[Xcb] size annotations for XML-XCB, and other tools

Jamey Sharp jamey at minilop.net
Tue Jun 13 02:52:37 PDT 2006


Hey folks,

I've just committed a small Python script that annotates one or more
XML-XCB protocol descriptions with the size in bytes of every <field>.
Josh and I have been saying to each other for a while that we need to
know how big protocol objects are to generate correct/better code (for
bug #6105, for example), so I thought I'd have a go at it. See:
	xcb-proto/src/size.py

Invoke it with paths to protocol descriptions that it should process.
The script is single-pass, so types must be declared before reference.
It doesn't currently handle the <include> tag or the implicit inclusion
of xcb_types and xproto, so you have to list all the relevant
descriptions and get them in the right order. For example, if you want
to examine the GLX extension:
	./size.py xcb_types.xml xproto.xml extensions/glx.xml
If you're interested in COMPOSITE, though, you need:
	./size.py xcb_types.xml xproto.xml \
		extensions/render.xml extensions/shape.xml \
		extensions/xfixes.xml extensions/composite.xml

The annotated output goes to stdout. I probably have the extension
namespace handling wrong, but it seemed to get correct answers for the
cases I briefly inspected.

I envision a small suite of tools like this that produce certain generic
analyses of protocol descriptions and can be shared between language
bindings. These tools seem immediately useful to me:
 - Inline <import>ed descriptions, plus xcb_types and xproto.
 - Insert request/response boilerplate (e.g. length field).
 - Insert <pad> tags where they can be inferred.

Enhancements, suggestions, etc. welcome.

--Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20060613/c27c8791/attachment.pgp


More information about the Xcb mailing list