--- ray/src/common/standard.h 1996/01/10 09:10:58 2.7 +++ ray/src/common/standard.h 1998/06/17 13:28:16 2.12 @@ -1,6 +1,6 @@ -/* Copyright (c) 1992 Regents of the University of California */ +/* Copyright (c) 1997 Silicon Graphics, Inc. */ -/* SCCSid "$SunId$ LBL" */ +/* SCCSid "$SunId$ SGI" */ /* * Miscellaneous definitions required by many routines. @@ -8,6 +8,8 @@ #include +#include + #include #include @@ -28,7 +30,7 @@ typedef struct { #ifndef PI #ifdef M_PI -#define PI M_PI +#define PI ((double)M_PI) #else #define PI 3.14159265358979323846 #endif @@ -40,14 +42,31 @@ typedef struct { #define X_OK 1 /* executable */ #define F_OK 0 /* exists */ #endif + +extern int eputs(), wputs(); /* standard error output functions */ + /* error codes */ -#define WARNING 1 /* non-fatal error */ -#define USER 2 /* fatal user-caused error */ -#define SYSTEM 3 /* fatal system-related error */ -#define INTERNAL 4 /* fatal program-related error */ -#define CONSISTENCY 5 /* bad consistency check, abort */ -#define COMMAND 6 /* interactive error */ +#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 + /* error struct */ +extern struct erract { + char pre[16]; /* prefix message */ + int (*pf)(); /* put function (resettable) */ + int ec; /* exit code (0 means non-fatal) */ +} erract[NERRS]; /* list of error actions */ +#define ERRACT_INIT { {"warning - ", wputs, 0}, \ + {"fatal - ", eputs, 1}, \ + {"system - ", eputs, 2}, \ + {"internal - ", eputs, 1}, \ + {"consistency - ", eputs, -1}, \ + {"", NULL, 0} } + extern char errmsg[]; /* global buffer for error messages */ /* memory operations */ @@ -57,15 +76,19 @@ extern char errmsg[]; /* global buffer for error me #define copystruct(d,s) (*(d) = *(s)) #endif -#ifndef BSD +#ifdef BSD +extern long lseek(); +#else #define bcopy(s,d,n) (void)memcpy(d,s,n) #define bzero(d,n) (void)memset(d,0,n) #define bcmp(b1,b2,n) memcmp(b1,b2,n) #define index strchr #define rindex strrchr +extern off_t lseek(); #endif +extern long ftell(); -extern char *sskip(); +extern char *sskip(), *sskip2(); extern char *getpath(), *getenv(); #ifndef malloc extern char *malloc(), *calloc(), *realloc();