[Xcb] Proposal: Link fields to enums in the protocol XML files

Peter Harris pharris at opentext.com
Tue Jan 6 08:50:14 PST 2009

Antoine Latter wrote:
> Back to the topic at hand - my issue is that
>  <field type="CARD32" enum="GrabMode" />
> to me reads:  "Send a CARD32 over the wire whose range of allowed
> values is found in the enum GrabMode"

That's how I would read it.

> Whereas the proposed syntax for non-CARD types would be:
>  <field type="WINDOW" enum="EventDest" />
> Which to me would read: "Send a valid WINDOW down the wire, or an
> entry in the EventDest enum"

That's how I would read it.

> I propose using a different attribute on the field element for the
> second case, since we mean something different.

Since it is intended to mean what you expected it to mean, I'm not sure
I see where the objection is coming from.

>  Then I don't have to
> care that CARD32 is a base type but TimeStamp and WINDOW are not.

Oh, I see. Your objection is that the second means something different
from the first, not that the second means something different from what
you expect.

So what is your suggested syntax for the 2nd case?

Something like:
<enum name="EventDest" type="WINDOW">
<field type="WINDOW" enum="SendEventDest" />

We can't drop type="WINDOW" from <field> without breaking the existing

Or something more like:
<field type="WINDOW" altenum="SendEventDest" />

(with altenum being short for alternate-enum, or similar)? This does
clearly differentiate CARD32 inclusive vs exhaustive enums without the
need for artificial typedefs.

I think I prefer this alternative. A quick grep doesn't turn up any
place where only high bits are used (implying an integer value with
optional flags), so I don't think there's a need for altmask.

> Sorry to get picky over small points.  I'm sure I can deal with it either way.

No need to be sorry at all. This is the right time to get picky. Once
people start depending on syntax, it gets a lot harder to go back and
change everything.

Thanks for being picky,
 Peter Harris
               Open Text Connectivity Solutions Group
Peter Harris                    http://www.opentext.com/connectivity
Research and Development        Phone: +1 905 762 6001
pharris at opentext.com            Toll Free: 1 877 359 4866

More information about the Xcb mailing list