gobject-introspection 3.1.8 → 3.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/ext/gobject-introspection/rb-gi-argument.c +49 -9
- data/ext/gobject-introspection/rb-gi-loader.c +74 -1
- data/test/run-test.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7600f4505e9b541f1599e76e10711438487a9ab2
|
4
|
+
data.tar.gz: 9e00b3aec282ba5bbf005dea71c1eb0d17a64c1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5674b84f008018f0033aa29c177c5f9b1ad578f2860f19343871679d630e85caf273c09db62150e8c565832a75e749aadda89a2edbb416a1ea4b43ddf1469ccd
|
7
|
+
data.tar.gz: 5a6e890806dd92a78730b902be40e17a37a83d83dc6c7a9ed6d73a3d44d18b378bf03265e505355daa64deff6033e1e8330b162214513bc36f3374fd0b9aad4d
|
data/Rakefile
CHANGED
@@ -32,7 +32,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
32
32
|
:name => "glib",
|
33
33
|
:download_site => :gnome,
|
34
34
|
:label => "GLib",
|
35
|
-
:version => "2.
|
35
|
+
:version => "2.54.1",
|
36
36
|
:compression_method => "xz",
|
37
37
|
:windows => {
|
38
38
|
:build => false,
|
@@ -47,7 +47,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
47
47
|
:name => "gobject-introspection",
|
48
48
|
:download_site => :gnome,
|
49
49
|
:label => "gobject-introspection",
|
50
|
-
:version => "1.
|
50
|
+
:version => "1.54.1",
|
51
51
|
:compression_method => "xz",
|
52
52
|
:windows => {
|
53
53
|
:configure_args => [
|
@@ -61,13 +61,14 @@ array_c_to_ruby_sized_interface(gconstpointer *elements,
|
|
61
61
|
g_base_info_unref(interface_info);
|
62
62
|
g_base_info_unref(element_type_info);
|
63
63
|
} else {
|
64
|
-
|
64
|
+
/* TODO: Should we check caller_allocates? */
|
65
|
+
gsize struct_size = g_struct_info_get_size(interface_info);
|
66
|
+
for (i = 0; i < n_elements; i++) {
|
67
|
+
gpointer element = ((gchar *)elements) + struct_size * i;
|
68
|
+
rb_ary_push(rb_array, BOXED2RVAL(element, gtype));
|
69
|
+
}
|
65
70
|
g_base_info_unref(interface_info);
|
66
71
|
g_base_info_unref(element_type_info);
|
67
|
-
rb_raise(rb_eNotImpError,
|
68
|
-
"TODO: GIArgument(array)[c][interface(%s)](%s) -> Ruby",
|
69
|
-
interface_name,
|
70
|
-
g_type_name(gtype));
|
71
72
|
}
|
72
73
|
break;
|
73
74
|
case GI_INFO_TYPE_BOXED:
|
@@ -131,12 +132,20 @@ array_c_to_ruby_sized(gconstpointer *elements,
|
|
131
132
|
|
132
133
|
switch (element_type_tag) {
|
133
134
|
case GI_TYPE_TAG_VOID:
|
134
|
-
case GI_TYPE_TAG_BOOLEAN:
|
135
135
|
g_base_info_unref(element_type_info);
|
136
136
|
rb_raise(rb_eNotImpError,
|
137
137
|
"TODO: GIArgument(array)[c][%s] -> Ruby",
|
138
138
|
g_type_tag_to_string(element_type_tag));
|
139
139
|
break;
|
140
|
+
case GI_TYPE_TAG_BOOLEAN:
|
141
|
+
g_base_info_unref(element_type_info);
|
142
|
+
{
|
143
|
+
const gboolean *booleans = (const gboolean *)elements;
|
144
|
+
for (i = 0; i < n_elements; i++) {
|
145
|
+
rb_ary_push(rb_array, CBOOL2RVAL(booleans[i]));
|
146
|
+
}
|
147
|
+
}
|
148
|
+
break;
|
140
149
|
case GI_TYPE_TAG_INT8:
|
141
150
|
g_base_info_unref(element_type_info);
|
142
151
|
{
|
@@ -1146,8 +1155,15 @@ rb_gi_argument_to_ruby_ghash(GIArgument *argument, GITypeInfo *type_info)
|
|
1146
1155
|
g_base_info_unref(value_type_info);
|
1147
1156
|
rb_argument =
|
1148
1157
|
rb_gi_argument_to_ruby_ghash_utf8_utf8(argument->v_pointer);
|
1149
|
-
|
1158
|
+
} else {
|
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));
|
1150
1165
|
}
|
1166
|
+
break;
|
1151
1167
|
case GI_TYPE_TAG_FILENAME:
|
1152
1168
|
case GI_TYPE_TAG_ARRAY:
|
1153
1169
|
case GI_TYPE_TAG_INTERFACE:
|
@@ -3330,6 +3346,22 @@ set_in_array_length_argument(GIArgument *argument,
|
|
3330
3346
|
}
|
3331
3347
|
}
|
3332
3348
|
|
3349
|
+
static void
|
3350
|
+
set_in_array_boolean_arguments_from_ruby(GIArgument *array_argument,
|
3351
|
+
VALUE rb_boolean_array)
|
3352
|
+
{
|
3353
|
+
gboolean *booleans;
|
3354
|
+
gint i, n_args;
|
3355
|
+
|
3356
|
+
n_args = RARRAY_LEN(rb_boolean_array);
|
3357
|
+
booleans = ALLOC_N(gboolean, n_args);
|
3358
|
+
for (i = 0; i < n_args; i++) {
|
3359
|
+
booleans[i] = RVAL2CBOOL(RARRAY_PTR(rb_boolean_array)[i]);
|
3360
|
+
}
|
3361
|
+
|
3362
|
+
array_argument->v_pointer = booleans;
|
3363
|
+
}
|
3364
|
+
|
3333
3365
|
static void
|
3334
3366
|
set_in_array_int8_arguments_from_ruby(GIArgument *array_argument,
|
3335
3367
|
VALUE rb_number_array)
|
@@ -3644,11 +3676,16 @@ in_array_c_argument_from_ruby(GIArgument *array_argument,
|
|
3644
3676
|
element_type_tag = g_type_info_get_tag(element_type_info);
|
3645
3677
|
switch (element_type_tag) {
|
3646
3678
|
case GI_TYPE_TAG_VOID:
|
3647
|
-
case GI_TYPE_TAG_BOOLEAN:
|
3648
3679
|
rb_raise(rb_eNotImpError,
|
3649
3680
|
"TODO: Ruby -> GIArgument(array)[%s]",
|
3650
3681
|
g_type_tag_to_string(element_type_tag));
|
3651
3682
|
break;
|
3683
|
+
case GI_TYPE_TAG_BOOLEAN:
|
3684
|
+
rb_argument = rbg_to_array(rb_argument);
|
3685
|
+
set_in_array_boolean_arguments_from_ruby(array_argument, rb_argument);
|
3686
|
+
set_in_array_length_argument(length_argument, length_type_info,
|
3687
|
+
RARRAY_LEN(rb_argument));
|
3688
|
+
break;
|
3652
3689
|
case GI_TYPE_TAG_INT8:
|
3653
3690
|
if (RB_TYPE_P(rb_argument, RUBY_T_STRING)) {
|
3654
3691
|
array_argument->v_pointer = RSTRING_PTR(rb_argument);
|
@@ -3953,11 +3990,13 @@ rb_gi_value_argument_free_array_c(VALUE rb_argument,
|
|
3953
3990
|
element_type_tag = g_type_info_get_tag(element_type_info);
|
3954
3991
|
switch (element_type_tag) {
|
3955
3992
|
case GI_TYPE_TAG_VOID:
|
3956
|
-
case GI_TYPE_TAG_BOOLEAN:
|
3957
3993
|
rb_raise(rb_eNotImpError,
|
3958
3994
|
"TODO: free GIArgument(array)[%s]",
|
3959
3995
|
g_type_tag_to_string(element_type_tag));
|
3960
3996
|
break;
|
3997
|
+
case GI_TYPE_TAG_BOOLEAN:
|
3998
|
+
xfree(argument->v_pointer);
|
3999
|
+
break;
|
3961
4000
|
case GI_TYPE_TAG_INT8:
|
3962
4001
|
case GI_TYPE_TAG_UINT8:
|
3963
4002
|
if (RB_TYPE_P(rb_argument, RUBY_T_STRING)) {
|
@@ -3985,6 +4024,7 @@ rb_gi_value_argument_free_array_c(VALUE rb_argument,
|
|
3985
4024
|
rb_raise(rb_eNotImpError,
|
3986
4025
|
"TODO: free GIArgument(array)[%s]",
|
3987
4026
|
g_type_tag_to_string(element_type_tag));
|
4027
|
+
break;
|
3988
4028
|
case GI_TYPE_TAG_INTERFACE:
|
3989
4029
|
xfree(argument->v_pointer);
|
3990
4030
|
break;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2012-
|
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
|
@@ -23,6 +23,7 @@
|
|
23
23
|
#define RG_TARGET_NAMESPACE rb_cGILoader
|
24
24
|
|
25
25
|
static const gchar *boxed_class_converters_name = "@@boxed_class_converters";
|
26
|
+
static const gchar *object_class_converters_name = "@@object_class_converters";
|
26
27
|
|
27
28
|
static VALUE
|
28
29
|
rg_s_define_class(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass)
|
@@ -194,6 +195,76 @@ rg_s_register_boxed_class_converter(VALUE klass, VALUE rb_gtype)
|
|
194
195
|
return Qnil;
|
195
196
|
}
|
196
197
|
|
198
|
+
typedef struct {
|
199
|
+
GType type;
|
200
|
+
VALUE rb_converters;
|
201
|
+
VALUE rb_converter;
|
202
|
+
} ObjectInstance2RObjData;
|
203
|
+
|
204
|
+
static void
|
205
|
+
object_class_converter_free(gpointer user_data)
|
206
|
+
{
|
207
|
+
ObjectInstance2RObjData *data = user_data;
|
208
|
+
rb_ary_delete(data->rb_converters, data->rb_converter);
|
209
|
+
g_free(data);
|
210
|
+
}
|
211
|
+
|
212
|
+
static VALUE
|
213
|
+
object_instance2robj(gpointer instance, gpointer user_data)
|
214
|
+
{
|
215
|
+
ObjectInstance2RObjData *data = user_data;
|
216
|
+
VALUE existing_rb_instance;
|
217
|
+
VALUE default_rb_instance;
|
218
|
+
VALUE klass;
|
219
|
+
ID id_call;
|
220
|
+
VALUE converted_rb_instance;
|
221
|
+
ID id_unref;
|
222
|
+
|
223
|
+
existing_rb_instance = rbgobj_get_ruby_object_from_gobject(instance, FALSE);
|
224
|
+
if (!NIL_P(existing_rb_instance))
|
225
|
+
return existing_rb_instance;
|
226
|
+
|
227
|
+
default_rb_instance = rbgobj_get_ruby_object_from_gobject(instance, TRUE);
|
228
|
+
CONST_ID(id_call, "call");
|
229
|
+
klass = rb_funcall(data->rb_converter, id_call, 1, default_rb_instance);
|
230
|
+
if (klass == rb_class_of(default_rb_instance))
|
231
|
+
return default_rb_instance;
|
232
|
+
|
233
|
+
converted_rb_instance = rbgobj_object_alloc_func(klass);
|
234
|
+
g_object_ref(instance);
|
235
|
+
CONST_ID(id_unref, "unref");
|
236
|
+
rb_funcall(default_rb_instance, id_unref, 0);
|
237
|
+
rbgobj_gobject_initialize(converted_rb_instance, instance);
|
238
|
+
return converted_rb_instance;
|
239
|
+
}
|
240
|
+
|
241
|
+
static VALUE
|
242
|
+
rg_s_register_object_class_converter(VALUE klass, VALUE rb_gtype)
|
243
|
+
{
|
244
|
+
RGConvertTable table;
|
245
|
+
ObjectInstance2RObjData *data;
|
246
|
+
ID id_to_i;
|
247
|
+
VALUE object_class_converters;
|
248
|
+
|
249
|
+
memset(&table, 0, sizeof(RGConvertTable));
|
250
|
+
CONST_ID(id_to_i, "to_i");
|
251
|
+
table.type = NUM2ULONG(rb_funcall(rb_gtype, id_to_i, 0));
|
252
|
+
table.klass = Qnil;
|
253
|
+
table.instance2robj = object_instance2robj;
|
254
|
+
|
255
|
+
data = g_new(ObjectInstance2RObjData, 1);
|
256
|
+
data->type = table.type;
|
257
|
+
data->rb_converter = rb_block_proc();
|
258
|
+
object_class_converters = rb_cv_get(klass, object_class_converters_name);
|
259
|
+
rb_ary_push(object_class_converters, data->rb_converter);
|
260
|
+
table.user_data = data;
|
261
|
+
table.notify = object_class_converter_free;
|
262
|
+
|
263
|
+
rbgobj_convert_define(&table);
|
264
|
+
|
265
|
+
return Qnil;
|
266
|
+
}
|
267
|
+
|
197
268
|
static VALUE
|
198
269
|
rg_s_register_constant_rename_map(G_GNUC_UNUSED VALUE klass,
|
199
270
|
VALUE rb_original,
|
@@ -260,12 +331,14 @@ rb_gi_loader_init(VALUE rb_mGI)
|
|
260
331
|
RG_TARGET_NAMESPACE = rb_define_class_under(rb_mGI, "Loader", rb_cObject);
|
261
332
|
|
262
333
|
rb_cv_set(RG_TARGET_NAMESPACE, boxed_class_converters_name, rb_ary_new());
|
334
|
+
rb_cv_set(RG_TARGET_NAMESPACE, object_class_converters_name, rb_ary_new());
|
263
335
|
|
264
336
|
RG_DEF_SMETHOD(define_class, -1);
|
265
337
|
RG_DEF_SMETHOD(define_interface, 3);
|
266
338
|
RG_DEF_SMETHOD(define_struct, -1);
|
267
339
|
RG_DEF_SMETHOD(define_error, -1);
|
268
340
|
RG_DEF_SMETHOD(register_boxed_class_converter, 1);
|
341
|
+
RG_DEF_SMETHOD(register_object_class_converter, 1);
|
269
342
|
RG_DEF_SMETHOD(register_constant_rename_map, 2);
|
270
343
|
RG_DEF_SMETHOD(start_callback_dispatch_thread, 0);
|
271
344
|
RG_DEF_SMETHOD(reference_gobject, -1);
|
data/test/run-test.rb
CHANGED
@@ -27,7 +27,7 @@ modules = [
|
|
27
27
|
[gobject_introspection_base, "gobject-introspection"]
|
28
28
|
]
|
29
29
|
modules.each do |target, module_name|
|
30
|
-
if system("which make > /dev/null")
|
30
|
+
if File.exist?("#{target}/Makefile") and system("which make > /dev/null")
|
31
31
|
`make -C #{target.dump} > /dev/null` or exit(false)
|
32
32
|
end
|
33
33
|
$LOAD_PATH.unshift(File.join(target, "ext", module_name))
|
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.
|
4
|
+
version: 3.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Ruby-GNOME2 Project Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-16 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.
|
19
|
+
version: 3.1.9
|
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.
|
26
|
+
version: 3.1.9
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: test-unit
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
requirements: []
|
146
146
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.5.2
|
147
|
+
rubygems_version: 2.5.2.1
|
148
148
|
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: Ruby/GObjectIntrospection is a Ruby binding of GObjectIntrospection.
|