human-readable signatures

Havoc Pennington hp at redhat.com
Fri Feb 4 19:12:04 PST 2005


Hi,

There's a problem with the signature format that it isn't really human-
readable. The reason is that too many of the types start with the same
letter. So "si" = string,int32 is good, but "yq" = byte,uint16 you
wouldn't quite guess.

I addressed this in the API with macros; they are kind of obnoxious to
type, but hopefully concealed by language bindings.

However, the "IDL" use case of the introspection format, or the command
line tools such as dbus-send, could use a more readable form.

We could add API like this:

 char* dbus_signature_to_readable   (const char *signature);
 char* dbus_signature_from_readable (const char *readable_signature);

The readable format could be something like:

 "si" -> "string,int32"
 "yq" -> "byte,uint16"
 "(si)" -> "(string,int32)"
 "a(si)" -> "array,(string,int32)"
 "aa(si)" -> "array,array,(string,int32)"

This is very simple; the typecodes are expanded and comma-separated, the
parens left as-is. It isn't _that_ human-friendly still but easy to
convert to the real signature format.

There are other options, such as:
 "array<int32>" "array<(string,int32)>" "array<array<(string,int32)>>"

But already that's harder to parse, and the <> sucks for command line
tools.

Something else to consider is that we could allow the human readable
form as arguments to the dbus-message.h API. On balance I don't really
think this is a good idea; it adds complexity and "tmtowtdi" that I'd
rather avoid.

Havoc




More information about the dbus mailing list