adding more missing typemaps

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7785 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-11-03 11:11:21 +00:00
commit ea0c2ca342
7 changed files with 67 additions and 1 deletions

View file

@ -26,6 +26,27 @@
%fragment("PySequence_Base","header")
{
namespace swig {
template <> struct traits<PyObject *> {
typedef value_category category;
static const char* type_name() { return "PyObject *"; }
};
template <> struct traits_asval<PyObject * > {
typedef PyObject * value_type;
static int asval(PyObject *obj, value_type *val) {
if (val) *val = obj;
return SWIG_OK;
}
};
template <> struct traits_from<PyObject *> {
typedef PyObject * value_type;
static PyObject *from(const value_type& val) {
Py_XINCREF(val);
return val;
}
};
}
namespace swig {
inline size_t

View file

@ -73,6 +73,17 @@
%typemap(in,numinputs=0) PyObject **PYTHON_SELF "$1 = &obj0;";
/* For output, we increase the reference object */
%typemap(out,noblock=1) PyObject * {
Py_XINCREF($1);
$result = $1;
}
%typemap(out,noblock=1) PyObject * const & {
Py_XINCREF(*$1);
$result = *$1;
}
/* Consttab, needed for callbacks, it should be removed later */
%typemap(consttab) SWIGTYPE ((*)(ANY))
@ -82,3 +93,5 @@