X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=bindings%2Fruby%2Fclasses.i;h=fbd7c36c95d9c57d008c3d128eb11be622269ac4;hb=HEAD;hp=5e4baf07db74eaa7cdadaedec9340acb48d11641;hpb=f504779c120713727d2d01cbd3ad38175a829a4f;p=libsigrok.git diff --git a/bindings/ruby/classes.i b/bindings/ruby/classes.i index 5e4baf07..fbd7c36c 100644 --- a/bindings/ruby/classes.i +++ b/bindings/ruby/classes.i @@ -41,10 +41,10 @@ which provides access to the error code and description." %module(docstring=DOCSTRING) sigrok %{ +#include "config.h" + #include #include - -#include "config.h" %} %include "../swig/templates.i" @@ -113,6 +113,7 @@ static VALUE variant_to_ruby(Glib::VariantBase variant) } else { SWIG_exception(SWIG_TypeError, ("TODO: GVariant(" + variant.get_type().get_string() + ") -> Ruby").c_str()); } + return 0; /* Dummy, to avoid a compiler warning. */ } %} @@ -235,6 +236,8 @@ Glib::VariantBase ruby_to_variant_by_key(VALUE input, const sigrok::ConfigKey *k return Glib::Variant::create(RFLOAT_VALUE(input)); else if (type == SR_T_INT32 && RB_TYPE_P(input, T_FIXNUM)) return Glib::Variant::create(NUM2INT(input)); + else if (type == SR_T_UINT32 && RB_TYPE_P(input, T_FIXNUM)) + return Glib::Variant::create(NUM2UINT(input)); else throw sigrok::Error(SR_ERR_ARG); } @@ -260,6 +263,8 @@ Glib::VariantBase ruby_to_variant_by_option(VALUE input, std::shared_ptr::create(RFLOAT_VALUE(input)); else if (variant.is_of_type(Glib::VARIANT_TYPE_INT32) && RB_TYPE_P(input, T_FIXNUM)) return Glib::Variant::create(NUM2INT(input)); + else if (variant.is_of_type(Glib::VARIANT_TYPE_UINT32) && RB_TYPE_P(input, T_FIXNUM)) + return Glib::Variant::create(NUM2UINT(input)); else throw sigrok::Error(SR_ERR_ARG); }