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 Oct 26, 2023
1 parent f78c440 commit edf2805
Show file tree
Hide file tree
Showing 2 changed files with 63 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
62 changes: 62 additions & 0 deletions scripts/templates/api_listing.mako
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,65 @@ ${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
#################################################################
## 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('urPrint', 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('urPrint', name)}`
%endfor
%endfor
## 'Extras' functions
* :ref:`urPrintFunctionParams`
<%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('urPrint', 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('urPrint', name)
%>
${generate_api_doc(func_name)}
%endfor
%endfor
## 'Extras' functions
${generate_api_doc('urPrintFunctionParams')}

0 comments on commit edf2805

Please sign in to comment.