Mercurial > pidgin
annotate libpurple/dbus-analyze-signals.py @ 29375:4608d460024e
The GLib requirement is 2.12.0, not 2.4.0. Sorry for the re-configure.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Tue, 16 Feb 2010 01:17:55 +0000 |
parents | 3a0552df3379 |
children | 9f6b8e5998ec |
rev | line source |
---|---|
27291
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1 # This program takes a C source as the input and produces the list of |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
2 # all signals registered. |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
3 # |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
4 # Output is: |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
5 # <signal name="Changed"> |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
6 # <arg name="new_value" type="b"/> |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
7 # </signal> |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
8 |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
9 import re |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
10 import sys |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
11 |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
12 # List "excluded" contains signals that shouldn't be exported via |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
13 # DBus. If you remove a signal from this list, please make sure |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
14 # that it does not break "make" with the configure option |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
15 # "--enable-dbus" turned on. |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
16 |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
17 excluded = [\ |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
18 # purple_dbus_signal_emit_purple prevents our "dbus-method-called" |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
19 # signal from being propagated to dbus. |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
20 "dbus-method-called", |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
21 ] |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
22 |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
23 registerregex = re.compile("purple_signal_register[^;]+\"([\w\-]+)\"[^;]+(purple_marshal_\w+)[^;]+;") |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
24 nameregex = re.compile('[-_][a-z]') |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
25 |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
26 print "/* Generated by %s. Do not edit! */" % sys.argv[0] |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
27 print "const char *dbus_signals = " |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
28 for match in registerregex.finditer(sys.stdin.read()): |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
29 signal = match.group(1) |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
30 marshal = match.group(2) |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
31 if signal in excluded: |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
32 continue |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
33 |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
34 signal = nameregex.sub(lambda x:x.group()[1].upper(), '-'+signal) |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
35 print "\"<signal name='%s'>\\n\""%signal |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
36 |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
37 args = marshal.split('_') |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
38 # ['purple', 'marshal', <return type>, '', args...] |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
39 if len(args) > 4: |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
40 for arg in args[4:]: |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
41 if arg == "POINTER": |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
42 type = 'p' |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
43 elif arg == "ENUM": |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
44 type = 'i' |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
45 elif arg == "INT": |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
46 type = 'i' |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
47 elif arg == "UINT": |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
48 type = 'u' |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
49 elif arg == "INT64": |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
50 type = 'x' |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
51 elif arg == "UINT64": |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
52 type = 't' |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
53 elif arg == "BOOLEAN": |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
54 type = 'b' |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
55 print "\"<arg type='%s'/>\\n\""%type |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
56 |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
57 print "\"</signal>\\n\"" |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
58 |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
59 print ";" |
3a0552df3379
Add auto-generated D-Bus signals introspection, though parameter names
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
60 |