File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libxml2 / doc / syms.xsl
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:37:59 2012 UTC (12 years, 8 months ago) by misho
Branches: libxml2, MAIN
CVS tags: v2_9_1p0, v2_9_1, v2_8_0p0, v2_8_0, v2_7_8, HEAD
libxml2

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">
  <xsl:output method="text" encoding="UTF-8"/>

  <xsl:variable name="api" select="document('libxml2-api.xml')"/>

  <xsl:template match="/">
    <xsl:text>#
# Officially exported symbols, for which header
# file definitions are installed in /usr/include/libxml2
#
# Automatically generated from symbols.xml and syms.xsl
#
# Versions here are *fixed* to match the libxml2 version
# at which the symbol was introduced. This ensures that
# a new client app requiring symbol foo() can't accidentally
# run with old libxml2.so not providing foo() - the global
# soname version info can't enforce this since we never
# change the soname
#

</xsl:text>
    <xsl:apply-templates select="/symbols/release"/>
  </xsl:template>

  <xsl:template match="release">
    <xsl:variable name="prev"
                  select="preceding-sibling::release[position()=1]"/>
    <xsl:text>LIBXML2_</xsl:text>
    <xsl:value-of select="string(@version)"/>
    <xsl:text> {
    global:
</xsl:text>
    <xsl:for-each select="symbol">
      <xsl:if test="string(preceding-sibling::symbol[position()=1]/@file) != string(@file)">
        <xsl:text>
# </xsl:text>
        <xsl:value-of select="@file"/>
        <xsl:text>
</xsl:text>
      </xsl:if>

      <xsl:apply-templates select="."/>
    </xsl:for-each>

    <xsl:text>} </xsl:text>
    <xsl:if test="$prev">
      <xsl:text>LIBXML2_</xsl:text>
      <xsl:value-of select="$prev/@version"/>
    </xsl:if>
    <xsl:text>;

</xsl:text>
  </xsl:template>

  <xsl:template match="symbol">
    <xsl:variable name="name" select="string(.)"/>
    <xsl:variable name="file" select="string(@file)"/>
    <xsl:choose>
      <xsl:when test="@removed">
        <xsl:text># </xsl:text>
        <xsl:value-of select="$name"/>
        <xsl:text>; removed in </xsl:text>
        <xsl:value-of select="@removed"/>
        <xsl:text>
</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <!-- make sure we can find that symbol exported from the API list -->
        <xsl:variable name="def"
            select="$api/api/files/file[@name = $file]/exports[@symbol = $name]"/>
        <xsl:if test="string($def/@symbol) != $name">
          <xsl:message terminate="yes">
            <xsl:text>Failed to find definition in libxml2-api.xml:</xsl:text>
            <xsl:value-of select="$name"/>
          </xsl:message>
        </xsl:if>

        <xsl:text>  </xsl:text>
        <xsl:value-of select="$name"/>
        <xsl:text>;</xsl:text>
        <xsl:if test="$def/@type = 'variable'">
          <xsl:text> # variable</xsl:text>
        </xsl:if>
        <xsl:if test="@comment">
          <xsl:text># </xsl:text>
          <xsl:value-of select="@comment"/>
          <xsl:text>
</xsl:text>
        </xsl:if>
        <xsl:text>
</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>