260ac024bab30ab19497c3e9436fe7dff03a34e9
[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 uuid = "1123fcea-706e-11e0-a38b-f3c28a683a3d";
55 packet.header := struct event_packet_header;
56 };
57
58 stream {
59 typealias integer { size = 64; align = 64; signed = false; } := uint64_t;
60 typealias integer { size = 16; align = 16; signed = false; } := uint16_t;
61 typealias integer { size = 32; align = 32; signed = true; } := int;
62 typedef int pid_t;
63
64 id = 5;
65 /* Type 1 - Few event IDs; Type 2 - Many event IDs. See section 6.2. */
66 event.header := struct { uint64_t timestamp; uint16_t id; };
67 event.context := struct { pid_t pid; };
68 };
69
70 struct example {
71 /* TODO gcc bitfields not supported yet. */
72 /* short a:12;
73 short b:5; */
74 };
75
76 struct name {
77 typealias integer { size = 64; align = 64; signed = false; } := uint64_t;
78 typealias integer { size = 32; align = 32; signed = false; } := uint32_t;
79 typealias integer { size = 32; align = 32; signed = true; } := int32_t;
80 typealias integer { size = 2; align = 8; signed = false; } := uint2_t;
81 typealias integer { size = 16; align = 16; signed = true; } := short;
82 typealias uint32_t := unsigned int;
83
84 enum : uint2_t { a, b, c, d } choice;
85 /* Unrelated fields can be added between the variant and its tag */
86 int32_t somevalue;
87 variant <choice> {
88 uint32_t a;
89 uint64_t b;
90 short c;
91 struct {
92 unsigned int field1;
93 uint64_t field2;
94 } d;
95 } s;
96 };
97
98 typealias integer {
99 size = 32;
100 signed = false;
101 align = 32;
102 } := uint32_t;
103
104 typealias string { encoding = UTF8; } := test;
105
106 struct event_packet_context {
107 typealias integer { size = 64; align = 64; signed = false; } := uint64_t;
108 typealias integer { size = 32; align = 32; signed = false; } := uint32_t;
109 typealias integer { size = 16; align = 16; signed = false; } := uint16_t;
110 typealias integer { size = 8; align = 8; signed = false; } := uint8_t;
111
112 uint64_t timestamp_begin;
113 uint64_t timestamp_end;
114 uint32_t checksum;
115 uint32_t stream_packet_count;
116 uint32_t events_discarded;
117 uint32_t cpu_id;
118 uint16_t content_size;
119 uint16_t packet_size;
120 uint8_t stream_packet_count_bits; /* Significant counter bits */
121 uint8_t compression_scheme;
122 uint8_t encryption_scheme;
123 uint8_t checksum_scheme;
124 };
125
126 struct event_header_1 {
127 typealias integer { size = 64; align = 64; signed = false; } := uint64_t;
128 typealias integer { size = 32; align = 32; signed = false; } := uint32_t;
129 typealias integer { size = 5; align = 1; signed = false; } := uint5_t;
130 typealias integer { size = 27; align = 1; signed = false; } := uint27_t;
131
132 /*
133 * id: range: 0 - 30.
134 * id 31 is reserved to indicate an extended header.
135 */
136 enum : uint5_t { compact = 0 ... 30, extended = 31 } id;
137 variant <id> {
138 struct {
139 uint27_t timestamp;
140 } compact;
141 struct {
142 uint32_t id; /* 32-bit event IDs */
143 uint64_t timestamp; /* 64-bit timestamps */
144 } extended;
145 } v;
146 };
147
148 struct event_header_2 {
149 typealias integer { size = 64; align = 64; signed = false; } := uint64_t;
150 typealias integer { size = 32; align = 32; signed = false; } := uint32_t;
151 typealias integer { size = 16; align = 16; signed = false; } := uint16_t;
152
153 /*
154 * id: range: 0 - 65534.
155 * id 65535 is reserved to indicate an extended header.
156 */
157 enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;
158 variant <id> {
159 struct {
160 uint32_t timestamp;
161 } compact;
162 struct {
163 uint32_t id; /* 32-bit event IDs */
164 uint64_t timestamp; /* 64-bit timestamps */
165 } extended;
166 } v;
167 };
168
169 typedef int rootscopetest;
170
171 /* parser level only: event { a.b.c.d.e = f.g.h->i->j; }; */
172
173 event {
174 name = test_event;
175 id = 0;
176 stream_id = 5;
177 context := struct {};
178 payload := struct {};
179 };
180
181 typealias integer { size = 32; align = 32; signed = false; } := unsigned long long *;
182
183 variant vardecl {
184 int a;
185 int b;
186 };
187
188 event {
189 name = test_event2;
190 id = 1;
191 stream_id = 5;
192 payload := struct {
193 enum : char { a = 0, b = 1, } tag;
194 variant vardecl <tag> myvariant;
195 };
196 };
197
198 typedef int myarray[10];
199 typedef int myseq[uint];
This page took 0.047997 seconds and 3 git commands to generate.