~ubuntu-branches/ubuntu/natty/empathy/natty-updates

« back to all changes in this revision

Viewing changes to tools/c-interfaces-generator.xsl

Tags: upstream-0.22.0
ImportĀ upstreamĀ versionĀ 0.22.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!-- Stylesheet to extract C enumerations from the Telepathy spec.
 
2
The master copy of this stylesheet is in telepathy-glib - please make any
 
3
changes there.
 
4
 
 
5
Copyright (C) 2006, 2007 Collabora Limited
 
6
 
 
7
This library is free software; you can redistribute it and/or
 
8
modify it under the terms of the GNU Lesser General Public
 
9
License as published by the Free Software Foundation; either
 
10
version 2.1 of the License, or (at your option) any later version.
 
11
 
 
12
This library is distributed in the hope that it will be useful,
 
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
Lesser General Public License for more details.
 
16
 
 
17
You should have received a copy of the GNU Lesser General Public
 
18
License along with this library; if not, write to the Free Software
 
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
20
-->
 
21
 
 
22
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
23
  xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
 
24
  exclude-result-prefixes="tp">
 
25
 
 
26
  <xsl:param name="mixed-case-prefix" select="''"/>
 
27
 
 
28
  <xsl:variable name="PREFIX"
 
29
    select="translate($mixed-case-prefix, $lower, $upper)"/>
 
30
  <xsl:variable name="Prefix" select="$mixed-case-prefix"/>
 
31
  <xsl:variable name="prefix"
 
32
    select="translate($mixed-case-prefix, $upper, $lower)"/>
 
33
 
 
34
  <xsl:output method="text" indent="no" encoding="ascii"/>
 
35
 
 
36
  <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
 
37
  <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
 
38
 
 
39
  <xsl:template match="interface">
 
40
    <xsl:text>/**&#10; * </xsl:text>
 
41
    <xsl:value-of select="$PREFIX"/>
 
42
    <xsl:text>_IFACE_</xsl:text>
 
43
    <xsl:value-of select="translate(../@name, concat($lower, '/'), $upper)"/>
 
44
    <xsl:text>:&#10; * &#10; * The interface name "</xsl:text>
 
45
    <xsl:value-of select="@name"/>
 
46
    <xsl:text>"&#10; */&#10;#define </xsl:text>
 
47
    <xsl:value-of select="$PREFIX"/>
 
48
    <xsl:text>_IFACE_</xsl:text>
 
49
    <xsl:value-of select="translate(../@name, concat($lower, '/'), $upper)"/>
 
50
    <xsl:text> \&#10;"</xsl:text>
 
51
    <xsl:value-of select="@name"/>
 
52
    <xsl:text>"&#10;&#10;</xsl:text>
 
53
  </xsl:template>
 
54
 
 
55
  <xsl:template match="text()"/>
 
56
 
 
57
  <xsl:template match="/tp:spec">
 
58
    <xsl:if test="$mixed-case-prefix = ''">
 
59
      <xsl:message terminate="yes">
 
60
        <xsl:text>mixed-case-prefix param must be set&#10;</xsl:text>
 
61
      </xsl:message>
 
62
    </xsl:if>
 
63
 
 
64
    <xsl:text>/* Generated from: </xsl:text>
 
65
    <xsl:value-of select="tp:title"/>
 
66
    <xsl:if test="tp:version">
 
67
      <xsl:text> version </xsl:text>
 
68
      <xsl:value-of select="tp:version"/>
 
69
    </xsl:if>
 
70
    <xsl:text>&#10;&#10;</xsl:text>
 
71
    <xsl:for-each select="tp:copyright">
 
72
      <xsl:value-of select="."/>
 
73
      <xsl:text>&#10;</xsl:text>
 
74
    </xsl:for-each>
 
75
    <xsl:text>&#10;</xsl:text>
 
76
    <xsl:value-of select="tp:license"/>
 
77
    <xsl:value-of select="tp:docstring"/>
 
78
    <xsl:text>&#10; */&#10;&#10;</xsl:text>
 
79
    <xsl:apply-templates/>
 
80
  </xsl:template>
 
81
 
 
82
</xsl:stylesheet>
 
83
 
 
84
<!-- vim:set sw=2 sts=2 et noai noci: -->