Hello all,
After studying the process_source_files.py
script in the Doxygen folder, I came up with this little snippet of code that can parse a module header for documented preprocessor defines:
def process_preprocessor_defines (file_contents):
config_token = "/** Config:"
preprocessor_defines = []
while file_contents:
idx = file_contents.find (config_token)
if (idx < 0):
break
file_contents = file_contents[idx+len(config_token):]
preprocessor_defines.append (file_contents[:file_contents.find ("*/")])
return preprocessor_defines
It can easily be integrated like so:
prepoc_defines = process_preprocessor_defines(file_contents)
# Create a Doxygen group definition for the module.
module_definiton = []
module_definiton.append("/** @defgroup {n} {n}".format(n=module_name))
module_definiton.append(" {d}".format(d=short_description))
module_definiton.append("")
for line in detail_lines:
module_definiton.append(" - {l}".format(l=line))
if (prepoc_defines):
module_definiton.append ("")
module_definiton.append ("Preprocessor configuration flags:")
for preproc_definition in prepoc_defines:
module_definiton.append (" - {l}".format (l=preproc_definition))
module_definiton.append("")
module_definiton.append(" @{")
module_definiton.append("*/")
Here is what the output looks like: Lemons: lemons_core
I think this could be a really beneficial addition to JUCE’s documentation - I hope this is helpful!