ref: 567483350d0cc48533800ec5d4acc89c67de284d
parent: 15a43e083b1bbddd09066420a064f7b0a18064a4
author: Martin Hermant <martin.hermant@gmail.com>
date: Mon May 29 09:31:18 EDT 2017
gen_external.py : support parsing of non aubio_ function : fvec and stuffs
--- a/python/lib/gen_external.py
+++ b/python/lib/gen_external.py
@@ -129,17 +129,29 @@
lib = {}
for o in cpp_objects:
- if o[:6] != 'aubio_':
- continue
- shortname = o[6:-2]
+ shortname = ''
+ 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
+
if shortname in skip_objects:
continue
lib[shortname] = {'struct': [], 'new': [], 'del': [], 'do': [], 'get': [], 'set': [], 'other': []}
lib[shortname]['longname'] = o
lib[shortname]['shortname'] = shortname
+ valid_funcname_part = ['_'+longname,longname+'_']
+
for fn in cpp_output:
- if o[:-1] in fn:
- #print "found", o[:-1], "in", fn
+ 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 any(x in func_name for x in valid_funcname_part):
+ # print "found", shortname, "in", fn
if 'typedef struct ' in fn:
lib[shortname]['struct'].append(fn)
elif '_do' in fn: