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