Changeset c96e6c0


Ignore:
Timestamp:
Sep 16, 2017, 11:46:17 PM (7 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
Children:
e7556a1
Parents:
2bf59042
Message:

python/lib/gen_code.py: add support for rdo

Location:
python/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/lib/gen_code.py

    r2bf59042 rc96e6c0  
    193193            out += self.gen_del()
    194194            out += self.gen_do()
     195            if len(self.prototypes['rdo']):
     196                self.do_proto = self.prototypes['rdo'][0]
     197                self.do_inputs = [get_params_types_names(self.do_proto)[1]]
     198                self.do_outputs = get_params_types_names(self.do_proto)[2:]
     199                out += self.gen_do(method='rdo')
    195200            out += self.gen_memberdef()
    196201            out += self.gen_set()
     
    373378        return out
    374379
    375     def gen_do(self):
     380    def gen_do(self, method = 'do'):
    376381        out = """
    377382// do {shortname}
    378383static PyObject*
    379 Py_{shortname}_do  (Py_{shortname} * self, PyObject * args)
    380 {{""".format(**self.__dict__)
     384Pyaubio_{shortname}_{method}  (Py_{shortname} * self, PyObject * args)
     385{{""".format(**self.__dict__, method = method)
    381386        input_params = self.do_inputs
    382387        output_params = self.do_outputs
     
    518523  {{"{shortname}", (PyCFunction) Py{name},
    519524    METH_NOARGS, ""}},""".format(name = name, shortname = shortname)
     525        for m in self.prototypes['rdo']:
     526            name = get_name(m)
     527            shortname = name.replace('aubio_%s_' % self.shortname, '')
     528            out += """
     529  {{"{shortname}", (PyCFunction) Py{name},
     530    METH_VARARGS, ""}},""".format(name = name, shortname = shortname)
    520531        out += """
    521532  {NULL} /* sentinel */
     
    543554  0,
    544555  0,
    545   (ternaryfunc)Py_{shortname}_do,
     556  (ternaryfunc)Pyaubio_{shortname}_do,
    546557  0,
    547558  0,
  • python/lib/gen_external.py

    r2bf59042 rc96e6c0  
    182182            shortname = o[6:-2]  # without aubio_ prefix and _t suffix
    183183
    184         lib[shortname] = {'struct': [], 'new': [], 'del': [], 'do': [], 'get': [], 'set': [], 'other': []}
     184        lib[shortname] = {'struct': [], 'new': [], 'del': [], 'do': [], 'rdo': [], 'get': [], 'set': [], 'other': []}
    185185        lib[shortname]['longname'] = o
    186186        lib[shortname]['shortname'] = shortname
     
    196196                elif '_do' in fn:
    197197                    lib[shortname]['do'].append(fn)
     198                elif '_rdo' in fn:
     199                    lib[shortname]['rdo'].append(fn)
    198200                elif 'new_' in fn:
    199201                    lib[shortname]['new'].append(fn)
Note: See TracChangeset for help on using the changeset viewer.