There are a few issues hidden deep inside the XCB C code generator that had to be changed in order to enable parsing of the XKB protocol description. Here's a short overview:
- for Types with a variable length, a length field has to be registered with the Type system. Within the context of the newly introduced
tag, the lookup for the length field had to be extended to include all anchestor Types - in some cases, no C mapping has been defined up to now for valid XML protocol descriptions, these include 1. requests with fields that are not fixed size and not lists 2. request with list of variable-sized elements (buggy) 3. structs with fixed-size fields following variable-sized fields. These issues will be addressed by changing the way Types are serialized in the C language mapping.
- There is an interface to make value-params somewhat easier to use in the util/aux module. This interface can be made obsolete by rewriting value-params to switch (thanks to Peter Harris for pointing this out, it provides an excellent test case for <switch>
).
The changes I made to the existing code still remain to be properly documented.
It remains to give a short overview of the mapping for the new xml tags:
<enum> is simply mapped to the corresponding named integer constant in C <sumof> is mapped to a function call to xcb_sumof (newly implemented) which performs a summation of the elements of the referenced list <popcount> is mapped to a function to xcb_popcount <switch> is mapped to a series of if statements, each of the form if (switch_expr & bitcase_expr); for each a struct is generated that encompasses all named bitcase fields <bitcase> fields are serialized no different from other field, except they get a prefix (switch_struct->)
The new elements still need more testing, however I will start writing XKB utility functions within the next days. Any discussion of new interfaces takes place on the XCB mailing list, all comments are appreciated so please feel free to join :)