[gtk-doc] mkdb: fix object_index for n_object % 3, FIxes #620249



commit 26901ca27fb053c2d9eda1dc80d5cb8eb9bee91b
Author: Stefan Kost <ensonic users sf net>
Date:   Wed Jun 2 23:43:47 2010 +0300

    mkdb: fix object_index for n_object % 3, FIxes #620249
    
    Don't output the closing row tag twice in this case. Add tests for it.

 gtkdoc-mkdb.in                              |    4 ++-
 tests/gobject/docs-tmpl/tester-docs.xml     |    9 ++++++-
 tests/gobject/docs-tmpl/tester-sections.txt |   17 +++++++++++++
 tests/gobject/docs-tmpl/tester.types        |    2 +
 tests/gobject/docs/tester-docs.xml          |    7 +++++
 tests/gobject/docs/tester-sections.txt      |   17 +++++++++++++
 tests/gobject/src/giface.c                  |   29 ++++++++++++++++++++++
 tests/gobject/src/giface.h                  |   10 +++++++
 tests/gobject/src/gobject.c                 |   35 +++++++++++++++++++++++++++
 tests/gobject/src/gobject.h                 |   26 ++++++++++++++++++++
 10 files changed, 154 insertions(+), 2 deletions(-)
---
diff --git a/gtkdoc-mkdb.in b/gtkdoc-mkdb.in
index 7827f0d..ba22826 100755
--- a/gtkdoc-mkdb.in
+++ b/gtkdoc-mkdb.in
@@ -459,7 +459,9 @@ EOF
 	print (OUTPUT "<row><entry> </entry></row>\n");
     }
     else {
-        print (OUTPUT "</row>\n");
+        if ($count % $cols > 0) {
+            print (OUTPUT "</row>\n");
+        }
     }
 
     print (OUTPUT <<EOF);
diff --git a/tests/gobject/docs-tmpl/tester-docs.xml b/tests/gobject/docs-tmpl/tester-docs.xml
index 937f739..7bbcada 100644
--- a/tests/gobject/docs-tmpl/tester-docs.xml
+++ b/tests/gobject/docs-tmpl/tester-docs.xml
@@ -35,7 +35,9 @@
     <chapter id="main-api">
       <title>Tests</title>
       <xi:include href="xml/object.xml"/>
+      <xi:include href="xml/object2.xml"/>
       <xi:include href="xml/iface.xml"/>
+      <xi:include href="xml/iface2.xml"/>
       <xi:include href="xml/types.xml"/>
     </chapter>
   </reference>
@@ -47,7 +49,12 @@
       <title>Object Hierarchy</title>
        <xi:include href="xml/tree_index.sgml" />
     </chapter>
-  
+
+    <chapter id="object-index">
+      <title>Object Index</title>
+       <xi:include href="xml/object_index.sgml"/>
+    </chapter>
+
     <index id="api-index-full">
       <title>API Index</title>
       <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
diff --git a/tests/gobject/docs-tmpl/tester-sections.txt b/tests/gobject/docs-tmpl/tester-sections.txt
index ee6e874..7745c12 100644
--- a/tests/gobject/docs-tmpl/tester-sections.txt
+++ b/tests/gobject/docs-tmpl/tester-sections.txt
@@ -19,6 +19,15 @@ GTKDOC_OBJECT_GET_CLASS
 </SECTION>
 
 <SECTION>
+<FILE>object2</FILE>
+GtkdocObject2
+GtkdocObject2Class
+<SUBSECTION Standard>
+GTKDOC_TYPE_OBJECT2
+gtkdoc_object2_get_type
+</SECTION>
+
+<SECTION>
 <FILE>iface</FILE>
 GtkdocIface
 GtkdocIfaceInterface
@@ -34,6 +43,14 @@ GTKDOC_IFACE_GET_INTERFACE
 </SECTION>
 
 <SECTION>
+<FILE>iface2</FILE>
+GtkdocIface2
+<SUBSECTION Standard>
+GTKDOC_TYPE_IFACE2
+gtkdoc_iface2_get_type
+</SECTION>
+
+<SECTION>
 <FILE>types</FILE>
 GtkdocEnum
 <SUBSECTION Standard>
diff --git a/tests/gobject/docs-tmpl/tester.types b/tests/gobject/docs-tmpl/tester.types
index a6d82a2..a39ff85 100644
--- a/tests/gobject/docs-tmpl/tester.types
+++ b/tests/gobject/docs-tmpl/tester.types
@@ -1,6 +1,8 @@
 #include <tester.h>
 
 gtkdoc_object_get_type
+gtkdoc_object2_get_type
 gtkdoc_iface_get_type
+gtkdoc_iface2_get_type
 gtkdoc_enum_get_type
 gtkdoc_boxed_get_type
diff --git a/tests/gobject/docs/tester-docs.xml b/tests/gobject/docs/tester-docs.xml
index 86c0f0b..59c821d 100644
--- a/tests/gobject/docs/tester-docs.xml
+++ b/tests/gobject/docs/tester-docs.xml
@@ -48,7 +48,9 @@
     <chapter id="main-api">
       <title>Tests</title>
       <xi:include href="xml/object.xml"/>
+      <xi:include href="xml/object2.xml"/>
       <xi:include href="xml/iface.xml"/>
+      <xi:include href="xml/iface2.xml"/>
       <xi:include href="xml/types.xml"/>
     </chapter>
   </reference>
@@ -61,6 +63,11 @@
        <xi:include href="xml/tree_index.sgml"/>
     </chapter>
 
+    <chapter id="object-index">
+      <title>Object Index</title>
+       <xi:include href="xml/object_index.sgml"/>
+    </chapter>
+
     <index id="api-index-full">
       <title>API Index</title>
       <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
diff --git a/tests/gobject/docs/tester-sections.txt b/tests/gobject/docs/tester-sections.txt
index ee6e874..7745c12 100644
--- a/tests/gobject/docs/tester-sections.txt
+++ b/tests/gobject/docs/tester-sections.txt
@@ -19,6 +19,15 @@ GTKDOC_OBJECT_GET_CLASS
 </SECTION>
 
 <SECTION>
+<FILE>object2</FILE>
+GtkdocObject2
+GtkdocObject2Class
+<SUBSECTION Standard>
+GTKDOC_TYPE_OBJECT2
+gtkdoc_object2_get_type
+</SECTION>
+
+<SECTION>
 <FILE>iface</FILE>
 GtkdocIface
 GtkdocIfaceInterface
@@ -34,6 +43,14 @@ GTKDOC_IFACE_GET_INTERFACE
 </SECTION>
 
 <SECTION>
+<FILE>iface2</FILE>
+GtkdocIface2
+<SUBSECTION Standard>
+GTKDOC_TYPE_IFACE2
+gtkdoc_iface2_get_type
+</SECTION>
+
+<SECTION>
 <FILE>types</FILE>
 GtkdocEnum
 <SUBSECTION Standard>
diff --git a/tests/gobject/src/giface.c b/tests/gobject/src/giface.c
index 4b09bdb..927b987 100644
--- a/tests/gobject/src/giface.c
+++ b/tests/gobject/src/giface.c
@@ -15,6 +15,14 @@
  *   <caption><para>Home sweet home.</para></caption>
  * </mediaobject>
  */
+/**
+ * SECTION:iface2
+ * @title: GtkdocIface2
+ * @short_description: interface with a prerequisite for gtk-doc unit test
+ * @see_also: #GtkdocObject, #GtkdocIface
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ */
 
 #include <glib.h>
 #include <glib-object.h>
@@ -90,3 +98,24 @@ GType gtkdoc_iface_get_type (void) {
   return type;
 }
 
+GType gtkdoc_iface2_get_type (void) {
+  static GType type = 0;
+  if (type == 0) {
+    static const GTypeInfo info = {
+      (guint16)sizeof(GtkdocIfaceInterface),
+      NULL, // base_init
+      NULL, // base_finalize
+      NULL, // class_init
+      NULL, // class_finalize
+      NULL, // class_data
+      0,
+      0,   // n_preallocs
+      NULL, // instance_init
+      NULL // value_table
+    };
+    type = g_type_register_static(G_TYPE_INTERFACE,"GtkdocIface2",&info,0);
+    g_type_interface_add_prerequisite(type, GTKDOC_TYPE_IFACE);
+  }
+  return type;
+}
+
diff --git a/tests/gobject/src/giface.h b/tests/gobject/src/giface.h
index 66ae29b..2883407 100644
--- a/tests/gobject/src/giface.h
+++ b/tests/gobject/src/giface.h
@@ -11,6 +11,8 @@
 #define GTKDOC_IS_IFACE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTKDOC_TYPE_IFACE))
 #define GTKDOC_IFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTKDOC_TYPE_IFACE, GtkdocIfaceInterface))
 
+#define GTKDOC_TYPE_IFACE2              (gtkdoc_iface2_get_type ())
+
 /* type structs */
 
 /**
@@ -22,6 +24,13 @@ typedef struct _GtkdocIface GtkdocIface;
 typedef struct _GtkdocIfaceInterface GtkdocIfaceInterface;
 
 /**
+ * GtkdocIface2:
+ *
+ * opaque instance of gtk-doc unit test interface
+ */
+typedef struct _GtkdocIface2 GtkdocIface2;
+
+/**
  * GtkdocIfaceInterface:
  * @parent: this is a bug :/
  * @test: overideable method
@@ -36,6 +45,7 @@ struct _GtkdocIfaceInterface {
 };
 
 GType  gtkdoc_iface_get_type(void) G_GNUC_CONST;
+GType  gtkdoc_iface2_get_type(void) G_GNUC_CONST;
 
 gboolean gtkdoc_iface_configure (gchar *config);
 
diff --git a/tests/gobject/src/gobject.c b/tests/gobject/src/gobject.c
index aaed5fe..de3bd04 100644
--- a/tests/gobject/src/gobject.c
+++ b/tests/gobject/src/gobject.c
@@ -37,11 +37,20 @@
  * </para></listitem>
  * </itemizedlist>
  */
+/**
+ * SECTION:object2
+ * @title: GtkdocObject2
+ * @short_description: class with interface for gtk-doc unit test
+ * @see_also: #GtkdocIface
+ *
+ * This file contains non-sense code for the sole purpose of testing the docs.
+ */
 
 #include <glib.h>
 #include <glib-object.h>
 
 #include "gobject.h"
+#include "giface.h"
 
 /* property ids */
 
@@ -214,3 +223,29 @@ GType gtkdoc_object_get_type (void) {
   return type;
 }
 
+GType gtkdoc_object2_get_type (void) {
+  static GType type = 0;
+  if (type == 0) {
+    static const GTypeInfo info = {
+      (guint16)sizeof(GtkdocObject2Class),
+      NULL, // base_init
+      NULL, // base_finalize
+      NULL, // class_init
+      NULL, // class_finalize
+      NULL, // class_data
+      (guint16)sizeof(GtkdocObject2),
+      0,   // n_preallocs
+      NULL, // instance_init
+      NULL // value_table
+    };
+    static const GInterfaceInfo interface_info = {
+      NULL,
+      NULL,
+      NULL
+    };
+    type = g_type_register_static(G_TYPE_OBJECT,"GtkdocObject2",&info,0);
+    g_type_add_interface_static(type, GTKDOC_TYPE_IFACE, &interface_info);
+  }
+  return type;
+}
+
diff --git a/tests/gobject/src/gobject.h b/tests/gobject/src/gobject.h
index 48e3f1c..4d9f561 100644
--- a/tests/gobject/src/gobject.h
+++ b/tests/gobject/src/gobject.h
@@ -13,11 +13,16 @@
 #define GTKDOC_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTKDOC_TYPE_OBJECT))
 #define GTKDOC_OBJECT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTKDOC_TYPE_OBJECT, GtkdocObjectClass))
 
+#define GTKDOC_TYPE_OBJECT2           (gtkdoc_object2_get_type ())
+
 /* type structs */
 
 typedef struct _GtkdocObject GtkdocObject;
 typedef struct _GtkdocObjectClass GtkdocObjectClass;
 
+typedef struct _GtkdocObject2 GtkdocObject2;
+typedef struct _GtkdocObject2Class GtkdocObject2Class;
+
 /* in gtkdoc-scan::ScanHeader() we currently skip the enums, but output a decl
 * to -decl.txt and -decl-list.txt for the struct
 * If the symbol has no docs, we get a warning in -unused.txt for the struct, but
@@ -53,6 +58,26 @@ struct _GtkdocObjectClass {
   void (*test)(const GtkdocObject * const self, gconstpointer const user_data);
 };
 
+/**
+ * GtkdocObject2:
+ *
+ * instance data of gtk-doc unit test class
+ */
+struct _GtkdocObject2 {
+  GObject parent;
+};
+
+/**
+ * GtkdocObject2Class:
+ * @parent: this is a bug :/
+ *
+ * class data of gtk-doc unit test class
+ */
+struct _GtkdocObject2Class {
+  GObjectClass parent;
+};
+
+
 struct GtkdocHelperStruct {
   int a;
 };
@@ -63,6 +88,7 @@ enum GtkdocHelperEnum {
 };
 
 GType  gtkdoc_object_get_type(void) G_GNUC_CONST;
+GType  gtkdoc_object2_get_type(void) G_GNUC_CONST;
 
 GtkdocObject *gtkdoc_object_new(void);
 #ifndef GTKDOC_TESTER_DISABLE_DEPRECATED



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]