| 1 | < | /* Copyright (c) 1990 Regents of the University of California */ | 
| 1 | > | /* Copyright (c) 1992 Regents of the University of California */ | 
| 2 |  |  | 
| 3 |  | /* SCCSid "$SunId$ LBL" */ | 
| 4 |  |  | 
| 8 |  |  | 
| 9 |  | #include  <stdio.h> | 
| 10 |  |  | 
| 11 | + | #include  <fcntl.h> | 
| 12 | + |  | 
| 13 |  | #include  <math.h> | 
| 14 |  |  | 
| 15 |  | #include  <errno.h> | 
| 18 |  | /* regular transformation */ | 
| 19 |  | typedef struct { | 
| 20 |  | MAT4  xfm;                              /* transform matrix */ | 
| 21 | < | double  sca;                            /* scalefactor */ | 
| 21 | > | FLOAT  sca;                             /* scalefactor */ | 
| 22 |  | }  XF; | 
| 23 |  | /* complemetary tranformation */ | 
| 24 |  | typedef struct { | 
| 26 |  | XF  b;                                  /* backward */ | 
| 27 |  | }  FULLXF; | 
| 28 |  |  | 
| 29 | < | #ifdef  M_PI | 
| 30 | < | #define  PI             M_PI | 
| 29 | > | #ifdef  M_PI | 
| 30 | > | #define  PI             M_PI | 
| 31 |  | #else | 
| 32 | < | #define  PI             3.14159265358979323846 | 
| 32 | > | #define  PI             3.14159265358979323846 | 
| 33 |  | #endif | 
| 34 |  |  | 
| 35 | < | #ifndef  F_OK                   /* mode bits for access(2) call */ | 
| 36 | < | #define  R_OK           4               /* readable */ | 
| 37 | < | #define  W_OK           2               /* writable */ | 
| 38 | < | #define  X_OK           1               /* executable */ | 
| 39 | < | #define  F_OK           0               /* exists */ | 
| 35 | > | #ifndef  F_OK                   /* mode bits for access(2) call */ | 
| 36 | > | #define  R_OK           4               /* readable */ | 
| 37 | > | #define  W_OK           2               /* writable */ | 
| 38 | > | #define  X_OK           1               /* executable */ | 
| 39 | > | #define  F_OK           0               /* exists */ | 
| 40 |  | #endif | 
| 41 |  | /* error codes */ | 
| 42 | < | #define  WARNING        1               /* non-fatal error */ | 
| 43 | < | #define  USER           2               /* fatal user-caused error */ | 
| 44 | < | #define  SYSTEM         3               /* fatal system-related error */ | 
| 45 | < | #define  INTERNAL       4               /* fatal program-related error */ | 
| 46 | < | #define  CONSISTENCY    5               /* bad consistency check, abort */ | 
| 47 | < | #define  COMMAND        6               /* interactive error */ | 
| 42 | > | #define  WARNING        1               /* non-fatal error */ | 
| 43 | > | #define  USER           2               /* fatal user-caused error */ | 
| 44 | > | #define  SYSTEM         3               /* fatal system-related error */ | 
| 45 | > | #define  INTERNAL       4               /* fatal program-related error */ | 
| 46 | > | #define  CONSISTENCY    5               /* bad consistency check, abort */ | 
| 47 | > | #define  COMMAND        6               /* interactive error */ | 
| 48 |  |  | 
| 49 |  | extern char  errmsg[];                  /* global buffer for error messages */ | 
| 50 |  |  | 
| 49 | – | extern int  errno;                      /* system error number */ | 
| 50 | – |  | 
| 51 |  | /* memory operations */ | 
| 52 | < | #ifdef  STRUCTASSIGN | 
| 53 | < | #define  copystruct(d,s)        (*(d) = *(s)) | 
| 52 | > | #ifdef  NOSTRUCTASS | 
| 53 | > | #define  copystruct(d,s)        bcopy((char *)(s),(char *)(d),sizeof(*(d))) | 
| 54 |  | #else | 
| 55 | < | #define  copystruct(d,s)        bcopy((char *)(s),(char *)(d),sizeof(*(d))) | 
| 55 | > | #define  copystruct(d,s)        (*(d) = *(s)) | 
| 56 |  | #endif | 
| 57 |  |  | 
| 58 | < | #ifndef  BSD | 
| 59 | < | #define  bcopy(s,d,n)           (void)memcpy(d,s,n) | 
| 60 | < | #define  bzero(d,n)             (void)memset(d,0,n) | 
| 61 | < | #define  bcmp(b1,b2,n)          memcmp(b1,b2,n) | 
| 58 | > | #ifndef  BSD | 
| 59 | > | #define  bcopy(s,d,n)           (void)memcpy(d,s,n) | 
| 60 | > | #define  bzero(d,n)             (void)memset(d,0,n) | 
| 61 | > | #define  bcmp(b1,b2,n)          memcmp(b1,b2,n) | 
| 62 |  | extern char  *memcpy(), *memset(); | 
| 63 | < | #define  index                  strchr | 
| 64 | < | #define  rindex                 strrchr | 
| 63 | > | #define  index                  strchr | 
| 64 | > | #define  rindex                 strrchr | 
| 65 |  | #endif | 
| 66 |  |  | 
| 67 | + | #ifndef atof | 
| 68 | + | extern double  atof(); | 
| 69 | + | #endif | 
| 70 |  | extern char  *sskip(); | 
| 71 |  | extern char  *getpath(), *getenv(); | 
| 72 | + | #ifndef malloc | 
| 73 |  | extern char  *malloc(), *calloc(), *realloc(); | 
| 74 | + | #endif | 
| 75 |  | extern char  *bmalloc(), *savestr(), *savqstr(); | 
| 76 | + |  | 
| 77 | + | #ifdef MSDOS | 
| 78 | + | #define NIX 1 | 
| 79 | + | #endif | 
| 80 | + | #ifdef AMIGA | 
| 81 | + | #define NIX 1 | 
| 82 | + | #endif | 
| 83 | + |  |