gobject-introspection 3.3.6 → 3.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00b3cb89e6856b82bf64ac65e776f8a6881a0e2d6e8b14b2eff708b75f72ee22
4
- data.tar.gz: ab04989918760421ce712721a251b368dcceb1b206ad932df789d646c58694d6
3
+ metadata.gz: 4ef3e45ea2b6d4e28b1843c528a1ba4aee03b1df923327f2942fd6d1b377eee5
4
+ data.tar.gz: 1032fca067c089c9706d919e74db6c5c5385ec8a14278fbe3256d72532df7784
5
5
  SHA512:
6
- metadata.gz: bfe9bf4ac5f2c3bc7878d32dc6fa9c4e0c2dc3f4c24257d5ceaa61d53ba5d51338ba6975e95dbbbd53307752861484af2f6a345e641c1d514a4705b0370e04ab
7
- data.tar.gz: '0466383df2a3d193cd280a7b728ada56841dcf5fe502bc5766203aeab628054dc30dfb9f1d2aab6945debd9073a740184eb72587381139bf7e1e1ccaeac57ead'
6
+ metadata.gz: '09846692d8fc65661b11d2972720eed395e5500544bf8bd2af186da930d92751e76db258db7b78bbd388191c6ce012d218bf7b3a356ff8688aeb1574b939169d'
7
+ data.tar.gz: 7c4cd440d50656c99d8472087a5599eaea262289daae2e00ca8f2c383c2ab934eb5420487a1090a100a9aaefcdc2ce4e74f4c6bd2a9904c84df8838f0a57b367
@@ -59,6 +59,7 @@ unless required_pkg_config_package(package_id,
59
59
  exit(false)
60
60
  end
61
61
 
62
+ # TODO: Remove this when we dropped support for GObject Introspection < 1.60
62
63
  make_version_header("GI", package_id, ".")
63
64
 
64
65
  gi_headers = ["girepository.h"]
@@ -3223,6 +3223,280 @@ rb_gi_value_argument_from_ruby_gslist(GIArgument *argument,
3223
3223
  }
3224
3224
  }
3225
3225
 
3226
+ typedef struct {
3227
+ VALUE rb_value;
3228
+ GType gtype;
3229
+ const gchar *context;
3230
+ } RubyToCData;
3231
+
3232
+ typedef gpointer (*RubyToCFunc)(RubyToCData *data);
3233
+
3234
+ static gpointer
3235
+ ruby_to_c_utf8(RubyToCData *data)
3236
+ {
3237
+ return g_strdup(RVAL2CSTR(data->rb_value));
3238
+ }
3239
+
3240
+ static gpointer
3241
+ ruby_to_c_interface_enum(RubyToCData *data)
3242
+ {
3243
+ gint32 value;
3244
+ if (data->gtype == G_TYPE_NONE) {
3245
+ value = NUM2INT(data->rb_value);
3246
+ } else {
3247
+ value = RVAL2GENUM(data->rb_value, data->gtype);
3248
+ }
3249
+ return GINT_TO_POINTER(value);
3250
+ }
3251
+
3252
+ typedef struct {
3253
+ GIArgument *argument;
3254
+ GITypeInfo *type_info;
3255
+ VALUE rb_argument;
3256
+ VALUE self;
3257
+ } ArgumentFromRubyData;
3258
+
3259
+ typedef struct {
3260
+ GHashTable *hash_table;
3261
+ RubyToCFunc key_ruby_to_c_func;
3262
+ RubyToCData *key_ruby_to_c_data;
3263
+ RubyToCFunc value_ruby_to_c_func;
3264
+ RubyToCData *value_ruby_to_c_data;
3265
+ } ArgumentFromRubyGHashData;
3266
+
3267
+ static int
3268
+ rb_gi_value_argument_from_ruby_ghash_convert(VALUE rb_key,
3269
+ VALUE rb_value,
3270
+ VALUE user_data)
3271
+ {
3272
+ ArgumentFromRubyGHashData *data = (ArgumentFromRubyGHashData *)user_data;
3273
+ gpointer key;
3274
+ gpointer value;
3275
+ data->key_ruby_to_c_data->rb_value = rb_key;
3276
+ key = data->key_ruby_to_c_func(data->key_ruby_to_c_data);
3277
+ data->value_ruby_to_c_data->rb_value = rb_value;
3278
+ value = data->key_ruby_to_c_func(data->value_ruby_to_c_data);
3279
+ g_hash_table_insert(data->hash_table, key, value);
3280
+ return ST_CONTINUE;
3281
+ }
3282
+
3283
+ static VALUE
3284
+ rb_gi_value_argument_from_ruby_ghash_body(VALUE value_data)
3285
+ {
3286
+ ArgumentFromRubyData *data = (ArgumentFromRubyData *)value_data;
3287
+ GIArgument *argument = data->argument;
3288
+ GITypeInfo *type_info = data->type_info;
3289
+ VALUE rb_argument = data->rb_argument;
3290
+ GHashFunc hash_func = NULL;
3291
+ GEqualFunc equal_func = NULL;
3292
+ GDestroyNotify key_destroy_func = NULL;
3293
+ GDestroyNotify value_destroy_func = NULL;
3294
+ GITypeInfo *key_type_info;
3295
+ GITypeTag key_type_tag;
3296
+ GIInfoType key_interface_type = GI_INFO_TYPE_INVALID;
3297
+ RubyToCFunc key_ruby_to_c_func = NULL;
3298
+ RubyToCData key_ruby_to_c_data;
3299
+ GITypeInfo *value_type_info;
3300
+ GITypeTag value_type_tag;
3301
+ GIInfoType value_interface_type = GI_INFO_TYPE_INVALID;
3302
+ RubyToCFunc value_ruby_to_c_func = NULL;
3303
+ RubyToCData value_ruby_to_c_data;
3304
+ ArgumentFromRubyGHashData convert_data;
3305
+
3306
+ key_type_info = g_type_info_get_param_type(type_info, 0);
3307
+ key_type_tag = g_type_info_get_tag(key_type_info);
3308
+ key_ruby_to_c_data.gtype = G_TYPE_NONE;
3309
+ if (key_type_tag == GI_TYPE_TAG_INTERFACE) {
3310
+ GIBaseInfo *interface_info;
3311
+ interface_info = g_type_info_get_interface(key_type_info);
3312
+ key_ruby_to_c_data.gtype =
3313
+ g_registered_type_info_get_g_type(interface_info);
3314
+ key_interface_type = g_base_info_get_type(interface_info);
3315
+ g_base_info_unref(interface_info);
3316
+ }
3317
+ g_base_info_unref(key_type_info);
3318
+
3319
+ value_type_info = g_type_info_get_param_type(type_info, 1);
3320
+ value_type_tag = g_type_info_get_tag(value_type_info);
3321
+ value_ruby_to_c_data.gtype = G_TYPE_NONE;
3322
+ if (value_type_tag == GI_TYPE_TAG_INTERFACE) {
3323
+ GIBaseInfo *interface_info;
3324
+ interface_info = g_type_info_get_interface(value_type_info);
3325
+ value_ruby_to_c_data.gtype =
3326
+ g_registered_type_info_get_g_type(interface_info);
3327
+ value_interface_type = g_base_info_get_type(interface_info);
3328
+ g_base_info_unref(interface_info);
3329
+ }
3330
+ g_base_info_unref(value_type_info);
3331
+
3332
+ switch (key_type_tag) {
3333
+ case GI_TYPE_TAG_VOID:
3334
+ case GI_TYPE_TAG_BOOLEAN:
3335
+ case GI_TYPE_TAG_INT8:
3336
+ case GI_TYPE_TAG_UINT8:
3337
+ case GI_TYPE_TAG_INT16:
3338
+ case GI_TYPE_TAG_UINT16:
3339
+ case GI_TYPE_TAG_INT32:
3340
+ case GI_TYPE_TAG_UINT32:
3341
+ case GI_TYPE_TAG_INT64:
3342
+ case GI_TYPE_TAG_UINT64:
3343
+ case GI_TYPE_TAG_FLOAT:
3344
+ case GI_TYPE_TAG_DOUBLE:
3345
+ case GI_TYPE_TAG_GTYPE:
3346
+ rb_raise(rb_eNotImpError,
3347
+ "TODO: Ruby -> GIArgument(GHash)[key][%s]",
3348
+ g_type_tag_to_string(key_type_tag));
3349
+ break;
3350
+ case GI_TYPE_TAG_UTF8:
3351
+ hash_func = g_str_hash;
3352
+ equal_func = g_str_equal;
3353
+ key_destroy_func = g_free;
3354
+ key_ruby_to_c_func = ruby_to_c_utf8;
3355
+ key_ruby_to_c_data.context = "Ruby -> GIArgument(GHash)[key][utf8]";
3356
+ break;
3357
+ case GI_TYPE_TAG_FILENAME:
3358
+ case GI_TYPE_TAG_ARRAY:
3359
+ case GI_TYPE_TAG_INTERFACE:
3360
+ case GI_TYPE_TAG_GLIST:
3361
+ case GI_TYPE_TAG_GSLIST:
3362
+ case GI_TYPE_TAG_GHASH:
3363
+ case GI_TYPE_TAG_ERROR:
3364
+ case GI_TYPE_TAG_UNICHAR:
3365
+ rb_raise(rb_eNotImpError,
3366
+ "TODO: Ruby -> GIArgument(GHash)[key][%s]",
3367
+ g_type_tag_to_string(key_type_tag));
3368
+ break;
3369
+ default:
3370
+ g_assert_not_reached();
3371
+ break;
3372
+ }
3373
+
3374
+ switch (value_type_tag) {
3375
+ case GI_TYPE_TAG_VOID:
3376
+ case GI_TYPE_TAG_BOOLEAN:
3377
+ case GI_TYPE_TAG_INT8:
3378
+ case GI_TYPE_TAG_UINT8:
3379
+ case GI_TYPE_TAG_INT16:
3380
+ case GI_TYPE_TAG_UINT16:
3381
+ case GI_TYPE_TAG_INT32:
3382
+ case GI_TYPE_TAG_UINT32:
3383
+ case GI_TYPE_TAG_INT64:
3384
+ case GI_TYPE_TAG_UINT64:
3385
+ case GI_TYPE_TAG_FLOAT:
3386
+ case GI_TYPE_TAG_DOUBLE:
3387
+ case GI_TYPE_TAG_GTYPE:
3388
+ case GI_TYPE_TAG_UTF8:
3389
+ case GI_TYPE_TAG_FILENAME:
3390
+ case GI_TYPE_TAG_ARRAY:
3391
+ rb_raise(rb_eNotImpError,
3392
+ "TODO: Ruby -> GIArgument(GHash)[value][%s]",
3393
+ g_type_tag_to_string(value_type_tag));
3394
+ break;
3395
+ case GI_TYPE_TAG_INTERFACE:
3396
+ switch (value_interface_type) {
3397
+ case GI_INFO_TYPE_INVALID:
3398
+ case GI_INFO_TYPE_FUNCTION:
3399
+ case GI_INFO_TYPE_CALLBACK:
3400
+ case GI_INFO_TYPE_STRUCT:
3401
+ case GI_INFO_TYPE_BOXED:
3402
+ rb_raise(rb_eNotImpError,
3403
+ "TODO: Ruby -> GIArgument(GHash)[value][%s][%s]",
3404
+ g_type_tag_to_string(value_type_tag),
3405
+ g_info_type_to_string(value_interface_type));
3406
+ break;
3407
+ case GI_INFO_TYPE_ENUM:
3408
+ value_destroy_func = NULL;
3409
+ value_ruby_to_c_func = ruby_to_c_interface_enum;
3410
+ value_ruby_to_c_data.context =
3411
+ "Ruby -> GIArgument(GHash)[value][interface]";
3412
+ break;
3413
+ case GI_INFO_TYPE_FLAGS:
3414
+ case GI_INFO_TYPE_OBJECT:
3415
+ case GI_INFO_TYPE_INTERFACE:
3416
+ case GI_INFO_TYPE_CONSTANT:
3417
+ case GI_INFO_TYPE_INVALID_0:
3418
+ case GI_INFO_TYPE_UNION:
3419
+ case GI_INFO_TYPE_VALUE:
3420
+ case GI_INFO_TYPE_SIGNAL:
3421
+ case GI_INFO_TYPE_VFUNC:
3422
+ case GI_INFO_TYPE_PROPERTY:
3423
+ case GI_INFO_TYPE_FIELD:
3424
+ case GI_INFO_TYPE_ARG:
3425
+ case GI_INFO_TYPE_TYPE:
3426
+ case GI_INFO_TYPE_UNRESOLVED:
3427
+ rb_raise(rb_eNotImpError,
3428
+ "TODO: Ruby -> GIArgument(GHash)[value][%s][%s]",
3429
+ g_type_tag_to_string(value_type_tag),
3430
+ g_info_type_to_string(value_interface_type));
3431
+ break;
3432
+ default:
3433
+ g_assert_not_reached();
3434
+ break;
3435
+ }
3436
+ break;
3437
+ case GI_TYPE_TAG_GLIST:
3438
+ case GI_TYPE_TAG_GSLIST:
3439
+ case GI_TYPE_TAG_GHASH:
3440
+ case GI_TYPE_TAG_ERROR:
3441
+ case GI_TYPE_TAG_UNICHAR:
3442
+ rb_raise(rb_eNotImpError,
3443
+ "TODO: Ruby -> GIArgument(GHash)[value][%s]",
3444
+ g_type_tag_to_string(value_type_tag));
3445
+ break;
3446
+ default:
3447
+ g_assert_not_reached();
3448
+ break;
3449
+ }
3450
+
3451
+ argument->v_pointer = g_hash_table_new_full(hash_func,
3452
+ equal_func,
3453
+ key_destroy_func,
3454
+ value_destroy_func);
3455
+ convert_data.hash_table = argument->v_pointer;
3456
+ convert_data.key_ruby_to_c_func = key_ruby_to_c_func;
3457
+ convert_data.key_ruby_to_c_data = &key_ruby_to_c_data;
3458
+ convert_data.value_ruby_to_c_func = value_ruby_to_c_func;
3459
+ convert_data.value_ruby_to_c_data = &value_ruby_to_c_data;
3460
+ rb_hash_foreach(rb_argument,
3461
+ rb_gi_value_argument_from_ruby_ghash_convert,
3462
+ (VALUE)&convert_data);
3463
+
3464
+ return Qnil;
3465
+ }
3466
+
3467
+ static VALUE
3468
+ rb_gi_value_argument_from_ruby_ghash_rescue(VALUE value_data,
3469
+ VALUE exception)
3470
+ {
3471
+ ArgumentFromRubyData *data = (ArgumentFromRubyData *)value_data;
3472
+ GIArgument *argument = data->argument;
3473
+
3474
+ if (argument->v_pointer) {
3475
+ g_hash_table_unref(argument->v_pointer);
3476
+ argument->v_pointer = NULL;
3477
+ }
3478
+
3479
+ rb_exc_raise(exception);
3480
+
3481
+ return Qnil;
3482
+ }
3483
+
3484
+ static void
3485
+ rb_gi_value_argument_from_ruby_ghash(GIArgument *argument,
3486
+ GITypeInfo *type_info,
3487
+ VALUE rb_argument,
3488
+ VALUE self)
3489
+ {
3490
+ ArgumentFromRubyData data;
3491
+ argument->v_pointer = NULL;
3492
+ data.argument = argument;
3493
+ data.type_info = type_info;
3494
+ data.rb_argument = rb_argument;
3495
+ data.self = self;
3496
+ rb_rescue(rb_gi_value_argument_from_ruby_ghash_body, (VALUE)&data,
3497
+ rb_gi_value_argument_from_ruby_ghash_rescue, (VALUE)&data);
3498
+ }
3499
+
3226
3500
  static void
3227
3501
  rb_gi_value_argument_from_ruby_void(GIArgument *argument, GITypeInfo *type_info,
3228
3502
  VALUE rb_argument)
@@ -3340,6 +3614,9 @@ rb_gi_value_argument_from_ruby(GIArgument *argument, GITypeInfo *type_info,
3340
3614
  rb_argument, self);
3341
3615
  break;
3342
3616
  case GI_TYPE_TAG_GHASH:
3617
+ rb_gi_value_argument_from_ruby_ghash(argument, type_info,
3618
+ rb_argument, self);
3619
+ break;
3343
3620
  case GI_TYPE_TAG_ERROR:
3344
3621
  rb_raise(rb_eNotImpError,
3345
3622
  "TODO: Ruby -> GIArgument(%s)",
@@ -28,7 +28,9 @@
28
28
  #include <girffi.h>
29
29
  #include "gobject-introspection-enum-types.h"
30
30
 
31
- #include "rbgiversion.h"
31
+ #ifndef GI_CHECK_VERSION
32
+ # include "rbgiversion.h"
33
+ #endif
32
34
 
33
35
  #include "rb-gi-types.h"
34
36
  #include "rb-gi-conversions.h"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gobject-introspection
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.6
4
+ version: 3.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME2 Project Team
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2019-03-21 00:00:00.000000000 Z
10
+ date: 2019-08-16 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: glib2
@@ -16,14 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - '='
18
17
  - !ruby/object:Gem::Version
19
- version: 3.3.6
18
+ version: 3.3.7
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - '='
25
24
  - !ruby/object:Gem::Version
26
- version: 3.3.6
25
+ version: 3.3.7
27
26
  description: Ruby/GObjectIntrospection provides bindings of GObject Introspection
28
27
  and a loader module that can generate dynamically Ruby bindings of any GObject C
29
28
  libraries