Merge branch 'master' into doxygen
Merge 3.0.12 release changes from master.
This commit is contained in:
commit
294ab27b90
254 changed files with 4158 additions and 2457 deletions
|
|
@ -13,6 +13,11 @@ SWIGINTERN Py_hash_t
|
|||
SWIG_PyNumber_AsPyHash(PyObject *obj) {
|
||||
Py_hash_t result = -1;
|
||||
#if PY_VERSION_HEX < 0x03020000
|
||||
#if PY_VERSION_HEX < 0x03000000
|
||||
if (PyInt_Check(obj))
|
||||
result = PyInt_AsLong(obj);
|
||||
else
|
||||
#endif
|
||||
if (PyLong_Check(obj))
|
||||
result = PyLong_AsLong(obj);
|
||||
#else
|
||||
|
|
@ -21,7 +26,7 @@ SWIG_PyNumber_AsPyHash(PyObject *obj) {
|
|||
#endif
|
||||
else
|
||||
PyErr_Format(PyExc_TypeError, "Wrong type for hash function");
|
||||
return result;
|
||||
return PyErr_Occurred() ? -1 : result;
|
||||
}
|
||||
|
||||
SWIGINTERN int
|
||||
|
|
|
|||
|
|
@ -2,48 +2,8 @@
|
|||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%feature("python:slot", "sq_item", functype="ssizeargfunc") NAME::__getitem__;
|
||||
%feature("python:slot", "sq_ass_item", functype="ssizeobjargproc") NAME::__setitem__;
|
||||
|
||||
%inline %{
|
||||
typedef struct {
|
||||
TYPE *el;
|
||||
} NAME;
|
||||
%}
|
||||
|
||||
%extend NAME {
|
||||
|
||||
NAME(size_t nelements) {
|
||||
NAME *arr = %new_instance(NAME);
|
||||
arr->el = %new_array(nelements, TYPE);
|
||||
return arr;
|
||||
}
|
||||
|
||||
~NAME() {
|
||||
%delete_array(self->el);
|
||||
%delete(self);
|
||||
}
|
||||
|
||||
TYPE __getitem__(size_t index) {
|
||||
return self->el[index];
|
||||
}
|
||||
|
||||
void __setitem__(size_t index, TYPE value) {
|
||||
self->el[index] = value;
|
||||
}
|
||||
|
||||
TYPE * cast() {
|
||||
return self->el;
|
||||
}
|
||||
|
||||
static NAME *frompointer(TYPE *t) {
|
||||
return %reinterpret_cast(t, NAME *);
|
||||
}
|
||||
};
|
||||
|
||||
%types(NAME = TYPE);
|
||||
|
||||
#else
|
||||
%array_class_wrap(TYPE,NAME,__getitem__,__setitem__)
|
||||
#endif
|
||||
%array_class_wrap(TYPE,NAME,__getitem__,__setitem__)
|
||||
%enddef
|
||||
|
||||
%include <typemaps/carrays.swg>
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ namespace swig {
|
|||
|
||||
namespace std {
|
||||
template <>
|
||||
struct less <PyObject *>: public binary_function<PyObject *, PyObject *, bool>
|
||||
struct less <PyObject *>
|
||||
{
|
||||
bool
|
||||
operator()(PyObject * v, PyObject *w) const
|
||||
|
|
@ -133,7 +133,7 @@ namespace std {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct less <swig::SwigPtr_PyObject>: public binary_function<swig::SwigPtr_PyObject, swig::SwigPtr_PyObject, bool>
|
||||
struct less <swig::SwigPtr_PyObject>
|
||||
{
|
||||
bool
|
||||
operator()(const swig::SwigPtr_PyObject& v, const swig::SwigPtr_PyObject& w) const
|
||||
|
|
@ -143,7 +143,7 @@ namespace std {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct less <swig::SwigVar_PyObject>: public binary_function<swig::SwigVar_PyObject, swig::SwigVar_PyObject, bool>
|
||||
struct less <swig::SwigVar_PyObject>
|
||||
{
|
||||
bool
|
||||
operator()(const swig::SwigVar_PyObject& v, const swig::SwigVar_PyObject& w) const
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
int res2 = swig::asval((PyObject*)second, psecond);
|
||||
if (!SWIG_IsOK(res2)) return res2;
|
||||
return res1 > res2 ? res1 : res2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int asval(PyObject *obj, std::pair<T,U> *val) {
|
||||
|
|
@ -68,10 +68,16 @@
|
|||
value_type *vp = %new_instance(std::pair<T,U>);
|
||||
T *pfirst = &(vp->first);
|
||||
int res1 = swig::asval((PyObject*)first, pfirst);
|
||||
if (!SWIG_IsOK(res1)) return res1;
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
%delete(vp);
|
||||
return res1;
|
||||
}
|
||||
U *psecond = &(vp->second);
|
||||
int res2 = swig::asval((PyObject*)second, psecond);
|
||||
if (!SWIG_IsOK(res2)) return res2;
|
||||
if (!SWIG_IsOK(res2)) {
|
||||
%delete(vp);
|
||||
return res2;
|
||||
}
|
||||
*val = vp;
|
||||
return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
|
||||
} else {
|
||||
|
|
@ -82,7 +88,7 @@
|
|||
int res2 = swig::asval((PyObject*)second, psecond);
|
||||
if (!SWIG_IsOK(res2)) return res2;
|
||||
return res1 > res2 ? res1 : res2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int asptr(PyObject *obj, std::pair<T,U> **val) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue