Kouhei Sutou 2017-08-07 00:12:46 +0900 (Mon, 07 Aug 2017)
New Revision: b68af887d1fc90c41c8423c17277c718fc8029d7
https://github.com/ruby-gnome2/ruby-gnome2/commit/b68af887d1fc90c41c8423c17277c718fc8029d7
Message:
gi: support [GBoxed] output
Modified files:
gobject-introspection/ext/gobject-introspection/rb-gi-argument.c
Modified: gobject-introspection/ext/gobject-introspection/rb-gi-argument.c (+6 -5)
===================================================================
--- gobject-introspection/ext/gobject-introspection/rb-gi-argument.c 2017-08-06 16:23:11 +0900 (7fc326d22)
+++ gobject-introspection/ext/gobject-introspection/rb-gi-argument.c 2017-08-07 00:12:46 +0900 (3a4cd7e64)
@@ -61,13 +61,14 @@ array_c_to_ruby_sized_interface(gconstpointer *elements,
g_base_info_unref(interface_info);
g_base_info_unref(element_type_info);
} else {
- interface_name = g_info_type_to_string(interface_type);
+ /* TODO: Should we check caller_allocates? */
+ gsize struct_size = g_struct_info_get_size(interface_info);
+ for (i = 0; i < n_elements; i++) {
+ gpointer element = ((gchar *)elements) + struct_size * i;
+ rb_ary_push(rb_array, BOXED2RVAL(element, gtype));
+ }
g_base_info_unref(interface_info);
g_base_info_unref(element_type_info);
- rb_raise(rb_eNotImpError,
- "TODO: GIArgument(array)[c][interface(%s)](%s) -> Ruby",
- interface_name,
- g_type_name(gtype));
}
break;
case GI_INFO_TYPE_BOXED:
|