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