add implicitconv support and cosmetics for cast rank
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8095 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e4e72e63fa
commit
0e4b388ec9
24 changed files with 484 additions and 308 deletions
|
|
@ -34,13 +34,13 @@ SWIG_AsVal_dec(long)(SV *obj, long* val)
|
|||
} else {
|
||||
if (*endptr == '\0') {
|
||||
if (val) *val = v;
|
||||
return SWIG_CastRank(SWIG_OK);
|
||||
return SWIG_AddCast(SWIG_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!dispatch) {
|
||||
double d;
|
||||
int res = SWIG_CastRank(SWIG_AsVal(double)(obj,&d));
|
||||
int res = SWIG_AddCast(SWIG_AsVal(double)(obj,&d));
|
||||
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
|
||||
if (val) *val = (long)(d);
|
||||
return res;
|
||||
|
|
@ -92,13 +92,13 @@ SWIG_AsVal_dec(unsigned long)(SV *obj, unsigned long *val)
|
|||
} else {
|
||||
if (*endptr == '\0') {
|
||||
if (val) *val = v;
|
||||
return SWIG_CastRank(SWIG_OK);
|
||||
return SWIG_AddCast(SWIG_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!dispatch) {
|
||||
double d;
|
||||
int res = SWIG_CastRank(SWIG_AsVal(double)(obj,&d));
|
||||
int res = SWIG_AddCast(SWIG_AsVal(double)(obj,&d));
|
||||
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
|
||||
if (val) *val = (unsigned long)(d);
|
||||
return res;
|
||||
|
|
@ -151,13 +151,13 @@ SWIG_AsVal_dec(long long)(SV *obj, long long *val)
|
|||
} else {
|
||||
if (*endptr == '\0') {
|
||||
if (val) *val = v;
|
||||
return SWIG_CastRank(SWIG_OK);
|
||||
return SWIG_AddCast(SWIG_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!dispatch) {
|
||||
double d;
|
||||
int res = SWIG_CastRank(SWIG_AsVal(double)(obj,&d));
|
||||
int res = SWIG_AddCast(SWIG_AsVal(double)(obj,&d));
|
||||
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LLONG_MIN, LLONG_MAX)) {
|
||||
if (val) *val = (long long)(d);
|
||||
return res;
|
||||
|
|
@ -209,13 +209,13 @@ SWIG_AsVal_dec(unsigned long long)(SV *obj, unsigned long long *val)
|
|||
} else {
|
||||
if (*endptr == '\0') {
|
||||
if (val) *val = v;
|
||||
return SWIG_CastRank(SWIG_OK);
|
||||
return SWIG_AddCast(SWIG_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!dispatch) {
|
||||
double d;
|
||||
int res = SWIG_CastRank(SWIG_AsVal(double)(obj,&d));
|
||||
int res = SWIG_AddCast(SWIG_AsVal(double)(obj,&d));
|
||||
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULLONG_MAX)) {
|
||||
if (val) *val = (unsigned long long)(d);
|
||||
return res;
|
||||
|
|
@ -247,7 +247,7 @@ SWIG_AsVal_dec(double)(SV *obj, double *val)
|
|||
return SWIG_OK;
|
||||
} else if (SvIOK(obj)) {
|
||||
if (val) *val = (double) SvIV(obj);
|
||||
return SWIG_CastRank(SWIG_OK);
|
||||
return SWIG_AddCast(SWIG_OK);
|
||||
} else {
|
||||
const char *nptr = SvPV(obj, PL_na);
|
||||
if (nptr) {
|
||||
|
|
@ -259,7 +259,7 @@ SWIG_AsVal_dec(double)(SV *obj, double *val)
|
|||
} else {
|
||||
if (*endptr == '\0') {
|
||||
if (val) *val = v;
|
||||
return SWIG_CastRank(SWIG_OK);
|
||||
return SWIG_AddCast(SWIG_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,19 +28,14 @@ SWIG_AsArgcArgv(PyObject* input,
|
|||
argv[i] = 0;
|
||||
}
|
||||
} else {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
PyErr_Clear();
|
||||
PyErr_SetString(PyExc_TypeError,"list or tuple must contain strings only");
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
SWIG_Error(SWIG_TypeError,"list or tuple must contain strings only");
|
||||
}
|
||||
}
|
||||
argv[i] = 0;
|
||||
return argv;
|
||||
} else {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
*argc = 0;
|
||||
PyErr_SetString(PyExc_TypeError,"a list or tuple is expected");
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
SWIG_Error(SWIG_TypeError,"a list or tuple is expected");
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,2 +1,7 @@
|
|||
%include <std_common.i>
|
||||
%include <typemaps/implicit.swg>
|
||||
|
||||
#warning "This file provide the %implicit directive, which is an old and fragil"
|
||||
#warning "way to implement the C++ implicit conversion mechanism."
|
||||
#warning "Try using the more robust '%implicitconv Type;' directive instead."
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ SWIG_AsVal(Type) (PyObject *o, Type* val)
|
|||
return SWIG_OK;
|
||||
} else {
|
||||
double d;
|
||||
int res = SWIG_CastRank(SWIG_AsVal(double)(o, &d));
|
||||
int res = SWIG_AddCast(SWIG_AsVal(double)(o, &d));
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = Constructor(d, 0.0);
|
||||
return res;
|
||||
|
|
@ -63,7 +63,7 @@ SWIG_AsVal(Type)(PyObject *o, Type *val)
|
|||
}
|
||||
} else {
|
||||
float re;
|
||||
int res = SWIG_CastRank(SWIG_AsVal(float)(o, &re));
|
||||
int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re));
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = Constructor(re, 0.0);
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -702,7 +702,7 @@ namespace swig {
|
|||
PyErr_SetString(PyExc_TypeError, e.what());
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
} else {
|
||||
sequence *p;
|
||||
|
|
@ -716,7 +716,7 @@ namespace swig {
|
|||
PyErr_Format(PyExc_TypeError, "a %s is expected",
|
||||
swig::type_name<sequence>());
|
||||
}
|
||||
return 0;
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ SWIG_AsVal_dec(bool)(PyObject *obj, bool *val)
|
|||
return SWIG_OK;
|
||||
} else {
|
||||
long v = 0;
|
||||
int res = SWIG_CastRank(SWIG_AsVal(long)(obj, val ? &v : 0));
|
||||
int res = SWIG_AddCast(SWIG_AsVal(long)(obj, val ? &v : 0));
|
||||
if (SWIG_IsOK(res) && val) *val = v ? true : false;
|
||||
return res;
|
||||
}
|
||||
|
|
@ -64,13 +64,13 @@ SWIG_AsVal_dec(long)(PyObject *obj, long* val)
|
|||
long v = PyInt_AsLong(obj);
|
||||
if (!PyErr_Occurred()) {
|
||||
if (val) *val = v;
|
||||
return SWIG_CastRank(SWIG_OK);
|
||||
return SWIG_AddCast(SWIG_OK);
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
}
|
||||
if (!dispatch) {
|
||||
double d;
|
||||
int res = SWIG_CastRank(SWIG_AsVal(double)(obj,&d));
|
||||
int res = SWIG_AddCast(SWIG_AsVal(double)(obj,&d));
|
||||
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
|
||||
if (val) *val = (long)(d);
|
||||
return res;
|
||||
|
|
@ -123,7 +123,7 @@ SWIG_AsVal_dec(unsigned long)(PyObject *obj, unsigned long *val)
|
|||
if (!PyErr_Occurred()) {
|
||||
if (v >= 0) {
|
||||
if (val) *val = v;
|
||||
return SWIG_CastRank(SWIG_OK);
|
||||
return SWIG_AddCast(SWIG_OK);
|
||||
} else {
|
||||
return SWIG_OverflowError;
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ SWIG_AsVal_dec(unsigned long)(PyObject *obj, unsigned long *val)
|
|||
}
|
||||
if (!dispatch) {
|
||||
double d;
|
||||
int res = SWIG_CastRank(SWIG_AsVal(double)(obj,&d));
|
||||
int res = SWIG_AddCast(SWIG_AsVal(double)(obj,&d));
|
||||
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
|
||||
if (val) *val = (unsigned long)(d);
|
||||
return res;
|
||||
|
|
@ -181,13 +181,13 @@ SWIG_AsVal_dec(long long)(PyObject *obj, long long *val)
|
|||
long v = PyInt_AsLong(obj);
|
||||
if (!PyErr_Occurred()) {
|
||||
if (val) *val = v;
|
||||
return SWIG_CastRank(SWIG_OK);
|
||||
return SWIG_AddCast(SWIG_OK);
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
}
|
||||
if (!dispatch) {
|
||||
double d;
|
||||
int res = SWIG_CastRank(SWIG_AsVal(double)(obj,&d));
|
||||
int res = SWIG_AddCast(SWIG_AsVal(double)(obj,&d));
|
||||
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LLONG_MIN, LLONG_MAX)) {
|
||||
if (val) *val = (long long)(d);
|
||||
return res;
|
||||
|
|
@ -240,7 +240,7 @@ SWIG_AsVal_dec(unsigned long long)(PyObject *obj, unsigned long long *val)
|
|||
if (!PyErr_Occurred()) {
|
||||
if (v >= 0) {
|
||||
if (val) *val = v;
|
||||
return SWIG_CastRank(SWIG_OK);
|
||||
return SWIG_AddCast(SWIG_OK);
|
||||
} else {
|
||||
return SWIG_OverflowError;
|
||||
}
|
||||
|
|
@ -249,7 +249,7 @@ SWIG_AsVal_dec(unsigned long long)(PyObject *obj, unsigned long long *val)
|
|||
}
|
||||
if (!dispatch) {
|
||||
double d;
|
||||
int res = SWIG_CastRank(SWIG_AsVal(double)(obj,&d));
|
||||
int res = SWIG_AddCast(SWIG_AsVal(double)(obj,&d));
|
||||
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULLONG_MAX)) {
|
||||
if (val) *val = (unsigned long)(d);
|
||||
return res;
|
||||
|
|
@ -292,7 +292,7 @@ SWIG_AsVal_dec(double)(PyObject *obj, double *val)
|
|||
double d = PyFloat_AsDouble(obj);
|
||||
if (!PyErr_Occurred()) {
|
||||
if (val) *val = d;
|
||||
return SWIG_CastRank(SWIG_OK);
|
||||
return SWIG_AddCast(SWIG_OK);
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
}
|
||||
|
|
@ -300,7 +300,7 @@ SWIG_AsVal_dec(double)(PyObject *obj, double *val)
|
|||
long v = PyInt_AsLong(obj);
|
||||
if (!PyErr_Occurred()) {
|
||||
if (val) *val = v;
|
||||
return SWIG_CastRank(SWIG_CastRank(SWIG_OK));
|
||||
return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
|
||||
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
|
||||
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags)
|
||||
#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
|
||||
#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
|
||||
#define swig_owntype int
|
||||
|
||||
|
|
@ -41,6 +42,13 @@
|
|||
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
|
||||
#define SWIG_NewClientData(obj) PySwigClientData_New(obj)
|
||||
|
||||
/* A functor is a function object with one single object argument */
|
||||
#if PY_VERSION_HEX >= 0x02020000
|
||||
#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
|
||||
#else
|
||||
#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj);
|
||||
#endif
|
||||
|
||||
/* Error manipulation */
|
||||
#define SWIG_SetErrorObj(type, obj) {SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetObject(type, obj); SWIG_PYTHON_THREAD_END_BLOCK; }
|
||||
#define SWIG_SetErrorMsg(type, msg) {SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetString(type, msg); SWIG_PYTHON_THREAD_END_BLOCK; }
|
||||
|
|
@ -48,6 +56,7 @@
|
|||
#define SWIG_Error(code, msg) SWIG_SetErrorMsg(SWIG_Python_ErrorType(code), msg)
|
||||
#define SWIG_fail goto fail
|
||||
|
||||
|
||||
/*
|
||||
Helper for static pointer initialization for both C and C++ code, for example
|
||||
static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
|
||||
|
|
@ -63,8 +72,10 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* Flags for new pointer objects */
|
||||
#define SWIG_POINTER_NOSHADOW SWIG_POINTER_OWN << 1
|
||||
#define SWIG_POINTER_NEW SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN
|
||||
#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
|
||||
#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
|
||||
|
||||
#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
|
||||
|
||||
/* For backward compatibility only */
|
||||
#define SWIG_POINTER_EXCEPTION 0
|
||||
|
|
@ -175,8 +186,17 @@ typedef struct {
|
|||
PyObject *newargs;
|
||||
PyObject *destroy;
|
||||
int delargs;
|
||||
int implicitconv;
|
||||
} PySwigClientData;
|
||||
|
||||
SWIGRUNTIME int
|
||||
SWIG_Python_CheckImplicit(swig_type_info *ty)
|
||||
{
|
||||
PySwigClientData *data = (PySwigClientData *)ty->clientdata;
|
||||
return data ? data->implicitconv : 0;
|
||||
}
|
||||
|
||||
|
||||
SWIGRUNTIME PySwigClientData *
|
||||
PySwigClientData_New(PyObject* obj)
|
||||
{
|
||||
|
|
@ -222,6 +242,7 @@ PySwigClientData_New(PyObject* obj)
|
|||
} else {
|
||||
data->delargs = 0;
|
||||
}
|
||||
data->implicitconv = 0;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
|
@ -358,11 +379,7 @@ PySwigObject_dealloc(PyObject *v)
|
|||
if (data->delargs) {
|
||||
/* we need to create a temporal object to carry the destroy operation */
|
||||
PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
|
||||
#if PY_VERSION_HEX >= 0x02020000
|
||||
res = PyObject_CallFunctionObjArgs(destroy, tmp, NULL);
|
||||
#else
|
||||
res = PyObject_CallFunction(destroy, "O", tmp);
|
||||
#endif
|
||||
res = SWIG_Python_CallFunctor(destroy, tmp);
|
||||
Py_DECREF(tmp);
|
||||
} else {
|
||||
PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
|
||||
|
|
@ -902,7 +919,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
|
|||
if (!tc) {
|
||||
sobj = (PySwigObject *)sobj->next;
|
||||
} else {
|
||||
*ptr = SWIG_TypeCast(tc,vptr);
|
||||
if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -918,7 +935,42 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
|
|||
}
|
||||
return SWIG_OK;
|
||||
} else {
|
||||
return SWIG_ERROR;
|
||||
int res = SWIG_ERROR;
|
||||
if (flags & SWIG_POINTER_IMPLICIT_CONV) {
|
||||
PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
|
||||
if (data && !data->implicitconv) {
|
||||
PyObject *klass = data->klass;
|
||||
if (klass) {
|
||||
PyObject *impconv;
|
||||
data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
|
||||
impconv = SWIG_Python_CallFunctor(klass, obj);
|
||||
data->implicitconv = 0;
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_Clear();
|
||||
impconv = 0;
|
||||
}
|
||||
if (impconv) {
|
||||
PySwigObject *sobj = SWIG_Python_GetSwigThis(impconv);
|
||||
if (sobj) {
|
||||
void *vptr;
|
||||
res = SWIG_Python_ConvertPtrAndOwn((PyObject*)sobj, &vptr, ty, 0, 0);
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (ptr) {
|
||||
*ptr = vptr;
|
||||
/* transfer the ownership to 'ptr' */
|
||||
sobj->own = 0;
|
||||
res = SWIG_AddNewMask(SWIG_AddCast(res));
|
||||
} else {
|
||||
res = SWIG_AddCast(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
Py_DECREF(impconv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace swig {
|
|||
static int asptr(PyObject *obj, Type **val) {
|
||||
Type *p;
|
||||
int res = (SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0) == SWIG_OK) ? SWIG_OLDOBJ : 0;
|
||||
if (res) {
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = p;
|
||||
}
|
||||
return res;
|
||||
|
|
@ -57,17 +57,21 @@ namespace swig {
|
|||
static int asval(PyObject *obj, Type *val) {
|
||||
if (val) {
|
||||
Type *p = 0;
|
||||
int res = traits_asptr<Type>::asptr(obj, (val ? &p : 0));
|
||||
if ((res != 0) && p) {
|
||||
int res = traits_asptr<Type>::asptr(obj, &p);
|
||||
if (!SWIG_IsOK(res)) return res;
|
||||
if (p) {
|
||||
typedef typename noconst_traits<Type>::noconst_type noconst_type;
|
||||
*(const_cast<noconst_type*>(val)) = *p;
|
||||
if (res == SWIG_NEWOBJ) %delete(p);
|
||||
return SWIG_OK;
|
||||
if (SWIG_IsNewObj(res)){
|
||||
%delete(p);
|
||||
res = SWIG_DelNewMask(res);
|
||||
}
|
||||
return res;
|
||||
} else {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
} else {
|
||||
return traits_asptr<Type>::asptr(obj, (Type **)(0)) ? SWIG_OK : SWIG_ERROR;
|
||||
return traits_asptr<Type>::asptr(obj, (Type **)(0));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -77,15 +81,13 @@ namespace swig {
|
|||
if (val) {
|
||||
typedef typename noconst_traits<Type>::noconst_type noconst_type;
|
||||
noconst_type *p = 0;
|
||||
int res = traits_asptr<noconst_type>::asptr(obj, (val ? &p : 0));
|
||||
if (res) {
|
||||
int res = traits_asptr<noconst_type>::asptr(obj, &p);
|
||||
if (SWIG_IsOK(res)) {
|
||||
*(const_cast<noconst_type**>(val)) = p;
|
||||
return SWIG_OK;
|
||||
} else {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
return res;
|
||||
} else {
|
||||
return traits_asptr<Type>::asptr(obj, (Type **)(0)) ? SWIG_OK : SWIG_ERROR;
|
||||
return traits_asptr<Type>::asptr(obj, (Type **)(0));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -113,9 +115,9 @@ namespace swig {
|
|||
struct traits_as<Type, pointer_category> {
|
||||
static Type as(PyObject *obj, bool throw_error) {
|
||||
Type *v = 0;
|
||||
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : 0);
|
||||
if (res && v) {
|
||||
if (res == SWIG_NEWOBJ) {
|
||||
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
|
||||
if (SWIG_IsOK(res) && v) {
|
||||
if (SWIG_IsNewObj(res)) {
|
||||
Type r(*v);
|
||||
%delete(v);
|
||||
return r;
|
||||
|
|
@ -139,8 +141,8 @@ namespace swig {
|
|||
struct traits_as<Type*, pointer_category> {
|
||||
static Type* as(PyObject *obj, bool throw_error) {
|
||||
Type *v = 0;
|
||||
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : 0);
|
||||
if (res) {
|
||||
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
|
||||
if (SWIG_IsOK(res)) {
|
||||
return v;
|
||||
} else {
|
||||
if (!PyErr_Occurred()) {
|
||||
|
|
@ -215,7 +217,7 @@ namespace swig {
|
|||
typedef Type value_type;
|
||||
static int asval(PyObject *obj, value_type *val) {
|
||||
if (Check(obj)) {
|
||||
*val = As(obj);
|
||||
if (val) *val = As(obj);
|
||||
return SWIG_OK;
|
||||
}
|
||||
return SWIG_ERROR;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@
|
|||
#define SWIG_Object PyObject *
|
||||
#define VOID_Object SWIG_Py_Void()
|
||||
|
||||
/* Python allows implicit conversion */
|
||||
#define %implicitconv_flag $implicitconv
|
||||
|
||||
|
||||
/* Overload of the output/constant/exception/dirout handling */
|
||||
|
||||
/* append output */
|
||||
|
|
@ -63,6 +67,7 @@
|
|||
SWIG_fail %enddef
|
||||
|
||||
|
||||
|
||||
/* Include the unified typemap library */
|
||||
%include <typemaps/swigtypemaps.swg>
|
||||
|
||||
|
|
|
|||
|
|
@ -152,11 +152,9 @@ These methods "may be called" if needed.
|
|||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/*
|
||||
Directors
|
||||
Implicit Conversion using the C++ constructor mechanism
|
||||
*/
|
||||
|
||||
#define %director %feature("director")
|
||||
#define %nodirector %feature("director","0")
|
||||
#define %cleardirector %feature("director","")
|
||||
|
||||
|
||||
#define %implicitconv %feature("implicitconv")
|
||||
#define %noimplicitconv %feature("implicitconv", "0")
|
||||
#define %clearimplicitconv %feature("implicitconv", "")
|
||||
|
|
|
|||
|
|
@ -17,22 +17,20 @@
|
|||
{
|
||||
if (val) {
|
||||
T *pfirst = &(val->first);
|
||||
int res1 = swig::asval((PyObject*)first, pfirst);
|
||||
if (!SWIG_IsOK(res1)) return res1;
|
||||
U *psecond = &(val->second);
|
||||
if ((swig::asval((PyObject*)first, pfirst) == SWIG_OK)
|
||||
&& (swig::asval((PyObject*)second, psecond) == SWIG_OK)) {
|
||||
return SWIG_OK;
|
||||
} else {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
int res2 = swig::asval((PyObject*)second, psecond);
|
||||
if (!SWIG_IsOK(res2)) return res2;
|
||||
return res1 > res2 ? res1 : res2;
|
||||
} else {
|
||||
T *pfirst = 0;
|
||||
int res1 = swig::asval((PyObject*)first, 0);
|
||||
if (!SWIG_IsOK(res1)) return res1;
|
||||
U *psecond = 0;
|
||||
if ((swig::asval((PyObject*)first, pfirst) == SWIG_OK)
|
||||
&& (swig::asval((PyObject*)second, psecond) == SWIG_OK)) {
|
||||
return SWIG_OK;
|
||||
} else {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
int res2 = swig::asval((PyObject*)second, psecond);
|
||||
if (!SWIG_IsOK(res2)) return res2;
|
||||
return res1 > res2 ? res1 : res2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -50,13 +48,8 @@
|
|||
}
|
||||
} else {
|
||||
value_type *p;
|
||||
if (SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0) == SWIG_OK) {
|
||||
if (val) *val = *p;
|
||||
res = SWIG_OK;
|
||||
}
|
||||
}
|
||||
if ((res == SWIG_ERROR) && val) {
|
||||
PyErr_Format(PyExc_TypeError, "a %s is expected", swig::type_name<value_type>());
|
||||
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0);
|
||||
if (SWIG_IsOK(res) && val) *val = *p;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
@ -73,29 +66,26 @@
|
|||
if (val) {
|
||||
value_type *vp = %new_instance(std::pair<T,U>);
|
||||
T *pfirst = &(vp->first);
|
||||
int res1 = swig::asval((PyObject*)first, pfirst);
|
||||
if (!SWIG_IsOK(res1)) return res1;
|
||||
U *psecond = &(vp->second);
|
||||
if ((swig::asval((PyObject*)first, pfirst) == SWIG_OK)
|
||||
&& (swig::asval((PyObject*)second, psecond) == SWIG_OK)) {
|
||||
*val = vp;
|
||||
return SWIG_NEWOBJ;
|
||||
} else {
|
||||
%delete(vp);
|
||||
return SWIG_BADOBJ;
|
||||
}
|
||||
int res2 = swig::asval((PyObject*)second, psecond);
|
||||
if (!SWIG_IsOK(res2)) return res2;
|
||||
*val = vp;
|
||||
return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
|
||||
} else {
|
||||
T *pfirst = 0;
|
||||
int res1 = swig::asval((PyObject*)first, pfirst);
|
||||
if (!SWIG_IsOK(res1)) return res1;
|
||||
U *psecond = 0;
|
||||
if ((swig::asval((PyObject*)first, pfirst) == SWIG_OK)
|
||||
&& (swig::asval((PyObject*)second, psecond) == SWIG_OK)) {
|
||||
return SWIG_NEWOBJ;
|
||||
} else {
|
||||
return SWIG_BADOBJ;
|
||||
}
|
||||
int res2 = swig::asval((PyObject*)second, psecond);
|
||||
if (!SWIG_IsOK(res2)) return res2;
|
||||
return res1 > res2 ? res1 : res2;
|
||||
}
|
||||
}
|
||||
|
||||
static int asptr(PyObject *obj, std::pair<T,U> **val) {
|
||||
int res = SWIG_BADOBJ;
|
||||
int res = SWIG_ERROR;
|
||||
if (PyTuple_Check(obj)) {
|
||||
if (PyTuple_GET_SIZE(obj) == 2) {
|
||||
res = get_pair(PyTuple_GET_ITEM(obj,0),PyTuple_GET_ITEM(obj,1), val);
|
||||
|
|
@ -108,13 +98,8 @@
|
|||
}
|
||||
} else {
|
||||
value_type *p;
|
||||
if (SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0) == SWIG_OK) {
|
||||
if (val) *val = p;
|
||||
res = SWIG_OLDOBJ;
|
||||
}
|
||||
}
|
||||
if ((res == SWIG_BADOBJ) && val) {
|
||||
PyErr_Format(PyExc_TypeError, "a %s is expected", swig::type_name<value_type>());
|
||||
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0);
|
||||
if (SWIG_IsOK(res) && val) *val = p;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
%define Name ## _input_binary(TYPEMAP, SIZE)
|
||||
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) (TYPEMAP, SIZE)
|
||||
(Char *buf = 0, size_t size = 0, int alloc = 0) {
|
||||
if (SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc))) {
|
||||
%argument_fail(SWIG_TypeError, "(TYPEMAP, SIZE)", $argnum);
|
||||
}
|
||||
$1 = ($1_ltype) buf;
|
||||
|
|
@ -61,7 +61,6 @@
|
|||
%typemap(in,noblock=1,numinputs=0) TYPEMAP (Char temp[MAX+1]) {
|
||||
$1 = ($1_ltype) temp;
|
||||
}
|
||||
%typemap(freearg,noblock=1) TYPEMAP "";
|
||||
%typemap(argout,noblock=1,fragment= #SWIG_FromCharPtr ) TYPEMAP {
|
||||
$1[MAX] = 0;
|
||||
%append_output(SWIG_FromCharPtr($1));
|
||||
|
|
@ -87,7 +86,6 @@
|
|||
%typemap(in,noblock=1,numinputs=0) TYPEMAP(Char temp[SIZE]) {
|
||||
$1 = ($1_ltype) temp;
|
||||
}
|
||||
%typemap(freearg,noblock=1) TYPEMAP "";
|
||||
%typemap(argout,noblock=1,fragment= #SWIG_FromCharPtrAndSize) TYPEMAP {
|
||||
%append_output(SWIG_FromCharPtrAndSize($1,SIZE));
|
||||
}
|
||||
|
|
@ -114,7 +112,7 @@
|
|||
%define Name ## _bounded_mutable(TYPEMAP,MAX)
|
||||
%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) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &t, &n, &alloc))) {
|
||||
%argument_fail(SWIG_TypeError, "TYPEMAP", $argnum);
|
||||
}
|
||||
if ( n > (size_t) MAX ) n = (size_t) MAX;
|
||||
|
|
@ -123,7 +121,6 @@
|
|||
temp[n - 1] = 0;
|
||||
$1 = ($1_ltype) temp;
|
||||
}
|
||||
%typemap(freearg,noblock=1) TYPEMAP "";
|
||||
%typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP {
|
||||
$1[MAX] = 0;
|
||||
%append_output(SWIG_FromCharPtr($1));
|
||||
|
|
@ -153,7 +150,7 @@
|
|||
#if #EXP != ""
|
||||
expansion += EXP;
|
||||
#endif
|
||||
if (SWIG_AsCharPtrAndSize($input, &t, &n, &alloc) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &t, &n, &alloc))) {
|
||||
%argument_fail(SWIG_TypeError, "TYPEMAP", $argnum);
|
||||
}
|
||||
$1 = %new_array(n+expansion, $*1_ltype);
|
||||
|
|
@ -161,7 +158,6 @@
|
|||
if (alloc == SWIG_NEWOBJ) %delete_array(t);
|
||||
$1[n-1] = 0;
|
||||
}
|
||||
%typemap(freearg,noblock=1) TYPEMAP "";
|
||||
%typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP {
|
||||
%append_output(SWIG_FromCharPtr($1));
|
||||
%delete_array($1);
|
||||
|
|
@ -246,7 +242,6 @@
|
|||
%typemap(in,noblock=1,numinputs=0) TYPEMAP($*1_ltype temp = 0) {
|
||||
$1 = &temp;
|
||||
}
|
||||
%typemap(freearg) TYPEMAP "";
|
||||
%typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP {
|
||||
if (*$1) {
|
||||
%append_output(SWIG_FromCharPtr(*$1));
|
||||
|
|
@ -274,7 +269,6 @@
|
|||
%typemap(in,noblock=1,numinputs=0) (TYPEMAP, SIZE) ($*1_ltype temp = 0, $*2_ltype tempn) {
|
||||
$1 = &temp; $2 = &tempn;
|
||||
}
|
||||
%typemap(freearg) (TYPEMAP,SIZE) "";
|
||||
%typemap(argout,noblock=1,fragment=#SWIG_FromCharPtrAndSize)(TYPEMAP,SIZE) {
|
||||
if (*$1) {
|
||||
%append_output(SWIG_FromCharPtrAndSize(*$1,*$2));
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
$1 = &temp;
|
||||
}
|
||||
}
|
||||
%typemap(freearg) const enum SWIGTYPE& "";
|
||||
|
||||
%typemap(varin,fragment=SWIG_AsVal_frag(int),noblock=1) enum SWIGTYPE {
|
||||
if (sizeof(int) != sizeof($1)) {
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@
|
|||
%define %implicit_code(Type...)
|
||||
if (SWIG_IsOK(swig::asval<Type >(obj, 0))) {
|
||||
Type _v;
|
||||
swig::asval<Type >(obj, &_v);
|
||||
int res = swig::asval<Type >(obj, &_v);
|
||||
if (val) *val = %new_copy(_v, value_type);
|
||||
return SWIG_NEWOBJ;
|
||||
return SWIG_AddNewMask(res);
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
|
@ -72,13 +72,14 @@ namespace swig {
|
|||
static int asptr(SWIG_Object obj, value_type **val) {
|
||||
Type *vptr;
|
||||
static swig_type_info* desc = SWIG_TypeQuery("Type *");
|
||||
if ((SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0) == SWIG_OK)) {
|
||||
int res = SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0);
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
return res;
|
||||
} else {
|
||||
%formacro_1(%implicit_code,__VA_ARGS__)
|
||||
}
|
||||
return 0;
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -107,13 +108,14 @@ namespace swig {
|
|||
static int asptr(SWIG_Object obj, value_type **val) {
|
||||
Type *vptr;
|
||||
static swig_type_info* desc = SWIG_TypeQuery("Type *");
|
||||
if ((SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0) == SWIG_OK)) {
|
||||
int res = SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0);
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
return res;
|
||||
} else {
|
||||
%implicit_code(Imp1);
|
||||
}
|
||||
return 0;
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -144,14 +146,15 @@ namespace swig {
|
|||
static int asptr(SWIG_Object obj, value_type **val) {
|
||||
Type *vptr;
|
||||
static swig_type_info* desc = SWIG_TypeQuery("Type *");
|
||||
if ((SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0) == SWIG_OK)) {
|
||||
int res = SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0);
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
} else {
|
||||
%implicit_code(Imp1);
|
||||
%implicit_code(Imp2);
|
||||
}
|
||||
return 0;
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -184,15 +187,16 @@ namespace swig {
|
|||
static int asptr(SWIG_Object obj, value_type **val) {
|
||||
Type *vptr;
|
||||
static swig_type_info* desc = SWIG_TypeQuery("Type *");
|
||||
if ((SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0) == SWIG_OK)) {
|
||||
int res = SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0);
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
return res;
|
||||
} else {
|
||||
%implicit_code(Imp1);
|
||||
%implicit_code(Imp2);
|
||||
%implicit_code(Imp3);
|
||||
}
|
||||
return 0;
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,13 @@ or you can use the %apply directive :
|
|||
|
||||
*/
|
||||
#if defined(SWIG_INPUT_ACCEPT_PTRS)
|
||||
#define %check_input_ptr(input,arg,desc,disown) (SWIG_ConvertPtr(input,%as_voidptrptr(arg),desc,disown) == SWIG_OK)
|
||||
#define %check_input_ptr(input,arg,desc,disown) (SWIG_IsOK(res = SWIG_ConvertPtr(input,%as_voidptrptr(arg),desc,disown)))
|
||||
#else
|
||||
#define %check_input_ptr(input,arg,desc,disown) (0)
|
||||
#define %check_input_ptr(input,arg,desc,disown) (SWIG_IsOK(res = SWIG_ERROR))
|
||||
#endif
|
||||
|
||||
%define %_value_input_typemap(code, asval_meth, asval_frag, Type)
|
||||
%typemap(in,noblock=1,fragment=asval_frag) Type *INPUT ($*ltype temp, int res = 0) {
|
||||
%typemap(in,noblock=1,fragment=asval_frag) Type *INPUT ($*ltype temp, int res) {
|
||||
if (!%check_input_ptr($input,&$1,$descriptor,$disown)) {
|
||||
Type val;
|
||||
int ecode = asval_meth($input, &val);
|
||||
|
|
@ -86,10 +86,10 @@ or you can use the %apply directive :
|
|||
}
|
||||
temp = %static_cast(val, $*ltype);
|
||||
$1 = &temp;
|
||||
res = SWIG_NEWOBJ;
|
||||
res = SWIG_AddTmpMask(ecode);
|
||||
}
|
||||
}
|
||||
%typemap(in,noblock=1,fragment=asval_frag) Type &INPUT($*ltype temp, int res = 0) {
|
||||
%typemap(in,noblock=1,fragment=asval_frag) Type &INPUT($*ltype temp, int res) {
|
||||
if (!%check_input_ptr($input,&$1,$descriptor,$disown)) {
|
||||
Type val;
|
||||
int ecode = asval_meth($input, &val);
|
||||
|
|
@ -98,41 +98,46 @@ or you can use the %apply directive :
|
|||
}
|
||||
temp = %static_cast(val, $*ltype);
|
||||
$1 = &temp;
|
||||
res = SWIG_NEWOBJ;
|
||||
res = SWIG_AddTmpMask(ecode);
|
||||
}
|
||||
}
|
||||
%typemap(freearg,noblock=1,match="in") Type *INPUT, Type &INPUT {
|
||||
if (SWIG_IsNewObj(res$argnum)) %delete($1);
|
||||
}
|
||||
%typemap(typecheck,noblock=1,precedence=code,fragment=asval_frag) Type *INPUT, Type &INPUT {
|
||||
void *ptr;
|
||||
int res = SWIG_CastRank(asval_meth($input, 0));
|
||||
if (SWIG_IsOK(res)) {
|
||||
$1 = res;
|
||||
} else {
|
||||
int res = asval_meth($input, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
if (!$1) {
|
||||
$1 = %check_input_ptr($input,&ptr,$1_descriptor,0);
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
||||
%define %_ptr_input_typemap(code,asptr_meth,asptr_frag,Type)
|
||||
%typemap(in,noblock=1,fragment=asptr_frag) Type *INPUT(int res = 0) {
|
||||
%typemap(in,noblock=1,fragment=asptr_frag) Type *INPUT(int res) {
|
||||
res = asptr_meth($input, &$1);
|
||||
if (!res) {
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(SWIG_TypeError,"$type",$argnum);
|
||||
}
|
||||
res = SWIG_AddTmpMask(res);
|
||||
}
|
||||
%typemap(in,noblock=1,fragment=asptr_frag) Type &INPUT(int res = 0) {
|
||||
%typemap(in,noblock=1,fragment=asptr_frag) Type &INPUT(int res) {
|
||||
res = asptr_meth($input, &$1);
|
||||
if (!res) {
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(SWIG_TypeError,"$type",$argnum);
|
||||
}
|
||||
if (!$1) {
|
||||
%argument_nullref("$type",$argnum);
|
||||
}
|
||||
res = SWIG_AddTmpMask(res);
|
||||
}
|
||||
%typemap(freearg,noblock=1) Type *INPUT, Type &INPUT {
|
||||
if (res$argnum == SWIG_NEWOBJ) %delete($1);
|
||||
%typemap(freearg,noblock=1,match="in") Type *INPUT, Type &INPUT {
|
||||
if (SWIG_IsNewObj(res$argnum)) %delete($1);
|
||||
}
|
||||
%typemap(typecheck,noblock=1,precedence=code,fragment=asptr_frag) Type *INPUT, Type &INPUT {
|
||||
$1 = asptr_meth($input, (Type**)0) != 0;
|
||||
int res = asptr_meth($input, (Type**)0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
|
@ -174,10 +179,11 @@ values.
|
|||
$1 = &temp;
|
||||
}
|
||||
%typemap(argout,noblock=1,fragment=from_frag) Type *OUTPUT, Type &OUTPUT {
|
||||
if (res$argnum == SWIG_NEWOBJ) {
|
||||
if (SWIG_IsTmpObj(res$argnum)) {
|
||||
%append_output(from_meth((*$1)));
|
||||
} else {
|
||||
%append_output(SWIG_NewPointerObj((void*)($1), $1_descriptor, %newpointer_flags));
|
||||
int new_flags = SWIG_IsNewObj(res$argnum) ? (SWIG_POINTER_OWN | %newpointer_flags) : %newpointer_flags;
|
||||
%append_output(SWIG_NewPointerObj((void*)($1), $1_descriptor, new_flags));
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
|
@ -233,6 +239,8 @@ phased out in future releases.
|
|||
|
||||
%define %_ptr_inout_typemap(Type)
|
||||
%_value_inout_typemap(%arg(Type))
|
||||
%typemap(typecheck) Type *INOUT = Type *INPUT;
|
||||
%typemap(typecheck) Type &INOUT = Type &INPUT;
|
||||
%typemap(freearg) Type *INOUT = Type *INPUT;
|
||||
%typemap(freearg) Type &INOUT = Type &INPUT;
|
||||
%enddef
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ SWIGINTERN int
|
|||
SWIG_AsVal_dec(bool)(SWIG_Object obj, bool *val)
|
||||
{
|
||||
long v;
|
||||
int res = SWIG_IsOK(SWIG_AsVal(long)(obj, val ? &v : 0));
|
||||
int res = SWIG_AsVal(long)(obj, val ? &v : 0);
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = v ? true : false;
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -28,20 +28,20 @@
|
|||
%typemap(in,fragment=frag) Type {
|
||||
Type *ptr = (Type *)0;
|
||||
int res = asptr_meth($input, &ptr);
|
||||
if (!res || !ptr) { %argument_fail(SWIG_TypeError, "$type", $argnum); }
|
||||
if (!SWIG_IsOK(res) || !ptr) { %argument_fail(SWIG_TypeError, "$type", $argnum); }
|
||||
$1 = *ptr;
|
||||
if (res == SWIG_NEWOBJ) %delete(ptr);
|
||||
if (SWIG_IsNewObj(res)) %delete(ptr);
|
||||
}
|
||||
%typemap(freearg) Type "";
|
||||
%typemap(in,fragment=frag) const Type & (int res = 0) {
|
||||
%typemap(in,fragment=frag) const Type & (int res = SWIG_OLDOBJ) {
|
||||
Type *ptr = (Type *)0;
|
||||
res = asptr_meth($input, &ptr);
|
||||
if (!res) { %argument_fail(SWIG_TypeError,"$type",$argnum); }
|
||||
if (!SWIG_IsOK(res)) { %argument_fail(SWIG_TypeError,"$type",$argnum); }
|
||||
if (!ptr) { %argument_nullref("$type",$argnum); }
|
||||
$1 = ptr;
|
||||
}
|
||||
%typemap(freearg,noblock=1) const Type & {
|
||||
if (res$argnum == SWIG_NEWOBJ) %delete($1);
|
||||
if (SWIG_IsNewObj(res$argnum)) %delete($1);
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
|
@ -51,9 +51,11 @@
|
|||
%typemap(varin,fragment=frag) Type {
|
||||
Type *ptr = (Type *)0;
|
||||
int res = asptr_meth($input, &ptr);
|
||||
if (!res || !ptr) { %variable_fail(SWIG_TypeError, "$type", "$name"); }
|
||||
if (!SWIG_IsOK(res) || !ptr) { %variable_fail(SWIG_TypeError, "$type", "$name"); }
|
||||
$1 = *ptr;
|
||||
if (res == SWIG_NEWOBJ) %delete(ptr);
|
||||
if (SWIG_IsNewObj(res)) {
|
||||
%delete(ptr);
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
|
@ -64,32 +66,32 @@
|
|||
%typemap(directorargout,noblock=1,fragment=frag) Type *DIRECTOROUT ($*ltype temp) {
|
||||
Type *optr = 0;
|
||||
int ores = $input ? asptr_meth($input, &optr) : 0;
|
||||
if (!ores || !optr) {
|
||||
if (!SWIG_IsOK(ores) || !optr) {
|
||||
%dirout_fail(SWIG_TypeError,"$type");
|
||||
}
|
||||
temp = *optr;
|
||||
$result = &temp;
|
||||
if (ores == SWIG_NEWOBJ) %delete(optr);
|
||||
if (SWIG_IsNewObj(ores)) %delete(optr);
|
||||
}
|
||||
|
||||
%typemap(directorout,noblock=1,fragment=frag) Type {
|
||||
Type *optr = 0;
|
||||
int ores = asptr_meth($input, &optr);
|
||||
if (!ores || !optr) {
|
||||
if (!SWIG_IsOK(ores) || !optr) {
|
||||
%dirout_fail(SWIG_TypeError,"$type");
|
||||
}
|
||||
$result = *optr;
|
||||
if (ores == SWIG_NEWOBJ) %delete(optr);
|
||||
if (SWIG_IsNewObj(ores)) %delete(optr);
|
||||
}
|
||||
|
||||
%typemap(directorout,noblock=1,fragment=frag,warning=SWIG_WARN_TYPEMAP_THREAD_UNSAFE) Type* {
|
||||
%typemap(directorout,noblock=1,fragment=frag,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR) Type* {
|
||||
Type *optr = 0;
|
||||
int ores = asptr_meth($input, &optr);
|
||||
if (!ores) {
|
||||
if (!SWIG_IsOK(ores)) {
|
||||
%dirout_fail(SWIG_TypeError,"$type");
|
||||
}
|
||||
$result = optr;
|
||||
if (ores == SWIG_NEWOBJ) {
|
||||
if (SWIG_IsNewObj(ores)) {
|
||||
swig_acquire_ownership(optr);
|
||||
}
|
||||
}
|
||||
|
|
@ -100,10 +102,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(directorout,noblock=1,fragment=frag,warning=SWIG_WARN_TYPEMAP_THREAD_UNSAFE) Type& {
|
||||
%typemap(directorout,noblock=1,fragment=frag,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR) Type& {
|
||||
Type *optr = 0;
|
||||
int ores = asptr_meth($input, &optr);
|
||||
if (!ores) {
|
||||
if (!SWIG_IsOK(ores)) {
|
||||
%dirout_fail(SWIG_TypeError,"$type");
|
||||
} else {
|
||||
if (!optr) {
|
||||
|
|
@ -111,7 +113,7 @@
|
|||
}
|
||||
}
|
||||
$result = optr;
|
||||
if (ores == SWIG_NEWOBJ) {
|
||||
if (SWIG_IsNewObj(ores)) {
|
||||
swig_acquire_ownership(optr);
|
||||
}
|
||||
}
|
||||
|
|
@ -136,12 +138,15 @@
|
|||
/* typecheck */
|
||||
|
||||
%define %ptr_typecheck_typemap(check,asptr_meth,frag,Type...)
|
||||
%typemap(typecheck,precedence=check,fragment=frag)
|
||||
Type *
|
||||
"$1 = asptr_meth($input, (Type**)(0)) != 0;";
|
||||
%typemap(typecheck,precedence=check,fragment=frag)
|
||||
Type, const Type&
|
||||
"$1 = asptr_meth($input, (Type**)(0)) != 0;";
|
||||
%typemap(typecheck,noblock=1,precedence=check,fragment=frag) Type * {
|
||||
int res = asptr_meth($input, (Type**)(0));
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typemap(typecheck,noblock=1,precedence=check,fragment=frag) Type, const Type& {
|
||||
int res = asptr_meth($input, (Type**)(0));
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
||||
|
|
@ -156,12 +161,16 @@
|
|||
{
|
||||
Type *v = (Type *)0;
|
||||
int res = SWIG_AsPtr(Type)(obj, &v);
|
||||
if (!res || !v) return SWIG_ERROR;
|
||||
if (val) {
|
||||
*val = *v;
|
||||
if (res == SWIG_NEWOBJ) %delete(v);
|
||||
if (!SWIG_IsOK(res)) return res;
|
||||
if (v) {
|
||||
if (val) *val = *v;
|
||||
if (SWIG_IsNewObj(res)) {
|
||||
%delete(v);
|
||||
res = SWIG_DelNewMask(res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
return SWIG_OK;
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
%ptr_in_typemap(%arg(AsPtrMeth), %arg(AsPtrFrag), Type);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ SWIGINTERN int
|
|||
SWIG_AsPtr_dec(String)(SWIG_Object obj, String **val)
|
||||
{
|
||||
Char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
|
||||
if (SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
|
||||
if (SWIG_IsOK(SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc))) {
|
||||
if (buf) {
|
||||
if (val) *val = new String(buf, size - 1);
|
||||
if (alloc == SWIG_NEWOBJ) %delete_array(buf);
|
||||
|
|
@ -24,14 +24,13 @@ SWIG_AsPtr_dec(String)(SWIG_Object obj, String **val)
|
|||
init = 1;
|
||||
}
|
||||
if (descriptor) {
|
||||
String *vptr;
|
||||
if ((SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0) == SWIG_OK)) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
}
|
||||
String *vptr;
|
||||
int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
|
||||
if (SWIG_IsOK(res) && val) *val = vptr;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
|
@ -51,14 +50,18 @@ SWIG_From_dec(String)(const String& s)
|
|||
SWIGINTERN int
|
||||
SWIG_AsVal_dec(String)(SWIG_Object obj, String *val)
|
||||
{
|
||||
String* s;
|
||||
int res = SWIG_AsPtr(String)(obj, &s);
|
||||
if ((res != 0) && s) {
|
||||
if (val) *val = *s;
|
||||
if (res == SWIG_NEWOBJ) delete s;
|
||||
return SWIG_OK;
|
||||
String* v = (String *) 0;
|
||||
int res = SWIG_AsPtr(String)(obj, &v);
|
||||
if (!SWIG_IsOK(res)) return res;
|
||||
if (v) {
|
||||
if (val) *val = *v;
|
||||
if (SWIG_IsNewObj(res)) {
|
||||
%delete(v);
|
||||
res = SWIG_DelNewMask(res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
return SWIG_TypeError;
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
|
|
|||
|
|
@ -30,22 +30,22 @@
|
|||
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtr)
|
||||
Char * (Char *buf = 0, int alloc = 0),
|
||||
const Char * (Char *buf = 0, int alloc = 0) {
|
||||
if (SWIG_AsCharPtr($input, &buf, &alloc) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharPtr($input, &buf, &alloc))) {
|
||||
%argument_fail(SWIG_TypeError,"$type",$argnum);
|
||||
}
|
||||
$1 = buf;
|
||||
}
|
||||
%typemap(freearg,noblock=1) Char *, const Char * {
|
||||
%typemap(freearg,noblock=1,match="in") Char *, const Char * {
|
||||
if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
|
||||
}
|
||||
|
||||
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtr) Char const*& (Char *buf = 0, int alloc = 0) {
|
||||
if (SWIG_AsCharPtr($input, &buf, &alloc) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharPtr($input, &buf, &alloc))) {
|
||||
%argument_fail(SWIG_TypeError,"$type",$argnum);
|
||||
}
|
||||
$1 = &temp;
|
||||
}
|
||||
%typemap(freearg, noblock=1) Char const*& {
|
||||
%typemap(freearg, noblock=1,match="in") Char const*& {
|
||||
if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
|
||||
%typemap(varin,noblock=1,fragment=#SWIG_AsCharPtrAndSize) Char * {
|
||||
Char *cptr = 0; size_t csize = 0; int alloc = SWIG_NEWOBJ;
|
||||
if (SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc))) {
|
||||
%variable_fail(SWIG_TypeError,"$type","$name");
|
||||
}
|
||||
if ($1) %delete_array($1);
|
||||
|
|
@ -76,9 +76,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(varin,noblock=1,fragment=#SWIG_AsCharPtrAndSize,warning="451:Setting const Char * variable may leak memory") const Char * {
|
||||
%typemap(varin,noblock=1,fragment=#SWIG_AsCharPtrAndSize,warning=SWIG_WARN_TYPEMAP_CHARLEAK) const Char * {
|
||||
Char *cptr = 0; size_t csize = 0; int alloc = SWIG_NEWOBJ;
|
||||
if (SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc))) {
|
||||
%variable_fail(SWIG_TypeError, "$type", "$name");
|
||||
}
|
||||
if (alloc == SWIG_NEWOBJ) {
|
||||
|
|
@ -106,7 +106,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(memberin,noblock=1,warning="451:Setting const char * member may leak memory.") const Char * {
|
||||
%typemap(memberin,noblock=1,warning=SWIG_WARN_TYPEMAP_CHARLEAK) const Char * {
|
||||
if ($input) {
|
||||
size_t size = SWIG_CharPtrLen($input) + 1;
|
||||
$1 = %new_copy_array($input, size, Char);
|
||||
|
|
@ -127,7 +127,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(globalin,noblock=1,warning="451:Setting const char * variable may leak memory.") const Char * {
|
||||
%typemap(globalin,noblock=1,warning=SWIG_WARN_TYPEMAP_CHARLEAK) const Char * {
|
||||
if ($input) {
|
||||
size_t size = SWIG_CharPtrLen($input) + 1;
|
||||
$1 = %new_copy_array($input, size, Char);
|
||||
|
|
@ -157,9 +157,9 @@
|
|||
|
||||
/* directorout */
|
||||
|
||||
%typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr,warning=SWIG_WARN_TYPEMAP_THREAD_UNSAFE)
|
||||
%typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR)
|
||||
Char * (Char* buf = 0, int alloc = SWIG_NEWOBJ) {
|
||||
if (SWIG_AsCharPtr($input, &buf, &alloc) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharPtr($input, &buf, &alloc))) {
|
||||
%dirout_fail(SWIG_TypeError, "$type");
|
||||
}
|
||||
if (alloc == SWIG_NEWOBJ) {
|
||||
|
|
@ -175,10 +175,10 @@
|
|||
}
|
||||
|
||||
|
||||
%typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr,warning=SWIG_WARN_TYPEMAP_THREAD_UNSAFE)
|
||||
%typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR)
|
||||
Char * const& (Char* buf = 0, int alloc = SWIG_NEWOBJ),
|
||||
Char const* const& (Char* buf = 0, int alloc = SWIG_NEWOBJ) {
|
||||
if (SWIG_AsCharPtr($input, &buf, &alloc) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharPtr($input, &buf, &alloc))) {
|
||||
%dirout_fail(SWIG_TypeError, "$type");
|
||||
}
|
||||
static $*ltype tmp = buf;
|
||||
|
|
@ -200,7 +200,8 @@
|
|||
|
||||
%typemap(typecheck,noblock=1,precedence=SWIG_TYPECHECK_STRING,
|
||||
fragment=#SWIG_AsCharPtr) Char *, Char const*& {
|
||||
$1 = (SWIG_AsCharPtr($input, 0, 0) == SWIG_OK);
|
||||
int res = SWIG_AsCharPtr($input, 0, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -248,7 +249,7 @@
|
|||
Char [ANY] (Char temp[$1_dim0]),
|
||||
const Char [ANY](Char temp[$1_dim0])
|
||||
{
|
||||
if (SWIG_AsCharArray($input, temp, $1_dim0) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharArray($input, temp, $1_dim0))) {
|
||||
%argument_fail(SWIG_TypeError,"$type",$argnum);
|
||||
}
|
||||
$1 = temp;
|
||||
|
|
@ -257,7 +258,7 @@
|
|||
|
||||
%typemap(in,noblock=1,fragment=#SWIG_AsCharArray) const Char (&)[ANY] (Char temp[$1_dim0])
|
||||
{
|
||||
if (SWIG_AsCharArray($input, temp, $1_dim0) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharArray($input, temp, $1_dim0))) {
|
||||
%argument_fail(SWIG_TypeError,"$type",$argnum);
|
||||
}
|
||||
$1 = &temp;
|
||||
|
|
@ -278,7 +279,7 @@
|
|||
|
||||
%typemap(varin,noblock=1,fragment=#SWIG_AsCharArray) Char [ANY]
|
||||
{
|
||||
if (SWIG_AsCharArray($input, $1, $1_dim0) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharArray($input, $1, $1_dim0))) {
|
||||
%variable_fail(SWIG_TypeError, "$type", "$name");
|
||||
}
|
||||
}
|
||||
|
|
@ -326,7 +327,7 @@
|
|||
Char [ANY] (Char temp[$result_dim0]),
|
||||
const Char [ANY] (Char temp[$result_dim0])
|
||||
{
|
||||
if (SWIG_AsCharArray($input, temp, $result_dim0) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharArray($input, temp, $result_dim0))) {
|
||||
%dirout_fail(SWIG_TypeError, "$type");
|
||||
}
|
||||
$result = temp;
|
||||
|
|
@ -339,7 +340,8 @@
|
|||
%typemap(typecheck,noblock=1,precedence=SWIG_TYPECHECK_STRING,
|
||||
fragment=#SWIG_AsCharArray)
|
||||
Char [ANY], const Char[ANY] {
|
||||
$1 = (SWIG_AsCharArray($input, (Char *)0, $1_dim0) == SWIG_OK);
|
||||
int res = SWIG_AsCharArray($input, (Char *)0, $1_dim0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -395,13 +397,13 @@
|
|||
(Char *STRING, size_t LENGTH) (Char *buf = 0, size_t size = 0, int alloc = 0),
|
||||
(const Char *STRING, size_t LENGTH) (Char *buf = 0, size_t size = 0, int alloc = 0)
|
||||
{
|
||||
if (SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc))) {
|
||||
%argument_fail(SWIG_TypeError,"$type",$argnum);
|
||||
}
|
||||
$1 = %static_cast(buf, $1_ltype);
|
||||
$2 = %numeric_cast(size - 1, $2_ltype);
|
||||
}
|
||||
%typemap(freearg,noblock=1) (Char *STRING, size_t LENGTH) {
|
||||
%typemap(freearg,noblock=1,match="in") (Char *STRING, size_t LENGTH) {
|
||||
if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
|
||||
}
|
||||
/* old 'int' form */
|
||||
|
|
@ -414,13 +416,13 @@
|
|||
(Char *STRING, size_t SIZE) (Char *buf = 0, size_t size = 0, int alloc = 0),
|
||||
(const Char *STRING, size_t SIZE) (Char *buf = 0, size_t size = 0, int alloc = 0)
|
||||
{
|
||||
if (SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc))) {
|
||||
%argument_fail(SWIG_TypeError,"$type",$argnum);
|
||||
}
|
||||
$1 = %static_cast(buf, $1_ltype);
|
||||
$2 = %numeric_cast(size, $2_ltype);
|
||||
}
|
||||
%typemap(freearg, noblock=1) (Char *STRING, size_t SIZE) {
|
||||
%typemap(freearg, noblock=1,match="in") (Char *STRING, size_t SIZE) {
|
||||
if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
|
||||
}
|
||||
/* old 'int' form */
|
||||
|
|
@ -435,13 +437,13 @@
|
|||
(size_t LENGTH, Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0),
|
||||
(size_t LENGHT, const Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0)
|
||||
{
|
||||
if (SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc))) {
|
||||
%argument_fail(SWIG_TypeError,"$type",$argnum);
|
||||
}
|
||||
$2 = %static_cast(buf, $2_ltype) ;
|
||||
$1 = %numeric_cast(size - 1, $1_ltype) ;
|
||||
}
|
||||
%typemap(freearg, noblock=1) (size_t LENGTH, Char *STRING) {
|
||||
%typemap(freearg, noblock=1, match="in") (size_t LENGTH, Char *STRING) {
|
||||
if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
|
||||
}
|
||||
/* old 'int' form */
|
||||
|
|
@ -453,13 +455,13 @@
|
|||
(size_t SIZE, Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0),
|
||||
(size_t SIZE, const Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0)
|
||||
{
|
||||
if (SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc))) {
|
||||
%argument_fail(SWIG_TypeError, "$type",$argnum);
|
||||
}
|
||||
$2 = %static_cast(buf, $2_ltype) ;
|
||||
$1 = %numeric_cast(size, $1_ltype) ;
|
||||
}
|
||||
%typemap(freearg, noblock=1) (size_t SIZE, Char *STRING) {
|
||||
%typemap(freearg, noblock=1, match="in") (size_t SIZE, Char *STRING) {
|
||||
if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
|
||||
}
|
||||
/* old 'int' form */
|
||||
|
|
@ -506,15 +508,19 @@ SWIGINTERN int
|
|||
SWIG_As##CharName##Array(SWIG_Object obj, Char *val, size_t size)
|
||||
{
|
||||
Char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ;
|
||||
if (SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc) == SWIG_OK) {
|
||||
int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc);
|
||||
if (SWIG_IsOK(res)) {
|
||||
if ((csize == size + 1) && cptr && !(cptr[csize-1])) --csize;
|
||||
if (csize <= size) {
|
||||
if (val) {
|
||||
if (csize) memcpy(val, cptr, csize*sizeof(Char));
|
||||
if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(Char));
|
||||
}
|
||||
if (alloc == SWIG_NEWOBJ) %delete_array(cptr);
|
||||
return SWIG_OK;
|
||||
if (alloc == SWIG_NEWOBJ) {
|
||||
%delete_array(cptr);
|
||||
res = SWIG_DelNewMask(res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
if (alloc == SWIG_NEWOBJ) %delete_array(cptr);
|
||||
}
|
||||
|
|
@ -542,7 +548,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
|
|||
int res = SWIG_As##CharName##Array(obj, val, 1);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
long v;
|
||||
res = SWIG_AsVal(long)(obj, &v);
|
||||
res = SWIG_AddCast(SWIG_AsVal(long)(obj, &v));
|
||||
if (SWIG_IsOK(res)) {
|
||||
if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) {
|
||||
if (val) *val = %numeric_cast(v, Char);
|
||||
|
|
|
|||
|
|
@ -3,42 +3,91 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* Pointers and arrays */
|
||||
%typemap(in, noblock=1) SWIGTYPE * (void *argp), SWIGTYPE [] (void *argp) {
|
||||
if (SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags) != SWIG_OK) {
|
||||
%typemap(in, noblock=1) SWIGTYPE *(void *argp = 0) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags))) {
|
||||
%argument_fail(SWIG_TypeError, "$type", $argnum);
|
||||
}
|
||||
$1 = %reinterpret_cast(argp, $ltype);
|
||||
}
|
||||
%typemap(freearg) SWIGTYPE *, SWIGTYPE [] "";
|
||||
|
||||
%typemap(in, noblock=1) SWIGTYPE* const& (void *argp, $*ltype temp) {
|
||||
if (SWIG_ConvertPtr($input, &argp, $*descriptor, $disown | %convertptr_flags) != SWIG_OK) {
|
||||
%typemap(in, noblock=1) SWIGTYPE [] (void *argp = 0) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags))) {
|
||||
%argument_fail(SWIG_TypeError, "$type", $argnum);
|
||||
}
|
||||
$1 = %reinterpret_cast(argp, $ltype);
|
||||
}
|
||||
|
||||
|
||||
%typemap(in, noblock=1) SWIGTYPE* const& (void *argp = 0, $*ltype temp) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp, $*descriptor, $disown | %convertptr_flags))) {
|
||||
%argument_fail(SWIG_TypeError, "$*ltype", $argnum);
|
||||
}
|
||||
temp = %reinterpret_cast(argp, $*ltype);
|
||||
$1 = &temp;
|
||||
}
|
||||
%typemap(freearg) SWIGTYPE* const& "";
|
||||
|
||||
|
||||
/* Reference */
|
||||
%typemap(in, noblock=1) SWIGTYPE & (void *argp) {
|
||||
if (SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags) != SWIG_OK) {
|
||||
%typemap(in, noblock=1) SWIGTYPE & (void *argp = 0) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags))) {
|
||||
%argument_fail(SWIG_TypeError, "$type", $argnum);
|
||||
}
|
||||
if (!argp) { %argument_nullref("$type", $argnum); }
|
||||
$1 = %reinterpret_cast(argp, $ltype);
|
||||
}
|
||||
%typemap(freearg) SWIGTYPE& "";
|
||||
#if defined(__cplusplus) && defined(%implicitconv_flag)
|
||||
%typemap(in, noblock=1,implicitconv=1) const SWIGTYPE & (void *argp = 0, int res) {
|
||||
res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(SWIG_TypeError, "$type", $argnum);
|
||||
}
|
||||
if (!argp) { %argument_nullref("$type", $argnum); }
|
||||
$1 = %reinterpret_cast(argp, $ltype);
|
||||
}
|
||||
%typemap(freearg,noblock=1,match="in") const SWIGTYPE &
|
||||
{
|
||||
if (SWIG_IsNewObj(res$argnum)) %delete($1);
|
||||
}
|
||||
#else
|
||||
%typemap(in, noblock=1) const SWIGTYPE & (void *argp) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags))) {
|
||||
%argument_fail(SWIG_TypeError, "$type", $argnum);
|
||||
}
|
||||
if (!argp) { %argument_nullref("$type", $argnum); }
|
||||
$1 = %reinterpret_cast(argp, $ltype);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* By value */
|
||||
%typemap(in,noblock=1) SWIGTYPE (void *argp) {
|
||||
if (SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags) != SWIG_OK) {
|
||||
#if defined(__cplusplus) && defined(%implicitconv_flag)
|
||||
%typemap(in,implicitconv=1) SWIGTYPE {
|
||||
void *argp;
|
||||
int res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(SWIG_TypeError, "$type", $argnum);
|
||||
}
|
||||
if (!argp) { %argument_nullref("$type", $argnum); }
|
||||
$1 = *(%reinterpret_cast(argp, $<ype));
|
||||
if (!argp) {
|
||||
%argument_nullref("$type", $argnum);
|
||||
} else {
|
||||
$<ype temp = %reinterpret_cast(argp, $<ype);
|
||||
$1 = *temp;
|
||||
if (SWIG_IsNewObj(res)) %delete(temp);
|
||||
}
|
||||
}
|
||||
%typemap(freearg) SWIGTYPE "";
|
||||
#else
|
||||
%typemap(in) SWIGTYPE {
|
||||
void *argp;
|
||||
$<ype temp;
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags))) {
|
||||
%argument_fail(SWIG_TypeError, "$type", $argnum);
|
||||
}
|
||||
if (!argp) {
|
||||
%argument_nullref("$type", $argnum);
|
||||
} else {
|
||||
$1 = *(%reinterpret_cast(argp, $<ype));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* --- Output arguments ---
|
||||
|
|
@ -88,7 +137,8 @@
|
|||
|
||||
%typemap(varin,noblock=1) SWIGTYPE [ANY] {
|
||||
$basetype *inp = 0;
|
||||
if (SWIG_ConvertPtr($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags) != SWIG_OK) {
|
||||
int res = SWIG_ConvertPtr($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%variable_fail(SWIG_TypeError, "$type", "$name");
|
||||
} else if (inp) {
|
||||
size_t ii = 0;
|
||||
|
|
@ -143,7 +193,8 @@
|
|||
|
||||
%typemap(varin,noblock=1) SWIGTYPE [ANY][ANY] {
|
||||
$basetype (*inp)[$dim1] = 0;
|
||||
if (SWIG_ConvertPtr($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags) != SWIG_OK) {
|
||||
int res = SWIG_ConvertPtr($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%variable_fail(SWIG_TypeError, "$type", "$name");
|
||||
} else if (inp) {
|
||||
$basetype (*dest)[$dim1] = %static_cast($1, $basetype (*)[$dim1]);
|
||||
|
|
@ -165,12 +216,13 @@
|
|||
|
||||
/* Pointers, references, and variable size arrays */
|
||||
|
||||
%typemap(varin,noblock=1) SWIGTYPE * {
|
||||
void *temp = 0;
|
||||
if (SWIG_ConvertPtr($input, &temp, $descriptor, %convertptr_flags) != SWIG_OK) {
|
||||
%typemap(varin,noblock=1,warning=SWIG_WARN_TYPEMAP_SWIGTYPELEAK) SWIGTYPE * {
|
||||
void *argp = 0;
|
||||
int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%variable_fail(SWIG_TypeError, "$type", "$name");
|
||||
}
|
||||
$1 = ($ltype) temp;
|
||||
$1 = %reinterpret_cast(argp, $ltype);
|
||||
}
|
||||
|
||||
%typemap(varin,noblock=1,warning="462:Unable to set dimensionless array variable") SWIGTYPE []
|
||||
|
|
@ -178,27 +230,47 @@
|
|||
%variable_fail(SWIG_AttributeError, "$type", "read-only $name");
|
||||
}
|
||||
|
||||
%typemap(varin,noblock=1) SWIGTYPE & {
|
||||
void *temp = 0;
|
||||
if (SWIG_ConvertPtr($input, &temp, $descriptor, %convertptr_flags) != SWIG_OK) {
|
||||
%typemap(varin,noblock=1,warning=SWIG_WARN_TYPEMAP_SWIGTYPELEAK) SWIGTYPE & {
|
||||
void *argp = 0;
|
||||
int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%variable_fail(SWIG_TypeError, "$type", "$name");
|
||||
}
|
||||
if (!temp) {
|
||||
if (!argp) {
|
||||
%variable_nullref("$type", "$name");
|
||||
}
|
||||
$1 = *(%reinterpret_cast(temp, $ltype));
|
||||
$1 = *(%reinterpret_cast(argp, $ltype));
|
||||
}
|
||||
|
||||
%typemap(varin,noblock=1) SWIGTYPE {
|
||||
void *temp = 0;
|
||||
if (SWIG_ConvertPtr($input, &temp, $&descriptor, %convertptr_flags) != SWIG_OK) {
|
||||
#if defined(__cplusplus) && defined(%implicitconv_flag)
|
||||
%typemap(varin,noblock=1,implicitconv=1) SWIGTYPE {
|
||||
void *argp = 0;
|
||||
int res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%variable_fail(SWIG_TypeError, "$type", "$name");
|
||||
}
|
||||
if (!temp) {
|
||||
if (!argp) {
|
||||
%variable_nullref("$type", "$name");
|
||||
} else {
|
||||
$&type temp;
|
||||
temp = %reinterpret_cast(argp, $&type);
|
||||
$1 = *temp;
|
||||
if (SWIG_IsNewObj(res)) %delete(temp);
|
||||
}
|
||||
$1 = *(%reinterpret_cast(temp, $&type));
|
||||
}
|
||||
#else
|
||||
%typemap(varin,noblock=1) SWIGTYPE {
|
||||
void *argp = 0;
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags))) {
|
||||
%variable_fail(SWIG_TypeError, "$type", "$name");
|
||||
}
|
||||
if (!argp) {
|
||||
%variable_nullref("$type", "$name");
|
||||
} else {
|
||||
$1 = *(%reinterpret_cast(argp, $&type));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* --- Variable output ---
|
||||
|
|
@ -227,27 +299,46 @@
|
|||
* --- Typechecking rules ---
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
void *ptr = 0;
|
||||
$1 = (SWIG_ConvertPtr($input, &ptr, $descriptor, 0) == SWIG_OK);
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE * {
|
||||
void *vptr = 0;
|
||||
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE & {
|
||||
void *ptr = 0;
|
||||
$1 = (SWIG_ConvertPtr($input, &ptr, $descriptor, 0) == SWIG_OK) && (ptr != 0);
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE & {
|
||||
void *vptr = 0;
|
||||
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE {
|
||||
void *ptr = 0;
|
||||
$1 = (SWIG_ConvertPtr($input, &ptr, $&descriptor, 0) == SWIG_OK) && (ptr != 0);
|
||||
#if defined(__cplusplus) && defined(%implicitconv_flag)
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) const SWIGTYPE & {
|
||||
int res = SWIG_ConvertPtr($input, 0, $descriptor, %implicitconv_flag);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) SWIGTYPE {
|
||||
int res = SWIG_ConvertPtr($input, 0, $&descriptor, %implicitconv_flag);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
#else
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) const SWIGTYPE & {
|
||||
void *vptr = 0;
|
||||
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE {
|
||||
void *vptr = 0;
|
||||
int res = SWIG_ConvertPtr($input, &vptr, $&descriptor, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* --- Director typemaps --- *
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#if defined(SWIG_DIRECTOR_TYPEMAPS)
|
||||
|
||||
/* directorin */
|
||||
|
|
@ -265,37 +356,48 @@
|
|||
}
|
||||
|
||||
/* directorout */
|
||||
|
||||
#if defined(__cplusplus) && defined(%implicitconv_flag)
|
||||
%typemap(directorout,noblock=1,implicitconv=1) SWIGTYPE (void * argp, int res) {
|
||||
res = SWIG_ConvertPtr($input,&argp,$&descriptor, %convertptr_flags | %implicitconv_flag);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%dirout_fail(SWIG_TypeError,"$type");
|
||||
}
|
||||
$result = *(%reinterpret_cast(argp, $<ype));
|
||||
if (SWIG_IsNewObj(res)) %delete(%reinterpret_cast(argp, $<ype));
|
||||
}
|
||||
#else
|
||||
%typemap(directorout,noblock=1) SWIGTYPE (void * argp) {
|
||||
if (SWIG_ConvertPtr($input,&argp,$&descriptor, %convertptr_flags) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input,&argp,$&descriptor, %convertptr_flags))) {
|
||||
%dirout_fail(SWIG_TypeError,"$type");
|
||||
}
|
||||
$result = *(%reinterpret_cast(argp, $<ype));
|
||||
}
|
||||
%typemap(directorout,noblock=1,warning=SWIG_WARN_TYPEMAP_THREAD_UNSAFE)
|
||||
SWIGTYPE *(void *argp, swig_owntype own), SWIGTYPE [](void *argp, swig_owntype own) {
|
||||
if (SWIG_ConvertPtrAndOwn($input, &argp, $descriptor, %convertptr_flags | SWIG_POINTER_DISOWN, &own) != SWIG_OK) {
|
||||
#endif
|
||||
|
||||
%typemap(directorout,noblock=1,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR)
|
||||
SWIGTYPE *(void *argp, swig_owntype own) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtrAndOwn($input, &argp, $descriptor, %convertptr_flags | SWIG_POINTER_DISOWN, &own))) {
|
||||
%dirout_fail(SWIG_TypeError,"$type");
|
||||
}
|
||||
$result = %reinterpret_cast(argp, $ltype);
|
||||
swig_acquire_ownership_obj(%as_voidptr($result), own);
|
||||
}
|
||||
%typemap(directorfree,noblock=1) SWIGTYPE *, SWIGTYPE [] {
|
||||
%typemap(directorfree,noblock=1,match="directorout") SWIGTYPE * {
|
||||
if (director) {
|
||||
SWIG_AcquirePtr($result, director->swig_release_ownership(%as_voidptr($input)));
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(directorout,noblock=1,warning=SWIG_WARN_TYPEMAP_THREAD_UNSAFE)
|
||||
%typemap(directorout,noblock=1,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR)
|
||||
SWIGTYPE &(void *argp, swig_owntype own) {
|
||||
if (SWIG_ConvertPtrAndOwn($input, &argp, $descriptor, %convertptr_flags | SWIG_POINTER_DISOWN, &own) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtrAndOwn($input, &argp, $descriptor, %convertptr_flags | SWIG_POINTER_DISOWN, &own))) {
|
||||
%dirout_fail(SWIG_TypeError,"$type");
|
||||
}
|
||||
if (!argp) { %dirout_nullref("$type"); }
|
||||
$result = %reinterpret_cast(argp, $ltype);
|
||||
swig_acquire_ownership_obj(%as_voidptr($result), own);
|
||||
}
|
||||
%typemap(directorfree,noblock=1) SWIGTYPE & {
|
||||
%typemap(directorfree,noblock=1,match="directorout") SWIGTYPE & {
|
||||
if (director) {
|
||||
SWIG_AcquirePtr($result, director->swig_release_ownership(%as_voidptr($input)));
|
||||
}
|
||||
|
|
@ -341,18 +443,17 @@
|
|||
* ------------------------------------------------------------ */
|
||||
|
||||
%typemap(in,noblock=1) SWIGTYPE (CLASS::*) {
|
||||
if (SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($type),$descriptor) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($type),$descriptor))) {
|
||||
%argument_fail(SWIG_TypeError,"$type",$argnum);
|
||||
}
|
||||
}
|
||||
%typemap(freearg) SWIGTYPE (CLASS::*) "";
|
||||
|
||||
%typemap(out,noblock=1) SWIGTYPE (CLASS::*) {
|
||||
%set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor));
|
||||
}
|
||||
|
||||
%typemap(varin,noblock=1) SWIGTYPE (CLASS::*) {
|
||||
if (SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($type), $descriptor) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($type), $descriptor))) {
|
||||
%variable_fail(SWIG_TypeError, "$type", "$name");
|
||||
}
|
||||
}
|
||||
|
|
@ -376,7 +477,7 @@
|
|||
/* directorout */
|
||||
|
||||
%typemap(directorout,noblock=1) SWIGTYPE (CLASS::*) {
|
||||
if (SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($type), $descriptor) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($type), $descriptor))) {
|
||||
%dirout_fail(SWIG_TypeError,"$type");
|
||||
}
|
||||
$result = %reinterpret_cast(argp, $ltype);
|
||||
|
|
@ -393,15 +494,15 @@
|
|||
some providences.
|
||||
*/
|
||||
%typemap(in, noblock=1) SWIGTYPE ((*)(ANY)) {
|
||||
if (SWIG_ConvertFunctionPtr($input, (void**)(&$1), $descriptor) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertFunctionPtr($input, (void**)(&$1), $descriptor))) {
|
||||
%argument_fail(SWIG_TypeError,"$type",$argnum);
|
||||
}
|
||||
}
|
||||
%typemap(freearg) SWIGTYPE ((*)(ANY)) "";
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE ((*)(ANY)) {
|
||||
void *ptr = 0;
|
||||
$1 = (SWIG_ConvertFunctionPtr($input, &ptr, $descriptor) == SWIG_OK);
|
||||
int res = SWIG_ConvertFunctionPtr($input, &ptr, $descriptor);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -410,7 +511,7 @@
|
|||
}
|
||||
|
||||
%typemap(varin,noblock=1) SWIGTYPE ((*)(ANY)) {
|
||||
if (SWIG_ConvertFunctionPtr($input, (void**)(&$1), $descriptor) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertFunctionPtr($input, (void**)(&$1), $descriptor))) {
|
||||
%variable_fail(SWIG_TypeError, "$type", "$name");
|
||||
}
|
||||
}
|
||||
|
|
@ -434,7 +535,7 @@
|
|||
/* directorout */
|
||||
|
||||
%typemap(directorout,noblock=1) SWIGTYPE ((*)(ANY)) {
|
||||
if (SWIG_ConvertFunctionPtr($input,(void**)(&$result),$descriptor) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertFunctionPtr($input,(void**)(&$result),$descriptor))) {
|
||||
%dirout_fail(SWIG_TypeError,"$type");
|
||||
}
|
||||
}
|
||||
|
|
@ -448,21 +549,19 @@
|
|||
/* VARARGS_SENTINEL typemap. Used by the %varargs directive. */
|
||||
|
||||
%typemap(in,numinputs=0) SWIGTYPE *VARARGS_SENTINEL, SWIGTYPE VARARGS_SENTINEL "";
|
||||
%typemap(freearg) SWIGTYPE *VARARGS_SENTINEL, SWIGTYPE VARARGS_SENTINEL "";
|
||||
|
||||
|
||||
/* DISOWN typemap */
|
||||
|
||||
%typemap(in, noblock=1) SWIGTYPE *DISOWN {
|
||||
if (SWIG_ConvertPtr($input, %as_voidptrptr(&$1), $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, %as_voidptrptr(&$1), $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags))) {
|
||||
%argument_fail(SWIG_TypeError,"$type", $argnum);
|
||||
}
|
||||
}
|
||||
%typemap(freearg) SWIGTYPE *DISOWN "";
|
||||
|
||||
%typemap(varin,noblock=1) SWIGTYPE *DISOWN {
|
||||
void *temp = 0;
|
||||
if (SWIG_ConvertPtr($input, &temp, $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &temp, $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags))) {
|
||||
%variable_fail(SWIG_TypeError, "$type", "$name");
|
||||
}
|
||||
$1 = ($ltype) temp;
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@
|
|||
|
||||
/*==== flags for new/convert methods ====*/
|
||||
|
||||
|
||||
#ifndef %convertptr_flags
|
||||
%define %convertptr_flags 0 %enddef
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -124,9 +124,8 @@ namespace swig {
|
|||
struct traits_asptr {
|
||||
static int asptr SWIG_AS_DECL_ARGS (SWIG_Object obj, Type **val) {
|
||||
Type *p;
|
||||
int res = (SWIG_ConvertPtr(obj, %as_voidptrptr(&p),
|
||||
type_info<Type>(), 0) == SWIG_OK) ? SWIG_OLDOBJ : 0;
|
||||
if (res && val) *val = p;
|
||||
int res = SWIG_ConvertPtr(obj, %as_voidptrptr(&p), type_info<Type>(), 0);
|
||||
if (SWIG_IsOK(res) && val) *val = p;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
|
@ -142,15 +141,16 @@ namespace swig {
|
|||
if (val) {
|
||||
Type *p = 0;
|
||||
int res = traits_asptr<Type>::asptr SWIG_AS_CALL_ARGS(obj, &p);
|
||||
if ((res != 0) && p) {
|
||||
if (SWIG_IsOK(res) && p) {
|
||||
*val = *p;
|
||||
if (res == SWIG_NEWOBJ) %delete(p);
|
||||
return SWIG_OK;
|
||||
} else {
|
||||
return SWIG_ERROR;
|
||||
if (SWIG_IsNewObj(res)) {
|
||||
%delete(p);
|
||||
res = SWIG_DelNewMask(res);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
} else {
|
||||
return traits_asptr<Type>::asptr SWIG_AS_CALL_ARGS(obj, (Type **)(0)) ? SWIG_OK : SWIG_ERROR;
|
||||
return traits_asptr<Type>::asptr SWIG_AS_CALL_ARGS(obj, (Type **)(0));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -168,15 +168,25 @@ namespace swig {
|
|||
|
||||
template <class Type>
|
||||
struct traits_checkval {
|
||||
static bool check SWIG_CHECK_DECL_ARGS(SWIG_Object obj) {
|
||||
return obj && SWIG_IsOK(asval SWIG_AS_CALL_ARGS(obj, (Type *)(0)));
|
||||
static int check SWIG_CHECK_DECL_ARGS(SWIG_Object obj) {
|
||||
if (obj) {
|
||||
int res = asval SWIG_AS_CALL_ARGS(obj, (Type *)(0));
|
||||
return SWIG_CheckState(res);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_checkptr {
|
||||
static bool check SWIG_CHECK_DECL_ARGS(SWIG_Object obj) {
|
||||
return obj && asptr SWIG_AS_CALL_ARGS(obj, (Type **)(0));
|
||||
static int check SWIG_CHECK_DECL_ARGS(SWIG_Object obj) {
|
||||
if (obj) {
|
||||
int res = asptr SWIG_AS_CALL_ARGS(obj, (Type **)(0));
|
||||
return SWIG_CheckState(res);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -189,7 +199,7 @@ namespace swig {
|
|||
};
|
||||
|
||||
template <class Type>
|
||||
inline bool check SWIG_CHECK_DECL_ARGS(SWIG_Object obj) {
|
||||
inline int check SWIG_CHECK_DECL_ARGS(SWIG_Object obj) {
|
||||
return traits_check<Type>::check SWIG_CHECK_CALL_ARGS(obj);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@
|
|||
}
|
||||
$result = %static_cast(val,$type);
|
||||
}
|
||||
%typemap(directorout,noblock=1,fragment=frag,warning=SWIG_WARN_TYPEMAP_THREAD_UNSAFE) const Type& {
|
||||
%typemap(directorout,noblock=1,fragment=frag,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR) const Type& {
|
||||
Type val;
|
||||
int res = asval_meth($input, &val);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
|
|
@ -161,8 +161,8 @@
|
|||
|
||||
%define %value_typecheck_typemap(check,asval_meth,frag,Type...)
|
||||
%typemap(typecheck,noblock=1,precedence=check,fragment=frag) Type, const Type& {
|
||||
int res = SWIG_CastRank(asval_meth($input, NULL));
|
||||
$1 = SWIG_IsOK(res) ? res : 0;
|
||||
int res = asval_meth($input, NULL);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@
|
|||
/* in */
|
||||
|
||||
%typemap(in,noblock=1) void * {
|
||||
if (SWIG_ConvertPtr($input,%as_voidptrptr(&$1), 0, $disown) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input,%as_voidptrptr(&$1), 0, $disown))) {
|
||||
%argument_fail(SWIG_TypeError, "$type", $argnum);
|
||||
}
|
||||
}
|
||||
%typemap(freearg) void * "";
|
||||
|
||||
%typemap(in,noblock=1) void * const& ($*ltype temp) {
|
||||
if (SWIG_ConvertPtr($input, %as_voidptrptr(&temp), 0, $disown) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, %as_voidptrptr(&temp), 0, $disown))) {
|
||||
%argument_fail(SWIG_TypeError, "Stype", $argnum);
|
||||
}
|
||||
$1 = &temp;
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
%typemap(varin,noblock=1) void * {
|
||||
void *temp = 0;
|
||||
if (SWIG_ConvertPtr($input, &temp, 0, SWIG_POINTER_DISOWN) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &temp, 0, SWIG_POINTER_DISOWN))) {
|
||||
%variable_fail(SWIG_TypeError, "$type", "$name");
|
||||
}
|
||||
$1 = ($1_ltype) temp;
|
||||
|
|
@ -43,7 +43,8 @@
|
|||
%typecheck(SWIG_TYPECHECK_VOIDPTR, noblock=1) void *
|
||||
{
|
||||
void *ptr = 0;
|
||||
$1 = (SWIG_ConvertPtr($input, &ptr, 0, 0) == SWIG_OK);
|
||||
int res = SWIG_ConvertPtr($input, &ptr, 0, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
#if defined(SWIG_DIRECTOR_TYPEMAPS)
|
||||
|
|
@ -58,14 +59,14 @@
|
|||
/* directorout */
|
||||
|
||||
%typemap(directorout,noblock=1) void * (void *argp) {
|
||||
if (SWIG_ConvertPtr($input, &argp, 0, 0) != SWIG_OK) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp, 0, 0))) {
|
||||
%dirout_fail(SWIG_TypeError,"$type");
|
||||
}
|
||||
$result = %reinterpret_cast(argp, $ltype);
|
||||
}
|
||||
|
||||
%typemap(directorout,noblock=1,warning=SWIG_WARN_TYPEMAP_THREAD_UNSAFE) void * const& (void *argp) {
|
||||
if (SWIG_ConvertPtr($input, &argp, 0, $disown) != SWIG_OK) {
|
||||
%typemap(directorout,noblock=1,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR) void * const& (void *argp) {
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp, 0, $disown))) {
|
||||
%dirout_fail(SWIG_TypeError,"$type");
|
||||
}
|
||||
static $*ltype temp = %reinterpret_cast(argp, $*ltype);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue