From 0b2643bbfebb7b369724bdfbd2c090efbc1cfe39 Mon Sep 17 00:00:00 2001 From: Martin Hermant Date: Mon, 29 May 2017 19:12:40 -0400 Subject: [PATCH] gen_external.py : fix wrong longname in generate_lib_from_c_declarations simplify parsing wscript.py : add _t suffix for added objects --- python/lib/gen_external.py | 21 ++++++++------------- wscript | 2 +- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/python/lib/gen_external.py b/python/lib/gen_external.py index f50f8d24..c8ab1744 100644 --- a/python/lib/gen_external.py +++ b/python/lib/gen_external.py @@ -174,27 +174,22 @@ def generate_lib_from_c_declarations(cpp_objects, c_declarations): lib = {} for o in cpp_objects: - shortname = '' + shortname = o if o[:6] == 'aubio_': - shortname = o[6:-2] # without aubio_ - longname = o[:-2] # without _t - else: # support object not starting with aubio_ (fvec...) - shortname = o - longname = shortname + shortname = o[6:-2] # without aubio_ prefix and _t suffix if shortname in skip_objects: continue + lib[shortname] = {'struct': [], 'new': [], 'del': [], 'do': [], 'get': [], 'set': [], 'other': []} - lib[shortname]['longname'] = longname + lib[shortname]['longname'] = o lib[shortname]['shortname'] = shortname + fullshortname = o[:-2] # name without _t suffix + for fn in c_declarations: - func_name = fn.split('(')[0].strip().split(' ')[1:] - if func_name: - func_name = func_name[-1] - else: - raise NameError('Warning : error while parsing : unexpected line %s' % fn) - if func_name.startswith(longname + '_') or func_name.endswith(longname): + func_name = fn.split('(')[0].strip().split(' ')[-1] + if func_name.startswith(fullshortname + '_') or func_name.endswith(fullshortname): # print "found", shortname, "in", fn if 'typedef struct ' in fn: lib[shortname]['struct'].append(fn) diff --git a/wscript b/wscript index d1ab97c1..18905e61 100644 --- a/wscript +++ b/wscript @@ -242,7 +242,7 @@ def configure(ctx): from python.lib.gen_external import get_c_declarations,get_cpp_objects_from_c_declarations,get_all_func_names_from_lib,generate_lib_from_c_declarations c_decls = get_c_declarations(usedouble=False) #emscripten can't use double objects = get_cpp_objects_from_c_declarations(c_decls) - objects+=['fvec'] + objects+=['fvec_t'] lib = generate_lib_from_c_declarations(objects,c_decls) exported_funcnames = get_all_func_names_from_lib(lib) c_mangled_names = ['_'+s for s in exported_funcnames] -- 2.11.0