ffi-value 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +11 -0
  3. data/ffi-value.gemspec +13 -0
  4. data/lib/ffi-value.rb +26 -0
  5. metadata +65 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ba462cc571b1688ec0c40092ae929513e50b29ef3c2fd2766384a40c31c0c2af
4
+ data.tar.gz: 3ef162c8ef18f5f90db587d5e3fdff9698593de0d6d727f710b38407fe5ffe31
5
+ SHA512:
6
+ metadata.gz: 3005a3c566436ebaacd2fd6dac7de6b9e087726450327d4cc0880d98d7e8bcf7ec096c619902480846102f3e9db2749f9519a6841ed3a3f1fcebc6b4108087b5
7
+ data.tar.gz: 89a225c9368934bdfbf539a19341c02e9b9067b11b4cf4eb93211bcd9d5626e3103bcc2aff0caaf3c80277c0a443c0895b3fdef3d00e339c3f9e52e513e7a26e
data/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ Copyright <YEAR> <COPYRIGHT HOLDER>
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,13 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'ffi-value'
3
+ s.version = "0.1.0"
4
+ s.author = "Brice Videau"
5
+ s.email = "bvideau@anl.gov"
6
+ s.homepage = "https://github.com/alcf-perfengr/ffi-value"
7
+ s.summary = "Allow passing ruby values instead of void* pointers"
8
+ s.description = "Allow passing ruby values instead of void* pointers."
9
+ s.files = Dir[ 'ffi-value.gemspec', 'LICENSE', 'lib/ffi-value.rb' ]
10
+ s.license = 'BSD-3-Clause'
11
+ s.required_ruby_version = '>= 2.3.0'
12
+ s.add_dependency 'ffi', '~> 1.9', '>=1.9.3'
13
+ end
@@ -0,0 +1,26 @@
1
+ require 'ffi'
2
+
3
+ module FFI
4
+ m = Module.new do
5
+ extend FFI::DataConverter
6
+ if FFI::Type::POINTER.size == 8
7
+ def self.native_type
8
+ FFI::Type::UINT64
9
+ end
10
+ else
11
+ def self.native_type
12
+ FFI::Type::UINT32
13
+ end
14
+ end
15
+
16
+ def self.from_native(value, context)
17
+ ObjectSpace._id2ref(value)
18
+ end
19
+
20
+ def self.to_native(value, context)
21
+ value.object_id
22
+ end
23
+ end
24
+
25
+ typedef m, :value
26
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ffi-value
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Brice Videau
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-12-10 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
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.9.3
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.9'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.9.3
33
+ description: Allow passing ruby values instead of void* pointers.
34
+ email: bvideau@anl.gov
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - LICENSE
40
+ - ffi-value.gemspec
41
+ - lib/ffi-value.rb
42
+ homepage: https://github.com/alcf-perfengr/ffi-value
43
+ licenses:
44
+ - BSD-3-Clause
45
+ metadata: {}
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 2.3.0
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubygems_version: 3.1.2
62
+ signing_key:
63
+ specification_version: 4
64
+ summary: Allow passing ruby values instead of void* pointers
65
+ test_files: []