On Thu, Sep 14, 2017 at 6:30 AM, Richard Tobin <richard@inf.ed.ac.uk> wrote:
> I really kind of liked that toolkit, it was all key/value like so:
>
>         panel = xv_create(
>           frame, PANEL,
>             XV_WIDTH, WIDTH,
>           XV_HEIGHT, 30,
>             PANEL_LAYOUT, PANEL_HORIZONTAL,
>             XV_SHOW, FALSE,
>           NULL);
>
> So the order of the args didn't really matter, I think the first one
> maybe did because that was the parent but not sure, the rest could
> be any order you wanted.  Pretty simple.

The first two were fixed; the prototype was

  Xv_object xv_create (Xv_opaque owner, Xv_pkg *pkg, ...);

The keywords (XV_WIDTH etc) contained a bitfield encoding the type and
cardinality of the value argument(s) so that the argument list could
be traversed without knowing every package's keywords.

Using NULL as the terminating argument looks unportable.

It turned out to be portable enough. And no worse than calloc dependencies in the base X11 library (which assumes that the address used when the integer 0 is assigned to a pointer has no bits set). The only other assumption was that pointers and ints were passed the same way, and that whatever NULL expanded to was at least as long as an int.

So, yes this wouldn't work on a system whose null-pointer representation contained bits set, but that was already an assumption of X11...

Warner