# HG changeset patch # User Edouard Tisserant # Date 1316705614 -7200 # Node ID eed1dcf311a1767f8417197d9f1858781453a585 # Parent be0ceea3b6dd9a252c301d6e3d2b4cfbb0b91ed3 added return type to suspendDebug diff -r be0ceea3b6dd -r eed1dcf311a1 runtime/PLCObject.py --- a/runtime/PLCObject.py Thu Sep 22 17:00:56 2011 +0200 +++ b/runtime/PLCObject.py Thu Sep 22 17:33:34 2011 +0200 @@ -136,7 +136,7 @@ self._GetDebugData.argtypes = [ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_void_p)] self._suspendDebug = self.PLClibraryHandle.suspendDebug - self._suspendDebug.restype = None + self._suspendDebug.restype = ctypes.c_int self._suspendDebug.argtypes = [ctypes.c_int] self._resumeDebug = self.PLClibraryHandle.resumeDebug @@ -161,7 +161,7 @@ self._IterDebugData = lambda x,y:None self._FreeDebugData = lambda:None self._GetDebugData = lambda:-1 - self._suspendDebug = lambda x:None + self._suspendDebug = lambda x:-1 self._resumeDebug = lambda:None self._PythonIterator = lambda:"" self.PLClibraryHandle = None @@ -329,18 +329,18 @@ """ if idxs: # suspend but dont disable - self._suspendDebug(False) - # keep a copy of requested idx - self._Idxs = idxs[:] - self._ResetDebugVariables() - for idx,iectype,force in idxs: - if force !=None: - c_type,unpack_func, pack_func = \ - TypeTranslator.get(iectype, - (None,None,None)) - force = ctypes.byref(pack_func(c_type,force)) - self._RegisterDebugVariable(idx, force) - self._resumeDebug() + if self._suspendDebug(False) == 0: + # keep a copy of requested idx + self._Idxs = idxs[:] + self._ResetDebugVariables() + for idx,iectype,force in idxs: + if force !=None: + c_type,unpack_func, pack_func = \ + TypeTranslator.get(iectype, + (None,None,None)) + force = ctypes.byref(pack_func(c_type,force)) + self._RegisterDebugVariable(idx, force) + self._resumeDebug() else: self._suspendDebug(True) self._Idxs = [] diff -r be0ceea3b6dd -r eed1dcf311a1 targets/Linux/plc_Linux_main.c --- a/targets/Linux/plc_Linux_main.c Thu Sep 22 17:00:56 2011 +0200 +++ b/targets/Linux/plc_Linux_main.c Thu Sep 22 17:33:34 2011 +0200 @@ -10,7 +10,6 @@ #include #include -/* provided by POUS.C */ extern unsigned long long common_ticktime__; long AtomicCompareExchange(long* atomicvar,long compared, long exchange) @@ -158,7 +157,7 @@ pthread_mutex_unlock(&debug_wait_mutex); } -void suspendDebug(int disable) +int suspendDebug(int disable) { /* Prevent PLC to enter debug code */ pthread_mutex_lock(&debug_mutex); @@ -166,6 +165,7 @@ __DEBUG = !disable; if (disable) pthread_mutex_unlock(&debug_mutex); + return 0; } void resumeDebug(void) diff -r be0ceea3b6dd -r eed1dcf311a1 targets/Win32/plc_Win32_main.c --- a/targets/Win32/plc_Win32_main.c Thu Sep 22 17:00:56 2011 +0200 +++ b/targets/Win32/plc_Win32_main.c Thu Sep 22 17:33:34 2011 +0200 @@ -183,14 +183,14 @@ ReleaseSemaphore(debug_wait_sem, 1, NULL); } -void suspendDebug(int disable) +int suspendDebug(int disable) { /* Prevent PLC to enter debug code */ WaitForSingleObject(debug_sem, INFINITE); - /*__DEBUG is protected by this mutex */ __DEBUG = !disable; if(disable) ReleaseSemaphore(debug_sem, 1, NULL); + return 0; } void resumeDebug()