Bugs on SFC transition list generation and search expression type with structured_variables corrected
--- a/.cvsignore Fri Apr 06 18:07:56 2007 +0200
+++ b/.cvsignore Wed Apr 18 16:43:18 2007 +0200
@@ -1,3 +1,4 @@
Makefile.depend
iec2iec
iec2cc
+*.txt
--- a/stage4/generate_cc/generate_cc_sfc.cc Fri Apr 06 18:07:56 2007 +0200
+++ b/stage4/generate_cc/generate_cc_sfc.cc Wed Apr 18 16:43:18 2007 +0200
@@ -314,6 +314,7 @@
s4o.print(";\n");
}
if (symbol->transition_condition_st != NULL) {
+ s4o.print(s4o.indent_spaces);
print_variable_prefix();
s4o.print("transition_list[");
print_transition_number();
--- a/stage4/generate_cc/generate_cc_sfcdecl.cc Fri Apr 06 18:07:56 2007 +0200
+++ b/stage4/generate_cc/generate_cc_sfcdecl.cc Wed Apr 18 16:43:18 2007 +0200
@@ -157,13 +157,13 @@
void *visit(step_c *symbol) {return NULL;}
- void *visit(transition_c *symbol) {return NULL;}
-
- void *visit(action_c *symbol) {
+ void *visit(transition_c *symbol) {
transition_number++;
return NULL;
}
+ void *visit(action_c *symbol) {return NULL;}
+
}; /* generate_cc_sfc_steptable_c */
@@ -221,8 +221,9 @@
generate_cc_sfc_actiontable->print_action_number();
s4o.print(";\n");
- /* generate actions table */
+ /* generate transitions table */
generate_cc_sfc_transitiontable->reset_transition_number();
+ symbol->accept(*generate_cc_sfc_transitiontable);
s4o.print(s4o.indent_spaces + "char transition_list[");
generate_cc_sfc_transitiontable->print_transition_number();
s4o.print("];\n");
--- a/stage4/generate_cc/generate_cc_st.cc Fri Apr 06 18:07:56 2007 +0200
+++ b/stage4/generate_cc/generate_cc_st.cc Wed Apr 18 16:43:18 2007 +0200
@@ -131,7 +131,7 @@
void *visit(or_expression_c *symbol) {
symbol_c *left_type = search_expression_type->get_type(symbol->l_exp);
symbol_c *right_type = search_expression_type->get_type(symbol->r_exp);
- if (typeid(*left_type) == typeid(bool_type_name_c) && typeid(*right_type) == typeid(bool_type_name_c)) {
+ if (search_expression_type->is_bool_type(left_type) && search_expression_type->is_bool_type(right_type)) {
return print_binary_expression(symbol->l_exp, symbol->r_exp, " || ");
}
if (search_expression_type->is_numeric_compatible(left_type) && search_expression_type->is_numeric_compatible(right_type)) {
@@ -144,7 +144,7 @@
void *visit(xor_expression_c *symbol) {
symbol_c *left_type = search_expression_type->get_type(symbol->l_exp);
symbol_c *right_type = search_expression_type->get_type(symbol->r_exp);
- if (typeid(*left_type) == typeid(bool_type_name_c) && typeid(*right_type) == typeid(bool_type_name_c)) {
+ if (search_expression_type->is_bool_type(left_type) && search_expression_type->is_bool_type(right_type)) {
s4o.print("(");
symbol->l_exp->accept(*this);
s4o.print(" && !");
@@ -165,7 +165,7 @@
void *visit(and_expression_c *symbol) {
symbol_c *left_type = search_expression_type->get_type(symbol->l_exp);
symbol_c *right_type = search_expression_type->get_type(symbol->r_exp);
- if (typeid(*left_type) == typeid(bool_type_name_c) && typeid(*right_type) == typeid(bool_type_name_c)) {
+ if (search_expression_type->is_bool_type(left_type) && search_expression_type->is_bool_type(right_type)) {
return print_binary_expression(symbol->l_exp, symbol->r_exp, " && ");
}
if (search_expression_type->is_numeric_compatible(left_type) && search_expression_type->is_numeric_compatible(right_type)) {
--- a/stage4/generate_cc/search_expression_type.cc Fri Apr 06 18:07:56 2007 +0200
+++ b/stage4/generate_cc/search_expression_type.cc Wed Apr 18 16:43:18 2007 +0200
@@ -117,6 +117,29 @@
return NULL;
}
+/*************************************/
+/* B 1.4.2 - Multi-element variables */
+/*************************************/
+
+ void *visit(array_variable_c *symbol) {
+ symbol_c *res;
+
+ /* Nope, now we assume it is a variable, and determine its type... */
+ res = search_varfb_instance_type->get_type(symbol);
+ if (NULL != res) return res;
+
+ return NULL;
+ }
+
+ void *visit(structured_variable_c *symbol) {
+ symbol_c *res;
+
+ /* Nope, now we assume it is a variable, and determine its type... */
+ res = search_varfb_instance_type->get_type(symbol);
+ if (NULL != res) return res;
+
+ return NULL;
+ }
/***************************************/
/* B.3 - Language ST (Structured Text) */