gobject-introspection 2.1.0-x86-mingw32 → 2.2.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -0
- data/ext/gobject-introspection/rb-gi-argument.c +599 -103
- data/ext/gobject-introspection/rb-gi-conversions.h +30 -1
- data/ext/gobject-introspection/rb-gi-enum-info.c +11 -1
- data/ext/gobject-introspection/rb-gi-function-info.c +108 -60
- data/ext/gobject-introspection/rb-gi-loader.c +42 -1
- data/ext/gobject-introspection/rb-gobject-introspection.h +6 -3
- data/lib/1.9/gobject_introspection.so +0 -0
- data/lib/2.0/gobject_introspection.so +0 -0
- data/lib/2.1/gobject_introspection.so +0 -0
- data/lib/gobject-introspection/loader.rb +76 -19
- data/test/test-enum-info.rb +6 -1
- data/test/test-interface-info.rb +3 -3
- data/test/test-repository.rb +5 -2
- data/test/test-signal-info.rb +6 -3
- data/test/test-struct-info.rb +3 -3
- 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/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.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -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/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/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.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.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.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.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
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dc58d3a16683bfc549a15a04932160e7a03962f
|
4
|
+
data.tar.gz: e33422fa5a785789df80009cd998fbc45614083e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f6b837f2f656efd261f96196ed1d83ecaaca0e1c074281d762b71471374db75afedc353f89940e7af929d297f7e306900d6773997db29ac0dafa636b61da7f9
|
7
|
+
data.tar.gz: 94af97fd8d5d02188929b2e0ad560eed9d47add513364772c7e3b46d8efc7dc4539b7b52577f5bf13f935323b61762c2d99a6dcb60624831c2ba1e176f2369b0
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2012-
|
3
|
+
* Copyright (C) 2012-2014 Ruby-GNOME2 Project Team
|
4
4
|
*
|
5
5
|
* This library is free software; you can redistribute it and/or
|
6
6
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -23,21 +23,22 @@
|
|
23
23
|
static VALUE rb_cGLibValue = Qnil;
|
24
24
|
|
25
25
|
static void
|
26
|
-
array_c_to_ruby(
|
26
|
+
array_c_to_ruby(GIArgument *array, GITypeInfo *type_info, gint64 n_elements,
|
27
|
+
VALUE rb_array)
|
27
28
|
{
|
28
|
-
|
29
|
+
const gchar **elements;
|
29
30
|
gboolean fixed_size_p;
|
30
31
|
gboolean zero_terminated_p;
|
31
32
|
|
33
|
+
elements = array->v_pointer;
|
32
34
|
if (!elements) {
|
33
35
|
return;
|
34
36
|
}
|
35
37
|
|
36
|
-
n_elements = g_type_info_get_array_length(type_info);
|
37
38
|
fixed_size_p = g_type_info_get_array_fixed_size(type_info);
|
38
39
|
zero_terminated_p = g_type_info_is_zero_terminated(type_info);
|
39
40
|
if (n_elements != -1) {
|
40
|
-
|
41
|
+
gint64 i;
|
41
42
|
for (i = 0; i < n_elements; i++) {
|
42
43
|
rb_ary_push(rb_array, CSTR2RVAL(elements[i]));
|
43
44
|
}
|
@@ -50,22 +51,91 @@ array_c_to_ruby(const gchar **elements, GITypeInfo *type_info, VALUE rb_array)
|
|
50
51
|
"TODO: GIArgument(array)[c] -> Ruby: "
|
51
52
|
"zero-terminated: %s "
|
52
53
|
"fixed-size: %s "
|
53
|
-
"length: %
|
54
|
+
"length: %" G_GINT64_FORMAT,
|
54
55
|
zero_terminated_p ? "true" : "false",
|
55
56
|
fixed_size_p ? "true" : "false",
|
56
57
|
n_elements);
|
57
58
|
}
|
58
59
|
}
|
59
60
|
|
60
|
-
static
|
61
|
-
|
61
|
+
static gint64
|
62
|
+
get_array_length(GIArgument *argument, GITypeInfo *type_info)
|
63
|
+
{
|
64
|
+
GITypeTag type_tag;
|
65
|
+
gint64 length = -1;
|
66
|
+
|
67
|
+
if (!argument) {
|
68
|
+
return length;
|
69
|
+
}
|
70
|
+
|
71
|
+
type_tag = g_type_info_get_tag(type_info);
|
72
|
+
switch (type_tag) {
|
73
|
+
case GI_TYPE_TAG_VOID:
|
74
|
+
case GI_TYPE_TAG_BOOLEAN:
|
75
|
+
rb_raise(rb_eNotImpError,
|
76
|
+
"TODO: invalid array length argument?: <%s>",
|
77
|
+
g_type_tag_to_string(type_tag));
|
78
|
+
break;
|
79
|
+
case GI_TYPE_TAG_INT8:
|
80
|
+
length = argument->v_int8;
|
81
|
+
break;
|
82
|
+
case GI_TYPE_TAG_UINT8:
|
83
|
+
length = argument->v_uint8;
|
84
|
+
break;
|
85
|
+
case GI_TYPE_TAG_INT16:
|
86
|
+
length = argument->v_int16;
|
87
|
+
break;
|
88
|
+
case GI_TYPE_TAG_UINT16:
|
89
|
+
length = argument->v_uint16;
|
90
|
+
break;
|
91
|
+
case GI_TYPE_TAG_INT32:
|
92
|
+
length = argument->v_int32;
|
93
|
+
break;
|
94
|
+
case GI_TYPE_TAG_UINT32:
|
95
|
+
length = argument->v_uint32;
|
96
|
+
break;
|
97
|
+
case GI_TYPE_TAG_INT64:
|
98
|
+
length = argument->v_int64;
|
99
|
+
break;
|
100
|
+
case GI_TYPE_TAG_UINT64:
|
101
|
+
length = argument->v_uint64;
|
102
|
+
break;
|
103
|
+
case GI_TYPE_TAG_FLOAT:
|
104
|
+
case GI_TYPE_TAG_DOUBLE:
|
105
|
+
case GI_TYPE_TAG_GTYPE:
|
106
|
+
case GI_TYPE_TAG_UTF8:
|
107
|
+
case GI_TYPE_TAG_FILENAME:
|
108
|
+
case GI_TYPE_TAG_ARRAY:
|
109
|
+
case GI_TYPE_TAG_INTERFACE:
|
110
|
+
case GI_TYPE_TAG_GLIST:
|
111
|
+
case GI_TYPE_TAG_GSLIST:
|
112
|
+
case GI_TYPE_TAG_GHASH:
|
113
|
+
case GI_TYPE_TAG_ERROR:
|
114
|
+
case GI_TYPE_TAG_UNICHAR:
|
115
|
+
rb_raise(rb_eNotImpError,
|
116
|
+
"TODO: invalid array length argument?: <%s>",
|
117
|
+
g_type_tag_to_string(type_tag));
|
118
|
+
break;
|
119
|
+
default:
|
120
|
+
g_assert_not_reached();
|
121
|
+
break;
|
122
|
+
}
|
123
|
+
|
124
|
+
return length;
|
125
|
+
}
|
126
|
+
|
127
|
+
VALUE
|
128
|
+
rb_gi_array_argument_to_ruby(GIArgument *array_argument,
|
129
|
+
GIArgument *length_argument,
|
130
|
+
GITypeInfo *array_type_info,
|
131
|
+
GITypeInfo *length_type_info)
|
62
132
|
{
|
63
133
|
VALUE rb_array;
|
64
134
|
GIArrayType array_type;
|
65
135
|
gint n_elements;
|
66
136
|
|
67
|
-
array_type = g_type_info_get_array_type(
|
68
|
-
n_elements =
|
137
|
+
array_type = g_type_info_get_array_type(array_type_info);
|
138
|
+
n_elements = get_array_length(length_argument, length_type_info);
|
69
139
|
if (n_elements == -1) {
|
70
140
|
rb_array = rb_ary_new();
|
71
141
|
} else {
|
@@ -73,7 +143,7 @@ array_to_ruby(gpointer array, GITypeInfo *type_info)
|
|
73
143
|
}
|
74
144
|
switch (array_type) {
|
75
145
|
case GI_ARRAY_TYPE_C:
|
76
|
-
array_c_to_ruby(
|
146
|
+
array_c_to_ruby(array_argument, array_type_info, n_elements, rb_array);
|
77
147
|
break;
|
78
148
|
case GI_ARRAY_TYPE_ARRAY:
|
79
149
|
rb_raise(rb_eNotImpError, "TODO: GIArgument(array)[array] -> Ruby");
|
@@ -118,7 +188,15 @@ interface_to_ruby(GIArgument *argument, GITypeInfo *type_info)
|
|
118
188
|
"TODO: GIArgument(interface)[callback] -> Ruby");
|
119
189
|
break;
|
120
190
|
case GI_INFO_TYPE_STRUCT:
|
121
|
-
|
191
|
+
if (gtype == G_TYPE_BYTES) {
|
192
|
+
GBytes *bytes = argument->v_pointer;
|
193
|
+
gconstpointer data;
|
194
|
+
gsize size;
|
195
|
+
data = g_bytes_get_data(bytes, &size);
|
196
|
+
rb_interface = rb_enc_str_new(data, size, rb_ascii8bit_encoding());
|
197
|
+
} else {
|
198
|
+
rb_interface = BOXED2RVAL(argument->v_pointer, gtype);
|
199
|
+
}
|
122
200
|
break;
|
123
201
|
case GI_INFO_TYPE_BOXED:
|
124
202
|
rb_raise(rb_eNotImpError,
|
@@ -255,7 +333,8 @@ rb_gi_argument_to_ruby(GIArgument *argument, GITypeInfo *type_info)
|
|
255
333
|
rb_argument = CSTR2RVAL(argument->v_string);
|
256
334
|
break;
|
257
335
|
case GI_TYPE_TAG_ARRAY:
|
258
|
-
rb_argument =
|
336
|
+
rb_argument = rb_gi_array_argument_to_ruby(argument, NULL,
|
337
|
+
type_info, NULL);
|
259
338
|
break;
|
260
339
|
case GI_TYPE_TAG_INTERFACE:
|
261
340
|
rb_argument = interface_to_ruby(argument, type_info);
|
@@ -500,6 +579,102 @@ rb_gi_out_argument_to_ruby(GIArgument *argument, GIArgInfo *arg_info)
|
|
500
579
|
return rb_gi_argument_to_ruby(&normalized_argument, &type_info);
|
501
580
|
}
|
502
581
|
|
582
|
+
static void
|
583
|
+
normalize_out_array_length(GIArgument *normalized_argument,
|
584
|
+
GIArgument *argument,
|
585
|
+
GITypeInfo *type_info)
|
586
|
+
{
|
587
|
+
GITypeTag type_tag;
|
588
|
+
|
589
|
+
type_tag = g_type_info_get_tag(type_info);
|
590
|
+
switch (type_tag) {
|
591
|
+
case GI_TYPE_TAG_VOID:
|
592
|
+
case GI_TYPE_TAG_BOOLEAN:
|
593
|
+
rb_raise(rb_eNotImpError,
|
594
|
+
"TODO: invalid out array length argument?: <%s>",
|
595
|
+
g_type_tag_to_string(type_tag));
|
596
|
+
break;
|
597
|
+
case GI_TYPE_TAG_INT8:
|
598
|
+
normalized_argument->v_int8 = *((gint8 *)argument->v_pointer);
|
599
|
+
break;
|
600
|
+
case GI_TYPE_TAG_UINT8:
|
601
|
+
normalized_argument->v_uint8 = *((guint8 *)argument->v_pointer);
|
602
|
+
break;
|
603
|
+
case GI_TYPE_TAG_INT16:
|
604
|
+
normalized_argument->v_int16 = *((gint16 *)argument->v_pointer);
|
605
|
+
break;
|
606
|
+
case GI_TYPE_TAG_UINT16:
|
607
|
+
normalized_argument->v_uint16 = *((guint16 *)argument->v_pointer);
|
608
|
+
break;
|
609
|
+
case GI_TYPE_TAG_INT32:
|
610
|
+
normalized_argument->v_int32 = *((gint32 *)argument->v_pointer);
|
611
|
+
break;
|
612
|
+
case GI_TYPE_TAG_UINT32:
|
613
|
+
normalized_argument->v_uint32 = *((guint32 *)argument->v_pointer);
|
614
|
+
break;
|
615
|
+
case GI_TYPE_TAG_INT64:
|
616
|
+
normalized_argument->v_int64 = *((gint64 *)argument->v_pointer);
|
617
|
+
break;
|
618
|
+
case GI_TYPE_TAG_UINT64:
|
619
|
+
normalized_argument->v_uint64 = *((guint64 *)argument->v_pointer);
|
620
|
+
break;
|
621
|
+
case GI_TYPE_TAG_FLOAT:
|
622
|
+
case GI_TYPE_TAG_DOUBLE:
|
623
|
+
case GI_TYPE_TAG_GTYPE:
|
624
|
+
case GI_TYPE_TAG_UTF8:
|
625
|
+
case GI_TYPE_TAG_FILENAME:
|
626
|
+
case GI_TYPE_TAG_ARRAY:
|
627
|
+
case GI_TYPE_TAG_INTERFACE:
|
628
|
+
case GI_TYPE_TAG_GLIST:
|
629
|
+
case GI_TYPE_TAG_GSLIST:
|
630
|
+
case GI_TYPE_TAG_GHASH:
|
631
|
+
case GI_TYPE_TAG_ERROR:
|
632
|
+
case GI_TYPE_TAG_UNICHAR:
|
633
|
+
rb_raise(rb_eNotImpError,
|
634
|
+
"TODO: invalid out array length argument?: <%s>",
|
635
|
+
g_type_tag_to_string(type_tag));
|
636
|
+
break;
|
637
|
+
default:
|
638
|
+
g_assert_not_reached();
|
639
|
+
break;
|
640
|
+
}
|
641
|
+
}
|
642
|
+
|
643
|
+
VALUE
|
644
|
+
rb_gi_out_array_argument_to_ruby(GIArgument *array_argument,
|
645
|
+
GIArgument *length_argument,
|
646
|
+
GIArgInfo *array_arg_info,
|
647
|
+
GIArgInfo *length_arg_info)
|
648
|
+
{
|
649
|
+
VALUE rb_array;
|
650
|
+
GIArgument normalized_array_argument;
|
651
|
+
GITypeInfo array_type_info;
|
652
|
+
|
653
|
+
normalized_array_argument.v_pointer =
|
654
|
+
*((gpointer *)(array_argument->v_pointer));
|
655
|
+
g_arg_info_load_type(array_arg_info, &array_type_info);
|
656
|
+
if (length_argument) {
|
657
|
+
GITypeInfo length_type_info;
|
658
|
+
GIArgument normalized_length_argument;
|
659
|
+
|
660
|
+
g_arg_info_load_type(length_arg_info, &length_type_info);
|
661
|
+
normalize_out_array_length(&normalized_length_argument,
|
662
|
+
length_argument,
|
663
|
+
&length_type_info);
|
664
|
+
rb_array = rb_gi_array_argument_to_ruby(&normalized_array_argument,
|
665
|
+
&normalized_length_argument,
|
666
|
+
&array_type_info,
|
667
|
+
&length_type_info);
|
668
|
+
} else {
|
669
|
+
rb_array = rb_gi_array_argument_to_ruby(&normalized_array_argument,
|
670
|
+
NULL,
|
671
|
+
&array_type_info,
|
672
|
+
NULL);
|
673
|
+
}
|
674
|
+
|
675
|
+
return rb_array;
|
676
|
+
}
|
677
|
+
|
503
678
|
void
|
504
679
|
rb_gi_out_argument_fin(GIArgument *argument, GIArgInfo *arg_info)
|
505
680
|
{
|
@@ -514,7 +689,7 @@ rb_gi_out_argument_fin(GIArgument *argument, GIArgInfo *arg_info)
|
|
514
689
|
}
|
515
690
|
|
516
691
|
static void
|
517
|
-
rb_gi_return_argument_free_container(GIArgument *argument,
|
692
|
+
rb_gi_return_argument_free_container(G_GNUC_UNUSED GIArgument *argument,
|
518
693
|
GITypeInfo *type_info)
|
519
694
|
{
|
520
695
|
GITypeTag type_tag;
|
@@ -549,15 +724,36 @@ rb_gi_return_argument_free_everything_array(GIArgument *argument,
|
|
549
724
|
}
|
550
725
|
}
|
551
726
|
|
727
|
+
static void
|
728
|
+
rb_gi_return_argument_free_everything_interface_struct(GIArgument *argument,
|
729
|
+
GType gtype)
|
730
|
+
{
|
731
|
+
if (!argument->v_pointer) {
|
732
|
+
return;
|
733
|
+
}
|
734
|
+
|
735
|
+
if (!gtype) {
|
736
|
+
xfree(argument->v_pointer);
|
737
|
+
}
|
738
|
+
|
739
|
+
if (G_TYPE_IS_BOXED(gtype)) {
|
740
|
+
g_boxed_free(gtype, argument->v_pointer);
|
741
|
+
} else {
|
742
|
+
rbgobj_instance_unref(argument->v_pointer);
|
743
|
+
}
|
744
|
+
}
|
745
|
+
|
552
746
|
static void
|
553
747
|
rb_gi_return_argument_free_everything_interface(GIArgument *argument,
|
554
748
|
GITypeInfo *type_info)
|
555
749
|
{
|
556
750
|
GIBaseInfo *interface_info;
|
557
751
|
GIInfoType interface_type;
|
752
|
+
GType gtype;
|
558
753
|
|
559
754
|
interface_info = g_type_info_get_interface(type_info);
|
560
755
|
interface_type = g_base_info_get_type(interface_info);
|
756
|
+
gtype = g_registered_type_info_get_g_type(interface_info);
|
561
757
|
g_base_info_unref(interface_info);
|
562
758
|
|
563
759
|
switch (interface_type) {
|
@@ -574,7 +770,7 @@ rb_gi_return_argument_free_everything_interface(GIArgument *argument,
|
|
574
770
|
"TODO: free GIArgument(interface)[callback] everything");
|
575
771
|
break;
|
576
772
|
case GI_INFO_TYPE_STRUCT:
|
577
|
-
|
773
|
+
rb_gi_return_argument_free_everything_interface_struct(argument, gtype);
|
578
774
|
break;
|
579
775
|
case GI_INFO_TYPE_BOXED:
|
580
776
|
rb_raise(rb_eNotImpError,
|
@@ -594,8 +790,9 @@ rb_gi_return_argument_free_everything_interface(GIArgument *argument,
|
|
594
790
|
}
|
595
791
|
break;
|
596
792
|
case GI_INFO_TYPE_INTERFACE:
|
597
|
-
|
598
|
-
|
793
|
+
if (argument->v_pointer) {
|
794
|
+
g_object_unref(argument->v_pointer);
|
795
|
+
}
|
599
796
|
break;
|
600
797
|
case GI_INFO_TYPE_CONSTANT:
|
601
798
|
rb_raise(rb_eNotImpError,
|
@@ -734,87 +931,6 @@ rb_gi_return_argument_to_ruby(GIArgument *argument,
|
|
734
931
|
return rb_argument;
|
735
932
|
}
|
736
933
|
|
737
|
-
static void
|
738
|
-
rb_gi_argument_from_ruby_array_c(GIArgument *argument,
|
739
|
-
G_GNUC_UNUSED GITypeInfo *type_info,
|
740
|
-
GITypeInfo *element_type_info,
|
741
|
-
VALUE rb_argument)
|
742
|
-
{
|
743
|
-
GITypeTag element_type_tag;
|
744
|
-
|
745
|
-
element_type_tag = g_type_info_get_tag(element_type_info);
|
746
|
-
switch (element_type_tag) {
|
747
|
-
case GI_TYPE_TAG_VOID:
|
748
|
-
case GI_TYPE_TAG_BOOLEAN:
|
749
|
-
rb_raise(rb_eNotImpError,
|
750
|
-
"TODO: Ruby -> GIArgument(array)[%s]",
|
751
|
-
g_type_tag_to_string(element_type_tag));
|
752
|
-
break;
|
753
|
-
case GI_TYPE_TAG_INT8:
|
754
|
-
case GI_TYPE_TAG_UINT8:
|
755
|
-
argument->v_pointer = RSTRING_PTR(rb_argument);
|
756
|
-
break;
|
757
|
-
case GI_TYPE_TAG_INT16:
|
758
|
-
case GI_TYPE_TAG_UINT16:
|
759
|
-
case GI_TYPE_TAG_INT32:
|
760
|
-
case GI_TYPE_TAG_UINT32:
|
761
|
-
case GI_TYPE_TAG_INT64:
|
762
|
-
case GI_TYPE_TAG_UINT64:
|
763
|
-
case GI_TYPE_TAG_FLOAT:
|
764
|
-
case GI_TYPE_TAG_DOUBLE:
|
765
|
-
case GI_TYPE_TAG_GTYPE:
|
766
|
-
rb_raise(rb_eNotImpError,
|
767
|
-
"TODO: Ruby -> GIArgument(array)[%s]",
|
768
|
-
g_type_tag_to_string(element_type_tag));
|
769
|
-
break;
|
770
|
-
case GI_TYPE_TAG_UTF8:
|
771
|
-
case GI_TYPE_TAG_FILENAME:
|
772
|
-
argument->v_pointer = RVAL2STRV(rb_argument);
|
773
|
-
break;
|
774
|
-
case GI_TYPE_TAG_ARRAY:
|
775
|
-
case GI_TYPE_TAG_INTERFACE:
|
776
|
-
case GI_TYPE_TAG_GLIST:
|
777
|
-
case GI_TYPE_TAG_GSLIST:
|
778
|
-
case GI_TYPE_TAG_GHASH:
|
779
|
-
case GI_TYPE_TAG_ERROR:
|
780
|
-
case GI_TYPE_TAG_UNICHAR:
|
781
|
-
rb_raise(rb_eNotImpError,
|
782
|
-
"TODO: Ruby -> GIArgument(array)[%s]",
|
783
|
-
g_type_tag_to_string(element_type_tag));
|
784
|
-
break;
|
785
|
-
default:
|
786
|
-
g_assert_not_reached();
|
787
|
-
break;
|
788
|
-
}
|
789
|
-
}
|
790
|
-
|
791
|
-
static void
|
792
|
-
rb_gi_argument_from_ruby_array(GIArgument *argument, GITypeInfo *type_info,
|
793
|
-
VALUE rb_argument)
|
794
|
-
{
|
795
|
-
GIArrayType array_type;
|
796
|
-
GITypeInfo *element_type_info;
|
797
|
-
|
798
|
-
array_type = g_type_info_get_array_type(type_info);
|
799
|
-
element_type_info = g_type_info_get_param_type(type_info, 0);
|
800
|
-
switch (array_type) {
|
801
|
-
case GI_ARRAY_TYPE_C:
|
802
|
-
rb_gi_argument_from_ruby_array_c(argument,
|
803
|
-
type_info, element_type_info,
|
804
|
-
rb_argument);
|
805
|
-
break;
|
806
|
-
case GI_ARRAY_TYPE_ARRAY:
|
807
|
-
case GI_ARRAY_TYPE_PTR_ARRAY:
|
808
|
-
case GI_ARRAY_TYPE_BYTE_ARRAY:
|
809
|
-
/* TODO */
|
810
|
-
break;
|
811
|
-
default:
|
812
|
-
g_assert_not_reached();
|
813
|
-
break;
|
814
|
-
}
|
815
|
-
g_base_info_unref(element_type_info);
|
816
|
-
}
|
817
|
-
|
818
934
|
static void
|
819
935
|
rb_gi_argument_from_ruby_interface(GIArgument *argument, GITypeInfo *type_info,
|
820
936
|
VALUE rb_argument)
|
@@ -907,6 +1023,20 @@ rb_gi_argument_from_ruby_interface(GIArgument *argument, GITypeInfo *type_info,
|
|
907
1023
|
g_base_info_unref(interface_info);
|
908
1024
|
}
|
909
1025
|
|
1026
|
+
static void
|
1027
|
+
rb_gi_value_argument_from_ruby_void(GIArgument *argument, GITypeInfo *type_info,
|
1028
|
+
VALUE rb_argument)
|
1029
|
+
{
|
1030
|
+
if (!g_type_info_is_pointer(type_info)) {
|
1031
|
+
return;
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
if (RB_TYPE_P(rb_argument, RUBY_T_STRING)) {
|
1035
|
+
argument->v_pointer = RSTRING_PTR(rb_argument);
|
1036
|
+
} else {
|
1037
|
+
argument->v_pointer = GUINT_TO_POINTER(NUM2ULONG(rb_argument));
|
1038
|
+
}
|
1039
|
+
}
|
910
1040
|
|
911
1041
|
GIArgument *
|
912
1042
|
rb_gi_value_argument_from_ruby(GIArgument *argument, GITypeInfo *type_info,
|
@@ -919,9 +1049,7 @@ rb_gi_value_argument_from_ruby(GIArgument *argument, GITypeInfo *type_info,
|
|
919
1049
|
type_tag = g_type_info_get_tag(type_info);
|
920
1050
|
switch (type_tag) {
|
921
1051
|
case GI_TYPE_TAG_VOID:
|
922
|
-
|
923
|
-
argument->v_pointer = GUINT_TO_POINTER(NUM2ULONG(rb_argument));
|
924
|
-
}
|
1052
|
+
rb_gi_value_argument_from_ruby_void(argument, type_info, rb_argument);
|
925
1053
|
break;
|
926
1054
|
case GI_TYPE_TAG_BOOLEAN:
|
927
1055
|
argument->v_boolean = RVAL2CBOOL(rb_argument);
|
@@ -968,7 +1096,9 @@ rb_gi_value_argument_from_ruby(GIArgument *argument, GITypeInfo *type_info,
|
|
968
1096
|
argument->v_string = (gchar *)RVAL2CSTR(rb_argument);
|
969
1097
|
break;
|
970
1098
|
case GI_TYPE_TAG_ARRAY:
|
971
|
-
|
1099
|
+
rb_raise(rb_eNotImpError,
|
1100
|
+
"should not be reached: Ruby -> GIArgument(%s)",
|
1101
|
+
g_type_tag_to_string(type_tag));
|
972
1102
|
break;
|
973
1103
|
case GI_TYPE_TAG_INTERFACE:
|
974
1104
|
rb_gi_argument_from_ruby_interface(argument, type_info, rb_argument);
|
@@ -1058,6 +1188,10 @@ rb_gi_inout_argument_from_ruby(GIArgument *argument,
|
|
1058
1188
|
*((gchar **)argument->v_pointer) = in_argument.v_string;
|
1059
1189
|
break;
|
1060
1190
|
case GI_TYPE_TAG_ARRAY:
|
1191
|
+
rb_raise(rb_eNotImpError,
|
1192
|
+
"should not be reached: Ruby -> GIArgument(%s)",
|
1193
|
+
g_type_tag_to_string(type_tag));
|
1194
|
+
break;
|
1061
1195
|
case GI_TYPE_TAG_INTERFACE:
|
1062
1196
|
case GI_TYPE_TAG_GLIST:
|
1063
1197
|
case GI_TYPE_TAG_GSLIST:
|
@@ -1220,15 +1354,376 @@ rb_gi_in_argument_from_ruby(GIArgument *argument, GIArgInfo *arg_info,
|
|
1220
1354
|
return argument;
|
1221
1355
|
}
|
1222
1356
|
|
1357
|
+
static void
|
1358
|
+
set_in_array_length_argument(GIArgument *argument,
|
1359
|
+
GITypeInfo *type_info,
|
1360
|
+
gint64 length)
|
1361
|
+
{
|
1362
|
+
GITypeTag type_tag;
|
1363
|
+
|
1364
|
+
if (!argument) {
|
1365
|
+
return;
|
1366
|
+
}
|
1367
|
+
|
1368
|
+
type_tag = g_type_info_get_tag(type_info);
|
1369
|
+
switch (type_tag) {
|
1370
|
+
case GI_TYPE_TAG_VOID:
|
1371
|
+
case GI_TYPE_TAG_BOOLEAN:
|
1372
|
+
rb_raise(rb_eNotImpError,
|
1373
|
+
"TODO: invalid argument?: length[%s]",
|
1374
|
+
g_type_tag_to_string(type_tag));
|
1375
|
+
break;
|
1376
|
+
case GI_TYPE_TAG_INT8:
|
1377
|
+
argument->v_int8 = length;
|
1378
|
+
break;
|
1379
|
+
case GI_TYPE_TAG_UINT8:
|
1380
|
+
argument->v_uint8 = length;
|
1381
|
+
break;
|
1382
|
+
case GI_TYPE_TAG_INT16:
|
1383
|
+
argument->v_int16 = length;
|
1384
|
+
break;
|
1385
|
+
case GI_TYPE_TAG_UINT16:
|
1386
|
+
argument->v_uint16 = length;
|
1387
|
+
break;
|
1388
|
+
case GI_TYPE_TAG_INT32:
|
1389
|
+
argument->v_int32 = length;
|
1390
|
+
break;
|
1391
|
+
case GI_TYPE_TAG_UINT32:
|
1392
|
+
argument->v_uint32 = length;
|
1393
|
+
break;
|
1394
|
+
case GI_TYPE_TAG_INT64:
|
1395
|
+
argument->v_int64 = length;
|
1396
|
+
break;
|
1397
|
+
case GI_TYPE_TAG_UINT64:
|
1398
|
+
argument->v_uint64 = length;
|
1399
|
+
break;
|
1400
|
+
case GI_TYPE_TAG_FLOAT:
|
1401
|
+
case GI_TYPE_TAG_DOUBLE:
|
1402
|
+
case GI_TYPE_TAG_GTYPE:
|
1403
|
+
case GI_TYPE_TAG_UTF8:
|
1404
|
+
case GI_TYPE_TAG_FILENAME:
|
1405
|
+
case GI_TYPE_TAG_ARRAY:
|
1406
|
+
case GI_TYPE_TAG_INTERFACE:
|
1407
|
+
case GI_TYPE_TAG_GLIST:
|
1408
|
+
case GI_TYPE_TAG_GSLIST:
|
1409
|
+
case GI_TYPE_TAG_GHASH:
|
1410
|
+
case GI_TYPE_TAG_ERROR:
|
1411
|
+
case GI_TYPE_TAG_UNICHAR:
|
1412
|
+
rb_raise(rb_eNotImpError,
|
1413
|
+
"TODO: invalid argument?: length[%s]",
|
1414
|
+
g_type_tag_to_string(type_tag));
|
1415
|
+
break;
|
1416
|
+
default:
|
1417
|
+
g_assert_not_reached();
|
1418
|
+
break;
|
1419
|
+
}
|
1420
|
+
}
|
1421
|
+
|
1422
|
+
static void
|
1423
|
+
in_array_c_argument_from_ruby(GIArgument *array_argument,
|
1424
|
+
GIArgument *length_argument,
|
1425
|
+
G_GNUC_UNUSED GITypeInfo *array_type_info,
|
1426
|
+
GITypeInfo *length_type_info,
|
1427
|
+
GITypeInfo *element_type_info,
|
1428
|
+
VALUE rb_argument)
|
1429
|
+
{
|
1430
|
+
GITypeTag element_type_tag;
|
1431
|
+
|
1432
|
+
element_type_tag = g_type_info_get_tag(element_type_info);
|
1433
|
+
switch (element_type_tag) {
|
1434
|
+
case GI_TYPE_TAG_VOID:
|
1435
|
+
case GI_TYPE_TAG_BOOLEAN:
|
1436
|
+
rb_raise(rb_eNotImpError,
|
1437
|
+
"TODO: Ruby -> GIArgument(array)[%s]",
|
1438
|
+
g_type_tag_to_string(element_type_tag));
|
1439
|
+
break;
|
1440
|
+
case GI_TYPE_TAG_INT8:
|
1441
|
+
case GI_TYPE_TAG_UINT8:
|
1442
|
+
array_argument->v_pointer = RSTRING_PTR(rb_argument);
|
1443
|
+
set_in_array_length_argument(length_argument, length_type_info,
|
1444
|
+
RSTRING_LEN(rb_argument));
|
1445
|
+
break;
|
1446
|
+
case GI_TYPE_TAG_INT16:
|
1447
|
+
case GI_TYPE_TAG_UINT16:
|
1448
|
+
case GI_TYPE_TAG_INT32:
|
1449
|
+
case GI_TYPE_TAG_UINT32:
|
1450
|
+
case GI_TYPE_TAG_INT64:
|
1451
|
+
case GI_TYPE_TAG_UINT64:
|
1452
|
+
case GI_TYPE_TAG_FLOAT:
|
1453
|
+
case GI_TYPE_TAG_DOUBLE:
|
1454
|
+
case GI_TYPE_TAG_GTYPE:
|
1455
|
+
rb_raise(rb_eNotImpError,
|
1456
|
+
"TODO: Ruby -> GIArgument(array)[%s]",
|
1457
|
+
g_type_tag_to_string(element_type_tag));
|
1458
|
+
break;
|
1459
|
+
case GI_TYPE_TAG_UTF8:
|
1460
|
+
case GI_TYPE_TAG_FILENAME:
|
1461
|
+
array_argument->v_pointer = RVAL2STRV(rb_argument);
|
1462
|
+
set_in_array_length_argument(length_argument, length_type_info,
|
1463
|
+
RARRAY_LEN(rb_argument));
|
1464
|
+
break;
|
1465
|
+
case GI_TYPE_TAG_ARRAY:
|
1466
|
+
case GI_TYPE_TAG_INTERFACE:
|
1467
|
+
case GI_TYPE_TAG_GLIST:
|
1468
|
+
case GI_TYPE_TAG_GSLIST:
|
1469
|
+
case GI_TYPE_TAG_GHASH:
|
1470
|
+
case GI_TYPE_TAG_ERROR:
|
1471
|
+
case GI_TYPE_TAG_UNICHAR:
|
1472
|
+
rb_raise(rb_eNotImpError,
|
1473
|
+
"TODO: Ruby -> GIArgument(array)[%s]",
|
1474
|
+
g_type_tag_to_string(element_type_tag));
|
1475
|
+
break;
|
1476
|
+
default:
|
1477
|
+
g_assert_not_reached();
|
1478
|
+
break;
|
1479
|
+
}
|
1480
|
+
}
|
1481
|
+
|
1482
|
+
static void
|
1483
|
+
in_array_argument_from_ruby(GIArgument *array_argument,
|
1484
|
+
GIArgument *length_argument,
|
1485
|
+
GITypeInfo *array_type_info,
|
1486
|
+
GITypeInfo *length_type_info,
|
1487
|
+
VALUE rb_argument)
|
1488
|
+
{
|
1489
|
+
GIArrayType array_type;
|
1490
|
+
GITypeInfo *element_type_info;
|
1491
|
+
|
1492
|
+
array_type = g_type_info_get_array_type(array_type_info);
|
1493
|
+
element_type_info = g_type_info_get_param_type(array_type_info, 0);
|
1494
|
+
switch (array_type) {
|
1495
|
+
case GI_ARRAY_TYPE_C:
|
1496
|
+
in_array_c_argument_from_ruby(array_argument,
|
1497
|
+
length_argument,
|
1498
|
+
array_type_info,
|
1499
|
+
length_type_info,
|
1500
|
+
element_type_info,
|
1501
|
+
rb_argument);
|
1502
|
+
break;
|
1503
|
+
case GI_ARRAY_TYPE_ARRAY:
|
1504
|
+
case GI_ARRAY_TYPE_PTR_ARRAY:
|
1505
|
+
case GI_ARRAY_TYPE_BYTE_ARRAY:
|
1506
|
+
rb_raise(rb_eNotImpError,
|
1507
|
+
"TODO: Ruby -> GIArgument(array)[%s]",
|
1508
|
+
g_type_tag_to_string(g_type_info_get_tag(element_type_info)));
|
1509
|
+
break;
|
1510
|
+
default:
|
1511
|
+
g_assert_not_reached();
|
1512
|
+
break;
|
1513
|
+
}
|
1514
|
+
g_base_info_unref(element_type_info);
|
1515
|
+
}
|
1516
|
+
|
1517
|
+
static void
|
1518
|
+
set_inout_array_length_argument(GIArgument *argument,
|
1519
|
+
GITypeInfo *type_info,
|
1520
|
+
GIArgument *length)
|
1521
|
+
{
|
1522
|
+
GITypeTag type_tag;
|
1523
|
+
|
1524
|
+
if (!argument) {
|
1525
|
+
return;
|
1526
|
+
}
|
1527
|
+
|
1528
|
+
type_tag = g_type_info_get_tag(type_info);
|
1529
|
+
switch (type_tag) {
|
1530
|
+
case GI_TYPE_TAG_VOID:
|
1531
|
+
case GI_TYPE_TAG_BOOLEAN:
|
1532
|
+
rb_raise(rb_eNotImpError,
|
1533
|
+
"TODO: invalid argument?: length[%s]",
|
1534
|
+
g_type_tag_to_string(type_tag));
|
1535
|
+
break;
|
1536
|
+
case GI_TYPE_TAG_INT8:
|
1537
|
+
argument->v_pointer = ALLOC(gint8);
|
1538
|
+
*((gint8 *)argument->v_pointer) = length->v_int8;
|
1539
|
+
break;
|
1540
|
+
case GI_TYPE_TAG_UINT8:
|
1541
|
+
argument->v_pointer = ALLOC(guint8);
|
1542
|
+
*((guint8 *)argument->v_pointer) = length->v_uint8;
|
1543
|
+
break;
|
1544
|
+
case GI_TYPE_TAG_INT16:
|
1545
|
+
argument->v_pointer = ALLOC(gint16);
|
1546
|
+
*((gint16 *)argument->v_pointer) = length->v_int16;
|
1547
|
+
break;
|
1548
|
+
case GI_TYPE_TAG_UINT16:
|
1549
|
+
argument->v_pointer = ALLOC(guint16);
|
1550
|
+
*((guint16 *)argument->v_pointer) = length->v_uint16;
|
1551
|
+
break;
|
1552
|
+
case GI_TYPE_TAG_INT32:
|
1553
|
+
argument->v_pointer = ALLOC(gint32);
|
1554
|
+
*((gint32 *)argument->v_pointer) = length->v_int32;
|
1555
|
+
break;
|
1556
|
+
case GI_TYPE_TAG_UINT32:
|
1557
|
+
argument->v_pointer = ALLOC(guint32);
|
1558
|
+
*((guint32 *)argument->v_pointer) = length->v_uint32;
|
1559
|
+
break;
|
1560
|
+
case GI_TYPE_TAG_INT64:
|
1561
|
+
argument->v_pointer = ALLOC(gint64);
|
1562
|
+
*((gint64 *)argument->v_pointer) = length->v_int64;
|
1563
|
+
break;
|
1564
|
+
case GI_TYPE_TAG_UINT64:
|
1565
|
+
argument->v_pointer = ALLOC(guint64);
|
1566
|
+
*((guint64 *)argument->v_pointer) = length->v_uint64;
|
1567
|
+
break;
|
1568
|
+
case GI_TYPE_TAG_FLOAT:
|
1569
|
+
case GI_TYPE_TAG_DOUBLE:
|
1570
|
+
case GI_TYPE_TAG_GTYPE:
|
1571
|
+
case GI_TYPE_TAG_UTF8:
|
1572
|
+
case GI_TYPE_TAG_FILENAME:
|
1573
|
+
case GI_TYPE_TAG_ARRAY:
|
1574
|
+
case GI_TYPE_TAG_INTERFACE:
|
1575
|
+
case GI_TYPE_TAG_GLIST:
|
1576
|
+
case GI_TYPE_TAG_GSLIST:
|
1577
|
+
case GI_TYPE_TAG_GHASH:
|
1578
|
+
case GI_TYPE_TAG_ERROR:
|
1579
|
+
case GI_TYPE_TAG_UNICHAR:
|
1580
|
+
rb_raise(rb_eNotImpError,
|
1581
|
+
"TODO: invalid argument?: length[%s]",
|
1582
|
+
g_type_tag_to_string(type_tag));
|
1583
|
+
break;
|
1584
|
+
default:
|
1585
|
+
g_assert_not_reached();
|
1586
|
+
break;
|
1587
|
+
}
|
1588
|
+
}
|
1589
|
+
|
1590
|
+
static void
|
1591
|
+
inout_array_argument_from_ruby(GIArgument *array_argument,
|
1592
|
+
GIArgument *length_argument,
|
1593
|
+
GITypeInfo *array_type_info,
|
1594
|
+
GITypeInfo *length_type_info,
|
1595
|
+
VALUE rb_argument)
|
1596
|
+
{
|
1597
|
+
GIArgument in_array_argument;
|
1598
|
+
GIArgument in_length_argument;
|
1599
|
+
|
1600
|
+
in_array_argument_from_ruby(&in_array_argument,
|
1601
|
+
&in_length_argument,
|
1602
|
+
array_type_info,
|
1603
|
+
length_type_info,
|
1604
|
+
rb_argument);
|
1605
|
+
|
1606
|
+
array_argument->v_pointer = ALLOC(gpointer);
|
1607
|
+
*((gpointer *)array_argument->v_pointer) = in_array_argument.v_pointer;
|
1608
|
+
set_inout_array_length_argument(length_argument,
|
1609
|
+
length_type_info,
|
1610
|
+
&in_length_argument);
|
1611
|
+
}
|
1612
|
+
|
1613
|
+
GIArgument *
|
1614
|
+
rb_gi_in_array_argument_from_ruby(GIArgument *array_argument,
|
1615
|
+
GIArgument *length_argument,
|
1616
|
+
GIArgInfo *array_arg_info,
|
1617
|
+
GIArgInfo *length_arg_info,
|
1618
|
+
VALUE rb_argument)
|
1619
|
+
{
|
1620
|
+
GITypeInfo array_type_info;
|
1621
|
+
GITypeInfo length_type_info;
|
1622
|
+
GITypeInfo *length_type_info_arg = NULL;
|
1623
|
+
|
1624
|
+
if (g_arg_info_may_be_null(array_arg_info) && NIL_P(rb_argument)) {
|
1625
|
+
memset(array_argument, 0, sizeof(GIArgument));
|
1626
|
+
if (length_argument) {
|
1627
|
+
memset(length_argument, 0, sizeof(GIArgument));
|
1628
|
+
}
|
1629
|
+
return array_argument;
|
1630
|
+
}
|
1631
|
+
|
1632
|
+
g_arg_info_load_type(array_arg_info, &array_type_info);
|
1633
|
+
if (length_arg_info) {
|
1634
|
+
g_arg_info_load_type(length_arg_info, &length_type_info);
|
1635
|
+
length_type_info_arg = &length_type_info;
|
1636
|
+
}
|
1637
|
+
if (g_arg_info_get_direction(array_arg_info) == GI_DIRECTION_INOUT) {
|
1638
|
+
inout_array_argument_from_ruby(array_argument,
|
1639
|
+
length_argument,
|
1640
|
+
&array_type_info,
|
1641
|
+
length_type_info_arg,
|
1642
|
+
rb_argument);
|
1643
|
+
} else {
|
1644
|
+
GITransfer transfer;
|
1645
|
+
|
1646
|
+
in_array_argument_from_ruby(array_argument,
|
1647
|
+
length_argument,
|
1648
|
+
&array_type_info,
|
1649
|
+
length_type_info_arg,
|
1650
|
+
rb_argument);
|
1651
|
+
transfer = g_arg_info_get_ownership_transfer(array_arg_info);
|
1652
|
+
rb_gi_in_argument_transfer(array_argument,
|
1653
|
+
transfer,
|
1654
|
+
&array_type_info,
|
1655
|
+
rb_argument);
|
1656
|
+
}
|
1657
|
+
|
1658
|
+
return array_argument;
|
1659
|
+
}
|
1660
|
+
|
1661
|
+
static void
|
1662
|
+
rb_gi_value_argument_free_array_c(GIArgument *argument,
|
1663
|
+
G_GNUC_UNUSED GITypeInfo *type_info,
|
1664
|
+
GITypeInfo *element_type_info)
|
1665
|
+
{
|
1666
|
+
GITypeTag element_type_tag;
|
1667
|
+
|
1668
|
+
element_type_tag = g_type_info_get_tag(element_type_info);
|
1669
|
+
switch (element_type_tag) {
|
1670
|
+
case GI_TYPE_TAG_VOID:
|
1671
|
+
case GI_TYPE_TAG_BOOLEAN:
|
1672
|
+
rb_raise(rb_eNotImpError,
|
1673
|
+
"TODO: free GIArgument(array)[%s]",
|
1674
|
+
g_type_tag_to_string(element_type_tag));
|
1675
|
+
break;
|
1676
|
+
case GI_TYPE_TAG_INT8:
|
1677
|
+
case GI_TYPE_TAG_UINT8:
|
1678
|
+
/* Do nothing */
|
1679
|
+
break;
|
1680
|
+
case GI_TYPE_TAG_INT16:
|
1681
|
+
case GI_TYPE_TAG_UINT16:
|
1682
|
+
case GI_TYPE_TAG_INT32:
|
1683
|
+
case GI_TYPE_TAG_UINT32:
|
1684
|
+
case GI_TYPE_TAG_INT64:
|
1685
|
+
case GI_TYPE_TAG_UINT64:
|
1686
|
+
case GI_TYPE_TAG_FLOAT:
|
1687
|
+
case GI_TYPE_TAG_DOUBLE:
|
1688
|
+
case GI_TYPE_TAG_GTYPE:
|
1689
|
+
rb_raise(rb_eNotImpError,
|
1690
|
+
"TODO: free GIArgument(array)[%s]",
|
1691
|
+
g_type_tag_to_string(element_type_tag));
|
1692
|
+
break;
|
1693
|
+
case GI_TYPE_TAG_UTF8:
|
1694
|
+
case GI_TYPE_TAG_FILENAME:
|
1695
|
+
g_free(argument->v_pointer);
|
1696
|
+
break;
|
1697
|
+
case GI_TYPE_TAG_ARRAY:
|
1698
|
+
case GI_TYPE_TAG_INTERFACE:
|
1699
|
+
case GI_TYPE_TAG_GLIST:
|
1700
|
+
case GI_TYPE_TAG_GSLIST:
|
1701
|
+
case GI_TYPE_TAG_GHASH:
|
1702
|
+
case GI_TYPE_TAG_ERROR:
|
1703
|
+
case GI_TYPE_TAG_UNICHAR:
|
1704
|
+
rb_raise(rb_eNotImpError,
|
1705
|
+
"TODO: free GIArgument(array)[%s]",
|
1706
|
+
g_type_tag_to_string(element_type_tag));
|
1707
|
+
break;
|
1708
|
+
default:
|
1709
|
+
g_assert_not_reached();
|
1710
|
+
break;
|
1711
|
+
}
|
1712
|
+
}
|
1713
|
+
|
1223
1714
|
static void
|
1224
1715
|
rb_gi_value_argument_free_array(GIArgument *argument, GITypeInfo *type_info)
|
1225
1716
|
{
|
1226
1717
|
GIArrayType array_type;
|
1718
|
+
GITypeInfo *element_type_info;
|
1227
1719
|
|
1228
1720
|
array_type = g_type_info_get_array_type(type_info);
|
1721
|
+
element_type_info = g_type_info_get_param_type(type_info, 0);
|
1229
1722
|
switch (array_type) {
|
1230
1723
|
case GI_ARRAY_TYPE_C:
|
1231
|
-
|
1724
|
+
rb_gi_value_argument_free_array_c(argument,
|
1725
|
+
type_info,
|
1726
|
+
element_type_info);
|
1232
1727
|
break;
|
1233
1728
|
case GI_ARRAY_TYPE_ARRAY:
|
1234
1729
|
case GI_ARRAY_TYPE_PTR_ARRAY:
|
@@ -1238,6 +1733,7 @@ rb_gi_value_argument_free_array(GIArgument *argument, GITypeInfo *type_info)
|
|
1238
1733
|
g_assert_not_reached();
|
1239
1734
|
break;
|
1240
1735
|
}
|
1736
|
+
g_base_info_unref(element_type_info);
|
1241
1737
|
}
|
1242
1738
|
|
1243
1739
|
static void
|