aboutsummaryrefslogtreecommitdiffstats
path: root/tools/glib-client-marshaller-gen.py
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-02-26 21:31:02 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-02-26 21:31:02 +0800
commitc3751daec7cca3e44abfed1db475cf0fc4703d66 (patch)
tree4ba009a19d6f3254acb8d91be788d49a7e259fc2 /tools/glib-client-marshaller-gen.py
parent035e672692a3c63ccf7b927b0b7b74438c1f0e24 (diff)
downloadgsoc2013-empathy-c3751daec7cca3e44abfed1db475cf0fc4703d66.tar
gsoc2013-empathy-c3751daec7cca3e44abfed1db475cf0fc4703d66.tar.gz
gsoc2013-empathy-c3751daec7cca3e44abfed1db475cf0fc4703d66.tar.bz2
gsoc2013-empathy-c3751daec7cca3e44abfed1db475cf0fc4703d66.tar.lz
gsoc2013-empathy-c3751daec7cca3e44abfed1db475cf0fc4703d66.tar.xz
gsoc2013-empathy-c3751daec7cca3e44abfed1db475cf0fc4703d66.tar.zst
gsoc2013-empathy-c3751daec7cca3e44abfed1db475cf0fc4703d66.zip
Import tools from telepathy-glib 0.7.3 and build a static libemp-extensions.la.
Link that library into libempathy (it's not actually used for anything at this point). Extensions currently built: ChannelHandler and StreamEngine. The namespacing convention used is emp_*, Emp*, EMP_* so it won't be included in the library ABI. svn path=/trunk/; revision=663
Diffstat (limited to 'tools/glib-client-marshaller-gen.py')
-rw-r--r--tools/glib-client-marshaller-gen.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/tools/glib-client-marshaller-gen.py b/tools/glib-client-marshaller-gen.py
new file mode 100644
index 000000000..54447255b
--- /dev/null
+++ b/tools/glib-client-marshaller-gen.py
@@ -0,0 +1,59 @@
+#!/usr/bin/python
+
+import sys
+import xml.dom.minidom
+from string import ascii_letters, digits
+
+
+from libglibcodegen import signal_to_marshal_name
+
+
+NS_TP = "http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
+
+class Generator(object):
+
+ def __init__(self, dom, prefix):
+ self.dom = dom
+ self.marshallers = {}
+ self.prefix = prefix
+
+ def do_signal(self, signal):
+ marshaller = signal_to_marshal_name(signal, self.prefix)
+
+ assert '__' in marshaller
+ rhs = marshaller.split('__', 1)[1].split('_')
+
+ self.marshallers[marshaller] = rhs
+
+ def __call__(self):
+ signals = self.dom.getElementsByTagName('signal')
+
+ for signal in signals:
+ self.do_signal(signal)
+
+ print 'void'
+ print '%s_register_dbus_glib_marshallers (void)' % self.prefix
+ print '{'
+
+ all = self.marshallers.keys()
+ all.sort()
+ for marshaller in all:
+ rhs = self.marshallers[marshaller]
+
+ print ' dbus_g_object_register_marshaller (%s,' % marshaller
+ print ' G_TYPE_NONE, /* return */'
+ for type in rhs:
+ print ' G_TYPE_%s,' % type.replace('VOID', 'NONE')
+ print ' G_TYPE_INVALID);'
+
+ print '}'
+
+
+def types_to_gtypes(types):
+ return [type_to_gtype(t)[1] for t in types]
+
+if __name__ == '__main__':
+ argv = sys.argv[1:]
+ dom = xml.dom.minidom.parse(argv[0])
+
+ Generator(dom, argv[1])()