Ignore:
Timestamp:
Nov 17, 2018, 10:19:27 PM (2 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/constantq
Children:
d1d4ad4
Parents:
088760e (diff), a114fe0 (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

    r088760e rc03d191  
    465465""".format(**self.__dict__)
    466466        for set_param in self.prototypes['set']:
    467             params = get_params_types_names(set_param)[1]
    468             paramtype = params['type']
     467            params = get_params_types_names(set_param)[1:]
     468            param = self.shortname.split('_set_')[-1]
     469            paramdecls = "".join(["""
     470   {0} {1};""".format(p['type'], p['name']) for p in params])
    469471            method_name = get_name(set_param)
    470472            param = method_name.split('aubio_'+self.shortname+'_set_')[-1]
    471             pyparamtype = pyargparse_chars[paramtype]
     473            refs = ", ".join(["&%s" % p['name'] for p in params])
     474            paramlist = ", ".join(["%s" % p['name'] for p in params])
     475            if len(params):
     476                paramlist = "," + paramlist
     477            pyparamtypes = ''.join([pyargparse_chars[p['type']] for p in params])
    472478            out += """
    473479static PyObject *
     
    475481{{
    476482  uint_t err = 0;
    477   {paramtype} {param};
    478 
    479   if (!PyArg_ParseTuple (args, "{pyparamtype}", &{param})) {{
     483  {paramdecls}
     484""".format(param = param, paramdecls = paramdecls, **self.__dict__)
     485
     486            if len(refs) and len(pyparamtypes):
     487                out += """
     488
     489  if (!PyArg_ParseTuple (args, "{pyparamtypes}", {refs})) {{
    480490    return NULL;
    481491  }}
    482   err = aubio_{shortname}_set_{param} (self->o, {param});
     492""".format(pyparamtypes = pyparamtypes, refs = refs)
     493
     494            out += """
     495  err = aubio_{shortname}_set_{param} (self->o {paramlist});
    483496
    484497  if (err > 0) {{
     
    495508  Py_RETURN_NONE;
    496509}}
    497 """.format(param = param, paramtype = paramtype, pyparamtype = pyparamtype, **self.__dict__)
     510""".format(param = param, refs = refs, paramdecls = paramdecls,
     511        pyparamtypes = pyparamtypes, paramlist = paramlist, **self.__dict__)
    498512        return out
    499513
Note: See TracChangeset for help on using the changeset viewer.