Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/enum.cxx

raw
1 #ifdef SHARED
2
3 enum countries {canada,usa,mexico};
4 enum countries country = mexico;
5
6 void
7 test_enum (int arg1, int arg2)
8 {
9 }
10
11 #else
12 void test_enum (int arg1, int arg2);
13
14 enum caps {A='A', B='B', C='C'};
15 enum caps cap = C;
16
17 enum sixteen_powers {sixteen_power_0=0,sixteen_power_1=16,sixteen_power_2=256,
18 sixteen_power_3=4096,sixteen_power_4=65536, sixteen_power_5=1048576,
19 sixteen_power_6=16777216,sixteen_power_7=268435456,sixteen_power_8=4294967296
20 };
21 enum sixteen_powers sixteen_power = sixteen_power_8;
22
23 int
24 main ()
25 {
26 enum enumdigits {one=1,two=2,three=3};
27
28 typedef enum {a='a',b='b',c='c'} letters;
29 letters letter = a;
30
31 typedef enum {ten=10,twenty=20,thirty=30} linears;
32 linears linear = twenty;
33
34 typedef enum { at='@',sharp='#' } symbols;
35 symbols symbol = at;
36
37 struct
38 {
39 enum ordinals {first=1,second=2,third=3};
40 enum ordinals ordinal = first;
41 } astruct;
42
43 {
44 enum ordinals {first=1,second=2,third=3,fourth=4};
45 enum colors {orange=1,green=2,yellow=3};
46 END_BLOCK:
47 test_enum (orange, fourth);
48 }
49
50 RETURN:
51 test_enum (astruct.first, astruct.second);
52 }
53
54 #endif