Fixed bug with SFC transition datatype checking
authorLaurent Bessard
Mon, 11 Mar 2013 12:49:33 +0100
changeset 802 cac262d1d6a5
parent 800 2481fffe6e58
child 803 36ac3a58be39
Fixed bug with SFC transition datatype checking
stage3/fill_candidate_datatypes.cc
stage3/fill_candidate_datatypes.hh
stage3/narrow_candidate_datatypes.cc
stage3/narrow_candidate_datatypes.hh
--- 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 */
--- 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 */
     /********************************/
--- 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 */
--- 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 */
     /********************************/