--- a/runtime/PLCObject.py Thu Dec 10 17:36:37 2009 +0100
+++ b/runtime/PLCObject.py Fri Dec 11 08:49:32 2009 +0100
@@ -362,7 +362,9 @@
self._ResetDebugVariables()
for idx,iectype,force in idxs:
if force !=None:
- c_type,unpack_func, pack_func = self.TypeTranslator.get(iectype, (None,None,None))
+ c_type,unpack_func, pack_func = \
+ self.TypeTranslator.get(iectype,
+ (None,None,None))
force = ctypes.byref(pack_func(c_type,force))
self._RegisterDebugVariable(idx, force)
self._resumeDebug()
@@ -381,18 +383,24 @@
buffer = ctypes.c_void_p()
offset = 0
if self.PLClibraryLock.acquire(False) and \
- self._GetDebugData(ctypes.byref(tick),ctypes.byref(size),ctypes.byref(buffer)) == 0 :
+ self._GetDebugData(ctypes.byref(tick),
+ ctypes.byref(size),
+ ctypes.byref(buffer)) == 0 :
if size.value:
for idx, iectype, forced in self._Idxs:
cursor = ctypes.c_void_p(buffer.value + offset)
- c_type,unpack_func, pack_func = self.TypeTranslator.get(iectype, (None,None,None))
+ c_type,unpack_func, pack_func = \
+ self.TypeTranslator.get(iectype,
+ (None,None,None))
if c_type is not None and offset < size:
- res.append(unpack_func(ctypes.cast(cursor,
- ctypes.POINTER(c_type)).contents))
+ res.append(unpack_func(
+ ctypes.cast(cursor,
+ ctypes.POINTER(c_type)).contents))
offset += ctypes.sizeof(c_type)
else:
if c_type is None:
- PLCprint("Debug error - " + iectype + " not supported !")
+ PLCprint("Debug error - " + iectype +
+ " not supported !")
if offset >= size:
PLCprint("Debug error - buffer too small !")
break
--- a/targets/plc_debug.c Thu Dec 10 17:36:37 2009 +0100
+++ b/targets/plc_debug.c Fri Dec 11 08:49:32 2009 +0100
@@ -278,11 +278,11 @@
int WaitDebugData(unsigned long *tick);
/* Wait until debug data ready and return pointer to it */
int GetDebugData(unsigned long *tick, unsigned long *size, void **buffer){
- int res = WaitDebugData(tick);
- if(res){
+ int wait_error = WaitDebugData(tick);
+ if(!wait_error){
*size = buffer_cursor - debug_buffer;
*buffer = debug_buffer;
}
- return res;
-}
-
+ return wait_error;
+}
+