[Xcb] [PATCH libxcb 4/4 V3] generator: fix align-pads for switches which start at unaligned pos

Christian Linhart chris at DemoRecorder.com
Thu Sep 11 05:42:37 PDT 2014

On 09/11/14 08:10, Christian Linhart wrote:
> Hi Ran,
> On 09/10/14 19:10, Ran Benita wrote:
>> On Tue, Sep 09, 2014 at 11:26:40PM +0200, Christian Linhart wrote:
>>> V3: patch revised according to suggestion by Ran Benita:
>>> * only create and use xcb_padding_offset for switch
>> It's always unfortunate when c_client.py becomes even more obscure.. 
> Yes, I agree.
> This could be remedied by refactoring the generator using OO-design,
> e.g.,. replacing nested structures of tuples and lists by classes, etc.

I have found another way to simplify the generator:
Several things that are currently done by the generator
can and should be done by the parser.
These are things that will be needed by all generators and
are independent on the output-language.

One of these things are symbol-table lookups
which are currently partially done by the parser
and partially done by the generator.

In connection with "sumof" I have just found out that
by adding *one* line of code to the parser ( xcb/proto/xcbgen/expr.py )
I can replace 8 lines by 1 line in the generator,
(and it'll make all other generators simpler, too.)

This refactoring can be done gradually, so it is more feasible 
than a big OO-refactoring of the code.

I'll add that one thing for "sumof" to my patchset which deals with "sumof".


More information about the Xcb mailing list