# HG changeset patch # User Laurent Bessard # Date 1363002573 -3600 # Node ID cac262d1d6a58327e3579567de9ccd0dbf9c4acb # Parent 2481fffe6e58cfd15289f851dbfd4c8e2531aefc Fixed bug with SFC transition datatype checking diff -r 2481fffe6e58 -r cac262d1d6a5 stage3/fill_candidate_datatypes.cc --- a/stage3/fill_candidate_datatypes.cc Fri Mar 08 02:00:36 2013 +0100 +++ b/stage3/fill_candidate_datatypes.cc Mon Mar 11 12:49:33 2013 +0100 @@ -1270,7 +1270,31 @@ return NULL; } - +/********************************************/ +/* B 1.6 Sequential function chart elements */ +/********************************************/ + +void *fill_candidate_datatypes_c::visit(transition_condition_c *symbol) { + symbol_c *condition_type; + + if (symbol->transition_condition_il != NULL) { + symbol->transition_condition_il->accept(*this); + for (unsigned int i = 0; i < symbol->transition_condition_il->candidate_datatypes.size(); i++) { + condition_type = symbol->transition_condition_il->candidate_datatypes[i]; + if (get_datatype_info_c::is_BOOL_compatible(condition_type)) + add_datatype_to_candidate_list(symbol, condition_type); + } + } + if (symbol->transition_condition_st != NULL) { + symbol->transition_condition_st->accept(*this); + for (unsigned int i = 0; i < symbol->transition_condition_st->candidate_datatypes.size(); i++) { + condition_type = symbol->transition_condition_st->candidate_datatypes[i]; + if (get_datatype_info_c::is_BOOL_compatible(condition_type)) + add_datatype_to_candidate_list(symbol, condition_type); + } + } + return NULL; +} /********************************/ /* B 1.7 Configuration elements */ diff -r 2481fffe6e58 -r cac262d1d6a5 stage3/fill_candidate_datatypes.hh --- a/stage3/fill_candidate_datatypes.hh Fri Mar 08 02:00:36 2013 +0100 +++ b/stage3/fill_candidate_datatypes.hh Mon Mar 11 12:49:33 2013 +0100 @@ -236,6 +236,12 @@ /**********************/ void *visit(program_declaration_c *symbol); + /********************************************/ + /* B 1.6 Sequential function chart elements */ + /********************************************/ + + void *visit(transition_condition_c *symbol); + /********************************/ /* B 1.7 Configuration elements */ /********************************/ diff -r 2481fffe6e58 -r cac262d1d6a5 stage3/narrow_candidate_datatypes.cc --- a/stage3/narrow_candidate_datatypes.cc Fri Mar 08 02:00:36 2013 +0100 +++ b/stage3/narrow_candidate_datatypes.cc Mon Mar 11 12:49:33 2013 +0100 @@ -755,6 +755,24 @@ return NULL; } +/********************************************/ +/* B 1.6 Sequential function chart elements */ +/********************************************/ + +void *narrow_candidate_datatypes_c::visit(transition_condition_c *symbol) { + if (symbol->candidate_datatypes.size() != 1) + return NULL; + symbol->datatype = symbol->candidate_datatypes[0]; + if (symbol->transition_condition_il != NULL) { + symbol->transition_condition_il->datatype = symbol->datatype; + symbol->transition_condition_il->accept(*this); + } + if (symbol->transition_condition_st != NULL) { + symbol->transition_condition_st->datatype = symbol->datatype; + symbol->transition_condition_st->accept(*this); + } + return NULL; +} /********************************/ /* B 1.7 Configuration elements */ diff -r 2481fffe6e58 -r cac262d1d6a5 stage3/narrow_candidate_datatypes.hh --- a/stage3/narrow_candidate_datatypes.hh Fri Mar 08 02:00:36 2013 +0100 +++ b/stage3/narrow_candidate_datatypes.hh Mon Mar 11 12:49:33 2013 +0100 @@ -211,6 +211,12 @@ /**********************/ void *visit(program_declaration_c *symbol); + /********************************************/ + /* B 1.6 Sequential function chart elements */ + /********************************************/ + + void *visit(transition_condition_c *symbol); + /********************************/ /* B 1.7 Configuration elements */ /********************************/