mirror of https://github.com/swig/swig
Commited SF#2158938: change all SWIG symbols start with Py to a new name.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10961 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
1c4ec59e45
commit
8f84447860
|
@ -1,6 +1,38 @@
|
|||
Version 1.3.37 (in progress)
|
||||
============================
|
||||
|
||||
2008-12-04: bhy
|
||||
[Python] Applied patch SF#2158938: all the SWIG symbol names started with Py
|
||||
are changed, since they are inappropriate and discouraged in Python
|
||||
documentation (from http://www.python.org/doc/2.5.2/api/includes.html):
|
||||
|
||||
"All user visible names defined by Python.h (except those defined by
|
||||
the included standard headers) have one of the prefixes "Py" or "_Py".
|
||||
Names beginning with "_Py" are for internal use by the Python implementation
|
||||
and should not be used by extension writers. Structure member names do
|
||||
not have a reserved prefix.
|
||||
|
||||
Important: user code should never define names that begin with "Py" or "_Py".
|
||||
This confuses the reader, and jeopardizes the portability of the user
|
||||
code to future Python versions, which may define additional names beginning
|
||||
with one of these prefixes."
|
||||
|
||||
Here is a brief list of what changed:
|
||||
|
||||
PySwig* -> SwigPy*
|
||||
PyObject_ptr -> SwigPtr_PyObject
|
||||
PyObject_var -> SwigVar_PyObject
|
||||
PySequence_Base, PySequence_Cont, PySequence_Ref ->
|
||||
SwigPySequence_Base, SwigPySequence_Cont, SwigPySequence_Ref
|
||||
PyMap* -> SwigPyMap*
|
||||
|
||||
We provided a pyname_compat.i for backward compatibility. Users whose code having
|
||||
these symbols and do not want to change it could simply include this file
|
||||
at front of your code. A better solution is to run the converting tool on
|
||||
your code, which has been put in SWIG's SVN trunk (Tools/pyname_patch.py) and
|
||||
you can download it here:
|
||||
https://swig.svn.sourceforge.net/svnroot/swig/trunk/Tools/pyname_patch.py
|
||||
|
||||
2008-12-02: wsfulton
|
||||
[Python] Apply patch #2143727 from Serge Monkewitz to fix importing base classes
|
||||
when the package option is specified in %module and that module is %import'ed.
|
||||
|
|
|
@ -23,5 +23,5 @@ namespace std {
|
|||
%template(halfi) half_map<std::string,int>;
|
||||
|
||||
|
||||
%template() std::pair<swig::PyObject_ptr, swig::PyObject_ptr>;
|
||||
%template(pymap) std::map<swig::PyObject_ptr, swig::PyObject_ptr>;
|
||||
%template() std::pair<swig::SwigPtr_PyObject, swig::SwigPtr_PyObject>;
|
||||
%template(pymap) std::map<swig::SwigPtr_PyObject, swig::SwigPtr_PyObject>;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*
|
||||
* For example:
|
||||
* swig::LANGUAGE_OBJ is GC_VALUE in Ruby
|
||||
* swig::LANGUAGE_OBJ is PyObject_ptr in python
|
||||
* swig::LANGUAGE_OBJ is SwigPtr_PyObject in python
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
@ -53,8 +53,8 @@ namespace std
|
|||
#endif
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%template() pair<swig::PyObject_ptr, swig::PyObject_ptr>;
|
||||
%template(pymap) map<swig::PyObject_ptr, swig::PyObject_ptr>;
|
||||
%template() pair<swig::SwigPtr_PyObject, swig::SwigPtr_PyObject>;
|
||||
%template(pymap) map<swig::SwigPtr_PyObject, swig::SwigPtr_PyObject>;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*
|
||||
* For example:
|
||||
* swig::LANGUAGE_OBJ is GC_VALUE in Ruby
|
||||
* swig::LANGUAGE_OBJ is PyObject_ptr in python
|
||||
* swig::LANGUAGE_OBJ is SwigPtr_PyObject in python
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
@ -36,5 +36,5 @@
|
|||
#endif
|
||||
|
||||
#if defined(SWIGPYTHON)
|
||||
%template(pyset) std::set<swig::PyObject_ptr>;
|
||||
%template(pyset) std::set<swig::SwigPtr_PyObject>;
|
||||
#endif
|
||||
|
|
|
@ -129,7 +129,7 @@ std::vector<std::string> vecStr(std::vector<std::string> v) {
|
|||
int extractInt(int *p) { return *p; }
|
||||
%}
|
||||
|
||||
%template(pyvector) std::vector<swig::PyObject_ptr>;
|
||||
%template(pyvector) std::vector<swig::SwigPtr_PyObject>;
|
||||
|
||||
namespace std {
|
||||
%template(ConstShortVector) vector<const short *>;
|
||||
|
|
|
@ -204,7 +204,7 @@ namespace swig
|
|||
|
||||
operator T () const
|
||||
{
|
||||
// swig::PyObject_var item = OctSequence_GetItem(_seq, _index);
|
||||
// swig::SwigVar_PyObject item = OctSequence_GetItem(_seq, _index);
|
||||
octave_value item; // * todo
|
||||
try {
|
||||
return swig::as<T>(item, true);
|
||||
|
@ -410,7 +410,7 @@ namespace swig
|
|||
{
|
||||
int s = size();
|
||||
for (int i = 0; i < s; ++i) {
|
||||
// swig::PyObject_var item = OctSequence_GetItem(_seq, i);
|
||||
// swig::SwigVar_PyObject item = OctSequence_GetItem(_seq, i);
|
||||
octave_value item; // * todo
|
||||
if (!swig::check<value_type>(item)) {
|
||||
if (set_err) {
|
||||
|
@ -453,7 +453,7 @@ namespace swig
|
|||
$result = Cell(tmpc);
|
||||
}
|
||||
|
||||
%fragment("PyPairBoolOutputIterator","header",fragment=SWIG_From_frag(bool),fragment="OctSequence_Cont") {}
|
||||
%fragment("SwigPyPairBoolOutputIterator","header",fragment=SWIG_From_frag(bool),fragment="OctSequence_Cont") {}
|
||||
|
||||
%typemap(out,fragment="OctPairBoolOutputIterator")
|
||||
std::pair<iterator, bool>, std::pair<const_iterator, bool> {
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace swig {
|
|||
|
||||
%extend std::carray {
|
||||
%fragment(SWIG_Traits_frag(std::carray<_Type, _Size >), "header",
|
||||
fragment="PySwigIterator_T",
|
||||
fragment="SwigPyIterator_T",
|
||||
fragment=SWIG_Traits_frag(_Type),
|
||||
fragment="StdCarrayTraits") {
|
||||
namespace swig {
|
||||
|
@ -36,7 +36,7 @@ namespace swig {
|
|||
|
||||
%typemap(out,noblock=1) iterator, const_iterator {
|
||||
$result = SWIG_NewPointerObj(swig::make_output_iterator((const $type &)$1),
|
||||
swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
|
||||
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
|
||||
}
|
||||
|
||||
inline size_t __len__() const { return self->size(); }
|
||||
|
@ -46,7 +46,7 @@ namespace swig {
|
|||
inline void __setitem__(size_t i, const _Type& v) { (*self)[i] = v; }
|
||||
|
||||
|
||||
swig::PySwigIterator* __iter__(PyObject **PYTHON_SELF) {
|
||||
swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) {
|
||||
return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/*
|
||||
int res = SWIG_ERROR;
|
||||
if (PyDict_Check(obj)) {
|
||||
PyObject_var items = PyObject_CallMethod(obj,(char *)"items",NULL);
|
||||
SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
|
||||
res = traits_asptr_stdseq<std::map<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||
} else {
|
||||
map_type *p;
|
||||
|
@ -58,8 +58,8 @@
|
|||
}
|
||||
PyObject *obj = PyDict_New();
|
||||
for (const_iterator i= map.begin(); i!= map.end(); ++i) {
|
||||
swig::PyObject_var key = swig::from(i->first);
|
||||
swig::PyObject_var val = swig::from(i->second);
|
||||
swig::SwigVar_PyObject key = swig::from(i->first);
|
||||
swig::SwigVar_PyObject val = swig::from(i->second);
|
||||
PyDict_SetItem(obj, key, val);
|
||||
}
|
||||
return obj;
|
||||
|
@ -92,10 +92,10 @@
|
|||
};
|
||||
|
||||
template<class OutIterator, class FromOper, class ValueType = typename OutIterator::value_type>
|
||||
struct OctMapIterator_T : PySwigIteratorClosed_T<OutIterator, ValueType, FromOper>
|
||||
struct OctMapIterator_T : SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper>
|
||||
{
|
||||
OctMapIterator_T(OutIterator curr, OutIterator first, OutIterator last, octave_value seq)
|
||||
: PySwigIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
|
||||
: SwigPyIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
@ -112,7 +112,7 @@
|
|||
};
|
||||
|
||||
template<typename OutIter>
|
||||
inline PySwigIterator*
|
||||
inline SwigPyIterator*
|
||||
make_output_key_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, octave_value seq = octave_value())
|
||||
{
|
||||
return new OctMapKeyIterator_T<OutIter>(current, begin, end, seq);
|
||||
|
@ -130,7 +130,7 @@
|
|||
|
||||
|
||||
template<typename OutIter>
|
||||
inline PySwigIterator*
|
||||
inline SwigPyIterator*
|
||||
make_output_value_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, octave_value seq = 0)
|
||||
{
|
||||
return new OctMapValueIterator_T<OutIter>(current, begin, end, seq);
|
||||
|
|
|
@ -1,55 +1,55 @@
|
|||
#ifdef __cplusplus
|
||||
|
||||
/*
|
||||
PyObject_ptr is used as a replacement of PyObject *, where
|
||||
SwigPtr_PyObject is used as a replacement of PyObject *, where
|
||||
the INCREF/DECREF are applied as needed.
|
||||
|
||||
You can use PyObject_ptr in a container, such as
|
||||
You can use SwigPtr_PyObject in a container, such as
|
||||
|
||||
std::vector<PyObject_ptr>;
|
||||
std::vector<SwigPtr_PyObject>;
|
||||
|
||||
or as a member variable:
|
||||
|
||||
struct A {
|
||||
PyObject_ptr obj;
|
||||
SwigPtr_PyObject obj;
|
||||
A(PyObject *o) : _obj(o) {
|
||||
}
|
||||
};
|
||||
|
||||
or as a input/output value
|
||||
|
||||
PyObject_ptr func(PyObject_ptr obj) {
|
||||
PyObject_ptr out = PyString_FromFormat("hello %s", PyObject_AsString(obj));
|
||||
SwigPtr_PyObject func(SwigPtr_PyObject obj) {
|
||||
SwigPtr_PyObject out = PyString_FromFormat("hello %s", PyObject_AsString(obj));
|
||||
Py_DECREF(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
just remember to pair the object creation with the proper DECREF,
|
||||
the same as with plain PyObject *ptr, since PyObject_ptr always add
|
||||
the same as with plain PyObject *ptr, since SwigPtr_PyObject always add
|
||||
one reference at construction.
|
||||
|
||||
PyObject_ptr is 'visible' at the wrapped side, so you can do:
|
||||
SwigPtr_PyObject is 'visible' at the wrapped side, so you can do:
|
||||
|
||||
|
||||
%template(pyvector) std::vector<swig::PyObject_ptr>;
|
||||
%template(pyvector) std::vector<swig::SwigPtr_PyObject>;
|
||||
|
||||
and all the proper typemaps will be used.
|
||||
|
||||
*/
|
||||
|
||||
namespace swig {
|
||||
%ignore PyObject_ptr;
|
||||
struct PyObject_ptr {};
|
||||
%apply PyObject * {PyObject_ptr};
|
||||
%apply PyObject * const& {PyObject_ptr const&};
|
||||
%ignore SwigPtr_PyObject;
|
||||
struct SwigPtr_PyObject {};
|
||||
%apply PyObject * {SwigPtr_PyObject};
|
||||
%apply PyObject * const& {SwigPtr_PyObject const&};
|
||||
|
||||
/* For output */
|
||||
%typemap(out,noblock=1) PyObject_ptr {
|
||||
%typemap(out,noblock=1) SwigPtr_PyObject {
|
||||
$result = (PyObject *)$1;
|
||||
Py_INCREF($result);
|
||||
}
|
||||
|
||||
%typemap(out,noblock=1) PyObject_ptr const & {
|
||||
%typemap(out,noblock=1) SwigPtr_PyObject const & {
|
||||
$result = (PyObject *)*$1;
|
||||
Py_INCREF($result);
|
||||
}
|
||||
|
@ -58,28 +58,28 @@ namespace swig {
|
|||
|
||||
%{
|
||||
namespace swig {
|
||||
class PyObject_ptr {
|
||||
class SwigPtr_PyObject {
|
||||
protected:
|
||||
PyObject *_obj;
|
||||
|
||||
public:
|
||||
PyObject_ptr() :_obj(0)
|
||||
SwigPtr_PyObject() :_obj(0)
|
||||
{
|
||||
}
|
||||
|
||||
PyObject_ptr(const PyObject_ptr& item) : _obj(item._obj)
|
||||
SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj)
|
||||
{
|
||||
Py_XINCREF(_obj);
|
||||
}
|
||||
|
||||
PyObject_ptr(PyObject *obj, bool initial_ref = true) :_obj(obj)
|
||||
SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj)
|
||||
{
|
||||
if (initial_ref) {
|
||||
Py_XINCREF(_obj);
|
||||
}
|
||||
}
|
||||
|
||||
PyObject_ptr & operator=(const PyObject_ptr& item)
|
||||
SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item)
|
||||
{
|
||||
Py_XINCREF(item._obj);
|
||||
Py_XDECREF(_obj);
|
||||
|
@ -87,7 +87,7 @@ namespace swig {
|
|||
return *this;
|
||||
}
|
||||
|
||||
~PyObject_ptr()
|
||||
~SwigPtr_PyObject()
|
||||
{
|
||||
Py_XDECREF(_obj);
|
||||
}
|
||||
|
@ -106,33 +106,33 @@ namespace swig {
|
|||
%}
|
||||
|
||||
/*
|
||||
PyObject_var is used to manage 'in the scope' PyObject * variables,
|
||||
SwigVar_PyObject is used to manage 'in the scope' PyObject * variables,
|
||||
as in
|
||||
|
||||
int func () {
|
||||
PyObject_var obj = PyString_FromString("hello");
|
||||
SwigVar_PyObject obj = PyString_FromString("hello");
|
||||
}
|
||||
|
||||
ie, 'obj' is created and destructed in the same scope from
|
||||
a python object that carries at least one reference value.
|
||||
|
||||
PyObject_var just take care of applying the proper Py_DECREF.
|
||||
SwigVar_PyObject just take care of applying the proper Py_DECREF.
|
||||
|
||||
Hence, this class is purely internal and not visible at the wrapped side.
|
||||
*/
|
||||
namespace swig {
|
||||
%ignore PyObject_var;
|
||||
struct PyObject_var {};
|
||||
%apply PyObject * {PyObject_var};
|
||||
%apply PyObject * const& {PyObject_var const&};
|
||||
%ignore SwigVar_PyObject;
|
||||
struct SwigVar_PyObject {};
|
||||
%apply PyObject * {SwigVar_PyObject};
|
||||
%apply PyObject * const& {SwigVar_PyObject const&};
|
||||
}
|
||||
|
||||
%{
|
||||
namespace swig {
|
||||
struct PyObject_var : PyObject_ptr {
|
||||
PyObject_var(PyObject* obj = 0) : PyObject_ptr(obj, false) { }
|
||||
struct SwigVar_PyObject : SwigPtr_PyObject {
|
||||
SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { }
|
||||
|
||||
PyObject_var & operator = (PyObject* obj)
|
||||
SwigVar_PyObject & operator = (PyObject* obj)
|
||||
{
|
||||
Py_XDECREF(_obj);
|
||||
_obj = obj;
|
||||
|
|
|
@ -36,15 +36,15 @@
|
|||
|
||||
%include <std_except.i>
|
||||
|
||||
%fragment(SWIG_Traits_frag(swig::PyObject_ptr),"header",fragment="StdTraits") {
|
||||
%fragment(SWIG_Traits_frag(swig::SwigPtr_PyObject),"header",fragment="StdTraits") {
|
||||
namespace swig {
|
||||
template <> struct traits<PyObject_ptr > {
|
||||
template <> struct traits<SwigPtr_PyObject > {
|
||||
typedef value_category category;
|
||||
static const char* type_name() { return "PyObject_ptr"; }
|
||||
static const char* type_name() { return "SwigPtr_PyObject"; }
|
||||
};
|
||||
|
||||
template <> struct traits_from<PyObject_ptr> {
|
||||
typedef PyObject_ptr value_type;
|
||||
template <> struct traits_from<SwigPtr_PyObject> {
|
||||
typedef SwigPtr_PyObject value_type;
|
||||
static PyObject *from(const value_type& val) {
|
||||
PyObject *obj = static_cast<PyObject *>(val);
|
||||
Py_XINCREF(obj);
|
||||
|
@ -53,14 +53,14 @@ namespace swig {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct traits_check<PyObject_ptr, value_category> {
|
||||
static bool check(PyObject_ptr) {
|
||||
struct traits_check<SwigPtr_PyObject, value_category> {
|
||||
static bool check(SwigPtr_PyObject) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct traits_asval<PyObject_ptr > {
|
||||
typedef PyObject_ptr value_type;
|
||||
template <> struct traits_asval<SwigPtr_PyObject > {
|
||||
typedef SwigPtr_PyObject value_type;
|
||||
static int asval(PyObject *obj, value_type *val) {
|
||||
if (val) *val = obj;
|
||||
return SWIG_OK;
|
||||
|
@ -69,15 +69,15 @@ namespace swig {
|
|||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_Traits_frag(swig::PyObject_var),"header",fragment="StdTraits") {
|
||||
%fragment(SWIG_Traits_frag(swig::SwigVar_PyObject),"header",fragment="StdTraits") {
|
||||
namespace swig {
|
||||
template <> struct traits<PyObject_var > {
|
||||
template <> struct traits<SwigVar_PyObject > {
|
||||
typedef value_category category;
|
||||
static const char* type_name() { return "PyObject_var"; }
|
||||
static const char* type_name() { return "SwigVar_PyObject"; }
|
||||
};
|
||||
|
||||
template <> struct traits_from<PyObject_var> {
|
||||
typedef PyObject_var value_type;
|
||||
template <> struct traits_from<SwigVar_PyObject> {
|
||||
typedef SwigVar_PyObject value_type;
|
||||
static PyObject *from(const value_type& val) {
|
||||
PyObject *obj = static_cast<PyObject *>(val);
|
||||
Py_XINCREF(obj);
|
||||
|
@ -86,14 +86,14 @@ namespace swig {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct traits_check<PyObject_var, value_category> {
|
||||
static bool check(PyObject_var) {
|
||||
struct traits_check<SwigVar_PyObject, value_category> {
|
||||
static bool check(SwigVar_PyObject) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct traits_asval<PyObject_var > {
|
||||
typedef PyObject_var value_type;
|
||||
template <> struct traits_asval<SwigVar_PyObject > {
|
||||
typedef SwigVar_PyObject value_type;
|
||||
static int asval(PyObject *obj, value_type *val) {
|
||||
if (val) *val = obj;
|
||||
return SWIG_OK;
|
||||
|
@ -102,7 +102,7 @@ namespace swig {
|
|||
}
|
||||
}
|
||||
|
||||
%fragment("PySequence_Base","header")
|
||||
%fragment("SwigPySequence_Base","header")
|
||||
{
|
||||
%#include <functional>
|
||||
|
||||
|
@ -133,20 +133,20 @@ namespace std {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct less <swig::PyObject_ptr>: public binary_function<swig::PyObject_ptr, swig::PyObject_ptr, bool>
|
||||
struct less <swig::SwigPtr_PyObject>: public binary_function<swig::SwigPtr_PyObject, swig::SwigPtr_PyObject, bool>
|
||||
{
|
||||
bool
|
||||
operator()(const swig::PyObject_ptr& v, const swig::PyObject_ptr& w) const
|
||||
operator()(const swig::SwigPtr_PyObject& v, const swig::SwigPtr_PyObject& w) const
|
||||
{
|
||||
return std::less<PyObject *>()(v, w);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct less <swig::PyObject_var>: public binary_function<swig::PyObject_var, swig::PyObject_var, bool>
|
||||
struct less <swig::SwigVar_PyObject>: public binary_function<swig::SwigVar_PyObject, swig::SwigVar_PyObject, bool>
|
||||
{
|
||||
bool
|
||||
operator()(const swig::PyObject_var& v, const swig::PyObject_var& w) const
|
||||
operator()(const swig::SwigVar_PyObject& v, const swig::SwigVar_PyObject& w) const
|
||||
{
|
||||
return std::less<PyObject *>()(v, w);
|
||||
}
|
||||
|
@ -288,24 +288,24 @@ namespace swig {
|
|||
}
|
||||
}
|
||||
|
||||
%fragment("PySequence_Cont","header",
|
||||
%fragment("SwigPySequence_Cont","header",
|
||||
fragment="StdTraits",
|
||||
fragment="PySequence_Base",
|
||||
fragment="PySwigIterator_T")
|
||||
fragment="SwigPySequence_Base",
|
||||
fragment="SwigPyIterator_T")
|
||||
{
|
||||
namespace swig
|
||||
{
|
||||
template <class T>
|
||||
struct PySequence_Ref
|
||||
struct SwigPySequence_Ref
|
||||
{
|
||||
PySequence_Ref(PyObject* seq, int index)
|
||||
SwigPySequence_Ref(PyObject* seq, int index)
|
||||
: _seq(seq), _index(index)
|
||||
{
|
||||
}
|
||||
|
||||
operator T () const
|
||||
{
|
||||
swig::PyObject_var item = PySequence_GetItem(_seq, _index);
|
||||
swig::SwigVar_PyObject item = PySequence_GetItem(_seq, _index);
|
||||
try {
|
||||
return swig::as<T>(item, true);
|
||||
} catch (std::exception& e) {
|
||||
|
@ -320,7 +320,7 @@ namespace swig
|
|||
}
|
||||
}
|
||||
|
||||
PySequence_Ref& operator=(const T& v)
|
||||
SwigPySequence_Ref& operator=(const T& v)
|
||||
{
|
||||
PySequence_SetItem(_seq, _index, swig::from<T>(v));
|
||||
return *this;
|
||||
|
@ -332,18 +332,18 @@ namespace swig
|
|||
};
|
||||
|
||||
template <class T>
|
||||
struct PySequence_ArrowProxy
|
||||
struct SwigPySequence_ArrowProxy
|
||||
{
|
||||
PySequence_ArrowProxy(const T& x): m_value(x) {}
|
||||
SwigPySequence_ArrowProxy(const T& x): m_value(x) {}
|
||||
const T* operator->() const { return &m_value; }
|
||||
operator const T*() const { return &m_value; }
|
||||
T m_value;
|
||||
};
|
||||
|
||||
template <class T, class Reference >
|
||||
struct PySequence_InputIterator
|
||||
struct SwigPySequence_InputIterator
|
||||
{
|
||||
typedef PySequence_InputIterator<T, Reference > self;
|
||||
typedef SwigPySequence_InputIterator<T, Reference > self;
|
||||
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
typedef Reference reference;
|
||||
|
@ -351,11 +351,11 @@ namespace swig
|
|||
typedef T* pointer;
|
||||
typedef int difference_type;
|
||||
|
||||
PySequence_InputIterator()
|
||||
SwigPySequence_InputIterator()
|
||||
{
|
||||
}
|
||||
|
||||
PySequence_InputIterator(PyObject* seq, int index)
|
||||
SwigPySequence_InputIterator(PyObject* seq, int index)
|
||||
: _seq(seq), _index(index)
|
||||
{
|
||||
}
|
||||
|
@ -365,9 +365,9 @@ namespace swig
|
|||
return reference(_seq, _index);
|
||||
}
|
||||
|
||||
PySequence_ArrowProxy<T>
|
||||
SwigPySequence_ArrowProxy<T>
|
||||
operator->() const {
|
||||
return PySequence_ArrowProxy<T>(operator*());
|
||||
return SwigPySequence_ArrowProxy<T>(operator*());
|
||||
}
|
||||
|
||||
bool operator==(const self& ri) const
|
||||
|
@ -436,19 +436,19 @@ namespace swig
|
|||
};
|
||||
|
||||
template <class T>
|
||||
struct PySequence_Cont
|
||||
struct SwigPySequence_Cont
|
||||
{
|
||||
typedef PySequence_Ref<T> reference;
|
||||
typedef const PySequence_Ref<T> const_reference;
|
||||
typedef SwigPySequence_Ref<T> reference;
|
||||
typedef const SwigPySequence_Ref<T> const_reference;
|
||||
typedef T value_type;
|
||||
typedef T* pointer;
|
||||
typedef int difference_type;
|
||||
typedef int size_type;
|
||||
typedef const pointer const_pointer;
|
||||
typedef PySequence_InputIterator<T, reference> iterator;
|
||||
typedef PySequence_InputIterator<T, const_reference> const_iterator;
|
||||
typedef SwigPySequence_InputIterator<T, reference> iterator;
|
||||
typedef SwigPySequence_InputIterator<T, const_reference> const_iterator;
|
||||
|
||||
PySequence_Cont(PyObject* seq) : _seq(0)
|
||||
SwigPySequence_Cont(PyObject* seq) : _seq(0)
|
||||
{
|
||||
if (!PySequence_Check(seq)) {
|
||||
throw std::invalid_argument("a sequence is expected");
|
||||
|
@ -457,7 +457,7 @@ namespace swig
|
|||
Py_INCREF(_seq);
|
||||
}
|
||||
|
||||
~PySequence_Cont()
|
||||
~SwigPySequence_Cont()
|
||||
{
|
||||
Py_XDECREF(_seq);
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ namespace swig
|
|||
{
|
||||
int s = size();
|
||||
for (int i = 0; i < s; ++i) {
|
||||
swig::PyObject_var item = PySequence_GetItem(_seq, i);
|
||||
swig::SwigVar_PyObject item = PySequence_GetItem(_seq, i);
|
||||
if (!swig::check<value_type>(item)) {
|
||||
if (set_err) {
|
||||
char msg[1024];
|
||||
|
@ -533,40 +533,40 @@ namespace swig
|
|||
class const_iterator;
|
||||
class const_reverse_iterator;
|
||||
|
||||
%typemap(out,noblock=1,fragment="PySequence_Cont")
|
||||
%typemap(out,noblock=1,fragment="SwigPySequence_Cont")
|
||||
iterator, reverse_iterator, const_iterator, const_reverse_iterator {
|
||||
$result = SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &)),
|
||||
swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
|
||||
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
|
||||
}
|
||||
%typemap(out,noblock=1,fragment="PySequence_Cont")
|
||||
%typemap(out,noblock=1,fragment="SwigPySequence_Cont")
|
||||
std::pair<iterator, iterator>, std::pair<const_iterator, const_iterator> {
|
||||
$result = PyTuple_New(2);
|
||||
PyTuple_SetItem($result,0,SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &).first),
|
||||
swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN));
|
||||
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN));
|
||||
PyTuple_SetItem($result,1,SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &).second),
|
||||
swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN));
|
||||
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%fragment("PyPairBoolOutputIterator","header",fragment=SWIG_From_frag(bool),fragment="PySequence_Cont") {}
|
||||
%fragment("SwigPyPairBoolOutputIterator","header",fragment=SWIG_From_frag(bool),fragment="SwigPySequence_Cont") {}
|
||||
|
||||
%typemap(out,noblock=1,fragment="PyPairBoolOutputIterator")
|
||||
%typemap(out,noblock=1,fragment="SwigPyPairBoolOutputIterator")
|
||||
std::pair<iterator, bool>, std::pair<const_iterator, bool> {
|
||||
$result = PyTuple_New(2);
|
||||
PyTuple_SetItem($result,0,SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &).first),
|
||||
swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN));
|
||||
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN));
|
||||
PyTuple_SetItem($result,1,SWIG_From(bool)(%static_cast($1,const $type &).second));
|
||||
}
|
||||
|
||||
%typemap(in,noblock=1,fragment="PySequence_Cont")
|
||||
iterator(swig::PySwigIterator *iter = 0, int res),
|
||||
reverse_iterator(swig::PySwigIterator *iter = 0, int res),
|
||||
const_iterator(swig::PySwigIterator *iter = 0, int res),
|
||||
const_reverse_iterator(swig::PySwigIterator *iter = 0, int res) {
|
||||
res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
|
||||
%typemap(in,noblock=1,fragment="SwigPySequence_Cont")
|
||||
iterator(swig::SwigPyIterator *iter = 0, int res),
|
||||
reverse_iterator(swig::SwigPyIterator *iter = 0, int res),
|
||||
const_iterator(swig::SwigPyIterator *iter = 0, int res),
|
||||
const_reverse_iterator(swig::SwigPyIterator *iter = 0, int res) {
|
||||
res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
|
||||
if (!SWIG_IsOK(res) || !iter) {
|
||||
%argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
|
||||
} else {
|
||||
swig::PySwigIterator_T<$type > *iter_t = dynamic_cast<swig::PySwigIterator_T<$type > *>(iter);
|
||||
swig::SwigPyIterator_T<$type > *iter_t = dynamic_cast<swig::SwigPyIterator_T<$type > *>(iter);
|
||||
if (iter_t) {
|
||||
$1 = iter_t->get_current();
|
||||
} else {
|
||||
|
@ -575,18 +575,18 @@ namespace swig
|
|||
}
|
||||
}
|
||||
|
||||
%typecheck(%checkcode(ITERATOR),noblock=1,fragment="PySequence_Cont")
|
||||
%typecheck(%checkcode(ITERATOR),noblock=1,fragment="SwigPySequence_Cont")
|
||||
iterator, reverse_iterator, const_iterator, const_reverse_iterator {
|
||||
swig::PySwigIterator *iter = 0;
|
||||
int res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
|
||||
$1 = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<$type > *>(iter) != 0));
|
||||
swig::SwigPyIterator *iter = 0;
|
||||
int res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
|
||||
$1 = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<$type > *>(iter) != 0));
|
||||
}
|
||||
|
||||
%fragment("PySequence_Cont");
|
||||
%fragment("SwigPySequence_Cont");
|
||||
|
||||
%newobject iterator(PyObject **PYTHON_SELF);
|
||||
%extend {
|
||||
swig::PySwigIterator* iterator(PyObject **PYTHON_SELF) {
|
||||
swig::SwigPyIterator* iterator(PyObject **PYTHON_SELF) {
|
||||
return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
}
|
||||
|
||||
|
@ -623,7 +623,7 @@ namespace swig
|
|||
%swig_sequence_iterator(%arg(Sequence))
|
||||
%swig_container_methods(%arg(Sequence))
|
||||
|
||||
%fragment("PySequence_Base");
|
||||
%fragment("SwigPySequence_Base");
|
||||
|
||||
%extend {
|
||||
value_type pop() throw (std::out_of_range) {
|
||||
|
@ -740,16 +740,16 @@ namespace swig
|
|||
|
||||
%fragment("StdSequenceTraits","header",
|
||||
fragment="StdTraits",
|
||||
fragment="PySequence_Cont")
|
||||
fragment="SwigPySequence_Cont")
|
||||
{
|
||||
namespace swig {
|
||||
template <class PySeq, class Seq>
|
||||
template <class SwigPySeq, class Seq>
|
||||
inline void
|
||||
assign(const PySeq& pyseq, Seq* seq) {
|
||||
// seq->assign(pyseq.begin(), pyseq.end()); // not used as not always implemented
|
||||
typedef typename PySeq::value_type value_type;
|
||||
typename PySeq::const_iterator it = pyseq.begin();
|
||||
for (;it != pyseq.end(); ++it) {
|
||||
assign(const SwigPySeq& swigpyseq, Seq* seq) {
|
||||
// seq->assign(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented
|
||||
typedef typename SwigPySeq::value_type value_type;
|
||||
typename SwigPySeq::const_iterator it = swigpyseq.begin();
|
||||
for (;it != swigpyseq.end(); ++it) {
|
||||
seq->insert(seq->end(),(value_type)(*it));
|
||||
}
|
||||
}
|
||||
|
@ -769,14 +769,14 @@ namespace swig {
|
|||
}
|
||||
} else if (PySequence_Check(obj)) {
|
||||
try {
|
||||
PySequence_Cont<value_type> pyseq(obj);
|
||||
SwigPySequence_Cont<value_type> swigpyseq(obj);
|
||||
if (seq) {
|
||||
sequence *pseq = new sequence();
|
||||
assign(pyseq, pseq);
|
||||
assign(swigpyseq, pseq);
|
||||
*seq = pseq;
|
||||
return SWIG_NEWOBJ;
|
||||
} else {
|
||||
return pyseq.check() ? SWIG_OK : SWIG_ERROR;
|
||||
return swigpyseq.check() ? SWIG_OK : SWIG_ERROR;
|
||||
}
|
||||
} catch (std::exception& e) {
|
||||
if (seq) {
|
||||
|
|
|
@ -6,56 +6,56 @@
|
|||
*
|
||||
* Implement a python 'output' iterator for Python 2.2 or higher.
|
||||
*
|
||||
* Users can derive form the PySwigIterator to implement their
|
||||
* Users can derive form the SwigPyIterator to implement their
|
||||
* own iterators. As an example (real one since we use it for STL/STD
|
||||
* containers), the template PySwigIterator_T does the
|
||||
* containers), the template SwigPyIterator_T does the
|
||||
* implementation for genereic C++ iterators.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
||||
%fragment("PySwigIterator","header") {
|
||||
%fragment("SwigPyIterator","header") {
|
||||
namespace swig {
|
||||
struct stop_iteration {
|
||||
};
|
||||
|
||||
struct PySwigIterator {
|
||||
struct SwigPyIterator {
|
||||
private:
|
||||
PyObject_ptr _seq;
|
||||
SwigPtr_PyObject _seq;
|
||||
|
||||
protected:
|
||||
PySwigIterator(PyObject *seq) : _seq(seq)
|
||||
SwigPyIterator(PyObject *seq) : _seq(seq)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~PySwigIterator() {}
|
||||
virtual ~SwigPyIterator() {}
|
||||
|
||||
// Access iterator method, required by Python
|
||||
virtual PyObject *value() const = 0;
|
||||
|
||||
// Forward iterator method, required by Python
|
||||
virtual PySwigIterator *incr(size_t n = 1) = 0;
|
||||
virtual SwigPyIterator *incr(size_t n = 1) = 0;
|
||||
|
||||
// Backward iterator method, very common in C++, but not required in Python
|
||||
virtual PySwigIterator *decr(size_t /*n*/ = 1)
|
||||
virtual SwigPyIterator *decr(size_t /*n*/ = 1)
|
||||
{
|
||||
throw stop_iteration();
|
||||
}
|
||||
|
||||
// Random access iterator methods, but not required in Python
|
||||
virtual ptrdiff_t distance(const PySwigIterator &/*x*/) const
|
||||
virtual ptrdiff_t distance(const SwigPyIterator &/*x*/) const
|
||||
{
|
||||
throw std::invalid_argument("operation not supported");
|
||||
}
|
||||
|
||||
virtual bool equal (const PySwigIterator &/*x*/) const
|
||||
virtual bool equal (const SwigPyIterator &/*x*/) const
|
||||
{
|
||||
throw std::invalid_argument("operation not supported");
|
||||
}
|
||||
|
||||
// C++ common/needed methods
|
||||
virtual PySwigIterator *copy() const = 0;
|
||||
virtual SwigPyIterator *copy() const = 0;
|
||||
|
||||
PyObject *next()
|
||||
{
|
||||
|
@ -81,42 +81,42 @@ namespace swig {
|
|||
return obj;
|
||||
}
|
||||
|
||||
PySwigIterator *advance(ptrdiff_t n)
|
||||
SwigPyIterator *advance(ptrdiff_t n)
|
||||
{
|
||||
return (n > 0) ? incr(n) : decr(-n);
|
||||
}
|
||||
|
||||
bool operator == (const PySwigIterator& x) const
|
||||
bool operator == (const SwigPyIterator& x) const
|
||||
{
|
||||
return equal(x);
|
||||
}
|
||||
|
||||
bool operator != (const PySwigIterator& x) const
|
||||
bool operator != (const SwigPyIterator& x) const
|
||||
{
|
||||
return ! operator==(x);
|
||||
}
|
||||
|
||||
PySwigIterator& operator += (ptrdiff_t n)
|
||||
SwigPyIterator& operator += (ptrdiff_t n)
|
||||
{
|
||||
return *advance(n);
|
||||
}
|
||||
|
||||
PySwigIterator& operator -= (ptrdiff_t n)
|
||||
SwigPyIterator& operator -= (ptrdiff_t n)
|
||||
{
|
||||
return *advance(-n);
|
||||
}
|
||||
|
||||
PySwigIterator* operator + (ptrdiff_t n) const
|
||||
SwigPyIterator* operator + (ptrdiff_t n) const
|
||||
{
|
||||
return copy()->advance(n);
|
||||
}
|
||||
|
||||
PySwigIterator* operator - (ptrdiff_t n) const
|
||||
SwigPyIterator* operator - (ptrdiff_t n) const
|
||||
{
|
||||
return copy()->advance(-n);
|
||||
}
|
||||
|
||||
ptrdiff_t operator - (const PySwigIterator& x) const
|
||||
ptrdiff_t operator - (const SwigPyIterator& x) const
|
||||
{
|
||||
return x.distance(*this);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ namespace swig {
|
|||
static int init = 0;
|
||||
static swig_type_info* desc = 0;
|
||||
if (!init) {
|
||||
desc = SWIG_TypeQuery("swig::PySwigIterator *");
|
||||
desc = SWIG_TypeQuery("swig::SwigPyIterator *");
|
||||
init = 1;
|
||||
}
|
||||
return desc;
|
||||
|
@ -134,18 +134,18 @@ namespace swig {
|
|||
}
|
||||
}
|
||||
|
||||
%fragment("PySwigIterator_T","header",fragment="PySwigIterator",fragment="StdTraits",fragment="StdIteratorTraits") {
|
||||
%fragment("SwigPyIterator_T","header",fragment="SwigPyIterator",fragment="StdTraits",fragment="StdIteratorTraits") {
|
||||
namespace swig {
|
||||
template<typename OutIterator>
|
||||
class PySwigIterator_T : public PySwigIterator
|
||||
class SwigPyIterator_T : public SwigPyIterator
|
||||
{
|
||||
public:
|
||||
typedef OutIterator out_iterator;
|
||||
typedef typename std::iterator_traits<out_iterator>::value_type value_type;
|
||||
typedef PySwigIterator_T<out_iterator> self_type;
|
||||
typedef SwigPyIterator_T<out_iterator> self_type;
|
||||
|
||||
PySwigIterator_T(out_iterator curr, PyObject *seq)
|
||||
: PySwigIterator(seq), current(curr)
|
||||
SwigPyIterator_T(out_iterator curr, PyObject *seq)
|
||||
: SwigPyIterator(seq), current(curr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ namespace swig {
|
|||
}
|
||||
|
||||
|
||||
bool equal (const PySwigIterator &iter) const
|
||||
bool equal (const SwigPyIterator &iter) const
|
||||
{
|
||||
const self_type *iters = dynamic_cast<const self_type *>(&iter);
|
||||
if (iters) {
|
||||
|
@ -165,7 +165,7 @@ namespace swig {
|
|||
}
|
||||
}
|
||||
|
||||
ptrdiff_t distance(const PySwigIterator &iter) const
|
||||
ptrdiff_t distance(const SwigPyIterator &iter) const
|
||||
{
|
||||
const self_type *iters = dynamic_cast<const self_type *>(&iter);
|
||||
if (iters) {
|
||||
|
@ -193,17 +193,17 @@ namespace swig {
|
|||
template<typename OutIterator,
|
||||
typename ValueType = typename std::iterator_traits<OutIterator>::value_type,
|
||||
typename FromOper = from_oper<ValueType> >
|
||||
class PySwigIteratorOpen_T : public PySwigIterator_T<OutIterator>
|
||||
class SwigPyIteratorOpen_T : public SwigPyIterator_T<OutIterator>
|
||||
{
|
||||
public:
|
||||
FromOper from;
|
||||
typedef OutIterator out_iterator;
|
||||
typedef ValueType value_type;
|
||||
typedef PySwigIterator_T<out_iterator> base;
|
||||
typedef PySwigIteratorOpen_T<OutIterator, ValueType, FromOper> self_type;
|
||||
typedef SwigPyIterator_T<out_iterator> base;
|
||||
typedef SwigPyIteratorOpen_T<OutIterator, ValueType, FromOper> self_type;
|
||||
|
||||
PySwigIteratorOpen_T(out_iterator curr, PyObject *seq)
|
||||
: PySwigIterator_T<OutIterator>(curr, seq)
|
||||
SwigPyIteratorOpen_T(out_iterator curr, PyObject *seq)
|
||||
: SwigPyIterator_T<OutIterator>(curr, seq)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -211,12 +211,12 @@ namespace swig {
|
|||
return from(static_cast<const value_type&>(*(base::current)));
|
||||
}
|
||||
|
||||
PySwigIterator *copy() const
|
||||
SwigPyIterator *copy() const
|
||||
{
|
||||
return new self_type(*this);
|
||||
}
|
||||
|
||||
PySwigIterator *incr(size_t n = 1)
|
||||
SwigPyIterator *incr(size_t n = 1)
|
||||
{
|
||||
while (n--) {
|
||||
++base::current;
|
||||
|
@ -224,7 +224,7 @@ namespace swig {
|
|||
return this;
|
||||
}
|
||||
|
||||
PySwigIterator *decr(size_t n = 1)
|
||||
SwigPyIterator *decr(size_t n = 1)
|
||||
{
|
||||
while (n--) {
|
||||
--base::current;
|
||||
|
@ -236,17 +236,17 @@ namespace swig {
|
|||
template<typename OutIterator,
|
||||
typename ValueType = typename std::iterator_traits<OutIterator>::value_type,
|
||||
typename FromOper = from_oper<ValueType> >
|
||||
class PySwigIteratorClosed_T : public PySwigIterator_T<OutIterator>
|
||||
class SwigPyIteratorClosed_T : public SwigPyIterator_T<OutIterator>
|
||||
{
|
||||
public:
|
||||
FromOper from;
|
||||
typedef OutIterator out_iterator;
|
||||
typedef ValueType value_type;
|
||||
typedef PySwigIterator_T<out_iterator> base;
|
||||
typedef PySwigIteratorClosed_T<OutIterator, ValueType, FromOper> self_type;
|
||||
typedef SwigPyIterator_T<out_iterator> base;
|
||||
typedef SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper> self_type;
|
||||
|
||||
PySwigIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq)
|
||||
: PySwigIterator_T<OutIterator>(curr, seq), begin(first), end(last)
|
||||
SwigPyIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq)
|
||||
: SwigPyIterator_T<OutIterator>(curr, seq), begin(first), end(last)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -258,12 +258,12 @@ namespace swig {
|
|||
}
|
||||
}
|
||||
|
||||
PySwigIterator *copy() const
|
||||
SwigPyIterator *copy() const
|
||||
{
|
||||
return new self_type(*this);
|
||||
}
|
||||
|
||||
PySwigIterator *incr(size_t n = 1)
|
||||
SwigPyIterator *incr(size_t n = 1)
|
||||
{
|
||||
while (n--) {
|
||||
if (base::current == end) {
|
||||
|
@ -275,7 +275,7 @@ namespace swig {
|
|||
return this;
|
||||
}
|
||||
|
||||
PySwigIterator *decr(size_t n = 1)
|
||||
SwigPyIterator *decr(size_t n = 1)
|
||||
{
|
||||
while (n--) {
|
||||
if (base::current == begin) {
|
||||
|
@ -293,23 +293,23 @@ namespace swig {
|
|||
};
|
||||
|
||||
template<typename OutIter>
|
||||
inline PySwigIterator*
|
||||
inline SwigPyIterator*
|
||||
make_output_iterator(const OutIter& current, const OutIter& begin,const OutIter& end, PyObject *seq = 0)
|
||||
{
|
||||
return new PySwigIteratorClosed_T<OutIter>(current, begin, end, seq);
|
||||
return new SwigPyIteratorClosed_T<OutIter>(current, begin, end, seq);
|
||||
}
|
||||
|
||||
template<typename OutIter>
|
||||
inline PySwigIterator*
|
||||
inline SwigPyIterator*
|
||||
make_output_iterator(const OutIter& current, PyObject *seq = 0)
|
||||
{
|
||||
return new PySwigIteratorOpen_T<OutIter>(current, seq);
|
||||
return new SwigPyIteratorOpen_T<OutIter>(current, seq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%fragment("PySwigIterator");
|
||||
%fragment("SwigPyIterator");
|
||||
namespace swig
|
||||
{
|
||||
/*
|
||||
|
@ -327,67 +327,67 @@ namespace swig
|
|||
/*
|
||||
Mark methods that return new objects
|
||||
*/
|
||||
%newobject PySwigIterator::copy;
|
||||
%newobject PySwigIterator::operator + (ptrdiff_t n) const;
|
||||
%newobject PySwigIterator::operator - (ptrdiff_t n) const;
|
||||
%newobject SwigPyIterator::copy;
|
||||
%newobject SwigPyIterator::operator + (ptrdiff_t n) const;
|
||||
%newobject SwigPyIterator::operator - (ptrdiff_t n) const;
|
||||
|
||||
%nodirector PySwigIterator;
|
||||
%extend PySwigIterator {
|
||||
%nodirector SwigPyIterator;
|
||||
%extend SwigPyIterator {
|
||||
%pythoncode {def __iter__(self): return self}
|
||||
}
|
||||
|
||||
%catches(swig::stop_iteration) PySwigIterator::value() const;
|
||||
%catches(swig::stop_iteration) PySwigIterator::incr(size_t n = 1);
|
||||
%catches(swig::stop_iteration) PySwigIterator::decr(size_t n = 1);
|
||||
%catches(std::invalid_argument) PySwigIterator::distance(const PySwigIterator &x) const;
|
||||
%catches(std::invalid_argument) PySwigIterator::equal (const PySwigIterator &x) const;
|
||||
%catches(swig::stop_iteration) PySwigIterator::__next__();
|
||||
%catches(swig::stop_iteration) PySwigIterator::next();
|
||||
%catches(swig::stop_iteration) PySwigIterator::previous();
|
||||
%catches(swig::stop_iteration) PySwigIterator::advance(ptrdiff_t n);
|
||||
%catches(swig::stop_iteration) PySwigIterator::operator += (ptrdiff_t n);
|
||||
%catches(swig::stop_iteration) PySwigIterator::operator -= (ptrdiff_t n);
|
||||
%catches(swig::stop_iteration) PySwigIterator::operator + (ptrdiff_t n) const;
|
||||
%catches(swig::stop_iteration) PySwigIterator::operator - (ptrdiff_t n) const;
|
||||
%catches(swig::stop_iteration) SwigPyIterator::value() const;
|
||||
%catches(swig::stop_iteration) SwigPyIterator::incr(size_t n = 1);
|
||||
%catches(swig::stop_iteration) SwigPyIterator::decr(size_t n = 1);
|
||||
%catches(std::invalid_argument) SwigPyIterator::distance(const SwigPyIterator &x) const;
|
||||
%catches(std::invalid_argument) SwigPyIterator::equal (const SwigPyIterator &x) const;
|
||||
%catches(swig::stop_iteration) SwigPyIterator::__next__();
|
||||
%catches(swig::stop_iteration) SwigPyIterator::next();
|
||||
%catches(swig::stop_iteration) SwigPyIterator::previous();
|
||||
%catches(swig::stop_iteration) SwigPyIterator::advance(ptrdiff_t n);
|
||||
%catches(swig::stop_iteration) SwigPyIterator::operator += (ptrdiff_t n);
|
||||
%catches(swig::stop_iteration) SwigPyIterator::operator -= (ptrdiff_t n);
|
||||
%catches(swig::stop_iteration) SwigPyIterator::operator + (ptrdiff_t n) const;
|
||||
%catches(swig::stop_iteration) SwigPyIterator::operator - (ptrdiff_t n) const;
|
||||
|
||||
|
||||
struct PySwigIterator
|
||||
struct SwigPyIterator
|
||||
{
|
||||
protected:
|
||||
PySwigIterator(PyObject *seq);
|
||||
SwigPyIterator(PyObject *seq);
|
||||
|
||||
public:
|
||||
virtual ~PySwigIterator();
|
||||
virtual ~SwigPyIterator();
|
||||
|
||||
// Access iterator method, required by Python
|
||||
virtual PyObject *value() const = 0;
|
||||
|
||||
// Forward iterator method, required by Python
|
||||
virtual PySwigIterator *incr(size_t n = 1) = 0;
|
||||
virtual SwigPyIterator *incr(size_t n = 1) = 0;
|
||||
|
||||
// Backward iterator method, very common in C++, but not required in Python
|
||||
virtual PySwigIterator *decr(size_t n = 1);
|
||||
virtual SwigPyIterator *decr(size_t n = 1);
|
||||
|
||||
// Random access iterator methods, but not required in Python
|
||||
virtual ptrdiff_t distance(const PySwigIterator &x) const;
|
||||
virtual ptrdiff_t distance(const SwigPyIterator &x) const;
|
||||
|
||||
virtual bool equal (const PySwigIterator &x) const;
|
||||
virtual bool equal (const SwigPyIterator &x) const;
|
||||
|
||||
// C++ common/needed methods
|
||||
virtual PySwigIterator *copy() const = 0;
|
||||
virtual SwigPyIterator *copy() const = 0;
|
||||
|
||||
PyObject *next();
|
||||
PyObject *__next__();
|
||||
PyObject *previous();
|
||||
PySwigIterator *advance(ptrdiff_t n);
|
||||
SwigPyIterator *advance(ptrdiff_t n);
|
||||
|
||||
bool operator == (const PySwigIterator& x) const;
|
||||
bool operator != (const PySwigIterator& x) const;
|
||||
PySwigIterator& operator += (ptrdiff_t n);
|
||||
PySwigIterator& operator -= (ptrdiff_t n);
|
||||
PySwigIterator* operator + (ptrdiff_t n) const;
|
||||
PySwigIterator* operator - (ptrdiff_t n) const;
|
||||
ptrdiff_t operator - (const PySwigIterator& x) const;
|
||||
bool operator == (const SwigPyIterator& x) const;
|
||||
bool operator != (const SwigPyIterator& x) const;
|
||||
SwigPyIterator& operator += (ptrdiff_t n);
|
||||
SwigPyIterator& operator -= (ptrdiff_t n);
|
||||
SwigPyIterator* operator + (ptrdiff_t n) const;
|
||||
SwigPyIterator* operator - (ptrdiff_t n) const;
|
||||
ptrdiff_t operator - (const SwigPyIterator& x) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* From SWIG 1.3.37 we deprecated all SWIG symbols that start with Py,
|
||||
* since they are inappropriate and discouraged in Python documentation
|
||||
* (from http://www.python.org/doc/2.5.2/api/includes.html):
|
||||
*
|
||||
* "All user visible names defined by Python.h (except those defined by the included
|
||||
* standard headers) have one of the prefixes "Py" or "_Py". Names beginning with
|
||||
* "_Py" are for internal use by the Python implementation and should not be used
|
||||
* by extension writers. Structure member names do not have a reserved prefix.
|
||||
*
|
||||
* Important: user code should never define names that begin with "Py" or "_Py".
|
||||
* This confuses the reader, and jeopardizes the portability of the user code to
|
||||
* future Python versions, which may define additional names beginning with one
|
||||
* of these prefixes."
|
||||
*
|
||||
* This file defined macros to provide backward compatibility for these deprecated
|
||||
* symbols. In the case you have these symbols in your interface file, you can simply
|
||||
* include this file at begining of it.
|
||||
*
|
||||
* However, this file may be removed in future release of SWIG, so using this file to
|
||||
* keep these inappropriate names in your SWIG interface file is also not recommanded.
|
||||
* Instead, we provide a simple tool for converting your interface files to
|
||||
* the new naming convention. You can download the tool here:
|
||||
* https://swig.svn.sourceforge.net/svnroot/swig/trunk/Tools/pyname_patch.py
|
||||
*/
|
||||
|
||||
%fragment("PySequence_Base", "header", fragment="SwigPySequence_Base") {}
|
||||
%fragment("PySequence_Cont", "header", fragment="SwigPySequence_Cont") {}
|
||||
%fragment("PySwigIterator_T", "header", fragment="SwigPyIterator_T") {}
|
||||
%fragment("PyPairBoolOutputIterator", "header", fragment="SwigPyPairBoolOutputIterator") {}
|
||||
%fragment("PySwigIterator", "header", fragment="SwigPyIterator") {}
|
||||
%fragment("PySwigIterator_T", "header", fragment="SwigPyIterator_T") {}
|
||||
|
||||
%inline %{
|
||||
#define PyMapIterator_T SwigPyMapIterator_T
|
||||
#define PyMapKeyIterator_T SwigPyMapKeyIterator_T
|
||||
#define PyMapValueIterator_T SwigPyMapValueITerator_T
|
||||
#define PyObject_ptr SwigPtr_PyObject
|
||||
#define PyObject_var SwigVar_PyObject
|
||||
#define PyOper SwigPyOper
|
||||
#define PySeq SwigPySeq
|
||||
#define PySequence_ArrowProxy SwigPySequence_ArrowProxy
|
||||
#define PySequence_Cont SwigPySequence_Cont
|
||||
#define PySequence_InputIterator SwigPySequence_InputIterator
|
||||
#define PySequence_Ref SwigPySequence_Ref
|
||||
#define PySwigClientData SwigPyClientData
|
||||
#define PySwigClientData_Del SwigPyClientData_Del
|
||||
#define PySwigClientData_New SwigPyClientData_New
|
||||
#define PySwigIterator SwigPyIterator
|
||||
#define PySwigIteratorClosed_T SwigPyIteratorClosed_T
|
||||
#define PySwigIteratorOpen_T SwigPyIteratorOpen_T
|
||||
#define PySwigIterator_T SwigPyIterator_T
|
||||
#define PySwigObject SwigPyObject
|
||||
#define PySwigObject_Check SwigPyObject_Check
|
||||
#define PySwigObject_GetDesc SwigPyObject_GetDesc
|
||||
#define PySwigObject_New SwigPyObject_New
|
||||
#define PySwigObject_acquire SwigPyObject_acquire
|
||||
#define PySwigObject_append SwigPyObject_append
|
||||
#define PySwigObject_as_number SwigPyObject_as_number
|
||||
#define PySwigObject_compare SwigPyObject_compare
|
||||
#define PySwigObject_dealloc SwigPyObject_dealloc
|
||||
#define PySwigObject_disown SwigPyObject_disown
|
||||
#define PySwigObject_format SwigPyObject_format
|
||||
#define PySwigObject_getattr SwigPyObject_getattr
|
||||
#define PySwigObject_hex SwigPyObject_hex
|
||||
#define PySwigObject_long SwigPyObject_long
|
||||
#define PySwigObject_next SwigPyObject_next
|
||||
#define PySwigObject_oct SwigPyObject_oct
|
||||
#define PySwigObject_own SwigPyObject_own
|
||||
#define PySwigObject_print SwigPyObject_print
|
||||
#define PySwigObject_repr SwigPyObject_repr
|
||||
#define PySwigObject_richcompare SwigPyObject_richcompare
|
||||
#define PySwigObject_str SwigPyObject_str
|
||||
#define PySwigObject_type SwigPyObject_type
|
||||
#define PySwigPacked SwigPyPacked
|
||||
#define PySwigPacked_Check SwigPyPacked_Check
|
||||
#define PySwigPacked_New SwigPyPacked_New
|
||||
#define PySwigPacked_UnpackData SwigPyPacked_UnpackData
|
||||
#define PySwigPacked_compare SwigPyPacked_compare
|
||||
#define PySwigPacked_dealloc SwigPyPacked_dealloc
|
||||
#define PySwigPacked_print SwigPyPacked_print
|
||||
#define PySwigPacked_repr SwigPyPacked_repr
|
||||
#define PySwigPacked_str SwigPyPacked_str
|
||||
#define PySwigPacked_type SwigPyPacked_type
|
||||
#define pyseq swigpyseq
|
||||
#define pyswigobject_type swigpyobject_type
|
||||
#define pyswigpacked_type swigpypacked_type
|
||||
%}
|
|
@ -90,7 +90,7 @@ __bool__ = __nonzero__
|
|||
|
||||
*/
|
||||
|
||||
#define %pyinplaceoper(PyOper, Oper) %delobject Oper; %newobject Oper; %rename(PyOper) Oper
|
||||
#define %pyinplaceoper(SwigPyOper, Oper) %delobject Oper; %newobject Oper; %rename(SwigPyOper) Oper
|
||||
|
||||
%pyinplaceoper(__iadd__ , *::operator +=);
|
||||
%pyinplaceoper(__isub__ , *::operator -=);
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
|
||||
#define SWIG_NewClientData(obj) PySwigClientData_New(obj)
|
||||
#define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
|
||||
|
||||
#define SWIG_SetErrorObj SWIG_Python_SetErrorObj
|
||||
#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
|
||||
|
@ -238,7 +238,7 @@ SWIG_Py_Void(void)
|
|||
return none;
|
||||
}
|
||||
|
||||
/* PySwigClientData */
|
||||
/* SwigPyClientData */
|
||||
|
||||
typedef struct {
|
||||
PyObject *klass;
|
||||
|
@ -247,30 +247,30 @@ typedef struct {
|
|||
PyObject *destroy;
|
||||
int delargs;
|
||||
int implicitconv;
|
||||
} PySwigClientData;
|
||||
} SwigPyClientData;
|
||||
|
||||
SWIGRUNTIMEINLINE int
|
||||
SWIG_Python_CheckImplicit(swig_type_info *ty)
|
||||
{
|
||||
PySwigClientData *data = (PySwigClientData *)ty->clientdata;
|
||||
SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
|
||||
return data ? data->implicitconv : 0;
|
||||
}
|
||||
|
||||
SWIGRUNTIMEINLINE PyObject *
|
||||
SWIG_Python_ExceptionType(swig_type_info *desc) {
|
||||
PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
|
||||
SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
|
||||
PyObject *klass = data ? data->klass : 0;
|
||||
return (klass ? klass : PyExc_RuntimeError);
|
||||
}
|
||||
|
||||
|
||||
SWIGRUNTIME PySwigClientData *
|
||||
PySwigClientData_New(PyObject* obj)
|
||||
SWIGRUNTIME SwigPyClientData *
|
||||
SwigPyClientData_New(PyObject* obj)
|
||||
{
|
||||
if (!obj) {
|
||||
return 0;
|
||||
} else {
|
||||
PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData));
|
||||
SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
|
||||
/* the klass element */
|
||||
data->klass = obj;
|
||||
Py_INCREF(data->klass);
|
||||
|
@ -318,14 +318,14 @@ PySwigClientData_New(PyObject* obj)
|
|||
}
|
||||
|
||||
SWIGRUNTIME void
|
||||
PySwigClientData_Del(PySwigClientData* data)
|
||||
SwigPyClientData_Del(SwigPyClientData* data)
|
||||
{
|
||||
Py_XDECREF(data->newraw);
|
||||
Py_XDECREF(data->newargs);
|
||||
Py_XDECREF(data->destroy);
|
||||
}
|
||||
|
||||
/* =============== PySwigObject =====================*/
|
||||
/* =============== SwigPyObject =====================*/
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
|
@ -333,21 +333,21 @@ typedef struct {
|
|||
swig_type_info *ty;
|
||||
int own;
|
||||
PyObject *next;
|
||||
} PySwigObject;
|
||||
} SwigPyObject;
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
PySwigObject_long(PySwigObject *v)
|
||||
SwigPyObject_long(SwigPyObject *v)
|
||||
{
|
||||
return PyLong_FromVoidPtr(v->ptr);
|
||||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
PySwigObject_format(const char* fmt, PySwigObject *v)
|
||||
SwigPyObject_format(const char* fmt, SwigPyObject *v)
|
||||
{
|
||||
PyObject *res = NULL;
|
||||
PyObject *args = PyTuple_New(1);
|
||||
if (args) {
|
||||
if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
|
||||
if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
|
||||
PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
|
||||
if (ofmt) {
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
|
@ -364,33 +364,33 @@ PySwigObject_format(const char* fmt, PySwigObject *v)
|
|||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
PySwigObject_oct(PySwigObject *v)
|
||||
SwigPyObject_oct(SwigPyObject *v)
|
||||
{
|
||||
return PySwigObject_format("%o",v);
|
||||
return SwigPyObject_format("%o",v);
|
||||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
PySwigObject_hex(PySwigObject *v)
|
||||
SwigPyObject_hex(SwigPyObject *v)
|
||||
{
|
||||
return PySwigObject_format("%x",v);
|
||||
return SwigPyObject_format("%x",v);
|
||||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
#ifdef METH_NOARGS
|
||||
PySwigObject_repr(PySwigObject *v)
|
||||
SwigPyObject_repr(SwigPyObject *v)
|
||||
#else
|
||||
PySwigObject_repr(PySwigObject *v, PyObject *args)
|
||||
SwigPyObject_repr(SwigPyObject *v, PyObject *args)
|
||||
#endif
|
||||
{
|
||||
const char *name = SWIG_TypePrettyName(v->ty);
|
||||
PyObject *hex = PySwigObject_hex(v);
|
||||
PyObject *hex = SwigPyObject_hex(v);
|
||||
PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", name, hex);
|
||||
Py_DECREF(hex);
|
||||
if (v->next) {
|
||||
#ifdef METH_NOARGS
|
||||
PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next);
|
||||
PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
|
||||
#else
|
||||
PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args);
|
||||
PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args);
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyObject *joined = PyUnicode_Concat(repr, nrep);
|
||||
|
@ -405,12 +405,12 @@ PySwigObject_repr(PySwigObject *v, PyObject *args)
|
|||
}
|
||||
|
||||
SWIGRUNTIME int
|
||||
PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
|
||||
SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
|
||||
{
|
||||
#ifdef METH_NOARGS
|
||||
PyObject *repr = PySwigObject_repr(v);
|
||||
PyObject *repr = SwigPyObject_repr(v);
|
||||
#else
|
||||
PyObject *repr = PySwigObject_repr(v, NULL);
|
||||
PyObject *repr = SwigPyObject_repr(v, NULL);
|
||||
#endif
|
||||
if (repr) {
|
||||
fputs(SWIG_Python_str_AsChar(repr), fp);
|
||||
|
@ -422,7 +422,7 @@ PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
|
|||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
PySwigObject_str(PySwigObject *v)
|
||||
SwigPyObject_str(SwigPyObject *v)
|
||||
{
|
||||
char result[SWIG_BUFFER_SIZE];
|
||||
return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
|
||||
|
@ -430,7 +430,7 @@ PySwigObject_str(PySwigObject *v)
|
|||
}
|
||||
|
||||
SWIGRUNTIME int
|
||||
PySwigObject_compare(PySwigObject *v, PySwigObject *w)
|
||||
SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
|
||||
{
|
||||
void *i = v->ptr;
|
||||
void *j = w->ptr;
|
||||
|
@ -439,14 +439,14 @@ PySwigObject_compare(PySwigObject *v, PySwigObject *w)
|
|||
|
||||
/* Added for Python 3.x, whould it also useful for Python 2.x? */
|
||||
SWIGRUNTIME PyObject*
|
||||
PySwigObject_richcompare(PySwigObject *v, PySwigObject *w, int op)
|
||||
SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
|
||||
{
|
||||
PyObject* res;
|
||||
if( op != Py_EQ && op != Py_NE ) {
|
||||
Py_INCREF(Py_NotImplemented);
|
||||
return Py_NotImplemented;
|
||||
}
|
||||
if( (PySwigObject_compare(v, w)==0) == (op == Py_EQ) )
|
||||
if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) )
|
||||
res = Py_True;
|
||||
else
|
||||
res = Py_False;
|
||||
|
@ -458,35 +458,35 @@ PySwigObject_richcompare(PySwigObject *v, PySwigObject *w, int op)
|
|||
SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
|
||||
|
||||
SWIGRUNTIME PyTypeObject*
|
||||
PySwigObject_type(void) {
|
||||
SwigPyObject_type(void) {
|
||||
static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
|
||||
return type;
|
||||
}
|
||||
|
||||
SWIGRUNTIMEINLINE int
|
||||
PySwigObject_Check(PyObject *op) {
|
||||
return (Py_TYPE(op) == PySwigObject_type())
|
||||
|| (strcmp(Py_TYPE(op)->tp_name,"PySwigObject") == 0);
|
||||
SwigPyObject_Check(PyObject *op) {
|
||||
return (Py_TYPE(op) == SwigPyObject_type())
|
||||
|| (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
|
||||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
PySwigObject_New(void *ptr, swig_type_info *ty, int own);
|
||||
SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
|
||||
|
||||
SWIGRUNTIME void
|
||||
PySwigObject_dealloc(PyObject *v)
|
||||
SwigPyObject_dealloc(PyObject *v)
|
||||
{
|
||||
PySwigObject *sobj = (PySwigObject *) v;
|
||||
SwigPyObject *sobj = (SwigPyObject *) v;
|
||||
PyObject *next = sobj->next;
|
||||
if (sobj->own == SWIG_POINTER_OWN) {
|
||||
swig_type_info *ty = sobj->ty;
|
||||
PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
|
||||
SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
|
||||
PyObject *destroy = data ? data->destroy : 0;
|
||||
if (destroy) {
|
||||
/* destroy is always a VARARGS method */
|
||||
PyObject *res;
|
||||
if (data->delargs) {
|
||||
/* we need to create a temporal object to carry the destroy operation */
|
||||
PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
|
||||
PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
|
||||
res = SWIG_Python_CallFunctor(destroy, tmp);
|
||||
Py_DECREF(tmp);
|
||||
} else {
|
||||
|
@ -508,15 +508,15 @@ PySwigObject_dealloc(PyObject *v)
|
|||
}
|
||||
|
||||
SWIGRUNTIME PyObject*
|
||||
PySwigObject_append(PyObject* v, PyObject* next)
|
||||
SwigPyObject_append(PyObject* v, PyObject* next)
|
||||
{
|
||||
PySwigObject *sobj = (PySwigObject *) v;
|
||||
SwigPyObject *sobj = (SwigPyObject *) v;
|
||||
#ifndef METH_O
|
||||
PyObject *tmp = 0;
|
||||
if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
|
||||
next = tmp;
|
||||
#endif
|
||||
if (!PySwigObject_Check(next)) {
|
||||
if (!SwigPyObject_Check(next)) {
|
||||
return NULL;
|
||||
}
|
||||
sobj->next = next;
|
||||
|
@ -526,12 +526,12 @@ PySwigObject_append(PyObject* v, PyObject* next)
|
|||
|
||||
SWIGRUNTIME PyObject*
|
||||
#ifdef METH_NOARGS
|
||||
PySwigObject_next(PyObject* v)
|
||||
SwigPyObject_next(PyObject* v)
|
||||
#else
|
||||
PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
|
||||
SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
|
||||
#endif
|
||||
{
|
||||
PySwigObject *sobj = (PySwigObject *) v;
|
||||
SwigPyObject *sobj = (SwigPyObject *) v;
|
||||
if (sobj->next) {
|
||||
Py_INCREF(sobj->next);
|
||||
return sobj->next;
|
||||
|
@ -542,30 +542,30 @@ PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
|
|||
|
||||
SWIGINTERN PyObject*
|
||||
#ifdef METH_NOARGS
|
||||
PySwigObject_disown(PyObject *v)
|
||||
SwigPyObject_disown(PyObject *v)
|
||||
#else
|
||||
PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
|
||||
SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
|
||||
#endif
|
||||
{
|
||||
PySwigObject *sobj = (PySwigObject *)v;
|
||||
SwigPyObject *sobj = (SwigPyObject *)v;
|
||||
sobj->own = 0;
|
||||
return SWIG_Py_Void();
|
||||
}
|
||||
|
||||
SWIGINTERN PyObject*
|
||||
#ifdef METH_NOARGS
|
||||
PySwigObject_acquire(PyObject *v)
|
||||
SwigPyObject_acquire(PyObject *v)
|
||||
#else
|
||||
PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
|
||||
SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
|
||||
#endif
|
||||
{
|
||||
PySwigObject *sobj = (PySwigObject *)v;
|
||||
SwigPyObject *sobj = (SwigPyObject *)v;
|
||||
sobj->own = SWIG_POINTER_OWN;
|
||||
return SWIG_Py_Void();
|
||||
}
|
||||
|
||||
SWIGINTERN PyObject*
|
||||
PySwigObject_own(PyObject *v, PyObject *args)
|
||||
SwigPyObject_own(PyObject *v, PyObject *args)
|
||||
{
|
||||
PyObject *val = 0;
|
||||
#if (PY_VERSION_HEX < 0x02020000)
|
||||
|
@ -578,20 +578,20 @@ PySwigObject_own(PyObject *v, PyObject *args)
|
|||
}
|
||||
else
|
||||
{
|
||||
PySwigObject *sobj = (PySwigObject *)v;
|
||||
SwigPyObject *sobj = (SwigPyObject *)v;
|
||||
PyObject *obj = PyBool_FromLong(sobj->own);
|
||||
if (val) {
|
||||
#ifdef METH_NOARGS
|
||||
if (PyObject_IsTrue(val)) {
|
||||
PySwigObject_acquire(v);
|
||||
SwigPyObject_acquire(v);
|
||||
} else {
|
||||
PySwigObject_disown(v);
|
||||
SwigPyObject_disown(v);
|
||||
}
|
||||
#else
|
||||
if (PyObject_IsTrue(val)) {
|
||||
PySwigObject_acquire(v,args);
|
||||
SwigPyObject_acquire(v,args);
|
||||
} else {
|
||||
PySwigObject_disown(v,args);
|
||||
SwigPyObject_disown(v,args);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -602,30 +602,30 @@ PySwigObject_own(PyObject *v, PyObject *args)
|
|||
#ifdef METH_O
|
||||
static PyMethodDef
|
||||
swigobject_methods[] = {
|
||||
{(char *)"disown", (PyCFunction)PySwigObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
|
||||
{(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"},
|
||||
{(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
|
||||
{(char *)"append", (PyCFunction)PySwigObject_append, METH_O, (char *)"appends another 'this' object"},
|
||||
{(char *)"next", (PyCFunction)PySwigObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
|
||||
{(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_NOARGS, (char *)"returns object representation"},
|
||||
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
|
||||
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"},
|
||||
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
|
||||
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"},
|
||||
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
|
||||
{(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
#else
|
||||
static PyMethodDef
|
||||
swigobject_methods[] = {
|
||||
{(char *)"disown", (PyCFunction)PySwigObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"},
|
||||
{(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"},
|
||||
{(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
|
||||
{(char *)"append", (PyCFunction)PySwigObject_append, METH_VARARGS, (char *)"appends another 'this' object"},
|
||||
{(char *)"next", (PyCFunction)PySwigObject_next, METH_VARARGS, (char *)"returns the next 'this' object"},
|
||||
{(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_VARARGS, (char *)"returns object representation"},
|
||||
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"},
|
||||
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"},
|
||||
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
|
||||
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"},
|
||||
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"},
|
||||
{(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if PY_VERSION_HEX < 0x02020000
|
||||
SWIGINTERN PyObject *
|
||||
PySwigObject_getattr(PySwigObject *sobj,char *name)
|
||||
SwigPyObject_getattr(SwigPyObject *sobj,char *name)
|
||||
{
|
||||
return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ SWIGRUNTIME PyTypeObject*
|
|||
_PySwigObject_type(void) {
|
||||
static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
|
||||
|
||||
static PyNumberMethods PySwigObject_as_number = {
|
||||
static PyNumberMethods SwigPyObject_as_number = {
|
||||
(binaryfunc)0, /*nb_add*/
|
||||
(binaryfunc)0, /*nb_subtract*/
|
||||
(binaryfunc)0, /*nb_multiply*/
|
||||
|
@ -659,12 +659,12 @@ _PySwigObject_type(void) {
|
|||
#if PY_VERSION_HEX < 0x03000000
|
||||
0, /*nb_coerce*/
|
||||
#endif
|
||||
(unaryfunc)PySwigObject_long, /*nb_int*/
|
||||
(unaryfunc)PySwigObject_long, /*nb_long*/
|
||||
(unaryfunc)SwigPyObject_long, /*nb_int*/
|
||||
(unaryfunc)SwigPyObject_long, /*nb_long*/
|
||||
(unaryfunc)0, /*nb_float*/
|
||||
#if PY_VERSION_HEX < 0x03000000
|
||||
(unaryfunc)PySwigObject_oct, /*nb_oct*/
|
||||
(unaryfunc)PySwigObject_hex, /*nb_hex*/
|
||||
(unaryfunc)SwigPyObject_oct, /*nb_oct*/
|
||||
(unaryfunc)SwigPyObject_hex, /*nb_hex*/
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
|
||||
|
@ -677,7 +677,7 @@ _PySwigObject_type(void) {
|
|||
#endif
|
||||
};
|
||||
|
||||
static PyTypeObject pyswigobject_type;
|
||||
static PyTypeObject swigpyobject_type;
|
||||
static int type_init = 0;
|
||||
if (!type_init) {
|
||||
const PyTypeObject tmp
|
||||
|
@ -689,25 +689,25 @@ _PySwigObject_type(void) {
|
|||
PyObject_HEAD_INIT(NULL)
|
||||
0, /* ob_size */
|
||||
#endif
|
||||
(char *)"PySwigObject", /* tp_name */
|
||||
sizeof(PySwigObject), /* tp_basicsize */
|
||||
(char *)"SwigPyObject", /* tp_name */
|
||||
sizeof(SwigPyObject), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
(destructor)PySwigObject_dealloc, /* tp_dealloc */
|
||||
(printfunc)PySwigObject_print, /* tp_print */
|
||||
(destructor)SwigPyObject_dealloc, /* tp_dealloc */
|
||||
(printfunc)SwigPyObject_print, /* tp_print */
|
||||
#if PY_VERSION_HEX < 0x02020000
|
||||
(getattrfunc)PySwigObject_getattr, /* tp_getattr */
|
||||
(getattrfunc)SwigPyObject_getattr, /* tp_getattr */
|
||||
#else
|
||||
(getattrfunc)0, /* tp_getattr */
|
||||
#endif
|
||||
(setattrfunc)0, /* tp_setattr */
|
||||
(cmpfunc)PySwigObject_compare, /* tp_compare */
|
||||
(reprfunc)PySwigObject_repr, /* tp_repr */
|
||||
&PySwigObject_as_number, /* tp_as_number */
|
||||
(cmpfunc)SwigPyObject_compare, /* tp_compare */
|
||||
(reprfunc)SwigPyObject_repr, /* tp_repr */
|
||||
&SwigPyObject_as_number, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
(hashfunc)0, /* tp_hash */
|
||||
(ternaryfunc)0, /* tp_call */
|
||||
(reprfunc)PySwigObject_str, /* tp_str */
|
||||
(reprfunc)SwigPyObject_str, /* tp_str */
|
||||
PyObject_GenericGetAttr, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
|
@ -715,7 +715,7 @@ _PySwigObject_type(void) {
|
|||
swigobject_doc, /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
(richcmpfunc)PySwigObject_richcompare, /* tp_richcompare */
|
||||
(richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
#if PY_VERSION_HEX >= 0x02020000
|
||||
0, /* tp_iter */
|
||||
|
@ -746,20 +746,20 @@ _PySwigObject_type(void) {
|
|||
0,0,0,0 /* tp_alloc -> tp_next */
|
||||
#endif
|
||||
};
|
||||
pyswigobject_type = tmp;
|
||||
swigpyobject_type = tmp;
|
||||
/* for Python 3 we already assigned the ob_type in PyVarObject_HEAD_INIT() */
|
||||
#if PY_VERSION_HEX < 0x03000000
|
||||
pyswigobject_type.ob_type = &PyType_Type;
|
||||
swigpyobject_type.ob_type = &PyType_Type;
|
||||
#endif
|
||||
type_init = 1;
|
||||
}
|
||||
return &pyswigobject_type;
|
||||
return &swigpyobject_type;
|
||||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
PySwigObject_New(void *ptr, swig_type_info *ty, int own)
|
||||
SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
|
||||
{
|
||||
PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
|
||||
SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
|
||||
if (sobj) {
|
||||
sobj->ptr = ptr;
|
||||
sobj->ty = ty;
|
||||
|
@ -778,10 +778,10 @@ typedef struct {
|
|||
void *pack;
|
||||
swig_type_info *ty;
|
||||
size_t size;
|
||||
} PySwigPacked;
|
||||
} SwigPyPacked;
|
||||
|
||||
SWIGRUNTIME int
|
||||
PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
|
||||
SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
|
||||
{
|
||||
char result[SWIG_BUFFER_SIZE];
|
||||
fputs("<Swig Packed ", fp);
|
||||
|
@ -795,7 +795,7 @@ PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
|
|||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
PySwigPacked_repr(PySwigPacked *v)
|
||||
SwigPyPacked_repr(SwigPyPacked *v)
|
||||
{
|
||||
char result[SWIG_BUFFER_SIZE];
|
||||
if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
|
||||
|
@ -806,7 +806,7 @@ PySwigPacked_repr(PySwigPacked *v)
|
|||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
PySwigPacked_str(PySwigPacked *v)
|
||||
SwigPyPacked_str(SwigPyPacked *v)
|
||||
{
|
||||
char result[SWIG_BUFFER_SIZE];
|
||||
if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
|
||||
|
@ -817,7 +817,7 @@ PySwigPacked_str(PySwigPacked *v)
|
|||
}
|
||||
|
||||
SWIGRUNTIME int
|
||||
PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
|
||||
SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
|
||||
{
|
||||
size_t i = v->size;
|
||||
size_t j = w->size;
|
||||
|
@ -828,22 +828,22 @@ PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
|
|||
SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
|
||||
|
||||
SWIGRUNTIME PyTypeObject*
|
||||
PySwigPacked_type(void) {
|
||||
SwigPyPacked_type(void) {
|
||||
static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
|
||||
return type;
|
||||
}
|
||||
|
||||
SWIGRUNTIMEINLINE int
|
||||
PySwigPacked_Check(PyObject *op) {
|
||||
SwigPyPacked_Check(PyObject *op) {
|
||||
return ((op)->ob_type == _PySwigPacked_type())
|
||||
|| (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
|
||||
|| (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
|
||||
}
|
||||
|
||||
SWIGRUNTIME void
|
||||
PySwigPacked_dealloc(PyObject *v)
|
||||
SwigPyPacked_dealloc(PyObject *v)
|
||||
{
|
||||
if (PySwigPacked_Check(v)) {
|
||||
PySwigPacked *sobj = (PySwigPacked *) v;
|
||||
if (SwigPyPacked_Check(v)) {
|
||||
SwigPyPacked *sobj = (SwigPyPacked *) v;
|
||||
free(sobj->pack);
|
||||
}
|
||||
PyObject_DEL(v);
|
||||
|
@ -852,7 +852,7 @@ PySwigPacked_dealloc(PyObject *v)
|
|||
SWIGRUNTIME PyTypeObject*
|
||||
_PySwigPacked_type(void) {
|
||||
static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
|
||||
static PyTypeObject pyswigpacked_type;
|
||||
static PyTypeObject swigpypacked_type;
|
||||
static int type_init = 0;
|
||||
if (!type_init) {
|
||||
const PyTypeObject tmp
|
||||
|
@ -864,21 +864,21 @@ _PySwigPacked_type(void) {
|
|||
PyObject_HEAD_INIT(NULL)
|
||||
0, /* ob_size */
|
||||
#endif
|
||||
(char *)"PySwigPacked", /* tp_name */
|
||||
sizeof(PySwigPacked), /* tp_basicsize */
|
||||
(char *)"SwigPyPacked", /* tp_name */
|
||||
sizeof(SwigPyPacked), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
(destructor)PySwigPacked_dealloc, /* tp_dealloc */
|
||||
(printfunc)PySwigPacked_print, /* tp_print */
|
||||
(destructor)SwigPyPacked_dealloc, /* tp_dealloc */
|
||||
(printfunc)SwigPyPacked_print, /* tp_print */
|
||||
(getattrfunc)0, /* tp_getattr */
|
||||
(setattrfunc)0, /* tp_setattr */
|
||||
(cmpfunc)PySwigPacked_compare, /* tp_compare */
|
||||
(reprfunc)PySwigPacked_repr, /* tp_repr */
|
||||
(cmpfunc)SwigPyPacked_compare, /* tp_compare */
|
||||
(reprfunc)SwigPyPacked_repr, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
(hashfunc)0, /* tp_hash */
|
||||
(ternaryfunc)0, /* tp_call */
|
||||
(reprfunc)PySwigPacked_str, /* tp_str */
|
||||
(reprfunc)SwigPyPacked_str, /* tp_str */
|
||||
PyObject_GenericGetAttr, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
|
@ -917,20 +917,20 @@ _PySwigPacked_type(void) {
|
|||
0,0,0,0 /* tp_alloc -> tp_next */
|
||||
#endif
|
||||
};
|
||||
pyswigpacked_type = tmp;
|
||||
swigpypacked_type = tmp;
|
||||
/* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */
|
||||
#if PY_VERSION_HEX < 0x03000000
|
||||
pyswigpacked_type.ob_type = &PyType_Type;
|
||||
swigpypacked_type.ob_type = &PyType_Type;
|
||||
#endif
|
||||
type_init = 1;
|
||||
}
|
||||
return &pyswigpacked_type;
|
||||
return &swigpypacked_type;
|
||||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty)
|
||||
SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
|
||||
{
|
||||
PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
|
||||
SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
|
||||
if (sobj) {
|
||||
void *pack = malloc(size);
|
||||
if (pack) {
|
||||
|
@ -947,10 +947,10 @@ PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty)
|
|||
}
|
||||
|
||||
SWIGRUNTIME swig_type_info *
|
||||
PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
|
||||
SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
|
||||
{
|
||||
if (PySwigPacked_Check(obj)) {
|
||||
PySwigPacked *sobj = (PySwigPacked *)obj;
|
||||
if (SwigPyPacked_Check(obj)) {
|
||||
SwigPyPacked *sobj = (SwigPyPacked *)obj;
|
||||
if (sobj->size != size) return 0;
|
||||
memcpy(ptr, sobj->pack, size);
|
||||
return sobj->ty;
|
||||
|
@ -983,11 +983,11 @@ SWIG_This(void)
|
|||
#define SWIG_PYTHON_SLOW_GETSET_THIS
|
||||
#endif
|
||||
|
||||
SWIGRUNTIME PySwigObject *
|
||||
SWIGRUNTIME SwigPyObject *
|
||||
SWIG_Python_GetSwigThis(PyObject *pyobj)
|
||||
{
|
||||
if (PySwigObject_Check(pyobj)) {
|
||||
return (PySwigObject *) pyobj;
|
||||
if (SwigPyObject_Check(pyobj)) {
|
||||
return (SwigPyObject *) pyobj;
|
||||
} else {
|
||||
PyObject *obj = 0;
|
||||
#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
|
||||
|
@ -1023,12 +1023,12 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (obj && !PySwigObject_Check(obj)) {
|
||||
if (obj && !SwigPyObject_Check(obj)) {
|
||||
/* a PyObject is called 'this', try to get the 'real this'
|
||||
PySwigObject from it */
|
||||
SwigPyObject from it */
|
||||
return SWIG_Python_GetSwigThis(obj);
|
||||
}
|
||||
return (PySwigObject *)obj;
|
||||
return (SwigPyObject *)obj;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1037,7 +1037,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
|
|||
SWIGRUNTIME int
|
||||
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
|
||||
if (own == SWIG_POINTER_OWN) {
|
||||
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
|
||||
SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
|
||||
if (sobj) {
|
||||
int oldown = sobj->own;
|
||||
sobj->own = own;
|
||||
|
@ -1056,7 +1056,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
|
|||
if (ptr) *ptr = 0;
|
||||
return SWIG_OK;
|
||||
} else {
|
||||
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
|
||||
SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
|
||||
if (own)
|
||||
*own = 0;
|
||||
while (sobj) {
|
||||
|
@ -1070,7 +1070,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
|
|||
} else {
|
||||
swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
|
||||
if (!tc) {
|
||||
sobj = (PySwigObject *)sobj->next;
|
||||
sobj = (SwigPyObject *)sobj->next;
|
||||
} else {
|
||||
if (ptr) {
|
||||
int newmemory = 0;
|
||||
|
@ -1099,7 +1099,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
|
|||
} else {
|
||||
int res = SWIG_ERROR;
|
||||
if (flags & SWIG_POINTER_IMPLICIT_CONV) {
|
||||
PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
|
||||
SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
|
||||
if (data && !data->implicitconv) {
|
||||
PyObject *klass = data->klass;
|
||||
if (klass) {
|
||||
|
@ -1112,7 +1112,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
|
|||
impconv = 0;
|
||||
}
|
||||
if (impconv) {
|
||||
PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
|
||||
SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
|
||||
if (iobj) {
|
||||
void *vptr;
|
||||
res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
|
||||
|
@ -1174,7 +1174,7 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
|
|||
|
||||
SWIGRUNTIME int
|
||||
SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
|
||||
swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
|
||||
swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
|
||||
if (!to) return SWIG_ERROR;
|
||||
if (ty) {
|
||||
if (to != ty) {
|
||||
|
@ -1196,7 +1196,7 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t
|
|||
*/
|
||||
|
||||
SWIGRUNTIME PyObject*
|
||||
SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
|
||||
SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
|
||||
{
|
||||
#if (PY_VERSION_HEX >= 0x02020000)
|
||||
PyObject *inst = 0;
|
||||
|
@ -1293,9 +1293,9 @@ SWIG_Python_InitShadowInstance(PyObject *args) {
|
|||
if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
|
||||
return NULL;
|
||||
} else {
|
||||
PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
|
||||
SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
|
||||
if (sthis) {
|
||||
PySwigObject_append((PyObject*) sthis, obj[1]);
|
||||
SwigPyObject_append((PyObject*) sthis, obj[1]);
|
||||
} else {
|
||||
SWIG_Python_SetSwigThis(obj[0], obj[1]);
|
||||
}
|
||||
|
@ -1311,8 +1311,8 @@ SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
|
|||
return SWIG_Py_Void();
|
||||
} else {
|
||||
int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
|
||||
PyObject *robj = PySwigObject_New(ptr, type, own);
|
||||
PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0;
|
||||
PyObject *robj = SwigPyObject_New(ptr, type, own);
|
||||
SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
|
||||
if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
|
||||
PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
|
||||
if (inst) {
|
||||
|
@ -1328,7 +1328,7 @@ SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
|
|||
|
||||
SWIGRUNTIMEINLINE PyObject *
|
||||
SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
|
||||
return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
|
||||
return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------*
|
||||
|
@ -1399,8 +1399,8 @@ SWIG_Python_DestroyModule(void *vptr)
|
|||
for (i =0; i < swig_module->size; ++i) {
|
||||
swig_type_info *ty = types[i];
|
||||
if (ty->owndata) {
|
||||
PySwigClientData *data = (PySwigClientData *) ty->clientdata;
|
||||
if (data) PySwigClientData_Del(data);
|
||||
SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
|
||||
if (data) SwigPyClientData_Del(data);
|
||||
}
|
||||
}
|
||||
Py_DECREF(SWIG_This());
|
||||
|
@ -1500,9 +1500,9 @@ SWIG_Python_ArgFail(int argnum)
|
|||
}
|
||||
|
||||
SWIGRUNTIMEINLINE const char *
|
||||
PySwigObject_GetDesc(PyObject *self)
|
||||
SwigPyObject_GetDesc(PyObject *self)
|
||||
{
|
||||
PySwigObject *v = (PySwigObject *)self;
|
||||
SwigPyObject *v = (SwigPyObject *)self;
|
||||
swig_type_info *ty = v ? v->ty : 0;
|
||||
return ty ? ty->str : (char*)"";
|
||||
}
|
||||
|
@ -1512,10 +1512,10 @@ SWIG_Python_TypeError(const char *type, PyObject *obj)
|
|||
{
|
||||
if (type) {
|
||||
#if defined(SWIG_COBJECT_TYPES)
|
||||
if (obj && PySwigObject_Check(obj)) {
|
||||
const char *otype = (const char *) PySwigObject_GetDesc(obj);
|
||||
if (obj && SwigPyObject_Check(obj)) {
|
||||
const char *otype = (const char *) SwigPyObject_GetDesc(obj);
|
||||
if (otype) {
|
||||
PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
|
||||
PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
|
||||
type, otype);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
if ($result) {
|
||||
PyObject *robj = PyObject_CallMethod($result, (char *)"__deref__", NULL);
|
||||
if (robj && !PyErr_Occurred()) {
|
||||
PySwigObject_append((PyObject *) SWIG_Python_GetSwigThis($result),
|
||||
SwigPyObject_append((PyObject *) SWIG_Python_GetSwigThis($result),
|
||||
(PyObject *) SWIG_Python_GetSwigThis(robj));
|
||||
Py_DECREF(robj);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace swig {
|
|||
|
||||
%extend std::carray {
|
||||
%fragment(SWIG_Traits_frag(std::carray<_Type, _Size >), "header",
|
||||
fragment="PySwigIterator_T",
|
||||
fragment="SwigPyIterator_T",
|
||||
fragment=SWIG_Traits_frag(_Type),
|
||||
fragment="StdCarrayTraits") {
|
||||
namespace swig {
|
||||
|
@ -36,7 +36,7 @@ namespace swig {
|
|||
|
||||
%typemap(out,noblock=1) iterator, const_iterator {
|
||||
$result = SWIG_NewPointerObj(swig::make_output_iterator((const $type &)$1),
|
||||
swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
|
||||
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
|
||||
}
|
||||
|
||||
inline size_t __len__() const { return self->size(); }
|
||||
|
@ -46,7 +46,7 @@ namespace swig {
|
|||
inline void __setitem__(size_t i, const _Type& v) { (*self)[i] = v; }
|
||||
|
||||
|
||||
swig::PySwigIterator* __iter__(PyObject **PYTHON_SELF) {
|
||||
swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) {
|
||||
return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
%fragment("StdMapTraits","header",fragment="StdSequenceTraits")
|
||||
{
|
||||
namespace swig {
|
||||
template <class PySeq, class K, class T >
|
||||
template <class SwigPySeq, class K, class T >
|
||||
inline void
|
||||
assign(const PySeq& pyseq, std::map<K,T > *map) {
|
||||
assign(const SwigPySeq& swigpyseq, std::map<K,T > *map) {
|
||||
typedef typename std::map<K,T>::value_type value_type;
|
||||
typename PySeq::const_iterator it = pyseq.begin();
|
||||
for (;it != pyseq.end(); ++it) {
|
||||
typename SwigPySeq::const_iterator it = swigpyseq.begin();
|
||||
for (;it != swigpyseq.end(); ++it) {
|
||||
map->insert(value_type(it->first, it->second));
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
|||
static int asptr(PyObject *obj, map_type **val) {
|
||||
int res = SWIG_ERROR;
|
||||
if (PyDict_Check(obj)) {
|
||||
PyObject_var items = PyObject_CallMethod(obj,(char *)"items",NULL);
|
||||
SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
|
||||
%#if PY_VERSION_HEX >= 0x03000000
|
||||
/* In Python 3.x the ".items()" method return a dict_items object */
|
||||
items = PySequence_Fast(items, ".items() havn't returned a sequence!");
|
||||
|
@ -58,8 +58,8 @@
|
|||
}
|
||||
PyObject *obj = PyDict_New();
|
||||
for (const_iterator i= map.begin(); i!= map.end(); ++i) {
|
||||
swig::PyObject_var key = swig::from(i->first);
|
||||
swig::PyObject_var val = swig::from(i->second);
|
||||
swig::SwigVar_PyObject key = swig::from(i->first);
|
||||
swig::SwigVar_PyObject val = swig::from(i->second);
|
||||
PyDict_SetItem(obj, key, val);
|
||||
}
|
||||
return obj;
|
||||
|
@ -90,10 +90,10 @@
|
|||
};
|
||||
|
||||
template<class OutIterator, class FromOper, class ValueType = typename OutIterator::value_type>
|
||||
struct PyMapIterator_T : PySwigIteratorClosed_T<OutIterator, ValueType, FromOper>
|
||||
struct SwigPyMapIterator_T : SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper>
|
||||
{
|
||||
PyMapIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: PySwigIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
|
||||
SwigPyMapIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: SwigPyIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
@ -101,37 +101,37 @@
|
|||
|
||||
template<class OutIterator,
|
||||
class FromOper = from_key_oper<typename OutIterator::value_type> >
|
||||
struct PyMapKeyIterator_T : PyMapIterator_T<OutIterator, FromOper>
|
||||
struct SwigPyMapKeyIterator_T : SwigPyMapIterator_T<OutIterator, FromOper>
|
||||
{
|
||||
PyMapKeyIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: PyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
|
||||
SwigPyMapKeyIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template<typename OutIter>
|
||||
inline PySwigIterator*
|
||||
inline SwigPyIterator*
|
||||
make_output_key_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
|
||||
{
|
||||
return new PyMapKeyIterator_T<OutIter>(current, begin, end, seq);
|
||||
return new SwigPyMapKeyIterator_T<OutIter>(current, begin, end, seq);
|
||||
}
|
||||
|
||||
template<class OutIterator,
|
||||
class FromOper = from_value_oper<typename OutIterator::value_type> >
|
||||
struct PyMapValueIterator_T : PyMapIterator_T<OutIterator, FromOper>
|
||||
struct SwigPyMapValueITerator_T : SwigPyMapIterator_T<OutIterator, FromOper>
|
||||
{
|
||||
PyMapValueIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: PyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
|
||||
SwigPyMapValueITerator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<typename OutIter>
|
||||
inline PySwigIterator*
|
||||
inline SwigPyIterator*
|
||||
make_output_value_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
|
||||
{
|
||||
return new PyMapValueIterator_T<OutIter>(current, begin, end, seq);
|
||||
return new SwigPyMapValueITerator_T<OutIter>(current, begin, end, seq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -222,12 +222,12 @@
|
|||
}
|
||||
|
||||
%newobject key_iterator(PyObject **PYTHON_SELF);
|
||||
swig::PySwigIterator* key_iterator(PyObject **PYTHON_SELF) {
|
||||
swig::SwigPyIterator* key_iterator(PyObject **PYTHON_SELF) {
|
||||
return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
}
|
||||
|
||||
%newobject value_iterator(PyObject **PYTHON_SELF);
|
||||
swig::PySwigIterator* value_iterator(PyObject **PYTHON_SELF) {
|
||||
swig::SwigPyIterator* value_iterator(PyObject **PYTHON_SELF) {
|
||||
return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
%fragment("StdMultimapTraits","header",fragment="StdSequenceTraits")
|
||||
{
|
||||
namespace swig {
|
||||
template <class PySeq, class K, class T >
|
||||
template <class SwigPySeq, class K, class T >
|
||||
inline void
|
||||
assign(const PySeq& pyseq, std::multimap<K,T > *multimap) {
|
||||
assign(const SwigPySeq& swigpyseq, std::multimap<K,T > *multimap) {
|
||||
typedef typename std::multimap<K,T>::value_type value_type;
|
||||
typename PySeq::const_iterator it = pyseq.begin();
|
||||
for (;it != pyseq.end(); ++it) {
|
||||
typename SwigPySeq::const_iterator it = swigpyseq.begin();
|
||||
for (;it != swigpyseq.end(); ++it) {
|
||||
multimap->insert(value_type(it->first, it->second));
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
|||
static int asptr(PyObject *obj, std::multimap<K,T> **val) {
|
||||
int res = SWIG_ERROR;
|
||||
if (PyDict_Check(obj)) {
|
||||
PyObject_var items = PyObject_CallMethod(obj,(char *)"items",NULL);
|
||||
SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
|
||||
return traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||
} else {
|
||||
multimap_type *p;
|
||||
|
@ -55,8 +55,8 @@
|
|||
}
|
||||
PyObject *obj = PyDict_New();
|
||||
for (const_iterator i= multimap.begin(); i!= multimap.end(); ++i) {
|
||||
swig::PyObject_var key = swig::from(i->first);
|
||||
swig::PyObject_var val = swig::from(i->second);
|
||||
swig::SwigVar_PyObject key = swig::from(i->first);
|
||||
swig::SwigVar_PyObject val = swig::from(i->second);
|
||||
PyDict_SetItem(obj, key, val);
|
||||
}
|
||||
return obj;
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
%fragment("StdMultisetTraits","header",fragment="StdSequenceTraits")
|
||||
%{
|
||||
namespace swig {
|
||||
template <class PySeq, class T>
|
||||
template <class SwigPySeq, class T>
|
||||
inline void
|
||||
assign(const PySeq& pyseq, std::multiset<T>* seq) {
|
||||
// seq->insert(pyseq.begin(), pyseq.end()); // not used as not always implemented
|
||||
typedef typename PySeq::value_type value_type;
|
||||
typename PySeq::const_iterator it = pyseq.begin();
|
||||
for (;it != pyseq.end(); ++it) {
|
||||
assign(const SwigPySeq& swigpyseq, std::multiset<T>* seq) {
|
||||
// seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented
|
||||
typedef typename SwigPySeq::value_type value_type;
|
||||
typename SwigPySeq::const_iterator it = swigpyseq.begin();
|
||||
for (;it != swigpyseq.end(); ++it) {
|
||||
seq->insert(seq->end(),(value_type)(*it));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@
|
|||
}
|
||||
} else if (PySequence_Check(obj)) {
|
||||
if (PySequence_Size(obj) == 2) {
|
||||
swig::PyObject_var first = PySequence_GetItem(obj,0);
|
||||
swig::PyObject_var second = PySequence_GetItem(obj,1);
|
||||
swig::SwigVar_PyObject first = PySequence_GetItem(obj,0);
|
||||
swig::SwigVar_PyObject second = PySequence_GetItem(obj,1);
|
||||
res = get_pair(first, second, val);
|
||||
}
|
||||
} else {
|
||||
|
@ -92,8 +92,8 @@
|
|||
}
|
||||
} else if (PySequence_Check(obj)) {
|
||||
if (PySequence_Size(obj) == 2) {
|
||||
swig::PyObject_var first = PySequence_GetItem(obj,0);
|
||||
swig::PyObject_var second = PySequence_GetItem(obj,1);
|
||||
swig::SwigVar_PyObject first = PySequence_GetItem(obj,0);
|
||||
swig::SwigVar_PyObject second = PySequence_GetItem(obj,1);
|
||||
res = get_pair(first, second, val);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
%fragment("StdSetTraits","header",fragment="StdSequenceTraits")
|
||||
%{
|
||||
namespace swig {
|
||||
template <class PySeq, class T>
|
||||
template <class SwigPySeq, class T>
|
||||
inline void
|
||||
assign(const PySeq& pyseq, std::set<T>* seq) {
|
||||
// seq->insert(pyseq.begin(), pyseq.end()); // not used as not always implemented
|
||||
typedef typename PySeq::value_type value_type;
|
||||
typename PySeq::const_iterator it = pyseq.begin();
|
||||
for (;it != pyseq.end(); ++it) {
|
||||
assign(const SwigPySeq& swigpyseq, std::set<T>* seq) {
|
||||
// seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented
|
||||
typedef typename SwigPySeq::value_type value_type;
|
||||
typename SwigPySeq::const_iterator it = swigpyseq.begin();
|
||||
for (;it != swigpyseq.end(); ++it) {
|
||||
seq->insert(seq->end(),(value_type)(*it));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -738,7 +738,7 @@ public:
|
|||
Printv(f_shadow,
|
||||
"def _swig_setattr_nondynamic(self,class_type,name,value,static=1):\n",
|
||||
tab4, "if (name == \"thisown\"): return self.this.own(value)\n",
|
||||
tab4, "if (name == \"this\"):\n", tab4, tab4, "if type(value).__name__ == 'PySwigObject':\n", tab4, tab8, "self.__dict__[name] = value\n",
|
||||
tab4, "if (name == \"this\"):\n", tab4, tab4, "if type(value).__name__ == 'SwigPyObject':\n", tab4, tab8, "self.__dict__[name] = value\n",
|
||||
#ifdef USE_THISOWN
|
||||
tab4, tab8, "if hasattr(value,\"thisown\"): self.__dict__[\"thisown\"] = value.thisown\n", tab4, tab8, "del value.thisown\n",
|
||||
#endif
|
||||
|
@ -2741,7 +2741,7 @@ public:
|
|||
Printf(f_directors_h, " PyObject *swig_get_method(size_t method_index, const char *method_name) const {\n");
|
||||
Printf(f_directors_h, " PyObject *method = vtable[method_index];\n");
|
||||
Printf(f_directors_h, " if (!method) {\n");
|
||||
Printf(f_directors_h, " swig::PyObject_var name = SWIG_Python_str_FromChar(method_name);\n");
|
||||
Printf(f_directors_h, " swig::SwigVar_PyObject name = SWIG_Python_str_FromChar(method_name);\n");
|
||||
Printf(f_directors_h, " method = PyObject_GetAttr(swig_get_self(), name);\n");
|
||||
Printf(f_directors_h, " if (method == NULL) {\n");
|
||||
Printf(f_directors_h, " std::string msg = \"Method in class %s doesn't exist, undefined \";\n", classname);
|
||||
|
@ -2753,7 +2753,7 @@ public:
|
|||
Printf(f_directors_h, " return method;\n");
|
||||
Printf(f_directors_h, " }\n");
|
||||
Printf(f_directors_h, "private:\n");
|
||||
Printf(f_directors_h, " mutable swig::PyObject_var vtable[%d];\n", director_method_index);
|
||||
Printf(f_directors_h, " mutable swig::SwigVar_PyObject vtable[%d];\n", director_method_index);
|
||||
Printf(f_directors_h, "#endif\n\n");
|
||||
}
|
||||
|
||||
|
@ -3753,8 +3753,8 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
|||
Replaceall(tm, "$input", input);
|
||||
Delete(input);
|
||||
Replaceall(tm, "$owner", "0");
|
||||
/* Wrapper_add_localv(w, source, "swig::PyObject_var", source, "= 0", NIL); */
|
||||
Printv(wrap_args, "swig::PyObject_var ", source, ";\n", NIL);
|
||||
/* Wrapper_add_localv(w, source, "swig::SwigVar_PyObject", source, "= 0", NIL); */
|
||||
Printv(wrap_args, "swig::SwigVar_PyObject ", source, ";\n", NIL);
|
||||
|
||||
Printv(wrap_args, tm, "\n", NIL);
|
||||
Printv(arglist, "(PyObject *)", source, NIL);
|
||||
|
@ -3810,7 +3810,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
|||
if (target) {
|
||||
String *director = NewStringf("director_%s", mangle);
|
||||
Wrapper_add_localv(w, director, "Swig::Director *", director, "= 0", NIL);
|
||||
Wrapper_add_localv(w, source, "swig::PyObject_var", source, "= 0", NIL);
|
||||
Wrapper_add_localv(w, source, "swig::SwigVar_PyObject", source, "= 0", NIL);
|
||||
Printf(wrap_args, "%s = SWIG_DIRECTOR_CAST(%s);\n", director, nonconst);
|
||||
Printf(wrap_args, "if (!%s) {\n", director);
|
||||
Printf(wrap_args, "%s = SWIG_NewPointerObj(%s, SWIGTYPE%s, 0);\n", source, nonconst, mangle);
|
||||
|
@ -3821,7 +3821,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
|||
Delete(director);
|
||||
Printv(arglist, source, NIL);
|
||||
} else {
|
||||
Wrapper_add_localv(w, source, "swig::PyObject_var", source, "= 0", NIL);
|
||||
Wrapper_add_localv(w, source, "swig::SwigVar_PyObject", source, "= 0", NIL);
|
||||
Printf(wrap_args, "%s = SWIG_NewPointerObj(%s, SWIGTYPE%s, 0);\n", source, nonconst, mangle);
|
||||
//Printf(wrap_args, "%s = SWIG_NewPointerObj(%s, SWIGTYPE_p_%s, 0);\n",
|
||||
// source, nonconst, base);
|
||||
|
@ -3872,33 +3872,33 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
|||
Append(w->code, "PyObject* method = swig_get_method(swig_method_index, swig_method_name);\n");
|
||||
if (Len(parse_args) > 0) {
|
||||
if (use_parse || !modernargs) {
|
||||
Printf(w->code, "swig::PyObject_var result = PyObject_CallFunction(method, (char *)\"(%s)\" %s);\n", parse_args, arglist);
|
||||
Printf(w->code, "swig::SwigVar_PyObject result = PyObject_CallFunction(method, (char *)\"(%s)\" %s);\n", parse_args, arglist);
|
||||
} else {
|
||||
Printf(w->code, "swig::PyObject_var result = PyObject_CallFunctionObjArgs(method %s, NULL);\n", arglist);
|
||||
Printf(w->code, "swig::SwigVar_PyObject result = PyObject_CallFunctionObjArgs(method %s, NULL);\n", arglist);
|
||||
}
|
||||
} else {
|
||||
if (modernargs) {
|
||||
Append(w->code, "swig::PyObject_var args = PyTuple_New(0);\n");
|
||||
Append(w->code, "swig::PyObject_var result = PyObject_Call(method, (PyObject*) args, NULL);\n");
|
||||
Append(w->code, "swig::SwigVar_PyObject args = PyTuple_New(0);\n");
|
||||
Append(w->code, "swig::SwigVar_PyObject result = PyObject_Call(method, (PyObject*) args, NULL);\n");
|
||||
} else {
|
||||
Printf(w->code, "swig::PyObject_var result = PyObject_CallFunction(method, NULL, NULL);\n");
|
||||
Printf(w->code, "swig::SwigVar_PyObject result = PyObject_CallFunction(method, NULL, NULL);\n");
|
||||
}
|
||||
}
|
||||
Append(w->code, "#else\n");
|
||||
if (Len(parse_args) > 0) {
|
||||
if (use_parse || !modernargs) {
|
||||
Printf(w->code, "swig::PyObject_var result = PyObject_CallMethod(swig_get_self(), (char *)\"%s\", (char *)\"(%s)\" %s);\n",
|
||||
Printf(w->code, "swig::SwigVar_PyObject result = PyObject_CallMethod(swig_get_self(), (char *)\"%s\", (char *)\"(%s)\" %s);\n",
|
||||
pyname, parse_args, arglist);
|
||||
} else {
|
||||
Printf(w->code, "swig::PyObject_var swig_method_name = SWIG_Python_str_FromChar((char *)\"%s\");\n", pyname);
|
||||
Printf(w->code, "swig::PyObject_var result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name %s, NULL);\n", arglist);
|
||||
Printf(w->code, "swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar((char *)\"%s\");\n", pyname);
|
||||
Printf(w->code, "swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name %s, NULL);\n", arglist);
|
||||
}
|
||||
} else {
|
||||
if (!modernargs) {
|
||||
Printf(w->code, "swig::PyObject_var result = PyObject_CallMethod(swig_get_self(), (char *) \"%s\", NULL);\n", pyname);
|
||||
Printf(w->code, "swig::SwigVar_PyObject result = PyObject_CallMethod(swig_get_self(), (char *) \"%s\", NULL);\n", pyname);
|
||||
} else {
|
||||
Printf(w->code, "swig::PyObject_var swig_method_name = SWIG_Python_str_FromChar((char *)\"%s\");\n", pyname);
|
||||
Append(w->code, "swig::PyObject_var result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);\n");
|
||||
Printf(w->code, "swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar((char *)\"%s\");\n", pyname);
|
||||
Append(w->code, "swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);\n");
|
||||
}
|
||||
}
|
||||
Append(w->code, "#endif\n");
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
"""
|
||||
From SWIG 1.3.37 we deprecated all SWIG symbols that start with Py,
|
||||
since they are inappropriate and discouraged in Python documentation
|
||||
(from http://www.python.org/doc/2.5.2/api/includes.html):
|
||||
|
||||
"All user visible names defined by Python.h (except those defined by the included
|
||||
standard headers) have one of the prefixes "Py" or "_Py". Names beginning with
|
||||
"_Py" are for internal use by the Python implementation and should not be used
|
||||
by extension writers. Structure member names do not have a reserved prefix.
|
||||
|
||||
Important: user code should never define names that begin with "Py" or "_Py".
|
||||
This confuses the reader, and jeopardizes the portability of the user code to
|
||||
future Python versions, which may define additional names beginning with one
|
||||
of these prefixes."
|
||||
|
||||
This file is a simple script used for change all of these symbols, for user code
|
||||
or SWIG itself.
|
||||
"""
|
||||
import re
|
||||
from shutil import copyfile
|
||||
import sys
|
||||
|
||||
symbols = [
|
||||
#(old name, new name)
|
||||
("PySequence_Base", "SwigPySequence_Base"),
|
||||
("PySequence_Cont", "SwigPySequence_Cont"),
|
||||
("PySwigIterator_T", "SwigPyIterator_T"),
|
||||
("PyPairBoolOutputIterator", "SwigPyPairBoolOutputIterator"),
|
||||
("PySwigIterator", "SwigPyIterator"),
|
||||
("PySwigIterator_T", "SwigPyIterator_T"),
|
||||
("PyMapIterator_T", "SwigPyMapIterator_T"),
|
||||
("PyMapKeyIterator_T", "SwigPyMapKeyIterator_T"),
|
||||
("PyMapValueIterator_T", "SwigPyMapValueITerator_T"),
|
||||
("PyObject_ptr", "SwigPtr_PyObject"),
|
||||
("PyObject_var", "SwigVar_PyObject"),
|
||||
("PyOper", "SwigPyOper"),
|
||||
("PySeq", "SwigPySeq"),
|
||||
("PySequence_ArrowProxy", "SwigPySequence_ArrowProxy"),
|
||||
("PySequence_Cont", "SwigPySequence_Cont"),
|
||||
("PySequence_InputIterator", "SwigPySequence_InputIterator"),
|
||||
("PySequence_Ref", "SwigPySequence_Ref"),
|
||||
("PySwigClientData", "SwigPyClientData"),
|
||||
("PySwigClientData_Del", "SwigPyClientData_Del"),
|
||||
("PySwigClientData_New", "SwigPyClientData_New"),
|
||||
("PySwigIterator", "SwigPyIterator"),
|
||||
("PySwigIteratorClosed_T", "SwigPyIteratorClosed_T"),
|
||||
("PySwigIteratorOpen_T", "SwigPyIteratorOpen_T"),
|
||||
("PySwigIterator_T", "SwigPyIterator_T"),
|
||||
("PySwigObject", "SwigPyObject"),
|
||||
("PySwigObject_Check", "SwigPyObject_Check"),
|
||||
("PySwigObject_GetDesc", "SwigPyObject_GetDesc"),
|
||||
("PySwigObject_New", "SwigPyObject_New"),
|
||||
("PySwigObject_acquire", "SwigPyObject_acquire"),
|
||||
("PySwigObject_append", "SwigPyObject_append"),
|
||||
("PySwigObject_as_number", "SwigPyObject_as_number"),
|
||||
("PySwigObject_compare", "SwigPyObject_compare"),
|
||||
("PySwigObject_dealloc", "SwigPyObject_dealloc"),
|
||||
("PySwigObject_disown", "SwigPyObject_disown"),
|
||||
("PySwigObject_format", "SwigPyObject_format"),
|
||||
("PySwigObject_getattr", "SwigPyObject_getattr"),
|
||||
("PySwigObject_hex", "SwigPyObject_hex"),
|
||||
("PySwigObject_long", "SwigPyObject_long"),
|
||||
("PySwigObject_next", "SwigPyObject_next"),
|
||||
("PySwigObject_oct", "SwigPyObject_oct"),
|
||||
("PySwigObject_own", "SwigPyObject_own"),
|
||||
("PySwigObject_print", "SwigPyObject_print"),
|
||||
("PySwigObject_repr", "SwigPyObject_repr"),
|
||||
("PySwigObject_richcompare", "SwigPyObject_richcompare"),
|
||||
("PySwigObject_str", "SwigPyObject_str"),
|
||||
("PySwigObject_type", "SwigPyObject_type"),
|
||||
("PySwigPacked", "SwigPyPacked"),
|
||||
("PySwigPacked_Check", "SwigPyPacked_Check"),
|
||||
("PySwigPacked_New", "SwigPyPacked_New"),
|
||||
("PySwigPacked_UnpackData", "SwigPyPacked_UnpackData"),
|
||||
("PySwigPacked_compare", "SwigPyPacked_compare"),
|
||||
("PySwigPacked_dealloc", "SwigPyPacked_dealloc"),
|
||||
("PySwigPacked_print", "SwigPyPacked_print"),
|
||||
("PySwigPacked_repr", "SwigPyPacked_repr"),
|
||||
("PySwigPacked_str", "SwigPyPacked_str"),
|
||||
("PySwigPacked_type", "SwigPyPacked_type"),
|
||||
("pyseq", "swigpyseq"),
|
||||
("pyswigobject_type", "swigpyobject_type"),
|
||||
("pyswigpacked_type", "swigpypacked_type"),
|
||||
]
|
||||
|
||||
res = [(re.compile("\\b(%s)\\b"%oldname), newname) for oldname, newname in symbols]
|
||||
|
||||
def patch_file(fn):
|
||||
newf = []
|
||||
changed = False
|
||||
for line in open(fn):
|
||||
for r, newname in res:
|
||||
line, n = r.subn(newname, line)
|
||||
if n>0:
|
||||
changed = True
|
||||
newf.append(line)
|
||||
|
||||
if changed:
|
||||
copyfile(fn, fn+".bak")
|
||||
f = open(fn, "w")
|
||||
f.write("".join(newf))
|
||||
f.close()
|
||||
return changed
|
||||
|
||||
def main(fns):
|
||||
for fn in fns:
|
||||
try:
|
||||
if patch_file(fn):
|
||||
print "Patched file", fn
|
||||
except IOError:
|
||||
print "Error occured during patching", fn
|
||||
return
|
||||
|
||||
if __name__=="__main__":
|
||||
if len(sys.argv) > 1:
|
||||
main(sys.argv[1:])
|
||||
else:
|
||||
print "Patch your interface file for SWIG's Py* symbol name deprecation."
|
||||
print "Usage:"
|
||||
print " %s files..."%sys.argv[0]
|
||||
|
||||
|
Loading…
Reference in New Issue