Mercurial > pidgin.yaz
annotate libpurple/dbus-analyze-functions.py @ 27400:31534ae3406a
Moved functions around and made some no longer static. All the functions
that are no longer static now have prototypes in libymsg.h. Moved the URI
handling stuff to libyahoo.c since I removed the handling capability from
libyahoojp.c. I still need to find out if Yahoo! JAPAN has its own URI
scheme or not.
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Sun, 05 Jul 2009 23:56:07 +0000 |
parents | 750f087d1df3 |
children | 5afee99de904 b168718d1072 |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 import re |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 import string |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 import sys |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
4 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 # types translated into "int" |
18130
d955d9bd7ea7
Treat some more types as simple types. This allows exporting some useful
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
6 simpletypes = ["int", "gint", "guint", "gboolean", "gpointer", "size_t", "gssize", "time_t"] |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 # List "excluded" contains functions that shouldn't be exported via |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 # DBus. If you remove a function from this list, please make sure |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 # that it does not break "make" with the configure option |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 # "--enable-dbus" turned on. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 excluded = [\ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 # I don't remember why this function is excluded; something to do |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 # with the fact that it takes a (const) GList as a parameter. |
15823 | 16 "purple_presence_add_list", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 # These functions are excluded because they involve value of the |
15823 | 19 # type PurpleConvPlacementFunc, which is a pointer to a function and |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 # (currently?) can't be translated into a DBus type. Normally, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 # functions with untranslatable types are skipped, but this script |
15823 | 22 # assumes that all non-pointer type names beginning with "Purple" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 # are enums, which is not true in this case. |
15823 | 24 "purple_conv_placement_add_fnc", |
25 "purple_conv_placement_get_fnc", | |
26 "purple_conv_placement_get_current_func", | |
27 "purple_conv_placement_set_current_func", | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 |
19710
93d10000432e
Work around a problem so --enable-dbus will build again.
Richard Laager <rlaager@wiktel.com>
parents:
19418
diff
changeset
|
29 # Similar to the above: |
93d10000432e
Work around a problem so --enable-dbus will build again.
Richard Laager <rlaager@wiktel.com>
parents:
19418
diff
changeset
|
30 "purple_account_set_register_callback", |
93d10000432e
Work around a problem so --enable-dbus will build again.
Richard Laager <rlaager@wiktel.com>
parents:
19418
diff
changeset
|
31 "purple_account_unregister", |
93d10000432e
Work around a problem so --enable-dbus will build again.
Richard Laager <rlaager@wiktel.com>
parents:
19418
diff
changeset
|
32 "purple_connection_new_unregister", |
93d10000432e
Work around a problem so --enable-dbus will build again.
Richard Laager <rlaager@wiktel.com>
parents:
19418
diff
changeset
|
33 |
26947
750f087d1df3
Exclude some get/set UI/protocol data functions from dbus. I don't see how these could function properly.
Paul Aurich <paul@darkrain42.org>
parents:
25048
diff
changeset
|
34 # These functions are excluded because they involve setting arbitrary |
750f087d1df3
Exclude some get/set UI/protocol data functions from dbus. I don't see how these could function properly.
Paul Aurich <paul@darkrain42.org>
parents:
25048
diff
changeset
|
35 # data via pointers for protocols and UIs. This just won't work. |
750f087d1df3
Exclude some get/set UI/protocol data functions from dbus. I don't see how these could function properly.
Paul Aurich <paul@darkrain42.org>
parents:
25048
diff
changeset
|
36 "purple_blist_get_ui_data", |
750f087d1df3
Exclude some get/set UI/protocol data functions from dbus. I don't see how these could function properly.
Paul Aurich <paul@darkrain42.org>
parents:
25048
diff
changeset
|
37 "purple_blist_set_ui_data", |
750f087d1df3
Exclude some get/set UI/protocol data functions from dbus. I don't see how these could function properly.
Paul Aurich <paul@darkrain42.org>
parents:
25048
diff
changeset
|
38 "purple_blist_node_get_ui_data", |
750f087d1df3
Exclude some get/set UI/protocol data functions from dbus. I don't see how these could function properly.
Paul Aurich <paul@darkrain42.org>
parents:
25048
diff
changeset
|
39 "purple_blist_node_set_ui_data", |
750f087d1df3
Exclude some get/set UI/protocol data functions from dbus. I don't see how these could function properly.
Paul Aurich <paul@darkrain42.org>
parents:
25048
diff
changeset
|
40 "purple_buddy_get_protocol_data", |
750f087d1df3
Exclude some get/set UI/protocol data functions from dbus. I don't see how these could function properly.
Paul Aurich <paul@darkrain42.org>
parents:
25048
diff
changeset
|
41 "purple_buddy_set_protocol_data", |
750f087d1df3
Exclude some get/set UI/protocol data functions from dbus. I don't see how these could function properly.
Paul Aurich <paul@darkrain42.org>
parents:
25048
diff
changeset
|
42 |
15823 | 43 # This is excluded because this script treats PurpleLogReadFlags* |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 # as pointer to a struct, instead of a pointer to an enum. This |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 # causes a compilation error. Someone should fix this script. |
15823 | 46 "purple_log_read", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 ] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
49 # This is a list of functions that return a GList* or GSList * whose elements |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
50 # are strings, not pointers to objects. |
18059
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
51 stringlists = [ |
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
52 "purple_prefs_get_path_list", |
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
53 "purple_prefs_get_string_list", |
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
54 "purple_uri_list_extract_filenames", |
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
55 "purple_uri_list_extract_uris", |
19222
476e16ce29d0
Make sure dbus doesn't leak in purple_prefs_get_children_names.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18146
diff
changeset
|
56 "purple_prefs_get_children_names", |
18059
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
57 ] |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
59 # This is a list of functions that return a GList* or GSList* that should |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
60 # not be freed. Ideally, this information should be obtained from the Doxygen |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
61 # documentation at some point. |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
62 constlists = [ |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
63 "purple_account_get_status_types", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
64 "purple_accounts_get_all", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
65 "purple_account_option_get_list", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
66 "purple_connections_get_all", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
67 "purple_connections_get_connecting", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
68 "purple_get_conversations", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
69 "purple_get_ims", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
70 "purple_get_chats", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
71 "purple_conv_chat_get_users", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
72 "purple_conv_chat_get_ignored", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
73 "purple_mime_document_get_fields", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
74 "purple_mime_document_get_parts", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
75 "purple_mime_part_get_fields", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
76 "purple_notify_user_info_get_entries", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
77 "purple_request_fields_get_required", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
78 "purple_request_field_list_get_selected", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
79 "purple_request_field_list_get_items", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
80 "purple_savedstatuses_get_all", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
81 "purple_status_type_get_attrs", |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
82 "purple_presence_get_statuses", |
19418
b33c2b085e78
DBus-ify the message history in a conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19222
diff
changeset
|
83 "purple_conversation_get_message_history", |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
84 ] |
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
85 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 pointer = "#pointer#" |
21038
ec9c30ce628d
Silence warnings from dbus-analyze-functions.py about calling 'raise' on a
Will Thompson <will.thompson@collabora.co.uk>
parents:
19710
diff
changeset
|
87 |
ec9c30ce628d
Silence warnings from dbus-analyze-functions.py about calling 'raise' on a
Will Thompson <will.thompson@collabora.co.uk>
parents:
19710
diff
changeset
|
88 class MyException(Exception): |
ec9c30ce628d
Silence warnings from dbus-analyze-functions.py about calling 'raise' on a
Will Thompson <will.thompson@collabora.co.uk>
parents:
19710
diff
changeset
|
89 pass |
ec9c30ce628d
Silence warnings from dbus-analyze-functions.py about calling 'raise' on a
Will Thompson <will.thompson@collabora.co.uk>
parents:
19710
diff
changeset
|
90 |
ec9c30ce628d
Silence warnings from dbus-analyze-functions.py about calling 'raise' on a
Will Thompson <will.thompson@collabora.co.uk>
parents:
19710
diff
changeset
|
91 myexception = MyException() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 def ctopascal(name): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 newname = "" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 for word in name.split("_"): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 newname += word.capitalize() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 return newname |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 class Parameter: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 def __init__(self, type, name): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 self.name = name |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 self.type = type |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 def fromtokens(tokens, parameternumber = -1): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 if len(tokens) == 0: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 raise myexception |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 if (len(tokens) == 1) or (tokens[-1] == pointer): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 if parameternumber >= 0: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 return Parameter(tokens, "param%i" % parameternumber) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 else: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 raise myexception |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 else: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 return Parameter(tokens[:-1], tokens[-1]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 fromtokens = staticmethod(fromtokens) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 class Binding: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 def __init__(self, functiontext, paramtexts): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 self.function = Parameter.fromtokens(functiontext.split()) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 if self.function.name in excluded: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 raise myexception |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 self.params = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 for i in range(len(paramtexts)): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 self.params.append(Parameter.fromtokens(paramtexts[i].split(), i)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 self.call = "%s(%s)" % (self.function.name, |
25000
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
129 ", ".join(param.name for param in self.params)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 def process(self): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 for param in self.params: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 self.processinput(param.type, param.name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 self.processoutput(self.function.type, "RESULT") |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 self.flush() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 def processinput(self, type, name): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 const = False |
18138
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
142 unsigned = False |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 if type[0] == "const": |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 type = type[1:] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 const = True |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 |
18138
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
147 if type[0] == "unsigned": |
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
148 type = type[1:] |
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
149 unsigned = True |
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
150 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 if len(type) == 1: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 # simple types (int, gboolean, etc.) and enums |
17081
3b01cb4147d3
Callbacks are not supported for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16794
diff
changeset
|
153 if (type[0] in simpletypes) or ((type[0].startswith("Purple") and not type[0].endswith("Callback"))): |
18138
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
154 return self.inputsimple(type, name, unsigned) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 # pointers ... |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 if (len(type) == 2) and (type[1] == pointer): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 # strings |
16794
c5bcac0d593d
gchar returning functions should also be exposed for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15823
diff
changeset
|
159 if type[0] in ["char", "gchar"]: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 if const: |
18146
5d1058768970
Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18138
diff
changeset
|
161 return self.inputstring(type, name, unsigned) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 else: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 raise myexception |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 elif type[0] == "GHashTable": |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 return self.inputhash(type, name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 # known object types are transformed to integer handles |
15823 | 169 elif type[0].startswith("Purple") or type[0] == "xmlnode": |
170 return self.inputpurplestructure(type, name) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 |
25000
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
172 # special case for *_get_data functions, be careful here... |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
173 elif (type[0] == "size_t") and (name == "len"): |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
174 return self.inputgetdata(type, name) |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
175 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 # unknown pointers are always replaced with NULL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 else: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 return self.inputpointer(type, name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 raise myexception |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 def processoutput(self, type, name): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 # the "void" type is simple ... |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 if type == ["void"]: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 return self.outputvoid(type, name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 const = False |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 if type[0] == "const": |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 type = type[1:] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 const = True |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 # a string |
16794
c5bcac0d593d
gchar returning functions should also be exposed for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15823
diff
changeset
|
194 if type == ["char", pointer] or type == ["gchar", pointer]: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 return self.outputstring(type, name, const) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 # simple types (ints, booleans, enums, ...) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 if (len(type) == 1) and \ |
15823 | 199 ((type[0] in simpletypes) or (type[0].startswith("Purple"))): |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 return self.outputsimple(type, name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 # pointers ... |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 if (len(type) == 2) and (type[1] == pointer): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 # handles |
15823 | 206 if type[0].startswith("Purple"): |
207 return self.outputpurplestructure(type, name) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 if type[0] in ["GList", "GSList"]: |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
210 return self.outputlist(type, name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 |
25000
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
212 # Special case for *_get_data functions |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
213 if type[0] == "gconstpointer": |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
214 return self.outputgetdata(type, name) |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
215 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 raise myexception |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 class ClientBinding (Binding): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 def __init__(self, functiontext, paramtexts, knowntypes, headersonly): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 Binding.__init__(self, functiontext, paramtexts) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 self.knowntypes = knowntypes |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 self.headersonly = headersonly |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 self.paramshdr = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 self.decls = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 self.inputparams = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 self.outputparams = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 self.returncode = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 def flush(self): |
17754 | 231 paramslist = ", ".join(self.paramshdr) |
232 if (paramslist == "") : | |
233 paramslist = "void" | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 print "%s %s(%s)" % (self.functiontype, self.function.name, |
17458
98ef77c2455f
Part of a patch from o_sukhodolsky.
Richard Laager <rlaager@wiktel.com>
parents:
17081
diff
changeset
|
235 paramslist), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 if self.headersonly: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 print ";" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 return |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 print "{" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 for decl in self.decls: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 print decl |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 |
15823 | 246 print 'dbus_g_proxy_call(purple_proxy, "%s", NULL,' % ctopascal(self.function.name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 for type_name in self.inputparams: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 print "\t%s, %s, " % type_name, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 print "G_TYPE_INVALID," |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 for type_name in self.outputparams: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 print "\t%s, &%s, " % type_name, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 print "G_TYPE_INVALID);" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 for code in self.returncode: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 print code |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 print "}\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 |
15823 | 262 def definepurplestructure(self, type): |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 if (self.headersonly) and (type[0] not in self.knowntypes): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 print "struct _%s;" % type[0] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 print "typedef struct _%s %s;" % (type[0], type[0]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 self.knowntypes.append(type[0]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 |
18138
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
268 def inputsimple(self, type, name, us): |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 self.paramshdr.append("%s %s" % (type[0], name)) |
18138
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
270 if us: |
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
271 self.inputparams.append(("G_TYPE_UINT", name)) |
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
272 else: |
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
273 self.inputparams.append(("G_TYPE_INT", name)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 |
18146
5d1058768970
Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18138
diff
changeset
|
275 def inputstring(self, type, name, us): |
5d1058768970
Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18138
diff
changeset
|
276 if us: |
5d1058768970
Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18138
diff
changeset
|
277 self.paramshdr.append("const unsigned char *%s" % name) |
5d1058768970
Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18138
diff
changeset
|
278 else: |
5d1058768970
Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18138
diff
changeset
|
279 self.paramshdr.append("const char *%s" % name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 self.inputparams.append(("G_TYPE_STRING", name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 |
15823 | 282 def inputpurplestructure(self, type, name): |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 self.paramshdr.append("const %s *%s" % (type[0], name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 self.inputparams.append(("G_TYPE_INT", "GPOINTER_TO_INT(%s)" % name)) |
15823 | 285 self.definepurplestructure(type) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 def inputpointer(self, type, name): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 name += "_NULL" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 self.paramshdr.append("const %s *%s" % (type[0], name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 self.inputparams.append(("G_TYPE_INT", "0")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 def inputhash(self, type, name): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 self.paramshdr.append("const GHashTable *%s" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 self.inputparams.append(('dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING)', name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 def outputvoid(self, type, name): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 self.functiontype = "void" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 def outputstring(self, type, name, const): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 self.functiontype = "char*" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 self.decls.append("char *%s = NULL;" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 self.outputparams.append(("G_TYPE_STRING", name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 # self.returncode.append("NULLIFY(%s);" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 self.returncode.append("return %s;" % name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 def outputsimple(self, type, name): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 self.functiontype = type[0] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 self.decls.append("%s %s = 0;" % (type[0], name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 self.outputparams.append(("G_TYPE_INT", name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 self.returncode.append("return %s;" % name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 # we could add "const" to the return type but this would probably |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 # be a nuisance |
15823 | 314 def outputpurplestructure(self, type, name): |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 name = name + "_ID" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 self.functiontype = "%s*" % type[0] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 self.decls.append("int %s = 0;" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 self.outputparams.append(("G_TYPE_INT", "%s" % name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 self.returncode.append("return (%s*) GINT_TO_POINTER(%s);" % (type[0], name)); |
15823 | 320 self.definepurplestructure(type) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
322 def outputlist(self, type, name): |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 self.functiontype = "%s*" % type[0] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 self.decls.append("GArray *%s;" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 self.outputparams.append(('dbus_g_type_get_collection("GArray", G_TYPE_INT)', name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 self.returncode.append("return garray_int_to_%s(%s);" % |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 (type[0].lower(), name)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 |
25000
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
329 # Special case for *_get_data functions, don't need client bindings, |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
330 # but do need the name so it doesn't crash |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
331 def inputgetdata(self, type, name): |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
332 raise myexception |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
333 def outputgetdata(self, type, name): |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
334 raise myexception |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
335 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 class ServerBinding (Binding): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 def __init__(self, functiontext, paramtexts): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 Binding.__init__(self, functiontext, paramtexts) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 self.dparams = "" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 self.cparams = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 self.cdecls = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 self.ccode = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 self.cparamsout = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 self.ccodeout = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 self.argfunc = "dbus_message_get_args" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 def flush(self): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 print "static DBusMessage*" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 print "%s_DBUS(DBusMessage *message_DBUS, DBusError *error_DBUS) {" % \ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 self.function.name |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
351 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 print "\tDBusMessage *reply_DBUS;" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 for decl in self.cdecls: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 print decl |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 |
17754 | 357 print "\t%s(message_DBUS, error_DBUS," % self.argfunc, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 for param in self.cparams: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 print "DBUS_TYPE_%s, &%s," % param, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 print "DBUS_TYPE_INVALID);" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 print "\tCHECK_ERROR(error_DBUS);" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 for code in self.ccode: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 print code |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 |
17754 | 367 print "\treply_DBUS = dbus_message_new_method_return (message_DBUS);" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 |
17754 | 369 print "\tdbus_message_append_args(reply_DBUS,", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 for param in self.cparamsout: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 if type(param) is str: |
18117
cd81f8f36788
Fix some weird whitespace in the output.
Richard Laager <rlaager@wiktel.com>
parents:
18059
diff
changeset
|
372 print "%s," % param, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 else: |
17754 | 374 print "DBUS_TYPE_%s, &%s," % param, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 print "DBUS_TYPE_INVALID);" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 for code in self.ccodeout: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 print code |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 print "\treturn reply_DBUS;\n}\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 def addstring(self, *items): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 for item in items: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 self.dparams += item + r"\0" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 def addintype(self, type, name): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 self.addstring("in", type, name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 def addouttype(self, type, name): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 self.addstring("out", type, name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 # input parameters |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 |
18138
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
396 def inputsimple(self, type, name, us): |
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
397 if us: |
24324
7493462e6959
A patch from Math2Gold to fix the dbus-analyze-functions script to properly
Richard Laager <rlaager@wiktel.com>
parents:
23145
diff
changeset
|
398 self.cdecls.append("\tdbus_uint32_t %s;" % name) |
7493462e6959
A patch from Math2Gold to fix the dbus-analyze-functions script to properly
Richard Laager <rlaager@wiktel.com>
parents:
23145
diff
changeset
|
399 self.cparams.append(("UINT32", name)) |
7493462e6959
A patch from Math2Gold to fix the dbus-analyze-functions script to properly
Richard Laager <rlaager@wiktel.com>
parents:
23145
diff
changeset
|
400 self.addintype("u", name) |
7493462e6959
A patch from Math2Gold to fix the dbus-analyze-functions script to properly
Richard Laager <rlaager@wiktel.com>
parents:
23145
diff
changeset
|
401 else: |
18138
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
402 self.cdecls.append("\tdbus_int32_t %s;" % name) |
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
403 self.cparams.append(("INT32", name)) |
c6ee57944335
Process unsigned ints for dbus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18130
diff
changeset
|
404 self.addintype("i", name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 |
18146
5d1058768970
Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18138
diff
changeset
|
406 def inputstring(self, type, name, us): |
5d1058768970
Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18138
diff
changeset
|
407 if us: |
5d1058768970
Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18138
diff
changeset
|
408 self.cdecls.append("\tconst unsigned char *%s;" % name) |
5d1058768970
Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18138
diff
changeset
|
409 else: |
5d1058768970
Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18138
diff
changeset
|
410 self.cdecls.append("\tconst char *%s;" % name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 self.cparams.append(("STRING", name)) |
18146
5d1058768970
Remove the warning about signedness.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18138
diff
changeset
|
412 self.ccode.append("\t%s = (%s && %s[0]) ? %s : NULL;" % (name,name,name,name)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 self.addintype("s", name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 def inputhash(self, type, name): |
15823 | 416 self.argfunc = "purple_dbus_message_get_args" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 self.cdecls.append("\tDBusMessageIter %s_ITER;" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 self.cdecls.append("\tGHashTable *%s;" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 self.cparams.append(("ARRAY", "%s_ITER" % name)) |
15823 | 420 self.ccode.append("\t%s = purple_dbus_iter_hash_table(&%s_ITER, error_DBUS);" \ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 % (name, name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 self.ccode.append("\tCHECK_ERROR(error_DBUS);") |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 self.ccodeout.append("\tg_hash_table_destroy(%s);" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 self.addintype("a{ss}", name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 |
15823 | 426 def inputpurplestructure(self, type, name): |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 self.cdecls.append("\tdbus_int32_t %s_ID;" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 self.cdecls.append("\t%s *%s;" % (type[0], name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 self.cparams.append(("INT32", name + "_ID")) |
15823 | 430 self.ccode.append("\tPURPLE_DBUS_ID_TO_POINTER(%s, %s_ID, %s, error_DBUS);" % \ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 (name, name, type[0])) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 self.addintype("i", name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 def inputpointer(self, type, name): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 self.cdecls.append("\tdbus_int32_t %s_NULL;" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 self.cdecls .append("\t%s *%s;" % (type[0], name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 self.cparams.append(("INT32", name + "_NULL")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 self.ccode .append("\t%s = NULL;" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 self.addintype("i", name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 # output parameters |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 def outputvoid(self, type, name): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 self.ccode.append("\t%s;" % self.call) # just call the function |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 def outputstring(self, type, name, const): |
17649
f187d935486b
The DBus bindings have a lot of warnings about calling g_free() on a
Richard Laager <rlaager@wiktel.com>
parents:
17458
diff
changeset
|
447 if const: |
f187d935486b
The DBus bindings have a lot of warnings about calling g_free() on a
Richard Laager <rlaager@wiktel.com>
parents:
17458
diff
changeset
|
448 self.cdecls.append("\tconst char *%s;" % name) |
f187d935486b
The DBus bindings have a lot of warnings about calling g_free() on a
Richard Laager <rlaager@wiktel.com>
parents:
17458
diff
changeset
|
449 else: |
f187d935486b
The DBus bindings have a lot of warnings about calling g_free() on a
Richard Laager <rlaager@wiktel.com>
parents:
17458
diff
changeset
|
450 self.cdecls.append("\tchar *%s;" % name) |
17650
a90e2e720762
Now fix warnings from null_to_empty()'s constness.
Richard Laager <rlaager@wiktel.com>
parents:
17649
diff
changeset
|
451 self.ccode.append("\tif ((%s = %s) == NULL)" % (name, self.call)) |
a90e2e720762
Now fix warnings from null_to_empty()'s constness.
Richard Laager <rlaager@wiktel.com>
parents:
17649
diff
changeset
|
452 self.ccode.append("\t\t%s = \"\";" % (name)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 self.cparamsout.append(("STRING", name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 self.addouttype("s", name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 if not const: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 self.ccodeout.append("\tg_free(%s);" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 def outputsimple(self, type, name): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 self.cdecls.append("\tdbus_int32_t %s;" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 self.ccode.append("\t%s = %s;" % (name, self.call)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
461 self.cparamsout.append(("INT32", name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 self.addouttype("i", name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 |
15823 | 464 def outputpurplestructure(self, type, name): |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 self.cdecls.append("\tdbus_int32_t %s;" % name) |
15823 | 466 self.ccode .append("\tPURPLE_DBUS_POINTER_TO_ID(%s, %s, error_DBUS);" % (name, self.call)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 self.cparamsout.append(("INT32", name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 self.addouttype("i", name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 # GList*, GSList*, assume that list is a list of objects |
18059
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
471 # unless the function is in stringlists |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
472 def outputlist(self, type, name): |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 self.cdecls.append("\tdbus_int32_t %s_LEN;" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 self.ccodeout.append("\tg_free(%s);" % name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
476 self.cdecls.append("\t%s *list;" % type[0]); |
18059
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
477 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 if self.function.name in stringlists: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 self.cdecls.append("\tchar **%s;" % name) |
18059
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
480 self.ccode.append("\tlist = %s;" % self.call) |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
481 self.ccode.append("\t%s = (char **)purple_%s_to_array(list, FALSE, &%s_LEN);" % \ |
18059
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
482 (name, type[0], name)) |
18117
cd81f8f36788
Fix some weird whitespace in the output.
Richard Laager <rlaager@wiktel.com>
parents:
18059
diff
changeset
|
483 self.cparamsout.append("DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &%s, %s_LEN" \ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 % (name, name)) |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
485 if (not (self.function.name in constlists)): |
18059
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
486 type_name = type[0].lower()[1:] |
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
487 self.ccodeout.append("\tg_%s_foreach(list, (GFunc)g_free, NULL);" % type_name) |
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
488 self.ccodeout.append("\tg_%s_free(list);" % type_name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 self.addouttype("as", name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 else: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 self.cdecls.append("\tdbus_int32_t *%s;" % name) |
18059
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
492 self.ccode.append("\tlist = %s;" % self.call) |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
493 self.ccode.append("\t%s = purple_dbusify_%s(list, FALSE, &%s_LEN);" % \ |
18059
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
494 (name, type[0], name)) |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18117
diff
changeset
|
495 if (not (self.function.name in constlists)): |
18059
3f3125b91728
Lots of DBus list handling changes. The objective here was to eliminate a
Richard Laager <rlaager@wiktel.com>
parents:
17754
diff
changeset
|
496 self.ccode.append("\tg_%s_free(list);" % type[0].lower()[1:]) |
18117
cd81f8f36788
Fix some weird whitespace in the output.
Richard Laager <rlaager@wiktel.com>
parents:
18059
diff
changeset
|
497 self.cparamsout.append("DBUS_TYPE_ARRAY, DBUS_TYPE_INT32, &%s, %s_LEN" \ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 % (name, name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 self.addouttype("ai", name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 |
25000
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
501 # Special case for *_get_data functions |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
502 def inputgetdata(self, type, name): |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
503 self.cdecls.append("\tsize_t %s = 0;" % name) |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
504 return True |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
505 def outputgetdata(self, type, name): |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
506 # This is a total hack, but self.call is set up before the parameters |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
507 # are processed, so we can't tell it to pass a parameter by reference. |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
508 self.call = "%s(%s)" % (self.function.name, |
25048
2520d5fe48a3
*** Plucked rev 8e8959be (sadrul@pidgin.im):
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25000
diff
changeset
|
509 ", ".join([(param.name, "&len")[param.name == "len"] for param in self.params])) |
25000
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
510 |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
511 self.cdecls.append("\tgconstpointer %s;" % name) |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
512 self.ccode.append("\t%s = %s;" % (name, self.call)) |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
513 self.cparamsout.append("DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &%s, %s" \ |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
514 % (name, "len")) |
a1c4ae9a2fcc
Add special handling to the Python D-Bus parsing code for the *_get_data
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24324
diff
changeset
|
515 self.addouttype("ay", name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 class BindingSet: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 regexp = r"^(\w[^()]*)\(([^()]*)\)\s*;\s*$"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 def __init__(self, inputfile, fprefix): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 self.inputiter = iter(inputfile) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 self.functionregexp = \ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 re.compile("^%s(\w[^()]*)\(([^()]*)\)\s*;\s*$" % fprefix) |
23145
2012a85f8507
Update the dbus-analyze script to deal with multiline function
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22079
diff
changeset
|
524 self.typeregexp = re.compile("^\w+\s*\*?\s*$") |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
525 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
526 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 def process(self): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 print "/* Generated by %s. Do not edit! */" % sys.argv[0] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 for line in self.inputiter: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 words = line.split() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 if len(words) == 0: # empty line |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 continue |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 if line[0] == "#": # preprocessor directive |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 continue |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 if words[0] in ["typedef", "struct", "enum", "static"]: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 continue |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 # accumulate lines until the parentheses are balance or an |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 # empty line has been encountered |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 myline = line.strip() |
23145
2012a85f8507
Update the dbus-analyze script to deal with multiline function
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22079
diff
changeset
|
543 while (myline.count("(") > myline.count(")")) or self.typeregexp.match(myline): |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 newline = self.inputiter.next().strip() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
545 if len(newline) == 0: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
546 break |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 myline += " " + newline |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
549 # is this a function declaration? |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
550 thematch = self.functionregexp.match( |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 myline.replace("*", " " + pointer + " ")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 if thematch is None: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 continue |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 functiontext = thematch.group(1) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 paramstext = thematch.group(2).strip() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 if (paramstext == "void") or (paramstext == ""): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 paramtexts = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 else: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 paramtexts = paramstext.split(",") |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 try: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 self.processfunction(functiontext, paramtexts) |
21038
ec9c30ce628d
Silence warnings from dbus-analyze-functions.py about calling 'raise' on a
Will Thompson <will.thompson@collabora.co.uk>
parents:
19710
diff
changeset
|
566 except MyException: |
22079
7ec5b5724a05
Disable the DBus "Functions not exported" list. It's huge and buries the
Richard Laager <rlaager@wiktel.com>
parents:
21038
diff
changeset
|
567 # sys.stderr.write(myline + "\n") |
7ec5b5724a05
Disable the DBus "Functions not exported" list. It's huge and buries the
Richard Laager <rlaager@wiktel.com>
parents:
21038
diff
changeset
|
568 pass |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 except: |
22079
7ec5b5724a05
Disable the DBus "Functions not exported" list. It's huge and buries the
Richard Laager <rlaager@wiktel.com>
parents:
21038
diff
changeset
|
570 # sys.stderr.write(myline + "\n") |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 raise |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 self.flush() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 class ServerBindingSet (BindingSet): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 def __init__(self, inputfile, fprefix): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 BindingSet.__init__(self, inputfile, fprefix) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 self.functions = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 def processfunction(self, functiontext, paramtexts): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 binding = ServerBinding(functiontext, paramtexts) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 binding.process() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 self.functions.append((binding.function.name, binding.dparams)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 def flush(self): |
15823 | 587 print "static PurpleDBusBinding bindings_DBUS[] = { " |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 for function, params in self.functions: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 print '{"%s", "%s", %s_DBUS},' % \ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 (ctopascal(function), params, function) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 print "{NULL, NULL, NULL}" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 print "};" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 |
15823 | 595 print "#define PURPLE_DBUS_REGISTER_BINDINGS(handle) purple_dbus_register_bindings(handle, bindings_DBUS)" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 class ClientBindingSet (BindingSet): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 def __init__(self, inputfile, fprefix, headersonly): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 BindingSet.__init__(self, inputfile, fprefix) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 self.functions = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 self.knowntypes = [] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 self.headersonly = headersonly |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 def processfunction(self, functiontext, paramtexts): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 binding = ClientBinding(functiontext, paramtexts, self.knowntypes, self.headersonly) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 binding.process() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 def flush(self): |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 pass |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 # Main program |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
613 options = {} |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 for arg in sys.argv[1:]: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 if arg[0:2] == "--": |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 mylist = arg[2:].split("=",1) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 command = mylist[0] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 if len(mylist) > 1: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
620 options[command] = mylist[1] |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 else: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 options[command] = None |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 if "export-only" in options: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 fprefix = "DBUS_EXPORT\s+" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 else: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 fprefix = "" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 |
22079
7ec5b5724a05
Disable the DBus "Functions not exported" list. It's huge and buries the
Richard Laager <rlaager@wiktel.com>
parents:
21038
diff
changeset
|
629 #sys.stderr.write("%s: Functions not exported:\n" % sys.argv[0]) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 if "client" in options: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 bindings = ClientBindingSet(sys.stdin, fprefix, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 options.has_key("headers")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 else: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 bindings = ServerBindingSet(sys.stdin, fprefix) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 bindings.process() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 |