diff -r 4798bd4739d0 -r 9b88b8b6bccd stage4/generate_c/generate_c_il.cc --- a/stage4/generate_c/generate_c_il.cc Fri Nov 18 17:21:16 2011 +0100 +++ b/stage4/generate_c/generate_c_il.cc Fri Nov 18 17:28:37 2011 +0100 @@ -132,6 +132,7 @@ expression_vg, assignment_vg, complextype_base_vg, + complextype_base_assignment_vg, complextype_suffix_vg, fparam_output_vg } variablegeneration_t; @@ -287,6 +288,11 @@ this->default_variable_back_name.accept(*this); } + void reset_default_variable_name(void) { + this->default_variable_name.current_type = NULL; + this->default_variable_back_name.current_type = NULL; + } + private: /* A helper function... */ /* @@ -468,35 +474,21 @@ bool negative = false) { unsigned int vartype = search_varfb_instance_type->get_vartype(symbol); bool type_is_complex = search_varfb_instance_type->type_is_complex(); - if (vartype == search_var_instance_decl_c::external_vt) { - symbolic_variable_c *variable = dynamic_cast(symbol); - /* TODO Find a solution for forcing global complex variables */ - if (variable != NULL) { - s4o.print(SET_EXTERNAL); - s4o.print("("); - variable->var_name->accept(*this); - s4o.print(","); - } - else { - s4o.print(SET_COMPLEX_EXTERNAL); - s4o.print("("); - } - } - else { - if (vartype == search_var_instance_decl_c::located_vt) - s4o.print(SET_LOCATED); - else - s4o.print(SET_VAR); - s4o.print("("); - } + if (vartype == search_var_instance_decl_c::external_vt) + s4o.print(SET_EXTERNAL); + else if (vartype == search_var_instance_decl_c::located_vt) + s4o.print(SET_LOCATED); + else + s4o.print(SET_VAR); + s4o.print("("); if (fb_symbol != NULL) { print_variable_prefix(); fb_symbol->accept(*this); - s4o.print("."); + s4o.print(".,"); } else if (type_is_complex) - wanted_variablegeneration = complextype_base_vg; + wanted_variablegeneration = complextype_base_assignment_vg; else wanted_variablegeneration = assignment_vg; @@ -580,8 +572,13 @@ void *visit(symbolic_variable_c *symbol) { unsigned int vartype; switch (wanted_variablegeneration) { + case complextype_base_assignment_vg: + case assignment_vg: + this->print_variable_prefix(); + s4o.print(","); + symbol->var_name->accept(*this); + break; case complextype_base_vg: - case assignment_vg: generate_c_base_c::visit(symbol); break; case complextype_suffix_vg: @@ -648,6 +645,7 @@ TRACE("structured_variable_c"); switch (wanted_variablegeneration) { case complextype_base_vg: + case complextype_base_assignment_vg: symbol->record_variable->accept(*this); break; case complextype_suffix_vg: @@ -674,6 +672,7 @@ void *visit(array_variable_c *symbol) { switch (wanted_variablegeneration) { case complextype_base_vg: + case complextype_base_assignment_vg: symbol->subscripted_variable->accept(*this); break; case complextype_suffix_vg: