Merged first chunk of Guile changes contributed by John Lenz.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4858 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Matthias Köppe 2003-06-03 22:12:50 +00:00
commit 34ea7f03ef
22 changed files with 1061 additions and 460 deletions

View file

@ -75,7 +75,7 @@ namespace std {
for (unsigned long i=0; i<size; i++) {
SCM o = gh_vector_ref($input,gh_ulong2scm(i));
(($1_type &)$1)[i] =
*((T*) SWIG_MustGetPtr(o,$descriptor(T *),$argnum));
*((T*) SWIG_MustGetPtr(o,$descriptor(T *),$argnum, 0));
}
} else if (gh_null_p($input)) {
$1 = std::vector<T >();
@ -86,13 +86,13 @@ namespace std {
while (!gh_null_p(tail)) {
head = gh_car(tail);
tail = gh_cdr(tail);
$1.push_back(*((T*) SWIG_MustGetPtr(head,
$descriptor(T *),
$argnum)));
$1.push_back(*((T*)SWIG_MustGetPtr(head,
$descriptor(T *),
$argnum, 0)));
}
} else {
$1 = *(($&1_type)
SWIG_MustGetPtr($input,$&1_descriptor,$argnum));
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
}
}
%typemap(in) const vector<T>& (std::vector<T> temp),
@ -105,7 +105,7 @@ namespace std {
SCM o = gh_vector_ref($input,gh_ulong2scm(i));
temp[i] = *((T*) SWIG_MustGetPtr(o,
$descriptor(T *),
$argnum));
$argnum, 0));
}
} else if (gh_null_p($input)) {
temp = std::vector<T >();
@ -120,10 +120,10 @@ namespace std {
tail = gh_cdr(tail);
temp.push_back(*((T*) SWIG_MustGetPtr(head,
$descriptor(T *),
$argnum)));
$argnum, 0)));
}
} else {
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum);
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
%typemap(out) vector<T> {
@ -131,7 +131,7 @@ namespace std {
for (unsigned int i=0; i<$1.size(); i++) {
T* x = new T((($1_type &)$1)[i]);
gh_vector_set_x($result,gh_long2scm(i),
SWIG_MakePtr(x,$descriptor(T *)));
SWIG_NewPointerObj(x, $descriptor(T *), 1));
}
}
%typecheck(SWIG_TYPECHECK_VECTOR) vector<T> {
@ -145,8 +145,8 @@ namespace std {
/* check the first element only */
SCM o = gh_vector_ref($input,gh_ulong2scm(0));
T* x;
if (SWIG_GetPtr(o,(void**) &x,
$descriptor(T *)) == 0)
if (SWIG_ConvertPtr(o,(void**) &x,
$descriptor(T *), 0) != -1)
$1 = 1;
else
$1 = 0;
@ -158,16 +158,16 @@ namespace std {
/* check the first element only */
T* x;
SCM head = gh_car($input);
if (SWIG_GetPtr(head,(void**) &x,
$descriptor(T *)) == 0)
if (SWIG_ConvertPtr(head,(void**) &x,
$descriptor(T *), 0) != -1)
$1 = 1;
else
$1 = 0;
} else {
/* wrapped vector? */
std::vector<T >* v;
if (SWIG_GetPtr($input,(void **) &v,
$&1_descriptor) == 0)
if (SWIG_ConvertPtr($input,(void **) &v,
$&1_descriptor, 0) != -1)
$1 = 1;
else
$1 = 0;
@ -185,8 +185,8 @@ namespace std {
/* check the first element only */
T* x;
SCM o = gh_vector_ref($input,gh_ulong2scm(0));
if (SWIG_GetPtr(o,(void**) &x,
$descriptor(T *)) == 0)
if (SWIG_ConvertPtr(o,(void**) &x,
$descriptor(T *), 0) != -1)
$1 = 1;
else
$1 = 0;
@ -198,16 +198,16 @@ namespace std {
/* check the first element only */
T* x;
SCM head = gh_car($input);
if (SWIG_GetPtr(head,(void**) &x,
$descriptor(T *)) == 0)
if (SWIG_ConvertPtr(head,(void**) &x,
$descriptor(T *), 0) != -1)
$1 = 1;
else
$1 = 0;
} else {
/* wrapped vector? */
std::vector<T >* v;
if (SWIG_GetPtr($input,(void **) &v,
$1_descriptor) == 0)
if (SWIG_ConvertPtr($input,(void **) &v,
$1_descriptor, 0) != -1)
$1 = 1;
else
$1 = 0;
@ -282,7 +282,7 @@ namespace std {
}
} else {
$1 = *(($&1_type)
SWIG_MustGetPtr($input,$&1_descriptor,$argnum));
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
}
}
%typemap(in) const vector<T>& (std::vector<T> temp),
@ -314,8 +314,7 @@ namespace std {
scm_wrong_type_arg(FUNC_NAME, $argnum, $input);
}
} else {
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,
$argnum);
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
%typemap(out) vector<T> {
@ -349,8 +348,8 @@ namespace std {
} else {
/* wrapped vector? */
std::vector<T >* v;
$1 = (SWIG_GetPtr($input,(void **) &v,
$&1_descriptor) == 0) ? 1 : 0;
$1 = (SWIG_ConvertPtr($input,(void **) &v,
$&1_descriptor, 0) != -1) ? 1 : 0;
}
}
%typecheck(SWIG_TYPECHECK_VECTOR) const vector<T>&,
@ -378,8 +377,8 @@ namespace std {
} else {
/* wrapped vector? */
std::vector<T >* v;
$1 = (SWIG_GetPtr($input,(void **) &v,
$1_descriptor) == 0) ? 1 : 0;
$1 = (SWIG_ConvertPtr($input,(void **) &v,
$1_descriptor, 0) != -1) ? 1 : 0;
}
}
public:
@ -428,12 +427,9 @@ namespace std {
specialize_stl_vector(short,gh_number_p,gh_scm2long,gh_long2scm);
specialize_stl_vector(unsigned int,gh_number_p,gh_scm2ulong,gh_ulong2scm);
specialize_stl_vector(unsigned long,gh_number_p,gh_scm2ulong,gh_ulong2scm);
specialize_stl_vector(unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_stl_vector(unsigned short,gh_number_p,gh_scm2ulong,gh_ulong2scm);
specialize_stl_vector(float,gh_number_p,gh_scm2double,gh_double2scm);
specialize_stl_vector(double,gh_number_p,gh_scm2double,gh_double2scm);
specialize_stl_vector(std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm);
specialize_stl_vector(std::string,gh_string_p,SWIG_scm2string,SWIG_string2scm);
}