[GTK] Generate API documentation for GObject DOM bindings
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Oct 2013 10:33:26 +0000 (10:33 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Oct 2013 10:33:26 +0000 (10:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121538

Reviewed by Gustavo Noronha Silva.

.:

* GNUmakefile.am: Initialize gdom_symbol_files variable.

Source/WebCore:

* bindings/gobject/GNUmakefile.am: Add a explicit rule for all
.symbols file making them depend on the corresponding header file,
since the .symbols file is generated by the bindings generator.

Tools:

The .symbols file that is now generated for checking GObject DOM
bindings API compatibility while building can also be used to
generate the files needed to produce the gtk-doc
documentation. The new script generate-webkitdom-doc-files can
generate the docs.sgml and sections.txt files from the given list
of .symbols files.

* gtk/GNUmakefile.am: Add rules to generate webkitdomgtk-docs.sgml
and webkitdomgtk-sections.txt as well as rules to install the
generated WebKitDOMGTK documentation.
* gtk/generate-gtkdoc:
(webkitdom_docs_html_path): New helper function that returns the
path where the DOM API documentation has been generated.
(get_webkit2_options): Include DOM API docs to the list of xref
dependencies.
(get_webkit1_options): Ditto.
(get_webkitdom_options): Return the gtk-doc options to generate
the DOM API docs.
(get_webkitdom_options.derived_sources_path):
(get_webkitdom_options.src_path):
* gtk/generate-webkitdom-doc-files: Added.
(WebKitDOMDocGenerator):
(WebKitDOMDocGenerator.write_header):
(WebKitDOMDocGenerator.write_section):
(WebKitDOMDocGenerator.write_footer):
(WebKitDOMDocGeneratorDocs):
(WebKitDOMDocGeneratorDocs.write_header):
(write_section):
(write_footer):
(WebKitDOMDocGeneratorSections):
(WebKitDOMDocGeneratorSections.__init__):
(WebKitDOMDocGeneratorSections._dom_class):
(WebKitDOMDocGeneratorSections._dom_class_decamelize):
(WebKitDOMDocGeneratorSections._symbol_list):
(WebKitDOMDocGeneratorSections.write_section):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157630 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
GNUmakefile.am
Source/WebCore/ChangeLog
Source/WebCore/bindings/gobject/GNUmakefile.am
Tools/ChangeLog
Tools/gtk/GNUmakefile.am
Tools/gtk/generate-gtkdoc
Tools/gtk/generate-webkitdom-doc-files [new file with mode: 0755]

index f7b6fa6..6d4dfa8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-10-18  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] Generate API documentation for GObject DOM bindings
+        https://bugs.webkit.org/show_bug.cgi?id=121538
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * GNUmakefile.am: Initialize gdom_symbol_files variable.
+
 2013-10-17  Afonso R. Costa Jr.  <afonso.costa@samsung.com>
 
         [CMAKE] Update code to take advantage of CMake version 2.8.3+.
index 78d89e5..9af8e03 100644 (file)
@@ -122,6 +122,7 @@ DOMAIN :=
 DISTCLEANFILES :=
 MAINTAINERCLEANFILES :=
 pkgconfig_DATA :=
+gdom_symbol_files :=
 
 if ENABLE_INTROSPECTION
 gir_DATA :=
@@ -287,3 +288,7 @@ if ENABLE_WEBKIT2
        @-cp ./Documentation/webkit2gtk/tmpl/*.sgml $(distdir)/Documentation/webkit2gtk/tmpl
        @cp ./Documentation/webkit2gtk/html/* $(distdir)/Documentation/webkit2gtk/html
 endif
+       @mkdir -p $(distdir)/Documentation/webkitdomgtk/html
+       @mkdir -p $(distdir)/Documentation/webkitdomgtk/tmpl
+       @-cp ./Documentation/webkitdomgtk/tmpl/*.sgml $(distdir)/Documentation/webkitdomgtk/tmpl
+       @cp ./Documentation/webkitdomgtk/html/* $(distdir)/Documentation/webkitdomgtk/html
\ No newline at end of file
index bd34572..463700f 100644 (file)
@@ -1,3 +1,14 @@
+2013-10-18  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] Generate API documentation for GObject DOM bindings
+        https://bugs.webkit.org/show_bug.cgi?id=121538
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * bindings/gobject/GNUmakefile.am: Add a explicit rule for all
+        .symbols file making them depend on the corresponding header file,
+        since the .symbols file is generated by the bindings generator.
+
 2013-10-18  Mario Sanchez Prada  <mario.prada@samsung.com>
 
         [ATK] Simplify implementation of atk_text_get_text
index f3e2eb7..4789f9b 100644 (file)
@@ -475,7 +475,7 @@ DerivedSources/webkitdom/webkitdomdefines.h: $(WebCore)/bindings/scripts/gobject
        $(AM_V_GEN)echo $(gdom_class_list) | $(PERL) $< defines > $@
 
 noinst_DATA += DerivedSources/webkitdom/webkitdom.symbols
-gdom_symbol_files := $(patsubst %.h,%.symbols, $(filter DerivedSources/webkitdom/WebKitDOM%.h, $(webkitgtk_gdom_built_h_api)))
+gdom_symbol_files += $(patsubst %.h,%.symbols, $(filter DerivedSources/webkitdom/WebKitDOM%.h, $(webkitgtk_gdom_built_h_api)))
 
 $(top_builddir)/DerivedSources/webkitdom/WebKitDOMObject.symbols: $(WebCore)/bindings/gobject/WebKitDOMObject.symbols
        $(AM_V_GEN)cp -f $< $@
@@ -486,6 +486,9 @@ $(top_builddir)/DerivedSources/webkitdom/WebKitDOMEventTarget.symbols: $(WebCore
 $(top_builddir)/DerivedSources/webkitdom/WebKitDOMCustom.symbols: $(WebCore)/bindings/gobject/WebKitDOMCustom.symbols
        $(AM_V_GEN)cp -f $< $@
 
+DerivedSources/webkitdom/WebKitDOM%.symbols: DerivedSources/webkitdom/WebKitDOM%.h
+       @true
+
 DerivedSources/webkitdom/webkitdom.symbols: $(gdom_symbol_files) $(WebCore)/bindings/gobject/webkitdom.symbols $(WebCore)/bindings/scripts/gobject-run-api-break-test
        $(AM_V_GEN)cat $(gdom_symbol_files) > gdom-gen-symbols \
        && $(PYTHON) $(WebCore)/bindings/scripts/gobject-run-api-break-test $(WebCore)/bindings/gobject/webkitdom.symbols gdom-gen-symbols \
index 00cf749..be6bfd4 100644 (file)
@@ -1,3 +1,46 @@
+2013-10-18  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] Generate API documentation for GObject DOM bindings
+        https://bugs.webkit.org/show_bug.cgi?id=121538
+
+        Reviewed by Gustavo Noronha Silva.
+
+        The .symbols file that is now generated for checking GObject DOM
+        bindings API compatibility while building can also be used to
+        generate the files needed to produce the gtk-doc
+        documentation. The new script generate-webkitdom-doc-files can
+        generate the docs.sgml and sections.txt files from the given list
+        of .symbols files.
+
+        * gtk/GNUmakefile.am: Add rules to generate webkitdomgtk-docs.sgml
+        and webkitdomgtk-sections.txt as well as rules to install the
+        generated WebKitDOMGTK documentation.
+        * gtk/generate-gtkdoc:
+        (webkitdom_docs_html_path): New helper function that returns the
+        path where the DOM API documentation has been generated.
+        (get_webkit2_options): Include DOM API docs to the list of xref
+        dependencies.
+        (get_webkit1_options): Ditto.
+        (get_webkitdom_options): Return the gtk-doc options to generate
+        the DOM API docs.
+        (get_webkitdom_options.derived_sources_path):
+        (get_webkitdom_options.src_path):
+        * gtk/generate-webkitdom-doc-files: Added.
+        (WebKitDOMDocGenerator):
+        (WebKitDOMDocGenerator.write_header):
+        (WebKitDOMDocGenerator.write_section):
+        (WebKitDOMDocGenerator.write_footer):
+        (WebKitDOMDocGeneratorDocs):
+        (WebKitDOMDocGeneratorDocs.write_header):
+        (write_section):
+        (write_footer):
+        (WebKitDOMDocGeneratorSections):
+        (WebKitDOMDocGeneratorSections.__init__):
+        (WebKitDOMDocGeneratorSections._dom_class):
+        (WebKitDOMDocGeneratorSections._dom_class_decamelize):
+        (WebKitDOMDocGeneratorSections._symbol_list):
+        (WebKitDOMDocGeneratorSections.write_section):
+
 2013-10-17  Alex Christensen  <achristensen@webkit.org>
 
         Run JavaScriptCore tests again on Windows.
index 1cada03..eaadb06 100644 (file)
@@ -2,6 +2,7 @@ EXTRA_DIST += \
        Tools/gtk/common.py \
        Tools/gtk/generate-feature-defines-files \
        Tools/gtk/generate-gtkdoc \
+       Tools/gtk/generate-webkitdom-doc-files \
        Tools/gtk/gtkdoc.py
 
 docs: docs-build.stamp
@@ -25,6 +26,23 @@ docs_build_stamp_list += \
        Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
 endif
 
+$(top_builddir)/DerivedSources/webkitdom/docs/webkitdomgtk-docs.sgml: $(gdom_symbol_files) $(srcdir)/Tools/gtk/generate-webkitdom-doc-files
+       $(AM_V_GEN)mkdir -p $(top_builddir)/DerivedSources/webkitdom/docs \
+       && echo $(gdom_symbol_files) | $(PYTHON) $(srcdir)/Tools/gtk/generate-webkitdom-doc-files docs > $@
+
+$(top_builddir)/DerivedSources/webkitdom/docs/webkitdomgtk-sections.txt: $(gdom_symbol_files) $(srcdir)/Tools/gtk/generate-webkitdom-doc-files
+       $(AM_V_GEN)mkdir -p $(top_builddir)/DerivedSources/webkitdom/docs \
+       && echo $(gdom_symbol_files) | $(PYTHON) $(srcdir)/Tools/gtk/generate-webkitdom-doc-files sections > $@
+
+BUILT_SOURCES += \
+       $(top_builddir)/DerivedSources/webkitdom/docs/webkitdomgtk-docs.sgml \
+       $(top_builddir)/DerivedSources/webkitdom/docs/webkitdomgtk-sections.txt
+
+docs_build_stamp_list += \
+       libGObjectDOMBindings.la \
+       $(top_builddir)/DerivedSources/webkitdom/docs/webkitdomgtk-docs.sgml \
+       $(top_builddir)/DerivedSources/webkitdom/docs/webkitdomgtk-sections.txt
+
 docs-build.stamp: $(docs_build_stamp_list)
        CC=$(CC) $(srcdir)/Tools/gtk/generate-gtkdoc
        @touch docs-build.stamp
@@ -33,12 +51,14 @@ clean-local: doc-clean-local
 doc-clean-local:
        @rm -f Documentation/webkitgtk/*~ Documentation/webkitgtk*.bak
        @rm -f Documentation/webkit2gtk/*~ Documentation/webkit2gtk*.bak
+       @rm -f Documentation/webkitdomgtk/*~ Documentation/webkitdomgtk*.bak
+
 distclean-local: doc-distclean-local
 doc-distclean-local:
        @rm -rf Documentation
 maintainer-clean-local: doc-maintainer-clean-local
 doc-maintainer-clean-local: clean
-       @rm -rf Documentation/webkitgtk Documentation/webkit2gtk
+       @rm -rf Documentation/webkitgtk Documentation/webkit2gtk Documentation/webkitdomgtk
        -@rmdir Documentation
 
 install-data-local:
@@ -86,6 +106,26 @@ if ENABLE_WEBKIT2
          fi; \
        fi
 endif
+       @installfiles=`echo ./Documentation/webkitdomgtk/html/*`; \
+       if test "$$installfiles" = './Documentation/webkitdomgtk/html/*'; \
+       then echo 1>&2 'No documentation to install' ; \
+       else \
+         DOC_MODULE_VERSION=`cat ./Documentation/webkitdomgtk/version.xml`; \
+         if test -n "$(DOC_MODULE_VERSION)"; then \
+           installdir="$(DESTDIR)$(HTML_DIR)/webkitdomgtk-$(DOC_MODULE_VERSION)"; \
+         else \
+           installdir="$(DESTDIR)$(HTML_DIR)/webkitdomgtk"; \
+         fi; \
+         $(mkinstalldirs) $${installdir} ; \
+         for i in $$installfiles; do \
+           echo ' $(INSTALL_DATA) '$$i ; \
+           $(INSTALL_DATA) $$i $${installdir}; \
+         done; \
+         if test -n "$(DOC_MODULE_VERSION)"; then \
+           mv -f $${installdir}/webkitdomgtk.devhelp2 \
+             $${installdir}/webkitdomgtk-$(DOC_MODULE_VERSION).devhelp2; \
+         fi; \
+       fi
 if ENABLE_GTK_DOC
        @$(AM_V_GEN) PKG_CONFIG=$(PKG_CONFIG) $(PYTHON) $(srcdir)/Tools/gtk/generate-gtkdoc --rebase --virtual-root=$${DESTDIR}
 endif
@@ -109,7 +149,13 @@ if ENABLE_WEBKIT2
        fi; \
        rm -rf $${installdir}
 endif
-
+       @DOC_MODULE_VERSION=`cat ./Documentation/webkitdomgtk/version.xml`; \
+       if test -n "$(DOC_MODULE_VERSION)"; then \
+         installdir="$(DESTDIR)$(HTML_DIR)/webkitdomgtk-$(DOC_MODULE_VERSION)"; \
+       else \
+         installdir="$(DESTDIR)$(HTML_DIR)/webkitdomgtk"; \
+       fi; \
+       rm -rf $${installdir}
 if ENABLE_GTK_DOC
 noinst_DATA += docs-build.stamp
 endif
index 7b98172..70afd60 100755 (executable)
@@ -72,6 +72,9 @@ def get_common_xref_deps():
         'gdk-pixbuf-2.0': ['gdk-pixbuf']
     }
 
+def webkitdom_docs_html_path():
+    return common.build_path('Documentation', 'webkitdomgtk', 'html')
+
 def get_webkit2_options():
     def derived_sources_path(*args):
         return common.build_path(*(('DerivedSources', 'WebKit2') + args))
@@ -96,7 +99,7 @@ def get_webkit2_options():
                    ' -I' + derived_sources_path('include') + \
                    ' -I' + common.top_level_path('Source') + \
                    ' -I' + src_path(),
-        'cross_reference_deps' : get_gtkdoc_module_paths(xref_deps),
+        'cross_reference_deps' : get_gtkdoc_module_paths(xref_deps) + [webkitdom_docs_html_path()],
         'ignored_files': glob.glob(src_path('*Private.h')) + \
                          glob.glob(injected_bundle_src_path('*Private.h')) + \
                          glob.glob(src_path('*Client*')) + \
@@ -136,13 +139,35 @@ def get_webkit1_options(gtk_version):
                    ' -I' + src_path() + \
                    ' -I' + common.top_level_path('Source') + \
                    ' -I' + common.top_level_path('Source', 'JavaScriptCore', 'ForwardingHeaders'),
-        'cross_reference_deps' : get_gtkdoc_module_paths(xref_deps),
+        'cross_reference_deps' : get_gtkdoc_module_paths(xref_deps) + [webkitdom_docs_html_path()],
         'ignored_files': glob.glob(src_path('webkit', '*private.*')) + \
                          glob.glob(src_path('webkit', 'webkitauthenticationdialog.*')) + \
                          glob.glob(src_path('webkit', 'webkitspellcheckerenchant.*'))
     })
     return options
 
+def get_webkitdom_options():
+    def derived_sources_path(*args):
+        return common.build_path(*(('DerivedSources', 'webkitdom') + args))
+    def src_path(*args):
+        return common.top_level_path(*(('Source', 'WebCore', 'bindings', 'gobject') + args))
+
+    xref_deps = { 'glib-2.0' : ['glib', 'gobject', 'gio'] }
+
+    options = get_common_options().copy()
+    options.update({
+        'module_name' : 'webkitdomgtk',
+        'doc_dir' : derived_sources_path('docs'),
+        'output_dir' : common.build_path('Documentation', 'webkitdomgtk'),
+        'source_dirs' : [derived_sources_path()],
+        'cflags' : ' -I' + derived_sources_path() + \
+                   ' -I' + src_path() + \
+                   ' -I' + common.top_level_path('Source'),
+        'cross_reference_deps' : get_gtkdoc_module_paths(xref_deps),
+        'ignored_files': glob.glob(derived_sources_path('*Private.h'))
+    })
+    return options
+
 def print_missing_api(generator):
     missing_api = generator.api_missing_documentation()
     if not missing_api:
@@ -178,10 +203,27 @@ if os.environ.get('CC') == "clang":
     os.environ['CFLAGS'] += ' -Qunused-arguments'
 
 saw_webkit1_warnings = saw_webkit2_warnings = False
-
-pkg_config_path = common.build_path('Source', 'WebKit', 'gtk', 'webkitgtk-3.0.pc')
-if not os.path.exists(pkg_config_path):
-    pkg_config_path = common.build_path('Source', 'WebKit', 'gtk', 'webkit-1.0.pc')
+wk2_pkg_config_path = common.build_path('Source', 'WebKit2', 'webkit2gtk-3.0.pc')
+wk1_pkg_config_path = common.build_path('Source', 'WebKit', 'gtk', 'webkitgtk-3.0.pc')
+if not os.path.exists(wk1_pkg_config_path):
+    wk1_pkg_config_path = common.build_path('Source', 'WebKit', 'gtk', 'webkit-1.0.pc')
+
+if os.path.exists(wk2_pkg_config_path):
+    pkg_config_path = wk2_pkg_config_path
+elif os.path.exists(wk1_pkg_config_path):
+    pkg_config_path = wk1_pkg_config_path
+generator = gtkdoc.PkgConfigGTKDoc(pkg_config_path, get_webkitdom_options())
+if '--rebase' not in sys.argv:
+    print("\nGenerating WebKitDOM documentation...")
+    saw_webkitdom_warnings = generate_doc(generator)
+else:
+    print("\nRebasing WebKitDOM documentation...")
+    try:
+        generator.rebase_installed_docs()
+    except Exception:
+        print("Rebase did not happen, likely no documentation is present.")
+
+pkg_config_path = wk1_pkg_config_path
 if os.path.exists(pkg_config_path):
     options = get_webkit1_options(common.gtk_version_of_pkg_config_file(pkg_config_path))
     generator = gtkdoc.PkgConfigGTKDoc(pkg_config_path, options)
@@ -196,7 +238,7 @@ if os.path.exists(pkg_config_path):
             print("Rebase did not happen, likely no documentation is present.")
 
 # WebKit2 might not be enabled, so check for the pkg-config file before building documentation.
-pkg_config_path = common.build_path('Source', 'WebKit2', 'webkit2gtk-3.0.pc')
+pkg_config_path = wk2_pkg_config_path
 if os.path.exists(pkg_config_path):
     generator = gtkdoc.PkgConfigGTKDoc(pkg_config_path, get_webkit2_options())
     if '--rebase' not in sys.argv:
diff --git a/Tools/gtk/generate-webkitdom-doc-files b/Tools/gtk/generate-webkitdom-doc-files
new file mode 100755 (executable)
index 0000000..3b58b4d
--- /dev/null
@@ -0,0 +1,146 @@
+#!/usr/bin/env python
+# Copyright (C) 2013 Igalia S.L.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301  USA
+
+import os
+import re
+import sys
+
+class WebKitDOMDocGenerator:
+
+    def write_header(self):
+        pass
+
+    def write_section(self, symbol_file):
+        raise NotImplementedError
+
+    def write_footer(self):
+        pass
+
+class WebKitDOMDocGeneratorDocs(WebKitDOMDocGenerator):
+
+    def write_header(self):
+        sys.stdout.write('''<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
+<!ENTITY version SYSTEM "version.xml">
+]>
+<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
+  <bookinfo>
+    <title>WebKitDOMGTK+ Reference Manual</title>
+    <releaseinfo>for WebKitDOMGTK+ &version;</releaseinfo>
+  </bookinfo>
+
+  <chapter>
+    <title>Class Overview</title>
+''')
+
+    def write_section(self, symbol_file):
+        basename = os.path.basename(symbol_file)
+        sys.stdout.write('    <xi:include href="xml/%s"/>\n' % basename.replace(".symbols", ".xml"))
+
+    def write_footer(self):
+        sys.stdout.write('''  </chapter>
+
+  <index id="index-all">
+    <title>Index</title>
+  </index>
+
+  <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
+</book>
+''')
+
+class WebKitDOMDocGeneratorSections(WebKitDOMDocGenerator):
+
+    def __init__(self):
+        self._first_decamelize_re = re.compile('(.)([A-Z][a-z]+)')
+        self._second_decamelize_re = re.compile('([a-z0-9])([A-Z])')
+        self._dom_class_re = re.compile('(^WebKitDOM)(.+)$')
+        self._function_re = re.compile('^.+ (.+)\(.+$')
+
+    def _dom_class(self, class_name):
+        return self._dom_class_re.sub(r'\2', class_name)
+
+    def _dom_class_decamelize(self, class_name):
+        s1 = self._first_decamelize_re.sub(r'\1_\2', self._dom_class(class_name))
+        retval = self._second_decamelize_re.sub(r'\1_\2', s1)
+
+        # Fix some exceptions.
+        retval = retval.replace('Web_Kit', 'WebKit')
+        retval = retval.replace('X_Path', 'XPath')
+        retval = retval.replace('HTMLI_Frame', 'HTML_IFrame')
+
+        return retval
+
+    def _symbol_list(self, symbol_file):
+        retval = []
+        f = open(symbol_file, 'r')
+        for line in f.readlines():
+            match = self._function_re.match(line)
+            if not match or match.group(1).endswith('get_type'):
+                continue
+            retval.append(match.group(1))
+
+        return retval
+
+    def write_section(self, symbol_file):
+        class_name = os.path.basename(symbol_file).replace(".symbols", "")
+        is_custom = class_name == 'WebKitDOMCustom'
+        is_interface = class_name == 'WebKitDOMEventTarget'
+        is_object = class_name == 'WebKitDOMObject'
+        sys.stdout.write('<SECTION>\n')
+        sys.stdout.write('<FILE>%s</FILE>\n<TITLE>%s</TITLE>\n' % (class_name, class_name))
+        if not is_custom:
+            sys.stdout.write('%s\n' % class_name)
+        sys.stdout.write('\n')
+        sys.stdout.write('\n'.join(self._symbol_list(symbol_file)) + '\n')
+        if not is_custom:
+            sys.stdout.write('\n<SUBSECTION Standard>\n')
+            sys.stdout.write('%sClass\n' % class_name)
+            dom_class = self._dom_class_decamelize(class_name).upper()
+            sys.stdout.write('WEBKIT_TYPE_DOM_%s\n' % dom_class)
+            sys.stdout.write('WEBKIT_DOM_%s\n' % dom_class)
+            if is_object:
+                sys.stdout.write('WEBKIT_IS_DOM_%s\n' % dom_class)
+            else:
+                sys.stdout.write('WEBKIT_DOM_IS_%s\n' % dom_class)
+            sys.stdout.write('WEBKIT_DOM_%s_CLASS\n' % dom_class)
+            if is_interface:
+                sys.stdout.write('WEBKIT_DOM_%s_GET_IFACE\n' % dom_class)
+            else:
+                if is_object:
+                    sys.stdout.write('WEBKIT_IS_DOM_%s_CLASS\n' % dom_class)
+                else:
+                    sys.stdout.write('WEBKIT_DOM_IS_%s_CLASS\n' % dom_class)
+                sys.stdout.write('WEBKIT_DOM_%s_GET_CLASS\n' % dom_class)
+            sys.stdout.write('\n<SUBSECTION Private>\n')
+            if is_object:
+                sys.stdout.write('%sPrivate\n' % class_name)
+            sys.stdout.write('webkit_dom_%s_get_type\n' % dom_class.lower())
+        sys.stdout.write('</SECTION>\n\n')
+
+
+symbol_files = sys.stdin.read().strip('\n').split(' ')
+if 'docs' in sys.argv[1:]:
+    generator = WebKitDOMDocGeneratorDocs()
+elif 'sections' in sys.argv[1:]:
+    generator = WebKitDOMDocGeneratorSections()
+
+generator.write_header()
+for symbol_file in symbol_files:
+    generator.write_section(symbol_file)
+generator.write_footer()