xref: /minix/external/mit/xorg/lib/libxcb/files/record.c (revision 0a6a1f1d)
1 /*
2  * This file generated automatically from record.xml by c_client.py.
3  * Edit at your peril.
4  */
5 
6 #ifdef HAVE_CONFIG_H
7 #include "config.h"
8 #endif
9 #include <stdlib.h>
10 #include <string.h>
11 #include <assert.h>
12 #include <stddef.h>  /* for offsetof() */
13 #include "xcbext.h"
14 #include "record.h"
15 
16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17 
18 xcb_extension_t xcb_record_id = { "RECORD", 0 };
19 
20 void
xcb_record_context_next(xcb_record_context_iterator_t * i)21 xcb_record_context_next (xcb_record_context_iterator_t *i  /**< */)
22 {
23     --i->rem;
24     ++i->data;
25     i->index += sizeof(xcb_record_context_t);
26 }
27 
28 xcb_generic_iterator_t
xcb_record_context_end(xcb_record_context_iterator_t i)29 xcb_record_context_end (xcb_record_context_iterator_t i  /**< */)
30 {
31     xcb_generic_iterator_t ret;
32     ret.data = i.data + i.rem;
33     ret.index = i.index + ((char *) ret.data - (char *) i.data);
34     ret.rem = 0;
35     return ret;
36 }
37 
38 void
xcb_record_range_8_next(xcb_record_range_8_iterator_t * i)39 xcb_record_range_8_next (xcb_record_range_8_iterator_t *i  /**< */)
40 {
41     --i->rem;
42     ++i->data;
43     i->index += sizeof(xcb_record_range_8_t);
44 }
45 
46 xcb_generic_iterator_t
xcb_record_range_8_end(xcb_record_range_8_iterator_t i)47 xcb_record_range_8_end (xcb_record_range_8_iterator_t i  /**< */)
48 {
49     xcb_generic_iterator_t ret;
50     ret.data = i.data + i.rem;
51     ret.index = i.index + ((char *) ret.data - (char *) i.data);
52     ret.rem = 0;
53     return ret;
54 }
55 
56 void
xcb_record_range_16_next(xcb_record_range_16_iterator_t * i)57 xcb_record_range_16_next (xcb_record_range_16_iterator_t *i  /**< */)
58 {
59     --i->rem;
60     ++i->data;
61     i->index += sizeof(xcb_record_range_16_t);
62 }
63 
64 xcb_generic_iterator_t
xcb_record_range_16_end(xcb_record_range_16_iterator_t i)65 xcb_record_range_16_end (xcb_record_range_16_iterator_t i  /**< */)
66 {
67     xcb_generic_iterator_t ret;
68     ret.data = i.data + i.rem;
69     ret.index = i.index + ((char *) ret.data - (char *) i.data);
70     ret.rem = 0;
71     return ret;
72 }
73 
74 void
xcb_record_ext_range_next(xcb_record_ext_range_iterator_t * i)75 xcb_record_ext_range_next (xcb_record_ext_range_iterator_t *i  /**< */)
76 {
77     --i->rem;
78     ++i->data;
79     i->index += sizeof(xcb_record_ext_range_t);
80 }
81 
82 xcb_generic_iterator_t
xcb_record_ext_range_end(xcb_record_ext_range_iterator_t i)83 xcb_record_ext_range_end (xcb_record_ext_range_iterator_t i  /**< */)
84 {
85     xcb_generic_iterator_t ret;
86     ret.data = i.data + i.rem;
87     ret.index = i.index + ((char *) ret.data - (char *) i.data);
88     ret.rem = 0;
89     return ret;
90 }
91 
92 void
xcb_record_range_next(xcb_record_range_iterator_t * i)93 xcb_record_range_next (xcb_record_range_iterator_t *i  /**< */)
94 {
95     --i->rem;
96     ++i->data;
97     i->index += sizeof(xcb_record_range_t);
98 }
99 
100 xcb_generic_iterator_t
xcb_record_range_end(xcb_record_range_iterator_t i)101 xcb_record_range_end (xcb_record_range_iterator_t i  /**< */)
102 {
103     xcb_generic_iterator_t ret;
104     ret.data = i.data + i.rem;
105     ret.index = i.index + ((char *) ret.data - (char *) i.data);
106     ret.rem = 0;
107     return ret;
108 }
109 
110 void
xcb_record_element_header_next(xcb_record_element_header_iterator_t * i)111 xcb_record_element_header_next (xcb_record_element_header_iterator_t *i  /**< */)
112 {
113     --i->rem;
114     ++i->data;
115     i->index += sizeof(xcb_record_element_header_t);
116 }
117 
118 xcb_generic_iterator_t
xcb_record_element_header_end(xcb_record_element_header_iterator_t i)119 xcb_record_element_header_end (xcb_record_element_header_iterator_t i  /**< */)
120 {
121     xcb_generic_iterator_t ret;
122     ret.data = i.data + i.rem;
123     ret.index = i.index + ((char *) ret.data - (char *) i.data);
124     ret.rem = 0;
125     return ret;
126 }
127 
128 void
xcb_record_client_spec_next(xcb_record_client_spec_iterator_t * i)129 xcb_record_client_spec_next (xcb_record_client_spec_iterator_t *i  /**< */)
130 {
131     --i->rem;
132     ++i->data;
133     i->index += sizeof(xcb_record_client_spec_t);
134 }
135 
136 xcb_generic_iterator_t
xcb_record_client_spec_end(xcb_record_client_spec_iterator_t i)137 xcb_record_client_spec_end (xcb_record_client_spec_iterator_t i  /**< */)
138 {
139     xcb_generic_iterator_t ret;
140     ret.data = i.data + i.rem;
141     ret.index = i.index + ((char *) ret.data - (char *) i.data);
142     ret.rem = 0;
143     return ret;
144 }
145 
146 int
xcb_record_client_info_sizeof(const void * _buffer)147 xcb_record_client_info_sizeof (const void  *_buffer  /**< */)
148 {
149     char *xcb_tmp = (char *)_buffer;
150     const xcb_record_client_info_t *_aux = (xcb_record_client_info_t *)_buffer;
151     unsigned int xcb_buffer_len = 0;
152     unsigned int xcb_block_len = 0;
153     unsigned int xcb_pad = 0;
154     unsigned int xcb_align_to = 0;
155 
156 
157     xcb_block_len += sizeof(xcb_record_client_info_t);
158     xcb_tmp += xcb_block_len;
159     xcb_buffer_len += xcb_block_len;
160     xcb_block_len = 0;
161     /* ranges */
162     xcb_block_len += _aux->num_ranges * sizeof(xcb_record_range_t);
163     xcb_tmp += xcb_block_len;
164     xcb_align_to = ALIGNOF(xcb_record_range_t);
165     /* insert padding */
166     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
167     xcb_buffer_len += xcb_block_len + xcb_pad;
168     if (0 != xcb_pad) {
169         xcb_tmp += xcb_pad;
170         xcb_pad = 0;
171     }
172     xcb_block_len = 0;
173 
174     return xcb_buffer_len;
175 }
176 
177 xcb_record_range_t *
xcb_record_client_info_ranges(const xcb_record_client_info_t * R)178 xcb_record_client_info_ranges (const xcb_record_client_info_t *R  /**< */)
179 {
180     return (xcb_record_range_t *) (R + 1);
181 }
182 
183 int
xcb_record_client_info_ranges_length(const xcb_record_client_info_t * R)184 xcb_record_client_info_ranges_length (const xcb_record_client_info_t *R  /**< */)
185 {
186     return R->num_ranges;
187 }
188 
189 xcb_record_range_iterator_t
xcb_record_client_info_ranges_iterator(const xcb_record_client_info_t * R)190 xcb_record_client_info_ranges_iterator (const xcb_record_client_info_t *R  /**< */)
191 {
192     xcb_record_range_iterator_t i;
193     i.data = (xcb_record_range_t *) (R + 1);
194     i.rem = R->num_ranges;
195     i.index = (char *) i.data - (char *) R;
196     return i;
197 }
198 
199 void
xcb_record_client_info_next(xcb_record_client_info_iterator_t * i)200 xcb_record_client_info_next (xcb_record_client_info_iterator_t *i  /**< */)
201 {
202     xcb_record_client_info_t *R = i->data;
203     xcb_generic_iterator_t child;
204     child.data = (xcb_record_client_info_t *)(((char *)R) + xcb_record_client_info_sizeof(R));
205     i->index = (char *) child.data - (char *) i->data;
206     --i->rem;
207     i->data = (xcb_record_client_info_t *) child.data;
208 }
209 
210 xcb_generic_iterator_t
xcb_record_client_info_end(xcb_record_client_info_iterator_t i)211 xcb_record_client_info_end (xcb_record_client_info_iterator_t i  /**< */)
212 {
213     xcb_generic_iterator_t ret;
214     while(i.rem > 0)
215         xcb_record_client_info_next(&i);
216     ret.data = i.data;
217     ret.rem = i.rem;
218     ret.index = i.index;
219     return ret;
220 }
221 
222 xcb_record_query_version_cookie_t
xcb_record_query_version(xcb_connection_t * c,uint16_t major_version,uint16_t minor_version)223 xcb_record_query_version (xcb_connection_t *c  /**< */,
224                           uint16_t          major_version  /**< */,
225                           uint16_t          minor_version  /**< */)
226 {
227     static const xcb_protocol_request_t xcb_req = {
228         /* count */ 2,
229         /* ext */ &xcb_record_id,
230         /* opcode */ XCB_RECORD_QUERY_VERSION,
231         /* isvoid */ 0
232     };
233 
234     struct iovec xcb_parts[4];
235     xcb_record_query_version_cookie_t xcb_ret;
236     xcb_record_query_version_request_t xcb_out;
237 
238     xcb_out.major_version = major_version;
239     xcb_out.minor_version = minor_version;
240 
241     xcb_parts[2].iov_base = (char *) &xcb_out;
242     xcb_parts[2].iov_len = sizeof(xcb_out);
243     xcb_parts[3].iov_base = 0;
244     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
245 
246     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
247     return xcb_ret;
248 }
249 
250 xcb_record_query_version_cookie_t
xcb_record_query_version_unchecked(xcb_connection_t * c,uint16_t major_version,uint16_t minor_version)251 xcb_record_query_version_unchecked (xcb_connection_t *c  /**< */,
252                                     uint16_t          major_version  /**< */,
253                                     uint16_t          minor_version  /**< */)
254 {
255     static const xcb_protocol_request_t xcb_req = {
256         /* count */ 2,
257         /* ext */ &xcb_record_id,
258         /* opcode */ XCB_RECORD_QUERY_VERSION,
259         /* isvoid */ 0
260     };
261 
262     struct iovec xcb_parts[4];
263     xcb_record_query_version_cookie_t xcb_ret;
264     xcb_record_query_version_request_t xcb_out;
265 
266     xcb_out.major_version = major_version;
267     xcb_out.minor_version = minor_version;
268 
269     xcb_parts[2].iov_base = (char *) &xcb_out;
270     xcb_parts[2].iov_len = sizeof(xcb_out);
271     xcb_parts[3].iov_base = 0;
272     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
273 
274     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
275     return xcb_ret;
276 }
277 
278 xcb_record_query_version_reply_t *
xcb_record_query_version_reply(xcb_connection_t * c,xcb_record_query_version_cookie_t cookie,xcb_generic_error_t ** e)279 xcb_record_query_version_reply (xcb_connection_t                   *c  /**< */,
280                                 xcb_record_query_version_cookie_t   cookie  /**< */,
281                                 xcb_generic_error_t               **e  /**< */)
282 {
283     return (xcb_record_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
284 }
285 
286 int
xcb_record_create_context_sizeof(const void * _buffer)287 xcb_record_create_context_sizeof (const void  *_buffer  /**< */)
288 {
289     char *xcb_tmp = (char *)_buffer;
290     const xcb_record_create_context_request_t *_aux = (xcb_record_create_context_request_t *)_buffer;
291     unsigned int xcb_buffer_len = 0;
292     unsigned int xcb_block_len = 0;
293     unsigned int xcb_pad = 0;
294     unsigned int xcb_align_to = 0;
295 
296 
297     xcb_block_len += sizeof(xcb_record_create_context_request_t);
298     xcb_tmp += xcb_block_len;
299     xcb_buffer_len += xcb_block_len;
300     xcb_block_len = 0;
301     /* client_specs */
302     xcb_block_len += _aux->num_client_specs * sizeof(xcb_record_client_spec_t);
303     xcb_tmp += xcb_block_len;
304     xcb_align_to = ALIGNOF(xcb_record_client_spec_t);
305     /* insert padding */
306     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
307     xcb_buffer_len += xcb_block_len + xcb_pad;
308     if (0 != xcb_pad) {
309         xcb_tmp += xcb_pad;
310         xcb_pad = 0;
311     }
312     xcb_block_len = 0;
313     /* ranges */
314     xcb_block_len += _aux->num_ranges * sizeof(xcb_record_range_t);
315     xcb_tmp += xcb_block_len;
316     xcb_align_to = ALIGNOF(xcb_record_range_t);
317     /* insert padding */
318     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
319     xcb_buffer_len += xcb_block_len + xcb_pad;
320     if (0 != xcb_pad) {
321         xcb_tmp += xcb_pad;
322         xcb_pad = 0;
323     }
324     xcb_block_len = 0;
325 
326     return xcb_buffer_len;
327 }
328 
329 xcb_void_cookie_t
xcb_record_create_context_checked(xcb_connection_t * c,xcb_record_context_t context,xcb_record_element_header_t element_header,uint32_t num_client_specs,uint32_t num_ranges,const xcb_record_client_spec_t * client_specs,const xcb_record_range_t * ranges)330 xcb_record_create_context_checked (xcb_connection_t               *c  /**< */,
331                                    xcb_record_context_t            context  /**< */,
332                                    xcb_record_element_header_t     element_header  /**< */,
333                                    uint32_t                        num_client_specs  /**< */,
334                                    uint32_t                        num_ranges  /**< */,
335                                    const xcb_record_client_spec_t *client_specs  /**< */,
336                                    const xcb_record_range_t       *ranges  /**< */)
337 {
338     static const xcb_protocol_request_t xcb_req = {
339         /* count */ 6,
340         /* ext */ &xcb_record_id,
341         /* opcode */ XCB_RECORD_CREATE_CONTEXT,
342         /* isvoid */ 1
343     };
344 
345     struct iovec xcb_parts[8];
346     xcb_void_cookie_t xcb_ret;
347     xcb_record_create_context_request_t xcb_out;
348 
349     xcb_out.context = context;
350     xcb_out.element_header = element_header;
351     memset(xcb_out.pad0, 0, 3);
352     xcb_out.num_client_specs = num_client_specs;
353     xcb_out.num_ranges = num_ranges;
354 
355     xcb_parts[2].iov_base = (char *) &xcb_out;
356     xcb_parts[2].iov_len = sizeof(xcb_out);
357     xcb_parts[3].iov_base = 0;
358     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
359     /* xcb_record_client_spec_t client_specs */
360     xcb_parts[4].iov_base = (char *) client_specs;
361     xcb_parts[4].iov_len = num_client_specs * sizeof(xcb_record_client_spec_t);
362     xcb_parts[5].iov_base = 0;
363     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
364     /* xcb_record_range_t ranges */
365     xcb_parts[6].iov_base = (char *) ranges;
366     xcb_parts[6].iov_len = num_ranges * sizeof(xcb_record_range_t);
367     xcb_parts[7].iov_base = 0;
368     xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3;
369 
370     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
371     return xcb_ret;
372 }
373 
374 xcb_void_cookie_t
xcb_record_create_context(xcb_connection_t * c,xcb_record_context_t context,xcb_record_element_header_t element_header,uint32_t num_client_specs,uint32_t num_ranges,const xcb_record_client_spec_t * client_specs,const xcb_record_range_t * ranges)375 xcb_record_create_context (xcb_connection_t               *c  /**< */,
376                            xcb_record_context_t            context  /**< */,
377                            xcb_record_element_header_t     element_header  /**< */,
378                            uint32_t                        num_client_specs  /**< */,
379                            uint32_t                        num_ranges  /**< */,
380                            const xcb_record_client_spec_t *client_specs  /**< */,
381                            const xcb_record_range_t       *ranges  /**< */)
382 {
383     static const xcb_protocol_request_t xcb_req = {
384         /* count */ 6,
385         /* ext */ &xcb_record_id,
386         /* opcode */ XCB_RECORD_CREATE_CONTEXT,
387         /* isvoid */ 1
388     };
389 
390     struct iovec xcb_parts[8];
391     xcb_void_cookie_t xcb_ret;
392     xcb_record_create_context_request_t xcb_out;
393 
394     xcb_out.context = context;
395     xcb_out.element_header = element_header;
396     memset(xcb_out.pad0, 0, 3);
397     xcb_out.num_client_specs = num_client_specs;
398     xcb_out.num_ranges = num_ranges;
399 
400     xcb_parts[2].iov_base = (char *) &xcb_out;
401     xcb_parts[2].iov_len = sizeof(xcb_out);
402     xcb_parts[3].iov_base = 0;
403     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
404     /* xcb_record_client_spec_t client_specs */
405     xcb_parts[4].iov_base = (char *) client_specs;
406     xcb_parts[4].iov_len = num_client_specs * sizeof(xcb_record_client_spec_t);
407     xcb_parts[5].iov_base = 0;
408     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
409     /* xcb_record_range_t ranges */
410     xcb_parts[6].iov_base = (char *) ranges;
411     xcb_parts[6].iov_len = num_ranges * sizeof(xcb_record_range_t);
412     xcb_parts[7].iov_base = 0;
413     xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3;
414 
415     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
416     return xcb_ret;
417 }
418 
419 int
xcb_record_register_clients_sizeof(const void * _buffer)420 xcb_record_register_clients_sizeof (const void  *_buffer  /**< */)
421 {
422     char *xcb_tmp = (char *)_buffer;
423     const xcb_record_register_clients_request_t *_aux = (xcb_record_register_clients_request_t *)_buffer;
424     unsigned int xcb_buffer_len = 0;
425     unsigned int xcb_block_len = 0;
426     unsigned int xcb_pad = 0;
427     unsigned int xcb_align_to = 0;
428 
429 
430     xcb_block_len += sizeof(xcb_record_register_clients_request_t);
431     xcb_tmp += xcb_block_len;
432     xcb_buffer_len += xcb_block_len;
433     xcb_block_len = 0;
434     /* client_specs */
435     xcb_block_len += _aux->num_client_specs * sizeof(xcb_record_client_spec_t);
436     xcb_tmp += xcb_block_len;
437     xcb_align_to = ALIGNOF(xcb_record_client_spec_t);
438     /* insert padding */
439     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
440     xcb_buffer_len += xcb_block_len + xcb_pad;
441     if (0 != xcb_pad) {
442         xcb_tmp += xcb_pad;
443         xcb_pad = 0;
444     }
445     xcb_block_len = 0;
446     /* ranges */
447     xcb_block_len += _aux->num_ranges * sizeof(xcb_record_range_t);
448     xcb_tmp += xcb_block_len;
449     xcb_align_to = ALIGNOF(xcb_record_range_t);
450     /* insert padding */
451     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
452     xcb_buffer_len += xcb_block_len + xcb_pad;
453     if (0 != xcb_pad) {
454         xcb_tmp += xcb_pad;
455         xcb_pad = 0;
456     }
457     xcb_block_len = 0;
458 
459     return xcb_buffer_len;
460 }
461 
462 xcb_void_cookie_t
xcb_record_register_clients_checked(xcb_connection_t * c,xcb_record_context_t context,xcb_record_element_header_t element_header,uint32_t num_client_specs,uint32_t num_ranges,const xcb_record_client_spec_t * client_specs,const xcb_record_range_t * ranges)463 xcb_record_register_clients_checked (xcb_connection_t               *c  /**< */,
464                                      xcb_record_context_t            context  /**< */,
465                                      xcb_record_element_header_t     element_header  /**< */,
466                                      uint32_t                        num_client_specs  /**< */,
467                                      uint32_t                        num_ranges  /**< */,
468                                      const xcb_record_client_spec_t *client_specs  /**< */,
469                                      const xcb_record_range_t       *ranges  /**< */)
470 {
471     static const xcb_protocol_request_t xcb_req = {
472         /* count */ 6,
473         /* ext */ &xcb_record_id,
474         /* opcode */ XCB_RECORD_REGISTER_CLIENTS,
475         /* isvoid */ 1
476     };
477 
478     struct iovec xcb_parts[8];
479     xcb_void_cookie_t xcb_ret;
480     xcb_record_register_clients_request_t xcb_out;
481 
482     xcb_out.context = context;
483     xcb_out.element_header = element_header;
484     memset(xcb_out.pad0, 0, 3);
485     xcb_out.num_client_specs = num_client_specs;
486     xcb_out.num_ranges = num_ranges;
487 
488     xcb_parts[2].iov_base = (char *) &xcb_out;
489     xcb_parts[2].iov_len = sizeof(xcb_out);
490     xcb_parts[3].iov_base = 0;
491     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
492     /* xcb_record_client_spec_t client_specs */
493     xcb_parts[4].iov_base = (char *) client_specs;
494     xcb_parts[4].iov_len = num_client_specs * sizeof(xcb_record_client_spec_t);
495     xcb_parts[5].iov_base = 0;
496     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
497     /* xcb_record_range_t ranges */
498     xcb_parts[6].iov_base = (char *) ranges;
499     xcb_parts[6].iov_len = num_ranges * sizeof(xcb_record_range_t);
500     xcb_parts[7].iov_base = 0;
501     xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3;
502 
503     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
504     return xcb_ret;
505 }
506 
507 xcb_void_cookie_t
xcb_record_register_clients(xcb_connection_t * c,xcb_record_context_t context,xcb_record_element_header_t element_header,uint32_t num_client_specs,uint32_t num_ranges,const xcb_record_client_spec_t * client_specs,const xcb_record_range_t * ranges)508 xcb_record_register_clients (xcb_connection_t               *c  /**< */,
509                              xcb_record_context_t            context  /**< */,
510                              xcb_record_element_header_t     element_header  /**< */,
511                              uint32_t                        num_client_specs  /**< */,
512                              uint32_t                        num_ranges  /**< */,
513                              const xcb_record_client_spec_t *client_specs  /**< */,
514                              const xcb_record_range_t       *ranges  /**< */)
515 {
516     static const xcb_protocol_request_t xcb_req = {
517         /* count */ 6,
518         /* ext */ &xcb_record_id,
519         /* opcode */ XCB_RECORD_REGISTER_CLIENTS,
520         /* isvoid */ 1
521     };
522 
523     struct iovec xcb_parts[8];
524     xcb_void_cookie_t xcb_ret;
525     xcb_record_register_clients_request_t xcb_out;
526 
527     xcb_out.context = context;
528     xcb_out.element_header = element_header;
529     memset(xcb_out.pad0, 0, 3);
530     xcb_out.num_client_specs = num_client_specs;
531     xcb_out.num_ranges = num_ranges;
532 
533     xcb_parts[2].iov_base = (char *) &xcb_out;
534     xcb_parts[2].iov_len = sizeof(xcb_out);
535     xcb_parts[3].iov_base = 0;
536     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
537     /* xcb_record_client_spec_t client_specs */
538     xcb_parts[4].iov_base = (char *) client_specs;
539     xcb_parts[4].iov_len = num_client_specs * sizeof(xcb_record_client_spec_t);
540     xcb_parts[5].iov_base = 0;
541     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
542     /* xcb_record_range_t ranges */
543     xcb_parts[6].iov_base = (char *) ranges;
544     xcb_parts[6].iov_len = num_ranges * sizeof(xcb_record_range_t);
545     xcb_parts[7].iov_base = 0;
546     xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3;
547 
548     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
549     return xcb_ret;
550 }
551 
552 int
xcb_record_unregister_clients_sizeof(const void * _buffer)553 xcb_record_unregister_clients_sizeof (const void  *_buffer  /**< */)
554 {
555     char *xcb_tmp = (char *)_buffer;
556     const xcb_record_unregister_clients_request_t *_aux = (xcb_record_unregister_clients_request_t *)_buffer;
557     unsigned int xcb_buffer_len = 0;
558     unsigned int xcb_block_len = 0;
559     unsigned int xcb_pad = 0;
560     unsigned int xcb_align_to = 0;
561 
562 
563     xcb_block_len += sizeof(xcb_record_unregister_clients_request_t);
564     xcb_tmp += xcb_block_len;
565     xcb_buffer_len += xcb_block_len;
566     xcb_block_len = 0;
567     /* client_specs */
568     xcb_block_len += _aux->num_client_specs * sizeof(xcb_record_client_spec_t);
569     xcb_tmp += xcb_block_len;
570     xcb_align_to = ALIGNOF(xcb_record_client_spec_t);
571     /* insert padding */
572     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
573     xcb_buffer_len += xcb_block_len + xcb_pad;
574     if (0 != xcb_pad) {
575         xcb_tmp += xcb_pad;
576         xcb_pad = 0;
577     }
578     xcb_block_len = 0;
579 
580     return xcb_buffer_len;
581 }
582 
583 xcb_void_cookie_t
xcb_record_unregister_clients_checked(xcb_connection_t * c,xcb_record_context_t context,uint32_t num_client_specs,const xcb_record_client_spec_t * client_specs)584 xcb_record_unregister_clients_checked (xcb_connection_t               *c  /**< */,
585                                        xcb_record_context_t            context  /**< */,
586                                        uint32_t                        num_client_specs  /**< */,
587                                        const xcb_record_client_spec_t *client_specs  /**< */)
588 {
589     static const xcb_protocol_request_t xcb_req = {
590         /* count */ 4,
591         /* ext */ &xcb_record_id,
592         /* opcode */ XCB_RECORD_UNREGISTER_CLIENTS,
593         /* isvoid */ 1
594     };
595 
596     struct iovec xcb_parts[6];
597     xcb_void_cookie_t xcb_ret;
598     xcb_record_unregister_clients_request_t xcb_out;
599 
600     xcb_out.context = context;
601     xcb_out.num_client_specs = num_client_specs;
602 
603     xcb_parts[2].iov_base = (char *) &xcb_out;
604     xcb_parts[2].iov_len = sizeof(xcb_out);
605     xcb_parts[3].iov_base = 0;
606     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
607     /* xcb_record_client_spec_t client_specs */
608     xcb_parts[4].iov_base = (char *) client_specs;
609     xcb_parts[4].iov_len = num_client_specs * sizeof(xcb_record_client_spec_t);
610     xcb_parts[5].iov_base = 0;
611     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
612 
613     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
614     return xcb_ret;
615 }
616 
617 xcb_void_cookie_t
xcb_record_unregister_clients(xcb_connection_t * c,xcb_record_context_t context,uint32_t num_client_specs,const xcb_record_client_spec_t * client_specs)618 xcb_record_unregister_clients (xcb_connection_t               *c  /**< */,
619                                xcb_record_context_t            context  /**< */,
620                                uint32_t                        num_client_specs  /**< */,
621                                const xcb_record_client_spec_t *client_specs  /**< */)
622 {
623     static const xcb_protocol_request_t xcb_req = {
624         /* count */ 4,
625         /* ext */ &xcb_record_id,
626         /* opcode */ XCB_RECORD_UNREGISTER_CLIENTS,
627         /* isvoid */ 1
628     };
629 
630     struct iovec xcb_parts[6];
631     xcb_void_cookie_t xcb_ret;
632     xcb_record_unregister_clients_request_t xcb_out;
633 
634     xcb_out.context = context;
635     xcb_out.num_client_specs = num_client_specs;
636 
637     xcb_parts[2].iov_base = (char *) &xcb_out;
638     xcb_parts[2].iov_len = sizeof(xcb_out);
639     xcb_parts[3].iov_base = 0;
640     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
641     /* xcb_record_client_spec_t client_specs */
642     xcb_parts[4].iov_base = (char *) client_specs;
643     xcb_parts[4].iov_len = num_client_specs * sizeof(xcb_record_client_spec_t);
644     xcb_parts[5].iov_base = 0;
645     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
646 
647     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
648     return xcb_ret;
649 }
650 
651 int
xcb_record_get_context_sizeof(const void * _buffer)652 xcb_record_get_context_sizeof (const void  *_buffer  /**< */)
653 {
654     char *xcb_tmp = (char *)_buffer;
655     const xcb_record_get_context_reply_t *_aux = (xcb_record_get_context_reply_t *)_buffer;
656     unsigned int xcb_buffer_len = 0;
657     unsigned int xcb_block_len = 0;
658     unsigned int xcb_pad = 0;
659     unsigned int xcb_align_to = 0;
660 
661     unsigned int i;
662     unsigned int xcb_tmp_len;
663 
664     xcb_block_len += sizeof(xcb_record_get_context_reply_t);
665     xcb_tmp += xcb_block_len;
666     xcb_buffer_len += xcb_block_len;
667     xcb_block_len = 0;
668     /* intercepted_clients */
669     for(i=0; i<_aux->num_intercepted_clients; i++) {
670         xcb_tmp_len = xcb_record_client_info_sizeof(xcb_tmp);
671         xcb_block_len += xcb_tmp_len;
672         xcb_tmp += xcb_tmp_len;
673     }
674     xcb_align_to = ALIGNOF(xcb_record_client_info_t);
675     /* insert padding */
676     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
677     xcb_buffer_len += xcb_block_len + xcb_pad;
678     if (0 != xcb_pad) {
679         xcb_tmp += xcb_pad;
680         xcb_pad = 0;
681     }
682     xcb_block_len = 0;
683 
684     return xcb_buffer_len;
685 }
686 
687 xcb_record_get_context_cookie_t
xcb_record_get_context(xcb_connection_t * c,xcb_record_context_t context)688 xcb_record_get_context (xcb_connection_t     *c  /**< */,
689                         xcb_record_context_t  context  /**< */)
690 {
691     static const xcb_protocol_request_t xcb_req = {
692         /* count */ 2,
693         /* ext */ &xcb_record_id,
694         /* opcode */ XCB_RECORD_GET_CONTEXT,
695         /* isvoid */ 0
696     };
697 
698     struct iovec xcb_parts[4];
699     xcb_record_get_context_cookie_t xcb_ret;
700     xcb_record_get_context_request_t xcb_out;
701 
702     xcb_out.context = context;
703 
704     xcb_parts[2].iov_base = (char *) &xcb_out;
705     xcb_parts[2].iov_len = sizeof(xcb_out);
706     xcb_parts[3].iov_base = 0;
707     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
708 
709     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
710     return xcb_ret;
711 }
712 
713 xcb_record_get_context_cookie_t
xcb_record_get_context_unchecked(xcb_connection_t * c,xcb_record_context_t context)714 xcb_record_get_context_unchecked (xcb_connection_t     *c  /**< */,
715                                   xcb_record_context_t  context  /**< */)
716 {
717     static const xcb_protocol_request_t xcb_req = {
718         /* count */ 2,
719         /* ext */ &xcb_record_id,
720         /* opcode */ XCB_RECORD_GET_CONTEXT,
721         /* isvoid */ 0
722     };
723 
724     struct iovec xcb_parts[4];
725     xcb_record_get_context_cookie_t xcb_ret;
726     xcb_record_get_context_request_t xcb_out;
727 
728     xcb_out.context = context;
729 
730     xcb_parts[2].iov_base = (char *) &xcb_out;
731     xcb_parts[2].iov_len = sizeof(xcb_out);
732     xcb_parts[3].iov_base = 0;
733     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
734 
735     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
736     return xcb_ret;
737 }
738 
739 int
xcb_record_get_context_intercepted_clients_length(const xcb_record_get_context_reply_t * R)740 xcb_record_get_context_intercepted_clients_length (const xcb_record_get_context_reply_t *R  /**< */)
741 {
742     return R->num_intercepted_clients;
743 }
744 
745 xcb_record_client_info_iterator_t
xcb_record_get_context_intercepted_clients_iterator(const xcb_record_get_context_reply_t * R)746 xcb_record_get_context_intercepted_clients_iterator (const xcb_record_get_context_reply_t *R  /**< */)
747 {
748     xcb_record_client_info_iterator_t i;
749     i.data = (xcb_record_client_info_t *) (R + 1);
750     i.rem = R->num_intercepted_clients;
751     i.index = (char *) i.data - (char *) R;
752     return i;
753 }
754 
755 xcb_record_get_context_reply_t *
xcb_record_get_context_reply(xcb_connection_t * c,xcb_record_get_context_cookie_t cookie,xcb_generic_error_t ** e)756 xcb_record_get_context_reply (xcb_connection_t                 *c  /**< */,
757                               xcb_record_get_context_cookie_t   cookie  /**< */,
758                               xcb_generic_error_t             **e  /**< */)
759 {
760     return (xcb_record_get_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
761 }
762 
763 int
xcb_record_enable_context_sizeof(const void * _buffer)764 xcb_record_enable_context_sizeof (const void  *_buffer  /**< */)
765 {
766     char *xcb_tmp = (char *)_buffer;
767     const xcb_record_enable_context_reply_t *_aux = (xcb_record_enable_context_reply_t *)_buffer;
768     unsigned int xcb_buffer_len = 0;
769     unsigned int xcb_block_len = 0;
770     unsigned int xcb_pad = 0;
771     unsigned int xcb_align_to = 0;
772 
773 
774     xcb_block_len += sizeof(xcb_record_enable_context_reply_t);
775     xcb_tmp += xcb_block_len;
776     xcb_buffer_len += xcb_block_len;
777     xcb_block_len = 0;
778     /* data */
779     xcb_block_len += (_aux->length * 4) * sizeof(uint8_t);
780     xcb_tmp += xcb_block_len;
781     xcb_align_to = ALIGNOF(uint8_t);
782     /* insert padding */
783     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
784     xcb_buffer_len += xcb_block_len + xcb_pad;
785     if (0 != xcb_pad) {
786         xcb_tmp += xcb_pad;
787         xcb_pad = 0;
788     }
789     xcb_block_len = 0;
790 
791     return xcb_buffer_len;
792 }
793 
794 xcb_record_enable_context_cookie_t
xcb_record_enable_context(xcb_connection_t * c,xcb_record_context_t context)795 xcb_record_enable_context (xcb_connection_t     *c  /**< */,
796                            xcb_record_context_t  context  /**< */)
797 {
798     static const xcb_protocol_request_t xcb_req = {
799         /* count */ 2,
800         /* ext */ &xcb_record_id,
801         /* opcode */ XCB_RECORD_ENABLE_CONTEXT,
802         /* isvoid */ 0
803     };
804 
805     struct iovec xcb_parts[4];
806     xcb_record_enable_context_cookie_t xcb_ret;
807     xcb_record_enable_context_request_t xcb_out;
808 
809     xcb_out.context = context;
810 
811     xcb_parts[2].iov_base = (char *) &xcb_out;
812     xcb_parts[2].iov_len = sizeof(xcb_out);
813     xcb_parts[3].iov_base = 0;
814     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
815 
816     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
817     return xcb_ret;
818 }
819 
820 xcb_record_enable_context_cookie_t
xcb_record_enable_context_unchecked(xcb_connection_t * c,xcb_record_context_t context)821 xcb_record_enable_context_unchecked (xcb_connection_t     *c  /**< */,
822                                      xcb_record_context_t  context  /**< */)
823 {
824     static const xcb_protocol_request_t xcb_req = {
825         /* count */ 2,
826         /* ext */ &xcb_record_id,
827         /* opcode */ XCB_RECORD_ENABLE_CONTEXT,
828         /* isvoid */ 0
829     };
830 
831     struct iovec xcb_parts[4];
832     xcb_record_enable_context_cookie_t xcb_ret;
833     xcb_record_enable_context_request_t xcb_out;
834 
835     xcb_out.context = context;
836 
837     xcb_parts[2].iov_base = (char *) &xcb_out;
838     xcb_parts[2].iov_len = sizeof(xcb_out);
839     xcb_parts[3].iov_base = 0;
840     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
841 
842     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
843     return xcb_ret;
844 }
845 
846 uint8_t *
xcb_record_enable_context_data(const xcb_record_enable_context_reply_t * R)847 xcb_record_enable_context_data (const xcb_record_enable_context_reply_t *R  /**< */)
848 {
849     return (uint8_t *) (R + 1);
850 }
851 
852 int
xcb_record_enable_context_data_length(const xcb_record_enable_context_reply_t * R)853 xcb_record_enable_context_data_length (const xcb_record_enable_context_reply_t *R  /**< */)
854 {
855     return (R->length * 4);
856 }
857 
858 xcb_generic_iterator_t
xcb_record_enable_context_data_end(const xcb_record_enable_context_reply_t * R)859 xcb_record_enable_context_data_end (const xcb_record_enable_context_reply_t *R  /**< */)
860 {
861     xcb_generic_iterator_t i;
862     i.data = ((uint8_t *) (R + 1)) + ((R->length * 4));
863     i.rem = 0;
864     i.index = (char *) i.data - (char *) R;
865     return i;
866 }
867 
868 xcb_record_enable_context_reply_t *
xcb_record_enable_context_reply(xcb_connection_t * c,xcb_record_enable_context_cookie_t cookie,xcb_generic_error_t ** e)869 xcb_record_enable_context_reply (xcb_connection_t                    *c  /**< */,
870                                  xcb_record_enable_context_cookie_t   cookie  /**< */,
871                                  xcb_generic_error_t                **e  /**< */)
872 {
873     return (xcb_record_enable_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
874 }
875 
876 xcb_void_cookie_t
xcb_record_disable_context_checked(xcb_connection_t * c,xcb_record_context_t context)877 xcb_record_disable_context_checked (xcb_connection_t     *c  /**< */,
878                                     xcb_record_context_t  context  /**< */)
879 {
880     static const xcb_protocol_request_t xcb_req = {
881         /* count */ 2,
882         /* ext */ &xcb_record_id,
883         /* opcode */ XCB_RECORD_DISABLE_CONTEXT,
884         /* isvoid */ 1
885     };
886 
887     struct iovec xcb_parts[4];
888     xcb_void_cookie_t xcb_ret;
889     xcb_record_disable_context_request_t xcb_out;
890 
891     xcb_out.context = context;
892 
893     xcb_parts[2].iov_base = (char *) &xcb_out;
894     xcb_parts[2].iov_len = sizeof(xcb_out);
895     xcb_parts[3].iov_base = 0;
896     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
897 
898     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
899     return xcb_ret;
900 }
901 
902 xcb_void_cookie_t
xcb_record_disable_context(xcb_connection_t * c,xcb_record_context_t context)903 xcb_record_disable_context (xcb_connection_t     *c  /**< */,
904                             xcb_record_context_t  context  /**< */)
905 {
906     static const xcb_protocol_request_t xcb_req = {
907         /* count */ 2,
908         /* ext */ &xcb_record_id,
909         /* opcode */ XCB_RECORD_DISABLE_CONTEXT,
910         /* isvoid */ 1
911     };
912 
913     struct iovec xcb_parts[4];
914     xcb_void_cookie_t xcb_ret;
915     xcb_record_disable_context_request_t xcb_out;
916 
917     xcb_out.context = context;
918 
919     xcb_parts[2].iov_base = (char *) &xcb_out;
920     xcb_parts[2].iov_len = sizeof(xcb_out);
921     xcb_parts[3].iov_base = 0;
922     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
923 
924     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
925     return xcb_ret;
926 }
927 
928 xcb_void_cookie_t
xcb_record_free_context_checked(xcb_connection_t * c,xcb_record_context_t context)929 xcb_record_free_context_checked (xcb_connection_t     *c  /**< */,
930                                  xcb_record_context_t  context  /**< */)
931 {
932     static const xcb_protocol_request_t xcb_req = {
933         /* count */ 2,
934         /* ext */ &xcb_record_id,
935         /* opcode */ XCB_RECORD_FREE_CONTEXT,
936         /* isvoid */ 1
937     };
938 
939     struct iovec xcb_parts[4];
940     xcb_void_cookie_t xcb_ret;
941     xcb_record_free_context_request_t xcb_out;
942 
943     xcb_out.context = context;
944 
945     xcb_parts[2].iov_base = (char *) &xcb_out;
946     xcb_parts[2].iov_len = sizeof(xcb_out);
947     xcb_parts[3].iov_base = 0;
948     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
949 
950     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
951     return xcb_ret;
952 }
953 
954 xcb_void_cookie_t
xcb_record_free_context(xcb_connection_t * c,xcb_record_context_t context)955 xcb_record_free_context (xcb_connection_t     *c  /**< */,
956                          xcb_record_context_t  context  /**< */)
957 {
958     static const xcb_protocol_request_t xcb_req = {
959         /* count */ 2,
960         /* ext */ &xcb_record_id,
961         /* opcode */ XCB_RECORD_FREE_CONTEXT,
962         /* isvoid */ 1
963     };
964 
965     struct iovec xcb_parts[4];
966     xcb_void_cookie_t xcb_ret;
967     xcb_record_free_context_request_t xcb_out;
968 
969     xcb_out.context = context;
970 
971     xcb_parts[2].iov_base = (char *) &xcb_out;
972     xcb_parts[2].iov_len = sizeof(xcb_out);
973     xcb_parts[3].iov_base = 0;
974     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
975 
976     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
977     return xcb_ret;
978 }
979 
980