# 2.11BSD#431 - /usr/src/ucb/PORT/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

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

##### Macros

    noprint           X

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

#### Defined functions

dashes defined in line 218; used 2 times

- in line 205, 211

flush defined in line 361; used 4 times

- in line 344
- in /usr/src/ucb/PORT/pascal/pxp/main.c line 258
- in /usr/src/ucb/PORT/pascal/pxp/pmon.c line 359
- in /usr/src/ucb/PORT/pascal/pxp/yymain.c line 85

indent defined in line 190; used 33 times

- in line 145
- in /usr/src/ucb/PORT/pascal/pxp/case.c line 64, 91, 111
- in /usr/src/ucb/PORT/pascal/pxp/const.c line 36
- in /usr/src/ucb/PORT/pascal/pxp/fdec.c line 52, 158, 205, 216, 273
- in /usr/src/ucb/PORT/pascal/pxp/lab.c line 33-37(2)
- in /usr/src/ucb/PORT/pascal/pxp/rec.c line 29, 47, 119
- in /usr/src/ucb/PORT/pascal/pxp/rmothers.c line 122, 138, 155, 169, 184
- in /usr/src/ucb/PORT/pascal/pxp/stat.c line 81-91(3), 97-102(2), 116-121(2), 204, 261, 290
- in /usr/src/ucb/PORT/pascal/pxp/type.c line 35
- in /usr/src/ucb/PORT/pascal/pxp/var.c line 35
- in /usr/src/ucb/PORT/pascal/pxp/yycomm.c line 368

indent1 defined in line 227; used 4 times

- in line 198-201(2), 215, 261

indentlab defined in line 258; used 1 times

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

linopr defined in line 246; used 2 times

- in line 196
- in /usr/src/ucb/PORT/pascal/pxp/lab.c line 75

outerr defined in line 387; used 2 times

- in line 340, 366

ppbra defined in line 90; used 11 times

- in /usr/src/ucb/PORT/pascal/pxp/call.c line 32
- in /usr/src/ucb/PORT/pascal/pxp/case.c line 65
- in /usr/src/ucb/PORT/pascal/pxp/cset.c line 29
- in /usr/src/ucb/PORT/pascal/pxp/fdec.c line 71, 122
- in /usr/src/ucb/PORT/pascal/pxp/lab.c line 38
- in /usr/src/ucb/PORT/pascal/pxp/lval.c line 61
- in /usr/src/ucb/PORT/pascal/pxp/rec.c line 34, 120
- in /usr/src/ucb/PORT/pascal/pxp/rval.c line 67
- in /usr/src/ucb/PORT/pascal/pxp/yycomm.c line 331

ppgoin defined in line 284; used 24 times

- in /usr/src/ucb/PORT/pascal/pxp/case.c line 61, 88
- in /usr/src/ucb/PORT/pascal/pxp/const.c line 38
- in /usr/src/ucb/PORT/pascal/pxp/fdec.c line 46, 156, 175, 210, 271
- in /usr/src/ucb/PORT/pascal/pxp/lab.c line 35
- in /usr/src/ucb/PORT/pascal/pxp/rec.c line 27, 36, 116
- in /usr/src/ucb/PORT/pascal/pxp/rmothers.c line 120, 153, 171
- in /usr/src/ucb/PORT/pascal/pxp/stat.c line 196, 221, 255, 265, 282, 306
- in /usr/src/ucb/PORT/pascal/pxp/type.c line 37, 158
- in /usr/src/ucb/PORT/pascal/pxp/var.c line 37

ppgoout defined in line 290; used 25 times

- in /usr/src/ucb/PORT/pascal/pxp/case.c line 101-102(2)
- in /usr/src/ucb/PORT/pascal/pxp/const.c line 71
- in /usr/src/ucb/PORT/pascal/pxp/fdec.c line 141, 161, 214, 224, 276
- in /usr/src/ucb/PORT/pascal/pxp/lab.c line 52
- in /usr/src/ucb/PORT/pascal/pxp/rec.c line 44-49(2), 137
- in /usr/src/ucb/PORT/pascal/pxp/rmothers.c line 152, 167, 179, 190
- in /usr/src/ucb/PORT/pascal/pxp/stat.c line 198, 223, 259, 266, 284, 308
- in /usr/src/ucb/PORT/pascal/pxp/type.c line 68, 171
- in /usr/src/ucb/PORT/pascal/pxp/var.c line 77

ppid defined in line 78; used 38 times

- in /usr/src/ucb/PORT/pascal/pxp/call.c line 30
- in /usr/src/ucb/PORT/pascal/pxp/case.c line 83
- in /usr/src/ucb/PORT/pascal/pxp/const.c line 53, 70, 87, 102
- in /usr/src/ucb/PORT/pascal/pxp/fdec.c line 67, 94, 101, 124, 242
- in /usr/src/ucb/PORT/pascal/pxp/lab.c line 49
- in /usr/src/ucb/PORT/pascal/pxp/lval.c line 29, 43-46(2)
- in /usr/src/ucb/PORT/pascal/pxp/rec.c line 71, 78, 106, 131
- in /usr/src/ucb/PORT/pascal/pxp/rval.c line 37
- in /usr/src/ucb/PORT/pascal/pxp/stat.c line 57, 146
- in /usr/src/ucb/PORT/pascal/pxp/type.c line 52, 67, 80, 90-94(2), 160, 173, 184-186(2), 225
- in /usr/src/ucb/PORT/pascal/pxp/var.c line 54, 61, 76
- in /usr/src/ucb/PORT/pascal/pxp/yycomm.c line 333, 364, 409

ppitem defined in line 139; used 12 times

- in /usr/src/ucb/PORT/pascal/pxp/case.c line 77
- in /usr/src/ucb/PORT/pascal/pxp/const.c line 52
- in /usr/src/ucb/PORT/pascal/pxp/rec.c line 51, 68, 101
- in /usr/src/ucb/PORT/pascal/pxp/stat.c line 56, 75, 106-110(2)
- in /usr/src/ucb/PORT/pascal/pxp/type.c line 51, 167
- in /usr/src/ucb/PORT/pascal/pxp/var.c line 51

ppket defined in line 109; used 11 times

- in /usr/src/ucb/PORT/pascal/pxp/call.c line 55
- in /usr/src/ucb/PORT/pascal/pxp/case.c line 84
- in /usr/src/ucb/PORT/pascal/pxp/cset.c line 47
- in /usr/src/ucb/PORT/pascal/pxp/fdec.c line 112, 130
- in /usr/src/ucb/PORT/pascal/pxp/lab.c line 50
- in /usr/src/ucb/PORT/pascal/pxp/lval.c line 72
- in /usr/src/ucb/PORT/pascal/pxp/rec.c line 52, 132
- in /usr/src/ucb/PORT/pascal/pxp/rval.c line 144
- in /usr/src/ucb/PORT/pascal/pxp/yycomm.c line 338

ppkw defined in line 55; used 49 times

- in /usr/src/ucb/PORT/pascal/pxp/call.c line 43
- in /usr/src/ucb/PORT/pascal/pxp/case.c line 51-55(2), 112
- in /usr/src/ucb/PORT/pascal/pxp/const.c line 37
- in /usr/src/ucb/PORT/pascal/pxp/fdec.c line 55-61(3), 79-87(3), 159, 206, 217, 274
- in /usr/src/ucb/PORT/pascal/pxp/lab.c line 34, 63
- in /usr/src/ucb/PORT/pascal/pxp/rec.c line 30, 48, 102, 111
- in /usr/src/ucb/PORT/pascal/pxp/rmothers.c line 115-119(2), 151, 170
- in /usr/src/ucb/PORT/pascal/pxp/rval.c line 51, 94, 135
- in /usr/src/ucb/PORT/pascal/pxp/stat.c line 134, 165-169(2), 184-188(2), 210, 239, 254, 262, 281, 291, 300
- in /usr/src/ucb/PORT/pascal/pxp/type.c line 36, 115, 129-138(4), 211, 228
- in /usr/src/ucb/PORT/pascal/pxp/var.c line 36

pplab defined in line 320; used 3 times

- in /usr/src/ucb/PORT/pascal/pxp/lab.c line 42, 65, 77

ppnl defined in line 179; used 40 times

- in line 144
- in /usr/src/ucb/PORT/pascal/pxp/case.c line 63, 90, 110
- in /usr/src/ucb/PORT/pascal/pxp/const.c line 35
- in /usr/src/ucb/PORT/pascal/pxp/fdec.c line 49-51(2), 157, 203-204(2), 215, 232, 272
- in /usr/src/ucb/PORT/pascal/pxp/lab.c line 32-36(2)
- in /usr/src/ucb/PORT/pascal/pxp/rec.c line 28, 46, 118
- in /usr/src/ucb/PORT/pascal/pxp/rmothers.c line 121, 137, 154, 168, 183
- in /usr/src/ucb/PORT/pascal/pxp/stat.c line 66, 80-90(3), 96-101(2), 115-120(2), 203, 260, 289
- in /usr/src/ucb/PORT/pascal/pxp/type.c line 34
- in /usr/src/ucb/PORT/pascal/pxp/var.c line 34
- in /usr/src/ucb/PORT/pascal/pxp/yycomm.c line 326, 359-367(3)

ppnumb defined in line 273; used 2 times

- in /usr/src/ucb/PORT/pascal/pxp/const.c line 107
- in /usr/src/ucb/PORT/pascal/pxp/rval.c line 46

ppop defined in line 264; used 9 times

- in /usr/src/ucb/PORT/pascal/pxp/const.c line 94-98(2)
- in /usr/src/ucb/PORT/pascal/pxp/lval.c line 36, 42
- in /usr/src/ucb/PORT/pascal/pxp/rval.c line 82, 137
- in /usr/src/ucb/PORT/pascal/pxp/type.c line 110
- in /usr/src/ucb/PORT/pascal/pxp/yycomm.c line 325, 404

pppay defined in line 166; used 1 times

- in line 186

ppsep defined in line 100; used 55 times

- in /usr/src/ucb/PORT/pascal/pxp/call.c line 38, 45, 53
- in /usr/src/ucb/PORT/pascal/pxp/case.c line 76-80(2), 106
- in /usr/src/ucb/PORT/pascal/pxp/const.c line 54-56(2), 109
- in /usr/src/ucb/PORT/pascal/pxp/cset.c line 39, 45
- in /usr/src/ucb/PORT/pascal/pxp/fdec.c line 98-103(2), 109, 115-118(2), 128-132(2), 160, 218, 241-243(2), 275
- in /usr/src/ucb/PORT/pascal/pxp/lab.c line 46, 78
- in /usr/src/ucb/PORT/pascal/pxp/lval.c line 68
- in /usr/src/ucb/PORT/pascal/pxp/rec.c line 75-79(2), 87-90(2), 107, 128, 141
- in /usr/src/ucb/PORT/pascal/pxp/rmothers.c line 123, 134-136(2), 149
- in /usr/src/ucb/PORT/pascal/pxp/rval.c line 48
- in /usr/src/ucb/PORT/pascal/pxp/stat.c line 36, 143, 155
- in /usr/src/ucb/PORT/pascal/pxp/type.c line 53-55(2), 154, 164, 174, 185-187(2), 199, 213, 222-226(2)
- in /usr/src/ucb/PORT/pascal/pxp/var.c line 58-64(3)

ppsnl defined in line 158; used 1 times

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

ppsnlb defined in line 150; used 1 times

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

ppspac defined in line 127; used 49 times

- in /usr/src/ucb/PORT/pascal/pxp/call.c line 42
- in /usr/src/ucb/PORT/pascal/pxp/case.c line 52-54(2)
- in /usr/src/ucb/PORT/pascal/pxp/fdec.c line 66, 80-88(3), 110
- in /usr/src/ucb/PORT/pascal/pxp/lab.c line 64
- in /usr/src/ucb/PORT/pascal/pxp/rec.c line 31-33(2), 105-110(2)
- in /usr/src/ucb/PORT/pascal/pxp/rmothers.c line 116-118(2), 139, 150
- in /usr/src/ucb/PORT/pascal/pxp/rval.c line 95, 133-138(2)
- in /usr/src/ucb/PORT/pascal/pxp/stat.c line 135, 166-170(3), 185-189(3), 207-212(2), 240, 263, 299-301(2)
- in /usr/src/ucb/PORT/pascal/pxp/type.c line 89-114(7), 120-137(6), 212, 227
- in /usr/src/ucb/PORT/pascal/pxp/yycomm.c line 371

ppstr defined in line 298; used 2 times

- in /usr/src/ucb/PORT/pascal/pxp/const.c line 112
- in /usr/src/ucb/PORT/pascal/pxp/rval.c line 63

pptab defined in line 369; used 1 times

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

ppunspac defined in line 121; used 1 times

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

printoff defined in line 49; used 6 times

- in /usr/src/ucb/PORT/pascal/pxp/const.c line 32
- in /usr/src/ucb/PORT/pascal/pxp/fdec.c line 44, 197
- in /usr/src/ucb/PORT/pascal/pxp/lab.c line 29
- in /usr/src/ucb/PORT/pascal/pxp/type.c line 31
- in /usr/src/ucb/PORT/pascal/pxp/var.c line 31

printon defined in line 38; used 2 times

- in /usr/src/ucb/PORT/pascal/pxp/fdec.c line 42, 231

putchar defined in line 334; never used
setprint defined in line 25; used 3 times

- in /usr/src/ucb/PORT/pascal/pxp/fdec.c line 40, 138, 195

#### Defined variables

killsp defined in line 119; used 3 times

- in line 124, 130-131(2)

nopflg defined in line 23; used 10 times

- in line 20, 30-35(3), 43-46(2), 52, 153, 161
- in /usr/src/ucb/PORT/pascal/pxp/yyput.c line 256

outcol defined in line 331; used 7 times

- in line 343-355(6), 384

owenl defined in line 148; used 3 times

- in line 163, 169, 175

owenlb defined in line 148; used 4 times

- in line 155, 169-173(3)

pplev defined in line 22; used 11 times

- in line 198-201(5), 215, 261, 287, 293-294(2), 375

sccsid defined in line 8; never used

#### Defined macros

noprint defined in line 20; used 16 times

- in line 60, 82, 94, 104, 113, 134, 142, 182, 194, 232, 249, 268, 277, 303, 324, 373

Last modified: 1985-06-06 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1941 |