static List_t ArgumentDeclarationList( void ) { List_t ListDeclaration = 0; Declaration_t Declaration; Type_t Type; while( True ) { switch( Token( 0 )) { case SN_ELLIPSIS: TokenStep( 1 ); Declaration = f_DeclarationCreate( DECLARATION_ARGUMENT ); Declaration->s_ellipsis = True; f_ListAddLast( &ListDeclaration, (Elem_t) Declaration ); return ListDeclaration; case ',': TokenStep( 1 ); break; case ')': return ListDeclaration; default: Type = TypeName(); if( Type == 0 ) { Type = f_TypeCreateInt(); while( True ) { if( Token( 0 ) == ')' ) break; if( Token( 0 ) == ',' ) break; if( Token( 0 ) == SN_ELLIPSIS ) break; if( Token( 0 ) == 0 ) break; TokenStep( 1 ); } } Declaration = f_TypeCastToDeclaration( Type ); f_ListAddLast( &ListDeclaration, (Elem_t) Declaration ); break; } } }
extern Boolean_t f_CompoundStatement( char *types, char *names ) { int retval; /* printf( "Compund Statement: (%s) (%s)\n", types, names ); */ if( SymtabVariable == 0 ) { SymtabVariable = SymtabCreate((void (*)(void*)) f_TypeDestroy ); } if( SymtabClass == 0 ) { SymtabClass = SymtabCreate((void (*)(void*)) f_ClassDestroy ); } if( types && names ) { /* feldolgozzuk a fuggveny argumentum listat */ char *my_types, *types_beg, *types_end; char *my_names, *names_beg, *names_end; int iBreak; my_types = SN_StrDup( types ); my_names = SN_StrDup( names ); types_beg = my_types; names_beg = my_names; iBreak = False; while( ! iBreak ) { if(( types_end = my_strchr( types_beg, ',' ))) { *types_end = 0; } else { iBreak = True; } if(( names_end = my_strchr( names_beg, ',' ))) { *names_end = 0; } else { iBreak = True; } if( *names_beg && types_beg[0] != '.' ) { Type_t Type; Type = f_TypeFromString( types_beg ); if( Type == 0 ) { /* 24.02.97 rigo */ /* int DEFUN(_IO_fflush, (fp), register _IO_FILE *fp ){} eseten elofordul */ /* f_InternalError( 61 ); */ Type = f_TypeCreateInt(); } if( Type->Declarator == 0 ) { Type->Declarator = f_DeclaratorCreate(); Type->Declarator->Name = f_NameCreate( names_beg ); } else { if( Type->Declarator->Name ) { f_InternalError( 62 ); } else { Type->Declarator->Name = f_NameCreate( names_beg ); } } /* felodjuk az esetleges typedef-eket */ Type = f_TypeBasic( Type, start_lineno_g - 1 ); if( SymtabInsert( SymtabVariable , Type->Declarator->Name->pcName , (void *) Type , niveauComp )) { #ifdef SYMTAB_TRACE char acType[10000]; /* old: 1000 */ f_TypeToString( Type, acType, 1 ); printf( "argument type: %s ----- name: %s\n" , acType , Type->Declarator->Name->pcName ); #endif } else { f_TypeDestroy( Type ); } } if( ! iBreak ) { types_beg = types_end + 1; names_beg = names_end + 1; } } ckfree( my_names ); ckfree( my_types ); } retval = compound_statement(); #ifdef SYMTAB_TRACE printf( "vor Clear\n" ); SymtabPrint( SymtabVariable, 0 ); #endif SymtabClear( SymtabVariable ); SymtabClear( SymtabClass ); #ifdef SYMTAB_TRACE printf( "after Clear\n" ); SymtabPrint( SymtabVariable, 0 ); #endif return retval; }