1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml">
23<xsl:output method="text" encoding="iso-8859-1"/>
24
25<xsl:template match="/">
26<xsl:apply-templates select="//xhtml:body/xhtml:table"/>
27</xsl:template>
28
29<xsl:template match="xhtml:table">
30<xsl:apply-templates select="xhtml:tbody/xhtml:tr[2]"/>
31</xsl:template>
32
33<xsl:template name="handleTR">
34<xsl:param name="offset"/>
35<xsl:param name="shift"/>
36<xsl:variable name="name"><xsl:value-of select="xhtml:td[3]"/></xsl:variable>
37<xsl:variable name="type"><xsl:value-of select="xhtml:td[4]"/></xsl:variable>
38<xsl:variable name="saltype">
39<xsl:choose>
40  <xsl:when test="$type='U8'">sal_uInt8</xsl:when>
41  <xsl:when test="$type='S8'">sal_Int8</xsl:when>
42  <xsl:when test="$type='U16'">sal_uInt16</xsl:when>
43  <xsl:when test="$type='S16'">sal_Int16</xsl:when>
44  <xsl:when test="$type='U32'">sal_uInt32</xsl:when>
45  <xsl:when test="$type='S32'">sal_Int32</xsl:when>
46  <xsl:otherwise>void *</xsl:otherwise>
47</xsl:choose>
48</xsl:variable>
49<xsl:variable name="bits"><xsl:value-of select="xhtml:td[5]"/></xsl:variable>
50<xsl:variable name="mask"><xsl:value-of select="xhtml:td[6]"/></xsl:variable>
51<xsl:variable name="comment"><xsl:value-of select="xhtml:td[7]"/></xsl:variable>
52/**
53<xsl:value-of select="$comment"/>
54
55offset : <xsl:value-of select="$offset"/>
56name : <xsl:value-of select="$name"/>
57type   : <xsl:value-of select="$type"/>
58shift  : <xsl:value-of select="concat($shift, '&#xa;')"/>
59*/
60
61<xsl:value-of select="$saltype"/> get_<xsl:value-of select="$name"/>() const<xsl:choose>
62<xsl:when test="$saltype='void *'">;
63</xsl:when>
64<xsl:otherwise> { return (get<xsl:value-of select="$type"/>(0x<xsl:value-of select="$offset"/>)<xsl:if test="string-length($mask)>0"> &amp; 0x<xsl:value-of select="translate($mask, 'ABCDEF', 'abcdef')"/></xsl:if>)<xsl:if test="$shift>0"> &gt;&gt; <xsl:value-of select="$shift"/></xsl:if>; }
65</xsl:otherwise>
66</xsl:choose>
67</xsl:template>
68
69<xsl:template match="xhtml:tr[./xhtml:td[position()=1]/text()]">
70<xsl:variable name="offset"><xsl:value-of select="xhtml:td[2]"/></xsl:variable>
71<xsl:call-template name="handleTR">
72<xsl:with-param name="offset" select="$offset"/>
73<xsl:with-param name="shift">0</xsl:with-param>
74</xsl:call-template>
75<xsl:variable name="shift1"><xsl:value-of select="substring-after(xhtml:td[5], ':')"/></xsl:variable>
76<xsl:apply-templates select="following-sibling::xhtml:tr[position()=1]">
77<xsl:with-param name="offset" select="$offset"/>
78<xsl:with-param name="shift" select="$shift1"/>
79</xsl:apply-templates>
80</xsl:template>
81
82<xsl:template match="xhtml:tr[not(./xhtml:td[position()=1]/text())]">
83<xsl:param name="offset"/>
84<xsl:param name="shift"/>
85<xsl:call-template name="handleTR">
86<xsl:with-param name="offset" select="$offset"/>
87<xsl:with-param name="shift" select="$shift"/>
88</xsl:call-template>
89<xsl:variable name="shift1"><xsl:value-of select="$shift+substring-after(xhtml:td[5], ':')"/></xsl:variable>
90<xsl:apply-templates select="following-sibling::xhtml:tr[position()=1]">
91<xsl:with-param name="offset" select="$offset"/>
92<xsl:with-param name="shift" select="$shift1"/>
93</xsl:apply-templates>
94</xsl:template>
95
96<xsl:template match="*">
97<xsl:copy-of select="."/>
98</xsl:template>
99
100</xsl:stylesheet>
101