yamlscript 0.1.97 → 0.2.1
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/ChangeLog.md +4 -0
- data/ReadMe.md +4 -4
- data/doc/readme.md +2 -2
- data/lib/yamlscript/version.rb +1 -1
- data/lib/yamlscript.rb +16 -16
- 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: 044ba49ce43d7233b7f9f3554abe1a0c9302b264793844d85a4a6bdd7e45a017
|
4
|
+
data.tar.gz: 7632506085fb4ebd3438a8499aafecf1bccea045c97ba72f34f0dba325f2c2b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27baec3225fcf007304a44822285bb2befc926904602725af93fbf0064d08a51830c1a8f64d306829670ee4ec77ee233ab43275d68c90c57438d14eb1d1def5b
|
7
|
+
data.tar.gz: b81b643ba7f4c8b8b636b6d9b14041688b5a6c9ba1bb1e4ffe433d0fc51a8a7252286f9a7cedec68ec24c854f40271a341303b0f765da69870d6c6c1baeb0790
|
data/ChangeLog.md
CHANGED
data/ReadMe.md
CHANGED
@@ -20,7 +20,7 @@ names-url =:
|
|
20
20
|
name-list =: names-url:curl:json/load
|
21
21
|
|
22
22
|
# Data object with literal keys and generated values:
|
23
|
-
name::
|
23
|
+
name:: name-list:shuffle:first
|
24
24
|
aka:: name-list:rand-nth
|
25
25
|
age:: &num 2 * 3 * 7
|
26
26
|
color:: &hue
|
@@ -63,7 +63,7 @@ This makes YS a complete functional programming language right out of the box.
|
|
63
63
|
|
64
64
|
Even though YS compiles to Clojure, and Clojure compiles to Java, there is no
|
65
65
|
dependency on Java or the JVM.
|
66
|
-
YS is compiled to a native shared library (`
|
66
|
+
YS is compiled to a native shared library (`libys.so`) that can be used
|
67
67
|
by any programming language that can load shared libraries.
|
68
68
|
|
69
69
|
To see the Clojure code that YS compiles to, you can use the YS
|
@@ -128,7 +128,7 @@ You can install this module like any other Ruby module:
|
|
128
128
|
gem install yamlscript
|
129
129
|
```
|
130
130
|
|
131
|
-
but you will need to have a system install of `
|
131
|
+
but you will need to have a system install of `libys.so`.
|
132
132
|
|
133
133
|
One simple way to do that is with:
|
134
134
|
|
@@ -137,7 +137,7 @@ curl https://yamlscript.org/install | bash
|
|
137
137
|
```
|
138
138
|
|
139
139
|
> Note: The above command will install the latest version of the YAMLScript
|
140
|
-
command line utility, `ys`, and the shared library, `
|
140
|
+
command line utility, `ys`, and the shared library, `libys.so`, into
|
141
141
|
`~/local/bin` and `~/.local/lib` respectively.
|
142
142
|
|
143
143
|
See <https://yamlscript.org/doc/install/> for more info.
|
data/doc/readme.md
CHANGED
@@ -44,7 +44,7 @@ You can install this module like any other Ruby module:
|
|
44
44
|
gem install yamlscript
|
45
45
|
```
|
46
46
|
|
47
|
-
but you will need to have a system install of `
|
47
|
+
but you will need to have a system install of `libys.so`.
|
48
48
|
|
49
49
|
One simple way to do that is with:
|
50
50
|
|
@@ -53,7 +53,7 @@ curl https://yamlscript.org/install | bash
|
|
53
53
|
```
|
54
54
|
|
55
55
|
> Note: The above command will install the latest version of the YAMLScript
|
56
|
-
command line utility, `ys`, and the shared library, `
|
56
|
+
command line utility, `ys`, and the shared library, `libys.so`, into
|
57
57
|
`~/local/bin` and `~/.local/lib` respectively.
|
58
58
|
|
59
59
|
See <https://yamlscript.org/doc/install/> for more info.
|
data/lib/yamlscript/version.rb
CHANGED
data/lib/yamlscript.rb
CHANGED
@@ -9,17 +9,17 @@ require 'json'
|
|
9
9
|
|
10
10
|
require_relative 'yamlscript/version'
|
11
11
|
|
12
|
-
# Ruby binding for the
|
12
|
+
# Ruby binding for the libys shared library.
|
13
13
|
class YAMLScript
|
14
14
|
Error = Class.new(StandardError)
|
15
15
|
|
16
16
|
# This value is automatically updated by 'make bump'.
|
17
17
|
# The version number is used to find the correct shared library file.
|
18
|
-
# We currently only support binding to an exact version of
|
19
|
-
YAMLSCRIPT_VERSION = '0.1
|
18
|
+
# We currently only support binding to an exact version of libys.
|
19
|
+
YAMLSCRIPT_VERSION = '0.2.1'
|
20
20
|
|
21
21
|
# A low-level interface to the native library
|
22
|
-
module
|
22
|
+
module LibYS
|
23
23
|
extend Fiddle::Importer
|
24
24
|
|
25
25
|
def self.extension
|
@@ -33,8 +33,8 @@ class YAMLScript
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def self.
|
37
|
-
"
|
36
|
+
def self.libys_name
|
37
|
+
"libys.#{extension}.#{YAMLSCRIPT_VERSION}"
|
38
38
|
end
|
39
39
|
|
40
40
|
# Returns an array of library paths extracted from the LD_LIBRARY_PATH
|
@@ -48,9 +48,9 @@ class YAMLScript
|
|
48
48
|
paths << ENV.fetch('HOME', '') + '/.local/lib'
|
49
49
|
end
|
50
50
|
|
51
|
-
# Find the
|
52
|
-
def self.
|
53
|
-
name =
|
51
|
+
# Find the libys shared library file path
|
52
|
+
def self.find_libys_path
|
53
|
+
name = libys_name
|
54
54
|
path = ld_library_paths.map {
|
55
55
|
|dir| File.join(dir, name) }.detect { |file| File.exist?(file)
|
56
56
|
}
|
@@ -66,7 +66,7 @@ ERROR
|
|
66
66
|
path
|
67
67
|
end
|
68
68
|
|
69
|
-
dlload
|
69
|
+
dlload find_libys_path
|
70
70
|
|
71
71
|
extern \
|
72
72
|
'int graal_create_isolate(void* params, void** isolate, void** thread)'
|
@@ -74,7 +74,7 @@ ERROR
|
|
74
74
|
extern 'char* load_ys_to_json(void* thread, char* yamlscript)'
|
75
75
|
end
|
76
76
|
|
77
|
-
# Interface with the
|
77
|
+
# Interface with the libys shared library.
|
78
78
|
#
|
79
79
|
# @example
|
80
80
|
# require 'yamlscript'
|
@@ -100,18 +100,18 @@ ERROR
|
|
100
100
|
# Create a new GraalVM isolate thread for each call to load()
|
101
101
|
thread = Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP)
|
102
102
|
raise Error, "Failed to create isolate" unless \
|
103
|
-
|
103
|
+
LibYS.graal_create_isolate(nil, @isolate.ref, thread.ref).zero?
|
104
104
|
|
105
|
-
# Call 'load_ys_to_json' function in
|
106
|
-
json_data =
|
105
|
+
# Call 'load_ys_to_json' function in libys shared library
|
106
|
+
json_data = LibYS.load_ys_to_json(thread, ys_code)
|
107
107
|
resp = JSON.parse(json_data.to_s)
|
108
108
|
|
109
109
|
raise Error, "Failed to tear down isolate" unless \
|
110
|
-
|
110
|
+
LibYS.graal_tear_down_isolate(thread).zero?
|
111
111
|
raise Error, @error['cause'] if @error = resp['error']
|
112
112
|
|
113
113
|
data = resp.fetch('data') do
|
114
|
-
raise Error, "Unexpected response from '
|
114
|
+
raise Error, "Unexpected response from 'libys'"
|
115
115
|
end
|
116
116
|
|
117
117
|
data
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yamlscript
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ingy döt Net
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-06
|
12
|
+
date: 2025-07-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|