      SUBROUTINE MAIN
      LOGICAL*1 LINE(512)
      INTEGER GETARG, OPEN
      INTEGER I, NFILES
      LOGICAL*1 FNAMES(40, 10)
      COMMON /CFORM/ CHAR1, CHAR2
      LOGICAL*1 CHAR1
      LOGICAL*1 CHAR2
      INTEGER MEM( 5000)
      LOGICAL*1 CMEM(10000)
      EQUIVALENCE (CMEM(1),MEM(1))
      COMMON/CDSMEM/MEM
      INTEGER PBP, PBSIZE
      LOGICAL*1 PBBUF(100)
      COMMON/CPBACK/PBP, PBSIZE, PBBUF
      LOGICAL*1 USESTR(32)
      DATA USESTR(1)/117/,USESTR(2)/115/,USESTR(3)/97/,USESTR(4)/103/,US
     *ESTR(5)/101/,USESTR(6)/58/,USESTR(7)/32/,USESTR(8)/32/,USESTR(9)/1
     *02/,USESTR(10)/111/,USESTR(11)/114/,USESTR(12)/109/,USESTR(13)/32/
     *,USESTR(14)/91/,USESTR(15)/45/,USESTR(16)/99/,USESTR(17)/93/,USEST
     *R(18)/32/,USESTR(19)/91/,USESTR(20)/43/,USESTR(21)/99/,USESTR(22)/
     *93/,USESTR(23)/32/,USESTR(24)/102/,USESTR(25)/105/,USESTR(26)/108/
     *,USESTR(27)/101/,USESTR(28)/32/,USESTR(29)/46/,USESTR(30)/46/,USES
     *TR(31)/46/,USESTR(32)/0/
      DATA CHAR1 /60/
      DATA CHAR2 /62/
      CALL QUERY(USESTR)
      CALL TBINIT(5000)
      CALL PBINIT(100)
      NFILES = 0
      I=1
23000 IF (.NOT.(GETARG(I, LINE, 512) .NE. -1))GOTO 23002
      IF (.NOT.(LINE(1) .EQ. 45 .AND. LINE(2) .NE. 0))GOTO 23003
      CHAR1 = LINE(2)
      GOTO 23004
23003 CONTINUE
      IF (.NOT.(LINE(1) .EQ. 43))GOTO 23005
      CHAR2 = LINE(2)
      GOTO 23006
23005 CONTINUE
      NFILES = NFILES + 1
      IF (.NOT.(NFILES .GT. 10))GOTO 23007
      CALL ERROR (19Htoo many file names)
23007 CONTINUE
      CALL SCOPY(LINE, 1, FNAMES(1, NFILES), 1)
23006 CONTINUE
23004 CONTINUE
23001 I=I+1
      GOTO 23000
23002 CONTINUE
      I=1
23009 IF (.NOT.(I.LE.NFILES))GOTO 23011
      INT = OPEN(FNAMES(1,I), 1)
      IF (.NOT.(INT .EQ. -3))GOTO 23012
      CALL CANT(FNAMES(1,I))
23012 CONTINUE
      CALL FORML(INT)
      CALL CLOSE(INT)
23010 I=I+1
      GOTO 23009
23011 CONTINUE
      IF (.NOT.(I .EQ. 1))GOTO 23014
      CALL ERROR (USESTR)
23014 CONTINUE
      RETURN
      END
      SUBROUTINE FORML(INT)
      INTEGER INT, TOG
      INTEGER FTOK, GUSER, TBLOOK
      LOGICAL*1 TOKEN(512), DEFN(5000)
      COMMON /CFORM/ CHAR1, CHAR2
      LOGICAL*1 CHAR1
      LOGICAL*1 CHAR2
      TOG = 0
23016 IF (.NOT.(FTOK(TOKEN, INT, TOG) .NE. -1))GOTO 23017
      IF (.NOT.(TOG .EQ. 1))GOTO 23018
      IF (.NOT.(TOKEN(1) .EQ. CHAR2))GOTO 23020
      TOG = 0
      GOTO 23016
23020 CONTINUE
      IF (.NOT.(TBLOOK(TOKEN, DEFN) .EQ. 0))GOTO 23022
      IF (.NOT.(GUSER(TOKEN, DEFN) .EQ. -1))GOTO 23024
      GOTO 23017
23024 CONTINUE
      CALL TBINST(TOKEN, DEFN)
23022 CONTINUE
      CALL PUTLIN(DEFN, 2)
      GOTO 23016
23018 CONTINUE
      IF (.NOT.(TOKEN(1) .EQ. CHAR1))GOTO 23026
      TOG = 1
      GOTO 23016
23026 CONTINUE
23019 CONTINUE
      CALL PUTLIN(TOKEN, 2)
      GOTO 23016
23017 CONTINUE
      RETURN
      END
      INTEGER FUNCTION FTOK(TOKEN, INT, PRFLAG)
      LOGICAL*1 TOKEN(100)
      INTEGER INT, PRFLAG
      LOGICAL*1 NGETCH
      COMMON /CFORM/ CHAR1, CHAR2
      LOGICAL*1 CHAR1
      LOGICAL*1 CHAR2
      I=1
23028 IF (.NOT.(I.LT. 5000))GOTO 23030
      FTOK = NGETCH(TOKEN(I), INT)
      IF (.NOT.(FTOK .EQ. -1 .OR. (PRFLAG .EQ. 0 .AND. FTOK .EQ. 10) .OR
     *. (I .EQ. 1 .AND. FTOK .EQ. CHAR1) .OR. (I .EQ. 1 .AND. FTOK .EQ. 
     *CHAR2) ))GOTO 23031
      GOTO 23030
23031 CONTINUE
      IF (.NOT.(FTOK .EQ. CHAR1 .OR. FTOK .EQ. CHAR2))GOTO 23033
      CALL PUTBAK(FTOK)
      IF (.NOT.(FTOK .EQ. CHAR2 .AND. PRFLAG .EQ. 1))GOTO 23035
      TOKEN(I) = 32
      GOTO 23036
23035 CONTINUE
      I = I - 1
23036 CONTINUE
      GOTO 23030
23033 CONTINUE
23029 I=I+1
      GOTO 23028
23030 CONTINUE
      IF (.NOT.(I .GE.5000))GOTO 23037
      CALL ERROR (15Htoken too long.)
23037 CONTINUE
      TOKEN(I+1) = 0
      RETURN
      END
      INTEGER FUNCTION GUSER(PSTR, REPL)
      LOGICAL*1 REPL(100), PSTR(100)
      INTEGER GETLIN, PROMPT
      INTEGER LTH
      LTH = 0
23039 CONTINUE
      IF (.NOT.(LTH .EQ. 0))GOTO 23042
      I = PROMPT(PSTR, REPL(LTH+1), 1)
      GOTO 23043
23042 CONTINUE
      I = GETLIN(REPL(LTH+1), 1)
23043 CONTINUE
      IF (.NOT.(I .EQ. -1))GOTO 23044
      GOTO 23041
23044 CONTINUE
      LTH = LTH + I
      IF (.NOT.(LTH .GE. 5000))GOTO 23046
      CALL REMARK (19Htruncating response)
      GOTO 23041
23046 CONTINUE
      IF (.NOT.(LTH .EQ. 1))GOTO 23048
      GOTO 23041
23048 CONTINUE
      IF (.NOT.(REPL(LTH) .EQ. 10 .AND. REPL(LTH-1) .NE. 45))GOTO 23050
      GOTO 23041
23050 CONTINUE
      LTH = LTH - 1
      REPL(LTH) = 10
23040 GOTO 23039
23041 CONTINUE
      IF (.NOT.(REPL(LTH) .EQ. 10))GOTO 23052
      LTH = LTH - 1
23052 CONTINUE
      REPL(LTH+1) = 0
      IF (.NOT.(I .EQ. -1))GOTO 23054
      GUSER = -1
      GOTO 23055
23054 CONTINUE
      GUSER = LTH
23055 CONTINUE
      RETURN
      END
