gir_ffi 0.14.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +21 -0
- data/Gemfile +6 -4
- data/README.md +4 -4
- data/Rakefile +5 -5
- data/lib/ffi-glib/array.rb +14 -4
- data/lib/ffi-glib/byte_array.rb +7 -2
- data/lib/ffi-glib/container_class_methods.rb +1 -1
- data/lib/ffi-glib/error.rb +1 -1
- data/lib/ffi-glib/hash_table.rb +3 -3
- data/lib/ffi-glib/list.rb +1 -1
- data/lib/ffi-glib/list_methods.rb +1 -1
- data/lib/ffi-glib/main_loop.rb +3 -3
- data/lib/ffi-glib/ptr_array.rb +30 -8
- data/lib/ffi-glib/s_list.rb +1 -1
- data/lib/ffi-glib/variant.rb +1 -1
- data/lib/ffi-glib.rb +16 -16
- data/lib/ffi-gobject/object.rb +23 -32
- data/lib/ffi-gobject/param_spec.rb +1 -1
- data/lib/ffi-gobject/ruby_closure.rb +2 -2
- data/lib/ffi-gobject/value.rb +37 -28
- data/lib/ffi-gobject.rb +13 -13
- data/lib/ffi-gobject_introspection/gobject_type_init.rb +2 -2
- data/lib/ffi-gobject_introspection/i_arg_info.rb +2 -2
- data/lib/ffi-gobject_introspection/i_base_info.rb +27 -17
- data/lib/ffi-gobject_introspection/i_callable_info.rb +4 -4
- data/lib/ffi-gobject_introspection/i_constant_info.rb +2 -2
- data/lib/ffi-gobject_introspection/i_enum_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_field_info.rb +1 -1
- data/lib/ffi-gobject_introspection/i_function_info.rb +1 -1
- data/lib/ffi-gobject_introspection/i_interface_info.rb +1 -1
- data/lib/ffi-gobject_introspection/i_object_info.rb +2 -2
- data/lib/ffi-gobject_introspection/i_property_info.rb +2 -2
- data/lib/ffi-gobject_introspection/i_repository.rb +9 -6
- data/lib/ffi-gobject_introspection/i_struct_info.rb +2 -1
- data/lib/ffi-gobject_introspection/i_type_info.rb +13 -7
- data/lib/ffi-gobject_introspection/i_unresolved_info.rb +1 -1
- data/lib/ffi-gobject_introspection/i_vfunc_info.rb +1 -1
- data/lib/ffi-gobject_introspection/lib.rb +30 -19
- data/lib/ffi-gobject_introspection/strv.rb +1 -1
- data/lib/ffi-gobject_introspection.rb +20 -20
- data/lib/gir_ffi/allocation_helper.rb +1 -1
- data/lib/gir_ffi/arg_helper.rb +4 -4
- data/lib/gir_ffi/{in_out_pointer.rb → array_element_convertor.rb} +16 -23
- data/lib/gir_ffi/boolean.rb +1 -1
- data/lib/gir_ffi/boxed_base.rb +1 -1
- data/lib/gir_ffi/builder.rb +18 -10
- data/lib/gir_ffi/builders/argument_builder.rb +17 -17
- data/lib/gir_ffi/builders/base_argument_builder.rb +1 -0
- data/lib/gir_ffi/builders/base_method_builder.rb +7 -7
- data/lib/gir_ffi/builders/base_return_value_builder.rb +1 -1
- data/lib/gir_ffi/builders/base_type_builder.rb +1 -1
- data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +5 -5
- data/lib/gir_ffi/builders/callback_argument_builder.rb +8 -8
- data/lib/gir_ffi/builders/callback_builder.rb +3 -3
- data/lib/gir_ffi/builders/callback_return_value_builder.rb +2 -2
- data/lib/gir_ffi/builders/closure_argument_builder.rb +1 -1
- data/lib/gir_ffi/builders/closure_return_value_builder.rb +1 -1
- data/lib/gir_ffi/builders/constant_builder.rb +1 -1
- data/lib/gir_ffi/builders/constructor_builder.rb +9 -9
- data/lib/gir_ffi/builders/enum_builder.rb +2 -2
- data/lib/gir_ffi/builders/field_builder.rb +16 -15
- data/lib/gir_ffi/builders/flags_builder.rb +2 -2
- data/lib/gir_ffi/builders/full_c_to_ruby_convertor.rb +1 -1
- data/lib/gir_ffi/builders/function_builder.rb +11 -5
- data/lib/gir_ffi/builders/initializer_builder.rb +3 -3
- data/lib/gir_ffi/builders/initializer_return_value_builder.rb +2 -2
- data/lib/gir_ffi/builders/interface_builder.rb +2 -2
- data/lib/gir_ffi/builders/mapping_method_builder.rb +9 -9
- data/lib/gir_ffi/builders/marshalling_method_builder.rb +7 -7
- data/lib/gir_ffi/builders/method_template.rb +1 -1
- data/lib/gir_ffi/builders/module_builder.rb +4 -6
- data/lib/gir_ffi/builders/object_builder.rb +6 -6
- data/lib/gir_ffi/builders/property_argument_builder.rb +1 -1
- data/lib/gir_ffi/builders/property_builder.rb +13 -12
- data/lib/gir_ffi/builders/property_return_value_builder.rb +1 -1
- data/lib/gir_ffi/builders/registered_type_builder.rb +14 -5
- data/lib/gir_ffi/builders/return_value_builder.rb +4 -4
- data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +6 -6
- data/lib/gir_ffi/builders/signal_closure_builder.rb +2 -2
- data/lib/gir_ffi/builders/struct_builder.rb +4 -4
- data/lib/gir_ffi/builders/struct_like.rb +1 -1
- data/lib/gir_ffi/builders/type_builder.rb +12 -12
- data/lib/gir_ffi/builders/unintrospectable_boxed_builder.rb +2 -2
- data/lib/gir_ffi/builders/unintrospectable_builder.rb +2 -2
- data/lib/gir_ffi/builders/union_builder.rb +4 -4
- data/lib/gir_ffi/builders/user_defined_builder.rb +2 -2
- data/lib/gir_ffi/builders/vfunc_argument_builder.rb +1 -1
- data/lib/gir_ffi/builders/vfunc_builder.rb +6 -6
- data/lib/gir_ffi/builders/with_layout.rb +2 -2
- data/lib/gir_ffi/callback_base.rb +1 -1
- data/lib/gir_ffi/class_base.rb +5 -5
- data/lib/gir_ffi/core.rb +19 -20
- data/lib/gir_ffi/enum_base.rb +1 -1
- data/lib/gir_ffi/enum_like_base.rb +2 -2
- data/lib/gir_ffi/error_argument_info.rb +2 -2
- data/lib/gir_ffi/error_type_info.rb +1 -1
- data/lib/gir_ffi/ffi_ext/pointer.rb +1 -1
- data/lib/gir_ffi/ffi_ext.rb +1 -1
- data/lib/gir_ffi/flags_base.rb +1 -1
- data/lib/gir_ffi/in_pointer.rb +10 -0
- data/lib/gir_ffi/info_ext/full_type_name.rb +3 -3
- data/lib/gir_ffi/info_ext/i_arg_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_callable_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_callback_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_field_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_function_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_property_info.rb +2 -2
- data/lib/gir_ffi/info_ext/i_registered_type_info.rb +4 -5
- data/lib/gir_ffi/info_ext/i_signal_info.rb +7 -3
- data/lib/gir_ffi/info_ext/i_type_info.rb +48 -26
- data/lib/gir_ffi/info_ext/i_unresolved_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_value_info.rb +2 -2
- data/lib/gir_ffi/info_ext/i_vfunc_info.rb +2 -2
- data/lib/gir_ffi/info_ext/safe_constant_name.rb +8 -8
- data/lib/gir_ffi/info_ext/safe_function_name.rb +2 -2
- data/lib/gir_ffi/info_ext.rb +15 -15
- data/lib/gir_ffi/interface_base.rb +3 -3
- data/lib/gir_ffi/lib_c.rb +1 -1
- data/lib/gir_ffi/method_stubber.rb +1 -1
- data/lib/gir_ffi/module_base.rb +1 -1
- data/lib/gir_ffi/object_base.rb +3 -4
- data/lib/gir_ffi/receiver_argument_info.rb +1 -1
- data/lib/gir_ffi/receiver_type_info.rb +2 -2
- data/lib/gir_ffi/registered_type_base.rb +1 -1
- data/lib/gir_ffi/sized_array.rb +4 -2
- data/lib/gir_ffi/struct.rb +1 -1
- data/lib/gir_ffi/struct_base.rb +1 -1
- data/lib/gir_ffi/type_map.rb +2 -23
- data/lib/gir_ffi/unintrospectable_boxed_info.rb +2 -2
- data/lib/gir_ffi/unintrospectable_type_info.rb +1 -1
- data/lib/gir_ffi/union.rb +1 -1
- data/lib/gir_ffi/union_base.rb +1 -1
- data/lib/gir_ffi/user_defined_object_info.rb +6 -2
- data/lib/gir_ffi/user_defined_property_info.rb +33 -33
- data/lib/gir_ffi/version.rb +1 -1
- data/lib/gir_ffi-base/gobject/lib.rb +3 -2
- data/lib/gir_ffi-base/gobject.rb +26 -25
- data/lib/gir_ffi-base.rb +1 -1
- data/lib/gir_ffi.rb +3 -3
- data/tasks/test.rake +3 -2
- data/test/base_test_helper.rb +16 -9
- data/test/ffi-glib/array_test.rb +71 -56
- data/test/ffi-glib/byte_array_test.rb +13 -7
- data/test/ffi-glib/bytes_test.rb +24 -19
- data/test/ffi-glib/closure_test.rb +11 -11
- data/test/ffi-glib/destroy_notify_test.rb +6 -6
- data/test/ffi-glib/hash_table_test.rb +27 -27
- data/test/ffi-glib/list_test.rb +22 -22
- data/test/ffi-glib/main_loop_test.rb +12 -12
- data/test/ffi-glib/ptr_array_test.rb +39 -39
- data/test/ffi-glib/ruby_closure_test.rb +10 -10
- data/test/ffi-glib/s_list_test.rb +20 -20
- data/test/ffi-glib/strv_test.rb +19 -19
- data/test/ffi-glib/variant_test.rb +5 -5
- data/test/ffi-gobject/gobject_test.rb +48 -44
- data/test/ffi-gobject/object_class_test.rb +8 -8
- data/test/ffi-gobject/object_test.rb +49 -67
- data/test/ffi-gobject/param_spec_test.rb +12 -12
- data/test/ffi-gobject/value_test.rb +145 -125
- data/test/ffi-gobject_introspection/gobject_type_init_test.rb +8 -8
- data/test/ffi-gobject_introspection/i_base_info_test.rb +15 -16
- data/test/ffi-gobject_introspection/i_constant_info_test.rb +9 -13
- data/test/ffi-gobject_introspection/i_enum_info_test.rb +7 -7
- data/test/ffi-gobject_introspection/i_function_info_test.rb +1 -1
- data/test/ffi-gobject_introspection/i_interface_info_test.rb +10 -10
- data/test/ffi-gobject_introspection/i_object_info_test.rb +23 -23
- data/test/ffi-gobject_introspection/i_property_info_test.rb +19 -19
- data/test/ffi-gobject_introspection/i_registered_type_info_test.rb +10 -10
- data/test/ffi-gobject_introspection/i_repository_test.rb +31 -31
- data/test/ffi-gobject_introspection/i_struct_info_test.rb +10 -10
- data/test/ffi-gobject_introspection/i_type_info_test.rb +12 -15
- data/test/ffi-gobject_introspection/i_union_info_test.rb +7 -7
- data/test/ffi-gobject_introspection/i_vfunc_info_test.rb +16 -16
- data/test/ffi-gobject_introspection/lib_test.rb +3 -3
- data/test/ffi-gobject_introspection/strv_test.rb +9 -9
- data/test/ffi-gobject_test.rb +44 -44
- data/test/gir_ffi/allocation_helper_test.rb +13 -13
- data/test/gir_ffi/arg_helper_test.rb +63 -64
- data/test/gir_ffi/boolean_test.rb +20 -20
- data/test/gir_ffi/boxed_base_test.rb +18 -18
- data/test/gir_ffi/builder_test.rb +115 -93
- data/test/gir_ffi/builders/argument_builder_test.rb +280 -286
- data/test/gir_ffi/builders/base_argument_builder_test.rb +1 -1
- data/test/gir_ffi/builders/callback_argument_builder_test.rb +53 -56
- data/test/gir_ffi/builders/callback_builder_test.rb +71 -72
- data/test/gir_ffi/builders/callback_return_value_builder_test.rb +36 -40
- data/test/gir_ffi/builders/constant_builder_test.rb +1 -1
- data/test/gir_ffi/builders/constructor_builder_test.rb +10 -10
- data/test/gir_ffi/builders/enum_builder_test.rb +10 -10
- data/test/gir_ffi/builders/field_builder_test.rb +42 -42
- data/test/gir_ffi/builders/function_builder_test.rb +236 -224
- data/test/gir_ffi/builders/initializer_builder_test.rb +14 -14
- data/test/gir_ffi/builders/interface_builder_test.rb +9 -9
- data/test/gir_ffi/builders/module_builder_test.rb +18 -18
- data/test/gir_ffi/builders/object_builder_test.rb +38 -38
- data/test/gir_ffi/builders/property_builder_test.rb +91 -94
- data/test/gir_ffi/builders/registered_type_builder_test.rb +35 -11
- data/test/gir_ffi/builders/return_value_builder_test.rb +215 -222
- data/test/gir_ffi/builders/signal_closure_builder_test.rb +122 -113
- data/test/gir_ffi/builders/struct_builder_test.rb +32 -32
- data/test/gir_ffi/builders/unintrospectable_boxed_builder_test.rb +8 -14
- data/test/gir_ffi/builders/unintrospectable_builder_test.rb +23 -23
- data/test/gir_ffi/builders/union_builder_test.rb +12 -15
- data/test/gir_ffi/builders/user_defined_builder_test.rb +147 -147
- data/test/gir_ffi/builders/vfunc_argument_builder_test.rb +40 -40
- data/test/gir_ffi/builders/vfunc_builder_test.rb +145 -157
- data/test/gir_ffi/callback_base_test.rb +9 -9
- data/test/gir_ffi/class_base_test.rb +49 -51
- data/test/gir_ffi/core_test.rb +32 -32
- data/test/gir_ffi/enum_base_test.rb +19 -19
- data/test/gir_ffi/error_type_info_test.rb +23 -23
- data/test/gir_ffi/ffi_ext/pointer_test.rb +5 -5
- data/test/gir_ffi/g_type_test.rb +11 -11
- data/test/gir_ffi/in_pointer_test.rb +70 -50
- data/test/gir_ffi/info_ext/i_callable_info_test.rb +5 -5
- data/test/gir_ffi/info_ext/i_callback_info_test.rb +4 -4
- data/test/gir_ffi/info_ext/i_field_info_test.rb +6 -6
- data/test/gir_ffi/info_ext/i_function_info_test.rb +17 -17
- data/test/gir_ffi/info_ext/i_signal_info_test.rb +8 -8
- data/test/gir_ffi/info_ext/i_type_info_test.rb +229 -215
- data/test/gir_ffi/info_ext/i_unresolved_info_test.rb +4 -4
- data/test/gir_ffi/info_ext/safe_constant_name_test.rb +8 -8
- data/test/gir_ffi/info_ext/safe_function_name_test.rb +8 -8
- data/test/gir_ffi/interface_base_test.rb +8 -8
- data/test/gir_ffi/method_stubber_test.rb +19 -19
- data/test/gir_ffi/object_base_test.rb +19 -19
- data/test/gir_ffi/object_store_test.rb +13 -13
- data/test/gir_ffi/receiver_argument_info_test.rb +15 -15
- data/test/gir_ffi/sized_array_test.rb +68 -68
- data/test/gir_ffi/struct_base_test.rb +8 -8
- data/test/gir_ffi/struct_like_base_test.rb +64 -64
- data/test/gir_ffi/type_map_test.rb +6 -6
- data/test/gir_ffi/unintrospectable_type_info_test.rb +33 -33
- data/test/gir_ffi/union_base_test.rb +8 -8
- data/test/gir_ffi/user_defined_object_info_test.rb +34 -34
- data/test/gir_ffi/user_defined_property_info_test.rb +16 -16
- data/test/gir_ffi/variable_name_generator_test.rb +8 -8
- data/test/gir_ffi/version_test.rb +4 -4
- data/test/gir_ffi/zero_terminated_test.rb +34 -34
- data/test/gir_ffi_test_helper.rb +3 -3
- data/test/integration/callback_exceptions_test.rb +17 -21
- data/test/integration/derived_classes_test.rb +13 -13
- data/test/integration/generated_everything_test.rb +224 -224
- data/test/integration/generated_gimarshallingtests_test.rb +1118 -1017
- data/test/integration/generated_gio_test.rb +36 -36
- data/test/integration/generated_glib_test.rb +4 -6
- data/test/integration/generated_gobject_test.rb +43 -35
- data/test/integration/generated_gst_test.rb +16 -16
- data/test/integration/generated_gtk_source_test.rb +22 -17
- data/test/integration/generated_gtop_test.rb +8 -15
- data/test/integration/generated_pango_ft2_test.rb +2 -2
- data/test/integration/generated_pango_test.rb +4 -4
- data/test/integration/generated_regress_test.rb +1809 -1621
- data/test/integration/generated_secret_test.rb +8 -11
- data/test/integration/generated_utility_test.rb +81 -81
- data/test/integration/generated_warnlib_test.rb +13 -19
- data/test/integration/method_lookup_test.rb +6 -6
- data/test/introspection_test_helper.rb +48 -7
- data/test/minitest/stats_plugin.rb +1 -1
- metadata +11 -28
- data/lib/ffi-glib/array_methods.rb +0 -16
- data/test/gir_ffi/in_out_pointer_test.rb +0 -56
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require "gir_ffi/registered_type_base"
|
4
|
+
require "gir_ffi/method_setup"
|
5
|
+
require "gir_ffi/instance_method_setup"
|
6
6
|
|
7
7
|
module GirFFI
|
8
8
|
# Base module for modules representing GLib interfaces.
|
data/lib/gir_ffi/lib_c.rb
CHANGED
data/lib/gir_ffi/module_base.rb
CHANGED
data/lib/gir_ffi/object_base.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "gir_ffi/class_base"
|
4
4
|
|
5
5
|
module GirFFI
|
6
6
|
# Base class for all generated classes of type :object.
|
@@ -38,7 +38,7 @@ module GirFFI
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def self.copy_from(val)
|
41
|
-
val
|
41
|
+
val&.ref
|
42
42
|
end
|
43
43
|
|
44
44
|
#
|
@@ -49,8 +49,7 @@ module GirFFI
|
|
49
49
|
# @return [GObjectIntrospection::IPropertyInfo] The property's info
|
50
50
|
#
|
51
51
|
def self.find_property(name)
|
52
|
-
gir_ffi_builder.find_property name
|
53
|
-
raise GirFFI::PropertyNotFoundError.new(name, self)
|
52
|
+
gir_ffi_builder.find_property name
|
54
53
|
end
|
55
54
|
|
56
55
|
#
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module GirFFI
|
4
|
-
# Represents the type of the receiver of a signal
|
5
|
-
# needed, to the interface of GObjectIntrospection::ITypeInfo
|
4
|
+
# Represents the type of the receiver of a signal, vfunc, or method,
|
5
|
+
# conforming, as needed, to the interface of GObjectIntrospection::ITypeInfo
|
6
6
|
class ReceiverTypeInfo
|
7
7
|
include InfoExt::ITypeInfo
|
8
8
|
|
data/lib/gir_ffi/sized_array.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "gir_ffi/array_element_convertor"
|
4
|
+
|
3
5
|
module GirFFI
|
4
6
|
# Class representing an array with a determined size
|
5
7
|
class SizedArray
|
@@ -17,8 +19,8 @@ module GirFFI
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def index(idx)
|
20
|
-
|
21
|
-
|
22
|
+
convertor = ArrayElementConvertor.new element_type, @pointer + idx * element_size
|
23
|
+
convertor.to_ruby_value
|
22
24
|
end
|
23
25
|
|
24
26
|
def each
|
data/lib/gir_ffi/struct.rb
CHANGED
data/lib/gir_ffi/struct_base.rb
CHANGED
data/lib/gir_ffi/type_map.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "gir_ffi/boolean"
|
4
|
+
require "gir_ffi/sized_array"
|
5
5
|
|
6
6
|
module GirFFI
|
7
7
|
# Maps GObject type tags and type specification to types FFI can handle.
|
@@ -58,26 +58,5 @@ module GirFFI
|
|
58
58
|
map_basic_type(type)
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
62
|
-
FLATTENED_TAG_TO_GTYPE_MAP = {
|
63
|
-
[:array, true] => GObject::TYPE_ARRAY,
|
64
|
-
[:c, true] => GObject::TYPE_POINTER,
|
65
|
-
[:gboolean, false] => GObject::TYPE_BOOLEAN,
|
66
|
-
[:ghash, true] => GObject::TYPE_HASH_TABLE,
|
67
|
-
[:glist, true] => GObject::TYPE_POINTER,
|
68
|
-
[:gint32, false] => GObject::TYPE_INT,
|
69
|
-
[:gint64, false] => GObject::TYPE_INT64,
|
70
|
-
[:guint64, false] => GObject::TYPE_UINT64,
|
71
|
-
[:strv, true] => GObject::TYPE_STRV,
|
72
|
-
[:utf8, true] => GObject::TYPE_STRING,
|
73
|
-
[:void, true] => GObject::TYPE_POINTER,
|
74
|
-
[:void, false] => GObject::TYPE_NONE
|
75
|
-
}.freeze
|
76
|
-
|
77
|
-
def self.type_info_to_gtype(type_info)
|
78
|
-
return type_info.interface.gtype if type_info.tag == :interface
|
79
|
-
|
80
|
-
FLATTENED_TAG_TO_GTYPE_MAP.fetch [type_info.flattened_tag, type_info.pointer?]
|
81
|
-
end
|
82
61
|
end
|
83
62
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "gir_ffi/info_ext/full_type_name"
|
4
4
|
|
5
5
|
module GirFFI
|
6
6
|
# Represents a boxed type not found in the GIR, conforming, as needed, to the
|
@@ -20,7 +20,7 @@ module GirFFI
|
|
20
20
|
GObject.type_name g_type
|
21
21
|
end
|
22
22
|
|
23
|
-
DEFAULT_BOXED_NAMESPACE =
|
23
|
+
DEFAULT_BOXED_NAMESPACE = "GLib"
|
24
24
|
|
25
25
|
def namespace
|
26
26
|
DEFAULT_BOXED_NAMESPACE
|
data/lib/gir_ffi/union.rb
CHANGED
data/lib/gir_ffi/union_base.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "gir_ffi/user_defined_property_info"
|
4
|
+
require "gir_ffi/vfunc_implementation"
|
5
5
|
|
6
6
|
module GirFFI
|
7
7
|
# Represents a user defined type, conforming, as needed, to the interface of
|
@@ -37,6 +37,10 @@ module GirFFI
|
|
37
37
|
nil
|
38
38
|
end
|
39
39
|
|
40
|
+
def find_property(_property)
|
41
|
+
nil
|
42
|
+
end
|
43
|
+
|
40
44
|
def parent_gtype
|
41
45
|
@parent_gtype ||= GType.new(@klass.superclass.gtype)
|
42
46
|
end
|
@@ -15,21 +15,21 @@ module GirFFI
|
|
15
15
|
# TODO: Unify with InfoExt::ITypeInfo.flattened_tag_to_gtype_map
|
16
16
|
G_TYPE_TAG_MAP = {
|
17
17
|
GObject::TYPE_BOOLEAN => :gboolean,
|
18
|
-
GObject::TYPE_CHAR
|
19
|
-
GObject::TYPE_UCHAR
|
20
|
-
GObject::TYPE_FLOAT
|
21
|
-
GObject::TYPE_DOUBLE
|
22
|
-
GObject::TYPE_INT
|
23
|
-
GObject::TYPE_UINT
|
24
|
-
GObject::TYPE_LONG
|
25
|
-
GObject::TYPE_ULONG
|
26
|
-
GObject::TYPE_INT64
|
27
|
-
GObject::TYPE_UINT64
|
28
|
-
GObject::TYPE_ENUM
|
29
|
-
GObject::TYPE_FLAGS
|
30
|
-
GObject::TYPE_STRING
|
31
|
-
GObject::TYPE_BOXED
|
32
|
-
GObject::TYPE_OBJECT
|
18
|
+
GObject::TYPE_CHAR => :gint8,
|
19
|
+
GObject::TYPE_UCHAR => :guint8,
|
20
|
+
GObject::TYPE_FLOAT => :gfloat,
|
21
|
+
GObject::TYPE_DOUBLE => :gdouble,
|
22
|
+
GObject::TYPE_INT => :gint,
|
23
|
+
GObject::TYPE_UINT => :guint,
|
24
|
+
GObject::TYPE_LONG => :glong,
|
25
|
+
GObject::TYPE_ULONG => :gulong,
|
26
|
+
GObject::TYPE_INT64 => :gint64,
|
27
|
+
GObject::TYPE_UINT64 => :guint64,
|
28
|
+
GObject::TYPE_ENUM => :interface,
|
29
|
+
GObject::TYPE_FLAGS => :interface,
|
30
|
+
GObject::TYPE_STRING => :utf8,
|
31
|
+
GObject::TYPE_BOXED => :interface,
|
32
|
+
GObject::TYPE_OBJECT => :interface
|
33
33
|
}.freeze
|
34
34
|
|
35
35
|
def tag
|
@@ -39,21 +39,21 @@ module GirFFI
|
|
39
39
|
# TODO: Unify with InfoExt::ITypeInfo.flattened_tag_to_gtype_map
|
40
40
|
G_TYPE_POINTER_MAP = {
|
41
41
|
GObject::TYPE_BOOLEAN => false,
|
42
|
-
GObject::TYPE_CHAR
|
43
|
-
GObject::TYPE_UCHAR
|
44
|
-
GObject::TYPE_FLOAT
|
45
|
-
GObject::TYPE_DOUBLE
|
46
|
-
GObject::TYPE_INT
|
47
|
-
GObject::TYPE_UINT
|
48
|
-
GObject::TYPE_LONG
|
49
|
-
GObject::TYPE_ULONG
|
50
|
-
GObject::TYPE_INT64
|
51
|
-
GObject::TYPE_UINT64
|
52
|
-
GObject::TYPE_ENUM
|
53
|
-
GObject::TYPE_FLAGS
|
54
|
-
GObject::TYPE_STRING
|
55
|
-
GObject::TYPE_BOXED
|
56
|
-
GObject::TYPE_OBJECT
|
42
|
+
GObject::TYPE_CHAR => false,
|
43
|
+
GObject::TYPE_UCHAR => false,
|
44
|
+
GObject::TYPE_FLOAT => false,
|
45
|
+
GObject::TYPE_DOUBLE => false,
|
46
|
+
GObject::TYPE_INT => false,
|
47
|
+
GObject::TYPE_UINT => false,
|
48
|
+
GObject::TYPE_LONG => false,
|
49
|
+
GObject::TYPE_ULONG => false,
|
50
|
+
GObject::TYPE_INT64 => false,
|
51
|
+
GObject::TYPE_UINT64 => false,
|
52
|
+
GObject::TYPE_ENUM => false,
|
53
|
+
GObject::TYPE_FLAGS => false,
|
54
|
+
GObject::TYPE_STRING => true,
|
55
|
+
GObject::TYPE_BOXED => true,
|
56
|
+
GObject::TYPE_OBJECT => true
|
57
57
|
}.freeze
|
58
58
|
|
59
59
|
def pointer?
|
@@ -61,9 +61,9 @@ module GirFFI
|
|
61
61
|
end
|
62
62
|
|
63
63
|
G_TYPE_INTERFACE_TAG_MAP = {
|
64
|
-
GObject::TYPE_ENUM
|
65
|
-
GObject::TYPE_FLAGS
|
66
|
-
GObject::TYPE_BOXED
|
64
|
+
GObject::TYPE_ENUM => :enum,
|
65
|
+
GObject::TYPE_FLAGS => :flags,
|
66
|
+
GObject::TYPE_BOXED => :struct,
|
67
67
|
GObject::TYPE_OBJECT => :object
|
68
68
|
}.freeze
|
69
69
|
|
data/lib/gir_ffi/version.rb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "ffi/bit_masks"
|
4
4
|
|
5
5
|
module GObject
|
6
6
|
# Module for attaching functions from the gobject library
|
7
7
|
module Lib
|
8
8
|
extend FFI::Library
|
9
9
|
extend FFI::BitMasks
|
10
|
-
ffi_lib
|
10
|
+
ffi_lib "gobject-2.0"
|
11
11
|
attach_function :g_type_from_name, [:string], :size_t
|
12
12
|
attach_function :g_type_fundamental, [:size_t], :size_t
|
13
13
|
attach_function :g_array_get_type, [], :size_t
|
14
14
|
attach_function :g_byte_array_get_type, [], :size_t
|
15
|
+
attach_function :g_error_get_type, [], :size_t
|
15
16
|
attach_function :g_hash_table_get_type, [], :size_t
|
16
17
|
attach_function :g_strv_get_type, [], :size_t
|
17
18
|
end
|
data/lib/gir_ffi-base/gobject.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Ensure GObject is defined by GirFFI itself
|
4
|
-
raise
|
4
|
+
raise "The module GObject was already defined elsewhere" if Kernel.const_defined? :GObject
|
5
5
|
|
6
|
-
require
|
6
|
+
require "gir_ffi-base/gobject/lib"
|
7
7
|
|
8
8
|
# The part of the GObject namespace that is needed by GirFFI.
|
9
9
|
#
|
@@ -17,32 +17,33 @@ module GObject
|
|
17
17
|
Lib.g_type_fundamental gtype
|
18
18
|
end
|
19
19
|
|
20
|
-
TYPE_INVALID = type_from_name(
|
21
|
-
TYPE_NONE = type_from_name(
|
22
|
-
TYPE_INTERFACE = type_from_name(
|
23
|
-
TYPE_CHAR = type_from_name(
|
24
|
-
TYPE_UCHAR = type_from_name(
|
25
|
-
TYPE_BOOLEAN = type_from_name(
|
26
|
-
TYPE_INT = type_from_name(
|
27
|
-
TYPE_UINT = type_from_name(
|
28
|
-
TYPE_LONG = type_from_name(
|
29
|
-
TYPE_ULONG = type_from_name(
|
30
|
-
TYPE_INT64 = type_from_name(
|
31
|
-
TYPE_UINT64 = type_from_name(
|
32
|
-
TYPE_ENUM = type_from_name(
|
33
|
-
TYPE_FLAGS = type_from_name(
|
34
|
-
TYPE_FLOAT = type_from_name(
|
35
|
-
TYPE_DOUBLE = type_from_name(
|
36
|
-
TYPE_STRING = type_from_name(
|
37
|
-
TYPE_POINTER = type_from_name(
|
38
|
-
TYPE_BOXED = type_from_name(
|
39
|
-
TYPE_PARAM = type_from_name(
|
40
|
-
TYPE_OBJECT = type_from_name(
|
41
|
-
TYPE_GTYPE = type_from_name(
|
42
|
-
TYPE_VARIANT = type_from_name(
|
20
|
+
TYPE_INVALID = type_from_name("invalid")
|
21
|
+
TYPE_NONE = type_from_name("void")
|
22
|
+
TYPE_INTERFACE = type_from_name("GInterface")
|
23
|
+
TYPE_CHAR = type_from_name("gchar")
|
24
|
+
TYPE_UCHAR = type_from_name("guchar")
|
25
|
+
TYPE_BOOLEAN = type_from_name("gboolean")
|
26
|
+
TYPE_INT = type_from_name("gint")
|
27
|
+
TYPE_UINT = type_from_name("guint")
|
28
|
+
TYPE_LONG = type_from_name("glong")
|
29
|
+
TYPE_ULONG = type_from_name("gulong")
|
30
|
+
TYPE_INT64 = type_from_name("gint64")
|
31
|
+
TYPE_UINT64 = type_from_name("guint64")
|
32
|
+
TYPE_ENUM = type_from_name("GEnum")
|
33
|
+
TYPE_FLAGS = type_from_name("GFlags")
|
34
|
+
TYPE_FLOAT = type_from_name("gfloat")
|
35
|
+
TYPE_DOUBLE = type_from_name("gdouble")
|
36
|
+
TYPE_STRING = type_from_name("gchararray")
|
37
|
+
TYPE_POINTER = type_from_name("gpointer")
|
38
|
+
TYPE_BOXED = type_from_name("GBoxed")
|
39
|
+
TYPE_PARAM = type_from_name("GParam")
|
40
|
+
TYPE_OBJECT = type_from_name("GObject")
|
41
|
+
TYPE_GTYPE = type_from_name("GType")
|
42
|
+
TYPE_VARIANT = type_from_name("GVariant")
|
43
43
|
|
44
44
|
TYPE_ARRAY = Lib.g_array_get_type
|
45
45
|
TYPE_BYTE_ARRAY = Lib.g_byte_array_get_type
|
46
|
+
TYPE_ERROR = Lib.g_error_get_type
|
46
47
|
TYPE_HASH_TABLE = Lib.g_hash_table_get_type
|
47
48
|
TYPE_STRV = Lib.g_strv_get_type
|
48
49
|
end
|
data/lib/gir_ffi-base.rb
CHANGED
data/lib/gir_ffi.rb
CHANGED