Adding Function Blocks in VARIABLES.csv
authorlbessard
Fri, 12 Dec 2008 17:52:44 +0100
changeset 157 3e12726f9d6b
parent 156 6b16b7f8b527
child 158 eb8a5df69bb0
Adding Function Blocks in VARIABLES.csv
stage4/generate_c/generate_var_list.cc
--- a/stage4/generate_c/generate_var_list.cc	Fri Dec 05 16:22:15 2008 +0100
+++ b/stage4/generate_c/generate_var_list.cc	Fri Dec 12 17:52:44 2008 +0100
@@ -139,6 +139,16 @@
     }
     
     void declare_variable(symbol_c *symbol, const char* type = "VAR") {
+      print_var_number();
+      s4o.print(";");
+      s4o.print(type);
+      s4o.print(";");
+      print_symbol_list();
+      symbol->accept(*this);
+      s4o.print(";");
+      print_symbol_list();
+      symbol->accept(*this);
+      s4o.print(";");
       if (strcmp(type, "FB") == 0) {
         SYMBOL *current_name;
         current_name = new SYMBOL;
@@ -148,16 +158,6 @@
         current_symbol_list.pop_back();
       }
       else {
-        print_var_number();
-        s4o.print(";");
-        s4o.print(type);
-        s4o.print(";");
-        print_symbol_list();
-        symbol->accept(*this);
-        s4o.print(";");
-        print_symbol_list();
-        symbol->accept(*this);
-        s4o.print(";");
         this->current_var_type_symbol->accept(*this);
         s4o.print(";\n");
       }
@@ -397,6 +397,8 @@
 /*****************************/
     void *visit(function_block_declaration_c *symbol) {
       if (current_declarationtype == variables_dt && configuration_defined) {
+        symbol->fblock_name->accept(*this);
+        s4o.print(";\n");
         symbol->var_declarations->accept(*this);
         symbol->fblock_body->accept(*this);
       }