stage4/generate_c/generate_c_inlinefcall.cc
changeset 706 31553c22f318
parent 625 c0bda77b37a0
child 793 268bf4ca5fa1
equal deleted inserted replaced
705:f2323f79252e 706:31553c22f318
    37     } variablegeneration_t;
    37     } variablegeneration_t;
    38 
    38 
    39   private:
    39   private:
    40 
    40 
    41     /* The initial value that should be given to the IL default variable
    41     /* The initial value that should be given to the IL default variable
    42 	 * imediately after a parenthesis is opened.
    42      * imediately after a parenthesis is opened.
    43 	 * This variable is only used to pass data from the
    43      * This variable is only used to pass data from the
    44 	 * il_expression_c visitor to the simple_instr_list_c visitor.
    44      * il_expression_c visitor to the simple_instr_list_c visitor.
    45 	 *
    45      *
    46 	 * e.g.:
    46      * e.g.:
    47 	 *         LD var1
    47      *         LD var1
    48 	 *         AND ( var2
    48      *         AND ( var2
    49 	 *         OR var3
    49      *         OR var3
    50 	 *         )
    50      *         )
    51 	 *
    51      *
    52 	 * In the above code sample, the line 'AND ( var2' constitutes
    52      * In the above code sample, the line 'AND ( var2' constitutes
    53 	 * an il_expression_c, where var2 should be loaded into the
    53      * an il_expression_c, where var2 should be loaded into the
    54 	 * il default variable before continuing with the expression
    54      * il default variable before continuing with the expression
    55 	 * inside the parenthesis.
    55      * inside the parenthesis.
    56 	 * Unfortunately, only the simple_instr_list_c may do the
    56      * Unfortunately, only the simple_instr_list_c may do the
    57 	 * initial laoding of the var2 bariable following the parenthesis,
    57      * initial laoding of the var2 bariable following the parenthesis,
    58 	 * so the il_expression_c visitor will have to pass 'var2' as a
    58      * so the il_expression_c visitor will have to pass 'var2' as a
    59 	 * parameter to the simple_instr_list_c visitor.
    59      * parameter to the simple_instr_list_c visitor.
    60 	 * Ergo, the existance of the following parameter...!
    60      * Ergo, the existance of the following parameter...!
    61 	 */
    61      */
    62 	symbol_c *il_default_variable_init_value;
    62     symbol_c *il_default_variable_init_value;
    63 
    63 
    64     /* Operand to the IL operation currently being processed... */
    64     /* Operand to the IL operation currently being processed... */
    65 	/* These variables are used to pass data from the
    65     /* These variables are used to pass data from the
    66 	 * il_simple_operation_c and il_expression_c visitors
    66      * il_simple_operation_c and il_expression_c visitors
    67 	 * to the il operator visitors (i.e. LD_operator_c,
    67      * to the il operator visitors (i.e. LD_operator_c,
    68 	 * LDN_operator_c, ST_operator_c, STN_operator_c, ...)
    68      * LDN_operator_c, ST_operator_c, STN_operator_c, ...)
    69 	 */
    69      */
    70 	symbol_c *current_operand;
    70     symbol_c *current_operand;
    71 	symbol_c *current_operand_type;
    71     symbol_c *current_operand_type;
    72 
    72 
    73 	 /* The result of the comparison IL operations (GT, EQ, LT, ...)
    73      /* The result of the comparison IL operations (GT, EQ, LT, ...)
    74 	 * is a boolean variable.
    74      * is a boolean variable.
    75 	 * This class keeps track of the current data type stored in the
    75      * This class keeps track of the current data type stored in the
    76 	 * il default variable. This is usually done by keeping a reference
    76      * il default variable. This is usually done by keeping a reference
    77 	 * to the data type of the last operand. Nevertheless, in the case of
    77      * to the data type of the last operand. Nevertheless, in the case of
    78 	 * the comparison IL operators, the data type of the result (a boolean)
    78      * the comparison IL operators, the data type of the result (a boolean)
    79 	 * is not the data type of the operand. We therefore need an object
    79      * is not the data type of the operand. We therefore need an object
    80 	 * of the boolean data type to keep as a reference of the current
    80      * of the boolean data type to keep as a reference of the current
    81 	 * data type.
    81      * data type.
    82 	 * The following object is it...
    82      * The following object is it...
    83 	 */
    83      */
    84 	bool_type_name_c bool_type;
    84     bool_type_name_c bool_type;
    85 	lint_type_name_c lint_type;
    85     lint_type_name_c lint_type;
    86 	lword_type_name_c lword_type;
    86     lword_type_name_c lword_type;
    87 	lreal_type_name_c lreal_type;
    87     lreal_type_name_c lreal_type;
    88 
    88 
    89     /* The name of the IL default variable... */
    89     /* The name of the IL default variable... */
    90 	#define IL_DEFVAR   VAR_LEADER "IL_DEFVAR"
    90     #define IL_DEFVAR   VAR_LEADER "IL_DEFVAR"
    91 
    91 
    92 	/* The name of the variable used to pass the result of a
    92     /* The name of the variable used to pass the result of a
    93 	 * parenthesised instruction list to the immediately preceding
    93      * parenthesised instruction list to the immediately preceding
    94 	 * scope ...
    94      * scope ...
    95 	 */
    95      */
    96     #define IL_DEFVAR_BACK   VAR_LEADER "IL_DEFVAR_BACK"
    96     #define IL_DEFVAR_BACK   VAR_LEADER "IL_DEFVAR_BACK"
    97     il_default_variable_c default_variable_name;
    97     il_default_variable_c default_variable_name;
    98 	il_default_variable_c default_variable_back_name;
    98     il_default_variable_c default_variable_back_name;
    99 
    99 
   100 	symbol_c* current_array_type;
   100     symbol_c* current_array_type;
   101 
   101 
   102 	int fcall_number;
   102     int fcall_number;
   103 	bool generating_inlinefunction;
   103     bool generating_inlinefunction;
   104 	symbol_c *fbname;
   104     symbol_c *fbname;
   105 
   105 
   106     search_expression_type_c *search_expression_type;
   106     search_expression_type_c *search_expression_type;
   107 
   107 
   108     search_varfb_instance_type_c *search_varfb_instance_type;
   108     search_varfb_instance_type_c *search_varfb_instance_type;
   109     search_var_instance_decl_c   *search_var_instance_decl;
   109     search_var_instance_decl_c   *search_var_instance_decl;
   140 
   140 
   141     void print(symbol_c* symbol) {
   141     void print(symbol_c* symbol) {
   142       function_call_iterator_c fc_iterator(symbol);
   142       function_call_iterator_c fc_iterator(symbol);
   143       symbol_c* function_call;
   143       symbol_c* function_call;
   144       while ((function_call = fc_iterator.next()) != NULL) {
   144       while ((function_call = fc_iterator.next()) != NULL) {
   145     	function_call->accept(*this);
   145         function_call->accept(*this);
   146       }
   146       }
   147     }
   147     }
   148 
   148 
   149 
   149 
   150 
   150 
   173       if (f_decl != NULL) {
   173       if (f_decl != NULL) {
   174         /* function being called is overloaded! */
   174         /* function being called is overloaded! */
   175         s4o.print("__");
   175         s4o.print("__");
   176         print_function_parameter_data_types_c overloaded_func_suf(&s4o);
   176         print_function_parameter_data_types_c overloaded_func_suf(&s4o);
   177         f_decl->accept(overloaded_func_suf);
   177         f_decl->accept(overloaded_func_suf);
   178       }	
   178       }
   179       if (function_type_suffix) {
   179       if (function_type_suffix) {
   180         function_type_suffix->accept(*this);
   180         function_type_suffix->accept(*this);
   181       }
   181       }
   182       s4o.print(fcall_number);
   182       s4o.print(fcall_number);
   183       s4o.print("(");
   183       s4o.print("(");
   222 
   222 
   223       s4o.print(s4o.indent_spaces + INLINE_RESULT_TEMP_VAR),
   223       s4o.print(s4o.indent_spaces + INLINE_RESULT_TEMP_VAR),
   224       s4o.print(" = ");
   224       s4o.print(" = ");
   225       function_name->accept(*this);
   225       function_name->accept(*this);
   226       if (f_decl != NULL) {
   226       if (f_decl != NULL) {
   227     	/* function being called is overloaded! */
   227         /* function being called is overloaded! */
   228     	s4o.print("__");
   228         s4o.print("__");
   229         print_function_parameter_data_types_c overloaded_func_suf(&s4o);
   229         print_function_parameter_data_types_c overloaded_func_suf(&s4o);
   230         f_decl->accept(overloaded_func_suf);
   230         f_decl->accept(overloaded_func_suf);
   231       }
   231       }
   232 
   232 
   233       if (function_type_suffix)
   233       if (function_type_suffix)
   271     }
   271     }
   272 
   272 
   273   private:
   273   private:
   274 
   274 
   275     /* A helper function... */
   275     /* A helper function... */
   276 	void CMP_operator_result_type() {
   276     void CMP_operator_result_type() {
   277 	  /* the data type resulting from this operation... */
   277       /* the data type resulting from this operation... */
   278 	  this->default_variable_name.current_type = &(this->bool_type);
   278       this->default_variable_name.current_type = &(this->bool_type);
   279 	}
   279     }
   280 
   280 
   281 	/* A helper function... */
   281     /* A helper function... */
   282     void BYTE_operator_result_type(void) {
   282     void BYTE_operator_result_type(void) {
   283 	  if (search_expression_type->is_literal_integer_type(this->default_variable_name.current_type)) {
   283       if (search_expression_type->is_literal_integer_type(this->default_variable_name.current_type)) {
   284 		if (search_expression_type->is_literal_integer_type(this->current_operand_type))
   284         if (search_expression_type->is_literal_integer_type(this->current_operand_type))
   285 		  this->default_variable_name.current_type = &(this->lword_type);
   285           this->default_variable_name.current_type = &(this->lword_type);
   286 		else
   286         else
   287 		  this->default_variable_name.current_type = this->current_operand_type;
   287           this->default_variable_name.current_type = this->current_operand_type;
   288 	  }
   288       }
   289 	  else if (search_expression_type->is_literal_integer_type(this->current_operand_type))
   289       else if (search_expression_type->is_literal_integer_type(this->current_operand_type))
   290 		  this->current_operand_type = this->default_variable_name.current_type;
   290           this->current_operand_type = this->default_variable_name.current_type;
   291 	}
   291     }
   292 
   292 
   293     /* A helper function... */
   293     /* A helper function... */
   294     void NUM_operator_result_type(void) {
   294     void NUM_operator_result_type(void) {
   295 	  if (search_expression_type->is_literal_real_type(this->default_variable_name.current_type)) {
   295       if (search_expression_type->is_literal_real_type(this->default_variable_name.current_type)) {
   296 		if (search_expression_type->is_literal_integer_type(this->current_operand_type) ||
   296         if (search_expression_type->is_literal_integer_type(this->current_operand_type) ||
   297 			search_expression_type->is_literal_real_type(this->current_operand_type))
   297             search_expression_type->is_literal_real_type(this->current_operand_type))
   298 		  this->default_variable_name.current_type = &(this->lreal_type);
   298           this->default_variable_name.current_type = &(this->lreal_type);
   299 		else
   299         else
   300 		  this->default_variable_name.current_type = this->current_operand_type;
   300           this->default_variable_name.current_type = this->current_operand_type;
   301 	  }
   301       }
   302 	  else if (search_expression_type->is_literal_integer_type(this->default_variable_name.current_type)) {
   302       else if (search_expression_type->is_literal_integer_type(this->default_variable_name.current_type)) {
   303 		if (search_expression_type->is_literal_integer_type(this->current_operand_type))
   303         if (search_expression_type->is_literal_integer_type(this->current_operand_type))
   304 		  this->default_variable_name.current_type = &(this->lint_type);
   304           this->default_variable_name.current_type = &(this->lint_type);
   305 		else if (search_expression_type->is_literal_real_type(this->current_operand_type))
   305         else if (search_expression_type->is_literal_real_type(this->current_operand_type))
   306 		  this->default_variable_name.current_type = &(this->lreal_type);
   306           this->default_variable_name.current_type = &(this->lreal_type);
   307 		else
   307         else
   308 		  this->default_variable_name.current_type = this->current_operand_type;
   308           this->default_variable_name.current_type = this->current_operand_type;
   309 	  }
   309       }
   310 	  else if (search_expression_type->is_literal_integer_type(this->current_operand_type) ||
   310       else if (search_expression_type->is_literal_integer_type(this->current_operand_type) ||
   311 			   search_expression_type->is_literal_real_type(this->current_operand_type))
   311                search_expression_type->is_literal_real_type(this->current_operand_type))
   312 		this->current_operand_type = this->default_variable_name.current_type;
   312         this->current_operand_type = this->default_variable_name.current_type;
   313 	}
   313     }
   314 
   314 
   315     void *print_getter(symbol_c *symbol) {
   315     void *print_getter(symbol_c *symbol) {
   316       unsigned int vartype = search_var_instance_decl->get_vartype(symbol);
   316       unsigned int vartype = search_var_instance_decl->get_vartype(symbol);
   317       if (vartype == search_var_instance_decl_c::external_vt)
   317       if (vartype == search_var_instance_decl_c::external_vt) {
   318     	s4o.print(GET_EXTERNAL);
   318         if (search_var_instance_decl->type_is_fb(symbol))
       
   319           s4o.print(GET_EXTERNAL_FB);
       
   320         else
       
   321           s4o.print(GET_EXTERNAL);
       
   322       }
   319       else if (vartype == search_var_instance_decl_c::located_vt)
   323       else if (vartype == search_var_instance_decl_c::located_vt)
   320     	s4o.print(GET_LOCATED);
   324         s4o.print(GET_LOCATED);
   321       else
   325       else
   322     	s4o.print(GET_VAR);
   326         s4o.print(GET_VAR);
   323       s4o.print("(");
   327       s4o.print("(");
   324 
   328 
   325       wanted_variablegeneration = complextype_base_vg;
   329       wanted_variablegeneration = complextype_base_vg;
   326       symbol->accept(*this);
   330       symbol->accept(*this);
   327       if (search_var_instance_decl->type_is_complex(symbol))
   331       if (search_var_instance_decl->type_is_complex(symbol))
   328     	s4o.print(",");
   332         s4o.print(",");
   329       wanted_variablegeneration = complextype_suffix_vg;
   333       wanted_variablegeneration = complextype_suffix_vg;
   330       symbol->accept(*this);
   334       symbol->accept(*this);
   331       s4o.print(")");
   335       s4o.print(")");
   332       wanted_variablegeneration = expression_vg;
   336       wanted_variablegeneration = expression_vg;
   333       return NULL;
   337       return NULL;
   334     }
   338     }
   335 
   339 
   336     void *print_setter(symbol_c* symbol,
   340     void *print_setter(symbol_c* symbol,
   337     		symbol_c* type,
   341             symbol_c* type,
   338     		symbol_c* value) {
   342             symbol_c* value) {
   339       unsigned int vartype = search_var_instance_decl->get_vartype(symbol);
   343       unsigned int vartype = search_var_instance_decl->get_vartype(symbol);
   340       if (vartype == search_var_instance_decl_c::external_vt)
   344       if (vartype == search_var_instance_decl_c::external_vt) {
   341         s4o.print(SET_EXTERNAL);
   345         if (search_var_instance_decl->type_is_fb(symbol))
       
   346           s4o.print(SET_EXTERNAL_FB);
       
   347          else
       
   348           s4o.print(SET_EXTERNAL);
       
   349       }
   342       else if (vartype == search_var_instance_decl_c::located_vt)
   350       else if (vartype == search_var_instance_decl_c::located_vt)
   343         s4o.print(SET_LOCATED);
   351         s4o.print(SET_LOCATED);
   344       else
   352       else
   345         s4o.print(SET_VAR);
   353         s4o.print(SET_VAR);
   346       s4o.print("(,");
   354       s4o.print("(,");
   405       if (generating_inlinefunction) {
   413       if (generating_inlinefunction) {
   406         switch (wanted_variablegeneration) {
   414         switch (wanted_variablegeneration) {
   407           case complextype_base_vg:
   415           case complextype_base_vg:
   408             symbol->record_variable->accept(*this);
   416             symbol->record_variable->accept(*this);
   409             if (!type_is_complex) {
   417             if (!type_is_complex) {
   410           	  s4o.print(".");
   418                 s4o.print(".");
   411           	  symbol->field_selector->accept(*this);
   419                 symbol->field_selector->accept(*this);
   412             }
   420             }
   413             break;
   421             break;
   414           case complextype_suffix_vg:
   422           case complextype_suffix_vg:
   415             symbol->record_variable->accept(*this);
   423             symbol->record_variable->accept(*this);
   416             if (type_is_complex) {
   424             if (type_is_complex) {
   826       this->il_default_variable_init_value = NULL;
   834       this->il_default_variable_init_value = NULL;
   827 
   835 
   828       iterator_visitor_c::visit(symbol);
   836       iterator_visitor_c::visit(symbol);
   829 
   837 
   830       /* copy the result in the default variable to the variable
   838       /* copy the result in the default variable to the variable
   831 	   * used to pass the data out to the scope enclosing
   839        * used to pass the data out to the scope enclosing
   832 	   * the current scope!
   840        * the current scope!
   833 	   *
   841        *
   834 	   * We also need to update the data type currently stored within
   842        * We also need to update the data type currently stored within
   835 	   * the variable used to pass the data to the outside scope...
   843        * the variable used to pass the data to the outside scope...
   836 	   */
   844        */
   837 	  this->default_variable_back_name.current_type = this->default_variable_name.current_type;
   845       this->default_variable_back_name.current_type = this->default_variable_name.current_type;
   838 	  return NULL;
   846       return NULL;
   839     }
   847     }
   840     
   848     
   841     // SYM_REF1(il_simple_instruction_c, il_simple_instruction, symbol_c *prev_il_instruction;)
   849     // SYM_REF1(il_simple_instruction_c, il_simple_instruction, symbol_c *prev_il_instruction;)
   842     void *visit(il_simple_instruction_c *symbol)	{
   850     void *visit(il_simple_instruction_c *symbol) {
   843       return symbol->il_simple_instruction->accept(*this);
   851       return symbol->il_simple_instruction->accept(*this);
   844     }
   852     }
   845 
   853 
   846     void *visit(LD_operator_c *symbol)	{
   854     void *visit(LD_operator_c *symbol) {
   847       /* the data type resulting from this operation... */
   855       /* the data type resulting from this operation... */
   848       this->default_variable_name.current_type = this->current_operand_type;
   856       this->default_variable_name.current_type = this->current_operand_type;
   849       return NULL;
   857       return NULL;
   850     }
   858     }
   851 
   859 
   852     void *visit(LDN_operator_c *symbol)	{
   860     void *visit(LDN_operator_c *symbol) {
   853       /* the data type resulting from this operation... */
   861       /* the data type resulting from this operation... */
   854       this->default_variable_name.current_type = this->current_operand_type;
   862       this->default_variable_name.current_type = this->current_operand_type;
   855       return NULL;
   863       return NULL;
   856     }
   864     }
   857 
   865 
   858     void *visit(AND_operator_c *symbol)	{
   866     void *visit(AND_operator_c *symbol) {
   859       if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
   867       if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
   860           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   868           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   861     	BYTE_operator_result_type();
   869         BYTE_operator_result_type();
   862       }
   870       }
   863       else {ERROR;}
   871       else {ERROR;}
   864       return NULL;
   872       return NULL;
   865     }
   873     }
   866 
   874 
   867     void *visit(OR_operator_c *symbol)	{
   875     void *visit(OR_operator_c *symbol) {
   868       if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
   876       if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
   869           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   877           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   870     	BYTE_operator_result_type();
   878         BYTE_operator_result_type();
   871       }
   879       }
   872       else {ERROR;}
   880       else {ERROR;}
   873       return NULL;
   881       return NULL;
   874     }
   882     }
   875 
   883 
   876     void *visit(XOR_operator_c *symbol)	{
   884     void *visit(XOR_operator_c *symbol) {
   877       if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
   885       if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
   878           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   886           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   879     	BYTE_operator_result_type();
   887         BYTE_operator_result_type();
   880       }
   888       }
   881       else {ERROR;}
   889       else {ERROR;}
   882       return NULL;
   890       return NULL;
   883     }
   891     }
   884 
   892 
   885     void *visit(ANDN_operator_c *symbol)	{
   893     void *visit(ANDN_operator_c *symbol) {
   886       if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
   894       if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
   887           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   895           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   888     	BYTE_operator_result_type();
   896         BYTE_operator_result_type();
   889       }
   897       }
   890       else {ERROR;}
   898       else {ERROR;}
   891       return NULL;
   899       return NULL;
   892     }
   900     }
   893 
   901 
   894     void *visit(ORN_operator_c *symbol)	{
   902     void *visit(ORN_operator_c *symbol) {
   895       if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
   903       if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
   896           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   904           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   897     	BYTE_operator_result_type();
   905         BYTE_operator_result_type();
   898       }
   906       }
   899       else {ERROR;}
   907       else {ERROR;}
   900       return NULL;
   908       return NULL;
   901     }
   909     }
   902 
   910 
   903     void *visit(XORN_operator_c *symbol)	{
   911     void *visit(XORN_operator_c *symbol) {
   904       if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
   912       if (search_expression_type->is_binary_type(this->default_variable_name.current_type) &&
   905           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   913           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   906     	BYTE_operator_result_type();
   914         BYTE_operator_result_type();
   907       }
   915       }
   908       else {ERROR;}
   916       else {ERROR;}
   909       return NULL;
   917       return NULL;
   910     }
   918     }
   911 
   919 
   912     void *visit(ADD_operator_c *symbol)	{
   920     void *visit(ADD_operator_c *symbol) {
   913       if (search_expression_type->is_time_type(this->default_variable_name.current_type) &&
   921       if (search_expression_type->is_time_type(this->default_variable_name.current_type) &&
   914           search_expression_type->is_time_type(this->current_operand_type)) {
   922           search_expression_type->is_time_type(this->current_operand_type)) {
   915         /* the data type resulting from this operation... */
   923         /* the data type resulting from this operation... */
   916         this->default_variable_name.current_type = this->current_operand_type;
   924         this->default_variable_name.current_type = this->current_operand_type;
   917       }
   925       }
   921       }
   929       }
   922       else {ERROR;}
   930       else {ERROR;}
   923       return NULL;
   931       return NULL;
   924     }
   932     }
   925 
   933 
   926     void *visit(SUB_operator_c *symbol)	{
   934     void *visit(SUB_operator_c *symbol) {
   927       if (search_expression_type->is_time_type(this->default_variable_name.current_type) &&
   935       if (search_expression_type->is_time_type(this->default_variable_name.current_type) &&
   928           search_expression_type->is_time_type(this->current_operand_type)) {
   936           search_expression_type->is_time_type(this->current_operand_type)) {
   929         /* the data type resulting from this operation... */
   937         /* the data type resulting from this operation... */
   930         this->default_variable_name.current_type = this->current_operand_type;
   938         this->default_variable_name.current_type = this->current_operand_type;
   931       }
   939       }
   932       else if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
   940       else if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
   933           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   941           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   934     	NUM_operator_result_type();
   942         NUM_operator_result_type();
   935       }
   943       }
   936       else {ERROR;}
   944       else {ERROR;}
   937       return NULL;
   945       return NULL;
   938     }
   946     }
   939 
   947 
   940     void *visit(MUL_operator_c *symbol)	{
   948     void *visit(MUL_operator_c *symbol) {
   941       if (search_expression_type->is_time_type(this->default_variable_name.current_type) &&
   949       if (search_expression_type->is_time_type(this->default_variable_name.current_type) &&
   942           search_expression_type->is_integer_type(this->current_operand_type)) {
   950           search_expression_type->is_integer_type(this->current_operand_type)) {
   943         /* the data type resulting from this operation is unchanged! */
   951         /* the data type resulting from this operation is unchanged! */
   944       }
   952       }
   945       else if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
   953       else if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
   946           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   954           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   947     	NUM_operator_result_type();
   955         NUM_operator_result_type();
   948       }
   956       }
   949       else {ERROR;}
   957       else {ERROR;}
   950       return NULL;
   958       return NULL;
   951     }
   959     }
   952 
   960 
   953     void *visit(DIV_operator_c *symbol)	{
   961     void *visit(DIV_operator_c *symbol) {
   954       if (search_expression_type->is_time_type(this->default_variable_name.current_type) &&
   962       if (search_expression_type->is_time_type(this->default_variable_name.current_type) &&
   955           search_expression_type->is_integer_type(this->current_operand_type)) {
   963           search_expression_type->is_integer_type(this->current_operand_type)) {
   956         /* the data type resulting from this operation is unchanged! */
   964         /* the data type resulting from this operation is unchanged! */
   957       }
   965       }
   958       else if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
   966       else if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
   961       }
   969       }
   962       else {ERROR;}
   970       else {ERROR;}
   963       return NULL;
   971       return NULL;
   964     }
   972     }
   965 
   973 
   966     void *visit(MOD_operator_c *symbol)	{
   974     void *visit(MOD_operator_c *symbol) {
   967       if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
   975       if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
   968           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   976           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   969         NUM_operator_result_type();
   977         NUM_operator_result_type();
   970       }
   978       }
   971       else {ERROR;}
   979       else {ERROR;}
   972       return NULL;
   980       return NULL;
   973     }
   981     }
   974 
   982 
   975     void *visit(GT_operator_c *symbol)	{
   983     void *visit(GT_operator_c *symbol) {
   976       if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) &&
   984       if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) &&
   977           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   985           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   978         CMP_operator_result_type();
   986         CMP_operator_result_type();
   979       }
   987       }
   980       else {ERROR;}
   988       else {ERROR;}
   981       return NULL;
   989       return NULL;
   982     }
   990     }
   983 
   991 
   984     void *visit(GE_operator_c *symbol)	{
   992     void *visit(GE_operator_c *symbol) {
   985       if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) &&
   993       if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) &&
   986           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   994           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   987         CMP_operator_result_type();
   995         CMP_operator_result_type();
   988       }
   996       }
   989       else {ERROR;}
   997       else {ERROR;}
   990       return NULL;
   998       return NULL;
   991     }
   999     }
   992 
  1000 
   993     void *visit(EQ_operator_c *symbol)	{
  1001     void *visit(EQ_operator_c *symbol) {
   994       if (search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
  1002       if (search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
   995         CMP_operator_result_type();
  1003         CMP_operator_result_type();
   996       }
  1004       }
   997       else {ERROR;}
  1005       else {ERROR;}
   998       return NULL;
  1006       return NULL;
   999     }
  1007     }
  1000 
  1008 
  1001     void *visit(LT_operator_c *symbol)	{
  1009     void *visit(LT_operator_c *symbol) {
  1002       if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) &&
  1010       if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) &&
  1003           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
  1011           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
  1004         CMP_operator_result_type();
  1012         CMP_operator_result_type();
  1005       }
  1013       }
  1006       else {ERROR;}
  1014       else {ERROR;}
  1007       return NULL;
  1015       return NULL;
  1008     }
  1016     }
  1009 
  1017 
  1010     void *visit(LE_operator_c *symbol)	{
  1018     void *visit(LE_operator_c *symbol) {
  1011       if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) &&
  1019       if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) &&
  1012           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
  1020           search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
  1013         CMP_operator_result_type();
  1021         CMP_operator_result_type();
  1014       }
  1022       }
  1015       else {ERROR;}
  1023       else {ERROR;}
  1016       return NULL;
  1024       return NULL;
  1017     }
  1025     }
  1018 
  1026 
  1019     void *visit(NE_operator_c *symbol)	{
  1027     void *visit(NE_operator_c *symbol) {
  1020       if (search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
  1028       if (search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
  1021         CMP_operator_result_type();
  1029         CMP_operator_result_type();
  1022       }
  1030       }
  1023       else {ERROR;}
  1031       else {ERROR;}
  1024       return NULL;
  1032       return NULL;
  1030     /***********************/
  1038     /***********************/
  1031     /* B 3.1 - Expressions */
  1039     /* B 3.1 - Expressions */
  1032     /***********************/
  1040     /***********************/
  1033 
  1041 
  1034     void *visit(statement_list_c *symbol) {
  1042     void *visit(statement_list_c *symbol) {
  1035 	  function_call_iterator_c fc_iterator(symbol);
  1043       function_call_iterator_c fc_iterator(symbol);
  1036 	  symbol_c* function_call;
  1044       symbol_c* function_call;
  1037 	  while ((function_call = fc_iterator.next()) != NULL) {
  1045       while ((function_call = fc_iterator.next()) != NULL) {
  1038 		function_call->accept(*this);
  1046         function_call->accept(*this);
  1039 	  }
  1047       }
  1040 	  return NULL;
  1048       return NULL;
  1041 	}
  1049     }
  1042 
  1050 
  1043     void *visit(function_invocation_c *symbol) {
  1051     void *visit(function_invocation_c *symbol) {
  1044       symbol_c* function_type_prefix = NULL;
  1052       symbol_c* function_type_prefix = NULL;
  1045       symbol_c* function_name = NULL;
  1053       symbol_c* function_name = NULL;
  1046       symbol_c* function_type_suffix = NULL;
  1054       symbol_c* function_type_suffix = NULL;
  1168       CLEAR_PARAM_LIST()
  1176       CLEAR_PARAM_LIST()
  1169 
  1177 
  1170       return NULL;
  1178       return NULL;
  1171     }
  1179     }
  1172 
  1180 
  1173 	/*********************************************/
  1181     /*********************************************/
  1174 	/* B.1.6  Sequential function chart elements */
  1182     /* B.1.6  Sequential function chart elements */
  1175 	/*********************************************/
  1183     /*********************************************/
  1176 
  1184 
  1177 	void *visit(initial_step_c *symbol) {
  1185     void *visit(initial_step_c *symbol) {
  1178 		return NULL;
  1186         return NULL;
  1179 	}
  1187     }
  1180 
  1188 
  1181 	void *visit(step_c *symbol) {
  1189     void *visit(step_c *symbol) {
  1182 		return NULL;
  1190         return NULL;
  1183 	}
  1191     }
  1184 
  1192 
  1185 	void *visit(transition_c *symbol) {
  1193     void *visit(transition_c *symbol) {
  1186 		return symbol->transition_condition->accept(*this);
  1194         return symbol->transition_condition->accept(*this);
  1187 	}
  1195     }
  1188 
  1196 
  1189 	void *visit(transition_condition_c *symbol) {
  1197     void *visit(transition_condition_c *symbol) {
  1190 		// Transition condition is in IL
  1198         // Transition condition is in IL
  1191 		if (symbol->transition_condition_il != NULL) {
  1199         if (symbol->transition_condition_il != NULL) {
  1192 			symbol->transition_condition_il->accept(*this);
  1200             symbol->transition_condition_il->accept(*this);
  1193 		}
  1201         }
  1194 
  1202 
  1195 		// Transition condition is in ST
  1203         // Transition condition is in ST
  1196 		if (symbol->transition_condition_st != NULL) {
  1204         if (symbol->transition_condition_st != NULL) {
  1197 			function_call_iterator_c fc_iterator(symbol->transition_condition_st);
  1205             function_call_iterator_c fc_iterator(symbol->transition_condition_st);
  1198 			symbol_c* function_call;
  1206             symbol_c* function_call;
  1199 			while ((function_call = fc_iterator.next()) != NULL) {
  1207             while ((function_call = fc_iterator.next()) != NULL) {
  1200 				function_call->accept(*this);
  1208                 function_call->accept(*this);
  1201 			}
  1209             }
  1202 		}
  1210         }
  1203 
  1211 
  1204 		return NULL;
  1212         return NULL;
  1205 	}
  1213     }
  1206 
  1214 
  1207 	void *visit(action_c *symbol) {
  1215     void *visit(action_c *symbol) {
  1208 		return symbol->function_block_body->accept(*this);
  1216         return symbol->function_block_body->accept(*this);
  1209 	}
  1217     }
  1210 
  1218 
  1211 };  /* generate_c_inlinefcall_c */
  1219 };  /* generate_c_inlinefcall_c */
  1212 
  1220