Daniel Veillard | f609d74 | 2009-08-21 15:16:46 +0200 | [diff] [blame] | 1 | <?xml version="1.0"?> |
| 2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 3 | version="1.0"> |
| 4 | <xsl:output method="text" encoding="UTF-8"/> |
| 5 | |
| 6 | <xsl:variable name="api" select="document('libxml2-api.xml')"/> |
| 7 | |
| 8 | <xsl:template match="/"> |
| 9 | <xsl:text># |
| 10 | # Officially exported symbols, for which header |
| 11 | # file definitions are installed in /usr/include/libxml2 |
| 12 | # |
| 13 | # Automatically generated from symbols.xml and syms.xsl |
| 14 | # |
| 15 | # Versions here are *fixed* to match the libxml2 version |
| 16 | # at which the symbol was introduced. This ensures that |
| 17 | # a new client app requiring symbol foo() can't accidentally |
| 18 | # run with old libxml2.so not providing foo() - the global |
| 19 | # soname version info can't enforce this since we never |
| 20 | # change the soname |
| 21 | # |
| 22 | |
| 23 | </xsl:text> |
| 24 | <xsl:apply-templates select="/symbols/release"/> |
| 25 | </xsl:template> |
| 26 | |
| 27 | <xsl:template match="release"> |
| 28 | <xsl:variable name="prev" |
| 29 | select="preceding-sibling::release[position()=1]"/> |
| 30 | <xsl:text>LIBXML2_</xsl:text> |
| 31 | <xsl:value-of select="string(@version)"/> |
| 32 | <xsl:text> { |
| 33 | global: |
| 34 | </xsl:text> |
| 35 | <xsl:for-each select="symbol"> |
| 36 | <xsl:if test="string(preceding-sibling::symbol[position()=1]/@file) != string(@file)"> |
| 37 | <xsl:text> |
| 38 | # </xsl:text> |
| 39 | <xsl:value-of select="@file"/> |
| 40 | <xsl:text> |
| 41 | </xsl:text> |
| 42 | </xsl:if> |
| 43 | |
| 44 | <xsl:apply-templates select="."/> |
| 45 | </xsl:for-each> |
| 46 | |
| 47 | <xsl:text>} </xsl:text> |
| 48 | <xsl:if test="$prev"> |
| 49 | <xsl:text>LIBXML2_</xsl:text> |
| 50 | <xsl:value-of select="$prev/@version"/> |
| 51 | </xsl:if> |
| 52 | <xsl:text>; |
| 53 | |
| 54 | </xsl:text> |
| 55 | </xsl:template> |
| 56 | |
| 57 | <xsl:template match="symbol"> |
| 58 | <xsl:variable name="name" select="string(.)"/> |
| 59 | <xsl:variable name="file" select="string(@file)"/> |
| 60 | <xsl:choose> |
| 61 | <xsl:when test="@removed"> |
| 62 | <xsl:text># </xsl:text> |
| 63 | <xsl:value-of select="$name"/> |
| 64 | <xsl:text>; removed in </xsl:text> |
| 65 | <xsl:value-of select="@removed"/> |
| 66 | <xsl:text> |
| 67 | </xsl:text> |
| 68 | </xsl:when> |
| 69 | <xsl:otherwise> |
| 70 | <!-- make sure we can find that symbol exported from the API list --> |
| 71 | <xsl:variable name="def" |
| 72 | select="$api/api/files/file[@name = $file]/exports[@symbol = $name]"/> |
| 73 | <xsl:if test="string($def/@symbol) != $name"> |
| 74 | <xsl:message terminate="yes"> |
| 75 | <xsl:text>Failed to find definition in libxml2-api.xml:</xsl:text> |
| 76 | <xsl:value-of select="$name"/> |
| 77 | </xsl:message> |
| 78 | </xsl:if> |
| 79 | |
| 80 | <xsl:text> </xsl:text> |
| 81 | <xsl:value-of select="$name"/> |
| 82 | <xsl:text>;</xsl:text> |
| 83 | <xsl:if test="$def/@type = 'variable'"> |
| 84 | <xsl:text> # variable</xsl:text> |
| 85 | </xsl:if> |
| 86 | <xsl:if test="@comment"> |
| 87 | <xsl:text># </xsl:text> |
| 88 | <xsl:value-of select="@comment"/> |
| 89 | <xsl:text> |
| 90 | </xsl:text> |
| 91 | </xsl:if> |
| 92 | <xsl:text> |
| 93 | </xsl:text> |
| 94 | </xsl:otherwise> |
| 95 | </xsl:choose> |
| 96 | </xsl:template> |
| 97 | |
| 98 | </xsl:stylesheet> |
| 99 | |