PageRenderTime 27ms CodeModel.GetById 21ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/trunk/Examples/test-suite/typemap_subst.i

#
Swig | 73 lines | 61 code | 9 blank | 3 comment | 0 complexity | d2188a42a0959631cc94e343976e53c7 MD5 | raw file
 1/* This interface file tests for type-related typemap substitutions.
 2 */
 3
 4%module typemap_subst
 5
 6%warnfilter(SWIGWARN_RUBY_WRONG_NAME) xyzzy; /* Ruby, wrong class name */
 7
 8%inline %{
 9  struct xyzzy {
10    int member;
11  };
12%}
13
14%typemap(in) const struct xyzzy **TEST
15  ($type temp, $*type startemp, $&type amptemp, $basetype basetemp)
16{
17  { /* Test C type name substitutions */
18    $ltype a = (struct xyzzy **) NULL;
19    const struct xyzzy **b = ($type) NULL;
20    $&ltype c = (struct xyzzy ***) NULL;
21    const struct xyzzy ***d = ($&type) NULL;
22    $*ltype e = *a;
23    $basetype f;
24    f.member = 42;
25    (void)a;
26    (void)b;
27    (void)c;
28    (void)d;
29    (void)e;
30  }
31  { /* Test locals */
32    basetemp.member = 0;
33    startemp = &basetemp;
34    temp = &startemp;
35    amptemp = &temp;
36  }
37  { /* Test descriptors */
38    void *desc = $descriptor;
39    void *stardesc = $*descriptor;
40    void *ampdesc = $&descriptor;
41    (void)desc;
42    (void)stardesc;
43    (void)ampdesc;
44  }
45  { /* Test mangled names */
46    void *desc = SWIGTYPE$mangle;
47    void *stardesc = SWIGTYPE$*mangle;
48    void *ampdesc = SWIGTYPE$&mangle;
49    (void)desc;
50    (void)stardesc;
51    (void)ampdesc;
52  }
53  { /* Test descriptor macro */
54    void *desc = $descriptor(const struct xyzzy **);
55    void *stardesc = $descriptor(const struct xyzzy *);
56    void *ampdesc = $descriptor(const struct xyzzy ***);
57    (void)desc;
58    (void)stardesc;
59    (void)ampdesc;
60  }
61  $1 = ($ltype) temp;  
62}
63
64/* Java, C#, Go and D modules don't use SWIG's runtime type system */
65#if !defined(SWIGJAVA) && !defined(SWIGCSHARP) && !defined(SWIGGO) && !defined(SWIGD)
66%inline %{
67  void foo(const struct xyzzy **TEST) {}
68%}
69#endif
70
71
72
73