      SUBROUTINE MAIN
      LOGICAL*1 ARG(402), LINBUF(402), CLOWER
      INTEGER I, J, NFILES, FD
      INTEGER LENGTH, GETARG, OPEN, GETLIN
      INTEGER AQ
      INTEGER IQ
      INTEGER BUF
      INTEGER LASTBF
      INTEGER NLINES
      INTEGER LINE1
      INTEGER LINE2
      INTEGER PAT
      INTEGER PREVC
      INTEGER NFLAG
      INTEGER QFLAG
      LOGICAL*1 USE(67)
      COMMON /CSEDIT/ AQ, IQ, BUF(5000), LASTBF, NLINES, LINE1, LINE2, P
     *AT(132), PREVC, NFLAG, QFLAG
      DATA USE(1)/117/,USE(2)/115/,USE(3)/97/,USE(4)/103/,USE(5)/101/,US
     *E(6)/58/,USE(7)/32/,USE(8)/32/,USE(9)/115/,USE(10)/101/,USE(11)/10
     *0/,USE(12)/105/,USE(13)/116/,USE(14)/32/,USE(15)/91/,USE(16)/45/,U
     *SE(17)/110/,USE(18)/93/,USE(19)/32/,USE(20)/123/,USE(21)/91/,USE(2
     *2)/45/,USE(23)/101/,USE(24)/32/,USE(25)/115/,USE(26)/99/,USE(27)/1
     *14/,USE(28)/105/,USE(29)/112/,USE(30)/116/,USE(31)/32/,USE(32)/124
     */,USE(33)/32/,USE(34)/45/,USE(35)/102/,USE(36)/32/,USE(37)/115/,US
     *E(38)/102/,USE(39)/105/,USE(40)/108/,USE(41)/101/,USE(42)/115/,USE
     *(43)/93/,USE(44)/46/,USE(45)/46/,USE(46)/46/,USE(47)/32/,USE(48)/1
     *24/,USE(49)/32/,USE(50)/115/,USE(51)/99/,USE(52)/114/,USE(53)/105/
     *,USE(54)/112/,USE(55)/116/,USE(56)/125/,USE(57)/32/,USE(58)/91/,US
     *E(59)/102/,USE(60)/105/,USE(61)/108/,USE(62)/101/,USE(63)/93/,USE(
     *64)/46/,USE(65)/46/,USE(66)/46/,USE(67)/0/
      CALL QUERY(USE)
      PREVC = 1
      BUF(1+1) = 0
      BUF(1+6) = 0
      BUF(6+1+6) = 0
      LASTBF = 6+1+7
      NFLAG = 0
      QFLAG = 0
      NFILES = 0
      I = 1
      IF (.NOT.(GETARG (I, ARG, 402) .EQ. -1))GOTO 23000
      CALL ERROR(USE)
23000 CONTINUE
      IF (.NOT.(ARG(1) .EQ. 45 .AND. CLOWER(ARG(2)) .EQ. 110))GOTO 23002
      NFLAG = 1
      I = I + 1
23002 CONTINUE
23004 IF (.NOT.(GETARG(I, ARG, 402) .NE. -1))GOTO 23006
      IF (.NOT.(ARG(1) .EQ. 45 .AND. CLOWER(ARG(2)) .EQ. 102))GOTO 23007
      IF (.NOT.(ARG(3) .NE. 0))GOTO 23009
      CALL SCOPY( ARG, 3, ARG, 1)
      GOTO 23010
23009 CONTINUE
      I = I+1
      IF (.NOT.(GETARG(I, ARG, 402) .EQ. -1))GOTO 23011
      CALL ERROR(USE)
23011 CONTINUE
23010 CONTINUE
      IF (.NOT.(ARG(1) .EQ. 45 .AND. ARG(2) .EQ. 0))GOTO 23013
      FD = 1
      GOTO 23014
23013 CONTINUE
      FD = OPEN(ARG, 1)
23014 CONTINUE
      IF (.NOT.(FD .EQ. -3))GOTO 23015
      CALL CANT(ARG)
23015 CONTINUE
23017 IF (.NOT.(GETLIN(ARG, FD) .NE. -1))GOTO 23018
      CALL COMPIL(ARG, FD)
      GOTO 23017
23018 CONTINUE
      IF (.NOT.(FD .NE. 1))GOTO 23019
      CALL CLOSE(FD)
23019 CONTINUE
      GOTO 23008
23007 CONTINUE
      IF (.NOT.(ARG(1) .EQ. 45 .AND. CLOWER(ARG(2)) .EQ. 101))GOTO 23021
      IF (.NOT.(ARG(3) .NE. 0))GOTO 23023
      CALL SCOPY( ARG, 3, ARG, 1)
      GOTO 23024
23023 CONTINUE
      I = I+1
      IF (.NOT.(GETARG(I, ARG, 402) .EQ. -1))GOTO 23025
      CALL ERROR(USE)
23025 CONTINUE
23024 CONTINUE
      J = LENGTH(ARG)
      ARG(J+1) = 10
      ARG(J+2) = 0
      CALL COMPIL(ARG, 0)
      GOTO 23022
23021 CONTINUE
      GOTO 23006
23022 CONTINUE
23008 CONTINUE
23005 I=I+1
      GOTO 23004
23006 CONTINUE
      IF (.NOT.(LASTBF .EQ. 6+1+7))GOTO 23027
      IF (.NOT.(GETARG(I, ARG, 402) .EQ. -1))GOTO 23029
      CALL ERROR(USE)
23029 CONTINUE
      J = LENGTH(ARG)
      ARG(J+1) = 10
      ARG(J+2) = 0
      CALL COMPIL(ARG, 0)
      I = I + 1
23027 CONTINUE
      LINBUF(1) = 0
      LINENO = 0
      CALL DOCMDS(LINBUF,0)
23031 IF (.NOT.(QFLAG.NE.1 .AND. GETARG(I,ARG,402).NE.-1))GOTO 23033
      IF (.NOT.(ARG(1) .EQ. 45 .AND. ARG(2) .EQ. 0))GOTO 23034
      FD = 1
      GOTO 23035
23034 CONTINUE
      FD = OPEN(ARG, 1)
23035 CONTINUE
      IF (.NOT.(FD .EQ. -3))GOTO 23036
      CALL CANT(ARG)
23036 CONTINUE
      CALL SED(LINBUF, LINENO, FD)
      IF (.NOT.(FD .NE. 1))GOTO 23038
      CALL CLOSE(FD)
23038 CONTINUE
      NFILES = NFILES + 1
23032 I = I + 1
      GOTO 23031
23033 CONTINUE
      IF (.NOT.(QFLAG.NE.1 .AND. NFILES .EQ. 0))GOTO 23040
      CALL SED(LINBUF, LINENO, 1)
23040 CONTINUE
      IF (.NOT.(QFLAG.NE.1 .AND. LINBUF(1) .NE. 0))GOTO 23042
      LINENO = LINENO + 1
      I = BUF(1+1)
23044 IF (.NOT.(I .GT. 0))GOTO 23046
      IF (.NOT.(BUF(I+2) .EQ. -30000))GOTO 23047
      BUF(I+2) = -LINENO
23047 CONTINUE
      IF (.NOT.(BUF(I+3) .EQ. -30000))GOTO 23049
      BUF(I+3) = -LINENO
23049 CONTINUE
      IF (.NOT.(BUF(I+5) .EQ. 99))GOTO 23051
      IF (.NOT.(BUF(I+0) .EQ. 2))GOTO 23053
      BUF(I+0) = 1
23053 CONTINUE
      IF (.NOT.(BUF(I+0) .EQ. 3 .AND. (BUF(I+3) .GT. 0 .OR. -BUF(I+3) .G
     *E. LINENO)))GOTO 23055
      BUF(I+3) = -LINENO
23055 CONTINUE
23051 CONTINUE
23045 I = BUF(I+1)
      GOTO 23044
23046 CONTINUE
      CALL DOCMDS(LINBUF, LINENO)
23042 CONTINUE
      RETURN
      END
      INTEGER FUNCTION INSSTR(S, STR, J, MAXSIZ)
      LOGICAL*1 S(100)
      INTEGER J, MAXSIZ, STR(100)
      INTEGER I, ADDINT, INT
      I = 1
23057 IF (.NOT.(S(I) .NE. 0))GOTO 23059
      INT = S(I)
      IF (.NOT.(ADDINT(INT, STR, J, MAXSIZ) .EQ. 0))GOTO 23060
      INSSTR=(0)
      RETURN
23060 CONTINUE
23058 I = I + 1
      GOTO 23057
23059 CONTINUE
      INSSTR=(1)
      RETURN
      END
      INTEGER FUNCTION CKP(LIN, I, PFLAG, STATUS)
      LOGICAL*1 LIN(402)
      INTEGER I, J, PFLAG, STATUS
      LOGICAL*1 CLOWER
      J = I
      IF (.NOT.(CLOWER(LIN(J)) .EQ. 112))GOTO 23062
      J = J + 1
      PFLAG = 1
      GOTO 23063
23062 CONTINUE
      PFLAG = 0
23063 CONTINUE
      IF (.NOT.(LIN(J) .EQ. 10))GOTO 23064
      STATUS = 1
      GOTO 23065
23064 CONTINUE
      STATUS = -3
23065 CONTINUE
      CKP = STATUS
      RETURN
      END
      SUBROUTINE COMPIL(LIN, FD)
      LOGICAL*1 LIN(402), COM
      INTEGER FD
      LOGICAL*1 FILE(36), SUB(132)
      INTEGER I, J, GFLAG, PFLAG, STATUS, FDW
      INTEGER ADDINT, ADDSI, INSSTR, ADDPAT, PATSIZ
      INTEGER CREATE, GETRHS, GETFN, CKP, OPTPAT, DOTEXT, GETLST, LENGTH
      LOGICAL*1 CLOWER
      INTEGER AQ
      INTEGER IQ
      INTEGER BUF
      INTEGER LASTBF
      INTEGER NLINES
      INTEGER LINE1
      INTEGER LINE2
      INTEGER PAT
      INTEGER PREVC
      INTEGER NFLAG
      INTEGER QFLAG
      LOGICAL*1 ST001Z(17)
      LOGICAL*1 ST002Z(18)
      LOGICAL*1 ST003Z(16)
      COMMON /CSEDIT/ AQ, IQ, BUF(5000), LASTBF, NLINES, LINE1, LINE2, P
     *AT(132), PREVC, NFLAG, QFLAG
      DATA ST001Z(1)/98/,ST001Z(2)/97/,ST001Z(3)/100/,ST001Z(4)/32/,ST00
     *1Z(5)/108/,ST001Z(6)/105/,ST001Z(7)/110/,ST001Z(8)/101/,ST001Z(9)/
     *32/,ST001Z(10)/110/,ST001Z(11)/117/,ST001Z(12)/109/,ST001Z(13)/98/
     *,ST001Z(14)/101/,ST001Z(15)/114/,ST001Z(16)/115/,ST001Z(17)/0/
      DATA ST002Z(1)/116/,ST002Z(2)/111/,ST002Z(3)/111/,ST002Z(4)/32/,ST
     *002Z(5)/109/,ST002Z(6)/97/,ST002Z(7)/110/,ST002Z(8)/121/,ST002Z(9)
     */32/,ST002Z(10)/99/,ST002Z(11)/111/,ST002Z(12)/109/,ST002Z(13)/109
     */,ST002Z(14)/97/,ST002Z(15)/110/,ST002Z(16)/100/,ST002Z(17)/115/,S
     *T002Z(18)/0/
      DATA ST003Z(1)/105/,ST003Z(2)/110/,ST003Z(3)/118/,ST003Z(4)/97/,ST
     *003Z(5)/108/,ST003Z(6)/105/,ST003Z(7)/100/,ST003Z(8)/32/,ST003Z(9)
     */99/,ST003Z(10)/111/,ST003Z(11)/109/,ST003Z(12)/109/,ST003Z(13)/97
     */,ST003Z(14)/110/,ST003Z(15)/100/,ST003Z(16)/0/
      STATUS = -3
      I = 1
      IF (.NOT.(GETLST(LIN, I, STATUS) .EQ. -3))GOTO 23066
      CALL PUTLIN(LIN, 3)
      CALL ERROR(ST001Z)
23066 CONTINUE
      CALL SKIPBL(LIN, I)
      BUF(PREVC+1) = LASTBF
      PREVC = LASTBF
      STATUS = ADDINT(NLINES, BUF, LASTBF, 5000)
      STATUS = ADDINT(0, BUF, LASTBF, 5000)
      STATUS = ADDINT(LINE1, BUF, LASTBF, 5000)
      STATUS = ADDINT(LINE2, BUF, LASTBF, 5000)
      COM = CLOWER(LIN(I))
      IF (.NOT.(COM .EQ. 33))GOTO 23068
      STATUS = ADDINT(1, BUF, LASTBF, 5000)
      I = I+1
      CALL SKIPBL(LIN, I)
      COM = CLOWER(LIN(I))
      GOTO 23069
23068 CONTINUE
      STATUS = ADDINT(0, BUF, LASTBF, 5000)
23069 CONTINUE
      STATUS = ADDINT(COM, BUF, LASTBF, 5000)
      IF (.NOT.(COM .EQ. 97 .AND. FD .NE. 0))GOTO 23070
      STATUS = ADDINT(0, BUF, LASTBF, 5000)
      STATUS = DOTEXT(FD)
      GOTO 23071
23070 CONTINUE
      IF (.NOT.(COM .EQ. 99 .AND. FD .NE. 0))GOTO 23072
      STATUS = ADDINT(0, BUF, LASTBF, 5000)
      STATUS = DOTEXT(FD)
      GOTO 23073
23072 CONTINUE
      IF (.NOT.(COM .EQ. 100))GOTO 23074
      STATUS = 1
      GOTO 23075
23074 CONTINUE
      IF (.NOT.(COM .EQ. 105 .AND. FD .NE. 0))GOTO 23076
      STATUS = ADDINT(0, BUF, LASTBF, 5000)
      STATUS = DOTEXT(FD)
      GOTO 23077
23076 CONTINUE
      IF (.NOT.(COM .EQ. 112))GOTO 23078
      STATUS = 1
      GOTO 23079
23078 CONTINUE
      IF (.NOT.(COM .EQ. 113))GOTO 23080
      STATUS = 1
      GOTO 23081
23080 CONTINUE
      IF (.NOT.(COM .EQ. 114))GOTO 23082
      STATUS = ADDINT(0, BUF, LASTBF, 5000)
      STATUS = GETFN(LIN, I, FILE)
      IF (.NOT.(STATUS .EQ. 1))GOTO 23084
      STATUS = INSSTR(FILE, BUF, LASTBF, 5000)
      STATUS = ADDINT(0, BUF, LASTBF, 5000)
23084 CONTINUE
      GOTO 23083
23082 CONTINUE
      IF (.NOT.(COM .EQ. 115))GOTO 23086
      I = I + 1
      IF (.NOT.(OPTPAT(LIN, I) .EQ. 1))GOTO 23088
      IF (.NOT.(GETRHS(LIN, I, SUB, GFLAG) .EQ. 1))GOTO 23090
      STATUS = CKP(LIN, I + 1, PFLAG, STATUS)
23090 CONTINUE
23088 CONTINUE
      IF (.NOT.(STATUS .EQ. 1))GOTO 23092
      STATUS = ADDINT(GFLAG, BUF, LASTBF, 5000)
      STATUS = ADDINT(PFLAG, BUF, LASTBF, 5000)
      STATUS = ADDINT(LASTBF+2, BUF, LASTBF, 5000)
      J=1
23094 IF (.NOT.(PAT(J).NE.0))GOTO 23096
23095 J=J+PATSIZ(PAT,J)
      GOTO 23094
23096 CONTINUE
      STATUS = ADDINT(LASTBF+J+1, BUF, LASTBF, 5000)
      STATUS = ADDPAT(PAT, BUF, LASTBF, 5000)
      STATUS = INSSTR(SUB, BUF, LASTBF, 5000)
      STATUS = ADDINT(0, BUF, LASTBF, 5000)
23092 CONTINUE
      GOTO 23087
23086 CONTINUE
      IF (.NOT.(COM .EQ. 119))GOTO 23097
      STATUS = GETFN(LIN, I, FILE)
      IF (.NOT.(STATUS .EQ. 1))GOTO 23099
      FDW = CREATE(FILE, 2)
      IF (.NOT.(FDW .EQ. -3))GOTO 23101
      CALL CANT(FILE)
23101 CONTINUE
23099 CONTINUE
      STATUS = ADDINT(FDW, BUF, LASTBF, 5000)
      GOTO 23098
23097 CONTINUE
      IF (.NOT.(COM .EQ. 61))GOTO 23103
      STATUS = 1
      GOTO 23104
23103 CONTINUE
      STATUS = -3
23104 CONTINUE
23098 CONTINUE
23087 CONTINUE
23083 CONTINUE
23081 CONTINUE
23079 CONTINUE
23077 CONTINUE
23075 CONTINUE
23073 CONTINUE
23071 CONTINUE
      IF (.NOT.(STATUS .NE. 1))GOTO 23105
      CALL PUTLIN(LIN, 3)
      IF (.NOT.(LASTBF .GT. 5000))GOTO 23107
      CALL ERROR(ST002Z)
      GOTO 23108
23107 CONTINUE
      CALL ERROR(ST003Z)
23108 CONTINUE
23105 CONTINUE
      RETURN
      END
      SUBROUTINE DOCMDS(LINBUF, LINENO)
      LOGICAL*1 LINBUF(402)
      INTEGER LINENO
      INTEGER I, N, STATE
      INTEGER MATCH
      INTEGER AQ
      INTEGER IQ
      INTEGER BUF
      INTEGER LASTBF
      INTEGER NLINES
      INTEGER LINE1
      INTEGER LINE2
      INTEGER PAT
      INTEGER PREVC
      INTEGER NFLAG
      INTEGER QFLAG
      LOGICAL*1 ST004Z(24)
      COMMON /CSEDIT/ AQ, IQ, BUF(5000), LASTBF, NLINES, LINE1, LINE2, P
     *AT(132), PREVC, NFLAG, QFLAG
      DATA ST004Z(1)/105/,ST004Z(2)/110/,ST004Z(3)/32/,ST004Z(4)/100/,ST
     *004Z(5)/111/,ST004Z(6)/99/,ST004Z(7)/109/,ST004Z(8)/100/,ST004Z(9)
     */115/,ST004Z(10)/58/,ST004Z(11)/32/,ST004Z(12)/99/,ST004Z(13)/97/,
     *ST004Z(14)/110/,ST004Z(15)/39/,ST004Z(16)/116/,ST004Z(17)/32/,ST00
     *4Z(18)/104/,ST004Z(19)/97/,ST004Z(20)/112/,ST004Z(21)/112/,ST004Z(
     *22)/101/,ST004Z(23)/110/,ST004Z(24)/0/
      AQ = 6+1
      BUF(AQ+6) = 0
      IQ = 1
      BUF(IQ+6) = 0
      I = BUF(1+1)
23109 IF (.NOT.(I .NE. 0))GOTO 23111
      NLINES = BUF(I+0)
      LINE1 = BUF(I+2)
      LINE2 = BUF(I+3)
      STATE = BUF(I+4)
      IF (.NOT.(NLINES.LE.0))GOTO 23112
      IF (.NOT.(LINENO .GT. 0))GOTO 23114
      IF (.NOT.(STATE.EQ.0))GOTO 23116
      CALL DOCOM(I, LINBUF, LINENO)
23116 CONTINUE
23114 CONTINUE
      GOTO 23113
23112 CONTINUE
      IF (.NOT.(NLINES.LE.2))GOTO 23118
      IF (.NOT.(LINE1.LE.0))GOTO 23120
      IF (.NOT.(-LINE1.EQ.LINENO))GOTO 23122
      IF (.NOT.(NLINES .EQ. 2))GOTO 23124
      BUF(I+0) = 3
23124 CONTINUE
      IF (.NOT.(STATE.EQ.0))GOTO 23126
      CALL DOCOM(I, LINBUF, LINENO)
23126 CONTINUE
      GOTO 23123
23122 CONTINUE
      IF (.NOT.(LINENO.GT.0 .AND. STATE.EQ.1))GOTO 23128
      CALL DOCOM(I, LINBUF, LINENO)
23128 CONTINUE
23123 CONTINUE
      GOTO 23121
23120 CONTINUE
      IF (.NOT.(LINENO .GT. 0))GOTO 23130
      IF (.NOT.(MATCH(LINBUF,BUF(LINE1)) .GT. 0))GOTO 23132
      IF (.NOT.(NLINES .EQ. 2))GOTO 23134
      BUF(I+0) = 3
23134 CONTINUE
      IF (.NOT.(STATE.EQ.0))GOTO 23136
      CALL DOCOM(I, LINBUF, LINENO)
23136 CONTINUE
      GOTO 23133
23132 CONTINUE
      IF (.NOT.(STATE.EQ.1))GOTO 23138
      CALL DOCOM(I, LINBUF, LINENO)
23138 CONTINUE
23133 CONTINUE
23130 CONTINUE
23121 CONTINUE
      GOTO 23119
23118 CONTINUE
      IF (.NOT.(NLINES .EQ. 3))GOTO 23140
      IF (.NOT.(LINE2 .LE. 0 .AND. LINENO .GE. -LINE2))GOTO 23142
      BUF(I+0) = 2
      GOTO 23143
23142 CONTINUE
      IF (.NOT.(LINE2 .GT. 0))GOTO 23144
      IF (.NOT.(MATCH(LINBUF, BUF(LINE2)) .GT. 0))GOTO 23146
      BUF(I+0) = 2
23146 CONTINUE
23144 CONTINUE
23143 CONTINUE
      IF (.NOT.(STATE .EQ. 0))GOTO 23148
      CALL DOCOM(I, LINBUF, LINENO)
23148 CONTINUE
      GOTO 23141
23140 CONTINUE
      CALL ERROR(ST004Z)
23141 CONTINUE
23119 CONTINUE
23113 CONTINUE
      IF (.NOT.(QFLAG.EQ.1 .OR. (LINBUF(1).EQ.0 .AND. LINENO.GT.0)))GOTO
     * 23150
      GOTO 23111
23150 CONTINUE
23110 I = BUF(I+1)
      GOTO 23109
23111 CONTINUE
      I = BUF(1+6)
23152 IF (.NOT.(I .GT. 0))GOTO 23154
      CALL PUTSI(BUF(I+7), 2)
23153 I = BUF(I+6)
      GOTO 23152
23154 CONTINUE
      IF (.NOT.(NFLAG .EQ. 0))GOTO 23155
      CALL PUTLIN(LINBUF, 2)
23155 CONTINUE
      I = BUF(6+1+6)
23157 IF (.NOT.(I .GT. 0))GOTO 23159
      IF (.NOT.(BUF(I+5) .EQ. 114))GOTO 23160
      CALL COPYF(BUF(I+7), 2)
      GOTO 23161
23160 CONTINUE
      CALL PUTSI(BUF(I+7), 2)
23161 CONTINUE
23158 I = BUF(I+6)
      GOTO 23157
23159 CONTINUE
      RETURN
      END
      SUBROUTINE DOCOM(I, LINBUF, LINENO)
      LOGICAL*1 LINBUF(402)
      INTEGER I, LINENO
      LOGICAL*1 CMD
      INTEGER K1, K2
      INTEGER AQ
      INTEGER IQ
      INTEGER BUF
      INTEGER LASTBF
      INTEGER NLINES
      INTEGER LINE1
      INTEGER LINE2
      INTEGER PAT
      INTEGER PREVC
      INTEGER NFLAG
      INTEGER QFLAG
      COMMON /CSEDIT/ AQ, IQ, BUF(5000), LASTBF, NLINES, LINE1, LINE2, P
     *AT(132), PREVC, NFLAG, QFLAG
      CMD = BUF(I+5)
      IF (.NOT.(CMD .EQ. 97))GOTO 23162
      BUF(AQ+6) = I
      AQ = I
      BUF(I+6) = 0
      GOTO 23163
23162 CONTINUE
      IF (.NOT.(CMD .EQ. 99))GOTO 23164
      LINBUF(1) = 0
      IF (.NOT.(BUF(I+0) .LE. 2))GOTO 23166
      BUF(AQ+6) = I
      AQ = I
      BUF(I+6) = 0
23166 CONTINUE
      GOTO 23165
23164 CONTINUE
      IF (.NOT.(CMD .EQ. 100))GOTO 23168
      LINBUF(1) = 0
      GOTO 23169
23168 CONTINUE
      IF (.NOT.(CMD .EQ. 105))GOTO 23170
      BUF(IQ+6) = I
      IQ = I
      BUF(I+6) = 0
      GOTO 23171
23170 CONTINUE
      IF (.NOT.(CMD .EQ. 112))GOTO 23172
      CALL PUTLIN(LINBUF, 2)
      GOTO 23173
23172 CONTINUE
      IF (.NOT.(CMD .EQ. 113))GOTO 23174
      QFLAG = 1
      GOTO 23175
23174 CONTINUE
      IF (.NOT.(CMD .EQ. 114))GOTO 23176
      BUF(AQ+6) = I
      AQ = I
      BUF(I+6) = 0
      GOTO 23177
23176 CONTINUE
      IF (.NOT.(CMD .EQ. 115))GOTO 23178
      K1 = BUF(I+5+3)
      K2 = BUF(I+5+4)
      CALL SUBST(LINBUF, BUF(K1), BUF(K2), BUF(I+5+1), BUF(I+5+2))
      GOTO 23179
23178 CONTINUE
      IF (.NOT.(CMD .EQ. 119))GOTO 23180
      IF (.NOT.(BUF(I+5+1) .NE. 0))GOTO 23182
      CALL PUTLIN(LINBUF, BUF(I+5+1))
23182 CONTINUE
      GOTO 23181
23180 CONTINUE
      IF (.NOT.(CMD .EQ. 61))GOTO 23184
      CALL PUTINT(LINENO, 1,2)
      CALL PUTCH(10,2)
23184 CONTINUE
23181 CONTINUE
23179 CONTINUE
23177 CONTINUE
23175 CONTINUE
23173 CONTINUE
23171 CONTINUE
23169 CONTINUE
23165 CONTINUE
23163 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOTEXT(FD)
      INTEGER FD
      INTEGER GETLIN, ADDINT, INSSTR
      LOGICAL*1 LIN(402)
      INTEGER AQ
      INTEGER IQ
      INTEGER BUF
      INTEGER LASTBF
      INTEGER NLINES
      INTEGER LINE1
      INTEGER LINE2
      INTEGER PAT
      INTEGER PREVC
      INTEGER NFLAG
      INTEGER QFLAG
      COMMON /CSEDIT/ AQ, IQ, BUF(5000), LASTBF, NLINES, LINE1, LINE2, P
     *AT(132), PREVC, NFLAG, QFLAG
23186 IF (.NOT.(GETLIN(LIN, FD) .NE. -1))GOTO 23187
      IF (.NOT.(LIN(1) .EQ. 46 .AND. LIN(2) .EQ. 10))GOTO 23188
      GOTO 23187
23188 CONTINUE
      JUNK = INSSTR(LIN, BUF, LASTBF, 5000)
      GOTO 23186
23187 CONTINUE
      DOTEXT = ADDINT(0, BUF, LASTBF, 5000)
      RETURN
      END
      SUBROUTINE COPYF(NAME, FDO)
      INTEGER NAME(100)
      INTEGER FDO
      INTEGER FDI, I
      INTEGER OPEN
      LOGICAL*1 C, NAMSTR(402)
      LOGICAL*1 GETCH
      I=1
23190 IF (.NOT.(NAME(I).NE.0))GOTO 23192
      NAMSTR(I) = NAME(I)
23191 I=I+1
      GOTO 23190
23192 CONTINUE
      NAMSTR(I) = 0
      FDI = OPEN(NAMSTR, 1)
      IF (.NOT.(FDI .EQ. -3))GOTO 23193
      CALL CANT(NAMSTR)
23193 CONTINUE
23195 IF (.NOT.(GETCH(C, FDI) .NE. -1))GOTO 23196
      CALL PUTCH(C, FDO)
      GOTO 23195
23196 CONTINUE
      CALL CLOSE(FDI)
      RETURN
      END
      INTEGER FUNCTION GETFN(LIN, I, FILE)
      LOGICAL*1 LIN(402), FILE(402)
      INTEGER I, J, K
      GETFN = -3
      IF (.NOT.(LIN(I + 1) .EQ. 32 .OR. LIN(I + 1) .EQ. 9))GOTO 23197
      J = I + 2
      CALL SKIPBL(LIN, J)
      K = 1
23199 IF (.NOT.(LIN(J) .NE. 10))GOTO 23201
      FILE(K) = LIN(J)
      J = J + 1
23200 K = K + 1
      GOTO 23199
23201 CONTINUE
      FILE(K) = 0
      IF (.NOT.(K .GT. 1))GOTO 23202
      GETFN = 1
23202 CONTINUE
23197 CONTINUE
      RETURN
      END
      INTEGER FUNCTION GETLST(LIN, I, STATUS)
      LOGICAL*1 LIN(402)
      INTEGER I
      INTEGER STATUS
      INTEGER NUM
      INTEGER GETONE
      INTEGER AQ
      INTEGER IQ
      INTEGER BUF
      INTEGER LASTBF
      INTEGER NLINES
      INTEGER LINE1
      INTEGER LINE2
      INTEGER PAT
      INTEGER PREVC
      INTEGER NFLAG
      INTEGER QFLAG
      COMMON /CSEDIT/ AQ, IQ, BUF(5000), LASTBF, NLINES, LINE1, LINE2, P
     *AT(132), PREVC, NFLAG, QFLAG
      NLINES = 0
      IF (.NOT.(GETONE(LIN, I, NUM) .EQ. -1))GOTO 23204
      GETLST=(1)
      RETURN
23204 CONTINUE
      LINE1 = NUM
      NLINES = NLINES + 1
      IF (.NOT.(LIN(I) .NE. 44))GOTO 23206
      GETLST=(1)
      RETURN
23206 CONTINUE
      I = I + 1
      IF (.NOT.(GETONE(LIN, I, NUM) .NE. 1))GOTO 23208
      GETLST=(-3)
      RETURN
23208 CONTINUE
      LINE2 = NUM
      NLINES = NLINES + 1
      GETLST=(1)
      RETURN
      END
      INTEGER FUNCTION GETONE(LIN, I, NUM)
      LOGICAL*1 LIN(402)
      INTEGER I, ISTART, NUM
      INTEGER ADDPAT, CTOI, OPTPAT
      INTEGER AQ
      INTEGER IQ
      INTEGER BUF
      INTEGER LASTBF
      INTEGER NLINES
      INTEGER LINE1
      INTEGER LINE2
      INTEGER PAT
      INTEGER PREVC
      INTEGER NFLAG
      INTEGER QFLAG
      COMMON /CSEDIT/ AQ, IQ, BUF(5000), LASTBF, NLINES, LINE1, LINE2, P
     *AT(132), PREVC, NFLAG, QFLAG
      GETONE = 1
      CALL SKIPBL(LIN, I)
      ISTART = I
      IF (.NOT.(LIN(I) .GE. 48 .AND. LIN(I) .LE. 57))GOTO 23210
      NUM = CTOI(LIN, I)
      I = I - 1
      IF (.NOT.(NUM .LT. 0))GOTO 23212
      GETONE = -3
23212 CONTINUE
      NUM = -NUM
      GOTO 23211
23210 CONTINUE
      IF (.NOT.(LIN(I) .EQ. 36))GOTO 23214
      NUM = -30000
      GOTO 23215
23214 CONTINUE
      IF (.NOT.(LIN(I) .EQ. 47))GOTO 23216
      IF (.NOT.(OPTPAT(LIN, I) .EQ. -3))GOTO 23218
      GETONE = -3
      GOTO 23219
23218 CONTINUE
      IF (.NOT.(LIN(I) .EQ. 47))GOTO 23220
      NUM = LASTBF
      IF (.NOT.(ADDPAT(PAT, BUF, LASTBF, 5000) .EQ. 0))GOTO 23222
      GETONE = -3
23222 CONTINUE
23220 CONTINUE
23219 CONTINUE
      GOTO 23217
23216 CONTINUE
      GETONE = -1
23217 CONTINUE
23215 CONTINUE
23211 CONTINUE
      IF (.NOT.(GETONE .EQ. 1))GOTO 23224
      I = I + 1
23224 CONTINUE
      CALL SKIPBL(LIN, I)
      IF (.NOT.(I .LE. ISTART))GOTO 23226
      GETONE = -1
      GOTO 23227
23226 CONTINUE
      GETONE = 1
23227 CONTINUE
      RETURN
      END
      INTEGER FUNCTION GETRHS(LIN, I, SUB, GFLAG)
      LOGICAL*1 LIN(402), SUB(132)
      INTEGER MAKSUB
      LOGICAL*1 CLOWER
      INTEGER GFLAG, I
      GETRHS = -3
      IF (.NOT.(LIN(I) .EQ. 0))GOTO 23228
      RETURN
23228 CONTINUE
      IF (.NOT.(LIN(I + 1) .EQ. 0))GOTO 23230
      RETURN
23230 CONTINUE
      I = MAKSUB(LIN, I + 1, LIN(I), SUB)
      IF (.NOT.(I .EQ. -3))GOTO 23232
      RETURN
23232 CONTINUE
      IF (.NOT.(CLOWER(LIN(I + 1)) .EQ. 103))GOTO 23234
      I = I + 1
      GFLAG = 1
      GOTO 23235
23234 CONTINUE
      GFLAG = 0
23235 CONTINUE
      GETRHS = 1
      RETURN
      END
      INTEGER FUNCTION OPTPAT(LIN, I)
      LOGICAL*1 LIN(402)
      INTEGER MAKPAT
      INTEGER I
      INTEGER AQ
      INTEGER IQ
      INTEGER BUF
      INTEGER LASTBF
      INTEGER NLINES
      INTEGER LINE1
      INTEGER LINE2
      INTEGER PAT
      INTEGER PREVC
      INTEGER NFLAG
      INTEGER QFLAG
      COMMON /CSEDIT/ AQ, IQ, BUF(5000), LASTBF, NLINES, LINE1, LINE2, P
     *AT(132), PREVC, NFLAG, QFLAG
      IF (.NOT.(LIN(I) .EQ. 0))GOTO 23236
      I = -3
      GOTO 23237
23236 CONTINUE
      IF (.NOT.(LIN(I + 1) .EQ. 0))GOTO 23238
      I = -3
      GOTO 23239
23238 CONTINUE
      IF (.NOT.(LIN(I + 1) .EQ. LIN(I)))GOTO 23240
      I = I + 1
      GOTO 23241
23240 CONTINUE
      I = MAKPAT(LIN, I + 1, LIN(I), PAT)
23241 CONTINUE
23239 CONTINUE
23237 CONTINUE
      IF (.NOT.(PAT(1) .EQ. 0))GOTO 23242
      I = -3
23242 CONTINUE
      IF (.NOT.(I .EQ. -3))GOTO 23244
      PAT(1) = 0
      OPTPAT = -3
      GOTO 23245
23244 CONTINUE
      OPTPAT = 1
23245 CONTINUE
      RETURN
      END
      SUBROUTINE SED(LINBUF, LINENO, FD)
      LOGICAL*1 LINBUF(402)
      INTEGER LINENO, FD
      LOGICAL*1 BUF1(402), BUF2(402)
      INTEGER GETLIN
      INTEGER AQ
      INTEGER IQ
      INTEGER BUF
      INTEGER LASTBF
      INTEGER NLINES
      INTEGER LINE1
      INTEGER LINE2
      INTEGER PAT
      INTEGER PREVC
      INTEGER NFLAG
      INTEGER QFLAG
      COMMON /CSEDIT/ AQ, IQ, BUF(5000), LASTBF, NLINES, LINE1, LINE2, P
     *AT(132), PREVC, NFLAG, QFLAG
      IF (.NOT.(GETLIN(BUF1, FD) .EQ. -1))GOTO 23246
      RETURN
23246 CONTINUE
      IF (.NOT.(LINENO .GT. 0))GOTO 23248
      LINENO = LINENO + 1
      CALL DOCMDS(LINBUF, LINENO)
23248 CONTINUE
23250 IF (.NOT.(QFLAG .NE. 1))GOTO 23251
      IF (.NOT.(GETLIN(BUF2, FD) .EQ. -1))GOTO 23252
      CALL SCOPY(BUF1, 1, LINBUF, 1)
      GOTO 23251
23252 CONTINUE
      LINENO = LINENO + 1
      CALL DOCMDS(BUF1, LINENO)
      IF (.NOT.(QFLAG .NE. 1))GOTO 23254
      IF (.NOT.(GETLIN(BUF1, FD) .EQ. -1))GOTO 23256
      CALL SCOPY(BUF2, 1, LINBUF, 1)
      GOTO 23251
23256 CONTINUE
      LINENO = LINENO + 1
      CALL DOCMDS(BUF2, LINENO)
23254 CONTINUE
      GOTO 23250
23251 CONTINUE
      RETURN
      END
      SUBROUTINE SUBST(TXT, PAT, ISUB, GFLAG, PFLAG)
      INTEGER PAT(100), ISUB(100), GFLAG, PFLAG
      LOGICAL*1 TXT(402), NEW(402), SUB(132)
      INTEGER ADDSET, AMATCH
      INTEGER J, JUNK, K, LASTM, M, SUBBED
      J = 1
      SUBBED = 0
      LASTM = 0
      K = 1
23258 IF (.NOT.(ISUB(K) .NE. 0))GOTO 23260
      SUB(K) = ISUB(K)
23259 K = K + 1
      GOTO 23258
23260 CONTINUE
      SUB(K) = 0
      K = 1
23261 IF (.NOT.(TXT(K) .NE. 0))GOTO 23263
      IF (.NOT.(GFLAG .EQ. 1 .OR. SUBBED .EQ. 0))GOTO 23264
      M = AMATCH(TXT, K, PAT)
      GOTO 23265
23264 CONTINUE
      M = 0
23265 CONTINUE
      IF (.NOT.(M .GT. 0 .AND. LASTM .NE. M))GOTO 23266
      SUBBED = 1
      CALL CATSUB(TXT, K, M, SUB, NEW, J, 402)
      LASTM = M
23266 CONTINUE
      IF (.NOT.(M .EQ. 0 .OR. M .EQ. K))GOTO 23268
      JUNK = ADDSET(TXT(K), NEW, J, 402)
      K = K + 1
      GOTO 23269
23268 CONTINUE
      K = M
23269 CONTINUE
23262 GOTO 23261
23263 CONTINUE
      IF (.NOT.(SUBBED .EQ. 1))GOTO 23270
      IF (.NOT.(ADDSET(0, NEW, J, 402) .EQ. 0))GOTO 23272
      RETURN
23272 CONTINUE
      CALL SCOPY(NEW, 1, TXT, 1)
      IF (.NOT.(PFLAG .EQ. 1))GOTO 23274
      CALL PUTLIN(TXT, 2)
23274 CONTINUE
23270 CONTINUE
      RETURN
      END
      INTEGER FUNCTION ADDPAT(P,STR,J,MAXSIZ)
      INTEGER P(100), STR(100)
      INTEGER J, MAXSIZ
      INTEGER I, LIM, ADDINT, PATSIZ
      LIM=1
23276 IF (.NOT.(P(LIM).NE.0))GOTO 23278
23277 LIM=LIM+PATSIZ(P,LIM)
      GOTO 23276
23278 CONTINUE
      I=1
23279 IF (.NOT.(I.LE.LIM))GOTO 23281
      IF (.NOT.(ADDINT(P(I), STR, J, MAXSIZ) .EQ. 0))GOTO 23282
      ADDPAT = 0
      RETURN
23282 CONTINUE
23280 I=I+1
      GOTO 23279
23281 CONTINUE
      ADDPAT = 1
      RETURN
      END
      INTEGER FUNCTION ADDSI(S, STR, J, MAXSIZ)
      INTEGER S(100)
      INTEGER J, MAXSIZ, STR(100)
      INTEGER I, ADDINT, INT
      I = 1
23284 IF (.NOT.(S(I) .NE. 0))GOTO 23286
      IF (.NOT.(ADDINT( S(I), STR, J, MAXSIZ) .EQ. 0))GOTO 23287
      ADDSI=(0)
      RETURN
23287 CONTINUE
23285 I = I + 1
      GOTO 23284
23286 CONTINUE
      ADDSI=(1)
      RETURN
      END
      SUBROUTINE PUTSI(STR, FD)
      INTEGER STR(100), FD, I
      I=1
23289 IF (.NOT.(STR(I).NE.0))GOTO 23291
      CALL PUTCH(STR(I),FD)
23290 I=I+1
      GOTO 23289
23291 CONTINUE
      RETURN
      END
