[Xcb] Python X11 encoder/decoder based on XCB

Thomas Hunger hto at arcor.de
Tue May 8 12:03:02 PDT 2007


On Tuesday 08 May 2007 06:36, Barton C Massey wrote:
> Very cool.  Thanks much for sharing this.
>
> Being too lazy to download the code right now :-), what did
> you do about reading the XCB protocol definitions?  Did you
> do your own parser etc?  I ask because we have a Google
> Summer of Code student working on Python code to read these
> things, and I'm sure he'll be interested :-).

I am! The code is very nice. It uses lxml.etree which is a 
reimplementation of elementtree which I use (lxml is build on top of 
libxml2).

The basic parsing structure is not very different from what I do. A 
function "make_struct_part_handler" takes the current tree-node. This 
function returns an instance of a class for each field. The instance 
knows how to decode a request.

In my case the instance outputs the c-code (a bit more complicated, 
since it also needs to pad or add parameters automagically in some 
cases).

Tom


More information about the Xcb mailing list