gobject-introspection 3.1.7-x64-mingw32 → 3.1.8-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gobject-introspection/rb-gi-argument.c +129 -103
  3. data/ext/gobject-introspection/rb-gi-field-info.c +146 -33
  4. data/ext/gobject-introspection/rb-gi-interface-info.c +1 -1
  5. data/ext/gobject-introspection/rb-gi-private.h +7 -1
  6. data/ext/gobject-introspection/rb-gi-struct-info.c +73 -1
  7. data/ext/gobject-introspection/rb-gobject-introspection.h +1 -1
  8. data/lib/2.2/gobject_introspection.so +0 -0
  9. data/lib/2.3/gobject_introspection.so +0 -0
  10. data/lib/2.4/gobject_introspection.so +0 -0
  11. data/vendor/local/bin/g-ir-compiler.exe +0 -0
  12. data/vendor/local/bin/g-ir-generate.exe +0 -0
  13. data/vendor/local/bin/g-ir-inspect.exe +0 -0
  14. data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
  15. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
  16. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
  17. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
  18. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
  19. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
  20. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
  21. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
  22. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
  23. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
  24. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
  25. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyc +0 -0
  26. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyo +0 -0
  27. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
  28. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
  29. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
  30. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
  31. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyc +0 -0
  32. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyo +0 -0
  33. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
  34. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
  35. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
  36. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
  37. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
  38. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
  39. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
  40. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
  41. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
  42. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
  43. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
  44. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
  45. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
  46. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
  47. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
  48. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
  49. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
  50. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
  51. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
  52. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
  53. data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
  54. data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
  55. data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyc +0 -0
  56. data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyo +0 -0
  57. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
  58. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
  59. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
  60. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
  61. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
  62. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
  63. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
  64. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
  65. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
  66. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
  67. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
  68. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
  69. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
  70. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
  71. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
  72. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
  73. data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
  74. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ffd9abd221b658fbe2b173a88021b2f97a65dbe
4
- data.tar.gz: 930783af7056405ca0df00406c095bb21f1b60ec
3
+ metadata.gz: 91726e13992b23a64769f30fcb15c921d3802b7c
4
+ data.tar.gz: e98b5a35888273aad281b30edc1f8b28317bbd59
5
5
  SHA512:
6
- metadata.gz: 45392c61ac15d2715067a140c4aa81a6240786789a28a8d7829b30b857271f536f646c604d68f8c1465a98b53b4a5a3d3214e3df79abd209510df7a21e7a2df9
7
- data.tar.gz: f2a421f053e1fa9b1bd3ad17072a3874638a1dba16b1205ff955323c0a2363a8f7066a0193added5a5dc182ebae5863d2d2a36853268c715af64e4e551ce1fbb
6
+ metadata.gz: f547e80aace4ef181502c9ac941c5025f320f25cc134eecb814ca3bacd1e342582a3192aa834707338e8b2a08b3a5819034e70b4616bfa60a95eed618fb7ba2a
7
+ data.tar.gz: 18909893c66862dce0df410a2d4c40f78a6e0529d275aafb5f0ac3cfb6b3d97882131296dc2f9332027345471cb67f295dd440b30b18ab5fbf30ed1fe8a2e00e
@@ -22,59 +22,6 @@
22
22
 
23
23
  static VALUE rb_cGLibValue = Qnil;
24
24
 
25
- static VALUE
26
- interface_struct_to_ruby(gpointer object,
27
- gboolean duplicate,
28
- G_GNUC_UNUSED GITypeInfo *type_info,
29
- GIBaseInfo *interface_info)
30
- {
31
- const char *namespace;
32
- const char *name;
33
- VALUE rb_module;
34
- VALUE rb_class;
35
- gpointer target_object = object;
36
- RUBY_DATA_FUNC free_func = NULL;
37
-
38
- namespace = g_base_info_get_namespace(interface_info);
39
- name = g_base_info_get_name(interface_info);
40
-
41
- if (strcmp(namespace, "cairo") == 0) {
42
- gchar *gtype_name;
43
- GType gtype;
44
-
45
- gtype_name = g_strdup_printf("Cairo%s", name);
46
- gtype = g_type_from_name(gtype_name);
47
- g_free(gtype_name);
48
- return BOXED2RVAL(target_object, gtype);
49
- }
50
-
51
- rb_module = rb_const_get(rb_cObject, rb_intern(namespace));
52
- rb_class = rb_const_get(rb_module, rb_intern(name));
53
- if (rb_respond_to(rb_class, rb_intern("gtype"))) {
54
- VALUE rb_gtype;
55
- GType gtype;
56
-
57
- rb_gtype = rb_funcall(rb_class, rb_intern("gtype"), 0);
58
- gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0));
59
- return BOXED2RVAL(target_object, gtype);
60
- }
61
-
62
- if (duplicate) {
63
- size_t object_size;
64
- object_size = g_struct_info_get_size(interface_info);
65
- target_object = xmalloc(object_size);
66
- memcpy(target_object, object, object_size);
67
- free_func = xfree;
68
- }
69
- return Data_Wrap_Struct(rb_class, NULL, free_func, target_object);
70
- }
71
-
72
- static gpointer
73
- interface_struct_from_ruby(VALUE rb_object)
74
- {
75
- return DATA_PTR(rb_object);
76
- }
77
-
78
25
  static void
79
26
  array_c_to_ruby_sized_interface(gconstpointer *elements,
80
27
  gint64 n_elements,
@@ -107,10 +54,9 @@ array_c_to_ruby_sized_interface(gconstpointer *elements,
107
54
  if (gtype == G_TYPE_NONE) {
108
55
  for (i = 0; i < n_elements; i++) {
109
56
  rb_ary_push(rb_array,
110
- interface_struct_to_ruby((gpointer)elements[i],
111
- FALSE,
112
- element_type_info,
113
- interface_info));
57
+ rb_gi_struct_info_to_ruby(interface_info,
58
+ (gpointer)elements[i],
59
+ TRUE));
114
60
  }
115
61
  g_base_info_unref(interface_info);
116
62
  g_base_info_unref(element_type_info);
@@ -399,10 +345,9 @@ array_array_interface_to_ruby(GIArgument *array,
399
345
  gpointer element;
400
346
  element = elements->data + (element_size * i);
401
347
  rb_ary_push(rb_array,
402
- interface_struct_to_ruby(element,
403
- TRUE,
404
- element_type_info,
405
- interface_info));
348
+ rb_gi_struct_info_to_ruby(interface_info,
349
+ element,
350
+ FALSE));
406
351
  }
407
352
  } else {
408
353
  interface_name = g_info_type_to_string(interface_type);
@@ -644,17 +589,9 @@ rb_gi_argument_to_ruby_interface(GIArgument *argument,
644
589
  "TODO: GIArgument(interface)[callback] -> Ruby");
645
590
  break;
646
591
  case GI_INFO_TYPE_STRUCT:
647
- if (gtype == G_TYPE_NONE) {
648
- rb_interface = interface_struct_to_ruby(argument->v_pointer,
649
- duplicate,
650
- type_info,
651
- interface_info);
652
- } else if (gtype == G_TYPE_VARIANT) {
653
- GVariant *variant = argument->v_pointer;
654
- rb_interface = rbg_variant_to_ruby(variant);
655
- } else {
656
- rb_interface = BOXED2RVAL(argument->v_pointer, gtype);
657
- }
592
+ rb_interface = rb_gi_struct_info_to_ruby(interface_info,
593
+ argument->v_pointer,
594
+ !duplicate);
658
595
  break;
659
596
  case GI_INFO_TYPE_BOXED:
660
597
  rb_raise(rb_eNotImpError,
@@ -879,10 +816,9 @@ rb_gi_argument_to_ruby_glist_interface(GIArgument *argument,
879
816
  rb_argument = rb_ary_new();
880
817
  for (node = argument->v_pointer; node; node = g_list_next(node)) {
881
818
  rb_ary_push(rb_argument,
882
- interface_struct_to_ruby(node->data,
883
- FALSE,
884
- element_type_info,
885
- interface_info));
819
+ rb_gi_struct_info_to_ruby(interface_info,
820
+ node->data,
821
+ TRUE));
886
822
  }
887
823
  } else {
888
824
  rb_argument = BOXEDGLIST2RVAL(argument->v_pointer, gtype);
@@ -1030,10 +966,9 @@ rb_gi_argument_to_ruby_gslist_interface(GIArgument *argument,
1030
966
  rb_argument = rb_ary_new();
1031
967
  for (node = argument->v_pointer; node; node = g_slist_next(node)) {
1032
968
  rb_ary_push(rb_argument,
1033
- interface_struct_to_ruby(node->data,
1034
- FALSE,
1035
- element_type_info,
1036
- interface_info));
969
+ rb_gi_struct_info_to_ruby(interface_info,
970
+ node->data,
971
+ TRUE));
1037
972
  }
1038
973
  } else {
1039
974
  rb_argument = BOXEDGLIST2RVAL(argument->v_pointer, gtype);
@@ -1144,6 +1079,100 @@ rb_gi_argument_to_ruby_gslist(GIArgument *argument, GITypeInfo *type_info)
1144
1079
  return rb_argument;
1145
1080
  }
1146
1081
 
1082
+ static void
1083
+ rb_gi_argument_to_ruby_ghash_utf8_utf8_body(gpointer key,
1084
+ gpointer value,
1085
+ gpointer user_data)
1086
+ {
1087
+ VALUE rb_table = (VALUE)user_data;
1088
+ VALUE rb_key;
1089
+ VALUE rb_value;
1090
+
1091
+ rb_key = CSTR2RVAL(key);
1092
+ rb_value = CSTR2RVAL(value);
1093
+ rb_hash_aset(rb_table, rb_key, rb_value);
1094
+ }
1095
+
1096
+ static VALUE
1097
+ rb_gi_argument_to_ruby_ghash_utf8_utf8(GHashTable *table)
1098
+ {
1099
+ VALUE rb_table;
1100
+
1101
+ rb_table = rb_hash_new();
1102
+ g_hash_table_foreach(table,
1103
+ rb_gi_argument_to_ruby_ghash_utf8_utf8_body,
1104
+ (gpointer)(rb_table));
1105
+ return rb_table;
1106
+ }
1107
+
1108
+ static VALUE
1109
+ rb_gi_argument_to_ruby_ghash(GIArgument *argument, GITypeInfo *type_info)
1110
+ {
1111
+ VALUE rb_argument;
1112
+ GITypeInfo *key_type_info;
1113
+ GITypeTag key_type_tag;
1114
+ GITypeInfo *value_type_info;
1115
+ GITypeTag value_type_tag;
1116
+
1117
+ key_type_info = g_type_info_get_param_type(type_info, 0);
1118
+ key_type_tag = g_type_info_get_tag(key_type_info);
1119
+ value_type_info = g_type_info_get_param_type(type_info, 1);
1120
+ value_type_tag = g_type_info_get_tag(value_type_info);
1121
+
1122
+ switch (key_type_tag) {
1123
+ case GI_TYPE_TAG_VOID:
1124
+ case GI_TYPE_TAG_BOOLEAN:
1125
+ case GI_TYPE_TAG_INT8:
1126
+ case GI_TYPE_TAG_UINT8:
1127
+ case GI_TYPE_TAG_INT16:
1128
+ case GI_TYPE_TAG_UINT16:
1129
+ case GI_TYPE_TAG_INT32:
1130
+ case GI_TYPE_TAG_UINT32:
1131
+ case GI_TYPE_TAG_INT64:
1132
+ case GI_TYPE_TAG_UINT64:
1133
+ case GI_TYPE_TAG_FLOAT:
1134
+ case GI_TYPE_TAG_DOUBLE:
1135
+ case GI_TYPE_TAG_GTYPE:
1136
+ g_base_info_unref(key_type_info);
1137
+ g_base_info_unref(value_type_info);
1138
+ rb_raise(rb_eNotImpError,
1139
+ "TODO: GIArgument(GHash)[%s][%s] -> Ruby",
1140
+ g_type_tag_to_string(key_type_tag),
1141
+ g_type_tag_to_string(value_type_tag));
1142
+ break;
1143
+ case GI_TYPE_TAG_UTF8:
1144
+ if (value_type_tag == GI_TYPE_TAG_UTF8) {
1145
+ g_base_info_unref(key_type_info);
1146
+ g_base_info_unref(value_type_info);
1147
+ rb_argument =
1148
+ rb_gi_argument_to_ruby_ghash_utf8_utf8(argument->v_pointer);
1149
+ break;
1150
+ }
1151
+ case GI_TYPE_TAG_FILENAME:
1152
+ case GI_TYPE_TAG_ARRAY:
1153
+ case GI_TYPE_TAG_INTERFACE:
1154
+ case GI_TYPE_TAG_GLIST:
1155
+ case GI_TYPE_TAG_GSLIST:
1156
+ case GI_TYPE_TAG_GHASH:
1157
+ case GI_TYPE_TAG_ERROR:
1158
+ case GI_TYPE_TAG_UNICHAR:
1159
+ g_base_info_unref(key_type_info);
1160
+ g_base_info_unref(value_type_info);
1161
+ rb_raise(rb_eNotImpError,
1162
+ "TODO: GIArgument(GHash)[%s][%s] -> Ruby",
1163
+ g_type_tag_to_string(key_type_tag),
1164
+ g_type_tag_to_string(value_type_tag));
1165
+ break;
1166
+ default:
1167
+ g_base_info_unref(key_type_info);
1168
+ g_base_info_unref(value_type_info);
1169
+ g_assert_not_reached();
1170
+ break;
1171
+ }
1172
+
1173
+ return rb_argument;
1174
+ }
1175
+
1147
1176
  static VALUE
1148
1177
  rb_gi_argument_to_ruby_unichar(GIArgument *argument)
1149
1178
  {
@@ -1248,9 +1277,7 @@ rb_gi_argument_to_ruby(GIArgument *argument,
1248
1277
  rb_argument = rb_gi_argument_to_ruby_gslist(argument, type_info);
1249
1278
  break;
1250
1279
  case GI_TYPE_TAG_GHASH:
1251
- rb_raise(rb_eNotImpError,
1252
- "TODO: GIArgument(%s) -> Ruby",
1253
- g_type_tag_to_string(type_tag));
1280
+ rb_argument = rb_gi_argument_to_ruby_ghash(argument, type_info);
1254
1281
  break;
1255
1282
  case GI_TYPE_TAG_ERROR:
1256
1283
  rb_argument = GERROR2RVAL(argument->v_pointer);
@@ -2035,6 +2062,8 @@ rb_gi_return_argument_free_container(GIArgument *argument,
2035
2062
  g_slist_free(argument->v_pointer);
2036
2063
  break;
2037
2064
  case GI_TYPE_TAG_GHASH:
2065
+ g_hash_table_unref(argument->v_pointer);
2066
+ break;
2038
2067
  case GI_TYPE_TAG_ERROR:
2039
2068
  case GI_TYPE_TAG_UNICHAR:
2040
2069
  rb_raise(rb_eNotImpError,
@@ -3479,7 +3508,7 @@ set_in_array_gtype_arguments_from_ruby(GIArgument *array_argument,
3479
3508
 
3480
3509
  typedef struct {
3481
3510
  GType element_gtype;
3482
- gsize element_size;
3511
+ GIStructInfo *struct_info;
3483
3512
  VALUE rb_argument;
3484
3513
  gint n_args;
3485
3514
  gchar *values;
@@ -3489,23 +3518,22 @@ static VALUE
3489
3518
  set_in_array_interface_struct_arguments_from_ruby_body(VALUE value)
3490
3519
  {
3491
3520
  ArrayInterfaceStructFromRubyData *data;
3521
+ gsize size;
3492
3522
  gint i;
3493
3523
 
3494
3524
  data = (ArrayInterfaceStructFromRubyData *)value;
3525
+ size = g_struct_info_get_size(data->struct_info);
3526
+ data->values = xmalloc(size * data->n_args);
3495
3527
 
3496
3528
  for (i = 0; i < data->n_args; i++) {
3497
3529
  VALUE rb_element;
3498
3530
  gpointer element;
3499
3531
 
3500
3532
  rb_element = RARRAY_PTR(data->rb_argument)[i];
3501
- if (data->element_gtype == G_TYPE_NONE) {
3502
- element = interface_struct_from_ruby(rb_element);
3503
- } else {
3504
- element = RVAL2BOXED(rb_element, data->element_gtype);
3505
- }
3506
- memcpy(data->values + (data->element_size * i),
3533
+ element = rb_gi_struct_info_from_ruby(data->struct_info, rb_element);
3534
+ memcpy(data->values + (size * i),
3507
3535
  element,
3508
- data->element_size);
3536
+ size);
3509
3537
  }
3510
3538
 
3511
3539
  return Qnil;
@@ -3517,6 +3545,7 @@ set_in_array_interface_struct_arguments_from_ruby_rescue(VALUE value)
3517
3545
  ArrayInterfaceStructFromRubyData *data;
3518
3546
 
3519
3547
  data = (ArrayInterfaceStructFromRubyData *)value;
3548
+ g_base_info_unref((GIBaseInfo *)(data->struct_info));
3520
3549
  xfree(data->values);
3521
3550
 
3522
3551
  rb_exc_raise(rb_errinfo());
@@ -3524,17 +3553,15 @@ set_in_array_interface_struct_arguments_from_ruby_rescue(VALUE value)
3524
3553
 
3525
3554
  static void
3526
3555
  set_in_array_interface_struct_arguments_from_ruby(GIArgument *array_argument,
3527
- GType element_gtype,
3528
- gsize element_size,
3556
+ GIStructInfo *struct_info,
3529
3557
  VALUE rb_argument)
3530
3558
  {
3531
3559
  ArrayInterfaceStructFromRubyData data;
3532
3560
 
3533
- data.element_gtype = element_gtype;
3534
- data.element_size = element_size;
3561
+ data.struct_info = struct_info;
3535
3562
  data.rb_argument = rb_argument;
3536
3563
  data.n_args = RARRAY_LEN(rb_argument);
3537
- data.values = xmalloc(data.element_size * data.n_args);
3564
+ data.values = NULL;
3538
3565
  rb_rescue(set_in_array_interface_struct_arguments_from_ruby_body,
3539
3566
  (VALUE)&data,
3540
3567
  set_in_array_interface_struct_arguments_from_ruby_rescue,
@@ -3551,7 +3578,6 @@ set_in_array_interface_arguments_from_ruby(GIArgument *array_argument,
3551
3578
  GIInfoType interface_type;
3552
3579
  GType gtype;
3553
3580
  const char *interface_name;
3554
- gsize size;
3555
3581
 
3556
3582
  interface_info = g_type_info_get_interface(element_type_info);
3557
3583
  interface_type = g_base_info_get_type(interface_info);
@@ -3569,12 +3595,12 @@ set_in_array_interface_arguments_from_ruby(GIArgument *array_argument,
3569
3595
  g_type_name(gtype));
3570
3596
  break;
3571
3597
  case GI_INFO_TYPE_STRUCT:
3572
- size = g_struct_info_get_size(interface_info);
3573
- g_base_info_unref(interface_info);
3574
- set_in_array_interface_struct_arguments_from_ruby(array_argument,
3575
- gtype,
3576
- size,
3577
- rb_argument);
3598
+ {
3599
+ GIStructInfo *struct_info = (GIStructInfo *)interface_info;
3600
+ set_in_array_interface_struct_arguments_from_ruby(array_argument,
3601
+ struct_info,
3602
+ rb_argument);
3603
+ }
3578
3604
  break;
3579
3605
  case GI_INFO_TYPE_BOXED:
3580
3606
  case GI_INFO_TYPE_ENUM:
@@ -71,6 +71,69 @@ rg_type(VALUE self)
71
71
  return GI_BASE_INFO2RVAL_WITH_UNREF(g_field_info_get_type(info));
72
72
  }
73
73
 
74
+ static VALUE
75
+ rb_gi_field_info_get_field_raw_interface(GIFieldInfo *info,
76
+ gpointer memory,
77
+ GITypeInfo *type_info)
78
+ {
79
+ VALUE rb_field_value = Qnil;
80
+ GIBaseInfo *interface_info;
81
+ GIInfoType interface_type;
82
+
83
+ interface_info = g_type_info_get_interface(type_info);
84
+ interface_type = g_base_info_get_type(interface_info);
85
+ switch (interface_type) {
86
+ case GI_INFO_TYPE_INVALID:
87
+ case GI_INFO_TYPE_FUNCTION:
88
+ case GI_INFO_TYPE_CALLBACK:
89
+ break;
90
+ case GI_INFO_TYPE_STRUCT:
91
+ {
92
+ GIStructInfo *struct_info = (GIStructInfo *)interface_info;
93
+ gint offset;
94
+
95
+ offset = g_field_info_get_offset(info);
96
+ rb_field_value = rb_gi_struct_info_to_ruby(
97
+ struct_info,
98
+ (gchar *)memory + offset,
99
+ g_type_info_is_pointer(type_info));
100
+ break;
101
+ }
102
+ case GI_INFO_TYPE_BOXED:
103
+ case GI_INFO_TYPE_UNION:
104
+ case GI_INFO_TYPE_OBJECT:
105
+ {
106
+ GIArgument argument;
107
+ gint offset;
108
+
109
+ offset = g_field_info_get_offset(info);
110
+ argument.v_pointer = G_STRUCT_MEMBER(gpointer, memory, offset);
111
+ rb_field_value = GI_ARGUMENT2RVAL(&argument, FALSE, type_info,
112
+ NULL, NULL, NULL);
113
+ }
114
+ break;
115
+ case GI_INFO_TYPE_ENUM:
116
+ case GI_INFO_TYPE_FLAGS:
117
+ case GI_INFO_TYPE_INTERFACE:
118
+ case GI_INFO_TYPE_CONSTANT:
119
+ case GI_INFO_TYPE_INVALID_0:
120
+ case GI_INFO_TYPE_VALUE:
121
+ case GI_INFO_TYPE_SIGNAL:
122
+ case GI_INFO_TYPE_VFUNC:
123
+ case GI_INFO_TYPE_PROPERTY:
124
+ case GI_INFO_TYPE_FIELD:
125
+ case GI_INFO_TYPE_ARG:
126
+ case GI_INFO_TYPE_TYPE:
127
+ case GI_INFO_TYPE_UNRESOLVED:
128
+ break;
129
+ default:
130
+ break;
131
+ }
132
+ g_base_info_unref(interface_info);
133
+
134
+ return rb_field_value;
135
+ }
136
+
74
137
  VALUE
75
138
  rb_gi_field_info_get_field_raw(GIFieldInfo *info, gpointer memory)
76
139
  {
@@ -78,36 +141,25 @@ rb_gi_field_info_get_field_raw(GIFieldInfo *info, gpointer memory)
78
141
  gboolean processed = FALSE;
79
142
  GITypeInfo *type_info;
80
143
  GITypeTag type_tag;
81
- VALUE rb_field_value;
144
+ VALUE rb_field_value = Qnil;
82
145
 
83
146
  type_info = g_field_info_get_type(info);
84
147
  type_tag = g_type_info_get_tag(type_info);
85
148
 
86
149
  switch (type_tag) {
87
- case GI_TYPE_TAG_INTERFACE:
88
- {
89
- GIBaseInfo *interface_info;
90
- GIInfoType interface_type;
91
-
92
- interface_info = g_type_info_get_interface(type_info);
93
- interface_type = g_base_info_get_type(interface_info);
94
- switch (interface_type) {
95
- case GI_INFO_TYPE_STRUCT:
96
- case GI_INFO_TYPE_UNION:
97
- case GI_INFO_TYPE_BOXED:
98
- {
99
- int offset;
100
-
101
- offset = g_field_info_get_offset(info);
102
- argument.v_pointer = G_STRUCT_MEMBER(gpointer, memory, offset);
103
- processed = TRUE;
104
- }
105
- break;
106
- default:
107
- break;
108
- }
109
- g_base_info_unref(interface_info);
110
- }
150
+ case GI_TYPE_TAG_VOID:
151
+ case GI_TYPE_TAG_BOOLEAN:
152
+ case GI_TYPE_TAG_INT8:
153
+ case GI_TYPE_TAG_UINT8:
154
+ case GI_TYPE_TAG_INT16:
155
+ case GI_TYPE_TAG_UINT16:
156
+ case GI_TYPE_TAG_INT32:
157
+ case GI_TYPE_TAG_UINT32:
158
+ case GI_TYPE_TAG_INT64:
159
+ case GI_TYPE_TAG_UINT64:
160
+ case GI_TYPE_TAG_FLOAT:
161
+ case GI_TYPE_TAG_DOUBLE:
162
+ case GI_TYPE_TAG_GTYPE:
111
163
  break;
112
164
  case GI_TYPE_TAG_UTF8:
113
165
  {
@@ -117,6 +169,25 @@ rb_gi_field_info_get_field_raw(GIFieldInfo *info, gpointer memory)
117
169
  processed = TRUE;
118
170
  }
119
171
  break;
172
+ case GI_TYPE_TAG_FILENAME:
173
+ case GI_TYPE_TAG_ARRAY:
174
+ break;
175
+ case GI_TYPE_TAG_INTERFACE:
176
+ rb_field_value =
177
+ rb_gi_field_info_get_field_raw_interface(info,
178
+ memory,
179
+ type_info);
180
+ if (!NIL_P(rb_field_value)) {
181
+ g_base_info_unref(type_info);
182
+ return rb_field_value;
183
+ }
184
+ break;
185
+ case GI_TYPE_TAG_GLIST:
186
+ case GI_TYPE_TAG_GSLIST:
187
+ case GI_TYPE_TAG_GHASH:
188
+ case GI_TYPE_TAG_ERROR:
189
+ case GI_TYPE_TAG_UNICHAR:
190
+ break;
120
191
  default:
121
192
  break;
122
193
  }
@@ -153,6 +224,31 @@ rb_gi_field_info_set_field_raw(GIFieldInfo *info, gpointer memory,
153
224
  succeeded = g_field_info_set_field(info, memory, &field_value);
154
225
  if (!succeeded) {
155
226
  switch (type_tag) {
227
+ case GI_TYPE_TAG_VOID:
228
+ case GI_TYPE_TAG_BOOLEAN:
229
+ case GI_TYPE_TAG_INT8:
230
+ case GI_TYPE_TAG_UINT8:
231
+ case GI_TYPE_TAG_INT16:
232
+ case GI_TYPE_TAG_UINT16:
233
+ case GI_TYPE_TAG_INT32:
234
+ case GI_TYPE_TAG_UINT32:
235
+ case GI_TYPE_TAG_INT64:
236
+ case GI_TYPE_TAG_UINT64:
237
+ case GI_TYPE_TAG_FLOAT:
238
+ case GI_TYPE_TAG_DOUBLE:
239
+ case GI_TYPE_TAG_GTYPE:
240
+ break;
241
+ case GI_TYPE_TAG_UTF8:
242
+ {
243
+ int offset;
244
+ offset = g_field_info_get_offset(info);
245
+ G_STRUCT_MEMBER(gchar *, memory, offset) = field_value.v_string;
246
+ succeeded = TRUE;
247
+ }
248
+ break;
249
+ case GI_TYPE_TAG_FILENAME:
250
+ case GI_TYPE_TAG_ARRAY:
251
+ break;
156
252
  case GI_TYPE_TAG_INTERFACE:
157
253
  {
158
254
  GIBaseInfo *interface_info;
@@ -161,9 +257,13 @@ rb_gi_field_info_set_field_raw(GIFieldInfo *info, gpointer memory,
161
257
  interface_info = g_type_info_get_interface(type_info);
162
258
  interface_type = g_base_info_get_type(interface_info);
163
259
  switch (interface_type) {
260
+ case GI_INFO_TYPE_INVALID:
261
+ case GI_INFO_TYPE_FUNCTION:
262
+ case GI_INFO_TYPE_CALLBACK:
263
+ break;
164
264
  case GI_INFO_TYPE_STRUCT:
165
- case GI_INFO_TYPE_UNION:
166
265
  case GI_INFO_TYPE_BOXED:
266
+ case GI_INFO_TYPE_UNION:
167
267
  {
168
268
  int offset;
169
269
 
@@ -173,19 +273,32 @@ rb_gi_field_info_set_field_raw(GIFieldInfo *info, gpointer memory,
173
273
  succeeded = TRUE;
174
274
  }
175
275
  break;
276
+ case GI_INFO_TYPE_ENUM:
277
+ case GI_INFO_TYPE_FLAGS:
278
+ case GI_INFO_TYPE_OBJECT:
279
+ case GI_INFO_TYPE_INTERFACE:
280
+ case GI_INFO_TYPE_CONSTANT:
281
+ case GI_INFO_TYPE_INVALID_0:
282
+ case GI_INFO_TYPE_VALUE:
283
+ case GI_INFO_TYPE_SIGNAL:
284
+ case GI_INFO_TYPE_VFUNC:
285
+ case GI_INFO_TYPE_PROPERTY:
286
+ case GI_INFO_TYPE_FIELD:
287
+ case GI_INFO_TYPE_ARG:
288
+ case GI_INFO_TYPE_TYPE:
289
+ case GI_INFO_TYPE_UNRESOLVED:
290
+ break;
176
291
  default:
177
292
  break;
178
293
  }
179
294
  g_base_info_unref(interface_info);
180
295
  }
181
296
  break;
182
- case GI_TYPE_TAG_UTF8:
183
- {
184
- int offset;
185
- offset = g_field_info_get_offset(info);
186
- G_STRUCT_MEMBER(gchar *, memory, offset) = field_value.v_string;
187
- succeeded = TRUE;
188
- }
297
+ case GI_TYPE_TAG_GLIST:
298
+ case GI_TYPE_TAG_GSLIST:
299
+ case GI_TYPE_TAG_GHASH:
300
+ case GI_TYPE_TAG_ERROR:
301
+ case GI_TYPE_TAG_UNICHAR:
189
302
  break;
190
303
  default:
191
304
  break;
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2012-2017 Ruby-GNOME2 Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2012-2017 Ruby-GNOME2 Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -105,4 +105,10 @@ void rb_gi_field_info_set_field_raw (GIFieldInfo *info,
105
105
  gpointer memory,
106
106
  VALUE rb_field_value);
107
107
 
108
+ VALUE rb_gi_struct_info_to_ruby(GIStructInfo *info,
109
+ gpointer object,
110
+ gboolean is_pointer);
111
+ gpointer rb_gi_struct_info_from_ruby(GIStructInfo *info,
112
+ VALUE rb_object);
113
+
108
114
  #endif
@@ -28,13 +28,85 @@ gi_struct_info_get_type(void)
28
28
  {
29
29
  static GType type = 0;
30
30
  if (type == 0) {
31
- type = g_boxed_type_register_static("GIStructInfo",
31
+ type = g_boxed_type_register_static("GIStructInfo",
32
32
  (GBoxedCopyFunc)g_base_info_ref,
33
33
  (GBoxedFreeFunc)g_base_info_unref);
34
34
  }
35
35
  return type;
36
36
  }
37
37
 
38
+ VALUE
39
+ rb_gi_struct_info_to_ruby(GIStructInfo *info,
40
+ gpointer object,
41
+ gboolean is_pointer)
42
+ {
43
+ GIBaseInfo *base_info = (GIBaseInfo *)info;
44
+ GIRegisteredTypeInfo *registered_type_info = (GIRegisteredTypeInfo *)info;
45
+ GType gtype;
46
+ const char *namespace;
47
+ const char *name;
48
+ VALUE rb_module;
49
+ VALUE rb_class;
50
+ gpointer target_object = object;
51
+ RUBY_DATA_FUNC free_func = NULL;
52
+
53
+ gtype = g_registered_type_info_get_g_type(registered_type_info);
54
+ if (gtype == G_TYPE_VARIANT) {
55
+ GVariant *variant = object;
56
+ return rbg_variant_to_ruby(variant);
57
+ } else if (gtype != G_TYPE_NONE) {
58
+ return BOXED2RVAL(target_object, gtype);
59
+ }
60
+
61
+ namespace = g_base_info_get_namespace(base_info);
62
+ name = g_base_info_get_name(base_info);
63
+
64
+ if (strcmp(namespace, "cairo") == 0) {
65
+ gchar *gtype_name;
66
+ GType gtype;
67
+
68
+ gtype_name = g_strdup_printf("Cairo%s", name);
69
+ gtype = g_type_from_name(gtype_name);
70
+ g_free(gtype_name);
71
+ return BOXED2RVAL(target_object, gtype);
72
+ }
73
+
74
+ rb_module = rb_const_get(rb_cObject, rb_intern(namespace));
75
+ rb_class = rb_const_get(rb_module, rb_intern(name));
76
+ if (rb_respond_to(rb_class, rb_intern("gtype"))) {
77
+ VALUE rb_gtype;
78
+ GType gtype;
79
+
80
+ rb_gtype = rb_funcall(rb_class, rb_intern("gtype"), 0);
81
+ gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0));
82
+ return BOXED2RVAL(target_object, gtype);
83
+ }
84
+
85
+ if (!is_pointer) {
86
+ size_t object_size;
87
+ object_size = g_struct_info_get_size(info);
88
+ target_object = xmalloc(object_size);
89
+ memcpy(target_object, object, object_size);
90
+ free_func = xfree;
91
+ }
92
+
93
+ return Data_Wrap_Struct(rb_class, NULL, free_func, target_object);
94
+ }
95
+
96
+ gpointer
97
+ rb_gi_struct_info_from_ruby(GIStructInfo *info, VALUE rb_object)
98
+ {
99
+ GIRegisteredTypeInfo *registerd_type_info = (GIRegisteredTypeInfo *)info;
100
+ GType gtype;
101
+
102
+ gtype = g_registered_type_info_get_g_type(registerd_type_info);
103
+ if (gtype == G_TYPE_NONE) {
104
+ return DATA_PTR(rb_object);
105
+ } else {
106
+ return RVAL2BOXED(rb_object, gtype);
107
+ }
108
+ }
109
+
38
110
  static VALUE
39
111
  rg_n_fields(VALUE self)
40
112
  {
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2014 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2012-2017 Ruby-GNOME2 Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gobject-introspection
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.7
4
+ version: 3.1.8
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - The Ruby-GNOME2 Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-10 00:00:00.000000000 Z
11
+ date: 2017-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glib2
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.1.7
19
+ version: 3.1.8
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.1.7
26
+ version: 3.1.8
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: test-unit
29
29
  requirement: !ruby/object:Gem::Requirement