      SUBROUTINE MAIN
      LOGICAL*1 BUF(402)
      INTEGER GTNWRD
      LOGICAL*1 ST001Z(27)
      DATA ST001Z(1)/117/,ST001Z(2)/115/,ST001Z(3)/97/,ST001Z(4)/103/,ST
     *001Z(5)/101/,ST001Z(6)/58/,ST001Z(7)/32/,ST001Z(8)/32/,ST001Z(9)/1
     *16/,ST001Z(10)/120/,ST001Z(11)/116/,ST001Z(12)/114/,ST001Z(13)/112
     */,ST001Z(14)/108/,ST001Z(15)/32/,ST001Z(16)/112/,ST001Z(17)/97/,ST
     *001Z(18)/116/,ST001Z(19)/102/,ST001Z(20)/105/,ST001Z(21)/108/,ST00
     *1Z(22)/101/,ST001Z(23)/32/,ST001Z(24)/46/,ST001Z(25)/46/,ST001Z(26
     *)/46/,ST001Z(27)/0/
      CALL QUERY(ST001Z)
      CALL INIPAT(BUF)
23000 IF (.NOT.(GTNWRD(BUF, 1) .NE. -1))GOTO 23001
      CALL REPLAC(BUF, 2)
      GOTO 23000
23001 CONTINUE
      RETURN
      END
      LOGICAL*1 FUNCTION GTCH(C, INT)
      LOGICAL*1 C
      INTEGER INT
      LOGICAL*1 GETCH
      LOGICAL*1 PBCHAR
      COMMON / CUNGET / PBCHAR
      IF (.NOT.(PBCHAR .NE. 0))GOTO 23002
      C = PBCHAR
      PBCHAR = 0
      GOTO 23003
23002 CONTINUE
      C = GETCH(C, INT)
23003 CONTINUE
      GTCH=(C)
      RETURN
      END
      INTEGER FUNCTION GTNWRD(BUF, INT)
      LOGICAL*1 BUF(402), C, TRMCHR
      INTEGER INT
      INTEGER I, T
      LOGICAL*1 GTCH
      INTEGER TYPE, LENGTH
      C = GTCH(BUF(1), INT)
      BUF(2) = 0
      IF (.NOT.(C .EQ. -1))GOTO 23004
      GTNWRD=(-1)
      RETURN
23004 CONTINUE
      I = 2
      IF (.NOT.(TYPE(C) .EQ. 1))GOTO 23006
23008 IF (.NOT.(GTCH(C, INT) .NE. -1))GOTO 23009
      T = TYPE(C)
      IF (.NOT.(T .NE. 1 .AND. T .NE. 2 .AND. T .NE. 95))GOTO 23010
      GOTO 23009
23010 CONTINUE
      CALL CHCOPY(C, BUF, I)
23011 CONTINUE
      GOTO 23008
23009 CONTINUE
      CALL UNGTCH(C, INT)
      GOTO 23007
23006 CONTINUE
      IF (.NOT.(C .EQ. 34))GOTO 23012
      TRMCHR = C
23014 IF (.NOT.(GTCH(C, INT) .NE. -1))GOTO 23015
      CALL CHCOPY(C, BUF, I)
      IF (.NOT.(C .EQ. TRMCHR .AND. BUF(I-2) .NE. 64))GOTO 23016
      GOTO 23015
23016 CONTINUE
      GOTO 23014
23015 CONTINUE
      GOTO 23013
23012 CONTINUE
      IF (.NOT.(C .EQ. 39))GOTO 23018
      C = GTCH(C, INT)
      CALL CHCOPY(C, BUF, I)
      IF (.NOT.(C .EQ. 64))GOTO 23020
      C = GTCH(C, INT)
      CALL CHCOPY(C, BUF, I)
23020 CONTINUE
      C = GTCH(C, INT)
      CALL CHCOPY(C, BUF, I)
      GOTO 23019
23018 CONTINUE
      IF (.NOT.(C .EQ. 35))GOTO 23022
23024 IF (.NOT.(GTCH(C, INT) .NE. -1))GOTO 23025
      CALL CHCOPY(C, BUF, I)
      IF (.NOT.(C .EQ. 10))GOTO 23026
      GOTO 23025
23026 CONTINUE
      GOTO 23024
23025 CONTINUE
23022 CONTINUE
23019 CONTINUE
23013 CONTINUE
23007 CONTINUE
      GTNWRD=(LENGTH(BUF))
      RETURN
      END
      SUBROUTINE INIPAT(BUF)
      LOGICAL*1 BUF(402), PAT(402), FILE(36)
      INTEGER I, J, JUNK
      INTEGER INT
      INTEGER GETARG, GETLIN, GETWRD, LENGTH
      INTEGER OPEN
      INTEGER MEM( 5000)
      LOGICAL*1 CMEM(10000)
      LOGICAL*1 PBCHAR
      COMMON /CDSMEM/ MEM
      COMMON / CUNGET / PBCHAR
      EQUIVALENCE (CMEM(1),MEM(1))
      PBCHAR = 0
      CALL TBINIT(5000)
      I=1
23028 IF (.NOT.(GETARG(I, FILE, 36) .NE. -1))GOTO 23030
      INT = OPEN(FILE, 1)
      IF (.NOT.(INT .EQ. -3))GOTO 23031
      CALL CANT(FILE)
23031 CONTINUE
23033 IF (.NOT.(GETLIN(BUF, INT) .NE. -1))GOTO 23034
      J = 1
      JUNK = GETWRD(BUF, J, PAT)
      CALL SKIPBL(BUF, J)
      CALL SCOPY(BUF, J, BUF, 1)
      J = LENGTH(BUF)
      BUF(J) = 0
      CALL TBINST(PAT, BUF)
      GOTO 23033
23034 CONTINUE
      CALL CLOSE(INT)
23029 I=I+1
      GOTO 23028
23030 CONTINUE
      RETURN
      END
      SUBROUTINE UNGTCH(C, INT)
      LOGICAL*1 C
      INTEGER INT
      LOGICAL*1 PBCHAR
      LOGICAL*1 ST002Z(45)
      COMMON / CUNGET / PBCHAR
      DATA ST002Z(1)/65/,ST002Z(2)/116/,ST002Z(3)/116/,ST002Z(4)/101/,ST
     *002Z(5)/109/,ST002Z(6)/112/,ST002Z(7)/116/,ST002Z(8)/32/,ST002Z(9)
     */116/,ST002Z(10)/111/,ST002Z(11)/32/,ST002Z(12)/112/,ST002Z(13)/11
     *7/,ST002Z(14)/115/,ST002Z(15)/104/,ST002Z(16)/32/,ST002Z(17)/98/,S
     *T002Z(18)/97/,ST002Z(19)/99/,ST002Z(20)/107/,ST002Z(21)/32/,ST002Z
     *(22)/109/,ST002Z(23)/111/,ST002Z(24)/114/,ST002Z(25)/101/,ST002Z(2
     *6)/32/,ST002Z(27)/116/,ST002Z(28)/104/,ST002Z(29)/97/,ST002Z(30)/1
     *10/,ST002Z(31)/32/,ST002Z(32)/111/,ST002Z(33)/110/,ST002Z(34)/101/
     *,ST002Z(35)/32/,ST002Z(36)/99/,ST002Z(37)/104/,ST002Z(38)/97/,ST00
     *2Z(39)/114/,ST002Z(40)/97/,ST002Z(41)/99/,ST002Z(42)/116/,ST002Z(4
     *3)/101/,ST002Z(44)/114/,ST002Z(45)/0/
      IF (.NOT.(PBCHAR .NE. 0))GOTO 23035
      CALL ERROR(ST002Z)
23035 CONTINUE
      PBCHAR = C
      RETURN
      END
      SUBROUTINE REPLAC(BUF, OUT)
      LOGICAL*1 BUF(402), DEFN(402)
      INTEGER OUT
      INTEGER TBLOOK
      IF (.NOT.(TBLOOK(BUF, DEFN) .EQ. 1))GOTO 23037
      CALL PUTLIN(DEFN, OUT)
      GOTO 23038
23037 CONTINUE
      CALL PUTLIN(BUF, OUT)
23038 CONTINUE
      RETURN
      END