gobject-introspection 3.4.3 → 3.4.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gobject-introspection/extconf.rb +1 -4
  3. data/ext/gobject-introspection/gobject-introspection-enum-types.c +230 -0
  4. data/ext/gobject-introspection/gobject-introspection-enum-types.h +42 -0
  5. data/ext/gobject-introspection/rb-gi-argument.c +11 -4
  6. data/ext/gobject-introspection/rb-gi-arguments-in.c +28 -108
  7. data/ext/gobject-introspection/rb-gi-arguments-out.c +20 -2
  8. data/ext/gobject-introspection/rb-gi-arguments.c +244 -18
  9. data/ext/gobject-introspection/rb-gi-base-info.c +11 -1
  10. data/ext/gobject-introspection/rb-gi-callable-info.c +10 -2
  11. data/ext/gobject-introspection/rb-gi-callback.c +156 -2
  12. data/ext/gobject-introspection/rb-gi-conversions.h +6 -6
  13. data/ext/gobject-introspection/rb-gi-interface-info.c +1 -7
  14. data/ext/gobject-introspection/rb-gi-loader.c +60 -12
  15. data/ext/gobject-introspection/rb-gi-object-info.c +11 -1
  16. data/ext/gobject-introspection/rb-gi-private-arguments-in.h +3 -1
  17. data/ext/gobject-introspection/rb-gi-private-arguments.h +5 -1
  18. data/ext/gobject-introspection/rb-gi-private-callback.h +6 -3
  19. data/ext/gobject-introspection/rb-gi-private.h +1 -0
  20. data/ext/gobject-introspection/rb-gi-repository.c +1 -1
  21. data/ext/gobject-introspection/rb-gi-struct-info.c +15 -3
  22. data/ext/gobject-introspection/rb-gi-vfunc-info.c +2 -2
  23. data/ext/gobject-introspection/rb-gobject-introspection.c +231 -0
  24. data/ext/gobject-introspection/rbgiversion.h +24 -0
  25. data/lib/gobject-introspection/loader.rb +65 -1
  26. data/test/gobject-introspection-test-utils.rb +2 -2
  27. data/test/run-test.rb +18 -25
  28. data/test/test-base-info.rb +5 -1
  29. data/test/test-callable-info.rb +16 -2
  30. data/test/test-loader.rb +53 -7
  31. data/test/test-object-info.rb +5 -1
  32. data/test/test-struct-info.rb +6 -1
  33. metadata +8 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49167989e84276d322d8ec6fc0e7a189924c62b5ff7daccfb76040284c75909d
4
- data.tar.gz: 045e683e7f9ffef5731b9763cada4c841243fda0ac14622cff3612454dc72ae3
3
+ metadata.gz: 46669e91b4af175368180fc2152330751da6a7a240f942e6d7acef846822fdf7
4
+ data.tar.gz: 0456bafef2aca2d5c43dff46556b11d181251bc95e455b3de4b12d9ddc298f87
5
5
  SHA512:
6
- metadata.gz: d8ca3007506eb8d0a91ba925678de9bbe3a1b3c2d295a968f47a1035efc031d6d8e254bb814c3638abfc415263cf991cbb9e60ff598585d2baa9b4ac02cb3ed8
7
- data.tar.gz: eaf8f55fb4cf71eba636f840e8bcfea3850f127736fd9ae650fb6d8d981d31d7618a6c78e22f887d22e436f1c5fd6a897cf260281ab054b89fe560eac761db00
6
+ metadata.gz: a5a15ad2b14adf1be44f0924eb002c24256c77c30016f5fa0734d0035e1a5842ca70edb624614da61c8f3065bcf1f4bc832685cfc383a0e3daa5e5aa020bb312
7
+ data.tar.gz: e5e058654ef3ac94dd75dd1c247ee3c68fcda15eb7996f9523688ae77f6f5a7e7d3943f450864aa4acbc94cefa6da6da0a6aec221eaca9bba8de3087a853ad4d
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright (C) 2012-2019 Ruby-GNOME Project Team
3
+ # Copyright (C) 2012-2021 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
@@ -62,9 +62,6 @@ end
62
62
  # TODO: Remove this when we dropped support for GObject Introspection < 1.60
63
63
  make_version_header("GI", package_id, ".")
64
64
 
65
- gi_headers = ["girepository.h"]
66
- have_func("g_interface_info_find_signal", gi_headers)
67
-
68
65
  enum_type_prefix = "gobject-introspection-enum-types"
69
66
  include_paths = PKGConfig.cflags_only_I(package_id)
70
67
  headers = include_paths.split.inject([]) do |result, path|
@@ -0,0 +1,230 @@
1
+
2
+ /* Generated by glib-mkenums.rb ($Id$) */
3
+
4
+ #include "gobject-introspection-enum-types.h"
5
+ #include <girepository.h>
6
+
7
+
8
+
9
+ /* enumerations from "/usr/include/gobject-introspection-1.0/girepository.h" */
10
+ GType
11
+ g_i_repository_load_flags_get_type (void)
12
+ {
13
+ static GType etype = 0;
14
+ if (etype == 0) {
15
+ static const GFlagsValue values[] = {
16
+ { G_IREPOSITORY_LOAD_FLAG_LAZY, "G_IREPOSITORY_LOAD_FLAG_LAZY", "g-irepository-load-flag-lazy" },
17
+ { 0, NULL, NULL }
18
+ };
19
+ etype = g_flags_register_static ("GIRepositoryLoadFlags", values);
20
+ }
21
+ return etype;
22
+ }
23
+
24
+ GType
25
+ g_i_repository_error_get_type (void)
26
+ {
27
+ static GType etype = 0;
28
+ if (etype == 0) {
29
+ static const GEnumValue values[] = {
30
+ { G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND, "G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND", "typelib-not-found" },
31
+ { G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH, "G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH", "namespace-mismatch" },
32
+ { G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT, "G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT", "namespace-version-conflict" },
33
+ { G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND, "G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND", "library-not-found" },
34
+ { 0, NULL, NULL }
35
+ };
36
+ etype = g_enum_register_static ("GIRepositoryError", values);
37
+ }
38
+ return etype;
39
+ }
40
+
41
+
42
+ /* enumerations from "/usr/include/gobject-introspection-1.0/gitypes.h" */
43
+ GType
44
+ g_i_info_type_get_type (void)
45
+ {
46
+ static GType etype = 0;
47
+ if (etype == 0) {
48
+ static const GEnumValue values[] = {
49
+ { GI_INFO_TYPE_INVALID, "GI_INFO_TYPE_INVALID", "invalid" },
50
+ { GI_INFO_TYPE_FUNCTION, "GI_INFO_TYPE_FUNCTION", "function" },
51
+ { GI_INFO_TYPE_CALLBACK, "GI_INFO_TYPE_CALLBACK", "callback" },
52
+ { GI_INFO_TYPE_STRUCT, "GI_INFO_TYPE_STRUCT", "struct" },
53
+ { GI_INFO_TYPE_BOXED, "GI_INFO_TYPE_BOXED", "boxed" },
54
+ { GI_INFO_TYPE_ENUM, "GI_INFO_TYPE_ENUM", "enum" },
55
+ { GI_INFO_TYPE_FLAGS, "GI_INFO_TYPE_FLAGS", "flags" },
56
+ { GI_INFO_TYPE_OBJECT, "GI_INFO_TYPE_OBJECT", "object" },
57
+ { GI_INFO_TYPE_INTERFACE, "GI_INFO_TYPE_INTERFACE", "interface" },
58
+ { GI_INFO_TYPE_CONSTANT, "GI_INFO_TYPE_CONSTANT", "constant" },
59
+ { GI_INFO_TYPE_INVALID_0, "GI_INFO_TYPE_INVALID_0", "invalid-0" },
60
+ { GI_INFO_TYPE_UNION, "GI_INFO_TYPE_UNION", "union" },
61
+ { GI_INFO_TYPE_VALUE, "GI_INFO_TYPE_VALUE", "value" },
62
+ { GI_INFO_TYPE_SIGNAL, "GI_INFO_TYPE_SIGNAL", "signal" },
63
+ { GI_INFO_TYPE_VFUNC, "GI_INFO_TYPE_VFUNC", "vfunc" },
64
+ { GI_INFO_TYPE_PROPERTY, "GI_INFO_TYPE_PROPERTY", "property" },
65
+ { GI_INFO_TYPE_FIELD, "GI_INFO_TYPE_FIELD", "field" },
66
+ { GI_INFO_TYPE_ARG, "GI_INFO_TYPE_ARG", "arg" },
67
+ { GI_INFO_TYPE_TYPE, "GI_INFO_TYPE_TYPE", "type" },
68
+ { GI_INFO_TYPE_UNRESOLVED, "GI_INFO_TYPE_UNRESOLVED", "unresolved" },
69
+ { 0, NULL, NULL }
70
+ };
71
+ etype = g_enum_register_static ("GIInfoType", values);
72
+ }
73
+ return etype;
74
+ }
75
+
76
+ GType
77
+ g_i_transfer_get_type (void)
78
+ {
79
+ static GType etype = 0;
80
+ if (etype == 0) {
81
+ static const GEnumValue values[] = {
82
+ { GI_TRANSFER_NOTHING, "GI_TRANSFER_NOTHING", "nothing" },
83
+ { GI_TRANSFER_CONTAINER, "GI_TRANSFER_CONTAINER", "container" },
84
+ { GI_TRANSFER_EVERYTHING, "GI_TRANSFER_EVERYTHING", "everything" },
85
+ { 0, NULL, NULL }
86
+ };
87
+ etype = g_enum_register_static ("GITransfer", values);
88
+ }
89
+ return etype;
90
+ }
91
+
92
+ GType
93
+ g_i_direction_get_type (void)
94
+ {
95
+ static GType etype = 0;
96
+ if (etype == 0) {
97
+ static const GEnumValue values[] = {
98
+ { GI_DIRECTION_IN, "GI_DIRECTION_IN", "in" },
99
+ { GI_DIRECTION_OUT, "GI_DIRECTION_OUT", "out" },
100
+ { GI_DIRECTION_INOUT, "GI_DIRECTION_INOUT", "inout" },
101
+ { 0, NULL, NULL }
102
+ };
103
+ etype = g_enum_register_static ("GIDirection", values);
104
+ }
105
+ return etype;
106
+ }
107
+
108
+ GType
109
+ g_i_scope_type_get_type (void)
110
+ {
111
+ static GType etype = 0;
112
+ if (etype == 0) {
113
+ static const GEnumValue values[] = {
114
+ { GI_SCOPE_TYPE_INVALID, "GI_SCOPE_TYPE_INVALID", "invalid" },
115
+ { GI_SCOPE_TYPE_CALL, "GI_SCOPE_TYPE_CALL", "call" },
116
+ { GI_SCOPE_TYPE_ASYNC, "GI_SCOPE_TYPE_ASYNC", "async" },
117
+ { GI_SCOPE_TYPE_NOTIFIED, "GI_SCOPE_TYPE_NOTIFIED", "notified" },
118
+ { 0, NULL, NULL }
119
+ };
120
+ etype = g_enum_register_static ("GIScopeType", values);
121
+ }
122
+ return etype;
123
+ }
124
+
125
+ GType
126
+ g_i_type_tag_get_type (void)
127
+ {
128
+ static GType etype = 0;
129
+ if (etype == 0) {
130
+ static const GEnumValue values[] = {
131
+ { GI_TYPE_TAG_VOID, "GI_TYPE_TAG_VOID", "void" },
132
+ { GI_TYPE_TAG_BOOLEAN, "GI_TYPE_TAG_BOOLEAN", "boolean" },
133
+ { GI_TYPE_TAG_INT8, "GI_TYPE_TAG_INT8", "int8" },
134
+ { GI_TYPE_TAG_UINT8, "GI_TYPE_TAG_UINT8", "uint8" },
135
+ { GI_TYPE_TAG_INT16, "GI_TYPE_TAG_INT16", "int16" },
136
+ { GI_TYPE_TAG_UINT16, "GI_TYPE_TAG_UINT16", "uint16" },
137
+ { GI_TYPE_TAG_INT32, "GI_TYPE_TAG_INT32", "int32" },
138
+ { GI_TYPE_TAG_UINT32, "GI_TYPE_TAG_UINT32", "uint32" },
139
+ { GI_TYPE_TAG_INT64, "GI_TYPE_TAG_INT64", "int64" },
140
+ { GI_TYPE_TAG_UINT64, "GI_TYPE_TAG_UINT64", "uint64" },
141
+ { GI_TYPE_TAG_FLOAT, "GI_TYPE_TAG_FLOAT", "float" },
142
+ { GI_TYPE_TAG_DOUBLE, "GI_TYPE_TAG_DOUBLE", "double" },
143
+ { GI_TYPE_TAG_GTYPE, "GI_TYPE_TAG_GTYPE", "gtype" },
144
+ { GI_TYPE_TAG_UTF8, "GI_TYPE_TAG_UTF8", "utf8" },
145
+ { GI_TYPE_TAG_FILENAME, "GI_TYPE_TAG_FILENAME", "filename" },
146
+ { GI_TYPE_TAG_ARRAY, "GI_TYPE_TAG_ARRAY", "array" },
147
+ { GI_TYPE_TAG_INTERFACE, "GI_TYPE_TAG_INTERFACE", "interface" },
148
+ { GI_TYPE_TAG_GLIST, "GI_TYPE_TAG_GLIST", "glist" },
149
+ { GI_TYPE_TAG_GSLIST, "GI_TYPE_TAG_GSLIST", "gslist" },
150
+ { GI_TYPE_TAG_GHASH, "GI_TYPE_TAG_GHASH", "ghash" },
151
+ { GI_TYPE_TAG_ERROR, "GI_TYPE_TAG_ERROR", "error" },
152
+ { GI_TYPE_TAG_UNICHAR, "GI_TYPE_TAG_UNICHAR", "unichar" },
153
+ { 0, NULL, NULL }
154
+ };
155
+ etype = g_enum_register_static ("GITypeTag", values);
156
+ }
157
+ return etype;
158
+ }
159
+
160
+ GType
161
+ g_i_array_type_get_type (void)
162
+ {
163
+ static GType etype = 0;
164
+ if (etype == 0) {
165
+ static const GEnumValue values[] = {
166
+ { GI_ARRAY_TYPE_C, "GI_ARRAY_TYPE_C", "c" },
167
+ { GI_ARRAY_TYPE_ARRAY, "GI_ARRAY_TYPE_ARRAY", "array" },
168
+ { GI_ARRAY_TYPE_PTR_ARRAY, "GI_ARRAY_TYPE_PTR_ARRAY", "ptr-array" },
169
+ { GI_ARRAY_TYPE_BYTE_ARRAY, "GI_ARRAY_TYPE_BYTE_ARRAY", "byte-array" },
170
+ { 0, NULL, NULL }
171
+ };
172
+ etype = g_enum_register_static ("GIArrayType", values);
173
+ }
174
+ return etype;
175
+ }
176
+
177
+ GType
178
+ g_i_field_info_flags_get_type (void)
179
+ {
180
+ static GType etype = 0;
181
+ if (etype == 0) {
182
+ static const GFlagsValue values[] = {
183
+ { GI_FIELD_IS_READABLE, "GI_FIELD_IS_READABLE", "readable" },
184
+ { GI_FIELD_IS_WRITABLE, "GI_FIELD_IS_WRITABLE", "writable" },
185
+ { 0, NULL, NULL }
186
+ };
187
+ etype = g_flags_register_static ("GIFieldInfoFlags", values);
188
+ }
189
+ return etype;
190
+ }
191
+
192
+ GType
193
+ g_iv_func_info_flags_get_type (void)
194
+ {
195
+ static GType etype = 0;
196
+ if (etype == 0) {
197
+ static const GFlagsValue values[] = {
198
+ { GI_VFUNC_MUST_CHAIN_UP, "GI_VFUNC_MUST_CHAIN_UP", "must-chain-up" },
199
+ { GI_VFUNC_MUST_OVERRIDE, "GI_VFUNC_MUST_OVERRIDE", "must-override" },
200
+ { GI_VFUNC_MUST_NOT_OVERRIDE, "GI_VFUNC_MUST_NOT_OVERRIDE", "must-not-override" },
201
+ { GI_VFUNC_THROWS, "GI_VFUNC_THROWS", "throws" },
202
+ { 0, NULL, NULL }
203
+ };
204
+ etype = g_flags_register_static ("GIVFuncInfoFlags", values);
205
+ }
206
+ return etype;
207
+ }
208
+
209
+ GType
210
+ g_i_function_info_flags_get_type (void)
211
+ {
212
+ static GType etype = 0;
213
+ if (etype == 0) {
214
+ static const GFlagsValue values[] = {
215
+ { GI_FUNCTION_IS_METHOD, "GI_FUNCTION_IS_METHOD", "is-method" },
216
+ { GI_FUNCTION_IS_CONSTRUCTOR, "GI_FUNCTION_IS_CONSTRUCTOR", "is-constructor" },
217
+ { GI_FUNCTION_IS_GETTER, "GI_FUNCTION_IS_GETTER", "is-getter" },
218
+ { GI_FUNCTION_IS_SETTER, "GI_FUNCTION_IS_SETTER", "is-setter" },
219
+ { GI_FUNCTION_WRAPS_VFUNC, "GI_FUNCTION_WRAPS_VFUNC", "wraps-vfunc" },
220
+ { GI_FUNCTION_THROWS, "GI_FUNCTION_THROWS", "throws" },
221
+ { 0, NULL, NULL }
222
+ };
223
+ etype = g_flags_register_static ("GIFunctionInfoFlags", values);
224
+ }
225
+ return etype;
226
+ }
227
+
228
+
229
+ /* Generated data ends here */
230
+
@@ -0,0 +1,42 @@
1
+
2
+ /* Generated by glib-mkenums.rb ($Id$) */
3
+
4
+ #ifndef __GOBJECT_INTROSPECTION_ENUM_TYPES_H__
5
+ #define __GOBJECT_INTROSPECTION_ENUM_TYPES_H__
6
+
7
+ #include <glib-object.h>
8
+
9
+ G_BEGIN_DECLS
10
+
11
+ /* enumerations from "/usr/include/gobject-introspection-1.0/girepository.h" */
12
+ GType g_i_repository_load_flags_get_type (void);
13
+ #define G_TYPE_I_REPOSITORY_LOAD_FLAGS (g_i_repository_load_flags_get_type())
14
+ GType g_i_repository_error_get_type (void);
15
+ #define G_TYPE_I_REPOSITORY_ERROR (g_i_repository_error_get_type())
16
+
17
+ /* enumerations from "/usr/include/gobject-introspection-1.0/gitypes.h" */
18
+ GType g_i_info_type_get_type (void);
19
+ #define G_TYPE_I_INFO_TYPE (g_i_info_type_get_type())
20
+ GType g_i_transfer_get_type (void);
21
+ #define G_TYPE_I_TRANSFER (g_i_transfer_get_type())
22
+ GType g_i_direction_get_type (void);
23
+ #define G_TYPE_I_DIRECTION (g_i_direction_get_type())
24
+ GType g_i_scope_type_get_type (void);
25
+ #define G_TYPE_I_SCOPE_TYPE (g_i_scope_type_get_type())
26
+ GType g_i_type_tag_get_type (void);
27
+ #define G_TYPE_I_TYPE_TAG (g_i_type_tag_get_type())
28
+ GType g_i_array_type_get_type (void);
29
+ #define G_TYPE_I_ARRAY_TYPE (g_i_array_type_get_type())
30
+ GType g_i_field_info_flags_get_type (void);
31
+ #define G_TYPE_I_FIELD_INFO_FLAGS (g_i_field_info_flags_get_type())
32
+ GType g_iv_func_info_flags_get_type (void);
33
+ #define G_TYPE_IV_FUNC_INFO_FLAGS (g_iv_func_info_flags_get_type())
34
+ GType g_i_function_info_flags_get_type (void);
35
+ #define G_TYPE_I_FUNCTION_INFO_FLAGS (g_i_function_info_flags_get_type())
36
+
37
+ G_END_DECLS
38
+
39
+ #endif /* __GOBJECT_INTROSPECTION_ENUM_TYPES_H__ */
40
+
41
+ /* Generated data ends here */
42
+
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2019 Ruby-GNOME Project Team
3
+ * Copyright (C) 2012-2021 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
@@ -1296,7 +1296,7 @@ rb_gi_argument_to_ruby(GIArgument *argument,
1296
1296
  switch (type_tag) {
1297
1297
  case GI_TYPE_TAG_VOID:
1298
1298
  if (g_type_info_is_pointer(type_info)) {
1299
- rb_argument = ULONG2NUM(GPOINTER_TO_UINT(argument->v_pointer));
1299
+ rb_argument = ULL2NUM((guint64)(argument->v_pointer));
1300
1300
  } else {
1301
1301
  rb_argument = Qnil;
1302
1302
  }
@@ -2011,11 +2011,18 @@ rb_gi_return_argument_to_ruby(GICallableInfo *callable_info,
2011
2011
  GITypeInfo return_value_info;
2012
2012
 
2013
2013
  may_return_null = g_callable_info_may_return_null(callable_info);
2014
+ g_callable_info_load_return_type(callable_info, &return_value_info);
2014
2015
  if (may_return_null && !argument->v_pointer) {
2015
- return Qnil;
2016
+ GITypeTag return_value_tag = g_type_info_get_tag(&return_value_info);
2017
+ switch (return_value_tag) {
2018
+ case GI_TYPE_TAG_GLIST:
2019
+ case GI_TYPE_TAG_GSLIST:
2020
+ return rb_ary_new();
2021
+ default:
2022
+ return Qnil;
2023
+ }
2016
2024
  }
2017
2025
 
2018
- g_callable_info_load_return_type(callable_info, &return_value_info);
2019
2026
  rb_argument = rb_gi_argument_to_ruby(argument, FALSE, &return_value_info,
2020
2027
  in_args, out_args, args_metadata);
2021
2028
  switch (g_callable_info_get_caller_owns(callable_info)) {
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2019 Ruby-GNOME Project Team
3
+ * Copyright (C) 2012-2021 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
@@ -27,13 +27,7 @@ rb_gi_callback_data_destroy_notify(gpointer data)
27
27
  rb_gi_callback_data_free(callback_data);
28
28
  }
29
29
 
30
- typedef struct {
31
- RBGIArguments *args;
32
- RBGICallback *callback;
33
- RBGICallbackData *callback_data;
34
- } RBGICallbackInvokeData;
35
-
36
- static VALUE
30
+ VALUE
37
31
  rb_gi_arguments_in_to_ruby(RBGIArguments *args)
38
32
  {
39
33
  VALUE rb_in_args;
@@ -68,85 +62,6 @@ rb_gi_arguments_in_to_ruby(RBGIArguments *args)
68
62
  return rb_in_args;
69
63
  }
70
64
 
71
- static VALUE
72
- rb_gi_callback_invoke(VALUE user_data)
73
- {
74
- RBGICallbackInvokeData *data = (RBGICallbackInvokeData *)user_data;
75
- ID id_call;
76
- VALUE rb_callback = rb_gi_callback_data_get_rb_callback(data->callback_data);
77
- VALUE rb_args = rb_gi_arguments_in_to_ruby(data->args);
78
-
79
- CONST_ID(id_call, "call");
80
- return rb_funcallv(rb_callback,
81
- id_call,
82
- RARRAY_LENINT(rb_args),
83
- RARRAY_CONST_PTR(rb_args));
84
- }
85
-
86
- static void
87
- rb_gi_ffi_closure_callback(G_GNUC_UNUSED ffi_cif *cif,
88
- void *return_value,
89
- void **raw_args,
90
- void *data)
91
- {
92
- RBGICallback *callback = data;
93
- RBGICallbackData *callback_data = NULL;
94
- RBGIArguments args;
95
- VALUE rb_results;
96
-
97
- rb_gi_arguments_init(&args,
98
- callback->callback_info,
99
- Qnil,
100
- Qnil,
101
- raw_args);
102
- {
103
- guint i;
104
-
105
- for (i = 0; i < args.metadata->len; i++) {
106
- RBGIArgMetadata *metadata;
107
-
108
- metadata = g_ptr_array_index(args.metadata, i);
109
- if (!metadata->closure_p) {
110
- continue;
111
- }
112
-
113
- callback_data = *((RBGICallbackData **)(raw_args[i]));
114
- break;
115
- }
116
-
117
- if (!callback_data && args.metadata->len > 0) {
118
- RBGIArgMetadata *metadata;
119
-
120
- i = args.metadata->len - 1;
121
- metadata = g_ptr_array_index(args.metadata, i);
122
- if (metadata->type.tag == GI_TYPE_TAG_VOID &&
123
- metadata->type.pointer_p &&
124
- strcmp(metadata->name, "data") == 0) {
125
- callback_data = *((RBGICallbackData **)(raw_args[i]));
126
- }
127
- }
128
- }
129
-
130
- {
131
- RBGICallbackInvokeData data;
132
- data.args = &args;
133
- data.callback = callback;
134
- data.callback_data = callback_data;
135
- rb_results = rbgutil_invoke_callback(rb_gi_callback_invoke,
136
- (VALUE)&data);
137
- }
138
- rb_gi_arguments_fill_raw_results(&args, rb_results, return_value);
139
- rb_gi_arguments_clear(&args);
140
-
141
- {
142
- RBGIArgMetadata *callback_metadata =
143
- rb_gi_callback_data_get_metadata(callback_data);
144
- if (callback_metadata->scope_type == GI_SCOPE_TYPE_ASYNC) {
145
- rb_gi_callback_data_free(callback_data);
146
- }
147
- }
148
- }
149
-
150
65
  static void
151
66
  rb_gi_arguments_in_init_arg_ruby_callback(RBGIArguments *args,
152
67
  RBGIArgMetadata *metadata)
@@ -187,14 +102,11 @@ rb_gi_arguments_in_init_arg_ruby_callback(RBGIArguments *args,
187
102
  if (callback_function) {
188
103
  callback_argument->v_pointer = callback_function;
189
104
  } else {
190
- callback = RB_ZALLOC(RBGICallback);
191
- callback->type_info = g_arg_info_get_type(arg_info);
192
- callback->callback_info = g_type_info_get_interface(callback->type_info);
193
- callback->closure =
194
- g_callable_info_prepare_closure(callback->callback_info,
195
- &(callback->cif),
196
- rb_gi_ffi_closure_callback,
197
- callback);
105
+ GITypeInfo *type_info = g_arg_info_get_type(arg_info);
106
+ GICallbackInfo *callback_info = g_type_info_get_interface(type_info);
107
+ callback = rb_gi_callback_new(callback_info, NULL);
108
+ g_base_info_unref(callback_info);
109
+ g_base_info_unref(type_info);
198
110
  callback_argument->v_pointer = callback->closure;
199
111
  }
200
112
 
@@ -231,7 +143,7 @@ rb_gi_arguments_in_init_arg_ruby_void(RBGIArguments *args,
231
143
  } else if (rbg_is_object(metadata->rb_arg)) {
232
144
  *target = RVAL2GOBJ(metadata->rb_arg);
233
145
  } else {
234
- *target = GUINT_TO_POINTER(NUM2ULONG(metadata->rb_arg));
146
+ *target = (gpointer)(NUM2ULL(metadata->rb_arg));
235
147
  }
236
148
  }
237
149
 
@@ -682,7 +594,7 @@ rb_gi_arguments_in_init_arg_ruby_array_c_gtype(RBGIArguments *args,
682
594
  raw_array = ALLOC_N(GType, n_elements);
683
595
  for (i = 0; i < n_elements; i++) {
684
596
  VALUE rb_type = RARRAY_AREF(rb_array, i);
685
- raw_array[i] = rbgobj_gtype_get(rb_type);
597
+ raw_array[i] = rbgobj_gtype_from_ruby(rb_type);
686
598
  }
687
599
 
688
600
  rb_gi_arguments_in_init_arg_ruby_array_c_generic(args,
@@ -1007,7 +919,7 @@ rb_gi_arguments_in_init_arg_ruby_array_c(RBGIArguments *args,
1007
919
  /* Workaround for rsvg_handle_set_stylesheet():
1008
920
  https://gitlab.gnome.org/GNOME/librsvg/-/issues/596 */
1009
921
  if (strcmp(metadata->name, "css") == 0) {
1010
- metadata->in_arg->v_pointer = RVAL2CSTR(rb_arg);
922
+ metadata->in_arg->v_pointer = (char *)RVAL2CSTR(rb_arg);
1011
923
  rb_gi_arguments_in_init_arg_ruby_array_set_length(args,
1012
924
  metadata,
1013
925
  RSTRING_LEN(rb_arg));
@@ -1262,15 +1174,6 @@ rb_gi_arguments_in_init_arg_ruby_interface(RBGIArguments *args,
1262
1174
  rb_gi_transfer_to_string(metadata->transfer));
1263
1175
  break;
1264
1176
  case GI_INFO_TYPE_STRUCT:
1265
- if (metadata->transfer != GI_TRANSFER_NOTHING) {
1266
- rb_raise(rb_eNotImpError,
1267
- "TODO: [%s] %s Ruby -> GIArgument(interface)[%s][%s][%s]",
1268
- metadata->name,
1269
- rb_gi_direction_to_string(metadata->direction),
1270
- g_info_type_to_string(metadata->type.interface_type),
1271
- g_type_name(metadata->type.interface_gtype),
1272
- rb_gi_transfer_to_string(metadata->transfer));
1273
- }
1274
1177
  metadata->free_func = rb_gi_arguments_in_free_interface_struct;
1275
1178
  if (metadata->type.interface_gtype == G_TYPE_VALUE) {
1276
1179
  GValue *gvalue;
@@ -2069,13 +1972,30 @@ rb_gi_arguments_in_init_arg_ruby(RBGIArguments *args,
2069
1972
  case GI_TYPE_TAG_UNICHAR:
2070
1973
  {
2071
1974
  gunichar *target;
1975
+ VALUE rb_unichar;
2072
1976
  if (metadata->direction == GI_DIRECTION_INOUT) {
2073
1977
  target = ALLOC(gunichar);
2074
1978
  metadata->in_arg->v_pointer = target;
2075
1979
  } else {
2076
1980
  target = &(metadata->in_arg->v_uint32);
2077
1981
  }
2078
- *target = NUM2UINT(metadata->rb_arg);
1982
+ if (RB_TYPE_P(metadata->rb_arg, RUBY_T_STRING)) {
1983
+ VALUE rb_codepoints;
1984
+ if (rb_str_strlen(metadata->rb_arg) != 1) {
1985
+ rb_raise(rb_eArgError,
1986
+ "[%s][%s] must be one character: %+" PRIsVALUE,
1987
+ metadata->name,
1988
+ g_type_tag_to_string(metadata->type.tag),
1989
+ metadata->rb_arg);
1990
+ }
1991
+ rb_codepoints = rb_funcall(metadata->rb_arg,
1992
+ rb_intern("codepoints"),
1993
+ 0);
1994
+ rb_unichar = RARRAY_PTR(rb_codepoints)[0];
1995
+ } else {
1996
+ rb_unichar = metadata->rb_arg;
1997
+ }
1998
+ *target = NUM2UINT(rb_unichar);
2079
1999
  }
2080
2000
  break;
2081
2001
  default:
@@ -105,10 +105,11 @@ rb_gi_arguments_out_free_array_c_interface(RBGIArguments *args,
105
105
  case GI_TRANSFER_EVERYTHING:
106
106
  default:
107
107
  rb_raise(rb_eNotImpError,
108
- "TODO: [%s] %s free GIArgument(%s)[%s]",
108
+ "TODO: [%s] %s free GIArgument(%s/%s)[%s]",
109
109
  metadata->name,
110
110
  rb_gi_direction_to_string(metadata->direction),
111
111
  g_type_tag_to_string(metadata->type.tag),
112
+ rb_gi_array_type_to_string(metadata->array_type),
112
113
  rb_gi_transfer_to_string(metadata->transfer));
113
114
  }
114
115
  xfree(target);
@@ -120,17 +121,34 @@ rb_gi_arguments_out_free_array_array_interface_struct(RBGIArguments *args,
120
121
  gpointer user_data)
121
122
  {
122
123
  GArray *target = metadata->out_arg->v_pointer;
124
+ GType gtype = metadata->element_type.interface_gtype;
123
125
  switch (metadata->transfer) {
124
126
  case GI_TRANSFER_NOTHING:
125
127
  break;
126
128
  case GI_TRANSFER_CONTAINER:
129
+ break;
127
130
  case GI_TRANSFER_EVERYTHING:
131
+ if (gtype == G_TYPE_NONE) {
132
+ /* If the target struct is raw (not GType-ed) struct, we
133
+ * can't know how to free fields in the target struct. We
134
+ * assume that the target struct doesn't allocate nothing
135
+ * for its fields.
136
+ *
137
+ * e.g.: The attributes out argument in
138
+ * vte_terminal_get_text_range():
139
+ * https://developer.gnome.org/vte/unstable/VteTerminal.html#vte-terminal-get-text-range
140
+ */
141
+ break;
142
+ }
128
143
  default:
129
144
  rb_raise(rb_eNotImpError,
130
- "TODO: [%s] %s free GIArgument(%s)[%s]",
145
+ "TODO: [%s] %s free GIArgument(%s/%s)[interface(%s)](%s)[%s]",
131
146
  metadata->name,
132
147
  rb_gi_direction_to_string(metadata->direction),
133
148
  g_type_tag_to_string(metadata->type.tag),
149
+ rb_gi_array_type_to_string(metadata->array_type),
150
+ g_info_type_to_string(metadata->element_type.interface_type),
151
+ g_type_name(metadata->element_type.interface_gtype),
134
152
  rb_gi_transfer_to_string(metadata->transfer));
135
153
  }
136
154
  g_array_free(target, TRUE);