diff options
Diffstat (limited to 'Examples/test-suite/typemap_subst.i')
-rw-r--r-- | Examples/test-suite/typemap_subst.i | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Examples/test-suite/typemap_subst.i b/Examples/test-suite/typemap_subst.i new file mode 100644 index 000000000..f9bc8dd6e --- /dev/null +++ b/Examples/test-suite/typemap_subst.i @@ -0,0 +1,54 @@ +/* This interface file tests for type-related typemap substitutions. + */ + +%module typemap_subst + +%warnfilter(801) xyzzy; /* Ruby, wrong class name */ + +%inline %{ + struct xyzzy { + int member; + }; +%} + +%typemap(in) const struct xyzzy **TEST + ($type temp, $*type startemp, $&type amptemp, $basetype basetemp) +{ + { /* Test C type name substitutions */ + $ltype a = (struct xyzzy **) NULL; + const struct xyzzy **b = ($type) NULL; + $<ype c = (struct xyzzy ***) NULL; + const struct xyzzy ***d = ($&type) NULL; + $*ltype e = *a; + $basetype f; + f.member = 42; + } + { /* Test locals */ + basetemp.member = 0; + startemp = &basetemp; + temp = &startemp; + amptemp = &temp; + } + /* Java module doesn't seem to use SWIG's type system? */ + { /* Test descriptors */ + void *desc = $descriptor; + void *stardesc = $*descriptor; + void *ampdesc = $&descriptor; + } + { /* Test mangled names */ + void *desc = SWIGTYPE$mangle; + void *stardesc = SWIGTYPE$*mangle; + void *ampdesc = SWIGTYPE$&mangle; + } + $1 = ($ltype) temp; +} + +#ifndef SWIGJAVA +%inline %{ + void foo(const struct xyzzy **TEST) {} +%} +#endif + + + + |