#include <perms.h>
// Edinburgh IMP77 Compiler - Version 8.4
//
// 1 !VECCE for Win32 console mode, F. Culloch, 23/11/2013,
// 2 ! Updated January 2026 to fix reverse-video (worked on legacy console, not new
// 3 ! Windows Terminal) and switch from EMAS-style 2 blank lines + 2 command/
// 4 ! message lines below text to VAX-style 2 command/message lines only.
// 5 ! Based on...
// 6
// 7 !ECCExx: Implementation of ECCE for VAX, EMAS and MOUSES
// 8 ! Revised specification (1981) including video support.
// 9 ! Files addressed directly in virtual memory.
// 10 ! Most of the main part of the program (routine EDI) is common
// 11 ! to both VAX and EMAS versions. The procedures for opening
// 12 ! and closing files are distinct. Upper-case is used for those
// 13 ! sections of program text which are peculiar to one version.
// 14 !
// 15 ! ECCE00 (09/02/81): initial test release
// 16 !
// 17 ! ECCE01 (04/06/81): VT52/Bantam/hard-copy support
// 18
// 19 ! ECCE02 (23/03/82): VT100 support added
// 20 !
// 21 !
// 22 !
// 23 !
// 24 !
// 25 !
// 26 !
// 27 !
// 28 !
// 29 !
// 30 !
// 31 !
// 32 !
// 33 !
// 34 !
// 35 !
// 36 !
// 37 !
// 38 !
// 39 %OPTION "NOOPEN"
// 40 %constinteger line insert = x'8000 0000',
// 41+ inverse video = x'4000 0000'
// 42
// 43 %constinteger Hard Copy = 0,
// 44+ Bantam = 1, {P-E 550 old model}
// 45+ VT52 = 2+line insert+inverse video,
// 46+ VT100 = 3+line insert+inverse video,
// 47+ VC404 = 4,
// 48+ Win32Console= 5+line insert+inverse video
// 49
// 50 !
// 51 !%BEGIN; !MOUSES version (program not routine)
// 52
// 53 %EXTERNAL %ROUTINE VECCE %ALIAS "__impmain" (%INTEGER ARGC,
void VECCE(int ARGC, _imp_string255 **ARGV) {
// 54+ %STRING(255) %NAME %ARRAY %NAME ARGV); !*WIN32C*
// 55
// 56 %EXTERNAL %ROUTINE %SPEC GET DIMENSIONS(%INTEGER %NAME ROWS, COLS)
extern void GETDIMENSIONS(int *ROWS, int *COLS);
// 57 %EXTERNAL %ROUTINE %SPEC CURSOR TO(%INTEGER ROW, COL)
extern void CURSORTO(int ROW, int COL);
// 58 %EXTERNAL %ROUTINE %SPEC INVERT
extern void INVERT(void);
// 59
// 60 %constinteger rt=13, esc=27, dle=x'10'; !ISO control characters
// 61 %CONSTINTEGER MAXNAME=255; !max file-name length
// 62 %RECORDFORMAT FILE(%STRING(MAXNAME) NAME, %INTEGER TOP,LIM,VMTOP,VMLIM,FLAG)
struct FILE {
union {
struct {
_imp_string255 NAME;
int TOP;
int LIM;
int VMTOP;
int VMLIM;
int FLAG;
};
};
};
auto void MOVE(int LENGTH, int FROM, int TO);
auto void CONNECTINPUT(struct FILE * F);
// 63 !
// 64 %ROUTINESPEC MOVE(%INTEGER LENGTH,FROM,TO); !bulk move
// 65 !
// 66 %routinespec connect input(%record(file)%name f)
// 67 !%BYTEINTEGERMAPSPEC BYTEINTEGER(%INTEGER PSEUDO ADDR); !*MOUSES*
// 68
// 69 !!!!!!!!!!!!!!!!!!! Start of Editor proper !!!!!!!!!!!!!!!!!!!
// 70 !
// 71 %routine edi(%record(file)%name old,sec,new, %integer video,rows,cols)
void EDI(struct FILE * OLD, struct FILE * SEC, struct FILE * NEW, int VIDEO, int ROWS, int COLS) {
// 72 ! Only the TOP and LIM components of the file info records
// 73 ! OLD, SEC and NEW are relevant for editing (except when
// 74 ! referencing secondary input).
// 75 ! In the EMAS version the original file is not copied into the
// 76 ! working space (NEW) prior to entry, so that OLD_LIM is not
// 77 ! equal to NEW_LIM: on VAX, OLD_LIM is equal to NEW_LIM (except
// 78 ! when just 'showing' in which case NEW_TOP = NEW_LIM = 0).
// 79 ! The parameter VIDEO defines terminal characteristics:
// 80 ! sign-bit: can DELETE-LINE & INSERT-LINE
// 81 ! 4000000: can reverse/reduce/underline arbitrary character
// 82 ! 4: VC404
// 83 ! 3: VT100
// 84 ! 2: VT52
// 85 ! 1: Bantam
// 86 ! all zero: hard-copy
// 87 %constinteger cbound=50; !command cell array bound
// 88 %constinteger tbound=120; !quoted text array bound
// 89 %constinteger stopper=-10000; !loop stop
// 90 %constinteger casebit=32
// 91 %integer cmax; !command cell max
int CMAX;
// 92 %integer ci; !command index
int CI;
// 93 %integer ti; !text index
int TI;
// 94 %integer code; !command code
int CODE;
// 95 %integer ref; !text or bracket pointer
int REF;
// 96 %integer scope; !search limit
int SCOPE;
// 97 %integer num; !repetition number
int NUM;
// 98 %integer sym,sym1,pend
int SYM;
int SYM1;
int PEND;
// 99 %integer casemask; !\0[\CASEBIT] to respect[ignore] case
int CASEMASK;
// 100 %integer width; !line width (default 80)
int WIDTH;
// 101 %integer dir; !current direction of movement
int DIR;
// 102 %integer sin; !0[1] for main[secondary] input
int SIN;
// 103 %integer macpos; !macro index values (3-byte nest)
int MACPOS;
// 104 !File pointers (byte addresses)
// 105 %integer lbeg; !line start position
int LBEG;
// 106 %integer fp; !current file position
int FP;
// 107 %integer lend; !line end position
int LEND;
// 108 %integer flim; !limit of current infile
int FLIM;
// 109 %integer gaptop; !start of gap
int GAPTOP;
// 110 %integer gaplim; !limit of gap
int GAPLIM;
// 111 %integer mstart,msize; !match start/size
int MSTART;
int MSIZE;
// 112 %integer sfp,slim; !saved FP & LIM for switching
int SFP;
int SLIM;
// 113 %integer newtop,newlim; !copies of NEW_TOP,NEW_LIM
int NEWTOP;
int NEWLIM;
// 114 ! Video control variables
// 115 %integer line; !line number of current line
int LINE;
// 116 %integer winline; !line number of top line on screen
int WINLINE;
// 117 %integer limline; !limit line number (if known)
int LIMLINE;
// 118 %integer breaks,joins; !count of lines added/removed
int BREAKS;
int JOINS;
// 119 %integer vrow,vcol; !video cursor position
int VROW;
int VCOL;
// 120 %owninteger zrow=0
static int ZROW = 0;
// 121 %owninteger mon=1
static int MON = 1;
// 122 %integer fprow
int FPROW;
// 123 %owninteger printline=0,printed=0
static int PRINTLINE = 0;
static int PRINTED = 0;
// 124 %integer wintop,winbot; !first/last window row
int WINTOP;
int WINBOT;
// 125 !the variable size window extends
// 126 !from floating WINTOP to fixed WINBOT
// 127 %integer winlim; != WINBOT+1
int WINLIM;
// 128 %integer minwin; !minimum window size
int MINWIN;
// 129 %integer changemin,changelbeg; !alteration positions
int CHANGEMIN;
int CHANGELBEG;
// 130 %integer vp
int VP;
// 131 %integer endon
int ENDON;
// 132 !
// 133 { ^ stands for ESC in below }
// 134 %conststring(11)%array proms(0:7) = ">", {hardcopy}
const _imp_string11 PROMS[8] = {_imp_str_init(">"), _imp_str_init("^X ^I >"), _imp_str_init("^Y ^x>"),
_imp_str_init("^[rrH^[2K>"), _imp_str_init("see below"), _imp_str_init(">"),
[6 ... 7] = _imp_str_init("")};
struct _imp_dv PROMS_dv = {PROMS, sizeof(_imp_string) /*, dims, <bounds> */};
// 135+ "^X ^I >", {Bantam}
// 136+ "^Y ^x>", {VT52}
// 137+ "^[rrH^[2K>", {VT100}
// 138+ "see below", {VC404}
// 139+ ">", {Win32 console}
// 140+ ""(*)
// 141 !%OWNSTRING(3)%ARRAY GPROM(0:3) = ":", "^A ", "^A", "^A"; !*VAX*
// 142 !%OWNSTRING(1)%ARRAY GPROM(0:3) = ":", " ", "", ""; !*EMAS*
// 143 %constSTRING(3)%ARRAY GPROMS(0:7) = ":", "^A ", "^A", "^M", " ", ""(*)
const _imp_string3 GPROMS[8] = {_imp_str_init(":"), _imp_str_init("^A "), _imp_str_init("^A"),
_imp_str_init("^M"), _imp_str_init(" "), [5 ... 7] = _imp_str_init("")};
struct _imp_dv GPROMS_dv = {GPROMS, sizeof(_imp_string) /*, dims, <bounds> */};
// 144
// 145 %byteintegerarray macstore(0:255)
unsigned char MACSTORE[256];
struct _imp_dv MACSTORE_dv = {MACSTORE, sizeof(unsigned char) /*, dims, <bounds> */};
// 146 %recordformat commandcell(%byteinteger code,ref, %SHORTinteger scope, %integer count)
struct COMMANDCELL {
union {
struct {
unsigned char CODE;
unsigned char REF;
short int SCOPE;
int COUNT;
};
};
};
// 147 %record(commandcell) %array r(1:cbound)
struct COMMANDCELL R[50];
struct _imp_dv R_dv = {R, sizeof(struct COMMANDCELL) /*, dims, <bounds> */};
// 148 %byteintegerarray text(1:tbound); !text strings
unsigned char TEXT[120];
struct _imp_dv TEXT_dv = {TEXT, sizeof(unsigned char) /*, dims, <bounds> */};
// 149 !
// 150 ! V i d e o c o n t r o l r o u t i n e s
// 151
// 152
// 153 {Pre-computed video control strings}
// 154 %string(15) prom,
_imp_string15 PROM;
_imp_string15 GPROM;
// 155+ gprom
// 156 %string(7) video invert,
_imp_string7 VIDEOINVERT;
_imp_string7 VIDEORESTORE;
// 157+ video restore
// 158
// 159 !! Generate digit strings for VT100 control sequences: this should be
// 160 ! machine coded ??
// 161 %string(3)%fn digits(%integer N)
_imp_string3 DIGITS(int N) {
// 162 %string(3) S
_imp_string3 S;
// 163 %integer j
int J;
// 164 S = ""
/* clang-format off */
_imp_strncpy(/*?*/&S, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = _imp_str_literal(""); (void *)&tmp;}), /*max:*/3);
/* clang-format on */
// 165 %if N >= 100 %start
if (N < 100) goto L_0001;
// 166 S = "1"; N = N-100 {Can't be >= 1000}
/* clang-format off */
_imp_strncpy(/*?*/&S, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = _imp_str_literal("1"); (void *)&tmp;}), /*max:*/3);
/* clang-format on */
N = N - 100;
// 167 %finish
L_0001:;
// 168 %if N >= 10 %start
if (N < 10) goto L_0002;
// 169 j = N // 10
J = ((long)N / (long)10);
// 170 S = S . to string(j+'0')
/* clang-format off */
_imp_strncpy(/*?*/&S, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/&S, ({__typeof__(_imp_string1) tmp; /*E*/ tmp = _imp_TOSTRING(J + 48); (void *)&tmp;})); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/3);
/* clang-format on */
// 171 N = N - (j*4 + j)*2
N = N - (J * 4 + J) * 2;
// 172 %finish
L_0002:;
// 173 S = S . to string(N+'0')
/* clang-format off */
_imp_strncpy(/*?*/&S, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/&S, ({__typeof__(_imp_string1) tmp; /*E*/ tmp = _imp_TOSTRING(N + 48); (void *)&tmp;})); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/3);
/* clang-format on */
// 174 %result = S
return *(_imp_string3 *)/*?*/ &S;
// 175 %end
} /* end of DIGITS */
// 176
// 177 %routine VT100 cmd 1(%integer p1, cmd symbol)
void VT100CMD1(int P1, int CMDSYMBOL) {
// 178 %string(15) S = tostring(ESC) . "["
_imp_string15 S;
/* clang-format off */
_imp_strncpy(/*?*/&S, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join(({__typeof__(_imp_string1) tmp; /*D*/ tmp = _imp_TOSTRING(27); (void *)&tmp;}), (_imp_string *)/*?*/_imp_str_literal_ptr("[")); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/15);
/* clang-format on */
// 179 S = S . digits(p1) %if p1 # 0
if (P1 == 0) goto L_0003;
/* clang-format off */
_imp_strncpy(/*?*/&S, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/&S, ({__typeof__(_imp_string3) tmp; /*E*/ tmp = DIGITS(P1); (void *)&tmp;})); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/15);
/* clang-format on */
L_0003:;
// 180 S = S . to string(cmd symbol)
/* clang-format off */
_imp_strncpy(/*?*/&S, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/&S, ({__typeof__(_imp_string1) tmp; /*E*/ tmp = _imp_TOSTRING(CMDSYMBOL); (void *)&tmp;})); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/15);
/* clang-format on */
// 181 print string(S)
_imp_PRINTSTRING(
/* clang-format off */
*({ __typeof__(_imp_string15) tmp = S/*q*/; (_imp_string255 *)&tmp; })
/* clang-format on */
);
// 182 %end
return;
} /* end of VT100CMD1 */
// 183
// 184 %routine VT100 cmd 2(%integer p1, p2, cmd symbol)
void VT100CMD2(int P1, int P2, int CMDSYMBOL) {
// 185 %string(15) S = to string(ESC)."["
_imp_string15 S;
/* clang-format off */
_imp_strncpy(/*?*/&S, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join(({__typeof__(_imp_string1) tmp; /*D*/ tmp = _imp_TOSTRING(27); (void *)&tmp;}), (_imp_string *)/*?*/_imp_str_literal_ptr("[")); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/15);
/* clang-format on */
// 186 S = S . digits(p1) %if p1 # 0
if (P1 == 0) goto L_0004;
/* clang-format off */
_imp_strncpy(/*?*/&S, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/&S, ({__typeof__(_imp_string3) tmp; /*E*/ tmp = DIGITS(P1); (void *)&tmp;})); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/15);
/* clang-format on */
L_0004:;
// 187 S = S . ";" . digits(p2) %if p2 # 0
if (P2 == 0) goto L_0005;
/* clang-format off */
_imp_strncpy(/*?*/&S, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/&*({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/&S, (_imp_string *)/*?*/_imp_str_literal_ptr(";")); (_imp_string255 *)&tmp;}), ({__typeof__(_imp_string3) tmp; /*E*/ tmp = DIGITS(P2); (void *)&tmp;})); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/15);
/* clang-format on */
L_0005:;
// 188 S = S . tostring(cmd symbol)
/* clang-format off */
_imp_strncpy(/*?*/&S, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/&S, ({__typeof__(_imp_string1) tmp; /*E*/ tmp = _imp_TOSTRING(CMDSYMBOL); (void *)&tmp;})); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/15);
/* clang-format on */
// 189 print string(S)
_imp_PRINTSTRING(
/* clang-format off */
*({ __typeof__(_imp_string15) tmp = S/*q*/; (_imp_string255 *)&tmp; })
/* clang-format on */
);
// 190 %end
return;
} /* end of VT100CMD2 */
// 191
// 192 %routine Clear Screen
void CLEARSCREEN(void) {
// 193 {Clear display screen on start up and termination}
// 194 %if video = VT100 %start
if (VIDEO != -1073741821) goto L_0006;
// 195 VT100 cmd 1(2,'J') {clear}
VT100CMD1(2, 74);
// 196 VT100 cmd 2(rows, 0, 'H') {set cursor}
VT100CMD2(ROWS, 0, 72);
// 197 %finish
L_0006:;
// 198 %end
return;
} /* end of CLEARSCREEN */
// 199
// 200 %routine at(%integer row,col)
void AT(int ROW, int COL) {
// 201 ! Set cursor to row ROW (0:ROWS-1) and column COL (0:COLS-1)
// 202 %if video # 0 %start
if (VIDEO == 0) goto L_0007;
// 203 {Note that the fiddle used on the older displays where ' ' counts as }
// 204 {row/col 1 is not possible on VT100. Must send row+1/col+1 explicitly }
// 205 vrow = row; vcol = col
VROW = ROW;
VCOL = COL;
// 206 col = cols-1 %if col >= cols
if (COL < COLS) goto L_0008;
COL = COLS - 1;
L_0008:;
// 207 %if video = VT100 %start
if (VIDEO != -1073741821) goto L_0009;
// 208 VT100 cmd2(row+1,col+1,'H')
VT100CMD2(ROW + 1, COL + 1, 72);
// 209 %ELSE %IF VIDEO = WIN32 CONSOLE
goto L_000A;
L_0009:;
if (VIDEO != -1073741819) goto L_000B;
// 210 CURSOR TO(ROW, COL)
CURSORTO(ROW, COL);
// 211 %else %if video = VT52; !VT52
goto L_000A;
L_000B:;
if (VIDEO != -1073741822) goto L_000C;
// 212 print symbol (esc)
_imp_PRINTSYMBOL(27);
// 213 print symbol('Y'); print symbol(' '+row)
_imp_PRINTSYMBOL(89);
_imp_PRINTSYMBOL(32 + ROW);
// 214 print symbol(' '+col)
_imp_PRINTSYMBOL(32 + COL);
// 215 %finish %else %if video = VC404 %start; !VC404
goto L_000A;
L_000C:;
if (VIDEO != 4) goto L_000D;
// 216 print symbol (dle); print symbol (' '+row)
_imp_PRINTSYMBOL(16);
_imp_PRINTSYMBOL(32 + ROW);
// 217 print symbol(' '+col)
_imp_PRINTSYMBOL(32 + COL);
// 218 %finish %else %start; !Bantam
goto L_000A;
L_000D:;
// 219 print symbol (esc)
_imp_PRINTSYMBOL(27);
// 220 print symbol('X'); print symbol(' '+row)
_imp_PRINTSYMBOL(88);
_imp_PRINTSYMBOL(32 + ROW);
// 221 print symbol(esc); print symbol('Y')
_imp_PRINTSYMBOL(27);
_imp_PRINTSYMBOL(89);
// 222 print symbol(' '+col)
_imp_PRINTSYMBOL(32 + COL);
// 223 %finish
L_000A:;
// 224 %finish
L_0007:;
// 225 %end
return;
} /* end of AT */
// 226 !
// 227 %routine clear line
void CLEARLINE(void) {
// 228 ! Clear rest of current row
// 229 %EXTERNAL %ROUTINE %SPEC CLR LINE
extern void CLRLINE(void);
// 230 %if video # 0 %and vcol < cols %start
if (VIDEO == 0) goto L_000E;
if (VCOL >= COLS) goto L_000E;
// 231 %if video = VT100 %start
if (VIDEO != -1073741821) goto L_000F;
// 232 VT100 cmd1(0,'K')
VT100CMD1(0, 75);
// 233 %ELSE %IF VIDEO = WIN32 CONSOLE
goto L_0010;
L_000F:;
if (VIDEO != -1073741819) goto L_0011;
// 234 CLR LINE
CLRLINE();
// 235 %else %if video = VT52
goto L_0010;
L_0011:;
if (VIDEO != -1073741822) goto L_0012;
// 236 print symbol(ESC)
_imp_PRINTSYMBOL(27);
// 237 print symbol ('x')
_imp_PRINTSYMBOL(120);
// 238 %finish %else %if video = VC404 %start; !VC404
goto L_0010;
L_0012:;
if (VIDEO != 4) goto L_0013;
// 239 print symbol(ESC)
_imp_PRINTSYMBOL(27);
// 240 print symbol (x'16')
_imp_PRINTSYMBOL(22);
// 241 %finish %else %start; !Bantam
goto L_0010;
L_0013:;
// 242 print symbol(ESC)
_imp_PRINTSYMBOL(27);
// 243 print symbol ('I'); print symbol (0)
_imp_PRINTSYMBOL(73);
_imp_PRINTSYMBOL(0);
// 244 %finish
L_0010:;
// 245 %finish
L_000E:;
// 246 %end
return;
} /* end of CLEARLINE */
// 247 !
// 248 %routine vnewline
void VNEWLINE(void) {
// 249 vrow = vrow+1; vcol = 0
VROW = VROW + 1;
VCOL = 0;
// 250 newline
_imp_NEWLINE();
// 251 %end
return;
} /* end of VNEWLINE */
// 252 !
// 253 %routine insert line(%integer row)
void INSERTLINE(int ROW) {
// 254 %EXTERNAL %ROUTINE %SPEC INS LINE
extern void INSLINE(void);
// 255 %integer from
int FROM;
// 256 %if video < 0 %start
if (VIDEO >= 0) goto L_0014;
// 257 at(row,0) %if vrow # row
if (VROW == ROW) goto L_0015;
AT(ROW, 0);
L_0015:;
// 258 vcol = 0
VCOL = 0;
// 259 %if video = VT100 %start
if (VIDEO != -1073741821) goto L_0016;
// 260 print symbol(ESC); print symbol('7') {save cursor position}
_imp_PRINTSYMBOL(27);
_imp_PRINTSYMBOL(55);
// 261 VT100 cmd 2(row+1,0,'r') {restrict scrolling area}
VT100CMD2(ROW + 1, 0, 114);
// 262 print symbol(ESC); print symbol('8')
_imp_PRINTSYMBOL(27);
_imp_PRINTSYMBOL(56);
// 263 print symbol(ESC); print symbol('M') {force downward scroll}
_imp_PRINTSYMBOL(27);
_imp_PRINTSYMBOL(77);
// 264 print string( tostring(ESC) . "[;r" )
_imp_PRINTSTRING(
/* clang-format off */
*({ __typeof__(_imp_string255) tmp = *({_imp_string255 tmp = _imp_join(({__typeof__(_imp_string1) tmp; /*D*/ tmp = _imp_TOSTRING(27); (void *)&tmp;}), (_imp_string *)/*?*/_imp_str_literal_ptr("[;r")); (_imp_string255 *)&tmp;})/*q*/; (_imp_string255 *)&tmp; })
/* clang-format on */
);
// 265 print symbol(ESC); print symbol('8') {restore cursor}
_imp_PRINTSYMBOL(27);
_imp_PRINTSYMBOL(56);
// 266 %ELSE %IF VIDEO = WIN32 CONSOLE
goto L_0017;
L_0016:;
if (VIDEO != -1073741819) goto L_0018;
// 267 INS LINE
INSLINE();
// 268 %else
goto L_0017;
L_0018:;
// 269 print symbol(esc); print symbol('L')
_imp_PRINTSYMBOL(27);
_imp_PRINTSYMBOL(76);
// 270 %finish
L_0017:;
// 271 %finish
L_0014:;
// 272 %end
return;
} /* end of INSERTLINE */
// ?FROM unused
// 273 !
// 274 %routine delete line(%integer row)
void DELETELINE(int ROW) {
// 275 %external %routine %spec del line
extern void DELLINE(void);
// 276 %if video < 0 %start
if (VIDEO >= 0) goto L_0019;
// 277 at(row,0) %if vrow # row
if (VROW == ROW) goto L_001A;
AT(ROW, 0);
L_001A:;
// 278 vcol = 0
VCOL = 0;
// 279 %if video = VT100 %start
if (VIDEO != -1073741821) goto L_001B;
// 280 print symbol(ESC); print symbol('7') {save cursor}
_imp_PRINTSYMBOL(27);
_imp_PRINTSYMBOL(55);
// 281 VT100 cmd 2(row+1,0,'r')
VT100CMD2(ROW + 1, 0, 114);
// 282 VT100 cmd 2(rows,0,'H')
VT100CMD2(ROWS, 0, 72);
// 283 print symbol(ESC); print symbol('D')
_imp_PRINTSYMBOL(27);
_imp_PRINTSYMBOL(68);
// 284 print string( tostring(ESC) . "[;r" )
_imp_PRINTSTRING(
/* clang-format off */
*({ __typeof__(_imp_string255) tmp = *({_imp_string255 tmp = _imp_join(({__typeof__(_imp_string1) tmp; /*D*/ tmp = _imp_TOSTRING(27); (void *)&tmp;}), (_imp_string *)/*?*/_imp_str_literal_ptr("[;r")); (_imp_string255 *)&tmp;})/*q*/; (_imp_string255 *)&tmp; })
/* clang-format on */
);
// 285 print symbol(ESC); print symbol('8')
_imp_PRINTSYMBOL(27);
_imp_PRINTSYMBOL(56);
// 286 %ELSE %IF VIDEO = WIN32 CONSOLE
goto L_001C;
L_001B:;
if (VIDEO != -1073741819) goto L_001D;
// 287 DEL LINE
DELLINE();
// 288 %else
goto L_001C;
L_001D:;
// 289 print symbol(esc); print symbol('M')
_imp_PRINTSYMBOL(27);
_imp_PRINTSYMBOL(77);
// 290 %finish
L_001C:;
// 291 %finish
L_0019:;
// 292 %end
return;
} /* end of DELETELINE */
// 293 !
// 294 %constinteger clear=1, inc=2
// 295 %routine display line(%integer mode)
void DISPLAYLINE(int MODE) {
// 296 %integer k
int K;
// 297 %if video<<1 > 0 %and vcol = 0 %start
if (VIDEO << 1 <= 0) goto L_001E;
if (VCOL != 0) goto L_001E;
// 298 print symbol(' '); vcol = 1
_imp_PRINTSYMBOL(32);
VCOL = 1;
// 299 %finish
L_001E:;
// 300 %cycle
L_001F:;
// 301 vp = gaplim %if vp = gaptop
if (VP != GAPTOP) goto L_0020;
VP = GAPLIM;
L_0020:;
// 302 %if vp = flim %start
if (VP != FLIM) goto L_0021;
// 303 %if endon = 0 %start
if (ENDON != 0) goto L_0022;
// 304 print string(" **END**")
_imp_PRINTSTRING(_imp_str_literal(" **END**"));
// 305 limline = winline+vrow-wintop
LIMLINE = WINLINE + VROW - WINTOP;
// 306 %finish
L_0022:;
// 307 endon = 1
ENDON = 1;
// 308 %exit
goto L_0023;
// 309 %finish
L_0021:;
// 310 k = byteinteger(vp); vp = vp+1
K = *_imp_BYTEINTEGER(VP);
VP = VP + 1;
// 311 %exit %if k = nl
if (K != 10) goto L_0024;
goto L_0023;
L_0024:;
// 312 print symbol(k) %if vcol < cols
if (VCOL >= COLS) goto L_0025;
_imp_PRINTSYMBOL(K);
L_0025:;
// 313 vcol = vcol+1
VCOL = VCOL + 1;
// 314 %repeat
goto L_001F;
L_0023:;
// 315 clear line %if mode&clear # 0
if (MODE & 1 == 0) goto L_0026;
CLEARLINE();
L_0026:;
// 316 vnewline %if mode&inc # 0
if (MODE & 2 == 0) goto L_0027;
VNEWLINE();
L_0027:;
// 317 %end
return;
} /* end of DISPLAYLINE */
// 318 !
// 319 %routine update
void UPDATE(void) {
// 320 ! If a change has been made to the file
// 321 ! update screen image, but only if current line is on screen
// 322 ! CHANGEMIN identifies the earliest point in the file affected
// 323 ! by alterations
// 324 %integer l,d,j,nop
int L;
int D;
int J;
int NOP;
// 325 %return %if changemin = newlim; !no change =>
if (CHANGEMIN != NEWLIM) goto L_0028;
return;
L_0028:;
// 326 %return %if video = 0
if (VIDEO != 0) goto L_0029;
return;
L_0029:;
// 327 joins = joins-breaks; l = line-winline+wintop-breaks
JOINS = JOINS - BREAKS;
L = LINE - WINLINE + WINTOP - BREAKS;
// 328 %if l >= wintop %and l < winlim %start; !within window
if (L < WINTOP) goto L_002A;
if (L >= WINLIM) goto L_002A;
// 329 vp = changemin; endon = 0
VP = CHANGEMIN;
ENDON = 0;
// 330 changemin = changemin-1 %while changemin # newtop %and byteinteger(changemin-1) # nl
L_002B:;
if (CHANGEMIN == NEWTOP) goto L_002C;
if (*_imp_BYTEINTEGER(CHANGEMIN - 1) == 10) goto L_002C;
CHANGEMIN = CHANGEMIN - 1;
goto L_002B;
L_002C:;
// 331 %if video < 0 %then at(l,vp-changemin) %else at(l,vp-changemin+1)
if (VIDEO >= 0) goto L_002D;
AT(L, VP - CHANGEMIN);
goto L_002E;
L_002D:;
AT(L, VP - CHANGEMIN + 1);
L_002E:;
// 332 nop = 1
NOP = 1;
// 333 %if changelbeg # lbeg %or vp # changemin %start
if (CHANGELBEG != LBEG) goto L_002F;
if (VP == CHANGEMIN) goto L_0030;
L_002F:;
// 334 nop = 0
NOP = 0;
// 335 display line(clear+inc)
DISPLAYLINE(1 + 2);
// 336 l = l+1
L = L + 1;
// 337 %finish
L_0030:;
// 338 -> done %if l = winlim
if (L != WINLIM) goto L_0031;
goto U_1000;
L_0031:;
// 339 %if joins < 0 %and video < 0 %start; !net expansion
if (JOINS >= 0) goto L_0032;
if (VIDEO >= 0) goto L_0032;
// 340 j = joins
J = JOINS;
// 341 %cycle
L_0033:;
// 342 %if wintop > zrow %start
if (WINTOP <= ZROW) goto L_0034;
// 343 delete line(zrow)
DELETELINE(ZROW);
// 344 wintop = wintop-1; l = l-1
WINTOP = WINTOP - 1;
L = L - 1;
// 345 %finish %else %start
goto L_0035;
L_0034:;
// 346 delete line(winbot)
DELETELINE(WINBOT);
// 347 %finish
L_0035:;
// 348 j = j+1
J = J + 1;
// 349 %repeat %until j = 0
if (J == 0) goto L_0036;
goto L_0033;
L_0036:;
// 350 %cycle
L_0037:;
// 351 insert line(l)
INSERTLINE(L);
// 352 joins = joins+1
JOINS = JOINS + 1;
// 353 %repeat %until joins = 0
if (JOINS == 0) goto L_0038;
goto L_0037;
L_0038:;
// 354 %finish
L_0032:;
// 355 %while vrow # winlim %and (newtop<=vp<gaptop %or (vp=gaptop %and nop=0)) %cycle
L_0039:;
if (VROW == WINLIM) goto L_003A;
{
// Double-sided test on VP (Part I)
int tmp;
if (NEWTOP > (tmp = VP)) goto L_003B;
// Double-sided test on VP (Part II)
if (tmp < GAPTOP) goto L_003C;
}
L_003B:;
if (VP != GAPTOP) goto L_003A;
if (NOP != 0) goto L_003A;
L_003C:;
// 356 display line(clear+inc)
DISPLAYLINE(1 + 2);
// 357 l = l+1
L = L + 1;
// 358 %repeat
goto L_0039;
L_003A:;
// 359 %if joins # 0 %start
if (JOINS == 0) goto L_003D;
// 360 d = winlim-l-joins
D = WINLIM - L - JOINS;
// 361 %if d <= 0 %or video > 0 %start
if (D <= 0) goto L_003E;
if (VIDEO <= 0) goto L_003F;
L_003E:;
// 362 display line(clear+inc) %while vrow # winlim
L_0040:;
if (VROW == WINLIM) goto L_0041;
DISPLAYLINE(1 + 2);
goto L_0040;
L_0041:;
// 363 %finish %else %start
goto L_0042;
L_003F:;
// 364 j = joins
J = JOINS;
// 365 %cycle
L_0043:;
// 366 delete line(vrow)
DELETELINE(VROW);
// 367 j = j-1
J = J - 1;
// 368 %repeat %until j = 0
if (J == 0) goto L_0044;
goto L_0043;
L_0044:;
// 369 %cycle
L_0045:;
// 370 %cycle
L_0046:;
// 371 vp = gaplim %if vp = gaptop
if (VP != GAPTOP) goto L_0047;
VP = GAPLIM;
L_0047:;
// 372 endon = 1 %and %exit %if vp = flim
if (VP != FLIM) goto L_0048;
ENDON = 1;
goto L_0049;
L_0048:;
// 373 vp = vp+1
VP = VP + 1;
// 374 %repeat %until byteinteger(vp-1) = nl
if (*_imp_BYTEINTEGER(VP - 1) == 10) goto L_0049;
goto L_0046;
L_0049:;
// 375 d = d-1
D = D - 1;
// 376 %repeat %until d = 0
if (D == 0) goto L_004A;
goto L_0045;
L_004A:;
// 377 at(winlim-joins,0)
AT(WINLIM - JOINS, 0);
// 378 %cycle
L_004B:;
// 379 insert line(vrow)
INSERTLINE(VROW);
// 380 display line(clear+inc)
DISPLAYLINE(1 + 2);
// 381 %repeat %until vrow = winlim
if (VROW == WINLIM) goto L_004C;
goto L_004B;
L_004C:;
// 382 %finish
L_0042:;
// 383 %finish
L_003D:;
// 384 %finish
L_002A:;
// 385 done:
U_1000:;
// 386 changemin = newlim; joins = 0; breaks = 0
CHANGEMIN = NEWLIM;
JOINS = 0;
BREAKS = 0;
// 387 %end
return;
} /* end of UPDATE */
// 388 !
// 389 %routine display
void DISPLAY(void) {
// 390 ! Update screen & ensure that current line is on screen
// 391 %integer pre,k
int PRE;
int K;
// 392 !
// 393 %routine scanback
void SCANBACK(void) {
// 394 %while pre > 0 %cycle
L_004D:;
if (PRE <= 0) goto L_004E;
// 395 vp = gaptop %if vp = gaplim
if (VP != GAPLIM) goto L_004F;
VP = GAPTOP;
L_004F:;
// 396 %exit %if vp = newtop
if (VP != NEWTOP) goto L_0050;
goto L_004E;
L_0050:;
// 397 %cycle
L_0051:;
// 398 vp = vp-1
VP = VP - 1;
// 399 vp = gaptop %if vp = gaplim
if (VP != GAPLIM) goto L_0052;
VP = GAPTOP;
L_0052:;
// 400 %repeat %until vp = newtop %or byteinteger(vp-1) = nl
if (VP == NEWTOP) goto L_0053;
if (*_imp_BYTEINTEGER(VP - 1) == 10) goto L_0053;
goto L_0051;
L_0053:;
// 401 pre = pre-1
PRE = PRE - 1;
// 402 %repeat
goto L_004D;
L_004E:;
// 403 %end
return;
} /* end of SCANBACK */
// 404 !
// 405 update
UPDATE();
// 406 vp = lbeg; endon = 0
VP = LBEG;
ENDON = 0;
// 407 vp = vp-gaplim+gaptop %if vp < gaplim <= fp
{
// Double-sided test on GAPLIM (Part I)
int tmp;
if (VP >= (tmp = GAPLIM)) goto L_0054;
// Double-sided test on GAPLIM (Part II)
if (tmp > FP) goto L_0054;
}
VP = VP - GAPLIM + GAPTOP;
L_0054:;
// 408 %if video = 0 %start
if (VIDEO != 0) goto L_0055;
// 409 vcol = 0; printline = line; printed = gaptop+fp
VCOL = 0;
PRINTLINE = LINE;
PRINTED = GAPTOP + FP;
// 410 %if vp # fp %and num = 1 %start
if (VP == FP) goto L_0056;
if (NUM != 1) goto L_0056;
// 411 %cycle
L_0057:;
// 412 print symbol(byteinteger(vp))
_imp_PRINTSYMBOL(*_imp_BYTEINTEGER(VP));
// 413 vp = vp+1
VP = VP + 1;
// 414 vp = gaplim %if vp = gaptop
if (VP != GAPTOP) goto L_0058;
VP = GAPLIM;
L_0058:;
// 415 %repeat %until vp = fp
if (VP == FP) goto L_0059;
goto L_0057;
L_0059:;
// 416 print symbol('^')
_imp_PRINTSYMBOL(94);
// 417 %finish
L_0056:;
// 418 display line(inc)
DISPLAYLINE(2);
// 419 %return
return;
// 420 %finish
L_0055:;
// 421 pre = line-winline
PRE = LINE - WINLINE;
// 422 %if pre < 0 %start; !before start of window
if (PRE >= 0) goto L_005A;
// 423 %if pre > -minwin %and (video<0 %or wintop+pre>=zrow) %start
if (PRE <= -MINWIN) goto L_005B;
if (VIDEO < 0) goto L_005C;
if (WINTOP + PRE < ZROW) goto L_005B;
L_005C:;
// 424 !worth prefixing
// 425 wintop = wintop+pre; !decrease wintop (PRE neg)
WINTOP = WINTOP + PRE;
// 426 %while wintop < zrow %cycle
L_005D:;
if (WINTOP >= ZROW) goto L_005E;
// 427 delete line(winbot)
DELETELINE(WINBOT);
// 428 insert line(zrow)
INSERTLINE(ZROW);
// 429 wintop = wintop+1
WINTOP = WINTOP + 1;
// 430 %repeat
goto L_005D;
L_005E:;
// 431 %if wintop > zrow %start
if (WINTOP <= ZROW) goto L_005F;
// 432 at(wintop-1,0)
AT(WINTOP - 1, 0);
// 433 print symbol('='); clear line
_imp_PRINTSYMBOL(61);
CLEARLINE();
// 434 %finish
L_005F:;
// 435 at(wintop,0)
AT(WINTOP, 0);
// 436 %cycle
L_0060:;
// 437 display line(clear)
DISPLAYLINE(1);
// 438 pre = pre+1
PRE = PRE + 1;
// 439 %exit %if pre >= 0
if (PRE < 0) goto L_0061;
goto L_0062;
L_0061:;
// 440 vnewline
VNEWLINE();
// 441 %repeat
goto L_0060;
L_0062:;
// 442 winline = line
WINLINE = LINE;
// 443 %return
return;
// 444 %finish
L_005B:;
// 445 %finish %else %start
goto L_0063;
L_005A:;
// 446 pre = pre+wintop-winlim
PRE = PRE + WINTOP - WINLIM;
// 447 %return %if pre < 0; !within window =>
if (PRE >= 0) goto L_0064;
return;
L_0064:;
// 448 %if pre < minwin %start; !worth appending
if (PRE >= MINWIN) goto L_0065;
// 449 k = pre
K = PRE;
// 450 scanback
SCANBACK();
// 451 at(winlim,0) %if video > 0
if (VIDEO <= 0) goto L_0066;
AT(WINLIM, 0);
L_0066:;
// 452 %cycle
L_0067:;
// 453 delete line(zrow)
DELETELINE(ZROW);
// 454 %if wintop > zrow %then wintop = wintop-1 %else winline = winline+1
if (WINTOP <= ZROW) goto L_0068;
WINTOP = WINTOP - 1;
goto L_0069;
L_0068:;
WINLINE = WINLINE + 1;
L_0069:;
// 455 insert line(winbot)
INSERTLINE(WINBOT);
// 456 display line(clear+inc)
DISPLAYLINE(1 + 2);
// 457 k = k-1
K = K - 1;
// 458 %repeat %until k < 0
if (K < 0) goto L_006A;
goto L_0067;
L_006A:;
// 459 NEWLINE %IF VIDEO > 0; !*VAX* *WIN32C*
if (VIDEO <= 0) goto L_006B;
_imp_NEWLINE();
L_006B:;
// 460 !*WIN32C* NEWLINE %AND NEWLINE %AND NEWLINE %IF VIDEO > 0; !*emas*
// 461 %return
return;
// 462 %finish
L_0065:;
// 463 %finish
L_0063:;
// 464 pre = minwin-1
PRE = MINWIN - 1;
// 465 pre = pre//2 %if fp # flim
if (FP == FLIM) goto L_006C;
PRE = ((long)PRE / (long)2);
L_006C:;
// 466 winline = line-pre
WINLINE = LINE - PRE;
// 467 scanback
SCANBACK();
// 468 winline = winline+pre
WINLINE = WINLINE + PRE;
// 469 wintop = winlim-minwin
WINTOP = WINLIM - MINWIN;
// 470 %if wintop > zrow %start
if (WINTOP <= ZROW) goto L_006D;
// 471 at(wintop-1,0)
AT(WINTOP - 1, 0);
// 472 print symbol('='); clear line
_imp_PRINTSYMBOL(61);
CLEARLINE();
// 473 vnewline
VNEWLINE();
// 474 %finish %else %start
goto L_006E;
L_006D:;
// 475 at(zrow,0)
AT(ZROW, 0);
// 476 %finish
L_006E:;
// 477 %cycle
L_006F:;
// 478 display line(clear)
DISPLAYLINE(1);
// 479 %exit %if vrow >= winbot
if (VROW < WINBOT) goto L_0070;
goto L_0071;
L_0070:;
// 480 vnewline
VNEWLINE();
// 481 %repeat
goto L_006F;
L_0071:;
// 482 %end
return;
} /* end of DISPLAY */
// 483 !
// 484 ! F i l e m o d i f y i n g r o u t i n e s
// 485 !
// 486 %routine split
void SPLIT(void) {
// 487 ! Create gap in file if gap is not at FP
// 488 %integer j,diff,unit
int J;
int DIFF;
int UNIT;
// 489 %if newtop <= fp < gaptop %start; !FP in upper half
{
// Double-sided test on FP (Part I)
int tmp;
if (NEWTOP > (tmp = FP)) goto L_0072;
// Double-sided test on FP (Part II)
if (tmp >= GAPTOP) goto L_0072;
}
// 490 %if flim # newlim %start; !lower half still in old
if (FLIM == NEWLIM) goto L_0073;
// 491 j = flim-gaplim; ! so must now copy across
J = FLIM - GAPLIM;
// 492 ->abdn %if newlim-j < gaptop
if (NEWLIM - J >= GAPTOP) goto L_0074;
goto U_1001;
L_0074:;
// 493 move(j,gaplim,newlim-j)
MOVE(J, GAPLIM, NEWLIM - J);
// 494 gaplim = newlim-j
GAPLIM = NEWLIM - J;
// 495 flim = newlim
FLIM = NEWLIM;
// 496 %finish
L_0073:;
// 497 j = gaptop-fp; !amount to shift down
J = GAPTOP - FP;
// 498 diff = gaplim-gaptop
DIFF = GAPLIM - GAPTOP;
// 499 %cycle; !shift in units <= gapsize
L_0075:;
// 500 unit = j; unit = diff %if diff < unit
UNIT = J;
if (DIFF >= UNIT) goto L_0076;
UNIT = DIFF;
L_0076:;
// 501 gaptop = gaptop-unit; gaplim = gaplim-unit
GAPTOP = GAPTOP - UNIT;
GAPLIM = GAPLIM - UNIT;
// 502 move(unit,gaptop,gaplim)
MOVE(UNIT, GAPTOP, GAPLIM);
// 503 j = j-unit
J = J - UNIT;
// 504 %repeat %until j = 0
if (J == 0) goto L_0077;
goto L_0075;
L_0077:;
// 505 mstart = gaplim %if mstart = fp
if (MSTART != FP) goto L_0078;
MSTART = GAPLIM;
L_0078:;
// 506 lbeg = lbeg+diff; lend = lend+diff
LBEG = LBEG + DIFF;
LEND = LEND + DIFF;
// 507 fp = gaplim
FP = GAPLIM;
// 508 %finish %else %start; !FP in lower half (old or new)
goto L_0079;
L_0072:;
// 509 j = fp-gaplim
J = FP - GAPLIM;
// 510 %if j > 0 %start
if (J <= 0) goto L_007A;
// 511 ->abdn %if gaptop+j >= newlim
if (GAPTOP + J < NEWLIM) goto L_007B;
goto U_1001;
L_007B:;
// 512 move(j,gaplim,gaptop)
MOVE(J, GAPLIM, GAPTOP);
// 513 %finish
L_007A:;
// 514 gaptop = gaptop+j; gaplim = fp
GAPTOP = GAPTOP + J;
GAPLIM = FP;
// 515 %finish
L_0079:;
// 516 %if gaptop < changemin %start
if (GAPTOP >= CHANGEMIN) goto L_007C;
// 517 changemin = gaptop; changelbeg = lbeg
CHANGEMIN = GAPTOP;
CHANGELBEG = LBEG;
// 518 %finish
L_007C:;
// 519 j = gaplim; j = newlim %if flim # newlim
J = GAPLIM;
if (FLIM == NEWLIM) goto L_007D;
J = NEWLIM;
L_007D:;
// 520 %return %if gaptop+256 < j
if (GAPTOP + 256 >= J) goto L_007E;
return;
L_007E:;
// 521 abdn:
U_1001:;
// 522 print string(" ** File too big ")
_imp_PRINTSTRING(_imp_str_literal(" ** File too big "));
// 523 %stop
_imp_stop(0);
// 524 %end
} /* end of SPLIT */
// 525 !
// 526 %routine consolidate
void CONSOLIDATE(void) {
// 527 ! Ensure that the gap lies on a line boundary
// 528 ! by copying up the remainder of a split line
// 529 %integer diff
int DIFF;
// 530 %if gaptop # newtop %and byteinteger(gaptop-1) # nl %start
if (GAPTOP == NEWTOP) goto L_007F;
if (*_imp_BYTEINTEGER(GAPTOP - 1) == 10) goto L_007F;
// 531 %cycle
L_0080:;
// 532 byteinteger(gaptop) = byteinteger(gaplim)
*_imp_BYTEINTEGER(GAPTOP) = *_imp_BYTEINTEGER(GAPLIM);
// 533 %if gaplim = fp %start
if (GAPLIM != FP) goto L_0081;
// 534 diff = gaplim-gaptop
DIFF = GAPLIM - GAPTOP;
// 535 lbeg = lbeg-diff; fp = fp-diff
LBEG = LBEG - DIFF;
FP = FP - DIFF;
// 536 lend = lend-diff; mstart = fp %if mstart = gaplim
LEND = LEND - DIFF;
if (MSTART != GAPLIM) goto L_0082;
MSTART = FP;
L_0082:;
// 537 %finish
L_0081:;
// 538 gaptop = gaptop+1; gaplim = gaplim+1
GAPTOP = GAPTOP + 1;
GAPLIM = GAPLIM + 1;
// 539 %repeat %until byteinteger(gaptop-1) = nl
if (*_imp_BYTEINTEGER(GAPTOP - 1) == 10) goto L_0083;
goto L_0080;
L_0083:;
// 540 %finish
L_007F:;
// 541 %end
return;
} /* end of CONSOLIDATE */
// 542 !
// 543 %routine join
void JOIN(void) {
// 544 ! Erase from FP to end of line AND the line terminator
// 545 ! (covers Kill, Join, Uncover)
// 546 ! NB LEND not revised
// 547 split
SPLIT();
// 548 lbeg = lbeg+(lend-fp+1); fp = lend+1
LBEG = LBEG + (LEND - FP + 1);
FP = LEND + 1;
// 549 changelbeg = lbeg
CHANGELBEG = LBEG;
// 550 gaplim = fp
GAPLIM = FP;
// 551 %if line >= winline %then joins = joins+1 %else winline = winline-1
if (LINE < WINLINE) goto L_0084;
JOINS = JOINS + 1;
goto L_0085;
L_0084:;
WINLINE = WINLINE - 1;
L_0085:;
// 552 limline = limline-1
LIMLINE = LIMLINE - 1;
// 553 %end
return;
} /* end of JOIN */
// 554 !
// 555 %routine switch
void SWITCH(void) {
// 556 ! Switch between main and secondary input
// 557 ! Create false bottom if switching from main and lower half is in NEW
// 558 %integer i
int I;
// 559 split
SPLIT();
// 560 newlim = gaplim %if flim = newlim; !create false bottom
if (FLIM != NEWLIM) goto L_0086;
NEWLIM = GAPLIM;
L_0086:;
// 561 i = sfp; sfp = fp; fp = i
I = SFP;
SFP = FP;
FP = I;
// 562 i = slim; slim = flim; flim = i
I = SLIM;
SLIM = FLIM;
FLIM = I;
// 563 sin = sin!!1
SIN = SIN ^ 1;
// 564 lbeg = lbeg-sfp+fp; gaplim = fp
LBEG = LBEG - SFP + FP;
GAPLIM = FP;
// 565 newlim = flim %if newlim = gaplim; !remove false bottom
if (NEWLIM != GAPLIM) goto L_0087;
NEWLIM = FLIM;
L_0087:;
// 566 lend = fp
LEND = FP;
// 567 lend = lend+1 %while lend # flim %and byteinteger(lend) # nl
L_0088:;
if (LEND == FLIM) goto L_0089;
if (*_imp_BYTEINTEGER(LEND) == 10) goto L_0089;
LEND = LEND + 1;
goto L_0088;
L_0089:;
// 568 joins = 999
JOINS = 999;
// 569 limline = 99999
LIMLINE = 99999;
// 570 %end
return;
} /* end of SWITCH */
// 571 !
// 572 ! C o m m a n d i n p u t routines
// 573 !
// 574 %integer type,chain,hold,echo
int TYPE;
int CHAIN;
int HOLD;
int ECHO;
// 575 !
// 576 %routine print code(%integer k)
void PRINTCODE(int K) {
// 577 ! Print command letter (mapping 'minus' values)
// 578 print symbol(k-casebit) %and k='-' %if k >= 'a'
if (K < 97) goto L_008A;
_imp_PRINTSYMBOL(K - 32);
K = 45;
L_008A:;
// 579 print symbol(k)
_imp_PRINTSYMBOL(K);
// 580 %end
return;
} /* end of PRINTCODE */
// 581 !
// 582 %routine read sym
void READSYM(void) {
// 583 ! Read next command symbol to SYM (maybe from macro def)
// 584 %on %event 9 %start
if (!_imp_on_event(9)) goto L_008B;
// 585 %finish
L_008B:;
// 586 %if pend # 0 %start
if (PEND == 0) goto L_008C;
// 587 sym = pend; pend = 0
SYM = PEND;
PEND = 0;
// 588 %finish %else %start
goto L_008D;
L_008C:;
// 589 %while macpos # 0 %cycle; !expanding macro
L_008E:;
if (MACPOS == 0) goto L_008F;
// 590 sym = macstore(macpos&255)
SYM = MACSTORE[MACPOS & 255];
// 591 macpos = macpos+1
MACPOS = MACPOS + 1;
// 592 %return %unless sym = nl; !(NL is definition terminator)
if (SYM == 10) goto L_0090;
return;
L_0090:;
// 593 macpos = macpos>>8
MACPOS = (unsigned int)MACPOS >> 8;
// 594 %repeat
goto L_008E;
L_008F:;
// 595 read symbol(sym)
_imp_READSYMBOL(/*?*/ &SYM);
// 596 print symbol(sym) %if echo # 0 %and sym >= ' '
if (ECHO == 0) goto L_0091;
if (SYM < 32) goto L_0091;
_imp_PRINTSYMBOL(SYM);
L_0091:;
// 597 %finish
L_008D:;
// 598 %end
return;
} /* end of READSYM */
// 599 !
// 600 %routine ignore
void IGNORE(void) {
// 601 echo = 0
ECHO = 0;
// 602 read sym %while sym # nl
L_0092:;
if (SYM == 10) goto L_0093;
READSYM();
goto L_0092;
L_0093:;
// 603 %end
return;
} /* end of IGNORE */
// 604 !
// 605 !Symbol types:-
// 606 ! 0:numeric 1:terminator 2:illegal 3:quote
// 607 ! 4:DU 5:IS 6:E 7:KJBGC@$
// 608 ! 8:F 9:TV 10:M 11:LR
// 609 ! 12:( [ 13:, 14:) ] 15:? \
// 610 !High order bits relevant following percent
// 611 %constbyteintegerarray symtype(32:95) =
const unsigned char SYMTYPE[64] = {3, 3, 3, 3, 7, 2, 3, 3, 12, 14, 0, 3, 13, 2, 3, 3,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 2, 2, 2, 15,
7, 7, 7, 23, 84, 6, 8, 7, 2, 5, 7, 7, 107, 74, 2, 2,
11, 2, 11, 37, 9, 52, 73, 112, 112, 112, 112, 12, 15, 14, 3, 3};
struct _imp_dv SYMTYPE_dv = {SYMTYPE, sizeof(unsigned char) /*, dims, <bounds> */};
// 612+ 16_03,16_03,16_03,16_03,16_07,16_02,16_03,16_03,
// 613+ 16_0C,16_0E,16_00,16_03,16_0D,16_02,16_03,16_03,
// 614+ 16_00,16_00,16_00,16_00,16_00,16_00,16_00,16_00,
// 615+ 16_00,16_00,16_03,16_01,16_02,16_02,16_02,16_0F,
// 616+ 16_07,16_07,16_07,16_17,16_54,16_06,16_08,16_07,
// 617+ 16_02,16_05,16_07,16_07,16_6B,16_4A,16_02,16_02,
// 618+ 16_0B,16_02,16_0B,16_25,16_09,16_34,16_49,16_70,
// 619+ 16_70,16_70,16_70,16_0C,16_0F,16_0E,16_03,16_03
// 620 ! sp ! " # $ % & '
// 621 ! ( ) * + , - . /
// 622 ! 0 1 2 3 4 5 6 7
// 623 ! 8 9 : ; < = > ?
// 624 ! @ A B C D E F G
// 625 ! H I J K L M N O
// 626 ! P Q R S T U V W
// 627 ! X Y Z [ \ ] ^ _
// 628 !
// 629 %routine read item
void READITEM(void) {
// 630 ! Read symbol to SYM and codify in TYPE
// 631 ! intercept macro letters ('W', 'X', 'Y', 'Z')
// 632 ! assemble numeric items in NUM
// 633 %cycle
L_0094:;
// 634 type = 1; !for terminator
TYPE = 1;
// 635 read sym %until sym # ' '; !ignore spaces
L_0095:;
READSYM();
if (SYM != 32) goto L_0096;
goto L_0095;
L_0096:;
// 636 %return %if sym < ' '; !terminator (any control) =>
if (SYM >= 32) goto L_0097;
return;
L_0097:;
// 637 sym = sym&95 %if sym >= 96; !ensure upper case (and more)
if (SYM < 96) goto L_0098;
SYM = SYM & 95;
L_0098:;
// 638 type = symtype(sym)&15
TYPE = SYMTYPE[SYM - 32] & 15;
// 639 %return %if type # 0; !not numeric or macro =>
if (TYPE == 0) goto L_0099;
return;
L_0099:;
// 640 %exit %if sym < 'W'
if (SYM >= 87) goto L_009A;
goto L_009B;
L_009A:;
// 641 %if macpos>>24 # 0 %then macpos = 0 %else macpos = (macpos<<2+(sym-'W'))<<6+1; !push down any existing calls
if ((unsigned int)MACPOS >> 24 == 0) goto L_009C;
MACPOS = 0;
goto L_009D;
L_009C:;
MACPOS = ((MACPOS << 2) + (SYM - 87) << 6) + 1;
L_009D:;
// 642 %repeat
goto L_0094;
L_009B:;
// 643 num = 0
NUM = 0;
// 644 %return %if sym = '*'
if (SYM != 42) goto L_009E;
return;
L_009E:;
// 645 %cycle
L_009F:;
// 646 num = num*10+sym-'0'
NUM = NUM * 10 + SYM - 48;
// 647 read sym
READSYM();
// 648 %repeat %until %not '0' <= sym <= '9'
{
// Double-sided test on SYM (Part I)
int tmp;
if (48 > (tmp = SYM)) goto L_00A0;
// Double-sided test on SYM (Part II)
if (tmp > 57) goto L_00A0;
}
goto L_009F;
L_00A0:;
// 649 pend = sym
PEND = SYM;
// 650 %end
return;
} /* end of READITEM */
// 651 !
// 652 %routine minus
void MINUS(void) {
// 653 ! Test for minus: map CODE if so
// 654 %if sym = '-' %start
if (SYM != 45) goto L_00A1;
// 655 code = code+casebit; !lower-case
CODE = CODE + 32;
// 656 read item
READITEM();
// 657 %finish
L_00A1:;
// 658 %end
return;
} /* end of MINUS */
// 659 !
// 660 %routine unchain
void UNCHAIN(void) {
// 661 ! Insert forward references in left bracket and comma cells
// 662 %cycle
L_00A2:;
// 663 ref = chain
REF = CHAIN;
// 664 %return %if ref = 0
if (REF != 0) goto L_00A3;
return;
L_00A3:;
// 665 chain = r(ref)_ref
CHAIN = R[REF - 1].REF;
// 666 r(ref)_ref = ci
R[REF - 1].REF = CI;
// 667 %repeat %until r(ref)_code = '['
if (R[REF - 1].CODE == 91) goto L_00A4;
goto L_00A2;
L_00A4:;
// 668 %end
return;
} /* end of UNCHAIN */
// 669 !
// 670 !
// 671 %switch c(4:15), pc(0:7), s('$':'p')
int C_index;
int C_line;
char *C_file;
static const void *C[12] = {&&case_C_4, &&case_C_5, &&case_C_6, &&case_C_7, &&case_C_8, &&case_C_9,
&&case_C_10, &&case_C_11, &&case_C_12, &&case_C_13, &&case_C_14, &&case_C_15};
int PC_index;
int PC_line;
char *PC_file;
static const void *PC[8] = {&&case_PC_0, &&case_PC_1, &&case_PC_2, &&case_PC_3,
&&case_PC_4, &&case_PC_5, &&case_PC_6, &&case_PC_7};
int S_index;
int S_line;
char *S_file;
static const void *S[77] = {
&&case_S_36, &&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing,
&&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing,
&&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing,
&&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing,
&&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_63, &&case_S_64, &&case_S_65,
&&case_S_66, &&case_S_67, &&case_S_68, &&case_S_69, &&case_S_70, &&case_S_71,
&&case_S_missing, &&case_S_73, &&case_S_74, &&case_S_75, &&case_S_76, &&case_S_77,
&&case_S_missing, &&case_S_missing, &&case_S_80, &&case_S_missing, &&case_S_82, &&case_S_83,
&&case_S_84, &&case_S_85, &&case_S_86, &&case_S_missing, &&case_S_missing, &&case_S_missing,
&&case_S_missing, &&case_S_91, &&case_S_92, &&case_S_93, &&case_S_94, &&case_S_missing,
&&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_101,
&&case_S_102, &&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing, &&case_S_missing,
&&case_S_missing, &&case_S_109, &&case_S_missing, &&case_S_missing, &&case_S_missing};
// 672 %integer i,j,p,fp1
int I;
int J;
int P;
int FP1;
// 673 !
// 674 ! I n i t i a l i s a t i o n
// 675 !
// 676 mstart = 0; cmax = 0
MSTART = 0;
CMAX = 0;
// 677 r(cbound-1) = 0; !'immediate-action' cell
R[50 - 1 - 1] = (struct COMMANDCELL){0};
// 678 r(cbound-1)_count = 1
R[50 - 1 - 1].COUNT = 1;
// 679 r(cbound) = 0; !'i-a' terminating cell
R[49] = (struct COMMANDCELL){0};
// 680 r(cbound)_code = ']'
R[49].CODE = 93;
// 681 r(cbound)_count = stopper+1
R[49].COUNT = (-10000) + 1;
// 682 macpos = 0
MACPOS = 0;
// 683 macstore(1) = nl; macstore(65) = nl
MACSTORE[1] = 10;
MACSTORE[65] = 10;
// 684 macstore(129) = nl; macstore(192) = nl
MACSTORE[129] = 10;
MACSTORE[192] = 10;
// 685 casemask = \casebit; !ignore case distinctions (default)
CASEMASK = (~32);
// 686 width = 80; dir = 0
WIDTH = 80;
DIR = 0;
// 687 newtop = new_top; gaptop = newtop
NEWTOP = NEW->TOP;
GAPTOP = NEWTOP;
// 688 newlim = new_lim
NEWLIM = NEW->LIM;
// 689 fp = old_top
FP = OLD->TOP;
// 690 gaplim = fp; lbeg = fp; lend = fp
GAPLIM = FP;
LBEG = FP;
LEND = FP;
// 691 flim = old_lim
FLIM = OLD->LIM;
// 692 lend = lend+1 %while lend # flim %and byteinteger(lend) # nl
L_00A5:;
if (LEND == FLIM) goto L_00A6;
if (*_imp_BYTEINTEGER(LEND) == 10) goto L_00A6;
LEND = LEND + 1;
goto L_00A5;
L_00A6:;
// 693 sin = 0; sfp = sec_top; slim = sec_lim
SIN = 0;
SFP = SEC->TOP;
SLIM = SEC->LIM;
// 694 changemin = newlim; changelbeg = 0
CHANGEMIN = NEWLIM;
CHANGELBEG = 0;
// 695 joins = 0; breaks = 0
JOINS = 0;
BREAKS = 0;
// 696 line = 1; winline = 0; limline = 999999
LINE = 1;
WINLINE = 0;
LIMLINE = 999999;
// 697 GET DIMENSIONS(ROWS, COLS)
GETDIMENSIONS(/*?*/ &ROWS, /*?*/ &COLS);
// 698 WINLIM = ROWS-4; !*EMAS*
WINLIM = ROWS - 4;
// 699 COLS = COLS-1; !*WIN32C*
COLS = COLS - 1;
// 700 WINLIM = ROWS-2; !*VAX* *WIN32C*
WINLIM = ROWS - 2;
// 701 winbot = winlim-1; wintop = winbot
WINBOT = WINLIM - 1;
WINTOP = WINBOT;
// 702 !*MOUSES* MINWIN = 20{ 3?} %AND WINLINE = -99
// 703 MINWIN = ROWS-2 %AND WINLINE = -999; !*WIN32C*
MINWIN = ROWS - 2;
WINLINE = -999;
// 704 ! vrow = 99
// 705 VROW = 999; !*WIN32C*
VROW = 999;
// 706 !*MOUSES* newlines(rows-winlim-1) %if video # 0
// 707 NEWLINES(ROWS-WINLIM-2) %IF VIDEO # 0; !*WIN32C*
if (VIDEO == 0) goto L_00A7;
_imp_NEWLINES(ROWS - WINLIM - 2);
L_00A7:;
// 708
// 709 !!! %for i = 0,1,3 %cycle
// 710 !!! %for j = 1,1,length(prom(i)) %cycle
// 711 !!! charno(prom(i),j) = esc %if charno(prom(i),j) = '^'
// 712 !!! %repeat
// 713 !!! charno(prom(i),3) = ' '+winlim %if i > 0
// 714 !!! CHARNO(GPROM(I),1) = ESC %IF I > 0; !*VAX*
// 715 !!! %repeat
// 716 !!! charno(prom(1),4) = rt; charno(prom(1),7) = rt
// 717
// 718 %begin {***** Initialise PROMPT strings *****}
{ /*%begin*/
// 719 %string(15) S
_imp_string15 S;
// 720 p = video & 7
P = VIDEO & 7;
// 721 prom = proms(p)
/* clang-format off */
_imp_strncpy(/*?*/&PROM, ({__typeof__(_imp_string11) tmp;/*B*/ tmp = PROMS[P]; (void *)&tmp;}), /*max:*/15);
/* clang-format on */
// 722 gprom = gproms(p); charno(gprom,1) = ESC %if charno(gprom,1) = '^'
/* clang-format off */
_imp_strncpy(/*?*/&GPROM, ({__typeof__(_imp_string3) tmp;/*B*/ tmp = GPROMS[P]; (void *)&tmp;}), /*max:*/15);
/* clang-format on */
if (*_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &GPROM, 1) != 94) goto L_00A8;
*_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &GPROM, 1) = 27;
L_00A8:;
// 723 %for j = 1,1,length(prom) %cycle
// %for J = 1, 1, *_imp_LENGTH((_imp_string255 *)/*p*//*?*/&PROM) %cycle
{
int _final = *_imp_LENGTH((_imp_string255 *)/*p*/ /*?*/ &PROM);
if (invalid_for_loop(1, 1, _final))
_imp_signal(5, 1, 0, "Illegal cycle J = 1, 1, *_imp_LENGTH((_imp_string255 *)/*p*//*?*/&PROM)");
J = 0;
L_00A9:
if (J == _final) goto L_00AA;
J += 1;
// ?Non-local
// 724 charno(prom,j) = ESC %if charno(prom,j) = '^'
if (*_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &PROM, J) != 94) goto L_00AC;
*_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &PROM, J) = 27;
L_00AC:;
// 725 %repeat
goto L_00A9;
}
L_00AA:;
// 726 %if video = VT52 %or video = BANTAM %start
if (VIDEO == -1073741822) goto L_00AB;
if (VIDEO != 1) goto L_00AD;
L_00AB:;
// 727 charno(prom,3) = ' '+winlim
*_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &PROM, 3) = 32 + WINLIM;
// 728 video invert = to string(ESC)."4" {reduced intensity}
/* clang-format off */
_imp_strncpy(/*?*/&VIDEOINVERT, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join(({__typeof__(_imp_string1) tmp; /*D*/ tmp = _imp_TOSTRING(27); (void *)&tmp;}), (_imp_string *)/*?*/_imp_str_literal_ptr("4")); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/7);
/* clang-format on */
// 729 video restore = to string(ESC)."3" {normal}
/* clang-format off */
_imp_strncpy(/*?*/&VIDEORESTORE, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join(({__typeof__(_imp_string1) tmp; /*D*/ tmp = _imp_TOSTRING(27); (void *)&tmp;}), (_imp_string *)/*?*/_imp_str_literal_ptr("3")); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/7);
/* clang-format on */
// 730 %if video = BANTAM %start
if (VIDEO != 1) goto L_00AE;
// 731 charno(prom,4) = rt; charno(prom,7) = rt
*_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &PROM, 4) = 13;
*_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &PROM, 7) = 13;
// 732 %finish
L_00AE:;
// 733 %else %if video = win32 console
goto L_00AF;
L_00AD:;
if (VIDEO != -1073741819) goto L_00B0;
// 734 video invert = tostring(ESC)."[7m"
/* clang-format off */
_imp_strncpy(/*?*/&VIDEOINVERT, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join(({__typeof__(_imp_string1) tmp; /*D*/ tmp = _imp_TOSTRING(27); (void *)&tmp;}), (_imp_string *)/*?*/_imp_str_literal_ptr("[7m")); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/7);
/* clang-format on */
// 735 video restore = tostring(ESC)."[0m"
/* clang-format off */
_imp_strncpy(/*?*/&VIDEORESTORE, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join(({__typeof__(_imp_string1) tmp; /*D*/ tmp = _imp_TOSTRING(27); (void *)&tmp;}), (_imp_string *)/*?*/_imp_str_literal_ptr("[0m")); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/7);
/* clang-format on */
// 736 %else %if video = VT100
goto L_00AF;
L_00B0:;
if (VIDEO != -1073741821) goto L_00B1;
// 737 S = digits(winlim+2) {*** This must be TWO digits ***}
/* clang-format off */
_imp_strncpy(/*?*/&S, ({__typeof__(_imp_string3) tmp;/*B*/ tmp = DIGITS(WINLIM + 2); (void *)&tmp;}), /*max:*/15);
/* clang-format on */
// 738 charno(prom,3) = charno(S,1)
*_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &PROM, 3) = *_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &S, 1);
// 739 charno(prom,4) = charno(S,2)
*_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &PROM, 4) = *_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &S, 2);
// 740 video invert = tostring(ESC)."[1;7m" {inverse video}
/* clang-format off */
_imp_strncpy(/*?*/&VIDEOINVERT, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join(({__typeof__(_imp_string1) tmp; /*D*/ tmp = _imp_TOSTRING(27); (void *)&tmp;}), (_imp_string *)/*?*/_imp_str_literal_ptr("[1;7m")); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/7);
/* clang-format on */
// 741 video restore = tostring(ESC)."[m" {normal}
/* clang-format off */
_imp_strncpy(/*?*/&VIDEORESTORE, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join(({__typeof__(_imp_string1) tmp; /*D*/ tmp = _imp_TOSTRING(27); (void *)&tmp;}), (_imp_string *)/*?*/_imp_str_literal_ptr("[m")); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/7);
/* clang-format on */
// 742 %else %if video = VC404
goto L_00AF;
L_00B1:;
if (VIDEO != 4) goto L_00B2;
// 743 prom = to string(DLE) . "4" . to string(' '+winlim) . to string(x'16') . ">"
/* clang-format off */
_imp_strncpy(/*?*/&PROM, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/&*({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/&*({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/&*({_imp_string255 tmp = _imp_join(({__typeof__(_imp_string1) tmp; /*D*/ tmp = _imp_TOSTRING(16); (void *)&tmp;}), (_imp_string *)/*?*/_imp_str_literal_ptr("4")); (_imp_string255 *)&tmp;}), ({__typeof__(_imp_string1) tmp; /*E*/ tmp = _imp_TOSTRING(32 + WINLIM); (void *)&tmp;})); (_imp_string255 *)&tmp;}), ({__typeof__(_imp_string1) tmp; /*E*/ tmp = _imp_TOSTRING(22); (void *)&tmp;})); (_imp_string255 *)&tmp;}), (_imp_string *)/*?*/_imp_str_literal_ptr(">")); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/15);
/* clang-format on */
// 744 %finish
L_00B2:;
L_00AF:;
// 745 %end {PROMPT initialisation}
goto end_1000;
end_1000:;
}
// 746
// 747 clear screen
CLEARSCREEN();
// 748
// 749 sym = nl
SYM = 10;
// 750 !
// 751 ! R e a d n e w c o m m a n d l i n e
// 752 !
// 753 read:
U_1002:;
// 754 %if sin = 0 %then prompt(prom) %else prompt(prom.">")
if (SIN != 0) goto L_00B3;
_imp_PROMPT(
/* clang-format off */
*({ __typeof__(_imp_string15) tmp = PROM/*q*/; (_imp_string15 *)&tmp; })
/* clang-format on */
);
goto L_00B4;
L_00B3:;
_imp_PROMPT(
/* clang-format off */
*({ __typeof__(_imp_string255) tmp = *({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/&PROM, (_imp_string *)/*?*/_imp_str_literal_ptr(">")); (_imp_string255 *)&tmp;})/*q*/; (_imp_string15 *)&tmp; })
/* clang-format on */
);
L_00B4:;
// 755 pend = 0; sym1 = sym
PEND = 0;
SYM1 = SYM;
// 756 %if sym = nl %start
if (SYM != 10) goto L_00B5;
// 757 %if video = 0 %start
if (VIDEO != 0) goto L_00B6;
// 758 num = 1
NUM = 1;
// 759 display %if (mon=0 %and printline#line) %or (mon>0 %and printed#gaptop+fp)
if (MON != 0) goto L_00B7;
if (PRINTLINE != LINE) goto L_00B8;
L_00B7:;
if (MON <= 0) goto L_00B9;
if (PRINTED == GAPTOP + FP) goto L_00B9;
L_00B8:;
DISPLAY();
L_00B9:;
// 760 %finish %else %start
goto L_00BA;
L_00B6:;
// 761 display
DISPLAY();
// 762 ! Show position of pointer
// 763 fprow = line-winline+wintop
FPROW = LINE - WINLINE + WINTOP;
// 764 at(fprow,fp-lbeg)
AT(FPROW, FP - LBEG);
// 765 %if video > 0 %start
if (VIDEO <= 0) goto L_00BB;
// 766 %IF video = BANTAM %THEN PRINT SYMBOL(ESC) %AND PRINT SYMBOL(127) %ELSE PRINT SYMBOL('^'); !ESC+127 IS BANTAM SPLODGE
if (VIDEO != 1) goto L_00BC;
_imp_PRINTSYMBOL(27);
_imp_PRINTSYMBOL(127);
goto L_00BD;
L_00BC:;
_imp_PRINTSYMBOL(94);
L_00BD:;
// 767 sym1 = ' '
SYM1 = 32;
// 768 %if fp # lbeg %start
if (FP == LBEG) goto L_00BE;
// 769 %if fp # gaplim %then sym1 = byteinteger(fp-1) %else sym1 = byteinteger(gaptop-1)
if (FP == GAPLIM) goto L_00BF;
SYM1 = *_imp_BYTEINTEGER(FP - 1);
goto L_00C0;
L_00BF:;
SYM1 = *_imp_BYTEINTEGER(GAPTOP - 1);
L_00C0:;
// 770 %finish
L_00BE:;
// 771 %finish %else %start
goto L_00C1;
L_00BB:;
// 772 print string(video invert) {change display mode for one char}
_imp_PRINTSTRING(
/* clang-format off */
*({ __typeof__(_imp_string7) tmp = VIDEOINVERT/*q*/; (_imp_string255 *)&tmp; })
/* clang-format on */
);
// 773 sym1 = ' '; sym = '|'
SYM1 = 32;
SYM = 124;
// 774 %if fp # lend %and byteinteger(fp) # ' ' %start
if (FP == LEND) goto L_00C2;
if (*_imp_BYTEINTEGER(FP) == 32) goto L_00C2;
// 775 sym1 = byteinteger(fp); sym = sym1
SYM1 = *_imp_BYTEINTEGER(FP);
SYM = SYM1;
// 776 %finish
L_00C2:;
// 777 print symbol(sym)
_imp_PRINTSYMBOL(SYM);
// 778 print string(video restore)
_imp_PRINTSTRING(
/* clang-format off */
*({ __typeof__(_imp_string7) tmp = VIDEORESTORE/*q*/; (_imp_string255 *)&tmp; })
/* clang-format on */
);
// 779 %finish
L_00C1:;
// 780 NEWLINE; !*VAX* to flush
_imp_NEWLINE();
// 781 %finish
L_00BA:;
// 782 AT(WINLIM,0) %AND CLEAR LINE %IF VIDEO = WIN32 CONSOLE; !*WIN32C*
if (VIDEO != -1073741819) goto L_00C3;
AT(WINLIM, 0);
CLEARLINE();
L_00C3:;
// 783 %finish %else %start
goto L_00C4;
L_00B5:;
// 784 read sym
READSYM();
// 785 pend = sym %if sym # nl; !NL not significant
if (SYM == 10) goto L_00C5;
PEND = SYM;
L_00C5:;
// 786 %finish
L_00C4:;
// 787 ! Deal with special cases
// 788 ci = 0; ti = 0; chain = 0
CI = 0;
TI = 0;
CHAIN = 0;
// 789 echo = 0
ECHO = 0;
// 790 %cycle
L_00C6:;
// 791 read item
READITEM();
// 792 %exit %if sym # '-'
if (SYM == 45) goto L_00C7;
goto L_00C8;
L_00C7:;
// 793 dir = dir!!casebit; !toggle direction
DIR = DIR ^ 32;
// 794 %repeat
goto L_00C6;
L_00C8:;
// 795 %if type = 1 %start; !plain RETURN
if (TYPE != 1) goto L_00C9;
// 796 r(cbound-1)_code = 'M'+dir; !M/M-
R[50 - 1 - 1].CODE = 77 + DIR;
// 797 ci = cbound-2
CI = 50 - 2;
// 798 -> restore
goto U_1003;
// 799 %finish
L_00C9:;
// 800 %if type = 0 %and cmax # 0 %start; !repetition
if (TYPE != 0) goto L_00CA;
if (CMAX == 0) goto L_00CA;
// 801 r(cmax)_count = num
R[CMAX - 1].COUNT = NUM;
// 802 read item; -> er1 %if type # 1
READITEM();
if (TYPE == 1) goto L_00CB;
goto U_1004;
L_00CB:;
// 803 -> restore
goto U_1003;
// 804 %finish
L_00CA:;
// 805 %if sym = '%' %start
if (SYM != 37) goto L_00CC;
// 806 read sym; -> erq %if sym < 'A'
READSYM();
if (SYM >= 65) goto L_00CD;
goto U_1005;
L_00CD:;
// 807 code = sym&95; !upper-case
CODE = SYM & 95;
// 808 read sym
READSYM();
// 809 -> pc(symtype(code)>>4&7)
PC_line = __LINE__;
PC_file = __FILE__;
PC_index = (unsigned int)SYMTYPE[CODE - 32] >> 4 & 7;
goto case_PC_dispatch;
// 810 %finish
L_00CC:;
// 811 dir = 0
DIR = 0;
// 812 %if video > 0 %start
if (VIDEO <= 0) goto L_00CF;
// 813 clear line; print symbol('=')
CLEARLINE();
_imp_PRINTSYMBOL(61);
// 814 print symbol(sym)
_imp_PRINTSYMBOL(SYM);
// 815 echo = 1
ECHO = 1;
// 816 %finish
L_00CF:;
// 817 ! C o m m a n d i n p u t: m a i n l o o p
// 818 more: !(command code has been read)
U_1006:;
// 819 hold = type; -> er2 %if hold < 4
HOLD = TYPE;
if (HOLD >= 4) goto L_00D0;
goto U_1007;
L_00D0:;
// 820 -> er0 %if hold < 8 %and newtop = 0; !no changes when Showing
if (HOLD >= 8) goto L_00D1;
if (NEWTOP != 0) goto L_00D1;
goto U_1008;
L_00D1:;
// 821 ci = ci+1; -> er6 %if ci >= cbound-3
CI = CI + 1;
if (CI < 50 - 3) goto L_00D2;
goto U_1009;
L_00D2:;
// 822 code = sym; !command letter
CODE = SYM;
// 823 ref = 0; num = 1; scope = 1; !default values
REF = 0;
NUM = 1;
SCOPE = 1;
// 824 read item
READITEM();
// 825 -> c(hold)
C_line = __LINE__;
C_file = __FILE__;
C_index = HOLD;
goto case_C_dispatch;
// 826 c(8): !Find
case_C_8:;
// 827 minus
MINUS();
// 828 scope = 0
SCOPE = 0;
// 829 c(4): !+ Delete, Uncover
case_C_4:;
// 830 c(9): !+ Traverse, Verify
case_C_9:;
// 831 %if type = 0 %start; !followed by number
if (TYPE != 0) goto L_00D4;
// 832 scope = num
SCOPE = NUM;
// 833 read item
READITEM();
// 834 %finish
L_00D4:;
// 835 num = 0; !as indicator (not I,S)
NUM = 0;
// 836 c(5): !+ Insert, Substitute
case_C_5:;
// 837 hold = sym; -> er4 %if type # 3; !not valid quote mark ->
HOLD = SYM;
if (TYPE == 3) goto L_00D5;
goto U_100A;
L_00D5:;
// 838 ti = ti+1; ref = ti; !REF indexes first quoted symbol
TI = TI + 1;
REF = TI;
// 839 %cycle
L_00D6:;
// 840 read sym
READSYM();
// 841 %if sym = nl %start; !closing quote omitted
if (SYM != 10) goto L_00D7;
// 842 -> er4 %if num = 0; !allowed only for I,S
if (NUM != 0) goto L_00D8;
goto U_100A;
L_00D8:;
// 843 pend = sym; sym = hold
PEND = SYM;
SYM = HOLD;
// 844 %finish
L_00D7:;
// 845 %exit %if sym = hold
if (SYM != HOLD) goto L_00D9;
goto L_00DA;
L_00D9:;
// 846 -> er6 %if ti > tbound-2
if (TI <= 120 - 2) goto L_00DB;
goto U_1009;
L_00DB:;
// 847 sym = sym&casemask %if 'a' <= sym <= 'z' %and num = 0
{
// Double-sided test on SYM (Part I)
int tmp;
if (97 > (tmp = SYM)) goto L_00DC;
// Double-sided test on SYM (Part II)
if (tmp > 122) goto L_00DC;
}
if (NUM != 0) goto L_00DC;
SYM = SYM & CASEMASK;
L_00DC:;
// 848 text(ti) = sym; ti = ti+1
TEXT[TI - 1] = SYM;
TI = TI + 1;
// 849 %repeat
goto L_00D6;
L_00DA:;
// 850 -> er4 %if ti = ref %and num = 0; !null allowed only for I,S
if (TI != REF) goto L_00DD;
if (NUM != 0) goto L_00DD;
goto U_100A;
L_00DD:;
// 851 text(ti) = 0; !end-marker
TEXT[TI - 1] = 0;
// 852 num = 1; !restore default
NUM = 1;
// 853 read item
READITEM();
// 854 -> nput
goto U_100B;
// 855 c(6): !Erase
case_C_6:;
// 856 c(10): !+ Move, Print
case_C_10:;
// 857 minus
MINUS();
// 858 c(7): !+ Get, Kill, etc
case_C_7:;
// 859 c(11): !+ Left, Right, etc
case_C_11:;
// 860 -> er1 %if type = 3; !(redundant, but better report)
if (TYPE != 3) goto L_00DE;
goto U_1004;
L_00DE:;
// 861 -> nput
goto U_100B;
// 862 c(12): !open bracket
case_C_12:;
// 863 code = '['
CODE = 91;
// 864 -> comma
goto U_100C;
// 865 c(13): !comma
case_C_13:;
// 866 code = '^'
CODE = 94;
// 867 ! read item %if type = 1; !permit line break (better not?)
// 868 comma:
U_100C:;
// 869 ref = chain; chain = ci
REF = CHAIN;
CHAIN = CI;
// 870 -> put
goto U_100D;
// 871 c(14): !close bracket
case_C_14:;
// 872 unchain; -> er3 %if ref = 0
UNCHAIN();
if (REF != 0) goto L_00DF;
goto U_100E;
L_00DF:;
// 873 code = ']'; r(ref)_count = num
CODE = 93;
R[REF - 1].COUNT = NUM;
// 874 nput:
U_100B:;
// 875 read item %if type = 0; !get next item if number
if (TYPE != 0) goto L_00E0;
READITEM();
L_00E0:;
// 876 c(15): !invert, query
case_C_15:;
// 877 put:
U_100D:;
// 878 r(ci)_code = code; r(ci)_ref = ref
R[CI - 1].CODE = CODE;
R[CI - 1].REF = REF;
// 879 r(ci)_scope = scope; r(ci)_count = num
R[CI - 1].SCOPE = SCOPE;
R[CI - 1].COUNT = NUM;
// 880 -> more %unless type = 1
if (TYPE == 1) goto L_00E1;
goto U_1006;
L_00E1:;
// 881 ci = ci+1; cmax = ci
CI = CI + 1;
CMAX = CI;
// 882 unchain; -> er3 %if ref # 0
UNCHAIN();
if (REF == 0) goto L_00E2;
goto U_100E;
L_00E2:;
// 883 r(ci)_code = ']'; r(ci)_ref = 0
R[CI - 1].CODE = 93;
R[CI - 1].REF = 0;
// 884 r(ci)_count = 1
R[CI - 1].COUNT = 1;
// 885 ci = 0
CI = 0;
// 886 AT(WINLIM,0) %IF VIDEO=WIN32 CONSOLE; !*WIN32C* neccessary, but why?!
if (VIDEO != -1073741819) goto L_00E3;
AT(WINLIM, 0);
L_00E3:;
// 887 insert line(winlim); !preserve command line
INSERTLINE(WINLIM);
// 888 restore:
U_1003:;
// 889 %if sym1 # nl %start
if (SYM1 == 10) goto L_00E4;
// 890 at(fprow,fp-lbeg)
AT(FPROW, FP - LBEG);
// 891 print symbol(sym1)
_imp_PRINTSYMBOL(SYM1);
// 892 %finish
L_00E4:;
// 893 -> next
goto U_100F;
// 894 !
// 895 er0:print symbol(' '); print code(sym)
U_1008:;
_imp_PRINTSYMBOL(32);
PRINTCODE(SYM);
// 896 print string(" when Showing")
_imp_PRINTSTRING(_imp_str_literal(" when Showing"));
// 897 -> erq
goto U_1005;
// 898 er1:print symbol(' '); print symbol(code)
U_1004:;
_imp_PRINTSYMBOL(32);
_imp_PRINTSYMBOL(CODE);
// 899 er2:code = sym
U_1007:;
CODE = SYM;
// 900 -> er5
goto U_1010;
// 901 er3:printstring(" Brackets")
U_100E:;
_imp_PRINTSTRING(_imp_str_literal(" Brackets"));
// 902 -> erq
goto U_1005;
// 903 er4:printstring(" Text for")
U_100A:;
_imp_PRINTSTRING(_imp_str_literal(" Text for"));
// 904 pc(0):
case_PC_0:;
// 905 er5:print symbol(' '); print code(code)
U_1010:;
_imp_PRINTSYMBOL(32);
PRINTCODE(CODE);
// 906 -> erq
goto U_1005;
// 907 er6:printstring(" Size")
U_1009:;
_imp_PRINTSTRING(_imp_str_literal(" Size"));
// 908 erq:print symbol('?')
U_1005:;
_imp_PRINTSYMBOL(63);
// 909 %if video # 0 %then clear line %else newline
if (VIDEO == 0) goto L_00E5;
CLEARLINE();
goto L_00E6;
L_00E5:;
_imp_NEWLINE();
L_00E6:;
// 910 cmax = 0 %if ci > 1
if (CI <= 1) goto L_00E7;
CMAX = 0;
L_00E7:;
// 911 ignore
IGNORE();
// 912 -> read
goto U_1002;
// 913 !
// 914 ! Percent commands
// 915 pc(1): !%C: close
case_PC_1:;
// 916 switch %if sin # 0
if (SIN == 0) goto L_00E8;
SWITCH();
L_00E8:;
// 917 new_flag = 1 %if changelbeg # 0
if (CHANGELBEG == 0) goto L_00E9;
NEW->FLAG = 1;
L_00E9:;
// 918 new_lim = gaptop
NEW->LIM = GAPTOP;
// 919 old_top = gaplim; old_lim = flim
OLD->TOP = GAPLIM;
OLD->LIM = FLIM;
// 920 clear screen
CLEARSCREEN();
// 921 %return
return;
// 922 pc(2): !%S: secondary input
case_PC_2:;
// 923 switch %if sin # 0
if (SIN == 0) goto L_00EA;
SWITCH();
L_00EA:;
// 924 %if sym = '=' %start
if (SYM != 61) goto L_00EB;
// 925 i = 0
I = 0;
// 926 %cycle
L_00EC:;
// 927 read sym
READSYM();
// 928 %exit %if sym = ';' %or sym = nl
if (SYM == 59) goto L_00ED;
if (SYM != 10) goto L_00EE;
L_00ED:;
goto L_00EF;
L_00EE:;
// 929 -> er6 %if i = maxname
if (I != 255) goto L_00F0;
goto U_1009;
L_00F0:;
// 930 i = i+1; charno(sec_name,i) = sym
I = I + 1;
*_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &SEC->NAME, I) = SYM;
// 931 %repeat
goto L_00EC;
L_00EF:;
// 932 length(sec_name) = i
*_imp_LENGTH((_imp_string255 *)/*p*/ /*?*/ &SEC->NAME) = I;
// 933 connect input(sec)
CONNECTINPUT(SEC);
// 934 %finish
L_00EB:;
// 935 sfp = sec_top; slim = sec_lim
SFP = SEC->TOP;
SLIM = SEC->LIM;
// 936 -> erq %if sec_top = sec_lim
if (SEC->TOP != SEC->LIM) goto L_00F1;
goto U_1005;
L_00F1:;
// 937 switch
SWITCH();
// 938 -> read
goto U_1002;
// 939 pc(3): !%U: ignore/respect case
case_PC_3:;
// 940 casemask = \casebit
CASEMASK = (~32);
// 941 casemask = \0 %and read sym %if sym = '-'
if (SYM != 45) goto L_00F2;
CASEMASK = (~0);
READSYM();
L_00F2:;
// 942 -> read
goto U_1002;
// 943 pc(4): !%M (%V)
case_PC_4:;
// 944 %if code = 'M' %start
if (CODE != 77) goto L_00F3;
// 945 mon = 0
MON = 0;
// 946 mon = 1 %and read sym %if sym = '+'
if (SYM != 43) goto L_00F4;
MON = 1;
READSYM();
L_00F4:;
// 947 mon = -1 %and read sym %if sym = '-'
if (SYM != 45) goto L_00F5;
MON = -1;
READSYM();
L_00F5:;
// 948 %finish %else %start
goto L_00F6;
L_00F3:;
// 949 read item
READITEM();
// 950 -> erq %if type # 0
if (TYPE == 0) goto L_00F7;
goto U_1005;
L_00F7:;
// 951 video = (num&x'C')<<28+num&7
VIDEO = ((NUM & 12) << 28) + (NUM & 7);
// 952 winline = -99
WINLINE = -99;
// 953 %finish
L_00F6:;
// 954 -> read
goto U_1002;
// 955 pc(5): !%D: define window size
case_PC_5:;
// 956 %if sym = '=' %start
if (SYM != 61) goto L_00F8;
// 957 read item
READITEM();
// 958 -> erq %if type # 0
if (TYPE == 0) goto L_00F9;
goto U_1005;
L_00F9:;
// 959 -> er6 %unless num <= winlim
if (NUM <= WINLIM) goto L_00FA;
goto U_1009;
L_00FA:;
// 960 minwin = num
MINWIN = NUM;
// 961 video = 0 %if num <= 0
if (NUM > 0) goto L_00FB;
VIDEO = 0;
L_00FB:;
// 962 %finish
L_00F8:;
// 963 winline = -99
WINLINE = -99;
// 964 -> read
goto U_1002;
// 965 pc(6): !%L: define line width
case_PC_6:;
// 966 -> erq %if sym # '='
if (SYM == 61) goto L_00FC;
goto U_1005;
L_00FC:;
// 967 read item
READITEM();
// 968 -> erq %if type # 0
if (TYPE == 0) goto L_00FD;
goto U_1005;
L_00FD:;
// 969 -> er6 %unless 5 <= num <= 256
{
// Double-sided test on NUM (Part I)
int tmp;
if (5 > (tmp = NUM)) goto L_00FE;
// Double-sided test on NUM (Part II)
if (tmp <= 256) goto L_00FF;
}
L_00FE:;
goto U_1009;
L_00FF:;
// 970 width = num
WIDTH = NUM;
// 971 -> read
goto U_1002;
// 972 pc(7): !%W, %X, %Y, %Z
case_PC_7:;
// 973 i = (code-'W')<<6+1; !64-byte increments
I = (CODE - 87 << 6) + 1;
// 974 %if sym = '=' %start; !definition
if (SYM != 61) goto L_0100;
// 975 %cycle
L_0101:;
// 976 read sym
READSYM();
// 977 macstore(i) = sym
MACSTORE[I] = SYM;
// 978 %exit %if sym = nl
if (SYM != 10) goto L_0102;
goto L_0103;
L_0102:;
// 979 i = i+1 %if i # 255
if (I == 255) goto L_0104;
I = I + 1;
L_0104:;
// 980 %repeat
goto L_0101;
L_0103:;
// 981 %finish %else %start; !enquiry
goto L_0105;
L_0100:;
// 982 -> er1 %if sym # nl
if (SYM == 10) goto L_0106;
goto U_1004;
L_0106:;
// 983 print symbol(code); print symbol('=')
_imp_PRINTSYMBOL(CODE);
_imp_PRINTSYMBOL(61);
// 984 %cycle
L_0107:;
// 985 sym = macstore(i)
SYM = MACSTORE[I];
// 986 %exit %if sym = nl
if (SYM != 10) goto L_0108;
goto L_0109;
L_0108:;
// 987 print symbol(sym)
_imp_PRINTSYMBOL(SYM);
// 988 i = i+1
I = I + 1;
// 989 %repeat
goto L_0107;
L_0109:;
// 990 %if video # 0 %then clear line %else newline
if (VIDEO == 0) goto L_010A;
CLEARLINE();
goto L_010B;
L_010A:;
_imp_NEWLINE();
L_010B:;
// 991 %finish
L_0105:;
// 992 -> read
goto U_1002;
// 993 !
// 994 ! C o m m a n d e x e c u t i o n
// 995 !
// 996 %integerfn matched
int MATCHED(void) {
// 997 %integer i,j,k
int I;
int J;
int K;
// 998 i = fp-1; j = ref-1
I = FP - 1;
J = REF - 1;
// 999 %cycle
L_010C:;
// 1000 i = i+1; j = j+1
I = I + 1;
J = J + 1;
// 1001 k = byteinteger(i)
K = *_imp_BYTEINTEGER(I);
// 1002 k = k&casemask %if 'a' <= k <= 'z'
{
// Double-sided test on K (Part I)
int tmp;
if (97 > (tmp = K)) goto L_010D;
// Double-sided test on K (Part II)
if (tmp > 122) goto L_010D;
}
K = K & CASEMASK;
L_010D:;
// 1003 %repeat %until k # text(j)
if (K != TEXT[J - 1]) goto L_010E;
goto L_010C;
L_010E:;
// 1004 %result = 0 %if text(j) # 0
if (TEXT[J - 1] == 0) goto L_010F;
return 0;
L_010F:;
// 1005 mstart = fp; msize = i-fp
MSTART = FP;
MSIZE = I - FP;
// 1006 %result = 1
return 1;
// 1007 %end
} /* end of MATCHED */
// 1008 !
// 1009 ! Extract next command
// 1010 !
// 1011 next: s('?'):
U_100F:;
case_S_63:;
// 1012 ci = ci+1
CI = CI + 1;
// 1013 code = r(ci)_code; ref = r(ci)_ref
CODE = R[CI - 1].CODE;
REF = R[CI - 1].REF;
// 1014 num = r(ci)_count
NUM = R[CI - 1].COUNT;
// 1015 -> s(code)
S_line = __LINE__;
S_file = __FILE__;
S_index = CODE;
goto case_S_dispatch;
// 1016 !
// 1017 ! Successful return after Move etc
// 1018 ! FP has been advanced into next line, new LEND to be determined
// 1019 lok:
U_1011:;
// 1020 lend = fp
LEND = FP;
// 1021 %if lend # flim %start
if (LEND == FLIM) goto L_0111;
// 1022 lend = lend+1 %while byteinteger(lend) # nl
L_0112:;
if (*_imp_BYTEINTEGER(LEND) == 10) goto L_0113;
LEND = LEND + 1;
goto L_0112;
L_0113:;
// 1023 %finish
L_0111:;
// 1024 ! Successful return from execution
// 1025 ok:
U_1012:;
// 1026 num = num-1
NUM = NUM - 1;
// 1027 -> next %if num = 0
if (NUM != 0) goto L_0114;
goto U_100F;
L_0114:;
// 1028 -> s(code)
S_line = __LINE__;
S_file = __FILE__;
S_index = CODE;
goto case_S_dispatch;
// 1029 fail:
U_1013:;
// 1030 num = 1
NUM = 1;
// 1031 ! Failure return
// 1032 no: s('\'):
U_1014:;
case_S_92:;
// 1033 %cycle
L_0115:;
// 1034 -> next %if num <= 0; !indefinite repetition ->
if (NUM > 0) goto L_0116;
goto U_100F;
L_0116:;
// 1035 ci = ci+1; !check following cell:-
CI = CI + 1;
// 1036 -> next %if r(ci)_code = '\'; !invert ->
if (R[CI - 1].CODE != 92) goto L_0117;
goto U_100F;
L_0117:;
// 1037 -> next %if r(ci)_code = '?'; !query ->
if (R[CI - 1].CODE != 63) goto L_0118;
goto U_100F;
L_0118:;
// 1038 %while r(ci)_code # ']' %cycle
L_0119:;
if (R[CI - 1].CODE == 93) goto L_011A;
// 1039 -> next %if r(ci)_code = '^'; !comma ->
if (R[CI - 1].CODE != 94) goto L_011B;
goto U_100F;
L_011B:;
// 1040 ci = r(ci)_ref %if r(ci)_code = '['
if (R[CI - 1].CODE != 91) goto L_011C;
CI = R[CI - 1].REF;
L_011C:;
// 1041 ci = ci+1
CI = CI + 1;
// 1042 %repeat
goto L_0119;
L_011A:;
// 1043 num = r(ci)_count
NUM = R[CI - 1].COUNT;
// 1044 %repeat %until ci >= cmax
if (CI >= CMAX) goto L_011D;
goto L_0115;
L_011D:;
// 1045 -> read %if num <= 0
if (NUM > 0) goto L_011E;
goto U_1002;
L_011E:;
// 1046 !
// 1047 !E x e c u t i o n e r r o r
// 1048 !
// 1049 at(winlim+1,40)
AT(WINLIM + 1, 40);
// 1050 printstring(" Failure: ")
_imp_PRINTSTRING(_imp_str_literal(" Failure: "));
// 1051 print code(code)
PRINTCODE(CODE);
// 1052 %if ref # 0 %start
if (REF == 0) goto L_011F;
// 1053 print symbol('''')
_imp_PRINTSYMBOL(39);
// 1054 %while text(ref) # 0 %cycle
L_0120:;
if (TEXT[REF - 1] == 0) goto L_0121;
// 1055 print symbol(text(ref))
_imp_PRINTSYMBOL(TEXT[REF - 1]);
// 1056 ref = ref+1
REF = REF + 1;
// 1057 %repeat
goto L_0120;
L_0121:;
// 1058 print symbol('''')
_imp_PRINTSYMBOL(39);
// 1059 %finish
L_011F:;
// 1060 %if video # 0 %then clear line %else newline
if (VIDEO == 0) goto L_0122;
CLEARLINE();
goto L_0123;
L_0122:;
_imp_NEWLINE();
L_0123:;
// 1061 ignore
IGNORE();
// 1062 -> read
goto U_1002;
// 1063
// 1064 !
// 1065 !I n d i v i d u a l c o m m a n d s
// 1066 !
// 1067 s('['): !open bracket
case_S_91:;
// 1068 r(ref)_count = num; !restore count on ']'
R[REF - 1].COUNT = NUM;
// 1069 -> next
goto U_100F;
// 1070 !
// 1071 s(']'): !close bracket
case_S_93:;
// 1072 num = num-1
NUM = NUM - 1;
// 1073 %if num # 0 %and num # stopper %start
if (NUM == 0) goto L_0124;
if (NUM == -10000) goto L_0124;
// 1074 r(ci)_count = num; !update
R[CI - 1].COUNT = NUM;
// 1075 ci = ref; !position of '['
CI = REF;
// 1076 %finish %else %start
goto L_0125;
L_0124:;
// 1077 -> read %if ci >= cmax
if (CI < CMAX) goto L_0126;
goto U_1002;
L_0126:;
// 1078 %finish
L_0125:;
// 1079 -> next
goto U_100F;
// 1080 !
// 1081 s('^'): !comma
case_S_94:;
// 1082 ci = ref-1; !position of ']' - 1
CI = REF - 1;
// 1083 -> next
goto U_100F;
// 1084 !
// 1085 s('P'):
case_S_80:;
// 1086 display
DISPLAY();
// 1087 -> ok %if num = 1
if (NUM != 1) goto L_0127;
goto U_1012;
L_0127:;
// 1088 s('M'): !Move
case_S_77:;
// 1089 -> no %if fp = flim
if (FP != FLIM) goto L_0128;
goto U_1014;
L_0128:;
// 1090 update
UPDATE();
// 1091 fp = lend+1
FP = LEND + 1;
// 1092 fp = gaplim %if fp = gaptop
if (FP != GAPTOP) goto L_0129;
FP = GAPLIM;
L_0129:;
// 1093 line = line+1
LINE = LINE + 1;
// 1094 fp = flim %and line = limline %if num = 0 %and code = 'M'
if (NUM != 0) goto L_012A;
if (CODE != 77) goto L_012A;
FP = FLIM;
LINE = LIMLINE;
L_012A:;
// 1095 lbeg = fp
LBEG = FP;
// 1096 -> lok
goto U_1011;
// 1097 !
// 1098 s('m'): !Move back
case_S_109:;
// 1099 -> no %if lbeg = newtop %or sin # 0
if (LBEG == NEWTOP) goto L_012B;
if (SIN == 0) goto L_012C;
L_012B:;
goto U_1014;
L_012C:;
// 1100 update
UPDATE();
// 1101 consolidate
CONSOLIDATE();
// 1102 mstart = 0
MSTART = 0;
// 1103 %if num = 0 %start; !M-*
if (NUM != 0) goto L_012D;
// 1104 lbeg = newtop
LBEG = NEWTOP;
// 1105 lbeg = gaplim %if lbeg = gaptop
if (LBEG != GAPTOP) goto L_012E;
LBEG = GAPLIM;
L_012E:;
// 1106 fp = lbeg
FP = LBEG;
// 1107 line = 1; num = 1
LINE = 1;
NUM = 1;
// 1108 -> lok
goto U_1011;
// 1109 %finish
L_012D:;
// 1110 %if lbeg = gaplim %start
if (LBEG != GAPLIM) goto L_012F;
// 1111 -> no %if gaptop = newtop
if (GAPTOP != NEWTOP) goto L_0130;
goto U_1014;
L_0130:;
// 1112 lbeg = gaptop
LBEG = GAPTOP;
// 1113 %finish
L_012F:;
// 1114 line = line-1; !there is a line there
LINE = LINE - 1;
// 1115 lend = lbeg-1
LEND = LBEG - 1;
// 1116 lbeg = lbeg-1 %until lbeg=gaplim %or lbeg=newtop %or byteinteger(lbeg-1)=nl
L_0131:;
LBEG = LBEG - 1;
if (LBEG == GAPLIM) goto L_0132;
if (LBEG == NEWTOP) goto L_0132;
if (*_imp_BYTEINTEGER(LBEG - 1) == 10) goto L_0132;
goto L_0131;
L_0132:;
// 1117 fp = lbeg
FP = LBEG;
// 1118 -> ok
goto U_1012;
// 1119 !
// 1120 s('C'): !Case-change with right-shift
case_S_67:;
// 1121 -> no %if fp = lend
if (FP != LEND) goto L_0133;
goto U_1014;
L_0133:;
// 1122 %if 'A' <= byteinteger(fp)&95 <= 'Z' %start
{
// Double-sided test on *_imp_BYTEINTEGER(FP) & 95 (Part I)
unsigned char tmp;
if (65 > (tmp = *_imp_BYTEINTEGER(FP) & 95)) goto L_0134;
// Double-sided test on *_imp_BYTEINTEGER(FP) & 95 (Part II)
if (tmp > 90) goto L_0134;
}
// 1123 split
SPLIT();
// 1124 byteinteger(gaptop) = byteinteger(fp)!!casebit
*_imp_BYTEINTEGER(GAPTOP) = *_imp_BYTEINTEGER(FP) ^ 32;
// 1125 gaptop = gaptop+1; gaplim = gaplim+1
GAPTOP = GAPTOP + 1;
GAPLIM = GAPLIM + 1;
// 1126 %finish
L_0134:;
// 1127 !
// 1128 s('R'): !Right-shift
case_S_82:;
// 1129 -> no %if fp = lend
if (FP != LEND) goto L_0135;
goto U_1014;
L_0135:;
// 1130 fp = fp+1
FP = FP + 1;
// 1131 -> ok
goto U_1012;
// 1132 !
// 1133 s('L'): !Left-shift
case_S_76:;
// 1134 -> no %if fp = lbeg %or sin # 0
if (FP == LBEG) goto L_0136;
if (SIN == 0) goto L_0137;
L_0136:;
goto U_1014;
L_0137:;
// 1135 consolidate %if fp = gaplim
if (FP != GAPLIM) goto L_0138;
CONSOLIDATE();
L_0138:;
// 1136 mstart = 0
MSTART = 0;
// 1137 fp = fp-1
FP = FP - 1;
// 1138 -> ok
goto U_1012;
// 1139 !
// 1140 s('E'): !Erase
case_S_69:;
// 1141 -> no %if fp = lend
if (FP != LEND) goto L_0139;
goto U_1014;
L_0139:;
// 1142 split
SPLIT();
// 1143 lbeg = lbeg+1; fp = fp+1
LBEG = LBEG + 1;
FP = FP + 1;
// 1144 gaplim = fp
GAPLIM = FP;
// 1145 -> ok
goto U_1012;
// 1146 !
// 1147 s('e'): !Erase back
case_S_101:;
// 1148 -> no %if fp = lbeg
if (FP != LBEG) goto L_013A;
goto U_1014;
L_013A:;
// 1149 split
SPLIT();
// 1150 lbeg = lbeg+1; gaptop = gaptop-1
LBEG = LBEG + 1;
GAPTOP = GAPTOP - 1;
// 1151 changemin = gaptop %if gaptop < changemin
if (GAPTOP >= CHANGEMIN) goto L_013B;
CHANGEMIN = GAPTOP;
L_013B:;
// 1152 -> ok
goto U_1012;
// 1153 !
// 1154 s('V'): !Verify
case_S_86:;
// 1155 -> no %if fp = lend
if (FP != LEND) goto L_013C;
goto U_1014;
L_013C:;
// 1156 -> no %if (byteinteger(fp)!!text(ref))&casemask # 0; !quick check
if ((*_imp_BYTEINTEGER(FP) ^ TEXT[REF - 1]) & CASEMASK == 0) goto L_013D;
goto U_1014;
L_013D:;
// 1157 -> no %if matched = 0
if (MATCHED() != 0) goto L_013E;
goto U_1014;
L_013E:;
// 1158 -> next
goto U_100F;
// 1159 !
// 1160 s('D'): !Delete
case_S_68:;
// 1161 s('T'): !+ Traverse
case_S_84:;
// 1162 fp1 = fp
FP1 = FP;
// 1163 -> find
goto U_1015;
// 1164 !
// 1165 s('F'): !Find
case_S_70:;
// 1166 s('U'): !+ Uncover
case_S_85:;
// 1167 fp1 = fp
FP1 = FP;
// 1168 fp = fp+1 %if fp = mstart
if (FP != MSTART) goto L_013F;
FP = FP + 1;
L_013F:;
// 1169 find:
U_1015:;
// 1170 scope = r(ci)_scope; !number of lines to search
SCOPE = R[CI - 1].SCOPE;
// 1171 sym1 = text(ref); !first symbol of quoted text
SYM1 = TEXT[REF - 1];
// 1172 %while fp # flim %cycle
L_0140:;
if (FP == FLIM) goto L_0141;
// 1173 %while byteinteger(fp) # nl %cycle
L_0142:;
if (*_imp_BYTEINTEGER(FP) == 10) goto L_0143;
// 1174 %if (byteinteger(fp)!!sym1)&casemask = 0 %start
if ((*_imp_BYTEINTEGER(FP) ^ SYM1) & CASEMASK != 0) goto L_0144;
// 1175 -> found %if matched # 0
if (MATCHED() == 0) goto L_0145;
goto U_1016;
L_0145:;
// 1176 %finish
L_0144:;
// 1177 fp = fp+1
FP = FP + 1;
// 1178 %repeat
goto L_0142;
L_0143:;
// 1179 lend = fp
LEND = FP;
// 1180 scope = scope-1
SCOPE = SCOPE - 1;
// 1181 %exit %if scope = 0
if (SCOPE != 0) goto L_0146;
goto L_0141;
L_0146:;
// 1182 %if code # 'U' %start
if (CODE == 85) goto L_0147;
// 1183 update
UPDATE();
// 1184 fp = fp+1
FP = FP + 1;
// 1185 fp = gaplim %if fp = gaptop
if (FP != GAPTOP) goto L_0148;
FP = GAPLIM;
L_0148:;
// 1186 lbeg = fp
LBEG = FP;
// 1187 line = line+1
LINE = LINE + 1;
// 1188 %finish %else %start
goto L_0149;
L_0147:;
// 1189 fp = fp1; join
FP = FP1;
JOIN();
// 1190 %finish
L_0149:;
// 1191 fp1 = fp
FP1 = FP;
// 1192 %repeat
goto L_0140;
L_0141:;
// 1193 lend = fp; fp = fp1
LEND = FP;
FP = FP1;
// 1194 -> no
goto U_1014;
// 1195 found:
U_1016:;
// 1196 %if code = 'D' %start
if (CODE != 68) goto L_014A;
// 1197 split
SPLIT();
// 1198 lbeg = lbeg+msize; fp = fp+msize
LBEG = LBEG + MSIZE;
FP = FP + MSIZE;
// 1199 gaplim = fp
GAPLIM = FP;
// 1200 %finish
L_014A:;
// 1201 fp = fp+msize %if code = 'T'
if (CODE != 84) goto L_014B;
FP = FP + MSIZE;
L_014B:;
// 1202 %if code = 'U' %start
if (CODE != 85) goto L_014C;
// 1203 i = fp-fp1; fp = fp1
I = FP - FP1;
FP = FP1;
// 1204 split
SPLIT();
// 1205 lbeg = lbeg+i; fp = fp+i
LBEG = LBEG + I;
FP = FP + I;
// 1206 gaplim = fp
GAPLIM = FP;
// 1207 %finish
L_014C:;
// 1208 -> lok
goto U_1011;
// 1209 !
// 1210 s('f'): !Find back
case_S_102:;
// 1211 scope = r(ci)_scope
SCOPE = R[CI - 1].SCOPE;
// 1212 update
UPDATE();
// 1213 consolidate
CONSOLIDATE();
// 1214 %cycle
L_014D:;
// 1215 %while fp # lbeg %cycle
L_014E:;
if (FP == LBEG) goto L_014F;
// 1216 fp = fp-1
FP = FP - 1;
// 1217 -> ok %if matched # 0
if (MATCHED() == 0) goto L_0150;
goto U_1012;
L_0150:;
// 1218 %repeat
goto L_014E;
L_014F:;
// 1219 scope = scope-1
SCOPE = SCOPE - 1;
// 1220 -> no %if scope = 0 %or fp = newtop
if (SCOPE == 0) goto L_0151;
if (FP != NEWTOP) goto L_0152;
L_0151:;
goto U_1014;
L_0152:;
// 1221 %if fp = gaplim %start
if (FP != GAPLIM) goto L_0153;
// 1222 -> no %if gaptop = newtop
if (GAPTOP != NEWTOP) goto L_0154;
goto U_1014;
L_0154:;
// 1223 fp = gaptop
FP = GAPTOP;
// 1224 %finish
L_0153:;
// 1225 lbeg = fp
LBEG = FP;
// 1226 fp = fp-1; lend = fp
FP = FP - 1;
LEND = FP;
// 1227 line = line-1
LINE = LINE - 1;
// 1228 lbeg = lbeg-1 %until lbeg=gaplim %or lbeg=newtop %or byteinteger(lbeg-1)=nl
L_0155:;
LBEG = LBEG - 1;
if (LBEG == GAPLIM) goto L_0156;
if (LBEG == NEWTOP) goto L_0156;
if (*_imp_BYTEINTEGER(LBEG - 1) == 10) goto L_0156;
goto L_0155;
L_0156:;
// 1229 %repeat
goto L_014D;
// 1230 !
// 1231 s('S'): !Substitute
case_S_83:;
// 1232 -> no %if fp # mstart
if (FP == MSTART) goto L_0157;
goto U_1014;
L_0157:;
// 1233 split
SPLIT();
// 1234 lbeg = lbeg+msize; fp = fp+msize
LBEG = LBEG + MSIZE;
FP = FP + MSIZE;
// 1235 gaplim = fp
GAPLIM = FP;
// 1236 !
// 1237 s('I'): !+Insert
case_S_73:;
// 1238 -> ok %if text(ref) = 0
if (TEXT[REF - 1] != 0) goto L_0158;
goto U_1012;
L_0158:;
// 1239 -> no %if fp-lbeg > width %or fp = flim
if (FP - LBEG > WIDTH) goto L_0159;
if (FP != FLIM) goto L_015A;
L_0159:;
goto U_1014;
L_015A:;
// 1240 split
SPLIT();
// 1241 j = ref
J = REF;
// 1242 %cycle
L_015B:;
// 1243 byteinteger(gaptop) = text(j)
*_imp_BYTEINTEGER(GAPTOP) = TEXT[J - 1];
// 1244 gaptop = gaptop+1; j = j+1
GAPTOP = GAPTOP + 1;
J = J + 1;
// 1245 %repeat %until text(j) = 0
if (TEXT[J - 1] == 0) goto L_015C;
goto L_015B;
L_015C:;
// 1246 lbeg = lbeg-(j-ref)
LBEG = LBEG - (J - REF);
// 1247 -> ok
goto U_1012;
// 1248 !
// 1249 s('G'): !Get (line from terminal)
case_S_71:;
// 1250 -> no %if sin # 0 %and fp # lbeg
if (SIN == 0) goto L_015D;
if (FP == LBEG) goto L_015D;
goto U_1014;
L_015D:;
// 1251 consolidate
CONSOLIDATE();
// 1252 fp = lbeg
FP = LBEG;
// 1253 split
SPLIT();
// 1254 %if video # 0 %start
if (VIDEO == 0) goto L_015E;
// 1255 %if video < 0 %start
if (VIDEO >= 0) goto L_015F;
// 1256 display
DISPLAY();
// 1257 fprow = line-winline+wintop
FPROW = LINE - WINLINE + WINTOP;
// 1258 delete line(winlim)
DELETELINE(WINLIM);
// 1259 insert line(fprow)
INSERTLINE(FPROW);
// 1260 %finish %else %start
goto L_0160;
L_015F:;
// 1261 byteinteger(gaptop) = nl; gaptop = gaptop+1
*_imp_BYTEINTEGER(GAPTOP) = 10;
GAPTOP = GAPTOP + 1;
// 1262 breaks = breaks+1
BREAKS = BREAKS + 1;
// 1263 line = line+1; limline = limline+1
LINE = LINE + 1;
LIMLINE = LIMLINE + 1;
// 1264 update
UPDATE();
// 1265 fp = gaptop-1; lbeg = fp
FP = GAPTOP - 1;
LBEG = FP;
// 1266 line = line-1
LINE = LINE - 1;
// 1267 display
DISPLAY();
// 1268 fprow = line-winline+wintop
FPROW = LINE - WINLINE + WINTOP;
// 1269 gaptop = gaptop-1
GAPTOP = GAPTOP - 1;
// 1270 fp = gaplim; lbeg = fp
FP = GAPLIM;
LBEG = FP;
// 1271 limline = limline-1
LIMLINE = LIMLINE - 1;
// 1272 at(fprow,0)
AT(FPROW, 0);
// 1273 %finish
L_0160:;
// 1274 !*WIN32C* NEWLINE; !*VAX*
// 1275 %finish
L_015E:;
// 1276 prompt(gprom)
_imp_PROMPT(
/* clang-format off */
*({ __typeof__(_imp_string15) tmp = GPROM/*q*/; (_imp_string15 *)&tmp; })
/* clang-format on */
);
// 1277 read sym
READSYM();
// 1278 vrow = 999
VROW = 999;
// 1279 %if sym = ':' %start
if (SYM != 58) goto L_0161;
// 1280 read sym %until sym = nl
L_0162:;
READSYM();
if (SYM == 10) goto L_0163;
goto L_0162;
L_0163:;
// 1281 %if video # 0 %start
if (VIDEO == 0) goto L_0164;
// 1282 %if video < 0 %start
if (VIDEO >= 0) goto L_0165;
// 1283 delete line(fprow)
DELETELINE(FPROW);
// 1284 insert line(winlim)
INSERTLINE(WINLIM);
// 1285 %finish %else %start
goto L_0166;
L_0165:;
// 1286 changemin = gaptop; changelbeg = lbeg
CHANGEMIN = GAPTOP;
CHANGELBEG = LBEG;
// 1287 joins = joins+1
JOINS = JOINS + 1;
// 1288 %finish
L_0166:;
// 1289 %finish
L_0164:;
// 1290 -> no
goto U_1014;
// 1291 %finish
L_0161:;
// 1292 line = line+1; limline = limline+1
LINE = LINE + 1;
LIMLINE = LIMLINE + 1;
// 1293 %cycle
L_0167:;
// 1294 byteinteger(gaptop) = sym; gaptop = gaptop+1
*_imp_BYTEINTEGER(GAPTOP) = SYM;
GAPTOP = GAPTOP + 1;
// 1295 %exit %if sym = nl
if (SYM != 10) goto L_0168;
goto L_0169;
L_0168:;
// 1296 read sym
READSYM();
// 1297 %repeat
goto L_0167;
L_0169:;
// 1298 %if video < 0 %and fprow = winbot %start; !bring back
if (VIDEO >= 0) goto L_016A;
if (FPROW != WINBOT) goto L_016A;
// 1299 delete line(zrow)
DELETELINE(ZROW);
// 1300 %if wintop > zrow %then wintop = wintop-1 %else winline = winline+1
if (WINTOP <= ZROW) goto L_016B;
WINTOP = WINTOP - 1;
goto L_016C;
L_016B:;
WINLINE = WINLINE + 1;
L_016C:;
// 1301 insert line(winlim)
INSERTLINE(WINLIM);
// 1302 %finish
L_016A:;
// 1303 -> ok
goto U_1012;
// 1304 !
// 1305 s('B'): !Break
case_S_66:;
// 1306 num = 66 %if num = 0 %or num > 66
if (NUM == 0) goto L_016D;
if (NUM <= 66) goto L_016E;
L_016D:;
NUM = 66;
L_016E:;
// 1307 split
SPLIT();
// 1308 break:
U_1017:;
// 1309 byteinteger(gaptop) = nl; gaptop = gaptop+1
*_imp_BYTEINTEGER(GAPTOP) = 10;
GAPTOP = GAPTOP + 1;
// 1310 breaks = breaks+1
BREAKS = BREAKS + 1;
// 1311 line = line+1; limline = limline+1
LINE = LINE + 1;
LIMLINE = LIMLINE + 1;
// 1312 lbeg = fp
LBEG = FP;
// 1313 -> ok
goto U_1012;
// 1314 !
// 1315 s('K'): !Kill
case_S_75:;
// 1316 -> no %if fp = flim
if (FP != FLIM) goto L_016F;
goto U_1014;
L_016F:;
// 1317 fp = lbeg
FP = LBEG;
// 1318 join
JOIN();
// 1319 -> lok
goto U_1011;
// 1320 !
// 1321 s('J'): !Join
case_S_74:;
// 1322 fp = lend
FP = LEND;
// 1323 -> no %if fp = flim %or fp-lbeg > width
if (FP == FLIM) goto L_0170;
if (FP - LBEG <= WIDTH) goto L_0171;
L_0170:;
goto U_1014;
L_0171:;
// 1324 join
JOIN();
// 1325 -> lok
goto U_1011;
// 1326 !
// 1327 s('A'): !Adjust
case_S_65:;
// 1328 -> s('M') %if lend = lbeg
if (LEND != LBEG) goto L_0172;
S_line = __LINE__;
S_file = __FILE__;
S_index = 77;
goto case_S_dispatch;
L_0172:;
// 1329 consolidate
CONSOLIDATE();
// 1330 %while lend-lbeg <= width %cycle
L_0173:;
if (LEND - LBEG > WIDTH) goto L_0174;
// 1331 fp = lend+1
FP = LEND + 1;
// 1332 %if fp = gaptop %start
if (FP != GAPTOP) goto L_0175;
// 1333 fp = gaplim; lbeg = lbeg+(gaplim-gaptop)
FP = GAPLIM;
LBEG = LBEG + (GAPLIM - GAPTOP);
// 1334 %finish
L_0175:;
// 1335 lend = fp
LEND = FP;
// 1336 lend = lend+1 %while lend # flim %and byteinteger(lend) # nl
L_0176:;
if (LEND == FLIM) goto L_0177;
if (*_imp_BYTEINTEGER(LEND) == 10) goto L_0177;
LEND = LEND + 1;
goto L_0176;
L_0177:;
// 1337 %if fp = lend %or byteinteger(fp) = ' ' %start
if (FP == LEND) goto L_0178;
if (*_imp_BYTEINTEGER(FP) != 32) goto L_0179;
L_0178:;
// 1338 update
UPDATE();
// 1339 lbeg = fp; line = line+1
LBEG = FP;
LINE = LINE + 1;
// 1340 ->no
goto U_1014;
// 1341 %finish
L_0179:;
// 1342 split
SPLIT();
// 1343 byteinteger(gaptop-1) = ' '
*_imp_BYTEINTEGER(GAPTOP - 1) = 32;
// 1344 changemin = gaptop-1 %if changemin >= gaptop
if (CHANGEMIN < GAPTOP) goto L_017A;
CHANGEMIN = GAPTOP - 1;
L_017A:;
// 1345 joins = joins+1; limline = limline-1
JOINS = JOINS + 1;
LIMLINE = LIMLINE - 1;
// 1346 %repeat
goto L_0173;
L_0174:;
// 1347 consolidate
CONSOLIDATE();
// 1348 fp = lbeg+width+1
FP = LBEG + WIDTH + 1;
// 1349 %cycle
L_017B:;
// 1350 fp = fp-1
FP = FP - 1;
// 1351 -> no %if fp = lbeg
if (FP != LBEG) goto L_017C;
goto U_1014;
L_017C:;
// 1352 %repeat %until byteinteger(fp) = ' '
if (*_imp_BYTEINTEGER(FP) == 32) goto L_017D;
goto L_017B;
L_017D:;
// 1353 split
SPLIT();
// 1354 fp = fp+1
FP = FP + 1;
// 1355 gaplim = fp
GAPLIM = FP;
// 1356 -> break
goto U_1017;
// 1357 !
// 1358 !
// 1359 s('@'): !'at' Column NUM
case_S_64:;
// 1360 -> fail %if lend = flim
if (LEND != FLIM) goto L_017E;
goto U_1013;
L_017E:;
// 1361 i = width-(lend-fp)
I = WIDTH - (LEND - FP);
// 1362 num = i %if i < num
if (I >= NUM) goto L_017F;
NUM = I;
L_017F:;
// 1363 i = fp-lbeg-num
I = FP - LBEG - NUM;
// 1364 -> next %if i = 0
if (I != 0) goto L_0180;
goto U_100F;
L_0180:;
// 1365 split
SPLIT();
// 1366 %cycle
L_0181:;
// 1367 %if i < 0 %start; !left of it
if (I >= 0) goto L_0182;
// 1368 byteinteger(gaptop) = ' '; gaptop = gaptop+1
*_imp_BYTEINTEGER(GAPTOP) = 32;
GAPTOP = GAPTOP + 1;
// 1369 lbeg = lbeg-1; i = i+1
LBEG = LBEG - 1;
I = I + 1;
// 1370 %finish %else %start
goto L_0183;
L_0182:;
// 1371 -> fail %if fp = lbeg %or byteinteger(gaptop-1) # ' '
if (FP == LBEG) goto L_0184;
if (*_imp_BYTEINTEGER(GAPTOP - 1) == 32) goto L_0185;
L_0184:;
goto U_1013;
L_0185:;
// 1372 gaptop = gaptop-1; lbeg = lbeg+1
GAPTOP = GAPTOP - 1;
LBEG = LBEG + 1;
// 1373 changemin = gaptop %if gaptop < changemin
if (GAPTOP >= CHANGEMIN) goto L_0186;
CHANGEMIN = GAPTOP;
L_0186:;
// 1374 i = i-1
I = I - 1;
// 1375 %finish
L_0183:;
// 1376 %repeat %until i = 0
if (I == 0) goto L_0187;
goto L_0181;
L_0187:;
// 1377 -> next
goto U_100F;
// 1378 s('$'): !switch inputs
case_S_36:;
// 1379 switch
SWITCH();
// 1380 -> next
goto U_100F;
// 1381 %end; !END OF EDI
case_C_dispatch:
if (C_index < 4 || C_index > 15)
_imp_signalf(6, 3, C_index, "->C(%d) out of bounds at %s line %d", C_index, C_file, C_line);
goto *C[C_index - 4];
case_PC_dispatch:
if (PC_index < 0 || PC_index > 7)
_imp_signalf(6, 3, PC_index, "->PC(%d) out of bounds at %s line %d", PC_index, PC_file, PC_line);
goto *PC[PC_index - 0];
case_S_dispatch:
if (S_index < 36 || S_index > 112)
_imp_signalf(6, 3, S_index, "->S(%d) out of bounds at %s line %d", S_index, S_file, S_line);
goto *S[S_index - 36];
case_S_missing:
_imp_signalf(8, 2, S_index, "switch jump to undefined label S(%d): at %s line %d", S_index, S_file, S_line);
} /* end of EDI */
// 1382
// 1383 !*MOUSES* !System-specific stuff
// 1384 !*MOUSES* %include "sysinc:command.inc" {to access user command line}
// 1385 !*MOUSES*
// 1386 !*MOUSES* %RECORD %FORMAT PARM FM (%SHORT DSNO,DACT,SSNO,SACT,
// 1387 !*MOUSES* %INTEGER P1,P2,P3,P4,P5,P6)
// 1388 !*MOUSES* %RECORD(PARM FM) P
// 1389 !*MOUSES* %CONST %INTEGER TT NO WIDTH = X'80'; !INHIBIT LINE BREAK PATTERN
// 1390 !*MOUSES* %CONST %INTEGER TT NO PAGE = X'40'; !INHIBIT PAGE WAIT PATTERN
// 1391 !*MOUSES* %CONST %INTEGER TT ERASE = X'20'; !VIDEO DELETE ENABLED?
// 1392 !*MOUSES* %CONST %INTEGER TT TABS = X'40000'; !TAB STOPS OR 3-SPACES?
// 1393 !*MOUSES* %INTEGER OLD TT; !HOLD CONSOLE STATE BITS DURING EDIT
// 1394 !*MOUSES* %CONST %INTEGER CACHE SIZE = 12; !BLOCKS
// 1395 !*MOUSES* %CONST %INTEGER PAGING FILE = 1; !DA CHANNEL
// 1396 !*MOUSES* %OWN %STRING(31) PAGE FILE NAME
// 1397 !*MOUSES* %STRING(3) %FN UNIQUE EXTENSION
// 1398 !*MOUSES* %RECORD(PARMFM) P
// 1399 !*MOUSES* %STRING(31)%NAME SN
// 1400 !*MOUSES* P_DACT = 25; SVC (20,P); !PACKED UNIQUE FILENAME
// 1401 !*MOUSES* P_P4 = P_P4&X'FFFF'; !LEAVE EXTENSION
// 1402 !*MOUSES* SVC (18,P); !UNPACK
// 1403 !*MOUSES* SN == STRING(ADDR(P_SACT)); ! => STRING RESULT
// 1404 !*MOUSES* %RESULT = SUBSTRING(SN,2,LENGTH(SN)); !KILL "."
// 1405 !*MOUSES* %END
// 1406 !*MOUSES* PAGE FILE NAME = "$ECCE.".UNIQUE EXTENSION
// 1407 !*MOUSES* %OWN %INTEGER MAX BLOCK = 400; !DEFAULT SIZE OF DA FILE
// 1408 !*MOUSES*
// 1409 !*MOUSES* %RECORD %FORMAT BLOCKFM(%BYTE %ARRAY B(0:511))
// 1410 !*MOUSES* %EXTERNAL %PREDICATE %SPEC EXISTS (%STRING(31) FILENAME)
// 1411 !*MOUSES* %EXTERNAL %ROUTINE %SPEC OPEN DA (%INTEGER CHAN,PROT,%STRING(31) FILENAME)
// 1412 !*MOUSES* %EXTERNAL %ROUTINE %SPEC RENAME FILE (%STRING(31) OLDNAME, NEWNAME)
// 1413 !*MOUSES* %EXTERNAL %ROUTINE %SPEC CREATE FILE (%STRING(31) FILENAME, %INTEGER BLOCKS,
// 1414 !*MOUSES* %INTEGERNAME ACTUAL); !RETURN ALLOC
// 1415 !*MOUSES* %EXTERNAL %ROUTINE %SPEC DELETE FILE (%STRING(31) FILENAME)
// 1416 !*MOUSES* %EXTERNAL %ROUTINE %SPEC READ DA(%INTEGER CHAN,BLOCK, %NAME BUFFER)
// 1417 !*MOUSES* %EXTERNAL %ROUTINE %SPEC WRITE DA(%INTEGER CHAN,BLOCK, %NAME BUFFER)
// 1418 !*MOUSES* %EXTERNAL %ROUTINE %SPEC EXTENDDA(%INTEGER CHAN,BLOCKS,%INTEGERNAME NEW SIZE)
// 1419 !*MOUSES* %EXTERNAL %ROUTINE %SPEC CLOSE DA(%INTEGER CHAN)
// 1420 !*MOUSES*
// 1421 !*MOUSES*
// 1422 !*MOUSES* %RECORD %FORMAT BUF FM (%INTEGER BLOCK,
// 1423 !*MOUSES* %RECORD(BUF FM)%NAME LINK,
// 1424 !*MOUSES* %RECORD(BLOCK FM) BLK)
// 1425 !*MOUSES*
// 1426 !*MOUSES* %RECORD(BUF FM) %ARRAY BUFFER(1:CACHE SIZE)
// 1427 !*MOUSES* %RECORD(BUF FM) %NAME BUF
// 1428 !*MOUSES*
// 1429 !*MOUSES* %ROUTINE FLUSH BUFFERS
// 1430 !*MOUSES* %RECORD(BUFFM)%NAME B
// 1431 !*MOUSES* %INTEGER J
// 1432 !*MOUSES* %FOR J = 1,1,CACHE SIZE %CYCLE
// 1433 !*MOUSES* B == BUFFER(J)
// 1434 !*MOUSES* %IF B_BLOCK >= 0 %START; !VALID?
// 1435 !*MOUSES* WRITE DA (PAGING FILE,B_BLOCK,B_BLK)
// 1436 !*MOUSES* B_BLOCK = -1; !INVALIDATE
// 1437 !*MOUSES* %FINISH
// 1438 !*MOUSES* %REPEAT
// 1439 !*MOUSES* %END
// 1440 !*MOUSES*
// 1441 !*MOUSES* !INITIALISATION
// 1442 !*MOUSES*
// 1443 !*MOUSES* DELETE FILE(PAGE FILE NAME) %IF EXISTS(PAGE FILE NAME)
// 1444 !*MOUSES* CREATE FILE(PAGE FILE NAME,MAX BLOCK,MAX BLOCK)
// 1445 !*MOUSES* OPEN DA (PAGING FILE,1,PAGE FILE NAME)
// 1446 SELECT INPUT (0); SELECT OUTPUT (0)
_imp_SELECTINPUT(0);
_imp_SELECTOUTPUT(0);
// 1447 !*MOUSES*
// 1448 !*MOUSES* %INTEGER WHICH
// 1449 !*MOUSES* %FOR WHICH = 1,1,CACHE SIZE %CYCLE; !INITIALISE CACHE LIST
// 1450 !*MOUSES* BUF == BUFFER(WHICH)
// 1451 !*MOUSES* BUF_BLOCK = -1; !MARK AS NOT IN USE
// 1452 !*MOUSES* %IF WHICH # 1 %THEN BUF_LINK == BUFFER(WHICH-1) %C
// 1453 !*MOUSES* %ELSE BUF_LINK == BUFFER(CACHE SIZE); !SET UP CIRCULAR LIST
// 1454 !*MOUSES* %REPEAT
// 1455 !*MOUSES*
// 1456 !*MOUSES* %OWN %INTEGER FREE = 1; !FIRST USABLE PSEUDO-ADDRESS
// 1457 !*MOUSES*
// 1458 !*MOUSES* %INTEGERFN TERMTYPE { *** configuration dependent ***}
// 1459 !*MOUSES* %CONST %INTEGER CONSOLES = 15
// 1460 !*MOUSES* %CONST %INTEGER %ARRAY TT TYPE(0:CONSOLES) =
// 1461 !*MOUSES* HARDCOPY(9),; !0..8
// 1462 !*MOUSES* VC404,; !9 (In machine room)
// 1463 !*MOUSES* VC404,; !10 (John's VC404)
// 1464 !*MOUSES* VT100 {PE550},; !11 (Chris's Bantam)
// 1465 !*MOUSES* HARDCOPY(*)
// 1466 !*MOUSES* %RECORD(PARM FM) P
// 1467 !*MOUSES* %INTEGER TT
// 1468 !*MOUSES* P_P1 = 0; !ME
// 1469 !*MOUSES* SVC (14,P); !GET PROCESS INFO
// 1470 !*MOUSES* TT = TT TYPE(P_P6)
// 1471 !*MOUSES* !! P_P2 = 0; !MY TTY
// 1472 !*MOUSES* !! P_P1 = 10
// 1473 !*MOUSES* !! P_P3 = TT NO PAGE + TT ERASE + TT NO WIDTH + TT TABS
// 1474 !*MOUSES* !! SVC (29,P)
// 1475 !*MOUSES* !! OLD TT = P_P4; !REMEMBER WHAT IT WAS BEFORE
// 1476 !*MOUSES* %RESULT = TT
// 1477 !*MOUSES* %END
// 1478 !*MOUSES*
// 1479 !*MOUSES* %BYTEINTEGERMAP BYTEINTEGER(%INTEGER PSADDR); !PSEUDO ADDRESS
// 1480 !*MOUSES* ! Map pseudo address into a <block,byte> pair. (Block
// 1481 !*MOUSES* ! may be in a DA file or in an LRU cache list).
// 1482 !*MOUSES* PSADDR = PSADDR-1; !SO THAT FIRST BYTE IN FILE IS USED
// 1483 !*MOUSES* %INTEGER BLOCK = PSADDR>>9, OFFSET = PSADDR&511
// 1484 !*MOUSES* %RECORD(BUFFM)%NAME PREV,P
// 1485 !*MOUSES* P == BUF_LINK; !HEAD OF CACHE LIST
// 1486 !*MOUSES* %CYCLE
// 1487 !*MOUSES* %IF P_BLOCK = BLOCK %START; !REQUIRED BYTE MAPPED IN THIS BLOCK?
// 1488 !*MOUSES* !YES: PROMOTE THIS BUFFER TO HEAD OF THE LIST
// 1489 !*MOUSES* %IF P == BUF %START; !TAIL BECOMES HEAD (CIRCULAR LIST)
// 1490 !*MOUSES* BUF == PREV
// 1491 !*MOUSES* %ELSE %IF P ## BUF_LINK; !ALREADY HEAD?
// 1492 !*MOUSES* PREV_LINK == P_LINK
// 1493 !*MOUSES* P_LINK == BUF_LINK
// 1494 !*MOUSES* BUF_LINK == P
// 1495 !*MOUSES* %FINISH
// 1496 !*MOUSES* %RESULT == P_BLK_B(OFFSET)
// 1497 !*MOUSES* %FINISH
// 1498 !*MOUSES* %EXIT %IF P == BUF
// 1499 !*MOUSES* PREV == P
// 1500 !*MOUSES* P == P_LINK
// 1501 !*MOUSES* %REPEAT
// 1502 !*MOUSES* !BLOCK NOT IN THE CACHE - REPLACE LRU BLOCK (TAIL OF LIST)
// 1503 !*MOUSES* %IF BUF_BLOCK >= 0 %START; !LAST BUFFER IN USE ALREADY?
// 1504 !*MOUSES* WRITE DA (PAGING FILE, BUF_BLOCK, BUF_BLK); !WRITE OUT TO DISC
// 1505 !*MOUSES* %FINISH
// 1506 !*MOUSES* !PROMOTE LAST BUFFER (NOW MRU).
// 1507 !*MOUSES* BUF == PREV
// 1508 !*MOUSES* P_BLOCK = BLOCK
// 1509 !*MOUSES* READ DA (PAGING FILE, BLOCK, P_BLK)
// 1510 !*MOUSES* %RESULT == P_BLK_B(OFFSET)
// 1511 !*MOUSES* %END
// 1512
// 1513 %ROUTINE MOVE(%INTEGER LENGTH,FROM,TO)
void MOVE(int LENGTH, int FROM, int TO) {
// 1514 %RETURN %IF FROM = TO
if (FROM != TO) goto L_0188;
return;
L_0188:;
// 1515 %IF TO <= FROM %START
if (TO > FROM) goto L_0189;
// 1516 %WHILE LENGTH > 0 %CYCLE
L_018A:;
if (LENGTH <= 0) goto L_018B;
// 1517 BYTEINTEGER(TO) = BYTEINTEGER(FROM)
*_imp_BYTEINTEGER(TO) = *_imp_BYTEINTEGER(FROM);
// 1518 FROM = FROM+1
FROM = FROM + 1;
// 1519 TO = TO+1
TO = TO + 1;
// 1520 LENGTH = LENGTH-1
LENGTH = LENGTH - 1;
// 1521 %REPEAT
goto L_018A;
L_018B:;
// 1522 %ELSE; !MOVE FROM BACK TO FRONT
goto L_018C;
L_0189:;
// 1523 FROM = FROM+LENGTH
FROM = FROM + LENGTH;
// 1524 TO = TO+LENGTH
TO = TO + LENGTH;
// 1525 %WHILE LENGTH > 0 %CYCLE
L_018D:;
if (LENGTH <= 0) goto L_018E;
// 1526 FROM = FROM-1
FROM = FROM - 1;
// 1527 TO = TO-1
TO = TO - 1;
// 1528 BYTEINTEGER(TO) = BYTEINTEGER(FROM)
*_imp_BYTEINTEGER(TO) = *_imp_BYTEINTEGER(FROM);
// 1529 LENGTH = LENGTH-1
LENGTH = LENGTH - 1;
// 1530 %REPEAT
goto L_018D;
L_018E:;
// 1531 %FINISH
L_018C:;
// 1532 %END
return;
} /* end of MOVE */
// 1533
// 1534 %ROUTINE CONNECT INPUT(%RECORD(FILE)%NAME F)
void CONNECTINPUT(struct FILE * F) {
// 1535 %EXTERNAL %ROUTINE %SPEC FREE(%INTEGER A)
extern void FREE(int A);
// 1536 %EXTERNAL %INTEGER %FN %SPEC READIN(%INTEGER FNAME ADDR, EXTRA,
extern int READIN(int FNAMEADDR, int EXTRA, int *BASE, int *TOP, int *FEND, int *LIMIT);
// 1537+ %INTEGER %NAME BASE, TOP, FEND, LIMIT)
// 1538 %STRING(MAXNAME) FNAME
_imp_string255 FNAME;
// 1539 FREE(F_VMTOP) %IF F_VMTOP # 0; !RE-USE SECONDARY FILE SPACE
if (F->VMTOP == 0) goto L_018F;
FREE(F->VMTOP);
L_018F:;
// 1540 FNAME = F_NAME.TOSTRING(0); !APPEND C STRING TERMINATOR
/* clang-format off */
_imp_strncpy(/*?*/&FNAME, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/&F->NAME, ({__typeof__(_imp_string1) tmp; /*E*/ tmp = _imp_TOSTRING(0); (void *)&tmp;})); (_imp_string255 *)&tmp;}); (void *)&tmp;}), /*max:*/255);
/* clang-format on */
// 1541 F_FLAG = READIN(ADDR(FNAME)+1, F_FLAG, F_VMTOP, F_TOP, F_LIM, F_VMLIM)
F->FLAG =
READIN(_imp_ADDR(/*?*/ &FNAME) + 1, F->FLAG, /*?*/ &F->VMTOP, /*?*/ &F->TOP, /*?*/ &F->LIM, /*?*/ &F->VMLIM);
// 1542 !D! PRINTSTRING("READIN returned "); WRITE(F_FLAG, 0); NEWLINE
// 1543 %IF F_FLAG # 0 %START
if (F->FLAG == 0) goto L_0190;
// 1544 F_VMTOP = 0; F_TOP = 0; F_LIM = 0
F->VMTOP = 0;
F->TOP = 0;
F->LIM = 0;
// 1545 %FINISH
L_0190:;
// 1546 ! Ensure that file does not end with partial line
// 1547 F_LIM = F_LIM-1 %WHILE F_LIM # F_TOP %AND BYTEINTEGER(F_LIM-1)#NL
L_0191:;
if (F->LIM == F->TOP) goto L_0192;
if (*_imp_BYTEINTEGER(F->LIM - 1) == 10) goto L_0192;
F->LIM = F->LIM - 1;
goto L_0191;
L_0192:;
// 1548 %END
return;
} /* end of CONNECTINPUT */
// 1549
// 1550 !*MOUSES* %ROUTINE CONNECT INPUT(%RECORD(FILE)%NAME F)
// 1551 !*MOUSES* %RECORD(BLOCKFM) BLOCK
// 1552 !*MOUSES* %INTEGER BUFFER = ADDR(BLOCK), SYM, J, KEY
// 1553 !*MOUSES* %RECORD(PARMFM) P
// 1554 !*MOUSES* %ON 9 %START
// 1555 !*MOUSES* ->EOF
// 1556 !*MOUSES* %FINISH
// 1557 !*MOUSES* FREE = F_VMTOP %IF F_VMTOP # 0; !REUSE SECONDARY FILE SPACE
// 1558 !*MOUSES* FREE = FREE-1; !PSADDR => BYTE ADDR IN FILE
// 1559 !*MOUSES* FREE = FREE+1 %WHILE FREE&511 # 0; !=> BLOCK BOUNDARY
// 1560 !*MOUSES* J = FREE>>9; !REMEMBER BLOCK NO
// 1561 !*MOUSES* FREE = FREE+1; !FILE BYTE ADDR (0-N) => PSADDR
// 1562 !*MOUSES* F_VMTOP = FREE
// 1563 !*MOUSES* FREE = FREE+512*F_FLAG; J = J + F_FLAG
// 1564 !*MOUSES* F_TOP = FREE
// 1565 !*MOUSES* F_FLAG = 0; !OK
// 1566 !*MOUSES* -> EOF %IF F_NAME = ""
// 1567 !*MOUSES* %IF EXISTS(F_NAME) %START; !QUICK LOAD FROM DISC
// 1568 !*MOUSES* FLUSH BUFFERS; !MAKE CHANGES TO FILE VALID
// 1569 !*MOUSES* STRING(ADDR(P_SACT)) = F_NAME
// 1570 !*MOUSES* SVC (17,P); !PACK
// 1571 !*MOUSES* P_DACT = 4; SVC (20,P); !OPEN SEQUENTIAL INPUT
// 1572 !*MOUSES* KEY = P_P5
// 1573 !*MOUSES* %CYCLE
// 1574 !*MOUSES* P_P5 = KEY; P_P4 = BUFFER
// 1575 !*MOUSES* P_DACT = 7; SVC(20,P); !READ SEQUENTIAL BLOCK
// 1576 !*MOUSES* WRITE DA (PAGING FILE,J,RECORD(BUFFER))
// 1577 !*MOUSES* FREE = FREE+512; J = J + 1
// 1578 !*MOUSES* %REPEAT %UNTIL P_P6 # 0; !LAST BLOCK?
// 1579 !*MOUSES* P_P5 = KEY; P_DACT = 11; !CLOSE FILE
// 1580 !*MOUSES* SVC (20,P)
// 1581 !*MOUSES* %ELSE
// 1582 !*MOUSES* %IF EXISTS(F_NAME) %START
// 1583 !*MOUSES* OPEN INPUT(3,F_NAME)
// 1584 !*MOUSES* %ELSE
// 1585 !*MOUSES* F_FLAG = -1
// 1586 !*MOUSES* F_TOP = 0; F_LIM = 0
// 1587 !*MOUSES* %RETURN
// 1588 !*MOUSES* %FINISH
// 1589 !*MOUSES* SELECT INPUT(3)
// 1590 !*MOUSES* %CYCLE; !READ FILE INTO PSEUDO-VM
// 1591 !*MOUSES* READ SYMBOL (SYM)
// 1592 !*MOUSES* BYTEINTEGER(FREE) = SYM
// 1593 !*MOUSES* FREE = FREE+1
// 1594 !*MOUSES* %REPEAT
// 1595 !*MOUSES* CLOSE INPUT
// 1596 !*MOUSES* %FINISH
// 1597 !*MOUSES* EOF:
// 1598 !*MOUSES* F_LIM = FREE
// 1599 !*MOUSES* F_LIM = F_LIM-1 %WHILE F_LIM # F_TOP %AND BYTEINTEGER(F_LIM-1) # NL
// 1600 !*MOUSES* FREE = FREE+40; !CAUTIOUS
// 1601 !*MOUSES* F_VMLIM = FREE-1
// 1602 !*MOUSES* CLOSE INPUT
// 1603 !*MOUSES* SELECT INPUT(0)
// 1604 !*MOUSES* %END
// 1605
// 1606 !*VAX* !system-specific stuff
// 1607 !*VAX* !
// 1608 !*VAX* ! External system routines
// 1609 !*VAX* !
// 1610 !*VAX* %EXTERNALINTEGERFNSPEC CHECKQUOTA(%STRING(127) FILENAME)
// 1611 !*VAX* %EXTERNALSTRING(72)%FNSPEC SYSMESS(%INTEGER I)
// 1612 !*VAX* %EXTERNALSTRING(255)%FNSPEC CLIPARAM
// 1613 !*VAX* !
// 1614 !*VAX* ! Special routines from PMM to handle file referencing and i/o
// 1615 !*VAX* !
// 1616 !*VAX* %EXTERNALINTEGERFNSPEC READIN(%STRING(MAXNAME)%NAME FILE,
// 1617 !*VAX* %INTEGER EXTRA, %INTEGERNAME BASE,TOP,FEND,LIMIT)
// 1618 !*VAX* %EXTERNALINTEGERFNSPEC WRITEOUT(%STRING(MAXNAME)%NAME FILE,
// 1619 !*VAX* %INTEGER BASE,TOP,FEND,LIMIT)
// 1620 !*VAX* %EXTERNALROUTINESPEC DELETEVM(%INTEGER BASE,LIMIT)
// 1621 !*VAX* !
// 1622 !*VAX* %ROUTINE CONNECT INPUT(%RECORD(FILE)%NAME F)
// 1623 !*VAX* ! Reference file specified by F_NAME
// 1624 !*VAX* ! allocate store to hold it + extra blocks specified by F_FLAG
// 1625 !*VAX* ! place the file in store (as near the end as possible)
// 1626 !*VAX* ! Return store addresses in F_VMTOP/F_VMLIM
// 1627 !*VAX* ! file addresses in F_TOP/F_LIM
// 1628 !*VAX* ! ( VMTOP <= TOP <= LIM <= VMLIM )
// 1629 !*VAX* ! (The area from LIM to VMLIM is not used; it exists only because
// 1630 !*VAX* ! it is not possible to predict precisely how much space the file
// 1631 !*VAX* ! will occupy when converted from VAX/VMS record format to a
// 1632 !*VAX* ! sanitary form, viz. straight ASCII with NLs at end of lines)
// 1633 !*VAX* !
// 1634 !*VAX* !Discard any previous secondary input file
// 1635 !*VAX* DELETEVM(F_VMTOP,F_VMLIM) %IF F_VMTOP # 0
// 1636 !*VAX* !Read the file in
// 1637 !*VAX* F_FLAG = READIN(F_NAME,F_FLAG,F_VMTOP,F_TOP,F_LIM,F_VMLIM)
// 1638 !*VAX* %IF F_FLAG # 0 %START
// 1639 !*VAX* PRINT STRING(" *".SYSMESS(F_FLAG).": ".F_NAME)
// 1640 !*VAX* F_VMTOP = 0; F_TOP = 0; F_LIM = 0
// 1641 !*VAX* %FINISH
// 1642 !*VAX* ! Ensure that file does not end with partial line
// 1643 !*VAX* F_LIM = F_LIM-1 %WHILE F_LIM # F_TOP %AND BYTEINTEGER(F_LIM-1)#NL
// 1644 !*VAX* %END
// 1645 !*VAX* !
// 1646 !*VAX* %INTEGERFN TERMTYPE
// 1647 !*VAX* %CONSTINTEGER VT52=16_40
// 1648 !*VAX* %RECORDFORMAT DEVINFO(%INTEGER GEN, %BYTE CLASS,TYPE, %SHORT WIDTH,
// 1649 !*VAX* %BYTE A,B,C,COLS,D,E,F,G,H,I,J,K)
// 1650 !*VAX* %RECORDFORMAT DESC(%INTEGER L,A)
// 1651 !*VAX* %SYSTEMINTEGERFNSPEC GETDEV(%RECORD(DESC)%NAME DEV, %INTEGERNAME Z,
// 1652 !*VAX* %RECORD(DESC)%NAME RES, %INTEGERNAME X, %INTEGER Y)
// 1653 !*VAX*
// 1654 !*VAX* %INTEGER F,X
// 1655 !*VAX* %RECORD(DEVINFO) TT
// 1656 !*VAX* %RECORD(DESC) DEV,RES
// 1657 !*VAX* %OWNSTRING(2) DEVNAME="TT"
// 1658 !*VAX*
// 1659 !*VAX* DEV_L = 2; DEV_A = ADDR(DEVNAME)+1
// 1660 !*VAX* RES_L = 20; RES_A = ADDR(TT)
// 1661 !*VAX* X = 0
// 1662 !*VAX* F = GETDEV(DEV,X,RES,X,0)
// 1663 !*VAX* %IF F&1 = 0 %START
// 1664 !*VAX* PRINTSTRING(SYSMESS(F))
// 1665 !*VAX* NEWLINE
// 1666 !*VAX* %STOP
// 1667 !*VAX* %FINISH
// 1668 !*VAX* %RESULT = 16_C0000002 %IF TT_TYPE = VT52
// 1669 !*VAX* %RESULT = 0
// 1670 !*VAX* %END
// 1671 !*VAX*
// 1672 %INTEGER I,F,L,SYM,DEFAULT
int I;
int F;
int L;
int SYM;
int DEFAULT;
// 1673 %RECORD(FILE) IN,SEC,OUT
struct FILE IN;
struct FILE SEC;
struct FILE OUT;
// 1674 !*VAX* %STRING(255) PARM=CLIPARAM
// 1675
// 1676 !*VAX* %routine getname(%string(maxname)%name s)
// 1677 !*VAX* ! Extract next name from PARM, leaving terminator in SYM
// 1678 !*VAX* %integer j
// 1679 !*VAX* j = 0
// 1680 !*VAX* %cycle
// 1681 !*VAX* sym = nl
// 1682 !*VAX* l = l+1 %and sym = charno(parm,l) %if l < length(parm)
// 1683 !*VAX* %exit %if sym = ',' %or sym = '/' %or sym < ' '
// 1684 !*VAX* %if sym = ' ' %start
// 1685 !*VAX* %exit %if j # 0
// 1686 !*VAX* %finish %else %start
// 1687 !*VAX* sym = sym-32 %if sym >= 96
// 1688 !*VAX* j = j+1 %if j # maxname; charno(s,j) = sym
// 1689 !*VAX* %finish
// 1690 !*VAX* %repeat
// 1691 !*VAX* length(s) = j
// 1692 !*VAX* s = ".N" %if s = ".NULL"
// 1693 !*VAX* %end
// 1694 !*VAX* !
// 1695 in = 0; sec = 0; out = 0
IN = (struct FILE){0};
SEC = (struct FILE){0};
OUT = (struct FILE){0};
// 1696 !*VAX* %if parm = "" %start
// 1697 !*VAX* prompt("File: ")
// 1698 !*VAX* l = 0
// 1699 !*VAX* %cycle
// 1700 !*VAX* read symbol(sym)
// 1701 !*VAX* %exit %if sym = nl
// 1702 !*VAX* l = l+1; charno(parm,l) = sym
// 1703 !*VAX* %repeat
// 1704 !*VAX* length(parm) = l
// 1705 !*VAX* %finish
// 1706 l = 0
L = 0;
// 1707 !*MOUSES* %STRING(31)%NAME IN1 == COMMAND_IN1,
// 1708 !*MOUSES* IN2 == COMMAND_IN2,
// 1709 !*MOUSES* OUT1 == COMMAND_OUT1
// 1710 !*MOUSES* IN_NAME = IN1
// 1711 !*MOUSES* IN_NAME = "" %IF IN_NAME = "N:" %OR IN_NAME = "NULL:"
// 1712 !*MOUSES* SEC_NAME = IN2
// 1713 !*MOUSES* OUT_NAME = OUT1
// 1714 !*MOUSES* %IF OUT_NAME = "" %THEN OUT_NAME = IN_NAME %AND DEFAULT = 1 %C
// 1715 !*MOUSES* %ELSE DEFAULT = 0
// 1716 !*MOUSES* OUT_NAME = "" %IF OUT_NAME = "N:" %OR OUT_NAME = "NULL:"
// 1717 !*VAX* getname(in_name)
// 1718 !*VAX* GETNAME(SEC_NAME) %IF SYM = ','
// 1719 !*VAX* in_name = "" %if in_name = ".N"
// 1720 !*VAX* out_name = in_name; default = 1
// 1721 !*VAX* %if sym = ' ' %or sym = '/' %start
// 1722 !*VAX* getname(out_name); default = 0
// 1723 !*VAX* OUT_NAME = "" %IF OUT_NAME = ".N"
// 1724 !*VAX* %finish
// 1725 !*VAX* %if sym # nl %start
// 1726 !*VAX* print string(" Faulty parameters: ".parm)
// 1727 !*VAX* newline
// 1728 !*VAX* spaces(19+l); print symbol('^'); newline
// 1729 !*VAX* %STOP
// 1730 !*VAX* %finish
// 1731
// 1732 %PREDICATE NULL(%STRING(MAXNAME) FNAME)
int NULL(_imp_string255 FNAME) {
// 1733 TOUPPER(FNAME)
_imp_TOUPPER((_imp_string255 *)/*p*/ /*?*/ &FNAME);
// 1734 %TRUE %IF FNAME="NUL" %OR FNAME="NUL:" %OR FNAME="NULL:"
/* clang-format off */
if (_imp_strcmp((_imp_string *)/*?*/&FNAME, (_imp_string *)/*?*/_imp_str_literal_ptr("NUL")) == 0) goto L_0193;
/* clang-format on */
/* clang-format off */
if (_imp_strcmp((_imp_string *)/*?*/&FNAME, (_imp_string *)/*?*/_imp_str_literal_ptr("NUL:")) == 0) goto L_0193;
/* clang-format on */
/* clang-format off */
if (_imp_strcmp((_imp_string *)/*?*/&FNAME, (_imp_string *)/*?*/_imp_str_literal_ptr("NULL:")) != 0) goto L_0194;
/* clang-format on */
L_0193:;
return 1 /*TRUE*/;
L_0194:;
// 1735 %FALSE
return 0 /*FALSE*/;
// 1736 %END
} /* end of NULL */
// 1737
// 1738 %INTEGER %FN TERMTYPE
int TERMTYPE(void) {
// 1739 %EXTERNAL %ROUTINE %SPEC INIT CONSOLE
extern void INITCONSOLE(void);
// 1740 INIT CONSOLE
INITCONSOLE();
// 1741 %RESULT = WIN32 CONSOLE
return -1073741819;
// 1742 %END
} /* end of TERMTYPE */
// 1743
// 1744 %IF ARGC <= 1 %OR ARGC > 3 %OR
if (ARGC <= 1) goto L_0195;
if (ARGC > 3) goto L_0195;
if (ARGC != 2) goto L_0196;
/* clang-format off */
if (_imp_strcmp((_imp_string *)ARGV[/*BUG*/1], (_imp_string *)/*?*/_imp_str_literal_ptr("/?")) != 0) goto L_0196;
/* clang-format on */
L_0195:;
// 1745+ (ARGC = 2 %AND ARGV(1)="/?") %START
// 1746 PRINTSTRING("Visual version of Edinburgh Compatible Context Editor (ECCE):
_imp_PRINTSTRING(
_imp_str_literal("Visual version of Edinburgh Compatible Context Editor (ECCE):\n\n VECCE infile [outfile]\n"));
// 1747+
// 1748+ VECCE infile [outfile]
// 1749+ ")
// 1750 PRINTSTRING("
_imp_PRINTSTRING(
_imp_str_literal("\n VECCE nul newfile to create newfile\n VECCE oldfile nul view existing "
"oldfile, don't modify\n VECCE oldfile to modify existing oldfile\n VECCE oldfile "
"newfile read oldfile, edit into newfile\n"));
// 1751+ VECCE nul newfile to create newfile
// 1752+ VECCE oldfile nul view existing oldfile, don't modify
// 1753+ VECCE oldfile to modify existing oldfile
// 1754+ VECCE oldfile newfile read oldfile, edit into newfile
// 1755+ ")
// 1756
// 1757 PRINTSTRING("
_imp_PRINTSTRING(_imp_str_literal("\nYou can use NUL: or NULL: in place of nul (case not significant).\n"));
// 1758+ You can use NUL: or NULL: in place of nul (case not significant).
// 1759+ ")
// 1760 %STOP
_imp_stop(0);
// 1761 %FINISH
L_0196:;
// 1762
// 1763 IN_NAME = ARGV(1)
/* clang-format off */
_imp_strncpy(/*?*/&IN.NAME, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *ARGV[/*BUG*/1]; (void *)&tmp;}), /*max:*/255);
/* clang-format on */
// 1764 !*WIN32C* IN_NAME = "" %IF NULL(IN_NAME)
// 1765 !*WIN32C* Can't have null string as file name
// 1766 %IF ARGC = 3 %START
if (ARGC != 3) goto L_0197;
// 1767 DEFAULT = 0
DEFAULT = 0;
// 1768 OUT_NAME = ARGV(2)
/* clang-format off */
_imp_strncpy(/*?*/&OUT.NAME, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = *ARGV[/*BUG*/2]; (void *)&tmp;}), /*max:*/255);
/* clang-format on */
// 1769 !*WIN32C* OUT_NAME = "" %IF NULL(OUT_NAME)
// 1770 %ELSE
goto L_0198;
L_0197:;
// 1771 DEFAULT = 1
DEFAULT = 1;
// 1772 OUT_NAME = IN_NAME
/* clang-format off */
_imp_strncpy(/*?*/&OUT.NAME, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = IN.NAME; (void *)&tmp;}), /*max:*/255);
/* clang-format on */
// 1773 %FINISH
L_0198:;
// 1774
// 1775 !*WIN32C* %IF OUT_NAME = "" %START
// 1776 {*WIN32C*} %IF NULL(OUT_NAME) %START
if (!(NULL(
/* clang-format off */
*({ __typeof__(_imp_string255) tmp = OUT.NAME/*q*/; (_imp_string255 *)&tmp; })
/* clang-format on */
)))
goto L_0199;
// 1777 CONNECT INPUT(IN); !without extra
CONNECTINPUT(/*?*/ &IN);
// 1778 %STOP %IF IN_FLAG # 0
if (IN.FLAG == 0) goto L_019A;
_imp_stop(0);
L_019A:;
// 1779 NEWLINES(2*25); !*WIN32C* CLEAR SCREEN
_imp_NEWLINES(2 * 25);
// 1780 PRINT STRING("= Showing ".IN_NAME)
_imp_PRINTSTRING(
/* clang-format off */
*({ __typeof__(_imp_string255) tmp = *({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/_imp_str_literal_ptr("= Showing "), (_imp_string *)/*?*/&IN.NAME); (_imp_string255 *)&tmp;})/*q*/; (_imp_string255 *)&tmp; })
/* clang-format on */
);
// 1781 %FINISH %ELSE %START
goto L_019B;
L_0199:;
// 1782 !*VAX* F = CHECKQUOTA(OUT_NAME)
// 1783 !*VAX* -> ER %IF F&1 = 0
// 1784 !*MOUSES* IN_FLAG = 20; !extra blocks
// 1785 !*MOUSES* IN_FLAG = 100 %IF command_modifier = '!';
// 1786 !*MOUSES* !*MOUSES* USE E <FILE>! FOR BIG BUFFER
// 1787 IN_FLAG = 100
IN.FLAG = 100;
// 1788 CONNECT INPUT(IN)
CONNECTINPUT(/*?*/ &IN);
// 1789 %STOP %IF IN_FLAG # 0
if (IN.FLAG == 0) goto L_019C;
_imp_stop(0);
L_019C:;
// 1790 %IF SEC_NAME # "" %START
/* clang-format off */
if (_imp_strcmp((_imp_string *)/*?*/&SEC.NAME, (_imp_string *)/*?*/_imp_str_literal_ptr("")) == 0) goto L_019D;
/* clang-format on */
// 1791 CONNECT INPUT(SEC)
CONNECTINPUT(/*?*/ &SEC);
// 1792 %STOP %IF SEC_FLAG # 0
if (SEC.FLAG == 0) goto L_019E;
_imp_stop(0);
L_019E:;
// 1793 %FINISH
L_019D:;
// 1794 OUT_TOP = IN_VMTOP; OUT_LIM = IN_LIM
OUT.TOP = IN.VMTOP;
OUT.LIM = IN.LIM;
// 1795 NEWLINES(2*25); !*WIN32C* CLEAR SCREEN
_imp_NEWLINES(2 * 25);
// 1796 !*WIN32C* %if in_name # "" %start
// 1797 %if %not null(in_name) %start {*WIN32C*}
if (NULL(
/* clang-format off */
*({ __typeof__(_imp_string255) tmp = IN.NAME/*q*/; (_imp_string255 *)&tmp; })
/* clang-format on */
))
goto L_019F;
// 1798 print string("= Editing ".in_name)
_imp_PRINTSTRING(
/* clang-format off */
*({ __typeof__(_imp_string255) tmp = *({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/_imp_str_literal_ptr("= Editing "), (_imp_string *)/*?*/&IN.NAME); (_imp_string255 *)&tmp;})/*q*/; (_imp_string255 *)&tmp; })
/* clang-format on */
);
// 1799 %if default = 0 %start
if (DEFAULT != 0) goto L_01A0;
// 1800 print string(" to ")
_imp_PRINTSTRING(_imp_str_literal(" to "));
// 1801 print string(out_name)
_imp_PRINTSTRING(
/* clang-format off */
*({ __typeof__(_imp_string255) tmp = OUT.NAME/*q*/; (_imp_string255 *)&tmp; })
/* clang-format on */
);
// 1802 %finish
L_01A0:;
// 1803 %finish %else %start
goto L_01A1;
L_019F:;
// 1804 print string("= Creating ".out_name)
_imp_PRINTSTRING(
/* clang-format off */
*({ __typeof__(_imp_string255) tmp = *({_imp_string255 tmp = _imp_join((_imp_string *)/*?*/_imp_str_literal_ptr("= Creating "), (_imp_string *)/*?*/&OUT.NAME); (_imp_string255 *)&tmp;})/*q*/; (_imp_string255 *)&tmp; })
/* clang-format on */
);
// 1805 %finish
L_01A1:;
// 1806 %finish
L_019B:;
// 1807 !*WIN32C* newline
// 1808 ! edi(in,sec,out,termtype,24,80)
// 1809 EDI(IN,SEC,OUT,TERMTYPE,25,79)
EDI(/*?*/ &IN, /*?*/ &SEC, /*?*/ &OUT, TERMTYPE(), 25, 79);
// 1810 %if default # 0 %and out_flag = 0 %start
if (DEFAULT == 0) goto L_01A2;
if (OUT.FLAG != 0) goto L_01A2;
// 1811 print string(" File unchanged"); SPACES(79-15) {*WIN32C*}
_imp_PRINTSTRING(_imp_str_literal(" File unchanged"));
_imp_SPACES(79 - 15);
// 1812 newline
_imp_NEWLINE();
// 1813 out_top = 0
OUT.TOP = 0;
// 1814 !*MOUSES* DELETE FILE (PAGE FILE NAME)
// 1815 %finish
L_01A2:;
// 1816 %if out_top # 0 %start
if (OUT.TOP == 0) goto L_01A3;
// 1817 i = in_lim-in_top; move(i,in_top,out_lim)
I = IN.LIM - IN.TOP;
MOVE(I, IN.TOP, OUT.LIM);
// 1818 out_lim = out_lim+i
OUT.LIM = OUT.LIM + I;
// 1819 !*MOUSES* STRING(ADDR(P_SACT)) = OUT_NAME
// 1820 !*MOUSES* SVC (17,P); !PACK FILENAME
// 1821 !*MOUSES*! %IF P_P2 = 0 %START; !FILE IN OWN DIR (NOT DEVICE)
// 1822 !*MOUSES*! %WHILE OUT_LIM&511 # 0 %CYCLE;!SUBSYS STANDARD: LAST BLOCK EOT PADDED
// 1823 !*MOUSES*! BYTEINTEGER(OUT_LIM) = 4; !ASCII EOT
// 1824 !*MOUSES*! OUT_LIM = OUT_LIM+1
// 1825 !*MOUSES*! %REPEAT
// 1826 !*MOUSES*! !JUST TRUNCATE THE WORKFILE
// 1827 !*MOUSES*! FLUSH BUFFERS; !MAKE DISC CONSISTENT
// 1828 !*MOUSES*! EXTEND DA (PAGING FILE, (OUT_LIM-OUT_TOP)>>9 - P_P2, I)
// 1829 !*MOUSES*! CLOSE DA (PAGING FILE)
// 1830 !*MOUSES*! DELETE FILE (OUT_NAME)
// 1831 !*MOUSES*! RENAME FILE (PAGE FILE NAME,OUT_NAME)
// 1832 !*MOUSES*! %ELSE; !QUEUE (LP:) OR DEVICE (OUT:)
// 1833 OPEN OUTPUT (3,OUT_NAME)
_imp_OPENOUTPUT(3,
/* clang-format off */
*({ __typeof__(_imp_string255) tmp = OUT.NAME/*q*/; (_imp_string255 *)&tmp; })
/* clang-format on */
);
// 1834 SELECT OUTPUT (3)
_imp_SELECTOUTPUT(3);
// 1835 PRINT SYMBOL (BYTEINTEGER(I)) %FOR I = OUT_TOP, 1, OUT_LIM-1
// %for I = OUT.TOP, 1, OUT.LIM - 1 %cycle
{
int _initial = OUT.TOP, _final = OUT.LIM - 1;
if (invalid_for_loop(_initial, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle I = OUT.TOP, 1, OUT.LIM - 1");
I = _initial - (1);
L_01A4:
if (I == _final) goto L_01A5;
I += 1;
_imp_PRINTSYMBOL(*_imp_BYTEINTEGER(I));
goto L_01A4;
}
L_01A5:;
// 1836 CLOSE OUTPUT
_imp_CLOSEOUTPUT();
// 1837 %FINISH
L_01A3:;
// 1838
// 1839 !*MOUSES* CLOSE DA (PAGING FILE)
// 1840 !*MOUSES* DELETE FILE (PAGE FILE NAME)
// 1841 !*VAX* F = WRITEOUT(OUT_NAME,OUT_TOP,OUT_TOP,OUT_LIM,IN_VMLIM)
// 1842 !*VAX* %IF F # 0 %START
// 1843 !*VAX* ER: PRINT STRING(" *".SYSMESS(F).": ".OUT_NAME)
// 1844 !*VAX* %FINISH
// 1845 !*VAX* %FINISH %ELSE %START
// 1846 !*VAX* DELETEVM(IN_VMTOP,IN_VMLIM)
// 1847 !*MOUSES*! %FINISH
// 1848 !*MOUSES* %FINISH %ELSE %START; !SHOWING
// 1849 !*MOUSES* DELETE FILE (PAGE FILE NAME)
// 1850 !*MOUSES* %FINISH
// 1851 !*VAX* DELETEVM(SEC_VMTOP,SEC_VMLIM) %IF SEC_VMTOP # 0
// 1852 !*MOUSES*!! P_P1 = 2; P_P2 = 10; P_P3 = OLD TT; !RESTORE TTY STATE FROM BEFORE EDIT
// 1853 !*MOUSES*!! SVC (29,P)
// 1854 %ENDOFPROGRAM
return;
} /* end of VECCE */