1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
%module(docstring="hello.") autodoc
%feature("autodoc");
// special typemap and its docs
%typemap(in) (int c, int d) "$1 = 0; $2 = 0;";
%typemap(doc,name="hello",type="Tuple") (int c, int d) "hello: int tuple[2]";
// testing for different documentation levels
%feature("autodoc","0") A::func0; // names
%feature("autodoc","1") A::func1; // names + types
%feature("autodoc","2") A::func2; // extended
%feature("autodoc","3") A::func3; // extended + types
%feature("autodoc","0") A::func0default; // names
%feature("autodoc","1") A::func1default; // names + types
%feature("autodoc","2") A::func2default; // extended
%feature("autodoc","3") A::func3default; // extended + types
%feature("autodoc","0") A::func0static; // names
%feature("autodoc","1") A::func1static; // names + types
%feature("autodoc","2") A::func2static; // extended
%feature("autodoc","3") A::func3static; // extended + types
%feature("autodoc","0") A::variable_a; // names
%feature("autodoc","1") A::variable_b; // names + types
%feature("autodoc","2") A::variable_c; // extended
%feature("autodoc","3") A::variable_d; // extended + types
%feature("autodoc","just a string.") A::funk; // names
%inline {
enum Hola {
hi, hello
};
struct A {
A(int a, short b, Hola h) {}
int funk(int a) { return a; }
int func0(short, int c, int d) { return c; }
int func1(short, int c, int d) { return c; }
int func2(short, int c, int d) { return c; }
int func3(short, int c, int d) { return c; }
int func0default(A *e, short, int c, int d, double f = 2) { return 0; }
int func1default(A *e, short, int c, int d, double f = 2) { return 0; }
int func2default(A *e, short, int c, int d, double f = 2) { return 0; }
int func3default(A *e, short, int c, int d, double f = 2) { return 0; }
static int func0static(A *e, short, int c, int d, double f = 2) { return 0; }
static int func1static(A *e, short, int c, int d, double f = 2) { return 0; }
static int func2static(A *e, short, int c, int d, double f = 2) { return 0; }
static int func3static(A *e, short, int c, int d, double f = 2) { return 0; }
int variable_a;
int variable_b;
int variable_c;
int variable_d;
};
}
// deleting typemaps and docs
%typemap(in) (int c, int d) ;
%typemap(doc) (int c, int d);
// docs for some parameters
%typemap(doc) int a "a: special comment for parameter a";
%typemap(doc) int b "b: another special comment for parameter b";
%feature("autodoc","0") C::C(int a, int b, Hola h); // names
%feature("autodoc","1") D::D(int a, int b, Hola h); // names + types
%feature("autodoc","2") E::E(int a, int b, Hola h); // extended
%feature("autodoc","3") F::F(int a, int b, Hola h); // extended + types
%inline {
struct B {
B(int a, int b, Hola h) {}
int funk(int c, int d) { return c; }
};
struct C {
C(int a, int b, Hola h) {}
};
struct D {
D(int a, int b, Hola h) {}
};
struct E {
E(int a, int b, Hola h) {}
};
struct F {
F(int a, int b, Hola h) {}
};
int funk(A *e, short, int c, int d) { return c; }
int funkdefaults(A *e, short, int c, int d, double f = 2) { return c; }
}
%include <typemaps.i>
%inline %{
int func_input(int *INPUT) {
return 1;
}
int func_output(int *OUTPUT) {
*OUTPUT = 2;
return 1;
}
int func_inout(int *INOUT) {
*INOUT += 1;
return 1;
}
%}
%callback("%(uppercase)s_CALLBACK") func_cb;
%inline {
int func_cb(int c, int d) { return c; }
}
// Bug 3310528
%feature("autodoc","1") banana; // names + types
%inline %{
typedef struct tagS {
int a;
char b;
} S;
typedef int Integer;
void banana(S *a, const struct tagS *b, int c, Integer d) {}
%}
%inline %{
#ifdef SWIGPYTHON_BUILTIN
bool is_python_builtin() { return true; }
#else
bool is_python_builtin() { return false; }
#endif
%}
|