[Xcb] XML-XCB: language-neutral bit constants

Ian Osgood iano at quirkster.com
Tue Mar 14 17:13:52 PST 2006

On Mar 14, 2006, at 3:49 PM, Jamey Sharp wrote:

> On Tue, Mar 14, 2006 at 11:23:46AM -0800, Ian Osgood wrote:
>> On Tue, 14 Mar 2006, Ian Osgood wrote:
>>>> We should strive to be language-neutral in the protocol
>>>> definitions, right?
> Certainly...
>>>> <op="&lt;&lt;"> is 1) ugly 2) repetitious
> No argument there.
>>>> 3) C-specific.
>> <bit> is for addressing a bit in a word.  The C idiom is (1<<n), but
>> other languages name this "shl(1,n)" or have built in bit addressing
>> syntax (Pascal, Modula, and Oberon's sets for instance).
> But I don't think I agree with this. It's not hard to pattern-match
> these cases in the existing XML. An XPath expression something like  
> this
> should do it (though my XPath is rusty):
> op[@op="&lt;&lt;" and value[1]="1"]/value[2]

Um... yeah. (I know almost nothing about XPath.) That's fine then.

> That said, your other two reasons are probably sufficient.
>>> I came up with <bit bit="n"/>, which replaces:
>>> <op op="&lt;&lt;"><value>1</value><value>n</value></op>
>>> Unless there are objections, I'll push my changes to xproto.xml,
>>> xcb.xsd, and c-client.xsl.
> I assume your changes to xproto.xml involve demonstrating how to use
> <bit>? It'd be good to commit that after committing the xsl/xsd  
> changes.

Yes, prettying the one existing Create/ChangeWindow <enum>, CW.

In de-X.h-ifying xcb-utils, I'm also adding new <bit> enums for event  
masks and ConfigureWindow masks (*also* lovingly prefixed CW in X.h;  
changing to ConfigWindow).

(We might consider not naming the enums.  I can't name the enum  
"ConfigureWindow" because it conflicts with the protocol request.  
Apple uses unnamed enums for all their error codes and things, for  

>> I'm adding a convenience function for one usage of the op="&lt;&lt;"
>> tag (see above).   <op> itself is unmodified.  I realize that
>> changing the name of operators &amp; and &lt;&lt; would result in
>> lots of breakage in the extensions.
> If there's a strong argument for changing the operator names, we can
> accept multiple names for the same operator, to provide time for a
> transition.
> --Jamey

If there is an XPath solution, then I won't bother.  <bit> replaces  
most uses, anyway.


P.S. Is there a mechanism to inject comments into the generated files?

More information about the Xcb mailing list