diff options
author | Mark W. Eichin <eichin@thok.org> | 2009-04-16 04:43:50 +0000 |
---|---|---|
committer | Mark W. Eichin <eichin@thok.org> | 2009-04-16 04:43:50 +0000 |
commit | 0aea3fbd83491c5a57e98d18ebe682505b0978f4 (patch) | |
tree | c103a05197e43c799761c59fc11e15fc42e129e7 /lib/zephyr_tests.py | |
parent | 94661ad2d0b4a042d55c6e0e2cc4284ec216f0d9 (diff) |
wrap ZMakeAscii
clone it too
test the wrapper against the clone
fix typo in description
add todos
add future-coverage list
Diffstat (limited to 'lib/zephyr_tests.py')
-rwxr-xr-x | lib/zephyr_tests.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/zephyr_tests.py b/lib/zephyr_tests.py index 041c2de..12864e0 100755 --- a/lib/zephyr_tests.py +++ b/lib/zephyr_tests.py @@ -325,6 +325,7 @@ class libZephyr(object): "ZExpandRealm", "ZOpenPort", "ZClosePort", + "ZMakeAscii", ] def __init__(self, library_path=None): """connect to the library and build the wrappers""" @@ -405,9 +406,30 @@ class libZephyr(object): POINTER(c_ushort), # port ] + # Code_t + # ZMakeAscii(register char *ptr, + # int len, + # unsigned char *field, + # int num) + self.ZMakeAscii.argtypes = [ + c_char_p, # ptr + c_int, # len + c_char_p, # field; c_uchar_p? + c_int, # num + ] + + # library-specific setup... self.ZInitialize() +def py_make_ascii(input): + """reference ZMakeAscii expressed as python...""" + hexes = ["%02X" % ord(ch) for ch in input] + output = [] + for i in range(0, len(hexes), 4): + output.append("0x" + "".join(hexes[i:i+4])) + return " ".join(output) + |