Fix indentation and unused variable warning in SFC generated code
authorLaurent Bessard
Tue, 06 Nov 2012 19:17:36 +0100
changeset 702 56337e796ab0
parent 701 562c01f82afb
child 703 48d106ffc2ca
Fix indentation and unused variable warning in SFC generated code
stage4/generate_c/generate_c_sfc.cc
--- a/stage4/generate_c/generate_c_sfc.cc	Wed Oct 31 19:21:09 2012 +0100
+++ b/stage4/generate_c/generate_c_sfc.cc	Tue Nov 06 19:17:36 2012 +0100
@@ -203,21 +203,22 @@
             current_step = symbol->step_name;
             s4o.print(s4o.indent_spaces + "{\n");
             s4o.indent_right();
-            s4o.print(s4o.indent_spaces + "char activated = ");
+            s4o.print(s4o.indent_spaces + "char activated, desactivated, active;\n");
+            s4o.print(s4o.indent_spaces + "activated = ");
             s4o.print(GET_VAR);
             s4o.print("(");
             print_step_argument(current_step, "state");
             s4o.print(") && !");
             print_step_argument(current_step, "prev_state");
             s4o.print(";\n");
-            s4o.print(s4o.indent_spaces + "char desactivated = !");
+            s4o.print(s4o.indent_spaces + "desactivated = !");
             s4o.print(GET_VAR);
             s4o.print("(");
             print_step_argument(current_step, "state");
             s4o.print(") && ");
             print_step_argument(current_step, "prev_state");
             s4o.print(";\n");
-            s4o.print(s4o.indent_spaces + "char active = ");
+            s4o.print(s4o.indent_spaces + "active = ");
             s4o.print(GET_VAR);
             s4o.print("(");
             print_step_argument(current_step, "state");
@@ -576,9 +577,10 @@
                 current_action->accept(*this);
                 s4o.print(",1);\n");
                 s4o.indent_left();
-                s4o.print("}\n");
+                s4o.print(s4o.indent_spaces + "}\n");
                 s4o.print(s4o.indent_spaces + "else if (active) {\n");
                 s4o.indent_right();
+                s4o.print(s4o.indent_spaces);
                 if (vartype == search_var_instance_decl_c::external_vt)
                   s4o.print(SET_EXTERNAL);
                 else if (vartype == search_var_instance_decl_c::located_vt)
@@ -699,7 +701,6 @@
       }
       
       s4o.print(s4o.indent_spaces +"INT i;\n");
-      s4o.print(s4o.indent_spaces +"BOOL transition;\n");
       s4o.print(s4o.indent_spaces +"TIME elapsed_time, current_time;\n\n");
       
       /* generate elapsed_time initializations */