Merge branch 'master' into directorargout_and_java_typemaps
This commit is contained in:
commit
b9cdc3c5e1
83 changed files with 1602 additions and 946 deletions
|
|
@ -2,9 +2,9 @@
|
|||
#define CSHARP_CSHARPKW_SWG_
|
||||
|
||||
/* Warnings for C# keywords */
|
||||
#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword, renaming to '_" `x` "'",rename="_%s") `x`
|
||||
#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword, renaming to '" `x` "_'",rename="%s_") `x`
|
||||
|
||||
#define CSHARPCLASSKW(x) %keywordwarn("'" `x` "' is a special method name used in the C# wrapper classes, class renamed to '_" `x` "'",%$isclass,rename="_%s") `x`
|
||||
#define CSHARPCLASSKW(x) %keywordwarn("'" `x` "' is a special method name used in the C# wrapper classes, class renamed to '" `x` "_'",%$isclass,rename="%s_") `x`
|
||||
|
||||
/*
|
||||
from
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <typeinfo>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
|
|
@ -16,6 +17,7 @@ namespace std
|
|||
struct exception {};
|
||||
}
|
||||
|
||||
%typemap(throws, canthrow=1) std::bad_cast "SWIG_CSharpSetPendingException(SWIG_CSharpInvalidCastException, $1.what());\n return $null;"
|
||||
%typemap(throws, canthrow=1) std::bad_exception "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
|
||||
%typemap(throws, canthrow=1) std::domain_error "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
|
||||
%typemap(throws, canthrow=1) std::exception "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <typeinfo>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
|
|
@ -16,6 +17,7 @@ namespace std
|
|||
struct exception {};
|
||||
}
|
||||
|
||||
%typemap(throws, canthrow=1) std::bad_cast "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;"
|
||||
%typemap(throws, canthrow=1) std::bad_exception "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;"
|
||||
%typemap(throws, canthrow=1) std::domain_error "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;"
|
||||
%typemap(throws, canthrow=1) std::exception "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#ifdef SWIGPHP
|
||||
%{
|
||||
#include "zend_exceptions.h"
|
||||
#define SWIG_exception(code, msg) zend_throw_exception(NULL, (char*)msg, code TSRMLS_CC)
|
||||
#define SWIG_exception(code, msg) do { zend_throw_exception(NULL, (char*)msg, code TSRMLS_CC); goto thrown; } while (0)
|
||||
%}
|
||||
#endif
|
||||
|
||||
|
|
@ -258,6 +258,7 @@ SWIGINTERN void SWIG_DThrowException(int code, const char *msg) {
|
|||
}
|
||||
*/
|
||||
%{
|
||||
#include <typeinfo>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
%define SWIG_CATCH_STDEXCEPT
|
||||
|
|
@ -274,6 +275,8 @@ SWIGINTERN void SWIG_DThrowException(int code, const char *msg) {
|
|||
SWIG_exception(SWIG_IndexError, e.what() );
|
||||
} catch (std::runtime_error& e) {
|
||||
SWIG_exception(SWIG_RuntimeError, e.what() );
|
||||
} catch (std::bad_cast& e) {
|
||||
SWIG_exception(SWIG_TypeError, e.what() );
|
||||
} catch (std::exception& e) {
|
||||
SWIG_exception(SWIG_SystemError, e.what() );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <typeinfo>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
|
|
@ -16,6 +17,7 @@ namespace std
|
|||
struct exception {};
|
||||
}
|
||||
|
||||
%typemap(throws) std::bad_cast %{_swig_gopanic($1.what());%}
|
||||
%typemap(throws) std::bad_exception %{_swig_gopanic($1.what());%}
|
||||
%typemap(throws) std::domain_error %{_swig_gopanic($1.what());%}
|
||||
%typemap(throws) std::exception %{_swig_gopanic($1.what());%}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// TODO: STL exception handling
|
||||
// Note that the generic std_except.i file did not work
|
||||
%{
|
||||
#include <typeinfo>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <typeinfo>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
|
|
@ -16,6 +17,7 @@ namespace std
|
|||
struct exception {};
|
||||
}
|
||||
|
||||
%typemap(throws) std::bad_cast "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||
%typemap(throws) std::bad_exception "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||
%typemap(throws) std::domain_error "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||
%typemap(throws) std::exception "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef ctorObject,
|
|||
size_t argc, const JSValueRef argv[], JSValueRef* exception)
|
||||
{
|
||||
SWIG_exception(SWIG_ERROR, "Class $jsname can not be instantiated");
|
||||
fail:
|
||||
return 0;
|
||||
}
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ SWIGINTERN bool JS_veto_set_variable(JSContextRef context, JSObjectRef thisObjec
|
|||
} else {
|
||||
SWIG_exception(SWIG_ERROR, msg);
|
||||
}
|
||||
|
||||
fail:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* ---------------------------------------------------------------------------*/
|
||||
|
||||
#define SWIG_Error(code, msg) SWIG_JSC_exception(context, exception, code, msg)
|
||||
#define SWIG_exception(code, msg) SWIG_JSC_exception(context, exception, code, msg)
|
||||
#define SWIG_exception(code, msg) do { SWIG_JSC_exception(context, exception, code, msg); SWIG_fail; } while (0)
|
||||
#define SWIG_fail goto fail
|
||||
|
||||
SWIGRUNTIME void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* type) {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
|
|||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
SWIG_exception(SWIG_ERROR, "Class $jsname can not be instantiated");
|
||||
fail:
|
||||
SWIGV8_RETURN(SWIGV8_UNDEFINED());
|
||||
}
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<
|
|||
} else {
|
||||
SWIG_exception(SWIG_ERROR, msg);
|
||||
}
|
||||
fail: ;
|
||||
}
|
||||
|
||||
%} // v8_helper_functions
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
|
|||
* ---------------------------------------------------------------------------*/
|
||||
|
||||
#define SWIG_Error(code, msg) SWIGV8_ErrorHandler.error(code, msg)
|
||||
#define SWIG_exception(code, msg) SWIGV8_ErrorHandler.error(code, msg)
|
||||
#define SWIG_exception(code, msg) do { SWIGV8_ErrorHandler.error(code, msg); SWIG_fail; } while (0)
|
||||
#define SWIG_fail goto fail
|
||||
#define SWIGV8_OVERLOAD false
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <typeinfo>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
%include <exception.i>
|
||||
|
|
@ -27,6 +28,7 @@ namespace std
|
|||
// normally objects which are thrown are returned to the interpreter as errors
|
||||
// (which potentially may have problems if they are not copied)
|
||||
// therefore all classes based upon std::exception are converted to their strings & returned as errors
|
||||
%typemap(throws) std::bad_cast "SWIG_exception(SWIG_TypeError, $1.what());"
|
||||
%typemap(throws) std::bad_exception "SWIG_exception(SWIG_RuntimeError, $1.what());"
|
||||
%typemap(throws) std::domain_error "SWIG_exception(SWIG_ValueError, $1.what());"
|
||||
%typemap(throws) std::exception "SWIG_exception(SWIG_SystemError, $1.what());"
|
||||
|
|
|
|||
|
|
@ -393,11 +393,7 @@
|
|||
{
|
||||
void * p = emalloc(sizeof($1));
|
||||
memcpy(p, &$1, sizeof($1));
|
||||
zval * resource;
|
||||
MAKE_STD_ZVAL(resource);
|
||||
ZEND_REGISTER_RESOURCE(resource, p, swig_member_ptr);
|
||||
|
||||
SWIG_SetPointerZval(return_value, (void *)&$1, $1_descriptor, $owner);
|
||||
ZEND_REGISTER_RESOURCE(return_value, p, swig_member_ptr);
|
||||
}
|
||||
|
||||
%typemap(in, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
|
||||
|
|
|
|||
|
|
@ -93,9 +93,6 @@ typedef struct {
|
|||
int newobject;
|
||||
} swig_object_wrapper;
|
||||
|
||||
/* empty zend destructor for types without one */
|
||||
static ZEND_RSRC_DTOR_FUNC(SWIG_landfill) { (void)rsrc; }
|
||||
|
||||
#define SWIG_SetPointerZval(a,b,c,d) SWIG_ZTS_SetPointerZval(a,b,c,d TSRMLS_CC)
|
||||
#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
|
||||
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ INT_TYPEMAP(unsigned long long);
|
|||
%typemap(in) char INPUT[ANY] ( char temp[$1_dim0] )
|
||||
%{
|
||||
convert_to_string_ex($input);
|
||||
strncpy(temp,Z_LVAL_PP($input),$1_dim0);
|
||||
strncpy(temp,Z_STRVAL_PP($input),$1_dim0);
|
||||
$1 = temp;
|
||||
%}
|
||||
%typemap(in,numinputs=0) char OUTPUT[ANY] ( char temp[$1_dim0] )
|
||||
|
|
|
|||
|
|
@ -1,220 +1,29 @@
|
|||
#define SWIGPY_UNARYFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a) { \
|
||||
return wrapper(a, NULL); \
|
||||
}
|
||||
|
||||
#define SWIGPY_DESTRUCTOR_CLOSURE(wrapper) \
|
||||
SWIGINTERN void \
|
||||
wrapper##_closure(PyObject *a) { \
|
||||
SwigPyObject *sobj; \
|
||||
sobj = (SwigPyObject *)a; \
|
||||
Py_XDECREF(sobj->dict); \
|
||||
if (sobj->own) { \
|
||||
PyObject *o; \
|
||||
PyObject *val = 0, *type = 0, *tb = 0; \
|
||||
PyErr_Fetch(&val, &type, &tb); \
|
||||
o = wrapper(a, NULL); \
|
||||
if (!o) { \
|
||||
PyObject *deallocname = PyString_FromString(#wrapper); \
|
||||
PyErr_WriteUnraisable(deallocname); \
|
||||
Py_DECREF(deallocname); \
|
||||
} \
|
||||
PyErr_Restore(val, type, tb); \
|
||||
Py_XDECREF(o); \
|
||||
} \
|
||||
if (PyType_IS_GC(a->ob_type)) { \
|
||||
PyObject_GC_Del(a); \
|
||||
} else { \
|
||||
PyObject_Del(a); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define SWIGPY_INQUIRY_CLOSURE(wrapper) \
|
||||
SWIGINTERN int \
|
||||
wrapper##_closure(PyObject *a) { \
|
||||
PyObject *pyresult; \
|
||||
int result; \
|
||||
pyresult = wrapper(a, NULL); \
|
||||
result = pyresult && PyObject_IsTrue(pyresult) ? 1 : 0; \
|
||||
Py_XDECREF(pyresult); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define SWIGPY_BINARYFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a, PyObject *b) { \
|
||||
PyObject *tuple, *result; \
|
||||
tuple = PyTuple_New(1); \
|
||||
assert(tuple); \
|
||||
PyTuple_SET_ITEM(tuple, 0, b); \
|
||||
Py_XINCREF(b); \
|
||||
result = wrapper(a, tuple); \
|
||||
Py_DECREF(tuple); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
typedef ternaryfunc ternarycallfunc;
|
||||
|
||||
#define SWIGPY_TERNARYFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
||||
PyObject *tuple, *result; \
|
||||
tuple = PyTuple_New(2); \
|
||||
assert(tuple); \
|
||||
PyTuple_SET_ITEM(tuple, 0, b); \
|
||||
PyTuple_SET_ITEM(tuple, 1, c); \
|
||||
Py_XINCREF(b); \
|
||||
Py_XINCREF(c); \
|
||||
result = wrapper(a, tuple); \
|
||||
Py_DECREF(tuple); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define SWIGPY_TERNARYCALLFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *callable_object, PyObject *args, PyObject *) { \
|
||||
return wrapper(callable_object, args); \
|
||||
}
|
||||
|
||||
#define SWIGPY_LENFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN Py_ssize_t \
|
||||
wrapper##_closure(PyObject *a) { \
|
||||
PyObject *resultobj; \
|
||||
Py_ssize_t result; \
|
||||
resultobj = wrapper(a, NULL); \
|
||||
result = PyNumber_AsSsize_t(resultobj, NULL); \
|
||||
Py_DECREF(resultobj); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define SWIGPY_SSIZESSIZEARGFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c) { \
|
||||
PyObject *tuple, *result; \
|
||||
tuple = PyTuple_New(2); \
|
||||
assert(tuple); \
|
||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \
|
||||
PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c)); \
|
||||
result = wrapper(a, tuple); \
|
||||
Py_DECREF(tuple); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define SWIGPY_SSIZESSIZEOBJARGPROC_CLOSURE(wrapper) \
|
||||
SWIGINTERN int \
|
||||
wrapper##_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) { \
|
||||
PyObject *tuple, *resultobj; \
|
||||
int result; \
|
||||
tuple = PyTuple_New(d ? 3 : 2); \
|
||||
assert(tuple); \
|
||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \
|
||||
PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c)); \
|
||||
if (d) { \
|
||||
PyTuple_SET_ITEM(tuple, 2, d); \
|
||||
Py_INCREF(d); \
|
||||
} \
|
||||
resultobj = wrapper(a, tuple); \
|
||||
result = resultobj ? 0 : -1; \
|
||||
Py_DECREF(tuple); \
|
||||
Py_XDECREF(resultobj); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define SWIGPY_SSIZEARGFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a, Py_ssize_t b) { \
|
||||
PyObject *tuple, *result; \
|
||||
tuple = PyTuple_New(1); \
|
||||
assert(tuple); \
|
||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \
|
||||
result = wrapper(a, tuple); \
|
||||
Py_DECREF(tuple); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define SWIGPY_FUNPACK_SSIZEARGFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a, Py_ssize_t b) { \
|
||||
PyObject *arg, *result; \
|
||||
arg = _PyLong_FromSsize_t(b); \
|
||||
result = wrapper(a, arg); \
|
||||
Py_DECREF(arg); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define SWIGPY_SSIZEOBJARGPROC_CLOSURE(wrapper) \
|
||||
SWIGINTERN int \
|
||||
wrapper##_closure(PyObject *a, Py_ssize_t b, PyObject *c) { \
|
||||
PyObject *tuple, *resultobj; \
|
||||
int result; \
|
||||
tuple = PyTuple_New(2); \
|
||||
assert(tuple); \
|
||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \
|
||||
PyTuple_SET_ITEM(tuple, 1, c); \
|
||||
Py_XINCREF(c); \
|
||||
resultobj = wrapper(a, tuple); \
|
||||
result = resultobj ? 0 : -1; \
|
||||
Py_XDECREF(resultobj); \
|
||||
Py_DECREF(tuple); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define SWIGPY_OBJOBJARGPROC_CLOSURE(wrapper) \
|
||||
SWIGINTERN int \
|
||||
wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
||||
PyObject *tuple, *resultobj; \
|
||||
int result; \
|
||||
tuple = PyTuple_New(c ? 2 : 1); \
|
||||
assert(tuple); \
|
||||
PyTuple_SET_ITEM(tuple, 0, b); \
|
||||
Py_XINCREF(b); \
|
||||
if (c) { \
|
||||
PyTuple_SET_ITEM(tuple, 1, c); \
|
||||
Py_XINCREF(c); \
|
||||
} \
|
||||
resultobj = wrapper(a, tuple); \
|
||||
result = resultobj ? 0 : -1; \
|
||||
Py_XDECREF(resultobj); \
|
||||
Py_DECREF(tuple); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define SWIGPY_REPRFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a) { \
|
||||
return wrapper(a, NULL); \
|
||||
}
|
||||
|
||||
#define SWIGPY_HASHFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN long \
|
||||
wrapper##_closure(PyObject *a) { \
|
||||
PyObject *pyresult; \
|
||||
long result; \
|
||||
pyresult = wrapper(a, NULL); \
|
||||
if (!pyresult || !PyLong_Check(pyresult)) \
|
||||
return -1; \
|
||||
result = PyLong_AsLong(pyresult); \
|
||||
Py_DECREF(pyresult); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#define SWIGPY_ITERNEXT_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a) { \
|
||||
PyObject *result; \
|
||||
result = wrapper(a, NULL); \
|
||||
if (result && result == Py_None) { \
|
||||
Py_DECREF(result); \
|
||||
result = NULL; \
|
||||
} \
|
||||
return result; \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
SWIGINTERN Py_hash_t
|
||||
SwigPyObject_hash(PyObject *obj) {
|
||||
SwigPyObject *sobj = (SwigPyObject *)obj;
|
||||
void *ptr = sobj->ptr;
|
||||
return (Py_hash_t)ptr;
|
||||
}
|
||||
|
||||
SWIGINTERN Py_hash_t
|
||||
SWIG_PyNumber_AsPyHash(PyObject *obj) {
|
||||
Py_hash_t result = -1;
|
||||
#if PY_VERSION_HEX < 0x03020000
|
||||
if (PyLong_Check(obj))
|
||||
result = PyLong_AsLong(obj);
|
||||
#else
|
||||
if (PyNumber_Check(obj))
|
||||
result = PyNumber_AsSsize_t(obj, NULL);
|
||||
#endif
|
||||
else
|
||||
PyErr_Format(PyExc_TypeError, "Wrong type for hash function");
|
||||
return result;
|
||||
}
|
||||
|
||||
SWIGINTERN int
|
||||
SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) {
|
||||
PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name);
|
||||
|
|
@ -222,11 +31,10 @@ SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *
|
|||
}
|
||||
|
||||
SWIGINTERN void
|
||||
SwigPyBuiltin_BadDealloc(PyObject *pyobj) {
|
||||
SwigPyObject *sobj;
|
||||
sobj = (SwigPyObject *)pyobj;
|
||||
SwigPyBuiltin_BadDealloc(PyObject *obj) {
|
||||
SwigPyObject *sobj = (SwigPyObject *)obj;
|
||||
if (sobj->own) {
|
||||
PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", pyobj->ob_type->tp_name);
|
||||
PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -387,16 +195,15 @@ SwigPyStaticVar_Type(void) {
|
|||
static int type_init = 0;
|
||||
if (!type_init) {
|
||||
const PyTypeObject tmp = {
|
||||
/* PyObject header changed in Python 3 */
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
#else
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0,
|
||||
0, /* ob_size */
|
||||
#endif
|
||||
"swig_static_var_getset_descriptor",
|
||||
sizeof(PyGetSetDescrObject),
|
||||
0,
|
||||
"swig_static_var_getset_descriptor", /* tp_name */
|
||||
sizeof(PyGetSetDescrObject), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
(destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
|
|
@ -527,6 +334,295 @@ SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Start of callback function macros for use in PyTypeObject */
|
||||
|
||||
typedef PyObject *(*SwigPyWrapperFunction)(PyObject *, PyObject *);
|
||||
|
||||
#define SWIGPY_UNARYFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_unaryfunc_closure(PyObject *a) { \
|
||||
return SwigPyBuiltin_unaryfunc_closure(wrapper, a); \
|
||||
}
|
||||
SWIGINTERN PyObject *
|
||||
SwigPyBuiltin_unaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
|
||||
return wrapper(a, NULL);
|
||||
}
|
||||
|
||||
#define SWIGPY_DESTRUCTOR_CLOSURE(wrapper) \
|
||||
SWIGINTERN void \
|
||||
wrapper##_destructor_closure(PyObject *a) { \
|
||||
SwigPyBuiltin_destructor_closure(wrapper, #wrapper, a); \
|
||||
}
|
||||
SWIGINTERN void
|
||||
SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) {
|
||||
SwigPyObject *sobj;
|
||||
sobj = (SwigPyObject *)a;
|
||||
Py_XDECREF(sobj->dict);
|
||||
if (sobj->own) {
|
||||
PyObject *o;
|
||||
PyObject *val = 0, *type = 0, *tb = 0;
|
||||
PyErr_Fetch(&val, &type, &tb);
|
||||
o = wrapper(a, NULL);
|
||||
if (!o) {
|
||||
PyObject *deallocname = PyString_FromString(wrappername);
|
||||
PyErr_WriteUnraisable(deallocname);
|
||||
Py_DECREF(deallocname);
|
||||
}
|
||||
PyErr_Restore(val, type, tb);
|
||||
Py_XDECREF(o);
|
||||
}
|
||||
if (PyType_IS_GC(a->ob_type)) {
|
||||
PyObject_GC_Del(a);
|
||||
} else {
|
||||
PyObject_Del(a);
|
||||
}
|
||||
}
|
||||
|
||||
#define SWIGPY_INQUIRY_CLOSURE(wrapper) \
|
||||
SWIGINTERN int \
|
||||
wrapper##_inquiry_closure(PyObject *a) { \
|
||||
return SwigPyBuiltin_inquiry_closure(wrapper, a); \
|
||||
}
|
||||
SWIGINTERN int
|
||||
SwigPyBuiltin_inquiry_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
|
||||
PyObject *pyresult;
|
||||
int result;
|
||||
pyresult = wrapper(a, NULL);
|
||||
result = pyresult && PyObject_IsTrue(pyresult) ? 1 : 0;
|
||||
Py_XDECREF(pyresult);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define SWIGPY_GETITERFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_getiterfunc_closure(PyObject *a) { \
|
||||
return SwigPyBuiltin_getiterfunc_closure(wrapper, a); \
|
||||
}
|
||||
SWIGINTERN PyObject *
|
||||
SwigPyBuiltin_getiterfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
|
||||
return wrapper(a, NULL);
|
||||
}
|
||||
|
||||
#define SWIGPY_BINARYFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_binaryfunc_closure(PyObject *a, PyObject *b) { \
|
||||
return SwigPyBuiltin_binaryfunc_closure(wrapper, a, b); \
|
||||
}
|
||||
SWIGINTERN PyObject *
|
||||
SwigPyBuiltin_binaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b) {
|
||||
PyObject *tuple, *result;
|
||||
tuple = PyTuple_New(1);
|
||||
assert(tuple);
|
||||
PyTuple_SET_ITEM(tuple, 0, b);
|
||||
Py_XINCREF(b);
|
||||
result = wrapper(a, tuple);
|
||||
Py_DECREF(tuple);
|
||||
return result;
|
||||
}
|
||||
|
||||
typedef ternaryfunc ternarycallfunc;
|
||||
|
||||
#define SWIGPY_TERNARYFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_ternaryfunc_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
||||
return SwigPyBuiltin_ternaryfunc_closure(wrapper, a, b, c); \
|
||||
}
|
||||
SWIGINTERN PyObject *
|
||||
SwigPyBuiltin_ternaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) {
|
||||
PyObject *tuple, *result;
|
||||
tuple = PyTuple_New(2);
|
||||
assert(tuple);
|
||||
PyTuple_SET_ITEM(tuple, 0, b);
|
||||
PyTuple_SET_ITEM(tuple, 1, c);
|
||||
Py_XINCREF(b);
|
||||
Py_XINCREF(c);
|
||||
result = wrapper(a, tuple);
|
||||
Py_DECREF(tuple);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define SWIGPY_TERNARYCALLFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_ternarycallfunc_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
||||
return SwigPyBuiltin_ternarycallfunc_closure(wrapper, a, b, c); \
|
||||
}
|
||||
SWIGINTERN PyObject *
|
||||
SwigPyBuiltin_ternarycallfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) {
|
||||
(void) c;
|
||||
return wrapper(a, b);
|
||||
}
|
||||
|
||||
#define SWIGPY_LENFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN Py_ssize_t \
|
||||
wrapper##_lenfunc_closure(PyObject *a) { \
|
||||
return SwigPyBuiltin_lenfunc_closure(wrapper, a); \
|
||||
}
|
||||
SWIGINTERN Py_ssize_t
|
||||
SwigPyBuiltin_lenfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
|
||||
PyObject *resultobj;
|
||||
Py_ssize_t result;
|
||||
resultobj = wrapper(a, NULL);
|
||||
result = PyNumber_AsSsize_t(resultobj, NULL);
|
||||
Py_DECREF(resultobj);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define SWIGPY_SSIZESSIZEARGFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_ssizessizeargfunc_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c) { \
|
||||
return SwigPyBuiltin_ssizessizeargfunc_closure(wrapper, a, b, c); \
|
||||
}
|
||||
SWIGINTERN PyObject *
|
||||
SwigPyBuiltin_ssizessizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, Py_ssize_t c) {
|
||||
PyObject *tuple, *result;
|
||||
tuple = PyTuple_New(2);
|
||||
assert(tuple);
|
||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b));
|
||||
PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c));
|
||||
result = wrapper(a, tuple);
|
||||
Py_DECREF(tuple);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define SWIGPY_SSIZESSIZEOBJARGPROC_CLOSURE(wrapper) \
|
||||
SWIGINTERN int \
|
||||
wrapper##_ssizessizeobjargproc_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) { \
|
||||
return SwigPyBuiltin_ssizessizeobjargproc_closure(wrapper, a, b, c, d); \
|
||||
}
|
||||
SWIGINTERN int
|
||||
SwigPyBuiltin_ssizessizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) {
|
||||
PyObject *tuple, *resultobj;
|
||||
int result;
|
||||
tuple = PyTuple_New(d ? 3 : 2);
|
||||
assert(tuple);
|
||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b));
|
||||
PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c));
|
||||
if (d) {
|
||||
PyTuple_SET_ITEM(tuple, 2, d);
|
||||
Py_INCREF(d);
|
||||
}
|
||||
resultobj = wrapper(a, tuple);
|
||||
result = resultobj ? 0 : -1;
|
||||
Py_DECREF(tuple);
|
||||
Py_XDECREF(resultobj);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define SWIGPY_SSIZEARGFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_ssizeargfunc_closure(PyObject *a, Py_ssize_t b) { \
|
||||
return SwigPyBuiltin_funpack_ssizeargfunc_closure(wrapper, a, b); \
|
||||
}
|
||||
SWIGINTERN PyObject *
|
||||
SwigPyBuiltin_funpack_ssizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b) {
|
||||
PyObject *tuple, *result;
|
||||
tuple = PyTuple_New(1);
|
||||
assert(tuple);
|
||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b));
|
||||
result = wrapper(a, tuple);
|
||||
Py_DECREF(tuple);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define SWIGPY_FUNPACK_SSIZEARGFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_ssizeargfunc_closure(PyObject *a, Py_ssize_t b) { \
|
||||
return SwigPyBuiltin_ssizeargfunc_closure(wrapper, a, b); \
|
||||
}
|
||||
SWIGINTERN PyObject *
|
||||
SwigPyBuiltin_ssizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b) {
|
||||
PyObject *arg, *result;
|
||||
arg = _PyLong_FromSsize_t(b);
|
||||
result = wrapper(a, arg);
|
||||
Py_DECREF(arg);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define SWIGPY_SSIZEOBJARGPROC_CLOSURE(wrapper) \
|
||||
SWIGINTERN int \
|
||||
wrapper##_ssizeobjargproc_closure(PyObject *a, Py_ssize_t b, PyObject *c) { \
|
||||
return SwigPyBuiltin_ssizeobjargproc_closure(wrapper, a, b, c); \
|
||||
}
|
||||
SWIGINTERN int
|
||||
SwigPyBuiltin_ssizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, PyObject *c) {
|
||||
PyObject *tuple, *resultobj;
|
||||
int result;
|
||||
tuple = PyTuple_New(2);
|
||||
assert(tuple);
|
||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b));
|
||||
PyTuple_SET_ITEM(tuple, 1, c);
|
||||
Py_XINCREF(c);
|
||||
resultobj = wrapper(a, tuple);
|
||||
result = resultobj ? 0 : -1;
|
||||
Py_XDECREF(resultobj);
|
||||
Py_DECREF(tuple);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define SWIGPY_OBJOBJARGPROC_CLOSURE(wrapper) \
|
||||
SWIGINTERN int \
|
||||
wrapper##_objobjargproc_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
||||
return SwigPyBuiltin_objobjargproc_closure(wrapper, a, b, c); \
|
||||
}
|
||||
SWIGINTERN int
|
||||
SwigPyBuiltin_objobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) {
|
||||
PyObject *tuple, *resultobj;
|
||||
int result;
|
||||
tuple = PyTuple_New(c ? 2 : 1);
|
||||
assert(tuple);
|
||||
PyTuple_SET_ITEM(tuple, 0, b);
|
||||
Py_XINCREF(b);
|
||||
if (c) {
|
||||
PyTuple_SET_ITEM(tuple, 1, c);
|
||||
Py_XINCREF(c);
|
||||
}
|
||||
resultobj = wrapper(a, tuple);
|
||||
result = resultobj ? 0 : -1;
|
||||
Py_XDECREF(resultobj);
|
||||
Py_DECREF(tuple);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define SWIGPY_REPRFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_reprfunc_closure(PyObject *a) { \
|
||||
return SwigPyBuiltin_reprfunc_closure(wrapper, a); \
|
||||
}
|
||||
SWIGINTERN PyObject *
|
||||
SwigPyBuiltin_reprfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
|
||||
return wrapper(a, NULL);
|
||||
}
|
||||
|
||||
#define SWIGPY_HASHFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN Py_hash_t \
|
||||
wrapper##_hashfunc_closure(PyObject *a) { \
|
||||
return SwigPyBuiltin_hashfunc_closure(wrapper, a); \
|
||||
}
|
||||
SWIGINTERN Py_hash_t
|
||||
SwigPyBuiltin_hashfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
|
||||
PyObject *pyresult;
|
||||
Py_hash_t result;
|
||||
pyresult = wrapper(a, NULL);
|
||||
if (!pyresult)
|
||||
return -1;
|
||||
result = SWIG_PyNumber_AsPyHash(pyresult);
|
||||
Py_DECREF(pyresult);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define SWIGPY_ITERNEXTFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_iternextfunc_closure(PyObject *a) { \
|
||||
return SwigPyBuiltin_iternextfunc_closure(wrapper, a);\
|
||||
}
|
||||
SWIGINTERN PyObject *
|
||||
SwigPyBuiltin_iternextfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
|
||||
return wrapper(a, NULL);
|
||||
}
|
||||
|
||||
/* End of callback function macros for use in PyTypeObject */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ namespace swig {
|
|||
if (step == 0) {
|
||||
throw std::invalid_argument("slice step cannot be zero");
|
||||
} else if (step > 0) {
|
||||
// Required range: 0 <= i < size, 0 <= j < size
|
||||
// Required range: 0 <= i < size, 0 <= j < size, i <= j
|
||||
if (i < 0) {
|
||||
ii = 0;
|
||||
} else if (i < (Difference)size) {
|
||||
|
|
@ -214,13 +214,15 @@ namespace swig {
|
|||
} else if (insert && (i >= (Difference)size)) {
|
||||
ii = (Difference)size;
|
||||
}
|
||||
if ( j < 0 ) {
|
||||
if (j < 0) {
|
||||
jj = 0;
|
||||
} else {
|
||||
jj = (j < (Difference)size) ? j : (Difference)size;
|
||||
}
|
||||
if (jj < ii)
|
||||
jj = ii;
|
||||
} else {
|
||||
// Required range: -1 <= i < size-1, -1 <= j < size-1
|
||||
// Required range: -1 <= i < size-1, -1 <= j < size-1, i >= j
|
||||
if (i < -1) {
|
||||
ii = -1;
|
||||
} else if (i < (Difference) size) {
|
||||
|
|
@ -233,6 +235,8 @@ namespace swig {
|
|||
} else {
|
||||
jj = (j < (Difference)size ) ? j : (Difference)(size-1);
|
||||
}
|
||||
if (ii < jj)
|
||||
ii = jj;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -258,6 +262,13 @@ namespace swig {
|
|||
seq->erase(position);
|
||||
}
|
||||
|
||||
template <class Sequence>
|
||||
struct traits_reserve {
|
||||
static void reserve(Sequence & /*seq*/, typename Sequence::size_type /*n*/) {
|
||||
// This should be specialized for types that support reserve
|
||||
}
|
||||
};
|
||||
|
||||
template <class Sequence, class Difference>
|
||||
inline Sequence*
|
||||
getslice(const Sequence* self, Difference i, Difference j, Py_ssize_t step) {
|
||||
|
|
@ -275,6 +286,7 @@ namespace swig {
|
|||
return new Sequence(sb, se);
|
||||
} else {
|
||||
Sequence *sequence = new Sequence();
|
||||
swig::traits_reserve<Sequence>::reserve(*sequence, (jj - ii + step - 1) / step);
|
||||
typename Sequence::const_iterator it = sb;
|
||||
while (it!=se) {
|
||||
sequence->push_back(*it);
|
||||
|
|
@ -285,17 +297,16 @@ namespace swig {
|
|||
}
|
||||
} else {
|
||||
Sequence *sequence = new Sequence();
|
||||
if (ii > jj) {
|
||||
typename Sequence::const_reverse_iterator sb = self->rbegin();
|
||||
typename Sequence::const_reverse_iterator se = self->rbegin();
|
||||
std::advance(sb,size-ii-1);
|
||||
std::advance(se,size-jj-1);
|
||||
typename Sequence::const_reverse_iterator it = sb;
|
||||
while (it!=se) {
|
||||
sequence->push_back(*it);
|
||||
for (Py_ssize_t c=0; c<-step && it!=se; ++c)
|
||||
it++;
|
||||
}
|
||||
swig::traits_reserve<Sequence>::reserve(*sequence, (ii - jj - step - 1) / -step);
|
||||
typename Sequence::const_reverse_iterator sb = self->rbegin();
|
||||
typename Sequence::const_reverse_iterator se = self->rbegin();
|
||||
std::advance(sb,size-ii-1);
|
||||
std::advance(se,size-jj-1);
|
||||
typename Sequence::const_reverse_iterator it = sb;
|
||||
while (it!=se) {
|
||||
sequence->push_back(*it);
|
||||
for (Py_ssize_t c=0; c<-step && it!=se; ++c)
|
||||
it++;
|
||||
}
|
||||
return sequence;
|
||||
}
|
||||
|
|
@ -309,12 +320,11 @@ namespace swig {
|
|||
Difference jj = 0;
|
||||
swig::slice_adjust(i, j, step, size, ii, jj, true);
|
||||
if (step > 0) {
|
||||
if (jj < ii)
|
||||
jj = ii;
|
||||
if (step == 1) {
|
||||
size_t ssize = jj - ii;
|
||||
if (ssize <= is.size()) {
|
||||
// expanding/staying the same size
|
||||
swig::traits_reserve<Sequence>::reserve(*self, self->size() - ssize + is.size());
|
||||
typename Sequence::iterator sb = self->begin();
|
||||
typename InputSeq::const_iterator isit = is.begin();
|
||||
std::advance(sb,ii);
|
||||
|
|
@ -348,8 +358,6 @@ namespace swig {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (jj > ii)
|
||||
jj = ii;
|
||||
size_t replacecount = (ii - jj - step - 1) / -step;
|
||||
if (is.size() != replacecount) {
|
||||
char msg[1024];
|
||||
|
|
@ -375,37 +383,33 @@ namespace swig {
|
|||
Difference jj = 0;
|
||||
swig::slice_adjust(i, j, step, size, ii, jj, true);
|
||||
if (step > 0) {
|
||||
if (jj > ii) {
|
||||
typename Sequence::iterator sb = self->begin();
|
||||
std::advance(sb,ii);
|
||||
if (step == 1) {
|
||||
typename Sequence::iterator se = self->begin();
|
||||
std::advance(se,jj);
|
||||
self->erase(sb,se);
|
||||
} else {
|
||||
typename Sequence::iterator it = sb;
|
||||
size_t delcount = (jj - ii + step - 1) / step;
|
||||
while (delcount) {
|
||||
it = self->erase(it);
|
||||
for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c)
|
||||
it++;
|
||||
delcount--;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (ii > jj) {
|
||||
typename Sequence::reverse_iterator sb = self->rbegin();
|
||||
std::advance(sb,size-ii-1);
|
||||
typename Sequence::reverse_iterator it = sb;
|
||||
size_t delcount = (ii - jj - step - 1) / -step;
|
||||
typename Sequence::iterator sb = self->begin();
|
||||
std::advance(sb,ii);
|
||||
if (step == 1) {
|
||||
typename Sequence::iterator se = self->begin();
|
||||
std::advance(se,jj);
|
||||
self->erase(sb,se);
|
||||
} else {
|
||||
typename Sequence::iterator it = sb;
|
||||
size_t delcount = (jj - ii + step - 1) / step;
|
||||
while (delcount) {
|
||||
it = typename Sequence::reverse_iterator(self->erase((++it).base()));
|
||||
for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c)
|
||||
it = self->erase(it);
|
||||
for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c)
|
||||
it++;
|
||||
delcount--;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
typename Sequence::reverse_iterator sb = self->rbegin();
|
||||
std::advance(sb,size-ii-1);
|
||||
typename Sequence::reverse_iterator it = sb;
|
||||
size_t delcount = (ii - jj - step - 1) / -step;
|
||||
while (delcount) {
|
||||
it = typename Sequence::reverse_iterator(self->erase((++it).base()));
|
||||
for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c)
|
||||
it++;
|
||||
delcount--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,4 +211,5 @@ typedef destructor freefunc;
|
|||
#if PY_VERSION_HEX < 0x03020000
|
||||
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
|
||||
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
|
||||
#define Py_hash_t long
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -145,7 +145,6 @@ swig_varlink_type(void) {
|
|||
static int type_init = 0;
|
||||
if (!type_init) {
|
||||
const PyTypeObject tmp = {
|
||||
/* PyObject header changed in Python 3 */
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -18,31 +18,35 @@
|
|||
where <slot> is the name of a field in a PyTypeObject, PyNumberMethods,
|
||||
PyMappingMethods, PySequenceMethods, or PyBufferProcs. For example:
|
||||
|
||||
%{
|
||||
|
||||
static long myHashFunc (PyObject *pyobj) {
|
||||
MyClass *cobj;
|
||||
// Convert pyobj to cobj
|
||||
return (cobj->field1 * (cobj->field2 << 7));
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%feature("python:tp_hash") MyClass "myHashFunc";
|
||||
|
||||
class MyClass {
|
||||
public:
|
||||
...
|
||||
};
|
||||
|
||||
%{
|
||||
// Note: Py_hash_t was introduced in Python 3.2
|
||||
static Py_hash_t myHashFunc(PyObject *pyobj) {
|
||||
MyClass *cobj;
|
||||
// Convert pyobj to cobj
|
||||
return (cobj->field1 * (cobj->field2 << 7));
|
||||
}
|
||||
%}
|
||||
|
||||
NOTE: It is the responsibility of the programmer (that's you) to ensure
|
||||
that a statically defined slot function has the correct signature.
|
||||
|
||||
If, instead, you want to dispatch to an instance method, you can
|
||||
use %feature("python:slot"). For example:
|
||||
|
||||
%feature("python:slot", "tp_hash", functype="hashfunc") MyClass::myHashFunc;
|
||||
|
||||
class MyClass {
|
||||
public:
|
||||
long myHashFunc () const;
|
||||
Py_hash_t myHashFunc () const;
|
||||
...
|
||||
};
|
||||
|
||||
%feature("python:slot", "tp_hash", functype="hashfunc") MyClass::myHashFunc;
|
||||
|
||||
NOTE: Some python slots use a method signature which does not
|
||||
match the signature of SWIG-wrapped methods. For those slots,
|
||||
|
|
@ -58,20 +62,21 @@
|
|||
operator overloads for comparison (operator==, operator<, etc.), they
|
||||
will be called from the generated rich compare function. If you
|
||||
want to explicitly choose a method to handle a certain comparison
|
||||
operation, you may use %feature("python:slot") like this:
|
||||
operation, you may use a different feature, %feature("python:compare")
|
||||
like this:
|
||||
|
||||
%feature("python:compare", "Py_LT") MyClass::lessThan;
|
||||
|
||||
class MyClass {
|
||||
public:
|
||||
bool lessThan (const MyClass& x) const;
|
||||
bool lessThan(const MyClass& other) const;
|
||||
...
|
||||
};
|
||||
|
||||
%feature("python:slot", "Py_LT") MyClass::lessThan;
|
||||
|
||||
... where "Py_LT" is one of the rich comparison opcodes defined in the
|
||||
python header file object.h.
|
||||
|
||||
If there's no method defined to handle a particular comparsion operation,
|
||||
If there's no method defined to handle a particular comparison operation,
|
||||
the default behavior is to compare pointer values of the wrapped
|
||||
C++ objects.
|
||||
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ SWIG_AsVal_dec(double)(PyObject *obj, double *val)
|
|||
return SWIG_OK;
|
||||
%#if PY_VERSION_HEX < 0x03000000
|
||||
} else if (PyInt_Check(obj)) {
|
||||
if (val) *val = PyInt_AsLong(obj);
|
||||
if (val) *val = (double) PyInt_AsLong(obj);
|
||||
return SWIG_OK;
|
||||
%#endif
|
||||
} else if (PyLong_Check(obj)) {
|
||||
|
|
|
|||
|
|
@ -758,7 +758,6 @@ SwigPyObject_TypeOnce(void) {
|
|||
static int type_init = 0;
|
||||
if (!type_init) {
|
||||
const PyTypeObject tmp = {
|
||||
/* PyObject header changed in Python 3 */
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
#else
|
||||
|
|
@ -769,7 +768,7 @@ SwigPyObject_TypeOnce(void) {
|
|||
sizeof(SwigPyObject), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
(destructor)SwigPyObject_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_print */
|
||||
#if PY_VERSION_HEX < 0x02020000
|
||||
(getattrfunc)SwigPyObject_getattr, /* tp_getattr */
|
||||
#else
|
||||
|
|
@ -777,7 +776,7 @@ SwigPyObject_TypeOnce(void) {
|
|||
#endif
|
||||
(setattrfunc)0, /* tp_setattr */
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
|
||||
0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
|
||||
#else
|
||||
(cmpfunc)SwigPyObject_compare, /* tp_compare */
|
||||
#endif
|
||||
|
|
@ -787,7 +786,7 @@ SwigPyObject_TypeOnce(void) {
|
|||
0, /* tp_as_mapping */
|
||||
(hashfunc)0, /* tp_hash */
|
||||
(ternaryfunc)0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_str */
|
||||
PyObject_GenericGetAttr, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
|
|
@ -950,7 +949,6 @@ SwigPyPacked_TypeOnce(void) {
|
|||
static int type_init = 0;
|
||||
if (!type_init) {
|
||||
const PyTypeObject tmp = {
|
||||
/* PyObject header changed in Python 3 */
|
||||
#if PY_VERSION_HEX>=0x03000000
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -15,6 +15,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
template <class K, class T>
|
||||
struct traits_reserve<std::unordered_map<K,T> > {
|
||||
static void reserve(std::unordered_map<K,T> &seq, typename std::unordered_map<K,T>::size_type n) {
|
||||
seq.reserve(n);
|
||||
}
|
||||
};
|
||||
|
||||
template <class K, class T>
|
||||
struct traits_asptr<std::unordered_map<K,T> > {
|
||||
typedef std::unordered_map<K,T> unordered_map_type;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
template <class K, class T>
|
||||
struct traits_reserve<std::unordered_multimap<K,T> > {
|
||||
static void reserve(std::unordered_multimap<K,T> &seq, typename std::unordered_multimap<K,T>::size_type n) {
|
||||
seq.reserve(n);
|
||||
}
|
||||
};
|
||||
|
||||
template <class K, class T>
|
||||
struct traits_asptr<std::unordered_multimap<K,T> > {
|
||||
typedef std::unordered_multimap<K,T> unordered_multimap_type;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct traits_reserve<std::unordered_multiset<T> > {
|
||||
static void reserve(std::unordered_multiset<T> &seq, typename std::unordered_multiset<T>::size_type n) {
|
||||
seq.reserve(n);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct traits_asptr<std::unordered_multiset<T> > {
|
||||
static int asptr(PyObject *obj, std::unordered_multiset<T> **m) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct traits_reserve<std::unordered_set<T> > {
|
||||
static void reserve(std::unordered_set<T> &seq, typename std::unordered_set<T>::size_type n) {
|
||||
seq.reserve(n);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct traits_asptr<std::unordered_set<T> > {
|
||||
static int asptr(PyObject *obj, std::unordered_set<T> **s) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,13 @@
|
|||
%fragment("StdVectorTraits","header",fragment="StdSequenceTraits")
|
||||
%{
|
||||
namespace swig {
|
||||
template <class T>
|
||||
struct traits_reserve<std::vector<T> > {
|
||||
static void reserve(std::vector<T> &seq, typename std::vector<T>::size_type n) {
|
||||
seq.reserve(n);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct traits_asptr<std::vector<T> > {
|
||||
static int asptr(PyObject *obj, std::vector<T> **vec) {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,4 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
#include <exception>
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* for raw pointer */
|
||||
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_R_ConvertPtr(obj, pptr, type, flags)
|
||||
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_R_ConvertPtr(obj, pptr, type, flags)
|
||||
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_R_NewPointerObj(ptr, type, flags)
|
||||
|
||||
|
||||
/* Remove global namespace pollution */
|
||||
#if !defined(SWIG_NO_R_NO_REMAP)
|
||||
# define R_NO_REMAP
|
||||
|
|
@ -20,6 +9,17 @@ extern "C" {
|
|||
|
||||
#include <Rdefines.h>
|
||||
#include <Rversion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <exception>
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* for raw pointer */
|
||||
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_R_ConvertPtr(obj, pptr, type, flags)
|
||||
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_R_ConvertPtr(obj, pptr, type, flags)
|
||||
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_R_NewPointerObj(ptr, type, flags)
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,6 @@ SWIG_SciBoolean_AsIntArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCo
|
|||
}
|
||||
|
||||
if (isBooleanType(pvApiCtx, piAddrVar)) {
|
||||
int i;
|
||||
sciErr = getMatrixOfBoolean(pvApiCtx, piAddrVar, iRows, iCols, piValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
}
|
||||
|
||||
%fragment("SWIG_NewPointerObj", "header") {
|
||||
#define SWIG_NewPointerObj(pointer, pointerDescriptor, flags) SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pointer, pointerDescriptor, flags)
|
||||
#define SWIG_NewPointerObj(pointer, pointerDescriptor, flags) SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pointer, pointerDescriptor, flags, NULL)
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
}
|
||||
|
||||
%fragment("SWIG_NewFunctionPtrObj", "header") {
|
||||
#define SWIG_NewFunctionPtrObj(pointer, pointerDescriptor) SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pointer, pointerDescriptor, 0)
|
||||
#define SWIG_NewFunctionPtrObj(pointer, pointerDescriptor) SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pointer, pointerDescriptor, 0, NULL)
|
||||
}
|
||||
// No fragment used here, the functions "SwigScilabPtrToObject" and "SwigScilabPtrFromObject" are defined in sciruntime.swg
|
||||
|
||||
|
|
|
|||
|
|
@ -100,8 +100,83 @@ SWIG_Scilab_SetOutput(void *pvApiCtx, SwigSciObject output) {
|
|||
return SWIG_OK;
|
||||
}
|
||||
|
||||
/* Error functions */
|
||||
|
||||
#define SCILAB_API_ARGUMENT_ERROR 999
|
||||
|
||||
SWIGINTERN const char*
|
||||
SWIG_Scilab_ErrorType(int code) {
|
||||
switch(code) {
|
||||
case SWIG_MemoryError:
|
||||
return "MemoryError";
|
||||
case SWIG_IOError:
|
||||
return "IOError";
|
||||
case SWIG_RuntimeError:
|
||||
return "RuntimeError";
|
||||
case SWIG_IndexError:
|
||||
return "IndexError";
|
||||
case SWIG_TypeError:
|
||||
return "TypeError";
|
||||
case SWIG_DivisionByZero:
|
||||
return "ZeroDivisionError";
|
||||
case SWIG_OverflowError:
|
||||
return "OverflowError";
|
||||
case SWIG_SyntaxError:
|
||||
return "SyntaxError";
|
||||
case SWIG_ValueError:
|
||||
return "ValueError";
|
||||
case SWIG_SystemError:
|
||||
return "SystemError";
|
||||
case SWIG_AttributeError:
|
||||
return "AttributeError";
|
||||
default:
|
||||
return "RuntimeError";
|
||||
}
|
||||
}
|
||||
#define SWIG_ErrorType(code) SWIG_Scilab_ErrorType(code)
|
||||
|
||||
#ifndef SWIG_SCILAB_ERROR
|
||||
#define SWIG_SCILAB_ERROR 20000
|
||||
#endif
|
||||
|
||||
SWIGINTERN void
|
||||
SWIG_Scilab_Error(int code, const char *msg) {
|
||||
Scierror(SWIG_SCILAB_ERROR - code, _("SWIG/Scilab: %s: %s\n"), SWIG_Scilab_ErrorType(code), msg);
|
||||
}
|
||||
|
||||
#define SWIG_Error(code, msg) SWIG_Scilab_Error(code, msg)
|
||||
|
||||
#define SWIG_fail return SWIG_ERROR;
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_Scilab_Raise_Ex(const char *obj, const char *type, swig_type_info *descriptor) {
|
||||
if (type) {
|
||||
if (obj)
|
||||
Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured: %s\n", type, obj);
|
||||
else
|
||||
Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type);
|
||||
}
|
||||
}
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_Scilab_Raise(const int obj, const char *type, swig_type_info *descriptor) {
|
||||
Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type);
|
||||
}
|
||||
|
||||
/* Module initialization */
|
||||
|
||||
static int swig_module_initialized = 0;
|
||||
|
||||
SWIGRUNTIME int
|
||||
SWIG_Module_Initialized() {
|
||||
return swig_module_initialized;
|
||||
}
|
||||
|
||||
/* Pointer conversion functions */
|
||||
|
||||
SWIGRUNTIME swig_type_info *
|
||||
SWIG_Scilab_TypeQuery(const char *name);
|
||||
|
||||
SWIGINTERN int
|
||||
SwigScilabCheckPtr(void *pvApiCtx, int iVar, swig_type_info *descriptor, char *fname) {
|
||||
SciErr sciErr;
|
||||
|
|
@ -120,7 +195,7 @@ SwigScilabCheckPtr(void *pvApiCtx, int iVar, swig_type_info *descriptor, char *f
|
|||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
if (iType == sci_tlist) {
|
||||
if (iType == sci_mlist) {
|
||||
int iItemCount = 0;
|
||||
void *pvTypeinfo = NULL;
|
||||
|
||||
|
|
@ -142,10 +217,10 @@ SwigScilabCheckPtr(void *pvApiCtx, int iVar, swig_type_info *descriptor, char *f
|
|||
if (descriptor) {
|
||||
swig_cast_info *cast = SWIG_TypeCheck(SWIG_TypeName((swig_type_info*)pvTypeinfo), descriptor);
|
||||
return (cast != NULL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return (iType == sci_pointer);
|
||||
|
|
@ -171,7 +246,7 @@ SwigScilabPtrToObject(void *pvApiCtx, int iVar, void **pvObj, swig_type_info *de
|
|||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
if (iType == sci_tlist) {
|
||||
if (iType == sci_mlist) {
|
||||
int iItemCount = 0;
|
||||
void *pvTypeinfo = NULL;
|
||||
|
||||
|
|
@ -232,34 +307,36 @@ SwigScilabPtrToObject(void *pvApiCtx, int iVar, void **pvObj, swig_type_info *de
|
|||
}
|
||||
|
||||
SWIGRUNTIMEINLINE int
|
||||
SwigScilabPtrFromObject(void *pvApiCtx, int iVarOut, void *pvObj, swig_type_info *descriptor, int flags) {
|
||||
SwigScilabPtrFromObject(void *pvApiCtx, int iVarOut, void *pvObj, swig_type_info *descriptor, int flags, const char *pstTypeName) {
|
||||
SciErr sciErr;
|
||||
|
||||
if (descriptor) {
|
||||
int *piTListAddr = NULL;
|
||||
const char *pstString;
|
||||
int *piMListAddr = NULL;
|
||||
|
||||
sciErr = createTList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, 3, &piTListAddr);
|
||||
sciErr = createMList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, 3, &piMListAddr);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
pstString = SWIG_TypeName(descriptor);
|
||||
sciErr = createMatrixOfStringInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piTListAddr, 1, 1, 1, &pstString);
|
||||
if (pstTypeName == NULL) {
|
||||
pstTypeName = SWIG_TypeName(descriptor);
|
||||
}
|
||||
|
||||
sciErr = createMatrixOfStringInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piMListAddr, 1, 1, 1, &pstTypeName);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = createPointerInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piTListAddr, 2, descriptor);
|
||||
sciErr = createPointerInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piMListAddr, 2, descriptor);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
|
||||
sciErr = createPointerInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piTListAddr, 3, pvObj);
|
||||
sciErr = createPointerInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piMListAddr, 3, pvObj);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
|
|
@ -342,69 +419,7 @@ SWIG_Scilab_NewMemberObj(void *pvApiCtx, int iVarOut, void *ptr, int sz, swig_ty
|
|||
}
|
||||
|
||||
|
||||
/* Error functions */
|
||||
|
||||
#define SCILAB_API_ARGUMENT_ERROR 999
|
||||
|
||||
SWIGINTERN const char*
|
||||
SWIG_Scilab_ErrorType(int code) {
|
||||
switch(code) {
|
||||
case SWIG_MemoryError:
|
||||
return "MemoryError";
|
||||
case SWIG_IOError:
|
||||
return "IOError";
|
||||
case SWIG_RuntimeError:
|
||||
return "RuntimeError";
|
||||
case SWIG_IndexError:
|
||||
return "IndexError";
|
||||
case SWIG_TypeError:
|
||||
return "TypeError";
|
||||
case SWIG_DivisionByZero:
|
||||
return "ZeroDivisionError";
|
||||
case SWIG_OverflowError:
|
||||
return "OverflowError";
|
||||
case SWIG_SyntaxError:
|
||||
return "SyntaxError";
|
||||
case SWIG_ValueError:
|
||||
return "ValueError";
|
||||
case SWIG_SystemError:
|
||||
return "SystemError";
|
||||
case SWIG_AttributeError:
|
||||
return "AttributeError";
|
||||
default:
|
||||
return "RuntimeError";
|
||||
}
|
||||
}
|
||||
#define SWIG_ErrorType(code) SWIG_Scilab_ErrorType(code)
|
||||
|
||||
#ifndef SWIG_SCILAB_ERROR
|
||||
#define SWIG_SCILAB_ERROR 20000
|
||||
#endif
|
||||
|
||||
SWIGINTERN void
|
||||
SWIG_Scilab_Error(int code, const char *msg)
|
||||
{
|
||||
Scierror(SWIG_SCILAB_ERROR - code, _("SWIG/Scilab: %s: %s\n"), SWIG_Scilab_ErrorType(code), msg);
|
||||
}
|
||||
|
||||
#define SWIG_Error(code, msg) SWIG_Scilab_Error(code, msg)
|
||||
|
||||
#define SWIG_fail return SWIG_ERROR;
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_Scilab_Raise_Ex(const char *obj, const char *type, swig_type_info *descriptor) {
|
||||
if (type) {
|
||||
if (obj)
|
||||
Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured: %s\n", type, obj);
|
||||
else
|
||||
Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type);
|
||||
}
|
||||
}
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_Scilab_Raise(const int obj, const char *type, swig_type_info *descriptor) {
|
||||
Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type);
|
||||
}
|
||||
|
||||
/*
|
||||
* Pointer utility functions
|
||||
|
|
@ -451,7 +466,7 @@ int SWIG_ptr(SWIG_GatewayParameters) {
|
|||
}
|
||||
SWIG_Scilab_SetOutputPosition(1);
|
||||
return SWIG_Scilab_SetOutput(pvApiCtx,
|
||||
SwigScilabPtrFromObject(pvApiCtx, 1, (void *) (uintptr_t)dValue, NULL, 0));
|
||||
SwigScilabPtrFromObject(pvApiCtx, 1, (void *) (uintptr_t)dValue, NULL, 0, NULL));
|
||||
}
|
||||
else {
|
||||
return SWIG_ERROR;
|
||||
|
|
|
|||
|
|
@ -1,33 +1,45 @@
|
|||
%insert(runtime) "swigrun.swg";
|
||||
%insert(runtime) "swigerrors.swg";
|
||||
|
||||
#define %scilabcode %insert("scilab")
|
||||
|
||||
%insert(runtime) "scirun.swg";
|
||||
|
||||
%init %{
|
||||
%insert(init) %{
|
||||
/* Module management functions */
|
||||
|
||||
#define SWIG_GetModule(clientdata) SWIG_Scilab_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Scilab_SetModule(pointer)
|
||||
|
||||
SWIGRUNTIME swig_module_info*
|
||||
SWIG_Scilab_GetModule(void)
|
||||
{
|
||||
SWIG_Scilab_GetModule(void) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_Scilab_SetModule(swig_module_info *swig_module)
|
||||
{
|
||||
SWIG_Scilab_SetModule(swig_module_info *swig_module) {
|
||||
}
|
||||
%}
|
||||
|
||||
%insert(init) "swiginit.swg"
|
||||
|
||||
%init %{
|
||||
%insert(init) %{
|
||||
SWIGRUNTIME swig_type_info *
|
||||
SWIG_Scilab_TypeQuery(const char *name) {
|
||||
if (SWIG_Module_Initialized()) {
|
||||
return SWIG_TypeQuery(name);
|
||||
}
|
||||
else {
|
||||
SWIG_Error(SWIG_RuntimeError, "the module is not initialized");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
%insert(init) %{
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int <module>_Init(SWIG_GatewayParameters) {
|
||||
SWIG_InitializeModule(NULL);
|
||||
SWIG_CreateScilabVariables(pvApiCtx);
|
||||
swig_module_initialized = 1;
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ SWIG_FromSet_Sequence_dec(bool)(int size, int *pSequence) {
|
|||
|
||||
SWIGINTERN bool
|
||||
SWIG_AsVal_SequenceItem_dec(bool)(SwigSciObject obj, int *pSequence, int iItemIndex) {
|
||||
return pSequence[iItemIndex];
|
||||
return (bool) pSequence[iItemIndex];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*char
|
||||
*
|
||||
* Scilab matrix of string <-> C++ std::string container
|
||||
*
|
||||
*/
|
||||
|
|
@ -88,7 +88,7 @@ SWIG_AsVal_SequenceItem_dec(std::string)(SwigSciObject obj, char **pSequence, in
|
|||
|
||||
SWIGINTERN int
|
||||
SWIG_From_SequenceItem_dec(std::string)(char **pSequence, int iItemIndex, std::string itemValue) {
|
||||
char *pChar = new char(itemValue.size() + 1);
|
||||
char *pChar = new char((int) itemValue.size() + 1);
|
||||
strcpy(pChar, itemValue.c_str());
|
||||
pSequence[iItemIndex] = pChar;
|
||||
return SWIG_OK;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,13 @@
|
|||
// to use a pointer to the smart pointer of the type, rather than the usual pointer to the underlying type.
|
||||
// So for some type T, shared_ptr<T> * is used rather than T *.
|
||||
|
||||
// Another key part of the implementation is the smartptr feature:
|
||||
// %feature("smartptr") T { shared_ptr<T> }
|
||||
// This feature marks the class T as having a smartptr to it (the shared_ptr<T> type). This is then used to
|
||||
// support smart pointers and inheritance. Say class D derives from base B, then shared_ptr<D> is marked
|
||||
// with a fake inheritance from shared_ptr<B> in the type system if the "smartptr" feature is used on both
|
||||
// B and D. This is to emulate the conversion of shared_ptr<D> to shared_ptr<B> in the target language.
|
||||
|
||||
// shared_ptr namespaces could be boost or std or std::tr1
|
||||
// For example for std::tr1, use:
|
||||
// #define SWIG_SHARED_PTR_NAMESPACE std
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#endif
|
||||
|
||||
%{
|
||||
#include <typeinfo>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
|
|
@ -15,6 +16,10 @@ namespace std {
|
|||
virtual const char* what() const throw();
|
||||
};
|
||||
|
||||
struct bad_cast : exception
|
||||
{
|
||||
};
|
||||
|
||||
struct bad_exception : exception
|
||||
{
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#endif
|
||||
|
||||
%{
|
||||
#include <typeinfo>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
|
|
@ -40,6 +41,7 @@
|
|||
%enddef
|
||||
|
||||
namespace std {
|
||||
%std_exception_map(bad_cast, SWIG_TypeError);
|
||||
%std_exception_map(bad_exception, SWIG_SystemError);
|
||||
%std_exception_map(domain_error, SWIG_ValueError);
|
||||
%std_exception_map(exception, SWIG_SystemError);
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@
|
|||
* This macro is used to return Character data along with a size
|
||||
* parameter.
|
||||
*
|
||||
* %cstring_output_maxsize(Char *outx, int *max) {
|
||||
* %cstring_output_withsize(Char *outx, int *max) {
|
||||
* void foo(Char *outx, int *max) {
|
||||
* sprintf(outx,"blah blah\n");
|
||||
* *max = strlen(outx);
|
||||
|
|
@ -236,7 +236,7 @@
|
|||
* This macro is used to return Character data that was
|
||||
* allocated with new or malloc.
|
||||
*
|
||||
* %cstring_output_allocated(Char **outx, free($1));
|
||||
* %cstring_output_allocate(Char **outx, free($1));
|
||||
* void foo(Char **outx) {
|
||||
* *outx = (Char *) malloc(512);
|
||||
* sprintf(outx,"blah blah\n");
|
||||
|
|
@ -263,7 +263,7 @@
|
|||
* This macro is used to return Character data that was
|
||||
* allocated with new or malloc.
|
||||
*
|
||||
* %cstring_output_allocated(Char **outx, int *sz, free($1));
|
||||
* %cstring_output_allocate_size(Char **outx, int *sz, free($1));
|
||||
* void foo(Char **outx, int *sz) {
|
||||
* *outx = (Char *) malloc(512);
|
||||
* sprintf(outx,"blah blah\n");
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
%enddef
|
||||
|
||||
namespace std {
|
||||
%std_exception_map(bad_cast, SWIG_TypeError);
|
||||
%std_exception_map(bad_exception, SWIG_SystemError);
|
||||
%std_exception_map(domain_error, SWIG_ValueError);
|
||||
%std_exception_map(exception, SWIG_SystemError);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue