Support building with recent versions of the Ruby 1.9 development branch.

Fixes bug #1560092.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9333 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2006-09-23 21:39:09 +00:00
commit 2f6a268e55
11 changed files with 137 additions and 118 deletions

View file

@ -48,10 +48,10 @@ namespace std {
template<class T> class vector {
%typemap(in) vector<T> {
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
unsigned int size = RARRAY_LEN($input);
$1;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY($input)->ptr[i];
VALUE o = RARRAY_PTR($input)[i];
T* x;
SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
$1.push_back(*x);
@ -65,10 +65,10 @@ namespace std {
%typemap(in) const vector<T>& (std::vector<T> temp),
const vector<T>* (std::vector<T> temp) {
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
unsigned int size = RARRAY_LEN($input);
$1 = &temp;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY($input)->ptr[i];
VALUE o = RARRAY_PTR($input)[i];
T* x;
SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
temp.push_back(*x);
@ -89,14 +89,14 @@ namespace std {
%typecheck(SWIG_TYPECHECK_VECTOR) vector<T> {
/* native sequence? */
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
unsigned int size = RARRAY_LEN($input);
if (size == 0) {
/* an empty sequence can be of any type */
$1 = 1;
} else {
/* check the first element only */
T* x;
VALUE o = RARRAY($input)->ptr[0];
VALUE o = RARRAY_PTR($input)[0];
if ((SWIG_ConvertPtr(o,(void **) &x,
$descriptor(T *),0)) != -1)
$1 = 1;
@ -117,14 +117,14 @@ namespace std {
const vector<T>* {
/* native sequence? */
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
unsigned int size = RARRAY_LEN($input);
if (size == 0) {
/* an empty sequence can be of any type */
$1 = 1;
} else {
/* check the first element only */
T* x;
VALUE o = RARRAY($input)->ptr[0];
VALUE o = RARRAY_PTR($input)[0];
if ((SWIG_ConvertPtr(o,(void **) &x,
$descriptor(T *),0)) != -1)
$1 = 1;
@ -194,10 +194,10 @@ namespace std {
template<class T> class vector<T*> {
%typemap(in) vector<T*> {
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
unsigned int size = RARRAY_LEN($input);
$1 = std::vector<T* >(size);
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY($input)->ptr[i];
VALUE o = RARRAY_PTR($input)[i];
T* x;
SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
(($1_type &)$1)[i] = x;
@ -211,11 +211,11 @@ namespace std {
%typemap(in) const vector<T*>& (std::vector<T*> temp),
const vector<T*>* (std::vector<T*> temp) {
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
unsigned int size = RARRAY_LEN($input);
temp = std::vector<T* >(size);
$1 = &temp;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY($input)->ptr[i];
VALUE o = RARRAY_PTR($input)[i];
T* x;
SWIG_ConvertPtr(o, (void **) &x, $descriptor(T *), 1);
temp[i] = x;
@ -236,14 +236,14 @@ namespace std {
%typecheck(SWIG_TYPECHECK_VECTOR) vector<T*> {
/* native sequence? */
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
unsigned int size = RARRAY_LEN($input);
if (size == 0) {
/* an empty sequence can be of any type */
$1 = 1;
} else {
/* check the first element only */
T* x;
VALUE o = RARRAY($input)->ptr[0];
VALUE o = RARRAY_PTR($input)[0];
if ((SWIG_ConvertPtr(o,(void **) &x,
$descriptor(T *),0)) != -1)
$1 = 1;
@ -264,14 +264,14 @@ namespace std {
const vector<T*>* {
/* native sequence? */
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
unsigned int size = RARRAY_LEN($input);
if (size == 0) {
/* an empty sequence can be of any type */
$1 = 1;
} else {
/* check the first element only */
T* x;
VALUE o = RARRAY($input)->ptr[0];
VALUE o = RARRAY_PTR($input)[0];
if ((SWIG_ConvertPtr(o,(void **) &x,
$descriptor(T *),0)) != -1)
$1 = 1;
@ -343,10 +343,10 @@ namespace std {
template<> class vector<T> {
%typemap(in) vector<T> {
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
unsigned int size = RARRAY_LEN($input);
$1 = std::vector<T >(size);
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY($input)->ptr[i];
VALUE o = RARRAY_PTR($input)[i];
if (CHECK(o))
(($1_type &)$1)[i] = (T)(CONVERT_FROM(o));
else
@ -363,11 +363,11 @@ namespace std {
%typemap(in) const vector<T>& (std::vector<T> temp),
const vector<T>* (std::vector<T> temp) {
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
unsigned int size = RARRAY_LEN($input);
temp = std::vector<T >(size);
$1 = &temp;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY($input)->ptr[i];
VALUE o = RARRAY_PTR($input)[i];
if (CHECK(o))
temp[i] = (T)(CONVERT_FROM(o));
else
@ -387,13 +387,13 @@ namespace std {
%typecheck(SWIG_TYPECHECK_VECTOR) vector<T> {
/* native sequence? */
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
unsigned int size = RARRAY_LEN($input);
if (size == 0) {
/* an empty sequence can be of any type */
$1 = 1;
} else {
/* check the first element only */
VALUE o = RARRAY($input)->ptr[0];
VALUE o = RARRAY_PTR($input)[0];
if (CHECK(o))
$1 = 1;
else
@ -413,13 +413,13 @@ namespace std {
const vector<T>* {
/* native sequence? */
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
unsigned int size = RARRAY_LEN($input);
if (size == 0) {
/* an empty sequence can be of any type */
$1 = 1;
} else {
/* check the first element only */
VALUE o = RARRAY($input)->ptr[0];
VALUE o = RARRAY_PTR($input)[0];
if (CHECK(o))
$1 = 1;
else