Merge remote branch 'origin/gallium-0.2' into gallium-0.2
[mesa.git] / src / gallium / drivers / trace / trace.xsl
1 <?xml version="1.0"?>
2
3 <!--
4
5 Copyright 2008 Tungsten Graphics, Inc.
6
7 This program is free software: you can redistribute it and/or modify it
8 under the terms of the GNU Lesser General Public License as published
9 by the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20 !-->
21
22 <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
23
24 <xsl:output method="html" />
25
26 <xsl:strip-space elements="*" />
27
28 <xsl:template match="/trace">
29 <html>
30 <head>
31 <title>Gallium Trace</title>
32 </head>
33 <style>
34 body {
35 font-family: verdana, sans-serif;
36 font-size: 11px;
37 font-weight: normal;
38 text-align : left;
39 }
40
41 .fun {
42 font-weight: bold;
43 }
44
45 .var {
46 font-style: italic;
47 }
48
49 .typ {
50 display: none;
51 }
52
53 .lit {
54 color: #0000ff;
55 }
56
57 .ptr {
58 color: #008000;
59 }
60 </style>
61 <body>
62 <ol class="calls">
63 <xsl:apply-templates/>
64 </ol>
65 </body>
66 </html>
67 </xsl:template>
68
69 <xsl:template match="call">
70 <li>
71 <span class="fun">
72 <xsl:value-of select="@class"/>
73 <xsl:text>::</xsl:text>
74 <xsl:value-of select="@method"/>
75 </span>
76 <xsl:text>(</xsl:text>
77 <xsl:apply-templates select="arg"/>
78 <xsl:text>)</xsl:text>
79 <xsl:apply-templates select="ret"/>
80 </li>
81 </xsl:template>
82
83 <xsl:template match="arg|member">
84 <xsl:apply-templates select="@name"/>
85 <xsl:text> = </xsl:text>
86 <xsl:apply-templates />
87 <xsl:if test="position() != last()">
88 <xsl:text>, </xsl:text>
89 </xsl:if>
90 </xsl:template>
91
92 <xsl:template match="ret">
93 <xsl:text> = </xsl:text>
94 <xsl:apply-templates />
95 </xsl:template>
96
97 <xsl:template match="bool|int|uint|float|enum">
98 <span class="lit">
99 <xsl:value-of select="text()"/>
100 </span>
101 </xsl:template>
102
103 <xsl:template match="bytes">
104 <span class="lit">
105 <xsl:text>...</xsl:text>
106 </span>
107 </xsl:template>
108
109 <xsl:template match="string">
110 <span class="lit">
111 <xsl:text>"</xsl:text>
112 <xsl:call-template name="break">
113 <xsl:with-param name="text" select="text()"/>
114 </xsl:call-template>
115 <xsl:text>"</xsl:text>
116 </span>
117 </xsl:template>
118
119 <xsl:template match="array|struct">
120 <xsl:text>{</xsl:text>
121 <xsl:apply-templates />
122 <xsl:text>}</xsl:text>
123 </xsl:template>
124
125 <xsl:template match="elem">
126 <xsl:apply-templates />
127 <xsl:if test="position() != last()">
128 <xsl:text>, </xsl:text>
129 </xsl:if>
130 </xsl:template>
131
132 <xsl:template match="null">
133 <span class="ptr">
134 <xsl:text>NULL</xsl:text>
135 </span>
136 </xsl:template>
137
138 <xsl:template match="ptr">
139 <span class="ptr">
140 <xsl:value-of select="text()"/>
141 </span>
142 </xsl:template>
143
144 <xsl:template match="@name">
145 <span class="var">
146 <xsl:value-of select="."/>
147 </span>
148 </xsl:template>
149
150 <xsl:template name="break">
151 <xsl:param name="text" select="."/>
152 <xsl:choose>
153 <xsl:when test="contains($text, '&#xa;')">
154 <xsl:value-of select="substring-before($text, '&#xa;')"/>
155 <br/>
156 <xsl:call-template name="break">
157 <xsl:with-param name="text" select="substring-after($text, '&#xa;')"/>
158 </xsl:call-template>
159 </xsl:when>
160 <xsl:otherwise>
161 <xsl:value-of select="$text"/>
162 </xsl:otherwise>
163 </xsl:choose>
164 </xsl:template>
165
166 <xsl:template name="replace">
167 <xsl:param name="text"/>
168 <xsl:param name="from"/>
169 <xsl:param name="to"/>
170 <xsl:choose>
171 <xsl:when test="contains($text,$from)">
172 <xsl:value-of select="concat(substring-before($text,$from),$to)"/>
173 <xsl:call-template name="replace">
174 <xsl:with-param name="text" select="substring-after($text,$from)"/>
175 <xsl:with-param name="from" select="$from"/>
176 <xsl:with-param name="to" select="$to"/>
177 </xsl:call-template>
178 </xsl:when>
179 <xsl:otherwise>
180 <xsl:value-of select="$text"/>
181 </xsl:otherwise>
182 </xsl:choose>
183 </xsl:template>
184
185 </xsl:transform>