1 |
< |
/* Copyright (c) 1997 Silicon Graphics, Inc. */ |
1 |
> |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
2 |
|
|
3 |
|
/* SCCSid "$SunId$ SGI" */ |
4 |
|
|
8 |
|
|
9 |
|
#include <stdio.h> |
10 |
|
|
11 |
+ |
#include <sys/types.h> |
12 |
+ |
|
13 |
|
#include <fcntl.h> |
14 |
|
|
15 |
|
#include <math.h> |
43 |
|
#define F_OK 0 /* exists */ |
44 |
|
#endif |
45 |
|
|
46 |
+ |
#ifndef int2 |
47 |
+ |
#define int2 short /* two-byte integer */ |
48 |
+ |
#endif |
49 |
+ |
#ifndef int4 |
50 |
+ |
#define int4 int /* four-byte integer */ |
51 |
+ |
#endif |
52 |
+ |
|
53 |
|
extern int eputs(), wputs(); /* standard error output functions */ |
54 |
|
|
55 |
|
/* error codes */ |
76 |
|
|
77 |
|
extern char errmsg[]; /* global buffer for error messages */ |
78 |
|
|
79 |
+ |
#ifdef FASTMATH |
80 |
+ |
#define tcos cos |
81 |
+ |
#define tsin sin |
82 |
+ |
#define ttan tan |
83 |
+ |
#else |
84 |
+ |
extern double tcos(); /* table-based cosine approximation */ |
85 |
+ |
#define tsin(x) tcos((x)-(PI/2.)) |
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) |
90 |
+ |
#ifdef DEBUG |
91 |
+ |
#define DCHECK CHECK |
92 |
+ |
#else |
93 |
+ |
#define DCHECK(be,et,em) 0 |
94 |
+ |
#endif |
95 |
|
/* memory operations */ |
96 |
|
#ifdef NOSTRUCTASS |
97 |
|
#define copystruct(d,s) bcopy((char *)(s),(char *)(d),sizeof(*(d))) |
99 |
|
#define copystruct(d,s) (*(d) = *(s)) |
100 |
|
#endif |
101 |
|
|
102 |
< |
#ifndef BSD |
102 |
> |
#ifdef BSD |
103 |
> |
extern long lseek(); |
104 |
> |
#else |
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(); |
111 |
|
#endif |
112 |
+ |
extern long ftell(); |
113 |
|
|
114 |
< |
extern char *sskip(), *sskip2(); |
114 |
> |
extern char *nextword(), *sskip(), *sskip2(); |
115 |
|
extern char *getpath(), *getenv(); |
116 |
|
#ifndef malloc |
117 |
|
extern char *malloc(), *calloc(), *realloc(); |