# 2.11BSD#431 - /usr/src/ucb/pascal/pxp/const.c

##### Functions

    constbeg          X
    constend          X
    gconst            X

##### Variables

    cdecl             X
    cid               X
    cline             X
    constcnt          X

       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: STATIC  int constcnt = -1;
      13:
      14: /*
      15:  * The const declaration part
      16:  */
      17: constbeg(l, cline)
      18:     int l, cline;
      19: {
      20:
      21:     line = l;
      22:     if (nodecl)
      23:         printoff();
      24:     puthedr();
      25:     putcm();
      26:     ppnl();
      27:     indent();
      28:     ppkw("const");
      29:     ppgoin(DECL);
      30:     constcnt = 0;
      31:     setline(cline);
      32: }
      33:
      34: const(cline, cid, cdecl)
      35:     int cline;
      36:     char *cid;
      37:     int *cdecl;
      38: {
      39:
      40:     if (constcnt)
      41:         putcm();
      42:     setline(cline);
      43:     ppitem();
      44:     ppid(cid);
      45:     ppsep(" = ");
      46:     gconst(cdecl);
      47:     ppsep(";");
      48:     constcnt++;
      49:     setinfo(cline);
      50:     putcml();
      51: }
      52:
      53: constend()
      54: {
      55:
      56:     if (constcnt == -1)
      57:         return;
      58:     if (nodecl)
      59:         return;
      60:     if (constcnt == 0)
      61:         ppid("{const decls}");
      62:     ppgoout(DECL);
      63:     constcnt = -1;
      64: }
      65:
      66: /*
      67:  * A constant in an expression
      68:  * or a declaration.
      69:  */
      70: gconst(r)
      71:     int *r;
      72: {
      73:     register *cn;
      74:
      75:     cn = r;
      76: loop:
      77:     if (cn == NIL) {
      78:         ppid("{constant}");
      79:         return;
      80:     }
      81:     switch (cn[0]) {
      82:         default:
      83:             panic("gconst");
      84:         case T_PLUSC:
      85:             ppop("+");
      86:             cn = cn[1];
      87:             goto loop;
      88:         case T_MINUSC:
      89:             ppop("-");
      90:             cn = cn[1];
      91:             goto loop;
      92:         case T_ID:
      93:             ppid(cn[1]);
      94:             return;
      95:         case T_CBINT:
      96:         case T_CINT:
      97:         case T_CFINT:
      98:             ppnumb(cn[1]);
      99:             if (cn[0] == T_CBINT)
     100:                 ppsep("b");
     101:             return;
     102:         case T_CSTRNG:
     103:             ppstr(cn[1]);
     104:             return;
     105:     }
     106: }

#### Defined functions

constbeg defined in line 17; used 2 times

- in /usr/src/ucb/pascal/pxp/pas.y line 206, 213

constend defined in line 53; used 2 times

- in /usr/src/ucb/pascal/pxp/pas.y line 163, 175

gconst defined in line 70; used 5 times

- in line 46
- in /usr/src/ucb/pascal/pxp/case.c line 41
- in /usr/src/ucb/pascal/pxp/rec.c line 115
- in /usr/src/ucb/pascal/pxp/type.c line 170-172(2)

#### Defined variables

cdecl defined in line 37; used 2 times

- in line 34, 46

cid defined in line 36; used 2 times

- in line 34, 44

cline defined in line 35; used 6 times

- in line 17-18(2), 31-34(2), 42, 49

constcnt defined in line 12; used 6 times

- in line 30, 40, 48, 56-63(3)

Last modified: 1986-05-31 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 639 |