add missing files from initial check in
change camel case to match SWIG conventions git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9182 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a9d5f49c4a
commit
0218fdeb27
7 changed files with 328 additions and 5 deletions
131
Examples/test-suite/r/copy_struct.i
Normal file
131
Examples/test-suite/r/copy_struct.i
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
%module copy_struct
|
||||
|
||||
%insert("snamespace") %{ # Just checking %}
|
||||
|
||||
|
||||
struct A {
|
||||
int i;
|
||||
unsigned int ui;
|
||||
double d;
|
||||
char* str;
|
||||
int **tmp;
|
||||
};
|
||||
|
||||
struct A getA();
|
||||
struct A* getARef();
|
||||
|
||||
typedef struct {
|
||||
int invisible;
|
||||
} B;
|
||||
|
||||
struct C {
|
||||
int invisible;
|
||||
double blind;
|
||||
};
|
||||
|
||||
typedef B C;
|
||||
|
||||
B* getBRef();
|
||||
struct C* getCRef();
|
||||
|
||||
C* getCCRef();
|
||||
|
||||
%feature("opaque", "yes") B;
|
||||
%feature("opaque", "yes") C;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x;
|
||||
double u;
|
||||
} D;
|
||||
|
||||
|
||||
%inline %{
|
||||
struct A {
|
||||
int i;
|
||||
unsigned int ui;
|
||||
double d;
|
||||
char* str;
|
||||
int **tmp;
|
||||
};
|
||||
|
||||
struct A getA();
|
||||
struct A* getARef();
|
||||
|
||||
typedef struct {
|
||||
int invisible;
|
||||
} B;
|
||||
|
||||
struct C {
|
||||
int invisible;
|
||||
double blind;
|
||||
};
|
||||
|
||||
typedef B C;
|
||||
|
||||
B* getBRef();
|
||||
struct C* getCRef();
|
||||
|
||||
C* getCCRef();
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x;
|
||||
double u;
|
||||
} D;
|
||||
|
||||
struct A
|
||||
getA()
|
||||
{
|
||||
struct A a;
|
||||
|
||||
a.i = 10;
|
||||
a.d = 3.1415;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
static struct A fixed = {20, 3.010101, 42};
|
||||
|
||||
struct A *
|
||||
getARef()
|
||||
{
|
||||
return(&fixed);
|
||||
}
|
||||
|
||||
|
||||
static B bb = {101};
|
||||
|
||||
B*
|
||||
getBRef()
|
||||
{
|
||||
return(&bb);
|
||||
}
|
||||
|
||||
struct C cc = {201, 3.14159};
|
||||
struct C *
|
||||
getCRef()
|
||||
{
|
||||
return(&cc);
|
||||
}
|
||||
|
||||
|
||||
C*
|
||||
getCCRef()
|
||||
{
|
||||
return(&bb);
|
||||
}
|
||||
|
||||
D
|
||||
bar()
|
||||
{ D a;
|
||||
a.x = 1;
|
||||
a.u = 0;
|
||||
return(a);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue