finishing the first stage of the typemap unification scheme, fixing issues with gcc and valgrind
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7692 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
733322c539
commit
ba3efb0917
44 changed files with 565 additions and 426 deletions
|
|
@ -1,2 +1,9 @@
|
|||
%define %array_class(TYPE,NAME)
|
||||
%array_class_wrap(TYPE,NAME,__getitem__,__setitem__)
|
||||
%enddef
|
||||
|
||||
%include <typemaps/carrays.swg>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ namespace Swig {
|
|||
swig_msg += msg;
|
||||
}
|
||||
if (!PyErr_Occurred()) {
|
||||
SWIG_Python_SetErrorMsg(error, getMessage());
|
||||
PyErr_SetString(error, getMessage());
|
||||
} else {
|
||||
SWIG_Python_AddErrorMsg(getMessage());
|
||||
}
|
||||
|
|
|
|||
1
Lib/python/exception.i
Normal file
1
Lib/python/exception.i
Normal file
|
|
@ -0,0 +1 @@
|
|||
%include <typemaps/exception.swg>
|
||||
|
|
@ -142,7 +142,7 @@ namespace swig
|
|||
char msg[1024];
|
||||
snprintf(msg, sizeof(msg), "in sequence element %d ", _index);
|
||||
if (!PyErr_Occurred()) {
|
||||
SWIG_set_errmsg(SWIG_TypeError,swig::type_name<T>());
|
||||
SWIG_type_error(swig::type_name<T>());
|
||||
}
|
||||
SWIG_Python_AddErrorMsg(msg);
|
||||
SWIG_Python_AddErrorMsg(e.what());
|
||||
|
|
@ -336,7 +336,7 @@ namespace swig
|
|||
if (set_err) {
|
||||
char msg[1024];
|
||||
snprintf(msg, sizeof(msg), "in sequence element %d of type %s", i, swig::type_name<value_type>());
|
||||
SWIG_set_errmsg(SWIG_TypeError, msg);
|
||||
SWIG_Error(SWIG_RuntimeError, msg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,50 +2,56 @@
|
|||
* error manipulation
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
%insert("header") %{
|
||||
|
||||
SWIGINTERN PyObject*
|
||||
SWIG_Python_ErrorType(int code) {
|
||||
PyObject* type = 0;
|
||||
switch(code) {
|
||||
case SWIG_MemoryError:
|
||||
return PyExc_MemoryError;
|
||||
type = PyExc_MemoryError;
|
||||
break;
|
||||
case SWIG_IOError:
|
||||
return PyExc_IOError;
|
||||
type = PyExc_IOError;
|
||||
break;
|
||||
case SWIG_RuntimeError:
|
||||
return PyExc_RuntimeError;
|
||||
type = PyExc_RuntimeError;
|
||||
break;
|
||||
case SWIG_IndexError:
|
||||
return PyExc_IndexError;
|
||||
type = PyExc_IndexError;
|
||||
break;
|
||||
case SWIG_TypeError:
|
||||
return PyExc_TypeError;
|
||||
type = PyExc_TypeError;
|
||||
break;
|
||||
case SWIG_DivisionByZero:
|
||||
return PyExc_ZeroDivisionError;
|
||||
type = PyExc_ZeroDivisionError;
|
||||
break;
|
||||
case SWIG_OverflowError:
|
||||
return PyExc_OverflowError;
|
||||
type = PyExc_OverflowError;
|
||||
break;
|
||||
case SWIG_SyntaxError:
|
||||
return PyExc_SyntaxError;
|
||||
type = PyExc_SyntaxError;
|
||||
break;
|
||||
case SWIG_ValueError:
|
||||
return PyExc_ValueError;
|
||||
type = PyExc_ValueError;
|
||||
break;
|
||||
case SWIG_SystemError:
|
||||
return PyExc_SystemError;
|
||||
type = PyExc_SystemError;
|
||||
break;
|
||||
case SWIG_AttributeError:
|
||||
return PyExc_AttributeError;
|
||||
type = PyExc_AttributeError;
|
||||
break;
|
||||
default:
|
||||
return PyExc_RuntimeError;
|
||||
type = PyExc_RuntimeError;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
SWIGINTERN void
|
||||
SWIG_Python_SetErrorMsg(PyObject *type, const char *mesg) {
|
||||
PyErr_SetString(type, mesg);
|
||||
SWIGINTERNINLINE PyObject *
|
||||
SWIG_Python_ExceptionType(swig_type_info *desc) {
|
||||
return (desc && desc->clientdata ? (PyObject *)(desc->clientdata) : PyExc_RuntimeError);
|
||||
}
|
||||
|
||||
SWIGINTERNINLINE void
|
||||
SWIG_Python_SetExceptionObj(swig_type_info *desc, PyObject *obj) {
|
||||
PyErr_SetObject((desc && desc->clientdata ? (PyObject *)(desc->clientdata) : PyExc_RuntimeError), obj);
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN void
|
||||
SWIG_Python_AddErrorMsg(const char* mesg)
|
||||
{
|
||||
|
|
@ -56,10 +62,11 @@ SWIG_Python_AddErrorMsg(const char* mesg)
|
|||
if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
|
||||
if (value) {
|
||||
PyObject *old_str = PyObject_Str(value);
|
||||
Py_XINCREF(type);
|
||||
PyErr_Clear();
|
||||
Py_XINCREF(type);
|
||||
PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
|
||||
Py_DECREF(old_str);
|
||||
Py_DECREF(value);
|
||||
} else {
|
||||
PyErr_Format(PyExc_RuntimeError, mesg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,18 +7,18 @@
|
|||
%init %{
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Python-specific SWIG API */
|
||||
#define SWIG_newvarlink() SWIG_Python_newvarlink()
|
||||
#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
|
||||
#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* global variable support code.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
typedef struct swig_globalvar {
|
||||
char *name; /* Name of global variable */
|
||||
PyObject *(*get_attr)(void); /* Return the current value */
|
||||
|
|
@ -50,6 +50,17 @@ swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
SWIGINTERN void
|
||||
swig_varlink_delete(swig_varlinkobject *v) {
|
||||
swig_globalvar *var = v->vars;
|
||||
while (var) {
|
||||
swig_globalvar *n = var->next;
|
||||
free(var->name);
|
||||
free(var);
|
||||
var = n;
|
||||
}
|
||||
}
|
||||
|
||||
SWIGINTERN PyObject *
|
||||
swig_varlink_getattr(swig_varlinkobject *v, char *n) {
|
||||
swig_globalvar *var = v->vars;
|
||||
|
|
@ -92,7 +103,7 @@ swig_varlink_type(void) {
|
|||
(char *)"swigvarlink", /* Type name (tp_name) */
|
||||
sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */
|
||||
0, /* Itemsize (tp_itemsize) */
|
||||
0, /* Deallocator (tp_dealloc) */
|
||||
(destructor) swig_varlink_delete, /* Deallocator (tp_dealloc) */
|
||||
(printfunc) swig_varlink_print, /* Print (tp_print) */
|
||||
(getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
|
||||
(setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
|
||||
|
|
@ -162,6 +173,13 @@ SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int
|
|||
v->vars = gv;
|
||||
}
|
||||
|
||||
SWIGINTERN PyObject *
|
||||
SWIG_globals() {
|
||||
static PyObject *_SWIG_globals = 0;
|
||||
if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();
|
||||
return _SWIG_globals;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* constants/methods manipulation
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
@ -185,6 +203,7 @@ SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
|
|||
}
|
||||
if (obj) {
|
||||
PyDict_SetItemString(d, constants[i].name, obj);
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -233,7 +252,7 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
@ -247,17 +266,16 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
|
|||
extern "C"
|
||||
#endif
|
||||
SWIGEXPORT void SWIG_init(void) {
|
||||
static PyObject *SWIG_globals = 0;
|
||||
PyObject *m, *d;
|
||||
if (!SWIG_globals) SWIG_globals = SWIG_newvarlink();
|
||||
|
||||
|
||||
/* Fix SwigMethods to carry the callback ptrs when needed */
|
||||
SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
|
||||
|
||||
m = Py_InitModule((char *) SWIG_name, SwigMethods);
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
|
||||
SWIG_InitializeModule(0);
|
||||
SWIG_InstallConstants(d,swig_const_table);
|
||||
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,35 +32,27 @@
|
|||
|
||||
|
||||
/* Runtime API */
|
||||
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
|
||||
|
||||
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
|
||||
|
||||
/* Error manipulation */
|
||||
#define SWIG_ERROR -1
|
||||
#define SWIG_fail goto fail
|
||||
#define SWIG_var_fail return 1
|
||||
|
||||
#define SWIG_error(code, msg) SWIG_Python_SetErrorMsg(SWIG_Python_ErrorType(code), msg)
|
||||
#define SWIG_exception(code, msg) do { SWIG_error(code, msg); SWIG_fail; } while (0)
|
||||
#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_error(SWIG_RuntimeError, msg); SWIG_fail; } else
|
||||
#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
|
||||
#define SWIG_Error(code, msg) PyErr_SetString(SWIG_Python_ErrorType(code), msg)
|
||||
#define SWIG_fail goto fail
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Pointer declarations
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
SWIGRUNTIMEINLINE PyObject *
|
||||
SWIG_Python_NoneObject() {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Create a new pointer object
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#if 0
|
||||
} /* cc-mode */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* PySwigObject */
|
||||
|
||||
|
|
@ -191,51 +183,51 @@ PySwigObject_type(void) {
|
|||
|
||||
static PyTypeObject pyswigobject_type
|
||||
#if !defined(__cplusplus)
|
||||
;
|
||||
;
|
||||
static int type_init = 0;
|
||||
if (!type_init) {
|
||||
PyTypeObject tmp
|
||||
#endif
|
||||
= {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /*ob_size*/
|
||||
(char *)"PySwigObject", /*tp_name*/
|
||||
sizeof(PySwigObject), /*tp_basicsize*/
|
||||
0, /*tp_itemsize*/
|
||||
/* methods */
|
||||
(destructor)PySwigObject_dealloc, /*tp_dealloc*/
|
||||
(printfunc)PySwigObject_print, /*tp_print*/
|
||||
(getattrfunc)0, /*tp_getattr*/
|
||||
(setattrfunc)0, /*tp_setattr*/
|
||||
(cmpfunc)PySwigObject_compare, /*tp_compare*/
|
||||
(reprfunc)PySwigObject_repr, /*tp_repr*/
|
||||
&PySwigObject_as_number, /*tp_as_number*/
|
||||
0, /*tp_as_sequence*/
|
||||
0, /*tp_as_mapping*/
|
||||
(hashfunc)0, /*tp_hash*/
|
||||
(ternaryfunc)0, /*tp_call*/
|
||||
(reprfunc)PySwigObject_str, /*tp_str*/
|
||||
/* Space for future expansion */
|
||||
0,0,0,0,
|
||||
pyswigobject_type__doc__, /* Documentation string */
|
||||
= {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /*ob_size*/
|
||||
(char *)"PySwigObject", /*tp_name*/
|
||||
sizeof(PySwigObject), /*tp_basicsize*/
|
||||
0, /*tp_itemsize*/
|
||||
/* methods */
|
||||
(destructor)PySwigObject_dealloc, /*tp_dealloc*/
|
||||
(printfunc)PySwigObject_print, /*tp_print*/
|
||||
(getattrfunc)0, /*tp_getattr*/
|
||||
(setattrfunc)0, /*tp_setattr*/
|
||||
(cmpfunc)PySwigObject_compare, /*tp_compare*/
|
||||
(reprfunc)PySwigObject_repr, /*tp_repr*/
|
||||
&PySwigObject_as_number, /*tp_as_number*/
|
||||
0, /*tp_as_sequence*/
|
||||
0, /*tp_as_mapping*/
|
||||
(hashfunc)0, /*tp_hash*/
|
||||
(ternaryfunc)0, /*tp_call*/
|
||||
(reprfunc)PySwigObject_str, /*tp_str*/
|
||||
/* Space for future expansion */
|
||||
0,0,0,0,
|
||||
pyswigobject_type__doc__, /* Documentation string */
|
||||
#if PY_VERSION_HEX >= 0x02000000
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x02010000
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x02020000
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x02030000
|
||||
0, /* tp_del */
|
||||
0, /* tp_del */
|
||||
#endif
|
||||
#ifdef COUNT_ALLOCS
|
||||
0,0,0,0 /* tp_alloc -> tp_next */
|
||||
0,0,0,0 /* tp_alloc -> tp_next */
|
||||
#endif
|
||||
};
|
||||
};
|
||||
#if !defined(__cplusplus)
|
||||
pyswigobject_type = tmp;
|
||||
type_init = 1;
|
||||
|
|
@ -348,51 +340,51 @@ PySwigPacked_type(void) {
|
|||
"Swig object carries a C/C++ instance pointer";
|
||||
static PyTypeObject pyswigpacked_type
|
||||
#if !defined(__cplusplus)
|
||||
;
|
||||
;
|
||||
static int type_init = 0;
|
||||
if (!type_init) {
|
||||
PyTypeObject tmp
|
||||
#endif
|
||||
= {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /*ob_size*/
|
||||
(char *)"PySwigPacked", /*tp_name*/
|
||||
sizeof(PySwigPacked), /*tp_basicsize*/
|
||||
0, /*tp_itemsize*/
|
||||
/* methods */
|
||||
(destructor)PySwigPacked_dealloc, /*tp_dealloc*/
|
||||
(printfunc)PySwigPacked_print, /*tp_print*/
|
||||
(getattrfunc)0, /*tp_getattr*/
|
||||
(setattrfunc)0, /*tp_setattr*/
|
||||
(cmpfunc)PySwigPacked_compare, /*tp_compare*/
|
||||
(reprfunc)PySwigPacked_repr, /*tp_repr*/
|
||||
0, /*tp_as_number*/
|
||||
0, /*tp_as_sequence*/
|
||||
0, /*tp_as_mapping*/
|
||||
(hashfunc)0, /*tp_hash*/
|
||||
(ternaryfunc)0, /*tp_call*/
|
||||
(reprfunc)PySwigPacked_str, /*tp_str*/
|
||||
/* Space for future expansion */
|
||||
0,0,0,0,
|
||||
pyswigpacked_type__doc__, /* Documentation string */
|
||||
= {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /*ob_size*/
|
||||
(char *)"PySwigPacked", /*tp_name*/
|
||||
sizeof(PySwigPacked), /*tp_basicsize*/
|
||||
0, /*tp_itemsize*/
|
||||
/* methods */
|
||||
(destructor)PySwigPacked_dealloc, /*tp_dealloc*/
|
||||
(printfunc)PySwigPacked_print, /*tp_print*/
|
||||
(getattrfunc)0, /*tp_getattr*/
|
||||
(setattrfunc)0, /*tp_setattr*/
|
||||
(cmpfunc)PySwigPacked_compare, /*tp_compare*/
|
||||
(reprfunc)PySwigPacked_repr, /*tp_repr*/
|
||||
0, /*tp_as_number*/
|
||||
0, /*tp_as_sequence*/
|
||||
0, /*tp_as_mapping*/
|
||||
(hashfunc)0, /*tp_hash*/
|
||||
(ternaryfunc)0, /*tp_call*/
|
||||
(reprfunc)PySwigPacked_str, /*tp_str*/
|
||||
/* Space for future expansion */
|
||||
0,0,0,0,
|
||||
pyswigpacked_type__doc__, /* Documentation string */
|
||||
#if PY_VERSION_HEX >= 0x02000000
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x02010000
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x02020000
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x02030000
|
||||
0, /* tp_del */
|
||||
0, /* tp_del */
|
||||
#endif
|
||||
#ifdef COUNT_ALLOCS
|
||||
0,0,0,0 /* tp_alloc -> tp_next */
|
||||
0,0,0,0 /* tp_alloc -> tp_next */
|
||||
#endif
|
||||
};
|
||||
};
|
||||
#if !defined(__cplusplus)
|
||||
pyswigpacked_type = tmp;
|
||||
type_init = 1;
|
||||
|
|
@ -479,7 +471,7 @@ SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags)
|
|||
if (newref) { Py_DECREF(obj); }
|
||||
goto type_check;
|
||||
|
||||
type_check:
|
||||
type_check:
|
||||
if (ty) {
|
||||
tc = SWIG_TypeCheck(c,ty);
|
||||
if (!tc) goto type_error;
|
||||
|
|
@ -492,7 +484,7 @@ type_check:
|
|||
}
|
||||
return SWIG_OK;
|
||||
|
||||
type_error:
|
||||
type_error:
|
||||
PyErr_Clear();
|
||||
if (pyobj && !obj) {
|
||||
obj = pyobj;
|
||||
|
|
@ -524,12 +516,15 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t
|
|||
}
|
||||
return SWIG_OK;
|
||||
|
||||
type_error:
|
||||
type_error:
|
||||
PyErr_Clear();
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
/* Create a new array object */
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Create a new pointer object
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
|
||||
PyObject *robj = 0;
|
||||
|
|
@ -562,6 +557,8 @@ SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
|
|||
return robj;
|
||||
}
|
||||
|
||||
/* Create a new array object */
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
|
||||
PyObject *robj = 0;
|
||||
|
|
@ -603,7 +600,7 @@ SWIG_Python_GetModule(void) {
|
|||
|
||||
#if PY_MAJOR_VERSION < 2
|
||||
/* PyModule_AddObject function was introduced in Python 2.0. The following function
|
||||
is copied out of Python/modsupport.c in python version 2.3.4 */
|
||||
is copied out of Python/modsupport.c in python version 2.3.4 */
|
||||
SWIGINTERN int
|
||||
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
|
||||
{
|
||||
|
|
@ -646,5 +643,8 @@ SWIG_Python_SetModule(swig_module_info *swig_module) {
|
|||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if 0
|
||||
{ /* cc-mode */
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ PyString_FromFormat(const char *fmt, ...) {
|
|||
|
||||
%}
|
||||
%insert(runtime) "swigrun.swg"; /* SWIG API */
|
||||
%insert(runtime) "swigerrors.swg" /* SWIG errors */
|
||||
%insert(runtime) "pyapi.swg"; /* Pyton API */
|
||||
%insert(runtime) "pyrun.swg"; /* Python run-time code */
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ namespace swig {
|
|||
Type v;
|
||||
if (!obj || (asval(obj, &v) != SWIG_OK)) {
|
||||
if (!PyErr_Occurred()) {
|
||||
SWIG_Python_SetErrorMsg(SWIG_Python_ErrorType(SWIG_TypeError), swig::type_name<Type>());
|
||||
SWIG_type_error(swig::type_name<Type>());
|
||||
}
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
}
|
||||
|
|
@ -139,7 +139,7 @@ namespace swig {
|
|||
// Uninitialized return value, no Type() constructor required.
|
||||
static Type *v_def = (Type*) malloc(sizeof(Type));
|
||||
if (!PyErr_Occurred()) {
|
||||
SWIG_Python_SetErrorMsg(SWIG_Python_ErrorType(SWIG_TypeError), swig::type_name<Type>());
|
||||
SWIG_type_error(swig::type_name<Type>());
|
||||
}
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
memset(v_def,0,sizeof(Type));
|
||||
|
|
@ -157,7 +157,7 @@ namespace swig {
|
|||
return v;
|
||||
} else {
|
||||
if (!PyErr_Occurred()) {
|
||||
SWIG_Python_SetErrorMsg(SWIG_Python_ErrorType(SWIG_TypeError),swig::type_name<Type>());
|
||||
SWIG_type_error(swig::type_name<Type>());
|
||||
}
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* Error manipulation
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <pyerrors.swg>
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -18,16 +18,11 @@
|
|||
|
||||
%define_swig_object(PyObject *)
|
||||
|
||||
#define SWIG_VoidObject() (Py_INCREF(Py_None) ? Py_None : 0)
|
||||
#define SWIG_SetResultObj(obj) $result = obj
|
||||
#define SWIG_AppendResultObj(obj) $result = SWIG_Python_AppendResult($result, obj)
|
||||
#define SWIG_SetConstantObj(name, obj) PyDict_SetItemString(d, name, obj);
|
||||
#define SWIG_NoneObject() SWIG_Python_NoneObject()
|
||||
|
||||
/* error manipulation */
|
||||
#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
|
||||
#define SWIG_SetErrorObj(code, obj) PyErr_SetObject(SWIG_ErrorType(code), obj)
|
||||
#define SWIG_SetErrorMsg(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code),msg)
|
||||
#define SWIG_ExceptionObj(desc, type, obj) SWIG_Python_SetExceptionObj(desc, obj)
|
||||
#define SWIG_SetConstantObj(name, obj) SWIG_block(PyObject *_obj = obj; PyDict_SetItemString(d, name, _obj); Py_DECREF(_obj))
|
||||
#define SWIG_Raise(obj, type, desc) PyObject *_obj = obj; PyErr_SetObject(SWIG_Python_ExceptionType(desc), _obj); Py_DECREF(_obj)
|
||||
#define SWIG_DirOutFail(code, msg) Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(code), msg)
|
||||
|
||||
|
||||
|
|
@ -35,14 +30,9 @@
|
|||
* All the typemaps
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
%fragment("t_output_helper","header") %{
|
||||
#define t_output_helper SWIG_Python_AppendResult
|
||||
%}
|
||||
|
||||
|
||||
%include "pyfragments.swg"
|
||||
|
||||
%include <typemaps/exception.swg>
|
||||
%include <pyswigtype.swg>
|
||||
%include <typemaps/void.swg>
|
||||
%include <typemaps/valtypes.swg>
|
||||
|
|
@ -54,3 +44,11 @@
|
|||
%include <typemaps/misctypes.swg>
|
||||
%include <typemaps/enumint.swg>
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Backward compatibility output helper
|
||||
* ----------------------------------------------------------------------------- */
|
||||
%fragment("t_output_helper","header") %{
|
||||
#define t_output_helper SWIG_Python_AppendResult
|
||||
%}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue