summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Sales de Andrade <qulogic@pidgin.im>2009-01-27 04:54:13 +0000
committerElliott Sales de Andrade <qulogic@pidgin.im>2009-01-27 04:54:13 +0000
commit14ac030847703a34a9cae06dde9b2de83f65ff2e (patch)
tree8c480c9e7910cbb8fc04d9dfb43b3fd55089bd53
parent1b7eff491cbe52ed368c0df0f7aab947fc8f90ad (diff)
downloadpidgin-14ac030847703a34a9cae06dde9b2de83f65ff2e.tar.gz
Add special handling to the Python D-Bus parsing code for the *_get_data
functions. They return the data as a DBus array of bytes, instead of not actually exporting the functions at all.
-rw-r--r--libpurple/dbus-analyze-functions.py33
1 files changed, 31 insertions, 2 deletions
diff --git a/libpurple/dbus-analyze-functions.py b/libpurple/dbus-analyze-functions.py
index 87c6ea6bd6..fe330cec97 100644
--- a/libpurple/dbus-analyze-functions.py
+++ b/libpurple/dbus-analyze-functions.py
@@ -117,7 +117,7 @@ class Binding:
self.params.append(Parameter.fromtokens(paramtexts[i].split(), i))
self.call = "%s(%s)" % (self.function.name,
- ", ".join([param.name for param in self.params]))
+ ", ".join(param.name for param in self.params))
def process(self):
@@ -160,6 +160,10 @@ class Binding:
elif type[0].startswith("Purple") or type[0] == "xmlnode":
return self.inputpurplestructure(type, name)
+ # special case for *_get_data functions, be careful here...
+ elif (type[0] == "size_t") and (name == "len"):
+ return self.inputgetdata(type, name)
+
# unknown pointers are always replaced with NULL
else:
return self.inputpointer(type, name)
@@ -196,6 +200,10 @@ class Binding:
if type[0] in ["GList", "GSList"]:
return self.outputlist(type, name)
+ # Special case for *_get_data functions
+ if type[0] == "gconstpointer":
+ return self.outputgetdata(type, name)
+
raise myexception
@@ -309,7 +317,13 @@ class ClientBinding (Binding):
self.returncode.append("return garray_int_to_%s(%s);" %
(type[0].lower(), name));
-
+ # Special case for *_get_data functions, don't need client bindings,
+ # but do need the name so it doesn't crash
+ def inputgetdata(self, type, name):
+ raise myexception
+ def outputgetdata(self, type, name):
+ raise myexception
+
class ServerBinding (Binding):
def __init__(self, functiontext, paramtexts):
Binding.__init__(self, functiontext, paramtexts)
@@ -475,6 +489,21 @@ class ServerBinding (Binding):
% (name, name))
self.addouttype("ai", name)
+ # Special case for *_get_data functions
+ def inputgetdata(self, type, name):
+ self.cdecls.append("\tsize_t %s = 0;" % name)
+ return True
+ def outputgetdata(self, type, name):
+ # This is a total hack, but self.call is set up before the parameters
+ # are processed, so we can't tell it to pass a parameter by reference.
+ self.call = "%s(%s)" % (self.function.name,
+ ", ".join(param.name if param.name != "len" else "&len" for param in self.params))
+
+ self.cdecls.append("\tgconstpointer %s;" % name)
+ self.ccode.append("\t%s = %s;" % (name, self.call))
+ self.cparamsout.append("DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &%s, %s" \
+ % (name, "len"))
+ self.addouttype("ay", name)
class BindingSet:
regexp = r"^(\w[^()]*)\(([^()]*)\)\s*;\s*$";