xref: /trunk/main/idlc/test/const.idl (revision ffd38472365e95f6a578737bc9a5eb0fac624a86)
1*540d5e64SAndrew Rist/**************************************************************
2*540d5e64SAndrew Rist *
3*540d5e64SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*540d5e64SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*540d5e64SAndrew Rist * distributed with this work for additional information
6*540d5e64SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*540d5e64SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*540d5e64SAndrew Rist * "License"); you may not use this file except in compliance
9*540d5e64SAndrew Rist * with the License.  You may obtain a copy of the License at
10*540d5e64SAndrew Rist *
11*540d5e64SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*540d5e64SAndrew Rist *
13*540d5e64SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*540d5e64SAndrew Rist * software distributed under the License is distributed on an
15*540d5e64SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*540d5e64SAndrew Rist * KIND, either express or implied.  See the License for the
17*540d5e64SAndrew Rist * specific language governing permissions and limitations
18*540d5e64SAndrew Rist * under the License.
19*540d5e64SAndrew Rist *
20*540d5e64SAndrew Rist *************************************************************/
21*540d5e64SAndrew Rist
22cdf0e10cSrcweirmodule idlc
23cdf0e10cSrcweir{
24cdf0e10cSrcweirmodule test
25cdf0e10cSrcweir{
26cdf0e10cSrcweir    const long l = 1;
27cdf0e10cSrcweir    const long add = 1 + 2;
28cdf0e10cSrcweir    const long sub = 3 - 2;
29cdf0e10cSrcweir    const hyper h = 123456789;
30cdf0e10cSrcweir    const float f7 = 3.4123;
31cdf0e10cSrcweir    const float f2 = 3.4123 + 10e-12;
32cdf0e10cSrcweir    const boolean bt = True;
33cdf0e10cSrcweir    const boolean bf = False;
34cdf0e10cSrcweir    const boolean and = bt & bf;
35cdf0e10cSrcweir
36cdf0e10cSrcweir    /// SHORT_MAX + 1;
37cdf0e10cSrcweir    const short shortMax = -0x8000;
38cdf0e10cSrcweir    /// LONG_MAX + 1;
39cdf0e10cSrcweir    const unsigned long longMax = 0x80000000;
40cdf0e10cSrcweir
41cdf0e10cSrcweir
42cdf0e10cSrcweirconstants USER
43cdf0e10cSrcweir{
44cdf0e10cSrcweir    /// = 1
45cdf0e10cSrcweir    const long FLAG1 = 0x00000001;
46cdf0e10cSrcweir    /// = 2
47cdf0e10cSrcweir    const long FLAG2 = 0x00000002;
48cdf0e10cSrcweir    /// = 4
49cdf0e10cSrcweir    const long FLAG3 = 0x00000004;
50cdf0e10cSrcweir    /// = 8
51cdf0e10cSrcweir    const long FLAG4 = 0x00000008;
52cdf0e10cSrcweir    /// = 16
53cdf0e10cSrcweir    const long FLAG5 = 0x00000010;
54cdf0e10cSrcweir    /// = 0
55cdf0e10cSrcweir    const long FLAG6 = FLAG1 & FLAG2;
56cdf0e10cSrcweir    /// = 3
57cdf0e10cSrcweir    const long FLAG7 = FLAG1 | FLAG2;
58cdf0e10cSrcweir    /// = 2
59cdf0e10cSrcweir    const long FLAG8 = (FLAG1 | FLAG2) & FLAG2;
60cdf0e10cSrcweir    /// = 4
61cdf0e10cSrcweir    const long FLAG9 = FLAG1 << 2;
62cdf0e10cSrcweir    /// = 32
63cdf0e10cSrcweir    const long FLAG10 = (FLAG5 >> 1) << 2;
64cdf0e10cSrcweir    /// = 1
65cdf0e10cSrcweir    const long FLAG11 = 33 % 4;
66cdf0e10cSrcweir    /// = 4
67cdf0e10cSrcweir    const long FLAG12 = FLAG10 / 8;
68cdf0e10cSrcweir};
69cdf0e10cSrcweir
70cdf0e10cSrcweir};
71cdf0e10cSrcweir};
72