* features/Makefile, features/arm-with-iwmmxt.xml,
[external/binutils.git] / gdb / features / number-regs.xsl
1 <xsl:stylesheet version="1.0"
2                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3   <xsl:variable name="total" select="count(//reg)"/>
4   <xsl:template name="reg">
5     <xsl:param name="which" select="1"/>
6     <xsl:param name="nextnum" select="0"/>
7     <xsl:variable name="thisnum" select="@regnum"/>
8     <xsl:element name="reg">
9       <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
10       <xsl:attribute name="bitsize"><xsl:value-of select="@bitsize"/></xsl:attribute>
11       <xsl:choose>
12         <xsl:when test="not(@regnum)">
13           <xsl:attribute name="regnum"><xsl:value-of select="$nextnum"/></xsl:attribute>
14         </xsl:when>
15         <xsl:otherwise>
16           <xsl:attribute name="regnum"><xsl:value-of select="@regnum"/></xsl:attribute>
17         </xsl:otherwise>
18       </xsl:choose>
19     </xsl:element>
20     <xsl:if test="$which &lt; $total">
21       <xsl:for-each select="/descendant::reg[$which + 1]">
22         <xsl:choose>
23           <xsl:when test="not($thisnum)">
24             <xsl:call-template name="reg">
25               <xsl:with-param name="which" select="$which + 1"/>
26               <xsl:with-param name="nextnum" select="$nextnum + 1"/>
27             </xsl:call-template>
28           </xsl:when>
29           <xsl:otherwise>
30             <xsl:call-template name="reg">
31               <xsl:with-param name="which" select="$which + 1"/>
32               <xsl:with-param name="nextnum" select="$thisnum + 1"/>
33             </xsl:call-template>
34           </xsl:otherwise>
35         </xsl:choose>
36       </xsl:for-each>
37     </xsl:if>
38   </xsl:template>
39
40   <xsl:template match="/">
41     <target>
42       <xsl:for-each select="/descendant::reg[1]">
43         <xsl:call-template name="reg"/>
44       </xsl:for-each>
45     </target>
46   </xsl:template>
47 </xsl:stylesheet>