Merge remote-tracking branch 'origin/master' into gsoc2012-scilab
This commit is contained in:
commit
9c5bac9887
83 changed files with 2913 additions and 7441 deletions
|
|
@ -398,7 +398,7 @@ python_clean:
|
|||
##################################################################
|
||||
|
||||
# Make sure these locate your Octave installation
|
||||
OCTAVE = OCTAVE_HISTFILE=/dev/null @OCTAVE@ -qfH
|
||||
OCTAVE = OCTAVE_HISTFILE=/dev/null @OCTAVE@
|
||||
OCTAVE_CXX = $(DEFS) @OCTAVE_CPPFLAGS@ @OCTAVE_CXXFLAGS@
|
||||
|
||||
# Extra Octave specific dynamic linking options
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
. "./example"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
. "./example"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"./example"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
. "./example"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
. "./example"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type CEO struct{}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
. "./example"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
. "./example"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
. "./example"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
. "./example"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"./example"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
. "./example"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"./example"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "SWIG_PYTHON_INTERPRETER_NO_DEBUG" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "SWIG_PYTHON_INTERPRETER_NO_DEBUG" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BAR_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GR /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BAR_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GR /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "SWIG_PYTHON_INTERPRETER_NO_DEBUG" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BAR_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BASE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GR /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BASE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GR /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "SWIG_PYTHON_INTERPRETER_NO_DEBUG" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BASE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FOO_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GR /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FOO_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GR /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "SWIG_PYTHON_INTERPRETER_NO_DEBUG" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FOO_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPAM_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GR /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPAM_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GR /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "SWIG_PYTHON_INTERPRETER_NO_DEBUG" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPAM_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "SWIG_PYTHON_INTERPRETER_NO_DEBUG" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "SWIG_PYTHON_INTERPRETER_NO_DEBUG" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
|
|
|
|||
9
Examples/test-suite/bom_utf8.i
Normal file
9
Examples/test-suite/bom_utf8.i
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
%module bom_utf8
|
||||
|
||||
/* Test for UTF8 BOM at start of file */
|
||||
%inline %{
|
||||
struct NotALotHere {
|
||||
int n;
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
@ -285,8 +285,9 @@ CPP_TEST_CASES += \
|
|||
operbool \
|
||||
ordering \
|
||||
overload_copy \
|
||||
overload_method \
|
||||
overload_extend \
|
||||
overload_method \
|
||||
overload_numeric \
|
||||
overload_rename \
|
||||
overload_return_type \
|
||||
overload_simple \
|
||||
|
|
@ -511,6 +512,7 @@ endif
|
|||
# C test cases. (Can be run individually using: make testcase.ctest)
|
||||
C_TEST_CASES += \
|
||||
arrays \
|
||||
bom_utf8 \
|
||||
char_constant \
|
||||
const_const \
|
||||
constant_expr \
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"./constover"
|
||||
"fmt"
|
||||
"os"
|
||||
"./constover"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import . "./template_typedef_cplx3"
|
|||
func main() {
|
||||
// this is OK
|
||||
|
||||
|
||||
s := NewSin()
|
||||
s.Get_base_value()
|
||||
s.Get_value()
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import . "./template_typedef_cplx4"
|
|||
func main() {
|
||||
// this is OK
|
||||
|
||||
|
||||
s := NewSin()
|
||||
s.Get_base_value()
|
||||
s.Get_value()
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import "template_typedef_import"
|
|||
func main() {
|
||||
// this is OK
|
||||
|
||||
|
||||
s := template_typedef_import.NewSin()
|
||||
s.Get_base_value()
|
||||
s.Get_value()
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@
|
|||
Foo(double){ ii = 2;}
|
||||
explicit Foo(char *s){ii = 3;}
|
||||
Foo(const Foo& f){ ii = f.ii;}
|
||||
|
||||
};
|
||||
|
||||
struct Bar
|
||||
|
|
@ -57,11 +56,61 @@
|
|||
Bar(const Foo& ff){ ii = ff.ii;}
|
||||
};
|
||||
|
||||
|
||||
int get_b(const Bar&b) { return b.ii; }
|
||||
|
||||
Foo foo;
|
||||
|
||||
}
|
||||
|
||||
%template(A_int) A_T<int>;
|
||||
|
||||
|
||||
/****************** None handling *********************/
|
||||
|
||||
%inline
|
||||
{
|
||||
struct BB {};
|
||||
struct AA
|
||||
{
|
||||
int ii;
|
||||
AA(int i) { ii = 1; }
|
||||
AA(double d) { ii = 2; }
|
||||
AA(const B* b) { ii = 3; }
|
||||
explicit AA(char *s) { ii = 4; }
|
||||
AA(const BB& b) { ii = 5; }
|
||||
|
||||
int get() const { return ii; }
|
||||
};
|
||||
|
||||
int get_AA_val(AA a) { return a.ii; }
|
||||
int get_AA_ref(const AA& a) { return a.ii; }
|
||||
}
|
||||
|
||||
|
||||
/****************** Overloading priority *********************/
|
||||
|
||||
%inline %{
|
||||
class BBB {
|
||||
public:
|
||||
BBB(const B &) {}
|
||||
};
|
||||
|
||||
class CCC {
|
||||
public:
|
||||
CCC(const BBB &) : checkvalue(0) {}
|
||||
int xx(int i) { return 11; }
|
||||
int xx(const A& i) { return 22; }
|
||||
int yy(int i, int j) { return 111; }
|
||||
int yy(const A& i, const A& j) { return 222; }
|
||||
int checkvalue;
|
||||
};
|
||||
%}
|
||||
|
||||
// CCC(const BBB &) was being called instead of this constructor (independent of being added via %extend)
|
||||
%extend CCC {
|
||||
CCC(const B& b) {
|
||||
CCC* ccc = new CCC(b);
|
||||
ccc->checkvalue = 10;
|
||||
return ccc;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
%feature("trackobjects");
|
||||
|
||||
%include std_pair.i
|
||||
%include std_map.i
|
||||
%include std_multimap.i
|
||||
|
||||
%inline %{
|
||||
|
|
@ -20,6 +19,5 @@ struct A{
|
|||
namespace std
|
||||
{
|
||||
%template(pairA) pair<int, A*>;
|
||||
%template(mapA) map<int, A*>;
|
||||
%template(multimapA) multimap<int, A*>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,14 @@ wchar_t* test_cvalue(wchar_t* x) {
|
|||
}
|
||||
|
||||
|
||||
wchar_t* test_wchar_overload() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
wchar_t* test_wchar_overload(wchar_t *x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
std::wstring test_value(std::wstring x) {
|
||||
return x;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,16 +42,22 @@ assert(f3.num==32)
|
|||
f4=cb.Foo(6)
|
||||
cb.Bar_global_fptr=f4
|
||||
assert(cb.Bar_global_fptr.num==6)
|
||||
assert(cb.Bar.global_fptr.num==6)
|
||||
f4.num=8
|
||||
assert(cb.Bar_global_fptr.num==8)
|
||||
assert(cb.Bar.global_fptr.num==8)
|
||||
|
||||
assert(cb.Bar_global_fref.num==23)
|
||||
assert(cb.Bar.global_fref.num==23)
|
||||
cb.Bar_global_fref=cb.Foo(-7) -- this will set the value
|
||||
assert(cb.Bar_global_fref.num==-7)
|
||||
assert(cb.Bar.global_fref.num==-7)
|
||||
|
||||
assert(cb.Bar_global_fval.num==3)
|
||||
assert(cb.Bar.global_fval.num==3)
|
||||
cb.Bar_global_fval=cb.Foo(-34)
|
||||
assert(cb.Bar_global_fval.num==-34)
|
||||
assert(cb.Bar.global_fval.num==-34)
|
||||
|
||||
-- Now test member function pointers
|
||||
func1_ptr=cb.get_func1_ptr()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#######################################################################
|
||||
|
||||
LANGUAGE = octave
|
||||
OCTAVE = @OCTAVE@ -qf
|
||||
OCTAVE = @OCTAVE@
|
||||
SCRIPTSUFFIX = _runme.m
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
|
|
|||
51
Examples/test-suite/overload_numeric.i
Normal file
51
Examples/test-suite/overload_numeric.i
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
%module overload_numeric
|
||||
|
||||
// Tests overloading of integral and floating point types to verify the range checking required
|
||||
// for dispatch to the correct overloaded method
|
||||
|
||||
#ifdef SWIGLUA
|
||||
// lua only has one numeric type, so most of the overloads shadow each other creating warnings
|
||||
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) Nums::over;
|
||||
#endif
|
||||
|
||||
%{
|
||||
#include <iostream>
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
struct Limits {
|
||||
signed char schar_min() { return SCHAR_MIN; }
|
||||
signed char schar_max() { return SCHAR_MAX; }
|
||||
short shrt_min() { return SHRT_MIN; }
|
||||
short shrt_max() { return SHRT_MAX; }
|
||||
int int_min() { return INT_MIN; }
|
||||
int int_max() { return INT_MAX; }
|
||||
float flt_min() { return FLT_MIN; }
|
||||
float flt_max() { return FLT_MAX; }
|
||||
double dbl_max() { return DBL_MAX; }
|
||||
};
|
||||
|
||||
struct Nums {
|
||||
const char * over(signed char v) {
|
||||
return "signed char";
|
||||
}
|
||||
const char * over(short v) {
|
||||
return "short";
|
||||
}
|
||||
const char * over(int v) {
|
||||
return "int";
|
||||
}
|
||||
const char * over(float v) {
|
||||
return "float";
|
||||
}
|
||||
const char * over(double v) {
|
||||
return "double";
|
||||
}
|
||||
double doublebounce(double v) {
|
||||
return v;
|
||||
}
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ CPP_TEST_CASES += \
|
|||
li_std_wstream \
|
||||
li_std_wstring \
|
||||
primitive_types \
|
||||
python_abstractbase \
|
||||
python_abstractbase \
|
||||
python_append \
|
||||
python_director \
|
||||
python_nondynamic \
|
||||
|
|
@ -165,6 +165,9 @@ endif
|
|||
clean:
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile python_clean
|
||||
rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
|
||||
rm -f clientdata_prop_a.py clientdata_prop_b.py import_stl_a.py import_stl_b.py
|
||||
rm -f imports_a.py imports_b.py mod_a.py mod_b.py multi_import_a.py
|
||||
rm -f multi_import_b.py packageoption_a.py packageoption_b.py packageoption_c.py
|
||||
|
||||
cvsignore:
|
||||
@echo '*wrap* *.pyc *.so *.dll *.exp *.lib'
|
||||
|
|
|
|||
|
|
@ -11,6 +11,14 @@ check(1, A(1).get())
|
|||
check(2, A(1.0).get())
|
||||
check(3, A(B()).get())
|
||||
check(4, A("hello").get())
|
||||
try:
|
||||
check(3, A(None).get())
|
||||
raise RuntimeError
|
||||
except ValueError:
|
||||
# ValueError: invalid null reference in method 'new_A', argument 1 of type 'B const &'
|
||||
# Arguably A(char *) should be chosen, but there is a bug to do with None passed to methods overloaded by value,
|
||||
# references and pointers to different types, where pointers ought to be given a slightly higher precedence.
|
||||
pass
|
||||
|
||||
check(1, get(1))
|
||||
check(2, get(1.0))
|
||||
|
|
@ -71,3 +79,47 @@ try:
|
|||
except TypeError:
|
||||
pass
|
||||
|
||||
#### Class testing None ####
|
||||
|
||||
# No implicit conversion
|
||||
check(1, AA(1).get())
|
||||
check(2, AA(1.0).get())
|
||||
check(3, AA(B()).get())
|
||||
check(3, AA(None).get())
|
||||
check(4, AA("hello").get())
|
||||
check(5, AA(BB()).get())
|
||||
|
||||
check(1, get_AA_val(1))
|
||||
check(2, get_AA_val(1.0))
|
||||
check(3, get_AA_val(B()))
|
||||
check(3, get_AA_val(None))
|
||||
check(5, get_AA_val(BB()))
|
||||
|
||||
# Explicit constructor:
|
||||
try:
|
||||
check(4, get_AA_val("hello"))
|
||||
raise RuntimeError
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
check(1, get_AA_ref(1))
|
||||
check(2, get_AA_ref(1.0))
|
||||
check(3, get_AA_ref(B()))
|
||||
check(3, get_AA_ref(None))
|
||||
check(5, get_AA_ref(BB()))
|
||||
|
||||
# Explicit constructor:
|
||||
try:
|
||||
check(4, get_AA_ref("hello"))
|
||||
raise RuntimeError
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
|
||||
### overloading priority test ###
|
||||
|
||||
ccc = CCC(B())
|
||||
check(ccc.checkvalue, 10)
|
||||
check(ccc.xx(123), 11)
|
||||
check(ccc.yy(123, 123), 111)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,12 @@ if li_std_wstring.test_ccvalue(x) != x:
|
|||
if li_std_wstring.test_cvalue(x) != x:
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_wstring.test_wchar_overload(x) != x:
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_wstring.test_wchar_overload("not unicode") != "not unicode":
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_wstring.test_value(x) != x:
|
||||
print x, li_std_wstring.test_value(x)
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
|
|
|||
43
Examples/test-suite/python/overload_numeric_runme.py
Normal file
43
Examples/test-suite/python/overload_numeric_runme.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
from overload_numeric import *
|
||||
import math
|
||||
|
||||
nums = Nums()
|
||||
limits = Limits()
|
||||
|
||||
def check(got, expected):
|
||||
if got != expected:
|
||||
raise RuntimeError("got: " + got + " expected: " + expected)
|
||||
|
||||
check(nums.over(0), "signed char")
|
||||
check(nums.over(0.0), "float")
|
||||
|
||||
check(nums.over(limits.schar_min()), "signed char")
|
||||
check(nums.over(limits.schar_max()), "signed char")
|
||||
|
||||
check(nums.over(limits.schar_min()-1), "short")
|
||||
check(nums.over(limits.schar_max()+1), "short")
|
||||
check(nums.over(limits.shrt_min()), "short")
|
||||
check(nums.over(limits.shrt_max()), "short")
|
||||
|
||||
check(nums.over(limits.shrt_min()-1), "int")
|
||||
check(nums.over(limits.shrt_max()+1), "int")
|
||||
check(nums.over(limits.int_min()), "int")
|
||||
check(nums.over(limits.int_max()), "int")
|
||||
|
||||
check(nums.over(limits.flt_min()), "float")
|
||||
check(nums.over(limits.flt_max()), "float")
|
||||
|
||||
check(nums.over(limits.flt_max()*10), "double")
|
||||
check(nums.over(-limits.flt_max()*10), "double")
|
||||
check(nums.over(limits.dbl_max()), "double")
|
||||
check(nums.over(-limits.dbl_max()), "double")
|
||||
|
||||
check(nums.over(float("inf")), "float")
|
||||
check(nums.over(float("-inf")), "float")
|
||||
check(nums.over(float("nan")), "float")
|
||||
|
||||
# Just check if the following are accepted without exceptions being thrown
|
||||
nums.doublebounce(float("inf"))
|
||||
nums.doublebounce(float("-inf"))
|
||||
nums.doublebounce(float("nan"))
|
||||
|
|
@ -2,3 +2,10 @@ from python_append import *
|
|||
t=Test()
|
||||
t.func()
|
||||
t.static_func()
|
||||
|
||||
if grabpath() != os.path.dirname(mypath):
|
||||
raise RuntimeError
|
||||
|
||||
if grabstaticpath() != os.path.basename(mypath):
|
||||
raise RuntimeError
|
||||
|
||||
|
|
|
|||
|
|
@ -1,25 +1,43 @@
|
|||
/*
|
||||
Testcase to test %pythonprepend and %pythonappend
|
||||
Testcase to test %pythonprepend and %pythonappend %pythoncode %pythonbegin
|
||||
*/
|
||||
|
||||
%module python_append
|
||||
|
||||
%pythoncode %{
|
||||
mypath = os.path.dirname("/a/b/c/d.txt")
|
||||
funcpath = None
|
||||
staticfuncpath = None
|
||||
def grabpath():
|
||||
return funcpath
|
||||
def grabstaticpath():
|
||||
return staticfuncpath
|
||||
%}
|
||||
|
||||
%pythonappend Test::func %{
|
||||
pass
|
||||
funcpath = os.path.dirname(funcpath)
|
||||
%}
|
||||
|
||||
%pythonprepend Test::func %{
|
||||
pass
|
||||
global funcpath
|
||||
funcpath = mypath
|
||||
%}
|
||||
|
||||
%pythonappend Test::static_func %{
|
||||
staticfuncpath = os.path.basename(staticfuncpath)
|
||||
pass
|
||||
%}
|
||||
|
||||
%pythonprepend Test::static_func {
|
||||
global staticfuncpath
|
||||
staticfuncpath = mypath
|
||||
pass
|
||||
}
|
||||
|
||||
%pythonbegin %{
|
||||
import os.path
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
|
||||
class Test {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ C_TEST_CASES += \
|
|||
|
||||
CPP_TEST_CASES += \
|
||||
r_double_delete \
|
||||
r_overload_array
|
||||
r_overload_array \
|
||||
r_sexp
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
|
|
|
|||
7
Examples/test-suite/r/r_sexp_runme.R
Normal file
7
Examples/test-suite/r/r_sexp_runme.R
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
source("unittest.R")
|
||||
dyn.load(paste("r_sexp", .Platform$dynlib.ext, sep=""))
|
||||
source("r_sexp.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
obj <- return_sexp(1);
|
||||
unittest(obj, 1)
|
||||
10
Examples/test-suite/r_sexp.i
Normal file
10
Examples/test-suite/r_sexp.i
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
%module r_sexp
|
||||
|
||||
extern "C" SEXP return_sexp(SEXP x);
|
||||
|
||||
%inline %{
|
||||
SEXP return_sexp(SEXP x) {
|
||||
return x; //Rcpp NumericVector is automatically casted to SEXP
|
||||
}
|
||||
%}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue