Back out valueparm attribute in the csvarin typemap. Add example usage of temporary variables in the csvarin typemap into docs. Modify CDate C# example. Add in special variable expansion in the csvarin typemap.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9949 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2007-09-21 23:58:00 +00:00
commit 8a17d9dcfa
4 changed files with 197 additions and 29 deletions

View file

@ -15,13 +15,16 @@ public class runme
initialLetters.Append(myChar);
myChar = csharp_typemaps.partyon("off");
initialLetters.Append(myChar);
myChar = csharp_typemaps.STRINGCONSTANT;
initialLetters.Append(myChar);
if (initialLetters.ToString() != "bhox")
if (initialLetters.ToString() != "bho")
throw new Exception("initial letters failed");
if (csharp_typemaps.go != 'z')
throw new Exception("go variable failed");
// $csinput expansion
csharp_typemaps.myInt = 1;
try {
csharp_typemaps.myInt = -1;
throw new Exception("oops");
} catch (ApplicationException) {
}
// Eager garbage collector test
{

View file

@ -22,14 +22,6 @@
return ret;
} %}
// test valueparm attribute
%typemap(csvarin, excode=SWIGEXCODE2, valueparm="tempValue") char * %{
set {
string tempValue = new string(value, 3);
$imcall;$excode
} %}
%inline %{
namespace Space {
class Things {
@ -38,8 +30,6 @@ namespace Space {
static char* stop(char *val) { return val; }
};
char* partyon(char *val) { return val; }
#define STRINGCONSTANT "xyz string"
char *go = "zap";
}
%}
@ -100,3 +90,14 @@ Number times12(const Number* num) {
};
%}
// Test $csinput expansion
%typemap(csvarin, excode=SWIGEXCODE2) int %{
set {
if ($csinput < 0)
throw new ApplicationException("number too small!");
$imcall;$excode
} %}
%inline %{
int myInt = 0;
%}