#include <perms.h>
// Edinburgh IMP77 Compiler - Version 8.4
//
// 1 %begin; ! LC (Low-level compiler) for 8086
int main(int argc, char **argv) { /*%begin*/
_imp_initialise(argc, argv);
// 2
// 3 ! Statement -> CONST {tag = cexpr}+
// 4 ! {WORD, BYTE} {tag { (cexpr:cexpr) }? {= {data}+ }? }*
// 5 ! SPEC tag string
// 6 ! PROC tag {string}? {tag}*
// 7 ! END
// 8 ! tag :
// 9 ! {instruction, ELSE}? {IF expr comp expr}?
// 10 ! CYCLE
// 11 ! FINISH
// 12 ! Instruction -> MOVE {string opd, cexpr opd opd}
// 13 ! JUMP tag
// 14 ! REPEAT
// 15 ! RETURN {expr}?
// 16 ! opd = expr
// 17 ! tag {expr}*
// 18 ! Data -> {string, cexpr { (cexpr) }? }
// 19 ! Cexpr -> const {op const}*
// 20 ! Expr -> {opd, const} {op {opd, const} }*
// 21 ! Opd -> tag { ( {opd, const} ) }?
// 22 ! Op -> + - & ! \ * / % << >>
// 23 ! Comp -> = # < > <= >= [ ] [= ]=
// 24 ! Comments are enclosed between { and } or | and NL.
// 25
// 26 ! Calling convention: Push parms, then XCALL or Push CS, CALL.
// 27 !Entry: Push DS, Push BP, Mov BP,SP, {Sub SP,framesize}?,
// 28 ! {Mov AX,Glaseg, Mov DS,AX}? Xor AX,AX, Push AX
// 29 !Return: Mov SP,BP, Pop BP, Pop DS, Xret parmsize.
// 30
// 31 %constinteger source=1,diag=0,object=1,list=2; !Streams
// 32
// 33 %constinteger linemax=80,atommax=50,tagmax=200,textmax=20
// 34 %constinteger codemax=3499,glamax=499
// 35 %byteintegerarray line(1:linemax)
unsigned char LINE[80];
// 36 %byteintegerarray code(0:codemax)
unsigned char CODE[3500];
// 37 %byteintegerarray gla(0:glamax)
unsigned char GLA[500];
// 38 %integerarray atomtype,atomval(1:atommax)
int ATOMTYPE[50];
int ATOMVAL[50];
// 39 %integerarray tag1,tag2,tagtype,tagval(1:tagmax)
int TAG1[200];
int TAG2[200];
int TAGTYPE[200];
int TAGVAL[200];
// 40 %integerarray texttype,textval(1:textmax)
int TEXTTYPE[20];
int TEXTVAL[20];
// 41 %integer type,val,t,v,atompos,ifpos,floc,parms
int TYPE;
int VAL;
int T;
int V;
int ATOMPOS;
int IFPOS;
int FLOC;
int PARMS;
// 42 %integer oldapos,oldcpos,oldtpos,access,textlevel
int OLDAPOS;
int OLDCPOS;
int OLDTPOS;
int ACCESS;
int TEXTLEVEL;
// 43 %integer lineno=0,cloc=0,gloc=0,level=0,gpos=0,cpos=0,tagpos=1
int LINENO;
LINENO = 0;
int CLOC;
CLOC = 0;
int GLOC;
GLOC = 0;
int LEVEL;
LEVEL = 0;
int GPOS;
GPOS = 0;
int CPOS;
CPOS = 0;
int TAGPOS;
TAGPOS = 1;
// 44 %string(31)program
_imp_string31 PROGRAM;
// 45
// 46 !Atom types
// 47 %constinteger unknown=0,constant=1,string=2,label=3
// 48 %constinteger var=4, wordbit=1, glabit=2, varmask=16_fc
// 49 %constinteger proc=8,xproc=9,spec=10
// 50 %constinteger op=11,comp=12,colon=13,sep=14,bracket=15,bx=16!wordbit
// 51
// 52 ! Keyword types
// 53 %constinteger kconst=17,kword=18,kbyte=19,kspec=20,kproc=21
// 54 %constinteger kend=22,kmove=23,kjump=24,kreturn=25,kprogram=26
// 55 %constinteger kelse=27,kfinish=28,kcycle=29,krepeat=30
// 56
// 57 !Operator codes
// 58 %constinteger load=1,add=2,sub=3,and=4,or=5,xor=6,cmp=7,
// 59+ mul=8,div=9,rem=10,left=11,right=12,store=13,lea=14
// 60
// 61 !Keyword tag codes (1:36 = A:Z,0:9) 1st {*37 + 2nd {*37 + 3rd}? }?
// 62 %constinteger if=339
// 63 %ownintegerarray n1(kconst:krepeat)=
static int N1[14] = {4676, 32060, 3683, 26608, 22585, 7367, 18374, 14480, 24847, 22585, 7308, 8561, 5035, 24843};
// 64+ 4676, 32060, 3683, 26608, 22585, 7367, 18374, 14480, 24847, 22585,
// 65+ 7308, 8561, 5035, 24843
// 66 %ownintegerarray n2(kconst:krepeat)=
static int N2[14] = {723, 4, 5, 3, 3, 0, 5, 16, 29429, 10250, 5, 13032, 449, 6902};
// 67+ 723, 4, 5, 3, 3, 0, 5, 16, 29429, 10250,
// 68+ 5, 13032, 449, 6902
// 69
// 70 !Fault numbers
// 71 %constinteger complex=1,atom=2,consterr=3,bfull=4,form=5,ambig=6,
// 72+ nested=7,declate=8,far=9,labund=10,level0=11,varund=12,dfull=13,
// 73+ repexp=14,finexp=15,context=16,maxfault=16
// 74
// 75 %routine fault(%integer n)
void FAULT(int N) {
// 76 %ownstring(15)%array s(1:maxfault)=
static _imp_string15 S[16] = {_imp_str_init("Complex"),
_imp_str_init("Atom"),
_imp_str_init("Not constant"),
_imp_str_init("Buffer full"),
_imp_str_init("Form"),
_imp_str_init("Ambiguous"),
_imp_str_init("Nesting"),
_imp_str_init("Too late"),
_imp_str_init("Too far"),
_imp_str_init("Label missing"),
_imp_str_init("Code misplaced"),
_imp_str_init("Name"),
_imp_str_init("Dict full"),
_imp_str_init("Repeat expected"),
_imp_str_init("Finish expected"),
_imp_str_init("Context")};
// 77+ "Complex",
// 78+ "Atom",
// 79+ "Not constant",
// 80+ "Buffer full",
// 81+ "Form",
// 82+ "Ambiguous",
// 83+ "Nesting",
// 84+ "Too late",
// 85+ "Too far",
// 86+ "Label missing",
// 87+ "Code misplaced",
// 88+ "Name",
// 89+ "Dict full",
// 90+ "Repeat expected",
// 91+ "Finish expected",
// 92+ "Context"
// 93 %integer i,sym
int I;
int SYM;
// 94 selectoutput(diag); write(lineno,1); space
_imp_SELECTOUTPUT(0);
_imp_WRITE(LINENO, 1);
_imp_SPACE();
// 95 i=1
I = 1;
// 96 %cycle
L_0001:;
// 97 sym=line(i); printsymbol(sym); i=i+1
SYM = LINE[I - 1];
_imp_PRINTSYMBOL(SYM);
I = I + 1;
// 98 %repeatuntil sym=nl
if (SYM == 10) goto L_0002;
goto L_0001;
L_0002:;
// 99 printstring(s(n)); write(atompos-1,1); newline
_imp_PRINTSTRING(
*({
__typeof__(_imp_string15) tmp = S[N - 1] /*q*/;
(_imp_string255 *)&tmp;
})
);
_imp_WRITE(ATOMPOS - 1, 1);
_imp_NEWLINE();
// 100 selectoutput(list)
_imp_SELECTOUTPUT(2);
// 101 printstring("** "); printstring(s(n))
_imp_PRINTSTRING(_imp_str_literal("** "));
_imp_PRINTSTRING(
*({
__typeof__(_imp_string15) tmp = S[N - 1] /*q*/;
(_imp_string255 *)&tmp;
})
);
// 102 write(atompos-1,1); newline
_imp_WRITE(ATOMPOS - 1, 1);
_imp_NEWLINE();
// 103 %signalevent 15
_imp_signal(15, 0, 0, "");
// 104 %end
return;
} /* end of FAULT */
// 105
// 106 %routine readline
void READLINE(void) {
// 107 %owninteger semi=0
static int SEMI = 0;
// 108 %OWNINTEGER QUOTE=0
static int QUOTE = 0;
// 109 %integer sym,n1,n2,radix,i,quoted,lpos
int SYM;
int N1;
int N2;
int RADIX;
int I;
int QUOTED;
int LPOS;
// 110
// 111 %routine phex(%integer x)
void PHEX(int X) {
// 112 %integer k,i
int K;
int I;
// 113 %for i=12,-4,0 %cycle
// %for I = 12, -4, 0 %cycle
{
I = 16;
L_0003:
if (I == 0) goto L_0004;
I -= 4;
// 114 k=x>>i&15; k=k+7 %if k>9
K = (unsigned int)X >> I & 15;
if (K <= 9) goto L_0006;
K = K + 7;
L_0006:;
// 115 printsymbol(k+'0')
_imp_PRINTSYMBOL(K + 48);
// 116 %repeat
goto L_0003;
}
L_0004:;
// 117 %end
return;
} /* end of PHEX */
// 118
// 119 %routine putatom(%integer t,v)
void PUTATOM(int T, int V) {
// 120 fault(complex) %if atompos>atommax
if (ATOMPOS <= 50) goto L_0007;
FAULT(1);
L_0007:;
// 121 atomtype(atompos)=t; atomval(atompos)=v
ATOMTYPE[ATOMPOS - 1] = T;
ATOMVAL[ATOMPOS - 1] = V;
// 122 atompos=atompos+1
ATOMPOS = ATOMPOS + 1;
// 123 %end
return;
} /* end of PUTATOM */
// 124
// 125 selectoutput(list)
_imp_SELECTOUTPUT(2);
// 126 %cycle
L_0008:;
// 127 %if semi=0 %start
if (SEMI != 0) goto L_0009;
// 128 write(lineno+1,4)
_imp_WRITE(LINENO + 1, 4);
// 129 printstring(" C"); phex(cloc); printstring(" D"); phex(gloc)
_imp_PRINTSTRING(_imp_str_literal(" C"));
PHEX(CLOC);
_imp_PRINTSTRING(_imp_str_literal(" D"));
PHEX(GLOC);
// 130 space
_imp_SPACE();
// 131 %finish
L_0009:;
// 132 lpos=1; quoted=0
LPOS = 1;
QUOTED = 0;
// 133 %cycle
L_000A:;
// 134 next: %if lpos+quoted=linemax %start; ! line nearly too long: force end
U_1000:;
if (LPOS + QUOTED != 80) goto L_000B;
// 135 %if quoted=0 %then sym=nl %else sym=quote
if (QUOTED != 0) goto L_000C;
SYM = 10;
goto L_000D;
L_000C:;
SYM = QUOTE;
L_000D:;
// 136 %else
goto L_000E;
L_000B:;
// 137 readsymbol(sym)
_imp_READSYMBOL(/*?*/ &SYM);
// 138 %finish
L_000E:;
// 139 printsymbol(sym)
_imp_PRINTSYMBOL(SYM);
// 140 %if quoted=0 %start
if (QUOTED != 0) goto L_000F;
// 141 quoted=1 %if sym='''' %or sym='"'
if (SYM == 39) goto L_0010;
if (SYM != 34) goto L_0011;
L_0010:;
QUOTED = 1;
L_0011:;
// 142 quote=sym %if quoted#0
if (QUOTED == 0) goto L_0012;
QUOTE = SYM;
L_0012:;
// 143 %else
goto L_0013;
L_000F:;
// 144 quoted=0 %if sym=quote
if (SYM != QUOTE) goto L_0014;
QUOTED = 0;
L_0014:;
// 145 %finish
L_0013:;
// 146 %if quoted=0 %start
if (QUOTED != 0) goto L_0015;
// 147 %if sym='{' %start; ! Comment
if (SYM != 123) goto L_0016;
// 148 %cycle
L_0017:;
// 149 readsymbol(sym)
_imp_READSYMBOL(/*?*/ &SYM);
// 150 printsymbol(sym)
_imp_PRINTSYMBOL(SYM);
// 151 %if sym=nl %start
if (SYM != 10) goto L_0018;
// 152 lineno=lineno+1; spaces(18)
LINENO = LINENO + 1;
_imp_SPACES(18);
// 153 %finish
L_0018:;
// 154 %repeatuntil sym='}'
if (SYM == 125) goto L_0019;
goto L_0017;
L_0019:;
// 155 ->next
goto U_1000;
// 156 %finish
L_0016:;
// 157 sym=sym-32 %if 'a'<=sym<='z'; semi=0
{
// Double-sided test on SYM (Part I)
int tmp;
if (97 > (tmp = SYM)) goto L_001A;
// Double-sided test on SYM (Part II)
if (tmp > 122) goto L_001A;
}
SYM = SYM - 32;
L_001A:;
SEMI = 0;
// 158 %if sym=';' %start
if (SYM != 59) goto L_001B;
// 159 sym=nl; lineno=lineno-1; semi=1
SYM = 10;
LINENO = LINENO - 1;
SEMI = 1;
// 160 %finish
L_001B:;
// 161 %if sym='|' %start
if (SYM != 124) goto L_001C;
// 162 readsymbol(sym) %and printsymbol(sym) %until sym=nl
L_001D:;
_imp_READSYMBOL(/*?*/ &SYM);
_imp_PRINTSYMBOL(SYM);
if (SYM == 10) goto L_001E;
goto L_001D;
L_001E:;
// 163 %finish
L_001C:;
// 164 %finish
L_0015:;
// 165 lineno=lineno+1 %if sym=nl
if (SYM != 10) goto L_001F;
LINENO = LINENO + 1;
L_001F:;
// 166 line(lpos)=sym; lpos=lpos+1
LINE[LPOS - 1] = SYM;
LPOS = LPOS + 1;
// 167 %repeatuntil sym=nl %and quoted=0
if (SYM != 10) goto L_0020;
if (QUOTED == 0) goto L_0021;
L_0020:;
goto L_000A;
L_0021:;
// 168 %repeatuntil lpos>2; ! non-empty line
if (LPOS > 2) goto L_0022;
goto L_0008;
L_0022:;
// 169
// 170 ! Now decompose line into atoms
// 171
// 172 atompos=1; ifpos=0; lpos=1
ATOMPOS = 1;
IFPOS = 0;
LPOS = 1;
// 173 nextatom:
U_1001:;
// 174 %cycle
L_0023:;
// 175 sym=line(lpos); lpos=lpos+1
SYM = LINE[LPOS - 1];
LPOS = LPOS + 1;
// 176 ->tag %if 'A'<=sym<='Z'
{
// Double-sided test on SYM (Part I)
int tmp;
if (65 > (tmp = SYM)) goto L_0024;
// Double-sided test on SYM (Part II)
if (tmp > 90) goto L_0024;
}
goto U_1002;
L_0024:;
// 177 ->num %if '0'<=sym<='9'
{
// Double-sided test on SYM (Part I)
int tmp;
if (48 > (tmp = SYM)) goto L_0025;
// Double-sided test on SYM (Part II)
if (tmp > 57) goto L_0025;
}
goto U_1003;
L_0025:;
// 178 %if sym=nl %start
if (SYM != 10) goto L_0026;
// 179 putatom(sep,0); atompos=1; %return
PUTATOM(14, 0);
ATOMPOS = 1;
return;
// 180 %finish
L_0026:;
// 181 %if sym=':' %start
if (SYM != 58) goto L_0027;
// 182 putatom(colon,0)
PUTATOM(13, 0);
// 183 %finishelseif sym='+' %start
goto L_0028;
L_0027:;
if (SYM != 43) goto L_0029;
// 184 putatom(op,add)
PUTATOM(11, 2);
// 185 %finishelseif sym='-' %start
goto L_0028;
L_0029:;
if (SYM != 45) goto L_002A;
// 186 putatom(op,sub)
PUTATOM(11, 3);
// 187 %finishelseif sym='&' %start
goto L_0028;
L_002A:;
if (SYM != 38) goto L_002B;
// 188 putatom(op,and)
PUTATOM(11, 4);
// 189 %finishelseif sym='!' %start
goto L_0028;
L_002B:;
if (SYM != 33) goto L_002C;
// 190 putatom(op,or)
PUTATOM(11, 5);
// 191 %finishelseif sym='\' %start
goto L_0028;
L_002C:;
if (SYM != 92) goto L_002D;
// 192 putatom(op,xor)
PUTATOM(11, 6);
// 193 %finishelseif sym='*' %start
goto L_0028;
L_002D:;
if (SYM != 42) goto L_002E;
// 194 putatom(op,mul)
PUTATOM(11, 8);
// 195 %finishelseif sym='%' %start
goto L_0028;
L_002E:;
if (SYM != 37) goto L_002F;
// 196 putatom(op,rem)
PUTATOM(11, 10);
// 197 %finishelseif sym='/' %start
goto L_0028;
L_002F:;
if (SYM != 47) goto L_0030;
// 198 putatom(op,div)
PUTATOM(11, 9);
// 199 %finishelseif sym='<' %or sym='>' %start
goto L_0028;
L_0030:;
if (SYM == 60) goto L_0031;
if (SYM != 62) goto L_0032;
L_0031:;
// 200 %if line(lpos)=sym %start; ! '<<', '>>'
if (LINE[LPOS - 1] != SYM) goto L_0033;
// 201 lpos=lpos+1
LPOS = LPOS + 1;
// 202 %if sym='<' %then putatom(op,left) %else putatom(op,right)
if (SYM != 60) goto L_0034;
PUTATOM(11, 11);
goto L_0035;
L_0034:;
PUTATOM(11, 12);
L_0035:;
// 203 %else; ! '<', '>', '<=', '>='
goto L_0036;
L_0033:;
// 204 square: !+'[', ']', '[=', ']='
U_1004:;
// 205 %if line(lpos)='=' %start
if (LINE[LPOS - 1] != 61) goto L_0037;
// 206 lpos=lpos+1; sym=sym+128
LPOS = LPOS + 1;
SYM = SYM + 128;
// 207 %finish
L_0037:;
// 208 putatom(comp,sym)
PUTATOM(12, SYM);
// 209 %finish
L_0036:;
// 210 %finishelseif sym='(' %or sym=')' %start
goto L_0028;
L_0032:;
if (SYM == 40) goto L_0038;
if (SYM != 41) goto L_0039;
L_0038:;
// 211 putatom(bracket,sym)
PUTATOM(15, SYM);
// 212 %finishelseif sym='[' %or sym=']' %start
goto L_0028;
L_0039:;
if (SYM == 91) goto L_003A;
if (SYM != 93) goto L_003B;
L_003A:;
// 213 ->square
goto U_1004;
// 214 %finishelseif sym='=' %or sym='#' %start
L_003B:;
if (SYM == 61) goto L_003C;
if (SYM != 35) goto L_003D;
L_003C:;
// 215 putatom(comp,sym)
PUTATOM(12, SYM);
// 216 %finishelseif sym='"' %start
goto L_0028;
L_003D:;
if (SYM != 34) goto L_003E;
// 217 putatom(string,lpos)
PUTATOM(2, LPOS);
// 218 lpos=lpos+1 %while line(lpos)#'"'; ! we know it's there
L_003F:;
if (LINE[LPOS - 1] == 34) goto L_0040;
LPOS = LPOS + 1;
goto L_003F;
L_0040:;
// 219 lpos=lpos+1
LPOS = LPOS + 1;
// 220 %finishelseif sym='''' %start
goto L_0028;
L_003E:;
if (SYM != 39) goto L_0041;
// 221 sym=line(lpos); lpos=lpos+1 %if sym=''''
SYM = LINE[LPOS - 1];
if (SYM != 39) goto L_0042;
LPOS = LPOS + 1;
L_0042:;
// 222 fault(atom) %if line(lpos+1)#''''
if (LINE[LPOS + 1 - 1] == 39) goto L_0043;
FAULT(2);
L_0043:;
// 223 putatom(constant,sym); lpos=lpos+2
PUTATOM(1, SYM);
LPOS = LPOS + 2;
// 224 %else
goto L_0028;
L_0041:;
// 225 fault(atom) %unless sym=' '
if (SYM == 32) goto L_0044;
FAULT(2);
L_0044:;
// 226 %finish
L_0028:;
// 227 %repeat
goto L_0023;
// 228 num: i=0; radix=10; ! I accumulates number, default radix is ten
U_1003:;
I = 0;
RADIX = 10;
// 229 %cycle
L_0045:;
// 230 %if sym='_' %start; ! change radix
if (SYM != 95) goto L_0046;
// 231 radix=i; i=0
RADIX = I;
I = 0;
// 232 %finishelseif '9'<sym<'A' %start
goto L_0047;
L_0046:;
{
// Double-sided test on SYM (Part I)
int tmp;
if (57 >= (tmp = SYM)) goto L_0048;
// Double-sided test on SYM (Part II)
if (tmp >= 65) goto L_0048;
}
// 233 endconst: putatom(constant,i); lpos=lpos-1; ->nextatom
U_1005:;
PUTATOM(1, I);
LPOS = LPOS - 1;
goto U_1001;
// 234 %else
L_0048:;
// 235 sym=sym-7 %if sym>'9'; sym=sym-'0'
if (SYM <= 57) goto L_0049;
SYM = SYM - 7;
L_0049:;
SYM = SYM - 48;
// 236 ->endconst %unless 0<=sym<radix
{
// Double-sided test on SYM (Part I)
int tmp;
if (0 > (tmp = SYM)) goto L_004A;
// Double-sided test on SYM (Part II)
if (tmp < RADIX) goto L_004B;
}
L_004A:;
goto U_1005;
L_004B:;
// 237 i=i*radix+sym
I = I * RADIX + SYM;
// 238 %finish
L_0047:;
// 239 sym=line(lpos); lpos=lpos+1
SYM = LINE[LPOS - 1];
LPOS = LPOS + 1;
// 240 %repeat
goto L_0045;
// 241 tag: n1=sym-'A'+1; n2=0; i=1; ! I counts name length
U_1002:;
N1 = SYM - 65 + 1;
N2 = 0;
I = 1;
// 242 %cycle
L_004C:;
// 243 sym=line(lpos)
SYM = LINE[LPOS - 1];
// 244 %if 'A'<=sym<='Z' %start
{
// Double-sided test on SYM (Part I)
int tmp;
if (65 > (tmp = SYM)) goto L_004D;
// Double-sided test on SYM (Part II)
if (tmp > 90) goto L_004D;
}
// 245 sym=sym-'A'+1
SYM = SYM - 65 + 1;
// 246 %finishelseif '0'<=sym<='9' %start
goto L_004E;
L_004D:;
{
// Double-sided test on SYM (Part I)
int tmp;
if (48 > (tmp = SYM)) goto L_004F;
// Double-sided test on SYM (Part II)
if (tmp > 57) goto L_004F;
}
// 247 sym=sym-'0'+27
SYM = SYM - 48 + 27;
// 248 %else
goto L_004E;
L_004F:;
// 249 %if n1=if %start
if (N1 != 339) goto L_0050;
// 250 fault(form) %unless ifpos=0
if (IFPOS == 0) goto L_0051;
FAULT(5);
L_0051:;
// 251 ifpos=atompos; putatom(sep,0)
IFPOS = ATOMPOS;
PUTATOM(14, 0);
// 252 %else; ! Look up in dictionary
goto L_0052;
L_0050:;
// 253 %for i=tagpos-1,-1,1 %cycle
// %for I = TAGPOS - 1, -1, 1 %cycle
{
int _initial = TAGPOS - 1;
if (invalid_for_loop(_initial, -1, 1)) _imp_signal(5, 1, 0, "Illegal cycle I = TAGPOS - 1, -1, 1");
I = _initial - (-1);
L_0053:
if (I == 1) goto L_0054;
I -= 1;
// 254 %if tag1(i)=n1 %and tag2(i)=n2 %start
if (TAG1[I - 1] != N1) goto L_0056;
if (TAG2[I - 1] != N2) goto L_0056;
// 255 n1=tagtype(i); n2=tagval(i)
N1 = TAGTYPE[I - 1];
N2 = TAGVAL[I - 1];
// 256 n2=i %if n1=unknown
if (N1 != 0) goto L_0057;
N2 = I;
L_0057:;
// 257 putatom(n1,n2)
PUTATOM(N1, N2);
// 258 ->nextatom
goto U_1001;
// 259 %finish
L_0056:;
// 260 %repeat
goto L_0053;
}
L_0054:;
// 261 ! Not found: enter name and details
// 262 tag1(tagpos)=n1; tag2(tagpos)=n2
TAG1[TAGPOS - 1] = N1;
TAG2[TAGPOS - 1] = N2;
// 263 tagtype(tagpos)=unknown; tagval(tagpos)=0
TAGTYPE[TAGPOS - 1] = 0;
TAGVAL[TAGPOS - 1] = 0;
// 264 putatom(unknown,tagpos)
PUTATOM(0, TAGPOS);
// 265 %if tagpos>tagmax %then fault(dfull) %else tagpos=tagpos+1
if (TAGPOS <= 200) goto L_0058;
FAULT(13);
L_0058:;
TAGPOS = TAGPOS + 1;
// 266 %finish
L_0052:;
// 267 ->nextatom
goto U_1001;
// 268 %finish
L_004E:;
// 269 %if i<3 %start
if (I >= 3) goto L_0059;
// 270 n1=n1*37+sym
N1 = N1 * 37 + SYM;
// 271 %finishelseif i<6 %start
goto L_005A;
L_0059:;
if (I >= 6) goto L_005B;
// 272 n2=n2*37+sym
N2 = N2 * 37 + SYM;
// 273 %finish
L_005B:;
L_005A:;
// 274 i=i+1; lpos=lpos+1
I = I + 1;
LPOS = LPOS + 1;
// 275 %repeat
goto L_004C;
// 276 %end
} /* end of READLINE */
// 277
// 278 %routine nextatom
void NEXTATOM(void) {
// 279 type=atomtype(atompos); val=atomval(atompos)
TYPE = ATOMTYPE[ATOMPOS - 1];
VAL = ATOMVAL[ATOMPOS - 1];
// 280 atompos=atompos+1 %unless type=sep
if (TYPE == 14) goto L_005C;
ATOMPOS = ATOMPOS + 1;
L_005C:;
// 281 %end
return;
} /* end of NEXTATOM */
// 282
// 283 %predicate open bracket
int OPENBRACKET(void) {
// 284 %falseunless atomtype(atompos)=bracket %and atomval(atompos)='('
if (ATOMTYPE[ATOMPOS - 1] != 15) goto L_0005;
if (ATOMVAL[ATOMPOS - 1] == 40) goto L_005D;
L_0005:;
return 0 /*FALSE*/;
L_005D:;
// 285 atompos=atompos+1; %true
ATOMPOS = ATOMPOS + 1;
return 1 /*TRUE*/;
// 286 %end
} /* end of OPENBRACKET */
// 287
// 288 %routine close bracket
void CLOSEBRACKET(void) {
// 289 fault(form) %unless atomtype(atompos)=bracket %and atomval(atompos)=')'
if (ATOMTYPE[ATOMPOS - 1] != 15) goto L_005E;
if (ATOMVAL[ATOMPOS - 1] == 41) goto L_005F;
L_005E:;
FAULT(5);
L_005F:;
// 290 atompos=atompos+1
ATOMPOS = ATOMPOS + 1;
// 291 %end
return;
} /* end of CLOSEBRACKET */
// 292
// 293 %predicate equal sign
int EQUALSIGN(void) {
// 294 %falseunless atomtype(atompos)=comp %and atomval(atompos)='='
if (ATOMTYPE[ATOMPOS - 1] != 12) goto L_0060;
if (ATOMVAL[ATOMPOS - 1] == 61) goto L_0061;
L_0060:;
return 0 /*FALSE*/;
L_0061:;
// 295 atompos=atompos+1; %true
ATOMPOS = ATOMPOS + 1;
return 1 /*TRUE*/;
// 296 %end
} /* end of EQUALSIGN */
auto void UNARY(void);
// 297
// 298 %routinespec unary
// 299
// 300 %integerfn cexpr(%integer must)
int CEXPR(int MUST) {
// 301 %integer value,oper
int VALUE;
int OPER;
// 302 %switch s(add:right)
int S_index;
int S_line;
char *S_file;
static const void *S[11] = {&&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};
// 303 nextatom; unary
NEXTATOM();
UNARY();
// 304 value=val; fault(consterr) %unless type=constant
VALUE = VAL;
if (TYPE == 1) goto L_0062;
FAULT(3);
L_0062:;
// 305 %cycle
L_0063:;
// 306 %result=value %unless atomtype(atompos)=op
if (ATOMTYPE[ATOMPOS - 1] == 11) goto L_0064;
return VALUE;
L_0064:;
// 307 %if must=0 %start
if (MUST != 0) goto L_0065;
// 308 %result=value %unless atomtype(atompos+1)=constant
if (ATOMTYPE[ATOMPOS + 1 - 1] == 1) goto L_0066;
return VALUE;
L_0066:;
// 309 %finish
L_0065:;
// 310 oper=atomval(atompos); atompos=atompos+1
OPER = ATOMVAL[ATOMPOS - 1];
ATOMPOS = ATOMPOS + 1;
// 311 nextatom; fault(consterr) %unless type=constant
NEXTATOM();
if (TYPE == 1) goto L_0067;
FAULT(3);
L_0067:;
// 312 ->s(oper)
S_line = __LINE__;
S_file = __FILE__;
S_index = OPER;
goto case_S_dispatch;
// 313 s(add): value=value+val; %continue
case_S_2:;
VALUE = VALUE + VAL;
goto L_0069;
// 314 s(sub): value=value-val; %continue
case_S_3:;
VALUE = VALUE - VAL;
goto L_0069;
// 315 s(and): value=value&val; %continue
case_S_4:;
VALUE = VALUE & VAL;
goto L_0069;
// 316 s(or): value=value!val; %continue
case_S_5:;
VALUE = VALUE | VAL;
goto L_0069;
// 317 s(xor): value=value!!val; %continue
case_S_6:;
VALUE = VALUE ^ VAL;
goto L_0069;
// 318 s(rem): value=value-value//val*val; %continue
case_S_10:;
VALUE = VALUE - ((long)VALUE / (long)VAL) * VAL;
goto L_0069;
// 319 s(div): value=value//val; %continue
case_S_9:;
VALUE = ((long)VALUE / (long)VAL);
goto L_0069;
// 320 s(mul): value=value*val; %continue
case_S_8:;
VALUE = VALUE * VAL;
goto L_0069;
// 321 s(left): value=value<<val; %continue
case_S_11:;
VALUE = VALUE << VAL;
goto L_0069;
// 322 s(right):value=value>>val
case_S_12:;
VALUE = (unsigned int)VALUE >> VAL;
// 323 %repeat
L_0069:;
goto L_0063;
// 324 %end
case_S_dispatch:
if (S_index < 2 || S_index > 12)
_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 - 2];
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 CEXPR */
// 325
// 326 %routine unary
void UNARY(void) {
// 327 %integername v
int *V;
// 328 %returnunless type=op %and atomtype(atompos)=constant
if (TYPE != 11) goto L_006A;
if (ATOMTYPE[ATOMPOS - 1] == 1) goto L_006B;
L_006A:;
return;
L_006B:;
// 329 %returnunless val=sub %or val=xor
if (VAL == 3) goto L_006C;
if (VAL == 6) goto L_006C;
return;
L_006C:;
// 330 v==atomval(atompos)
V = (int *)/*?*/ &ATOMVAL[ATOMPOS - 1];
// 331 v=\v; v=v+1 %if val=sub
*V = (~*V);
if (VAL != 3) goto L_006D;
*V = *V + 1;
L_006D:;
// 332 val=cexpr(0); type=constant
VAL = CEXPR(0);
TYPE = 1;
// 333 %end
return;
} /* end of UNARY */
// 334
// 335 %routine gbyte(%integer b)
void GBYTE(int B) {
// 336 fault(bfull) %if gpos>glamax
if (GPOS <= 499) goto L_006E;
FAULT(4);
L_006E:;
// 337 gla(gpos)=b&255; gpos=gpos+1; gloc=gloc+1
GLA[GPOS] = B & 255;
GPOS = GPOS + 1;
GLOC = GLOC + 1;
// 338 %end
return;
} /* end of GBYTE */
// 339
// 340 %routine gword(%integer x)
void GWORD(int X) {
// 341 gbyte(x); gbyte(x>>8)
GBYTE(X);
GBYTE((unsigned int)X >> 8);
// 342 %end
return;
} /* end of GWORD */
// 343
// 344 %routine gflush
void GFLUSH(void) {
// 345 %integer i
int I;
// 346 %returnif gpos=0
if (GPOS != 0) goto L_006F;
return;
L_006F:;
// 347 selectoutput(object); printsymbol(2); printsymbol(4)
_imp_SELECTOUTPUT(1);
_imp_PRINTSYMBOL(2);
_imp_PRINTSYMBOL(4);
// 348 printsymbol(gpos&255); printsymbol(gpos>>8&255)
_imp_PRINTSYMBOL(GPOS & 255);
_imp_PRINTSYMBOL((unsigned int)GPOS >> 8 & 255);
// 349 printsymbol(gla(i)) %for i=0,1,gpos-1
// %for I = 0, 1, GPOS - 1 %cycle
{
int _final = GPOS - 1;
if (invalid_for_loop(0, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle I = 0, 1, GPOS - 1");
I = -1;
L_0070:
if (I == _final) goto L_0071;
I += 1;
_imp_PRINTSYMBOL(GLA[I]);
goto L_0070;
}
L_0071:;
// 350 gpos=0
GPOS = 0;
// 351 %end
return;
} /* end of GFLUSH */
// 352
// 353 %routine dumpstring(%integer p)
void DUMPSTRING(int P) {
// 354 %integer l
int L;
// 355 l=0
L = 0;
// 356 l=l+1 %and p=p+1 %while line(p)#'"'
L_0073:;
if (LINE[P - 1] == 34) goto L_0074;
L = L + 1;
P = P + 1;
goto L_0073;
L_0074:;
// 357 gbyte(l); p=p-l
GBYTE(L);
P = P - L;
// 358 gbyte(line(p)) %and p=p+1 %and l=l-1 %while l>0
L_0075:;
if (L <= 0) goto L_0076;
GBYTE(LINE[P - 1]);
P = P + 1;
L = L - 1;
goto L_0075;
L_0076:;
// 359 %end
return;
} /* end of DUMPSTRING */
// 360
// 361 %routine dump(%integer byte)
void DUMP(int BYTE) {
// 362 fault(bfull) %if cpos>codemax
if (CPOS <= 3499) goto L_0077;
FAULT(4);
L_0077:;
// 363 code(cpos)=byte&255; cpos=cpos+1; cloc=cloc+1
CODE[CPOS] = BYTE & 255;
CPOS = CPOS + 1;
CLOC = CLOC + 1;
// 364 %end
return;
} /* end of DUMP */
// 365
// 366 %routine flush
void FLUSH(void) {
// 367 %integer i
int I;
// 368 %returnif cpos=0
if (CPOS != 0) goto L_0078;
return;
L_0078:;
// 369 selectoutput(object); printsymbol(1); printsymbol(4)
_imp_SELECTOUTPUT(1);
_imp_PRINTSYMBOL(1);
_imp_PRINTSYMBOL(4);
// 370 printsymbol(cpos&255); printsymbol(cpos>>8&255)
_imp_PRINTSYMBOL(CPOS & 255);
_imp_PRINTSYMBOL((unsigned int)CPOS >> 8 & 255);
// 371 printsymbol(code(i)) %for i=0,1,cpos-1
// %for I = 0, 1, CPOS - 1 %cycle
{
int _final = CPOS - 1;
if (invalid_for_loop(0, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle I = 0, 1, CPOS - 1");
I = -1;
L_0079:
if (I == _final) goto L_007A;
I += 1;
_imp_PRINTSYMBOL(CODE[I]);
goto L_0079;
}
L_007A:;
// 372 cpos=0
CPOS = 0;
// 373 %end
return;
} /* end of FLUSH */
// 374
// 375 %routine satrefs(%integer ref,val)
void SATREFS(int REF, int VAL) {
// 376 %integer abs,rel,disp
int ABS;
int REL;
int DISP;
// 377 %while ref#0 %cycle
L_007B:;
if (REF == 0) goto L_007C;
// 378 rel=ref; abs=rel-cloc+cpos; disp=val-rel-2
REL = REF;
ABS = REL - CLOC + CPOS;
DISP = VAL - REL - 2;
// 379 ref=code(abs+1)<<8+code(abs)
REF = (CODE[ABS + 1] << 8) + CODE[ABS];
// 380 code(abs)=disp&255; code(abs+1)=disp>>8&255
CODE[ABS] = DISP & 255;
CODE[ABS + 1] = (unsigned int)DISP >> 8 & 255;
// 381 %repeat
goto L_007B;
L_007C:;
// 382 %end
return;
} /* end of SATREFS */
// 383
// 384 %routine labelref(%integer type,val)
void LABELREF(int TYPE, int VAL) {
// 385 %integer tvv
int TVV;
// 386 %if type=label %start
if (TYPE != 3) goto L_007D;
// 387 val=val-(cloc+2)
VAL = VAL - (CLOC + 2);
// 388 dump(val); dump(val>>8)
DUMP(VAL);
DUMP((unsigned int)VAL >> 8);
// 389 %else
goto L_007E;
L_007D:;
// 390 fault(form) %unless type=unknown
if (TYPE == 0) goto L_007F;
FAULT(5);
L_007F:;
// 391 tvv=tagval(val)
TVV = TAGVAL[VAL - 1];
// 392 dump(tvv); dump(tvv>>8)
DUMP(TVV);
DUMP((unsigned int)TVV >> 8);
// 393 tagval(val)=cloc-2
TAGVAL[VAL - 1] = CLOC - 2;
// 394 %finish
L_007E:;
// 395 %end
return;
} /* end of LABELREF */
// 396
// 397 %routine pushtext(%integer t,v)
void PUSHTEXT(int T, int V) {
// 398 textlevel=textlevel+1
TEXTLEVEL = TEXTLEVEL + 1;
// 399 fault(complex) %if textlevel>textmax
if (TEXTLEVEL <= 20) goto L_0080;
FAULT(1);
L_0080:;
// 400 texttype(textlevel)=t; textval(textlevel)=v
TEXTTYPE[TEXTLEVEL - 1] = T;
TEXTVAL[TEXTLEVEL - 1] = V;
// 401 %end
return;
} /* end of PUSHTEXT */
// 402
// 403 %routine poptext
void POPTEXT(void) {
// 404 fault(context) %if textlevel=0
if (TEXTLEVEL != 0) goto L_0081;
FAULT(16);
L_0081:;
// 405 type=texttype(textlevel); val=textval(textlevel)
TYPE = TEXTTYPE[TEXTLEVEL - 1];
VAL = TEXTVAL[TEXTLEVEL - 1];
// 406 textlevel=textlevel-1
TEXTLEVEL = TEXTLEVEL - 1;
// 407 %end
return;
} /* end of POPTEXT */
auto void EXPR(void);
// 408
// 409 %routinespec expr
// 410
// 411 %constinteger pushax=16_50,popax=16_58
// 412
// 413 %routine call(%integer t,v)
void CALL(int T, int V) {
// 414 type=atomtype(atompos)
TYPE = ATOMTYPE[ATOMPOS - 1];
// 415 %if type#op %start
if (TYPE == 11) goto L_0082;
// 416 %cycle
L_0083:;
// 417 %exitif type=sep %or type=comp
if (TYPE == 14) goto L_0084;
if (TYPE != 12) goto L_0085;
L_0084:;
goto L_0086;
L_0085:;
// 418 expr; dump(pushax); type=atomtype(atompos)
EXPR();
DUMP(80);
TYPE = ATOMTYPE[ATOMPOS - 1];
// 419 %repeat
goto L_0083;
L_0086:;
// 420 %finish
L_0082:;
// 421 %if t=spec %start
if (T != 10) goto L_0087;
// 422 dump(16_FF); dump(16_1e); dump(v); dump(v>>8); !Xcall
DUMP(255);
DUMP(30);
DUMP(V);
DUMP((unsigned int)V >> 8);
// 423 %else
goto L_0088;
L_0087:;
// 424 dump(16_0e); dump(16_e8); labelref(label,v); !PushCs, Call
DUMP(14);
DUMP(232);
LABELREF(3, V);
// 425 %finish
L_0088:;
// 426 %end
return;
} /* end of CALL */
// 427
// 428 %routine immediate(%integer op,val)
void IMMEDIATE(int OP, int VAL) {
// 429 %switch s(load:right)
int S_index;
int S_line;
char *S_file;
static const void *S[12] = {&&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};
// 430 ->s(op)
S_line = __LINE__;
S_file = __FILE__;
S_index = OP;
goto case_S_dispatch;
// 431 s(load): dump(16_b8); ->imm
case_S_1:;
DUMP(184);
goto U_1006;
// 432 s(add): dump(16_05); ->imm
case_S_2:;
DUMP(5);
goto U_1006;
// 433 s(sub): dump(16_2d); ->imm
case_S_3:;
DUMP(45);
goto U_1006;
// 434 s(and): dump(16_25); ->imm
case_S_4:;
DUMP(37);
goto U_1006;
// 435 s(or): dump(16_0d); ->imm
case_S_5:;
DUMP(13);
goto U_1006;
// 436 s(xor): dump(16_35); ->imm
case_S_6:;
DUMP(53);
goto U_1006;
// 437 s(cmp): dump(16_3d)
case_S_7:;
DUMP(61);
// 438 imm: dump(val); dump(val>>8); %return
U_1006:;
DUMP(VAL);
DUMP((unsigned int)VAL >> 8);
return;
// 439 s(left):
case_S_11:;
// 440 s(right):
case_S_12:;
// 441 %if val=1 %start
if (VAL != 1) goto L_008A;
// 442 val=16_d1
VAL = 209;
// 443 %else
goto L_008B;
L_008A:;
// 444 dump(16_b1); dump(val&15); !Mov CL,nn
DUMP(177);
DUMP(VAL & 15);
// 445 val=16_d3
VAL = 211;
// 446 %finish
L_008B:;
// 447 dump(val)
DUMP(VAL);
// 448 %if op=left %then dump(16_e0) %else dump(16_e8)
if (OP != 11) goto L_008C;
DUMP(224);
goto L_008D;
L_008C:;
DUMP(232);
L_008D:;
// 449 %return
return;
// 450 s(mul):s(div):s(rem):
case_S_8:;
case_S_9:;
case_S_10:;
// 451 dump(16_b9); dump(val); dump(val>>8); !Mov CX,nn
DUMP(185);
DUMP(VAL);
DUMP((unsigned int)VAL >> 8);
// 452 dump(16_99) %unless op=mul; !Cwd
if (OP == 8) goto L_008E;
DUMP(153);
L_008E:;
// 453 dump(16_f7)
DUMP(247);
// 454 %if op=mul %then dump(16_e9) %else dump(16_f9)
if (OP != 8) goto L_008F;
DUMP(233);
goto L_0090;
L_008F:;
DUMP(249);
L_0090:;
// 455 %returnunless op=rem
if (OP == 10) goto L_0091;
return;
L_0091:;
// 456 dump(16_8b); dump(16_c2); !Mov ax,dx
DUMP(139);
DUMP(194);
// 457 %end
return;
case_S_dispatch:
if (S_index < 1 || S_index > 12)
_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 - 1];
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 IMMEDIATE */
// 458
// 459 %routine direct(%integer op,type,val,index)
void DIRECT(int OP, int TYPE, int VAL, int INDEX) {
// 460 %ownintegerarray code(load:lea)=
static int CODE[14] = {138, 2, 42, 34, 10, 50, 58, 40, 56, 48, 224, 232, 136, 141};
// 461+ 16_8a, 16_02, 16_2a, 16_22, 16_0a,
// 462+ 16_32, 16_3a, 16_28, 16_38, 16_30,
// 463+ 16_e0, 16_e8, 16_88, 16_8d
// 464 %integer oper,extra
int OPER;
int EXTRA;
// 465 immediate(op,val) %andreturnif type=constant
if (TYPE != 1) goto L_0092;
IMMEDIATE(OP, VAL);
return;
L_0092:;
// 466 oper=code(op)
OPER = CODE[OP - 1];
// 467 ->shift %if op=left %or op=right
if (OP == 11) goto L_0072;
if (OP != 12) goto L_0093;
L_0072:;
goto U_1007;
L_0093:;
// 468 extra=0; extra=oper %and oper=16_f6 %if op=mul
EXTRA = 0;
if (OP != 8) goto L_0094;
EXTRA = OPER;
OPER = 246;
L_0094:;
// 469 %if op=div %or op=rem %start
if (OP == 9) goto L_0095;
if (OP != 10) goto L_0096;
L_0095:;
// 470 %if type&wordbit#0 %then dump(16_99) %else dump(16_98)
if (TYPE & 1 == 0) goto L_0097;
DUMP(153);
goto L_0098;
L_0097:;
DUMP(152);
L_0098:;
// 471 extra=oper; oper=16_f6
EXTRA = OPER;
OPER = 246;
// 472 %finish
L_0096:;
// 473 oper=oper+1 %if type&wordbit#0
if (TYPE & 1 == 0) goto L_0099;
OPER = OPER + 1;
L_0099:;
// 474 dump(oper)
DUMP(OPER);
// 475 %if type=bx %then dump(16_c3+extra) %andreturn
if (TYPE != 17) goto L_009A;
DUMP(195 + EXTRA);
return;
L_009A:;
// 476 %if type=unknown %start
if (TYPE != 0) goto L_009B;
// 477 tagtype(val)=var+wordbit
TAGTYPE[VAL - 1] = 4 + 1;
// 478 tagval(val)=-2
TAGVAL[VAL - 1] = -2;
// 479 fault(varund)
FAULT(12);
// 480 %finish
L_009B:;
// 481 fault(form) %unless type&varmask=var
if (TYPE & 252 == 4) goto L_009C;
FAULT(5);
L_009C:;
// 482 %if type&glabit=0 %start
if (TYPE & 2 != 0) goto L_009D;
// 483 %if -128<=val<=127 %then oper=16_42 %else oper=16_82
{
// Double-sided test on VAL (Part I)
int tmp;
if (-128 > (tmp = VAL)) goto L_009E;
// Double-sided test on VAL (Part II)
if (tmp > 127) goto L_009E;
}
OPER = 66;
goto L_009F;
L_009E:;
OPER = 130;
L_009F:;
// 484 oper=oper+4 %if index=0
if (INDEX != 0) goto L_00A0;
OPER = OPER + 4;
L_00A0:;
// 485 %else
goto L_00A1;
L_009D:;
// 486 %if index=0 %start
if (INDEX != 0) goto L_00A2;
// 487 oper=6
OPER = 6;
// 488 %finishelseif -128<=val<=127 %start
goto L_00A3;
L_00A2:;
{
// Double-sided test on VAL (Part I)
int tmp;
if (-128 > (tmp = VAL)) goto L_00A4;
// Double-sided test on VAL (Part II)
if (tmp > 127) goto L_00A4;
}
// 489 oper=16_44
OPER = 68;
// 490 %else
goto L_00A3;
L_00A4:;
// 491 oper=16_84
OPER = 132;
// 492 %finish
L_00A3:;
// 493 %finish
L_00A1:;
// 494 dump(oper+extra); dump(val)
DUMP(OPER + EXTRA);
DUMP(VAL);
// 495 dump(val>>8) %if oper&16_40=0
if (OPER & 64 != 0) goto L_00A5;
DUMP((unsigned int)VAL >> 8);
L_00A5:;
// 496 dump(16_8B) %and dump(16_C2) %if op=rem
if (OP != 10) goto L_00A6;
DUMP(139);
DUMP(194);
L_00A6:;
// 497 %if type&wordbit=0 %and op=load %then dump(16_32) %and dump(16_e4)
if (TYPE & 1 != 0) goto L_00A7;
if (OP != 1) goto L_00A7;
DUMP(50);
DUMP(228);
L_00A7:;
// 498 %return
return;
// 499 shift: dump(pushax)
U_1007:;
DUMP(80);
// 500 direct(load,type,val,index); dump(16_89); dump(16_c1); !Mov Cx,Ax
DIRECT(1, TYPE, VAL, INDEX);
DUMP(137);
DUMP(193);
// 501 dump(popax)
DUMP(88);
// 502 %if type&wordbit=0 %then dump(16_d2) %else dump(16_d3)
if (TYPE & 1 != 0) goto L_00A8;
DUMP(210);
goto L_00A9;
L_00A8:;
DUMP(211);
L_00A9:;
// 503 dump(oper)
DUMP(OPER);
// 504 %end
return;
} /* end of DIRECT */
// 505
// 506 %routine double(%integer t); ! index for word arrays
void DOUBLE(int T) {
// 507 %returnif t&wordbit=0
if (T & 1 != 0) goto L_00AA;
return;
L_00AA:;
// 508 dump(16_03); dump(16_c0); !Add ax,ax
DUMP(3);
DUMP(192);
// 509 %end
return;
} /* end of DOUBLE */
// 510
// 511 %routine expr
void EXPR(void) {
// 512 %integer oper,t,v,index
int OPER;
int T;
int V;
int INDEX;
// 513 oper=load
OPER = 1;
// 514 %cycle
L_00AB:;
// 515 nextatom; unary
NEXTATOM();
UNARY();
// 516 %if type=constant %start
if (TYPE != 1) goto L_00AC;
// 517 atompos=atompos-1 %and val=cexpr(0) %if oper=load
if (OPER != 1) goto L_00AD;
ATOMPOS = ATOMPOS - 1;
VAL = CEXPR(0);
L_00AD:;
// 518 immediate(oper,val)
IMMEDIATE(OPER, VAL);
// 519 %finishelseif type&varmask=var %start
goto L_00AE;
L_00AC:;
if (TYPE & 252 != 4) goto L_00AF;
// 520 t=type; v=val
T = TYPE;
V = VAL;
// 521 %if open bracket %start
if (!(OPENBRACKET())) goto L_00B0;
// 522 dump(pushax) %unless oper=load
if (OPER == 1) goto L_00B1;
DUMP(80);
L_00B1:;
// 523 expr; double(t)
EXPR();
DOUBLE(T);
// 524 dump(16_8b); dump(16_f0); !Mov si,ax
DUMP(139);
DUMP(240);
// 525 dump(popax) %unless oper=load
if (OPER == 1) goto L_00B2;
DUMP(88);
L_00B2:;
// 526 close bracket
CLOSEBRACKET();
// 527 index=1
INDEX = 1;
// 528 %finishelse index=0
goto L_00B3;
L_00B0:;
INDEX = 0;
L_00B3:;
// 529 direct(oper,t,v,index)
DIRECT(OPER, T, V, INDEX);
// 530 %finishelseif type=proc %or type=xproc %or type=spec %start
goto L_00AE;
L_00AF:;
if (TYPE == 8) goto L_00B4;
if (TYPE == 9) goto L_00B4;
if (TYPE != 10) goto L_00B5;
L_00B4:;
// 531 %if oper=load %start
if (OPER != 1) goto L_00B6;
// 532 call(type,val)
CALL(TYPE, VAL);
// 533 %else
goto L_00B7;
L_00B6:;
// 534 dump(pushax); call(type,val); dump(16_8b); dump(16_d8);!mov bx,ax
DUMP(80);
CALL(TYPE, VAL);
DUMP(139);
DUMP(216);
// 535 dump(popax); direct(oper,bx,0,0)
DUMP(88);
DIRECT(OPER, 17, 0, 0);
// 536 %finish
L_00B7:;
// 537 %else
goto L_00AE;
L_00B5:;
// 538 fault(form)
FAULT(5);
// 539 %finish
L_00AE:;
// 540 %returnunless atomtype(atompos)=op
if (ATOMTYPE[ATOMPOS - 1] == 11) goto L_00B8;
return;
L_00B8:;
// 541 nextatom
NEXTATOM();
// 542 oper=val
OPER = VAL;
// 543 %repeat
goto L_00AB;
// 544 %end
} /* end of EXPR */
// 545
// 546 %routine return
void RETURN(void) {
// 547 dump(16_8b); dump(16_e5); !Mov sp,bp
DUMP(139);
DUMP(229);
// 548 dump(16_5d); dump(16_1f); !Pop bp, pop ds
DUMP(93);
DUMP(31);
// 549 %if parms=0 %then dump(16_cb) %elsestart
if (PARMS != 0) goto L_00B9;
DUMP(203);
goto L_00BA;
L_00B9:;
// 550 dump(16_ca)
DUMP(202);
// 551 dump(parms); dump(parms>>8)
DUMP(PARMS);
DUMP((unsigned int)PARMS >> 8);
// 552 %finish
L_00BA:;
// 553 access=0
ACCESS = 0;
// 554 %end
return;
} /* end of RETURN */
// 555
// 556 %routine terminate declarations
void TERMINATEDECLARATIONS(void) {
// 557 %integer i
int I;
// 558 fault(level0) %if level=0
if (LEVEL != 0) goto L_00BB;
FAULT(11);
L_00BB:;
// 559 %if level=1 %start
if (LEVEL != 1) goto L_00BC;
// 560 level=2; i=-floc
LEVEL = 2;
I = -FLOC;
// 561 %if i>127 %start
if (I <= 127) goto L_00BD;
// 562 dump(16_81); dump(16_ec); dump(i); dump(i>>8); !Sub sp,nn
DUMP(129);
DUMP(236);
DUMP(I);
DUMP((unsigned int)I >> 8);
// 563 %finishelseunless i=0 %start
goto L_00BE;
L_00BD:;
if (I == 0) goto L_00BF;
// 564 dump(16_83); dump(16_ec); dump(i); !sub sp,n
DUMP(131);
DUMP(236);
DUMP(I);
// 565 %finish
L_00BF:;
L_00BE:;
// 566 floc=floc-2
FLOC = FLOC - 2;
// 567 %finish
L_00BC:;
// 568 %end
return;
} /* end of TERMINATEDECLARATIONS */
// 569
// 570 %routine constdef
void CONSTDEF(void) {
// 571 %integer c
int C;
// 572 %cycle
L_00C0:;
// 573 nextatom; %returnif type=sep
NEXTATOM();
if (TYPE != 14) goto L_00C1;
return;
L_00C1:;
// 574 fault(ambig) %unless type=unknown; c=val
if (TYPE == 0) goto L_00C2;
FAULT(6);
L_00C2:;
C = VAL;
// 575 fault(form) %unless equal sign
if (EQUALSIGN()) goto L_00C3;
FAULT(5);
L_00C3:;
// 576 tagtype(c)=constant; tagval(c)=cexpr(1)
TAGTYPE[C - 1] = 1;
TAGVAL[C - 1] = CEXPR(1);
// 577 %repeat
goto L_00C0;
// 578 %end
} /* end of CONSTDEF */
// 579
// 580 %routine vardef(%integer key)
void VARDEF(int KEY) {
// 581 %integer t,lb,ub,c,r
int T;
int LB;
int UB;
int C;
int R;
// 582 %integername v
int *V;
// 583 %cycle
L_00C4:;
// 584 nextatom
NEXTATOM();
// 585 next: %returnif type=sep
U_1008:;
if (TYPE != 14) goto L_00C5;
return;
L_00C5:;
// 586 fault(ambig) %unless type=unknown
if (TYPE == 0) goto L_00C6;
FAULT(6);
L_00C6:;
// 587 t=var
T = 4;
// 588 t=t+wordbit %if key=kword
if (KEY != 18) goto L_00C7;
T = T + 1;
L_00C7:;
// 589 t=t+glabit %if level=0
if (LEVEL != 0) goto L_00C8;
T = T + 2;
L_00C8:;
// 590 tagtype(val)=t; v==tagval(val)
TAGTYPE[VAL - 1] = T;
V = (int *)/*?*/ &TAGVAL[VAL - 1];
// 591 %if open bracket %start
if (!(OPENBRACKET())) goto L_00C9;
// 592 lb=cexpr(1); nextatom; fault(form) %unless type=colon
LB = CEXPR(1);
NEXTATOM();
if (TYPE == 13) goto L_00CA;
FAULT(5);
L_00CA:;
// 593 ub=cexpr(1)+1; close bracket
UB = CEXPR(1) + 1;
CLOSEBRACKET();
// 594 %finishelse lb=0 %and ub=1
goto L_00CB;
L_00C9:;
LB = 0;
UB = 1;
L_00CB:;
// 595 lb=lb+lb %and ub=ub+ub %if key=kword
if (KEY != 18) goto L_00CC;
LB = LB + LB;
UB = UB + UB;
L_00CC:;
// 596 %if level=0 %start
if (LEVEL != 0) goto L_00CD;
// 597 v=gloc-lb; t=v+ub
*V = GLOC - LB;
T = *V + UB;
// 598 %if equal sign %start
if (!(EQUALSIGN())) goto L_00CE;
// 599 %cycle
L_00CF:;
// 600 nextatom
NEXTATOM();
// 601 %if gloc>=t %start
if (GLOC < T) goto L_00D0;
// 602 gflush; ->next
GFLUSH();
goto U_1008;
// 603 %finish
L_00D0:;
// 604 %if type=string %start
if (TYPE != 2) goto L_00D1;
// 605 dumpstring(val)
DUMPSTRING(VAL);
// 606 %finishelseif type=sep %start
goto L_00D2;
L_00D1:;
if (TYPE != 14) goto L_00D3;
// 607 readline
READLINE();
// 608 %finishelsestart
goto L_00D2;
L_00D3:;
// 609 atompos=atompos-1; c=Cexpr(1); r=1
ATOMPOS = ATOMPOS - 1;
C = CEXPR(1);
R = 1;
// 610 %if open bracket %start
if (!(OPENBRACKET())) goto L_00D4;
// 611 r=cexpr(1); close bracket
R = CEXPR(1);
CLOSEBRACKET();
// 612 %finish
L_00D4:;
// 613 %while r>0 %cycle
L_00D5:;
if (R <= 0) goto L_00D6;
// 614 r=r-1; %if key=kword %then gword(c) %else gbyte(c)
R = R - 1;
if (KEY != 18) goto L_00D7;
GWORD(C);
goto L_00D8;
L_00D7:;
GBYTE(C);
L_00D8:;
// 615 %repeat
goto L_00D5;
L_00D6:;
// 616 %finish
L_00D2:;
// 617 %repeat
goto L_00CF;
// 618 %else
L_00CE:;
// 619 selectoutput(object); printsymbol(2); printsymbol(3)
_imp_SELECTOUTPUT(1);
_imp_PRINTSYMBOL(2);
_imp_PRINTSYMBOL(3);
// 620 printsymbol(t&255); printsymbol(t>>8&255); gloc=t
_imp_PRINTSYMBOL(T & 255);
_imp_PRINTSYMBOL((unsigned int)T >> 8 & 255);
GLOC = T;
// 621 %finish
// 622 %else
goto L_00D9;
L_00CD:;
// 623 fault(declate) %if level=2
if (LEVEL != 2) goto L_00DA;
FAULT(8);
L_00DA:;
// 624 floc=floc-ub+lb; v=floc-lb
FLOC = FLOC - UB + LB;
*V = FLOC - LB;
// 625 %finish
L_00D9:;
// 626 %repeat
goto L_00C4;
// 627 %end
} /* end of VARDEF */
// 628
// 629 %routine procdef(%integer key)
void PROCDEF(int KEY) {
// 630 %integer p,sym
int P;
int SYM;
// 631 %string(31)s
_imp_string31 S;
// 632
// 633 %routine getstring
void GETSTRING(void) {
// 634 s=""
_imp_strncpy(/*?*/ &S, ({
__typeof__(_imp_string255) tmp; /*B*/
tmp = _imp_str_literal("");
(void *)&tmp;
}),
/*max:*/ 31);
// 635 %cycle
L_00DB:;
// 636 sym=line(val); %returnif sym='"'; val=val+1; s=s.tostring(sym)
SYM = LINE[VAL - 1];
if (SYM != 34) goto L_00DC;
return;
L_00DC:;
VAL = VAL + 1;
_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(SYM);
(void *)&tmp;
}));
(_imp_string255 *)&tmp;
});
(void *)&tmp;
}),
/*max:*/ 31);
// 637 %repeat
goto L_00DB;
// 638 %end
} /* end of GETSTRING */
// 639
// 640 nextatom; fault(ambig) %unless type=unknown
NEXTATOM();
if (TYPE == 0) goto L_00DD;
FAULT(6);
L_00DD:;
// 641 %if key=kspec %start
if (KEY != 20) goto L_00DE;
// 642 tagtype(val)=spec; tagval(val)=gloc
TAGTYPE[VAL - 1] = 10;
TAGVAL[VAL - 1] = GLOC;
// 643 nextatom; fault(form) %unless type=string
NEXTATOM();
if (TYPE == 2) goto L_00DF;
FAULT(5);
L_00DF:;
// 644 getstring; p=length(s)
GETSTRING();
P = *_imp_LENGTH((_imp_string255 *)/*p*/ /*?*/ &S);
// 645 selectoutput(object); printsymbol(2)
_imp_SELECTOUTPUT(1);
_imp_PRINTSYMBOL(2);
// 646 printsymbol(8); printsymbol(p); printstring(s)
_imp_PRINTSYMBOL(8);
_imp_PRINTSYMBOL(P);
_imp_PRINTSTRING(
*({
__typeof__(_imp_string31) tmp = S /*q*/;
(_imp_string255 *)&tmp;
})
);
// 647 printsymbol(7); printsymbol(0)
_imp_PRINTSYMBOL(7);
_imp_PRINTSYMBOL(0);
// 648 gloc=gloc+4; %return
GLOC = GLOC + 4;
return;
// 649 %finish
L_00DE:;
// 650 fault(nested) %unless level=0; level=1; access=1; textlevel=0
if (LEVEL == 0) goto L_00E0;
FAULT(7);
L_00E0:;
LEVEL = 1;
ACCESS = 1;
TEXTLEVEL = 0;
// 651 v=val; t=proc; nextatom
V = VAL;
T = 8;
NEXTATOM();
// 652 %if type=string %start
if (TYPE != 2) goto L_00E1;
// 653 getstring
GETSTRING();
// 654 selectoutput(object); printsymbol(1); printsymbol(6)
_imp_SELECTOUTPUT(1);
_imp_PRINTSYMBOL(1);
_imp_PRINTSYMBOL(6);
// 655 printsymbol(length(s)); printstring(s)
_imp_PRINTSYMBOL(*_imp_LENGTH((_imp_string255 *)/*p*/ /*?*/ &S));
_imp_PRINTSTRING(
*({
__typeof__(_imp_string31) tmp = S /*q*/;
(_imp_string255 *)&tmp;
})
);
// 656 t=xproc; nextatom
T = 9;
NEXTATOM();
// 657 %finish
L_00E1:;
// 658 tagtype(v)=t; tagval(v)=cloc
TAGTYPE[V - 1] = T;
TAGVAL[V - 1] = CLOC;
// 659 dump(16_1e); dump(16_55); !Push ds, push bp
DUMP(30);
DUMP(85);
// 660 dump(16_8b); dump(16_ec); !Mov BP,SP
DUMP(139);
DUMP(236);
// 661 dump(16_33); dump(16_C0); !Xor AX,AX
DUMP(51);
DUMP(192);
// 662 dump(pushax); !For event mechanism
DUMP(80);
// 663 %if t=xproc %start
if (T != 9) goto L_00E2;
// 664 fault(labund) %if program=""
if (_imp_strcmp((_imp_string *)/*?*/ &PROGRAM, (_imp_string *)/*?*/ _imp_str_literal_ptr("")) != 0) goto L_00E3;
FAULT(10);
L_00E3:;
// 665 dump(16_b8); flush; !Mov ax,nn=dseg
DUMP(184);
FLUSH();
// 666 printsymbol(7); printsymbol(length(program)); printstring(program)
_imp_PRINTSYMBOL(7);
_imp_PRINTSYMBOL(*_imp_LENGTH((_imp_string255 *)/*p*/ /*?*/ &PROGRAM));
_imp_PRINTSTRING(
*({
__typeof__(_imp_string31) tmp = PROGRAM /*q*/;
(_imp_string255 *)&tmp;
})
);
// 667 cloc=cloc+2; dump(16_8E); dump(16_D8); !Mov ds,ax
CLOC = CLOC + 2;
DUMP(142);
DUMP(216);
// 668 %finish
L_00E2:;
// 669 parms=0; oldtpos=v+1
PARMS = 0;
OLDTPOS = V + 1;
// 670 %while type#sep %cycle
L_00E4:;
if (TYPE == 14) goto L_00E5;
// 671 fault(ambig) %unless type=unknown
if (TYPE == 0) goto L_00E6;
FAULT(6);
L_00E6:;
// 672 tagtype(val)=var+wordbit
TAGTYPE[VAL - 1] = 4 + 1;
// 673 parms=parms+1; nextatom
PARMS = PARMS + 1;
NEXTATOM();
// 674 %repeat
goto L_00E4;
L_00E5:;
// 675 p=tagpos-parms; parms=parms+parms; sym=parms+6
P = TAGPOS - PARMS;
PARMS = PARMS + PARMS;
SYM = PARMS + 6;
// 676 %while p<tagpos %cycle
L_00E7:;
if (P >= TAGPOS) goto L_00E8;
// 677 tagval(p)=sym; sym=sym-2; p=p+1
TAGVAL[P - 1] = SYM;
SYM = SYM - 2;
P = P + 1;
// 678 %repeat
goto L_00E7;
L_00E8:;
// 679 floc=0
FLOC = 0;
// 680 %end
return;
} /* end of PROCDEF */
// 681
// 682 %routine instruction
void INSTRUCTION(void) {
// 683 %integer t,v,i,oper,st,sv,si,dt,dv
int T;
int V;
int I;
int OPER;
int ST;
int SV;
int SI;
int DT;
int DV;
// 684 nextatom
NEXTATOM();
// 685 %if type=kmove %start
if (TYPE != 23) goto L_00E9;
// 686 nextatom; oper=16_a4; !Movb
NEXTATOM();
OPER = 164;
// 687 %if type=string %start
if (TYPE != 2) goto L_00EA;
// 688 st=var+glabit; sv=gloc; si=0
ST = 4 + 2;
SV = GLOC;
SI = 0;
// 689 dumpstring(val); val=gloc-sv; gflush
DUMPSTRING(VAL);
VAL = GLOC - SV;
GFLUSH();
// 690 %if val&1=0 %start
if (VAL & 1 != 0) goto L_00EB;
// 691 val=val>>1; oper=16_a5; !Movw
VAL = (unsigned int)VAL >> 1;
OPER = 165;
// 692 %finish
L_00EB:;
// 693 immediate(load,val); dump(pushax)
IMMEDIATE(1, VAL);
DUMP(80);
// 694 %else
goto L_00EC;
L_00EA:;
// 695 expr; dump(pushax)
EXPR();
DUMP(80);
// 696 nextatom; st=type; sv=val; si=0
NEXTATOM();
ST = TYPE;
SV = VAL;
SI = 0;
// 697 fault(form) %unless st&varmask=var
if (ST & 252 == 4) goto L_00ED;
FAULT(5);
L_00ED:;
// 698 %if openbracket %start
if (!(OPENBRACKET())) goto L_00EE;
// 699 expr; double(st); si=1; dump(pushax)
EXPR();
DOUBLE(ST);
SI = 1;
DUMP(80);
// 700 closebracket
CLOSEBRACKET();
// 701 %finish
L_00EE:;
// 702 oper=16_a5 %if st&wordbit#0; !Movw
if (ST & 1 == 0) goto L_00EF;
OPER = 165;
L_00EF:;
// 703 %finish
L_00EC:;
// 704 nextatom; dt=type; dv=val
NEXTATOM();
DT = TYPE;
DV = VAL;
// 705 fault(form) %unless dt&varmask=var
if (DT & 252 == 4) goto L_00F0;
FAULT(5);
L_00F0:;
// 706 %if openbracket %start
if (!(OPENBRACKET())) goto L_00F1;
// 707 expr; double(dt); dump(16_8b); dump(16_f8); !Mov di,ax
EXPR();
DOUBLE(DT);
DUMP(139);
DUMP(248);
// 708 direct(lea,dt,dv,0); dump(16_03); dump(16_f8); !add di,ax
DIRECT(14, DT, DV, 0);
DUMP(3);
DUMP(248);
// 709 closebracket
CLOSEBRACKET();
// 710 %else
goto L_00F2;
L_00F1:;
// 711 direct(lea,dt,dv,0); dump(16_8b); dump(16_f8); !Mov di,ax
DIRECT(14, DT, DV, 0);
DUMP(139);
DUMP(248);
// 712 %finish
L_00F2:;
// 713 direct(lea,st,sv,0); dump(16_8b); dump(16_f0); !Mov si,ax
DIRECT(14, ST, SV, 0);
DUMP(139);
DUMP(240);
// 714 %if si#0 %Start
if (SI == 0) goto L_00F3;
// 715 dump(popax); dump(16_03); dump(16_f0); !add,si,ax
DUMP(88);
DUMP(3);
DUMP(240);
// 716 %finish
L_00F3:;
// 717 %if dt&glabit=0 %then dump(16_16) %else dump(16_1e); !Push SS/DS
if (DT & 2 != 0) goto L_00F4;
DUMP(22);
goto L_00F5;
L_00F4:;
DUMP(30);
L_00F5:;
// 718 dump(16_07); !Pop ES
DUMP(7);
// 719 %if st&glabit=0 %start
if (ST & 2 != 0) goto L_00F6;
// 720 dump(16_1e); dump(16_16); dump(16_1f); !Push DS,SS, Pop DS
DUMP(30);
DUMP(22);
DUMP(31);
// 721 %finish
L_00F6:;
// 722 dump(16_59); dump(16_F2); dump(oper); !Pop cx, rep
DUMP(89);
DUMP(242);
DUMP(OPER);
// 723 dump(16_1f) %if st&glabit=0; !Pop DS
if (ST & 2 != 0) goto L_00F7;
DUMP(31);
L_00F7:;
// 724 %finishelseif type=krepeat %start
goto L_00F8;
L_00E9:;
if (TYPE != 30) goto L_00F9;
// 725 poptext; fault(type) %unless type=repexp
POPTEXT();
if (TYPE == 14) goto L_00FA;
FAULT(TYPE);
L_00FA:;
// 726 dump(16_E9); labelref(label,val)
DUMP(233);
LABELREF(3, VAL);
// 727 %finishelseif type=kjump %start
goto L_00F8;
L_00F9:;
if (TYPE != 24) goto L_00FB;
// 728 nextatom; dump(16_e9); labelref(type,val)
NEXTATOM();
DUMP(233);
LABELREF(TYPE, VAL);
// 729 %finishelseif type=kreturn %start
goto L_00F8;
L_00FB:;
if (TYPE != 25) goto L_00FC;
// 730 expr %unless atomtype(atompos)=sep
if (ATOMTYPE[ATOMPOS - 1] == 14) goto L_00FD;
EXPR();
L_00FD:;
// 731 return
RETURN();
// 732 %finishelseif type&varmask=var %start
goto L_00F8;
L_00FC:;
if (TYPE & 252 != 4) goto L_00FE;
// 733 t=type; v=val; i=0
T = TYPE;
V = VAL;
I = 0;
// 734 %if open bracket %start
if (!(OPENBRACKET())) goto L_00FF;
// 735 expr; double(t); dump(pushax)
EXPR();
DOUBLE(T);
DUMP(80);
// 736 close bracket
CLOSEBRACKET();
// 737 i=1
I = 1;
// 738 %finish
L_00FF:;
// 739 fault(form) %unless equal sign
if (EQUALSIGN()) goto L_0100;
FAULT(5);
L_0100:;
// 740 expr; dump(16_5e) %unless i=0; !pop si
EXPR();
if (I == 0) goto L_0101;
DUMP(94);
L_0101:;
// 741 direct(store,t,v,i)
DIRECT(13, T, V, I);
// 742 %finishelseif type=proc %or type=xproc %or type=spec %start
goto L_00F8;
L_00FE:;
if (TYPE == 8) goto L_0102;
if (TYPE == 9) goto L_0102;
if (TYPE != 10) goto L_0103;
L_0102:;
// 743 call(type,val)
CALL(TYPE, VAL);
// 744 %else
goto L_00F8;
L_0103:;
// 745 atompos=atompos-1
ATOMPOS = ATOMPOS - 1;
// 746 %finish
L_00F8:;
// 747 %end
return;
} /* end of INSTRUCTION */
// 748
// 749 %integerfn cond; !Evaluate condition, return value of jump opcode
int COND(void) {
// 750 expr; nextatom; fault(form) %unless type=comp
EXPR();
NEXTATOM();
if (TYPE == 12) goto L_0104;
FAULT(5);
L_0104:;
// 751 v=val; nextatom; unary
V = VAL;
NEXTATOM();
UNARY();
// 752 %if atomtype(atompos)#sep %or (type#constant %and type&varmask#var) %start
if (ATOMTYPE[ATOMPOS - 1] != 14) goto L_0105;
if (TYPE == 1) goto L_0106;
if (TYPE & 252 == 4) goto L_0106;
L_0105:;
// 753 dump(pushax); atompos=atompos-1; expr
DUMP(80);
ATOMPOS = ATOMPOS - 1;
EXPR();
// 754 dump(16_8B); dump(16_D8); dump(popax); !Mov bx,ax
DUMP(139);
DUMP(216);
DUMP(88);
// 755 type=bx
TYPE = 17;
// 756 %finish
L_0106:;
// 757 direct(cmp,type,val,0)
DIRECT(7, TYPE, VAL, 0);
// 758 %result=16_72 %if v=']'+128
if (V != 93 + 128) goto L_0107;
return 114;
L_0107:;
// 759 %result=16_73 %if v='['
if (V != 91) goto L_0108;
return 115;
L_0108:;
// 760 %result=16_74 %if v='#'
if (V != 35) goto L_0109;
return 116;
L_0109:;
// 761 %result=16_75 %if v='='
if (V != 61) goto L_010A;
return 117;
L_010A:;
// 762 %result=16_76 %if v=']'
if (V != 93) goto L_010B;
return 118;
L_010B:;
// 763 %result=16_77 %if v='['+128
if (V != 91 + 128) goto L_010C;
return 119;
L_010C:;
// 764 %result=16_7c %if v='>'+128
if (V != 62 + 128) goto L_010D;
return 124;
L_010D:;
// 765 %result=16_7d %if v='<'
if (V != 60) goto L_010E;
return 125;
L_010E:;
// 766 %result=16_7e %if v='>'
if (V != 62) goto L_010F;
return 126;
L_010F:;
// 767 %result=16_7f; ! %if v='<'+128
return 127;
// 768 %end
} /* end of COND */
// 769
// 770 ! Main Program
// 771
// 772 %onevent 15 %start
if (!_imp_on_event(15)) goto L_0110;
// 773 %finish
L_0110:;
// 774
// 775 %if tagpos=1 %start; ! (not via event: first time)
if (TAGPOS != 1) goto L_0111;
// 776 program = cliparam
_imp_strncpy(/*?*/ &PROGRAM, ({
__typeof__(_imp_string255) tmp; /*B*/
tmp = _imp_CLIPARAM();
(void *)&tmp;
}),
/*max:*/ 31);
// 777 openinput(source,program.".lc")
_imp_OPENINPUT(1,
*({
__typeof__(_imp_string255) tmp = *({
_imp_string255 tmp =
_imp_join((_imp_string *)/*?*/ &PROGRAM, (_imp_string *)/*?*/ _imp_str_literal_ptr(".lc"));
(_imp_string255 *)&tmp;
}) /*q*/;
(_imp_string255 *)&tmp;
})
);
// 778 openoutput(object,program.".iob")
_imp_OPENOUTPUT(1,
*({
__typeof__(_imp_string255) tmp = *({
_imp_string255 tmp =
_imp_join((_imp_string *)/*?*/ &PROGRAM, (_imp_string *)/*?*/ _imp_str_literal_ptr(".iob"));
(_imp_string255 *)&tmp;
}) /*q*/;
(_imp_string255 *)&tmp;
})
);
// 779 openoutput(list,program.".lis")
_imp_OPENOUTPUT(2,
*({
__typeof__(_imp_string255) tmp = *({
_imp_string255 tmp =
_imp_join((_imp_string *)/*?*/ &PROGRAM, (_imp_string *)/*?*/ _imp_str_literal_ptr(".lis"));
(_imp_string255 *)&tmp;
}) /*q*/;
(_imp_string255 *)&tmp;
})
);
// 780 selectoutput(list)
_imp_SELECTOUTPUT(2);
// 781 printstring(" LC Cross-compiler 06/01/81"); newline; newline
_imp_PRINTSTRING(_imp_str_literal(" LC Cross-compiler 06/01/81"));
_imp_NEWLINE();
_imp_NEWLINE();
// 782 %for type=kconst,1,krepeat %cycle
// %for TYPE = 17, 1, 30 %cycle
{
TYPE = 16;
L_0112:
if (TYPE == 30) goto L_0113;
TYPE += 1;
// 783 tag1(tagpos)=n1(type); tag2(tagpos)=n2(type)
TAG1[TAGPOS - 1] = N1[TYPE - 17];
TAG2[TAGPOS - 1] = N2[TYPE - 17];
// 784 tagtype(tagpos)=type; tagval(tagpos)=-1
TAGTYPE[TAGPOS - 1] = TYPE;
TAGVAL[TAGPOS - 1] = -1;
// 785 tagpos=tagpos+1
TAGPOS = TAGPOS + 1;
// 786 %repeat
goto L_0112;
}
L_0113:;
// 787 selectinput(source); program=""
_imp_SELECTINPUT(1);
_imp_strncpy(/*?*/ &PROGRAM, ({
__typeof__(_imp_string255) tmp; /*B*/
tmp = _imp_str_literal("");
(void *)&tmp;
}),
/*max:*/ 31);
// 788 %finish
L_0111:;
// 789
// 790 %cycle
L_0115:;
// 791 readline
READLINE();
// 792 %cycle; !Deal with labels
L_0116:;
// 793 nextatom
NEXTATOM();
// 794 %exitunless type=unknown %and atomtype(atompos)=colon
if (TYPE != 0) goto L_0117;
if (ATOMTYPE[ATOMPOS - 1] == 13) goto L_0118;
L_0117:;
goto L_0119;
L_0118:;
// 795 tagtype(val)=label; satrefs(tagval(val),cloc)
TAGTYPE[VAL - 1] = 3;
SATREFS(TAGVAL[VAL - 1], CLOC);
// 796 tagval(val)=cloc; atompos=atompos+1
TAGVAL[VAL - 1] = CLOC;
ATOMPOS = ATOMPOS + 1;
// 797 access=1
ACCESS = 1;
// 798 %repeat
goto L_0116;
L_0119:;
// 799 %continueif type=sep %and ifpos=0
if (TYPE != 14) goto L_011A;
if (IFPOS != 0) goto L_011A;
goto L_011B;
L_011A:;
// 800 %if type=kconst %start
if (TYPE != 17) goto L_011C;
// 801 constdef
CONSTDEF();
// 802 %finishelseif type=kbyte %or type=kword %start
goto L_011D;
L_011C:;
if (TYPE == 19) goto L_0114;
if (TYPE != 18) goto L_011E;
L_0114:;
// 803 vardef(type)
VARDEF(TYPE);
// 804 %finishelseif type=kspec %or type=kproc %start
goto L_011D;
L_011E:;
if (TYPE == 20) goto L_011F;
if (TYPE != 21) goto L_0120;
L_011F:;
// 805 procdef(type)
PROCDEF(TYPE);
// 806 %finishelseif type=kend %start
goto L_011D;
L_0120:;
if (TYPE != 22) goto L_0121;
// 807 %exitif level=0; level=0
if (LEVEL != 0) goto L_0122;
goto L_0123;
L_0122:;
LEVEL = 0;
// 808 return %unless access=0; flush
if (ACCESS == 0) goto L_0124;
RETURN();
L_0124:;
FLUSH();
// 809 val=oldtpos; oldtpos=tagpos; tagpos=val; ! Reset tagpos before moaning
VAL = OLDTPOS;
OLDTPOS = TAGPOS;
TAGPOS = VAL;
// 810 %while oldtpos>tagpos %cycle
L_0125:;
if (OLDTPOS <= TAGPOS) goto L_0126;
// 811 oldtpos=oldtpos-1; fault(labund) %if tagtype(oldtpos)=unknown
OLDTPOS = OLDTPOS - 1;
if (TAGTYPE[OLDTPOS - 1] != 0) goto L_0127;
FAULT(10);
L_0127:;
// 812 %repeat
goto L_0125;
L_0126:;
// 813 %unless textlevel=0 %start
if (TEXTLEVEL == 0) goto L_0128;
// 814 poptext; textlevel=0; fault(type)
POPTEXT();
TEXTLEVEL = 0;
FAULT(TYPE);
// 815 %finish
L_0128:;
// 816 %finishelseif type=kprogram %start
goto L_011D;
L_0121:;
if (TYPE != 26) goto L_0129;
// 817 fault(ambig) %unless program=""
if (_imp_strcmp((_imp_string *)/*?*/ &PROGRAM, (_imp_string *)/*?*/ _imp_str_literal_ptr("")) == 0) goto L_012A;
FAULT(6);
L_012A:;
// 818 nextatom; fault(form) %unless type=string
NEXTATOM();
if (TYPE == 2) goto L_012B;
FAULT(5);
L_012B:;
// 819 fault(form) %if val='"'; !Null name not allowed
if (VAL != 34) goto L_012C;
FAULT(5);
L_012C:;
// 820 v=line(val)
V = LINE[VAL - 1];
// 821 %cycle
L_012D:;
// 822 val=val+1; program=program.tostring(v); v=line(val)
VAL = VAL + 1;
_imp_strncpy(/*?*/ &PROGRAM, ({
__typeof__(_imp_string255) tmp; /*B*/
tmp = *({
_imp_string255 tmp = _imp_join((_imp_string *)/*?*/ &PROGRAM, ({
__typeof__(_imp_string1) tmp; /*E*/
tmp = _imp_TOSTRING(V);
(void *)&tmp;
}));
(_imp_string255 *)&tmp;
});
(void *)&tmp;
}),
/*max:*/ 31);
V = LINE[VAL - 1];
// 823 %repeatuntil v='"'
if (V == 34) goto L_012E;
goto L_012D;
L_012E:;
// 824 program=program."_" %unless charno(program,length(program))='_'
if (*_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &PROGRAM, *_imp_LENGTH((_imp_string255 *)/*p*/ /*?*/ &PROGRAM)) == 95)
goto L_012F;
_imp_strncpy(/*?*/ &PROGRAM, ({
__typeof__(_imp_string255) tmp; /*B*/
tmp = *({
_imp_string255 tmp =
_imp_join((_imp_string *)/*?*/ &PROGRAM, (_imp_string *)/*?*/ _imp_str_literal_ptr("_"));
(_imp_string255 *)&tmp;
});
(void *)&tmp;
}),
/*max:*/ 31);
L_012F:;
// 825 selectoutput(object); printsymbol(2); printsymbol(6)
_imp_SELECTOUTPUT(1);
_imp_PRINTSYMBOL(2);
_imp_PRINTSYMBOL(6);
// 826 printsymbol(length(program)); printstring(program)
_imp_PRINTSYMBOL(*_imp_LENGTH((_imp_string255 *)/*p*/ /*?*/ &PROGRAM));
_imp_PRINTSTRING(
*({
__typeof__(_imp_string31) tmp = PROGRAM /*q*/;
(_imp_string255 *)&tmp;
})
);
// 827 %finishelseif type=kcycle %start
goto L_011D;
L_0129:;
if (TYPE != 29) goto L_0130;
// 828 pushtext(repexp,cloc)
PUSHTEXT(14, CLOC);
// 829 %finishelseif type=kelse %start
goto L_011D;
L_0130:;
if (TYPE != 27) goto L_0131;
// 830 poptext; fault(type) %unless type=finexp
POPTEXT();
if (TYPE == 15) goto L_0132;
FAULT(TYPE);
L_0132:;
// 831 satrefs(val,cloc+3)
SATREFS(VAL, CLOC + 3);
// 832 poptext; fault(type) %unless type=finexp
POPTEXT();
if (TYPE == 15) goto L_0133;
FAULT(TYPE);
L_0133:;
// 833 dump(16_e9); dump(val); dump(val>>8)
DUMP(233);
DUMP(VAL);
DUMP((unsigned int)VAL >> 8);
// 834 %if ifpos=0 %start
if (IFPOS != 0) goto L_0134;
// 835 pushtext(context,0)
PUSHTEXT(16, 0);
// 836 %else
goto L_0135;
L_0134:;
// 837 pushtext(finexp,cloc-2)
PUSHTEXT(15, CLOC - 2);
// 838 atompos=ifpos+1; dump(cond!!1); dump(3)
ATOMPOS = IFPOS + 1;
DUMP(COND() ^ 1);
DUMP(3);
// 839 dump(16_E9); dump(0); dump(0)
DUMP(233);
DUMP(0);
DUMP(0);
// 840 atompos=ifpos %and fault(form) %unless ifpos=2
if (IFPOS == 2) goto L_0136;
ATOMPOS = IFPOS;
FAULT(5);
L_0136:;
// 841 IFPOS=0
IFPOS = 0;
// 842 %finish
L_0135:;
// 843 pushtext(finexp,cloc-2)
PUSHTEXT(15, CLOC - 2);
// 844 %finishelseif type=kfinish %start
goto L_011D;
L_0131:;
if (TYPE != 28) goto L_0137;
// 845 poptext; fault(type) %unless type=finexp %or type=context
POPTEXT();
if (TYPE == 15) goto L_0138;
if (TYPE == 16) goto L_0138;
FAULT(TYPE);
L_0138:;
// 846 satrefs(val,cloc)
SATREFS(VAL, CLOC);
// 847 poptext; satrefs(val,cloc); access=1
POPTEXT();
SATREFS(VAL, CLOC);
ACCESS = 1;
// 848 %else
goto L_011D;
L_0137:;
// 849 fault(varund) %if type=unknown
if (TYPE != 0) goto L_0139;
FAULT(12);
L_0139:;
// 850 terminate declarations
TERMINATEDECLARATIONS();
// 851 %if ifpos=0 %start; ! Statement
if (IFPOS != 0) goto L_013A;
// 852 atompos=atompos-1; instruction
ATOMPOS = ATOMPOS - 1;
INSTRUCTION();
// 853 %finishelseif type=sep %start; ! IF condition
goto L_013B;
L_013A:;
if (TYPE != 14) goto L_013C;
// 854 fault(form) %unless ifpos=atompos
if (IFPOS == ATOMPOS) goto L_013D;
FAULT(5);
L_013D:;
// 855 atompos=ifpos+1
ATOMPOS = IFPOS + 1;
// 856 dump(cond!!1); dump(3); dump(16_E9); dump(0); dump(0)
DUMP(COND() ^ 1);
DUMP(3);
DUMP(233);
DUMP(0);
DUMP(0);
// 857 pushtext(finexp,0); pushtext(finexp,cloc-2)
PUSHTEXT(15, 0);
PUSHTEXT(15, CLOC - 2);
// 858 %else; ! Statement IF condition
goto L_013B;
L_013C:;
// 859 oldapos=atompos-1; atompos=ifpos+1
OLDAPOS = ATOMPOS - 1;
ATOMPOS = IFPOS + 1;
// 860 dump(cond)
DUMP(COND());
// 861 oldcpos=cpos; dump(0)
OLDCPOS = CPOS;
DUMP(0);
// 862 atompos=oldapos; instruction
ATOMPOS = OLDAPOS;
INSTRUCTION();
// 863 v=cpos-oldcpos-1; fault(far) %if v>127
V = CPOS - OLDCPOS - 1;
if (V <= 127) goto L_013E;
FAULT(9);
L_013E:;
// 864 code(oldcpos)=v
CODE[OLDCPOS] = V;
// 865 access=1
ACCESS = 1;
// 866 %finish
L_013B:;
// 867 ifpos=0
IFPOS = 0;
// 868 %finish
L_011D:;
// 869 nextatom; fault(form) %unless type=sep %and ifpos=0
NEXTATOM();
if (TYPE != 14) goto L_013F;
if (IFPOS == 0) goto L_0140;
L_013F:;
FAULT(5);
L_0140:;
// 870 %repeat
L_011B:;
goto L_0115;
L_0123:;
// 871 selectoutput(object); printsymbol(10)
_imp_SELECTOUTPUT(1);
_imp_PRINTSYMBOL(10);
// 872 selectoutput(list); newline
_imp_SELECTOUTPUT(2);
_imp_NEWLINE();
// 873 %endofprogram
_imp_stop(0);
return 0;
end_0:;
}