Fixed retrieve and publish call order in PLC generated code
authorLaurent Bessard
Fri, 26 Apr 2013 13:38:27 +0200
changeset 1072 83b0815b8812
parent 1071 5e740fe71fbe
child 1073 3cc7d6951cf4
Fixed retrieve and publish call order in PLC generated code
ProjectController.py
--- a/ProjectController.py	Thu Apr 25 15:30:50 2013 +0200
+++ b/ProjectController.py	Fri Apr 26 13:38:27 2013 +0200
@@ -803,7 +803,7 @@
         # in retreive, publish, init, cleanup
         locstrs = map(lambda x:"_".join(map(str,x)),
            [loc for loc,Cfiles,DoCalls in self.LocationCFilesAndCFLAGS if loc and DoCalls])
-
+        
         # Generate main, based on template
         if not self.BeremizRoot.getDisable_Extensions():
             plc_main_code = targets.GetCode("plc_main_head") % {
@@ -813,9 +813,9 @@
                       "void __retrieve_%(s)s(void);\n"+
                       "void __publish_%(s)s(void);")%{'s':locstr} for locstr in locstrs]),
                 "retrieve_calls":"\n    ".join([
-                      "__retrieve_%s();"%locstrs[i-1] for i in xrange(len(locstrs), 0, -1)]),
+                      "__retrieve_%s();"%locstr for locstr in locstrs]),
                 "publish_calls":"\n    ".join([ #Call publish in reverse order
-                      "__publish_%s();"%locstr for locstr in locstrs]),
+                      "__publish_%s();"%locstrs[i-1] for i in xrange(len(locstrs), 0, -1)]),
                 "init_calls":"\n    ".join([
                       "init_level=%d; "%(i+1)+
                       "if((res = __init_%s(argc,argv))){"%locstr +