diff -r c02818d7e29f -r 7e61baa047f0 targets/typemapping.py --- a/targets/typemapping.py Mon Aug 14 22:30:41 2017 +0300 +++ b/targets/typemapping.py Mon Aug 14 23:27:15 2017 +0300 @@ -30,6 +30,7 @@ from ctypes import * from datetime import timedelta as td + class IEC_STRING(Structure): """ Must be changed according to changes in iec_types.h @@ -37,6 +38,7 @@ _fields_ = [("len", c_uint8), ("body", c_char * 126)] + class IEC_TIME(Structure): """ Must be changed according to changes in iec_types.h @@ -44,7 +46,10 @@ _fields_ = [("s", c_long), #tv_sec ("ns", c_long)] #tv_nsec + def _t(t, u=lambda x:x.value, p=lambda t,x:t(x)): return (t, u, p) + + def _ttime(): return (IEC_TIME, lambda x:td(0, x.s, x.ns/1000), lambda t,x:t(x.days * 24 * 3600 + x.seconds, x.microseconds*1000)) @@ -86,6 +91,7 @@ # Construct debugger natively supported types DebugTypesSize = dict([(key,sizeof(t)) for key,(t,p,u) in SameEndianessTypeTranslator.iteritems() if t is not None]) + def UnpackDebugBuffer(buff, indexes): res = [] buffoffset = 0