]> git.cworth.org Git - apitrace/blob - apitrace.xsl
Dump wchar_t strings correctly.
[apitrace] / apitrace.xsl
1 <?xml version="1.0"?>
2
3 <!--
4
5 Copyright 2009 VMware, Inc.
6 Copyright 2008 Tungsten Graphics, Inc.
7
8 This program is free software: you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published
10 by the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
21 !-->
22
23 <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
24
25         <xsl:output method="html" />
26
27         <xsl:strip-space elements="*" />
28
29         <xsl:template match="/trace">
30                 <html>
31                         <head>
32                                 <title>D3D Trace</title>
33                         </head>
34                         <style>
35                                 body {
36                                         font-family: verdana, sans-serif;
37                                         font-size: 11px;
38                                         font-weight: normal;
39                                         text-align : left;
40                                 }
41
42                                 ul.calls {
43                                         list-style: none;
44                                         margin-left: 0px;
45                                         padding-left: 0px;
46                                 }
47
48                                 ul.args {
49                                         display:inline;
50                                         list-style: none;
51                                         margin-left: 0px;
52                                         padding-left: 0px;
53                                 }
54
55                                 ul.args li {
56                                         display:inline;
57                                 }
58
59                                 ul.elems {
60                                         list-style: none;
61                                         margin-left: 2em;
62                                         padding-left: 0px;
63                                 }
64
65                                 ul.elems li {
66                                         display:block;
67                                 }
68
69                                 .fun {
70                                         font-weight: bold;
71                                 }
72
73                                 .var {
74                                         font-style: italic;
75                                 }
76
77                                 .typ {
78                                         display: none;
79                                 }
80
81                                 .lit {
82                                         color: #0000ff;
83                                 }
84
85                                 .addr {
86                                         color: #008000;
87                                 }
88
89                                 .ref {
90                                         position: relative;
91                                         cursor: help;
92                                 }
93
94                                 .def {
95                                         display: none;
96                                         position: absolute;
97                                         top: 1.5em;
98                                         left: 0;
99                                         width: 32em;
100                                         background: #f7f7f7;
101                                         cursor: default;
102                                 }
103
104                                 .ref:hover .def {
105                                         display: block;
106                                 }
107                         </style>
108                         <body>
109                                 <ul class="calls">
110                                         <xsl:apply-templates/>
111                                 </ul>
112                         </body>
113                 </html>
114         </xsl:template>
115
116         <xsl:template match="call">
117                 <li>
118                         <span class="fun">
119                                 <xsl:value-of select="@name"/>
120                         </span>
121                         <xsl:text>(</xsl:text>
122                         <ul class="args">
123                                 <xsl:apply-templates select="arg"/>
124                         </ul>
125                         <xsl:text>)</xsl:text>
126                         <xsl:apply-templates select="ret"/>
127                 </li>
128         </xsl:template>
129
130         <xsl:template match="arg|elem">
131                 <li>
132                         <xsl:apply-templates select="@type"/>
133                         <xsl:apply-templates select="@name"/>
134                         <xsl:text> = </xsl:text>
135                         <xsl:call-template name="compound"/>
136                         <xsl:if test="position() != last()">
137                                 <xsl:text>, </xsl:text>
138                         </xsl:if>
139                 </li>
140         </xsl:template>
141
142         <xsl:template match="@type">
143                 <xsl:attribute name="title">
144                         <xsl:value-of select="."/>
145                 </xsl:attribute>
146         </xsl:template>
147
148         <xsl:template match="@name">
149                 <span class="var">
150                         <xsl:value-of select="."/>
151                 </span>
152         </xsl:template>
153
154         <xsl:template match="ret">
155                 <xsl:text> = </xsl:text>
156                 <xsl:call-template name="compound"/>
157         </xsl:template>
158
159         <xsl:template match="ref">
160                 <xsl:choose>
161                         <xsl:when test="elem">
162                                 <span class="ref">
163                                         <xsl:apply-templates select="@addr"/>
164                                         <span class="def">
165                                                 <xsl:call-template name="compound"/>
166                                         </span>
167                                 </span>
168                         </xsl:when>
169                         <xsl:when test="*">
170                                 <xsl:text>&amp;</xsl:text>
171                                 <xsl:apply-templates />
172                         </xsl:when>
173                         <xsl:otherwise>
174                                 <xsl:apply-templates select="@addr"/>
175                         </xsl:otherwise>
176                 </xsl:choose>
177         </xsl:template>
178
179         <xsl:template match="@addr">
180                 <span class="addr">
181                         <xsl:value-of select="."/>
182                 </span>
183         </xsl:template>
184
185         <xsl:template match="text()">
186                 <span class="lit">
187                         <xsl:value-of select="."/>
188                 </span>
189         </xsl:template>
190
191         <xsl:template name="compound">
192                 <xsl:choose>
193                         <xsl:when test="elem">
194                                 <xsl:text>{</xsl:text>
195                                 <ul class="elems">
196                                         <xsl:apply-templates />
197                                 </ul>
198                                 <xsl:text>}</xsl:text>
199                         </xsl:when>
200                         <xsl:otherwise>
201                                 <xsl:apply-templates />
202                         </xsl:otherwise>
203                 </xsl:choose>
204         </xsl:template>
205 </xsl:transform>