gobject-introspection 2.2.5-x64-mingw32 → 3.0.0-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -3
- data/ext/gobject-introspection/extconf.rb +1 -1
- data/ext/gobject-introspection/rb-gi-argument.c +2275 -708
- data/ext/gobject-introspection/rb-gi-constant-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-constructor-info.c +2 -2
- data/ext/gobject-introspection/rb-gi-conversions.h +40 -36
- data/ext/gobject-introspection/rb-gi-field-info.c +32 -6
- data/ext/gobject-introspection/rb-gi-function-info.c +98 -63
- data/ext/gobject-introspection/rb-gi-loader.c +33 -1
- data/ext/gobject-introspection/rb-gi-method-info.c +3 -6
- data/ext/gobject-introspection/rb-gi-private.h +2 -1
- data/ext/gobject-introspection/rb-gi-repository.c +29 -29
- data/lib/2.0/gobject_introspection.so +0 -0
- data/lib/2.1/gobject_introspection.so +0 -0
- data/lib/2.2/gobject_introspection.so +0 -0
- data/lib/gobject-introspection.rb +1 -0
- data/lib/gobject-introspection/arg-info.rb +27 -0
- data/lib/gobject-introspection/callable-info.rb +3 -1
- data/lib/gobject-introspection/loader.rb +160 -31
- data/vendor/local/bin/g-ir-compiler.exe +0 -0
- data/vendor/local/bin/g-ir-generate.exe +0 -0
- data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
- data/vendor/local/include/gobject-introspection-1.0/girepository.h +4 -0
- data/vendor/local/include/gobject-introspection-1.0/giversionmacros.h +15 -1
- data/vendor/local/lib/girepository-1.0/GIRepository-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/GObject-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.py +6 -1
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ast.py +3 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girparser.py +19 -1
- data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.py +7 -3
- data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +1 -1
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.py +8 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
- data/vendor/local/lib/libgirepository-1.0.a +0 -0
- data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
- data/vendor/local/lib/libgirepository-1.0.la +3 -3
- data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +1 -1
- data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +1 -1
- data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +44 -7
- data/vendor/local/share/gir-1.0/GLib-2.0.gir +518 -131
- data/vendor/local/share/gir-1.0/GObject-2.0.gir +1248 -475
- data/vendor/local/share/gir-1.0/Gio-2.0.gir +1849 -80
- data/vendor/local/share/gobject-introspection-1.0/tests/annotation.c +1 -1
- data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +19 -16
- data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.h +1 -1
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +3 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +2 -2
- data/vendor/local/share/man/man1/g-ir-compiler.1 +1 -2
- data/vendor/local/share/man/man1/g-ir-generate.1 +2 -3
- metadata +5 -4
@@ -56,7 +56,7 @@ rg_value(VALUE self)
|
|
56
56
|
info = SELF(self);
|
57
57
|
type_info = g_constant_info_get_type(info);
|
58
58
|
value_size = g_constant_info_get_value(info, &value);
|
59
|
-
rb_value = GI_ARGUMENT2RVAL(&value, type_info);
|
59
|
+
rb_value = GI_ARGUMENT2RVAL(&value, FALSE, type_info, NULL, NULL, NULL);
|
60
60
|
g_base_info_unref(type_info);
|
61
61
|
g_constant_info_free_value(info, &value);
|
62
62
|
|
@@ -50,7 +50,6 @@ initialize_receiver(VALUE receiver, GITypeInfo *info, GIArgument *value)
|
|
50
50
|
g_base_info_unref(interface_info);
|
51
51
|
switch (interface_type) {
|
52
52
|
case GI_INFO_TYPE_OBJECT:
|
53
|
-
g_object_ref_sink(value->v_pointer);
|
54
53
|
G_INITIALIZE(receiver, value->v_pointer);
|
55
54
|
break;
|
56
55
|
case GI_INFO_TYPE_STRUCT:
|
@@ -111,7 +110,8 @@ rg_invoke(VALUE self, VALUE rb_options)
|
|
111
110
|
/* TODO: use rb_protect */
|
112
111
|
rb_gi_function_info_invoke_raw(info,
|
113
112
|
rb_options,
|
114
|
-
&return_value
|
113
|
+
&return_value,
|
114
|
+
NULL);
|
115
115
|
|
116
116
|
g_callable_info_load_return_type(callable_info, &return_value_info);
|
117
117
|
initialize_receiver(receiver, &return_value_info, &return_value);
|
@@ -31,26 +31,24 @@
|
|
31
31
|
(rb_gi_base_info_to_ruby_with_unref((GIBaseInfo *)(info)))
|
32
32
|
#define RVAL2GI_BASE_INFO(rb_object) (rb_gi_base_info_from_ruby(rb_object))
|
33
33
|
|
34
|
-
#define GI_ARGUMENT2RVAL(argument, type_info
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
#define
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
#define RVAL2GI_IN_ARGUMENT(argument, arg_info, rb_argument) \
|
53
|
-
(rb_gi_in_argument_from_ruby((argument), (arg_info), (rb_argument)))
|
34
|
+
#define GI_ARGUMENT2RVAL(argument, duplicate, type_info, \
|
35
|
+
in_args, out_args, args_metadata) \
|
36
|
+
(rb_gi_argument_to_ruby((argument), (duplicate), (type_info), \
|
37
|
+
(in_args), (out_args), (args_metadata)))
|
38
|
+
#define GI_OUT_ARGUMENT2RVAL(argument, arg_info, \
|
39
|
+
in_args, out_args, args_metadata) \
|
40
|
+
(rb_gi_out_argument_to_ruby((argument), (arg_info), \
|
41
|
+
(in_args), (out_args), (args_metadata)))
|
42
|
+
#define GI_RETURN_ARGUMENT2RVAL(callable_info, argument, \
|
43
|
+
in_args, out_args, args_metadata) \
|
44
|
+
(rb_gi_return_argument_to_ruby((callable_info), (argument), \
|
45
|
+
(in_args), (out_args), (args_metadata)))
|
46
|
+
#define RVAL2GI_VALUE_ARGUMENT(argument, type_info, rb_argument, self) \
|
47
|
+
(rb_gi_value_argument_from_ruby((argument), (type_info), \
|
48
|
+
(rb_argument), (self)))
|
49
|
+
#define RVAL2GI_IN_ARGUMENT(argument, arg_info, rb_argument, self) \
|
50
|
+
(rb_gi_in_argument_from_ruby((argument), (arg_info), \
|
51
|
+
(rb_argument), (self)))
|
54
52
|
#define RVAL2GI_IN_ARRAY_ARGUMENT(array_argument, length_argument, \
|
55
53
|
array_arg_info, length_arg_info, \
|
56
54
|
rb_argument) \
|
@@ -106,37 +104,43 @@ VALUE rb_gi_base_info_to_ruby_with_unref(GIBaseInfo *info);
|
|
106
104
|
GIBaseInfo *rb_gi_base_info_from_ruby (VALUE rb_info);
|
107
105
|
|
108
106
|
VALUE rb_gi_argument_to_ruby (GIArgument *argument,
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
107
|
+
gboolean duplicate,
|
108
|
+
GITypeInfo *type_info,
|
109
|
+
GArray *in_args,
|
110
|
+
GArray *out_args,
|
111
|
+
GPtrArray *args_metadata);
|
114
112
|
void rb_gi_out_argument_init (GIArgument *argument,
|
115
113
|
GIArgInfo *arg_info);
|
116
114
|
VALUE rb_gi_out_argument_to_ruby (GIArgument *argument,
|
117
|
-
GIArgInfo *arg_info
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
GIArgInfo *length_arg_info);
|
115
|
+
GIArgInfo *arg_info,
|
116
|
+
GArray *in_args,
|
117
|
+
GArray *out_args,
|
118
|
+
GPtrArray *args_metadata);
|
122
119
|
void rb_gi_out_argument_fin (GIArgument *argument,
|
123
120
|
GIArgInfo *arg_info);
|
124
|
-
VALUE rb_gi_return_argument_to_ruby (
|
125
|
-
|
121
|
+
VALUE rb_gi_return_argument_to_ruby (GICallableInfo *callable_info,
|
122
|
+
GIArgument *argument,
|
123
|
+
GArray *in_args,
|
124
|
+
GArray *out_args,
|
125
|
+
GPtrArray *args_metadata);
|
126
126
|
GIArgument *rb_gi_value_argument_from_ruby (GIArgument *argument,
|
127
127
|
GITypeInfo *type_info,
|
128
|
-
VALUE rb_argument
|
128
|
+
VALUE rb_argument,
|
129
|
+
VALUE self);
|
129
130
|
GIArgument *rb_gi_in_argument_from_ruby (GIArgument *argument,
|
130
131
|
GIArgInfo *arg_info,
|
131
|
-
VALUE rb_argument
|
132
|
+
VALUE rb_argument,
|
133
|
+
VALUE self);
|
132
134
|
GIArgument *rb_gi_in_array_argument_from_ruby (GIArgument *array_argument,
|
133
135
|
GIArgument *length_argument,
|
134
136
|
GIArgInfo *array_arg_info,
|
135
137
|
GIArgInfo *length_arg_info,
|
136
138
|
VALUE rb_argument);
|
137
|
-
void rb_gi_value_argument_free (
|
139
|
+
void rb_gi_value_argument_free (VALUE rb_argument,
|
140
|
+
GIArgument *argument,
|
138
141
|
GITypeInfo *type_info);
|
139
|
-
void rb_gi_in_argument_free (
|
142
|
+
void rb_gi_in_argument_free (VALUE rb_argument,
|
143
|
+
GIArgument *argument,
|
140
144
|
GIArgInfo *arg_info);
|
141
145
|
|
142
146
|
VALUE rb_gi_array_type_to_ruby (GIArrayType type);
|
@@ -76,14 +76,27 @@ rb_gi_field_info_get_field_raw(GIFieldInfo *info, gpointer memory)
|
|
76
76
|
{
|
77
77
|
GIArgument argument;
|
78
78
|
GITypeInfo *type_info;
|
79
|
+
GITypeTag type_tag;
|
79
80
|
VALUE rb_field_value;
|
80
81
|
|
82
|
+
type_info = g_field_info_get_type(info);
|
83
|
+
type_tag = g_type_info_get_tag(type_info);
|
84
|
+
|
81
85
|
if (!g_field_info_get_field(info, memory, &argument)) {
|
82
|
-
|
86
|
+
g_base_info_unref(type_info);
|
87
|
+
rb_raise(rb_eArgError, "failed to get field value: %s[%s]",
|
88
|
+
g_base_info_get_name(info),
|
89
|
+
g_type_tag_to_string(type_tag));
|
83
90
|
}
|
84
91
|
|
85
|
-
|
86
|
-
|
92
|
+
if (type_tag == GI_TYPE_TAG_UTF8) {
|
93
|
+
int offset;
|
94
|
+
offset = g_field_info_get_offset(info);
|
95
|
+
argument.v_string = G_STRUCT_MEMBER(gchar *, memory, offset);
|
96
|
+
}
|
97
|
+
|
98
|
+
rb_field_value = GI_ARGUMENT2RVAL(&argument, FALSE, type_info,
|
99
|
+
NULL, NULL, NULL);
|
87
100
|
g_base_info_unref(type_info);
|
88
101
|
|
89
102
|
return rb_field_value;
|
@@ -95,17 +108,30 @@ rb_gi_field_info_set_field_raw(GIFieldInfo *info, gpointer memory,
|
|
95
108
|
{
|
96
109
|
GIArgument field_value;
|
97
110
|
GITypeInfo *type_info;
|
111
|
+
GITypeTag type_tag;
|
98
112
|
gboolean succeeded;
|
99
113
|
|
100
114
|
type_info = g_field_info_get_type(info);
|
101
|
-
|
115
|
+
type_tag = g_type_info_get_tag(type_info);
|
116
|
+
RVAL2GI_VALUE_ARGUMENT(&field_value, type_info, rb_field_value, Qnil);
|
102
117
|
|
103
118
|
succeeded = g_field_info_set_field(info, memory, &field_value);
|
104
|
-
|
119
|
+
if (!succeeded) {
|
120
|
+
if (type_tag == GI_TYPE_TAG_UTF8) {
|
121
|
+
int offset;
|
122
|
+
offset = g_field_info_get_offset(info);
|
123
|
+
G_STRUCT_MEMBER(gchar *, memory, offset) = field_value.v_string;
|
124
|
+
succeeded = TRUE;
|
125
|
+
}
|
126
|
+
}
|
127
|
+
rb_gi_value_argument_free(rb_field_value, &field_value, type_info);
|
105
128
|
g_base_info_unref(type_info);
|
106
129
|
|
107
130
|
if (!succeeded) {
|
108
|
-
rb_raise(rb_eArgError,
|
131
|
+
rb_raise(rb_eArgError,
|
132
|
+
"failed to set field value: %s[%s]",
|
133
|
+
g_base_info_get_name(info),
|
134
|
+
g_type_tag_to_string(type_tag));
|
109
135
|
}
|
110
136
|
}
|
111
137
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2012-
|
3
|
+
* Copyright (C) 2012-2015 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
|
@@ -220,6 +220,10 @@ fill_metadata_rb_arg_index(GPtrArray *args_metadata)
|
|
220
220
|
|
221
221
|
metadata = g_ptr_array_index(args_metadata, i);
|
222
222
|
|
223
|
+
if (metadata->callback_p) {
|
224
|
+
continue;
|
225
|
+
}
|
226
|
+
|
223
227
|
if (metadata->closure_p) {
|
224
228
|
continue;
|
225
229
|
}
|
@@ -382,8 +386,36 @@ in_callback_argument_from_ruby(RBGIArgMetadata *metadata, GArray *in_args)
|
|
382
386
|
gpointer callback;
|
383
387
|
GIArgInfo *arg_info;
|
384
388
|
GIArgument *callback_argument;
|
389
|
+
GIArgument *closure_argument = NULL;
|
390
|
+
GIArgument *destroy_argument = NULL;
|
385
391
|
|
386
392
|
arg_info = &(metadata->arg_info);
|
393
|
+
|
394
|
+
callback_argument = &(g_array_index(in_args,
|
395
|
+
GIArgument,
|
396
|
+
metadata->in_arg_index));
|
397
|
+
if (metadata->closure_in_arg_index != -1) {
|
398
|
+
closure_argument = &(g_array_index(in_args,
|
399
|
+
GIArgument,
|
400
|
+
metadata->closure_in_arg_index));
|
401
|
+
}
|
402
|
+
if (metadata->destroy_in_arg_index != -1) {
|
403
|
+
destroy_argument = &(g_array_index(in_args,
|
404
|
+
GIArgument,
|
405
|
+
metadata->destroy_in_arg_index));
|
406
|
+
}
|
407
|
+
|
408
|
+
if (!rb_block_given_p() && g_arg_info_may_be_null(arg_info)) {
|
409
|
+
callback_argument->v_pointer = NULL;
|
410
|
+
if (closure_argument) {
|
411
|
+
closure_argument->v_pointer = NULL;
|
412
|
+
}
|
413
|
+
if (destroy_argument) {
|
414
|
+
destroy_argument->v_pointer = NULL;
|
415
|
+
}
|
416
|
+
return;
|
417
|
+
}
|
418
|
+
|
387
419
|
callback = find_callback_function(arg_info);
|
388
420
|
if (!callback) {
|
389
421
|
GITypeInfo type_info;
|
@@ -398,46 +430,38 @@ in_callback_argument_from_ruby(RBGIArgMetadata *metadata, GArray *in_args)
|
|
398
430
|
RVAL2CSTR(rb_type_name),
|
399
431
|
g_base_info_get_name(arg_info));
|
400
432
|
}
|
401
|
-
|
402
|
-
callback_argument = &(g_array_index(in_args,
|
403
|
-
GIArgument,
|
404
|
-
metadata->in_arg_index));
|
405
433
|
callback_argument->v_pointer = callback;
|
406
434
|
|
407
|
-
if (
|
435
|
+
if (closure_argument) {
|
408
436
|
RBGICallbackData *callback_data;
|
409
|
-
GIArgument *closure_argument;
|
410
437
|
|
411
438
|
callback_data = ALLOC(RBGICallbackData);
|
412
439
|
callback_data->metadata = metadata;
|
413
440
|
callback_data->rb_callback = rb_block_proc();
|
414
441
|
callback_data_guard_from_gc(callback_data);
|
415
|
-
closure_argument = &(g_array_index(in_args,
|
416
|
-
GIArgument,
|
417
|
-
metadata->closure_in_arg_index));
|
418
442
|
closure_argument->v_pointer = callback_data;
|
419
443
|
}
|
420
444
|
|
421
|
-
if (
|
422
|
-
GIArgument *destroy_argument;
|
423
|
-
destroy_argument = &(g_array_index(in_args,
|
424
|
-
GIArgument,
|
425
|
-
metadata->destroy_in_arg_index));
|
445
|
+
if (destroy_argument) {
|
426
446
|
destroy_argument->v_pointer = destroy_notify;
|
427
447
|
}
|
428
448
|
}
|
429
449
|
|
430
450
|
static void
|
431
451
|
in_argument_from_ruby(RBGIArgMetadata *metadata, VALUE rb_arguments,
|
432
|
-
GArray *in_args, GPtrArray *args_metadata
|
452
|
+
GArray *in_args, GPtrArray *args_metadata,
|
453
|
+
VALUE self)
|
433
454
|
{
|
455
|
+
if (metadata->callback_p && !metadata->destroy_p) {
|
456
|
+
in_callback_argument_from_ruby(metadata, in_args);
|
457
|
+
return;
|
458
|
+
}
|
459
|
+
|
434
460
|
if (metadata->rb_arg_index == -1) {
|
435
461
|
return;
|
436
462
|
}
|
437
463
|
|
438
|
-
if (metadata->
|
439
|
-
in_callback_argument_from_ruby(metadata, in_args);
|
440
|
-
} else if (metadata->array_p) {
|
464
|
+
if (metadata->array_p) {
|
441
465
|
GIArgument *array_argument;
|
442
466
|
GIArgument *length_argument = NULL;
|
443
467
|
GIArgInfo *length_arg_info = NULL;
|
@@ -475,7 +499,8 @@ in_argument_from_ruby(RBGIArgMetadata *metadata, VALUE rb_arguments,
|
|
475
499
|
argument = &(g_array_index(in_args, GIArgument, metadata->in_arg_index));
|
476
500
|
RVAL2GI_IN_ARGUMENT(argument,
|
477
501
|
&(metadata->arg_info),
|
478
|
-
rb_argument
|
502
|
+
rb_argument,
|
503
|
+
self);
|
479
504
|
}
|
480
505
|
}
|
481
506
|
|
@@ -500,7 +525,7 @@ arg_metadata_free(gpointer data)
|
|
500
525
|
}
|
501
526
|
|
502
527
|
static void
|
503
|
-
arguments_from_ruby(GICallableInfo *info, VALUE rb_arguments,
|
528
|
+
arguments_from_ruby(GICallableInfo *info, VALUE self, VALUE rb_arguments,
|
504
529
|
GArray *in_args, GArray *out_args,
|
505
530
|
GPtrArray *args_metadata)
|
506
531
|
{
|
@@ -516,7 +541,7 @@ arguments_from_ruby(GICallableInfo *info, VALUE rb_arguments,
|
|
516
541
|
metadata = g_ptr_array_index(args_metadata, i);
|
517
542
|
if (metadata->in_arg_index != -1) {
|
518
543
|
in_argument_from_ruby(metadata, rb_arguments,
|
519
|
-
in_args, args_metadata);
|
544
|
+
in_args, args_metadata, self);
|
520
545
|
} else {
|
521
546
|
out_argument_from_ruby(metadata, out_args);
|
522
547
|
}
|
@@ -563,33 +588,11 @@ out_arguments_to_ruby(GICallableInfo *callable_info,
|
|
563
588
|
continue;
|
564
589
|
}
|
565
590
|
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
RBGIArgMetadata *length_metadata;
|
572
|
-
length_metadata =
|
573
|
-
g_ptr_array_index(args_metadata,
|
574
|
-
metadata->array_length_arg_index);
|
575
|
-
if (length_metadata->direction == GI_DIRECTION_OUT) {
|
576
|
-
length_argument =
|
577
|
-
&g_array_index(in_args, GIArgument,
|
578
|
-
length_metadata->out_arg_index);
|
579
|
-
} else {
|
580
|
-
length_argument =
|
581
|
-
&g_array_index(in_args, GIArgument,
|
582
|
-
length_metadata->in_arg_index);
|
583
|
-
}
|
584
|
-
length_arg_info = &(length_metadata->arg_info);
|
585
|
-
}
|
586
|
-
rb_argument = GI_OUT_ARRAY_ARGUMENT2RVAL(argument,
|
587
|
-
length_argument,
|
588
|
-
&(metadata->arg_info),
|
589
|
-
length_arg_info);
|
590
|
-
} else {
|
591
|
-
rb_argument = GI_OUT_ARGUMENT2RVAL(argument, &(metadata->arg_info));
|
592
|
-
}
|
591
|
+
rb_argument = GI_OUT_ARGUMENT2RVAL(argument,
|
592
|
+
&(metadata->arg_info),
|
593
|
+
in_args,
|
594
|
+
out_args,
|
595
|
+
args_metadata);
|
593
596
|
rb_ary_push(rb_out_args, rb_argument);
|
594
597
|
}
|
595
598
|
|
@@ -609,7 +612,8 @@ arguments_init(GArray **in_args, GArray **out_args, GPtrArray **args_metadata)
|
|
609
612
|
}
|
610
613
|
|
611
614
|
static void
|
612
|
-
arguments_free(
|
615
|
+
arguments_free(VALUE rb_arguments,
|
616
|
+
GArray *in_args, GArray *out_args, GPtrArray *args_metadata)
|
613
617
|
{
|
614
618
|
guint i;
|
615
619
|
|
@@ -622,9 +626,18 @@ arguments_free(GArray *in_args, GArray *out_args, GPtrArray *args_metadata)
|
|
622
626
|
metadata->direction == GI_DIRECTION_INOUT) {
|
623
627
|
in_arg_index = metadata->in_arg_index;
|
624
628
|
if (in_arg_index != -1) {
|
629
|
+
gint rb_arg_index;
|
630
|
+
VALUE rb_argument = Qnil;
|
625
631
|
GIArgument *argument;
|
632
|
+
|
633
|
+
rb_arg_index = metadata->rb_arg_index;
|
634
|
+
if (rb_arg_index > 0) {
|
635
|
+
rb_argument = RARRAY_PTR(rb_arguments)[rb_arg_index];
|
636
|
+
}
|
626
637
|
argument = &(g_array_index(in_args, GIArgument, in_arg_index));
|
627
|
-
rb_gi_in_argument_free(
|
638
|
+
rb_gi_in_argument_free(rb_argument,
|
639
|
+
argument,
|
640
|
+
&(metadata->arg_info));
|
628
641
|
}
|
629
642
|
} else {
|
630
643
|
GIArgument *argument;
|
@@ -643,7 +656,7 @@ typedef struct {
|
|
643
656
|
GIFunctionInfo *info;
|
644
657
|
GArray *in_args;
|
645
658
|
GArray *out_args;
|
646
|
-
GIArgument
|
659
|
+
GIArgument return_value;
|
647
660
|
GError **error;
|
648
661
|
gboolean succeeded;
|
649
662
|
} InvokeData;
|
@@ -657,7 +670,7 @@ rb_gi_function_info_invoke_raw_call(InvokeData *data)
|
|
657
670
|
data->in_args->len,
|
658
671
|
(GIArgument *)((void *)(data->out_args->data)),
|
659
672
|
data->out_args->len,
|
660
|
-
data->return_value,
|
673
|
+
&(data->return_value),
|
661
674
|
data->error);
|
662
675
|
}
|
663
676
|
|
@@ -692,7 +705,7 @@ gobject_based_p(GIBaseInfo *info)
|
|
692
705
|
|
693
706
|
VALUE
|
694
707
|
rb_gi_function_info_invoke_raw(GIFunctionInfo *info, VALUE rb_options,
|
695
|
-
GIArgument *return_value)
|
708
|
+
GIArgument *return_value, VALUE *rb_return_value)
|
696
709
|
{
|
697
710
|
GICallableInfo *callable_info;
|
698
711
|
GIArgument receiver;
|
@@ -703,6 +716,7 @@ rb_gi_function_info_invoke_raw(GIFunctionInfo *info, VALUE rb_options,
|
|
703
716
|
GError *error = NULL;
|
704
717
|
gboolean unlock_gvl = FALSE;
|
705
718
|
VALUE rb_receiver, rb_arguments, rb_unlock_gvl;
|
719
|
+
gboolean rb_receiver_is_class = FALSE;
|
706
720
|
|
707
721
|
if (RB_TYPE_P(rb_options, RUBY_T_ARRAY)) {
|
708
722
|
rb_receiver = Qnil;
|
@@ -726,6 +740,12 @@ rb_gi_function_info_invoke_raw(GIFunctionInfo *info, VALUE rb_options,
|
|
726
740
|
} else {
|
727
741
|
if (gobject_based_p((GIBaseInfo *)info)) {
|
728
742
|
receiver.v_pointer = RVAL2GOBJ(rb_receiver);
|
743
|
+
} else if (RVAL2CBOOL(rb_obj_is_kind_of(rb_receiver, rb_cClass)) &&
|
744
|
+
rb_respond_to(rb_receiver, rb_intern("gtype"))) {
|
745
|
+
GObjectClass *object_class;
|
746
|
+
rb_receiver_is_class = TRUE;
|
747
|
+
object_class = g_type_class_ref(CLASS2GTYPE(rb_receiver));
|
748
|
+
receiver.v_pointer = object_class;
|
729
749
|
} else {
|
730
750
|
receiver.v_pointer = DATA_PTR(rb_receiver);
|
731
751
|
}
|
@@ -740,14 +760,13 @@ rb_gi_function_info_invoke_raw(GIFunctionInfo *info, VALUE rb_options,
|
|
740
760
|
if (receiver.v_pointer) {
|
741
761
|
g_array_append_val(in_args, receiver);
|
742
762
|
}
|
743
|
-
arguments_from_ruby(callable_info, rb_arguments,
|
763
|
+
arguments_from_ruby(callable_info, rb_receiver, rb_arguments,
|
744
764
|
in_args, out_args, args_metadata);
|
745
765
|
{
|
746
766
|
InvokeData data;
|
747
767
|
data.info = info;
|
748
768
|
data.in_args = in_args;
|
749
769
|
data.out_args = out_args;
|
750
|
-
data.return_value = return_value;
|
751
770
|
data.error = &error;
|
752
771
|
if (unlock_gvl) {
|
753
772
|
rb_thread_call_without_gvl(
|
@@ -757,6 +776,25 @@ rb_gi_function_info_invoke_raw(GIFunctionInfo *info, VALUE rb_options,
|
|
757
776
|
rb_gi_function_info_invoke_raw_call(&data);
|
758
777
|
}
|
759
778
|
succeeded = data.succeeded;
|
779
|
+
|
780
|
+
if (rb_receiver_is_class) {
|
781
|
+
g_type_class_unref(receiver.v_pointer);
|
782
|
+
}
|
783
|
+
|
784
|
+
if (return_value) {
|
785
|
+
*return_value = data.return_value;
|
786
|
+
}
|
787
|
+
if (rb_return_value) {
|
788
|
+
if (succeeded) {
|
789
|
+
*rb_return_value = GI_RETURN_ARGUMENT2RVAL(callable_info,
|
790
|
+
&(data.return_value),
|
791
|
+
in_args,
|
792
|
+
out_args,
|
793
|
+
args_metadata);
|
794
|
+
} else {
|
795
|
+
*rb_return_value = Qnil;
|
796
|
+
}
|
797
|
+
}
|
760
798
|
}
|
761
799
|
|
762
800
|
if (succeeded) {
|
@@ -764,7 +802,7 @@ rb_gi_function_info_invoke_raw(GIFunctionInfo *info, VALUE rb_options,
|
|
764
802
|
in_args, out_args,
|
765
803
|
args_metadata);
|
766
804
|
}
|
767
|
-
arguments_free(in_args, out_args, args_metadata);
|
805
|
+
arguments_free(rb_arguments, in_args, out_args, args_metadata);
|
768
806
|
if (!succeeded) {
|
769
807
|
RG_RAISE_ERROR(error);
|
770
808
|
}
|
@@ -784,8 +822,6 @@ static VALUE
|
|
784
822
|
rg_invoke(VALUE self, VALUE rb_options)
|
785
823
|
{
|
786
824
|
GIFunctionInfo *info;
|
787
|
-
GICallableInfo *callable_info;
|
788
|
-
GIArgument return_value;
|
789
825
|
VALUE rb_out_args;
|
790
826
|
VALUE rb_return_value;
|
791
827
|
|
@@ -793,14 +829,13 @@ rg_invoke(VALUE self, VALUE rb_options)
|
|
793
829
|
/* TODO: use rb_protect() */
|
794
830
|
rb_out_args = rb_gi_function_info_invoke_raw(info,
|
795
831
|
rb_options,
|
796
|
-
|
797
|
-
|
798
|
-
callable_info = (GICallableInfo *)info;
|
799
|
-
rb_return_value = GI_RETURN_ARGUMENT2RVAL(&return_value, callable_info);
|
832
|
+
NULL,
|
833
|
+
&rb_return_value);
|
800
834
|
|
801
835
|
if (NIL_P(rb_out_args)) {
|
802
836
|
return rb_return_value;
|
803
837
|
} else {
|
838
|
+
GICallableInfo *callable_info = (GICallableInfo *)info;
|
804
839
|
GITypeInfo return_value_info;
|
805
840
|
g_callable_info_load_return_type(callable_info, &return_value_info);
|
806
841
|
if (g_type_info_get_tag(&return_value_info) != GI_TYPE_TAG_VOID) {
|