stage4/generate_c/generate_c_inlinefcall.cc
changeset 392 9b88b8b6bccd
parent 388 17eaad42ba88
child 399 55b074ea7255
child 453 4733f662362a
equal deleted inserted replaced
391:4798bd4739d0 392:9b88b8b6bccd
   118       default_variable_back_name(IL_DEFVAR_BACK, NULL)
   118       default_variable_back_name(IL_DEFVAR_BACK, NULL)
   119     {
   119     {
   120       search_expression_type = new search_expression_type_c(scope);
   120       search_expression_type = new search_expression_type_c(scope);
   121       search_varfb_instance_type = new search_varfb_instance_type_c(scope);
   121       search_varfb_instance_type = new search_varfb_instance_type_c(scope);
   122       this->set_variable_prefix(variable_prefix);
   122       this->set_variable_prefix(variable_prefix);
       
   123       current_operand = NULL;
       
   124       current_operand_type = NULL;
       
   125       il_default_variable_init_value = NULL;
   123       fcall_number = 0;
   126       fcall_number = 0;
   124       fbname = name;
   127       fbname = name;
   125       wanted_variablegeneration = expression_vg;
   128       wanted_variablegeneration = expression_vg;
   126       generating_inlinefunction = false;
   129       generating_inlinefunction = false;
   127     }
   130     }
   328 
   331 
   329     void *print_setter(symbol_c* symbol,
   332     void *print_setter(symbol_c* symbol,
   330     		symbol_c* type,
   333     		symbol_c* type,
   331     		symbol_c* value) {
   334     		symbol_c* value) {
   332       unsigned int vartype = search_varfb_instance_type->get_vartype(symbol);
   335       unsigned int vartype = search_varfb_instance_type->get_vartype(symbol);
   333       if (vartype == search_var_instance_decl_c::external_vt) {
   336       if (vartype == search_var_instance_decl_c::external_vt)
   334         symbolic_variable_c *variable = dynamic_cast<symbolic_variable_c *>(symbol);
   337         s4o.print(SET_EXTERNAL);
   335         /* TODO Find a solution for forcing global complex variables */
   338       else if (vartype == search_var_instance_decl_c::located_vt)
   336         if (variable != NULL) {
   339         s4o.print(SET_LOCATED);
   337           s4o.print(SET_EXTERNAL);
   340       else
   338           s4o.print("(");
   341         s4o.print(SET_VAR);
   339           variable->var_name->accept(*this);
   342       s4o.print("(,");
   340           s4o.print(",");
       
   341         }
       
   342         else {
       
   343           s4o.print(SET_COMPLEX_EXTERNAL);
       
   344           s4o.print("(");
       
   345         }
       
   346       }
       
   347       else {
       
   348         if (vartype == search_var_instance_decl_c::located_vt)
       
   349           s4o.print(SET_LOCATED);
       
   350         else
       
   351           s4o.print(SET_VAR);
       
   352         s4o.print("(");
       
   353       }
       
   354 
   343 
   355       wanted_variablegeneration = complextype_base_vg;
   344       wanted_variablegeneration = complextype_base_vg;
   356       symbol->accept(*this);
   345       symbol->accept(*this);
   357       s4o.print(",");
   346       s4o.print(",");
   358       wanted_variablegeneration = expression_vg;
   347       wanted_variablegeneration = expression_vg;
   467       if (NULL != symbol->il_instruction) {
   456       if (NULL != symbol->il_instruction) {
   468         symbol->il_instruction->accept(*this);
   457         symbol->il_instruction->accept(*this);
   469       }
   458       }
   470       return NULL;
   459       return NULL;
   471     }
   460     }
       
   461 
   472     /* | il_simple_operator [il_operand] */
   462     /* | il_simple_operator [il_operand] */
   473     //SYM_REF2(il_simple_operation_c, il_simple_operator, il_operand)
   463     //SYM_REF2(il_simple_operation_c, il_simple_operator, il_operand)
   474     void *visit(il_simple_operation_c *symbol) {
   464     void *visit(il_simple_operation_c *symbol) {
   475       this->current_operand = symbol->il_operand;
   465       this->current_operand = symbol->il_operand;
   476       if (NULL == this->current_operand) {
   466       if (NULL == this->current_operand) {