1: #if !defined(lint) && defined(DOSCCS) 2: static char *sccsid ="@(#)xdefs.c 4.3 (Berkeley) 3/19/85"; 3: #endif lint 4: 5: # include "pass1.h" 6: 7: /* communication between lexical routines */ 8: 9: char ftitle[100]; /* title of the file */ 10: #ifndef LINT 11: char ititle[100]; /* title of initial file */ 12: #endif 13: int lineno; /* line number of the input file */ 14: 15: CONSZ lastcon; /* the last constant read by the lexical analyzer */ 16: float fcon; /* the last float read by the lexical analyzer */ 17: double dcon; /* the last double read by the lexical analyzer */ 18: 19: 20: /* symbol table maintainence */ 21: 22: struct symtab stab[SYMTSZ+1]; /* one extra slot for scratch */ 23: 24: int curftn; /* "current" function */ 25: int ftnno; /* "current" function number */ 26: 27: int curclass, /* current storage class */ 28: instruct, /* "in structure" flag */ 29: stwart, /* for accessing names which are structure members or names */ 30: blevel, /* block level: 0 for extern, 1 for ftn args, >=2 inside function */ 31: curdim; /* current offset into the dimension table */ 32: 33: OFFSZ dimtab[ DIMTABSZ ]; /* same comments as below. bit addressing 34: * everything forces this to be large. 35: */ 36: 37: OFFSZ paramstk[ PARAMSZ ]; /* used in definition of function parameters */ 38: /* ordinarily 'int' would be enough, but the 39: * "bit address" in 'strucoff' (for structures 40: * over 4kb) needs a 'long' *sigh* 41: */ 42: int paramno; /* the number of parameters */ 43: OFFSZ autooff, /* the next unused automatic offset */ 44: argoff, /* the next unused argument offset */ 45: strucoff; /* the next structure offset position */ 46: int regvar; /* the next free register for register variables */ 47: int minrvar; /* the smallest that regvar gets witing a function */ 48: OFFSZ inoff; /* offset of external element being initialized */ 49: int brkflag = 0; /* complain about break statements not reached */ 50: 51: struct sw swtab[SWITSZ]; /* table for cases within a switch */ 52: struct sw *swp; /* pointer to next free entry in swtab */ 53: int swx; /* index of beginning of cases for current switch */ 54: 55: /* debugging flag */ 56: int xdebug = 0; 57: 58: int strflg; /* if on, strings are to be treated as lists */ 59: 60: int reached; /* true if statement can be reached... */ 61: 62: int idname; /* tunnel to buildtree for name id's */ 63: 64: 65: NODE node[TREESZ]; 66: 67: int cflag = 0; /* do we check for funny casts */ 68: int hflag = 0; /* do we check for various heuristics which may indicate errors */ 69: int pflag = 0; /* do we check for portable constructions */ 70: 71: int brklab; 72: int contlab; 73: int flostat; 74: int retlab = NOLAB; 75: int retstat; 76: 77: /* save array for break, continue labels, and flostat */ 78: 79: int asavbc[BCSZ]; 80: int *psavbc = asavbc ; 81: 82: # ifndef BUG1 83: static char * 84: ccnames[] = { /* names of storage classes */ 85: "SNULL", 86: "AUTO", 87: "EXTERN", 88: "STATIC", 89: "REGISTER", 90: "EXTDEF", 91: "LABEL", 92: "ULABEL", 93: "MOS", 94: "PARAM", 95: "STNAME", 96: "MOU", 97: "UNAME", 98: "TYPEDEF", 99: "FORTRAN", 100: "ENAME", 101: "MOE", 102: "UFORTRAN", 103: "USTATIC", 104: }; 105: 106: char * scnames( c ) register c; { 107: /* return the name for storage class c */ 108: static char buf[12]; 109: if( c&FIELD ){ 110: sprintf( buf, "FIELD[%d]", c&FLDSIZ ); 111: return( buf ); 112: } 113: return( ccnames[c] ); 114: } 115: # endif