xref: /minix3/external/mit/xorg/lib/libxcb/files/res.c (revision b80da2a01d0bb632707b7b4e974aa32eaebbcc6f)
1 /*
2  * This file generated automatically from res.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 "res.h"
15 
16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17 #include "xproto.h"
18 
19 xcb_extension_t xcb_res_id = { "X-Resource", 0 };
20 
21 
22 /*****************************************************************************
23  **
24  ** void xcb_res_client_next
25  **
26  ** @param xcb_res_client_iterator_t *i
27  ** @returns void
28  **
29  *****************************************************************************/
30 
31 void
32 xcb_res_client_next (xcb_res_client_iterator_t *i  /**< */)
33 {
34     --i->rem;
35     ++i->data;
36     i->index += sizeof(xcb_res_client_t);
37 }
38 
39 
40 /*****************************************************************************
41  **
42  ** xcb_generic_iterator_t xcb_res_client_end
43  **
44  ** @param xcb_res_client_iterator_t i
45  ** @returns xcb_generic_iterator_t
46  **
47  *****************************************************************************/
48 
49 xcb_generic_iterator_t
50 xcb_res_client_end (xcb_res_client_iterator_t i  /**< */)
51 {
52     xcb_generic_iterator_t ret;
53     ret.data = i.data + i.rem;
54     ret.index = i.index + ((char *) ret.data - (char *) i.data);
55     ret.rem = 0;
56     return ret;
57 }
58 
59 
60 /*****************************************************************************
61  **
62  ** void xcb_res_type_next
63  **
64  ** @param xcb_res_type_iterator_t *i
65  ** @returns void
66  **
67  *****************************************************************************/
68 
69 void
70 xcb_res_type_next (xcb_res_type_iterator_t *i  /**< */)
71 {
72     --i->rem;
73     ++i->data;
74     i->index += sizeof(xcb_res_type_t);
75 }
76 
77 
78 /*****************************************************************************
79  **
80  ** xcb_generic_iterator_t xcb_res_type_end
81  **
82  ** @param xcb_res_type_iterator_t i
83  ** @returns xcb_generic_iterator_t
84  **
85  *****************************************************************************/
86 
87 xcb_generic_iterator_t
88 xcb_res_type_end (xcb_res_type_iterator_t i  /**< */)
89 {
90     xcb_generic_iterator_t ret;
91     ret.data = i.data + i.rem;
92     ret.index = i.index + ((char *) ret.data - (char *) i.data);
93     ret.rem = 0;
94     return ret;
95 }
96 
97 
98 /*****************************************************************************
99  **
100  ** xcb_res_query_version_cookie_t xcb_res_query_version
101  **
102  ** @param xcb_connection_t *c
103  ** @param uint8_t           client_major
104  ** @param uint8_t           client_minor
105  ** @returns xcb_res_query_version_cookie_t
106  **
107  *****************************************************************************/
108 
109 xcb_res_query_version_cookie_t
110 xcb_res_query_version (xcb_connection_t *c  /**< */,
111                        uint8_t           client_major  /**< */,
112                        uint8_t           client_minor  /**< */)
113 {
114     static const xcb_protocol_request_t xcb_req = {
115         /* count */ 2,
116         /* ext */ &xcb_res_id,
117         /* opcode */ XCB_RES_QUERY_VERSION,
118         /* isvoid */ 0
119     };
120 
121     struct iovec xcb_parts[4];
122     xcb_res_query_version_cookie_t xcb_ret;
123     xcb_res_query_version_request_t xcb_out;
124 
125     xcb_out.client_major = client_major;
126     xcb_out.client_minor = client_minor;
127 
128     xcb_parts[2].iov_base = (char *) &xcb_out;
129     xcb_parts[2].iov_len = sizeof(xcb_out);
130     xcb_parts[3].iov_base = 0;
131     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
132 
133     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
134     return xcb_ret;
135 }
136 
137 
138 /*****************************************************************************
139  **
140  ** xcb_res_query_version_cookie_t xcb_res_query_version_unchecked
141  **
142  ** @param xcb_connection_t *c
143  ** @param uint8_t           client_major
144  ** @param uint8_t           client_minor
145  ** @returns xcb_res_query_version_cookie_t
146  **
147  *****************************************************************************/
148 
149 xcb_res_query_version_cookie_t
150 xcb_res_query_version_unchecked (xcb_connection_t *c  /**< */,
151                                  uint8_t           client_major  /**< */,
152                                  uint8_t           client_minor  /**< */)
153 {
154     static const xcb_protocol_request_t xcb_req = {
155         /* count */ 2,
156         /* ext */ &xcb_res_id,
157         /* opcode */ XCB_RES_QUERY_VERSION,
158         /* isvoid */ 0
159     };
160 
161     struct iovec xcb_parts[4];
162     xcb_res_query_version_cookie_t xcb_ret;
163     xcb_res_query_version_request_t xcb_out;
164 
165     xcb_out.client_major = client_major;
166     xcb_out.client_minor = client_minor;
167 
168     xcb_parts[2].iov_base = (char *) &xcb_out;
169     xcb_parts[2].iov_len = sizeof(xcb_out);
170     xcb_parts[3].iov_base = 0;
171     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
172 
173     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
174     return xcb_ret;
175 }
176 
177 
178 /*****************************************************************************
179  **
180  ** xcb_res_query_version_reply_t * xcb_res_query_version_reply
181  **
182  ** @param xcb_connection_t                *c
183  ** @param xcb_res_query_version_cookie_t   cookie
184  ** @param xcb_generic_error_t            **e
185  ** @returns xcb_res_query_version_reply_t *
186  **
187  *****************************************************************************/
188 
189 xcb_res_query_version_reply_t *
190 xcb_res_query_version_reply (xcb_connection_t                *c  /**< */,
191                              xcb_res_query_version_cookie_t   cookie  /**< */,
192                              xcb_generic_error_t            **e  /**< */)
193 {
194     return (xcb_res_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
195 }
196 
197 int
198 xcb_res_query_clients_sizeof (const void  *_buffer  /**< */)
199 {
200     char *xcb_tmp = (char *)_buffer;
201     const xcb_res_query_clients_reply_t *_aux = (xcb_res_query_clients_reply_t *)_buffer;
202     unsigned int xcb_buffer_len = 0;
203     unsigned int xcb_block_len = 0;
204     unsigned int xcb_pad = 0;
205     unsigned int xcb_align_to;
206 
207 
208     xcb_block_len += sizeof(xcb_res_query_clients_reply_t);
209     xcb_tmp += xcb_block_len;
210     /* clients */
211     xcb_block_len += _aux->num_clients * sizeof(xcb_res_client_t);
212     xcb_tmp += xcb_block_len;
213     xcb_align_to = ALIGNOF(xcb_res_client_t);
214     /* insert padding */
215     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
216     xcb_buffer_len += xcb_block_len + xcb_pad;
217     if (0 != xcb_pad) {
218         xcb_tmp += xcb_pad;
219         xcb_pad = 0;
220     }
221     xcb_block_len = 0;
222 
223     return xcb_buffer_len;
224 }
225 
226 
227 /*****************************************************************************
228  **
229  ** xcb_res_query_clients_cookie_t xcb_res_query_clients
230  **
231  ** @param xcb_connection_t *c
232  ** @returns xcb_res_query_clients_cookie_t
233  **
234  *****************************************************************************/
235 
236 xcb_res_query_clients_cookie_t
237 xcb_res_query_clients (xcb_connection_t *c  /**< */)
238 {
239     static const xcb_protocol_request_t xcb_req = {
240         /* count */ 2,
241         /* ext */ &xcb_res_id,
242         /* opcode */ XCB_RES_QUERY_CLIENTS,
243         /* isvoid */ 0
244     };
245 
246     struct iovec xcb_parts[4];
247     xcb_res_query_clients_cookie_t xcb_ret;
248     xcb_res_query_clients_request_t xcb_out;
249 
250 
251     xcb_parts[2].iov_base = (char *) &xcb_out;
252     xcb_parts[2].iov_len = sizeof(xcb_out);
253     xcb_parts[3].iov_base = 0;
254     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
255 
256     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
257     return xcb_ret;
258 }
259 
260 
261 /*****************************************************************************
262  **
263  ** xcb_res_query_clients_cookie_t xcb_res_query_clients_unchecked
264  **
265  ** @param xcb_connection_t *c
266  ** @returns xcb_res_query_clients_cookie_t
267  **
268  *****************************************************************************/
269 
270 xcb_res_query_clients_cookie_t
271 xcb_res_query_clients_unchecked (xcb_connection_t *c  /**< */)
272 {
273     static const xcb_protocol_request_t xcb_req = {
274         /* count */ 2,
275         /* ext */ &xcb_res_id,
276         /* opcode */ XCB_RES_QUERY_CLIENTS,
277         /* isvoid */ 0
278     };
279 
280     struct iovec xcb_parts[4];
281     xcb_res_query_clients_cookie_t xcb_ret;
282     xcb_res_query_clients_request_t xcb_out;
283 
284 
285     xcb_parts[2].iov_base = (char *) &xcb_out;
286     xcb_parts[2].iov_len = sizeof(xcb_out);
287     xcb_parts[3].iov_base = 0;
288     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
289 
290     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
291     return xcb_ret;
292 }
293 
294 
295 /*****************************************************************************
296  **
297  ** xcb_res_client_t * xcb_res_query_clients_clients
298  **
299  ** @param const xcb_res_query_clients_reply_t *R
300  ** @returns xcb_res_client_t *
301  **
302  *****************************************************************************/
303 
304 xcb_res_client_t *
305 xcb_res_query_clients_clients (const xcb_res_query_clients_reply_t *R  /**< */)
306 {
307     return (xcb_res_client_t *) (R + 1);
308 }
309 
310 
311 /*****************************************************************************
312  **
313  ** int xcb_res_query_clients_clients_length
314  **
315  ** @param const xcb_res_query_clients_reply_t *R
316  ** @returns int
317  **
318  *****************************************************************************/
319 
320 int
321 xcb_res_query_clients_clients_length (const xcb_res_query_clients_reply_t *R  /**< */)
322 {
323     return R->num_clients;
324 }
325 
326 
327 /*****************************************************************************
328  **
329  ** xcb_res_client_iterator_t xcb_res_query_clients_clients_iterator
330  **
331  ** @param const xcb_res_query_clients_reply_t *R
332  ** @returns xcb_res_client_iterator_t
333  **
334  *****************************************************************************/
335 
336 xcb_res_client_iterator_t
337 xcb_res_query_clients_clients_iterator (const xcb_res_query_clients_reply_t *R  /**< */)
338 {
339     xcb_res_client_iterator_t i;
340     i.data = (xcb_res_client_t *) (R + 1);
341     i.rem = R->num_clients;
342     i.index = (char *) i.data - (char *) R;
343     return i;
344 }
345 
346 
347 /*****************************************************************************
348  **
349  ** xcb_res_query_clients_reply_t * xcb_res_query_clients_reply
350  **
351  ** @param xcb_connection_t                *c
352  ** @param xcb_res_query_clients_cookie_t   cookie
353  ** @param xcb_generic_error_t            **e
354  ** @returns xcb_res_query_clients_reply_t *
355  **
356  *****************************************************************************/
357 
358 xcb_res_query_clients_reply_t *
359 xcb_res_query_clients_reply (xcb_connection_t                *c  /**< */,
360                              xcb_res_query_clients_cookie_t   cookie  /**< */,
361                              xcb_generic_error_t            **e  /**< */)
362 {
363     return (xcb_res_query_clients_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
364 }
365 
366 int
367 xcb_res_query_client_resources_sizeof (const void  *_buffer  /**< */)
368 {
369     char *xcb_tmp = (char *)_buffer;
370     const xcb_res_query_client_resources_reply_t *_aux = (xcb_res_query_client_resources_reply_t *)_buffer;
371     unsigned int xcb_buffer_len = 0;
372     unsigned int xcb_block_len = 0;
373     unsigned int xcb_pad = 0;
374     unsigned int xcb_align_to;
375 
376 
377     xcb_block_len += sizeof(xcb_res_query_client_resources_reply_t);
378     xcb_tmp += xcb_block_len;
379     /* types */
380     xcb_block_len += _aux->num_types * sizeof(xcb_res_type_t);
381     xcb_tmp += xcb_block_len;
382     xcb_align_to = ALIGNOF(xcb_res_type_t);
383     /* insert padding */
384     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
385     xcb_buffer_len += xcb_block_len + xcb_pad;
386     if (0 != xcb_pad) {
387         xcb_tmp += xcb_pad;
388         xcb_pad = 0;
389     }
390     xcb_block_len = 0;
391 
392     return xcb_buffer_len;
393 }
394 
395 
396 /*****************************************************************************
397  **
398  ** xcb_res_query_client_resources_cookie_t xcb_res_query_client_resources
399  **
400  ** @param xcb_connection_t *c
401  ** @param uint32_t          xid
402  ** @returns xcb_res_query_client_resources_cookie_t
403  **
404  *****************************************************************************/
405 
406 xcb_res_query_client_resources_cookie_t
407 xcb_res_query_client_resources (xcb_connection_t *c  /**< */,
408                                 uint32_t          xid  /**< */)
409 {
410     static const xcb_protocol_request_t xcb_req = {
411         /* count */ 2,
412         /* ext */ &xcb_res_id,
413         /* opcode */ XCB_RES_QUERY_CLIENT_RESOURCES,
414         /* isvoid */ 0
415     };
416 
417     struct iovec xcb_parts[4];
418     xcb_res_query_client_resources_cookie_t xcb_ret;
419     xcb_res_query_client_resources_request_t xcb_out;
420 
421     xcb_out.xid = xid;
422 
423     xcb_parts[2].iov_base = (char *) &xcb_out;
424     xcb_parts[2].iov_len = sizeof(xcb_out);
425     xcb_parts[3].iov_base = 0;
426     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
427 
428     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
429     return xcb_ret;
430 }
431 
432 
433 /*****************************************************************************
434  **
435  ** xcb_res_query_client_resources_cookie_t xcb_res_query_client_resources_unchecked
436  **
437  ** @param xcb_connection_t *c
438  ** @param uint32_t          xid
439  ** @returns xcb_res_query_client_resources_cookie_t
440  **
441  *****************************************************************************/
442 
443 xcb_res_query_client_resources_cookie_t
444 xcb_res_query_client_resources_unchecked (xcb_connection_t *c  /**< */,
445                                           uint32_t          xid  /**< */)
446 {
447     static const xcb_protocol_request_t xcb_req = {
448         /* count */ 2,
449         /* ext */ &xcb_res_id,
450         /* opcode */ XCB_RES_QUERY_CLIENT_RESOURCES,
451         /* isvoid */ 0
452     };
453 
454     struct iovec xcb_parts[4];
455     xcb_res_query_client_resources_cookie_t xcb_ret;
456     xcb_res_query_client_resources_request_t xcb_out;
457 
458     xcb_out.xid = xid;
459 
460     xcb_parts[2].iov_base = (char *) &xcb_out;
461     xcb_parts[2].iov_len = sizeof(xcb_out);
462     xcb_parts[3].iov_base = 0;
463     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
464 
465     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
466     return xcb_ret;
467 }
468 
469 
470 /*****************************************************************************
471  **
472  ** xcb_res_type_t * xcb_res_query_client_resources_types
473  **
474  ** @param const xcb_res_query_client_resources_reply_t *R
475  ** @returns xcb_res_type_t *
476  **
477  *****************************************************************************/
478 
479 xcb_res_type_t *
480 xcb_res_query_client_resources_types (const xcb_res_query_client_resources_reply_t *R  /**< */)
481 {
482     return (xcb_res_type_t *) (R + 1);
483 }
484 
485 
486 /*****************************************************************************
487  **
488  ** int xcb_res_query_client_resources_types_length
489  **
490  ** @param const xcb_res_query_client_resources_reply_t *R
491  ** @returns int
492  **
493  *****************************************************************************/
494 
495 int
496 xcb_res_query_client_resources_types_length (const xcb_res_query_client_resources_reply_t *R  /**< */)
497 {
498     return R->num_types;
499 }
500 
501 
502 /*****************************************************************************
503  **
504  ** xcb_res_type_iterator_t xcb_res_query_client_resources_types_iterator
505  **
506  ** @param const xcb_res_query_client_resources_reply_t *R
507  ** @returns xcb_res_type_iterator_t
508  **
509  *****************************************************************************/
510 
511 xcb_res_type_iterator_t
512 xcb_res_query_client_resources_types_iterator (const xcb_res_query_client_resources_reply_t *R  /**< */)
513 {
514     xcb_res_type_iterator_t i;
515     i.data = (xcb_res_type_t *) (R + 1);
516     i.rem = R->num_types;
517     i.index = (char *) i.data - (char *) R;
518     return i;
519 }
520 
521 
522 /*****************************************************************************
523  **
524  ** xcb_res_query_client_resources_reply_t * xcb_res_query_client_resources_reply
525  **
526  ** @param xcb_connection_t                         *c
527  ** @param xcb_res_query_client_resources_cookie_t   cookie
528  ** @param xcb_generic_error_t                     **e
529  ** @returns xcb_res_query_client_resources_reply_t *
530  **
531  *****************************************************************************/
532 
533 xcb_res_query_client_resources_reply_t *
534 xcb_res_query_client_resources_reply (xcb_connection_t                         *c  /**< */,
535                                       xcb_res_query_client_resources_cookie_t   cookie  /**< */,
536                                       xcb_generic_error_t                     **e  /**< */)
537 {
538     return (xcb_res_query_client_resources_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
539 }
540 
541 
542 /*****************************************************************************
543  **
544  ** xcb_res_query_client_pixmap_bytes_cookie_t xcb_res_query_client_pixmap_bytes
545  **
546  ** @param xcb_connection_t *c
547  ** @param uint32_t          xid
548  ** @returns xcb_res_query_client_pixmap_bytes_cookie_t
549  **
550  *****************************************************************************/
551 
552 xcb_res_query_client_pixmap_bytes_cookie_t
553 xcb_res_query_client_pixmap_bytes (xcb_connection_t *c  /**< */,
554                                    uint32_t          xid  /**< */)
555 {
556     static const xcb_protocol_request_t xcb_req = {
557         /* count */ 2,
558         /* ext */ &xcb_res_id,
559         /* opcode */ XCB_RES_QUERY_CLIENT_PIXMAP_BYTES,
560         /* isvoid */ 0
561     };
562 
563     struct iovec xcb_parts[4];
564     xcb_res_query_client_pixmap_bytes_cookie_t xcb_ret;
565     xcb_res_query_client_pixmap_bytes_request_t xcb_out;
566 
567     xcb_out.xid = xid;
568 
569     xcb_parts[2].iov_base = (char *) &xcb_out;
570     xcb_parts[2].iov_len = sizeof(xcb_out);
571     xcb_parts[3].iov_base = 0;
572     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
573 
574     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
575     return xcb_ret;
576 }
577 
578 
579 /*****************************************************************************
580  **
581  ** xcb_res_query_client_pixmap_bytes_cookie_t xcb_res_query_client_pixmap_bytes_unchecked
582  **
583  ** @param xcb_connection_t *c
584  ** @param uint32_t          xid
585  ** @returns xcb_res_query_client_pixmap_bytes_cookie_t
586  **
587  *****************************************************************************/
588 
589 xcb_res_query_client_pixmap_bytes_cookie_t
590 xcb_res_query_client_pixmap_bytes_unchecked (xcb_connection_t *c  /**< */,
591                                              uint32_t          xid  /**< */)
592 {
593     static const xcb_protocol_request_t xcb_req = {
594         /* count */ 2,
595         /* ext */ &xcb_res_id,
596         /* opcode */ XCB_RES_QUERY_CLIENT_PIXMAP_BYTES,
597         /* isvoid */ 0
598     };
599 
600     struct iovec xcb_parts[4];
601     xcb_res_query_client_pixmap_bytes_cookie_t xcb_ret;
602     xcb_res_query_client_pixmap_bytes_request_t xcb_out;
603 
604     xcb_out.xid = xid;
605 
606     xcb_parts[2].iov_base = (char *) &xcb_out;
607     xcb_parts[2].iov_len = sizeof(xcb_out);
608     xcb_parts[3].iov_base = 0;
609     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
610 
611     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
612     return xcb_ret;
613 }
614 
615 
616 /*****************************************************************************
617  **
618  ** xcb_res_query_client_pixmap_bytes_reply_t * xcb_res_query_client_pixmap_bytes_reply
619  **
620  ** @param xcb_connection_t                            *c
621  ** @param xcb_res_query_client_pixmap_bytes_cookie_t   cookie
622  ** @param xcb_generic_error_t                        **e
623  ** @returns xcb_res_query_client_pixmap_bytes_reply_t *
624  **
625  *****************************************************************************/
626 
627 xcb_res_query_client_pixmap_bytes_reply_t *
628 xcb_res_query_client_pixmap_bytes_reply (xcb_connection_t                            *c  /**< */,
629                                          xcb_res_query_client_pixmap_bytes_cookie_t   cookie  /**< */,
630                                          xcb_generic_error_t                        **e  /**< */)
631 {
632     return (xcb_res_query_client_pixmap_bytes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
633 }
634 
635