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.15 by gwlarson, Mon Jul 12 10:27:59 1999 UTC vs.
Revision 2.24 by schorsch, Fri Jun 6 16:38:47 2003 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines