19
20 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 or visit www.oracle.com if you need additional information or have any
22 questions.
23 -->
24
25 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
26 <xsl:import href="xsl_util.xsl"/>
27 <xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
28
29 <xsl:template match="/">
30 <xsl:call-template name="file-header"/>
31
32 #ifndef TRACEFILES_TRACEEVENTCLASSES_HPP
33 #define TRACEFILES_TRACEEVENTCLASSES_HPP
34
35 // On purpose outside the INCLUDE_TRACE
36 // Some parts of traceEvent.hpp are used outside of
37 // INCLUDE_TRACE
38
39 #include "tracefiles/traceTypes.hpp"
40 #include "utilities/macros.hpp"
41
42 #if INCLUDE_TRACE
43 #include "trace/traceEvent.hpp"
44 #include "trace/traceStream.hpp"
45 #include "utilities/ostream.hpp"
46
47 <xsl:apply-templates select="trace/events/struct" mode="trace"/>
48 <xsl:apply-templates select="trace/events/event" mode="trace"/>
49
50 #else // !INCLUDE_TRACE
51
52 class TraceEvent {
53 public:
54 TraceEvent() {}
55 void set_starttime(const Ticks& ignore) {}
56 void set_endtime(const Ticks& ignore) {}
57 bool should_commit() const { return false; }
58 static bool is_enabled() { return false; }
59 void commit() {}
60 };
61
62 <xsl:apply-templates select="trace/events/struct" mode="empty"/>
63 <xsl:apply-templates select="trace/events/event" mode="empty"/>
64
65 #endif // INCLUDE_TRACE
66 #endif // TRACEFILES_TRACEEVENTCLASSES_HPP
67 </xsl:template>
68
69 <xsl:template match="struct" mode="trace">
70 struct TraceStruct<xsl:value-of select="@id"/>
71 {
72 private:
73 <xsl:apply-templates select="value" mode="write-fields"/>
74 public:
75 <xsl:apply-templates select="value" mode="write-setters"/>
76
77 void writeStruct(TraceStream& ts) {
78 <xsl:apply-templates select="value" mode="write-data"/>
79 }
80 };
81
82 </xsl:template>
83
84 <xsl:template match="struct" mode="empty">
85 struct TraceStruct<xsl:value-of select="@id"/>
86 {
87 public:
88 <xsl:apply-templates select="value" mode="write-empty-setters"/>
89 };
90 </xsl:template>
91
92
93 <xsl:template match="event" mode="empty">
94 <xsl:value-of select="concat('class Event', @id, ' : public TraceEvent')"/>
95 {
96 public:
97 <xsl:value-of select="concat(' Event', @id, '(bool ignore=true) {}')"/>
98 <xsl:text>
99 </xsl:text>
100
101 <xsl:apply-templates select="value|structvalue|transition_value|relation" mode="write-empty-setters"/>
102 };
103
104 </xsl:template>
105
106
107 <xsl:template match="event" mode="trace">
108 <xsl:value-of select="concat('class Event', @id, ' : public TraceEvent<Event', @id, '>')"/>
109 {
110 public:
111 static const bool hasThread = <xsl:value-of select="@has_thread"/>;
112 static const bool hasStackTrace = <xsl:value-of select="@has_stacktrace"/>;
113 static const bool isInstant = <xsl:value-of select="@is_instant"/>;
114 static const bool isRequestable = <xsl:value-of select="@is_requestable"/>;
115 static const TraceEventId eventId = <xsl:value-of select="concat('Trace', @id, 'Event')"/>;
116
117 private:
118 <xsl:apply-templates select="value|structvalue|transition_value|relation" mode="write-fields"/>
119
120 void writeEventContent(void) {
121 TraceStream ts;
122 ts.print("<xsl:value-of select="@label"/>: [");
123 <xsl:apply-templates select="value|structvalue" mode="write-data"/>
124 ts.print("]\n");
125 }
126
127 public:
128 <xsl:apply-templates select="value|structvalue|transition_value|relation" mode="write-setters"/>
129
130 bool should_write(void) {
131 return true;
132 }
133 <xsl:text>
134
135 </xsl:text>
136 <xsl:value-of select="concat(' Event', @id, '(EventStartTime timing=TIMED) : TraceEvent<Event', @id, '>(timing) {}', $newline)"/>
137 void writeEvent(void) {
138 if (UseLockedTracing) {
139 ttyLocker lock;
140 writeEventContent();
141 } else {
142 writeEventContent();
143 }
144 }
145
146 using <xsl:value-of select="concat('TraceEvent<Event', @id, '>')"/>::commit; // else commit() is hidden by overloaded versions in this class
147
148 <xsl:variable name="instant" select="@is_instant"/>
149 <!-- non static method (only for non instant events)-->
150 <xsl:if test="$instant='false'">
151 <xsl:value-of select="concat(' Event', @id)"/>(
152 <xsl:for-each select="value|structvalue|transition_value|relation">
153 <xsl:apply-templates select="." mode="cpp-type"/><xsl:value-of select="concat(' ', @field)"/>
154 <xsl:if test="position() != last()">,
155 </xsl:if></xsl:for-each>) : TraceEvent<<xsl:value-of select="concat('Event', @id)"/>>(TIMED) {
156 if (should_commit()) {<xsl:for-each select="value|structvalue|transition_value|relation">
157 set_<xsl:value-of select="@field"/>(<xsl:value-of select="@field"/>);</xsl:for-each>
158 }
159 }
160
161 void commit(<xsl:for-each select="value|structvalue|transition_value|relation">
162 <xsl:apply-templates select="." mode="cpp-type"/><xsl:value-of select="concat(' ', @field)"/>
163 <xsl:if test="position() != last()">,
164 </xsl:if></xsl:for-each>) {
165 if (should_commit()) {
166 <xsl:for-each select="value|structvalue|transition_value|relation">set_<xsl:value-of select="@field"/>(<xsl:value-of select="@field"/>);
167 </xsl:for-each>commit();
168 }
169 }</xsl:if>
170 <!-- static method (for all events) -->
171 static void commit(<xsl:if test="$instant='false'">const Ticks& startTicks,
172 const Ticks& endTicks<xsl:choose><xsl:when test="value|structvalue|transition_value|relation">,
173 </xsl:when></xsl:choose></xsl:if>
174 <xsl:for-each select="value|structvalue|transition_value|relation">
175 <xsl:apply-templates select="." mode="cpp-type"/><xsl:value-of select="concat(' ', @field)"/>
176 <xsl:if test="position() != last()">,
177 </xsl:if></xsl:for-each>) {
178 <xsl:value-of select="concat('Event', @id)"/> me(UNTIMED);
179
180 if (me.should_commit()) {
181 <xsl:if test="$instant='false'">me.set_starttime(startTicks);
182 me.set_endtime(endTicks);
183 </xsl:if>
184 <xsl:for-each select="value|structvalue|transition_value|relation">me.set_<xsl:value-of select="@field"/>(<xsl:value-of select="@field"/>);
185 </xsl:for-each>me.commit();
186 }
187 }
188 };
189
190 </xsl:template>
191
192 <xsl:template match="value|transition_value|relation" mode="write-empty-setters">
193 <xsl:param name="cls"/>
194 <xsl:variable name="type" select="@type"/>
195 <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
196 <xsl:value-of select="concat(' void set_', @field, '(', $wt, ' value) { }')"/>
197 <xsl:if test="position() != last()">
198 <xsl:text>
199 </xsl:text>
200 </xsl:if>
201 </xsl:template>
202
203 <xsl:template match="structvalue" mode="write-empty-setters">
204 <xsl:param name="cls"/>
205 <xsl:value-of select="concat(' void set_', @field, '(const TraceStruct', @type, '& value) { }')"/>
206 <xsl:if test="position() != last()">
207 <xsl:text>
208 </xsl:text>
209 </xsl:if>
210 </xsl:template>
211
212 <xsl:template match="value[@type='TICKS']" mode="write-setters">
213 #if INCLUDE_TRACE
214 <xsl:value-of select="concat(' void set_', @field, '(const Ticks& time) { _', @field, ' = time; }')"/>
215 #else
216 <xsl:value-of select="concat(' void set_', @field, '(const Ticks& ignore) {}')"/>
217 #endif
218 </xsl:template>
219
220 <xsl:template match="value[@type='TICKSPAN']" mode="write-setters">
221 #if INCLUDE_TRACE
222 <xsl:value-of select="concat(' void set_', @field, '(const Tickspan& time) { _', @field, ' = time; }')"/>
223 #else
224 <xsl:value-of select="concat(' void set_', @field, '(const Tickspan& ignore) {}')"/>
225 #endif
226 </xsl:template>
227
228
229 <xsl:template match="value" mode="write-fields">
230 <xsl:variable name="type" select="@type"/>
231 <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
232 <xsl:value-of select="concat(' ', $wt, ' _', @field, ';')"/>
233 <xsl:if test="position() != last()">
234 <xsl:text>
235 </xsl:text>
236 </xsl:if>
237 </xsl:template>
238
239 <xsl:template match="structvalue" mode="write-fields">
240 <xsl:value-of select="concat(' TraceStruct', @type, ' _', @field, ';')"/>
241 <xsl:text>
242 </xsl:text>
243 </xsl:template>
244
245 <xsl:template match="value|transition_value|relation" mode="write-setters">
246 <xsl:param name="cls"/>
247 <xsl:variable name="type" select="@type"/>
248 <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
249 <xsl:value-of select="concat(' void set_', @field, '(', $wt, ' value) { this->_', @field, ' = value; }')"/>
250 <xsl:if test="position() != last()">
251 <xsl:text>
252 </xsl:text>
253 </xsl:if>
254 </xsl:template>
255
256 <xsl:template match="structvalue" mode="write-setters">
257 <xsl:param name="cls"/>
258 <xsl:value-of select="concat(' void set_', @field, '(const TraceStruct', @type, '& value) { this->_', @field, ' = value; }')"/>
259 <xsl:if test="position() != last()">
260 <xsl:text>
261 </xsl:text>
262 </xsl:if>
263 </xsl:template>
264
265 <xsl:template match="value" mode="write-data">
266 <xsl:variable name="type" select="@type"/>
267 <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@writetype"/>
268 <xsl:choose>
269 <xsl:when test="@type='TICKSPAN'">
270 <xsl:value-of select="concat(' ts.print_val("', @label, '", _', @field, '.value());')"/>
271 </xsl:when>
272 <xsl:when test="@type='TICKS'">
273 <xsl:value-of select="concat(' ts.print_val("', @label, '", _', @field, '.value());')"/>
274 </xsl:when>
275 <xsl:otherwise>
276 <xsl:value-of select="concat(' ts.print_val("', @label, '", _', @field, ');')"/>
277 </xsl:otherwise>
278 </xsl:choose>
279 <xsl:if test="position() != last()">
280 <xsl:text>
281 ts.print(", ");
282 </xsl:text>
283 </xsl:if>
284 </xsl:template>
285
286 <xsl:template match="structvalue" mode="write-data">
287 <xsl:value-of select="concat(' _', @field, '.writeStruct(ts);')"/>
288 <xsl:if test="position() != last()">
289 <xsl:text>
290 ts.print(", ");
291 </xsl:text>
292 </xsl:if>
293 </xsl:template>
294
295
296 <xsl:template match="value|transition_value|relation" mode="cpp-type">
297 <xsl:variable name="type" select="@type"/>
298 <xsl:value-of select="//primary_type[@symbol=$type]/@type"/>
299 </xsl:template>
300 <xsl:template match="structvalue" mode="cpp-type">
301 <xsl:value-of select="concat('const TraceStruct', @type, '&')"/>
302 </xsl:template>
303
304 </xsl:stylesheet>
|
19
20 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 or visit www.oracle.com if you need additional information or have any
22 questions.
23 -->
24
25 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
26 <xsl:import href="xsl_util.xsl"/>
27 <xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
28
29 <xsl:template match="/">
30 <xsl:call-template name="file-header"/>
31
32 #ifndef TRACEFILES_TRACEEVENTCLASSES_HPP
33 #define TRACEFILES_TRACEEVENTCLASSES_HPP
34
35 // On purpose outside the INCLUDE_TRACE
36 // Some parts of traceEvent.hpp are used outside of
37 // INCLUDE_TRACE
38
39 #include "trace/traceEvent.hpp"
40 #include "tracefiles/traceTypes.hpp"
41 #include "utilities/macros.hpp"
42 #if INCLUDE_TRACE
43 #include "jfr/recorder/service/jfrEvent.hpp"
44 /*
45 * Each event class has an assert member function verify() which is invoked
46 * just before the engine writes the event and its fields to the data stream.
47 * The purpose of verify() is to ensure that all fields in the event are initialized
48 * and set before attempting to commit.
49 *
50 * We enforce this requirement because events are generally stack allocated and therefore
51 * *not* initialized to default values. This prevents us from inadvertently committing
52 * uninitialized values to the data stream.
53 *
54 * The assert message contains both the index (zero based) as well as the name of the field.
55 */
56
57 <xsl:apply-templates select="trace/events/struct" mode="jfr"/>
58 <xsl:apply-templates select="trace/events/event" mode="jfr"/>
59
60 #else // !INCLUDE_TRACE
61
62 class TraceEvent {
63 public:
64 TraceEvent() {}
65 void set_starttime(const JfrTraceTime& ignore) const {}
66 void set_endtime(const JfrTraceTime& ignore) const {}
67 void set_starttime(const Ticks& ignore) const {}
68 void set_endtime(const Ticks& ignore) const {}
69 bool should_commit() const { return false; }
70 static bool is_enabled() { return false; }
71 void commit() {}
72 };
73
74 <xsl:apply-templates select="trace/events/struct" mode="empty"/>
75 <xsl:apply-templates select="trace/events/event" mode="empty"/>
76
77 #endif // INCLUDE_TRACE
78 #endif // JFRFILES_JFREVENTCLASSES_HPP
79 </xsl:template>
80
81 <xsl:template match="struct" mode="jfr">
82 struct TraceStruct<xsl:value-of select="@id"/>
83 {
84 private:
85 <xsl:apply-templates select="value" mode="write-fields"/>
86
87 public:
88 <xsl:apply-templates select="value" mode="write-setters"/>
89
90 template <typename Writer>
91 void writeData(Writer& w) {
92 <xsl:apply-templates select="value" mode="write-data"/>
93 }
94 };
95
96 </xsl:template>
97
98 <xsl:template match="struct" mode="empty">
99 struct TraceStruct<xsl:value-of select="@id"/>
100 {
101 public:
102 <xsl:apply-templates select="value" mode="write-empty-setters"/>
103 };
104
105 </xsl:template>
106
107 <xsl:template match="event" mode="empty">
108 <xsl:value-of select="concat('class Event', @id, ' : public TraceEvent')"/>
109 {
110 public:
111 <xsl:value-of select="concat(' Event', @id, '(EventStartTime ignore=TIMED) {}')"/>
112 <xsl:text>
113 </xsl:text>
114
115 <xsl:apply-templates select="value|structvalue|transition_value|relation" mode="write-empty-setters">
116 <xsl:with-param name="cls" select="concat('Event',@id)"/>
117 </xsl:apply-templates>
118 };
119
120 </xsl:template>
121
122 <xsl:template match="event" mode="jfr">
123 <xsl:value-of select="concat('class Event', @id, ' : public JfrTraceEvent<Event', @id, '>')"/>
124 {
125 private:
126 <xsl:apply-templates select="value|structvalue|transition_value|relation" mode="write-fields"/>
127
128 public:
129 static const bool hasThread = <xsl:value-of select="@has_thread"/>;
130 static const bool hasStackTrace = <xsl:value-of select="@has_stacktrace"/>;
131 static const bool isInstant = <xsl:value-of select="@is_instant"/>;
132 static const bool hasCutoff = <xsl:value-of select="@cutoff"/>;
133 static const bool isRequestable = <xsl:value-of select="@is_requestable"/>;
134 static const TraceEventId eventId = <xsl:value-of select="concat('Trace', @id, 'Event')"/>;
135
136 <xsl:value-of select="concat(' Event', @id, '(EventStartTime timing=TIMED) : JfrTraceEvent<Event', @id, '>(timing) {}
')"/>
137
138 <xsl:apply-templates select="value|structvalue|transition_value|relation" mode="write-setters-with-verification"/>
139
140 template <typename Writer>
141 void writeData(Writer& w) {
142 <xsl:apply-templates select="value|structvalue|transition_value|relation" mode="write-data"/>
143 }
144
145 using TraceEvent::commit; // else commit() is hidden by overloaded versions in this class
146
147 <xsl:variable name="instant" select="@is_instant"/>
148
149 <!-- non static method (only for non instant events)-->
150 <xsl:if test="$instant='false'">
151 <xsl:value-of select="concat(' Event', @id)"/>(
152 <xsl:for-each select="value|structvalue|transition_value|relation">
153 <xsl:apply-templates select="." mode="cpp-type"/><xsl:value-of select="concat(' ', @field)"/>
154 <xsl:if test="position() != last()">,
155 </xsl:if></xsl:for-each>) : JfrTraceEvent<<xsl:value-of select="concat('Event', @id)"/>>(TIMED) {
156 if (should_commit()) {<xsl:for-each select="value|structvalue|transition_value|relation">
157 set_<xsl:value-of select="@field"/>(<xsl:value-of select="@field"/>);</xsl:for-each>
158 }
159 }
160
161 void commit(<xsl:for-each select="value|structvalue|transition_value|relation">
162 <xsl:apply-templates select="." mode="cpp-type"/><xsl:value-of select="concat(' ', @field)"/>
163 <xsl:if test="position() != last()">,
164 </xsl:if></xsl:for-each>) {
165 if (should_commit()) {
166 <xsl:for-each select="value|structvalue|transition_value|relation">set_<xsl:value-of select="@field"/>(<xsl:value-of select="@field"/>);
167 </xsl:for-each>commit();
168 }
169 }</xsl:if>
170 <!-- static method (for all events) -->
171 static void commit(<xsl:if test="$instant='false'">const Ticks& startTicks,
172 const Ticks& endTicks<xsl:choose><xsl:when test="value|structvalue|transition_value|relation">,
173 </xsl:when></xsl:choose></xsl:if>
174 <xsl:for-each select="value|structvalue|transition_value|relation">
175 <xsl:apply-templates select="." mode="cpp-type"/><xsl:value-of select="concat(' ', @field)"/>
176 <xsl:if test="position() != last()">,
177 </xsl:if></xsl:for-each>) {
178 <xsl:value-of select="concat('Event', @id)"/> me(UNTIMED);
179
180 if (me.should_commit()) {
181 <xsl:if test="$instant='false'">me.set_starttime(startTicks);
182 me.set_endtime(endTicks);
183 </xsl:if>
184 <xsl:for-each select="value|structvalue|transition_value|relation">me.set_<xsl:value-of select="@field"/>(<xsl:value-of select="@field"/>);
185 </xsl:for-each>me.commit();
186 }
187 }
188
189 #ifdef ASSERT
190 void verify() const {
191 <xsl:apply-templates select="value" mode="write-verify"/>
192 }
193 #endif
194 };
195 <xsl:text>
196 </xsl:text>
197 </xsl:template>
198
199 <xsl:template match="value|transition_value|relation" mode="write-empty-setters">
200 <xsl:param name="cls"/>
201 <xsl:variable name="type" select="@type"/>
202 <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
203 <xsl:value-of select="concat(' void set_', @field, '(', $wt, ' ignore) { }')"/>
204 <xsl:if test="position() != last()">
205 <xsl:text>
206 </xsl:text>
207 </xsl:if>
208 </xsl:template>
209
210 <xsl:template match="structvalue" mode="write-empty-setters">
211 <xsl:param name="cls"/>
212 <xsl:value-of select="concat(' void set_', @field, '(const TraceStruct', @type, '& ignore) { }')"/>
213 <xsl:if test="position() != last()">
214 <xsl:text>
215 </xsl:text>
216 </xsl:if>
217 </xsl:template>
218
219 <xsl:template match="value[@type='TICKS']" mode="write-setters">
220 <xsl:value-of select="concat(' void set_', @field, '(const Ticks& time) {
this->_', @field, ' = time; }')"/>
221 <xsl:text>
</xsl:text>
222 </xsl:template>
223
224 <xsl:template match="value[@type='TICKS']" mode="write-setters-with-verification">
225 <xsl:value-of select="concat(' void set_', @field, '(const Ticks& time) {
this->_', @field, ' = time;
')"/>
226 <xsl:value-of select="concat(' DEBUG_ONLY(set_field_bit(', position() - 1, '));
}')"/>
227 <xsl:text>
</xsl:text>
228 </xsl:template>
229
230 <xsl:template match="value[@type='TICKSPAN']" mode="write-setters">
231 <xsl:value-of select="concat(' void set_', @field, '(const Tickspan& time) {
this->_', @field, ' = time; }')"/>
232 <xsl:text>
</xsl:text>
233 </xsl:template>
234
235 <xsl:template match="value[@type='TICKSPAN']" mode="write-setters-with-verification">
236 <xsl:value-of select="concat(' void set_', @field, '(const Tickspan& time) {
this->_', @field, ' = time;
')"/>
237 <xsl:value-of select="concat(' DEBUG_ONLY(set_field_bit(', position() - 1, '));
}')"/>
238 <xsl:text>
</xsl:text>
239 </xsl:template>
240
241 <xsl:template match="value|transition_value|relation" mode="write-setters">
242 <xsl:param name="cls"/>
243 <xsl:variable name="type" select="@type"/>
244 <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
245 <xsl:value-of select="concat(' void set_', @field, '(', $wt, ' new_value) { this->_', @field, ' = new_value; }')"/>
246 <xsl:if test="position() != last()">
247 <xsl:text>
248 </xsl:text>
249 </xsl:if>
250 </xsl:template>
251
252 <xsl:template match="value|transition|relation" mode="write-setters-with-verification">
253 <xsl:param name="cls"/>
254 <xsl:variable name="type" select="@type"/>
255 <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
256 <xsl:value-of select="concat(' void set_', @field, '(', $wt, ' new_value) {
this->_', @field, ' = new_value;
')"/>
257 <xsl:value-of select="concat(' DEBUG_ONLY(set_field_bit(', position() - 1, '));
}')"/>
258 <xsl:if test="position() != last()">
259 <xsl:text>
260 </xsl:text>
261 </xsl:if>
262 </xsl:template>
263
264 <xsl:template match="structvalue" mode="write-setters">
265 <xsl:param name="cls"/>
266 <xsl:value-of select="concat(' void set_', @field, '(const TraceStruct', @type, '& value) { this->_', @field, ' = value; }')"/>
267 <xsl:if test="position() != last()">
268 <xsl:text>
269 </xsl:text>
270 </xsl:if>
271 </xsl:template>
272
273 <xsl:template match="structvalue" mode="write-setters-with-verification">
274 <xsl:param name="cls"/>
275 <xsl:value-of select="concat(' void set_', @field, '(const TraceStruct', @type, '& value) {
this->_', @field, ' = value;
')"/>
276 <xsl:value-of select="concat(' DEBUG_ONLY(set_field_bit(', position() - 1, '));
')"/>
277 <xsl:text> }</xsl:text>
278 <xsl:if test="position() != last()">
279 <xsl:text>
280 </xsl:text>
281 </xsl:if>
282 </xsl:template>
283
284 <xsl:template match="value|transition_value|relation" mode="write-fields">
285 <xsl:variable name="type" select="@type"/>
286 <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
287 <xsl:value-of select="concat(' ', $wt, ' _', @field, ';')"/>
288 <xsl:if test="position() != last()">
289 <xsl:text>
290 </xsl:text>
291 </xsl:if>
292 </xsl:template>
293
294 <xsl:template match="structvalue" mode="write-fields">
295 <xsl:value-of select="concat(' TraceStruct', @type, ' _', @field, ';')"/>
296 <xsl:if test="position() != last()">
297 <xsl:text>
298 </xsl:text>
299 </xsl:if>
300 </xsl:template>
301
302 <xsl:template match="value" mode="write-verify">
303 <xsl:param name="cls"/>
304 <xsl:text> </xsl:text>
305 <xsl:value-of select="concat('assert(verify_field_bit(', position() - 1, '), ' , $quote, 'Attempting to write an uninitialized event field: %s', $quote,', ', $quote, '_', @field, $quote, ');')"/>
306 <xsl:if test="position() != last()">
307 <xsl:text>
308 </xsl:text>
309 </xsl:if>
310 </xsl:template>
311
312 <xsl:template match="value|transition_value|relation" mode="write-data">
313 <xsl:variable name="type" select="@type"/>
314 <xsl:value-of select="concat(' w.write(_', @field, ');')"/>
315 <xsl:if test="position() != last()">
316 <xsl:text>
317 </xsl:text>
318 </xsl:if>
319 </xsl:template>
320
321 <xsl:template match="structvalue" mode="write-data">
322 <xsl:variable name="structtype" select="@type"/>
323 <xsl:variable name="structname" select="@field"/>
324 <xsl:value-of select="concat(' _', @field, '.writeData(w);')"/>
325 <xsl:if test="position() != last()">
326 <xsl:text>
327 </xsl:text>
328 </xsl:if>
329 </xsl:template>
330
331
332 <xsl:template match="value|transition_value|relation" mode="cpp-type">
333 <xsl:variable name="type" select="@type"/>
334 <xsl:value-of select="//primary_type[@symbol=$type]/@type"/>
335 </xsl:template>
336 <xsl:template match="structvalue" mode="cpp-type">
337 <xsl:value-of select="concat('const TraceStruct', @type, '&')"/>
338 </xsl:template>
339
340 </xsl:stylesheet>
|