gobject-introspection 3.4.9 → 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 +22 -19
- data/ext/gobject-introspection/rb-gi-arguments-out.c +17 -17
- data/ext/gobject-introspection/rb-gi-arguments.c +1908 -53
- 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-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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a24154a126cda02fe928d6a88fb2c31352281fd36df4371ee450339962aa322f
|
4
|
+
data.tar.gz: b91549d9c20aaa75735dcc75851d359c85368b17fbbbc058a345d0041e063e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24ee47b97392a89035459cc04f69c6f9fbd65371304446b5b5b61d61b0555dacd94a2ca0f720b451254b7bf3f5afd0285362819b4707f95bd9fad91d241765cf
|
7
|
+
data.tar.gz: bb32ddd70238b06c68349c237aec55a1f44a48ea9a712cc5eba4c4fd0b5f30a6ae8651288746f5f7ef48d88c7f2d6295d8fe6f1d90a65409537696efd6fa44ff
|
@@ -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
|
@@ -23,6 +23,41 @@
|
|
23
23
|
#define RG_TARGET_NAMESPACE rb_cGIArgInfo
|
24
24
|
#define SELF(self) (RVAL2GI_ARG_INFO(self))
|
25
25
|
|
26
|
+
gboolean
|
27
|
+
rb_gi_arg_info_is_input_buffer(GIArgInfo *info)
|
28
|
+
{
|
29
|
+
if (g_arg_info_get_direction(info) != GI_DIRECTION_IN) {
|
30
|
+
return FALSE;
|
31
|
+
}
|
32
|
+
|
33
|
+
/* Heuristic */
|
34
|
+
const gchar *name = g_base_info_get_name((GIBaseInfo *)info);
|
35
|
+
if (strcmp(name, "buffer") != 0) {
|
36
|
+
return FALSE;
|
37
|
+
}
|
38
|
+
|
39
|
+
GITypeInfo type_info;
|
40
|
+
g_arg_info_load_type(info, &type_info);
|
41
|
+
if (g_type_info_get_tag(&type_info) != GI_TYPE_TAG_ARRAY) {
|
42
|
+
return FALSE;
|
43
|
+
}
|
44
|
+
|
45
|
+
GIArrayType array_type = g_type_info_get_array_type(&type_info);
|
46
|
+
if (array_type != GI_ARRAY_TYPE_C) {
|
47
|
+
return FALSE;
|
48
|
+
}
|
49
|
+
|
50
|
+
gint length_index = g_type_info_get_array_length(&type_info);
|
51
|
+
if (length_index == -1) {
|
52
|
+
return FALSE;
|
53
|
+
}
|
54
|
+
|
55
|
+
GITypeInfo *element_type_info = g_type_info_get_param_type(&type_info, 0);
|
56
|
+
GITypeTag element_type_tag = g_type_info_get_tag(element_type_info);
|
57
|
+
g_base_info_unref(element_type_info);
|
58
|
+
return element_type_tag == GI_TYPE_TAG_UINT8;
|
59
|
+
}
|
60
|
+
|
26
61
|
gboolean
|
27
62
|
rb_gi_arg_info_is_output_buffer(GIArgInfo *info)
|
28
63
|
{
|
@@ -148,6 +183,13 @@ rg_type(VALUE self)
|
|
148
183
|
return GI_BASE_INFO2RVAL_WITH_UNREF(g_arg_info_get_type(info));
|
149
184
|
}
|
150
185
|
|
186
|
+
static VALUE
|
187
|
+
rg_input_buffer_p(VALUE self)
|
188
|
+
{
|
189
|
+
GIArgInfo *info = SELF(self);
|
190
|
+
return CBOOL2RVAL(rb_gi_arg_info_is_input_buffer(info));
|
191
|
+
}
|
192
|
+
|
151
193
|
static VALUE
|
152
194
|
rg_output_buffer_p(VALUE self)
|
153
195
|
{
|
@@ -175,6 +217,7 @@ rb_gi_arg_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo)
|
|
175
217
|
RG_DEF_METHOD(destroy, 0);
|
176
218
|
RG_DEF_METHOD(type, 0);
|
177
219
|
|
220
|
+
RG_DEF_METHOD_P(input_buffer, 0);
|
178
221
|
RG_DEF_METHOD_P(output_buffer, 0);
|
179
222
|
|
180
223
|
G_DEF_CLASS(G_TYPE_I_DIRECTION, "Direction", rb_mGI);
|
@@ -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
|
@@ -36,7 +36,6 @@ rb_gi_arguments_in_to_ruby(RBGIArguments *args)
|
|
36
36
|
rb_in_args = rb_ary_new_capa(args->metadata->len);
|
37
37
|
for (i = 0; i < args->metadata->len; i++) {
|
38
38
|
RBGIArgMetadata *metadata;
|
39
|
-
GITypeInfo *type_info;
|
40
39
|
VALUE rb_arg;
|
41
40
|
|
42
41
|
metadata = g_ptr_array_index(args->metadata, i);
|
@@ -47,15 +46,14 @@ rb_gi_arguments_in_to_ruby(RBGIArguments *args)
|
|
47
46
|
if (metadata->closure_p) {
|
48
47
|
continue;
|
49
48
|
}
|
49
|
+
if (metadata->array_length_p) {
|
50
|
+
continue;
|
51
|
+
}
|
50
52
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
type_info,
|
56
|
-
args->in_args,
|
57
|
-
args->out_args,
|
58
|
-
args->metadata);
|
53
|
+
rb_arg = rb_gi_arguments_convert_arg(args,
|
54
|
+
metadata->in_arg,
|
55
|
+
metadata,
|
56
|
+
FALSE);
|
59
57
|
rb_ary_push(rb_in_args, rb_arg);
|
60
58
|
}
|
61
59
|
|
@@ -2023,16 +2021,18 @@ rb_gi_arguments_in_init_arg_raw_interface(RBGIArguments *args,
|
|
2023
2021
|
metadata->in_arg->v_pointer = *((gpointer *)(args->raw_args[metadata->index]));
|
2024
2022
|
break;
|
2025
2023
|
case GI_INFO_TYPE_BOXED:
|
2024
|
+
rb_raise(rb_eNotImpError,
|
2025
|
+
"TODO: %s::%s: raw argument -> GIArgument(interface)[%s]: <%s>",
|
2026
|
+
g_base_info_get_namespace(args->info),
|
2027
|
+
g_base_info_get_name(args->info),
|
2028
|
+
g_info_type_to_string(metadata->type.interface_type),
|
2029
|
+
g_base_info_get_name(metadata->type.interface_info));
|
2030
|
+
break;
|
2026
2031
|
case GI_INFO_TYPE_ENUM:
|
2027
|
-
|
2028
|
-
|
2029
|
-
g_base_info_get_namespace(args->info),
|
2030
|
-
g_base_info_get_name(args->info),
|
2031
|
-
g_info_type_to_string(metadata->type.interface_type),
|
2032
|
-
g_base_info_get_name(metadata->type.interface_info));
|
2033
|
-
break;
|
2032
|
+
metadata->in_arg->v_int32 = *((gint32 *)(args->raw_args[metadata->index]));
|
2033
|
+
break;
|
2034
2034
|
case GI_INFO_TYPE_FLAGS:
|
2035
|
-
metadata->in_arg->v_int32= *((gint32 *)(args->raw_args[metadata->index]));
|
2035
|
+
metadata->in_arg->v_int32 = *((gint32 *)(args->raw_args[metadata->index]));
|
2036
2036
|
break;
|
2037
2037
|
case GI_INFO_TYPE_OBJECT:
|
2038
2038
|
case GI_INFO_TYPE_INTERFACE:
|
@@ -2164,12 +2164,15 @@ rb_gi_arguments_in_init(RBGIArguments *args)
|
|
2164
2164
|
void
|
2165
2165
|
rb_gi_arguments_in_clear(RBGIArguments *args)
|
2166
2166
|
{
|
2167
|
-
|
2167
|
+
if (!args->metadata) {
|
2168
|
+
return;
|
2169
|
+
}
|
2168
2170
|
|
2169
2171
|
if (!args->rb_mode_p) {
|
2170
2172
|
return;
|
2171
2173
|
}
|
2172
2174
|
|
2175
|
+
guint i;
|
2173
2176
|
for (i = 0; i < args->metadata->len; i++) {
|
2174
2177
|
RBGIArgMetadata *metadata;
|
2175
2178
|
|
@@ -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
|
@@ -140,6 +140,7 @@ rb_gi_arguments_out_free_array_array_interface_struct(RBGIArguments *args,
|
|
140
140
|
*/
|
141
141
|
break;
|
142
142
|
}
|
143
|
+
G_GNUC_FALLTHROUGH;
|
143
144
|
default:
|
144
145
|
rb_raise(rb_eNotImpError,
|
145
146
|
"TODO: [%s] %s free GIArgument(%s/%s)[interface(%s)](%s)[%s]",
|
@@ -150,6 +151,7 @@ rb_gi_arguments_out_free_array_array_interface_struct(RBGIArguments *args,
|
|
150
151
|
g_info_type_to_string(metadata->element_type.interface_type),
|
151
152
|
g_type_name(metadata->element_type.interface_gtype),
|
152
153
|
rb_gi_transfer_to_string(metadata->transfer));
|
154
|
+
break;
|
153
155
|
}
|
154
156
|
g_array_free(target, TRUE);
|
155
157
|
}
|
@@ -264,14 +266,6 @@ rb_gi_arguments_out_free_error(RBGIArguments *args,
|
|
264
266
|
gpointer user_data)
|
265
267
|
{
|
266
268
|
GError **target = metadata->out_arg->v_pointer;
|
267
|
-
if (metadata->transfer != GI_TRANSFER_NOTHING) {
|
268
|
-
rb_raise(rb_eNotImpError,
|
269
|
-
"TODO: [%s] %s free GIArgument(%s)[%s]",
|
270
|
-
metadata->name,
|
271
|
-
rb_gi_direction_to_string(metadata->direction),
|
272
|
-
g_type_tag_to_string(metadata->type.tag),
|
273
|
-
rb_gi_transfer_to_string(metadata->transfer));
|
274
|
-
}
|
275
269
|
xfree(target);
|
276
270
|
}
|
277
271
|
|
@@ -315,7 +309,12 @@ rb_gi_arguments_out_init_arg_array_c(RBGIArguments *args,
|
|
315
309
|
rb_gi_transfer_to_string(metadata->transfer));
|
316
310
|
}
|
317
311
|
argument->v_pointer = RSTRING_PTR(metadata->rb_arg);
|
318
|
-
|
312
|
+
if (length_metadata->in_arg) {
|
313
|
+
length_metadata->in_arg->v_size = RSTRING_LEN(metadata->rb_arg);
|
314
|
+
}
|
315
|
+
if (length_metadata->out_arg) {
|
316
|
+
length_metadata->out_arg->v_size = RSTRING_LEN(metadata->rb_arg);
|
317
|
+
}
|
319
318
|
} else {
|
320
319
|
argument->v_pointer = ALLOC(guint8 *);
|
321
320
|
metadata->free_func = rb_gi_arguments_out_free_array_c_uint8;
|
@@ -788,8 +787,11 @@ rb_gi_arguments_out_init(RBGIArguments *args)
|
|
788
787
|
void
|
789
788
|
rb_gi_arguments_out_clear(RBGIArguments *args)
|
790
789
|
{
|
791
|
-
|
790
|
+
if (!args->metadata) {
|
791
|
+
return;
|
792
|
+
}
|
792
793
|
|
794
|
+
guint i;
|
793
795
|
for (i = 0; i < args->metadata->len; i++) {
|
794
796
|
RBGIArgMetadata *metadata;
|
795
797
|
|
@@ -887,12 +889,10 @@ rb_gi_arguments_out_to_ruby_arg(RBGIArguments *args,
|
|
887
889
|
break;
|
888
890
|
}
|
889
891
|
|
890
|
-
return
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
args->out_args,
|
895
|
-
args->metadata);
|
892
|
+
return rb_gi_arguments_convert_arg(args,
|
893
|
+
&normalized_argument,
|
894
|
+
metadata,
|
895
|
+
duplicate);
|
896
896
|
}
|
897
897
|
|
898
898
|
VALUE
|