diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2008-02-15 13:13:56 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2008-02-15 13:13:56 +0000 |
commit | 14d16cfccd1540a46890daed97bb1eaa0aefb434 (patch) | |
tree | a7cd5830cef7144ae71a5f02c49d6f03adc140ad /tools/glib-signals-marshal-gen.py | |
parent | 3a56a953d4012a1a19288844821d802f021e1d4b (diff) | |
download | telepathy-mission-control-14d16cfccd1540a46890daed97bb1eaa0aefb434.tar.gz |
* tools/: update from telepathy-glib/telepathy-spec and pull in
a fairly complete set of code-gen tools (which will actually be used
in a follow-up patch)
* configure.ac: Check for Python (the code-gen tools use it).
Require telepathy-glib 0.7.1 and libtelepathy 0.3.2
* xml/MissionControl.xml: Use tp: namespace prefix in preparation for
extending use of telepathy-glib code generation tools
git-svn-id: https://mission-control.svn.sourceforge.net/svnroot/mission-control/trunk@284 d91c8aed-3f2b-0410-a83d-924a1c20a0ba
Diffstat (limited to 'tools/glib-signals-marshal-gen.py')
-rw-r--r-- | tools/glib-signals-marshal-gen.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/glib-signals-marshal-gen.py b/tools/glib-signals-marshal-gen.py new file mode 100644 index 00000000..0d02c134 --- /dev/null +++ b/tools/glib-signals-marshal-gen.py @@ -0,0 +1,55 @@ +#!/usr/bin/python + +import sys +import xml.dom.minidom +from string import ascii_letters, digits + + +from libglibcodegen import signal_to_marshal_name, method_to_glue_marshal_name + + +class Generator(object): + + def __init__(self, dom): + self.dom = dom + self.marshallers = {} + + def do_method(self, method): + marshaller = method_to_glue_marshal_name(method, 'PREFIX') + + assert '__' in marshaller + rhs = marshaller.split('__', 1)[1].split('_') + + self.marshallers[marshaller] = rhs + + def do_signal(self, signal): + marshaller = signal_to_marshal_name(signal, 'PREFIX') + + assert '__' in marshaller + rhs = marshaller.split('__', 1)[1].split('_') + + self.marshallers[marshaller] = rhs + + def __call__(self): + methods = self.dom.getElementsByTagName('method') + + for method in methods: + self.do_method(method) + + signals = self.dom.getElementsByTagName('signal') + + for signal in signals: + self.do_signal(signal) + + all = self.marshallers.keys() + all.sort() + for marshaller in all: + rhs = self.marshallers[marshaller] + if not marshaller.startswith('g_cclosure'): + print 'VOID:' + ','.join(rhs) + +if __name__ == '__main__': + argv = sys.argv[1:] + dom = xml.dom.minidom.parse(argv[0]) + + Generator(dom)() |