PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

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

#
Swig | 69 lines | 60 code | 9 blank | 0 comment | 0 complexity | 88736fed1864d280f93abae06ceb2a60 MD5 | raw file
 1%module typemap_variables
 2
 3// Check typemap name matching rules for variables
 4// Some of these are using qualified names, which is not right... the test will be adjusted as these get fixed
 5
 6#if defined(SWIGUTL)
 7%{
 8#define TYPEMAP_VARIABLES_FAIL SWIG_fail;
 9%}
10#else
11%{
12#define TYPEMAP_VARIABLES_FAIL
13%}
14#endif
15
16// Scripting languages use varin/varout for variables (except non-static member variables where in/out are used ???)
17%typemap(varin)  int                           "this_will_not_compile_varin "
18%typemap(varout) int                           "this_will_not_compile_varout"
19%typemap(varin)  int globul                    "/*int globul varin */ TYPEMAP_VARIABLES_FAIL"
20%typemap(varout) int globul                    "/*int globul varout*/ $result=0;"
21%typemap(varin)  int Space::nspace             "/*int nspace varin */ TYPEMAP_VARIABLES_FAIL"
22%typemap(varout) int Space::nspace             "/*int nspace varout*/ $result=0;"
23//%typemap(varin)  int member                    "/*int member varin */"
24//%typemap(varout) int member                    "/*int member varout*/ $result=0;"
25%typemap(varin)  int Space::Struct::smember    "/*int smember varin */ TYPEMAP_VARIABLES_FAIL"
26%typemap(varout) int Space::Struct::smember    "/*int smember varout*/ $result=0;"
27
28// Statically typed languages use in/out for variables
29%typemap(in)  int                           "this_will_not_compile_in "
30%typemap(out) int                           "this_will_not_compile_out"
31%typemap(in)  int globul                    "/*int globul in */ $1=0;"
32%typemap(out) int globul                    "/*int globul out*/ $result=0;"
33%typemap(in)  int Space::nspace             "/*int nspace in */ $1=0;"
34%typemap(out) int Space::nspace             "/*int nspace out*/ $result=0;"
35%typemap(in)  int member                    "/*int member in */ $1=0;"
36#ifdef SWIGTCL
37%typemap(out) int member                    "/*int member out*/"
38#else
39%typemap(out) int member                    "/*int member out*/ $result=0;"
40#endif
41%typemap(in)  int Space::Struct::smember    "/*int smember in */ $1=0;"
42%typemap(out) int Space::Struct::smember    "/*int smember out*/ $result=0;"
43
44%typemap(javain)  int                           "this_will_not_compile_javain "
45%typemap(javaout) int                           "this_will_not_compile_javaout"
46%typemap(javain)  int globul                    "/*int globul in */  $javainput"
47%typemap(javaout) int globul                    "/*int globul out*/  { return $jnicall; }"
48%typemap(javain)  int Space::nspace             "/*int nspace in */  $javainput"
49%typemap(javaout) int Space::nspace             "/*int nspace out*/  { return $jnicall; }"
50%typemap(javain)  int member                    "/*int member in */  $javainput"
51%typemap(javaout) int member                    "/*int member out*/  { return $jnicall; }"
52%typemap(javain)  int Space::Struct::smember    "/*int smember in */ $javainput"
53%typemap(javaout) int Space::Struct::smember    "/*int smember out*/ { return $jnicall; }"
54
55%inline %{
56
57int globul;
58
59namespace Space {
60  int nspace;
61  struct Struct {
62    int member;
63    static int smember;
64//    static short memberfunction() { return 0; } //javaout and jstype typemaps don't use fully qualified name, but other typemaps do
65  };
66  int Struct::smember = 0;
67}
68%}
69