home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume10 / ptoc / part08 / ptc.c.6
Encoding:
Text File  |  1987-07-27  |  43.9 KB  |  1,001 lines

  1. e(dput)) {
  2.         (void)fprintf(output.fp, "/*\n"), Putl(output, 1);
  3.         (void)fprintf(output.fp, "**    Definitions for i/o\n"), Putl(output, 1);
  4.         (void)fprintf(output.fp, "*/\n"), Putl(output, 1);
  5.         (void)fprintf(output.fp, "%s<stdio.h>\n", C24_include), Putl(output, 1);
  6.     }
  7.     if (use(dinput) || use(doutput) || use(dtext)) {
  8.         etextdef();
  9.         if (use(dinput)) {
  10.             if (tp->U.V13.tsubid == (struct S61 *)NIL)
  11.                 (void)fprintf(output.fp, "%s", xtern), Putl(output, 0);
  12.             (void)fprintf(output.fp, "text%c", tab1), Putl(output, 0);
  13.             printid(defnams.A[(int)(dinput)]->U.V6.lid);
  14.             if (tp->U.V13.tsubid != (struct S61 *)NIL)
  15.                 (void)fprintf(output.fp, " = { stdin, 0, 0 }"), Putl(output, 0);
  16.             Putchr(';', output),Putchr('\n', output);
  17.         }
  18.         if (use(doutput)) {
  19.             if (tp->U.V13.tsubid == (struct S61 *)NIL)
  20.                 (void)fprintf(output.fp, "%s", xtern), Putl(output, 0);
  21.             (void)fprintf(output.fp, "text%c", tab1), Putl(output, 0);
  22.             printid(defnams.A[(int)(doutput)]->U.V6.lid);
  23.             if (tp->U.V13.tsubid != (struct S61 *)NIL)
  24.                 (void)fprintf(output.fp, " = { stdout, 0, 0 }"), Putl(output, 0);
  25.             Putchr(';', output),Putchr('\n', output);
  26.         }
  27.     }
  28.     if (use(dinput) || use(dget) || use(dread) || use(dreadln) || use(deof) || use(deoln) || use(dreset) || use(drewrite)) {
  29.         (void)fprintf(output.fp, "%sFread(x, f) fread((char *)&x, sizeof(x), 1, f)\n", C4_define), Putl(output, 1);
  30.         (void)fprintf(output.fp, "%sGet(f) Fread((f).buf, (f).fp)\n", C4_define), Putl(output, 1);
  31.         (void)fprintf(output.fp, "%sGetx(f) (f).init = 1, (f).eoln = (((f).buf = fgetc((f).fp)) == %s) ? (((f).buf = %s), 1) : 0\n", C4_define, nlchr, spchr), Putl(output, 1);
  32.         (void)fprintf(output.fp, "%sGetchr(f) (f).buf, Getx(f)\n", C4_define), Putl(output, 1);
  33.     }
  34.     if (use(dread) || use(dreadln)) {
  35.         (void)fprintf(output.fp, "%sFILE%c*Tmpfil;\n", C50_static, tab1), Putl(output, 1);
  36.         (void)fprintf(output.fp, "%slong%cTmplng;\n", C50_static, tab1), Putl(output, 1);
  37.         (void)fprintf(output.fp, "%sdouble%cTmpdbl;\n", C50_static, tab1), Putl(output, 1);
  38.         (void)fprintf(output.fp, "%sFscan(f) (f).init ? ungetc((f).buf, (f).fp) : 0, Tmpfil = (f).fp\n", C4_define), Putl(output, 1);
  39.         (void)fprintf(output.fp, "%sScan(p, a) Scanck(fscanf(Tmpfil, p, a))\n", C4_define), Putl(output, 1);
  40.         (void)fprintf(output.fp, "%s%cScanck();\n", voidtyp, tab1), Putl(output, 1);
  41.         if (use(dreadln))
  42.             (void)fprintf(output.fp, "%s%cGetl();\n", voidtyp, tab1), Putl(output, 1);
  43.     }
  44.     if (use(deoln))
  45.         (void)fprintf(output.fp, "%sEoln(f) ((f).eoln ? true : false)\n", C4_define), Putl(output, 1);
  46.     if (use(deof))
  47.         (void)fprintf(output.fp, "%sEof(f) ((((f).init == 0) ? (Get(f)) : 0, ((f).eof ? 1 : feof((f).fp))) ? true : false)\n", C4_define), Putl(output, 1);
  48.     if (use(doutput) || use(dput) || use(dwrite) || use(dwriteln) || use(dreset) || use(drewrite) || use(dclose)) {
  49.         (void)fprintf(output.fp, "%sFwrite(x, f) fwrite((char *)&x, sizeof(x), 1, f)\n", C4_define), Putl(output, 1);
  50.         (void)fprintf(output.fp, "%sPut(f) Fwrite((f).buf, (f).fp)\n", C4_define), Putl(output, 1);
  51.         (void)fprintf(output.fp, "%sPutx(f) (f).eoln = ((f).buf == %s), %sfputc((f).buf, (f).fp)\n", C4_define, nlchr, voidcast), Putl(output, 1);
  52.         (void)fprintf(output.fp, "%sPutchr(c, f) (f).buf = (c), Putx(f)\n", C4_define), Putl(output, 1);
  53.         (void)fprintf(output.fp, "%sPutl(f, v) (f).eoln = v\n", C4_define), Putl(output, 1);
  54.     }
  55.     if (use(dreset) || use(drewrite) || use(dclose))
  56.         (void)fprintf(output.fp, "%sFinish(f) ((f).out && !(f).eoln) ? (Putchr(%s, f), 0) : 0, rewind((f).fp)\n", C4_define, nlchr), Putl(output, 1);
  57.     if (use(dclose)) {
  58.         (void)fprintf(output.fp, "%sClose(f) (f).init = ((f).init ? (fclose((f).fp), 0) : 0), (f).fp = NULL\n", C4_define), Putl(output, 1);
  59.         (void)fprintf(output.fp, "%sClosex(f) (f).init = ((f).init ? (Finish(f), fclose((f).fp), 0) : 0), (f).fp = NULL\n", C4_define), Putl(output, 1);
  60.     }
  61.     if (use(dreset)) {
  62.         (void)fprintf(output.fp, "%sREADONLY\n", ifdef), Putl(output, 1);
  63.         (void)fprintf(output.fp, "%s%s%cRmode[] = \"r\";\n", C50_static, chartyp, tab1), Putl(output, 1);
  64.         (void)fprintf(output.fp, "%s\n", elsif), Putl(output, 1);
  65.         (void)fprintf(output.fp, "%s%s%cRmode[] = \"r+\";\n", C50_static, chartyp, tab1), Putl(output, 1);
  66.         (void)fprintf(output.fp, "%s\n", endif), Putl(output, 1);
  67.         (void)fprintf(output.fp, "%sReset(f, n) (f).init = (f).init ? rewind((f).fp) : (((f).fp = Fopen(n, Rmode)), 1), (f).eof = (f).out = 0, Get(f)\n", C4_define), Putl(output, 1);
  68.         (void)fprintf(output.fp, "%sResetx(f, n) (f).init = (f).init ? (Finish(f)) : (((f).fp = Fopen(n, Rmode)), 1), (f).eof = (f).out = 0, Getx(f)\n", C4_define), Putl(output, 1);
  69.         usefopn = true;
  70.     }
  71.     if (use(drewrite)) {
  72.         (void)fprintf(output.fp, "%sWRITEONLY\n", ifdef), Putl(output, 1);
  73.         (void)fprintf(output.fp, "%s%s%cWmode[] = \"w\";\n", C50_static, chartyp, tab1), Putl(output, 1);
  74.         (void)fprintf(output.fp, "%s\n", elsif), Putl(output, 1);
  75.         (void)fprintf(output.fp, "%s%s%cWmode[] = \"w+\";\n", C50_static, chartyp, tab1), Putl(output, 1);
  76.         (void)fprintf(output.fp, "%s\n", endif), Putl(output, 1);
  77.         (void)fprintf(output.fp, "%sRewrite(f, n) (f).init = (f).init ? rewind((f).fp) : (((f).fp = Fopen(n, Wmode)), 1), (f).out = (f).eof = 1\n", C4_define), Putl(output, 1);
  78.         (void)fprintf(output.fp, "%sRewritex(f, n) (f).init = (f).init ? (Finish(f)) : (((f).fp = Fopen(n, Wmode)), 1), (f).out = (f).eof = (f).eoln = 1\n", C4_define), Putl(output, 1);
  79.         usefopn = true;
  80.     }
  81.     if (usefopn) {
  82.         (void)fprintf(output.fp, "FILE    *Fopen();\n"), Putl(output, 1);
  83.         (void)fprintf(output.fp, "%sMAXFILENAME 256\n", C4_define), Putl(output, 1);
  84.     }
  85.     if (usecase || usejmps) {
  86.         (void)fprintf(output.fp, "/*\n"), Putl(output, 1);
  87.         (void)fprintf(output.fp, "**    Definitions for case-statements\n"), Putl(output, 1);
  88.         (void)fprintf(output.fp, "**    and for non-local gotos\n"), Putl(output, 1);
  89.         (void)fprintf(output.fp, "*/\n"), Putl(output, 1);
  90.         (void)fprintf(output.fp, "%sLine __LINE__\n", C4_define), Putl(output, 1);
  91.         (void)fprintf(output.fp, "%s%cCaseerror();\n", voidtyp, tab1), Putl(output, 1);
  92.     }
  93.     if (usejmps) {
  94.         (void)fprintf(output.fp, "%s<setjmp.h>\n", C24_include), Putl(output, 1);
  95.         (void)fprintf(output.fp, "%sstruct Jb { jmp_buf%cjb; } J[%1d];\n", C50_static, tab1, (maxlevel + 1)), Putl(output, 1);
  96.     }
  97.     if (use(dinteger) || use(dmaxint) || use(dboolean) || use(dfalse) || use(dtrue) || use(deof) || use(deoln) || use(dexp) || use(dln) || use(dsqr) || use(dsin) || use(dcos) || use(dtan) || use(darctan) || use(dsqrt) || use(dreal)) {
  98.         (void)fprintf(output.fp, "/*\n"), Putl(output, 1);
  99.         (void)fprintf(output.fp, "**    Definitions for standard types\n"), Putl(output, 1);
  100.         (void)fprintf(output.fp, "*/\n"), Putl(output, 1);
  101.     }
  102.     if (usecomp) {
  103.         (void)fprintf(output.fp, "%s%s strncmp();\n", xtern, inttyp), Putl(output, 1);
  104.         (void)fprintf(output.fp, "%sCmpstr(x, y) strncmp((x), (y), sizeof(x))\n", C4_define), Putl(output, 1);
  105.     }
  106.     if (use(dboolean) || use(dfalse) || use(dtrue) || use(deof) || use(deoln) || usesets) {
  107.         capital(defnams.A[(int)(dboolean)]);
  108.         (void)fprintf(output.fp, "%s%s%c", typdef, chartyp, tab1), Putl(output, 0);
  109.         printid(defnams.A[(int)(dboolean)]->U.V6.lid);
  110.         Putchr(';', output),Putchr('\n', output);
  111.         capital(defnams.A[(int)(dfalse)]);
  112.         (void)fprintf(output.fp, "%s", C4_define), Putl(output, 0);
  113.         printid(defnams.A[(int)(dfalse)]->U.V6.lid);
  114.         (void)fprintf(output.fp, " ("), Putl(output, 0);
  115.         printid(defnams.A[(int)(dboolean)]->U.V6.lid);
  116.         (void)fprintf(output.fp, ")0\n"), Putl(output, 1);
  117.         capital(defnams.A[(int)(dtrue)]);
  118.         (void)fprintf(output.fp, "%s", C4_define), Putl(output, 0);
  119.         printid(defnams.A[(int)(dtrue)]->U.V6.lid);
  120.         (void)fprintf(output.fp, " ("), Putl(output, 0);
  121.         printid(defnams.A[(int)(dboolean)]->U.V6.lid);
  122.         (void)fprintf(output.fp, ")1\n"), Putl(output, 1);
  123.         (void)fprintf(output.fp, "%s%s%c*Bools[];\n", xtern, chartyp, tab1), Putl(output, 1);
  124.     }
  125.     capital(defnams.A[(int)(dinteger)]);
  126.     if (use(dinteger)) {
  127.         (void)fprintf(output.fp, "%s%s%c", typdef, inttyp, tab1), Putl(output, 0);
  128.         printid(defnams.A[(int)(dinteger)]->U.V6.lid);
  129.         Putchr(';', output),Putchr('\n', output);
  130.     }
  131.     if (use(dmaxint))
  132.         (void)fprintf(output.fp, "%smaxint%c%1d\n", C4_define, tab1, maxint), Putl(output, 1);
  133.     capital(defnams.A[(int)(dreal)]);
  134.     if (use(dreal)) {
  135.         (void)fprintf(output.fp, "%s%s%c", typdef, realtyp, tab1), Putl(output, 0);
  136.         printid(defnams.A[(int)(dreal)]->U.V6.lid);
  137.         Putchr(';', output),Putchr('\n', output);
  138.     }
  139.     if (use(dexp))
  140.         (void)fprintf(output.fp, "%s%s exp();\n", xtern, doubletyp), Putl(output, 1);
  141.     if (use(dln))
  142.         (void)fprintf(output.fp, "%s%s log();\n", xtern, doubletyp), Putl(output, 1);
  143.     if (use(dsqr))
  144.         (void)fprintf(output.fp, "%s%s pow();\n", xtern, doubletyp), Putl(output, 1);
  145.     if (use(dsin))
  146.         (void)fprintf(output.fp, "%s%s sin();\n", xtern, doubletyp), Putl(output, 1);
  147.     if (use(dcos))
  148.         (void)fprintf(output.fp, "%s%s cos();\n", xtern, doubletyp), Putl(output, 1);
  149.     if (use(dtan))
  150.         (void)fprintf(output.fp, "%s%s tan();\n", xtern, doubletyp), Putl(output, 1);
  151.     if (use(darctan))
  152.         (void)fprintf(output.fp, "%s%s atan();\n", xtern, doubletyp), Putl(output, 1);
  153.     if (use(dsqrt))
  154.         (void)fprintf(output.fp, "%s%s sqrt();\n", xtern, doubletyp), Putl(output, 1);
  155.     if (use(dabs) && use(dreal))
  156.         (void)fprintf(output.fp, "%s%s fabs();\n", xtern, doubletyp), Putl(output, 1);
  157.     if (use(dhalt))
  158.         (void)fprintf(output.fp, "%s%s abort();\n", xtern, voidtyp), Putl(output, 1);
  159.     if (use(dnew) || usenilp) {
  160.         (void)fprintf(output.fp, "/*\n"), Putl(output, 1);
  161.         (void)fprintf(output.fp, "**    Definitions for pointers\n"), Putl(output, 1);
  162.         (void)fprintf(output.fp, "*/\n"), Putl(output, 1);
  163.     }
  164.     if (use(dnew)) {
  165.         (void)fprintf(output.fp, "%sUnionoffs\n", ifndef), Putl(output, 1);
  166.         (void)fprintf(output.fp, "%sUnionoffs(p, m) (((long)(&(p)->m))-((long)(p)))\n", C4_define), Putl(output, 1);
  167.         (void)fprintf(output.fp, "%s\n", endif), Putl(output, 1);
  168.     }
  169.     if (usenilp)
  170.         (void)fprintf(output.fp, "%sNIL 0\n", C4_define), Putl(output, 1);
  171.     if (use(dnew))
  172.         (void)fprintf(output.fp, "%s%s *malloc();\n", xtern, chartyp), Putl(output, 1);
  173.     if (use(ddispose))
  174.         (void)fprintf(output.fp, "%s%s free();\n", xtern, voidtyp), Putl(output, 1);
  175.     if (usesets) {
  176.         (void)fprintf(output.fp, "/*\n"), Putl(output, 1);
  177.         (void)fprintf(output.fp, "**    Definitions for set-operations\n"), Putl(output, 1);
  178.         (void)fprintf(output.fp, "*/\n"), Putl(output, 1);
  179.         (void)fprintf(output.fp, "%sClaimset() %sCurrset(0, (%s)0)\n", C4_define, voidcast, setptyp), Putl(output, 1);
  180.         (void)fprintf(output.fp, "%sNewset() Currset(1, (%s)0)\n", C4_define, setptyp), Putl(output, 1);
  181.         (void)fprintf(output.fp, "%sSaveset(s) Currset(2, s)\n", C4_define), Putl(output, 1);
  182.         (void)fprintf(output.fp, "%ssetbits %1d\n", C4_define, C37_setbits), Putl(output, 1);
  183.         (void)fprintf(output.fp, "%s%s%c%s;\n", typdef, wordtype, tab1, setwtyp), Putl(output, 1);
  184.         (void)fprintf(output.fp, "%s%s *%c%s;\n", typdef, setwtyp, tab1, setptyp), Putl(output, 1);
  185.         printid(defnams.A[(int)(dboolean)]->U.V6.lid);
  186.         (void)fprintf(output.fp, "%cMember(), Le(), Ge(), Eq(), Ne();\n", tab1), Putl(output, 1);
  187.         (void)fprintf(output.fp, "%s%cUnion(), Diff();\n", setptyp, tab1), Putl(output, 1);
  188.         (void)fprintf(output.fp, "%s%cInsmem(), Mksubr();\n", setptyp, tab1), Putl(output, 1);
  189.         (void)fprintf(output.fp, "%s%cCurrset(), Inter();\n", setptyp, tab1), Putl(output, 1);
  190.         (void)fprintf(output.fp, "%s%s%cTmpset;\n", C50_static, setptyp, tab1), Putl(output, 1);
  191.         (void)fprintf(output.fp, "%s%s%cConset[];\n", xtern, setptyp, tab1), Putl(output, 1);
  192.         (void)fprintf(output.fp, "%s%cSetncpy();\n", voidtyp, tab1), Putl(output, 1);
  193.     }
  194.     (void)fprintf(output.fp, "%s%s *strncpy();\n", xtern, chartyp), Putl(output, 1);
  195.     if (use(dargc) || use(dargv)) {
  196.         (void)fprintf(output.fp, "/*\n"), Putl(output, 1);
  197.         (void)fprintf(output.fp, "**    Definitions for argv-operations\n"), Putl(output, 1);
  198.         (void)fprintf(output.fp, "*/\n"), Putl(output, 1);
  199.         (void)fprintf(output.fp, "%s%cargc;\n", inttyp, tab1), Putl(output, 1);
  200.         (void)fprintf(output.fp, "%s%c**argv;\n", chartyp, tab1), Putl(output, 1);
  201.         (void)fprintf(output.fp, " void\n"), Putl(output, 1);
  202.         (void)fprintf(output.fp, "Argvgt(n, cp, l)\n"), Putl(output, 1);
  203.         (void)fprintf(output.fp, "%s%cn;\n", inttyp, tab1), Putl(output, 1);
  204.         (void)fprintf(output.fp, "%s%s%cl;\n", registr, inttyp, tab1), Putl(output, 1);
  205.         (void)fprintf(output.fp, "%s%s%c*cp;\n", registr, chartyp, tab1), Putl(output, 1);
  206.         Putchr('{', output),Putchr('\n', output);
  207.         (void)fprintf(output.fp, "%c%s%s%c*sp;\n", tab1, registr, chartyp, tab1), Putl(output, 1);
  208.         Putchr('\n', output);
  209.         (void)fprintf(output.fp, "%cfor (sp = argv[n]; l > 0 && *sp; l--)\n", tab1), Putl(output, 1);
  210.         (void)fprintf(output.fp, "%s*cp++ = *sp++;\n", tab2), Putl(output, 1);
  211.         (void)fprintf(output.fp, "%cwhile (l-- > 0)\n", tab1), Putl(output, 1);
  212.         (void)fprintf(output.fp, "%s*cp++ = %s;\n", tab2, spchr), Putl(output, 1);
  213.         Putchr('}', output),Putchr('\n', output);
  214.     }
  215.     if ((tp->U.V13.tsubconst != (struct S61 *)NIL) || (tp->U.V13.tsubtype != (struct S61 *)NIL) || (tp->U.V13.tsubvar != (struct S61 *)NIL) || (tp->U.V13.tsubsub != (struct S61 *)NIL)) {
  216.         (void)fprintf(output.fp, "/*\n"), Putl(output, 1);
  217.         (void)fprintf(output.fp, "**    Start of program definitions\n"), Putl(output, 1);
  218.         (void)fprintf(output.fp, "*/\n"), Putl(output, 1);
  219.     }
  220.     econst(tp->U.V13.tsubconst);
  221.     etype(tp->U.V13.tsubtype);
  222.     evar(tp->U.V13.tsubvar);
  223.     if (tp->U.V13.tsubsub != (struct S61 *)NIL)
  224.         Putchr('\n', output);
  225.     esubr(tp->U.V13.tsubsub);
  226.     if (tp->U.V13.tsubid != (struct S61 *)NIL) {
  227.         (void)fprintf(output.fp, "/*\n"), Putl(output, 1);
  228.         (void)fprintf(output.fp, "**    Start of program code\n"), Putl(output, 1);
  229.         (void)fprintf(output.fp, "*/\n"), Putl(output, 1);
  230.         if (use(dargc) || use(dargv)) {
  231.             (void)fprintf(output.fp, "main(_ac, _av)\n"), Putl(output, 1);
  232.             (void)fprintf(output.fp, "%s%c_ac;\n", inttyp, tab1), Putl(output, 1);
  233.             (void)fprintf(output.fp, "%s%c*_av[];\n", chartyp, tab1), Putl(output, 1);
  234.             Putchr('{', output),Putchr('\n', output);
  235.             Putchr('\n', output);
  236.             (void)fprintf(output.fp, "%cargc = _ac;\n", tab1), Putl(output, 1);
  237.             (void)fprintf(output.fp, "%cargv = _av;\n", tab1), Putl(output, 1);
  238.         } else {
  239.             (void)fprintf(output.fp, "main()\n"), Putl(output, 1);
  240.             Putchr('{', output),Putchr('\n', output);
  241.         }
  242.         increment();
  243.         elabel(tp);
  244.         estmt(tp->U.V13.tsubstmt);
  245.         indent();
  246.         (void)fprintf(output.fp, "exit(0);\n"), Putl(output, 1);
  247.         decrement();
  248.         Putchr('}', output),Putchr('\n', output);
  249.         (void)fprintf(output.fp, "/*\n"), Putl(output, 1);
  250.         (void)fprintf(output.fp, "**    End of program code\n"), Putl(output, 1);
  251.         (void)fprintf(output.fp, "*/\n"), Putl(output, 1);
  252.     }
  253. }
  254.  
  255. void econset();
  256.  
  257.  integer
  258. size(tp)
  259.     treeptr    tp;
  260. {
  261.     register integer    R175;
  262.     integer    r, x;
  263.  
  264.     r = 0;
  265.     while (tp != (struct S61 *)NIL) {
  266.         if (tp->tt == nrange)
  267.             x = cvalof(tp->U.V41.texpr);
  268.         else
  269.             if (tp->tt == nempty)
  270.                 x = 0;
  271.             else
  272.                 x = cvalof(tp);
  273.         if (x > r)
  274.             r = x;
  275.         tp = tp->tnext;
  276.     }
  277.     R175 = csetwords(r + 1);
  278.     return R175;
  279. }
  280.  
  281. void ebits();
  282.  
  283.  void
  284. eword(s)
  285.     bitset    s;
  286. {
  287. # define bitshex 4
  288.     integer    n;
  289.     register integer    i;
  290.     unsigned char    x;
  291.  
  292.     n = 0;
  293.     while (n <= C37_setbits)
  294.         n = n + bitshex;
  295.     n = n - bitshex;
  296.     while (n >= 0) {
  297.         x = 0;
  298.         {
  299.             integer    B57 = 0,
  300.                 B58 = bitshex - 1;
  301.  
  302.             if (B57 <= B58)
  303.                 for (i = B57; ; i++) {
  304.                     if (Member((unsigned)((n + i)), s.S))
  305.                         switch (i) {
  306.                           case 0:
  307.                             x = x + 1;
  308.                             break ;
  309.                           case 1:
  310.                             x = x + 2;
  311.                             break ;
  312.                           case 2:
  313.                             x = x + 4;
  314.                             break ;
  315.                           case 3:
  316.                             x = x + 8;
  317.                             break ;
  318.                           default:
  319.                             Caseerror(Line);
  320.                         }
  321.                     if (i == B58) break;
  322.                 }
  323.         }
  324.         Putchr(hexdig.A[x], output);
  325.         n = n - bitshex;
  326.     }
  327. }
  328.  
  329.  void
  330. ebits(tp)
  331.     treeptr    tp;
  332. {
  333.     typedef struct { bitset    A[maxsetrange + 1]; }    T74;
  334.     T74    sets;
  335.     integer    s;
  336.     register integer    m;
  337.     register integer    n;
  338.  
  339.     s = size(tp);
  340.     {
  341.         integer    B59 = 0,
  342.             B60 = s - 1;
  343.  
  344.         if (B59 <= B60)
  345.             for (n = B59; ; n++) {
  346.                 Setncpy(sets.A[n].S, Conset[161], sizeof(sets.A[n].S));
  347.                 if (n == B60) break;
  348.             }
  349.     }
  350.     while (tp != (struct S61 *)NIL) {
  351.         if (tp->tt == nrange)
  352.             {
  353.                 integer    B61 = cvalof(tp->U.V41.texpl),
  354.                     B62 = cvalof(tp->U.V41.texpr);
  355.  
  356.                 if (B61 <= B62)
  357.                     for (m = B61; ; m++) {
  358.                         n = m / (C37_setbits + 1);
  359.                         Setncpy(sets.A[n].S, Union(sets.A[n].S, Saveset((Tmpset = Newset(), (void)Insmem((unsigned)(m % (C37_setbits + 1)), Tmpset), Tmpset))), sizeof(sets.A[n].S));
  360.                         Claimset();
  361.                         if (m == B62) break;
  362.                     }
  363.             }
  364.         else
  365.             if (tp->tt != nempty) {
  366.                 m = cvalof(tp);
  367.                 n = m / (C37_setbits + 1);
  368.                 Setncpy(sets.A[n].S, Union(sets.A[n].S, Saveset((Tmpset = Newset(), (void)Insmem((unsigned)(m % (C37_setbits + 1)), Tmpset), Tmpset))), sizeof(sets.A[n].S));
  369.                 Claimset();
  370.             }
  371.         tp = tp->tnext;
  372.     }
  373.     (void)fprintf(output.fp, "%c%1d", tab1, s), Putl(output, 0);
  374.     {
  375.         integer    B63 = 0,
  376.             B64 = s - 1;
  377.  
  378.         if (B63 <= B64)
  379.             for (n = B63; ; n++) {
  380.                 Putchr(',', output);
  381.                 if (n % 6 == 0)
  382.                     Putchr('\n', output);
  383.                 (void)fprintf(output.fp, "%c0x", tab1), Putl(output, 0);
  384.                 eword(sets.A[n]);
  385.                 if (n == B64) break;
  386.             }
  387.     }
  388.     Putchr('\n', output);
  389. }
  390.  
  391.  void
  392. econset(tp, len)
  393.     treeptr    tp;
  394.     integer    len;
  395. {
  396.     register integer    i;
  397.  
  398.     i = 0;
  399.     while (tp != (struct S61 *)NIL) {
  400.         (void)fprintf(output.fp, "%s%s%cQ%1d[] = {\n", C50_static, setwtyp, tab1, i), Putl(output, 1);
  401.         ebits(tp->U.V42.texps);
  402.         (void)fprintf(output.fp, "};\n"), Putl(output, 1);
  403.         i = i + 1;
  404.         tp = tp->tnext;
  405.     }
  406.     (void)fprintf(output.fp, "%s%s%c*Conset[] = {\n", C50_static, setwtyp, tab1), Putl(output, 1);
  407.     {
  408.         integer    B65 = len - 1,
  409.             B66 = 1;
  410.  
  411.         if (B65 >= B66)
  412.             for (i = B65; ; i--) {
  413.                 (void)fprintf(output.fp, "%cQ%1d,", tab1, i), Putl(output, 0);
  414.                 if (i % 6 == 5)
  415.                     Putchr('\n', output);
  416.                 if (i == B66) break;
  417.             }
  418.     }
  419.     (void)fprintf(output.fp, "%cQ0\n", tab1), Putl(output, 1);
  420.     (void)fprintf(output.fp, "};\n"), Putl(output, 1);
  421. }
  422.  
  423.  void
  424. emit()
  425. {
  426.     static char    usigned[]    = "unsigned ";
  427.     boolean    conflag, setused, dropset, donearr;
  428.     integer    doarrow, indnt;
  429.     boolean    *F195;
  430.     boolean    *F197;
  431.     boolean    *F199;
  432.     boolean    *F201;
  433.     integer    *F203;
  434.     integer    *F205;
  435.  
  436.     F205 = G204_indnt;
  437.     G204_indnt = &indnt;
  438.     F203 = G202_doarrow;
  439.     G202_doarrow = &doarrow;
  440.     F201 = G200_donearr;
  441.     G200_donearr = &donearr;
  442.     F199 = G198_dropset;
  443.     G198_dropset = &dropset;
  444.     F197 = G196_setused;
  445.     G196_setused = &setused;
  446.     F195 = G194_conflag;
  447.     G194_conflag = &conflag;
  448.     (*G204_indnt) = 0;
  449.     varno = 0;
  450.     (*G194_conflag) = false;
  451.     (*G196_setused) = false;
  452.     (*G198_dropset) = false;
  453.     (*G202_doarrow) = 0;
  454.     eprogram(top);
  455.     if (usebool)
  456.         (void)fprintf(output.fp, "%s%c*Bools[] = { \"false\", \"true\" };\n", chartyp, tab1), Putl(output, 1);
  457.     if (usescan) {
  458.         Putchr('\n', output);
  459.         (void)fprintf(output.fp, "%s%s\n", C50_static, voidtyp), Putl(output, 1);
  460.         (void)fprintf(output.fp, "Scanck(n)\n"), Putl(output, 1);
  461.         (void)fprintf(output.fp, "%s%cn;\n", inttyp, tab1), Putl(output, 1);
  462.         Putchr('{', output),Putchr('\n', output);
  463.         (void)fprintf(output.fp, "%cif (n != 1) {\n", tab1), Putl(output, 1);
  464.         (void)fprintf(output.fp, "%s%sfprintf(stderr, \"Bad input\\n\");\n", tab2, voidcast), Putl(output, 1);
  465.         (void)fprintf(output.fp, "%sexit(1);\n", tab2), Putl(output, 1);
  466.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  467.         Putchr('}', output),Putchr('\n', output);
  468.     }
  469.     if (usegetl) {
  470.         Putchr('\n', output);
  471.         (void)fprintf(output.fp, "%s%s\n", C50_static, voidtyp), Putl(output, 1);
  472.         (void)fprintf(output.fp, "Getl(f)\n"), Putl(output, 1);
  473.         (void)fprintf(output.fp, " text%c*f;\n", tab1), Putl(output, 1);
  474.         Putchr('{', output),Putchr('\n', output);
  475.         (void)fprintf(output.fp, "%cwhile (f->eoln == 0)\n", tab1), Putl(output, 1);
  476.         (void)fprintf(output.fp, "%sGetx(*f);\n", tab2), Putl(output, 1);
  477.         (void)fprintf(output.fp, "%cGetx(*f);\n", tab1), Putl(output, 1);
  478.         Putchr('}', output),Putchr('\n', output);
  479.     }
  480.     if (usefopn) {
  481.         Putchr('\n', output);
  482.         (void)fprintf(output.fp, "%sFILE *\n", C50_static), Putl(output, 1);
  483.         (void)fprintf(output.fp, "Fopen(n, m)\n"), Putl(output, 1);
  484.         (void)fprintf(output.fp, "%s%c*n, *m;\n", chartyp, tab1), Putl(output, 1);
  485.         Putchr('{', output),Putchr('\n', output);
  486.         (void)fprintf(output.fp, "%cFILE%s*f;\n", tab1, tab2), Putl(output, 1);
  487.         (void)fprintf(output.fp, "%c%s%s%c*s;\n", tab1, registr, chartyp, tab1), Putl(output, 1);
  488.         (void)fprintf(output.fp, "%c%s%s%cch = %cA%c;\n", tab1, C50_static, chartyp, tab1, quote, quote), Putl(output, 1);
  489.         (void)fprintf(output.fp, "%c%s%s%ctmp[MAXFILENAME];\n", tab1, C50_static, chartyp, tab1), Putl(output, 1);
  490.         (void)fprintf(output.fp, "%c%s%s%cunlink();\n", tab1, xtern, inttyp, tab1), Putl(output, 1);
  491.         Putchr('\n', output);
  492.         (void)fprintf(output.fp, "%cif (n == NULL)\n", tab1), Putl(output, 1);
  493.         (void)fprintf(output.fp, "%ssprintf(tmp, %sch++);\n", tab2, tmpfilename), Putl(output, 1);
  494.         (void)fprintf(output.fp, "%celse {\n", tab1), Putl(output, 1);
  495.         (void)fprintf(output.fp, "%sstrncpy(tmp, n, sizeof(tmp));\n", tab2), Putl(output, 1);
  496.         (void)fprintf(output.fp, "%sfor (s = &tmp[sizeof(tmp)-1]; *s == %s || *s == %s; )\n", tab2, spchr, nulchr), Putl(output, 1);
  497.         (void)fprintf(output.fp, "%s*s-- = %s;\n", tab3, nulchr), Putl(output, 1);
  498.         (void)fprintf(output.fp, "%sif (tmp[sizeof(tmp)-1]) {\n", tab2), Putl(output, 1);
  499.         (void)fprintf(output.fp, "%s%sfprintf(stderr, \"Too long filename %c%%s%c\\n\", n);\n", tab3, voidcast, quote, quote), Putl(output, 1);
  500.         (void)fprintf(output.fp, "%sexit(1);\n", tab3), Putl(output, 1);
  501.         (void)fprintf(output.fp, "%s}\n", tab2), Putl(output, 1);
  502.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  503.         (void)fprintf(output.fp, "%cs = tmp;\n", tab1), Putl(output, 1);
  504.         (void)fprintf(output.fp, "%cif ((f = fopen(s, m)) == NULL) {\n", tab1), Putl(output, 1);
  505.         (void)fprintf(output.fp, "%s%sfprintf(stderr, \"Cannot open: %%s\\n\", s);\n", tab2, voidcast), Putl(output, 1);
  506.         (void)fprintf(output.fp, "%sexit(1);\n", tab2), Putl(output, 1);
  507.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  508.         (void)fprintf(output.fp, "%cif (n == NULL)\n", tab1), Putl(output, 1);
  509.         (void)fprintf(output.fp, "%sunlink(tmp);\n", tab2), Putl(output, 1);
  510.         (void)fprintf(output.fp, "%creturn (f);\n", tab1), Putl(output, 1);
  511.         Putchr('}', output),Putchr('\n', output);
  512.         (void)fprintf(output.fp, "%s%s%crewind();\n", xtern, inttyp, tab1), Putl(output, 1);
  513.     }
  514.     if (setcnt > 0)
  515.         econset(setlst, setcnt);
  516.     if (useunion) {
  517.         Putchr('\n', output);
  518.         (void)fprintf(output.fp, "%s%s\n", C50_static, setptyp), Putl(output, 1);
  519.         (void)fprintf(output.fp, "Union(p1, p2)\n"), Putl(output, 1);
  520.         (void)fprintf(output.fp, "%c%s%s%cp1, p2;\n", tab1, registr, setptyp, tab1), Putl(output, 1);
  521.         Putchr('{', output),Putchr('\n', output);
  522.         (void)fprintf(output.fp, "%c%s%s%si, j, k;\n", tab1, registr, inttyp, tab2), Putl(output, 1);
  523.         (void)fprintf(output.fp, "%c%s%s%ssp = Newset(),\n", tab1, registr, setptyp, tab2), Putl(output, 1);
  524.         (void)fprintf(output.fp, "%sp3 = sp;\n", tab4), Putl(output, 1);
  525.         Putchr('\n', output);
  526.         (void)fprintf(output.fp, "%cj = *p1;\n", tab1), Putl(output, 1);
  527.         (void)fprintf(output.fp, "%c*p3 = j;\n", tab1), Putl(output, 1);
  528.         (void)fprintf(output.fp, "%cif (j > *p2)\n", tab1), Putl(output, 1);
  529.         (void)fprintf(output.fp, "%sj = *p2;\n", tab2), Putl(output, 1);
  530.         (void)fprintf(output.fp, "%celse\n", tab1), Putl(output, 1);
  531.         (void)fprintf(output.fp, "%s*p3 = *p2;\n", tab2), Putl(output, 1);
  532.         (void)fprintf(output.fp, "%ck = *p1 - *p2;\n", tab1), Putl(output, 1);
  533.         (void)fprintf(output.fp, "%cp1++, p2++, p3++;\n", tab1), Putl(output, 1);
  534.         (void)fprintf(output.fp, "%cfor (i = 0; i < j; i++)\n", tab1), Putl(output, 1);
  535.         (void)fprintf(output.fp, "%s*p3++ = (*p1++ | *p2++);\n", tab2), Putl(output, 1);
  536.         (void)fprintf(output.fp, "%cwhile (k > 0) {\n", tab1), Putl(output, 1);
  537.         (void)fprintf(output.fp, "%s*p3++ = *p1++;\n", tab2), Putl(output, 1);
  538.         (void)fprintf(output.fp, "%sk--;\n", tab2), Putl(output, 1);
  539.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  540.         (void)fprintf(output.fp, "%cwhile (k < 0) {\n", tab1), Putl(output, 1);
  541.         (void)fprintf(output.fp, "%s*p3++ = *p2++;\n", tab2), Putl(output, 1);
  542.         (void)fprintf(output.fp, "%sk++;\n", tab2), Putl(output, 1);
  543.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  544.         (void)fprintf(output.fp, "%creturn (Saveset(sp));\n", tab1), Putl(output, 1);
  545.         Putchr('}', output),Putchr('\n', output);
  546.     }
  547.     if (usediff) {
  548.         Putchr('\n', output);
  549.         (void)fprintf(output.fp, "%s%s\n", C50_static, setptyp), Putl(output, 1);
  550.         (void)fprintf(output.fp, "Diff(p1, p2)\n"), Putl(output, 1);
  551.         (void)fprintf(output.fp, "%c%s%s%cp1, p2;\n", tab1, registr, setptyp, tab1), Putl(output, 1);
  552.         Putchr('{', output),Putchr('\n', output);
  553.         (void)fprintf(output.fp, "%c%s%s%si, j, k;\n", tab1, registr, inttyp, tab2), Putl(output, 1);
  554.         (void)fprintf(output.fp, "%c%s%s%ssp = Newset(),\n", tab1, registr, setptyp, tab2), Putl(output, 1);
  555.         (void)fprintf(output.fp, "%sp3 = sp;\n", tab4), Putl(output, 1);
  556.         Putchr('\n', output);
  557.         (void)fprintf(output.fp, "%cj = *p1;\n", tab1), Putl(output, 1);
  558.         (void)fprintf(output.fp, "%c*p3 = j;\n", tab1), Putl(output, 1);
  559.         (void)fprintf(output.fp, "%cif (j > *p2)\n", tab1), Putl(output, 1);
  560.         (void)fprintf(output.fp, "%sj = *p2;\n", tab2), Putl(output, 1);
  561.         (void)fprintf(output.fp, "%ck = *p1 - *p2;\n", tab1), Putl(output, 1);
  562.         (void)fprintf(output.fp, "%cp1++, p2++, p3++;\n", tab1), Putl(output, 1);
  563.         (void)fprintf(output.fp, "%cfor (i = 0; i < j; i++)\n", tab1), Putl(output, 1);
  564.         (void)fprintf(output.fp, "%s*p3++ = (*p1++ & ~ (*p2++));\n", tab2), Putl(output, 1);
  565.         (void)fprintf(output.fp, "%cwhile (k > 0) {\n", tab1), Putl(output, 1);
  566.         (void)fprintf(output.fp, "%s*p3++ = *p1++;\n", tab2), Putl(output, 1);
  567.         (void)fprintf(output.fp, "%sk--;\n", tab2), Putl(output, 1);
  568.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  569.         (void)fprintf(output.fp, "%creturn (Saveset(sp));\n", tab1), Putl(output, 1);
  570.         Putchr('}', output),Putchr('\n', output);
  571.     }
  572.     if (useintr) {
  573.         Putchr('\n', output);
  574.         (void)fprintf(output.fp, "%s%s\n", C50_static, setptyp), Putl(output, 1);
  575.         (void)fprintf(output.fp, "Inter(p1, p2)\n"), Putl(output, 1);
  576.         (void)fprintf(output.fp, "%c%s%s%cp1, p2;\n", tab1, registr, setptyp, tab1), Putl(output, 1);
  577.         Putchr('{', output),Putchr('\n', output);
  578.         (void)fprintf(output.fp, "%c%s%s%si, j, k;\n", tab1, registr, inttyp, tab2), Putl(output, 1);
  579.         (void)fprintf(output.fp, "%c%s%s%ssp = Newset(),\n", tab1, registr, setptyp, tab2), Putl(output, 1);
  580.         (void)fprintf(output.fp, "%sp3 = sp;\n", tab4), Putl(output, 1);
  581.         Putchr('\n', output);
  582.         (void)fprintf(output.fp, "%cif ((j = *p1) > *p2)\n", tab1), Putl(output, 1);
  583.         (void)fprintf(output.fp, "%sj = *p2;\n", tab2), Putl(output, 1);
  584.         (void)fprintf(output.fp, "%c*p3 = j;\n", tab1), Putl(output, 1);
  585.         (void)fprintf(output.fp, "%cp1++, p2++, p3++;\n", tab1), Putl(output, 1);
  586.         (void)fprintf(output.fp, "%cfor (i = 0; i < j; i++)\n", tab1), Putl(output, 1);
  587.         (void)fprintf(output.fp, "%s*p3++ = (*p1++ & *p2++);\n", tab2), Putl(output, 1);
  588.         (void)fprintf(output.fp, "%creturn (Saveset(sp));\n", tab1), Putl(output, 1);
  589.         Putchr('}', output),Putchr('\n', output);
  590.     }
  591.     if (usememb) {
  592.         Putchr('\n', output);
  593.         (void)fprintf(output.fp, "%s", C50_static), Putl(output, 0);
  594.         printid(defnams.A[(int)(dboolean)]->U.V6.lid);
  595.         Putchr('\n', output);
  596.         (void)fprintf(output.fp, "Member(m, sp)\n"), Putl(output, 1);
  597.         (void)fprintf(output.fp, "%c%s%s%s%cm;\n", tab1, registr, usigned, inttyp, tab1), Putl(output, 1);
  598.         (void)fprintf(output.fp, "%c%s%s%csp;\n", tab1, registr, setptyp, tab1), Putl(output, 1);
  599.         Putchr('{', output),Putchr('\n', output);
  600.         (void)fprintf(output.fp, "%c%s%s%s%ci = m / (setbits+1) + 1;\n", tab1, registr, usigned, inttyp, tab1), Putl(output, 1);
  601.         Putchr('\n', output);
  602.         (void)fprintf(output.fp, "%cif ((i <= *sp) && (sp[i] & (1 << (m %% (setbits+1)))))\n", tab1), Putl(output, 1);
  603.         (void)fprintf(output.fp, "%sreturn (", tab2), Putl(output, 0);
  604.         printid(defnams.A[(int)(dtrue)]->U.V6.lid);
  605.         (void)fprintf(output.fp, ");\n"), Putl(output, 1);
  606.         (void)fprintf(output.fp, "%creturn (", tab1), Putl(output, 0);
  607.         printid(defnams.A[(int)(dfalse)]->U.V6.lid);
  608.         (void)fprintf(output.fp, ");\n"), Putl(output, 1);
  609.         Putchr('}', output),Putchr('\n', output);
  610.     }
  611.     if (useseq || usesne) {
  612.         Putchr('\n', output);
  613.         (void)fprintf(output.fp, "%s", C50_static), Putl(output, 0);
  614.         printid(defnams.A[(int)(dboolean)]->U.V6.lid);
  615.         Putchr('\n', output);
  616.         (void)fprintf(output.fp, "Eq(p1, p2)\n"), Putl(output, 1);
  617.         (void)fprintf(output.fp, "%c%s%s%cp1, p2;\n", tab1, registr, setptyp, tab1), Putl(output, 1);
  618.         Putchr('{', output),Putchr('\n', output);
  619.         (void)fprintf(output.fp, "%c%s%s%ci, j;\n", tab1, registr, inttyp, tab1), Putl(output, 1);
  620.         Putchr('\n', output);
  621.         (void)fprintf(output.fp, "%ci = *p1++;\n", tab1), Putl(output, 1);
  622.         (void)fprintf(output.fp, "%cj = *p2++;\n", tab1), Putl(output, 1);
  623.         (void)fprintf(output.fp, "%cwhile (i != 0 && j != 0) {\n", tab1), Putl(output, 1);
  624.         (void)fprintf(output.fp, "%sif (*p1++ != *p2++)\n", tab2), Putl(output, 1);
  625.         (void)fprintf(output.fp, "%sreturn (", tab3), Putl(output, 0);
  626.         printid(defnams.A[(int)(dfalse)]->U.V6.lid);
  627.         (void)fprintf(output.fp, ");\n"), Putl(output, 1);
  628.         (void)fprintf(output.fp, "%si--, j--;\n", tab2), Putl(output, 1);
  629.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  630.         (void)fprintf(output.fp, "%cwhile (i != 0) {\n", tab1), Putl(output, 1);
  631.         (void)fprintf(output.fp, "%sif (*p1++ != 0)\n", tab2), Putl(output, 1);
  632.         (void)fprintf(output.fp, "%sreturn (", tab3), Putl(output, 0);
  633.         printid(defnams.A[(int)(dfalse)]->U.V6.lid);
  634.         (void)fprintf(output.fp, ");\n"), Putl(output, 1);
  635.         (void)fprintf(output.fp, "%si--;\n", tab2), Putl(output, 1);
  636.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  637.         (void)fprintf(output.fp, "%cwhile (j != 0) {\n", tab1), Putl(output, 1);
  638.         (void)fprintf(output.fp, "%sif (*p2++ != 0)\n", tab2), Putl(output, 1);
  639.         (void)fprintf(output.fp, "%sreturn (", tab3), Putl(output, 0);
  640.         printid(defnams.A[(int)(dfalse)]->U.V6.lid);
  641.         (void)fprintf(output.fp, ");\n"), Putl(output, 1);
  642.         (void)fprintf(output.fp, "%sj--;\n", tab2), Putl(output, 1);
  643.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  644.         (void)fprintf(output.fp, "%creturn (", tab1), Putl(output, 0);
  645.         printid(defnams.A[(int)(dtrue)]->U.V6.lid);
  646.         (void)fprintf(output.fp, ");\n"), Putl(output, 1);
  647.         Putchr('}', output),Putchr('\n', output);
  648.     }
  649.     if (usesne) {
  650.         Putchr('\n', output);
  651.         (void)fprintf(output.fp, "%s", C50_static), Putl(output, 0);
  652.         printid(defnams.A[(int)(dboolean)]->U.V6.lid);
  653.         Putchr('\n', output);
  654.         (void)fprintf(output.fp, "Ne(p1, p2)\n"), Putl(output, 1);
  655.         (void)fprintf(output.fp, "%c%s%s%cp1, p2;\n", tab1, registr, setptyp, tab1), Putl(output, 1);
  656.         Putchr('{', output),Putchr('\n', output);
  657.         (void)fprintf(output.fp, "%creturn (!Eq(p1, p2));", tab1), Putl(output, 0);
  658.         Putchr('}', output),Putchr('\n', output);
  659.     }
  660.     if (usesle) {
  661.         Putchr('\n', output);
  662.         (void)fprintf(output.fp, "%s", C50_static), Putl(output, 0);
  663.         printid(defnams.A[(int)(dboolean)]->U.V6.lid);
  664.         Putchr('\n', output);
  665.         (void)fprintf(output.fp, "Le(p1, p2)\n"), Putl(output, 1);
  666.         (void)fprintf(output.fp, "%c%s%s%cp1, p2;\n", tab1, registr, setptyp, tab1), Putl(output, 1);
  667.         Putchr('{', output),Putchr('\n', output);
  668.         (void)fprintf(output.fp, "%c%s%s%ci, j;\n", tab1, registr, inttyp, tab1), Putl(output, 1);
  669.         Putchr('\n', output);
  670.         (void)fprintf(output.fp, "%ci = *p1++;\n", tab1), Putl(output, 1);
  671.         (void)fprintf(output.fp, "%cj = *p2++;\n", tab1), Putl(output, 1);
  672.         (void)fprintf(output.fp, "%cwhile (i != 0 && j != 0) {\n", tab1), Putl(output, 1);
  673.         (void)fprintf(output.fp, "%sif ((*p1++ & ~ *p2++) != 0)\n", tab2), Putl(output, 1);
  674.         (void)fprintf(output.fp, "%sreturn (", tab3), Putl(output, 0);
  675.         printid(defnams.A[(int)(dfalse)]->U.V6.lid);
  676.         (void)fprintf(output.fp, ");\n"), Putl(output, 1);
  677.         (void)fprintf(output.fp, "%si--, j--;\n", tab2), Putl(output, 1);
  678.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  679.         (void)fprintf(output.fp, "%cwhile (i != 0) {\n", tab1), Putl(output, 1);
  680.         (void)fprintf(output.fp, "%sif (*p1++ != 0)\n", tab2), Putl(output, 1);
  681.         (void)fprintf(output.fp, "%sreturn (", tab3), Putl(output, 0);
  682.         printid(defnams.A[(int)(dfalse)]->U.V6.lid);
  683.         (void)fprintf(output.fp, ");\n"), Putl(output, 1);
  684.         (void)fprintf(output.fp, "%si--;\n", tab2), Putl(output, 1);
  685.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  686.         (void)fprintf(output.fp, "%creturn (", tab1), Putl(output, 0);
  687.         printid(defnams.A[(int)(dtrue)]->U.V6.lid);
  688.         (void)fprintf(output.fp, ");\n"), Putl(output, 1);
  689.         Putchr('}', output),Putchr('\n', output);
  690.     }
  691.     if (usesge) {
  692.         Putchr('\n', output);
  693.         (void)fprintf(output.fp, "%s", C50_static), Putl(output, 0);
  694.         printid(defnams.A[(int)(dboolean)]->U.V6.lid);
  695.         Putchr('\n', output);
  696.         (void)fprintf(output.fp, "Ge(p1, p2)\n"), Putl(output, 1);
  697.         (void)fprintf(output.fp, "%c%s%s%cp1, p2;\n", tab1, registr, setptyp, tab1), Putl(output, 1);
  698.         Putchr('{', output),Putchr('\n', output);
  699.         (void)fprintf(output.fp, "%c%s%s%ci, j;\n", tab1, registr, inttyp, tab1), Putl(output, 1);
  700.         Putchr('\n', output);
  701.         (void)fprintf(output.fp, "%ci = *p1++;\n", tab1), Putl(output, 1);
  702.         (void)fprintf(output.fp, "%cj = *p2++;\n", tab1), Putl(output, 1);
  703.         (void)fprintf(output.fp, "%cwhile (i != 0 && j != 0) {\n", tab1), Putl(output, 1);
  704.         (void)fprintf(output.fp, "%sif ((*p2++ & ~ *p1++) != 0)\n", tab2), Putl(output, 1);
  705.         (void)fprintf(output.fp, "%sreturn (false);\n", tab3), Putl(output, 1);
  706.         (void)fprintf(output.fp, "%si--, j--;\n", tab2), Putl(output, 1);
  707.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  708.         (void)fprintf(output.fp, "%cwhile (j != 0) {\n", tab1), Putl(output, 1);
  709.         (void)fprintf(output.fp, "%sif (*p2++ != 0)\n", tab2), Putl(output, 1);
  710.         (void)fprintf(output.fp, "%sreturn (", tab3), Putl(output, 0);
  711.         printid(defnams.A[(int)(dfalse)]->U.V6.lid);
  712.         (void)fprintf(output.fp, ");\n"), Putl(output, 1);
  713.         (void)fprintf(output.fp, "%sj--;\n", tab2), Putl(output, 1);
  714.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  715.         (void)fprintf(output.fp, "%creturn (", tab1), Putl(output, 0);
  716.         printid(defnams.A[(int)(dtrue)]->U.V6.lid);
  717.         (void)fprintf(output.fp, ");\n"), Putl(output, 1);
  718.         Putchr('}', output),Putchr('\n', output);
  719.     }
  720.     if (usemksub) {
  721.         Putchr('\n', output);
  722.         (void)fprintf(output.fp, "%s%s\n", C50_static, setptyp), Putl(output, 1);
  723.         (void)fprintf(output.fp, "Mksubr(lo, hi, sp)\n"), Putl(output, 1);
  724.         (void)fprintf(output.fp, "%c%s%s%s%clo, hi;\n", tab1, registr, usigned, inttyp, tab1), Putl(output, 1);
  725.         (void)fprintf(output.fp, "%c%s%s%csp;\n", tab1, registr, setptyp, tab1), Putl(output, 1);
  726.         Putchr('{', output),Putchr('\n', output);
  727.         (void)fprintf(output.fp, "%c%s%s%ci, k;\n", tab1, registr, inttyp, tab1), Putl(output, 1);
  728.         Putchr('\n', output);
  729.         (void)fprintf(output.fp, "%cif (hi < lo)\n", tab1), Putl(output, 1);
  730.         (void)fprintf(output.fp, "%sreturn (sp);\n", tab2), Putl(output, 1);
  731.         (void)fprintf(output.fp, "%ci = hi / (setbits+1) + 1;\n", tab1), Putl(output, 1);
  732.         (void)fprintf(output.fp, "%cfor (k = *sp + 1; k <= i; k++)\n", tab1), Putl(output, 1);
  733.         (void)fprintf(output.fp, "%ssp[k] = 0;\n", tab2), Putl(output, 1);
  734.         (void)fprintf(output.fp, "%cif (*sp < i)\n", tab1), Putl(output, 1);
  735.         (void)fprintf(output.fp, "%s*sp = i;\n", tab2), Putl(output, 1);
  736.         (void)fprintf(output.fp, "%cfor (k = lo; k <= hi; k++)\n", tab1), Putl(output, 1);
  737.         (void)fprintf(output.fp, "%ssp[k / (setbits+1) + 1] |= (1 << (k %% (setbits+1)));\n", tab2), Putl(output, 1);
  738.         (void)fprintf(output.fp, "%creturn (sp);\n", tab1), Putl(output, 1);
  739.         Putchr('}', output),Putchr('\n', output);
  740.     }
  741.     if (useins) {
  742.         Putchr('\n', output);
  743.         (void)fprintf(output.fp, "%s%s\n", C50_static, setptyp), Putl(output, 1);
  744.         (void)fprintf(output.fp, "Insmem(m, sp)\n"), Putl(output, 1);
  745.         (void)fprintf(output.fp, "%c%s%s%s%cm;\n", tab1, registr, usigned, inttyp, tab1), Putl(output, 1);
  746.         (void)fprintf(output.fp, "%c%s%s%csp;\n", tab1, registr, setptyp, tab1), Putl(output, 1);
  747.         Putchr('{', output),Putchr('\n', output);
  748.         (void)fprintf(output.fp, "%c%s%s%ci,\n", tab1, registr, inttyp, tab1), Putl(output, 1);
  749.         (void)fprintf(output.fp, "%s%cj = m / (setbits+1) + 1;\n", tab3, tab1), Putl(output, 1);
  750.         Putchr('\n', output);
  751.         (void)fprintf(output.fp, "%cif (*sp < j)\n", tab1), Putl(output, 1);
  752.         (void)fprintf(output.fp, "%sfor (i = *sp + 1, *sp = j; i <= *sp; i++)\n", tab2), Putl(output, 1);
  753.         (void)fprintf(output.fp, "%ssp[i] = 0;\n", tab3), Putl(output, 1);
  754.         (void)fprintf(output.fp, "%csp[j] |= (1 << (m %% (setbits+1)));\n", tab1), Putl(output, 1);
  755.         (void)fprintf(output.fp, "%creturn (sp);\n", tab1), Putl(output, 1);
  756.         Putchr('}', output),Putchr('\n', output);
  757.     }
  758.     if (usesets) {
  759.         Putchr('\n', output);
  760.         (void)fprintf(output.fp, "%sSETSPACE\n", ifndef), Putl(output, 1);
  761.         (void)fprintf(output.fp, "%sSETSPACE 256\n", C4_define), Putl(output, 1);
  762.         (void)fprintf(output.fp, "%s\n", endif), Putl(output, 1);
  763.         (void)fprintf(output.fp, "%s%s\n", C50_static, setptyp), Putl(output, 1);
  764.         (void)fprintf(output.fp, "Currset(n,sp)\n"), Putl(output, 1);
  765.         (void)fprintf(output.fp, "%c%s%cn;\n", tab1, inttyp, tab1), Putl(output, 1);
  766.         (void)fprintf(output.fp, "%c%s%csp;\n", tab1, setptyp, tab1), Putl(output, 1);
  767.         Putchr('{', output),Putchr('\n', output);
  768.         (void)fprintf(output.fp, "%c%s%s%cSpace[SETSPACE];\n", tab1, C50_static, setwtyp, tab1), Putl(output, 1);
  769.         (void)fprintf(output.fp, "%c%s%s%cTop = Space;\n", tab1, C50_static, setptyp, tab1), Putl(output, 1);
  770.         Putchr('\n', output);
  771.         (void)fprintf(output.fp, "%cswitch (n) {\n", tab1), Putl(output, 1);
  772.         (void)fprintf(output.fp, "%c  case 0:\n", tab1), Putl(output, 1);
  773.         (void)fprintf(output.fp, "%sTop = Space;\n", tab2), Putl(output, 1);
  774.         (void)fprintf(output.fp, "%sreturn (0);\n", tab2), Putl(output, 1);
  775.         (void)fprintf(output.fp, "%c  case 1:\n", tab1), Putl(output, 1);
  776.         (void)fprintf(output.fp, "%sif (&Space[SETSPACE] - Top <= %1d) {\n", tab2, maxsetrange), Putl(output, 1);
  777.         (void)fprintf(output.fp, "%s%sfprintf(stderr, \"Set-space exhausted\\n\");\n", tab3, voidcast), Putl(output, 1);
  778.         (void)fprintf(output.fp, "%sexit(1);\n", tab3), Putl(output, 1);
  779.         (void)fprintf(output.fp, "%s}\n", tab2), Putl(output, 1);
  780.         (void)fprintf(output.fp, "%s*Top = 0;\n", tab2), Putl(output, 1);
  781.         (void)fprintf(output.fp, "%sreturn (Top);\n", tab2), Putl(output, 1);
  782.         (void)fprintf(output.fp, "%c  case 2:\n", tab1), Putl(output, 1);
  783.         (void)fprintf(output.fp, "%sif (Top <= &sp[*sp])\n", tab2), Putl(output, 1);
  784.         (void)fprintf(output.fp, "%sTop = &sp[*sp + 1];\n", tab3), Putl(output, 1);
  785.         (void)fprintf(output.fp, "%sreturn (sp);\n", tab2), Putl(output, 1);
  786.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  787.         (void)fprintf(output.fp, "%c/* NOTREACHED */\n", tab1), Putl(output, 1);
  788.         Putchr('}', output),Putchr('\n', output);
  789.     }
  790.     if (usescpy) {
  791.         Putchr('\n', output);
  792.         (void)fprintf(output.fp, "%s%s\n", C50_static, voidtyp), Putl(output, 1);
  793.         (void)fprintf(output.fp, "Setncpy(S1, S2, N)\n"), Putl(output, 1);
  794.         (void)fprintf(output.fp, "%c%s%s%cS1, S2;\n", tab1, registr, setptyp, tab1), Putl(output, 1);
  795.         (void)fprintf(output.fp, "%c%s%s%s%cN;\n", tab1, registr, usigned, inttyp, tab1), Putl(output, 1);
  796.         Putchr('{', output),Putchr('\n', output);
  797.         (void)fprintf(output.fp, "%c%s%s%s%cm;\n", tab1, registr, usigned, inttyp, tab1), Putl(output, 1);
  798.         Putchr('\n', output);
  799.         (void)fprintf(output.fp, "%cN /= sizeof(%s);\n", tab1, setwtyp), Putl(output, 1);
  800.         (void)fprintf(output.fp, "%c*S1++ = --N;\n", tab1), Putl(output, 1);
  801.         (void)fprintf(output.fp, "%cm = *S2++;\n", tab1), Putl(output, 1);
  802.         (void)fprintf(output.fp, "%cwhile (m != 0 && N != 0) {\n", tab1), Putl(output, 1);
  803.         (void)fprintf(output.fp, "%s*S1++ = *S2++;\n", tab2), Putl(output, 1);
  804.         (void)fprintf(output.fp, "%s--N;\n", tab2), Putl(output, 1);
  805.         (void)fprintf(output.fp, "%s--m;\n", tab2), Putl(output, 1);
  806.         (void)fprintf(output.fp, "%c}\n", tab1), Putl(output, 1);
  807.         (void)fprintf(output.fp, "%cwhile (N-- != 0)\n", tab1), Putl(output, 1);
  808.         (void)fprintf(output.fp, "%s*S1++ = 0;\n", tab2), Putl(output, 1);
  809.         Putchr('}', output),Putchr('\n', output);
  810.     }
  811.     if (usecase) {
  812.         Putchr('\n', output);
  813.         (void)fprintf(output.fp, "%s%s\n", C50_static, voidtyp), Putl(output, 1);
  814.         (void)fprintf(output.fp, "Caseerror(n)\n"), Putl(output, 1);
  815.         (void)fprintf(output.fp, "%c%s%cn;\n", tab1, inttyp, tab1), Putl(output, 1);
  816.         Putchr('{', output),Putchr('\n', output);
  817.         (void)fprintf(output.fp, "%c%sfprintf(stderr, \"Missing case limb: line %%d\\n\", n);\n", tab1, voidcast), Putl(output, 1);
  818.         (void)fprintf(output.fp, "%cexit(1);\n", tab1), Putl(output, 1);
  819.         Putchr('}', output),Putchr('\n', output);
  820.     }
  821.     if (usemax) {
  822.         Putchr('\n', output);
  823.         (void)fprintf(output.fp, "%s%s\n", C50_static, inttyp), Putl(output, 1);
  824.         (void)fprintf(output.fp, "Max(m, n)\n"), Putl(output, 1);
  825.         (void)fprintf(output.fp, "%c%s%cm, n;\n", tab1, inttyp, tab1), Putl(output, 1);
  826.         Putchr('{', output),Putchr('\n', output);
  827.         (void)fprintf(output.fp, "%cif (m > n)\n", tab1), Putl(output, 1);
  828.         (void)fprintf(output.fp, "%sreturn (m);\n", tab2), Putl(output, 1);
  829.         (void)fprintf(output.fp, "%creturn (n);\n", tab1), Putl(output, 1);
  830.         Putchr('}', output),Putchr('\n', output);
  831.     }
  832.     if (use(dtrunc)) {
  833.         (void)fprintf(output.fp, "%s%s\n", C50_static, inttyp), Putl(output, 1);
  834.         (void)fprintf(output.fp, "Trunc(f)\n"), Putl(output, 1);
  835.         printid(defnams.A[(int)(dreal)]->U.V6.lid);
  836.         (void)fprintf(output.fp, "%cf;\n", tab1), Putl(output, 1);
  837.         Putchr('{', output),Putchr('\n', output);
  838.         (void)fprintf(output.fp, "%creturn f;\n", tab1), Putl(output, 1);
  839.         Putchr('}', output),Putchr('\n', output);
  840.     }
  841.     if (use(dround)) {
  842.         (void)fprintf(output.fp, "%s%s\n", C50_static, inttyp), Putl(output, 1);
  843.         (void)fprintf(output.fp, "Round(f)\n"), Putl(output, 1);
  844.         printid(defnams.A[(int)(dreal)]->U.V6.lid);
  845.         (void)fprintf(output.fp, "%cf;\n", tab1), Putl(output, 1);
  846.         Putchr('{', output),Putchr('\n', output);
  847.         (void)fprintf(output.fp, "%c%s%s floor();\n", tab1, xtern, doubletyp), Putl(output, 1);
  848.         (void)fprintf(output.fp, "%creturn floor(%s(0.5+f));\n", tab1, dblcast), Putl(output, 1);
  849.         Putchr('}', output),Putchr('\n', output);
  850.     }
  851.     G194_conflag = F195;
  852.     G196_setused = F197;
  853.     G198_dropset = F199;
  854.     G200_donearr = F201;
  855.     G202_doarrow = F203;
  856.     G204_indnt = F205;
  857. }
  858.  
  859. void initialize();
  860.  
  861.  void
  862. defname(cn, str)
  863.     cnames    cn;
  864.     keyword    str;
  865. {
  866.     toknbuf    w;
  867.     register toknidx    i;
  868.  
  869.     {   register int    _j, _i = 1 - 1;
  870.         for (_j = 0; _j < 10; )
  871.         w.A[_i++] = str.A[_j++];
  872.     }
  873.     {
  874.         toknidx    B67 = 1,
  875.             B68 = keywordlen;
  876.  
  877.         if (B67 <= B68)
  878.             for (i = B67; ; i++) {
  879.                 if (w.A[i - 1] == space) {
  880.                     w.A[i - 1] = null;
  881.                     goto L999;
  882.                 }
  883.                 if (i == B68) break;
  884.             }
  885.     }
  886.     w.A[keywordlen + 1 - 1] = null;
  887. L999:
  888.     ctable.A[(int)(cn)] = saveid(&w);
  889. }
  890.  
  891.  void
  892. defid(nt, did, str)
  893.     treetyp    nt;
  894.     predefs    did;
  895.     keyword    str;
  896. {
  897.     toknbuf    w;
  898.     register toknidx    i;
  899.     treeptr    tp, tq, tv;
  900.  
  901.     {
  902.         toknidx    B69 = 1,
  903.             B70 = keywordlen;
  904.  
  905.         if (B69 <= B70)
  906.             for (i = B69; ; i++) {
  907.                 if (str.A[i - 1] == space) {
  908.                     w.A[i - 1] = null;
  909.                     goto L999;
  910.                 } else
  911.                     w.A[i - 1] = str.A[i - 1];
  912.                 if (i == B70) break;
  913.             }
  914.     }
  915.     w.A[keywordlen + 1 - 1] = null;
  916. L999:
  917.     tp = newid(saveid(&w));
  918.     defnams.A[(int)(did)] = tp->U.V43.tsym;
  919.     if (Member((unsigned)(nt), Conset[162])) {
  920.         tv = mknode(npredef);
  921.         tv->U.V12.tdef = did;
  922.         tv->U.V12.tobtyp = tnone;
  923.     } else
  924.         tv = (struct S61 *)NIL;
  925.     switch (nt) {
  926.       case nscalar:
  927.         tv = mknode(nscalar);
  928.         tv->U.V17.tscalid = (struct S61 *)NIL;
  929.         tq = mknode(ntype);
  930.         tq->U.V14.tbind = tv;
  931.         tq->U.V14.tidl = tp;
  932.         tp = tq;
  933.         break ;
  934.       case nconst:  case ntype:  case nfield:  case nvar:
  935.         tq = mknode(nt);
  936.         tq->U.V14.tbind = tv;
  937.         tq->U.V14.tidl = tp;
  938.         tq->U.V14.tattr = anone;
  939.         tp = tq;
  940.         break ;
  941.       case nfunc:  case nproc:
  942.         tq = mknode(nt);
  943.         tq->U.V13.tsubid = tp;
  944.         tq->U.V13.tsubstmt = tv;
  945.         tq->U.V13.tfuntyp = (struct S61 *)NIL;
  946.         tq->U.V13.tsubpar = (struct S61 *)NIL;
  947.         tq->U.V13.tsublab = (struct S61 *)NIL;
  948.         tq->U.V13.tsubconst = (struct S61 *)NIL;
  949.         tq->U.V13.tsubtype = (struct S61 *)NIL;
  950.         tq->U.V13.tsubvar = (struct S61 *)NIL;
  951.         tq->U.V13.tsubsub = (struct S61 *)NIL;
  952.         tq->U.V13.tscope = (struct S60 *)NIL;
  953.         tq->U.V13.tstat = 0;
  954.         tp = tq;
  955.         break ;
  956.       case nid:
  957.         break ;
  958.       default:
  959.         Caseerror(Line);
  960.     }
  961.     deftab.A[(int)(did)] = tp;
  962. }
  963.  
  964.  void
  965. defkey(s, w)
  966.     symtyp    s;
  967.     keyword    w;
  968. {
  969.     register unsigned char    i;
  970.  
  971.     {
  972.         unsigned char    B71 = 1,
  973.             B72 = keywordlen;
  974.  
  975.         if (B71 <= B72)
  976.             for (i = B71; ; i++) {
  977.                 if (w.A[i - 1] == space)
  978.                     w.A[i - 1] = null;
  979.                 if (i == B72) break;
  980.             }
  981.     }
  982.     {
  983.         register struct S206 *W73 = &keytab.A[(unsigned)(s)];
  984.  
  985.         W73->wrd = w;
  986.         W73->sym = s;
  987.     }
  988. }
  989.  
  990.  void
  991. fixinit(i)
  992.     strindx    i;
  993. {
  994.     toknbuf    t;
  995.  
  996.     gettokn(i, &t);
  997.     t.A[1 - 1] = 'i';
  998.     puttokn(i, &t);
  999. }
  1000.  
  1001.