/* Implementation : RUBY */
/* Flags for pointer conversion */
#define SWIG_POINTER_EXCEPTION 0x1
#define SWIG_POINTER_OWN 0x1
#define SWIG_POINTER_DISOWN 0x2
#define SWIG_TRACK_OBJECTS 0x4
(0 <= NUM2UINT(n) && NUM2UINT(n) <= USHRT_MAX)\
? (unsigned short) NUM2UINT(n) \
: (rb_raise(rb_eArgError, "integer %d out of range of `unsigned short'",\
(SHRT_MIN <= NUM2INT(n) && NUM2INT(n) <= SHRT_MAX)\
: (rb_raise(rb_eArgError, "integer %d out of range of `short'",\
/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
#define NUM2LL(x) NUM2LONG((x))
#define LL2NUM(x) INT2NUM((long) (x))
#define ULL2NUM(x) UINT2NUM((unsigned long) (x))
/* Ruby 1.7 doesn't (yet) define NUM2ULL() */
#define NUM2ULL(x) rb_num2ull((x))
#define NUM2ULL(x) NUM2ULONG(x)
* Need to be very careful about how these macros are defined, especially
* when compiling C++ code or C code with an ANSI C compiler.
* VALUEFUNC(f) is a macro used to typecast a C function that implements
* a Ruby method so that it can be passed as an argument to API functions
* like rb_define_method() and rb_define_singleton_method().
* VOIDFUNC(f) is a macro used to typecast a C function that implements
* either the "mark" or "free" stuff for a Ruby Data object, so that it
* can be passed as an argument to API functions like Data_Wrap_Struct()
* and Data_Make_Struct().
# ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
# define PROTECTFUNC(f) ((VALUE (*)()) f)
# define VALUEFUNC(f) ((VALUE (*)()) f)
# define VOIDFUNC(f) ((void (*)()) f)
# ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
# define PROTECTFUNC(f) ((VALUE (*)()) f)
# define VALUEFUNC(f) ((VALUE (*)()) f)
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
# else /* These definitions should work for Ruby 1.7+ */
# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
# define VALUEFUNC(f) (f)
/* Don't use for expressions have side effect */
#define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
#define StringValue(s) RB_STRING_VALUE(s)
#define StringValuePtr(s) RSTRING(RB_STRING_VALUE(s))->ptr
#define StringValueLen(s) RSTRING(RB_STRING_VALUE(s))->len
#define SafeStringValue(v) do {\
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
#define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
#define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
#define SWIG_contract_assert(expr, msg) if (!(expr)) { rb_raise(rb_eRuntimeError, (char *) msg ); } else