jsonnet 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/README.md +1 -1
- data/ext/jsonnet/callbacks.c +11 -3
- data/ext/jsonnet/vm.c +6 -8
- data/lib/jsonnet/version.rb +1 -1
- data/test/test_vm.rb +0 -1
- 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: 21fb3547860dbf786a960705f8ec154f2068b07679091020da431fd1b407a4fd
|
4
|
+
data.tar.gz: 7860579f2f6931a3635ccae64de7c2de558644e6833e302b6511efb00f494a17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1abbd8abe2a2670b366bd249ed92106d06c55e43db8c3ffd4c263c7151b985361a653f8d032782e0a5a3900af0e26d3f2a6a761246669463fbc0d22999df498
|
7
|
+
data.tar.gz: 59e92b2680be878b8dfeb29c876aa877eaa22562ee5e60a4deb98f24b8e7cf27702f1e3b78404f31f21be1e6d0475e606e90398805f1b92d20bcdbcdd1ef7b7d
|
data/.github/workflows/ruby.yml
CHANGED
data/README.md
CHANGED
@@ -63,7 +63,7 @@ gem install jsonnet -- --use-system-libraries
|
|
63
63
|
|
64
64
|
Load the library with `require "jsonnet"`
|
65
65
|
|
66
|
-
You can evaluate a string of Jsonnet using `Jsonnet.
|
66
|
+
You can evaluate a string of Jsonnet using `Jsonnet.evaluate`
|
67
67
|
|
68
68
|
```
|
69
69
|
irb(main):002:0> Jsonnet.evaluate('{ foo: "bar" }')
|
data/ext/jsonnet/callbacks.c
CHANGED
@@ -11,6 +11,14 @@
|
|
11
11
|
*/
|
12
12
|
#define RUBYJSONNET_GLOBAL_ESCAPE_MAGIC "\x07\x03\x0c:rubytag:\x07\x03\x0c:"
|
13
13
|
|
14
|
+
/* Copied from vm_core.h in Ruby. State variables in global escapes have
|
15
|
+
* this value when an exception is raised.
|
16
|
+
*
|
17
|
+
* TODO(yugui) Find a better way to distinguish "raise" from "throw".
|
18
|
+
* It is not a very good idea to depend on the implementation details of Ruby.
|
19
|
+
*/
|
20
|
+
#define RUBY_TAG_RAISE 0x6
|
21
|
+
|
14
22
|
/*
|
15
23
|
* callback support in VM
|
16
24
|
*/
|
@@ -44,9 +52,9 @@ invoke_callback(VALUE args)
|
|
44
52
|
static VALUE
|
45
53
|
rescue_callback(int state, const char *fmt, ...)
|
46
54
|
{
|
47
|
-
|
48
|
-
|
49
|
-
VALUE msg = rb_protect(rubyjsonnet_format_exception,
|
55
|
+
if (state == RUBY_TAG_RAISE) {
|
56
|
+
VALUE err = rb_errinfo();
|
57
|
+
VALUE msg = rb_protect(rubyjsonnet_format_exception, err, NULL);
|
50
58
|
if (msg == Qnil) {
|
51
59
|
va_list ap;
|
52
60
|
va_start(ap, fmt);
|
data/ext/jsonnet/vm.c
CHANGED
@@ -59,16 +59,15 @@ rubyjsonnet_obj_to_vm(VALUE wrap)
|
|
59
59
|
}
|
60
60
|
|
61
61
|
static VALUE
|
62
|
-
|
62
|
+
vm_s_allocate(VALUE klass)
|
63
63
|
{
|
64
64
|
struct jsonnet_vm_wrap *vm;
|
65
|
-
VALUE self = TypedData_Make_Struct(
|
65
|
+
VALUE self = TypedData_Make_Struct(klass, struct jsonnet_vm_wrap, &jsonnet_vm_type, vm);
|
66
66
|
vm->vm = jsonnet_make();
|
67
67
|
vm->import_callback = Qnil;
|
68
68
|
vm->native_callbacks.len = 0;
|
69
69
|
vm->native_callbacks.contexts = NULL;
|
70
70
|
|
71
|
-
rb_obj_call_init(self, argc, argv);
|
72
71
|
return self;
|
73
72
|
}
|
74
73
|
|
@@ -81,11 +80,10 @@ vm_free(void *ptr)
|
|
81
80
|
|
82
81
|
for (i = 0; i < vm->native_callbacks.len; ++i) {
|
83
82
|
struct native_callback_ctx *ctx = vm->native_callbacks.contexts[i];
|
84
|
-
|
83
|
+
xfree(ctx);
|
85
84
|
}
|
86
|
-
|
87
|
-
|
88
|
-
RB_REALLOC_N(vm, struct jsonnet_vm_wrap, 0);
|
85
|
+
xfree(vm->native_callbacks.contexts);
|
86
|
+
xfree(vm);
|
89
87
|
}
|
90
88
|
|
91
89
|
static void
|
@@ -390,7 +388,7 @@ void
|
|
390
388
|
rubyjsonnet_init_vm(VALUE mJsonnet)
|
391
389
|
{
|
392
390
|
cVM = rb_define_class_under(mJsonnet, "VM", rb_cObject);
|
393
|
-
|
391
|
+
rb_define_alloc_func(cVM, vm_s_allocate);
|
394
392
|
rb_define_private_method(cVM, "eval_file", vm_evaluate_file, 3);
|
395
393
|
rb_define_private_method(cVM, "eval_snippet", vm_evaluate, 3);
|
396
394
|
rb_define_private_method(cVM, "fmt_file", vm_fmt_file, 2);
|
data/lib/jsonnet/version.rb
CHANGED
data/test/test_vm.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonnet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuki Yugui Sonoda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_portile2
|