gir_ffi 0.6.7 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/{History.txt → Changelog.md} +93 -61
- data/{DESIGN.rdoc → DESIGN.md} +7 -7
- data/README.md +5 -7
- data/TODO.md +90 -0
- data/lib/ffi-glib.rb +0 -1
- data/lib/ffi-glib/array.rb +13 -29
- data/lib/ffi-glib/array_methods.rb +13 -0
- data/lib/ffi-glib/container_class_methods.rb +6 -1
- data/lib/ffi-glib/hash_table.rb +3 -2
- data/lib/ffi-glib/list.rb +3 -17
- data/lib/ffi-glib/list_methods.rb +22 -3
- data/lib/ffi-glib/ptr_array.rb +19 -19
- data/lib/ffi-glib/s_list.rb +3 -17
- data/lib/ffi-gobject.rb +10 -17
- data/lib/ffi-gobject/object.rb +19 -9
- data/lib/ffi-gobject/object_class.rb +14 -0
- data/lib/ffi-gobject/ruby_closure.rb +4 -5
- data/lib/ffi-gobject/value.rb +7 -5
- data/lib/ffi-gobject_introspection/i_vfunc_info.rb +1 -1
- data/lib/gir_ffi-base.rb +0 -2
- data/lib/gir_ffi-base/gobject.rb +1 -0
- data/lib/gir_ffi-base/gobject/lib.rb +1 -1
- data/lib/gir_ffi.rb +2 -0
- data/lib/gir_ffi/arg_helper.rb +18 -8
- data/lib/gir_ffi/builders/argument_builder.rb +62 -55
- data/lib/gir_ffi/builders/base_argument_builder.rb +52 -106
- data/lib/gir_ffi/builders/base_type_builder.rb +3 -3
- data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +34 -0
- data/lib/gir_ffi/builders/callback_argument_builder.rb +73 -0
- data/lib/gir_ffi/builders/callback_builder.rb +19 -9
- data/lib/gir_ffi/builders/callback_return_value_builder.rb +54 -0
- data/lib/gir_ffi/builders/closure_convertor.rb +9 -0
- data/lib/gir_ffi/builders/closure_to_pointer_convertor.rb +9 -0
- data/lib/gir_ffi/builders/constructor_result_convertor.rb +9 -0
- data/lib/gir_ffi/builders/enum_builder.rb +16 -16
- data/lib/gir_ffi/builders/field_builder.rb +36 -15
- data/lib/gir_ffi/builders/function_builder.rb +32 -27
- data/lib/gir_ffi/builders/interface_builder.rb +14 -4
- data/lib/gir_ffi/builders/mapping_method_builder.rb +95 -43
- data/lib/gir_ffi/builders/module_builder.rb +22 -35
- data/lib/gir_ffi/builders/null_convertor.rb +9 -0
- data/lib/gir_ffi/builders/object_builder.rb +11 -14
- data/lib/gir_ffi/builders/property_builder.rb +107 -9
- data/lib/gir_ffi/builders/registered_type_builder.rb +2 -2
- data/lib/gir_ffi/builders/return_value_builder.rb +42 -33
- data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +15 -0
- data/lib/gir_ffi/builders/signal_builder.rb +18 -58
- data/lib/gir_ffi/builders/struct_builder.rb +1 -2
- data/lib/gir_ffi/builders/type_builder.rb +1 -0
- data/lib/gir_ffi/builders/unintrospectable_builder.rb +4 -4
- data/lib/gir_ffi/builders/user_defined_builder.rb +151 -26
- data/lib/gir_ffi/builders/vfunc_builder.rb +57 -0
- data/lib/gir_ffi/builders/with_layout.rb +10 -8
- data/lib/gir_ffi/builders/with_methods.rb +1 -1
- data/lib/gir_ffi/callback_base.rb +42 -8
- data/lib/gir_ffi/class_base.rb +1 -2
- data/lib/gir_ffi/enum_base.rb +26 -4
- data/lib/gir_ffi/error_argument_info.rb +21 -0
- data/lib/gir_ffi/{setter_argument_info.rb → field_argument_info.rb} +2 -1
- data/lib/gir_ffi/g_type.rb +25 -0
- data/lib/gir_ffi/in_out_pointer.rb +3 -14
- data/lib/gir_ffi/in_pointer.rb +20 -21
- data/lib/gir_ffi/info_ext.rb +2 -0
- data/lib/gir_ffi/info_ext/i_callable_info.rb +0 -9
- data/lib/gir_ffi/info_ext/i_callback_info.rb +17 -0
- data/lib/gir_ffi/info_ext/i_function_info.rb +4 -0
- data/lib/gir_ffi/info_ext/i_property_info.rb +4 -0
- data/lib/gir_ffi/info_ext/i_registered_type_info.rb +1 -0
- data/lib/gir_ffi/info_ext/i_signal_info.rb +14 -16
- data/lib/gir_ffi/info_ext/i_type_info.rb +72 -34
- data/lib/gir_ffi/info_ext/i_vfunc_info.rb +12 -0
- data/lib/gir_ffi/info_ext/safe_constant_name.rb +3 -2
- data/lib/gir_ffi/interface_base.rb +8 -3
- data/lib/gir_ffi/module_base.rb +3 -5
- data/lib/gir_ffi/object_base.rb +8 -0
- data/lib/gir_ffi/receiver_argument_info.rb +21 -0
- data/lib/gir_ffi/receiver_type_info.rb +27 -0
- data/lib/gir_ffi/return_value_info.rb +23 -0
- data/lib/gir_ffi/signal_base.rb +1 -1
- data/lib/{ffi-glib → gir_ffi}/sized_array.rb +10 -6
- data/lib/gir_ffi/struct_base.rb +10 -9
- data/lib/gir_ffi/type_base.rb +1 -0
- data/lib/gir_ffi/type_map.rb +3 -0
- data/lib/gir_ffi/unintrospectable_type_info.rb +4 -1
- data/lib/gir_ffi/union_base.rb +4 -21
- data/lib/gir_ffi/user_data_argument_info.rb +21 -0
- data/lib/gir_ffi/user_data_type_info.rb +17 -0
- data/lib/gir_ffi/user_defined_type_info.rb +18 -4
- data/lib/gir_ffi/version.rb +1 -1
- data/lib/gir_ffi/vfunc_base.rb +8 -0
- data/lib/gir_ffi/vfunc_implementation.rb +11 -0
- data/lib/gir_ffi/zero_terminated.rb +18 -24
- data/test/base_test_helper.rb +2 -3
- data/test/ffi-glib/array_test.rb +3 -3
- data/test/ffi-glib/ruby_closure_test.rb +3 -3
- data/test/ffi-gobject/value_test.rb +15 -1
- data/test/ffi-gobject_test.rb +2 -1
- data/test/gir_ffi/arg_helper_test.rb +21 -2
- data/test/gir_ffi/builders/argument_builder_test.rb +213 -287
- data/test/gir_ffi/builders/base_argument_builder_test.rb +1 -1
- data/test/gir_ffi/builders/callback_builder_test.rb +26 -8
- data/test/gir_ffi/builders/field_builder_test.rb +18 -3
- data/test/gir_ffi/builders/function_builder_test.rb +30 -12
- data/test/gir_ffi/builders/interface_builder_test.rb +9 -0
- data/test/gir_ffi/builders/module_builder_test.rb +0 -39
- data/test/gir_ffi/builders/object_builder_test.rb +27 -27
- data/test/gir_ffi/builders/property_builder_test.rb +110 -0
- data/test/gir_ffi/builders/return_value_builder_test.rb +168 -200
- data/test/gir_ffi/builders/signal_builder_test.rb +58 -14
- data/test/gir_ffi/builders/struct_builder_test.rb +2 -41
- data/test/gir_ffi/builders/user_defined_builder_test.rb +88 -20
- data/test/gir_ffi/builders/vfunc_builder_test.rb +44 -0
- data/test/gir_ffi/g_type_test.rb +29 -0
- data/test/gir_ffi/in_pointer_test.rb +28 -9
- data/test/gir_ffi/info_ext/i_callable_info_test.rb +0 -9
- data/test/gir_ffi/info_ext/i_callback_info_test.rb +19 -0
- data/test/gir_ffi/info_ext/i_function_info_test.rb +9 -0
- data/test/gir_ffi/info_ext/i_signal_info_test.rb +8 -11
- data/test/gir_ffi/info_ext/i_type_info_test.rb +140 -16
- data/test/gir_ffi/interface_base_test.rb +9 -3
- data/test/gir_ffi/object_base_test.rb +1 -2
- data/test/{ffi-glib → gir_ffi}/sized_array_test.rb +28 -28
- data/test/gir_ffi/type_map_test.rb +1 -1
- data/test/gir_ffi/user_defined_type_info_test.rb +36 -4
- data/test/gir_ffi_test.rb +5 -5
- data/test/gir_ffi_test_helper.rb +4 -0
- data/test/integration/generated_gimarshallingtests_test.rb +163 -59
- data/test/integration/generated_gobject_test.rb +21 -8
- data/test/integration/generated_pango_test.rb +2 -2
- data/test/integration/generated_regress_test.rb +361 -101
- data/test/lib/autogen.sh +5 -1
- metadata +51 -35
- data/TODO.rdoc +0 -63
- data/lib/gir_ffi-base/gir_ffi/library.rb +0 -17
- data/lib/gir_ffi-base/gir_ffi/struct.rb +0 -27
@@ -5,15 +5,6 @@ module GirFFI
|
|
5
5
|
def argument_ffi_types
|
6
6
|
args.map { |arg| arg.to_ffitype }
|
7
7
|
end
|
8
|
-
|
9
|
-
def return_ffi_type
|
10
|
-
return_type.to_ffitype
|
11
|
-
end
|
12
|
-
|
13
|
-
# TODO: Move to extension just for ICallbackInfo
|
14
|
-
def to_ffitype
|
15
|
-
Builder.build_class(self)
|
16
|
-
end
|
17
8
|
end
|
18
9
|
end
|
19
10
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module GirFFI
|
2
|
+
module InfoExt
|
3
|
+
# Extensions for GObjectIntrospection::ICallbackInfo needed by GirFFI
|
4
|
+
module ICallbackInfo
|
5
|
+
def to_ffitype
|
6
|
+
Builder.build_class(self)
|
7
|
+
end
|
8
|
+
|
9
|
+
def return_ffi_type
|
10
|
+
return_type.to_callback_ffitype
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
GObjectIntrospection::ICallbackInfo.send :include, GirFFI::InfoExt::ICallbackInfo
|
17
|
+
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module GirFFI
|
2
2
|
module InfoExt
|
3
3
|
# Extensions for GObjectIntrospection::ISignalInfo needed by GirFFI
|
4
|
-
# TODO: Rename methods to not include 'signal' everywhere.
|
5
4
|
module ISignalInfo
|
6
5
|
# Create a signal hander callback. Wraps the given block in such a way that
|
7
6
|
# arguments and return value are cast correctly to the ruby world and back.
|
@@ -10,33 +9,32 @@ module GirFFI
|
|
10
9
|
#
|
11
10
|
# @return [FFI::Function] The signal handler, ready to be passed as a
|
12
11
|
# callback to C.
|
13
|
-
def
|
14
|
-
rettype = self.return_ffi_type
|
15
|
-
argtypes = self.ffi_callback_argument_types
|
16
|
-
|
12
|
+
def create_callback &block
|
17
13
|
raise ArgumentError, "Block needed" unless block
|
18
14
|
|
19
15
|
# TODO: Find the signal module directly, then retrieve the info
|
20
16
|
# from that, instead of vice versa.
|
21
17
|
bldr = Builders::SignalBuilder.new(self)
|
22
18
|
wrapped = bldr.build_class.from(block)
|
23
|
-
FFI::Function.new
|
19
|
+
FFI::Function.new return_ffi_type, ffi_callback_argument_types, &wrapped
|
24
20
|
end
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
# TODO: Use argument info to convert out arguments and array lengths.
|
23
|
+
def arguments_to_gvalue_array_pointer object, args
|
24
|
+
arr = arguments_to_gvalues object, args
|
25
|
+
GirFFI::InPointer.from_array GObject::Value, arr
|
26
|
+
end
|
30
27
|
|
31
|
-
|
32
|
-
|
28
|
+
def arguments_to_gvalues instance, arguments
|
29
|
+
arg_values = self.args.zip(arguments).map do |info, arg|
|
30
|
+
info.argument_type.make_g_value.set_value(arg)
|
33
31
|
end
|
34
32
|
|
35
|
-
|
33
|
+
arg_values.unshift GObject::Value.wrap_instance(instance)
|
36
34
|
end
|
37
35
|
|
38
|
-
def
|
39
|
-
|
36
|
+
def gvalue_for_return_value
|
37
|
+
return_type.make_g_value
|
40
38
|
end
|
41
39
|
|
42
40
|
# TODO: Rename and clarify relation to argument_ffi_types:
|
@@ -52,7 +50,7 @@ module GirFFI
|
|
52
50
|
end
|
53
51
|
|
54
52
|
def return_ffi_type
|
55
|
-
result =
|
53
|
+
result = return_type.to_ffitype
|
56
54
|
if result == GLib::Boolean
|
57
55
|
:bool
|
58
56
|
else
|
@@ -2,17 +2,30 @@ require 'gir_ffi/builder_helper'
|
|
2
2
|
|
3
3
|
module GirFFI
|
4
4
|
module InfoExt
|
5
|
-
# Extensions for GObjectIntrospection::
|
5
|
+
# Extensions for GObjectIntrospection::ITypeInfo needed by GirFFI
|
6
6
|
module ITypeInfo
|
7
|
-
|
7
|
+
|
8
|
+
def self.flattened_tag_to_gtype_map
|
9
|
+
@flattened_tag_to_gtype_map ||= {
|
10
|
+
:array => GObject::TYPE_ARRAY,
|
11
|
+
:c => GObject::TYPE_POINTER,
|
12
|
+
:gboolean => GObject::TYPE_BOOLEAN,
|
13
|
+
:ghash => GObject::TYPE_HASH_TABLE,
|
14
|
+
:gint32 => GObject::TYPE_INT,
|
15
|
+
:gint64 => GObject::TYPE_INT64,
|
16
|
+
:guint64 => GObject::TYPE_UINT64,
|
17
|
+
:strv => GObject::TYPE_STRV,
|
18
|
+
:utf8 => GObject::TYPE_STRING,
|
19
|
+
:void => GObject::TYPE_NONE
|
20
|
+
}
|
21
|
+
end
|
8
22
|
|
9
23
|
def g_type
|
10
|
-
tag
|
11
|
-
case tag
|
12
|
-
when :interface
|
24
|
+
if tag == :interface
|
13
25
|
interface.g_type
|
14
26
|
else
|
15
|
-
|
27
|
+
ITypeInfo.flattened_tag_to_gtype_map[flattened_tag] or
|
28
|
+
raise "Can't find type for #{flattened_tag} pointer? = #{pointer?}"
|
16
29
|
end
|
17
30
|
end
|
18
31
|
|
@@ -22,10 +35,10 @@ module GirFFI
|
|
22
35
|
|
23
36
|
def element_type
|
24
37
|
case tag
|
25
|
-
when :glist, :gslist, :array
|
26
|
-
|
38
|
+
when :glist, :gslist, :array, :c
|
39
|
+
enumerable_element_type
|
27
40
|
when :ghash
|
28
|
-
|
41
|
+
dictionary_element_type
|
29
42
|
else
|
30
43
|
nil
|
31
44
|
end
|
@@ -46,18 +59,16 @@ module GirFFI
|
|
46
59
|
tag == :interface && interface.info_type
|
47
60
|
end
|
48
61
|
|
49
|
-
def subtype_tag_or_class index = 0
|
50
|
-
param_type(index).tag_or_class
|
51
|
-
end
|
52
|
-
|
53
62
|
def tag_or_class
|
54
|
-
base = case
|
55
|
-
when
|
63
|
+
base = case tag
|
64
|
+
when:interface
|
56
65
|
Builder.build_class interface
|
66
|
+
when :ghash
|
67
|
+
[tag, *element_type]
|
57
68
|
else
|
58
69
|
flattened_tag
|
59
70
|
end
|
60
|
-
if pointer? && tag != :utf8 && tag != :filename
|
71
|
+
if pointer? && tag != :utf8 && tag != :filename
|
61
72
|
[:pointer, base]
|
62
73
|
else
|
63
74
|
base
|
@@ -67,8 +78,7 @@ module GirFFI
|
|
67
78
|
TAG_TO_WRAPPER_CLASS_MAP = {
|
68
79
|
:array => 'GLib::Array',
|
69
80
|
:byte_array => 'GLib::ByteArray',
|
70
|
-
:c => '
|
71
|
-
:callback => 'GirFFI::Callback',
|
81
|
+
:c => 'GirFFI::SizedArray',
|
72
82
|
:error => 'GLib::Error',
|
73
83
|
:ghash => 'GLib::HashTable',
|
74
84
|
:glist => 'GLib::List',
|
@@ -82,8 +92,7 @@ module GirFFI
|
|
82
92
|
|
83
93
|
# TODO: Use class rather than class name
|
84
94
|
def argument_class_name
|
85
|
-
|
86
|
-
when :struct, :union, :object, :interface, :enum, :flags, :callback
|
95
|
+
if tag == :interface
|
87
96
|
interface.full_type_name
|
88
97
|
else
|
89
98
|
TAG_TO_WRAPPER_CLASS_MAP[flattened_tag]
|
@@ -93,28 +102,20 @@ module GirFFI
|
|
93
102
|
def to_ffitype
|
94
103
|
return :pointer if pointer?
|
95
104
|
|
96
|
-
|
97
|
-
case type_tag
|
105
|
+
case tag
|
98
106
|
when :interface
|
99
107
|
interface.to_ffitype
|
100
108
|
when :array
|
101
|
-
|
102
|
-
# NOTE: Don't use pointer directly to appease JRuby.
|
103
|
-
if subtype == :pointer
|
104
|
-
subtype = :"uint#{FFI.type_size(:pointer)*8}"
|
105
|
-
end
|
106
|
-
[subtype, array_fixed_size]
|
109
|
+
[subtype_ffitype(0), array_fixed_size]
|
107
110
|
else
|
108
|
-
TypeMap.map_basic_type
|
111
|
+
TypeMap.map_basic_type tag
|
109
112
|
end
|
110
113
|
end
|
111
114
|
|
112
115
|
def to_callback_ffitype
|
113
|
-
type_tag = tag
|
114
|
-
|
115
116
|
return :pointer if pointer?
|
116
117
|
|
117
|
-
if
|
118
|
+
if tag == :interface
|
118
119
|
case interface.info_type
|
119
120
|
when :enum, :flags
|
120
121
|
:int32
|
@@ -122,16 +123,31 @@ module GirFFI
|
|
122
123
|
:pointer
|
123
124
|
end
|
124
125
|
else
|
125
|
-
|
126
|
+
TypeMap.map_basic_type tag
|
126
127
|
end
|
127
128
|
end
|
128
129
|
|
130
|
+
def needs_ruby_to_c_conversion_for_functions?
|
131
|
+
[ :array, :c, :callback, :ghash, :glist, :gslist, :object, :ptr_array,
|
132
|
+
:struct, :strv, :utf8, :void, :zero_terminated ].include?(flattened_tag)
|
133
|
+
end
|
134
|
+
|
135
|
+
def needs_conversion_for_functions?
|
136
|
+
[ :array, :byte_array, :c, :error, :filename, :ghash, :glist,
|
137
|
+
:gslist, :interface, :object, :ptr_array, :struct, :strv, :union,
|
138
|
+
:utf8, :zero_terminated ].include?(flattened_tag)
|
139
|
+
end
|
140
|
+
|
141
|
+
def needs_conversion_for_callbacks?
|
142
|
+
flattened_tag == :enum || needs_conversion_for_functions?
|
143
|
+
end
|
144
|
+
|
129
145
|
def extra_conversion_arguments
|
130
146
|
case flattened_tag
|
131
147
|
when :utf8, :void
|
132
148
|
[flattened_tag]
|
133
149
|
when :c
|
134
|
-
[
|
150
|
+
[element_type, array_fixed_size]
|
135
151
|
when :array, :ghash, :glist, :gslist, :ptr_array, :zero_terminated
|
136
152
|
[element_type]
|
137
153
|
else
|
@@ -141,6 +157,28 @@ module GirFFI
|
|
141
157
|
|
142
158
|
private
|
143
159
|
|
160
|
+
def subtype_tag_or_class index
|
161
|
+
param_type(index).tag_or_class
|
162
|
+
end
|
163
|
+
|
164
|
+
def dictionary_element_type
|
165
|
+
[subtype_tag_or_class(0), subtype_tag_or_class(1)]
|
166
|
+
end
|
167
|
+
|
168
|
+
def enumerable_element_type
|
169
|
+
subtype_tag_or_class 0
|
170
|
+
end
|
171
|
+
|
172
|
+
def subtype_ffitype(index)
|
173
|
+
subtype = param_type(index).to_ffitype
|
174
|
+
if subtype == :pointer
|
175
|
+
# NOTE: Don't use pointer directly to appease JRuby.
|
176
|
+
:"uint#{FFI.type_size(:pointer)*8}"
|
177
|
+
else
|
178
|
+
subtype
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
144
182
|
def flattened_array_type
|
145
183
|
if zero_terminated?
|
146
184
|
zero_terminated_array_type
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module GirFFI
|
2
|
+
module InfoExt
|
3
|
+
# Extensions for GObjectIntrospection::IVFuncInfo needed by GirFFI
|
4
|
+
module IVFuncInfo
|
5
|
+
def return_ffi_type
|
6
|
+
return_type.to_callback_ffitype
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
GObjectIntrospection::IVFuncInfo.send :include, GirFFI::InfoExt::IVFuncInfo
|
@@ -13,9 +13,9 @@ module GirFFI
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
# FIXME:
|
16
|
+
# FIXME: This is invalid for ISignalInfo and IVFuncInfo
|
17
17
|
def full_type_name
|
18
|
-
"
|
18
|
+
"#{safe_namespace}::#{safe_name}"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -25,3 +25,4 @@ GObjectIntrospection::ICallbackInfo.send :include, GirFFI::InfoExt::SafeConstant
|
|
25
25
|
GObjectIntrospection::IConstantInfo.send :include, GirFFI::InfoExt::SafeConstantName
|
26
26
|
GObjectIntrospection::IRegisteredTypeInfo.send :include, GirFFI::InfoExt::SafeConstantName
|
27
27
|
GObjectIntrospection::ISignalInfo.send :include, GirFFI::InfoExt::SafeConstantName
|
28
|
+
GObjectIntrospection::IVFuncInfo.send :include, GirFFI::InfoExt::SafeConstantName
|
@@ -1,8 +1,9 @@
|
|
1
|
+
require 'gir_ffi/type_base'
|
2
|
+
|
1
3
|
module GirFFI
|
4
|
+
# Base module for modules representing GLib interfaces.
|
2
5
|
module InterfaceBase
|
3
|
-
|
4
|
-
self.const_get :GIR_FFI_BUILDER
|
5
|
-
end
|
6
|
+
include TypeBase
|
6
7
|
|
7
8
|
def setup_instance_method name
|
8
9
|
gir_ffi_builder.setup_instance_method name
|
@@ -11,5 +12,9 @@ module GirFFI
|
|
11
12
|
def wrap ptr
|
12
13
|
ptr.to_object
|
13
14
|
end
|
15
|
+
|
16
|
+
def to_ffitype
|
17
|
+
:pointer
|
18
|
+
end
|
14
19
|
end
|
15
20
|
end
|
data/lib/gir_ffi/module_base.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
module GirFFI
|
2
|
+
# Base module for modules representing GLib namespaces.
|
2
3
|
module ModuleBase
|
3
4
|
def method_missing method, *arguments, &block
|
4
5
|
result = setup_method method.to_s
|
@@ -10,15 +11,12 @@ module GirFFI
|
|
10
11
|
load_class(classname) || super
|
11
12
|
end
|
12
13
|
|
13
|
-
# @deprecated Compatibility function. Remove in 0.7.0.
|
14
|
-
def load_class classname
|
15
|
-
setup_class classname
|
16
|
-
end
|
17
|
-
|
18
14
|
def setup_class classname
|
19
15
|
gir_ffi_builder.build_namespaced_class classname.to_s
|
20
16
|
end
|
21
17
|
|
18
|
+
alias load_class setup_class
|
19
|
+
|
22
20
|
def gir_ffi_builder
|
23
21
|
self.const_get :GIR_FFI_BUILDER
|
24
22
|
end
|
data/lib/gir_ffi/object_base.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Class to represent the info for the receiver argument of a callback or signal
|
2
|
+
# handler. Implements the necessary parts of IArgumentInfo's interface.
|
3
|
+
class GirFFI::ReceiverArgumentInfo
|
4
|
+
attr_reader :argument_type
|
5
|
+
|
6
|
+
def initialize type
|
7
|
+
@argument_type = type
|
8
|
+
end
|
9
|
+
|
10
|
+
def direction
|
11
|
+
:in
|
12
|
+
end
|
13
|
+
|
14
|
+
def skip?
|
15
|
+
false
|
16
|
+
end
|
17
|
+
|
18
|
+
def name
|
19
|
+
"_instance"
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module GirFFI
|
2
|
+
# Represents the type of the receiver of a signal or vfunc, conforming, as
|
3
|
+
# needed, to the interface of GObjectIntrospection::ITypeInfo
|
4
|
+
class ReceiverTypeInfo
|
5
|
+
include InfoExt::ITypeInfo
|
6
|
+
|
7
|
+
def initialize interface_info
|
8
|
+
@interface_info = interface_info
|
9
|
+
end
|
10
|
+
|
11
|
+
def interface
|
12
|
+
@interface_info
|
13
|
+
end
|
14
|
+
|
15
|
+
def tag
|
16
|
+
:interface
|
17
|
+
end
|
18
|
+
|
19
|
+
def pointer?
|
20
|
+
false
|
21
|
+
end
|
22
|
+
|
23
|
+
def array_length
|
24
|
+
-1
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|