ffi-value 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ffi-value.gemspec +1 -1
- data/lib/ffi-value.rb +63 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc8f19d7e2f3689c28657b502559f603554417e47108dc76afc2c0a97d941e81
|
4
|
+
data.tar.gz: f161557be237cec2c59bd2f697d0fff0177fc8f325221e3e2fbde2a73fe18295
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9eea815db9a231fbc777b0f26bdc3842002b816ebadce7c8b16b769da6aeeab8bee34f094bce1583de95ef4551a0d5e56432ce4d8d8f289307549960e71ae495
|
7
|
+
data.tar.gz: dc8e6dac092317193a0eb33f4e920f01072855eb59ddbefea6405c29f8c86e9996d847478317794225d7f7308724730103b84f46108f6df207d8a6de7586d7bf
|
data/ffi-value.gemspec
CHANGED
data/lib/ffi-value.rb
CHANGED
@@ -22,5 +22,67 @@ module FFI
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
if TypeDefs.frozen?
|
26
|
+
t = TypeDefs.dup
|
27
|
+
remove_const(:TypeDefs)
|
28
|
+
const_set(:TypeDefs, t)
|
29
|
+
typedef m, :value
|
30
|
+
TypeDefs.freeze
|
31
|
+
else
|
32
|
+
typedef m, :value
|
33
|
+
end
|
34
|
+
|
35
|
+
class AbstractMemory
|
36
|
+
if FFI::Type::POINTER.size == 8
|
37
|
+
def put_value(offset, value)
|
38
|
+
put_uint64(offset, value.object_id)
|
39
|
+
end
|
40
|
+
def write_value(value)
|
41
|
+
write_uint64(value.object_id)
|
42
|
+
end
|
43
|
+
def put_array_of_value(offset, ary)
|
44
|
+
put_array_of_uint64(offset, ary.collect(&:object_id))
|
45
|
+
end
|
46
|
+
def write_array_of_value(ary)
|
47
|
+
write_array_of_uint64(ary.collect(&:object_id))
|
48
|
+
end
|
49
|
+
def get_value(offset)
|
50
|
+
ObjectSpace._id2ref(get_uint64(offset))
|
51
|
+
end
|
52
|
+
def read_value
|
53
|
+
ObjectSpace._id2ref(read_uint64)
|
54
|
+
end
|
55
|
+
def get_array_of_value(offset, length)
|
56
|
+
get_array_of_uint64(offset, length).collect { |v| ObjectSpace._id2ref(v) }
|
57
|
+
end
|
58
|
+
def read_array_of_value(length)
|
59
|
+
read_array_of_uint64(length).collect { |v| ObjectSpace._id2ref(v) }
|
60
|
+
end
|
61
|
+
else
|
62
|
+
def put_value(offset, value)
|
63
|
+
put_uint32(offset, value.object_id)
|
64
|
+
end
|
65
|
+
def write_value(value)
|
66
|
+
write_uint32(value.object_id)
|
67
|
+
end
|
68
|
+
def put_array_of_value(offset, ary)
|
69
|
+
put_array_of_uint32(offset, ary.collect(&:object_id))
|
70
|
+
end
|
71
|
+
def write_array_of_value(ary)
|
72
|
+
write_array_of_uint32(ary.collect(&:object_id))
|
73
|
+
end
|
74
|
+
def get_value(offset)
|
75
|
+
ObjectSpace._id2ref(get_uint32(offset))
|
76
|
+
end
|
77
|
+
def read_value
|
78
|
+
ObjectSpace._id2ref(read_uint32)
|
79
|
+
end
|
80
|
+
def get_array_of_value(offset, length)
|
81
|
+
get_array_of_uint32(offset, length).collect { |v| ObjectSpace._id2ref(v) }
|
82
|
+
end
|
83
|
+
def read_array_of_value(length)
|
84
|
+
read_array_of_uint32(length).collect { |v| ObjectSpace._id2ref(v) }
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
26
88
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-value
|
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
|
- Brice Videau
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -43,7 +43,7 @@ homepage: https://github.com/alcf-perfengr/ffi-value
|
|
43
43
|
licenses:
|
44
44
|
- BSD-3-Clause
|
45
45
|
metadata: {}
|
46
|
-
post_install_message:
|
46
|
+
post_install_message:
|
47
47
|
rdoc_options: []
|
48
48
|
require_paths:
|
49
49
|
- lib
|
@@ -58,8 +58,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0'
|
60
60
|
requirements: []
|
61
|
-
rubygems_version: 3.
|
62
|
-
signing_key:
|
61
|
+
rubygems_version: 3.3.15
|
62
|
+
signing_key:
|
63
63
|
specification_version: 4
|
64
64
|
summary: Allow passing ruby values instead of void* pointers
|
65
65
|
test_files: []
|