ffi 1.0.9 → 1.0.10
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 +4 -4
- data/ext/ffi_c/AbstractMemory.c +367 -14
- data/ext/ffi_c/AbstractMemory.h +4 -0
- data/ext/ffi_c/ArrayType.c +28 -0
- data/ext/ffi_c/Buffer.c +101 -25
- data/ext/ffi_c/Call.c +8 -5
- data/ext/ffi_c/ClosurePool.c +9 -8
- data/ext/ffi_c/DataConverter.c +29 -0
- data/ext/ffi_c/DynamicLibrary.c +64 -1
- data/ext/ffi_c/Function.c +111 -10
- data/ext/ffi_c/FunctionInfo.c +13 -1
- data/ext/ffi_c/LastError.c +16 -0
- data/ext/ffi_c/MappedType.c +22 -0
- data/ext/ffi_c/MemoryPointer.c +11 -1
- data/ext/ffi_c/MethodHandle.c +18 -11
- data/ext/ffi_c/Platform.c +9 -3
- data/ext/ffi_c/Pointer.c +98 -0
- data/ext/ffi_c/Struct.c +4 -4
- data/ext/ffi_c/Struct.h +2 -1
- data/ext/ffi_c/StructLayout.c +2 -2
- data/ext/ffi_c/Thread.c +124 -1
- data/ext/ffi_c/Type.c +108 -17
- data/ext/ffi_c/Types.c +9 -2
- data/ext/ffi_c/Variadic.c +5 -4
- data/ext/ffi_c/compat.h +8 -0
- data/ext/ffi_c/endian.h +7 -1
- data/ext/ffi_c/extconf.rb +46 -35
- data/ext/ffi_c/ffi.c +5 -0
- data/ext/ffi_c/libffi.darwin.mk +15 -15
- data/ext/ffi_c/libffi.gnu.mk +3 -3
- data/ext/ffi_c/libffi.mk +4 -4
- data/lib/ffi.rb +13 -9
- data/lib/ffi/autopointer.rb +88 -26
- data/lib/ffi/enum.rb +42 -0
- data/lib/ffi/errno.rb +6 -1
- data/lib/ffi/ffi.rb +1 -0
- data/lib/ffi/io.rb +13 -2
- data/lib/ffi/library.rb +212 -19
- data/lib/ffi/memorypointer.rb +1 -33
- data/lib/ffi/platform.rb +23 -7
- data/lib/ffi/platform/i386-freebsd/types.conf +152 -0
- data/lib/ffi/platform/i386-netbsd/types.conf +126 -0
- data/lib/ffi/platform/x86_64-freebsd/types.conf +126 -0
- data/lib/ffi/platform/x86_64-netbsd/types.conf +126 -0
- data/lib/ffi/pointer.rb +44 -0
- data/lib/ffi/struct.rb +1 -1
- data/lib/ffi/struct_layout_builder.rb +2 -1
- data/lib/ffi/tools/const_generator.rb +72 -17
- data/lib/ffi/types.rb +21 -1
- data/spec/ffi/rbx/memory_pointer_spec.rb +4 -2
- data/spec/ffi/struct_spec.rb +10 -0
- data/spec/ffi/typedef_spec.rb +11 -0
- data/tasks/extension.rake +0 -1
- data/tasks/gem.rake +0 -1
- data/tasks/yard.rake +11 -0
- metadata +15 -8
@@ -12,12 +12,14 @@ end
|
|
12
12
|
describe "MemoryPointer" do
|
13
13
|
it "makes a pointer from a string" do
|
14
14
|
m = FFI::MemoryPointer.from_string("FFI is Awesome")
|
15
|
-
m.
|
15
|
+
m.total.should == 15
|
16
|
+
m.type_size.should == 1
|
16
17
|
end
|
17
18
|
|
18
19
|
it "makes a pointer from a string with multibyte characters" do
|
19
20
|
m = FFI::MemoryPointer.from_string("ぱんだ")
|
20
|
-
m.
|
21
|
+
m.total.should == 10
|
22
|
+
m.type_size.should == 1
|
21
23
|
end
|
22
24
|
|
23
25
|
it "reads back a string" do
|
data/spec/ffi/struct_spec.rb
CHANGED
@@ -669,4 +669,14 @@ describe "Struct allocation" do
|
|
669
669
|
end
|
670
670
|
S.new(FFI::MemoryPointer.new(S)).null?.should be_false
|
671
671
|
end
|
672
|
+
|
673
|
+
it "supports :bool as a struct member" do
|
674
|
+
lambda do
|
675
|
+
c = Class.new(FFI::Struct) do
|
676
|
+
layout :b, :bool
|
677
|
+
end
|
678
|
+
c.new
|
679
|
+
end.should_not raise_error
|
680
|
+
end
|
681
|
+
|
672
682
|
end
|
data/spec/ffi/typedef_spec.rb
CHANGED
@@ -75,4 +75,15 @@ describe "Custom type definitions" do
|
|
75
75
|
end
|
76
76
|
end.should_not raise_error
|
77
77
|
end
|
78
|
+
|
79
|
+
it "detects the correct type for size_t" do
|
80
|
+
lambda do
|
81
|
+
Module.new do
|
82
|
+
extend FFI::Library
|
83
|
+
ffi_lib "c"
|
84
|
+
# read(2) is a standard UNIX function
|
85
|
+
attach_function :read, [:int, :pointer, :size_t], :ssize_t
|
86
|
+
end
|
87
|
+
end.should_not raise_error
|
88
|
+
end
|
78
89
|
end
|
data/tasks/extension.rake
CHANGED
data/tasks/gem.rake
CHANGED
data/tasks/yard.rake
ADDED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 3
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 10
|
10
|
+
version: 1.0.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Wayne Meissner
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-10-20 00:00:00 Z
|
20
19
|
dependencies: []
|
21
20
|
|
22
21
|
description: |-
|
@@ -34,7 +33,9 @@ extra_rdoc_files:
|
|
34
33
|
- History.txt
|
35
34
|
- README.rdoc
|
36
35
|
- lib/ffi/platform/i386-darwin/types.conf
|
36
|
+
- lib/ffi/platform/i386-freebsd/types.conf
|
37
37
|
- lib/ffi/platform/i386-linux/types.conf
|
38
|
+
- lib/ffi/platform/i386-netbsd/types.conf
|
38
39
|
- lib/ffi/platform/i386-openbsd/types.conf
|
39
40
|
- lib/ffi/platform/i386-solaris/types.conf
|
40
41
|
- lib/ffi/platform/i386-windows/types.conf
|
@@ -43,7 +44,9 @@ extra_rdoc_files:
|
|
43
44
|
- lib/ffi/platform/sparc-solaris/types.conf
|
44
45
|
- lib/ffi/platform/sparcv9-solaris/types.conf
|
45
46
|
- lib/ffi/platform/x86_64-darwin/types.conf
|
47
|
+
- lib/ffi/platform/x86_64-freebsd/types.conf
|
46
48
|
- lib/ffi/platform/x86_64-linux/types.conf
|
49
|
+
- lib/ffi/platform/x86_64-netbsd/types.conf
|
47
50
|
- lib/ffi/platform/x86_64-openbsd/types.conf
|
48
51
|
- lib/ffi/platform/x86_64-solaris/types.conf
|
49
52
|
files:
|
@@ -366,7 +369,9 @@ files:
|
|
366
369
|
- lib/ffi/memorypointer.rb
|
367
370
|
- lib/ffi/platform.rb
|
368
371
|
- lib/ffi/platform/i386-darwin/types.conf
|
372
|
+
- lib/ffi/platform/i386-freebsd/types.conf
|
369
373
|
- lib/ffi/platform/i386-linux/types.conf
|
374
|
+
- lib/ffi/platform/i386-netbsd/types.conf
|
370
375
|
- lib/ffi/platform/i386-openbsd/types.conf
|
371
376
|
- lib/ffi/platform/i386-solaris/types.conf
|
372
377
|
- lib/ffi/platform/i386-windows/types.conf
|
@@ -375,7 +380,9 @@ files:
|
|
375
380
|
- lib/ffi/platform/sparc-solaris/types.conf
|
376
381
|
- lib/ffi/platform/sparcv9-solaris/types.conf
|
377
382
|
- lib/ffi/platform/x86_64-darwin/types.conf
|
383
|
+
- lib/ffi/platform/x86_64-freebsd/types.conf
|
378
384
|
- lib/ffi/platform/x86_64-linux/types.conf
|
385
|
+
- lib/ffi/platform/x86_64-netbsd/types.conf
|
379
386
|
- lib/ffi/platform/x86_64-openbsd/types.conf
|
380
387
|
- lib/ffi/platform/x86_64-solaris/types.conf
|
381
388
|
- lib/ffi/pointer.rb
|
@@ -431,7 +438,7 @@ files:
|
|
431
438
|
- tasks/spec.rake
|
432
439
|
- tasks/svn.rake
|
433
440
|
- tasks/test.rake
|
434
|
-
|
441
|
+
- tasks/yard.rake
|
435
442
|
homepage: http://wiki.github.com/ffi/ffi
|
436
443
|
licenses: []
|
437
444
|
|
@@ -465,7 +472,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
465
472
|
requirements: []
|
466
473
|
|
467
474
|
rubyforge_project: ffi
|
468
|
-
rubygems_version: 1.
|
475
|
+
rubygems_version: 1.8.6
|
469
476
|
signing_key:
|
470
477
|
specification_version: 3
|
471
478
|
summary: Ruby-FFI is a ruby extension for programmatically loading dynamic libraries, binding functions within them, and calling those functions from Ruby code
|