sorbet-baml 0.3.0 → 0.4.0

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.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +59 -0
  3. data/README.md +32 -11
  4. data/lib/sorbet_baml/dspy_tool_converter.rb +2 -2
  5. data/lib/sorbet_baml/dspy_tool_extensions.rb +1 -1
  6. data/lib/sorbet_baml/version.rb +1 -1
  7. data/lib/sorbet_baml.rb +4 -2
  8. metadata +3 -115
  9. data/.idea/.gitignore +0 -8
  10. data/.idea/inspectionProfiles/Project_Default.xml +0 -5
  11. data/.rspec +0 -3
  12. data/docs-site/.gitignore +0 -48
  13. data/docs-site/Gemfile +0 -5
  14. data/docs-site/Gemfile.lock +0 -140
  15. data/docs-site/Rakefile +0 -3
  16. data/docs-site/bridgetown.config.yml +0 -15
  17. data/docs-site/config/initializers.rb +0 -9
  18. data/docs-site/config/puma.rb +0 -9
  19. data/docs-site/config.ru +0 -5
  20. data/docs-site/esbuild.config.js +0 -11
  21. data/docs-site/frontend/javascript/index.js +0 -22
  22. data/docs-site/frontend/styles/index.css +0 -61
  23. data/docs-site/package.json +0 -18
  24. data/docs-site/postcss.config.js +0 -6
  25. data/docs-site/server/roda_app.rb +0 -9
  26. data/docs-site/src/_components/head.liquid +0 -26
  27. data/docs-site/src/_components/nav.liquid +0 -68
  28. data/docs-site/src/_layouts/default.liquid +0 -27
  29. data/docs-site/src/_layouts/doc.liquid +0 -39
  30. data/docs-site/src/advanced-usage.md +0 -598
  31. data/docs-site/src/getting-started.md +0 -170
  32. data/docs-site/src/index.md +0 -183
  33. data/docs-site/src/troubleshooting.md +0 -317
  34. data/docs-site/src/type-mapping.md +0 -236
  35. data/docs-site/tailwind.config.js +0 -85
  36. data/sorbet/config +0 -6
  37. data/sorbet/rbi/annotations/.gitattributes +0 -1
  38. data/sorbet/rbi/annotations/rainbow.rbi +0 -269
  39. data/sorbet/rbi/gems/.gitattributes +0 -1
  40. data/sorbet/rbi/gems/anthropic@1.5.0.rbi +0 -21252
  41. data/sorbet/rbi/gems/ast@2.4.3.rbi +0 -585
  42. data/sorbet/rbi/gems/async@2.27.3.rbi +0 -9
  43. data/sorbet/rbi/gems/benchmark@0.4.1.rbi +0 -619
  44. data/sorbet/rbi/gems/bigdecimal@3.2.2.rbi +0 -9
  45. data/sorbet/rbi/gems/byebug@11.1.3.rbi +0 -37
  46. data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +0 -424
  47. data/sorbet/rbi/gems/connection_pool@2.5.3.rbi +0 -9
  48. data/sorbet/rbi/gems/console@1.33.0.rbi +0 -9
  49. data/sorbet/rbi/gems/date@3.4.1.rbi +0 -75
  50. data/sorbet/rbi/gems/diff-lcs@1.6.2.rbi +0 -1134
  51. data/sorbet/rbi/gems/dry-configurable@1.3.0.rbi +0 -672
  52. data/sorbet/rbi/gems/dry-core@1.1.0.rbi +0 -1729
  53. data/sorbet/rbi/gems/dry-logger@1.1.0.rbi +0 -1317
  54. data/sorbet/rbi/gems/dspy@0.19.1.rbi +0 -6677
  55. data/sorbet/rbi/gems/erb@5.0.2.rbi +0 -878
  56. data/sorbet/rbi/gems/erubi@1.13.1.rbi +0 -155
  57. data/sorbet/rbi/gems/ffi@1.17.2.rbi +0 -2174
  58. data/sorbet/rbi/gems/fiber-annotation@0.2.0.rbi +0 -9
  59. data/sorbet/rbi/gems/fiber-local@1.1.0.rbi +0 -9
  60. data/sorbet/rbi/gems/fiber-storage@1.0.1.rbi +0 -9
  61. data/sorbet/rbi/gems/google-protobuf@4.32.0.rbi +0 -9
  62. data/sorbet/rbi/gems/googleapis-common-protos-types@1.20.0.rbi +0 -9
  63. data/sorbet/rbi/gems/informers@1.2.1.rbi +0 -1875
  64. data/sorbet/rbi/gems/io-console@0.8.1.rbi +0 -9
  65. data/sorbet/rbi/gems/io-event@1.12.1.rbi +0 -9
  66. data/sorbet/rbi/gems/json@2.13.2.rbi +0 -2087
  67. data/sorbet/rbi/gems/language_server-protocol@3.17.0.5.rbi +0 -9
  68. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +0 -240
  69. data/sorbet/rbi/gems/logger@1.7.0.rbi +0 -963
  70. data/sorbet/rbi/gems/metrics@0.13.0.rbi +0 -9
  71. data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -159
  72. data/sorbet/rbi/gems/onnxruntime@0.10.0.rbi +0 -304
  73. data/sorbet/rbi/gems/openai@0.16.0.rbi +0 -68055
  74. data/sorbet/rbi/gems/opentelemetry-api@1.6.0.rbi +0 -9
  75. data/sorbet/rbi/gems/opentelemetry-common@0.22.0.rbi +0 -9
  76. data/sorbet/rbi/gems/opentelemetry-exporter-otlp@0.30.0.rbi +0 -9
  77. data/sorbet/rbi/gems/opentelemetry-registry@0.4.0.rbi +0 -9
  78. data/sorbet/rbi/gems/opentelemetry-sdk@1.8.1.rbi +0 -9
  79. data/sorbet/rbi/gems/opentelemetry-semantic_conventions@1.11.0.rbi +0 -9
  80. data/sorbet/rbi/gems/parallel@1.27.0.rbi +0 -291
  81. data/sorbet/rbi/gems/parser@3.3.9.0.rbi +0 -5535
  82. data/sorbet/rbi/gems/polars-df@0.20.0.rbi +0 -9
  83. data/sorbet/rbi/gems/pp@0.6.2.rbi +0 -368
  84. data/sorbet/rbi/gems/prettyprint@0.2.0.rbi +0 -477
  85. data/sorbet/rbi/gems/prism@1.4.0.rbi +0 -41732
  86. data/sorbet/rbi/gems/psych@5.2.6.rbi +0 -2469
  87. data/sorbet/rbi/gems/racc@1.8.1.rbi +0 -164
  88. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -403
  89. data/sorbet/rbi/gems/rake@13.3.0.rbi +0 -3031
  90. data/sorbet/rbi/gems/rbi@0.3.6.rbi +0 -6893
  91. data/sorbet/rbi/gems/rbs@3.9.4.rbi +0 -6976
  92. data/sorbet/rbi/gems/rdoc@6.14.2.rbi +0 -12688
  93. data/sorbet/rbi/gems/regexp_parser@2.11.2.rbi +0 -3845
  94. data/sorbet/rbi/gems/reline@0.6.2.rbi +0 -2441
  95. data/sorbet/rbi/gems/rexml@3.4.1.rbi +0 -5240
  96. data/sorbet/rbi/gems/rspec-core@3.13.5.rbi +0 -11250
  97. data/sorbet/rbi/gems/rspec-expectations@3.13.5.rbi +0 -8189
  98. data/sorbet/rbi/gems/rspec-mocks@3.13.5.rbi +0 -5350
  99. data/sorbet/rbi/gems/rspec-support@3.13.4.rbi +0 -1630
  100. data/sorbet/rbi/gems/rspec@3.13.1.rbi +0 -83
  101. data/sorbet/rbi/gems/rubocop-ast@1.46.0.rbi +0 -7764
  102. data/sorbet/rbi/gems/rubocop-sorbet@0.10.5.rbi +0 -2386
  103. data/sorbet/rbi/gems/rubocop@1.79.2.rbi +0 -63321
  104. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +0 -1318
  105. data/sorbet/rbi/gems/sorbet-result@1.4.0.rbi +0 -242
  106. data/sorbet/rbi/gems/sorbet-schema@0.9.2.rbi +0 -743
  107. data/sorbet/rbi/gems/sorbet-struct-comparable@1.3.0.rbi +0 -48
  108. data/sorbet/rbi/gems/spoom@1.6.3.rbi +0 -6985
  109. data/sorbet/rbi/gems/stringio@3.1.7.rbi +0 -9
  110. data/sorbet/rbi/gems/tapioca@0.16.11.rbi +0 -3628
  111. data/sorbet/rbi/gems/thor@1.4.0.rbi +0 -4399
  112. data/sorbet/rbi/gems/tokenizers@0.5.5.rbi +0 -754
  113. data/sorbet/rbi/gems/traces@0.17.0.rbi +0 -9
  114. data/sorbet/rbi/gems/unicode-display_width@3.1.5.rbi +0 -132
  115. data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +0 -251
  116. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +0 -435
  117. data/sorbet/rbi/gems/yard@0.9.37.rbi +0 -18379
  118. data/sorbet/rbi/gems/zeitwerk@2.7.3.rbi +0 -1429
  119. data/sorbet/tapioca/config.yml +0 -13
  120. data/sorbet/tapioca/require.rb +0 -4
@@ -1,2174 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `ffi` gem.
5
- # Please instead update this file by running `bin/tapioca gem ffi`.
6
-
7
-
8
- # source://ffi//lib/ffi/compat.rb#32
9
- module FFI
10
- private
11
-
12
- def custom_typedefs; end
13
-
14
- class << self
15
- def _async_cb_dispatcher_atfork_child; end
16
-
17
- # Add a definition type to type definitions.
18
- #
19
- # The type definition is local per Ractor.
20
- #
21
- # @param old [Type, DataConverter, Symbol] type definition used by {FFI.find_type}
22
- # @param add [Symbol] new type definition's name to add
23
- # @return [Type]
24
- #
25
- # source://ffi//lib/ffi/types.rb#62
26
- def add_typedef(old, add); end
27
-
28
- # @see FFI::LastError.error
29
- #
30
- # source://ffi//lib/ffi/errno.rb#34
31
- def errno; end
32
-
33
- # @see FFI::LastError.error=
34
- #
35
- # source://ffi//lib/ffi/errno.rb#40
36
- def errno=(error); end
37
-
38
- # Find a type in +type_map+ ({FFI::TypeDefs}, by default) from
39
- # a type objet, a type name (symbol). If +name+ is a {DataConverter},
40
- # a new {Type::Mapped} is created.
41
- #
42
- # @param name [Type, DataConverter, Symbol]
43
- # @param type_map [Hash] if nil, {FFI::TypeDefs} is used
44
- # @return [Type]
45
- #
46
- # source://ffi//lib/ffi/types.rb#76
47
- def find_type(name, type_map = T.unsafe(nil)); end
48
-
49
- # This is for FFI internal use only.
50
- #
51
- # source://ffi//lib/ffi/compat.rb#35
52
- def make_shareable(obj); end
53
-
54
- # Transform a generic library name to a platform library name
55
- #
56
- # @example
57
- # # Linux
58
- # FFI.map_library_name 'c' # -> "libc.so.6"
59
- # FFI.map_library_name 'jpeg' # -> "libjpeg.so"
60
- # # Windows
61
- # FFI.map_library_name 'c' # -> "msvcrt.dll"
62
- # FFI.map_library_name 'jpeg' # -> "jpeg.dll"
63
- # @param lib [String, FFI::LibraryPath] library name or LibraryPath object
64
- # @return [String] library name formatted for current platform
65
- #
66
- # source://ffi//lib/ffi/library.rb#46
67
- def map_library_name(lib); end
68
-
69
- # Get +type+ size, in bytes.
70
- #
71
- # @param type +type+ is an instance of class accepted by {FFI.find_type}
72
- # @return [Integer]
73
- #
74
- # source://ffi//lib/ffi/types.rb#101
75
- def type_size(type); end
76
-
77
- # Add a definition type to type definitions.
78
- #
79
- # The type definition is local per Ractor.
80
- #
81
- # @param old [Type, DataConverter, Symbol] type definition used by {FFI.find_type}
82
- # @param add [Symbol] new type definition's name to add
83
- # @return [Type]
84
- #
85
- # source://ffi//lib/ffi/types.rb#56
86
- def typedef(old, add); end
87
-
88
- private
89
-
90
- # source://ffi//lib/ffi/types.rb#66
91
- def __typedef(old, add); end
92
-
93
- # Truffleruby and JRuby don't support Ractor so far.
94
- # So they don't need separation between builtin and custom types.
95
- def custom_typedefs; end
96
- end
97
- end
98
-
99
- # source://ffi//lib/ffi/abstract_memory.rb#33
100
- class FFI::AbstractMemory
101
- def [](_arg0); end
102
- def __copy_from__(_arg0, _arg1); end
103
- def clear; end
104
- def freeze; end
105
- def get(_arg0, _arg1); end
106
- def get_array_of_char(_arg0, _arg1); end
107
- def get_array_of_double(_arg0, _arg1); end
108
- def get_array_of_float(_arg0, _arg1); end
109
- def get_array_of_float32(_arg0, _arg1); end
110
- def get_array_of_float64(_arg0, _arg1); end
111
- def get_array_of_int(_arg0, _arg1); end
112
- def get_array_of_int16(_arg0, _arg1); end
113
- def get_array_of_int32(_arg0, _arg1); end
114
- def get_array_of_int64(_arg0, _arg1); end
115
- def get_array_of_int8(_arg0, _arg1); end
116
- def get_array_of_long(_arg0, _arg1); end
117
- def get_array_of_long_long(_arg0, _arg1); end
118
- def get_array_of_pointer(_arg0, _arg1); end
119
- def get_array_of_short(_arg0, _arg1); end
120
- def get_array_of_string(*_arg0); end
121
- def get_array_of_uchar(_arg0, _arg1); end
122
- def get_array_of_uint(_arg0, _arg1); end
123
- def get_array_of_uint16(_arg0, _arg1); end
124
- def get_array_of_uint32(_arg0, _arg1); end
125
- def get_array_of_uint64(_arg0, _arg1); end
126
- def get_array_of_uint8(_arg0, _arg1); end
127
- def get_array_of_ulong(_arg0, _arg1); end
128
- def get_array_of_ulong_long(_arg0, _arg1); end
129
- def get_array_of_ushort(_arg0, _arg1); end
130
- def get_bytes(_arg0, _arg1); end
131
- def get_char(_arg0); end
132
- def get_double(_arg0); end
133
- def get_float(_arg0); end
134
- def get_float32(_arg0); end
135
- def get_float64(_arg0); end
136
- def get_int(_arg0); end
137
- def get_int16(_arg0); end
138
- def get_int32(_arg0); end
139
- def get_int64(_arg0); end
140
- def get_int8(_arg0); end
141
- def get_long(_arg0); end
142
- def get_long_long(_arg0); end
143
- def get_pointer(_arg0); end
144
- def get_short(_arg0); end
145
- def get_string(*_arg0); end
146
- def get_uchar(_arg0); end
147
- def get_uint(_arg0); end
148
- def get_uint16(_arg0); end
149
- def get_uint32(_arg0); end
150
- def get_uint64(_arg0); end
151
- def get_uint8(_arg0); end
152
- def get_ulong(_arg0); end
153
- def get_ulong_long(_arg0); end
154
- def get_ushort(_arg0); end
155
- def put(_arg0, _arg1, _arg2); end
156
- def put_array_of_char(_arg0, _arg1); end
157
- def put_array_of_double(_arg0, _arg1); end
158
- def put_array_of_float(_arg0, _arg1); end
159
- def put_array_of_float32(_arg0, _arg1); end
160
- def put_array_of_float64(_arg0, _arg1); end
161
- def put_array_of_int(_arg0, _arg1); end
162
- def put_array_of_int16(_arg0, _arg1); end
163
- def put_array_of_int32(_arg0, _arg1); end
164
- def put_array_of_int64(_arg0, _arg1); end
165
- def put_array_of_int8(_arg0, _arg1); end
166
- def put_array_of_long(_arg0, _arg1); end
167
- def put_array_of_long_long(_arg0, _arg1); end
168
- def put_array_of_pointer(_arg0, _arg1); end
169
- def put_array_of_short(_arg0, _arg1); end
170
- def put_array_of_uchar(_arg0, _arg1); end
171
- def put_array_of_uint(_arg0, _arg1); end
172
- def put_array_of_uint16(_arg0, _arg1); end
173
- def put_array_of_uint32(_arg0, _arg1); end
174
- def put_array_of_uint64(_arg0, _arg1); end
175
- def put_array_of_uint8(_arg0, _arg1); end
176
- def put_array_of_ulong(_arg0, _arg1); end
177
- def put_array_of_ulong_long(_arg0, _arg1); end
178
- def put_array_of_ushort(_arg0, _arg1); end
179
- def put_bytes(*_arg0); end
180
- def put_char(_arg0, _arg1); end
181
- def put_double(_arg0, _arg1); end
182
- def put_float(_arg0, _arg1); end
183
- def put_float32(_arg0, _arg1); end
184
- def put_float64(_arg0, _arg1); end
185
- def put_int(_arg0, _arg1); end
186
- def put_int16(_arg0, _arg1); end
187
- def put_int32(_arg0, _arg1); end
188
- def put_int64(_arg0, _arg1); end
189
- def put_int8(_arg0, _arg1); end
190
- def put_long(_arg0, _arg1); end
191
- def put_long_long(_arg0, _arg1); end
192
- def put_pointer(_arg0, _arg1); end
193
- def put_short(_arg0, _arg1); end
194
- def put_string(_arg0, _arg1); end
195
- def put_uchar(_arg0, _arg1); end
196
- def put_uint(_arg0, _arg1); end
197
- def put_uint16(_arg0, _arg1); end
198
- def put_uint32(_arg0, _arg1); end
199
- def put_uint64(_arg0, _arg1); end
200
- def put_uint8(_arg0, _arg1); end
201
- def put_ulong(_arg0, _arg1); end
202
- def put_ulong_long(_arg0, _arg1); end
203
- def put_ushort(_arg0, _arg1); end
204
- def read_array_of_char(_arg0); end
205
- def read_array_of_double(_arg0); end
206
- def read_array_of_float(_arg0); end
207
- def read_array_of_int(_arg0); end
208
- def read_array_of_int16(_arg0); end
209
- def read_array_of_int32(_arg0); end
210
- def read_array_of_int64(_arg0); end
211
- def read_array_of_int8(_arg0); end
212
- def read_array_of_long(_arg0); end
213
- def read_array_of_long_long(_arg0); end
214
- def read_array_of_pointer(_arg0); end
215
- def read_array_of_short(_arg0); end
216
- def read_array_of_string(*_arg0); end
217
- def read_array_of_uchar(_arg0); end
218
- def read_array_of_uint(_arg0); end
219
- def read_array_of_uint16(_arg0); end
220
- def read_array_of_uint32(_arg0); end
221
- def read_array_of_uint64(_arg0); end
222
- def read_array_of_uint8(_arg0); end
223
- def read_array_of_ulong(_arg0); end
224
- def read_array_of_ulong_long(_arg0); end
225
- def read_array_of_ushort(_arg0); end
226
- def read_bytes(_arg0); end
227
- def read_char; end
228
- def read_double; end
229
- def read_float; end
230
- def read_int; end
231
- def read_int16; end
232
- def read_int32; end
233
- def read_int64; end
234
- def read_int8; end
235
- def read_long; end
236
- def read_long_long; end
237
- def read_pointer; end
238
- def read_short; end
239
- def read_uchar; end
240
- def read_uint; end
241
- def read_uint16; end
242
- def read_uint32; end
243
- def read_uint64; end
244
- def read_uint8; end
245
- def read_ulong; end
246
- def read_ulong_long; end
247
- def read_ushort; end
248
- def size; end
249
-
250
- # Return +true+ if +self+ has a size limit.
251
- #
252
- # @return [Boolean]
253
- #
254
- # source://ffi//lib/ffi/abstract_memory.rb#40
255
- def size_limit?; end
256
-
257
- def total; end
258
- def type_size; end
259
- def write_array_of_char(_arg0); end
260
- def write_array_of_double(_arg0); end
261
- def write_array_of_float(_arg0); end
262
- def write_array_of_int(_arg0); end
263
- def write_array_of_int16(_arg0); end
264
- def write_array_of_int32(_arg0); end
265
- def write_array_of_int64(_arg0); end
266
- def write_array_of_int8(_arg0); end
267
- def write_array_of_long(_arg0); end
268
- def write_array_of_long_long(_arg0); end
269
- def write_array_of_pointer(_arg0); end
270
- def write_array_of_short(_arg0); end
271
- def write_array_of_uchar(_arg0); end
272
- def write_array_of_uint(_arg0); end
273
- def write_array_of_uint16(_arg0); end
274
- def write_array_of_uint32(_arg0); end
275
- def write_array_of_uint64(_arg0); end
276
- def write_array_of_uint8(_arg0); end
277
- def write_array_of_ulong(_arg0); end
278
- def write_array_of_ulong_long(_arg0); end
279
- def write_array_of_ushort(_arg0); end
280
- def write_bytes(*_arg0); end
281
- def write_char(_arg0); end
282
- def write_double(_arg0); end
283
- def write_float(_arg0); end
284
- def write_int(_arg0); end
285
- def write_int16(_arg0); end
286
- def write_int32(_arg0); end
287
- def write_int64(_arg0); end
288
- def write_int8(_arg0); end
289
- def write_long(_arg0); end
290
- def write_long_long(_arg0); end
291
- def write_pointer(_arg0); end
292
- def write_short(_arg0); end
293
- def write_uchar(_arg0); end
294
- def write_uint(_arg0); end
295
- def write_uint16(_arg0); end
296
- def write_uint32(_arg0); end
297
- def write_uint64(_arg0); end
298
- def write_uint8(_arg0); end
299
- def write_ulong(_arg0); end
300
- def write_ulong_long(_arg0); end
301
- def write_ushort(_arg0); end
302
- end
303
-
304
- # source://ffi//lib/ffi/abstract_memory.rb#34
305
- FFI::AbstractMemory::LONG_MAX = T.let(T.unsafe(nil), Integer)
306
-
307
- class FFI::ArrayType < ::FFI::Type
308
- def initialize(_arg0, _arg1); end
309
-
310
- def elem_type; end
311
- def length; end
312
- end
313
-
314
- # source://ffi//lib/ffi/autopointer.rb#33
315
- class FFI::AutoPointer < ::FFI::Pointer
316
- extend ::FFI::DataConverter
317
-
318
- # @note The safest, and therefore preferred, calling
319
- # idiom is to pass a Method as the second parameter. Example usage:
320
- #
321
- # class PointerHelper
322
- # def self.release(pointer)
323
- # ...
324
- # end
325
- # end
326
- #
327
- # p = AutoPointer.new(other_pointer, PointerHelper.method(:release))
328
- #
329
- # The above code will cause PointerHelper#release to be invoked at GC time.
330
- # @note The last calling idiom (only one parameter) is generally only
331
- # going to be useful if you subclass {AutoPointer}, and override
332
- # #release, which by default does nothing.
333
- # @overload initialize
334
- # @overload initialize
335
- # @overload initialize
336
- # @raise [TypeError]
337
- # @return [AutoPointer] a new instance of AutoPointer
338
- #
339
- # source://ffi//lib/ffi/autopointer.rb#70
340
- def initialize(ptr, proc = T.unsafe(nil)); end
341
-
342
- # Set +autorelease+ property. See {Pointer Autorelease section at Pointer}.
343
- #
344
- # @param autorelease [Boolean]
345
- # @raise [FrozenError]
346
- # @return [Boolean] +autorelease+
347
- #
348
- # source://ffi//lib/ffi/autopointer.rb#101
349
- def autorelease=(autorelease); end
350
-
351
- # Get +autorelease+ property. See {Pointer Autorelease section at Pointer}.
352
- #
353
- # @return [Boolean] +autorelease+
354
- #
355
- # source://ffi//lib/ffi/autopointer.rb#108
356
- def autorelease?; end
357
-
358
- # Free the pointer.
359
- #
360
- # @return [nil]
361
- #
362
- # source://ffi//lib/ffi/autopointer.rb#94
363
- def free; end
364
-
365
- class << self
366
- # Create a new AutoPointer.
367
- #
368
- # Override {DataConverter#from_native}.
369
- #
370
- # @overload self.from_native
371
- # @return [AutoPointer]
372
- #
373
- # source://ffi//lib/ffi/autopointer.rb#175
374
- def from_native(val, ctx); end
375
-
376
- # Return native type of AutoPointer.
377
- #
378
- # Override {DataConverter#native_type}.
379
- #
380
- # @raise [RuntimeError] if class does not implement a +#release+ method
381
- # @return [Type::POINTER]
382
- #
383
- # source://ffi//lib/ffi/autopointer.rb#161
384
- def native_type; end
385
- end
386
- end
387
-
388
- # A releaser is an object in charge of release an {AutoPointer}.
389
- #
390
- # @abstract Base class for {AutoPointer}'s releasers.
391
- #
392
- # All subclasses of Releaser should define a +#release(ptr)+ method.
393
- #
394
- # source://ffi//lib/ffi/autopointer.rb#116
395
- class FFI::AutoPointer::Releaser
396
- # A new instance of Releaser.
397
- #
398
- # @param ptr [Pointer]
399
- # @param proc [#call]
400
- # @return [nil]
401
- #
402
- # source://ffi//lib/ffi/autopointer.rb#123
403
- def initialize(ptr, proc); end
404
-
405
- # Returns the value of attribute autorelease.
406
- #
407
- # source://ffi//lib/ffi/autopointer.rb#117
408
- def autorelease; end
409
-
410
- # Sets the attribute autorelease
411
- #
412
- # @param value the value to set the attribute autorelease to.
413
- #
414
- # source://ffi//lib/ffi/autopointer.rb#117
415
- def autorelease=(_arg0); end
416
-
417
- # Release pointer if +autorelease+ is set.
418
- #
419
- # @param args
420
- #
421
- # source://ffi//lib/ffi/autopointer.rb#142
422
- def call(*args); end
423
-
424
- # Free pointer.
425
- #
426
- # @return [nil]
427
- #
428
- # source://ffi//lib/ffi/autopointer.rb#131
429
- def free; end
430
-
431
- # Release +ptr+ by using Proc or Method defined at +ptr+
432
- # {AutoPointer#initialize initialization}.
433
- #
434
- # @param ptr [Pointer]
435
- # @return [nil]
436
- #
437
- # source://ffi//lib/ffi/autopointer.rb#151
438
- def release(ptr); end
439
- end
440
-
441
- # Represents a C enum whose values are power of 2
442
- #
443
- # Contrary to classical enums, bitmask values are usually combined
444
- # when used.
445
- #
446
- # @example
447
- # enum {
448
- # red = (1<<0),
449
- # green = (1<<1),
450
- # blue = (1<<2)
451
- # }
452
- #
453
- # source://ffi//lib/ffi/enum.rb#183
454
- class FFI::Bitmask < ::FFI::Enum
455
- # @overload initialize
456
- # @overload initialize
457
- # @return [Bitmask] a new instance of Bitmask
458
- #
459
- # source://ffi//lib/ffi/enum.rb#192
460
- def initialize(*args); end
461
-
462
- # Get a symbol list or a value from the bitmask
463
- #
464
- # @overload []
465
- # @overload []
466
- # @overload []
467
- # @overload []
468
- # @raise [ArgumentError]
469
- #
470
- # source://ffi//lib/ffi/enum.rb#236
471
- def [](*query); end
472
-
473
- # @param val [Integer]
474
- # @param ctx unused
475
- # @return [Array<Symbol, Integer>] list of symbol names corresponding to val, plus an optional remainder if some bits don't match any constant
476
- #
477
- # source://ffi//lib/ffi/enum.rb#288
478
- def from_native(val, ctx); end
479
-
480
- # Get the native value of a bitmask
481
- #
482
- # @overload to_native
483
- # @overload to_native
484
- #
485
- # source://ffi//lib/ffi/enum.rb#260
486
- def to_native(query, ctx); end
487
- end
488
-
489
- class FFI::Buffer < ::FFI::AbstractMemory
490
- def initialize(*_arg0); end
491
-
492
- def +(_arg0); end
493
- def inspect; end
494
- def length; end
495
- def order(*_arg0); end
496
- def slice(_arg0, _arg1); end
497
-
498
- private
499
-
500
- def initialize_copy(_arg0); end
501
-
502
- class << self
503
- def alloc_in(*_arg0); end
504
- def alloc_inout(*_arg0); end
505
- def alloc_out(*_arg0); end
506
- def new_in(*_arg0); end
507
- def new_inout(*_arg0); end
508
- def new_out(*_arg0); end
509
- end
510
- end
511
-
512
- # source://ffi//lib/ffi/library.rb#34
513
- FFI::CURRENT_PROCESS = T.let(T.unsafe(nil), Object)
514
-
515
- FFI::CallbackInfo = FFI::FunctionType
516
-
517
- # This module is used to extend somes classes and give then a common API.
518
- #
519
- # Most of methods defined here must be overridden.
520
- #
521
- # source://ffi//lib/ffi/data_converter.rb#35
522
- module FFI::DataConverter
523
- # Convert from a native type.
524
- #
525
- # source://ffi//lib/ffi/data_converter.rb#63
526
- def from_native(value, ctx); end
527
-
528
- # Get native type.
529
- #
530
- # @overload native_type
531
- # @overload native_type
532
- #
533
- # source://ffi//lib/ffi/data_converter.rb#45
534
- def native_type(type = T.unsafe(nil)); end
535
-
536
- # Convert to a native type.
537
- #
538
- # source://ffi//lib/ffi/data_converter.rb#58
539
- def to_native(value, ctx); end
540
- end
541
-
542
- # source://ffi//lib/ffi/dynamic_library.rb#32
543
- class FFI::DynamicLibrary
544
- def initialize(_arg0, _arg1); end
545
-
546
- def find_function(_arg0); end
547
- def find_symbol(_arg0); end
548
- def find_variable(_arg0); end
549
- def last_error; end
550
- def name; end
551
-
552
- class << self
553
- def last_error; end
554
- def open(_arg0, _arg1); end
555
-
556
- private
557
-
558
- # source://ffi//lib/ffi/dynamic_library.rb#69
559
- def load_library(name, flags); end
560
-
561
- # source://ffi//lib/ffi/dynamic_library.rb#99
562
- def try_load(libname, flags, errors); end
563
- end
564
- end
565
-
566
- FFI::DynamicLibrary::RTLD_ALL_MASK = T.let(T.unsafe(nil), Integer)
567
- FFI::DynamicLibrary::RTLD_BINDING_MASK = T.let(T.unsafe(nil), Integer)
568
- FFI::DynamicLibrary::RTLD_DEEPBIND = T.let(T.unsafe(nil), Integer)
569
- FFI::DynamicLibrary::RTLD_FIRST = T.let(T.unsafe(nil), Integer)
570
- FFI::DynamicLibrary::RTLD_GLOBAL = T.let(T.unsafe(nil), Integer)
571
- FFI::DynamicLibrary::RTLD_LAZY = T.let(T.unsafe(nil), Integer)
572
- FFI::DynamicLibrary::RTLD_LOCAL = T.let(T.unsafe(nil), Integer)
573
- FFI::DynamicLibrary::RTLD_LOCATION_MASK = T.let(T.unsafe(nil), Integer)
574
- FFI::DynamicLibrary::RTLD_MEMBER = T.let(T.unsafe(nil), Integer)
575
- FFI::DynamicLibrary::RTLD_NODELETE = T.let(T.unsafe(nil), Integer)
576
- FFI::DynamicLibrary::RTLD_NOLOAD = T.let(T.unsafe(nil), Integer)
577
- FFI::DynamicLibrary::RTLD_NOW = T.let(T.unsafe(nil), Integer)
578
-
579
- # source://ffi//lib/ffi/dynamic_library.rb#33
580
- FFI::DynamicLibrary::SEARCH_PATH = T.let(T.unsafe(nil), Array)
581
-
582
- # source://ffi//lib/ffi/dynamic_library.rb#67
583
- FFI::DynamicLibrary::SEARCH_PATH_MESSAGE = T.let(T.unsafe(nil), String)
584
-
585
- class FFI::DynamicLibrary::Symbol < ::FFI::Pointer
586
- def inspect; end
587
-
588
- private
589
-
590
- def initialize_copy(_arg0); end
591
- end
592
-
593
- # Represents a C enum.
594
- #
595
- # For a C enum:
596
- # enum fruits {
597
- # apple,
598
- # banana,
599
- # orange,
600
- # pineapple
601
- # };
602
- # are defined this vocabulary:
603
- # * a _symbol_ is a word from the enumeration (ie. _apple_, by example);
604
- # * a _value_ is the value of a symbol in the enumeration (by example, apple has value _0_ and banana _1_).
605
- #
606
- # source://ffi//lib/ffi/enum.rb#83
607
- class FFI::Enum
608
- include ::FFI::DataConverter
609
-
610
- # @overload initialize
611
- # @overload initialize
612
- # @return [Enum] a new instance of Enum
613
- #
614
- # source://ffi//lib/ffi/enum.rb#96
615
- def initialize(*args); end
616
-
617
- # Get a symbol or a value from the enum.
618
- #
619
- # @overload []
620
- # @overload []
621
- #
622
- # source://ffi//lib/ffi/enum.rb#133
623
- def [](query); end
624
-
625
- # Get a symbol or a value from the enum.
626
- #
627
- # @overload []
628
- # @overload []
629
- #
630
- # source://ffi//lib/ffi/enum.rb#133
631
- def find(query); end
632
-
633
- # @param val
634
- # @return symbol name if it exists for +val+.
635
- #
636
- # source://ffi//lib/ffi/enum.rb#167
637
- def from_native(val, ctx); end
638
-
639
- # Returns the value of attribute native_type.
640
- #
641
- # source://ffi//lib/ffi/enum.rb#87
642
- def native_type; end
643
-
644
- # Get the symbol map.
645
- #
646
- # @return [Hash]
647
- #
648
- # source://ffi//lib/ffi/enum.rb#145
649
- def symbol_map; end
650
-
651
- # @return [Array] enum symbol names
652
- #
653
- # source://ffi//lib/ffi/enum.rb#120
654
- def symbols; end
655
-
656
- # Returns the value of attribute tag.
657
- #
658
- # source://ffi//lib/ffi/enum.rb#86
659
- def tag; end
660
-
661
- # Get the symbol map.
662
- #
663
- # @return [Hash]
664
- #
665
- # source://ffi//lib/ffi/enum.rb#145
666
- def to_h; end
667
-
668
- # Get the symbol map.
669
- #
670
- # @return [Hash]
671
- #
672
- # source://ffi//lib/ffi/enum.rb#145
673
- def to_hash; end
674
-
675
- # @param val [Symbol, Integer, #to_int]
676
- # @param ctx unused
677
- # @return [Integer] value of a enum symbol
678
- #
679
- # source://ffi//lib/ffi/enum.rb#155
680
- def to_native(val, ctx); end
681
- end
682
-
683
- # An instance of this class permits to manage {Enum}s. In fact, Enums is a collection of {Enum}s.
684
- #
685
- # source://ffi//lib/ffi/enum.rb#36
686
- class FFI::Enums
687
- # @return [Enums] a new instance of Enums
688
- #
689
- # source://ffi//lib/ffi/enum.rb#38
690
- def initialize; end
691
-
692
- # Add an {Enum} to the collection.
693
- #
694
- # @param enum [Enum]
695
- #
696
- # source://ffi//lib/ffi/enum.rb#46
697
- def <<(enum); end
698
-
699
- # @param symbol a symbol to find in merge symbol maps of all enums.
700
- # @return a symbol
701
- #
702
- # source://ffi//lib/ffi/enum.rb#65
703
- def __map_symbol(symbol); end
704
-
705
- # Find a {Enum} in collection.
706
- #
707
- # @param query enum tag or part of an enum name
708
- # @return [Enum]
709
- #
710
- # source://ffi//lib/ffi/enum.rb#55
711
- def find(query); end
712
- end
713
-
714
- # source://ffi//lib/ffi/function.rb#32
715
- class FFI::Function < ::FFI::Pointer
716
- include ::FFI::Function::RegisterAttach
717
-
718
- def initialize(*_arg0); end
719
-
720
- # source://ffi//lib/ffi/function.rb#57
721
- def attach(mod, name); end
722
-
723
- def autorelease; end
724
- def autorelease=(_arg0); end
725
- def autorelease?; end
726
- def call(*_arg0); end
727
- def free; end
728
-
729
- # Retrieve Array of parameter types
730
- #
731
- # This method returns an Array of FFI types accepted as function parameters.
732
- #
733
- # @return [Array<FFI::Type>]
734
- #
735
- # source://ffi//lib/ffi/function.rb#49
736
- def param_types; end
737
-
738
- # Retrieve the return type of the function
739
- #
740
- # This method returns FFI type returned by the function.
741
- #
742
- # @return [FFI::Type]
743
- #
744
- # source://ffi//lib/ffi/function.rb#40
745
- def return_type; end
746
-
747
- private
748
-
749
- def initialize_copy(_arg0); end
750
- def type; end
751
- end
752
-
753
- # Stash the Function in a module variable so it can be inspected by attached_functions.
754
- # On CRuby it also ensures that it does not get garbage collected.
755
- #
756
- # source://ffi//lib/ffi/function.rb#56
757
- module FFI::Function::RegisterAttach
758
- # source://ffi//lib/ffi/function.rb#57
759
- def attach(mod, name); end
760
- end
761
-
762
- FFI::FunctionInfo = FFI::FunctionType
763
-
764
- class FFI::FunctionType < ::FFI::Type
765
- def initialize(*_arg0); end
766
-
767
- def param_types; end
768
- def return_type; end
769
- end
770
-
771
- # This module implements a couple of class methods to play with IO.
772
- #
773
- # source://ffi//lib/ffi/io.rb#34
774
- module FFI::IO
775
- class << self
776
- # Synonym for IO::for_fd.
777
- #
778
- # @param fd [Integer] file decriptor
779
- # @param mode [String] mode string
780
- # @return [::IO]
781
- #
782
- # source://ffi//lib/ffi/io.rb#39
783
- def for_fd(fd, mode = T.unsafe(nil)); end
784
-
785
- # A version of IO#read that reads data from an IO and put then into a native buffer.
786
- #
787
- # This will be optimized at some future time to eliminate the double copy.
788
- #
789
- # @param io [#read] io to read from
790
- # @param buf [AbstractMemory] destination for data read from +io+
791
- # @param len [nil, Integer] maximul number of bytes to read from +io+. If +nil+,
792
- # read until end of file.
793
- # @return [Integer] length really read, in bytes
794
- #
795
- # source://ffi//lib/ffi/io.rb#53
796
- def native_read(io, buf, len); end
797
- end
798
- end
799
-
800
- module FFI::LastError
801
- private
802
-
803
- def error; end
804
- def error=(_arg0); end
805
-
806
- class << self
807
- def error; end
808
- def error=(_arg0); end
809
- end
810
- end
811
-
812
- # source://ffi//lib/ffi/ffi.rb#63
813
- module FFI::LegacyForkTracking; end
814
-
815
- # source://ffi//lib/ffi/ffi.rb#84
816
- module FFI::LegacyForkTracking::IOExt
817
- # source://ffi//lib/ffi/ffi.rb#85
818
- def popen(*args); end
819
- end
820
-
821
- # source://ffi//lib/ffi/ffi.rb#64
822
- module FFI::LegacyForkTracking::KernelExt
823
- # source://ffi//lib/ffi/ffi.rb#65
824
- def fork; end
825
- end
826
-
827
- # source://ffi//lib/ffi/ffi.rb#79
828
- module FFI::LegacyForkTracking::KernelExtPrivate
829
- include ::FFI::LegacyForkTracking::KernelExt
830
-
831
- private
832
-
833
- # source://ffi//lib/ffi/ffi.rb#65
834
- def fork; end
835
- end
836
-
837
- # This module is the base to use native functions.
838
- #
839
- # A basic usage may be:
840
- # require 'ffi'
841
- #
842
- # module Hello
843
- # extend FFI::Library
844
- # ffi_lib FFI::Library::LIBC
845
- # attach_function 'puts', [ :string ], :int
846
- # end
847
- #
848
- # Hello.puts("Hello, World")
849
- #
850
- # source://ffi//lib/ffi/library.rb#72
851
- module FFI::Library
852
- # Attach C function +func+ to this module.
853
- #
854
- # @option options
855
- # @option options
856
- # @option options
857
- # @option options
858
- # @overload attach_function
859
- # @overload attach_function
860
- # @param name [#to_s] name of ruby method to attach as
861
- # @param func [#to_s] name of C function to attach
862
- # @param args [Array<Symbol>] an array of types
863
- # @param returns [Symbol] type of return value
864
- # @param options [Hash] a customizable set of options
865
- # @raise [FFI::NotFoundError] if +func+ cannot be found in the attached libraries (see {#ffi_lib})
866
- # @return [FFI::VariadicInvoker]
867
- #
868
- # source://ffi//lib/ffi/library.rb#177
869
- def attach_function(name, func, args, returns = T.unsafe(nil), options = T.unsafe(nil)); end
870
-
871
- # Attach C variable +cname+ to this module.
872
- #
873
- # @overload attach_variable
874
- # @overload attach_variable
875
- # @raise [FFI::NotFoundError] if +cname+ cannot be found in libraries
876
- # @return [DynamicLibrary::Symbol]
877
- #
878
- # source://ffi//lib/ffi/library.rb#274
879
- def attach_variable(mname, a1, a2 = T.unsafe(nil)); end
880
-
881
- # Retrieve all attached functions and their function signature
882
- #
883
- # This method returns a Hash of method names of attached functions connected by #attach_function and the corresponding function type.
884
- # The function type responds to #return_type and #param_types which return the FFI types of the function signature.
885
- #
886
- # @return [Hash< Symbol => [FFI::Function, FFI::VariadicInvoker] >]
887
- #
888
- # source://ffi//lib/ffi/library.rb#544
889
- def attached_functions; end
890
-
891
- # Retrieve all attached variables and their type
892
- #
893
- # This method returns a Hash of variable names and the corresponding type or variables connected by #attach_variable .
894
- #
895
- # @return [Hash< Symbol => ffi_type >]
896
- #
897
- # source://ffi//lib/ffi/library.rb#553
898
- def attached_variables; end
899
-
900
- # Create a new FFI::Bitmask
901
- #
902
- # @overload bitmask
903
- # @overload bitmask
904
- # @overload bitmask
905
- # @overload bitmask
906
- # @overload bitmask
907
- # @overload bitmask
908
- # @return [FFI::Bitmask]
909
- #
910
- # source://ffi//lib/ffi/library.rb#520
911
- def bitmask(*args); end
912
-
913
- # @overload callback
914
- # @overload callback
915
- # @raise [ArgumentError]
916
- # @return [FFI::CallbackInfo]
917
- #
918
- # source://ffi//lib/ffi/library.rb#330
919
- def callback(*args); end
920
-
921
- # Create a new {FFI::Enum}.
922
- #
923
- # @overload enum
924
- # @overload enum
925
- # @overload enum
926
- # @overload enum
927
- # @overload enum
928
- # @overload enum
929
- # @return [FFI::Enum]
930
- #
931
- # source://ffi//lib/ffi/library.rb#477
932
- def enum(*args); end
933
-
934
- # Find an enum by name.
935
- #
936
- # @param name
937
- # @return [FFI::Enum]
938
- #
939
- # source://ffi//lib/ffi/library.rb#527
940
- def enum_type(name); end
941
-
942
- # Find an enum by a symbol it contains.
943
- #
944
- # @param symbol
945
- # @return [FFI::Enum]
946
- #
947
- # source://ffi//lib/ffi/library.rb#534
948
- def enum_value(symbol); end
949
-
950
- # Set the calling convention for {#attach_function} and {#callback}
951
- #
952
- # @note +:stdcall+ is typically used for attaching Windows API functions
953
- # @param convention [Symbol] one of +:default+, +:stdcall+
954
- # @return [Symbol] the new calling convention
955
- # @see http://en.wikipedia.org/wiki/Stdcall#stdcall
956
- #
957
- # source://ffi//lib/ffi/library.rb#106
958
- def ffi_convention(convention = T.unsafe(nil)); end
959
-
960
- # Load native libraries.
961
- #
962
- # @param names [Array] names of libraries to load
963
- # @raise [LoadError] if a library cannot be opened
964
- # @return [Array<DynamicLibrary>]
965
- #
966
- # source://ffi//lib/ffi/library.rb#89
967
- def ffi_lib(*names); end
968
-
969
- # Sets library flags for {#ffi_lib}.
970
- #
971
- # @example
972
- # ffi_lib_flags(:lazy, :local) # => 5
973
- # @param flags [Symbol, …] (see {FlagsMap})
974
- # @return [Integer] the new value
975
- #
976
- # source://ffi//lib/ffi/library.rb#139
977
- def ffi_lib_flags(*flags); end
978
-
979
- # Get FFI libraries loaded using {#ffi_lib}.
980
- #
981
- # @raise [LoadError] if no libraries have been loaded (using {#ffi_lib})
982
- # @return [Array<FFI::DynamicLibrary>] array of currently loaded FFI libraries
983
- # @see #ffi_lib
984
- #
985
- # source://ffi//lib/ffi/library.rb#116
986
- def ffi_libraries; end
987
-
988
- # Find a type definition.
989
- #
990
- # @param t [DataConverter, Type, Struct, Symbol] type to find
991
- # @return [Type]
992
- #
993
- # source://ffi//lib/ffi/library.rb#401
994
- def find_type(t); end
995
-
996
- # Freeze all definitions of the module
997
- #
998
- # This freezes the module's definitions, so that it can be used in a Ractor.
999
- # No further methods or variables can be attached and no further enums or typedefs can be created in this module afterwards.
1000
- #
1001
- # source://ffi//lib/ffi/library.rb#568
1002
- def freeze; end
1003
-
1004
- # This function returns a list of possible names to lookup.
1005
- #
1006
- # @note Function names on windows may be decorated if they are using stdcall. See
1007
- # * http://en.wikipedia.org/wiki/Name_mangling#C_name_decoration_in_Microsoft_Windows
1008
- # * http://msdn.microsoft.com/en-us/library/zxk0tw93%28v=VS.100%29.aspx
1009
- # * http://en.wikibooks.org/wiki/X86_Disassembly/Calling_Conventions#STDCALL
1010
- # Note that decorated names can be overridden via def files. Also note that the
1011
- # windows api, although using, doesn't have decorated names.
1012
- # @param name [#to_s] function name
1013
- # @param arg_types [Array] function's argument types
1014
- # @return [Array<String>]
1015
- #
1016
- # source://ffi//lib/ffi/library.rb#232
1017
- def function_names(name, arg_types); end
1018
-
1019
- # Register or get an already registered type definition.
1020
- #
1021
- # To register a new type definition, +old+ should be a {FFI::Type}. +add+
1022
- # is in this case the type definition.
1023
- #
1024
- # If +old+ is a {DataConverter}, a {Type::Mapped} is returned.
1025
- #
1026
- # If +old+ is +:enum+
1027
- # * and +add+ is an +Array+, a call to {#enum} is made with +add+ as single parameter;
1028
- # * in others cases, +info+ is used to create a named enum.
1029
- #
1030
- # If +old+ is a key for type map, #typedef get +old+ type definition.
1031
- #
1032
- # @param old [DataConverter, Symbol, Type]
1033
- # @param add [Symbol]
1034
- # @param info [Symbol]
1035
- # @return [FFI::Enum, FFI::Type]
1036
- #
1037
- # source://ffi//lib/ffi/library.rb#374
1038
- def typedef(old, add, info = T.unsafe(nil)); end
1039
-
1040
- private
1041
-
1042
- # Generic enum builder
1043
- # @param [Class] klass can be one of FFI::Enum or FFI::Bitmask
1044
- # @param args (see #enum or #bitmask)
1045
- #
1046
- # source://ffi//lib/ffi/library.rb#422
1047
- def generic_enum(klass, *args); end
1048
-
1049
- class << self
1050
- # Test if extended object is a Module. If not, raise RuntimeError.
1051
- #
1052
- # @param mod extended object
1053
- # @raise [RuntimeError] if +mod+ is not a Module
1054
- # @return [nil]
1055
- #
1056
- # source://ffi//lib/ffi/library.rb#80
1057
- def extended(mod); end
1058
- end
1059
- end
1060
-
1061
- # source://ffi//lib/ffi/library.rb#73
1062
- FFI::Library::CURRENT_PROCESS = T.let(T.unsafe(nil), Object)
1063
-
1064
- # Flags used in {#ffi_lib}.
1065
- #
1066
- # This map allows you to supply symbols to {#ffi_lib_flags} instead of
1067
- # the actual constants.
1068
- #
1069
- # source://ffi//lib/ffi/library.rb#125
1070
- FFI::Library::FlagsMap = T.let(T.unsafe(nil), Hash)
1071
-
1072
- # source://ffi//lib/ffi/library.rb#74
1073
- FFI::Library::LIBC = T.let(T.unsafe(nil), String)
1074
-
1075
- # Transform a generic library name and ABI number to a platform library name
1076
- #
1077
- # Example:
1078
- # module LibVips
1079
- # extend FFI::Library
1080
- # ffi_lib LibraryPath.new("vips", abi_number: 42)
1081
- # end
1082
- #
1083
- # This translates to the following library file names:
1084
- # libvips-42.dll on Windows
1085
- # libvips.so.42 on Linux
1086
- # libvips.42.dylib on Macos
1087
- #
1088
- # See https://packaging.ubuntu.com/html/libraries.html for more information about library naming.
1089
- #
1090
- # source://ffi//lib/ffi/library_path.rb#46
1091
- class FFI::LibraryPath
1092
- # Build a new library path
1093
- #
1094
- # * <tt>name</tt> : The name of the library without file prefix or suffix.
1095
- # * <tt>abi_number</tt> : The ABI number of the library.
1096
- # * <tt>root</tt> : An optional base path prepended to the library name.
1097
- #
1098
- # @return [LibraryPath] a new instance of LibraryPath
1099
- #
1100
- # source://ffi//lib/ffi/library_path.rb#56
1101
- def initialize(name, abi_number: T.unsafe(nil), root: T.unsafe(nil)); end
1102
-
1103
- # Returns the value of attribute abi_number.
1104
- #
1105
- # source://ffi//lib/ffi/library_path.rb#48
1106
- def abi_number; end
1107
-
1108
- # source://ffi//lib/ffi/library_path.rb#78
1109
- def full_name; end
1110
-
1111
- # Returns the value of attribute name.
1112
- #
1113
- # source://ffi//lib/ffi/library_path.rb#47
1114
- def name; end
1115
-
1116
- # Returns the value of attribute root.
1117
- #
1118
- # source://ffi//lib/ffi/library_path.rb#49
1119
- def root; end
1120
-
1121
- # source://ffi//lib/ffi/library_path.rb#100
1122
- def to_s; end
1123
-
1124
- class << self
1125
- # source://ffi//lib/ffi/library_path.rb#62
1126
- def wrap(value); end
1127
- end
1128
- end
1129
-
1130
- # FFI::ManagedStruct allows custom garbage-collection of your FFI::Structs.
1131
- #
1132
- # The typical use case would be when interacting with a library
1133
- # that has a nontrivial memory management design, such as a linked
1134
- # list or a binary tree.
1135
- #
1136
- # When the {Struct} instance is garbage collected, FFI::ManagedStruct will
1137
- # invoke the class's release() method during object finalization.
1138
- #
1139
- # @example Example usage:
1140
- # module MyLibrary
1141
- # ffi_lib "libmylibrary"
1142
- # attach_function :new_dlist, [], :pointer
1143
- # attach_function :destroy_dlist, [:pointer], :void
1144
- # end
1145
- #
1146
- # class DoublyLinkedList < FFI::ManagedStruct
1147
- # @@@
1148
- # struct do |s|
1149
- # s.name 'struct dlist'
1150
- # s.include 'dlist.h'
1151
- # s.field :head, :pointer
1152
- # s.field :tail, :pointer
1153
- # end
1154
- # @@@
1155
- #
1156
- # def self.release ptr
1157
- # MyLibrary.destroy_dlist(ptr)
1158
- # end
1159
- # end
1160
- #
1161
- # begin
1162
- # ptr = DoublyLinkedList.new(MyLibrary.new_dlist)
1163
- # # do something with the list
1164
- # end
1165
- # # struct is out of scope, and will be GC'd using DoublyLinkedList#release
1166
- #
1167
- # source://ffi//lib/ffi/managedstruct.rb#70
1168
- class FFI::ManagedStruct < ::FFI::Struct
1169
- # A new instance of FFI::ManagedStruct.
1170
- #
1171
- # @overload initialize
1172
- # @overload initialize
1173
- # @raise [NoMethodError]
1174
- # @return [ManagedStruct] a new instance of ManagedStruct
1175
- #
1176
- # source://ffi//lib/ffi/managedstruct.rb#77
1177
- def initialize(pointer = T.unsafe(nil)); end
1178
- end
1179
-
1180
- class FFI::MemoryPointer < ::FFI::Pointer
1181
- def initialize(*_arg0); end
1182
-
1183
- class << self
1184
- def from_string(_arg0); end
1185
- end
1186
- end
1187
-
1188
- # source://ffi//lib/ffi/ffi.rb#53
1189
- module FFI::ModernForkTracking
1190
- # source://ffi//lib/ffi/ffi.rb#54
1191
- def _fork; end
1192
- end
1193
-
1194
- FFI::NativeLibrary = FFI::DynamicLibrary
1195
- module FFI::NativeType; end
1196
- FFI::NativeType::BOOL = T.let(T.unsafe(nil), FFI::Type::Builtin)
1197
- FFI::NativeType::BUFFER_IN = T.let(T.unsafe(nil), FFI::Type::Builtin)
1198
- FFI::NativeType::BUFFER_INOUT = T.let(T.unsafe(nil), FFI::Type::Builtin)
1199
- FFI::NativeType::BUFFER_OUT = T.let(T.unsafe(nil), FFI::Type::Builtin)
1200
- FFI::NativeType::FLOAT32 = T.let(T.unsafe(nil), FFI::Type::Builtin)
1201
- FFI::NativeType::FLOAT64 = T.let(T.unsafe(nil), FFI::Type::Builtin)
1202
- FFI::NativeType::INT16 = T.let(T.unsafe(nil), FFI::Type::Builtin)
1203
- FFI::NativeType::INT32 = T.let(T.unsafe(nil), FFI::Type::Builtin)
1204
- FFI::NativeType::INT64 = T.let(T.unsafe(nil), FFI::Type::Builtin)
1205
- FFI::NativeType::INT8 = T.let(T.unsafe(nil), FFI::Type::Builtin)
1206
- FFI::NativeType::LONG = T.let(T.unsafe(nil), FFI::Type::Builtin)
1207
- FFI::NativeType::LONGDOUBLE = T.let(T.unsafe(nil), FFI::Type::Builtin)
1208
- FFI::NativeType::POINTER = T.let(T.unsafe(nil), FFI::Type::Builtin)
1209
- FFI::NativeType::STRING = T.let(T.unsafe(nil), FFI::Type::Builtin)
1210
- FFI::NativeType::UINT16 = T.let(T.unsafe(nil), FFI::Type::Builtin)
1211
- FFI::NativeType::UINT32 = T.let(T.unsafe(nil), FFI::Type::Builtin)
1212
- FFI::NativeType::UINT64 = T.let(T.unsafe(nil), FFI::Type::Builtin)
1213
- FFI::NativeType::UINT8 = T.let(T.unsafe(nil), FFI::Type::Builtin)
1214
- FFI::NativeType::ULONG = T.let(T.unsafe(nil), FFI::Type::Builtin)
1215
- FFI::NativeType::VARARGS = T.let(T.unsafe(nil), FFI::Type::Builtin)
1216
- FFI::NativeType::VOID = T.let(T.unsafe(nil), FFI::Type::Builtin)
1217
-
1218
- # Exception raised when a function is not found in libraries
1219
- #
1220
- # source://ffi//lib/ffi/library.rb#52
1221
- class FFI::NotFoundError < ::LoadError
1222
- # @return [NotFoundError] a new instance of NotFoundError
1223
- #
1224
- # source://ffi//lib/ffi/library.rb#53
1225
- def initialize(function, *libraries); end
1226
- end
1227
-
1228
- class FFI::NullPointerError < ::RuntimeError; end
1229
-
1230
- # This module defines different constants and class methods to play with
1231
- # various platforms.
1232
- #
1233
- # source://ffi//lib/ffi/platform.rb#39
1234
- module FFI::Platform
1235
- class << self
1236
- # Test if current OS is a *BSD (include MAC)
1237
- #
1238
- # @return [Boolean]
1239
- #
1240
- # source://ffi//lib/ffi/platform.rb#158
1241
- def bsd?; end
1242
-
1243
- # Test if current OS is +os+.
1244
- #
1245
- # @param os [String]
1246
- # @return [Boolean]
1247
- #
1248
- # source://ffi//lib/ffi/platform.rb#92
1249
- def is_os(os); end
1250
-
1251
- # Test if current OS is Mac OS
1252
- #
1253
- # @return [Boolean]
1254
- #
1255
- # source://ffi//lib/ffi/platform.rb#170
1256
- def mac?; end
1257
-
1258
- # Test if current OS is Solaris (Sun OS)
1259
- #
1260
- # @return [Boolean]
1261
- #
1262
- # source://ffi//lib/ffi/platform.rb#176
1263
- def solaris?; end
1264
-
1265
- # Test if current OS is a unix OS
1266
- #
1267
- # @return [Boolean]
1268
- #
1269
- # source://ffi//lib/ffi/platform.rb#182
1270
- def unix?; end
1271
-
1272
- # Test if current OS is Windows
1273
- #
1274
- # @return [Boolean]
1275
- #
1276
- # source://ffi//lib/ffi/platform.rb#164
1277
- def windows?; end
1278
- end
1279
- end
1280
-
1281
- FFI::Platform::ADDRESS_ALIGN = T.let(T.unsafe(nil), Integer)
1282
- FFI::Platform::ADDRESS_SIZE = T.let(T.unsafe(nil), Integer)
1283
-
1284
- # source://ffi//lib/ffi/platform.rb#65
1285
- FFI::Platform::ARCH = T.let(T.unsafe(nil), String)
1286
-
1287
- FFI::Platform::BIG_ENDIAN = T.let(T.unsafe(nil), Integer)
1288
- FFI::Platform::BYTE_ORDER = T.let(T.unsafe(nil), Integer)
1289
-
1290
- # source://ffi//lib/ffi/platform.rb#111
1291
- FFI::Platform::CONF_DIR = T.let(T.unsafe(nil), String)
1292
-
1293
- # source://ffi//lib/ffi/platform.rb#63
1294
- FFI::Platform::CPU = T.let(T.unsafe(nil), String)
1295
-
1296
- FFI::Platform::DOUBLE_ALIGN = T.let(T.unsafe(nil), Integer)
1297
- FFI::Platform::DOUBLE_SIZE = T.let(T.unsafe(nil), Integer)
1298
- FFI::Platform::FLOAT_ALIGN = T.let(T.unsafe(nil), Integer)
1299
- FFI::Platform::FLOAT_SIZE = T.let(T.unsafe(nil), Integer)
1300
- FFI::Platform::INT16_ALIGN = T.let(T.unsafe(nil), Integer)
1301
- FFI::Platform::INT16_SIZE = T.let(T.unsafe(nil), Integer)
1302
- FFI::Platform::INT32_ALIGN = T.let(T.unsafe(nil), Integer)
1303
- FFI::Platform::INT32_SIZE = T.let(T.unsafe(nil), Integer)
1304
- FFI::Platform::INT64_ALIGN = T.let(T.unsafe(nil), Integer)
1305
- FFI::Platform::INT64_SIZE = T.let(T.unsafe(nil), Integer)
1306
- FFI::Platform::INT8_ALIGN = T.let(T.unsafe(nil), Integer)
1307
- FFI::Platform::INT8_SIZE = T.let(T.unsafe(nil), Integer)
1308
-
1309
- # source://ffi//lib/ffi/platform.rb#105
1310
- FFI::Platform::IS_BSD = T.let(T.unsafe(nil), TrueClass)
1311
-
1312
- # source://ffi//lib/ffi/platform.rb#102
1313
- FFI::Platform::IS_DRAGONFLYBSD = T.let(T.unsafe(nil), FalseClass)
1314
-
1315
- # source://ffi//lib/ffi/platform.rb#99
1316
- FFI::Platform::IS_FREEBSD = T.let(T.unsafe(nil), FalseClass)
1317
-
1318
- # source://ffi//lib/ffi/platform.rb#96
1319
- FFI::Platform::IS_GNU = T.let(T.unsafe(nil), T.untyped)
1320
-
1321
- # source://ffi//lib/ffi/platform.rb#97
1322
- FFI::Platform::IS_LINUX = T.let(T.unsafe(nil), FalseClass)
1323
-
1324
- # source://ffi//lib/ffi/platform.rb#98
1325
- FFI::Platform::IS_MAC = T.let(T.unsafe(nil), TrueClass)
1326
-
1327
- # source://ffi//lib/ffi/platform.rb#100
1328
- FFI::Platform::IS_NETBSD = T.let(T.unsafe(nil), FalseClass)
1329
-
1330
- # source://ffi//lib/ffi/platform.rb#101
1331
- FFI::Platform::IS_OPENBSD = T.let(T.unsafe(nil), FalseClass)
1332
-
1333
- # source://ffi//lib/ffi/platform.rb#103
1334
- FFI::Platform::IS_SOLARIS = T.let(T.unsafe(nil), FalseClass)
1335
-
1336
- # source://ffi//lib/ffi/platform.rb#104
1337
- FFI::Platform::IS_WINDOWS = T.let(T.unsafe(nil), FalseClass)
1338
-
1339
- # source://ffi//lib/ffi/platform.rb#136
1340
- FFI::Platform::LIBC = T.let(T.unsafe(nil), String)
1341
-
1342
- # source://ffi//lib/ffi/platform.rb#115
1343
- FFI::Platform::LIBPREFIX = T.let(T.unsafe(nil), String)
1344
-
1345
- # source://ffi//lib/ffi/platform.rb#124
1346
- FFI::Platform::LIBSUFFIX = T.let(T.unsafe(nil), String)
1347
-
1348
- FFI::Platform::LITTLE_ENDIAN = T.let(T.unsafe(nil), Integer)
1349
- FFI::Platform::LONG_ALIGN = T.let(T.unsafe(nil), Integer)
1350
- FFI::Platform::LONG_DOUBLE_ALIGN = T.let(T.unsafe(nil), Integer)
1351
- FFI::Platform::LONG_DOUBLE_SIZE = T.let(T.unsafe(nil), Integer)
1352
- FFI::Platform::LONG_SIZE = T.let(T.unsafe(nil), Integer)
1353
-
1354
- # 64-bit inodes
1355
- #
1356
- # source://ffi//lib/ffi/platform.rb#110
1357
- FFI::Platform::NAME = T.let(T.unsafe(nil), String)
1358
-
1359
- # source://ffi//lib/ffi/platform.rb#40
1360
- FFI::Platform::OS = T.let(T.unsafe(nil), String)
1361
-
1362
- # source://ffi//lib/ffi/platform.rb#61
1363
- FFI::Platform::OSVERSION = T.let(T.unsafe(nil), Integer)
1364
-
1365
- # source://ffi//lib/ffi/platform.rb#35
1366
- class FFI::PlatformError < ::LoadError; end
1367
-
1368
- # source://ffi//lib/ffi/pointer.rb#42
1369
- class FFI::Pointer < ::FFI::AbstractMemory
1370
- def initialize(*_arg0); end
1371
-
1372
- def +(_arg0); end
1373
- def ==(_arg0); end
1374
- def address; end
1375
- def autorelease=(_arg0); end
1376
- def autorelease?; end
1377
- def free; end
1378
- def inspect; end
1379
- def null?; end
1380
- def order(*_arg0); end
1381
-
1382
- # Read pointer's contents as +type+
1383
- #
1384
- # Same as:
1385
- # ptr.get(type, 0)
1386
- #
1387
- # @param type [Symbol, Type] of data to read
1388
- # @return [Object]
1389
- #
1390
- # source://ffi//lib/ffi/pointer.rb#152
1391
- def read(type); end
1392
-
1393
- # Read an array of +type+ of length +length+.
1394
- #
1395
- # @example
1396
- # ptr.read_array_of_type(TYPE_UINT8, :read_uint8, 4) # -> [1, 2, 3, 4]
1397
- # @param type [Type] type of data to read from pointer's contents
1398
- # @param reader [Symbol] method to send to +self+ to read +type+
1399
- # @param length [Integer]
1400
- # @return [Array]
1401
- #
1402
- # source://ffi//lib/ffi/pointer.rb#114
1403
- def read_array_of_type(type, reader, length); end
1404
-
1405
- # Read pointer's contents as a string, or the first +len+ bytes of the
1406
- # equivalent string if +len+ is not +nil+.
1407
- #
1408
- # @param len [nil, Integer] length of string to return
1409
- # @return [String]
1410
- #
1411
- # source://ffi//lib/ffi/pointer.rb#57
1412
- def read_string(len = T.unsafe(nil)); end
1413
-
1414
- # Read the first +len+ bytes of pointer's contents as a string.
1415
- #
1416
- # Same as:
1417
- # ptr.read_string(len) # with len not nil
1418
- #
1419
- # @param len [Integer] length of string to return
1420
- # @return [String]
1421
- #
1422
- # source://ffi//lib/ffi/pointer.rb#72
1423
- def read_string_length(len); end
1424
-
1425
- # Read pointer's contents as a string.
1426
- #
1427
- # Same as:
1428
- # ptr.read_string # with no len
1429
- #
1430
- # @return [String]
1431
- #
1432
- # source://ffi//lib/ffi/pointer.rb#81
1433
- def read_string_to_null; end
1434
-
1435
- def slice(_arg0, _arg1); end
1436
- def to_i; end
1437
-
1438
- # @return [self]
1439
- #
1440
- # source://ffi//lib/ffi/pointer.rb#142
1441
- def to_ptr; end
1442
-
1443
- def to_s; end
1444
- def type_size; end
1445
-
1446
- # Write +value+ of type +type+ to pointer's content
1447
- #
1448
- # Same as:
1449
- # ptr.put(type, 0)
1450
- #
1451
- # @param type [Symbol, Type] of data to read
1452
- # @param value [Object] to write
1453
- # @return [nil]
1454
- #
1455
- # source://ffi//lib/ffi/pointer.rb#163
1456
- def write(type, value); end
1457
-
1458
- # Write +ary+ in pointer's contents as +type+.
1459
- #
1460
- # @example
1461
- # ptr.write_array_of_type(TYPE_UINT8, :put_uint8, [1, 2, 3 ,4])
1462
- # @param type [Type] type of data to write to pointer's contents
1463
- # @param writer [Symbol] method to send to +self+ to write +type+
1464
- # @param ary [Array]
1465
- # @return [self]
1466
- #
1467
- # source://ffi//lib/ffi/pointer.rb#132
1468
- def write_array_of_type(type, writer, ary); end
1469
-
1470
- # Write +str+ in pointer's contents, or first +len+ bytes if
1471
- # +len+ is not +nil+.
1472
- #
1473
- # @param str [String] string to write
1474
- # @param len [Integer] length of string to return
1475
- # @return [self]
1476
- #
1477
- # source://ffi//lib/ffi/pointer.rb#101
1478
- def write_string(str, len = T.unsafe(nil)); end
1479
-
1480
- # Write +len+ first bytes of +str+ in pointer's contents.
1481
- #
1482
- # Same as:
1483
- # ptr.write_string(str, len) # with len not nil
1484
- #
1485
- # @param str [String] string to write
1486
- # @param len [Integer] length of string to return
1487
- # @return [self]
1488
- #
1489
- # source://ffi//lib/ffi/pointer.rb#92
1490
- def write_string_length(str, len); end
1491
-
1492
- private
1493
-
1494
- def initialize_copy(_arg0); end
1495
-
1496
- class << self
1497
- # Return the size of a pointer on the current platform, in bytes
1498
- #
1499
- # @return [Integer]
1500
- #
1501
- # source://ffi//lib/ffi/pointer.rb#49
1502
- def size; end
1503
- end
1504
- end
1505
-
1506
- FFI::Pointer::NULL = T.let(T.unsafe(nil), FFI::Pointer)
1507
-
1508
- # Pointer size
1509
- #
1510
- # source://ffi//lib/ffi/pointer.rb#45
1511
- FFI::Pointer::SIZE = T.let(T.unsafe(nil), Integer)
1512
-
1513
- # This will convert a pointer to a Ruby string (just like `:string`), but
1514
- # also allow to work with the pointer itself. This is useful when you want
1515
- # a Ruby string already containing a copy of the data, but also the pointer
1516
- # to the data for you to do something with it, like freeing it, in case the
1517
- # library handed the memory off to the caller (Ruby-FFI).
1518
- #
1519
- # It's {typedef}'d as +:strptr+.
1520
- #
1521
- # source://ffi//lib/ffi/types.rb#191
1522
- class FFI::StrPtrConverter
1523
- extend ::FFI::DataConverter
1524
-
1525
- class << self
1526
- # Returns a [ String, Pointer ] tuple so the C memory for the string can be freed
1527
- #
1528
- # @param val [Pointer]
1529
- # @param ctx not used
1530
- # @return [Array(String, Pointer)]
1531
- #
1532
- # source://ffi//lib/ffi/types.rb#199
1533
- def from_native(val, ctx); end
1534
- end
1535
- end
1536
-
1537
- # source://ffi//lib/ffi/struct.rb#41
1538
- class FFI::Struct
1539
- def initialize(*_arg0); end
1540
-
1541
- def [](_arg0); end
1542
- def []=(_arg0, _arg1); end
1543
-
1544
- # @return [Integer] Struct alignment
1545
- #
1546
- # source://ffi//lib/ffi/struct.rb#50
1547
- def align; end
1548
-
1549
- # @return [Integer] Struct alignment
1550
- #
1551
- # source://ffi//lib/ffi/struct.rb#50
1552
- def alignment; end
1553
-
1554
- # Clear the struct content.
1555
- #
1556
- # @return [self]
1557
- #
1558
- # source://ffi//lib/ffi/struct.rb#78
1559
- def clear; end
1560
-
1561
- def layout; end
1562
-
1563
- # source://ffi//lib/ffi/struct.rb#61
1564
- def members; end
1565
-
1566
- def null?; end
1567
-
1568
- # Get the offset of a field.
1569
- #
1570
- # @return [Integer]
1571
- #
1572
- # source://ffi//lib/ffi/struct.rb#56
1573
- def offset_of(name); end
1574
-
1575
- # Get an array of tuples (field name, offset of the field).
1576
- #
1577
- # @return [Array<Array(Symbol, Integer)>] Array<Array(Symbol, Integer)>
1578
- #
1579
- # source://ffi//lib/ffi/struct.rb#72
1580
- def offsets; end
1581
-
1582
- def order(*_arg0); end
1583
- def pointer; end
1584
-
1585
- # Get struct size
1586
- #
1587
- # @return [Integer]
1588
- #
1589
- # source://ffi//lib/ffi/struct.rb#45
1590
- def size; end
1591
-
1592
- # Get {Pointer} to struct content.
1593
- #
1594
- # @return [AbstractMemory]
1595
- #
1596
- # source://ffi//lib/ffi/struct.rb#85
1597
- def to_ptr; end
1598
-
1599
- # Get array of values from Struct fields.
1600
- #
1601
- # @return [Array]
1602
- #
1603
- # source://ffi//lib/ffi/struct.rb#67
1604
- def values; end
1605
-
1606
- private
1607
-
1608
- def initialize_copy(_arg0); end
1609
- def layout=(_arg0); end
1610
- def pointer=(_arg0); end
1611
-
1612
- class << self
1613
- # @return [Integer] Struct alignment
1614
- #
1615
- # source://ffi//lib/ffi/struct.rb#104
1616
- def alignment; end
1617
-
1618
- def alloc_in(*_arg0); end
1619
- def alloc_inout(*_arg0); end
1620
- def alloc_out(*_arg0); end
1621
-
1622
- # source://ffi//lib/ffi/struct.rb#165
1623
- def auto_ptr; end
1624
-
1625
- # source://ffi//lib/ffi/struct.rb#143
1626
- def by_ref(flags = T.unsafe(nil)); end
1627
-
1628
- # source://ffi//lib/ffi/struct.rb#139
1629
- def by_value; end
1630
-
1631
- # source://ffi//lib/ffi/struct.rb#123
1632
- def in; end
1633
-
1634
- # @overload layout
1635
- # @overload layout
1636
- # @return [StructLayout]
1637
- #
1638
- # source://ffi//lib/ffi/struct.rb#205
1639
- def layout(*spec); end
1640
-
1641
- # source://ffi//lib/ffi/struct.rb#109
1642
- def members; end
1643
-
1644
- def new_in(*_arg0); end
1645
- def new_inout(*_arg0); end
1646
- def new_out(*_arg0); end
1647
-
1648
- # Get the offset of a field.
1649
- #
1650
- # @return [Integer]
1651
- #
1652
- # source://ffi//lib/ffi/struct.rb#119
1653
- def offset_of(name); end
1654
-
1655
- # Get an array of tuples (field name, offset of the field).
1656
- #
1657
- # @return [Array<Array(Symbol, Integer)>] Array<Array(Symbol, Integer)>
1658
- #
1659
- # source://ffi//lib/ffi/struct.rb#114
1660
- def offsets; end
1661
-
1662
- # source://ffi//lib/ffi/struct.rb#127
1663
- def out; end
1664
-
1665
- # source://ffi//lib/ffi/struct.rb#131
1666
- def ptr(flags = T.unsafe(nil)); end
1667
-
1668
- # Get struct size
1669
- #
1670
- # @return [Integer]
1671
- #
1672
- # source://ffi//lib/ffi/struct.rb#91
1673
- def size; end
1674
-
1675
- # set struct size
1676
- #
1677
- # @param size [Integer]
1678
- # @raise [ArgumentError]
1679
- # @return [size]
1680
- #
1681
- # source://ffi//lib/ffi/struct.rb#98
1682
- def size=(size); end
1683
-
1684
- # source://ffi//lib/ffi/struct.rb#135
1685
- def val; end
1686
-
1687
- protected
1688
-
1689
- # source://ffi//lib/ffi/struct.rb#244
1690
- def align(alignment = T.unsafe(nil)); end
1691
-
1692
- # source://ffi//lib/ffi/struct.rb#244
1693
- def aligned(alignment = T.unsafe(nil)); end
1694
-
1695
- # source://ffi//lib/ffi/struct.rb#230
1696
- def callback(params, ret); end
1697
-
1698
- # source://ffi//lib/ffi/struct.rb#249
1699
- def enclosing_module; end
1700
-
1701
- # source://ffi//lib/ffi/struct.rb#261
1702
- def find_field_type(type, mod = T.unsafe(nil)); end
1703
-
1704
- # source://ffi//lib/ffi/struct.rb#276
1705
- def find_type(type, mod = T.unsafe(nil)); end
1706
-
1707
- # source://ffi//lib/ffi/struct.rb#239
1708
- def pack(packed = T.unsafe(nil)); end
1709
-
1710
- # source://ffi//lib/ffi/struct.rb#239
1711
- def packed(packed = T.unsafe(nil)); end
1712
-
1713
- private
1714
-
1715
- # Add array +spec+ to +builder+.
1716
- #
1717
- # @param builder [StructLayoutBuilder]
1718
- # @param spec [Array<Symbol, Integer>]
1719
- # @return [builder]
1720
- #
1721
- # source://ffi//lib/ffi/struct.rb#298
1722
- def array_layout(builder, spec); end
1723
-
1724
- # Add hash +spec+ to +builder+.
1725
- #
1726
- # @param builder [StructLayoutBuilder]
1727
- # @param spec [Hash]
1728
- # @return [builder]
1729
- #
1730
- # source://ffi//lib/ffi/struct.rb#288
1731
- def hash_layout(builder, spec); end
1732
- end
1733
- end
1734
-
1735
- class FFI::Struct::InlineArray
1736
- include ::Enumerable
1737
-
1738
- def initialize(_arg0, _arg1); end
1739
-
1740
- def [](_arg0); end
1741
- def []=(_arg0, _arg1); end
1742
- def each; end
1743
- def size; end
1744
- def to_a; end
1745
- def to_ptr; end
1746
- end
1747
-
1748
- # source://ffi//lib/ffi/struct.rb#147
1749
- class FFI::Struct::ManagedStructConverter < ::FFI::StructByReference
1750
- # @param struct_class [Struct]
1751
- # @raise [NoMethodError]
1752
- # @return [ManagedStructConverter] a new instance of ManagedStructConverter
1753
- #
1754
- # source://ffi//lib/ffi/struct.rb#150
1755
- def initialize(struct_class); end
1756
-
1757
- # @param ptr [Pointer]
1758
- # @param ctx [nil]
1759
- # @return [Struct]
1760
- #
1761
- # source://ffi//lib/ffi/struct.rb#160
1762
- def from_native(ptr, ctx); end
1763
- end
1764
-
1765
- # This class includes the {FFI::DataConverter} module.
1766
- #
1767
- # source://ffi//lib/ffi/struct_by_reference.rb#33
1768
- class FFI::StructByReference
1769
- include ::FFI::DataConverter
1770
-
1771
- # @param struct_class [Struct]
1772
- # @return [StructByReference] a new instance of StructByReference
1773
- #
1774
- # source://ffi//lib/ffi/struct_by_reference.rb#39
1775
- def initialize(struct_class); end
1776
-
1777
- # Create a struct from content of memory +value+.
1778
- #
1779
- # @param value [AbstractMemory]
1780
- # @param ctx [nil]
1781
- # @return [Struct]
1782
- #
1783
- # source://ffi//lib/ffi/struct_by_reference.rb#68
1784
- def from_native(value, ctx); end
1785
-
1786
- # Always get {FFI::Type}::POINTER.
1787
- #
1788
- # source://ffi//lib/ffi/struct_by_reference.rb#47
1789
- def native_type; end
1790
-
1791
- # Returns the value of attribute struct_class.
1792
- #
1793
- # source://ffi//lib/ffi/struct_by_reference.rb#36
1794
- def struct_class; end
1795
-
1796
- # @param value [nil, Struct]
1797
- # @param ctx [nil]
1798
- # @return [AbstractMemory] Pointer on +value+.
1799
- #
1800
- # source://ffi//lib/ffi/struct_by_reference.rb#54
1801
- def to_native(value, ctx); end
1802
- end
1803
-
1804
- class FFI::StructByValue < ::FFI::Type
1805
- def initialize(_arg0); end
1806
-
1807
- def layout; end
1808
- def struct_class; end
1809
- end
1810
-
1811
- # source://ffi//lib/ffi/struct_layout.rb#36
1812
- class FFI::StructLayout < ::FFI::Type
1813
- def initialize(_arg0, _arg1, _arg2); end
1814
-
1815
- def [](_arg0); end
1816
- def __union!; end
1817
- def fields; end
1818
- def members; end
1819
-
1820
- # Get the offset of a field.
1821
- #
1822
- # @return [Integer]
1823
- #
1824
- # source://ffi//lib/ffi/struct_layout.rb#46
1825
- def offset_of(field_name); end
1826
-
1827
- # Get an array of tuples (field name, offset of the field).
1828
- #
1829
- # @return [Array<Array(Symbol, Integer)>] Array<Array(Symbol, Integer)>
1830
- #
1831
- # source://ffi//lib/ffi/struct_layout.rb#40
1832
- def offsets; end
1833
-
1834
- def to_a; end
1835
- end
1836
-
1837
- class FFI::StructLayout::Array < ::FFI::StructLayout::Field
1838
- def get(_arg0); end
1839
- def put(_arg0, _arg1); end
1840
- end
1841
-
1842
- class FFI::StructLayout::CharArray < ::FFI::Struct::InlineArray
1843
- def to_s; end
1844
- def to_str; end
1845
- end
1846
-
1847
- # An enum {Field} in a {StructLayout}.
1848
- #
1849
- # source://ffi//lib/ffi/struct_layout.rb#51
1850
- class FFI::StructLayout::Enum < ::FFI::StructLayout::Field
1851
- # Get an object of type {#type} from memory pointed by +ptr+.
1852
- #
1853
- # @param ptr [AbstractMemory] pointer on a {Struct}
1854
- # @return [Object]
1855
- #
1856
- # source://ffi//lib/ffi/struct_layout.rb#56
1857
- def get(ptr); end
1858
-
1859
- # Set +value+ into memory pointed by +ptr+.
1860
- #
1861
- # @param ptr [AbstractMemory] pointer on a {Struct}
1862
- # @param value
1863
- # @return [nil]
1864
- #
1865
- # source://ffi//lib/ffi/struct_layout.rb#64
1866
- def put(ptr, value); end
1867
- end
1868
-
1869
- class FFI::StructLayout::Field
1870
- def initialize(*_arg0); end
1871
-
1872
- def alignment; end
1873
- def get(_arg0); end
1874
- def name; end
1875
- def offset; end
1876
- def put(_arg0, _arg1); end
1877
- def size; end
1878
- def type; end
1879
- end
1880
-
1881
- class FFI::StructLayout::Function < ::FFI::StructLayout::Field
1882
- def get(_arg0); end
1883
- def put(_arg0, _arg1); end
1884
- end
1885
-
1886
- # source://ffi//lib/ffi/struct_layout.rb#70
1887
- class FFI::StructLayout::InnerStruct < ::FFI::StructLayout::Field
1888
- # source://ffi//lib/ffi/struct_layout.rb#71
1889
- def get(ptr); end
1890
-
1891
- # @raise [TypeError]
1892
- #
1893
- # source://ffi//lib/ffi/struct_layout.rb#75
1894
- def put(ptr, value); end
1895
- end
1896
-
1897
- # source://ffi//lib/ffi/struct_layout.rb#81
1898
- class FFI::StructLayout::Mapped < ::FFI::StructLayout::Field
1899
- # @return [Mapped] a new instance of Mapped
1900
- #
1901
- # source://ffi//lib/ffi/struct_layout.rb#82
1902
- def initialize(name, offset, type, orig_field); end
1903
-
1904
- # source://ffi//lib/ffi/struct_layout.rb#87
1905
- def get(ptr); end
1906
-
1907
- # source://ffi//lib/ffi/struct_layout.rb#91
1908
- def put(ptr, value); end
1909
- end
1910
-
1911
- class FFI::StructLayout::Number < ::FFI::StructLayout::Field; end
1912
- class FFI::StructLayout::Pointer < ::FFI::StructLayout::Field; end
1913
- class FFI::StructLayout::String < ::FFI::StructLayout::Field; end
1914
-
1915
- # Build a {StructLayout struct layout}.
1916
- #
1917
- # source://ffi//lib/ffi/struct_layout_builder.rb#35
1918
- class FFI::StructLayoutBuilder
1919
- # @return [StructLayoutBuilder] a new instance of StructLayoutBuilder
1920
- #
1921
- # source://ffi//lib/ffi/struct_layout_builder.rb#39
1922
- def initialize; end
1923
-
1924
- # Add a field to the builder.
1925
- #
1926
- # @note Setting +offset+ to +nil+ or +-1+ is equivalent to +0+.
1927
- # @param name [String, Symbol] name of the field
1928
- # @param type [Array, DataConverter, Struct, StructLayout::Field, Symbol, Type] type of the field
1929
- # @param offset [Integer, nil]
1930
- # @return [self]
1931
- #
1932
- # source://ffi//lib/ffi/struct_layout_builder.rb#123
1933
- def add(name, type, offset = T.unsafe(nil)); end
1934
-
1935
- # Add an array as a field to the builder.
1936
- #
1937
- # @param count [Integer] array length
1938
- # @param name [String, Symbol] name of the field
1939
- # @param type [Array, DataConverter, Struct, StructLayout::Field, Symbol, Type] type of the field
1940
- # @param offset [Integer, nil]
1941
- # @return [self]
1942
- #
1943
- # source://ffi//lib/ffi/struct_layout_builder.rb#161
1944
- def add_array(name, type, count, offset = T.unsafe(nil)); end
1945
-
1946
- # Same as {#add}.
1947
- #
1948
- # @param name [String, Symbol] name of the field
1949
- # @param type [Array, DataConverter, Struct, StructLayout::Field, Symbol, Type] type of the field
1950
- # @param offset [Integer, nil]
1951
- # @return [self]
1952
- # @see #add
1953
- #
1954
- # source://ffi//lib/ffi/struct_layout_builder.rb#144
1955
- def add_field(name, type, offset = T.unsafe(nil)); end
1956
-
1957
- # Add a struct as a field to the builder.
1958
- #
1959
- # @param name [String, Symbol] name of the field
1960
- # @param type [Array, DataConverter, Struct, StructLayout::Field, Symbol, Type] type of the field
1961
- # @param offset [Integer, nil]
1962
- # @return [self]
1963
- #
1964
- # source://ffi//lib/ffi/struct_layout_builder.rb#151
1965
- def add_struct(name, type, offset = T.unsafe(nil)); end
1966
-
1967
- # Returns the value of attribute alignment.
1968
- #
1969
- # source://ffi//lib/ffi/struct_layout_builder.rb#37
1970
- def alignment; end
1971
-
1972
- # Set alignment attribute with +align+ only if it is greater than attribute value.
1973
- #
1974
- # @param align [Integer]
1975
- #
1976
- # source://ffi//lib/ffi/struct_layout_builder.rb#56
1977
- def alignment=(align); end
1978
-
1979
- # Build and return the struct layout.
1980
- #
1981
- # @return [StructLayout]
1982
- #
1983
- # source://ffi//lib/ffi/struct_layout_builder.rb#167
1984
- def build; end
1985
-
1986
- # Set packed attribute
1987
- #
1988
- # @overload packed=
1989
- # @overload packed=
1990
- #
1991
- # source://ffi//lib/ffi/struct_layout_builder.rb#89
1992
- def packed=(packed); end
1993
-
1994
- # Returns the value of attribute size.
1995
- #
1996
- # source://ffi//lib/ffi/struct_layout_builder.rb#36
1997
- def size; end
1998
-
1999
- # Set size attribute with +size+ only if +size+ is greater than attribute value.
2000
- #
2001
- # @param size [Integer]
2002
- #
2003
- # source://ffi//lib/ffi/struct_layout_builder.rb#50
2004
- def size=(size); end
2005
-
2006
- # Set union attribute.
2007
- # Set to +true+ to build a {Union} instead of a {Struct}.
2008
- #
2009
- # @param is_union [Boolean]
2010
- # @return [is_union]
2011
- #
2012
- # source://ffi//lib/ffi/struct_layout_builder.rb#65
2013
- def union=(is_union); end
2014
-
2015
- # Building a {Union} or a {Struct} ?
2016
- #
2017
- # @return [Boolean]
2018
- #
2019
- # source://ffi//lib/ffi/struct_layout_builder.rb#73
2020
- def union?; end
2021
-
2022
- private
2023
-
2024
- # @param offset [Integer]
2025
- # @param align [Integer]
2026
- # @return [Integer]
2027
- #
2028
- # source://ffi//lib/ffi/struct_layout_builder.rb#181
2029
- def align(offset, align); end
2030
-
2031
- # @param name [String, Symbol] name of the field
2032
- # @param type [Array, DataConverter, Struct, StructLayout::Field, Symbol, Type] type of the field
2033
- # @param offset [Integer, nil]
2034
- # @return [StructLayout::Field]
2035
- #
2036
- # source://ffi//lib/ffi/struct_layout_builder.rb#187
2037
- def field_for_type(name, offset, type); end
2038
- end
2039
-
2040
- # List of number types
2041
- #
2042
- # source://ffi//lib/ffi/struct_layout_builder.rb#100
2043
- FFI::StructLayoutBuilder::NUMBER_TYPES = T.let(T.unsafe(nil), Array)
2044
-
2045
- FFI::TYPE_BOOL = T.let(T.unsafe(nil), FFI::Type::Builtin)
2046
- FFI::TYPE_BUFFER_IN = T.let(T.unsafe(nil), FFI::Type::Builtin)
2047
- FFI::TYPE_BUFFER_INOUT = T.let(T.unsafe(nil), FFI::Type::Builtin)
2048
- FFI::TYPE_BUFFER_OUT = T.let(T.unsafe(nil), FFI::Type::Builtin)
2049
- FFI::TYPE_FLOAT32 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2050
- FFI::TYPE_FLOAT64 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2051
- FFI::TYPE_INT16 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2052
- FFI::TYPE_INT32 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2053
- FFI::TYPE_INT64 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2054
- FFI::TYPE_INT8 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2055
- FFI::TYPE_LONG = T.let(T.unsafe(nil), FFI::Type::Builtin)
2056
- FFI::TYPE_LONGDOUBLE = T.let(T.unsafe(nil), FFI::Type::Builtin)
2057
- FFI::TYPE_POINTER = T.let(T.unsafe(nil), FFI::Type::Builtin)
2058
- FFI::TYPE_STRING = T.let(T.unsafe(nil), FFI::Type::Builtin)
2059
- FFI::TYPE_UINT16 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2060
- FFI::TYPE_UINT32 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2061
- FFI::TYPE_UINT64 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2062
- FFI::TYPE_UINT8 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2063
- FFI::TYPE_ULONG = T.let(T.unsafe(nil), FFI::Type::Builtin)
2064
- FFI::TYPE_VARARGS = T.let(T.unsafe(nil), FFI::Type::Builtin)
2065
- FFI::TYPE_VOID = T.let(T.unsafe(nil), FFI::Type::Builtin)
2066
-
2067
- class FFI::Type
2068
- def initialize(_arg0); end
2069
-
2070
- def alignment; end
2071
- def inspect; end
2072
- def size; end
2073
- end
2074
-
2075
- FFI::Type::Array = FFI::ArrayType
2076
- FFI::Type::BOOL = T.let(T.unsafe(nil), FFI::Type::Builtin)
2077
- FFI::Type::BUFFER_IN = T.let(T.unsafe(nil), FFI::Type::Builtin)
2078
- FFI::Type::BUFFER_INOUT = T.let(T.unsafe(nil), FFI::Type::Builtin)
2079
- FFI::Type::BUFFER_OUT = T.let(T.unsafe(nil), FFI::Type::Builtin)
2080
-
2081
- class FFI::Type::Builtin < ::FFI::Type
2082
- def inspect; end
2083
- end
2084
-
2085
- FFI::Type::CHAR = T.let(T.unsafe(nil), FFI::Type::Builtin)
2086
- FFI::Type::DOUBLE = T.let(T.unsafe(nil), FFI::Type::Builtin)
2087
- FFI::Type::FLOAT = T.let(T.unsafe(nil), FFI::Type::Builtin)
2088
- FFI::Type::FLOAT32 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2089
- FFI::Type::FLOAT64 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2090
- FFI::Type::Function = FFI::FunctionType
2091
- FFI::Type::INT = T.let(T.unsafe(nil), FFI::Type::Builtin)
2092
- FFI::Type::INT16 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2093
- FFI::Type::INT32 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2094
- FFI::Type::INT64 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2095
- FFI::Type::INT8 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2096
- FFI::Type::LONG = T.let(T.unsafe(nil), FFI::Type::Builtin)
2097
- FFI::Type::LONGDOUBLE = T.let(T.unsafe(nil), FFI::Type::Builtin)
2098
- FFI::Type::LONG_LONG = T.let(T.unsafe(nil), FFI::Type::Builtin)
2099
-
2100
- class FFI::Type::Mapped < ::FFI::Type
2101
- def initialize(_arg0); end
2102
-
2103
- def converter; end
2104
- def from_native(*_arg0); end
2105
- def native_type; end
2106
- def to_native(*_arg0); end
2107
- def type; end
2108
- end
2109
-
2110
- FFI::Type::POINTER = T.let(T.unsafe(nil), FFI::Type::Builtin)
2111
- FFI::Type::SCHAR = T.let(T.unsafe(nil), FFI::Type::Builtin)
2112
- FFI::Type::SHORT = T.let(T.unsafe(nil), FFI::Type::Builtin)
2113
- FFI::Type::SINT = T.let(T.unsafe(nil), FFI::Type::Builtin)
2114
- FFI::Type::SLONG = T.let(T.unsafe(nil), FFI::Type::Builtin)
2115
- FFI::Type::SLONG_LONG = T.let(T.unsafe(nil), FFI::Type::Builtin)
2116
- FFI::Type::SSHORT = T.let(T.unsafe(nil), FFI::Type::Builtin)
2117
- FFI::Type::STRING = T.let(T.unsafe(nil), FFI::Type::Builtin)
2118
- FFI::Type::Struct = FFI::StructByValue
2119
- FFI::Type::UCHAR = T.let(T.unsafe(nil), FFI::Type::Builtin)
2120
- FFI::Type::UINT = T.let(T.unsafe(nil), FFI::Type::Builtin)
2121
- FFI::Type::UINT16 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2122
- FFI::Type::UINT32 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2123
- FFI::Type::UINT64 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2124
- FFI::Type::UINT8 = T.let(T.unsafe(nil), FFI::Type::Builtin)
2125
- FFI::Type::ULONG = T.let(T.unsafe(nil), FFI::Type::Builtin)
2126
- FFI::Type::ULONG_LONG = T.let(T.unsafe(nil), FFI::Type::Builtin)
2127
- FFI::Type::USHORT = T.let(T.unsafe(nil), FFI::Type::Builtin)
2128
- FFI::Type::VARARGS = T.let(T.unsafe(nil), FFI::Type::Builtin)
2129
- FFI::Type::VOID = T.let(T.unsafe(nil), FFI::Type::Builtin)
2130
- FFI::TypeDefs = T.let(T.unsafe(nil), Hash)
2131
-
2132
- # source://ffi//lib/ffi/library.rb#34
2133
- FFI::USE_THIS_PROCESS_AS_LIBRARY = T.let(T.unsafe(nil), Object)
2134
-
2135
- # source://ffi//lib/ffi/union.rb#36
2136
- class FFI::Union < ::FFI::Struct
2137
- class << self
2138
- # source://ffi//lib/ffi/union.rb#37
2139
- def builder; end
2140
- end
2141
- end
2142
-
2143
- # source://ffi//lib/ffi/version.rb#2
2144
- FFI::VERSION = T.let(T.unsafe(nil), String)
2145
-
2146
- # source://ffi//lib/ffi/variadic.rb#34
2147
- class FFI::VariadicInvoker
2148
- def initialize(_arg0, _arg1, _arg2, _arg3); end
2149
-
2150
- # Attach the invoker to module +mod+ as +mname+
2151
- #
2152
- # source://ffi//lib/ffi/variadic.rb#53
2153
- def attach(mod, mname); end
2154
-
2155
- # source://ffi//lib/ffi/variadic.rb#35
2156
- def call(*args, &block); end
2157
-
2158
- def invoke(_arg0, _arg1); end
2159
-
2160
- # Retrieve Array of parameter types
2161
- #
2162
- # This method returns an Array of FFI types accepted as function parameters.
2163
- #
2164
- # @return [Array<FFI::Type>]
2165
- #
2166
- # source://ffi//lib/ffi/variadic.rb#76
2167
- def param_types; end
2168
-
2169
- def return_type; end
2170
- end
2171
-
2172
- module Process
2173
- extend ::FFI::ModernForkTracking
2174
- end