Commit abb968c6 authored by Xavier Claessens's avatar Xavier Claessens

Update tools to latest version of tp-glib and include a gitignore

svn path=/trunk/; revision=1883
parent 52bc7715
......@@ -86,27 +86,16 @@ _gen/register-dbus-glib-marshallers-body.h: _gen/all.xml \
$(PYTHON) $(tools_dir)/glib-client-marshaller-gen.py $< \
_emp_ext > $@
_gen/enums.h: _gen/all.xml $(tools_dir)/c-constants-generator.xsl
$(XSLTPROC) $(XSLTPROCFLAGS) \
--stringparam mixed-case-prefix Emp \
$(tools_dir)/c-constants-generator.xsl \
$< > $@
_gen/interfaces.h: _gen/all.xml \
$(tools_dir)/glib-interfaces-generator.xsl \
$(tools_dir)/c-interfaces-generator.xsl
$(XSLTPROC) $(XSLTPROCFLAGS) \
--stringparam mixed-case-prefix Emp \
$(tools_dir)/glib-interfaces-generator.xsl \
_gen/enums.h: _gen/all.xml \
$(tools_dir)/c-constants-gen.py
$(PYTHON) $(tools_dir)/c-constants-gen.py \
Emp \
$< > $@
_gen/interfaces-body.h: _gen/all.xml \
$(tools_dir)/glib-interfaces-body-generator.xsl \
$(tools_dir)/c-interfaces-generator.xsl
$(XSLTPROC) $(XSLTPROCFLAGS) \
--stringparam mixed-case-prefix Emp \
$(tools_dir)/glib-interfaces-body-generator.xsl \
$< > $@
_gen/interfaces-body.h _gen/interfaces.h: _gen/all.xml \
$(tools_dir)/glib-interfaces-gen.py
$(PYTHON) $(tools_dir)/glib-interfaces-gen.py \
Emp _gen/interfaces-body.h _gen/interfaces.h $<
# Generated files which must be generated per "category". Each TpProxy
# subclass you want to use with --subclass will need to have its own category,
......
.py[co]
_gen
extensions.html
telepathy-glib-env
......@@ -7,41 +7,50 @@ telepathy-glib-env: telepathy-glib-env.in Makefile
chmod +x $@
EXTRA_DIST = \
c-constants-generator.xsl \
c-constants-gen.py \
check-coding-style.mk \
check-c-style.sh \
check-misc.sh \
check-whitespace.sh \
c-interfaces-generator.xsl \
doc-generator.xsl \
glib-client-gen.py \
glib-client-marshaller-gen.py \
glib-errors-enum-body.xsl \
glib-errors-enum-header.xsl \
glib-interfaces-generator.xsl \
glib-interfaces-body-generator.xsl \
glib-errors-enum-body-gen.py \
glib-errors-enum-header-gen.py \
glib-ginterface-gen.py \
glib-gtypes-generator.py \
glib-interfaces-gen.py \
glib-signals-marshal-gen.py \
gobject-foo.py \
identity.xsl \
lcov.am \
libtpcodegen.py \
libglibcodegen.py \
ls-interfaces.xsl \
make-all-async.xsl \
spec-to-introspect.xsl \
make-version-script.py \
telepathy.am \
telepathy-glib-env.in \
with-session-bus.sh
CLEANFILES = libglibcodegen.pyc libglibcodegen.pyo $(noinst_SCRIPTS)
CLEANFILES = libtpcodegen.pyc libtpcodegen.pyo libglibcodegen.pyc libglibcodegen.pyo $(noinst_SCRIPTS)
all: $(EXTRA_DIST)
libglibcodegen.py: libtpcodegen.py
touch $@
c-constants-gen.py: libglibcodegen.py
touch $@
glib-client-marshaller-gen.py: libglibcodegen.py
touch $@
glib-errors-enum-body-gen.py: libglibcodegen.py
touch $@
glib-errors-enum-header-gen.py: libglibcodegen.py
touch $@
glib-ginterface-gen.py: libglibcodegen.py
touch $@
glib-gtypes-generator.py: libglibcodegen.py
touch $@
glib-interfaces-gen.py: libglibcodegen.py
touch $@
glib-signals-marshal-gen.py: libglibcodegen.py
touch $@
......
#!/usr/bin/python
from sys import argv, stdout, stderr
import xml.dom.minidom
from libglibcodegen import NS_TP, camelcase_to_upper, get_docstring, \
get_descendant_text, get_by_path
class Generator(object):
def __init__(self, prefix, dom):
self.prefix = prefix + '_'
self.spec = get_by_path(dom, "spec")[0]
def __call__(self):
self.do_header()
self.do_body()
self.do_footer()
# Header
def do_header(self):
stdout.write('/* Generated from ')
stdout.write(get_descendant_text(get_by_path(self.spec, 'title')))
version = get_by_path(self.spec, "version")
if version:
stdout.write(', version ' + get_descendant_text(version))
stdout.write('\n\n')
for copyright in get_by_path(self.spec, 'copyright'):
stdout.write(get_descendant_text(copyright))
stdout.write('\n')
stdout.write(get_descendant_text(get_by_path(self.spec, 'license')))
stdout.write('\n')
stdout.write(get_descendant_text(get_by_path(self.spec, 'docstring')))
stdout.write("""
*/
#ifdef __cplusplus
extern "C" {
#endif
\n""")
# Body
def do_body(self):
for elem in self.spec.getElementsByTagNameNS(NS_TP, '*'):
if elem.localName == 'flags':
self.do_flags(elem)
elif elem.localName == 'enum':
self.do_enum(elem)
def do_flags(self, flags):
name = flags.getAttribute('plural') or flags.getAttribute('name')
value_prefix = flags.getAttribute('singular') or \
flags.getAttribute('value-prefix') or \
flags.getAttribute('name')
stdout.write("""\
/**
*
%s:
""" % (self.prefix + name).replace('_', ''))
for flag in get_by_path(flags, 'flag'):
self.do_gtkdoc(flag, value_prefix)
stdout.write(' *\n')
docstrings = get_by_path(flags, 'docstring')
if docstrings:
stdout.write("""\
* <![CDATA[%s]]>
*
""" % get_descendant_text(docstrings).replace('\n', ' '))
stdout.write("""\
* Bitfield/set of flags generated from the Telepathy specification.
*/
typedef enum {
""")
for flag in get_by_path(flags, 'flag'):
self.do_val(flag, value_prefix)
stdout.write("""\
} %s;
""" % (self.prefix + name).replace('_', ''))
def do_enum(self, enum):
name = enum.getAttribute('singular') or enum.getAttribute('name')
value_prefix = enum.getAttribute('singular') or \
enum.getAttribute('value-prefix') or \
enum.getAttribute('name')
name_plural = enum.getAttribute('plural') or \
enum.getAttribute('name') + 's'
stdout.write("""\
/**
*
%s:
""" % (self.prefix + name).replace('_', ''))
vals = get_by_path(enum, 'enumvalue')
for val in vals:
self.do_gtkdoc(val, value_prefix)
stdout.write(' *\n')
docstrings = get_by_path(enum, 'docstring')
if docstrings:
stdout.write("""\
* <![CDATA[%s]]>
*
""" % get_descendant_text(docstrings).replace('\n', ' '))
stdout.write("""\
* Bitfield/set of flags generated from the Telepathy specification.
*/
typedef enum {
""")
for val in vals:
self.do_val(val, value_prefix)
stdout.write("""\
} %(mixed-name)s;
/**
* NUM_%(upper-plural)s:
*
* 1 higher than the highest valid value of #%(mixed-name)s.
*/
#define NUM_%(upper-plural)s (%(last-val)s+1)
""" % {'mixed-name' : (self.prefix + name).replace('_', ''),
'upper-plural' : (self.prefix + name_plural).upper(),
'last-val' : vals[-1].getAttribute('value')})
def do_val(self, val, value_prefix):
name = val.getAttribute('name')
suffix = val.getAttribute('suffix')
use_name = (self.prefix + value_prefix + '_' + \
(suffix or name)).upper()
assert not (name and suffix) or name == suffix, \
'Flag/enumvalue name %s != suffix %s' % (name, suffix)
stdout.write(' %s = %s,\n' % (use_name, val.getAttribute('value')))
def do_gtkdoc(self, node, value_prefix):
stdout.write(' * @')
stdout.write((self.prefix + value_prefix + '_' +
node.getAttribute('suffix')).upper())
stdout.write(': <![CDATA[')
docstring = get_by_path(node, 'docstring')
stdout.write(get_descendant_text(docstring).replace('\n', ' '))
stdout.write(']]>\n')
# Footer
def do_footer(self):
stdout.write("""
#ifdef __cplusplus
}
#endif
""")
if __name__ == '__main__':
argv = argv[1:]
Generator(argv[0], xml.dom.minidom.parse(argv[1]))()
<!-- Stylesheet to extract C enumerations from the Telepathy spec.
The master copy of this stylesheet is in telepathy-glib - please make any
changes there.
Copyright (C) 2006, 2007 Collabora Limited
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<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:param name="mixed-case-prefix" select="''"/>
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="upper-case-prefix" select="concat(translate($mixed-case-prefix, $lower, $upper), '_')"/>
<xsl:variable name="lower-case-prefix" select="concat(translate($mixed-case-prefix, $upper, $lower), '_')"/>
<xsl:template match="tp:flags">
<xsl:variable name="name">
<xsl:choose>
<xsl:when test="@plural">
<xsl:value-of select="@plural"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="value-prefix">
<xsl:choose>
<xsl:when test="@singular">
<xsl:value-of select="@singular"/>
</xsl:when>
<xsl:when test="@value-prefix">
<xsl:value-of select="@value-prefix"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:text>/**&#10;</xsl:text>
<xsl:text> *&#10;</xsl:text>
<xsl:value-of select="translate(concat($mixed-case-prefix, $name), '_', '')"/>
<xsl:text>:&#10;</xsl:text>
<xsl:apply-templates mode="flag-or-enumvalue-gtkdoc">
<xsl:with-param name="value-prefix" select="$value-prefix"/>
</xsl:apply-templates>
<xsl:text> *&#10;</xsl:text>
<xsl:if test="tp:docstring">
<xsl:text> * &lt;![CDATA[</xsl:text>
<xsl:value-of select="translate(string (tp:docstring), '&#13;&#10;', ' ')"/>
<xsl:text>]]&gt;&#10;</xsl:text>
<xsl:text> *&#10;</xsl:text>
</xsl:if>
<xsl:text> * Bitfield/set of flags generated from the Telepathy specification.&#10;</xsl:text>
<xsl:text> */&#10;</xsl:text>
<xsl:text>typedef enum {&#10;</xsl:text>
<xsl:apply-templates>
<xsl:with-param name="value-prefix" select="$value-prefix"/>
</xsl:apply-templates>
<xsl:text>} </xsl:text>
<xsl:value-of select="translate(concat($mixed-case-prefix, $name), '_', '')"/>
<xsl:text>;&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="text()" mode="flag-or-enumvalue-gtkdoc"/>
<xsl:template match="tp:enumvalue" mode="flag-or-enumvalue-gtkdoc">
<xsl:param name="value-prefix"/>
<xsl:text> * @</xsl:text>
<xsl:value-of select="translate(concat($upper-case-prefix, $value-prefix, '_', @suffix), $lower, $upper)"/>
<xsl:text>: &lt;![CDATA[</xsl:text>
<xsl:value-of select="translate(string(tp:docstring), '&#13;&#10;', ' ')"/>
<xsl:text>]]&gt;&#10;</xsl:text>
</xsl:template>
<xsl:template match="tp:flag" mode="flag-or-enumvalue-gtkdoc">
<xsl:param name="value-prefix"/>
<xsl:text> * @</xsl:text>
<xsl:value-of select="translate(concat($upper-case-prefix, $value-prefix, '_', @suffix), $lower, $upper)"/>
<xsl:text>: &lt;![CDATA[</xsl:text>
<xsl:value-of select="translate(string(tp:docstring), '&#13;&#10;', ' ')"/>
<xsl:text>]]&gt;&#10;</xsl:text>
</xsl:template>
<xsl:template match="tp:enum">
<xsl:variable name="name">
<xsl:choose>
<xsl:when test="@singular">
<xsl:value-of select="@singular"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="value-prefix">
<xsl:choose>
<xsl:when test="@singular">
<xsl:value-of select="@singular"/>
</xsl:when>
<xsl:when test="@value-prefix">
<xsl:value-of select="@value-prefix"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="name-plural">
<xsl:choose>
<xsl:when test="@plural">
<xsl:value-of select="@plural"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/><xsl:text>s</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:text>/**&#10;</xsl:text>
<xsl:text> *&#10;</xsl:text>
<xsl:value-of select="translate(concat($mixed-case-prefix, $name), '_', '')"/>
<xsl:text>:&#10;</xsl:text>
<xsl:apply-templates mode="flag-or-enumvalue-gtkdoc">
<xsl:with-param name="value-prefix" select="$value-prefix"/>
</xsl:apply-templates>
<xsl:text> *&#10;</xsl:text>
<xsl:if test="tp:docstring">
<xsl:text> * &lt;![CDATA[</xsl:text>
<xsl:value-of select="translate(string (tp:docstring), '&#13;&#10;', ' ')"/>
<xsl:text>]]&gt;&#10;</xsl:text>
<xsl:text> *&#10;</xsl:text>
</xsl:if>
<xsl:text> * Bitfield/set of flags generated from the Telepathy specification.&#10;</xsl:text>
<xsl:text> */&#10;</xsl:text>
<xsl:text>typedef enum {&#10;</xsl:text>
<xsl:apply-templates>
<xsl:with-param name="value-prefix" select="$value-prefix"/>
</xsl:apply-templates>
<xsl:text>} </xsl:text>
<xsl:value-of select="translate(concat($mixed-case-prefix, $name), '_', '')"/>
<xsl:text>;&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:text>/**&#10;</xsl:text>
<xsl:text> * NUM_</xsl:text>
<xsl:value-of select="translate(concat($upper-case-prefix, $name-plural), $lower, $upper)"/>
<xsl:text>:&#10;</xsl:text>
<xsl:text> *&#10;</xsl:text>
<xsl:text> * 1 higher than the highest valid value of #</xsl:text>
<xsl:value-of select="translate(concat($mixed-case-prefix, $name), '_', '')"/>
<xsl:text>.&#10;</xsl:text>
<xsl:text> */&#10;</xsl:text>
<xsl:text>#define NUM_</xsl:text>
<xsl:value-of select="translate(concat($upper-case-prefix, $name-plural), $lower, $upper)"/>
<xsl:text> (</xsl:text>
<xsl:value-of select="tp:enumvalue[position() = last()]/@value"/>
<xsl:text>+1)&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="tp:flags/tp:flag">
<xsl:param name="value-prefix"/>
<xsl:variable name="suffix">
<xsl:choose>
<xsl:when test="@suffix">
<xsl:value-of select="@suffix"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="name" select="translate(concat($upper-case-prefix, $value-prefix, '_', $suffix), $lower, $upper)"/>
<xsl:if test="@name and @suffix and @name != @suffix">
<xsl:message terminate="yes">
<xsl:text>Flag name </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> != suffix </xsl:text>
<xsl:value-of select="@suffix"/>
<xsl:text>&#10;</xsl:text>
</xsl:message>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:value-of select="$name"/>
<xsl:text> = </xsl:text>
<xsl:value-of select="@value"/>
<xsl:text>,&#10;</xsl:text>
</xsl:template>
<xsl:template match="tp:enum/tp:enumvalue">
<xsl:param name="value-prefix"/>
<xsl:variable name="suffix">
<xsl:choose>
<xsl:when test="@suffix">
<xsl:value-of select="@suffix"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="name" select="translate(concat($upper-case-prefix, $value-prefix, '_', $suffix), $lower, $upper)"/>
<xsl:if test="@name and @suffix and @name != @suffix">
<xsl:message terminate="yes">
<xsl:text>Enumvalue name </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> != suffix </xsl:text>
<xsl:value-of select="@suffix"/>
<xsl:text>&#10;</xsl:text>
</xsl:message>
</xsl:if>
<xsl:if test="preceding-sibling::tp:enumvalue and number(preceding-sibling::tp:enumvalue[1]/@value) > number(@value)">
<xsl:message terminate="yes">
<xsl:text>Enum values must be in ascending numeric order, but </xsl:text>
<xsl:value-of select="$name"/>
<xsl:text> is less than the previous value</xsl:text>
</xsl:message>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:value-of select="$name"/>
<xsl:text> = </xsl:text>
<xsl:value-of select="@value"/>
<xsl:text>,&#10;</xsl:text>
</xsl:template>
<xsl:template match="tp:flag">
<xsl:message terminate="yes">tp:flag found outside tp:flags&#10;</xsl:message>
</xsl:template>
<xsl:template match="tp:enumvalue">
<xsl:message terminate="yes">tp:enumvalue found outside tp:enum&#10;</xsl:message>
</xsl:template>
<xsl:template match="text()"/>
<xsl:template match="/tp:spec">
<xsl:if test="$mixed-case-prefix = ''">
<xsl:message terminate="yes">
<xsl:text>mixed-case-prefix param must be set&#10;</xsl:text>
</xsl:message>
</xsl:if>
<xsl:text>/* Generated from </xsl:text>
<xsl:value-of select="tp:title"/>
<xsl:if test="tp:version">
<xsl:text>, version </xsl:text>
<xsl:value-of select="tp:version"/>
</xsl:if>
<xsl:text>&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:for-each select="tp:copyright">
<xsl:value-of select="."/>
<xsl:text>&#10;</xsl:text>
</xsl:for-each>
<xsl:value-of select="tp:license"/>
<xsl:text>&#10;</xsl:text>
<xsl:value-of select="tp:docstring"/>
<xsl:text>&#10;</xsl:text>
<xsl:text> */&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:text>#ifdef __cplusplus&#10;</xsl:text>
<xsl:text>extern "C" {&#10;</xsl:text>
<xsl:text>#endif&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&#10;</xsl:text>
<xsl:text>#ifdef __cplusplus&#10;</xsl:text>
<xsl:text>}&#10;</xsl:text>
<xsl:text>#endif&#10;</xsl:text>
</xsl:template>
</xsl:stylesheet>
<!-- vim:set sw=2 sts=2 et noai noci: -->
<!-- Stylesheet to extract C enumerations from the Telepathy spec.
The master copy of this stylesheet is in telepathy-glib - please make any
changes there.
Copyright (C) 2006, 2007 Collabora Limited
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<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:param name="mixed-case-prefix" select="''"/>
<xsl:variable name="PREFIX"
select="translate($mixed-case-prefix, $lower, $upper)"/>
<xsl:variable name="Prefix" select="$mixed-case-prefix"/>
<xsl:variable name="prefix"
select="translate($mixed-case-prefix, $upper, $lower)"/>
<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; * </xsl:text>
<xsl:value-of select="$PREFIX"/>
<xsl:text>_IFACE_</xsl:text>
<xsl:value-of select="translate(../@name, concat($lower, '/'), $upper)"/>
<xsl:text>:&#10; * &#10; * The interface name "</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>"&#10; */&#10;#define </xsl:text>
<xsl:value-of select="$PREFIX"/>
<xsl:text>_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">
<xsl:if test="$mixed-case-prefix = ''">
<xsl:message terminate="yes">
<xsl:text>mixed-case-prefix param must be set&#10;</xsl:text>
</xsl:message>
</xsl:if>
<xsl:text>/* Generated from: </xsl:text>
<xsl:value-of select="tp:title"/>
<xsl:if test="tp:version">
<xsl:text> version </xsl:text>
<xsl:value-of select="tp:version"/>
</xsl:if>
<xsl:text>&#10;&#10;</xsl:text>
<xsl:for-each select="tp:copyright">
<xsl:value-of select="."/>
<xsl:text>&#10;</xsl:text>
</xsl:for-each>
<xsl:text>&#10;</xsl:text>
<xsl:value-of select="tp:license"/>
<xsl:value-of select="tp:docstring"/>
<xsl:text>&#10; */&#10;&#10;</xsl:text>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
<!-- vim:set sw=2 sts=2 et noai noci: -->
......@@ -24,6 +24,26 @@ then
fail=1
fi
if grep -En '[(][[:alnum:]_]+ ?\*[)][(]?[[:alpha:]_]' "$@"; then
echo "^^^ Our coding style is to have a space between a cast and the "
echo " thing being cast"
fail=1
fi
# this only spots casts
if grep -En '[(][[:alnum:]_]+\*+[)]' "$@"; then
echo "^^^ Our coding style is to have a space before the * of pointer types"
echo " (regex 1)"
fail=1
fi
# ... and this only spots variable declarations and function return types
if grep -En '^ *(static |const |)* *[[:alnum:]_]+\*+([[:alnum:]_]|;|$)' \
"$@"; then
echo "^^^ Our coding style is to have a space before the * of pointer types"
echo " (regex 2)"
fail=1
fi
if test -n "$CHECK_FOR_LONG_LINES"
then
if egrep -n '.{80,}' "$@"
......
check-local::
check-coding-style:
@fail=0; \
if test -n "$(check_misc_sources)"; then \
tools_dir=$(top_srcdir)/tools \
......
This diff is collapsed.
......@@ -57,9 +57,13 @@ class Generator(object):
self.proxy_arg = 'gpointer '
def h(self, s):
if isinstance(s, unicode):
s = s.encode('utf-8')
self.__header.append(s)
def b(self, s):
if isinstance(s, unicode):
s = s.encode('utf-8')
self.__body.append(s)
def get_iface_quark(self):
......@@ -656,13 +660,18 @@ class Generator(object):
self.b(' * @%s: Used to pass an \'in\' argument: %s'
% (name, xml_escape(get_docstring(elt) or '(Undocumented)')))
self.b(' * @callback: called when the method call succeeds or fails')
self.b(' * @user_data: user-supplied data passed to the callback')
self.b(' * @callback: called when the method call succeeds or fails;')
self.b(' * may be %NULL to make a "fire and forget" call with no ')
self.b(' * reply tracking')
self.b(' * @user_data: user-supplied data passed to the callback;')
self.b(' * must be %NULL if @callback is %NULL')
self.b(' * @destroy: called with the user_data as argument, after the')
self.b(' * call has succeeded, failed or been cancelled')
self.b(' * @weak_object: A #GObject which will be weakly referenced; ')
self.b(' * if it is destroyed, this callback will automatically be')
self.b(' * disconnected')
self.b(' * call has succeeded, failed or been cancelled;')
self.b(' * must be %NULL if @callback is %NULL')
self.b(' * @weak_object: If not %NULL, a #GObject which will be ')
self.b(' * weakly referenced; if it is destroyed, this call ')
self.b(' * will automatically be cancelled. Must be %NULL if ')
self.b(' * @callback is %NULL')
self.b(' *')
self.b(' * Start a %s method call.' % member)
self.b(' *')
......@@ -703,6 +712,12 @@ class Generator(object):
self.b('')
self.b(' g_return_val_if_fail (%s (proxy), NULL);'
% self.proxy_assert)
self.b(' g_return_val_if_fail (callback != NULL || '
'user_data == NULL, NULL);')
self.b(' g_return_val_if_fail (callback != NULL || '
'destroy == NULL, NULL);')
self.b(' g_return_val_if_fail (callback != NULL || '
'weak_object == NULL, NULL);')
self.b('')
self.b(' iface = tp_proxy_borrow_interface_by_id (')
self.b(' (TpProxy *) proxy,')
......@@ -723,6 +738,10 @@ class Generator(object):
self.b(' 0,')
self.b(' error, user_data, weak_object);')