Commit | Line | Data |
---|---|---|
442fe3bf DF |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
c9bf2796 | 3 | * All rights reserved. |
442fe3bf | 4 | * |
c9bf2796 | 5 | * Redistribution and use in source and binary forms are permitted |
9c50374f KB |
6 | * provided that the above copyright notice and this paragraph are |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
c9bf2796 | 16 | * |
dc0e9d50 | 17 | * @(#)error.h 5.4 (Berkeley) %G% |
442fe3bf | 18 | */ |
524aa063 | 19 | |
c7be6007 | 20 | typedef int boolean; |
58195f21 | 21 | #define reg register |
c7be6007 BJ |
22 | |
23 | #define TRUE 1 | |
24 | #define FALSE 0 | |
58195f21 RH |
25 | |
26 | #define true 1 | |
27 | #define false 0 | |
c7be6007 BJ |
28 | /* |
29 | * Descriptors for the various languages we know about. | |
30 | * If you touch these, also touch lang_table | |
31 | */ | |
32 | #define INUNKNOWN 0 | |
33 | #define INCPP 1 | |
34 | #define INCC 2 | |
35 | #define INAS 3 | |
36 | #define INLD 4 | |
37 | #define INLINT 5 | |
38 | #define INF77 6 | |
39 | #define INPI 7 | |
40 | #define INPC 8 | |
41 | #define INFRANZ 9 | |
42 | #define INLISP 10 | |
43 | #define INVAXIMA 11 | |
44 | #define INRATFOR 12 | |
45 | #define INLEX 13 | |
46 | #define INYACC 14 | |
47 | #define INAPL 15 | |
48 | #define INMAKE 16 | |
49 | #define INRI 17 | |
243bdea5 | 50 | #define INTROFF 18 |
07e24738 | 51 | #define INMOD2 19 |
c7be6007 BJ |
52 | |
53 | extern int language; | |
54 | /* | |
55 | * We analyze each line in the error message file, and | |
56 | * attempt to categorize it by type, as well as language. | |
57 | * Here are the type descriptors. | |
58 | */ | |
59 | typedef int Errorclass; | |
60 | ||
58195f21 | 61 | #define C_FIRST 0 /* first error category */ |
c7be6007 BJ |
62 | #define C_UNKNOWN 0 /* must be zero */ |
63 | #define C_IGNORE 1 /* ignore the message; used for pi */ | |
64 | #define C_SYNC 2 /* synchronization errors */ | |
65 | #define C_DISCARD 3 /* touches dangerous files, so discard */ | |
66 | #define C_NONSPEC 4 /* not specific to any file */ | |
67 | #define C_THISFILE 5 /* specific to this file, but at no line */ | |
68 | #define C_NULLED 6 /* refers to special func; so null */ | |
69 | #define C_TRUE 7 /* fits into true error format */ | |
70 | #define C_DUPL 8 /* sub class only; duplicated error message */ | |
58195f21 | 71 | #define C_LAST 9 /* last error category */ |
c7be6007 BJ |
72 | |
73 | #define SORTABLE(x) (!(NOTSORTABLE(x))) | |
74 | #define NOTSORTABLE(x) (x <= C_NONSPEC) | |
75 | /* | |
76 | * Resources to count and print out the error categories | |
77 | */ | |
78 | extern char *class_table[]; | |
79 | extern int class_count[]; | |
80 | ||
81 | #define nunknown class_count[C_UNKNOWN] | |
82 | #define nignore class_count[C_IGNORE] | |
58195f21 | 83 | #define nsyncerrors class_count[C_SYNC] |
c7be6007 BJ |
84 | #define ndiscard class_count[C_DISCARD] |
85 | #define nnonspec class_count[C_NONSPEC] | |
86 | #define nthisfile class_count[C_THISFILE] | |
58195f21 RH |
87 | #define nnulled class_count[C_NULLED] |
88 | #define ntrue class_count[C_TRUE] | |
c7be6007 BJ |
89 | #define ndupl class_count[C_DUPL] |
90 | ||
91 | /* places to put the error complaints */ | |
92 | ||
58195f21 | 93 | #define TOTHEFILE 1 /* touch the file */ |
c7be6007 BJ |
94 | #define TOSTDOUT 2 /* just print them out (ho-hum) */ |
95 | ||
96 | FILE *errorfile; /* where error file comes from */ | |
97 | FILE *queryfile; /* where the query responses from the user come from*/ | |
98 | ||
99 | extern char *currentfilename; | |
100 | extern char *processname; | |
101 | extern char *scriptname; | |
102 | ||
103 | extern boolean query; | |
58195f21 RH |
104 | extern boolean terse; |
105 | int inquire(); /* inquire for yes/no */ | |
106 | /* | |
107 | * codes for inquire() to return | |
108 | */ | |
109 | #define Q_NO 1 /* 'N' */ | |
110 | #define Q_no 2 /* 'n' */ | |
111 | #define Q_YES 3 /* 'Y' */ | |
112 | #define Q_yes 4 /* 'y' */ | |
113 | ||
114 | int probethisfile(); | |
115 | /* | |
116 | * codes for probethisfile to return | |
117 | */ | |
118 | #define F_NOTEXIST 1 | |
119 | #define F_NOTREAD 2 | |
120 | #define F_NOTWRITE 3 | |
121 | #define F_TOUCHIT 4 | |
122 | ||
c7be6007 BJ |
123 | /* |
124 | * Describes attributes about a language | |
125 | */ | |
126 | struct lang_desc{ | |
127 | char *lang_name; | |
128 | char *lang_incomment; /* one of the following defines */ | |
129 | char *lang_outcomment; /* one of the following defines */ | |
130 | }; | |
131 | extern struct lang_desc lang_table[]; | |
132 | ||
133 | #define CINCOMMENT "/*###" | |
134 | #define COUTCOMMENT "%%%*/\n" | |
135 | #define FINCOMMENT "C###" | |
136 | #define FOUTCOMMENT "%%%\n" | |
137 | #define NEWLINE "%%%\n" | |
138 | #define PIINCOMMENT "(*###" | |
139 | #define PIOUTCOMMENT "%%%*)\n" | |
140 | #define LISPINCOMMENT ";###" | |
141 | #define ASINCOMMENT "####" | |
58195f21 | 142 | #define RIINCOMMENT CINCOMMENT |
c7be6007 | 143 | #define RIOUTCOMMENT COUTCOMMENT |
243bdea5 RH |
144 | #define TROFFINCOMMENT ".\\\"###" |
145 | #define TROFFOUTCOMMENT NEWLINE | |
07e24738 RH |
146 | #define MOD2INCOMMENT "(*###" |
147 | #define MOD2OUTCOMMENT "%%%*)\n" | |
c7be6007 BJ |
148 | /* |
149 | * Defines and resources for determing if a given line | |
150 | * is to be discarded because it refers to a file not to | |
151 | * be touched, or if the function reference is to a | |
152 | * function the user doesn't want recorded. | |
153 | */ | |
c7be6007 | 154 | |
58195f21 | 155 | #define ERRORNAME "/.errorrc" |
c7be6007 BJ |
156 | int nignored; |
157 | char **names_ignored; | |
158 | /* | |
159 | * Structure definition for a full error | |
160 | */ | |
58195f21 RH |
161 | typedef struct edesc Edesc; |
162 | typedef Edesc *Eptr; | |
163 | ||
164 | struct edesc{ | |
165 | Eptr error_next; /*linked together*/ | |
c7be6007 BJ |
166 | int error_lgtext; /* how many on the right hand side*/ |
167 | char **error_text; /* the right hand side proper*/ | |
168 | Errorclass error_e_class; /* error category of this error*/ | |
169 | Errorclass error_s_class; /* sub descriptor of error_e_class*/ | |
170 | int error_language; /* the language for this error*/ | |
171 | int error_position; /* oridinal position */ | |
172 | int error_line; /* discovered line number*/ | |
173 | int error_no; /* sequence number on input */ | |
174 | }; | |
175 | /* | |
176 | * Resources for the true errors | |
177 | */ | |
178 | extern int nerrors; | |
58195f21 RH |
179 | extern Eptr er_head; |
180 | extern Eptr *errors; | |
c7be6007 BJ |
181 | /* |
182 | * Resources for each of the files mentioned | |
183 | */ | |
184 | extern int nfiles; | |
58195f21 RH |
185 | extern Eptr **files; /* array of pointers into errors*/ |
186 | boolean *touchedfiles; /* which files we touched */ | |
c7be6007 BJ |
187 | /* |
188 | * The langauge the compilation is in, as intuited from | |
189 | * the flavor of error messages analyzed. | |
190 | */ | |
191 | extern int langauge; | |
192 | extern char *currentfilename; | |
193 | /* | |
194 | * Functional forwards | |
195 | */ | |
196 | char *Calloc(); | |
197 | char *strsave(); | |
198 | char *clobberfirst(); | |
199 | char lastchar(); | |
200 | char firstchar(); | |
201 | char next_lastchar(); | |
202 | char **wordvsplice(); | |
203 | int wordvcmp(); | |
204 | boolean persperdexplode(); | |
58195f21 RH |
205 | /* |
206 | * Printing hacks | |
207 | */ | |
208 | char *plural(), *verbform(); |