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