summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2020-05-19 12:30:57 +0100
committerDaniel P. Berrangé <berrange@redhat.com>2020-05-22 11:32:55 +0100
commit38f3fa61400dc087266a49cdc2499bb39dcf9b9b (patch)
treead22ab80866b0da737660b9b9dc7cd3dc3c4cd2b /scripts
parent34204f992316611cf5105afb131f2f1054279660 (diff)
downloadlibvirt-38f3fa61400dc087266a49cdc2499bb39dcf9b9b.tar.gz
scripts: emit enum parameters in API build description
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 <macro name='LIBVIR_CHECK_VERSION' file='libvirt-common'> <macro name='VIR_COPY_CPUMAP' file='libvirt-domain'> ...snip... becomes <macro name='LIBVIR_CHECK_VERSION' file='libvirt-common' params='major,minor,micro'> <macro name='VIR_COPY_CPUMAP' file='libvirt-domain' params='cpumaps,maplen,vcpu,cpumap'> ...snip... Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/apibuild.py17
1 files 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")