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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines