Skip to content

Commit

Permalink
cleaned up wrapper code
Browse files Browse the repository at this point in the history
  • Loading branch information
forrestv committed Oct 10, 2011
1 parent 373a875 commit f93c831
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions dds.py
Expand Up @@ -60,10 +60,7 @@ def __getattr__(self, attr):
@apply
class DDSUInt(object):
def __getattr__(self, attr):
#help(_ddsc_lib)
#print "XXX", attr, ctypes.cast(getattr(_ddsc_lib, 'DDS_' + attr), ctypes.POINTER(ctypes.c_ulong)).contents, ctypes.cast(getattr(_ddsc_lib, 'DDS_' + attr), ctypes.POINTER(ctypes.c_uint)).contents
contents = ctypes.cast(getattr(_ddsc_lib, 'DDS_' + attr), ctypes.POINTER(ctypes.c_uint)).contents
#print attr, contents
setattr(self, attr, contents)
return contents

Expand All @@ -74,13 +71,13 @@ def __getattr__(self, attr):

def g(self2, attr2):
f = getattr(DDSFunc, attr + '_' + attr2)
def p(*args):
def m(*args):
return f(self2, *args)
setattr(self2, attr2, p)
return p
setattr(self2, attr2, m)
return m
# make structs dynamically present bound methods
contents.__getattr__ = g
# takes advantage of POINTERs being cached to make type pointers do the same
# take advantage of POINTERs being cached to make type pointers do the same
ctypes.POINTER(contents).__getattr__ = g

setattr(self, attr, contents)
Expand Down

0 comments on commit f93c831

Please sign in to comment.