| 1 | #define VERSION "3.55c" |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | /* machine-specific stuff: |
|---|
| 5 | based on a number of factors in the library stdlib.h, we will try |
|---|
| 6 | to determine what kind of machine/compiler this program is being |
|---|
| 7 | built on. However, it doesn't always succeed. However, if you have |
|---|
| 8 | ANSI conforming C, it will probably work. |
|---|
| 9 | |
|---|
| 10 | we will try to figure out machine type |
|---|
| 11 | based on defines in stdio, and compiler-defined things as well.: */ |
|---|
| 12 | |
|---|
| 13 | #ifdef GNUDOS |
|---|
| 14 | #define DJGPP |
|---|
| 15 | #define DOS |
|---|
| 16 | #endif |
|---|
| 17 | |
|---|
| 18 | #ifdef THINK_C |
|---|
| 19 | #define MAC |
|---|
| 20 | #endif |
|---|
| 21 | |
|---|
| 22 | #include <stdio.h> |
|---|
| 23 | #include <stdlib.h> |
|---|
| 24 | |
|---|
| 25 | #ifdef __CMS_OPEN |
|---|
| 26 | #define CMS |
|---|
| 27 | #define EBCDIC true |
|---|
| 28 | #define INFILE "infile data" |
|---|
| 29 | #define OUTFILE "outfile data" |
|---|
| 30 | #define TREEFILE "treefile data" |
|---|
| 31 | #define FONTFILE "fontfile data" |
|---|
| 32 | #define PLOTFILE "plotfile data" |
|---|
| 33 | #define INTREE "intree data" |
|---|
| 34 | #define OUTTREE "outtree data" |
|---|
| 35 | #else |
|---|
| 36 | #define EBCDIC false |
|---|
| 37 | #define INFILE "infile" |
|---|
| 38 | #define OUTFILE "outfile" |
|---|
| 39 | #define TREEFILE "treefile" |
|---|
| 40 | #define FONTFILE "fontfile" /* on unix this might be /usr/local/lib/fontfile */ |
|---|
| 41 | #define PLOTFILE "plotfile" |
|---|
| 42 | #define INTREE "intree" |
|---|
| 43 | #define OUTTREE "outtree" |
|---|
| 44 | #endif |
|---|
| 45 | |
|---|
| 46 | #ifdef L_ctermid /* try and detect for sysV or V7. */ |
|---|
| 47 | #define SYSTEM_FIVE |
|---|
| 48 | #endif |
|---|
| 49 | |
|---|
| 50 | #ifdef sequent |
|---|
| 51 | #define SYSTEM_FIVE |
|---|
| 52 | #endif |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | #ifdef __STDIO_LOADED |
|---|
| 56 | #define VMS |
|---|
| 57 | #define MACHINE_TYPE "VAX/VMS C" |
|---|
| 58 | #define printf vax_printf_is_broken |
|---|
| 59 | #define fprintf vax_fprintf_is_broken |
|---|
| 60 | void vax_printf_is_broken(const char *fmt,...); |
|---|
| 61 | void vax_fprintf_is_broken(FILE *fp,const char *fmt,...); |
|---|
| 62 | void vax_tweak_fmt(char *); |
|---|
| 63 | #endif |
|---|
| 64 | |
|---|
| 65 | #ifdef __WATCOMC__ |
|---|
| 66 | #define QUICKC |
|---|
| 67 | #define WATCOM |
|---|
| 68 | #define DOS |
|---|
| 69 | #include "graph.h" |
|---|
| 70 | #endif |
|---|
| 71 | /* watcom-c has graphics library calls that are almost identical to * |
|---|
| 72 | * quick-c, so the "QUICKC" symbol name stays. */ |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | #ifdef _QC |
|---|
| 76 | #define MACHINE_TYPE "MS-DOS / Quick C" |
|---|
| 77 | #define QUICKC |
|---|
| 78 | #include "graph.h" |
|---|
| 79 | #define DOS |
|---|
| 80 | #endif |
|---|
| 81 | |
|---|
| 82 | #ifdef _DOS_MODE |
|---|
| 83 | #define MACHINE_TYPE "MS-DOS /Microsoft C " |
|---|
| 84 | #define DOS /* DOS is always defined if on a dos machine */ |
|---|
| 85 | #define MSC /* MSC is defined for microsoft C */ |
|---|
| 86 | #endif |
|---|
| 87 | |
|---|
| 88 | #ifdef __MSDOS__ /* TURBO c compiler, ONLY (no other DOS C compilers) */ |
|---|
| 89 | #define DOS |
|---|
| 90 | #define TURBOC |
|---|
| 91 | #include<stdlib.h> |
|---|
| 92 | #include<graphics.h> |
|---|
| 93 | #endif |
|---|
| 94 | |
|---|
| 95 | #ifdef DJGPP /* DJ's gnu C/C++ port */ |
|---|
| 96 | #include<graphics.h> |
|---|
| 97 | #endif |
|---|
| 98 | |
|---|
| 99 | #ifndef MACHINE_TYPE |
|---|
| 100 | #define MACHINE_TYPE "ANSI C" |
|---|
| 101 | #endif |
|---|
| 102 | |
|---|
| 103 | #ifdef DOS |
|---|
| 104 | #define MALLOCRETURN void |
|---|
| 105 | #else |
|---|
| 106 | #define MALLOCRETURN void |
|---|
| 107 | #endif |
|---|
| 108 | |
|---|
| 109 | #ifdef VMS |
|---|
| 110 | #define signed /* signed doesn't exist in VMS */ |
|---|
| 111 | #endif |
|---|
| 112 | |
|---|
| 113 | #ifdef DJGPP |
|---|
| 114 | #undef MALLOCRETURN |
|---|
| 115 | #define MALLOCRETURN void |
|---|
| 116 | #endif |
|---|
| 117 | |
|---|
| 118 | |
|---|
| 119 | /* includes: */ |
|---|
| 120 | #ifdef UNIX |
|---|
| 121 | #include<strings.h> |
|---|
| 122 | #else |
|---|
| 123 | #include<string.h> |
|---|
| 124 | #endif |
|---|
| 125 | |
|---|
| 126 | #include <math.h> |
|---|
| 127 | #include <ctype.h> |
|---|
| 128 | |
|---|
| 129 | #ifdef MAC |
|---|
| 130 | #include "interface.h" |
|---|
| 131 | #endif |
|---|
| 132 | |
|---|
| 133 | #define FClose(file) if (file) fclose(file) ; file=NULL |
|---|
| 134 | #define Malloc(x) mymalloc((long)x) |
|---|
| 135 | |
|---|
| 136 | typedef void *Anyptr; |
|---|
| 137 | #define Signed signed |
|---|
| 138 | #define Void void /* Void f() = procedure */ |
|---|
| 139 | #define Const const |
|---|
| 140 | #define Volatile volatile |
|---|
| 141 | #define Char char /* Characters (not bytes) */ |
|---|
| 142 | #define Static static /* Private global funcs and vars */ |
|---|
| 143 | #define Local static /* Nested functions */ |
|---|
| 144 | |
|---|
| 145 | typedef unsigned char boolean; |
|---|
| 146 | |
|---|
| 147 | # define true 1 |
|---|
| 148 | # define false 0 |
|---|
| 149 | #define SETBITS 32 |
|---|
| 150 | |
|---|
| 151 | #ifdef MAC |
|---|
| 152 | MALLOCRETURN *mymalloc(long); |
|---|
| 153 | #else |
|---|
| 154 | MALLOCRETURN *mymalloc(); |
|---|
| 155 | #endif |
|---|
| 156 | int eof(); |
|---|
| 157 | int eoln(); |
|---|
| 158 | void memerror(); |
|---|
| 159 | |
|---|