summaryrefslogtreecommitdiff
path: root/Examples/test-suite/unions.i
blob: 49bb85de4a05afbc41375846735511374d758c60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
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;

%}