Changeset c03d191 for python/lib/gen_code.py
- Timestamp:
- Nov 17, 2018, 10:19:27 PM (5 years ago)
- Branches:
- feature/constantq
- Children:
- d1d4ad4
- Parents:
- 088760e (diff), a114fe0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/gen_code.py
r088760e rc03d191 465 465 """.format(**self.__dict__) 466 466 for set_param in self.prototypes['set']: 467 params = get_params_types_names(set_param)[1] 468 paramtype = params['type'] 467 params = get_params_types_names(set_param)[1:] 468 param = self.shortname.split('_set_')[-1] 469 paramdecls = "".join([""" 470 {0} {1};""".format(p['type'], p['name']) for p in params]) 469 471 method_name = get_name(set_param) 470 472 param = method_name.split('aubio_'+self.shortname+'_set_')[-1] 471 pyparamtype = pyargparse_chars[paramtype] 473 refs = ", ".join(["&%s" % p['name'] for p in params]) 474 paramlist = ", ".join(["%s" % p['name'] for p in params]) 475 if len(params): 476 paramlist = "," + paramlist 477 pyparamtypes = ''.join([pyargparse_chars[p['type']] for p in params]) 472 478 out += """ 473 479 static PyObject * … … 475 481 {{ 476 482 uint_t err = 0; 477 {paramtype} {param}; 478 479 if (!PyArg_ParseTuple (args, "{pyparamtype}", &{param})) {{ 483 {paramdecls} 484 """.format(param = param, paramdecls = paramdecls, **self.__dict__) 485 486 if len(refs) and len(pyparamtypes): 487 out += """ 488 489 if (!PyArg_ParseTuple (args, "{pyparamtypes}", {refs})) {{ 480 490 return NULL; 481 491 }} 482 err = aubio_{shortname}_set_{param} (self->o, {param}); 492 """.format(pyparamtypes = pyparamtypes, refs = refs) 493 494 out += """ 495 err = aubio_{shortname}_set_{param} (self->o {paramlist}); 483 496 484 497 if (err > 0) {{ … … 495 508 Py_RETURN_NONE; 496 509 }} 497 """.format(param = param, paramtype = paramtype, pyparamtype = pyparamtype, **self.__dict__) 510 """.format(param = param, refs = refs, paramdecls = paramdecls, 511 pyparamtypes = pyparamtypes, paramlist = paramlist, **self.__dict__) 498 512 return out 499 513
Note: See TracChangeset
for help on using the changeset viewer.