summaryrefslogtreecommitdiffstats
path: root/libxslt/doc/syms.xsl
blob: 3965e90c6a0bd122d6c6821854662dc12976aa8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?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('libxslt-api.xml')"/>

  <xsl:template match="/">
    <xsl:text>#
# Officially exported symbols, for which header
# file definitions are installed in /usr/include/libxslt
#
# Automatically generated from symbols.xml and syms.xsl
#
# Versions here are *fixed* to match the libxslt version
# at which the symbol was introduced. This ensures that
# a new client app requiring symbol foo() can't accidentally
# run with old libxslt.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 libxslt-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>