|
|
1.1 root 1: #include "defs"
2:
3: char *linerr()
4: {
5: static char buff[50];
6: register int i;
7:
8: for(i = filedepth; i>0 && filenames[i]==NULL ; --i)
9: ;
10: if(i > 0)
11: sprintf(buff, "on line %d of file %s", yylineno, filenames[i]);
12: else
13: sprintf(buff, "on line %d", yylineno);
14: return(buff);
15: }
16:
17:
18:
19: laberr(s,t)
20: char *s;
21: char *t;
22: {
23: errmess("Label error", s, t);
24: }
25:
26:
27: labwarn(s,t)
28: char *s, *t;
29: {
30: char junk[100];
31: sprintf(junk, s, t);
32: warn1("Label warning: %s", junk);
33: }
34:
35:
36:
37: exprerr(s,t)
38: char *s;
39: ptr t;
40: {
41: errmess("Expression error", s, t);
42: }
43:
44:
45:
46:
47: execerr(s,t)
48: char *s, *t;
49: {
50: errmess("Error", s, t);
51: }
52:
53:
54: errmess(m,s,t)
55: char *m, *s, *t;
56: {
57: fprintf(diagfile, "**%s %s: ", m, linerr());
58: if(s)
59: fprintf(diagfile, s, t);
60: fprintf(diagfile, "\n");
61: fflush(diagfile);
62: ++nerrs;
63: }
64:
65:
66:
67: dclerr(s, n)
68: char *s, *n;
69: {
70: extern int nerrs;
71:
72: fprintf(diagfile, "**Error %s: Declaration for %s: %s\n",
73: linerr(), n, s);
74: fflush(diagfile);
75: ++nerrs;
76: }
77:
78:
79:
80:
81: badtag(routine, tag)
82: char *routine;
83: int tag;
84: {
85: char buff[100];
86: sprintf(buff, "impossible tag %d in routine %s", tag, routine);
87: fatal(buff);
88: }
89:
90:
91:
92: fatal1(s,t)
93: char *s;
94: int t;
95: {
96:
97: sprintf(msg, s, t);
98: fatal(msg);
99: }
100:
101:
102:
103: fatal(s)
104: char *s;
105: {
106: fprintf(diagfile, "\n***Compiler error %s.", linerr());
107: if(s) fprintf(diagfile, " %s.", s);
108: fprintf(diagfile, "\n");
109: fflush(diagfile);
110: fflush(stdout);
111:
112: if(dumpcore)
113: abort(0);
114: else {
115: rmiis();
116: exit(-1);
117: }
118: }
119:
120:
121:
122: warn1(s,t)
123: char *s;
124: int t;
125: {
126: sprintf(msg, s, t);
127: warn(msg);
128: }
129:
130:
131:
132:
133: warn(s)
134: char *s;
135: {
136: ++nwarns;
137: if( !nowarnflag) {
138: fprintf(diagfile, "*Warning: %s\n", s);
139: fflush(diagfile);
140: }
141: }
142:
143:
144:
145: yyerror(s)
146: char *s;
147: {
148: errmess(s, CNULL, CNULL);
149: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.