ffi 1.16.2-x64-mingw-ucrt → 1.17.0.rc1-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -0
- data/Gemfile +9 -2
- data/README.md +2 -2
- data/Rakefile +17 -5
- data/lib/3.1/ffi_c.so +0 -0
- data/lib/3.2/ffi_c.so +0 -0
- data/lib/3.3/ffi_c.so +0 -0
- data/lib/ffi/dynamic_library.rb +34 -5
- data/lib/ffi/enum.rb +0 -1
- data/lib/ffi/function.rb +1 -1
- data/lib/ffi/io.rb +2 -2
- data/lib/ffi/library.rb +23 -23
- data/lib/ffi/platform/aarch64-linux/types.conf +74 -3
- data/lib/ffi/pointer.rb +6 -6
- data/lib/ffi/struct.rb +4 -4
- data/lib/ffi/struct_layout.rb +2 -2
- data/lib/ffi/struct_layout_builder.rb +8 -8
- data/lib/ffi/types.rb +51 -48
- data/lib/ffi/version.rb +1 -1
- data/samples/hello_ractor.rb +11 -0
- data/samples/qsort_ractor.rb +28 -0
- data/sig/ffi/abstract_memory.rbs +164 -0
- data/sig/ffi/auto_pointer.rbs +27 -0
- data/sig/ffi/buffer.rbs +18 -0
- data/sig/ffi/data_converter.rbs +10 -0
- data/sig/ffi/dynamic_library.rbs +9 -0
- data/sig/ffi/enum.rbs +38 -0
- data/sig/ffi/function.rbs +39 -0
- data/sig/ffi/library.rbs +42 -0
- data/sig/ffi/native_type.rbs +86 -0
- data/sig/ffi/pointer.rbs +42 -0
- data/sig/ffi/struct.rbs +76 -0
- data/sig/ffi/struct_by_reference.rbs +11 -0
- data/sig/ffi/struct_by_value.rbs +7 -0
- data/sig/ffi/struct_layout.rbs +9 -0
- data/sig/ffi/struct_layout_builder.rbs +5 -0
- data/sig/ffi/type.rbs +39 -0
- data/sig/ffi.rbs +26 -0
- metadata +25 -5
data/sig/ffi/struct.rbs
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
module FFI
|
2
|
+
class Struct[out P < AbstractMemory, unchecked out E]
|
3
|
+
type layout = Library::ffi_lib_type | singleton(StructLayout::Field) | [layout, Integer]
|
4
|
+
|
5
|
+
type ptr = Type::Mapped[
|
6
|
+
StructByReference[Struct[AbstractMemory, untyped], AbstractMemory],
|
7
|
+
AbstractMemory, instance, untyped
|
8
|
+
]
|
9
|
+
def self.ptr: (?untyped flags) -> ptr # https://github.com/ffi/ffi/issues/1073
|
10
|
+
alias self.by_ref self.ptr
|
11
|
+
def self.in: () -> ptr
|
12
|
+
def self.out: () -> ptr
|
13
|
+
def self.val: () -> StructByValue[singleton(Struct)]
|
14
|
+
alias self.by_value self.val
|
15
|
+
|
16
|
+
alias self.alloc_inout self.new
|
17
|
+
alias self.alloc_in self.new
|
18
|
+
alias self.alloc_out self.new
|
19
|
+
alias self.new_inout self.new
|
20
|
+
alias self.new_in self.new
|
21
|
+
alias self.new_out self.new
|
22
|
+
|
23
|
+
def self.auto_ptr: () -> Type::Mapped[
|
24
|
+
ManagedStructConverter[ManagedStruct[AutoPointer, untyped], AutoPointer],
|
25
|
+
Pointer, instance, untyped
|
26
|
+
]
|
27
|
+
def self.layout: (*layout | Integer) -> StructLayout
|
28
|
+
| (Hash[Symbol, layout]) -> StructLayout
|
29
|
+
def self.size=: (Integer size) -> Integer
|
30
|
+
|
31
|
+
def self?.alignment: () -> Integer
|
32
|
+
def self?.members: () -> Array[Symbol]
|
33
|
+
def self?.offset_of: (Symbol name) -> Integer
|
34
|
+
def self?.offsets: () -> Array[[Symbol, Integer]]
|
35
|
+
def self?.size: -> Integer
|
36
|
+
|
37
|
+
def initialize: (?P pointer, *layout args) -> void
|
38
|
+
def []: (Symbol field_name) -> E
|
39
|
+
def []=: (Symbol field_name, E value) -> E
|
40
|
+
alias align alignment
|
41
|
+
def clear: () -> self
|
42
|
+
def layout: () -> StructLayout
|
43
|
+
def null?: () -> bool
|
44
|
+
def order: (AbstractMemory::order_in order) -> Struct[P, E]
|
45
|
+
| () -> AbstractMemory::order_out
|
46
|
+
def pointer: () -> P
|
47
|
+
alias to_ptr pointer
|
48
|
+
def values: () -> Array[E]
|
49
|
+
|
50
|
+
class InlineArray[out P < AbstractMemory, unchecked out E]
|
51
|
+
include Enumerable[E]
|
52
|
+
include AbstractMemory::_Size
|
53
|
+
|
54
|
+
def initialize: (P memory, StructLayout::Field field) -> self
|
55
|
+
def []: (Integer index) -> E
|
56
|
+
def []=: (Integer index, E value) -> E
|
57
|
+
def each: () { (E) -> void } -> self
|
58
|
+
def to_a: () -> Array[E]
|
59
|
+
def to_ptr: () -> P
|
60
|
+
end
|
61
|
+
|
62
|
+
class ManagedStructConverter[S < ManagedStruct[P, untyped], P < AutoPointer] < StructByReference[S, P]
|
63
|
+
def initialize: ...
|
64
|
+
def from_native: (Pointer ptr, untyped ctx) -> S
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
class ManagedStruct[out P < AutoPointer, unchecked out E] < Struct[P, E]
|
69
|
+
def self.release: (AbstractMemory ptr) -> void
|
70
|
+
def initialize: (Pointer pointer) -> self
|
71
|
+
end
|
72
|
+
|
73
|
+
class Union[out P < AbstractMemory, unchecked out E] < Struct[P, E]
|
74
|
+
def self.builder: () -> StructLayoutBuilder
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module FFI
|
2
|
+
class StructByReference[S < Struct[P, untyped], P < AbstractMemory]
|
3
|
+
include DataConverter[P, S, untyped]
|
4
|
+
attr_reader struct_class: Struct[P, untyped]
|
5
|
+
|
6
|
+
def initialize: (S struct_class) -> void
|
7
|
+
def from_native: (P value, untyped ctx) -> S
|
8
|
+
def native_type: () -> Type::Builtin
|
9
|
+
def to_native: (S? value, untyped ctx) -> P
|
10
|
+
end
|
11
|
+
end
|
data/sig/ffi/type.rbs
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
module FFI
|
2
|
+
class Type
|
3
|
+
class Array = ArrayType
|
4
|
+
class Function = FunctionType
|
5
|
+
class Struct = StructByValue
|
6
|
+
|
7
|
+
include AbstractMemory::_Size
|
8
|
+
def initialize: (Integer | Type value) -> self
|
9
|
+
def alignment: () -> Integer
|
10
|
+
def inspect: ...
|
11
|
+
|
12
|
+
class Builtin < Type
|
13
|
+
def inspect: ...
|
14
|
+
end
|
15
|
+
|
16
|
+
class Mapped[X < _DataConverter[N, R, C], N, R, C]
|
17
|
+
include _DataConverter[N, R, C]
|
18
|
+
|
19
|
+
def initialize: (X converter) -> self
|
20
|
+
def converter: () -> X
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class ArrayType
|
25
|
+
def initialize: (Type component_type, Integer length) -> self
|
26
|
+
def element_type: -> Type
|
27
|
+
def length: -> Integer
|
28
|
+
end
|
29
|
+
|
30
|
+
class FunctionType < Type
|
31
|
+
def initialize:
|
32
|
+
(
|
33
|
+
ffi_type return_type, Array[ffi_type] param_types,
|
34
|
+
?blocking: boolish, ?convention: Library::convention, ?enums: Enums
|
35
|
+
) -> self
|
36
|
+
def param_types: () -> Array[Type]
|
37
|
+
def return_type: () -> Type
|
38
|
+
end
|
39
|
+
end
|
data/sig/ffi.rbs
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module FFI
|
2
|
+
type ffi_type = Type | Symbol
|
3
|
+
type ffi_auto_type = ffi_type | DataConverter[untyped, untyped, untyped]
|
4
|
+
type type_map = Hash[Symbol | DataConverter[untyped, untyped, untyped], Type]
|
5
|
+
|
6
|
+
class CallbackInfo = FunctionType
|
7
|
+
class FunctionInfo = FunctionType
|
8
|
+
class NativeLibrary = DynamicLibrary
|
9
|
+
|
10
|
+
VERSION: String
|
11
|
+
TypeDefs: type_map
|
12
|
+
|
13
|
+
type current_process = Object
|
14
|
+
CURRENT_PROCESS: current_process
|
15
|
+
USE_THIS_PROCESS_AS_LIBRARY: current_process
|
16
|
+
|
17
|
+
private def self.custom_typedefs: () -> type_map
|
18
|
+
def self.errno: () -> Integer
|
19
|
+
def self.errno=: (Integer) -> nil
|
20
|
+
def self.find_type: (ffi_auto_type name, ?type_map? type_map) -> Type
|
21
|
+
def self.make_shareable: [T] (T obj) -> T
|
22
|
+
def self.map_library_name: (_ToS lib) -> String
|
23
|
+
def self.type_size: (ffi_auto_type type) -> Integer
|
24
|
+
def self.typedef: (ffi_auto_type old, Symbol add) -> Type
|
25
|
+
alias self.add_typedef self.typedef
|
26
|
+
end
|
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.17.0.rc1
|
5
5
|
platform: x64-mingw-ucrt
|
6
6
|
authors:
|
7
7
|
- Wayne Meissner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- ffi.gemspec
|
83
83
|
- lib/3.1/ffi_c.so
|
84
84
|
- lib/3.2/ffi_c.so
|
85
|
+
- lib/3.3/ffi_c.so
|
85
86
|
- lib/ffi.rb
|
86
87
|
- lib/ffi/abstract_memory.rb
|
87
88
|
- lib/ffi/autopointer.rb
|
@@ -177,9 +178,28 @@ files:
|
|
177
178
|
- samples/getpid.rb
|
178
179
|
- samples/gettimeofday.rb
|
179
180
|
- samples/hello.rb
|
181
|
+
- samples/hello_ractor.rb
|
180
182
|
- samples/inotify.rb
|
181
183
|
- samples/pty.rb
|
182
184
|
- samples/qsort.rb
|
185
|
+
- samples/qsort_ractor.rb
|
186
|
+
- sig/ffi.rbs
|
187
|
+
- sig/ffi/abstract_memory.rbs
|
188
|
+
- sig/ffi/auto_pointer.rbs
|
189
|
+
- sig/ffi/buffer.rbs
|
190
|
+
- sig/ffi/data_converter.rbs
|
191
|
+
- sig/ffi/dynamic_library.rbs
|
192
|
+
- sig/ffi/enum.rbs
|
193
|
+
- sig/ffi/function.rbs
|
194
|
+
- sig/ffi/library.rbs
|
195
|
+
- sig/ffi/native_type.rbs
|
196
|
+
- sig/ffi/pointer.rbs
|
197
|
+
- sig/ffi/struct.rbs
|
198
|
+
- sig/ffi/struct_by_reference.rbs
|
199
|
+
- sig/ffi/struct_by_value.rbs
|
200
|
+
- sig/ffi/struct_layout.rbs
|
201
|
+
- sig/ffi/struct_layout_builder.rbs
|
202
|
+
- sig/ffi/type.rbs
|
183
203
|
homepage: https://github.com/ffi/ffi/wiki
|
184
204
|
licenses:
|
185
205
|
- BSD-3-Clause
|
@@ -203,12 +223,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
203
223
|
version: '3.1'
|
204
224
|
- - "<"
|
205
225
|
- !ruby/object:Gem::Version
|
206
|
-
version: 3.
|
226
|
+
version: 3.4.dev
|
207
227
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
228
|
requirements:
|
209
|
-
- - "
|
229
|
+
- - ">"
|
210
230
|
- !ruby/object:Gem::Version
|
211
|
-
version:
|
231
|
+
version: 1.3.1
|
212
232
|
requirements: []
|
213
233
|
rubygems_version: 3.3.26
|
214
234
|
signing_key:
|