4 static const char yysccsid
[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
15 #define yyclearin (yychar = YYEMPTY)
16 #define yyerrok (yyerrflag = 0)
17 #define YYRECOVERING() (yyerrflag != 0)
19 /* compatibility with bison */
21 /* compatibility with FreeBSD */
22 #ifdef YYPARSE_PARAM_TYPE
23 #define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
25 #define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
28 #define YYPARSE_DECL() yyparse(void)
29 #endif /* YYPARSE_PARAM */
31 extern int YYPARSE_DECL();
33 static int yygrowstack(void);
34 #define yyparse grammar_parse
35 #define yylex grammar_lex
36 #define yyerror grammar_error
37 #define yychar grammar_char
38 #define yyval grammar_val
39 #define yylval grammar_lval
40 #define yydebug grammar_debug
41 #define yynerrs grammar_nerrs
42 #define yyerrflag grammar_errflag
43 #define yyss grammar_ss
44 #define yyssp grammar_ssp
45 #define yyvs grammar_vs
46 #define yyvsp grammar_vsp
47 #define yylhs grammar_lhs
48 #define yylen grammar_len
49 #define yydefred grammar_defred
50 #define yydgoto grammar_dgoto
51 #define yysindex grammar_sindex
52 #define yyrindex grammar_rindex
53 #define yygindex grammar_gindex
54 #define yytable grammar_table
55 #define yycheck grammar_check
56 #define yyname grammar_name
57 #define yyrule grammar_rule
58 #define YYPREFIX "grammar_"
66 #define YYMAXDEPTH 150
68 extern int yylex (void);
70 /* declaration specifier attributes for the typedef statement currently being
73 static int cur_decl_spec_flags
;
75 /* pointer to parameter list for the current function definition */
76 static ParameterList
*func_params
;
78 /* A parser semantic action sets this pointer to the current declarator in
79 * a function parameter declaration in order to catch any comments following
80 * the parameter declaration on the same line. If the lexer scans a comment
81 * and <cur_declarator> is not NULL, then the comment is attached to the
82 * declarator. To ignore subsequent comments, the lexer sets this to NULL
83 * after scanning a comment or end of line.
85 static Declarator
*cur_declarator
;
87 /* temporary string buffer */
88 static char buf
[MAX_TEXT_SIZE
];
90 /* table of typedef names */
91 static SymbolTable
*typedef_names
;
93 /* table of define names */
94 static SymbolTable
*define_names
;
96 /* table of type qualifiers */
97 static SymbolTable
*type_qualifiers
;
99 /* information about the current input file */
101 char *base_name
; /* base input file name */
102 char *file_name
; /* current file name */
103 FILE *file
; /* input file */
104 unsigned line_num
; /* current line number in input file */
105 FILE *tmp_file
; /* temporary file */
106 long begin_comment
; /* tmp file offset after last written ) or ; */
107 long end_comment
; /* tmp file offset after last comment */
108 boolean convert
; /* if TRUE, convert function definitions */
109 boolean changed
; /* TRUE if conversion done in this file */
112 static IncludeStack
*cur_file
; /* current input file */
116 static int haveAnsiParam (void);
119 /* Flags to enable us to find if a procedure returns a value.
121 static int return_val
, /* nonzero on BRACES iff return-expression found */
122 returned_at
; /* marker for token-number to set 'return_val' */
125 static char *dft_decl_spec (void);
130 return (lintLibrary() && !return_val
) ? "void" : "int";
134 #define dft_decl_spec() "int"
141 if (func_params
!= 0) {
142 for (p
= func_params
->first
; p
!= 0; p
= p
->next
) {
143 if (p
->declarator
->func_def
== FUNC_ANSI
) {
150 #line 149 "grammar.tab.c"
151 #define T_IDENTIFIER 257
152 #define T_TYPEDEF_NAME 258
153 #define T_DEFINE_NAME 259
156 #define T_REGISTER 262
158 #define T_TYPEDEF 264
160 #define T_EXTENSION 266
169 #define T_UNSIGNED 275
174 #define T_Complex 280
175 #define T_Imaginary 281
176 #define T_TYPE_QUALIFIER 282
177 #define T_BRACKETS 283
179 #define T_MATCHRBRACE 285
180 #define T_ELLIPSIS 286
181 #define T_INITIALIZER 287
182 #define T_STRING_LITERAL 288
186 #define YYERRCODE 256
187 static const short grammar_lhs
[] = { -1,
188 0, 0, 26, 26, 27, 27, 27, 27, 27, 27,
189 27, 31, 30, 30, 28, 28, 34, 28, 32, 32,
190 33, 33, 35, 35, 37, 38, 29, 39, 29, 36,
191 36, 36, 40, 40, 1, 1, 2, 2, 2, 3,
192 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
193 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
194 5, 5, 6, 6, 6, 19, 19, 8, 8, 9,
195 41, 9, 7, 7, 7, 25, 23, 23, 10, 10,
196 11, 11, 11, 11, 11, 20, 20, 21, 21, 22,
197 22, 14, 14, 15, 15, 16, 16, 16, 17, 17,
198 18, 18, 24, 24, 12, 12, 12, 13, 13, 13,
201 static const short grammar_len
[] = { 2,
202 0, 1, 1, 2, 1, 1, 1, 1, 3, 2,
203 2, 2, 3, 3, 2, 3, 0, 5, 2, 1,
204 0, 1, 1, 3, 0, 0, 7, 0, 5, 0,
205 1, 1, 1, 2, 1, 2, 1, 1, 1, 1,
206 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
207 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208 1, 1, 3, 2, 2, 1, 1, 1, 3, 1,
209 0, 4, 3, 2, 2, 1, 1, 1, 2, 1,
210 1, 3, 2, 4, 4, 2, 3, 0, 1, 1,
211 2, 1, 3, 1, 3, 2, 2, 1, 0, 1,
212 1, 3, 1, 2, 1, 2, 1, 3, 2, 1,
215 static const short grammar_defred
[] = { 0,
216 0, 0, 0, 0, 77, 0, 62, 40, 0, 42,
217 43, 20, 44, 0, 46, 47, 48, 49, 54, 50,
218 51, 52, 53, 76, 66, 67, 55, 56, 57, 61,
219 0, 7, 0, 0, 35, 37, 38, 39, 59, 60,
220 28, 0, 0, 0, 103, 81, 0, 0, 3, 5,
221 6, 8, 0, 10, 11, 78, 0, 90, 0, 0,
222 104, 0, 19, 0, 41, 45, 15, 36, 0, 68,
223 0, 0, 0, 83, 0, 0, 64, 0, 0, 74,
224 4, 58, 0, 82, 87, 91, 0, 14, 13, 9,
225 16, 0, 71, 0, 31, 33, 0, 0, 0, 0,
226 0, 94, 0, 0, 101, 12, 63, 73, 0, 0,
227 69, 0, 0, 0, 34, 0, 110, 96, 97, 0,
228 0, 84, 0, 85, 0, 23, 0, 0, 72, 26,
229 29, 114, 0, 0, 0, 109, 0, 93, 95, 102,
230 18, 0, 0, 108, 113, 112, 0, 24, 27, 111,
232 static const short grammar_dgoto
[] = { 33,
233 87, 35, 36, 37, 38, 39, 40, 69, 70, 41,
234 42, 119, 120, 100, 101, 102, 103, 104, 43, 44,
235 59, 60, 45, 46, 47, 48, 49, 50, 51, 52,
236 77, 53, 127, 109, 128, 97, 94, 143, 72, 98,
239 static const short grammar_sindex
[] = { -2,
240 -3, 27, -239, -177, 0, 0, 0, 0, -274, 0,
241 0, 0, 0, -246, 0, 0, 0, 0, 0, 0,
242 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
243 -266, 0, 0, 455, 0, 0, 0, 0, 0, 0,
244 0, -35, -245, 128, 0, 0, -245, -2, 0, 0,
245 0, 0, 642, 0, 0, 0, -15, 0, -12, -239,
246 0, 590, 0, -27, 0, 0, 0, 0, -10, 0,
247 -11, 534, -72, 0, -237, -232, 0, -35, -232, 0,
248 0, 0, 642, 0, 0, 0, 455, 0, 0, 0,
249 0, 27, 0, 534, 0, 0, -222, 617, 209, 34,
250 39, 0, 44, 42, 0, 0, 0, 0, 27, -11,
251 0, -200, -196, -195, 0, 174, 0, 0, 0, -33,
252 243, 0, 561, 0, -177, 0, 33, 49, 0, 0,
253 0, 0, 53, 55, 417, 0, -33, 0, 0, 0,
254 0, 27, -188, 0, 0, 0, 57, 0, 0, 0,
256 static const short grammar_rindex
[] = { 99,
257 0, 0, 275, 0, 0, -38, 0, 0, 481, 0,
258 0, 0, 0, 509, 0, 0, 0, 0, 0, 0,
259 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
260 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
261 0, 30, 0, 0, 0, 0, 0, 101, 0, 0,
262 0, 0, 0, 0, 0, 0, 0, 0, 343, 309,
263 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
264 98, -182, 62, 0, 0, 133, 0, 64, 379, 0,
265 0, 0, -5, 0, 0, 0, 0, 0, 0, 0,
266 0, 0, 0, -182, 0, 0, 0, -180, -19, 0,
267 65, 0, 0, 68, 0, 0, 0, 0, 51, 9,
268 0, 0, 0, 0, 0, 0, 0, 0, 0, -13,
269 19, 0, 0, 0, 0, 0, 0, 52, 0, 0,
270 0, 0, 0, 0, 0, 0, 35, 0, 0, 0,
271 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
273 static const short grammar_gindex
[] = { 0,
274 11, -17, 0, 0, 13, 0, 0, 0, 20, 8,
275 -43, -1, -8, -89, 0, -9, 0, 0, 0, -44,
276 0, 0, 4, 0, 0, 0, 70, -53, 0, 0,
277 -18, 0, 0, 0, 0, 22, 0, 0, 0, 0,
280 #define YYTABLESIZE 924
281 static const short grammar_table
[] = { 58,
282 78, 58, 58, 58, 73, 58, 135, 61, 88, 57,
283 34, 5, 56, 62, 85, 58, 68, 63, 96, 7,
284 58, 98, 78, 64, 98, 84, 134, 107, 80, 3,
285 107, 90, 17, 92, 17, 4, 17, 2, 75, 3,
286 96, 71, 30, 89, 115, 147, 76, 106, 91, 93,
287 79, 75, 70, 17, 121, 55, 32, 107, 34, 105,
288 108, 114, 105, 83, 4, 68, 2, 70, 3, 68,
289 80, 121, 86, 80, 122, 106, 105, 78, 106, 5,
290 56, 68, 123, 99, 124, 125, 129, 130, 80, 131,
291 80, 141, 142, 144, 110, 145, 149, 150, 1, 110,
292 2, 30, 99, 32, 79, 92, 118, 79, 100, 21,
293 22, 111, 137, 139, 133, 113, 126, 81, 0, 0,
294 0, 0, 79, 57, 79, 0, 99, 0, 140, 0,
295 0, 0, 0, 99, 0, 0, 0, 0, 0, 0,
296 0, 70, 0, 0, 0, 99, 0, 0, 0, 148,
297 0, 0, 0, 0, 0, 0, 70, 0, 0, 0,
298 0, 0, 0, 0, 0, 4, 0, 2, 0, 0,
299 65, 0, 65, 65, 65, 0, 65, 0, 0, 0,
300 0, 0, 0, 0, 5, 6, 7, 8, 65, 10,
301 11, 65, 13, 66, 15, 16, 17, 18, 19, 20,
302 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
303 0, 4, 0, 116, 132, 3, 0, 0, 58, 58,
304 58, 58, 58, 58, 58, 78, 58, 58, 58, 58,
305 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
306 58, 58, 58, 58, 58, 78, 4, 74, 116, 136,
307 3, 17, 78, 1, 5, 6, 7, 8, 9, 10,
308 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
309 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
310 4, 54, 116, 5, 56, 0, 31, 80, 80, 80,
311 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
312 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
313 80, 80, 88, 80, 88, 88, 88, 0, 88, 0,
314 80, 79, 79, 79, 79, 79, 79, 79, 79, 79,
315 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
316 79, 79, 79, 79, 79, 79, 89, 79, 89, 89,
317 89, 0, 89, 0, 79, 25, 25, 25, 25, 25,
318 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
319 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
320 86, 25, 86, 86, 5, 56, 86, 0, 25, 65,
321 65, 65, 65, 65, 65, 65, 0, 65, 65, 65,
322 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
323 65, 65, 65, 65, 65, 65, 75, 0, 75, 75,
324 75, 0, 75, 0, 0, 0, 0, 0, 0, 0,
325 5, 6, 7, 8, 65, 10, 11, 75, 13, 66,
326 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
327 25, 26, 27, 28, 29, 30, 117, 146, 0, 0,
328 0, 0, 0, 0, 0, 5, 6, 7, 8, 65,
329 10, 11, 0, 13, 66, 15, 16, 17, 18, 19,
330 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
331 30, 117, 4, 0, 2, 0, 3, 0, 0, 5,
332 56, 0, 0, 0, 0, 0, 0, 0, 0, 0,
333 0, 0, 0, 67, 0, 0, 0, 0, 41, 0,
334 41, 0, 41, 0, 0, 117, 0, 0, 0, 0,
335 0, 88, 88, 0, 0, 0, 0, 0, 0, 41,
336 0, 0, 0, 0, 0, 0, 45, 0, 45, 0,
337 45, 0, 0, 0, 0, 0, 0, 88, 0, 0,
338 0, 0, 0, 0, 0, 89, 89, 45, 0, 0,
339 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
340 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
341 0, 89, 0, 0, 0, 0, 0, 0, 0, 86,
342 86, 0, 0, 0, 0, 0, 0, 0, 0, 0,
343 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
344 0, 0, 0, 0, 0, 86, 0, 0, 0, 0,
345 0, 0, 0, 0, 0, 75, 75, 75, 75, 75,
346 75, 75, 0, 75, 75, 75, 75, 75, 75, 75,
347 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
348 75, 75, 0, 0, 0, 0, 0, 0, 0, 0,
349 0, 0, 0, 0, 82, 7, 8, 65, 10, 11,
350 0, 13, 66, 15, 16, 17, 18, 19, 20, 21,
351 22, 23, 24, 25, 26, 27, 28, 29, 30, 0,
352 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
353 0, 5, 6, 7, 8, 65, 10, 11, 0, 13,
354 66, 15, 16, 17, 18, 19, 20, 21, 22, 23,
355 24, 25, 26, 27, 28, 29, 30, 41, 41, 41,
356 41, 41, 41, 41, 0, 41, 41, 41, 41, 41,
357 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
358 41, 41, 41, 0, 0, 45, 45, 45, 45, 45,
359 45, 45, 0, 45, 45, 45, 45, 45, 45, 45,
360 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
361 45, 82, 7, 8, 65, 10, 11, 12, 13, 14,
362 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
363 25, 26, 27, 28, 29, 30, 0, 0, 82, 7,
364 8, 65, 10, 11, 95, 13, 66, 15, 16, 17,
365 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
366 28, 29, 30, 0, 0, 0, 138, 82, 7, 8,
367 65, 10, 11, 12, 13, 14, 15, 16, 17, 18,
368 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
369 29, 30, 0, 75, 82, 7, 8, 65, 10, 11,
370 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
371 22, 23, 24, 25, 26, 27, 28, 29, 30, 82,
372 7, 8, 65, 10, 11, 0, 13, 66, 15, 16,
373 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
376 static const short grammar_check
[] = { 38,
377 44, 40, 41, 42, 40, 44, 40, 4, 62, 2,
378 0, 257, 258, 288, 59, 3, 34, 264, 72, 259,
379 59, 41, 61, 290, 44, 41, 116, 41, 47, 42,
380 44, 59, 38, 44, 40, 38, 42, 40, 284, 42,
381 94, 34, 282, 62, 98, 135, 43, 285, 59, 61,
382 47, 284, 44, 59, 99, 59, 59, 76, 48, 41,
383 79, 284, 44, 53, 38, 83, 40, 59, 42, 87,
384 41, 116, 60, 44, 41, 41, 73, 121, 44, 257,
385 258, 99, 44, 73, 41, 44, 287, 284, 59, 285,
386 61, 59, 44, 41, 87, 41, 285, 41, 0, 92,
387 0, 284, 41, 284, 41, 41, 99, 44, 41, 59,
388 59, 92, 121, 123, 116, 94, 109, 48, -1, -1,
389 -1, -1, 59, 116, 61, -1, 116, -1, 125, -1,
390 -1, -1, -1, 123, -1, -1, -1, -1, -1, -1,
391 -1, 44, -1, -1, -1, 135, -1, -1, -1, 142,
392 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
393 -1, -1, -1, -1, -1, 38, -1, 40, -1, -1,
394 38, -1, 40, 41, 42, -1, 44, -1, -1, -1,
395 -1, -1, -1, -1, 257, 258, 259, 260, 261, 262,
396 263, 59, 265, 266, 267, 268, 269, 270, 271, 272,
397 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
398 -1, 38, -1, 40, 41, 42, -1, -1, 257, 258,
399 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
400 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
401 279, 280, 281, 282, 283, 284, 38, 283, 40, 283,
402 42, 257, 291, 256, 257, 258, 259, 260, 261, 262,
403 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
404 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
405 38, 285, 40, 257, 258, -1, 289, 258, 259, 260,
406 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
407 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
408 281, 282, 38, 284, 40, 41, 42, -1, 44, -1,
409 291, 258, 259, 260, 261, 262, 263, 264, 265, 266,
410 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
411 277, 278, 279, 280, 281, 282, 38, 284, 40, 41,
412 42, -1, 44, -1, 291, 258, 259, 260, 261, 262,
413 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
414 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
415 38, 284, 40, 41, 257, 258, 44, -1, 291, 257,
416 258, 259, 260, 261, 262, 263, -1, 265, 266, 267,
417 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
418 278, 279, 280, 281, 282, 283, 38, -1, 40, 41,
419 42, -1, 44, -1, -1, -1, -1, -1, -1, -1,
420 257, 258, 259, 260, 261, 262, 263, 59, 265, 266,
421 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
422 277, 278, 279, 280, 281, 282, 283, 41, -1, -1,
423 -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
424 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
425 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
426 282, 283, 38, -1, 40, -1, 42, -1, -1, 257,
427 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
428 -1, -1, -1, 59, -1, -1, -1, -1, 38, -1,
429 40, -1, 42, -1, -1, 283, -1, -1, -1, -1,
430 -1, 257, 258, -1, -1, -1, -1, -1, -1, 59,
431 -1, -1, -1, -1, -1, -1, 38, -1, 40, -1,
432 42, -1, -1, -1, -1, -1, -1, 283, -1, -1,
433 -1, -1, -1, -1, -1, 257, 258, 59, -1, -1,
434 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
435 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
436 -1, 283, -1, -1, -1, -1, -1, -1, -1, 257,
437 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
438 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
439 -1, -1, -1, -1, -1, 283, -1, -1, -1, -1,
440 -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
441 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
442 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
443 282, 283, -1, -1, -1, -1, -1, -1, -1, -1,
444 -1, -1, -1, -1, 258, 259, 260, 261, 262, 263,
445 -1, 265, 266, 267, 268, 269, 270, 271, 272, 273,
446 274, 275, 276, 277, 278, 279, 280, 281, 282, -1,
447 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
448 -1, 257, 258, 259, 260, 261, 262, 263, -1, 265,
449 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
450 276, 277, 278, 279, 280, 281, 282, 257, 258, 259,
451 260, 261, 262, 263, -1, 265, 266, 267, 268, 269,
452 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
453 280, 281, 282, -1, -1, 257, 258, 259, 260, 261,
454 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
455 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
456 282, 258, 259, 260, 261, 262, 263, 264, 265, 266,
457 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
458 277, 278, 279, 280, 281, 282, -1, -1, 258, 259,
459 260, 261, 262, 263, 291, 265, 266, 267, 268, 269,
460 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
461 280, 281, 282, -1, -1, -1, 286, 258, 259, 260,
462 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
463 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
464 281, 282, -1, 284, 258, 259, 260, 261, 262, 263,
465 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
466 274, 275, 276, 277, 278, 279, 280, 281, 282, 258,
467 259, 260, 261, 262, 263, -1, 265, 266, 267, 268,
468 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
475 #define YYMAXTOKEN 291
477 static const char *grammar_name
[] = {
479 "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,
480 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,
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,0,0,
484 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,
485 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,
486 "T_IDENTIFIER","T_TYPEDEF_NAME","T_DEFINE_NAME","T_AUTO","T_EXTERN",
487 "T_REGISTER","T_STATIC","T_TYPEDEF","T_INLINE","T_EXTENSION","T_CHAR",
488 "T_DOUBLE","T_FLOAT","T_INT","T_VOID","T_LONG","T_SHORT","T_SIGNED",
489 "T_UNSIGNED","T_ENUM","T_STRUCT","T_UNION","T_Bool","T_Complex","T_Imaginary",
490 "T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE","T_ELLIPSIS",
491 "T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL",
493 static const char *grammar_rule
[] = {
496 "program : translation_unit",
497 "translation_unit : external_declaration",
498 "translation_unit : translation_unit external_declaration",
499 "external_declaration : declaration",
500 "external_declaration : function_definition",
501 "external_declaration : ';'",
502 "external_declaration : linkage_specification",
503 "external_declaration : T_ASM T_ASMARG ';'",
504 "external_declaration : error T_MATCHRBRACE",
505 "external_declaration : error ';'",
506 "braces : T_LBRACE T_MATCHRBRACE",
507 "linkage_specification : T_EXTERN T_STRING_LITERAL braces",
508 "linkage_specification : T_EXTERN T_STRING_LITERAL declaration",
509 "declaration : decl_specifiers ';'",
510 "declaration : decl_specifiers init_declarator_list ';'",
512 "declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';'",
513 "any_typedef : T_EXTENSION T_TYPEDEF",
514 "any_typedef : T_TYPEDEF",
515 "opt_declarator_list :",
516 "opt_declarator_list : declarator_list",
517 "declarator_list : declarator",
518 "declarator_list : declarator_list ',' declarator",
521 "function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE",
523 "function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE",
524 "opt_declaration_list :",
525 "opt_declaration_list : T_VA_DCL",
526 "opt_declaration_list : declaration_list",
527 "declaration_list : declaration",
528 "declaration_list : declaration_list declaration",
529 "decl_specifiers : decl_specifier",
530 "decl_specifiers : decl_specifiers decl_specifier",
531 "decl_specifier : storage_class",
532 "decl_specifier : type_specifier",
533 "decl_specifier : type_qualifier",
534 "storage_class : T_AUTO",
535 "storage_class : T_EXTERN",
536 "storage_class : T_REGISTER",
537 "storage_class : T_STATIC",
538 "storage_class : T_INLINE",
539 "storage_class : T_EXTENSION",
540 "type_specifier : T_CHAR",
541 "type_specifier : T_DOUBLE",
542 "type_specifier : T_FLOAT",
543 "type_specifier : T_INT",
544 "type_specifier : T_LONG",
545 "type_specifier : T_SHORT",
546 "type_specifier : T_SIGNED",
547 "type_specifier : T_UNSIGNED",
548 "type_specifier : T_VOID",
549 "type_specifier : T_Bool",
550 "type_specifier : T_Complex",
551 "type_specifier : T_Imaginary",
552 "type_specifier : T_TYPEDEF_NAME",
553 "type_specifier : struct_or_union_specifier",
554 "type_specifier : enum_specifier",
555 "type_qualifier : T_TYPE_QUALIFIER",
556 "type_qualifier : T_DEFINE_NAME",
557 "struct_or_union_specifier : struct_or_union any_id braces",
558 "struct_or_union_specifier : struct_or_union braces",
559 "struct_or_union_specifier : struct_or_union any_id",
560 "struct_or_union : T_STRUCT",
561 "struct_or_union : T_UNION",
562 "init_declarator_list : init_declarator",
563 "init_declarator_list : init_declarator_list ',' init_declarator",
564 "init_declarator : declarator",
566 "init_declarator : declarator '=' $$5 T_INITIALIZER",
567 "enum_specifier : enumeration any_id braces",
568 "enum_specifier : enumeration braces",
569 "enum_specifier : enumeration any_id",
570 "enumeration : T_ENUM",
571 "any_id : T_IDENTIFIER",
572 "any_id : T_TYPEDEF_NAME",
573 "declarator : pointer direct_declarator",
574 "declarator : direct_declarator",
575 "direct_declarator : identifier_or_ref",
576 "direct_declarator : '(' declarator ')'",
577 "direct_declarator : direct_declarator T_BRACKETS",
578 "direct_declarator : direct_declarator '(' parameter_type_list ')'",
579 "direct_declarator : direct_declarator '(' opt_identifier_list ')'",
580 "pointer : '*' opt_type_qualifiers",
581 "pointer : '*' opt_type_qualifiers pointer",
582 "opt_type_qualifiers :",
583 "opt_type_qualifiers : type_qualifier_list",
584 "type_qualifier_list : type_qualifier",
585 "type_qualifier_list : type_qualifier_list type_qualifier",
586 "parameter_type_list : parameter_list",
587 "parameter_type_list : parameter_list ',' T_ELLIPSIS",
588 "parameter_list : parameter_declaration",
589 "parameter_list : parameter_list ',' parameter_declaration",
590 "parameter_declaration : decl_specifiers declarator",
591 "parameter_declaration : decl_specifiers abs_declarator",
592 "parameter_declaration : decl_specifiers",
593 "opt_identifier_list :",
594 "opt_identifier_list : identifier_list",
595 "identifier_list : any_id",
596 "identifier_list : identifier_list ',' any_id",
597 "identifier_or_ref : any_id",
598 "identifier_or_ref : '&' any_id",
599 "abs_declarator : pointer",
600 "abs_declarator : pointer direct_abs_declarator",
601 "abs_declarator : direct_abs_declarator",
602 "direct_abs_declarator : '(' abs_declarator ')'",
603 "direct_abs_declarator : direct_abs_declarator T_BRACKETS",
604 "direct_abs_declarator : T_BRACKETS",
605 "direct_abs_declarator : direct_abs_declarator '(' parameter_type_list ')'",
606 "direct_abs_declarator : direct_abs_declarator '(' ')'",
607 "direct_abs_declarator : '(' parameter_type_list ')'",
608 "direct_abs_declarator : '(' ')'",
616 /* define the initial stack-sizes */
619 #define YYMAXDEPTH YYSTACKSIZE
622 #define YYSTACKSIZE YYMAXDEPTH
624 #define YYSTACKSIZE 500
625 #define YYMAXDEPTH 500
629 #define YYINITSTACKSIZE 500
640 /* variables for the parser stack */
642 static short *yysslim
;
643 static YYSTYPE
*yyvs
;
644 static unsigned yystacksize
;
645 #line 816 "grammar.y"
647 #if defined(__EMX__) || defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(vms)
658 yaccError (char *msg
)
661 put_error(); /* tell what line we're on, and what file */
662 fprintf(stderr
, "%s at token '%s'\n", msg
, yytext
);
665 /* Initialize the table of type qualifier keywords recognized by the lexical
671 static char *keywords
[] = {
680 #if defined(MSDOS) || defined(OS2)
738 /* Initialize type qualifier table. */
739 type_qualifiers
= new_symbol_table();
740 for (i
= 0; i
< sizeof(keywords
)/sizeof(keywords
[0]); ++i
) {
741 new_symbol(type_qualifiers
, keywords
[i
], NULL
, DS_NONE
);
745 /* Process the C source file. Write function prototypes to the standard
746 * output. Convert function definitions and write the converted source
747 * code to a temporary file.
750 process_file (FILE *infile
, char *name
)
754 if (strlen(name
) > 2) {
755 s
= name
+ strlen(name
) - 2;
758 if (*s
== 'l' || *s
== 'y')
760 #if defined(MSDOS) || defined(OS2)
761 if (*s
== 'L' || *s
== 'Y')
767 included_files
= new_symbol_table();
768 typedef_names
= new_symbol_table();
769 define_names
= new_symbol_table();
775 include_file(strcpy(base_file
, name
), func_style
!= FUNC_NONE
);
779 put_blankline(stdout
);
783 put_string(stdout
, "/* ");
784 put_string(stdout
, cur_file_name());
785 put_string(stdout
, " */\n");
788 free_symbol_table(define_names
);
789 free_symbol_table(typedef_names
);
790 free_symbol_table(included_files
);
797 free_symbol_table (type_qualifiers
);
799 if (yy_current_buffer
!= 0)
800 yy_delete_buffer(yy_current_buffer
);
804 #line 803 "grammar.tab.c"
805 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
806 static int yygrowstack(void)
813 if ((newsize
= yystacksize
) == 0)
814 newsize
= YYINITSTACKSIZE
;
815 else if (newsize
>= YYMAXDEPTH
)
817 else if ((newsize
*= 2) > YYMAXDEPTH
)
818 newsize
= YYMAXDEPTH
;
822 ? (short *)realloc(yyss
, newsize
* sizeof(*newss
))
823 : (short *)malloc(newsize
* sizeof(*newss
));
830 ? (YYSTYPE
*)realloc(yyvs
, newsize
* sizeof(*newvs
))
831 : (YYSTYPE
*)malloc(newsize
* sizeof(*newvs
));
837 yystacksize
= newsize
;
838 yysslim
= yyss
+ newsize
- 1;
842 #define YYABORT goto yyabort
843 #define YYREJECT goto yyabort
844 #define YYACCEPT goto yyaccept
845 #define YYERROR goto yyerrlab
850 int yym
, yyn
, yystate
;
854 if ((yys
= getenv("YYDEBUG")) != 0)
857 if (yyn
>= '0' && yyn
<= '9')
867 if (yyss
== NULL
&& yygrowstack()) goto yyoverflow
;
874 if ((yyn
= yydefred
[yystate
]) != 0) goto yyreduce
;
877 if ((yychar
= yylex()) < 0) yychar
= 0;
882 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
883 if (!yys
) yys
= "illegal-symbol";
884 printf("%sdebug: state %d, reading %d (%s)\n",
885 YYPREFIX
, yystate
, yychar
, yys
);
889 if ((yyn
= yysindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
890 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
894 printf("%sdebug: state %d, shifting to state %d\n",
895 YYPREFIX
, yystate
, yytable
[yyn
]);
897 if (yyssp
>= yysslim
&& yygrowstack())
901 yystate
= yytable
[yyn
];
902 *++yyssp
= yytable
[yyn
];
905 if (yyerrflag
> 0) --yyerrflag
;
908 if ((yyn
= yyrindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
909 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
914 if (yyerrflag
) goto yyinrecovery
;
916 yyerror("syntax error");
929 if ((yyn
= yysindex
[*yyssp
]) && (yyn
+= YYERRCODE
) >= 0 &&
930 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == YYERRCODE
)
934 printf("%sdebug: state %d, error recovery shifting\
935 to state %d\n", YYPREFIX
, *yyssp
, yytable
[yyn
]);
937 if (yyssp
>= yysslim
&& yygrowstack())
941 yystate
= yytable
[yyn
];
942 *++yyssp
= yytable
[yyn
];
950 printf("%sdebug: error recovery discarding state %d\n",
953 if (yyssp
<= yyss
) goto yyabort
;
961 if (yychar
== 0) goto yyabort
;
966 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
967 if (!yys
) yys
= "illegal-symbol";
968 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
969 YYPREFIX
, yystate
, yychar
, yys
);
979 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
980 YYPREFIX
, yystate
, yyn
, yyrule
[yyn
]);
984 yyval
= yyvsp
[1-yym
];
986 memset(&yyval
, 0, sizeof yyval
);
990 #line 179 "grammar.y"
996 #line 183 "grammar.y"
1002 #line 194 "grammar.y"
1004 /* Provide an empty action here so bison will not complain about
1005 * incompatible types in the default action it normally would
1011 #line 201 "grammar.y"
1017 #line 208 "grammar.y"
1020 if (types_out
&& want_typedef()) {
1021 gen_declarations(&yyvsp
[-1].decl_spec
, (DeclaratorList
*)0);
1025 free_decl_spec(&yyvsp
[-1].decl_spec
);
1030 #line 219 "grammar.y"
1032 if (func_params
!= NULL
) {
1033 set_param_types(func_params
, &yyvsp
[-2].decl_spec
, &yyvsp
[-1].decl_list
);
1035 gen_declarations(&yyvsp
[-2].decl_spec
, &yyvsp
[-1].decl_list
);
1039 free_decl_list(&yyvsp
[-1].decl_list
);
1041 free_decl_spec(&yyvsp
[-2].decl_spec
);
1046 #line 233 "grammar.y"
1048 cur_decl_spec_flags
= yyvsp
[0].decl_spec
.flags
;
1049 free_decl_spec(&yyvsp
[0].decl_spec
);
1053 #line 238 "grammar.y"
1059 #line 245 "grammar.y"
1065 #line 249 "grammar.y"
1071 #line 261 "grammar.y"
1073 int flags
= cur_decl_spec_flags
;
1075 /* If the typedef is a pointer type, then reset the short type
1076 * flags so it does not get promoted.
1078 if (strcmp(yyvsp
[0].declarator
->text
, yyvsp
[0].declarator
->name
) != 0)
1079 flags
&= ~(DS_CHAR
| DS_SHORT
| DS_FLOAT
);
1080 new_symbol(typedef_names
, yyvsp
[0].declarator
->name
, NULL
, flags
);
1081 free_declarator(yyvsp
[0].declarator
);
1085 #line 273 "grammar.y"
1087 int flags
= cur_decl_spec_flags
;
1089 if (strcmp(yyvsp
[0].declarator
->text
, yyvsp
[0].declarator
->name
) != 0)
1090 flags
&= ~(DS_CHAR
| DS_SHORT
| DS_FLOAT
);
1091 new_symbol(typedef_names
, yyvsp
[0].declarator
->name
, NULL
, flags
);
1092 free_declarator(yyvsp
[0].declarator
);
1096 #line 285 "grammar.y"
1098 check_untagged(&yyvsp
[-1].decl_spec
);
1099 if (yyvsp
[0].declarator
->func_def
== FUNC_NONE
) {
1100 yyerror("syntax error");
1103 func_params
= &(yyvsp
[0].declarator
->head
->params
);
1104 func_params
->begin_comment
= cur_file
->begin_comment
;
1105 func_params
->end_comment
= cur_file
->end_comment
;
1109 #line 296 "grammar.y"
1111 /* If we're converting to K&R and we've got a nominally K&R
1112 * function which has a parameter which is ANSI (i.e., a prototyped
1113 * function pointer), then we must override the deciphered value of
1114 * 'func_def' so that the parameter will be converted.
1116 if (func_style
== FUNC_TRADITIONAL
1118 && yyvsp
[-3].declarator
->head
->func_def
== func_style
) {
1119 yyvsp
[-3].declarator
->head
->func_def
= FUNC_BOTH
;
1124 if (cur_file
->convert
)
1125 gen_func_definition(&yyvsp
[-4].decl_spec
, yyvsp
[-3].declarator
);
1126 gen_prototype(&yyvsp
[-4].decl_spec
, yyvsp
[-3].declarator
);
1130 free_decl_spec(&yyvsp
[-4].decl_spec
);
1131 free_declarator(yyvsp
[-3].declarator
);
1135 #line 321 "grammar.y"
1137 if (yyvsp
[0].declarator
->func_def
== FUNC_NONE
) {
1138 yyerror("syntax error");
1141 func_params
= &(yyvsp
[0].declarator
->head
->params
);
1142 func_params
->begin_comment
= cur_file
->begin_comment
;
1143 func_params
->end_comment
= cur_file
->end_comment
;
1147 #line 331 "grammar.y"
1153 new_decl_spec(&decl_spec
, dft_decl_spec(), yyvsp
[-4].declarator
->begin
, DS_NONE
);
1154 if (cur_file
->convert
)
1155 gen_func_definition(&decl_spec
, yyvsp
[-4].declarator
);
1156 gen_prototype(&decl_spec
, yyvsp
[-4].declarator
);
1160 free_decl_spec(&decl_spec
);
1161 free_declarator(yyvsp
[-4].declarator
);
1165 #line 362 "grammar.y"
1167 join_decl_specs(&yyval
.decl_spec
, &yyvsp
[-1].decl_spec
, &yyvsp
[0].decl_spec
);
1168 free(yyvsp
[-1].decl_spec
.text
);
1169 free(yyvsp
[0].decl_spec
.text
);
1173 #line 377 "grammar.y"
1175 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_NONE
);
1179 #line 381 "grammar.y"
1181 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_EXTERN
);
1185 #line 385 "grammar.y"
1187 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_NONE
);
1191 #line 389 "grammar.y"
1193 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_STATIC
);
1197 #line 393 "grammar.y"
1199 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_INLINE
);
1203 #line 397 "grammar.y"
1205 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_JUNK
);
1209 #line 404 "grammar.y"
1211 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_CHAR
);
1215 #line 408 "grammar.y"
1217 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_NONE
);
1221 #line 412 "grammar.y"
1223 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_FLOAT
);
1227 #line 416 "grammar.y"
1229 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_NONE
);
1233 #line 420 "grammar.y"
1235 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_NONE
);
1239 #line 424 "grammar.y"
1241 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_SHORT
);
1245 #line 428 "grammar.y"
1247 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_NONE
);
1251 #line 432 "grammar.y"
1253 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_NONE
);
1257 #line 436 "grammar.y"
1259 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_NONE
);
1263 #line 440 "grammar.y"
1265 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_CHAR
);
1269 #line 444 "grammar.y"
1271 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_NONE
);
1275 #line 448 "grammar.y"
1277 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_NONE
);
1281 #line 452 "grammar.y"
1284 s
= find_symbol(typedef_names
, yyvsp
[0].text
.text
);
1286 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, s
->flags
);
1290 #line 464 "grammar.y"
1292 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, DS_NONE
);
1296 #line 468 "grammar.y"
1298 /* This rule allows the <pointer> nonterminal to scan #define
1299 * names as if they were type modifiers.
1302 s
= find_symbol(define_names
, yyvsp
[0].text
.text
);
1304 new_decl_spec(&yyval
.decl_spec
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
, s
->flags
);
1308 #line 481 "grammar.y"
1311 if ((s
= implied_typedef()) == 0)
1312 (void)sprintf(s
= buf
, "%s %s", yyvsp
[-2].text
.text
, yyvsp
[-1].text
.text
);
1313 new_decl_spec(&yyval
.decl_spec
, s
, yyvsp
[-2].text
.begin
, DS_NONE
);
1317 #line 488 "grammar.y"
1320 if ((s
= implied_typedef()) == 0)
1321 (void)sprintf(s
= buf
, "%s {}", yyvsp
[-1].text
.text
);
1322 new_decl_spec(&yyval
.decl_spec
, s
, yyvsp
[-1].text
.begin
, DS_NONE
);
1326 #line 495 "grammar.y"
1328 (void)sprintf(buf
, "%s %s", yyvsp
[-1].text
.text
, yyvsp
[0].text
.text
);
1329 new_decl_spec(&yyval
.decl_spec
, buf
, yyvsp
[-1].text
.begin
, DS_NONE
);
1333 #line 503 "grammar.y"
1335 imply_typedef(yyval
.text
.text
);
1339 #line 507 "grammar.y"
1341 imply_typedef(yyval
.text
.text
);
1345 #line 514 "grammar.y"
1347 new_decl_list(&yyval
.decl_list
, yyvsp
[0].declarator
);
1351 #line 518 "grammar.y"
1353 add_decl_list(&yyval
.decl_list
, &yyvsp
[-2].decl_list
, yyvsp
[0].declarator
);
1357 #line 525 "grammar.y"
1359 if (yyvsp
[0].declarator
->func_def
!= FUNC_NONE
&& func_params
== NULL
&&
1360 func_style
== FUNC_TRADITIONAL
&& cur_file
->convert
) {
1361 gen_func_declarator(yyvsp
[0].declarator
);
1362 fputs(cur_text(), cur_file
->tmp_file
);
1364 cur_declarator
= yyval
.declarator
;
1368 #line 534 "grammar.y"
1370 if (yyvsp
[-1].declarator
->func_def
!= FUNC_NONE
&& func_params
== NULL
&&
1371 func_style
== FUNC_TRADITIONAL
&& cur_file
->convert
) {
1372 gen_func_declarator(yyvsp
[-1].declarator
);
1373 fputs(" =", cur_file
->tmp_file
);
1378 #line 546 "grammar.y"
1381 if ((s
= implied_typedef()) == 0)
1382 (void)sprintf(s
= buf
, "enum %s", yyvsp
[-1].text
.text
);
1383 new_decl_spec(&yyval
.decl_spec
, s
, yyvsp
[-2].text
.begin
, DS_NONE
);
1387 #line 553 "grammar.y"
1390 if ((s
= implied_typedef()) == 0)
1391 (void)sprintf(s
= buf
, "%s {}", yyvsp
[-1].text
.text
);
1392 new_decl_spec(&yyval
.decl_spec
, s
, yyvsp
[-1].text
.begin
, DS_NONE
);
1396 #line 560 "grammar.y"
1398 (void)sprintf(buf
, "enum %s", yyvsp
[0].text
.text
);
1399 new_decl_spec(&yyval
.decl_spec
, buf
, yyvsp
[-1].text
.begin
, DS_NONE
);
1403 #line 568 "grammar.y"
1405 imply_typedef("enum");
1406 yyval
.text
= yyvsp
[0].text
;
1410 #line 581 "grammar.y"
1412 yyval
.declarator
= yyvsp
[0].declarator
;
1413 (void)sprintf(buf
, "%s%s", yyvsp
[-1].text
.text
, yyval
.declarator
->text
);
1414 free(yyval
.declarator
->text
);
1415 yyval
.declarator
->text
= xstrdup(buf
);
1416 yyval
.declarator
->begin
= yyvsp
[-1].text
.begin
;
1417 yyval
.declarator
->pointer
= TRUE
;
1421 #line 594 "grammar.y"
1423 yyval
.declarator
= new_declarator(yyvsp
[0].text
.text
, yyvsp
[0].text
.text
, yyvsp
[0].text
.begin
);
1427 #line 598 "grammar.y"
1429 yyval
.declarator
= yyvsp
[-1].declarator
;
1430 (void)sprintf(buf
, "(%s)", yyval
.declarator
->text
);
1431 free(yyval
.declarator
->text
);
1432 yyval
.declarator
->text
= xstrdup(buf
);
1433 yyval
.declarator
->begin
= yyvsp
[-2].text
.begin
;
1437 #line 606 "grammar.y"
1439 yyval
.declarator
= yyvsp
[-1].declarator
;
1440 (void)sprintf(buf
, "%s%s", yyval
.declarator
->text
, yyvsp
[0].text
.text
);
1441 free(yyval
.declarator
->text
);
1442 yyval
.declarator
->text
= xstrdup(buf
);
1446 #line 613 "grammar.y"
1448 yyval
.declarator
= new_declarator("%s()", yyvsp
[-3].declarator
->name
, yyvsp
[-3].declarator
->begin
);
1449 yyval
.declarator
->params
= yyvsp
[-1].param_list
;
1450 yyval
.declarator
->func_stack
= yyvsp
[-3].declarator
;
1451 yyval
.declarator
->head
= (yyvsp
[-3].declarator
->func_stack
== NULL
) ? yyval
.declarator
: yyvsp
[-3].declarator
->head
;
1452 yyval
.declarator
->func_def
= FUNC_ANSI
;
1456 #line 621 "grammar.y"
1458 yyval
.declarator
= new_declarator("%s()", yyvsp
[-3].declarator
->name
, yyvsp
[-3].declarator
->begin
);
1459 yyval
.declarator
->params
= yyvsp
[-1].param_list
;
1460 yyval
.declarator
->func_stack
= yyvsp
[-3].declarator
;
1461 yyval
.declarator
->head
= (yyvsp
[-3].declarator
->func_stack
== NULL
) ? yyval
.declarator
: yyvsp
[-3].declarator
->head
;
1462 yyval
.declarator
->func_def
= FUNC_TRADITIONAL
;
1466 #line 632 "grammar.y"
1468 (void)sprintf(yyval
.text
.text
, "*%s", yyvsp
[0].text
.text
);
1469 yyval
.text
.begin
= yyvsp
[-1].text
.begin
;
1473 #line 637 "grammar.y"
1475 (void)sprintf(yyval
.text
.text
, "*%s%s", yyvsp
[-1].text
.text
, yyvsp
[0].text
.text
);
1476 yyval
.text
.begin
= yyvsp
[-2].text
.begin
;
1480 #line 645 "grammar.y"
1482 strcpy(yyval
.text
.text
, "");
1483 yyval
.text
.begin
= 0L;
1487 #line 654 "grammar.y"
1489 (void)sprintf(yyval
.text
.text
, "%s ", yyvsp
[0].decl_spec
.text
);
1490 yyval
.text
.begin
= yyvsp
[0].decl_spec
.begin
;
1491 free(yyvsp
[0].decl_spec
.text
);
1495 #line 660 "grammar.y"
1497 (void)sprintf(yyval
.text
.text
, "%s%s ", yyvsp
[-1].text
.text
, yyvsp
[0].decl_spec
.text
);
1498 yyval
.text
.begin
= yyvsp
[-1].text
.begin
;
1499 free(yyvsp
[0].decl_spec
.text
);
1503 #line 670 "grammar.y"
1505 add_ident_list(&yyval
.param_list
, &yyvsp
[-2].param_list
, "...");
1509 #line 677 "grammar.y"
1511 new_param_list(&yyval
.param_list
, yyvsp
[0].parameter
);
1515 #line 681 "grammar.y"
1517 add_param_list(&yyval
.param_list
, &yyvsp
[-2].param_list
, yyvsp
[0].parameter
);
1521 #line 688 "grammar.y"
1523 check_untagged(&yyvsp
[-1].decl_spec
);
1524 yyval
.parameter
= new_parameter(&yyvsp
[-1].decl_spec
, yyvsp
[0].declarator
);
1528 #line 693 "grammar.y"
1530 check_untagged(&yyvsp
[-1].decl_spec
);
1531 yyval
.parameter
= new_parameter(&yyvsp
[-1].decl_spec
, yyvsp
[0].declarator
);
1535 #line 698 "grammar.y"
1537 check_untagged(&yyvsp
[0].decl_spec
);
1538 yyval
.parameter
= new_parameter(&yyvsp
[0].decl_spec
, (Declarator
*)0);
1542 #line 706 "grammar.y"
1544 new_ident_list(&yyval
.param_list
);
1548 #line 714 "grammar.y"
1550 new_ident_list(&yyval
.param_list
);
1551 add_ident_list(&yyval
.param_list
, &yyval
.param_list
, yyvsp
[0].text
.text
);
1555 #line 719 "grammar.y"
1557 add_ident_list(&yyval
.param_list
, &yyvsp
[-2].param_list
, yyvsp
[0].text
.text
);
1561 #line 726 "grammar.y"
1563 yyval
.text
= yyvsp
[0].text
;
1567 #line 730 "grammar.y"
1570 if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
1571 yyval
.text
= yyvsp
[0].text
;
1574 (void)sprintf(yyval
.text
.text
, "&%s", yyvsp
[0].text
.text
);
1575 yyval
.text
.begin
= yyvsp
[-1].text
.begin
;
1579 #line 743 "grammar.y"
1581 yyval
.declarator
= new_declarator(yyvsp
[0].text
.text
, "", yyvsp
[0].text
.begin
);
1585 #line 747 "grammar.y"
1587 yyval
.declarator
= yyvsp
[0].declarator
;
1588 (void)sprintf(buf
, "%s%s", yyvsp
[-1].text
.text
, yyval
.declarator
->text
);
1589 free(yyval
.declarator
->text
);
1590 yyval
.declarator
->text
= xstrdup(buf
);
1591 yyval
.declarator
->begin
= yyvsp
[-1].text
.begin
;
1595 #line 759 "grammar.y"
1597 yyval
.declarator
= yyvsp
[-1].declarator
;
1598 (void)sprintf(buf
, "(%s)", yyval
.declarator
->text
);
1599 free(yyval
.declarator
->text
);
1600 yyval
.declarator
->text
= xstrdup(buf
);
1601 yyval
.declarator
->begin
= yyvsp
[-2].text
.begin
;
1605 #line 767 "grammar.y"
1607 yyval
.declarator
= yyvsp
[-1].declarator
;
1608 (void)sprintf(buf
, "%s%s", yyval
.declarator
->text
, yyvsp
[0].text
.text
);
1609 free(yyval
.declarator
->text
);
1610 yyval
.declarator
->text
= xstrdup(buf
);
1614 #line 774 "grammar.y"
1616 yyval
.declarator
= new_declarator(yyvsp
[0].text
.text
, "", yyvsp
[0].text
.begin
);
1620 #line 778 "grammar.y"
1622 yyval
.declarator
= new_declarator("%s()", "", yyvsp
[-3].declarator
->begin
);
1623 yyval
.declarator
->params
= yyvsp
[-1].param_list
;
1624 yyval
.declarator
->func_stack
= yyvsp
[-3].declarator
;
1625 yyval
.declarator
->head
= (yyvsp
[-3].declarator
->func_stack
== NULL
) ? yyval
.declarator
: yyvsp
[-3].declarator
->head
;
1626 yyval
.declarator
->func_def
= FUNC_ANSI
;
1630 #line 786 "grammar.y"
1632 yyval
.declarator
= new_declarator("%s()", "", yyvsp
[-2].declarator
->begin
);
1633 yyval
.declarator
->func_stack
= yyvsp
[-2].declarator
;
1634 yyval
.declarator
->head
= (yyvsp
[-2].declarator
->func_stack
== NULL
) ? yyval
.declarator
: yyvsp
[-2].declarator
->head
;
1635 yyval
.declarator
->func_def
= FUNC_ANSI
;
1639 #line 793 "grammar.y"
1643 d
= new_declarator("", "", yyvsp
[-2].text
.begin
);
1644 yyval
.declarator
= new_declarator("%s()", "", yyvsp
[-2].text
.begin
);
1645 yyval
.declarator
->params
= yyvsp
[-1].param_list
;
1646 yyval
.declarator
->func_stack
= d
;
1647 yyval
.declarator
->head
= yyval
.declarator
;
1648 yyval
.declarator
->func_def
= FUNC_ANSI
;
1652 #line 804 "grammar.y"
1656 d
= new_declarator("", "", yyvsp
[-1].text
.begin
);
1657 yyval
.declarator
= new_declarator("%s()", "", yyvsp
[-1].text
.begin
);
1658 yyval
.declarator
->func_stack
= d
;
1659 yyval
.declarator
->head
= yyval
.declarator
;
1660 yyval
.declarator
->func_def
= FUNC_ANSI
;
1663 #line 1662 "grammar.tab.c"
1669 if (yystate
== 0 && yym
== 0)
1673 printf("%sdebug: after reduction, shifting from state 0 to\
1674 state %d\n", YYPREFIX
, YYFINAL
);
1681 if ((yychar
= yylex()) < 0) yychar
= 0;
1686 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
1687 if (!yys
) yys
= "illegal-symbol";
1688 printf("%sdebug: state %d, reading %d (%s)\n",
1689 YYPREFIX
, YYFINAL
, yychar
, yys
);
1693 if (yychar
== 0) goto yyaccept
;
1696 if ((yyn
= yygindex
[yym
]) && (yyn
+= yystate
) >= 0 &&
1697 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yystate
)
1698 yystate
= yytable
[yyn
];
1700 yystate
= yydgoto
[yym
];
1703 printf("%sdebug: after reduction, shifting from state %d \
1704 to state %d\n", YYPREFIX
, *yyssp
, yystate
);
1706 if (yyssp
>= yysslim
&& yygrowstack())
1710 *++yyssp
= (short) yystate
;
1715 yyerror("yacc stack overflow");