ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/standard.h
Revision: 2.12
Committed: Wed Jun 17 13:28:16 1998 UTC (25 years, 10 months ago) by gwlarson
Content type: text/plain
Branch: MAIN
Changes since 2.11: +7 -1 lines
Log Message:
added declaration for lseek() and ftell()

File Contents

# Content
1 /* Copyright (c) 1997 Silicon Graphics, Inc. */
2
3 /* SCCSid "$SunId$ SGI" */
4
5 /*
6 * Miscellaneous definitions required by many routines.
7 */
8
9 #include <stdio.h>
10
11 #include <sys/types.h>
12
13 #include <fcntl.h>
14
15 #include <math.h>
16
17 #include <errno.h>
18
19 #include "mat4.h"
20 /* regular transformation */
21 typedef struct {
22 MAT4 xfm; /* transform matrix */
23 FLOAT sca; /* scalefactor */
24 } XF;
25 /* complemetary tranformation */
26 typedef struct {
27 XF f; /* forward */
28 XF b; /* backward */
29 } FULLXF;
30
31 #ifndef PI
32 #ifdef M_PI
33 #define PI ((double)M_PI)
34 #else
35 #define PI 3.14159265358979323846
36 #endif
37 #endif
38
39 #ifndef F_OK /* mode bits for access(2) call */
40 #define R_OK 4 /* readable */
41 #define W_OK 2 /* writable */
42 #define X_OK 1 /* executable */
43 #define F_OK 0 /* exists */
44 #endif
45
46 extern int eputs(), wputs(); /* standard error output functions */
47
48 /* error codes */
49 #define WARNING 0 /* non-fatal error */
50 #define USER 1 /* fatal user-caused error */
51 #define SYSTEM 2 /* fatal system-related error */
52 #define INTERNAL 3 /* fatal program-related error */
53 #define CONSISTENCY 4 /* bad consistency check, abort */
54 #define COMMAND 5 /* interactive error */
55 #define NERRS 6
56 /* error struct */
57 extern struct erract {
58 char pre[16]; /* prefix message */
59 int (*pf)(); /* put function (resettable) */
60 int ec; /* exit code (0 means non-fatal) */
61 } erract[NERRS]; /* list of error actions */
62
63 #define ERRACT_INIT { {"warning - ", wputs, 0}, \
64 {"fatal - ", eputs, 1}, \
65 {"system - ", eputs, 2}, \
66 {"internal - ", eputs, 1}, \
67 {"consistency - ", eputs, -1}, \
68 {"", NULL, 0} }
69
70 extern char errmsg[]; /* global buffer for error messages */
71
72 /* memory operations */
73 #ifdef NOSTRUCTASS
74 #define copystruct(d,s) bcopy((char *)(s),(char *)(d),sizeof(*(d)))
75 #else
76 #define copystruct(d,s) (*(d) = *(s))
77 #endif
78
79 #ifdef BSD
80 extern long lseek();
81 #else
82 #define bcopy(s,d,n) (void)memcpy(d,s,n)
83 #define bzero(d,n) (void)memset(d,0,n)
84 #define bcmp(b1,b2,n) memcmp(b1,b2,n)
85 #define index strchr
86 #define rindex strrchr
87 extern off_t lseek();
88 #endif
89 extern long ftell();
90
91 extern char *sskip(), *sskip2();
92 extern char *getpath(), *getenv();
93 #ifndef malloc
94 extern char *malloc(), *calloc(), *realloc();
95 #endif
96 extern char *bmalloc(), *savestr(), *savqstr();
97
98 #ifdef DCL_ATOF
99 extern double atof();
100 #endif
101
102 #ifdef MSDOS
103 #define NIX 1
104 #endif
105 #ifdef AMIGA
106 #define NIX 1
107 #endif
108