hindi update
[empathy-mirror.git] / tools / glib-signals-marshal-gen.py
blob0d02c1341c920b043bd0ced37bef5a3293126559
1 #!/usr/bin/python
3 import sys
4 import xml.dom.minidom
5 from string import ascii_letters, digits
8 from libglibcodegen import signal_to_marshal_name, method_to_glue_marshal_name
11 class Generator(object):
13 def __init__(self, dom):
14 self.dom = dom
15 self.marshallers = {}
17 def do_method(self, method):
18 marshaller = method_to_glue_marshal_name(method, 'PREFIX')
20 assert '__' in marshaller
21 rhs = marshaller.split('__', 1)[1].split('_')
23 self.marshallers[marshaller] = rhs
25 def do_signal(self, signal):
26 marshaller = signal_to_marshal_name(signal, 'PREFIX')
28 assert '__' in marshaller
29 rhs = marshaller.split('__', 1)[1].split('_')
31 self.marshallers[marshaller] = rhs
33 def __call__(self):
34 methods = self.dom.getElementsByTagName('method')
36 for method in methods:
37 self.do_method(method)
39 signals = self.dom.getElementsByTagName('signal')
41 for signal in signals:
42 self.do_signal(signal)
44 all = self.marshallers.keys()
45 all.sort()
46 for marshaller in all:
47 rhs = self.marshallers[marshaller]
48 if not marshaller.startswith('g_cclosure'):
49 print 'VOID:' + ','.join(rhs)
51 if __name__ == '__main__':
52 argv = sys.argv[1:]
53 dom = xml.dom.minidom.parse(argv[0])
55 Generator(dom)()