50 search_expression_type_c *search_expression_type; |
56 search_expression_type_c *search_expression_type; |
51 |
57 |
52 search_varfb_instance_type_c *search_varfb_instance_type; |
58 search_varfb_instance_type_c *search_varfb_instance_type; |
53 |
59 |
54 search_base_type_c search_base_type; |
60 search_base_type_c search_base_type; |
|
61 |
|
62 variablegeneration_t wanted_variablegeneration; |
55 |
63 |
56 public: |
64 public: |
57 generate_c_inline_c(stage4out_c *s4o_ptr, symbol_c *name, symbol_c *scope, const char *variable_prefix = NULL) |
65 generate_c_inline_c(stage4out_c *s4o_ptr, symbol_c *name, symbol_c *scope, const char *variable_prefix = NULL) |
58 : generate_c_typedecl_c(s4o_ptr), |
66 : generate_c_typedecl_c(s4o_ptr), |
59 default_variable_name(IL_DEFVAR, NULL) |
67 default_variable_name(IL_DEFVAR, NULL) |
61 search_expression_type = new search_expression_type_c(scope); |
69 search_expression_type = new search_expression_type_c(scope); |
62 search_varfb_instance_type = new search_varfb_instance_type_c(scope); |
70 search_varfb_instance_type = new search_varfb_instance_type_c(scope); |
63 this->set_variable_prefix(variable_prefix); |
71 this->set_variable_prefix(variable_prefix); |
64 fcall_number = 0; |
72 fcall_number = 0; |
65 fbname = name; |
73 fbname = name; |
|
74 wanted_variablegeneration = expression_vg; |
66 } |
75 } |
67 |
76 |
68 virtual ~generate_c_inline_c(void) { |
77 virtual ~generate_c_inline_c(void) { |
69 delete search_varfb_instance_type; |
78 delete search_varfb_instance_type; |
70 } |
79 } |
160 else if (vartype == search_var_instance_decl_c::located_vt) |
169 else if (vartype == search_var_instance_decl_c::located_vt) |
161 s4o.print(SET_LOCATED); |
170 s4o.print(SET_LOCATED); |
162 else |
171 else |
163 s4o.print(SET_VAR); |
172 s4o.print(SET_VAR); |
164 s4o.print("("); |
173 s4o.print("("); |
165 |
174 wanted_variablegeneration = assignment_vg; |
166 PARAM_VALUE->accept(*this); |
175 PARAM_VALUE->accept(*this); |
|
176 wanted_variablegeneration = expression_vg; |
167 s4o.print(", "); |
177 s4o.print(", "); |
168 print_check_function(PARAM_TYPE, PARAM_NAME, NULL, true); |
178 print_check_function(PARAM_TYPE, PARAM_NAME, NULL, true); |
169 s4o.print(");\n"); |
179 s4o.print(");\n"); |
170 } |
180 } |
171 } |
181 } |
183 |
193 |
184 /*********************/ |
194 /*********************/ |
185 /* B 1.4 - Variables */ |
195 /* B 1.4 - Variables */ |
186 /*********************/ |
196 /*********************/ |
187 void *visit(symbolic_variable_c *symbol) { |
197 void *visit(symbolic_variable_c *symbol) { |
188 unsigned int vartype = search_varfb_instance_type->get_vartype(symbol); |
198 if (wanted_variablegeneration == expression_vg) { |
189 if (vartype == search_var_instance_decl_c::external_vt) { |
199 unsigned int vartype = search_varfb_instance_type->get_vartype(symbol); |
190 s4o.print(GET_EXTERNAL); |
200 if (vartype == search_var_instance_decl_c::external_vt) { |
191 s4o.print("("); |
201 s4o.print(GET_EXTERNAL); |
192 symbol->var_name->accept(*this); |
202 s4o.print("("); |
|
203 symbol->var_name->accept(*this); |
|
204 } |
|
205 else { |
|
206 if (vartype == search_var_instance_decl_c::located_vt) |
|
207 s4o.print(GET_LOCATED); |
|
208 else |
|
209 s4o.print(GET_VAR); |
|
210 s4o.print("("); |
|
211 generate_c_base_c::visit(symbol); |
|
212 } |
|
213 s4o.print(")"); |
193 } |
214 } |
194 else { |
215 else |
195 if (vartype == search_var_instance_decl_c::located_vt) |
|
196 s4o.print(GET_LOCATED); |
|
197 else |
|
198 s4o.print(GET_VAR); |
|
199 s4o.print("("); |
|
200 generate_c_base_c::visit(symbol); |
216 generate_c_base_c::visit(symbol); |
201 } |
|
202 s4o.print(")"); |
|
203 return NULL; |
217 return NULL; |
204 } |
218 } |
205 |
219 |
206 /********************************************/ |
220 /********************************************/ |
207 /* B.1.4.1 Directly Represented Variables */ |
221 /* B.1.4.1 Directly Represented Variables */ |