[Doxygen-users] Auto-link broken for filtered files?
Brought to you by:
dimitri
|
From: Leonardo P. S. <Leo...@on...> - 2019-08-22 18:48:13
|
Hello All!
I'm trying to fix some proprietary compiler directives by using a filter. I discovered that if I pass a file through a filter, the file documentation is generated correctly, but auto-linking seems broken!
I came up with a very simple example. My filter is implemented in Python and it just opens the file and prints every single line, it doesn't change anything. I confirmed this by comparing the filter's input and output (by redirection) with a diff and there are no differences at all.
I redirected the filter's output to a file called filtered_c.h. If I include this file as a source file, I get auto-link to work. If I pass the original header file through the filter, auto-linking is broken and I get a warning
latex_double.md:7: warning: unable to resolve reference to `some_c_function' for \ref command
If I comment out the FILTER_PATTERNS line in the Doxyfile, auto-linking works.
This is really an issue for me, as I'm also supporting parsing assembly files through a filter script and I see the same behavior there: the file documentation is perfect, but no auto-linking.
Any thoughts are very welcome! Thanks!
This is my Doxyfile:
# General options
PROJECT_NAME = "Double table headers in LaTeX"
INPUT = doc/latex_double.md
INPUT += include/regular_c.h
#INPUT += filtered_c.h
#You should not need to change the rest of the file
OUTPUT_DIRECTORY = output_doc
GENERATE_HTML = YES
GENERATE_TREEVIEW = YES
GENERATE_LATEX = YES
OPTIMIZE_OUTPUT_FOR_C = YES
FILTER_PATTERNS += *.h="c:\Python27\python filter\dummy_filter.py"
My filter is:
from __future__ import print_function
import sys
if len(sys.argv) != 2:
sys.exit(1)
def extract_globals(filename):
with open(filename, 'r') as infile:
for line in infile:
print(line, end='')
extract_globals(sys.argv[1])
My Markdown source is:
# Chapter Title {#chapter_title}
Some text here
# Introduction {#chapter_intro}
Loren Ipsum @ref some_c_function
And my header file is:
/**
* @file regular_c.h
* @brief This is a simple C header file with some examples.
*/
#ifndef REGULAR_C_H_
#define REGULAR_C_H_
/* ----------------------------------------------------------------------------
* If building with a C++ compiler, make all of the definitions in this header
* have a C binding.
* ------------------------------------------------------------------------- */
#ifdef __cplusplus
extern "C"
{
#endif /* ifdef __cplusplus */
/* ----------------------------------------------------------------------------
* Include files
* --------------------------------------------------------------------------*/
/* ----------------------------------------------------------------------------
* Defines
* --------------------------------------------------------------------------*/
/* ----------------------------------------------------------------------------
* Global variables and types
* --------------------------------------------------------------------------*/
/**
* This enumeration has the return codes for the @ref some_c_function function.
*/
typedef enum __SOME_C_FUNCTION_RETURN {
SOME_C_FUNCTION_RETURN_everthing_ok = 0, ///< Nothing to see here
SOME_C_FUNCTION_RETURN_some_weird_error, ///< This is not the error you're looking for
SOME_C_FUNCTION_RETURN_some_very_bad_error, ///< This is not the error we are looking for
SOME_C_FUNCTION_RETURN_life_is_sad_just_cope ///< Move along
} SOME_C_FUNCTION_RETURN;
/* ----------------------------------------------------------------------------
* Function prototype definitions
* --------------------------------------------------------------------------*/
/**
* @brief Some C function that is here just as an example.
*
* This function doesn't actually do anything useful.
*
* @param[in] v We do something with this value.
* @param[out] ptr Some value will be written here.
*
* @return Returns a value that depends on what happened:
* - @ref SOME_C_FUNCTION_RETURN_everthing_ok
* Uh, everything is under control. Situation normal.
* - @ref SOME_C_FUNCTION_RETURN_some_weird_error
* Uh, had a slight weapons malfunction.
* - @ref SOME_C_FUNCTION_RETURN_some_very_bad_error
* We had a reactor leak here now. Give us a few minutes to lock it down.
* Large leak... very dangerous.
* - @ref SOME_C_FUNCTION_RETURN_life_is_sad_just_cope
* Who is this?? What's your operating number?
*
*/
int some_c_function(uint32_t v, void* ptr);
/* ----------------------------------------------------------------------------
* Close the 'extern "C"' block
* ------------------------------------------------------------------------- */
#ifdef __cplusplus
}
#endif /* ifdef __cplusplus */
#endif /* REGULAR_C_H_ */
Any thoughts are very welcome! Thanks!
Regards,
____________________________________________________________
Leonardo Pereira Santos | ON Semiconductor
Design Engineer
200-611 Kumpf Dr | Waterloo, Ontario, Canada, N2N 1A8
519-884-9696 x2269 (O) | Leo...@on...<mailto:Leo...@on...>
|