stage4/generate_c/generate_c_inlinefcall.cc
author laurent
Mon, 04 Jul 2011 15:27:09 +0200
changeset 332 0f1d91a37506
parent 321 a96399ab57c2
child 336 229eb3e29216
permissions -rwxr-xr-x
Fix bug in inline function calls when using function with undetermined type interface with literals as input
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
     1
/*
279
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
     2
 *  matiec - a compiler for the programming languages defined in IEC 61131-3
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
     3
 *
279
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
     4
 *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
     5
 *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
     6
 *
279
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
     7
 *  This program is free software: you can redistribute it and/or modify
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
     8
 *  it under the terms of the GNU General Public License as published by
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
     9
 *  the Free Software Foundation, either version 3 of the License, or
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
    10
 *  (at your option) any later version.
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
    11
 *
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
    12
 *  This program is distributed in the hope that it will be useful,
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
    13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
    14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
    15
 *  GNU General Public License for more details.
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
    16
 *
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
    17
 *  You should have received a copy of the GNU General Public License
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
    18
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 238
diff changeset
    19
 *
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    20
 *
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    21
 * This code is made available on the understanding that it will not be
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    22
 * used in safety-critical situations without a full and competent review.
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    23
 */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    24
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    25
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    26
#define INLINE_RESULT_TEMP_VAR "__res"
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    27
234
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    28
class generate_c_inlinefcall_c: public generate_c_typedecl_c {
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    29
221
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 219
diff changeset
    30
  public:
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 219
diff changeset
    31
    typedef enum {
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 219
diff changeset
    32
      expression_vg,
228
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
    33
      assignment_vg,
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
    34
      complextype_base_vg,
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
    35
      complextype_suffix_vg
221
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 219
diff changeset
    36
    } variablegeneration_t;
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 219
diff changeset
    37
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    38
  private:
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    39
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    40
    /* The name of the IL default variable... */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    41
	#define IL_DEFVAR   VAR_LEADER "IL_DEFVAR"
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    42
	/* The name of the variable used to pass the result of a
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    43
	 * parenthesised instruction list to the immediately preceding
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    44
	 * scope ...
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    45
	 */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    46
	il_default_variable_c default_variable_name;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    47
228
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
    48
	symbol_c* current_array_type;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
    49
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    50
	int fcall_number;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    51
	symbol_c *fbname;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    52
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    53
    search_expression_type_c *search_expression_type;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    54
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    55
    search_varfb_instance_type_c *search_varfb_instance_type;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    56
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    57
    search_base_type_c search_base_type;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    58
221
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 219
diff changeset
    59
    variablegeneration_t wanted_variablegeneration;
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 219
diff changeset
    60
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    61
  public:
234
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    62
    generate_c_inlinefcall_c(stage4out_c *s4o_ptr, symbol_c *name, symbol_c *scope, const char *variable_prefix = NULL)
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    63
    : generate_c_typedecl_c(s4o_ptr),
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    64
      default_variable_name(IL_DEFVAR, NULL)
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    65
    {
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    66
      search_expression_type = new search_expression_type_c(scope);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    67
      search_varfb_instance_type = new search_varfb_instance_type_c(scope);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    68
      this->set_variable_prefix(variable_prefix);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    69
      fcall_number = 0;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    70
      fbname = name;
221
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 219
diff changeset
    71
      wanted_variablegeneration = expression_vg;
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    72
    }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    73
234
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    74
    virtual ~generate_c_inlinefcall_c(void) {
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    75
      delete search_expression_type;
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    76
      delete search_varfb_instance_type;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    77
    }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    78
234
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    79
    void print(symbol_c* symbol) {
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    80
      function_call_iterator_c fc_iterator(symbol);
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    81
      symbol_c* function_call;
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    82
      while ((function_call = fc_iterator.next()) != NULL) {
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    83
    	function_call->accept(*this);
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    84
      }
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    85
    }
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    86
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    87
    void generate_inline(symbol_c *function_name,
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
    88
            symbol_c *function_type_prefix,
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
    89
            symbol_c *function_type_suffix,
234
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    90
            std::list<FUNCTION_PARAM*> param_list) {
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
    91
            std::list<FUNCTION_PARAM*>::iterator pt;
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    92
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
    93
      fcall_number++;
332
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
    94
      if (search_expression_type->is_literal_integer_type(function_type_prefix)) {
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
    95
    	function_type_prefix = (symbol_c *)&search_constant_type_c::lint_type_name;
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
    96
      }
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
    97
      else if (search_expression_type->is_literal_real_type(function_type_prefix)) {
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
    98
    	function_type_prefix = (symbol_c *)&search_constant_type_c::lreal_type_name;
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
    99
      }
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   100
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   101
      s4o.print(s4o.indent_spaces);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   102
      s4o.print("inline ");
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   103
      function_type_prefix->accept(*this);
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   104
      s4o.print(" __");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   105
      fbname->accept(*this);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   106
      s4o.print("_");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   107
      function_name->accept(*this);
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   108
      if (function_type_suffix)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   109
        function_type_suffix->accept(*this);
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   110
      s4o.print_integer(fcall_number);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   111
      s4o.print("(");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   112
      s4o.indent_right();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   113
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   114
      PARAM_LIST_ITERATOR() {
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   115
        if (PARAM_DIRECTION == function_param_iterator_c::direction_in) {
332
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
   116
          if (search_expression_type->is_literal_integer_type(PARAM_TYPE)) {
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
   117
        	((symbol_c *)&search_constant_type_c::lint_type_name)->accept(*this);
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
   118
          }
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
   119
          else if (search_expression_type->is_literal_real_type(PARAM_TYPE)) {
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
   120
        	((symbol_c *)&search_constant_type_c::lreal_type_name)->accept(*this);
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
   121
          }
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
   122
          else {
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
   123
        	PARAM_TYPE->accept(*this);
0f1d91a37506 Fix bug in inline function calls when using function with undetermined type interface with literals as input
laurent
parents: 321
diff changeset
   124
          }
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   125
          s4o.print(" ");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   126
          PARAM_NAME->accept(*this);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   127
          s4o.print(",\n" + s4o.indent_spaces);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   128
        }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   129
      }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   130
      fbname->accept(*this);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   131
	  s4o.print(" *");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   132
	  s4o.print(FB_FUNCTION_PARAM);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   133
	  s4o.indent_left();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   134
	  s4o.print(")\n" + s4o.indent_spaces);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   135
	  s4o.print("{\n");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   136
      s4o.indent_right();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   137
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   138
      s4o.print(s4o.indent_spaces);
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   139
      function_type_prefix->accept(*this);
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   140
      s4o.print(" "),
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   141
      s4o.print(INLINE_RESULT_TEMP_VAR);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   142
      s4o.print(";\n");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   143
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   144
	  PARAM_LIST_ITERATOR() {
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   145
		if ((PARAM_DIRECTION == function_param_iterator_c::direction_out ||
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   146
		     PARAM_DIRECTION == function_param_iterator_c::direction_inout) &&
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   147
		    PARAM_VALUE != NULL) {
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   148
		  s4o.print(s4o.indent_spaces);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   149
		  PARAM_TYPE->accept(*this);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   150
          s4o.print(" ");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   151
          s4o.print(TEMP_VAR);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   152
          PARAM_NAME->accept(*this);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   153
          s4o.print(" = ");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   154
          print_check_function(PARAM_TYPE, PARAM_VALUE);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   155
          s4o.print(";\n");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   156
		}
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   157
	  }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   158
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   159
	  s4o.print(s4o.indent_spaces + INLINE_RESULT_TEMP_VAR),
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   160
			  s4o.print(" = ");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   161
	  function_name->accept(*this);
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   162
	  if (function_type_suffix)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   163
        function_type_suffix->accept(*this);
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   164
	  s4o.print("(");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   165
	  s4o.indent_right();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   166
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   167
	  PARAM_LIST_ITERATOR() {
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   168
		if (pt != param_list.begin())
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   169
		  s4o.print(",\n" + s4o.indent_spaces);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   170
		if (PARAM_DIRECTION == function_param_iterator_c::direction_in)
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   171
		  PARAM_NAME->accept(*this);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   172
		else if (PARAM_VALUE != NULL){
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   173
          s4o.print("&");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   174
          s4o.print(TEMP_VAR);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   175
          PARAM_NAME->accept(*this);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   176
        }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   177
		else {
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   178
		  s4o.print("NULL");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   179
		}
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   180
	  }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   181
	  s4o.print(");\n");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   182
	  s4o.indent_left();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   183
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   184
	  PARAM_LIST_ITERATOR() {
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   185
        if ((PARAM_DIRECTION == function_param_iterator_c::direction_out ||
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   186
        	 PARAM_DIRECTION == function_param_iterator_c::direction_inout) &&
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   187
        	PARAM_VALUE != NULL) {
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   188
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   189
          s4o.print(s4o.indent_spaces);
228
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   190
          print_setter(PARAM_VALUE, PARAM_TYPE, PARAM_NAME);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   191
          s4o.print(";\n");
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   192
		}
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   193
	  }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   194
	  s4o.print(s4o.indent_spaces + "return ");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   195
	  s4o.print(INLINE_RESULT_TEMP_VAR);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   196
	  s4o.print(";\n");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   197
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   198
      s4o.indent_left();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   199
      s4o.print(s4o.indent_spaces + "}\n\n");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   200
    }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   201
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   202
  private:
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   203
228
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   204
    void *print_getter(symbol_c *symbol) {
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   205
      unsigned int vartype = search_varfb_instance_type->get_vartype(symbol);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   206
      if (vartype == search_var_instance_decl_c::external_vt)
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   207
    	s4o.print(GET_EXTERNAL);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   208
      else if (vartype == search_var_instance_decl_c::located_vt)
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   209
    	s4o.print(GET_LOCATED);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   210
      else
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   211
    	s4o.print(GET_VAR);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   212
      s4o.print("(");
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   213
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   214
      wanted_variablegeneration = complextype_base_vg;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   215
      symbol->accept(*this);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   216
      if (search_varfb_instance_type->type_is_complex())
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   217
    	s4o.print(",");
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   218
      wanted_variablegeneration = complextype_suffix_vg;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   219
      symbol->accept(*this);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   220
      s4o.print(")");
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   221
      wanted_variablegeneration = expression_vg;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   222
      return NULL;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   223
    }
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   224
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   225
    void *print_setter(symbol_c* symbol,
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   226
    		symbol_c* type,
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   227
    		symbol_c* value) {
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   228
      unsigned int vartype = search_varfb_instance_type->get_vartype(symbol);
231
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   229
      if (vartype == search_var_instance_decl_c::external_vt) {
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   230
        symbolic_variable_c *variable = dynamic_cast<symbolic_variable_c *>(symbol);
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   231
        /* TODO Find a solution for forcing global complex variables */
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   232
        if (variable != NULL) {
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   233
          s4o.print(SET_EXTERNAL);
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   234
          s4o.print("(");
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   235
          variable->var_name->accept(*this);
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   236
          s4o.print(",");
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   237
        }
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   238
        else {
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   239
          s4o.print(SET_COMPLEX_EXTERNAL);
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   240
          s4o.print("(");
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   241
        }
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   242
      }
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   243
      else {
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   244
        if (vartype == search_var_instance_decl_c::located_vt)
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   245
          s4o.print(SET_LOCATED);
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   246
        else
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   247
          s4o.print(SET_VAR);
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   248
        s4o.print("(");
b8527b0abe75 Adding support for forcing global without perturbation from setting external
laurent
parents: 228
diff changeset
   249
      }
228
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   250
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   251
      wanted_variablegeneration = complextype_base_vg;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   252
      symbol->accept(*this);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   253
      s4o.print(",");
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   254
      wanted_variablegeneration = expression_vg;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   255
      print_check_function(type, value, NULL, true);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   256
      if (search_varfb_instance_type->type_is_complex()) {
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   257
        s4o.print(",");
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   258
        wanted_variablegeneration = complextype_suffix_vg;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   259
        symbol->accept(*this);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   260
      }
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   261
      s4o.print(")");
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   262
      wanted_variablegeneration = expression_vg;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   263
      return NULL;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   264
    }
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   265
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   266
    /*********************/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   267
    /* B 1.4 - Variables */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   268
    /*********************/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   269
    void *visit(symbolic_variable_c *symbol) {
228
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   270
      unsigned int vartype;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   271
      if (wanted_variablegeneration == complextype_base_vg)
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   272
        generate_c_base_c::visit(symbol);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   273
      else if (wanted_variablegeneration == complextype_suffix_vg)
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   274
        return NULL;
221
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 219
diff changeset
   275
      else
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   276
        print_getter(symbol);
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   277
      return NULL;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   278
    }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   279
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   280
    /********************************************/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   281
    /* B.1.4.1   Directly Represented Variables */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   282
    /********************************************/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   283
    // direct_variable: direct_variable_token   {$$ = new direct_variable_c($1);};
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   284
    void *visit(direct_variable_c *symbol) {
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   285
      TRACE("direct_variable_c");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   286
      /* Do not use print_token() as it will change everything into uppercase */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   287
      if (strlen(symbol->value) == 0) ERROR;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   288
      s4o.print(GET_LOCATED);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   289
      s4o.print("(");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   290
      this->print_variable_prefix();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   291
      s4o.printlocation(symbol->value + 1);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   292
      s4o.print(")");
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   293
      return NULL;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   294
    }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   295
228
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   296
    /*************************************/
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   297
    /* B.1.4.2   Multi-element Variables */
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   298
    /*************************************/
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   299
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   300
    // SYM_REF2(structured_variable_c, record_variable, field_selector)
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   301
    void *visit(structured_variable_c *symbol) {
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   302
      TRACE("structured_variable_c");
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   303
      switch (wanted_variablegeneration) {
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   304
        case complextype_base_vg:
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   305
          symbol->record_variable->accept(*this);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   306
          break;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   307
        case complextype_suffix_vg:
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   308
          symbol->record_variable->accept(*this);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   309
          s4o.print(".");
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   310
          symbol->field_selector->accept(*this);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   311
          break;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   312
        default:
237
cece842c7417 Adding support for using arrays in POU interface
laurent
parents: 235
diff changeset
   313
          print_getter(symbol);
228
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   314
          break;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   315
      }
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   316
      return NULL;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   317
    }
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   318
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   319
    /*  subscripted_variable '[' subscript_list ']' */
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   320
    //SYM_REF2(array_variable_c, subscripted_variable, subscript_list)
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   321
    void *visit(array_variable_c *symbol) {
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   322
      switch (wanted_variablegeneration) {
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   323
        case complextype_base_vg:
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   324
          symbol->subscripted_variable->accept(*this);
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   325
          break;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   326
        case complextype_suffix_vg:
238
0919986a5c98 Bug when trying to get type of elements in a big complex structure fixed
laurent
parents: 237
diff changeset
   327
          symbol->subscripted_variable->accept(*this);
0919986a5c98 Bug when trying to get type of elements in a big complex structure fixed
laurent
parents: 237
diff changeset
   328
321
a96399ab57c2 Add better comments, and change name of functions to clarify what they do.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   329
          current_array_type = search_varfb_instance_type->get_type_id(symbol->subscripted_variable);
238
0919986a5c98 Bug when trying to get type of elements in a big complex structure fixed
laurent
parents: 237
diff changeset
   330
          if (current_array_type == NULL) ERROR;
0919986a5c98 Bug when trying to get type of elements in a big complex structure fixed
laurent
parents: 237
diff changeset
   331
0919986a5c98 Bug when trying to get type of elements in a big complex structure fixed
laurent
parents: 237
diff changeset
   332
          s4o.print(".table");
0919986a5c98 Bug when trying to get type of elements in a big complex structure fixed
laurent
parents: 237
diff changeset
   333
          symbol->subscript_list->accept(*this);
0919986a5c98 Bug when trying to get type of elements in a big complex structure fixed
laurent
parents: 237
diff changeset
   334
0919986a5c98 Bug when trying to get type of elements in a big complex structure fixed
laurent
parents: 237
diff changeset
   335
          current_array_type = NULL;
228
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   336
          break;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   337
        default:
237
cece842c7417 Adding support for using arrays in POU interface
laurent
parents: 235
diff changeset
   338
          print_getter(symbol);
228
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   339
          break;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   340
      }
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   341
      return NULL;
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   342
    }
43831b683764 Adding support for setter and getter on complex datatype in IL
berem
parents: 221
diff changeset
   343
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   344
    /****************************************/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   345
    /* B.2 - Language IL (Instruction List) */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   346
    /****************************************/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   347
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   348
    /***********************************/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   349
    /* B 2.1 Instructions and Operands */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   350
    /***********************************/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   351
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   352
    void *visit(il_function_call_c *symbol) {
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   353
      symbol_c* function_type_prefix = NULL;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   354
      symbol_c* function_name = NULL;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   355
      symbol_c* function_type_suffix = NULL;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   356
      DECLARE_PARAM_LIST()
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   357
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   358
      symbol_c *param_data_type = default_variable_name.current_type;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   359
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   360
      function_call_param_iterator_c function_call_param_iterator(symbol);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   361
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   362
      function_declaration_c *f_decl = function_symtable.find_value(symbol->function_name);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   363
	  if (f_decl == function_symtable.end_value()) {
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   364
        function_type_t current_function_type = get_function_type((identifier_c *)symbol->function_name);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   365
        if (current_function_type == function_none) ERROR;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   366
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   367
        function_type_prefix = (symbol_c *)search_expression_type->compute_standard_function_il(symbol, param_data_type);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   368
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   369
        symbol_c *en_param_name = (symbol_c *)(new identifier_c("EN"));
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   370
        /* Add the value from EN param */
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   371
        ADD_PARAM_LIST(en_param_name,
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   372
                       (symbol_c*)(new boolean_literal_c((symbol_c*)(new bool_type_name_c()), new boolean_true_c())),
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   373
                       (symbol_c*)(new bool_type_name_c()),
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   374
                       function_param_iterator_c::direction_in)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   375
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   376
        symbol_c *eno_param_name = (symbol_c *)(new identifier_c("ENO"));
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   377
        /* Add the value from ENO param */
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   378
        ADD_PARAM_LIST(eno_param_name, NULL, (symbol_c*)(new bool_type_name_c()), function_param_iterator_c::direction_out)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   379
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   380
        int nb_param = 1;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   381
        if (symbol->il_operand_list != NULL)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   382
          nb_param += ((list_c *)symbol->il_operand_list)->n;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   383
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   384
        #include "il_code_gen.c"
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   385
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   386
      }
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   387
	  else {
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   388
		function_name = symbol->function_name;
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   389
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   390
		/* determine the base data type returned by the function being called... */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   391
		search_base_type_c search_base_type;
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   392
		function_type_prefix = (symbol_c *)f_decl->type_name->accept(search_base_type);
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   393
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   394
		/* loop through each function parameter, find the value we should pass
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   395
		 * to it, and then output the c equivalent...
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   396
		 */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   397
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   398
		function_param_iterator_c fp_iterator(f_decl);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   399
		identifier_c *param_name;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   400
		for(int i = 1; (param_name = fp_iterator.next()) != NULL; i++) {
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   401
		  symbol_c *param_type = fp_iterator.param_type();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   402
		  if (param_type == NULL) ERROR;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   403
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   404
		  function_param_iterator_c::param_direction_t param_direction = fp_iterator.param_direction();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   405
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   406
		  symbol_c *param_value = NULL;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   407
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   408
		  /* if it is the first parameter, semantics specifies that we should
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   409
		   * get the value off the IL default variable!
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   410
		   */
233
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   411
		  if (1 == i)
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   412
		    param_value = &this->default_variable_name;
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   413
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   414
		  /* Get the value from a foo(<param_name> = <param_value>) style call */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   415
		  /* NOTE: the following line of code is not required in this case, but it doesn't
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   416
		   * harm to leave it in, as in the case of a non-formal syntax function call,
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   417
		   * it will always return NULL.
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   418
		   * We leave it in in case we later decide to merge this part of the code together
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   419
		   * with the function calling code in generate_c_st_c, which does require
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   420
		   * the following line...
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   421
		   */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   422
		  if (param_value == NULL)
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   423
			param_value = function_call_param_iterator.search_f(param_name);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   424
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   425
		  /* Get the value from a foo(<param_value>) style call */
233
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   426
          if (param_value == NULL) {
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   427
            param_value = function_call_param_iterator.next_nf();
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   428
            if (param_value != NULL && fp_iterator.is_en_eno_param_implicit()) ERROR;
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   429
          }
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   430
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   431
		  if (param_value == NULL && param_direction == function_param_iterator_c::direction_in) {
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   432
			/* No value given for parameter, so we must use the default... */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   433
			/* First check whether default value specified in function declaration...*/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   434
			param_value = fp_iterator.default_value();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   435
		  }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   436
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   437
		  ADD_PARAM_LIST(param_name, param_value, param_type, fp_iterator.param_direction())
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   438
		} /* for(...) */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   439
	  }
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   440
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   441
	  if (function_call_param_iterator.next_nf() != NULL) ERROR;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   442
      if (NULL == function_type_prefix) ERROR;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   443
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   444
      bool has_output_params = false;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   445
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   446
      PARAM_LIST_ITERATOR() {
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   447
        if ((PARAM_DIRECTION == function_param_iterator_c::direction_out ||
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   448
             PARAM_DIRECTION == function_param_iterator_c::direction_inout) &&
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   449
             PARAM_VALUE != NULL) {
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   450
          has_output_params = true;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   451
        }
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   452
      }
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   453
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   454
      if (has_output_params)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   455
        generate_inline(function_name, function_type_prefix, function_type_suffix, param_list);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   456
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   457
      CLEAR_PARAM_LIST()
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   458
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   459
      return NULL;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   460
    }
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   461
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   462
    /* | function_name '(' eol_list [il_param_list] ')' */
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   463
    // SYM_REF2(il_formal_funct_call_c, function_name, il_param_list)
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   464
    void *visit(il_formal_funct_call_c *symbol) {
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   465
      symbol_c* function_type_prefix = NULL;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   466
      symbol_c* function_name = NULL;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   467
      symbol_c* function_type_suffix = NULL;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   468
      DECLARE_PARAM_LIST()
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   469
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   470
      function_call_param_iterator_c function_call_param_iterator(symbol);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   471
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   472
      function_declaration_c *f_decl = function_symtable.find_value(symbol->function_name);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   473
      if (f_decl == function_symtable.end_value()) {
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   474
        function_type_t current_function_type = get_function_type((identifier_c *)symbol->function_name);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   475
        if (current_function_type == function_none) ERROR;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   476
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   477
        function_type_prefix = (symbol_c *)search_expression_type->compute_standard_function_default(NULL, symbol);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   478
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   479
        int nb_param = 0;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   480
        if (symbol->il_param_list != NULL)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   481
          nb_param += ((list_c *)symbol->il_param_list)->n;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   482
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   483
        symbol_c *en_param_name = (symbol_c *)(new identifier_c("EN"));
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   484
        /* Get the value from EN param */
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   485
        symbol_c *EN_param_value = function_call_param_iterator.search_f(en_param_name);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   486
        if (EN_param_value == NULL)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   487
          EN_param_value = (symbol_c*)(new boolean_literal_c((symbol_c*)(new bool_type_name_c()), new boolean_true_c()));
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   488
        else
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   489
          nb_param --;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   490
        ADD_PARAM_LIST(en_param_name, EN_param_value, (symbol_c*)(new bool_type_name_c()), function_param_iterator_c::direction_in)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   491
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   492
        symbol_c *eno_param_name = (symbol_c *)(new identifier_c("ENO"));
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   493
        /* Get the value from ENO param */
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   494
        symbol_c *ENO_param_value = function_call_param_iterator.search_f(eno_param_name);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   495
        if (ENO_param_value != NULL)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   496
          nb_param --;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   497
        ADD_PARAM_LIST(eno_param_name, ENO_param_value, (symbol_c*)(new bool_type_name_c()), function_param_iterator_c::direction_out)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   498
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   499
        #include "st_code_gen.c"
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   500
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   501
      }
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   502
      else {
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   503
        function_name = symbol->function_name;
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   504
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   505
		/* determine the base data type returned by the function being called... */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   506
		search_base_type_c search_base_type;
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   507
		function_type_prefix = (symbol_c *)f_decl->type_name->accept(search_base_type);
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   508
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   509
		/* loop through each function parameter, find the value we should pass
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   510
		 * to it, and then output the c equivalent...
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   511
		 */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   512
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   513
		function_param_iterator_c fp_iterator(f_decl);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   514
		identifier_c *param_name;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   515
		for(int i = 1; (param_name = fp_iterator.next()) != NULL; i++) {
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   516
		  symbol_c *param_type = fp_iterator.param_type();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   517
		  if (param_type == NULL) ERROR;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   518
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   519
		  function_param_iterator_c::param_direction_t param_direction = fp_iterator.param_direction();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   520
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   521
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   522
		  symbol_c *param_value = NULL;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   523
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   524
		  /* Get the value from a foo(<param_name> = <param_value>) style call */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   525
		  if (param_value == NULL)
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   526
			param_value = function_call_param_iterator.search_f(param_name);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   527
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   528
		  /* Get the value from a foo(<param_value>) style call */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   529
		  /* NOTE: the following line of code is not required in this case, but it doesn't
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   530
		   * harm to leave it in, as in the case of a formal syntax function call,
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   531
		   * it will always return NULL.
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   532
		   * We leave it in in case we later decide to merge this part of the code together
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   533
		   * with the function calling code in generate_c_st_c, which does require
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   534
		   * the following line...
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   535
		   */
233
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   536
		  if (param_value == NULL) {
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   537
            param_value = function_call_param_iterator.next_nf();
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   538
            if (param_value != NULL && fp_iterator.is_en_eno_param_implicit()) ERROR;
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   539
          }
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   540
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   541
		  if (param_value == NULL) {
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   542
			/* No value given for parameter, so we must use the default... */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   543
			/* First check whether default value specified in function declaration...*/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   544
			param_value = fp_iterator.default_value();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   545
		  }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   546
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   547
		  ADD_PARAM_LIST(param_name, param_value, param_type, fp_iterator.param_direction())
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   548
		}
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   549
      }
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   550
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   551
      if (function_call_param_iterator.next_nf() != NULL) ERROR;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   552
      if (NULL == function_type_prefix) ERROR;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   553
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   554
      bool has_output_params = false;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   555
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   556
      PARAM_LIST_ITERATOR() {
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   557
        if ((PARAM_DIRECTION == function_param_iterator_c::direction_out ||
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   558
             PARAM_DIRECTION == function_param_iterator_c::direction_inout) &&
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   559
             PARAM_VALUE != NULL) {
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   560
          has_output_params = true;
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   561
        }
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   562
      }
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   563
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   564
      if (has_output_params)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   565
        generate_inline(function_name, function_type_prefix, function_type_suffix, param_list);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   566
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   567
      CLEAR_PARAM_LIST()
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   568
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   569
      return NULL;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   570
    }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   571
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   572
    /***************************************/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   573
    /* B.3 - Language ST (Structured Text) */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   574
    /***************************************/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   575
    /***********************/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   576
    /* B 3.1 - Expressions */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   577
    /***********************/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   578
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   579
    void *visit(function_invocation_c *symbol) {
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   580
      symbol_c* function_type_prefix = NULL;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   581
      symbol_c* function_name = NULL;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   582
      symbol_c* function_type_suffix = NULL;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   583
      DECLARE_PARAM_LIST()
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   584
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   585
      symbol_c *parameter_assignment_list = NULL;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   586
      if (NULL != symbol->   formal_param_list) parameter_assignment_list = symbol->   formal_param_list;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   587
      if (NULL != symbol->nonformal_param_list) parameter_assignment_list = symbol->nonformal_param_list;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   588
      if (NULL == parameter_assignment_list) ERROR;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   589
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   590
      function_call_param_iterator_c function_call_param_iterator(symbol);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   591
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   592
      function_declaration_c *f_decl = function_symtable.find_value(symbol->function_name);
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   593
      if (f_decl == function_symtable.end_value()) {
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   594
        /* The function called is not in the symtable, so we test if it is a
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   595
         * standard function defined in standard */
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   596
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   597
        function_type_t current_function_type = get_function_type((identifier_c *)symbol->function_name);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   598
        if (current_function_type == function_none) ERROR;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   599
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   600
        function_type_prefix = search_expression_type->get_type(symbol);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   601
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   602
        int nb_param = ((list_c *)parameter_assignment_list)->n;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   603
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   604
        symbol_c *en_param_name = (symbol_c *)(new identifier_c("EN"));
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   605
        /* Get the value from EN param */
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   606
        symbol_c *EN_param_value = function_call_param_iterator.search_f(en_param_name);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   607
        if (EN_param_value == NULL)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   608
          EN_param_value = (symbol_c*)(new boolean_literal_c((symbol_c*)(new bool_type_name_c()), new boolean_true_c()));
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   609
        else
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   610
          nb_param --;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   611
        ADD_PARAM_LIST(en_param_name, EN_param_value, (symbol_c*)(new bool_type_name_c()), function_param_iterator_c::direction_in)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   612
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   613
        symbol_c *eno_param_name = (symbol_c *)(new identifier_c("ENO"));
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   614
        /* Get the value from ENO param */
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   615
        symbol_c *ENO_param_value = function_call_param_iterator.search_f(eno_param_name);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   616
        if (ENO_param_value != NULL)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   617
          nb_param --;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   618
        ADD_PARAM_LIST(eno_param_name, ENO_param_value, (symbol_c*)(new bool_type_name_c()), function_param_iterator_c::direction_out)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   619
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   620
        #include "st_code_gen.c"
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   621
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   622
      }
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   623
      else {
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   624
        function_name = symbol->function_name;
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   625
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   626
	    /* determine the base data type returned by the function being called... */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   627
		search_base_type_c search_base_type;
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   628
		function_type_prefix = (symbol_c *)f_decl->type_name->accept(search_base_type);
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   629
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   630
    	/* loop through each function parameter, find the value we should pass
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   631
         * to it, and then output the c equivalent...
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   632
         */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   633
        function_param_iterator_c fp_iterator(f_decl);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   634
        identifier_c *param_name;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   635
        for(int i = 1; (param_name = fp_iterator.next()) != NULL; i++) {
233
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   636
          symbol_c *param_type = fp_iterator.param_type();
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   637
          if (param_type == NULL) ERROR;
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   638
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   639
          function_param_iterator_c::param_direction_t param_direction = fp_iterator.param_direction();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   640
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   641
          /* Get the value from a foo(<param_name> = <param_value>) style call */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   642
          symbol_c *param_value = function_call_param_iterator.search_f(param_name);
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   643
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   644
          /* Get the value from a foo(<param_value>) style call */
233
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   645
          if (param_value == NULL) {
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   646
            param_value = function_call_param_iterator.next_nf();
233
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   647
            if (param_value != NULL && fp_iterator.is_en_eno_param_implicit()) ERROR;
3d23a68183d3 Bug on standard functions called with literals fixed
laurent
parents: 231
diff changeset
   648
          }
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   649
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   650
          if (param_value == NULL && param_direction == function_param_iterator_c::direction_in) {
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   651
            /* No value given for parameter, so we must use the default... */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   652
            /* First check whether default value specified in function declaration...*/
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   653
            param_value = fp_iterator.default_value();
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   654
          }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   655
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   656
          ADD_PARAM_LIST(param_name, param_value, param_type, param_direction)
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   657
        } /* for(...) */
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   658
        // symbol->parameter_assignment->accept(*this);
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   659
      }
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   660
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   661
      if (function_call_param_iterator.next_nf() != NULL) ERROR;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   662
      if (NULL == function_type_prefix) ERROR;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   663
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   664
	  bool has_output_params = false;
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   665
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   666
	  PARAM_LIST_ITERATOR() {
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   667
        if ((PARAM_DIRECTION == function_param_iterator_c::direction_out ||
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   668
             PARAM_DIRECTION == function_param_iterator_c::direction_inout) &&
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   669
             PARAM_VALUE != NULL) {
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   670
          has_output_params = true;
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   671
        }
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   672
      }
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   673
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   674
      if (has_output_params)
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   675
        generate_inline(function_name, function_type_prefix, function_type_suffix, param_list);
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   676
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   677
      CLEAR_PARAM_LIST()
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 234
diff changeset
   678
219
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   679
	  return NULL;
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   680
    }
9bb38736f126 Adding support for declare, init, get and set macros
laurent
parents:
diff changeset
   681
234
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
   682
};  /* generate_c_inlinefcall_c */
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
   683
e4d31cd0e6d8 Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents: 233
diff changeset
   684