]> git.0d.be Git - empathy.git/blob - tools/glib-signals-marshal-gen.py
check-whitespace.sh: check trailing tabs
[empathy.git] / tools / glib-signals-marshal-gen.py
1 #!/usr/bin/python
2
3 import sys
4 import xml.dom.minidom
5 from string import ascii_letters, digits
6
7
8 from libglibcodegen import signal_to_marshal_name, method_to_glue_marshal_name
9
10
11 class Generator(object):
12
13     def __init__(self, dom):
14         self.dom = dom
15         self.marshallers = {}
16
17     def do_method(self, method):
18         marshaller = method_to_glue_marshal_name(method, 'PREFIX')
19
20         assert '__' in marshaller
21         rhs = marshaller.split('__', 1)[1].split('_')
22
23         self.marshallers[marshaller] = rhs
24
25     def do_signal(self, signal):
26         marshaller = signal_to_marshal_name(signal, 'PREFIX')
27
28         assert '__' in marshaller
29         rhs = marshaller.split('__', 1)[1].split('_')
30
31         self.marshallers[marshaller] = rhs
32
33     def __call__(self):
34         methods = self.dom.getElementsByTagName('method')
35
36         for method in methods:
37             self.do_method(method)
38
39         signals = self.dom.getElementsByTagName('signal')
40
41         for signal in signals:
42             self.do_signal(signal)
43
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)
50
51 if __name__ == '__main__':
52     argv = sys.argv[1:]
53     dom = xml.dom.minidom.parse(argv[0])
54
55     Generator(dom)()