Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/lib/gen_code.py

    r21067f9 r9b23815e  
    463463""".format(**self.__dict__)
    464464        for set_param in self.prototypes['set']:
    465             params = get_params_types_names(set_param)[1:]
    466             param = self.shortname.split('_set_')[-1]
    467             paramdecls = "".join(["""
    468    {0} {1};""".format(p['type'], p['name']) for p in params])
     465            params = get_params_types_names(set_param)[1]
     466            paramtype = params['type']
    469467            method_name = get_name(set_param)
    470468            param = method_name.split('aubio_'+self.shortname+'_set_')[-1]
    471             refs = ", ".join(["&%s" % p['name'] for p in params])
    472             paramlist = ", ".join(["%s" % p['name'] for p in params])
    473             if len(params):
    474                 paramlist = "," + paramlist
    475             pyparamtypes = ''.join([pyargparse_chars[p['type']] for p in params])
     469            pyparamtype = pyargparse_chars[paramtype]
    476470            out += """
    477471static PyObject *
     
    479473{{
    480474  uint_t err = 0;
    481   {paramdecls}
    482 """.format(param = param, paramdecls = paramdecls, **self.__dict__)
    483 
    484             if len(refs) and len(pyparamtypes):
    485                 out += """
    486 
    487   if (!PyArg_ParseTuple (args, "{pyparamtypes}", {refs})) {{
     475  {paramtype} {param};
     476
     477  if (!PyArg_ParseTuple (args, "{pyparamtype}", &{param})) {{
    488478    return NULL;
    489479  }}
    490 """.format(pyparamtypes = pyparamtypes, refs = refs)
    491 
    492             out += """
    493   err = aubio_{shortname}_set_{param} (self->o {paramlist});
     480  err = aubio_{shortname}_set_{param} (self->o, {param});
    494481
    495482  if (err > 0) {{
     
    506493  Py_RETURN_NONE;
    507494}}
    508 """.format(param = param, refs = refs, paramdecls = paramdecls,
    509         pyparamtypes = pyparamtypes, paramlist = paramlist, **self.__dict__)
     495""".format(param = param, paramtype = paramtype, pyparamtype = pyparamtype, **self.__dict__)
    510496        return out
    511497
Note: See TracChangeset for help on using the changeset viewer.