403 void *search_varfb_instance_type_c::visit(step_c *symbol) { |
403 void *search_varfb_instance_type_c::visit(step_c *symbol) { |
404 /* The code here should be identicial to the code in the visit(initial_step_c *) visitor! So we simply call the other visitor! */ |
404 /* The code here should be identicial to the code in the visit(initial_step_c *) visitor! So we simply call the other visitor! */ |
405 initial_step_c initial_step(NULL, NULL); |
405 initial_step_c initial_step(NULL, NULL); |
406 return initial_step.accept(*this); |
406 return initial_step.accept(*this); |
407 } |
407 } |
|
408 |
|
409 |
|
410 /***************************************/ |
|
411 /* B.3 - Language ST (Structured Text) */ |
|
412 /***************************************/ |
|
413 /***********************/ |
|
414 /* B 3.1 - Expressions */ |
|
415 /***********************/ |
|
416 /* SYM_REF1(deref_expression_c, exp) --> an extension to the IEC 61131-3 standard - based on the IEC 61131-3 v3 standard. Returns address of the varible! */ |
|
417 void *search_varfb_instance_type_c::visit(deref_expression_c *symbol) { |
|
418 symbol->exp->accept(*this); |
|
419 symbol_c *basetype_decl = current_basetype_decl; |
|
420 this->init(); /* set all current_*** pointers to NULL ! */ |
|
421 |
|
422 /* Check whether the expression if a REF_TO datatype, and if so, set the new datatype to the datatype it references! */ |
|
423 /* Determine whether the datatype is a ref_spec_c, as this is the class used as the */ |
|
424 /* canonical/base datatype of REF_TO types (see search_base_type_c ...) */ |
|
425 ref_spec_c * ref_spec = dynamic_cast<ref_spec_c *>(basetype_decl); |
|
426 if (NULL != ref_spec) { |
|
427 current_basetype_decl = search_base_type_c::get_basetype_decl(ref_spec->type_name); |
|
428 current_basetype_id = search_base_type_c::get_basetype_id (ref_spec->type_name); |
|
429 } |
|
430 |
|
431 /* ########### WARNING ########################################################## */ |
|
432 /* The following two lines DO NOT belong here. It is just a temporary measure until I get the chance |
|
433 * to clean this up, and move it to fill/narrow candidate datatypes in stage 3 |
|
434 */ |
|
435 symbol->datatype = current_basetype_decl; |
|
436 symbol->exp->datatype = ref_spec; |
|
437 |
|
438 return NULL; |
|
439 } |
|
440 |
|
441 |
|
442 /* SYM_REF1(deref_operator_c, exp) --> an extension to the IEC 61131-3 standard - based on the IEC 61131-3 v3 standard. Returns address of the varible! */ |
|
443 void *search_varfb_instance_type_c::visit(deref_operator_c *symbol) { |
|
444 symbol->exp->accept(*this); |
|
445 symbol_c *basetype_decl = current_basetype_decl; |
|
446 this->init(); /* set all current_*** pointers to NULL ! */ |
|
447 |
|
448 /* Check whether the expression if a REF_TO datatype, and if so, set the new datatype to the datatype it references! */ |
|
449 /* Determine whether the datatype is a ref_spec_c, as this is the class used as the */ |
|
450 /* canonical/base datatype of REF_TO types (see search_base_type_c ...) */ |
|
451 ref_spec_c * ref_spec = dynamic_cast<ref_spec_c *>(basetype_decl); |
|
452 if (NULL != ref_spec) { |
|
453 current_basetype_decl = search_base_type_c::get_basetype_decl(ref_spec->type_name); |
|
454 current_basetype_id = search_base_type_c::get_basetype_id (ref_spec->type_name); |
|
455 } |
|
456 |
|
457 /* ########### WARNING ########################################################## */ |
|
458 /* The following two lines DO NOT belong here. It is just a temporary measure until I get the chance |
|
459 * to clean this up, and move it to fill/narrow candidate datatypes in stage 3 |
|
460 */ |
|
461 symbol->datatype = current_basetype_decl; |
|
462 symbol->exp->datatype = ref_spec; |
|
463 |
|
464 return NULL; |
|
465 } |