From: Paul Brossier Date: Tue, 4 Dec 2018 01:42:17 +0000 (+0100) Subject: [py] use macro in docstring of generated objects macro if defined X-Git-Tag: 0.4.9~131 X-Git-Url: https://git.aubio.org/?p=aubio.git;a=commitdiff_plain;h=6342fd14614588d5e0cf5d6889769a9fc9fb39e4;hp=1030a7b2ca99071b54fe00146467c4b5b5dd0c0e [py] use macro in docstring of generated objects macro if defined --- diff --git a/python/lib/gen_code.py b/python/lib/gen_code.py index a29a23fb..b48f9a04 100644 --- a/python/lib/gen_code.py +++ b/python/lib/gen_code.py @@ -231,11 +231,21 @@ typedef struct{{ return out.format(do_inputs_list = do_inputs_list, **self.__dict__) def gen_doc(self): + sig = [] + for p in self.input_params: + name = p['name'] + defval = aubiodefvalue[name].replace('"','\\\"') + sig.append("{name}={defval}".format(defval=defval, name=name)) out = """ -// TODO: add documentation -static char Py_{shortname}_doc[] = \"undefined\"; +#ifndef PYAUBIO_{shortname}_doc +#define PYAUBIO_{shortname}_doc "{shortname}({sig})" +#endif /* PYAUBIO_{shortname}_doc */ + +static char Py_{shortname}_doc[] = "" +PYAUBIO_{shortname}_doc +""; """ - return out.format(**self.__dict__) + return out.format(sig=', '.join(sig), **self.__dict__) def gen_new(self): out = """