/* Edinburgh IMP77 Compiler - Version 8.4 */ PUSHS "\n" const char [2] snl {ind obj} ; INIT 1 %prim int rem {ind obj} ; ( int p ; int q ; ) %prim void readsymbol ; ( int typecode, void *p ; ) %prim real float {ind obj} ; ( int n ; ) %prim char [2] tostring {ind obj} ; ( int p ; ) %prim char [256] substring {ind obj} ; ( char [256] s ; int f ; int t ; ) %prim int freespace {ind obj} ; () %prim void svc ; ( int n ; struct /*(null)*/ int typecode, void *r ; ) %prim int addr {ind obj} ; ( int typecode, void *p ; ) %prim int integer ; ( int n ; ) %prim short int shortinteger ; ( int n ; ) %prim char int byteinteger ; ( int n ; ) %prim char [1] string ; ( int n ; ) %prim struct /*(null)*/ record ; ( int n ; ) %prim real real ; ( int n ; ) %prim long real longreal ; ( int n ; ) %prim char int length ; ( char [256] s ; ) %prim char int charno ; ( char [256] s ; int n ; ) %prim int int {ind obj} ; ( real x ; ) %prim int intpt {ind obj} ; ( real x ; ) %prim void iocp ; ( int n ; ) %prim int typeof {ind obj} ; ( int typecode, void *n ; ) %prim int sizeof {ind obj} ; ( int typecode, void *n ; ) %prim real fracpt {ind obj} ; ( real x ; ) extern void prompt ; ( char [16] s ; ) extern int nextsymbol {ind obj} ; () extern void skipsymbol ; () extern void printsymbol ; ( int sym ; ) extern void printstring ; ( char [256] s ; ) extern void write ; ( int v ; int p ; ) extern void selectinput ; ( int n ; ) extern void selectoutput ; ( int n ; ) extern void openinput ; ( int n ; char [32] fd ; ) extern void openoutput ; ( int n ; char [32] fd ; ) extern void closeinput ; () extern void closeoutput ; () extern void resetinput ; () extern void resetoutput ; () extern char [9] time {ind obj} ; () extern char [10] date {ind obj} ; () extern int cputime {ind obj} ; () extern int comreg ; ( int n ; ) extern void read ; ( int typecode, void *x ; ) extern void print ; ( real val ; int before ; int after ; ) extern void printfl ; ( real val ; int places ; ) extern void space ; () extern void spaces ; ( int n ; ) extern void newline ; () extern void newlines ; ( int n ; ) struct /*FILEFM*/ %format filefm ; ( int unit ; int owner ; int n1 ; int n2 ; ) struct /*EVENTFM*/ %format eventfm ; ( int event ; int sub ; int extra ; char [64] message ; int pc ; int x ; ) extern struct /*EVENTFM*/ /*spec*/ event ; #line 21 // 1 !!This version of ECCE, derived from a paper copy believed to // 2 !!date from 1975, removes PDP9/15 machine code, and other // 3 !!IMP9/15 system dependencies, and I'm hopeful that as a result // 4 !!it might well work if compiled with a generic Imp compiler. // 5 // 6 !!RWT Feb 2002 // 7 // 8 !!Code slightly rearranged to fit the model of Peter Stephen's Imp to C // 9 !!translator. This now compiles and runs exactly as on the pdp9/15 // 10 !!Remember to run it with redirected input, eg ecce < file.txt > file2.txt // 11 // 12 !!The I/O library currently assumes you are running on Unix. // 13 !!NOTE: There IS a bug in this implementation. Lines of more // 14 !!than 120 characters have a newline inserted at the 120th character // 15 !!on output. This *may* be an original bug rather than an artifact // 16 !!of the translation or run-time library.. // 17 // 18 !!GT 02 Mar 2002 // 19 // 20 %external %integer outstream // 21 int outstream ; INIT 1 #line 23 // 22 %owninteger in=1; !current input stream // 23 %constinteger min=1; !main input stream static int in ; INIT 1 #line 24 // 24 %constinteger mout=1; !main output stream #line 25 // 25 %constinteger sin=2; !secondary input stream #line 26 // 26 %constinteger sextra=122; !extra buff for sin #line 27 // 27 %constinteger size=30000; !of edit buffer (bytes) #line 28 // 28 %owninteger mon=0; !monitor indic #line 29 // 29 %owninteger print1=0,print2=0; !print indicators static int mon ; INIT 1 #line 30 // 30 %constinteger stop=-5000; !loop stop (const) static int print1 ; INIT 1 static int print2 ; INIT 1 #line 31 // 31 %owninteger i,j,k,pp1,sym #line 32 // 32 %owninteger code; !command code letter static int i ; INIT 1 static int j ; INIT 1 static int k ; INIT 1 static int pp1 ; INIT 1 static int sym ; INIT 1 #line 33 // 33 %owninteger text; !text pointer static int code ; INIT 1 #line 34 // 34 %owninteger num; !repetition number static int text ; INIT 1 #line 35 // 35 %ownintegername mainfp; ! == fp or mfp (for sin) static int num ; INIT 1 #line 36 // 36 %constinteger cbase=1,tbase=120 static int int typecode, void *mainfp ; INIT 1 #line 37 // 37 %ownintegerarray c(cbase:tbase); !command -> <- text #line 38 // 38 ! each command unit -- letter, parenthesis or comma -- is BOUNDS {NOT IMPLEMENTED YET} static int *c ; INIT 120 #line 43 // 39 ! represented by a trio: code(+lim) text num // 40 ! in the case of parentheses and commas 'text' is a pointer // 41 ! to another command unit (not to a text string) // 42 %owninteger ci; !command index (ad) // 43 %owninteger ti; !text index (ad) static int ci ; INIT 1 #line 44 // 44 %owninteger cmax=0; !command max (ad) static int ti ; INIT 1 #line 45 // 45 %ownintegerarray stored(1:192); !defs of x,y,z static int cmax ; INIT 1 #line 46 // 46 %owninteger pos1=0, pos2=0, pos3=0 BOUNDS {NOT IMPLEMENTED YET} static int *stored ; INIT 192 #line 47 // 47 %ownbyteintegerarray byte(1:size) static int pos1 ; INIT 1 static int pos2 ; INIT 1 static int pos3 ; INIT 1 #line 48 // 48 %owninteger top = 2; !top of buff (index) BOUNDS {NOT IMPLEMENTED YET} static char int *byte ; INIT 30000 #line 49 // 49 %owninteger bot = size-sextra; !bottom of buff (index) static int top ; INIT 1 #line 50 // 50 %owninteger lbeg; !line start (index) static int bot ; INIT 1 #line 51 // 51 %owninteger pp; !previous pointer (index) static int lbeg ; INIT 1 #line 52 // 52 %owninteger fp=0; !file pointer (index) static int pp ; INIT 1 #line 53 // 53 %owninteger lend; !line end (index) static int fp ; INIT 1 #line 54 // 54 %owninteger fend; !end of file in buff (index) static int lend ; INIT 1 #line 55 // 55 %owninteger ms=0; !match start (index) static int fend ; INIT 1 #line 56 // 56 %owninteger ml=0; !match limit (index) static int ms ; INIT 1 #line 57 // 57 ! significance of file pointers: static int ml ; INIT 1 #line 66 // 58 ! [nl] o n e nl t w . . . o nl n e x t nl . . nl l a s t nl [nl] // 59 ! ! ! ! ! ! ! // 60 ! t l p f l f // 61 ! o b p p e e // 62 ! p e n n // 63 ! g d d // 64 // 65 %owninteger type,chain; !command input vars // 66 %owninteger pend=0; !ditto static int type ; INIT 1 static int chain ; INIT 1 #line 67 // 67 static int pend ; INIT 1 #line 69 // 68 %routine prompt(%string(1) s); ! Emulating pdp9/15 routine // 69 %integer oldstream, c void prompt ; ( char [2] s ; ) #line 70 // 70 c = charno(s, 1) int oldstream ; int c ; #line 71 // 71 %if c # 0 %then %start ; ! c = 0 is supposed to flush output on the 9/15 c = /*%prim*/ %byte %spec charno (%string (1) s , 1); #line 72 // 72 oldstream = outstream if (c == 0) goto L_0001; #line 73 // 73 select output(0) oldstream = /*%external*/ outstream ; #line 74 // 74 print symbol(c) #line 75 // 75 select output(oldstream) #line 76 // 76 %finish #line 77 // 77 %end L_0001: /* LOCATE */ #line 78 // 78 #line 80 // 79 %routine load pp(%integer k); !!!also increments pp // 80 byte(pp) = k; pp = pp+1 void loadpp ; ( int k ; ) #line 81 // 81 %end %byte byte [pp ] = k ; #line 81 /*%own*/ pp = (pp + 1); #line 82 // 82 #line 84 // 83 %routine load fp(%integer k) // 84 byte(fp) = k void loadfp ; ( int k ; ) #line 85 // 85 %end %byte byte [fp ] = k ; #line 86 // 86 #line 88 // 87 %routine left star // 88 %cycle void leftstar ; () #line 89 // 89 %return %if pp = lbeg for (;;) { L_0002: /* LOCATE */ #line 90 // 90 fp = fp-1; pp = pp-1 if (pp != lbeg ) goto L_0003; RETURN {NOT IMPLEMENTED YET} L_0003: /* LOCATE */ #line 91 // 91 load fp(byte(pp)) /*%own*/ fp = (fp - 1); #line 91 /*%own*/ pp = (pp - 1); #line 92 // 92 %repeat #line 93 // 93 %end L_0002: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ #line 94 // 94 #line 96 // 95 %routine right star // 96 %cycle void rightstar ; () #line 97 // 97 %return %if fp = lend for (;;) { L_0004: /* LOCATE */ #line 98 // 98 load pp(byte(fp)) if (fp != lend ) goto L_0005; RETURN {NOT IMPLEMENTED YET} L_0005: /* LOCATE */ #line 99 // 99 fp = fp+1 #line 100 // 100 %repeat /*%own*/ fp = (fp + 1); #line 101 // 101 %end L_0004: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ #line 102 // 102 #line 104 // 103 %ownintegerarray symtype(33:95) = %c // 104 64, 3, 3, 3, 2, 3, 3,11, 9,64, 3,12, 2, 3, 3, BOUNDS {NOT IMPLEMENTED YET} static int *symtype ; INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 INIT 1 #line 114 // 105 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 3, 3, 3,64, // 106 3, 2,10,18, 5, 8,52,10, 2, 6,10,10,10,56, 2, 2, // 107 10,50,10,22, 5, 5, 6, 2,32,32,32, 3,10, 3, 3, 3 // 108 ! ! " # $ % & ' ( ) * + , - . / // 109 ! 0 1 2 3 4 5 6 7 8 9 : < = > ? // 110 ! @ A B C D E F G H I J K L M N O // 111 ! P Q R S T U V W X Y Z [ \ ] ^ _ // 112 // 113 %routine read sym // 114 %if pend # 0 %then sym=pend %and pend=0 %else %start void readsym ; () #line 115 // 115 %while pos3 # 0 %cycle if (pend == 0) goto L_0006; /*%own*/ sym = pend ; /*%own*/ pend = 0; goto L_0007 /* GOTO (is this always %continue or %exit?) */; L_0006: /* LOCATE */ #line 116 // 116 sym = stored(pos3); pos3 = pos3+1 for (;;) { L_0008: /* LOCATE */ if (pos3 == 0) goto L_0009; #line 117 // 117 %return %unless sym = nl /*%own*/ sym = stored [pos3 ]; #line 117 /*%own*/ pos3 = (pos3 + 1); #line 118 // 118 pos3 = pos2; pos2 = pos1; pos1 = 0 if (sym == 10) goto L_000a; RETURN {NOT IMPLEMENTED YET} L_000a: /* LOCATE */ #line 119 // 119 %repeat /*%own*/ pos3 = pos2 ; #line 119 /*%own*/ pos2 = pos1 ; #line 119 /*%own*/ pos1 = 0; #line 120 // 120 read symbol(sym) L_0008: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ L_0009: /* LOCATE */ #line 121 // 121 %finish #line 122 // 122 %end L_0007: /* LOCATE */ #line 123 // 123 #line 125 // 124 %routine read item // 125 type = 1 void readitem ; () #line 126 // 126 %cycle /*%own*/ type = 1; #line 127 // 127 read sym %until sym # ' ' L_0007: /* LOCATE */ #line 128 // 128 %return %if sym < 32; !nl for (;;) { L_000b: /* LOCATE */ readsym (); if (sym != 32) goto L_000c; L_000b: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ L_000c: /* LOCATE */ #line 129 // 129 sym = sym-32 %if sym >= 96; !ensure upper case if (sym >= 32) goto L_000d; RETURN {NOT IMPLEMENTED YET} L_000d: /* LOCATE */ #line 130 // 130 type = symtype(sym) if (sym < 96) goto L_000e; /*%own*/ sym = (sym - 32); L_000e: /* LOCATE */ #line 131 // 131 %return %unless type&15 = 0 /*%own*/ type = symtype [sym ]; #line 132 // 132 %exit %unless type=32 if ((15 & type ) == 0) goto L_000f; RETURN {NOT IMPLEMENTED YET} L_000f: /* LOCATE */ #line 133 // 133 pos1 = pos2; pos2 = pos3 if (type == 32) goto L_0010; goto L_0011 /* GOTO (is this always %continue or %exit?) */; L_0010: /* LOCATE */ #line 134 // 134 pos3 = (sym-'X')<<6+1 /*%own*/ pos1 = pos2 ; #line 134 /*%own*/ pos2 = pos3 ; #line 135 // 135 %repeat /*%own*/ pos3 = (((sym - 88) << 6) + 1); #line 136 // 136 %if type = 0 %start L_0007: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ L_0011: /* LOCATE */ #line 137 // 137 num = sym-'0' if (type != 0) goto L_0011; #line 138 // 138 %cycle /*%own*/ num = (sym - 48); #line 139 // 139 read symbol(pend) for (;;) { L_0012: /* LOCATE */ #line 140 // 140 %exit %unless '0' <= pend <= '9' #line 141 // 141 num = (num<<2+num)<<1-'0'+pend JUMPIFD > L_0013 if (pend <= 57) goto L_0014; L_0013: /* LOCATE */ goto L_0015 /* GOTO (is this always %continue or %exit?) */; L_0014: /* LOCATE */ #line 142 // 142 %repeat /*%own*/ num = (((((num << 2) + num ) << 1) - 48) + pend ); #line 143 // 143 %finish %else %start L_0012: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ L_0015: /* LOCATE */ #line 144 // 144 type = 0 goto L_0016 /* GOTO (is this always %continue or %exit?) */; L_0011: /* LOCATE */ #line 145 // 145 num = 0; %return %if sym = '*' /*%own*/ type = 0; #line 146 // 146 num = stop+1; %return %if sym = '?' /*%own*/ num = 0; #line 146 if (sym != 42) goto L_0015; RETURN {NOT IMPLEMENTED YET} L_0015: /* LOCATE */ #line 147 // 147 num = stop; ! '!' /*%own*/ num = (-5000 + 1); #line 147 if (sym != 63) goto L_0015; RETURN {NOT IMPLEMENTED YET} L_0015: /* LOCATE */ #line 148 // 148 %finish /*%own*/ num = -5000; #line 149 // 149 %end L_0016: /* LOCATE */ #line 150 // 150 #line 152 // 151 %routine unchain // 152 %cycle void unchain ; () #line 153 // 153 text = chain; %return %if text = 0 L_0016: /* LOCATE */ #line 154 // 154 chain = c(text+1); c(text+1) = ci /*%own*/ text = chain ; #line 154 if (text != 0) goto L_0015; RETURN {NOT IMPLEMENTED YET} L_0015: /* LOCATE */ #line 155 // 155 %repeat %until c(text) = 'X' /*%own*/ chain = c [(text + 1)]; #line 155 c [(text + 1)] = ci ; #line 156 // 156 %end if (c [text ] == 88) goto L_0011; L_0016: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ L_0011: /* LOCATE */ #line 157 // 157 #line 159 // 158 %routine stack(%integer v) // 159 c(ci) = v; ci = ci+1 void stack ; ( int v ; ) #line 160 // 160 %end c [ci ] = v ; #line 160 /*%own*/ ci = (ci + 1); #line 161 // 161 #line 163 // 162 %routine make space // 163 %integer k,p1,p2 void makespace ; () #line 164 // 164 %return %if mainfp-pp-240 > 0 int k ; int p1 ; int p2 ; #line 165 // 165 select output(mout) if (((*mainfp - pp ) - 240) <= 0) goto L_0011; RETURN {NOT IMPLEMENTED YET} L_0011: /* LOCATE */ #line 166 // 166 p1 = top; p2 = (p1+lbeg)>>1; !output about half #line 167 // 167 p2 = lbeg %if code = 'C'; !but all if closing p1 = top ; #line 167 p2 = ((p1 + lbeg ) >> 1); #line 168 // 168 %monitor %and %stop %if p2 = top; !!!logical error if (code != 67) goto L_0011; p2 = lbeg ; L_0011: /* LOCATE */ #line 169 // 169 %cycle if (p2 != top ) goto L_0011; assert(FALSE); STOP {NOT IMPLEMENTED YET} L_0011: /* LOCATE */ #line 170 // 170 k = byte(p1); print symbol(k); p1 = p1+1 for (;;) { L_0017: /* LOCATE */ #line 171 // 171 %repeat %until k = nl %and p1-p2 >= 0 k = %byte byte [p1 ]; #line 171 #line 171 p1 = (p1 + 1); #line 172 // 172 select output(0) if (k != 10) goto L_0018; if ((p1 - p2 ) >= 0) goto L_0011; L_0018: /* LOCATE */ L_0017: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ L_0011: /* LOCATE */ #line 173 // 173 lbeg = top+lbeg-p1; p2 = pp; pp = top #line 174 // 174 %cycle /*%own*/ lbeg = ((top + lbeg ) - p1 ); #line 174 p2 = pp ; #line 174 /*%own*/ pp = top ; #line 175 // 175 %return %if p1 = p2 for (;;) { L_0019: /* LOCATE */ #line 176 // 176 load pp(byte(p1)); p1 = p1+1 if (p1 != p2 ) goto L_0015; RETURN {NOT IMPLEMENTED YET} L_0015: /* LOCATE */ #line 177 // 177 %repeat #line 177 p1 = (p1 + 1); #line 178 // 178 %end L_0019: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ #line 179 // 179 #line 181 // 180 %routine read line // 181 %integer k void readline ; () #line 182 // 182 ! %on %event 9 %start int k ; #line 186 // 183 ! ->eof // 184 ! %finish // 185 %if fp # fend %start // 186 lend = fp if (fp == fend ) goto L_0011; #line 187 // 187 lend = lend+1 %while byte(lend) # nl /*%own*/ lend = fp ; #line 188 // 188 %return for (;;) { L_001a: /* LOCATE */ if (%byte byte [lend ] == 10) goto L_0015; /*%own*/ lend = (lend + 1); L_001a: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ L_0015: /* LOCATE */ #line 189 // 189 %finish RETURN {NOT IMPLEMENTED YET} #line 190 // 190 ms = 0; print1 = 0; print2 = 0 L_0011: /* LOCATE */ #line 191 // 191 select input(in) /*%own*/ ms = 0; #line 191 /*%own*/ print1 = 0; #line 191 /*%own*/ print2 = 0; #line 192 // 192 fp = bot-sextra+1 #line 193 // 193 %cycle /*%own*/ fp = ((bot - 122) + 1); #line 194 // 194 %if fp # bot %then read symbol(k) %else k = nl for (;;) { L_001b: /* LOCATE */ #line 195 // 195 ->eof %if k<0 if (fp == bot ) goto L_0015; goto L_001c /* GOTO (is this always %continue or %exit?) */; L_0015: /* LOCATE */ k = 10; L_001c: /* LOCATE */ #line 196 // 196 load fp(k); fp = fp+1 if (k >= 0) goto L_0015; goto L_001d /* JUMP */; L_0015: /* LOCATE */ #line 197 // 197 %repeat %until k = nl #line 197 /*%own*/ fp = (fp + 1); #line 198 // 198 fend = fp; lend = fend-1 if (k == 10) goto L_0011; L_001b: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ L_0011: /* LOCATE */ #line 199 // 199 fp = bot-sextra+1 /*%own*/ fend = fp ; #line 199 /*%own*/ lend = (fend - 1); #line 200 // 200 select input(0) /*%own*/ fp = ((bot - 122) + 1); #line 201 // 201 %return #line 202 // 202 eof:fp = bot; lend = fp; fend = lend RETURN {NOT IMPLEMENTED YET} #line 203 // 203 load fp(nl) L_001d: /* LABEL */ #line 203 /*%own*/ fp = bot ; #line 203 /*%own*/ lend = fp ; #line 203 /*%own*/ fend = lend ; #line 204 // 204 select input(0) #line 205 // 205 %end #line 206 // 206 #line 208 // 207 %routine switch inputs // 208 %owninteger mfp,mlend,mend,sfp,send void switchinputs ; () #line 209 // 209 %if in = min %start static int mfp ; INIT 1 static int mlend ; INIT 1 static int mend ; INIT 1 static int sfp ; INIT 1 static int send ; INIT 1 #line 210 // 210 left star if (in != 1) goto L_0011; #line 211 // 211 in = sin leftstar (); #line 212 // 212 mfp = fp; mlend = lend; mend = fend /*%own*/ in = 2; #line 213 // 213 mainfp == mfp /*%own*/ mfp = fp ; #line 213 /*%own*/ mlend = lend ; #line 213 /*%own*/ mend = fend ; #line 214 // 214 bot = bot+sextra; fp = sfp; fend = send %own /*%name*/ mainfp = &%own mfp ; #line 215 // 215 read line /*%own*/ bot = (bot + 122); #line 215 /*%own*/ fp = sfp ; #line 215 /*%own*/ fend = send ; #line 216 // 216 %finish %else %start readline (); #line 217 // 217 pp = lbeg goto L_001e /* GOTO (is this always %continue or %exit?) */; L_0011: /* LOCATE */ #line 218 // 218 in = min /*%own*/ pp = lbeg ; #line 219 // 219 bot = bot-sextra; sfp = fp; send = fend /*%own*/ in = 1; #line 220 // 220 fp = mfp; lend = mlend; fend = mend /*%own*/ bot = (bot - 122); #line 220 /*%own*/ sfp = fp ; #line 220 /*%own*/ send = fend ; #line 221 // 221 mainfp == fp /*%own*/ fp = mfp ; #line 221 /*%own*/ lend = mlend ; #line 221 /*%own*/ fend = mend ; #line 222 // 222 %finish %own /*%name*/ mainfp = &%own fp ; #line 223 // 223 %end L_001e: /* LOCATE */ #line 224 // 224 #line 226 // 225 %routine print line // 226 %integer p void printline ; () #line 227 // 227 print1 = lend; print2 = fp+pp int p ; #line 228 // 228 p = lbeg /*%own*/ print1 = lend ; #line 228 /*%own*/ print2 = (fp + pp ); #line 229 // 229 %cycle p = lbeg ; #line 230 // 230 %if p = pp %start L_001e: /* LOCATE */ #line 231 // 231 print symbol('^') %if p # lbeg %and num = 0 if (p != pp ) goto L_0015; #line 232 // 232 p = fp if (p == lbeg ) goto L_001f; if (num != 0) goto L_001f; L_001f: /* LOCATE */ #line 233 // 233 %finish p = fp ; #line 234 // 234 %exit %if p = lend L_0015: /* LOCATE */ #line 235 // 235 print symbol(byte(p)) if (p != lend ) goto L_0015; goto L_0011 /* GOTO (is this always %continue or %exit?) */; L_0015: /* LOCATE */ #line 236 // 236 p = p+1 #line 237 // 237 %repeat p = (p + 1); #line 238 // 238 print string("**END**") %if p = fend L_001e: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ L_0011: /* LOCATE */ #line 239 // 239 newline if (p != fend ) goto L_0011; PUSHS "**END**" L_0011: /* LOCATE */ #line 240 // 240 %end /*%external*/ %spec newline (); #line 241 // 241 #line 243 // 242 %integerfn matched // 243 %integer i,j,k,l,t1,fp1,lim int matched {ind obj} ; () #line 244 // 244 lim = c(ci-3)&(\127); t1 = c(text) int i ; int j ; int k ; int l ; int t1 ; int fp1 ; int lim ; #line 245 // 245 L1: pp1 = pp; fp1 = fp lim = ((\127) & c [(ci - 3)]); #line 245 t1 = c [text ]; #line 246 // 246 ->L3 %unless fp = ms %and (code='F' %or code='U') for (;;) { L_0020: /* LABEL */ #line 246 /*%own*/ pp1 = pp ; #line 246 fp1 = fp ; #line 247 // 247 k = byte(fp) if (fp != ms ) goto L_0021; if (code == 70) goto L_0011; if (code == 85) goto L_0011; L_0021: /* LOCATE */ goto L_0022 /* JUMP */; L_0011: /* LOCATE */ #line 248 // 248 L2: load pp(k); fp = fp+1 k = %byte byte [fp ]; #line 249 // 249 L3: ->L10 %if fp = lend for (;;) { L_0023: /* LABEL */ #line 249 #line 249 /*%own*/ fp = (fp + 1); #line 250 // 250 k = byte(fp) L_0022: /* LABEL */ #line 250 if (fp != lend ) goto L_0011; goto L_0024 /* JUMP */; L_0011: /* LOCATE */ #line 251 // 251 ->L2 %unless k = t1 k = %byte byte [fp ]; #line 252 // 252 i = fp; j = text if (k == t1 ) goto L_0011; goto L_0023 /* JUMP */; L_0011: /* LOCATE */ #line 253 // 253 L6: i = i+1; j = j-1 i = fp ; #line 253 j = text ; #line 254 // 254 l = c(j) for (;;) { L_0025: /* LABEL */ #line 254 i = (i + 1); #line 254 j = (j - 1); #line 255 // 255 ->L6 %if byte(i) = l l = c [j ]; #line 256 // 256 ->L2 %if l # 0 if (%byte byte [i ] != l ) goto L_0011; goto L_0025 /* JUMP */; L_0011: /* LOCATE */ #line 257 // 257 ms = fp; ml = i if (l == 0) goto L_0011; goto L_0023 /* JUMP */; L_0011: /* LOCATE */ #line 258 // 258 %result = 1 /*%own*/ ms = fp ; #line 258 /*%own*/ ml = i ; #line 259 // 259 L10: lim = lim-128 return(1); #line 260 // 260 %if lim # 0 %and fp # fend %start L_0024: /* LABEL */ #line 260 lim = (lim - 128); #line 261 // 261 %if code # 'U' %start if (lim == 0) goto L_0011; if (fp == fend ) goto L_0011; #line 262 // 262 load pp(nl); lbeg = pp if (code == 85) goto L_0015; #line 263 // 263 %finish %else pp = pp1 #line 263 /*%own*/ lbeg = pp ; #line 264 // 264 fp = fp+1; make space; read line goto L_001c /* GOTO (is this always %continue or %exit?) */; L_0015: /* LOCATE */ /*%own*/ pp = pp1 ; L_001c: /* LOCATE */ #line 265 // 265 ->L1 /*%own*/ fp = (fp + 1); #line 265 makespace (); #line 265 readline (); #line 266 // 266 %finish goto L_0020 /* JUMP */; #line 267 // 267 pp = pp1; fp = fp1 L_0011: /* LOCATE */ #line 268 // 268 %result = 0 /*%own*/ pp = pp1 ; #line 268 /*%own*/ fp = fp1 ; #line 269 // 269 %end return(0); #line 270 // 270 #line 273 // 271 // 272 %externalintegerfn main; !edit15: ecce for pdp9/15 // 273 !initialise int main {ind obj} ; () #line 275 // 274 %switch t(0:12) // 275 %switch s('A':'\') BOUNDS {NOT IMPLEMENTED YET} %switch t ; #line 276 // 276 BOUNDS {NOT IMPLEMENTED YET} %switch s ; #line 283 // 277 !%on %event 9 %start // 278 ! printstring("Caught event"); newline // 279 ! ->eof // 280 !%finish // 281 // 282 select input(0) // 283 pp = top-1; load pp(nl); !for bouncing off #line 284 // 284 lbeg = pp; mainfp == fp /*%own*/ pp = (top - 1); #line 284 #line 285 // 285 stored(1) = nl; stored(65) = nl; stored(129) = nl /*%own*/ lbeg = pp ; #line 285 %own /*%name*/ mainfp = &%own fp ; #line 286 // 286 select output(0); print string("EDIT stored [1] = 10; #line 286 stored [65] = 10; #line 286 stored [129] = 10; #line 287 // 287 ") #line 287 PUSHS "EDIT\n" #line 289 // 288 read line // 289 readline (); #line 293 // 290 !read command line // 291 // 292 L1: prompt(">") // 293 read item; ->eof %if sym<0; ->L1 %if type = 1 for (;;) { L_0026: /* LABEL */ #line 293 PUSHS ">" #line 294 // 294 ci = cbase; ti = tbase; chain = 0 readitem (); #line 294 if (sym >= 0) goto L_0011; goto L_0027 /* JUMP */; L_0011: /* LOCATE */ #line 294 if (type != 1) goto L_0011; goto L_0026 /* JUMP */; L_0011: /* LOCATE */ #line 295 // 295 %if type = 0 %and cmax # 0 %start /*%own*/ ci = 1; #line 295 /*%own*/ ti = 120; #line 295 /*%own*/ chain = 0; #line 296 // 296 c(cmax+2) = num if (type != 0) goto L_0011; if (cmax == 0) goto L_0011; #line 297 // 297 read item; ->er2 %if type # 1 c [(cmax + 2)] = num ; #line 298 // 298 ->go readitem (); #line 298 if (type == 1) goto L_0015; goto L_0028 /* JUMP */; L_0015: /* LOCATE */ #line 299 // 299 %finish goto L_0029 /* JUMP */; #line 300 // 300 %if sym = '%' %start L_0011: /* LOCATE */ #line 301 // 301 read sym; sym = sym-32 %if sym >= 96 if (sym != 37) goto L_0011; #line 302 // 302 code = sym; ->er5 %if code<=32 readsym (); #line 302 if (sym < 96) goto L_0015; /*%own*/ sym = (sym - 32); L_0015: /* LOCATE */ #line 303 // 303 read item /*%own*/ code = sym ; #line 303 if (code > 32) goto L_0015; goto L_0020 /* JUMP */; L_0015: /* LOCATE */ #line 304 // 304 ->t(symtype(code)>>4) readitem (); #line 305 // 305 %finish ->SJUMP(104) #line 306 // 306 L2: i = type&15; ->er2 %if i < 4 L_0011: /* LOCATE */ #line 307 // 307 code = sym; text = 0; num = 1; !default values L_0022: /* LABEL */ #line 307 /*%own*/ i = (15 & type ); #line 307 if (i >= 4) goto L_0011; goto L_0028 /* JUMP */; L_0011: /* LOCATE */ #line 308 // 308 read item /*%own*/ code = sym ; #line 308 /*%own*/ text = 0; #line 308 /*%own*/ num = 1; #line 309 // 309 ->t(i) readitem (); #line 310 // 310 t(2): !%x, %y, %z ->SJUMP(104) #line 311 // 311 ->er1 %if sym # '=' SLABEL(104): #line 312 // 312 i = (code-'X')<<6 if (sym == 61) goto L_0011; goto L_0023 /* JUMP */; L_0011: /* LOCATE */ #line 313 // 313 %cycle /*%own*/ i = ((code - 88) << 6); #line 314 // 314 read sym for (;;) { L_002a: /* LOCATE */ #line 315 // 315 i = i+1; stored(i) = sym readsym (); #line 316 // 316 ->L1 %if sym = nl /*%own*/ i = (i + 1); #line 316 stored [i ] = sym ; #line 317 // 317 %repeat if (sym != 10) goto L_0015; goto L_0026 /* JUMP */; L_0015: /* LOCATE */ #line 318 // 318 t(3): !%m, %f, %q L_002a: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ #line 319 // 319 mon = 'M'-code SLABEL(104): #line 320 // 320 ->L1 /*%own*/ mon = (77 - code ); #line 321 // 321 t(4): !find goto L_0026 /* JUMP */; #line 322 // 322 num = 0 %unless type = 0 SLABEL(104): #line 323 // 323 t(5): !+del,trav,uncover if (type == 0) goto L_0011; /*%own*/ num = 0; L_0011: /* LOCATE */ #line 324 // 324 code = num<<7+code; num = 1 SLABEL(104): #line 325 // 325 read item %if type = 0 /*%own*/ code = ((num << 7) + code ); #line 325 /*%own*/ num = 1; #line 326 // 326 t(6): !+insert,subst,verify if (type != 0) goto L_0011; readitem (); L_0011: /* LOCATE */ #line 327 // 327 ->er4 %if type # 3 SLABEL(104): #line 328 // 328 text = ti; i = sym if (type == 3) goto L_0011; goto L_0024 /* JUMP */; L_0011: /* LOCATE */ #line 329 // 329 L61: read sym /*%own*/ text = ti ; #line 329 /*%own*/ i = sym ; #line 330 // 330 %if sym # nl %start L_0025: /* LABEL */ #line 330 readsym (); #line 331 // 331 %if sym # i %start if (sym == 10) goto L_0011; #line 332 // 332 ->er6 %if ti <= ci if (sym == i ) goto L_0015; #line 333 // 333 c(ti) = sym; ti = ti-1 if (ti > ci ) goto L_002b; goto L_002c /* JUMP */; L_002b: /* LOCATE */ #line 334 // 334 ->L61 c [ti ] = sym ; #line 334 /*%own*/ ti = (ti - 1); #line 335 // 335 %finish goto L_0025 /* JUMP */; #line 336 // 336 %finish %else %start L_0015: /* LOCATE */ #line 337 // 337 pend = sym goto L_002d /* GOTO (is this always %continue or %exit?) */; L_0011: /* LOCATE */ #line 338 // 338 ->er4 %unless code = 'S' %or code = 'I' /*%own*/ pend = sym ; #line 339 // 339 %finish if (code == 83) goto L_0015; if (code == 73) goto L_0015; goto L_0024 /* JUMP */; L_0015: /* LOCATE */ #line 340 // 340 ->er4 %if ti = text %and code # 'S' L_002d: /* LOCATE */ #line 341 // 341 c(ti) = 0; ti = ti-1 if (ti != text ) goto L_0011; if (code == 83) goto L_0011; goto L_0024 /* JUMP */; L_0011: /* LOCATE */ #line 342 // 342 ->L81 c [ti ] = 0; #line 342 /*%own*/ ti = (ti - 1); #line 343 // 343 t(8): !move,erase goto L_002e /* JUMP */; #line 344 // 344 ->L100 %unless sym = '-' SLABEL(104): #line 345 // 345 code = code+10 if (sym == 45) goto L_0011; goto L_002f /* JUMP */; L_0011: /* LOCATE */ #line 346 // 346 L81: read item /*%own*/ code = (code + 10); #line 347 // 347 ->L101 L_002e: /* LABEL */ #line 347 readitem (); #line 348 // 348 t(9): !close bracket goto L_0030 /* JUMP */; #line 349 // 349 unchain; ->er3 %if text = 0 SLABEL(104): #line 350 // 350 code = 'Z'; c(text+2) = num unchain (); #line 350 if (text != 0) goto L_0011; goto L_0031 /* JUMP */; L_0011: /* LOCATE */ #line 351 // 351 text = text+3 /*%own*/ code = 90; #line 351 c [(text + 2)] = num ; #line 352 // 352 t(10): !+get,kill,etc. /*%own*/ text = (text + 3); #line 353 // 353 L100:->er1 %if type = 3 SLABEL(104): #line 354 // 354 L101:read item %if type = 0 L_002f: /* LABEL */ #line 354 if (type != 3) goto L_0011; goto L_0023 /* JUMP */; L_0011: /* LOCATE */ #line 355 // 355 ->put L_0030: /* LABEL */ #line 355 if (type != 0) goto L_0011; readitem (); L_0011: /* LOCATE */ #line 356 // 356 t(11): !open bracket goto L_0032 /* JUMP */; #line 357 // 357 code = 'X' SLABEL(104): #line 358 // 358 ->L121 /*%own*/ code = 88; #line 359 // 359 t(12): !comma goto L_0033 /* JUMP */; #line 360 // 360 code = 'Y' SLABEL(104): #line 361 // 361 read item %if type = 1 /*%own*/ code = 89; #line 362 // 362 L121:text = chain; chain = ci if (type != 1) goto L_0011; readitem (); L_0011: /* LOCATE */ #line 363 // 363 num = 0 L_0033: /* LABEL */ #line 363 /*%own*/ text = chain ; #line 363 /*%own*/ chain = ci ; #line 364 // 364 put:stack(code); stack(text); stack(num) /*%own*/ num = 0; #line 365 // 365 ->er6 %if ci+4 >= ti L_0032: /* LABEL */ #line 365 #line 365 #line 365 #line 366 // 366 ->L2 %unless type = 1 if ((ci + 4) < ti ) goto L_0011; goto L_002c /* JUMP */; L_0011: /* LOCATE */ #line 367 // 367 unchain; ->er3 %if text # 0 if (type == 1) goto L_0011; goto L_0022 /* JUMP */; L_0011: /* LOCATE */ #line 368 // 368 cmax = ci unchain (); #line 368 if (text == 0) goto L_0011; goto L_0031 /* JUMP */; L_0011: /* LOCATE */ #line 369 // 369 stack('Z'); stack(cbase); stack(1); !extra close b /*%own*/ cmax = ci ; #line 370 // 370 stack(0) #line 370 #line 370 #line 371 // 371 ->go #line 372 // 372 goto L_0029 /* JUMP */; #line 376 // 373 !command input error reports // 374 // 375 er1:space; print symbol(code) // 376 er2:code = sym L_0023: /* LABEL */ #line 376 /*%external*/ %spec space (); #line 376 #line 377 // 377 ->er5 L_0028: /* LABEL */ #line 377 /*%own*/ code = sym ; #line 378 // 378 er3:print string(" ()") goto L_0020 /* JUMP */; #line 379 // 379 ->er7 L_0031: /* LABEL */ #line 379 PUSHS " ()" #line 380 // 380 er4:print string(" TEXT FOR") goto L_0034 /* JUMP */; #line 381 // 381 t(0): L_0024: /* LABEL */ #line 381 PUSHS " TEXT FOR" #line 382 // 382 er5:space; print symbol(code&127) SLABEL(104): #line 383 // 383 ->er7 L_0020: /* LABEL */ #line 383 /*%external*/ %spec space (); #line 383 #line 384 // 384 er6:print string(" SIZE") goto L_0034 /* JUMP */; #line 385 // 385 er7:print symbol('?') L_002c: /* LABEL */ #line 385 PUSHS " SIZE" #line 386 // 386 newline; cmax = 0 %if ci # cbase L_0034: /* LABEL */ #line 386 #line 387 // 387 L10: ->L1 %if sym<32 /*%external*/ %spec newline (); #line 387 if (ci == 1) goto L_0011; /*%own*/ cmax = 0; L_0011: /* LOCATE */ #line 388 // 388 read sym for (;;) { L_0035: /* LABEL */ #line 388 if (sym >= 32) goto L_0011; goto L_0026 /* JUMP */; L_0011: /* LOCATE */ #line 389 // 389 ->L10 readsym (); #line 390 // 390 goto L_0035 /* JUMP */; #line 394 // 391 !execute command line // 392 // 393 go: ci = cbase // 394 get:code = c(ci)&127; ->L99 %if code = 0 L_0029: /* LABEL */ #line 394 /*%own*/ ci = 1; #line 395 // 395 text = c(ci+1) for (;;) { L_0036: /* LABEL */ #line 395 /*%own*/ code = (127 & c [ci ]); #line 395 if (code != 0) goto L_0011; goto L_0037 /* JUMP */; L_0011: /* LOCATE */ #line 396 // 396 num = c(ci+2) /*%own*/ text = c [(ci + 1)]; #line 397 // 397 ci = ci+3 /*%own*/ num = c [(ci + 2)]; #line 398 // 398 rep:num = num-1 /*%own*/ ci = (ci + 3); #line 399 // 399 ->s(code) for (;;) { L_0038: /* LABEL */ #line 399 /*%own*/ num = (num - 1); #line 400 // 400 ok: ->rep %unless num = 0 %or num = stop ->SJUMP(105) #line 401 // 401 ->get for (;;) { L_0039: /* LABEL */ #line 401 if (num == 0) goto L_0011; if (num == -5000) goto L_0011; goto L_0038 /* JUMP */; L_0011: /* LOCATE */ #line 402 // 402 s('\'): !invert goto L_0036 /* JUMP */; #line 403 // 403 no: ->get %if num < 0 SLABEL(105): #line 404 // 404 ci = ci+3 %and ->get %if c(ci) = '\' for (;;) { L_003a: /* LABEL */ #line 404 if (num >= 0) goto L_0011; goto L_0036 /* JUMP */; L_0011: /* LOCATE */ #line 405 // 405 skp:i = c(ci); ci = c(ci+1) %if i = 'X' if (c [ci ] != 92) goto L_0011; /*%own*/ ci = (ci + 3); goto L_0036 /* JUMP */; L_0011: /* LOCATE */ #line 406 // 406 ci = ci+3 for (;;) { L_003b: /* LABEL */ #line 406 /*%own*/ i = c [ci ]; #line 406 if (i != 88) goto L_0011; /*%own*/ ci = c [(ci + 1)]; L_0011: /* LOCATE */ #line 407 // 407 num = c(ci-1)-1 %and ->no %if i > 'X' /*%own*/ ci = (ci + 3); #line 408 // 408 ->skp %if i # 0 if (i <= 88) goto L_0011; /*%own*/ num = (c [(ci - 1)] - 1); goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 409 // 409 if (i == 0) goto L_0011; goto L_003b /* JUMP */; L_0011: /* LOCATE */ #line 413 // 410 !execution error report // 411 // 412 print string("FAILURE: ") // 413 %if code='O' %or code='W' %start PUSHS "FAILURE: " #line 414 // 414 print symbol(code-10); code = '-' if (code == 79) goto L_003c; if (code != 87) goto L_0011; L_003c: /* LOCATE */ #line 415 // 415 %finish #line 415 /*%own*/ code = 45; #line 416 // 416 print symbol(code) L_0011: /* LOCATE */ #line 417 // 417 %if text # 0 %start #line 418 // 418 print symbol('''') if (text == 0) goto L_0011; #line 419 // 419 %while c(text) # 0 %cycle #line 420 // 420 print symbol(c(text)) L_001c: /* LOCATE */ if (c [text ] == 0) goto L_0015; #line 421 // 421 text = text-1 #line 422 // 422 %repeat /*%own*/ text = (text - 1); #line 423 // 423 print symbol('''') L_001c: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ L_0015: /* LOCATE */ #line 424 // 424 %finish #line 425 // 425 newline L_0011: /* LOCATE */ #line 426 // 426 print1 = 0 /*%external*/ %spec newline (); #line 427 // 427 /*%own*/ print1 = 0; #line 431 // 428 !end of command line // 429 // 430 L99: ->L1 %if sym # nl // 431 ->L1 %unless (mon>=0 %and print1#lend) %or (mon>0 %and print2#fp+pp) L_0037: /* LABEL */ #line 431 if (sym == 10) goto L_0011; goto L_0026 /* JUMP */; L_0011: /* LOCATE */ #line 432 // 432 num = 0; print line if (mon < 0) goto L_003d; if (print1 != lend ) goto L_0011; L_003d: /* LOCATE */ if (mon <= 0) goto L_003e; if (print2 != (fp + pp )) goto L_0011; L_003e: /* LOCATE */ goto L_0026 /* JUMP */; L_0011: /* LOCATE */ #line 433 // 433 ->L1 /*%own*/ num = 0; #line 433 printline (); #line 434 // 434 goto L_0026 /* JUMP */; #line 438 // 435 !individual commands // 436 // 437 s('X'): !open bracket // 438 c(text+2) = num+1 SLABEL(105): #line 439 // 439 ->get c [(text + 2)] = (num + 1); #line 440 // 440 s('Z'): !close bracket goto L_0036 /* JUMP */; #line 441 // 441 ->get %if num = 0 %or num = stop SLABEL(105): #line 442 // 442 c(ci-1) = num if (num == 0) goto L_003f; if (num != -5000) goto L_0011; L_003f: /* LOCATE */ goto L_0036 /* JUMP */; L_0011: /* LOCATE */ #line 443 // 443 s('Y'): !+comma c [(ci - 1)] = num ; #line 444 // 444 ci = text SLABEL(105): #line 445 // 445 ->get /*%own*/ ci = text ; #line 446 // 446 s('R'): !right shift goto L_0036 /* JUMP */; #line 447 // 447 ->no %if fp = lend SLABEL(105): #line 448 // 448 load pp(byte(fp)); fp = fp+1 if (fp != lend ) goto L_0011; goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 449 // 449 ->ok #line 449 /*%own*/ fp = (fp + 1); #line 450 // 450 s('L'): !left shift goto L_0039 /* JUMP */; #line 451 // 451 ->no %if in = sin %or pp = lbeg SLABEL(105): #line 452 // 452 fp = fp-1; pp = pp-1; load fp(byte(pp)) if (in == 2) goto L_0040; if (pp != lbeg ) goto L_0011; L_0040: /* LOCATE */ goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 453 // 453 ms = 0 /*%own*/ fp = (fp - 1); #line 453 /*%own*/ pp = (pp - 1); #line 453 #line 454 // 454 ->ok /*%own*/ ms = 0; #line 455 // 455 s('E'): !erase goto L_0039 /* JUMP */; #line 456 // 456 ->no %if fp = lend SLABEL(105): #line 457 // 457 fp = fp+1 if (fp != lend ) goto L_0011; goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 458 // 458 ->ok /*%own*/ fp = (fp + 1); #line 459 // 459 s('O'): !erase back goto L_0039 /* JUMP */; #line 460 // 460 ->no %if pp = lbeg SLABEL(105): #line 461 // 461 pp = pp-1 if (pp != lbeg ) goto L_0011; goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 462 // 462 ->ok /*%own*/ pp = (pp - 1); #line 463 // 463 s('V'): !verify goto L_0039 /* JUMP */; #line 464 // 464 i = fp-1; j = text+1 SLABEL(105): #line 465 // 465 v1: i = i+1; j = j-1 /*%own*/ i = (fp - 1); #line 465 /*%own*/ j = (text + 1); #line 466 // 466 k = c(j) for (;;) { L_0041: /* LABEL */ #line 466 /*%own*/ i = (i + 1); #line 466 /*%own*/ j = (j - 1); #line 467 // 467 ->v1 %if byte(i) = k /*%own*/ k = c [j ]; #line 468 // 468 ->no %if k # 0 if (%byte byte [i ] != k ) goto L_0011; goto L_0041 /* JUMP */; L_0011: /* LOCATE */ #line 469 // 469 ms = fp; ml = i if (k == 0) goto L_0011; goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 470 // 470 ->ok /*%own*/ ms = fp ; #line 470 /*%own*/ ml = i ; #line 471 // 471 s('F'): !find goto L_0039 /* JUMP */; #line 472 // 472 ->no %if matched = 0 SLABEL(105): #line 473 // 473 ->ok matched (); if (70 != 0) goto L_0011; goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 474 // 474 s('U'): !uncover goto L_0039 /* JUMP */; #line 475 // 475 ->no %if matched = 0; pp = pp1 SLABEL(105): #line 476 // 476 ->ok matched (); if (85 != 0) goto L_0011; goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 476 /*%own*/ pp = pp1 ; #line 477 // 477 s('D'): !delete goto L_0039 /* JUMP */; #line 478 // 478 ->no %if matched = 0; fp = ml SLABEL(105): #line 479 // 479 ->ok matched (); if (68 != 0) goto L_0011; goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 479 /*%own*/ fp = ml ; #line 480 // 480 s('T'): !traverse goto L_0039 /* JUMP */; #line 481 // 481 ->no %if matched = 0 SLABEL(105): #line 482 // 482 s('S'): !+substitute matched (); if (84 != 0) goto L_0011; goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 483 // 483 fp = ml %if fp = ms SLABEL(105): #line 484 // 484 s('I'): !+insert if (fp != ms ) goto L_0011; /*%own*/ fp = ml ; L_0011: /* LOCATE */ #line 485 // 485 make space SLABEL(105): #line 486 // 486 !! ->no %if pp-lbeg+lend-fp > 80 makespace (); #line 488 // 487 i = text // 488 i1: ->ok %if c(i) = 0 /*%own*/ i = text ; #line 489 // 489 load pp(c(i)); i = i-1 for (;;) { L_0042: /* LABEL */ #line 489 if (c [i ] != 0) goto L_0011; goto L_0039 /* JUMP */; L_0011: /* LOCATE */ #line 490 // 490 ->i1 #line 490 /*%own*/ i = (i - 1); #line 491 // 491 s('G'): !get (line from tt) goto L_0042 /* JUMP */; #line 492 // 492 prompt(":") SLABEL(105): #line 493 // 493 !! make space PUSHS ":" #line 495 // 494 read symbol(i) // 495 ->no %if i = ':' #line 496 // 496 left star if (i != 58) goto L_0011; goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 497 // 497 %while i # nl %cycle leftstar (); #line 498 // 498 load pp(i) L_002d: /* LOCATE */ if (i == 10) goto L_0011; #line 499 // 499 read symbol(i) #line 500 // 500 %repeat #line 501 // 501 s('B'): !+break (insert newline) L_002d: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ L_0011: /* LOCATE */ #line 502 // 502 make space SLABEL(105): #line 503 // 503 load pp(nl); lbeg = pp makespace (); #line 504 // 504 ->ok #line 504 /*%own*/ lbeg = pp ; #line 505 // 505 s('P'): !print goto L_0039 /* JUMP */; #line 506 // 506 print line SLABEL(105): #line 507 // 507 ->get %if num = 0 printline (); #line 508 // 508 s('M'): !+move if (num != 0) goto L_0011; goto L_0036 /* JUMP */; L_0011: /* LOCATE */ #line 509 // 509 right star SLABEL(105): #line 510 // 510 ->no %if fp = fend rightstar (); #line 511 // 511 load pp(nl); lbeg = pp if (fp != fend ) goto L_0011; goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 512 // 512 m1: fp = fp+1; make space; read line #line 512 /*%own*/ lbeg = pp ; #line 513 // 513 ->ok for (;;) { L_0043: /* LABEL */ #line 513 /*%own*/ fp = (fp + 1); #line 513 makespace (); #line 513 readline (); #line 514 // 514 s('K'): !kill (line) goto L_0039 /* JUMP */; #line 515 // 515 pp = lbeg; fp = lend SLABEL(105): #line 516 // 516 k1: ->no %if fp = fend /*%own*/ pp = lbeg ; #line 516 /*%own*/ fp = lend ; #line 517 // 517 ->m1 for (;;) { L_0044: /* LABEL */ #line 517 if (fp != fend ) goto L_0011; goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 518 // 518 s('J'): !join (delete newline) goto L_0043 /* JUMP */; #line 519 // 519 right star SLABEL(105): #line 520 // 520 !! ->no %if pp-lbeg > 80 rightstar (); #line 522 // 521 ->k1 // 522 s('W'): !move back goto L_0044 /* JUMP */; #line 523 // 523 ->no %if in = sin SLABEL(105): #line 524 // 524 make space if (in != 2) goto L_0011; goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 525 // 525 ->no %if lbeg = top makespace (); #line 526 // 526 lend = fp-pp+lbeg-1 if (lbeg != top ) goto L_0011; goto L_003a /* JUMP */; L_0011: /* LOCATE */ #line 527 // 527 w1: k = byte(pp-1) /*%own*/ lend = (((fp - pp ) + lbeg ) - 1); #line 528 // 528 ->w2 %if k = nl %and pp # lbeg for (;;) { L_0045: /* LABEL */ #line 528 /*%own*/ k = %byte byte [(pp - 1)]; #line 529 // 529 fp = fp-1; pp = pp-1; load fp(k) if (k != 10) goto L_0011; if (pp == lbeg ) goto L_0011; goto L_0046 /* JUMP */; L_0011: /* LOCATE */ #line 530 // 530 ->w1 /*%own*/ fp = (fp - 1); #line 530 /*%own*/ pp = (pp - 1); #line 530 #line 531 // 531 w2: lbeg = pp; ms = 0 goto L_0045 /* JUMP */; #line 532 // 532 ->ok L_0046: /* LABEL */ #line 532 /*%own*/ lbeg = pp ; #line 532 /*%own*/ ms = 0; #line 533 // 533 t(1): !%s, %c ... goto L_0039 /* JUMP */; #line 534 // 534 ->eof %if code = 'C' SLABEL(104): #line 535 // 535 switch inputs if (code != 67) goto L_0011; goto L_0027 /* JUMP */; L_0011: /* LOCATE */ #line 536 // 536 ->L99 switchinputs (); #line 537 // 537 eof:code = 'C'; !+eof on command stream goto L_0037 /* JUMP */; #line 538 // 538 switch inputs %if in = sin L_0027: /* LABEL */ #line 538 /*%own*/ code = 67; #line 539 // 539 %cycle if (in != 2) goto L_0011; switchinputs (); L_0011: /* LOCATE */ #line 540 // 540 right star for (;;) { L_0047: /* LOCATE */ #line 541 // 541 %exit %if fp = fend rightstar (); #line 542 // 542 load pp(nl); lbeg = pp if (fp != fend ) goto L_0015; goto L_0011 /* GOTO (is this always %continue or %exit?) */; L_0015: /* LOCATE */ #line 543 // 543 fp = fp+1; make space; read line #line 543 /*%own*/ lbeg = pp ; #line 544 // 544 %repeat /*%own*/ fp = (fp + 1); #line 544 makespace (); #line 544 readline (); #line 545 // 545 select output(mout) L_0047: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ L_0011: /* LOCATE */ #line 546 // 546 %while top # pp %cycle #line 547 // 547 print symbol(byte(top)); top = top+1 for (;;) { L_0048: /* LOCATE */ if (top == pp ) goto L_0011; #line 548 // 548 %repeat #line 548 /*%own*/ top = (top + 1); #line 549 // 549 select output(0) L_0048: /* continue address if it was a for loop, otherwise a bug to be fixed! */ } /* end loop */ L_0011: /* LOCATE */ #line 550 // 550 %if code # 'C' %then %monitor #line 551 // 551 %result = 0 if (code == 67) goto L_0011; assert(FALSE); L_0011: /* LOCATE */ #line 552 // 552 %end return(0); #line 553 // 553 #line 555 // 554 %endoffile