]> git.cworth.org Git - apitrace/blob - d3dtrace.xsl
Basic support for tracing d3d7.
[apitrace] / d3dtrace.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>D3D Trace</title>
32                                 <link rel="stylesheet" type="text/css" href="d3dtrace.css"/>
33                         </head>
34                         <body>
35                                 <ul class="calls">
36                                         <xsl:apply-templates/>
37                                 </ul>
38                         </body>
39                 </html>
40         </xsl:template>
41
42         <xsl:template match="call">
43                 <li>
44                         <span class="fun">
45                                 <xsl:value-of select="@name"/>
46                         </span>
47                         <xsl:text>(</xsl:text>
48                         <ul class="args">
49                                 <xsl:apply-templates select="arg"/>
50                         </ul>
51                         <xsl:text>)</xsl:text>
52                         <xsl:apply-templates select="ret"/>
53                 </li>
54         </xsl:template>
55
56         <xsl:template match="arg|elem">
57                 <li>
58                         <xsl:apply-templates select="@type"/>
59                         <xsl:apply-templates select="@name"/>
60                         <xsl:text> = </xsl:text>
61                         <xsl:call-template name="compound"/>
62                         <xsl:if test="position() != last()">
63                                 <xsl:text>, </xsl:text>
64                         </xsl:if>
65                 </li>
66         </xsl:template>
67
68         <xsl:template match="@type">
69                 <xsl:attribute name="title">
70                         <xsl:value-of select="."/>
71                 </xsl:attribute>
72         </xsl:template>
73
74         <xsl:template match="@name">
75                 <span class="var">
76                         <xsl:value-of select="."/>
77                 </span>
78         </xsl:template>
79
80         <xsl:template match="ret">
81                 <xsl:text> = </xsl:text>
82                 <xsl:call-template name="compound"/>
83         </xsl:template>
84
85         <xsl:template match="ref">
86                 <xsl:choose>
87                         <xsl:when test="elem">
88                                 <span class="ref">
89                                         <xsl:apply-templates select="@addr"/>
90                                         <span class="def">
91                                                 <xsl:call-template name="compound"/>
92                                         </span>
93                                 </span>
94                         </xsl:when>
95                         <xsl:when test="*">
96                                 <xsl:text>&amp;</xsl:text>
97                                 <xsl:apply-templates />
98                         </xsl:when>
99                         <xsl:otherwise>
100                                 <xsl:apply-templates select="@addr"/>
101                         </xsl:otherwise>
102                 </xsl:choose>
103         </xsl:template>
104
105         <xsl:template match="@addr">
106                 <span class="addr">
107                         <xsl:value-of select="."/>
108                 </span>
109         </xsl:template>
110
111         <xsl:template match="text()">
112                 <span class="lit">
113                         <xsl:value-of select="."/>
114                 </span>
115         </xsl:template>
116
117         <xsl:template name="compound">
118                 <xsl:choose>
119                         <xsl:when test="elem">
120                                 <xsl:text>{</xsl:text>
121                                 <ul class="elems">
122                                         <xsl:apply-templates />
123                                 </ul>
124                                 <xsl:text>}</xsl:text>
125                         </xsl:when>
126                         <xsl:otherwise>
127                                 <xsl:apply-templates />
128                         </xsl:otherwise>
129                 </xsl:choose>
130         </xsl:template>
131 </xsl:transform>