Changeset 6203a70 for python/lib/gen_code.py
- Timestamp:
- Sep 15, 2018, 6:30:42 PM (6 years ago)
- Branches:
- feature/constantq
- Children:
- 45c2c5c
- Parents:
- 81fe7d30 (diff), 8c4918a (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
r81fe7d30 r6203a70 85 85 'filterbank': 'self->n_filters', 86 86 'tss': 'self->buf_size', 87 'dct': 'self->size', 87 88 'constantq': 'aubio_constantq_get_numbins (self->o)', 88 89 } … … 180 181 self.do_outputs = get_params_types_names(self.do_proto)[2:] 181 182 struct_output_str = ["PyObject *{0[name]}; {1} c_{0[name]}".format(i, i['type'][:-1]) for i in self.do_outputs] 183 if len(self.prototypes['rdo']): 184 rdo_outputs = get_params_types_names(prototypes['rdo'][0])[2:] 185 struct_output_str += ["PyObject *{0[name]}; {1} c_{0[name]}".format(i, i['type'][:-1]) for i in rdo_outputs] 186 self.outputs += rdo_outputs 182 187 self.struct_outputs = ";\n ".join(struct_output_str) 183 188 … … 194 199 out += self.gen_del() 195 200 out += self.gen_do() 201 if len(self.prototypes['rdo']): 202 self.do_proto = self.prototypes['rdo'][0] 203 self.do_inputs = [get_params_types_names(self.do_proto)[1]] 204 self.do_outputs = get_params_types_names(self.do_proto)[2:] 205 out += self.gen_do(method='rdo') 196 206 out += self.gen_memberdef() 197 207 out += self.gen_set() … … 374 384 return out 375 385 376 def gen_do(self ):386 def gen_do(self, method = 'do'): 377 387 out = """ 378 388 // do {shortname} 379 389 static PyObject* 380 Py _{shortname}_do(Py_{shortname} * self, PyObject * args)381 {{""".format( **self.__dict__)390 Pyaubio_{shortname}_{method} (Py_{shortname} * self, PyObject * args) 391 {{""".format(method = method, **self.__dict__) 382 392 input_params = self.do_inputs 383 393 output_params = self.do_outputs … … 519 529 {{"{shortname}", (PyCFunction) Py{name}, 520 530 METH_NOARGS, ""}},""".format(name = name, shortname = shortname) 531 for m in self.prototypes['rdo']: 532 name = get_name(m) 533 shortname = name.replace('aubio_%s_' % self.shortname, '') 534 out += """ 535 {{"{shortname}", (PyCFunction) Py{name}, 536 METH_VARARGS, ""}},""".format(name = name, shortname = shortname) 521 537 out += """ 522 538 {NULL} /* sentinel */ … … 544 560 0, 545 561 0, 546 (ternaryfunc)Py _{shortname}_do,562 (ternaryfunc)Pyaubio_{shortname}_do, 547 563 0, 548 564 0,
Note: See TracChangeset
for help on using the changeset viewer.