1: #
2: /*
3: * pi - Pascal interpreter code translator
4: *
5: * Charles Haley, Bill Joy UCB
6: * Version 1.2 January 1979
7: *
8: *
9: * pxp - Pascal execution profiler
10: *
11: * Bill Joy UCB
12: * Version 1.2 January 1979
13: */
14:
15: #include "0.h"
16: #include "yy.h"
17:
18: #ifdef PXP
19: extern int yyline;
20: extern char errout;
21: #endif
22:
23: char errpfx 'E';
24: extern int yyline;
25: /*
26: * Panic is called when impossible
27: * (supposedly, anyways) situations
28: * are encountered.
29: #ifdef PI
30: * Panic messages should be short
31: * as they do not go to the message
32: * file.
33: #endif
34: */
35: panic(s)
36: char *s;
37: {
38:
39: #ifdef DEBUG
40: printf("Snark (%s) line=%d yyline=%d\n", s, line, yyline);
41: #endif
42: #ifdef PXP
43: Perror( "Snark in pxp", s);
44: #endif
45: #ifdef PI
46: Perror( "Snark in pi", s);
47: #endif
48: pexit(DIED);
49: }
50:
51: extern char *errfile;
52: /*
53: * Error is called for
54: * semantic errors and
55: * prints the error and
56: * a line number.
57: */
58: error(a1, a2, a3, a4)
59: {
60: #ifdef PI
61: char buf[256];
62: register int i;
63: #endif
64: #ifdef PXP
65: int ofout;
66: #endif
67:
68: if (errpfx == 'w' && opt('w') != 0)
69: return;
70: #ifdef PXP
71: flush();
72: ofout = fout[0];
73: fout[0] = errout;
74: #endif
75: #ifdef PI
76: Enocascade = 0;
77: geterr(a1, buf);
78: a1 = buf;
79: #endif
80: if (line < 0)
81: line = -line;
82: yySsync();
83: yysetfile(filename);
84: #ifdef PI
85: if (errpfx == ' ') {
86: printf(" ");
87: for (i = line; i >= 10; i =/ 10)
88: putchar(' ');
89: printf("... ");
90: } else if (Enoline)
91: printf(" %c - ", errpfx);
92: else
93: #endif
94: printf("%c %d - ", errpfx, line);
95: printf(a1, a2, a3, a4);
96: if (errpfx == 'E')
97: #ifdef PI
98: eflg++, cgenflg++;
99: #endif
100: #ifdef PXP
101: eflg++;
102: #endif
103: errpfx = 'E';
104: #ifdef PI
105: if (Eholdnl)
106: Eholdnl = 0;
107: else
108: #endif
109: putchar('\n');
110: #ifdef PXP
111: flush();
112: fout[0] = ofout;
113: #endif
114: }
115:
116: #ifdef PI
117: cerror(a1, a2, a3, a4)
118: {
119:
120: if (Enocascade)
121: return;
122: setpfx(' ');
123: error(a1, a2, a3, a4);
124: }
125: #endif
Defined functions
error
defined in line
58; used 12 times
panic
defined in line
35; used 12 times
Defined variables