]> git.0d.be Git - empathy.git/blob - tools/glib-errors-enum-body.xsl
Import tools from telepathy-glib 0.7.3 and build a static libemp-extensions.la.
[empathy.git] / tools / glib-errors-enum-body.xsl
1 <!-- Stylesheet to extract GLib error 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:output method="text" indent="no" encoding="ascii"/>
27
28   <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
29   <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
30
31   <xsl:template match="tp:error" mode="values">
32     <!-- CHANNEL_BANNED -->
33     <xsl:variable name="name" select="translate(@name, concat($lower, '. '),
34                                                 concat($upper, '__'))"/>
35     <!-- Channel.Banned -->
36     <xsl:variable name="nick" select="translate(@name, ' ', '')"/>
37         /* <xsl:value-of select="concat(../@namespace, '.', $name)"/>
38     <xsl:value-of select="tp:docstring"/> */
39         { TP_ERROR_<xsl:value-of select="$name"/>, "TP_ERROR_<xsl:value-of select="$name"/>", "<xsl:value-of select="$nick"/>" },
40 </xsl:template>
41
42   <xsl:template match="text()"/>
43
44   <xsl:template match="//tp:errors">/* Generated from the Telepathy spec
45
46 <xsl:for-each select="tp:copyright">
47 <xsl:value-of select="."/><xsl:text>
48 </xsl:text></xsl:for-each><xsl:text>
49 </xsl:text><xsl:value-of select="tp:license"/>
50 */
51
52 #include &lt;_gen/telepathy-errors.h&gt;
53
54 GType
55 tp_error_get_type (void)
56 {
57   static GType etype = 0;
58   if (G_UNLIKELY (etype == 0))
59     {
60       static const GEnumValue values[] = {
61 <xsl:apply-templates select="tp:error" mode="values"/>      };
62
63       etype = g_enum_register_static ("TpError", values);
64     }
65   return etype;
66 }
67
68 </xsl:template>
69
70 </xsl:stylesheet>
71
72 <!-- vim:set sw=2 sts=2 et noai noci: -->