[Xcb] progress with generator fixes for xkb ( Re: [PATCH proto xkb] Fixes for xkb.xml )

Christian Linhart chris at DemoRecorder.com
Fri Feb 21 08:03:14 PST 2014


Hi again Ran,

I have worked on the problems of the generator with "xkb.xml + patches from my previous mail".

So far, I have identified the following three problems:

1. The generator did not support structs which contain only variable-sized fields.
     This has caused the empty struct xcb_xkb_property_t.

     I have made a first patch for c_client.py in libxcb to fix this, which is attached to this mail.
     The patch makes xcb_xkb_property_t a "typedef void", and causes serialize and sizeof functions to be generated for xcb_xkb_property.
     Also, the serialize function does not have an _aux parameter because it is not used in that case.
     ( It is not used because there are no fixed size fields to read from the _aux parameter. )


2. When var-sized structs are passed to serialize functions ( or to request functions ),
     then that function assumes that the struct is serialized, but it lists the struct type on the parameter list.

     for example:

         int
         xcb_xkb_property_serialize (void                        **_buffer  /**< */,
                             xcb_xkb_counted_string_16_t  *name  /**< */,
                             xcb_xkb_counted_string_16_t  *value  /**< */);


     It should list these parameters as "void*". ( like it is done with "switch" data when passed to such functions. )

     for example:
         int
         xcb_xkb_property_serialize (void                        **_buffer  /**< */,
                             void  *name  /**< */,
                             void  *value  /**< */);


     Or we could make the code a bit more readable by using typedefs to void*, e.g.:

         typedef void* xcb_xkb_counted_string_16_serialized_t;

         [...]

         typedef void* xcb_xkb_property_serialized_t;

         [...]

         int
         xcb_xkb_property_serialize (xcb_xkb_property_serialized_t                        *_buffer  /**< */,
                             xcb_xkb_counted_string_16_serialized_t  *name  /**< */,
                             xcb_xkb_counted_string_16_serialized_t  *value  /**< */);

     I have not yet made a patch for that.


3. Types like xcb_xkb_counted_string_16_t do not have a serialize function yet, but it would be needed in order to generate serialized data for such types.

     I have not yet made a patch for that, either.


So, this is work in progress.

I'd like to get your comments on that in order to check whether I am working in a good direction.

Have a nice weekend,

Chris

P.S: Sorry that my previous email was formatted in HTML which the archiver converts to an attachment.
This mail is in plain text ( if my mailer handles this correctly )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-generator-support-structs-with-only-varsize-fields.patch
Type: text/x-patch
Size: 6817 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20140221/e107f106/attachment.bin>


More information about the Xcb mailing list