From: Martin Ling Date: Fri, 1 Aug 2014 19:08:44 +0000 (+0100) Subject: bindings: Transfer C++ method parameter documentation to Python/Java bindings. X-Git-Tag: libsigrok-0.4.0~1162 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=5cad31c708b50329a27f31c7df0f67dddea6ce5a;p=libsigrok.git bindings: Transfer C++ method parameter documentation to Python/Java bindings. --- diff --git a/bindings/swig/doc.py b/bindings/swig/doc.py index 16cc1652..10b0494e 100644 --- a/bindings/swig/doc.py +++ b/bindings/swig/doc.py @@ -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"'