1 /*- 2 * Copyright (c) 1991 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 * 7 * @(#)defines.h 5.3 (Berkeley) 04/12/91 8 */ 9 10 #define INTERDATA 2 11 #define GCOS 3 12 #define PDP11 4 13 #define IBM 5 14 #define CMACH 6 15 #define VAX 7 16 17 #define DMR 2 18 #define PCC 3 19 20 #ifndef FAMILY 21 FAMILY NOT DEFINED !!! 22 Family = FAMILY 23 #endif 24 25 #ifndef HERE 26 HERE NOT DEFINED !!!! 27 Here = HERE 28 #endif 29 30 #define M(x) (1<<x) 31 #define ALLOC(x) (struct x *) ckalloc(sizeof(struct x)) 32 #define ALLOCN(n,x) (struct x *) ckalloc(n*sizeof(struct x)) 33 #define ALLEXPR (expptr) ckalloc( sizeof(union Expression) ) 34 typedef int *ptr; 35 typedef char *charptr; 36 typedef FILE *FILEP; 37 typedef short flag; 38 typedef char field; /* actually need only 4 bits */ 39 typedef long int ftnint; 40 #define LOCAL static 41 42 #define NO 0 43 #define YES 1 44 45 #define CNULL (char *) 0 46 #define PNULL (ptr) 0 47 #define CHNULL (chainp) 0 48 #define ENULL (expptr) 0 49 50 51 52 /* block tag values */ 53 54 #define TNAME 1 55 #define TCONST 2 56 #define TEXPR 3 57 #define TADDR 4 58 #define TTEMP 5 59 #define TPRIM 6 60 #define TLIST 7 61 #define TIMPLDO 8 62 #define TERROR 9 63 64 65 /* parser states */ 66 67 #define OUTSIDE 0 68 #define INSIDE 1 69 #define INDCL 2 70 #define INDATA 3 71 #define INEXEC 4 72 73 /* procedure classes */ 74 75 #define PROCMAIN 1 76 #define PROCBLOCK 2 77 #define PROCSUBR 3 78 #define PROCFUNCT 4 79 80 81 /* storage classes -- vstg values */ 82 83 #define STGUNKNOWN 0 84 #define STGARG 1 85 #define STGAUTO 2 86 #define STGBSS 3 87 #define STGINIT 4 88 #define STGCONST 5 89 #define STGEXT 6 90 #define STGINTR 7 91 #define STGSTFUNCT 8 92 #define STGCOMMON 9 93 #define STGEQUIV 10 94 #define STGREG 11 95 #define STGLENG 12 96 #define STGNULL 13 97 #define STGPREG 14 98 99 /* name classes -- vclass values */ 100 101 #define CLUNKNOWN 0 102 #define CLPARAM 1 103 #define CLVAR 2 104 #define CLENTRY 3 105 #define CLMAIN 4 106 #define CLBLOCK 5 107 #define CLPROC 6 108 #define CLNAMELIST 7 109 110 111 /* vprocclass values */ 112 113 #define PUNKNOWN 0 114 #define PEXTERNAL 1 115 #define PINTRINSIC 2 116 #define PSTFUNCT 3 117 #define PTHISPROC 4 118 119 /* control stack codes */ 120 121 #define CTLDO 1 122 #define CTLIF 2 123 #define CTLELSE 3 124 125 126 /* operators -- see also arrays 'ops' and 'ops2' in put.c */ 127 128 #define OPPLUS 1 129 #define OPMINUS 2 130 #define OPSTAR 3 131 #define OPSLASH 4 132 #define OPPOWER 5 133 #define OPNEG 6 134 #define OPOR 7 135 #define OPAND 8 136 #define OPEQV 9 137 #define OPNEQV 10 138 #define OPNOT 11 139 #define OPCONCAT 12 140 #define OPLT 13 141 #define OPEQ 14 142 #define OPGT 15 143 #define OPLE 16 144 #define OPNE 17 145 #define OPGE 18 146 #define OPCALL 19 147 #define OPCCALL 20 148 #define OPASSIGN 21 149 #define OPPLUSEQ 22 150 #define OPSTAREQ 23 151 #define OPCONV 24 152 #define OPLSHIFT 25 153 #define OPMOD 26 154 #define OPCOMMA 27 155 #define OPQUEST 28 156 #define OPCOLON 29 157 #define OPABS 30 158 #define OPMIN 31 159 #define OPMAX 32 160 #define OPADDR 33 161 #define OPINDIRECT 34 162 #define OPBITOR 35 163 #define OPBITAND 36 164 #define OPBITXOR 37 165 #define OPBITNOT 38 166 #define OPRSHIFT 39 167 #define OPPAREN 40 168 #define OPUNARYPLUS 41 169 170 171 /* label type codes */ 172 173 #define LABUNKNOWN 0 174 #define LABEXEC 1 175 #define LABFORMAT 2 176 #define LABOTHER 3 177 178 179 /* INTRINSIC function codes*/ 180 181 #define INTREND 0 182 #define INTRCONV 1 183 #define INTRMIN 2 184 #define INTRMAX 3 185 #define INTRGEN 4 186 #define INTRSPEC 5 187 #define INTRBOOL 6 188 #define INTRCNST 7 189 190 191 /* I/O statement codes */ 192 193 #define IOSTDIN ICON(5) 194 #define IOSTDOUT ICON(6) 195 #define IOSTDERR ICON(0) 196 197 #define IOSBAD (-1) 198 #define IOSPOSITIONAL 0 199 #define IOSUNIT 1 200 #define IOSFMT 2 201 202 #define IOINQUIRE 1 203 #define IOOPEN 2 204 #define IOCLOSE 3 205 #define IOREWIND 4 206 #define IOBACKSPACE 5 207 #define IOENDFILE 6 208 #define IOREAD 7 209 #define IOWRITE 8 210 211 212 /* type masks */ 213 214 #define MSKLOGICAL M(TYLOGICAL) 215 #define MSKADDR M(TYADDR) 216 #define MSKCHAR M(TYCHAR) 217 #define MSKINT M(TYSHORT)|M(TYLONG) 218 #define MSKREAL M(TYREAL)|M(TYDREAL) 219 #define MSKCOMPLEX M(TYCOMPLEX)|M(TYDCOMPLEX) 220 #define MSKSTATIC (M(STGINIT)|M(STGBSS)|M(STGCOMMON)|M(STGEQUIV)|M(STGCONST)) 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->constblock.vtype)) 229 #define ISCHAR(z) (z->headblock.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->exprblock.opcode==OPPLUS) 234 #define ISSTAROP(z) (z->tag==TEXPR && z->exprblock.opcode==OPSTAR) 235 #define ISONE(z) (ISICON(z) && z->constblock.constant.ci==1) 236 #define INT(z) ONEOF(z, MSKINT|MSKCHAR) 237 #define ICON(z) mkintcon( (ftnint)(z) ) 238 239 #define NO66(s) if(no66flag) err66(s) 240 #define NOEXT(s) if(noextflag) errext(s) 241 242 /* round a up to a multiple of b */ 243 #define roundup(a,b) ( b * ( (a+b-1)/b) ) 244 245 246 /* optimization buffer slot types */ 247 248 #define SKNULL 0 249 #define SKIFN 1 250 #define SKGOTO 2 251 #define SKLABEL 3 252 #define SKEQ 4 253 #define SKCALL 5 254 #define SKCMGOTO 6 255 #define SKSTOP 7 256 #define SKDOHEAD 8 257 #define SKENDDO 9 258 #define SKARIF 10 259 #define SKRETURN 11 260 #define SKASGOTO 12 261 #define SKPAUSE 13 262 #define SKASSIGN 14 263 #define SKIOIFN 15 264 #define SKFRTEMP 16 265