doc: add Doxygen filter that adds docs to struct *method macros

Add an input filter that tries to link e.g.

 #define pw_core_add_listener(...) pw_core_method(c,add_listener,...)

to the corresponding declaration in struct pw_core_methods.
This commit is contained in:
Pauli Virtanen 2021-10-02 22:22:59 +03:00
parent 4cb24531b3
commit cd94eff5f2
3 changed files with 16 additions and 1 deletions

View file

@ -17,7 +17,7 @@ QUIET = YES
WARN_NO_PARAMDOC = YES
HAVE_DOT = @HAVE_DOT@
INPUT = @inputs@
FILTER_PATTERNS = "*.c=@c_input_filter@"
FILTER_PATTERNS = "*.c=@c_input_filter@" "*.h=@h_input_filter@"
FILE_PATTERNS = "*.h" "*.c"
RECURSIVE = YES
EXAMPLE_PATH = "@top_srcdir@/src/tools" \

14
doc/input-filter-h.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
#
# Doxygen input filter, which tries to fix documentation of callback
# method macros.
#
# This is used for .h files.
#
# Add \sa and \copydoc for (struct *methods) callback macros.
# #define pw_core_add_listener(...) pw_core_method(c,add_listener,...) -> add \sa and \copydoc
# #define spa_system_read(...) spa_system_method_r(c,read,...) -> add \sa and \copydoc
sed -e 's@^\(#define .*[[:space:]]\)\(.*_method\)\((.,[[:space:]]*\)\([a-z_]\+\)\(.*)[[:space:]]*\)$@\1\2\3\4\5 /**< \\copydoc \2s.\4\n\n\\sa \2s.\4 */@;' \
-e 's@^\(#define .*[[:space:]]\)\(.*_method\)\(_[rvs](.,[[:space:]]*\)\([a-z_]\+\)\(.*)[[:space:]]*\)$@\1\2\3\4\5 /**< \\copydoc \2s.\4\n\n\\sa \2s.\4 */@;' \
< "$1"

View file

@ -81,6 +81,7 @@ doxyfile_conf.set('inputs', ' '.join(inputs))
doxyfile_conf.set('cssfiles', ' '.join(cssfiles))
doxyfile_conf.set('path_prefixes', ' '.join(path_prefixes))
doxyfile_conf.set('c_input_filter', meson.source_root() / 'doc' / 'input-filter.sh')
doxyfile_conf.set('h_input_filter', meson.source_root() / 'doc' / 'input-filter-h.sh')
doxyfile = configure_file(input: 'Doxyfile.in',
output: 'Doxyfile',