1: /* pass1.h 4.2 85/08/22 */ 2: 3: #ifndef _PASS1_ 4: #define _PASS1_ 5: 6: #include "macdefs.h" 7: #include "manifest.h" 8: 9: /* 10: * Symbol table definition. 11: * 12: * Colliding entries are moved down with a standard 13: * probe (no quadratic rehash here) and moved back when 14: * entries are cleared. 15: */ 16: struct symtab { 17: #ifndef FLEXNAMES 18: char sname[NCHNAM]; 19: #else 20: char *sname; 21: #endif 22: struct symtab *snext; /* link to other symbols in the same scope */ 23: TWORD stype; /* type word */ 24: char sclass; /* storage class */ 25: char slevel; /* scope level */ 26: char sflags; /* flags, see below */ 27: OFFSZ offset; /* offset or value */ 28: short dimoff; /* offset into the dimension table */ 29: short sizoff; /* offset into the size table */ 30: int suse; /* line number of last use of the variable */ 31: }; 32: 33: /* 34: * Storage classes 35: */ 36: #define SNULL 0 /* initial value */ 37: #define AUTO 1 /* automatic (on stack) */ 38: #define EXTERN 2 /* external reference */ 39: #define STATIC 3 /* static scope */ 40: #define REGISTER 4 /* register requested */ 41: #define EXTDEF 5 /* external definition */ 42: #define LABEL 6 /* label definition */ 43: #define ULABEL 7 /* undefined label reference */ 44: #define MOS 8 /* member of structure */ 45: #define PARAM 9 /* parameter */ 46: #define STNAME 10 /* structure name */ 47: #define MOU 11 /* member of union */ 48: #define UNAME 12 /* union name */ 49: #define TYPEDEF 13 /* typedef name */ 50: #define FORTRAN 14 /* fortran function */ 51: #define ENAME 15 /* enumeration name */ 52: #define MOE 16 /* member of enumeration */ 53: #define UFORTRAN 17 /* undefined fortran reference */ 54: #define USTATIC 18 /* undefined static reference */ 55: 56: /* field size is ORed in */ 57: #define FIELD 0100 58: #define FLDSIZ 077 59: #ifndef BUG1 60: extern char *scnames(); 61: #endif 62: 63: /* 64: * Symbol table flags 65: */ 66: #define SMOS 01 /* member of structure */ 67: #define SHIDDEN 02 /* hidden in current scope */ 68: #define SHIDES 04 /* hides symbol in outer scope */ 69: #define SSET 010 /* symbol assigned to */ 70: #define SREF 020 /* symbol referenced */ 71: #define SNONUNIQ 040 /* non-unique structure member */ 72: #define STAG 0100 /* structure tag name */ 73: 74: /* 75: * Location counters 76: */ 77: #define PROG 0 /* program segment */ 78: #define DATA 1 /* data segment */ 79: #define ADATA 2 /* array data segment */ 80: #define STRNG 3 /* string data segment */ 81: #define ISTRNG 4 /* initialized string segment */ 82: #define STAB 5 /* symbol table segment */ 83: 84: 85: #ifndef ONEPASS 86: #include "ndu.h" 87: #endif 88: 89: 90: #ifndef FIXDEF 91: #define FIXDEF(p) 92: #endif 93: #ifndef FIXARG 94: #define FIXARG(p) 95: #endif 96: #ifndef FIXSTRUCT 97: #define FIXSTRUCT(a,b) 98: #endif 99: 100: /* alignment of initialized quantities */ 101: #ifndef AL_INIT 102: #define AL_INIT ALINT 103: #endif 104: 105: /* 106: * External definitions 107: */ 108: struct sw { /* switch table */ 109: CONSZ sval; /* case value */ 110: int slab; /* associated label */ 111: }; 112: extern struct sw swtab[]; 113: extern struct sw *swp; 114: extern int swx; 115: 116: extern int ftnno; 117: extern int blevel; 118: extern int instruct, stwart; 119: 120: extern int lineno, nerrors; 121: 122: extern CONSZ lastcon; 123: extern float fcon; 124: extern double dcon; 125: 126: extern char ftitle[]; 127: #ifndef LINT 128: extern char ititle[]; 129: #endif 130: extern struct symtab stab[]; 131: extern int curftn; 132: extern int curclass; 133: extern int curdim; 134: extern OFFSZ dimtab[]; 135: extern OFFSZ paramstk[]; 136: extern int paramno; 137: extern OFFSZ autooff, argoff, strucoff; 138: extern int regvar; 139: extern int minrvar; 140: extern int brkflag; 141: typedef union { 142: int intval; 143: NODE * nodep; 144: } YYSTYPE; 145: extern YYSTYPE yylval; 146: extern char yytext[]; 147: 148: extern int strflg; 149: 150: extern OFFSZ inoff; 151: 152: extern int reached; 153: 154: /* tunnel to buildtree for name id's */ 155: extern int idname; 156: 157: extern NODE node[]; 158: extern NODE *lastfree; 159: 160: extern int cflag, hflag, pflag; 161: 162: /* various labels */ 163: extern int brklab; 164: extern int contlab; 165: extern int flostat; 166: extern int retlab; 167: extern int retstat; 168: extern int asavbc[], *psavbc; 169: 170: /* declarations of various functions */ 171: extern NODE 172: *buildtree(), 173: *bdty(), 174: *mkty(), 175: *rstruct(), 176: *dclstruct(), 177: *getstr(), 178: *tymerge(), 179: *stref(), 180: *offcon(), 181: *bcon(), 182: *bpsize(), 183: *convert(), 184: *pconvert(), 185: *oconvert(), 186: *ptmatch(), 187: *tymatch(), 188: *makety(), 189: *block(), 190: *doszof(), 191: *talloc(), 192: *optim(), 193: *fixargs(), 194: *clocal(); 195: OFFSZ tsize(), 196: psize(); 197: TWORD types(); 198: double atof(); 199: char *exname(), *exdcon(); 200: 201: #define checkst(x) 202: 203: #ifndef CHARCAST 204: /* to make character constants into character connstants */ 205: /* this is a macro to defend against cross-compilers, etc. */ 206: #define CHARCAST(x) (char)(x) 207: #endif 208: #endif 209: 210: /* 211: * Flags used in structures/unions 212: */ 213: #define SEENAME 01 214: #define INSTRUCT 02 215: #define INUNION 04 216: #define FUNNYNAME 010 217: #define TAGNAME 020 218: 219: /* 220: * Flags used in the (elementary) flow analysis ... 221: */ 222: #define FBRK 02 223: #define FCONT 04 224: #define FDEF 010 225: #define FLOOP 020 226: 227: /* 228: * Flags used for return status 229: */ 230: #define RETVAL 1 231: #define NRETVAL 2 232: 233: #define NONAME 040000 /* marks constant w/o name field */ 234: #define NOOFFSET (-10201) /* mark an offset which is undefined */