| 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 "copyright.h" |
| 12 |
|
|
| 13 |
|
#include <stdio.h> |
| 9 |
– |
|
| 14 |
|
#include <sys/types.h> |
| 11 |
– |
|
| 15 |
|
#include <fcntl.h> |
| 13 |
– |
|
| 16 |
|
#include <math.h> |
| 15 |
– |
|
| 17 |
|
#include <errno.h> |
| 17 |
– |
|
| 18 |
|
#include <stdlib.h> |
| 19 |
– |
|
| 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 */ |
| 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 */ |
| 49 |
|
#define F_OK 0 /* exists */ |
| 50 |
|
#endif |
| 51 |
|
|
| 49 |
– |
#ifndef int2 |
| 50 |
– |
#define int2 short /* two-byte integer */ |
| 51 |
– |
#endif |
| 52 |
– |
#ifndef int4 |
| 53 |
– |
#define int4 int /* four-byte integer */ |
| 54 |
– |
#endif |
| 55 |
– |
|
| 52 |
|
/* error codes */ |
| 53 |
|
#define WARNING 0 /* non-fatal error */ |
| 54 |
|
#define USER 1 /* fatal user-caused error */ |
| 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 |
| 103 |
|
#define index strchr |
| 104 |
|
#define rindex strrchr |
| 105 |
|
#endif |
| 110 |
– |
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 |
|
|
| 119 |
– |
#ifdef NOPROTO |
| 117 |
|
|
| 121 |
– |
extern int badarg(); |
| 122 |
– |
extern char *bmalloc(); |
| 123 |
– |
extern void bfree(); |
| 124 |
– |
extern void error(); |
| 125 |
– |
extern int expandarg(); |
| 126 |
– |
extern time_t fdate(); |
| 127 |
– |
extern int setfdate(); |
| 128 |
– |
extern char *fgetline(); |
| 129 |
– |
extern int fgetval(); |
| 130 |
– |
extern char *fgetword(); |
| 131 |
– |
extern void fputword(); |
| 132 |
– |
extern char *fixargv0(); |
| 133 |
– |
extern FILE *frlibopen(); |
| 134 |
– |
extern char *getlibpath(); |
| 135 |
– |
extern char *getpath(); |
| 136 |
– |
extern void putstr(); |
| 137 |
– |
extern void putint(); |
| 138 |
– |
extern void putflt(); |
| 139 |
– |
extern char *getstr(); |
| 140 |
– |
extern long getint(); |
| 141 |
– |
extern double getflt(); |
| 142 |
– |
extern int open_process(); |
| 143 |
– |
extern int process(); |
| 144 |
– |
extern int close_process(); |
| 145 |
– |
extern int readbuf(); |
| 146 |
– |
extern int writebuf(); |
| 147 |
– |
extern int ecompile(); |
| 148 |
– |
extern char *expsave(); |
| 149 |
– |
extern void expset(); |
| 150 |
– |
extern char *eindex(); |
| 151 |
– |
extern char *savestr(); |
| 152 |
– |
extern void freestr(); |
| 153 |
– |
extern int shash(); |
| 154 |
– |
extern char *savqstr(); |
| 155 |
– |
extern void freeqstr(); |
| 156 |
– |
extern double tcos(); |
| 157 |
– |
extern int wordfile(); |
| 158 |
– |
extern int wordstring(); |
| 159 |
– |
extern char *atos(); |
| 160 |
– |
extern char *nextword(); |
| 161 |
– |
extern char *sskip(); |
| 162 |
– |
extern char *sskip2(); |
| 163 |
– |
extern char *iskip(); |
| 164 |
– |
extern char *fskip(); |
| 165 |
– |
extern int isint(); |
| 166 |
– |
extern int isintd(); |
| 167 |
– |
extern int isflt(); |
| 168 |
– |
extern int isfltd(); |
| 169 |
– |
extern int xf(); |
| 170 |
– |
extern int invxf(); |
| 171 |
– |
extern int fullxf(); |
| 172 |
– |
extern int quadtratic(); |
| 173 |
– |
extern void eputs(); |
| 174 |
– |
extern void wputs(); |
| 175 |
– |
extern void quit(); |
| 176 |
– |
|
| 177 |
– |
#else |
| 118 |
|
/* defined in badarg.c */ |
| 119 |
|
extern int badarg(int ac, char **av, char *fl); |
| 120 |
|
/* defined in bmalloc.c */ |
| 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 */ |
| 159 |
|
extern int writebuf(int fd, char *bpos, int siz); |
| 160 |
|
/* defined in rexpr.c */ |
| 161 |
|
extern int ecompile(char *sp, int iflg, int wflag); |
| 162 |
< |
extern char *expsave(); |
| 162 |
> |
extern char *expsave(void); |
| 163 |
|
extern void expset(char *ep); |
| 164 |
|
extern char *eindex(char *sp); |
| 165 |
|
/* defined in savestr.c */ |
| 191 |
|
extern int fullxf(FULLXF *fx, int ac, char *av[]); |
| 192 |
|
/* defined in zeroes.c */ |
| 193 |
|
extern int quadtratic(double *r, double a, double b, double c); |
| 194 |
+ |
/* defined in dircode.c */ |
| 195 |
+ |
extern int32 encodedir(FVECT dv); |
| 196 |
+ |
extern void decodedir(FVECT dv, int32 dc); |
| 197 |
+ |
extern double dir2diff(int32 dc1, int32 dc2); |
| 198 |
+ |
extern double fdir2diff(int32 dc1, FVECT v2); |
| 199 |
+ |
/* defined in lamp.c */ |
| 200 |
+ |
extern float * matchlamp(char *s); |
| 201 |
+ |
extern int loadlamps(char *file); |
| 202 |
+ |
extern void freelamps(void); |
| 203 |
|
/* miscellaneous */ |
| 204 |
|
extern void eputs(char *s); |
| 205 |
|
extern void wputs(char *s); |
| 206 |
|
extern void quit(int code); |
| 207 |
|
|
| 208 |
+ |
|
| 209 |
+ |
#ifdef __cplusplus |
| 210 |
+ |
} |
| 211 |
|
#endif |
| 212 |
+ |
#endif /* _RAD_STANDARD_H_ */ |
| 213 |
+ |
|