gobject-introspection 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/gobject-introspection/depend +10 -0
- data/ext/gobject-introspection/rb-gi-arg-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-argument.c +30 -12
- data/ext/gobject-introspection/rb-gi-base-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-boxed-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-callable-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-callback-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-constant-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-constructor-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-enum-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-field-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-flags-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-function-info.c +122 -81
- data/ext/gobject-introspection/rb-gi-interface-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-loader.c +9 -1
- data/ext/gobject-introspection/rb-gi-method-info.c +6 -2
- data/ext/gobject-introspection/rb-gi-object-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-private.h +110 -0
- data/ext/gobject-introspection/rb-gi-property-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-registered-type-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-repository.c +1 -1
- data/ext/gobject-introspection/rb-gi-signal-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-struct-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-type-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-type-tag.c +1 -1
- data/ext/gobject-introspection/rb-gi-union-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-unresolved-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-value-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-vfunc-info.c +1 -1
- data/ext/gobject-introspection/rb-gobject-introspection.c +1 -1
- data/ext/gobject-introspection/rb-gobject-introspection.h +30 -81
- data/lib/gobject-introspection/callable-info.rb +38 -2
- data/lib/gobject-introspection/loader.rb +81 -15
- metadata +92 -108
@@ -0,0 +1,10 @@
|
|
1
|
+
install-so: install-headers
|
2
|
+
install-headers:
|
3
|
+
$(INSTALL_DATA) $(srcdir)/rb-gobject-introspection.h $(RUBYARCHDIR)
|
4
|
+
|
5
|
+
install: install-pc
|
6
|
+
install-pc:
|
7
|
+
if test -n "$(pkgconfigdir)"; then \
|
8
|
+
$(MAKEDIRS) $(pkgconfigdir); \
|
9
|
+
$(INSTALL_DATA) ruby-gobject-introspection.pc $(pkgconfigdir);\
|
10
|
+
fi
|
@@ -18,7 +18,7 @@
|
|
18
18
|
* MA 02110-1301 USA
|
19
19
|
*/
|
20
20
|
|
21
|
-
#include "rb-
|
21
|
+
#include "rb-gi-private.h"
|
22
22
|
|
23
23
|
static VALUE rb_cGLibValue = Qnil;
|
24
24
|
|
@@ -121,10 +121,18 @@ interface_to_ruby(GIArgument *argument, GITypeInfo *type_info)
|
|
121
121
|
"TODO: GIArgument(interface)[boxed] -> Ruby");
|
122
122
|
break;
|
123
123
|
case GI_INFO_TYPE_ENUM:
|
124
|
-
|
124
|
+
if (gtype == G_TYPE_NONE) {
|
125
|
+
rb_interface = INT2NUM(argument->v_int32);
|
126
|
+
} else {
|
127
|
+
rb_interface = GENUM2RVAL(argument->v_int32, gtype);
|
128
|
+
}
|
125
129
|
break;
|
126
130
|
case GI_INFO_TYPE_FLAGS:
|
127
|
-
|
131
|
+
if (gtype == G_TYPE_NONE) {
|
132
|
+
rb_interface = INT2NUM(argument->v_int32);
|
133
|
+
} else {
|
134
|
+
rb_interface = GFLAGS2RVAL(argument->v_int32, gtype);
|
135
|
+
}
|
128
136
|
break;
|
129
137
|
case GI_INFO_TYPE_OBJECT:
|
130
138
|
rb_interface = GOBJ2RVAL(argument->v_pointer);
|
@@ -250,7 +258,7 @@ rb_gi_argument_to_ruby(GIArgument *argument, GITypeInfo *type_info)
|
|
250
258
|
rb_raise(rb_eNotImpError, "TODO: GIArgument(unichar) -> Ruby");
|
251
259
|
break;
|
252
260
|
case GI_TYPE_TAG_ERROR:
|
253
|
-
|
261
|
+
rb_argument = GERROR2RVAL(argument->v_pointer);
|
254
262
|
break;
|
255
263
|
case GI_TYPE_TAG_UNICHAR:
|
256
264
|
rb_raise(rb_eNotImpError,
|
@@ -574,10 +582,18 @@ rb_gi_argument_from_ruby_interface(GIArgument *argument, GITypeInfo *type_info,
|
|
574
582
|
g_base_info_get_name(interface_info));
|
575
583
|
break;
|
576
584
|
case GI_INFO_TYPE_ENUM:
|
577
|
-
|
585
|
+
if (gtype == G_TYPE_NONE) {
|
586
|
+
argument->v_int32 = NUM2INT(rb_argument);
|
587
|
+
} else {
|
588
|
+
argument->v_int32 = RVAL2GENUM(rb_argument, gtype);
|
589
|
+
}
|
578
590
|
break;
|
579
591
|
case GI_INFO_TYPE_FLAGS:
|
580
|
-
|
592
|
+
if (gtype == G_TYPE_NONE) {
|
593
|
+
argument->v_int32 = NUM2INT(rb_argument);
|
594
|
+
} else {
|
595
|
+
argument->v_int32 = RVAL2GFLAGS(rb_argument, gtype);
|
596
|
+
}
|
581
597
|
break;
|
582
598
|
case GI_INFO_TYPE_OBJECT:
|
583
599
|
case GI_INFO_TYPE_INTERFACE:
|
@@ -828,17 +844,19 @@ rb_gi_in_argument_free_interface(GIArgument *argument, GITypeInfo *type_info)
|
|
828
844
|
{
|
829
845
|
GIBaseInfo *interface_info;
|
830
846
|
GIInfoType interface_type;
|
831
|
-
GType gtype;
|
832
847
|
|
833
848
|
interface_info = g_type_info_get_interface(type_info);
|
834
849
|
interface_type = g_base_info_get_type(interface_info);
|
835
850
|
|
836
|
-
|
851
|
+
if (interface_type == GI_INFO_TYPE_STRUCT) {
|
852
|
+
GType gtype;
|
853
|
+
gtype = g_registered_type_info_get_g_type(interface_info);
|
837
854
|
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
855
|
+
if (gtype == G_TYPE_VALUE) {
|
856
|
+
GValue *gvalue = argument->v_pointer;
|
857
|
+
g_value_unset(gvalue);
|
858
|
+
xfree(argument->v_pointer);
|
859
|
+
}
|
842
860
|
}
|
843
861
|
|
844
862
|
g_base_info_unref(interface_info);
|
@@ -18,13 +18,15 @@
|
|
18
18
|
* MA 02110-1301 USA
|
19
19
|
*/
|
20
20
|
|
21
|
-
#include "rb-
|
21
|
+
#include "rb-gi-private.h"
|
22
22
|
|
23
23
|
#define RG_TARGET_NAMESPACE rb_cGIFunctionInfo
|
24
24
|
#define SELF(self) RVAL2GI_FUNCTION_INFO(self)
|
25
25
|
|
26
26
|
static VALUE RG_TARGET_NAMESPACE;
|
27
|
+
static VALUE rb_cGLibError;
|
27
28
|
static const char *callbacks_key = "gi_callbacks";
|
29
|
+
static GPtrArray *callback_finders;
|
28
30
|
|
29
31
|
GType
|
30
32
|
gi_function_info_get_type(void)
|
@@ -74,23 +76,6 @@ rg_vfunc(VALUE self)
|
|
74
76
|
return GI_BASE_INFO2RVAL(g_function_info_get_vfunc(info));
|
75
77
|
}
|
76
78
|
|
77
|
-
typedef struct
|
78
|
-
{
|
79
|
-
GIArgInfo arg_info;
|
80
|
-
GIScopeType scope_type;
|
81
|
-
GIDirection direction;
|
82
|
-
gboolean callback_p;
|
83
|
-
gboolean closure_p;
|
84
|
-
gboolean destroy_p;
|
85
|
-
gboolean inout_argv_p;
|
86
|
-
gint in_arg_index;
|
87
|
-
gint closure_in_arg_index;
|
88
|
-
gint destroy_in_arg_index;
|
89
|
-
gint rb_arg_index;
|
90
|
-
gint out_arg_index;
|
91
|
-
gint inout_argc_arg_index;
|
92
|
-
} ArgMetadata;
|
93
|
-
|
94
79
|
static void
|
95
80
|
allocate_arguments(GICallableInfo *info,
|
96
81
|
GArray *in_args, GArray *out_args,
|
@@ -102,13 +87,13 @@ allocate_arguments(GICallableInfo *info,
|
|
102
87
|
n_args = g_callable_info_get_n_args(info);
|
103
88
|
for (i = 0; i < n_args; i++) {
|
104
89
|
GIArgument argument;
|
105
|
-
|
90
|
+
RBGIArgMetadata *metadata;
|
106
91
|
GIArgInfo *arg_info;
|
107
92
|
GIDirection direction;
|
108
93
|
|
109
94
|
memset(&argument, 0, sizeof(GIArgument));
|
110
95
|
|
111
|
-
metadata = ALLOC(
|
96
|
+
metadata = ALLOC(RBGIArgMetadata);
|
112
97
|
arg_info = &(metadata->arg_info);
|
113
98
|
g_callable_info_load_arg(info, i, arg_info);
|
114
99
|
metadata->scope_type = g_arg_info_get_scope(arg_info);
|
@@ -146,7 +131,7 @@ fill_metadata_inout_argv(GPtrArray *args_metadata)
|
|
146
131
|
gint inout_argc_arg_index = -1;
|
147
132
|
|
148
133
|
for (i = 0; i < args_metadata->len; i++) {
|
149
|
-
|
134
|
+
RBGIArgMetadata *metadata;
|
150
135
|
GIArgInfo *arg_info;
|
151
136
|
const gchar *name;
|
152
137
|
|
@@ -171,7 +156,7 @@ fill_metadata_callback(GPtrArray *args_metadata)
|
|
171
156
|
guint i;
|
172
157
|
|
173
158
|
for (i = 0; i < args_metadata->len; i++) {
|
174
|
-
|
159
|
+
RBGIArgMetadata *metadata;
|
175
160
|
GIArgInfo *arg_info;
|
176
161
|
gint closure_index;
|
177
162
|
gint destroy_index;
|
@@ -184,7 +169,7 @@ fill_metadata_callback(GPtrArray *args_metadata)
|
|
184
169
|
arg_info = &(metadata->arg_info);
|
185
170
|
closure_index = g_arg_info_get_closure(arg_info);
|
186
171
|
if (closure_index != -1) {
|
187
|
-
|
172
|
+
RBGIArgMetadata *closure_metadata;
|
188
173
|
closure_metadata = g_ptr_array_index(args_metadata, closure_index);
|
189
174
|
closure_metadata->closure_p = TRUE;
|
190
175
|
metadata->closure_in_arg_index = closure_metadata->in_arg_index;
|
@@ -193,7 +178,7 @@ fill_metadata_callback(GPtrArray *args_metadata)
|
|
193
178
|
|
194
179
|
destroy_index = g_arg_info_get_destroy(arg_info);
|
195
180
|
if (destroy_index != -1) {
|
196
|
-
|
181
|
+
RBGIArgMetadata *destroy_metadata;
|
197
182
|
destroy_metadata = g_ptr_array_index(args_metadata, destroy_index);
|
198
183
|
destroy_metadata->destroy_p = TRUE;
|
199
184
|
metadata->destroy_in_arg_index = destroy_metadata->in_arg_index;
|
@@ -209,8 +194,67 @@ fill_metadata(GPtrArray *args_metadata)
|
|
209
194
|
fill_metadata_callback(args_metadata);
|
210
195
|
}
|
211
196
|
|
197
|
+
static void
|
198
|
+
callback_data_guard_from_gc(RBGICallbackData *callback_data)
|
199
|
+
{
|
200
|
+
VALUE rb_callbacks;
|
201
|
+
|
202
|
+
rb_callbacks = rb_iv_get(RG_TARGET_NAMESPACE, callbacks_key);
|
203
|
+
callback_data->rb_gc_guard_key = rb_class_new_instance(0, NULL, rb_cObject);
|
204
|
+
rb_hash_aset(rb_callbacks,
|
205
|
+
callback_data->rb_gc_guard_key,
|
206
|
+
callback_data->rb_callback);
|
207
|
+
}
|
208
|
+
|
209
|
+
static void
|
210
|
+
callback_data_unguard_from_gc(RBGICallbackData *callback_data)
|
211
|
+
{
|
212
|
+
VALUE rb_callbacks;
|
213
|
+
|
214
|
+
rb_callbacks = rb_iv_get(RG_TARGET_NAMESPACE, callbacks_key);
|
215
|
+
rb_hash_delete(rb_callbacks, callback_data->rb_gc_guard_key);
|
216
|
+
}
|
217
|
+
|
218
|
+
void
|
219
|
+
rb_gi_callback_data_free(RBGICallbackData *callback_data)
|
220
|
+
{
|
221
|
+
callback_data_unguard_from_gc(callback_data);
|
222
|
+
xfree(callback_data->metadata);
|
223
|
+
xfree(callback_data);
|
224
|
+
}
|
225
|
+
|
226
|
+
static void
|
227
|
+
destroy_notify(gpointer data)
|
228
|
+
{
|
229
|
+
RBGICallbackData *callback_data = data;
|
230
|
+
rb_gi_callback_data_free(callback_data);
|
231
|
+
}
|
232
|
+
|
233
|
+
static gpointer
|
234
|
+
find_callback_function(GIArgInfo *info)
|
235
|
+
{
|
236
|
+
guint i;
|
237
|
+
gpointer callback = NULL;
|
238
|
+
|
239
|
+
for (i = 0; i < callback_finders->len; i++) {
|
240
|
+
RBGICallbackFinderFunc finder = g_ptr_array_index(callback_finders, i);
|
241
|
+
callback = finder(info);
|
242
|
+
if (callback) {
|
243
|
+
break;
|
244
|
+
}
|
245
|
+
}
|
246
|
+
|
247
|
+
return callback;
|
248
|
+
}
|
249
|
+
|
250
|
+
void
|
251
|
+
rb_gi_callback_register_finder(RBGICallbackFinderFunc finder)
|
252
|
+
{
|
253
|
+
g_ptr_array_add(callback_finders, finder);
|
254
|
+
}
|
255
|
+
|
212
256
|
static gboolean
|
213
|
-
|
257
|
+
source_func_p(GIArgInfo *info)
|
214
258
|
{
|
215
259
|
GITypeInfo type_info;
|
216
260
|
GIBaseInfo *interface_info;
|
@@ -253,84 +297,64 @@ source_callback_p(GIArgInfo *info)
|
|
253
297
|
return TRUE;
|
254
298
|
}
|
255
299
|
|
256
|
-
typedef struct {
|
257
|
-
ArgMetadata *metadata;
|
258
|
-
VALUE rb_gc_guard_key;
|
259
|
-
VALUE rb_callback;
|
260
|
-
} CallbackData;
|
261
|
-
|
262
|
-
static void
|
263
|
-
callback_data_guard_from_gc(CallbackData *callback_data)
|
264
|
-
{
|
265
|
-
VALUE rb_callbacks;
|
266
|
-
|
267
|
-
rb_callbacks = rb_iv_get(RG_TARGET_NAMESPACE, callbacks_key);
|
268
|
-
callback_data->rb_gc_guard_key = rb_class_new_instance(0, NULL, rb_cObject);
|
269
|
-
rb_hash_aset(rb_callbacks,
|
270
|
-
callback_data->rb_gc_guard_key,
|
271
|
-
callback_data->rb_callback);
|
272
|
-
}
|
273
|
-
|
274
|
-
static void
|
275
|
-
callback_data_unguard_from_gc(CallbackData *callback_data)
|
276
|
-
{
|
277
|
-
VALUE rb_callbacks;
|
278
|
-
|
279
|
-
rb_callbacks = rb_iv_get(RG_TARGET_NAMESPACE, callbacks_key);
|
280
|
-
rb_hash_delete(rb_callbacks, callback_data->rb_gc_guard_key);
|
281
|
-
}
|
282
|
-
|
283
|
-
static void
|
284
|
-
callback_data_free(CallbackData *callback_data)
|
285
|
-
{
|
286
|
-
callback_data_unguard_from_gc(callback_data);
|
287
|
-
xfree(callback_data->metadata);
|
288
|
-
xfree(callback_data);
|
289
|
-
}
|
290
|
-
|
291
300
|
static gboolean
|
292
|
-
|
301
|
+
source_func_callback(gpointer user_data)
|
293
302
|
{
|
294
|
-
|
303
|
+
RBGICallbackData *callback_data = user_data;
|
295
304
|
VALUE rb_keep;
|
296
305
|
ID id_call;
|
297
306
|
|
298
307
|
CONST_ID(id_call, "call");
|
299
308
|
rb_keep = rb_funcall(callback_data->rb_callback, id_call, 0);
|
300
309
|
if (callback_data->metadata->scope_type == GI_SCOPE_TYPE_ASYNC) {
|
301
|
-
|
310
|
+
rb_gi_callback_data_free(callback_data);
|
302
311
|
}
|
303
312
|
return RVAL2CBOOL(rb_keep);
|
304
313
|
}
|
305
314
|
|
306
|
-
static
|
307
|
-
|
315
|
+
static gpointer
|
316
|
+
source_func_callback_finder(GIArgInfo *arg_info)
|
308
317
|
{
|
309
|
-
|
310
|
-
|
318
|
+
if (!source_func_p(arg_info)) {
|
319
|
+
return NULL;
|
320
|
+
}
|
321
|
+
return source_func_callback;
|
311
322
|
}
|
312
323
|
|
313
324
|
static void
|
314
|
-
in_callback_argument_from_ruby(
|
325
|
+
in_callback_argument_from_ruby(RBGIArgMetadata *metadata, VALUE *argv,
|
315
326
|
GArray *in_args)
|
316
327
|
{
|
328
|
+
gpointer callback;
|
329
|
+
GIArgInfo *arg_info;
|
317
330
|
GIArgument *callback_argument;
|
318
331
|
|
319
|
-
|
332
|
+
arg_info = &(metadata->arg_info);
|
333
|
+
callback = find_callback_function(arg_info);
|
334
|
+
if (!callback) {
|
335
|
+
GITypeInfo type_info;
|
336
|
+
GIBaseInfo *interface_info;
|
337
|
+
VALUE rb_type_name;
|
338
|
+
g_arg_info_load_type(arg_info, &type_info);
|
339
|
+
interface_info = g_type_info_get_interface(&type_info);
|
340
|
+
rb_type_name = CSTR2RVAL(g_base_info_get_name(interface_info));
|
341
|
+
g_base_info_unref(interface_info);
|
320
342
|
rb_raise(rb_eNotImpError,
|
321
|
-
"TODO:
|
343
|
+
"TODO: <%s>(%s) callback is not supported yet.",
|
344
|
+
RVAL2CSTR(rb_type_name),
|
345
|
+
g_base_info_get_name(arg_info));
|
322
346
|
}
|
323
347
|
|
324
348
|
callback_argument = &(g_array_index(in_args,
|
325
349
|
GIArgument,
|
326
350
|
metadata->in_arg_index));
|
327
|
-
callback_argument->v_pointer =
|
351
|
+
callback_argument->v_pointer = callback;
|
328
352
|
|
329
353
|
if (metadata->closure_in_arg_index != -1) {
|
330
|
-
|
354
|
+
RBGICallbackData *callback_data;
|
331
355
|
GIArgument *closure_argument;
|
332
356
|
|
333
|
-
callback_data = ALLOC(
|
357
|
+
callback_data = ALLOC(RBGICallbackData);
|
334
358
|
callback_data->metadata = metadata;
|
335
359
|
callback_data->rb_callback = rb_block_proc();
|
336
360
|
callback_data_guard_from_gc(callback_data);
|
@@ -350,7 +374,7 @@ in_callback_argument_from_ruby(ArgMetadata *metadata, VALUE *argv,
|
|
350
374
|
}
|
351
375
|
|
352
376
|
static void
|
353
|
-
in_argument_from_ruby(
|
377
|
+
in_argument_from_ruby(RBGIArgMetadata *metadata, VALUE *argv, GArray *in_args)
|
354
378
|
{
|
355
379
|
if (metadata->rb_arg_index == -1) {
|
356
380
|
return;
|
@@ -369,7 +393,7 @@ in_argument_from_ruby(ArgMetadata *metadata, VALUE *argv, GArray *in_args)
|
|
369
393
|
}
|
370
394
|
|
371
395
|
static void
|
372
|
-
out_argument_from_ruby(
|
396
|
+
out_argument_from_ruby(RBGIArgMetadata *metadata, GArray *out_args)
|
373
397
|
{
|
374
398
|
GIArgument *argument;
|
375
399
|
|
@@ -380,7 +404,7 @@ out_argument_from_ruby(ArgMetadata *metadata, GArray *out_args)
|
|
380
404
|
static void
|
381
405
|
arg_metadata_free(gpointer data)
|
382
406
|
{
|
383
|
-
|
407
|
+
RBGIArgMetadata *metadata = data;
|
384
408
|
if (metadata->scope_type == GI_SCOPE_TYPE_ASYNC ||
|
385
409
|
metadata->scope_type == GI_SCOPE_TYPE_NOTIFIED) {
|
386
410
|
return;
|
@@ -403,7 +427,7 @@ arguments_from_ruby(GICallableInfo *info,
|
|
403
427
|
|
404
428
|
n_args = g_callable_info_get_n_args(info);
|
405
429
|
for (i = 0; i < n_args; i++) {
|
406
|
-
|
430
|
+
RBGIArgMetadata *metadata;
|
407
431
|
|
408
432
|
metadata = g_ptr_array_index(args_metadata, i);
|
409
433
|
if (metadata->in_arg_index != -1) {
|
@@ -415,7 +439,7 @@ arguments_from_ruby(GICallableInfo *info,
|
|
415
439
|
}
|
416
440
|
|
417
441
|
static VALUE
|
418
|
-
inout_argv_argument_to_ruby(GArray *in_args,
|
442
|
+
inout_argv_argument_to_ruby(GArray *in_args, RBGIArgMetadata *metadata)
|
419
443
|
{
|
420
444
|
GIArgument *inout_argc_argument;
|
421
445
|
GIArgument *inout_argv_argument;
|
@@ -447,7 +471,7 @@ out_arguments_to_ruby(GICallableInfo *callable_info,
|
|
447
471
|
rb_out_args = rb_ary_new();
|
448
472
|
n_args = g_callable_info_get_n_args(callable_info);
|
449
473
|
for (i = 0; i < n_args; i++) {
|
450
|
-
|
474
|
+
RBGIArgMetadata *metadata;
|
451
475
|
GIArgument *argument = NULL;
|
452
476
|
VALUE rb_argument;
|
453
477
|
|
@@ -501,7 +525,7 @@ arguments_free(GArray *in_args, GArray *out_args, GPtrArray *args_metadata)
|
|
501
525
|
guint i;
|
502
526
|
|
503
527
|
for (i = 0; i < args_metadata->len; i++) {
|
504
|
-
|
528
|
+
RBGIArgMetadata *metadata;
|
505
529
|
gint in_arg_index;
|
506
530
|
|
507
531
|
metadata = g_ptr_array_index(args_metadata, i);
|
@@ -563,6 +587,14 @@ rb_gi_function_info_invoke_raw(GIFunctionInfo *info, GIArgument *receiver,
|
|
563
587
|
RG_RAISE_ERROR(error);
|
564
588
|
}
|
565
589
|
|
590
|
+
if (!NIL_P(rb_out_args) && RARRAY_LEN(rb_out_args) == 1) {
|
591
|
+
VALUE rb_out_arg;
|
592
|
+
rb_out_arg = RARRAY_PTR(rb_out_args)[0];
|
593
|
+
if (rb_obj_is_kind_of(rb_out_arg, rb_cGLibError)) {
|
594
|
+
rb_exc_raise(rb_out_arg);
|
595
|
+
}
|
596
|
+
}
|
597
|
+
|
566
598
|
return rb_out_args;
|
567
599
|
}
|
568
600
|
|
@@ -591,19 +623,28 @@ rg_invoke(int argc, VALUE *argv, VALUE self)
|
|
591
623
|
if (g_type_info_get_tag(&return_value_info) != GI_TYPE_TAG_VOID) {
|
592
624
|
rb_ary_unshift(rb_out_args, rb_return_value);
|
593
625
|
}
|
594
|
-
|
626
|
+
if (RARRAY_LEN(rb_out_args) == 1) {
|
627
|
+
return RARRAY_PTR(rb_out_args)[0];
|
628
|
+
} else {
|
629
|
+
return rb_out_args;
|
630
|
+
}
|
595
631
|
}
|
596
632
|
}
|
597
633
|
|
598
634
|
void
|
599
635
|
rb_gi_function_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo)
|
600
636
|
{
|
637
|
+
rb_cGLibError = rb_const_get(mGLib, rb_intern("Error"));
|
638
|
+
|
601
639
|
RG_TARGET_NAMESPACE =
|
602
640
|
G_DEF_CLASS_WITH_PARENT(GI_TYPE_FUNCTION_INFO, "FunctionInfo", rb_mGI,
|
603
641
|
rb_cGICallableInfo);
|
604
642
|
|
605
643
|
rb_iv_set(RG_TARGET_NAMESPACE, callbacks_key, rb_hash_new());
|
606
644
|
|
645
|
+
callback_finders = g_ptr_array_new();
|
646
|
+
rb_gi_callback_register_finder(source_func_callback_finder);
|
647
|
+
|
607
648
|
RG_DEF_METHOD(symbol, 0);
|
608
649
|
RG_DEF_METHOD(flags, 0);
|
609
650
|
RG_DEF_METHOD(property, 0);
|