207 /* NOTE: I don't think this will ever get called, since in the visit method for structured_variable_c |
207 /* NOTE: I don't think this will ever get called, since in the visit method for structured_variable_c |
208 * we use the basetype_decl for recursively calling this class, and the base type should never be a |
208 * we use the basetype_decl for recursively calling this class, and the base type should never be a |
209 * structure_type_declaration_c, but for now, let's leave it in... |
209 * structure_type_declaration_c, but for now, let's leave it in... |
210 */ |
210 */ |
211 void *search_varfb_instance_type_c::visit(structure_type_declaration_c *symbol) { |
211 void *search_varfb_instance_type_c::visit(structure_type_declaration_c *symbol) { |
212 if (NULL == current_field_selector) ERROR; |
212 if (NULL == current_field_selector) return NULL; // the source code has a datatype consistency bug that will be caught later!! |
|
213 |
213 symbol->structure_specification->accept(*this); |
214 symbol->structure_specification->accept(*this); |
214 return NULL; |
215 return NULL; |
215 /* NOTE: structure_specification will point to either a |
216 /* NOTE: structure_specification will point to either a |
216 * initialized_structure_c |
217 * initialized_structure_c |
217 * OR A |
218 * OR A |
226 /* NOTE: I don't think this will ever get called, since in the visit method for structured_variable_c |
227 /* NOTE: I don't think this will ever get called, since in the visit method for structured_variable_c |
227 * we use the basetype_decl for recursively calling this class, and the base type should never be a |
228 * we use the basetype_decl for recursively calling this class, and the base type should never be a |
228 * initialized_structure_c, but for now, let's leave it in... |
229 * initialized_structure_c, but for now, let's leave it in... |
229 */ |
230 */ |
230 void *search_varfb_instance_type_c::visit(initialized_structure_c *symbol) { |
231 void *search_varfb_instance_type_c::visit(initialized_structure_c *symbol) { |
231 if (NULL != current_field_selector) ERROR; |
232 if (NULL == current_field_selector) return NULL; // the source code has a datatype consistency bug that will be caught later!! |
232 |
233 |
233 /* recursively find out the data type of current_field_selector... */ |
234 /* recursively find out the data type of current_field_selector... */ |
234 symbol->structure_type_name->accept(*this); |
235 symbol->structure_type_name->accept(*this); |
235 return NULL; |
236 return NULL; |
236 } |
237 } |
237 |
238 |
238 /* helper symbol for structure_declaration */ |
239 /* helper symbol for structure_declaration */ |
239 /* structure_declaration: STRUCT structure_element_declaration_list END_STRUCT */ |
240 /* structure_declaration: STRUCT structure_element_declaration_list END_STRUCT */ |
240 /* structure_element_declaration_list structure_element_declaration ';' */ |
241 /* structure_element_declaration_list structure_element_declaration ';' */ |
241 void *search_varfb_instance_type_c::visit(structure_element_declaration_list_c *symbol) { |
242 void *search_varfb_instance_type_c::visit(structure_element_declaration_list_c *symbol) { |
242 if (NULL == current_field_selector) ERROR; |
243 if (NULL == current_field_selector) return NULL; // the source code has a datatype consistency bug that will be caught later!! |
243 |
244 |
244 /* now search the structure declaration */ |
245 /* now search the structure declaration */ |
245 for(int i = 0; i < symbol->n; i++) { |
246 for(int i = 0; i < symbol->n; i++) { |
246 symbol->elements[i]->accept(*this); |
247 symbol->elements[i]->accept(*this); |
247 } |
248 } |
249 return NULL; |
250 return NULL; |
250 } |
251 } |
251 |
252 |
252 /* structure_element_name ':' spec_init */ |
253 /* structure_element_name ':' spec_init */ |
253 void *search_varfb_instance_type_c::visit(structure_element_declaration_c *symbol) { |
254 void *search_varfb_instance_type_c::visit(structure_element_declaration_c *symbol) { |
254 if (NULL == current_field_selector) ERROR; |
255 if (NULL == current_field_selector) return NULL; // the source code has a datatype consistency bug that will be caught later!! |
255 |
256 |
256 if (compare_identifiers(symbol->structure_element_name, current_field_selector) == 0) { |
257 if (compare_identifiers(symbol->structure_element_name, current_field_selector) == 0) { |
257 /* found the type of the element we were looking for! */ |
258 /* found the type of the element we were looking for! */ |
258 current_type_id = symbol->spec_init; |
259 current_type_id = symbol->spec_init; |
259 current_basetype_decl = search_base_type_c::get_basetype_decl(current_type_id); |
260 current_basetype_decl = search_base_type_c::get_basetype_decl(current_type_id); |
355 /*****************************/ |
356 /*****************************/ |
356 |
357 |
357 /* FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */ |
358 /* FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */ |
358 // SYM_REF4(function_block_declaration_c, fblock_name, var_declarations, fblock_body, unused) |
359 // SYM_REF4(function_block_declaration_c, fblock_name, var_declarations, fblock_body, unused) |
359 void *search_varfb_instance_type_c::visit(function_block_declaration_c *symbol) { |
360 void *search_varfb_instance_type_c::visit(function_block_declaration_c *symbol) { |
360 if (NULL == current_field_selector) ERROR; |
361 if (NULL == current_field_selector) return NULL; // the source code has a datatype consistency bug that will be caught later!! |
361 |
362 |
362 /* now search the function block declaration for the variable... */ |
363 /* now search the function block declaration for the variable... */ |
363 /* If not found, these pointers will all be set to NULL!! */ |
364 /* If not found, these pointers will all be set to NULL!! */ |
364 search_var_instance_decl_c search_decl(symbol); |
365 search_var_instance_decl_c search_decl(symbol); |
365 current_type_id = search_decl.get_decl(current_field_selector); |
366 current_type_id = search_decl.get_decl(current_field_selector); |
376 /*********************************************/ |
377 /*********************************************/ |
377 /* INITIAL_STEP step_name ':' action_association_list END_STEP */ |
378 /* INITIAL_STEP step_name ':' action_association_list END_STEP */ |
378 // SYM_REF2(initial_step_c, step_name, action_association_list) |
379 // SYM_REF2(initial_step_c, step_name, action_association_list) |
379 /* NOTE: this method may be called from visit(structured_variable_c *symbol) method| */ |
380 /* NOTE: this method may be called from visit(structured_variable_c *symbol) method| */ |
380 void *search_varfb_instance_type_c::visit(initial_step_c *symbol) { |
381 void *search_varfb_instance_type_c::visit(initial_step_c *symbol) { |
381 if (NULL == current_field_selector) ERROR; |
382 if (NULL == current_field_selector) return NULL; // the source code has a datatype consistency bug that will be caught later!! |
382 |
383 |
383 identifier_c T("T"); |
384 identifier_c T("T"); |
384 identifier_c X("X"); |
385 identifier_c X("X"); |
385 |
386 |
386 /* Hard code the datatypes of the implicit variables Stepname.X and Stepname.T */ |
387 /* Hard code the datatypes of the implicit variables Stepname.X and Stepname.T */ |