From 9ce7c22ad74c0d706bf857477c421320b1c9941e Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 1 Mar 2016 16:34:05 +0100 Subject: [PATCH] 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. --- doc/Doxyfile.in | 3 +++ scripts/gen-api-gtkdoc.py | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index c5464d294..2b799e7ce 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -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 diff --git a/scripts/gen-api-gtkdoc.py b/scripts/gen-api-gtkdoc.py index f50dbf9be..e235d43af 100755 --- a/scripts/gen-api-gtkdoc.py +++ b/scripts/gen-api-gtkdoc.py @@ -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)