stage4/generate_c/generate_c_st.cc
changeset 302 d120740a6b58
parent 298 022a874149ce
child 309 f93bcada0f51
equal deleted inserted replaced
299:de1be61482fa 302:d120740a6b58
   153 void *print_setter(symbol_c* symbol,
   153 void *print_setter(symbol_c* symbol,
   154 		symbol_c* type,
   154 		symbol_c* type,
   155 		symbol_c* value,
   155 		symbol_c* value,
   156 		symbol_c* fb_symbol = NULL,
   156 		symbol_c* fb_symbol = NULL,
   157 		symbol_c* fb_value = NULL) {
   157 		symbol_c* fb_value = NULL) {
       
   158   
   158   unsigned int vartype = search_varfb_instance_type->get_vartype(symbol);
   159   unsigned int vartype = search_varfb_instance_type->get_vartype(symbol);
   159   if (vartype == search_var_instance_decl_c::external_vt) {
   160   if (vartype == search_var_instance_decl_c::external_vt) {
   160     symbolic_variable_c *variable = dynamic_cast<symbolic_variable_c *>(symbol);
   161     symbolic_variable_c *variable = dynamic_cast<symbolic_variable_c *>(symbol);
   161     /* TODO Find a solution for forcing global complex variables */
   162     /* TODO Find a solution for forcing global complex variables */
   162     if (variable != NULL) {
   163     if (variable != NULL) {
   183     fb_symbol->accept(*this);
   184     fb_symbol->accept(*this);
   184     s4o.print(".");
   185     s4o.print(".");
   185   }
   186   }
   186   else
   187   else
   187     wanted_variablegeneration = complextype_base_vg;
   188     wanted_variablegeneration = complextype_base_vg;
       
   189   
   188   symbol->accept(*this);
   190   symbol->accept(*this);
   189   s4o.print(",");
   191   s4o.print(",");
   190   wanted_variablegeneration = expression_vg;
   192   wanted_variablegeneration = expression_vg;
   191   print_check_function(type, value, fb_value);
   193   print_check_function(type, value, fb_value);
       
   194   /* We need to call search_varfb_instance_type->get_vartype() again, as it may have been called
       
   195    * again since we called it in the beginning of this print_setter() function.
       
   196    * This make sure the call to search_varfb_instance_type->type_is_complex() will return
       
   197    * the correct value regarding our 'symbol'.
       
   198    */
       
   199   search_varfb_instance_type->get_vartype(symbol);
   192   if (search_varfb_instance_type->type_is_complex()) {
   200   if (search_varfb_instance_type->type_is_complex()) {
   193     s4o.print(",");
   201     s4o.print(",");
   194     wanted_variablegeneration = complextype_suffix_vg;
   202     wanted_variablegeneration = complextype_suffix_vg;
   195     symbol->accept(*this);
   203     symbol->accept(*this);
   196   }
   204   }