(hsearch_r): Add back ensurance that hval is not zero.
[glibc/history.git] / locale / programs / charmap-kw.h
blob8ad6421639f0efde2cd48e5b6af2cf4ee1647731
1 /* ANSI-C code produced by gperf version 3.0.1 */
2 /* Command-line: gperf -acCgopt -k'1,2,5,9,$' -L ANSI-C -N charmap_hash charmap-kw.gperf */
4 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
5 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
6 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
7 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
8 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
9 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
10 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
11 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
12 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
13 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
14 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
15 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
16 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
17 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
18 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
19 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
20 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
21 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
22 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
23 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
24 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
25 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
26 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
27 /* The character set is not based on ISO-646. */
28 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
29 #endif
31 #line 1 "charmap-kw.gperf"
33 /* Copyright (C) 1995,1996,1997,1998,1999,2005 Free Software Foundation, Inc.
34 This file is part of the GNU C Library.
35 Contributed by Ulrich Drepper, <drepper@gnu.org>.
37 This program is free software; you can redistribute it and/or modify
38 it under the terms of the GNU General Public License as published
39 by the Free Software Foundation; version 2 of the License, or
40 (at your option) any later version.
42 This program is distributed in the hope that it will be useful,
43 but WITHOUT ANY WARRANTY; without even the implied warranty of
44 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 GNU General Public License for more details.
47 You should have received a copy of the GNU General Public License
48 along with this program; if not, write to the Free Software Foundation,
49 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
51 #include <string.h>
53 #include "locfile-token.h"
54 #line 23 "charmap-kw.gperf"
55 struct keyword_t ;
57 #define TOTAL_KEYWORDS 17
58 #define MIN_WORD_LENGTH 3
59 #define MAX_WORD_LENGTH 14
60 #define MIN_HASH_VALUE 3
61 #define MAX_HASH_VALUE 35
62 /* maximum key range = 33, duplicates = 0 */
64 #ifdef __GNUC__
65 __inline
66 #else
67 #ifdef __cplusplus
68 inline
69 #endif
70 #endif
71 static unsigned int
72 hash (register const char *str, register unsigned int len)
74 static const unsigned char asso_values[] =
76 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
77 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
78 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
79 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
80 36, 36, 36, 36, 36, 36, 36, 36, 25, 20,
81 15, 10, 36, 36, 36, 36, 36, 36, 36, 36,
82 36, 36, 36, 36, 36, 36, 36, 5, 0, 0,
83 5, 36, 0, 0, 36, 36, 36, 5, 0, 36,
84 0, 36, 0, 36, 0, 36, 36, 0, 36, 36,
85 36, 36, 36, 36, 36, 0, 36, 5, 0, 0,
86 5, 0, 36, 5, 0, 0, 36, 36, 36, 0,
87 0, 0, 0, 0, 0, 0, 0, 0, 36, 36,
88 0, 36, 36, 36, 36, 36, 36, 36, 36, 36,
89 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
90 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
91 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
92 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
93 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
94 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
95 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
96 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
97 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
98 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
99 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
100 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
101 36, 36, 36, 36, 36, 36
103 register int hval = len;
105 switch (hval)
107 default:
108 hval += asso_values[(unsigned char)str[8]];
109 /*FALLTHROUGH*/
110 case 8:
111 case 7:
112 case 6:
113 case 5:
114 hval += asso_values[(unsigned char)str[4]];
115 /*FALLTHROUGH*/
116 case 4:
117 case 3:
118 case 2:
119 hval += asso_values[(unsigned char)str[1]];
120 /*FALLTHROUGH*/
121 case 1:
122 hval += asso_values[(unsigned char)str[0]];
123 break;
125 return hval + asso_values[(unsigned char)str[len - 1]];
128 #ifdef __GNUC__
129 __inline
130 #endif
131 const struct keyword_t *
132 charmap_hash (register const char *str, register unsigned int len)
134 static const struct keyword_t wordlist[] =
136 {""}, {""}, {""},
137 #line 38 "charmap-kw.gperf"
138 {"END", tok_end, 0},
139 {""},
140 #line 39 "charmap-kw.gperf"
141 {"WIDTH", tok_width, 0},
142 #line 34 "charmap-kw.gperf"
143 {"escseq", tok_escseq, 1},
144 #line 36 "charmap-kw.gperf"
145 {"include", tok_include, 1},
146 {""}, {""},
147 #line 27 "charmap-kw.gperf"
148 {"mb_cur_min", tok_mb_cur_min, 1},
149 #line 28 "charmap-kw.gperf"
150 {"escape_char", tok_escape_char, 1},
151 #line 29 "charmap-kw.gperf"
152 {"comment_char", tok_comment_char, 1},
153 #line 25 "charmap-kw.gperf"
154 {"code_set_name", tok_code_set_name, 1},
155 #line 40 "charmap-kw.gperf"
156 {"WIDTH_VARIABLE", tok_width_variable, 0},
157 #line 26 "charmap-kw.gperf"
158 {"mb_cur_max", tok_mb_cur_max, 1},
159 #line 35 "charmap-kw.gperf"
160 {"addset", tok_addset, 1},
161 #line 37 "charmap-kw.gperf"
162 {"CHARMAP", tok_charmap, 0},
163 #line 41 "charmap-kw.gperf"
164 {"WIDTH_DEFAULT", tok_width_default, 0},
165 {""},
166 #line 33 "charmap-kw.gperf"
167 {"g3esc", tok_g3esc, 1},
168 {""}, {""}, {""}, {""},
169 #line 32 "charmap-kw.gperf"
170 {"g2esc", tok_g2esc, 1},
171 {""}, {""}, {""}, {""},
172 #line 31 "charmap-kw.gperf"
173 {"g1esc", tok_g1esc, 1},
174 {""}, {""}, {""}, {""},
175 #line 30 "charmap-kw.gperf"
176 {"g0esc", tok_g0esc, 1}
179 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
181 register int key = hash (str, len);
183 if (key <= MAX_HASH_VALUE && key >= 0)
185 register const char *s = wordlist[key].name;
187 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
188 return &wordlist[key];
191 return 0;