scilab: fix union and nested tests (they are C and not CPP tests)
This commit is contained in:
parent
4acda6d25b
commit
07eb661565
2 changed files with 72 additions and 17 deletions
|
|
@ -7,19 +7,10 @@ Also tests reported error when a #define placed in a deeply embedded struct/unio
|
|||
%module nested
|
||||
|
||||
|
||||
#ifdef SWIGSCILAB
|
||||
#if defined(SWIGSCILAB)
|
||||
%rename(OutStNamed) OuterStructNamed;
|
||||
%rename(InStNamed) OuterStructUnnamed::InnerStructNamed;
|
||||
%rename(InUnNamed) OuterStructUnnamed::Inner_union_named;
|
||||
|
||||
%rename(OutStUnnamed) OuterStructUnnamed;
|
||||
%rename(inStUnnamed) OuterStructUnnamed::inner_struct_unnamed;
|
||||
%rename(inUnUnnamed) OuterStructUnnamed::inner_union_unnamed;
|
||||
|
||||
%rename(OutSt) OuterStruct;
|
||||
%rename(OutNestedSt) OuterStruct::outer_nested_struct;
|
||||
%rename(InNestedSt) OuterStruct::outer_nested_struct::inner_nested_struct;
|
||||
%rename(InNestedUn) OuterStruct::outer_nested_struct::innerNestedUnion;
|
||||
%rename(InStNamed) OuterStructNamed::InnerStructNamed;
|
||||
%rename(InUnNamed) OuterStructNamed::Inner_union_named;
|
||||
#endif
|
||||
|
||||
%inline %{
|
||||
|
|
@ -38,6 +29,13 @@ struct OuterStructNamed {
|
|||
} inner_union_named;
|
||||
};
|
||||
|
||||
%}
|
||||
|
||||
|
||||
#if not defined(SWIGSCILAB)
|
||||
|
||||
%inline %{
|
||||
|
||||
struct OuterStructUnnamed {
|
||||
struct {
|
||||
double xx;
|
||||
|
|
@ -48,7 +46,6 @@ struct OuterStructUnnamed {
|
|||
} inner_union_unnamed;
|
||||
};
|
||||
|
||||
|
||||
typedef struct OuterStruct {
|
||||
union {
|
||||
|
||||
|
|
@ -68,3 +65,41 @@ typedef struct OuterStruct {
|
|||
} OuterStruct;
|
||||
|
||||
%}
|
||||
|
||||
#else
|
||||
|
||||
%inline %{
|
||||
|
||||
struct OutStUnnamed {
|
||||
struct {
|
||||
double xx;
|
||||
} inSt;
|
||||
union {
|
||||
double yy;
|
||||
int zz;
|
||||
} inUn;
|
||||
};
|
||||
|
||||
typedef struct OutSt {
|
||||
union {
|
||||
|
||||
struct nst_st {
|
||||
union in_un {
|
||||
#define BAD_STYLE 1
|
||||
int red;
|
||||
struct TestStruct green;
|
||||
} InUn;
|
||||
|
||||
struct in_st {
|
||||
int blue;
|
||||
} InSt;
|
||||
} NstdSt;
|
||||
|
||||
} EmbedUn;
|
||||
} OutSt;
|
||||
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,6 @@ This testcase checks that unions can be set and read.
|
|||
|
||||
%module unions
|
||||
|
||||
#if defined(SWIGSCILAB)
|
||||
%rename(EmbedUnion) EmbeddedUnionTest;
|
||||
#endif
|
||||
|
||||
%{
|
||||
/* Must undefine small to work on Windows. small is defined as a
|
||||
char in rpcndr.h */
|
||||
|
|
@ -33,7 +29,14 @@ typedef union {
|
|||
SmallStruct ss;
|
||||
} UnionTest;
|
||||
|
||||
%}
|
||||
|
||||
/* This union checks the parser and will be used in a runtime test */
|
||||
|
||||
#if not defined(SWIGSCILAB)
|
||||
|
||||
%inline %{
|
||||
|
||||
typedef struct {
|
||||
union
|
||||
{
|
||||
|
|
@ -44,3 +47,20 @@ typedef struct {
|
|||
} EmbeddedUnionTest;
|
||||
|
||||
%}
|
||||
|
||||
#else
|
||||
|
||||
%inline %{
|
||||
|
||||
typedef struct {
|
||||
union
|
||||
{
|
||||
BigStruct big;
|
||||
SmallStruct small;
|
||||
} uni;
|
||||
int number;
|
||||
} EmbedUnionTst;
|
||||
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue