const char *snl; extern int rem(int p, int q); extern void readsymbol(int typeof_P, void *p); extern real float(int n); extern char * tostring(int p); extern char * substring(char *s, int f, int t); extern int freespace(); extern void svc(int n, struct (null) *r); extern int addr(int typeof_P, void *p); extern int *integer(int n); extern short *shortinteger(int n); extern char *byteinteger(int n); extern char * *string(int n); extern struct (null) record ; (/*should not get here any more*/ int n; /*or here*/) extern real *real(int n); extern long real *longreal(int n); extern char *length(char *s); extern char *charno(char *s, int n); extern int int(real x); extern int intpt(real x); extern void iocp(int n); extern int typeof(int typeof_N, void *n); extern int sizeof(int typeof_N, void *n); extern real fracpt(real x); extern void prompt(char *s); extern int nextsymbol(); extern void skipsymbol(); extern void printsymbol(int sym); extern void printstring(char *s); extern void write(int v, int p); extern void selectinput(int n); extern void selectoutput(int n); extern void openinput(int n, char *fd); extern void openoutput(int n, char *fd); extern void closeinput(); extern void closeoutput(); extern void resetinput(); extern void resetoutput(); extern char * time(); extern char * date(); extern int cputime(); extern int *comreg(int n); extern void read(int typeof_X, 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); typedef struct FILEFM{int unit; int owner; int n1; int n2;} filefm; typedef struct EVENTFM{int event; int sub; int extra; char *message; int pc; int x;} eventfm; extern struct EVENTFM event; int main(int argc, char **argv) { typedef struct IMPCOMFM{int statements; int flags; int code; int gla; int diags; int perm; char *file; char *option;} impcomfm; extern struct IMPCOMFM impcom; static int diags; static int hide; const char *mainep; const char *traceep; // bounds [1 : 1018] // do it now: const short {*,2}prim {NO INIT} // bounds [0 : 12] // do it now: const short {*,2}shortjump {NO INIT} // bounds [0 : 12] // do it now: const short {*,2}longjump {NO INIT} static int sfjump; static int rx1jump; static int rx2jump; static int rx13jump; static int localtot; static int localnonsafe; static int globaltot; static int globalnonsafe; static int buffmiss1; static int buffmiss2; static int buffmiss3; int t0; int t1; int t2; int t10; int t11; int t12; typedef struct REFFM{short tag; short link; short flags; short ca;} reffm; typedef struct DEFFM{struct DEFFM *link; short proc; short ca;} deffm; typedef struct PROCFM{struct PROCFM *link; struct REFFM *reflist; struct DEFFM *deflist; short base; short ca; short staticframe; short eventmask; short displayreg; short eventstart; short eventfinish; short ldbase; short ldsize; short vdbase; short vdsize; short me;} procfm; // ON DIM DO: struct PROCFM {*,0}proc // bounds [1 : 255] DIM 0x0001 0x0001 // ON DIM DO: struct DEFFM {*,0}tagdef // bounds [1 : 2050] DIM 0x0001 0x0001 // ON DIM DO: char {*,0}reftype // bounds [1 : 2900] DIM 0x0001 0x0001 static int refs; const struct (null) *null; struct PROCFM *proc1; struct PROCFM *lastproc; // ON DIM DO: short {*,0}primentry // bounds [1 : 52] DIM 0x0001 0x0001 int headersize; int glasize; int codesize; int literalsize; int vardiags; int linediags; static int defns; static int specs; static int relocations; int currentline; int lineincr; int caincr; int j; int k; int l; for (j = 1; j += 1; j != 2050) { tagdef[j] = 0; } L_0004: for (j = 1; j += 1; j != 52) { primentry[j] = (-1); } L_0008: proc1 = &proc[1]; memset(*proc1,0,sizeof struct PROCFM); lastproc = proc1; goto L_0009; void phex(short n) { int j; int k; for (j = 12; j += (-4); j != 0) { k = ((n >> j) & 15); if (k >= 10) goto L_000e; k = (k + 48); goto L_000f; L_000e: k = ((k - 10) + 65); L_000f: printsymbol(k); } L_000d: return(0); } L_0009: goto L_0010; void error(int n, int p) { selectoutput(0); printstring("*ERROR"); write(n, 1); printsymbol(58); write(p, 4); newline(); // EVENT 0x000f L_0010: goto L_0011; void get(int *n) { int j; int k; readsymbol(j); readsymbol(k); *n = ((j << 8) | k); L_0011: goto L_0012; void phaseone() { // ON DIM DO: struct REFFM {*,0}ref // bounds [1 : 2900] DIM 0x0001 0x0001 struct PROCFM *pp; struct PROCFM *qq; int procs; procs = 0; int catotal; catotal = 0; int extra; int n; int j; goto L_0012; void inputdirectives() { static int depth; static int code; static int n; static int ca; struct REFFM *r; struct DEFFM *d; struct DEFFM *dd; struct PROCFM *p; int lastref; int thisproc; int lastline; // bounds [1 : 21] /*todo: gcc jump table extension*/ void **dir; depth = (depth + 1); procs = (procs + 1); thisproc = procs; p = &proc[procs]; memset(*p,0,sizeof struct PROCFM); p->tagdef = thisproc; p->specs = diags; p->j = 0; if (diags <= 0) goto L_0013; p->j = 4; if (diags != 2) goto L_0014; p->j = 5; L_0014: L_0013: lastline = currentline; lastref = 0; r = null; for (;;) { L_0015: readsymbol(code); if (0 >= code) goto L_0016; if (code > 21) goto L_0016; goto *dir[code]; L_0016: error(0, code); dir_16: readsymbol(n); if (n == procs) goto L_0017; error(1, n); L_0017: inputdirectives(); goto L_0018; dir_17: get(ca); get(n); if (diags != 2) goto L_0019; p->j = (p->j + n); L_0019: get(n); p->staticframe = n; p->displayreg = nextsymbol(); skipsymbol(); get(n); p->eventmask = n; get(n); p->eventstart = n; get(n); p->eventfinish = n; depth = (depth - 1); if (depth != 0) goto L_001a; return; L_001a: p->ca = (ca + 2); if (p->eventmask == 0) goto L_001b; p->ca = (p->ca + 3); L_001b: catotal = (catotal + ca); if (r == null) goto L_001c; n = lastref; lastref = 0; for (;;) { L_001d: if (n == 0) goto L_001e; r = &ref[n]; k = r->link; r->link = lastref; lastref = n; n = k; } L_001e: L_001c: p->reflist = r; lastproc->link = p; lastproc = p; return; dir_1: get(j); get(ca); n = (j & 32767); if (0 >= n) goto L_001f; if (n <= 2050) goto L_0020; L_001f: error(3, n); L_0020: d = &tagdef[n]; if (&d->link == null) goto L_0021; if ((j & 32768) != 0) goto L_0022; error(4, n); L_0022: if (&p->deflist == d) goto L_0023; dd = &p->deflist; for (;;) { L_0024: if (&dd->link == d) goto L_0025; dd = &dd->link; } L_0025: dd->link = &d->link; goto L_0026; L_0023: p->deflist = &d->link; L_0026: L_0021: d->proc = thisproc; d->ca = ca; d->link = &p->deflist; p->deflist = d; goto L_0018; dir_2: code = (64 + 2); goto U_0082; dir_5: code = 1; goto U_0082; dir_6: code = (1 + 256); U_0082: get(n); get(ca); if (0 >= n) goto L_0027; if (n <= 2050) goto L_0028; L_0027: error(5, n); L_0028: if (refs != 2900) goto L_0029; error(6, n); L_0029: refs = (refs + 1); r = &ref[refs]; r->link = lastref; lastref = refs; r->tag = n; r->ca = ca; r->flags = code; goto L_0018; dir_4: get(n); get(ca); goto L_0018; dir_3: get(n); get(ca); primentry[n] = (-2); goto L_0018; dir_10: get(n); currentline = (n - 1); dir_9: currentline = (currentline + 1); if (diags != 2) goto L_002a; p->specs = (p->specs + 1); if (0 > (currentline - lastline)) goto L_002b; if ((currentline - lastline) <= 31) goto L_002c; L_002b: p->specs = (p->specs + 1); L_002c: L_002a: lastline = currentline; goto L_0018; L_0018: } L_0012: goto L_002d; void setprim(int n) { int a; int j; int k; int base; int to; if (0 >= n) goto L_002e; if (n <= 52) goto L_002f; L_002e: error(9, n); L_002f: if (primentry[n] < 0) goto L_0030; return; L_0030: base = proc1->ca; j = prim[n]; k = prim[j]; if ((k & 32768) == 0) goto L_0031; base = ((base + 1) & (\1)); L_0031: k = (k & 32767); primentry[n] = base; proc1->ca = (base + (k * (2 / 2))); to = (j + k); for (;;) { L_0032: if (j == to) goto L_0033; j = (j + 1); a = (prim[j] & 65535); if ((a & 65520) != 34944) goto L_0034; if (a == 34951) goto L_0034; j = (j + 1); a = prim[j]; if (primentry[a] >= 0) goto L_0035; setprim(a); L_0035: L_0034: } L_0033: L_002d: goto L_0036; void localstretch(struct PROCFM *p) { struct DEFFM *d; struct DEFFM *dd; struct REFFM *r; int j; int n; int mod; if (&p->reflist != null) goto L_0037; return; L_0037: for (;;) { L_0038: n = 0; mod = 0; r = &p->reflist; for (;;) { L_0039: localtot = (localtot + 1); r->ca = (r->ca + mod); if ((r->flags & ((2 | 64) | 128)) != 0) goto L_003a; localnonsafe = (localnonsafe + 1); d = &tagdef[r->tag]; j = r->ca; if ((j - (30 / 2)) > d->ca) goto L_003b; if (d->ca <= (j + (30 / 2))) goto L_003c; L_003b: n = 1; mod = (mod + (2 / 2)); p->ca = (p->ca + (2 / 2)); r->flags = (r->flags | 2); if (((j + 2) - (16384 / 2)) > d->ca) goto L_003d; if (d->ca > (((j + 2) + (16384 / 2)) - 1)) goto L_003d; r->flags = (r->flags | 4); if (abs((j - d->ca)) > 6500) goto L_003e; r->flags = (r->flags | 128); L_003e: L_003d: dd = &p->deflist; for (;;) { L_003f: if (dd == null) goto L_0040; if (dd->ca > r->ca) goto L_0041; L_0040: goto L_0042; L_0041: dd->ca = (dd->ca + (2 / 2)); dd = &dd->link; } L_0042: L_003c: L_003a: if (r->link != 0) goto L_0043; goto L_0044; L_0043: r = &ref[r->link]; } L_0044: if (n != 0) goto L_0045; goto L_0046; L_0045: } L_0046: L_0036: goto L_0047; void globalstretch(struct PROCFM *p, int *extra) { struct PROCFM *pp; struct DEFFM *d; struct DEFFM *dd; struct REFFM *r; int j; int k; int x; int n; int mod; int me; if (&p->reflist != null) goto L_0048; *extra = 0; return; L_0048: x = 0; for (;;) { L_0049: n = 0; mod = 0; r = &p->reflist; me = p->tagdef; for (;;) { L_004a: globaltot = (globaltot + 1); r->ca = (r->ca + mod); if ((r->flags & (128 | 8)) != 0) goto L_004b; globalnonsafe = (globalnonsafe + 1); d = &tagdef[r->tag]; j = (p->base + r->ca); if (d->proc != me) goto L_004c; if ((r->flags & 64) == 0) goto L_004d; L_004c: k = (proc[d->proc].base + d->ca); if (((j + 2) - (16384 / 2)) > k) goto L_004e; if (k > (((j + 2) + (16384 / 2)) - 1)) goto L_004e; r->flags = (r->flags | 4); if (abs((j - k)) > 6500) goto L_004f; r->flags = (r->flags | 128); L_004f: if ((r->flags & 2) == 0) goto L_0050; goto U_0085; L_0050: L_004e: goto L_0051; L_004d: k = (p->base + d->ca); L_0051: if ((j - (30 / 2)) > k) goto L_0052; if (k > (j + (30 / 2))) goto L_0052; goto U_0085; L_0052: if ((r->flags & 2) != 0) goto L_0053; r->flags = (r->flags | 2); if (((j + 2) - (16384 / 2)) > k) goto L_0054; if (k > (((j + 2) + (16384 / 2)) - 1)) goto L_0054; r->flags = (r->flags | 4); if (abs((j - k)) > 6500) goto L_0055; r->flags = (r->flags | 128); L_0055: L_0054: goto L_0056; L_0053: if ((r->flags & 4) != 0) goto L_0057; if (0 > k) goto L_0058; if (k > (16383 / 2)) goto L_0058; L_0057: if ((r->flags & 4) == 0) goto L_0059; if (((j + 2) - (16384 / 2)) > k) goto L_0058; if (k <= (((j + 2) + (16384 / 2)) - 1)) goto L_0059; L_0058: if (0 > k) goto L_005a; if (k > (16383 / 2)) goto L_005a; r->flags = (r->flags & (\4)); goto U_0085; L_005a: r->flags = (r->flags | 8); goto L_0056; L_0059: goto U_0085; L_0056: n = 1; x = (x + (2 / 2)); mod = (mod + (2 / 2)); p->ca = (p->ca + (2 / 2)); dd = &p->deflist; for (;;) { L_005b: if (dd->ca > r->ca) goto L_005c; goto L_005d; L_005c: dd->ca = (dd->ca + (2 / 2)); dd = &dd->link; } L_005d: pp = p; for (;;) { L_005e: pp = &pp->link; if (pp != null) goto L_005f; goto L_0060; L_005f: pp->base = (pp->base + (2 / 2)); } L_0060: L_004b: U_0085: if (r->link != 0) goto L_0061; goto L_0062; L_0061: r = &ref[r->link]; } L_0062: if (n != 0) goto L_0063; goto L_0064; L_0063: } L_0064: *extra = x; L_0047: goto L_0065; void condense() { // bounds [0 : 15] // do it now: const char {*,2}m {NO INIT} int j; int f; for (j = 1; j += 1; j != refs) { f = ref[j].flags; if ((f & 32) == 0) goto L_006a; reftype[j] = 0; goto L_006b; L_006a: reftype[j] = (m[(f & 15)] | (f & (16 + 64))); L_006b: } L_0069: if (0 >= 0) goto L_006c; for (j = 1; j += 1; j != refs) { if (((j - 1) & 15) != 0) goto L_0071; newline(); write(j, (-4)); printstring(": "); L_0071: write(reftype[j], 2); } L_0070: newlines(2); L_006c: L_0065: goto L_0072; void dumptags() { int k; goto L_0072; int tagno(struct DEFFM *d) { int k; for (k = 1; k += 1; k != 2050) { if (&tagdef[k] != d) goto L_0077; return(k); L_0077: } L_0076: // EVENT 0x000f L_0072: goto L_0078; void dumpproc(int n) { struct PROCFM *p; struct DEFFM *d; int k; k = 0; p = &proc[n]; printstring(" base"); write(p->base, 1); printstring(" size"); write(p->ca, 1); newline(); d = &p->deflist; for (;;) { L_0079: if (d == null) goto L_007a; write(tagno(*d), 3); printsymbol(58); write(d->ca, 0); k = (k + 1); if ((k & 7) != 0) goto L_007b; newline(); L_007b: d = &d->link; } L_007a: if ((k & 7) == 0) goto L_007c; newline(); L_007c: L_0078: for (k = 1; k += 1; k != procs) { newline(); printstring("proc"); write(k, 1); dumpproc(k); } L_0080: for (;;) { L_0081: selectinput(1); currentline = 0; inputdirectives(); lastproc->link = null; readsymbol(j); if (j == 18) goto L_0082; error((-1), j); L_0082: get(codesize); get(literalsize); get(glasize); get(defns); get(specs); get(relocations); if (codesize == catotal) goto L_0083; error(8, catotal); L_0083: for (j = 1; j += 1; j != 52) { if (primentry[j] != (-2)) goto L_0088; setprim(j); L_0088: } L_0087: proc1->ca = (proc1->ca + 2); if (0 >= 0) goto L_0089; dumptags(); L_0089: t10 = cputime(); pp = proc1; for (;;) { L_008a: qq = &pp->link; if (qq != null) goto L_008b; goto L_008c; L_008b: localstretch(*qq); qq->base = ((qq->base + pp->base) + pp->ca); qq->ldbase = (pp->ldbase + pp->specs); qq->rem = (pp->rem + pp->j); pp = qq; } L_008c: if (0 >= 0) goto L_008d; dumptags(); L_008d: t11 = cputime(); for (;;) { L_008e: n = 0; pp = proc1; for (;;) { L_008f: pp = &pp->link; if (pp != null) goto L_0090; goto L_0091; L_0090: globalstretch(*pp, extra); if (extra == 0) goto L_0092; n = (n + 1); pp->ca = (pp->ca + extra); qq = pp; for (;;) { L_0093: qq = &qq->link; if (qq != null) goto L_0094; goto L_0095; L_0094: qq->base = (qq->base + extra); } L_0095: L_0092: } L_0091: if (n != 0) goto L_0096; goto L_0097; L_0096: } L_0097: if (0 >= 0) goto L_0098; dumptags(); L_0098: t12 = cputime(); condense(); linediags = (lastproc->ldbase + lastproc->specs); vardiags = (lastproc->rem + lastproc->j); codesize = (lastproc->base + lastproc->ca); L_0081: goto L_0099; void phasetwo() { typedef struct BFM{struct BFM *link; int block; short {*,0}b; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;} bfm; typedef struct SFM{int zeroaddr; int lower; int upper; int ca;} sfm; struct SFM code; struct SFM gla; struct SFM ldiag; struct SFM vdiag; struct SFM reloc; struct SFM defn; struct SFM spec; // ON DIM DO: struct BFM {*,0}buffpool // bounds [1 : 8] DIM 0x0001 0x0001 struct BFM *bufflist; struct BFM *bp; typedef struct HDFM{short p1; short p2;} hdfm; typedef struct HEADERFM{short puresize; short glasize; short codedisp; short litdisp; short registers; short mainep; struct HDFM reloc; struct HDFM defn; struct HDFM spec; struct HDFM ldiag; struct HDFM vdiag;} headerfm; struct HEADERFM header; typedef struct NAMEFM{short n1a; short n1b; short n2a; short n2b;} namefm; typedef struct XDEFFM{struct NAMEFM n; int ep;} xdeffm; typedef struct SPECFM{int code; int gla; int link;} specfm; typedef struct DESCRIPTIONFM{int base; int disp; int type; int size; int form; int otype; int datasize; short identlen; char *sym;} descriptionfm; struct DESCRIPTIONFM xd; int thisproc; thisproc = 0; int totalblocks; int op; int cond; int tag; int extra; int ref; ref = 0; int eventlink; int ldiaglink; int vdiaglink; int defnlink; int speclink; int asynchlink; int tracepatch; tracepatch = 0; int j; int k; int l; typedef struct PARMFM{short dsno; short dact; short ssno; short sact; int p1; int p2; int p3; int p4; int p5; int p6;} parmfm; static int dakey; goto L_0099; void openda(char * *fd, int blocks) { struct PARMFM p; struct PARMFM q; string(addr(p.sact)) = fd; svc(17, p); if (p.p2 >= 0) goto L_009a; printstring(fd); newline(); exit(0); L_009a: memcpy(q,p,sizeof struct PARMFM); p.dact = 14; svc(20, p); memcpy(p,q,sizeof struct PARMFM); p.p5 = blocks; p.dact = 2; svc(20, p); if (p.p6 < 0) goto L_009b; memcpy(p,q,sizeof struct PARMFM); p.p5 = 1; p.dact = 6; svc(20, p); if (p.p6 < 0) goto L_009c; dakey = p.p5; return; L_009c: L_009b: printstring("open da: "); newline(); exit(0); L_0099: goto L_009d; void closeda() { struct PARMFM p; p.p5 = dakey; p.dact = 11; svc(20, p); dakey = 0; if (p.p6 < 0) goto L_009e; return; L_009e: printstring("close da: "); newline(); exit(0); L_009d: goto L_009f; void blockio(struct BFM *block, int iofn) { struct PARMFM p; p.p4 = addr(block->b[0]); p.p5 = dakey; p.p6 = block->block; p.dact = iofn; svc(20, p); if (p.p6 < 0) goto L_00a0; return; L_00a0: printstring("block io: "); write(block->block, 1); newline(); // EVENT 0x000f L_009f: bufflist = null; for (j = 1; j += 1; j != 8) { bp = bufflist; bufflist = &buffpool[j]; bufflist->block = (-1); bufflist->link = bp; } L_00a4: goto L_00a5; void setsection(struct SFM *sect, int sectsize, struct HDFM *hd) { sect->zeroaddr = headersize; headersize = (headersize + sectsize); sect->lower = 0; sect->upper = sectsize; sect->ca = 0; hd->p1 = sect->zeroaddr; hd->p2 = 0; L_00a5: headersize = 18; defns = (defns * (3 * 2)); specs = (specs * (2 * 2)); relocations = (relocations * (2 / 2)); literalsize = ((literalsize + 3) & (\3)); codesize = (codesize + proc1->ca); setsection(defn, defns, header.defn); setsection(spec, specs, header.spec); setsection(reloc, relocations, header.reloc); setsection(ldiag, linediags, header.ldiag); setsection(vdiag, vardiags, header.vdiag); headersize = ((headersize + 3) & (\3)); code.zeroaddr = (headersize + literalsize); code.lower = (-literalsize); code.upper = codesize; code.ca = 0; gla.zeroaddr = ((((code.zeroaddr + codesize) + 8) + 255) & (\255)); gla.lower = 0; gla.upper = glasize; gla.ca = 0; header.registers = 32239; header.mainep = (-1); header.codedisp = code.zeroaddr; header.litdisp = headersize; header.puresize = (code.zeroaddr + codesize); header.glasize = glasize; totalblocks = (((gla.zeroaddr + glasize) + 255) >> 8); header.reloc.glasize = relocations; header.defn.glasize = defns; goto L_00a6; struct BFM buff (int addr) { struct BFM *this; struct BFM *last; int block; block = (addr >> 8); if (block != bufflist->block) goto L_00a7; return(bufflist); L_00a7: buffmiss1 = (buffmiss1 + 1); if (0 >= 0) goto L_00a8; printstring("block"); write(block, 1); newline(); L_00a8: last = bufflist; for (;;) { L_00a9: buffmiss3 = (buffmiss3 + 1); this = &last->link; if (this->block != block) goto L_00aa; goto U_009e; L_00aa: if (&this->link != null) goto L_00ab; goto L_00ac; L_00ab: last = this; } L_00ac: if (this->block >= 0) goto L_00ad; this->block = block; goto L_00ae; L_00ad: blockio(*this, 10); this->block = block; blockio(*this, 9); buffmiss2 = (buffmiss2 + 1); L_00ae: U_009e: last->link = &this->link; this->link = bufflist; bufflist = this; return(bufflist); L_00a6: goto L_00af; void flushbuffers() { struct BFM *this; int k; this = &*buff(0); if (8 == 0) goto L_00b0; this->b[0] = (((header.puresize + 8) + 255) / 256); this->b[1] = ((header.glasize + 255) / 256); this->b[2] = 17185; this->b[3] = 0; this->b[4] = 0; this->b[5] = 0; this->b[6] = 0; this->b[7] = 0; L_00b0: for (k = 0; k += 1; k != (18 - 1)) { this->b[(k + 8)] = *shortinteger((addr(header) + (k * 2))); } L_00b4: this = bufflist; for (;;) { L_00b5: if (this->block < 0) goto L_00b6; blockio(*this, 10); L_00b6: this = &this->link; if (this != null) goto L_00b7; goto L_00b8; L_00b7: } L_00b8: L_00af: goto L_00b9; void origin(struct SFM *section, int org) { if (0 >= 0) goto L_00ba; if (0 > (-2)) goto L_00bb; printstring("ORG:"); write(org, 1); write(section->lower, 6); write(section->upper, 1); newline(); L_00bb: L_00ba: if (section->lower > org) goto L_00bc; if (org > section->upper) goto L_00bc; section->ca = org; return; L_00bc: error(25, org); L_00b9: goto L_00bd; void put(struct SFM *section, short item) { struct BFM *bp; int addr; static int last; addr = (section->zeroaddr + section->ca); if (section == &gla) goto L_00be; addr = (addr + 8); L_00be: if (0 >= 0) goto L_00bf; if (0 >= (-2)) goto L_00c0; if (addr == (last + 1)) goto L_00c1; newline(); L_00c1: last = addr; write(addr, 4); printstring(": "); phex(item); newline(); L_00c0: L_00bf: bp = &*buff(addr); bp->b[(addr & 255)] = item; section->ca = (section->ca + 1); L_00bd: goto L_00c2; void putname(struct SFM *sect) { int j; short half; goto L_00c2; int ch(int sym) { if (65 > sym) goto L_00c3; if (sym > 90) goto L_00c3; return(((sym - 65) + 1)); L_00c3: if (97 > sym) goto L_00c4; if (sym > 122) goto L_00c4; return(((sym - 97) + 1)); L_00c4: if (48 > sym) goto L_00c5; if (sym > 57) goto L_00c5; return(((sym - 48) + 27)); L_00c5: if (35 > sym) goto L_00c6; if (sym > 37) goto L_00c6; return(((sym - 35) + 37)); L_00c6: if (sym != 32) goto L_00c7; return(0); L_00c7: return((-1)); L_00c2: goto L_00c8; void pack3(int k, short *n) { int p; int q; int r; p = *charno(xd.sym, k); q = *charno(xd.sym, (k + 1)); r = *charno(xd.sym, (k + 2)); *n = ((((ch(p) * 40) + ch(q)) * 40) + ch(r)); L_00c8: for (j = (*length(xd.sym) + 1); j += 1; j != xd.identlen) { *charno(xd.sym, j) = 32; } L_00cc: for (j = 1; j += 3; j != (xd.identlen - 2)) { pack3(j, half); put(*sect, half); } L_00d0: for (;;) { L_00d1: goto L_00d1; void setdescription(int desctype) { int sym; int j; int k; int l; int char; readsymbol(k); l = k; if (l <= 12) goto L_00d2; l = 12; L_00d2: *length(xd.sym) = l; for (j = 1; j += 1; j != l) { readsymbol(char); if (97 > char) goto L_00d7; if (char > 122) goto L_00d7; char = ((char - 97) + 65); L_00d7: *charno(xd.sym, j) = char; } L_00d6: k = (k - l); for (;;) { L_00d8: if (k <= 0) goto L_00d9; skipsymbol(); k = (k - 1); } L_00d9: xd.identlen = 12; if (desctype != 1) goto L_00da; return; L_00da: if (l > 6) goto L_00db; if (desctype != 0) goto L_00db; xd.identlen = 6; L_00db: readsymbol(xd.otype); readsymbol(k); xd.type = (k >> 4); xd.form = (k & 15); readsymbol(j); get(k); xd.base = (j >> 4); xd.disp = (((j & 15) << 16) + (k & 65535)); if (0 >= 0) goto L_00dc; printstring(xd.sym); write(xd.identlen, 1); write(xd.base, 1); write(xd.disp, 4); write(xd.type, 3); write(xd.form, 1); write(xd.otype, 1); newline(); L_00dc: L_00d1: goto L_00dd; void insertprims() { int j; int k; int l; int m; int to; for (j = 1; j += 1; j != 52) { k = primentry[j]; if (k < 0) goto L_00e2; if (0 >= 0) goto L_00e3; printstring("prim"); write(j, 1); printsymbol(32); phex(k); newline(); L_00e3: origin(code, (proc1->base + primentry[j])); k = prim[j]; to = (k + (prim[k] & 32767)); for (;;) { L_00e4: if (k == to) goto L_00e5; k = (k + 1); m = (prim[k] & 65535); if ((m & 65520) == 34944) goto L_00e6; put(code, m); goto L_00e7; L_00e6: if (m != 34951) goto L_00e8; tracepatch = code.ca; put(code, m); goto L_00e7; L_00e8: if ((m & 15) != 8) goto L_00e9; put(code, 17166); goto L_00ea; L_00e9: put(code, (16654 + ((m & 15) << 4))); L_00ea: k = (k + 1); m = prim[k]; l = primentry[m]; if (l >= 0) goto L_00eb; error(15, j); L_00eb: put(code, ((proc1->base + l) * 2)); L_00e7: } L_00e5: L_00e2: } L_00e1: asynchlink = primentry[52]; L_00dd: goto L_00ec; void plantcoderef() { int j; int k; int l; int t; int there; struct DEFFM *d; // bounds [1 : 4] /*todo: gcc jump table extension*/ void **format; ref = (ref + 1); t = reftype[ref]; d = &tagdef[tag]; there = ((proc[d->proc].base + d->ca) + extra); if ((t & 16) == 0) goto L_00ed; cond = (cond + 6); L_00ed: if ((t & 64) != 0) goto L_00ee; op = longjump[cond]; L_00ee: goto *format[(t & 7)]; format_1: sfjump = (sfjump + 1); l = 0; k = (there - code.ca); if (k >= 0) goto L_00ef; l = 256; k = (-k); L_00ef: if (k <= 15) goto L_00f0; error(200, code.ca); L_00f0: put(code, ((shortjump[cond] ^ l) + k)); return; format_2: rx1jump = (rx1jump + 1); format_4: rx13jump = (rx13jump + 1); k = ((there - proc1->base) * 2); put(code, op); if ((t & 7) != 4) goto L_00f1; put(code, (16384 | ((k >> 16) & 15))); goto L_00f2; L_00f1: if (0 > k) goto L_00f3; if (k <= 16383) goto L_00f4; L_00f3: error(201, code.ca); L_00f4: L_00f2: put(code, (k & 65535)); return; format_3: rx2jump = (rx2jump + 1); k = ((there - (code.ca + (4 / 2))) * 2); if ((-16384) > k) goto L_00f5; if (k <= 16383) goto L_00f6; L_00f5: error(202, code.ca); L_00f6: put(code, (op & (\15))); put(code, (-32768 | k)); L_00ec: goto L_00f7; void dumpcode() { static int depth; int lastline; int lastca; int codereset; static int litreset; static int lastspec; static int glaskip; struct PROCFM *p; int cca; int lca; int vca; int k; int c; int half; // bounds [1 : 21] /*todo: gcc jump table extension*/ void **dir; depth = (depth + 1); thisproc = (thisproc + 1); p = &proc[thisproc]; origin(code, p->base); origin(ldiag, p->ldbase); origin(vdiag, p->rem); lastca = code.ca; lastline = 0; if (thisproc == 1) goto L_00f8; get(lastline); setdescription(1); if (diags == 0) goto L_00f9; k = lastline; if (hide == 0) goto L_00fa; k = 0; L_00fa: put(ldiag, k); putname(vdiag); L_00f9: goto L_00fb; L_00f8: if (diags == 0) goto L_00fc; xd.sym = "PERM"; xd.identlen = 12; put(ldiag, 0); putname(vdiag); L_00fc: insertprims(); origin(code, ((proc1->base + proc1->ca) - 2)); put(code, (code.ca - eventlink)); eventlink = (code.ca - 1); put(code, 32768); L_00fb: for (;;) { L_00fd: readsymbol(c); if (0 >= c) goto L_00fe; if (c > 21) goto L_00fe; goto *dir[c]; L_00fe: error(12, c); dir_16: readsymbol(k); if (k == thisproc) goto L_00ff; error(13, k); L_00ff: cca = code.ca; lca = ldiag.ca; vca = vdiag.ca; dumpcode(); origin(code, cca); origin(ldiag, lca); origin(vdiag, vca); goto L_0100; dir_17: depth = (depth - 1); if (depth == 0) goto L_0101; put(code, (code.ca - eventlink)); eventlink = (code.ca - 1); if (p->eventmask != 0) goto L_0102; put(code, (p->displayreg | -32768)); goto L_0103; L_0102: put(code, p->displayreg); put(code, p->eventmask); put(code, (tagdef[p->eventstart].ca + p->base)); put(code, (tagdef[p->eventfinish].ca + p->base)); L_0103: L_0101: if (0 >= 0) goto L_0104; write(ldiag.ca, 1); write(p->ldbase, 1); write(p->specs, 1); newline(); L_0104: if (diags != 2) goto L_0105; if (depth != 0) goto L_0106; put(ldiag, proc1->specs); put(vdiag, proc1->j); goto L_0107; L_0106: put(ldiag, (ldiag.ca - ldiaglink)); ldiaglink = (ldiag.ca - 1); put(vdiag, (vdiag.ca - vdiaglink)); vdiaglink = (vdiag.ca - 1); L_0107: k = (p->ldbase + p->specs); for (;;) { L_0108: if (ldiag.ca == k) goto L_0109; put(ldiag, 0); } L_0109: L_0105: return; dir_12: litreset = code.ca; code.ca = codereset; goto L_0100; dir_13: codereset = code.ca; code.ca = litreset; goto L_0100; dir_14: get(half); litreset = (-half); goto L_0100; dir_7: get(half); put(code, half); goto L_0100; dir_8: get(half); if (glaskip == 0) goto L_010a; glaskip = (glaskip - 1); goto L_0100; L_010a: put(gla, half); goto L_0100; dir_20: put(reloc, (gla.ca - 2)); goto L_0100; dir_19: put(reloc, ((gla.ca - 2) + 1)); goto L_0100; dir_15: origin(code, (code.ca - 1)); put(code, p->staticframe); goto L_0100; dir_6: dir_5: skipsymbol(); get(half); cond = (half & 15); tag = (half >> 4); extra = 0; plantcoderef(); goto L_0100; dir_2: get(tag); skipsymbol(); get(op); skipsymbol(); get(extra); cond = 0; plantcoderef(); goto L_0100; dir_3: skipsymbol(); get(op); skipsymbol(); get(k); if (0 >= k) goto L_010b; if (k <= 52) goto L_010c; L_010b: error(15, k); L_010c: put(code, op); put(code, (primentry[k] * 2)); goto L_0100; dir_4: skipsymbol(); get(tag); k = tagdef[tag].ca; if (k == 0) goto L_010d; k = (k + p->base); L_010d: put(code, k); goto L_0100; dir_10: get(half); currentline = (half - 1); dir_9: currentline = (currentline + 1); if (0 >= 0) goto L_010e; printstring("line"); write(currentline, 1); write(code.ca, 1); newline(); L_010e: caincr = (code.ca - lastca); if (caincr != 0) goto L_010f; goto L_0100; L_010f: lineincr = (currentline - lastline); if (0 > lineincr) goto L_0110; if (lineincr <= 31) goto L_0111; L_0110: if (diags != 2) goto L_0112; put(ldiag, ((currentline - 1) | -32768)); L_0112: lineincr = 1; L_0111: if (diags != 2) goto L_0113; put(ldiag, ((caincr * (31 + 1)) + lineincr)); L_0113: lastline = currentline; lastca = code.ca; goto L_0100; dir_11: setdescription(0); if (diags != 2) goto L_0114; k = (((((xd.type & 7) << 4) + (xd.base & 15)) << 4) + (xd.disp >> 16)); if (xd.identlen == 12) goto L_0115; k = (k | -32768); L_0115: if (xd.form != 2) goto L_0116; k = (k | 16384); L_0116: if ((xd.type & 8) == 0) goto L_0117; k = (k | 8192); L_0117: put(vdiag, k); put(vdiag, (xd.disp & 65535)); putname(vdiag); L_0114: goto L_0100; dir_21: readsymbol(c); get(xd.datasize); setdescription(-1); glaskip = 0; if (c == 7) goto L_0118; if (c != 5) goto L_0119; L_0118: k = xd.disp; if (c != 7) goto L_011a; k = code.ca; if (xd.sym != mainep) goto L_011b; p->displayreg = (p->displayreg | 16384); header.mainep = k; L_011b: L_011a: put(defn, defnlink); defnlink = ((header.defn.puresize + defn.ca) - 1); put(defn, k); putname(defn); goto L_011c; L_0119: if (c == 6) goto L_011d; if (c != 4) goto L_011e; L_011d: if (tracepatch == 0) goto L_011f; if (xd.sym != traceep) goto L_011f; c = code.ca; origin(code, tracepatch); put(code, (gla.ca * 2)); origin(code, c); L_011f: k = (header.spec.puresize + spec.ca); putname(spec); put(gla, (speclink >> 16)); put(gla, speclink); speclink = (gla.ca - 2); put(gla, k); put(gla, (gla.ca - 3)); if (c != 4) goto L_0120; put(gla, (-1)); put(gla, (-1)); goto L_0121; L_0120: put(gla, 0); put(gla, 0); L_0121: glaskip = 6; goto L_011c; L_011e: error(170, c); L_011c: goto L_0100; L_0100: } L_00f7: selectinput(2); openda(impcom.file, totalblocks); readsymbol(j); for (j = 1; j += 1; j != (j - 2)) { put(gla, 32767); } L_0125: put(gla, 0); put(gla, 0); readsymbol(j); if (j >= 4) goto L_0126; error(17, j); L_0126: currentline = 0; eventlink = (-1); ldiaglink = (proc1->specs - 1); vdiaglink = (proc1->j - 1); defnlink = 0; speclink = 0; dumpcode(); readsymbol(j); if (j == 18) goto L_0127; error((-2), j); L_0127: origin(code, (-4)); put(code, 0); put(code, asynchlink); put(code, header.codedisp); put(code, eventlink); if (diags == 2) goto L_0128; if (diags != 1) goto L_0129; header.ldiag.puresize = (header.ldiag.puresize | -32768); ldiaglink = (thisproc * (2 / 2)); vdiaglink = ((thisproc * 8) / 2); goto L_012a; L_0129: header.ldiag.puresize = 0; L_012a: L_0128: header.ldiag.glasize = ldiaglink; header.vdiag.glasize = vdiaglink; header.spec.glasize = speclink; header.defn.glasize = defnlink; flushbuffers(); closeda(); for (;;) { L_012b: diags = ((impcom.flags >> 8) & 7); hide = (impcom.flags & 2048); selectoutput(0); t0 = cputime(); if (diags <= 2) goto L_012c; diags = 2; L_012c: phaseone(); t1 = cputime(); phasetwo(); t2 = cputime(); impcom.code = (((codesize + literalsize) - proc1->ca) * 2); impcom.perm = (proc1->ca * 2); impcom.gla = (glasize * 2); impcom.diags = ((linediags + vardiags) * 2);