massive typemap unification

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7676 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-10-18 13:24:15 +00:00
commit 7e5e4fd1f9
144 changed files with 6378 additions and 7248 deletions

View file

@ -18,14 +18,15 @@ CPP_TEST_CASES += \
complextest \
director_stl \
director_thread \
director_wstring \
file_test \
implicittest \
inout \
input \
inplaceadd \
kwargs \
li_cstring \
li_cwstring \
li_implicit \
li_std_except \
li_std_vectora \
li_std_map \

View file

@ -6,6 +6,7 @@ if mainc(largs) != 3:
targs=('hi','hola')
if mainv(targs,1) != 'hola':
print mainv(targs,1)
raise RuntimeError, "bad main typemap"
targs=('hi', 'hola')

View file

@ -0,0 +1 @@
import empty

View file

@ -1,22 +0,0 @@
%module implicittest
%include implicit.i
%inline
{
struct B { };
}
%implicit(A, int, double, B);
%inline
{
struct A
{
int ii;
A(int i) { ii = 1; }
A(double d) { ii = 2; }
A(const B& b) { ii = 3; }
};
int get(const A& a) { return a.ii; }
}

View file

@ -32,6 +32,10 @@
p->second += 1;
}
inline void AddOne1r(double& a) {
a += 1;
}
%}
%template() std::pair<double, double>;
@ -41,3 +45,4 @@ void AddOne3(double* INOUT, double* INOUT, double* INOUT);
void AddOne1p(std::pair<double, double>* INOUT);
void AddOne2p(std::pair<double, double>* INOUT, double* INOUT);
void AddOne3p(double* INOUT, std::pair<double, double>* INOUT, double* INOUT);
void AddOne1r(double& INOUT);

View file

@ -11,9 +11,11 @@ if test2() != " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
raise RuntimeError
if test3("hello") != "hello-suffix":
print test3("hello")
raise RuntimeError
if test4("hello") != "hello-suffix":
print test4("hello")
raise RuntimeError
if test5(4) != 'xxxx':

View file

@ -1,4 +1,4 @@
from implicittest import *
from li_implicit import *
b = B()
ai = A(1)
ad = A(2.0)

View file

@ -11,6 +11,7 @@ if li_std_string.test_cvalue(x) != x:
raise RuntimeError, "bad string mapping"
if li_std_string.test_value(x) != x:
print x, li_std_string.test_value(x)
raise RuntimeError, "bad string mapping"
if li_std_string.test_const_reference(x) != x:

View file

@ -3,6 +3,7 @@ import li_std_wstring
x=u"h"
if li_std_wstring.test_wcvalue(x) != x:
print li_std_wstring.test_wcvalue(x)
raise RuntimeError, "bad string mapping"
x=u"hello"

View file

@ -14,8 +14,8 @@ cvar.var_long = sct_long
cvar.var_ulong = sct_ulong
cvar.var_llong = sct_llong
cvar.var_ullong = sct_ullong
#cvar.var_float = sct_float
#cvar.var_double = sct_double
cvar.var_float = sct_float
cvar.var_double = sct_double
cvar.var_char = sct_char
cvar.var_pchar = sct_pchar
cvar.var_pcharc = sct_pcharc
@ -46,8 +46,8 @@ if cvar.var_long != cct_long: pyerror("long", cvar.var_long, cct_long)
if cvar.var_ulong != cct_ulong: pyerror("ulong", cvar.var_ulong, cct_ulong)
if cvar.var_llong != cct_llong: pyerror("llong", cvar.var_llong, cct_llong)
if cvar.var_ullong != cct_ullong: pyerror("ullong", cvar.var_ullong, cct_ullong)
#if cvar.var_float != cct_float: pyerror("float", cvar.var_float, cct_float)
#if cvar.var_double != cct_double: pyerror("double", cvar.var_double, cct_double)
if cvar.var_float != cct_float: pyerror("float", cvar.var_float, cct_float)
if cvar.var_double != cct_double: pyerror("double", cvar.var_double, cct_double)
if cvar.var_char != cct_char: pyerror("char", cvar.var_char, cct_char)
if cvar.var_pchar != cct_pchar: pyerror("pchar", cvar.var_pchar, cct_pchar)
if cvar.var_pcharc != cct_pcharc: pyerror("pchar", cvar.var_pcharc, cct_pcharc)
@ -128,8 +128,8 @@ p.var_long = p.stc_long
p.var_ulong = p.stc_ulong
p.var_llong = p.stc_llong
p.var_ullong = p.stc_ullong
#p.var_float = p.stc_float
#p.var_double = p.stc_double
p.var_float = p.stc_float
p.var_double = p.stc_double
p.var_char = p.stc_char
p.var_pchar = sct_pchar
p.var_pcharc = sct_pcharc
@ -156,8 +156,8 @@ t.var_long = t.stc_long
t.var_ulong = t.stc_ulong
t.var_llong = t.stc_llong
t.var_ullong = t.stc_ullong
#t.var_float = t.stc_float
#t.var_double = t.stc_double
t.var_float = t.stc_float
t.var_double = t.stc_double
t.var_char = t.stc_char
t.var_pchar = sct_pchar
t.var_pcharc = sct_pcharc
@ -215,6 +215,7 @@ if cvar.var_char != '\0':
cvar.var_namet = '\0'
#if cvar.var_namet != '\0\0\0\0\0':
if cvar.var_namet != '':
print 'hola', '', cvar.var_namet
raise RuntimeError, "bad char '\0' case"
cvar.var_namet = ''
@ -301,7 +302,7 @@ try:
a = t.var_uint
t.var_uint = -1
error = 1
except TypeError:
except OverflowError:
if a != t.var_uint:
error = 1
pass