The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6fcc22a1f8
commit
516036631c
1508 changed files with 125983 additions and 44037 deletions
71
SWIG/Lib/ruby/rubyhead.swg
Normal file
71
SWIG/Lib/ruby/rubyhead.swg
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/* ruby.swg */
|
||||
/* Implementation : RUBY */
|
||||
#define SWIGRUBY 1
|
||||
|
||||
#include "ruby.h"
|
||||
|
||||
#define NUM2USHRT(n) NUM2UINT(n)
|
||||
#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 VALUEFUNC(f) ((VALUE (*)()) f)
|
||||
# define VOIDFUNC(f) ((void (*)()) f)
|
||||
# else
|
||||
# ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
|
||||
# define VALUEFUNC(f) ((VALUE (*)()) f)
|
||||
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
|
||||
# else /* These definitions should work for Ruby 1.7 */
|
||||
# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
|
||||
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define VALUEFUNC(f) (f)
|
||||
# define VOIDFUNC(f) (f)
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
VALUE klass;
|
||||
void (*mark)(void *);
|
||||
void (*destroy)(void *);
|
||||
} swig_class;
|
||||
Loading…
Add table
Add a link
Reference in a new issue