more typemaps unification and fixes for valgrind
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7684 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
464ae5b1b0
commit
3aac30b168
26 changed files with 484 additions and 74 deletions
111
SWIG/Lib/typemaps/carrays.swg
Normal file
111
SWIG/Lib/typemaps/carrays.swg
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* carrays.i
|
||||
*
|
||||
* Author(s): David Beazley (beazley@cs.uchicago.edu)
|
||||
*
|
||||
* This library file contains macros that can be used to manipulate simple
|
||||
* pointers as arrays.
|
||||
*
|
||||
* $Header$
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* %array_functions(TYPE,NAME)
|
||||
*
|
||||
* Generates functions for creating and accessing elements of a C array
|
||||
* (as pointers). Creates the following functions:
|
||||
*
|
||||
* TYPE *new_NAME(int nelements)
|
||||
* void delete_NAME(TYPE *);
|
||||
* TYPE NAME_getitem(TYPE *, int index);
|
||||
* void NAME_setitem(TYPE *, int index, TYPE value);
|
||||
*
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%define %array_functions(TYPE,NAME)
|
||||
%{
|
||||
static TYPE *new_##NAME(size_t nelements) {
|
||||
return SWIG_new_array(nelements, TYPE);
|
||||
}
|
||||
|
||||
static void delete_##NAME(TYPE *ary) {
|
||||
SWIG_delete_array(ary);
|
||||
}
|
||||
|
||||
static TYPE NAME##_getitem(TYPE *ary, size_t index) {
|
||||
return ary[index];
|
||||
}
|
||||
static void NAME##_setitem(TYPE *ary, size_t index, TYPE value) {
|
||||
ary[index] = value;
|
||||
}
|
||||
%}
|
||||
|
||||
TYPE *new_##NAME(size_t nelements);
|
||||
void delete_##NAME(TYPE *ary);
|
||||
TYPE NAME##_getitem(TYPE *ary, size_t index);
|
||||
void NAME##_setitem(TYPE *ary, size_t index, TYPE value);
|
||||
|
||||
%enddef
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* %array_class(TYPE,NAME)
|
||||
*
|
||||
* Generates a class wrapper around a C array. The class has the following
|
||||
* interface:
|
||||
*
|
||||
* struct NAME {
|
||||
* NAME(int nelements);
|
||||
* ~NAME();
|
||||
* TYPE getitem(int index);
|
||||
* void setitem(int index, TYPE value);
|
||||
* TYPE * cast();
|
||||
* static NAME *frompointer(TYPE *t);
|
||||
* }
|
||||
*
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%define %array_class(TYPE,NAME)
|
||||
%{
|
||||
typedef TYPE NAME;
|
||||
%}
|
||||
typedef struct NAME {
|
||||
/* Put language specific enhancements here */
|
||||
|
||||
#if defined(SWIGPYTHON) || defined(SWIGRUBY)
|
||||
%rename(__getitem__) getitem;
|
||||
%rename(__setitem__) setitem;
|
||||
#endif
|
||||
} NAME;
|
||||
|
||||
%extend NAME {
|
||||
|
||||
NAME(size_t nelements) {
|
||||
return SWIG_new_array(nelements, TYPE);
|
||||
}
|
||||
|
||||
~NAME() {
|
||||
SWIG_delete_array(self);
|
||||
}
|
||||
|
||||
TYPE getitem(size_t index) {
|
||||
return self[index];
|
||||
}
|
||||
|
||||
void setitem(size_t index, TYPE value) {
|
||||
self[index] = value;
|
||||
}
|
||||
|
||||
TYPE * cast() {
|
||||
return self;
|
||||
}
|
||||
|
||||
static NAME *frompointer(TYPE *t) {
|
||||
return SWIG_static_cast(t, NAME *);
|
||||
}
|
||||
};
|
||||
|
||||
%types(NAME = TYPE);
|
||||
|
||||
%enddef
|
||||
|
||||
114
SWIG/Lib/typemaps/cmalloc.swg
Normal file
114
SWIG/Lib/typemaps/cmalloc.swg
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* cmalloc.i
|
||||
*
|
||||
* Author(s): David Beazley (beazley@cs.uchicago.edu)
|
||||
*
|
||||
* This library file contains macros that can be used to create objects using
|
||||
* the C malloc function.
|
||||
*
|
||||
* $Header$
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <stdlib.h>
|
||||
%}
|
||||
|
||||
/* %malloc(TYPE [, NAME = TYPE])
|
||||
%calloc(TYPE [, NAME = TYPE])
|
||||
%realloc(TYPE [, NAME = TYPE])
|
||||
%free(TYPE [, NAME = TYPE])
|
||||
%allocators(TYPE [,NAME = TYPE])
|
||||
|
||||
Creates functions for allocating/reallocating memory.
|
||||
|
||||
TYPE *malloc_NAME(size_t nbytes = sizeof(TYPE);
|
||||
TYPE *calloc_NAME(size_t nobj=1, size_t size=sizeof(TYPE));
|
||||
TYPE *realloc_NAME(TYPE *ptr, size_t nbytes);
|
||||
void free_NAME(TYPE *ptr);
|
||||
|
||||
*/
|
||||
|
||||
%define %malloc(TYPE,NAME...)
|
||||
#if #NAME != ""
|
||||
%rename(malloc_##NAME) ::malloc(size_t nbytes);
|
||||
#else
|
||||
%rename(malloc_##TYPE) ::malloc(size_t nbytes);
|
||||
#endif
|
||||
|
||||
#if #TYPE != "void"
|
||||
%typemap(default) size_t nbytes "$1 = (size_t) sizeof(TYPE);"
|
||||
#endif
|
||||
TYPE *malloc(size_t nbytes);
|
||||
%typemap(default) size_t nbytes;
|
||||
%enddef
|
||||
|
||||
%define %calloc(TYPE,NAME...)
|
||||
#if #NAME != ""
|
||||
%rename(calloc_##NAME) ::calloc(size_t nobj, size_t sz);
|
||||
#else
|
||||
%rename(calloc_##TYPE) ::calloc(size_t nobj, size_t sz);
|
||||
#endif
|
||||
#if #TYPE != "void"
|
||||
%typemap(default) size_t sz "$1 = (size_t) sizeof(TYPE);"
|
||||
#else
|
||||
%typemap(default) size_t sz "$1 = 1;"
|
||||
#endif
|
||||
%typemap(default) size_t nobj "$1 = 1;"
|
||||
TYPE *calloc(size_t nobj, size_t sz);
|
||||
%typemap(default) size_t sz;
|
||||
%typemap(default) size_t nobj;
|
||||
%enddef
|
||||
|
||||
%define %realloc(TYPE,NAME...)
|
||||
%insert("header") {
|
||||
#if #NAME != ""
|
||||
TYPE *realloc_##NAME(TYPE *ptr, size_t nitems)
|
||||
#else
|
||||
TYPE *realloc_##TYPE(TYPE *ptr, size_t nitems)
|
||||
#endif
|
||||
{
|
||||
#if #TYPE != "void"
|
||||
return (TYPE *) realloc(ptr, nitems*sizeof(TYPE));
|
||||
#else
|
||||
return (TYPE *) realloc(ptr, nitems);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if #NAME != ""
|
||||
TYPE *realloc_##NAME(TYPE *ptr, size_t nitems);
|
||||
#else
|
||||
TYPE *realloc_##TYPE(TYPE *ptr, size_t nitems);
|
||||
#endif
|
||||
%enddef
|
||||
|
||||
%define %free(TYPE,NAME...)
|
||||
#if #NAME != ""
|
||||
%rename(free_##NAME) ::free(TYPE *ptr);
|
||||
#else
|
||||
%rename(free_##TYPE) ::free(TYPE *ptr);
|
||||
#endif
|
||||
void free(TYPE *ptr);
|
||||
%enddef
|
||||
|
||||
%define %sizeof(TYPE,NAME...)
|
||||
#if #NAME != ""
|
||||
%constant size_t sizeof_##NAME = sizeof(TYPE);
|
||||
#else
|
||||
%constant size_t sizeof_##TYPE = sizeof(TYPE);
|
||||
#endif
|
||||
%enddef
|
||||
|
||||
%define %allocators(TYPE,NAME...)
|
||||
%malloc(TYPE,NAME)
|
||||
%calloc(TYPE,NAME)
|
||||
%realloc(TYPE,NAME)
|
||||
%free(TYPE,NAME)
|
||||
#if #TYPE != "void"
|
||||
%sizeof(TYPE,NAME)
|
||||
#endif
|
||||
%enddef
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
160
SWIG/Lib/typemaps/cpointer.swg
Normal file
160
SWIG/Lib/typemaps/cpointer.swg
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* cpointer.i
|
||||
*
|
||||
* Author(s): David Beazley (beazley@cs.uchicago.edu)
|
||||
*
|
||||
* This library file contains macros that can be used to manipulate simple
|
||||
* pointer objects.
|
||||
*
|
||||
* $Header$
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* %pointer_class(type,name)
|
||||
*
|
||||
* Places a simple proxy around a simple type like 'int', 'float', or whatever.
|
||||
* The proxy provides this interface:
|
||||
*
|
||||
* class type {
|
||||
* public:
|
||||
* type();
|
||||
* ~type();
|
||||
* type value();
|
||||
* void assign(type value);
|
||||
* };
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* %pointer_class(int, intp);
|
||||
*
|
||||
* int add(int *x, int *y) { return *x + *y; }
|
||||
*
|
||||
* In python (with proxies)
|
||||
*
|
||||
* >>> a = intp()
|
||||
* >>> a.assign(10)
|
||||
* >>> a.value()
|
||||
* 10
|
||||
* >>> b = intp()
|
||||
* >>> b.assign(20)
|
||||
* >>> print add(a,b)
|
||||
* 30
|
||||
*
|
||||
* As a general rule, this macro should not be used on class/structures that
|
||||
* are already defined in the interface.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
%define %pointer_class(TYPE, NAME)
|
||||
%{
|
||||
typedef TYPE NAME;
|
||||
%}
|
||||
|
||||
typedef struct {
|
||||
} NAME;
|
||||
|
||||
%extend NAME {
|
||||
NAME() {
|
||||
return SWIG_new(TYPE);
|
||||
}
|
||||
~NAME() {
|
||||
if (self) SWIG_delete(self);
|
||||
}
|
||||
}
|
||||
|
||||
%extend NAME {
|
||||
|
||||
void assign(TYPE value) {
|
||||
*self = value;
|
||||
}
|
||||
TYPE value() {
|
||||
return *self;
|
||||
}
|
||||
TYPE * cast() {
|
||||
return self;
|
||||
}
|
||||
static NAME * frompointer(TYPE *t) {
|
||||
return (NAME *) t;
|
||||
}
|
||||
}
|
||||
|
||||
%types(NAME = TYPE);
|
||||
|
||||
%enddef
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* %pointer_functions(type,name)
|
||||
*
|
||||
* Create functions for allocating/deallocating pointers. This can be used
|
||||
* if you don't want to create a proxy class or if the pointer is complex.
|
||||
*
|
||||
* %pointer_functions(int, intp)
|
||||
*
|
||||
* int add(int *x, int *y) { return *x + *y; }
|
||||
*
|
||||
* In python (with proxies)
|
||||
*
|
||||
* >>> a = copy_intp(10)
|
||||
* >>> intp_value(a)
|
||||
* 10
|
||||
* >>> b = new_intp()
|
||||
* >>> intp_assign(b,20)
|
||||
* >>> print add(a,b)
|
||||
* 30
|
||||
* >>> delete_intp(a)
|
||||
* >>> delete_intp(b)
|
||||
*
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%define %pointer_functions(TYPE,NAME)
|
||||
%{
|
||||
static TYPE *new_##NAME() {
|
||||
return SWIG_new(TYPE);
|
||||
}
|
||||
|
||||
static TYPE *copy_##NAME(TYPE value) {
|
||||
return SWIG_new_copy(value, TYPE);
|
||||
}
|
||||
|
||||
static void delete_##NAME(TYPE *self) {
|
||||
if (self) SWIG_delete(self);
|
||||
}
|
||||
|
||||
static void NAME ##_assign(TYPE *self, TYPE value) {
|
||||
*self = value;
|
||||
}
|
||||
|
||||
static TYPE NAME ##_value(TYPE *self) {
|
||||
return *self;
|
||||
}
|
||||
%}
|
||||
|
||||
TYPE *new_##NAME();
|
||||
TYPE *copy_##NAME(TYPE value);
|
||||
void delete_##NAME(TYPE *self);
|
||||
void NAME##_assign(TYPE *self, TYPE value);
|
||||
TYPE NAME##_value(TYPE *self);
|
||||
|
||||
%enddef
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* %pointer_cast(type1,type2,name)
|
||||
*
|
||||
* Generates a pointer casting function.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%define %pointer_cast(TYPE1,TYPE2,NAME)
|
||||
%inline %{
|
||||
TYPE2 NAME(TYPE1 x) {
|
||||
return SWIG_static_cast(x, TYPE2);
|
||||
}
|
||||
%}
|
||||
%enddef
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -29,14 +29,14 @@
|
|||
|
||||
%define Name ## _input_binary(TYPEMAP, SIZE)
|
||||
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) (TYPEMAP, SIZE)
|
||||
(Char *buf, size_t size, int alloc) {
|
||||
(Char *buf = 0, size_t size = 0, int alloc = 0) {
|
||||
if (SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc) != SWIG_OK) {
|
||||
SWIG_arg_fail(SWIG_TypeError, "(TYPEMAP, SIZE)", $argnum);
|
||||
}
|
||||
$1 = ($1_ltype) buf;
|
||||
$2 = ($2_ltype) size - 1;
|
||||
}
|
||||
%typemap(freearg) (TYPEMAP, SIZE) {
|
||||
%typemap(freearg,noblock=1) (TYPEMAP, SIZE) {
|
||||
if (alloc$argnum == SWIG_NEWOBJ) SWIG_delete_array(buf$argnum);
|
||||
}
|
||||
%enddef
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
%typemap(in,noblock=1,numinputs=0) TYPEMAP (Char temp[MAX+1]) {
|
||||
$1 = ($1_ltype) temp;
|
||||
}
|
||||
%typemap(freearg) TYPEMAP "";
|
||||
%typemap(freearg,noblock=1) TYPEMAP "";
|
||||
%typemap(argout,noblock=1,fragment= #SWIG_FromCharPtr ) TYPEMAP {
|
||||
$1[MAX] = 0;
|
||||
SWIG_append_result(SWIG_FromCharPtr($1));
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
%typemap(in,noblock=1,numinputs=0) TYPEMAP(Char temp[SIZE]) {
|
||||
$1 = ($1_ltype) temp;
|
||||
}
|
||||
%typemap(freearg) TYPEMAP "";
|
||||
%typemap(freearg,noblock=1) TYPEMAP "";
|
||||
%typemap(argout,noblock=1,fragment= #SWIG_FromCharPtrAndSize) TYPEMAP {
|
||||
SWIG_append_result(SWIG_FromCharPtrAndSize($1,SIZE));
|
||||
}
|
||||
|
|
@ -108,7 +108,8 @@
|
|||
|
||||
|
||||
%define Name ## _bounded_mutable(TYPEMAP,MAX)
|
||||
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) TYPEMAP (Char temp[MAX+1], Char *t, size_t n, int alloc) {
|
||||
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) TYPEMAP
|
||||
(Char temp[MAX+1], Char *t = 0, size_t n = 0, int alloc = 0) {
|
||||
if (SWIG_AsCharPtrAndSize($input, &t, &n, &alloc) != SWIG_OK) {
|
||||
SWIG_arg_fail(SWIG_TypeError, "TYPEMAP", $argnum);
|
||||
}
|
||||
|
|
@ -118,7 +119,7 @@
|
|||
temp[n - 1] = 0;
|
||||
$1 = ($1_ltype) temp;
|
||||
}
|
||||
%typemap(freearg) TYPEMAP "";
|
||||
%typemap(freearg,noblock=1) TYPEMAP "";
|
||||
%typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP {
|
||||
$1[MAX] = 0;
|
||||
SWIG_append_result(SWIG_FromCharPtr($1));
|
||||
|
|
@ -143,7 +144,8 @@
|
|||
*/
|
||||
|
||||
%define Name ## _mutable(TYPEMAP,EXP...)
|
||||
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) TYPEMAP (Char* t, size_t n, int alloc, size_t expansion = 0) {
|
||||
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) TYPEMAP
|
||||
(Char* t = 0, size_t n = 0, int alloc = 0, size_t expansion = 0) {
|
||||
#if #EXP != ""
|
||||
expansion += EXP;
|
||||
#endif
|
||||
|
|
@ -155,7 +157,7 @@
|
|||
if (alloc == SWIG_NEWOBJ) SWIG_delete_array(t);
|
||||
$1[n-1] = 0;
|
||||
}
|
||||
%typemap(freearg) TYPEMAP "";
|
||||
%typemap(freearg,noblock=1) TYPEMAP "";
|
||||
%typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP {
|
||||
SWIG_append_result(SWIG_FromCharPtr($1));
|
||||
SWIG_delete_array($1);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
%define %implicit_frag(Type...) ,fragment=SWIG_Traits_frag(Type) %enddef
|
||||
|
||||
%define %implicit_code(Type...)
|
||||
if (swig::asval<Type >(obj, 0)) {
|
||||
if (swig::asval<Type >(obj, 0) == SWIG_OK) {
|
||||
Type _v;
|
||||
swig::asval<Type >(obj, &_v);
|
||||
if (val) *val = new value_type(_v);
|
||||
|
|
|
|||
|
|
@ -41,47 +41,44 @@
|
|||
/* directorout */
|
||||
|
||||
%define SWIG_PTR_DIRECTOROUT_TYPEMAP(asptr_meth,frag,Type...)
|
||||
%typemap(directorargout,fragment=frag) Type *DIRECTOROUT ($*1_ltype temp) {
|
||||
Type *ptr = 0;
|
||||
int res = $input ? asptr_meth($input, &ptr) : 0;
|
||||
if (!res || !ptr) {
|
||||
%typemap(directorargout,noblock=1,fragment=frag) Type *DIRECTOROUT ($*ltype temp) {
|
||||
Type *optr = 0;
|
||||
int ores = $input ? asptr_meth($input, &optr) : 0;
|
||||
if (!ores || !optr) {
|
||||
SWIG_dout_fail(SWIG_TypeError,"$type");
|
||||
} else {
|
||||
temp = *ptr;
|
||||
$result = &temp;
|
||||
if (res == SWIG_NEWOBJ) SWIG_delete(ptr);
|
||||
}
|
||||
temp = *optr;
|
||||
$result = &temp;
|
||||
if (ores == SWIG_NEWOBJ) SWIG_delete(optr);
|
||||
}
|
||||
|
||||
%typemap(directorout,fragment=frag) Type {
|
||||
Type *ptr = 0;
|
||||
int res = asptr_meth($input, &ptr);
|
||||
if (!res || !ptr) {
|
||||
%typemap(directorout,noblock=1,fragment=frag) Type {
|
||||
Type *optr = 0;
|
||||
int ores = asptr_meth($input, &optr);
|
||||
if (!ores || !optr) {
|
||||
SWIG_dout_fail(SWIG_TypeError,"$type");
|
||||
} else {
|
||||
$result = *ptr;
|
||||
if (res == SWIG_NEWOBJ) SWIG_delete(ptr);
|
||||
}
|
||||
$result = *optr;
|
||||
if (ores == SWIG_NEWOBJ) SWIG_delete(optr);
|
||||
}
|
||||
|
||||
%typemap(directorout,fragment=frag,warning=SWIG_WARN_TYPEMAP_THREAD_UNSAFE) const Type& {
|
||||
Type *ptr = 0;
|
||||
int res = asptr_meth($input, &ptr);
|
||||
if (!res) {
|
||||
%typemap(directorout,noblock=1,fragment=frag,warning=SWIG_WARN_TYPEMAP_THREAD_UNSAFE) const Type& {
|
||||
Type *optr = 0;
|
||||
int ores = asptr_meth($input, &optr);
|
||||
if (!ores) {
|
||||
SWIG_dout_fail(SWIG_TypeError,"$type");
|
||||
} else {
|
||||
if (!ptr) {
|
||||
if (!optr) {
|
||||
SWIG_dout_nullref("$type");
|
||||
} else {
|
||||
if (res == SWIG_NEWOBJ) {
|
||||
/* Possible thread/reentrant problem here! */
|
||||
static $*ltype temp = *ptr;
|
||||
$result = &temp;
|
||||
SWIG_delete(ptr);
|
||||
} else {
|
||||
$result = ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ores == SWIG_NEWOBJ) {
|
||||
/* Possible thread/reentrant problem here! */
|
||||
static $*ltype temp = *optr;
|
||||
$result = &temp;
|
||||
SWIG_delete(optr);
|
||||
} else {
|
||||
$result = optr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -115,12 +112,12 @@
|
|||
{
|
||||
Type *v = (Type *)0;
|
||||
int res = SWIG_AsPtr(Type)(obj, &v);
|
||||
if (!res || !v) return 0;
|
||||
if (!res || !v) return SWIG_ERROR;
|
||||
if (val) {
|
||||
*val = *v;
|
||||
if (res == SWIG_NEWOBJ) SWIG_delete(v);
|
||||
}
|
||||
return 1;
|
||||
return SWIG_OK;
|
||||
}
|
||||
%}
|
||||
%fragment(SWIG_As_frag(Type),"header",
|
||||
|
|
|
|||
|
|
@ -39,8 +39,7 @@
|
|||
if (alloc$argnum == SWIG_NEWOBJ) SWIG_delete_array(buf$argnum);
|
||||
}
|
||||
|
||||
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtr) Char const*& (Char *buf, int alloc)
|
||||
{
|
||||
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtr) Char const*& (Char *buf = 0, int alloc = 0) {
|
||||
if (SWIG_AsCharPtr($input, &buf, &alloc) != SWIG_OK) {
|
||||
SWIG_arg_fail(SWIG_TypeError,"$type",$argnum);
|
||||
}
|
||||
|
|
@ -149,7 +148,7 @@
|
|||
|
||||
/* directorin */
|
||||
|
||||
%typemap(directorin,fragment=#SWIG_FromCharPtr,noblock=1)
|
||||
%typemap(directorin,noblock=1,fragment=#SWIG_FromCharPtr)
|
||||
Char *, Char const*, Char *const, Char const *const,
|
||||
Char const *&, Char *const &, Char const *const & {
|
||||
$input = SWIG_FromCharPtr($1_name);
|
||||
|
|
@ -158,14 +157,14 @@
|
|||
|
||||
/* directorout */
|
||||
|
||||
%typemap(directorout,fragment=#SWIG_AsCharPtr,noblock=1) Char * (Char* buf, int alloc) {
|
||||
%typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr) Char * (Char* buf = 0, int alloc = 0) {
|
||||
if (SWIG_AsCharPtr($input, &buf, &alloc) != SWIG_OK) {
|
||||
SWIG_dout_fail(SWIG_TypeError, "$type");
|
||||
}
|
||||
$result = buf;
|
||||
}
|
||||
|
||||
%typemap(directorout,fragment=#SWIG_AsCharPtr) Char * const& (Char* buf, int alloc) {
|
||||
%typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr) Char * const& (Char* buf = 0, int alloc = 0) {
|
||||
if (SWIG_AsCharPtr($input, &buf, &alloc) != SWIG_OK) {
|
||||
SWIG_dout_fail(SWIG_TypeError, "$type");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
/* Pointers and arrays */
|
||||
%typemap(in, noblock=1) SWIGTYPE *, SWIGTYPE [] {
|
||||
if (SWIG_ConvertPtr($input, SWIG_as_voidptrptr(&$1), $descriptor, $disown) != SWIG_OK) {
|
||||
if (SWIG_ConvertPtr($input, SWIG_as_voidptrptr(&$1),$descriptor, $disown) != SWIG_OK) {
|
||||
SWIG_arg_fail(SWIG_TypeError, "$type", $argnum);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue