1: /*
2: * @(#)dextern 4.2 (Berkeley) 3/21/86
3: */
4: # include <stdio.h>
5: # include <ctype.h>
6: # include "files"
7:
8: /* MANIFEST CONSTANT DEFINITIONS */
9:
10: /* base of nonterminal internal numbers */
11: # define NTBASE 010000
12:
13: /* internal codes for error and accept actions */
14:
15: # define ERRCODE 8190
16: # define ACCEPTCODE 8191
17:
18: /* sizes and limits */
19:
20: # ifdef HUGE
21: # define ACTSIZE 12000
22: # define MEMSIZE 24000
23: # define NSTATES 750
24: # define NTERMS 300
25: # define NPROD 600
26: # define NNONTERM 300
27: # define TEMPSIZE 1200
28: # define CNAMSZ 5000
29: # define LSETSIZE 600
30: # define WSETSIZE 350
31: # endif
32:
33: # ifdef MEDIUM
34: # define ACTSIZE 4000
35: # define MEMSIZE 5200
36: # define NSTATES 600
37: # define NTERMS 127
38: # define NPROD 400
39: # define NNONTERM 200
40: # define TEMPSIZE 800
41: # define CNAMSZ 4000
42: # define LSETSIZE 450
43: # define WSETSIZE 250
44: # endif
45:
46: # define NAMESIZE 50
47: # define NTYPES 63
48:
49: # ifdef WORD32
50: # define TBITSET ((32+NTERMS)/32)
51:
52: /* bit packing macros (may be machine dependent) */
53: # define BIT(a,i) ((a)[(i)>>5] & (1<<((i)&037)))
54: # define SETBIT(a,i) ((a)[(i)>>5] |= (1<<((i)&037)))
55:
56: /* number of words needed to hold n+1 bits */
57: # define NWORDS(n) (((n)+32)/32)
58:
59: # else
60:
61: # define TBITSET ((16+NTERMS)/16)
62:
63: /* bit packing macros (may be machine dependent) */
64: # define BIT(a,i) ((a)[(i)>>4] & (1<<((i)&017)))
65: # define SETBIT(a,i) ((a)[(i)>>4] |= (1<<((i)&017)))
66:
67: /* number of words needed to hold n+1 bits */
68: # define NWORDS(n) (((n)+16)/16)
69: # endif
70:
71: /* relationships which must hold:
72: TBITSET ints must hold NTERMS+1 bits...
73: WSETSIZE >= NNONTERM
74: LSETSIZE >= NNONTERM
75: TEMPSIZE >= NTERMS + NNONTERMs + 1
76: TEMPSIZE >= NSTATES
77: */
78:
79: /* associativities */
80:
81: # define NOASC 0 /* no assoc. */
82: # define LASC 1 /* left assoc. */
83: # define RASC 2 /* right assoc. */
84: # define BASC 3 /* binary assoc. */
85:
86: /* flags for state generation */
87:
88: # define DONE 0
89: # define MUSTDO 1
90: # define MUSTLOOKAHEAD 2
91:
92: /* flags for a rule having an action, and being reduced */
93:
94: # define ACTFLAG 04
95: # define REDFLAG 010
96:
97: /* output parser flags */
98: # define YYFLAG1 (-1000)
99:
100: /* macros for getting associativity and precedence levels */
101:
102: # define ASSOC(i) ((i)&03)
103: # define PLEVEL(i) (((i)>>4)&077)
104: # define TYPE(i) ((i>>10)&077)
105:
106: /* macros for setting associativity and precedence levels */
107:
108: # define SETASC(i,j) i|=j
109: # define SETPLEV(i,j) i |= (j<<4)
110: # define SETTYPE(i,j) i |= (j<<10)
111:
112: /* looping macros */
113:
114: # define TLOOP(i) for(i=1;i<=ntokens;++i)
115: # define NTLOOP(i) for(i=0;i<=nnonter;++i)
116: # define PLOOP(s,i) for(i=s;i<nprod;++i)
117: # define SLOOP(i) for(i=0;i<nstate;++i)
118: # define WSBUMP(x) ++x
119: # define WSLOOP(s,j) for(j=s;j<cwp;++j)
120: # define ITMLOOP(i,p,q) q=pstate[i+1];for(p=pstate[i];p<q;++p)
121: # define SETLOOP(i) for(i=0;i<tbitset;++i)
122:
123: /* I/O descriptors */
124:
125: extern FILE * finput; /* input file */
126: extern FILE * faction; /* file for saving actions */
127: extern FILE *fdefine; /* file for # defines */
128: extern FILE * ftable; /* y.tab.c file */
129: extern FILE * ftemp; /* tempfile to pass 2 */
130: extern FILE * foutput; /* y.output file */
131:
132: /* structure declarations */
133:
134: struct looksets {
135: int lset[TBITSET];
136: };
137:
138: struct item {
139: int *pitem;
140: struct looksets *look;
141: };
142:
143: struct toksymb {
144: char *name;
145: int value;
146: };
147:
148: struct ntsymb {
149: char *name;
150: int tvalue;
151: };
152:
153: struct wset {
154: int *pitem;
155: int flag;
156: struct looksets ws;
157: };
158:
159: /* token information */
160:
161: extern int ntokens ; /* number of tokens */
162: extern struct toksymb tokset[];
163: extern int toklev[]; /* vector with the precedence of the terminals */
164:
165: /* nonterminal information */
166:
167: extern int nnonter ; /* the number of nonterminals */
168: extern struct ntsymb nontrst[];
169:
170: /* grammar rule information */
171:
172: extern int nprod ; /* number of productions */
173: extern int *prdptr[]; /* pointers to descriptions of productions */
174: extern int levprd[] ; /* contains production levels to break conflicts */
175:
176: /* state information */
177:
178: extern int nstate ; /* number of states */
179: extern struct item *pstate[]; /* pointers to the descriptions of the states */
180: extern int tystate[]; /* contains type information about the states */
181: extern int defact[]; /* the default action of the state */
182: extern int tstates[]; /* the states deriving each token */
183: extern int ntstates[]; /* the states deriving each nonterminal */
184: extern int mstates[]; /* the continuation of the chains begun in tstates and ntstates */
185:
186: /* lookahead set information */
187:
188: extern struct looksets lkst[];
189: extern int nolook; /* flag to turn off lookahead computations */
190:
191: /* working set information */
192:
193: extern struct wset wsets[];
194: extern struct wset *cwp;
195:
196: /* storage for productions */
197:
198: extern int mem0[];
199: extern int *mem;
200:
201: /* storage for action table */
202:
203: extern int amem[]; /* action table storage */
204: extern int *memp ; /* next free action table position */
205: extern int indgo[]; /* index to the stored goto table */
206:
207: /* temporary vector, indexable by states, terms, or ntokens */
208:
209: extern int temp1[];
210: extern int lineno; /* current line number */
211:
212: /* statistics collection variables */
213:
214: extern int zzgoent ;
215: extern int zzgobest ;
216: extern int zzacent ;
217: extern int zzexcp ;
218: extern int zzclose ;
219: extern int zzrrconf ;
220: extern int zzsrconf ;
221: /* define functions with strange types... */
222:
223: extern char *cstash();
224: extern struct looksets *flset();
225: extern char *symnam();
226: extern char *writem();
227:
228: /* default settings for a number of macros */
229:
230: /* name of yacc tempfiles */
231:
232: # ifndef TEMPNAME
233: # define TEMPNAME "yacc.tmp"
234: # endif
235:
236: # ifndef ACTNAME
237: # define ACTNAME "yacc.acts"
238: # endif
239:
240: /* output file name */
241:
242: # ifndef OFILE
243: # define OFILE "y.tab.c"
244: # endif
245:
246: /* user output file name */
247:
248: # ifndef FILEU
249: # define FILEU "y.output"
250: # endif
251:
252: /* output file for # defines */
253:
254: # ifndef FILED
255: # define FILED "y.tab.h"
256: # endif
257:
258: /* command to clobber tempfiles after use */
259:
260: # ifndef ZAPFILE
261: # define ZAPFILE(x) unlink(x)
262: # endif
Defined struct's
item
defined in line
138; used 18 times
wset
defined in line
153; used 18 times
Defined macros
BASC
defined in line
84;
never used
BIT
defined in line
64; used 2 times
DONE
defined in line
88; used 1 times
LASC
defined in line
82; used 1 times
NOASC
defined in line
81;
never used
NPROD
defined in line
38; used 8 times
NTBASE
defined in line
11; used 55 times
- in /usr/src/usr.bin/yacc/y1.c line
128,
150(2),
247,
277-281(2),
294,
335(2),
366-368(3),
412-417(4),
448-451(4),
509-513(2),
561,
576-582(3),
590
- in /usr/src/usr.bin/yacc/y2.c line
155,
164-169(3),
274,
297,
309,
318(2),
371-378(4),
417,
633-635(4),
651
- in /usr/src/usr.bin/yacc/y3.c line
27,
33(2),
195-197(2),
220-221(2),
370,
410
RASC
defined in line
83; used 1 times
TYPE
defined in line
104; used 4 times
Usage of this include