diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-12-04 10:50:04 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-12-04 10:50:04 +0000 |
commit | 8864d11897352f55dd000a90534ade3cb6ca7ed7 (patch) | |
tree | 6c9c7338a18d2c03e6a447a4dc3ca4e815a8d2c7 /tools | |
parent | 4234af34f0c5f8c20f437ea58e80c13d184ab6d1 (diff) |
Also add glib-signals-marshal-gen.py from telepathy-glib
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.am | 1 | ||||
-rw-r--r-- | tools/glib-signals-marshal-gen.py | 55 |
2 files changed, 56 insertions, 0 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am index 89dbeace6..d60835833 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -8,6 +8,7 @@ EXTRA_DIST = \ doc-generator.xsl \ genginterface.py \ glib-ginterface-gen.py \ + glib-signals-marshal-gen.py \ libglibcodegen.py \ ls-interfaces.xsl \ make-all-async.xsl \ diff --git a/tools/glib-signals-marshal-gen.py b/tools/glib-signals-marshal-gen.py new file mode 100644 index 000000000..0d02c1341 --- /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)() |