PageRenderTime 17ms CodeModel.GetById 16ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/rel-1-3-25/SWIG/Examples/test-suite/unions.i

#
Swig | 34 lines | 22 code | 7 blank | 5 comment | 0 complexity | 88d30859b858653d7efd689f644c9cc4 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
 1/*
 2This testcase checks that unions can be set and read.
 3*/
 4
 5%module unions
 6
 7%inline %{
 8
 9typedef struct SmallStruct {
10  short         jill;
11} SmallStruct;
12
13typedef struct BigStruct {
14  int           jack;
15  SmallStruct   smallstruct;
16} BigStruct;
17
18/* This union is just to check the parser */
19typedef union {
20  BigStruct     bs;
21  SmallStruct   ss;
22} UnionTest;
23
24/* This union checks the parser and will be used in a runtime test */
25typedef struct {
26  union
27  {
28    BigStruct   big;
29    SmallStruct small;
30  } uni;
31  int           number;
32} EmbeddedUnionTest;
33
34%}