# HG changeset patch # User Laurent Bessard # Date 1344966001 -7200 # Node ID aad38592bdde6ae08a697f321723744310d7ea05 # Parent 3e21d98d0a7153f41f14d93f04bb0db1a7a76151 Fix bug with InOut variable of structured type diff -r 3e21d98d0a71 -r aad38592bdde absyntax_utils/search_base_type.cc --- a/absyntax_utils/search_base_type.cc Sat Jul 28 17:38:57 2012 +0200 +++ b/absyntax_utils/search_base_type.cc Tue Aug 14 19:40:01 2012 +0200 @@ -256,6 +256,11 @@ return symbol->structure_specification->accept(*this); } +/* var1_list ':' structure_type_name */ +void *search_base_type_c::visit(structured_var_declaration_c *symbol) { + return symbol->structure_type_name->accept(*this); +} + /* structure_type_name ASSIGN structure_initialization */ /* structure_initialization may be NULL ! */ void *search_base_type_c::visit(initialized_structure_c *symbol) { diff -r 3e21d98d0a71 -r aad38592bdde absyntax_utils/search_base_type.hh --- a/absyntax_utils/search_base_type.hh Sat Jul 28 17:38:57 2012 +0200 +++ b/absyntax_utils/search_base_type.hh Tue Aug 14 19:40:01 2012 +0200 @@ -194,6 +194,8 @@ * structure_element_declaration_list_c */ void *visit(structure_type_declaration_c *symbol); + /* var1_list ':' structure_type_name */ + void *visit(structured_var_declaration_c *symbol); /* structure_type_name ASSIGN structure_initialization */ /* structure_initialization may be NULL ! */ void *visit(initialized_structure_c *symbol); diff -r 3e21d98d0a71 -r aad38592bdde absyntax_utils/search_var_instance_decl.cc --- a/absyntax_utils/search_var_instance_decl.cc Sat Jul 28 17:38:57 2012 +0200 +++ b/absyntax_utils/search_var_instance_decl.cc Tue Aug 14 19:40:01 2012 +0200 @@ -262,7 +262,7 @@ /* var1_list ':' structure_type_name */ // SYM_REF2(structured_var_declaration_c, var1_list, structure_type_name) void *search_var_instance_decl_c::visit(structured_var_declaration_c *symbol) { - current_type_decl = symbol->structure_type_name; + current_type_decl = symbol; return symbol->var1_list->accept(*this); } diff -r 3e21d98d0a71 -r aad38592bdde absyntax_utils/search_varfb_instance_type.cc --- a/absyntax_utils/search_varfb_instance_type.cc Sat Jul 28 17:38:57 2012 +0200 +++ b/absyntax_utils/search_varfb_instance_type.cc Tue Aug 14 19:40:01 2012 +0200 @@ -301,6 +301,34 @@ */ } +/* var1_list ':' structure_type_name */ +void *search_varfb_instance_type_c::visit(structured_var_declaration_c *symbol) { + this->is_complex = true; + if (NULL != current_structelement_name) ERROR; + + /* make sure that we have decomposed all structure elements of the variable name */ + symbol_c *var_name = decompose_var_instance_name->next_part(); + if (NULL == var_name) { + /* this is it... ! + * No need to look any further... + * Note also that, unlike for the struct types, a function block may + * not be defined based on another (i.e. no inheritance is allowed), + * so this function block is already the most base type. + * We simply return it. + */ + return (void *)symbol; + } + + /* reset current_type_id because of new structure element part */ + this->current_typeid = NULL; + + /* look for the var_name in the structure declaration */ + current_structelement_name = var_name; + + /* recursively find out the data type of current_structelement_name... */ + return symbol->structure_type_name->accept(*this); +} + /* structure_type_name ASSIGN structure_initialization */ /* structure_initialization may be NULL ! */ // SYM_REF2(initialized_structure_c, structure_type_name, structure_initialization) diff -r 3e21d98d0a71 -r aad38592bdde absyntax_utils/search_varfb_instance_type.hh --- a/absyntax_utils/search_varfb_instance_type.hh Sat Jul 28 17:38:57 2012 +0200 +++ b/absyntax_utils/search_varfb_instance_type.hh Tue Aug 14 19:40:01 2012 +0200 @@ -149,6 +149,9 @@ /* structure_type_name ':' structure_specification */ void *visit(structure_type_declaration_c *symbol); + /* var1_list ':' structure_type_name */ + void *visit(structured_var_declaration_c *symbol); + /* structure_type_name ASSIGN structure_initialization */ /* structure_initialization may be NULL ! */ // SYM_REF2(initialized_structure_c, structure_type_name, structure_initialization) diff -r 3e21d98d0a71 -r aad38592bdde stage4/generate_c/generate_c.cc --- a/stage4/generate_c/generate_c.cc Sat Jul 28 17:38:57 2012 +0200 +++ b/stage4/generate_c/generate_c.cc Tue Aug 14 19:40:01 2012 +0200 @@ -809,6 +809,11 @@ return NULL; } + /* var1_list ':' structure_type_name */ + void *visit(structured_var_declaration_c *symbol) { + return NULL; + } + /* var1_list ':' initialized_structure */ // SYM_REF2(structured_var_init_decl_c, var1_list, initialized_structure) void *visit(structured_var_init_decl_c *symbol) {