Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/lib/gen_code.py

    rce79a9e ra2ed169  
    33    'buf_size': 'Py_default_vector_length',
    44    'win_s': 'Py_default_vector_length',
     5    'size': 'Py_default_vector_length',
    56    # and here too
    67    'hop_size': 'Py_default_vector_length / 2',
     
    8384        'filterbank': 'self->n_filters',
    8485        'tss': 'self->buf_size',
     86        'dct': 'self->size',
    8587        }
    8688
     
    177179        self.do_outputs = get_params_types_names(self.do_proto)[2:]
    178180        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
    179185        self.struct_outputs = ";\n    ".join(struct_output_str)
    180186
     
    191197            out += self.gen_del()
    192198            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')
    193204            out += self.gen_memberdef()
    194205            out += self.gen_set()
     
    371382        return out
    372383
    373     def gen_do(self):
     384    def gen_do(self, method = 'do'):
    374385        out = """
    375386// do {shortname}
    376387static PyObject*
    377 Py_{shortname}_do  (Py_{shortname} * self, PyObject * args)
    378 {{""".format(**self.__dict__)
     388Pyaubio_{shortname}_{method}  (Py_{shortname} * self, PyObject * args)
     389{{""".format(method = method, **self.__dict__)
    379390        input_params = self.do_inputs
    380391        output_params = self.do_outputs
     
    516527  {{"{shortname}", (PyCFunction) Py{name},
    517528    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)
    518535        out += """
    519536  {NULL} /* sentinel */
     
    541558  0,
    542559  0,
    543   (ternaryfunc)Py_{shortname}_do,
     560  (ternaryfunc)Pyaubio_{shortname}_do,
    544561  0,
    545562  0,
Note: See TracChangeset for help on using the changeset viewer.