summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2007-11-29 13:02:20 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2007-11-29 13:02:20 +0000
commit9279a0091cdce5b4ca05be6265aeb1120beb6e92 (patch)
tree43d5e43157881660c281d6ba3eaea9c7e9e8c431 /tools
parent06bc54d3d3a0e10e8ea482cba2a145a90be0a8c8 (diff)
Add missing glib-signals-marshal-gen.py in tools/
Diffstat (limited to 'tools')
-rw-r--r--tools/glib-signals-marshal-gen.py55
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 0000000..0d02c13
--- /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)()