ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/standard.h
(Generate patch)

Comparing ray/src/common/standard.h (file contents):
Revision 1.6 by greg, Fri Apr 12 13:55:33 1991 UTC vs.
Revision 2.13 by gwlarson, Wed Aug 12 17:57:44 1998 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1990 Regents of the University of California */
1 > /* Copyright (c) 1998 Silicon Graphics, Inc. */
2  
3 < /* SCCSid "$SunId$ LBL" */
3 > /* SCCSid "$SunId$ SGI" */
4  
5   /*
6   *      Miscellaneous definitions required by many routines.
# Line 8 | Line 8
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>
# Line 16 | Line 20
20                                  /* regular transformation */
21   typedef struct {
22          MAT4  xfm;                              /* transform matrix */
23 <        double  sca;                            /* scalefactor */
23 >        FLOAT  sca;                             /* scalefactor */
24   }  XF;
25                                  /* complemetary tranformation */
26   typedef struct {
# Line 24 | Line 28 | typedef struct {
28          XF  b;                                  /* backward */
29   }  FULLXF;
30  
31 < #define  FHUGE          (1e10)          /* large real number */
32 < #define  FTINY          (1e-6)          /* small real number */
33 <
30 < #ifdef  M_PI
31 < #define  PI             M_PI
31 > #ifndef  PI
32 > #ifdef  M_PI
33 > #define  PI             ((double)M_PI)
34   #else
35 < #define  PI             3.14159265358979323846
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 */
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 + #ifndef  int2
47 + #define  int2           short           /* two-byte integer */
48 + #endif
49 + #ifndef  int4
50 + #define  int4           int             /* four-byte integer */
51 + #endif
52 +
53 + extern int  eputs(), wputs();   /* standard error output functions */
54 +
55                                  /* error codes */
56 < #define  WARNING        1               /* non-fatal error */
57 < #define  USER           2               /* fatal user-caused error */
58 < #define  SYSTEM         3               /* fatal system-related error */
59 < #define  INTERNAL       4               /* fatal program-related error */
60 < #define  CONSISTENCY    5               /* bad consistency check, abort */
61 < #define  COMMAND        6               /* interactive error */
56 > #define  WARNING        0               /* non-fatal error */
57 > #define  USER           1               /* fatal user-caused error */
58 > #define  SYSTEM         2               /* fatal system-related error */
59 > #define  INTERNAL       3               /* fatal program-related error */
60 > #define  CONSISTENCY    4               /* bad consistency check, abort */
61 > #define  COMMAND        5               /* interactive error */
62 > #define  NERRS          6
63 >                                /* error struct */
64 > extern struct erract {
65 >        char    pre[16];                /* prefix message */
66 >        int     (*pf)();                /* put function (resettable) */
67 >        int     ec;                     /* exit code (0 means non-fatal) */
68 > } erract[NERRS];        /* list of error actions */
69  
70 + #define  ERRACT_INIT    {       {"warning - ", wputs, 0}, \
71 +                                {"fatal - ", eputs, 1}, \
72 +                                {"system - ", eputs, 2}, \
73 +                                {"internal - ", eputs, 1}, \
74 +                                {"consistency - ", eputs, -1}, \
75 +                                {"", NULL, 0}   }
76 +
77   extern char  errmsg[];                  /* global buffer for error messages */
78  
52 extern int  errno;                      /* system error number */
53
79                                          /* memory operations */
80 < #ifdef  STRUCTASSIGN
81 < #define  copystruct(d,s)        (*(d) = *(s))
80 > #ifdef  NOSTRUCTASS
81 > #define  copystruct(d,s)        bcopy((char *)(s),(char *)(d),sizeof(*(d)))
82   #else
83 < #define  copystruct(d,s)        bcopy((char *)(s),(char *)(d),sizeof(*(d)))
83 > #define  copystruct(d,s)        (*(d) = *(s))
84   #endif
85  
86 < #ifndef  BSD
87 < #define  bcopy(s,d,n)           (void)memcpy(d,s,n)
88 < #define  bzero(d,n)             (void)memset(d,0,n)
89 < #define  bcmp(b1,b2,n)          memcmp(b1,b2,n)
90 < extern char  *memcpy(), *memset();
91 < #define  index                  strchr
92 < #define  rindex                 strrchr
86 > #ifdef   BSD
87 > extern long  lseek();
88 > #else
89 > #define  bcopy(s,d,n)           (void)memcpy(d,s,n)
90 > #define  bzero(d,n)             (void)memset(d,0,n)
91 > #define  bcmp(b1,b2,n)          memcmp(b1,b2,n)
92 > #define  index                  strchr
93 > #define  rindex                 strrchr
94 > extern off_t  lseek();
95   #endif
96 + extern long  ftell();
97  
98 < extern char  *sskip();
98 > extern char  *sskip(), *sskip2();
99   extern char  *getpath(), *getenv();
100 + #ifndef malloc
101   extern char  *malloc(), *calloc(), *realloc();
102 + #endif
103   extern char  *bmalloc(), *savestr(), *savqstr();
104 +
105 + #ifdef  DCL_ATOF
106 + extern double  atof();
107 + #endif
108 +
109 + #ifdef MSDOS
110 + #define NIX 1
111 + #endif
112 + #ifdef AMIGA
113 + #define NIX 1
114 + #endif
115 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines