1: #
   2: /*
   3:  * pxp - Pascal execution profiler
   4:  *
   5:  * Bill Joy UCB
   6:  * Version 1.2 January 1979
   7:  */
   8: 
   9: #include "0.h"
  10: #include "tree.h"
  11: 
  12: /*
  13:  * Case statement
  14:  */
  15: caseop(r)
  16:     int *r;
  17: {
  18:     register *cl, *cs, i;
  19:     struct pxcnt scnt;
  20: 
  21:     savecnt(&scnt);
  22:     ppkw("case");
  23:     ppspac();
  24:     rvalue(r[2], NIL);
  25:     ppspac();
  26:     ppkw("of");
  27:     for (cl = r[3]; cl != NIL;) {
  28:         cs = cl[1];
  29:         if (cs == NIL)
  30:             continue;
  31:         baroff();
  32:         ppgoin(DECL);
  33:         setline(cs[1]);
  34:         ppnl();
  35:         indent();
  36:         ppbra(NIL);
  37:         cs = cs[2];
  38:         if (cs != NIL) {
  39:             i = 0;
  40:             for (;;) {
  41:                 gconst(cs[1]);
  42:                 cs = cs[2];
  43:                 if (cs == NIL)
  44:                     break;
  45:                 i++;
  46:                 if (i == 7) {
  47:                     ppsep(",");
  48:                     ppitem();
  49:                     i = 0;
  50:                 } else
  51:                     ppsep(", ");
  52:             }
  53:         } else
  54:             ppid("{case label list}");
  55:         ppket(":");
  56:         cs = cl[1];
  57:         cs = cs[3];
  58:         getcnt();
  59:         ppgoin(STAT);
  60:         if (cs != NIL && cs[0] == T_BLOCK) {
  61:             ppnl();
  62:             indent();
  63:             baron();
  64:             ppstbl1(cs, STAT);
  65:             baroff();
  66:             ppstbl2();
  67:             baron();
  68:         } else {
  69:             baron();
  70:             statement(cs);
  71:         }
  72:         ppgoout(STAT);
  73:         ppgoout(DECL);
  74:         cl = cl[2];
  75:         if (cl == NIL)
  76:             break;
  77:         ppsep(";");
  78:     }
  79:     if (rescnt(&scnt))
  80:         getcnt();
  81:     ppnl();
  82:     indent();
  83:     ppkw("end");
  84: }

Defined functions

caseop defined in line 15; used 1 times
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 739
Valid CSS Valid XHTML 1.0 Strict