      SUBROUTINE MAIN
      LOGICAL*1 IARG(40)
      LOGICAL*1 INBUF(400)
      INTEGER I, INT
      INTEGER GETARG, OPEN, GETLIN
      COMMON /FLIST/ FLEVEL, FFILES(40, 10)
      INTEGER FLEVEL
      LOGICAL*1 FFILES
      COMMON /CPAGE/ CURPAG,NEWPAG,LINENO,PLVAL,M1VAL,M2VAL,M3VAL,M4VAL,
     * BOTTOM, EHLIM(2), OHLIM(2), EFLIM(2), OFLIM(2), STOPX, FRSTPG, LS
     *TPAG, PRINT, OFFSET, EHEAD(400), OHEAD(400), EFOOT(400), OFOOT(400
     *)
      INTEGER CURPAG
      INTEGER NEWPAG
      INTEGER LINENO
      INTEGER PLVAL
      INTEGER M1VAL
      INTEGER M2VAL
      INTEGER M3VAL
      INTEGER M4VAL
      INTEGER BOTTOM
      INTEGER EHLIM
      INTEGER FRSTPG
      INTEGER LSTPAG
      INTEGER PRINT
      INTEGER OFFSET
      INTEGER OHLIM
      INTEGER EFLIM
      INTEGER OFLIM
      INTEGER STOPX
      LOGICAL*1 EHEAD
      LOGICAL*1 OHEAD
      LOGICAL*1 EFOOT
      LOGICAL*1 OFOOT
      COMMON /COUT/ OUTP, OUTW, OUTWDS, PREP, OUTBUF(400)
      INTEGER OUTP
      INTEGER OUTW
      INTEGER PREP
      INTEGER OUTWDS
      LOGICAL*1 OUTBUF
      COMMON /CPARAM/ FILL, LSVAL, INVAL, RMVAL, TIVAL, CEVAL, ULVAL, BO
     *VAL, TJUST(3), BSVAL, RJUST, CCHAR
      INTEGER FILL
      INTEGER LSVAL
      INTEGER INVAL
      INTEGER RMVAL
      INTEGER TIVAL
      INTEGER CEVAL
      INTEGER ULVAL
      INTEGER BOVAL
      INTEGER TJUST
      INTEGER BSVAL
      INTEGER RJUST
      LOGICAL*1 CCHAR
      DATA FLEVEL/0/
      CALL ROFINT
      I=1
23000 IF(.NOT.(GETARG(I, IARG, 40) .NE. -1))GOTO 23002
      IF(.NOT.((IARG(1) .EQ. 45 .OR. IARG(1) .EQ. 43) .AND. IARG(2) .NE.
     * 0))GOTO 23003
      CALL ROFCMD(IARG)
      GOTO 23004
23003 CONTINUE
      IF(.NOT.(IARG(1) .EQ. 63 .AND. IARG(2) .EQ. 0))GOTO 23005
      CALL ERROR (41Husage:  roff [+n] [-n] [-s] [-po] [file].)
      GOTO 23006
23005 CONTINUE
      CALL FSTACK(IARG)
23006 CONTINUE
23004 CONTINUE
23001 I=I+1
      GOTO 23000
23002 CONTINUE
      IF(.NOT.(FLEVEL .LE. 0))GOTO 23007
      FLEVEL = 1
      FFILES(1,1) = 45
23007 CONTINUE
      I=1
23009 IF(.NOT.(I.LE. FLEVEL))GOTO 23011
      IF(.NOT.(FFILES(1,I) .EQ. 45))GOTO 23012
      INT = 1
      GOTO 23013
23012 CONTINUE
      INT = OPEN (FFILES(1,I), 1)
23013 CONTINUE
      IF(.NOT.(INT .EQ. -3))GOTO 23014
      CALL CANT(FFILES(1,I))
23014 CONTINUE
23016 IF(.NOT.(GETLIN(INBUF, INT) .NE. -1))GOTO 23017
      IF(.NOT.(INBUF(1) .EQ. CCHAR))GOTO 23018
      CALL COMAND(INBUF)
      GOTO 23019
23018 CONTINUE
      CALL TEXT(INBUF)
23019 CONTINUE
      GOTO 23016
23017 CONTINUE
      IF(.NOT.(INT .NE. 1))GOTO 23020
      CALL CLOSE(INT)
23020 CONTINUE
23010 I=I+1
      GOTO 23009
23011 CONTINUE
      IF(.NOT.(LINENO .GT. 0 .OR. OUTP .GT. 0))GOTO 23022
      CALL SPACE(1000)
23022 CONTINUE
      CALL PUTC(10)
      RETURN
      END
      SUBROUTINE BRK
      COMMON /COUT/ OUTP, OUTW, OUTWDS, PREP, OUTBUF(400)
      INTEGER OUTP
      INTEGER OUTW
      INTEGER PREP
      INTEGER OUTWDS
      LOGICAL*1 OUTBUF
      IF(.NOT.(OUTP .GT. 0))GOTO 23024
      OUTBUF(OUTP) = 10
      OUTBUF(OUTP+1) = 0
      CALL PUT(OUTBUF)
23024 CONTINUE
      OUTP = 0
      OUTW = 0
      OUTWDS = 0
      PREP = 0
      RETURN
      END
      SUBROUTINE CENTER(BUF)
      LOGICAL*1 BUF(100)
      INTEGER WIDTH
      COMMON /CPARAM/ FILL, LSVAL, INVAL, RMVAL, TIVAL, CEVAL, ULVAL, BO
     *VAL, TJUST(3), BSVAL, RJUST, CCHAR
      INTEGER FILL
      INTEGER LSVAL
      INTEGER INVAL
      INTEGER RMVAL
      INTEGER TIVAL
      INTEGER CEVAL
      INTEGER ULVAL
      INTEGER BOVAL
      INTEGER TJUST
      INTEGER BSVAL
      INTEGER RJUST
      LOGICAL*1 CCHAR
      TIVAL = MAX0((RMVAL+TIVAL-WIDTH(BUF))/2, 0)
      RETURN
      END
      SUBROUTINE ROFCMD (IARG)
      INTEGER CREATE, CTOI, I, VAL
      LOGICAL*1 IARG(100), ARGTYP, TERML(40)
      COMMON /FLIST/ FLEVEL, FFILES(40, 10)
      INTEGER FLEVEL
      LOGICAL*1 FFILES
      COMMON /CPAGE/ CURPAG,NEWPAG,LINENO,PLVAL,M1VAL,M2VAL,M3VAL,M4VAL,
     * BOTTOM, EHLIM(2), OHLIM(2), EFLIM(2), OFLIM(2), STOPX, FRSTPG, LS
     *TPAG, PRINT, OFFSET, EHEAD(400), OHEAD(400), EFOOT(400), OFOOT(400
     *)
      INTEGER CURPAG
      INTEGER NEWPAG
      INTEGER LINENO
      INTEGER PLVAL
      INTEGER M1VAL
      INTEGER M2VAL
      INTEGER M3VAL
      INTEGER M4VAL
      INTEGER BOTTOM
      INTEGER EHLIM
      INTEGER FRSTPG
      INTEGER LSTPAG
      INTEGER PRINT
      INTEGER OFFSET
      INTEGER OHLIM
      INTEGER EFLIM
      INTEGER OFLIM
      INTEGER STOPX
      LOGICAL*1 EHEAD
      LOGICAL*1 OHEAD
      LOGICAL*1 EFOOT
      LOGICAL*1 OFOOT
      COMMON /CPARAM/ FILL, LSVAL, INVAL, RMVAL, TIVAL, CEVAL, ULVAL, BO
     *VAL, TJUST(3), BSVAL, RJUST, CCHAR
      INTEGER FILL
      INTEGER LSVAL
      INTEGER INVAL
      INTEGER RMVAL
      INTEGER TIVAL
      INTEGER CEVAL
      INTEGER ULVAL
      INTEGER BOVAL
      INTEGER TJUST
      INTEGER BSVAL
      INTEGER RJUST
      LOGICAL*1 CCHAR
      IF(.NOT.(IARG(1) .EQ. 45 .AND. (IARG(2) .EQ. 115 .OR. IARG(2) .EQ.
     * 83)))GOTO 23026
      CALL GTTY (TERML)
      STOPX = CREATE(TERML, 1)
      IF(.NOT.(STOPX .EQ. -3))GOTO 23028
      CALL REMARK (27HCan't open user's terminal.)
      STOPX = 0
23028 CONTINUE
      GOTO 23027
23026 CONTINUE
      IF(.NOT.(IARG(1) .EQ. 45 .AND. (IARG(2) .EQ. 112 .OR. IARG(2) .EQ.
     * 80) .AND. (IARG(3) .EQ. 111 .OR. IARG(3) .EQ. 79)))GOTO 23030
      I = 4
      VAL = CTOI (IARG, I)
      ARGTYP = IARG(4)
      CALL SET (OFFSET, VAL, ARGTYP, 0, 0, RMVAL-1)
      GOTO 23031
23030 CONTINUE
      IF(.NOT.(IARG(1) .EQ. 43))GOTO 23032
      I = 2
      FRSTPG = CTOI (IARG, I)
      GOTO 23033
23032 CONTINUE
      IF(.NOT.(IARG(1) .EQ. 45))GOTO 23034
      I = 2
      LSTPAG = CTOI (IARG, I)
      GOTO 23035
23034 CONTINUE
      CALL REMARK (25Hignoring invalid argument )
23035 CONTINUE
23033 CONTINUE
23031 CONTINUE
23027 CONTINUE
      RETURN
      END
      SUBROUTINE COMAND(BUF)
      LOGICAL*1 BUF(400), ARGTYP
      INTEGER COMTYP, GETVAL
      INTEGER CT, SPVAL, VAL
      COMMON /CPAGE/ CURPAG,NEWPAG,LINENO,PLVAL,M1VAL,M2VAL,M3VAL,M4VAL,
     * BOTTOM, EHLIM(2), OHLIM(2), EFLIM(2), OFLIM(2), STOPX, FRSTPG, LS
     *TPAG, PRINT, OFFSET, EHEAD(400), OHEAD(400), EFOOT(400), OFOOT(400
     *)
      INTEGER CURPAG
      INTEGER NEWPAG
      INTEGER LINENO
      INTEGER PLVAL
      INTEGER M1VAL
      INTEGER M2VAL
      INTEGER M3VAL
      INTEGER M4VAL
      INTEGER BOTTOM
      INTEGER EHLIM
      INTEGER FRSTPG
      INTEGER LSTPAG
      INTEGER PRINT
      INTEGER OFFSET
      INTEGER OHLIM
      INTEGER EFLIM
      INTEGER OFLIM
      INTEGER STOPX
      LOGICAL*1 EHEAD
      LOGICAL*1 OHEAD
      LOGICAL*1 EFOOT
      LOGICAL*1 OFOOT
      COMMON /CPARAM/ FILL, LSVAL, INVAL, RMVAL, TIVAL, CEVAL, ULVAL, BO
     *VAL, TJUST(3), BSVAL, RJUST, CCHAR
      INTEGER FILL
      INTEGER LSVAL
      INTEGER INVAL
      INTEGER RMVAL
      INTEGER TIVAL
      INTEGER CEVAL
      INTEGER ULVAL
      INTEGER BOVAL
      INTEGER TJUST
      INTEGER BSVAL
      INTEGER RJUST
      LOGICAL*1 CCHAR
      CT = COMTYP(BUF)
      IF(.NOT.(CT .EQ. 0))GOTO 23036
      RETURN
23036 CONTINUE
      VAL = GETVAL(BUF, ARGTYP)
      IF(.NOT.(CT .EQ. 1))GOTO 23038
      CALL BRK
      FILL = 1
      GOTO 23039
23038 CONTINUE
      IF(.NOT.(CT .EQ. 2))GOTO 23040
      CALL BRK
      FILL = 0
      GOTO 23041
23040 CONTINUE
      IF(.NOT.(CT .EQ. 3))GOTO 23042
      CALL BRK
      GOTO 23043
23042 CONTINUE
      IF(.NOT.(CT .EQ. 4))GOTO 23044
      CALL SET(LSVAL, VAL, ARGTYP, 1, 1, 1000)
      GOTO 23045
23044 CONTINUE
      IF(.NOT.(CT .EQ. 10))GOTO 23046
      CALL BRK
      CALL SET(CEVAL, VAL, ARGTYP, 1, 0, 1000)
      GOTO 23047
23046 CONTINUE
      IF(.NOT.(CT .EQ. 11))GOTO 23048
      CALL SET(ULVAL, VAL, ARGTYP, 1, 0, 1000)
      GOTO 23049
23048 CONTINUE
      IF(.NOT.(CT .EQ. 16))GOTO 23050
      CALL SET(BOVAL, VAL, ARGTYP, 0, 1, 1000)
      GOTO 23051
23050 CONTINUE
      IF(.NOT.(CT .EQ. 12))GOTO 23052
      CALL GETTL(BUF, EHEAD, EHLIM)
      CALL GETTL(BUF, OHEAD, OHLIM)
      GOTO 23053
23052 CONTINUE
      IF(.NOT.(CT .EQ. 13))GOTO 23054
      CALL GETTL(BUF, EFOOT, EFLIM)
      CALL GETTL(BUF, OFOOT, OFLIM)
      GOTO 23055
23054 CONTINUE
      IF(.NOT.(CT .EQ. 5))GOTO 23056
      CALL BRK
      IF(.NOT.(LINENO .GT. 0))GOTO 23058
      CALL SPACE(1000)
23058 CONTINUE
      CALL SET(CURPAG, VAL, ARGTYP, CURPAG+1, -1000, 1000)
      NEWPAG = CURPAG
      GOTO 23057
23056 CONTINUE
      IF(.NOT.(CT .EQ. 6))GOTO 23060
      CALL SET(SPVAL, VAL, ARGTYP, 1, 0, 1000)
      CALL SPACE(SPVAL)
      GOTO 23061
23060 CONTINUE
      IF(.NOT.(CT .EQ. 7))GOTO 23062
      CALL BRK
      CALL SET(INVAL, VAL, ARGTYP, 0, 0, RMVAL-1)
      TIVAL = INVAL
      GOTO 23063
23062 CONTINUE
      IF(.NOT.(CT .EQ. 8))GOTO 23064
      CALL SET(RMVAL, VAL, ARGTYP, 65, TIVAL+1, 1000)
      GOTO 23065
23064 CONTINUE
      IF(.NOT.(CT .EQ. 9))GOTO 23066
      CALL BRK
      CALL SET(TIVAL, VAL, ARGTYP, 0, 0, RMVAL)
      GOTO 23067
23066 CONTINUE
      IF(.NOT.(CT .EQ. 14))GOTO 23068
      CALL SET(PLVAL, VAL, ARGTYP, 66, M1VAL+M2VAL+M3VAL+M4VAL+1, 1000)
      BOTTOM = PLVAL - M3VAL - M4VAL
      GOTO 23069
23068 CONTINUE
      IF(.NOT.(CT .EQ. 15))GOTO 23070
      CALL SET (OFFSET, VAL, ARGTYP, 0, 0, RMVAL-1)
      GOTO 23071
23070 CONTINUE
      IF(.NOT.(CT .EQ. 17))GOTO 23072
      CALL SET (M1VAL, VAL, ARGTYP, 3, 0, PLVAL-M2VAL-M3VAL-M4VAL-1)
      GOTO 23073
23072 CONTINUE
      IF(.NOT.(CT .EQ. 18))GOTO 23074
      CALL SET (M2VAL, VAL, ARGTYP, 2, 0, PLVAL-M1VAL-M3VAL-M4VAL-1)
      GOTO 23075
23074 CONTINUE
      IF(.NOT.(CT .EQ. 19))GOTO 23076
      CALL SET (M3VAL, VAL, ARGTYP, 2, 0, PLVAL-M1VAL-M2VAL-M4VAL-1)
      BOTTOM = PLVAL - M3VAL - M4VAL
      GOTO 23077
23076 CONTINUE
      IF(.NOT.(CT .EQ. 20))GOTO 23078
      CALL SET (M4VAL, VAL, ARGTYP, 3, 0, PLVAL-M1VAL-M2VAL-M3VAL-1)
      BOTTOM = PLVAL - M3VAL - M4VAL
      GOTO 23079
23078 CONTINUE
      IF(.NOT.(CT .EQ. 21))GOTO 23080
      CALL GETTL(BUF,EHEAD, EHLIM)
      GOTO 23081
23080 CONTINUE
      IF(.NOT.(CT .EQ. 22))GOTO 23082
      CALL GETTL(BUF,OHEAD, OHLIM)
      GOTO 23083
23082 CONTINUE
      IF(.NOT.(CT .EQ. 23))GOTO 23084
      CALL GETTL(BUF,EFOOT, EFLIM)
      GOTO 23085
23084 CONTINUE
      IF(.NOT.(CT .EQ. 24))GOTO 23086
      CALL GETTL(BUF,OFOOT, OFLIM)
      GOTO 23087
23086 CONTINUE
      IF(.NOT.(CT .EQ. 25))GOTO 23088
      CCHAR = ARGTYP
      GOTO 23089
23088 CONTINUE
      IF(.NOT.(CT .EQ. 26))GOTO 23090
      IF(.NOT.((LINENO + VAL) .GT. BOTTOM .AND. LINENO .LE. BOTTOM))GOTO
     * 23092
      CALL SPACE(VAL)
      LINENO = 0
23092 CONTINUE
      GOTO 23091
23090 CONTINUE
      IF(.NOT.(CT .EQ. 27))GOTO 23094
      CALL SET(BSVAL, VAL, ARGTYP, 1, 0, 1000)
      GOTO 23095
23094 CONTINUE
      IF(.NOT.(CT .EQ. 28))GOTO 23096
      RJUST = 1
      GOTO 23097
23096 CONTINUE
      IF(.NOT.(CT .EQ. 29))GOTO 23098
      RJUST = 0
23098 CONTINUE
23097 CONTINUE
23095 CONTINUE
23091 CONTINUE
23089 CONTINUE
23087 CONTINUE
23085 CONTINUE
23083 CONTINUE
23081 CONTINUE
23079 CONTINUE
23077 CONTINUE
23075 CONTINUE
23073 CONTINUE
23071 CONTINUE
23069 CONTINUE
23067 CONTINUE
23065 CONTINUE
23063 CONTINUE
23061 CONTINUE
23057 CONTINUE
23055 CONTINUE
23053 CONTINUE
23051 CONTINUE
23049 CONTINUE
23047 CONTINUE
23045 CONTINUE
23043 CONTINUE
23041 CONTINUE
23039 CONTINUE
      RETURN
      END
      INTEGER FUNCTION COMTYP(BUF)
      LOGICAL*1 BUF(400), C1, C2, CLOWER
      C1 = CLOWER(BUF(2))
      C2 = CLOWER(BUF(3))
      IF(.NOT.(C1 .EQ. 102 .AND. C2 .EQ. 105))GOTO 23100
      COMTYP = 1
      GOTO 23101
23100 CONTINUE
      IF(.NOT.(C1 .EQ. 110 .AND. C2 .EQ. 102))GOTO 23102
      COMTYP = 2
      GOTO 23103
23102 CONTINUE
      IF(.NOT.(C1 .EQ. 98 .AND. C2 .EQ. 114))GOTO 23104
      COMTYP = 3
      GOTO 23105
23104 CONTINUE
      IF(.NOT.(C1 .EQ. 108 .AND. C2 .EQ. 115))GOTO 23106
      COMTYP = 4
      GOTO 23107
23106 CONTINUE
      IF(.NOT.(C1 .EQ. 98 .AND. C2 .EQ. 112))GOTO 23108
      COMTYP = 5
      GOTO 23109
23108 CONTINUE
      IF(.NOT.(C1 .EQ. 115 .AND. C2 .EQ. 112))GOTO 23110
      COMTYP = 6
      GOTO 23111
23110 CONTINUE
      IF(.NOT.(C1 .EQ. 105 .AND. C2 .EQ. 110))GOTO 23112
      COMTYP = 7
      GOTO 23113
23112 CONTINUE
      IF(.NOT.(C1 .EQ. 114 .AND. C2 .EQ. 109))GOTO 23114
      COMTYP = 8
      GOTO 23115
23114 CONTINUE
      IF(.NOT.(C1 .EQ. 116 .AND. C2 .EQ. 105))GOTO 23116
      COMTYP = 9
      GOTO 23117
23116 CONTINUE
      IF(.NOT.(C1 .EQ. 99 .AND. C2 .EQ. 101))GOTO 23118
      COMTYP = 10
      GOTO 23119
23118 CONTINUE
      IF(.NOT.(C1 .EQ. 117 .AND. C2 .EQ. 108))GOTO 23120
      COMTYP = 11
      GOTO 23121
23120 CONTINUE
      IF(.NOT.(C1 .EQ. 104 .AND. C2 .EQ. 101))GOTO 23122
      COMTYP = 12
      GOTO 23123
23122 CONTINUE
      IF(.NOT.(C1 .EQ. 102 .AND. C2 .EQ. 111))GOTO 23124
      COMTYP = 13
      GOTO 23125
23124 CONTINUE
      IF(.NOT.(C1 .EQ. 112 .AND. C2 .EQ. 108))GOTO 23126
      COMTYP = 14
      GOTO 23127
23126 CONTINUE
      IF(.NOT.(C1 .EQ. 112 .AND. C2 .EQ. 111))GOTO 23128
      COMTYP = 15
      GOTO 23129
23128 CONTINUE
      IF(.NOT.(C1 .EQ. 98 .AND. C2 .EQ. 100))GOTO 23130
      COMTYP = 16
      GOTO 23131
23130 CONTINUE
      IF(.NOT.(C1 .EQ. 109 .AND. C2 .EQ. 49))GOTO 23132
      COMTYP = 17
      GOTO 23133
23132 CONTINUE
      IF(.NOT.(C1 .EQ. 109 .AND. C2 .EQ. 50))GOTO 23134
      COMTYP = 18
      GOTO 23135
23134 CONTINUE
      IF(.NOT.(C1 .EQ. 109 .AND. C2 .EQ. 51))GOTO 23136
      COMTYP = 19
      GOTO 23137
23136 CONTINUE
      IF(.NOT.(C1 .EQ. 109 .AND. C2 .EQ. 52))GOTO 23138
      COMTYP = 20
      GOTO 23139
23138 CONTINUE
      IF(.NOT.(C1 .EQ. 101 .AND. C2 .EQ. 104))GOTO 23140
      COMTYP = 21
      GOTO 23141
23140 CONTINUE
      IF(.NOT.(C1 .EQ. 111 .AND. C2 .EQ. 104))GOTO 23142
      COMTYP = 22
      GOTO 23143
23142 CONTINUE
      IF(.NOT.(C1 .EQ. 101 .AND. C2 .EQ. 102))GOTO 23144
      COMTYP = 23
      GOTO 23145
23144 CONTINUE
      IF(.NOT.(C1 .EQ. 111 .AND. C2 .EQ. 102))GOTO 23146
      COMTYP = 24
      GOTO 23147
23146 CONTINUE
      IF(.NOT.(C1 .EQ. 99 .AND. C2 .EQ. 99))GOTO 23148
      COMTYP = 25
      GOTO 23149
23148 CONTINUE
      IF(.NOT.(C1 .EQ. 110 .AND. C2 .EQ. 101))GOTO 23150
      COMTYP = 26
      GOTO 23151
23150 CONTINUE
      IF(.NOT.(C1 .EQ. 98 .AND. C2 .EQ. 115))GOTO 23152
      COMTYP = 27
      GOTO 23153
23152 CONTINUE
      IF(.NOT.(C1 .EQ. 106 .AND. C2 .EQ. 117))GOTO 23154
      COMTYP = 28
      GOTO 23155
23154 CONTINUE
      IF(.NOT.(C1 .EQ. 110 .AND. C2 .EQ. 106))GOTO 23156
      COMTYP = 29
      GOTO 23157
23156 CONTINUE
      COMTYP = 0
23157 CONTINUE
23155 CONTINUE
23153 CONTINUE
23151 CONTINUE
23149 CONTINUE
23147 CONTINUE
23145 CONTINUE
23143 CONTINUE
23141 CONTINUE
23139 CONTINUE
23137 CONTINUE
23135 CONTINUE
23133 CONTINUE
23131 CONTINUE
23129 CONTINUE
23127 CONTINUE
23125 CONTINUE
23123 CONTINUE
23121 CONTINUE
23119 CONTINUE
23117 CONTINUE
23115 CONTINUE
23113 CONTINUE
23111 CONTINUE
23109 CONTINUE
23107 CONTINUE
23105 CONTINUE
23103 CONTINUE
23101 CONTINUE
      RETURN
      END
      SUBROUTINE FSTACK (IARG)
      INTEGER I
      LOGICAL*1 IARG(40)
      COMMON /FLIST/ FLEVEL, FFILES(40, 10)
      INTEGER FLEVEL
      LOGICAL*1 FFILES
      IF(.NOT.(FLEVEL .LT. 10))GOTO 23158
      FLEVEL = FLEVEL + 1
      I=1
23160 IF(.NOT.(I.LE.40))GOTO 23162
      FFILES(I,FLEVEL) = IARG(I)
23161 I=I+1
      GOTO 23160
23162 CONTINUE
23158 CONTINUE
      RETURN
      END
      SUBROUTINE GETTL(BUF, TTL, LIM)
      LOGICAL*1 BUF(400), TTL(400)
      INTEGER I, LIM(2)
      COMMON /CPARAM/ FILL, LSVAL, INVAL, RMVAL, TIVAL, CEVAL, ULVAL, BO
     *VAL, TJUST(3), BSVAL, RJUST, CCHAR
      INTEGER FILL
      INTEGER LSVAL
      INTEGER INVAL
      INTEGER RMVAL
      INTEGER TIVAL
      INTEGER CEVAL
      INTEGER ULVAL
      INTEGER BOVAL
      INTEGER TJUST
      INTEGER BSVAL
      INTEGER RJUST
      LOGICAL*1 CCHAR
      I = 1
23163 IF(.NOT.(BUF(I) .NE. 32 .AND. BUF(I) .NE. 9 .AND. BUF(I) .NE. 10))
     *GOTO 23164
      I = I + 1
      GOTO 23163
23164 CONTINUE
      CALL SKIPBL(BUF, I)
      CALL SCOPY(BUF, I, TTL, 1)
      LIM(1) = INVAL
      LIM(2) = RMVAL
      RETURN
      END
      INTEGER FUNCTION GETVAL(BUF, ARGTYP)
      LOGICAL*1 BUF(400), ARGTYP
      INTEGER CTOI
      INTEGER I
      I = 1
23165 IF(.NOT.(BUF(I) .NE. 32 .AND. BUF(I) .NE. 9 .AND. BUF(I) .NE. 10))
     *GOTO 23166
      I = I + 1
      GOTO 23165
23166 CONTINUE
      CALL SKIPBL(BUF, I)
      ARGTYP = BUF(I)
      IF(.NOT.(ARGTYP .EQ. 43 .OR. ARGTYP .EQ. 45))GOTO 23167
      I = I + 1
23167 CONTINUE
      GETVAL = CTOI(BUF, I)
      RETURN
      END
      SUBROUTINE ROFINT
      COMMON /CPARAM/ FILL, LSVAL, INVAL, RMVAL, TIVAL, CEVAL, ULVAL, BO
     *VAL, TJUST(3), BSVAL, RJUST, CCHAR
      INTEGER FILL
      INTEGER LSVAL
      INTEGER INVAL
      INTEGER RMVAL
      INTEGER TIVAL
      INTEGER CEVAL
      INTEGER ULVAL
      INTEGER BOVAL
      INTEGER TJUST
      INTEGER BSVAL
      INTEGER RJUST
      LOGICAL*1 CCHAR
      COMMON /CPAGE/ CURPAG,NEWPAG,LINENO,PLVAL,M1VAL,M2VAL,M3VAL,M4VAL,
     * BOTTOM, EHLIM(2), OHLIM(2), EFLIM(2), OFLIM(2), STOPX, FRSTPG, LS
     *TPAG, PRINT, OFFSET, EHEAD(400), OHEAD(400), EFOOT(400), OFOOT(400
     *)
      INTEGER CURPAG
      INTEGER NEWPAG
      INTEGER LINENO
      INTEGER PLVAL
      INTEGER M1VAL
      INTEGER M2VAL
      INTEGER M3VAL
      INTEGER M4VAL
      INTEGER BOTTOM
      INTEGER EHLIM
      INTEGER FRSTPG
      INTEGER LSTPAG
      INTEGER PRINT
      INTEGER OFFSET
      INTEGER OHLIM
      INTEGER EFLIM
      INTEGER OFLIM
      INTEGER STOPX
      LOGICAL*1 EHEAD
      LOGICAL*1 OHEAD
      LOGICAL*1 EFOOT
      LOGICAL*1 OFOOT
      COMMON /COUT/ OUTP, OUTW, OUTWDS, PREP, OUTBUF(400)
      INTEGER OUTP
      INTEGER OUTW
      INTEGER PREP
      INTEGER OUTWDS
      LOGICAL*1 OUTBUF
      INVAL = 0
      RMVAL = 65
      TIVAL = 0
      LSVAL = 1
      FILL = 1
      CEVAL = 0
      ULVAL = 0
      BOVAL = 0
      CCHAR = 46
      TJUST(1) = 1
      TJUST(2) = 2
      TJUST(3) = 3
      BSVAL = 0
      RJUST = 1
      LINENO = 0
      CURPAG = 0
      NEWPAG = 1
      PLVAL = 66
      M1VAL = 3
      M2VAL = 2
      M3VAL = 2
      M4VAL = 3
      BOTTOM = PLVAL - M3VAL - M4VAL
      EHEAD(1) = 0
      OHEAD(1) = 0
      EFOOT(1) = 0
      OFOOT(1) = 0
      EHLIM(1) = INVAL
      EHLIM(2) = RMVAL
      OHLIM(1) = INVAL
      OHLIM(2) = RMVAL
      EFLIM(1) = INVAL
      EFLIM(2) = RMVAL
      OFLIM(1) = INVAL
      OFLIM(2) = RMVAL
      PRINT = 1
      FRSTPG = 0
      LSTPAG = 1000
      STOPX = 0
      OFFSET = 0
      OUTP = 0
      OUTW = 0
      OUTWDS = 0
      PREP = 0
      RETURN
      END
      SUBROUTINE LEADBL(BUF)
      LOGICAL*1 BUF(400)
      INTEGER I, J
      COMMON /CPARAM/ FILL, LSVAL, INVAL, RMVAL, TIVAL, CEVAL, ULVAL, BO
     *VAL, TJUST(3), BSVAL, RJUST, CCHAR
      INTEGER FILL
      INTEGER LSVAL
      INTEGER INVAL
      INTEGER RMVAL
      INTEGER TIVAL
      INTEGER CEVAL
      INTEGER ULVAL
      INTEGER BOVAL
      INTEGER TJUST
      INTEGER BSVAL
      INTEGER RJUST
      LOGICAL*1 CCHAR
      CALL BRK
      I = 1
23169 IF(.NOT.(BUF(I) .EQ. 32))GOTO 23171
23170 I = I + 1
      GOTO 23169
23171 CONTINUE
      IF(.NOT.(BUF(I) .NE. 10))GOTO 23172
      TIVAL = I - 1
23172 CONTINUE
      J = 1
23174 IF(.NOT.(BUF(I) .NE. 0))GOTO 23176
      BUF(J) = BUF(I)
      I = I + 1
23175 J = J + 1
      GOTO 23174
23176 CONTINUE
      BUF(J) = 0
      RETURN
      END
      SUBROUTINE PFOOT
      COMMON /CPAGE/ CURPAG,NEWPAG,LINENO,PLVAL,M1VAL,M2VAL,M3VAL,M4VAL,
     * BOTTOM, EHLIM(2), OHLIM(2), EFLIM(2), OFLIM(2), STOPX, FRSTPG, LS
     *TPAG, PRINT, OFFSET, EHEAD(400), OHEAD(400), EFOOT(400), OFOOT(400
     *)
      INTEGER CURPAG
      INTEGER NEWPAG
      INTEGER LINENO
      INTEGER PLVAL
      INTEGER M1VAL
      INTEGER M2VAL
      INTEGER M3VAL
      INTEGER M4VAL
      INTEGER BOTTOM
      INTEGER EHLIM
      INTEGER FRSTPG
      INTEGER LSTPAG
      INTEGER PRINT
      INTEGER OFFSET
      INTEGER OHLIM
      INTEGER EFLIM
      INTEGER OFLIM
      INTEGER STOPX
      LOGICAL*1 EHEAD
      LOGICAL*1 OHEAD
      LOGICAL*1 EFOOT
      LOGICAL*1 OFOOT
      INTEGER EVEN
      CALL SKIP(M3VAL)
      IF(.NOT.(EVEN(CURPAG) .EQ. 1))GOTO 23177
      CALL PUTTL(EFOOT,EFLIM,CURPAG)
      GOTO 23178
23177 CONTINUE
      CALL PUTTL(OFOOT,OFLIM,CURPAG)
23178 CONTINUE
      IF(.NOT.(PRINT .EQ. 1))GOTO 23179
      CALL PUTC(12)
23179 CONTINUE
      RETURN
      END
      SUBROUTINE PHEAD
      COMMON /CPAGE/ CURPAG,NEWPAG,LINENO,PLVAL,M1VAL,M2VAL,M3VAL,M4VAL,
     * BOTTOM, EHLIM(2), OHLIM(2), EFLIM(2), OFLIM(2), STOPX, FRSTPG, LS
     *TPAG, PRINT, OFFSET, EHEAD(400), OHEAD(400), EFOOT(400), OFOOT(400
     *)
      INTEGER CURPAG
      INTEGER NEWPAG
      INTEGER LINENO
      INTEGER PLVAL
      INTEGER M1VAL
      INTEGER M2VAL
      INTEGER M3VAL
      INTEGER M4VAL
      INTEGER BOTTOM
      INTEGER EHLIM
      INTEGER FRSTPG
      INTEGER LSTPAG
      INTEGER PRINT
      INTEGER OFFSET
      INTEGER OHLIM
      INTEGER EFLIM
      INTEGER OFLIM
      INTEGER STOPX
      LOGICAL*1 EHEAD
      LOGICAL*1 OHEAD
      LOGICAL*1 EFOOT
      LOGICAL*1 OFOOT
      COMMON /RSCRAT/ TBUF1(400), TBUF2(400), TTL(400)
      LOGICAL*1 TBUF1
      LOGICAL*1 TBUF2
      LOGICAL*1 TTL
      INTEGER EVEN, FIRST, TTY, GETLIN, JUNK
      DATA FIRST /1/
      CURPAG = NEWPAG
      IF(.NOT.(CURPAG .GE. FRSTPG .AND. CURPAG .LE. LSTPAG))GOTO 23181
      PRINT = 1
      GOTO 23182
23181 CONTINUE
      PRINT = 0
23182 CONTINUE
      IF(.NOT.(PRINT .EQ. 1))GOTO 23183
      IF(.NOT.(FIRST .EQ. 1))GOTO 23185
      IF(.NOT.(STOPX .NE. 0 .AND. TTY(2) .EQ. 1))GOTO 23187
      CALL PUTLIN(39HPosition paper, then hit CR to continue, 2)
      CALL PUTCH(10, 2)
23187 CONTINUE
      FIRST = 0
      IF(.NOT.(TTY(2) .NE. 1))GOTO 23189
      CALL PUTC(12)
23189 CONTINUE
23185 CONTINUE
      IF(.NOT.(STOPX .NE. 0 .AND. TTY(2) .EQ. 1))GOTO 23191
      JUNK = GETLIN (TBUF1, STOPX)
23191 CONTINUE
23183 CONTINUE
      NEWPAG = NEWPAG + 1
      CALL SKIP(M1VAL-1)
      LINENO = MAX0(M1VAL-1, 0)
      IF(.NOT.(EVEN(CURPAG) .EQ. 1))GOTO 23193
      CALL PUTTL(EHEAD,EHLIM,CURPAG)
      GOTO 23194
23193 CONTINUE
      CALL PUTTL(OHEAD,OHLIM,CURPAG)
23194 CONTINUE
      CALL SKIP(M2VAL)
      LINENO = LINENO + MAX0(M2VAL, 0)
      RETURN
      END
      SUBROUTINE PUT(BUF)
      LOGICAL*1 BUF(400)
      INTEGER I
      COMMON /CPAGE/ CURPAG,NEWPAG,LINENO,PLVAL,M1VAL,M2VAL,M3VAL,M4VAL,
     * BOTTOM, EHLIM(2), OHLIM(2), EFLIM(2), OFLIM(2), STOPX, FRSTPG, LS
     *TPAG, PRINT, OFFSET, EHEAD(400), OHEAD(400), EFOOT(400), OFOOT(400
     *)
      INTEGER CURPAG
      INTEGER NEWPAG
      INTEGER LINENO
      INTEGER PLVAL
      INTEGER M1VAL
      INTEGER M2VAL
      INTEGER M3VAL
      INTEGER M4VAL
      INTEGER BOTTOM
      INTEGER EHLIM
      INTEGER FRSTPG
      INTEGER LSTPAG
      INTEGER PRINT
      INTEGER OFFSET
      INTEGER OHLIM
      INTEGER EFLIM
      INTEGER OFLIM
      INTEGER STOPX
      LOGICAL*1 EHEAD
      LOGICAL*1 OHEAD
      LOGICAL*1 EFOOT
      LOGICAL*1 OFOOT
      COMMON /CPARAM/ FILL, LSVAL, INVAL, RMVAL, TIVAL, CEVAL, ULVAL, BO
     *VAL, TJUST(3), BSVAL, RJUST, CCHAR
      INTEGER FILL
      INTEGER LSVAL
      INTEGER INVAL
      INTEGER RMVAL
      INTEGER TIVAL
      INTEGER CEVAL
      INTEGER ULVAL
      INTEGER BOVAL
      INTEGER TJUST
      INTEGER BSVAL
      INTEGER RJUST
      LOGICAL*1 CCHAR
      IF(.NOT.(LINENO .EQ. 0 .OR. LINENO .GT. BOTTOM))GOTO 23195
      CALL PHEAD
23195 CONTINUE
      IF(.NOT.(PRINT .EQ. 1))GOTO 23197
      I=1
23199 IF(.NOT.(I.LE.OFFSET))GOTO 23201
      CALL PUTC (32)
23200 I=I+1
      GOTO 23199
23201 CONTINUE
23197 CONTINUE
      I = 1
23202 IF(.NOT.(I .LE. TIVAL))GOTO 23204
      IF(.NOT.(PRINT .EQ. 1))GOTO 23205
      CALL PUTC(32)
23205 CONTINUE
23203 I = I + 1
      GOTO 23202
23204 CONTINUE
      TIVAL = INVAL
      IF(.NOT.(PRINT .EQ. 1))GOTO 23207
      CALL PUTLIN(BUF, 2)
23207 CONTINUE
      CALL SKIP(MIN0(LSVAL-1, BOTTOM-LINENO))
      LINENO = LINENO + LSVAL
      IF(.NOT.(LINENO .GT. BOTTOM))GOTO 23209
      CALL PFOOT
23209 CONTINUE
      RETURN
      END
      SUBROUTINE PUTTL(BUF, LIM, PAGENO)
      LOGICAL*1 BUF(400), CHARS(10), DELIM, DATBUF(10)
      INTEGER PAGENO, LIM(2), FIRST
      INTEGER NC, ITOC, I, J, N, LEFT, RIGHT, GFIELD
      COMMON /CPAGE/ CURPAG,NEWPAG,LINENO,PLVAL,M1VAL,M2VAL,M3VAL,M4VAL,
     * BOTTOM, EHLIM(2), OHLIM(2), EFLIM(2), OFLIM(2), STOPX, FRSTPG, LS
     *TPAG, PRINT, OFFSET, EHEAD(400), OHEAD(400), EFOOT(400), OFOOT(400
     *)
      INTEGER CURPAG
      INTEGER NEWPAG
      INTEGER LINENO
      INTEGER PLVAL
      INTEGER M1VAL
      INTEGER M2VAL
      INTEGER M3VAL
      INTEGER M4VAL
      INTEGER BOTTOM
      INTEGER EHLIM
      INTEGER FRSTPG
      INTEGER LSTPAG
      INTEGER PRINT
      INTEGER OFFSET
      INTEGER OHLIM
      INTEGER EFLIM
      INTEGER OFLIM
      INTEGER STOPX
      LOGICAL*1 EHEAD
      LOGICAL*1 OHEAD
      LOGICAL*1 EFOOT
      LOGICAL*1 OFOOT
      COMMON /CPARAM/ FILL, LSVAL, INVAL, RMVAL, TIVAL, CEVAL, ULVAL, BO
     *VAL, TJUST(3), BSVAL, RJUST, CCHAR
      INTEGER FILL
      INTEGER LSVAL
      INTEGER INVAL
      INTEGER RMVAL
      INTEGER TIVAL
      INTEGER CEVAL
      INTEGER ULVAL
      INTEGER BOVAL
      INTEGER TJUST
      INTEGER BSVAL
      INTEGER RJUST
      LOGICAL*1 CCHAR
      COMMON /RSCRAT/ TBUF1(400), TBUF2(400), TTL(400)
      LOGICAL*1 TBUF1
      LOGICAL*1 TBUF2
      LOGICAL*1 TTL
      DATA FIRST /1/
      IF(.NOT.(PRINT .EQ. 1 .AND. BUF(1) .NE. 0))GOTO 23211
      IF(.NOT.(FIRST .EQ. 1))GOTO 23213
      CALL DATE(DATBUF)
      DATBUF(10) = 0
      FIRST = 0
23213 CONTINUE
      LINENO = LINENO + 1
      LEFT = LIM(1) + 1
      RIGHT = LIM(2) + 1
      NC = ITOC(PAGENO, CHARS, 10)
      I = 1
      DELIM = BUF(I)
      J=1
23215 IF(.NOT.(J.LT.RIGHT))GOTO 23217
      TTL(J) = 32
23216 J=J+1
      GOTO 23215
23217 CONTINUE
      N = 0
23218 CONTINUE
      N = N + 1
      IF(.NOT.(GFIELD(BUF,I,RIGHT-LEFT,TBUF1,DELIM) .GT. 0))GOTO 23221
      CALL SBST (TBUF1,35,TBUF2,CHARS,NC)
      CALL SBST (TBUF2,37,TBUF1,DATBUF,9)
      CALL JUSTFY(TBUF1,LEFT,RIGHT,TJUST(N),TTL)
23221 CONTINUE
23219 IF(.NOT.(BUF(I) .EQ. 0 .OR. BUF(I) .EQ. 10 .OR. N .EQ. 3))GOTO 232
     *18
23220 CONTINUE
      TTL(RIGHT) = 10
      TTL(RIGHT+1) = 0
      I=1
23223 IF(.NOT.(I.LE.OFFSET))GOTO 23225
      CALL PUTC(32)
23224 I=I+1
      GOTO 23223
23225 CONTINUE
      I=1
23226 IF(.NOT.(TTL(I) .NE. 0))GOTO 23228
      CALL PUTC(TTL(I))
23227 I=I+1
      GOTO 23226
23228 CONTINUE
23211 CONTINUE
      RETURN
      END
      SUBROUTINE PUTWRD(WRDBUF, BS)
      LOGICAL*1 WRDBUF(400)
      INTEGER LENGTH, WIDTH
      INTEGER LAST, LLVAL, NEXTRA, W
      INTEGER BS, NB, I, J, WWIDTH
      COMMON /COUT/ OUTP, OUTW, OUTWDS, PREP, OUTBUF(400)
      INTEGER OUTP
      INTEGER OUTW
      INTEGER PREP
      INTEGER OUTWDS
      LOGICAL*1 OUTBUF
      COMMON /CPARAM/ FILL, LSVAL, INVAL, RMVAL, TIVAL, CEVAL, ULVAL, BO
     *VAL, TJUST(3), BSVAL, RJUST, CCHAR
      INTEGER FILL
      INTEGER LSVAL
      INTEGER INVAL
      INTEGER RMVAL
      INTEGER TIVAL
      INTEGER CEVAL
      INTEGER ULVAL
      INTEGER BOVAL
      INTEGER TJUST
      INTEGER BSVAL
      INTEGER RJUST
      LOGICAL*1 CCHAR
      COMMON /RSCRAT/ TBUF1(400), TBUF2(400), TTL(400)
      LOGICAL*1 TBUF1
      LOGICAL*1 TBUF2
      LOGICAL*1 TTL
      PREP = OUTP
      IF(.NOT.(OUTP .NE. 0 .AND. BS .GT. 0))GOTO 23229
      NB = 0
      GOTO 23230
23229 CONTINUE
      NB = 1
23230 CONTINUE
      W = WIDTH(WRDBUF)
      LAST = LENGTH(WRDBUF) + OUTP + NB
      LLVAL = RMVAL - TIVAL
      WWIDTH = OUTW + W + NB - 1
      IF(.NOT.(PREP .GT. 0 .AND. (WWIDTH .GT. LLVAL .OR. LAST .GE. 400))
     *)GOTO 23231
      LAST = LAST - PREP
      IF(.NOT.(NB .EQ. 0))GOTO 23233
      I = PREP + 1
      J = 1
23235 IF(.NOT.(I .LT. OUTP))GOTO 23236
      TBUF1(J) = OUTBUF(I)
      I = I + 1
      J = J + 1
      GOTO 23235
23236 CONTINUE
      CALL SCOPY(WRDBUF, 1, TBUF1, J)
      CALL SCOPY(TBUF1, 1, WRDBUF, 1)
      OUTWDS = OUTWDS - 1
23233 CONTINUE
      OUTP = PREP
      W = WIDTH(WRDBUF)
      NEXTRA = LLVAL - WWIDTH + W + 1
      NB = 1
      IF(.NOT.(OUTBUF(OUTP-2) .EQ. 46 .AND. OUTBUF(OUTP-1) .EQ. 32))GOTO
     * 23237
      OUTP = OUTP - 1
      NEXTRA = NEXTRA + 1
23237 CONTINUE
      IF(.NOT.(RJUST .EQ. 1))GOTO 23239
      CALL SPREAD(OUTBUF, OUTP, NEXTRA, OUTWDS)
      IF(.NOT.(NEXTRA .GT. 0 .AND. OUTWDS .GT. 1))GOTO 23241
      OUTP = OUTP + NEXTRA
23241 CONTINUE
23239 CONTINUE
      CALL BRK
23231 CONTINUE
      CALL SCOPY(WRDBUF, 1, OUTBUF, OUTP+NB)
      OUTP = LAST
      OUTBUF(OUTP) = 32
      OUTW = OUTW + W + NB
      OUTWDS = OUTWDS + NB
      RETURN
      END
      SUBROUTINE SET(PARAM, VAL, ARGTYP, DEFVAL, MINVAL, MAXVAL)
      LOGICAL*1 ARGTYP
      INTEGER DEFVAL, MAXVAL, MINVAL, PARAM, VAL
      IF(.NOT.(ARGTYP .EQ. 10))GOTO 23243
      PARAM = DEFVAL
      GOTO 23244
23243 CONTINUE
      IF(.NOT.(ARGTYP .EQ. 43))GOTO 23245
      PARAM = PARAM + VAL
      GOTO 23246
23245 CONTINUE
      IF(.NOT.(ARGTYP .EQ. 45))GOTO 23247
      PARAM = PARAM - VAL
      GOTO 23248
23247 CONTINUE
      PARAM = VAL
23248 CONTINUE
23246 CONTINUE
23244 CONTINUE
      PARAM = MIN0(PARAM, MAXVAL)
      PARAM = MAX0(PARAM, MINVAL)
      RETURN
      END
      SUBROUTINE SKIP(N)
      INTEGER I, N
      COMMON /CPAGE/ CURPAG,NEWPAG,LINENO,PLVAL,M1VAL,M2VAL,M3VAL,M4VAL,
     * BOTTOM, EHLIM(2), OHLIM(2), EFLIM(2), OFLIM(2), STOPX, FRSTPG, LS
     *TPAG, PRINT, OFFSET, EHEAD(400), OHEAD(400), EFOOT(400), OFOOT(400
     *)
      INTEGER CURPAG
      INTEGER NEWPAG
      INTEGER LINENO
      INTEGER PLVAL
      INTEGER M1VAL
      INTEGER M2VAL
      INTEGER M3VAL
      INTEGER M4VAL
      INTEGER BOTTOM
      INTEGER EHLIM
      INTEGER FRSTPG
      INTEGER LSTPAG
      INTEGER PRINT
      INTEGER OFFSET
      INTEGER OHLIM
      INTEGER EFLIM
      INTEGER OFLIM
      INTEGER STOPX
      LOGICAL*1 EHEAD
      LOGICAL*1 OHEAD
      LOGICAL*1 EFOOT
      LOGICAL*1 OFOOT
      I = 1
23249 IF(.NOT.(I .LE. N))GOTO 23251
      IF(.NOT.(PRINT .EQ. 1))GOTO 23252
      CALL PUTC(10)
23252 CONTINUE
23250 I = I + 1
      GOTO 23249
23251 CONTINUE
      RETURN
      END
      SUBROUTINE SPACE(N)
      INTEGER N
      COMMON /CPAGE/ CURPAG,NEWPAG,LINENO,PLVAL,M1VAL,M2VAL,M3VAL,M4VAL,
     * BOTTOM, EHLIM(2), OHLIM(2), EFLIM(2), OFLIM(2), STOPX, FRSTPG, LS
     *TPAG, PRINT, OFFSET, EHEAD(400), OHEAD(400), EFOOT(400), OFOOT(400
     *)
      INTEGER CURPAG
      INTEGER NEWPAG
      INTEGER LINENO
      INTEGER PLVAL
      INTEGER M1VAL
      INTEGER M2VAL
      INTEGER M3VAL
      INTEGER M4VAL
      INTEGER BOTTOM
      INTEGER EHLIM
      INTEGER FRSTPG
      INTEGER LSTPAG
      INTEGER PRINT
      INTEGER OFFSET
      INTEGER OHLIM
      INTEGER EFLIM
      INTEGER OFLIM
      INTEGER STOPX
      LOGICAL*1 EHEAD
      LOGICAL*1 OHEAD
      LOGICAL*1 EFOOT
      LOGICAL*1 OFOOT
      CALL BRK
      IF(.NOT.(LINENO .GT. BOTTOM))GOTO 23254
      RETURN
23254 CONTINUE
      IF(.NOT.(LINENO .EQ. 0))GOTO 23256
      CALL PHEAD
23256 CONTINUE
      CALL SKIP(MIN0(N, BOTTOM+1-LINENO))
      LINENO = LINENO + N
      IF(.NOT.(LINENO .GT. BOTTOM))GOTO 23258
      CALL PFOOT
23258 CONTINUE
      RETURN
      END
      SUBROUTINE SPREAD(BUF, OUTP, NEXTRA, OUTWDS)
      LOGICAL*1 BUF(400)
      COMMON /CPARAM/ FILL, LSVAL, INVAL, RMVAL, TIVAL, CEVAL, ULVAL, BO
     *VAL, TJUST(3), BSVAL, RJUST, CCHAR
      INTEGER FILL
      INTEGER LSVAL
      INTEGER INVAL
      INTEGER RMVAL
      INTEGER TIVAL
      INTEGER CEVAL
      INTEGER ULVAL
      INTEGER BOVAL
      INTEGER TJUST
      INTEGER BSVAL
      INTEGER RJUST
      LOGICAL*1 CCHAR
      INTEGER DIR, I, J, NB, NE, NEXTRA, NHOLES, OUTP, OUTWDS
      DATA DIR /0/
      IF(.NOT.(NEXTRA .LE. 0 .OR. OUTWDS .LE. 1))GOTO 23260
      RETURN
23260 CONTINUE
      DIR = 1 - DIR
      NE = NEXTRA
      NHOLES = OUTWDS - 1
      IF(.NOT.(TIVAL .NE. INVAL .AND. NHOLES .GT. 1))GOTO 23262
      NHOLES = NHOLES - 1
23262 CONTINUE
      I = OUTP - 1
      J = MIN0(400-2, I+NE)
23264 IF(.NOT.(I .LT. J))GOTO 23265
      BUF(J) = BUF(I)
      IF(.NOT.(BUF(I) .EQ. 32 .AND. BUF(I-1) .NE. 32))GOTO 23266
      IF(.NOT.(DIR .EQ. 0))GOTO 23268
      NB = (NE-1) / NHOLES + 1
      GOTO 23269
23268 CONTINUE
      NB = NE / NHOLES
23269 CONTINUE
      NE = NE - NB
      NHOLES = NHOLES - 1
23270 IF(.NOT.(NB .GT. 0))GOTO 23272
      J = J - 1
      BUF(J) = 32
23271 NB = NB - 1
      GOTO 23270
23272 CONTINUE
23266 CONTINUE
      I = I - 1
      J = J - 1
      GOTO 23264
23265 CONTINUE
      RETURN
      END
      SUBROUTINE TEXT(INBUF)
      LOGICAL*1 INBUF(400), WRDBUF(400)
      INTEGER GETWRB
      INTEGER I, BS, J
      COMMON /CPARAM/ FILL, LSVAL, INVAL, RMVAL, TIVAL, CEVAL, ULVAL, BO
     *VAL, TJUST(3), BSVAL, RJUST, CCHAR
      INTEGER FILL
      INTEGER LSVAL
      INTEGER INVAL
      INTEGER RMVAL
      INTEGER TIVAL
      INTEGER CEVAL
      INTEGER ULVAL
      INTEGER BOVAL
      INTEGER TJUST
      INTEGER BSVAL
      INTEGER RJUST
      LOGICAL*1 CCHAR
      IF(.NOT.(INBUF(1) .EQ. 32 .OR. INBUF(1) .EQ. 10))GOTO 23273
      CALL LEADBL(INBUF)
23273 CONTINUE
      IF(.NOT.(ULVAL .GT. 0))GOTO 23275
      CALL UNDERL(INBUF, WRDBUF, 400)
      ULVAL = ULVAL - 1
23275 CONTINUE
      IF(.NOT.(BOVAL .GT. 0))GOTO 23277
      CALL BOLD(INBUF, WRDBUF, 400)
      BOVAL = BOVAL - 1
23277 CONTINUE
      IF(.NOT.(CEVAL .GT. 0))GOTO 23279
      CALL CENTER(INBUF)
      CALL PUT(INBUF)
      CEVAL = CEVAL - 1
      GOTO 23280
23279 CONTINUE
      IF(.NOT.(INBUF(1) .EQ. 10))GOTO 23281
      CALL PUT(INBUF)
      GOTO 23282
23281 CONTINUE
      IF(.NOT.(FILL .EQ. 0))GOTO 23283
      CALL PUT(INBUF)
      GOTO 23284
23283 CONTINUE
      J = 0
      I = 1
23285 IF(.NOT.(GETWRB(INBUF, I, WRDBUF) .GT. 0))GOTO 23287
      J = J + 1
      IF(.NOT.(BSVAL .GT. 0 .AND. J .EQ. 1))GOTO 23288
      BS = 1
      BSVAL = BSVAL - 1
      GOTO 23289
23288 CONTINUE
      BS = 0
23289 CONTINUE
      CALL PUTWRD(WRDBUF, BS)
23286 GOTO 23285
23287 CONTINUE
23284 CONTINUE
23282 CONTINUE
23280 CONTINUE
      RETURN
      END
      SUBROUTINE UNDERL(BUF, TBUF, SIZE)
      INTEGER I, J, SIZE
      LOGICAL*1 BUF(SIZE), TBUF(SIZE)
      J = 1
      I = 1
23290 IF(.NOT.(BUF(I) .NE. 10 .AND. J .LT. SIZE-1))GOTO 23292
      IF(.NOT.(BUF(I) .NE. 32 .AND. BUF(I) .NE. 9 .AND. BUF(I) .NE. 8))G
     *OTO 23293
      TBUF(J) = 95
      TBUF(J+1) = 8
      J = J + 2
23293 CONTINUE
      TBUF(J) = BUF(I)
      J = J + 1
23291 I = I + 1
      GOTO 23290
23292 CONTINUE
      TBUF(J) = 10
      TBUF(J+1) = 0
      CALL SCOPY(TBUF, 1, BUF, 1)
      RETURN
      END
      INTEGER FUNCTION WIDTH(BUF)
      LOGICAL*1 BUF(400)
      INTEGER I
      WIDTH = 0
      I = 1
23295 IF(.NOT.(BUF(I) .NE. 0))GOTO 23297
      IF(.NOT.(BUF(I) .EQ. 8))GOTO 23298
      WIDTH = WIDTH - 1
      GOTO 23299
23298 CONTINUE
      IF(.NOT.(BUF(I) .NE. 10))GOTO 23300
      WIDTH = WIDTH + 1
23300 CONTINUE
23299 CONTINUE
23296 I = I + 1
      GOTO 23295
23297 CONTINUE
      RETURN
      END
      SUBROUTINE BOLD(BUF, TBUF, SIZE)
      INTEGER I, J, SIZE
      LOGICAL*1 BUF(SIZE), TBUF(SIZE)
      J = 1
      I = 1
23302 IF(.NOT.(BUF(I) .NE. 10 .AND. J .LT. SIZE-1))GOTO 23304
      TBUF(J) = BUF(I)
      J = J + 1
      IF(.NOT.(BUF(I) .NE. 32 .AND. BUF(I) .NE. 9 .AND. BUF(I) .NE. 8))G
     *OTO 23305
      TBUF(J) = 8
      TBUF(J+1) = TBUF(J-1)
      TBUF(J+2) = 8
      TBUF(J+3) = TBUF(J+1)
      J = J + 4
23305 CONTINUE
23303 I = I + 1
      GOTO 23302
23304 CONTINUE
      TBUF(J) = 10
      TBUF(J+1) = 0
      CALL SCOPY(TBUF, 1, BUF, 1)
      RETURN
      END
      INTEGER FUNCTION EVEN(I)
      INTEGER I,MOD
      IF(.NOT.(MOD(I,2) .EQ. 0))GOTO 23307
      EVEN = 1
      GOTO 23308
23307 CONTINUE
      EVEN = 0
23308 CONTINUE
      RETURN
      END
      INTEGER FUNCTION GETWRB(IN,I,OUT)
      LOGICAL*1 IN(100),OUT(100)
      INTEGER I, J
23309 IF(.NOT.(IN(I) .EQ. 32 .OR. IN(I) .EQ. 9))GOTO 23310
      I = I + 1
      GOTO 23309
23310 CONTINUE
      J = 1
23311 IF(.NOT.(IN(I) .NE. 0 .AND. IN(I) .NE. 32 .AND. IN(I) .NE. 9 .AND.
     * IN(I) .NE. 10))GOTO 23312
      OUT(J) = IN(I)
      I = I + 1
      J = J + 1
      GOTO 23311
23312 CONTINUE
23313 CONTINUE
23316 IF(.NOT.(IN(I) .EQ. 32))GOTO 23317
      OUT(J) = 32
      I = I + 1
      J = J + 1
      GOTO 23316
23317 CONTINUE
23318 IF(.NOT.(IN(I) .EQ. 46 .OR. IN(I) .EQ. 44 .OR. IN(I) .EQ. 58 .OR. 
     *IN(I) .EQ. 125 .OR. IN(I) .EQ. 93 .OR. IN(I) .EQ. 41 .OR. IN(I) .E
     *Q. 59 .OR. IN(I) .EQ. 8))GOTO 23319
      OUT(J) = IN(I)
      I = I + 1
      J = J + 1
      GOTO 23318
23319 CONTINUE
23314 IF(.NOT.(IN(I) .NE. 32))GOTO 23313
23315 CONTINUE
      IF(.NOT.(OUT(J-1) .EQ. 32))GOTO 23320
      J = J - 1
23320 CONTINUE
      OUT(J) = 0
      GETWRB = J - 1
      RETURN
      END
      SUBROUTINE JCOPY(FROM,I,TO,J)
      LOGICAL*1 FROM(100),TO(100)
      INTEGER I,J,K1,K2
      K1 = I
      K2 = J
23322 IF(.NOT.(FROM(K1) .NE. 0))GOTO 23323
      TO(K2) = FROM(K1)
      K1 = K1 + 1
      K2 = K2 + 1
      GOTO 23322
23323 CONTINUE
      RETURN
      END
      INTEGER FUNCTION GFIELD(BUF,I,N,TEMP,DELIM)
      LOGICAL*1 BUF(100), TEMP(100), DELIM
      INTEGER I, J, N
      J = 1
      IF(.NOT.(N .GT. 0))GOTO 23324
      IF(.NOT.(BUF(I) .EQ. DELIM))GOTO 23326
      I = I + 1
23326 CONTINUE
23328 IF(.NOT.(BUF(I) .NE. DELIM .AND. BUF(I) .NE. 0 .AND. BUF(I) .NE. 1
     *0 .AND. J .LE. N))GOTO 23329
      TEMP(J) = BUF(I)
      J = J + 1
      I = I + 1
      GOTO 23328
23329 CONTINUE
23324 CONTINUE
      TEMP(J) = 0
      GFIELD = J - 1
23330 IF(.NOT.(BUF(I) .NE. DELIM .AND. BUF(I) .NE. 0 .AND. BUF(I) .NE. 1
     *0))GOTO 23331
      I = I + 1
      GOTO 23330
23331 CONTINUE
      RETURN
      END
      SUBROUTINE JUSTFY(IN,LEFT,RIGHT,TYPE,OUT)
      LOGICAL*1 IN(100), OUT(100)
      INTEGER LEFT, RIGHT, TYPE, J, N, WIDTH
      N = WIDTH(IN)
      IF(.NOT.(TYPE .EQ. 3))GOTO 23332
      CALL JCOPY(IN,1,OUT,RIGHT-N)
      GOTO 23333
23332 CONTINUE
      IF(.NOT.(TYPE .EQ. 2))GOTO 23334
      J = MAX0((RIGHT+LEFT-N)/2,LEFT)
      CALL JCOPY(IN,1,OUT,J)
      GOTO 23335
23334 CONTINUE
      CALL JCOPY(IN,1,OUT,LEFT)
23335 CONTINUE
23333 CONTINUE
      RETURN
      END
      SUBROUTINE SBST (IN,CHAR,OUT,SUBARA,N)
      LOGICAL*1 IN(100), CHAR, OUT(100), SUBARA(100)
      INTEGER I, J, K, N
      I = 1
      J = 1
23336 IF(.NOT.(IN(I) .NE. 0))GOTO 23337
      IF(.NOT.(IN(I) .EQ. CHAR))GOTO 23338
      K=1
23340 IF(.NOT.(K.LE.N))GOTO 23342
      OUT(J) = SUBARA(K)
      J = J + 1
23341 K=K+1
      GOTO 23340
23342 CONTINUE
      GOTO 23339
23338 CONTINUE
      OUT(J) = IN(I)
      J = J + 1
23339 CONTINUE
      I = I + 1
      GOTO 23336
23337 CONTINUE
      OUT(J) = 0
      RETURN
      END
