Changes in python/lib/gen_code.py [21067f9:9b23815e]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/gen_code.py
r21067f9 r9b23815e 463 463 """.format(**self.__dict__) 464 464 for set_param in self.prototypes['set']: 465 params = get_params_types_names(set_param)[1:] 466 param = self.shortname.split('_set_')[-1] 467 paramdecls = "".join([""" 468 {0} {1};""".format(p['type'], p['name']) for p in params]) 465 params = get_params_types_names(set_param)[1] 466 paramtype = params['type'] 469 467 method_name = get_name(set_param) 470 468 param = method_name.split('aubio_'+self.shortname+'_set_')[-1] 471 refs = ", ".join(["&%s" % p['name'] for p in params]) 472 paramlist = ", ".join(["%s" % p['name'] for p in params]) 473 if len(params): 474 paramlist = "," + paramlist 475 pyparamtypes = ''.join([pyargparse_chars[p['type']] for p in params]) 469 pyparamtype = pyargparse_chars[paramtype] 476 470 out += """ 477 471 static PyObject * … … 479 473 {{ 480 474 uint_t err = 0; 481 {paramdecls} 482 """.format(param = param, paramdecls = paramdecls, **self.__dict__) 483 484 if len(refs) and len(pyparamtypes): 485 out += """ 486 487 if (!PyArg_ParseTuple (args, "{pyparamtypes}", {refs})) {{ 475 {paramtype} {param}; 476 477 if (!PyArg_ParseTuple (args, "{pyparamtype}", &{param})) {{ 488 478 return NULL; 489 479 }} 490 """.format(pyparamtypes = pyparamtypes, refs = refs) 491 492 out += """ 493 err = aubio_{shortname}_set_{param} (self->o {paramlist}); 480 err = aubio_{shortname}_set_{param} (self->o, {param}); 494 481 495 482 if (err > 0) {{ … … 506 493 Py_RETURN_NONE; 507 494 }} 508 """.format(param = param, refs = refs, paramdecls = paramdecls, 509 pyparamtypes = pyparamtypes, paramlist = paramlist, **self.__dict__) 495 """.format(param = param, paramtype = paramtype, pyparamtype = pyparamtype, **self.__dict__) 510 496 return out 511 497
Note: See TracChangeset
for help on using the changeset viewer.