Fix Doxygen generation instead of working around incorrect output

Make Doxygen ignore `G_{BEGIN,END}_DECLS` and `GEANY_API_SYMBOL` itself
instead of stripping those manually when parsing the XML output.

This makes Doxygen parsing more robust by ignoring some odd C syntax,
and also improves the HTML version removing some incorrect C code
references.
This commit is contained in:
Colomban Wendling 2016-03-01 16:34:05 +01:00
parent 6f79a94cec
commit 9ce7c22ad7
2 changed files with 7 additions and 4 deletions

View File

@ -2035,7 +2035,10 @@ INCLUDE_FILE_PATTERNS =
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = "G_GNUC_PRINTF(x,y)=" \
G_BEGIN_DECLS= \
G_END_DECLS= \
HAVE_PLUGINS \
GEANY_API_SYMBOL= \
GEANY_FUNCTIONS_H
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this

View File

@ -281,7 +281,7 @@ class DoxyTypedef(DoxyElement):
@staticmethod
def from_memberdef(xml):
name = xml.find("name").text
d = normalize_text(xml.find("definition").text).replace("G_BEGIN_DECLS", "")
d = normalize_text(xml.find("definition").text)
d += ";"
return DoxyTypedef(name, d)
@ -338,9 +338,9 @@ class DoxyFunction(DoxyElement):
@staticmethod
def from_memberdef(xml):
name = xml.find("name").text
d = normalize_text(xml.find("definition").text.replace("G_BEGIN_DECLS", ""))
d = normalize_text(xml.find("definition").text)
d += " " + xml.find("argsstring").text + ";"
d = normalize_text(d.replace("GEANY_API_SYMBOL", ""))
d = normalize_text(d)
e = DoxyFunction(name, d)
e.add_brief(xml.find("briefdescription"))
@ -385,7 +385,7 @@ def main(args):
for f in h_files:
if not (f.find("compoundname").text.endswith("private.h")):
for n0 in f.xpath(".//*/memberdef[@kind='typedef' and @prot='public']"):
if not (n0.find("type").text.replace("G_BEGIN_DECLS", "").lstrip().startswith("enum")):
if not (n0.find("type").text.startswith("enum")):
e = DoxyTypedef.from_memberdef(n0)
typedefs.append(e)