      SUBROUTINE GETSYM
      IMPLICIT NONE
C
C GET A SYMBOL
C
      INCLUDE MATLAB$KOM:SIZEPARMS.INC
      INCLUDE MATLAB$KOM:VSTK.KOM
      INCLUDE MATLAB$KOM:ALFS.KOM
      INCLUDE MATLAB$KOM:IOP.KOM
      INCLUDE MATLAB$KOM:COM.KOM
C
      DOUBLE PRECISION SYV, S
      INTEGER BLANK, Z, DOT, D, E, PLUS, MINUS, NAME, NUM, SIGN
     .        CHCNT, EOL, STAR, SLASH, BSLASH, SS, CHCNT, I
C
      DOUBLE PRECISION FLOP
C
      DATA BLANK / 36 /, Z / 35 /, DOT / 47 /, D / 13 /, E / 14 /
      DATA EOL / 99 /, PLUS / 41 /,  MINUS / 42 /, NAME / 1 /
      DATA NUM / 0 /, STAR / 43 /, SLASH / 44 /, BSLASH / 45 /
C
C
10    CONTINUE
      IF (CHAR.NE.BLANK) GO TO 20
      CALL GETCH
      GO TO 10
C
20    CONTINUE
      LPT(2) = LPT(3)
      LPT(3) = LPT(4)
      IF (CHAR.LE.9) GO TO 50
      IF (CHAR.LE.Z) GO TO 30
C
C ***      SPECIAL CHARACTER
      SS = SYM
      SYM = CHAR
      CALL GETCH
      IF (SYM.NE.DOT) GO TO 90
C
C ***      IS DOT PART OF NUMBER OR OPERATOR
      SYV = 0.0D0
      IF (CHAR.LE.9) GO TO 55
      IF (CHAR.EQ.STAR .OR. CHAR.EQ.SLASH .OR. CHAR.EQ.BSLASH) GO TO 90
      IF (SS.EQ.STAR .OR. SS.EQ.SLASH .OR. SS.EQ.BSLASH) GO TO 90
      GO TO 55
C
C ***      NAME
30    CONTINUE
      SYM = NAME
      SYN(1) = CHAR
      CHCNT = 1
40    CONTINUE
      CALL GETCH
      CHCNT = CHCNT+1
      IF (CHAR.GT.Z) GO TO 45
      IF (CHCNT.LE.4) SYN(CHCNT) = CHAR
      GO TO 40
C
45    CONTINUE
      IF (CHCNT.GT.4) GO TO 47
      DO 46 I = CHCNT, 4
        SYN(I) = BLANK
46    CONTINUE
47    CONTINUE
      GO TO 90
C
C ***      NUMBER
50    CONTINUE
      CALL GETVAL (SYV)
      IF (CHAR.NE.DOT) GO TO 60
      CALL GETCH
55    CONTINUE
      CHCNT = LPT(4)
      CALL GETVAL (S)
      CHCNT = LPT(4)-CHCNT
      IF (CHAR.EQ.EOL) CHCNT = CHCNT+1
      SYV = SYV+S/10.0D0**CHCNT
60    CONTINUE
      IF (CHAR.NE.D .AND. CHAR.NE.E) GO TO 70
      CALL GETCH
      SIGN = CHAR
      IF (SIGN.EQ.MINUS .OR. SIGN.EQ.PLUS) CALL GETCH
      CALL GETVAL (S)
      IF (SIGN.NE.MINUS) SYV = SYV*10.0D0**S
      IF (SIGN.EQ.MINUS) SYV = SYV/10.0D0**S
70    CONTINUE
      STKI(VSIZE) = FLOP (SYV)
      SYM = NUM
C
90    CONTINUE
      IF (CHAR.NE.BLANK) GO TO 99
      CALL GETCH
      GO TO 90
C
99    CONTINUE
      IF (DDT.NE.1) RETURN
      IF (SYM.GT.NAME .AND. SYM.LT.ALFL) WRITE (WTE, 197) ALFA(SYM+1)
197   FORMAT (1X, A1)
      IF (SYM.GE.ALFL) WRITE (WTE, 198)
198   FORMAT (' EOL')
      IF (SYM.EQ.NAME) CALL PRNTID (SYN, 1)
      IF (SYM.EQ.NUM) WRITE (WTE, 199) SYV
199   FORMAT (1X, G8.2)
      RETURN
      END
