      subroutine STFINT(NEQN,Y,W,IW,TINIT,TFINAL,TINCR,
     &RELERR,ABSERR,IUNIT,TT,IIFLAG,TPRINT,TTYOUT,FOURU,NPRINT)
      double precision ABSER, ABSERR, DT, DTSGN,
     &                 EPSDT, RELER, RELERR, T, TFINAL, TPRINT,
     &                 TINCR, TINIT, TMAXIN, TOUT, TT, W, Y, FOURU
      double precision RVAR
      integer IVAR, IW, TTYOUT, NPRINT, INIT, KOP
      integer NEQN,IUNIT,K1,K2,K3,NEQ,IFLAG,JFLAG,IER,IIFLAG,IOLD
      logical LVAR
      dimension Y(NEQN), W(NEQN**2+17*NEQN), IW(NEQN)
      common/SFDATA/ T,TOUT,RELER,ABSER,DTSGN,NEQ,IFLAG,IOLD,
     &               INIT,KOP
      common/GEDATA/ RVAR(12),IVAR(7),LVAR
      if (IUNIT.gt.0) call STMESS (TTYOUT,10,NEQN,TINIT,TFINAL,TINCR,
     &   RELERR,ABSERR)
      K1 = NEQN+1
      K2 = K1+9*NEQN
      K3 = K2+7*NEQN
      NEQ = NEQN
      RELER = RELERR
      ABSER = ABSERR
      IFLAG = 1
      JFLAG = 1
      T = TINIT
      TOUT = TPRINT
      TMAXIN = dabs(TFINAL-TINIT)
      EPSDT = 0.001*dabs(TINCR)
      DT = dsign(TINCR,TFINAL-TINIT)
      IER = 0
100   continue
      call STIFF (Y,W(1),IW,W(K2),W(K3),W(K1),FOURU)
      if (IFLAG.ne.2) go to 110
      call OUTP (T,Y,W,JFLAG)
      JFLAG = IFLAG
      NPRINT = NPRINT+1
      if (dabs(T-TINIT).ge.TMAXIN) go to 210
      TOUT = T+DT
      if (dabs(TFINAL-TOUT).lt.EPSDT) TOUT = TFINAL
      go to 100
110   continue
      IER = IER+1
      go to (120,120,130,140,150,160,170,180,190), IFLAG
120   continue
      if (IUNIT.gt.0) call STMESS (TTYOUT,20,NEQN,TINIT,TFINAL,TINCR,
     &   RELERR,ABSERR)
      IFLAG = 9
      go to 220
130   continue
      if (IUNIT.gt.0) call STMESS (TTYOUT,30,NEQN,TINIT,TFINAL,TINCR,
     &   RELERR,ABSERR)
      if (IER.gt.4) go to 200
      go to 100
140   continue
      if (IUNIT.gt.0) call STMESS (TTYOUT,40,NEQN,TINIT,TFINAL,TINCR,
     &   RELERR,ABSERR)
      if (IER.gt.4) go to 200
      go to 100
150   continue
      RELER = RELER*5.
      ABSER = ABSER*5.
      if (IUNIT.gt.0) call STMESS (TTYOUT,50,NEQN,TINIT,TFINAL,TINCR,
     &   RELERR,ABSERR)
      if (IUNIT.eq.0) write (TTYOUT,5000)
5000  format (/'     Simulation RUN/CONTINUE in progress...')
      if (IER.gt.4) go to 200
      go to 100
160   continue
      if (IUNIT.gt.0) call STMESS (TTYOUT,60,NEQN,TINIT,TFINAL,TINCR,
     &   RELERR,ABSERR)
      if (IER.gt.4) go to 200
      go to 100
170   continue
      if (IUNIT.gt.0) call STMESS (TTYOUT,70,NEQN,TINIT,TFINAL,TINCR,
     &   RELERR,ABSERR)
      if (IER.gt.4) go to 200
      go to 100
180   continue
      if (IUNIT.gt.0) call STMESS (TTYOUT,80,NEQN,TINIT,TFINAL,TINCR,
     &   RELERR,ABSERR)
      go to 220
190   continue
      if (IUNIT.gt.0) call STMESS (TTYOUT,90,NEQN,TINIT,TFINAL,TINCR,
     &   RELERR,ABSERR)
      go to 220
200   continue
      if (IUNIT.gt.0) call STMESS (TTYOUT,92,NEQN,TINIT,TFINAL,TINCR,
     &   RELERR,ABSERR)
      go to 220
210   continue
      if (IUNIT.gt.0) call STMESS (TTYOUT,95,NEQN,TINIT,TFINAL,TINCR,
     &   RELERR,ABSERR)
220   continue
      TT = T
      IIFLAG = IFLAG
      TPRINT = TOUT
      return
      end
