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