[PATCH wayland] connection: Print the content of arrays in closures

Pekka Paalanen ppaalanen at gmail.com
Tue Feb 27 12:59:27 UTC 2018


On Tue, 27 Feb 2018 12:39:59 +0000
Daniel Stone <daniel at fooishbar.org> wrote:

> Hi,
> 
> On 4 December 2017 at 08:08, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> > On Fri, 1 Dec 2017 17:08:15 +0000 Daniel Stone <daniel at fooishbar.org> wrote:  
> >> On 10 July 2017 at 19:28, Emmanuel Gil Peyrot
> >> <emmanuel.peyrot at collabora.com> wrote:  
> >> > The current behaviour when WAYLAND_DEBUG is set is to print “array”,
> >> > which is quite unhelpful.
> >> >
> >> > This patch prints a list of the bytes present in the array.  It doesn’t
> >> > try to interpret it as uint32_t or anything, leaving that to the reader
> >> > because this information isn’t present in the protocol description.  
> >>
> >> To be honest, I'm not really wild about this one. All the array users
> >> I know of (key/button, xdg surface states) are uint32_t. I'd prefer to
> >> add a pretty-printing hint to the protocol - this could specify how to
> >> interpret arrays, and also scratch my long-standing itch of printing
> >> uints with %x rather than %u when it makes sense to ...  
> >
> > just a side note, if you start working on that, do also think of
> > bindings for (strongly) typed languages. ISTR requests to add type
> > information so that better bindings could be generated, and the
> > problem was where to stop defining the type system. I'm pretty sure if
> > printing hints are added, people will use them for bindings, whether we
> > wanted or not.  
> 
> Here's a strawman.
> 
> Since libwayland allows the signature to contain unknown/new values,
> as a hint, optionally allow the 'a' type to be preceded by:
>   - one character of either 'X', 'I', or 'U', indicating respectively
> that the value should be pretty-printed as hexidecimal / signed int /
> unsigned int, followed by
>   - either '1', '2' or '4' to indicate the byte width of the type
> (respectively 8/16/32 bits)

What about 64-bit integers, and float and double? I think the
touchscreen calibration extension will use an array of doubles.

> Similarly, allow the 'u' type to be preceded by 'X' indicating that
> the value should be pretty-printed in hex.

Sounds ok to me.

An alternative proposal is to just print whatever format that could be
fed into od or hexdump, which would avoid the feature creep in
libwayland and message signatures.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180227/157811b1/attachment.sig>


More information about the wayland-devel mailing list