| File: | docs/reference/cdk/cdk3-scan.c |
| Warning: | line 198, column 16 Although the value stored to 'event_num' is used in the enclosing expression, the value is never actually read from 'event_num' |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | |
| 2 | #include <string.h> |
| 3 | #include <stdlib.h> |
| 4 | #include <stdio.h> |
| 5 | #include <errno(*__errno_location ()).h> |
| 6 | #include <glib-object.h> |
| 7 | |
| 8 | #ifndef G_GNUC_BEGIN_IGNORE_DEPRECATIONSclang diagnostic push
clang diagnostic ignored "-Wdeprecated-declarations" |
| 9 | # define G_GNUC_BEGIN_IGNORE_DEPRECATIONSclang diagnostic push
clang diagnostic ignored "-Wdeprecated-declarations" |
| 10 | # define G_GNUC_END_IGNORE_DEPRECATIONSclang diagnostic pop |
| 11 | #endif |
| 12 | |
| 13 | #include <cdk/cdk.h> |
| 14 | |
| 15 | |
| 16 | #ifdef GTK_IS_WIDGET_CLASS |
| 17 | #include <gtk/gtk.h> |
| 18 | #endif |
| 19 | static GType object_types[18]; |
| 20 | |
| 21 | static GType * |
| 22 | get_object_types (void) |
| 23 | { |
| 24 | gpointer g_object_class; |
| 25 | gint i = 0; |
| 26 | |
| 27 | G_GNUC_BEGIN_IGNORE_DEPRECATIONSclang diagnostic push
clang diagnostic ignored "-Wdeprecated-declarations" |
| 28 | |
| 29 | object_types[i++] = cdk_app_launch_context_get_type (); |
| 30 | object_types[i++] = cdk_cursor_get_type (); |
| 31 | object_types[i++] = cdk_device_get_type (); |
| 32 | object_types[i++] = cdk_device_manager_get_type (); |
| 33 | object_types[i++] = cdk_device_pad_get_type (); |
| 34 | object_types[i++] = cdk_display_get_type (); |
| 35 | object_types[i++] = cdk_display_manager_get_type (); |
| 36 | object_types[i++] = cdk_drag_context_get_type (); |
| 37 | object_types[i++] = cdk_drawing_context_get_type (); |
| 38 | object_types[i++] = cdk_frame_clock_get_type (); |
| 39 | object_types[i++] = cdk_gl_context_get_type (); |
| 40 | object_types[i++] = cdk_keymap_get_type (); |
| 41 | object_types[i++] = cdk_monitor_get_type (); |
| 42 | object_types[i++] = cdk_screen_get_type (); |
| 43 | object_types[i++] = cdk_seat_get_type (); |
| 44 | object_types[i++] = cdk_visual_get_type (); |
| 45 | object_types[i++] = cdk_window_get_type (); |
| 46 | |
| 47 | object_types[i] = G_TYPE_INVALID((GType) ((0) << (2))); |
| 48 | |
| 49 | /* reference the GObjectClass to initialize the param spec pool |
| 50 | * potentially needed by interfaces. See http://bugs.gnome.org/571820 */ |
| 51 | g_object_class = g_type_class_ref (G_TYPE_OBJECT((GType) ((20) << (2)))); |
| 52 | |
| 53 | /* Need to make sure all the types are loaded in and initialize |
| 54 | * their signals and properties. |
| 55 | */ |
| 56 | for (i=0; object_types[i]; i++) { |
| 57 | if (G_TYPE_IS_CLASSED (object_types[i])(g_type_test_flags ((object_types[i]), G_TYPE_FLAG_CLASSED))) |
| 58 | g_type_class_ref (object_types[i]); |
| 59 | if (G_TYPE_IS_INTERFACE (object_types[i])((g_type_fundamental (object_types[i])) == ((GType) ((2) << (2))))) |
| 60 | g_type_default_interface_ref (object_types[i]); |
| 61 | } |
| 62 | |
| 63 | g_type_class_unref (g_object_class); |
| 64 | |
| 65 | G_GNUC_END_IGNORE_DEPRECATIONSclang diagnostic pop |
| 66 | |
| 67 | return object_types; |
| 68 | } |
| 69 | |
| 70 | /* |
| 71 | * This uses GObject type functions to output signal prototypes and the object |
| 72 | * hierarchy. |
| 73 | */ |
| 74 | |
| 75 | /* The output files */ |
| 76 | const gchar *signals_filename = "./cdk3.signals.new"; |
| 77 | const gchar *hierarchy_filename = "./cdk3.hierarchy.new"; |
| 78 | const gchar *interfaces_filename = "./cdk3.interfaces.new"; |
| 79 | const gchar *prerequisites_filename = "./cdk3.prerequisites.new"; |
| 80 | const gchar *args_filename = "./cdk3.args.new"; |
| 81 | const gchar *actions_filename = "./cdk3.actions.new"; |
| 82 | |
| 83 | static void output_signals (void); |
| 84 | static void output_object_signals (FILE *fp, |
| 85 | GType object_type); |
| 86 | static void output_object_signal (FILE *fp, |
| 87 | const gchar *object_class_name, |
| 88 | guint signal_id); |
| 89 | static const gchar * get_type_name (GType type, |
| 90 | gboolean * is_pointer); |
| 91 | static void output_object_hierarchy (void); |
| 92 | static void output_hierarchy (FILE *fp, |
| 93 | GType type, |
| 94 | guint level); |
| 95 | |
| 96 | static void output_object_interfaces (void); |
| 97 | static void output_interfaces (FILE *fp, |
| 98 | GType type); |
| 99 | |
| 100 | static void output_interface_prerequisites (void); |
| 101 | static void output_prerequisites (FILE *fp, |
| 102 | GType type); |
| 103 | |
| 104 | static void output_args (void); |
| 105 | static void output_object_args (FILE *fp, GType object_type); |
| 106 | |
| 107 | static void output_actions (void); |
| 108 | static void output_object_actions (FILE *fp, GType object_type); |
| 109 | |
| 110 | int |
| 111 | main (void) |
| 112 | { |
| 113 | ; |
| 114 | |
| 115 | get_object_types (); |
| 116 | |
| 117 | output_signals (); |
| 118 | output_object_hierarchy (); |
| 119 | output_object_interfaces (); |
| 120 | output_interface_prerequisites (); |
| 121 | output_args (); |
| 122 | output_actions (); |
| 123 | |
| 124 | return 0; |
| 125 | } |
| 126 | |
| 127 | static void |
| 128 | output_signals (void) |
| 129 | { |
| 130 | FILE *fp; |
| 131 | gint i; |
| 132 | |
| 133 | fp = fopen (signals_filename, "w"); |
| 134 | if (fp == NULL((void*)0)) { |
| 135 | g_warning ("Couldn't open output file: %s : %s", signals_filename, g_strerror(errno(*__errno_location ()))); |
| 136 | return; |
| 137 | } |
| 138 | |
| 139 | for (i = 0; object_types[i]; i++) |
| 140 | output_object_signals (fp, object_types[i]); |
| 141 | |
| 142 | fclose (fp); |
| 143 | } |
| 144 | |
| 145 | static gint |
| 146 | compare_signals (const void *a, const void *b) |
| 147 | { |
| 148 | const guint *signal_a = a; |
| 149 | const guint *signal_b = b; |
| 150 | |
| 151 | return strcmp (g_signal_name (*signal_a), g_signal_name (*signal_b)); |
| 152 | } |
| 153 | |
| 154 | /* This outputs all the signals of one object. */ |
| 155 | static void |
| 156 | output_object_signals (FILE *fp, GType object_type) |
| 157 | { |
| 158 | const gchar *object_class_name; |
| 159 | guint *signals, n_signals; |
| 160 | guint sig; |
| 161 | |
| 162 | if (G_TYPE_IS_INSTANTIATABLE (object_type)(g_type_test_flags ((object_type), G_TYPE_FLAG_INSTANTIATABLE )) || |
| 163 | G_TYPE_IS_INTERFACE (object_type)((g_type_fundamental (object_type)) == ((GType) ((2) << (2))))) { |
| 164 | |
| 165 | object_class_name = g_type_name (object_type); |
| 166 | |
| 167 | signals = g_signal_list_ids (object_type, &n_signals); |
| 168 | if (n_signals > 0) |
| 169 | qsort (signals, n_signals, sizeof (guint), compare_signals); |
| 170 | |
| 171 | for (sig = 0; sig < n_signals; sig++) { |
| 172 | output_object_signal (fp, object_class_name, signals[sig]); |
| 173 | } |
| 174 | g_free (signals); |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | /* This outputs one signal. */ |
| 179 | static void |
| 180 | output_object_signal (FILE *fp, |
| 181 | const gchar *object_name, |
| 182 | guint signal_id) |
| 183 | { |
| 184 | GSignalQuery query_info; |
| 185 | const gchar *type_name, *ret_type, *object_arg, *arg_name; |
| 186 | gchar *pos, *object_arg_lower; |
| 187 | gboolean is_pointer; |
| 188 | gchar buffer[1024]; |
| 189 | guint i, param; |
| 190 | gint param_num, widget_num, event_num, callback_num; |
| 191 | gint *arg_num; |
| 192 | gchar signal_name[128]; |
| 193 | gchar flags[16]; |
| 194 | |
| 195 | /* g_print ("Object: %s Signal: %u\n", object_name, signal_id);*/ |
| 196 | |
| 197 | param_num = 1; |
| 198 | widget_num = event_num = callback_num = 0; |
Although the value stored to 'event_num' is used in the enclosing expression, the value is never actually read from 'event_num' | |
| 199 | |
| 200 | g_signal_query (signal_id, &query_info); |
| 201 | |
| 202 | /* Output the signal object type and the argument name. We assume the |
| 203 | * type is a pointer - I think that is OK. We remove "Gtk" or "Gnome" and |
| 204 | * convert to lower case for the argument name. */ |
| 205 | pos = buffer; |
| 206 | sprintf (pos, "%s ", object_name); |
| 207 | pos += strlen (pos); |
| 208 | |
| 209 | /* Try to come up with a sensible variable name for the first arg |
| 210 | * It chops off 2 know prefixes :/ and makes the name lowercase |
| 211 | * It should replace lowercase -> uppercase with '_' |
| 212 | * GFileMonitor -> file_monitor |
| 213 | * GIOExtensionPoint -> extension_point |
| 214 | * GtkTreeView -> tree_view |
| 215 | * if 2nd char is upper case too |
| 216 | * search for first lower case and go back one char |
| 217 | * else |
| 218 | * search for next upper case |
| 219 | */ |
| 220 | if (!strncmp (object_name, "Gtk", 3)) |
| 221 | object_arg = object_name + 3; |
| 222 | else if (!strncmp (object_name, "Gnome", 5)) |
| 223 | object_arg = object_name + 5; |
| 224 | else |
| 225 | object_arg = object_name; |
| 226 | |
| 227 | object_arg_lower = g_ascii_strdown (object_arg, -1); |
| 228 | sprintf (pos, "*%s\n", object_arg_lower); |
| 229 | pos += strlen (pos); |
| 230 | if (!strncmp (object_arg_lower, "widget", 6)) |
| 231 | widget_num = 2; |
| 232 | g_free(object_arg_lower); |
| 233 | |
| 234 | /* Convert signal name to use underscores rather than dashes '-'. */ |
| 235 | strncpy (signal_name, query_info.signal_name, 127); |
| 236 | signal_name[127] = '\0'; |
| 237 | for (i = 0; signal_name[i]; i++) { |
| 238 | if (signal_name[i] == '-') |
| 239 | signal_name[i] = '_'; |
| 240 | } |
| 241 | |
| 242 | /* Output the signal parameters. */ |
| 243 | for (param = 0; param < query_info.n_params; param++) { |
| 244 | type_name = get_type_name (query_info.param_types[param] & ~G_SIGNAL_TYPE_STATIC_SCOPE(((GType) (1 << 0))), &is_pointer); |
| 245 | |
| 246 | /* Most arguments to the callback are called "arg1", "arg2", etc. |
| 247 | GtkWidgets are called "widget", "widget2", ... |
| 248 | GtkCallbacks are called "callback", "callback2", ... */ |
| 249 | if (!strcmp (type_name, "GtkWidget")) { |
| 250 | arg_name = "widget"; |
| 251 | arg_num = &widget_num; |
| 252 | } |
| 253 | else if (!strcmp (type_name, "GtkCallback") |
| 254 | || !strcmp (type_name, "GtkCCallback")) { |
| 255 | arg_name = "callback"; |
| 256 | arg_num = &callback_num; |
| 257 | } |
| 258 | else { |
| 259 | arg_name = "arg"; |
| 260 | arg_num = ¶m_num; |
| 261 | } |
| 262 | sprintf (pos, "%s ", type_name); |
| 263 | pos += strlen (pos); |
| 264 | |
| 265 | if (!arg_num || *arg_num == 0) |
| 266 | sprintf (pos, "%s%s\n", is_pointer ? "*" : " ", arg_name); |
| 267 | else |
| 268 | sprintf (pos, "%s%s%i\n", is_pointer ? "*" : " ", arg_name, |
| 269 | *arg_num); |
| 270 | pos += strlen (pos); |
| 271 | |
| 272 | if (arg_num) { |
| 273 | if (*arg_num == 0) |
| 274 | *arg_num = 2; |
| 275 | else |
| 276 | *arg_num += 1; |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | pos = flags; |
| 281 | /* We use one-character flags for simplicity. */ |
| 282 | if (query_info.signal_flags & G_SIGNAL_RUN_FIRST) |
| 283 | *pos++ = 'f'; |
| 284 | if (query_info.signal_flags & G_SIGNAL_RUN_LAST) |
| 285 | *pos++ = 'l'; |
| 286 | if (query_info.signal_flags & G_SIGNAL_RUN_CLEANUP) |
| 287 | *pos++ = 'c'; |
| 288 | if (query_info.signal_flags & G_SIGNAL_NO_RECURSE) |
| 289 | *pos++ = 'r'; |
| 290 | if (query_info.signal_flags & G_SIGNAL_DETAILED) |
| 291 | *pos++ = 'd'; |
| 292 | if (query_info.signal_flags & G_SIGNAL_ACTION) |
| 293 | *pos++ = 'a'; |
| 294 | if (query_info.signal_flags & G_SIGNAL_NO_HOOKS) |
| 295 | *pos++ = 'h'; |
| 296 | *pos = 0; |
| 297 | |
| 298 | /* Output the return type and function name. */ |
| 299 | ret_type = get_type_name (query_info.return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE(((GType) (1 << 0))), &is_pointer); |
| 300 | |
| 301 | fprintf (fp, |
| 302 | "<SIGNAL>\n<NAME>%s::%s</NAME>\n<RETURNS>%s%s</RETURNS>\n<FLAGS>%s</FLAGS>\n%s</SIGNAL>\n\n", |
| 303 | object_name, query_info.signal_name, ret_type, is_pointer ? "*" : "", flags, buffer); |
| 304 | } |
| 305 | |
| 306 | |
| 307 | /* Returns the type name to use for a signal argument or return value, given |
| 308 | the GtkType from the signal info. It also sets is_pointer to TRUE if the |
| 309 | argument needs a '*' since it is a pointer. */ |
| 310 | static const gchar * |
| 311 | get_type_name (GType type, gboolean * is_pointer) |
| 312 | { |
| 313 | const gchar *type_name; |
| 314 | |
| 315 | *is_pointer = FALSE(0); |
| 316 | type_name = g_type_name (type); |
| 317 | |
| 318 | switch (type) { |
| 319 | case G_TYPE_NONE((GType) ((1) << (2))): |
| 320 | case G_TYPE_UCHAR((GType) ((4) << (2))): |
| 321 | case G_TYPE_BOOLEAN((GType) ((5) << (2))): |
| 322 | case G_TYPE_UINT((GType) ((7) << (2))): |
| 323 | case G_TYPE_LONG((GType) ((8) << (2))): |
| 324 | case G_TYPE_ULONG((GType) ((9) << (2))): |
| 325 | case G_TYPE_POINTER((GType) ((17) << (2))): |
| 326 | /* These all have normal C type names so they are OK. */ |
| 327 | return type_name; |
| 328 | |
| 329 | case G_TYPE_CHAR((GType) ((3) << (2))): |
| 330 | return "char"; |
| 331 | |
| 332 | case G_TYPE_INT((GType) ((6) << (2))): |
| 333 | return "int"; |
| 334 | |
| 335 | case G_TYPE_FLOAT((GType) ((14) << (2))): |
| 336 | return "float"; |
| 337 | |
| 338 | case G_TYPE_DOUBLE((GType) ((15) << (2))): |
| 339 | return "double"; |
| 340 | |
| 341 | case G_TYPE_STRING((GType) ((16) << (2))): |
| 342 | /* A GtkString is really a gchar*. */ |
| 343 | *is_pointer = TRUE(!(0)); |
| 344 | return "char"; |
| 345 | |
| 346 | case G_TYPE_ENUM((GType) ((12) << (2))): |
| 347 | case G_TYPE_FLAGS((GType) ((13) << (2))): |
| 348 | /* We use a gint for both of these. Hopefully a subtype with a decent |
| 349 | name will be registered and used instead, as GTK+ does itself. */ |
| 350 | return "int"; |
| 351 | |
| 352 | case G_TYPE_BOXED((GType) ((18) << (2))): |
| 353 | /* The boxed type shouldn't be used itself, only subtypes. Though we |
| 354 | return 'gpointer' just in case. */ |
| 355 | return "gpointer"; |
| 356 | |
| 357 | case G_TYPE_PARAM((GType) ((19) << (2))): |
| 358 | /* A GParam is really a GParamSpec*. */ |
| 359 | *is_pointer = TRUE(!(0)); |
| 360 | return "GParamSpec"; |
| 361 | |
| 362 | #if GLIB_CHECK_VERSION (2, 25, 9)(2 > (2) || (2 == (2) && 86 > (25)) || (2 == (2 ) && 86 == (25) && 2 >= (9))) |
| 363 | case G_TYPE_VARIANT((GType) ((21) << (2))): |
| 364 | *is_pointer = TRUE(!(0)); |
| 365 | return "GVariant"; |
| 366 | #endif |
| 367 | |
| 368 | default: |
| 369 | break; |
| 370 | } |
| 371 | |
| 372 | /* For all GObject subclasses we can use the class name with a "*", |
| 373 | e.g. 'GtkWidget *'. */ |
| 374 | if (g_type_is_a (type, G_TYPE_OBJECT)((type) == (((GType) ((20) << (2)))) || (g_type_is_a) ( (type), (((GType) ((20) << (2))))))) |
| 375 | *is_pointer = TRUE(!(0)); |
| 376 | |
| 377 | /* Also catch non GObject root types */ |
| 378 | if (G_TYPE_IS_CLASSED (type)(g_type_test_flags ((type), G_TYPE_FLAG_CLASSED))) |
| 379 | *is_pointer = TRUE(!(0)); |
| 380 | |
| 381 | /* All boxed subtypes will be pointers as well. */ |
| 382 | /* Exception: GStrv */ |
| 383 | if (g_type_is_a (type, G_TYPE_BOXED)((type) == (((GType) ((18) << (2)))) || (g_type_is_a) ( (type), (((GType) ((18) << (2)))))) && |
| 384 | !g_type_is_a (type, G_TYPE_STRV)((type) == ((g_strv_get_type ())) || (g_type_is_a) ((type), ( (g_strv_get_type ()))))) |
| 385 | *is_pointer = TRUE(!(0)); |
| 386 | |
| 387 | /* All pointer subtypes will be pointers as well. */ |
| 388 | if (g_type_is_a (type, G_TYPE_POINTER)((type) == (((GType) ((17) << (2)))) || (g_type_is_a) ( (type), (((GType) ((17) << (2))))))) |
| 389 | *is_pointer = TRUE(!(0)); |
| 390 | |
| 391 | /* But enums are not */ |
| 392 | if (g_type_is_a (type, G_TYPE_ENUM)((type) == (((GType) ((12) << (2)))) || (g_type_is_a) ( (type), (((GType) ((12) << (2)))))) || |
| 393 | g_type_is_a (type, G_TYPE_FLAGS)((type) == (((GType) ((13) << (2)))) || (g_type_is_a) ( (type), (((GType) ((13) << (2))))))) |
| 394 | *is_pointer = FALSE(0); |
| 395 | |
| 396 | return type_name; |
| 397 | } |
| 398 | |
| 399 | |
| 400 | /* This outputs the hierarchy of all objects which have been initialized, |
| 401 | i.e. by calling their XXX_get_type() initialization function. */ |
| 402 | static void |
| 403 | output_object_hierarchy (void) |
| 404 | { |
| 405 | FILE *fp; |
| 406 | gint i,j; |
| 407 | GType root, type; |
| 408 | GType root_types[18] = { G_TYPE_INVALID((GType) ((0) << (2))), }; |
| 409 | |
| 410 | fp = fopen (hierarchy_filename, "w"); |
| 411 | if (fp == NULL((void*)0)) { |
| 412 | g_warning ("Couldn't open output file: %s : %s", hierarchy_filename, g_strerror(errno(*__errno_location ()))); |
| 413 | return; |
| 414 | } |
| 415 | output_hierarchy (fp, G_TYPE_OBJECT((GType) ((20) << (2))), 0); |
| 416 | output_hierarchy (fp, G_TYPE_INTERFACE((GType) ((2) << (2))), 0); |
| 417 | |
| 418 | for (i=0; object_types[i]; i++) { |
| 419 | root = object_types[i]; |
| 420 | while ((type = g_type_parent (root))) { |
| 421 | root = type; |
| 422 | } |
| 423 | if ((root != G_TYPE_OBJECT((GType) ((20) << (2)))) && (root != G_TYPE_INTERFACE((GType) ((2) << (2))))) { |
| 424 | for (j=0; root_types[j]; j++) { |
| 425 | if (root == root_types[j]) { |
| 426 | root = G_TYPE_INVALID((GType) ((0) << (2))); break; |
| 427 | } |
| 428 | } |
| 429 | if(root) { |
| 430 | root_types[j] = root; |
| 431 | output_hierarchy (fp, root, 0); |
| 432 | } |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | fclose (fp); |
| 437 | } |
| 438 | |
| 439 | /* This is called recursively to output the hierarchy of a object. */ |
| 440 | static void |
| 441 | output_hierarchy (FILE *fp, |
| 442 | GType type, |
| 443 | guint level) |
| 444 | { |
| 445 | guint i; |
| 446 | GType *children; |
| 447 | guint n_children; |
| 448 | |
| 449 | if (!type) |
| 450 | return; |
| 451 | |
| 452 | for (i = 0; i < level; i++) |
| 453 | fprintf (fp, " "); |
| 454 | fprintf (fp, "%s\n", g_type_name (type)); |
| 455 | |
| 456 | children = g_type_children (type, &n_children); |
| 457 | |
| 458 | for (i=0; i < n_children; i++) |
| 459 | output_hierarchy (fp, children[i], level + 1); |
| 460 | |
| 461 | g_free (children); |
| 462 | } |
| 463 | |
| 464 | static void output_object_interfaces (void) |
| 465 | { |
| 466 | guint i; |
| 467 | FILE *fp; |
| 468 | |
| 469 | fp = fopen (interfaces_filename, "w"); |
| 470 | if (fp == NULL((void*)0)) { |
| 471 | g_warning ("Couldn't open output file: %s : %s", interfaces_filename, g_strerror(errno(*__errno_location ()))); |
| 472 | return; |
| 473 | } |
| 474 | output_interfaces (fp, G_TYPE_OBJECT((GType) ((20) << (2)))); |
| 475 | |
| 476 | for (i = 0; object_types[i]; i++) { |
| 477 | if (!g_type_parent (object_types[i]) && |
| 478 | (object_types[i] != G_TYPE_OBJECT((GType) ((20) << (2)))) && |
| 479 | G_TYPE_IS_INSTANTIATABLE (object_types[i])(g_type_test_flags ((object_types[i]), G_TYPE_FLAG_INSTANTIATABLE ))) { |
| 480 | output_interfaces (fp, object_types[i]); |
| 481 | } |
| 482 | } |
| 483 | fclose (fp); |
| 484 | } |
| 485 | |
| 486 | static void |
| 487 | output_interfaces (FILE *fp, |
| 488 | GType type) |
| 489 | { |
| 490 | guint i; |
| 491 | GType *children, *interfaces; |
| 492 | guint n_children, n_interfaces; |
| 493 | |
| 494 | if (!type) |
| 495 | return; |
| 496 | |
| 497 | interfaces = g_type_interfaces (type, &n_interfaces); |
| 498 | |
| 499 | if (n_interfaces > 0) { |
| 500 | fprintf (fp, "%s", g_type_name (type)); |
| 501 | for (i=0; i < n_interfaces; i++) |
| 502 | fprintf (fp, " %s", g_type_name (interfaces[i])); |
| 503 | fprintf (fp, "\n"); |
| 504 | } |
| 505 | g_free (interfaces); |
| 506 | |
| 507 | children = g_type_children (type, &n_children); |
| 508 | |
| 509 | for (i=0; i < n_children; i++) |
| 510 | output_interfaces (fp, children[i]); |
| 511 | |
| 512 | g_free (children); |
| 513 | } |
| 514 | |
| 515 | static void output_interface_prerequisites (void) |
| 516 | { |
| 517 | FILE *fp; |
| 518 | |
| 519 | fp = fopen (prerequisites_filename, "w"); |
| 520 | if (fp == NULL((void*)0)) { |
| 521 | g_warning ("Couldn't open output file: %s : %s", prerequisites_filename, g_strerror(errno(*__errno_location ()))); |
| 522 | return; |
| 523 | } |
| 524 | output_prerequisites (fp, G_TYPE_INTERFACE((GType) ((2) << (2)))); |
| 525 | fclose (fp); |
| 526 | } |
| 527 | |
| 528 | static void |
| 529 | output_prerequisites (FILE *fp, |
| 530 | GType type) |
| 531 | { |
| 532 | #if GLIB_CHECK_VERSION(2,1,0)(2 > (2) || (2 == (2) && 86 > (1)) || (2 == (2) && 86 == (1) && 2 >= (0))) |
| 533 | guint i; |
| 534 | GType *children, *prerequisites; |
| 535 | guint n_children, n_prerequisites; |
| 536 | |
| 537 | if (!type) |
| 538 | return; |
| 539 | |
| 540 | prerequisites = g_type_interface_prerequisites (type, &n_prerequisites); |
| 541 | |
| 542 | if (n_prerequisites > 0) { |
| 543 | fprintf (fp, "%s", g_type_name (type)); |
| 544 | for (i=0; i < n_prerequisites; i++) |
| 545 | fprintf (fp, " %s", g_type_name (prerequisites[i])); |
| 546 | fprintf (fp, "\n"); |
| 547 | } |
| 548 | g_free (prerequisites); |
| 549 | |
| 550 | children = g_type_children (type, &n_children); |
| 551 | |
| 552 | for (i=0; i < n_children; i++) |
| 553 | output_prerequisites (fp, children[i]); |
| 554 | |
| 555 | g_free (children); |
| 556 | #endif |
| 557 | } |
| 558 | |
| 559 | static void |
| 560 | output_actions (void) |
| 561 | { |
| 562 | FILE *fp; |
| 563 | gint i; |
| 564 | |
| 565 | fp = fopen (actions_filename, "w"); |
| 566 | if (fp == NULL((void*)0)) { |
| 567 | g_warning ("Couldn't open output file: %s : %s", actions_filename, g_strerror(errno(*__errno_location ()))); |
| 568 | return; |
| 569 | } |
| 570 | |
| 571 | for (i = 0; object_types[i]; i++) { |
| 572 | output_object_actions (fp, object_types[i]); |
| 573 | } |
| 574 | |
| 575 | fclose (fp); |
| 576 | } |
| 577 | |
| 578 | static void |
| 579 | output_object_actions (FILE *fp, GType object_type) |
| 580 | { |
| 581 | gpointer class; |
| 582 | |
| 583 | if (!G_TYPE_IS_OBJECT (object_type)((g_type_fundamental (object_type)) == ((GType) ((20) << (2))))) |
| 584 | return; |
| 585 | |
| 586 | class = g_type_class_peek (object_type); |
| 587 | if (!class) |
| 588 | return; |
| 589 | |
| 590 | #ifdef GTK_IS_WIDGET_CLASS |
| 591 | #if GTK_CHECK_VERSION(3,96,0) |
| 592 | if (GTK_IS_WIDGET_CLASS (class)) { |
| 593 | guint i = 0; |
| 594 | const char *action_name; |
| 595 | GType owner; |
| 596 | const GVariantType *parameter_type; |
| 597 | const char *property_name; |
| 598 | const gchar *object_class_name; |
| 599 | |
| 600 | object_class_name = g_type_name (object_type); |
| 601 | while (gtk_widget_class_query_action (GTK_WIDGET_CLASS (class), |
| 602 | i, |
| 603 | &owner, |
| 604 | &action_name, |
| 605 | ¶meter_type, |
| 606 | &property_name)) { |
| 607 | i++; |
| 608 | if (owner == G_TYPE_FROM_CLASS (class)(((GTypeClass*) (class))->g_type)) |
| 609 | fprintf (fp, "<ACTION>\n" |
| 610 | "<NAME>%s:::%s</NAME>\n" |
| 611 | "<PARAMETER>%s</PARAMETER>\n" |
| 612 | "<PROPERTY>%s</PROPERTY>\n" |
| 613 | "</ACTION>\n\n", |
| 614 | object_class_name, |
| 615 | action_name, |
| 616 | parameter_type ? g_variant_type_peek_string (parameter_type) : "", |
| 617 | property_name ? property_name : ""); |
| 618 | } |
| 619 | } |
| 620 | #endif |
| 621 | #endif |
| 622 | } |
| 623 | |
| 624 | static void |
| 625 | output_args (void) |
| 626 | { |
| 627 | FILE *fp; |
| 628 | gint i; |
| 629 | |
| 630 | fp = fopen (args_filename, "w"); |
| 631 | if (fp == NULL((void*)0)) { |
| 632 | g_warning ("Couldn't open output file: %s : %s", args_filename, g_strerror(errno(*__errno_location ()))); |
| 633 | return; |
| 634 | } |
| 635 | |
| 636 | for (i = 0; object_types[i]; i++) { |
| 637 | output_object_args (fp, object_types[i]); |
| 638 | } |
| 639 | |
| 640 | fclose (fp); |
| 641 | } |
| 642 | |
| 643 | static gint |
| 644 | compare_param_specs (const void *a, const void *b) |
| 645 | { |
| 646 | GParamSpec *spec_a = *(GParamSpec **)a; |
| 647 | GParamSpec *spec_b = *(GParamSpec **)b; |
| 648 | |
| 649 | return strcmp (g_param_spec_get_name (spec_a), g_param_spec_get_name (spec_b)); |
| 650 | } |
| 651 | |
| 652 | /* Its common to have unsigned properties restricted |
| 653 | * to the signed range. Therefore we make this look |
| 654 | * a bit nicer by spelling out the max constants. |
| 655 | */ |
| 656 | |
| 657 | /* Don't use "==" with floats, it might trigger a gcc warning. */ |
| 658 | #define GTKDOC_COMPARE_FLOAT(x, y)(x <= y && x >= y) (x <= y && x >= y) |
| 659 | |
| 660 | static gchar* |
| 661 | describe_double_constant (gdouble value) |
| 662 | { |
| 663 | gchar *desc; |
| 664 | |
| 665 | if (GTKDOC_COMPARE_FLOAT (value, G_MAXDOUBLE)(value <= 1.7976931348623157e+308 && value >= 1.7976931348623157e+308 )) |
| 666 | desc = g_strdup ("G_MAXDOUBLE")g_strdup_inline ("G_MAXDOUBLE"); |
| 667 | else if (GTKDOC_COMPARE_FLOAT (value, G_MINDOUBLE)(value <= 2.2250738585072014e-308 && value >= 2.2250738585072014e-308 )) |
| 668 | desc = g_strdup ("G_MINDOUBLE")g_strdup_inline ("G_MINDOUBLE"); |
| 669 | else if (GTKDOC_COMPARE_FLOAT (value, -G_MAXDOUBLE)(value <= -1.7976931348623157e+308 && value >= - 1.7976931348623157e+308)) |
| 670 | desc = g_strdup ("-G_MAXDOUBLE")g_strdup_inline ("-G_MAXDOUBLE"); |
| 671 | else if (GTKDOC_COMPARE_FLOAT (value, (gdouble)G_MAXFLOAT)(value <= (gdouble)3.40282347e+38F && value >= ( gdouble)3.40282347e+38F)) |
| 672 | desc = g_strdup ("G_MAXFLOAT")g_strdup_inline ("G_MAXFLOAT"); |
| 673 | else if (GTKDOC_COMPARE_FLOAT (value, (gdouble)G_MINFLOAT)(value <= (gdouble)1.17549435e-38F && value >= ( gdouble)1.17549435e-38F)) |
| 674 | desc = g_strdup ("G_MINFLOAT")g_strdup_inline ("G_MINFLOAT"); |
| 675 | else if (GTKDOC_COMPARE_FLOAT (value, (gdouble)-G_MAXFLOAT)(value <= (gdouble)-3.40282347e+38F && value >= (gdouble)-3.40282347e+38F)) |
| 676 | desc = g_strdup ("-G_MAXFLOAT")g_strdup_inline ("-G_MAXFLOAT"); |
| 677 | else{ |
| 678 | /* make sure floats are output with a decimal dot irrespective of |
| 679 | * current locale. Use formatd since we want human-readable numbers |
| 680 | * and do not need the exact same bit representation when deserialising */ |
| 681 | desc = g_malloc0 (G_ASCII_DTOSTR_BUF_SIZE(29 + 10)); |
| 682 | g_ascii_formatd (desc, G_ASCII_DTOSTR_BUF_SIZE(29 + 10), "%g", value); |
| 683 | } |
| 684 | |
| 685 | return desc; |
| 686 | } |
| 687 | |
| 688 | static gchar* |
| 689 | describe_signed_constant (gsize size, gint64 value) |
| 690 | { |
| 691 | gchar *desc = NULL((void*)0); |
| 692 | |
| 693 | switch (size) { |
| 694 | case 2: |
| 695 | if (sizeof (int) == 2) { |
| 696 | if (value == G_MAXINT2147483647) |
| 697 | desc = g_strdup ("G_MAXINT")g_strdup_inline ("G_MAXINT"); |
| 698 | else if (value == G_MININT(-2147483647 -1)) |
| 699 | desc = g_strdup ("G_MININT")g_strdup_inline ("G_MININT"); |
| 700 | } |
| 701 | break; |
| 702 | case 4: |
| 703 | if (sizeof (int) == 4) { |
| 704 | if (value == G_MAXINT2147483647) |
| 705 | desc = g_strdup ("G_MAXINT")g_strdup_inline ("G_MAXINT"); |
| 706 | else if (value == G_MININT(-2147483647 -1)) |
| 707 | desc = g_strdup ("G_MININT")g_strdup_inline ("G_MININT"); |
| 708 | } |
| 709 | if (value == G_MAXLONG9223372036854775807L) |
| 710 | desc = g_strdup ("G_MAXLONG")g_strdup_inline ("G_MAXLONG"); |
| 711 | else if (value == G_MINLONG(-9223372036854775807L -1L)) |
| 712 | desc = g_strdup ("G_MINLONG")g_strdup_inline ("G_MINLONG"); |
| 713 | break; |
| 714 | case 8: |
| 715 | if (value == G_MAXINT64(0x7fffffffffffffffL)) |
| 716 | desc = g_strdup ("G_MAXINT64")g_strdup_inline ("G_MAXINT64"); |
| 717 | else if (value == G_MININT64((gint64) (-(0x7fffffffffffffffL) - (1L)))) |
| 718 | desc = g_strdup ("G_MININT64")g_strdup_inline ("G_MININT64"); |
| 719 | break; |
| 720 | default: |
| 721 | break; |
| 722 | } |
| 723 | if (!desc) |
| 724 | desc = g_strdup_printf ("%" G_GINT64_FORMAT"li", value); |
| 725 | |
| 726 | return desc; |
| 727 | } |
| 728 | |
| 729 | static gchar* |
| 730 | describe_unsigned_constant (gsize size, guint64 value) |
| 731 | { |
| 732 | gchar *desc = NULL((void*)0); |
| 733 | |
| 734 | switch (size) { |
| 735 | case 2: |
| 736 | if (sizeof (int) == 2) { |
| 737 | if (value == (guint64)G_MAXINT2147483647) |
| 738 | desc = g_strdup ("G_MAXINT")g_strdup_inline ("G_MAXINT"); |
| 739 | else if (value == G_MAXUINT(2147483647 *2U +1U)) |
| 740 | desc = g_strdup ("G_MAXUINT")g_strdup_inline ("G_MAXUINT"); |
| 741 | } |
| 742 | break; |
| 743 | case 4: |
| 744 | if (sizeof (int) == 4) { |
| 745 | if (value == (guint64)G_MAXINT2147483647) |
| 746 | desc = g_strdup ("G_MAXINT")g_strdup_inline ("G_MAXINT"); |
| 747 | else if (value == G_MAXUINT(2147483647 *2U +1U)) |
| 748 | desc = g_strdup ("G_MAXUINT")g_strdup_inline ("G_MAXUINT"); |
| 749 | } |
| 750 | if (desc == NULL((void*)0)) { |
| 751 | if (value == (guint64)G_MAXLONG9223372036854775807L) |
| 752 | desc = g_strdup ("G_MAXLONG")g_strdup_inline ("G_MAXLONG"); |
| 753 | else if (value == G_MAXULONG(9223372036854775807L *2UL+1UL)) |
| 754 | desc = g_strdup ("G_MAXULONG")g_strdup_inline ("G_MAXULONG"); |
| 755 | } |
| 756 | break; |
| 757 | case 8: |
| 758 | if (value == G_MAXINT64(0x7fffffffffffffffL)) |
| 759 | desc = g_strdup ("G_MAXINT64")g_strdup_inline ("G_MAXINT64"); |
| 760 | else if (value == G_MAXUINT64(0xffffffffffffffffUL)) |
| 761 | desc = g_strdup ("G_MAXUINT64")g_strdup_inline ("G_MAXUINT64"); |
| 762 | break; |
| 763 | default: |
| 764 | break; |
| 765 | } |
| 766 | if (!desc) |
| 767 | desc = g_strdup_printf ("%" G_GUINT64_FORMAT"lu", value); |
| 768 | |
| 769 | return desc; |
| 770 | } |
| 771 | |
| 772 | static gchar* |
| 773 | describe_type (GParamSpec *spec) |
| 774 | { |
| 775 | gchar *desc; |
| 776 | gchar *lower; |
| 777 | gchar *upper; |
| 778 | |
| 779 | if (G_IS_PARAM_SPEC_CHAR (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[0])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 780 | GParamSpecChar *pspec = G_PARAM_SPEC_CHAR (spec)((((GParamSpecChar*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[0])))))); |
| 781 | |
| 782 | lower = describe_signed_constant (sizeof(gchar), pspec->minimum); |
| 783 | upper = describe_signed_constant (sizeof(gchar), pspec->maximum); |
| 784 | if (pspec->minimum == G_MININT8((gint8) (-((gint8) 0x7f) - 1)) && pspec->maximum == G_MAXINT8((gint8) 0x7f)) |
| 785 | desc = g_strdup ("")g_strdup_inline (""); |
| 786 | else if (pspec->minimum == G_MININT8((gint8) (-((gint8) 0x7f) - 1))) |
| 787 | desc = g_strdup_printf ("<= %s", upper); |
| 788 | else if (pspec->maximum == G_MAXINT8((gint8) 0x7f)) |
| 789 | desc = g_strdup_printf (">= %s", lower); |
| 790 | else |
| 791 | desc = g_strdup_printf ("[%s,%s]", lower, upper); |
| 792 | g_free (lower); |
| 793 | g_free (upper); |
| 794 | } |
| 795 | else if (G_IS_PARAM_SPEC_UCHAR (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[1])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 796 | GParamSpecUChar *pspec = G_PARAM_SPEC_UCHAR (spec)((((GParamSpecUChar*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[1])))))); |
| 797 | |
| 798 | lower = describe_unsigned_constant (sizeof(guchar), pspec->minimum); |
| 799 | upper = describe_unsigned_constant (sizeof(guchar), pspec->maximum); |
| 800 | if (pspec->minimum == 0 && pspec->maximum == G_MAXUINT8((guint8) 0xff)) |
| 801 | desc = g_strdup ("")g_strdup_inline (""); |
| 802 | else if (pspec->minimum == 0) |
| 803 | desc = g_strdup_printf ("<= %s", upper); |
| 804 | else if (pspec->maximum == G_MAXUINT8((guint8) 0xff)) |
| 805 | desc = g_strdup_printf (">= %s", lower); |
| 806 | else |
| 807 | desc = g_strdup_printf ("[%s,%s]", lower, upper); |
| 808 | g_free (lower); |
| 809 | g_free (upper); |
| 810 | } |
| 811 | else if (G_IS_PARAM_SPEC_INT (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[3])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 812 | GParamSpecInt *pspec = G_PARAM_SPEC_INT (spec)((((GParamSpecInt*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[3])))))); |
| 813 | |
| 814 | lower = describe_signed_constant (sizeof(gint), pspec->minimum); |
| 815 | upper = describe_signed_constant (sizeof(gint), pspec->maximum); |
| 816 | if (pspec->minimum == G_MININT(-2147483647 -1) && pspec->maximum == G_MAXINT2147483647) |
| 817 | desc = g_strdup ("")g_strdup_inline (""); |
| 818 | else if (pspec->minimum == G_MININT(-2147483647 -1)) |
| 819 | desc = g_strdup_printf ("<= %s", upper); |
| 820 | else if (pspec->maximum == G_MAXINT2147483647) |
| 821 | desc = g_strdup_printf (">= %s", lower); |
| 822 | else |
| 823 | desc = g_strdup_printf ("[%s,%s]", lower, upper); |
| 824 | g_free (lower); |
| 825 | g_free (upper); |
| 826 | } |
| 827 | else if (G_IS_PARAM_SPEC_UINT (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[4])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 828 | GParamSpecUInt *pspec = G_PARAM_SPEC_UINT (spec)((((GParamSpecUInt*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[4])))))); |
| 829 | |
| 830 | lower = describe_unsigned_constant (sizeof(guint), pspec->minimum); |
| 831 | upper = describe_unsigned_constant (sizeof(guint), pspec->maximum); |
| 832 | if (pspec->minimum == 0 && pspec->maximum == G_MAXUINT(2147483647 *2U +1U)) |
| 833 | desc = g_strdup ("")g_strdup_inline (""); |
| 834 | else if (pspec->minimum == 0) |
| 835 | desc = g_strdup_printf ("<= %s", upper); |
| 836 | else if (pspec->maximum == G_MAXUINT(2147483647 *2U +1U)) |
| 837 | desc = g_strdup_printf (">= %s", lower); |
| 838 | else |
| 839 | desc = g_strdup_printf ("[%s,%s]", lower, upper); |
| 840 | g_free (lower); |
| 841 | g_free (upper); |
| 842 | } |
| 843 | else if (G_IS_PARAM_SPEC_LONG (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[5])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 844 | GParamSpecLong *pspec = G_PARAM_SPEC_LONG (spec)((((GParamSpecLong*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[5])))))); |
| 845 | |
| 846 | lower = describe_signed_constant (sizeof(glong), pspec->minimum); |
| 847 | upper = describe_signed_constant (sizeof(glong), pspec->maximum); |
| 848 | if (pspec->minimum == G_MINLONG(-9223372036854775807L -1L) && pspec->maximum == G_MAXLONG9223372036854775807L) |
| 849 | desc = g_strdup ("")g_strdup_inline (""); |
| 850 | else if (pspec->minimum == G_MINLONG(-9223372036854775807L -1L)) |
| 851 | desc = g_strdup_printf ("<= %s", upper); |
| 852 | else if (pspec->maximum == G_MAXLONG9223372036854775807L) |
| 853 | desc = g_strdup_printf (">= %s", lower); |
| 854 | else |
| 855 | desc = g_strdup_printf ("[%s,%s]", lower, upper); |
| 856 | g_free (lower); |
| 857 | g_free (upper); |
| 858 | } |
| 859 | else if (G_IS_PARAM_SPEC_ULONG (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[6])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 860 | GParamSpecULong *pspec = G_PARAM_SPEC_ULONG (spec)((((GParamSpecULong*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[6])))))); |
| 861 | |
| 862 | lower = describe_unsigned_constant (sizeof(gulong), pspec->minimum); |
| 863 | upper = describe_unsigned_constant (sizeof(gulong), pspec->maximum); |
| 864 | if (pspec->minimum == 0 && pspec->maximum == G_MAXULONG(9223372036854775807L *2UL+1UL)) |
| 865 | desc = g_strdup ("")g_strdup_inline (""); |
| 866 | else if (pspec->minimum == 0) |
| 867 | desc = g_strdup_printf ("<= %s", upper); |
| 868 | else if (pspec->maximum == G_MAXULONG(9223372036854775807L *2UL+1UL)) |
| 869 | desc = g_strdup_printf (">= %s", lower); |
| 870 | else |
| 871 | desc = g_strdup_printf ("[%s,%s]", lower, upper); |
| 872 | g_free (lower); |
| 873 | g_free (upper); |
| 874 | } |
| 875 | else if (G_IS_PARAM_SPEC_INT64 (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[7])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 876 | GParamSpecInt64 *pspec = G_PARAM_SPEC_INT64 (spec)((((GParamSpecInt64*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[7])))))); |
| 877 | |
| 878 | lower = describe_signed_constant (sizeof(gint64), pspec->minimum); |
| 879 | upper = describe_signed_constant (sizeof(gint64), pspec->maximum); |
| 880 | if (pspec->minimum == G_MININT64((gint64) (-(0x7fffffffffffffffL) - (1L))) && pspec->maximum == G_MAXINT64(0x7fffffffffffffffL)) |
| 881 | desc = g_strdup ("")g_strdup_inline (""); |
| 882 | else if (pspec->minimum == G_MININT64((gint64) (-(0x7fffffffffffffffL) - (1L)))) |
| 883 | desc = g_strdup_printf ("<= %s", upper); |
| 884 | else if (pspec->maximum == G_MAXINT64(0x7fffffffffffffffL)) |
| 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_UINT64 (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[8])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 892 | GParamSpecUInt64 *pspec = G_PARAM_SPEC_UINT64 (spec)((((GParamSpecUInt64*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((spec)), ((g_param_spec_types[8])))))); |
| 893 | |
| 894 | lower = describe_unsigned_constant (sizeof(guint64), pspec->minimum); |
| 895 | upper = describe_unsigned_constant (sizeof(guint64), pspec->maximum); |
| 896 | if (pspec->minimum == 0 && pspec->maximum == G_MAXUINT64(0xffffffffffffffffUL)) |
| 897 | desc = g_strdup ("")g_strdup_inline (""); |
| 898 | else if (pspec->minimum == 0) |
| 899 | desc = g_strdup_printf ("<= %s", upper); |
| 900 | else if (pspec->maximum == G_MAXUINT64(0xffffffffffffffffUL)) |
| 901 | desc = g_strdup_printf (">= %s", lower); |
| 902 | else |
| 903 | desc = g_strdup_printf ("[%s,%s]", lower, upper); |
| 904 | g_free (lower); |
| 905 | g_free (upper); |
| 906 | } |
| 907 | else if (G_IS_PARAM_SPEC_FLOAT (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[12])); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 908 | GParamSpecFloat *pspec = G_PARAM_SPEC_FLOAT (spec)((((GParamSpecFloat*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[12])))))); |
| 909 | |
| 910 | lower = describe_double_constant (pspec->minimum); |
| 911 | upper = describe_double_constant (pspec->maximum); |
| 912 | if (GTKDOC_COMPARE_FLOAT (pspec->minimum, -G_MAXFLOAT)(pspec->minimum <= -3.40282347e+38F && pspec-> minimum >= -3.40282347e+38F)) { |
| 913 | if (GTKDOC_COMPARE_FLOAT (pspec->maximum, G_MAXFLOAT)(pspec->maximum <= 3.40282347e+38F && pspec-> maximum >= 3.40282347e+38F)) |
| 914 | desc = g_strdup ("")g_strdup_inline (""); |
| 915 | else |
| 916 | desc = g_strdup_printf ("<= %s", upper); |
| 917 | } |
| 918 | else if (GTKDOC_COMPARE_FLOAT (pspec->maximum, G_MAXFLOAT)(pspec->maximum <= 3.40282347e+38F && pspec-> maximum >= 3.40282347e+38F)) |
| 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_DOUBLE (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[13])); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 926 | GParamSpecDouble *pspec = G_PARAM_SPEC_DOUBLE (spec)((((GParamSpecDouble*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((spec)), ((g_param_spec_types[13])))))); |
| 927 | |
| 928 | lower = describe_double_constant (pspec->minimum); |
| 929 | upper = describe_double_constant (pspec->maximum); |
| 930 | if (GTKDOC_COMPARE_FLOAT (pspec->minimum, -G_MAXDOUBLE)(pspec->minimum <= -1.7976931348623157e+308 && pspec ->minimum >= -1.7976931348623157e+308)) { |
| 931 | if (GTKDOC_COMPARE_FLOAT (pspec->maximum, G_MAXDOUBLE)(pspec->maximum <= 1.7976931348623157e+308 && pspec ->maximum >= 1.7976931348623157e+308)) |
| 932 | desc = g_strdup ("")g_strdup_inline (""); |
| 933 | else |
| 934 | desc = g_strdup_printf ("<= %s", upper); |
| 935 | } |
| 936 | else if (GTKDOC_COMPARE_FLOAT (pspec->maximum, G_MAXDOUBLE)(pspec->maximum <= 1.7976931348623157e+308 && pspec ->maximum >= 1.7976931348623157e+308)) |
| 937 | desc = g_strdup_printf (">= %s", lower); |
| 938 | else |
| 939 | desc = g_strdup_printf ("[%s,%s]", lower, upper); |
| 940 | g_free (lower); |
| 941 | g_free (upper); |
| 942 | } |
| 943 | #if GLIB_CHECK_VERSION (2, 12, 0)(2 > (2) || (2 == (2) && 86 > (12)) || (2 == (2 ) && 86 == (12) && 2 >= (0))) |
| 944 | else if (G_IS_PARAM_SPEC_GTYPE (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[21])); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 945 | GParamSpecGType *pspec = G_PARAM_SPEC_GTYPE (spec)((((GParamSpecGType*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[21])))))); |
| 946 | gboolean is_pointer; |
| 947 | |
| 948 | desc = g_strdup (get_type_name (pspec->is_a_type, &is_pointer))g_strdup_inline (get_type_name (pspec->is_a_type, &is_pointer )); |
| 949 | } |
| 950 | #endif |
| 951 | #if GLIB_CHECK_VERSION (2, 25, 9)(2 > (2) || (2 == (2) && 86 > (25)) || (2 == (2 ) && 86 == (25) && 2 >= (9))) |
| 952 | else if (G_IS_PARAM_SPEC_VARIANT (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[22])); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 953 | GParamSpecVariant *pspec = G_PARAM_SPEC_VARIANT (spec)((((GParamSpecVariant*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((spec)), ((g_param_spec_types[22])))))); |
| 954 | gchar *variant_type; |
| 955 | |
| 956 | variant_type = g_variant_type_dup_string (pspec->type); |
| 957 | desc = g_strdup_printf ("GVariant<%s>", variant_type); |
| 958 | g_free (variant_type); |
| 959 | } |
| 960 | #endif |
| 961 | else { |
| 962 | desc = g_strdup ("")g_strdup_inline (""); |
| 963 | } |
| 964 | |
| 965 | return desc; |
| 966 | } |
| 967 | |
| 968 | static gchar* |
| 969 | describe_default (GParamSpec *spec) |
| 970 | { |
| 971 | gchar *desc; |
| 972 | |
| 973 | if (G_IS_PARAM_SPEC_CHAR (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[0])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 974 | GParamSpecChar *pspec = G_PARAM_SPEC_CHAR (spec)((((GParamSpecChar*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[0])))))); |
| 975 | |
| 976 | desc = g_strdup_printf ("%d", pspec->default_value); |
| 977 | } |
| 978 | else if (G_IS_PARAM_SPEC_UCHAR (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[1])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 979 | GParamSpecUChar *pspec = G_PARAM_SPEC_UCHAR (spec)((((GParamSpecUChar*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[1])))))); |
| 980 | |
| 981 | desc = g_strdup_printf ("%u", pspec->default_value); |
| 982 | } |
| 983 | else if (G_IS_PARAM_SPEC_BOOLEAN (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[2])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 984 | GParamSpecBoolean *pspec = G_PARAM_SPEC_BOOLEAN (spec)((((GParamSpecBoolean*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((spec)), ((g_param_spec_types[2])))))); |
| 985 | |
| 986 | desc = g_strdup_printf ("%s", pspec->default_value ? "TRUE" : "FALSE"); |
| 987 | } |
| 988 | else if (G_IS_PARAM_SPEC_INT (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[3])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 989 | GParamSpecInt *pspec = G_PARAM_SPEC_INT (spec)((((GParamSpecInt*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[3])))))); |
| 990 | |
| 991 | desc = g_strdup_printf ("%d", pspec->default_value); |
| 992 | } |
| 993 | else if (G_IS_PARAM_SPEC_UINT (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[4])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 994 | GParamSpecUInt *pspec = G_PARAM_SPEC_UINT (spec)((((GParamSpecUInt*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[4])))))); |
| 995 | |
| 996 | desc = g_strdup_printf ("%u", pspec->default_value); |
| 997 | } |
| 998 | else if (G_IS_PARAM_SPEC_LONG (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[5])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 999 | GParamSpecLong *pspec = G_PARAM_SPEC_LONG (spec)((((GParamSpecLong*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[5])))))); |
| 1000 | |
| 1001 | desc = g_strdup_printf ("%ld", pspec->default_value); |
| 1002 | } |
| 1003 | else if (G_IS_PARAM_SPEC_LONG (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[5])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 1004 | GParamSpecULong *pspec = G_PARAM_SPEC_ULONG (spec)((((GParamSpecULong*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[6])))))); |
| 1005 | |
| 1006 | desc = g_strdup_printf ("%lu", pspec->default_value); |
| 1007 | } |
| 1008 | else if (G_IS_PARAM_SPEC_INT64 (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[7])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 1009 | GParamSpecInt64 *pspec = G_PARAM_SPEC_INT64 (spec)((((GParamSpecInt64*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[7])))))); |
| 1010 | |
| 1011 | desc = g_strdup_printf ("%" G_GINT64_FORMAT"li", pspec->default_value); |
| 1012 | } |
| 1013 | else if (G_IS_PARAM_SPEC_UINT64 (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[8])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) |
| 1014 | { |
| 1015 | GParamSpecUInt64 *pspec = G_PARAM_SPEC_UINT64 (spec)((((GParamSpecUInt64*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((spec)), ((g_param_spec_types[8])))))); |
| 1016 | |
| 1017 | desc = g_strdup_printf ("%" G_GUINT64_FORMAT"lu", pspec->default_value); |
| 1018 | } |
| 1019 | else if (G_IS_PARAM_SPEC_UNICHAR (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[9])); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 1020 | GParamSpecUnichar *pspec = G_PARAM_SPEC_UNICHAR (spec)((((GParamSpecUnichar*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((spec)), ((g_param_spec_types[9])))))); |
| 1021 | |
| 1022 | if (g_unichar_isprint (pspec->default_value)) |
| 1023 | desc = g_strdup_printf ("'%c'", pspec->default_value); |
| 1024 | else |
| 1025 | desc = g_strdup_printf ("%u", pspec->default_value); |
| 1026 | } |
| 1027 | else if (G_IS_PARAM_SPEC_ENUM (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[10])); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 1028 | GParamSpecEnum *pspec = G_PARAM_SPEC_ENUM (spec)((((GParamSpecEnum*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[10])))))); |
| 1029 | |
| 1030 | GEnumValue *value = g_enum_get_value (pspec->enum_class, pspec->default_value); |
| 1031 | if (value) |
| 1032 | desc = g_strdup_printf ("%s", value->value_name); |
| 1033 | else |
| 1034 | desc = g_strdup_printf ("%d", pspec->default_value); |
| 1035 | } |
| 1036 | else if (G_IS_PARAM_SPEC_FLAGS (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[11])); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 1037 | GParamSpecFlags *pspec = G_PARAM_SPEC_FLAGS (spec)((((GParamSpecFlags*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[11])))))); |
| 1038 | guint default_value; |
| 1039 | GString *acc; |
| 1040 | |
| 1041 | default_value = pspec->default_value; |
| 1042 | acc = g_string_new (""); |
| 1043 | |
| 1044 | while (default_value) { |
| 1045 | GFlagsValue *value = g_flags_get_first_value (pspec->flags_class, default_value); |
| 1046 | |
| 1047 | if (!value) |
| 1048 | break; |
| 1049 | |
| 1050 | if (acc->len > 0) |
| 1051 | g_string_append (acc, " | ")(__builtin_constant_p (" | ") ? __extension__ ({ const char * const __val = (" | "); g_string_append_len_inline (acc, __val , (__val != ((void*)0)) ? (gssize) strlen (((__val) + !(__val ))) : (gssize) -1); }) : g_string_append_len_inline (acc, " | " , (gssize) -1)); |
| 1052 | g_string_append (acc, value->value_name)(__builtin_constant_p (value->value_name) ? __extension__ ( { const char * const __val = (value->value_name); g_string_append_len_inline (acc, __val, (__val != ((void*)0)) ? (gssize) strlen (((__val ) + !(__val))) : (gssize) -1); }) : g_string_append_len_inline (acc, value->value_name, (gssize) -1)); |
| 1053 | |
| 1054 | default_value &= ~value->value; |
| 1055 | } |
| 1056 | |
| 1057 | if (default_value == 0) |
| 1058 | desc = g_string_free (acc, FALSE)(__builtin_constant_p ((0)) ? (((0)) ? (g_string_free) ((acc) , ((0))) : g_string_free_and_steal (acc)) : (g_string_free) ( (acc), ((0)))); |
| 1059 | else { |
| 1060 | desc = g_strdup_printf ("%d", pspec->default_value); |
| 1061 | g_string_free (acc, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (acc), ((!(0)))) : g_string_free_and_steal (acc)) : (g_string_free ) ((acc), ((!(0))))); |
| 1062 | } |
| 1063 | } |
| 1064 | else if (G_IS_PARAM_SPEC_FLOAT (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[12])); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 1065 | GParamSpecFloat *pspec = G_PARAM_SPEC_FLOAT (spec)((((GParamSpecFloat*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((spec)), ((g_param_spec_types[12])))))); |
| 1066 | |
| 1067 | /* make sure floats are output with a decimal dot irrespective of |
| 1068 | * current locale. Use formatd since we want human-readable numbers |
| 1069 | * and do not need the exact same bit representation when deserialising */ |
| 1070 | desc = g_malloc0 (G_ASCII_DTOSTR_BUF_SIZE(29 + 10)); |
| 1071 | g_ascii_formatd (desc, G_ASCII_DTOSTR_BUF_SIZE(29 + 10), "%g", |
| 1072 | pspec->default_value); |
| 1073 | } |
| 1074 | else if (G_IS_PARAM_SPEC_DOUBLE (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[13])); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 1075 | GParamSpecDouble *pspec = G_PARAM_SPEC_DOUBLE (spec)((((GParamSpecDouble*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((spec)), ((g_param_spec_types[13])))))); |
| 1076 | |
| 1077 | /* make sure floats are output with a decimal dot irrespective of |
| 1078 | * current locale. Use formatd since we want human-readable numbers |
| 1079 | * and do not need the exact same bit representation when deserialising */ |
| 1080 | desc = g_malloc0 (G_ASCII_DTOSTR_BUF_SIZE(29 + 10)); |
| 1081 | g_ascii_formatd (desc, G_ASCII_DTOSTR_BUF_SIZE(29 + 10), "%g", |
| 1082 | pspec->default_value); |
| 1083 | } |
| 1084 | else if (G_IS_PARAM_SPEC_STRING (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[14])); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 1085 | GParamSpecString *pspec = G_PARAM_SPEC_STRING (spec)((((GParamSpecString*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((spec)), ((g_param_spec_types[14])))))); |
| 1086 | |
| 1087 | if (pspec->default_value) { |
| 1088 | gchar *esc = g_strescape (pspec->default_value, NULL((void*)0)); |
| 1089 | desc = g_strdup_printf ("\"%s\"", esc); |
| 1090 | g_free (esc); |
| 1091 | } |
| 1092 | else |
| 1093 | desc = g_strdup_printf ("NULL"); |
| 1094 | } |
| 1095 | #if GLIB_CHECK_VERSION (2, 25, 9)(2 > (2) || (2 == (2) && 86 > (25)) || (2 == (2 ) && 86 == (25) && 2 >= (9))) |
| 1096 | else if (G_IS_PARAM_SPEC_VARIANT (spec)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (spec)); GType __t = ((g_param_spec_types[22])); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { |
| 1097 | GParamSpecVariant *pspec = G_PARAM_SPEC_VARIANT (spec)((((GParamSpecVariant*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((spec)), ((g_param_spec_types[22])))))); |
| 1098 | |
| 1099 | if (pspec->default_value) |
| 1100 | desc = g_variant_print (pspec->default_value, TRUE(!(0))); |
| 1101 | else |
| 1102 | desc = g_strdup ("NULL")g_strdup_inline ("NULL"); |
| 1103 | } |
| 1104 | #endif |
| 1105 | else { |
| 1106 | desc = g_strdup ("")g_strdup_inline (""); |
| 1107 | } |
| 1108 | |
| 1109 | return desc; |
| 1110 | } |
| 1111 | |
| 1112 | |
| 1113 | static void |
| 1114 | output_object_args (FILE *fp, GType object_type) |
| 1115 | { |
| 1116 | gpointer class; |
| 1117 | const gchar *object_class_name; |
| 1118 | guint arg; |
| 1119 | gchar flags[16], *pos; |
| 1120 | GParamSpec **properties; |
| 1121 | guint n_properties; |
| 1122 | gboolean child_prop; |
| 1123 | gboolean style_prop; |
| 1124 | gboolean is_pointer; |
| 1125 | const gchar *type_name; |
| 1126 | gchar *type_desc; |
| 1127 | gchar *default_value; |
| 1128 | |
| 1129 | if (G_TYPE_IS_OBJECT (object_type)((g_type_fundamental (object_type)) == ((GType) ((20) << (2))))) { |
| 1130 | class = g_type_class_peek (object_type); |
| 1131 | if (!class) |
| 1132 | return; |
| 1133 | |
| 1134 | properties = g_object_class_list_properties (class, &n_properties); |
| 1135 | } |
| 1136 | #if GLIB_MAJOR_VERSION2 > 2 || (GLIB_MAJOR_VERSION2 == 2 && GLIB_MINOR_VERSION86 >= 3) |
| 1137 | else if (G_TYPE_IS_INTERFACE (object_type)((g_type_fundamental (object_type)) == ((GType) ((2) << (2))))) { |
| 1138 | class = g_type_default_interface_ref (object_type); |
| 1139 | |
| 1140 | if (!class) |
| 1141 | return; |
| 1142 | |
| 1143 | properties = g_object_interface_list_properties (class, &n_properties); |
| 1144 | } |
| 1145 | #endif |
| 1146 | else |
| 1147 | return; |
| 1148 | |
| 1149 | object_class_name = g_type_name (object_type); |
| 1150 | |
| 1151 | child_prop = FALSE(0); |
| 1152 | style_prop = FALSE(0); |
| 1153 | |
| 1154 | while (TRUE(!(0))) { |
| 1155 | if (n_properties > 0) |
| 1156 | qsort (properties, n_properties, sizeof (GParamSpec *), compare_param_specs); |
| 1157 | for (arg = 0; arg < n_properties; arg++) { |
| 1158 | GParamSpec *spec = properties[arg]; |
| 1159 | const gchar *nick, *blurb, *dot; |
| 1160 | |
| 1161 | if (spec->owner_type != object_type) |
| 1162 | continue; |
| 1163 | |
| 1164 | pos = flags; |
| 1165 | /* We use one-character flags for simplicity. */ |
| 1166 | if (child_prop && !style_prop) |
| 1167 | *pos++ = 'c'; |
| 1168 | if (style_prop) |
| 1169 | *pos++ = 's'; |
| 1170 | if (spec->flags & G_PARAM_READABLE) |
| 1171 | *pos++ = 'r'; |
| 1172 | if (spec->flags & G_PARAM_WRITABLE) |
| 1173 | *pos++ = 'w'; |
| 1174 | if (spec->flags & G_PARAM_CONSTRUCT) |
| 1175 | *pos++ = 'x'; |
| 1176 | if (spec->flags & G_PARAM_CONSTRUCT_ONLY) |
| 1177 | *pos++ = 'X'; |
| 1178 | *pos = 0; |
| 1179 | |
| 1180 | nick = g_param_spec_get_nick (spec); |
| 1181 | blurb = g_param_spec_get_blurb (spec); |
| 1182 | |
| 1183 | dot = ""; |
| 1184 | if (blurb) { |
| 1185 | int str_len = strlen (blurb); |
| 1186 | if (str_len > 0 && blurb[str_len - 1] != '.') |
| 1187 | dot = "."; |
| 1188 | } |
| 1189 | |
| 1190 | type_desc = describe_type (spec); |
| 1191 | default_value = describe_default (spec); |
| 1192 | type_name = get_type_name (spec->value_type, &is_pointer); |
| 1193 | fprintf (fp, "<ARG>\n" |
| 1194 | "<NAME>%s::%s</NAME>\n" |
| 1195 | "<TYPE>%s%s</TYPE>\n" |
| 1196 | "<RANGE>%s</RANGE>\n" |
| 1197 | "<FLAGS>%s</FLAGS>\n" |
| 1198 | "<NICK>%s</NICK>\n" |
| 1199 | "<BLURB>%s%s</BLURB>\n" |
| 1200 | "<DEFAULT>%s</DEFAULT>\n" |
| 1201 | "</ARG>\n\n", |
| 1202 | object_class_name, g_param_spec_get_name (spec), type_name, |
| 1203 | is_pointer ? "*" : "", type_desc, flags, nick ? nick : "(null)", |
| 1204 | blurb ? blurb : "(null)", dot, default_value); |
| 1205 | g_free (type_desc); |
| 1206 | g_free (default_value); |
| 1207 | } |
| 1208 | |
| 1209 | g_free (properties); |
| 1210 | |
| 1211 | #ifdef GTK_IS_CONTAINER_CLASS |
| 1212 | #if !GTK_CHECK_VERSION(3,96,0) |
| 1213 | if (!child_prop && GTK_IS_CONTAINER_CLASS (class)) { |
| 1214 | properties = gtk_container_class_list_child_properties (class, &n_properties); |
| 1215 | child_prop = TRUE(!(0)); |
| 1216 | continue; |
| 1217 | } |
| 1218 | #endif |
| 1219 | #endif |
| 1220 | |
| 1221 | #ifdef GTK_IS_CELL_AREA_CLASS |
| 1222 | if (!child_prop && GTK_IS_CELL_AREA_CLASS (class)) { |
| 1223 | properties = gtk_cell_area_class_list_cell_properties (class, &n_properties); |
| 1224 | child_prop = TRUE(!(0)); |
| 1225 | continue; |
| 1226 | } |
| 1227 | #endif |
| 1228 | |
| 1229 | #ifdef GTK_IS_WIDGET_CLASS |
| 1230 | #if GTK_CHECK_VERSION(2,1,0) && !GTK_CHECK_VERSION(3,89,2) |
| 1231 | if (!style_prop && GTK_IS_WIDGET_CLASS (class)) { |
| 1232 | properties = gtk_widget_class_list_style_properties (GTK_WIDGET_CLASS (class), &n_properties); |
| 1233 | style_prop = TRUE(!(0)); |
| 1234 | continue; |
| 1235 | } |
| 1236 | #endif |
| 1237 | #endif |
| 1238 | |
| 1239 | |
| 1240 | break; |
| 1241 | } |
| 1242 | } |