shithub: aubio

Download patch

ref: 0b2643bbfebb7b369724bdfbd2c090efbc1cfe39
parent: e717faeed725b108c3a6bc1206707ef6c7b5b4a1
author: Martin Hermant <martin.hermant@gmail.com>
date: Mon May 29 15:12:40 EDT 2017

gen_external.py :
	fix wrong longname in generate_lib_from_c_declarations
	simplify parsing

wscript.py : add _t suffix for added objects

--- a/python/lib/gen_external.py
+++ b/python/lib/gen_external.py
@@ -174,27 +174,22 @@
     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)
--- a/wscript
+++ b/wscript
@@ -242,7 +242,7 @@
         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]