diff options
author | Marcelo Matus <mmatus@acms.arizona.edu> | 2006-01-30 19:55:43 +0000 |
---|---|---|
committer | Marcelo Matus <mmatus@acms.arizona.edu> | 2006-01-30 19:55:43 +0000 |
commit | 19ce5762f0395649c307d01bf4781a2093d713b3 (patch) | |
tree | 0671e978b2e1dddfdcf4a9d667c1f82c7ebc39fc | |
parent | c661fae1e7145e9a7d7258a10c6e5654e065afbe (diff) | |
download | swig-19ce5762f0395649c307d01bf4781a2093d713b3.tar.gz |
reenable missing INPUT/OUTPUT, and add tests for std::string
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8637 626c5289-ae23-0410-ae9c-e8d60b6d4f22
-rw-r--r-- | Examples/test-suite/li_std_string.i | 16 | ||||
-rw-r--r-- | Examples/test-suite/perl5/li_std_string_runme.pl | 8 | ||||
-rw-r--r-- | Examples/test-suite/python/li_std_string_runme.py | 6 | ||||
-rw-r--r-- | Examples/test-suite/ruby/li_std_string_runme.rb | 9 | ||||
-rw-r--r-- | Lib/perl5/perltypemaps.swg | 4 | ||||
-rw-r--r-- | Lib/ruby/rubytypemaps.swg | 3 | ||||
-rw-r--r-- | Lib/tcl/tcltypemaps.swg | 3 |
7 files changed, 38 insertions, 11 deletions
diff --git a/Examples/test-suite/li_std_string.i b/Examples/test-suite/li_std_string.i index 68e92c410..6530c3f40 100644 --- a/Examples/test-suite/li_std_string.i +++ b/Examples/test-suite/li_std_string.i @@ -1,5 +1,11 @@ %module li_std_string -%include "std_string.i" +%include <std_string.i> + +#if defined(SWIGUTL) +%apply std::string& INPUT { std::string &input } +%apply std::string& INOUT { std::string &inout } +#endif + %inline %{ @@ -35,6 +41,14 @@ std::string& test_reference_out() { return x; } +std::string test_reference_input(std::string &input) { + return input; +} + +void test_reference_inout(std::string &inout) { + inout += inout; +} + #if defined(_MSC_VER) #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow) #endif diff --git a/Examples/test-suite/perl5/li_std_string_runme.pl b/Examples/test-suite/perl5/li_std_string_runme.pl index af61493c9..155277fda 100644 --- a/Examples/test-suite/perl5/li_std_string_runme.pl +++ b/Examples/test-suite/perl5/li_std_string_runme.pl @@ -97,3 +97,11 @@ if ($li_std_string::Structure::StaticMemberString2 ne $s) { if ($li_std_string::Structure::ConstStaticMemberString ne "const static member string") { die ("ConstStaticMemberString test"); } + +if (li_std_string::test_reference_input("hello") ne "hello") { + die ("reference_input"); +} + +if (li_std_string::test_reference_inout("hello") ne "hellohello") { + die ("reference_inout"); +} diff --git a/Examples/test-suite/python/li_std_string_runme.py b/Examples/test-suite/python/li_std_string_runme.py index 67696e5bf..1360cacb5 100644 --- a/Examples/test-suite/python/li_std_string_runme.py +++ b/Examples/test-suite/python/li_std_string_runme.py @@ -113,3 +113,9 @@ if li_std_string.cvar.Structure_StaticMemberString2 != s: if li_std_string.cvar.Structure_ConstStaticMemberString != "const static member string": raise RuntimeError, "ConstStaticMemberString test" + +if li_std_string.test_reference_input("hello") != "hello": + raise RuntimeError +s = li_std_string.test_reference_inout("hello") +if s != "hellohello": + raise RuntimeError diff --git a/Examples/test-suite/ruby/li_std_string_runme.rb b/Examples/test-suite/ruby/li_std_string_runme.rb index 4f853d1ea..e9617f9bf 100644 --- a/Examples/test-suite/ruby/li_std_string_runme.rb +++ b/Examples/test-suite/ruby/li_std_string_runme.rb @@ -102,3 +102,12 @@ end if (Structure.ConstStaticMemberString != "const static member string") raise RuntimeError end + + +if (test_reference_input("hello") != "hello") + raise RuntimeError +end +s = test_reference_inout("hello") +if (s != "hellohello") + raise RuntimeError +end diff --git a/Lib/perl5/perltypemaps.swg b/Lib/perl5/perltypemaps.swg index e24337ba3..c3a9ef0d6 100644 --- a/Lib/perl5/perltypemaps.swg +++ b/Lib/perl5/perltypemaps.swg @@ -40,10 +40,6 @@ #undef SWIG_DIRECTOR_TYPEMAPS #endif -#ifndef SWIG_INOUT_NODEF -#define SWIG_INOUT_NODEF -#endif - /* Perl types */ #define SWIG_Object SV * diff --git a/Lib/ruby/rubytypemaps.swg b/Lib/ruby/rubytypemaps.swg index d6fe1d5d1..45e894666 100644 --- a/Lib/ruby/rubytypemaps.swg +++ b/Lib/ruby/rubytypemaps.swg @@ -31,9 +31,6 @@ #define SWIG_DIRECTOR_TYPEMAPS #endif -#ifndef SWIG_INOUT_NODEF -#define SWIG_INOUT_NODEF -#endif /* Ruby types */ #define SWIG_Object VALUE diff --git a/Lib/tcl/tcltypemaps.swg b/Lib/tcl/tcltypemaps.swg index 97613653a..3901603e1 100644 --- a/Lib/tcl/tcltypemaps.swg +++ b/Lib/tcl/tcltypemaps.swg @@ -37,9 +37,6 @@ #undef SWIG_DIRECTOR_TYPEMAPS #endif -#ifndef SWIG_INOUT_NODEF -#define SWIG_INOUT_NODEF -#endif /* Tcl types */ #define SWIG_Object Tcl_Obj * |