[Xcb] bind from XML (was: Objective-C binding)

Jamey Sharp jamey at minilop.net
Fri May 12 19:55:46 PDT 2006


On Fri, May 12, 2006 at 06:53:46PM -0700, Ian Osgood wrote:
> On May 12, 2006, at 2:48 PM, Florent Monnier wrote:
> >           child: WINDOW or None
> > ...
> > I am not sure at all of this but perhaps it should be a little bit
> > more strict for OCaml users, for exemple switching to:
> >      <field type="WINDOW option" name="child" />

Except of course embedding ML type names is no good. It should clearly
be "Maybe WINDOW".

/me starts a language war and runs away.

But seriously, note that you should always be able to lift an integer
into a WINDOW, or else other bad things will happen. So the protocol
description as it stands doesn't prevent any valid programs from being
written.

Also, having to parse type strings in the code generator is not good. So
some more XML-ish approach like those Ian proposes would be necessary,
and we won't wind up with either ML or Haskell syntax in the protocol
descriptions. :-)

> I think this is a very fine idea!

I'm hesitant to get too excited about it, since it's not actually
necessary for any language binding, as far as I know. It may not even be
usable for its intended purpose unless we're very careful. As a general
principle it'd be nice for the descriptions to be as complete as
possible, though, especially for generating documentation and such.

> d) a combination of derived types (drawable, which means WINDOW or
> PIXMAP)

... or Glx:PIXMAP or possibly other things, apparently. This is tricky.

> I'm not sure which XML constructs can best describe all these kinds  
> of types.

A fairly traditional approach would use an attribute for the simplest
cases, but allow the use of a child element instead for more complex
ones.

In CreateWindow:
<field type="WINDOW" name="wid" />

In the KeyPress event:
<field name="child">
  <type>WINDOW</type>
  <const>0</type>
</field>

Or, you know, something.

> The other type hole is in value lists.  They consist of CARD/INT32s,
> but the meaning of each item in the list is dependent on the bits set
> in the  mask.  Xlib hides value lists behind structures, so the
> individual fields are typed,  but the raw lists are exposed in XCB.

Yup. :-/

--Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20060512/dcddf26c/attachment-0001.pgp


More information about the Xcb mailing list