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