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,6 +1,26 @@
|
||||||
Version 1.3.27 (October 15, 2005)
|
Version 1.3.27 (October 15, 2005)
|
||||||
=================================
|
=================================
|
||||||
|
|
||||||
|
10/20/2005: mmatus
|
||||||
|
Ruby, Tcl, Python:
|
||||||
|
|
||||||
|
- Uniform way to fail (label fail:), now finally
|
||||||
|
SWIG_exception works across the three languages and all
|
||||||
|
the typemaps.
|
||||||
|
|
||||||
|
- Add proper cleanup code to ruby
|
||||||
|
|
||||||
|
- More valgrind fixes
|
||||||
|
|
||||||
|
- Simplify the inline use, it seems a small interface of
|
||||||
|
20,000 lines (plus many many templates0 can break
|
||||||
|
gcc -O3 easily.
|
||||||
|
|
||||||
|
- Finalize the typemaps library. All the old *.i files
|
||||||
|
(carray.i, cpointer.i, exception.i) had been implemented
|
||||||
|
in the new typemaps library.
|
||||||
|
|
||||||
|
|
||||||
10/19/2005: wuzzeb
|
10/19/2005: wuzzeb
|
||||||
Update the Runtime Typemap documentation in Typemaps.html
|
Update the Runtime Typemap documentation in Typemaps.html
|
||||||
|
|
||||||
|
|
|
||||||
9
Examples/test-suite/python/li_carrays_runme.py
Normal file
9
Examples/test-suite/python/li_carrays_runme.py
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
from li_carrays import *
|
||||||
|
|
||||||
|
d = doubleArray(10)
|
||||||
|
|
||||||
|
d[0] = 7
|
||||||
|
d[5] = d[0] + 3
|
||||||
|
|
||||||
|
if d[5] + d[0] != 17:
|
||||||
|
raise RuntimeError
|
||||||
|
|
@ -5,3 +5,9 @@ f = voidtest.Foo()
|
||||||
f.memberfunc()
|
f.memberfunc()
|
||||||
|
|
||||||
voidtest.Foo_staticmemberfunc()
|
voidtest.Foo_staticmemberfunc()
|
||||||
|
|
||||||
|
def fvoid():
|
||||||
|
pass
|
||||||
|
|
||||||
|
if f.memberfunc() != fvoid():
|
||||||
|
raise RuntimeError
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ void globalfunc(void) {
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
public:
|
public:
|
||||||
Foo() { }
|
Foo(void) { }
|
||||||
void memberfunc(void) { }
|
void memberfunc(void) { }
|
||||||
static void staticmemberfunc(void) { }
|
static void staticmemberfunc(void) { }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
%include "python/pythonkw.swg"
|
%include "python/pythonkw.swg"
|
||||||
%include "ocaml/ocamlkw.swg"
|
%include "ocaml/ocamlkw.swg"
|
||||||
%include "ruby/rubykw.swg"
|
%include "ruby/rubykw.swg"
|
||||||
%include "tcl/tcl8kw.swg"
|
%include "tcl/tclkw.swg"
|
||||||
|
|
||||||
|
|
||||||
#endif //__Lib_allkw_swg__
|
#endif //__Lib_allkw_swg__
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
// This SWIG library file provides language independent exception handling
|
// This SWIG library file provides language independent exception handling
|
||||||
|
|
||||||
|
|
||||||
|
%insert("runtime") "swigerrors.swg"
|
||||||
|
|
||||||
#ifdef SWIGPERL5
|
#ifdef SWIGPERL5
|
||||||
%{
|
%{
|
||||||
#define SWIG_exception(a,b) SWIG_croak(b)
|
#define SWIG_exception(a,b) SWIG_croak(b)
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,9 @@
|
||||||
|
%define %array_class(TYPE,NAME)
|
||||||
|
%array_class_wrap(TYPE,NAME,__getitem__,__setitem__)
|
||||||
|
%enddef
|
||||||
|
|
||||||
%include <typemaps/carrays.swg>
|
%include <typemaps/carrays.swg>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ namespace Swig {
|
||||||
swig_msg += msg;
|
swig_msg += msg;
|
||||||
}
|
}
|
||||||
if (!PyErr_Occurred()) {
|
if (!PyErr_Occurred()) {
|
||||||
SWIG_Python_SetErrorMsg(error, getMessage());
|
PyErr_SetString(error, getMessage());
|
||||||
} else {
|
} else {
|
||||||
SWIG_Python_AddErrorMsg(getMessage());
|
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];
|
char msg[1024];
|
||||||
snprintf(msg, sizeof(msg), "in sequence element %d ", _index);
|
snprintf(msg, sizeof(msg), "in sequence element %d ", _index);
|
||||||
if (!PyErr_Occurred()) {
|
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(msg);
|
||||||
SWIG_Python_AddErrorMsg(e.what());
|
SWIG_Python_AddErrorMsg(e.what());
|
||||||
|
|
@ -336,7 +336,7 @@ namespace swig
|
||||||
if (set_err) {
|
if (set_err) {
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
snprintf(msg, sizeof(msg), "in sequence element %d of type %s", i, swig::type_name<value_type>());
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,50 +2,56 @@
|
||||||
* error manipulation
|
* error manipulation
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
%insert("header") %{
|
%insert("header") %{
|
||||||
|
|
||||||
SWIGINTERN PyObject*
|
SWIGINTERN PyObject*
|
||||||
SWIG_Python_ErrorType(int code) {
|
SWIG_Python_ErrorType(int code) {
|
||||||
|
PyObject* type = 0;
|
||||||
switch(code) {
|
switch(code) {
|
||||||
case SWIG_MemoryError:
|
case SWIG_MemoryError:
|
||||||
return PyExc_MemoryError;
|
type = PyExc_MemoryError;
|
||||||
|
break;
|
||||||
case SWIG_IOError:
|
case SWIG_IOError:
|
||||||
return PyExc_IOError;
|
type = PyExc_IOError;
|
||||||
|
break;
|
||||||
case SWIG_RuntimeError:
|
case SWIG_RuntimeError:
|
||||||
return PyExc_RuntimeError;
|
type = PyExc_RuntimeError;
|
||||||
|
break;
|
||||||
case SWIG_IndexError:
|
case SWIG_IndexError:
|
||||||
return PyExc_IndexError;
|
type = PyExc_IndexError;
|
||||||
|
break;
|
||||||
case SWIG_TypeError:
|
case SWIG_TypeError:
|
||||||
return PyExc_TypeError;
|
type = PyExc_TypeError;
|
||||||
|
break;
|
||||||
case SWIG_DivisionByZero:
|
case SWIG_DivisionByZero:
|
||||||
return PyExc_ZeroDivisionError;
|
type = PyExc_ZeroDivisionError;
|
||||||
|
break;
|
||||||
case SWIG_OverflowError:
|
case SWIG_OverflowError:
|
||||||
return PyExc_OverflowError;
|
type = PyExc_OverflowError;
|
||||||
|
break;
|
||||||
case SWIG_SyntaxError:
|
case SWIG_SyntaxError:
|
||||||
return PyExc_SyntaxError;
|
type = PyExc_SyntaxError;
|
||||||
|
break;
|
||||||
case SWIG_ValueError:
|
case SWIG_ValueError:
|
||||||
return PyExc_ValueError;
|
type = PyExc_ValueError;
|
||||||
|
break;
|
||||||
case SWIG_SystemError:
|
case SWIG_SystemError:
|
||||||
return PyExc_SystemError;
|
type = PyExc_SystemError;
|
||||||
|
break;
|
||||||
case SWIG_AttributeError:
|
case SWIG_AttributeError:
|
||||||
return PyExc_AttributeError;
|
type = PyExc_AttributeError;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return PyExc_RuntimeError;
|
type = PyExc_RuntimeError;
|
||||||
}
|
}
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN void
|
SWIGINTERNINLINE PyObject *
|
||||||
SWIG_Python_SetErrorMsg(PyObject *type, const char *mesg) {
|
SWIG_Python_ExceptionType(swig_type_info *desc) {
|
||||||
PyErr_SetString(type, mesg);
|
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
|
SWIGINTERN void
|
||||||
SWIG_Python_AddErrorMsg(const char* mesg)
|
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 (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
|
||||||
if (value) {
|
if (value) {
|
||||||
PyObject *old_str = PyObject_Str(value);
|
PyObject *old_str = PyObject_Str(value);
|
||||||
Py_XINCREF(type);
|
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
|
Py_XINCREF(type);
|
||||||
PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
|
PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
|
||||||
Py_DECREF(old_str);
|
Py_DECREF(old_str);
|
||||||
|
Py_DECREF(value);
|
||||||
} else {
|
} else {
|
||||||
PyErr_Format(PyExc_RuntimeError, mesg);
|
PyErr_Format(PyExc_RuntimeError, mesg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,17 @@ swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) {
|
||||||
return 0;
|
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 *
|
SWIGINTERN PyObject *
|
||||||
swig_varlink_getattr(swig_varlinkobject *v, char *n) {
|
swig_varlink_getattr(swig_varlinkobject *v, char *n) {
|
||||||
swig_globalvar *var = v->vars;
|
swig_globalvar *var = v->vars;
|
||||||
|
|
@ -92,7 +103,7 @@ swig_varlink_type(void) {
|
||||||
(char *)"swigvarlink", /* Type name (tp_name) */
|
(char *)"swigvarlink", /* Type name (tp_name) */
|
||||||
sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */
|
sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */
|
||||||
0, /* Itemsize (tp_itemsize) */
|
0, /* Itemsize (tp_itemsize) */
|
||||||
0, /* Deallocator (tp_dealloc) */
|
(destructor) swig_varlink_delete, /* Deallocator (tp_dealloc) */
|
||||||
(printfunc) swig_varlink_print, /* Print (tp_print) */
|
(printfunc) swig_varlink_print, /* Print (tp_print) */
|
||||||
(getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
|
(getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
|
||||||
(setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
|
(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;
|
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
|
* constants/methods manipulation
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
@ -185,6 +203,7 @@ SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
|
||||||
}
|
}
|
||||||
if (obj) {
|
if (obj) {
|
||||||
PyDict_SetItemString(d, constants[i].name, obj);
|
PyDict_SetItemString(d, constants[i].name, obj);
|
||||||
|
Py_DECREF(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -247,9 +266,7 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
|
||||||
extern "C"
|
extern "C"
|
||||||
#endif
|
#endif
|
||||||
SWIGEXPORT void SWIG_init(void) {
|
SWIGEXPORT void SWIG_init(void) {
|
||||||
static PyObject *SWIG_globals = 0;
|
|
||||||
PyObject *m, *d;
|
PyObject *m, *d;
|
||||||
if (!SWIG_globals) SWIG_globals = SWIG_newvarlink();
|
|
||||||
|
|
||||||
/* Fix SwigMethods to carry the callback ptrs when needed */
|
/* Fix SwigMethods to carry the callback ptrs when needed */
|
||||||
SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
|
SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
|
||||||
|
|
@ -259,5 +276,6 @@ SWIGEXPORT void SWIG_init(void) {
|
||||||
|
|
||||||
SWIG_InitializeModule(0);
|
SWIG_InitializeModule(0);
|
||||||
SWIG_InstallConstants(d,swig_const_table);
|
SWIG_InstallConstants(d,swig_const_table);
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,35 +32,27 @@
|
||||||
|
|
||||||
|
|
||||||
/* Runtime API */
|
/* Runtime API */
|
||||||
|
|
||||||
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
|
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
|
||||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
|
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
|
||||||
|
|
||||||
/* Error manipulation */
|
/* 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_ErrorType(code) SWIG_Python_ErrorType(code)
|
||||||
#define SWIG_exception(code, msg) do { SWIG_error(code, msg); SWIG_fail; } while (0)
|
#define SWIG_Error(code, msg) PyErr_SetString(SWIG_Python_ErrorType(code), msg)
|
||||||
#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_error(SWIG_RuntimeError, msg); SWIG_fail; } else
|
#define SWIG_fail goto fail
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* Pointer declarations
|
* Pointer declarations
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
SWIGRUNTIMEINLINE PyObject *
|
|
||||||
SWIG_Python_NoneObject() {
|
|
||||||
Py_INCREF(Py_None);
|
|
||||||
return Py_None;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* Create a new pointer object
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#if 0
|
||||||
|
} /* cc-mode */
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* PySwigObject */
|
/* PySwigObject */
|
||||||
|
|
||||||
|
|
@ -479,7 +471,7 @@ SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags)
|
||||||
if (newref) { Py_DECREF(obj); }
|
if (newref) { Py_DECREF(obj); }
|
||||||
goto type_check;
|
goto type_check;
|
||||||
|
|
||||||
type_check:
|
type_check:
|
||||||
if (ty) {
|
if (ty) {
|
||||||
tc = SWIG_TypeCheck(c,ty);
|
tc = SWIG_TypeCheck(c,ty);
|
||||||
if (!tc) goto type_error;
|
if (!tc) goto type_error;
|
||||||
|
|
@ -492,7 +484,7 @@ type_check:
|
||||||
}
|
}
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
|
|
||||||
type_error:
|
type_error:
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
if (pyobj && !obj) {
|
if (pyobj && !obj) {
|
||||||
obj = pyobj;
|
obj = pyobj;
|
||||||
|
|
@ -524,12 +516,15 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t
|
||||||
}
|
}
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
|
|
||||||
type_error:
|
type_error:
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a new array object */
|
/* -----------------------------------------------------------------------------
|
||||||
|
* Create a new pointer object
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
SWIGRUNTIME PyObject *
|
SWIGRUNTIME PyObject *
|
||||||
SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
|
SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
|
||||||
PyObject *robj = 0;
|
PyObject *robj = 0;
|
||||||
|
|
@ -562,6 +557,8 @@ SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
|
||||||
return robj;
|
return robj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create a new array object */
|
||||||
|
|
||||||
SWIGRUNTIME PyObject *
|
SWIGRUNTIME PyObject *
|
||||||
SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
|
SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
|
||||||
PyObject *robj = 0;
|
PyObject *robj = 0;
|
||||||
|
|
@ -603,7 +600,7 @@ SWIG_Python_GetModule(void) {
|
||||||
|
|
||||||
#if PY_MAJOR_VERSION < 2
|
#if PY_MAJOR_VERSION < 2
|
||||||
/* PyModule_AddObject function was introduced in Python 2.0. The following function
|
/* 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
|
SWIGINTERN int
|
||||||
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
|
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
|
||||||
{
|
{
|
||||||
|
|
@ -646,5 +643,8 @@ SWIG_Python_SetModule(swig_module_info *swig_module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
#if 0
|
||||||
|
{ /* cc-mode */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ PyString_FromFormat(const char *fmt, ...) {
|
||||||
|
|
||||||
%}
|
%}
|
||||||
%insert(runtime) "swigrun.swg"; /* SWIG API */
|
%insert(runtime) "swigrun.swg"; /* SWIG API */
|
||||||
|
%insert(runtime) "swigerrors.swg" /* SWIG errors */
|
||||||
%insert(runtime) "pyapi.swg"; /* Pyton API */
|
%insert(runtime) "pyapi.swg"; /* Pyton API */
|
||||||
%insert(runtime) "pyrun.swg"; /* Python run-time code */
|
%insert(runtime) "pyrun.swg"; /* Python run-time code */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ namespace swig {
|
||||||
Type v;
|
Type v;
|
||||||
if (!obj || (asval(obj, &v) != SWIG_OK)) {
|
if (!obj || (asval(obj, &v) != SWIG_OK)) {
|
||||||
if (!PyErr_Occurred()) {
|
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");
|
if (throw_error) throw std::invalid_argument("bad type");
|
||||||
}
|
}
|
||||||
|
|
@ -139,7 +139,7 @@ namespace swig {
|
||||||
// Uninitialized return value, no Type() constructor required.
|
// Uninitialized return value, no Type() constructor required.
|
||||||
static Type *v_def = (Type*) malloc(sizeof(Type));
|
static Type *v_def = (Type*) malloc(sizeof(Type));
|
||||||
if (!PyErr_Occurred()) {
|
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");
|
if (throw_error) throw std::invalid_argument("bad type");
|
||||||
memset(v_def,0,sizeof(Type));
|
memset(v_def,0,sizeof(Type));
|
||||||
|
|
@ -157,7 +157,7 @@ namespace swig {
|
||||||
return v;
|
return v;
|
||||||
} else {
|
} else {
|
||||||
if (!PyErr_Occurred()) {
|
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");
|
if (throw_error) throw std::invalid_argument("bad type");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* Error manipulation
|
* Error manipulation
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
%include <pyerrors.swg>
|
%include <pyerrors.swg>
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,11 @@
|
||||||
|
|
||||||
%define_swig_object(PyObject *)
|
%define_swig_object(PyObject *)
|
||||||
|
|
||||||
|
#define SWIG_VoidObject() (Py_INCREF(Py_None) ? Py_None : 0)
|
||||||
#define SWIG_SetResultObj(obj) $result = obj
|
#define SWIG_SetResultObj(obj) $result = obj
|
||||||
#define SWIG_AppendResultObj(obj) $result = SWIG_Python_AppendResult($result, obj)
|
#define SWIG_AppendResultObj(obj) $result = SWIG_Python_AppendResult($result, obj)
|
||||||
#define SWIG_SetConstantObj(name, obj) PyDict_SetItemString(d, name, obj);
|
#define SWIG_SetConstantObj(name, obj) SWIG_block(PyObject *_obj = obj; PyDict_SetItemString(d, name, _obj); Py_DECREF(_obj))
|
||||||
#define SWIG_NoneObject() SWIG_Python_NoneObject()
|
#define SWIG_Raise(obj, type, desc) PyObject *_obj = obj; PyErr_SetObject(SWIG_Python_ExceptionType(desc), _obj); Py_DECREF(_obj)
|
||||||
|
|
||||||
/* 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_DirOutFail(code, msg) Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(code), msg)
|
#define SWIG_DirOutFail(code, msg) Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(code), msg)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -35,14 +30,9 @@
|
||||||
* All the typemaps
|
* All the typemaps
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
%fragment("t_output_helper","header") %{
|
|
||||||
#define t_output_helper SWIG_Python_AppendResult
|
|
||||||
%}
|
|
||||||
|
|
||||||
|
|
||||||
%include "pyfragments.swg"
|
%include "pyfragments.swg"
|
||||||
|
|
||||||
|
%include <typemaps/exception.swg>
|
||||||
%include <pyswigtype.swg>
|
%include <pyswigtype.swg>
|
||||||
%include <typemaps/void.swg>
|
%include <typemaps/void.swg>
|
||||||
%include <typemaps/valtypes.swg>
|
%include <typemaps/valtypes.swg>
|
||||||
|
|
@ -54,3 +44,11 @@
|
||||||
%include <typemaps/misctypes.swg>
|
%include <typemaps/misctypes.swg>
|
||||||
%include <typemaps/enumint.swg>
|
%include <typemaps/enumint.swg>
|
||||||
|
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* Backward compatibility output helper
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
%fragment("t_output_helper","header") %{
|
||||||
|
#define t_output_helper SWIG_Python_AppendResult
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,6 @@
|
||||||
|
%define %array_class(TYPE,NAME)
|
||||||
|
%array_class_wrap(TYPE,NAME,__getitem__,__setitem__)
|
||||||
|
%enddef
|
||||||
|
|
||||||
%include <typemaps/carrays.swg>
|
%include <typemaps/carrays.swg>
|
||||||
|
|
||||||
|
|
|
||||||
1
Lib/ruby/exception.i
Normal file
1
Lib/ruby/exception.i
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
%include <typemaps/exception.swg>
|
||||||
|
|
@ -4,6 +4,16 @@
|
||||||
* Ruby configuration module.
|
* Ruby configuration module.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* Inner macros
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
%include <rubymacros.swg>
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* Error manipulation
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
%include <rubyerrors.swg>
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* The runtime part
|
* The runtime part
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
@ -14,17 +24,6 @@
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
%include <rubyuserdir.swg>
|
%include <rubyuserdir.swg>
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* Inner macros
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
%include <rubymacros.swg>
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* Error manipulation
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
%include <rubyerrors.swg>
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* Look for user fragments file. If not found, include empty system one.
|
* Look for user fragments file. If not found, include empty system one.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
|
||||||
|
|
@ -2,45 +2,54 @@
|
||||||
* error manipulation
|
* error manipulation
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
%insert("runtime") "swigerrors.swg"
|
||||||
|
|
||||||
%insert("header") %{
|
%insert("header") %{
|
||||||
|
|
||||||
SWIGINTERN VALUE
|
SWIGINTERN VALUE
|
||||||
SWIG_Ruby_ErrorType(int SWIG_code) {
|
SWIG_Ruby_ErrorType(int SWIG_code) {
|
||||||
|
VALUE type;
|
||||||
switch (SWIG_code) {
|
switch (SWIG_code) {
|
||||||
case SWIG_MemoryError:
|
case SWIG_MemoryError:
|
||||||
return rb_eNoMemError;
|
type = rb_eNoMemError;
|
||||||
|
break;
|
||||||
case SWIG_IOError:
|
case SWIG_IOError:
|
||||||
return rb_eIOError;
|
type = rb_eIOError;
|
||||||
|
break;
|
||||||
case SWIG_RuntimeError:
|
case SWIG_RuntimeError:
|
||||||
return rb_eRuntimeError;
|
type = rb_eRuntimeError;
|
||||||
|
break;
|
||||||
case SWIG_IndexError:
|
case SWIG_IndexError:
|
||||||
return rb_eIndexError;
|
type = rb_eIndexError;
|
||||||
|
break;
|
||||||
case SWIG_TypeError:
|
case SWIG_TypeError:
|
||||||
return rb_eTypeError;
|
type = rb_eTypeError;
|
||||||
|
break;
|
||||||
case SWIG_DivisionByZero:
|
case SWIG_DivisionByZero:
|
||||||
return rb_eZeroDivError;
|
type = rb_eZeroDivError;
|
||||||
|
break;
|
||||||
case SWIG_OverflowError:
|
case SWIG_OverflowError:
|
||||||
return rb_eRangeError;
|
type = rb_eRangeError;
|
||||||
|
break;
|
||||||
case SWIG_SyntaxError:
|
case SWIG_SyntaxError:
|
||||||
return rb_eSyntaxError;
|
type = rb_eSyntaxError;
|
||||||
|
break;
|
||||||
case SWIG_ValueError:
|
case SWIG_ValueError:
|
||||||
return rb_eArgError;
|
type = rb_eArgError;
|
||||||
|
break;
|
||||||
case SWIG_SystemError:
|
case SWIG_SystemError:
|
||||||
return rb_eFatal;
|
type = rb_eFatal;
|
||||||
|
break;
|
||||||
case SWIG_AttributeError:
|
case SWIG_AttributeError:
|
||||||
return rb_eRuntimeError;
|
type = rb_eRuntimeError;
|
||||||
|
break;
|
||||||
case SWIG_UnknownError:
|
case SWIG_UnknownError:
|
||||||
return rb_eRuntimeError;
|
type = rb_eRuntimeError;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return rb_eRuntimeError;
|
type = rb_eRuntimeError;
|
||||||
}
|
}
|
||||||
}
|
return type;
|
||||||
|
|
||||||
|
|
||||||
SWIGINTERN void
|
|
||||||
SWIG_Ruby_SetErrorMsg(VALUE type, const char *msg) {
|
|
||||||
rb_raise(type, msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,18 @@
|
||||||
|
|
||||||
|
|
||||||
/* Runtime API */
|
/* Runtime API */
|
||||||
|
|
||||||
#define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule()
|
#define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule()
|
||||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
|
#define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
|
||||||
|
|
||||||
|
|
||||||
|
/* Error manipulation */
|
||||||
|
|
||||||
|
#define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
|
||||||
|
#define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), msg)
|
||||||
|
#define SWIG_fail goto fail
|
||||||
|
|
||||||
|
|
||||||
/* Ruby-specific SWIG API */
|
/* Ruby-specific SWIG API */
|
||||||
|
|
||||||
#define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
|
#define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
|
||||||
|
|
@ -40,27 +49,21 @@
|
||||||
#define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
|
#define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
|
||||||
#define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
|
#define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
|
||||||
|
|
||||||
/* Error manipulation */
|
|
||||||
#define SWIG_ERROR -1
|
|
||||||
#define SWIG_fail goto fail
|
|
||||||
#define SWIG_var_fail return Qnil
|
|
||||||
|
|
||||||
#define SWIG_error(code, msg) SWIG_Ruby_SetErrorMsg(SWIG_Ruby_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
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Flags for new pointer objects */
|
|
||||||
#define SWIG_TRACK_OBJECTS 0x4
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* pointers/data manipulation
|
* pointers/data manipulation
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#if 0
|
||||||
|
} /* cc-mode */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Flags for new pointer objects */
|
||||||
|
#define SWIG_TRACK_OBJECTS 0x4
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
VALUE klass;
|
VALUE klass;
|
||||||
VALUE mImpl;
|
VALUE mImpl;
|
||||||
|
|
@ -256,7 +259,7 @@ SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty, int fl
|
||||||
}
|
}
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
|
|
||||||
type_error:
|
type_error:
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -285,5 +288,8 @@ SWIG_Ruby_SetModule(swig_module_info *pointer)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
#if 0
|
||||||
|
{ /* cc-mode */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -13,16 +13,11 @@
|
||||||
|
|
||||||
%define_swig_object(VALUE)
|
%define_swig_object(VALUE)
|
||||||
|
|
||||||
|
#define SWIG_VoidObject() Qnil
|
||||||
#define SWIG_SetResultObj(obj) $result = obj
|
#define SWIG_SetResultObj(obj) $result = obj
|
||||||
#define SWIG_AppendResultObj(obj) $result = SWIG_Ruby_AppendResult($result, obj)
|
#define SWIG_AppendResultObj(obj) $result = SWIG_Ruby_AppendResult($result, obj)
|
||||||
#define SWIG_SetConstantObj(name, obj) rb_define_const($module, name, obj);
|
#define SWIG_SetConstantObj(name, obj) rb_define_const($module, name, obj)
|
||||||
#define SWIG_NoneObject() Qnil
|
#define SWIG_Raise(obj, type, desc) rb_exc_raise(rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj)))
|
||||||
|
|
||||||
/* error manipulation */
|
|
||||||
#define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
|
|
||||||
#define SWIG_SetErrorObj(code, obj) SWIG_Ruby_SetErrorMsg(SWIG_ErrorType(code),obj)
|
|
||||||
#define SWIG_SetErrorMsg(code, msg) SWIG_Ruby_SetErrorMsg(SWIG_ErrorType(code),msg)
|
|
||||||
#define SWIG_ExceptionObj(d, type, obj) rb_exc_raise(rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj)))
|
|
||||||
#define SWIG_DirOutFail(code, msg) Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(code), msg)
|
#define SWIG_DirOutFail(code, msg) Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(code), msg)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -32,6 +27,7 @@
|
||||||
|
|
||||||
%include "rubyfragments.swg"
|
%include "rubyfragments.swg"
|
||||||
|
|
||||||
|
%include <typemaps/exception.swg>
|
||||||
%include <typemaps/swigtype.swg>
|
%include <typemaps/swigtype.swg>
|
||||||
%include <typemaps/void.swg>
|
%include <typemaps/void.swg>
|
||||||
%include <typemaps/valtypes.swg>
|
%include <typemaps/valtypes.swg>
|
||||||
|
|
@ -43,3 +39,10 @@
|
||||||
%include <typemaps/misctypes.swg>
|
%include <typemaps/misctypes.swg>
|
||||||
%include <typemaps/enumint.swg>
|
%include <typemaps/enumint.swg>
|
||||||
|
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* Backward compatibility output helper
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
%fragment("output_helper","header") %{
|
||||||
|
#define output_helper SWIG_Ruby_AppendResult
|
||||||
|
%}
|
||||||
|
|
|
||||||
17
Lib/swigerrors.swg
Normal file
17
Lib/swigerrors.swg
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
/* Errors in SWIG */
|
||||||
|
|
||||||
|
#define SWIG_OK 0
|
||||||
|
#define SWIG_ERROR -1
|
||||||
|
|
||||||
|
#define SWIG_MemoryError 1
|
||||||
|
#define SWIG_IOError 2
|
||||||
|
#define SWIG_RuntimeError 3
|
||||||
|
#define SWIG_IndexError 4
|
||||||
|
#define SWIG_TypeError 5
|
||||||
|
#define SWIG_DivisionByZero 6
|
||||||
|
#define SWIG_OverflowError 7
|
||||||
|
#define SWIG_SyntaxError 8
|
||||||
|
#define SWIG_ValueError 9
|
||||||
|
#define SWIG_SystemError 10
|
||||||
|
#define SWIG_AttributeError 11
|
||||||
|
#define SWIG_UnknownError 99
|
||||||
|
|
@ -69,19 +69,3 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Error labels */
|
|
||||||
#define SWIG_OK 0
|
|
||||||
#define SWIG_ERROR -1
|
|
||||||
|
|
||||||
#define SWIG_MemoryError 1
|
|
||||||
#define SWIG_IOError 2
|
|
||||||
#define SWIG_RuntimeError 3
|
|
||||||
#define SWIG_IndexError 4
|
|
||||||
#define SWIG_TypeError 5
|
|
||||||
#define SWIG_DivisionByZero 6
|
|
||||||
#define SWIG_OverflowError 7
|
|
||||||
#define SWIG_SyntaxError 8
|
|
||||||
#define SWIG_ValueError 9
|
|
||||||
#define SWIG_SystemError 10
|
|
||||||
#define SWIG_AttributeError 11
|
|
||||||
#define SWIG_UnknownError 99
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,4 @@
|
||||||
%include <typemaps/carrays.swg>
|
%include <typemaps/carrays.swg>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
1
Lib/tcl/exception.i
Normal file
1
Lib/tcl/exception.i
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
%include <typemaps/exception.swg>
|
||||||
|
|
@ -4,6 +4,16 @@
|
||||||
* Tcl configuration module.
|
* Tcl configuration module.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* Inner macros
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
%include <tclmacros.swg>
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* Error manipulation
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
%include <tclerrors.swg>
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* The runtime part
|
* The runtime part
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
@ -14,17 +24,6 @@
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
%include <tcluserdir.swg>
|
%include <tcluserdir.swg>
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* Inner macros
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
%include <tclmacros.swg>
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* Error manipulation
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
%include <tclerrors.swg>
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* Look for user fragments file. If not found, include empty system one.
|
* Look for user fragments file. If not found, include empty system one.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
|
||||||
|
|
@ -2,37 +2,52 @@
|
||||||
* error manipulation
|
* error manipulation
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
%insert("runtime") "swigerrors.swg"
|
||||||
|
|
||||||
%insert("header") %{
|
%insert("header") %{
|
||||||
|
|
||||||
|
|
||||||
SWIGINTERN const char*
|
SWIGINTERN const char*
|
||||||
SWIG_Tcl_ErrorType(int code) {
|
SWIG_Tcl_ErrorType(int code) {
|
||||||
|
const char* type = 0;
|
||||||
switch(code) {
|
switch(code) {
|
||||||
case SWIG_MemoryError:
|
case SWIG_MemoryError:
|
||||||
return "MemoryError";
|
type = "MemoryError";
|
||||||
|
break;
|
||||||
case SWIG_IOError:
|
case SWIG_IOError:
|
||||||
return "IOError";
|
type = "IOError";
|
||||||
|
break;
|
||||||
case SWIG_RuntimeError:
|
case SWIG_RuntimeError:
|
||||||
return "RuntimeError";
|
type = "RuntimeError";
|
||||||
|
break;
|
||||||
case SWIG_IndexError:
|
case SWIG_IndexError:
|
||||||
return "IndexError";
|
type = "IndexError";
|
||||||
|
break;
|
||||||
case SWIG_TypeError:
|
case SWIG_TypeError:
|
||||||
return "TypeError";
|
type = "TypeError";
|
||||||
|
break;
|
||||||
case SWIG_DivisionByZero:
|
case SWIG_DivisionByZero:
|
||||||
return "ZeroDivisionError";
|
type = "ZeroDivisionError";
|
||||||
|
break;
|
||||||
case SWIG_OverflowError:
|
case SWIG_OverflowError:
|
||||||
return "OverflowError";
|
type = "OverflowError";
|
||||||
|
break;
|
||||||
case SWIG_SyntaxError:
|
case SWIG_SyntaxError:
|
||||||
return "SyntaxError";
|
type = "SyntaxError";
|
||||||
|
break;
|
||||||
case SWIG_ValueError:
|
case SWIG_ValueError:
|
||||||
return "ValueError";
|
type = "ValueError";
|
||||||
|
break;
|
||||||
case SWIG_SystemError:
|
case SWIG_SystemError:
|
||||||
return "SystemError";
|
type = "SystemError";
|
||||||
|
break;
|
||||||
case SWIG_AttributeError:
|
case SWIG_AttributeError:
|
||||||
return "AttributeError";
|
type = "AttributeError";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return "RuntimeError";
|
type = "RuntimeError";
|
||||||
}
|
}
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,22 @@
|
||||||
#define SWIG_ConvertMember(obj, ptr, sz, ty, flags) SWIG_Tcl_ConvertPacked(interp,obj, ptr, sz, ty, flags)
|
#define SWIG_ConvertMember(obj, ptr, sz, ty, flags) SWIG_Tcl_ConvertPacked(interp,obj, ptr, sz, ty, flags)
|
||||||
#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Tcl_NewPackedObj(ptr, sz, type, 0)
|
#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Tcl_NewPackedObj(ptr, sz, type, 0)
|
||||||
|
|
||||||
|
|
||||||
/* Runtime API */
|
/* Runtime API */
|
||||||
|
|
||||||
#define SWIG_GetModule(clientdata) SWIG_Tcl_GetModule((Tcl_Interp *) (clientdata))
|
#define SWIG_GetModule(clientdata) SWIG_Tcl_GetModule((Tcl_Interp *) (clientdata))
|
||||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Tcl_SetModule((Tcl_Interp *) (clientdata), pointer)
|
#define SWIG_SetModule(clientdata, pointer) SWIG_Tcl_SetModule((Tcl_Interp *) (clientdata), pointer)
|
||||||
|
|
||||||
|
|
||||||
|
/* Error manipulation */
|
||||||
|
|
||||||
|
#define SWIG_ErrorType(code) SWIG_Tcl_ErrorType(code)
|
||||||
|
#define SWIG_Error(code, msg) SWIG_Tcl_SetErrorMsg(interp, SWIG_Tcl_ErrorType(code), msg)
|
||||||
|
#define SWIG_fail goto fail
|
||||||
|
|
||||||
|
|
||||||
/* Tcl-specific SWIG API */
|
/* Tcl-specific SWIG API */
|
||||||
|
|
||||||
#define SWIG_Acquire(ptr) SWIG_Tcl_Acquire(ptr)
|
#define SWIG_Acquire(ptr) SWIG_Tcl_Acquire(ptr)
|
||||||
#define SWIG_MethodCommand SWIG_Tcl_MethodCommand
|
#define SWIG_MethodCommand SWIG_Tcl_MethodCommand
|
||||||
#define SWIG_Disown(ptr) SWIG_Tcl_Disown(ptr)
|
#define SWIG_Disown(ptr) SWIG_Tcl_Disown(ptr)
|
||||||
|
|
@ -46,19 +57,18 @@
|
||||||
#define SWIG_Thisown(ptr) SWIG_Tcl_Thisown(ptr)
|
#define SWIG_Thisown(ptr) SWIG_Tcl_Thisown(ptr)
|
||||||
#define SWIG_ObjectDelete SWIG_Tcl_ObjectDelete
|
#define SWIG_ObjectDelete SWIG_Tcl_ObjectDelete
|
||||||
|
|
||||||
/* Error manipulation */
|
|
||||||
#define SWIG_fail goto fail
|
|
||||||
#define SWIG_var_fail return "$name"
|
|
||||||
#define SWIG_exception(code, msg) do { SWIG_Tcl_SetErrorMsg(interp, SWIG_Tcl_ErrorType(code), msg); SWIG_fail; } while (0)
|
|
||||||
#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Tcl_SetErrorMsg(interp, 0, msg); SWIG_fail; } else
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* pointers/data manipulation
|
* pointers/data manipulation
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#if 0
|
||||||
|
} /* cc-mode */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Object support */
|
/* Object support */
|
||||||
|
|
||||||
SWIGRUNTIME Tcl_HashTable*
|
SWIGRUNTIME Tcl_HashTable*
|
||||||
|
|
@ -172,7 +182,7 @@ SWIG_Tcl_ConvertPacked(Tcl_Interp *interp, Tcl_Obj *obj, void *ptr, int sz, swig
|
||||||
}
|
}
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
|
|
||||||
type_error:
|
type_error:
|
||||||
|
|
||||||
if (flags) {
|
if (flags) {
|
||||||
if (ty) {
|
if (ty) {
|
||||||
|
|
@ -655,5 +665,8 @@ SWIG_Tcl_GetArgs(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], const char
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
#if 0
|
||||||
|
{ /* cc-mode */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -13,16 +13,12 @@
|
||||||
|
|
||||||
%define_swig_object(Tcl_Obj *)
|
%define_swig_object(Tcl_Obj *)
|
||||||
|
|
||||||
|
#define SWIG_VoidObject() NULL
|
||||||
#define SWIG_SetResultObj(obj) $result = obj
|
#define SWIG_SetResultObj(obj) $result = obj
|
||||||
#define SWIG_AppendResultObj(obj) $result = (Tcl_ListObjAppendElement(NULL,$result,obj) == TCL_OK) ? $result : NULL;
|
#define SWIG_AppendResultObj(obj) $result = (Tcl_ListObjAppendElement(NULL,$result,obj) == TCL_OK) ? $result : NULL
|
||||||
#define SWIG_SetConstantObj(name, obj) SWIG_Tcl_SetConstantObj(interp, name, obj)
|
#define SWIG_SetConstantObj(name, obj) SWIG_Tcl_SetConstantObj(interp, name, obj)
|
||||||
#define SWIG_NoneObject() NULL
|
#define SWIG_Raise(obj,type,desc) SWIG_Tcl_SetErrorObj(interp,type,obj)
|
||||||
|
#define SWIG_DirOutFail(code, msg) /* no directors supported */
|
||||||
/* error manipulation */
|
|
||||||
#define SWIG_ErrorType(code) SWIG_Tcl_ErrorType(code)
|
|
||||||
#define SWIG_SetErrorObj(code,obj) SWIG_Tcl_SetErrorObj(interp,SWIG_ErrorType(code),obj)
|
|
||||||
#define SWIG_SetErrorMsg(code,msg) SWIG_Tcl_SetErrorMsg(interp,SWIG_ErrorType(code),msg)
|
|
||||||
#define SWIG_ExceptionObj(d,type,obj) SWIG_Tcl_SetErrorObj(interp,type,obj)
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* All the typemaps
|
* All the typemaps
|
||||||
|
|
@ -30,6 +26,7 @@
|
||||||
|
|
||||||
%include "tclfragments.swg"
|
%include "tclfragments.swg"
|
||||||
|
|
||||||
|
%include <typemaps/exception.swg>
|
||||||
%include <tclswigtype.swg>
|
%include <tclswigtype.swg>
|
||||||
%include <typemaps/void.swg>
|
%include <typemaps/void.swg>
|
||||||
%include <typemaps/valtypes.swg>
|
%include <typemaps/valtypes.swg>
|
||||||
|
|
|
||||||
|
|
@ -63,19 +63,20 @@ void NAME##_setitem(TYPE *ary, size_t index, TYPE value);
|
||||||
* static NAME *frompointer(TYPE *t);
|
* static NAME *frompointer(TYPE *t);
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
|
* Use
|
||||||
|
*
|
||||||
|
* %array_class_wrap(TYPE,NAME,GET,SET)
|
||||||
|
*
|
||||||
|
* if you want different names for the get/set methods.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
%define %array_class(TYPE,NAME)
|
%define %array_class_wrap(TYPE,NAME,getitem,setitem)
|
||||||
%{
|
%{
|
||||||
typedef TYPE NAME;
|
typedef TYPE NAME;
|
||||||
%}
|
%}
|
||||||
typedef struct NAME {
|
|
||||||
/* Put language specific enhancements here */
|
|
||||||
|
|
||||||
#if defined(SWIGPYTHON) || defined(SWIGRUBY)
|
|
||||||
%rename(__getitem__) getitem;
|
typedef struct NAME {
|
||||||
%rename(__setitem__) setitem;
|
|
||||||
#endif
|
|
||||||
} NAME;
|
} NAME;
|
||||||
|
|
||||||
%extend NAME {
|
%extend NAME {
|
||||||
|
|
@ -109,3 +110,9 @@ typedef struct NAME {
|
||||||
|
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef %array_class
|
||||||
|
%define %array_class(TYPE,NAME)
|
||||||
|
%array_class_wrap(TYPE,NAME,getitem,setitem)
|
||||||
|
%enddef
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
$input = from_meth($1_name);
|
$input = from_meth($1_name);
|
||||||
}
|
}
|
||||||
%typemap(throws,noblock=1,fragment=frag) enum SWIGTYPE {
|
%typemap(throws,noblock=1,fragment=frag) enum SWIGTYPE {
|
||||||
SWIG_exception_obj(0,"$type", from_meth($1));
|
SWIG_raise(from_meth($1),"$type",0);
|
||||||
}
|
}
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
|
||||||
9
Lib/typemaps/exception.swg
Normal file
9
Lib/typemaps/exception.swg
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
// This SWIG library file provides language independent exception handling
|
||||||
|
%include <typemaps/swigmacros.swg>
|
||||||
|
|
||||||
|
%insert("runtime") {
|
||||||
|
|
||||||
|
SWIG_define(SWIG_exception(code, msg), SWIG_block(SWIG_error(code, msg); SWIG_fail))
|
||||||
|
SWIG_define(SWIG_contract_assert(expr, msg), if (!(expr)) { SWIG_error(SWIG_RuntimeError, msg); SWIG_fail; } else)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -184,7 +184,7 @@
|
||||||
/* throws */
|
/* throws */
|
||||||
|
|
||||||
%typemap(throws,noblock=1,fragment=#SWIG_FromCharPtr) Char * {
|
%typemap(throws,noblock=1,fragment=#SWIG_FromCharPtr) Char * {
|
||||||
SWIG_exception_obj(0, "$type", SWIG_FromCharPtr($1));
|
SWIG_raise(SWIG_FromCharPtr($1), "$type", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -327,7 +327,7 @@
|
||||||
%#ifndef SWIG_PRESERVE_CARRAY_SIZE
|
%#ifndef SWIG_PRESERVE_CARRAY_SIZE
|
||||||
while (size && ($1[size - 1] == '\0')) --size;
|
while (size && ($1[size - 1] == '\0')) --size;
|
||||||
%#endif
|
%#endif
|
||||||
SWIG_exception_obj(0, "$type", SWIG_FromCharPtrAndSize($1, size));
|
SWIG_raise(SWIG_FromCharPtrAndSize($1, size), "$type", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------
|
/* -------------------------------------------------------------------
|
||||||
|
|
@ -357,9 +357,8 @@
|
||||||
#endif /* SWIG_DIRECTOR_TYPEMAPS */
|
#endif /* SWIG_DIRECTOR_TYPEMAPS */
|
||||||
|
|
||||||
%typemap(throws,noblock=1,fragment=#SWIG_FromCharPtrAndSize)
|
%typemap(throws,noblock=1,fragment=#SWIG_FromCharPtrAndSize)
|
||||||
Char FIXSIZE[ANY], const Char FIXSIZE[ANY]
|
Char FIXSIZE[ANY], const Char FIXSIZE[ANY] {
|
||||||
{
|
SWIG_raise(SWIG_FromCharPtrAndSize($1, $1_dim0), "$type", 0);
|
||||||
SWIG_exception_obj(0, "$type", SWIG_FromCharPtrAndSize($1, $1_dim0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------
|
/* ------------------------------------------------------------
|
||||||
|
|
@ -484,10 +483,11 @@ SWIG_As##CharName##Array(SWIG_Object obj, Char *val, size_t size)
|
||||||
if (val) {
|
if (val) {
|
||||||
if (csize) memcpy(val, cptr, csize*sizeof(Char));
|
if (csize) memcpy(val, cptr, csize*sizeof(Char));
|
||||||
if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(Char));
|
if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(Char));
|
||||||
if (alloc == SWIG_NEWOBJ) SWIG_delete_array(cptr);
|
|
||||||
}
|
}
|
||||||
|
if (alloc == SWIG_NEWOBJ) SWIG_delete_array(cptr);
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
if (alloc == SWIG_NEWOBJ) SWIG_delete_array(cptr);
|
||||||
}
|
}
|
||||||
return SWIG_TypeError;
|
return SWIG_TypeError;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,26 +87,30 @@
|
||||||
|
|
||||||
#define SWIG_set_result(obj) SWIG_SetResultObj(obj)
|
#define SWIG_set_result(obj) SWIG_SetResultObj(obj)
|
||||||
#define SWIG_append_result(obj) SWIG_AppendResultObj(obj)
|
#define SWIG_append_result(obj) SWIG_AppendResultObj(obj)
|
||||||
#define SWIG_set_constant(n, v) SWIG_SetConstantObj(n,v)
|
#define SWIG_set_constant(name,value) SWIG_SetConstantObj(name,value)
|
||||||
|
|
||||||
/* macros for error manipulation */
|
/* macros for error manipulation */
|
||||||
#define SWIG_TypeErrorFmt(_type,_name) "expected '"_type"'"
|
#define SWIG_NullRefFmt() "invalid null reference "
|
||||||
#define SWIG_VarFailFmt(_type,_name) "in variable '"_name"' of type '"_type"'"
|
#define SWIG_VarFailFmt(_type,_name) "in variable '"_name"' of type '"_type"'"
|
||||||
#define SWIG_ArgFailFmt(_type,_argn) "in argument " #_argn" of type '" _type"'"
|
#define SWIG_ArgFailFmt(_type,_argn) "in argument " #_argn" of type '" _type"'"
|
||||||
#define SWIG_OutFailFmt(_type) "in output of type '"_type"'"
|
#define SWIG_OutFailFmt(_type) "in output value of type '"_type"'"
|
||||||
#define SWIG_ArgNullRefFmt(_type, _argn) "null reference " SWIG_ArgFailFmt(_type, _argn)
|
#define SWIG_ArgNullRefFmt(_type, _argn) SWIG_NullRefFmt() SWIG_ArgFailFmt(_type, _argn)
|
||||||
#define SWIG_VarNullRefFmt(_type, _name) "null reference " SWIG_VarFailFmt(_type, _name)
|
#define SWIG_VarNullRefFmt(_type, _name) SWIG_NullRefFmt() SWIG_VarFailFmt(_type, _name)
|
||||||
#define SWIG_OutNullRefFmt(_type) "null reference " SWIG_OutFailFmt(_type)
|
#define SWIG_OutNullRefFmt(_type) SWIG_NullRefFmt() SWIG_OutFailFmt(_type)
|
||||||
|
|
||||||
#define SWIG_ArgFail(code,type,argn) SWIG_SetErrorMsg(code,SWIG_ArgFailFmt(type, argn))
|
#define SWIG_ArgFail(code,type,argn) SWIG_Error(code, SWIG_ArgFailFmt(type, argn))
|
||||||
#define SWIG_VarFail(code,type,name) SWIG_SetErrorMsg(code,SWIG_VarFailFmt(type, name))
|
#define SWIG_VarFail(code,type,name) SWIG_Error(code, SWIG_VarFailFmt(type, name))
|
||||||
#define SWIG_ArgNullRef(type,argn) SWIG_SetErrorMsg(SWIG_ValueError, SWIG_ArgNullRefFmt(type, argn))
|
#define SWIG_ArgNullRef(type,argn) SWIG_Error(SWIG_ValueError, SWIG_ArgNullRefFmt(type, argn))
|
||||||
#define SWIG_VarNullRef(type,name) SWIG_SetErrorMsg(SWIG_ValueError, SWIG_VarNullRefFmt(type, name))
|
#define SWIG_VarNullRef(type,name) SWIG_Error(SWIG_ValueError, SWIG_VarNullRefFmt(type, name))
|
||||||
#define SWIG_OutNullRef(type) SWIG_SetErrorMsg(SWIG_ValueError, SWIG_OutNullRefFmt(type))
|
#define SWIG_OutNullRef(type) SWIG_Error(SWIG_ValueError, SWIG_OutNullRefFmt(type))
|
||||||
|
|
||||||
#define SWIG_set_errmsg(code,msg...) SWIG_SetErrorMsg(code,msg)
|
|
||||||
#define SWIG_set_errobj(code,obj) SWIG_SetErrorObj(code,obj)
|
|
||||||
|
|
||||||
|
/* setting an error */
|
||||||
|
#define SWIG_error(code,msg...) SWIG_Error(code, msg)
|
||||||
|
#define SWIG_type_error(msg...) SWIG_Error(SWIG_TypeError, msg)
|
||||||
|
|
||||||
|
|
||||||
|
/* setting an error and exit */
|
||||||
#define SWIG_error_block(Block...) SWIG_block(Block)
|
#define SWIG_error_block(Block...) SWIG_block(Block)
|
||||||
|
|
||||||
#define SWIG_arg_fail(code, type, arg) SWIG_error_block(SWIG_ArgFail(code, type, arg); SWIG_fail)
|
#define SWIG_arg_fail(code, type, arg) SWIG_error_block(SWIG_ArgFail(code, type, arg); SWIG_fail)
|
||||||
|
|
@ -118,14 +122,13 @@
|
||||||
#define SWIG_global_fail(code, type, name) SWIG_error_block(SWIG_VarFail(code, type, name); SWIG_fail)
|
#define SWIG_global_fail(code, type, name) SWIG_error_block(SWIG_VarFail(code, type, name); SWIG_fail)
|
||||||
#define SWIG_global_nullref(type, name) SWIG_error_block(SWIG_VarNullRef(type, name); SWIG_fail)
|
#define SWIG_global_nullref(type, name) SWIG_error_block(SWIG_VarNullRef(type, name); SWIG_fail)
|
||||||
|
|
||||||
#define SWIG_var_fail(code, type, name) SWIG_error_block(SWIG_VarFail(code, type, name); SWIG_var_fail)
|
#define SWIG_var_fail(code, type, name) SWIG_error_block(SWIG_VarFail(code, type, name); SWIG_fail)
|
||||||
#define SWIG_var_nullref(type, name) SWIG_error_block(SWIG_VarNullRef(type, name); SWIG_var_fail)
|
#define SWIG_var_nullref(type, name) SWIG_error_block(SWIG_VarNullRef(type, name); SWIG_fail)
|
||||||
|
|
||||||
#define SWIG_dout_fail(code, type) SWIG_DirOutFail(code, SWIG_OutFailFmt(type))
|
#define SWIG_dout_fail(code, type) SWIG_DirOutFail(code, SWIG_OutFailFmt(type))
|
||||||
#define SWIG_dout_nullref(type) SWIG_DirOutFail(SWIG_ValueError, SWIG_OutNullRefFmt(type))
|
#define SWIG_dout_nullref(type) SWIG_DirOutFail(SWIG_ValueError, SWIG_OutNullRefFmt(type))
|
||||||
|
|
||||||
|
#define SWIG_raise(obj, type, desc) SWIG_error_block(SWIG_Raise(obj, type, desc); SWIG_fail)
|
||||||
#define SWIG_exception_obj(desc, type, obj) SWIG_error_block(SWIG_ExceptionObj(desc, type, obj); SWIG_fail)
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -133,7 +136,7 @@
|
||||||
|
|
||||||
Use it, for example in Tcl, as
|
Use it, for example in Tcl, as
|
||||||
|
|
||||||
%define_swig_object(Tcl_Obj)
|
%define_swig_object(Tcl_Obj *)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SWIG_Object __NULL__
|
#define SWIG_Object __NULL__
|
||||||
|
|
@ -153,7 +156,7 @@
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* define a new macro */
|
/* define a new macro */
|
||||||
%define SWIG_define(Def, Val)
|
%define SWIG_define(Def, Val...)
|
||||||
%#define Def Val
|
%#define Def Val
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIG_Object "$1 = ($input != 0);";
|
%typecheck(SWIG_TYPECHECK_POINTER) SWIG_Object "$1 = ($input != 0);";
|
||||||
|
|
||||||
%typemap(throws,noblock=1) SWIG_Object {
|
%typemap(throws,noblock=1) SWIG_Object {
|
||||||
SWIG_exception_obj(0, "$type", $1);
|
SWIG_raise($1, "$type", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(constcode,noblock=1) SWIG_Object {
|
%typemap(constcode,noblock=1) SWIG_Object {
|
||||||
|
|
|
||||||
|
|
@ -357,19 +357,19 @@
|
||||||
* ------------------------------------------------------------ */
|
* ------------------------------------------------------------ */
|
||||||
|
|
||||||
%typemap(throws,noblock=1) SWIGTYPE {
|
%typemap(throws,noblock=1) SWIGTYPE {
|
||||||
SWIG_exception_obj($&descriptor, "$type", SWIG_NewPointerObj(SWIG_new_copy($1, $ltype),$&descriptor,SWIG_POINTER_OWN));
|
SWIG_raise(SWIG_NewPointerObj(SWIG_new_copy($1, $ltype),$&descriptor,SWIG_POINTER_OWN), "$type", $&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(throws,noblock=1) SWIGTYPE * {
|
%typemap(throws,noblock=1) SWIGTYPE * {
|
||||||
SWIG_exception_obj($descriptor, "$type", SWIG_NewPointerObj(SWIG_as_voidptr($1),$descriptor,0));
|
SWIG_raise(SWIG_NewPointerObj(SWIG_as_voidptr($1),$descriptor,0), "$type", $descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(throws,noblock=1) SWIGTYPE [ANY] {
|
%typemap(throws,noblock=1) SWIGTYPE [ANY] {
|
||||||
SWIG_exception_obj($descriptor, "$type", SWIG_NewPointerObj(SWIG_as_voidptr($1),$descriptor,0));
|
SWIG_raise(SWIG_NewPointerObj(SWIG_as_voidptr($1),$descriptor,0), "$type", $descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(throws,noblock=1) SWIGTYPE & {
|
%typemap(throws,noblock=1) SWIGTYPE & {
|
||||||
SWIG_exception_obj($descriptor, "$type", SWIG_NewPointerObj(SWIG_as_voidptr(&$1),$descriptor,0));
|
SWIG_raise(SWIG_NewPointerObj(SWIG_as_voidptr(&$1),$descriptor,0), "$type", $descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------
|
/* ------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@
|
||||||
|
|
||||||
%define SWIG_VALUE_THROWS_TYPEMAP(from_meth,frag,Type...)
|
%define SWIG_VALUE_THROWS_TYPEMAP(from_meth,frag,Type...)
|
||||||
%typemap(throws,noblock=1,fragment=frag) Type {
|
%typemap(throws,noblock=1,fragment=frag) Type {
|
||||||
SWIG_exception_obj(0, "Type", from_meth(SWIG_static_cast($1,$basetype)));
|
SWIG_raise(from_meth(SWIG_static_cast($1,Type)), "$type", 0);
|
||||||
}
|
}
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(freearg,noblock=1) void * "";
|
%typemap(freearg) void * "";
|
||||||
|
|
||||||
%typemap(in,noblock=1) void * const& ($*ltype temp) {
|
%typemap(in,noblock=1) void * const& ($*ltype temp) {
|
||||||
if (SWIG_ConvertPtr($input, SWIG_as_voidptrptr(&temp), 0, $disown) != SWIG_OK) {
|
if (SWIG_ConvertPtr($input, SWIG_as_voidptrptr(&temp), 0, $disown) != SWIG_OK) {
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
/* out */
|
/* out */
|
||||||
|
|
||||||
%typemap(out,noblock=1) void {
|
%typemap(out,noblock=1) void {
|
||||||
SWIG_set_result(SWIG_NoneObject());
|
SWIG_set_result(SWIG_VoidObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* varin */
|
/* varin */
|
||||||
|
|
|
||||||
|
|
@ -305,6 +305,15 @@ static void SWIG_dump_runtime() {
|
||||||
Printf(runtime, "%s", s);
|
Printf(runtime, "%s", s);
|
||||||
Delete(s);
|
Delete(s);
|
||||||
|
|
||||||
|
s = Swig_include_sys("swigerrors.swg");
|
||||||
|
if (!s) {
|
||||||
|
Printf(stderr, "*** Unable to open 'swigerrors.swg'\n");
|
||||||
|
Close(runtime);
|
||||||
|
SWIG_exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
Printf(runtime, "%s", s);
|
||||||
|
Delete(s);
|
||||||
|
|
||||||
s = Swig_include_sys("swigrun.swg");
|
s = Swig_include_sys("swigrun.swg");
|
||||||
if (!s) {
|
if (!s) {
|
||||||
Printf(stderr, "*** Unable to open 'swigrun.swg'\n");
|
Printf(stderr, "*** Unable to open 'swigrun.swg'\n");
|
||||||
|
|
|
||||||
|
|
@ -1177,7 +1177,7 @@ public:
|
||||||
outarg = NewString("");
|
outarg = NewString("");
|
||||||
kwargs = NewString("");
|
kwargs = NewString("");
|
||||||
|
|
||||||
Wrapper_add_local(f,"resultobj", "PyObject *resultobj = NULL");
|
Wrapper_add_local(f,"resultobj", "PyObject *resultobj = 0");
|
||||||
|
|
||||||
/* Write code to extract function parameters. */
|
/* Write code to extract function parameters. */
|
||||||
emit_args(d, l, f);
|
emit_args(d, l, f);
|
||||||
|
|
@ -1491,7 +1491,6 @@ public:
|
||||||
/* Output cleanup code */
|
/* Output cleanup code */
|
||||||
int need_cleanup = Len(cleanup) != 0;
|
int need_cleanup = Len(cleanup) != 0;
|
||||||
if (need_cleanup) {
|
if (need_cleanup) {
|
||||||
Printf(f->code,"cleanup:\n");
|
|
||||||
Printv(f->code,cleanup,NIL);
|
Printv(f->code,cleanup,NIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1515,12 +1514,10 @@ public:
|
||||||
|
|
||||||
Printf(f->code,"fail:\n");
|
Printf(f->code,"fail:\n");
|
||||||
if (need_cleanup) {
|
if (need_cleanup) {
|
||||||
Printf(f->code,"if (resultobj) Py_DECREF(resultobj);\n");
|
Printv(f->code,cleanup,NIL);
|
||||||
Printf(f->code,"resultobj = NULL;\n");
|
|
||||||
Printf(f->code,"goto cleanup;\n");
|
|
||||||
} else {
|
|
||||||
Printf(f->code,"return NULL;\n");
|
|
||||||
}
|
}
|
||||||
|
Printv(f->code,tab4,"return NULL;\n",NIL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Printf(f->code,"}\n");
|
Printf(f->code,"}\n");
|
||||||
|
|
@ -1606,7 +1603,7 @@ public:
|
||||||
Python dictionary. */
|
Python dictionary. */
|
||||||
|
|
||||||
if (!have_globals) {
|
if (!have_globals) {
|
||||||
Printf(f_init,"\t PyDict_SetItemString(d,(char*)\"%s\", SWIG_globals);\n",global_name);
|
Printf(f_init,"\t PyDict_SetItemString(d,(char*)\"%s\", SWIG_globals());\n",global_name);
|
||||||
have_globals=1;
|
have_globals=1;
|
||||||
if ((shadow) && (!(shadow & PYSHADOW_MEMBER))) {
|
if ((shadow) && (!(shadow & PYSHADOW_MEMBER))) {
|
||||||
Printf(f_shadow_stubs,"%s = %s.%s\n", global_name, module, global_name);
|
Printf(f_shadow_stubs,"%s = %s.%s\n", global_name, module, global_name);
|
||||||
|
|
@ -1636,7 +1633,9 @@ public:
|
||||||
Swig_warning(WARN_TYPEMAP_VARIN_UNDEF, input_file, line_number,
|
Swig_warning(WARN_TYPEMAP_VARIN_UNDEF, input_file, line_number,
|
||||||
"Unable to set variable of type %s.\n", SwigType_str(t,0));
|
"Unable to set variable of type %s.\n", SwigType_str(t,0));
|
||||||
}
|
}
|
||||||
Printf(setf->code," return 0;\n");
|
Printv(setf->code,tab4,"return 0;\n",NULL);
|
||||||
|
Printf(setf->code,"fail:\n");
|
||||||
|
Printv(setf->code,tab4,"return 1;\n",NULL);
|
||||||
} else {
|
} else {
|
||||||
/* Is a readonly variable. Issue an error */
|
/* Is a readonly variable. Issue an error */
|
||||||
if (CPlusPlus) {
|
if (CPlusPlus) {
|
||||||
|
|
@ -1645,8 +1644,7 @@ public:
|
||||||
Printf(setf->def,"static int %s_set(PyObject *_val) {", wname);
|
Printf(setf->def,"static int %s_set(PyObject *_val) {", wname);
|
||||||
}
|
}
|
||||||
Printv(setf->code,
|
Printv(setf->code,
|
||||||
tab4, "PyErr_SetString(PyExc_TypeError,\"Variable ", iname,
|
tab4, "SWIG_Error(SWIG_AttributeError,\"Variable ", iname," is read-only.\");\n",
|
||||||
" is read-only.\");\n",
|
|
||||||
tab4, "return 1;\n",
|
tab4, "return 1;\n",
|
||||||
NIL);
|
NIL);
|
||||||
}
|
}
|
||||||
|
|
@ -1656,7 +1654,7 @@ public:
|
||||||
|
|
||||||
/* Create a function for getting the value of a variable */
|
/* Create a function for getting the value of a variable */
|
||||||
Printf(getf->def,"static PyObject *%s_get(void) {", wname);
|
Printf(getf->def,"static PyObject *%s_get(void) {", wname);
|
||||||
Wrapper_add_local(getf,"pyobj", "PyObject *pyobj = NULL");
|
Wrapper_add_local(getf,"pyobj", "PyObject *pyobj = 0");
|
||||||
if ((tm = Swig_typemap_lookup_new("varout",n,name,0))) {
|
if ((tm = Swig_typemap_lookup_new("varout",n,name,0))) {
|
||||||
Replaceall(tm,"$source",name);
|
Replaceall(tm,"$source",name);
|
||||||
Replaceall(tm,"$target","pyobj");
|
Replaceall(tm,"$target","pyobj");
|
||||||
|
|
@ -1671,7 +1669,7 @@ public:
|
||||||
Wrapper_print(getf,f_wrappers);
|
Wrapper_print(getf,f_wrappers);
|
||||||
|
|
||||||
/* Now add this to the variable linking mechanism */
|
/* Now add this to the variable linking mechanism */
|
||||||
Printf(f_init,"\t SWIG_addvarlink(SWIG_globals,(char*)\"%s\",%s_get, %s_set);\n", iname, wname, wname);
|
Printf(f_init,"\t SWIG_addvarlink(SWIG_globals(),(char*)\"%s\",%s_get, %s_set);\n", iname, wname, wname);
|
||||||
|
|
||||||
DelWrapper(setf);
|
DelWrapper(setf);
|
||||||
DelWrapper(getf);
|
DelWrapper(getf);
|
||||||
|
|
|
||||||
|
|
@ -1314,7 +1314,6 @@ public:
|
||||||
/* Dump the argument cleanup code */
|
/* Dump the argument cleanup code */
|
||||||
int need_cleanup = (current != CONSTRUCTOR_ALLOCATE) && (Len(cleanup) != 0);
|
int need_cleanup = (current != CONSTRUCTOR_ALLOCATE) && (Len(cleanup) != 0);
|
||||||
if (need_cleanup) {
|
if (need_cleanup) {
|
||||||
Printv(f->code,"cleanup:\n",NIL);
|
|
||||||
Printv(f->code,cleanup,NIL);
|
Printv(f->code,cleanup,NIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1343,38 +1342,27 @@ public:
|
||||||
Printv(f->code, tab4, "return self;\n", NIL);
|
Printv(f->code, tab4, "return self;\n", NIL);
|
||||||
Printv(f->code,"fail:\n",NIL);
|
Printv(f->code,"fail:\n",NIL);
|
||||||
if (need_cleanup) {
|
if (need_cleanup) {
|
||||||
Printv(f->code, tab4, "self = Qnil;\n", NIL);
|
Printv(f->code,cleanup,NIL);
|
||||||
Printv(f->code, tab4, "goto cleanup;\n", NIL);
|
|
||||||
} else {
|
|
||||||
Printv(f->code, tab4, "return Qnil;\n", NIL);
|
|
||||||
}
|
}
|
||||||
|
Printv(f->code, tab4, "return Qnil;\n", NIL);
|
||||||
} else {
|
} else {
|
||||||
Wrapper_add_local(f,"vresult","VALUE vresult = Qnil");
|
Wrapper_add_local(f,"vresult","VALUE vresult = Qnil");
|
||||||
Printv(f->code, tab4, "return vresult;\n", NIL);
|
Printv(f->code, tab4, "return vresult;\n", NIL);
|
||||||
Printv(f->code,"fail:\n",NIL);
|
Printv(f->code,"fail:\n",NIL);
|
||||||
if (need_cleanup) {
|
if (need_cleanup) {
|
||||||
Printv(f->code, tab4, "vresult = Qnil;\n", NIL);
|
Printv(f->code,cleanup,NIL);
|
||||||
Printv(f->code, tab4, "goto cleanup;\n", NIL);
|
|
||||||
} else {
|
|
||||||
Printv(f->code, tab4, "return Qnil;\n", NIL);
|
|
||||||
}
|
}
|
||||||
|
Printv(f->code, tab4, "return Qnil;\n", NIL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Printv(f->code, tab4, "return Qnil;\n", NIL);
|
Printv(f->code, tab4, "return Qnil;\n", NIL);
|
||||||
Printv(f->code,"fail:\n",NIL);
|
Printv(f->code,"fail:\n",NIL);
|
||||||
if (need_cleanup) {
|
if (need_cleanup) {
|
||||||
Printv(f->code, tab4, "goto cleanup;\n", NIL);
|
Printv(f->code,cleanup,NIL);
|
||||||
} else {
|
}
|
||||||
Printv(f->code, tab4, "return Qnil;\n", NIL);
|
Printv(f->code, tab4, "return Qnil;\n", NIL);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Error handling code */
|
|
||||||
/*
|
|
||||||
Printf(f->code,"fail:\n");
|
|
||||||
Printv(f->code,cleanup,NIL);
|
|
||||||
Printv(f->code,"return Qnil;\n",NIL);
|
|
||||||
*/
|
|
||||||
Printf(f->code,"}\n");
|
Printf(f->code,"}\n");
|
||||||
|
|
||||||
/* Substitute the cleanup code */
|
/* Substitute the cleanup code */
|
||||||
|
|
@ -1500,7 +1488,7 @@ public:
|
||||||
Printv(getf->code, tab4, "return _val;\n}\n", NIL);
|
Printv(getf->code, tab4, "return _val;\n}\n", NIL);
|
||||||
Wrapper_print(getf,f_wrappers);
|
Wrapper_print(getf,f_wrappers);
|
||||||
|
|
||||||
if (GetFlag(n,"feature:immutable")) {
|
if (!is_assignable(n)) {
|
||||||
setfname = NewString("NULL");
|
setfname = NewString("NULL");
|
||||||
} else {
|
} else {
|
||||||
/* create setter */
|
/* create setter */
|
||||||
|
|
@ -1518,7 +1506,9 @@ public:
|
||||||
Swig_warning(WARN_TYPEMAP_VARIN_UNDEF, input_file, line_number,
|
Swig_warning(WARN_TYPEMAP_VARIN_UNDEF, input_file, line_number,
|
||||||
"Unable to set variable of type %s\n", SwigType_str(t,0));
|
"Unable to set variable of type %s\n", SwigType_str(t,0));
|
||||||
}
|
}
|
||||||
Printv(setf->code, tab4, "return _val;\n",NIL);
|
Printv(setf->code, tab4, "return _val;\n", NIL);
|
||||||
|
Printf(setf->code, "fail:\n");
|
||||||
|
Printv(setf->code, tab4, "return Qnil;\n", NIL);
|
||||||
Printf(setf->code,"}\n");
|
Printf(setf->code,"}\n");
|
||||||
Wrapper_print(setf,f_wrappers);
|
Wrapper_print(setf,f_wrappers);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -583,7 +583,7 @@ public:
|
||||||
DelWrapper(getf);
|
DelWrapper(getf);
|
||||||
|
|
||||||
/* Try to create a function setting a variable */
|
/* Try to create a function setting a variable */
|
||||||
if (!GetFlag(n,"feature:immutable")) {
|
if (is_assignable(n)) {
|
||||||
setf = NewWrapper();
|
setf = NewWrapper();
|
||||||
setname = Swig_name_wrapper(Swig_name_set(iname));
|
setname = Swig_name_wrapper(Swig_name_set(iname));
|
||||||
Printv(setf->def,"SWIGINTERN char *",setname, "(ClientData clientData, Tcl_Interp *interp, char *name1, char *name2, int flags) {",NIL);
|
Printv(setf->def,"SWIGINTERN char *",setname, "(ClientData clientData, Tcl_Interp *interp, char *name1, char *name2, int flags) {",NIL);
|
||||||
|
|
@ -600,6 +600,8 @@ public:
|
||||||
Printf(setf->code,"if (!value) return NULL;\n");
|
Printf(setf->code,"if (!value) return NULL;\n");
|
||||||
Printf(setf->code,"%s\n", tm);
|
Printf(setf->code,"%s\n", tm);
|
||||||
Printf(setf->code,"return NULL;\n");
|
Printf(setf->code,"return NULL;\n");
|
||||||
|
Printf(setf->code,"fail:\n");
|
||||||
|
Printf(setf->code,"return \"%s\";\n", iname);
|
||||||
Printf(setf->code,"}\n");
|
Printf(setf->code,"}\n");
|
||||||
if (setf) Wrapper_print(setf,f_wrappers);
|
if (setf) Wrapper_print(setf,f_wrappers);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -608,10 +610,13 @@ public:
|
||||||
readonly = 1;
|
readonly = 1;
|
||||||
}
|
}
|
||||||
DelWrapper(setf);
|
DelWrapper(setf);
|
||||||
|
} else {
|
||||||
|
readonly = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Printv(var_tab, tab4,"{ SWIG_prefix \"", iname, "\", 0, (swig_variable_func) ", getname, ",", NIL);
|
Printv(var_tab, tab4,"{ SWIG_prefix \"", iname, "\", 0, (swig_variable_func) ", getname, ",", NIL);
|
||||||
if (readonly || GetFlag(n,"feature:immutable")) {
|
if (readonly) {
|
||||||
static int readonlywrap = 0;
|
static int readonlywrap = 0;
|
||||||
if (!readonlywrap) {
|
if (!readonlywrap) {
|
||||||
Wrapper *ro = NewWrapper();
|
Wrapper *ro = NewWrapper();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue