resetting manifest requested domain to floor
[platform/upstream/gst-common.git] / gstdoc-scangobj
index b017740..09039a5 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 # -*- cperl -*-
 #
 # gtk-doc - GTK DocBook documentation generator.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
 #
-# This gets information about object heirarchies and signals
+# This gets information about object hierarchies and signals
 # by compiling a small C program. CFLAGS and LDFLAGS must be
 # set appropriately before running this script.
 #
-# NOTE: the lookup_signal_arg_names() function contains the argument names of
-#       standard GTK signal handlers. This may need to be updated for new
-#       GTK signals or Gnome widget signals.
 
 use Getopt::Long;
 
-unshift @INC, '/usr/share/gtk-doc/data';
+my $GTK_DOC_PREFIX=`pkg-config --variable prefix gtk-doc`;
+if ($GTK_DOC_PREFIX) {
+  chomp $GTK_DOC_PREFIX;
+  #print "Adding $GTK_DOC_PREFIX/share/gtk-doc/data to \@INC\n";
+  unshift @INC, "$GTK_DOC_PREFIX/share/gtk-doc/data";
+} else {
+  unshift @INC, '/usr/share/gtk-doc/data';
+}
 require "gtkdoc-common.pl";
 
 # Options
@@ -39,6 +43,7 @@ require "gtkdoc-common.pl";
 my $MODULE;
 my $OUTPUT_DIR;
 my $INSPECT_DIR;
+my $VERBOSE;
 my $PRINT_VERSION;
 my $PRINT_HELP;
 my $TYPE_INIT_FUNC="g_type_init ()";
@@ -51,13 +56,15 @@ my $TYPE_INIT_FUNC="g_type_init ()";
           'type-init-func' => \$TYPE_INIT_FUNC,
           'output-dir' => \$OUTPUT_DIR,
           'inspect-dir' => \$INSPECT_DIR,
+          'verbose' => \$VERBOSE,
           'version' => \$PRINT_VERSION,
           'help' => \$PRINT_HELP);
 
-GetOptions(\%optctl, "module=s", "source=s", "types:s", "output-dir:s", "inspect-dir:s", "nogtkinit", "type-init-func:s", "version", "help");
+GetOptions(\%optctl, "module=s", "source=s", "types:s", "output-dir:s", "inspect-dir:s", "nogtkinit", "type-init-func:s", "verbose", "version", "help");
 
 if ($NO_GTK_INIT) {
   # Do nothing. This just avoids a warning.
+  # the option is not used anymore
 }
 
 if ($PRINT_VERSION) {
@@ -70,15 +77,19 @@ if (!$MODULE) {
 }
 
 if ($PRINT_HELP) {
-    print "gstdoc-scangobj version 1.5\n";
-    print "\n--module=MODULE_NAME  Name of the doc module being parsed";
-    print "\n--source=SOURCE_NAME  Name of the source module for plugins";
-    print "\n--types=FILE          The name of the file to store the types in";
-    print "\n--type-init-func=FUNC The init function to call instead of g_type_init ()";
-    print "\n--output-dir=DIRNAME  The directory where the results are stored";
-    print "\n--inspect-dir=DIRNAME  The directory where the plugin inspect data is stored";
-    print "\n--version             Print the version of this program";
-    print "\n--help                Print this help\n";
+    print <<EOF;
+gstdoc-scangobj version 1.5 - introspect gstreamer-plugins
+
+--module=MODULE_NAME          Name of the doc module being parsed
+--source=SOURCE_NAME          Name of the source module for plugins
+--types=FILE                  The name of the file to store the types in
+--type-init-func=FUNC         The init function to call instead of g_type_init()
+--output-dir=DIRNAME          The directory where the results are stored
+--inspect-dir=DIRNAME         The directory where the plugin inspect data is stored
+--verbose                     Print extra output while processing
+--version                     Print the version of this program
+--help                        Print this help
+EOF
     exit 0;
 }
 
@@ -100,6 +111,11 @@ my $new_prerequisites_filename = "$OUTPUT_DIR/$MODULE.prerequisites.new";
 my $old_args_filename = "$OUTPUT_DIR/$MODULE.args";
 my $new_args_filename = "$OUTPUT_DIR/$MODULE.args.new";
 
+my $debug_log="g_message";
+if (!defined($VERBOSE) or $VERBOSE eq "0") {
+    $debug_log="//$debug_log";
+}
+
 # write a C program to scan the types
 
 $includes = "";
@@ -123,9 +139,12 @@ for (<TYPES>) {
     }
 }
 
-$ntypes = @types + @impl_types;
+$ntypes = @types + @impl_types + 1;
 
 print OUTPUT <<EOT;
+
+/* file generated by common/gstdoc-scangobj */
+
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -136,67 +155,80 @@ $includes
 #ifdef GTK_IS_WIDGET_CLASS
 #include <gtk/gtkversion.h>
 #endif
-GType *object_types = NULL;
 
-GString *xmlstr = NULL;
+static GType *object_types = NULL;
+
+static GString *xmlstr = NULL;
 
 static const gchar*
 xmlprint (gint indent, const gchar *tag, const gchar *data)
 {
-  /* 20 spaces */
-  gchar indent_str[] = "                    ";
-  
+  const gchar indent_str[] = "                                               ";
+
   /* reset */
   g_string_truncate (xmlstr, 0);
-  g_string_append_printf (xmlstr, "%s<%s>", &indent_str[20-indent], tag);
+  g_string_append_len (xmlstr, indent_str, MIN (indent, strlen (indent_str)));
+  g_string_append_printf (xmlstr, "<%s>", tag);
 
   if (data) {
-    const gchar *s = data;
-    while (*s) {
-      switch (*s) {
-        case '<':
-          g_string_append (xmlstr, "&lt;");
-          break;
-        case '>':
-          g_string_append (xmlstr, "&gt;");
-          break;
-        case '&':
-          g_string_append (xmlstr, "&amp;");
-          break;
-        default:
-          g_string_append_c (xmlstr, *s);
-      }
-      s++;
-    }
+    gchar *s;
+
+    s = g_markup_escape_text (data, -1);
+    g_string_append (xmlstr, s);
+    g_free (s);
   }
-  
-  g_string_append_printf (xmlstr, "</%s>", tag);
+
+  g_string_append_printf (xmlstr, "</%s>\\n", tag);
   return xmlstr->str;
 }
 
 static gint
 gst_feature_sort_compare (gconstpointer a, gconstpointer b)
 {
-  return strcmp (((GstPluginFeature *)a)->name, ((GstPluginFeature *)b)->name); 
+  const gchar *name_a = gst_plugin_feature_get_name ((GstPluginFeature *) a);
+  const gchar *name_b = gst_plugin_feature_get_name ((GstPluginFeature *) b);
+  return strcmp (name_a, name_b);
+}
+
+static gint
+static_pad_template_compare (gconstpointer a, gconstpointer b)
+{
+  GstStaticPadTemplate *spt_a = (GstStaticPadTemplate *) a;
+  GstStaticPadTemplate *spt_b = (GstStaticPadTemplate *) b;
+
+  /* we want SINK before SRC (enum is UNKNOWN, SRC, SINK) */
+  if (spt_a->direction != spt_b->direction)
+    return spt_b->direction - spt_a->direction;
+
+  /* we want ALWAYS first, SOMETIMES second, REQUEST last
+   * (enum is ALWAYS, SOMETIMES, REQUEST) */
+  if (spt_a->presence != spt_b->presence)
+    return spt_a->presence - spt_b->presence;
+
+  return strcmp (spt_a->name_template, spt_b->name_template);
 }
 
 static GType *
 get_object_types (void)
 {
+    gpointer g_object_class;
     GList *plugins = NULL;
     GList *factories = NULL;
     GList *l;
     GstElementFactory *factory = NULL;
     GType type;
     gint i = 0;
-    
+    gboolean reinspect;
+
     /* get a list of features from plugins in our source module */
-    plugins = gst_registry_get_plugin_list (gst_registry_get_default());
+    plugins = gst_registry_get_plugin_list (gst_registry_get ());
 
     xmlstr = g_string_new ("");
-    
+
+    reinspect = !g_file_test ("scanobj-build.stamp", G_FILE_TEST_EXISTS);
+
     while (plugins) {
-      GList *features, *pads;
+      GList *features;
       GstPlugin *plugin;
       const gchar *source;
       FILE *inspect = NULL;
@@ -205,37 +237,53 @@ get_object_types (void)
       plugin = (GstPlugin *) (plugins->data);
       plugins = g_list_next (plugins);
       source = gst_plugin_get_source (plugin);
-      /*g_print ("plugin: %s source: %s\\n", plugin->desc.name, source);*/
       if (!source || strcmp (source, "$SOURCE") != 0) {
         continue;
       }
-      g_print ("plugin: %s source: %s\\n", plugin->desc.name, source);
-
-      inspect_name = g_strdup_printf ("$INSPECT_DIR" G_DIR_SEPARATOR_S "plugin-%s.xml",
-          plugin->desc.name);
-      inspect = fopen (inspect_name, "w");
-      g_free (inspect_name);
-      
-      /* output plugin data */
-      fputs ("<plugin>\\n",inspect);
-      fputs (xmlprint(2, "name", plugin->desc.name),inspect);
-      fputs (xmlprint(2, "description", plugin->desc.description),inspect);
-      fputs (xmlprint(2, "filename", plugin->filename),inspect);
-      fputs (xmlprint(2, "basename", plugin->basename),inspect);
-      fputs (xmlprint(2, "version", plugin->desc.version),inspect);
-      fputs (xmlprint(2, "license", plugin->desc.license),inspect);
-      fputs (xmlprint(2, "source", plugin->desc.source),inspect);
-      fputs (xmlprint(2, "package", plugin->desc.package),inspect);
-      fputs (xmlprint(2, "origin", plugin->desc.origin),inspect);
-      fputs ("  <elements>\\n", inspect);
+
+      /* skip static coreelements plugin with pipeline and bin element factory */
+      if (gst_plugin_get_filename (plugin) == NULL)
+        continue;
+
+      $debug_log ("plugin: %s source: %s", gst_plugin_get_name (plugin), source);
+
+      if (reinspect) {
+        gchar *basename;
+
+        inspect_name = g_strdup_printf ("$INSPECT_DIR" G_DIR_SEPARATOR_S "plugin-%s.xml",
+            gst_plugin_get_name (plugin));
+        inspect = fopen (inspect_name, "w");
+        if (inspect == NULL) {
+          g_error ("Could not open %s for writing: %s\\n", inspect_name,
+              g_strerror (errno));
+        }
+        g_free (inspect_name);
+
+                 basename = g_path_get_basename (gst_plugin_get_filename (plugin));
+
+        /* output plugin data */
+        fputs ("<plugin>\\n",inspect);
+        fputs (xmlprint(2, "name", gst_plugin_get_name (plugin)),inspect);
+        fputs (xmlprint(2, "description", gst_plugin_get_description (plugin)),inspect);
+        fputs (xmlprint(2, "filename", gst_plugin_get_filename (plugin)),inspect);
+        fputs (xmlprint(2, "basename", basename),inspect);
+        fputs (xmlprint(2, "version", gst_plugin_get_version (plugin)),inspect);
+        fputs (xmlprint(2, "license", gst_plugin_get_license (plugin)),inspect);
+        fputs (xmlprint(2, "source", gst_plugin_get_source (plugin)),inspect);
+        fputs (xmlprint(2, "package", gst_plugin_get_package (plugin)),inspect);
+        fputs (xmlprint(2, "origin", gst_plugin_get_origin (plugin)),inspect);
+        fputs ("  <elements>\\n", inspect);
+
+                 g_free (basename);
+      }
 
       features =
-          gst_registry_get_feature_list_by_plugin (gst_registry_get_default (),
-          plugin->desc.name);
+          gst_registry_get_feature_list_by_plugin (gst_registry_get (),
+          gst_plugin_get_name (plugin));
 
       /* sort factories by feature->name */
       features = g_list_sort (features, gst_feature_sort_compare);
-          
+
       while (features) {
         GstPluginFeature *feature;
         feature = GST_PLUGIN_FEATURE (features->data);
@@ -246,50 +294,54 @@ get_object_types (void)
         }
 
         if (GST_IS_ELEMENT_FACTORY (feature)) {
-          GstStaticPadTemplate *pt;
           const gchar *pad_dir[] = { "unknown","source","sink" };
           const gchar *pad_pres[] = { "always","sometimes","request" };
+          GList *pads, *pad;
+
+          $debug_log ("  feature: %s", gst_plugin_feature_get_name (feature));
 
-          /*g_print ("  feature: %s\\n", feature->name);*/
-          
           factory = GST_ELEMENT_FACTORY (feature);
           factories = g_list_prepend (factories, factory);
-          
-          /* output element data */
-          fputs ("    <element>\\n", inspect);
-          fputs (xmlprint(6, "name", feature->name),inspect);
-          fputs (xmlprint(6, "longname", factory->details.longname),inspect);
-          fputs (xmlprint(6, "class", factory->details.klass),inspect);
-          fputs (xmlprint(6, "description", factory->details.description),inspect);
-          fputs (xmlprint(6, "author", factory->details.author),inspect);
-          fputs ("      <pads>\\n", inspect);
-            
-          /* output pad-template data */
-          pads =(GList *) gst_element_factory_get_static_pad_templates (factory);
-          while (pads) {
-            pt = (GstStaticPadTemplate *)pads->data;
-
-            fputs ("        <caps>\\n", inspect);
-            fputs (xmlprint(10, "name", pt->name_template),inspect);
-            fputs (xmlprint(10, "direction", pad_dir[pt->direction]),inspect);
-            fputs (xmlprint(10, "presence", pad_pres[pt->presence]),inspect);
-            fputs (xmlprint(10, "details", pt->static_caps.string),inspect);
-            fputs ("        </caps>\\n", inspect);
-
-            pads = g_list_next (pads);
+
+          if (reinspect) {
+            /* output element data */
+            fputs ("    <element>\\n", inspect);
+            fputs (xmlprint(6, "name", gst_plugin_feature_get_name (feature)),inspect);
+            fputs (xmlprint(6, "longname", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_LONGNAME)),inspect);
+            fputs (xmlprint(6, "class", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_KLASS)),inspect);
+            fputs (xmlprint(6, "description", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_DESCRIPTION)),inspect);
+            fputs (xmlprint(6, "author", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_AUTHOR)),inspect);
+            fputs ("      <pads>\\n", inspect);
+
+            /* output pad-template data */
+            pads = g_list_copy ((GList *) gst_element_factory_get_static_pad_templates (factory));
+            pads = g_list_sort (pads, static_pad_template_compare);
+            for (pad = pads; pad != NULL; pad = pad->next) {
+              GstStaticPadTemplate *pt = pad->data;
+
+              fputs ("        <caps>\\n", inspect);
+              fputs (xmlprint(10, "name", pt->name_template),inspect);
+              fputs (xmlprint(10, "direction", pad_dir[pt->direction]),inspect);
+              fputs (xmlprint(10, "presence", pad_pres[pt->presence]),inspect);
+              fputs (xmlprint(10, "details", pt->static_caps.string),inspect);
+              fputs ("        </caps>\\n", inspect);
+            }
+            g_list_free (pads);
+            fputs ("      </pads>\\n    </element>\\n", inspect);
           }
-          fputs ("      </pads>\\n    </element>\\n", inspect);
         }
         features = g_list_next (features);
       }
-      
-      fputs ("  </elements>\\n</plugin>\\n", inspect);
-      fclose (inspect);
+
+      if (reinspect) {
+        fputs ("  </elements>\\n</plugin>", inspect);
+        fclose (inspect);
+      }
     }
-    
+
     g_string_free (xmlstr, TRUE);
 
-    g_message ("number of element factories: %d", g_list_length (factories));
+    $debug_log ("number of element factories: %d", g_list_length (factories));
 
     /* allocate the object_types array to hold them */
     object_types = g_new0 (GType, g_list_length (factories)+$ntypes+1);
@@ -302,11 +354,11 @@ get_object_types (void)
       factory = GST_ELEMENT_FACTORY (l->data);
       type = gst_element_factory_get_element_type (factory);
       if (type != 0) {
-        g_message ("adding type %p for factory %s", (void *) type, gst_element_factory_get_longname (factory));
+        $debug_log ("adding type for factory %s", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_LONGNAME));
         object_types[i++] = type;
       } else {
         g_message ("type info for factory %s not found",
-            gst_element_factory_get_longname (factory));
+            gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_LONGNAME));
       }
       l = g_list_next (l);
     }
@@ -343,16 +395,22 @@ print OUTPUT <<EOT;
 
     object_types[i] = 0;
 
+    /* reference the GObjectClass to initialize the param spec pool
+     * potentially needed by interfaces. See http://bugs.gnome.org/571820 */
+    g_object_class = g_type_class_ref (G_TYPE_OBJECT);
+
     /* Need to make sure all the types are loaded in and initialize
      * their signals and properties.
      */
-    for (i=0; object_types[i]; i++) {
-      if (G_TYPE_IS_CLASSED (object_types[i]))
-        g_type_class_ref (object_types[i]);
-        else {
-          g_warning ("not reffing type: %s", g_type_name (object_types[i]));
-        }
-    }
+    for (i=0; object_types[i]; i++)
+      {
+        if (G_TYPE_IS_CLASSED (object_types[i]))
+          g_type_class_ref (object_types[i]);
+        if (G_TYPE_IS_INTERFACE (object_types[i]))
+          g_type_default_interface_ref (object_types[i]);
+      }
+
+    g_type_class_unref (g_object_class);
 
     return object_types;
 }
@@ -378,10 +436,6 @@ static void output_object_signal (FILE *fp,
                                  guint signal_id);
 static const gchar * get_type_name (GType type,
                                    gboolean * is_pointer);
-static const gchar * get_gdk_event (const gchar * signal_name);
-static const gchar ** lookup_signal_arg_names (const gchar * type,
-                                              const gchar * signal_name);
-
 static void output_object_hierarchy (void);
 static void output_hierarchy (FILE *fp,
                              GType type,
@@ -427,7 +481,7 @@ output_signals (void)
   fp = fopen (signals_filename, "w");
   if (fp == NULL)
     {
-      g_warning ("Couldn't open output file: %s : %s", signals_filename, strerror(errno));
+      g_warning ("Couldn't open output file: %s : %s", signals_filename, g_strerror(errno));
       return;
     }
 
@@ -482,25 +536,20 @@ output_object_signal (FILE *fp,
   const gchar *type_name, *ret_type, *object_arg, *arg_name;
   gchar *pos, *object_arg_lower;
   gboolean is_pointer;
-  gchar ret_type_buffer[1024], buffer[1024];
+  gchar buffer[1024];
   guint i, param;
-  const gchar **arg_names;
   gint param_num, widget_num, event_num, callback_num;
   gint *arg_num;
   gchar signal_name[128];
   gchar flags[16];
 
-  /*  g_print ("Object: %s Signal: %u\\n", object_name, signal_id);*/
+  $debug_log ("Object: %s Signal: %u", object_name, signal_id);
 
   param_num = 1;
   widget_num = event_num = callback_num = 0;
 
   g_signal_query (signal_id, &query_info);
 
-  /* Output the return type and function name. */
-  ret_type = get_type_name (query_info.return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE, &is_pointer);
-  sprintf (ret_type_buffer, "%s%s", ret_type, is_pointer ? "*" : "");
-
   /* Output the signal object type and the argument name. We assume the
      type is a pointer - I think that is OK. We remove "Gtk" or "Gnome" and
      convert to lower case for the argument name. */
@@ -508,6 +557,17 @@ output_object_signal (FILE *fp,
   sprintf (pos, "%s ", object_name);
   pos += strlen (pos);
 
+  /* Try to come up with a sensible variable name for the first arg
+   * It chops off 2 know prefixes :/ and makes the name lowercase
+   * It should replace lowercase -> uppercase with '_'
+   * GFileMonitor -> file_monitor
+   * GIOExtensionPoint -> extension_point
+   * GtkTreeView -> tree_view
+   * if 2nd char is upper case too
+   *   search for first lower case and go back one char
+   * else
+   *   search for next upper case
+   */
   if (!strncmp (object_name, "Gtk", 3))
       object_arg = object_name + 3;
   else if (!strncmp (object_name, "Gnome", 5))
@@ -523,7 +583,8 @@ output_object_signal (FILE *fp,
   g_free(object_arg_lower);
 
   /* Convert signal name to use underscores rather than dashes '-'. */
-  strcpy (signal_name, query_info.signal_name);
+  strncpy (signal_name, query_info.signal_name, 127);
+  signal_name[127] = '\\0';
   for (i = 0; signal_name[i]; i++)
     {
       if (signal_name[i] == '-')
@@ -531,64 +592,46 @@ output_object_signal (FILE *fp,
     }
 
   /* Output the signal parameters. */
-  arg_names = lookup_signal_arg_names (object_name, signal_name);
-
   for (param = 0; param < query_info.n_params; param++)
     {
-      if (arg_names)
-       {
-         sprintf (pos, "%s\\n", arg_names[param]);
-         pos += strlen (pos);
-       }
+      type_name = get_type_name (query_info.param_types[param] & ~G_SIGNAL_TYPE_STATIC_SCOPE, &is_pointer);
+
+      /* Most arguments to the callback are called "arg1", "arg2", etc.
+         GtkWidgets are called "widget", "widget2", ...
+         GtkCallbacks are called "callback", "callback2", ... */
+      if (!strcmp (type_name, "GtkWidget"))
+        {
+          arg_name = "widget";
+          arg_num = &widget_num;
+        }
+      else if (!strcmp (type_name, "GtkCallback")
+               || !strcmp (type_name, "GtkCCallback"))
+        {
+          arg_name = "callback";
+          arg_num = &callback_num;
+        }
       else
-       {
-         type_name = get_type_name (query_info.param_types[param] & ~G_SIGNAL_TYPE_STATIC_SCOPE, &is_pointer);
-
-         /* Most arguments to the callback are called "arg1", "arg2", etc.
-            GdkWidgets are called "widget", "widget2", ...
-            GdkEvents are called "event", "event2", ...
-            GtkCallbacks are called "callback", "callback2", ... */
-         if (!strcmp (type_name, "GtkWidget"))
-           {
-             arg_name = "widget";
-             arg_num = &widget_num;
-           }
-         else if (!strcmp (type_name, "GdkEvent"))
-           {
-             type_name = get_gdk_event (signal_name);
-             arg_name = "event";
-             arg_num = &event_num;
-             is_pointer = TRUE;
-           }
-         else if (!strcmp (type_name, "GtkCallback")
-                  || !strcmp (type_name, "GtkCCallback"))
-           {
-             arg_name = "callback";
-             arg_num = &callback_num;
-           }
-         else
-           {
-             arg_name = "arg";
-             arg_num = &param_num;
-           }
-         sprintf (pos, "%s ", type_name);
-         pos += strlen (pos);
-
-         if (!arg_num || *arg_num == 0)
-           sprintf (pos, "%s%s\\n", is_pointer ? "*" : " ", arg_name);
-         else
-           sprintf (pos, "%s%s%i\\n", is_pointer ? "*" : " ", arg_name,
-                    *arg_num);
-         pos += strlen (pos);
-
-         if (arg_num)
-           {
-             if (*arg_num == 0)
-               *arg_num = 2;
-             else
-               *arg_num += 1;
-           }
-       }
+        {
+          arg_name = "arg";
+          arg_num = &param_num;
+        }
+      sprintf (pos, "%s ", type_name);
+      pos += strlen (pos);
+
+      if (!arg_num || *arg_num == 0)
+        sprintf (pos, "%s%s\\n", is_pointer ? "*" : " ", arg_name);
+      else
+        sprintf (pos, "%s%s%i\\n", is_pointer ? "*" : " ", arg_name,
+                 *arg_num);
+      pos += strlen (pos);
+
+      if (arg_num)
+        {
+          if (*arg_num == 0)
+            *arg_num = 2;
+          else
+            *arg_num += 1;
+        }
     }
 
   pos = flags;
@@ -609,9 +652,12 @@ output_object_signal (FILE *fp,
     *pos++ = 'h';
   *pos = 0;
 
+  /* Output the return type and function name. */
+  ret_type = get_type_name (query_info.return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE, &is_pointer);
+
   fprintf (fp,
-          "<SIGNAL>\\n<NAME>%s::%s</NAME>\\n<RETURNS>%s</RETURNS>\\n<FLAGS>%s</FLAGS>\\n%s</SIGNAL>\\n\\n",
-          object_name, query_info.signal_name, ret_type_buffer, flags, buffer);
+          "<SIGNAL>\\n<NAME>%s::%s</NAME>\\n<RETURNS>%s%s</RETURNS>\\n<FLAGS>%s</FLAGS>\\n%s</SIGNAL>\\n\\n",
+          object_name, query_info.signal_name, ret_type, is_pointer ? "*" : "", flags, buffer);
 }
 
 
@@ -662,7 +708,13 @@ get_type_name (GType type, gboolean * is_pointer)
     *is_pointer = TRUE;
     return "GParamSpec";
 
-  default:
+#if GLIB_CHECK_VERSION (2, 25, 9)
+  case G_TYPE_VARIANT:
+    *is_pointer = TRUE;
+    return "GVariant";
+#endif
+
+default:
     break;
   }
 
@@ -671,11 +723,14 @@ get_type_name (GType type, gboolean * is_pointer)
   if (g_type_is_a (type, G_TYPE_OBJECT))
     *is_pointer = TRUE;
 
+  /* Also catch non GObject root types */
   if (G_TYPE_IS_CLASSED (type))
     *is_pointer = TRUE;
 
   /* All boxed subtypes will be pointers as well. */
-  if (g_type_is_a (type, G_TYPE_BOXED))
+  /* Exception: GStrv */
+  if (g_type_is_a (type, G_TYPE_BOXED) &&
+      !g_type_is_a (type, G_TYPE_STRV))
     *is_pointer = TRUE;
 
   /* All pointer subtypes will be pointers as well. */
@@ -691,323 +746,57 @@ get_type_name (GType type, gboolean * is_pointer)
 }
 
 
-static const gchar *
-get_gdk_event (const gchar * signal_name)
-{
-  static const gchar *GbGDKEvents[] =
-  {
-    "button_press_event", "GdkEventButton",
-    "button_release_event", "GdkEventButton",
-    "motion_notify_event", "GdkEventMotion",
-    "delete_event", "GdkEvent",
-    "destroy_event", "GdkEvent",
-    "expose_event", "GdkEventExpose",
-    "key_press_event", "GdkEventKey",
-    "key_release_event", "GdkEventKey",
-    "enter_notify_event", "GdkEventCrossing",
-    "leave_notify_event", "GdkEventCrossing",
-    "configure_event", "GdkEventConfigure",
-    "focus_in_event", "GdkEventFocus",
-    "focus_out_event", "GdkEventFocus",
-    "map_event", "GdkEvent",
-    "unmap_event", "GdkEvent",
-    "property_notify_event", "GdkEventProperty",
-    "selection_clear_event", "GdkEventSelection",
-    "selection_request_event", "GdkEventSelection",
-    "selection_notify_event", "GdkEventSelection",
-    "proximity_in_event", "GdkEventProximity",
-    "proximity_out_event", "GdkEventProximity",
-    "drag_begin_event", "GdkEventDragBegin",
-    "drag_request_event", "GdkEventDragRequest",
-    "drag_end_event", "GdkEventDragRequest",
-    "drop_enter_event", "GdkEventDropEnter",
-    "drop_leave_event", "GdkEventDropLeave",
-    "drop_data_available_event", "GdkEventDropDataAvailable",
-    "other_event", "GdkEventOther",
-    "client_event", "GdkEventClient",
-    "no_expose_event", "GdkEventNoExpose",
-    "visibility_notify_event", "GdkEventVisibility",
-    "window_state_event", "GdkEventWindowState",
-    "scroll_event", "GdkEventScroll",
-    NULL
-  };
-
-  gint i;
-
-  for (i = 0; GbGDKEvents[i]; i += 2)
-    {
-      if (!strcmp (signal_name, GbGDKEvents[i]))
-       return GbGDKEvents[i + 1];
-    }
-  return "GdkEvent";
-}
-
-
-/* This returns argument names to use for some known GTK signals.
-    It is passed a widget name, e.g. 'GtkCList' and a signal name, e.g.
-    'select_row' and it returns a pointer to an array of argument types and
-    names. */
-static const gchar **
-lookup_signal_arg_names (const gchar * type, const gchar * signal_name)
-{
-  /* Each arg array starts with the object type name and the signal name,
-     and then signal arguments follow. */
-  static const gchar *GbArgTable[][16] =
-  {
-    {"GtkCList", "select_row",
-     "gint             row",
-     "gint             column",
-     "GdkEventButton  *event"},
-    {"GtkCList", "unselect_row",
-     "gint             row",
-     "gint             column",
-     "GdkEventButton  *event"},
-    {"GtkCList", "click_column",
-     "gint             column"},
-
-    {"GtkCList", "resize_column",
-     "gint             column",
-     "gint             width"},
-
-    {"GtkCList", "extend_selection",
-     "GtkScrollType    scroll_type",
-     "gfloat           position",
-     "gboolean         auto_start_selection"},
-    {"GtkCList", "scroll_vertical",
-     "GtkScrollType    scroll_type",
-     "gfloat           position"},
-    {"GtkCList", "scroll_horizontal",
-     "GtkScrollType    scroll_type",
-     "gfloat           position"},
-
-    {"GtkCTree", "tree_select_row",
-     "GtkCTreeNode    *node",
-     "gint             column"},
-    {"GtkCTree", "tree_unselect_row",
-     "GtkCTreeNode    *node",
-     "gint             column"},
-    {"GtkCTree", "tree_expand",
-     "GtkCTreeNode    *node"},
-    {"GtkCTree", "tree_collapse",
-     "GtkCTreeNode    *node"},
-    {"GtkCTree", "tree_move",
-     "GtkCTreeNode    *node",
-     "GtkCTreeNode    *new_parent",
-     "GtkCTreeNode    *new_sibling"},
-    {"GtkCTree", "change_focus_row_expansion",
-     "GtkCTreeExpansionType expansion"},
-
-    {"GtkEditable", "insert_text",
-     "gchar           *new_text",
-     "gint             new_text_length",
-     "gint            *position"},
-    {"GtkEditable", "delete_text",
-     "gint             start_pos",
-     "gint             end_pos"},
-    {"GtkEditable", "set_editable",
-     "gboolean         is_editable"},
-    {"GtkEditable", "move_cursor",
-     "gint             x",
-     "gint             y"},
-    {"GtkEditable", "move_word",
-     "gint             num_words"},
-    {"GtkEditable", "move_page",
-     "gint             x",
-     "gint             y"},
-    {"GtkEditable", "move_to_row",
-     "gint             row"},
-    {"GtkEditable", "move_to_column",
-     "gint             column"},
-
-    {"GtkEditable", "kill_char",
-     "gint             direction"},
-    {"GtkEditable", "kill_word",
-     "gint             direction"},
-    {"GtkEditable", "kill_line",
-     "gint             direction"},
-
-
-    {"GtkInputDialog", "enable_device",
-     "GdkDevice       *deviceid"},
-    {"GtkInputDialog", "disable_device",
-     "GdkDevice       *deviceid"},
-
-    {"GtkListItem", "extend_selection",
-     "GtkScrollType    scroll_type",
-     "gfloat           position",
-     "gboolean         auto_start_selection"},
-    {"GtkListItem", "scroll_vertical",
-     "GtkScrollType    scroll_type",
-     "gfloat           position"},
-    {"GtkListItem", "scroll_horizontal",
-     "GtkScrollType    scroll_type",
-     "gfloat           position"},
-
-    {"GtkMenuShell", "move_current",
-     "GtkMenuDirectionType direction"},
-    {"GtkMenuShell", "activate_current",
-     "gboolean         force_hide"},
-
-
-    {"GtkNotebook", "switch_page",
-     "GtkNotebookPage *page",
-     "guint            page_num"},
-    {"GtkStatusbar", "text_pushed",
-     "guint            context_id",
-     "gchar           *text"},
-    {"GtkStatusbar", "text_popped",
-     "guint            context_id",
-     "gchar           *text"},
-    {"GtkTipsQuery", "widget_entered",
-     "GtkWidget       *widget",
-     "gchar           *tip_text",
-     "gchar           *tip_private"},
-    {"GtkTipsQuery", "widget_selected",
-     "GtkWidget       *widget",
-     "gchar           *tip_text",
-     "gchar           *tip_private",
-     "GdkEventButton  *event"},
-    {"GtkToolbar", "orientation_changed",
-     "GtkOrientation   orientation"},
-    {"GtkToolbar", "style_changed",
-     "GtkToolbarStyle  style"},
-    {"GtkWidget", "draw",
-     "GdkRectangle    *area"},
-    {"GtkWidget", "size_request",
-     "GtkRequisition  *requisition"},
-    {"GtkWidget", "size_allocate",
-     "GtkAllocation   *allocation"},
-    {"GtkWidget", "state_changed",
-     "GtkStateType     state"},
-    {"GtkWidget", "style_set",
-     "GtkStyle        *previous_style"},
-
-    {"GtkWidget", "install_accelerator",
-     "gchar           *signal_name",
-     "gchar            key",
-     "gint             modifiers"},
-
-    {"GtkWidget", "add_accelerator",
-     "guint            accel_signal_id",
-     "GtkAccelGroup   *accel_group",
-     "guint            accel_key",
-     "GdkModifierType  accel_mods",
-     "GtkAccelFlags    accel_flags"},
-
-    {"GtkWidget", "parent_set",
-     "GtkObject       *old_parent"},
-
-    {"GtkWidget", "remove_accelerator",
-     "GtkAccelGroup   *accel_group",
-     "guint            accel_key",
-     "GdkModifierType  accel_mods"},
-    {"GtkWidget", "debug_msg",
-     "gchar           *message"},
-    {"GtkWindow", "move_resize",
-     "gint            *x",
-     "gint            *y",
-     "gint             width",
-     "gint             height"},
-    {"GtkWindow", "set_focus",
-     "GtkWidget       *widget"},
-
-    {"GtkWidget", "selection_get",
-     "GtkSelectionData *data",
-     "guint            info",
-     "guint            time"},
-    {"GtkWidget", "selection_received",
-     "GtkSelectionData *data",
-     "guint            time"},
-
-    {"GtkWidget", "drag_begin",
-     "GdkDragContext  *drag_context"},
-    {"GtkWidget", "drag_end",
-     "GdkDragContext  *drag_context"},
-    {"GtkWidget", "drag_data_delete",
-     "GdkDragContext  *drag_context"},
-    {"GtkWidget", "drag_leave",
-     "GdkDragContext  *drag_context",
-     "guint            time"},
-    {"GtkWidget", "drag_motion",
-     "GdkDragContext  *drag_context",
-     "gint             x",
-     "gint             y",
-     "guint            time"},
-    {"GtkWidget", "drag_drop",
-     "GdkDragContext  *drag_context",
-     "gint             x",
-     "gint             y",
-     "guint            time"},
-    {"GtkWidget", "drag_data_get",
-     "GdkDragContext  *drag_context",
-     "GtkSelectionData *data",
-     "guint            info",
-     "guint            time"},
-    {"GtkWidget", "drag_data_received",
-     "GdkDragContext  *drag_context",
-     "gint             x",
-     "gint             y",
-     "GtkSelectionData *data",
-     "guint            info",
-     "guint            time"},
-
-    {NULL}
-  };
-
-  gint i;
-
-  for (i = 0; GbArgTable[i][0]; i++)
-    {
-#if 1
-      if (!strcmp (type, GbArgTable[i][0])
-         && !strcmp (signal_name, GbArgTable[i][1]))
-       return &GbArgTable[i][2];
-#endif
-    }
-  return NULL;
-}
-
 /* This outputs the hierarchy of all objects which have been initialized,
    i.e. by calling their XXX_get_type() initialization function. */
 static void
 output_object_hierarchy (void)
 {
   FILE *fp;
-  gint i;
+  gint i,j;
+  GType root, type;
+  GType root_types[$ntypes] = { G_TYPE_INVALID, };
 
   fp = fopen (hierarchy_filename, "w");
   if (fp == NULL)
     {
-      g_warning ("Couldn't open output file: %s : %s", hierarchy_filename, strerror(errno));
+      g_warning ("Couldn't open output file: %s : %s", hierarchy_filename, g_strerror(errno));
       return;
     }
   output_hierarchy (fp, G_TYPE_OBJECT, 0);
   output_hierarchy (fp, G_TYPE_INTERFACE, 0);
 
   for (i=0; object_types[i]; i++) {
-    if (!g_type_parent (object_types[i]) &&
-      (object_types[i] != G_TYPE_NONE) &&
-      (object_types[i] != G_TYPE_OBJECT) &&
-      (object_types[i] != G_TYPE_INTERFACE)
-    ) {
-      g_warning ("printing hierarchy for root type: %s",
-          g_type_name (object_types[i]));
-      output_hierarchy (fp, object_types[i], 0);
+    root = object_types[i];
+    while ((type = g_type_parent (root))) {
+      root = type;
     }
-  }
-  /* for debugging
-  for (i=0; object_types[i]; i++) {
-    if(object_types[i] != G_TYPE_NONE) {
-      g_print ("type has not been added to hierarchy: %s\\n",
-        g_type_name (object_types[i]));
+    if ((root != G_TYPE_OBJECT) && (root != G_TYPE_INTERFACE)) {
+      for (j=0; root_types[j]; j++) {
+        if (root == root_types[j]) {
+          root = G_TYPE_INVALID; break;
+        }
+      }
+      if(root) {
+        root_types[j] = root;
+        output_hierarchy (fp, root, 0);
+      }
     }
   }
-  for debugging */
 
   fclose (fp);
 }
 
-/* This is called recursively to output the hierarchy of a widget. */
+static int
+compare_types (const void *a, const void *b)
+{
+  const char *na = g_type_name (*((GType *)a));
+  const char *nb = g_type_name (*((GType *)b));
+
+  return g_strcmp0 (na, nb);
+}
+
+
+/* This is called recursively to output the hierarchy of a object. */
 static void
 output_hierarchy (FILE  *fp,
                  GType  type,
@@ -1020,27 +809,16 @@ output_hierarchy (FILE  *fp,
   if (!type)
     return;
 
-  /* for debugging
-  for (i=0; object_types[i]; i++) {
-    if(object_types[i] == type) {
-      g_print ("added type to hierarchy (level %d): %s\\n",
-        level, g_type_name (type));
-      object_types[i] = G_TYPE_NONE;
-      break;
-    }
-  }
-  for debugging */
-
   for (i = 0; i < level; i++)
     fprintf (fp, "  ");
-  fprintf (fp, "%s", g_type_name (type));
-  fprintf (fp, "\\n");
+  fprintf (fp, "%s\\n", g_type_name (type));
 
   children = g_type_children (type, &n_children);
+  qsort (children, n_children, sizeof (GType), compare_types);
+
 
-  for (i=0; i < n_children; i++) {
+  for (i=0; i < n_children; i++)
     output_hierarchy (fp, children[i], level + 1);
-  }
 
   g_free (children);
 }
@@ -1053,7 +831,7 @@ static void output_object_interfaces (void)
   fp = fopen (interfaces_filename, "w");
   if (fp == NULL)
     {
-      g_warning ("Couldn't open output file: %s : %s", interfaces_filename, strerror(errno));
+      g_warning ("Couldn't open output file: %s : %s", interfaces_filename, g_strerror(errno));
       return;
     }
   output_interfaces (fp, G_TYPE_OBJECT);
@@ -1107,7 +885,7 @@ static void output_interface_prerequisites (void)
   fp = fopen (prerequisites_filename, "w");
   if (fp == NULL)
     {
-      g_warning ("Couldn't open output file: %s : %s", prerequisites_filename, strerror(errno));
+      g_warning ("Couldn't open output file: %s : %s", prerequisites_filename, g_strerror(errno));
       return;
     }
   output_prerequisites (fp, G_TYPE_INTERFACE);
@@ -1155,7 +933,7 @@ output_args (void)
   fp = fopen (args_filename, "w");
   if (fp == NULL)
     {
-      g_warning ("Couldn't open output file: %s : %s", args_filename, strerror(errno));
+      g_warning ("Couldn't open output file: %s : %s", args_filename, g_strerror(errno));
       return;
     }
 
@@ -1200,63 +978,100 @@ describe_double_constant (gdouble value)
     desc = g_strdup ("G_MINFLOAT");
   else if (GTKDOC_COMPARE_FLOAT (value, -G_MAXFLOAT))
     desc = g_strdup ("-G_MAXFLOAT");
-  else
-    desc = g_strdup_printf ("%lg", value);
+  else{
+    /* make sure floats are output with a decimal dot irrespective of
+    * current locale. Use formatd since we want human-readable numbers
+    * and do not need the exact same bit representation when deserialising */
+    desc = g_malloc0 (G_ASCII_DTOSTR_BUF_SIZE);
+    g_ascii_formatd (desc, G_ASCII_DTOSTR_BUF_SIZE, "%g", value);
+  }
 
   return desc;
 }
 
 static gchar*
-describe_signed_constant (gint64 value)
+describe_signed_constant (gsize size, gint64 value)
 {
-  gchar *desc;
-
-  if (value == G_MAXINT)
-    desc = g_strdup ("G_MAXINT");
-  else if (value == G_MININT)
-    desc = g_strdup ("G_MININT");
-  else if (value == G_MAXUINT)
-    desc = g_strdup ("G_MAXUINT");
-  else if (value == G_MAXLONG)
-    desc = g_strdup ("G_MAXLONG");
-  else if (value == G_MINLONG)
-    desc = g_strdup ("G_MINLONG");
-  else if (value == G_MAXULONG)
-    desc = g_strdup ("G_MAXULONG");
-  else if (value == G_MAXINT64)
-    desc = g_strdup ("G_MAXINT64");
-  else if (value == G_MININT64)
-    desc = g_strdup ("G_MININT64");
-  else
+  gchar *desc = NULL;
+
+  switch (size) {
+    case 8:
+      if (value == G_MAXINT64)
+        desc = g_strdup ("G_MAXINT64");
+      else if (value == G_MININT64)
+        desc = g_strdup ("G_MININT64");
+      /* fall through */
+    case 4:
+      if (sizeof (int) == 4) {
+        if (value == G_MAXINT)
+          desc = g_strdup ("G_MAXINT");
+        else if (value == G_MININT)
+          desc = g_strdup ("G_MININT");
+        else if (value == (gint64)G_MAXUINT)
+          desc = g_strdup ("G_MAXUINT");
+      }
+      if (value == G_MAXLONG)
+        desc = g_strdup ("G_MAXLONG");
+      else if (value == G_MINLONG)
+        desc = g_strdup ("G_MINLONG");
+      else if (value == (gint64)G_MAXULONG)
+        desc = g_strdup ("G_MAXULONG");
+      /* fall through */
+    case 2:
+      if (sizeof (int) == 2) {
+        if (value == G_MAXINT)
+          desc = g_strdup ("G_MAXINT");
+        else if (value == G_MININT)
+          desc = g_strdup ("G_MININT");
+        else if (value == (gint64)G_MAXUINT)
+          desc = g_strdup ("G_MAXUINT");
+      }
+      break;
+    default:
+      break;
+  }
+  if (!desc)
     desc = g_strdup_printf ("%" G_GINT64_FORMAT, value);
 
   return desc;
 }
 
 static gchar*
-describe_unsigned_constant (guint64 value)
+describe_unsigned_constant (gsize size, guint64 value)
 {
-  gchar *desc;
-
-  if (value == G_MAXINT)
-    desc = g_strdup ("G_MAXINT");
-  else if (value == G_MININT)
-    desc = g_strdup ("G_MININT");
-  else if (value == G_MAXUINT)
-    desc = g_strdup ("G_MAXUINT");
-  else if (value == G_MAXLONG)
-    desc = g_strdup ("G_MAXLONG");
-  else if (value == G_MINLONG)
-    desc = g_strdup ("G_MINLONG");
-  else if (value == G_MAXULONG)
-    desc = g_strdup ("G_MAXULONG");
-  else if (value == G_MAXINT64)
-    desc = g_strdup ("G_MAXINT64");
-  else if (value == G_MININT64)
-    desc = g_strdup ("G_MININT64");
-  else if (value == G_MAXUINT64)
-    desc = g_strdup ("G_MAXUINT64");
-  else
+  gchar *desc = NULL;
+
+  switch (size) {
+    case 8:
+      if (value == G_MAXINT64)
+        desc = g_strdup ("G_MAXINT64");
+      else if (value == G_MAXUINT64)
+        desc = g_strdup ("G_MAXUINT64");
+      /* fall through */
+    case 4:
+      if (sizeof (int) == 4) {
+        if (value == (guint64)G_MAXINT)
+          desc = g_strdup ("G_MAXINT");
+        else if (value == G_MAXUINT)
+          desc = g_strdup ("G_MAXUINT");
+      }
+      if (value == (guint64)G_MAXLONG)
+        desc = g_strdup ("G_MAXLONG");
+      else if (value == G_MAXULONG)
+        desc = g_strdup ("G_MAXULONG");
+      /* fall through */
+    case 2:
+      if (sizeof (int) == 2) {
+        if (value == (guint64)G_MAXINT)
+          desc = g_strdup ("G_MAXINT");
+        else if (value == G_MAXUINT)
+          desc = g_strdup ("G_MAXUINT");
+      }
+      break;
+    default:
+      break;
+  }
+  if (!desc)
     desc = g_strdup_printf ("%" G_GUINT64_FORMAT, value);
 
   return desc;
@@ -1273,8 +1088,8 @@ describe_type (GParamSpec *spec)
     {
       GParamSpecChar *pspec = G_PARAM_SPEC_CHAR (spec);
 
-      lower = describe_signed_constant (pspec->minimum);
-      upper = describe_signed_constant (pspec->maximum);
+      lower = describe_signed_constant (sizeof(gchar), pspec->minimum);
+      upper = describe_signed_constant (sizeof(gchar), pspec->maximum);
       if (pspec->minimum == G_MININT8 && pspec->maximum == G_MAXINT8)
        desc = g_strdup ("");
       else if (pspec->minimum == G_MININT8)
@@ -1290,8 +1105,8 @@ describe_type (GParamSpec *spec)
     {
       GParamSpecUChar *pspec = G_PARAM_SPEC_UCHAR (spec);
 
-      lower = describe_unsigned_constant (pspec->minimum);
-      upper = describe_unsigned_constant (pspec->maximum);
+      lower = describe_unsigned_constant (sizeof(guchar), pspec->minimum);
+      upper = describe_unsigned_constant (sizeof(guchar), pspec->maximum);
       if (pspec->minimum == 0 && pspec->maximum == G_MAXUINT8)
        desc = g_strdup ("");
       else if (pspec->minimum == 0)
@@ -1307,8 +1122,8 @@ describe_type (GParamSpec *spec)
     {
       GParamSpecInt *pspec = G_PARAM_SPEC_INT (spec);
 
-      lower = describe_signed_constant (pspec->minimum);
-      upper = describe_signed_constant (pspec->maximum);
+      lower = describe_signed_constant (sizeof(gint), pspec->minimum);
+      upper = describe_signed_constant (sizeof(gint), pspec->maximum);
       if (pspec->minimum == G_MININT && pspec->maximum == G_MAXINT)
        desc = g_strdup ("");
       else if (pspec->minimum == G_MININT)
@@ -1324,8 +1139,8 @@ describe_type (GParamSpec *spec)
     {
       GParamSpecUInt *pspec = G_PARAM_SPEC_UINT (spec);
 
-      lower = describe_unsigned_constant (pspec->minimum);
-      upper = describe_unsigned_constant (pspec->maximum);
+      lower = describe_unsigned_constant (sizeof(guint), pspec->minimum);
+      upper = describe_unsigned_constant (sizeof(guint), pspec->maximum);
       if (pspec->minimum == 0 && pspec->maximum == G_MAXUINT)
        desc = g_strdup ("");
       else if (pspec->minimum == 0)
@@ -1341,8 +1156,8 @@ describe_type (GParamSpec *spec)
     {
       GParamSpecLong *pspec = G_PARAM_SPEC_LONG (spec);
 
-      lower = describe_signed_constant (pspec->minimum);
-      upper = describe_signed_constant (pspec->maximum);
+      lower = describe_signed_constant (sizeof(glong), pspec->minimum);
+      upper = describe_signed_constant (sizeof(glong), pspec->maximum);
       if (pspec->minimum == G_MINLONG && pspec->maximum == G_MAXLONG)
        desc = g_strdup ("");
       else if (pspec->minimum == G_MINLONG)
@@ -1357,10 +1172,9 @@ describe_type (GParamSpec *spec)
   else if (G_IS_PARAM_SPEC_ULONG (spec))
     {
       GParamSpecULong *pspec = G_PARAM_SPEC_ULONG (spec);
-      gchar *upper;
 
-      lower = describe_unsigned_constant (pspec->minimum);
-      upper = describe_unsigned_constant (pspec->maximum);
+      lower = describe_unsigned_constant (sizeof(gulong), pspec->minimum);
+      upper = describe_unsigned_constant (sizeof(gulong), pspec->maximum);
       if (pspec->minimum == 0 && pspec->maximum == G_MAXULONG)
        desc = g_strdup ("");
       else if (pspec->minimum == 0)
@@ -1376,8 +1190,8 @@ describe_type (GParamSpec *spec)
     {
       GParamSpecInt64 *pspec = G_PARAM_SPEC_INT64 (spec);
 
-      lower = describe_signed_constant (pspec->minimum);
-      upper = describe_signed_constant (pspec->maximum);
+      lower = describe_signed_constant (sizeof(gint64), pspec->minimum);
+      upper = describe_signed_constant (sizeof(gint64), pspec->maximum);
       if (pspec->minimum == G_MININT64 && pspec->maximum == G_MAXINT64)
        desc = g_strdup ("");
       else if (pspec->minimum == G_MININT64)
@@ -1393,8 +1207,8 @@ describe_type (GParamSpec *spec)
     {
       GParamSpecUInt64 *pspec = G_PARAM_SPEC_UINT64 (spec);
 
-      lower = describe_unsigned_constant (pspec->minimum);
-      upper = describe_unsigned_constant (pspec->maximum);
+      lower = describe_unsigned_constant (sizeof(guint64), pspec->minimum);
+      upper = describe_unsigned_constant (sizeof(guint64), pspec->maximum);
       if (pspec->minimum == 0 && pspec->maximum == G_MAXUINT64)
        desc = g_strdup ("");
       else if (pspec->minimum == 0)
@@ -1446,6 +1260,26 @@ describe_type (GParamSpec *spec)
       g_free (lower);
       g_free (upper);
     }
+#if GLIB_CHECK_VERSION (2, 12, 0)
+  else if (G_IS_PARAM_SPEC_GTYPE (spec))
+    {
+      GParamSpecGType *pspec = G_PARAM_SPEC_GTYPE (spec);
+      gboolean is_pointer;
+
+      desc = g_strdup (get_type_name (pspec->is_a_type, &is_pointer));
+    }
+#endif
+#if GLIB_CHECK_VERSION (2, 25, 9)
+  else if (G_IS_PARAM_SPEC_VARIANT (spec))
+    {
+      GParamSpecVariant *pspec = G_PARAM_SPEC_VARIANT (spec);
+      gchar *variant_type;
+
+      variant_type = g_variant_type_dup_string (pspec->type);
+      desc = g_strdup_printf ("GVariant<%s>", variant_type);
+      g_free (variant_type);
+    }
+#endif
   else
     {
       desc = g_strdup ("");
@@ -1567,13 +1401,23 @@ describe_default (GParamSpec *spec)
     {
       GParamSpecFloat *pspec = G_PARAM_SPEC_FLOAT (spec);
 
-      desc = g_strdup_printf ("%g", pspec->default_value);
+      /* make sure floats are output with a decimal dot irrespective of
+       * current locale. Use formatd since we want human-readable numbers
+       * and do not need the exact same bit representation when deserialising */
+      desc = g_malloc0 (G_ASCII_DTOSTR_BUF_SIZE);
+      g_ascii_formatd (desc, G_ASCII_DTOSTR_BUF_SIZE, "%g",
+          pspec->default_value);
     }
   else if (G_IS_PARAM_SPEC_DOUBLE (spec))
     {
       GParamSpecDouble *pspec = G_PARAM_SPEC_DOUBLE (spec);
 
-      desc = g_strdup_printf ("%lg", pspec->default_value);
+      /* make sure floats are output with a decimal dot irrespective of
+       * current locale. Use formatd since we want human-readable numbers
+       * and do not need the exact same bit representation when deserialising */
+      desc = g_malloc0 (G_ASCII_DTOSTR_BUF_SIZE);
+      g_ascii_formatd (desc, G_ASCII_DTOSTR_BUF_SIZE, "%g",
+          pspec->default_value);
     }
   else if (G_IS_PARAM_SPEC_STRING (spec))
     {
@@ -1697,6 +1541,14 @@ output_object_args (FILE *fp, GType object_type)
     }
 #endif
 
+#ifdef GTK_IS_CELL_AREA_CLASS
+    if (!child_prop && GTK_IS_CELL_AREA_CLASS (class)) {
+      properties = gtk_cell_area_class_list_cell_properties (class, &n_properties);
+      child_prop = TRUE;
+      continue;
+    }
+#endif
+
 #ifdef GTK_IS_WIDGET_CLASS
 #if GTK_CHECK_VERSION(2,1,0)
     if (!style_prop && GTK_IS_WIDGET_CLASS (class)) {
@@ -1718,7 +1570,7 @@ close OUTPUT;
 
 $CC = $ENV{CC} ? $ENV{CC} : "gcc";
 $LD = $ENV{LD} ? $ENV{LD} : $CC;
-$CFLAGS = $ENV{CFLAGS} ? "$ENV{CFLAGS} -Wall -g" : "-Wall -g";
+$CFLAGS = $ENV{CFLAGS} ? "$ENV{CFLAGS}" : "";
 $LDFLAGS = $ENV{LDFLAGS} ? $ENV{LDFLAGS} : "";
 
 my $o_file;
@@ -1728,25 +1580,30 @@ if ($CC =~ /libtool/) {
   $o_file = "$MODULE-scan.o"
 }
 
-print "gtk-doc: Compiling scanner\n";
-$command = "$CC $CFLAGS -c -o $o_file $MODULE-scan.c";
-system($command) == 0 or die "Compilation of scanner failed: $!\n";
+my $stdout="";
+if (!defined($VERBOSE) or $VERBOSE eq "0") {
+    $stdout=">/dev/null";
+}
 
-print "gtk-doc: Linking scanner\n";
-$command = "$LD -o $MODULE-scan $o_file $LDFLAGS";
+# Compiling scanner
+$command = "$CC $stdout $CFLAGS -c -o $o_file $MODULE-scan.c";
+system("($command)") == 0 or die "Compilation of scanner failed: $!\n";
+
+# Linking scanner
+$command = "$LD $stdout -o $MODULE-scan $o_file $LDFLAGS";
 system($command) == 0 or die "Linking of scanner failed: $!\n";
 
-print "gtk-doc: Running scanner $MODULE-scan\n";
+# Running scanner $MODULE-scan ";
 system("sh -c ./$MODULE-scan") == 0 or die "Scan failed: $!\n";
 
 if (!defined($ENV{"GTK_DOC_KEEP_INTERMEDIATE"})) {
   unlink "./$MODULE-scan.c", "./$MODULE-scan.o", "./$MODULE-scan.lo", "./$MODULE-scan";
 }
 
-#&UpdateFileIfChanged ($old_signals_filename, $new_signals_filename, 0);
 &UpdateFileIfChanged ($old_hierarchy_filename, $new_hierarchy_filename, 0);
-&UpdateFileIfChanged ($old_interfaces_filename, $new_interfaces_filename, 0);
-&UpdateFileIfChanged ($old_prerequisites_filename, $new_prerequisites_filename, 0);
+# we will merge these in scangobj-merge.py
+#&UpdateFileIfChanged ($old_interfaces_filename, $new_interfaces_filename, 0);
+#&UpdateFileIfChanged ($old_prerequisites_filename, $new_prerequisites_filename, 0);
+#&UpdateFileIfChanged ($old_signals_filename, $new_signals_filename, 0);
 #&UpdateFileIfChanged ($old_args_filename, $new_args_filename, 0);
 
-