|
|
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[ DIMTABSZ ];
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: extern NODE node[];
60:
61: int cflag = 0; /* do we check for funny casts */
62: int hflag = 0; /* do we check for various heuristics which may indicate errors */
63: int pflag = 0; /* do we check for portable constructions */
64:
65: int brklab;
66: int contlab;
67: #ifdef M32B
68: int swregno;
69: #endif
70: int flostat;
71: int retlab = NOLAB;
72: int retstat;
73:
74: /* save array for break, continue labels, and flostat */
75:
76: int asavbc[BCSZ];
77: int *psavbc = asavbc ;
78:
79: /* stack of scope chains */
80:
81: struct symtab *scopestack[MAXNEST];
82:
83: static char *ccnames[] =
84: {
85: /* names of storage classes */
86: "SNULL",
87: "AUTO",
88: "EXTERN",
89: "STATIC",
90: "REGISTER",
91: "EXTDEF",
92: "LABEL",
93: "ULABEL",
94: "MOS",
95: "PARAM",
96: "STNAME",
97: "MOU",
98: "UNAME",
99: "TYPEDEF",
100: "FORTRAN",
101: "ENAME",
102: "MOE",
103: "UFORTRAN",
104: "USTATIC",
105: };
106:
107: char *
108: scnames( c )
109: register c;
110: {
111: /* return the name for storage class c */
112: static char buf[12];
113: if( c&FIELD )
114: {
115: sprintf( buf, "FIELD[%d]", c&FLDSIZ );
116: return( buf );
117: }
118: return( ccnames[c] );
119: }
120:
121: #ifdef M32B
122: /* for register allocation optimizations */
123:
124: int fordepth; /* nest depth of 'for' loops */
125: int whdepth; /* nest depth of 'while' and 'do-while' loops */
126: int brdepth; /* nest depth of 'if', 'if-else', and 'switch' */
127: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.