xref: /minix/external/mit/xorg/lib/libxcb/files/xc_misc.c (revision 0a6a1f1d)
1 /*
2  * This file generated automatically from xc_misc.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 "xc_misc.h"
15 
16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17 
18 xcb_extension_t xcb_xc_misc_id = { "XC-MISC", 0 };
19 
20 xcb_xc_misc_get_version_cookie_t
xcb_xc_misc_get_version(xcb_connection_t * c,uint16_t client_major_version,uint16_t client_minor_version)21 xcb_xc_misc_get_version (xcb_connection_t *c  /**< */,
22                          uint16_t          client_major_version  /**< */,
23                          uint16_t          client_minor_version  /**< */)
24 {
25     static const xcb_protocol_request_t xcb_req = {
26         /* count */ 2,
27         /* ext */ &xcb_xc_misc_id,
28         /* opcode */ XCB_XC_MISC_GET_VERSION,
29         /* isvoid */ 0
30     };
31 
32     struct iovec xcb_parts[4];
33     xcb_xc_misc_get_version_cookie_t xcb_ret;
34     xcb_xc_misc_get_version_request_t xcb_out;
35 
36     xcb_out.client_major_version = client_major_version;
37     xcb_out.client_minor_version = client_minor_version;
38 
39     xcb_parts[2].iov_base = (char *) &xcb_out;
40     xcb_parts[2].iov_len = sizeof(xcb_out);
41     xcb_parts[3].iov_base = 0;
42     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
43 
44     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
45     return xcb_ret;
46 }
47 
48 xcb_xc_misc_get_version_cookie_t
xcb_xc_misc_get_version_unchecked(xcb_connection_t * c,uint16_t client_major_version,uint16_t client_minor_version)49 xcb_xc_misc_get_version_unchecked (xcb_connection_t *c  /**< */,
50                                    uint16_t          client_major_version  /**< */,
51                                    uint16_t          client_minor_version  /**< */)
52 {
53     static const xcb_protocol_request_t xcb_req = {
54         /* count */ 2,
55         /* ext */ &xcb_xc_misc_id,
56         /* opcode */ XCB_XC_MISC_GET_VERSION,
57         /* isvoid */ 0
58     };
59 
60     struct iovec xcb_parts[4];
61     xcb_xc_misc_get_version_cookie_t xcb_ret;
62     xcb_xc_misc_get_version_request_t xcb_out;
63 
64     xcb_out.client_major_version = client_major_version;
65     xcb_out.client_minor_version = client_minor_version;
66 
67     xcb_parts[2].iov_base = (char *) &xcb_out;
68     xcb_parts[2].iov_len = sizeof(xcb_out);
69     xcb_parts[3].iov_base = 0;
70     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
71 
72     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
73     return xcb_ret;
74 }
75 
76 xcb_xc_misc_get_version_reply_t *
xcb_xc_misc_get_version_reply(xcb_connection_t * c,xcb_xc_misc_get_version_cookie_t cookie,xcb_generic_error_t ** e)77 xcb_xc_misc_get_version_reply (xcb_connection_t                  *c  /**< */,
78                                xcb_xc_misc_get_version_cookie_t   cookie  /**< */,
79                                xcb_generic_error_t              **e  /**< */)
80 {
81     return (xcb_xc_misc_get_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
82 }
83 
84 xcb_xc_misc_get_xid_range_cookie_t
xcb_xc_misc_get_xid_range(xcb_connection_t * c)85 xcb_xc_misc_get_xid_range (xcb_connection_t *c  /**< */)
86 {
87     static const xcb_protocol_request_t xcb_req = {
88         /* count */ 2,
89         /* ext */ &xcb_xc_misc_id,
90         /* opcode */ XCB_XC_MISC_GET_XID_RANGE,
91         /* isvoid */ 0
92     };
93 
94     struct iovec xcb_parts[4];
95     xcb_xc_misc_get_xid_range_cookie_t xcb_ret;
96     xcb_xc_misc_get_xid_range_request_t xcb_out;
97 
98 
99     xcb_parts[2].iov_base = (char *) &xcb_out;
100     xcb_parts[2].iov_len = sizeof(xcb_out);
101     xcb_parts[3].iov_base = 0;
102     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
103 
104     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
105     return xcb_ret;
106 }
107 
108 xcb_xc_misc_get_xid_range_cookie_t
xcb_xc_misc_get_xid_range_unchecked(xcb_connection_t * c)109 xcb_xc_misc_get_xid_range_unchecked (xcb_connection_t *c  /**< */)
110 {
111     static const xcb_protocol_request_t xcb_req = {
112         /* count */ 2,
113         /* ext */ &xcb_xc_misc_id,
114         /* opcode */ XCB_XC_MISC_GET_XID_RANGE,
115         /* isvoid */ 0
116     };
117 
118     struct iovec xcb_parts[4];
119     xcb_xc_misc_get_xid_range_cookie_t xcb_ret;
120     xcb_xc_misc_get_xid_range_request_t xcb_out;
121 
122 
123     xcb_parts[2].iov_base = (char *) &xcb_out;
124     xcb_parts[2].iov_len = sizeof(xcb_out);
125     xcb_parts[3].iov_base = 0;
126     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
127 
128     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
129     return xcb_ret;
130 }
131 
132 xcb_xc_misc_get_xid_range_reply_t *
xcb_xc_misc_get_xid_range_reply(xcb_connection_t * c,xcb_xc_misc_get_xid_range_cookie_t cookie,xcb_generic_error_t ** e)133 xcb_xc_misc_get_xid_range_reply (xcb_connection_t                    *c  /**< */,
134                                  xcb_xc_misc_get_xid_range_cookie_t   cookie  /**< */,
135                                  xcb_generic_error_t                **e  /**< */)
136 {
137     return (xcb_xc_misc_get_xid_range_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
138 }
139 
140 int
xcb_xc_misc_get_xid_list_sizeof(const void * _buffer)141 xcb_xc_misc_get_xid_list_sizeof (const void  *_buffer  /**< */)
142 {
143     char *xcb_tmp = (char *)_buffer;
144     const xcb_xc_misc_get_xid_list_reply_t *_aux = (xcb_xc_misc_get_xid_list_reply_t *)_buffer;
145     unsigned int xcb_buffer_len = 0;
146     unsigned int xcb_block_len = 0;
147     unsigned int xcb_pad = 0;
148     unsigned int xcb_align_to = 0;
149 
150 
151     xcb_block_len += sizeof(xcb_xc_misc_get_xid_list_reply_t);
152     xcb_tmp += xcb_block_len;
153     xcb_buffer_len += xcb_block_len;
154     xcb_block_len = 0;
155     /* ids */
156     xcb_block_len += _aux->ids_len * sizeof(uint32_t);
157     xcb_tmp += xcb_block_len;
158     xcb_align_to = ALIGNOF(uint32_t);
159     /* insert padding */
160     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
161     xcb_buffer_len += xcb_block_len + xcb_pad;
162     if (0 != xcb_pad) {
163         xcb_tmp += xcb_pad;
164         xcb_pad = 0;
165     }
166     xcb_block_len = 0;
167 
168     return xcb_buffer_len;
169 }
170 
171 xcb_xc_misc_get_xid_list_cookie_t
xcb_xc_misc_get_xid_list(xcb_connection_t * c,uint32_t count)172 xcb_xc_misc_get_xid_list (xcb_connection_t *c  /**< */,
173                           uint32_t          count  /**< */)
174 {
175     static const xcb_protocol_request_t xcb_req = {
176         /* count */ 2,
177         /* ext */ &xcb_xc_misc_id,
178         /* opcode */ XCB_XC_MISC_GET_XID_LIST,
179         /* isvoid */ 0
180     };
181 
182     struct iovec xcb_parts[4];
183     xcb_xc_misc_get_xid_list_cookie_t xcb_ret;
184     xcb_xc_misc_get_xid_list_request_t xcb_out;
185 
186     xcb_out.count = count;
187 
188     xcb_parts[2].iov_base = (char *) &xcb_out;
189     xcb_parts[2].iov_len = sizeof(xcb_out);
190     xcb_parts[3].iov_base = 0;
191     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
192 
193     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
194     return xcb_ret;
195 }
196 
197 xcb_xc_misc_get_xid_list_cookie_t
xcb_xc_misc_get_xid_list_unchecked(xcb_connection_t * c,uint32_t count)198 xcb_xc_misc_get_xid_list_unchecked (xcb_connection_t *c  /**< */,
199                                     uint32_t          count  /**< */)
200 {
201     static const xcb_protocol_request_t xcb_req = {
202         /* count */ 2,
203         /* ext */ &xcb_xc_misc_id,
204         /* opcode */ XCB_XC_MISC_GET_XID_LIST,
205         /* isvoid */ 0
206     };
207 
208     struct iovec xcb_parts[4];
209     xcb_xc_misc_get_xid_list_cookie_t xcb_ret;
210     xcb_xc_misc_get_xid_list_request_t xcb_out;
211 
212     xcb_out.count = count;
213 
214     xcb_parts[2].iov_base = (char *) &xcb_out;
215     xcb_parts[2].iov_len = sizeof(xcb_out);
216     xcb_parts[3].iov_base = 0;
217     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
218 
219     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
220     return xcb_ret;
221 }
222 
223 uint32_t *
xcb_xc_misc_get_xid_list_ids(const xcb_xc_misc_get_xid_list_reply_t * R)224 xcb_xc_misc_get_xid_list_ids (const xcb_xc_misc_get_xid_list_reply_t *R  /**< */)
225 {
226     return (uint32_t *) (R + 1);
227 }
228 
229 int
xcb_xc_misc_get_xid_list_ids_length(const xcb_xc_misc_get_xid_list_reply_t * R)230 xcb_xc_misc_get_xid_list_ids_length (const xcb_xc_misc_get_xid_list_reply_t *R  /**< */)
231 {
232     return R->ids_len;
233 }
234 
235 xcb_generic_iterator_t
xcb_xc_misc_get_xid_list_ids_end(const xcb_xc_misc_get_xid_list_reply_t * R)236 xcb_xc_misc_get_xid_list_ids_end (const xcb_xc_misc_get_xid_list_reply_t *R  /**< */)
237 {
238     xcb_generic_iterator_t i;
239     i.data = ((uint32_t *) (R + 1)) + (R->ids_len);
240     i.rem = 0;
241     i.index = (char *) i.data - (char *) R;
242     return i;
243 }
244 
245 xcb_xc_misc_get_xid_list_reply_t *
xcb_xc_misc_get_xid_list_reply(xcb_connection_t * c,xcb_xc_misc_get_xid_list_cookie_t cookie,xcb_generic_error_t ** e)246 xcb_xc_misc_get_xid_list_reply (xcb_connection_t                   *c  /**< */,
247                                 xcb_xc_misc_get_xid_list_cookie_t   cookie  /**< */,
248                                 xcb_generic_error_t               **e  /**< */)
249 {
250     return (xcb_xc_misc_get_xid_list_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
251 }
252 
253