libsel4: Generate doxygen tag for error element

Translate "error" elements into "retval" doxygen comment tags when
generating object invocation stubs.

Signed-off-by: Jimmy Brush <code@jimmah.com>
This commit is contained in:
Jimmy Brush 2021-08-24 07:18:50 -04:00 committed by Gerwin Klein
parent 238c6b8da2
commit ae197ad146
2 changed files with 12 additions and 1 deletions

View file

@ -930,6 +930,17 @@ def parse_xml_file(input_file, valid_types):
else:
comment_lines.append("@return @xmlonly <errorenumdesc/> @endxmlonly")
for error in method.getElementsByTagName("error"):
error_name = error.getAttribute("name")
error_description = error.getAttribute("description")
if not error_description:
error_description_element = error.getElementsByTagName("description")
if error_description_element:
error_description_text = get_xml_element_content_with_xmlonly(
error_description_element[0])
error_description = normalise_text(error_description_text)
comment_lines.append("@retval %s %s " % (error_name, error_description))
# split each line on newlines
comment_lines = reduce(operator.add, [l.split("\n") for l in comment_lines], [])

View file

@ -154,7 +154,7 @@ class Generator(object):
params[str(n.text)] = {"type": param_type}
param_order.append(str(n.text))
param_items = parent.find_all("parameteritem")
param_items = parent.find_all(lambda e: e.name == "parameteritem" and e.parent["kind"] == "param")
for param_item in param_items:
param_name_node = param_item.find("parametername")
param_desc_node = param_item.find("parameterdescription")