gir_ffi 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +5 -0
- data/Gemfile +1 -1
- data/lib/ffi-gobject/closure.rb +20 -0
- data/lib/gir_ffi-base/gobject/lib.rb +0 -7
- data/lib/gir_ffi/builders/user_defined_builder.rb +4 -2
- data/lib/gir_ffi/version.rb +1 -1
- data/test/ffi-glib/ruby_closure_test.rb +1 -1
- data/test/gir_ffi/builders/function_builder_test.rb +8 -8
- data/test/integration/generated_gimarshallingtests_test.rb +2 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87a8f4c01010d8c1d510e080f58ebc0cc601b163
|
4
|
+
data.tar.gz: 25eae9388e40ac27eb7724ca335d21c5a6dd0b80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c045bfc9d552fc6fec83cfe4aa222f123c3df3bd0327b0768f247ff3257d31debf9da3704523d95c6601c3a09afddb6d743d23ef8f4f74af2242d5bd78915e2
|
7
|
+
data.tar.gz: 16e9ebda8c005d7b9363f76d4a8a9c79e5fc26ab07298f27f087c688fd955db771b762bd0c9e6e9ec2b92653573fbdb52d29e395a630aee81814cb09ac0b97a7
|
data/Changelog.md
CHANGED
data/Gemfile
CHANGED
data/lib/ffi-gobject/closure.rb
CHANGED
@@ -7,6 +7,7 @@ module GObject
|
|
7
7
|
# To create Closure objects wrapping Ruby code, use {RubyClosure}.
|
8
8
|
class Closure
|
9
9
|
setup_method :new_simple
|
10
|
+
setup_instance_method :invoke
|
10
11
|
|
11
12
|
# @override
|
12
13
|
#
|
@@ -16,6 +17,25 @@ module GObject
|
|
16
17
|
Lib.g_closure_set_marshal self, callback
|
17
18
|
end
|
18
19
|
|
20
|
+
# @override
|
21
|
+
#
|
22
|
+
# This override of invoke ensures the return value location can be passed
|
23
|
+
# in as the first argument, which is needed to ensure the GValue is
|
24
|
+
# initialized with the proper type.
|
25
|
+
#
|
26
|
+
# @param [GObject::Value] return_value The GValue to store the return
|
27
|
+
# value, or nil if no return value is expected.
|
28
|
+
# @param [Array] param_values the closure parameters, or nil if no
|
29
|
+
# parameters are needed.
|
30
|
+
# @param invocation_hint
|
31
|
+
def invoke(return_value, param_values, invocation_hint = nil)
|
32
|
+
rval = GObject::Value.from(return_value)
|
33
|
+
n_params = param_values.nil? ? 0 : param_values.length
|
34
|
+
params = GirFFI::SizedArray.from(GObject::Value, -1, param_values)
|
35
|
+
GObject::Lib.g_closure_invoke self, rval, n_params, params, invocation_hint
|
36
|
+
rval.get_value
|
37
|
+
end
|
38
|
+
|
19
39
|
def store_pointer(ptr)
|
20
40
|
super
|
21
41
|
# NOTE: Call C functions directly to avoid extra argument conversion
|
@@ -1,13 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'ffi/bit_masks'
|
3
3
|
|
4
|
-
# NOTE: Monkey-patch BitMask to work on JRuby.
|
5
|
-
FFI::BitMasks::BitMask.class_eval do
|
6
|
-
def reference_required?
|
7
|
-
false
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
4
|
module GObject
|
12
5
|
# Module for attaching functions from the gobject library
|
13
6
|
module Lib
|
@@ -70,14 +70,16 @@ module GirFFI
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def class_init_proc
|
73
|
-
proc do |
|
73
|
+
proc do |type_class_or_ptr, _data|
|
74
|
+
object_class_ptr = type_class_or_ptr.to_ptr
|
74
75
|
setup_properties object_class_ptr
|
75
76
|
setup_vfuncs object_class_ptr
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|
79
80
|
def interface_init_proc(interface)
|
80
|
-
proc do |
|
81
|
+
proc do |interface_or_ptr, _data|
|
82
|
+
interface_ptr = interface_or_ptr.to_ptr
|
81
83
|
setup_interface_vfuncs interface, interface_ptr
|
82
84
|
end
|
83
85
|
end
|
data/lib/gir_ffi/version.rb
CHANGED
@@ -488,16 +488,16 @@ describe GirFFI::Builders::FunctionBuilder do
|
|
488
488
|
end
|
489
489
|
|
490
490
|
describe 'for functions where some allow-none cannot be honored' do
|
491
|
-
let(:function_info) {
|
491
|
+
let(:function_info) { get_introspection_data 'GIMarshallingTests', 'array_in_utf8_two_in_out_of_order' }
|
492
492
|
it 'builds correct definition with default parameter value on the later arguments' do
|
493
493
|
code.must_equal <<-CODE.reset_indentation
|
494
|
-
def
|
495
|
-
|
496
|
-
|
497
|
-
_v2 =
|
498
|
-
_v3 =
|
499
|
-
_v4 = GirFFI::SizedArray.from(
|
500
|
-
|
494
|
+
def self.array_in_utf8_two_in_out_of_order(a, ints, b = nil)
|
495
|
+
length = ints.nil? ? 0 : ints.length
|
496
|
+
_v1 = length
|
497
|
+
_v2 = GirFFI::InPointer.from_utf8(a)
|
498
|
+
_v3 = GirFFI::InPointer.from_utf8(b)
|
499
|
+
_v4 = GirFFI::SizedArray.from(:gint32, -1, ints)
|
500
|
+
GIMarshallingTests::Lib.gi_marshalling_tests_array_in_utf8_two_in_out_of_order _v1, _v2, _v4, _v3
|
501
501
|
end
|
502
502
|
CODE
|
503
503
|
end
|
@@ -1841,8 +1841,9 @@ describe GIMarshallingTests do
|
|
1841
1841
|
it 'has a working function #gclosure_return' do
|
1842
1842
|
cl = GIMarshallingTests.gclosure_return
|
1843
1843
|
gv = GObject::Value.wrap_ruby_value 0
|
1844
|
-
cl.invoke gv, nil
|
1844
|
+
result = cl.invoke gv, nil
|
1845
1845
|
assert_equal 42, gv.get_value
|
1846
|
+
result.must_equal 42
|
1846
1847
|
end
|
1847
1848
|
|
1848
1849
|
it 'has a working function #genum_in' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gir_ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
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: 2016-
|
11
|
+
date: 2016-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.1.
|
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
|
-
version: 0.1.
|
40
|
+
version: 0.1.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: indentation
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|