a/c2iec.y | b/c2iec.y | ||
---|---|---|---|
... |
... |
||
29 | #define FIFO_SIZE 200 |
29 | #define FIFO_SIZE 200 |
30 | 30 | ||
31 | typedef enum |
31 | typedef enum |
32 | { |
32 | { |
33 | decl_all, |
33 | decl_all, |
34 | decl_param, |
||
34 | decl_func, |
35 | decl_func, |
35 | fifo_entry_num /* reflects the number of enum entries */ |
36 | fifo_entry_num /* reflects the number of enum entries */ |
36 | } fifo_entry_t; |
37 | } fifo_entry_t; |
37 | 38 | ||
38 | typedef struct |
39 | typedef struct |
... |
... |
||
296 | { |
297 | { |
297 | char *p; |
298 | char *p; |
298 | while( (p=fifo_pop(decl_func)) != NULL) |
299 | while( (p=fifo_pop(decl_func)) != NULL) |
299 | { |
300 | { |
300 | printf(p, $<str>1); |
301 | printf(p, $<str>1); |
301 | strcpy($<str>$, ""); |
302 | } |
303 | while( (p=fifo_pop(decl_param)) != NULL) |
||
304 | { |
||
305 | printf(p, $<str>1); |
||
302 | } |
306 | } |
303 | while( (p=fifo_pop(decl_all)) != NULL) |
307 | while( (p=fifo_pop(decl_all)) != NULL) |
304 | { |
308 | { |
305 | printf(p, $<str>1); |
309 | printf(p, $<str>1); |
306 | strcpy($<str>$, ""); |
310 | } |
311 | strcpy($<str>$, ""); |
||
307 | } |
||
308 | } |
312 | } |
309 | ; |
313 | ; |
310 | 314 | ||
311 | declaration_specifiers |
315 | declaration_specifiers |
312 | : storage_class_specifier |
316 | : storage_class_specifier |
... |
... |
||
471 | | IDENTIFIER '=' constant_expression |
475 | | IDENTIFIER '=' constant_expression |
472 | ; |
476 | ; |
473 | 477 | ||
474 | type_qualifier |
478 | type_qualifier |
475 | : CONST |
479 | : CONST |
476 | | RESTRICT |
480 | { strcpy($<str>$, ""); } |
477 | | VOLATILE |
481 | | RESTRICT |
482 | { strcpy($<str>$, ""); } |
||
483 | | VOLATILE |
||
484 | { strcpy($<str>$, ""); } |
||
478 | ; |
485 | ; |
479 | 486 | ||
480 | function_specifier : INLINE |
487 | function_specifier : INLINE |
481 | ; |
488 | ; |
482 | 489 | ||
... |
... |
||
583 | | parameter_list ',' parameter_declaration |
590 | | parameter_list ',' parameter_declaration |
584 | ; |
591 | ; |
585 | 592 | ||
586 | parameter_declaration |
593 | parameter_declaration |
587 | : declaration_specifiers declarator |
594 | : declaration_specifiers declarator |
595 | { |
||
596 | char *p; |
||
597 | while (p = fifo_pop(decl_all)) |
||
598 | { |
||
599 | // printf(";;; %s :: %s\n\n", $<str>1, p); |
||
600 | sprintf($<str>$, p, $<str>1); |
||
601 | fifo_push(decl_param, $<str>$); |
||
602 | |||
603 | } |
||
604 | } |
||
588 | | declaration_specifiers abstract_declarator |
605 | | declaration_specifiers abstract_declarator |
589 | | declaration_specifiers |
606 | | declaration_specifiers |
590 | ; |
607 | ; |
591 | 608 | ||
592 | identifier_list |
609 | identifier_list |
... |
... |
||
746 | char *p; |
763 | char *p; |
747 | while( (p=fifo_pop(decl_func)) != NULL) |
764 | while( (p=fifo_pop(decl_func)) != NULL) |
748 | { |
765 | { |
749 | printf(p, $<str>1); |
766 | printf(p, $<str>1); |
750 | } |
767 | } |
768 | while( (p=fifo_pop(decl_param)) != NULL) |
||
769 | { |
||
770 | printf(p, $<str>1); |
||
771 | } |
||
751 | while( (p=fifo_pop(decl_all)) != NULL) |
772 | while( (p=fifo_pop(decl_all)) != NULL) |
752 | { |
773 | { |
753 | printf(p, $<str>1); |
774 | printf(p, $<str>1); |
754 | } |
775 | } |
755 | printf("%s", $<str>3); |
776 | printf("%s", $<str>3); |