1 # This program takes a C source as the input and produces the list of
2 # all signals registered.
5 # <signal name="Changed">
6 # <arg name="new_value" type="b"/>
12 # List "excluded" contains signals that shouldn't be exported via
13 # DBus. If you remove a signal from this list, please make sure
14 # that it does not break "make" with the configure option
15 # "--enable-dbus" turned on.
18 # purple_dbus_signal_emit_purple prevents our "dbus-method-called"
19 # signal from being propagated to dbus.
23 registerregex
= re
.compile("purple_signal_register[^;]+\"([\w\-]+)\"[^;]+(purple_marshal_\w+)[^;]+;")
24 nameregex
= re
.compile('[-_][a-z]')
26 print "/* Generated by %s. Do not edit! */" % sys
.argv
[0]
27 print "const char *dbus_signals = "
28 for match
in registerregex
.finditer(sys
.stdin
.read()):
29 signal
= match
.group(1)
30 marshal
= match
.group(2)
31 if signal
in excluded
:
34 signal
= nameregex
.sub(lambda x
:x
.group()[1].upper(), '-'+signal
)
35 print "\" <signal name='%s'>\\n\""%signal
37 args
= marshal
.split('_')
38 # ['purple', 'marshal', <return type>, '', args...]
53 elif arg
== "BOOLEAN":
55 print "\" <arg type='%s'/>\\n\""%type
57 print "\" </signal>\\n\""