A slew of changes based on William Fulton's code review.
- Fixed naming conventions; SwigPyBuiltin is used a lot - Removed use of std::vector - builtin.swg isn't included if -builtin isn't specified - Changed many feature names to use a "python:" prefix - Eliminated static vars in std_pair.i - Eliminated C++-style comments (//) - Enabled autodoc and docstring with -builtin - Fixed non-ansi generated C code - Detect and complain if two incompatible swig modules are loaded - Removed argcargvtest_runme3.py, and fixed argcargvtest_runme.py so that 2to3 handles it better - Removed anonymous namespaces - Eliminated builtin_init typemaps; consolidated functionality into SWIG_Python_NewPointerObj - Eliminate printf warnings from %U conversion character by switching to %S, which works just as well - Fixed li_std_set_runme.py for python3, which returns set members in a different order from python2 git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12562 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
39921e87d9
commit
3d444101d1
23 changed files with 550 additions and 509 deletions
|
|
@ -6,6 +6,10 @@
|
|||
#define SHARED_PTR_DISOWN 0
|
||||
#endif
|
||||
|
||||
%fragment("SWIG_null_deleter_python", "header", fragment="SWIG_null_deleter") {
|
||||
%#define SWIG_NO_NULL_DELETER_SWIG_BUILTIN_INIT
|
||||
}
|
||||
|
||||
// Language specific macro implementing all the customisations for handling the smart pointer
|
||||
%define SWIG_SHARED_PTR_TYPEMAPS(CONST, TYPE...)
|
||||
|
||||
|
|
@ -76,7 +80,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * {
|
||||
%typemap(out, fragment="SWIG_null_deleter_python") CONST TYPE * {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), $owner | SWIG_POINTER_OWN));
|
||||
}
|
||||
|
|
@ -99,7 +103,7 @@
|
|||
$1 = %const_cast((smartarg ? smartarg->get() : 0), $1_ltype);
|
||||
}
|
||||
}
|
||||
%typemap(varout, fragment="SWIG_null_deleter") CONST TYPE * {
|
||||
%typemap(varout, fragment="SWIG_null_deleter_python") CONST TYPE * {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
|
||||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
|
@ -120,7 +124,7 @@
|
|||
$1 = %const_cast(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get(), $1_ltype);
|
||||
}
|
||||
}
|
||||
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE & {
|
||||
%typemap(out, fragment="SWIG_null_deleter_python") CONST TYPE & {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner);
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
|
@ -142,7 +146,7 @@
|
|||
$1 = *%const_cast(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get(), $1_ltype);
|
||||
}
|
||||
}
|
||||
%typemap(varout, fragment="SWIG_null_deleter") CONST TYPE & {
|
||||
%typemap(varout, fragment="SWIG_null_deleter_python") CONST TYPE & {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
|
||||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
|
@ -164,7 +168,7 @@
|
|||
}
|
||||
$1 = &temp;
|
||||
}
|
||||
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& {
|
||||
%typemap(out, fragment="SWIG_null_deleter_python") TYPE *CONST& {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
|
@ -316,7 +320,7 @@
|
|||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
|
||||
%typemap(builtin_init, fragment="SWIG_null_deleter") CONST TYPE * {
|
||||
%typemap(builtin_init, fragment="SWIG_null_deleter_python") CONST TYPE * {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
|
||||
%set_output(SWIG_Python_NewBuiltinObj(self, %as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), $owner | SWIG_POINTER_OWN));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#define PYSWIG_UNARYFUNC_CLOSURE(wrapper) \
|
||||
#define SWIGPY_UNARYFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a) { \
|
||||
return wrapper(a, NULL); \
|
||||
}
|
||||
|
||||
#define PYSWIG_DESTRUCTOR_CLOSURE(wrapper) \
|
||||
#define SWIGPY_DESTRUCTOR_CLOSURE(wrapper) \
|
||||
SWIGINTERN void \
|
||||
wrapper##_closure(PyObject *a) { \
|
||||
SwigPyObject *sobj = (SwigPyObject *)a; \
|
||||
|
|
@ -14,7 +14,7 @@ wrapper##_closure(PyObject *a) { \
|
|||
} \
|
||||
}
|
||||
|
||||
#define PYSWIG_INQUIRY_CLOSURE(wrapper) \
|
||||
#define SWIGPY_INQUIRY_CLOSURE(wrapper) \
|
||||
SWIGINTERN int \
|
||||
wrapper##_closure(PyObject *a) { \
|
||||
PyObject *pyresult = wrapper(a, NULL); \
|
||||
|
|
@ -23,7 +23,7 @@ wrapper##_closure(PyObject *a) { \
|
|||
return result; \
|
||||
}
|
||||
|
||||
#define PYSWIG_BINARYFUNC_CLOSURE(wrapper) \
|
||||
#define SWIGPY_BINARYFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a, PyObject *b) { \
|
||||
PyObject *tuple = PyTuple_New(1); \
|
||||
|
|
@ -35,7 +35,7 @@ wrapper##_closure(PyObject *a, PyObject *b) { \
|
|||
return result; \
|
||||
}
|
||||
|
||||
#define PYSWIG_TERNARYFUNC_CLOSURE(wrapper) \
|
||||
#define SWIGPY_TERNARYFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
||||
PyObject *tuple = PyTuple_New(2); \
|
||||
|
|
@ -49,7 +49,7 @@ wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
|||
return result; \
|
||||
}
|
||||
|
||||
#define PYSWIG_LENFUNC_CLOSURE(wrapper) \
|
||||
#define SWIGPY_LENFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN Py_ssize_t \
|
||||
wrapper##_closure(PyObject *a) { \
|
||||
PyObject *resultobj = wrapper(a, NULL); \
|
||||
|
|
@ -58,7 +58,7 @@ wrapper##_closure(PyObject *a) { \
|
|||
return result; \
|
||||
}
|
||||
|
||||
#define PYSWIG_SSIZESSIZEARGFUNC_CLOSURE(wrapper) \
|
||||
#define SWIGPY_SSIZESSIZEARGFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c) { \
|
||||
PyObject *tuple = PyTuple_New(2); \
|
||||
|
|
@ -70,7 +70,7 @@ wrapper##_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c) { \
|
|||
return result; \
|
||||
}
|
||||
|
||||
#define PYSWIG_SSIZESSIZEOBJARGPROC_CLOSURE(wrapper) \
|
||||
#define SWIGPY_SSIZESSIZEOBJARGPROC_CLOSURE(wrapper) \
|
||||
SWIGINTERN int \
|
||||
wrapper##_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) { \
|
||||
PyObject *tuple = PyTuple_New(d ? 3 : 2); \
|
||||
|
|
@ -88,7 +88,7 @@ wrapper##_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) { \
|
|||
return result; \
|
||||
}
|
||||
|
||||
#define PYSWIG_SSIZEARGFUNC_CLOSURE(wrapper) \
|
||||
#define SWIGPY_SSIZEARGFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a, Py_ssize_t b) { \
|
||||
PyObject *tuple = PyTuple_New(1); \
|
||||
|
|
@ -99,7 +99,7 @@ wrapper##_closure(PyObject *a, Py_ssize_t b) { \
|
|||
return result; \
|
||||
}
|
||||
|
||||
#define PYSWIG_FUNPACK_SSIZEARGFUNC_CLOSURE(wrapper) \
|
||||
#define SWIGPY_FUNPACK_SSIZEARGFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a, Py_ssize_t b) { \
|
||||
PyObject *arg = _PyLong_FromSsize_t(b); \
|
||||
|
|
@ -108,7 +108,7 @@ wrapper##_closure(PyObject *a, Py_ssize_t b) { \
|
|||
return result; \
|
||||
}
|
||||
|
||||
#define PYSWIG_SSIZEOBJARGPROC_CLOSURE(wrapper) \
|
||||
#define SWIGPY_SSIZEOBJARGPROC_CLOSURE(wrapper) \
|
||||
SWIGINTERN int \
|
||||
wrapper##_closure(PyObject *a, Py_ssize_t b, PyObject *c) { \
|
||||
PyObject *tuple = PyTuple_New(2); \
|
||||
|
|
@ -123,7 +123,7 @@ wrapper##_closure(PyObject *a, Py_ssize_t b, PyObject *c) { \
|
|||
return result; \
|
||||
}
|
||||
|
||||
#define PYSWIG_OBJOBJARGPROC_CLOSURE(wrapper) \
|
||||
#define SWIGPY_OBJOBJARGPROC_CLOSURE(wrapper) \
|
||||
SWIGINTERN int \
|
||||
wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
||||
PyObject *tuple = PyTuple_New(c ? 2 : 1); \
|
||||
|
|
@ -141,13 +141,13 @@ wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
|||
return result; \
|
||||
}
|
||||
|
||||
#define PYSWIG_REPRFUNC_CLOSURE(wrapper) \
|
||||
#define SWIGPY_REPRFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a) { \
|
||||
return wrapper(a, NULL); \
|
||||
}
|
||||
|
||||
#define PYSWIG_HASHFUNC_CLOSURE(wrapper) \
|
||||
#define SWIGPY_HASHFUNC_CLOSURE(wrapper) \
|
||||
SWIGINTERN long \
|
||||
wrapper##_closure(PyObject *a) { \
|
||||
PyObject *pyresult = wrapper(a, NULL); \
|
||||
|
|
@ -158,7 +158,7 @@ wrapper##_closure(PyObject *a) { \
|
|||
return result; \
|
||||
}
|
||||
|
||||
#define PYSWIG_ITERNEXT_CLOSURE(wrapper) \
|
||||
#define SWIGPY_ITERNEXT_CLOSURE(wrapper) \
|
||||
SWIGINTERN PyObject * \
|
||||
wrapper##_closure(PyObject *a) { \
|
||||
PyObject *result = wrapper(a, NULL); \
|
||||
|
|
@ -170,13 +170,13 @@ wrapper##_closure(PyObject *a) { \
|
|||
}
|
||||
|
||||
SWIGINTERN int
|
||||
py_builtin_bad_init(PyObject *self, PyObject *args, PyObject *kwds) {
|
||||
SwigPyBuiltin_BadInit(PyObject *self, PyObject *args, PyObject *kwds) {
|
||||
PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
SWIGINTERN void
|
||||
py_builtin_bad_dealloc(PyObject *pyobj) {
|
||||
SwigPyBuiltin_BadDealloc(PyObject *pyobj) {
|
||||
SwigPyObject *sobj = (SwigPyObject *)pyobj;
|
||||
if (sobj->own) {
|
||||
PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", pyobj->ob_type->tp_name);
|
||||
|
|
@ -189,7 +189,7 @@ typedef struct {
|
|||
} SwigPyGetSet;
|
||||
|
||||
SWIGINTERN PyObject *
|
||||
pyswig_getter_closure(PyObject *obj, void *closure) {
|
||||
SwigPyBuiltin_GetterClosure (PyObject *obj, void *closure) {
|
||||
if (!closure)
|
||||
return SWIG_Py_Void();
|
||||
SwigPyGetSet *getset = (SwigPyGetSet *)closure;
|
||||
|
|
@ -203,7 +203,7 @@ pyswig_getter_closure(PyObject *obj, void *closure) {
|
|||
}
|
||||
|
||||
SWIGINTERN PyObject *
|
||||
pyswig_funpack_getter_closure(PyObject *obj, void *closure) {
|
||||
SwigPyBuiltin_FunpackGetterClosure (PyObject *obj, void *closure) {
|
||||
if (!closure)
|
||||
return SWIG_Py_Void();
|
||||
SwigPyGetSet *getset = (SwigPyGetSet *)closure;
|
||||
|
|
@ -214,7 +214,7 @@ pyswig_funpack_getter_closure(PyObject *obj, void *closure) {
|
|||
}
|
||||
|
||||
SWIGINTERN int
|
||||
pyswig_setter_closure(PyObject *obj, PyObject *val, void *closure) {
|
||||
SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) {
|
||||
if (!closure) {
|
||||
PyErr_Format(PyExc_TypeError, "Missing getset closure");
|
||||
return -1;
|
||||
|
|
@ -235,7 +235,7 @@ pyswig_setter_closure(PyObject *obj, PyObject *val, void *closure) {
|
|||
}
|
||||
|
||||
SWIGINTERN int
|
||||
pyswig_funpack_setter_closure(PyObject *obj, PyObject *val, void *closure) {
|
||||
SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) {
|
||||
if (!closure) {
|
||||
PyErr_Format(PyExc_TypeError, "Missing getset closure");
|
||||
return -1;
|
||||
|
|
@ -250,41 +250,6 @@ pyswig_funpack_setter_closure(PyObject *obj, PyObject *val, void *closure) {
|
|||
return result ? 0 : -1;
|
||||
}
|
||||
|
||||
SWIGINTERN PyObject *
|
||||
pyswig_static_getter_closure(PyObject *obj, void *closure) {
|
||||
if (!closure)
|
||||
return SWIG_Py_Void();
|
||||
SwigPyGetSet *getset = (SwigPyGetSet *)closure;
|
||||
if (!getset->get)
|
||||
return SWIG_Py_Void();
|
||||
PyObject *tuple = PyTuple_New(0);
|
||||
assert(tuple);
|
||||
PyObject *result = (*getset->get)(obj, tuple);
|
||||
Py_DECREF(tuple);
|
||||
return result;
|
||||
}
|
||||
|
||||
SWIGINTERN int
|
||||
pyswig_static_setter_closure(PyObject *obj, PyObject *val, void *closure) {
|
||||
if (!closure) {
|
||||
PyErr_Format(PyExc_TypeError, "Missing getset closure");
|
||||
return -1;
|
||||
}
|
||||
SwigPyGetSet *getset = (SwigPyGetSet *)closure;
|
||||
if (!getset->set) {
|
||||
PyErr_Format(PyExc_TypeError, "Illegal static variable assignment.");
|
||||
return -1;
|
||||
}
|
||||
PyObject *tuple = PyTuple_New(1);
|
||||
assert(tuple);
|
||||
PyTuple_SET_ITEM(tuple, 0, val);
|
||||
Py_XINCREF(val);
|
||||
PyObject *result = (*getset->set)(obj, tuple);
|
||||
Py_DECREF(tuple);
|
||||
Py_XDECREF(result);
|
||||
return result ? 0 : -1;
|
||||
}
|
||||
|
||||
SWIGINTERN void
|
||||
SwigPyStaticVar_dealloc(PyDescrObject *descr) {
|
||||
_PyObject_GC_UNTRACK(descr);
|
||||
|
|
@ -296,7 +261,7 @@ SwigPyStaticVar_dealloc(PyDescrObject *descr) {
|
|||
SWIGINTERN PyObject *
|
||||
SwigPyStaticVar_repr(PyGetSetDescrObject *descr) {
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
return PyUnicode_FromFormat("<class attribute '%U' of type '%s'>", descr->d_name, descr->d_type->tp_name);
|
||||
return PyUnicode_FromFormat("<class attribute '%S' of type '%s'>", descr->d_name, descr->d_type->tp_name);
|
||||
#else
|
||||
return PyString_FromFormat("<class attribute '%s' of type '%s'>", PyString_AsString(descr->d_name), descr->d_type->tp_name);
|
||||
#endif
|
||||
|
|
@ -416,19 +381,22 @@ SwigPyStaticVar_new_getset(PyTypeObject *type, PyGetSetDef *getset) {
|
|||
return descr;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <vector>
|
||||
|
||||
SWIGINTERN void
|
||||
pyswig_builtin_init_bases(PyTypeObject *type, std::vector<PyTypeObject *> &bases) {
|
||||
if (!bases.size())
|
||||
bases.push_back(SwigPyObject_type());
|
||||
SwigPyBuiltin_InitBases (PyTypeObject *type, PyTypeObject **bases) {
|
||||
int base_count = 0;
|
||||
PyTypeObject **b;
|
||||
int i;
|
||||
|
||||
if (!bases[0]) {
|
||||
bases[0] = SwigPyObject_type();
|
||||
bases[1] = NULL;
|
||||
}
|
||||
type->tp_base = bases[0];
|
||||
Py_INCREF((PyObject *)bases[0]);
|
||||
PyObject *tuple = PyTuple_New(bases.size());
|
||||
int i;
|
||||
for (i = 0; i < bases.size(); ++i) {
|
||||
for (b = bases; *b != NULL; ++b)
|
||||
++base_count;
|
||||
PyObject *tuple = PyTuple_New(base_count);
|
||||
for (i = 0; i < base_count; ++i) {
|
||||
PyTuple_SET_ITEM(tuple, i, (PyObject *)bases[i]);
|
||||
Py_INCREF((PyObject *)bases[i]);
|
||||
}
|
||||
|
|
@ -436,10 +404,8 @@ pyswig_builtin_init_bases(PyTypeObject *type, std::vector<PyTypeObject *> &bases
|
|||
}
|
||||
|
||||
SWIGINTERN PyObject *
|
||||
pyswig_this_closure(PyObject *self, void *closure) {
|
||||
SwigPyBuiltin_ThisClosure (PyObject *self, void *closure) {
|
||||
PyObject *result = (PyObject *)SWIG_Python_GetSwigThis(self);
|
||||
Py_XINCREF(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
%define %array_class(TYPE,NAME)
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%feature("pyslot", "sq_item", functype="ssizeargfunc") NAME::__getitem__;
|
||||
%feature("pyslot", "sq_ass_item", functype="ssizeobjargproc") NAME::__setitem__;
|
||||
%feature("python:slot", "sq_item", functype="ssizeargfunc") NAME::__getitem__;
|
||||
%feature("python:slot", "sq_ass_item", functype="ssizeobjargproc") NAME::__setitem__;
|
||||
|
||||
%inline %{
|
||||
typedef struct NAME {
|
||||
|
|
|
|||
|
|
@ -460,12 +460,12 @@ namespace Swig {
|
|||
return own;
|
||||
}
|
||||
|
||||
template <typename _Tp>
|
||||
static PyObject* pyobj_disown(PyObject *pyobj, PyObject *SWIGUNUSEDPARM(args))
|
||||
template <typename Type>
|
||||
static PyObject* swig_pyobj_disown(PyObject *pyobj, PyObject *SWIGUNUSEDPARM(args))
|
||||
{
|
||||
SwigPyObject *sobj = (SwigPyObject *)pyobj;
|
||||
sobj->own = 0;
|
||||
Director *d = SWIG_DIRECTOR_CAST(reinterpret_cast<_Tp *>(sobj->ptr));
|
||||
Director *d = SWIG_DIRECTOR_CAST(reinterpret_cast<Type *>(sobj->ptr));
|
||||
if (d)
|
||||
d->swig_disown();
|
||||
return PyWeakref_NewProxy(pyobj, NULL);
|
||||
|
|
|
|||
|
|
@ -587,7 +587,7 @@ namespace swig
|
|||
}
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%feature("pyslot", "tp_iter", functype="getiterfunc") iterator;
|
||||
%feature("python:slot", "tp_iter", functype="getiterfunc") iterator;
|
||||
#else
|
||||
%pythoncode {def __iter__(self): return self.iterator()}
|
||||
#endif
|
||||
|
|
@ -604,8 +604,8 @@ namespace swig
|
|||
%newobject __getslice__;
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%feature("pyslot", "nb_nonzero", functype="inquiry") __nonzero__;
|
||||
%feature("pyslot", "sq_length", functype="lenfunc") __len__;
|
||||
%feature("python:slot", "nb_nonzero", functype="inquiry") __nonzero__;
|
||||
%feature("python:slot", "sq_length", functype="lenfunc") __len__;
|
||||
#endif // SWIGPYTHON_BUILTIN
|
||||
|
||||
%extend {
|
||||
|
|
@ -634,12 +634,12 @@ namespace swig
|
|||
%fragment("SwigPySequence_Base");
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
//%feature("pyslot", "sq_item", functype="ssizeargfunc") __getitem__;
|
||||
//%feature("pyslot", "sq_slice", functype="ssizessizeargfunc") __getslice__;
|
||||
//%feature("pyslot", "sq_ass_item", functype="ssizeobjargproc") __setitem__;
|
||||
//%feature("pyslot", "sq_ass_slice", functype="ssizessizeobjargproc") __setslice__;
|
||||
%feature("pyslot", "mp_subscript", functype="binaryfunc") __getitem__;
|
||||
%feature("pyslot", "mp_ass_subscript", functype="objobjargproc") __setitem__;
|
||||
//%feature("python:slot", "sq_item", functype="ssizeargfunc") __getitem__;
|
||||
//%feature("python:slot", "sq_slice", functype="ssizessizeargfunc") __getslice__;
|
||||
//%feature("python:slot", "sq_ass_item", functype="ssizeobjargproc") __setitem__;
|
||||
//%feature("python:slot", "sq_ass_slice", functype="ssizessizeobjargproc") __setslice__;
|
||||
%feature("python:slot", "mp_subscript", functype="binaryfunc") __getitem__;
|
||||
%feature("python:slot", "mp_ass_subscript", functype="objobjargproc") __setitem__;
|
||||
#endif // SWIGPYTHON_BUILTIN
|
||||
|
||||
%extend {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@
|
|||
%init %{
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <vector>
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
|
@ -241,7 +239,7 @@ SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
|
|||
for (i = 0; constants[i].type; ++i) {
|
||||
switch(constants[i].type) {
|
||||
case SWIG_PY_POINTER:
|
||||
obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
|
||||
obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
|
||||
break;
|
||||
case SWIG_PY_BINARY:
|
||||
obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
|
||||
|
|
@ -340,16 +338,14 @@ SWIG_init(void) {
|
|||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
PyTypeObject *builtin_pytype = 0;
|
||||
#ifdef __cplusplus
|
||||
std::vector<PyTypeObject*> builtin_bases;
|
||||
#endif
|
||||
int builtin_base_count = 0;
|
||||
swig_type_info *builtin_basetype = 0;
|
||||
PyObject *tuple = NULL;
|
||||
PyGetSetDescrObject *static_getset = NULL;
|
||||
|
||||
int i;
|
||||
|
||||
// metatype is used to implement static member variables.
|
||||
/* metatype is used to implement static member variables. */
|
||||
PyObject *metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type);
|
||||
assert(metatype_args);
|
||||
PyTypeObject *metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL);
|
||||
|
|
@ -381,22 +377,29 @@ SWIG_init(void) {
|
|||
SwigPyClientData *cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
|
||||
if (!cd) {
|
||||
SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
|
||||
SwigPyObject_clientdata.pytype = _PySwigObject_type();
|
||||
SwigPyObject_clientdata.pytype = SwigPyObject_TypeOnce();
|
||||
} else if (SwigPyObject_TypeOnce()->tp_basicsize != cd->pytype->tp_basicsize) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
|
||||
# if PY_VERSION_HEX >= 0x03000000
|
||||
return NULL;
|
||||
# else
|
||||
return;
|
||||
# endif
|
||||
}
|
||||
|
||||
// All objects have a 'this' attribute
|
||||
/* All objects have a 'this' attribute */
|
||||
static PyGetSetDef this_getset_def = {
|
||||
const_cast<char *>("this"), pyswig_this_closure, NULL, NULL, NULL
|
||||
(char*) "this", SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
|
||||
};
|
||||
PyObject *this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def);
|
||||
|
||||
// All objects have a 'thisown' attribute
|
||||
/* All objects have a 'thisown' attribute */
|
||||
static SwigPyGetSet thisown_getset_closure = {
|
||||
(PyCFunction) SwigPyObject_own,
|
||||
(PyCFunction) SwigPyObject_own
|
||||
};
|
||||
static PyGetSetDef thisown_getset_def = {
|
||||
const_cast<char*>("thisown"), pyswig_getter_closure, pyswig_setter_closure, NULL, &thisown_getset_closure
|
||||
const_cast<char*>("thisown"), SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
|
||||
};
|
||||
PyObject *thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def);
|
||||
|
||||
|
|
@ -405,9 +408,9 @@ SWIG_init(void) {
|
|||
PyDict_SetItemString(md, "__all__", public_interface);
|
||||
Py_DECREF(public_interface);
|
||||
for (i = 0; SwigMethods[i].ml_name != NULL; ++i)
|
||||
pyswig_add_public_symbol(public_interface, SwigMethods[i].ml_name);
|
||||
SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name);
|
||||
for (i = 0; swig_const_table[i].name != 0; ++i)
|
||||
pyswig_add_public_symbol(public_interface, swig_const_table[i].name);
|
||||
SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name);
|
||||
#endif
|
||||
|
||||
SWIG_InstallConstants(d,swig_const_table);
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ namespace swig {
|
|||
if (!seq)
|
||||
return SWIG_Py_Void();
|
||||
SwigPyIterator *iter = make_output_iterator(seq->begin(), seq->begin(), seq->end(), pyself);
|
||||
return SWIG_NewPointerObj(iter, SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN);
|
||||
return SWIG_InternalNewPointerObj(iter, SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -350,8 +350,8 @@ namespace swig
|
|||
%nodirector SwigPyIterator;
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%feature("tp_iter") SwigPyIterator "&swig::make_output_iterator_builtin";
|
||||
%feature("pyslot", "tp_iternext", functype="iternextfunc") SwigPyIterator::__next__;
|
||||
%feature("python:tp_iter") SwigPyIterator "&swig::make_output_iterator_builtin";
|
||||
%feature("python:slot", "tp_iternext", functype="iternextfunc") SwigPyIterator::__next__;
|
||||
#else
|
||||
%extend SwigPyIterator {
|
||||
%pythoncode {def __iter__(self): return self}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
#ifdef __cplusplus
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
#define %pybinoperator(pyname,oper,functp,slot) %rename(pyname) oper; %pythonmaybecall oper; %feature("pyslot", #slot, functype=#functp) oper; %feature("pyslot", #slot, functype=#functp) pyname;
|
||||
#define %pycompare(pyname,oper,comptype) %rename(pyname) oper; %pythonmaybecall oper; %feature("pycompare", #comptype) oper; %feature("pycompare", #comptype) pyname;
|
||||
#define %pybinoperator(pyname,oper,functp,slt) %rename(pyname) oper; %pythonmaybecall oper; %feature("python:slot", #slt, functype=#functp) oper; %feature("python:slot", #slt, functype=#functp) pyname;
|
||||
#define %pycompare(pyname,oper,comptype) %rename(pyname) oper; %pythonmaybecall oper; %feature("python:compare", #comptype) oper; %feature("python:compare", #comptype) pyname;
|
||||
#else
|
||||
#define %pybinoperator(pyname,oper,functp,slot) %rename(pyname) oper; %pythonmaybecall oper
|
||||
#define %pybinoperator(pyname,oper,functp,slt) %rename(pyname) oper; %pythonmaybecall oper
|
||||
#define %pycompare(pyname,oper,comptype) %pybinoperator(pyname,oper,,comptype)
|
||||
#endif
|
||||
|
||||
|
|
@ -34,13 +34,13 @@
|
|||
%pycompare(__eq__, *::operator==, Py_EQ);
|
||||
%pycompare(__ne__, *::operator!=, Py_NE);
|
||||
|
||||
%feature("pyslot", "nb_truediv", functype="binaryfunc") *::operator/;
|
||||
%feature("python:slot", "nb_truediv", functype="binaryfunc") *::operator/;
|
||||
|
||||
/* Special cases */
|
||||
%rename(__invert__) *::operator~;
|
||||
%feature("pyslot", "nb_invert", functype="unaryfunc") *::operator~;
|
||||
%feature("python:slot", "nb_invert", functype="unaryfunc") *::operator~;
|
||||
%rename(__call__) *::operator();
|
||||
%feature("pyslot", "tp_call", functype="ternaryfunc") *::operator();
|
||||
%feature("python:slot", "tp_call", functype="ternaryfunc") *::operator();
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%pybinoperator(__nonzero__, *::operator bool, inquiry, nb_nonzero);
|
||||
|
|
@ -103,9 +103,9 @@ __bool__ = __nonzero__
|
|||
*/
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
#define %pyinplaceoper(SwigPyOper, Oper, functp, slot) %delobject Oper; %newobject Oper; %feature("pyslot", #slot, functype=#functp) Oper; %rename(SwigPyOper) Oper
|
||||
#define %pyinplaceoper(SwigPyOper, Oper, functp, slt) %delobject Oper; %newobject Oper; %feature("python:slot", #slt, functype=#functp) Oper; %rename(SwigPyOper) Oper
|
||||
#else
|
||||
#define %pyinplaceoper(SwigPyOper, Oper, functp, slot) %delobject Oper; %newobject Oper; %rename(SwigPyOper) Oper
|
||||
#define %pyinplaceoper(SwigPyOper, Oper, functp, slt) %delobject Oper; %newobject Oper; %rename(SwigPyOper) Oper
|
||||
#endif
|
||||
|
||||
%pyinplaceoper(__iadd__ , *::operator +=, binaryfunc, nb_inplace_add);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,15 @@
|
|||
#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
|
||||
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
|
||||
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
|
||||
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags)
|
||||
|
||||
#ifdef SWIGPYTHON_BUILTIN
|
||||
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags)
|
||||
#else
|
||||
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
|
||||
#endif
|
||||
|
||||
#define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
|
||||
|
||||
#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
|
||||
#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
|
||||
#define swig_owntype int
|
||||
|
|
@ -28,7 +36,7 @@
|
|||
|
||||
/* for C or C++ function pointers */
|
||||
#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
|
||||
#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0)
|
||||
#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
|
||||
|
||||
/* for C++ member pointers, ie, member methods */
|
||||
#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
|
||||
|
|
@ -74,7 +82,7 @@ SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
|
|||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
|
||||
SWIGINTERN void
|
||||
pyswig_add_public_symbol(PyObject *seq, const char *key) {
|
||||
SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
|
||||
PyObject *s = PyString_InternFromString(key);
|
||||
PyList_Append(seq, s);
|
||||
Py_DECREF(s);
|
||||
|
|
@ -85,7 +93,7 @@ SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *nam
|
|||
PyDict_SetItemString(d, (char *)name, obj);
|
||||
Py_DECREF(obj);
|
||||
if (public_interface)
|
||||
pyswig_add_public_symbol(public_interface, name);
|
||||
SwigPyBuiltin_AddPublicSymbol(public_interface, name);
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
@ -210,6 +218,9 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
|
|||
|
||||
#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
|
||||
|
||||
#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
|
||||
#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#if 0
|
||||
|
|
@ -478,7 +489,7 @@ SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
|
|||
}
|
||||
|
||||
|
||||
SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
|
||||
SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void);
|
||||
|
||||
#ifdef SWIGPYTHON_BUILTIN
|
||||
static swig_type_info *SwigPyObject_stype = 0;
|
||||
|
|
@ -493,7 +504,7 @@ SwigPyObject_type(void) {
|
|||
#else
|
||||
SWIGRUNTIME PyTypeObject*
|
||||
SwigPyObject_type(void) {
|
||||
static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
|
||||
static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
|
||||
return type;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -675,7 +686,7 @@ SwigPyObject_getattr(SwigPyObject *sobj,char *name)
|
|||
#endif
|
||||
|
||||
SWIGRUNTIME PyTypeObject*
|
||||
_PySwigObject_type(void) {
|
||||
SwigPyObject_TypeOnce(void) {
|
||||
static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
|
||||
|
||||
static PyNumberMethods SwigPyObject_as_number = {
|
||||
|
|
@ -876,17 +887,17 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
|
|||
return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
|
||||
}
|
||||
|
||||
SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
|
||||
SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void);
|
||||
|
||||
SWIGRUNTIME PyTypeObject*
|
||||
SwigPyPacked_type(void) {
|
||||
static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
|
||||
static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
|
||||
return type;
|
||||
}
|
||||
|
||||
SWIGRUNTIMEINLINE int
|
||||
SwigPyPacked_Check(PyObject *op) {
|
||||
return ((op)->ob_type == _PySwigPacked_type())
|
||||
return ((op)->ob_type == SwigPyPacked_TypeOnce())
|
||||
|| (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
|
||||
}
|
||||
|
||||
|
|
@ -901,7 +912,7 @@ SwigPyPacked_dealloc(PyObject *v)
|
|||
}
|
||||
|
||||
SWIGRUNTIME PyTypeObject*
|
||||
_PySwigPacked_type(void) {
|
||||
SwigPyPacked_TypeOnce(void) {
|
||||
static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
|
||||
static PyTypeObject swigpypacked_type;
|
||||
static int type_init = 0;
|
||||
|
|
@ -1044,6 +1055,8 @@ SWIG_This(void)
|
|||
SWIGRUNTIME SwigPyObject *
|
||||
SWIG_Python_GetSwigThis(PyObject *pyobj)
|
||||
{
|
||||
PyObject *obj;
|
||||
|
||||
if (SwigPyObject_Check(pyobj))
|
||||
return (SwigPyObject *) pyobj;
|
||||
|
||||
|
|
@ -1058,7 +1071,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
|
|||
return NULL;
|
||||
#endif
|
||||
|
||||
PyObject *obj = 0;
|
||||
obj = 0;
|
||||
|
||||
#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
|
||||
if (PyInstance_Check(pyobj)) {
|
||||
|
|
@ -1120,92 +1133,95 @@ SWIG_Python_AcquirePtr(PyObject *obj, int own) {
|
|||
|
||||
SWIGRUNTIME int
|
||||
SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
|
||||
if (!obj) return SWIG_ERROR;
|
||||
if (obj == Py_None) {
|
||||
int res;
|
||||
SwigPyObject *sobj;
|
||||
|
||||
if (!obj) return SWIG_ERROR;
|
||||
if (obj == Py_None) {
|
||||
if (ptr) *ptr = 0;
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
int res = SWIG_ERROR;
|
||||
res = SWIG_ERROR;
|
||||
|
||||
SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
|
||||
if (own)
|
||||
*own = 0;
|
||||
while (sobj) {
|
||||
void *vptr = sobj->ptr;
|
||||
if (ty) {
|
||||
swig_type_info *to = sobj->ty;
|
||||
if (to == ty) {
|
||||
/* no type cast needed */
|
||||
if (ptr) *ptr = vptr;
|
||||
break;
|
||||
} else {
|
||||
swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
|
||||
if (!tc) {
|
||||
sobj = (SwigPyObject *)sobj->next;
|
||||
} else {
|
||||
if (ptr) {
|
||||
int newmemory = 0;
|
||||
*ptr = SWIG_TypeCast(tc,vptr,&newmemory);
|
||||
if (newmemory == SWIG_CAST_NEW_MEMORY) {
|
||||
assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
|
||||
if (own)
|
||||
*own = *own | SWIG_CAST_NEW_MEMORY;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sobj = SWIG_Python_GetSwigThis(obj);
|
||||
if (own)
|
||||
*own = 0;
|
||||
while (sobj) {
|
||||
void *vptr = sobj->ptr;
|
||||
if (ty) {
|
||||
swig_type_info *to = sobj->ty;
|
||||
if (to == ty) {
|
||||
/* no type cast needed */
|
||||
if (ptr) *ptr = vptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sobj) {
|
||||
if (own)
|
||||
*own = *own | sobj->own;
|
||||
if (flags & SWIG_POINTER_DISOWN) {
|
||||
sobj->own = 0;
|
||||
}
|
||||
res = SWIG_OK;
|
||||
} else {
|
||||
if (flags & SWIG_POINTER_IMPLICIT_CONV) {
|
||||
SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
|
||||
if (data && !data->implicitconv) {
|
||||
PyObject *klass = data->klass;
|
||||
if (klass) {
|
||||
PyObject *impconv;
|
||||
data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
|
||||
impconv = SWIG_Python_CallFunctor(klass, obj);
|
||||
data->implicitconv = 0;
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_Clear();
|
||||
impconv = 0;
|
||||
} else {
|
||||
swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
|
||||
if (!tc) {
|
||||
sobj = (SwigPyObject *)sobj->next;
|
||||
} else {
|
||||
if (ptr) {
|
||||
int newmemory = 0;
|
||||
*ptr = SWIG_TypeCast(tc,vptr,&newmemory);
|
||||
if (newmemory == SWIG_CAST_NEW_MEMORY) {
|
||||
assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
|
||||
if (own)
|
||||
*own = *own | SWIG_CAST_NEW_MEMORY;
|
||||
}
|
||||
if (impconv) {
|
||||
SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
|
||||
if (iobj) {
|
||||
void *vptr;
|
||||
res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (ptr) {
|
||||
*ptr = vptr;
|
||||
/* transfer the ownership to 'ptr' */
|
||||
iobj->own = 0;
|
||||
res = SWIG_AddCast(res);
|
||||
res = SWIG_AddNewMask(res);
|
||||
} else {
|
||||
res = SWIG_AddCast(res);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (ptr) *ptr = vptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sobj) {
|
||||
if (own)
|
||||
*own = *own | sobj->own;
|
||||
if (flags & SWIG_POINTER_DISOWN) {
|
||||
sobj->own = 0;
|
||||
}
|
||||
res = SWIG_OK;
|
||||
} else {
|
||||
if (flags & SWIG_POINTER_IMPLICIT_CONV) {
|
||||
SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
|
||||
if (data && !data->implicitconv) {
|
||||
PyObject *klass = data->klass;
|
||||
if (klass) {
|
||||
PyObject *impconv;
|
||||
data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
|
||||
impconv = SWIG_Python_CallFunctor(klass, obj);
|
||||
data->implicitconv = 0;
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_Clear();
|
||||
impconv = 0;
|
||||
}
|
||||
if (impconv) {
|
||||
SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
|
||||
if (iobj) {
|
||||
void *vptr;
|
||||
res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (ptr) {
|
||||
*ptr = vptr;
|
||||
/* transfer the ownership to 'ptr' */
|
||||
iobj->own = 0;
|
||||
res = SWIG_AddCast(res);
|
||||
res = SWIG_AddNewMask(res);
|
||||
} else {
|
||||
res = SWIG_AddCast(res);
|
||||
}
|
||||
}
|
||||
Py_DECREF(impconv);
|
||||
}
|
||||
Py_DECREF(impconv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Convert a function ptr value */
|
||||
|
|
@ -1375,14 +1391,30 @@ SWIG_Python_InitShadowInstance(PyObject *args) {
|
|||
/* Create a new pointer object */
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
|
||||
SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
|
||||
SwigPyClientData *clientdata;
|
||||
PyObject * robj;
|
||||
int own;
|
||||
|
||||
if (!ptr)
|
||||
return SWIG_Py_Void();
|
||||
|
||||
SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
|
||||
int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
|
||||
clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
|
||||
own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
|
||||
if (clientdata && clientdata->pytype) {
|
||||
SwigPyObject *newobj = PyObject_New(SwigPyObject, clientdata->pytype);
|
||||
SwigPyObject *newobj;
|
||||
if (flags & SWIG_BUILTIN_TP_INIT) {
|
||||
newobj = (SwigPyObject*) self;
|
||||
if (newobj->ptr) {
|
||||
PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
|
||||
while (newobj->next)
|
||||
newobj = (SwigPyObject *) newobj->next;
|
||||
newobj->next = next_self;
|
||||
newobj = (SwigPyObject *)next_self;
|
||||
}
|
||||
} else {
|
||||
newobj = PyObject_New(SwigPyObject, clientdata->pytype);
|
||||
}
|
||||
if (newobj) {
|
||||
newobj->ptr = ptr;
|
||||
newobj->ty = type;
|
||||
|
|
@ -1396,7 +1428,9 @@ SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
|
|||
return SWIG_Py_Void();
|
||||
}
|
||||
|
||||
PyObject *robj = SwigPyObject_New(ptr, type, own);
|
||||
assert(!(flags & SWIG_BUILTIN_TP_INIT));
|
||||
|
||||
robj = SwigPyObject_New(ptr, type, own);
|
||||
if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
|
||||
PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
|
||||
if (inst) {
|
||||
|
|
@ -1414,6 +1448,7 @@ SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
|
|||
return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
|
||||
}
|
||||
|
||||
/*
|
||||
SWIGRUNTIME int
|
||||
SWIG_Python_NewBuiltinObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
|
||||
assert(self);
|
||||
|
|
@ -1437,6 +1472,7 @@ SWIG_Python_NewBuiltinObj(PyObject *self, void *ptr, swig_type_info *type, int f
|
|||
#endif
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
/* -----------------------------------------------------------------------------*
|
||||
* Get type list
|
||||
|
|
@ -1671,7 +1707,6 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
|
|||
return result;
|
||||
}
|
||||
|
||||
// Cribbed from Objects/object.c in the python source code and modified
|
||||
SWIGRUNTIME int
|
||||
SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
|
||||
PyTypeObject *tp = obj->ob_type;
|
||||
|
|
|
|||
|
|
@ -10,4 +10,7 @@
|
|||
%insert(runtime) "pythreads.swg"; /* Python thread code */
|
||||
%insert(runtime) "pyapi.swg"; /* Python API */
|
||||
%insert(runtime) "pyrun.swg"; /* Python run-time code */
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%insert(runtime) "builtin.swg"; /* Specialization for classes with single inheritance */
|
||||
#endif
|
||||
|
|
@ -6,7 +6,7 @@ namespace swig {
|
|||
*/
|
||||
template <class Type> struct traits_from_ptr {
|
||||
static PyObject *from(Type *val, int owner = 0) {
|
||||
return SWIG_NewPointerObj(val, type_info<Type>(), owner);
|
||||
return SWIG_InternalNewPointerObj(val, type_info<Type>(), owner);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
|
|||
if (size > INT_MAX) {
|
||||
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
|
||||
return pchar_descriptor ?
|
||||
SWIG_NewPointerObj(%const_cast(carray,char *), pchar_descriptor, 0) : SWIG_Py_Void();
|
||||
SWIG_InternalNewPointerObj(%const_cast(carray,char *), pchar_descriptor, 0) : SWIG_Py_Void();
|
||||
} else {
|
||||
%#if PY_VERSION_HEX >= 0x03000000
|
||||
return PyUnicode_FromStringAndSize(carray, %numeric_cast(size,int));
|
||||
|
|
|
|||
|
|
@ -88,9 +88,11 @@
|
|||
$result = SWIG_NewPointerObj(%new_copy(*$1, $*ltype), $descriptor, SWIG_POINTER_OWN | %newpointer_flags);
|
||||
}
|
||||
|
||||
/*
|
||||
%typemap(builtin_init,noblock=1) const SWIGTYPE & SMARTPOINTER {
|
||||
$result = SWIG_NewBuiltinObj(self, %new_copy(*$1, $*ltype), $descriptor, SWIG_POINTER_OWN | %newpointer_flags);
|
||||
}
|
||||
*/
|
||||
|
||||
%typemap(ret,noblock=1) const SWIGTYPE & SMARTPOINTER, SWIGTYPE SMARTPOINTER {
|
||||
if ($result) {
|
||||
|
|
@ -108,15 +110,19 @@
|
|||
* ------------------------------------------------------------ */
|
||||
|
||||
/* Pointers, references */
|
||||
/*
|
||||
%typemap(builtin_init,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE[] {
|
||||
%set_output(SWIG_Python_NewBuiltinObj(self, %as_voidptr($1), $descriptor, $owner | %newpointer_flags));
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
%typemap(builtin_init, noblock=1) SWIGTYPE *const& {
|
||||
%set_output(SWIG_Python_NewBuiltinObj(self, %as_voidptr(*$1), $*descriptor, $owner | %newpointer_flags));
|
||||
}
|
||||
|
||||
*/
|
||||
/* Return by value */
|
||||
/*
|
||||
%typemap(builtin_init, noblock=1) SWIGTYPE {
|
||||
%set_output(SWIG_Python_NewBuiltinObj(self, %new_copy($1, $ltype), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags));
|
||||
%set_output(SWIG_Python_NewBuiltinObj(self, %new_copy($1, $ltype), $&descriptor, $owner | %newpointer_flags));
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ SWIG_FromWCharPtrAndSize(const wchar_t * carray, size_t size)
|
|||
if (size > INT_MAX) {
|
||||
swig_type_info* pwchar_descriptor = SWIG_pwchar_descriptor();
|
||||
return pwchar_descriptor ?
|
||||
SWIG_NewPointerObj(%const_cast(carray,wchar_t *), pwchar_descriptor, 0) : SWIG_Py_Void();
|
||||
SWIG_InternalNewPointerObj(%const_cast(carray,wchar_t *), pwchar_descriptor, 0) : SWIG_Py_Void();
|
||||
} else {
|
||||
return PyUnicode_FromWideChar(carray, %numeric_cast(size,int));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
static PyObject *from(const map_type& map) {
|
||||
swig_type_info *desc = swig::type_info<map_type>();
|
||||
if (desc && desc->clientdata) {
|
||||
return SWIG_NewPointerObj(new map_type(map), desc, SWIG_POINTER_OWN);
|
||||
return SWIG_InternalNewPointerObj(new map_type(map), desc, SWIG_POINTER_OWN);
|
||||
} else {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
size_type size = map.size();
|
||||
|
|
@ -127,7 +127,7 @@
|
|||
if (!seq)
|
||||
return SWIG_Py_Void();
|
||||
SwigPyIterator *iter = make_output_key_iterator(seq->begin(), seq->begin(), seq->end(), pyself);
|
||||
return SWIG_NewPointerObj(iter, SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN);
|
||||
return SWIG_InternalNewPointerObj(iter, SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN);
|
||||
}
|
||||
|
||||
template<class OutIterator,
|
||||
|
|
@ -156,9 +156,9 @@
|
|||
%swig_container_methods(Map)
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%feature("pyslot", "mp_length", functype="lenfunc") __len__;
|
||||
%feature("pyslot", "mp_subscript", functype="binaryfunc") __getitem__;
|
||||
%feature("pyslot", "tp_iter", functype="getiterfunc") key_iterator;
|
||||
%feature("python:slot", "mp_length", functype="lenfunc") __len__;
|
||||
%feature("python:slot", "mp_subscript", functype="binaryfunc") __getitem__;
|
||||
%feature("python:slot", "tp_iter", functype="getiterfunc") key_iterator;
|
||||
|
||||
%extend {
|
||||
%newobject iterkeys(PyObject **PYTHON_SELF);
|
||||
|
|
@ -287,7 +287,7 @@
|
|||
%swig_map_common(Map)
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%feature("pyslot", "mp_ass_subscript", functype="objobjargproc") __setitem__;
|
||||
%feature("python:slot", "mp_ass_subscript", functype="objobjargproc") __setitem__;
|
||||
#endif
|
||||
|
||||
%extend {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
static PyObject *from(const multimap_type& multimap) {
|
||||
swig_type_info *desc = swig::type_info<multimap_type>();
|
||||
if (desc && desc->clientdata) {
|
||||
return SWIG_NewPointerObj(new multimap_type(multimap), desc, SWIG_POINTER_OWN);
|
||||
return SWIG_InternalNewPointerObj(new multimap_type(multimap), desc, SWIG_POINTER_OWN);
|
||||
} else {
|
||||
size_type size = multimap.size();
|
||||
int pysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
|
||||
|
|
|
|||
|
|
@ -127,12 +127,10 @@ SwigPython_std_pair_len (PyObject *a)
|
|||
SWIGINTERN PyObject*
|
||||
SwigPython_std_pair_repr (PyObject *o)
|
||||
{
|
||||
static PyObject *first = PyString_FromString("first");
|
||||
static PyObject *second = PyString_FromString("second");
|
||||
PyObject *tuple = PyTuple_New(2);
|
||||
assert(tuple);
|
||||
PyTuple_SET_ITEM(tuple, 0, PyObject_GetAttr(o, first));
|
||||
PyTuple_SET_ITEM(tuple, 1, PyObject_GetAttr(o, second));
|
||||
PyTuple_SET_ITEM(tuple, 0, PyObject_GetAttrString(o, "first"));
|
||||
PyTuple_SET_ITEM(tuple, 1, PyObject_GetAttrString(o, "second"));
|
||||
PyObject *result = PyObject_Repr(tuple);
|
||||
Py_DECREF(tuple);
|
||||
return result;
|
||||
|
|
@ -141,45 +139,39 @@ SwigPython_std_pair_repr (PyObject *o)
|
|||
SWIGINTERN PyObject*
|
||||
SwigPython_std_pair_getitem (PyObject *a, Py_ssize_t b)
|
||||
{
|
||||
static PyObject *first = PyString_FromString("first");
|
||||
static PyObject *second = PyString_FromString("second");
|
||||
PyObject *attr_name = b % 2 ? second : first;
|
||||
PyObject *result = PyObject_GetAttr(a, attr_name);
|
||||
PyObject *result = PyObject_GetAttrString(a, b % 2 ? "second" : "first");
|
||||
return result;
|
||||
}
|
||||
|
||||
SWIGINTERN int
|
||||
SwigPython_std_pair_setitem (PyObject *a, Py_ssize_t b, PyObject *c)
|
||||
{
|
||||
static PyObject *first = PyString_FromString("first");
|
||||
static PyObject *second = PyString_FromString("second");
|
||||
PyObject *attr_name = b % 2 ? second : first;
|
||||
int result = PyObject_SetAttr(a, attr_name, c);
|
||||
int result = PyObject_SetAttrString(a, b % 2 ? "second" : "first", c);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
%feature("sq_length") std::pair "SwigPython_std_pair_len";
|
||||
%feature("sq_length") std::pair<T*,U> "SwigPython_std_pair_len";
|
||||
%feature("sq_length") std::pair<T,U*> "SwigPython_std_pair_len";
|
||||
%feature("sq_length") std::pair<T*,U*> "SwigPython_std_pair_len";
|
||||
%feature("python:sq_length") std::pair "SwigPython_std_pair_len";
|
||||
%feature("python:sq_length") std::pair<T*,U> "SwigPython_std_pair_len";
|
||||
%feature("python:sq_length") std::pair<T,U*> "SwigPython_std_pair_len";
|
||||
%feature("python:sq_length") std::pair<T*,U*> "SwigPython_std_pair_len";
|
||||
|
||||
%feature("tp_repr") std::pair "SwigPython_std_pair_repr";
|
||||
%feature("tp_repr") std::pair<T*,U> "SwigPython_std_pair_repr";
|
||||
%feature("tp_repr") std::pair<T,U*> "SwigPython_std_pair_repr";
|
||||
%feature("tp_repr") std::pair<T*,U*> "SwigPython_std_pair_repr";
|
||||
%feature("python:tp_repr") std::pair "SwigPython_std_pair_repr";
|
||||
%feature("python:tp_repr") std::pair<T*,U> "SwigPython_std_pair_repr";
|
||||
%feature("python:tp_repr") std::pair<T,U*> "SwigPython_std_pair_repr";
|
||||
%feature("python:tp_repr") std::pair<T*,U*> "SwigPython_std_pair_repr";
|
||||
|
||||
%feature("sq_item") std::pair "SwigPython_std_pair_getitem";
|
||||
%feature("sq_item") std::pair<T*,U> "SwigPython_std_pair_getitem";
|
||||
%feature("sq_item") std::pair<T,U*> "SwigPython_std_pair_getitem";
|
||||
%feature("sq_item") std::pair<T*,U*> "SwigPython_std_pair_getitem";
|
||||
%feature("python:sq_item") std::pair "SwigPython_std_pair_getitem";
|
||||
%feature("python:sq_item") std::pair<T*,U> "SwigPython_std_pair_getitem";
|
||||
%feature("python:sq_item") std::pair<T,U*> "SwigPython_std_pair_getitem";
|
||||
%feature("python:sq_item") std::pair<T*,U*> "SwigPython_std_pair_getitem";
|
||||
|
||||
%feature("sq_ass_item") std::pair "SwigPython_std_pair_setitem";
|
||||
%feature("sq_ass_item") std::pair<T*,U> "SwigPython_std_pair_setitem";
|
||||
%feature("sq_ass_item") std::pair<T,U*> "SwigPython_std_pair_setitem";
|
||||
%feature("sq_ass_item") std::pair<T*,U*> "SwigPython_std_pair_setitem";
|
||||
%feature("python:sq_ass_item") std::pair "SwigPython_std_pair_setitem";
|
||||
%feature("python:sq_ass_item") std::pair<T*,U> "SwigPython_std_pair_setitem";
|
||||
%feature("python:sq_ass_item") std::pair<T,U*> "SwigPython_std_pair_setitem";
|
||||
%feature("python:sq_ass_item") std::pair<T*,U*> "SwigPython_std_pair_setitem";
|
||||
|
||||
%define %swig_pair_methods(pair...)
|
||||
#if !defined(SWIGPYTHON_BUILTIN)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue