equal
deleted
inserted
replaced
347 if ( get_datatype_info_c::is_function_block(symbol->record_variable->datatype) |
347 if ( get_datatype_info_c::is_function_block(symbol->record_variable->datatype) |
348 || get_datatype_info_c::is_sfc_step (symbol->record_variable->datatype)) { |
348 || get_datatype_info_c::is_sfc_step (symbol->record_variable->datatype)) { |
349 if (NULL == symbol->record_variable->scope) ERROR; |
349 if (NULL == symbol->record_variable->scope) ERROR; |
350 search_var_instance_decl_c search_var_instance_decl(symbol->record_variable->scope); |
350 search_var_instance_decl_c search_var_instance_decl(symbol->record_variable->scope); |
351 if (search_var_instance_decl_c::external_vt == search_var_instance_decl.get_vartype(get_var_name_c::get_last_field(symbol->record_variable))) |
351 if (search_var_instance_decl_c::external_vt == search_var_instance_decl.get_vartype(get_var_name_c::get_last_field(symbol->record_variable))) |
352 s4o.print("->"); /* please read the comment in visit(deref_operator_c *) tio understand what this line is doing! */ |
352 s4o.print("->"); |
353 else if (dynamic_cast<deref_operator_c *>(symbol->record_variable) != NULL) |
353 else if (dynamic_cast<deref_operator_c *>(symbol->record_variable) != NULL) |
354 s4o.print("->"); /* please read the comment in visit(deref_operator_c *) tio understand what this line is doing! */ |
354 s4o.print("->"); /* please read the comment in visit(deref_operator_c *) tio understand what this line is doing! */ |
355 else |
355 else |
356 s4o.print("."); |
356 s4o.print("."); |
357 symbol->field_selector->accept(*this); |
357 symbol->field_selector->accept(*this); |
400 symbol->subscripted_variable->accept(*this); |
400 symbol->subscripted_variable->accept(*this); |
401 |
401 |
402 current_array_type = search_varfb_instance_type->get_basetype_decl(symbol->subscripted_variable); |
402 current_array_type = search_varfb_instance_type->get_basetype_decl(symbol->subscripted_variable); |
403 if (current_array_type == NULL) ERROR; |
403 if (current_array_type == NULL) ERROR; |
404 |
404 |
405 s4o.print(".table"); |
405 if (dynamic_cast<deref_operator_c *>(symbol->subscripted_variable) != NULL) |
|
406 s4o.print("->"); /* please read the comment in visit(deref_operator_c *) tio understand what this line is doing! */ |
|
407 else |
|
408 s4o.print("."); |
|
409 s4o.print("table"); |
406 wanted_variablegeneration = expression_vg; |
410 wanted_variablegeneration = expression_vg; |
407 symbol->subscript_list->accept(*this); |
411 symbol->subscript_list->accept(*this); |
408 wanted_variablegeneration = complextype_suffix_vg; |
412 wanted_variablegeneration = complextype_suffix_vg; |
409 |
413 |
410 current_array_type = NULL; |
414 current_array_type = NULL; |
496 s4o.print("(*"); |
500 s4o.print("(*"); |
497 symbol->exp->accept(*this); |
501 symbol->exp->accept(*this); |
498 s4o.print(")"); |
502 s4o.print(")"); |
499 } else { |
503 } else { |
500 /* For code in FBs, and PROGRAMS... */ |
504 /* For code in FBs, and PROGRAMS... */ |
501 if (NULL == dynamic_cast<structured_variable_c *>(symbol->parent)) { |
505 if ( (NULL == dynamic_cast<structured_variable_c *>(symbol->parent)) |
|
506 && (NULL == dynamic_cast< array_variable_c *>(symbol->parent))) { |
502 s4o.print("(*"); |
507 s4o.print("(*"); |
503 symbol->exp->accept(*this); |
508 symbol->exp->accept(*this); |
504 s4o.print(")"); |
509 s4o.print(")"); |
505 } else { |
510 } else { |
506 /* We are in a structured variable - the structured_variable_c itself will already have printed out the '->' !! */ |
511 /* We are in a structured variable - the structured_variable_c or the array_variable_c will already have printed out the '->' !! */ |
507 if (NULL != dynamic_cast<deref_operator_c *>(symbol->exp)) |
512 if (NULL != dynamic_cast<deref_operator_c *>(symbol->exp)) |
508 STAGE4_ERROR(symbol, symbol->exp, "The use of two or more consecutive derefencing operators between a struct variable and its record elem (ex: struct_ref_ref^^.elem) is currently not supported for code inside a Function_Block."); |
513 STAGE4_ERROR(symbol, symbol->exp, "The use of two or more consecutive derefencing operators between a struct variable and its record elem (ex: struct_ref_ref^^.elem) is currently not supported for code inside a Function_Block."); |
509 symbol->exp->accept(*this); |
514 symbol->exp->accept(*this); |
510 } |
515 } |
511 } |
516 } |