Mercurial > pidgin.yaz
comparison src/dbus-analyze-types.py @ 11171:ebb02ea3c789
[gaim-migrate @ 13272]
Moved DBUS init call from gtkmain.c to core.c
Reimplemented DBUS bindings mechamism to use low-level GLib bindings
as described in my last blog entry. This way plugins can add new DBUS
methods on the fly. Also wrote an example plugin that demonstrate how
to do it.
committer: Tailor Script <tailor@pidgin.im>
author | Piotr Zielinski <zielaj> |
---|---|
date | Sat, 30 Jul 2005 00:23:21 +0000 |
parents | 1c5398ccbeb0 |
children | 64fadbf3810f |
comparison
equal
deleted
inserted
replaced
11170:0e9e2b923d09 | 11171:ebb02ea3c789 |
---|---|
16 | 16 |
17 | 17 |
18 import re | 18 import re |
19 import sys | 19 import sys |
20 | 20 |
21 myinput = iter(sys.stdin) | |
22 | |
23 def outputenum(name): | |
24 print "DBUS_POINTER_%s," % name | |
25 | |
26 def outputdeclare(name): | |
27 print "DECLARE_TYPE(%s, NONE);" % name | |
28 | |
29 def outputtext(name): | |
30 print name | |
31 | |
32 myoutput = outputtext | |
33 keyword = "struct" | 21 keyword = "struct" |
22 pattern = "%s" | |
34 | 23 |
35 for arg in sys.argv[1:]: | 24 for arg in sys.argv[1:]: |
36 if arg[0:2] == "--": | 25 if arg[0:2] == "--": |
37 mylist = arg[2:].split("=") | 26 mylist = arg[2:].split("=",1) |
38 command = mylist[0] | 27 command = mylist[0] |
39 if len(mylist) > 1: | 28 if len(mylist) > 1: |
40 value = mylist[1] | 29 value = mylist[1] |
41 else: | 30 else: |
42 value = None | 31 value = None |
43 | 32 |
44 if command == "enum": | 33 if command == "pattern": |
45 myoutput = outputenum | 34 pattern = value |
46 if command == "declare": | |
47 myoutput = outputdeclare | |
48 if command == "list": | |
49 myoutput = outputtext | |
50 if command == "keyword": | 35 if command == "keyword": |
51 keyword = value | 36 keyword = value |
52 | 37 |
53 | 38 |
54 structregexp1 = re.compile(r"^(typedef\s+)?%s\s+\w+\s+(\w+)\s*;" % keyword) | 39 structregexp1 = re.compile(r"^(typedef\s+)?%s\s+\w+\s+(\w+)\s*;" % keyword) |
55 structregexp2 = re.compile(r"^(typedef\s+)?%s" % keyword) | 40 structregexp2 = re.compile(r"^(typedef\s+)?%s" % keyword) |
56 structregexp3 = re.compile(r"^}\s+(\w+)\s*;") | 41 structregexp3 = re.compile(r"^}\s+(\w+)\s*;") |
57 | 42 |
43 myinput = iter(sys.stdin) | |
44 | |
58 for line in myinput: | 45 for line in myinput: |
59 match = structregexp1.match(line) | 46 match = structregexp1.match(line) |
60 if match is not None: | 47 if match is not None: |
61 myoutput(match.group(2)) | 48 print pattern % match.group(2) |
62 continue | 49 continue |
63 | 50 |
64 match = structregexp2.match(line) | 51 match = structregexp2.match(line) |
65 if match is not None: | 52 if match is not None: |
66 while True: | 53 while True: |
67 line = myinput.next() | 54 line = myinput.next() |
68 match = structregexp3.match(line) | 55 match = structregexp3.match(line) |
69 if match is not None: | 56 if match is not None: |
70 myoutput(match.group(1)) | 57 print pattern % match.group(1) |
71 break | 58 break |
72 if line[0] not in [" ", "\t", "{", "\n"]: | 59 if line[0] not in [" ", "\t", "{", "\n"]: |
73 break | 60 break |
74 | 61 |
75 | 62 |