xref: /netbsd-src/external/mit/xorg/lib/xcb-util/atom/atoms.c (revision c2f76ff004a2cb67efe5b12d97bd3ef7fe89e18d)
1 /* C code produced by gperf version 3.0.4 */
2 /* Command-line: gperf --output-file atoms.c atoms.gperf  */
3 /* Computed positions: -k'3,6,9,$' */
4 
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>."
30 #endif
31 
32 #line 1 "atoms.gperf"
33 
34 
35 /* Rely on vasprintf (GNU extension) instead of vsnprintf if
36    possible... */
37 #ifdef HAVE_VASPRINTF
38 #define _GNU_SOURCE
39 #include <stdio.h>
40 #endif
41 
42 #include <xcb/xcb.h>
43 #include <stdlib.h>
44 #include <stdarg.h>
45 #include "xcb_atom.h"
46 
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; };
117 #include <string.h>
118 /* maximum key range = 146, duplicates = 0 */
119 
120 #ifdef __GNUC__
121 __inline
122 #else
123 #ifdef __cplusplus
124 inline
125 #endif
126 #endif
127 static unsigned int
128 hash (str, len)
129      register const char *str;
130      register unsigned int len;
131 {
132   static const unsigned char asso_values[] =
133     {
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
160     };
161   register int hval = len;
162 
163   switch (hval)
164     {
165       default:
166         hval += asso_values[(unsigned char)str[8]];
167       /*FALLTHROUGH*/
168       case 8:
169       case 7:
170       case 6:
171         hval += asso_values[(unsigned char)str[5]];
172       /*FALLTHROUGH*/
173       case 5:
174       case 4:
175       case 3:
176         hval += asso_values[(unsigned char)str[2]];
177         break;
178     }
179   return hval + asso_values[(unsigned char)str[len - 1]];
180 }
181 
182 struct stringpool_t
183   {
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")];
252   };
253 static const struct stringpool_t stringpool_contents =
254   {
255     "FONT",
256     "NOTICE",
257     "FONT_NAME",
258     "POINT",
259     "WEIGHT",
260     "MIN_SPACE",
261     "CAP_HEIGHT",
262     "BITMAP",
263     "INTEGER",
264     "COPYRIGHT",
265     "FULL_NAME",
266     "STRIKEOUT_ASCENT",
267     "STRIKEOUT_DESCENT",
268     "RGB_GREEN_MAP",
269     "END_SPACE",
270     "RGB_BEST_MAP",
271     "CARDINAL",
272     "CURSOR",
273     "WM_CLIENT_MACHINE",
274     "WM_HINTS",
275     "CUT_BUFFER7",
276     "RGB_GRAY_MAP",
277     "DRAWABLE",
278     "RGB_DEFAULT_MAP",
279     "WINDOW",
280     "RGB_BLUE_MAP",
281     "UNDERLINE_POSITION",
282     "RGB_RED_MAP",
283     "VISUALID",
284     "RECTANGLE",
285     "CUT_BUFFER6",
286     "WM_NAME",
287     "X_HEIGHT",
288     "SUBSCRIPT_Y",
289     "PRIMARY",
290     "COLORMAP",
291     "UNDERLINE_THICKNESS",
292     "QUAD_WIDTH",
293     "RESOURCE_MANAGER",
294     "WM_ICON_NAME",
295     "RGB_COLOR_MAP",
296     "WM_NORMAL_HINTS",
297     "CUT_BUFFER5",
298     "WM_CLASS",
299     "WM_COMMAND",
300     "CUT_BUFFER4",
301     "SUPERSCRIPT_Y",
302     "ATOM",
303     "NORM_SPACE",
304     "WM_TRANSIENT_FOR",
305     "WM_ICON_SIZE",
306     "WM_ZOOM_HINTS",
307     "MAX_SPACE",
308     "POINT_SIZE",
309     "PIXMAP",
310     "RESOLUTION",
311     "SUBSCRIPT_X",
312     "ITALIC_ANGLE",
313     "ARC",
314     "CUT_BUFFER3",
315     "WM_SIZE_HINTS",
316     "CUT_BUFFER2",
317     "CUT_BUFFER1",
318     "SUPERSCRIPT_X",
319     "CUT_BUFFER0",
320     "STRING",
321     "FAMILY_NAME",
322     "SECONDARY"
323   };
324 #define stringpool ((const char *) &stringpool_contents)
325 #ifdef __GNUC__
326 __inline
327 #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
328 __attribute__ ((__gnu_inline__))
329 #endif
330 #endif
331 const struct atom_map *
332 in_word_set (str, len)
333      register const char *str;
334      register unsigned int len;
335 {
336   enum
337     {
338       TOTAL_KEYWORDS = 68,
339       MIN_WORD_LENGTH = 3,
340       MAX_WORD_LENGTH = 19,
341       MIN_HASH_VALUE = 4,
342       MAX_HASH_VALUE = 149
343     };
344 
345   static const struct atom_map wordlist[] =
346     {
347       {-1}, {-1}, {-1}, {-1},
348 #line 112 "atoms.gperf"
349       {(int)(long)&((struct stringpool_t *)0)->stringpool_str4,18},
350       {-1},
351 #line 156 "atoms.gperf"
352       {(int)(long)&((struct stringpool_t *)0)->stringpool_str6,62},
353       {-1}, {-1},
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},
360       {-1}, {-1},
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},
369       {-1},
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},
375       {-1},
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},
384       {-1}, {-1},
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},
389       {-1}, {-1},
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},
396       {-1}, {-1},
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},
403       {-1},
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},
412       {-1}, {-1},
413 #line 124 "atoms.gperf"
414       {(int)(long)&((struct stringpool_t *)0)->stringpool_str51,30},
415       {-1},
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},
420       {-1},
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},
427       {-1}, {-1},
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},
444       {-1},
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},
449       {-1},
450 #line 161 "atoms.gperf"
451       {(int)(long)&((struct stringpool_t *)0)->stringpool_str73,67},
452       {-1},
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},
457       {-1},
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},
476       {-1}, {-1}, {-1},
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},
485       {-1}, {-1},
486 #line 106 "atoms.gperf"
487       {(int)(long)&((struct stringpool_t *)0)->stringpool_str96,12},
488       {-1},
489 #line 135 "atoms.gperf"
490       {(int)(long)&((struct stringpool_t *)0)->stringpool_str98,41},
491       {-1}, {-1},
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},
497       {-1},
498 #line 141 "atoms.gperf"
499       {(int)(long)&((struct stringpool_t *)0)->stringpool_str108,47},
500       {-1}, {-1},
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}
514     };
515 
516   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
517     {
518       register int key = hash (str, len);
519 
520       if (key <= MAX_HASH_VALUE && key >= 0)
521         {
522           register int o = wordlist[key].name;
523           if (o >= 0)
524             {
525               register const char *s = o + stringpool;
526 
527               if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
528                 return &wordlist[key];
529             }
530         }
531     }
532   return 0;
533 }
534 #line 163 "atoms.gperf"
535 
536 
537 static const char atom_names[] =
538 	"PRIMARY\0"
539 	"SECONDARY\0"
540 	"ARC\0"
541 	"ATOM\0"
542 	"BITMAP\0"
543 	"CARDINAL\0"
544 	"COLORMAP\0"
545 	"CURSOR\0"
546 	"CUT_BUFFER0\0"
547 	"CUT_BUFFER1\0"
548 	"CUT_BUFFER2\0"
549 	"CUT_BUFFER3\0"
550 	"CUT_BUFFER4\0"
551 	"CUT_BUFFER5\0"
552 	"CUT_BUFFER6\0"
553 	"CUT_BUFFER7\0"
554 	"DRAWABLE\0"
555 	"FONT\0"
556 	"INTEGER\0"
557 	"PIXMAP\0"
558 	"POINT\0"
559 	"RECTANGLE\0"
560 	"RESOURCE_MANAGER\0"
561 	"RGB_COLOR_MAP\0"
562 	"RGB_BEST_MAP\0"
563 	"RGB_BLUE_MAP\0"
564 	"RGB_DEFAULT_MAP\0"
565 	"RGB_GRAY_MAP\0"
566 	"RGB_GREEN_MAP\0"
567 	"RGB_RED_MAP\0"
568 	"STRING\0"
569 	"VISUALID\0"
570 	"WINDOW\0"
571 	"WM_COMMAND\0"
572 	"WM_HINTS\0"
573 	"WM_CLIENT_MACHINE\0"
574 	"WM_ICON_NAME\0"
575 	"WM_ICON_SIZE\0"
576 	"WM_NAME\0"
577 	"WM_NORMAL_HINTS\0"
578 	"WM_SIZE_HINTS\0"
579 	"WM_ZOOM_HINTS\0"
580 	"MIN_SPACE\0"
581 	"NORM_SPACE\0"
582 	"MAX_SPACE\0"
583 	"END_SPACE\0"
584 	"SUPERSCRIPT_X\0"
585 	"SUPERSCRIPT_Y\0"
586 	"SUBSCRIPT_X\0"
587 	"SUBSCRIPT_Y\0"
588 	"UNDERLINE_POSITION\0"
589 	"UNDERLINE_THICKNESS\0"
590 	"STRIKEOUT_ASCENT\0"
591 	"STRIKEOUT_DESCENT\0"
592 	"ITALIC_ANGLE\0"
593 	"X_HEIGHT\0"
594 	"QUAD_WIDTH\0"
595 	"WEIGHT\0"
596 	"POINT_SIZE\0"
597 	"RESOLUTION\0"
598 	"COPYRIGHT\0"
599 	"NOTICE\0"
600 	"FONT_NAME\0"
601 	"FAMILY_NAME\0"
602 	"FULL_NAME\0"
603 	"CAP_HEIGHT\0"
604 	"WM_CLASS\0"
605 	"WM_TRANSIENT_FOR\0"
606 ;
607 
608 static const uint16_t atom_name_offsets[] = {
609 	0,
610 	8,
611 	18,
612 	22,
613 	27,
614 	34,
615 	43,
616 	52,
617 	59,
618 	71,
619 	83,
620 	95,
621 	107,
622 	119,
623 	131,
624 	143,
625 	155,
626 	164,
627 	169,
628 	177,
629 	184,
630 	190,
631 	200,
632 	217,
633 	231,
634 	244,
635 	257,
636 	273,
637 	286,
638 	300,
639 	312,
640 	319,
641 	328,
642 	335,
643 	346,
644 	355,
645 	373,
646 	386,
647 	399,
648 	407,
649 	423,
650 	437,
651 	451,
652 	461,
653 	472,
654 	482,
655 	492,
656 	506,
657 	520,
658 	532,
659 	544,
660 	563,
661 	583,
662 	600,
663 	618,
664 	631,
665 	640,
666 	651,
667 	658,
668 	669,
669 	680,
670 	690,
671 	697,
672 	707,
673 	719,
674 	729,
675 	740,
676 	749,
677 };
678 
679 xcb_atom_t xcb_atom_get(xcb_connection_t *connection, const char *atom_name)
680 {
681 	if(atom_name == NULL)
682 		return XCB_NONE;
683 	xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection,
684 		xcb_intern_atom(connection, 0, strlen(atom_name), atom_name), NULL);
685 	if(!reply)
686 		return XCB_NONE;
687 	xcb_atom_t atom = reply->atom;
688 	free(reply);
689 	return atom;
690 }
691 
692 xcb_atom_t xcb_atom_get_predefined(uint16_t name_len, const char *name)
693 {
694 	const struct atom_map *value = in_word_set(name, name_len);
695 	xcb_atom_t ret = XCB_NONE;
696 	if(value)
697 		ret = value->value;
698 	return ret;
699 }
700 
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)
702 {
703 	xcb_atom_fast_cookie_t cookie;
704 
705 	if((cookie.u.atom = xcb_atom_get_predefined(name_len, name)) != XCB_NONE)
706 	{
707 		cookie.tag = TAG_VALUE;
708 		return cookie;
709 	}
710 
711 	cookie.tag = TAG_COOKIE;
712 	cookie.u.cookie = xcb_intern_atom(c, only_if_exists, name_len, name);
713 	return cookie;
714 }
715 
716 xcb_atom_t xcb_atom_get_fast_reply(xcb_connection_t *c, xcb_atom_fast_cookie_t cookie, xcb_generic_error_t **e)
717 {
718 	switch(cookie.tag)
719 	{
720 		xcb_intern_atom_reply_t *reply;
721 	case TAG_VALUE:
722 		if(e)
723 			*e = 0;
724 		break;
725 	case TAG_COOKIE:
726 		reply = xcb_intern_atom_reply(c, cookie.u.cookie, e);
727 		if(reply)
728 		{
729 			cookie.u.atom = reply->atom;
730 			free(reply);
731 		}
732 		else
733 			cookie.u.atom = XCB_NONE;
734 		break;
735 	}
736 	return cookie.u.atom;
737 }
738 
739 const char *xcb_atom_get_name_predefined(xcb_atom_t atom)
740 {
741 	if(atom <= 0 || atom > (sizeof(atom_name_offsets) / sizeof(*atom_name_offsets)))
742 		return 0;
743 	return atom_names + atom_name_offsets[atom - 1];
744 }
745 
746 int xcb_atom_get_name(xcb_connection_t *c, xcb_atom_t atom, const char **namep, int *lengthp)
747 {
748 	static char buf[100];
749 	const char *name = xcb_atom_get_name_predefined(atom);
750 	int namelen;
751 	xcb_get_atom_name_cookie_t atomc;
752 	xcb_get_atom_name_reply_t *atomr;
753 	if(name)
754 	{
755 		*namep = name;
756 		*lengthp = strlen(name);
757 		return 1;
758 	}
759 	atomc = xcb_get_atom_name(c, atom);
760 	atomr = xcb_get_atom_name_reply(c, atomc, 0);
761 	if(!atomr)
762 		return 0;
763 	namelen = xcb_get_atom_name_name_length(atomr);
764 	if(namelen > sizeof(buf))
765 		namelen = sizeof(buf);
766 	*lengthp = namelen;
767 	memcpy(buf, xcb_get_atom_name_name(atomr), namelen);
768 	*namep = buf;
769 	free(atomr);
770 	return 1;
771 }
772 
773 static char *makename(const char *fmt, ...)
774 {
775 	char *ret;
776 	int n;
777 	va_list ap;
778 
779 #ifndef HAVE_VASPRINTF
780 	char *np;
781 	int size = 64;
782 
783 	/* First allocate 'size' bytes, should be enough usually */
784 	if((ret = malloc(size)) == NULL)
785 		return NULL;
786 
787 	while(1)
788 	{
789 		va_start(ap, fmt);
790 		n = vsnprintf(ret, size, fmt, ap);
791 		va_end(ap);
792 
793 		if(n < 0)
794 			return NULL;
795 
796 		if(n < size)
797 			return ret;
798 
799 		size = n + 1;
800 		if((np = realloc(ret, size)) == NULL)
801 		{
802 			free(ret);
803 			return NULL;
804 		}
805 
806 		ret = np;
807 	}
808 #else
809 	va_start(ap, fmt);
810 	n = vasprintf(&ret, fmt, ap);
811 	va_end(ap);
812 
813 	if(n < 0)
814 		return NULL;
815 
816 	return ret;
817 #endif
818 }
819 
820 char *xcb_atom_name_by_screen(const char *base, uint8_t screen)
821 {
822 	return makename("%s_S%u", base, screen);
823 }
824 
825 char *xcb_atom_name_by_resource(const char *base, uint32_t resource)
826 {
827 	return makename("%s_R%08X", base, resource);
828 }
829 
830 char *xcb_atom_name_unique(const char *base, uint32_t id)
831 {
832 	if(base)
833 		return makename("%s_U%lu", base, id);
834 	else
835 		return makename("U%lu", id);
836 }
837