diff --git a/Examples/test-suite/li_std_map.i b/Examples/test-suite/li_std_map.i index edcb05641..806e732ee 100644 --- a/Examples/test-suite/li_std_map.i +++ b/Examples/test-suite/li_std_map.i @@ -47,8 +47,15 @@ namespace std %template(pairiiAc) pair >; +#ifdef SWIGRUBY %template() pair< swig::LANGUAGE_OBJ, swig::LANGUAGE_OBJ >; %template(LanguageMap) map< swig::LANGUAGE_OBJ, swig::LANGUAGE_OBJ >; +#endif + +#ifdef SWIGPYTHON + %template() pair; + %template(pymap) map; +#endif } diff --git a/Examples/test-suite/li_std_set.i b/Examples/test-suite/li_std_set.i index c2cdc2ebe..6da920a5a 100644 --- a/Examples/test-suite/li_std_set.i +++ b/Examples/test-suite/li_std_set.i @@ -31,4 +31,10 @@ +#if defined(SWIGRUBY) %template(LanguageSet) std::set; +#endif + +#if defined(SWIGPYTHON) +%template(pyset) std::set; +#endif diff --git a/Examples/test-suite/python/li_std_vector.i b/Examples/test-suite/li_std_vector_extra.i similarity index 98% rename from Examples/test-suite/python/li_std_vector.i rename to Examples/test-suite/li_std_vector_extra.i index 06dafce59..17baffe04 100644 --- a/Examples/test-suite/python/li_std_vector.i +++ b/Examples/test-suite/li_std_vector_extra.i @@ -1,4 +1,4 @@ -%module li_std_vector +%module li_std_vector_extra %warnfilter(509) overloaded1; %warnfilter(509) overloaded2; diff --git a/Examples/test-suite/python/li_std_map.i b/Examples/test-suite/python/li_std_map.i deleted file mode 100644 index a8ba4f2e2..000000000 --- a/Examples/test-suite/python/li_std_map.i +++ /dev/null @@ -1,58 +0,0 @@ -%module("templatereduce") li_std_map - -%include std_pair.i -%include std_map.i -%include std_multimap.i - -%inline %{ -struct A{ - int val; - - A(int v = 0): val(v) - { - } - -}; -%} - -namespace std -{ - %template(pairii) pair; - %template(pairAA) pair; - %template(pairA) pair; - %template(mapA) map; - %template(mmapA) multimap; - - %template(paircA1) pair; - %template(paircA2) pair; - %template(pairiiA) pair >; - %template(pairiiAc) pair >; - - - %template() pair; - %template(pymap) map; - -} - - - -%inline -{ -std::pair -p_identa(std::pair p) { - return p; -} - -std::map m_identa(const std::map& v) -{ - return v; -} - -} - - - -namespace std -{ -%template(mapii) map; -} diff --git a/Examples/test-suite/python/li_std_set.i b/Examples/test-suite/python/li_std_set.i deleted file mode 100644 index f0fddb058..000000000 --- a/Examples/test-suite/python/li_std_set.i +++ /dev/null @@ -1,17 +0,0 @@ -%module li_std_set - -%include -%include -%include -%include - -%template(set_string) std::set; -%template(set_int) std::multiset; - - -%template(v_int) std::vector; - - - - -%template(pyset) std::set; diff --git a/Examples/test-suite/python/li_std_stream.i b/Examples/test-suite/python/li_std_stream.i deleted file mode 100644 index 0a999ddbf..000000000 --- a/Examples/test-suite/python/li_std_stream.i +++ /dev/null @@ -1,59 +0,0 @@ -%module li_std_stream - -%inline %{ - struct A; -%} - -%include -%include - - - -%callback(1) A::bar; - -%inline %{ - - struct B { - virtual ~B() - { - } - - }; - - struct A : B - { - void __add__(int a) - { - } - - void __add__(double a) - { - } - - static int bar(int a){ - return a; - } - - static int foo(int a, int (*pf)(int a)) - { - return pf(a); - } - - - std::ostream& __rlshift__(std::ostream& out) - { - out << "A class"; - return out; - } - }; -%} - -%extend std::basic_ostream{ - std::basic_ostream& - operator<<(const A& a) - { - *self << "A class"; - return *self; - } -} - diff --git a/Examples/test-suite/python/li_std_vector_runme.py b/Examples/test-suite/python/li_std_vector_extra_runme.py similarity index 98% rename from Examples/test-suite/python/li_std_vector_runme.py rename to Examples/test-suite/python/li_std_vector_extra_runme.py index a0d96d4aa..ce7b0c737 100644 --- a/Examples/test-suite/python/li_std_vector_runme.py +++ b/Examples/test-suite/python/li_std_vector_extra_runme.py @@ -1,4 +1,4 @@ -from li_std_vector import * +from li_std_vector_extra import * iv = IntVector(4) for i in range(0,4): diff --git a/Examples/test-suite/python/li_std_wstring.i b/Examples/test-suite/python/li_std_wstring.i deleted file mode 100644 index c809e11ec..000000000 --- a/Examples/test-suite/python/li_std_wstring.i +++ /dev/null @@ -1,89 +0,0 @@ -%module li_std_wstring -%include -%include - - -%inline %{ - -struct A : std::wstring -{ - A(const std::wstring& s) : std::wstring(s) - { - } -}; - -struct B -{ - B(const std::wstring& s) : cname(0), name(s), a(s) - { - } - - char *cname; - std::wstring name; - A a; - -}; - - -wchar_t test_wcvalue(wchar_t x) { - return x; -} - -const wchar_t* test_ccvalue(const wchar_t* x) { - return x; -} - -wchar_t* test_cvalue(wchar_t* x) { - return x; -} - - -std::wstring test_value(std::wstring x) { - return x; -} - -const std::wstring& test_const_reference(const std::wstring &x) { - return x; -} - -void test_pointer(std::wstring *x) { -} - -std::wstring *test_pointer_out() { - static std::wstring x = L"x"; - return &x; -} - -void test_const_pointer(const std::wstring *x) { -} - -const std::wstring *test_const_pointer_out() { - static std::wstring x = L"x"; - return &x; -} - -void test_reference(std::wstring &x) { -} - -std::wstring& test_reference_out() { - static std::wstring x = L"x"; - return x; -} - -#if defined(_MSC_VER) - #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow) -#endif - -void test_throw() throw(std::wstring){ - static std::wstring x = L"x"; - - throw x; -} - -#if defined(_MSC_VER) - #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow) -#endif - -%} - - diff --git a/Examples/test-suite/python/std_containers.i b/Examples/test-suite/python/std_containers.i deleted file mode 100644 index a1d39e7ab..000000000 --- a/Examples/test-suite/python/std_containers.i +++ /dev/null @@ -1,199 +0,0 @@ -%module std_containers - -%{ -#include -%} -%include std_vector.i -%include std_string.i -%include std_deque.i -%include std_list.i -%include std_set.i -%include std_multiset.i -%include std_pair.i -%include std_map.i -%include std_multimap.i -%include std_complex.i - -%template() std::vector; -%template() std::pair; -%template() std::pair; - -%template() std::vector< std::vector > ; -%template(ccube) std::vector< std::vector< std::vector > >; - -%inline -{ - typedef - std::vector > > - ccube; - - ccube cident(const ccube& c) - { - return c; - } - - struct C - { - }; -} - - -%template(map_si) std::map; -%template(pair_iC) std::pair; -%template(map_iC) std::map; -%template(mmap_si) std::multimap; -%template(set_i) std::set; -%template(multiset_i) std::multiset; -%template(list_i) std::list; -%template(deque_i) std::deque; - -%template(vector_b) std::vector; -%template(vector_i) std::vector; -%template(vector_c) std::vector >; -%template(vector_ui) std::vector; - -%template(bmatrix) std::vector >; -%template(imatrix) std::vector >; -%template(cmatrix) std::vector > >; - -%apply std::vector *INOUT {std::vector *INOUT2}; - -%inline -{ - typedef std::vector > imatrix; - imatrix midenti(const imatrix& v) - { - return v; - } - - typedef std::vector > bmatrix; - bmatrix midentb(const bmatrix& v) - { - return v; - } - - std::map mapidentc(const std::map& v) - { - return v; - } - - std::map mapidenti(const std::map& v) - { - return v; - } - - std::map mapident(const std::map& v) - { - return v; - } - - std::multimap mapident(const std::multimap& v) - { - return v; - } - - std::vector vident(const std::vector& v) - { - return v; - } - - std::set sident(const std::set& v) - { - return v; - } - - std::vector videntu(const std::vector& v) - { - return v; - } - - - int get_elem(const std::vector& v, int index) - { - return v[index]; - } - - std::pair pident(const std::pair& p) - { - return p; - } - - void - v_inout(std::vector *INOUT) { - *INOUT = *INOUT; - } - - void - v_inout2(std::vector *INOUT, std::vector *INOUT2) { - std::swap(*INOUT, *INOUT2); - } - -} - - -%{ - - template struct Param - { - }; -%} - - -template struct Param -{ -}; - - -%template(Param_c) Param >; -%inline -{ - int hello(Param > c) - { - return 0; - } -} - -%inline -{ - struct A - { - A(int aa = 0) : a(aa) - { - } - int a; - }; -} - -%template() std::pair; -%template(pair_iA) std::pair; -%template(vector_piA) std::vector >; - - -%inline { - std::pair ident(std::pair a, const std::pair& b) - { - return std::pair(); - } - - - std::vector > pia_vident(std::vector > a ) - { - return a; - } - - struct Foo - { - Foo(int i) { - } - }; - -} - - -%std_nodefconst_type(Foo); - -%template(vector_Foo) std::vector; -%template(deque_Foo) std::deque; -%template(list_Foo) std::list; - -