ffi 1.0.4-x86-mingw32 → 1.0.5-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ffi might be problematic. Click here for more details.
- data/Rakefile +2 -2
- data/ext/ffi_c/AbstractMemory.c +1 -1
- data/ext/ffi_c/ArrayType.c +11 -19
- data/ext/ffi_c/ArrayType.h +11 -19
- data/ext/ffi_c/Buffer.c +2 -0
- data/ext/ffi_c/Call.h +12 -19
- data/ext/ffi_c/ClosurePool.h +19 -0
- data/ext/ffi_c/DynamicLibrary.h +18 -0
- data/ext/ffi_c/Function.c +12 -13
- data/ext/ffi_c/Function.h +12 -19
- data/ext/ffi_c/LastError.c +12 -19
- data/ext/ffi_c/LastError.h +20 -0
- data/ext/ffi_c/MappedType.c +12 -19
- data/ext/ffi_c/MappedType.h +12 -19
- data/ext/ffi_c/MemoryPointer.c +1 -0
- data/ext/ffi_c/MemoryPointer.h +23 -3
- data/ext/ffi_c/MethodHandle.h +15 -22
- data/ext/ffi_c/Platform.c +36 -9
- data/ext/ffi_c/Platform.h +23 -3
- data/ext/ffi_c/Pointer.c +2 -0
- data/ext/ffi_c/Pointer.h +11 -19
- data/ext/ffi_c/Struct.c +12 -19
- data/ext/ffi_c/Struct.h +11 -19
- data/ext/ffi_c/StructByValue.c +13 -19
- data/ext/ffi_c/StructByValue.h +12 -19
- data/ext/ffi_c/StructLayout.c +12 -19
- data/ext/ffi_c/Thread.c +36 -10
- data/ext/ffi_c/Thread.h +14 -5
- data/ext/ffi_c/Type.c +1 -0
- data/ext/ffi_c/Types.c +12 -19
- data/ext/ffi_c/Types.h +11 -19
- data/ext/ffi_c/Variadic.c +1 -1
- data/ext/ffi_c/compat.h +13 -19
- data/ext/ffi_c/endian.h +1 -0
- data/ext/ffi_c/extconf.rb +3 -1
- data/ext/ffi_c/ffi.c +12 -19
- data/ext/ffi_c/rbffi.h +23 -3
- data/lib/1.8/ffi_c.so +0 -0
- data/lib/1.9/ffi_c.so +0 -0
- data/lib/ffi/tools/const_generator.rb +1 -1
- data/spec/ffi/async_callback_spec.rb +35 -12
- data/spec/ffi/bool_spec.rb +16 -0
- data/spec/ffi/buffer_spec.rb +34 -21
- data/spec/ffi/callback_spec.rb +16 -0
- data/spec/ffi/custom_param_type.rb +16 -0
- data/spec/ffi/custom_type_spec.rb +16 -0
- data/spec/ffi/enum_spec.rb +16 -0
- data/spec/ffi/errno_spec.rb +16 -0
- data/spec/ffi/ffi_spec.rb +16 -0
- data/spec/ffi/library_spec.rb +16 -0
- data/spec/ffi/managed_struct_spec.rb +16 -0
- data/spec/ffi/number_spec.rb +16 -0
- data/spec/ffi/strptr_spec.rb +16 -0
- data/spec/ffi/struct_callback_spec.rb +16 -0
- data/spec/ffi/struct_initialize_spec.rb +1 -0
- data/spec/ffi/struct_packed_spec.rb +16 -0
- data/spec/ffi/struct_spec.rb +16 -0
- data/spec/ffi/typedef_spec.rb +16 -0
- data/spec/ffi/union_spec.rb +16 -0
- data/spec/ffi/variadic_spec.rb +16 -0
- data/tasks/extension.rake +1 -1
- metadata +11 -24
- data/lib/ffi_c.so +0 -0
data/spec/ffi/buffer_spec.rb
CHANGED
@@ -1,22 +1,35 @@
|
|
1
|
-
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
2
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
3
|
-
include FFI
|
4
|
-
LongSize = FFI::Platform::LONG_SIZE / 8
|
5
18
|
|
6
19
|
describe "Buffer#total" do
|
7
20
|
[1,2,3].each do |i|
|
8
21
|
{ :char => 1, :uchar => 1, :short => 2, :ushort => 2, :int => 4,
|
9
|
-
:uint => 4, :long =>
|
22
|
+
:uint => 4, :long => FFI::Type::LONG.size, :ulong => FFI::Type::ULONG.size,
|
10
23
|
:long_long => 8, :ulong_long => 8, :float => 4, :double => 8
|
11
24
|
}.each_pair do |t, s|
|
12
25
|
it "Buffer.alloc_in(#{t}, #{i}).total == #{i * s}" do
|
13
|
-
Buffer.alloc_in(t, i).total.should == i * s
|
26
|
+
FFI::Buffer.alloc_in(t, i).total.should == i * s
|
14
27
|
end
|
15
28
|
it "Buffer.alloc_out(#{t}, #{i}).total == #{i * s}" do
|
16
|
-
Buffer.alloc_out(t, i).total.should == i * s
|
29
|
+
FFI::Buffer.alloc_out(t, i).total.should == i * s
|
17
30
|
end
|
18
31
|
it "Buffer.alloc_inout(#{t}, #{i}).total == #{i * s}" do
|
19
|
-
Buffer.alloc_inout(t, i).total.should == i * s
|
32
|
+
FFI::Buffer.alloc_inout(t, i).total.should == i * s
|
20
33
|
end
|
21
34
|
end
|
22
35
|
end
|
@@ -27,7 +40,7 @@ describe "Buffer#put_char" do
|
|
27
40
|
(0..127).each do |i|
|
28
41
|
(0..bufsize-1).each do |offset|
|
29
42
|
it "put_char(#{offset}, #{i}).get_char(#{offset}) == #{i}" do
|
30
|
-
Buffer.alloc_in(bufsize).put_char(offset, i).get_char(offset).should == i
|
43
|
+
FFI::Buffer.alloc_in(bufsize).put_char(offset, i).get_char(offset).should == i
|
31
44
|
end
|
32
45
|
end
|
33
46
|
end
|
@@ -37,7 +50,7 @@ describe "Buffer#put_uchar" do
|
|
37
50
|
(0..255).each do |i|
|
38
51
|
(0..bufsize-1).each do |offset|
|
39
52
|
it "Buffer.put_uchar(#{offset}, #{i}).get_uchar(#{offset}) == #{i}" do
|
40
|
-
Buffer.alloc_in(bufsize).put_uchar(offset, i).get_uchar(offset).should == i
|
53
|
+
FFI::Buffer.alloc_in(bufsize).put_uchar(offset, i).get_uchar(offset).should == i
|
41
54
|
end
|
42
55
|
end
|
43
56
|
end
|
@@ -47,7 +60,7 @@ describe "Buffer#put_short" do
|
|
47
60
|
[0, 1, 128, 32767].each do |i|
|
48
61
|
(0..bufsize-2).each do |offset|
|
49
62
|
it "put_short(#{offset}, #{i}).get_short(#{offset}) == #{i}" do
|
50
|
-
Buffer.alloc_in(bufsize).put_short(offset, i).get_short(offset).should == i
|
63
|
+
FFI::Buffer.alloc_in(bufsize).put_short(offset, i).get_short(offset).should == i
|
51
64
|
end
|
52
65
|
end
|
53
66
|
end
|
@@ -57,7 +70,7 @@ describe "Buffer#put_ushort" do
|
|
57
70
|
[ 0, 1, 128, 32767, 65535, 0xfee1, 0xdead, 0xbeef, 0xcafe ].each do |i|
|
58
71
|
(0..bufsize-2).each do |offset|
|
59
72
|
it "put_ushort(#{offset}, #{i}).get_ushort(#{offset}) == #{i}" do
|
60
|
-
Buffer.alloc_in(bufsize).put_ushort(offset, i).get_ushort(offset).should == i
|
73
|
+
FFI::Buffer.alloc_in(bufsize).put_ushort(offset, i).get_ushort(offset).should == i
|
61
74
|
end
|
62
75
|
end
|
63
76
|
end
|
@@ -67,7 +80,7 @@ describe "Buffer#put_int" do
|
|
67
80
|
[0, 1, 128, 32767, 0x7ffffff ].each do |i|
|
68
81
|
(0..bufsize-4).each do |offset|
|
69
82
|
it "put_int(#{offset}, #{i}).get_int(#{offset}) == #{i}" do
|
70
|
-
Buffer.alloc_in(bufsize).put_int(offset, i).get_int(offset).should == i
|
83
|
+
FFI::Buffer.alloc_in(bufsize).put_int(offset, i).get_int(offset).should == i
|
71
84
|
end
|
72
85
|
end
|
73
86
|
end
|
@@ -77,7 +90,7 @@ describe "Buffer#put_uint" do
|
|
77
90
|
[ 0, 1, 128, 32767, 65535, 0xfee1dead, 0xcafebabe, 0xffffffff ].each do |i|
|
78
91
|
(0..bufsize-4).each do |offset|
|
79
92
|
it "put_uint(#{offset}, #{i}).get_uint(#{offset}) == #{i}" do
|
80
|
-
Buffer.alloc_in(bufsize).put_uint(offset, i).get_uint(offset).should == i
|
93
|
+
FFI::Buffer.alloc_in(bufsize).put_uint(offset, i).get_uint(offset).should == i
|
81
94
|
end
|
82
95
|
end
|
83
96
|
end
|
@@ -85,9 +98,9 @@ end
|
|
85
98
|
describe "Buffer#put_long" do
|
86
99
|
bufsize = 16
|
87
100
|
[0, 1, 128, 32767, 0x7ffffff ].each do |i|
|
88
|
-
(0..bufsize-
|
101
|
+
(0..bufsize-FFI::Type::LONG.size).each do |offset|
|
89
102
|
it "put_long(#{offset}, #{i}).get_long(#{offset}) == #{i}" do
|
90
|
-
Buffer.alloc_in(bufsize).put_long(offset, i).get_long(offset).should == i
|
103
|
+
FFI::Buffer.alloc_in(bufsize).put_long(offset, i).get_long(offset).should == i
|
91
104
|
end
|
92
105
|
end
|
93
106
|
end
|
@@ -95,9 +108,9 @@ end
|
|
95
108
|
describe "Buffer#put_ulong" do
|
96
109
|
bufsize = 16
|
97
110
|
[ 0, 1, 128, 32767, 65535, 0xfee1dead, 0xcafebabe, 0xffffffff ].each do |i|
|
98
|
-
(0..bufsize-
|
111
|
+
(0..bufsize-FFI::Type::LONG.size).each do |offset|
|
99
112
|
it "put_ulong(#{offset}, #{i}).get_ulong(#{offset}) == #{i}" do
|
100
|
-
Buffer.alloc_in(bufsize).put_ulong(offset, i).get_ulong(offset).should == i
|
113
|
+
FFI::Buffer.alloc_in(bufsize).put_ulong(offset, i).get_ulong(offset).should == i
|
101
114
|
end
|
102
115
|
end
|
103
116
|
end
|
@@ -107,7 +120,7 @@ describe "Buffer#put_long_long" do
|
|
107
120
|
[0, 1, 128, 32767, 0x7ffffffffffffff ].each do |i|
|
108
121
|
(0..bufsize-8).each do |offset|
|
109
122
|
it "put_long_long(#{offset}, #{i}).get_long_long(#{offset}) == #{i}" do
|
110
|
-
Buffer.alloc_in(bufsize).put_long_long(offset, i).get_long_long(offset).should == i
|
123
|
+
FFI::Buffer.alloc_in(bufsize).put_long_long(offset, i).get_long_long(offset).should == i
|
111
124
|
end
|
112
125
|
end
|
113
126
|
end
|
@@ -117,7 +130,7 @@ describe "Buffer#put_ulong_long" do
|
|
117
130
|
[ 0, 1, 128, 32767, 65535, 0xdeadcafebabe, 0x7fffffffffffffff ].each do |i|
|
118
131
|
(0..bufsize-8).each do |offset|
|
119
132
|
it "put_ulong_long(#{offset}, #{i}).get_ulong_long(#{offset}) == #{i}" do
|
120
|
-
Buffer.alloc_in(bufsize).put_ulong_long(offset, i).get_ulong_long(offset).should == i
|
133
|
+
FFI::Buffer.alloc_in(bufsize).put_ulong_long(offset, i).get_ulong_long(offset).should == i
|
121
134
|
end
|
122
135
|
end
|
123
136
|
end
|
@@ -185,9 +198,9 @@ describe "Reading/Writing ascii strings" do
|
|
185
198
|
end
|
186
199
|
describe "Buffer#put_pointer" do
|
187
200
|
it "put_pointer(0, p).get_pointer(0) == p" do
|
188
|
-
p = MemoryPointer.new :ulong_long
|
201
|
+
p = FFI::MemoryPointer.new :ulong_long
|
189
202
|
p.put_uint(0, 0xdeadbeef)
|
190
|
-
buf = Buffer.alloc_inout 8
|
203
|
+
buf = FFI::Buffer.alloc_inout 8
|
191
204
|
p2 = buf.put_pointer(0, p).get_pointer(0)
|
192
205
|
p2.should_not be_nil
|
193
206
|
p2.should == p
|
data/spec/ffi/callback_spec.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
|
3
19
|
describe "Callback" do
|
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
|
3
19
|
describe "functions with custom parameter types" do
|
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
|
3
19
|
describe "functions with custom types" do
|
data/spec/ffi/enum_spec.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
|
3
19
|
module TestEnum0
|
data/spec/ffi/errno_spec.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
describe "FFI.errno" do
|
3
19
|
module LibTest
|
data/spec/ffi/ffi_spec.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
|
3
19
|
describe "FFI" do
|
data/spec/ffi/library_spec.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
describe "Library" do
|
3
19
|
|
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
require 'java' if RUBY_PLATFORM =~ /java/
|
3
19
|
|
data/spec/ffi/number_spec.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
describe "Function with primitive integer arguments" do
|
3
19
|
module LibTest
|
data/spec/ffi/strptr_spec.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
|
3
19
|
describe "functions returning :strptr" do
|
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
|
3
19
|
describe FFI::Struct, ' with inline callback functions' do
|
@@ -13,6 +13,7 @@
|
|
13
13
|
# You should have received a copy of the GNU Lesser General Public License
|
14
14
|
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
15
|
#
|
16
|
+
|
16
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
17
18
|
|
18
19
|
describe FFI::Struct, ' with an initialize function' do
|
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
|
3
19
|
describe FFI::Struct do
|
data/spec/ffi/struct_spec.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
describe "Struct tests" do
|
3
19
|
StructTypes = {
|
data/spec/ffi/typedef_spec.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
describe "Custom type definitions" do
|
3
19
|
it "attach_function with custom typedef" do
|
data/spec/ffi/union_spec.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of ruby-ffi.
|
3
|
+
#
|
4
|
+
# This code is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
11
|
+
# version 3 for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
|
1
17
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
2
18
|
|
3
19
|
module LibTest
|