aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-06-30 18:22:03 -0400
committerDavid Robillard <d@drobilla.net>2021-06-30 18:22:03 -0400
commitfd1766701adda261199682adf0c9ec5b8d106485 (patch)
treea9c522884d63779c989f6cc7687e6491d39481bc /scripts
parentfee16e0a6f73c3a6fb252d690539404fac9abc30 (diff)
downloadserd-fd1766701adda261199682adf0c9ec5b8d106485.tar.gz
serd-fd1766701adda261199682adf0c9ec5b8d106485.tar.bz2
serd-fd1766701adda261199682adf0c9ec5b8d106485.zip
dox_to_sphinx.py: Show macro parameter names in prototype
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dox_to_sphinx.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/scripts/dox_to_sphinx.py b/scripts/dox_to_sphinx.py
index de56510c..6058d0dd 100755
--- a/scripts/dox_to_sphinx.py
+++ b/scripts/dox_to_sphinx.py
@@ -197,6 +197,9 @@ def link_markup(index, lang, refid):
if kind in ["class", "enum", "struct", "typedef", "union"]:
return ":%s:`%s`" % (role, name)
+ if kind == "define":
+ return ":%s:macro:`%s`" % (lang, name)
+
if kind == "function":
return ":%s:func:`%s`" % (lang, name)
@@ -427,7 +430,16 @@ def read_definition_doc(index, lang, root):
assert kind in ["function", "typedef", "variable"]
record["type"] = plain_text(member.find("type"))
- if kind == "enum":
+ if kind == "define":
+ if member.find('param') is not None:
+ param_names = []
+ for param in member.findall('param'):
+ defname = param.find('defname')
+ param_names += [defname.text] if defname is not None else []
+
+ record["prototype"] = "%s(%s)" % (record["name"], ', '.join(param_names))
+
+ elif kind == "enum":
for value in member.findall("enumvalue"):
set_descriptions(
index, lang, value, index[value.get("id")]
@@ -481,7 +493,9 @@ def declaration_string(record):
if "template_params" in record:
result = "template <%s> " % record["template_params"]
- if kind == "function":
+ if kind == "define" and "prototype" in record:
+ result += record["prototype"]
+ elif kind == "function":
result += record["prototype"]
elif kind == "typedef":
result += record["definition"]