|
|
1.1 root 1: /* @(#)mfile1 4.2 (Berkeley) 83/04/04 */
2:
3: # include "macdefs"
4: # include "manifest"
5:
6: /* storage classes */
7: # define SNULL 0
8: # define AUTO 1
9: # define EXTERN 2
10: # define STATIC 3
11: # define REGISTER 4
12: # define EXTDEF 5
13: # define LABEL 6
14: # define ULABEL 7
15: # define MOS 8
16: # define PARAM 9
17: # define STNAME 10
18: # define MOU 11
19: # define UNAME 12
20: # define TYPEDEF 13
21: # define FORTRAN 14
22: # define ENAME 15
23: # define MOE 16
24: # define UFORTRAN 17
25: # define USTATIC 18
26: /* field size is ORed in */
27: # define FIELD 0100
28: # define FLDSIZ 077
29: # ifndef BUG1
30: extern char *scnames();
31: # endif
32:
33: /* location counters */
34: # define PROG 0
35: # define DATA 1
36: # define ADATA 2
37: # define STRNG 3
38: # define ISTRNG 4
39: # define STAB 5
40:
41:
42: /* symbol table flags */
43: # define SMOS 01
44: # define SHIDDEN 02
45: # define SHIDES 04
46: # define SSET 010
47: # define SREF 020
48: # define SNONUNIQ 040
49: # define STAG 0100
50:
51: # ifndef FIXDEF
52: # define FIXDEF(p)
53: #endif
54: # ifndef FIXARG
55: # define FIXARG(p)
56: # endif
57: # ifndef FIXSTRUCT
58: # define FIXSTRUCT(a,b)
59: # endif
60:
61: /* alignment of initialized quantities */
62: # ifndef AL_INIT
63: # define AL_INIT ALINT
64: # endif
65:
66: struct symtab {
67: #ifndef FLEXNAMES
68: char sname[NCHNAM];
69: #else
70: char *sname;
71: #endif
72: TWORD stype; /* type word */
73:
74: char sclass; /* storage class */
75: char slevel; /* scope level */
76: char sflags; /* flags for set, use, hidden, mos, etc. */
77: int offset; /* offset or value */
78: short dimoff; /* offset into the dimension table */
79: short sizoff; /* offset into the size table */
80: short suse; /* line number of last use of the variable */
81: };
82:
83:
84: # ifdef ONEPASS
85: /* NOPREF must be defined for use in first pass tree machine */
86: # define NOPREF 020000 /* no preference for register assignment */
87: #else
88:
89: union ndu {
90: struct {
91: int op;
92: TWORD type;
93: int cdim, csiz;
94: }fn; /* front node */
95: struct {
96: int op;
97: TWORD type;
98: int cdim, csiz;
99: NODE *left;
100: NODE * right;
101: }in; /* interior node */
102:
103: struct {
104: /* this structure is the same as above,
105: but is used when a value, rather than
106: address, is kept in +left */
107: int op;
108: TWORD type;
109: int cdim, csiz;
110: CONSZ lval;
111: int rval;
112: }tn; /* terminal node */
113:
114: struct {
115: /* this structure is used when a floating point constant
116: is being computed */
117: int op;
118: TWORD type;
119: int cdim, csiz;
120: double dval;
121: }fpn; /* floating point node */
122:
123: };
124: # endif
125:
126: struct sw {
127: CONSZ sval;
128: int slab;
129: };
130:
131: extern struct sw swtab[];
132: extern struct sw *swp;
133: extern int swx;
134:
135: extern int ftnno;
136: extern int blevel;
137: extern int instruct, stwart;
138:
139: extern int lineno, nerrors;
140: typedef union {
141: int intval;
142: NODE * nodep;
143: } YYSTYPE;
144: extern YYSTYPE yylval;
145:
146: extern CONSZ lastcon;
147: extern double dcon;
148:
149: extern char ftitle[];
150: extern char ititle[];
151: extern struct symtab stab[];
152: extern int curftn;
153: extern int curclass;
154: extern int curdim;
155: extern int dimtab[];
156: extern int paramstk[];
157: extern int paramno;
158: extern int autooff, argoff, strucoff;
159: extern int regvar;
160: extern int minrvar;
161: extern int brkflag;
162: extern char yytext[];
163:
164: extern int strflg;
165:
166: extern OFFSZ inoff;
167:
168: extern int reached;
169:
170: /* tunnel to buildtree for name id's */
171:
172: extern int idname;
173:
174: extern NODE node[];
175: extern NODE *lastfree;
176:
177: extern int cflag, hflag, pflag;
178:
179: /* various labels */
180: extern int brklab;
181: extern int contlab;
182: extern int flostat;
183: extern int retlab;
184: extern int retstat;
185: extern int asavbc[], *psavbc;
186:
187: /* flags used in structures/unions */
188:
189: # define SEENAME 01
190: # define INSTRUCT 02
191: # define INUNION 04
192: # define FUNNYNAME 010
193: # define TAGNAME 020
194:
195: /* flags used in the (elementary) flow analysis ... */
196:
197: # define FBRK 02
198: # define FCONT 04
199: # define FDEF 010
200: # define FLOOP 020
201:
202: /* flags used for return status */
203:
204: # define RETVAL 1
205: # define NRETVAL 2
206:
207: /* used to mark a constant with no name field */
208:
209: # define NONAME 040000
210:
211: /* mark an offset which is undefined */
212:
213: # define NOOFFSET (-10201)
214:
215: /* declarations of various functions */
216:
217: extern NODE
218: *buildtree(),
219: *bdty(),
220: *mkty(),
221: *rstruct(),
222: *dclstruct(),
223: *getstr(),
224: *tymerge(),
225: *stref(),
226: *offcon(),
227: *bcon(),
228: *bpsize(),
229: *convert(),
230: *pconvert(),
231: *oconvert(),
232: *ptmatch(),
233: *tymatch(),
234: *makety(),
235: *block(),
236: *doszof(),
237: *talloc(),
238: *optim(),
239: *strargs(),
240: *clocal();
241:
242: OFFSZ tsize(),
243: psize();
244:
245: TWORD types();
246:
247:
248: double atof();
249:
250: char *exname(), *exdcon();
251:
252: # define checkst(x)
253:
254: # ifndef CHARCAST
255: /* to make character constants into character connstants */
256: /* this is a macro to defend against cross-compilers, etc. */
257: # define CHARCAST(x) (char)(x)
258: # endif
259:
260: # define BCSZ 100 /* size of the table to save break and continue labels */
261: # define SYMTSZ 3000 /* size of the symbol table (was 500) */
262: # define DIMTABSZ 4200 /* size of the dimension/size table (was 800) */
263: # define PARAMSZ 300 /* size of the parameter stack */
264: # define SWITSZ 500 /* size of switch table */
265: /* special interfaces for yacc alone */
266: /* These serve as abbreviations of 2 or more ops:
267: ASOP =, = ops
268: RELOP LE,LT,GE,GT
269: EQUOP EQ,NE
270: DIVOP DIV,MOD
271: SHIFTOP LS,RS
272: ICOP ICR,DECR
273: UNOP NOT,COMPL
274: STROP DOT,STREF
275:
276: */
277: # define ASOP 25
278: # define RELOP 26
279: # define EQUOP 27
280: # define DIVOP 28
281: # define SHIFTOP 29
282: # define INCOP 30
283: # define UNOP 31
284: # define STROP 32
285:
286: # define LP 50
287: # define RP 51
288: # define LC 52
289: # define RC 53
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.