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

##### Functions

    dashes            X
    flush             X
    indent            X
    indent1           X
    indentlab         X
    linopr            X
    outerr            X
    ppbra             X
    ppgoin            X
    ppgoout           X
    ppid              X
    ppitem            X
    ppket             X
    ppkw              X
    pplab             X
    ppnl              X
    ppnumb            X
    ppop              X
    pppay             X
    ppsep             X
    ppsnl             X
    ppsnlb            X
    ppspac            X
    ppstr             X
    pptab             X
    ppunspac          X
    printoff          X
    printon           X
    putchar           X
    setprint          X

##### Variables

    fout              X
    killsp            X
    nopflg            X
    outcol            X
    owenl             X
    owenlb            X
    pplev             X

##### Macros

    noprint           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:
      11: #define noprint() nopflg
      12:
      13: int pplev[3];   /* STAT, DECL, PRFN */
      14: int nopflg;
      15:
      16: setprint()
      17: {
      18:
      19:     if (profile == 0) {
      20:         if (table)
      21:             nopflg = 1;
      22:         else
      23:             nopflg = 0;
      24:         return;
      25:     }
      26:     nopflg = !all && nowcnt() == 0 || !opt('z');
      27: }
      28:
      29: printon()
      30: {
      31:
      32:     if (profile == 0) {
      33:         if (table)
      34:             nopflg = 1;
      35:         return;
      36:     }
      37:     nopflg = 0;
      38: }
      39:
      40: printoff()
      41: {
      42:
      43:     nopflg = 1;
      44: }
      45:
      46: ppkw(s)
      47:     register char *s;
      48: {
      49:     register char *cp, i;
      50:
      51:     if (noprint())
      52:         return;
      53:     /*
      54: 	 * First real thing printed
      55: 	 * is always a keyword
      56: 	 * or includes an "id" (if a comment)
      57: 	 * (See ppnl below)
      58: 	 */
      59:     hadsome = 1;
      60:     if (underline) {
      61:         for (cp = s; *cp; cp++)
      62:             putchar('_');
      63:         for (cp = s; *cp; cp++)
      64:             putchar('\b');
      65:     }
      66:     printf(s);
      67: }
      68:
      69: ppid(s)
      70:     register char *s;
      71: {
      72:
      73:     if (noprint())
      74:         return;
      75:     hadsome = 1;
      76:     if (s == NIL)
      77:         s = "{identifier}";
      78:     printf(s);
      79: }
      80:
      81: ppbra(s)
      82:     register char *s;
      83: {
      84:
      85:     if (noprint())
      86:         return;
      87:     if (s != NIL)
      88:         printf(s);
      89: }
      90:
      91: ppsep(s)
      92:     char *s;
      93: {
      94:
      95:     if (noprint())
      96:         return;
      97:     printf(s);
      98: }
      99:
     100: ppket(s)
     101:     char *s;
     102: {
     103:
     104:     if (noprint())
     105:         return;
     106:     if (s != NIL)
     107:         printf(s);
     108: }
     109:
     110: char    killsp;
     111:
     112: ppunspac()
     113: {
     114:
     115:     killsp = 1;
     116: }
     117:
     118: ppspac()
     119: {
     120:
     121:     if (killsp) {
     122:         killsp = 0;
     123:         return;
     124:     }
     125:     if (noprint())
     126:         return;
     127:     putchar(' ');
     128: }
     129:
     130: ppitem()
     131: {
     132:
     133:     if (noprint())
     134:         return;
     135:     ppnl();
     136:     indent();
     137: }
     138:
     139: int owenl, owenlb;
     140:
     141: ppsnlb()
     142: {
     143:
     144:     if (nopflg)
     145:         return;
     146:     owenlb++;
     147: }
     148:
     149: ppsnl()
     150: {
     151:
     152:     if (nopflg)
     153:         return;
     154:     owenl++;
     155: }
     156:
     157: pppay()
     158: {
     159:
     160:     while (owenl || owenlb) {
     161:         putchar('\n');
     162:         if (owenlb) {
     163:             putchar(' ');
     164:             owenlb--;
     165:         } else
     166:             owenl--;
     167:     }
     168: }
     169:
     170: ppnl()
     171: {
     172:
     173:     if (noprint())
     174:         return;
     175:     if (hadsome == 0)
     176:         return;
     177:     pppay();
     178:     putchar('\n');
     179: }
     180:
     181: indent()
     182: {
     183:     register i;
     184:
     185:     if (noprint())
     186:         return;
     187:     linopr();
     188:     if (profile == 0) {
     189:         indent1(pplev[PRFN] + pplev[DECL] + pplev[STAT]);
     190:         return;
     191:     }
     192:     indent1(pplev[PRFN] + pplev[STAT]);
     193:     switch (i = shudpcnt()) {
     194:         case 1:
     195:             printf("%7.7ld.", nowcnt());
     196:             dashes('-');
     197:             putchar('|');
     198:             break;
     199:         case 0:
     200:         case -1:
     201:             printf("        ");
     202:             dashes(' ');
     203:             putchar(i == 0 ? '|' : ' ');
     204:             break;
     205:     }
     206:     indent1(pplev[DECL]);
     207: }
     208:
     209: dashes(c)
     210:     char c;
     211: {
     212:     register i;
     213:
     214:     for (i = unit - 1; i != 0; i--)
     215:         putchar(c);
     216: }
     217:
     218: indent1(in)
     219:     int in;
     220: {
     221:     register i;
     222:
     223:     if (noprint())
     224:         return;
     225:     i = in;
     226:     if (profile == 0)
     227:         while (i >= 8) {
     228:             putchar('\t');
     229:             i -= 8;
     230:         }
     231:     while (i > 0) {
     232:         putchar(' ');
     233:         i--;
     234:     }
     235: }
     236:
     237: linopr()
     238: {
     239:
     240:     if (noprint())
     241:         return;
     242:     if (profile) {
     243:         if (line < 0)
     244:             line = -line;
     245:         printf("%6d  ", line);
     246:     }
     247: }
     248:
     249: indentlab()
     250: {
     251:
     252:     indent1(pplev[PRFN]);
     253: }
     254:
     255: ppop(s)
     256:     char *s;
     257: {
     258:
     259:     if (noprint())
     260:         return;
     261:     printf(s);
     262: }
     263:
     264: ppnumb(s)
     265:     char *s;
     266: {
     267:
     268:     if (noprint())
     269:         return;
     270:     if (s == NIL)
     271:         s = "{number}";
     272:     printf(s);
     273: }
     274:
     275: ppgoin(lv)
     276: {
     277:
     278:     pplev[lv] += unit;
     279: }
     280:
     281: ppgoout(lv)
     282: {
     283:
     284:     pplev[lv] -= unit;
     285:     if (pplev[lv] < 0)
     286:         panic("pplev");
     287: }
     288:
     289: ppstr(s)
     290:     char *s;
     291: {
     292:     register char *cp;
     293:
     294:     if (noprint())
     295:         return;
     296:     if (s == NIL) {
     297:         printf("{string}");
     298:         return;
     299:     }
     300:     putchar('\'');
     301:     cp = s;
     302:     while (*cp) {
     303:         putchar(*cp);
     304:         if (*cp == '\'')
     305:             putchar('\'');
     306:         cp++;
     307:     }
     308:     putchar('\'');
     309: }
     310:
     311: pplab(s)
     312:     char *s;
     313: {
     314:
     315:     if (noprint())
     316:         return;
     317:     if (s == NIL)
     318:         s = "{integer label}";
     319:     printf(s);
     320: }
     321:
     322: int fout[259] = { 1 };
     323: extern  int putchar(), flush();
     324:
     325: int outcol;
     326:
     327: extern  int werflg;
     328:
     329: putchar(c)
     330:     char c;
     331: {
     332:
     333:     werflg = 0;
     334:     putc(c, fout);
     335:     if (werflg)
     336:         outerr();
     337:     switch (c) {
     338:         case '\n':
     339:             outcol = 0;
     340:             flush();
     341:             break;
     342:         case '\t':
     343:             outcol += 8;
     344:             outcol &= ~07;
     345:             break;
     346:         case '\b':
     347:             if (outcol)
     348:                 outcol--;
     349:             break;
     350:         default:
     351:             outcol++;
     352:         case '\f':
     353:             break;
     354:     }
     355: }
     356:
     357: flush()
     358: {
     359:
     360:     werflg = 0;
     361:     fflush(fout);
     362:     if (werflg)
     363:         outerr();
     364: }
     365:
     366: pptab()
     367: {
     368:     register int i;
     369:
     370:     if (noprint())
     371:         return;
     372:     i = pplev[PRFN] + profile ? 44 + unit : 28;
     373: /*
     374: 	if (outcol > i + 8) {
     375: 		ppnl();
     376: 		i += 8;
     377: 	}
     378: */
     379:     do
     380:         putchar('\t');
     381:     while (outcol < i);
     382: }
     383:
     384: outerr()
     385: {
     386:     extern int errno;
     387:
     388:     errno = werflg;
     389:     perror(stdoutn);
     390:     pexit(DIED);
     391: }

#### Defined functions

dashes defined in line 209; used 2 times

- in line 196, 202

flush defined in line 357; used 11 times

- in line 323, 340
- in /usr/src/ucb/pascal/pxp/0.h line 298
- in /usr/src/ucb/pascal/pxp/error.c line 71, 111
- in /usr/src/ucb/pascal/pxp/main.c line 243
- in /usr/src/ucb/pascal/pxp/pmon.c line 345
- in /usr/src/ucb/pascal/pxp/yycosts.c line 228
- in /usr/src/ucb/pascal/pxp/yyerror.c line 47, 83
- in /usr/src/ucb/pascal/pxp/yymain.c line 78

indent defined in line 181; used 27 times

- in line 136
- in /usr/src/ucb/pascal/pxp/case.c line 35, 62, 82
- in /usr/src/ucb/pascal/pxp/const.c line 27
- in /usr/src/ucb/pascal/pxp/fdec.c line 43, 149, 196, 207
- in /usr/src/ucb/pascal/pxp/lab.c line 24-28(2)
- in /usr/src/ucb/pascal/pxp/rec.c line 20, 38, 110
- in /usr/src/ucb/pascal/pxp/stat.c line 72-82(3), 88-93(2), 107-112(2), 199, 256, 285
- in /usr/src/ucb/pascal/pxp/type.c line 26
- in /usr/src/ucb/pascal/pxp/var.c line 26
- in /usr/src/ucb/pascal/pxp/yycomm.c line 358

indent1 defined in line 218; used 4 times

- in line 189-192(2), 206, 252

indentlab defined in line 249; used 1 times

- in /usr/src/ucb/pascal/pxp/lab.c line 67

linopr defined in line 237; used 2 times

- in line 187
- in /usr/src/ucb/pascal/pxp/lab.c line 66

outerr defined in line 384; used 2 times

- in line 336, 363

ppbra defined in line 81; used 11 times

- in /usr/src/ucb/pascal/pxp/call.c line 22
- in /usr/src/ucb/pascal/pxp/case.c line 36
- in /usr/src/ucb/pascal/pxp/cset.c line 20
- in /usr/src/ucb/pascal/pxp/fdec.c line 62, 113
- in /usr/src/ucb/pascal/pxp/lab.c line 29
- in /usr/src/ucb/pascal/pxp/lval.c line 52
- in /usr/src/ucb/pascal/pxp/rec.c line 25, 111
- in /usr/src/ucb/pascal/pxp/rval.c line 58
- in /usr/src/ucb/pascal/pxp/yycomm.c line 321

ppgoin defined in line 275; used 20 times

- in /usr/src/ucb/pascal/pxp/case.c line 32, 59
- in /usr/src/ucb/pascal/pxp/const.c line 29
- in /usr/src/ucb/pascal/pxp/fdec.c line 37, 147, 166, 201
- in /usr/src/ucb/pascal/pxp/lab.c line 26
- in /usr/src/ucb/pascal/pxp/rec.c line 18, 27, 107
- in /usr/src/ucb/pascal/pxp/stat.c line 191, 216, 250, 260, 277, 301
- in /usr/src/ucb/pascal/pxp/type.c line 28, 144
- in /usr/src/ucb/pascal/pxp/var.c line 28

ppgoout defined in line 281; used 20 times

- in /usr/src/ucb/pascal/pxp/case.c line 72-73(2)
- in /usr/src/ucb/pascal/pxp/const.c line 62
- in /usr/src/ucb/pascal/pxp/fdec.c line 132, 152, 205, 215
- in /usr/src/ucb/pascal/pxp/lab.c line 43
- in /usr/src/ucb/pascal/pxp/rec.c line 35-40(2), 128
- in /usr/src/ucb/pascal/pxp/stat.c line 193, 218, 254, 261, 279, 303
- in /usr/src/ucb/pascal/pxp/type.c line 59, 157
- in /usr/src/ucb/pascal/pxp/var.c line 68

ppid defined in line 69; used 36 times

- in /usr/src/ucb/pascal/pxp/call.c line 20
- in /usr/src/ucb/pascal/pxp/case.c line 54
- in /usr/src/ucb/pascal/pxp/const.c line 44, 61, 78, 93
- in /usr/src/ucb/pascal/pxp/fdec.c line 58, 85, 92, 115, 233
- in /usr/src/ucb/pascal/pxp/lab.c line 40
- in /usr/src/ucb/pascal/pxp/lval.c line 20, 34-37(2)
- in /usr/src/ucb/pascal/pxp/rec.c line 62, 69, 97, 122
- in /usr/src/ucb/pascal/pxp/rval.c line 28
- in /usr/src/ucb/pascal/pxp/stat.c line 48, 141
- in /usr/src/ucb/pascal/pxp/type.c line 43, 58, 71, 81-85(2), 146, 159, 197
- in /usr/src/ucb/pascal/pxp/var.c line 45, 52, 67
- in /usr/src/ucb/pascal/pxp/yycomm.c line 323, 354, 399

ppitem defined in line 130; used 13 times

- in /usr/src/ucb/pascal/pxp/case.c line 48
- in /usr/src/ucb/pascal/pxp/const.c line 43
- in /usr/src/ucb/pascal/pxp/rec.c line 42, 59, 92
- in /usr/src/ucb/pascal/pxp/stat.c line 47, 66, 97-101(2), 116
- in /usr/src/ucb/pascal/pxp/type.c line 42, 153
- in /usr/src/ucb/pascal/pxp/var.c line 42

ppket defined in line 100; used 11 times

- in /usr/src/ucb/pascal/pxp/call.c line 45
- in /usr/src/ucb/pascal/pxp/case.c line 55
- in /usr/src/ucb/pascal/pxp/cset.c line 38
- in /usr/src/ucb/pascal/pxp/fdec.c line 103, 121
- in /usr/src/ucb/pascal/pxp/lab.c line 41
- in /usr/src/ucb/pascal/pxp/lval.c line 63
- in /usr/src/ucb/pascal/pxp/rec.c line 43, 123
- in /usr/src/ucb/pascal/pxp/rval.c line 105
- in /usr/src/ucb/pascal/pxp/yycomm.c line 328

ppkw defined in line 46; used 45 times

- in /usr/src/ucb/pascal/pxp/call.c line 33
- in /usr/src/ucb/pascal/pxp/case.c line 22-26(2), 83
- in /usr/src/ucb/pascal/pxp/const.c line 28
- in /usr/src/ucb/pascal/pxp/fdec.c line 46-52(3), 70-78(3), 150, 197, 208
- in /usr/src/ucb/pascal/pxp/lab.c line 25, 54
- in /usr/src/ucb/pascal/pxp/rec.c line 21, 39, 93, 102
- in /usr/src/ucb/pascal/pxp/rval.c line 42, 69, 96
- in /usr/src/ucb/pascal/pxp/stat.c line 129, 160-164(2), 179-183(2), 205, 234, 249, 257, 276, 286, 295, 311
- in /usr/src/ucb/pascal/pxp/type.c line 27, 102, 115-124(4), 183, 200
- in /usr/src/ucb/pascal/pxp/var.c line 27

pplab defined in line 311; used 3 times

- in /usr/src/ucb/pascal/pxp/lab.c line 33, 56, 68

ppnl defined in line 170; used 34 times

- in line 135
- in /usr/src/ucb/pascal/pxp/case.c line 34, 61, 81
- in /usr/src/ucb/pascal/pxp/const.c line 26
- in /usr/src/ucb/pascal/pxp/fdec.c line 40-42(2), 148, 194-195(2), 206, 223
- in /usr/src/ucb/pascal/pxp/lab.c line 23-27(2)
- in /usr/src/ucb/pascal/pxp/rec.c line 19, 37, 109
- in /usr/src/ucb/pascal/pxp/stat.c line 57, 71-81(3), 87-92(2), 106-111(2), 198, 255, 284
- in /usr/src/ucb/pascal/pxp/type.c line 25
- in /usr/src/ucb/pascal/pxp/var.c line 25
- in /usr/src/ucb/pascal/pxp/yycomm.c line 316, 349-357(3)

ppnumb defined in line 264; used 2 times

- in /usr/src/ucb/pascal/pxp/const.c line 98
- in /usr/src/ucb/pascal/pxp/rval.c line 37

ppop defined in line 255; used 9 times

- in /usr/src/ucb/pascal/pxp/const.c line 85-89(2)
- in /usr/src/ucb/pascal/pxp/lval.c line 27, 33
- in /usr/src/ucb/pascal/pxp/rval.c line 64, 98
- in /usr/src/ucb/pascal/pxp/type.c line 97
- in /usr/src/ucb/pascal/pxp/yycomm.c line 315, 394

pppay defined in line 157; used 1 times

- in line 177

ppsep defined in line 91; used 48 times

- in /usr/src/ucb/pascal/pxp/call.c line 28, 35, 43
- in /usr/src/ucb/pascal/pxp/case.c line 47-51(2), 77
- in /usr/src/ucb/pascal/pxp/const.c line 45-47(2), 100
- in /usr/src/ucb/pascal/pxp/cset.c line 30, 36
- in /usr/src/ucb/pascal/pxp/fdec.c line 89-94(2), 100, 106-109(2), 119-123(2), 151, 209, 232-234(2)
- in /usr/src/ucb/pascal/pxp/lab.c line 37, 69
- in /usr/src/ucb/pascal/pxp/lval.c line 59
- in /usr/src/ucb/pascal/pxp/rec.c line 66-70(2), 78-81(2), 98, 119, 132
- in /usr/src/ucb/pascal/pxp/rval.c line 39
- in /usr/src/ucb/pascal/pxp/stat.c line 27, 138, 150
- in /usr/src/ucb/pascal/pxp/type.c line 44-46(2), 140, 150, 160, 171, 185, 194-198(2)
- in /usr/src/ucb/pascal/pxp/var.c line 49-55(3)

ppsnl defined in line 149; used 1 times

- in /usr/src/ucb/pascal/pxp/yycomm.c line 342

ppsnlb defined in line 141; used 1 times

- in /usr/src/ucb/pascal/pxp/yycomm.c line 345

ppspac defined in line 118; used 45 times

- in /usr/src/ucb/pascal/pxp/call.c line 32
- in /usr/src/ucb/pascal/pxp/case.c line 23-25(2)
- in /usr/src/ucb/pascal/pxp/fdec.c line 57, 71-79(3), 101
- in /usr/src/ucb/pascal/pxp/lab.c line 55
- in /usr/src/ucb/pascal/pxp/rec.c line 22-24(2), 96-101(2)
- in /usr/src/ucb/pascal/pxp/rval.c line 70, 94-99(2)
- in /usr/src/ucb/pascal/pxp/stat.c line 130, 161-165(3), 180-184(3), 202-207(2), 235, 258, 294-296(2), 312
- in /usr/src/ucb/pascal/pxp/type.c line 80-123(12), 184, 199
- in /usr/src/ucb/pascal/pxp/yycomm.c line 361

ppstr defined in line 289; used 2 times

- in /usr/src/ucb/pascal/pxp/const.c line 103
- in /usr/src/ucb/pascal/pxp/rval.c line 54

pptab defined in line 366; used 1 times

- in /usr/src/ucb/pascal/pxp/yycomm.c line 365

ppunspac defined in line 112; used 1 times

- in /usr/src/ucb/pascal/pxp/type.c line 188

printoff defined in line 40; used 6 times

- in /usr/src/ucb/pascal/pxp/const.c line 23
- in /usr/src/ucb/pascal/pxp/fdec.c line 35, 188
- in /usr/src/ucb/pascal/pxp/lab.c line 20
- in /usr/src/ucb/pascal/pxp/type.c line 22
- in /usr/src/ucb/pascal/pxp/var.c line 22

printon defined in line 29; used 2 times

- in /usr/src/ucb/pascal/pxp/fdec.c line 33, 222

putchar defined in line 329; used 45 times

- in line 62-64(2), 127, 161-163(2), 178, 197, 203, 215, 228-232(2), 300-308(4), 323, 380
- in /usr/src/ucb/pascal/pxp/0.h line 298
- in /usr/src/ucb/pascal/pxp/error.c line 88, 109
- in /usr/src/ucb/pascal/pxp/main.c line 215-216(2), 242
- in /usr/src/ucb/pascal/pxp/nl.c line 448-458(4), 539
- in /usr/src/ucb/pascal/pxp/pmon.c line 218
- in /usr/src/ucb/pascal/pxp/printf.s line 8, 31, 240, 247, 254
- in /usr/src/ucb/pascal/pxp/yycomm.c line 305
- in /usr/src/ucb/pascal/pxp/yyerror.c line 57-60(3), 67
- in /usr/src/ucb/pascal/pxp/yymain.c line 77
- in /usr/src/ucb/pascal/pxp/yyput.c line 194, 213-214(2), 277
- in /usr/src/ucb/pascal/pxp/yyrecover.c line 211

setprint defined in line 16; used 3 times

- in /usr/src/ucb/pascal/pxp/fdec.c line 31, 129, 186

#### Defined variables

fout defined in line 322; used 2 times

- in line 334, 361

killsp defined in line 110; used 3 times

- in line 115, 121-122(2)

nopflg defined in line 14; used 10 times

- in line 11, 21-26(3), 34-37(2), 43, 144, 152
- in /usr/src/ucb/pascal/pxp/yyput.c line 246

outcol defined in line 325; used 7 times

- in line 339-351(6), 381

owenl defined in line 139; used 3 times

- in line 154, 160, 166

owenlb defined in line 139; used 4 times

- in line 146, 160-164(3)

pplev defined in line 13; used 11 times

- in line 189-192(5), 206, 252, 278, 284-285(2), 372

#### Defined macros

noprint defined in line 11; used 16 times

- in line 51, 73, 85, 95, 104, 125, 133, 173, 185, 223, 240, 259, 268, 294, 315, 370

Last modified: 1986-06-01 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1340 |