xref: /minix/external/mit/xorg/lib/xcb-util/atom/atoms.c (revision 83ee113e)
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 static
326 #ifdef __GNUC__
327 __inline
328 #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
329 __attribute__ ((__gnu_inline__))
330 #endif
331 #endif
332 const struct atom_map *
333 in_word_set (str, len)
334      register const char *str;
335      register unsigned int len;
336 {
337   enum
338     {
339       TOTAL_KEYWORDS = 68,
340       MIN_WORD_LENGTH = 3,
341       MAX_WORD_LENGTH = 19,
342       MIN_HASH_VALUE = 4,
343       MAX_HASH_VALUE = 149
344     };
345 
346   static const struct atom_map wordlist[] =
347     {
348       {-1}, {-1}, {-1}, {-1},
349 #line 112 "atoms.gperf"
350       {(int)(long)&((struct stringpool_t *)0)->stringpool_str4,18},
351       {-1},
352 #line 156 "atoms.gperf"
353       {(int)(long)&((struct stringpool_t *)0)->stringpool_str6,62},
354       {-1}, {-1},
355 #line 157 "atoms.gperf"
356       {(int)(long)&((struct stringpool_t *)0)->stringpool_str9,63},
357 #line 115 "atoms.gperf"
358       {(int)(long)&((struct stringpool_t *)0)->stringpool_str10,21},
359 #line 152 "atoms.gperf"
360       {(int)(long)&((struct stringpool_t *)0)->stringpool_str11,58},
361       {-1}, {-1},
362 #line 137 "atoms.gperf"
363       {(int)(long)&((struct stringpool_t *)0)->stringpool_str14,43},
364 #line 160 "atoms.gperf"
365       {(int)(long)&((struct stringpool_t *)0)->stringpool_str15,66},
366 #line 99 "atoms.gperf"
367       {(int)(long)&((struct stringpool_t *)0)->stringpool_str16,5},
368 #line 113 "atoms.gperf"
369       {(int)(long)&((struct stringpool_t *)0)->stringpool_str17,19},
370       {-1},
371 #line 155 "atoms.gperf"
372       {(int)(long)&((struct stringpool_t *)0)->stringpool_str19,61},
373       {-1}, {-1}, {-1}, {-1},
374 #line 159 "atoms.gperf"
375       {(int)(long)&((struct stringpool_t *)0)->stringpool_str24,65},
376       {-1},
377 #line 147 "atoms.gperf"
378       {(int)(long)&((struct stringpool_t *)0)->stringpool_str26,53},
379 #line 148 "atoms.gperf"
380       {(int)(long)&((struct stringpool_t *)0)->stringpool_str27,54},
381 #line 123 "atoms.gperf"
382       {(int)(long)&((struct stringpool_t *)0)->stringpool_str28,29},
383 #line 140 "atoms.gperf"
384       {(int)(long)&((struct stringpool_t *)0)->stringpool_str29,46},
385       {-1}, {-1},
386 #line 119 "atoms.gperf"
387       {(int)(long)&((struct stringpool_t *)0)->stringpool_str32,25},
388 #line 100 "atoms.gperf"
389       {(int)(long)&((struct stringpool_t *)0)->stringpool_str33,6},
390       {-1}, {-1},
391 #line 102 "atoms.gperf"
392       {(int)(long)&((struct stringpool_t *)0)->stringpool_str36,8},
393 #line 130 "atoms.gperf"
394       {(int)(long)&((struct stringpool_t *)0)->stringpool_str37,36},
395 #line 129 "atoms.gperf"
396       {(int)(long)&((struct stringpool_t *)0)->stringpool_str38,35},
397       {-1}, {-1},
398 #line 110 "atoms.gperf"
399       {(int)(long)&((struct stringpool_t *)0)->stringpool_str41,16},
400 #line 122 "atoms.gperf"
401       {(int)(long)&((struct stringpool_t *)0)->stringpool_str42,28},
402 #line 111 "atoms.gperf"
403       {(int)(long)&((struct stringpool_t *)0)->stringpool_str43,17},
404       {-1},
405 #line 121 "atoms.gperf"
406       {(int)(long)&((struct stringpool_t *)0)->stringpool_str45,27},
407 #line 127 "atoms.gperf"
408       {(int)(long)&((struct stringpool_t *)0)->stringpool_str46,33},
409 #line 120 "atoms.gperf"
410       {(int)(long)&((struct stringpool_t *)0)->stringpool_str47,26},
411 #line 145 "atoms.gperf"
412       {(int)(long)&((struct stringpool_t *)0)->stringpool_str48,51},
413       {-1}, {-1},
414 #line 124 "atoms.gperf"
415       {(int)(long)&((struct stringpool_t *)0)->stringpool_str51,30},
416       {-1},
417 #line 126 "atoms.gperf"
418       {(int)(long)&((struct stringpool_t *)0)->stringpool_str53,32},
419 #line 116 "atoms.gperf"
420       {(int)(long)&((struct stringpool_t *)0)->stringpool_str54,22},
421       {-1},
422 #line 109 "atoms.gperf"
423       {(int)(long)&((struct stringpool_t *)0)->stringpool_str56,15},
424 #line 133 "atoms.gperf"
425       {(int)(long)&((struct stringpool_t *)0)->stringpool_str57,39},
426 #line 150 "atoms.gperf"
427       {(int)(long)&((struct stringpool_t *)0)->stringpool_str58,56},
428       {-1}, {-1},
429 #line 144 "atoms.gperf"
430       {(int)(long)&((struct stringpool_t *)0)->stringpool_str61,50},
431 #line 95 "atoms.gperf"
432       {(int)(long)&((struct stringpool_t *)0)->stringpool_str62,1},
433 #line 101 "atoms.gperf"
434       {(int)(long)&((struct stringpool_t *)0)->stringpool_str63,7},
435 #line 146 "atoms.gperf"
436       {(int)(long)&((struct stringpool_t *)0)->stringpool_str64,52},
437 #line 151 "atoms.gperf"
438       {(int)(long)&((struct stringpool_t *)0)->stringpool_str65,57},
439 #line 117 "atoms.gperf"
440       {(int)(long)&((struct stringpool_t *)0)->stringpool_str66,23},
441 #line 131 "atoms.gperf"
442       {(int)(long)&((struct stringpool_t *)0)->stringpool_str67,37},
443 #line 118 "atoms.gperf"
444       {(int)(long)&((struct stringpool_t *)0)->stringpool_str68,24},
445       {-1},
446 #line 134 "atoms.gperf"
447       {(int)(long)&((struct stringpool_t *)0)->stringpool_str70,40},
448 #line 108 "atoms.gperf"
449       {(int)(long)&((struct stringpool_t *)0)->stringpool_str71,14},
450       {-1},
451 #line 161 "atoms.gperf"
452       {(int)(long)&((struct stringpool_t *)0)->stringpool_str73,67},
453       {-1},
454 #line 128 "atoms.gperf"
455       {(int)(long)&((struct stringpool_t *)0)->stringpool_str75,34},
456 #line 107 "atoms.gperf"
457       {(int)(long)&((struct stringpool_t *)0)->stringpool_str76,13},
458       {-1},
459 #line 142 "atoms.gperf"
460       {(int)(long)&((struct stringpool_t *)0)->stringpool_str78,48},
461 #line 98 "atoms.gperf"
462       {(int)(long)&((struct stringpool_t *)0)->stringpool_str79,4},
463 #line 138 "atoms.gperf"
464       {(int)(long)&((struct stringpool_t *)0)->stringpool_str80,44},
465 #line 162 "atoms.gperf"
466       {(int)(long)&((struct stringpool_t *)0)->stringpool_str81,68},
467 #line 132 "atoms.gperf"
468       {(int)(long)&((struct stringpool_t *)0)->stringpool_str82,38},
469 #line 136 "atoms.gperf"
470       {(int)(long)&((struct stringpool_t *)0)->stringpool_str83,42},
471 #line 139 "atoms.gperf"
472       {(int)(long)&((struct stringpool_t *)0)->stringpool_str84,45},
473 #line 153 "atoms.gperf"
474       {(int)(long)&((struct stringpool_t *)0)->stringpool_str85,59},
475 #line 114 "atoms.gperf"
476       {(int)(long)&((struct stringpool_t *)0)->stringpool_str86,20},
477       {-1}, {-1}, {-1},
478 #line 154 "atoms.gperf"
479       {(int)(long)&((struct stringpool_t *)0)->stringpool_str90,60},
480 #line 143 "atoms.gperf"
481       {(int)(long)&((struct stringpool_t *)0)->stringpool_str91,49},
482 #line 149 "atoms.gperf"
483       {(int)(long)&((struct stringpool_t *)0)->stringpool_str92,55},
484 #line 97 "atoms.gperf"
485       {(int)(long)&((struct stringpool_t *)0)->stringpool_str93,3},
486       {-1}, {-1},
487 #line 106 "atoms.gperf"
488       {(int)(long)&((struct stringpool_t *)0)->stringpool_str96,12},
489       {-1},
490 #line 135 "atoms.gperf"
491       {(int)(long)&((struct stringpool_t *)0)->stringpool_str98,41},
492       {-1}, {-1},
493 #line 105 "atoms.gperf"
494       {(int)(long)&((struct stringpool_t *)0)->stringpool_str101,11},
495       {-1}, {-1}, {-1}, {-1},
496 #line 104 "atoms.gperf"
497       {(int)(long)&((struct stringpool_t *)0)->stringpool_str106,10},
498       {-1},
499 #line 141 "atoms.gperf"
500       {(int)(long)&((struct stringpool_t *)0)->stringpool_str108,47},
501       {-1}, {-1},
502 #line 103 "atoms.gperf"
503       {(int)(long)&((struct stringpool_t *)0)->stringpool_str111,9},
504       {-1}, {-1}, {-1}, {-1},
505 #line 125 "atoms.gperf"
506       {(int)(long)&((struct stringpool_t *)0)->stringpool_str116,31},
507       {-1}, {-1}, {-1}, {-1},
508 #line 158 "atoms.gperf"
509       {(int)(long)&((struct stringpool_t *)0)->stringpool_str121,64},
510       {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
511       {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
512       {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
513 #line 96 "atoms.gperf"
514       {(int)(long)&((struct stringpool_t *)0)->stringpool_str149,2}
515     };
516 
517   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
518     {
519       register int key = hash (str, len);
520 
521       if (key <= MAX_HASH_VALUE && key >= 0)
522         {
523           register int o = wordlist[key].name;
524           if (o >= 0)
525             {
526               register const char *s = o + stringpool;
527 
528               if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
529                 return &wordlist[key];
530             }
531         }
532     }
533   return 0;
534 }
535 #line 163 "atoms.gperf"
536 
537 
538 static const char atom_names[] =
539 	"PRIMARY\0"
540 	"SECONDARY\0"
541 	"ARC\0"
542 	"ATOM\0"
543 	"BITMAP\0"
544 	"CARDINAL\0"
545 	"COLORMAP\0"
546 	"CURSOR\0"
547 	"CUT_BUFFER0\0"
548 	"CUT_BUFFER1\0"
549 	"CUT_BUFFER2\0"
550 	"CUT_BUFFER3\0"
551 	"CUT_BUFFER4\0"
552 	"CUT_BUFFER5\0"
553 	"CUT_BUFFER6\0"
554 	"CUT_BUFFER7\0"
555 	"DRAWABLE\0"
556 	"FONT\0"
557 	"INTEGER\0"
558 	"PIXMAP\0"
559 	"POINT\0"
560 	"RECTANGLE\0"
561 	"RESOURCE_MANAGER\0"
562 	"RGB_COLOR_MAP\0"
563 	"RGB_BEST_MAP\0"
564 	"RGB_BLUE_MAP\0"
565 	"RGB_DEFAULT_MAP\0"
566 	"RGB_GRAY_MAP\0"
567 	"RGB_GREEN_MAP\0"
568 	"RGB_RED_MAP\0"
569 	"STRING\0"
570 	"VISUALID\0"
571 	"WINDOW\0"
572 	"WM_COMMAND\0"
573 	"WM_HINTS\0"
574 	"WM_CLIENT_MACHINE\0"
575 	"WM_ICON_NAME\0"
576 	"WM_ICON_SIZE\0"
577 	"WM_NAME\0"
578 	"WM_NORMAL_HINTS\0"
579 	"WM_SIZE_HINTS\0"
580 	"WM_ZOOM_HINTS\0"
581 	"MIN_SPACE\0"
582 	"NORM_SPACE\0"
583 	"MAX_SPACE\0"
584 	"END_SPACE\0"
585 	"SUPERSCRIPT_X\0"
586 	"SUPERSCRIPT_Y\0"
587 	"SUBSCRIPT_X\0"
588 	"SUBSCRIPT_Y\0"
589 	"UNDERLINE_POSITION\0"
590 	"UNDERLINE_THICKNESS\0"
591 	"STRIKEOUT_ASCENT\0"
592 	"STRIKEOUT_DESCENT\0"
593 	"ITALIC_ANGLE\0"
594 	"X_HEIGHT\0"
595 	"QUAD_WIDTH\0"
596 	"WEIGHT\0"
597 	"POINT_SIZE\0"
598 	"RESOLUTION\0"
599 	"COPYRIGHT\0"
600 	"NOTICE\0"
601 	"FONT_NAME\0"
602 	"FAMILY_NAME\0"
603 	"FULL_NAME\0"
604 	"CAP_HEIGHT\0"
605 	"WM_CLASS\0"
606 	"WM_TRANSIENT_FOR\0"
607 ;
608 
609 static const uint16_t atom_name_offsets[] = {
610 	0,
611 	8,
612 	18,
613 	22,
614 	27,
615 	34,
616 	43,
617 	52,
618 	59,
619 	71,
620 	83,
621 	95,
622 	107,
623 	119,
624 	131,
625 	143,
626 	155,
627 	164,
628 	169,
629 	177,
630 	184,
631 	190,
632 	200,
633 	217,
634 	231,
635 	244,
636 	257,
637 	273,
638 	286,
639 	300,
640 	312,
641 	319,
642 	328,
643 	335,
644 	346,
645 	355,
646 	373,
647 	386,
648 	399,
649 	407,
650 	423,
651 	437,
652 	451,
653 	461,
654 	472,
655 	482,
656 	492,
657 	506,
658 	520,
659 	532,
660 	544,
661 	563,
662 	583,
663 	600,
664 	618,
665 	631,
666 	640,
667 	651,
668 	658,
669 	669,
670 	680,
671 	690,
672 	697,
673 	707,
674 	719,
675 	729,
676 	740,
677 	749,
678 };
679 
680 xcb_atom_t xcb_atom_get(xcb_connection_t *connection, const char *atom_name)
681 {
682 	if(atom_name == NULL)
683 		return XCB_NONE;
684 	xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection,
685 		xcb_intern_atom(connection, 0, strlen(atom_name), atom_name), NULL);
686 	if(!reply)
687 		return XCB_NONE;
688 	xcb_atom_t atom = reply->atom;
689 	free(reply);
690 	return atom;
691 }
692 
693 xcb_atom_t xcb_atom_get_predefined(uint16_t name_len, const char *name)
694 {
695 	const struct atom_map *value = in_word_set(name, name_len);
696 	xcb_atom_t ret = XCB_NONE;
697 	if(value)
698 		ret = value->value;
699 	return ret;
700 }
701 
702 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 {
704 	xcb_atom_fast_cookie_t cookie;
705 
706 	if((cookie.u.atom = xcb_atom_get_predefined(name_len, name)) != XCB_NONE)
707 	{
708 		cookie.tag = TAG_VALUE;
709 		return cookie;
710 	}
711 
712 	cookie.tag = TAG_COOKIE;
713 	cookie.u.cookie = xcb_intern_atom(c, only_if_exists, name_len, name);
714 	return cookie;
715 }
716 
717 xcb_atom_t xcb_atom_get_fast_reply(xcb_connection_t *c, xcb_atom_fast_cookie_t cookie, xcb_generic_error_t **e)
718 {
719 	switch(cookie.tag)
720 	{
721 		xcb_intern_atom_reply_t *reply;
722 	case TAG_VALUE:
723 		if(e)
724 			*e = 0;
725 		break;
726 	case TAG_COOKIE:
727 		reply = xcb_intern_atom_reply(c, cookie.u.cookie, e);
728 		if(reply)
729 		{
730 			cookie.u.atom = reply->atom;
731 			free(reply);
732 		}
733 		else
734 			cookie.u.atom = XCB_NONE;
735 		break;
736 	}
737 	return cookie.u.atom;
738 }
739 
740 const char *xcb_atom_get_name_predefined(xcb_atom_t atom)
741 {
742 	if(atom <= 0 || atom > (sizeof(atom_name_offsets) / sizeof(*atom_name_offsets)))
743 		return 0;
744 	return atom_names + atom_name_offsets[atom - 1];
745 }
746 
747 int xcb_atom_get_name(xcb_connection_t *c, xcb_atom_t atom, const char **namep, int *lengthp)
748 {
749 	static char buf[100];
750 	const char *name = xcb_atom_get_name_predefined(atom);
751 	int namelen;
752 	xcb_get_atom_name_cookie_t atomc;
753 	xcb_get_atom_name_reply_t *atomr;
754 	if(name)
755 	{
756 		*namep = name;
757 		*lengthp = strlen(name);
758 		return 1;
759 	}
760 	atomc = xcb_get_atom_name(c, atom);
761 	atomr = xcb_get_atom_name_reply(c, atomc, 0);
762 	if(!atomr)
763 		return 0;
764 	namelen = xcb_get_atom_name_name_length(atomr);
765 	if(namelen > sizeof(buf))
766 		namelen = sizeof(buf);
767 	*lengthp = namelen;
768 	memcpy(buf, xcb_get_atom_name_name(atomr), namelen);
769 	*namep = buf;
770 	free(atomr);
771 	return 1;
772 }
773 
774 static char *makename(const char *fmt, ...)
775 {
776 	char *ret;
777 	int n;
778 	va_list ap;
779 
780 #ifndef HAVE_VASPRINTF
781 	char *np;
782 	int size = 64;
783 
784 	/* First allocate 'size' bytes, should be enough usually */
785 	if((ret = malloc(size)) == NULL)
786 		return NULL;
787 
788 	while(1)
789 	{
790 		va_start(ap, fmt);
791 		n = vsnprintf(ret, size, fmt, ap);
792 		va_end(ap);
793 
794 		if(n < 0)
795 			return NULL;
796 
797 		if(n < size)
798 			return ret;
799 
800 		size = n + 1;
801 		if((np = realloc(ret, size)) == NULL)
802 		{
803 			free(ret);
804 			return NULL;
805 		}
806 
807 		ret = np;
808 	}
809 #else
810 	va_start(ap, fmt);
811 	n = vasprintf(&ret, fmt, ap);
812 	va_end(ap);
813 
814 	if(n < 0)
815 		return NULL;
816 
817 	return ret;
818 #endif
819 }
820 
821 char *xcb_atom_name_by_screen(const char *base, uint8_t screen)
822 {
823 	return makename("%s_S%u", base, screen);
824 }
825 
826 char *xcb_atom_name_by_resource(const char *base, uint32_t resource)
827 {
828 	return makename("%s_R%08X", base, resource);
829 }
830 
831 char *xcb_atom_name_unique(const char *base, uint32_t id)
832 {
833 	if(base)
834 		return makename("%s_U%lu", base, id);
835 	else
836 		return makename("U%lu", id);
837 }
838