提交 38f3fa61 编写于 作者: D Daniel P. Berrangé

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: NMichal Privoznik <mprivozn@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 34204f99
......@@ -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")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册