gobject-introspection 4.3.5 → 4.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/gobject-introspection/rb-gi-callable-info.c +185 -1
- data/ext/gobject-introspection/rb-gi-constructor-info.c +3 -2
- data/ext/gobject-introspection/rb-gi-function-info.c +4 -177
- data/ext/gobject-introspection/rb-gi-method-info.c +4 -4
- data/ext/gobject-introspection/rb-gi-private.h +3 -2
- data/ext/gobject-introspection/rb-gi-vfunc-info.c +37 -1
- data/lib/gobject-introspection/loader.rb +25 -5
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 14cd462d3b6126aa18b9f24dd4d7b2f463d7e4bca9aba7bd8f24936235cadfcc
|
|
4
|
+
data.tar.gz: c0d6260db2ec239fed19214d15a46f48d8cdec20e0da01d4c69d3cf330df84b1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4e02b93e0319866f0c5d1635d0f1621fb1fdb6eb43fa30a6c14929ff16f1ebf65c1438babafeea8b8b688413feb976fa8b7cd0437d477988cc70aa80fb2d9759
|
|
7
|
+
data.tar.gz: 97f30ee234ae5e68397280d17346c58c1efcb6889683d509c62a6d5175008e10c42a5a4e1d78aaaaa90c29371f9a531f0a8dfe66f59862617ea246a7f5f7a78c
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (C) 2012-
|
|
3
|
+
* Copyright (C) 2012-2026 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
|
|
@@ -20,6 +20,134 @@
|
|
|
20
20
|
|
|
21
21
|
#include "rb-gi-private.h"
|
|
22
22
|
|
|
23
|
+
#ifdef HAVE_RUBY_THREAD_H
|
|
24
|
+
# include <ruby/thread.h>
|
|
25
|
+
# define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE void *
|
|
26
|
+
# define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE NULL
|
|
27
|
+
#else
|
|
28
|
+
# define rb_thread_call_without_gvl(func, func_data, ubf, ubf_data) \
|
|
29
|
+
rb_thread_blocking_region(func, func_data, ubf, ubf_data)
|
|
30
|
+
# define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE VALUE
|
|
31
|
+
# define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE Qnil
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
typedef struct {
|
|
35
|
+
GICallableInfo *info;
|
|
36
|
+
GType implementor_gtype;
|
|
37
|
+
GArray *in_args;
|
|
38
|
+
GArray *out_args;
|
|
39
|
+
GIArgument return_value;
|
|
40
|
+
GError **error;
|
|
41
|
+
gboolean succeeded;
|
|
42
|
+
} InvokeData;
|
|
43
|
+
|
|
44
|
+
static void
|
|
45
|
+
rb_gi_callable_info_invoke_raw_call(InvokeData *data)
|
|
46
|
+
{
|
|
47
|
+
GIInfoType type = g_base_info_get_type((GIBaseInfo *)(data->info));
|
|
48
|
+
if (type == GI_INFO_TYPE_VFUNC) {
|
|
49
|
+
data->succeeded =
|
|
50
|
+
g_vfunc_info_invoke((GIVFuncInfo *)(data->info),
|
|
51
|
+
data->implementor_gtype,
|
|
52
|
+
(GIArgument *)((void *)(data->in_args->data)),
|
|
53
|
+
data->in_args->len,
|
|
54
|
+
(GIArgument *)((void *)(data->out_args->data)),
|
|
55
|
+
data->out_args->len,
|
|
56
|
+
&(data->return_value),
|
|
57
|
+
data->error);
|
|
58
|
+
} else {
|
|
59
|
+
data->succeeded =
|
|
60
|
+
g_function_info_invoke((GIFunctionInfo *)(data->info),
|
|
61
|
+
(GIArgument *)((void *)(data->in_args->data)),
|
|
62
|
+
data->in_args->len,
|
|
63
|
+
(GIArgument *)((void *)(data->out_args->data)),
|
|
64
|
+
data->out_args->len,
|
|
65
|
+
&(data->return_value),
|
|
66
|
+
data->error);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE
|
|
71
|
+
rb_gi_callable_info_invoke_raw_call_without_gvl_body(void *user_data)
|
|
72
|
+
{
|
|
73
|
+
InvokeData *data = (InvokeData *)user_data;
|
|
74
|
+
|
|
75
|
+
rb_gi_callable_info_invoke_raw_call(data);
|
|
76
|
+
|
|
77
|
+
return RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
VALUE
|
|
81
|
+
rb_gi_callable_info_invoke_raw(GICallableInfo *info,
|
|
82
|
+
VALUE rb_info,
|
|
83
|
+
GType implementor_gtype,
|
|
84
|
+
VALUE rb_receiver,
|
|
85
|
+
VALUE rb_arguments,
|
|
86
|
+
GIArgument *return_value,
|
|
87
|
+
VALUE *rb_return_value)
|
|
88
|
+
{
|
|
89
|
+
RBGIArguments args;
|
|
90
|
+
VALUE rb_out_args = Qnil;
|
|
91
|
+
gboolean succeeded;
|
|
92
|
+
GError *error = NULL;
|
|
93
|
+
gboolean lock_gvl = FALSE;
|
|
94
|
+
|
|
95
|
+
lock_gvl = RVAL2CBOOL(rb_funcall(rb_info,
|
|
96
|
+
rb_intern("lock_gvl?"),
|
|
97
|
+
1,
|
|
98
|
+
rb_receiver));
|
|
99
|
+
rb_arguments = rbg_to_array(rb_arguments);
|
|
100
|
+
|
|
101
|
+
rb_gi_arguments_init(&args, info, rb_receiver, rb_arguments, NULL);
|
|
102
|
+
{
|
|
103
|
+
InvokeData data;
|
|
104
|
+
data.info = info;
|
|
105
|
+
data.implementor_gtype = implementor_gtype;
|
|
106
|
+
data.in_args = args.in_args;
|
|
107
|
+
data.out_args = args.out_args;
|
|
108
|
+
data.error = &error;
|
|
109
|
+
if (lock_gvl) {
|
|
110
|
+
rb_gi_callable_info_invoke_raw_call(&data);
|
|
111
|
+
} else {
|
|
112
|
+
rb_thread_call_without_gvl(
|
|
113
|
+
rb_gi_callable_info_invoke_raw_call_without_gvl_body, &data,
|
|
114
|
+
NULL, NULL);
|
|
115
|
+
}
|
|
116
|
+
succeeded = data.succeeded;
|
|
117
|
+
|
|
118
|
+
if (return_value) {
|
|
119
|
+
*return_value = data.return_value;
|
|
120
|
+
}
|
|
121
|
+
if (rb_return_value) {
|
|
122
|
+
if (succeeded) {
|
|
123
|
+
*rb_return_value =
|
|
124
|
+
rb_gi_arguments_convert_return_value(&args,
|
|
125
|
+
&(data.return_value));
|
|
126
|
+
} else {
|
|
127
|
+
*rb_return_value = Qnil;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (succeeded) {
|
|
133
|
+
rb_out_args = rb_gi_arguments_get_rb_out_args(&args);
|
|
134
|
+
}
|
|
135
|
+
rb_gi_arguments_clear(&args);
|
|
136
|
+
if (!succeeded) {
|
|
137
|
+
RG_RAISE_ERROR(error);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (!NIL_P(rb_out_args) && RARRAY_LEN(rb_out_args) == 1) {
|
|
141
|
+
VALUE rb_out_arg;
|
|
142
|
+
rb_out_arg = RARRAY_AREF(rb_out_args, 0);
|
|
143
|
+
if (rb_obj_is_kind_of(rb_out_arg, rb_eException)) {
|
|
144
|
+
rb_exc_raise(rb_out_arg);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return rb_out_args;
|
|
149
|
+
}
|
|
150
|
+
|
|
23
151
|
#define RG_TARGET_NAMESPACE rb_cGICallableInfo
|
|
24
152
|
#define SELF(self) RVAL2GI_CALLABLE_INFO(self)
|
|
25
153
|
|
|
@@ -35,6 +163,58 @@ gi_callable_info_get_type(void)
|
|
|
35
163
|
return type;
|
|
36
164
|
}
|
|
37
165
|
|
|
166
|
+
static VALUE
|
|
167
|
+
rg_set_lock_gvl_default(VALUE self, VALUE rb_boolean)
|
|
168
|
+
{
|
|
169
|
+
return rb_iv_set(self, "lock_gvl_default", rb_boolean);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
static VALUE
|
|
173
|
+
rg_add_lock_gvl_predicate(VALUE self)
|
|
174
|
+
{
|
|
175
|
+
VALUE rb_predicates;
|
|
176
|
+
if (!RVAL2CBOOL(rb_ivar_defined(self, rb_intern("lock_gvl_predicates")))) {
|
|
177
|
+
rb_predicates = rb_ary_new();
|
|
178
|
+
rb_iv_set(self, "lock_gvl_predicates", rb_predicates);
|
|
179
|
+
} else {
|
|
180
|
+
rb_predicates = rb_iv_get(self, "lock_gvl_predicates");
|
|
181
|
+
}
|
|
182
|
+
rb_ary_push(rb_predicates, rb_block_lambda());
|
|
183
|
+
return Qnil;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
static VALUE
|
|
187
|
+
rg_lock_gvl_p(int argc, VALUE *argv, VALUE self)
|
|
188
|
+
{
|
|
189
|
+
VALUE rb_receiver;
|
|
190
|
+
VALUE rb_lock_gvl_default = Qtrue;
|
|
191
|
+
rb_scan_args(argc, argv, "01", &rb_receiver);
|
|
192
|
+
if (RVAL2CBOOL(rb_ivar_defined(self, rb_intern("lock_gvl_default")))) {
|
|
193
|
+
rb_lock_gvl_default = rb_iv_get(self, "lock_gvl_default");
|
|
194
|
+
}
|
|
195
|
+
if (NIL_P(rb_receiver)) {
|
|
196
|
+
return rb_lock_gvl_default;
|
|
197
|
+
}
|
|
198
|
+
if (!RVAL2CBOOL(rb_ivar_defined(self, rb_intern("lock_gvl_predicates")))) {
|
|
199
|
+
return rb_lock_gvl_default;
|
|
200
|
+
}
|
|
201
|
+
VALUE rb_predicates = rb_iv_get(self, "lock_gvl_predicates");
|
|
202
|
+
long n = RARRAY_LEN(rb_predicates);
|
|
203
|
+
long i;
|
|
204
|
+
VALUE rb_args = rb_ary_new_from_args(2,
|
|
205
|
+
self,
|
|
206
|
+
rb_receiver);
|
|
207
|
+
for (i = 0; i < n; i++) {
|
|
208
|
+
VALUE rb_predicate = RARRAY_PTR(rb_predicates)[n - i - 1];
|
|
209
|
+
VALUE rb_result = rb_proc_call(rb_predicate, rb_args);
|
|
210
|
+
if (NIL_P(rb_result)) {
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
return rb_result;
|
|
214
|
+
}
|
|
215
|
+
return rb_lock_gvl_default;
|
|
216
|
+
}
|
|
217
|
+
|
|
38
218
|
static VALUE
|
|
39
219
|
rg_can_throw_gerror_p(VALUE self)
|
|
40
220
|
{
|
|
@@ -98,6 +278,10 @@ rb_gi_callable_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo)
|
|
|
98
278
|
G_DEF_CLASS_WITH_PARENT(GI_TYPE_CALLABLE_INFO, "CallableInfo", rb_mGI,
|
|
99
279
|
rb_cGIBaseInfo);
|
|
100
280
|
|
|
281
|
+
RG_DEF_METHOD(set_lock_gvl_default, 1);
|
|
282
|
+
RG_DEF_METHOD(add_lock_gvl_predicate, 0);
|
|
283
|
+
RG_DEF_METHOD_P(lock_gvl, -1);
|
|
284
|
+
|
|
101
285
|
RG_DEF_METHOD_P(can_throw_gerror, 0);
|
|
102
286
|
RG_DEF_METHOD(return_type, 0);
|
|
103
287
|
RG_DEF_METHOD(caller_owns, 0);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (C) 2012 Ruby-
|
|
3
|
+
* Copyright (C) 2012-2026 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
|
|
@@ -124,8 +124,9 @@ rg_invoke(VALUE self, VALUE rb_receiver, VALUE rb_arguments)
|
|
|
124
124
|
rb_raise(rb_eArgError, "receiver is missing");
|
|
125
125
|
}
|
|
126
126
|
/* TODO: use rb_protect */
|
|
127
|
-
|
|
127
|
+
rb_gi_callable_info_invoke_raw(info,
|
|
128
128
|
self,
|
|
129
|
+
G_TYPE_NONE,
|
|
129
130
|
Qnil,
|
|
130
131
|
rb_arguments,
|
|
131
132
|
&return_value,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (C) 2012-
|
|
3
|
+
* Copyright (C) 2012-2026 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
|
|
@@ -20,17 +20,6 @@
|
|
|
20
20
|
|
|
21
21
|
#include "rb-gi-private.h"
|
|
22
22
|
|
|
23
|
-
#ifdef HAVE_RUBY_THREAD_H
|
|
24
|
-
# include <ruby/thread.h>
|
|
25
|
-
# define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE void *
|
|
26
|
-
# define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE NULL
|
|
27
|
-
#else
|
|
28
|
-
# define rb_thread_call_without_gvl(func, func_data, ubf, ubf_data) \
|
|
29
|
-
rb_thread_blocking_region(func, func_data, ubf, ubf_data)
|
|
30
|
-
# define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE VALUE
|
|
31
|
-
# define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE Qnil
|
|
32
|
-
#endif
|
|
33
|
-
|
|
34
23
|
#define RG_TARGET_NAMESPACE rb_cGIFunctionInfo
|
|
35
24
|
#define SELF(self) RVAL2GI_FUNCTION_INFO(self)
|
|
36
25
|
|
|
@@ -48,58 +37,6 @@ gi_function_info_get_type(void)
|
|
|
48
37
|
return type;
|
|
49
38
|
}
|
|
50
39
|
|
|
51
|
-
static VALUE
|
|
52
|
-
rg_set_lock_gvl_default(VALUE self, VALUE rb_boolean)
|
|
53
|
-
{
|
|
54
|
-
return rb_iv_set(self, "lock_gvl_default", rb_boolean);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
static VALUE
|
|
58
|
-
rg_add_lock_gvl_predicate(VALUE self)
|
|
59
|
-
{
|
|
60
|
-
VALUE rb_predicates;
|
|
61
|
-
if (!RVAL2CBOOL(rb_ivar_defined(self, rb_intern("lock_gvl_predicates")))) {
|
|
62
|
-
rb_predicates = rb_ary_new();
|
|
63
|
-
rb_iv_set(self, "lock_gvl_predicates", rb_predicates);
|
|
64
|
-
} else {
|
|
65
|
-
rb_predicates = rb_iv_get(self, "lock_gvl_predicates");
|
|
66
|
-
}
|
|
67
|
-
rb_ary_push(rb_predicates, rb_block_lambda());
|
|
68
|
-
return Qnil;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
static VALUE
|
|
72
|
-
rg_lock_gvl_p(int argc, VALUE *argv, VALUE self)
|
|
73
|
-
{
|
|
74
|
-
VALUE rb_receiver;
|
|
75
|
-
VALUE rb_lock_gvl_default = Qtrue;
|
|
76
|
-
rb_scan_args(argc, argv, "01", &rb_receiver);
|
|
77
|
-
if (RVAL2CBOOL(rb_ivar_defined(self, rb_intern("lock_gvl_default")))) {
|
|
78
|
-
rb_lock_gvl_default = rb_iv_get(self, "lock_gvl_default");
|
|
79
|
-
}
|
|
80
|
-
if (NIL_P(rb_receiver)) {
|
|
81
|
-
return rb_lock_gvl_default;
|
|
82
|
-
}
|
|
83
|
-
if (!RVAL2CBOOL(rb_ivar_defined(self, rb_intern("lock_gvl_predicates")))) {
|
|
84
|
-
return rb_lock_gvl_default;
|
|
85
|
-
}
|
|
86
|
-
VALUE rb_predicates = rb_iv_get(self, "lock_gvl_predicates");
|
|
87
|
-
long n = RARRAY_LEN(rb_predicates);
|
|
88
|
-
long i;
|
|
89
|
-
VALUE rb_args = rb_ary_new_from_args(2,
|
|
90
|
-
self,
|
|
91
|
-
rb_receiver);
|
|
92
|
-
for (i = 0; i < n; i++) {
|
|
93
|
-
VALUE rb_predicate = RARRAY_PTR(rb_predicates)[n - i - 1];
|
|
94
|
-
VALUE rb_result = rb_proc_call(rb_predicate, rb_args);
|
|
95
|
-
if (NIL_P(rb_result)) {
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
return rb_result;
|
|
99
|
-
}
|
|
100
|
-
return rb_lock_gvl_default;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
40
|
static VALUE
|
|
104
41
|
rg_symbol(VALUE self)
|
|
105
42
|
{
|
|
@@ -136,113 +73,6 @@ rg_vfunc(VALUE self)
|
|
|
136
73
|
return GI_BASE_INFO2RVAL(g_function_info_get_vfunc(info));
|
|
137
74
|
}
|
|
138
75
|
|
|
139
|
-
typedef struct {
|
|
140
|
-
GIFunctionInfo *info;
|
|
141
|
-
GArray *in_args;
|
|
142
|
-
GArray *out_args;
|
|
143
|
-
GIArgument return_value;
|
|
144
|
-
GError **error;
|
|
145
|
-
gboolean succeeded;
|
|
146
|
-
} InvokeData;
|
|
147
|
-
|
|
148
|
-
static void
|
|
149
|
-
rb_gi_function_info_invoke_raw_call(InvokeData *data)
|
|
150
|
-
{
|
|
151
|
-
data->succeeded =
|
|
152
|
-
g_function_info_invoke(data->info,
|
|
153
|
-
(GIArgument *)((void *)(data->in_args->data)),
|
|
154
|
-
data->in_args->len,
|
|
155
|
-
(GIArgument *)((void *)(data->out_args->data)),
|
|
156
|
-
data->out_args->len,
|
|
157
|
-
&(data->return_value),
|
|
158
|
-
data->error);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
static RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE
|
|
162
|
-
rb_gi_function_info_invoke_raw_call_without_gvl_body(void *user_data)
|
|
163
|
-
{
|
|
164
|
-
InvokeData *data = (InvokeData *)user_data;
|
|
165
|
-
|
|
166
|
-
rb_gi_function_info_invoke_raw_call(data);
|
|
167
|
-
|
|
168
|
-
return RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
VALUE
|
|
172
|
-
rb_gi_function_info_invoke_raw(GIFunctionInfo *info,
|
|
173
|
-
VALUE rb_info,
|
|
174
|
-
VALUE rb_receiver,
|
|
175
|
-
VALUE rb_arguments,
|
|
176
|
-
GIArgument *return_value,
|
|
177
|
-
VALUE *rb_return_value)
|
|
178
|
-
{
|
|
179
|
-
GICallableInfo *callable_info;
|
|
180
|
-
RBGIArguments args;
|
|
181
|
-
VALUE rb_out_args = Qnil;
|
|
182
|
-
gboolean succeeded;
|
|
183
|
-
GError *error = NULL;
|
|
184
|
-
gboolean lock_gvl = FALSE;
|
|
185
|
-
|
|
186
|
-
lock_gvl = RVAL2CBOOL(rb_funcall(rb_info,
|
|
187
|
-
rb_intern("lock_gvl?"),
|
|
188
|
-
1,
|
|
189
|
-
rb_receiver));
|
|
190
|
-
rb_arguments = rbg_to_array(rb_arguments);
|
|
191
|
-
|
|
192
|
-
callable_info = (GICallableInfo *)info;
|
|
193
|
-
rb_gi_arguments_init(&args,
|
|
194
|
-
callable_info,
|
|
195
|
-
rb_receiver,
|
|
196
|
-
rb_arguments,
|
|
197
|
-
NULL);
|
|
198
|
-
{
|
|
199
|
-
InvokeData data;
|
|
200
|
-
data.info = info;
|
|
201
|
-
data.in_args = args.in_args;
|
|
202
|
-
data.out_args = args.out_args;
|
|
203
|
-
data.error = &error;
|
|
204
|
-
if (lock_gvl) {
|
|
205
|
-
rb_gi_function_info_invoke_raw_call(&data);
|
|
206
|
-
} else {
|
|
207
|
-
rb_thread_call_without_gvl(
|
|
208
|
-
rb_gi_function_info_invoke_raw_call_without_gvl_body, &data,
|
|
209
|
-
NULL, NULL);
|
|
210
|
-
}
|
|
211
|
-
succeeded = data.succeeded;
|
|
212
|
-
|
|
213
|
-
if (return_value) {
|
|
214
|
-
*return_value = data.return_value;
|
|
215
|
-
}
|
|
216
|
-
if (rb_return_value) {
|
|
217
|
-
if (succeeded) {
|
|
218
|
-
*rb_return_value =
|
|
219
|
-
rb_gi_arguments_convert_return_value(&args,
|
|
220
|
-
&(data.return_value));
|
|
221
|
-
} else {
|
|
222
|
-
*rb_return_value = Qnil;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (succeeded) {
|
|
228
|
-
rb_out_args = rb_gi_arguments_get_rb_out_args(&args);
|
|
229
|
-
}
|
|
230
|
-
rb_gi_arguments_clear(&args);
|
|
231
|
-
if (!succeeded) {
|
|
232
|
-
RG_RAISE_ERROR(error);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (!NIL_P(rb_out_args) && RARRAY_LEN(rb_out_args) == 1) {
|
|
236
|
-
VALUE rb_out_arg;
|
|
237
|
-
rb_out_arg = RARRAY_AREF(rb_out_args, 0);
|
|
238
|
-
if (rb_obj_is_kind_of(rb_out_arg, rb_eException)) {
|
|
239
|
-
rb_exc_raise(rb_out_arg);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return rb_out_args;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
76
|
static VALUE
|
|
247
77
|
rg_invoke(VALUE self, VALUE rb_arguments)
|
|
248
78
|
{
|
|
@@ -251,9 +81,11 @@ rg_invoke(VALUE self, VALUE rb_arguments)
|
|
|
251
81
|
VALUE rb_return_value;
|
|
252
82
|
|
|
253
83
|
info = SELF(self);
|
|
84
|
+
GICallableInfo *callable_info = (GICallableInfo *)info;
|
|
254
85
|
/* TODO: use rb_protect() */
|
|
255
|
-
rb_out_args =
|
|
86
|
+
rb_out_args = rb_gi_callable_info_invoke_raw(callable_info,
|
|
256
87
|
self,
|
|
88
|
+
G_TYPE_NONE,
|
|
257
89
|
Qnil,
|
|
258
90
|
rb_arguments,
|
|
259
91
|
NULL,
|
|
@@ -262,7 +94,6 @@ rg_invoke(VALUE self, VALUE rb_arguments)
|
|
|
262
94
|
if (NIL_P(rb_out_args)) {
|
|
263
95
|
return rb_return_value;
|
|
264
96
|
} else {
|
|
265
|
-
GICallableInfo *callable_info = (GICallableInfo *)info;
|
|
266
97
|
GITypeInfo return_value_info;
|
|
267
98
|
g_callable_info_load_return_type(callable_info, &return_value_info);
|
|
268
99
|
if (g_type_info_get_tag(&return_value_info) != GI_TYPE_TAG_VOID) {
|
|
@@ -283,10 +114,6 @@ rb_gi_function_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo)
|
|
|
283
114
|
G_DEF_CLASS_WITH_PARENT(GI_TYPE_FUNCTION_INFO, "FunctionInfo", rb_mGI,
|
|
284
115
|
rb_cGICallableInfo);
|
|
285
116
|
|
|
286
|
-
RG_DEF_METHOD(set_lock_gvl_default, 1);
|
|
287
|
-
RG_DEF_METHOD(add_lock_gvl_predicate, 0);
|
|
288
|
-
RG_DEF_METHOD_P(lock_gvl, -1);
|
|
289
|
-
|
|
290
117
|
RG_DEF_METHOD(symbol, 0);
|
|
291
118
|
RG_DEF_METHOD(flags, 0);
|
|
292
119
|
RG_DEF_METHOD(property, 0);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (C) 2012-
|
|
3
|
+
* Copyright (C) 2012-2026 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
|
|
@@ -43,10 +43,11 @@ rg_invoke(VALUE self, VALUE rb_receiver, VALUE rb_arguments)
|
|
|
43
43
|
VALUE rb_return_value;
|
|
44
44
|
|
|
45
45
|
info = SELF(self);
|
|
46
|
-
|
|
46
|
+
GICallableInfo *callable_info = (GICallableInfo *)info;
|
|
47
47
|
/* TODO: use rb_protect */
|
|
48
|
-
rb_out_args =
|
|
48
|
+
rb_out_args = rb_gi_callable_info_invoke_raw(callable_info,
|
|
49
49
|
self,
|
|
50
|
+
G_TYPE_NONE,
|
|
50
51
|
rb_receiver,
|
|
51
52
|
rb_arguments,
|
|
52
53
|
NULL,
|
|
@@ -55,7 +56,6 @@ rg_invoke(VALUE self, VALUE rb_receiver, VALUE rb_arguments)
|
|
|
55
56
|
if (NIL_P(rb_out_args)) {
|
|
56
57
|
return rb_return_value;
|
|
57
58
|
} else {
|
|
58
|
-
GICallableInfo *callable_info = (GICallableInfo *)info;
|
|
59
59
|
GITypeInfo return_value_info;
|
|
60
60
|
g_callable_info_load_return_type(callable_info, &return_value_info);
|
|
61
61
|
if (g_type_info_get_tag(&return_value_info) != GI_TYPE_TAG_VOID) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (C) 2012-
|
|
3
|
+
* Copyright (C) 2012-2026 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
|
|
@@ -108,8 +108,9 @@ void rb_gi_unresolved_info_init (VALUE rb_mGI,
|
|
|
108
108
|
void rb_gi_repository_init (VALUE rb_mGI);
|
|
109
109
|
void rb_gi_loader_init (VALUE rb_mGI);
|
|
110
110
|
|
|
111
|
-
VALUE
|
|
111
|
+
VALUE rb_gi_callable_info_invoke_raw (GICallableInfo *info,
|
|
112
112
|
VALUE rb_info,
|
|
113
|
+
GType implementor_gtype,
|
|
113
114
|
VALUE rb_receiver,
|
|
114
115
|
VALUE rb_arguments,
|
|
115
116
|
GIArgument *return_value,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (C) 2012-
|
|
3
|
+
* Copyright (C) 2012-2026 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
|
|
@@ -71,6 +71,41 @@ rg_invoker(VALUE self)
|
|
|
71
71
|
return GI_BASE_INFO2RVAL_WITH_UNREF(g_vfunc_info_get_invoker(info));
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
static VALUE
|
|
75
|
+
rg_invoke(VALUE self,
|
|
76
|
+
VALUE rb_implementor_gtype,
|
|
77
|
+
VALUE rb_receiver,
|
|
78
|
+
VALUE rb_arguments)
|
|
79
|
+
{
|
|
80
|
+
GIVFuncInfo *info = SELF(self);
|
|
81
|
+
GICallableInfo *callable_info = (GICallableInfo *)info;
|
|
82
|
+
GType implementor_gtype = rbgobj_gtype_from_ruby(rb_implementor_gtype);
|
|
83
|
+
VALUE rb_return_value;
|
|
84
|
+
/* TODO: use rb_protect */
|
|
85
|
+
VALUE rb_out_args = rb_gi_callable_info_invoke_raw(info,
|
|
86
|
+
self,
|
|
87
|
+
implementor_gtype,
|
|
88
|
+
rb_receiver,
|
|
89
|
+
rb_arguments,
|
|
90
|
+
NULL,
|
|
91
|
+
&rb_return_value);
|
|
92
|
+
|
|
93
|
+
if (NIL_P(rb_out_args)) {
|
|
94
|
+
return rb_return_value;
|
|
95
|
+
} else {
|
|
96
|
+
GITypeInfo return_value_info;
|
|
97
|
+
g_callable_info_load_return_type(callable_info, &return_value_info);
|
|
98
|
+
if (g_type_info_get_tag(&return_value_info) != GI_TYPE_TAG_VOID) {
|
|
99
|
+
rb_ary_unshift(rb_out_args, rb_return_value);
|
|
100
|
+
}
|
|
101
|
+
if (RARRAY_LEN(rb_out_args) == 1) {
|
|
102
|
+
return RARRAY_PTR(rb_out_args)[0];
|
|
103
|
+
} else {
|
|
104
|
+
return rb_out_args;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
74
109
|
void
|
|
75
110
|
rb_gi_vfunc_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo)
|
|
76
111
|
{
|
|
@@ -86,6 +121,7 @@ rb_gi_vfunc_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo)
|
|
|
86
121
|
RG_DEF_METHOD(offset, 0);
|
|
87
122
|
RG_DEF_METHOD(signal, 0);
|
|
88
123
|
RG_DEF_METHOD(invoker, 0);
|
|
124
|
+
RG_DEF_METHOD(invoke, 3);
|
|
89
125
|
|
|
90
126
|
G_DEF_CLASS(G_TYPE_IV_FUNC_INFO_FLAGS, "VFuncInfoFlags", rb_mGI);
|
|
91
127
|
}
|
|
@@ -363,7 +363,7 @@ module GObjectIntrospection
|
|
|
363
363
|
invokers = INITIALIZE_INVOKERS
|
|
364
364
|
invokers.values.each do |invoker|
|
|
365
365
|
catch do |tag|
|
|
366
|
-
invoker.invoke(self, arguments.dup, block, tag)
|
|
366
|
+
invoker.invoke(self, arguments.dup, block, abort_tag: tag)
|
|
367
367
|
LOADER_CLASS.initialize_instance_post(self)
|
|
368
368
|
return
|
|
369
369
|
end
|
|
@@ -687,10 +687,12 @@ module GObjectIntrospection
|
|
|
687
687
|
ensure_prepared if defined?(Ractor)
|
|
688
688
|
end
|
|
689
689
|
|
|
690
|
-
def invoke(receiver, arguments, block,
|
|
690
|
+
def invoke(receiver, arguments, block,
|
|
691
|
+
abort_tag: nil,
|
|
692
|
+
implementor_gtype: nil)
|
|
691
693
|
ensure_prepared
|
|
692
694
|
|
|
693
|
-
if receiver and @
|
|
695
|
+
if receiver and @info.class == FunctionInfo
|
|
694
696
|
arguments.unshift(receiver)
|
|
695
697
|
end
|
|
696
698
|
|
|
@@ -709,7 +711,12 @@ module GObjectIntrospection
|
|
|
709
711
|
if block.nil? and @require_callback_p
|
|
710
712
|
receiver.to_enum(@method_name, *arguments)
|
|
711
713
|
else
|
|
712
|
-
if @
|
|
714
|
+
if @info.class == VFuncInfo
|
|
715
|
+
return_value = @info.invoke(implementor_gtype,
|
|
716
|
+
receiver,
|
|
717
|
+
arguments,
|
|
718
|
+
&block)
|
|
719
|
+
elsif @info.class == FunctionInfo
|
|
713
720
|
return_value = @info.invoke(arguments, &block)
|
|
714
721
|
else
|
|
715
722
|
return_value = @info.invoke(receiver, arguments, &block)
|
|
@@ -753,7 +760,6 @@ module GObjectIntrospection
|
|
|
753
760
|
@in_arg_nil_indexes << i if may_be_null
|
|
754
761
|
end
|
|
755
762
|
|
|
756
|
-
@function_info_p = (@info.class == FunctionInfo)
|
|
757
763
|
@have_return_value_p = @info.have_return_value?
|
|
758
764
|
@require_callback_p = @info.require_callback?
|
|
759
765
|
|
|
@@ -847,6 +853,20 @@ module GObjectIntrospection
|
|
|
847
853
|
vtable_gtype = container.gtype
|
|
848
854
|
if container.respond_to?(:class_struct)
|
|
849
855
|
struct = container.class_struct
|
|
856
|
+
# This is for "super" in "virtual_do_XXX".
|
|
857
|
+
parent_gtype = implementor_gtype.parent
|
|
858
|
+
parent_class = parent_gtype.to_class
|
|
859
|
+
invoker = Invoker.new(info, name, "#{parent_class.name}\##{name}")
|
|
860
|
+
parent_vfunc_callable = Module.new
|
|
861
|
+
parent_vfunc_callable.define_method(name) do |*args, &block|
|
|
862
|
+
invoker.invoke(self, args, block, implementor_gtype: parent_gtype)
|
|
863
|
+
end
|
|
864
|
+
# If we use implementor_gtype.class.include here,
|
|
865
|
+
# GLib::Instantiatable.include calls this method
|
|
866
|
+
# recursively. We don't need to call any hook for this
|
|
867
|
+
# method. So we use the original Module.include here.
|
|
868
|
+
Module.method(:include).unbind.bind_call(implementor_gtype.to_class,
|
|
869
|
+
parent_vfunc_callable)
|
|
850
870
|
else
|
|
851
871
|
return false unless implementor_gtype.type_is_a?(vtable_gtype)
|
|
852
872
|
struct = container.iface_struct
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gobject-introspection
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.3.
|
|
4
|
+
version: 4.3.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Ruby-GNOME Project Team
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 4.3.
|
|
18
|
+
version: 4.3.6
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 4.3.
|
|
25
|
+
version: 4.3.6
|
|
26
26
|
description: Ruby/GObjectIntrospection provides bindings of GObject Introspection
|
|
27
27
|
and a loader module that can generate dynamically Ruby bindings of any GObject C
|
|
28
28
|
libraries
|
|
@@ -157,7 +157,7 @@ requirements:
|
|
|
157
157
|
- 'system: gobject-introspection-1.0: macports: gobject-introspection'
|
|
158
158
|
- 'system: gobject-introspection-1.0: msys2: gobject-introspection'
|
|
159
159
|
- 'system: gobject-introspection-1.0: rhel: pkgconfig(gobject-introspection-1.0)'
|
|
160
|
-
rubygems_version: 4.0.
|
|
160
|
+
rubygems_version: 4.0.6
|
|
161
161
|
specification_version: 4
|
|
162
162
|
summary: Ruby/GObjectIntrospection is a Ruby binding of GObject Introspection.
|
|
163
163
|
test_files: []
|