wscript.py : add _t suffix for added objects
Unified · Split
| @@ -174,27 +174,22 @@ def generate_lib_from_c_declarations(cpp_objects, c_declarations): · 173 unmodified lines | |||
| 174 | lib = {} | 174 | lib = {} |
| 175 | 175 | ||
| 176 | for o in cpp_objects: | 176 | for o in cpp_objects: |
| 177 | shortname = '' | 177 | shortname = o |
| 178 | if o[:6] == 'aubio_': | 178 | if o[:6] == 'aubio_': |
| 179 | shortname = o[6:-2] # without aubio_ | 179 | shortname = o[6:-2] # without aubio_ prefix and _t suffix |
| 180 | longname = o[:-2] # without _t | ||
| 181 | else: # support object not starting with aubio_ (fvec...) | ||
| 182 | shortname = o | ||
| 183 | longname = shortname | ||
| 184 | 180 | ||
| 185 | if shortname in skip_objects: | 181 | if shortname in skip_objects: |
| 186 | continue | 182 | continue |
| 183 | |||
| 187 | lib[shortname] = {'struct': [], 'new': [], 'del': [], 'do': [], 'get': [], 'set': [], 'other': []} | 184 | lib[shortname] = {'struct': [], 'new': [], 'del': [], 'do': [], 'get': [], 'set': [], 'other': []} |
| 188 | lib[shortname]['longname'] = longname | 185 | lib[shortname]['longname'] = o |
| 189 | lib[shortname]['shortname'] = shortname | 186 | lib[shortname]['shortname'] = shortname |
| 190 | 187 | ||
| 188 | fullshortname = o[:-2] # name without _t suffix | ||
| 189 | |||
| 191 | for fn in c_declarations: | 190 | for fn in c_declarations: |
| 192 | func_name = fn.split('(')[0].strip().split(' ')[1:] | 191 | func_name = fn.split('(')[0].strip().split(' ')[-1] |
| 193 | if func_name: | 192 | if func_name.startswith(fullshortname + '_') or func_name.endswith(fullshortname): |
| 194 | func_name = func_name[-1] | ||
| 195 | else: | ||
| 196 | raise NameError('Warning : error while parsing : unexpected line %s' % fn) | ||
| 197 | if func_name.startswith(longname + '_') or func_name.endswith(longname): | ||
| 198 | # print "found", shortname, "in", fn | 193 | # print "found", shortname, "in", fn |
| 199 | if 'typedef struct ' in fn: | 194 | if 'typedef struct ' in fn: |
| 200 | lib[shortname]['struct'].append(fn) | 195 | lib[shortname]['struct'].append(fn) |
| @@ -242,7 +242,7 @@ def configure(ctx): · 241 unmodified lines | |||
| 242 | 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 | 242 | 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 |
| 243 | c_decls = get_c_declarations(usedouble=False) #emscripten can't use double | 243 | c_decls = get_c_declarations(usedouble=False) #emscripten can't use double |
| 244 | objects = get_cpp_objects_from_c_declarations(c_decls) | 244 | objects = get_cpp_objects_from_c_declarations(c_decls) |
| 245 | objects+=['fvec'] | 245 | objects+=['fvec_t'] |
| 246 | lib = generate_lib_from_c_declarations(objects,c_decls) | 246 | lib = generate_lib_from_c_declarations(objects,c_decls) |
| 247 | exported_funcnames = get_all_func_names_from_lib(lib) | 247 | exported_funcnames = get_all_func_names_from_lib(lib) |
| 248 | c_mangled_names = ['_'+s for s in exported_funcnames] | 248 | c_mangled_names = ['_'+s for s in exported_funcnames] |