Ignore:
Timestamp:
Sep 15, 2018, 6:30:42 PM (6 years ago)
Author:
Paul Brossier <piem@piem.org>
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.
Message:

Merge branch 'master' into feature/constantq

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/lib/gen_code.py

    r81fe7d30 r6203a70  
    8585        'filterbank': 'self->n_filters',
    8686        'tss': 'self->buf_size',
     87        'dct': 'self->size',
    8788        'constantq': 'aubio_constantq_get_numbins (self->o)',
    8889        }
     
    180181        self.do_outputs = get_params_types_names(self.do_proto)[2:]
    181182        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
    182187        self.struct_outputs = ";\n    ".join(struct_output_str)
    183188
     
    194199            out += self.gen_del()
    195200            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')
    196206            out += self.gen_memberdef()
    197207            out += self.gen_set()
     
    374384        return out
    375385
    376     def gen_do(self):
     386    def gen_do(self, method = 'do'):
    377387        out = """
    378388// do {shortname}
    379389static PyObject*
    380 Py_{shortname}_do  (Py_{shortname} * self, PyObject * args)
    381 {{""".format(**self.__dict__)
     390Pyaubio_{shortname}_{method}  (Py_{shortname} * self, PyObject * args)
     391{{""".format(method = method, **self.__dict__)
    382392        input_params = self.do_inputs
    383393        output_params = self.do_outputs
     
    519529  {{"{shortname}", (PyCFunction) Py{name},
    520530    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)
    521537        out += """
    522538  {NULL} /* sentinel */
     
    544560  0,
    545561  0,
    546   (ternaryfunc)Py_{shortname}_do,
     562  (ternaryfunc)Pyaubio_{shortname}_do,
    547563  0,
    548564  0,
Note: See TracChangeset for help on using the changeset viewer.