ffi-additions 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e875a815b30c3d91adfa08e53dcca79b9780d3f8
4
+ data.tar.gz: e45441a425e62ad5aab7a785cb1163f5f36b0324
5
+ SHA512:
6
+ metadata.gz: 6f5ef9eb40697ad338799eb30dc4ac0c11c4947c4e5318392c4f53498b465f88aefb91dc19288790b1814b55da9895233d31b390e241558cd71f2e6472a8dfdd
7
+ data.tar.gz: f2d75a6cee8908b55d4df98225333c16d5da52d56e14a0cd1d11f66ddb0436cee444b78f9f8fbb22ce29b4e4f54686ee6659029f0776f7297e18517d5f4c63b2
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # FFI Additions
2
+
3
+ [![Join the chat at https://gitter.im/P3t3rU5/winffi](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/P3t3rU5/winffi?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
+
5
+ FFI Additions is a gem that adds functionality to FFI
6
+ This gem is work in progress
7
+ To install:
8
+
9
+ ```
10
+ gem install ffi-additions
11
+ ```
12
+
13
+ # License
14
+
15
+ (The MIT License)
16
+
17
+ Copyright © 2013 Pedro Miranda
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining
20
+ a copy of this software and associated documentation files (the
21
+ 'Software'), to deal in the Software without restriction, including
22
+ without limitation the rights to use, copy, modify, merge, publish,
23
+ distribute, sublicense, and/or sell copies of the Software, and to
24
+ permit persons to whom the Software is furnished to do so, subject to
25
+ the following conditions:
26
+
27
+ The above copyright notice and this permission notice shall be
28
+ included in all copies or substantial portions of the Software.
29
+
30
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
31
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
34
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
35
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
36
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ require 'ffi'
@@ -0,0 +1,27 @@
1
+ require 'ffi-additions'
2
+
3
+ module FFIAdditions
4
+ class Struct < FFI::Struct
5
+ def self.layout(*args)
6
+ super
7
+ members.each do |name|
8
+ unless method_defined?(name)
9
+ define_method name, ->{ self[name] }
10
+ define_method "#{name}=", ->(v){ self[name] = v }
11
+ end
12
+ end
13
+ end
14
+ end
15
+
16
+ class Union < FFI::Union
17
+ def self.layout(*args)
18
+ super
19
+ members.each do |name|
20
+ unless method_defined?(name)
21
+ define_method name, ->{ self[name] }
22
+ define_method "#{name}=", ->(v){ self[name] = v }
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ module FFIAdditions
2
+ VERSION = '0.0.1'
3
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ffi-additions
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - P3t3rU5
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ description: Additions to FFI gem
28
+ email:
29
+ - pedro.at.miranda@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - README.md
35
+ - lib/ffi-additions.rb
36
+ - lib/ffi-additions/struct.rb
37
+ - lib/ffi-additions/version.rb
38
+ homepage: https://github.com/P3t3rU5/ffi-additions
39
+ licenses:
40
+ - MIT
41
+ metadata: {}
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubyforge_project:
58
+ rubygems_version: 2.6.4
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: Additions to FFI gem
62
+ test_files: []