| 1 | #define INTERDATA 2 |
| 2 | #define GCOS 3 |
| 3 | #define PDP11 4 |
| 4 | #define IBM 5 |
| 5 | #define CMACH 6 |
| 6 | #define VAX 7 |
| 7 | |
| 8 | #define DMR 2 |
| 9 | #define SCJ 3 |
| 10 | |
| 11 | #define BINARY 2 |
| 12 | #define ASCII 3 |
| 13 | |
| 14 | #define PREFIX 2 |
| 15 | #define POSTFIX 3 |
| 16 | |
| 17 | #ifndef FAMILY |
| 18 | FAMILY NOT DEFINED !!! |
| 19 | Family = FAMILY |
| 20 | #endif |
| 21 | |
| 22 | #ifndef HERE |
| 23 | HERE NOT DEFINED !!!! |
| 24 | Here = HERE |
| 25 | #endif |
| 26 | |
| 27 | #ifndef OUTPUT |
| 28 | OUTPUT NOT DEFINED!!!! |
| 29 | Output = OUTPUT |
| 30 | #endif |
| 31 | |
| 32 | #ifndef POLISH |
| 33 | POLISH NOT DEFINED !!! |
| 34 | Polish = POLISH |
| 35 | #endif |
| 36 | |
| 37 | #define M(x) (1<<x) |
| 38 | #define ALLOC(x) (struct x *) ckalloc(sizeof(struct x)) |
| 39 | typedef int *ptr; |
| 40 | typedef FILE *FILEP; |
| 41 | typedef short flag; |
| 42 | typedef long int ftnint; |
| 43 | #define LOCAL static |
| 44 | |
| 45 | #define NO 0 |
| 46 | #define YES 1 |
| 47 | |
| 48 | |
| 49 | |
| 50 | /* block tag values */ |
| 51 | |
| 52 | #define TNAME 1 |
| 53 | #define TCONST 2 |
| 54 | #define TEXPR 3 |
| 55 | #define TADDR 4 |
| 56 | #define TPRIM 5 |
| 57 | #define TLIST 6 |
| 58 | #define TIMPLDO 7 |
| 59 | #define TERROR 8 |
| 60 | |
| 61 | |
| 62 | /* parser states */ |
| 63 | |
| 64 | #define OUTSIDE 0 |
| 65 | #define INSIDE 1 |
| 66 | #define INDCL 2 |
| 67 | #define INDATA 3 |
| 68 | #define INEXEC 4 |
| 69 | |
| 70 | /* procedure classes */ |
| 71 | |
| 72 | #define PROCMAIN 1 |
| 73 | #define PROCBLOCK 2 |
| 74 | #define PROCSUBR 3 |
| 75 | #define PROCFUNCT 4 |
| 76 | |
| 77 | |
| 78 | /* storage classes */ |
| 79 | |
| 80 | #define STGUNKNOWN 0 |
| 81 | #define STGARG 1 |
| 82 | #define STGAUTO 2 |
| 83 | #define STGBSS 3 |
| 84 | #define STGINIT 4 |
| 85 | #define STGCONST 5 |
| 86 | #define STGEXT 6 |
| 87 | #define STGINTR 7 |
| 88 | #define STGSTFUNCT 8 |
| 89 | #define STGCOMMON 9 |
| 90 | #define STGEQUIV 10 |
| 91 | #define STGREG 11 |
| 92 | #define STGLENG 12 |
| 93 | |
| 94 | /* name classes */ |
| 95 | |
| 96 | #define CLUNKNOWN 0 |
| 97 | #define CLPARAM 1 |
| 98 | #define CLVAR 2 |
| 99 | #define CLENTRY 3 |
| 100 | #define CLMAIN 4 |
| 101 | #define CLBLOCK 5 |
| 102 | #define CLPROC 6 |
| 103 | |
| 104 | |
| 105 | /* vproclass values */ |
| 106 | |
| 107 | #define PUNKNOWN 0 |
| 108 | #define PEXTERNAL 1 |
| 109 | #define PINTRINSIC 2 |
| 110 | #define PSTFUNCT 3 |
| 111 | #define PTHISPROC 4 |
| 112 | |
| 113 | /* control stack codes */ |
| 114 | |
| 115 | #define CTLDO 1 |
| 116 | #define CTLIF 2 |
| 117 | #define CTLELSE 3 |
| 118 | |
| 119 | |
| 120 | /* operators */ |
| 121 | |
| 122 | #define OPPLUS 1 |
| 123 | #define OPMINUS 2 |
| 124 | #define OPSTAR 3 |
| 125 | #define OPSLASH 4 |
| 126 | #define OPPOWER 5 |
| 127 | #define OPNEG 6 |
| 128 | #define OPOR 7 |
| 129 | #define OPAND 8 |
| 130 | #define OPEQV 9 |
| 131 | #define OPNEQV 10 |
| 132 | #define OPNOT 11 |
| 133 | #define OPCONCAT 12 |
| 134 | #define OPLT 13 |
| 135 | #define OPEQ 14 |
| 136 | #define OPGT 15 |
| 137 | #define OPLE 16 |
| 138 | #define OPNE 17 |
| 139 | #define OPGE 18 |
| 140 | #define OPCALL 19 |
| 141 | #define OPCCALL 20 |
| 142 | #define OPASSIGN 21 |
| 143 | #define OPPLUSEQ 22 |
| 144 | #define OPSTAREQ 23 |
| 145 | #define OPCONV 24 |
| 146 | #define OPLSHIFT 25 |
| 147 | #define OPMOD 26 |
| 148 | #define OPCOMMA 27 |
| 149 | #define OPQUEST 28 |
| 150 | #define OPCOLON 29 |
| 151 | #define OPABS 30 |
| 152 | #define OPMIN 31 |
| 153 | #define OPMAX 32 |
| 154 | #define OPADDR 33 |
| 155 | #define OPINDIRECT 34 |
| 156 | #define OPBITOR 35 |
| 157 | #define OPBITAND 36 |
| 158 | #define OPBITXOR 37 |
| 159 | #define OPBITNOT 38 |
| 160 | #define OPRSHIFT 39 |
| 161 | |
| 162 | |
| 163 | /* memory regions */ |
| 164 | |
| 165 | #define REGARG 1 |
| 166 | #define REGAUTO 2 |
| 167 | #define REGBSS 3 |
| 168 | #define REGINIT 4 |
| 169 | #define REGCONST 5 |
| 170 | #define REGEXT 6 |
| 171 | #define REGPROG 7 |
| 172 | |
| 173 | /* label type codes */ |
| 174 | |
| 175 | #define LABUNKNOWN 0 |
| 176 | #define LABEXEC 1 |
| 177 | #define LABFORMAT 2 |
| 178 | #define LABOTHER 3 |
| 179 | |
| 180 | |
| 181 | /* INTRINSIC function codes*/ |
| 182 | |
| 183 | #define INTREND 0 |
| 184 | #define INTRCONV 1 |
| 185 | #define INTRMIN 2 |
| 186 | #define INTRMAX 3 |
| 187 | #define INTRGEN 4 |
| 188 | #define INTRSPEC 5 |
| 189 | #define INTRBOOL 6 |
| 190 | #define INTRCNST 7 |
| 191 | |
| 192 | |
| 193 | /* I/O statement codes */ |
| 194 | |
| 195 | #define IOSTDIN ICON(5) |
| 196 | #define IOSTDOUT ICON(6) |
| 197 | |
| 198 | #define IOSBAD (-1) |
| 199 | #define IOSPOSITIONAL 0 |
| 200 | #define IOSUNIT 1 |
| 201 | #define IOSFMT 2 |
| 202 | |
| 203 | #define IOINQUIRE 1 |
| 204 | #define IOOPEN 2 |
| 205 | #define IOCLOSE 3 |
| 206 | #define IOREWIND 4 |
| 207 | #define IOBACKSPACE 5 |
| 208 | #define IOENDFILE 6 |
| 209 | #define IOREAD 7 |
| 210 | #define IOWRITE 8 |
| 211 | |
| 212 | |
| 213 | /* type masks */ |
| 214 | |
| 215 | #define MSKLOGICAL M(TYLOGICAL) |
| 216 | #define MSKADDR M(TYADDR) |
| 217 | #define MSKCHAR M(TYCHAR) |
| 218 | #define MSKINT M(TYSHORT)|M(TYLONG) |
| 219 | #define MSKREAL M(TYREAL)|M(TYDREAL) |
| 220 | #define MSKCOMPLEX M(TYCOMPLEX)|M(TYDCOMPLEX) |
| 221 | |
| 222 | /* miscellaneous macros */ |
| 223 | |
| 224 | #define ONEOF(x,y) (M(x) & (y)) |
| 225 | #define ISCOMPLEX(z) ONEOF(z, MSKCOMPLEX) |
| 226 | #define ISREAL(z) ONEOF(z, MSKREAL) |
| 227 | #define ISNUMERIC(z) ONEOF(z, MSKINT|MSKREAL|MSKCOMPLEX) |
| 228 | #define ISICON(z) (z->tag==TCONST && ISINT(z->vtype)) |
| 229 | #define ISCHAR(z) (z->vtype==TYCHAR) |
| 230 | #define ISINT(z) ONEOF(z, MSKINT) |
| 231 | #define ISCONST(z) (z->tag==TCONST) |
| 232 | #define ISERROR(z) (z->tag==TERROR) |
| 233 | #define ISPLUSOP(z) (z->tag==TEXPR && z->opcode==OPPLUS) |
| 234 | #define ISSTAROP(z) (z->tag==TEXPR && z->opcode==OPSTAR) |
| 235 | #define ISONE(z) (ISICON(z) && z->const.ci==1) |
| 236 | #define INT(z) ONEOF(z, MSKINT|MSKCHAR) |
| 237 | #define ICON(z) mkintcon( (ftnint)(z) ) |
| 238 | #define CHCON(z) mkstrcon(strlen(z), z) |
| 239 | |
| 240 | /* round a up to a multiple of b */ |
| 241 | #define roundup(a,b) ( b * ( (a+b-1)/b) ) |