summaryrefslogtreecommitdiff
path: root/lib/tools/c-interfaces-generator.xsl
blob: 3c46452151a8500ca429e964c8406f3cea574148 (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
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
  exclude-result-prefixes="tp">

  <xsl:output method="text" indent="no" encoding="ascii"/>

  <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
  <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>

  <xsl:template match="interface">
    <xsl:text>/**&#10; * TP_IFACE_</xsl:text>
    <xsl:value-of select="translate(../@name, concat($lower, '/'), $upper)"/>
    <xsl:text>:&#10; * &#10; * The Telepathy interface name "</xsl:text>
    <xsl:value-of select="@name"/>
    <xsl:text>"&#10; */&#10;#define TP_IFACE_</xsl:text>
    <xsl:value-of select="translate(../@name, concat($lower, '/'), $upper)"/>
    <xsl:text> \&#10;"</xsl:text>
    <xsl:value-of select="@name"/>
    <xsl:text>"&#10;&#10;</xsl:text>
  </xsl:template>

  <xsl:template match="text()"/>

  <xsl:template match="/tp:spec">/* Generated from the Telepathy spec

<xsl:for-each select="tp:copyright">
<xsl:value-of select="."/><xsl:text>
</xsl:text></xsl:for-each><xsl:text>
</xsl:text><xsl:value-of select="tp:license"/>
<xsl:value-of select="tp:docstring"/>
*/

<xsl:apply-templates select="node"/>
</xsl:template>

</xsl:stylesheet>

<!-- vim:set sw=2 sts=2 et noai noci: -->