2
static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93 (BSDI)";
10
#define yyclearin (yychar=YYEMPTY)
11
#define yyerrok (yyerrflag=0)
12
#define YYRECOVERING (yyerrflag!=0)
21
#define YYMAXDEPTH 150
23
extern int yylex ARGS((void));
25
/* declaration specifier attributes for the typedef statement currently being
28
static int cur_decl_spec_flags;
30
/* pointer to parameter list for the current function definition */
31
static ParameterList *func_params;
33
/* A parser semantic action sets this pointer to the current declarator in
34
* a function parameter declaration in order to catch any comments following
35
* the parameter declaration on the same line. If the lexer scans a comment
36
* and <cur_declarator> is not NULL, then the comment is attached to the
37
* declarator. To ignore subsequent comments, the lexer sets this to NULL
38
* after scanning a comment or end of line.
40
static Declarator *cur_declarator;
42
/* temporary string buffer */
43
static char buf[MAX_TEXT_SIZE];
45
/* table of typedef names */
46
static SymbolTable *typedef_names;
48
/* table of define names */
49
static SymbolTable *define_names;
51
/* table of type qualifiers */
52
static SymbolTable *type_qualifiers;
54
/* information about the current input file */
56
char *base_name; /* base input file name */
57
char *file_name; /* current file name */
58
FILE *file; /* input file */
59
unsigned line_num; /* current line number in input file */
60
FILE *tmp_file; /* temporary file */
61
long begin_comment; /* tmp file offset after last written ) or ; */
62
long end_comment; /* tmp file offset after last comment */
63
boolean convert; /* if TRUE, convert function definitions */
64
boolean changed; /* TRUE if conversion done in this file */
67
static IncludeStack *cur_file; /* current input file */
71
static int haveAnsiParam ARGS((void));
74
/* Flags to enable us to find if a procedure returns a value.
76
static int return_val, /* nonzero on BRACES iff return-expression found */
77
returned_at; /* marker for token-number to set 'return_val' */
80
static char *dft_decl_spec ARGS((void));
85
return (lintLibrary() && !return_val) ? "void" : "int";
89
#define dft_decl_spec() "int"
96
if (func_params != 0) {
97
for (p = func_params->first; p != 0; p = p->next) {
98
if (p->declarator->func_def == FUNC_ANSI) {
106
#define T_IDENTIFIER 257
107
#define T_TYPEDEF_NAME 258
108
#define T_DEFINE_NAME 259
111
#define T_REGISTER 262
113
#define T_TYPEDEF 264
123
#define T_UNSIGNED 274
127
#define T_TYPE_QUALIFIER 278
128
#define T_BRACKETS 279
130
#define T_MATCHRBRACE 281
131
#define T_ELLIPSIS 282
132
#define T_INITIALIZER 283
133
#define T_STRING_LITERAL 284
137
#define YYERRCODE 256
138
short yylhs[] = { -1,
139
0, 0, 26, 26, 27, 27, 27, 27, 27, 27,
140
27, 31, 30, 30, 28, 28, 34, 28, 32, 33,
141
33, 35, 35, 37, 38, 29, 39, 29, 36, 36,
142
36, 40, 40, 1, 1, 2, 2, 2, 3, 3,
143
3, 3, 3, 4, 4, 4, 4, 4, 4, 4,
144
4, 4, 4, 4, 4, 5, 5, 6, 6, 6,
145
19, 19, 8, 8, 9, 41, 9, 7, 7, 7,
146
25, 23, 23, 10, 10, 11, 11, 11, 11, 11,
147
20, 20, 21, 21, 22, 22, 14, 14, 15, 15,
148
16, 16, 16, 17, 17, 18, 18, 24, 24, 12,
149
12, 12, 13, 13, 13, 13, 13, 13, 13,
152
0, 1, 1, 2, 1, 1, 1, 1, 3, 2,
153
2, 2, 3, 3, 2, 3, 0, 5, 1, 0,
154
1, 1, 3, 0, 0, 7, 0, 5, 0, 1,
155
1, 1, 2, 1, 2, 1, 1, 1, 1, 1,
156
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
157
1, 1, 1, 1, 1, 1, 1, 3, 2, 2,
158
1, 1, 1, 3, 1, 0, 4, 3, 2, 2,
159
1, 1, 1, 2, 1, 1, 3, 2, 4, 4,
160
2, 3, 0, 1, 1, 2, 1, 3, 1, 3,
161
2, 2, 1, 0, 1, 1, 3, 1, 2, 1,
162
2, 1, 3, 2, 1, 4, 3, 3, 2,
164
short yydefred[] = { 0,
165
0, 0, 0, 0, 98, 53, 57, 39, 0, 41,
166
42, 19, 43, 44, 45, 46, 47, 52, 48, 49,
167
50, 51, 71, 61, 62, 56, 0, 7, 0, 0,
168
34, 36, 37, 38, 54, 55, 27, 0, 0, 0,
169
76, 0, 0, 3, 5, 6, 8, 0, 10, 11,
170
0, 85, 0, 0, 99, 0, 0, 40, 15, 35,
171
0, 63, 0, 0, 0, 78, 72, 73, 0, 0,
172
59, 0, 0, 69, 4, 0, 77, 82, 86, 0,
173
14, 13, 9, 16, 0, 66, 0, 30, 32, 0,
174
0, 96, 0, 0, 0, 89, 0, 0, 12, 58,
175
68, 0, 0, 64, 0, 0, 0, 33, 0, 105,
176
91, 92, 0, 0, 79, 0, 80, 0, 22, 0,
177
0, 67, 25, 28, 109, 0, 0, 0, 104, 0,
178
88, 90, 97, 18, 0, 0, 103, 108, 107, 0,
181
short yydgoto[] = { 29,
182
80, 31, 32, 33, 34, 35, 36, 61, 62, 37,
183
38, 112, 113, 94, 95, 96, 97, 98, 39, 40,
184
53, 54, 70, 41, 42, 43, 44, 45, 46, 47,
185
71, 48, 120, 102, 121, 90, 87, 136, 64, 91,
188
short yysindex[] = { -38,
189
-36, 17, -248, -241, 0, 0, 0, 0, -264, 0,
190
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
191
0, 0, 0, 0, 0, 0, -261, 0, 0, 395,
192
0, 0, 0, 0, 0, 0, 0, -37, -245, -11,
193
0, -245, -38, 0, 0, 0, 0, 438, 0, 0,
194
-15, 0, -5, -248, 0, 327, -27, 0, 0, 0,
195
-16, 0, -22, 279, 351, 0, 0, 0, -239, -234,
196
0, -37, -234, 0, 0, 438, 0, 0, 0, 395,
197
0, 0, 0, 0, 17, 0, 279, 0, 0, -232,
198
372, 0, 150, 24, 27, 0, 33, 32, 0, 0,
199
0, 17, -22, 0, -206, -202, -199, 0, 127, 0,
200
0, 0, -35, 203, 0, 302, 0, -174, 0, 28,
201
44, 0, 0, 0, 0, 48, 49, 258, 0, -35,
202
0, 0, 0, 0, 17, -189, 0, 0, 0, 52,
205
short yyrindex[] = { 95,
206
0, 0, 157, 0, 0, 0, 0, 0, 417, 0,
207
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
208
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
209
0, 0, 0, 0, 0, 0, 0, -10, 0, 0,
210
0, 0, 96, 0, 0, 0, 0, 0, 0, 0,
211
0, 0, 231, 173, 0, 0, 0, 0, 0, 0,
212
0, 0, 50, -183, 57, 0, 0, 0, 0, 81,
213
0, 20, 104, 0, 0, 16, 0, 0, 0, 0,
214
0, 0, 0, 0, 0, 0, -183, 0, 0, 0,
215
-180, 0, -26, 0, 60, 0, 0, 61, 0, 0,
216
0, 45, 1, 0, 0, 0, 0, 0, 0, 0,
217
0, 0, 9, 25, 0, 0, 0, 0, 0, 0,
218
46, 0, 0, 0, 0, 0, 0, 0, 0, 29,
219
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
222
short yygindex[] = { 0,
223
19, -8, 0, 0, -2, 0, 0, 0, 18, 6,
224
-34, -3, -7, -95, 0, -6, 0, 0, 0, -46,
225
0, 0, 69, 0, 0, 0, 70, -47, 0, 0,
226
-32, 0, 0, 0, 0, 30, 0, 0, 0, 0,
229
#define YYTABLESIZE 716
230
short yytable[] = { 4,
231
52, 2, 65, 3, 128, 72, 78, 51, 81, 74,
232
7, 67, 68, 127, 93, 55, 89, 93, 30, 56,
233
28, 60, 50, 82, 57, 77, 4, 85, 2, 26,
234
75, 83, 140, 75, 69, 63, 3, 100, 86, 89,
235
101, 99, 84, 108, 65, 69, 114, 107, 75, 102,
236
75, 79, 102, 17, 4, 17, 2, 17, 3, 65,
237
74, 30, 114, 74, 115, 100, 76, 60, 100, 101,
238
116, 60, 101, 117, 17, 118, 122, 123, 74, 72,
239
74, 124, 133, 93, 60, 103, 134, 135, 137, 138,
240
103, 142, 143, 65, 1, 2, 29, 94, 111, 31,
241
87, 95, 104, 20, 21, 126, 130, 119, 65, 132,
242
73, 0, 75, 0, 51, 0, 106, 0, 60, 0,
243
60, 60, 60, 0, 60, 0, 0, 93, 0, 0,
244
0, 0, 0, 0, 93, 0, 0, 0, 0, 60,
245
141, 70, 0, 70, 70, 70, 93, 70, 0, 0,
246
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
247
0, 0, 70, 0, 4, 0, 109, 125, 3, 0,
248
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
249
0, 0, 0, 0, 0, 0, 0, 4, 0, 109,
250
0, 3, 0, 0, 83, 0, 83, 83, 83, 0,
251
83, 0, 0, 0, 0, 0, 0, 0, 0, 0,
252
84, 0, 84, 84, 84, 0, 84, 1, 5, 6,
253
7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
254
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
255
4, 66, 109, 129, 49, 5, 27, 75, 75, 75,
256
75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
257
75, 75, 75, 75, 75, 75, 75, 75, 81, 75,
258
81, 81, 17, 5, 81, 0, 75, 74, 74, 74,
259
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
260
74, 74, 74, 74, 74, 74, 74, 74, 139, 74,
261
0, 0, 0, 0, 0, 0, 74, 24, 24, 24,
262
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
263
24, 24, 24, 24, 24, 24, 24, 24, 0, 24,
264
0, 0, 0, 0, 0, 0, 24, 60, 60, 60,
265
60, 60, 60, 60, 0, 60, 60, 60, 60, 60,
266
60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
267
70, 70, 70, 70, 70, 70, 70, 0, 70, 70,
268
70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
269
70, 70, 70, 5, 6, 7, 8, 58, 10, 11,
270
0, 13, 14, 15, 16, 17, 18, 19, 20, 21,
271
22, 23, 24, 25, 26, 110, 5, 6, 7, 8,
272
58, 10, 11, 83, 13, 14, 15, 16, 17, 18,
273
19, 20, 21, 22, 23, 24, 25, 26, 110, 84,
274
0, 0, 4, 0, 2, 83, 3, 0, 0, 0,
275
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
276
0, 84, 0, 59, 40, 0, 40, 0, 40, 5,
277
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
278
0, 0, 0, 0, 0, 40, 0, 0, 0, 0,
279
0, 110, 0, 0, 0, 0, 0, 81, 0, 0,
280
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
281
0, 0, 0, 0, 0, 0, 0, 0, 0, 81,
282
0, 0, 0, 0, 0, 6, 7, 8, 58, 10,
283
11, 0, 13, 14, 15, 16, 17, 18, 19, 20,
284
21, 22, 23, 24, 25, 26, 6, 7, 8, 58,
285
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
286
20, 21, 22, 23, 24, 25, 26, 0, 0, 6,
287
7, 8, 58, 10, 11, 88, 13, 14, 15, 16,
288
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
289
0, 0, 0, 131, 6, 7, 8, 58, 10, 11,
290
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
291
22, 23, 24, 25, 26, 0, 69, 92, 6, 7,
292
8, 58, 10, 11, 0, 13, 14, 15, 16, 17,
293
18, 19, 20, 21, 22, 23, 24, 25, 26, 6,
294
7, 8, 58, 10, 11, 12, 13, 14, 15, 16,
295
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
296
0, 5, 6, 7, 8, 58, 10, 11, 0, 13,
297
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
298
24, 25, 26, 40, 40, 40, 40, 40, 40, 40,
299
0, 40, 40, 40, 40, 40, 40, 40, 40, 40,
300
40, 40, 40, 40, 40, 6, 7, 8, 58, 10,
301
11, 0, 13, 14, 15, 16, 17, 18, 19, 20,
302
21, 22, 23, 24, 25, 26,
304
short yycheck[] = { 38,
305
3, 40, 40, 42, 40, 40, 53, 2, 56, 42,
306
259, 257, 258, 109, 41, 257, 64, 44, 0, 284,
307
59, 30, 59, 56, 286, 41, 38, 44, 40, 278,
308
41, 59, 128, 44, 280, 30, 42, 70, 61, 87,
309
73, 281, 59, 91, 44, 280, 93, 280, 59, 41,
310
61, 54, 44, 38, 38, 40, 40, 42, 42, 59,
311
41, 43, 109, 44, 41, 41, 48, 76, 44, 41,
312
44, 80, 44, 41, 59, 44, 283, 280, 59, 114,
313
61, 281, 257, 65, 93, 80, 59, 44, 41, 41,
314
85, 281, 41, 44, 0, 0, 280, 41, 93, 280,
315
41, 41, 85, 59, 59, 109, 114, 102, 59, 116,
316
42, -1, 43, -1, 109, -1, 87, -1, 38, -1,
317
40, 41, 42, -1, 44, -1, -1, 109, -1, -1,
318
-1, -1, -1, -1, 116, -1, -1, -1, -1, 59,
319
135, 38, -1, 40, 41, 42, 128, 44, -1, -1,
320
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
321
-1, -1, 59, -1, 38, -1, 40, 41, 42, -1,
322
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
323
-1, -1, -1, -1, -1, -1, -1, 38, -1, 40,
324
-1, 42, -1, -1, 38, -1, 40, 41, 42, -1,
325
44, -1, -1, -1, -1, -1, -1, -1, -1, -1,
326
38, -1, 40, 41, 42, -1, 44, 256, 257, 258,
327
259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
328
269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
329
38, 279, 40, 279, 281, 257, 285, 258, 259, 260,
330
261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
331
271, 272, 273, 274, 275, 276, 277, 278, 38, 280,
332
40, 41, 257, 257, 44, -1, 287, 258, 259, 260,
333
261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
334
271, 272, 273, 274, 275, 276, 277, 278, 41, 280,
335
-1, -1, -1, -1, -1, -1, 287, 258, 259, 260,
336
261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
337
271, 272, 273, 274, 275, 276, 277, 278, -1, 280,
338
-1, -1, -1, -1, -1, -1, 287, 257, 258, 259,
339
260, 261, 262, 263, -1, 265, 266, 267, 268, 269,
340
270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
341
257, 258, 259, 260, 261, 262, 263, -1, 265, 266,
342
267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
343
277, 278, 279, 257, 258, 259, 260, 261, 262, 263,
344
-1, 265, 266, 267, 268, 269, 270, 271, 272, 273,
345
274, 275, 276, 277, 278, 279, 257, 258, 259, 260,
346
261, 262, 263, 257, 265, 266, 267, 268, 269, 270,
347
271, 272, 273, 274, 275, 276, 277, 278, 279, 257,
348
-1, -1, 38, -1, 40, 279, 42, -1, -1, -1,
349
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
350
-1, 279, -1, 59, 38, -1, 40, -1, 42, 257,
351
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
352
-1, -1, -1, -1, -1, 59, -1, -1, -1, -1,
353
-1, 279, -1, -1, -1, -1, -1, 257, -1, -1,
354
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
355
-1, -1, -1, -1, -1, -1, -1, -1, -1, 279,
356
-1, -1, -1, -1, -1, 258, 259, 260, 261, 262,
357
263, -1, 265, 266, 267, 268, 269, 270, 271, 272,
358
273, 274, 275, 276, 277, 278, 258, 259, 260, 261,
359
262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
360
272, 273, 274, 275, 276, 277, 278, -1, -1, 258,
361
259, 260, 261, 262, 263, 287, 265, 266, 267, 268,
362
269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
363
-1, -1, -1, 282, 258, 259, 260, 261, 262, 263,
364
264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
365
274, 275, 276, 277, 278, -1, 280, 257, 258, 259,
366
260, 261, 262, 263, -1, 265, 266, 267, 268, 269,
367
270, 271, 272, 273, 274, 275, 276, 277, 278, 258,
368
259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
369
269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
370
-1, 257, 258, 259, 260, 261, 262, 263, -1, 265,
371
266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
372
276, 277, 278, 257, 258, 259, 260, 261, 262, 263,
373
-1, 265, 266, 267, 268, 269, 270, 271, 272, 273,
374
274, 275, 276, 277, 278, 258, 259, 260, 261, 262,
375
263, -1, 265, 266, 267, 268, 269, 270, 271, 272,
376
273, 274, 275, 276, 277, 278,
382
#define YYMAXTOKEN 287
385
"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
386
0,0,0,0,"'&'",0,"'('","')'","'*'",0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,
387
"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
388
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
389
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
390
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
391
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
392
"T_IDENTIFIER","T_TYPEDEF_NAME","T_DEFINE_NAME","T_AUTO","T_EXTERN",
393
"T_REGISTER","T_STATIC","T_TYPEDEF","T_INLINE","T_CHAR","T_DOUBLE","T_FLOAT",
394
"T_INT","T_VOID","T_LONG","T_SHORT","T_SIGNED","T_UNSIGNED","T_ENUM","T_STRUCT",
395
"T_UNION","T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE",
396
"T_ELLIPSIS","T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL",
401
"program : translation_unit",
402
"translation_unit : external_declaration",
403
"translation_unit : translation_unit external_declaration",
404
"external_declaration : declaration",
405
"external_declaration : function_definition",
406
"external_declaration : ';'",
407
"external_declaration : linkage_specification",
408
"external_declaration : T_ASM T_ASMARG ';'",
409
"external_declaration : error T_MATCHRBRACE",
410
"external_declaration : error ';'",
411
"braces : T_LBRACE T_MATCHRBRACE",
412
"linkage_specification : T_EXTERN T_STRING_LITERAL braces",
413
"linkage_specification : T_EXTERN T_STRING_LITERAL declaration",
414
"declaration : decl_specifiers ';'",
415
"declaration : decl_specifiers init_declarator_list ';'",
417
"declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';'",
418
"any_typedef : T_TYPEDEF",
419
"opt_declarator_list :",
420
"opt_declarator_list : declarator_list",
421
"declarator_list : declarator",
422
"declarator_list : declarator_list ',' declarator",
425
"function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE",
427
"function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE",
428
"opt_declaration_list :",
429
"opt_declaration_list : T_VA_DCL",
430
"opt_declaration_list : declaration_list",
431
"declaration_list : declaration",
432
"declaration_list : declaration_list declaration",
433
"decl_specifiers : decl_specifier",
434
"decl_specifiers : decl_specifiers decl_specifier",
435
"decl_specifier : storage_class",
436
"decl_specifier : type_specifier",
437
"decl_specifier : type_qualifier",
438
"storage_class : T_AUTO",
439
"storage_class : T_EXTERN",
440
"storage_class : T_REGISTER",
441
"storage_class : T_STATIC",
442
"storage_class : T_INLINE",
443
"type_specifier : T_CHAR",
444
"type_specifier : T_DOUBLE",
445
"type_specifier : T_FLOAT",
446
"type_specifier : T_INT",
447
"type_specifier : T_LONG",
448
"type_specifier : T_SHORT",
449
"type_specifier : T_SIGNED",
450
"type_specifier : T_UNSIGNED",
451
"type_specifier : T_VOID",
452
"type_specifier : T_TYPEDEF_NAME",
453
"type_specifier : struct_or_union_specifier",
454
"type_specifier : enum_specifier",
455
"type_qualifier : T_TYPE_QUALIFIER",
456
"type_qualifier : T_DEFINE_NAME",
457
"struct_or_union_specifier : struct_or_union any_id braces",
458
"struct_or_union_specifier : struct_or_union braces",
459
"struct_or_union_specifier : struct_or_union any_id",
460
"struct_or_union : T_STRUCT",
461
"struct_or_union : T_UNION",
462
"init_declarator_list : init_declarator",
463
"init_declarator_list : init_declarator_list ',' init_declarator",
464
"init_declarator : declarator",
466
"init_declarator : declarator '=' $$5 T_INITIALIZER",
467
"enum_specifier : enumeration any_id braces",
468
"enum_specifier : enumeration braces",
469
"enum_specifier : enumeration any_id",
470
"enumeration : T_ENUM",
471
"any_id : T_IDENTIFIER",
472
"any_id : T_TYPEDEF_NAME",
473
"declarator : pointer direct_declarator",
474
"declarator : direct_declarator",
475
"direct_declarator : identifier_or_ref",
476
"direct_declarator : '(' declarator ')'",
477
"direct_declarator : direct_declarator T_BRACKETS",
478
"direct_declarator : direct_declarator '(' parameter_type_list ')'",
479
"direct_declarator : direct_declarator '(' opt_identifier_list ')'",
480
"pointer : '*' opt_type_qualifiers",
481
"pointer : '*' opt_type_qualifiers pointer",
482
"opt_type_qualifiers :",
483
"opt_type_qualifiers : type_qualifier_list",
484
"type_qualifier_list : type_qualifier",
485
"type_qualifier_list : type_qualifier_list type_qualifier",
486
"parameter_type_list : parameter_list",
487
"parameter_type_list : parameter_list ',' T_ELLIPSIS",
488
"parameter_list : parameter_declaration",
489
"parameter_list : parameter_list ',' parameter_declaration",
490
"parameter_declaration : decl_specifiers declarator",
491
"parameter_declaration : decl_specifiers abs_declarator",
492
"parameter_declaration : decl_specifiers",
493
"opt_identifier_list :",
494
"opt_identifier_list : identifier_list",
495
"identifier_list : T_IDENTIFIER",
496
"identifier_list : identifier_list ',' T_IDENTIFIER",
497
"identifier_or_ref : T_IDENTIFIER",
498
"identifier_or_ref : '&' T_IDENTIFIER",
499
"abs_declarator : pointer",
500
"abs_declarator : pointer direct_abs_declarator",
501
"abs_declarator : direct_abs_declarator",
502
"direct_abs_declarator : '(' abs_declarator ')'",
503
"direct_abs_declarator : direct_abs_declarator T_BRACKETS",
504
"direct_abs_declarator : T_BRACKETS",
505
"direct_abs_declarator : direct_abs_declarator '(' parameter_type_list ')'",
506
"direct_abs_declarator : direct_abs_declarator '(' ')'",
507
"direct_abs_declarator : '(' parameter_type_list ')'",
508
"direct_abs_declarator : '(' ')'",
513
#define YYMAXDEPTH YYSTACKSIZE
516
#define YYSTACKSIZE YYMAXDEPTH
518
#define YYSTACKSIZE 10000
519
#define YYMAXDEPTH 10000
522
#define YYINITSTACKSIZE 200
533
int yychar; /* some people use this, so we copy it in & out */
534
int yyerrflag; /* must be global for yyerrok & YYRECOVERING */
536
#line 792 "grammar.y"
538
#if defined(__EMX__) || defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(vms)
553
put_error(); /* tell what line we're on, and what file */
554
fprintf(stderr, "%s at token '%s'\n", msg, yytext);
557
/* Initialize the table of type qualifier keywords recognized by the lexical
563
static char *keywords[] = {
564
"const", "volatile", "interrupt",
566
"noshare", "readonly",
568
#if defined(MSDOS) || defined(OS2)
569
"cdecl", "far", "huge", "near", "pascal",
570
"_cdecl", "_export", "_far", "_fastcall", "_fortran", "_huge",
571
"_interrupt", "_loadds", "_near", "_pascal", "_saveregs", "_segment",
572
"_cs", "_ds", "_es", "_ss", "_seg",
573
"__cdecl", "__export", "__far", "__fastcall", "__fortran", "__huge",
574
"__inline", "__interrupt", "__loadds", "__near", "__pascal",
575
"__saveregs", "__segment", "__stdcall", "__syscall",
580
"__const__", "__const",
581
"__volatile__", "__volatile",
582
"__inline__", "__inline",
587
/* Initialize type qualifier table. */
588
type_qualifiers = new_symbol_table();
589
for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
590
new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE);
594
/* Process the C source file. Write function prototypes to the standard
595
* output. Convert function definitions and write the converted source
596
* code to a temporary file.
599
process_file (infile, name)
605
if (strlen(name) > 2) {
606
s = name + strlen(name) - 2;
609
if (*s == 'l' || *s == 'y')
611
#if defined(MSDOS) || defined(OS2)
612
if (*s == 'L' || *s == 'Y')
618
included_files = new_symbol_table();
619
typedef_names = new_symbol_table();
620
define_names = new_symbol_table();
626
include_file(strcpy(base_file, name), func_style != FUNC_NONE);
630
put_blankline(stdout);
634
put_string(stdout, "/* ");
635
put_string(stdout, cur_file_name());
636
put_string(stdout, " */\n");
639
free_symbol_table(define_names);
640
free_symbol_table(typedef_names);
641
free_symbol_table(included_files);
648
free_symbol_table (type_qualifiers);
650
if (yy_current_buffer != 0)
651
yy_delete_buffer(yy_current_buffer);
656
/* allocate initial stack */
657
#if defined(__STDC__) || defined(__cplusplus)
658
static int yyinitstack(struct yystack *sp)
660
static int yyinitstack(sp)
668
newsize = YYINITSTACKSIZE;
669
newss = (short *)malloc(newsize * sizeof *newss);
670
newvs = (YYSTYPE *)malloc(newsize * sizeof *newvs);
671
sp->ss = sp->ssp = newss;
672
sp->vs = sp->vsp = newvs;
673
if (newss == NULL || newvs == NULL) return -1;
674
sp->stacksize = newsize;
675
sp->sslim = newss + newsize - 1;
679
/* double stack size, up to YYMAXDEPTH */
680
#if defined(__STDC__) || defined(__cplusplus)
681
static int yygrowstack(struct yystack *sp)
683
static int yygrowstack(sp)
691
if ((newsize = sp->stacksize) >= YYMAXDEPTH) return -1;
692
if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH;
693
i = sp->ssp - sp->ss;
694
if ((newss = (short *)realloc(sp->ss, newsize * sizeof *newss)) == NULL)
698
if ((newvs = (YYSTYPE *)realloc(sp->vs, newsize * sizeof *newvs)) == NULL)
702
sp->stacksize = newsize;
703
sp->sslim = newss + newsize - 1;
707
#define YYFREESTACK(sp) { free((sp)->ss); free((sp)->vs); }
709
#define YYABORT goto yyabort
710
#define YYREJECT goto yyabort
711
#define YYACCEPT goto yyaccept
712
#define YYERROR goto yyerrlab
716
register int yym, yyn, yystate, yych;
717
register YYSTYPE *yyvsp;
719
struct yystack yystk;
722
extern char *getenv();
724
if (yys = getenv("YYDEBUG"))
727
if (yyn >= '0' && yyn <= '9')
734
yychar = yych = YYEMPTY;
736
if (yyinitstack(&yystk)) goto yyoverflow;
737
*yystk.ssp = yystate = 0;
740
if (yyn = yydefred[yystate]) goto yyreduce;
743
if ((yych = YYLEX) < 0) yych = 0;
749
if (yych <= YYMAXTOKEN) yys = yyname[yych];
750
if (!yys) yys = "illegal-symbol";
751
printf("%sdebug: state %d, reading %d (%s)\n",
752
YYPREFIX, yystate, yych, yys);
756
if ((yyn = yysindex[yystate]) && (yyn += yych) >= 0 &&
757
yyn <= YYTABLESIZE && yycheck[yyn] == yych)
761
printf("%sdebug: state %d, shifting to state %d\n",
762
YYPREFIX, yystate, yytable[yyn]);
764
if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk))
766
*++yystk.ssp = yystate = yytable[yyn];
767
*++yystk.vsp = yylval;
768
yychar = yych = YYEMPTY;
769
if (yyerrflag > 0) --yyerrflag;
772
if ((yyn = yyrindex[yystate]) && (yyn += yych) >= 0 &&
773
yyn <= YYTABLESIZE && yycheck[yyn] == yych)
778
if (yyerrflag) goto yyinrecovery;
783
yyerror("syntax error");
795
if ((yyn = yysindex[*yystk.ssp]) &&
796
(yyn += YYERRCODE) >= 0 &&
797
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
801
printf("%sdebug: state %d, error recovery shifting\
802
to state %d\n", YYPREFIX, *yystk.ssp, yytable[yyn]);
804
if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk))
806
*++yystk.ssp = yystate = yytable[yyn];
807
*++yystk.vsp = yylval;
814
printf("%sdebug: error recovery discarding state %d\n",
815
YYPREFIX, *yystk.ssp);
817
if (yystk.ssp <= yystk.ss) goto yyabort;
825
if (yych == 0) goto yyabort;
830
if (yych <= YYMAXTOKEN) yys = yyname[yych];
831
if (!yys) yys = "illegal-symbol";
832
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
833
YYPREFIX, yystate, yych, yys);
836
yychar = yych = YYEMPTY;
842
printf("%sdebug: state %d, reducing by rule %d (%s)\n",
843
YYPREFIX, yystate, yyn, yyrule[yyn]);
846
yyvsp = yystk.vsp; /* for speed in code under switch() */
847
yyval = yyvsp[1-yym];
851
#line 175 "grammar.y"
857
#line 179 "grammar.y"
863
#line 190 "grammar.y"
865
/* Provide an empty action here so bison will not complain about
866
* incompatible types in the default action it normally would
872
#line 197 "grammar.y"
878
#line 204 "grammar.y"
881
if (types_out && want_typedef()) {
882
gen_declarations(&yyvsp[-1].decl_spec, (DeclaratorList *)0);
886
free_decl_spec(&yyvsp[-1].decl_spec);
891
#line 215 "grammar.y"
893
if (func_params != NULL) {
894
set_param_types(func_params, &yyvsp[-2].decl_spec, &yyvsp[-1].decl_list);
896
gen_declarations(&yyvsp[-2].decl_spec, &yyvsp[-1].decl_list);
900
free_decl_list(&yyvsp[-1].decl_list);
902
free_decl_spec(&yyvsp[-2].decl_spec);
907
#line 229 "grammar.y"
909
cur_decl_spec_flags = yyvsp[0].decl_spec.flags;
910
free_decl_spec(&yyvsp[0].decl_spec);
914
#line 234 "grammar.y"
920
#line 241 "grammar.y"
926
#line 253 "grammar.y"
928
int flags = cur_decl_spec_flags;
930
/* If the typedef is a pointer type, then reset the short type
931
* flags so it does not get promoted.
933
if (strcmp(yyvsp[0].declarator->text, yyvsp[0].declarator->name) != 0)
934
flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
935
new_symbol(typedef_names, yyvsp[0].declarator->name, NULL, flags);
936
free_declarator(yyvsp[0].declarator);
940
#line 265 "grammar.y"
942
int flags = cur_decl_spec_flags;
944
if (strcmp(yyvsp[0].declarator->text, yyvsp[0].declarator->name) != 0)
945
flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
946
new_symbol(typedef_names, yyvsp[0].declarator->name, NULL, flags);
947
free_declarator(yyvsp[0].declarator);
951
#line 277 "grammar.y"
953
check_untagged(&yyvsp[-1].decl_spec);
954
if (yyvsp[0].declarator->func_def == FUNC_NONE) {
955
yyerror("syntax error");
958
func_params = &(yyvsp[0].declarator->head->params);
959
func_params->begin_comment = cur_file->begin_comment;
960
func_params->end_comment = cur_file->end_comment;
964
#line 288 "grammar.y"
966
/* If we're converting to K&R and we've got a nominally K&R
967
* function which has a parameter which is ANSI (i.e., a prototyped
968
* function pointer), then we must override the deciphered value of
969
* 'func_def' so that the parameter will be converted.
971
if (func_style == FUNC_TRADITIONAL
973
&& yyvsp[-3].declarator->head->func_def == func_style) {
974
yyvsp[-3].declarator->head->func_def = FUNC_BOTH;
979
if (cur_file->convert)
980
gen_func_definition(&yyvsp[-4].decl_spec, yyvsp[-3].declarator);
981
gen_prototype(&yyvsp[-4].decl_spec, yyvsp[-3].declarator);
985
free_decl_spec(&yyvsp[-4].decl_spec);
986
free_declarator(yyvsp[-3].declarator);
990
#line 313 "grammar.y"
992
if (yyvsp[0].declarator->func_def == FUNC_NONE) {
993
yyerror("syntax error");
996
func_params = &(yyvsp[0].declarator->head->params);
997
func_params->begin_comment = cur_file->begin_comment;
998
func_params->end_comment = cur_file->end_comment;
1002
#line 323 "grammar.y"
1008
new_decl_spec(&decl_spec, dft_decl_spec(), yyvsp[-4].declarator->begin, DS_NONE);
1009
if (cur_file->convert)
1010
gen_func_definition(&decl_spec, yyvsp[-4].declarator);
1011
gen_prototype(&decl_spec, yyvsp[-4].declarator);
1015
free_decl_spec(&decl_spec);
1016
free_declarator(yyvsp[-4].declarator);
1020
#line 354 "grammar.y"
1022
join_decl_specs(&yyval.decl_spec, &yyvsp[-1].decl_spec, &yyvsp[0].decl_spec);
1023
free(yyvsp[-1].decl_spec.text);
1024
free(yyvsp[0].decl_spec.text);
1028
#line 369 "grammar.y"
1030
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1034
#line 373 "grammar.y"
1036
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_EXTERN);
1040
#line 377 "grammar.y"
1042
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1046
#line 381 "grammar.y"
1048
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_STATIC);
1052
#line 385 "grammar.y"
1054
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_JUNK);
1058
#line 392 "grammar.y"
1060
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_CHAR);
1064
#line 396 "grammar.y"
1066
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1070
#line 400 "grammar.y"
1072
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_FLOAT);
1076
#line 404 "grammar.y"
1078
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1082
#line 408 "grammar.y"
1084
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1088
#line 412 "grammar.y"
1090
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_SHORT);
1094
#line 416 "grammar.y"
1096
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1100
#line 420 "grammar.y"
1102
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1106
#line 424 "grammar.y"
1108
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1112
#line 428 "grammar.y"
1115
s = find_symbol(typedef_names, yyvsp[0].text.text);
1117
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, s->flags);
1121
#line 440 "grammar.y"
1123
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1127
#line 444 "grammar.y"
1129
/* This rule allows the <pointer> nonterminal to scan #define
1130
* names as if they were type modifiers.
1133
s = find_symbol(define_names, yyvsp[0].text.text);
1135
new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, s->flags);
1139
#line 457 "grammar.y"
1142
if ((s = implied_typedef()) == 0)
1143
(void)sprintf(s = buf, "%s %s", yyvsp[-2].text.text, yyvsp[-1].text.text);
1144
new_decl_spec(&yyval.decl_spec, s, yyvsp[-2].text.begin, DS_NONE);
1148
#line 464 "grammar.y"
1151
if ((s = implied_typedef()) == 0)
1152
(void)sprintf(s = buf, "%s {}", yyvsp[-1].text.text);
1153
new_decl_spec(&yyval.decl_spec, s, yyvsp[-1].text.begin, DS_NONE);
1157
#line 471 "grammar.y"
1159
(void)sprintf(buf, "%s %s", yyvsp[-1].text.text, yyvsp[0].text.text);
1160
new_decl_spec(&yyval.decl_spec, buf, yyvsp[-1].text.begin, DS_NONE);
1164
#line 479 "grammar.y"
1166
imply_typedef(yyval.text.text);
1170
#line 483 "grammar.y"
1172
imply_typedef(yyval.text.text);
1176
#line 490 "grammar.y"
1178
new_decl_list(&yyval.decl_list, yyvsp[0].declarator);
1182
#line 494 "grammar.y"
1184
add_decl_list(&yyval.decl_list, &yyvsp[-2].decl_list, yyvsp[0].declarator);
1188
#line 501 "grammar.y"
1190
if (yyvsp[0].declarator->func_def != FUNC_NONE && func_params == NULL &&
1191
func_style == FUNC_TRADITIONAL && cur_file->convert) {
1192
gen_func_declarator(yyvsp[0].declarator);
1193
fputs(cur_text(), cur_file->tmp_file);
1195
cur_declarator = yyval.declarator;
1199
#line 510 "grammar.y"
1201
if (yyvsp[-1].declarator->func_def != FUNC_NONE && func_params == NULL &&
1202
func_style == FUNC_TRADITIONAL && cur_file->convert) {
1203
gen_func_declarator(yyvsp[-1].declarator);
1204
fputs(" =", cur_file->tmp_file);
1209
#line 522 "grammar.y"
1212
if ((s = implied_typedef()) == 0)
1213
(void)sprintf(s = buf, "enum %s", yyvsp[-1].text.text);
1214
new_decl_spec(&yyval.decl_spec, s, yyvsp[-2].text.begin, DS_NONE);
1218
#line 529 "grammar.y"
1221
if ((s = implied_typedef()) == 0)
1222
(void)sprintf(s = buf, "%s {}", yyvsp[-1].text.text);
1223
new_decl_spec(&yyval.decl_spec, s, yyvsp[-1].text.begin, DS_NONE);
1227
#line 536 "grammar.y"
1229
(void)sprintf(buf, "enum %s", yyvsp[0].text.text);
1230
new_decl_spec(&yyval.decl_spec, buf, yyvsp[-1].text.begin, DS_NONE);
1234
#line 544 "grammar.y"
1236
imply_typedef("enum");
1237
yyval.text = yyvsp[0].text;
1241
#line 557 "grammar.y"
1243
yyval.declarator = yyvsp[0].declarator;
1244
(void)sprintf(buf, "%s%s", yyvsp[-1].text.text, yyval.declarator->text);
1245
free(yyval.declarator->text);
1246
yyval.declarator->text = xstrdup(buf);
1247
yyval.declarator->begin = yyvsp[-1].text.begin;
1248
yyval.declarator->pointer = TRUE;
1252
#line 570 "grammar.y"
1254
yyval.declarator = new_declarator(yyvsp[0].text.text, yyvsp[0].text.text, yyvsp[0].text.begin);
1258
#line 574 "grammar.y"
1260
yyval.declarator = yyvsp[-1].declarator;
1261
(void)sprintf(buf, "(%s)", yyval.declarator->text);
1262
free(yyval.declarator->text);
1263
yyval.declarator->text = xstrdup(buf);
1264
yyval.declarator->begin = yyvsp[-2].text.begin;
1268
#line 582 "grammar.y"
1270
yyval.declarator = yyvsp[-1].declarator;
1271
(void)sprintf(buf, "%s%s", yyval.declarator->text, yyvsp[0].text.text);
1272
free(yyval.declarator->text);
1273
yyval.declarator->text = xstrdup(buf);
1277
#line 589 "grammar.y"
1279
yyval.declarator = new_declarator("%s()", yyvsp[-3].declarator->name, yyvsp[-3].declarator->begin);
1280
yyval.declarator->params = yyvsp[-1].param_list;
1281
yyval.declarator->func_stack = yyvsp[-3].declarator;
1282
yyval.declarator->head = (yyvsp[-3].declarator->func_stack == NULL) ? yyval.declarator : yyvsp[-3].declarator->head;
1283
yyval.declarator->func_def = FUNC_ANSI;
1287
#line 597 "grammar.y"
1289
yyval.declarator = new_declarator("%s()", yyvsp[-3].declarator->name, yyvsp[-3].declarator->begin);
1290
yyval.declarator->params = yyvsp[-1].param_list;
1291
yyval.declarator->func_stack = yyvsp[-3].declarator;
1292
yyval.declarator->head = (yyvsp[-3].declarator->func_stack == NULL) ? yyval.declarator : yyvsp[-3].declarator->head;
1293
yyval.declarator->func_def = FUNC_TRADITIONAL;
1297
#line 608 "grammar.y"
1299
(void)sprintf(yyval.text.text, "*%s", yyvsp[0].text.text);
1300
yyval.text.begin = yyvsp[-1].text.begin;
1304
#line 613 "grammar.y"
1306
(void)sprintf(yyval.text.text, "*%s%s", yyvsp[-1].text.text, yyvsp[0].text.text);
1307
yyval.text.begin = yyvsp[-2].text.begin;
1311
#line 621 "grammar.y"
1313
strcpy(yyval.text.text, "");
1314
yyval.text.begin = 0L;
1318
#line 630 "grammar.y"
1320
(void)sprintf(yyval.text.text, "%s ", yyvsp[0].decl_spec.text);
1321
yyval.text.begin = yyvsp[0].decl_spec.begin;
1322
free(yyvsp[0].decl_spec.text);
1326
#line 636 "grammar.y"
1328
(void)sprintf(yyval.text.text, "%s%s ", yyvsp[-1].text.text, yyvsp[0].decl_spec.text);
1329
yyval.text.begin = yyvsp[-1].text.begin;
1330
free(yyvsp[0].decl_spec.text);
1334
#line 646 "grammar.y"
1336
add_ident_list(&yyval.param_list, &yyvsp[-2].param_list, "...");
1340
#line 653 "grammar.y"
1342
new_param_list(&yyval.param_list, yyvsp[0].parameter);
1346
#line 657 "grammar.y"
1348
add_param_list(&yyval.param_list, &yyvsp[-2].param_list, yyvsp[0].parameter);
1352
#line 664 "grammar.y"
1354
check_untagged(&yyvsp[-1].decl_spec);
1355
yyval.parameter = new_parameter(&yyvsp[-1].decl_spec, yyvsp[0].declarator);
1359
#line 669 "grammar.y"
1361
check_untagged(&yyvsp[-1].decl_spec);
1362
yyval.parameter = new_parameter(&yyvsp[-1].decl_spec, yyvsp[0].declarator);
1366
#line 674 "grammar.y"
1368
check_untagged(&yyvsp[0].decl_spec);
1369
yyval.parameter = new_parameter(&yyvsp[0].decl_spec, (Declarator *)0);
1373
#line 682 "grammar.y"
1375
new_ident_list(&yyval.param_list);
1379
#line 690 "grammar.y"
1381
new_ident_list(&yyval.param_list);
1382
add_ident_list(&yyval.param_list, &yyval.param_list, yyvsp[0].text.text);
1386
#line 695 "grammar.y"
1388
add_ident_list(&yyval.param_list, &yyvsp[-2].param_list, yyvsp[0].text.text);
1392
#line 702 "grammar.y"
1394
yyval.text = yyvsp[0].text;
1398
#line 706 "grammar.y"
1401
if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
1402
yyval.text = yyvsp[0].text;
1405
(void)sprintf(yyval.text.text, "&%s", yyvsp[0].text.text);
1406
yyval.text.begin = yyvsp[-1].text.begin;
1410
#line 719 "grammar.y"
1412
yyval.declarator = new_declarator(yyvsp[0].text.text, "", yyvsp[0].text.begin);
1416
#line 723 "grammar.y"
1418
yyval.declarator = yyvsp[0].declarator;
1419
(void)sprintf(buf, "%s%s", yyvsp[-1].text.text, yyval.declarator->text);
1420
free(yyval.declarator->text);
1421
yyval.declarator->text = xstrdup(buf);
1422
yyval.declarator->begin = yyvsp[-1].text.begin;
1426
#line 735 "grammar.y"
1428
yyval.declarator = yyvsp[-1].declarator;
1429
(void)sprintf(buf, "(%s)", yyval.declarator->text);
1430
free(yyval.declarator->text);
1431
yyval.declarator->text = xstrdup(buf);
1432
yyval.declarator->begin = yyvsp[-2].text.begin;
1436
#line 743 "grammar.y"
1438
yyval.declarator = yyvsp[-1].declarator;
1439
(void)sprintf(buf, "%s%s", yyval.declarator->text, yyvsp[0].text.text);
1440
free(yyval.declarator->text);
1441
yyval.declarator->text = xstrdup(buf);
1445
#line 750 "grammar.y"
1447
yyval.declarator = new_declarator(yyvsp[0].text.text, "", yyvsp[0].text.begin);
1451
#line 754 "grammar.y"
1453
yyval.declarator = new_declarator("%s()", "", yyvsp[-3].declarator->begin);
1454
yyval.declarator->params = yyvsp[-1].param_list;
1455
yyval.declarator->func_stack = yyvsp[-3].declarator;
1456
yyval.declarator->head = (yyvsp[-3].declarator->func_stack == NULL) ? yyval.declarator : yyvsp[-3].declarator->head;
1457
yyval.declarator->func_def = FUNC_ANSI;
1461
#line 762 "grammar.y"
1463
yyval.declarator = new_declarator("%s()", "", yyvsp[-2].declarator->begin);
1464
yyval.declarator->func_stack = yyvsp[-2].declarator;
1465
yyval.declarator->head = (yyvsp[-2].declarator->func_stack == NULL) ? yyval.declarator : yyvsp[-2].declarator->head;
1466
yyval.declarator->func_def = FUNC_ANSI;
1470
#line 769 "grammar.y"
1474
d = new_declarator("", "", yyvsp[-2].text.begin);
1475
yyval.declarator = new_declarator("%s()", "", yyvsp[-2].text.begin);
1476
yyval.declarator->params = yyvsp[-1].param_list;
1477
yyval.declarator->func_stack = d;
1478
yyval.declarator->head = yyval.declarator;
1479
yyval.declarator->func_def = FUNC_ANSI;
1483
#line 780 "grammar.y"
1487
d = new_declarator("", "", yyvsp[-1].text.begin);
1488
yyval.declarator = new_declarator("%s()", "", yyvsp[-1].text.begin);
1489
yyval.declarator->func_stack = d;
1490
yyval.declarator->head = yyval.declarator;
1491
yyval.declarator->func_def = FUNC_ANSI;
1494
#line 1495 "y.tab.c"
1497
yystate = *yystk.ssp;
1501
if (yystate == 0 && yym == 0)
1505
printf("%sdebug: after reduction, shifting from state 0 to\
1506
state %d\n", YYPREFIX, YYFINAL);
1509
*++yystk.ssp = YYFINAL;
1510
*++yystk.vsp = yyval;
1513
if ((yych = YYLEX) < 0) yych = 0;
1519
if (yych <= YYMAXTOKEN) yys = yyname[yych];
1520
if (!yys) yys = "illegal-symbol";
1521
printf("%sdebug: state %d, reading %d (%s)\n",
1522
YYPREFIX, YYFINAL, yych, yys);
1526
if (yych == 0) goto yyaccept;
1529
if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
1530
yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
1531
yystate = yytable[yyn];
1533
yystate = yydgoto[yym];
1536
printf("%sdebug: after reduction, shifting from state %d \
1537
to state %d\n", YYPREFIX, *yystk.ssp, yystate);
1539
if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk))
1541
*++yystk.ssp = yystate;
1542
*++yystk.vsp = yyval;
1545
yyerror("yacc stack overflow");
1547
YYFREESTACK(&yystk);
1550
YYFREESTACK(&yystk);