std::pair added (but not very much tested)

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4959 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Luigi Ballabio 2003-07-10 12:42:42 +00:00
commit 8c35d20048
12 changed files with 3782 additions and 0 deletions

View file

@ -1,6 +1,10 @@
Version 1.3.20 (In progress)
============================
07/10/2003: ballabio (Luigi Ballabio)
[Almost all languages] Wrappers for std::pair added.
Typemaps for Python, Ruby, Guile and MzScheme.
07/01/2003: mkoeppe (Matthias Koeppe)
[Chicken] Handle the case of more than one argout typemap
per function.

845
SWIG/Lib/guile/std_pair.i Normal file
View file

@ -0,0 +1,845 @@
//
// SWIG typemaps for std::pair
// Luigi Ballabio
// July 2003
//
// Guile implementation
%include std_common.i
// ------------------------------------------------------------------------
// std::pair
//
// See std_vector.i for the rationale of typemap application
// ------------------------------------------------------------------------
%{
#include <utility>
%}
// exported class
namespace std {
template<class K, class T> struct pair {
%typemap(in) pair<T,U> (std::pair<T,U>* m) {
if (gh_pair_p($input)) {
T* x;
U* y;
SCM first, second;
first = gh_car($input);
second = gh_cdr($input);
x = (T*) SWIG_MustGetPtr(first,$descriptor(T *),$argnum, 0);
y = (U*) SWIG_MustGetPtr(second,$descriptor(U *),$argnum, 0);
$1 = std::make_pair(x,y);
} else {
$1 = *(($&1_type)
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
}
}
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
std::pair<T,U>* m),
const pair<T,U>* (std::pair<T,U> temp,
std::pair<T,U>* m) {
if (gh_pair_p($input)) {
T* x;
U* y;
SCM first, second;
first = gh_car($input);
second = gh_cdr($input);
x = (T*) SWIG_MustGetPtr(first,$descriptor(T *),$argnum, 0);
y = (U*) SWIG_MustGetPtr(second,$descriptor(U *),$argnum, 0);
temp = std::make_pair(x,y);
$1 = &temp;
} else {
$1 = ($1_ltype)
SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
%typemap(out) pair<T,U> {
T* x = new T($1.first);
U* y = new U($1.second);
SCM first = SWIG_NewPointerObj(x,$descriptor(T *), 1);
SCM second = SWIG_NewPointerObj(y,$descriptor(U *), 1);
$result = gh_cons(first,second);
}
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
/* native pair? */
if (gh_pair_p($input)) {
T* x;
U* y;
SCM first = gh_car($input);
SCM second = gh_cdr($input);
if (SWIG_ConvertPtr(first,(void**) &x,
$descriptor(T *), 0) == 0 &&
SWIG_ConvertPtr(second,(void**) &y,
$descriptor(U *), 0) == 0) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$&1_descriptor, 0) == 0)
$1 = 1;
else
$1 = 0;
}
}
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
const pair<T,U>* {
/* native pair? */
if (gh_pair_p($input)) {
T* x;
U* y;
SCM first = gh_car($input);
SCM second = gh_cdr($input);
if (SWIG_ConvertPtr(first,(void**) &x,
$descriptor(T *), 0) == 0 &&
SWIG_ConvertPtr(second,(void**) &y,
$descriptor(U *), 0) == 0) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$1_descriptor, 0) == 0)
$1 = 1;
else
$1 = 0;
}
}
T first;
U second;
};
// specializations for built-ins
%define specialize_std_pair_on_first(T,CHECK,CONVERT_FROM,CONVERT_TO)
template<class U> struct pair<T,U> {
%typemap(in) pair<T,U> (std::pair<T,U>* m) {
if (gh_pair_p($input)) {
U* y;
SCM first, second;
first = gh_car($input);
second = gh_cdr($input);
if (!CHECK(first))
SWIG_exception(SWIG_TypeError,
"map<" #K "," #T "> expected");
y = (U*) SWIG_MustGetPtr(second,$descriptor(U *),$argnum, 0);
$1 = std::make_pair(CONVERT_FROM(first),y);
} else {
$1 = *(($&1_type)
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
}
}
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
std::pair<T,U>* m),
const pair<T,U>* (std::pair<T,U> temp,
std::pair<T,U>* m) {
if (gh_pair_p($input)) {
U* y;
SCM first, second;
first = gh_car($input);
second = gh_cdr($input);
if (!CHECK(first))
SWIG_exception(SWIG_TypeError,
"map<" #K "," #T "> expected");
y = (U*) SWIG_MustGetPtr(second,$descriptor(U *),$argnum, 0);
temp = std::make_pair(CONVERT_FROM(first),y);
$1 = &temp;
} else {
$1 = ($1_ltype)
SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
%typemap(out) pair<T,U> {
U* y = new U($1.second);
SCM second = SWIG_NewPointerObj(y,$descriptor(U *), 1);
$result = gh_cons(CONVERT_TO($1.first),second);
}
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
/* native pair? */
if (gh_pair_p($input)) {
U* y;
SCM first = gh_car($input);
SCM second = gh_cdr($input);
if (CHECK(first) &&
SWIG_ConvertPtr(second,(void**) &y,
$descriptor(U *), 0) == 0) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$&1_descriptor, 0) == 0)
$1 = 1;
else
$1 = 0;
}
}
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
const pair<T,U>* {
/* native pair? */
if (gh_pair_p($input)) {
U* y;
SCM first = gh_car($input);
SCM second = gh_cdr($input);
if (CHECK(first) &&
SWIG_ConvertPtr(second,(void**) &y,
$descriptor(U *), 0) == 0) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$1_descriptor, 0) == 0)
$1 = 1;
else
$1 = 0;
}
}
T first;
U second;
};
%enddef
%define specialize_std_pair_on_second(U,CHECK,CONVERT_FROM,CONVERT_TO)
template<class T> struct pair<T,U> {
%typemap(in) pair<T,U> (std::pair<T,U>* m) {
if (gh_pair_p($input)) {
T* x;
SCM first, second;
first = gh_car($input);
second = gh_cdr($input);
x = (T*) SWIG_MustGetPtr(first,$descriptor(T *),$argnum, 0);
if (!CHECK(second))
SWIG_exception(SWIG_TypeError,
"map<" #K "," #T "> expected");
$1 = std::make_pair(x,CONVERT_FROM(second));
} else {
$1 = *(($&1_type)
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
}
}
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
std::pair<T,U>* m),
const pair<T,U>* (std::pair<T,U> temp,
std::pair<T,U>* m) {
if (gh_pair_p($input)) {
T* x;
SCM first, second;
first = gh_car($input);
second = gh_cdr($input);
x = (T*) SWIG_MustGetPtr(first,$descriptor(T *),$argnum, 0);
if (!CHECK(second))
SWIG_exception(SWIG_TypeError,
"map<" #K "," #T "> expected");
temp = std::make_pair(x,CONVERT_FROM(second));
$1 = &temp;
} else {
$1 = ($1_ltype)
SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
%typemap(out) pair<T,U> {
T* x = new T($1.first);
SCM first = SWIG_NewPointerObj(x,$descriptor(T *), 1);
$result = gh_cons(first,CONVERT_TO($1.second));
}
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
/* native pair? */
if (gh_pair_p($input)) {
T* x;
SCM first = gh_car($input);
SCM second = gh_cdr($input);
if (SWIG_ConvertPtr(first,(void**) &x,
$descriptor(T *), 0) == 0 &&
CHECK(second)) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$&1_descriptor, 0) == 0)
$1 = 1;
else
$1 = 0;
}
}
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
const pair<T,U>* {
/* native pair? */
if (gh_pair_p($input)) {
T* x;
SCM first = gh_car($input);
SCM second = gh_cdr($input);
if (SWIG_ConvertPtr(first,(void**) &x,
$descriptor(T *), 0) == 0 &&
CHECK(second)) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$1_descriptor, 0) == 0)
$1 = 1;
else
$1 = 0;
}
}
T first;
U second;
};
%enddef
%define specialize_std_pair_on_both(T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO,
U,CHECK_U,CONVERT_U_FROM,CONVERT_U_TO)
template<> struct pair<T,U> {
%typemap(in) pair<T,U> (std::pair<T,U>* m) {
if (gh_pair_p($input)) {
SCM first, second;
first = gh_car($input);
second = gh_cdr($input);
if (!CHECK_T(first) || !CHECK_U(second))
SWIG_exception(SWIG_TypeError,
"map<" #K "," #T "> expected");
$1 = std::make_pair(CONVERT_T_FROM(first),
CONVERT_U_FROM(second));
} else {
$1 = *(($&1_type)
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
}
}
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
std::pair<T,U>* m),
const pair<T,U>* (std::pair<T,U> temp,
std::pair<T,U>* m) {
if (gh_pair_p($input)) {
SCM first, second;
first = gh_car($input);
second = gh_cdr($input);
if (!CHECK_T(first) || !CHECK_U(second))
SWIG_exception(SWIG_TypeError,
"map<" #K "," #T "> expected");
temp = std::make_pair(CONVERT_T_FROM(first),
CONVERT_U_FROM(second));
$1 = &temp;
} else {
$1 = ($1_ltype)
SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
%typemap(out) pair<T,U> {
$result = gh_cons(CONVERT_T_TO($1.first),
CONVERT_U_TO($1.second));
}
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
/* native pair? */
if (gh_pair_p($input)) {
SCM first = gh_car($input);
SCM second = gh_cdr($input);
if (CHECK_T(first) && CHECK_U(second)) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$&1_descriptor, 0) == 0)
$1 = 1;
else
$1 = 0;
}
}
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
const pair<T,U>* {
/* native pair? */
if (gh_pair_p($input)) {
SCM first = gh_car($input);
SCM second = gh_cdr($input);
if (CHECK_T(first) && CHECK_U(second)) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$1_descriptor, 0) == 0)
$1 = 1;
else
$1 = 0;
}
}
T first;
U second;
};
%enddef
specialize_std_pair_on_first(bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm);
specialize_std_pair_on_first(int,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_first(short,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_first(long,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_first(unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_first(unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_first(unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_first(double,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_first(float,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_first(std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm);
specialize_std_pair_on_second(bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm);
specialize_std_pair_on_second(int,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_second(short,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_second(long,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_second(unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_second(unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_second(unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_second(double,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_second(float,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_second(std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm);
specialize_std_pair_on_both(bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm,
bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm);
specialize_std_pair_on_both(bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm,
int,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm,
short,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm,
long,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm,
unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm,
unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm,
unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm,
double,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm,
float,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm,
std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm);
specialize_std_pair_on_both(int,gh_number_p,
gh_scm2long,gh_long2scm,
bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm);
specialize_std_pair_on_both(int,gh_number_p,
gh_scm2long,gh_long2scm,
int,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(int,gh_number_p,
gh_scm2long,gh_long2scm,
short,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(int,gh_number_p,
gh_scm2long,gh_long2scm,
long,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(int,gh_number_p,
gh_scm2long,gh_long2scm,
unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(int,gh_number_p,
gh_scm2long,gh_long2scm,
unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(int,gh_number_p,
gh_scm2long,gh_long2scm,
unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(int,gh_number_p,
gh_scm2long,gh_long2scm,
double,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(int,gh_number_p,
gh_scm2long,gh_long2scm,
float,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(int,gh_number_p,
gh_scm2long,gh_long2scm,
std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm);
specialize_std_pair_on_both(short,gh_number_p,
gh_scm2long,gh_long2scm,
bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm);
specialize_std_pair_on_both(short,gh_number_p,
gh_scm2long,gh_long2scm,
int,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(short,gh_number_p,
gh_scm2long,gh_long2scm,
short,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(short,gh_number_p,
gh_scm2long,gh_long2scm,
long,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(short,gh_number_p,
gh_scm2long,gh_long2scm,
unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(short,gh_number_p,
gh_scm2long,gh_long2scm,
unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(short,gh_number_p,
gh_scm2long,gh_long2scm,
unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(short,gh_number_p,
gh_scm2long,gh_long2scm,
double,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(short,gh_number_p,
gh_scm2long,gh_long2scm,
float,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(short,gh_number_p,
gh_scm2long,gh_long2scm,
std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm);
specialize_std_pair_on_both(long,gh_number_p,
gh_scm2long,gh_long2scm,
bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm);
specialize_std_pair_on_both(long,gh_number_p,
gh_scm2long,gh_long2scm,
int,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(long,gh_number_p,
gh_scm2long,gh_long2scm,
short,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(long,gh_number_p,
gh_scm2long,gh_long2scm,
long,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(long,gh_number_p,
gh_scm2long,gh_long2scm,
unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(long,gh_number_p,
gh_scm2long,gh_long2scm,
unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(long,gh_number_p,
gh_scm2long,gh_long2scm,
unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(long,gh_number_p,
gh_scm2long,gh_long2scm,
double,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(long,gh_number_p,
gh_scm2long,gh_long2scm,
float,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(long,gh_number_p,
gh_scm2long,gh_long2scm,
std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm);
specialize_std_pair_on_both(unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm);
specialize_std_pair_on_both(unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
int,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
short,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
long,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
double,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
float,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm);
specialize_std_pair_on_both(unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm);
specialize_std_pair_on_both(unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
int,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
short,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
long,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
double,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
float,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm);
specialize_std_pair_on_both(unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm);
specialize_std_pair_on_both(unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
int,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
short,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
long,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
double,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
float,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm,
std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm);
specialize_std_pair_on_both(double,gh_number_p,
gh_scm2double,gh_double2scm,
bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm);
specialize_std_pair_on_both(double,gh_number_p,
gh_scm2double,gh_double2scm,
int,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(double,gh_number_p,
gh_scm2double,gh_double2scm,
short,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(double,gh_number_p,
gh_scm2double,gh_double2scm,
long,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(double,gh_number_p,
gh_scm2double,gh_double2scm,
unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(double,gh_number_p,
gh_scm2double,gh_double2scm,
unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(double,gh_number_p,
gh_scm2double,gh_double2scm,
unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(double,gh_number_p,
gh_scm2double,gh_double2scm,
double,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(double,gh_number_p,
gh_scm2double,gh_double2scm,
float,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(double,gh_number_p,
gh_scm2double,gh_double2scm,
std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm);
specialize_std_pair_on_both(float,gh_number_p,
gh_scm2double,gh_double2scm,
bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm);
specialize_std_pair_on_both(float,gh_number_p,
gh_scm2double,gh_double2scm,
int,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(float,gh_number_p,
gh_scm2double,gh_double2scm,
short,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(float,gh_number_p,
gh_scm2double,gh_double2scm,
long,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(float,gh_number_p,
gh_scm2double,gh_double2scm,
unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(float,gh_number_p,
gh_scm2double,gh_double2scm,
unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(float,gh_number_p,
gh_scm2double,gh_double2scm,
unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(float,gh_number_p,
gh_scm2double,gh_double2scm,
double,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(float,gh_number_p,
gh_scm2double,gh_double2scm,
float,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(float,gh_number_p,
gh_scm2double,gh_double2scm,
std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm);
specialize_std_pair_on_both(std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm,
bool,gh_boolean_p,
gh_scm2bool,SWIG_bool2scm);
specialize_std_pair_on_both(std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm,
int,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm,
short,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm,
long,gh_number_p,
gh_scm2long,gh_long2scm);
specialize_std_pair_on_both(std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm,
unsigned int,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm,
unsigned short,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm,
unsigned long,gh_number_p,
gh_scm2ulong,gh_ulong2scm);
specialize_std_pair_on_both(std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm,
double,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm,
float,gh_number_p,
gh_scm2double,gh_double2scm);
specialize_std_pair_on_both(std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm,
std::string,gh_string_p,
SWIG_scm2string,SWIG_string2scm);
}

31
SWIG/Lib/java/std_pair.i Normal file
View file

@ -0,0 +1,31 @@
//
// SWIG typemaps for std::pair
// Luigi Ballabio
// July 2003
//
// Common implementation
%include std_common.i
%include exception.i
// ------------------------------------------------------------------------
// std::pair
// ------------------------------------------------------------------------
%{
#include <utility>
%}
// exported class
namespace std {
template<class T, class U> struct pair {
// add typemaps here
T first;
U second;
};
// add specializations here
}

View file

@ -0,0 +1,845 @@
//
// SWIG typemaps for std::pair
// Luigi Ballabio
// July 2003
//
// MzScheme implementation
%include std_common.i
// ------------------------------------------------------------------------
// std::pair
//
// See std_vector.i for the rationale of typemap application
// ------------------------------------------------------------------------
%{
#include <utility>
%}
// exported class
namespace std {
template<class T, class U> struct pair {
%typemap(in) pair<T,U> (std::pair<T,U>* m) {
if (SCHEME_PAIRP($input)) {
T* x;
U* y;
Scheme_Object *first, *second;
first = scheme_car($input);
second = scheme_cdr($input);
x = (T*) SWIG_MustGetPtr(first,$descriptor(T *),$argnum, 0);
y = (U*) SWIG_MustGetPtr(second,$descriptor(U *),$argnum, 0);
$1 = make_pair(x,y);
} else {
$1 = *(($&1_type)
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
}
}
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
std::pair<T,U>* m),
const pair<T,U>* (std::pair<T,U> temp,
std::pair<T,U>* m) {
if (SCHEME_PAIRP($input)) {
T* x;
U* y;
Scheme_Object *first, *second;
first = scheme_car($input);
second = scheme_cdr($input);
x = (T*) SWIG_MustGetPtr(first,$descriptor(T *),$argnum, 0);
y = (U*) SWIG_MustGetPtr(second,$descriptor(U *),$argnum, 0);
temp = make_pair(x,y);
$1 = &temp;
} else {
$1 = ($1_ltype)
SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
%typemap(out) pair<T,U> {
T* x = new T($1.first);
U* y = new U($1.second);
Scheme_Object* first = SWIG_NewPointerObj(x,$descriptor(T *), 1);
Scheme_Object* second = SWIG_NewPointerObj(y,$descriptor(U *), 1);
$result = scheme_make_pair(first,second);
}
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
/* native pair? */
if (SCHEME_PAIRP($input)) {
T* x;
U* y;
Scheme_Object* first = scheme_car($input);
Scheme_Object* second = scheme_cdr($input);
if (SWIG_ConvertPtr(first,(void**) &x,
$descriptor(T *), 0) != -1 &&
SWIG_ConvertPtr(second,(void**) &y,
$descriptor(U *), 0) != -1) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$&1_descriptor, 0) != -1)
$1 = 1;
else
$1 = 0;
}
}
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
const pair<T,U>* {
/* native pair? */
if (SCHEME_PAIRP($input)) {
T* x;
U* y;
Scheme_Object* first = scheme_car($input);
Scheme_Object* second = scheme_cdr($input);
if (SWIG_ConvertPtr(first,(void**) &x,
$descriptor(T *), 0) != -1 &&
SWIG_ConvertPtr(second,(void**) &y,
$descriptor(U *), 0) != -1) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$1_descriptor, 0) != -1)
$1 = 1;
else
$1 = 0;
}
}
T first;
U second;
};
// specializations for built-ins
%define specialize_std_pair_on_first(T,CHECK,CONVERT_FROM,CONVERT_TO)
template<class U> struct pair<T,U> {
%typemap(in) pair<T,U> (std::pair<T,U>* m) {
if (SCHEME_PAIRP($input)) {
U* y;
Scheme_Object *first, *second;
first = scheme_car($input);
second = scheme_cdr($input);
if (!CHECK(first))
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
y = (U*) SWIG_MustGetPtr(second,$descriptor(U *),$argnum, 0);
$1 = make_pair(CONVERT_FROM(first),y);
} else {
$1 = *(($&1_type)
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
}
}
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
std::pair<T,U>* m),
const pair<T,U>* (std::pair<T,U> temp,
std::pair<T,U>* m) {
if (SCHEME_PAIRP($input)) {
U* y;
Scheme_Object *first, *second;
first = scheme_car($input);
second = scheme_cdr($input);
if (!CHECK(first))
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
y = (U*) SWIG_MustGetPtr(second,$descriptor(U *),$argnum, 0);
temp = make_pair(CONVERT_FROM(first),y);
$1 = &temp;
} else {
$1 = ($1_ltype)
SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
%typemap(out) pair<T,U> {
U* y = new U($1.second);
Scheme_Object* second = SWIG_NewPointerObj(y,$descriptor(U *), 1);
$result = scheme_make_pair(CONVERT_TO($1.first),second);
}
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
/* native pair? */
if (SCHEME_PAIRP($input)) {
U* y;
Scheme_Object* first = scheme_car($input);
Scheme_Object* second = scheme_cdr($input);
if (CHECK(first) &&
SWIG_ConvertPtr(second,(void**) &y,
$descriptor(U *), 0) != -1) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$&1_descriptor, 0) != -1)
$1 = 1;
else
$1 = 0;
}
}
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
const pair<T,U>* {
/* native pair? */
if (SCHEME_PAIRP($input)) {
U* y;
Scheme_Object* first = scheme_car($input);
Scheme_Object* second = scheme_cdr($input);
if (CHECK(first) &&
SWIG_ConvertPtr(second,(void**) &y,
$descriptor(U *), 0) != -1) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$1_descriptor, 0) != -1)
$1 = 1;
else
$1 = 0;
}
}
T first;
U second;
};
%enddef
%define specialize_std_pair_on_second(U,CHECK,CONVERT_FROM,CONVERT_TO)
template<class T> struct pair<T,U> {
%typemap(in) pair<T,U> (std::pair<T,U>* m) {
if (SCHEME_PAIRP($input)) {
T* x;
Scheme_Object *first, *second;
first = scheme_car($input);
second = scheme_cdr($input);
x = (T*) SWIG_MustGetPtr(first,$descriptor(T *),$argnum, 0);
if (!CHECK(second))
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
$1 = make_pair(x,CONVERT_FROM(second));
} else {
$1 = *(($&1_type)
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
}
}
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
std::pair<T,U>* m),
const pair<T,U>* (std::pair<T,U> temp,
std::pair<T,U>* m) {
if (SCHEME_PAIRP($input)) {
T* x;
Scheme_Object *first, *second;
first = scheme_car($input);
second = scheme_cdr($input);
x = (T*) SWIG_MustGetPtr(first,$descriptor(T *),$argnum, 0);
if (!CHECK(second))
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
temp = make_pair(x,CONVERT_FROM(second));
$1 = &temp;
} else {
$1 = ($1_ltype)
SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
%typemap(out) pair<T,U> {
T* x = new T($1.first);
Scheme_Object* first = SWIG_NewPointerObj(x,$descriptor(T *), 1);
$result = scheme_make_pair(first,CONVERT_TO($1.second));
}
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
/* native pair? */
if (SCHEME_PAIRP($input)) {
T* x;
Scheme_Object* first = scheme_car($input);
Scheme_Object* second = scheme_cdr($input);
if (SWIG_ConvertPtr(first,(void**) &x,
$descriptor(T *), 0) != -1 &&
CHECK(second)) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$&1_descriptor, 0) != -1)
$1 = 1;
else
$1 = 0;
}
}
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
const pair<T,U>* {
/* native pair? */
if (SCHEME_PAIRP($input)) {
T* x;
Scheme_Object* first = scheme_car($input);
Scheme_Object* second = scheme_cdr($input);
if (SWIG_ConvertPtr(first,(void**) &x,
$descriptor(T *), 0) != -1 &&
CHECK(second)) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$1_descriptor, 0) != -1)
$1 = 1;
else
$1 = 0;
}
}
T first;
U second;
};
%enddef
%define specialize_std_pair_on_both(T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO,
U,CHECK_U,CONVERT_U_FROM,CONVERT_U_TO)
template<> struct pair<T,U> {
%typemap(in) pair<T,U> (std::pair<T,U>* m) {
if (SCHEME_PAIRP($input)) {
Scheme_Object *first, *second;
first = scheme_car($input);
second = scheme_cdr($input);
if (!CHECK_T(first) || !CHECK_U(second))
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
$1 = make_pair(CONVERT_T_FROM(first),
CONVERT_U_FROM(second));
} else {
$1 = *(($&1_type)
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
}
}
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
std::pair<T,U>* m),
const pair<T,U>* (std::pair<T,U> temp,
std::pair<T,U>* m) {
if (SCHEME_PAIRP($input)) {
Scheme_Object *first, *second;
first = scheme_car($input);
second = scheme_cdr($input);
x = (T*) SWIG_MustGetPtr(first,$descriptor(T *),$argnum, 0);
if (!CHECK_T(first) || !CHECK_U(second))
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
temp = make_pair(CONVERT_T_FROM(first),
CONVERT_U_FROM(second));
$1 = &temp;
} else {
$1 = ($1_ltype)
SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
%typemap(out) pair<T,U> {
$result = scheme_make_pair(CONVERT_T_TO($1.first),
CONVERT_U_TO($1.second));
}
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
/* native pair? */
if (SCHEME_PAIRP($input)) {
Scheme_Object* first = scheme_car($input);
Scheme_Object* second = scheme_cdr($input);
if (CHECK_T(first) && CHECK_U(second)) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$&1_descriptor, 0) != -1)
$1 = 1;
else
$1 = 0;
}
}
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
const pair<T,U>* {
/* native pair? */
if (SCHEME_PAIRP($input)) {
Scheme_Object* first = scheme_car($input);
Scheme_Object* second = scheme_cdr($input);
if (CHECK_T(first) && CHECK_U(second)) {
$1 = 1;
} else {
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$1_descriptor, 0) != -1)
$1 = 1;
else
$1 = 0;
}
}
T first;
U second;
};
%enddef
specialize_std_pair_on_first(bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean);
specialize_std_pair_on_first(int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_first(short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_first(long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_first(unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_first(unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_first(unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_first(double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_first(float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_first(std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string);
specialize_std_pair_on_second(bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean);
specialize_std_pair_on_second(int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_second(short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_second(long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_second(unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_second(unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_second(unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_second(double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_second(float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_second(std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string);
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean,
bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean);
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean,
int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean,
short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean,
long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean,
unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean,
unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean,
unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean,
double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean,
float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean,
std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string);
specialize_std_pair_on_both(int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean);
specialize_std_pair_on_both(int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string);
specialize_std_pair_on_both(short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean);
specialize_std_pair_on_both(short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string);
specialize_std_pair_on_both(long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean);
specialize_std_pair_on_both(long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string);
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean);
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string);
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean);
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string);
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean);
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value,
std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string);
specialize_std_pair_on_both(double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean);
specialize_std_pair_on_both(double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string);
specialize_std_pair_on_both(float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean);
specialize_std_pair_on_both(float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double,
std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string);
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string,
bool,SCHEME_BOOLP,
SCHEME_TRUEP,swig_make_boolean);
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string,
int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string,
short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string,
long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string,
unsigned int,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string,
unsigned short,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string,
unsigned long,SCHEME_INTP,
SCHEME_INT_VAL,scheme_make_integer_value);
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string,
double,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string,
float,SCHEME_REALP,
scheme_real_to_double,scheme_make_double);
specialize_std_pair_on_both(std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string,
std::string,SCHEME_STRINGP,
swig_scm_to_string,swig_make_string);
}

31
SWIG/Lib/ocaml/std_pair.i Normal file
View file

@ -0,0 +1,31 @@
//
// SWIG typemaps for std::pair
// Luigi Ballabio
// July 2003
//
// Common implementation
%include std_common.i
%include exception.i
// ------------------------------------------------------------------------
// std::pair
// ------------------------------------------------------------------------
%{
#include <utility>
%}
// exported class
namespace std {
template<class T, class U> struct pair {
// add typemaps here
T first;
U second;
};
// add specializations here
}

31
SWIG/Lib/perl5/std_pair.i Normal file
View file

@ -0,0 +1,31 @@
//
// SWIG typemaps for std::pair
// Luigi Ballabio
// July 2003
//
// Common implementation
%include std_common.i
%include exception.i
// ------------------------------------------------------------------------
// std::pair
// ------------------------------------------------------------------------
%{
#include <utility>
%}
// exported class
namespace std {
template<class T, class U> struct pair {
// add typemaps here
T first;
U second;
};
// add specializations here
}

31
SWIG/Lib/php4/std_pair.i Normal file
View file

@ -0,0 +1,31 @@
//
// SWIG typemaps for std::pair
// Luigi Ballabio
// July 2003
//
// Common implementation
%include std_common.i
%include exception.i
// ------------------------------------------------------------------------
// std::pair
// ------------------------------------------------------------------------
%{
#include <utility>
%}
// exported class
namespace std {
template<class T, class U> struct pair {
// add typemaps here
T first;
U second;
};
// add specializations here
}

1006
SWIG/Lib/python/std_pair.i Normal file

File diff suppressed because it is too large Load diff

925
SWIG/Lib/ruby/std_pair.i Normal file
View file

@ -0,0 +1,925 @@
//
// SWIG typemaps for std::pair
// Luigi Ballabio
// July 2003
//
// Ruby implementation
%include std_common.i
// ------------------------------------------------------------------------
// std::pair
//
// See std_vector.i for the rationale of typemap application
// ------------------------------------------------------------------------
%{
#include <utility>
%}
// exported class
namespace std {
template<class T, class U> struct pair {
%typemap(in) pair<T,U> (std::pair<T,U>* p) {
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
if (size != 2)
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
T* x;
U* y;
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
SWIG_ConvertPtr(first, (void **) &x, $descriptor(T *), 1);
SWIG_ConvertPtr(second, (void **) &y, $descriptor(U *), 1);
$1 = std::make_pair(x,y);
} else {
SWIG_ConvertPtr($input, (void **) &p, $&1_descriptor, 1);
$1 = *p;
}
}
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
std::pair<T,U>* p),
const pair<T,U>* (std::pair<T,U> temp,
std::pair<T,U>* p) {
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
if (size != 2)
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
T* x;
U* y;
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
SWIG_ConvertPtr(first, (void **) &x, $descriptor(T *), 1);
SWIG_ConvertPtr(second, (void **) &y, $descriptor(U *), 1);
temp = std::make_pair(x,y);
$1 = &temp;
} else {
SWIG_ConvertPtr($input, (void **) &p, $1_descriptor, 1);
$1 = p;
}
}
%typemap(out) pair<T,U> {
$result = rb_ary_new2(2);
T* x = new T($1.first);
U* y = new U($1.second);
rb_ary_store($result,0,
SWIG_NewPointerObj((void *) x,
$descriptor(T *), 1));
rb_ary_store($result,1,
SWIG_NewPointerObj((void *) y,
$descriptor(U *), 1));
}
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
/* native sequence? */
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
if (size != 2) {
/* not a pair */
$1 = 0;
} else {
T* x;
U* y;
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
if (SWIG_ConvertPtr(first,(void **) &x,
$descriptor(T *),0) != -1 &&
SWIG_ConvertPtr(second,(void **) &y,
$descriptor(U *),0) != -1)
$1 = 1;
else
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$&1_descriptor,0) != -1)
$1 = 1;
else
$1 = 0;
}
}
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
const pair<T,U>* {
/* native sequence? */
if (rb_obj_is_kind_of($input,rb_cHash)) {
unsigned int size = RARRAY($input)->len;
if (size != 2) {
/* not a pair */
$1 = 0;
} else {
T* x;
U* y;
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
if (SWIG_ConvertPtr(first,(void **) &x,
$descriptor(T *),0) != -1 &&
SWIG_ConvertPtr(second,(void **) &y,
$descriptor(U *),0) != -1)
$1 = 1;
else
$1 = 0;
}
} else {
/* wrapped map? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$1_descriptor,0) != -1)
$1 = 1;
else
$1 = 0;
}
}
T first;
U second;
};
// specializations for built-ins
%define specialize_std_pair_on_first(T,CHECK,CONVERT_FROM,CONVERT_TO)
template<class U> struct pair<T,U> {
%typemap(in) pair<T,U> (std::pair<T,U>* p) {
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
if (size != 2)
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
U* y;
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
if (!CHECK(first))
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
SWIG_ConvertPtr(second, (void **) &y, $descriptor(U *), 1);
$1 = std::make_pair(CONVERT_FROM(first),y);
} else {
SWIG_ConvertPtr($input, (void **) &p, $&1_descriptor, 1);
$1 = *p;
}
}
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
std::pair<T,U>* p),
const pair<T,U>* (std::pair<T,U> temp,
std::pair<T,U>* p) {
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
if (size != 2)
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
U* y;
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
if (!CHECK(first))
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
SWIG_ConvertPtr(second, (void **) &y, $descriptor(U *), 1);
temp = std::make_pair(CONVERT_FROM(first),y);
$1 = &temp;
} else {
SWIG_ConvertPtr($input, (void **) &p, $1_descriptor, 1);
$1 = p;
}
}
%typemap(out) pair<T,U> {
$result = rb_ary_new2(2);
U* y = new U($1.second);
rb_ary_store($result,0,CONVERT_TO($1.first));
rb_ary_store($result,1,
SWIG_NewPointerObj((void *) y,
$descriptor(U *), 1));
}
%typecheck(SWIG_TYPECHECK_MAP) pair<T,U> {
/* native sequence? */
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
if (size != 2) {
/* not a pair */
$1 = 0;
} else {
U* y;
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
if (CHECK(first) &&
SWIG_ConvertPtr(second,(void **) &y,
$descriptor(U *),0) != -1)
$1 = 1;
else
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$&1_descriptor,0) != -1)
$1 = 1;
else
$1 = 0;
}
}
%typecheck(SWIG_TYPECHECK_MAP) const pair<T,U>&,
const pair<T,U>* {
/* native sequence? */
if (rb_obj_is_kind_of($input,rb_cHash)) {
unsigned int size = RARRAY($input)->len;
if (size != 2) {
/* not a pair */
$1 = 0;
} else {
U* y;
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
if (CHECK(first) &&
SWIG_ConvertPtr(second,(void **) &y,
$descriptor(U *),0) != -1)
$1 = 1;
else
$1 = 0;
}
} else {
/* wrapped map? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$1_descriptor,0) != -1)
$1 = 1;
else
$1 = 0;
}
}
T first;
U second;
};
%enddef
%define specialize_std_pair_on_second(U,CHECK,CONVERT_FROM,CONVERT_TO)
template<class T> struct pair<T,U> {
%typemap(in) pair<T,U> (std::pair<T,U>* p) {
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
if (size != 2) {
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
}
T* x;
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
SWIG_ConvertPtr(first, (void **) &x, $descriptor(T *), 1);
if (!CHECK(second))
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
$1 = std::make_pair(x,CONVERT_FROM(second));
} else {
SWIG_ConvertPtr($input, (void **) &p, $&1_descriptor, 1);
$1 = *p;
}
}
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
std::pair<T,U>* p),
const pair<T,U>* (std::pair<T,U> temp,
std::pair<T,U>* p) {
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
if (size != 2) {
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
}
T* x;
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
SWIG_ConvertPtr(first, (void **) &x, $descriptor(T *), 1);
if (!CHECK(second))
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
temp = std::make_pair(x,CONVERT_FROM(second));
$1 = &temp;
} else {
SWIG_ConvertPtr($input, (void **) &p, $1_descriptor, 1);
$1 = p;
}
}
%typemap(out) pair<T,U> {
$result = rb_ary_new2(2);
T* x = new T($1.first);
rb_ary_store($result,0,
SWIG_NewPointerObj((void *) x,
$descriptor(T *), 1));
rb_ary_store($result,1,CONVERT_TO($1.second));
}
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
/* native sequence? */
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
if (size != 2) {
/* not a pair */
$1 = 0;
} else {
T* x;
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
if (SWIG_ConvertPtr(first,(void **) &x,
$descriptor(T *),0) != -1 &&
CHECK(second))
$1 = 1;
else
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$&1_descriptor,0) != -1)
$1 = 1;
else
$1 = 0;
}
}
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
const pair<T,U>* {
/* native sequence? */
if (rb_obj_is_kind_of($input,rb_cHash)) {
unsigned int size = RARRAY($input)->len;
if (size != 2) {
/* not a pair */
$1 = 0;
} else {
T* x;
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
if (SWIG_ConvertPtr(first,(void **) &x,
$descriptor(T *),0) != -1 &&
CHECK(second))
$1 = 1;
else
$1 = 0;
}
} else {
/* wrapped map? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$1_descriptor,0) != -1)
$1 = 1;
else
$1 = 0;
}
}
T first;
U second;
};
%enddef
%define specialize_std_map_on_both(T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO,
U,CHECK_U,CONVERT_U_FROM,CONVERT_U_TO)
template<> struct pair<T,U> {
%typemap(in) pair<T,U> (std::pair<T,U>* p) {
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
if (size != 2) {
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
}
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
if (!CHECK_T(first) || !CHECK_U(second))
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
$1 = std::make_pair(CONVERT_T_FROM(first),
CONVERT_U_FROM(second));
} else {
SWIG_ConvertPtr($input, (void **) &p, $&1_descriptor, 1);
$1 = *p;
}
}
%typemap(in) const pair<T,U>& (std::pair<T,U> temp,
std::pair<T,U>* p),
const pair<T,U>* (std::pair<T,U> temp,
std::pair<T,U>* p) {
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
if (size != 2) {
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
}
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
if (!CHECK_T(first) || !CHECK_U(second))
SWIG_exception(SWIG_TypeError,
"pair<" #T "," #U "> expected");
temp = std::make_pair(CONVERT_T_FROM(first),
CONVERT_U_FROM(second));
$1 = &temp;
} else {
SWIG_ConvertPtr($input, (void **) &p, $1_descriptor, 1);
$1 = p;
}
}
%typemap(out) pair<T,U> {
$result = rb_ary_new2(2);
rb_ary_store($result,0,CONVERT_T_TO($1.first));
rb_ary_store($result,1,CONVERT_U_TO($1.second));
}
%typecheck(SWIG_TYPECHECK_PAIR) pair<T,U> {
/* native sequence? */
if (rb_obj_is_kind_of($input,rb_cArray)) {
unsigned int size = RARRAY($input)->len;
if (size != 2) {
/* not a pair */
$1 = 0;
} else {
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
if (CHECK_T(first) && CHECK_U(second))
$1 = 1;
else
$1 = 0;
}
} else {
/* wrapped pair? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$&1_descriptor,0) != -1)
$1 = 1;
else
$1 = 0;
}
}
%typecheck(SWIG_TYPECHECK_PAIR) const pair<T,U>&,
const pair<T,U>* {
/* native sequence? */
if (rb_obj_is_kind_of($input,rb_cHash)) {
unsigned int size = RARRAY($input)->len;
if (size != 2) {
/* not a pair */
$1 = 0;
} else {
VALUE first = RARRAY($input)->ptr[0];
VALUE second = RARRAY($input)->ptr[1];
if (CHECK_T(first) && CHECK_U(second))
$1 = 1;
else
$1 = 0;
}
} else {
/* wrapped map? */
std::pair<T,U >* p;
if (SWIG_ConvertPtr($input,(void **) &p,
$1_descriptor,0) != -1)
$1 = 1;
else
$1 = 0;
}
}
T first;
U second;
};
%enddef
specialize_std_pair_on_first(bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB);
specialize_std_pair_on_first(int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_first(short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_first(long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_first(unsigned int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_first(unsigned short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_first(unsigned long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_first(double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_first(float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_first(std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB);
specialize_std_pair_on_second(bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB);
specialize_std_pair_on_second(int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_second(short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_second(long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_second(unsigned int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_second(unsigned short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_second(unsigned long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_second(double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_second(float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_second(std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB);
specialize_std_pair_on_both(bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB,
bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB);
specialize_std_pair_on_both(bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB,
int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB,
short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB,
long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB,
unsigned int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB,
unsigned short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB,
unsigned long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB,
double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB,
float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB,
std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB);
specialize_std_pair_on_both(int,FIXNUM_P,
FIX2INT,INT2NUM,
bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB);
specialize_std_pair_on_both(int,FIXNUM_P,
FIX2INT,INT2NUM,
int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(int,FIXNUM_P,
FIX2INT,INT2NUM,
short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(int,FIXNUM_P,
FIX2INT,INT2NUM,
long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(int,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(int,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(int,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(int,FIXNUM_P,
FIX2INT,INT2NUM,
double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(int,FIXNUM_P,
FIX2INT,INT2NUM,
float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(int,FIXNUM_P,
FIX2INT,INT2NUM,
std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB);
specialize_std_pair_on_both(short,FIXNUM_P,
FIX2INT,INT2NUM,
bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB);
specialize_std_pair_on_both(short,FIXNUM_P,
FIX2INT,INT2NUM,
int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(short,FIXNUM_P,
FIX2INT,INT2NUM,
short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(short,FIXNUM_P,
FIX2INT,INT2NUM,
long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(short,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(short,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(short,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(short,FIXNUM_P,
FIX2INT,INT2NUM,
double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(short,FIXNUM_P,
FIX2INT,INT2NUM,
float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(short,FIXNUM_P,
FIX2INT,INT2NUM,
std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB);
specialize_std_pair_on_both(long,FIXNUM_P,
FIX2INT,INT2NUM,
bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB);
specialize_std_pair_on_both(long,FIXNUM_P,
FIX2INT,INT2NUM,
int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(long,FIXNUM_P,
FIX2INT,INT2NUM,
short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(long,FIXNUM_P,
FIX2INT,INT2NUM,
long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(long,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(long,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(long,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(long,FIXNUM_P,
FIX2INT,INT2NUM,
double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(long,FIXNUM_P,
FIX2INT,INT2NUM,
float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(long,FIXNUM_P,
FIX2INT,INT2NUM,
std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB);
specialize_std_pair_on_both(unsigned int,FIXNUM_P,
FIX2INT,INT2NUM,
bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB);
specialize_std_pair_on_both(unsigned int,FIXNUM_P,
FIX2INT,INT2NUM,
int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned int,FIXNUM_P,
FIX2INT,INT2NUM,
short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned int,FIXNUM_P,
FIX2INT,INT2NUM,
long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned int,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned int,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned int,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned int,FIXNUM_P,
FIX2INT,INT2NUM,
double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(unsigned int,FIXNUM_P,
FIX2INT,INT2NUM,
float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(unsigned int,FIXNUM_P,
FIX2INT,INT2NUM,
std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB);
specialize_std_pair_on_both(unsigned short,FIXNUM_P,
FIX2INT,INT2NUM,
bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB);
specialize_std_pair_on_both(unsigned short,FIXNUM_P,
FIX2INT,INT2NUM,
int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned short,FIXNUM_P,
FIX2INT,INT2NUM,
short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned short,FIXNUM_P,
FIX2INT,INT2NUM,
long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned short,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned short,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned short,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned short,FIXNUM_P,
FIX2INT,INT2NUM,
double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(unsigned short,FIXNUM_P,
FIX2INT,INT2NUM,
float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(unsigned short,FIXNUM_P,
FIX2INT,INT2NUM,
std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB);
specialize_std_pair_on_both(unsigned long,FIXNUM_P,
FIX2INT,INT2NUM,
bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB);
specialize_std_pair_on_both(unsigned long,FIXNUM_P,
FIX2INT,INT2NUM,
int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned long,FIXNUM_P,
FIX2INT,INT2NUM,
short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned long,FIXNUM_P,
FIX2INT,INT2NUM,
long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned long,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned long,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned long,FIXNUM_P,
FIX2INT,INT2NUM,
unsigned long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(unsigned long,FIXNUM_P,
FIX2INT,INT2NUM,
double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(unsigned long,FIXNUM_P,
FIX2INT,INT2NUM,
float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(unsigned long,FIXNUM_P,
FIX2INT,INT2NUM,
std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB);
specialize_std_pair_on_both(double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB);
specialize_std_pair_on_both(double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
unsigned int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
unsigned short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
unsigned long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB);
specialize_std_pair_on_both(float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB);
specialize_std_pair_on_both(float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
unsigned int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
unsigned short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
unsigned long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new,
std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB);
specialize_std_pair_on_both(std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB,
bool,SWIG_BOOL_P,
SWIG_RB2BOOL,SWIG_BOOL2RB);
specialize_std_pair_on_both(std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB,
int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB,
short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB,
long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB,
unsigned int,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB,
unsigned short,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB,
unsigned long,FIXNUM_P,
FIX2INT,INT2NUM);
specialize_std_pair_on_both(std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB,
double,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB,
float,SWIG_FLOAT_P,
SWIG_NUM2DBL,rb_float_new);
specialize_std_pair_on_both(std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB,
std::string,SWIG_STRING_P,
SWIG_RB2STR,SWIG_STR2RB);
}

View file

@ -9,4 +9,5 @@
%include std_string.i
%include std_vector.i
%include std_map.i
%include std_pair.i

View file

@ -240,6 +240,7 @@ namespace std {
%define SWIG_TYPECHECK_STRING 140 %enddef
%define SWIG_TYPECHECK_VECTOR 150 %enddef
%define SWIG_TYPECHECK_MAP 160 %enddef
%define SWIG_TYPECHECK_PAIR 170 %enddef
%define SWIG_TYPECHECK_BOOL_ARRAY 1015 %enddef
%define SWIG_TYPECHECK_INT8_ARRAY 1025 %enddef

31
SWIG/Lib/tcl/std_pair.i Normal file
View file

@ -0,0 +1,31 @@
//
// SWIG typemaps for std::pair
// Luigi Ballabio
// July 2003
//
// Common implementation
%include std_common.i
%include exception.i
// ------------------------------------------------------------------------
// std::pair
// ------------------------------------------------------------------------
%{
#include <utility>
%}
// exported class
namespace std {
template<class T, class U> struct pair {
// add typemaps here
T first;
U second;
};
// add specializations here
}