rubyhead.swg
来自「subversion-1.4.5.tar.gz 配置svn的源码」· SWG 代码 · 共 117 行
SWG
117 行
/* ruby.swg *//* Implementation : RUBY */#define SWIGRUBY 1#include "ruby.h"/* Flags for pointer conversion */#define SWIG_POINTER_EXCEPTION 0x1#define SWIG_POINTER_DISOWN 0x2#define NUM2USHRT(n) (\ (0 <= NUM2UINT(n) && NUM2UINT(n) <= USHRT_MAX)\ ? (unsigned short) NUM2UINT(n) \ : (rb_raise(rb_eArgError, "integer %d out of range of `unsigned short'",\ NUM2UINT(n)), (short)0)\)#define NUM2SHRT(n) (\ (SHRT_MIN <= NUM2INT(n) && NUM2INT(n) <= SHRT_MAX)\ ? (short)NUM2INT(n)\ : (rb_raise(rb_eArgError, "integer %d out of range of `short'",\ NUM2INT(n)), (short)0)\)/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */#ifndef NUM2LL#define NUM2LL(x) NUM2LONG((x))#endif#ifndef LL2NUM#define LL2NUM(x) INT2NUM((long) (x))#endif#ifndef ULL2NUM#define ULL2NUM(x) UINT2NUM((unsigned long) (x))#endif/* Ruby 1.7 doesn't (yet) define NUM2ULL() */#ifndef NUM2ULL#ifdef HAVE_LONG_LONG#define NUM2ULL(x) rb_num2ull((x))#else#define NUM2ULL(x) NUM2ULONG(x)#endif#endif/* * 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(). */ #ifdef __cplusplus# 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)# else# 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)# endif# endif#else# define VALUEFUNC(f) (f)# define VOIDFUNC(f) (f)#endiftypedef struct { VALUE klass; VALUE mImpl; void (*mark)(void *); void (*destroy)(void *);} swig_class;/* Don't use for expressions have side effect */#ifndef RB_STRING_VALUE#define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))#endif#ifndef StringValue#define StringValue(s) RB_STRING_VALUE(s)#endif#ifndef StringValuePtr#define StringValuePtr(s) RSTRING(RB_STRING_VALUE(s))->ptr#endif#ifndef StringValueLen#define StringValueLen(s) RSTRING(RB_STRING_VALUE(s))->len#endif#ifndef SafeStringValue#define SafeStringValue(v) do {\ StringValue(v);\ rb_check_safe_str(v);\} while (0)#endif#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")#endif/* Contract support */#define SWIG_contract_assert(expr, msg) if (!(expr)) { rb_raise(rb_eRuntimeError, (char *) msg ); } else
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?