Fix multiple resources support, POUS.c now only contain static definitions. POUS.c is included in configuration C code as well as in resources to allow GLOBAL FBs to be declared in configurations
authorEdouard Tisserant
Wed, 26 Mar 2014 13:20:45 +0100
changeset 883 f1b501f47c1f
parent 882 18a39a545ed9
child 884 a51a3bb4d613
Fix multiple resources support, POUS.c now only contain static definitions. POUS.c is included in configuration C code as well as in resources to allow GLOBAL FBs to be declared in configurations
stage4/generate_c/generate_c.cc
--- a/stage4/generate_c/generate_c.cc	Thu Mar 20 17:27:29 2014 +0100
+++ b/stage4/generate_c/generate_c.cc	Wed Mar 26 13:20:45 2014 +0100
@@ -1504,7 +1504,7 @@
 
   /* (B) Constructor */
   /* (B.1) Constructor name... */
-  s4o.print(s4o.indent_spaces + "void ");
+  s4o.print(s4o.indent_spaces + "static void ");
   symbol->fblock_name->accept(*this);
   s4o.print(FB_INIT_SUFFIX);
   s4o.print("(");
@@ -1551,7 +1551,7 @@
   /* (C.3) Function declaration */
   s4o.print("// Code part\n");
   /* function interface */
-  s4o.print("void ");
+  s4o.print("static void ");
   symbol->fblock_name->accept(*this);
   s4o.print(FB_FUNCTION_SUFFIX);
   s4o.print("(");
@@ -1694,7 +1694,7 @@
 
   /* (B) Constructor */
   /* (B.1) Constructor name... */
-  s4o.print(s4o.indent_spaces + "void ");
+  s4o.print(s4o.indent_spaces + "static void ");
   symbol->program_type_name->accept(*this);
   s4o.print(FB_INIT_SUFFIX);
   s4o.print("(");
@@ -1738,7 +1738,7 @@
   /* (C.3) Function declaration */
   s4o.print("// Code part\n");
   /* function interface */
-  s4o.print("void ");
+  s4o.print("static void ");
   symbol->program_type_name->accept(*this);
   s4o.print(FB_FUNCTION_SUFFIX);
   s4o.print("(");
@@ -1874,6 +1874,9 @@
   delete vardecl;
   s4o.print("\n");
 
+  /* (A.3) POUs inclusion */
+  s4o.print("#include \"POUS.c\"\n\n");
+
   /* (A.3) Declare global prototypes in include file */
   vardecl = new generate_c_vardecl_c(&s4o_incl,
                                      generate_c_vardecl_c::globalprototype_vf,