| 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 "platform.h" |
| 22 |
|
#include "mat4.h" |
| 23 |
+ |
|
| 24 |
+ |
|
| 25 |
+ |
#ifndef NULL |
| 26 |
+ |
#define NULL 0 |
| 27 |
+ |
#endif |
| 28 |
+ |
|
| 29 |
|
/* regular transformation */ |
| 30 |
|
typedef struct { |
| 31 |
|
MAT4 xfm; /* transform matrix */ |
| 93 |
|
#define ttan(x) (tsin(x)/tcos(x)) |
| 94 |
|
#endif |
| 95 |
|
/* custom version of assert(3) */ |
| 96 |
< |
#define CHECK(be,et,em) ((be) ? error(et,em) : 0) |
| 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) 0 |
| 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 |
| 122 |
|
#define NIX 1 |
| 123 |
|
#endif |
| 124 |
|
|
| 174 |
– |
#ifdef NOPROTO |
| 125 |
|
|
| 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 |
| 126 |
|
/* defined in badarg.c */ |
| 127 |
|
extern int badarg(int ac, char **av, char *fl); |
| 128 |
|
/* defined in bmalloc.c */ |
| 148 |
|
/* defined in fropen.c */ |
| 149 |
|
extern FILE *frlibopen(char *fname); |
| 150 |
|
/* defined in getlibpath.c */ |
| 151 |
< |
extern char *getlibpath(void); |
| 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 */ |
| 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(); |
| 170 |
> |
extern char *expsave(void); |
| 171 |
|
extern void expset(char *ep); |
| 172 |
|
extern char *eindex(char *sp); |
| 173 |
|
/* defined in savestr.c */ |
| 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 |
|
/* miscellaneous */ |
| 208 |
|
extern void eputs(char *s); |
| 209 |
|
extern void wputs(char *s); |
| 210 |
|
extern void quit(int code); |
| 211 |
|
|
| 212 |
+ |
|
| 213 |
+ |
#ifdef __cplusplus |
| 214 |
+ |
} |
| 215 |
|
#endif |
| 216 |
+ |
#endif /* _RAD_STANDARD_H_ */ |
| 217 |
+ |
|