2 static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
13 #define yyclearin (yychar = YYEMPTY)
14 #define yyerrok (yyerrflag = 0)
15 #define YYRECOVERING() (yyerrflag != 0)
17 /* compatibility with bison */
19 /* compatibility with FreeBSD */
20 #ifdef YYPARSE_PARAM_TYPE
21 #define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
23 #define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
26 #define YYPARSE_DECL() yyparse(void)
27 #endif /* YYPARSE_PARAM */
29 extern int YYPARSE_DECL();
31 static int yygrowstack(void);
32 #define yyparse grammar_parse
33 #define yylex grammar_lex
34 #define yyerror grammar_error
35 #define yychar grammar_char
36 #define yyval grammar_val
37 #define yylval grammar_lval
38 #define yydebug grammar_debug
39 #define yynerrs grammar_nerrs
40 #define yyerrflag grammar_errflag
41 #define yyss grammar_ss
42 #define yyssp grammar_ssp
43 #define yyvs grammar_vs
44 #define yyvsp grammar_vsp
45 #define yylhs grammar_lhs
46 #define yylen grammar_len
47 #define yydefred grammar_defred
48 #define yydgoto grammar_dgoto
49 #define yysindex grammar_sindex
50 #define yyrindex grammar_rindex
51 #define yygindex grammar_gindex
52 #define yytable grammar_table
53 #define yycheck grammar_check
54 #define yyname grammar_name
55 #define yyrule grammar_rule
56 #define YYPREFIX "grammar_"
64 #define YYMAXDEPTH 150
66 extern int yylex (void);
68 /* declaration specifier attributes for the typedef statement currently being
71 static int cur_decl_spec_flags;
73 /* pointer to parameter list for the current function definition */
74 static ParameterList *func_params;
76 /* A parser semantic action sets this pointer to the current declarator in
77 * a function parameter declaration in order to catch any comments following
78 * the parameter declaration on the same line. If the lexer scans a comment
79 * and <cur_declarator> is not NULL, then the comment is attached to the
80 * declarator. To ignore subsequent comments, the lexer sets this to NULL
81 * after scanning a comment or end of line.
83 static Declarator *cur_declarator;
85 /* temporary string buffer */
86 static char buf[MAX_TEXT_SIZE];
88 /* table of typedef names */
89 static SymbolTable *typedef_names;
91 /* table of define names */
92 static SymbolTable *define_names;
94 /* table of type qualifiers */
95 static SymbolTable *type_qualifiers;
97 /* information about the current input file */
99 char *base_name; /* base input file name */
100 char *file_name; /* current file name */
101 FILE *file; /* input file */
102 unsigned line_num; /* current line number in input file */
103 FILE *tmp_file; /* temporary file */
104 long begin_comment; /* tmp file offset after last written ) or ; */
105 long end_comment; /* tmp file offset after last comment */
106 boolean convert; /* if TRUE, convert function definitions */
107 boolean changed; /* TRUE if conversion done in this file */
110 static IncludeStack *cur_file; /* current input file */
114 static int haveAnsiParam (void);
117 /* Flags to enable us to find if a procedure returns a value.
119 static int return_val, /* nonzero on BRACES iff return-expression found */
120 returned_at; /* marker for token-number to set 'return_val' */
123 static char *dft_decl_spec (void);
128 return (lintLibrary() && !return_val) ? "void" : "int";
132 #define dft_decl_spec() "int"
139 if (func_params != 0) {
140 for (p = func_params->first; p != 0; p = p->next) {
141 if (p->declarator->func_def == FUNC_ANSI) {
148 #line 149 "grammar.tab.c"
149 #define T_IDENTIFIER 257
150 #define T_TYPEDEF_NAME 258
151 #define T_DEFINE_NAME 259
154 #define T_REGISTER 262
156 #define T_TYPEDEF 264
158 #define T_EXTENSION 266
167 #define T_UNSIGNED 275
172 #define T_Complex 280
173 #define T_Imaginary 281
174 #define T_TYPE_QUALIFIER 282
175 #define T_BRACKETS 283
177 #define T_MATCHRBRACE 285
178 #define T_ELLIPSIS 286
179 #define T_INITIALIZER 287
180 #define T_STRING_LITERAL 288
184 #define YYERRCODE 256
185 static const short grammar_lhs[] = { -1,
186 0, 0, 26, 26, 27, 27, 27, 27, 27, 27,
187 27, 31, 30, 30, 28, 28, 34, 28, 32, 32,
188 33, 33, 35, 35, 37, 38, 29, 39, 29, 36,
189 36, 36, 40, 40, 1, 1, 2, 2, 2, 3,
190 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
191 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
192 5, 5, 6, 6, 6, 19, 19, 8, 8, 9,
193 41, 9, 7, 7, 7, 25, 23, 23, 10, 10,
194 11, 11, 11, 11, 11, 20, 20, 21, 21, 22,
195 22, 14, 14, 15, 15, 16, 16, 16, 17, 17,
196 18, 18, 24, 24, 12, 12, 12, 13, 13, 13,
199 static const short grammar_len[] = { 2,
200 0, 1, 1, 2, 1, 1, 1, 1, 3, 2,
201 2, 2, 3, 3, 2, 3, 0, 5, 2, 1,
202 0, 1, 1, 3, 0, 0, 7, 0, 5, 0,
203 1, 1, 1, 2, 1, 2, 1, 1, 1, 1,
204 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
205 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
206 1, 1, 3, 2, 2, 1, 1, 1, 3, 1,
207 0, 4, 3, 2, 2, 1, 1, 1, 2, 1,
208 1, 3, 2, 4, 4, 2, 3, 0, 1, 1,
209 2, 1, 3, 1, 3, 2, 2, 1, 0, 1,
210 1, 3, 1, 2, 1, 2, 1, 3, 2, 1,
213 static const short grammar_defred[] = { 0,
214 0, 0, 0, 0, 77, 0, 62, 40, 0, 42,
215 43, 20, 44, 0, 46, 47, 48, 49, 54, 50,
216 51, 52, 53, 76, 66, 67, 55, 56, 57, 61,
217 0, 7, 0, 0, 35, 37, 38, 39, 59, 60,
218 28, 0, 0, 0, 103, 81, 0, 0, 3, 5,
219 6, 8, 0, 10, 11, 78, 0, 90, 0, 0,
220 104, 0, 19, 0, 41, 45, 15, 36, 0, 68,
221 0, 0, 0, 83, 0, 0, 64, 0, 0, 74,
222 4, 58, 0, 82, 87, 91, 0, 14, 13, 9,
223 16, 0, 71, 0, 31, 33, 0, 0, 0, 0,
224 0, 94, 0, 0, 101, 12, 63, 73, 0, 0,
225 69, 0, 0, 0, 34, 0, 110, 96, 97, 0,
226 0, 84, 0, 85, 0, 23, 0, 0, 72, 26,
227 29, 114, 0, 0, 0, 109, 0, 93, 95, 102,
228 18, 0, 0, 108, 113, 112, 0, 24, 27, 111,
230 static const short grammar_dgoto[] = { 33,
231 87, 35, 36, 37, 38, 39, 40, 69, 70, 41,
232 42, 119, 120, 100, 101, 102, 103, 104, 43, 44,
233 59, 60, 45, 46, 47, 48, 49, 50, 51, 52,
234 77, 53, 127, 109, 128, 97, 94, 143, 72, 98,
237 static const short grammar_sindex[] = { -2,
238 -3, 27, -239, -177, 0, 0, 0, 0, -274, 0,
239 0, 0, 0, -246, 0, 0, 0, 0, 0, 0,
240 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
241 -266, 0, 0, 455, 0, 0, 0, 0, 0, 0,
242 0, -35, -245, 128, 0, 0, -245, -2, 0, 0,
243 0, 0, 642, 0, 0, 0, -15, 0, -12, -239,
244 0, 590, 0, -27, 0, 0, 0, 0, -10, 0,
245 -11, 534, -72, 0, -237, -232, 0, -35, -232, 0,
246 0, 0, 642, 0, 0, 0, 455, 0, 0, 0,
247 0, 27, 0, 534, 0, 0, -222, 617, 209, 34,
248 39, 0, 44, 42, 0, 0, 0, 0, 27, -11,
249 0, -200, -196, -195, 0, 174, 0, 0, 0, -33,
250 243, 0, 561, 0, -177, 0, 33, 49, 0, 0,
251 0, 0, 53, 55, 417, 0, -33, 0, 0, 0,
252 0, 27, -188, 0, 0, 0, 57, 0, 0, 0,
254 static const short grammar_rindex[] = { 99,
255 0, 0, 275, 0, 0, -38, 0, 0, 481, 0,
256 0, 0, 0, 509, 0, 0, 0, 0, 0, 0,
257 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
258 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
259 0, 30, 0, 0, 0, 0, 0, 101, 0, 0,
260 0, 0, 0, 0, 0, 0, 0, 0, 343, 309,
261 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
262 98, -182, 62, 0, 0, 133, 0, 64, 379, 0,
263 0, 0, -5, 0, 0, 0, 0, 0, 0, 0,
264 0, 0, 0, -182, 0, 0, 0, -180, -19, 0,
265 65, 0, 0, 68, 0, 0, 0, 0, 51, 9,
266 0, 0, 0, 0, 0, 0, 0, 0, 0, -13,
267 19, 0, 0, 0, 0, 0, 0, 52, 0, 0,
268 0, 0, 0, 0, 0, 0, 35, 0, 0, 0,
269 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
271 static const short grammar_gindex[] = { 0,
272 11, -17, 0, 0, 13, 0, 0, 0, 20, 8,
273 -43, -1, -8, -89, 0, -9, 0, 0, 0, -44,
274 0, 0, 4, 0, 0, 0, 70, -53, 0, 0,
275 -18, 0, 0, 0, 0, 22, 0, 0, 0, 0,
278 #define YYTABLESIZE 924
279 static const short grammar_table[] = { 58,
280 78, 58, 58, 58, 73, 58, 135, 61, 88, 57,
281 34, 5, 56, 62, 85, 58, 68, 63, 96, 7,
282 58, 98, 78, 64, 98, 84, 134, 107, 80, 3,
283 107, 90, 17, 92, 17, 4, 17, 2, 75, 3,
284 96, 71, 30, 89, 115, 147, 76, 106, 91, 93,
285 79, 75, 70, 17, 121, 55, 32, 107, 34, 105,
286 108, 114, 105, 83, 4, 68, 2, 70, 3, 68,
287 80, 121, 86, 80, 122, 106, 105, 78, 106, 5,
288 56, 68, 123, 99, 124, 125, 129, 130, 80, 131,
289 80, 141, 142, 144, 110, 145, 149, 150, 1, 110,
290 2, 30, 99, 32, 79, 92, 118, 79, 100, 21,
291 22, 111, 137, 139, 133, 113, 126, 81, 0, 0,
292 0, 0, 79, 57, 79, 0, 99, 0, 140, 0,
293 0, 0, 0, 99, 0, 0, 0, 0, 0, 0,
294 0, 70, 0, 0, 0, 99, 0, 0, 0, 148,
295 0, 0, 0, 0, 0, 0, 70, 0, 0, 0,
296 0, 0, 0, 0, 0, 4, 0, 2, 0, 0,
297 65, 0, 65, 65, 65, 0, 65, 0, 0, 0,
298 0, 0, 0, 0, 5, 6, 7, 8, 65, 10,
299 11, 65, 13, 66, 15, 16, 17, 18, 19, 20,
300 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
301 0, 4, 0, 116, 132, 3, 0, 0, 58, 58,
302 58, 58, 58, 58, 58, 78, 58, 58, 58, 58,
303 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
304 58, 58, 58, 58, 58, 78, 4, 74, 116, 136,
305 3, 17, 78, 1, 5, 6, 7, 8, 9, 10,
306 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
307 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
308 4, 54, 116, 5, 56, 0, 31, 80, 80, 80,
309 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
310 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
311 80, 80, 88, 80, 88, 88, 88, 0, 88, 0,
312 80, 79, 79, 79, 79, 79, 79, 79, 79, 79,
313 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
314 79, 79, 79, 79, 79, 79, 89, 79, 89, 89,
315 89, 0, 89, 0, 79, 25, 25, 25, 25, 25,
316 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
317 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
318 86, 25, 86, 86, 5, 56, 86, 0, 25, 65,
319 65, 65, 65, 65, 65, 65, 0, 65, 65, 65,
320 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
321 65, 65, 65, 65, 65, 65, 75, 0, 75, 75,
322 75, 0, 75, 0, 0, 0, 0, 0, 0, 0,
323 5, 6, 7, 8, 65, 10, 11, 75, 13, 66,
324 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
325 25, 26, 27, 28, 29, 30, 117, 146, 0, 0,
326 0, 0, 0, 0, 0, 5, 6, 7, 8, 65,
327 10, 11, 0, 13, 66, 15, 16, 17, 18, 19,
328 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
329 30, 117, 4, 0, 2, 0, 3, 0, 0, 5,
330 56, 0, 0, 0, 0, 0, 0, 0, 0, 0,
331 0, 0, 0, 67, 0, 0, 0, 0, 41, 0,
332 41, 0, 41, 0, 0, 117, 0, 0, 0, 0,
333 0, 88, 88, 0, 0, 0, 0, 0, 0, 41,
334 0, 0, 0, 0, 0, 0, 45, 0, 45, 0,
335 45, 0, 0, 0, 0, 0, 0, 88, 0, 0,
336 0, 0, 0, 0, 0, 89, 89, 45, 0, 0,
337 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
338 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
339 0, 89, 0, 0, 0, 0, 0, 0, 0, 86,
340 86, 0, 0, 0, 0, 0, 0, 0, 0, 0,
341 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
342 0, 0, 0, 0, 0, 86, 0, 0, 0, 0,
343 0, 0, 0, 0, 0, 75, 75, 75, 75, 75,
344 75, 75, 0, 75, 75, 75, 75, 75, 75, 75,
345 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
346 75, 75, 0, 0, 0, 0, 0, 0, 0, 0,
347 0, 0, 0, 0, 82, 7, 8, 65, 10, 11,
348 0, 13, 66, 15, 16, 17, 18, 19, 20, 21,
349 22, 23, 24, 25, 26, 27, 28, 29, 30, 0,
350 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
351 0, 5, 6, 7, 8, 65, 10, 11, 0, 13,
352 66, 15, 16, 17, 18, 19, 20, 21, 22, 23,
353 24, 25, 26, 27, 28, 29, 30, 41, 41, 41,
354 41, 41, 41, 41, 0, 41, 41, 41, 41, 41,
355 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
356 41, 41, 41, 0, 0, 45, 45, 45, 45, 45,
357 45, 45, 0, 45, 45, 45, 45, 45, 45, 45,
358 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
359 45, 82, 7, 8, 65, 10, 11, 12, 13, 14,
360 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
361 25, 26, 27, 28, 29, 30, 0, 0, 82, 7,
362 8, 65, 10, 11, 95, 13, 66, 15, 16, 17,
363 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
364 28, 29, 30, 0, 0, 0, 138, 82, 7, 8,
365 65, 10, 11, 12, 13, 14, 15, 16, 17, 18,
366 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
367 29, 30, 0, 75, 82, 7, 8, 65, 10, 11,
368 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
369 22, 23, 24, 25, 26, 27, 28, 29, 30, 82,
370 7, 8, 65, 10, 11, 0, 13, 66, 15, 16,
371 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
374 static const short grammar_check[] = { 38,
375 44, 40, 41, 42, 40, 44, 40, 4, 62, 2,
376 0, 257, 258, 288, 59, 3, 34, 264, 72, 259,
377 59, 41, 61, 290, 44, 41, 116, 41, 47, 42,
378 44, 59, 38, 44, 40, 38, 42, 40, 284, 42,
379 94, 34, 282, 62, 98, 135, 43, 285, 59, 61,
380 47, 284, 44, 59, 99, 59, 59, 76, 48, 41,
381 79, 284, 44, 53, 38, 83, 40, 59, 42, 87,
382 41, 116, 60, 44, 41, 41, 73, 121, 44, 257,
383 258, 99, 44, 73, 41, 44, 287, 284, 59, 285,
384 61, 59, 44, 41, 87, 41, 285, 41, 0, 92,
385 0, 284, 41, 284, 41, 41, 99, 44, 41, 59,
386 59, 92, 121, 123, 116, 94, 109, 48, -1, -1,
387 -1, -1, 59, 116, 61, -1, 116, -1, 125, -1,
388 -1, -1, -1, 123, -1, -1, -1, -1, -1, -1,
389 -1, 44, -1, -1, -1, 135, -1, -1, -1, 142,
390 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
391 -1, -1, -1, -1, -1, 38, -1, 40, -1, -1,
392 38, -1, 40, 41, 42, -1, 44, -1, -1, -1,
393 -1, -1, -1, -1, 257, 258, 259, 260, 261, 262,
394 263, 59, 265, 266, 267, 268, 269, 270, 271, 272,
395 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
396 -1, 38, -1, 40, 41, 42, -1, -1, 257, 258,
397 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
398 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
399 279, 280, 281, 282, 283, 284, 38, 283, 40, 283,
400 42, 257, 291, 256, 257, 258, 259, 260, 261, 262,
401 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
402 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
403 38, 285, 40, 257, 258, -1, 289, 258, 259, 260,
404 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
405 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
406 281, 282, 38, 284, 40, 41, 42, -1, 44, -1,
407 291, 258, 259, 260, 261, 262, 263, 264, 265, 266,
408 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
409 277, 278, 279, 280, 281, 282, 38, 284, 40, 41,
410 42, -1, 44, -1, 291, 258, 259, 260, 261, 262,
411 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
412 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
413 38, 284, 40, 41, 257, 258, 44, -1, 291, 257,
414 258, 259, 260, 261, 262, 263, -1, 265, 266, 267,
415 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
416 278, 279, 280, 281, 282, 283, 38, -1, 40, 41,
417 42, -1, 44, -1, -1, -1, -1, -1, -1, -1,
418 257, 258, 259, 260, 261, 262, 263, 59, 265, 266,
419 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
420 277, 278, 279, 280, 281, 282, 283, 41, -1, -1,
421 -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
422 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
423 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
424 282, 283, 38, -1, 40, -1, 42, -1, -1, 257,
425 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
426 -1, -1, -1, 59, -1, -1, -1, -1, 38, -1,
427 40, -1, 42, -1, -1, 283, -1, -1, -1, -1,
428 -1, 257, 258, -1, -1, -1, -1, -1, -1, 59,
429 -1, -1, -1, -1, -1, -1, 38, -1, 40, -1,
430 42, -1, -1, -1, -1, -1, -1, 283, -1, -1,
431 -1, -1, -1, -1, -1, 257, 258, 59, -1, -1,
432 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
433 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
434 -1, 283, -1, -1, -1, -1, -1, -1, -1, 257,
435 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
436 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
437 -1, -1, -1, -1, -1, 283, -1, -1, -1, -1,
438 -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
439 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
440 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
441 282, 283, -1, -1, -1, -1, -1, -1, -1, -1,
442 -1, -1, -1, -1, 258, 259, 260, 261, 262, 263,
443 -1, 265, 266, 267, 268, 269, 270, 271, 272, 273,
444 274, 275, 276, 277, 278, 279, 280, 281, 282, -1,
445 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
446 -1, 257, 258, 259, 260, 261, 262, 263, -1, 265,
447 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
448 276, 277, 278, 279, 280, 281, 282, 257, 258, 259,
449 260, 261, 262, 263, -1, 265, 266, 267, 268, 269,
450 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
451 280, 281, 282, -1, -1, 257, 258, 259, 260, 261,
452 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
453 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
454 282, 258, 259, 260, 261, 262, 263, 264, 265, 266,
455 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
456 277, 278, 279, 280, 281, 282, -1, -1, 258, 259,
457 260, 261, 262, 263, 291, 265, 266, 267, 268, 269,
458 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
459 280, 281, 282, -1, -1, -1, 286, 258, 259, 260,
460 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
461 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
462 281, 282, -1, 284, 258, 259, 260, 261, 262, 263,
463 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
464 274, 275, 276, 277, 278, 279, 280, 281, 282, 258,
465 259, 260, 261, 262, 263, -1, 265, 266, 267, 268,
466 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
473 #define YYMAXTOKEN 291
475 static const char *grammar_name[] = {
477 "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,
478 0,0,0,0,"'&'",0,"'('","')'","'*'",0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,
479 "'='",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,
480 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,
481 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,
482 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,
483 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,
484 "T_IDENTIFIER","T_TYPEDEF_NAME","T_DEFINE_NAME","T_AUTO","T_EXTERN",
485 "T_REGISTER","T_STATIC","T_TYPEDEF","T_INLINE","T_EXTENSION","T_CHAR",
486 "T_DOUBLE","T_FLOAT","T_INT","T_VOID","T_LONG","T_SHORT","T_SIGNED",
487 "T_UNSIGNED","T_ENUM","T_STRUCT","T_UNION","T_Bool","T_Complex","T_Imaginary",
488 "T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE","T_ELLIPSIS",
489 "T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL",
491 static const char *grammar_rule[] = {
494 "program : translation_unit",
495 "translation_unit : external_declaration",
496 "translation_unit : translation_unit external_declaration",
497 "external_declaration : declaration",
498 "external_declaration : function_definition",
499 "external_declaration : ';'",
500 "external_declaration : linkage_specification",
501 "external_declaration : T_ASM T_ASMARG ';'",
502 "external_declaration : error T_MATCHRBRACE",
503 "external_declaration : error ';'",
504 "braces : T_LBRACE T_MATCHRBRACE",
505 "linkage_specification : T_EXTERN T_STRING_LITERAL braces",
506 "linkage_specification : T_EXTERN T_STRING_LITERAL declaration",
507 "declaration : decl_specifiers ';'",
508 "declaration : decl_specifiers init_declarator_list ';'",
510 "declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';'",
511 "any_typedef : T_EXTENSION T_TYPEDEF",
512 "any_typedef : T_TYPEDEF",
513 "opt_declarator_list :",
514 "opt_declarator_list : declarator_list",
515 "declarator_list : declarator",
516 "declarator_list : declarator_list ',' declarator",
519 "function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE",
521 "function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE",
522 "opt_declaration_list :",
523 "opt_declaration_list : T_VA_DCL",
524 "opt_declaration_list : declaration_list",
525 "declaration_list : declaration",
526 "declaration_list : declaration_list declaration",
527 "decl_specifiers : decl_specifier",
528 "decl_specifiers : decl_specifiers decl_specifier",
529 "decl_specifier : storage_class",
530 "decl_specifier : type_specifier",
531 "decl_specifier : type_qualifier",
532 "storage_class : T_AUTO",
533 "storage_class : T_EXTERN",
534 "storage_class : T_REGISTER",
535 "storage_class : T_STATIC",
536 "storage_class : T_INLINE",
537 "storage_class : T_EXTENSION",
538 "type_specifier : T_CHAR",
539 "type_specifier : T_DOUBLE",
540 "type_specifier : T_FLOAT",
541 "type_specifier : T_INT",
542 "type_specifier : T_LONG",
543 "type_specifier : T_SHORT",
544 "type_specifier : T_SIGNED",
545 "type_specifier : T_UNSIGNED",
546 "type_specifier : T_VOID",
547 "type_specifier : T_Bool",
548 "type_specifier : T_Complex",
549 "type_specifier : T_Imaginary",
550 "type_specifier : T_TYPEDEF_NAME",
551 "type_specifier : struct_or_union_specifier",
552 "type_specifier : enum_specifier",
553 "type_qualifier : T_TYPE_QUALIFIER",
554 "type_qualifier : T_DEFINE_NAME",
555 "struct_or_union_specifier : struct_or_union any_id braces",
556 "struct_or_union_specifier : struct_or_union braces",
557 "struct_or_union_specifier : struct_or_union any_id",
558 "struct_or_union : T_STRUCT",
559 "struct_or_union : T_UNION",
560 "init_declarator_list : init_declarator",
561 "init_declarator_list : init_declarator_list ',' init_declarator",
562 "init_declarator : declarator",
564 "init_declarator : declarator '=' $$5 T_INITIALIZER",
565 "enum_specifier : enumeration any_id braces",
566 "enum_specifier : enumeration braces",
567 "enum_specifier : enumeration any_id",
568 "enumeration : T_ENUM",
569 "any_id : T_IDENTIFIER",
570 "any_id : T_TYPEDEF_NAME",
571 "declarator : pointer direct_declarator",
572 "declarator : direct_declarator",
573 "direct_declarator : identifier_or_ref",
574 "direct_declarator : '(' declarator ')'",
575 "direct_declarator : direct_declarator T_BRACKETS",
576 "direct_declarator : direct_declarator '(' parameter_type_list ')'",
577 "direct_declarator : direct_declarator '(' opt_identifier_list ')'",
578 "pointer : '*' opt_type_qualifiers",
579 "pointer : '*' opt_type_qualifiers pointer",
580 "opt_type_qualifiers :",
581 "opt_type_qualifiers : type_qualifier_list",
582 "type_qualifier_list : type_qualifier",
583 "type_qualifier_list : type_qualifier_list type_qualifier",
584 "parameter_type_list : parameter_list",
585 "parameter_type_list : parameter_list ',' T_ELLIPSIS",
586 "parameter_list : parameter_declaration",
587 "parameter_list : parameter_list ',' parameter_declaration",
588 "parameter_declaration : decl_specifiers declarator",
589 "parameter_declaration : decl_specifiers abs_declarator",
590 "parameter_declaration : decl_specifiers",
591 "opt_identifier_list :",
592 "opt_identifier_list : identifier_list",
593 "identifier_list : any_id",
594 "identifier_list : identifier_list ',' any_id",
595 "identifier_or_ref : any_id",
596 "identifier_or_ref : '&' any_id",
597 "abs_declarator : pointer",
598 "abs_declarator : pointer direct_abs_declarator",
599 "abs_declarator : direct_abs_declarator",
600 "direct_abs_declarator : '(' abs_declarator ')'",
601 "direct_abs_declarator : direct_abs_declarator T_BRACKETS",
602 "direct_abs_declarator : T_BRACKETS",
603 "direct_abs_declarator : direct_abs_declarator '(' parameter_type_list ')'",
604 "direct_abs_declarator : direct_abs_declarator '(' ')'",
605 "direct_abs_declarator : '(' parameter_type_list ')'",
606 "direct_abs_declarator : '(' ')'",
614 /* define the initial stack-sizes */
617 #define YYMAXDEPTH YYSTACKSIZE
620 #define YYSTACKSIZE YYMAXDEPTH
622 #define YYSTACKSIZE 500
623 #define YYMAXDEPTH 500
627 #define YYINITSTACKSIZE 500
638 /* variables for the parser stack */
640 static short *yysslim;
641 static YYSTYPE *yyvs;
642 static unsigned yystacksize;
643 #line 816 "grammar.y"
645 #if defined(__EMX__) || defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(vms)
656 yaccError (char *msg)
659 put_error(); /* tell what line we're on, and what file */
660 fprintf(stderr, "%s at token '%s'\n", msg, yytext);
663 /* Initialize the table of type qualifier keywords recognized by the lexical
669 static char *keywords[] = {
678 #if defined(MSDOS) || defined(OS2)
736 /* Initialize type qualifier table. */
737 type_qualifiers = new_symbol_table();
738 for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
739 new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE);
743 /* Process the C source file. Write function prototypes to the standard
744 * output. Convert function definitions and write the converted source
745 * code to a temporary file.
748 process_file (FILE *infile, char *name)
752 if (strlen(name) > 2) {
753 s = name + strlen(name) - 2;
756 if (*s == 'l' || *s == 'y')
758 #if defined(MSDOS) || defined(OS2)
759 if (*s == 'L' || *s == 'Y')
765 included_files = new_symbol_table();
766 typedef_names = new_symbol_table();
767 define_names = new_symbol_table();
773 include_file(strcpy(base_file, name), func_style != FUNC_NONE);
777 put_blankline(stdout);
781 put_string(stdout, "/* ");
782 put_string(stdout, cur_file_name());
783 put_string(stdout, " */\n");
786 free_symbol_table(define_names);
787 free_symbol_table(typedef_names);
788 free_symbol_table(included_files);
795 free_symbol_table (type_qualifiers);
797 if (yy_current_buffer != 0)
798 yy_delete_buffer(yy_current_buffer);
802 #line 803 "grammar.tab.c"
803 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
804 static int yygrowstack(void)
811 if ((newsize = yystacksize) == 0)
812 newsize = YYINITSTACKSIZE;
813 else if (newsize >= YYMAXDEPTH)
815 else if ((newsize *= 2) > YYMAXDEPTH)
816 newsize = YYMAXDEPTH;
820 ? (short *)realloc(yyss, newsize * sizeof(*newss))
821 : (short *)malloc(newsize * sizeof(*newss));
828 ? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs))
829 : (YYSTYPE *)malloc(newsize * sizeof(*newvs));
835 yystacksize = newsize;
836 yysslim = yyss + newsize - 1;
840 #define YYABORT goto yyabort
841 #define YYREJECT goto yyabort
842 #define YYACCEPT goto yyaccept
843 #define YYERROR goto yyerrlab
848 int yym, yyn, yystate;
852 if ((yys = getenv("YYDEBUG")) != 0)
855 if (yyn >= '0' && yyn <= '9')
865 if (yyss == NULL && yygrowstack()) goto yyoverflow;
872 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
875 if ((yychar = yylex()) < 0) yychar = 0;
880 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
881 if (!yys) yys = "illegal-symbol";
882 printf("%sdebug: state %d, reading %d (%s)\n",
883 YYPREFIX, yystate, yychar, yys);
887 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
888 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
892 printf("%sdebug: state %d, shifting to state %d\n",
893 YYPREFIX, yystate, yytable[yyn]);
895 if (yyssp >= yysslim && yygrowstack())
899 yystate = yytable[yyn];
900 *++yyssp = yytable[yyn];
903 if (yyerrflag > 0) --yyerrflag;
906 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
907 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
912 if (yyerrflag) goto yyinrecovery;
914 yyerror("syntax error");
927 if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
928 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
932 printf("%sdebug: state %d, error recovery shifting\
933 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
935 if (yyssp >= yysslim && yygrowstack())
939 yystate = yytable[yyn];
940 *++yyssp = yytable[yyn];
948 printf("%sdebug: error recovery discarding state %d\n",
951 if (yyssp <= yyss) goto yyabort;
959 if (yychar == 0) goto yyabort;
964 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
965 if (!yys) yys = "illegal-symbol";
966 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
967 YYPREFIX, yystate, yychar, yys);
977 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
978 YYPREFIX, yystate, yyn, yyrule[yyn]);
982 yyval = yyvsp[1-yym];
984 memset(&yyval, 0, sizeof yyval);
988 #line 179 "grammar.y"
994 #line 183 "grammar.y"
1000 #line 194 "grammar.y"
1002 /* Provide an empty action here so bison will not complain about
1003 * incompatible types in the default action it normally would
1009 #line 201 "grammar.y"
1015 #line 208 "grammar.y"
1018 if (types_out && want_typedef()) {
1019 gen_declarations(&yyvsp[-1].decl_spec, (DeclaratorList *)0);
1023 free_decl_spec(&yyvsp[-1].decl_spec);
1028 #line 219 "grammar.y"
1030 if (func_params != NULL) {
1031 set_param_types(func_params, &yyvsp[-2].decl_spec, &yyvsp[-1].decl_list);
1033 gen_declarations(&yyvsp[-2].decl_spec, &yyvsp[-1].decl_list);
1037 free_decl_list(&yyvsp[-1].decl_list);
1039 free_decl_spec(&yyvsp[-2].decl_spec);
1044 #line 233 "grammar.y"
1046 cur_decl_spec_flags = yyvsp[0].decl_spec.flags;
1047 free_decl_spec(&yyvsp[0].decl_spec);
1051 #line 238 "grammar.y"
1057 #line 245 "grammar.y"
1063 #line 249 "grammar.y"
1069 #line 261 "grammar.y"
1071 int flags = cur_decl_spec_flags;
1073 /* If the typedef is a pointer type, then reset the short type
1074 * flags so it does not get promoted.
1076 if (strcmp(yyvsp[0].declarator->text, yyvsp[0].declarator->name) != 0)
1077 flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
1078 new_symbol(typedef_names, yyvsp[0].declarator->name, NULL, flags);
1079 free_declarator(yyvsp[0].declarator);
1083 #line 273 "grammar.y"
1085 int flags = cur_decl_spec_flags;
1087 if (strcmp(yyvsp[0].declarator->text, yyvsp[0].declarator->name) != 0)
1088 flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
1089 new_symbol(typedef_names, yyvsp[0].declarator->name, NULL, flags);
1090 free_declarator(yyvsp[0].declarator);
1094 #line 285 "grammar.y"
1096 check_untagged(&yyvsp[-1].decl_spec);
1097 if (yyvsp[0].declarator->func_def == FUNC_NONE) {
1098 yyerror("syntax error");
1101 func_params = &(yyvsp[0].declarator->head->params);
1102 func_params->begin_comment = cur_file->begin_comment;
1103 func_params->end_comment = cur_file->end_comment;
1107 #line 296 "grammar.y"
1109 /* If we're converting to K&R and we've got a nominally K&R
1110 * function which has a parameter which is ANSI (i.e., a prototyped
1111 * function pointer), then we must override the deciphered value of
1112 * 'func_def' so that the parameter will be converted.
1114 if (func_style == FUNC_TRADITIONAL
1116 && yyvsp[-3].declarator->head->func_def == func_style) {
1117 yyvsp[-3].declarator->head->func_def = FUNC_BOTH;
1122 if (cur_file->convert)
1123 gen_func_definition(&yyvsp[-4].decl_spec, yyvsp[-3].declarator);
1124 gen_prototype(&yyvsp[-4].decl_spec, yyvsp[-3].declarator);
1128 free_decl_spec(&yyvsp[-4].decl_spec);
1129 free_declarator(yyvsp[-3].declarator);
1133 #line 321 "grammar.y"
1135 if (yyvsp[0].declarator->func_def == FUNC_NONE) {
1136 yyerror("syntax error");
1139 func_params = &(yyvsp[0].declarator->head->params);
1140 func_params->begin_comment = cur_file->begin_comment;
1141 func_params->end_comment = cur_file->end_comment;
1145 #line 331 "grammar.y"
1151 new_decl_spec(&decl_spec, dft_decl_spec(), yyvsp[-4].declarator->begin, DS_NONE);
1152 if (cur_file->convert)
1153 gen_func_definition(&decl_spec, yyvsp[-4].declarator);
1154 gen_prototype(&decl_spec, yyvsp[-4].declarator);
1158 free_decl_spec(&decl_spec);
1159 free_declarator(yyvsp[-4].declarator);
1163 #line 362 "grammar.y"
1165 join_decl_specs(&yyval.decl_spec, &yyvsp[-1].decl_spec, &yyvsp[0].decl_spec);
1166 free(yyvsp[-1].decl_spec.text);
1167 free(yyvsp[0].decl_spec.text);
1171 #line 377 "grammar.y"
1173 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1177 #line 381 "grammar.y"
1179 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_EXTERN);
1183 #line 385 "grammar.y"
1185 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1189 #line 389 "grammar.y"
1191 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_STATIC);
1195 #line 393 "grammar.y"
1197 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_INLINE);
1201 #line 397 "grammar.y"
1203 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_JUNK);
1207 #line 404 "grammar.y"
1209 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_CHAR);
1213 #line 408 "grammar.y"
1215 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1219 #line 412 "grammar.y"
1221 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_FLOAT);
1225 #line 416 "grammar.y"
1227 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1231 #line 420 "grammar.y"
1233 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1237 #line 424 "grammar.y"
1239 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_SHORT);
1243 #line 428 "grammar.y"
1245 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1249 #line 432 "grammar.y"
1251 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1255 #line 436 "grammar.y"
1257 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1261 #line 440 "grammar.y"
1263 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_CHAR);
1267 #line 444 "grammar.y"
1269 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1273 #line 448 "grammar.y"
1275 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1279 #line 452 "grammar.y"
1282 s = find_symbol(typedef_names, yyvsp[0].text.text);
1284 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, s->flags);
1288 #line 464 "grammar.y"
1290 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1294 #line 468 "grammar.y"
1296 /* This rule allows the <pointer> nonterminal to scan #define
1297 * names as if they were type modifiers.
1300 s = find_symbol(define_names, yyvsp[0].text.text);
1302 new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, s->flags);
1306 #line 481 "grammar.y"
1309 if ((s = implied_typedef()) == 0)
1310 (void)sprintf(s = buf, "%s %s", yyvsp[-2].text.text, yyvsp[-1].text.text);
1311 new_decl_spec(&yyval.decl_spec, s, yyvsp[-2].text.begin, DS_NONE);
1315 #line 488 "grammar.y"
1318 if ((s = implied_typedef()) == 0)
1319 (void)sprintf(s = buf, "%s {}", yyvsp[-1].text.text);
1320 new_decl_spec(&yyval.decl_spec, s, yyvsp[-1].text.begin, DS_NONE);
1324 #line 495 "grammar.y"
1326 (void)sprintf(buf, "%s %s", yyvsp[-1].text.text, yyvsp[0].text.text);
1327 new_decl_spec(&yyval.decl_spec, buf, yyvsp[-1].text.begin, DS_NONE);
1331 #line 503 "grammar.y"
1333 imply_typedef(yyval.text.text);
1337 #line 507 "grammar.y"
1339 imply_typedef(yyval.text.text);
1343 #line 514 "grammar.y"
1345 new_decl_list(&yyval.decl_list, yyvsp[0].declarator);
1349 #line 518 "grammar.y"
1351 add_decl_list(&yyval.decl_list, &yyvsp[-2].decl_list, yyvsp[0].declarator);
1355 #line 525 "grammar.y"
1357 if (yyvsp[0].declarator->func_def != FUNC_NONE && func_params == NULL &&
1358 func_style == FUNC_TRADITIONAL && cur_file->convert) {
1359 gen_func_declarator(yyvsp[0].declarator);
1360 fputs(cur_text(), cur_file->tmp_file);
1362 cur_declarator = yyval.declarator;
1366 #line 534 "grammar.y"
1368 if (yyvsp[-1].declarator->func_def != FUNC_NONE && func_params == NULL &&
1369 func_style == FUNC_TRADITIONAL && cur_file->convert) {
1370 gen_func_declarator(yyvsp[-1].declarator);
1371 fputs(" =", cur_file->tmp_file);
1376 #line 546 "grammar.y"
1379 if ((s = implied_typedef()) == 0)
1380 (void)sprintf(s = buf, "enum %s", yyvsp[-1].text.text);
1381 new_decl_spec(&yyval.decl_spec, s, yyvsp[-2].text.begin, DS_NONE);
1385 #line 553 "grammar.y"
1388 if ((s = implied_typedef()) == 0)
1389 (void)sprintf(s = buf, "%s {}", yyvsp[-1].text.text);
1390 new_decl_spec(&yyval.decl_spec, s, yyvsp[-1].text.begin, DS_NONE);
1394 #line 560 "grammar.y"
1396 (void)sprintf(buf, "enum %s", yyvsp[0].text.text);
1397 new_decl_spec(&yyval.decl_spec, buf, yyvsp[-1].text.begin, DS_NONE);
1401 #line 568 "grammar.y"
1403 imply_typedef("enum");
1404 yyval.text = yyvsp[0].text;
1408 #line 581 "grammar.y"
1410 yyval.declarator = yyvsp[0].declarator;
1411 (void)sprintf(buf, "%s%s", yyvsp[-1].text.text, yyval.declarator->text);
1412 free(yyval.declarator->text);
1413 yyval.declarator->text = xstrdup(buf);
1414 yyval.declarator->begin = yyvsp[-1].text.begin;
1415 yyval.declarator->pointer = TRUE;
1419 #line 594 "grammar.y"
1421 yyval.declarator = new_declarator(yyvsp[0].text.text, yyvsp[0].text.text, yyvsp[0].text.begin);
1425 #line 598 "grammar.y"
1427 yyval.declarator = yyvsp[-1].declarator;
1428 (void)sprintf(buf, "(%s)", yyval.declarator->text);
1429 free(yyval.declarator->text);
1430 yyval.declarator->text = xstrdup(buf);
1431 yyval.declarator->begin = yyvsp[-2].text.begin;
1435 #line 606 "grammar.y"
1437 yyval.declarator = yyvsp[-1].declarator;
1438 (void)sprintf(buf, "%s%s", yyval.declarator->text, yyvsp[0].text.text);
1439 free(yyval.declarator->text);
1440 yyval.declarator->text = xstrdup(buf);
1444 #line 613 "grammar.y"
1446 yyval.declarator = new_declarator("%s()", yyvsp[-3].declarator->name, yyvsp[-3].declarator->begin);
1447 yyval.declarator->params = yyvsp[-1].param_list;
1448 yyval.declarator->func_stack = yyvsp[-3].declarator;
1449 yyval.declarator->head = (yyvsp[-3].declarator->func_stack == NULL) ? yyval.declarator : yyvsp[-3].declarator->head;
1450 yyval.declarator->func_def = FUNC_ANSI;
1454 #line 621 "grammar.y"
1456 yyval.declarator = new_declarator("%s()", yyvsp[-3].declarator->name, yyvsp[-3].declarator->begin);
1457 yyval.declarator->params = yyvsp[-1].param_list;
1458 yyval.declarator->func_stack = yyvsp[-3].declarator;
1459 yyval.declarator->head = (yyvsp[-3].declarator->func_stack == NULL) ? yyval.declarator : yyvsp[-3].declarator->head;
1460 yyval.declarator->func_def = FUNC_TRADITIONAL;
1464 #line 632 "grammar.y"
1466 (void)sprintf(yyval.text.text, "*%s", yyvsp[0].text.text);
1467 yyval.text.begin = yyvsp[-1].text.begin;
1471 #line 637 "grammar.y"
1473 (void)sprintf(yyval.text.text, "*%s%s", yyvsp[-1].text.text, yyvsp[0].text.text);
1474 yyval.text.begin = yyvsp[-2].text.begin;
1478 #line 645 "grammar.y"
1480 strcpy(yyval.text.text, "");
1481 yyval.text.begin = 0L;
1485 #line 654 "grammar.y"
1487 (void)sprintf(yyval.text.text, "%s ", yyvsp[0].decl_spec.text);
1488 yyval.text.begin = yyvsp[0].decl_spec.begin;
1489 free(yyvsp[0].decl_spec.text);
1493 #line 660 "grammar.y"
1495 (void)sprintf(yyval.text.text, "%s%s ", yyvsp[-1].text.text, yyvsp[0].decl_spec.text);
1496 yyval.text.begin = yyvsp[-1].text.begin;
1497 free(yyvsp[0].decl_spec.text);
1501 #line 670 "grammar.y"
1503 add_ident_list(&yyval.param_list, &yyvsp[-2].param_list, "...");
1507 #line 677 "grammar.y"
1509 new_param_list(&yyval.param_list, yyvsp[0].parameter);
1513 #line 681 "grammar.y"
1515 add_param_list(&yyval.param_list, &yyvsp[-2].param_list, yyvsp[0].parameter);
1519 #line 688 "grammar.y"
1521 check_untagged(&yyvsp[-1].decl_spec);
1522 yyval.parameter = new_parameter(&yyvsp[-1].decl_spec, yyvsp[0].declarator);
1526 #line 693 "grammar.y"
1528 check_untagged(&yyvsp[-1].decl_spec);
1529 yyval.parameter = new_parameter(&yyvsp[-1].decl_spec, yyvsp[0].declarator);
1533 #line 698 "grammar.y"
1535 check_untagged(&yyvsp[0].decl_spec);
1536 yyval.parameter = new_parameter(&yyvsp[0].decl_spec, (Declarator *)0);
1540 #line 706 "grammar.y"
1542 new_ident_list(&yyval.param_list);
1546 #line 714 "grammar.y"
1548 new_ident_list(&yyval.param_list);
1549 add_ident_list(&yyval.param_list, &yyval.param_list, yyvsp[0].text.text);
1553 #line 719 "grammar.y"
1555 add_ident_list(&yyval.param_list, &yyvsp[-2].param_list, yyvsp[0].text.text);
1559 #line 726 "grammar.y"
1561 yyval.text = yyvsp[0].text;
1565 #line 730 "grammar.y"
1568 if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
1569 yyval.text = yyvsp[0].text;
1572 (void)sprintf(yyval.text.text, "&%s", yyvsp[0].text.text);
1573 yyval.text.begin = yyvsp[-1].text.begin;
1577 #line 743 "grammar.y"
1579 yyval.declarator = new_declarator(yyvsp[0].text.text, "", yyvsp[0].text.begin);
1583 #line 747 "grammar.y"
1585 yyval.declarator = yyvsp[0].declarator;
1586 (void)sprintf(buf, "%s%s", yyvsp[-1].text.text, yyval.declarator->text);
1587 free(yyval.declarator->text);
1588 yyval.declarator->text = xstrdup(buf);
1589 yyval.declarator->begin = yyvsp[-1].text.begin;
1593 #line 759 "grammar.y"
1595 yyval.declarator = yyvsp[-1].declarator;
1596 (void)sprintf(buf, "(%s)", yyval.declarator->text);
1597 free(yyval.declarator->text);
1598 yyval.declarator->text = xstrdup(buf);
1599 yyval.declarator->begin = yyvsp[-2].text.begin;
1603 #line 767 "grammar.y"
1605 yyval.declarator = yyvsp[-1].declarator;
1606 (void)sprintf(buf, "%s%s", yyval.declarator->text, yyvsp[0].text.text);
1607 free(yyval.declarator->text);
1608 yyval.declarator->text = xstrdup(buf);
1612 #line 774 "grammar.y"
1614 yyval.declarator = new_declarator(yyvsp[0].text.text, "", yyvsp[0].text.begin);
1618 #line 778 "grammar.y"
1620 yyval.declarator = new_declarator("%s()", "", yyvsp[-3].declarator->begin);
1621 yyval.declarator->params = yyvsp[-1].param_list;
1622 yyval.declarator->func_stack = yyvsp[-3].declarator;
1623 yyval.declarator->head = (yyvsp[-3].declarator->func_stack == NULL) ? yyval.declarator : yyvsp[-3].declarator->head;
1624 yyval.declarator->func_def = FUNC_ANSI;
1628 #line 786 "grammar.y"
1630 yyval.declarator = new_declarator("%s()", "", yyvsp[-2].declarator->begin);
1631 yyval.declarator->func_stack = yyvsp[-2].declarator;
1632 yyval.declarator->head = (yyvsp[-2].declarator->func_stack == NULL) ? yyval.declarator : yyvsp[-2].declarator->head;
1633 yyval.declarator->func_def = FUNC_ANSI;
1637 #line 793 "grammar.y"
1641 d = new_declarator("", "", yyvsp[-2].text.begin);
1642 yyval.declarator = new_declarator("%s()", "", yyvsp[-2].text.begin);
1643 yyval.declarator->params = yyvsp[-1].param_list;
1644 yyval.declarator->func_stack = d;
1645 yyval.declarator->head = yyval.declarator;
1646 yyval.declarator->func_def = FUNC_ANSI;
1650 #line 804 "grammar.y"
1654 d = new_declarator("", "", yyvsp[-1].text.begin);
1655 yyval.declarator = new_declarator("%s()", "", yyvsp[-1].text.begin);
1656 yyval.declarator->func_stack = d;
1657 yyval.declarator->head = yyval.declarator;
1658 yyval.declarator->func_def = FUNC_ANSI;
1661 #line 1662 "grammar.tab.c"
1667 if (yystate == 0 && yym == 0)
1671 printf("%sdebug: after reduction, shifting from state 0 to\
1672 state %d\n", YYPREFIX, YYFINAL);
1679 if ((yychar = yylex()) < 0) yychar = 0;
1684 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1685 if (!yys) yys = "illegal-symbol";
1686 printf("%sdebug: state %d, reading %d (%s)\n",
1687 YYPREFIX, YYFINAL, yychar, yys);
1691 if (yychar == 0) goto yyaccept;
1694 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
1695 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
1696 yystate = yytable[yyn];
1698 yystate = yydgoto[yym];
1701 printf("%sdebug: after reduction, shifting from state %d \
1702 to state %d\n", YYPREFIX, *yyssp, yystate);
1704 if (yyssp >= yysslim && yygrowstack())
1708 *++yyssp = (short) yystate;
1713 yyerror("yacc stack overflow");