1*47932Sbostic /*- 2*47932Sbostic * Copyright (c) 1991 The Regents of the University of California. 3*47932Sbostic * All rights reserved. 4*47932Sbostic * 5*47932Sbostic * %sccs.include.proprietary.c% 6*47932Sbostic * 7*47932Sbostic * @(#)defines.h 5.3 (Berkeley) 04/12/91 8*47932Sbostic */ 9*47932Sbostic 1044230Sbostic #define INTERDATA 2 1144230Sbostic #define GCOS 3 1244230Sbostic #define PDP11 4 1344230Sbostic #define IBM 5 1444230Sbostic #define CMACH 6 1544230Sbostic #define VAX 7 1644230Sbostic 1744230Sbostic #define DMR 2 1844230Sbostic #define PCC 3 1944230Sbostic 2044230Sbostic #ifndef FAMILY 2144230Sbostic FAMILY NOT DEFINED !!! 2244230Sbostic Family = FAMILY 2344230Sbostic #endif 2444230Sbostic 2544230Sbostic #ifndef HERE 2644230Sbostic HERE NOT DEFINED !!!! 2744230Sbostic Here = HERE 2844230Sbostic #endif 2944230Sbostic 3044230Sbostic #define M(x) (1<<x) 3144230Sbostic #define ALLOC(x) (struct x *) ckalloc(sizeof(struct x)) 3244230Sbostic #define ALLOCN(n,x) (struct x *) ckalloc(n*sizeof(struct x)) 3344230Sbostic #define ALLEXPR (expptr) ckalloc( sizeof(union Expression) ) 3444230Sbostic typedef int *ptr; 3544230Sbostic typedef char *charptr; 3644230Sbostic typedef FILE *FILEP; 3744230Sbostic typedef short flag; 3844230Sbostic typedef char field; /* actually need only 4 bits */ 3944230Sbostic typedef long int ftnint; 4044230Sbostic #define LOCAL static 4144230Sbostic 4244230Sbostic #define NO 0 4344230Sbostic #define YES 1 4444230Sbostic 4544230Sbostic #define CNULL (char *) 0 4644230Sbostic #define PNULL (ptr) 0 4744230Sbostic #define CHNULL (chainp) 0 4844230Sbostic #define ENULL (expptr) 0 4944230Sbostic 5044230Sbostic 5144230Sbostic 5244230Sbostic /* block tag values */ 5344230Sbostic 5444230Sbostic #define TNAME 1 5544230Sbostic #define TCONST 2 5644230Sbostic #define TEXPR 3 5744230Sbostic #define TADDR 4 5844230Sbostic #define TTEMP 5 5944230Sbostic #define TPRIM 6 6044230Sbostic #define TLIST 7 6144230Sbostic #define TIMPLDO 8 6244230Sbostic #define TERROR 9 6344230Sbostic 6444230Sbostic 6544230Sbostic /* parser states */ 6644230Sbostic 6744230Sbostic #define OUTSIDE 0 6844230Sbostic #define INSIDE 1 6944230Sbostic #define INDCL 2 7044230Sbostic #define INDATA 3 7144230Sbostic #define INEXEC 4 7244230Sbostic 7344230Sbostic /* procedure classes */ 7444230Sbostic 7544230Sbostic #define PROCMAIN 1 7644230Sbostic #define PROCBLOCK 2 7744230Sbostic #define PROCSUBR 3 7844230Sbostic #define PROCFUNCT 4 7944230Sbostic 8044230Sbostic 8144230Sbostic /* storage classes -- vstg values */ 8244230Sbostic 8344230Sbostic #define STGUNKNOWN 0 8444230Sbostic #define STGARG 1 8544230Sbostic #define STGAUTO 2 8644230Sbostic #define STGBSS 3 8744230Sbostic #define STGINIT 4 8844230Sbostic #define STGCONST 5 8944230Sbostic #define STGEXT 6 9044230Sbostic #define STGINTR 7 9144230Sbostic #define STGSTFUNCT 8 9244230Sbostic #define STGCOMMON 9 9344230Sbostic #define STGEQUIV 10 9444230Sbostic #define STGREG 11 9544230Sbostic #define STGLENG 12 9644230Sbostic #define STGNULL 13 9744230Sbostic #define STGPREG 14 9844230Sbostic 9944230Sbostic /* name classes -- vclass values */ 10044230Sbostic 10144230Sbostic #define CLUNKNOWN 0 10244230Sbostic #define CLPARAM 1 10344230Sbostic #define CLVAR 2 10444230Sbostic #define CLENTRY 3 10544230Sbostic #define CLMAIN 4 10644230Sbostic #define CLBLOCK 5 10744230Sbostic #define CLPROC 6 10844230Sbostic #define CLNAMELIST 7 10944230Sbostic 11044230Sbostic 11144230Sbostic /* vprocclass values */ 11244230Sbostic 11344230Sbostic #define PUNKNOWN 0 11444230Sbostic #define PEXTERNAL 1 11544230Sbostic #define PINTRINSIC 2 11644230Sbostic #define PSTFUNCT 3 11744230Sbostic #define PTHISPROC 4 11844230Sbostic 11944230Sbostic /* control stack codes */ 12044230Sbostic 12144230Sbostic #define CTLDO 1 12244230Sbostic #define CTLIF 2 12344230Sbostic #define CTLELSE 3 12444230Sbostic 12544230Sbostic 12644230Sbostic /* operators -- see also arrays 'ops' and 'ops2' in put.c */ 12744230Sbostic 12844230Sbostic #define OPPLUS 1 12944230Sbostic #define OPMINUS 2 13044230Sbostic #define OPSTAR 3 13144230Sbostic #define OPSLASH 4 13244230Sbostic #define OPPOWER 5 13344230Sbostic #define OPNEG 6 13444230Sbostic #define OPOR 7 13544230Sbostic #define OPAND 8 13644230Sbostic #define OPEQV 9 13744230Sbostic #define OPNEQV 10 13844230Sbostic #define OPNOT 11 13944230Sbostic #define OPCONCAT 12 14044230Sbostic #define OPLT 13 14144230Sbostic #define OPEQ 14 14244230Sbostic #define OPGT 15 14344230Sbostic #define OPLE 16 14444230Sbostic #define OPNE 17 14544230Sbostic #define OPGE 18 14644230Sbostic #define OPCALL 19 14744230Sbostic #define OPCCALL 20 14844230Sbostic #define OPASSIGN 21 14944230Sbostic #define OPPLUSEQ 22 15044230Sbostic #define OPSTAREQ 23 15144230Sbostic #define OPCONV 24 15244230Sbostic #define OPLSHIFT 25 15344230Sbostic #define OPMOD 26 15444230Sbostic #define OPCOMMA 27 15544230Sbostic #define OPQUEST 28 15644230Sbostic #define OPCOLON 29 15744230Sbostic #define OPABS 30 15844230Sbostic #define OPMIN 31 15944230Sbostic #define OPMAX 32 16044230Sbostic #define OPADDR 33 16144230Sbostic #define OPINDIRECT 34 16244230Sbostic #define OPBITOR 35 16344230Sbostic #define OPBITAND 36 16444230Sbostic #define OPBITXOR 37 16544230Sbostic #define OPBITNOT 38 16644230Sbostic #define OPRSHIFT 39 16744230Sbostic #define OPPAREN 40 16844230Sbostic #define OPUNARYPLUS 41 16944230Sbostic 17044230Sbostic 17144230Sbostic /* label type codes */ 17244230Sbostic 17344230Sbostic #define LABUNKNOWN 0 17444230Sbostic #define LABEXEC 1 17544230Sbostic #define LABFORMAT 2 17644230Sbostic #define LABOTHER 3 17744230Sbostic 17844230Sbostic 17944230Sbostic /* INTRINSIC function codes*/ 18044230Sbostic 18144230Sbostic #define INTREND 0 18244230Sbostic #define INTRCONV 1 18344230Sbostic #define INTRMIN 2 18444230Sbostic #define INTRMAX 3 18544230Sbostic #define INTRGEN 4 18644230Sbostic #define INTRSPEC 5 18744230Sbostic #define INTRBOOL 6 18844230Sbostic #define INTRCNST 7 18944230Sbostic 19044230Sbostic 19144230Sbostic /* I/O statement codes */ 19244230Sbostic 19344230Sbostic #define IOSTDIN ICON(5) 19444230Sbostic #define IOSTDOUT ICON(6) 19544230Sbostic #define IOSTDERR ICON(0) 19644230Sbostic 19744230Sbostic #define IOSBAD (-1) 19844230Sbostic #define IOSPOSITIONAL 0 19944230Sbostic #define IOSUNIT 1 20044230Sbostic #define IOSFMT 2 20144230Sbostic 20244230Sbostic #define IOINQUIRE 1 20344230Sbostic #define IOOPEN 2 20444230Sbostic #define IOCLOSE 3 20544230Sbostic #define IOREWIND 4 20644230Sbostic #define IOBACKSPACE 5 20744230Sbostic #define IOENDFILE 6 20844230Sbostic #define IOREAD 7 20944230Sbostic #define IOWRITE 8 21044230Sbostic 21144230Sbostic 21244230Sbostic /* type masks */ 21344230Sbostic 21444230Sbostic #define MSKLOGICAL M(TYLOGICAL) 21544230Sbostic #define MSKADDR M(TYADDR) 21644230Sbostic #define MSKCHAR M(TYCHAR) 21744230Sbostic #define MSKINT M(TYSHORT)|M(TYLONG) 21844230Sbostic #define MSKREAL M(TYREAL)|M(TYDREAL) 21944230Sbostic #define MSKCOMPLEX M(TYCOMPLEX)|M(TYDCOMPLEX) 22044230Sbostic #define MSKSTATIC (M(STGINIT)|M(STGBSS)|M(STGCOMMON)|M(STGEQUIV)|M(STGCONST)) 22144230Sbostic 22244230Sbostic /* miscellaneous macros */ 22344230Sbostic 22444230Sbostic #define ONEOF(x,y) (M(x) & (y)) 22544230Sbostic #define ISCOMPLEX(z) ONEOF(z, MSKCOMPLEX) 22644230Sbostic #define ISREAL(z) ONEOF(z, MSKREAL) 22744230Sbostic #define ISNUMERIC(z) ONEOF(z, MSKINT|MSKREAL|MSKCOMPLEX) 22844230Sbostic #define ISICON(z) (z->tag==TCONST && ISINT(z->constblock.vtype)) 22944230Sbostic #define ISCHAR(z) (z->headblock.vtype==TYCHAR) 23044230Sbostic #define ISINT(z) ONEOF(z, MSKINT) 23144230Sbostic #define ISCONST(z) (z->tag==TCONST) 23244230Sbostic #define ISERROR(z) (z->tag==TERROR) 23344230Sbostic #define ISPLUSOP(z) (z->tag==TEXPR && z->exprblock.opcode==OPPLUS) 23444230Sbostic #define ISSTAROP(z) (z->tag==TEXPR && z->exprblock.opcode==OPSTAR) 23547714Sbostic #define ISONE(z) (ISICON(z) && z->constblock.constant.ci==1) 23644230Sbostic #define INT(z) ONEOF(z, MSKINT|MSKCHAR) 23744230Sbostic #define ICON(z) mkintcon( (ftnint)(z) ) 23844230Sbostic 23944230Sbostic #define NO66(s) if(no66flag) err66(s) 24044230Sbostic #define NOEXT(s) if(noextflag) errext(s) 24144230Sbostic 24244230Sbostic /* round a up to a multiple of b */ 24344230Sbostic #define roundup(a,b) ( b * ( (a+b-1)/b) ) 24444230Sbostic 24544230Sbostic 24644230Sbostic /* optimization buffer slot types */ 24744230Sbostic 24844230Sbostic #define SKNULL 0 24944230Sbostic #define SKIFN 1 25044230Sbostic #define SKGOTO 2 25144230Sbostic #define SKLABEL 3 25244230Sbostic #define SKEQ 4 25344230Sbostic #define SKCALL 5 25444230Sbostic #define SKCMGOTO 6 25544230Sbostic #define SKSTOP 7 25644230Sbostic #define SKDOHEAD 8 25744230Sbostic #define SKENDDO 9 25844230Sbostic #define SKARIF 10 25944230Sbostic #define SKRETURN 11 26044230Sbostic #define SKASGOTO 12 26144230Sbostic #define SKPAUSE 13 26244230Sbostic #define SKASSIGN 14 26344230Sbostic #define SKIOIFN 15 26444230Sbostic #define SKFRTEMP 16 265