ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/rterror.h
Revision: 3.1
Committed: Fri Jun 27 06:53:21 2003 UTC (20 years, 10 months ago) by greg
Content type: text/plain
Branch: MAIN
Log Message:
Broke standard.h into rtio.h, rterror.h, rtmath.h, and rtmisc.h

File Contents

# Content
1 /* RCSid $Id$ */
2 /*
3 * Header for Radiance error-handling routines
4 */
5
6 #ifndef _RAD_RTERROR_H_
7 #define _RAD_RTERROR_H_
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 #include <errno.h>
13 /* error codes */
14 #define WARNING 0 /* non-fatal error */
15 #define USER 1 /* fatal user-caused error */
16 #define SYSTEM 2 /* fatal system-related error */
17 #define INTERNAL 3 /* fatal program-related error */
18 #define CONSISTENCY 4 /* bad consistency check, abort */
19 #define COMMAND 5 /* interactive error */
20 #define NERRS 6
21 /* error struct */
22 extern struct erract {
23 char pre[16]; /* prefix message */
24 void (*pf)(); /* put function (resettable) */
25 int ec; /* exit code (0 means non-fatal) */
26 } erract[NERRS]; /* list of error actions */
27
28 #define ERRACT_INIT { {"warning - ", wputs, 0}, \
29 {"fatal - ", eputs, 1}, \
30 {"system - ", eputs, 2}, \
31 {"internal - ", eputs, 3}, \
32 {"consistency - ", eputs, -1}, \
33 {"", NULL, 0} }
34
35 extern char errmsg[]; /* global buffer for error messages */
36
37 /* custom version of assert(3) */
38 #define CHECK(be,et,em) if (be) error(et,em); else
39 #ifdef DEBUG
40 #define DCHECK CHECK
41 #else
42 #define DCHECK(be,et,em) (void)0
43 #endif
44 /* defined in error.c */
45 extern void error(int etype, char *emsg);
46 /* error & warning output & exit */
47 extern void eputs(char *s);
48 extern void wputs(char *s);
49 extern void quit(int code);
50
51 #ifdef __cplusplus
52 }
53 #endif
54 #endif /* _RAD_RTERROR_H_ */
55