]> sigrok.org Git - libsigrok.git/commitdiff
bindings: Transfer C++ method parameter documentation to Python/Java bindings.
authorMartin Ling <redacted>
Fri, 1 Aug 2014 19:08:44 +0000 (20:08 +0100)
committerUwe Hermann <redacted>
Sun, 10 Aug 2014 13:47:14 +0000 (15:47 +0200)
bindings/swig/doc.py

index 16cc16520e03ed84021d7ecd991ad5102aa6bad6..10b0494e0970e098447cda4f950789ced7279854 100644 (file)
@@ -50,10 +50,26 @@ for compound in index.findall('compound'):
         for function in section.findall('memberdef'):
             function_name = function.find('name').text
             brief = get_text(function.find('briefdescription'))
+            parameters = {}
+            for para in function.find('detaileddescription').findall('para'):
+                paramlist = para.find('parameterlist')
+                if paramlist is not None:
+                    for param in paramlist.findall('parameteritem'):
+                        namelist = param.find('parameternamelist')
+                        name = namelist.find('parametername').text
+                        description = get_text(param.find('parameterdescription'))
+                        if description:
+                            parameters[name] = description
             if brief:
                 if language == 'python':
-                    print '%%feature("docstring") %s::%s "%s";' % (
-                        class_name, function_name, brief)
+                    print str.join('\n', [
+                        '%%feature("docstring") %s::%s "%s' % (
+                            class_name, function_name, brief)] + [
+                        '@param %s %s' % (name, desc)
+                            for name, desc in parameters.items()]) + '";'
                 elif language == 'java':
-                    print '%%javamethodmodifiers %s::%s "/** %s */\npublic"' % (
-                    class_name, function_name, brief)
+                    print str.join('\n', [
+                        '%%javamethodmodifiers %s::%s "/** %s' % (
+                            class_name, function_name, brief)] + [
+                        '   * @param %s %s' % (name, desc)
+                            for name, desc in parameters.items()]) + ' */\npublic"'