author | laurent |
Sun, 13 Dec 2009 11:41:22 +0100 | |
changeset 234 | e4d31cd0e6d8 |
parent 233 | 3d23a68183d3 |
child 235 | ed66dc50f31a |
permissions | -rwxr-xr-x |
219 | 1 |
/* |
2 |
* (c) 2007 Mario de Sousa and Laurent Bessard |
|
3 |
* |
|
4 |
* Offered to the public under the terms of the GNU General Public License |
|
5 |
* as published by the Free Software Foundation; either version 2 of the |
|
6 |
* License, or (at your option) any later version. |
|
7 |
* |
|
8 |
* This program is distributed in the hope that it will be useful, but |
|
9 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
|
11 |
* Public License for more details. |
|
12 |
* |
|
13 |
* This code is made available on the understanding that it will not be |
|
14 |
* used in safety-critical situations without a full and competent review. |
|
15 |
*/ |
|
16 |
||
17 |
/* |
|
18 |
* An IEC 61131-3 IL and ST compiler. |
|
19 |
* |
|
20 |
* Based on the |
|
21 |
* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
25 |
/* |
|
26 |
* This is one of the versions available for the 4th stage. |
|
27 |
* |
|
28 |
* This 4th stage generates a c++ source program equivalent |
|
29 |
* to the IL and ST code. |
|
30 |
*/ |
|
31 |
||
32 |
||
33 |
#define INLINE_RESULT_TEMP_VAR "__res" |
|
34 |
||
234
e4d31cd0e6d8
Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents:
233
diff
changeset
|
35 |
class generate_c_inlinefcall_c: public generate_c_typedecl_c { |
219 | 36 |
|
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
|
37 |
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
|
38 |
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
|
39 |
expression_vg, |
228
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
40 |
assignment_vg, |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
41 |
complextype_base_vg, |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
42 |
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
|
43 |
} 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
|
44 |
|
219 | 45 |
private: |
46 |
||
47 |
/* The name of the IL default variable... */ |
|
48 |
#define IL_DEFVAR VAR_LEADER "IL_DEFVAR" |
|
49 |
/* The name of the variable used to pass the result of a |
|
50 |
* parenthesised instruction list to the immediately preceding |
|
51 |
* scope ... |
|
52 |
*/ |
|
53 |
il_default_variable_c default_variable_name; |
|
54 |
||
228
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
55 |
symbol_c* current_array_type; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
56 |
|
219 | 57 |
int fcall_number; |
58 |
symbol_c *fbname; |
|
59 |
||
60 |
search_expression_type_c *search_expression_type; |
|
61 |
||
62 |
search_varfb_instance_type_c *search_varfb_instance_type; |
|
63 |
||
64 |
search_base_type_c search_base_type; |
|
65 |
||
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
|
66 |
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
|
67 |
|
219 | 68 |
public: |
234
e4d31cd0e6d8
Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents:
233
diff
changeset
|
69 |
generate_c_inlinefcall_c(stage4out_c *s4o_ptr, symbol_c *name, symbol_c *scope, const char *variable_prefix = NULL) |
219 | 70 |
: generate_c_typedecl_c(s4o_ptr), |
71 |
default_variable_name(IL_DEFVAR, NULL) |
|
72 |
{ |
|
73 |
search_expression_type = new search_expression_type_c(scope); |
|
74 |
search_varfb_instance_type = new search_varfb_instance_type_c(scope); |
|
75 |
this->set_variable_prefix(variable_prefix); |
|
76 |
fcall_number = 0; |
|
77 |
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
|
78 |
wanted_variablegeneration = expression_vg; |
219 | 79 |
} |
80 |
||
234
e4d31cd0e6d8
Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents:
233
diff
changeset
|
81 |
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
|
82 |
delete search_expression_type; |
219 | 83 |
delete search_varfb_instance_type; |
84 |
} |
|
85 |
||
234
e4d31cd0e6d8
Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents:
233
diff
changeset
|
86 |
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
|
87 |
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
|
88 |
symbol_c* function_call; |
e4d31cd0e6d8
Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents:
233
diff
changeset
|
89 |
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
|
90 |
function_call->accept(*this); |
e4d31cd0e6d8
Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents:
233
diff
changeset
|
91 |
} |
e4d31cd0e6d8
Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents:
233
diff
changeset
|
92 |
} |
e4d31cd0e6d8
Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents:
233
diff
changeset
|
93 |
|
e4d31cd0e6d8
Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents:
233
diff
changeset
|
94 |
void generate_inline(symbol_c *function_name, |
e4d31cd0e6d8
Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents:
233
diff
changeset
|
95 |
symbol_c *return_data_type, |
e4d31cd0e6d8
Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents:
233
diff
changeset
|
96 |
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
|
97 |
std::list<FUNCTION_PARAM*>::iterator pt; |
219 | 98 |
|
99 |
fcall_number++; |
|
100 |
||
101 |
s4o.print(s4o.indent_spaces); |
|
102 |
s4o.print("inline "); |
|
103 |
return_data_type->accept(*this); |
|
104 |
s4o.print(" __"); |
|
105 |
fbname->accept(*this); |
|
106 |
s4o.print("_"); |
|
107 |
function_name->accept(*this); |
|
108 |
s4o.print_integer(fcall_number); |
|
109 |
s4o.print("("); |
|
110 |
s4o.indent_right(); |
|
111 |
||
112 |
PARAM_LIST_ITERATOR() { |
|
113 |
if (PARAM_DIRECTION == function_param_iterator_c::direction_in) { |
|
114 |
PARAM_TYPE->accept(*this); |
|
115 |
s4o.print(" "); |
|
116 |
PARAM_NAME->accept(*this); |
|
117 |
s4o.print(",\n" + s4o.indent_spaces); |
|
118 |
} |
|
119 |
} |
|
120 |
fbname->accept(*this); |
|
121 |
s4o.print(" *"); |
|
122 |
s4o.print(FB_FUNCTION_PARAM); |
|
123 |
s4o.indent_left(); |
|
124 |
s4o.print(")\n" + s4o.indent_spaces); |
|
125 |
s4o.print("{\n"); |
|
126 |
s4o.indent_right(); |
|
127 |
||
128 |
s4o.print(s4o.indent_spaces); |
|
129 |
return_data_type->accept(*this); |
|
130 |
s4o.print(" "), |
|
131 |
s4o.print(INLINE_RESULT_TEMP_VAR); |
|
132 |
s4o.print(";\n"); |
|
133 |
||
134 |
PARAM_LIST_ITERATOR() { |
|
135 |
if ((PARAM_DIRECTION == function_param_iterator_c::direction_out || |
|
136 |
PARAM_DIRECTION == function_param_iterator_c::direction_inout) && |
|
137 |
PARAM_VALUE != NULL) { |
|
138 |
s4o.print(s4o.indent_spaces); |
|
139 |
PARAM_TYPE->accept(*this); |
|
140 |
s4o.print(" "); |
|
141 |
s4o.print(TEMP_VAR); |
|
142 |
PARAM_NAME->accept(*this); |
|
143 |
s4o.print(" = "); |
|
144 |
print_check_function(PARAM_TYPE, PARAM_VALUE); |
|
145 |
s4o.print(";\n"); |
|
146 |
} |
|
147 |
} |
|
148 |
||
149 |
s4o.print(s4o.indent_spaces + INLINE_RESULT_TEMP_VAR), |
|
150 |
s4o.print(" = "); |
|
151 |
function_name->accept(*this); |
|
152 |
s4o.print("("); |
|
153 |
s4o.indent_right(); |
|
154 |
||
155 |
PARAM_LIST_ITERATOR() { |
|
156 |
if (pt != param_list.begin()) |
|
157 |
s4o.print(",\n" + s4o.indent_spaces); |
|
158 |
if (PARAM_DIRECTION == function_param_iterator_c::direction_in) |
|
159 |
PARAM_NAME->accept(*this); |
|
160 |
else if (PARAM_VALUE != NULL){ |
|
161 |
s4o.print("&"); |
|
162 |
s4o.print(TEMP_VAR); |
|
163 |
PARAM_NAME->accept(*this); |
|
164 |
} |
|
165 |
else { |
|
166 |
s4o.print("NULL"); |
|
167 |
} |
|
168 |
} |
|
169 |
s4o.print(");\n"); |
|
170 |
s4o.indent_left(); |
|
171 |
||
172 |
PARAM_LIST_ITERATOR() { |
|
173 |
if ((PARAM_DIRECTION == function_param_iterator_c::direction_out || |
|
174 |
PARAM_DIRECTION == function_param_iterator_c::direction_inout) && |
|
175 |
PARAM_VALUE != NULL) { |
|
176 |
||
177 |
s4o.print(s4o.indent_spaces); |
|
228
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
178 |
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
|
179 |
s4o.print(";\n"); |
219 | 180 |
} |
181 |
} |
|
182 |
s4o.print(s4o.indent_spaces + "return "); |
|
183 |
s4o.print(INLINE_RESULT_TEMP_VAR); |
|
184 |
s4o.print(";\n"); |
|
185 |
||
186 |
s4o.indent_left(); |
|
187 |
s4o.print(s4o.indent_spaces + "}\n\n"); |
|
188 |
} |
|
189 |
||
190 |
private: |
|
191 |
||
228
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
192 |
void *print_getter(symbol_c *symbol) { |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
193 |
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
|
194 |
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
|
195 |
s4o.print(GET_EXTERNAL); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
196 |
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
|
197 |
s4o.print(GET_LOCATED); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
198 |
else |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
199 |
s4o.print(GET_VAR); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
200 |
s4o.print("("); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
201 |
|
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
202 |
wanted_variablegeneration = complextype_base_vg; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
203 |
symbol->accept(*this); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
204 |
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
|
205 |
s4o.print(","); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
206 |
wanted_variablegeneration = complextype_suffix_vg; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
207 |
symbol->accept(*this); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
208 |
s4o.print(")"); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
209 |
wanted_variablegeneration = expression_vg; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
210 |
return NULL; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
211 |
} |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
212 |
|
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
213 |
void *print_setter(symbol_c* symbol, |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
214 |
symbol_c* type, |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
215 |
symbol_c* value) { |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
216 |
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
|
217 |
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
|
218 |
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
|
219 |
/* 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
|
220 |
if (variable != NULL) { |
b8527b0abe75
Adding support for forcing global without perturbation from setting external
laurent
parents:
228
diff
changeset
|
221 |
s4o.print(SET_EXTERNAL); |
b8527b0abe75
Adding support for forcing global without perturbation from setting external
laurent
parents:
228
diff
changeset
|
222 |
s4o.print("("); |
b8527b0abe75
Adding support for forcing global without perturbation from setting external
laurent
parents:
228
diff
changeset
|
223 |
variable->var_name->accept(*this); |
b8527b0abe75
Adding support for forcing global without perturbation from setting external
laurent
parents:
228
diff
changeset
|
224 |
s4o.print(","); |
b8527b0abe75
Adding support for forcing global without perturbation from setting external
laurent
parents:
228
diff
changeset
|
225 |
} |
b8527b0abe75
Adding support for forcing global without perturbation from setting external
laurent
parents:
228
diff
changeset
|
226 |
else { |
b8527b0abe75
Adding support for forcing global without perturbation from setting external
laurent
parents:
228
diff
changeset
|
227 |
s4o.print(SET_COMPLEX_EXTERNAL); |
b8527b0abe75
Adding support for forcing global without perturbation from setting external
laurent
parents:
228
diff
changeset
|
228 |
s4o.print("("); |
b8527b0abe75
Adding support for forcing global without perturbation from setting external
laurent
parents:
228
diff
changeset
|
229 |
} |
b8527b0abe75
Adding support for forcing global without perturbation from setting external
laurent
parents:
228
diff
changeset
|
230 |
} |
b8527b0abe75
Adding support for forcing global without perturbation from setting external
laurent
parents:
228
diff
changeset
|
231 |
else { |
b8527b0abe75
Adding support for forcing global without perturbation from setting external
laurent
parents:
228
diff
changeset
|
232 |
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
|
233 |
s4o.print(SET_LOCATED); |
b8527b0abe75
Adding support for forcing global without perturbation from setting external
laurent
parents:
228
diff
changeset
|
234 |
else |
b8527b0abe75
Adding support for forcing global without perturbation from setting external
laurent
parents:
228
diff
changeset
|
235 |
s4o.print(SET_VAR); |
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 |
} |
228
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
238 |
|
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
239 |
wanted_variablegeneration = complextype_base_vg; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
240 |
symbol->accept(*this); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
241 |
s4o.print(","); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
242 |
wanted_variablegeneration = expression_vg; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
243 |
print_check_function(type, value, NULL, true); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
244 |
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
|
245 |
s4o.print(","); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
246 |
wanted_variablegeneration = complextype_suffix_vg; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
247 |
symbol->accept(*this); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
248 |
} |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
249 |
s4o.print(")"); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
250 |
wanted_variablegeneration = expression_vg; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
251 |
return NULL; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
252 |
} |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
253 |
|
219 | 254 |
/*********************/ |
255 |
/* B 1.4 - Variables */ |
|
256 |
/*********************/ |
|
257 |
void *visit(symbolic_variable_c *symbol) { |
|
228
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
258 |
unsigned int vartype; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
259 |
if (wanted_variablegeneration == complextype_base_vg) |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
260 |
generate_c_base_c::visit(symbol); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
261 |
else if (wanted_variablegeneration == complextype_suffix_vg) |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
262 |
return NULL; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
263 |
else if (wanted_variablegeneration == expression_vg) { |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
264 |
vartype = search_varfb_instance_type->get_vartype(symbol); |
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
|
265 |
if (vartype == search_var_instance_decl_c::external_vt) { |
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
|
266 |
s4o.print(GET_EXTERNAL); |
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
|
267 |
s4o.print("("); |
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
|
268 |
symbol->var_name->accept(*this); |
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
|
269 |
} |
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
|
270 |
else { |
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
|
271 |
if (vartype == search_var_instance_decl_c::located_vt) |
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
|
272 |
s4o.print(GET_LOCATED); |
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
|
273 |
else |
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
|
274 |
s4o.print(GET_VAR); |
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 |
s4o.print("("); |
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
|
276 |
generate_c_base_c::visit(symbol); |
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
|
277 |
} |
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
|
278 |
s4o.print(")"); |
219 | 279 |
} |
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
|
280 |
else |
219 | 281 |
generate_c_base_c::visit(symbol); |
282 |
return NULL; |
|
283 |
} |
|
284 |
||
285 |
/********************************************/ |
|
286 |
/* B.1.4.1 Directly Represented Variables */ |
|
287 |
/********************************************/ |
|
288 |
// direct_variable: direct_variable_token {$$ = new direct_variable_c($1);}; |
|
289 |
void *visit(direct_variable_c *symbol) { |
|
290 |
TRACE("direct_variable_c"); |
|
291 |
/* Do not use print_token() as it will change everything into uppercase */ |
|
292 |
if (strlen(symbol->value) == 0) ERROR; |
|
293 |
s4o.print(GET_LOCATED); |
|
294 |
s4o.print("("); |
|
295 |
this->print_variable_prefix(); |
|
296 |
s4o.printlocation(symbol->value + 1); |
|
297 |
s4o.print(")"); |
|
298 |
return NULL; |
|
299 |
} |
|
300 |
||
228
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
301 |
/*************************************/ |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
302 |
/* B.1.4.2 Multi-element Variables */ |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
303 |
/*************************************/ |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
304 |
|
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
305 |
// 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
|
306 |
void *visit(structured_variable_c *symbol) { |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
307 |
TRACE("structured_variable_c"); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
308 |
switch (wanted_variablegeneration) { |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
309 |
case complextype_base_vg: |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
310 |
symbol->record_variable->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 |
case complextype_suffix_vg: |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
313 |
symbol->record_variable->accept(*this); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
314 |
s4o.print("."); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
315 |
symbol->field_selector->accept(*this); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
316 |
break; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
317 |
default: |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
318 |
if (this->is_variable_prefix_null()) { |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
319 |
symbol->record_variable->accept(*this); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
320 |
s4o.print("."); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
321 |
symbol->field_selector->accept(*this); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
322 |
} |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
323 |
else |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
324 |
print_getter(symbol); |
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 |
} |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
327 |
return NULL; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
328 |
} |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
329 |
|
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
330 |
/* subscripted_variable '[' subscript_list ']' */ |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
331 |
//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
|
332 |
void *visit(array_variable_c *symbol) { |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
333 |
switch (wanted_variablegeneration) { |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
334 |
case complextype_base_vg: |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
335 |
symbol->subscripted_variable->accept(*this); |
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 |
case complextype_suffix_vg: |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
338 |
current_array_type = search_varfb_instance_type->get_rawtype(symbol->subscripted_variable); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
339 |
symbol->subscripted_variable->accept(*this); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
340 |
if (current_array_type != NULL) { |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
341 |
symbol->subscript_list->accept(*this); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
342 |
current_array_type = NULL; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
343 |
} |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
344 |
break; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
345 |
default: |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
346 |
if (this->is_variable_prefix_null()) { |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
347 |
current_array_type = search_varfb_instance_type->get_rawtype(symbol->subscripted_variable); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
348 |
symbol->subscripted_variable->accept(*this); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
349 |
if (current_array_type != NULL) { |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
350 |
symbol->subscript_list->accept(*this); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
351 |
current_array_type = NULL; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
352 |
} |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
353 |
} |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
354 |
else |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
355 |
print_getter(symbol); |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
356 |
break; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
357 |
} |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
358 |
return NULL; |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
359 |
} |
43831b683764
Adding support for setter and getter on complex datatype in IL
berem
parents:
221
diff
changeset
|
360 |
|
219 | 361 |
/****************************************/ |
362 |
/* B.2 - Language IL (Instruction List) */ |
|
363 |
/****************************************/ |
|
364 |
||
365 |
/***********************************/ |
|
366 |
/* B 2.1 Instructions and Operands */ |
|
367 |
/***********************************/ |
|
368 |
||
369 |
void *visit(il_function_call_c *symbol) { |
|
370 |
function_declaration_c *f_decl = function_symtable.find_value(symbol->function_name); |
|
371 |
||
372 |
if (f_decl != function_symtable.end_value()) { |
|
373 |
DECLARE_PARAM_LIST() |
|
374 |
bool has_output_params = false; |
|
375 |
||
376 |
/* determine the base data type returned by the function being called... */ |
|
377 |
search_base_type_c search_base_type; |
|
378 |
symbol_c *return_data_type = (symbol_c *)f_decl->type_name->accept(search_base_type); |
|
379 |
if (NULL == return_data_type) ERROR; |
|
380 |
||
381 |
/* loop through each function parameter, find the value we should pass |
|
382 |
* to it, and then output the c equivalent... |
|
383 |
*/ |
|
384 |
||
385 |
function_param_iterator_c fp_iterator(f_decl); |
|
386 |
identifier_c *param_name; |
|
387 |
function_call_param_iterator_c function_call_param_iterator(symbol); |
|
388 |
for(int i = 1; (param_name = fp_iterator.next()) != NULL; i++) { |
|
389 |
symbol_c *param_type = fp_iterator.param_type(); |
|
390 |
if (param_type == NULL) ERROR; |
|
391 |
||
392 |
function_param_iterator_c::param_direction_t param_direction = fp_iterator.param_direction(); |
|
393 |
||
394 |
symbol_c *param_value = NULL; |
|
395 |
||
396 |
/* if it is the first parameter, semantics specifies that we should |
|
397 |
* get the value off the IL default variable! |
|
398 |
*/ |
|
233
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
399 |
if (1 == i) |
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
400 |
param_value = &this->default_variable_name; |
219 | 401 |
|
402 |
/* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
403 |
/* NOTE: the following line of code is not required in this case, but it doesn't |
|
404 |
* harm to leave it in, as in the case of a non-formal syntax function call, |
|
405 |
* it will always return NULL. |
|
406 |
* We leave it in in case we later decide to merge this part of the code together |
|
407 |
* with the function calling code in generate_c_st_c, which does require |
|
408 |
* the following line... |
|
409 |
*/ |
|
410 |
if (param_value == NULL) |
|
411 |
param_value = function_call_param_iterator.search_f(param_name); |
|
412 |
||
413 |
/* 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
|
414 |
if (param_value == NULL) { |
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
415 |
param_value = function_call_param_iterator.next_nf(); |
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
416 |
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
|
417 |
} |
219 | 418 |
|
419 |
if (param_value == NULL && param_direction == function_param_iterator_c::direction_in) { |
|
420 |
/* No value given for parameter, so we must use the default... */ |
|
421 |
/* First check whether default value specified in function declaration...*/ |
|
422 |
param_value = fp_iterator.default_value(); |
|
423 |
} |
|
424 |
||
425 |
ADD_PARAM_LIST(param_name, param_value, param_type, fp_iterator.param_direction()) |
|
426 |
} /* for(...) */ |
|
427 |
||
233
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
428 |
if (function_call_param_iterator.next_nf() != NULL) ERROR; |
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
429 |
|
219 | 430 |
PARAM_LIST_ITERATOR() { |
431 |
if ((PARAM_DIRECTION == function_param_iterator_c::direction_out || |
|
432 |
PARAM_DIRECTION == function_param_iterator_c::direction_inout) && |
|
433 |
PARAM_VALUE != NULL) { |
|
434 |
has_output_params = true; |
|
435 |
} |
|
436 |
} |
|
437 |
||
438 |
if (has_output_params) |
|
439 |
generate_inline(symbol->function_name, return_data_type, param_list); |
|
440 |
||
441 |
CLEAR_PARAM_LIST() |
|
442 |
} |
|
443 |
return NULL; |
|
444 |
} |
|
445 |
||
446 |
void *visit(il_formal_funct_call_c *symbol) { |
|
447 |
function_declaration_c *f_decl = function_symtable.find_value(symbol->function_name); |
|
448 |
||
449 |
if (f_decl != function_symtable.end_value()) { |
|
450 |
DECLARE_PARAM_LIST() |
|
451 |
bool has_output_params = false; |
|
452 |
||
453 |
/* determine the base data type returned by the function being called... */ |
|
454 |
search_base_type_c search_base_type; |
|
455 |
symbol_c *return_data_type = (symbol_c *)f_decl->type_name->accept(search_base_type); |
|
456 |
if (NULL == return_data_type) ERROR; |
|
457 |
||
458 |
/* loop through each function parameter, find the value we should pass |
|
459 |
* to it, and then output the c equivalent... |
|
460 |
*/ |
|
461 |
||
462 |
function_param_iterator_c fp_iterator(f_decl); |
|
463 |
identifier_c *param_name; |
|
464 |
function_call_param_iterator_c function_call_param_iterator(symbol); |
|
465 |
for(int i = 1; (param_name = fp_iterator.next()) != NULL; i++) { |
|
466 |
symbol_c *param_type = fp_iterator.param_type(); |
|
467 |
if (param_type == NULL) ERROR; |
|
468 |
||
469 |
function_param_iterator_c::param_direction_t param_direction = fp_iterator.param_direction(); |
|
470 |
||
471 |
||
472 |
symbol_c *param_value = NULL; |
|
473 |
||
474 |
/* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
475 |
if (param_value == NULL) |
|
476 |
param_value = function_call_param_iterator.search_f(param_name); |
|
477 |
||
478 |
/* Get the value from a foo(<param_value>) style call */ |
|
479 |
/* NOTE: the following line of code is not required in this case, but it doesn't |
|
480 |
* harm to leave it in, as in the case of a formal syntax function call, |
|
481 |
* it will always return NULL. |
|
482 |
* We leave it in in case we later decide to merge this part of the code together |
|
483 |
* with the function calling code in generate_c_st_c, which does require |
|
484 |
* the following line... |
|
485 |
*/ |
|
233
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
486 |
if (param_value == NULL) { |
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
487 |
param_value = function_call_param_iterator.next_nf(); |
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
488 |
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
|
489 |
} |
219 | 490 |
|
491 |
if (param_value == NULL) { |
|
492 |
/* No value given for parameter, so we must use the default... */ |
|
493 |
/* First check whether default value specified in function declaration...*/ |
|
494 |
param_value = fp_iterator.default_value(); |
|
495 |
} |
|
496 |
||
497 |
ADD_PARAM_LIST(param_name, param_value, param_type, fp_iterator.param_direction()) |
|
498 |
} |
|
499 |
||
233
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
500 |
if (function_call_param_iterator.next_nf() != NULL) ERROR; |
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
501 |
|
219 | 502 |
PARAM_LIST_ITERATOR() { |
503 |
if ((PARAM_DIRECTION == function_param_iterator_c::direction_out || |
|
504 |
PARAM_DIRECTION == function_param_iterator_c::direction_inout) && |
|
505 |
PARAM_VALUE != NULL) { |
|
506 |
has_output_params = true; |
|
507 |
} |
|
508 |
} |
|
509 |
||
510 |
if (has_output_params) |
|
511 |
generate_inline(symbol->function_name, return_data_type, param_list); |
|
512 |
||
513 |
CLEAR_PARAM_LIST() |
|
514 |
} |
|
515 |
return NULL; |
|
516 |
} |
|
517 |
||
518 |
/***************************************/ |
|
519 |
/* B.3 - Language ST (Structured Text) */ |
|
520 |
/***************************************/ |
|
521 |
/***********************/ |
|
522 |
/* B 3.1 - Expressions */ |
|
523 |
/***********************/ |
|
524 |
||
525 |
void *visit(function_invocation_c *symbol) { |
|
526 |
function_declaration_c *f_decl = function_symtable.find_value(symbol->function_name); |
|
527 |
||
528 |
if (f_decl != function_symtable.end_value()) { |
|
529 |
DECLARE_PARAM_LIST() |
|
530 |
bool has_output_params = false; |
|
531 |
||
532 |
symbol_c *parameter_assignment_list = NULL; |
|
533 |
if (NULL != symbol-> formal_param_list) parameter_assignment_list = symbol-> formal_param_list; |
|
534 |
if (NULL != symbol->nonformal_param_list) parameter_assignment_list = symbol->nonformal_param_list; |
|
535 |
if (NULL == parameter_assignment_list) ERROR; |
|
536 |
||
537 |
/* determine the base data type returned by the function being called... */ |
|
538 |
search_base_type_c search_base_type; |
|
539 |
symbol_c *return_data_type = (symbol_c *)f_decl->type_name->accept(search_base_type); |
|
540 |
if (NULL == return_data_type) ERROR; |
|
541 |
||
542 |
/* loop through each function parameter, find the value we should pass |
|
543 |
* to it, and then output the c equivalent... |
|
544 |
*/ |
|
545 |
function_param_iterator_c fp_iterator(f_decl); |
|
546 |
identifier_c *param_name; |
|
547 |
function_call_param_iterator_c function_call_param_iterator(symbol); |
|
548 |
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
|
549 |
symbol_c *param_type = fp_iterator.param_type(); |
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
550 |
if (param_type == NULL) ERROR; |
219 | 551 |
|
552 |
function_param_iterator_c::param_direction_t param_direction = fp_iterator.param_direction(); |
|
553 |
||
554 |
/* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
555 |
symbol_c *param_value = function_call_param_iterator.search_f(param_name); |
|
556 |
||
557 |
/* 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
|
558 |
if (param_value == NULL) { |
219 | 559 |
param_value = function_call_param_iterator.next_nf(); |
233
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
560 |
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
|
561 |
} |
219 | 562 |
|
563 |
if (param_value == NULL && param_direction == function_param_iterator_c::direction_in) { |
|
564 |
/* No value given for parameter, so we must use the default... */ |
|
565 |
/* First check whether default value specified in function declaration...*/ |
|
566 |
param_value = fp_iterator.default_value(); |
|
567 |
} |
|
568 |
||
569 |
ADD_PARAM_LIST(param_name, param_value, param_type, param_direction) |
|
570 |
} /* for(...) */ |
|
571 |
// symbol->parameter_assignment->accept(*this); |
|
572 |
||
233
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
573 |
if (function_call_param_iterator.next_nf() != NULL) ERROR; |
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
231
diff
changeset
|
574 |
|
219 | 575 |
PARAM_LIST_ITERATOR() { |
576 |
if ((PARAM_DIRECTION == function_param_iterator_c::direction_out || |
|
577 |
PARAM_DIRECTION == function_param_iterator_c::direction_inout) && |
|
578 |
PARAM_VALUE != NULL) { |
|
579 |
has_output_params = true; |
|
580 |
} |
|
581 |
} |
|
582 |
||
583 |
if (has_output_params) |
|
584 |
generate_inline(symbol->function_name, return_data_type, param_list); |
|
585 |
||
586 |
CLEAR_PARAM_LIST() |
|
587 |
} |
|
588 |
return NULL; |
|
589 |
} |
|
590 |
||
234
e4d31cd0e6d8
Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents:
233
diff
changeset
|
591 |
}; /* generate_c_inlinefcall_c */ |
e4d31cd0e6d8
Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents:
233
diff
changeset
|
592 |
|
e4d31cd0e6d8
Using function_call_iterator in generate_c_inlinefcall instead of creating a new visitor
laurent
parents:
233
diff
changeset
|
593 |