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