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.16 by greg, Sat Feb 22 02:07:22 2003 UTC vs.
Revision 2.30 by schorsch, Thu Jun 26 00:58:09 2003 UTC

# Line 1 | Line 1
1 < /* RCSid: $Id$ */
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 < /* ====================================================================
7 < * The Radiance Software License, Version 1.0
8 < *
9 < * Copyright (c) 1990 - 2002 The Regents of the University of California,
10 < * through Lawrence Berkeley National Laboratory.   All rights reserved.
11 < *
12 < * Redistribution and use in source and binary forms, with or without
13 < * modification, are permitted provided that the following conditions
14 < * are met:
15 < *
16 < * 1. Redistributions of source code must retain the above copyright
17 < *         notice, this list of conditions and the following disclaimer.
18 < *
19 < * 2. Redistributions in binary form must reproduce the above copyright
20 < *       notice, this list of conditions and the following disclaimer in
21 < *       the documentation and/or other materials provided with the
22 < *       distribution.
23 < *
24 < * 3. The end-user documentation included with the redistribution,
25 < *           if any, must include the following acknowledgment:
26 < *             "This product includes Radiance software
27 < *                 (http://radsite.lbl.gov/)
28 < *                 developed by the Lawrence Berkeley National Laboratory
29 < *               (http://www.lbl.gov/)."
30 < *       Alternately, this acknowledgment may appear in the software itself,
31 < *       if and wherever such third-party acknowledgments normally appear.
32 < *
33 < * 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
34 < *       and "The Regents of the University of California" must
35 < *       not be used to endorse or promote products derived from this
36 < *       software without prior written permission. For written
37 < *       permission, please contact [email protected].
38 < *
39 < * 5. Products derived from this software may not be called "Radiance",
40 < *       nor may "Radiance" appear in their name, without prior written
41 < *       permission of Lawrence Berkeley National Laboratory.
42 < *
43 < * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
44 < * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
45 < * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
46 < * DISCLAIMED.   IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
47 < * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48 < * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49 < * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
50 < * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
51 < * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
52 < * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
53 < * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54 < * SUCH DAMAGE.
55 < * ====================================================================
56 < *
57 < * This software consists of voluntary contributions made by many
58 < * individuals on behalf of Lawrence Berkeley National Laboratory.   For more
59 < * information on Lawrence Berkeley National Laboratory, please see
60 < * <http://www.lbl.gov/>.
61 < */
11 > #include "copyright.h"
12  
13   #include  <stdio.h>
64
14   #include  <sys/types.h>
66
15   #include  <fcntl.h>
68
16   #include  <math.h>
70
17   #include  <errno.h>
72
18   #include  <stdlib.h>
74
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 */
28 <        FLOAT  sca;                             /* scalefactor */
28 >        RREAL  sca;                             /* scalefactor */
29   }  XF;
30                                  /* complemetary tranformation */
31   typedef struct {
# Line 94 | 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 101 | Line 49 | typedef struct {
49   #define  F_OK           0               /* exists */
50   #endif
51  
104 #ifndef  int2
105 #define  int2           short           /* two-byte integer */
106 #endif
107 #ifndef  int4
108 #define  int4           int             /* four-byte integer */
109 #endif
110
52                                  /* error codes */
53   #define  WARNING        0               /* non-fatal error */
54   #define  USER           1               /* fatal user-caused error */
# Line 137 | Line 78 | extern char  errmsg[];                 /* global buffer for error me
78   #define  tsin                   sin
79   #define  ttan                   tan
80   #else
81 < extern double   tcos();                 /* table-based cosine approximation */
81 >                                        /* 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)        ((be) ? error(et,em) : 0)
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)       0
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
# Line 162 | Line 103 | extern double  tcos();                 /* table-based cosine approxim
103   #define  index                  strchr
104   #define  rindex                 strrchr
105   #endif
165 extern off_t  lseek();
106  
107 < #ifdef MSDOS
107 >                        /* <unistd.h> is missing on some systems */
108 > extern off_t  lseek(int, off_t, int);
109 >
110 > #ifdef _WIN32
111   #define NIX 1
112   #endif
113   #ifdef AMIGA
114   #define NIX 1
115   #endif
116  
174 #ifdef NOPROTO
117  
176 extern int      badarg();
177 extern char     *bmalloc();
178 extern void     bfree();
179 extern void     error();
180 extern int      expandarg();
181 extern time_t   fdate();
182 extern int      setfdate();
183 extern char     *fgetline();
184 extern int      fgetval();
185 extern char     *fgetword();
186 extern void     fputword();
187 extern char     *fixargv0();
188 extern FILE     *frlibopen();
189 extern char     *getlibpath();
190 extern char     *getpath();
191 extern void     putstr();
192 extern void     putint();
193 extern void     putflt();
194 extern char     *getstr();
195 extern long     getint();
196 extern double   getflt();
197 extern int      open_process();
198 extern int      process();
199 extern int      close_process();
200 extern int      readbuf();
201 extern int      writebuf();
202 extern int      ecompile();
203 extern char     *expsave();
204 extern void     expset();
205 extern char     *eindex();
206 extern char     *savestr();
207 extern void     freestr();
208 extern int      shash();
209 extern char     *savqstr();
210 extern void     freeqstr();
211 extern double   tcos();
212 extern int      wordfile();
213 extern int      wordstring();
214 extern char     *atos();
215 extern char     *nextword();
216 extern char     *sskip();
217 extern char     *sskip2();
218 extern char     *iskip();
219 extern char     *fskip();
220 extern int      isint();
221 extern int      isintd();
222 extern int      isflt();
223 extern int      isfltd();
224 extern int      xf();
225 extern int      invxf();
226 extern int      fullxf();
227 extern int      quadtratic();
228 extern void     eputs();
229 extern void     wputs();
230 extern void     quit();
231
232 #else
118                                          /* defined in badarg.c */
119   extern int      badarg(int ac, char **av, char *fl);
120                                          /* defined in bmalloc.c */
# Line 251 | Line 136 | extern char    *fgetword(char *s, int n, FILE *fp);
136                                          /* defined in fputword.c */
137   extern void     fputword(char *s, FILE *fp);
138                                          /* defined in fixargv0.c */
139 < extern char     *fixargv0(char *av0);
139 > /*extern char   *fixargv0(char *av0);*/ /* XXX include paths.h instead */
140                                          /* defined in fropen.c */
141   extern FILE     *frlibopen(char *fname);
142                                          /* defined in getlibpath.c */
143 < extern char     *getlibpath(void);
143 > extern char     *getrlibpath(void);
144                                          /* defined in getpath.c */
145   extern char     *getpath(char *fname, char *searchpath, int mode);
146                                          /* defined in portio.c */
# Line 266 | Line 151 | extern char    *getstr(char *s, FILE *fp);
151   extern long     getint(int siz, FILE *fp);
152   extern double   getflt(FILE *fp);
153                                          /* defined in process.c */
154 + /*
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 + */
162                                          /* defined in rexpr.c */
163   extern int      ecompile(char *sp, int iflg, int wflag);
164 < extern char     *expsave();
164 > extern char     *expsave(void);
165   extern void     expset(char *ep);
166   extern char     *eindex(char *sp);
167                                          /* defined in savestr.c */
# Line 306 | Line 193 | extern int     invxf(XF *ret, int ac, char *av[]);
193   extern int      fullxf(FULLXF *fx, int ac, char *av[]);
194                                          /* defined in zeroes.c */
195   extern int      quadtratic(double *r, double a, double b, double c);
196 +                                        /* defined in dircode.c */
197 + extern int32    encodedir(FVECT dv);
198 + extern void     decodedir(FVECT dv, int32 dc);
199 + extern double   dir2diff(int32 dc1, int32 dc2);
200 + extern double   fdir2diff(int32 dc1, FVECT v2);
201 +                                        /* defined in lamp.c */
202 + extern float * matchlamp(char *s);
203 + extern int loadlamps(char *file);
204 + extern void freelamps(void);
205                                          /* miscellaneous */
206   extern void     eputs(char *s);
207   extern void     wputs(char *s);
208   extern void     quit(int code);
209  
210 +
211 + #ifdef __cplusplus
212 + }
213   #endif
214 + #endif /* _RAD_STANDARD_H_ */
215 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines