ffi 1.12.2-x86-mingw32 → 1.14.2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +82 -0
  3. data/Gemfile +4 -2
  4. data/README.md +10 -2
  5. data/Rakefile +31 -43
  6. data/ffi.gemspec +2 -2
  7. data/lib/2.3/ffi_c.so +0 -0
  8. data/lib/2.4/ffi_c.so +0 -0
  9. data/lib/2.5/ffi_c.so +0 -0
  10. data/lib/2.6/ffi_c.so +0 -0
  11. data/lib/2.7/ffi_c.so +0 -0
  12. data/lib/3.0/ffi_c.so +0 -0
  13. data/lib/ffi.rb +10 -2
  14. data/lib/ffi/abstract_memory.rb +44 -0
  15. data/lib/ffi/autopointer.rb +1 -1
  16. data/lib/ffi/ffi.rb +1 -0
  17. data/lib/ffi/io.rb +3 -3
  18. data/lib/ffi/library.rb +6 -2
  19. data/lib/ffi/managedstruct.rb +2 -2
  20. data/lib/ffi/platform.rb +21 -8
  21. data/lib/ffi/platform/aarch64-darwin/types.conf +130 -0
  22. data/lib/ffi/platform/aarch64-openbsd/types.conf +134 -0
  23. data/lib/ffi/platform/arm-linux/types.conf +32 -4
  24. data/lib/ffi/platform/i386-windows/types.conf +26 -79
  25. data/lib/ffi/platform/powerpc-linux/types.conf +32 -2
  26. data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
  27. data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
  28. data/lib/ffi/platform/x86_64-darwin/types.conf +4 -0
  29. data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +4 -22
  30. data/lib/ffi/platform/x86_64-haiku/types.conf +117 -0
  31. data/lib/ffi/platform/x86_64-linux/types.conf +21 -0
  32. data/lib/ffi/platform/x86_64-msys/types.conf +119 -0
  33. data/lib/ffi/platform/x86_64-windows/types.conf +10 -78
  34. data/lib/ffi/pointer.rb +21 -14
  35. data/lib/ffi/struct.rb +8 -2
  36. data/lib/ffi/tools/types_generator.rb +2 -0
  37. data/lib/ffi/variadic.rb +1 -1
  38. data/lib/ffi/version.rb +1 -1
  39. data/samples/getlogin.rb +1 -1
  40. data/samples/getpid.rb +1 -1
  41. data/samples/gettimeofday.rb +8 -8
  42. data/samples/hello.rb +2 -1
  43. data/samples/inotify.rb +1 -1
  44. data/samples/pty.rb +1 -2
  45. data/samples/qsort.rb +0 -1
  46. metadata +13 -12
  47. data/.appveyor.yml +0 -27
  48. data/.gitignore +0 -25
  49. data/.gitmodules +0 -4
  50. data/.travis.yml +0 -44
  51. data/.yardopts +0 -5
  52. data/samples/sample_helper.rb +0 -6
@@ -228,7 +228,11 @@ module FFI
228
228
 
229
229
  def callback(params, ret)
230
230
  mod = enclosing_module
231
- FFI::CallbackInfo.new(find_type(ret, mod), params.map { |e| find_type(e, mod) })
231
+ ret_type = find_type(ret, mod)
232
+ if ret_type == Type::STRING
233
+ raise TypeError, ":string is not allowed as return type of callbacks"
234
+ end
235
+ FFI::CallbackInfo.new(ret_type, params.map { |e| find_type(e, mod) })
232
236
  end
233
237
 
234
238
  def packed(packed = 1)
@@ -244,7 +248,9 @@ module FFI
244
248
  def enclosing_module
245
249
  begin
246
250
  mod = self.name.split("::")[0..-2].inject(Object) { |obj, c| obj.const_get(c) }
247
- (mod < FFI::Library || mod < FFI::Struct || mod.respond_to?(:find_type)) ? mod : nil
251
+ if mod.respond_to?(:find_type) && (mod.is_a?(FFI::Library) || mod < FFI::Struct)
252
+ mod
253
+ end
248
254
  rescue Exception
249
255
  nil
250
256
  end
@@ -47,6 +47,8 @@ module FFI
47
47
  typedefs = nil
48
48
  Tempfile.open 'ffi_types_generator' do |io|
49
49
  io.puts <<-C
50
+ #include <stdint.h>
51
+ #include <stddef.h>
50
52
  #include <sys/types.h>
51
53
  #if !(defined(WIN32))
52
54
  #include <sys/socket.h>
@@ -31,7 +31,7 @@
31
31
  #
32
32
 
33
33
  module FFI
34
- class VariadicInvoker
34
+ class VariadicInvoker
35
35
  def init(arg_types, type_map)
36
36
  @fixed = Array.new
37
37
  @type_map = type_map
@@ -1,3 +1,3 @@
1
1
  module FFI
2
- VERSION = '1.12.2'
2
+ VERSION = '1.14.2'
3
3
  end
@@ -1,5 +1,5 @@
1
- require 'rubygems'
2
1
  require 'ffi'
2
+
3
3
  module Foo
4
4
  extend FFI::Library
5
5
  ffi_lib FFI::Library::LIBC
@@ -1,5 +1,5 @@
1
- require 'rubygems'
2
1
  require 'ffi'
2
+
3
3
  module Foo
4
4
  extend FFI::Library
5
5
  ffi_lib FFI::Library::LIBC
@@ -1,16 +1,16 @@
1
- require 'rubygems'
2
1
  require 'ffi'
2
+ require 'rbconfig'
3
+
3
4
  class Timeval < FFI::Struct
4
- rb_maj, rb_min, rb_micro = RUBY_VERSION.split('.')
5
- if rb_maj.to_i >= 1 && rb_min.to_i >= 9 || RUBY_PLATFORM =~ /java/
6
- layout :tv_sec => :ulong, :tv_usec => :ulong
7
- else
8
- layout :tv_sec, :ulong, 0, :tv_usec, :ulong, 4
9
- end
5
+ layout tv_sec: :ulong, tv_usec: :ulong
10
6
  end
11
7
  module LibC
12
8
  extend FFI::Library
13
- ffi_lib FFI::Library::LIBC
9
+ if FFI::Platform.windows?
10
+ ffi_lib RbConfig::CONFIG["LIBRUBY_SO"]
11
+ else
12
+ ffi_lib FFI::Library::LIBC
13
+ end
14
14
  attach_function :gettimeofday, [ :pointer, :pointer ], :int
15
15
  end
16
16
  t = Timeval.new
@@ -1,4 +1,5 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), "sample_helper"))
1
+ require 'ffi'
2
+
2
3
  module Foo
3
4
  extend FFI::Library
4
5
  ffi_lib FFI::Library::LIBC
@@ -1,5 +1,5 @@
1
- require 'rubygems'
2
1
  require 'ffi'
2
+
3
3
  module Inotify
4
4
  extend FFI::Library
5
5
  ffi_lib FFI::Library::LIBC
@@ -1,6 +1,5 @@
1
1
  require 'ffi'
2
2
 
3
-
4
3
  module PTY
5
4
  private
6
5
  module LibC
@@ -41,7 +40,7 @@ module PTY
41
40
  #
42
41
  exec_cmd, exec_args = build_args(args)
43
42
  pid = LibC.forkpty(mfdp, name, nil, nil)
44
- raise "forkpty failed: #{LibC.strerror(FFI.errno)}" if pid < 0
43
+ raise "forkpty failed: #{LibC.strerror(FFI.errno)}" if pid < 0
45
44
  if pid == 0
46
45
  LibC.execvp(exec_cmd, exec_args)
47
46
  exit 1
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  require 'ffi'
3
2
 
4
3
  module LibC
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.2
4
+ version: 1.14.2
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Wayne Meissner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-01 00:00:00.000000000 Z
11
+ date: 2020-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -86,11 +86,6 @@ executables: []
86
86
  extensions: []
87
87
  extra_rdoc_files: []
88
88
  files:
89
- - ".appveyor.yml"
90
- - ".gitignore"
91
- - ".gitmodules"
92
- - ".travis.yml"
93
- - ".yardopts"
94
89
  - CHANGELOG.md
95
90
  - COPYING
96
91
  - Gemfile
@@ -99,13 +94,14 @@ files:
99
94
  - README.md
100
95
  - Rakefile
101
96
  - ffi.gemspec
102
- - lib/2.2/ffi_c.so
103
97
  - lib/2.3/ffi_c.so
104
98
  - lib/2.4/ffi_c.so
105
99
  - lib/2.5/ffi_c.so
106
100
  - lib/2.6/ffi_c.so
107
101
  - lib/2.7/ffi_c.so
102
+ - lib/3.0/ffi_c.so
108
103
  - lib/ffi.rb
104
+ - lib/ffi/abstract_memory.rb
109
105
  - lib/ffi/autopointer.rb
110
106
  - lib/ffi/buffer.rb
111
107
  - lib/ffi/callback.rb
@@ -118,9 +114,11 @@ files:
118
114
  - lib/ffi/managedstruct.rb
119
115
  - lib/ffi/memorypointer.rb
120
116
  - lib/ffi/platform.rb
117
+ - lib/ffi/platform/aarch64-darwin/types.conf
121
118
  - lib/ffi/platform/aarch64-freebsd/types.conf
122
119
  - lib/ffi/platform/aarch64-freebsd12/types.conf
123
120
  - lib/ffi/platform/aarch64-linux/types.conf
121
+ - lib/ffi/platform/aarch64-openbsd/types.conf
124
122
  - lib/ffi/platform/arm-freebsd/types.conf
125
123
  - lib/ffi/platform/arm-freebsd12/types.conf
126
124
  - lib/ffi/platform/arm-linux/types.conf
@@ -146,19 +144,23 @@ files:
146
144
  - lib/ffi/platform/powerpc-aix/types.conf
147
145
  - lib/ffi/platform/powerpc-darwin/types.conf
148
146
  - lib/ffi/platform/powerpc-linux/types.conf
147
+ - lib/ffi/platform/powerpc-openbsd/types.conf
149
148
  - lib/ffi/platform/powerpc64-linux/types.conf
150
149
  - lib/ffi/platform/s390-linux/types.conf
151
150
  - lib/ffi/platform/s390x-linux/types.conf
152
151
  - lib/ffi/platform/sparc-linux/types.conf
153
152
  - lib/ffi/platform/sparc-solaris/types.conf
154
153
  - lib/ffi/platform/sparc64-linux/types.conf
154
+ - lib/ffi/platform/sparcv9-openbsd/types.conf
155
155
  - lib/ffi/platform/sparcv9-solaris/types.conf
156
156
  - lib/ffi/platform/x86_64-cygwin/types.conf
157
157
  - lib/ffi/platform/x86_64-darwin/types.conf
158
158
  - lib/ffi/platform/x86_64-dragonflybsd/types.conf
159
159
  - lib/ffi/platform/x86_64-freebsd/types.conf
160
160
  - lib/ffi/platform/x86_64-freebsd12/types.conf
161
+ - lib/ffi/platform/x86_64-haiku/types.conf
161
162
  - lib/ffi/platform/x86_64-linux/types.conf
163
+ - lib/ffi/platform/x86_64-msys/types.conf
162
164
  - lib/ffi/platform/x86_64-netbsd/types.conf
163
165
  - lib/ffi/platform/x86_64-openbsd/types.conf
164
166
  - lib/ffi/platform/x86_64-solaris/types.conf
@@ -184,7 +186,6 @@ files:
184
186
  - samples/inotify.rb
185
187
  - samples/pty.rb
186
188
  - samples/qsort.rb
187
- - samples/sample_helper.rb
188
189
  homepage: https://github.com/ffi/ffi/wiki
189
190
  licenses:
190
191
  - BSD-3-Clause
@@ -205,17 +206,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
206
  requirements:
206
207
  - - ">="
207
208
  - !ruby/object:Gem::Version
208
- version: '2.2'
209
+ version: '2.3'
209
210
  - - "<"
210
211
  - !ruby/object:Gem::Version
211
- version: 2.8.dev
212
+ version: 3.1.dev
212
213
  required_rubygems_version: !ruby/object:Gem::Requirement
213
214
  requirements:
214
215
  - - ">="
215
216
  - !ruby/object:Gem::Version
216
217
  version: '0'
217
218
  requirements: []
218
- rubygems_version: 3.1.2
219
+ rubygems_version: 3.2.2
219
220
  signing_key:
220
221
  specification_version: 4
221
222
  summary: Ruby FFI
@@ -1,27 +0,0 @@
1
- install:
2
- - SET PATH=C:\Ruby%RUBYVER%\bin;%PATH%
3
- - SET RAKEOPT=-rdevkit
4
- - ps: |
5
- if ($env:RUBYVER -like "*head*") {
6
- $(new-object net.webclient).DownloadFile("https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-$env:RUBYVER.exe", "$pwd/ruby-setup.exe")
7
- cmd /c ruby-setup.exe /verysilent /dir=C:/Ruby$env:RUBYVER
8
- }
9
- - ridk version
10
- - gem --version
11
- - gem install bundler --quiet --no-document
12
- - bundle install
13
- build: off
14
- build_script:
15
- - bundle exec rake libffi compile -- %EXTCONFOPTS% || bundle exec rake compile -- %EXTCONFOPTS%
16
- test_script:
17
- - bundle exec rake test
18
- environment:
19
- matrix:
20
- - RUBYVER: "head-x64"
21
- EXTCONFOPTS: "--disable-system-libffi"
22
- - RUBYVER: 24
23
- EXTCONFOPTS: "--disable-system-libffi"
24
- - RUBYVER: 25-x64
25
- EXTCONFOPTS: "--enable-system-libffi"
26
- - RUBYVER: 26
27
- EXTCONFOPTS: "--enable-system-libffi"
data/.gitignore DELETED
@@ -1,25 +0,0 @@
1
- doc/
2
- bin/
3
- .yardoc
4
- *.orig
5
- nbproject/private
6
- pkg
7
- *.orig
8
- *.rej
9
- *.patch
10
- *.diff
11
- build
12
- *.so
13
- *.[oa]
14
- core
15
- lib/ffi/types.conf
16
- lib/ffi_c.bundle
17
- lib/ffi_c.so
18
- vendor
19
- .bundle
20
- Gemfile.lock
21
- types_log
22
- *.gem
23
- embed-test.log
24
- spec/ffi/embed-test/ext/Makefile
25
- spec/ffi/embed-test/ext/embed_test.bundle
@@ -1,4 +0,0 @@
1
- [submodule "ext/ffi_c/libffi"]
2
- path = ext/ffi_c/libffi
3
- url = https://github.com/libffi/libffi.git
4
- branch = master
@@ -1,44 +0,0 @@
1
- dist: trusty
2
- group: beta
3
- language: ruby
4
-
5
- script:
6
- - bundle exec rake compile || bundle exec rake compile
7
- - bundle exec rake test
8
- - ITER=10 bundle exec rake bench:all
9
- os:
10
- - linux
11
- - osx
12
- rvm:
13
- - 2.3.8
14
- - 2.4.5
15
- - 2.5.3
16
- - 2.6.0
17
- - ruby-head
18
-
19
- env:
20
- - CC=gcc
21
- - CC=clang
22
- matrix:
23
- allow_failures:
24
- - os: osx
25
- rvm: ruby-head
26
- - os: osx
27
- rvm: 2.3.8
28
- include:
29
- - name: powerpc
30
- language: generic
31
- before_install: |
32
- docker run --rm --privileged multiarch/qemu-user-static:register --reset &&
33
- docker build --rm -t ffi-powerpc -f spec/env/Dockerfile.powerpc .
34
- script: |
35
- docker run --rm -t -v `pwd`:/ffi ffi-powerpc
36
- - name: armhf
37
- language: generic
38
- before_install: |
39
- docker run --rm --privileged multiarch/qemu-user-static:register --reset &&
40
- docker build --rm -t ffi-armhf -f spec/env/Dockerfile.armhf .
41
- script: |
42
- docker run --rm -t -v `pwd`:/ffi ffi-armhf
43
- after_failure:
44
- - "find build -name mkmf.log | xargs cat"
data/.yardopts DELETED
@@ -1,5 +0,0 @@
1
- --title "Ruby FFI"
2
- --charset UTF-8
3
- --private
4
- lib/**/*.rb
5
- ext/**/*.c
@@ -1,6 +0,0 @@
1
- require 'rubygems'
2
- require 'spec'
3
-
4
- $:.unshift File.join(File.dirname(__FILE__), "..", "lib"), File.join(File.dirname(__FILE__), "..", "build", RUBY_VERSION) unless RUBY_PLATFORM =~ /java/
5
- require "ffi"
6
-