[Xcb] xproto test failed

Antoine Latter aslatter at gmail.com
Mon Feb 16 18:57:15 PST 2009

On Mon, Feb 16, 2009 at 8:46 PM, Peter Harris <git at peter.is-a-geek.org> wrote:
> On Mon, Feb 16, 2009 at 6:39 PM, Barton C Massey wrote:
>> So, yes. :-) It seems like it might be nice to modify the C
>> codegen to use the new annotations also, though?  Can't the
>> new annotations be used to do things like automatically
>> generate union types for altenums?  Or am I still confused?
> I think you're still confused. "altenum" is for types like "WINDOW,
> but may also contain the magic values None or CopyFromParent", or
> "ATOM, but may also contain the magic value Any". So on the C side, it
> needs to be an XID.
> If you make a union out of that, the compiler is free to turn the XID
> part into garbage, and then your on-wire will be broken (unless you
> start adding flags to indicate which part of the union you used, which
> would break the current API and ABI, and just generally make libxcb
> harder to use).
> Honestly, altenum wasn't my idea. But it's not a terrible idea, and I
> figured I could get more discussion out of implementing it than by
> trying to attract more people to this thread (linked to the message
> that prompted me to cook up 'altenum'):
> http://lists.freedesktop.org/archives/xcb/2009-January/004226.html
> That thread just died as soon as I proposed altenum.
> It's not too late to decide that 'altenum' sucks, and we should just
> use 'enum'. I kinda like the idea of altenum, but I'm not married to
> it.
> It's also not too late to change the name of altenum. 'partenum'?
> 'xidenum'? 'enumref'? 'bikeshed'? :-)
> Once I finish this pass of annotations (both to xproto and the
> extensions), my Grand Plan is to start adding type annotations to
> enums themselves, and attach those enums to <valueparam>s. This would
> allow us to auto-generate xcb/util/aux's xcb_aux_create_window (and
> xcb_params_cw_t) and friends if we wanted to. But that's in the rather
> distant future (unless someone else steps in, of course).
>> Thanks huge for working on this.
> Thanks huge for reviewing all of this.
> Peter Harris

For some context:

I plan on using the attribute over in Haskell-land, and right now the
idea is to use the referenced enum to build constants of type 'WINDOW'
or 'TIMESTAMP' or whatever is appropriate.

Long term when the Haskell code can generate documentation as well,
this attribute will also be nice.

Also, I'm interested in helping work towards the value-param grand
vision.  It sounds like a great idea and I am eager to use the fruits
of the project.


More information about the Xcb mailing list