ffi 1.16.3 → 1.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +42 -0
  4. data/Gemfile +9 -2
  5. data/README.md +1 -1
  6. data/Rakefile +17 -5
  7. data/ext/ffi_c/AbstractMemory.c +39 -38
  8. data/ext/ffi_c/ArrayType.c +2 -2
  9. data/ext/ffi_c/Buffer.c +4 -4
  10. data/ext/ffi_c/Call.c +12 -6
  11. data/ext/ffi_c/Call.h +3 -2
  12. data/ext/ffi_c/DynamicLibrary.c +2 -2
  13. data/ext/ffi_c/FunctionInfo.c +1 -1
  14. data/ext/ffi_c/LastError.c +4 -4
  15. data/ext/ffi_c/MemoryPointer.c +2 -2
  16. data/ext/ffi_c/Pointer.c +14 -11
  17. data/ext/ffi_c/Struct.c +11 -4
  18. data/ext/ffi_c/StructLayout.c +13 -13
  19. data/ext/ffi_c/Type.c +17 -16
  20. data/ext/ffi_c/Types.c +7 -1
  21. data/ext/ffi_c/Types.h +0 -1
  22. data/ext/ffi_c/Variadic.c +6 -3
  23. data/ext/ffi_c/libffi/.allow-ai-service +0 -0
  24. data/ext/ffi_c/libffi/.github/workflows/build.yml +34 -15
  25. data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +2 -1
  26. data/ext/ffi_c/libffi/LICENSE +1 -1
  27. data/ext/ffi_c/libffi/README.md +10 -5
  28. data/ext/ffi_c/libffi/configure +15 -15
  29. data/ext/ffi_c/libffi/configure.ac +2 -2
  30. data/ext/ffi_c/libffi/configure.host +1 -1
  31. data/ext/ffi_c/libffi/doc/libffi.texi +1 -1
  32. data/ext/ffi_c/libffi/doc/version.texi +4 -4
  33. data/ext/ffi_c/libffi/include/ffi.h.in +2 -11
  34. data/ext/ffi_c/libffi/include/ffi_common.h +4 -2
  35. data/ext/ffi_c/libffi/libffi.map.in +5 -0
  36. data/ext/ffi_c/libffi/libtool-version +1 -1
  37. data/ext/ffi_c/libffi/ltmain.sh +8 -20
  38. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +1 -1
  39. data/ext/ffi_c/libffi/src/aarch64/ffi.c +26 -13
  40. data/ext/ffi_c/libffi/src/aarch64/sysv.S +198 -46
  41. data/ext/ffi_c/libffi/src/closures.c +3 -3
  42. data/ext/ffi_c/libffi/src/debug.c +2 -2
  43. data/ext/ffi_c/libffi/src/dlmalloc.c +1 -1
  44. data/ext/ffi_c/libffi/src/loongarch64/ffi.c +3 -0
  45. data/ext/ffi_c/libffi/src/mips/ffi.c +12 -4
  46. data/ext/ffi_c/libffi/src/mips/n32.S +65 -14
  47. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +36 -24
  48. data/ext/ffi_c/libffi/src/sparc/ffi64.c +7 -1
  49. data/ext/ffi_c/libffi/src/tramp.c +1 -1
  50. data/ext/ffi_c/libffi/src/types.c +4 -6
  51. data/ext/ffi_c/libffi/src/wasm32/ffi.c +13 -0
  52. data/ext/ffi_c/libffi/src/x86/ffiw64.c +1 -1
  53. data/ext/ffi_c/libffi/testsuite/Makefile.am +79 -127
  54. data/ext/ffi_c/libffi/testsuite/Makefile.in +79 -127
  55. data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +6 -0
  56. data/ext/ffi_c/libffi/testsuite/libffi.call/callback.c +99 -0
  57. data/ext/ffi_c/libffi/testsuite/libffi.call/callback2.c +108 -0
  58. data/ext/ffi_c/libffi/testsuite/libffi.call/callback3.c +114 -0
  59. data/ext/ffi_c/libffi/testsuite/libffi.call/callback4.c +119 -0
  60. data/ext/ffi_c/libffi.darwin.mk +2 -2
  61. data/lib/ffi/autopointer.rb +1 -9
  62. data/lib/ffi/dynamic_library.rb +34 -5
  63. data/lib/ffi/enum.rb +0 -1
  64. data/lib/ffi/function.rb +1 -1
  65. data/lib/ffi/io.rb +2 -2
  66. data/lib/ffi/library.rb +23 -23
  67. data/lib/ffi/platform/aarch64-linux/types.conf +74 -3
  68. data/lib/ffi/pointer.rb +6 -6
  69. data/lib/ffi/struct.rb +4 -4
  70. data/lib/ffi/struct_layout.rb +2 -2
  71. data/lib/ffi/struct_layout_builder.rb +8 -8
  72. data/lib/ffi/types.rb +51 -49
  73. data/lib/ffi/version.rb +1 -1
  74. data/sig/ffi/abstract_memory.rbs +165 -0
  75. data/sig/ffi/auto_pointer.rbs +27 -0
  76. data/sig/ffi/buffer.rbs +18 -0
  77. data/sig/ffi/data_converter.rbs +10 -0
  78. data/sig/ffi/dynamic_library.rbs +9 -0
  79. data/sig/ffi/enum.rbs +38 -0
  80. data/sig/ffi/function.rbs +39 -0
  81. data/sig/ffi/library.rbs +42 -0
  82. data/sig/ffi/native_type.rbs +86 -0
  83. data/sig/ffi/pointer.rbs +42 -0
  84. data/sig/ffi/struct.rbs +76 -0
  85. data/sig/ffi/struct_by_reference.rbs +11 -0
  86. data/sig/ffi/struct_by_value.rbs +7 -0
  87. data/sig/ffi/struct_layout.rbs +9 -0
  88. data/sig/ffi/struct_layout_builder.rbs +5 -0
  89. data/sig/ffi/type.rbs +39 -0
  90. data/sig/ffi.rbs +26 -0
  91. data.tar.gz.sig +0 -0
  92. metadata +37 -18
  93. metadata.gz.sig +0 -0
@@ -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
@@ -0,0 +1,7 @@
1
+ module FFI
2
+ class StructByValue[C < singleton(Struct)] < Type
3
+ def initialize: (C) -> self
4
+ def layout: () -> StructLayout
5
+ def struct_class: () -> C
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module FFI
2
+ class StructLayout
3
+ #TODO
4
+
5
+ class Field
6
+ #TODO
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module FFI
2
+ class StructLayoutBuilder
3
+ #TODO
4
+ end
5
+ 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
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,18 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.3
4
+ version: 1.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayne Meissner
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain:
11
10
  - |
12
11
  -----BEGIN CERTIFICATE-----
13
- MIIEBDCCAmygAwIBAgIBAjANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
14
- L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yMzAyMTUxNzQxMTVaFw0yNDAy
15
- MTUxNzQxMTVaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
12
+ MIIEBDCCAmygAwIBAgIBAzANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
13
+ L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0y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CYXck0pajvubsDd
34
- NUIIFkVXvd1odFyK9LF1RFAtxn/iAmpx
25
+ 7EfMFzANBgkqhkiG9w0BAQsFAAOCAYEArBmHSfnUyNWf3R1Fx0mMHloWGdcKn2D2
26
+ BsqTApXU2nADiyppIqRq4b9e7hw342uzadSLkoQcEFOxThLRhAcijoWfQVBcsbV/
27
+ ZsCY1qlUTIJuSWxaSyS4efUX+N4eMNyPM9oW/sphlWFo0DgI34Y9WB6HDzH+O71y
28
+ R7PARke3f4kYnRJf5yRQLPDrH9UYt9KlBQm6l7XMtr5EMnQt0EfcmZEi9H4t/vS2
29
+ haxvpFMdAKo4H46GBYNO96r6b74t++vgQSBTg/AFVwvRZwNSrPPcBfb4xxeEAhRR
30
+ x+LU7feIH7lZ//3buiyD03gLAEtHXai0Y+/VfuWIpwYJAl2BO/tU7FS/dtbJq9oc
31
+ dI36Yyzy+BrCM0WT4oCsagePNb97FaNhl4F6sM5JEPT0ZPxRx0i3G4TNNIYziVos
32
+ 5wFER6XhvvLDFAMh/jMg+s7Wd5SbSHgHNSUaUGVtdWkVPOer6oF0aLdZUR3CETkn
33
+ 5nWXZma/BUd3YgYA/Xumc6QQqIS4p7mr
35
34
  -----END CERTIFICATE-----
36
- date: 2023-10-04 00:00:00.000000000 Z
35
+ date: 2024-06-02 00:00:00.000000000 Z
37
36
  dependencies:
38
37
  - !ruby/object:Gem::Dependency
39
38
  name: rake
@@ -154,6 +153,7 @@ files:
154
153
  - ext/ffi_c/libffi.mk
155
154
  - ext/ffi_c/libffi.vc.mk
156
155
  - ext/ffi_c/libffi.vc64.mk
156
+ - ext/ffi_c/libffi/.allow-ai-service
157
157
  - ext/ffi_c/libffi/.appveyor.yml
158
158
  - ext/ffi_c/libffi/.appveyor/site.exp
159
159
  - ext/ffi_c/libffi/.appveyor/unix-noexec.exp
@@ -404,6 +404,10 @@ files:
404
404
  - ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c
405
405
  - ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c
406
406
  - ext/ffi_c/libffi/testsuite/libffi.call/call.exp
407
+ - ext/ffi_c/libffi/testsuite/libffi.call/callback.c
408
+ - ext/ffi_c/libffi/testsuite/libffi.call/callback2.c
409
+ - ext/ffi_c/libffi/testsuite/libffi.call/callback3.c
410
+ - ext/ffi_c/libffi/testsuite/libffi.call/callback4.c
407
411
  - ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c
408
412
  - ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h
409
413
  - ext/ffi_c/libffi/testsuite/libffi.call/float.c
@@ -717,6 +721,23 @@ files:
717
721
  - samples/pty.rb
718
722
  - samples/qsort.rb
719
723
  - samples/qsort_ractor.rb
724
+ - sig/ffi.rbs
725
+ - sig/ffi/abstract_memory.rbs
726
+ - sig/ffi/auto_pointer.rbs
727
+ - sig/ffi/buffer.rbs
728
+ - sig/ffi/data_converter.rbs
729
+ - sig/ffi/dynamic_library.rbs
730
+ - sig/ffi/enum.rbs
731
+ - sig/ffi/function.rbs
732
+ - sig/ffi/library.rbs
733
+ - sig/ffi/native_type.rbs
734
+ - sig/ffi/pointer.rbs
735
+ - sig/ffi/struct.rbs
736
+ - sig/ffi/struct_by_reference.rbs
737
+ - sig/ffi/struct_by_value.rbs
738
+ - sig/ffi/struct_layout.rbs
739
+ - sig/ffi/struct_layout_builder.rbs
740
+ - sig/ffi/type.rbs
720
741
  homepage: https://github.com/ffi/ffi/wiki
721
742
  licenses:
722
743
  - BSD-3-Clause
@@ -727,7 +748,6 @@ metadata:
727
748
  wiki_uri: https://github.com/ffi/ffi/wiki
728
749
  source_code_uri: https://github.com/ffi/ffi/
729
750
  mailing_list_uri: http://groups.google.com/group/ruby-ffi
730
- post_install_message:
731
751
  rdoc_options:
732
752
  - "--exclude=ext/ffi_c/.*\\.o$"
733
753
  - "--exclude=ffi_c\\.(bundle|so)$"
@@ -744,8 +764,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
744
764
  - !ruby/object:Gem::Version
745
765
  version: '0'
746
766
  requirements: []
747
- rubygems_version: 3.4.19
748
- signing_key:
767
+ rubygems_version: 3.6.0.dev
749
768
  specification_version: 4
750
769
  summary: Ruby FFI
751
770
  test_files: []
metadata.gz.sig CHANGED
Binary file