ProjectController.py
changeset 1050 56bef276055e
parent 1006 0302f9ab7e9a
child 1062 fd7c9a7cf882
--- a/ProjectController.py	Tue Apr 23 20:01:56 2013 +0900
+++ b/ProjectController.py	Wed Apr 24 12:24:12 2013 +0900
@@ -602,6 +602,15 @@
             return False
         # transform those base names to full names with path
         C_files = map(lambda filename:os.path.join(buildpath, filename), C_files)
+
+        # prepend beremiz include to configuration header
+        H_files = [ fname for fname in result.splitlines() if fname[-2:]==".h" or fname[-2:]==".H" ]
+        H_files.remove("LOCATED_VARIABLES.h")
+        H_files = map(lambda filename:os.path.join(buildpath, filename), H_files)
+        for H_file in H_files:
+            with file(H_file, 'r') as original: data = original.read()
+            with file(H_file, 'w') as modified: modified.write('#include "beremiz.h"\n' + data)
+
         self.logger.write(_("Extracting Located Variables...\n"))
         # Keep track of generated located variables for later use by self._Generate_C
         self.PLCGeneratedLocatedVars = self.GetLocations()