gobject-introspection 4.0.3 → 4.0.4

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: 8022e622d198838f9adae24c76abf4d0ff9add43e98a23b1d71b0239eb5c63f1
4
- data.tar.gz: faf42ad29ca80ee31e82398e6f82badd2bbea63d82f50411883e7058f52e7adf
3
+ metadata.gz: 9feb4ba56486befb7695ab16f5c3e8cd0b09894f9117a13ed6c43e14b2922fff
4
+ data.tar.gz: ec9ab4a57024a77919929e50d99221f36d3345dd61a314127afdd5674b92393f
5
5
  SHA512:
6
- metadata.gz: 5fb1a3eb51518856fe39631a485bffcfd72ba95d323d66646bbed280e47e0126bffafcbca4aee2c6f79e35cd2bdc6c9bba938bf41c3c22ed78de3e649f807d6c
7
- data.tar.gz: 5e1c3119edf742e6a0f53cf1c057f1b5cc89c1361834ba5918ba614d44b60f9399bff0803a826b03efe8d904651ad0ed0f1529c6e52131b29916e3020e6c8805
6
+ metadata.gz: 97fb5b2b15556a2adc4f1f9a9fb214edcb9b2f45b9304c4dfea2965792b5cace76ec3643b64f1f15bbfd7fbeeb6f978fa034bc30109290ef4566559d1a4c197d
7
+ data.tar.gz: 155aeec561392d4a5a23c5a74ebf298d3b3052d541608b0cdc6d30d274110a624f9a208d5ad88fe2e41be58212652fe1baa43f09c4c8ae9cf83ba8702dc0a2c1
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright (C) 2012-2021 Ruby-GNOME Project Team
3
+ # Copyright (C) 2012-2022 Ruby-GNOME 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
@@ -76,6 +76,81 @@ create_pkg_config_file("Ruby/GObjectIntrospection",
76
76
  ensure_objs
77
77
 
78
78
  $defs << "-DRUBY_GOBJECT_INTROSPECTION_COMPILATION"
79
+ case RUBY_PLATFORM
80
+ when /darwin/
81
+ symbols_in_external_bundles = [
82
+ "_g_rclosure_attach",
83
+ "_g_rclosure_attach_gobject",
84
+ "_g_rclosure_new",
85
+ "_g_signal_flags_get_type",
86
+ "_rbg_cGLibObject",
87
+ "_rbg_cstr2rval",
88
+ "_rbg_cstr2rval_free",
89
+ "_rbg_define_method",
90
+ "_rbg_define_singleton_method",
91
+ "_rbg_filename_from_ruby",
92
+ "_rbg_filename_to_ruby",
93
+ "_rbg_glist2rval",
94
+ "_rbg_glist2rval_with_type",
95
+ "_rbg_gslist2rval",
96
+ "_rbg_gslist2rval_with_type",
97
+ "_rbg_inspect",
98
+ "_rbg_is_bytes",
99
+ "_rbg_is_object",
100
+ "_rbg_is_value",
101
+ "_rbg_mGLib",
102
+ "_rbg_rval2cstr",
103
+ "_rbg_rval2cstr_accept_nil",
104
+ "_rbg_rval2cstr_accept_symbol",
105
+ "_rbg_rval2filenamev",
106
+ "_rbg_rval2glist",
107
+ "_rbg_rval2gslist",
108
+ "_rbg_rval2strv",
109
+ "_rbg_rval2strv_dup",
110
+ "_rbg_scan_options",
111
+ "_rbg_strv2rval",
112
+ "_rbg_to_array",
113
+ "_rbg_variant_from_ruby",
114
+ "_rbg_variant_to_ruby",
115
+ "_rbgerr_define_gerror",
116
+ "_rbgerr_gerror2exception",
117
+ "_rbgerr_ruby_error_quark",
118
+ "_rbgobj_add_relative",
119
+ "_rbgobj_boxed_get",
120
+ "_rbgobj_boxed_unown",
121
+ "_rbgobj_constant_remap",
122
+ "_rbgobj_convert_define",
123
+ "_rbgobj_define_class",
124
+ "_rbgobj_get_enum",
125
+ "_rbgobj_get_flags",
126
+ "_rbgobj_get_ruby_object_from_gobject",
127
+ "_rbgobj_gobject_initialize",
128
+ "_rbgobj_gtype_from_ruby",
129
+ "_rbgobj_gtype_new",
130
+ "_rbgobj_initialize_gvalue",
131
+ "_rbgobj_initialize_object",
132
+ "_rbgobj_instance_from_ruby_object",
133
+ "_rbgobj_instance_unref",
134
+ "_rbgobj_lookup_class",
135
+ "_rbgobj_make_boxed",
136
+ "_rbgobj_make_boxed_default",
137
+ "_rbgobj_make_boxed_raw",
138
+ "_rbgobj_make_enum",
139
+ "_rbgobj_make_flags",
140
+ "_rbgobj_object_add_relative",
141
+ "_rbgobj_object_alloc_func",
142
+ "_rbgobj_object_remove_relative",
143
+ "_rbgobj_remove_relative",
144
+ "_rbgobj_ruby_object_from_instance",
145
+ "_rbgobj_ruby_object_from_instance2",
146
+ "_rbgutil_invoke_callback",
147
+ "_rbgutil_on_callback_error",
148
+ "_rbgutil_start_callback_dispatch_thread",
149
+ ]
150
+ symbols_in_external_bundles.each do |symbol|
151
+ $DLDFLAGS << " -Wl,-U,#{symbol}"
152
+ end
153
+ end
79
154
  create_makefile(module_name)
80
155
 
81
156
  pkg_config_dir = with_config("pkg-config-dir")
@@ -135,6 +135,15 @@ rb_gi_arg_metadata_init_type_info(RBGIArgMetadata *metadata,
135
135
  }
136
136
  }
137
137
 
138
+ void
139
+ rb_gi_arg_metadata_init_struct_info(RBGIArgMetadata *metadata,
140
+ GIStructInfo *struct_info,
141
+ gpointer struct_memory)
142
+ {
143
+ metadata->struct_info = struct_info;
144
+ metadata->struct_memory = struct_memory;
145
+ }
146
+
138
147
  static RBGIArgMetadata *
139
148
  rb_gi_arg_metadata_new(GICallableInfo *callable_info, gint i)
140
149
  {
@@ -144,6 +153,8 @@ rb_gi_arg_metadata_new(GICallableInfo *callable_info, gint i)
144
153
  GIArgInfo *arg_info = &(metadata->arg_info);
145
154
  g_callable_info_load_arg(callable_info, i, arg_info);
146
155
  metadata->name = g_base_info_get_name(arg_info);
156
+ metadata->struct_info = NULL;
157
+ metadata->struct_memory = NULL;
147
158
  metadata->index = i;
148
159
 
149
160
  rb_gi_arg_metadata_init_type_info(metadata,
@@ -656,6 +667,156 @@ rb_gi_arguments_convert_arg_array_like_ensure(VALUE user_data)
656
667
  return Qnil;
657
668
  }
658
669
 
670
+ static gint64
671
+ rb_gi_arguments_convert_arg_array_body_extract_length(GIArgument *arg,
672
+ RBGIArgMetadata *metadata,
673
+ gboolean is_pointer)
674
+ {
675
+ switch (metadata->type.tag) {
676
+ case GI_TYPE_TAG_VOID:
677
+ case GI_TYPE_TAG_BOOLEAN:
678
+ rb_raise(rb_eNotImpError,
679
+ "TODO: invalid out array length argument?: <%s>",
680
+ g_type_tag_to_string(metadata->type.tag));
681
+ return -1;
682
+ case GI_TYPE_TAG_INT8:
683
+ if (is_pointer) {
684
+ return *((gint8 *)arg->v_pointer);
685
+ } else {
686
+ return arg->v_int8;
687
+ }
688
+ case GI_TYPE_TAG_UINT8:
689
+ if (is_pointer) {
690
+ return *((guint8 *)arg->v_pointer);
691
+ } else {
692
+ return arg->v_uint8;
693
+ }
694
+ case GI_TYPE_TAG_INT16:
695
+ if (is_pointer) {
696
+ return *((gint16 *)arg->v_pointer);
697
+ } else {
698
+ return arg->v_int16;
699
+ }
700
+ case GI_TYPE_TAG_UINT16:
701
+ if (is_pointer) {
702
+ return *((guint16 *)arg->v_pointer);
703
+ } else {
704
+ return arg->v_uint16;
705
+ }
706
+ case GI_TYPE_TAG_INT32:
707
+ if (is_pointer) {
708
+ return *((gint32 *)arg->v_pointer);
709
+ } else {
710
+ return arg->v_int32;
711
+ }
712
+ case GI_TYPE_TAG_UINT32:
713
+ if (is_pointer) {
714
+ return *((guint32 *)arg->v_pointer);
715
+ } else {
716
+ return arg->v_uint32;
717
+ }
718
+ case GI_TYPE_TAG_INT64:
719
+ if (is_pointer) {
720
+ return *((gint64 *)arg->v_pointer);
721
+ } else {
722
+ return arg->v_int64;
723
+ }
724
+ case GI_TYPE_TAG_UINT64:
725
+ if (is_pointer) {
726
+ return *((guint64 *)arg->v_pointer);
727
+ } else {
728
+ return arg->v_uint64;
729
+ }
730
+ case GI_TYPE_TAG_FLOAT:
731
+ case GI_TYPE_TAG_DOUBLE:
732
+ case GI_TYPE_TAG_GTYPE:
733
+ case GI_TYPE_TAG_UTF8:
734
+ case GI_TYPE_TAG_FILENAME:
735
+ case GI_TYPE_TAG_ARRAY:
736
+ case GI_TYPE_TAG_INTERFACE:
737
+ case GI_TYPE_TAG_GLIST:
738
+ case GI_TYPE_TAG_GSLIST:
739
+ case GI_TYPE_TAG_GHASH:
740
+ case GI_TYPE_TAG_ERROR:
741
+ case GI_TYPE_TAG_UNICHAR:
742
+ rb_raise(rb_eNotImpError,
743
+ "TODO: invalid out array length argument?: <%s>",
744
+ g_type_tag_to_string(metadata->type.tag));
745
+ return -1;
746
+ default:
747
+ g_assert_not_reached();
748
+ return -1;
749
+ }
750
+ }
751
+
752
+ static gint64
753
+ rb_gi_arguments_convert_arg_array_body_get_length(ArrayLikeToRubyData *data)
754
+ {
755
+ GITypeInfo *type_info = data->arg_metadata->type_info;
756
+ gint length_index = g_type_info_get_array_length(type_info);
757
+ if (length_index == -1) {
758
+ return -1;
759
+ }
760
+
761
+ if (!data->args->metadata && data->arg_metadata->struct_info) {
762
+ GIFieldInfo *field_info =
763
+ g_struct_info_get_field(data->arg_metadata->struct_info,
764
+ length_index);
765
+ GIArgument value;
766
+ g_field_info_get_field(field_info,
767
+ data->arg_metadata->struct_memory,
768
+ &value);
769
+ RBGIArgMetadata length_metadata;
770
+ GITypeInfo *length_type_info = g_field_info_get_type(field_info);
771
+ rb_gi_arg_metadata_init_type_info(&length_metadata, length_type_info);
772
+ rb_gi_arg_metadata_init_struct_info(&length_metadata,
773
+ data->arg_metadata->struct_info,
774
+ data->arg_metadata->struct_memory);
775
+ int64_t length =
776
+ rb_gi_arguments_convert_arg_array_body_extract_length(
777
+ &value,
778
+ &length_metadata,
779
+ FALSE);
780
+ /* TODO: Use ensure */
781
+ rb_gi_arg_metadata_clear(&length_metadata);
782
+ g_base_info_unref(field_info);
783
+ return length;
784
+ }
785
+
786
+ GIArgument *length_arg = NULL;
787
+ RBGIArgMetadata *length_metadata =
788
+ g_ptr_array_index(data->args->metadata, length_index);
789
+ if (length_metadata->direction == GI_DIRECTION_OUT) {
790
+ length_arg = &g_array_index(data->args->out_args,
791
+ GIArgument,
792
+ length_metadata->out_arg_index);
793
+ } else if (length_metadata->direction == GI_DIRECTION_INOUT) {
794
+ length_arg = &g_array_index(data->args->in_args,
795
+ GIArgument,
796
+ length_metadata->in_arg_index);
797
+ }
798
+
799
+ if (length_arg) {
800
+ gboolean is_pointer =
801
+ !(length_metadata->array_metadata &&
802
+ length_metadata->array_metadata->output_buffer_p);
803
+ return
804
+ rb_gi_arguments_convert_arg_array_body_extract_length(
805
+ length_arg,
806
+ length_metadata,
807
+ is_pointer);
808
+ } else {
809
+ length_arg = &g_array_index(data->args->in_args,
810
+ GIArgument,
811
+ length_metadata->in_arg_index);
812
+ return
813
+ rb_gi_arguments_convert_arg_array_body_extract_length(
814
+ length_arg,
815
+ length_metadata,
816
+ FALSE);
817
+ }
818
+ }
819
+
659
820
  static VALUE
660
821
  rb_gi_arguments_convert_arg_array_body_c_sized_interface(
661
822
  ArrayLikeToRubyData *data,
@@ -1115,135 +1276,19 @@ rb_gi_arguments_convert_arg_array_body_array(ArrayLikeToRubyData *data)
1115
1276
  }
1116
1277
  }
1117
1278
 
1118
- static gint64
1119
- rb_gi_arguments_convert_arg_array_body_extract_length(GIArgument *arg,
1120
- RBGIArgMetadata *metadata,
1121
- gboolean is_pointer)
1122
- {
1123
- switch (metadata->type.tag) {
1124
- case GI_TYPE_TAG_VOID:
1125
- case GI_TYPE_TAG_BOOLEAN:
1126
- rb_raise(rb_eNotImpError,
1127
- "TODO: invalid out array length argument?: <%s>",
1128
- g_type_tag_to_string(metadata->type.tag));
1129
- return -1;
1130
- case GI_TYPE_TAG_INT8:
1131
- if (is_pointer) {
1132
- return *((gint8 *)arg->v_pointer);
1133
- } else {
1134
- return arg->v_int8;
1135
- }
1136
- case GI_TYPE_TAG_UINT8:
1137
- if (is_pointer) {
1138
- return *((guint8 *)arg->v_pointer);
1139
- } else {
1140
- return arg->v_uint8;
1141
- }
1142
- case GI_TYPE_TAG_INT16:
1143
- if (is_pointer) {
1144
- return *((gint16 *)arg->v_pointer);
1145
- } else {
1146
- return arg->v_int16;
1147
- }
1148
- case GI_TYPE_TAG_UINT16:
1149
- if (is_pointer) {
1150
- return *((guint16 *)arg->v_pointer);
1151
- } else {
1152
- return arg->v_uint16;
1153
- }
1154
- case GI_TYPE_TAG_INT32:
1155
- if (is_pointer) {
1156
- return *((gint32 *)arg->v_pointer);
1157
- } else {
1158
- return arg->v_int32;
1159
- }
1160
- case GI_TYPE_TAG_UINT32:
1161
- if (is_pointer) {
1162
- return *((guint32 *)arg->v_pointer);
1163
- } else {
1164
- return arg->v_uint32;
1165
- }
1166
- case GI_TYPE_TAG_INT64:
1167
- if (is_pointer) {
1168
- return *((gint64 *)arg->v_pointer);
1169
- } else {
1170
- return arg->v_int64;
1171
- }
1172
- case GI_TYPE_TAG_UINT64:
1173
- if (is_pointer) {
1174
- return *((guint64 *)arg->v_pointer);
1175
- } else {
1176
- return arg->v_uint64;
1177
- }
1178
- case GI_TYPE_TAG_FLOAT:
1179
- case GI_TYPE_TAG_DOUBLE:
1180
- case GI_TYPE_TAG_GTYPE:
1181
- case GI_TYPE_TAG_UTF8:
1182
- case GI_TYPE_TAG_FILENAME:
1183
- case GI_TYPE_TAG_ARRAY:
1184
- case GI_TYPE_TAG_INTERFACE:
1185
- case GI_TYPE_TAG_GLIST:
1186
- case GI_TYPE_TAG_GSLIST:
1187
- case GI_TYPE_TAG_GHASH:
1188
- case GI_TYPE_TAG_ERROR:
1189
- case GI_TYPE_TAG_UNICHAR:
1190
- rb_raise(rb_eNotImpError,
1191
- "TODO: invalid out array length argument?: <%s>",
1192
- g_type_tag_to_string(metadata->type.tag));
1193
- return -1;
1194
- default:
1195
- g_assert_not_reached();
1196
- return -1;
1197
- }
1198
- }
1199
-
1200
1279
  static VALUE
1201
1280
  rb_gi_arguments_convert_arg_array_body(VALUE user_data)
1202
1281
  {
1203
1282
  ArrayLikeToRubyData *data = (ArrayLikeToRubyData *)user_data;
1204
1283
  GITypeInfo *type_info = data->arg_metadata->type_info;
1205
-
1206
- gint length_index = g_type_info_get_array_length(type_info);
1207
- gint64 length = -1;
1208
- if (length_index != -1) {
1209
- GIArgument *length_arg = NULL;
1210
- RBGIArgMetadata *length_metadata =
1211
- g_ptr_array_index(data->args->metadata, length_index);
1212
- if (length_metadata->direction == GI_DIRECTION_OUT) {
1213
- length_arg = &g_array_index(data->args->out_args,
1214
- GIArgument,
1215
- length_metadata->out_arg_index);
1216
- } else if (length_metadata->direction == GI_DIRECTION_INOUT) {
1217
- length_arg = &g_array_index(data->args->in_args,
1218
- GIArgument,
1219
- length_metadata->in_arg_index);
1220
- }
1221
-
1222
- if (length_arg) {
1223
- gboolean is_pointer =
1224
- !(length_metadata->array_metadata &&
1225
- length_metadata->array_metadata->output_buffer_p);
1226
- length =
1227
- rb_gi_arguments_convert_arg_array_body_extract_length(
1228
- length_arg,
1229
- length_metadata,
1230
- is_pointer);
1231
- } else {
1232
- length_arg = &g_array_index(data->args->in_args,
1233
- GIArgument,
1234
- length_metadata->in_arg_index);
1235
- length =
1236
- rb_gi_arguments_convert_arg_array_body_extract_length(
1237
- length_arg,
1238
- length_metadata,
1239
- FALSE);
1240
- }
1241
- }
1242
-
1243
1284
  GIArrayType array_type = g_type_info_get_array_type(type_info);
1244
1285
  switch (array_type) {
1245
1286
  case GI_ARRAY_TYPE_C:
1246
- return rb_gi_arguments_convert_arg_array_body_c(data, length);
1287
+ {
1288
+ gint64 length =
1289
+ rb_gi_arguments_convert_arg_array_body_get_length(data);
1290
+ return rb_gi_arguments_convert_arg_array_body_c(data, length);
1291
+ }
1247
1292
  case GI_ARRAY_TYPE_ARRAY:
1248
1293
  return rb_gi_arguments_convert_arg_array_body_array(data);
1249
1294
  case GI_ARRAY_TYPE_PTR_ARRAY:
@@ -1711,11 +1756,13 @@ rb_gi_arguments_convert_arg_ghash(RBGIArguments *args,
1711
1756
  RBGIArgMetadata key_metadata;
1712
1757
  rb_gi_arg_metadata_init_type_info(&key_metadata,
1713
1758
  g_type_info_get_param_type(type_info, 0));
1759
+ rb_gi_arg_metadata_init_struct_info(&key_metadata, NULL, NULL);
1714
1760
  data.key_metadata = &key_metadata;
1715
1761
 
1716
1762
  RBGIArgMetadata value_metadata;
1717
1763
  rb_gi_arg_metadata_init_type_info(&value_metadata,
1718
1764
  g_type_info_get_param_type(type_info, 1));
1765
+ rb_gi_arg_metadata_init_struct_info(&value_metadata, NULL, NULL);
1719
1766
  data.value_metadata = &value_metadata;
1720
1767
 
1721
1768
  return rb_ensure(rb_gi_arguments_convert_arg_ghash_body, (VALUE)&data,
@@ -2408,6 +2455,7 @@ rb_gi_arguments_convert_return_value(RBGIArguments *args,
2408
2455
  RBGIArgMetadata metadata;
2409
2456
  GITypeInfo *return_value_info = g_callable_info_get_return_type(args->info);
2410
2457
  rb_gi_arg_metadata_init_type_info(&metadata, return_value_info);
2458
+ rb_gi_arg_metadata_init_struct_info(&metadata, NULL, NULL);
2411
2459
  data.metadata = &metadata;
2412
2460
 
2413
2461
  return rb_ensure(rb_gi_arguments_convert_return_value_body, (VALUE)&data,
@@ -56,6 +56,7 @@ rg_value(VALUE self)
56
56
  RBGIArgMetadata value_metadata;
57
57
  rb_gi_arg_metadata_init_type_info(&value_metadata,
58
58
  g_constant_info_get_type(info));
59
+ rb_gi_arg_metadata_init_struct_info(&value_metadata, NULL, NULL);
59
60
  VALUE rb_value = rb_gi_arguments_convert_arg(&args,
60
61
  &value,
61
62
  &value_metadata,
@@ -232,12 +232,15 @@ rb_gi_field_info_get_field_raw_ensure(VALUE user_data)
232
232
  }
233
233
 
234
234
  VALUE
235
- rb_gi_field_info_get_field_raw(GIFieldInfo *info, gpointer memory)
235
+ rb_gi_field_info_get_field_raw(GIFieldInfo *info,
236
+ GIStructInfo *struct_info,
237
+ gpointer memory)
236
238
  {
237
239
  FieldToRubyData data;
238
240
  rb_gi_arguments_init(&(data.args), NULL, Qnil, Qnil, NULL);
239
241
  GITypeInfo *type_info = g_field_info_get_type(info);
240
242
  rb_gi_arg_metadata_init_type_info(&(data.metadata), type_info);
243
+ rb_gi_arg_metadata_init_struct_info(&(data.metadata), struct_info, memory);
241
244
  data.info = info;
242
245
  data.memory = memory;
243
246
 
@@ -246,7 +249,10 @@ rb_gi_field_info_get_field_raw(GIFieldInfo *info, gpointer memory)
246
249
  }
247
250
 
248
251
  void
249
- rb_gi_field_info_set_field_raw(GIFieldInfo *info, gpointer memory,
252
+ rb_gi_field_info_set_field_raw(GIFieldInfo *info,
253
+ /* TODO: Use this to set length field. */
254
+ GIStructInfo *struct_info,
255
+ gpointer memory,
250
256
  VALUE rb_field_value)
251
257
  {
252
258
  gint offset;
@@ -444,26 +450,24 @@ rb_gi_field_info_set_field_raw(GIFieldInfo *info, gpointer memory,
444
450
  }
445
451
 
446
452
  static VALUE
447
- rg_get_field(VALUE self, VALUE rb_memory)
453
+ rg_get_field(VALUE self, VALUE rb_struct_info, VALUE rb_memory)
448
454
  {
449
- GIFieldInfo *info;
450
- gpointer memory;
451
-
452
- info = SELF(self);
453
- memory = GUINT_TO_POINTER(NUM2ULONG(rb_memory));
454
- return rb_gi_field_info_get_field_raw(info, memory);
455
+ GIFieldInfo *info = SELF(self);
456
+ GIStructInfo *struct_info = RVAL2GI_STRUCT_INFO(rb_struct_info);
457
+ gpointer memory = GUINT_TO_POINTER(NUM2ULONG(rb_memory));
458
+ return rb_gi_field_info_get_field_raw(info, struct_info, memory);
455
459
  }
456
460
 
457
461
  static VALUE
458
- rg_set_field(VALUE self, VALUE rb_memory, VALUE rb_field_value)
462
+ rg_set_field(VALUE self,
463
+ VALUE rb_struct_info,
464
+ VALUE rb_memory,
465
+ VALUE rb_field_value)
459
466
  {
460
- GIFieldInfo *info;
461
- gpointer memory;
462
-
463
- info = SELF(self);
464
- memory = GUINT_TO_POINTER(NUM2ULONG(rb_memory));
465
- rb_gi_field_info_set_field_raw(info, memory, rb_field_value);
466
-
467
+ GIFieldInfo *info = SELF(self);
468
+ GIStructInfo *struct_info = RVAL2GI_STRUCT_INFO(rb_struct_info);
469
+ gpointer memory = GUINT_TO_POINTER(NUM2ULONG(rb_memory));
470
+ rb_gi_field_info_set_field_raw(info, struct_info, memory, rb_field_value);
467
471
  return Qnil;
468
472
  }
469
473
 
@@ -480,8 +484,8 @@ rb_gi_field_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo)
480
484
  RG_DEF_METHOD(size, 0);
481
485
  RG_DEF_METHOD(offset, 0);
482
486
  RG_DEF_METHOD(type, 0);
483
- RG_DEF_METHOD(get_field, 1);
484
- RG_DEF_METHOD(set_field, 2);
487
+ RG_DEF_METHOD(get_field, 2);
488
+ RG_DEF_METHOD(set_field, 3);
485
489
 
486
490
  G_DEF_CLASS(G_TYPE_I_FIELD_INFO_FLAGS, "FieldInfoFlags", rb_mGI);
487
491
  }
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2021 Ruby-GNOME Project Team
3
+ * Copyright (C) 2012-2022 Ruby-GNOME 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
@@ -131,7 +131,10 @@ rg_get_field_value(VALUE self, VALUE rb_object, VALUE rb_n)
131
131
  info = SELF(self);
132
132
  n = NUM2INT(rb_n);
133
133
  field_info = g_object_info_get_field(info, n);
134
- rb_value = rb_gi_field_info_get_field_raw(field_info, RVAL2GOBJ(rb_object));
134
+ rb_value = rb_gi_field_info_get_field_raw(field_info,
135
+ /* TODO: use info for size */
136
+ NULL,
137
+ RVAL2GOBJ(rb_object));
135
138
  g_base_info_unref(field_info);
136
139
 
137
140
  return rb_value;
@@ -147,7 +150,11 @@ rg_set_field_value(VALUE self, VALUE rb_object, VALUE rb_n, VALUE rb_value)
147
150
  info = SELF(self);
148
151
  n = NUM2INT(rb_n);
149
152
  field_info = g_object_info_get_field(info, n);
150
- rb_gi_field_info_set_field_raw(field_info, RVAL2GOBJ(rb_object), rb_value);
153
+ rb_gi_field_info_set_field_raw(field_info,
154
+ /* TODO: use info for size */
155
+ NULL,
156
+ RVAL2GOBJ(rb_object),
157
+ rb_value);
151
158
  /* TODO: use rb_ensure() to unref field_info. */
152
159
  g_base_info_unref(field_info);
153
160
 
@@ -51,6 +51,8 @@ struct RBGIArgMetadata_ {
51
51
  GICallableInfo *callable_info;
52
52
  GIArgInfo arg_info;
53
53
  GITypeInfo *type_info;
54
+ GIFieldInfo *struct_info;
55
+ gpointer *struct_memory;
54
56
  const gchar *name;
55
57
  RBGIArgMetadataType type;
56
58
  RBGIArgMetadataType element_type;
@@ -91,6 +93,10 @@ G_GNUC_INTERNAL void
91
93
  rb_gi_arg_metadata_init_type_info(RBGIArgMetadata *metadata,
92
94
  GITypeInfo *type_info);
93
95
  G_GNUC_INTERNAL void
96
+ rb_gi_arg_metadata_init_struct_info(RBGIArgMetadata *metadata,
97
+ GIStructInfo *struct_info,
98
+ gpointer struct_memory);
99
+ G_GNUC_INTERNAL void
94
100
  rb_gi_arg_metadata_clear(RBGIArgMetadata *metadata);
95
101
  G_GNUC_INTERNAL void
96
102
  rb_gi_arg_metadata_free(RBGIArgMetadata *metadata);
@@ -116,8 +116,10 @@ VALUE rb_gi_function_info_invoke_raw (GIFunctionInfo *info,
116
116
  VALUE *rb_return_value);
117
117
 
118
118
  VALUE rb_gi_field_info_get_field_raw (GIFieldInfo *info,
119
+ GIStructInfo *struct_info,
119
120
  gpointer memory);
120
121
  void rb_gi_field_info_set_field_raw (GIFieldInfo *info,
122
+ GIStructInfo *struct_info,
121
123
  gpointer memory,
122
124
  VALUE rb_field_value);
123
125
 
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2021 Ruby-GNOME Project Team
3
+ * Copyright (C) 2012-2022 Ruby-GNOME 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
@@ -218,7 +218,7 @@ rg_get_field_value(VALUE self, VALUE rb_struct, VALUE rb_n)
218
218
  raw_struct = rb_gi_struct_info_from_ruby(info, rb_struct);
219
219
  n = NUM2INT(rb_n);
220
220
  field_info = g_struct_info_get_field(info, n);
221
- rb_value = rb_gi_field_info_get_field_raw(field_info, raw_struct);
221
+ rb_value = rb_gi_field_info_get_field_raw(field_info, info, raw_struct);
222
222
  g_base_info_unref(field_info);
223
223
 
224
224
  return rb_value;
@@ -236,7 +236,7 @@ rg_set_field_value(VALUE self, VALUE rb_struct, VALUE rb_n, VALUE rb_value)
236
236
  raw_struct = rb_gi_struct_info_from_ruby(info, rb_struct);
237
237
  n = NUM2INT(rb_n);
238
238
  field_info = g_struct_info_get_field(info, n);
239
- rb_gi_field_info_set_field_raw(field_info, raw_struct, rb_value);
239
+ rb_gi_field_info_set_field_raw(field_info, info, raw_struct, rb_value);
240
240
  /* TODO: use rb_ensure() to unref field_info. */
241
241
  g_base_info_unref(field_info);
242
242
 
@@ -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-2022 Ruby-GNOME 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
@@ -69,6 +69,8 @@ rg_get_field_value(VALUE self, VALUE rb_union, VALUE rb_n)
69
69
  field_info = g_union_info_get_field(info, n);
70
70
  gtype = g_registered_type_info_get_g_type(info);
71
71
  rb_value = rb_gi_field_info_get_field_raw(field_info,
72
+ /* TODO: use info */
73
+ NULL,
72
74
  RVAL2BOXED(rb_union, gtype));
73
75
  g_base_info_unref(field_info);
74
76
 
@@ -88,6 +90,8 @@ rg_set_field_value(VALUE self, VALUE rb_union, VALUE rb_n, VALUE rb_value)
88
90
  field_info = g_union_info_get_field(info, n);
89
91
  gtype = g_registered_type_info_get_g_type(info);
90
92
  rb_gi_field_info_set_field_raw(field_info,
93
+ /* TODO: use info */
94
+ NULL,
91
95
  RVAL2BOXED(rb_union, gtype),
92
96
  rb_value);
93
97
  /* TODO: use rb_ensure() to unref field_info. */
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: 4.0.3
4
+ version: 4.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-13 00:00:00.000000000 Z
11
+ date: 2022-12-09 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: 4.0.3
19
+ version: 4.0.4
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: 4.0.3
26
+ version: 4.0.4
27
27
  description: Ruby/GObjectIntrospection provides bindings of GObject Introspection
28
28
  and a loader module that can generate dynamically Ruby bindings of any GObject C
29
29
  libraries