aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-08-05 18:23:04 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-05 20:32:45 +0200
commita579c6906f9f7fe6e19c70a44f74c0d2148c8085 (patch)
tree62fc5f5af737736ec583cc43883cf78dc1329b7f /README.md
parent2befc01bbdd43f7a1a97b9e39df53ba3ff25c25f (diff)
downloadlibnitrokey-a579c6906f9f7fe6e19c70a44f74c0d2148c8085.tar.gz
libnitrokey-a579c6906f9f7fe6e19c70a44f74c0d2148c8085.tar.bz2
Bindings example update
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'README.md')
-rw-r--r--README.md9
1 files changed, 6 insertions, 3 deletions
diff --git a/README.md b/README.md
index 5a3df26..4e3a4e6 100644
--- a/README.md
+++ b/README.md
@@ -44,13 +44,16 @@ get_string = ffi.string
def get_library():
fp = 'NK_C_API.h' # path to C API header
- declarations = []
+ declarations = []
with open(fp, 'r') as f:
declarations = f.readlines()
- for declaration in declarations:
- if 'extern' in declaration and not '"C"' in declaration:
+ a = iter(declarations)
+ for declaration in a:
+ if declaration.startswith('extern') and not '"C"' in declaration:
declaration = declaration.replace('extern', '').strip()
+ while not ';' in declaration:
+ declaration += (next(a)).strip()
# print(declaration)
ffi.cdef(declaration)