      SUBROUTINE stlim(string, iparse)
c		fwj haberl march 1988
c		subroutine for XPLOT
      INCLUDE 'xplot.inc'
      INTEGER*4 iparse, icom, iflag, idelim, ix, iy, nret
      CHARACTER*(*) string
      INTEGER*4 maxscm
      PARAMETER (maxscm=20)
      CHARACTER*1 cdum
      CHARACTER*(2) subcom(maxscm)
      REAL*4 limi(2)
      REAL*4 rmax
      DATA subcom/'x', 'x1', 'x2', 'x3', 'x4', 'x5', 'x6', 'x7', 'x8',
     &     'x9', 'y', 'y1', 'y2', 'y3', 'y4', 'y5', 'y6', 'y7', 'y8',
     &     'y9'/
      DATA rmax/1.e32/
 
      CALL xgtmch(string, iparse, subcom, maxscm, 'limits x y', icom,
     &            iflag, idelim, *900)
      IF (iflag.NE.0) THEN
         GOTO 900
      ENDIF
      limi(1) = rmax*1.01
      limi(2) = -rmax*1.01
      iflag = 0
      CALL xgtrl4(string, iparse, 2, 'limits', 1, limi, nret, iflag,
     &            idelim)
      IF (nret.LE.0) THEN
         GOTO 900
      ELSE
         IF (icom.EQ.1) THEN
            DO ix = 1, divx
               IF (limi(1).LT.rmax) limitx(1, ix) = limi(1)
               IF (limi(2).GT.-rmax) limitx(2, ix) = limi(2)
               qslimx(ix) = .TRUE.
            ENDDO
         ELSEIF (icom.EQ.11) THEN
            DO iy = 1, divy
               IF (limi(1).LT.rmax) limity(1, iy) = limi(1)
               IF (limi(2).GT.-rmax) limity(2, iy) = limi(2)
               qslimy(iy) = .TRUE.
            ENDDO
         ELSEIF (icom.LT.11) THEN
            READ (subcom(icom), '(a,i1)') cdum, ix
            IF (limi(1).LT.rmax) limitx(1, ix) = limi(1)
            IF (limi(2).GT.-rmax) limitx(2, ix) = limi(2)
            qslimx(ix) = .TRUE.
         ELSE
            READ (subcom(icom), '(a,i1)') cdum, iy
            IF (limi(1).LT.rmax) limity(1, iy) = limi(1)
            IF (limi(2).GT.-rmax) limity(2, iy) = limi(2)
            qslimy(iy) = .TRUE.
         ENDIF
      ENDIF
      RETURN
 900  CONTINUE
      WRITE (*, '(a)') ' Current plot limits:'
      WRITE (*, '(a)') '               X'
      DO ix = 1, divx
         WRITE (*, '(2g15.5)') limitx(1, ix), limitx(2, ix)
      ENDDO
      WRITE (*, '(a)') '               Y'
      DO iy = 1, divy
         WRITE (*, '(2g15.5)') limity(1, iy), limity(2, iy)
      ENDDO
      RETURN
      END
