1
/* C code produced by gperf version 3.0.3 */
2
/* Command-line: gperf --output-file atoms.c atoms.gperf */
3
/* Computed positions: -k'3,6,9,$' */
5
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
6
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
7
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
8
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
9
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
10
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
11
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
12
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
13
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
14
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
15
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
16
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
17
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
18
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
19
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
20
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
21
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
22
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
23
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
24
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
25
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
26
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
27
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
28
/* The character set is not based on ISO-646. */
29
error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
35
/* Rely on vasprintf (GNU extension) instead of vsnprintf if
47
const xcb_atom_t PRIMARY = 1;
48
const xcb_atom_t SECONDARY = 2;
49
const xcb_atom_t ARC = 3;
50
const xcb_atom_t ATOM = 4;
51
const xcb_atom_t BITMAP = 5;
52
const xcb_atom_t CARDINAL = 6;
53
const xcb_atom_t COLORMAP = 7;
54
const xcb_atom_t CURSOR = 8;
55
const xcb_atom_t CUT_BUFFER0 = 9;
56
const xcb_atom_t CUT_BUFFER1 = 10;
57
const xcb_atom_t CUT_BUFFER2 = 11;
58
const xcb_atom_t CUT_BUFFER3 = 12;
59
const xcb_atom_t CUT_BUFFER4 = 13;
60
const xcb_atom_t CUT_BUFFER5 = 14;
61
const xcb_atom_t CUT_BUFFER6 = 15;
62
const xcb_atom_t CUT_BUFFER7 = 16;
63
const xcb_atom_t DRAWABLE = 17;
64
const xcb_atom_t FONT = 18;
65
const xcb_atom_t INTEGER = 19;
66
const xcb_atom_t PIXMAP = 20;
67
const xcb_atom_t POINT = 21;
68
const xcb_atom_t RECTANGLE = 22;
69
const xcb_atom_t RESOURCE_MANAGER = 23;
70
const xcb_atom_t RGB_COLOR_MAP = 24;
71
const xcb_atom_t RGB_BEST_MAP = 25;
72
const xcb_atom_t RGB_BLUE_MAP = 26;
73
const xcb_atom_t RGB_DEFAULT_MAP = 27;
74
const xcb_atom_t RGB_GRAY_MAP = 28;
75
const xcb_atom_t RGB_GREEN_MAP = 29;
76
const xcb_atom_t RGB_RED_MAP = 30;
77
const xcb_atom_t STRING = 31;
78
const xcb_atom_t VISUALID = 32;
79
const xcb_atom_t WINDOW = 33;
80
const xcb_atom_t WM_COMMAND = 34;
81
const xcb_atom_t WM_HINTS = 35;
82
const xcb_atom_t WM_CLIENT_MACHINE = 36;
83
const xcb_atom_t WM_ICON_NAME = 37;
84
const xcb_atom_t WM_ICON_SIZE = 38;
85
const xcb_atom_t WM_NAME = 39;
86
const xcb_atom_t WM_NORMAL_HINTS = 40;
87
const xcb_atom_t WM_SIZE_HINTS = 41;
88
const xcb_atom_t WM_ZOOM_HINTS = 42;
89
const xcb_atom_t MIN_SPACE = 43;
90
const xcb_atom_t NORM_SPACE = 44;
91
const xcb_atom_t MAX_SPACE = 45;
92
const xcb_atom_t END_SPACE = 46;
93
const xcb_atom_t SUPERSCRIPT_X = 47;
94
const xcb_atom_t SUPERSCRIPT_Y = 48;
95
const xcb_atom_t SUBSCRIPT_X = 49;
96
const xcb_atom_t SUBSCRIPT_Y = 50;
97
const xcb_atom_t UNDERLINE_POSITION = 51;
98
const xcb_atom_t UNDERLINE_THICKNESS = 52;
99
const xcb_atom_t STRIKEOUT_ASCENT = 53;
100
const xcb_atom_t STRIKEOUT_DESCENT = 54;
101
const xcb_atom_t ITALIC_ANGLE = 55;
102
const xcb_atom_t X_HEIGHT = 56;
103
const xcb_atom_t QUAD_WIDTH = 57;
104
const xcb_atom_t WEIGHT = 58;
105
const xcb_atom_t POINT_SIZE = 59;
106
const xcb_atom_t RESOLUTION = 60;
107
const xcb_atom_t COPYRIGHT = 61;
108
const xcb_atom_t NOTICE = 62;
109
const xcb_atom_t FONT_NAME = 63;
110
const xcb_atom_t FAMILY_NAME = 64;
111
const xcb_atom_t FULL_NAME = 65;
112
const xcb_atom_t CAP_HEIGHT = 66;
113
const xcb_atom_t WM_CLASS = 67;
114
const xcb_atom_t WM_TRANSIENT_FOR = 68;
115
#line 93 "atoms.gperf"
116
struct atom_map { int name; xcb_atom_t value; };
118
/* maximum key range = 146, duplicates = 0 */
129
register const char *str;
130
register unsigned int len;
132
static const unsigned char asso_values[] =
134
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
135
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
136
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
137
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
138
150, 150, 150, 150, 150, 150, 150, 150, 75, 70,
139
65, 60, 40, 35, 20, 5, 150, 150, 150, 150,
140
150, 150, 150, 150, 150, 35, 0, 45, 15, 0,
141
150, 50, 0, 5, 150, 150, 15, 35, 0, 40,
142
5, 150, 10, 15, 0, 25, 150, 20, 70, 40,
143
55, 150, 150, 150, 150, 15, 150, 150, 150, 150,
144
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
145
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
146
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
147
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
148
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
149
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
150
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
151
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
152
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
153
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
154
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
155
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
156
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
157
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
158
150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
159
150, 150, 150, 150, 150, 150
161
register int hval = len;
166
hval += asso_values[(unsigned char)str[8]];
171
hval += asso_values[(unsigned char)str[5]];
176
hval += asso_values[(unsigned char)str[2]];
179
return hval + asso_values[(unsigned char)str[len - 1]];
184
char stringpool_str4[sizeof("FONT")];
185
char stringpool_str6[sizeof("NOTICE")];
186
char stringpool_str9[sizeof("FONT_NAME")];
187
char stringpool_str10[sizeof("POINT")];
188
char stringpool_str11[sizeof("WEIGHT")];
189
char stringpool_str14[sizeof("MIN_SPACE")];
190
char stringpool_str15[sizeof("CAP_HEIGHT")];
191
char stringpool_str16[sizeof("BITMAP")];
192
char stringpool_str17[sizeof("INTEGER")];
193
char stringpool_str19[sizeof("COPYRIGHT")];
194
char stringpool_str24[sizeof("FULL_NAME")];
195
char stringpool_str26[sizeof("STRIKEOUT_ASCENT")];
196
char stringpool_str27[sizeof("STRIKEOUT_DESCENT")];
197
char stringpool_str28[sizeof("RGB_GREEN_MAP")];
198
char stringpool_str29[sizeof("END_SPACE")];
199
char stringpool_str32[sizeof("RGB_BEST_MAP")];
200
char stringpool_str33[sizeof("CARDINAL")];
201
char stringpool_str36[sizeof("CURSOR")];
202
char stringpool_str37[sizeof("WM_CLIENT_MACHINE")];
203
char stringpool_str38[sizeof("WM_HINTS")];
204
char stringpool_str41[sizeof("CUT_BUFFER7")];
205
char stringpool_str42[sizeof("RGB_GRAY_MAP")];
206
char stringpool_str43[sizeof("DRAWABLE")];
207
char stringpool_str45[sizeof("RGB_DEFAULT_MAP")];
208
char stringpool_str46[sizeof("WINDOW")];
209
char stringpool_str47[sizeof("RGB_BLUE_MAP")];
210
char stringpool_str48[sizeof("UNDERLINE_POSITION")];
211
char stringpool_str51[sizeof("RGB_RED_MAP")];
212
char stringpool_str53[sizeof("VISUALID")];
213
char stringpool_str54[sizeof("RECTANGLE")];
214
char stringpool_str56[sizeof("CUT_BUFFER6")];
215
char stringpool_str57[sizeof("WM_NAME")];
216
char stringpool_str58[sizeof("X_HEIGHT")];
217
char stringpool_str61[sizeof("SUBSCRIPT_Y")];
218
char stringpool_str62[sizeof("PRIMARY")];
219
char stringpool_str63[sizeof("COLORMAP")];
220
char stringpool_str64[sizeof("UNDERLINE_THICKNESS")];
221
char stringpool_str65[sizeof("QUAD_WIDTH")];
222
char stringpool_str66[sizeof("RESOURCE_MANAGER")];
223
char stringpool_str67[sizeof("WM_ICON_NAME")];
224
char stringpool_str68[sizeof("RGB_COLOR_MAP")];
225
char stringpool_str70[sizeof("WM_NORMAL_HINTS")];
226
char stringpool_str71[sizeof("CUT_BUFFER5")];
227
char stringpool_str73[sizeof("WM_CLASS")];
228
char stringpool_str75[sizeof("WM_COMMAND")];
229
char stringpool_str76[sizeof("CUT_BUFFER4")];
230
char stringpool_str78[sizeof("SUPERSCRIPT_Y")];
231
char stringpool_str79[sizeof("ATOM")];
232
char stringpool_str80[sizeof("NORM_SPACE")];
233
char stringpool_str81[sizeof("WM_TRANSIENT_FOR")];
234
char stringpool_str82[sizeof("WM_ICON_SIZE")];
235
char stringpool_str83[sizeof("WM_ZOOM_HINTS")];
236
char stringpool_str84[sizeof("MAX_SPACE")];
237
char stringpool_str85[sizeof("POINT_SIZE")];
238
char stringpool_str86[sizeof("PIXMAP")];
239
char stringpool_str90[sizeof("RESOLUTION")];
240
char stringpool_str91[sizeof("SUBSCRIPT_X")];
241
char stringpool_str92[sizeof("ITALIC_ANGLE")];
242
char stringpool_str93[sizeof("ARC")];
243
char stringpool_str96[sizeof("CUT_BUFFER3")];
244
char stringpool_str98[sizeof("WM_SIZE_HINTS")];
245
char stringpool_str101[sizeof("CUT_BUFFER2")];
246
char stringpool_str106[sizeof("CUT_BUFFER1")];
247
char stringpool_str108[sizeof("SUPERSCRIPT_X")];
248
char stringpool_str111[sizeof("CUT_BUFFER0")];
249
char stringpool_str116[sizeof("STRING")];
250
char stringpool_str121[sizeof("FAMILY_NAME")];
251
char stringpool_str149[sizeof("SECONDARY")];
253
static const struct stringpool_t stringpool_contents =
281
"UNDERLINE_POSITION",
291
"UNDERLINE_THICKNESS",
324
#define stringpool ((const char *) &stringpool_contents)
327
#ifdef __GNUC_STDC_INLINE__
328
__attribute__ ((__gnu_inline__))
331
const struct atom_map *
332
in_word_set (str, len)
333
register const char *str;
334
register unsigned int len;
340
MAX_WORD_LENGTH = 19,
345
static const struct atom_map wordlist[] =
347
{-1}, {-1}, {-1}, {-1},
348
#line 112 "atoms.gperf"
349
{(int)(long)&((struct stringpool_t *)0)->stringpool_str4,18},
351
#line 156 "atoms.gperf"
352
{(int)(long)&((struct stringpool_t *)0)->stringpool_str6,62},
354
#line 157 "atoms.gperf"
355
{(int)(long)&((struct stringpool_t *)0)->stringpool_str9,63},
356
#line 115 "atoms.gperf"
357
{(int)(long)&((struct stringpool_t *)0)->stringpool_str10,21},
358
#line 152 "atoms.gperf"
359
{(int)(long)&((struct stringpool_t *)0)->stringpool_str11,58},
361
#line 137 "atoms.gperf"
362
{(int)(long)&((struct stringpool_t *)0)->stringpool_str14,43},
363
#line 160 "atoms.gperf"
364
{(int)(long)&((struct stringpool_t *)0)->stringpool_str15,66},
365
#line 99 "atoms.gperf"
366
{(int)(long)&((struct stringpool_t *)0)->stringpool_str16,5},
367
#line 113 "atoms.gperf"
368
{(int)(long)&((struct stringpool_t *)0)->stringpool_str17,19},
370
#line 155 "atoms.gperf"
371
{(int)(long)&((struct stringpool_t *)0)->stringpool_str19,61},
372
{-1}, {-1}, {-1}, {-1},
373
#line 159 "atoms.gperf"
374
{(int)(long)&((struct stringpool_t *)0)->stringpool_str24,65},
376
#line 147 "atoms.gperf"
377
{(int)(long)&((struct stringpool_t *)0)->stringpool_str26,53},
378
#line 148 "atoms.gperf"
379
{(int)(long)&((struct stringpool_t *)0)->stringpool_str27,54},
380
#line 123 "atoms.gperf"
381
{(int)(long)&((struct stringpool_t *)0)->stringpool_str28,29},
382
#line 140 "atoms.gperf"
383
{(int)(long)&((struct stringpool_t *)0)->stringpool_str29,46},
385
#line 119 "atoms.gperf"
386
{(int)(long)&((struct stringpool_t *)0)->stringpool_str32,25},
387
#line 100 "atoms.gperf"
388
{(int)(long)&((struct stringpool_t *)0)->stringpool_str33,6},
390
#line 102 "atoms.gperf"
391
{(int)(long)&((struct stringpool_t *)0)->stringpool_str36,8},
392
#line 130 "atoms.gperf"
393
{(int)(long)&((struct stringpool_t *)0)->stringpool_str37,36},
394
#line 129 "atoms.gperf"
395
{(int)(long)&((struct stringpool_t *)0)->stringpool_str38,35},
397
#line 110 "atoms.gperf"
398
{(int)(long)&((struct stringpool_t *)0)->stringpool_str41,16},
399
#line 122 "atoms.gperf"
400
{(int)(long)&((struct stringpool_t *)0)->stringpool_str42,28},
401
#line 111 "atoms.gperf"
402
{(int)(long)&((struct stringpool_t *)0)->stringpool_str43,17},
404
#line 121 "atoms.gperf"
405
{(int)(long)&((struct stringpool_t *)0)->stringpool_str45,27},
406
#line 127 "atoms.gperf"
407
{(int)(long)&((struct stringpool_t *)0)->stringpool_str46,33},
408
#line 120 "atoms.gperf"
409
{(int)(long)&((struct stringpool_t *)0)->stringpool_str47,26},
410
#line 145 "atoms.gperf"
411
{(int)(long)&((struct stringpool_t *)0)->stringpool_str48,51},
413
#line 124 "atoms.gperf"
414
{(int)(long)&((struct stringpool_t *)0)->stringpool_str51,30},
416
#line 126 "atoms.gperf"
417
{(int)(long)&((struct stringpool_t *)0)->stringpool_str53,32},
418
#line 116 "atoms.gperf"
419
{(int)(long)&((struct stringpool_t *)0)->stringpool_str54,22},
421
#line 109 "atoms.gperf"
422
{(int)(long)&((struct stringpool_t *)0)->stringpool_str56,15},
423
#line 133 "atoms.gperf"
424
{(int)(long)&((struct stringpool_t *)0)->stringpool_str57,39},
425
#line 150 "atoms.gperf"
426
{(int)(long)&((struct stringpool_t *)0)->stringpool_str58,56},
428
#line 144 "atoms.gperf"
429
{(int)(long)&((struct stringpool_t *)0)->stringpool_str61,50},
430
#line 95 "atoms.gperf"
431
{(int)(long)&((struct stringpool_t *)0)->stringpool_str62,1},
432
#line 101 "atoms.gperf"
433
{(int)(long)&((struct stringpool_t *)0)->stringpool_str63,7},
434
#line 146 "atoms.gperf"
435
{(int)(long)&((struct stringpool_t *)0)->stringpool_str64,52},
436
#line 151 "atoms.gperf"
437
{(int)(long)&((struct stringpool_t *)0)->stringpool_str65,57},
438
#line 117 "atoms.gperf"
439
{(int)(long)&((struct stringpool_t *)0)->stringpool_str66,23},
440
#line 131 "atoms.gperf"
441
{(int)(long)&((struct stringpool_t *)0)->stringpool_str67,37},
442
#line 118 "atoms.gperf"
443
{(int)(long)&((struct stringpool_t *)0)->stringpool_str68,24},
445
#line 134 "atoms.gperf"
446
{(int)(long)&((struct stringpool_t *)0)->stringpool_str70,40},
447
#line 108 "atoms.gperf"
448
{(int)(long)&((struct stringpool_t *)0)->stringpool_str71,14},
450
#line 161 "atoms.gperf"
451
{(int)(long)&((struct stringpool_t *)0)->stringpool_str73,67},
453
#line 128 "atoms.gperf"
454
{(int)(long)&((struct stringpool_t *)0)->stringpool_str75,34},
455
#line 107 "atoms.gperf"
456
{(int)(long)&((struct stringpool_t *)0)->stringpool_str76,13},
458
#line 142 "atoms.gperf"
459
{(int)(long)&((struct stringpool_t *)0)->stringpool_str78,48},
460
#line 98 "atoms.gperf"
461
{(int)(long)&((struct stringpool_t *)0)->stringpool_str79,4},
462
#line 138 "atoms.gperf"
463
{(int)(long)&((struct stringpool_t *)0)->stringpool_str80,44},
464
#line 162 "atoms.gperf"
465
{(int)(long)&((struct stringpool_t *)0)->stringpool_str81,68},
466
#line 132 "atoms.gperf"
467
{(int)(long)&((struct stringpool_t *)0)->stringpool_str82,38},
468
#line 136 "atoms.gperf"
469
{(int)(long)&((struct stringpool_t *)0)->stringpool_str83,42},
470
#line 139 "atoms.gperf"
471
{(int)(long)&((struct stringpool_t *)0)->stringpool_str84,45},
472
#line 153 "atoms.gperf"
473
{(int)(long)&((struct stringpool_t *)0)->stringpool_str85,59},
474
#line 114 "atoms.gperf"
475
{(int)(long)&((struct stringpool_t *)0)->stringpool_str86,20},
477
#line 154 "atoms.gperf"
478
{(int)(long)&((struct stringpool_t *)0)->stringpool_str90,60},
479
#line 143 "atoms.gperf"
480
{(int)(long)&((struct stringpool_t *)0)->stringpool_str91,49},
481
#line 149 "atoms.gperf"
482
{(int)(long)&((struct stringpool_t *)0)->stringpool_str92,55},
483
#line 97 "atoms.gperf"
484
{(int)(long)&((struct stringpool_t *)0)->stringpool_str93,3},
486
#line 106 "atoms.gperf"
487
{(int)(long)&((struct stringpool_t *)0)->stringpool_str96,12},
489
#line 135 "atoms.gperf"
490
{(int)(long)&((struct stringpool_t *)0)->stringpool_str98,41},
492
#line 105 "atoms.gperf"
493
{(int)(long)&((struct stringpool_t *)0)->stringpool_str101,11},
494
{-1}, {-1}, {-1}, {-1},
495
#line 104 "atoms.gperf"
496
{(int)(long)&((struct stringpool_t *)0)->stringpool_str106,10},
498
#line 141 "atoms.gperf"
499
{(int)(long)&((struct stringpool_t *)0)->stringpool_str108,47},
501
#line 103 "atoms.gperf"
502
{(int)(long)&((struct stringpool_t *)0)->stringpool_str111,9},
503
{-1}, {-1}, {-1}, {-1},
504
#line 125 "atoms.gperf"
505
{(int)(long)&((struct stringpool_t *)0)->stringpool_str116,31},
506
{-1}, {-1}, {-1}, {-1},
507
#line 158 "atoms.gperf"
508
{(int)(long)&((struct stringpool_t *)0)->stringpool_str121,64},
509
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
510
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
511
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
512
#line 96 "atoms.gperf"
513
{(int)(long)&((struct stringpool_t *)0)->stringpool_str149,2}
516
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
518
register int key = hash (str, len);
520
if (key <= MAX_HASH_VALUE && key >= 0)
522
register int o = wordlist[key].name;
525
register const char *s = o + stringpool;
527
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
528
return &wordlist[key];
534
#line 163 "atoms.gperf"
537
static const char atom_names[] =
573
"WM_CLIENT_MACHINE\0"
588
"UNDERLINE_POSITION\0"
589
"UNDERLINE_THICKNESS\0"
591
"STRIKEOUT_DESCENT\0"
608
static const uint16_t atom_name_offsets[] = {
679
xcb_atom_t xcb_atom_get(xcb_connection_t *connection, const char *atom_name)
681
if(atom_name == NULL)
683
xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection,
684
xcb_intern_atom(connection, 0, strlen(atom_name), atom_name), NULL);
687
xcb_atom_t atom = reply->atom;
692
xcb_atom_t xcb_atom_get_predefined(uint16_t name_len, const char *name)
694
const struct atom_map *value = in_word_set(name, name_len);
695
xcb_atom_t ret = XCB_NONE;
701
xcb_atom_fast_cookie_t xcb_atom_get_fast(xcb_connection_t *c, uint8_t only_if_exists, uint16_t name_len, const char *name)
703
xcb_atom_fast_cookie_t cookie;
705
if((cookie.u.atom = xcb_atom_get_predefined(name_len, name)) != XCB_NONE)
707
cookie.tag = TAG_VALUE;
711
cookie.tag = TAG_COOKIE;
712
cookie.u.cookie = xcb_intern_atom(c, only_if_exists, name_len, name);
716
xcb_atom_t xcb_atom_get_fast_reply(xcb_connection_t *c, xcb_atom_fast_cookie_t cookie, xcb_generic_error_t **e)
720
xcb_intern_atom_reply_t *reply;
726
reply = xcb_intern_atom_reply(c, cookie.u.cookie, e);
729
cookie.u.atom = reply->atom;
733
cookie.u.atom = XCB_NONE;
736
return cookie.u.atom;
739
const char *xcb_atom_get_name_predefined(xcb_atom_t atom)
741
if(atom <= 0 || atom > (sizeof(atom_name_offsets) / sizeof(*atom_name_offsets)))
743
return atom_names + atom_name_offsets[atom - 1];
746
int xcb_atom_get_name(xcb_connection_t *c, xcb_atom_t atom, const char **namep, int *lengthp)
748
static char buf[100];
749
const char *name = xcb_atom_get_name_predefined(atom);
751
xcb_get_atom_name_cookie_t atomc;
752
xcb_get_atom_name_reply_t *atomr;
756
*lengthp = strlen(name);
759
atomc = xcb_get_atom_name(c, atom);
760
atomr = xcb_get_atom_name_reply(c, atomc, 0);
763
namelen = xcb_get_atom_name_name_length(atomr);
764
if(namelen > sizeof(buf))
765
namelen = sizeof(buf);
767
memcpy(buf, xcb_get_atom_name_name(atomr), namelen);
773
static char *makename(const char *fmt, ...)
779
#ifndef HAVE_VASPRINTF
783
/* First allocate 'size' bytes, should be enough usually */
784
if((ret = malloc(size)) == NULL)
790
n = vsnprintf(ret, size, fmt, ap);
800
if((np = realloc(ret, size)) == NULL)
810
n = vasprintf(&ret, fmt, ap);
820
char *xcb_atom_name_by_screen(const char *base, uint8_t screen)
822
return makename("%s_S%u", base, screen);
825
char *xcb_atom_name_by_resource(const char *base, uint32_t resource)
827
return makename("%s_R%08X", base, resource);
830
char *xcb_atom_name_unique(const char *base, uint32_t id)
833
return makename("%s_U%lu", base, id);
835
return makename("U%lu", id);