PageRenderTime 36ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

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

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