diff 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
line wrap: on
line diff
--- a/src/dbus-analyze-types.py	Fri Jul 29 13:38:00 2005 +0000
+++ b/src/dbus-analyze-types.py	Sat Jul 30 00:23:21 2005 +0000
@@ -18,35 +18,20 @@
 import re
 import sys
 
-myinput = iter(sys.stdin)
-
-def outputenum(name):
-    print "DBUS_POINTER_%s," % name
-
-def outputdeclare(name):
-    print "DECLARE_TYPE(%s, NONE);" % name
-
-def outputtext(name):
-    print name
-
-myoutput = outputtext
 keyword = "struct"
+pattern = "%s"
 
 for arg in sys.argv[1:]:
     if arg[0:2] == "--":
-        mylist = arg[2:].split("=")
+        mylist = arg[2:].split("=",1)
         command = mylist[0]
         if len(mylist) > 1:
             value = mylist[1]
         else:
             value = None
             
-    if command == "enum":
-        myoutput = outputenum
-    if command == "declare":
-        myoutput = outputdeclare
-    if command == "list":
-        myoutput = outputtext
+    if command == "pattern":
+        pattern = value
     if command == "keyword":
         keyword = value
         
@@ -55,10 +40,12 @@
 structregexp2 = re.compile(r"^(typedef\s+)?%s" % keyword)
 structregexp3 = re.compile(r"^}\s+(\w+)\s*;")
 
+myinput = iter(sys.stdin)
+
 for line in myinput:
     match = structregexp1.match(line)
     if match is not None:
-        myoutput(match.group(2))        
+        print pattern % match.group(2)
         continue
 
     match = structregexp2.match(line)
@@ -67,7 +54,7 @@
             line = myinput.next()
             match = structregexp3.match(line)
             if match is not None:
-                myoutput(match.group(1))
+                print pattern % match.group(1)
                 break
             if line[0] not in [" ", "\t", "{", "\n"]:
                 break