Abstract directors and typemap fixes.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5024 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Mark Rose 2003-08-30 05:03:34 +00:00
commit c1b57370b6
10 changed files with 97 additions and 17 deletions

View file

@ -53,6 +53,7 @@ class SWIG_DIRECTOR_PURE_VIRTUAL_EXCEPTION: public SWIG_DIRECTOR_EXCEPTION { };
#endif
#endif
/* director base class */
class __DIRECTOR__ {
private:
@ -171,6 +172,7 @@ public:
};
namespace {
int __DIRECTOR__::_up = 0;
#ifdef __PTHREAD__
@ -179,6 +181,8 @@ int __DIRECTOR__::_up = 0;
int __DIRECTOR__::_mutex_active = 0;
#endif
}
#endif /* __cplusplus */

View file

@ -435,6 +435,7 @@
%typemap(inv,parse="d") double "";
%typemap(inv,parse="s") char* "";
%typemap(inv,parse="i") bool "";
%typemap(inv,parse="i") enum SWIGTYPE "";
%typemap(inv,parse="l") unsigned int, unsigned short, unsigned long, unsigned char "(long) $1_name";
@ -453,6 +454,7 @@
%typemap(inv, parse="O") PyObject* "";
%typemap(inv, parse="l") std::size_t "(long) $input";
/* // this is rather dangerous
%typemap(inv) SWIGTYPE {
@ -514,6 +516,7 @@ OUTV_TYPEMAP(double, PyFloat_AsDouble);
OUTV_TYPEMAP(bool, PyInt_AsLong);
OUTV_TYPEMAP(PyObject *, );
OUTV_TYPEMAP(char *, PyString_AsString);
OUTV_TYPEMAP(std::size_t, PyInt_AsLong);
/* Object returned by value. Convert from a pointer */
%typemap(outv) SWIGTYPE ($&ltype argp)

View file

@ -72,7 +72,7 @@ SwigComplex_AsComplexDouble(PyObject *o)
}
%typemap(inv) const complex<T> & {
$inupt = PyComplex_FromDoubles($1_name->real(), $1_name->imag());
$input = PyComplex_FromDoubles($1_name->real(), $1_name->imag());
}
%typemap(outv) complex<T> {

View file

@ -203,9 +203,9 @@ namespace std {
}
}
%typemap(inv) vector<T> {
$input = PyTuple_New($1.size());
for (unsigned int i=0; i<$1.size(); i++) {
T* ptr = new T((($1_type &)$1)[i]);
$input = PyTuple_New($1_name.size());
for (unsigned int i=0; i<$1_name.size(); i++) {
T* ptr = new T((($1_type &)$1_name)[i]);
PyTuple_SetItem($input,i,
SWIG_NewPointerObj((void *) ptr,
$descriptor(T *), 1));
@ -486,7 +486,7 @@ namespace std {
%typemap(inv) vector<T> {
$input = PyTuple_New($1_name.size());
for (unsigned int i=0; i<$1_name.size(); i++) {
T ptr = (($1_type &)$1)[i];
T ptr = (($1_type &)$1_name)[i];
PyTuple_SetItem($input,i,
SWIG_NewPointerObj((void *) ptr,
$descriptor(T), 0));