ffi_dry 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/VERSION +1 -1
- data/ffi_dry.gemspec +2 -2
- data/lib/ffi/dry.rb +9 -7
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
=== 0.1.8 / 2010-2-16
|
2
|
+
* Updated for compatability with ffi 0.6.x's new requirement that
|
3
|
+
libraries be included with 'ffi_lib' even if they are already linked.
|
4
|
+
|
1
5
|
=== 0.1.7 / 2010-2-05
|
2
6
|
* Fixed bugs with FFI::Unions
|
3
7
|
* Revamped the dsl_layout builder so that it just wraps layout() instead of
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.8
|
data/ffi_dry.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ffi_dry}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Eric Monti"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-16}
|
13
13
|
s.description = %q{Provides some useful modules, classes, and methods for FFI bindings as well as a DSL-like syntax for FFI::Struct layouts}
|
14
14
|
s.email = %q{emonti@matasano.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/ffi/dry.rb
CHANGED
@@ -2,6 +2,10 @@ begin; require 'rubygems'; rescue LoadError; end
|
|
2
2
|
|
3
3
|
require 'ffi'
|
4
4
|
|
5
|
+
unless defined?(FFI::Library::LIBC)
|
6
|
+
FFI::Library::LIBC = (RUBY_PLATFORM == 'mswin32' ? 'msvcrt' : 'c')
|
7
|
+
end
|
8
|
+
|
5
9
|
module FFI::DRY
|
6
10
|
|
7
11
|
# A module to add syntactic sugar and some nice automatic getter/setter
|
@@ -233,7 +237,7 @@ module FFI::DRY
|
|
233
237
|
# for the pointer will be returned.
|
234
238
|
def p_struct(name, klass, o={})
|
235
239
|
unless klass.kind_of?(Class)
|
236
|
-
raise(
|
240
|
+
raise(TypeError, "klass must be a Class")
|
237
241
|
end
|
238
242
|
opts = o.merge(:p_struct => klass)
|
239
243
|
offset = opts[:offset]
|
@@ -269,12 +273,12 @@ module FFI::DRY
|
|
269
273
|
o={}
|
270
274
|
if extra.size > 1
|
271
275
|
raise(ArgumentError,
|
272
|
-
"Bad field
|
276
|
+
"Bad field syntax. Use: 'name :type, {optional extra parameters}'")
|
273
277
|
elsif h=extra.first
|
274
278
|
if h.kind_of? Hash
|
275
279
|
o=h
|
276
280
|
else
|
277
|
-
raise(
|
281
|
+
raise(TypeError, "Options must be provided as a hash.")
|
278
282
|
end
|
279
283
|
end
|
280
284
|
opts = o.merge(:name => name, :type => type)
|
@@ -376,10 +380,8 @@ module FFI::DRY
|
|
376
380
|
module NetEndian
|
377
381
|
extend ::FFI::Library
|
378
382
|
|
379
|
-
|
380
|
-
|
381
|
-
rescue LoadError
|
382
|
-
end
|
383
|
+
ffi_lib FFI::Library::LIBC
|
384
|
+
begin; ffi_lib 'wsock32'; rescue LoadError; end
|
383
385
|
|
384
386
|
attach_function :htons, [:uint16], :uint16
|
385
387
|
attach_function :ntohs, [:uint16], :uint16
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi_dry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Monti
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-16 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|