168 symbol_c* value, |
168 symbol_c* value, |
169 symbol_c* fb_symbol = NULL, |
169 symbol_c* fb_symbol = NULL, |
170 symbol_c* fb_value = NULL) { |
170 symbol_c* fb_value = NULL) { |
171 |
171 |
172 unsigned int vartype = search_varfb_instance_type->get_vartype(symbol); |
172 unsigned int vartype = search_varfb_instance_type->get_vartype(symbol); |
|
173 bool type_is_complex = search_varfb_instance_type->type_is_complex(); |
173 if (vartype == search_var_instance_decl_c::external_vt) { |
174 if (vartype == search_var_instance_decl_c::external_vt) { |
174 symbolic_variable_c *variable = dynamic_cast<symbolic_variable_c *>(symbol); |
175 symbolic_variable_c *variable = dynamic_cast<symbolic_variable_c *>(symbol); |
175 /* TODO Find a solution for forcing global complex variables */ |
176 /* TODO Find a solution for forcing global complex variables */ |
176 if (variable != NULL) { |
177 if (variable != NULL) { |
177 s4o.print(SET_EXTERNAL); |
178 s4o.print(SET_EXTERNAL); |
195 if (fb_symbol != NULL) { |
196 if (fb_symbol != NULL) { |
196 print_variable_prefix(); |
197 print_variable_prefix(); |
197 fb_symbol->accept(*this); |
198 fb_symbol->accept(*this); |
198 s4o.print("."); |
199 s4o.print("."); |
199 } |
200 } |
|
201 else if (type_is_complex) |
|
202 wanted_variablegeneration = complextype_base_vg; |
200 else |
203 else |
201 wanted_variablegeneration = complextype_base_vg; |
204 wanted_variablegeneration = assignment_vg; |
202 |
205 |
203 symbol->accept(*this); |
206 symbol->accept(*this); |
204 s4o.print(","); |
207 s4o.print(","); |
205 wanted_variablegeneration = expression_vg; |
208 wanted_variablegeneration = expression_vg; |
206 print_check_function(type, value, fb_value); |
209 print_check_function(type, value, fb_value); |
207 /* We need to call search_varfb_instance_type->get_vartype() again, as it may have been called |
210 if (type_is_complex) { |
208 * again since we called it in the beginning of this print_setter() function. |
|
209 * This make sure the call to search_varfb_instance_type->type_is_complex() will return |
|
210 * the correct value regarding our 'symbol'. |
|
211 */ |
|
212 search_varfb_instance_type->get_vartype(symbol); |
|
213 if (search_varfb_instance_type->type_is_complex()) { |
|
214 s4o.print(","); |
211 s4o.print(","); |
215 wanted_variablegeneration = complextype_suffix_vg; |
212 wanted_variablegeneration = complextype_suffix_vg; |
216 symbol->accept(*this); |
213 symbol->accept(*this); |
217 } |
214 } |
218 s4o.print(")"); |
215 s4o.print(")"); |
249 /*********************/ |
246 /*********************/ |
250 /* B 1.4 - Variables */ |
247 /* B 1.4 - Variables */ |
251 /*********************/ |
248 /*********************/ |
252 void *visit(symbolic_variable_c *symbol) { |
249 void *visit(symbolic_variable_c *symbol) { |
253 unsigned int vartype; |
250 unsigned int vartype; |
254 if (wanted_variablegeneration == complextype_base_vg) |
251 switch (wanted_variablegeneration) { |
255 generate_c_base_c::visit(symbol); |
252 case complextype_base_vg: |
256 else if (wanted_variablegeneration == complextype_suffix_vg) |
253 case assignment_vg: |
257 return NULL; |
254 generate_c_base_c::visit(symbol); |
258 else if (this->is_variable_prefix_null()) { |
255 break; |
259 vartype = search_varfb_instance_type->get_vartype(symbol); |
256 case complextype_suffix_vg: |
260 if (wanted_variablegeneration == fparam_output_vg) { |
257 break; |
261 s4o.print("&("); |
258 default: |
262 generate_c_base_c::visit(symbol); |
259 if (this->is_variable_prefix_null()) { |
263 s4o.print(")"); |
260 vartype = search_varfb_instance_type->get_vartype(symbol); |
264 } |
261 if (wanted_variablegeneration == fparam_output_vg) { |
265 else { |
262 s4o.print("&("); |
266 generate_c_base_c::visit(symbol); |
263 generate_c_base_c::visit(symbol); |
267 } |
264 s4o.print(")"); |
268 } |
265 } |
269 else |
266 else { |
270 print_getter(symbol); |
267 generate_c_base_c::visit(symbol); |
|
268 } |
|
269 } |
|
270 else |
|
271 print_getter(symbol); |
|
272 break; |
|
273 } |
271 return NULL; |
274 return NULL; |
272 } |
275 } |
273 |
276 |
274 /********************************************/ |
277 /********************************************/ |
275 /* B.1.4.1 Directly Represented Variables */ |
278 /* B.1.4.1 Directly Represented Variables */ |
315 switch (wanted_variablegeneration) { |
318 switch (wanted_variablegeneration) { |
316 case complextype_base_vg: |
319 case complextype_base_vg: |
317 symbol->record_variable->accept(*this); |
320 symbol->record_variable->accept(*this); |
318 break; |
321 break; |
319 case complextype_suffix_vg: |
322 case complextype_suffix_vg: |
|
323 case assignment_vg: |
320 symbol->record_variable->accept(*this); |
324 symbol->record_variable->accept(*this); |
321 s4o.print("."); |
325 s4o.print("."); |
322 symbol->field_selector->accept(*this); |
326 symbol->field_selector->accept(*this); |
323 break; |
327 break; |
324 default: |
328 default: |