5 from string
import ascii_letters
, digits
8 from libglibcodegen
import signal_to_marshal_name
11 NS_TP
= "http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
13 class Generator(object):
15 def __init__(self
, dom
, prefix
):
20 def do_signal(self
, signal
):
21 marshaller
= signal_to_marshal_name(signal
, self
.prefix
)
23 assert '__' in marshaller
24 rhs
= marshaller
.split('__', 1)[1].split('_')
26 self
.marshallers
[marshaller
] = rhs
29 signals
= self
.dom
.getElementsByTagName('signal')
31 for signal
in signals
:
32 self
.do_signal(signal
)
35 print('%s_register_dbus_glib_marshallers (void)' % self
.prefix
)
38 all
= list(self
.marshallers
.keys())
40 for marshaller
in all
:
41 rhs
= self
.marshallers
[marshaller
]
43 print(' dbus_g_object_register_marshaller (')
44 print(' g_cclosure_marshal_generic,')
45 print(' G_TYPE_NONE, /* return */')
47 print(' G_TYPE_%s,' % type.replace('VOID', 'NONE'))
48 print(' G_TYPE_INVALID);')
53 def types_to_gtypes(types
):
54 return [type_to_gtype(t
)[1] for t
in types
]
56 if __name__
== '__main__':
58 dom
= xml
.dom
.minidom
.parse(argv
[0])
60 Generator(dom
, argv
[1])()