/trunk/Examples/test-suite/unions.i
Swig | 42 lines | 27 code | 8 blank | 7 comment | 0 complexity | 94ded6016c41cfa9f200f2bd9ec9d452 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- /*
- This testcase checks that unions can be set and read.
- */
- %module unions
- %{
- /* Must undefine small to work on Windows. small is defined as a
- char in rpcndr.h */
- #ifdef small
- #undef small
- #endif
- %}
- %inline %{
- typedef struct SmallStruct {
- short jill;
- } SmallStruct;
- typedef struct BigStruct {
- int jack;
- SmallStruct smallstruct;
- } BigStruct;
- /* This union is just to check the parser */
- typedef union {
- BigStruct bs;
- SmallStruct ss;
- } UnionTest;
- /* This union checks the parser and will be used in a runtime test */
- typedef struct {
- union
- {
- BigStruct big;
- SmallStruct small;
- } uni;
- int number;
- } EmbeddedUnionTest;
- %}