diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2009-08-18 20:56:02 +0000 |
|---|---|---|
| committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-25 16:59:08 +0000 |
| commit | 9f8a09ed743cedd9547bf0661d518647966ab114 (patch) | |
| tree | 9c7803d3b27a8ec22e91792ac7f7932efa128b20 /Examples/test-suite/typemap_subst.i | |
| download | swig-tarball-master.tar.gz | |
Imported from /srv/lorry/lorry-area/swig-tarball/swig-1.3.40.tar.gz.HEADswig-1.3.40master
Diffstat (limited to 'Examples/test-suite/typemap_subst.i')
| -rw-r--r-- | Examples/test-suite/typemap_subst.i | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/Examples/test-suite/typemap_subst.i b/Examples/test-suite/typemap_subst.i new file mode 100644 index 0000000..d5a8416 --- /dev/null +++ b/Examples/test-suite/typemap_subst.i @@ -0,0 +1,73 @@ +/* This interface file tests for type-related typemap substitutions. + */ + +%module typemap_subst + +%warnfilter(SWIGWARN_RUBY_WRONG_NAME) 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; + (void)a; + (void)b; + (void)c; + (void)d; + (void)e; + } + { /* Test locals */ + basetemp.member = 0; + startemp = &basetemp; + temp = &startemp; + amptemp = &temp; + } + { /* Test descriptors */ + void *desc = $descriptor; + void *stardesc = $*descriptor; + void *ampdesc = $&descriptor; + (void)desc; + (void)stardesc; + (void)ampdesc; + } + { /* Test mangled names */ + void *desc = SWIGTYPE$mangle; + void *stardesc = SWIGTYPE$*mangle; + void *ampdesc = SWIGTYPE$&mangle; + (void)desc; + (void)stardesc; + (void)ampdesc; + } + { /* Test descriptor macro */ + void *desc = $descriptor(const struct xyzzy **); + void *stardesc = $descriptor(const struct xyzzy *); + void *ampdesc = $descriptor(const struct xyzzy ***); + (void)desc; + (void)stardesc; + (void)ampdesc; + } + $1 = ($ltype) temp; +} + +/* Java and C# modules don't use SWIG's runtime type system */ +#if !defined(SWIGJAVA) && !defined(SWIGCSHARP) +%inline %{ + void foo(const struct xyzzy **TEST) {} +%} +#endif + + + + |
