Update sequence (type specifier -> field ref), fix definition lookup
[babeltrace.git] / formats / ctf / metadata / ctf-test / succeed / ctf-test.txt
1
2 typealias integer { size = 32; align = 32; signed = true; } := int;
3 typealias integer { size = 32; align = 32; signed = false; } := uint;
4 typealias integer { size = 64; align = 64; signed = true; } := long;
5 typealias integer { size = 64; align = 64; } := unsigned long;
6
7 enum name1 : int {
8 ZERO,
9 ONE,
10 TWO,
11 TEN = 10,
12 ELEVEN,
13 };
14
15 enum name2 : long { ONE, TWO };
16
17 enum name3 : unsigned long { ONE, TWO };
18
19 enum name4 : unsigned long {
20 string = 1 ... 2,
21 "other string" = 3...4,
22 yet_another_string, /* will be assigned to end_value2 + 1 */
23 "some other string" = 10,
24 };
25
26 enum name5 : long { "int" = 1, };
27
28 enum name6 { "int" = 1, };
29
30 typealias floating_point {
31 exp_dig = 8; /* sizeof(float) * CHAR_BIT - FLT_MANT_DIG */
32 mant_dig = 24; /* FLT_MANT_DIG */
33 byte_order = native;
34 } := float;
35
36 typealias integer {
37 size = 32;
38 align = 32;
39 signed = false;
40 } := struct page *;
41
42 struct event_packet_header {
43 typealias integer { size = 32; align = 32; signed = false; } := uint32_t;
44 typealias integer { size = 8; align = 8; signed = false; } := uint8_t;
45
46 uint32_t magic;
47 uint8_t trace_uuid[16];
48 uint32_t stream_id;
49 };
50
51 trace {
52 major = 66;
53 minor = 2;
54 byte_order = le;
55 uuid = "1123fcea-706e-11e0-a38b-f3c28a683a3d";
56 packet.header := struct event_packet_header;
57 };
58
59 stream {
60 typealias integer { size = 64; align = 64; signed = false; } := uint64_t;
61 typealias integer { size = 16; align = 16; signed = false; } := uint16_t;
62 typealias integer { size = 32; align = 32; signed = true; } := int;
63 typedef int pid_t;
64
65 id = 5;
66 /* Type 1 - Few event IDs; Type 2 - Many event IDs. See section 6.2. */
67 event.header := struct { uint64_t timestamp; uint16_t id; };
68 event.context := struct { pid_t pid; };
69 };
70
71 struct example {
72 /* TODO gcc bitfields not supported yet. */
73 /* short a:12;
74 short b:5; */
75 };
76
77 struct name {
78 typealias integer { size = 64; align = 64; signed = false; } := uint64_t;
79 typealias integer { size = 32; align = 32; signed = false; } := uint32_t;
80 typealias integer { size = 32; align = 32; signed = true; } := int32_t;
81 typealias integer { size = 2; align = 8; signed = false; } := uint2_t;
82 typealias integer { size = 16; align = 16; signed = true; } := short;
83 typealias uint32_t := unsigned int;
84
85 enum : uint2_t { a, b, c, d } choice;
86 /* Unrelated fields can be added between the variant and its tag */
87 int32_t somevalue;
88 variant <choice> {
89 uint32_t a;
90 uint64_t b;
91 short c;
92 struct {
93 unsigned int field1;
94 uint64_t field2;
95 } d;
96 } s;
97 };
98
99 typealias integer {
100 size = 32;
101 signed = false;
102 align = 32;
103 } := uint32_t;
104
105 typealias string { encoding = UTF8; } := test;
106
107 struct event_packet_context {
108 typealias integer { size = 64; align = 64; signed = false; } := uint64_t;
109 typealias integer { size = 32; align = 32; signed = false; } := uint32_t;
110 typealias integer { size = 16; align = 16; signed = false; } := uint16_t;
111 typealias integer { size = 8; align = 8; signed = false; } := uint8_t;
112
113 uint64_t timestamp_begin;
114 uint64_t timestamp_end;
115 uint32_t checksum;
116 uint32_t stream_packet_count;
117 uint32_t events_discarded;
118 uint32_t cpu_id;
119 uint16_t content_size;
120 uint16_t packet_size;
121 uint8_t stream_packet_count_bits; /* Significant counter bits */
122 uint8_t compression_scheme;
123 uint8_t encryption_scheme;
124 uint8_t checksum_scheme;
125 };
126
127 struct event_header_1 {
128 typealias integer { size = 64; align = 64; signed = false; } := uint64_t;
129 typealias integer { size = 32; align = 32; signed = false; } := uint32_t;
130 typealias integer { size = 5; align = 1; signed = false; } := uint5_t;
131 typealias integer { size = 27; align = 1; signed = false; } := uint27_t;
132
133 /*
134 * id: range: 0 - 30.
135 * id 31 is reserved to indicate an extended header.
136 */
137 enum : uint5_t { compact = 0 ... 30, extended = 31 } id;
138 variant <id> {
139 struct {
140 uint27_t timestamp;
141 } compact;
142 struct {
143 uint32_t id; /* 32-bit event IDs */
144 uint64_t timestamp; /* 64-bit timestamps */
145 } extended;
146 } v;
147 };
148
149 struct event_header_2 {
150 typealias integer { size = 64; align = 64; signed = false; } := uint64_t;
151 typealias integer { size = 32; align = 32; signed = false; } := uint32_t;
152 typealias integer { size = 16; align = 16; signed = false; } := uint16_t;
153
154 /*
155 * id: range: 0 - 65534.
156 * id 65535 is reserved to indicate an extended header.
157 */
158 enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;
159 variant <id> {
160 struct {
161 uint32_t timestamp;
162 } compact;
163 struct {
164 uint32_t id; /* 32-bit event IDs */
165 uint64_t timestamp; /* 64-bit timestamps */
166 } extended;
167 } v;
168 };
169
170 typedef int rootscopetest;
171
172 /* parser level only: event { a.b.c.d.e = f.g.h->i->j; }; */
173
174 event {
175 name = test_event;
176 id = 0;
177 stream_id = 5;
178 context := struct {};
179 fields := struct {};
180 };
181
182 typealias integer { size = 32; align = 32; signed = false; } := unsigned long long *;
183
184 variant vardecl {
185 int a;
186 int b;
187 };
188
189 event {
190 typealias integer { size = 8; align = 8; signed = true; } := char;
191 typealias integer { size = 32; align = 32; signed = false; } := unsigned int;
192
193 name = test_event2;
194 id = 1;
195 stream_id = 5;
196 fields := struct {
197 enum : char { a = 0, b = 1, } tag;
198 variant vardecl <tag> myvariant;
199 unsigned int seqlen;
200 int myseq[seqlen];
201 };
202 };
203
204 typedef int myarray[10];
This page took 0.058741 seconds and 4 git commands to generate.