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