ffi 0.3.4 → 0.3.5

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 CHANGED
@@ -31,7 +31,7 @@ PROJ.name = 'ffi'
31
31
  PROJ.authors = 'Wayne Meissner'
32
32
  PROJ.email = 'wmeissner@gmail.com'
33
33
  PROJ.url = 'http://kenai.com/projects/ruby-ffi'
34
- PROJ.version = '0.3.4'
34
+ PROJ.version = '0.3.5'
35
35
  PROJ.rubyforge.name = 'ffi'
36
36
  PROJ.readme_file = 'README.rdoc'
37
37
 
@@ -43,9 +43,11 @@ PROJ.ann.email[:server] = 'smtp.gmail.com'
43
43
 
44
44
  # Gem specifications
45
45
  PROJ.gem.need_tar = false
46
- PROJ.gem.files = %w(LICENSE README.rdoc Rakefile) + Dir.glob("{ext,lib,spec}/**/*")
46
+ PROJ.gem.files = %w(LICENSE README.rdoc Rakefile) + Dir.glob("{ext,gen,lib,spec}/**/*")
47
47
  PROJ.gem.platform = Gem::Platform::RUBY
48
- PROJ.gem.extensions = %w(ext/ffi_c/extconf.rb gen/Rakefile)
48
+
49
+ # Override Mr. Bones autogenerated extensions and force ours in
50
+ PROJ.gem.extras['extensions'] = %w(ext/ffi_c/extconf.rb gen/Rakefile)
49
51
 
50
52
  # RDoc
51
53
  PROJ.rdoc.exclude << '^ext\/'
@@ -32,6 +32,10 @@
32
32
  #endif
33
33
  #define MAX_FIXED_ARITY (3)
34
34
 
35
+ #ifndef roundup
36
+ # define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
37
+ #endif
38
+
35
39
  typedef struct MethodHandle MethodHandle;
36
40
  typedef struct Invoker Invoker;
37
41
 
@@ -49,7 +49,7 @@ memptr_initialize(int argc, VALUE* argv, VALUE self)
49
49
  nargs > 2 && RTEST(clear));
50
50
 
51
51
  if (rb_block_given_p()) {
52
- return rb_rescue(rb_yield, self, memptr_free, self);
52
+ return rb_ensure(rb_yield, self, memptr_free, self);
53
53
  }
54
54
  return self;
55
55
  }
@@ -9,7 +9,7 @@
9
9
  extern "C" {
10
10
  #endif
11
11
 
12
- extern void rb_FFI_MemoryPointer_Init();
12
+ extern void rb_FFI_MemoryPointer_Init(void);
13
13
  extern VALUE rb_FFI_MemoryPointer_class;
14
14
  extern VALUE rb_FFI_MemoryPointer_new(long size, long count, bool clear);
15
15
  #ifdef __cplusplus
@@ -12,7 +12,7 @@ typedef struct Library {
12
12
  void* handle;
13
13
  } Library;
14
14
 
15
- extern void rb_FFI_NativeLibrary_Init();
15
+ extern void rb_FFI_NativeLibrary_Init(void);
16
16
 
17
17
  #ifdef __cplusplus
18
18
  }
@@ -5,7 +5,7 @@
5
5
  extern "C" {
6
6
  #endif
7
7
 
8
- extern void rb_FFI_Platform_Init();
8
+ extern void rb_FFI_Platform_Init(void);
9
9
 
10
10
 
11
11
  #ifdef __cplusplus
@@ -9,7 +9,7 @@ extern "C" {
9
9
 
10
10
 
11
11
  extern void rb_FFI_Pointer_Init(void);
12
- extern void rb_FFI_NullPointer_Init();
12
+ extern void rb_FFI_NullPointer_Init(void);
13
13
  extern VALUE rb_FFI_Pointer_new(void* addr);
14
14
  extern VALUE rb_FFI_Pointer_class;
15
15
  extern VALUE rb_FFI_NullPointer_class;
@@ -7,7 +7,7 @@
7
7
  extern "C" {
8
8
  #endif
9
9
 
10
- void rb_FFI_Struct_Init();
10
+ extern void rb_FFI_Struct_Init(void);
11
11
 
12
12
  struct StructLayout;
13
13
  typedef struct Struct {
@@ -92,7 +92,7 @@ Init_ffi_c() {
92
92
  rb_FFI_MemoryPointer_Init();
93
93
  rb_FFI_Buffer_Init();
94
94
  rb_FFI_Callback_Init();
95
- rb_FFI_Struct_Init(0);
95
+ rb_FFI_Struct_Init();
96
96
  rb_FFI_NativeLibrary_Init();
97
97
  rb_FFI_Invoker_Init();
98
98
  }
@@ -9,11 +9,11 @@ extern "C" {
9
9
 
10
10
  #define MAX_PARAMETERS (32)
11
11
 
12
- extern void rb_FFI_AbstractMemory_Init();
13
- extern void rb_FFI_MemoryPointer_Init();
14
- extern void rb_FFI_Buffer_Init();
15
- extern void rb_FFI_Callback_Init();
16
- extern void rb_FFI_Invoker_Init();
12
+ extern void rb_FFI_AbstractMemory_Init(void);
13
+ extern void rb_FFI_MemoryPointer_Init(void);
14
+ extern void rb_FFI_Buffer_Init(void);
15
+ extern void rb_FFI_Callback_Init(void);
16
+ extern void rb_FFI_Invoker_Init(void);
17
17
  extern VALUE rb_FFI_AbstractMemory_class;
18
18
  extern int rb_FFI_type_size(VALUE type);
19
19
 
@@ -0,0 +1,12 @@
1
+ require 'fileutils'
2
+ require "#{File.join(ENV['RUBYLIBDIR'], 'ffi', 'tools', 'types_generator.rb')}"
3
+ types_conf = File.join(ENV['RUBYLIBDIR'], 'ffi', 'types.conf')
4
+ file types_conf do |task|
5
+ options = {}
6
+ FileUtils.mkdir_p(File.dirname(task.name), { :mode => 0755 })
7
+ File.open(task.name, File::CREAT|File::TRUNC|File::RDWR, 0644) do |f|
8
+ f.puts FFI::TypesGenerator.generate(options)
9
+ end
10
+ end
11
+ task :default => types_conf do
12
+ end
@@ -393,7 +393,6 @@ describe FFI::Struct, ' with an array field' do
393
393
  before do
394
394
  @s = LibTest::StructWithArray.new
395
395
  end
396
- it 'should align correctly array field'
397
396
  it 'should correctly calculate StructWithArray size (in bytes)' do
398
397
  LibTest::StructWithArray.size.should == 24
399
398
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayne Meissner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-01 00:00:00 +10:00
12
+ date: 2009-05-08 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -28,6 +28,7 @@ executables: []
28
28
 
29
29
  extensions:
30
30
  - ext/ffi_c/extconf.rb
31
+ - gen/Rakefile
31
32
  extra_rdoc_files:
32
33
  - README.rdoc
33
34
  - lib/ffi
@@ -321,6 +322,7 @@ files:
321
322
  - ext/ffi_c/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc
322
323
  - ext/ffi_c/libffi/texinfo.tex
323
324
  - ext/ffi_c/rbffi.h
325
+ - gen/Rakefile
324
326
  - lib/ffi
325
327
  - lib/ffi.rb
326
328
  - lib/ffi/autopointer.rb