Skip to content

Commit

Permalink
Add html docs for printing C API
Browse files Browse the repository at this point in the history
  • Loading branch information
PatKamin committed Dec 14, 2023
1 parent 4a9c972 commit 4e50fe6
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/generate_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def generate_rst(docpath, section, namespace, tags, ver, rev, specs, meta):
fout = os.path.join(dstpath, "api.rst")
groupname = os.path.basename(dstpath).capitalize()
util.makoWrite(fin, fout,
namespace=namespace,
groupname=groupname,
ver=ver,
rev=rev,
Expand Down
65 changes: 65 additions & 0 deletions scripts/templates/api_listing.mako
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,68 @@ ${th.make_type_name(n, tags, obj)}
%endfor # obj in objects
%endfor # s in specs
#################################################################
## Print API not part of the spec, needs to be generated separately
#################################################################
<%
x = tags['$x']
%>
## Generate Print links table
Print
============================================================
* Functions
%for s in specs:
%for obj in s['objects']:
%if re.match(r"enum", obj['type']) or re.match(r"struct", obj['type']):
* :ref:`${th.make_func_name_with_prefix(f'{x}Print', obj['name'])}`
%endif
%endfor # obj in objects
%endfor # s in specs
## Params of functions objects
%for tbl in th.get_pfncbtables(specs, meta, namespace, tags):
%for obj in tbl['functions']:
<%
name = th.make_pfncb_param_type(namespace, tags, obj)
%>\
* :ref:`${th.make_func_name_with_prefix(f'{x}Print', name)}`
%endfor
%endfor
## 'Extras' functions
* :ref:`${x}PrintFunctionParams`
<%def name="generate_api_doc(func_name)">\
.. _${func_name.replace("_", "-")}:
${func_name}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. doxygenfunction:: ${func_name}
:project: UnifiedRuntime
</%def>
## Generate Print API documentation
Print Functions
------------------------------------------------------------------------------
%for s in specs:
%for obj in s['objects']:
%if re.match(r"enum", obj['type']) or re.match(r"struct", obj['type']):
<%
func_name = th.make_func_name_with_prefix(f'{x}Print', obj['name'])
%>
${generate_api_doc(func_name)}
%endif
%endfor # obj in objects
%endfor # s in specs
%for tbl in th.get_pfncbtables(specs, meta, namespace, tags):
%for obj in tbl['functions']:
<%
name = th.make_pfncb_param_type(namespace, tags, obj)
func_name = th.make_func_name_with_prefix(f'{x}Print', name)
%>
${generate_api_doc(func_name)}
%endfor
%endfor
## 'Extras' functions
${generate_api_doc(f'{x}PrintFunctionParams')}

0 comments on commit 4e50fe6

Please sign in to comment.