*** empty log message ***

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4793 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Luigi Ballabio 2003-05-19 09:13:12 +00:00
commit 1a2c2c6ebc

View file

@ -76,7 +76,10 @@ namespace std {
template<class T> class vector { template<class T> class vector {
%typemap(in) vector<T> (std::vector<T>* v) { %typemap(in) vector<T> (std::vector<T>* v) {
if (SvROK($input)) { if (SWIG_ConvertPtr($input,(void **) &v,
$&1_descriptor,1) != -1) {
$1 = *v;
} else if (SvROK($input)) {
AV *av = (AV *)SvRV($input); AV *av = (AV *)SvRV($input);
if (SvTYPE(av) != SVt_PVAV) if (SvTYPE(av) != SVt_PVAV)
SWIG_croak("Type error in argument $argnum of $symname. " SWIG_croak("Type error in argument $argnum of $symname. "
@ -95,9 +98,6 @@ namespace std {
"Expected an array of " #T); "Expected an array of " #T);
} }
} }
} else if (SWIG_ConvertPtr($input,(void **) &v,
$&1_descriptor,1) != -1){
$1 = *v;
} else { } else {
SWIG_croak("Type error in argument $argnum of $symname. " SWIG_croak("Type error in argument $argnum of $symname. "
"Expected an array of " #T); "Expected an array of " #T);
@ -107,7 +107,10 @@ namespace std {
std::vector<T>* v), std::vector<T>* v),
const vector<T>* (std::vector<T> temp, const vector<T>* (std::vector<T> temp,
std::vector<T>* v) { std::vector<T>* v) {
if (SvROK($input)) { if (SWIG_ConvertPtr($input,(void **) &v,
$1_descriptor,1) != -1) {
$1 = v;
} else if (SvROK($input)) {
AV *av = (AV *)SvRV($input); AV *av = (AV *)SvRV($input);
if (SvTYPE(av) != SVt_PVAV) if (SvTYPE(av) != SVt_PVAV)
SWIG_croak("Type error in argument $argnum of $symname. " SWIG_croak("Type error in argument $argnum of $symname. "
@ -127,9 +130,6 @@ namespace std {
} }
} }
$1 = &temp; $1 = &temp;
} else if (SWIG_ConvertPtr($input,(void **) &v,
$1_descriptor,1) != -1){
$1 = v;
} else { } else {
SWIG_croak("Type error in argument $argnum of $symname. " SWIG_croak("Type error in argument $argnum of $symname. "
"Expected an array of " #T); "Expected an array of " #T);
@ -150,66 +150,68 @@ namespace std {
argvi++; argvi++;
} }
%typecheck(SWIG_TYPECHECK_VECTOR) vector<T> { %typecheck(SWIG_TYPECHECK_VECTOR) vector<T> {
/* native sequence? */ {
if (SvROK($input)) {
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
SV **tv;
I32 len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
} else {
/* check the first element only */
T* obj;
tv = av_fetch(av, 0, 0);
if (SWIG_ConvertPtr(*tv, (void **)&obj,
$descriptor(T *),0) != -1)
$1 = 1;
else
$1 = 0;
}
}
} else {
/* wrapped vector? */ /* wrapped vector? */
std::vector<T >* v; std::vector<T >* v;
if (SWIG_ConvertPtr($input,(void **) &v, if (SWIG_ConvertPtr($input,(void **) &v,
$1_&descriptor,0) != -1) $1_&descriptor,0) != -1) {
$1 = 1; $1 = 1;
else } else if (SvROK($input)) {
/* native sequence? */
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
SV **tv;
I32 len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
} else {
/* check the first element only */
T* obj;
tv = av_fetch(av, 0, 0);
if (SWIG_ConvertPtr(*tv, (void **)&obj,
$descriptor(T *),0) != -1)
$1 = 1;
else
$1 = 0;
}
}
} else {
$1 = 0; $1 = 0;
}
} }
} }
%typecheck(SWIG_TYPECHECK_VECTOR) const vector<T>&, %typecheck(SWIG_TYPECHECK_VECTOR) const vector<T>&,
const vector<T>* { const vector<T>* {
/* native sequence? */ {
if (SvROK($input)) {
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
SV **tv;
I32 len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
} else {
/* check the first element only */
T* obj;
tv = av_fetch(av, 0, 0);
if (SWIG_ConvertPtr(*tv, (void **)&obj,
$descriptor(T *),0) != -1)
$1 = 1;
else
$1 = 0;
}
}
} else {
/* wrapped vector? */ /* wrapped vector? */
std::vector<T >* v; std::vector<T >* v;
if (SWIG_ConvertPtr($input,(void **) &v, if (SWIG_ConvertPtr($input,(void **) &v,
$1_descriptor,0) != -1) $1_descriptor,0) != -1) {
$1 = 1; $1 = 1;
else } else if (SvROK($input)) {
/* native sequence? */
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
SV **tv;
I32 len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
} else {
/* check the first element only */
T* obj;
tv = av_fetch(av, 0, 0);
if (SWIG_ConvertPtr(*tv, (void **)&obj,
$descriptor(T *),0) != -1)
$1 = 1;
else
$1 = 0;
}
}
} else {
$1 = 0; $1 = 0;
}
} }
} }
public: public:
@ -250,7 +252,10 @@ namespace std {
%define specialize_std_vector(T,CHECK_T,TO_T,FROM_T) %define specialize_std_vector(T,CHECK_T,TO_T,FROM_T)
template<> class vector<T> { template<> class vector<T> {
%typemap(in) vector<T> (std::vector<T>* v) { %typemap(in) vector<T> (std::vector<T>* v) {
if (SvROK($input)) { if (SWIG_ConvertPtr($input,(void **) &v,
$&1_descriptor,1) != -1){
$1 = *v;
} else if (SvROK($input)) {
AV *av = (AV *)SvRV($input); AV *av = (AV *)SvRV($input);
if (SvTYPE(av) != SVt_PVAV) if (SvTYPE(av) != SVt_PVAV)
SWIG_croak("Type error in argument $argnum of $symname. " SWIG_croak("Type error in argument $argnum of $symname. "
@ -267,9 +272,6 @@ namespace std {
"Expected an array of " #T); "Expected an array of " #T);
} }
} }
} else if (SWIG_ConvertPtr($input,(void **) &v,
$&1_descriptor,1) != -1){
$1 = *v;
} else { } else {
SWIG_croak("Type error in argument $argnum of $symname. " SWIG_croak("Type error in argument $argnum of $symname. "
"Expected an array of " #T); "Expected an array of " #T);
@ -279,7 +281,10 @@ namespace std {
std::vector<T>* v), std::vector<T>* v),
const vector<T>* (std::vector<T> temp, const vector<T>* (std::vector<T> temp,
std::vector<T>* v) { std::vector<T>* v) {
if (SvROK($input)) { if (SWIG_ConvertPtr($input,(void **) &v,
$1_descriptor,1) != -1) {
$1 = v;
} else if (SvROK($input)) {
AV *av = (AV *)SvRV($input); AV *av = (AV *)SvRV($input);
if (SvTYPE(av) != SVt_PVAV) if (SvTYPE(av) != SVt_PVAV)
SWIG_croak("Type error in argument $argnum of $symname. " SWIG_croak("Type error in argument $argnum of $symname. "
@ -298,9 +303,6 @@ namespace std {
} }
} }
$1 = &temp; $1 = &temp;
} else if (SWIG_ConvertPtr($input,(void **) &v,
$1_descriptor,1) != -1){
$1 = v;
} else { } else {
SWIG_croak("Type error in argument $argnum of $symname. " SWIG_croak("Type error in argument $argnum of $symname. "
"Expected an array of " #T); "Expected an array of " #T);
@ -320,65 +322,66 @@ namespace std {
argvi++; argvi++;
} }
%typecheck(SWIG_TYPECHECK_VECTOR) vector<T> { %typecheck(SWIG_TYPECHECK_VECTOR) vector<T> {
/* native sequence? */ {
if (SvROK($input)) {
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
SV **tv;
I32 len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
} else {
/* check the first element only */
tv = av_fetch(av, 0, 0);
if (CHECK_T(*tv))
$1 = 1;
else
$1 = 0;
}
}
} else {
/* wrapped vector? */ /* wrapped vector? */
std::vector<T >* v; std::vector<T >* v;
if (SWIG_ConvertPtr($input,(void **) &v, if (SWIG_ConvertPtr($input,(void **) &v,
$1_&descriptor,0) != -1) $1_&descriptor,0) != -1) {
$1 = 1; $1 = 1;
else } else if (SvROK($input)) {
/* native sequence? */
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
SV **tv;
I32 len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
} else {
/* check the first element only */
tv = av_fetch(av, 0, 0);
if (CHECK_T(*tv))
$1 = 1;
else
$1 = 0;
}
}
} else {
$1 = 0; $1 = 0;
}
} }
} }
%typecheck(SWIG_TYPECHECK_VECTOR) const vector<T>&, %typecheck(SWIG_TYPECHECK_VECTOR) const vector<T>&,
const vector<T>* { const vector<T>* {
/* native sequence? */ {
if (SvROK($input)) {
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
SV **tv;
I32 len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
} else {
/* check the first element only */
tv = av_fetch(av, 0, 0);
if (CHECK_T(*tv))
$1 = 1;
else
$1 = 0;
}
}
} else {
/* wrapped vector? */ /* wrapped vector? */
std::vector<T >* v; std::vector<T >* v;
if (SWIG_ConvertPtr($input,(void **) &v, if (SWIG_ConvertPtr($input,(void **) &v,
$1_descriptor,0) != -1) $1_descriptor,0) != -1) {
$1 = 1; $1 = 1;
else } else if (SvROK($input)) {
/* native sequence? */
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
SV **tv;
I32 len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
} else {
/* check the first element only */
tv = av_fetch(av, 0, 0);
if (CHECK_T(*tv))
$1 = 1;
else
$1 = 0;
}
}
} else {
$1 = 0; $1 = 0;
}
} }
} }
// add specialized typemaps here
public: public:
vector(); vector();
vector(unsigned int size, const T& value=T()); vector(unsigned int size, const T& value=T());