Adding support for P0 and P1 qualifiers and fixing code generated for SL qualifier
authorLaurent Bessard
Tue, 04 Sep 2012 18:02:06 +0200
changeset 627 e7caa7d32ef5
parent 626 9f2cefb98e60
child 628 fe0d516fe291
Adding support for P0 and P1 qualifiers and fixing code generated for SL qualifier
stage1_2/iec_bison.yy
stage1_2/iec_flex.ll
stage4/generate_c/generate_c_sfc.cc
--- a/stage1_2/iec_bison.yy	Sat Sep 01 16:27:24 2012 +0200
+++ b/stage1_2/iec_bison.yy	Tue Sep 04 18:02:06 2012 +0200
@@ -1020,6 +1020,8 @@
 
 %token N
 %token P
+%token P0
+%token P1
 /* NOTE: the following two clash with the R and S IL operators.
  * It will have to be handled when we include parsing of SFC...
  */
@@ -5255,6 +5257,8 @@
 | R		{$$ = new qualifier_c(strdup("R"), locloc(@$));}
 | S		{$$ = new qualifier_c(strdup("S"), locloc(@$));}
 | P		{$$ = new qualifier_c(strdup("P"), locloc(@$));}
+| P0	{$$ = new qualifier_c(strdup("P0"), locloc(@$));}
+| P1	{$$ = new qualifier_c(strdup("P1"), locloc(@$));}
 ;
 
 timed_qualifier:
--- a/stage1_2/iec_flex.ll	Sat Sep 01 16:27:24 2012 +0200
+++ b/stage1_2/iec_flex.ll	Tue Sep 04 18:02:06 2012 +0200
@@ -1387,6 +1387,8 @@
 SL		return SL;
 N		return N;
 P		return P;
+P0		return P0;
+P1		return P1;
 R		return R;
 S		return S;
 }
--- a/stage4/generate_c/generate_c_sfc.cc	Sat Sep 01 16:27:24 2012 +0200
+++ b/stage4/generate_c/generate_c_sfc.cc	Tue Sep 04 18:02:06 2012 +0200
@@ -519,11 +519,15 @@
                 strcmp(qualifier, "R") == 0) {
               s4o.print("active");
             }
-            if (strcmp(qualifier, "P") == 0 || strcmp(qualifier, "SD") == 0 || 
-                strcmp(qualifier, "DS") == 0 || strcmp(qualifier, "SL") == 0) {
+            else if (strcmp(qualifier, "P") == 0 || strcmp(qualifier, "SD") == 0 ||
+            		 strcmp(qualifier, "DS") == 0 || strcmp(qualifier, "SL") == 0 ||
+            		 strcmp(qualifier, "P0") == 0) {
               s4o.print("activated");
             }
-            if (strcmp(qualifier, "D") == 0 || strcmp(qualifier, "L") == 0) {
+            else if (strcmp(qualifier, "P1") == 0) {
+              s4o.print("desactivated");
+            }
+            else if (strcmp(qualifier, "D") == 0 || strcmp(qualifier, "L") == 0) {
               s4o.print("active && __time_cmp(");
               print_step_argument(current_step, "elapsed_time");
               s4o.print(", ");
@@ -539,11 +543,12 @@
             s4o.indent_right();
             s4o.print(s4o.indent_spaces);
             if (strcmp(qualifier, "N") == 0 || strcmp(qualifier, "P") == 0 ||
-                strcmp(qualifier, "D") == 0 || strcmp(qualifier, "L") == 0) {
+                strcmp(qualifier, "D") == 0 || strcmp(qualifier, "L") == 0 ||
+                strcmp(qualifier, "P0") == 0 || strcmp(qualifier, "P1") == 0) {
               print_action_argument(current_action, "state");
               s4o.print(" = 1;\n");  
             }
-            if (strcmp(qualifier, "S") == 0) {
+            if (strcmp(qualifier, "S") == 0 || strcmp(qualifier, "SL") == 0) {
               print_action_argument(current_action, "set");
               s4o.print(" = 1;\n");
             }