ffi 1.11.3-x86-mingw32 → 1.13.1-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.appveyor.yml +3 -0
- data/.github/workflows/ci.yml +64 -0
- data/.travis.yml +21 -5
- data/CHANGELOG.md +68 -0
- data/Gemfile +6 -4
- data/README.md +10 -1
- data/Rakefile +24 -43
- data/ffi.gemspec +3 -3
- data/lib/ffi.rb +10 -2
- data/lib/ffi/ffi.rb +1 -0
- data/lib/ffi/library.rb +5 -1
- data/lib/ffi/platform.rb +6 -2
- data/lib/ffi/platform/arm-linux/types.conf +32 -4
- data/lib/ffi/platform/i386-windows/types.conf +26 -79
- data/lib/ffi/platform/powerpc-linux/types.conf +32 -2
- data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
- data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
- data/lib/ffi/platform/x86_64-darwin/types.conf +4 -0
- data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +4 -22
- data/lib/ffi/platform/x86_64-linux/types.conf +21 -0
- data/lib/ffi/platform/x86_64-windows/types.conf +10 -78
- data/lib/ffi/pointer.rb +19 -12
- data/lib/ffi/struct.rb +10 -5
- data/lib/ffi/tools/types_generator.rb +2 -0
- data/lib/ffi/version.rb +1 -1
- data/samples/getlogin.rb +1 -1
- data/samples/getpid.rb +1 -1
- data/samples/gettimeofday.rb +8 -8
- data/samples/hello.rb +2 -1
- data/samples/inotify.rb +1 -1
- data/samples/pty.rb +1 -2
- data/samples/qsort.rb +0 -1
- metadata +13 -12
- data/samples/sample_helper.rb +0 -6
data/lib/ffi/struct.rb
CHANGED
@@ -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+
|
193
|
+
# @example Creating a layout from a hash +spec+
|
194
194
|
# class MyStructFromHash < Struct
|
195
195
|
# layout :field1 => :int,
|
196
196
|
# :field2 => :pointer,
|
@@ -202,9 +202,8 @@ 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
|
209
208
|
|
210
209
|
builder = StructLayoutBuilder.new
|
@@ -229,7 +228,11 @@ module FFI
|
|
229
228
|
|
230
229
|
def callback(params, ret)
|
231
230
|
mod = enclosing_module
|
232
|
-
|
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
|
-
(
|
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
|
data/lib/ffi/version.rb
CHANGED
data/samples/getlogin.rb
CHANGED
data/samples/getpid.rb
CHANGED
data/samples/gettimeofday.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'ffi'
|
2
|
+
require 'rbconfig'
|
3
|
+
|
3
4
|
class Timeval < FFI::Struct
|
4
|
-
|
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
|
-
|
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
|
data/samples/hello.rb
CHANGED
data/samples/inotify.rb
CHANGED
data/samples/pty.rb
CHANGED
@@ -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
|
data/samples/qsort.rb
CHANGED
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.
|
4
|
+
version: 1.13.1
|
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:
|
11
|
+
date: 2020-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '13.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '13.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake-compiler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '1.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,6 +87,7 @@ extensions: []
|
|
87
87
|
extra_rdoc_files: []
|
88
88
|
files:
|
89
89
|
- ".appveyor.yml"
|
90
|
+
- ".github/workflows/ci.yml"
|
90
91
|
- ".gitignore"
|
91
92
|
- ".gitmodules"
|
92
93
|
- ".travis.yml"
|
@@ -99,11 +100,11 @@ files:
|
|
99
100
|
- README.md
|
100
101
|
- Rakefile
|
101
102
|
- ffi.gemspec
|
102
|
-
- lib/2.2/ffi_c.so
|
103
103
|
- lib/2.3/ffi_c.so
|
104
104
|
- lib/2.4/ffi_c.so
|
105
105
|
- lib/2.5/ffi_c.so
|
106
106
|
- lib/2.6/ffi_c.so
|
107
|
+
- lib/2.7/ffi_c.so
|
107
108
|
- lib/ffi.rb
|
108
109
|
- lib/ffi/autopointer.rb
|
109
110
|
- lib/ffi/buffer.rb
|
@@ -145,12 +146,14 @@ files:
|
|
145
146
|
- lib/ffi/platform/powerpc-aix/types.conf
|
146
147
|
- lib/ffi/platform/powerpc-darwin/types.conf
|
147
148
|
- lib/ffi/platform/powerpc-linux/types.conf
|
149
|
+
- lib/ffi/platform/powerpc-openbsd/types.conf
|
148
150
|
- lib/ffi/platform/powerpc64-linux/types.conf
|
149
151
|
- lib/ffi/platform/s390-linux/types.conf
|
150
152
|
- lib/ffi/platform/s390x-linux/types.conf
|
151
153
|
- lib/ffi/platform/sparc-linux/types.conf
|
152
154
|
- lib/ffi/platform/sparc-solaris/types.conf
|
153
155
|
- lib/ffi/platform/sparc64-linux/types.conf
|
156
|
+
- lib/ffi/platform/sparcv9-openbsd/types.conf
|
154
157
|
- lib/ffi/platform/sparcv9-solaris/types.conf
|
155
158
|
- lib/ffi/platform/x86_64-cygwin/types.conf
|
156
159
|
- lib/ffi/platform/x86_64-darwin/types.conf
|
@@ -183,7 +186,6 @@ files:
|
|
183
186
|
- samples/inotify.rb
|
184
187
|
- samples/pty.rb
|
185
188
|
- samples/qsort.rb
|
186
|
-
- samples/sample_helper.rb
|
187
189
|
homepage: https://github.com/ffi/ffi/wiki
|
188
190
|
licenses:
|
189
191
|
- BSD-3-Clause
|
@@ -204,18 +206,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
206
|
requirements:
|
205
207
|
- - ">="
|
206
208
|
- !ruby/object:Gem::Version
|
207
|
-
version: '2.
|
209
|
+
version: '2.3'
|
208
210
|
- - "<"
|
209
211
|
- !ruby/object:Gem::Version
|
210
|
-
version: 2.
|
212
|
+
version: 2.8.dev
|
211
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
214
|
requirements:
|
213
215
|
- - ">="
|
214
216
|
- !ruby/object:Gem::Version
|
215
217
|
version: '0'
|
216
218
|
requirements: []
|
217
|
-
|
218
|
-
rubygems_version: 2.7.9
|
219
|
+
rubygems_version: 3.1.2
|
219
220
|
signing_key:
|
220
221
|
specification_version: 4
|
221
222
|
summary: Ruby FFI
|