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