169 symbol_c* fb_symbol = NULL, |
170 symbol_c* fb_symbol = NULL, |
170 symbol_c* fb_value = NULL) { |
171 symbol_c* fb_value = NULL) { |
171 |
172 |
172 unsigned int vartype = search_varfb_instance_type->get_vartype(symbol); |
173 unsigned int vartype = search_varfb_instance_type->get_vartype(symbol); |
173 bool type_is_complex = search_varfb_instance_type->type_is_complex(); |
174 bool type_is_complex = search_varfb_instance_type->type_is_complex(); |
174 if (vartype == search_var_instance_decl_c::external_vt) { |
175 if (vartype == search_var_instance_decl_c::external_vt) |
175 symbolic_variable_c *variable = dynamic_cast<symbolic_variable_c *>(symbol); |
176 s4o.print(SET_EXTERNAL); |
176 /* TODO Find a solution for forcing global complex variables */ |
177 else if (vartype == search_var_instance_decl_c::located_vt) |
177 if (variable != NULL) { |
178 s4o.print(SET_LOCATED); |
178 s4o.print(SET_EXTERNAL); |
179 else |
179 s4o.print("("); |
180 s4o.print(SET_VAR); |
180 variable->var_name->accept(*this); |
181 s4o.print("("); |
181 s4o.print(","); |
|
182 } |
|
183 else { |
|
184 s4o.print(SET_COMPLEX_EXTERNAL); |
|
185 s4o.print("("); |
|
186 } |
|
187 } |
|
188 else { |
|
189 if (vartype == search_var_instance_decl_c::located_vt) |
|
190 s4o.print(SET_LOCATED); |
|
191 else |
|
192 s4o.print(SET_VAR); |
|
193 s4o.print("("); |
|
194 } |
|
195 |
182 |
196 if (fb_symbol != NULL) { |
183 if (fb_symbol != NULL) { |
197 print_variable_prefix(); |
184 print_variable_prefix(); |
198 fb_symbol->accept(*this); |
185 fb_symbol->accept(*this); |
199 s4o.print("."); |
186 s4o.print(".,"); |
200 } |
187 } |
201 else if (type_is_complex) |
188 else if (type_is_complex) |
202 wanted_variablegeneration = complextype_base_vg; |
189 wanted_variablegeneration = complextype_base_assignment_vg; |
203 else |
190 else |
204 wanted_variablegeneration = assignment_vg; |
191 wanted_variablegeneration = assignment_vg; |
205 |
192 |
206 symbol->accept(*this); |
193 symbol->accept(*this); |
207 s4o.print(","); |
194 s4o.print(","); |
247 /* B 1.4 - Variables */ |
234 /* B 1.4 - Variables */ |
248 /*********************/ |
235 /*********************/ |
249 void *visit(symbolic_variable_c *symbol) { |
236 void *visit(symbolic_variable_c *symbol) { |
250 unsigned int vartype; |
237 unsigned int vartype; |
251 switch (wanted_variablegeneration) { |
238 switch (wanted_variablegeneration) { |
|
239 case complextype_base_assignment_vg: |
|
240 case assignment_vg: |
|
241 this->print_variable_prefix(); |
|
242 s4o.print(","); |
|
243 symbol->var_name->accept(*this); |
|
244 break; |
252 case complextype_base_vg: |
245 case complextype_base_vg: |
253 case assignment_vg: |
|
254 generate_c_base_c::visit(symbol); |
246 generate_c_base_c::visit(symbol); |
255 break; |
247 break; |
256 case complextype_suffix_vg: |
248 case complextype_suffix_vg: |
257 break; |
249 break; |
258 default: |
250 default: |
315 // SYM_REF2(structured_variable_c, record_variable, field_selector) |
307 // SYM_REF2(structured_variable_c, record_variable, field_selector) |
316 void *visit(structured_variable_c *symbol) { |
308 void *visit(structured_variable_c *symbol) { |
317 TRACE("structured_variable_c"); |
309 TRACE("structured_variable_c"); |
318 switch (wanted_variablegeneration) { |
310 switch (wanted_variablegeneration) { |
319 case complextype_base_vg: |
311 case complextype_base_vg: |
|
312 case complextype_base_assignment_vg: |
320 symbol->record_variable->accept(*this); |
313 symbol->record_variable->accept(*this); |
321 break; |
314 break; |
322 case complextype_suffix_vg: |
315 case complextype_suffix_vg: |
323 case assignment_vg: |
316 case assignment_vg: |
324 symbol->record_variable->accept(*this); |
317 symbol->record_variable->accept(*this); |
341 /* subscripted_variable '[' subscript_list ']' */ |
334 /* subscripted_variable '[' subscript_list ']' */ |
342 //SYM_REF2(array_variable_c, subscripted_variable, subscript_list) |
335 //SYM_REF2(array_variable_c, subscripted_variable, subscript_list) |
343 void *visit(array_variable_c *symbol) { |
336 void *visit(array_variable_c *symbol) { |
344 switch (wanted_variablegeneration) { |
337 switch (wanted_variablegeneration) { |
345 case complextype_base_vg: |
338 case complextype_base_vg: |
|
339 case complextype_base_assignment_vg: |
346 symbol->subscripted_variable->accept(*this); |
340 symbol->subscripted_variable->accept(*this); |
347 break; |
341 break; |
348 case complextype_suffix_vg: |
342 case complextype_suffix_vg: |
349 symbol->subscripted_variable->accept(*this); |
343 symbol->subscripted_variable->accept(*this); |
350 |
344 |