      SUBROUTINE stlab(string, iparse, mlabel, dset, dset_new)
c		fwj haberl march 1988
c		subroutine for XPLOT
      INCLUDE 'xplot.inc'
      INTEGER*4 iparse, dset, dset_new
      INTEGER*4 icom, iscom, iflag, idlm, ix, iy, ibeg, iend, nret
      INTEGER*4 iset, is, ivlab
      CHARACTER*(*) string, mlabel
      INTEGER*4 maxscm, maxssc
      PARAMETER (maxscm=52, maxssc=4)
      CHARACTER*1 cdum
      CHARACTER*3 subcom(maxscm)
      CHARACTER*5 subsubcom(maxssc)
      REAL*4 plen
      LOGICAL qskip
      DATA subcom/'x', 'x1', 'x2', 'x3', 'x4', 'x5', 'x6', 'x7', 'x8',
     &     'x9', 'y', 'y1', 'y2', 'y3', 'y4', 'y5', 'y6', 'y7', 'y8',
     &     'y9', 't', 't1', 't2', 't3', 't4', 't5', 't6', 't7', 't8',
     &     't9', 'tl', 'tl1', 'tl2', 'tl3', 'tl4', 'tl5', 'tl6', 'tl7',
     &     'tl8', 'tl9', 'tr', 'tr1', 'tr2', 'tr3', 'tr4', 'tr5', 'tr6',
     &     'tr7', 'tr8', 'tr9', 'in', 'pos'/
      DATA subsubcom/'on', 'off', 'write', 'model'/
 
      CALL xgtmch(string, iparse, subcom, maxscm, 'lables', icom, iflag,
     &            idlm, *900)
      IF (iflag.NE.0) THEN
         GOTO 900
      ENDIF
      CALL xgtarg(string, iparse, ibeg, iend, qskip, iflag, idlm)
      IF (iend.LT.ibeg) THEN
         GOTO 900
      ENDIF
      IF (string(ibeg-1:ibeg-1).EQ.'"' .AND. string(iend+1:iend+1)
     &    .EQ.'"') THEN
         string(iend+1:iend+1) = ' '
      ENDIF
      iset = dset+dset_new
      IF (icom.EQ.1) THEN
         DO ix = 1, divx
            DO is = 1, iset
               IF (pos(1, is).eq.ix .or. pos(1, is).eq.0)
     &            xlab(is) = string(ibeg:)
            ENDDO
         ENDDO
      ELSEIF (icom.EQ.11) THEN
         DO iy = 1, divy
            DO is = 1, iset
               IF (pos(2, is).eq.iy .or. pos(2, is).eq.0)
     &            ylab(is) = string(ibeg:)
            ENDDO
         ENDDO
      ELSEIF (icom.EQ.21) THEN
         DO ix = 1, divx
            DO is = 1, iset
               IF (pos(1, is).eq.ix .or. pos(1, is).eq.0)
     &            phead(is) = string(ibeg:)
            ENDDO
         ENDDO
         IF (framey2(divy).GT.0.89) THEN
            plen = offsety/divy
            DO iy = 1, divy
               pleny(iy) = pleny(iy) - plen
            ENDDO
            CALL frame
         ENDIF
      ELSEIF (icom.EQ.31) THEN
         DO ix = 1, divx
            DO is = 1, iset
               IF (pos(1, is).eq.ix .or. pos(1, is).eq.0)
     &            tllab(is) = string(ibeg:)
            ENDDO
         ENDDO
         IF (framey2(divy).GT.0.89) THEN
            plen = offsety/divy
            DO iy = 1, divy
               pleny(iy) = pleny(iy) - plen
            ENDDO
            CALL frame
         ENDIF
      ELSEIF (icom.EQ.41) THEN
         DO ix = 1, divx
            DO is = 1, iset
               IF (pos(1, is).eq.ix .or. pos(1, is).eq.0)
     &            trlab(is) = string(ibeg:)
            ENDDO
         ENDDO
         IF (framey2(divy).GT.0.89) THEN
            plen = offsety/divy
            DO iy = 1, divy
               pleny(iy) = pleny(iy) - plen
            ENDDO
            CALL frame
         ENDIF
      ELSEIF (icom.EQ.51) THEN
         CALL xmatch(string(ibeg:iend), subsubcom, maxssc, iscom, *900)
         IF (iscom.EQ.1) THEN
            qabc = .TRUE.
         ELSEIF (iscom.EQ.2) THEN
            qabc = .FALSE.
         ELSEIF (iscom.EQ.3) THEN
            qabc = .TRUE.
            CALL xgtint(string, iparse, 1, 'x-pos', 1, ix, nret, iflag,
     &                  idlm)
            CALL xgtint(string, iparse, 1, 'y-pos', 1, iy, nret, iflag,
     &                  idlm)
            CALL xgtarg(string, iparse, ibeg, iend, qskip, iflag, idlm)
            IF (string(ibeg-1:ibeg-1).EQ.'"' .AND. string(iend+1:iend+1)
     &          .EQ.'"') THEN
               string(iend+1:iend+1) = ' '
            ENDIF
            IF (iend.LT.ibeg) THEN
               abc(ix, iy) = ' '
            ELSE
               abc(ix, iy) = string(ibeg:)
            ENDIF
         ELSEIF (iscom.EQ.4) THEN
            qabc = .TRUE.
            CALL xgtint(string, iparse, 1, 'x-pos', 1, ix, nret, iflag,
     &                  idlm)
            CALL xgtint(string, iparse, 1, 'y-pos', 1, iy, nret, iflag,
     &                  idlm)
            abc(ix, iy) = mlabel
            mlabel = ' '
         ENDIF
      ELSEIF (icom.EQ.52) THEN
         iparse = ibeg -1
         CALL xgtint(string, iparse, 1, 'lab #', 1, ivlab, 
     &               nret, iflag, idlm)
         CALL xgtrl4(string, iparse, 1, 'x-vpos', 1, vpos(ivlab,1), 
     &               nret, iflag, idlm)
         CALL xgtrl4(string, iparse, 1, 'y-vpos', 1, vpos(ivlab,2), 
     &               nret, iflag, idlm)
         CALL xgtstr(string, iparse, 1, 'label', 1, vlab(ivlab), 
     &               nret, iflag, idlm)
      ELSEIF (icom.LT.11) THEN
         READ (subcom(icom), '(a1,i1)') cdum, ix
         DO is = 1, iset
            IF (pos(1, is).eq.ix .or. pos(1, is).eq.0)
     &         xlab(is) = string(ibeg:)
         ENDDO
      ELSEIF (icom.LT.21) THEN
         READ (subcom(icom), '(a1,i1)') cdum, iy
         DO is = 1, iset
            IF (pos(2, is).eq.iy .or. pos(2, is).eq.0)
     &         ylab(is) = string(ibeg:)
         ENDDO
      ELSEIF (icom.LT.31) THEN
         READ (subcom(icom), '(a1,i1)') cdum, ix
         DO is = 1, iset
            IF (pos(1, is).eq.ix .or. pos(1, is).eq.0)
     &         phead(is) = string(ibeg:)
         ENDDO
         IF (framey2(divy).GT.0.89) THEN
            plen = offsety/divy
            DO iy = 1, divy
               pleny(iy) = pleny(iy) - plen
            ENDDO
            CALL frame
         ENDIF
      ELSEIF (icom.LT.41) THEN
         READ (subcom(icom), '(2a1,i1)') cdum, cdum, ix
         DO is = 1, iset
            IF (pos(1, is).eq.ix .or. pos(1, is).eq.0)
     &         tllab(is) = string(ibeg:)
         ENDDO
         IF (framey2(divy).GT.0.89) THEN
            plen = offsety/divy
            DO iy = 1, divy
               pleny(iy) = pleny(iy) - plen
            ENDDO
            CALL frame
         ENDIF
      ELSEIF (icom.LT.51) THEN
         READ (subcom(icom), '(2a1,i1)') cdum, cdum, ix
         DO is = 1, iset
            IF (pos(1, is).eq.ix .or. pos(1, is).eq.0)
     &         trlab(is) = string(ibeg:)
         ENDDO
         IF (framey2(divy).GT.0.89) THEN
            plen = offsety/divy
            DO iy = 1, divy
               pleny(iy) = pleny(iy) - plen
            ENDDO
            CALL frame
         ENDIF
      ENDIF
 900  RETURN
      END
