From 01815bc90f80a6c3cd58a731577c24a21ea0096c Mon Sep 17 00:00:00 2001 From: _ <_> Date: Tue, 24 Apr 2018 19:25:26 -0700 Subject: [PATCH] Added demonstration of design --- bindings/py3devil1.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bindings/py3devil1.py b/bindings/py3devil1.py index d20cf1c..82bb2a0 100755 --- a/bindings/py3devil1.py +++ b/bindings/py3devil1.py @@ -12,6 +12,12 @@ class PldHeader(ctypes.Structure): ("offsets", ctypes.POINTER(ctypes.c_int)) ] + def getoffsets(self): + pyoffsets = [] + for i in range(0, self.numOffset): + pyoffsets.append(self.offsets[i]) + return pyoffsets + class Devil1PLD_FN(ctypes.Structure): _fields_ = [ ("getheader" , ctypes.CFUNCTYPE( @@ -232,11 +238,8 @@ if __name__ == "__main__": data = f.read() devil1pld.getheader(ctypes.byref(pldheader), data) devil1pld.printheader(ctypes.byref(pldheader)) - print(pldheader) - print(pldheader.numOffset) - print(pldheader.offsets) - for i in range(0, pldheader.numOffset): - print(hex(pldheader.offsets[i])) + for offset in pldheader.getoffsets(): + print(hex(offset)) def textest(devil1tex, texheader): with open("pl01.pld_1.txp", "rb") as f: