      integer function istkst (nfact)
c
c returns control information as follows
c
c nfact    item returned
c
c   1    lout   the number of current allocations excluding
c               permanent storage allocations.  at the end of a
c               run, there should be no active allocations.
c   2    lnow   the current active length
c   3    ltotal the total maximum storage used so far.
c   4    lmax   the maximum allowed
c   5    lalc   the total number of allocations by istkgt so far
c   6    lneed  the number of words by which the stack must be
c               increased for all past allocations to succeed.
c
      common /cstak / dstak
c
      double precision dstak(500)
      integer istak(1000)
      integer istats(7)
      logical init
c
      equivalence (dstak(1), istak(1))
      equivalence (istak(1), istats(1))
c
      data init / .true. /
c
      if (init) call i0tk00 (init, 500, 4)
c
      if (nfact.le.0 .or. nfact.ge.7) call
     1  seterr (33histkst - nfact.le.0.or.nfact.ge.6, 33, 1, 2)
c
      if (nfact.eq.1) istkst = istats(1)
      if (nfact.eq.2) istkst = istats(2) + (istats(5)-istats(4)+1)
      if (nfact.eq.3) istkst = istats(3) + (istats(5)-istats(4)+1)
      if (nfact.eq.4) istkst = istats(5)
      if (nfact.eq.5) istkst = istats(6)
      if (nfact.eq.6) istkst = istats(7)
c
      return
c
      end