# HG changeset patch # User mario # Date 1245345534 -7200 # Node ID e18690830555d4e3abb400e8c59303400cbc5bab # Parent 5ef4fe412e34112ebdaa2a657e03d713fbabf236 Removing un-necessary symbol direct_variable_type_name_c from abstract syntax tree diff -r 5ef4fe412e34 -r e18690830555 absyntax/absyntax.def --- a/absyntax/absyntax.def Thu Jun 18 18:49:29 2009 +0200 +++ b/absyntax/absyntax.def Thu Jun 18 19:18:54 2009 +0200 @@ -208,7 +208,6 @@ SYM_REF0(wstring_type_name_c) SYM_REF0(constant_int_type_name_c) SYM_REF0(constant_real_type_name_c) -SYM_REF0(direct_variable_type_name_c) /********************************/ diff -r 5ef4fe412e34 -r e18690830555 absyntax_utils/search_base_type.cc --- a/absyntax_utils/search_base_type.cc Thu Jun 18 18:49:29 2009 +0200 +++ b/absyntax_utils/search_base_type.cc Thu Jun 18 19:18:54 2009 +0200 @@ -93,7 +93,6 @@ void *search_base_type_c::visit(wstring_type_name_c *symbol) {return (void *)symbol;} void *search_base_type_c::visit(constant_int_type_name_c *symbol) {return (void *)symbol;} void *search_base_type_c::visit(constant_real_type_name_c *symbol) {return (void *)symbol;} -void *search_base_type_c::visit(direct_variable_type_name_c *symbol) {return (void *)symbol;} /******************************************************/ /* Extensions to the base standard as defined in */ /* "Safety Software Technical Specification, */ diff -r 5ef4fe412e34 -r e18690830555 absyntax_utils/search_base_type.hh --- a/absyntax_utils/search_base_type.hh Thu Jun 18 18:49:29 2009 +0200 +++ b/absyntax_utils/search_base_type.hh Thu Jun 18 19:18:54 2009 +0200 @@ -79,7 +79,6 @@ void *visit(wstring_type_name_c *symbol); void *visit(constant_int_type_name_c *symbol); void *visit(constant_real_type_name_c *symbol); - void *visit(direct_variable_type_name_c *symbol); /******************************************************/ /* Extensions to the base standard as defined in */ diff -r 5ef4fe412e34 -r e18690830555 absyntax_utils/search_constant_type.cc --- a/absyntax_utils/search_constant_type.cc Thu Jun 18 18:49:29 2009 +0200 +++ b/absyntax_utils/search_constant_type.cc Thu Jun 18 19:18:54 2009 +0200 @@ -122,4 +122,3 @@ constant_real_type_name_c search_constant_type_c::constant_real_type_name; constant_int_type_name_c search_constant_type_c::constant_int_type_name; -direct_variable_type_name_c search_constant_type_c::direct_variable_type_name; diff -r 5ef4fe412e34 -r e18690830555 absyntax_utils/search_constant_type.hh --- a/absyntax_utils/search_constant_type.hh Thu Jun 18 18:49:29 2009 +0200 +++ b/absyntax_utils/search_constant_type.hh Thu Jun 18 19:18:54 2009 +0200 @@ -69,7 +69,6 @@ static constant_real_type_name_c constant_real_type_name; static constant_int_type_name_c constant_int_type_name; - static direct_variable_type_name_c direct_variable_type_name; /******************************************************/ /* Extensions to the base standard as defined in */ diff -r 5ef4fe412e34 -r e18690830555 absyntax_utils/search_expression_type.cc --- a/absyntax_utils/search_expression_type.cc Thu Jun 18 18:49:29 2009 +0200 +++ b/absyntax_utils/search_expression_type.cc Thu Jun 18 19:18:54 2009 +0200 @@ -82,7 +82,6 @@ if (typeid(*type_symbol) == typeid(udint_type_name_c)) {return true;} if (typeid(*type_symbol) == typeid(ulint_type_name_c)) {return true;} if (typeid(*type_symbol) == typeid(constant_int_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(direct_variable_type_name_c)) {return true;} return false; } @@ -91,7 +90,6 @@ if (typeid(*type_symbol) == typeid(real_type_name_c)) {return true;} if (typeid(*type_symbol) == typeid(lreal_type_name_c)) {return true;} if (typeid(*type_symbol) == typeid(constant_real_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(direct_variable_type_name_c)) {return true;} return false; } @@ -107,7 +105,6 @@ if (typeid(*type_symbol) == typeid(dword_type_name_c)) {return true;} if (typeid(*type_symbol) == typeid(lword_type_name_c)) {return true;} if (typeid(*type_symbol) == typeid(constant_int_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(direct_variable_type_name_c)) {return true;} return false; } @@ -126,8 +123,6 @@ if ((typeid(*first_type) == typeid(constant_int_type_name_c) && is_binary_type(second_type))) {return true;} if (is_real_type(first_type) && (typeid(*second_type) == typeid(constant_real_type_name_c))) {return true;} if ((typeid(*first_type) == typeid(constant_real_type_name_c) && is_real_type(second_type))) {return true;} - if (typeid(*first_type) == typeid(direct_variable_type_name_c)) {return true;} - if (typeid(*second_type) == typeid(direct_variable_type_name_c)) {return true;} return false; } @@ -136,12 +131,12 @@ if (first_type == NULL) {return second_type;} if (second_type == NULL) {return first_type;} if (typeid(*first_type) == typeid(*second_type)) {return first_type;} - if (is_integer_type(first_type) && (typeid(*second_type) == typeid(constant_int_type_name_c) || typeid(*second_type) == typeid(direct_variable_type_name_c))) {return first_type;} - if ((typeid(*first_type) == typeid(constant_int_type_name_c) || typeid(*second_type) == typeid(direct_variable_type_name_c)) && is_integer_type(second_type)) {return second_type;} - if (is_binary_type(first_type) && (typeid(*second_type) == typeid(constant_int_type_name_c) || typeid(*second_type) == typeid(direct_variable_type_name_c))) {return first_type;} - if ((typeid(*first_type) == typeid(constant_int_type_name_c) || typeid(*second_type) == typeid(direct_variable_type_name_c)) && is_binary_type(second_type)) {return second_type;} - if (is_real_type(first_type) && (typeid(*second_type) == typeid(constant_real_type_name_c) || typeid(*second_type) == typeid(direct_variable_type_name_c))) {return first_type;} - if ((typeid(*first_type) == typeid(constant_real_type_name_c) || typeid(*second_type) == typeid(direct_variable_type_name_c)) && is_real_type(second_type)) {return second_type;} + if (is_integer_type(first_type) && (typeid(*second_type) == typeid(constant_int_type_name_c))) {return first_type;} + if ((typeid(*first_type) == typeid(constant_int_type_name_c)) && is_integer_type(second_type)) {return second_type;} + if (is_binary_type(first_type) && (typeid(*second_type) == typeid(constant_int_type_name_c))) {return first_type;} + if ((typeid(*first_type) == typeid(constant_int_type_name_c)) && is_binary_type(second_type)) {return second_type;} + if (is_real_type(first_type) && (typeid(*second_type) == typeid(constant_real_type_name_c))) {return first_type;} + if ((typeid(*first_type) == typeid(constant_real_type_name_c)) && is_real_type(second_type)) {return second_type;} return NULL; } @@ -198,11 +193,19 @@ /********************************************/ void *search_expression_type_c::visit(direct_variable_c *symbol) { switch (symbol->value[2]) { - case 'X': // bit + case 'X': // bit - 1 bit return (void *)&bool_type_name; - default: - return (void *)&direct_variable_type_name; - } + case 'B': // byte - 8 bits + return (void *)&byte_type_name; + case 'W': // word - 16 bits + return (void *)&word_type_name; + case 'D': // double word - 32 bits + return (void *)&dword_type_name; + case 'L': // long word - 64 bits + return (void *)&lword_type_name; + default: // if none of the above, then the empty string was used <=> boolean + return (void *)&bool_type_name; + } } /*************************************/ diff -r 5ef4fe412e34 -r e18690830555 stage4/generate_iec/generate_iec.cc --- a/stage4/generate_iec/generate_iec.cc Thu Jun 18 18:49:29 2009 +0200 +++ b/stage4/generate_iec/generate_iec.cc Thu Jun 18 19:18:54 2009 +0200 @@ -316,7 +316,6 @@ void *visit(wstring_type_name_c *symbol) {s4o.print("WSTRING"); return NULL;} void *visit(constant_int_type_name_c *symbol) {return NULL;} void *visit(constant_real_type_name_c *symbol) {return NULL;} -void *visit(direct_variable_type_name_c *symbol) {return NULL;} /********************************/