1 %module csharp_typemaps
3 // Test the C# types customisation by modifying the default char * typemaps to return a single char
5 %typemap(ctype, out="char /*ctype out override*/") char * "char *"
6 %typemap(imtype, out="char /*imtype out override*/") char * "string"
7 %typemap(cstype, out="char /*cstype out override*/") char * "string"
9 %typemap(out) char * %{
10 // return the 0th element rather than the whole string
11 $result = SWIG_csharp_string_callback($1)[0];
14 %typemap(csout, excode=SWIGEXCODE) char * {
15 char ret = $imcall;$excode
19 %typemap(csvarout, excode=SWIGEXCODE2) char * %{
21 char ret = $imcall;$excode
29 char* start(char *val) { return val; }
30 static char* stop(char *val) { return val; }
32 char* partyon(char *val) { return val; }
37 // Test variables when ref is used in the cstype typemap - the variable name should come from the out attribute if specified
38 %typemap(cstype) MKVector, const MKVector& "MKVector"
39 %typemap(cstype, out="MKVector") MKVector &, MKVector * "ref MKVector"
44 struct MKRenderGameVector {
46 static MKVector staticValue;
48 MKVector MKRenderGameVector::staticValue;
53 // Number and Obj are for the eager garbage collector runtime test
56 Number(double value) : Value(value) {}
62 Number triple(Number n) {
66 Number times6(const Number& num) {
71 Number times9(const Number* num) {
77 Number quadruple(Number n) {
81 Number times8(const Number& num) {
86 Number times12(const Number* num) {
93 // Test $csinput expansion
94 %typemap(csvarin, excode=SWIGEXCODE2) int %{
97 throw new ApplicationException("number too small!");