doc: Generate geany-sciwrappers-gtkdoc.h along geany-gtkdoc.h

geany-sciwrappers-gtkdoc.h contains all scintilla_object_* methods. It is
intended that they are going to be exposed through a separate .gir file,
therefore a separate header makes things easier.

This is useful when you want scintlla-related stuff in a separate .gir file or
oarse it specially otherwise.

gen-api-gtkdoc.py: Add switch to write out scintilla_object methods
This commit is contained in:
Thomas Martitz 2016-03-05 21:45:22 +01:00
parent 1e911051ab
commit c3c67c96d4
4 changed files with 34 additions and 5 deletions

1
.gitignore vendored
View File

@ -112,6 +112,7 @@ Makefile.in
/doc/*.toc /doc/*.toc
/doc/reference /doc/reference
/doc/geany-gtkdoc.h /doc/geany-gtkdoc.h
/doc/geany-sciwrappers-gtkdoc.h
/doc/xml/ /doc/xml/
#----------------------------------------------------------------------- #-----------------------------------------------------------------------

View File

@ -850,7 +850,8 @@ RECURSIVE = NO
# Note that relative paths are relative to the directory from which doxygen is # Note that relative paths are relative to the directory from which doxygen is
# run. # run.
EXCLUDE = @top_srcdir@/doc/geany-gtkdoc.h EXCLUDE = @top_srcdir@/doc/geany-gtkdoc.h \
@top_srcdir@/doc/geany-sciwrappers-gtkdoc.h
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded # directories that are symbolic links (a Unix file system feature) are excluded

View File

@ -129,16 +129,19 @@ Doxyfile-gi.stamp: Doxyfile-gi Doxyfile.stamp $(doxygen_sources)
$(AM_V_GEN)$(DOXYGEN) Doxyfile-gi && echo "" > $@ $(AM_V_GEN)$(DOXYGEN) Doxyfile-gi && echo "" > $@
geany-gtkdoc.h: Doxyfile-gi.stamp $(top_srcdir)/scripts/gen-api-gtkdoc.py geany-gtkdoc.h: Doxyfile-gi.stamp $(top_srcdir)/scripts/gen-api-gtkdoc.py
$(AM_V_GEN)$(top_srcdir)/scripts/gen-api-gtkdoc.py xml -d $(builddir) -o $@ $(AM_V_GEN)$(top_srcdir)/scripts/gen-api-gtkdoc.py xml -d $(builddir) -o $@ \
--sci-output geany-sciwrappers-gtkdoc.h
geany-sciwrappers-gtkdoc.h: geany-gtkdoc.h
geany_gtkdocincludedir = $(includedir)/geany/gtkdoc geany_gtkdocincludedir = $(includedir)/geany/gtkdoc
nodist_geany_gtkdocinclude_HEADERS = geany-gtkdoc.h nodist_geany_gtkdocinclude_HEADERS = geany-gtkdoc.h geany-sciwrappers-gtkdoc.h
ALL_LOCAL_TARGETS += geany-gtkdoc.h ALL_LOCAL_TARGETS += geany-gtkdoc.h geany-sciwrappers-gtkdoc.h
CLEAN_LOCAL_TARGETS += clean-gtkdoc-header-local CLEAN_LOCAL_TARGETS += clean-gtkdoc-header-local
clean-gtkdoc-header-local: clean-gtkdoc-header-local:
-rm -rf xml/ Doxyfile-gi Doxyfile-gi.stamp geany-gtkdoc.h -rm -rf xml/ Doxyfile-gi Doxyfile-gi.stamp geany-gtkdoc.h geany-sciwrappers-gtkdoc.h
endif endif

View File

@ -341,6 +341,7 @@ class DoxyFunction(DoxyElement):
def main(args): def main(args):
xml_dir = None xml_dir = None
outfile = None outfile = None
scioutfile = None
parser = OptionParser(usage="usage: %prog [options] XML_DIR") parser = OptionParser(usage="usage: %prog [options] XML_DIR")
parser.add_option("--xmldir", metavar="DIRECTORY", help="Path to Doxygen-generated XML files", parser.add_option("--xmldir", metavar="DIRECTORY", help="Path to Doxygen-generated XML files",
@ -349,6 +350,8 @@ def main(args):
action="store", dest="outdir", default=".") action="store", dest="outdir", default=".")
parser.add_option("-o", "--output", metavar="FILE", help="Write output to FILE", parser.add_option("-o", "--output", metavar="FILE", help="Write output to FILE",
action="store", dest="outfile") action="store", dest="outfile")
parser.add_option("--sci-output", metavar="FILE", help="Write output to FILE (only sciwrappers)",
action="store", dest="scioutfile")
opts, args = parser.parse_args(args[1:]) opts, args = parser.parse_args(args[1:])
xml_dir = args[0] xml_dir = args[0]
@ -397,11 +400,25 @@ def main(args):
else: else:
outfile = sys.stdout outfile = sys.stdout
if (opts.scioutfile):
try:
scioutfile = open(opts.scioutfile, "w+")
except OSError as err:
sys.stderr.write("failed to open \"%s\" for writing (%s)\n" % (opts.scioutfile, err.strerror))
return 1
else:
scioutfile = outfile
try: try:
outfile.write("/*\n * Automatically generated file - do not edit\n */\n\n") outfile.write("/*\n * Automatically generated file - do not edit\n */\n\n")
outfile.write("#include \"gtkcompat.h\"\n") outfile.write("#include \"gtkcompat.h\"\n")
outfile.write("#include \"Scintilla.h\"\n") outfile.write("#include \"Scintilla.h\"\n")
outfile.write("#include \"ScintillaWidget.h\"\n") outfile.write("#include \"ScintillaWidget.h\"\n")
if (scioutfile != outfile):
scioutfile.write("/*\n * Automatically generated file - do not edit\n */\n\n")
scioutfile.write("#include \"gtkcompat.h\"\n")
scioutfile.write("#include \"Scintilla.h\"\n")
scioutfile.write("#include \"ScintillaWidget.h\"\n")
# write enums first, so typedefs to them are valid (as forward enum declaration # write enums first, so typedefs to them are valid (as forward enum declaration
# is invalid). It's fine as an enum can't contain reference to other types. # is invalid). It's fine as an enum can't contain reference to other types.
@ -423,6 +440,13 @@ def main(args):
outfile.write(e.to_gtkdoc()) outfile.write(e.to_gtkdoc())
outfile.write(e.definition) outfile.write(e.definition)
outfile.write("\n\n") outfile.write("\n\n")
if (e.name.startswith("sci_")):
if (scioutfile != outfile):
scioutfile.write("\n\n")
scioutfile.write(e.to_gtkdoc())
scioutfile.write(e.definition)
scioutfile.write("\n\n")
except BrokenPipeError: except BrokenPipeError:
# probably piped to head or tail # probably piped to head or tail
return 0 return 0