missing test file
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6440 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e639abae0f
commit
da7b869cbf
1 changed files with 136 additions and 0 deletions
136
Examples/test-suite/mixed_types.i
Normal file
136
Examples/test-suite/mixed_types.i
Normal file
|
|
@ -0,0 +1,136 @@
|
||||||
|
%module caca
|
||||||
|
|
||||||
|
|
||||||
|
%inline
|
||||||
|
{
|
||||||
|
const void* ref_pointer(const void*& a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct A
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
const A* ref_pointer(A* const& a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
const A** ref_pointer_1(const A**& a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
A* pointer_1(A* a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
const A& ref_const(const A& a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Hello { hi,hello };
|
||||||
|
|
||||||
|
int sint(int a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int& ref_int(const int& a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
Hello senum(Hello a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Hello& ref_enum(const Hello& a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef A *Aptr;
|
||||||
|
const Aptr& rptr_const(const Aptr& a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Aptr& rptr_const2(const Aptr& a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
const void*& rptr_void(const void*& a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
const A& cref_a(const A& a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
A& ref_a(A& a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef char name[8];
|
||||||
|
typedef char namea[];
|
||||||
|
|
||||||
|
char* test_a(char hello[8],
|
||||||
|
char hi[],
|
||||||
|
const char chello[8],
|
||||||
|
const char chi[]) {
|
||||||
|
return hi;
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_b(const name& n1, name n2) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Foo
|
||||||
|
{
|
||||||
|
int foo(const Aptr&a);
|
||||||
|
int foon(const char (&a)[8]);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline int Foo::foo(A* const& a) { return 1; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
%{
|
||||||
|
inline int Foo::foon(const name& a) { return a[0]; }
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
#define ARRAY_LEN_X 2
|
||||||
|
#define ARRAY_LEN_Y 4
|
||||||
|
|
||||||
|
typedef enum {One, Two, Three, Four, Five} finger;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
double double_field;
|
||||||
|
} SimpleStruct;
|
||||||
|
|
||||||
|
char array_c [ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
signed char array_sc[ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
unsigned char array_uc[ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
short array_s [ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
unsigned short array_us[ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
int array_i [ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
unsigned int array_ui[ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
long array_l [ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
unsigned long array_ul[ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
long long array_ll[ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
float array_f [ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
double array_d [ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
SimpleStruct array_struct[ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
SimpleStruct* array_structpointers[ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
int* array_ipointers [ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
finger array_enum[ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
finger* array_enumpointers[ARRAY_LEN_X][ARRAY_LEN_Y];
|
||||||
|
const int array_const_i[ARRAY_LEN_X][ARRAY_LEN_Y] = { {10, 11, 12, 13}, {14, 15, 16, 17} };
|
||||||
|
|
||||||
|
void fn_taking_arrays(SimpleStruct array_struct[ARRAY_LEN_X][ARRAY_LEN_Y]) {}
|
||||||
|
|
||||||
|
int get_2d_array(int (*array)[ARRAY_LEN_Y], int x, int y){
|
||||||
|
return array[x][y];
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue