Update tools from telepathy-glib

parent 9503c4aa
......@@ -59,10 +59,9 @@ XSLTPROCFLAGS = --nonet --novalid
# Generated files which can be generated for all categories simultaneously
_gen/all.xml: all.xml $(wildcard *.xml)
_gen/all.xml: all.xml $(wildcard *.xml) $(tools_dir)/xincludator.py
@$(mkdir_p) _gen
$(AM_V_GEN)$(XSLTPROC) $(XSLTPROCFLAGS) --xinclude $(tools_dir)/identity.xsl \
$< > $@
$(AM_V_GEN)$(PYTHON) $(tools_dir)/xincludator.py $< > $@
extensions.html: _gen/all.xml $(tools_dir)/doc-generator.xsl
$(AM_V_GEN)$(XSLTPROC) $(XSLTPROCFLAGS) \
......@@ -95,7 +94,7 @@ _gen/enums.h: _gen/all.xml \
$(tools_dir)/c-constants-gen.py
$(AM_V_GEN)$(PYTHON) $(tools_dir)/c-constants-gen.py \
Emp \
$< > $@
$< _gen/enums
_gen/interfaces-body.h _gen/interfaces.h: _gen/all.xml \
$(tools_dir)/glib-interfaces-gen.py
......@@ -106,10 +105,9 @@ _gen/interfaces-body.h _gen/interfaces.h: _gen/all.xml \
# subclass you want to use with --subclass will need to have its own category,
# although you can subdivide further if you want.
_gen/misc.xml: misc.xml $(wildcard *.xml)
_gen/misc.xml: misc.xml $(wildcard *.xml) $(tools_dir)/xincludator.py
@$(mkdir_p) _gen
$(AM_V_GEN)$(XSLTPROC) $(XSLTPROCFLAGS) --xinclude $(tools_dir)/identity.xsl \
$< > $@
$(AM_V_GEN)$(PYTHON) $(tools_dir)/xincludator.py $< > $@
_gen/cli-misc-body.h _gen/cli-misc.h: _gen/misc.xml \
$(tools_dir)/glib-client-gen.py
......
......@@ -14,23 +14,29 @@ EXTRA_DIST = \
check-whitespace.sh \
doc-generator.xsl \
flymake.mk \
git-which-branch.sh \
glib-client-gen.py \
glib-client-marshaller-gen.py \
glib-errors-enum-body-gen.py \
glib-errors-enum-header-gen.py \
glib-errors-check-gen.py \
glib-errors-str-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 \
make-release-mail.py \
make-version-script.py \
manager-file.py \
shave.mk \
telepathy.am \
telepathy-glib.supp \
telepathy-glib-env.in \
with-session-bus.sh
test-wrapper.sh \
with-session-bus.sh \
xincludator.py
CLEANFILES = libtpcodegen.pyc libtpcodegen.pyo libglibcodegen.pyc libglibcodegen.pyo $(noinst_SCRIPTS)
......
......@@ -3,34 +3,43 @@
from sys import argv, stdout, stderr
import xml.dom.minidom
from libglibcodegen import NS_TP, camelcase_to_upper, get_docstring, \
from libglibcodegen import NS_TP, get_docstring, \
get_descendant_text, get_by_path
class Generator(object):
def __init__(self, prefix, dom):
def __init__(self, prefix, dom, output_base):
self.prefix = prefix + '_'
self.spec = get_by_path(dom, "spec")[0]
self.__header = open(output_base + '.h', 'w')
self.__docs = open(output_base + '-gtk-doc.h', 'w')
def __call__(self):
self.do_header()
self.do_body()
self.do_footer()
def write(self, code):
self.__header.write(code.encode('utf-8'))
def d(self, code):
self.__docs.write(code.encode('utf-8'))
# Header
def do_header(self):
stdout.write('/* Generated from ')
stdout.write(get_descendant_text(get_by_path(self.spec, 'title')))
self.write('/* Generated from ')
self.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')
self.write(', version ' + get_descendant_text(version))
self.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("""
self.write(get_descendant_text(copyright))
self.write('\n')
self.write(get_descendant_text(get_by_path(self.spec, 'license')))
self.write('\n')
self.write(get_descendant_text(get_by_path(self.spec, 'docstring')))
self.write("""
*/
#ifdef __cplusplus
......@@ -51,28 +60,30 @@ extern "C" {
value_prefix = flags.getAttribute('singular') or \
flags.getAttribute('value-prefix') or \
flags.getAttribute('name')
stdout.write("""\
self.d("""\
/**
*
%s:
""" % (self.prefix + name).replace('_', ''))
for flag in get_by_path(flags, 'flag'):
self.do_gtkdoc(flag, value_prefix)
stdout.write(' *\n')
self.d(' *\n')
docstrings = get_by_path(flags, 'docstring')
if docstrings:
stdout.write("""\
self.d("""\
* <![CDATA[%s]]>
*
""" % get_descendant_text(docstrings).replace('\n', ' '))
stdout.write("""\
self.d("""\
* Bitfield/set of flags generated from the Telepathy specification.
*/
typedef enum {
""")
self.write("typedef enum /*< flags >*/ {\n")
for flag in get_by_path(flags, 'flag'):
self.do_val(flag, value_prefix)
stdout.write("""\
self.write("""\
} %s;
""" % (self.prefix + name).replace('_', ''))
......@@ -84,7 +95,7 @@ typedef enum {
enum.getAttribute('name')
name_plural = enum.getAttribute('plural') or \
enum.getAttribute('name') + 's'
stdout.write("""\
self.d("""\
/**
*
%s:
......@@ -92,28 +103,35 @@ typedef enum {
vals = get_by_path(enum, 'enumvalue')
for val in vals:
self.do_gtkdoc(val, value_prefix)
stdout.write(' *\n')
self.d(' *\n')
docstrings = get_by_path(enum, 'docstring')
if docstrings:
stdout.write("""\
self.d("""\
* <![CDATA[%s]]>
*
""" % get_descendant_text(docstrings).replace('\n', ' '))
stdout.write("""\
self.d("""\
* Bitfield/set of flags generated from the Telepathy specification.
*/
typedef enum {
""")
self.write("typedef enum {\n")
for val in vals:
self.do_val(val, value_prefix)
stdout.write("""\
} %(mixed-name)s;
self.write("} %s;\n" % (self.prefix + name).replace('_', ''))
self.d("""\
/**
* NUM_%(upper-plural)s:
*
* 1 higher than the highest valid value of #%(mixed-name)s.
*/
""" % {'mixed-name' : (self.prefix + name).replace('_', ''),
'upper-plural' : (self.prefix + name_plural).upper(),
'last-val' : vals[-1].getAttribute('value')})
self.write("""\
#define NUM_%(upper-plural)s (%(last-val)s+1)
""" % {'mixed-name' : (self.prefix + name).replace('_', ''),
......@@ -127,20 +145,20 @@ typedef enum {
(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')))
self.write(' %s = %s,\n' % (use_name, val.getAttribute('value')))
def do_gtkdoc(self, node, value_prefix):
stdout.write(' * @')
stdout.write((self.prefix + value_prefix + '_' +
self.d(' * @')
self.d((self.prefix + value_prefix + '_' +
node.getAttribute('suffix')).upper())
stdout.write(': <![CDATA[')
self.d(': <![CDATA[')
docstring = get_by_path(node, 'docstring')
stdout.write(get_descendant_text(docstring).replace('\n', ' '))
stdout.write(']]>\n')
self.d(get_descendant_text(docstring).replace('\n', ' '))
self.d(']]>\n')
# Footer
def do_footer(self):
stdout.write("""
self.write("""
#ifdef __cplusplus
}
#endif
......@@ -148,4 +166,4 @@ typedef enum {
if __name__ == '__main__':
argv = argv[1:]
Generator(argv[0], xml.dom.minidom.parse(argv[1]))()
Generator(argv[0], xml.dom.minidom.parse(argv[1]), argv[2])()
......@@ -3,12 +3,12 @@ check-coding-style:
if test -n "$(check_misc_sources)"; then \
tools_dir=$(top_srcdir)/tools \
sh $(top_srcdir)/tools/check-misc.sh \
$(check_misc_sources) || fail=1; \
$(addprefix $(srcdir)/,$(check_misc_sources)) || fail=1; \
fi; \
if test -n "$(check_c_sources)"; then \
tools_dir=$(top_srcdir)/tools \
sh $(top_srcdir)/tools/check-c-style.sh \
$(check_c_sources) || fail=1; \
$(addprefix $(srcdir)/,$(check_c_sources)) || fail=1; \
fi;\
if test yes = "$(ENABLE_CODING_STYLE_CHECKS)"; then \
exit "$$fail";\
......
#!/bin/sh
# git-which-branch.sh - output the name of the current git branch
#
# The canonical location of this program is the telepathy-spec tools/
# directory, please synchronize any changes with that copy.
#
# Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
default="$1"
if { ref="`git symbolic-ref HEAD 2>/dev/null`"; }; then
echo ${ref#refs/heads/}
exit 0
fi
if test -n "$default"; then
echo "$default" >/dev/null
exit 0
fi
echo "no git branch found" >&2
exit 1
......@@ -28,7 +28,7 @@ import xml.dom.minidom
from getopt import gnu_getopt
from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \
camelcase_to_lower, get_docstring, xml_escape
get_docstring, xml_escape, get_deprecated
NS_TP = "http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
......@@ -39,6 +39,7 @@ class Generator(object):
self.dom = dom
self.__header = []
self.__body = []
self.__docs = []
self.prefix_lc = prefix.lower()
self.prefix_uc = prefix.upper()
......@@ -55,6 +56,11 @@ class Generator(object):
% opts.get('--subclass', 'TpProxy'))
if self.proxy_arg == 'void *':
self.proxy_arg = 'gpointer '
self.generate_reentrant = ('--generate-reentrant' in opts or
'--deprecate-reentrant' in opts)
self.deprecate_reentrant = opts.get('--deprecate-reentrant', None)
self.deprecation_attribute = opts.get('--deprecation-attribute',
'G_GNUC_DEPRECATED')
def h(self, s):
if isinstance(s, unicode):
......@@ -66,6 +72,11 @@ class Generator(object):
s = s.encode('utf-8')
self.__body.append(s)
def d(self, s):
if isinstance(s, unicode):
s = s.encode('utf-8')
self.__docs.append(s)
def get_iface_quark(self):
assert self.iface_dbus is not None
assert self.iface_uc is not None
......@@ -78,7 +89,11 @@ class Generator(object):
iface_lc = iface.lower()
member = signal.getAttribute('name')
member_lc = camelcase_to_lower(member)
member_lc = signal.getAttribute('tp:name-for-bindings')
if member != member_lc.replace('_', ''):
raise AssertionError('Signal %s tp:name-for-bindings (%s) does '
'not match' % (member, member_lc))
member_lc = member_lc.lower()
member_uc = member_lc.upper()
arg_count = 0
......@@ -114,25 +129,27 @@ class Generator(object):
# guint arg_handle, gboolean arg_suppress_handler,
# gpointer user_data, GObject *weak_object);
self.b('/**')
self.b(' * %s:' % callback_name)
self.b(' * @proxy: The proxy on which %s_%s_connect_to_%s ()'
self.d('/**')
self.d(' * %s:' % callback_name)
self.d(' * @proxy: The proxy on which %s_%s_connect_to_%s ()'
% (self.prefix_lc, iface_lc, member_lc))
self.b(' * was called')
self.d(' * was called')
for arg in args:
name, info, tp_type, elt = arg
ctype, gtype, marshaller, pointer = info
self.b(' * @%s: %s' % (name,
self.d(' * @%s: %s' % (name,
xml_escape(get_docstring(elt) or '(Undocumented)')))
self.b(' * @user_data: User-supplied data')
self.b(' * @weak_object: User-supplied weakly referenced object')
self.b(' *')
self.b(' * Represents the signature of a callback for the signal %s.'
self.d(' * @user_data: User-supplied data')
self.d(' * @weak_object: User-supplied weakly referenced object')
self.d(' *')
self.d(' * Represents the signature of a callback for the signal %s.'
% member)
self.b(' */')
self.d(' */')
self.d('')
self.h('typedef void (*%s) (%sproxy,'
% (callback_name, self.proxy_cls))
......@@ -281,31 +298,33 @@ class Generator(object):
# emitted the 'invalidated' signal, or because the weakly referenced
# object has gone away.
self.b('/**')
self.b(' * %s_%s_connect_to_%s:'
self.d('/**')
self.d(' * %s_%s_connect_to_%s:'
% (self.prefix_lc, iface_lc, member_lc))
self.b(' * @proxy: %s' % self.proxy_doc)
self.b(' * @callback: Callback to be called when the signal is')
self.b(' * received')
self.b(' * @user_data: User-supplied data for the callback')
self.b(' * @destroy: Destructor for the user-supplied data, which')
self.b(' * will be called when this signal is disconnected, or')
self.b(' * before this function returns %NULL')
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(' * @error: If not %NULL, used to raise an error if %NULL is')
self.b(' * returned')
self.b(' *')
self.b(' * Connect a handler to the signal %s.' % member)
self.b(' *')
self.b(' * %s' % xml_escape(get_docstring(signal) or '(Undocumented)'))
self.b(' *')
self.b(' * Returns: a #TpProxySignalConnection containing all of the')
self.b(' * above, which can be used to disconnect the signal; or')
self.b(' * %NULL if the proxy does not have the desired interface')
self.b(' * or has become invalid.')
self.b(' */')
self.d(' * @proxy: %s' % self.proxy_doc)
self.d(' * @callback: Callback to be called when the signal is')
self.d(' * received')
self.d(' * @user_data: User-supplied data for the callback')
self.d(' * @destroy: Destructor for the user-supplied data, which')
self.d(' * will be called when this signal is disconnected, or')
self.d(' * before this function returns %NULL')
self.d(' * @weak_object: A #GObject which will be weakly referenced; ')
self.d(' * if it is destroyed, this callback will automatically be')
self.d(' * disconnected')
self.d(' * @error: If not %NULL, used to raise an error if %NULL is')
self.d(' * returned')
self.d(' *')
self.d(' * Connect a handler to the signal %s.' % member)
self.d(' *')
self.d(' * %s' % xml_escape(get_docstring(signal) or '(Undocumented)'))
self.d(' *')
self.d(' * Returns: a #TpProxySignalConnection containing all of the')
self.d(' * above, which can be used to disconnect the signal; or')
self.d(' * %NULL if the proxy does not have the desired interface')
self.d(' * or has become invalid.')
self.d(' */')
self.d('')
self.h('TpProxySignalConnection *%s_%s_connect_to_%s (%sproxy,'
% (self.prefix_lc, iface_lc, member_lc, self.proxy_arg))
self.h(' %s callback,' % callback_name)
......@@ -313,6 +332,7 @@ class Generator(object):
self.h(' GDestroyNotify destroy,')
self.h(' GObject *weak_object,')
self.h(' GError **error);')
self.h('')
self.b('TpProxySignalConnection *')
self.b('%s_%s_connect_to_%s (%sproxy,'
......@@ -352,13 +372,15 @@ class Generator(object):
self.b('}')
self.b('')
self.h('')
def do_method(self, iface, method):
iface_lc = iface.lower()
member = method.getAttribute('name')
member_lc = camelcase_to_lower(member)
member_lc = method.getAttribute('tp:name-for-bindings')
if member != member_lc.replace('_', ''):
raise AssertionError('Method %s tp:name-for-bindings (%s) does '
'not match' % (member, member_lc))
member_lc = member_lc.lower()
member_uc = member_lc.upper()
in_count = 0
......@@ -401,27 +423,35 @@ class Generator(object):
# gpointer user_data,
# GObject *weak_object);
self.b('/**')
self.b(' * %s_%s_callback_for_%s:'
self.d('/**')
self.d(' * %s_%s_callback_for_%s:'
% (self.prefix_lc, iface_lc, member_lc))
self.b(' * @proxy: the proxy on which the call was made')
self.d(' * @proxy: the proxy on which the call was made')
for arg in out_args:
name, info, tp_type, elt = arg
ctype, gtype, marshaller, pointer = info
self.b(' * @%s: Used to return an \'out\' argument if @error is '
self.d(' * @%s: Used to return an \'out\' argument if @error is '
'%%NULL: %s'
% (name, xml_escape(get_docstring(elt) or '(Undocumented)')))
self.b(' * @error: %NULL on success, or an error on failure')
self.b(' * @user_data: user-supplied data')
self.b(' * @weak_object: user-supplied object')
self.b(' *')
self.b(' * Signature of the callback called when a %s method call'
self.d(' * @error: %NULL on success, or an error on failure')
self.d(' * @user_data: user-supplied data')
self.d(' * @weak_object: user-supplied object')
self.d(' *')
self.d(' * Signature of the callback called when a %s method call'
% member)
self.b(' * succeeds or fails.')
self.b(' */')
self.d(' * succeeds or fails.')
deprecated = method.getElementsByTagName('tp:deprecated')
if deprecated:
d = deprecated[0]
self.d(' *')
self.d(' * Deprecated: %s' % xml_escape(get_deprecated(d)))
self.d(' */')
self.d('')
callback_name = '%s_%s_callback_for_%s' % (self.prefix_lc, iface_lc,
member_lc)
......@@ -646,42 +676,51 @@ class Generator(object):
% (self.prefix_lc, iface_lc, member_lc, self.proxy_arg))
self.h(' gint timeout_ms,')
self.b('/**')
self.b(' * %s_%s_call_%s:'
self.d('/**')
self.d(' * %s_%s_call_%s:'
% (self.prefix_lc, iface_lc, member_lc))
self.b(' * @proxy: the #TpProxy')
self.b(' * @timeout_ms: the timeout in milliseconds, or -1 to use the')
self.b(' * default')
self.d(' * @proxy: the #TpProxy')
self.d(' * @timeout_ms: the timeout in milliseconds, or -1 to use the')
self.d(' * default')
for arg in in_args:
name, info, tp_type, elt = arg
ctype, gtype, marshaller, pointer = info
self.b(' * @%s: Used to pass an \'in\' argument: %s'
self.d(' * @%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(' * 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(' * 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(' *')
self.b(' * %s' % xml_escape(get_docstring(method) or '(Undocumented)'))
self.b(' *')
self.b(' * Returns: a #TpProxyPendingCall representing the call in')
self.b(' * progress. It is borrowed from the object, and will become')
self.b(' * invalid when the callback is called, the call is')
self.b(' * cancelled or the #TpProxy becomes invalid.')
self.b(' */')
self.d(' * @callback: called when the method call succeeds or fails;')
self.d(' * may be %NULL to make a "fire and forget" call with no ')
self.d(' * reply tracking')
self.d(' * @user_data: user-supplied data passed to the callback;')
self.d(' * must be %NULL if @callback is %NULL')
self.d(' * @destroy: called with the user_data as argument, after the')
self.d(' * call has succeeded, failed or been cancelled;')
self.d(' * must be %NULL if @callback is %NULL')
self.d(' * @weak_object: If not %NULL, a #GObject which will be ')
self.d(' * weakly referenced; if it is destroyed, this call ')
self.d(' * will automatically be cancelled. Must be %NULL if ')
self.d(' * @callback is %NULL')
self.d(' *')
self.d(' * Start a %s method call.' % member)
self.d(' *')
self.d(' * %s' % xml_escape(get_docstring(method) or '(Undocumented)'))
self.d(' *')
self.d(' * Returns: a #TpProxyPendingCall representing the call in')
self.d(' * progress. It is borrowed from the object, and will become')
self.d(' * invalid when the callback is called, the call is')
self.d(' * cancelled or the #TpProxy becomes invalid.')
deprecated = method.getElementsByTagName('tp:deprecated')
if deprecated:
d = deprecated[0]
self.d(' *')
self.d(' * Deprecated: %s' % xml_escape(get_deprecated(d)))
self.d(' */')
self.d('')
self.b('TpProxyPendingCall *\n%s_%s_call_%s (%sproxy,'
% (self.prefix_lc, iface_lc, member_lc, self.proxy_arg))
self.b(' gint timeout_ms,')
......@@ -793,6 +832,17 @@ class Generator(object):
self.b('}')
self.b('')
if self.generate_reentrant:
self.do_method_reentrant(method, iface_lc, member, member_lc,
in_args, out_args, collect_callback)
# leave a gap for the end of the method
self.d('')
self.b('')
self.h('')
def do_method_reentrant(self, method, iface_lc, member, member_lc, in_args,
out_args, collect_callback):
# Reentrant blocking calls
# Example:
# gboolean tp_cli_properties_interface_run_get_properties
......@@ -877,48 +927,60 @@ class Generator(object):
self.b('}')
self.b('')
if self.deprecate_reentrant:
self.h('#ifndef %s' % self.deprecate_reentrant)
self.h('gboolean %s_%s_run_%s (%sproxy,'
% (self.prefix_lc, iface_lc, member_lc, self.proxy_arg))
self.h(' gint timeout_ms,')
self.b('/**')
self.b(' * %s_%s_run_%s:' % (self.prefix_lc, iface_lc, member_lc))
self.b(' * @proxy: %s' % self.proxy_doc)
self.b(' * @timeout_ms: Timeout in milliseconds, or -1 for default')
self.d('/**')
self.d(' * %s_%s_run_%s:' % (self.prefix_lc, iface_lc, member_lc))
self.d(' * @proxy: %s' % self.proxy_doc)
self.d(' * @timeout_ms: Timeout in milliseconds, or -1 for default')
for arg in in_args:
name, info, tp_type, elt = arg
ctype, gtype, marshaller, pointer = info
self.b(' * @%s: Used to pass an \'in\' argument: %s'
self.d(' * @%s: Used to pass an \'in\' argument: %s'
% (name, xml_escape(get_docstring(elt) or '(Undocumented)')))
for arg in out_args:
name, info, tp_type, elt = arg
ctype, gtype, marshaller, pointer = info
self.b(' * @%s: Used to return an \'out\' argument if %%TRUE is '
self.d(' * @%s: Used to return an \'out\' argument if %%TRUE is '
'returned: %s'
% (name, xml_escape(get_docstring(elt) or '(Undocumented)')))
self.b(' * @error: If not %NULL, used to return errors if %FALSE ')
self.b(' * is returned')
self.b(' * @loop: If not %NULL, set before re-entering ')
self.b(' * the main loop, to point to a #GMainLoop ')
self.b(' * which can be used to cancel this call with ')
self.b(' * g_main_loop_quit(), causing a return of ')
self.b(' * %FALSE with @error set to %TP_DBUS_ERROR_CANCELLED')
self.b(' *')
self.b(' * Call the method %s and run the main loop' % member)
self.b(' * until it returns. Before calling this method, you must')
self.b(' * add a reference to any borrowed objects you need to keep,')
self.b(' * and generally ensure that everything is in a consistent')
self.b(' * state.')
self.b(' *')
self.b(' * %s' % xml_escape(get_docstring(method) or '(Undocumented)'))
self.b(' *')
self.b(' * Returns: TRUE on success, FALSE and sets @error on error')
self.b(' */')
self.d(' * @error: If not %NULL, used to return errors if %FALSE ')
self.d(' * is returned')
self.d(' * @loop: If not %NULL, set before re-entering ')
self.d(' * the main loop, to point to a #GMainLoop ')
self.d(' * which can be used to cancel this call with ')
self.d(' * g_main_loop_quit(), causing a return of ')
self.d(' * %FALSE with @error set to %TP_DBUS_ERROR_CANCELLED')
self.d(' *')
self.d(' * Call the method %s and run the main loop' % member)
self.d(' * until it returns. Before calling this method, you must')
self.d(' * add a reference to any borrowed objects you need to keep,')
self.d(' * and generally ensure that everything is in a consistent')
self.d(' * state.')
self.d(' *')
self.d(' * %s' % xml_escape(get_docstring(method) or '(Undocumented)'))
self.d(' *')
self.d(' * Returns: TRUE on success, FALSE and sets @error on error')
deprecated = method.getElementsByTagName('tp:deprecated')
if deprecated:
d = deprecated[0]
self.d(' *')
self.d(' * Deprecated: %s' % xml_escape(get_deprecated(d)))
self.d(' */')
self.d('')
self.b('gboolean\n%s_%s_run_%s (%sproxy,'
% (self.prefix_lc, iface_lc, member_lc, self.proxy_arg))
self.b(' gint timeout_ms,')
......@@ -940,7 +1002,13 @@ class Generator(object):
self.b(' %s*%s,' % (ctype, name))
self.h(' GError **error,')
self.h(' GMainLoop **loop);')
if self.deprecate_reentrant:
self.h(' GMainLoop **loop) %s;' % self.deprecation_attribute)
self.h('#endif /* not %s */' % self.deprecate_reentrant)
else:
self.h(' GMainLoop **loop);')
self.h('')
self.b(' GError **error,')
......@@ -1012,10 +1080,6 @@ class Generator(object):
self.b('}')
self.b('')
# leave a gap for the end of the method
self.b('')