Back to index

radiance  4R0+20100331
Classes | Defines | Functions | Variables
rterror.h File Reference
#include <errno.h>

Go to the source code of this file.

Classes

struct  erract

Defines

#define WARNING   0 /* non-fatal error */
#define USER   1 /* fatal user-caused error */
#define SYSTEM   2 /* fatal system-related error */
#define INTERNAL   3 /* fatal program-related error */
#define CONSISTENCY   4 /* bad consistency check, abort */
#define COMMAND   5 /* interactive error */
#define NERRS   6
#define ERRACT_INIT
#define CHECK(be, et, em)   if (be) error(et,em); else
#define DCHECK(be, et, em)   (void)0

Functions

void error (int etype, char *emsg)
void eputs (char *s)
void wputs (char *s)
void quit (int code)

Variables

struct erract erract [NERRS]
char errmsg []

Define Documentation

#define CHECK (   be,
  et,
  em 
)    if (be) error(et,em); else

Definition at line 40 of file rterror.h.

#define COMMAND   5 /* interactive error */

Definition at line 21 of file rterror.h.

#define CONSISTENCY   4 /* bad consistency check, abort */

Definition at line 20 of file rterror.h.

#define DCHECK (   be,
  et,
  em 
)    (void)0

Definition at line 44 of file rterror.h.

#define ERRACT_INIT
Value:
{      {"warning - ", wputs, 0}, \
                            {"fatal - ", eputs, 1}, \
                            {"system - ", eputs, 2}, \
                            {"internal - ", eputs, 3}, \
                            {"consistency - ", eputs, -1}, \
                            {"", NULL, 0} }

Definition at line 30 of file rterror.h.

#define INTERNAL   3 /* fatal program-related error */

Definition at line 19 of file rterror.h.

#define NERRS   6

Definition at line 22 of file rterror.h.

#define SYSTEM   2 /* fatal system-related error */

Definition at line 18 of file rterror.h.

#define USER   1 /* fatal user-caused error */

Definition at line 17 of file rterror.h.

#define WARNING   0 /* non-fatal error */

Definition at line 16 of file rterror.h.


Function Documentation

void eputs ( char *  s)

Definition at line 146 of file calc.c.

{
       fputs(msg, stderr);
}
void error ( int  etype,
char *  emsg 
)

Definition at line 25 of file error.c.

{
       register struct erract      *ep;

       if ((etype < 0) | (etype >= NERRS))
              return;
       ep = erract + etype;
       if (ep->pf != NULL) {
              if (ep->pre[0]) (*ep->pf)(ep->pre);
              if (emsg != NULL && emsg[0]) (*ep->pf)(emsg);
              if (etype == SYSTEM && errno > 0) {
                     (*ep->pf)(": ");
                     (*ep->pf)(strerror(errno));
              }
              (*ep->pf)("\n");
       }
       if (!ep->ec)         /* non-fatal */
              return;
       if (ep->ec < 0)             /* dump core */
              abort();
       quit(ep->ec);        /* quit calls exit after cleanup */
}

Here is the call graph for this function:

void quit ( int  code)

Definition at line 162 of file calc.c.

{
       if (recover)                /* a cavalier approach */
              longjmp(env, 1);
       exit(code);
}

Here is the call graph for this function:

void wputs ( char *  s)

Definition at line 154 of file calc.c.

{
       eputs(msg);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

struct erract erract[NERRS]
char errmsg[]

Definition at line 21 of file error.c.