Updated Spanish translation
[gtk-doc.git] / gtkdoc-scangobj.in
blobd5aa0ba21ffce20658417b879913ec4ff324e24c
1 #!@PERL@ -w
2 # -*- cperl -*-
4 # gtk-doc - GTK DocBook documentation generator.
5 # Copyright (C) 1998  Damon Chaplin
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 # This gets information about object hierarchies and signals
24 # by compiling a small C program. CFLAGS and LDFLAGS must be
25 # set appropriately before running this script.
28 use Getopt::Long;
30 push @INC, '@PACKAGE_DATA_DIR@';
31 require "gtkdoc-common.pl";
33 # Options
35 # name of documentation module
36 my $MODULE;
37 my $OUTPUT_DIR;
38 my $VERBOSE;
39 my $PRINT_VERSION;
40 my $PRINT_HELP;
41 my $TYPE_INIT_FUNC="#if !GLIB_CHECK_VERSION(2,35,0)\n  g_type_init();\n  #endif\n  g_type_class_ref(G_TYPE_OBJECT)";
42 my $QUERY_CHILD_PROPERTIES;
44 my $CC;
45 my $LD;
46 my $CFLAGS;
47 my $LDFLAGS;
48 my $RUN;
50 # --nogtkinit is deprecated, as it is the default now anyway.
51 %optctl = (module => \$MODULE,
52            types => \$TYPES_FILE,
53            nogtkinit => \$NO_GTK_INIT,
54            'type-init-func' => \$TYPE_INIT_FUNC,
55            'query-child-properties' => \$QUERY_CHILD_PROPERTIES,
56            'output-dir' => \$OUTPUT_DIR,
57            'cc' => \$CC,
58            'ld' => \$LD,
59            'cflags' => \$CFLAGS,
60            'ldflags' => \$LDFLAGS,
61            'run' => \$RUN,
62            'verbose' => \$VERBOSE,
63            'version' => \$PRINT_VERSION,
64            'help' => \$PRINT_HELP);
66 GetOptions(\%optctl, "module=s", "types:s", "output-dir:s", "nogtkinit", "type-init-func:s", "query-child-properties:s", "cc:s", "ld:s", "run:s", "cflags:s", "ldflags:s", "verbose", "version", "help");
68 if ($NO_GTK_INIT) {
69   # Do nothing. This just avoids a warning.
70   # the option is not used anymore
73 if ($PRINT_VERSION) {
74     print "@VERSION@\n";
75     exit 0;
78 if (!$MODULE) {
79     $PRINT_HELP = 1;
82 if ($PRINT_HELP) {
83     print <<EOF;
84 gtkdoc-scangobj version @VERSION@ - introspect g-objects
86 --module=MODULE_NAME          Name of the doc module being parsed
87 --types=FILE                  The name of the file to store the types in
88 --type-init-func=FUNC         The init function to call instead of g_type_init()
89 --query-child-properties=FUNC A function that returns a list of child
90                               properties for a class
91 --output-dir=DIRNAME          The directory where the results are stored
92 --cc=COMPILER                 The compiler to use
93 --ld=LINKER                   The linker to use
94 --run=RUN                     Command for running the scanner
95 --cflags=CFLAGS               Compiler flags
96 --ldflags=LDFLAGS             Linker flags
97 --verbose                     Print extra output while processing
98 --version                     Print the version of this program
99 --help                        Print this help
101     exit 0;
104 $OUTPUT_DIR = $OUTPUT_DIR ? $OUTPUT_DIR : ".";
106 $TYPES_FILE = $TYPES_FILE ? $TYPES_FILE : "$OUTPUT_DIR/$MODULE.types";
108 open (TYPES, $TYPES_FILE) || die "Cannot open $TYPES_FILE: $!\n";
109 open (OUTPUT, ">$MODULE-scan.c") || die "Cannot open $MODULE-scan.c: $!\n";
111 my $old_signals_filename = "$OUTPUT_DIR/$MODULE.signals";
112 my $new_signals_filename = "$OUTPUT_DIR/$MODULE.signals.new";
113 my $old_hierarchy_filename = "$OUTPUT_DIR/$MODULE.hierarchy";
114 my $new_hierarchy_filename = "$OUTPUT_DIR/$MODULE.hierarchy.new";
115 my $old_interfaces_filename = "$OUTPUT_DIR/$MODULE.interfaces";
116 my $new_interfaces_filename = "$OUTPUT_DIR/$MODULE.interfaces.new";
117 my $old_prerequisites_filename = "$OUTPUT_DIR/$MODULE.prerequisites";
118 my $new_prerequisites_filename = "$OUTPUT_DIR/$MODULE.prerequisites.new";
119 my $old_args_filename = "$OUTPUT_DIR/$MODULE.args";
120 my $new_args_filename = "$OUTPUT_DIR/$MODULE.args.new";
122 # write a C program to scan the types
124 $includes = "";
125 @types = ();
127 for (<TYPES>) {
128     if (/^#include/) {
129         $includes .= $_;
130     } elsif (/^gnome_keyring_item_info_get_type$/) {
131         # HACK: This isn't really a GObject type so skip it.
132         next;
133     } elsif (/^%/) {
134         next;
135     } elsif (/^\s*$/) {
136         next;
137     } else {
138         chomp;
139         push @types, $_;
140     }
143 $ntypes = @types + 1;
145 print OUTPUT <<EOT;
146 #include <string.h>
147 #include <stdlib.h>
148 #include <stdio.h>
149 #include <errno.h>
150 #include <glib-object.h>
154 if ($includes) {
155     print OUTPUT $includes;
156 } else {
157     for (@types) {
158         print OUTPUT "extern GType $_ (void);\n";
159     }
162 if ($QUERY_CHILD_PROPERTIES) {
163   print OUTPUT <<EOT;
164 extern GParamSpec** $QUERY_CHILD_PROPERTIES (gpointer class, guint *n_properties);
168 print OUTPUT <<EOT;
170 #ifdef GTK_IS_WIDGET_CLASS
171 #include <gtk/gtk.h>
172 #endif
173 GType object_types[$ntypes];
175 static GType *
176 get_object_types (void)
178     gpointer g_object_class;
179     gint i = 0;
182 for (@types) {
183     print OUTPUT "    object_types[i++] = $_ ();\n";
186 print OUTPUT <<EOT;
187     object_types[i] = 0;
189     /* reference the GObjectClass to initialize the param spec pool
190      * potentially needed by interfaces. See http://bugs.gnome.org/571820 */
191     g_object_class = g_type_class_ref (G_TYPE_OBJECT);
193     /* Need to make sure all the types are loaded in and initialize
194      * their signals and properties.
195      */
196     for (i=0; object_types[i]; i++)
197       {
198         if (G_TYPE_IS_CLASSED (object_types[i]))
199           g_type_class_ref (object_types[i]);
200         if (G_TYPE_IS_INTERFACE (object_types[i]))
201           g_type_default_interface_ref (object_types[i]);
202       }
204     g_type_class_unref (g_object_class);
206     return object_types;
210  * This uses GObject type functions to output signal prototypes and the object
211  * hierarchy.
212  */
214 /* The output files */
215 const gchar *signals_filename = "$new_signals_filename";
216 const gchar *hierarchy_filename = "$new_hierarchy_filename";
217 const gchar *interfaces_filename = "$new_interfaces_filename";
218 const gchar *prerequisites_filename = "$new_prerequisites_filename";
219 const gchar *args_filename = "$new_args_filename";
222 static void output_signals (void);
223 static void output_object_signals (FILE *fp,
224                                    GType object_type);
225 static void output_object_signal (FILE *fp,
226                                   const gchar *object_class_name,
227                                   guint signal_id);
228 static const gchar * get_type_name (GType type,
229                                     gboolean * is_pointer);
230 static void output_object_hierarchy (void);
231 static void output_hierarchy (FILE *fp,
232                               GType type,
233                               guint level);
235 static void output_object_interfaces (void);
236 static void output_interfaces (FILE *fp,
237                                GType type);
239 static void output_interface_prerequisites (void);
240 static void output_prerequisites (FILE *fp,
241                                   GType type);
243 static void output_args (void);
244 static void output_object_args (FILE *fp, GType object_type);
247 main (int argc, char *argv[])
249   $TYPE_INIT_FUNC;
251   get_object_types ();
253   output_signals ();
254   output_object_hierarchy ();
255   output_object_interfaces ();
256   output_interface_prerequisites ();
257   output_args ();
259   return 0;
263 static void
264 output_signals (void)
266   FILE *fp;
267   gint i;
269   fp = fopen (signals_filename, "w");
270   if (fp == NULL)
271     {
272       g_warning ("Couldn't open output file: %s : %s", signals_filename, g_strerror(errno));
273       return;
274     }
276   for (i = 0; object_types[i]; i++)
277     output_object_signals (fp, object_types[i]);
279   fclose (fp);
282 static gint
283 compare_signals (const void *a, const void *b)
285   const guint *signal_a = a;
286   const guint *signal_b = b;
288   return strcmp (g_signal_name (*signal_a), g_signal_name (*signal_b));
291 /* This outputs all the signals of one object. */
292 static void
293 output_object_signals (FILE *fp, GType object_type)
295   const gchar *object_class_name;
296   guint *signals, n_signals;
297   guint sig;
299   if (G_TYPE_IS_INSTANTIATABLE (object_type) ||
300       G_TYPE_IS_INTERFACE (object_type))
301     {
303       object_class_name = g_type_name (object_type);
305       signals = g_signal_list_ids (object_type, &n_signals);
306       qsort (signals, n_signals, sizeof (guint), compare_signals);
308       for (sig = 0; sig < n_signals; sig++)
309         {
310            output_object_signal (fp, object_class_name, signals[sig]);
311         }
312       g_free (signals);
313    }
317 /* This outputs one signal. */
318 static void
319 output_object_signal (FILE *fp,
320                       const gchar *object_name,
321                       guint signal_id)
323   GSignalQuery query_info;
324   const gchar *type_name, *ret_type, *object_arg, *arg_name;
325   gchar *pos, *object_arg_lower;
326   gboolean is_pointer;
327   gchar buffer[1024];
328   guint i, param;
329   gint param_num, widget_num, event_num, callback_num;
330   gint *arg_num;
331   gchar signal_name[128];
332   gchar flags[16];
334   /*  g_print ("Object: %s Signal: %u\\n", object_name, signal_id);*/
336   param_num = 1;
337   widget_num = event_num = callback_num = 0;
339   g_signal_query (signal_id, &query_info);
341   /* Output the signal object type and the argument name. We assume the
342      type is a pointer - I think that is OK. We remove "Gtk" or "Gnome" and
343      convert to lower case for the argument name. */
344   pos = buffer;
345   sprintf (pos, "%s ", object_name);
346   pos += strlen (pos);
348   /* Try to come up with a sensible variable name for the first arg
349    * It chops off 2 know prefixes :/ and makes the name lowercase
350    * It should replace lowercase -> uppercase with '_'
351    * GFileMonitor -> file_monitor
352    * GIOExtensionPoint -> extension_point
353    * GtkTreeView -> tree_view
354    * if 2nd char is upper case too
355    *   search for first lower case and go back one char
356    * else
357    *   search for next upper case
358    */
359   if (!strncmp (object_name, "Gtk", 3))
360       object_arg = object_name + 3;
361   else if (!strncmp (object_name, "Gnome", 5))
362       object_arg = object_name + 5;
363   else
364       object_arg = object_name;
366   object_arg_lower = g_ascii_strdown (object_arg, -1);
367   sprintf (pos, "*%s\\n", object_arg_lower);
368   pos += strlen (pos);
369   if (!strncmp (object_arg_lower, "widget", 6))
370     widget_num = 2;
371   g_free(object_arg_lower);
373   /* Convert signal name to use underscores rather than dashes '-'. */
374   strncpy (signal_name, query_info.signal_name, 127);
375   signal_name[127] = '\\0';
376   for (i = 0; signal_name[i]; i++)
377     {
378       if (signal_name[i] == '-')
379         signal_name[i] = '_';
380     }
382   /* Output the signal parameters. */
383   for (param = 0; param < query_info.n_params; param++)
384     {
385       type_name = get_type_name (query_info.param_types[param] & ~G_SIGNAL_TYPE_STATIC_SCOPE, &is_pointer);
387       /* Most arguments to the callback are called "arg1", "arg2", etc.
388          GtkWidgets are called "widget", "widget2", ...
389          GtkCallbacks are called "callback", "callback2", ... */
390       if (!strcmp (type_name, "GtkWidget"))
391         {
392           arg_name = "widget";
393           arg_num = &widget_num;
394         }
395       else if (!strcmp (type_name, "GtkCallback")
396                || !strcmp (type_name, "GtkCCallback"))
397         {
398           arg_name = "callback";
399           arg_num = &callback_num;
400         }
401       else
402         {
403           arg_name = "arg";
404           arg_num = &param_num;
405         }
406       sprintf (pos, "%s ", type_name);
407       pos += strlen (pos);
409       if (!arg_num || *arg_num == 0)
410         sprintf (pos, "%s%s\\n", is_pointer ? "*" : " ", arg_name);
411       else
412         sprintf (pos, "%s%s%i\\n", is_pointer ? "*" : " ", arg_name,
413                  *arg_num);
414       pos += strlen (pos);
416       if (arg_num)
417         {
418           if (*arg_num == 0)
419             *arg_num = 2;
420           else
421             *arg_num += 1;
422         }
423     }
425   pos = flags;
426   /* We use one-character flags for simplicity. */
427   if (query_info.signal_flags & G_SIGNAL_RUN_FIRST)
428     *pos++ = 'f';
429   if (query_info.signal_flags & G_SIGNAL_RUN_LAST)
430     *pos++ = 'l';
431   if (query_info.signal_flags & G_SIGNAL_RUN_CLEANUP)
432     *pos++ = 'c';
433   if (query_info.signal_flags & G_SIGNAL_NO_RECURSE)
434     *pos++ = 'r';
435   if (query_info.signal_flags & G_SIGNAL_DETAILED)
436     *pos++ = 'd';
437   if (query_info.signal_flags & G_SIGNAL_ACTION)
438     *pos++ = 'a';
439   if (query_info.signal_flags & G_SIGNAL_NO_HOOKS)
440     *pos++ = 'h';
441   *pos = 0;
443   /* Output the return type and function name. */
444   ret_type = get_type_name (query_info.return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE, &is_pointer);
446   fprintf (fp,
447            "<SIGNAL>\\n<NAME>%s::%s</NAME>\\n<RETURNS>%s%s</RETURNS>\\n<FLAGS>%s</FLAGS>\\n%s</SIGNAL>\\n\\n",
448            object_name, query_info.signal_name, ret_type, is_pointer ? "*" : "", flags, buffer);
452 /* Returns the type name to use for a signal argument or return value, given
453    the GtkType from the signal info. It also sets is_pointer to TRUE if the
454    argument needs a '*' since it is a pointer. */
455 static const gchar *
456 get_type_name (GType type, gboolean * is_pointer)
458   const gchar *type_name;
460   *is_pointer = FALSE;
461   type_name = g_type_name (type);
463   switch (type) {
464   case G_TYPE_NONE:
465   case G_TYPE_CHAR:
466   case G_TYPE_UCHAR:
467   case G_TYPE_BOOLEAN:
468   case G_TYPE_INT:
469   case G_TYPE_UINT:
470   case G_TYPE_LONG:
471   case G_TYPE_ULONG:
472   case G_TYPE_FLOAT:
473   case G_TYPE_DOUBLE:
474   case G_TYPE_POINTER:
475     /* These all have normal C type names so they are OK. */
476     return type_name;
478   case G_TYPE_STRING:
479     /* A GtkString is really a gchar*. */
480     *is_pointer = TRUE;
481     return "gchar";
483   case G_TYPE_ENUM:
484   case G_TYPE_FLAGS:
485     /* We use a gint for both of these. Hopefully a subtype with a decent
486        name will be registered and used instead, as GTK+ does itself. */
487     return "gint";
489   case G_TYPE_BOXED:
490     /* The boxed type shouldn't be used itself, only subtypes. Though we
491        return 'gpointer' just in case. */
492     return "gpointer";
494   case G_TYPE_PARAM:
495     /* A GParam is really a GParamSpec*. */
496     *is_pointer = TRUE;
497     return "GParamSpec";
499 #if GLIB_CHECK_VERSION (2, 25, 9)
500   case G_TYPE_VARIANT:
501     *is_pointer = TRUE;
502     return "GVariant";
503 #endif
505 default:
506     break;
507   }
509   /* For all GObject subclasses we can use the class name with a "*",
510      e.g. 'GtkWidget *'. */
511   if (g_type_is_a (type, G_TYPE_OBJECT))
512     *is_pointer = TRUE;
514   /* Also catch non GObject root types */
515   if (G_TYPE_IS_CLASSED (type))
516     *is_pointer = TRUE;
518   /* All boxed subtypes will be pointers as well. */
519   /* Exception: GStrv */
520   if (g_type_is_a (type, G_TYPE_BOXED) &&
521       !g_type_is_a (type, G_TYPE_STRV))
522     *is_pointer = TRUE;
524   /* All pointer subtypes will be pointers as well. */
525   if (g_type_is_a (type, G_TYPE_POINTER))
526     *is_pointer = TRUE;
528   /* But enums are not */
529   if (g_type_is_a (type, G_TYPE_ENUM) ||
530       g_type_is_a (type, G_TYPE_FLAGS))
531     *is_pointer = FALSE;
533   return type_name;
537 /* This outputs the hierarchy of all objects which have been initialized,
538    i.e. by calling their XXX_get_type() initialization function. */
539 static void
540 output_object_hierarchy (void)
542   FILE *fp;
543   gint i,j;
544   GType root, type;
545   GType root_types[$ntypes] = { G_TYPE_INVALID, };
547   fp = fopen (hierarchy_filename, "w");
548   if (fp == NULL)
549     {
550       g_warning ("Couldn't open output file: %s : %s", hierarchy_filename, g_strerror(errno));
551       return;
552     }
553   output_hierarchy (fp, G_TYPE_OBJECT, 0);
554   output_hierarchy (fp, G_TYPE_INTERFACE, 0);
556   for (i=0; object_types[i]; i++) {
557     root = object_types[i];
558     while ((type = g_type_parent (root))) {
559       root = type;
560     }
561     if ((root != G_TYPE_OBJECT) && (root != G_TYPE_INTERFACE)) {
562       for (j=0; root_types[j]; j++) {
563         if (root == root_types[j]) {
564           root = G_TYPE_INVALID; break;
565         }
566       }
567       if(root) {
568         root_types[j] = root;
569         output_hierarchy (fp, root, 0);
570       }
571     }
572   }
574   fclose (fp);
577 /* This is called recursively to output the hierarchy of a object. */
578 static void
579 output_hierarchy (FILE  *fp,
580                   GType  type,
581                   guint   level)
583   guint i;
584   GType *children;
585   guint n_children;
587   if (!type)
588     return;
590   for (i = 0; i < level; i++)
591     fprintf (fp, "  ");
592   fprintf (fp, "%s\\n", g_type_name (type));
594   children = g_type_children (type, &n_children);
596   for (i=0; i < n_children; i++)
597     output_hierarchy (fp, children[i], level + 1);
599   g_free (children);
602 static void output_object_interfaces (void)
604   guint i;
605   FILE *fp;
607   fp = fopen (interfaces_filename, "w");
608   if (fp == NULL)
609     {
610       g_warning ("Couldn't open output file: %s : %s", interfaces_filename, g_strerror(errno));
611       return;
612     }
613   output_interfaces (fp, G_TYPE_OBJECT);
615   for (i = 0; object_types[i]; i++)
616     {
617       if (!g_type_parent (object_types[i]) &&
618           (object_types[i] != G_TYPE_OBJECT) &&
619           G_TYPE_IS_INSTANTIATABLE (object_types[i]))
620         {
621           output_interfaces (fp, object_types[i]);
622         }
623     }
624   fclose (fp);
627 static void
628 output_interfaces (FILE  *fp,
629                    GType  type)
631   guint i;
632   GType *children, *interfaces;
633   guint n_children, n_interfaces;
635   if (!type)
636     return;
638   interfaces = g_type_interfaces (type, &n_interfaces);
640   if (n_interfaces > 0)
641     {
642       fprintf (fp, "%s", g_type_name (type));
643       for (i=0; i < n_interfaces; i++)
644           fprintf (fp, " %s", g_type_name (interfaces[i]));
645       fprintf (fp, "\\n");
646      }
647   g_free (interfaces);
649   children = g_type_children (type, &n_children);
651   for (i=0; i < n_children; i++)
652     output_interfaces (fp, children[i]);
654   g_free (children);
657 static void output_interface_prerequisites (void)
659   FILE *fp;
661   fp = fopen (prerequisites_filename, "w");
662   if (fp == NULL)
663     {
664       g_warning ("Couldn't open output file: %s : %s", prerequisites_filename, g_strerror(errno));
665       return;
666     }
667   output_prerequisites (fp, G_TYPE_INTERFACE);
668   fclose (fp);
671 static void
672 output_prerequisites (FILE  *fp,
673                       GType  type)
675 #if GLIB_CHECK_VERSION(2,1,0)
676   guint i;
677   GType *children, *prerequisites;
678   guint n_children, n_prerequisites;
680   if (!type)
681     return;
683   prerequisites = g_type_interface_prerequisites (type, &n_prerequisites);
685   if (n_prerequisites > 0)
686     {
687       fprintf (fp, "%s", g_type_name (type));
688       for (i=0; i < n_prerequisites; i++)
689           fprintf (fp, " %s", g_type_name (prerequisites[i]));
690       fprintf (fp, "\\n");
691      }
692   g_free (prerequisites);
694   children = g_type_children (type, &n_children);
696   for (i=0; i < n_children; i++)
697     output_prerequisites (fp, children[i]);
699   g_free (children);
700 #endif
703 static void
704 output_args (void)
706   FILE *fp;
707   gint i;
709   fp = fopen (args_filename, "w");
710   if (fp == NULL)
711     {
712       g_warning ("Couldn't open output file: %s : %s", args_filename, g_strerror(errno));
713       return;
714     }
716   for (i = 0; object_types[i]; i++) {
717     output_object_args (fp, object_types[i]);
718   }
720   fclose (fp);
723 static gint
724 compare_param_specs (const void *a, const void *b)
726   GParamSpec *spec_a = *(GParamSpec **)a;
727   GParamSpec *spec_b = *(GParamSpec **)b;
729   return strcmp (g_param_spec_get_name (spec_a), g_param_spec_get_name (spec_b));
732 /* Its common to have unsigned properties restricted
733  * to the signed range. Therefore we make this look
734  * a bit nicer by spelling out the max constants.
735  */
737 /* Don't use "==" with floats, it might trigger a gcc warning.  */
738 #define GTKDOC_COMPARE_FLOAT(x, y) (x <= y && x >= y)
740 static gchar*
741 describe_double_constant (gdouble value)
743   gchar *desc;
745   if (GTKDOC_COMPARE_FLOAT (value, G_MAXDOUBLE))
746     desc = g_strdup ("G_MAXDOUBLE");
747   else if (GTKDOC_COMPARE_FLOAT (value, G_MINDOUBLE))
748     desc = g_strdup ("G_MINDOUBLE");
749   else if (GTKDOC_COMPARE_FLOAT (value, -G_MAXDOUBLE))
750     desc = g_strdup ("-G_MAXDOUBLE");
751   else if (GTKDOC_COMPARE_FLOAT (value, G_MAXFLOAT))
752     desc = g_strdup ("G_MAXFLOAT");
753   else if (GTKDOC_COMPARE_FLOAT (value, G_MINFLOAT))
754     desc = g_strdup ("G_MINFLOAT");
755   else if (GTKDOC_COMPARE_FLOAT (value, -G_MAXFLOAT))
756     desc = g_strdup ("-G_MAXFLOAT");
757   else{
758     /* make sure floats are output with a decimal dot irrespective of
759     * current locale. Use formatd since we want human-readable numbers
760     * and do not need the exact same bit representation when deserialising */
761     desc = g_malloc0 (G_ASCII_DTOSTR_BUF_SIZE);
762     g_ascii_formatd (desc, G_ASCII_DTOSTR_BUF_SIZE, "%g", value);
763   }
765   return desc;
768 static gchar*
769 describe_signed_constant (gsize size, gint64 value)
771   gchar *desc = NULL;
773   switch (size) {
774     case 2:
775       if (sizeof (int) == 2) {
776         if (value == G_MAXINT)
777           desc = g_strdup ("G_MAXINT");
778         else if (value == G_MININT)
779           desc = g_strdup ("G_MININT");
780       }
781       break;
782     case 4:
783       if (sizeof (int) == 4) {
784         if (value == G_MAXINT)
785           desc = g_strdup ("G_MAXINT");
786         else if (value == G_MININT)
787           desc = g_strdup ("G_MININT");
788       }
789       if (value == G_MAXLONG)
790         desc = g_strdup ("G_MAXLONG");
791       else if (value == G_MINLONG)
792         desc = g_strdup ("G_MINLONG");
793       break;
794     case 8:
795       if (value == G_MAXINT64)
796         desc = g_strdup ("G_MAXINT64");
797       else if (value == G_MININT64)
798         desc = g_strdup ("G_MININT64");
799       break;
800     default:
801       break;
802   }
803   if (!desc)
804     desc = g_strdup_printf ("%" G_GINT64_FORMAT, value);
806   return desc;
809 static gchar*
810 describe_unsigned_constant (gsize size, guint64 value)
812   gchar *desc = NULL;
814   switch (size) {
815     case 2:
816       if (sizeof (int) == 2) {
817         if (value == (guint64)G_MAXINT)
818           desc = g_strdup ("G_MAXINT");
819         else if (value == G_MAXUINT)
820           desc = g_strdup ("G_MAXUINT");
821       }
822       break;
823     case 4:
824       if (sizeof (int) == 4) {
825         if (value == (guint64)G_MAXINT)
826           desc = g_strdup ("G_MAXINT");
827         else if (value == G_MAXUINT)
828           desc = g_strdup ("G_MAXUINT");
829       }
830       if (value == (guint64)G_MAXLONG)
831         desc = g_strdup ("G_MAXLONG");
832       else if (value == G_MAXULONG)
833         desc = g_strdup ("G_MAXULONG");
834       break;
835     case 8:
836       if (value == G_MAXINT64)
837         desc = g_strdup ("G_MAXINT64");
838       else if (value == G_MAXUINT64)
839         desc = g_strdup ("G_MAXUINT64");
840       break;
841     default:
842       break;
843   }
844   if (!desc)
845     desc = g_strdup_printf ("%" G_GUINT64_FORMAT, value);
847   return desc;
850 static gchar*
851 describe_type (GParamSpec *spec)
853   gchar *desc;
854   gchar *lower;
855   gchar *upper;
857   if (G_IS_PARAM_SPEC_CHAR (spec))
858     {
859       GParamSpecChar *pspec = G_PARAM_SPEC_CHAR (spec);
861       lower = describe_signed_constant (sizeof(gchar), pspec->minimum);
862       upper = describe_signed_constant (sizeof(gchar), pspec->maximum);
863       if (pspec->minimum == G_MININT8 && pspec->maximum == G_MAXINT8)
864         desc = g_strdup ("");
865       else if (pspec->minimum == G_MININT8)
866         desc = g_strdup_printf ("<= %s", upper);
867       else if (pspec->maximum == G_MAXINT8)
868         desc = g_strdup_printf (">= %s", lower);
869       else
870         desc = g_strdup_printf ("[%s,%s]", lower, upper);
871       g_free (lower);
872       g_free (upper);
873     }
874   else if (G_IS_PARAM_SPEC_UCHAR (spec))
875     {
876       GParamSpecUChar *pspec = G_PARAM_SPEC_UCHAR (spec);
878       lower = describe_unsigned_constant (sizeof(guchar), pspec->minimum);
879       upper = describe_unsigned_constant (sizeof(guchar), pspec->maximum);
880       if (pspec->minimum == 0 && pspec->maximum == G_MAXUINT8)
881         desc = g_strdup ("");
882       else if (pspec->minimum == 0)
883         desc = g_strdup_printf ("<= %s", upper);
884       else if (pspec->maximum == G_MAXUINT8)
885         desc = g_strdup_printf (">= %s", lower);
886       else
887         desc = g_strdup_printf ("[%s,%s]", lower, upper);
888       g_free (lower);
889       g_free (upper);
890     }
891   else if (G_IS_PARAM_SPEC_INT (spec))
892     {
893       GParamSpecInt *pspec = G_PARAM_SPEC_INT (spec);
895       lower = describe_signed_constant (sizeof(gint), pspec->minimum);
896       upper = describe_signed_constant (sizeof(gint), pspec->maximum);
897       if (pspec->minimum == G_MININT && pspec->maximum == G_MAXINT)
898         desc = g_strdup ("");
899       else if (pspec->minimum == G_MININT)
900         desc = g_strdup_printf ("<= %s", upper);
901       else if (pspec->maximum == G_MAXINT)
902         desc = g_strdup_printf (">= %s", lower);
903       else
904         desc = g_strdup_printf ("[%s,%s]", lower, upper);
905       g_free (lower);
906       g_free (upper);
907     }
908   else if (G_IS_PARAM_SPEC_UINT (spec))
909     {
910       GParamSpecUInt *pspec = G_PARAM_SPEC_UINT (spec);
912       lower = describe_unsigned_constant (sizeof(guint), pspec->minimum);
913       upper = describe_unsigned_constant (sizeof(guint), pspec->maximum);
914       if (pspec->minimum == 0 && pspec->maximum == G_MAXUINT)
915         desc = g_strdup ("");
916       else if (pspec->minimum == 0)
917         desc = g_strdup_printf ("<= %s", upper);
918       else if (pspec->maximum == G_MAXUINT)
919         desc = g_strdup_printf (">= %s", lower);
920       else
921         desc = g_strdup_printf ("[%s,%s]", lower, upper);
922       g_free (lower);
923       g_free (upper);
924     }
925   else if (G_IS_PARAM_SPEC_LONG (spec))
926     {
927       GParamSpecLong *pspec = G_PARAM_SPEC_LONG (spec);
929       lower = describe_signed_constant (sizeof(glong), pspec->minimum);
930       upper = describe_signed_constant (sizeof(glong), pspec->maximum);
931       if (pspec->minimum == G_MINLONG && pspec->maximum == G_MAXLONG)
932         desc = g_strdup ("");
933       else if (pspec->minimum == G_MINLONG)
934         desc = g_strdup_printf ("<= %s", upper);
935       else if (pspec->maximum == G_MAXLONG)
936         desc = g_strdup_printf (">= %s", lower);
937       else
938         desc = g_strdup_printf ("[%s,%s]", lower, upper);
939       g_free (lower);
940       g_free (upper);
941     }
942   else if (G_IS_PARAM_SPEC_ULONG (spec))
943     {
944       GParamSpecULong *pspec = G_PARAM_SPEC_ULONG (spec);
946       lower = describe_unsigned_constant (sizeof(gulong), pspec->minimum);
947       upper = describe_unsigned_constant (sizeof(gulong), pspec->maximum);
948       if (pspec->minimum == 0 && pspec->maximum == G_MAXULONG)
949         desc = g_strdup ("");
950       else if (pspec->minimum == 0)
951         desc = g_strdup_printf ("<= %s", upper);
952       else if (pspec->maximum == G_MAXULONG)
953         desc = g_strdup_printf (">= %s", lower);
954       else
955         desc = g_strdup_printf ("[%s,%s]", lower, upper);
956       g_free (lower);
957       g_free (upper);
958     }
959   else if (G_IS_PARAM_SPEC_INT64 (spec))
960     {
961       GParamSpecInt64 *pspec = G_PARAM_SPEC_INT64 (spec);
963       lower = describe_signed_constant (sizeof(gint64), pspec->minimum);
964       upper = describe_signed_constant (sizeof(gint64), pspec->maximum);
965       if (pspec->minimum == G_MININT64 && pspec->maximum == G_MAXINT64)
966         desc = g_strdup ("");
967       else if (pspec->minimum == G_MININT64)
968         desc = g_strdup_printf ("<= %s", upper);
969       else if (pspec->maximum == G_MAXINT64)
970         desc = g_strdup_printf (">= %s", lower);
971       else
972         desc = g_strdup_printf ("[%s,%s]", lower, upper);
973       g_free (lower);
974       g_free (upper);
975     }
976   else if (G_IS_PARAM_SPEC_UINT64 (spec))
977     {
978       GParamSpecUInt64 *pspec = G_PARAM_SPEC_UINT64 (spec);
980       lower = describe_unsigned_constant (sizeof(guint64), pspec->minimum);
981       upper = describe_unsigned_constant (sizeof(guint64), pspec->maximum);
982       if (pspec->minimum == 0 && pspec->maximum == G_MAXUINT64)
983         desc = g_strdup ("");
984       else if (pspec->minimum == 0)
985         desc = g_strdup_printf ("<= %s", upper);
986       else if (pspec->maximum == G_MAXUINT64)
987         desc = g_strdup_printf (">= %s", lower);
988       else
989         desc = g_strdup_printf ("[%s,%s]", lower, upper);
990       g_free (lower);
991       g_free (upper);
992     }
993   else if (G_IS_PARAM_SPEC_FLOAT (spec))
994     {
995       GParamSpecFloat *pspec = G_PARAM_SPEC_FLOAT (spec);
997       lower = describe_double_constant (pspec->minimum);
998       upper = describe_double_constant (pspec->maximum);
999       if (GTKDOC_COMPARE_FLOAT (pspec->minimum, -G_MAXFLOAT))
1000         {
1001           if (GTKDOC_COMPARE_FLOAT (pspec->maximum, G_MAXFLOAT))
1002             desc = g_strdup ("");
1003           else
1004             desc = g_strdup_printf ("<= %s", upper);
1005         }
1006       else if (GTKDOC_COMPARE_FLOAT (pspec->maximum, G_MAXFLOAT))
1007         desc = g_strdup_printf (">= %s", lower);
1008       else
1009         desc = g_strdup_printf ("[%s,%s]", lower, upper);
1010       g_free (lower);
1011       g_free (upper);
1012     }
1013   else if (G_IS_PARAM_SPEC_DOUBLE (spec))
1014     {
1015       GParamSpecDouble *pspec = G_PARAM_SPEC_DOUBLE (spec);
1017       lower = describe_double_constant (pspec->minimum);
1018       upper = describe_double_constant (pspec->maximum);
1019       if (GTKDOC_COMPARE_FLOAT (pspec->minimum, -G_MAXDOUBLE))
1020         {
1021           if (GTKDOC_COMPARE_FLOAT (pspec->maximum, G_MAXDOUBLE))
1022             desc = g_strdup ("");
1023           else
1024             desc = g_strdup_printf ("<= %s", upper);
1025         }
1026       else if (GTKDOC_COMPARE_FLOAT (pspec->maximum, G_MAXDOUBLE))
1027         desc = g_strdup_printf (">= %s", lower);
1028       else
1029         desc = g_strdup_printf ("[%s,%s]", lower, upper);
1030       g_free (lower);
1031       g_free (upper);
1032     }
1033 #if GLIB_CHECK_VERSION (2, 12, 0)
1034   else if (G_IS_PARAM_SPEC_GTYPE (spec))
1035     {
1036       GParamSpecGType *pspec = G_PARAM_SPEC_GTYPE (spec);
1037       gboolean is_pointer;
1039       desc = g_strdup (get_type_name (pspec->is_a_type, &is_pointer));
1040     }
1041 #endif
1042 #if GLIB_CHECK_VERSION (2, 25, 9)
1043   else if (G_IS_PARAM_SPEC_VARIANT (spec))
1044     {
1045       GParamSpecVariant *pspec = G_PARAM_SPEC_VARIANT (spec);
1046       gchar *variant_type;
1048       variant_type = g_variant_type_dup_string (pspec->type);
1049       desc = g_strdup_printf ("GVariant<%s>", variant_type);
1050       g_free (variant_type);
1051     }
1052 #endif
1053   else
1054     {
1055       desc = g_strdup ("");
1056     }
1058   return desc;
1061 static gchar*
1062 describe_default (GParamSpec *spec)
1064   gchar *desc;
1066   if (G_IS_PARAM_SPEC_CHAR (spec))
1067     {
1068       GParamSpecChar *pspec = G_PARAM_SPEC_CHAR (spec);
1070       desc = g_strdup_printf ("%d", pspec->default_value);
1071     }
1072   else if (G_IS_PARAM_SPEC_UCHAR (spec))
1073     {
1074       GParamSpecUChar *pspec = G_PARAM_SPEC_UCHAR (spec);
1076       desc = g_strdup_printf ("%u", pspec->default_value);
1077     }
1078   else if (G_IS_PARAM_SPEC_BOOLEAN (spec))
1079     {
1080       GParamSpecBoolean *pspec = G_PARAM_SPEC_BOOLEAN (spec);
1082       desc = g_strdup_printf ("%s", pspec->default_value ? "TRUE" : "FALSE");
1083     }
1084   else if (G_IS_PARAM_SPEC_INT (spec))
1085     {
1086       GParamSpecInt *pspec = G_PARAM_SPEC_INT (spec);
1088       desc = g_strdup_printf ("%d", pspec->default_value);
1089     }
1090   else if (G_IS_PARAM_SPEC_UINT (spec))
1091     {
1092       GParamSpecUInt *pspec = G_PARAM_SPEC_UINT (spec);
1094       desc = g_strdup_printf ("%u", pspec->default_value);
1095     }
1096   else if (G_IS_PARAM_SPEC_LONG (spec))
1097     {
1098       GParamSpecLong *pspec = G_PARAM_SPEC_LONG (spec);
1100       desc = g_strdup_printf ("%ld", pspec->default_value);
1101     }
1102   else if (G_IS_PARAM_SPEC_LONG (spec))
1103     {
1104       GParamSpecULong *pspec = G_PARAM_SPEC_ULONG (spec);
1106       desc = g_strdup_printf ("%lu", pspec->default_value);
1107     }
1108   else if (G_IS_PARAM_SPEC_INT64 (spec))
1109     {
1110       GParamSpecInt64 *pspec = G_PARAM_SPEC_INT64 (spec);
1112       desc = g_strdup_printf ("%" G_GINT64_FORMAT, pspec->default_value);
1113     }
1114   else if (G_IS_PARAM_SPEC_UINT64 (spec))
1115     {
1116       GParamSpecUInt64 *pspec = G_PARAM_SPEC_UINT64 (spec);
1118       desc = g_strdup_printf ("%" G_GUINT64_FORMAT, pspec->default_value);
1119     }
1120   else if (G_IS_PARAM_SPEC_UNICHAR (spec))
1121     {
1122       GParamSpecUnichar *pspec = G_PARAM_SPEC_UNICHAR (spec);
1124       if (g_unichar_isprint (pspec->default_value))
1125         desc = g_strdup_printf ("'%c'", pspec->default_value);
1126       else
1127         desc = g_strdup_printf ("%u", pspec->default_value);
1128     }
1129   else if (G_IS_PARAM_SPEC_ENUM (spec))
1130     {
1131       GParamSpecEnum *pspec = G_PARAM_SPEC_ENUM (spec);
1133       GEnumValue *value = g_enum_get_value (pspec->enum_class, pspec->default_value);
1134       if (value)
1135         desc = g_strdup_printf ("%s", value->value_name);
1136       else
1137         desc = g_strdup_printf ("%d", pspec->default_value);
1138     }
1139   else if (G_IS_PARAM_SPEC_FLAGS (spec))
1140     {
1141       GParamSpecFlags *pspec = G_PARAM_SPEC_FLAGS (spec);
1142       guint default_value;
1143       GString *acc;
1145       default_value = pspec->default_value;
1146       acc = g_string_new ("");
1148       while (default_value)
1149         {
1150           GFlagsValue *value = g_flags_get_first_value (pspec->flags_class, default_value);
1152           if (!value)
1153             break;
1155           if (acc->len > 0)
1156             g_string_append (acc, " | ");
1157           g_string_append (acc, value->value_name);
1159           default_value &= ~value->value;
1160         }
1162       if (default_value == 0)
1163         desc = g_string_free (acc, FALSE);
1164       else
1165         {
1166           desc = g_strdup_printf ("%d", pspec->default_value);
1167           g_string_free (acc, TRUE);
1168         }
1169     }
1170   else if (G_IS_PARAM_SPEC_FLOAT (spec))
1171     {
1172       GParamSpecFloat *pspec = G_PARAM_SPEC_FLOAT (spec);
1174       /* make sure floats are output with a decimal dot irrespective of
1175        * current locale. Use formatd since we want human-readable numbers
1176        * and do not need the exact same bit representation when deserialising */
1177       desc = g_malloc0 (G_ASCII_DTOSTR_BUF_SIZE);
1178       g_ascii_formatd (desc, G_ASCII_DTOSTR_BUF_SIZE, "%g",
1179           pspec->default_value);
1180     }
1181   else if (G_IS_PARAM_SPEC_DOUBLE (spec))
1182     {
1183       GParamSpecDouble *pspec = G_PARAM_SPEC_DOUBLE (spec);
1185       /* make sure floats are output with a decimal dot irrespective of
1186        * current locale. Use formatd since we want human-readable numbers
1187        * and do not need the exact same bit representation when deserialising */
1188       desc = g_malloc0 (G_ASCII_DTOSTR_BUF_SIZE);
1189       g_ascii_formatd (desc, G_ASCII_DTOSTR_BUF_SIZE, "%g",
1190           pspec->default_value);
1191     }
1192   else if (G_IS_PARAM_SPEC_STRING (spec))
1193     {
1194       GParamSpecString *pspec = G_PARAM_SPEC_STRING (spec);
1196       if (pspec->default_value)
1197         {
1198           gchar *esc = g_strescape (pspec->default_value, NULL);
1200           desc = g_strdup_printf ("\\"%s\\"", esc);
1202           g_free (esc);
1203         }
1204       else
1205         desc = g_strdup_printf ("NULL");
1206     }
1207 #if GLIB_CHECK_VERSION (2, 25, 9)
1208   else if (G_IS_PARAM_SPEC_VARIANT (spec))
1209     {
1210       GParamSpecVariant *pspec = G_PARAM_SPEC_VARIANT (spec);
1212       if (pspec->default_value)
1213         desc = g_variant_print (pspec->default_value, TRUE);
1214       else
1215         desc = g_strdup ("NULL");
1216     }
1217 #endif
1218   else
1219     {
1220       desc = g_strdup ("");
1221     }
1223   return desc;
1227 static void
1228 output_object_args (FILE *fp, GType object_type)
1230   gpointer class;
1231   const gchar *object_class_name;
1232   guint arg;
1233   gchar flags[16], *pos;
1234   GParamSpec **properties;
1235   guint n_properties;
1236   gboolean child_prop;
1237   gboolean style_prop;
1238   gboolean is_pointer;
1239   const gchar *type_name;
1240   gchar *type_desc;
1241   gchar *default_value;
1243   if (G_TYPE_IS_OBJECT (object_type))
1244     {
1245       class = g_type_class_peek (object_type);
1246       if (!class)
1247         return;
1249       properties = g_object_class_list_properties (class, &n_properties);
1250     }
1251 #if GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 3)
1252   else if (G_TYPE_IS_INTERFACE (object_type))
1253     {
1254       class = g_type_default_interface_ref (object_type);
1256       if (!class)
1257         return;
1259       properties = g_object_interface_list_properties (class, &n_properties);
1260     }
1261 #endif
1262   else
1263     return;
1265   object_class_name = g_type_name (object_type);
1267   child_prop = FALSE;
1268   style_prop = FALSE;
1270   while (TRUE) {
1271     qsort (properties, n_properties, sizeof (GParamSpec *), compare_param_specs);
1272     for (arg = 0; arg < n_properties; arg++)
1273       {
1274         GParamSpec *spec = properties[arg];
1275         const gchar *nick, *blurb, *dot;
1277         if (spec->owner_type != object_type)
1278           continue;
1280         pos = flags;
1281         /* We use one-character flags for simplicity. */
1282         if (child_prop && !style_prop)
1283              *pos++ = 'c';
1284         if (style_prop)
1285              *pos++ = 's';
1286         if (spec->flags & G_PARAM_READABLE)
1287            *pos++ = 'r';
1288         if (spec->flags & G_PARAM_WRITABLE)
1289           *pos++ = 'w';
1290         if (spec->flags & G_PARAM_CONSTRUCT)
1291           *pos++ = 'x';
1292         if (spec->flags & G_PARAM_CONSTRUCT_ONLY)
1293           *pos++ = 'X';
1294         *pos = 0;
1296         nick = g_param_spec_get_nick (spec);
1297         blurb = g_param_spec_get_blurb (spec);
1299         dot = "";
1300         if (blurb) {
1301           int str_len = strlen (blurb);
1302           if (str_len > 0  && blurb[str_len - 1] != '.')
1303             dot = ".";
1304         }
1306         type_desc = describe_type (spec);
1307         default_value = describe_default (spec);
1308         type_name = get_type_name (spec->value_type, &is_pointer);
1309         fprintf (fp, "<ARG>\\n<NAME>%s::%s</NAME>\\n<TYPE>%s%s</TYPE>\\n<RANGE>%s</RANGE>\\n<FLAGS>%s</FLAGS>\\n<NICK>%s</NICK>\\n<BLURB>%s%s</BLURB>\\n<DEFAULT>%s</DEFAULT>\\n</ARG>\\n\\n",
1310                  object_class_name, g_param_spec_get_name (spec), type_name, is_pointer ? "*" : "", type_desc, flags, nick ? nick : "(null)", blurb ? blurb : "(null)", dot, default_value);
1311         g_free (type_desc);
1312         g_free (default_value);
1313       }
1315     g_free (properties);
1317 #ifdef GTK_IS_CONTAINER_CLASS
1318     if (!child_prop && GTK_IS_CONTAINER_CLASS (class)) {
1319       properties = gtk_container_class_list_child_properties (class, &n_properties);
1320       child_prop = TRUE;
1321       continue;
1322     }
1323 #endif
1325 #ifdef GTK_IS_CELL_AREA_CLASS
1326     if (!child_prop && GTK_IS_CELL_AREA_CLASS (class)) {
1327       properties = gtk_cell_area_class_list_cell_properties (class, &n_properties);
1328       child_prop = TRUE;
1329       continue;
1330     }
1331 #endif
1333 #ifdef GTK_IS_WIDGET_CLASS
1334 #if GTK_CHECK_VERSION(2,1,0)
1335     if (!style_prop && GTK_IS_WIDGET_CLASS (class)) {
1336       properties = gtk_widget_class_list_style_properties (GTK_WIDGET_CLASS (class), &n_properties);
1337       style_prop = TRUE;
1338       continue;
1339     }
1340 #endif
1341 #endif
1345 if ($QUERY_CHILD_PROPERTIES) {
1346   print OUTPUT <<EOT;
1347     if (!child_prop) {
1348       properties = $QUERY_CHILD_PROPERTIES (class, &n_properties);
1349       if (properties) {
1350         child_prop = TRUE;
1351         continue;
1352       }
1353    }
1358 print OUTPUT <<EOT;
1359     break;
1360   }
1364 close OUTPUT;
1366 # Compile and run our file
1368 unless ($CC) {
1369     $CC = $ENV{CC} ? $ENV{CC} : "gcc";
1371 unless ($LD) {
1372     $LD = $ENV{LD} ? $ENV{LD} : $CC;
1374 unless ($CFLAGS) {
1375     $CFLAGS = $ENV{CFLAGS} ? $ENV{CFLAGS} : "";
1377 unless ($LDFLAGS) {
1378     $LDFLAGS = $ENV{LDFLAGS} ? $ENV{LDFLAGS} : "";
1380 unless ($RUN) {
1381     $RUN = $ENV{RUN} ? $ENV{RUN} : "";
1384 my $o_file;
1385 if ($CC =~ /libtool/) {
1386   $o_file  = "$MODULE-scan.lo"
1387 } else {
1388   $o_file = "$MODULE-scan.o"
1391 my $stdout="";
1392 if (!defined($VERBOSE) or $VERBOSE eq "0") {
1393     $stdout=">/dev/null";
1396 # Compiling scanner
1397 $command = "$CC $stdout $CFLAGS -c -o $o_file $MODULE-scan.c";
1398 system("($command)") == 0 or die "Compilation of scanner failed: $!\n";
1400 # Linking scanner
1401 # FIXME: Can we turn off as-needed for the docs (or better fix it?)
1402 #$command = "$LD -Wl,--no-as-needed $o_file $LDFLAGS -o $MODULE-scan@EXEEXT@";
1403 $command = "$LD $stdout $o_file $LDFLAGS -o $MODULE-scan@EXEEXT@";
1404 system("($command)") == 0 or die "Linking of scanner failed: $!\n";
1406 # Running scanner $MODULE-scan ";
1407 system("($RUN ./$MODULE-scan@EXEEXT@)") == 0 or die "Scan failed: $!\n";
1410 if (!defined($ENV{"GTK_DOC_KEEP_INTERMEDIATE"})) {
1411   unlink "./$MODULE-scan.c", "./$MODULE-scan.o", "./$MODULE-scan.lo", "./$MODULE-scan@EXEEXT@";
1414 &UpdateFileIfChanged ($old_signals_filename, $new_signals_filename, 0);
1415 &UpdateFileIfChanged ($old_hierarchy_filename, $new_hierarchy_filename, 0);
1416 &UpdateFileIfChanged ($old_interfaces_filename, $new_interfaces_filename, 0);
1417 &UpdateFileIfChanged ($old_prerequisites_filename, $new_prerequisites_filename, 0);
1418 &UpdateFileIfChanged ($old_args_filename, $new_args_filename, 0);