[Xcb] put description of valueparams in xml files

Thomas Hunger hto at arcor.de
Wed Jun 6 15:16:42 PDT 2007


Hello, 

Mark Seaborn wrote a protocol-tracer, see:
http://lists.freedesktop.org/archives/xcb/2007-May/002790.html

To allow for readable output of the valueparam argument he introduced 
an additional attribute "bitfield" in the valueparam:

  <valueparam value-mask-type="CARD32"
              value-mask-name="value_mask"
              value-list-name="value_list"
              bitfield="window_attributes" />

"bitfield" references another xml-list like this:

  <bitfield name="window_attributes">
    <bit number="0" 
         type="PIXMAP / 0=None 1=ParentRelative" name="back_pixmap" />
    <bit number="1" type="CARD32" name="back_pixel" />
    <bit number="2" 
         type="PIXMAP / 0=CopyFromParent" name="border_pixmap" />
    ....
  </bitfield>

This can be useful for other things besides tracers: validation or 
languages with named parameters (e.g. Python). It also serves as 
documentation. 

It has some overlap with the enumeration which describes the bits for 
the value-mask (in this case the enum CW) though.

I have the following two-part idea: An extra tag for valueparam-enums. 
E.g. replace:

  <enum name="CW">
    <item name="BackPixmap">      <bit>0</bit></item>

with

  <valueparam_enum name="CW">
    <item name="BackPixmap" type="PIXMAP">      <bit>0</bit></item>

In addition to that we allow fields which have enum values to 
reference these values. E.g.:

<valueparam enum_ref="CW" ...>
<item type="CARD32" name="WinGravity" enum_ref="Gravity"/>
<field type="CARD8" name="image_byte_order" enum_ref="ImageOrder"/>
...

What do you think?

Tom


More information about the Xcb mailing list