[Xcb] GSoC: final C code mapping for <switch>

Christoph Reimann chrr at arcor.de
Sun Jun 20 14:58:19 PDT 2010


Hello once more,
I've been thinking about Jamey's & Peter's comments and implemented a
prototype to generate the following code for switch (still buggy -
btw. sorry for the awful formatting in my first post in this thread,
it looked ok in my mail client...):

typedef struct xcb_xkb_select_events_details_t {
... all bitcase fields ...
... pointer fields for variable size data types as well...
} xcb_xkb_select_events_details_t;

/* backwards compatible request function */
xcb_void_cookie_t
xcb_xkb_select_events (xcb_connection_t *c, ..., void *details);

/* aux request function */
xcb_void_cookie_t
xcb_xkb_select_events_aux (xcb_connection_t *c, ...,

xcb_xkb_select_events_details_t *details);

/* serialize xcb_xkb_select_events_details_t to void * */
unsigned int
xcb_xkb_select_events_details_serialize(void **_buffer,
    uint16_t  selectAll, uint16_t  clear, uint16_t  affectWhich,
    const xcb_xkb_select_events_details_t *details);

The serialize function would allocate memory if NULL is supplied for
_buffer, and it has to take care about serializing all data types that
appear in switch as well (perhaps by calling further _serialize
functions). It returns the number of bytes written to buffer.
The autogeneration code for serialize is working for all kinds of
structs (and even requests, as a test case), but I have to finish the
handling of switch yet.

I think with this API all things from the wish-list mentioned so far
would be handled.
As always looking forward for comments from you,
cheers

Christoph


More information about the Xcb mailing list