Changes in python/lib/gen_code.py [ce79a9e:a2ed169]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/gen_code.py
rce79a9e ra2ed169 3 3 'buf_size': 'Py_default_vector_length', 4 4 'win_s': 'Py_default_vector_length', 5 'size': 'Py_default_vector_length', 5 6 # and here too 6 7 'hop_size': 'Py_default_vector_length / 2', … … 83 84 'filterbank': 'self->n_filters', 84 85 'tss': 'self->buf_size', 86 'dct': 'self->size', 85 87 } 86 88 … … 177 179 self.do_outputs = get_params_types_names(self.do_proto)[2:] 178 180 struct_output_str = ["PyObject *{0[name]}; {1} c_{0[name]}".format(i, i['type'][:-1]) for i in self.do_outputs] 181 if len(self.prototypes['rdo']): 182 rdo_outputs = get_params_types_names(prototypes['rdo'][0])[2:] 183 struct_output_str += ["PyObject *{0[name]}; {1} c_{0[name]}".format(i, i['type'][:-1]) for i in rdo_outputs] 184 self.outputs += rdo_outputs 179 185 self.struct_outputs = ";\n ".join(struct_output_str) 180 186 … … 191 197 out += self.gen_del() 192 198 out += self.gen_do() 199 if len(self.prototypes['rdo']): 200 self.do_proto = self.prototypes['rdo'][0] 201 self.do_inputs = [get_params_types_names(self.do_proto)[1]] 202 self.do_outputs = get_params_types_names(self.do_proto)[2:] 203 out += self.gen_do(method='rdo') 193 204 out += self.gen_memberdef() 194 205 out += self.gen_set() … … 371 382 return out 372 383 373 def gen_do(self ):384 def gen_do(self, method = 'do'): 374 385 out = """ 375 386 // do {shortname} 376 387 static PyObject* 377 Py _{shortname}_do(Py_{shortname} * self, PyObject * args)378 {{""".format( **self.__dict__)388 Pyaubio_{shortname}_{method} (Py_{shortname} * self, PyObject * args) 389 {{""".format(method = method, **self.__dict__) 379 390 input_params = self.do_inputs 380 391 output_params = self.do_outputs … … 516 527 {{"{shortname}", (PyCFunction) Py{name}, 517 528 METH_NOARGS, ""}},""".format(name = name, shortname = shortname) 529 for m in self.prototypes['rdo']: 530 name = get_name(m) 531 shortname = name.replace('aubio_%s_' % self.shortname, '') 532 out += """ 533 {{"{shortname}", (PyCFunction) Py{name}, 534 METH_VARARGS, ""}},""".format(name = name, shortname = shortname) 518 535 out += """ 519 536 {NULL} /* sentinel */ … … 541 558 0, 542 559 0, 543 (ternaryfunc)Py _{shortname}_do,560 (ternaryfunc)Pyaubio_{shortname}_do, 544 561 0, 545 562 0,
Note: See TracChangeset
for help on using the changeset viewer.