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

Jeremy A. Kolb jkolb at brandeis.edu
Thu Jun 15 08:01:04 PDT 2006


This is definitely a good idea.  Good to know sizes.

I don't this seems to take into account the padding at the 
end of requests/replies when not explicitly marked.

Are we going to do the Xlib thing where each req/rep is going to have a 
#defined size?  Would that be useful?

Jeremy 

On Tue, 13 Jun 2006, Jamey Sharp wrote:

> 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
> 



More information about the Xcb mailing list