From fd95d2ec8b0160657709f1655887739191f33932 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Thu, 4 Aug 2016 11:24:17 +0200 Subject: Handle C API declarations done in multiple lines Signed-off-by: Szczepan Zalega --- unittest/test_bindings.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/unittest/test_bindings.py b/unittest/test_bindings.py index d65eeaf..fa78409 100644 --- a/unittest/test_bindings.py +++ b/unittest/test_bindings.py @@ -30,10 +30,13 @@ def C(request): with open(fp, 'r') as f: declarations = f.readlines() - for declaration in declarations: + a = iter(declarations) + for declaration in a: # extern int NK_write_totp_slot(int slot_number, char* secret, int time_window); - if 'extern' in declaration and not '"C"' in declaration: + 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) -- cgit v1.2.3