1 /* manifest.h 4.1 85/03/19 */ 2 3 #ifndef _MANIFEST_ 4 #define _MANIFEST_ 5 6 #include <stdio.h> 7 #include "pcclocal.h" 8 #include "config.h" 9 10 #define DSIZE (MAXOP+1) /* DSIZE is the size of the dope array */ 11 12 #define NOLAB (-1) /* no label with constant */ 13 14 /* 15 * Node types 16 */ 17 #define LTYPE 02 /* leaf */ 18 #define UTYPE 04 /* unary */ 19 #define BITYPE 010 /* binary */ 20 21 /* 22 * Bogus type values 23 */ 24 #define TNULL PTR /* pointer to UNDEF */ 25 #define TVOID FTN /* function returning UNDEF (for void) */ 26 27 /* 28 * Type packing constants 29 */ 30 #define TMASK 060 /* mask for 1st component of compound type */ 31 #define TMASK1 0300 /* mask for 2nd component of compound type */ 32 #define TMASK2 0360 /* mask for 3rd component of compound type */ 33 #define BTMASK 017 /* basic type mask */ 34 #define BTSHIFT 4 /* basic type shift */ 35 #define TSHIFT 2 /* shift count to get next type component */ 36 37 /* 38 * Type manipulation macros 39 */ 40 #define MODTYPE(x,y) x = ((x)&(~BTMASK))|(y) /* set basic type of x to y */ 41 #define BTYPE(x) ((x)&BTMASK) /* basic type of x */ 42 #define ISUNSIGNED(x) ((x)<=ULONG&&(x)>=UCHAR) 43 #define UNSIGNABLE(x) ((x)<=LONG&&(x)>=CHAR) 44 #define ENUNSIGN(x) ((x)+(UNSIGNED-INT)) 45 #define DEUNSIGN(x) ((x)+(INT-UNSIGNED)) 46 #define ISPTR(x) (((x)&TMASK)==PTR) 47 #define ISFTN(x) (((x)&TMASK)==FTN) /* is x a function type */ 48 #define ISARY(x) (((x)&TMASK)==ARY) /* is x an array type */ 49 #define INCREF(x) ((((x)&~BTMASK)<<TSHIFT)|PTR|((x)&BTMASK)) 50 #define DECREF(x) ((((x)>>TSHIFT)&~BTMASK)|( (x)&BTMASK)) 51 /* advance x to a multiple of y */ 52 #define SETOFF(x,y) if ((x)%(y) != 0) (x) = (((x)/(y) + 1) * (y)) 53 /* can y bits be added to x without overflowing z */ 54 #define NOFIT(x,y,z) (((x)%(z) + (y)) > (z)) 55 56 /* 57 * Pack and unpack field descriptors (size and offset) 58 */ 59 #define PKFIELD(s,o) (((o)<<6)| (s)) 60 #define UPKFSZ(v) ((v) &077) 61 #define UPKFOFF(v) ((v)>>6) 62 63 /* 64 * Operator information 65 */ 66 #define TYFLG 016 67 #define ASGFLG 01 68 #define LOGFLG 020 69 70 #define SIMPFLG 040 71 #define COMMFLG 0100 72 #define DIVFLG 0200 73 #define FLOFLG 0400 74 #define LTYFLG 01000 75 #define CALLFLG 02000 76 #define MULFLG 04000 77 #define SHFFLG 010000 78 #define ASGOPFLG 020000 79 80 #define SPFLG 040000 81 82 #define optype(o) (dope[o]&TYFLG) 83 #define asgop(o) (dope[o]&ASGFLG) 84 #define logop(o) (dope[o]&LOGFLG) 85 #define callop(o) (dope[o]&CALLFLG) 86 87 /* 88 * External declarations, typedefs and the like 89 */ 90 #ifdef FLEXNAMES 91 char *hash(); 92 char *savestr(); 93 char *tstr(); 94 extern int tstrused; 95 extern char *tstrbuf[]; 96 extern char **curtstr; 97 #define freetstr() curtstr = tstrbuf, tstrused = 0 98 #endif 99 100 extern int nerrors; /* number of errors seen so far */ 101 extern int dope[]; /* a vector containing operator information */ 102 extern char *opst[]; /* a vector containing names for ops */ 103 104 typedef union ndu NODE; 105 typedef unsigned int TWORD; 106 #define NIL (NODE *)0 107 108 #ifndef ONEPASS 109 #ifndef EXPR 110 #define EXPR '.' 111 #endif 112 #ifndef BBEG 113 #define BBEG '[' 114 #endif 115 #ifndef BEND 116 #define BEND ']' 117 #endif 118 #else 119 #include "onepass.h" 120 #endif 121 #endif 122