File indexing completed on 2024-04-21 05:01:51

0001 #!/usr/bin/python
0002 
0003 import sys
0004 import xml.dom.minidom
0005 from string import ascii_letters, digits
0006 
0007 
0008 from libglibcodegen import signal_to_marshal_name, method_to_glue_marshal_name
0009 
0010 
0011 class Generator(object):
0012 
0013     def __init__(self, dom):
0014         self.dom = dom
0015         self.marshallers = {}
0016 
0017     def do_method(self, method):
0018         marshaller = method_to_glue_marshal_name(method, 'PREFIX')
0019 
0020         assert '__' in marshaller
0021         rhs = marshaller.split('__', 1)[1].split('_')
0022 
0023         self.marshallers[marshaller] = rhs
0024 
0025     def do_signal(self, signal):
0026         marshaller = signal_to_marshal_name(signal, 'PREFIX')
0027 
0028         assert '__' in marshaller
0029         rhs = marshaller.split('__', 1)[1].split('_')
0030 
0031         self.marshallers[marshaller] = rhs
0032 
0033     def __call__(self):
0034         methods = self.dom.getElementsByTagName('method')
0035 
0036         for method in methods:
0037             self.do_method(method)
0038 
0039         signals = self.dom.getElementsByTagName('signal')
0040 
0041         for signal in signals:
0042             self.do_signal(signal)
0043 
0044         all = self.marshallers.keys()
0045         all.sort()
0046         for marshaller in all:
0047             rhs = self.marshallers[marshaller]
0048             if not marshaller.startswith('g_cclosure'):
0049                 print 'VOID:' + ','.join(rhs)
0050 
0051 if __name__ == '__main__':
0052     argv = sys.argv[1:]
0053     dom = xml.dom.minidom.parse(argv[0])
0054 
0055     Generator(dom)()