Ignore:
Timestamp:
Dec 4, 2018, 2:42:17 AM (6 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:
521b9ad
Parents:
1030a7b
Message:

[py] use macro in docstring of generated objects macro if defined

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/lib/gen_code.py

    r1030a7b r6342fd1  
    232232
    233233    def gen_doc(self):
    234         out = """
    235 // TODO: add documentation
    236 static char Py_{shortname}_doc[] = \"undefined\";
     234        sig = []
     235        for p in self.input_params:
     236            name = p['name']
     237            defval = aubiodefvalue[name].replace('"','\\\"')
     238            sig.append("{name}={defval}".format(defval=defval, name=name))
     239        out = """
     240#ifndef PYAUBIO_{shortname}_doc
     241#define PYAUBIO_{shortname}_doc "{shortname}({sig})"
     242#endif /* PYAUBIO_{shortname}_doc */
     243
     244static char Py_{shortname}_doc[] = ""
     245PYAUBIO_{shortname}_doc
     246"";
    237247"""
    238         return out.format(**self.__dict__)
     248        return out.format(sig=', '.join(sig), **self.__dict__)
    239249
    240250    def gen_new(self):
Note: See TracChangeset for help on using the changeset viewer.