Displaying 3 results from an estimated 3 matches for "nbdkit_module".
2017 Feb 02
3
[nbdkit PATCH 0/2] Ruby bindings for .zero
Similar to python and perl. But MUCH easier (especially considering
that this is the first time I've every tried to run Ruby). I even
had fun making set_error() polymorphic.
Eric Blake (2):
ruby: Expose nbdkit_set_error to ruby script
ruby: Support zero callback
plugins/ruby/example.rb | 11 ++++++++
plugins/ruby/nbdkit-ruby-plugin.pod | 54
2017 Feb 02
0
[nbdkit PATCH 2/2] ruby: Support zero callback
...ins/ruby/ruby.c
index fc2e8ad..33d7968 100644
--- a/plugins/ruby/ruby.c
+++ b/plugins/ruby/ruby.c
@@ -36,12 +36,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
+#include <errno.h>
#include <nbdkit-plugin.h>
#include <ruby.h>
static VALUE nbdkit_module = Qnil;
+static int last_error;
static VALUE
set_error(VALUE self, VALUE arg)
@@ -58,6 +60,7 @@ set_error(VALUE self, VALUE arg)
} else {
err = NUM2INT(arg);
}
+ last_error = err;
nbdkit_set_error(err);
return Qnil;
}
@@ -367,6 +370,30 @@ plugin_rb_trim (void *handle, uint32_t...
2018 Oct 01
2
[PATCH nbdkit] plugins: Add scripting language version to --dump-plugin output.
...iff --git a/plugins/ruby/ruby.c b/plugins/ruby/ruby.c
index aa57f65..a3d7a42 100644
--- a/plugins/ruby/ruby.c
+++ b/plugins/ruby/ruby.c
@@ -41,6 +41,9 @@
#include <nbdkit-plugin.h>
#include <ruby.h>
+#ifdef HAVE_RUBY_VERSION_H
+#include <ruby/version.h>
+#endif
static VALUE nbdkit_module = Qnil;
static int last_error;
@@ -168,6 +171,17 @@ plugin_rb_unload (void)
static void
plugin_rb_dump_plugin (void)
{
+#ifdef RUBY_API_VERSION_MAJOR
+ printf ("ruby_api_version=%d", RUBY_API_VERSION_MAJOR);
+#ifdef RUBY_API_VERSION_MINOR
+ printf (".%d", RUBY_API_VERSION_...