      SUBROUTINE WARND0(FROM,TO)
      INTEGER FROM,TO
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER ROW
      INTEGER AAAAA0(5)
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      DATA AAAAA0/231,239,238,229,0/
      ROW=TOPRO0
      GOTO 10002
10000 ROW=ROW+(1)
10002 IF((ROW.GT.BOTRO0))GOTO 10001
        IF((TOPLN0+ROW-TOPRO0.LT.FROM))GOTO 10000
        IF((TOPLN0+ROW-TOPRO0.GT.TO))GOTO 10000
          CALL LOADS0(AAAAA0,ROW,1,7-1)
10003 GOTO 10000
10001 RETURN
      END
      INTEGER FUNCTION ALLOC(PTR)
      INTEGER PTR
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER * 4 LAST
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      IF((FREEA0.NE.-1))GOTO 10004
        LAST=AND(:00177777,INTL(LASTB0))
        IF((LAST.GT.65520))GOTO 10005
          PTR=LASTB0
          LASTB0=LASTB0+(7)
          GOTO 10007
10005     PTR=-1
10006   GOTO 10007
10004   PTR=FREEA0
        FREEA0=PREVL0(FREEA0)
10007 ALLOC=PTR
      RETURN
      END
      INTEGER FUNCTION INJECT(LIN)
      INTEGER LIN(1)
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER I
      INTEGER MAKLIN
      INTEGER K1,K2,K3
      INTEGER GETIND
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      I=1
      GOTO 10010
10008 CONTINUE
10010 IF((LIN(I).EQ.0))GOTO 10009
        I=MAKLIN(LIN,I,K3)
        IF((I.NE.-3))GOTO 10011
          INJECT=-3
          ERRCO0=25
          GOTO 10009
10011   K1=GETIND(CURLN0)
        K2=NEXTL0(K1)
        CALL RELINK(K1,K3,K3,K2)
        CALL RELINK(K3,K2,K1,K3)
        CALL SVINS(CURLN0,1)
        CURLN0=CURLN0+(1)
        LASTL0=LASTL0+(1)
        INJECT=-2
      GOTO 10008
10009 RETURN
      END
      INTEGER FUNCTION MAKLIN(LIN,I,NEWIND)
      INTEGER LIN(1)
      INTEGER I
      INTEGER NEWIND
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER TEXT(512)
      INTEGER L,N
      INTEGER PTR
      INTEGER ALLOC
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      MAKLIN=-3
      IF((ALLOC(PTR).NE.-1))GOTO 10012
        RETURN
10012 N=I
      GOTO 10015
10013 N=N+(1)
10015 IF((LIN(N).EQ.0))GOTO 10014
        IF((LIN(N).NE.138))GOTO 10013
          N=N+(1)
          GOTO 10014
10014 IF((N-I.LT.512))GOTO 10017
        N=I+512-1
10017 L=N-I+1
      CALL MOVE$(LIN(I),TEXT,L)
      TEXT(L)=0
      SEEKA0(PTR)=SCREN0
      LINEL0(PTR)=L
      GLOBM0(PTR)=0
      MARKN0(PTR)=160
      CALL SEEKF(SCREN0,SCRAA0)
      CALL WRITEF(TEXT,L,SCRAA0)
      SCREN0=SCREN0+(L)
      BUFFE0=1
      NEWIND=PTR
      MAKLIN=N
      RETURN
      END
      SUBROUTINE SVINS(LN,N)
      INTEGER LN,N
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER I,LB
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      IF((LN.GE.SCTOP0))GOTO 10018
        SCTOP0=SCTOP0+(N)
        GOTO 10019
10018   LB=LN-SCTOP0+1
        I=1
        GOTO 10022
10020   I=I+(1)
10022   IF((I.GT.SCLEN0))GOTO 10021
          IF((SCLIN0(I).EQ.-1))GOTO 10020
          IF((SCLIN0(I).LE.LB))GOTO 10020
            SCLIN0(I)=SCLIN0(I)+(N)
10023   GOTO 10020
10021 CONTINUE
10019 RETURN
      END
      INTEGER FUNCTION APPEND(LINE,STR)
      INTEGER LINE
      INTEGER STR(1)
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER LIN(512),TERMI0
      INTEGER LEN,I
      INTEGER INJECT,HWINS0
      INTEGER DPOS,DOTSE0
      INTEGER K,GETTXT
      INTEGER AAAAB0(5)
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      DATA AAAAB0/225,240,228,190,0/
      CURLN0=LINE
      IF((STR(1).NE.186))GOTO 10024
        APPEND=INJECT(STR(2))
        GOTO 10025
10024   CMDRO0=TOPRO0+(CURLN0-TOPLN0)+1
        LIN(1)=0
        IF((INDEN0.GT.0))GOTO 10027
        IF((LINE.LE.0))GOTO 10027
        GOTO 10026
10027     LEN=MAX0(0,INDEN0-1)
          GOTO 10028
10026     K=GETTXT(LINE)
          LEN=1
          GOTO 10031
10029     LEN=LEN+(1)
10031     IF((TXTAA0(LEN).NE.160))GOTO 10030
          GOTO 10029
10030   CONTINUE
10028   DPOS=LEN
        APPEND=1
        GOTO 10034
10032   CONTINUE
10034   IF((APPEND.NE.1))GOTO 10033
          IF((HWINS0(0).NE.0))GOTO 10035
            IF((CMDRO0.LE.BOTRO0))GOTO 10036
              CMDRO0=TOPRO0+1
              CALL CPROW(BOTRO0,TOPRO0)
              CALL ADJUS0(CURLN0,CURLN0)
              IF((FIRSU0.LE.TOPLN0))GOTO 10037
                FIRSU0=TOPLN0
10037       CONTINUE
10036       CALL CLRROW(CMDRO0)
            IF((CMDRO0.GE.BOTRO0))GOTO 10039
              CALL CLRROW(CMDRO0+1)
10038       GOTO 10039
10035       IF((CMDRO0.LE.BOTRO0))GOTO 10040
              CMDRO0=CMDRO0-(1)
              CALL DELLI0(TOPRO0,1)
              CALL INSLI0(CMDRO0,1)
              TOPLN0=TOPLN0+(1)
              GOTO 10041
10040         CALL DELLI0(BOTRO0,1)
              CALL INSLI0(CMDRO0,1)
10041     CONTINUE
10039     CALL PROMPT(AAAAB0)
10042       CALL GETCMD(LIN,FIRST0,LEN,TERMI0)
          IF((TERMI0.EQ.132))GOTO 10042
          IF((TERMI0.EQ.139))GOTO 10042
          IF((TERMI0.EQ.141))GOTO 10042
          DOTSE0=0
          IF((LIN(1).NE.174))GOTO 10043
          IF((LIN(2).NE.138))GOTO 10043
          IF((LIN(3).NE.0))GOTO 10043
            DOTSE0=1
10043     I=1
          GOTO 10046
10044     I=I+(1)
10046     IF((I.GE.DPOS))GOTO 10045
          IF((LIN(I).NE.160))GOTO 10045
          GOTO 10044
10045     IF((I.NE.DPOS))GOTO 10047
          IF((LIN(DPOS).NE.174))GOTO 10047
          IF((LIN(DPOS+1).NE.138))GOTO 10047
          IF((LIN(DPOS+2).NE.0))GOTO 10047
            DOTSE0=1
10047     IF((DOTSE0.NE.1))GOTO 10048
            IF((HWINS0(0).NE.1))GOTO 10049
              CALL DELLI0(CMDRO0,1)
              CALL INSLI0(BOTRO0,1)
10049       APPEND=-2
            GOTO 10050
10048       IF((INJECT(LIN).NE.-3))GOTO 10051
              APPEND=-3
              GOTO 10052
10051         CALL PROMPT(0)
10052     CONTINUE
10050     CMDRO0=CMDRO0+(1)
          IF((TERMI0.EQ.134))GOTO 10032
            IF((INDEN0.LE.0))GOTO 10054
              LEN=INDEN0-1
              GOTO 10055
10054         LEN=1
              GOTO 10058
10056         LEN=LEN+(1)
10058         IF((LIN(LEN).NE.160))GOTO 10057
              GOTO 10056
10057       CONTINUE
10055       DPOS=LEN
            LIN(1)=0
10053   GOTO 10032
10033   CMDRO0=NROWS0-1
        IF((HWINS0(0).NE.1))GOTO 10059
          SCTOP0=TOPLN0
          I=1
          GOTO 10062
10060     I=I+(1)
10062     IF((I.GT.SCLEN0))GOTO 10061
            IF((SCTOP0+I-1.GT.LASTL0))GOTO 10063
              SCLIN0(I)=I
              GOTO 10060
10063         SCLIN0(I)=-1
10064     GOTO 10060
10061   CONTINUE
10059 CONTINUE
10025 IF((CURLN0.NE.0))GOTO 10065
      IF((LASTL0.LE.0))GOTO 10065
        CURLN0=1
10065 IF((FIRSU0.LE.LINE))GOTO 10066
        FIRSU0=LINE
10066 RETURN
      END
      SUBROUTINE CLRROW(ROW)
      INTEGER ROW
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      CALL LOADS0(0,ROW,1,7-1)
      CALL LOADS0(0,ROW,7+1,NCOLS0)
      RETURN
      END
      INTEGER FUNCTION CKCHAR(CH,ALTCH,LIN,I,FLAG,STATUS)
      INTEGER CH,ALTCH
      INTEGER LIN(1),I,FLAG,STATUS
      IF((LIN(I).EQ.CH))GOTO 10068
      IF((LIN(I).EQ.ALTCH))GOTO 10068
      GOTO 10067
10068   I=I+(1)
        FLAG=1
        GOTO 10069
10067   FLAG=0
10069 STATUS=-2
      CKCHAR=-2
      RETURN
      END
      INTEGER FUNCTION DELETE(PFROM,PTO,STATUS)
      INTEGER PFROM,PTO,STATUS
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER FROM,TO
      INTEGER L1
      INTEGER PREVLN
      INTEGER K1,K2,J1,J2
      INTEGER GETIND
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      FROM=PFROM
      TO=PTO
      IF((FROM.GT.0))GOTO 10070
        STATUS=-3
        ERRCO0=17
        GOTO 10071
10070   IF((FIRSU0.LE.FROM))GOTO 10072
          FIRSU0=FROM
10072   K1=GETIND(PREVLN(FROM))
        J1=NEXTL0(K1)
        J2=GETIND(TO)
        K2=NEXTL0(J2)
        LASTL0=LASTL0-(TO-FROM+1)
        CURLN0=PREVLN(FROM)
        CALL RELINK(K1,K2,K1,K2)
        IF((LIMBO0.EQ.-1))GOTO 10073
          L1=PREVL0(LIMBO0)
          PREVL0(LIMBO0)=FREEA0
          FREEA0=L1
10073   LOSTL0=LOSTL0+LIMCN0
        LIMBO0=J1
        LIMCN0=TO-FROM+1
        CALL RELINK(J2,J1,J2,J1)
        CALL SVDEL(FROM,TO-FROM+1)
        STATUS=-2
        BUFFE0=1
10071 DELETE=STATUS
      RETURN
      END
      SUBROUTINE SVDEL(LN,N)
      INTEGER LN,N
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER I,LB,UB
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      IF((LN+N.GT.SCTOP0))GOTO 10074
        SCTOP0=SCTOP0-(N)
        GOTO 10075
10074   IF((LN.GE.SCTOP0))GOTO 10076
          UB=LN+N-SCTOP0
          I=1
          GOTO 10079
10077     I=I+(1)
10079     IF((I.GT.SCLEN0))GOTO 10078
            IF((SCLIN0(I).NE.-1))GOTO 10080
              GOTO 10077
10080         IF((SCLIN0(I).GT.UB))GOTO 10082
                SCLIN0(I)=-1
                GOTO 10083
10082           SCLIN0(I)=SCLIN0(I)-(UB)
10083       CONTINUE
10081     GOTO 10077
10078     SCTOP0=LN
          GOTO 10084
10076     LB=LN-SCTOP0
          UB=LN+N-SCTOP0
          I=1
          GOTO 10087
10085     I=I+(1)
10087     IF((I.GT.SCLEN0))GOTO 10086
            IF((SCLIN0(I).EQ.-1))GOTO 10085
            IF((SCLIN0(I).LE.LB))GOTO 10085
            GOTO 10088
10088         IF((SCLIN0(I).GT.UB))GOTO 10091
                SCLIN0(I)=-1
                GOTO 10092
10091           SCLIN0(I)=SCLIN0(I)-(N)
10092       CONTINUE
10090     GOTO 10085
10086   CONTINUE
10084 CONTINUE
10075 RETURN
      END
      INTEGER FUNCTION DOPRNT(FROM,TO)
      INTEGER FROM,TO
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER LOCAL0,LOCAM0
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      LOCAL0=TO
      LOCAM0=FROM
      IF((LOCAM0.GT.0))GOTO 10093
        DOPRNT=-3
        ERRCO0=17
        GOTO 10094
10093   CALL ADJUS0(LOCAM0,LOCAL0)
        CURLN0=LOCAL0
        DOPRNT=-2
10094 RETURN
      END
      SUBROUTINE OVERL0(STATUS)
      INTEGER STATUS
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER TERMI0,SAVTXT(512),EMPTY(2)
      INTEGER LNG,KNAME,VCOL,LCURLN,SCURLN
      INTEGER INJECT,NEXTLN,EQUAL
      INTEGER INDX
      INTEGER GETIND,GETTXT
      INTEGER AAAAC0
      INTEGER AAAAD0
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      DATA EMPTY/138,0/
      STATUS=-2
      IF((LINE10.NE.0))GOTO 10095
        CURLN0=0
        STATUS=INJECT(EMPTY)
        IF((STATUS.NE.-3))GOTO 10096
          RETURN
10096   FIRSU0=1
        LINE10=1
        LINE20=LINE20+(1)
10095 LCURLN=LINE10
      GOTO 10099
10097 LCURLN=LCURLN+(1)
10099 IF((LCURLN.GT.LINE20))GOTO 10098
        CURLN0=LCURLN
        VCOL=OVERM0
10100     CALL ADJUS0(CURLN0,CURLN0)
          CALL UPDSC0
          CMDRO0=CURLN0-TOPLN0+TOPRO0
          INDX=GETTXT(CURLN0)
          LNG=LINEL0(INDX)
          IF((TXTAA0(LNG-1).NE.138))GOTO 10101
            LNG=LNG-(1)
10101     IF((VCOL.GT.0))GOTO 10102
            VCOL=LNG
10102     CONTINUE
10103     IF((LNG.GE.VCOL))GOTO 10104
            TXTAA0(LNG)=160
            LNG=LNG+(1)
          GOTO 10103
10104     TXTAA0(LNG)=138
          TXTAA0(LNG+1)=0
          CALL MOVE$(TXTAA0,SAVTXT,LNG+1)
          CALL GETCMD(TXTAA0,FIRST0,VCOL,TERMI0)
          IF((FIRSU0.LE.CURLN0))GOTO 10105
            FIRSU0=CURLN0
10105     IF((TERMI0.NE.134))GOTO 10106
            GOTO 10098
10106     IF((EQUAL(TXTAA0,SAVTXT).NE.0))GOTO 10107
            KNAME=MARKN0(INDX)
            CALL DELETE(CURLN0,CURLN0,STATUS)
            SCURLN=CURLN0
            IF((STATUS.NE.-2))GOTO 10108
              STATUS=INJECT(TXTAA0)
10108       IF((STATUS.NE.-3))GOTO 10109
              GOTO 10098
10109       INDX=GETIND(NEXTLN(SCURLN))
            MARKN0(INDX)=KNAME
10107     AAAAC0=TERMI0
          GOTO 10110
10111       IF((CURLN0.LE.1))GOTO 10112
              CURLN0=CURLN0-(1)
              GOTO 10114
10112         CURLN0=LASTL0
10113     GOTO 10114
10115       IF((CURLN0.GE.LASTL0))GOTO 10116
              CURLN0=CURLN0+(1)
              GOTO 10114
10116         CURLN0=MIN0(1,LASTL0)
10117     GOTO 10114
10118       VCOL=1
          GOTO 10114
10110     AAAAD0=AAAAC0-131
          GOTO(10111,10119,10119,10119,10119,10119,10119,10115,10119,   
     *  10118),AAAAD0
10119     CONTINUE
10114   CONTINUE
        IF((TERMI0.EQ.132))GOTO 10100
        IF((TERMI0.EQ.139))GOTO 10100
        IF((TERMI0.EQ.141))GOTO 10100
      GOTO 10097
10098 CMDRO0=NROWS0-1
      RETURN
      END
      INTEGER FUNCTION PTSCAN(WAY,NUM)
      INTEGER WAY,NUM
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER MATCH
      INTEGER K
      INTEGER GETIND
      LOGICAL INTRPT,BRKFL0
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      NUM=CURLN0
      K=GETIND(NUM)
10120   CALL BUMP(NUM,K,WAY)
        CALL GTXT(K)
        IF((MATCH(TXTAA0,PATAA0).NE.1))GOTO 10121
          PTSCAN=-2
          RETURN
10121 CONTINUE
      IF((NUM.EQ.CURLN0))GOTO 10122
      IF(INTRPT(BRKFL0))GOTO 10122
      GOTO 10120
10122 CONTINUE
      IF((ERRCO0.NE.7))GOTO 10123
        ERRCO0=19
10123 PTSCAN=-3
      RETURN
      END
      SUBROUTINE BUMP(LINE,IX,WAY)
      INTEGER LINE,WAY
      INTEGER IX
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      IF((WAY.NE.0))GOTO 10124
        IX=NEXTL0(IX)
        IF((IX.NE.LINE00))GOTO 10125
          LINE=0
          GOTO 10127
10125     LINE=LINE+(1)
10126   GOTO 10127
10124   IF((IX.NE.LINE00))GOTO 10128
          LINE=LASTL0
          GOTO 10129
10128     LINE=LINE-(1)
10129   IX=PREVL0(IX)
10127 RETURN
      END
      INTEGER FUNCTION SUBST(SUB,GFLAG,GLOB)
      INTEGER SUB(256)
      INTEGER GFLAG,GLOB
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER NEW(512),KNAME
      INTEGER J,K,JUNK,LASTM,LINE,M,STATUS,SUBBED,INX,TAGBEG(10),TAGEND(
     *10)
      INTEGER ADDSET,AMATCH,GETTXT,INJECT
      INTEGER INX
      INTEGER GETIND
      LOGICAL INTRPT,BRKFL0
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      IF((GLOBA0.NE.1))GOTO 10130
      IF((GLOB.NE.1))GOTO 10130
        SUBST=-2
        GOTO 10131
10130   SUBST=-3
10131 IF((LINE10.GT.0))GOTO 10132
        ERRCO0=17
        RETURN
10132 IF((INDEX(PATAA0,138).EQ.0))GOTO 10133
        ERRCO0=3
        RETURN
10133 LINE=LINE10
      GOTO 10136
10134 LINE=LINE+(1)
10136 IF((LINE.GT.LINE20))GOTO 10135
        IF((.NOT.INTRPT(BRKFL0)))GOTO 10137
          SUBST=-3
          RETURN
10137   J=1
        SUBBED=0
        INX=GETTXT(LINE)
        LASTM=0
        K=1
        GOTO 10140
10138   CONTINUE
10140   IF((TXTAA0(K).EQ.0))GOTO 10139
          DO 10141 M=2,10
            TAGBEG(M)=0
            TAGEND(M)=0
10141     CONTINUE
10142     IF((GFLAG.EQ.1))GOTO 10144
          IF((SUBBED.EQ.0))GOTO 10144
          GOTO 10143
10144       M=AMATCH(TXTAA0,K,PATAA0,TAGBEG(2),TAGEND(2))
            GOTO 10145
10143       M=0
10145     IF((M.LE.0))GOTO 10146
          IF((LASTM.EQ.M))GOTO 10146
            SUBBED=1
            TAGBEG(1)=K
            TAGEND(1)=M
            CALL CATSUB(TXTAA0,TAGBEG,TAGEND,SUB,NEW,J,512)
            LASTM=M
10146     IF((M.EQ.0))GOTO 10148
          IF((M.EQ.K))GOTO 10148
          GOTO 10147
10148       JUNK=ADDSET(TXTAA0(K),NEW,J,512)
            K=K+(1)
            GOTO 10138
10147       K=M
10149   GOTO 10138
10139   IF((SUBBED.NE.1))GOTO 10150
          IF((ADDSET(0,NEW,J,512).NE.0))GOTO 10151
            SUBST=-3
            ERRCO0=13
            GOTO 10135
10151     KNAME=MARKN0(INX)
          CALL DELETE(LINE,LINE,STATUS)
          SUBST=INJECT(NEW)
          IF((FIRSU0.LE.CURLN0))GOTO 10152
            FIRSU0=CURLN0
10152     IF((SUBST.NE.-3))GOTO 10153
            GOTO 10135
10153     INX=GETIND(CURLN0)
          MARKN0(INX)=KNAME
          SUBST=-2
          BUFFE0=1
          GOTO 10134
10150     ERRCO0=26
10154 GOTO 10134
10135 RETURN
      END
      INTEGER FUNCTION OPTPAT(LIN,I)
      INTEGER LIN(512)
      INTEGER I
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER MAKPAT
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      IF((LIN(I).NE.0))GOTO 10155
        I=-3
        GOTO 10156
10155   IF((LIN(I+1).NE.0))GOTO 10157
          I=-3
          GOTO 10158
10157     IF((LIN(I+1).NE.LIN(I)))GOTO 10159
            I=I+1
            GOTO 10160
10159       I=MAKPAT(LIN,I+1,LIN(I),PATAA0)
10160   CONTINUE
10158 CONTINUE
10156 IF((PATAA0(1).NE.0))GOTO 10161
        OPTPAT=-3
        ERRCO0=2
        GOTO 10162
10161   IF((I.NE.-3))GOTO 10163
          PATAA0(1)=0
          OPTPAT=-3
          ERRCO0=3
          GOTO 10164
10163     OPTPAT=-2
10164 CONTINUE
10162 RETURN
      END
      INTEGER FUNCTION GETRHS(LIN,I,SUB,GFLAG)
      INTEGER LIN(512),SUB(256)
      INTEGER GFLAG,I
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER MAKSUB
      INTEGER SAVED0
      INTEGER J
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      IF((UNIXM0.NE.1))GOTO 10165
        SAVED0=165
        GOTO 10166
10165   SAVED0=166
10166 ERRCO0=5
      GETRHS=-3
      IF((LIN(I).NE.0))GOTO 10167
        RETURN
10167 IF((LIN(I+1).NE.SAVED0))GOTO 10168
      IF((LIN(I+2).EQ.LIN(I)))GOTO 10169
      IF((LIN(I+2).EQ.138))GOTO 10169
      GOTO 10168
10169   CALL CTOC(SUBSA0,SUB,256)
        I=I+(2)
        IF((LIN(I).NE.138))GOTO 10171
          LIN(I)=LIN(I-2)
          LIN(I+1)=138
          LIN(I+2)=0
          PEEKC0=143
10170   GOTO 10171
10168   IF((LIN(I+1).NE.138))GOTO 10172
          LIN(I+1)=LIN(I)
          LIN(I+2)=138
          LIN(I+3)=0
          PEEKC0=143
          GOTO 10173
10172     J=I
          GOTO 10176
10174     J=J+(1)
10176     IF((LIN(J).EQ.0))GOTO 10175
          GOTO 10174
10175     J=J-(2)
          IF((LIN(J).EQ.240))GOTO 10178
          IF((LIN(J).EQ.208))GOTO 10178
          GOTO 10177
10178       J=J-(1)
            IF((LIN(J).EQ.231))GOTO 10180
            IF((LIN(J).EQ.199))GOTO 10180
            GOTO 10179
10180         IF((J.LT.I+1))GOTO 10181
              IF((LIN(J-1).NE.LIN(I)))GOTO 10181
              IF((LIN(J-2).NE.ESCAP0))GOTO 10188
              IF((LIN(J-3).EQ.ESCAP0))GOTO 10188
              GOTO 10181
10181           J=J+(2)
                LIN(J)=LIN(I)
                LIN(J+1)=138
                LIN(J+2)=0
                PEEKC0=143
10183         GOTO 10188
10179         IF((J.LT.I+1))GOTO 10185
              IF((LIN(J).NE.LIN(I)))GOTO 10185
              IF((LIN(J-1).NE.ESCAP0))GOTO 10187
              IF((LIN(J-2).EQ.ESCAP0))GOTO 10187
              GOTO 10185
10185           J=J+(2)
                LIN(J)=LIN(I)
                LIN(J+1)=138
                LIN(J+2)=0
                PEEKC0=143
10187       CONTINUE
10184       GOTO 10188
10177       IF((LIN(J).EQ.231))GOTO 10190
            IF((LIN(J).EQ.199))GOTO 10190
            GOTO 10189
10190         J=J-(1)
              IF((J.LT.I+1))GOTO 10191
              IF((LIN(J).NE.LIN(I)))GOTO 10191
              IF((LIN(J-1).NE.ESCAP0))GOTO 10194
              IF((LIN(J-2).EQ.ESCAP0))GOTO 10194
              GOTO 10191
10191           J=J+(2)
                LIN(J)=LIN(I)
                LIN(J+1)=138
                LIN(J+2)=0
                PEEKC0=143
10193         GOTO 10194
10189         IF((LIN(J).NE.LIN(I)))GOTO 10196
              IF((LIN(J).NE.LIN(I)))GOTO 10195
              IF((LIN(J-1).NE.ESCAP0))GOTO 10195
              IF((LIN(J-2).EQ.ESCAP0))GOTO 10195
              GOTO 10196
10196           J=J+(1)
                LIN(J)=LIN(I)
                LIN(J+1)=138
                LIN(J+2)=0
                PEEKC0=143
10195       CONTINUE
10194     CONTINUE
10188   CONTINUE
10173   I=MAKSUB(LIN,I+1,LIN(I),SUB)
        IF((I.NE.-3))GOTO 10198
          RETURN
10198   CALL CTOC(SUB,SUBSA0,256)
10171 IF((LIN(I+1).EQ.231))GOTO 10200
      IF((LIN(I+1).EQ.199))GOTO 10200
      GOTO 10199
10200   I=I+(1)
        GFLAG=1
        GOTO 10201
10199   GFLAG=0
10201 ERRCO0=7
      GETRHS=-2
      RETURN
      END
      SUBROUTINE REMARK(LIT)
      INTEGER LIT(1)
      CALL LITME0(LIT,1)
      RETURN
      END
      SUBROUTINE LITNN0(LIT,NUM,TYPE)
      INTEGER LIT(1),NUM,TYPE
      INTEGER STR(128)
      INTEGER L
      INTEGER PTOC
      L=PTOC(LIT,174,STR,128)
      CALL ITOC(NUM,STR(L+1),10)
      CALL MESG(STR,TYPE)
      RETURN
      END
      INTEGER FUNCTION CKP(LIN,I,PFLAG,STATUS)
      INTEGER LIN(512)
      INTEGER I,PFLAG,STATUS
      INTEGER J
      J=I
      IF((LIN(J).EQ.240))GOTO 10203
      IF((LIN(J).EQ.208))GOTO 10203
      GOTO 10202
10203   J=J+(1)
        PFLAG=1
        GOTO 10204
10202   PFLAG=0
10204 IF((LIN(J).NE.138))GOTO 10205
        STATUS=-2
        GOTO 10206
10205   STATUS=-3
10206 CKP=STATUS
      RETURN
      END
      SUBROUTINE DELLI0(ROW,N)
      INTEGER ROW,N
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER I,DELAY
      INTEGER BLANKS(128)
      INTEGER AAAAE0
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      DATA BLANKS/128*160/
      CALL POSIT0(ROW,1)
      I=1
      GOTO 10209
10207 I=I+(1)
10209 IF((I.GT.N))GOTO 10208
        AAAAE0=TERMT0
        GOTO 10210
10211     CALL T1OU(155)
          CALL T1OU(205)
          DELAY=0
        GOTO 10212
10213     CALL T1OU(155)
          CALL T1OU(210)
          DELAY=0
        GOTO 10212
10214     CALL T1OU(155)
          CALL T1OU(205)
          DELAY=16
        GOTO 10212
10215     CALL T1OU(155)
          CALL T1OU(236)
          DELAY=64
        GOTO 10212
10216     CALL T1OU(155)
          CALL T1OU(143)
          DELAY=32
        GOTO 10212
10217     CALL T1OU(155)
          CALL T1OU(210)
          DELAY=32
        GOTO 10212
10218     CALL T1OU(155)
          CALL T1OU(210)
          DELAY=180
        GOTO 10212
10219     CALL T1OU(155)
          CALL T1OU(219)
          CALL T1OU(177)
          CALL T1OU(205)
          DELAY=0
        GOTO 10212
10210   GOTO(10216,10215,10220,10220,10220,10220,10220,10214,10220,10220
     *,10220,10220,10220,10220,10220,10220,10214,10220,10211,10218,10217
     *,10214,10211,10220,10213,10211,10220,10220,10211,10220,10211,10220
     *,10219,10220,10220,10220,10220,10220,10211,10220,10220,10215,10217
     *),AAAAE0
10220     CALL ERROR('in dellines: shouldn''t happen.')
10212   IF((DELAY.EQ.0))GOTO 10207
          CALL SENDD0(DELAY)
10221 GOTO 10207
10208 I=CURRO0
      GOTO 10224
10222 I=I+(1)
10224 IF((I+N.GT.NROWS0))GOTO 10227
        CALL MOVE$(SCREE0(1,I+N),SCREE0(1,I),NCOLS0)
      GOTO 10222
10225 I=I+(1)
10227 IF((I.GT.NROWS0))GOTO 10226
        CALL MOVE$(BLANKS,SCREE0(1,I),NCOLS0)
      GOTO 10225
10226 RETURN
      END
      SUBROUTINE INSLI0(ROW,N)
      INTEGER ROW,N
      COMMON /CLINES/LINE10,LINE20,NLINE0,CURLN0,LASTL0
      INTEGER LINE10,LINE20,NLINE0,CURLN0,LASTL0
      COMMON /CPAT/PATAA0(256),TLPAT0(256),SUBSA0(256),TSETA0(256)
      INTEGER PATAA0,TLPAT0,SUBSA0,TSETA0
      COMMON /CTXT/TXTAA0(512)
      INTEGER TXTAA0
      COMMON /CFILE/SAVFI0(512)
      INTEGER SAVFI0
      COMMON /CBUFR$/LASTB0,FENCE0,FREEA0,LINE00,BUFAA0(65520)
      INTEGER LASTB0,FENCE0,FREEA0,LINE00
      INTEGER BUFAA0
      INTEGER PREVL0(1),NEXTL0(1)
      INTEGER GLOBM0(1),LINEL0(1)
      INTEGER * 4 SEEKA0(1)
      INTEGER MARKN0(1)
      COMMON /CUNDO/LIMBO0,LIMCN0
      INTEGER LIMBO0,LIMCN0
      COMMON /CSCRAT/SCRAA0,SCREN0,SCRNA0(512),LOSTL0
      INTEGER SCRAA0
      INTEGER * 4 SCREN0
      INTEGER SCRNA0
      INTEGER LOSTL0
      COMMON /CMISC/BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0,PEEKC0,SAV
     *CO0
      INTEGER BUFFE0,ERRCO0,SAVER0,PROBA0,ARGNO0,LASTC0
      INTEGER PEEKC0,SAVCO0(512)
      COMMON /CMARK/SAVKN0
      INTEGER SAVKN0
      COMMON /COPT/TABST0(512),TABSU0(512),UNPRI0,DDIRA0,ABSNO0,NCHOI0,O
     *VERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GLOBA0
      INTEGER TABST0,TABSU0,UNPRI0
      INTEGER DDIRA0,ABSNO0,NCHOI0,OVERM0,WARNC0,FIRST0,TSPEE0,INDEN0,GL
     *OBA0
      COMMON /CTERM/TERMT0
      INTEGER TERMT0
      COMMON /CSCRN/SCREE0(128,51),MSGAL0(128),NROWS0,NCOLS0,CURRO0,CURC
     *O0,TOPRO0,BOTRO0,CMDRO0,TOPLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,
     *SCLEN0,SCTOP0,SCLIN0
      INTEGER SCREE0
      INTEGER MSGAL0,NROWS0,NCOLS0,CURRO0,CURCO0,TOPRO0,BOTRO0,CMDRO0,TO
     *PLN0,INSER0,INVER0,FIRSU0,RELAA0,RELZA0,SCLEN0,SCTOP0,SCLIN0(51)
      COMMON /CUNIX0/UNIXM0,BACKS0,NOTIN0,XMARK0,ESCAP0
      INTEGER UNIXM0
      INTEGER BACKS0,NOTIN0,XMARK0,ESCAP0
      COMMON /CTTY/TTYST0
      INTEGER TTYST0
      INTEGER I,DELAY
      INTEGER BLANKS(128)
      INTEGER AAAAF0
      EQUIVALENCE (PREVL0(1),BUFAA0(1)),(NEXTL0(1),BUFAA0(2)),(GLOBM0(1)
     *,BUFAA0(3)),(SEEKA0(1),BUFAA0(4)),(LINEL0(1),BUFAA0(6)),(MARKN0(1)
     *,BUFAA0(7))
      DATA BLANKS/128*160/
      CALL POSIT0(ROW,1)
      I=1
      GOTO 10230
10228 I=I+(1)
10230 IF((I.GT.N))GOTO 10229
        AAAAF0=TERMT0
        GOTO 10231
10232     DELAY=0
          CALL T1OU(155)
          CALL T1OU(204)
        GOTO 10233
10234     DELAY=0
          CALL T1OU(155)
          CALL T1OU(197)
        GOTO 10233
10235     DELAY=16
          CALL T1OU(155)
          CALL T1OU(204)
        GOTO 10233
10236     DELAY=64
          CALL T1OU(155)
          CALL T1OU(205)
        GOTO 10233
10237     DELAY=32
          CALL T1OU(155)
          CALL T1OU(142)
        GOTO 10233
10238     DELAY=32
          CALL T1OU(155)
          CALL T1OU(197)
        GOTO 10233
10239     DELAY=0
          CALL T1OU(155)
          CALL T1OU(219)
          CALL T1OU(177)
          CALL T1OU(204)
        GOTO 10233
10240     DELAY=180
          CALL T1OU(155)
          CALL T1OU(197)
        GOTO 10233
10231   GOTO(10237,10236,10241,10241,10241,10241,10241,10235,10241,10241
     *,10241,10241,10241,10241,10241,10241,10235,10241,10232,10240,10238
     *,10235,10232,10241,10234,10232,10241,10241,10232,10241,10232,10241
     *,10239,10241,10241,10241,10241,10241,10232,10241,10241,10236,10238
     *),AAAAF0
10241     CALL ERROR('in inslines: shouldn''t happen.')
10233   IF((DELAY.EQ.0))GOTO 10228
          CALL SENDD0(DELAY)
10242 GOTO 10228
10229 I=NROWS0
      GOTO 10245
10243 I=I-(1)
10245 IF((I-N.LT.CURRO0))GOTO 10248
        CALL MOVE$(SCREE0(1,I-N),SCREE0(1,I),NCOLS0)
      GOTO 10243
10246 I=I-(1)
10248 IF((I.LT.CURRO0))GOTO 10247
        CALL MOVE$(BLANKS,SCREE0(1,I),NCOLS0)
      GOTO 10246
10247 RETURN
      END
C ---- Long Name Map ----
C Toprow                         topro0
C Sctop                          sctop0
C inslines                       insli0
C Lostlines                      lostl0
C Indent                         inden0
C Invertcase                     inver0
C Fence                          fence0
C Topln                          topln0
C localfrom                      locam0
C gt40pos                        gt40p0
C terakpos                       terak0
C Savfil                         savfi0
C Line0                          line00
C Tspeed                         tspee0
C clrscreen                      clrsc0
C printverboseerrormessage       print0
C Line1                          line10
C Absnos                         absno0
C uniquelyname                   uniqu0
C Line2                          line20
C Limcnt                         limcn0
C Curcol                         curco0
C Insertmode                     inser0
C dologout                       dolog0
C doshell                        doshe0
C Nlines                         nline0
C Savcom                         savco0
C Peekc                          peekc0
C addspos                        addsp0
C fixscreen                      fixsc0
C Prevline                       prevl0
C Cmdrow                         cmdro0
C localto                        local0
C adjustwindow                   adjus0
C Bufferchanged                  buffe0
C Errcode                        errco0
C Firstcol                       first0
C Globals                        globa0
C updscreen                      updsc0
C Lastln                         lastl0
C Nextline                       nextl0
C Overlaycol                     overm0
C Txt                            txtaa0
C Savknm                         savkn0
C Tabstr                         tabsu0
C Nrows                          nrows0
C Unixmode                       unixm0
C dotseen                        dotse0
C setscreen                      setsc0
C forsyspos                      forsy0
C Scrname                        scrna0
C Nchoise                        nchoi0
C litmesg                        litme0
C getrange                       getra0
C drawbox                        drawb0
C Seekaddr                       seeka0
C Limbo                          limbo0
C garbagecollect                 garba0
C Subs                           subsa0
C Relz                           relza0
C termination                    termi0
C dellines                       delli0
C displaymessage                 displ0
C loadstr                        loads0
C restorescreen                  resto0
C Tabstops                       tabst0
C Sclen                          sclen0
C cleartoeol                     clear0
C Buf                            bufaa0
C whereami                       where0
C Tset                           tseta0
C Argno                          argno0
C ansipos                        ansip0
C Unprintable                    unpri0
C regentpos                      regen0
C sendmesg                       sendm0
C Botrow                         botro0
C Markname                       markn0
C Probation                      proba0
C Lastcharscanned                lastc0
C Warncol                        warnc0
C initialize                     initi0
C overlay                        overl0
C Pat                            pataa0
C Lineleng                       linel0
C cunixswt                       cunix0
C decodemnemonic                 decod0
C Globmark                       globm0
C Termtype                       termt0
C Ncols                          ncols0
C Currow                         curro0
C brkflag                        brkfl0
C recvmesg                       recvm0
C Scr                            scraa0
C Firstaffected                  firsu0
C NOTINCCL                       notin0
C bee2pos                        bee2p0
C positioncursor                 posit0
C Msgalloc                       msgal0
C savedsub                       saved0
C hwinsdel                       hwins0
C litnnum                        litnn0
C Screenimage                    scree0
C gettermtype                    gette0
C sbeecoord                      sbeec0
C warndeleted                    warnd0
C Curln                          curln0
C Free                           freea0
C XMARK                          xmark0
C b200coord                      b200c0
C spinject                       spinj0
C Tlpat                          tlpat0
C Lastbf                         lastb0
C Saverrcode                     saver0
C Ddir                           ddira0
C Rela                           relaa0
C ESCAPE                         escap0
C senddelay                      sendd0
C Scline                         sclin0
C Ttystate                       ttyst0
C cgcoord                        cgcoo0
C Scrend                         scren0
C BACKSCAN                       backs0
