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.

Files changed (56) hide show
  1. data/Rakefile +4 -4
  2. data/ext/ffi_c/AbstractMemory.c +367 -14
  3. data/ext/ffi_c/AbstractMemory.h +4 -0
  4. data/ext/ffi_c/ArrayType.c +28 -0
  5. data/ext/ffi_c/Buffer.c +101 -25
  6. data/ext/ffi_c/Call.c +8 -5
  7. data/ext/ffi_c/ClosurePool.c +9 -8
  8. data/ext/ffi_c/DataConverter.c +29 -0
  9. data/ext/ffi_c/DynamicLibrary.c +64 -1
  10. data/ext/ffi_c/Function.c +111 -10
  11. data/ext/ffi_c/FunctionInfo.c +13 -1
  12. data/ext/ffi_c/LastError.c +16 -0
  13. data/ext/ffi_c/MappedType.c +22 -0
  14. data/ext/ffi_c/MemoryPointer.c +11 -1
  15. data/ext/ffi_c/MethodHandle.c +18 -11
  16. data/ext/ffi_c/Platform.c +9 -3
  17. data/ext/ffi_c/Pointer.c +98 -0
  18. data/ext/ffi_c/Struct.c +4 -4
  19. data/ext/ffi_c/Struct.h +2 -1
  20. data/ext/ffi_c/StructLayout.c +2 -2
  21. data/ext/ffi_c/Thread.c +124 -1
  22. data/ext/ffi_c/Type.c +108 -17
  23. data/ext/ffi_c/Types.c +9 -2
  24. data/ext/ffi_c/Variadic.c +5 -4
  25. data/ext/ffi_c/compat.h +8 -0
  26. data/ext/ffi_c/endian.h +7 -1
  27. data/ext/ffi_c/extconf.rb +46 -35
  28. data/ext/ffi_c/ffi.c +5 -0
  29. data/ext/ffi_c/libffi.darwin.mk +15 -15
  30. data/ext/ffi_c/libffi.gnu.mk +3 -3
  31. data/ext/ffi_c/libffi.mk +4 -4
  32. data/lib/ffi.rb +13 -9
  33. data/lib/ffi/autopointer.rb +88 -26
  34. data/lib/ffi/enum.rb +42 -0
  35. data/lib/ffi/errno.rb +6 -1
  36. data/lib/ffi/ffi.rb +1 -0
  37. data/lib/ffi/io.rb +13 -2
  38. data/lib/ffi/library.rb +212 -19
  39. data/lib/ffi/memorypointer.rb +1 -33
  40. data/lib/ffi/platform.rb +23 -7
  41. data/lib/ffi/platform/i386-freebsd/types.conf +152 -0
  42. data/lib/ffi/platform/i386-netbsd/types.conf +126 -0
  43. data/lib/ffi/platform/x86_64-freebsd/types.conf +126 -0
  44. data/lib/ffi/platform/x86_64-netbsd/types.conf +126 -0
  45. data/lib/ffi/pointer.rb +44 -0
  46. data/lib/ffi/struct.rb +1 -1
  47. data/lib/ffi/struct_layout_builder.rb +2 -1
  48. data/lib/ffi/tools/const_generator.rb +72 -17
  49. data/lib/ffi/types.rb +21 -1
  50. data/spec/ffi/rbx/memory_pointer_spec.rb +4 -2
  51. data/spec/ffi/struct_spec.rb +10 -0
  52. data/spec/ffi/typedef_spec.rb +11 -0
  53. data/tasks/extension.rake +0 -1
  54. data/tasks/gem.rake +0 -1
  55. data/tasks/yard.rake +11 -0
  56. 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.type_size.should == 15
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.type_size.should == 10
21
+ m.total.should == 10
22
+ m.type_size.should == 1
21
23
  end
22
24
 
23
25
  it "reads back a string" do
@@ -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
@@ -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
@@ -2,7 +2,6 @@ spec = Gem::Specification.new do |s|
2
2
  s.name = PROJ.name
3
3
  s.version = PROJ.version
4
4
  s.platform = Gem::Platform::RUBY
5
- s.has_rdoc = true
6
5
  s.extra_rdoc_files = ["README.rdoc", "LICENSE"]
7
6
  s.summary = PROJ.summary
8
7
  s.description = PROJ.description
@@ -130,7 +130,6 @@ namespace :gem do
130
130
  end
131
131
  s.rdoc_options = PROJ.rdoc.opts + ['--main', PROJ.rdoc.main]
132
132
  s.extra_rdoc_files = rdoc_files
133
- s.has_rdoc = true
134
133
 
135
134
  if test ?f, PROJ.test.file
136
135
  s.test_file = PROJ.test.file
@@ -0,0 +1,11 @@
1
+ begin
2
+ require 'yard'
3
+
4
+ namespace :doc do
5
+ YARD::Rake::YardocTask.new do |yard|
6
+ end
7
+ end
8
+ rescue LoadError
9
+ warn "[warn] YARD unavailable"
10
+ end
11
+
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
5
- prerelease: false
4
+ hash: 3
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 9
10
- version: 1.0.9
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-05-22 00:00:00 +10:00
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
- has_rdoc: true
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.3.7
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