|
|
1.1 root 1: /* @(#) xdefs.c: 1.2 1/12/84 */
2:
3: # include "mfile1.h"
4:
5: /* communication between lexical routines */
6:
7: int lineno; /* line number of the input file */
8:
9: CONSZ lastcon; /* the last constant read by the lexical analyzer */
10: double dcon; /* the last double read by the lexical analyzer */
11:
12:
13: /* symbol table maintainence */
14:
15: struct symtab stab[SYMTSZ+1]; /* one extra slot for scratch */
16:
17: int curftn; /* "current" function */
18: int strftn; /* 1 if current function returns struct or union */
19: int ftnno; /* "current" function number */
20: int curloc; /* current location counter value */
21:
22: int curclass, /* current storage class */
23: instruct, /* "in structure" flag */
24: stwart, /* for accessing names which are structure members or names */
25: blevel, /* block level: 0 for extern, 1 for ftn args, >=2 inside function */
26: curdim; /* current offset into the dimension table */
27:
28: int *dimtab;
29:
30: int paramstk[ PARAMSZ ]; /* holds symtab indices of function parameters */
31: int paramno; /* the number of parameters */
32: int argsoff[ ARGSZ ]; /* the offsets for the arguments */
33: int argno; /* the number of arguments */
34: int argstk[ ARGSZ ]; /* the symtab indices of arguments */
35: TWORD argty[ ARGSZ ]; /* the types of the arguments */
36: int autooff, /* the next unused automatic offset */
37: argoff, /* the next unused argument offset */
38: strucoff; /* the next structure offset position */
39: int regvar; /* the next free register for register variables */
40: int nextrvar; /* the next allocated reg (set by cisreg) */
41: OFFSZ inoff; /* offset of external element being initialized */
42: int brkflag = 0; /* complain about break statements not reached */
43:
44: struct sw swtab[SWITSZ]; /* table for cases within a switch */
45: struct sw *swp; /* pointer to next free entry in swtab */
46: int swx; /* index of beginning of cases for current switch */
47:
48: /* debugging flag */
49: int xdebug = 0;
50: int idebug = 0;
51:
52: int strflg; /* if on, strings are to be treated as lists */
53:
54: int reached; /* true if statement can be reached... */
55:
56: int idname; /* tunnel to buildtree for name id's */
57:
58:
59: int cflag = 0; /* do we check for funny casts */
60: int hflag = 0; /* do we check for various heuristics which may indicate errors */
61: int pflag = 0; /* do we check for portable constructions */
62: int gdebug; /* for pi/sdb */
63:
64: int brklab;
65: int contlab;
66: #ifdef M32B
67: int swregno;
68: #endif
69: int flostat;
70: int retlab = NOLAB;
71: int retstat;
72:
73: /* save array for break, continue labels, and flostat */
74:
75: int asavbc[BCSZ];
76: int *psavbc = asavbc ;
77:
78: /* stack of scope chains */
79:
80: struct symtab *scopestack[MAXNEST];
81:
82: static char *ccnames[] =
83: {
84: /* 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 *
107: scnames( c )
108: register c;
109: {
110: /* return the name for storage class c */
111: static char buf[12];
112: if( c&FIELD )
113: {
114: sprintf( buf, "FIELD[%d]", c&FLDSIZ );
115: return( buf );
116: }
117: return( ccnames[c] );
118: }
119:
120: #ifdef M32B
121: /* for register allocation optimizations */
122:
123: int fordepth; /* nest depth of 'for' loops */
124: int whdepth; /* nest depth of 'while' and 'do-while' loops */
125: int brdepth; /* nest depth of 'if', 'if-else', and 'switch' */
126: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.