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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines