<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi there, <br>
<br>
sorry for not noticing that the reply-to would not direct my thanks via
the dbus-list, which I would like very much, giving the great help Mike
Gorse has given! Kudos to Mike!<br>
<br>
---rony<br>
<br>
<br>
-------- Original Message --------
<table class="moz-email-headers-table" border="0" cellpadding="0"
cellspacing="0">
<tbody>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject: </th>
<td>Re: Request for pointers/hints for processing container
arguments ...</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date: </th>
<td>Tue, 21 Jun 2011 21:52:07 +0200</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">From: </th>
<td>rony <a class="moz-txt-link-rfc2396E" href="mailto:rony@wu.ac.at"><rony@wu.ac.at></a></td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Organization:
</th>
<td>WU Wien</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">To: </th>
<td>Mike Gorse <a class="moz-txt-link-rfc2396E" href="mailto:mgorse@novell.com"><mgorse@novell.com></a></td>
</tr>
</tbody>
</table>
<br>
<br>
<pre>Mike:
super, thank you *very, very* much for your kind explanations, they
really help a *lot* !
This is more than enough "food for thoughts" helping really a lot to go
more systematically over the documentation once more!
(Your DBUS_TYPE_DICT example is really just extremely instructional!)
Best regards,
---rony
On 21.06.2011 20:42, Mike Gorse wrote:
> Hi Rony,
>
> Basically you can use dbus_message_iter_open_container and
> dbus_message_iter_close_container to write structs/dicts/arrays and
> dbus_message_iter_recurse to read them. Dictionaries have a
> DBUS_TYPE_DICT (which wants a type that should look something like
> {ss}) containing entries (which want a type of NULL). To write a
> struct, you can use something like
>
> dbus_message_iter_open_container (&iter, DBUS_TYPE_STRUCT, NULL,
> &iter_struct);
> // use dbus_message_iter_append_basic on iter_struct to write your data
> dbus_message_iter_close_container (&iter, &iter_struct);
>
> where "iter" is a DBusMessageIter that you've initialized. For a
> dictionary with strings for the key and value, you'd have something like
>
> dbus_message_iter_open_container (&iter, DBUS_TYPE_DICT< "{ss}",
> &iter_dict);
> while (more_entries_to_write) {
> dbus_message_iter_open_container (&iter_dict, DBUS_TYPE_DICT_ENTRY,
> NULL, &iter_dict_entry);
> dbus_message_iter_append_basic (&iter_dict_entry, DBUS_TYPE_STRING,
> &key);
> dbus_message_iter_append_basic (&iter_dict_entry, DBUS_TYPE_STRING,
> &val);
> dbus_message_iter_close_container (&iter_dict, &iter_dict_entry);
> }
> dbus_message_iter_close_container (&iter, &iter_dict);
>
> Arrays can be handled similarly and want a type argument (ie, "i" for
> integers), but they can also be handled with the functions you
> mentioned. Variants are similar and also want the type to be specified
> when opening the container.
>
> Also, these functions have return values to return errors if they run
> out of memory.
>
> Hth,
> -Mike
>
> On Tue, 21 Jun 2011, rony wrote:
>
>> Hi there,
>>
>> my name is Rony and I have started to write a language binding for a
>> scripting language named ooRexx (<a class="moz-txt-link-freetext" href="http://www.ooRexx.org">http://www.ooRexx.org</a>). Hence, despite
>> all well-meant warnings, I have to delve into the C bindings in order to
>> successfully create the binding (starting out for Linux, but aiming also
>> on porting later to MacOSX and Windows).
>>
>> In the process of doing so I have studied the specs, tutorials and
>> Matthew Johnsons's *great tutorail* (however, the link on
>> <a class="moz-txt-link-rfc2396E" href="http://www.freedesktop.org/wiki/Software/dbus"><http://www.freedesktop.org/wiki/Software/dbus></a> to his tutorial at
>> <a class="moz-txt-link-rfc2396E" href="http://dbus.freedesktop.org/doc/dbus/libdbus-tutorial.html"><http://dbus.freedesktop.org/doc/dbus/libdbus-tutorial.html></a> is dead,
>> but I managed to get a version on his web site), which has helped me
>> a lot.
>>
>> Currently I am involved in writng the code for processing the ooRexx
>> arguments for DBus which now work for all simple types (using
>> dbus_message_iter_append_basic(...)).
>>
>> The next step is to deal with the container types variant, arrays,
>> structs and dicts. While studying the specification and the methods in
>> DBusMessage (like dbus_message_iter_get_array_len(*iter) or
>> dbus_message_iter_get_fixed_array(*iter, void *value, int *n_elements),
>> but also dbus_message_iter_append_fixed_array(*iter, int element_type,
>> const void *value, int n_elements) etc.) it is the case that I still am
>> not able to understand how exactly these types have to be processed.
>>
>> Any little program/snippet or pseudo code would help me a lot and hence
>> turning to this list of experts to ask for help!
>>
>> If you have pointers to any plain C code (glib's binding won't help me
>> unfortunately) or would be kind enough to simply sketch in scarce
>> pseudocode how to create those container values for message arguments, I
>> would *really* appreciate it a lot!
>>
>> TIA,
>>
>> ---rony
>>
>> P.S.: If anyone has anything comparable to Matthew Johnson's tutorial,
>> but demoing how to process container values, that would be a boon!
>>
>>
>> _______________________________________________
>> dbus mailing list
>> <a class="moz-txt-link-abbreviated" href="mailto:dbus@lists.freedesktop.org">dbus@lists.freedesktop.org</a>
>> <a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/mailman/listinfo/dbus">http://lists.freedesktop.org/mailman/listinfo/dbus</a>
>></pre>
<br>
</body>
</html>