gir_ffi 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +7 -0
- data/TODO.md +8 -0
- data/lib/ffi-glib/array.rb +7 -7
- data/lib/ffi-glib/byte_array.rb +3 -4
- data/lib/ffi-glib/bytes.rb +3 -3
- data/lib/ffi-glib/error.rb +2 -2
- data/lib/ffi-glib/hash_table.rb +7 -7
- data/lib/ffi-glib/iconv.rb +3 -4
- data/lib/ffi-glib/list.rb +3 -3
- data/lib/ffi-glib/list_methods.rb +3 -3
- data/lib/ffi-glib/ptr_array.rb +6 -6
- data/lib/ffi-glib/s_list.rb +3 -3
- data/lib/ffi-glib/strv.rb +3 -3
- data/lib/ffi-glib/variant.rb +6 -2
- data/lib/ffi-glib.rb +3 -0
- data/lib/ffi-gobject/base.rb +1 -0
- data/lib/ffi-gobject/closure.rb +2 -2
- data/lib/ffi-gobject/initially_unowned.rb +4 -3
- data/lib/ffi-gobject/object.rb +5 -5
- data/lib/ffi-gobject/object_class.rb +2 -2
- data/lib/ffi-gobject/ruby_closure.rb +2 -3
- data/lib/ffi-gobject/value.rb +5 -5
- data/lib/ffi-gobject.rb +17 -22
- data/lib/ffi-gobject_introspection/i_arg_info.rb +0 -1
- data/lib/ffi-gobject_introspection/i_base_info.rb +3 -4
- data/lib/ffi-gobject_introspection/i_callable_info.rb +1 -2
- data/lib/ffi-gobject_introspection/i_constant_info.rb +19 -11
- data/lib/ffi-gobject_introspection/i_enum_info.rb +4 -3
- data/lib/ffi-gobject_introspection/i_function_info.rb +7 -1
- data/lib/ffi-gobject_introspection/i_interface_info.rb +12 -0
- data/lib/ffi-gobject_introspection/i_object_info.rb +19 -8
- data/lib/ffi-gobject_introspection/i_registered_type_info.rb +0 -1
- data/lib/ffi-gobject_introspection/i_repository.rb +10 -15
- data/lib/ffi-gobject_introspection/i_struct_info.rb +4 -2
- data/lib/ffi-gobject_introspection/i_type_info.rb +4 -2
- data/lib/ffi-gobject_introspection/i_union_info.rb +7 -3
- data/lib/ffi-gobject_introspection/i_value_info.rb +0 -1
- data/lib/ffi-gobject_introspection/lib.rb +1 -2
- data/lib/ffi-gobject_introspection.rb +0 -1
- data/lib/gir_ffi/allocation_helper.rb +2 -1
- data/lib/gir_ffi/arg_helper.rb +6 -2
- data/lib/gir_ffi/builder_helper.rb +1 -0
- data/lib/gir_ffi/builders/argument_builder_collection.rb +67 -0
- data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +2 -0
- data/lib/gir_ffi/builders/callback_argument_builder.rb +7 -5
- data/lib/gir_ffi/builders/callback_builder.rb +3 -1
- data/lib/gir_ffi/builders/callback_return_value_builder.rb +2 -0
- data/lib/gir_ffi/builders/closure_argument_builder.rb +13 -0
- data/lib/gir_ffi/builders/closure_convertor.rb +2 -0
- data/lib/gir_ffi/builders/closure_to_pointer_convertor.rb +2 -0
- data/lib/gir_ffi/builders/constructor_result_convertor.rb +1 -0
- data/lib/gir_ffi/builders/enum_builder.rb +1 -4
- data/lib/gir_ffi/builders/field_builder.rb +2 -2
- data/lib/gir_ffi/builders/function_builder.rb +2 -1
- data/lib/gir_ffi/builders/interface_builder.rb +0 -3
- data/lib/gir_ffi/builders/mapping_method_builder.rb +24 -92
- data/lib/gir_ffi/builders/marshalling_method_builder.rb +73 -0
- data/lib/gir_ffi/builders/null_argument_builder.rb +3 -0
- data/lib/gir_ffi/builders/null_builder.rb +1 -0
- data/lib/gir_ffi/builders/object_builder.rb +0 -2
- data/lib/gir_ffi/builders/property_builder.rb +4 -4
- data/lib/gir_ffi/builders/registered_type_builder.rb +35 -1
- data/lib/gir_ffi/builders/return_value_builder.rb +4 -6
- data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +2 -0
- data/lib/gir_ffi/builders/signal_closure_builder.rb +46 -0
- data/lib/gir_ffi/builders/struct_builder.rb +0 -2
- data/lib/gir_ffi/builders/type_builder.rb +1 -1
- data/lib/gir_ffi/builders/unintrospectable_builder.rb +1 -1
- data/lib/gir_ffi/builders/union_builder.rb +0 -2
- data/lib/gir_ffi/builders/user_defined_builder.rb +6 -18
- data/lib/gir_ffi/builders/vfunc_builder.rb +6 -4
- data/lib/gir_ffi/builders/with_layout.rb +1 -2
- data/lib/gir_ffi/callback_base.rb +4 -4
- data/lib/gir_ffi/class_base.rb +28 -18
- data/lib/gir_ffi/enum_base.rb +2 -2
- data/lib/gir_ffi/ffi_ext/pointer.rb +1 -0
- data/lib/gir_ffi/in_out_pointer.rb +4 -4
- data/lib/gir_ffi/in_pointer.rb +2 -2
- data/lib/gir_ffi/info_ext/full_type_name.rb +16 -0
- data/lib/gir_ffi/info_ext/i_arg_info.rb +2 -3
- data/lib/gir_ffi/info_ext/i_callback_info.rb +1 -8
- data/lib/gir_ffi/info_ext/i_property_info.rb +0 -1
- data/lib/gir_ffi/info_ext/i_registered_type_info.rb +0 -1
- data/lib/gir_ffi/info_ext/i_signal_info.rb +8 -40
- data/lib/gir_ffi/info_ext/i_type_info.rb +12 -2
- data/lib/gir_ffi/info_ext/i_vfunc_info.rb +1 -6
- data/lib/gir_ffi/info_ext/safe_constant_name.rb +0 -5
- data/lib/gir_ffi/info_ext.rb +1 -0
- data/lib/gir_ffi/lib_c.rb +1 -0
- data/lib/gir_ffi/module_base.rb +2 -2
- data/lib/gir_ffi/object_base.rb +0 -16
- data/lib/gir_ffi/receiver_argument_info.rb +0 -4
- data/lib/gir_ffi/registered_type_base.rb +0 -1
- data/lib/gir_ffi/sized_array.rb +5 -5
- data/lib/gir_ffi/struct_base.rb +4 -0
- data/lib/gir_ffi/type_base.rb +2 -2
- data/lib/gir_ffi/type_map.rb +1 -0
- data/lib/gir_ffi/unintrospectable_type_info.rb +1 -3
- data/lib/gir_ffi/user_data_type_info.rb +2 -0
- data/lib/gir_ffi/version.rb +2 -1
- data/lib/gir_ffi/zero_terminated.rb +6 -6
- data/lib/gir_ffi-base/glib/boolean.rb +2 -2
- data/lib/gir_ffi-base/glib/strv.rb +1 -1
- data/lib/gir_ffi-base/gobject/lib.rb +1 -0
- data/lib/gir_ffi-base/gobject.rb +1 -1
- data/lib/gir_ffi.rb +2 -0
- data/test/ffi-glib/hash_table_test.rb +1 -1
- data/test/ffi-glib/strv_test.rb +27 -0
- data/test/ffi-gobject_introspection/i_constant_info_test.rb +1 -5
- data/test/ffi-gobject_test.rb +3 -3
- data/test/gir_ffi/builders/{with_methods_test.rb → registered_type_builder_test.rb} +1 -1
- data/test/gir_ffi/builders/signal_closure_builder_test.rb +136 -0
- data/test/gir_ffi/builders/user_defined_builder_test.rb +2 -1
- data/test/gir_ffi/info_ext/i_signal_info_test.rb +0 -11
- data/test/integration/generated_gimarshallingtests_test.rb +47 -2
- data/test/integration/generated_regress_test.rb +19 -11
- metadata +82 -25
- data/lib/gir_ffi/builders/signal_builder.rb +0 -51
- data/lib/gir_ffi/builders/with_methods.rb +0 -45
- data/lib/gir_ffi/signal_base.rb +0 -21
- data/lib/gir_ffi/vfunc_base.rb +0 -9
- data/test/gir_ffi/builders/signal_builder_test.rb +0 -106
metadata
CHANGED
@@ -1,85 +1,141 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gir_ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matijs van Zuijlen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.8'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: indentation
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.1.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.1.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 5.2
|
47
|
+
version: '5.2'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 5.2
|
54
|
+
version: '5.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rr
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.1.2
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.1.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '10.1'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '10.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: repl_rake
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: yard
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
83
139
|
description: |2
|
84
140
|
GirFFI creates bindings for GObject-based libraries at runtime based on introspection
|
85
141
|
data provided by the GObject Introspection Repository (GIR) system. Bindings are created
|
@@ -164,12 +220,14 @@ files:
|
|
164
220
|
- lib/gir_ffi/builder.rb
|
165
221
|
- lib/gir_ffi/builder_helper.rb
|
166
222
|
- lib/gir_ffi/builders/argument_builder.rb
|
223
|
+
- lib/gir_ffi/builders/argument_builder_collection.rb
|
167
224
|
- lib/gir_ffi/builders/base_argument_builder.rb
|
168
225
|
- lib/gir_ffi/builders/base_type_builder.rb
|
169
226
|
- lib/gir_ffi/builders/c_to_ruby_convertor.rb
|
170
227
|
- lib/gir_ffi/builders/callback_argument_builder.rb
|
171
228
|
- lib/gir_ffi/builders/callback_builder.rb
|
172
229
|
- lib/gir_ffi/builders/callback_return_value_builder.rb
|
230
|
+
- lib/gir_ffi/builders/closure_argument_builder.rb
|
173
231
|
- lib/gir_ffi/builders/closure_convertor.rb
|
174
232
|
- lib/gir_ffi/builders/closure_to_pointer_convertor.rb
|
175
233
|
- lib/gir_ffi/builders/constant_builder.rb
|
@@ -180,6 +238,7 @@ files:
|
|
180
238
|
- lib/gir_ffi/builders/function_builder.rb
|
181
239
|
- lib/gir_ffi/builders/interface_builder.rb
|
182
240
|
- lib/gir_ffi/builders/mapping_method_builder.rb
|
241
|
+
- lib/gir_ffi/builders/marshalling_method_builder.rb
|
183
242
|
- lib/gir_ffi/builders/module_builder.rb
|
184
243
|
- lib/gir_ffi/builders/null_argument_builder.rb
|
185
244
|
- lib/gir_ffi/builders/null_builder.rb
|
@@ -189,7 +248,7 @@ files:
|
|
189
248
|
- lib/gir_ffi/builders/registered_type_builder.rb
|
190
249
|
- lib/gir_ffi/builders/return_value_builder.rb
|
191
250
|
- lib/gir_ffi/builders/ruby_to_c_convertor.rb
|
192
|
-
- lib/gir_ffi/builders/
|
251
|
+
- lib/gir_ffi/builders/signal_closure_builder.rb
|
193
252
|
- lib/gir_ffi/builders/struct_builder.rb
|
194
253
|
- lib/gir_ffi/builders/type_builder.rb
|
195
254
|
- lib/gir_ffi/builders/unintrospectable_builder.rb
|
@@ -197,7 +256,6 @@ files:
|
|
197
256
|
- lib/gir_ffi/builders/user_defined_builder.rb
|
198
257
|
- lib/gir_ffi/builders/vfunc_builder.rb
|
199
258
|
- lib/gir_ffi/builders/with_layout.rb
|
200
|
-
- lib/gir_ffi/builders/with_methods.rb
|
201
259
|
- lib/gir_ffi/callback_base.rb
|
202
260
|
- lib/gir_ffi/class_base.rb
|
203
261
|
- lib/gir_ffi/enum_base.rb
|
@@ -211,6 +269,7 @@ files:
|
|
211
269
|
- lib/gir_ffi/in_out_pointer.rb
|
212
270
|
- lib/gir_ffi/in_pointer.rb
|
213
271
|
- lib/gir_ffi/info_ext.rb
|
272
|
+
- lib/gir_ffi/info_ext/full_type_name.rb
|
214
273
|
- lib/gir_ffi/info_ext/i_arg_info.rb
|
215
274
|
- lib/gir_ffi/info_ext/i_callable_info.rb
|
216
275
|
- lib/gir_ffi/info_ext/i_callback_info.rb
|
@@ -232,7 +291,6 @@ files:
|
|
232
291
|
- lib/gir_ffi/receiver_type_info.rb
|
233
292
|
- lib/gir_ffi/registered_type_base.rb
|
234
293
|
- lib/gir_ffi/return_value_info.rb
|
235
|
-
- lib/gir_ffi/signal_base.rb
|
236
294
|
- lib/gir_ffi/sized_array.rb
|
237
295
|
- lib/gir_ffi/struct_base.rb
|
238
296
|
- lib/gir_ffi/type_base.rb
|
@@ -245,7 +303,6 @@ files:
|
|
245
303
|
- lib/gir_ffi/user_defined_type_info.rb
|
246
304
|
- lib/gir_ffi/variable_name_generator.rb
|
247
305
|
- lib/gir_ffi/version.rb
|
248
|
-
- lib/gir_ffi/vfunc_base.rb
|
249
306
|
- lib/gir_ffi/vfunc_implementation.rb
|
250
307
|
- lib/gir_ffi/zero_terminated.rb
|
251
308
|
- tasks/test.rake
|
@@ -292,14 +349,14 @@ files:
|
|
292
349
|
- test/gir_ffi/builders/module_builder_test.rb
|
293
350
|
- test/gir_ffi/builders/object_builder_test.rb
|
294
351
|
- test/gir_ffi/builders/property_builder_test.rb
|
352
|
+
- test/gir_ffi/builders/registered_type_builder_test.rb
|
295
353
|
- test/gir_ffi/builders/return_value_builder_test.rb
|
296
|
-
- test/gir_ffi/builders/
|
354
|
+
- test/gir_ffi/builders/signal_closure_builder_test.rb
|
297
355
|
- test/gir_ffi/builders/struct_builder_test.rb
|
298
356
|
- test/gir_ffi/builders/unintrospectable_builder_test.rb
|
299
357
|
- test/gir_ffi/builders/union_builder_test.rb
|
300
358
|
- test/gir_ffi/builders/user_defined_builder_test.rb
|
301
359
|
- test/gir_ffi/builders/vfunc_builder_test.rb
|
302
|
-
- test/gir_ffi/builders/with_methods_test.rb
|
303
360
|
- test/gir_ffi/callback_base_test.rb
|
304
361
|
- test/gir_ffi/class_base_test.rb
|
305
362
|
- test/gir_ffi/error_type_info_test.rb
|
@@ -349,18 +406,18 @@ licenses:
|
|
349
406
|
metadata: {}
|
350
407
|
post_install_message:
|
351
408
|
rdoc_options:
|
352
|
-
- --main
|
409
|
+
- "--main"
|
353
410
|
- README.md
|
354
411
|
require_paths:
|
355
412
|
- lib
|
356
413
|
required_ruby_version: !ruby/object:Gem::Requirement
|
357
414
|
requirements:
|
358
|
-
- -
|
415
|
+
- - ">="
|
359
416
|
- !ruby/object:Gem::Version
|
360
417
|
version: '0'
|
361
418
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
362
419
|
requirements:
|
363
|
-
- -
|
420
|
+
- - ">="
|
364
421
|
- !ruby/object:Gem::Version
|
365
422
|
version: '0'
|
366
423
|
requirements: []
|
@@ -411,14 +468,14 @@ test_files:
|
|
411
468
|
- test/gir_ffi/builders/module_builder_test.rb
|
412
469
|
- test/gir_ffi/builders/object_builder_test.rb
|
413
470
|
- test/gir_ffi/builders/property_builder_test.rb
|
471
|
+
- test/gir_ffi/builders/registered_type_builder_test.rb
|
414
472
|
- test/gir_ffi/builders/return_value_builder_test.rb
|
415
|
-
- test/gir_ffi/builders/
|
473
|
+
- test/gir_ffi/builders/signal_closure_builder_test.rb
|
416
474
|
- test/gir_ffi/builders/struct_builder_test.rb
|
417
475
|
- test/gir_ffi/builders/unintrospectable_builder_test.rb
|
418
476
|
- test/gir_ffi/builders/union_builder_test.rb
|
419
477
|
- test/gir_ffi/builders/user_defined_builder_test.rb
|
420
478
|
- test/gir_ffi/builders/vfunc_builder_test.rb
|
421
|
-
- test/gir_ffi/builders/with_methods_test.rb
|
422
479
|
- test/gir_ffi/callback_base_test.rb
|
423
480
|
- test/gir_ffi/class_base_test.rb
|
424
481
|
- test/gir_ffi/error_type_info_test.rb
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'gir_ffi/builders/base_type_builder'
|
2
|
-
require 'gir_ffi/builders/mapping_method_builder'
|
3
|
-
require 'gir_ffi/receiver_type_info'
|
4
|
-
require 'gir_ffi/receiver_argument_info'
|
5
|
-
require 'gir_ffi/signal_base'
|
6
|
-
require 'gir_ffi/user_data_type_info'
|
7
|
-
require 'gir_ffi/user_data_argument_info'
|
8
|
-
|
9
|
-
module GirFFI
|
10
|
-
module Builders
|
11
|
-
# Implements the creation of a signal module for handling a particular
|
12
|
-
# signal. The type will be attached to the appropriate class.
|
13
|
-
class SignalBuilder < BaseTypeBuilder
|
14
|
-
def instantiate_class
|
15
|
-
unless already_set_up
|
16
|
-
klass.extend SignalBase
|
17
|
-
setup_constants
|
18
|
-
klass.class_eval mapping_method_definition
|
19
|
-
end
|
20
|
-
klass
|
21
|
-
end
|
22
|
-
|
23
|
-
def klass
|
24
|
-
@klass ||= get_or_define_module container_class, @classname
|
25
|
-
end
|
26
|
-
|
27
|
-
def mapping_method_definition
|
28
|
-
arg_infos = info.args
|
29
|
-
|
30
|
-
container_type_info = ReceiverTypeInfo.new(container_info)
|
31
|
-
receiver_info = ReceiverArgumentInfo.new(container_type_info)
|
32
|
-
|
33
|
-
user_data_type_info = UserDataTypeInfo.new
|
34
|
-
user_data_argument_info = UserDataArgumentInfo.new(user_data_type_info)
|
35
|
-
|
36
|
-
MappingMethodBuilder.for_signal(receiver_info,
|
37
|
-
arg_infos,
|
38
|
-
user_data_argument_info,
|
39
|
-
info.return_type).method_definition
|
40
|
-
end
|
41
|
-
|
42
|
-
def container_class
|
43
|
-
@container_class ||= Builder.build_class(container_info)
|
44
|
-
end
|
45
|
-
|
46
|
-
def container_info
|
47
|
-
@container_info ||= info.container
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'gir_ffi/method_stubber'
|
2
|
-
|
3
|
-
module GirFFI
|
4
|
-
module Builders
|
5
|
-
# Implements method creation for types such as, :union, :struct,
|
6
|
-
# :object, :interface.
|
7
|
-
module WithMethods
|
8
|
-
def setup_method method
|
9
|
-
go = info.find_method method
|
10
|
-
attach_and_define_method method, go, meta_class
|
11
|
-
end
|
12
|
-
|
13
|
-
def setup_instance_method method
|
14
|
-
go = info.find_instance_method method
|
15
|
-
attach_and_define_method method, go, build_class
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def meta_class
|
21
|
-
klass = build_class
|
22
|
-
return (class << klass; self; end)
|
23
|
-
end
|
24
|
-
|
25
|
-
def function_definition go
|
26
|
-
FunctionBuilder.new(go).generate
|
27
|
-
end
|
28
|
-
|
29
|
-
def attach_and_define_method method, go, modul
|
30
|
-
return unless go
|
31
|
-
method = go.safe_name
|
32
|
-
Builder.attach_ffi_function lib, go
|
33
|
-
modul.class_eval { remove_method method if method_defined? method }
|
34
|
-
build_class.class_eval function_definition(go)
|
35
|
-
return method
|
36
|
-
end
|
37
|
-
|
38
|
-
def stub_methods
|
39
|
-
info.get_methods.each do |minfo|
|
40
|
-
klass.class_eval MethodStubber.new(minfo).method_stub
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/lib/gir_ffi/signal_base.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'gir_ffi/type_base'
|
2
|
-
|
3
|
-
module GirFFI
|
4
|
-
module SignalBase
|
5
|
-
include TypeBase
|
6
|
-
|
7
|
-
# Create signal handler from a Proc. Makes sure arguments are properly
|
8
|
-
# wrapped.
|
9
|
-
def from prc
|
10
|
-
wrap_in_callback_args_mapper(prc)
|
11
|
-
end
|
12
|
-
|
13
|
-
def wrap_in_callback_args_mapper prc
|
14
|
-
return if !prc
|
15
|
-
return prc if FFI::Function === prc
|
16
|
-
return Proc.new do |*args|
|
17
|
-
call_with_argument_mapping(prc, *args)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/lib/gir_ffi/vfunc_base.rb
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
require 'gir_ffi_test_helper'
|
2
|
-
|
3
|
-
describe GirFFI::Builders::SignalBuilder do
|
4
|
-
let(:builder) { GirFFI::Builders::SignalBuilder.new signal_info }
|
5
|
-
|
6
|
-
describe "#mapping_method_definition" do
|
7
|
-
describe "for a signal with no arguments or return value" do
|
8
|
-
let(:signal_info) {
|
9
|
-
get_signal_introspection_data "Regress", "TestObj", "test" }
|
10
|
-
|
11
|
-
it "returns a valid mapping method including receiver and user data" do
|
12
|
-
expected = <<-CODE.reset_indentation
|
13
|
-
def self.call_with_argument_mapping(_proc, _instance, _user_data)
|
14
|
-
_v1 = Regress::TestObj.wrap(_instance)
|
15
|
-
_v2 = GirFFI::ArgHelper::OBJECT_STORE.fetch(_user_data)
|
16
|
-
_proc.call(_v1, _v2)
|
17
|
-
end
|
18
|
-
CODE
|
19
|
-
|
20
|
-
builder.mapping_method_definition.must_equal expected
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "for a signal with an argument and a return value" do
|
25
|
-
let(:signal_info) {
|
26
|
-
get_signal_introspection_data "Regress", "TestObj", "sig-with-int64-prop" }
|
27
|
-
|
28
|
-
it "returns a valid mapping method" do
|
29
|
-
skip unless signal_info
|
30
|
-
|
31
|
-
expected = <<-CODE.reset_indentation
|
32
|
-
def self.call_with_argument_mapping(_proc, _instance, i, _user_data)
|
33
|
-
_v1 = Regress::TestObj.wrap(_instance)
|
34
|
-
_v2 = i
|
35
|
-
_v3 = GirFFI::ArgHelper::OBJECT_STORE.fetch(_user_data)
|
36
|
-
_v4 = _proc.call(_v1, _v2, _v3)
|
37
|
-
return _v4
|
38
|
-
end
|
39
|
-
CODE
|
40
|
-
|
41
|
-
builder.mapping_method_definition.must_equal expected
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe "for a signal with an enum argument" do
|
46
|
-
let(:signal_info) {
|
47
|
-
get_signal_introspection_data "Gio", "MountOperation", "reply" }
|
48
|
-
|
49
|
-
it "returns a valid mapping method" do
|
50
|
-
expected = <<-CODE.reset_indentation
|
51
|
-
def self.call_with_argument_mapping(_proc, _instance, result, _user_data)
|
52
|
-
_v1 = Gio::MountOperation.wrap(_instance)
|
53
|
-
_v2 = Gio::MountOperationResult.wrap(result)
|
54
|
-
_v3 = GirFFI::ArgHelper::OBJECT_STORE.fetch(_user_data)
|
55
|
-
_proc.call(_v1, _v2, _v3)
|
56
|
-
end
|
57
|
-
CODE
|
58
|
-
|
59
|
-
builder.mapping_method_definition.must_equal expected
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe "for a signal with a array plus length arguments" do
|
64
|
-
let(:signal_info) {
|
65
|
-
get_signal_introspection_data "Regress", "TestObj", "sig-with-array-len-prop" }
|
66
|
-
|
67
|
-
it "returns a valid mapping method" do
|
68
|
-
skip unless signal_info
|
69
|
-
|
70
|
-
expected = <<-CODE.reset_indentation
|
71
|
-
def self.call_with_argument_mapping(_proc, _instance, arr, len, _user_data)
|
72
|
-
_v1 = Regress::TestObj.wrap(_instance)
|
73
|
-
_v2 = len
|
74
|
-
_v3 = GirFFI::ArgHelper::OBJECT_STORE.fetch(_user_data)
|
75
|
-
_v4 = GirFFI::SizedArray.wrap(:guint32, _v2, arr)
|
76
|
-
_proc.call(_v1, _v4, _v3)
|
77
|
-
end
|
78
|
-
CODE
|
79
|
-
|
80
|
-
builder.mapping_method_definition.must_equal expected
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe "for a signal returning an array of integers" do
|
85
|
-
let(:signal_info) {
|
86
|
-
get_signal_introspection_data "Regress", "TestObj", "sig-with-intarray-ret" }
|
87
|
-
|
88
|
-
it "returns a valid mapping method" do
|
89
|
-
skip unless signal_info
|
90
|
-
|
91
|
-
expected = <<-CODE.reset_indentation
|
92
|
-
def self.call_with_argument_mapping(_proc, _instance, i, _user_data)
|
93
|
-
_v1 = Regress::TestObj.wrap(_instance)
|
94
|
-
_v2 = i
|
95
|
-
_v3 = GirFFI::ArgHelper::OBJECT_STORE.fetch(_user_data)
|
96
|
-
_v4 = _proc.call(_v1, _v2, _v3)
|
97
|
-
_v5 = GLib::Array.from(:gint32, _v4)
|
98
|
-
return _v5
|
99
|
-
end
|
100
|
-
CODE
|
101
|
-
|
102
|
-
builder.mapping_method_definition.must_equal expected
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|