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 2.12 by gwlarson, Wed Jun 17 13:28:16 1998 UTC vs.
Revision 2.26 by schorsch, Sun Jun 8 12:03:09 2003 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1997 Silicon Graphics, Inc. */
2 <
3 < /* SCCSid "$SunId$ SGI" */
4 <
1 > /* RCSid $Id$ */
2   /*
3   *      Miscellaneous definitions required by many routines.
4   */
5 + #ifndef _RAD_STANDARD_H_
6 + #define _RAD_STANDARD_H_
7 + #ifdef __cplusplus
8 + extern "C" {
9 + #endif
10  
11 < #include  <stdio.h>
11 > #include "copyright.h"
12  
13 + #include  <stdio.h>
14   #include  <sys/types.h>
12
15   #include  <fcntl.h>
14
16   #include  <math.h>
16
17   #include  <errno.h>
18 + #include  <stdlib.h>
19 + #include  <string.h>
20  
21   #include  "mat4.h"
22 +
23 +
24 + #ifndef NULL
25 + #define NULL 0
26 + #endif
27 +
28                                  /* regular transformation */
29   typedef struct {
30          MAT4  xfm;                              /* transform matrix */
# Line 36 | Line 44 | typedef struct {
44   #endif
45   #endif
46  
47 + /* XXX include paths.h instead */
48   #ifndef  F_OK                   /* mode bits for access(2) call */
49   #define  R_OK           4               /* readable */
50   #define  W_OK           2               /* writable */
# Line 43 | Line 52 | typedef struct {
52   #define  F_OK           0               /* exists */
53   #endif
54  
55 < extern int  eputs(), wputs();   /* standard error output functions */
55 > #ifndef  int2
56 > #define  int2           short           /* two-byte integer */
57 > #endif
58 > #ifndef  int4
59 > #define  int4           int             /* four-byte integer */
60 > #endif
61  
62                                  /* error codes */
63   #define  WARNING        0               /* non-fatal error */
# Line 56 | Line 70 | extern int  eputs(), wputs();  /* standard error output
70                                  /* error struct */
71   extern struct erract {
72          char    pre[16];                /* prefix message */
73 <        int     (*pf)();                /* put function (resettable) */
73 >        void    (*pf)();                /* put function (resettable) */
74          int     ec;                     /* exit code (0 means non-fatal) */
75   } erract[NERRS];        /* list of error actions */
76  
77   #define  ERRACT_INIT    {       {"warning - ", wputs, 0}, \
78                                  {"fatal - ", eputs, 1}, \
79                                  {"system - ", eputs, 2}, \
80 <                                {"internal - ", eputs, 1}, \
80 >                                {"internal - ", eputs, 3}, \
81                                  {"consistency - ", eputs, -1}, \
82                                  {"", NULL, 0}   }
83  
84   extern char  errmsg[];                  /* global buffer for error messages */
85  
86 + #ifdef  FASTMATH
87 + #define  tcos                   cos
88 + #define  tsin                   sin
89 + #define  ttan                   tan
90 + #else
91 + extern double   tcos();                 /* table-based cosine approximation */
92 + #define  tsin(x)                tcos((x)-(PI/2.))
93 + #define  ttan(x)                (tsin(x)/tcos(x))
94 + #endif
95 +                                        /* custom version of assert(3) */
96 + #define  CHECK(be,et,em)        if (be) error(et,em); else
97 + #ifdef  DEBUG
98 + #define  DCHECK                 CHECK
99 + #else
100 + #define  DCHECK(be,et,em)       (void)0
101 + #endif
102                                          /* memory operations */
103   #ifdef  NOSTRUCTASS
104 < #define  copystruct(d,s)        bcopy((char *)(s),(char *)(d),sizeof(*(d)))
104 > #define  copystruct(d,s)        bcopy((void *)(s),(void *)(d),sizeof(*(d)))
105   #else
106   #define  copystruct(d,s)        (*(d) = *(s))
107   #endif
108  
109 < #ifdef   BSD
80 < extern long  lseek();
81 < #else
109 > #ifndef BSD
110   #define  bcopy(s,d,n)           (void)memcpy(d,s,n)
111   #define  bzero(d,n)             (void)memset(d,0,n)
112   #define  bcmp(b1,b2,n)          memcmp(b1,b2,n)
113   #define  index                  strchr
114   #define  rindex                 strrchr
87 extern off_t  lseek();
115   #endif
116 < extern long  ftell();
116 > extern off_t  lseek();
117  
118 < 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
118 > #ifdef _WIN32
119   #define NIX 1
120   #endif
121   #ifdef AMIGA
122   #define NIX 1
123   #endif
124 +
125 +
126 +                                        /* defined in badarg.c */
127 + extern int      badarg(int ac, char **av, char *fl);
128 +                                        /* defined in bmalloc.c */
129 + extern char     *bmalloc(unsigned int n);
130 + extern void     bfree(char *p, unsigned int n);
131 +                                        /* defined in error.c */
132 + extern void     error(int etype, char *emsg);
133 +                                        /* defined in expandarg.c */
134 + extern int      expandarg(int *acp, char ***avp, int n);
135 +                                        /* defined in fdate.c */
136 + extern time_t   fdate(char *fname);
137 + extern int      setfdate(char *fname, long ftim);
138 +                                        /* defined in fgetline.c */
139 + extern char     *fgetline(char *s, int n, FILE *fp);
140 +                                        /* defined in fgetval.c */
141 + extern int      fgetval(FILE *fp, int ty, char *vp);
142 +                                        /* defined in fgetword.c */
143 + extern char     *fgetword(char *s, int n, FILE *fp);
144 +                                        /* defined in fputword.c */
145 + extern void     fputword(char *s, FILE *fp);
146 +                                        /* defined in fixargv0.c */
147 + extern char     *fixargv0(char *av0);
148 +                                        /* defined in fropen.c */
149 + extern FILE     *frlibopen(char *fname);
150 +                                        /* defined in getlibpath.c */
151 + extern char     *getrlibpath(void);
152 +                                        /* defined in getpath.c */
153 + extern char     *getpath(char *fname, char *searchpath, int mode);
154 +                                        /* defined in portio.c */
155 + extern void     putstr(char *s, FILE *fp);
156 + extern void     putint(long i, int siz, FILE *fp);
157 + extern void     putflt(double f, FILE *fp);
158 + extern char     *getstr(char *s, FILE *fp);
159 + extern long     getint(int siz, FILE *fp);
160 + extern double   getflt(FILE *fp);
161 +                                        /* defined in process.c */
162 + extern int      open_process(int pd[3], char *av[]);
163 + extern int      process(int pd[3], char *recvbuf, char *sendbuf,
164 +                                int nbr, int nbs);
165 + extern int      close_process(int pd[3]);
166 + extern int      readbuf(int fd, char *bpos, int siz);
167 + extern int      writebuf(int fd, char *bpos, int siz);
168 +                                        /* defined in rexpr.c */
169 + extern int      ecompile(char *sp, int iflg, int wflag);
170 + extern char     *expsave(void);
171 + extern void     expset(char *ep);
172 + extern char     *eindex(char *sp);
173 +                                        /* defined in savestr.c */
174 + extern char     *savestr(char *str);
175 + extern void     freestr(char *s);
176 + extern int      shash(char *s);
177 +                                        /* defined in savqstr.c */
178 + extern char     *savqstr(char *s);
179 + extern void     freeqstr(char *s);
180 +                                        /* defined in tcos.c */
181 + extern double   tcos(double x);
182 +                                        /* defined in wordfile.c */
183 + extern int      wordfile(char **words, char *fname);
184 + extern int      wordstring(char **avl, char *str);
185 +                                        /* defined in words.c */
186 + extern char     *atos(char *rs, int nb, char *s);
187 + extern char     *nextword(char *cp, int nb, char *s);
188 + extern char     *sskip(char *s);
189 + extern char     *sskip2(char *s, int n);
190 + extern char     *iskip(char *s);
191 + extern char     *fskip(char *s);
192 + extern int      isint(char *s);
193 + extern int      isintd(char *s, char *ds);
194 + extern int      isflt(char *s);
195 + extern int      isfltd(char *s, char *ds);
196 +                                        /* defined in xf.c */
197 + extern int      xf(XF *ret, int ac, char *av[]);
198 + extern int      invxf(XF *ret, int ac, char *av[]);
199 + extern int      fullxf(FULLXF *fx, int ac, char *av[]);
200 +                                        /* defined in zeroes.c */
201 + extern int      quadtratic(double *r, double a, double b, double c);
202 +                                        /* defined in dircode.c */
203 + extern int4     encodedir(FVECT dv);
204 + extern void     decodedir(FVECT dv, int4 dc);
205 + extern double   dir2diff(int4 dc1, int4 dc2);
206 + extern double   fdir2diff(int4 dc1, FVECT v2);
207 +                                        /* defined in lamp.c */
208 + extern float * matchlamp(char *s);
209 + extern int loadlamps(char *file);
210 + extern void freelamps(void);
211 +                                        /* miscellaneous */
212 + extern void     eputs(char *s);
213 + extern void     wputs(char *s);
214 + extern void     quit(int code);
215 +
216 +
217 + #ifdef __cplusplus
218 + }
219 + #endif
220 + #endif /* _RAD_STANDARD_H_ */
221  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines