Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor opaque type handling.

  • Loading branch information...
commit 6b204fe55b05348e736e0bd295cd4ec92ec535e5 1 parent 0b0cd76
Peter Johnson PeterJohnson authored
Showing with 9 additions and 4 deletions.
  1. +8 −0 ctypes_core_prefix.py
  2. +1 −4 gen_wrap.py
8 ctypes_core_prefix.py
View
@@ -124,3 +124,11 @@ def from_param(cls, obj):
raise ValueError("Cannot mix enumeration members")
return ctypes.c_uint(obj.value)
+#
+# Memory Managed Types
+#
+class Disposed(ctypes.c_void_p):
+ def __del__(self):
+ if self.value != 0:
+ imaqDispose(self)
+
5 gen_wrap.py
View
@@ -86,10 +86,7 @@ def block_comment(self, comment):
print("#"*78, file=self.out)
def opaque_struct(self, name):
- print("class %s(ctypes.c_void_p):" % name, file=self.out)
- print(" def __del__(self):", file=self.out)
- print(" if self.value != 0:", file=self.out)
- print(" imaqDispose(self)", file=self.out)
+ print("class %s(Disposed): pass" % name, file=self.out)
def define(self, name, value, comment):
if name in exclude:
Please sign in to comment.
Something went wrong with that request. Please try again.