| 1 |
/* |
| 2 |
SPDX-License-Identifier: GPL-2.0-or-later AND LGPL-2.0-or-later AND MIT |
| 3 |
SPDX-FileCopyrightText: 2008-2009 Dan Winship |
| 4 |
SPDX-FileCopyrightText: 2008-2010 Colin Walters <[email protected]> |
| 5 |
SPDX-FileCopyrightText: 2008-2011 Johan Dahlin |
| 6 |
SPDX-FileCopyrightText: 2008 Owen Taylor |
| 7 |
SPDX-FileCopyrightText: 2008 Tristan Van Berkom |
| 8 |
SPDX-FileCopyrightText: 2009 Andreas Rottmann <[email protected]> |
| 9 |
SPDX-FileCopyrightText: 2010 litl, LLC |
| 10 |
SPDX-FileCopyrightText: 2010 Pavel Holejsovsky |
| 11 |
SPDX-FileCopyrightText: 2010 Red Hat, Inc. |
| 12 |
SPDX-FileCopyrightText: 2011 Jasper St. Pierre |
| 13 |
SPDX-FileCopyrightText: 2015 Christoph Reiter |
| 14 |
*/ |
| 15 |
|
| 16 |
#include <stddef.h> |
| 17 |
|
| 18 |
#include "annotation.h" |
| 19 |
|
| 20 |
char backslash_parsing_tester = '\\'; |
| 21 |
|
| 22 |
G_DEFINE_TYPE (RegressAnnotationObject, regress_annotation_object, G_TYPE_OBJECT); |
| 23 |
|
| 24 |
enum |
| 25 |
{ |
| 26 |
PROP_0, |
| 27 |
PROP_STRING_PROPERTY, |
| 28 |
PROP_FUNCTION_PROPERTY, |
| 29 |
PROP_TAB_PROPERTY |
| 30 |
}; |
| 31 |
|
| 32 |
enum |
| 33 |
{ |
| 34 |
STRING_SIGNAL, |
| 35 |
LIST_SIGNAL, |
| 36 |
DOC_EMPTY_ARG_PARSING, |
| 37 |
ATTRIBUTE_SIGNAL, |
| 38 |
LAST_SIGNAL |
| 39 |
}; |
| 40 |
|
| 41 |
static guint regress_annotation_object_signals[LAST_SIGNAL] = { 0 }; |
| 42 |
|
| 43 |
static void |
| 44 |
regress_annotation_object_set_property (GObject *object, |
| 45 |
guint prop_id, |
| 46 |
const GValue *value G_GNUC_UNUSED, |
| 47 |
GParamSpec *pspec) |
| 48 |
{ |
| 49 |
switch (prop_id) |
| 50 |
{ |
| 51 |
case PROP_STRING_PROPERTY: |
| 52 |
break; |
| 53 |
case PROP_FUNCTION_PROPERTY: |
| 54 |
break; |
| 55 |
case PROP_TAB_PROPERTY: |
| 56 |
break; |
| 57 |
default: |
| 58 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
| 59 |
break; |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
static void |
| 64 |
regress_annotation_object_get_property (GObject *object, |
| 65 |
guint prop_id, |
| 66 |
GValue *value G_GNUC_UNUSED, |
| 67 |
GParamSpec *pspec) |
| 68 |
{ |
| 69 |
switch (prop_id) |
| 70 |
{ |
| 71 |
case PROP_STRING_PROPERTY: |
| 72 |
break; |
| 73 |
case PROP_FUNCTION_PROPERTY: |
| 74 |
break; |
| 75 |
case PROP_TAB_PROPERTY: |
| 76 |
break; |
| 77 |
default: |
| 78 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
| 79 |
break; |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
static void |
| 84 |
regress_annotation_object_finalize (GObject *gobj) |
| 85 |
{ |
| 86 |
RegressAnnotationObject *self = (RegressAnnotationObject *)gobj; |
| 87 |
if (self->destroy_notify) |
| 88 |
self->destroy_notify(self->user_data); |
| 89 |
G_OBJECT_CLASS(regress_annotation_object_parent_class)->finalize(gobj); |
| 90 |
} |
| 91 |
|
| 92 |
static void |
| 93 |
regress_annotation_object_class_init (RegressAnnotationObjectClass *klass) |
| 94 |
{ |
| 95 |
GObjectClass *gobject_class; |
| 96 |
|
| 97 |
gobject_class = G_OBJECT_CLASS (klass); |
| 98 |
|
| 99 |
gobject_class->set_property = regress_annotation_object_set_property; |
| 100 |
gobject_class->get_property = regress_annotation_object_get_property; |
| 101 |
gobject_class->finalize = regress_annotation_object_finalize; |
| 102 |
|
| 103 |
/** |
| 104 |
* RegressAnnotationObject::string-signal: |
| 105 |
* @regress_annotation: the regress_annotation object |
| 106 |
* @string: (type utf8): a string |
| 107 |
* |
| 108 |
* This is a signal which has a broken signal handler, |
| 109 |
* it says it's pointer but it's actually a string. |
| 110 |
* |
| 111 |
* Since: 1.0 |
| 112 |
* Deprecated: 1.2: Use other-signal instead |
| 113 |
*/ |
| 114 |
regress_annotation_object_signals[STRING_SIGNAL] = |
| 115 |
g_signal_new ("string-signal", |
| 116 |
G_OBJECT_CLASS_TYPE (gobject_class), |
| 117 |
G_SIGNAL_RUN_LAST, |
| 118 |
0, |
| 119 |
NULL, NULL, |
| 120 |
(GSignalCMarshaller) g_cclosure_marshal_VOID__POINTER, |
| 121 |
G_TYPE_NONE, 1, G_TYPE_POINTER); |
| 122 |
|
| 123 |
/** |
| 124 |
* RegressAnnotationObject::list-signal: |
| 125 |
* @regress_annotation: the regress_annotation object |
| 126 |
* @list: (type GLib.List) (element-type utf8) (transfer container): a list of strings |
| 127 |
* |
| 128 |
* This is a signal which takes a list of strings, but it's not |
| 129 |
* known by GObject as it's only marked as G_TYPE_POINTER |
| 130 |
*/ |
| 131 |
regress_annotation_object_signals[LIST_SIGNAL] = |
| 132 |
g_signal_new ("list-signal", |
| 133 |
G_OBJECT_CLASS_TYPE (gobject_class), |
| 134 |
G_SIGNAL_RUN_LAST, |
| 135 |
0, |
| 136 |
NULL, NULL, |
| 137 |
(GSignalCMarshaller) g_cclosure_marshal_VOID__POINTER, |
| 138 |
G_TYPE_NONE, 1, G_TYPE_POINTER); |
| 139 |
|
| 140 |
/** |
| 141 |
* RegressAnnotationObject::doc-empty-arg-parsing: |
| 142 |
* @regress_annotation: the regress_annotation object |
| 143 |
* @arg1: |
| 144 |
* |
| 145 |
* This signal tests an empty document argument (@arg1) |
| 146 |
*/ |
| 147 |
regress_annotation_object_signals[DOC_EMPTY_ARG_PARSING] = |
| 148 |
g_signal_new ("doc-empty-arg-parsing", |
| 149 |
G_OBJECT_CLASS_TYPE (gobject_class), |
| 150 |
G_SIGNAL_RUN_LAST, |
| 151 |
0, |
| 152 |
NULL, NULL, |
| 153 |
(GSignalCMarshaller) g_cclosure_marshal_VOID__POINTER, |
| 154 |
G_TYPE_NONE, 1, G_TYPE_POINTER); |
| 155 |
|
| 156 |
/** |
| 157 |
* RegressAnnotationObject::attribute-signal: |
| 158 |
* @regress_annotation: the regress_annotation object |
| 159 |
* @arg1: (attributes some.annotation.foo1=val1): a value |
| 160 |
* @arg2: (attributes some.annotation.foo2=val2): another value |
| 161 |
* |
| 162 |
* This signal tests a signal with attributes. |
| 163 |
* |
| 164 |
* Returns: (attributes some.annotation.foo3=val3): the return value |
| 165 |
*/ |
| 166 |
regress_annotation_object_signals[ATTRIBUTE_SIGNAL] = |
| 167 |
g_signal_new ("attribute-signal", |
| 168 |
G_OBJECT_CLASS_TYPE (gobject_class), |
| 169 |
G_SIGNAL_RUN_LAST, |
| 170 |
0, |
| 171 |
NULL, NULL, |
| 172 |
NULL, /* marshaller */ |
| 173 |
G_TYPE_STRING, |
| 174 |
2, |
| 175 |
G_TYPE_STRING, |
| 176 |
G_TYPE_STRING); |
| 177 |
|
| 178 |
/** |
| 179 |
* RegressAnnotationObject:string-property: |
| 180 |
* |
| 181 |
* This is a property which is a string |
| 182 |
* |
| 183 |
* Since: 1.0 |
| 184 |
* Deprecated: 1.2: Use better-string-property instead |
| 185 |
*/ |
| 186 |
g_object_class_install_property (gobject_class, |
| 187 |
PROP_STRING_PROPERTY, |
| 188 |
g_param_spec_string ("string-property", |
| 189 |
"String property", |
| 190 |
"This property is a string", |
| 191 |
NULL, |
| 192 |
G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); |
| 193 |
/** |
| 194 |
* RegressAnnotationObject:function-property: (type RegressAnnotationCallback) |
| 195 |
*/ |
| 196 |
g_object_class_install_property (gobject_class, |
| 197 |
PROP_FUNCTION_PROPERTY, |
| 198 |
g_param_spec_pointer ("function-property", |
| 199 |
"Function property", |
| 200 |
"This property is a function pointer", |
| 201 |
G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); |
| 202 |
|
| 203 |
/* clang-format off */ |
| 204 |
|
| 205 |
/** |
| 206 |
* RegressAnnotationObject:tab-property: |
| 207 |
* |
| 208 |
* This is a property annotation intentionally indented with a mix |
| 209 |
* of tabs and strings to test the tab handling capabilities of the scanner. |
| 210 |
* |
| 211 |
* Since: 1.2 |
| 212 |
*/ |
| 213 |
g_object_class_install_property (gobject_class, |
| 214 |
PROP_TAB_PROPERTY, |
| 215 |
g_param_spec_string ("tab-property", |
| 216 |
"Tab property", |
| 217 |
"This property is a thing", |
| 218 |
NULL, |
| 219 |
G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); |
| 220 |
|
| 221 |
/* clang-format on */ |
| 222 |
} |
| 223 |
|
| 224 |
static void |
| 225 |
regress_annotation_object_init (RegressAnnotationObject *object G_GNUC_UNUSED) |
| 226 |
{ |
| 227 |
} |
| 228 |
|
| 229 |
/** |
| 230 |
* regress_annotation_object_method: |
| 231 |
* @object: a #GObject |
| 232 |
* |
| 233 |
* Return value: an int |
| 234 |
**/ |
| 235 |
gint |
| 236 |
regress_annotation_object_method (RegressAnnotationObject *object G_GNUC_UNUSED) |
| 237 |
{ |
| 238 |
return 1; |
| 239 |
} |
| 240 |
|
| 241 |
/** |
| 242 |
* regress_annotation_object_out: |
| 243 |
* @object: a #GObject |
| 244 |
* @outarg: (out): This is an argument test |
| 245 |
* |
| 246 |
* This is a test for out arguments |
| 247 |
* |
| 248 |
* Return value: an int |
| 249 |
*/ |
| 250 |
gint |
| 251 |
regress_annotation_object_out (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 252 |
int *outarg) |
| 253 |
{ |
| 254 |
*outarg = 2; |
| 255 |
return 1; |
| 256 |
} |
| 257 |
|
| 258 |
/** |
| 259 |
* regress_annotation_object_in: |
| 260 |
* @object: a #GObject |
| 261 |
* @inarg: (in) (transfer none): This is an argument test |
| 262 |
* |
| 263 |
* This is a test for in arguments |
| 264 |
* |
| 265 |
* Return value: an int |
| 266 |
*/ |
| 267 |
gint |
| 268 |
regress_annotation_object_in (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 269 |
int *inarg) |
| 270 |
{ |
| 271 |
return *inarg; |
| 272 |
} |
| 273 |
|
| 274 |
/** |
| 275 |
* regress_annotation_object_inout: |
| 276 |
* @object: a #GObject |
| 277 |
* @inoutarg: (inout): This is an argument test |
| 278 |
* |
| 279 |
* This is a test for out arguments |
| 280 |
* |
| 281 |
* Return value: an int |
| 282 |
*/ |
| 283 |
gint |
| 284 |
regress_annotation_object_inout (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 285 |
int *inoutarg) |
| 286 |
{ |
| 287 |
return *inoutarg += 1; |
| 288 |
} |
| 289 |
|
| 290 |
/** |
| 291 |
* regress_annotation_object_inout2: |
| 292 |
* @object: a #GObject |
| 293 |
* @inoutarg: (inout): This is an argument test |
| 294 |
* |
| 295 |
* This is a second test for out arguments |
| 296 |
* |
| 297 |
* Return value: an int |
| 298 |
*/ |
| 299 |
gint |
| 300 |
regress_annotation_object_inout2 (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 301 |
int *inoutarg) |
| 302 |
{ |
| 303 |
return *inoutarg += 1; |
| 304 |
} |
| 305 |
|
| 306 |
/** |
| 307 |
* regress_annotation_object_inout3: |
| 308 |
* @object: a #GObject |
| 309 |
* @inoutarg: (inout) (allow-none): This is an argument test |
| 310 |
* |
| 311 |
* This is a 3th test for out arguments |
| 312 |
* |
| 313 |
* Return value: an int |
| 314 |
*/ |
| 315 |
gint |
| 316 |
regress_annotation_object_inout3 (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 317 |
int *inoutarg) |
| 318 |
{ |
| 319 |
if (inoutarg) |
| 320 |
return *inoutarg + 1; |
| 321 |
return 1; |
| 322 |
} |
| 323 |
|
| 324 |
/** |
| 325 |
* regress_annotation_object_calleeowns: |
| 326 |
* @object: a #GObject |
| 327 |
* @toown: (out): a #GObject |
| 328 |
* |
| 329 |
* This is a test for out arguments; GObject defaults to transfer |
| 330 |
* |
| 331 |
* Return value: an int |
| 332 |
*/ |
| 333 |
gint |
| 334 |
regress_annotation_object_calleeowns (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 335 |
GObject **toown G_GNUC_UNUSED) |
| 336 |
{ |
| 337 |
return 1; |
| 338 |
} |
| 339 |
|
| 340 |
/** |
| 341 |
* regress_annotation_object_calleesowns: |
| 342 |
* @object: a #GObject |
| 343 |
* @toown1: (out) (transfer full): a #GObject |
| 344 |
* @toown2: (out) (transfer none): a #GObject |
| 345 |
* |
| 346 |
* This is a test for out arguments, one transferred, other not |
| 347 |
* |
| 348 |
* Return value: an int |
| 349 |
*/ |
| 350 |
gint |
| 351 |
regress_annotation_object_calleesowns (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 352 |
GObject **toown1 G_GNUC_UNUSED, |
| 353 |
GObject **toown2 G_GNUC_UNUSED) |
| 354 |
{ |
| 355 |
return 1; |
| 356 |
} |
| 357 |
|
| 358 |
/** |
| 359 |
* regress_annotation_object_get_strings: |
| 360 |
* @object: a #GObject |
| 361 |
* |
| 362 |
* This is a test for returning a list of strings, where |
| 363 |
* each string needs to be freed. |
| 364 |
* |
| 365 |
* Return value: (element-type utf8) (transfer full): list of strings |
| 366 |
*/ |
| 367 |
GList * |
| 368 |
regress_annotation_object_get_strings (RegressAnnotationObject *object G_GNUC_UNUSED) |
| 369 |
{ |
| 370 |
GList *list = NULL; |
| 371 |
list = g_list_prepend (list, g_strdup ("regress_annotation")); |
| 372 |
list = g_list_prepend (list, g_strdup ("bar")); |
| 373 |
return list; |
| 374 |
} |
| 375 |
|
| 376 |
/** |
| 377 |
* regress_annotation_object_get_hash: |
| 378 |
* @object: a #GObject |
| 379 |
* |
| 380 |
* This is a test for returning a hash table mapping strings to |
| 381 |
* objects. |
| 382 |
* |
| 383 |
* Return value: (element-type utf8 GObject) (transfer full): hash table |
| 384 |
*/ |
| 385 |
GHashTable * |
| 386 |
regress_annotation_object_get_hash (RegressAnnotationObject *object) |
| 387 |
{ |
| 388 |
GHashTable *hash = g_hash_table_new_full (g_str_hash, g_str_equal, |
| 389 |
g_free, g_object_unref); |
| 390 |
g_hash_table_insert (hash, g_strdup ("one"), g_object_ref (object)); |
| 391 |
g_hash_table_insert (hash, g_strdup ("two"), g_object_ref (object)); |
| 392 |
return hash; |
| 393 |
} |
| 394 |
|
| 395 |
/** |
| 396 |
* regress_annotation_object_with_voidp: |
| 397 |
* @data: Opaque pointer handle |
| 398 |
*/ |
| 399 |
void |
| 400 |
regress_annotation_object_with_voidp (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 401 |
void *data G_GNUC_UNUSED) |
| 402 |
{ |
| 403 |
} |
| 404 |
|
| 405 |
/** |
| 406 |
* regress_annotation_object_get_objects: |
| 407 |
* @object: a #GObject |
| 408 |
* |
| 409 |
* This is a test for returning a list of objects. |
| 410 |
* The list itself should be freed, but not the internal objects, |
| 411 |
* intentionally similar example to gtk_container_get_children |
| 412 |
* |
| 413 |
* Return value: (element-type RegressAnnotationObject) (transfer container): list of objects |
| 414 |
*/ |
| 415 |
GSList * |
| 416 |
regress_annotation_object_get_objects (RegressAnnotationObject *object) |
| 417 |
{ |
| 418 |
GSList *list = NULL; |
| 419 |
list = g_slist_prepend (list, object); |
| 420 |
return list; |
| 421 |
} |
| 422 |
|
| 423 |
/** |
| 424 |
* regress_annotation_object_create_object: |
| 425 |
* @object: a #GObject |
| 426 |
* |
| 427 |
* Test returning a caller-owned object |
| 428 |
* |
| 429 |
* Return value: (transfer full): The object |
| 430 |
**/ |
| 431 |
GObject * |
| 432 |
regress_annotation_object_create_object (RegressAnnotationObject *object) |
| 433 |
{ |
| 434 |
return G_OBJECT (g_object_ref (object)); |
| 435 |
} |
| 436 |
|
| 437 |
/** |
| 438 |
* regress_annotation_object_use_buffer: |
| 439 |
* @object: a #GObject |
| 440 |
* |
| 441 |
**/ |
| 442 |
void |
| 443 |
regress_annotation_object_use_buffer (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 444 |
guchar *bytes G_GNUC_UNUSED) |
| 445 |
{ |
| 446 |
} |
| 447 |
|
| 448 |
/** |
| 449 |
* regress_annotation_object_compute_sum: |
| 450 |
* @object: a #GObject |
| 451 |
* @nums: (array): Sequence of numbers |
| 452 |
* |
| 453 |
* Test taking a zero-terminated array |
| 454 |
**/ |
| 455 |
void |
| 456 |
regress_annotation_object_compute_sum (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 457 |
int *nums G_GNUC_UNUSED) |
| 458 |
{ |
| 459 |
} |
| 460 |
|
| 461 |
/** |
| 462 |
* regress_annotation_object_compute_sum_n: |
| 463 |
* @object: a #GObject |
| 464 |
* @nums: (array length=n_nums zero-terminated=0): Sequence of |
| 465 |
* numbers that are zero-terminated |
| 466 |
* @n_nums: Length of number array |
| 467 |
* |
| 468 |
* Test taking an array with length parameter |
| 469 |
**/ |
| 470 |
void |
| 471 |
regress_annotation_object_compute_sum_n (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 472 |
int *nums G_GNUC_UNUSED, |
| 473 |
int n_nums G_GNUC_UNUSED) |
| 474 |
{ |
| 475 |
} |
| 476 |
|
| 477 |
/** |
| 478 |
* regress_annotation_object_compute_sum_nz: |
| 479 |
* @object: a #RegressAnnotationObject |
| 480 |
* @nums: (array length=n_nums zero-terminated): Sequence of numbers that |
| 481 |
* are zero-terminated |
| 482 |
* @n_nums: Length of number array |
| 483 |
* |
| 484 |
* Test taking a zero-terminated array with length parameter |
| 485 |
**/ |
| 486 |
void |
| 487 |
regress_annotation_object_compute_sum_nz (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 488 |
int *nums G_GNUC_UNUSED, |
| 489 |
int n_nums G_GNUC_UNUSED) |
| 490 |
{ |
| 491 |
} |
| 492 |
|
| 493 |
/** |
| 494 |
* regress_annotation_object_parse_args: |
| 495 |
* @object: a #RegressAnnotationObject |
| 496 |
* @argc: (inout): Length of the argument vector |
| 497 |
* @argv: (inout) (array length=argc zero-terminated=1): Argument vector |
| 498 |
* |
| 499 |
* Test taking a zero-terminated array with length parameter |
| 500 |
**/ |
| 501 |
void |
| 502 |
regress_annotation_object_parse_args (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 503 |
int *argc G_GNUC_UNUSED, |
| 504 |
char ***argv G_GNUC_UNUSED) |
| 505 |
{ |
| 506 |
} |
| 507 |
|
| 508 |
/** |
| 509 |
* regress_annotation_object_string_out: |
| 510 |
* @object: a #RegressAnnotationObject |
| 511 |
* @str_out: (out) (transfer full): string return value |
| 512 |
* |
| 513 |
* Test returning a string as an out parameter |
| 514 |
* |
| 515 |
* Returns: some boolean |
| 516 |
**/ |
| 517 |
gboolean |
| 518 |
regress_annotation_object_string_out (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 519 |
char **str_out G_GNUC_UNUSED) |
| 520 |
{ |
| 521 |
return FALSE; |
| 522 |
} |
| 523 |
|
| 524 |
/** |
| 525 |
* regress_annotation_object_foreach: |
| 526 |
* @object: a #RegressAnnotationObject |
| 527 |
* @func: (scope call): Callback to invoke |
| 528 |
* @user_data: Callback user data |
| 529 |
* |
| 530 |
* Test taking a call-scoped callback |
| 531 |
**/ |
| 532 |
void |
| 533 |
regress_annotation_object_foreach (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 534 |
RegressAnnotationForeachFunc func G_GNUC_UNUSED, |
| 535 |
gpointer user_data G_GNUC_UNUSED) |
| 536 |
{ |
| 537 |
} |
| 538 |
|
| 539 |
/** |
| 540 |
* regress_annotation_object_set_data: |
| 541 |
* @object: a #RegressAnnotationObject |
| 542 |
* @data: (array length=length): The data |
| 543 |
* @length: Length of the data |
| 544 |
* |
| 545 |
* Test taking a guchar * with a length. |
| 546 |
**/ |
| 547 |
void |
| 548 |
regress_annotation_object_set_data (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 549 |
const guchar *data G_GNUC_UNUSED, |
| 550 |
gsize length G_GNUC_UNUSED) |
| 551 |
{ |
| 552 |
} |
| 553 |
|
| 554 |
/** |
| 555 |
* regress_annotation_object_set_data2: |
| 556 |
* @object: a #RegressAnnotationObject |
| 557 |
* @data: (array length=length) (element-type gint8): The data |
| 558 |
* @length: Length of the data |
| 559 |
* |
| 560 |
* Test taking a gchar * with a length. |
| 561 |
**/ |
| 562 |
void |
| 563 |
regress_annotation_object_set_data2 (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 564 |
const gchar *data G_GNUC_UNUSED, |
| 565 |
gsize length G_GNUC_UNUSED) |
| 566 |
{ |
| 567 |
} |
| 568 |
|
| 569 |
/** |
| 570 |
* regress_annotation_object_set_data3: |
| 571 |
* @object: a #RegressAnnotationObject |
| 572 |
* @data: (array length=length) (element-type guint8): The data |
| 573 |
* @length: Length of the data |
| 574 |
* |
| 575 |
* Test taking a gchar * with a length, overriding the array element |
| 576 |
* type. |
| 577 |
**/ |
| 578 |
void |
| 579 |
regress_annotation_object_set_data3 (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 580 |
gpointer data G_GNUC_UNUSED, |
| 581 |
gsize length G_GNUC_UNUSED) |
| 582 |
{ |
| 583 |
} |
| 584 |
|
| 585 |
/** |
| 586 |
* regress_annotation_object_allow_none: |
| 587 |
* @object: a #GObject |
| 588 |
* @somearg: (allow-none): |
| 589 |
* |
| 590 |
* Returns: (transfer none): %NULL always |
| 591 |
**/ |
| 592 |
GObject * |
| 593 |
regress_annotation_object_allow_none (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 594 |
const gchar *somearg G_GNUC_UNUSED) |
| 595 |
{ |
| 596 |
return NULL; |
| 597 |
} |
| 598 |
|
| 599 |
/** |
| 600 |
* regress_annotation_object_notrans: |
| 601 |
* @object: a #GObject |
| 602 |
* |
| 603 |
* Returns: (transfer none): An object, not referenced |
| 604 |
**/ |
| 605 |
|
| 606 |
GObject * |
| 607 |
regress_annotation_object_notrans (RegressAnnotationObject *object G_GNUC_UNUSED) |
| 608 |
{ |
| 609 |
return NULL; |
| 610 |
} |
| 611 |
|
| 612 |
/** |
| 613 |
* regress_annotation_object_do_not_use: |
| 614 |
* @object: a #GObject |
| 615 |
* |
| 616 |
* Returns: (transfer none): %NULL always |
| 617 |
* Deprecated: 0.12: Use regress_annotation_object_create_object() instead. |
| 618 |
**/ |
| 619 |
GObject * |
| 620 |
regress_annotation_object_do_not_use (RegressAnnotationObject *object G_GNUC_UNUSED) |
| 621 |
{ |
| 622 |
return NULL; |
| 623 |
} |
| 624 |
|
| 625 |
/** |
| 626 |
* regress_annotation_object_watch: (skip) |
| 627 |
* @object: A #RegressAnnotationObject |
| 628 |
* @func: The callback |
| 629 |
* @user_data: The callback data |
| 630 |
* |
| 631 |
* This is here just for the sake of being overriden by its |
| 632 |
* regress_annotation_object_watch_full(). |
| 633 |
*/ |
| 634 |
void |
| 635 |
regress_annotation_object_watch (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 636 |
RegressAnnotationForeachFunc func G_GNUC_UNUSED, |
| 637 |
gpointer user_data G_GNUC_UNUSED) |
| 638 |
{ |
| 639 |
} |
| 640 |
|
| 641 |
/** |
| 642 |
* regress_annotation_object_watch_full: (rename-to regress_annotation_object_watch) |
| 643 |
* @object: A #RegressAnnotationObject |
| 644 |
* @func: The callback |
| 645 |
* @user_data: The callback data |
| 646 |
* @destroy: Destroy notification |
| 647 |
* |
| 648 |
* Test overriding via the "Rename To" annotation. |
| 649 |
*/ |
| 650 |
void |
| 651 |
regress_annotation_object_watch_full (RegressAnnotationObject *object, |
| 652 |
RegressAnnotationForeachFunc func G_GNUC_UNUSED, |
| 653 |
gpointer user_data, |
| 654 |
GDestroyNotify destroy) |
| 655 |
{ |
| 656 |
object->user_data = user_data; |
| 657 |
object->destroy_notify = destroy; |
| 658 |
} |
| 659 |
|
| 660 |
/** |
| 661 |
* regress_annotation_object_hidden_self: |
| 662 |
* @object: (type RegressAnnotationObject): A #RegressAnnotationObject |
| 663 |
**/ |
| 664 |
void |
| 665 |
regress_annotation_object_hidden_self (gpointer object G_GNUC_UNUSED) |
| 666 |
{ |
| 667 |
} |
| 668 |
|
| 669 |
/** |
| 670 |
* regress_annotation_init: |
| 671 |
* @argc: (inout): The number of args. |
| 672 |
* @argv: (inout) (array length=argc): The arguments. |
| 673 |
**/ |
| 674 |
void |
| 675 |
regress_annotation_init (int *argc G_GNUC_UNUSED, |
| 676 |
char ***argv G_GNUC_UNUSED) |
| 677 |
{ |
| 678 |
} |
| 679 |
|
| 680 |
/** |
| 681 |
* regress_annotation_return_array: |
| 682 |
* @length: (out): Number of return values |
| 683 |
* |
| 684 |
* Return value: (transfer full) (array length=length): The return value |
| 685 |
**/ |
| 686 |
char ** |
| 687 |
regress_annotation_return_array (int *length G_GNUC_UNUSED) |
| 688 |
{ |
| 689 |
return NULL; |
| 690 |
} |
| 691 |
|
| 692 |
/** |
| 693 |
* regress_annotation_string_zero_terminated: |
| 694 |
* |
| 695 |
* Return value: (transfer full) (array zero-terminated=1): The return value |
| 696 |
**/ |
| 697 |
char ** |
| 698 |
regress_annotation_string_zero_terminated (void) |
| 699 |
{ |
| 700 |
return NULL; |
| 701 |
} |
| 702 |
|
| 703 |
/** |
| 704 |
* regress_annotation_string_zero_terminated_out: |
| 705 |
* @out: (array zero-terminated=1) (inout): |
| 706 |
**/ |
| 707 |
void |
| 708 |
regress_annotation_string_zero_terminated_out (char ***out G_GNUC_UNUSED) |
| 709 |
{ |
| 710 |
} |
| 711 |
|
| 712 |
/** |
| 713 |
* regress_annotation_versioned: |
| 714 |
* |
| 715 |
* Since: 0.6 |
| 716 |
**/ |
| 717 |
void |
| 718 |
regress_annotation_versioned (void) |
| 719 |
{ |
| 720 |
} |
| 721 |
|
| 722 |
/** |
| 723 |
* regress_annotation_string_array_length: |
| 724 |
* @n_properties: |
| 725 |
* @properties: (array length=n_properties) (element-type utf8): |
| 726 |
*/ |
| 727 |
void |
| 728 |
regress_annotation_string_array_length (guint n_properties G_GNUC_UNUSED, |
| 729 |
const gchar *const properties[] G_GNUC_UNUSED) |
| 730 |
{ |
| 731 |
} |
| 732 |
|
| 733 |
/** |
| 734 |
* regress_annotation_object_extra_annos: (attributes org.foobar=testvalue) |
| 735 |
*/ |
| 736 |
void |
| 737 |
regress_annotation_object_extra_annos (RegressAnnotationObject *object G_GNUC_UNUSED) |
| 738 |
{ |
| 739 |
} |
| 740 |
|
| 741 |
static void *regress_annotation_user_data; |
| 742 |
static GDestroyNotify regress_annotation_destroy_notify; |
| 743 |
|
| 744 |
/** |
| 745 |
* regress_annotation_custom_destroy: |
| 746 |
* @callback: (destroy destroy) (closure data): Destroy notification |
| 747 |
* |
| 748 |
* Test messing up the heuristic of closure/destroy-notification |
| 749 |
* detection, and fixing it via annotations. |
| 750 |
*/ |
| 751 |
void |
| 752 |
regress_annotation_custom_destroy (RegressAnnotationCallback callback G_GNUC_UNUSED, |
| 753 |
RegressAnnotationNotifyFunc destroy, |
| 754 |
gpointer data) |
| 755 |
{ |
| 756 |
regress_annotation_user_data = data; |
| 757 |
regress_annotation_destroy_notify = destroy; |
| 758 |
} |
| 759 |
|
| 760 |
/** |
| 761 |
* regress_annotation_custom_destroy_cleanup: |
| 762 |
* |
| 763 |
* Use in tests for bindings with managed memory, to clean up the callback |
| 764 |
* passed to regress_annotation_custom_destroy(). |
| 765 |
*/ |
| 766 |
void |
| 767 |
regress_annotation_custom_destroy_cleanup (void) |
| 768 |
{ |
| 769 |
if (regress_annotation_destroy_notify) |
| 770 |
regress_annotation_destroy_notify(regress_annotation_user_data); |
| 771 |
} |
| 772 |
|
| 773 |
/** |
| 774 |
* regress_annotation_get_source_file: |
| 775 |
* |
| 776 |
* Return value: (type filename) (transfer full): Source file |
| 777 |
*/ |
| 778 |
char * |
| 779 |
regress_annotation_get_source_file (void) |
| 780 |
{ |
| 781 |
return NULL; |
| 782 |
} |
| 783 |
|
| 784 |
/** |
| 785 |
* regress_annotation_set_source_file: |
| 786 |
* @fname: (type filename): Source file |
| 787 |
* |
| 788 |
*/ |
| 789 |
void |
| 790 |
regress_annotation_set_source_file (const char *fname G_GNUC_UNUSED) |
| 791 |
{ |
| 792 |
} |
| 793 |
|
| 794 |
/** |
| 795 |
* regress_annotation_ptr_array: |
| 796 |
* @array: (element-type GObject.Value): the array |
| 797 |
*/ |
| 798 |
void |
| 799 |
regress_annotation_ptr_array (GPtrArray *array G_GNUC_UNUSED) |
| 800 |
{ |
| 801 |
} |
| 802 |
|
| 803 |
/** |
| 804 |
* regress_annotation_attribute_func: |
| 805 |
* @object: A #RegressAnnotationObject. |
| 806 |
* @data: (attributes some.annotation=value another.annotation=blahvalue): Some data. |
| 807 |
* |
| 808 |
* Returns: (attributes some.other.annotation=value2 yet.another.annotation=another_value): The return value. |
| 809 |
*/ |
| 810 |
gint |
| 811 |
regress_annotation_attribute_func (RegressAnnotationObject *object G_GNUC_UNUSED, |
| 812 |
const gchar *data G_GNUC_UNUSED) |
| 813 |
{ |
| 814 |
return 42; |
| 815 |
} |
| 816 |
|
| 817 |
/** |
| 818 |
* regress_annotation_invalid_regress_annotation: |
| 819 |
* @foo: some text (e.g. example) or else |
| 820 |
*/ |
| 821 |
void |
| 822 |
regress_annotation_invalid_regress_annotation (int foo G_GNUC_UNUSED) |
| 823 |
{ |
| 824 |
} |
| 825 |
|
| 826 |
char backslash_parsing_tester_2 = '\\'; |
| 827 |
|
| 828 |
/** |
| 829 |
* regress_annotation_test_parsing_bug630862: |
| 830 |
* |
| 831 |
* See https://bugzilla.gnome.org/show_bug.cgi?id=630862 |
| 832 |
* |
| 833 |
* Returns: (transfer none): An object, note the colon:in here |
| 834 |
*/ |
| 835 |
GObject * |
| 836 |
regress_annotation_test_parsing_bug630862 (void) |
| 837 |
{ |
| 838 |
return NULL; |
| 839 |
} |
| 840 |
|
| 841 |
/* clang-format off */ |
| 842 |
/** |
| 843 |
* regress_annotation_space_after_comment_bug631690: |
| 844 |
* |
| 845 |
* Explicitly test having a space after the ** here. |
| 846 |
*/ |
| 847 |
void |
| 848 |
regress_annotation_space_after_comment_bug631690 (void) |
| 849 |
{ |
| 850 |
} |
| 851 |
/* clang-format on */ |
| 852 |
|
| 853 |
/** |
| 854 |
* regress_annotation_return_filename: |
| 855 |
* |
| 856 |
* Returns: (type filename): An annotated filename |
| 857 |
*/ |
| 858 |
gchar * |
| 859 |
regress_annotation_return_filename (void) |
| 860 |
{ |
| 861 |
return g_strdup ("a utf-8 filename"); |
| 862 |
} |
| 863 |
|
| 864 |
/** |
| 865 |
* regress_annotation_transfer_floating: |
| 866 |
* @object: (in) (transfer floating): an object |
| 867 |
* |
| 868 |
* Returns: (transfer floating): A floating object |
| 869 |
*/ |
| 870 |
GObject * |
| 871 |
regress_annotation_transfer_floating (GObject *object G_GNUC_UNUSED) |
| 872 |
{ |
| 873 |
return NULL; |
| 874 |
} |