From 38f3fa61400dc087266a49cdc2499bb39dcf9b9b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 19 May 2020 12:30:57 +0100 Subject: [PATCH] scripts: emit enum parameters in API build description MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Currently the information about enums in the API document lacks any mention of parameters, so it is impossible to tell what kind of enum declaration is present in the libvirt API header. With this change ...snip... becomes ...snip... Reviewed-by: Michal Privoznik Signed-off-by: Daniel P. Berrangé --- scripts/apibuild.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/apibuild.py b/scripts/apibuild.py index 68c588d8b6..9faf15a75e 100755 --- a/scripts/apibuild.py +++ b/scripts/apibuild.py @@ -1013,10 +1013,12 @@ class CParser: token[1][0] != '#'): lst.append(token[1]) token = self.lexer.token() - try: - name = name.split('(')[0] - except Exception: - pass + + paramStart = name.find("(") + params = None + if paramStart != -1: + params = name[paramStart+1:-1] + name = name[0:paramStart] # skip hidden macros if name in hidden_macros: @@ -1029,7 +1031,7 @@ class CParser: strValue = lst[0][1:-1] (args, desc) = self.parseMacroComment(name, not self.is_header) self.index_add(name, self.filename, not self.is_header, - "macro", (args, desc, strValue)) + "macro", (args, desc, params, strValue)) return token # @@ -2174,10 +2176,13 @@ class docBuilder: if id.info is None: args = [] desc = None + params = None strValue = None else: - (args, desc, strValue) = id.info + (args, desc, params, strValue) = id.info + if params is not None: + output.write(" params='%s'" % params) if strValue is not None: output.write(" string='%s'" % strValue) output.write(">\n") -- 2.47.2