From 0aea3fbd83491c5a57e98d18ebe682505b0978f4 Mon Sep 17 00:00:00 2001 From: "Mark W. Eichin" Date: Thu, 16 Apr 2009 04:43:50 +0000 Subject: wrap ZMakeAscii clone it too test the wrapper against the clone fix typo in description add todos add future-coverage list --- lib/zephyr_tests.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'lib/zephyr_tests.py') 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) + -- cgit v1.2.3