588 } |
588 } |
589 |
589 |
590 |
590 |
591 void *fill_candidate_datatypes_c::visit(boolean_true_c *symbol) { |
591 void *fill_candidate_datatypes_c::visit(boolean_true_c *symbol) { |
592 add_2datatypes_to_candidate_list(symbol, &search_constant_type_c::bool_type_name, &search_constant_type_c::safebool_type_name); |
592 add_2datatypes_to_candidate_list(symbol, &search_constant_type_c::bool_type_name, &search_constant_type_c::safebool_type_name); |
593 remove_incompatible_datatypes(symbol); |
|
594 return NULL; |
593 return NULL; |
595 } |
594 } |
596 |
595 |
597 void *fill_candidate_datatypes_c::visit(boolean_false_c *symbol) { |
596 void *fill_candidate_datatypes_c::visit(boolean_false_c *symbol) { |
598 add_2datatypes_to_candidate_list(symbol, &search_constant_type_c::bool_type_name, &search_constant_type_c::safebool_type_name); |
597 add_2datatypes_to_candidate_list(symbol, &search_constant_type_c::bool_type_name, &search_constant_type_c::safebool_type_name); |
599 remove_incompatible_datatypes(symbol); |
|
600 return NULL; |
598 return NULL; |
601 } |
599 } |
602 |
600 |
603 /*******************************/ |
601 /*******************************/ |
604 /* B.1.2.2 Character Strings */ |
602 /* B.1.2.2 Character Strings */ |
605 /*******************************/ |
603 /*******************************/ |
606 void *fill_candidate_datatypes_c::visit(double_byte_character_string_c *symbol) { |
604 void *fill_candidate_datatypes_c::visit(double_byte_character_string_c *symbol) { |
607 add_2datatypes_to_candidate_list(symbol, &search_constant_type_c::wstring_type_name, &search_constant_type_c::safewstring_type_name); |
605 add_2datatypes_to_candidate_list(symbol, &search_constant_type_c::wstring_type_name, &search_constant_type_c::safewstring_type_name); |
608 remove_incompatible_datatypes(symbol); |
|
609 return NULL; |
606 return NULL; |
610 } |
607 } |
611 |
608 |
612 void *fill_candidate_datatypes_c::visit(single_byte_character_string_c *symbol) { |
609 void *fill_candidate_datatypes_c::visit(single_byte_character_string_c *symbol) { |
613 add_2datatypes_to_candidate_list(symbol, &search_constant_type_c::string_type_name, &search_constant_type_c::safestring_type_name); |
610 add_2datatypes_to_candidate_list(symbol, &search_constant_type_c::string_type_name, &search_constant_type_c::safestring_type_name); |
1422 * details (e.g. how to round and truncate numbers) as defined in IEC 61131-3, we will leave this to the future. |
1419 * details (e.g. how to round and truncate numbers) as defined in IEC 61131-3, we will leave this to the future. |
1423 * Also, the question will arise if we should also replace calls to standard |
1420 * Also, the question will arise if we should also replace calls to standard |
1424 * functions if the input parameters are all literals (e.g. ADD(42, 42)). This |
1421 * functions if the input parameters are all literals (e.g. ADD(42, 42)). This |
1425 * means this class will be more difficult than it appears at first. |
1422 * means this class will be more difficult than it appears at first. |
1426 */ |
1423 */ |
1427 void *fill_candidate_datatypes_c::visit( add_expression_c *symbol) { |
1424 void *fill_candidate_datatypes_c::visit( add_expression_c *symbol) {return handle_binary_expression(widen_ADD_table, symbol, symbol->l_exp, symbol->r_exp);} |
1428 void *ret = handle_binary_expression(widen_ADD_table, symbol, symbol->l_exp, symbol->r_exp); |
|
1429 remove_incompatible_datatypes(symbol); |
|
1430 return ret; |
|
1431 } |
|
1432 void *fill_candidate_datatypes_c::visit( sub_expression_c *symbol) {return handle_binary_expression(widen_SUB_table, symbol, symbol->l_exp, symbol->r_exp);} |
1425 void *fill_candidate_datatypes_c::visit( sub_expression_c *symbol) {return handle_binary_expression(widen_SUB_table, symbol, symbol->l_exp, symbol->r_exp);} |
1433 void *fill_candidate_datatypes_c::visit( mul_expression_c *symbol) {return handle_binary_expression(widen_MUL_table, symbol, symbol->l_exp, symbol->r_exp);} |
1426 void *fill_candidate_datatypes_c::visit( mul_expression_c *symbol) {return handle_binary_expression(widen_MUL_table, symbol, symbol->l_exp, symbol->r_exp);} |
1434 void *fill_candidate_datatypes_c::visit( div_expression_c *symbol) {return handle_binary_expression(widen_DIV_table, symbol, symbol->l_exp, symbol->r_exp);} |
1427 void *fill_candidate_datatypes_c::visit( div_expression_c *symbol) {return handle_binary_expression(widen_DIV_table, symbol, symbol->l_exp, symbol->r_exp);} |
1435 void *fill_candidate_datatypes_c::visit( mod_expression_c *symbol) {return handle_binary_expression(widen_MOD_table, symbol, symbol->l_exp, symbol->r_exp);} |
1428 void *fill_candidate_datatypes_c::visit( mod_expression_c *symbol) {return handle_binary_expression(widen_MOD_table, symbol, symbol->l_exp, symbol->r_exp);} |
1436 void *fill_candidate_datatypes_c::visit(power_expression_c *symbol) {return handle_binary_expression(widen_EXPT_table, symbol, symbol->l_exp, symbol->r_exp);} |
1429 void *fill_candidate_datatypes_c::visit(power_expression_c *symbol) {return handle_binary_expression(widen_EXPT_table, symbol, symbol->l_exp, symbol->r_exp);} |