ffi-module 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ffi/module/library.rb +23 -23
- data/lib/ffi/module/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 979a10f28449ee33ceecb9e1b11c31604c62d3d69787d9b00d48fc75c847eb91
|
4
|
+
data.tar.gz: 8584ea6b4f362bf4f68ecfdf33ec05b2212469ffc89e2b928407e05b3156178a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0106cd144f20ed3bffdc8093f759f80b7c3011990623382edf13bba5d2158f2af83c930570d54d1b82a2d286301428db6aba87d3c8961ddc15c427bb547ae201
|
7
|
+
data.tar.gz: bdf29ffe1d98fc704b45851c05836d0c94946a9f410a031c44dafab5caf01cad185316fc0b5f8afdb012821422be24fb1754453e415bc20e9e665636d450fe5d
|
data/lib/ffi/module/library.rb
CHANGED
@@ -172,6 +172,29 @@ module FFI
|
|
172
172
|
ffi_define_generic_enumeration(name, FFI::Bitmask, native_type, *arguments)
|
173
173
|
end
|
174
174
|
|
175
|
+
def ffi_find_type(argument)
|
176
|
+
if argument.kind_of?(Type)
|
177
|
+
return argument
|
178
|
+
end
|
179
|
+
|
180
|
+
if type = @ffi_type_map[argument]
|
181
|
+
return type
|
182
|
+
end
|
183
|
+
|
184
|
+
if argument.is_a?(Class) && argument < Struct
|
185
|
+
return Type::POINTER
|
186
|
+
end
|
187
|
+
|
188
|
+
if argument.is_a?(DataConverter)
|
189
|
+
# Cache the mapped type:
|
190
|
+
return ffi_define_type(argument, Type::Mapped.new(argument))
|
191
|
+
end
|
192
|
+
|
193
|
+
if argument
|
194
|
+
return FFI.find_type(argument)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
175
198
|
private
|
176
199
|
|
177
200
|
def ffi_define_generic_enumeration(name, klass, native_type, values)
|
@@ -213,29 +236,6 @@ module FFI
|
|
213
236
|
|
214
237
|
return result
|
215
238
|
end
|
216
|
-
|
217
|
-
def ffi_find_type(argument)
|
218
|
-
if argument.kind_of?(Type)
|
219
|
-
return argument
|
220
|
-
end
|
221
|
-
|
222
|
-
if type = @ffi_type_map[argument]
|
223
|
-
return type
|
224
|
-
end
|
225
|
-
|
226
|
-
if argument.is_a?(Class) && argument < Struct
|
227
|
-
return Type::POINTER
|
228
|
-
end
|
229
|
-
|
230
|
-
if argument.is_a?(DataConverter)
|
231
|
-
# Cache the mapped type:
|
232
|
-
return ffi_define_type(argument, Type::Mapped.new(argument))
|
233
|
-
end
|
234
|
-
|
235
|
-
if argument
|
236
|
-
return FFI.find_type(argument)
|
237
|
-
end
|
238
|
-
end
|
239
239
|
end
|
240
240
|
end
|
241
241
|
end
|
data/lib/ffi/module/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-module
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|
114
|
-
rubygems_version: 3.
|
114
|
+
rubygems_version: 3.0.3
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: Write a short summary, because RubyGems requires one.
|