1*32807Sdonn /* manifest.h 4.2 87/12/09 */ 218388Sralph 318388Sralph #ifndef _MANIFEST_ 418388Sralph #define _MANIFEST_ 518388Sralph 618388Sralph #include <stdio.h> 718388Sralph #include "pcclocal.h" 818388Sralph #include "config.h" 918388Sralph 1018388Sralph #define DSIZE (MAXOP+1) /* DSIZE is the size of the dope array */ 1118388Sralph 1218388Sralph #define NOLAB (-1) /* no label with constant */ 1318388Sralph 1418388Sralph /* 1518388Sralph * Node types 1618388Sralph */ 1718388Sralph #define LTYPE 02 /* leaf */ 1818388Sralph #define UTYPE 04 /* unary */ 1918388Sralph #define BITYPE 010 /* binary */ 2018388Sralph 2118388Sralph /* 2218388Sralph * Bogus type values 2318388Sralph */ 24*32807Sdonn #define TNULL INCREF(MOETY) /* pointer to MOETY -- impossible type */ 2518388Sralph #define TVOID FTN /* function returning UNDEF (for void) */ 2618388Sralph 2718388Sralph /* 2818388Sralph * Type packing constants 2918388Sralph */ 3018388Sralph #define TMASK 060 /* mask for 1st component of compound type */ 3118388Sralph #define TMASK1 0300 /* mask for 2nd component of compound type */ 3218388Sralph #define TMASK2 0360 /* mask for 3rd component of compound type */ 3318388Sralph #define BTMASK 017 /* basic type mask */ 3418388Sralph #define BTSHIFT 4 /* basic type shift */ 3518388Sralph #define TSHIFT 2 /* shift count to get next type component */ 3618388Sralph 3718388Sralph /* 3818388Sralph * Type manipulation macros 3918388Sralph */ 4018388Sralph #define MODTYPE(x,y) x = ((x)&(~BTMASK))|(y) /* set basic type of x to y */ 4118388Sralph #define BTYPE(x) ((x)&BTMASK) /* basic type of x */ 4218388Sralph #define ISUNSIGNED(x) ((x)<=ULONG&&(x)>=UCHAR) 4318388Sralph #define UNSIGNABLE(x) ((x)<=LONG&&(x)>=CHAR) 4418388Sralph #define ENUNSIGN(x) ((x)+(UNSIGNED-INT)) 4518388Sralph #define DEUNSIGN(x) ((x)+(INT-UNSIGNED)) 4618388Sralph #define ISPTR(x) (((x)&TMASK)==PTR) 4718388Sralph #define ISFTN(x) (((x)&TMASK)==FTN) /* is x a function type */ 4818388Sralph #define ISARY(x) (((x)&TMASK)==ARY) /* is x an array type */ 4918388Sralph #define INCREF(x) ((((x)&~BTMASK)<<TSHIFT)|PTR|((x)&BTMASK)) 5018388Sralph #define DECREF(x) ((((x)>>TSHIFT)&~BTMASK)|( (x)&BTMASK)) 5118388Sralph /* advance x to a multiple of y */ 5218388Sralph #define SETOFF(x,y) if ((x)%(y) != 0) (x) = (((x)/(y) + 1) * (y)) 5318388Sralph /* can y bits be added to x without overflowing z */ 5418388Sralph #define NOFIT(x,y,z) (((x)%(z) + (y)) > (z)) 5518388Sralph 5618388Sralph /* 5718388Sralph * Pack and unpack field descriptors (size and offset) 5818388Sralph */ 5918388Sralph #define PKFIELD(s,o) (((o)<<6)| (s)) 6018388Sralph #define UPKFSZ(v) ((v) &077) 6118388Sralph #define UPKFOFF(v) ((v)>>6) 6218388Sralph 6318388Sralph /* 6418388Sralph * Operator information 6518388Sralph */ 6618388Sralph #define TYFLG 016 6718388Sralph #define ASGFLG 01 6818388Sralph #define LOGFLG 020 6918388Sralph 7018388Sralph #define SIMPFLG 040 7118388Sralph #define COMMFLG 0100 7218388Sralph #define DIVFLG 0200 7318388Sralph #define FLOFLG 0400 7418388Sralph #define LTYFLG 01000 7518388Sralph #define CALLFLG 02000 7618388Sralph #define MULFLG 04000 7718388Sralph #define SHFFLG 010000 7818388Sralph #define ASGOPFLG 020000 7918388Sralph 8018388Sralph #define SPFLG 040000 8118388Sralph 8218388Sralph #define optype(o) (dope[o]&TYFLG) 8318388Sralph #define asgop(o) (dope[o]&ASGFLG) 8418388Sralph #define logop(o) (dope[o]&LOGFLG) 8518388Sralph #define callop(o) (dope[o]&CALLFLG) 8618388Sralph 8718388Sralph /* 8818388Sralph * External declarations, typedefs and the like 8918388Sralph */ 9018388Sralph #ifdef FLEXNAMES 9118388Sralph char *hash(); 9218388Sralph char *savestr(); 9318388Sralph char *tstr(); 9418388Sralph extern int tstrused; 9518388Sralph extern char *tstrbuf[]; 9618388Sralph extern char **curtstr; 9718388Sralph #define freetstr() curtstr = tstrbuf, tstrused = 0 9818388Sralph #endif 9918388Sralph 10018388Sralph extern int nerrors; /* number of errors seen so far */ 10118388Sralph extern int dope[]; /* a vector containing operator information */ 10218388Sralph extern char *opst[]; /* a vector containing names for ops */ 10318388Sralph 10418388Sralph typedef union ndu NODE; 10518388Sralph typedef unsigned int TWORD; 10618388Sralph #define NIL (NODE *)0 10718388Sralph 10818388Sralph #ifndef ONEPASS 10918388Sralph #ifndef EXPR 11018388Sralph #define EXPR '.' 11118388Sralph #endif 11218388Sralph #ifndef BBEG 11318388Sralph #define BBEG '[' 11418388Sralph #endif 11518388Sralph #ifndef BEND 11618388Sralph #define BEND ']' 11718388Sralph #endif 11818388Sralph #else 11918388Sralph #include "onepass.h" 12018388Sralph #endif 12118388Sralph #endif 122