ffi 1.12.1-x64-mingw32 → 1.14.1-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +80 -0
  3. data/Gemfile +4 -2
  4. data/README.md +10 -2
  5. data/Rakefile +24 -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/ffi.rb +10 -2
  13. data/lib/ffi/abstract_memory.rb +44 -0
  14. data/lib/ffi/ffi.rb +1 -0
  15. data/lib/ffi/library.rb +6 -2
  16. data/lib/ffi/platform.rb +21 -8
  17. data/lib/ffi/platform/aarch64-darwin/types.conf +130 -0
  18. data/lib/ffi/platform/aarch64-openbsd/types.conf +134 -0
  19. data/lib/ffi/platform/arm-linux/types.conf +32 -4
  20. data/lib/ffi/platform/i386-windows/types.conf +26 -79
  21. data/lib/ffi/platform/powerpc-linux/types.conf +32 -2
  22. data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
  23. data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
  24. data/lib/ffi/platform/x86_64-darwin/types.conf +4 -0
  25. data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +4 -22
  26. data/lib/ffi/platform/x86_64-haiku/types.conf +117 -0
  27. data/lib/ffi/platform/x86_64-linux/types.conf +21 -0
  28. data/lib/ffi/platform/x86_64-msys/types.conf +119 -0
  29. data/lib/ffi/platform/x86_64-windows/types.conf +10 -78
  30. data/lib/ffi/pointer.rb +19 -12
  31. data/lib/ffi/struct.rb +9 -4
  32. data/lib/ffi/tools/types_generator.rb +2 -0
  33. data/lib/ffi/version.rb +1 -1
  34. data/samples/getlogin.rb +1 -1
  35. data/samples/getpid.rb +1 -1
  36. data/samples/gettimeofday.rb +8 -8
  37. data/samples/hello.rb +2 -1
  38. data/samples/inotify.rb +1 -1
  39. data/samples/pty.rb +1 -2
  40. data/samples/qsort.rb +0 -1
  41. metadata +10 -10
  42. data/.appveyor.yml +0 -27
  43. data/.gitignore +0 -25
  44. data/.gitmodules +0 -4
  45. data/.travis.yml +0 -44
  46. data/.yardopts +0 -5
  47. data/samples/sample_helper.rb +0 -6
@@ -190,7 +190,7 @@ module FFI
190
190
  # :field2, :pointer, 6, # set offset to 6 for this field
191
191
  # :field3, :string
192
192
  # end
193
- # @example Creating a layout from a hash +spec+ (Ruby 1.9 only)
193
+ # @example Creating a layout from a hash +spec+
194
194
  # class MyStructFromHash < Struct
195
195
  # layout :field1 => :int,
196
196
  # :field2 => :pointer,
@@ -202,7 +202,6 @@ module FFI
202
202
  # :function2, callback([:pointer], :void),
203
203
  # :field3, :string
204
204
  # end
205
- # @note Creating a layout from a hash +spec+ is supported only for Ruby 1.9.
206
205
  def layout(*spec)
207
206
  warn "[DEPRECATION] Struct layout is already defined for class #{self.inspect}. Redefinition as in #{caller[0]} will be disallowed in ffi-2.0." if defined?(@layout)
208
207
  return @layout if spec.size == 0
@@ -229,7 +228,11 @@ module FFI
229
228
 
230
229
  def callback(params, ret)
231
230
  mod = enclosing_module
232
- 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) })
233
236
  end
234
237
 
235
238
  def packed(packed = 1)
@@ -245,7 +248,9 @@ module FFI
245
248
  def enclosing_module
246
249
  begin
247
250
  mod = self.name.split("::")[0..-2].inject(Object) { |obj, c| obj.const_get(c) }
248
- (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
249
254
  rescue Exception
250
255
  nil
251
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>
@@ -1,3 +1,3 @@
1
1
  module FFI
2
- VERSION = '1.12.1'
2
+ VERSION = '1.14.1'
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.1
4
+ version: 1.14.1
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Wayne Meissner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-14 00:00:00.000000000 Z
11
+ date: 2020-12-19 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,13 @@ 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
108
102
  - lib/ffi.rb
103
+ - lib/ffi/abstract_memory.rb
109
104
  - lib/ffi/autopointer.rb
110
105
  - lib/ffi/buffer.rb
111
106
  - lib/ffi/callback.rb
@@ -118,9 +113,11 @@ files:
118
113
  - lib/ffi/managedstruct.rb
119
114
  - lib/ffi/memorypointer.rb
120
115
  - lib/ffi/platform.rb
116
+ - lib/ffi/platform/aarch64-darwin/types.conf
121
117
  - lib/ffi/platform/aarch64-freebsd/types.conf
122
118
  - lib/ffi/platform/aarch64-freebsd12/types.conf
123
119
  - lib/ffi/platform/aarch64-linux/types.conf
120
+ - lib/ffi/platform/aarch64-openbsd/types.conf
124
121
  - lib/ffi/platform/arm-freebsd/types.conf
125
122
  - lib/ffi/platform/arm-freebsd12/types.conf
126
123
  - lib/ffi/platform/arm-linux/types.conf
@@ -146,19 +143,23 @@ files:
146
143
  - lib/ffi/platform/powerpc-aix/types.conf
147
144
  - lib/ffi/platform/powerpc-darwin/types.conf
148
145
  - lib/ffi/platform/powerpc-linux/types.conf
146
+ - lib/ffi/platform/powerpc-openbsd/types.conf
149
147
  - lib/ffi/platform/powerpc64-linux/types.conf
150
148
  - lib/ffi/platform/s390-linux/types.conf
151
149
  - lib/ffi/platform/s390x-linux/types.conf
152
150
  - lib/ffi/platform/sparc-linux/types.conf
153
151
  - lib/ffi/platform/sparc-solaris/types.conf
154
152
  - lib/ffi/platform/sparc64-linux/types.conf
153
+ - lib/ffi/platform/sparcv9-openbsd/types.conf
155
154
  - lib/ffi/platform/sparcv9-solaris/types.conf
156
155
  - lib/ffi/platform/x86_64-cygwin/types.conf
157
156
  - lib/ffi/platform/x86_64-darwin/types.conf
158
157
  - lib/ffi/platform/x86_64-dragonflybsd/types.conf
159
158
  - lib/ffi/platform/x86_64-freebsd/types.conf
160
159
  - lib/ffi/platform/x86_64-freebsd12/types.conf
160
+ - lib/ffi/platform/x86_64-haiku/types.conf
161
161
  - lib/ffi/platform/x86_64-linux/types.conf
162
+ - lib/ffi/platform/x86_64-msys/types.conf
162
163
  - lib/ffi/platform/x86_64-netbsd/types.conf
163
164
  - lib/ffi/platform/x86_64-openbsd/types.conf
164
165
  - lib/ffi/platform/x86_64-solaris/types.conf
@@ -184,7 +185,6 @@ files:
184
185
  - samples/inotify.rb
185
186
  - samples/pty.rb
186
187
  - samples/qsort.rb
187
- - samples/sample_helper.rb
188
188
  homepage: https://github.com/ffi/ffi/wiki
189
189
  licenses:
190
190
  - BSD-3-Clause
@@ -205,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
- version: '2.2'
208
+ version: '2.3'
209
209
  - - "<"
210
210
  - !ruby/object:Gem::Version
211
211
  version: 2.8.dev
@@ -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
-