gobject-introspection 3.4.6 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/gobject-introspection/rb-gi-arg-info.c +44 -1
- data/ext/gobject-introspection/rb-gi-arguments-in.c +23 -20
- data/ext/gobject-introspection/rb-gi-arguments-out.c +17 -17
- data/ext/gobject-introspection/rb-gi-arguments.c +2013 -130
- data/ext/gobject-introspection/rb-gi-callback.c +8 -2
- data/ext/gobject-introspection/rb-gi-constant-info.c +14 -10
- data/ext/gobject-introspection/rb-gi-conversions.h +1 -23
- data/ext/gobject-introspection/rb-gi-field-info.c +77 -76
- data/ext/gobject-introspection/rb-gi-function-info.c +57 -16
- data/ext/gobject-introspection/rb-gi-loader.c +2 -2
- data/ext/gobject-introspection/rb-gi-private-arg-info.h +3 -1
- data/ext/gobject-introspection/rb-gi-private-arguments.h +19 -3
- data/ext/gobject-introspection/rb-gi-private.h +6 -3
- data/ext/gobject-introspection/rb-gobject-introspection.c +5 -225
- data/lib/gobject-introspection/function-info.rb +2 -2
- data/lib/gobject-introspection/loader.rb +144 -73
- data/lib/gobject-introspection/type-tag.rb +115 -123
- data/test/test-loader.rb +14 -0
- metadata +5 -6
- data/ext/gobject-introspection/rb-gi-argument.c +0 -2051
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2012-
|
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
|
@@ -44,7 +44,7 @@ static VALUE
|
|
44
44
|
rb_gi_callback_invoke_without_protect(VALUE user_data)
|
45
45
|
{
|
46
46
|
RBGICallbackInvokeData *data = (RBGICallbackInvokeData *)user_data;
|
47
|
-
VALUE rb_args =
|
47
|
+
VALUE rb_args = rb_gi_arguments_get_rb_in_args(data->args);
|
48
48
|
|
49
49
|
if (data->callback->method_name) {
|
50
50
|
ID id___send__;
|
@@ -91,6 +91,9 @@ rb_gi_callback_invoke(VALUE user_data)
|
|
91
91
|
&state);
|
92
92
|
if (state != 0) {
|
93
93
|
VALUE error = rb_errinfo();
|
94
|
+
if (!g_callable_info_can_throw_gerror(data->args->info)) {
|
95
|
+
rbgutil_on_callback_error(error);
|
96
|
+
}
|
94
97
|
rb_gi_arguments_fill_raw_out_gerror(data->args, error);
|
95
98
|
rb_protect(rb_gi_callback_invoke_fill_raw_results,
|
96
99
|
user_data,
|
@@ -101,6 +104,9 @@ rb_gi_callback_invoke(VALUE user_data)
|
|
101
104
|
&state);
|
102
105
|
if (state != 0) {
|
103
106
|
VALUE error = rb_errinfo();
|
107
|
+
if (!g_callable_info_can_throw_gerror(data->args->info)) {
|
108
|
+
rbgutil_on_callback_error(error);
|
109
|
+
}
|
104
110
|
rb_gi_arguments_fill_raw_out_gerror(data->args, error);
|
105
111
|
}
|
106
112
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2012-
|
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
|
@@ -47,17 +47,21 @@ rg_type(VALUE self)
|
|
47
47
|
static VALUE
|
48
48
|
rg_value(VALUE self)
|
49
49
|
{
|
50
|
-
GIConstantInfo *info;
|
50
|
+
GIConstantInfo *info = SELF(self);
|
51
51
|
GIArgument value;
|
52
|
-
G_GNUC_UNUSED gint value_size;
|
53
|
-
GITypeInfo *type_info;
|
54
|
-
VALUE rb_value;
|
52
|
+
G_GNUC_UNUSED gint value_size = g_constant_info_get_value(info, &value);
|
55
53
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
54
|
+
RBGIArguments args;
|
55
|
+
rb_gi_arguments_init(&args, NULL, Qnil, Qnil, NULL);
|
56
|
+
RBGIArgMetadata value_metadata;
|
57
|
+
rb_gi_arg_metadata_init_type_info(&value_metadata,
|
58
|
+
g_constant_info_get_type(info));
|
59
|
+
VALUE rb_value = rb_gi_arguments_convert_arg(&args,
|
60
|
+
&value,
|
61
|
+
&value_metadata,
|
62
|
+
FALSE);
|
63
|
+
rb_gi_arg_metadata_clear(&value_metadata);
|
64
|
+
rb_gi_arguments_clear(&args);
|
61
65
|
g_constant_info_free_value(info, &value);
|
62
66
|
|
63
67
|
return rb_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-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
|
@@ -30,16 +30,6 @@
|
|
30
30
|
(rb_gi_base_info_to_ruby_with_unref((GIBaseInfo *)(info)))
|
31
31
|
#define RVAL2GI_BASE_INFO(rb_object) (rb_gi_base_info_from_ruby(rb_object))
|
32
32
|
|
33
|
-
#define GI_ARGUMENT2RVAL(argument, duplicate, type_info, \
|
34
|
-
in_args, out_args, args_metadata) \
|
35
|
-
(rb_gi_argument_to_ruby((argument), (duplicate), (type_info), \
|
36
|
-
(in_args), (out_args), (args_metadata)))
|
37
|
-
#define GI_RETURN_ARGUMENT2RVAL(callable_info, argument, \
|
38
|
-
in_args, out_args, args_metadata) \
|
39
|
-
(rb_gi_return_argument_to_ruby((callable_info), (argument), \
|
40
|
-
(in_args), (out_args), (args_metadata)))
|
41
|
-
|
42
|
-
|
43
33
|
#define RVAL2GI_REGISTERED_TYPE_INFO(rb_object) \
|
44
34
|
((GIRegisteredTypeInfo *)RVAL2GI_BASE_INFO(rb_object))
|
45
35
|
#define RVAL2GI_FUNCTION_INFO(rb_object) \
|
@@ -90,16 +80,4 @@ VALUE rb_gi_base_info_to_ruby (GIBaseInfo *info);
|
|
90
80
|
VALUE rb_gi_base_info_to_ruby_with_unref(GIBaseInfo *info);
|
91
81
|
GIBaseInfo *rb_gi_base_info_from_ruby (VALUE rb_info);
|
92
82
|
|
93
|
-
VALUE rb_gi_argument_to_ruby (GIArgument *argument,
|
94
|
-
gboolean duplicate,
|
95
|
-
GITypeInfo *type_info,
|
96
|
-
GArray *in_args,
|
97
|
-
GArray *out_args,
|
98
|
-
GPtrArray *args_metadata);
|
99
|
-
VALUE rb_gi_return_argument_to_ruby (GICallableInfo *callable_info,
|
100
|
-
GIArgument *argument,
|
101
|
-
GArray *in_args,
|
102
|
-
GArray *out_args,
|
103
|
-
GPtrArray *args_metadata);
|
104
|
-
|
105
83
|
VALUE rb_gi_array_type_to_ruby (GIArrayType type);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2012-
|
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
|
@@ -71,66 +71,58 @@ rg_type(VALUE self)
|
|
71
71
|
return GI_BASE_INFO2RVAL_WITH_UNREF(g_field_info_get_type(info));
|
72
72
|
}
|
73
73
|
|
74
|
+
typedef struct {
|
75
|
+
RBGIArguments args;
|
76
|
+
GIArgument value;
|
77
|
+
RBGIArgMetadata metadata;
|
78
|
+
GIFieldInfo *info;
|
79
|
+
gpointer memory;
|
80
|
+
} FieldToRubyData;
|
81
|
+
|
74
82
|
static VALUE
|
75
|
-
|
76
|
-
gpointer memory,
|
77
|
-
GITypeInfo *type_info)
|
83
|
+
rb_gi_field_info_get_field_raw_body_interface(FieldToRubyData *data)
|
78
84
|
{
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
gint offset;
|
84
|
-
|
85
|
-
interface_info = g_type_info_get_interface(type_info);
|
86
|
-
interface_type = g_base_info_get_type(interface_info);
|
87
|
-
gtype = g_registered_type_info_get_g_type(interface_info);
|
88
|
-
offset = g_field_info_get_offset(info);
|
89
|
-
switch (interface_type) {
|
85
|
+
GIInfoType type = data->metadata.type.interface_type;
|
86
|
+
GType gtype = data->metadata.type.interface_gtype;
|
87
|
+
gint offset = g_field_info_get_offset(data->info);
|
88
|
+
switch (type) {
|
90
89
|
case GI_INFO_TYPE_INVALID:
|
91
90
|
case GI_INFO_TYPE_FUNCTION:
|
92
91
|
case GI_INFO_TYPE_CALLBACK:
|
93
92
|
rb_raise(rb_eNotImpError,
|
94
93
|
"TODO: GIField(interface)[%s](%s)",
|
95
|
-
g_info_type_to_string(
|
94
|
+
g_info_type_to_string(type),
|
96
95
|
g_type_name(gtype));
|
97
|
-
|
96
|
+
return Qnil;
|
98
97
|
case GI_INFO_TYPE_STRUCT:
|
99
98
|
{
|
100
|
-
GIStructInfo *struct_info =
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
target = (gpointer)((guint8 *)memory + offset);
|
99
|
+
GIStructInfo *struct_info =
|
100
|
+
(GIStructInfo *)(data->metadata.type.interface_info);
|
101
|
+
gboolean is_pointer =
|
102
|
+
g_type_info_is_pointer(data->metadata.type.info);
|
103
|
+
gpointer target = (gpointer)((guint8 *)(data->memory) + offset);
|
106
104
|
if (is_pointer) {
|
107
105
|
target = *((gpointer *)target);
|
108
106
|
}
|
109
|
-
|
110
|
-
target,
|
111
|
-
is_pointer);
|
112
|
-
break;
|
107
|
+
return rb_gi_struct_info_to_ruby(struct_info, target, is_pointer);
|
113
108
|
}
|
114
109
|
case GI_INFO_TYPE_BOXED:
|
115
110
|
case GI_INFO_TYPE_UNION:
|
116
111
|
case GI_INFO_TYPE_OBJECT:
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
NULL, NULL, NULL);
|
123
|
-
}
|
124
|
-
break;
|
112
|
+
data->value.v_pointer = G_STRUCT_MEMBER(gpointer, data->memory, offset);
|
113
|
+
return rb_gi_arguments_convert_arg(&(data->args),
|
114
|
+
&(data->value),
|
115
|
+
&(data->metadata),
|
116
|
+
FALSE);
|
125
117
|
case GI_INFO_TYPE_ENUM:
|
126
118
|
{
|
127
119
|
gint32 raw_value;
|
128
120
|
|
129
|
-
raw_value = G_STRUCT_MEMBER(gint32, memory, offset);
|
121
|
+
raw_value = G_STRUCT_MEMBER(gint32, data->memory, offset);
|
130
122
|
if (gtype == G_TYPE_NONE) {
|
131
|
-
|
123
|
+
return INT2NUM(raw_value);
|
132
124
|
} else {
|
133
|
-
|
125
|
+
return GENUM2RVAL(raw_value, gtype);
|
134
126
|
}
|
135
127
|
}
|
136
128
|
break;
|
@@ -138,11 +130,11 @@ rb_gi_field_info_get_field_raw_interface(GIFieldInfo *info,
|
|
138
130
|
{
|
139
131
|
gint32 raw_value;
|
140
132
|
|
141
|
-
raw_value = G_STRUCT_MEMBER(gint32, memory, offset);
|
133
|
+
raw_value = G_STRUCT_MEMBER(gint32, data->memory, offset);
|
142
134
|
if (gtype == G_TYPE_NONE) {
|
143
|
-
|
135
|
+
return INT2NUM(raw_value);
|
144
136
|
} else {
|
145
|
-
|
137
|
+
return GFLAGS2RVAL(raw_value, gtype);
|
146
138
|
}
|
147
139
|
}
|
148
140
|
break;
|
@@ -157,32 +149,21 @@ rb_gi_field_info_get_field_raw_interface(GIFieldInfo *info,
|
|
157
149
|
case GI_INFO_TYPE_ARG:
|
158
150
|
case GI_INFO_TYPE_TYPE:
|
159
151
|
case GI_INFO_TYPE_UNRESOLVED:
|
152
|
+
default:
|
160
153
|
rb_raise(rb_eNotImpError,
|
161
154
|
"TODO: GIField(interface)[%s](%s)",
|
162
|
-
g_info_type_to_string(
|
155
|
+
g_info_type_to_string(type),
|
163
156
|
g_type_name(gtype));
|
164
|
-
|
165
|
-
default:
|
166
|
-
break;
|
157
|
+
return Qnil;
|
167
158
|
}
|
168
|
-
g_base_info_unref(interface_info);
|
169
|
-
|
170
|
-
return rb_field_value;
|
171
159
|
}
|
172
160
|
|
173
|
-
VALUE
|
174
|
-
|
161
|
+
static VALUE
|
162
|
+
rb_gi_field_info_get_field_raw_body(VALUE user_data)
|
175
163
|
{
|
176
|
-
|
164
|
+
FieldToRubyData *data = (FieldToRubyData *)user_data;
|
177
165
|
gboolean processed = FALSE;
|
178
|
-
|
179
|
-
GITypeTag type_tag;
|
180
|
-
VALUE rb_field_value = Qnil;
|
181
|
-
|
182
|
-
type_info = g_field_info_get_type(info);
|
183
|
-
type_tag = g_type_info_get_tag(type_info);
|
184
|
-
|
185
|
-
switch (type_tag) {
|
166
|
+
switch (data->metadata.type.tag) {
|
186
167
|
case GI_TYPE_TAG_VOID:
|
187
168
|
case GI_TYPE_TAG_BOOLEAN:
|
188
169
|
case GI_TYPE_TAG_INT8:
|
@@ -200,8 +181,9 @@ rb_gi_field_info_get_field_raw(GIFieldInfo *info, gpointer memory)
|
|
200
181
|
case GI_TYPE_TAG_UTF8:
|
201
182
|
{
|
202
183
|
int offset;
|
203
|
-
offset = g_field_info_get_offset(info);
|
204
|
-
|
184
|
+
offset = g_field_info_get_offset(data->info);
|
185
|
+
data->value.v_string =
|
186
|
+
G_STRUCT_MEMBER(gchar *, data->memory, offset);
|
205
187
|
processed = TRUE;
|
206
188
|
}
|
207
189
|
break;
|
@@ -209,13 +191,11 @@ rb_gi_field_info_get_field_raw(GIFieldInfo *info, gpointer memory)
|
|
209
191
|
case GI_TYPE_TAG_ARRAY:
|
210
192
|
break;
|
211
193
|
case GI_TYPE_TAG_INTERFACE:
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
g_base_info_unref(type_info);
|
218
|
-
return rb_field_value;
|
194
|
+
{
|
195
|
+
VALUE rb_value = rb_gi_field_info_get_field_raw_body_interface(data);
|
196
|
+
if (!NIL_P(rb_value)) {
|
197
|
+
return rb_value;
|
198
|
+
}
|
219
199
|
}
|
220
200
|
break;
|
221
201
|
case GI_TYPE_TAG_GLIST:
|
@@ -229,19 +209,40 @@ rb_gi_field_info_get_field_raw(GIFieldInfo *info, gpointer memory)
|
|
229
209
|
}
|
230
210
|
|
231
211
|
if (!processed) {
|
232
|
-
if (!g_field_info_get_field(info, memory, &
|
233
|
-
g_base_info_unref(type_info);
|
212
|
+
if (!g_field_info_get_field(data->info, data->memory, &(data->value))) {
|
234
213
|
rb_raise(rb_eArgError, "failed to get field value: %s[%s]",
|
235
|
-
g_base_info_get_name(info),
|
236
|
-
g_type_tag_to_string(
|
214
|
+
g_base_info_get_name(data->info),
|
215
|
+
g_type_tag_to_string(data->metadata.type.tag));
|
237
216
|
}
|
238
217
|
}
|
239
218
|
|
240
|
-
|
241
|
-
|
242
|
-
|
219
|
+
return rb_gi_arguments_convert_arg(&(data->args),
|
220
|
+
&(data->value),
|
221
|
+
&(data->metadata),
|
222
|
+
FALSE);
|
223
|
+
}
|
243
224
|
|
244
|
-
|
225
|
+
static VALUE
|
226
|
+
rb_gi_field_info_get_field_raw_ensure(VALUE user_data)
|
227
|
+
{
|
228
|
+
FieldToRubyData *data = (FieldToRubyData *)user_data;
|
229
|
+
rb_gi_arguments_clear(&(data->args));
|
230
|
+
rb_gi_arg_metadata_clear(&(data->metadata));
|
231
|
+
return Qnil;
|
232
|
+
}
|
233
|
+
|
234
|
+
VALUE
|
235
|
+
rb_gi_field_info_get_field_raw(GIFieldInfo *info, gpointer memory)
|
236
|
+
{
|
237
|
+
FieldToRubyData data;
|
238
|
+
rb_gi_arguments_init(&(data.args), NULL, Qnil, Qnil, NULL);
|
239
|
+
GITypeInfo *type_info = g_field_info_get_type(info);
|
240
|
+
rb_gi_arg_metadata_init_type_info(&(data.metadata), type_info);
|
241
|
+
data.info = info;
|
242
|
+
data.memory = memory;
|
243
|
+
|
244
|
+
return rb_ensure(rb_gi_field_info_get_field_raw_body, (VALUE)&data,
|
245
|
+
rb_gi_field_info_get_field_raw_ensure, (VALUE)&data);
|
245
246
|
}
|
246
247
|
|
247
248
|
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-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
|
@@ -49,18 +49,55 @@ gi_function_info_get_type(void)
|
|
49
49
|
}
|
50
50
|
|
51
51
|
static VALUE
|
52
|
-
|
52
|
+
rg_set_lock_gvl_default(VALUE self, VALUE rb_boolean)
|
53
53
|
{
|
54
|
-
return rb_iv_set(self, "
|
54
|
+
return rb_iv_set(self, "lock_gvl_default", rb_boolean);
|
55
55
|
}
|
56
56
|
|
57
57
|
static VALUE
|
58
|
-
|
58
|
+
rg_add_lock_gvl_predicate(VALUE self)
|
59
59
|
{
|
60
|
-
|
61
|
-
|
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;
|
62
82
|
}
|
63
|
-
|
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;
|
64
101
|
}
|
65
102
|
|
66
103
|
static VALUE
|
@@ -144,9 +181,12 @@ rb_gi_function_info_invoke_raw(GIFunctionInfo *info,
|
|
144
181
|
VALUE rb_out_args = Qnil;
|
145
182
|
gboolean succeeded;
|
146
183
|
GError *error = NULL;
|
147
|
-
gboolean
|
184
|
+
gboolean lock_gvl = FALSE;
|
148
185
|
|
149
|
-
|
186
|
+
lock_gvl = RVAL2CBOOL(rb_funcall(rb_info,
|
187
|
+
rb_intern("lock_gvl?"),
|
188
|
+
1,
|
189
|
+
rb_receiver));
|
150
190
|
rb_arguments = rbg_to_array(rb_arguments);
|
151
191
|
|
152
192
|
callable_info = (GICallableInfo *)info;
|
@@ -161,12 +201,12 @@ rb_gi_function_info_invoke_raw(GIFunctionInfo *info,
|
|
161
201
|
data.in_args = args.in_args;
|
162
202
|
data.out_args = args.out_args;
|
163
203
|
data.error = &error;
|
164
|
-
if (
|
204
|
+
if (lock_gvl) {
|
205
|
+
rb_gi_function_info_invoke_raw_call(&data);
|
206
|
+
} else {
|
165
207
|
rb_thread_call_without_gvl(
|
166
208
|
rb_gi_function_info_invoke_raw_call_without_gvl_body, &data,
|
167
209
|
NULL, NULL);
|
168
|
-
} else {
|
169
|
-
rb_gi_function_info_invoke_raw_call(&data);
|
170
210
|
}
|
171
211
|
succeeded = data.succeeded;
|
172
212
|
|
@@ -176,8 +216,8 @@ rb_gi_function_info_invoke_raw(GIFunctionInfo *info,
|
|
176
216
|
if (rb_return_value) {
|
177
217
|
if (succeeded) {
|
178
218
|
*rb_return_value =
|
179
|
-
|
180
|
-
|
219
|
+
rb_gi_arguments_convert_return_value(&args,
|
220
|
+
&(data.return_value));
|
181
221
|
} else {
|
182
222
|
*rb_return_value = Qnil;
|
183
223
|
}
|
@@ -243,8 +283,9 @@ rb_gi_function_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo)
|
|
243
283
|
G_DEF_CLASS_WITH_PARENT(GI_TYPE_FUNCTION_INFO, "FunctionInfo", rb_mGI,
|
244
284
|
rb_cGICallableInfo);
|
245
285
|
|
246
|
-
RG_DEF_METHOD(
|
247
|
-
|
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);
|
248
289
|
|
249
290
|
RG_DEF_METHOD(symbol, 0);
|
250
291
|
RG_DEF_METHOD(flags, 0);
|
@@ -70,7 +70,7 @@ struct_alloc(VALUE klass)
|
|
70
70
|
is_owned = FALSE;
|
71
71
|
} else {
|
72
72
|
size_t size;
|
73
|
-
size =
|
73
|
+
size = NUM2ULL(rb_size);
|
74
74
|
instance = xcalloc(1, size);
|
75
75
|
is_owned = TRUE;
|
76
76
|
}
|
@@ -365,7 +365,7 @@ rg_s_instantiate_gobject_pointer(G_GNUC_UNUSED VALUE klass,
|
|
365
365
|
{
|
366
366
|
GObject *gobject;
|
367
367
|
|
368
|
-
gobject =
|
368
|
+
gobject = (gpointer)(NUM2ULL(rb_gobject_pointer));
|
369
369
|
|
370
370
|
return GOBJ2RVAL(gobject);
|
371
371
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2019 Ruby-GNOME Project Team
|
3
|
+
* Copyright (C) 2019-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
|
@@ -20,5 +20,7 @@
|
|
20
20
|
|
21
21
|
#pragma once
|
22
22
|
|
23
|
+
G_GNUC_INTERNAL gboolean
|
24
|
+
rb_gi_arg_info_is_input_buffer(GIArgInfo *info);
|
23
25
|
G_GNUC_INTERNAL gboolean
|
24
26
|
rb_gi_arg_info_is_output_buffer(GIArgInfo *info);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2019-
|
3
|
+
* Copyright (C) 2019-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
|
@@ -50,6 +50,7 @@ typedef struct {
|
|
50
50
|
struct RBGIArgMetadata_ {
|
51
51
|
GICallableInfo *callable_info;
|
52
52
|
GIArgInfo arg_info;
|
53
|
+
GITypeInfo *type_info;
|
53
54
|
const gchar *name;
|
54
55
|
RBGIArgMetadataType type;
|
55
56
|
RBGIArgMetadataType element_type;
|
@@ -67,6 +68,7 @@ struct RBGIArgMetadata_ {
|
|
67
68
|
gboolean may_be_null_p;
|
68
69
|
gboolean caller_allocates_p;
|
69
70
|
gboolean zero_terminated_p;
|
71
|
+
gboolean input_buffer_p;
|
70
72
|
gboolean output_buffer_p;
|
71
73
|
GIArrayType array_type;
|
72
74
|
gint index;
|
@@ -85,6 +87,12 @@ struct RBGIArgMetadata_ {
|
|
85
87
|
gpointer free_func_data;
|
86
88
|
};
|
87
89
|
|
90
|
+
G_GNUC_INTERNAL void
|
91
|
+
rb_gi_arg_metadata_init_type_info(RBGIArgMetadata *metadata,
|
92
|
+
GITypeInfo *type_info);
|
93
|
+
G_GNUC_INTERNAL void
|
94
|
+
rb_gi_arg_metadata_clear(RBGIArgMetadata *metadata);
|
95
|
+
|
88
96
|
G_GNUC_INTERNAL void
|
89
97
|
rb_gi_arguments_init(RBGIArguments *args,
|
90
98
|
GICallableInfo *info,
|
@@ -94,12 +102,20 @@ rb_gi_arguments_init(RBGIArguments *args,
|
|
94
102
|
G_GNUC_INTERNAL void
|
95
103
|
rb_gi_arguments_clear(RBGIArguments *args);
|
96
104
|
|
105
|
+
G_GNUC_INTERNAL VALUE
|
106
|
+
rb_gi_arguments_get_rb_in_args(RBGIArguments *args);
|
97
107
|
G_GNUC_INTERNAL VALUE
|
98
108
|
rb_gi_arguments_get_rb_out_args(RBGIArguments *args);
|
99
109
|
|
100
110
|
G_GNUC_INTERNAL VALUE
|
101
|
-
|
102
|
-
|
111
|
+
rb_gi_arguments_convert_arg(RBGIArguments *args,
|
112
|
+
GIArgument *arg,
|
113
|
+
RBGIArgMetadata *arg_metadata,
|
114
|
+
gboolean duplicate);
|
115
|
+
|
116
|
+
G_GNUC_INTERNAL VALUE
|
117
|
+
rb_gi_arguments_convert_return_value(RBGIArguments *args,
|
118
|
+
GIArgument *return_value);
|
103
119
|
|
104
120
|
G_GNUC_INTERNAL void
|
105
121
|
rb_gi_arguments_fill_raw_out_gerror(RBGIArguments *args,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2012-
|
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
|
@@ -50,12 +50,15 @@
|
|
50
50
|
# define RB_TYPE_P(object, type) (TYPE(object) == type)
|
51
51
|
#endif
|
52
52
|
|
53
|
+
/* GLib 2.60 or later defines this. */
|
54
|
+
#ifndef G_GNUC_FALLTHROUGH
|
55
|
+
# define G_GNUC_FALLTHROUGH
|
56
|
+
#endif
|
57
|
+
|
53
58
|
extern void Init_gobject_introspection(void);
|
54
59
|
|
55
60
|
gboolean rb_gi_is_debug_mode(void);
|
56
61
|
|
57
|
-
void rb_gi_argument_init (void);
|
58
|
-
|
59
62
|
void rb_gi_type_tag_init (VALUE rb_mGI);
|
60
63
|
void rb_gi_base_info_init (VALUE rb_mGI);
|
61
64
|
void rb_gi_callable_info_init (VALUE rb_mGI,
|