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