Add (and use) the SWIG_POINTER_EXCEPTION and SWIG_POINTER_DISOWN flags
for the Ruby runtime support. Have not actually implemented support for "disowning" Ruby pointers yet. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5122 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ce97184374
commit
87a1b982e3
2 changed files with 6 additions and 2 deletions
|
|
@ -100,14 +100,14 @@ SWIG_ConvertPtr(VALUE obj, void **ptr, swig_type_info *ty, int flags)
|
|||
}
|
||||
}
|
||||
if ((c = SWIG_MangleStr(obj)) == NULL) {
|
||||
if (flags)
|
||||
if (flags & SWIG_POINTER_EXCEPTION)
|
||||
rb_raise(rb_eTypeError, "Expected %s", ty->str);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
tc = SWIG_TypeCheck(c, ty);
|
||||
if (!tc) {
|
||||
if (flags)
|
||||
if (flags & SWIG_POINTER_EXCEPTION)
|
||||
rb_raise(rb_eTypeError, "Expected %s", ty->str);
|
||||
else
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
#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) \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue