2 |
7u83 |
1 |
/*
|
|
|
2 |
Crown Copyright (c) 1997
|
|
|
3 |
|
|
|
4 |
This TenDRA(r) Computer Program is subject to Copyright
|
|
|
5 |
owned by the United Kingdom Secretary of State for Defence
|
|
|
6 |
acting through the Defence Evaluation and Research Agency
|
|
|
7 |
(DERA). It is made available to Recipients with a
|
|
|
8 |
royalty-free licence for its use, reproduction, transfer
|
|
|
9 |
to other parties and amendment for any purpose not excluding
|
|
|
10 |
product development provided that any such use et cetera
|
|
|
11 |
shall be deemed to be acceptance of the following conditions:-
|
|
|
12 |
|
|
|
13 |
(1) Its Recipients shall ensure that this Notice is
|
|
|
14 |
reproduced upon any copies or amended versions of it;
|
|
|
15 |
|
|
|
16 |
(2) Any amended version of it shall be clearly marked to
|
|
|
17 |
show both the nature of and the organisation responsible
|
|
|
18 |
for the relevant amendment or amendments;
|
|
|
19 |
|
|
|
20 |
(3) Its onward transfer from a recipient to another
|
|
|
21 |
party shall be deemed to be that party's acceptance of
|
|
|
22 |
these conditions;
|
|
|
23 |
|
|
|
24 |
(4) DERA gives no warranty or assurance as to its
|
|
|
25 |
quality or suitability for any purpose and DERA accepts
|
|
|
26 |
no liability whatsoever in relation to any use to which
|
|
|
27 |
it may be put.
|
|
|
28 |
*/
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
/**** error.h --- Error reporting.
|
|
|
32 |
*
|
|
|
33 |
** Author: Steve Folkes <smf@hermes.mod.uk>
|
|
|
34 |
*
|
|
|
35 |
**** Commentary:
|
|
|
36 |
*
|
|
|
37 |
***=== INTRODUCTION =========================================================
|
|
|
38 |
*
|
|
|
39 |
* This file specifies the interface to an error message reporting facility.
|
|
|
40 |
* This facility allows for named errors, with variables (called tags) inside
|
|
|
41 |
* the error messages. This allows the messages to be redefined (e.g. in a
|
|
|
42 |
* different language) with the variable components of the message in a
|
|
|
43 |
* different order.
|
|
|
44 |
*
|
|
|
45 |
* In addition to the error mesage support, this facility also provides
|
|
|
46 |
* support for named strings whose text may be redefined. This is useful for
|
|
|
47 |
* allowing the text of help messages to be redefined.
|
|
|
48 |
*
|
|
|
49 |
***=== TYPES ================================================================
|
|
|
50 |
*
|
|
|
51 |
** Type: EseverityT
|
|
|
52 |
** Type: EseverityP
|
|
|
53 |
** Repr: enum {ERROR_SEVERITY_INFORMATION, ERROR_SEVERITY_WARNING,
|
|
|
54 |
* ERROR_SEVERITY_ERROR, ERROR_SEVERITY_FATAL,
|
|
|
55 |
* ERROR_SEVERITY_INTERNAL}
|
|
|
56 |
*
|
|
|
57 |
* This is the error severity level type. The lowest error severity is
|
|
|
58 |
* ``ERROR_SEVERITY_INFORMATION'', which is used for information messages (not
|
|
|
59 |
* normally printed out). The highest severity of error is
|
|
|
60 |
* ``ERROR_SEVERITY_INTERNAL'' which is used for internal program errors.
|
|
|
61 |
*
|
|
|
62 |
** Type: ETagT
|
|
|
63 |
** Type: ETagP
|
|
|
64 |
** Repr: <private>
|
|
|
65 |
*
|
|
|
66 |
* This is the error tag type. A tag is used to represent a variable inside
|
|
|
67 |
* an error message, such as the file name in which the error occured. A
|
|
|
68 |
* string of the form "${tag name}" inside an error message is replaced by the
|
|
|
69 |
* tag of the same name.
|
|
|
70 |
*
|
|
|
71 |
** Type: ErrorListT
|
|
|
72 |
** Type: ErrorListP
|
|
|
73 |
** Repr: <private>
|
|
|
74 |
*
|
|
|
75 |
* This is used by the error type.
|
|
|
76 |
*
|
|
|
77 |
** Type: ErrorT
|
|
|
78 |
** Type: ErrorP
|
|
|
79 |
** Repr: <private>
|
|
|
80 |
*
|
|
|
81 |
* This is the error type.
|
|
|
82 |
*
|
|
|
83 |
** Type: EStringT
|
|
|
84 |
** Type: EStringP
|
|
|
85 |
** Repr: <private>
|
|
|
86 |
*
|
|
|
87 |
* This is the named string type.
|
|
|
88 |
*
|
|
|
89 |
** Type: ErrorProcP
|
|
|
90 |
** Repr: void (*) PROTO_S ((OStreamP, ETagP, GenericP))
|
|
|
91 |
*
|
|
|
92 |
* This is the type of a procedure that is used to display the contents of a
|
|
|
93 |
* tag when reporting an error.
|
|
|
94 |
*
|
|
|
95 |
** Type: ErrorInitProcP
|
|
|
96 |
** Repr: void (*) PROTO_S ((void))
|
|
|
97 |
*
|
|
|
98 |
* This is the type of the procedure that will be called to define all of the
|
|
|
99 |
* error messages for the current program.
|
|
|
100 |
*
|
|
|
101 |
** Type: ETagDataT
|
|
|
102 |
** Type: ETagDataP
|
|
|
103 |
** Repr: union {CStringP name; ETagP tag;}
|
|
|
104 |
*
|
|
|
105 |
* This is the type of an element in a vector of error tags to be passed to
|
|
|
106 |
* the ``error_intern_tags'' function. The vector should be initialised with
|
|
|
107 |
* the tag names (surrounded by the ``UB'' and ``UE'' macros for union
|
|
|
108 |
* initialisation), terminated by the ``ERROR_END_TAG_LIST'' macro, e.g.
|
|
|
109 |
*
|
|
|
110 |
* static ETagDataT tags [] = {
|
|
|
111 |
* UB "tag 1" UE,
|
|
|
112 |
* UB "tag 2" UE,
|
|
|
113 |
* ERROR_END_TAG_LIST
|
|
|
114 |
* };
|
|
|
115 |
*
|
|
|
116 |
* Once the ``error_intern_tags'' function has been called, the ``tag'' field
|
|
|
117 |
* should be used to access the tag object.
|
|
|
118 |
*
|
|
|
119 |
** Type: ErrorDataT
|
|
|
120 |
** Type: ErrorDataP
|
|
|
121 |
** Repr: union {struct {CStringP name; EseverityP severity;
|
|
|
122 |
* CStringP message; GenericP data;} s;
|
|
|
123 |
* ErrorP error;}
|
|
|
124 |
*
|
|
|
125 |
* This is the type of an element in a vector of errors to be passed to the
|
|
|
126 |
* ``error_intern_errors'' function. The vector should be initialised with
|
|
|
127 |
* the error names, severity levels, message text, and a pointer to a
|
|
|
128 |
* non-function object (all surrounded by the ``UB'' and ``UE'' macros for
|
|
|
129 |
* union initialisation). The vector should be terminated by the
|
|
|
130 |
* ``ERROR_END_ERROR_LIST'' macro, e.g.
|
|
|
131 |
*
|
|
|
132 |
* static ErrorDataT errors [] = {
|
|
|
133 |
* UB {
|
|
|
134 |
* "error 1", ERROR_SEVERITY_ERROR,
|
|
|
135 |
* "error 1 occured at line ${line}", NIL (GenericP)
|
|
|
136 |
* } UE, ERROR_END_ERROR_LIST
|
|
|
137 |
* };
|
|
|
138 |
*
|
|
|
139 |
* Once the ``error_intern_errors'' function has been called, the ``error''
|
|
|
140 |
* field should be used to access the error object.
|
|
|
141 |
*
|
|
|
142 |
*
|
|
|
143 |
** Type: EStringDataT
|
|
|
144 |
** Type: EStringDataP
|
|
|
145 |
** Repr: union {struct {CStringP name; CStringP contents;} s;
|
|
|
146 |
* EStringP estring;}
|
|
|
147 |
*
|
|
|
148 |
* This is the type of an element in a vector of named strings to be passed to
|
|
|
149 |
* the ``error_intern_strings'' function. The vector should be initialised
|
|
|
150 |
* with the string names and contents (all surrounded by the ``UB'' and ``UE''
|
|
|
151 |
* macros for union initialisation). The vector should be terminated by the
|
|
|
152 |
* ``ERROR_END_STRING_LIST'' macro, e.g.
|
|
|
153 |
*
|
|
|
154 |
* static EStringDataT strings [] = {
|
|
|
155 |
* UB {"string name", "string contents"} UE,
|
|
|
156 |
* ERROR_END_STRING_LIST
|
|
|
157 |
* };
|
|
|
158 |
*
|
|
|
159 |
* Once the ``error_intern_strings'' function has been called, the ``estring''
|
|
|
160 |
* field should be used to access the error string object.
|
|
|
161 |
*
|
|
|
162 |
** Type: ErrorStatusT
|
|
|
163 |
** Type: ErrorStatusP
|
|
|
164 |
** Repr: enum {ERROR_STATUS_BAD_MESSAGE, ERROR_STATUS_SUCCESS,
|
|
|
165 |
* ERROR_STATUS_BAD_ERROR}
|
|
|
166 |
*
|
|
|
167 |
* This is the return type of the ``error_redefine_error'' function.
|
|
|
168 |
*
|
|
|
169 |
***=== FUNCTIONS ============================================================
|
|
|
170 |
*
|
|
|
171 |
** Function: void error_init
|
|
|
172 |
* PROTO_S ((CStringP program, ErrorInitProcP proc))
|
|
|
173 |
** Exceptions: XX_dalloc_no_memory
|
|
|
174 |
*
|
|
|
175 |
* This function initialises the error reporting mechanism. It should only be
|
|
|
176 |
* called once, at the start of the program. The basename of the program
|
|
|
177 |
* string is used as the program name, for the "${program name}" tag. The
|
|
|
178 |
* procedure is registered as the error initialisation procedure. The error
|
|
|
179 |
* initialisation procedure should be called once before attempting to report
|
|
|
180 |
* errors. The best way of doing this, is to call the
|
|
|
181 |
* ``error_call_init_proc'' function which guarantees to only call the
|
|
|
182 |
* function once. Note that the error initialisation procedure is not
|
|
|
183 |
* expected to be used to initialise named strings: these should be explicitly
|
|
|
184 |
* initialised before they are used.
|
|
|
185 |
*
|
|
|
186 |
** Function: void error_call_init_proc
|
|
|
187 |
* PROTO_S ((void))
|
|
|
188 |
** Exceptions:
|
|
|
189 |
*
|
|
|
190 |
* This calls the error initialisation procedure if it has not already been
|
|
|
191 |
* called. This function should be called before ``error_report'' (actually,
|
|
|
192 |
* it should be called before the error value that will be passed to that
|
|
|
193 |
* function is accessed).
|
|
|
194 |
*
|
|
|
195 |
** Function: ETagP error_define_tag
|
|
|
196 |
* PROTO_S ((CStringP name))
|
|
|
197 |
** Exceptions: XX_dalloc_no_memory
|
|
|
198 |
*
|
|
|
199 |
* This function defines a tag with the specified name, and returns it. The
|
|
|
200 |
* name should not be modified or deallocated. It is possible to define the
|
|
|
201 |
* same tag more than once (but the same value will be returned each time).
|
|
|
202 |
*
|
|
|
203 |
** Function: ErrorP error_define_error
|
|
|
204 |
* PROTO_S ((CStringP name, ESeverityT severity,
|
|
|
205 |
* CStringP message, GenericP data))
|
|
|
206 |
** Exceptions: XX_dalloc_no_memory
|
|
|
207 |
*
|
|
|
208 |
* This function defines an error with the specified name, and returns it.
|
|
|
209 |
* The name should not be modified or deallocated. The severity level is used
|
|
|
210 |
* to decide whether or not an error should be shown and whether or not the
|
|
|
211 |
* program should abort, when the ``error_report'' function is called. The
|
|
|
212 |
* message is split up into a list of strings and tags, which will be printed
|
|
|
213 |
* when the error is reported (the sequence "${tag name}" will be replaced by
|
|
|
214 |
* the value of the tag when the error is reported). The data is for use by
|
|
|
215 |
* the program.
|
|
|
216 |
*
|
|
|
217 |
** Function: void error_intern_tags
|
|
|
218 |
* PROTO_S ((ETagDataP vector))
|
|
|
219 |
** Exceptions: XX_dalloc_no_memory
|
|
|
220 |
*
|
|
|
221 |
* This function changes the name entries in the specified vector into error
|
|
|
222 |
* tags. The vector should be terminated by the macro ``ERROR_END_TAG_LIST''.
|
|
|
223 |
* This function should only be called once on any vector.
|
|
|
224 |
*
|
|
|
225 |
** Function: void error_intern_errors
|
|
|
226 |
* PROTO_S ((ErrorDataP vector))
|
|
|
227 |
** Exceptions: XX_dalloc_no_memory
|
|
|
228 |
*
|
|
|
229 |
* This function changes the name entries in the specified vector into errors.
|
|
|
230 |
* The vector should be terminated by the macro ``ERROR_END_ERROR_LIST''.
|
|
|
231 |
* This function should only be called once on any vector.
|
|
|
232 |
*
|
|
|
233 |
** Function: ErrorStatusT error_redefine_error
|
|
|
234 |
* PROTO_S ((CStringP name, CStringP message))
|
|
|
235 |
** Exceptions: XX_dalloc_no_memory
|
|
|
236 |
*
|
|
|
237 |
* This function changes the error message for the error with the specified
|
|
|
238 |
* name. If necessary, the error initialisation procedure will be called to
|
|
|
239 |
* initialise the errors before they are redefined. If the error does not
|
|
|
240 |
* exist, the function will return ``ERROR_STATUS_BAD_ERROR''. If the error
|
|
|
241 |
* message contains an unterminated tag, the function will return
|
|
|
242 |
* ``ERROR_STATUS_BAD_MESSAGE''. If the function succeeds, it will return
|
|
|
243 |
* ``ERROR_STATUS_SUCCESS''.
|
|
|
244 |
*
|
|
|
245 |
** Function: ErrorP error_lookup_error
|
|
|
246 |
* PROTO_S ((CStringP name))
|
|
|
247 |
** Exceptions:
|
|
|
248 |
*
|
|
|
249 |
* This function returns the error with the specified name. If the error does
|
|
|
250 |
* not exist, it returns the null pointer. If necessary, the error
|
|
|
251 |
* initialisation procedure will be called to initialise the error messages
|
|
|
252 |
* before they are looked up.
|
|
|
253 |
*
|
|
|
254 |
** Function: GenericP error_data
|
|
|
255 |
* PROTO_S ((ErrorP error))
|
|
|
256 |
** Exceptions:
|
|
|
257 |
*
|
|
|
258 |
* This function returns the data associated with the specified error.
|
|
|
259 |
*
|
|
|
260 |
** Function: void error_report
|
|
|
261 |
* PROTO_S ((ErrorP error, ErrorProcP proc,
|
|
|
262 |
* GenericP closure))
|
|
|
263 |
** Exceptions: XX_dalloc_no_memory, XX_ostream_write_error
|
|
|
264 |
*
|
|
|
265 |
* This function reports the specified error. The procedure is used to print
|
|
|
266 |
* out information for tags. It is called with the output stream, the tag and
|
|
|
267 |
* the specified closure. If the procedure doesn't know about the tag, it
|
|
|
268 |
* should ignore it. The error message is only reported if the severity level
|
|
|
269 |
* of the error is greater than or equal to the minimum severity level set by
|
|
|
270 |
* the ``error_set_min_severity'' function. The function will cause the
|
|
|
271 |
* program to exit if the error's severity level is ``ERROR_SEVERITY_FATAL''
|
|
|
272 |
* or higher.
|
|
|
273 |
*
|
|
|
274 |
** Function: void error_set_min_report_severity
|
|
|
275 |
* PROTO_S ((ESeverityT severity))
|
|
|
276 |
** Exceptions:
|
|
|
277 |
*
|
|
|
278 |
* This function sets the minimum severity of error that should be reported.
|
|
|
279 |
*
|
|
|
280 |
** Function: ESeverityT error_get_min_report_severity
|
|
|
281 |
* PROTO_S ((void))
|
|
|
282 |
** Exceptions:
|
|
|
283 |
*
|
|
|
284 |
* This function returns the minimum severity of error that will be reported.
|
|
|
285 |
*
|
|
|
286 |
** Function: ESeverityT error_max_reported_severity
|
|
|
287 |
* PROTO_S ((void))
|
|
|
288 |
** Exceptions:
|
|
|
289 |
*
|
|
|
290 |
* This function returns the severity of the error with the highest severity
|
|
|
291 |
* that has been passed to ``error_report''.
|
|
|
292 |
*
|
|
|
293 |
** Function: void error_set_severity_message
|
|
|
294 |
* PROTO_S ((ESeverityT severity, CStringP message))
|
|
|
295 |
** Exceptions:
|
|
|
296 |
*
|
|
|
297 |
* This function sets the message to be displayed when the "${severity}" tag
|
|
|
298 |
* is encountered for the specified severity. Tags are not expanded in the
|
|
|
299 |
* message. The message should not be modified or deallocated.
|
|
|
300 |
*
|
|
|
301 |
** Function: BoolT error_set_prefix_message
|
|
|
302 |
* PROTO_S ((CStringP message))
|
|
|
303 |
** Exceptions: XX_dalloc_no_memory
|
|
|
304 |
*
|
|
|
305 |
* This function sets the error message prefix string. This string is output
|
|
|
306 |
* by ``error_display'' before outputting any actual error message. Tags are
|
|
|
307 |
* expanded, but only for the standard tags: "${program name}", "${severity}",
|
|
|
308 |
* "${dollar}", "${this error name}", "${open brace}", and "${close brace}".
|
|
|
309 |
* All other tags will be ignored. The function returns true if the message
|
|
|
310 |
* was valid, and false if there was an unterminated tag in the message.
|
|
|
311 |
*
|
|
|
312 |
** Function: EStringP error_define_string
|
|
|
313 |
* PROTO_S ((CStringP name, CStringP contents))
|
|
|
314 |
** Exceptions: XX_dalloc_no_memory
|
|
|
315 |
*
|
|
|
316 |
* This function defines a named string with the specified name, and assigns
|
|
|
317 |
* it the specified contents. Neither the name nor the contents should be
|
|
|
318 |
* modified or deallocated. No tag splitting is performed on the contents.
|
|
|
319 |
*
|
|
|
320 |
** Function: void error_intern_strings
|
|
|
321 |
* PROTO_S ((EStringDataP vector))
|
|
|
322 |
** Exceptions: XX_dalloc_no_memory
|
|
|
323 |
*
|
|
|
324 |
* This function changes the name and contents entries in the specified vector
|
|
|
325 |
* into named strings. The vector should be terminated by the macro
|
|
|
326 |
* ``ERROR_END_STRING_LIST''. This function should only be called once on any
|
|
|
327 |
* vector.
|
|
|
328 |
*
|
|
|
329 |
** Function: BoolT error_redefine_string
|
|
|
330 |
* PROTO_S ((CStringP name, CStringP contents))
|
|
|
331 |
** Exceptions: XX_dalloc_no_memory
|
|
|
332 |
*
|
|
|
333 |
* This function changes the contents of the named string with the specified
|
|
|
334 |
* name. If the name does not exist, the function returns false, otherwise it
|
|
|
335 |
* returns true.
|
|
|
336 |
*
|
|
|
337 |
** Function: EStringP error_lookup_string
|
|
|
338 |
* PROTO_S ((CStringP name))
|
|
|
339 |
** Exceptions:
|
|
|
340 |
*
|
|
|
341 |
* This function returns the named string with the specified name. If the
|
|
|
342 |
* named string does not exist, the function returns the null pointer.
|
|
|
343 |
*
|
|
|
344 |
** Function: CStringP error_string_contents
|
|
|
345 |
* PROTO_S ((EStringP estring))
|
|
|
346 |
** Exceptions:
|
|
|
347 |
*
|
|
|
348 |
* This function returns the contents of the specified named string. The
|
|
|
349 |
* returned string should not be modified or deallocated.
|
|
|
350 |
*
|
|
|
351 |
** Function: void write_error_file
|
|
|
352 |
* PROTO_S ((OStreamP ostream))
|
|
|
353 |
** Exceptions: XX_dalloc_no_memory, XX_ostream_write_error
|
|
|
354 |
*
|
|
|
355 |
* This function writes out an error file (in the same format as parsed by the
|
|
|
356 |
* functions in "error-file.[ch]") to the specified ostream.
|
|
|
357 |
*
|
|
|
358 |
***=== MACROS ===============================================================
|
|
|
359 |
*
|
|
|
360 |
** Macro: ERROR_END_TAG_LIST
|
|
|
361 |
** Exceptions:
|
|
|
362 |
*
|
|
|
363 |
* This macro should form the last entry in a vector of ``ETagDataT'' objects.
|
|
|
364 |
*
|
|
|
365 |
** Macro: ERROR_END_ERROR_LIST
|
|
|
366 |
** Exceptions:
|
|
|
367 |
*
|
|
|
368 |
* This macro should form the last entry in a vector of ``ErrorDataT''
|
|
|
369 |
* objects.
|
|
|
370 |
*
|
|
|
371 |
** Macro: ERROR_END_STRING_LIST
|
|
|
372 |
** Exceptions:
|
|
|
373 |
*
|
|
|
374 |
* This macro should form the last entry in a vector of ``EStringDataT''
|
|
|
375 |
* objects.
|
|
|
376 |
*
|
|
|
377 |
**** Change log:
|
|
|
378 |
* $Log: error.h,v $
|
|
|
379 |
* Revision 1.1.1.1 1998/01/17 15:57:17 release
|
|
|
380 |
* First version to be checked into rolling release.
|
|
|
381 |
*
|
|
|
382 |
* Revision 1.2 1994/12/12 11:44:43 smf
|
|
|
383 |
* Performing changes for 'CR94_178.sid+tld-update' - bringing in line with
|
|
|
384 |
* OSSG C Coding Standards.
|
|
|
385 |
*
|
|
|
386 |
* Revision 1.1.1.1 1994/07/25 16:05:51 smf
|
|
|
387 |
* Initial import of library shared files.
|
|
|
388 |
*
|
|
|
389 |
**/
|
|
|
390 |
|
|
|
391 |
/****************************************************************************/
|
|
|
392 |
|
|
|
393 |
#ifndef H_ERROR
|
|
|
394 |
#define H_ERROR
|
|
|
395 |
|
|
|
396 |
#include "os-interface.h"
|
|
|
397 |
#include "cstring.h"
|
|
|
398 |
#include "dstring.h"
|
|
|
399 |
#include "ostream.h"
|
|
|
400 |
|
|
|
401 |
/*--------------------------------------------------------------------------*/
|
|
|
402 |
|
|
|
403 |
#ifdef FS_NO_ENUM
|
|
|
404 |
typedef int ESeverityT, *ESeverityP;
|
|
|
405 |
#define ERROR_SEVERITY_INFORMATION (0)
|
|
|
406 |
#define ERROR_SEVERITY_WARNING (1)
|
|
|
407 |
#define ERROR_SEVERITY_ERROR (2)
|
|
|
408 |
#define ERROR_SEVERITY_FATAL (3)
|
|
|
409 |
#define ERROR_SEVERITY_INTERNAL (4)
|
|
|
410 |
#else
|
|
|
411 |
typedef enum {
|
|
|
412 |
ERROR_SEVERITY_INFORMATION,
|
|
|
413 |
ERROR_SEVERITY_WARNING,
|
|
|
414 |
ERROR_SEVERITY_ERROR,
|
|
|
415 |
ERROR_SEVERITY_FATAL,
|
|
|
416 |
ERROR_SEVERITY_INTERNAL
|
|
|
417 |
} ESeverityT, *ESeverityP;
|
|
|
418 |
#endif /* defined (FS_NO_ENUM) */
|
|
|
419 |
|
|
|
420 |
typedef struct ETagT {
|
|
|
421 |
struct ETagT *next;
|
|
|
422 |
CStringP name;
|
|
|
423 |
} ETagT, *ETagP;
|
|
|
424 |
|
|
|
425 |
typedef struct ErrorListT {
|
|
|
426 |
struct ErrorListT *next;
|
|
|
427 |
#ifdef FS_NO_ENUM
|
|
|
428 |
int tag;
|
|
|
429 |
#define ERROR_TAG_STRING (0)
|
|
|
430 |
#define ERROR_TAG_TAG (1)
|
|
|
431 |
#else
|
|
|
432 |
enum {
|
|
|
433 |
ERROR_TAG_STRING,
|
|
|
434 |
ERROR_TAG_TAG
|
|
|
435 |
} tag;
|
|
|
436 |
#endif /* defined (FS_NO_ENUM) */
|
|
|
437 |
union {
|
|
|
438 |
NStringT string;
|
|
|
439 |
ETagP tag;
|
|
|
440 |
} u;
|
|
|
441 |
} ErrorListT, *ErrorListP;
|
|
|
442 |
|
|
|
443 |
typedef struct ErrorT {
|
|
|
444 |
struct ErrorT *next;
|
|
|
445 |
CStringP name;
|
|
|
446 |
ESeverityT severity;
|
|
|
447 |
ErrorListP error_list;
|
|
|
448 |
GenericP data;
|
|
|
449 |
} ErrorT, *ErrorP;
|
|
|
450 |
|
|
|
451 |
typedef struct EStringT {
|
|
|
452 |
struct EStringT *next;
|
|
|
453 |
CStringP name;
|
|
|
454 |
CStringP contents;
|
|
|
455 |
} EStringT, *EStringP;
|
|
|
456 |
|
|
|
457 |
typedef void (*ErrorProcP) PROTO_S ((OStreamP, ETagP, GenericP));
|
|
|
458 |
typedef void (*ErrorInitProcP) PROTO_S ((void));
|
|
|
459 |
typedef UNION ETagDataT {
|
|
|
460 |
CStringP name;
|
|
|
461 |
ETagP tag;
|
|
|
462 |
} ETagDataT, *ETagDataP;
|
|
|
463 |
typedef UNION ErrorDataT {
|
|
|
464 |
struct {
|
|
|
465 |
CStringP name;
|
|
|
466 |
ESeverityT severity;
|
|
|
467 |
CStringP message;
|
|
|
468 |
GenericP data;
|
|
|
469 |
} s;
|
|
|
470 |
ErrorP error;
|
|
|
471 |
} ErrorDataT, *ErrorDataP;
|
|
|
472 |
typedef UNION EStringDataT {
|
|
|
473 |
struct {
|
|
|
474 |
CStringP name;
|
|
|
475 |
CStringP contents;
|
|
|
476 |
} s;
|
|
|
477 |
EStringP estring;
|
|
|
478 |
} EStringDataT, *EStringDataP;
|
|
|
479 |
|
|
|
480 |
#ifdef FS_NO_ENUM
|
|
|
481 |
typedef int ErrorStatusT, *ErrorStatusP;
|
|
|
482 |
#define ERROR_STATUS_BAD_MESSAGE (0)
|
|
|
483 |
#define ERROR_STATUS_SUCCESS (1)
|
|
|
484 |
#define ERROR_STATUS_BAD_ERROR (2)
|
|
|
485 |
#else
|
|
|
486 |
typedef enum {
|
|
|
487 |
ERROR_STATUS_BAD_MESSAGE,
|
|
|
488 |
ERROR_STATUS_SUCCESS,
|
|
|
489 |
ERROR_STATUS_BAD_ERROR
|
|
|
490 |
} ErrorStatusT, *ErrorStatusP;
|
|
|
491 |
#endif /* defined (FS_NO_ENUM) */
|
|
|
492 |
|
|
|
493 |
/*--------------------------------------------------------------------------*/
|
|
|
494 |
|
|
|
495 |
extern void error_init
|
|
|
496 |
PROTO_S ((CStringP, ErrorInitProcP));
|
|
|
497 |
extern void error_call_init_proc
|
|
|
498 |
PROTO_S ((void));
|
|
|
499 |
extern ETagP error_define_tag
|
|
|
500 |
PROTO_S ((CStringP));
|
|
|
501 |
extern ErrorP error_define_error
|
|
|
502 |
PROTO_S ((CStringP, ESeverityT, CStringP, GenericP));
|
|
|
503 |
extern void error_intern_tags
|
|
|
504 |
PROTO_S ((ETagDataP));
|
|
|
505 |
extern void error_intern_errors
|
|
|
506 |
PROTO_S ((ErrorDataP));
|
|
|
507 |
extern ErrorStatusT error_redefine_error
|
|
|
508 |
PROTO_S ((CStringP, CStringP));
|
|
|
509 |
extern ErrorP error_lookup_error
|
|
|
510 |
PROTO_S ((CStringP));
|
|
|
511 |
extern GenericP error_data
|
|
|
512 |
PROTO_S ((ErrorP));
|
|
|
513 |
extern void error_report
|
|
|
514 |
PROTO_S ((ErrorP, ErrorProcP, GenericP));
|
|
|
515 |
extern void error_set_min_report_severity
|
|
|
516 |
PROTO_S ((ESeverityT));
|
|
|
517 |
extern ESeverityT error_get_min_report_severity
|
|
|
518 |
PROTO_S ((void));
|
|
|
519 |
extern ESeverityT error_max_reported_severity
|
|
|
520 |
PROTO_S ((void));
|
|
|
521 |
extern void error_set_severity_message
|
|
|
522 |
PROTO_S ((ESeverityT, CStringP));
|
|
|
523 |
extern BoolT error_set_prefix_message
|
|
|
524 |
PROTO_S ((CStringP));
|
|
|
525 |
extern EStringP error_define_string
|
|
|
526 |
PROTO_S ((CStringP, CStringP));
|
|
|
527 |
extern void error_intern_strings
|
|
|
528 |
PROTO_S ((EStringDataP));
|
|
|
529 |
extern BoolT error_redefine_string
|
|
|
530 |
PROTO_S ((CStringP, CStringP));
|
|
|
531 |
extern EStringP error_lookup_string
|
|
|
532 |
PROTO_S ((CStringP));
|
|
|
533 |
extern CStringP error_string_contents
|
|
|
534 |
PROTO_S ((EStringP));
|
|
|
535 |
|
|
|
536 |
extern void write_error_file
|
|
|
537 |
PROTO_S ((OStreamP));
|
|
|
538 |
|
|
|
539 |
/*--------------------------------------------------------------------------*/
|
|
|
540 |
|
|
|
541 |
#define ERROR_END_TAG_LIST UB NIL (CStringP) UE
|
|
|
542 |
#define ERROR_END_ERROR_LIST \
|
|
|
543 |
UB {NIL (CStringP), (ESeverityT) 0, NIL (CStringP), NIL (GenericP)} UE
|
|
|
544 |
#define ERROR_END_STRING_LIST UB {NIL (CStringP), NIL (CStringP)} UE
|
|
|
545 |
|
|
|
546 |
#endif /* !defined (H_ERROR) */
|
|
|
547 |
|
|
|
548 |
/*
|
|
|
549 |
* Local variables(smf):
|
|
|
550 |
* eval: (include::add-path-entry "../os-interface" "../generated")
|
|
|
551 |
* end:
|
|
|
552 |
**/
|