shithub: aubio

Download patch

ref: 6342fd14614588d5e0cf5d6889769a9fc9fb39e4
parent: 1030a7b2ca99071b54fe00146467c4b5b5dd0c0e
author: Paul Brossier <piem@piem.org>
date: Mon Dec 3 21:42:17 EST 2018

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

--- a/python/lib/gen_code.py
+++ b/python/lib/gen_code.py
@@ -231,11 +231,21 @@
         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 = """