1 /* File : example.i */ 2 %module my_example 3 4 enum color { RED=10, BLUE, GREEN }; 5 6 class Foo { 7 public: Foo()8 Foo() { } 9 enum speed { IMPULSE, WARP, LUDICROUS }; 10 void enum_test(speed s); 11 }; 12 13 void enum_test(color c, Foo::speed s); 14 15 16 17 %include pointer.i 18 19 /* Next we'll use some typemaps */ 20 21 %include typemaps.i 22 23 %typemap(out) int * { 24 WHATEVER MAKES YOU HAPPY AS RESULT 25 } 26 27 %typemap(in) int * { 28 WHATEVER MAKES YOU HAPPY AS PARAMETER 29 } 30 31 %pragma(xml) DEBUG="false"; 32 33 extern int * my_gcd(const char * x, int * y[], int * r, int (*op)(int,int)) const; 34 extern double my_foo; 35 void my_void(); 36 my_empty(); 37 38 const double my_dutch = 1.0; 39 40 union my_union 41 { 42 int my_iii; 43 char my_ccc; 44 }; 45 46 struct my_struct 47 { 48 public: 49 virtual ~my_struct(); 50 int my_foo(); 51 protected: 52 int my_bar; 53 double x, y; 54 virtual double area() = 0; 55 static int nshapes; 56 }; 57 58 class my_class : public my_struct, public my_union 59 { 60 public: 61 my_class( char c ); 62 private: 63 ~my_class(); 64 virtual const int * my_func( my_class , char * * x, int y[], const int & r) const; 65 double my_foo[128]; 66 const my_int i; 67 }; 68 69 typedef int my_int; 70