Showing the changes to python/lib/gen_code.py (1 of 1 file). Show all
Unified · Split
| @@ -470,6 +470,8 @@ Pyaubio_{shortname}_{method} (Py_{shortname} * self, PyObject * args) · 469 unmodified lines | |||
| 470 | param = method_name.split('aubio_'+self.shortname+'_set_')[-1] | 470 | param = method_name.split('aubio_'+self.shortname+'_set_')[-1] |
| 471 | refs = ", ".join(["&%s" % p['name'] for p in params]) | 471 | refs = ", ".join(["&%s" % p['name'] for p in params]) |
| 472 | paramlist = ", ".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 | ||
| 473 | pyparamtypes = ''.join([pyargparse_chars[p['type']] for p in params]) | 475 | pyparamtypes = ''.join([pyargparse_chars[p['type']] for p in params]) |
| 474 | out += """ | 476 | out += """ |
| 475 | static PyObject * | 477 | static PyObject * |
| @@ -477,11 +479,18 @@ Pyaubio_{shortname}_set_{param} (Py_{shortname} *self, PyObject *args) · 1 unmodified line | |||
| 477 | {{ | 479 | {{ |
| 478 | uint_t err = 0; | 480 | uint_t err = 0; |
| 479 | {paramdecls} | 481 | {paramdecls} |
| 482 | """.format(param = param, paramdecls = paramdecls, **self.__dict__) | ||
| 483 | |||
| 484 | if len(refs) and len(pyparamtypes): | ||
| 485 | out += """ | ||
| 480 | 486 | ||
| 481 | if (!PyArg_ParseTuple (args, "{pyparamtypes}", {refs})) {{ | 487 | if (!PyArg_ParseTuple (args, "{pyparamtypes}", {refs})) {{ |
| 482 | return NULL; | 488 | return NULL; |
| 483 | }} | 489 | }} |
| 484 | err = aubio_{shortname}_set_{param} (self->o, {paramlist}); | 490 | """.format(pyparamtypes = pyparamtypes, refs = refs) |
| 491 | |||
| 492 | out += """ | ||
| 493 | err = aubio_{shortname}_set_{param} (self->o {paramlist}); | ||
| 485 | 494 | ||
| 486 | if (err > 0) {{ | 495 | if (err > 0) {{ |
| 487 | if (PyErr_Occurred() == NULL) {{ | 496 | if (PyErr_Occurred() == NULL) {{ |