ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/rterror.h
Revision: 3.4
Committed: Mon Feb 6 22:40:21 2023 UTC (14 months, 3 weeks ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, HEAD
Changes since 3.3: +5 -5 lines
Log Message:
refactor: Changed some char* args to const char* to avoid warnings

File Contents

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