[Xcb] sizeof paramters for length less lists

chris at demorecorder.com chris at demorecorder.com
Thu Feb 26 22:55:23 PST 2015

Hi Peter,

Peter Harris wrote on 26.02.2015 17:45:

> On 2015-02-26 01:58, chris at demorecorder.com wrote:
> I'm confused. Earlier you said "so, don't use "(length - 3)/2" inside,
> but use rectangles_len", and then you went to a lot of manual effort to
> define rectangles_len as "(length - 3)/2".
It is needed for other functions, such as:

> Given that rectangles_len is already implied by a list with no length,
> and given that creating all the <op>s by hand is error prone, I'd rather
> leave the XML as-is.
> If the generator needs this <op> block for something, shouldn't it be
> calculated from the rest of the request and inserted by an earlier pass
> in the generator? 
That's a really good idea.

It can be implemented in xcb/proto/xcbgen at a place where
parsing and post-processing of a request is finished.
There something like the following can be implemented:
  If a request contains a list without length
  and if the request has only fixed-size fields besides that list
  and if the list members are fixed size,
  then generate a suitable expression like:
     ( length*4 - total_size_of_fixed_size_fields ) / size_of_listmember

Computing the expression in xcb/proto has the advantage
that all generators will be able to use it.
( such as the generator written by Asalle for doing checking
and byteswappig for the X-Server )

So, I suggest to move forward as follows:
* Jaya, please continue to use the modified XML with the list-length expression
  for your testing for getting the generator-side working correctly.
  As far as I can tell, only the sizeof function needs to be fixed.
  (Everything else works already correctly as far as I can tell.)

* Then, somebody adds the code to xcb/proto/xcbgen to compute the
  expression automatically. Jaya, would you like to do that?
  (I can also do it, but before I need to make a patch for the 64-bit sequence-numbers
  that fixes a bug that's already unfixed for too long.) 

* Then it will work correctly without changing the xml.

> Or did I miss something?
No, You didn't miss anything.

Thank you for your idea to make it better.



> Peter Harris
> -- 
>               Open Text Connectivity Solutions Group
> Peter Harris                    http://connectivity.opentext.com/
> Research and Development        Phone: +1 905 762 6001
> pharris at opentext.com            Toll Free: 1 877 359 4866

More information about the Xcb mailing list