//============================================================================= /** * @file constants.idl * * $Id$ * * This file contains examples of IDL code that has * caused problems in the past for the TAO IDL * compiler. This test is to make sure the problems * stay fixed. * * * @author Jeff Parsons and TAO users. */ //============================================================================= const string all_escape = "\n\t\v\b\r\f\a\\\?\'\""; const char tick = '\''; const char backslash = '\\'; // The escape sequences will display differently // depending on whether the platform uses signed // or unsigned chars, but either should build w/o // errors. // octal escape sequences const char oct_nought = '\000'; const char lucky = '\7'; const char square = '4'; const char blastoff = '\321'; const char max_char_oct = '\377'; // hex escape sequences const char hex_nought ='\x0'; const char fingers = '\xA'; const char fortnight = '\xe'; const char fivebits = '\x32'; const char maybe_minus = '\xAf'; const char max_char_hex = '\xff'; // const wstring wstr = L"wstr"; // unsigned longs greater than LONG_MAX const unsigned long in_range = 3222111000; const unsigned long max_ulong_oct = 037777777777; const unsigned long max_ulong_hex = 0XFFFFFFFF; // Testing 64-bit integers. The executable will // verify that the generated values are correct. const unsigned long long AAA = 122192928000000000; const unsigned long AA = 3538947897; const long long NAAA = -122192928000000000; const long long PAAA = 122192928000000000; const long NAA = -1538947897; // various uncommon but legal formats for floats and doubles const float root_beer = .2; const double bogey = .2; const float trip = 2.; const double vision = .2e-4; const double take = 2e3; const double dip = 1.797693134862315E+308; const double trouble = 2.2250738585072014E-308; // const values created through mathematic operations const long neg = -8; const long sub1 = 0x10 - 0x01; const long sub2 = 0x10 + (-0x01); const unsigned long add1 = 16 + 1; const unsigned long mul1 = 0x80 * 0x70; const unsigned long div1 = 99 / 12; // The original Sun code for bitwise operators was broken. const unsigned short stuff = ~0; const unsigned long day = ~0; const unsigned long drink = 1000000000 << 2; const unsigned long c_l1 = (1 << 1); const octet c_o11 = 10 + c_l1; // @@ (JP 06/03/07) Seems it is still broken for big-endian systems, // at least. Rather than hold up a beta release with a redesign... //const octet c_o3 = (1 << 3); // An enum of one type cannot be assigned to an constant of another // enum type, but it's ok if one is a typedef of the other. module m_a { enum enum_a { value_1, value_2, value_3, value_4, value_5 }; }; module m_b { typedef m_a::enum_a enum_b; }; module problems { const m_b::enum_b bconst = m_a::value_2; }; // In a class, string constants cannot be declared inline, but // arithmetic types can be. module ClassConstants { interface Iface { const long iface_long = 55; const string iface_str = "iface_str"; // const wstring iface_wstr = L"iface_wstr"; }; valuetype Vt { const double vt_long = 66.66; const string vt_str = "vt_str"; // const wstring vt_wstr = L"vt_wstr"; }; }; // The bitwise OR rhs was causing bogus coercion failure. module CoercionBug { typedef unsigned short UInt16; typedef UInt16 CellFlags; const CellFlags EXPLICIT_VALUE_LOCK = 0x0400; const CellFlags EDIT_VALUE_LOCK = 0x1000; const CellFlags VALUE_LOCK = (EXPLICIT_VALUE_LOCK | EDIT_VALUE_LOCK); }; module SignedGen { // On some platforms, the rhs of a typedef'd long constant is // getting generated as an unsigned literal. typedef long LongType; const LongType val = -3; typedef short ShortType; const ShortType short_val = -3; };