runtime/PLCObject.py
changeset 851 666f5bdad301
parent 798 0d2423f283a6
child 867 06495975e8a4
--- a/runtime/PLCObject.py	Sat Oct 06 00:23:51 2012 +0200
+++ b/runtime/PLCObject.py	Mon Oct 15 17:05:19 2012 +0200
@@ -105,7 +105,7 @@
             self._PythonIterator = getattr(self.PLClibraryHandle, "PythonIterator", None)
             if self._PythonIterator is not None:
                 self._PythonIterator.restype = ctypes.c_char_p
-                self._PythonIterator.argtypes = [ctypes.c_char_p]
+                self._PythonIterator.argtypes = [ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)]
                 
                 self._stopPLC = self._stopPLC_real
             else:
@@ -221,14 +221,15 @@
         self.StatusChange()
         self.StartSem.release()
         self.evaluator(self.PrepareRuntimePy)
-        res,cmd = "None","None"
+        res,cmd,blkid = "None","None",ctypes.c_void_p()
         while True:
-            #print "_PythonIterator(", res, ")",
-            cmd = self._PythonIterator(res)
-            #print " -> ", cmd
+            # print "_PythonIterator(", res, ")",
+            cmd = self._PythonIterator(res,blkid)
+            # print " -> ", cmd, blkid
             if cmd is None:
                 break
             try :
+                self.python_threads_vars["FBID"]=blkid.value
                 res = str(self.evaluator(eval,cmd,self.python_threads_vars))
             except Exception,e:
                 res = "#EXCEPTION : "+str(e)