xref: /aoo41x/main/idlc/test/union.idl (revision cdf0e10c)
1*cdf0e10cSrcweirmodule idlc
2*cdf0e10cSrcweir{
3*cdf0e10cSrcweirmodule test
4*cdf0e10cSrcweir{
5*cdf0e10cSrcweir
6*cdf0e10cSrcweirunion UnionTest switch (long) {
7*cdf0e10cSrcweir  case 1: long x;
8*cdf0e10cSrcweir  case 2: byte y;
9*cdf0e10cSrcweir  case 3: string z;
10*cdf0e10cSrcweir  case 4:
11*cdf0e10cSrcweir  case 5: short w;
12*cdf0e10cSrcweir  case 6: long array[ 10 ][ 20 ];
13*cdf0e10cSrcweir  case 7: sequence<long> seq;
14*cdf0e10cSrcweir default: any a;
15*cdf0e10cSrcweir};
16*cdf0e10cSrcweir
17*cdf0e10cSrcweirtypedef enum E {
18*cdf0e10cSrcweir  A,
19*cdf0e10cSrcweir  B
20*cdf0e10cSrcweir} EAlias;
21*cdf0e10cSrcweir
22*cdf0e10cSrcweir// Union with no default label
23*cdf0e10cSrcweirunion U2 switch(EAlias) {
24*cdf0e10cSrcweir  case E::A : long x;
25*cdf0e10cSrcweir  case E::B : short y;
26*cdf0e10cSrcweir};
27*cdf0e10cSrcweir
28*cdf0e10cSrcweirunion U3 switch(char) {
29*cdf0e10cSrcweir  case 2 : long x;
30*cdf0e10cSrcweir  case 4 : short y;
31*cdf0e10cSrcweir};
32*cdf0e10cSrcweir
33*cdf0e10cSrcweir};
34*cdf0e10cSrcweir};
35*cdf0e10cSrcweir
36