diff options
author | Stefan Kost <ensonic@users.sf.net> | 2011-03-24 17:46:42 +0200 |
---|---|---|
committer | Stefan Kost <ensonic@users.sf.net> | 2011-03-24 17:46:42 +0200 |
commit | 7540b8cfc312e356fe5ef939f1fc4f61c361a8a0 (patch) | |
tree | e851e4686b625ef23ce9ad5bb0845a3c94d1fe69 /gstdoc-scangobj | |
parent | d6e3fe913375e82a83fbc3fbdf8b26b8ce8bf97c (diff) | |
download | gstreamer-common-7540b8cfc312e356fe5ef939f1fc4f61c361a8a0.tar.gz |
scanobj: sync with gtk-doc variant
Remve gtk/gdk specific code as we did in upstream. Add various small formatting
and robustness improvements.
Diffstat (limited to 'gstdoc-scangobj')
-rwxr-xr-x | gstdoc-scangobj | 694 |
1 files changed, 229 insertions, 465 deletions
diff --git a/gstdoc-scangobj b/gstdoc-scangobj index 982602c..df85eda 100755 --- a/gstdoc-scangobj +++ b/gstdoc-scangobj @@ -20,13 +20,10 @@ # # -# 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; @@ -65,6 +62,7 @@ GetOptions(\%optctl, "module=s", "source=s", "types:s", "output-dir:s", "inspect if ($NO_GTK_INIT) { # Do nothing. This just avoids a warning. + # the option is not used anymore } if ($PRINT_VERSION) { @@ -130,7 +128,7 @@ for (<TYPES>) { } } -$ntypes = @types + @impl_types; +$ntypes = @types + @impl_types + 1; print OUTPUT <<EOT; #include <string.h> @@ -197,6 +195,7 @@ static_pad_template_compare (gconstpointer a, gconstpointer b) static GType * get_object_types (void) { + gpointer g_object_class; GList *plugins = NULL; GList *factories = NULL; GList *l; @@ -375,16 +374,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; } @@ -410,10 +415,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, @@ -459,7 +460,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; } @@ -514,9 +515,8 @@ 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]; @@ -529,10 +529,6 @@ output_object_signal (FILE *fp, 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. */ @@ -540,6 +536,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)) @@ -555,7 +562,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] == '-') @@ -563,64 +571,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 = ¶m_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 = ¶m_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; @@ -641,9 +631,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); } @@ -694,7 +687,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; } @@ -703,11 +702,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. */ @@ -723,329 +725,47 @@ 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); } -static int -type_cmp (const void * p1, const void * p2) -{ - return strcmp (g_type_name (*((GType *) p1)), g_type_name (*((GType *) p2))); -} - -/* This is called recursively to output the hierarchy of a widget. */ +/* This is called recursively to output the hierarchy of a object. */ static void output_hierarchy (FILE *fp, GType type, @@ -1058,29 +778,14 @@ 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[0], n_children, sizeof (GType), type_cmp); - - for (i=0; i < n_children; i++) { + for (i=0; i < n_children; i++) output_hierarchy (fp, children[i], level + 1); - } g_free (children); } @@ -1093,7 +798,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); @@ -1147,7 +852,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); @@ -1195,7 +900,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; } @@ -1240,10 +945,10 @@ describe_double_constant (gdouble value) desc = g_strdup ("G_MINFLOAT"); else if (GTKDOC_COMPARE_FLOAT (value, -G_MAXFLOAT)) desc = g_strdup ("-G_MAXFLOAT"); - else { + 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 */ + * 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); } @@ -1252,56 +957,88 @@ describe_double_constant (gdouble value) } 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 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; + 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"); + break; + case 8: + if (value == G_MAXINT64) + desc = g_strdup ("G_MAXINT64"); + else if (value == G_MININT64) + desc = g_strdup ("G_MININT64"); + 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 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; + 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"); + break; + case 8: + if (value == G_MAXINT64) + desc = g_strdup ("G_MAXINT64"); + else if (value == G_MAXUINT64) + desc = g_strdup ("G_MAXUINT64"); + break; + default: + break; + } + if (!desc) desc = g_strdup_printf ("%" G_GUINT64_FORMAT, value); return desc; @@ -1318,8 +1055,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) @@ -1335,8 +1072,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) @@ -1352,8 +1089,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) @@ -1369,8 +1106,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) @@ -1386,8 +1123,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) @@ -1402,10 +1139,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) @@ -1421,8 +1157,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) @@ -1438,8 +1174,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) @@ -1491,6 +1227,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 (""); @@ -1752,6 +1508,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)) { |