PageRenderTime 37ms CodeModel.GetById 22ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/rel-1.3.35/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
 1/*
 2This testcase checks that unions can be set and read.
 3*/
 4
 5%module unions
 6
 7%{
 8/* Must undefine small to work on Windows.  small is defined as a
 9char in rpcndr.h */
10#ifdef small
11#undef small	
12#endif
13%}
14
15%inline %{
16
17typedef struct SmallStruct {
18  short         jill;
19} SmallStruct;
20
21typedef struct BigStruct {
22  int           jack;
23  SmallStruct   smallstruct;
24} BigStruct;
25
26/* This union is just to check the parser */
27typedef union {
28  BigStruct     bs;
29  SmallStruct   ss;
30} UnionTest;
31
32/* This union checks the parser and will be used in a runtime test */
33typedef struct {
34  union
35  {
36    BigStruct   big;
37    SmallStruct small;
38  } uni;
39  int           number;
40} EmbeddedUnionTest;
41
42%}