Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / IDL_Test / constants.idl
blob46097f4f36d414407a26ad8921c266e2390cb556
1 //=============================================================================
2 /**
3 * @file constants.idl
5 * This file contains examples of IDL code that has
6 * caused problems in the past for the TAO IDL
7 * compiler. This test is to make sure the problems
8 * stay fixed.
10 * @author Jeff Parsons <parsons@cs.wustl.edu> and TAO users.
12 //=============================================================================
14 const string all_escape = "\n\t\v\b\r\f\a\\\?\'\"";
16 const char tick = '\'';
18 const char backslash = '\\';
20 // The escape sequences will display differently
21 // depending on whether the platform uses signed
22 // or unsigned chars, but either should build w/o
23 // errors.
25 // octal escape sequences
26 const char oct_nought = '\000';
27 const char lucky = '\7';
28 const char square = '4';
29 const char blastoff = '\321';
30 const char max_char_oct = '\377';
32 // hex escape sequences
33 const char hex_nought ='\x0';
34 const char fingers = '\xA';
35 const char fortnight = '\xe';
36 const char fivebits = '\x32';
37 const char maybe_minus = '\xAf';
38 const char max_char_hex = '\xff';
40 const wstring wstr = L"wstr";
42 // unsigned longs greater than LONG_MAX
43 const unsigned long in_range = 3222111000;
44 const unsigned long max_ulong_oct = 037777777777;
45 const unsigned long max_ulong_hex = 0XFFFFFFFF;
47 // Testing 64-bit integers. The executable will
48 // verify that the generated values are correct.
49 const unsigned long long AAA = 122192928000000000;
50 const unsigned long AA = 3538947897;
51 const long long NAAA = -122192928000000000;
52 const long long PAAA = 122192928000000000;
53 const long NAA = -1538947897;
55 // various uncommon but legal formats for floats and doubles
56 const float root_beer = .2;
57 const double bogey = .2;
58 const float trip = 2.;
59 const double vision = .2e-4;
60 const double take = 2e3;
61 const double dip = 1.797693134862315E+308;
62 const double trouble = 2.2250738585072014E-308;
64 // const values created through mathematic operations
65 const long neg = -8;
66 const long sub1 = 0x10 - 0x01;
67 const long sub2 = 0x10 + (-0x01);
68 const unsigned long add1 = 16 + 1;
69 const unsigned long mul1 = 0x80 * 0x70;
70 const unsigned long div1 = 99 / 12;
72 // The original Sun code for bitwise operators was broken.
73 const unsigned short stuff = ~0;
74 const unsigned long day = ~0;
75 const unsigned long drink = 1000000000 << 2;
76 const unsigned long c_l1 = (1 << 1);
77 const octet c_o11 = 10 + c_l1;
78 // @@ (JP 06/03/07) Seems it is still broken for big-endian systems,
79 // at least. Rather than hold up a beta release with a redesign...
80 //const octet c_o3 = (1 << 3);
82 // An enum of one type cannot be assigned to an constant of another
83 // enum type, but it's ok if one is a typedef of the other.
84 module m_a
86 enum enum_a { value_1, value_2, value_3, value_4, value_5 };
89 module m_b
91 typedef m_a::enum_a enum_b;
94 module problems
96 const m_b::enum_b bconst = m_a::value_2;
99 // In a class, string constants cannot be declared inline, but
100 // arithmetic types can be.
101 module ClassConstants
103 interface Iface
105 const long iface_long = 55;
106 const string iface_str = "iface_str";
107 const wstring iface_wstr = L"iface_wstr";
110 valuetype Vt
112 const double vt_long = 66.66;
113 const string vt_str = "vt_str";
114 const wstring vt_wstr = L"vt_wstr";
118 // The bitwise OR rhs was causing bogus coercion failure.
119 module CoercionBug
121 typedef unsigned short UInt16;
122 typedef UInt16 CellFlags;
124 const CellFlags EXPLICIT_VALUE_LOCK = 0x0400;
125 const CellFlags EDIT_VALUE_LOCK = 0x1000;
127 const CellFlags VALUE_LOCK = (EXPLICIT_VALUE_LOCK | EDIT_VALUE_LOCK);
130 module SignedGen
132 // On some platforms, the rhs of a typedef'd long constant is
133 // getting generated as an unsigned literal.
134 typedef long LongType;
135 const LongType val = -3;
136 typedef short ShortType;
137 const ShortType short_val = -3;