1 /* ANSI-C code produced by gperf version 3.1 */
2 /* Command-line: gperf -acCgopt -k'1,2,5,9,$' -L ANSI-C -N charmap_hash charmap-kw.gperf */
3
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-gperf@gnu.org>."
29 #endif
30
31 #line 1 "charmap-kw.gperf"
32
33 /* Copyright (C) 1995-2022 Free Software Foundation, Inc.
34 This file is part of the GNU C Library.
35
36 This program is free software; you can redistribute it and/or modify
37 it under the terms of the GNU General Public License as published
38 by the Free Software Foundation; version 2 of the License, or
39 (at your option) any later version.
40
41 This program is distributed in the hope that it will be useful,
42 but WITHOUT ANY WARRANTY; without even the implied warranty of
43 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44 GNU General Public License for more details.
45
46 You should have received a copy of the GNU General Public License
47 along with this program; if not, see
48 <https://www.gnu.org/licenses/>. */
49
50 #include <string.h>
51
52 #include "locfile-token.h"
53 #line 23 "charmap-kw.gperf"
54 struct keyword_t ;
55
56 #define TOTAL_KEYWORDS 17
57 #define MIN_WORD_LENGTH 3
58 #define MAX_WORD_LENGTH 14
59 #define MIN_HASH_VALUE 3
60 #define MAX_HASH_VALUE 35
61 /* maximum key range = 33, duplicates = 0 */
62
63 #ifdef __GNUC__
64 __inline
65 #else
66 #ifdef __cplusplus
67 inline
68 #endif
69 #endif
70 static unsigned int
hash(register const char * str,register size_t len)71 hash (register const char *str, register size_t len)
72 {
73 static const unsigned char asso_values[] =
74 {
75 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
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, 25, 20,
80 15, 10, 36, 36, 36, 36, 36, 36, 36, 36,
81 36, 36, 36, 36, 36, 36, 36, 5, 0, 0,
82 5, 36, 0, 0, 36, 36, 36, 5, 0, 36,
83 0, 36, 0, 36, 0, 36, 36, 0, 36, 36,
84 36, 36, 36, 36, 36, 0, 36, 5, 0, 0,
85 5, 0, 36, 5, 0, 0, 36, 36, 36, 0,
86 0, 0, 0, 0, 0, 0, 0, 0, 36, 36,
87 0, 36, 36, 36, 36, 36, 36, 36, 36, 36,
88 36, 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
101 };
102 register unsigned int hval = len;
103
104 switch (hval)
105 {
106 default:
107 hval += asso_values[(unsigned char)str[8]];
108 /*FALLTHROUGH*/
109 case 8:
110 case 7:
111 case 6:
112 case 5:
113 hval += asso_values[(unsigned char)str[4]];
114 /*FALLTHROUGH*/
115 case 4:
116 case 3:
117 case 2:
118 hval += asso_values[(unsigned char)str[1]];
119 /*FALLTHROUGH*/
120 case 1:
121 hval += asso_values[(unsigned char)str[0]];
122 break;
123 }
124 return hval + asso_values[(unsigned char)str[len - 1]];
125 }
126
127 const struct keyword_t *
charmap_hash(register const char * str,register size_t len)128 charmap_hash (register const char *str, register size_t len)
129 {
130 static const struct keyword_t wordlist[] =
131 {
132 {""}, {""}, {""},
133 #line 38 "charmap-kw.gperf"
134 {"END", tok_end, 0},
135 {""},
136 #line 39 "charmap-kw.gperf"
137 {"WIDTH", tok_width, 0},
138 #line 34 "charmap-kw.gperf"
139 {"escseq", tok_escseq, 1},
140 #line 36 "charmap-kw.gperf"
141 {"include", tok_include, 1},
142 {""}, {""},
143 #line 27 "charmap-kw.gperf"
144 {"mb_cur_min", tok_mb_cur_min, 1},
145 #line 28 "charmap-kw.gperf"
146 {"escape_char", tok_escape_char, 1},
147 #line 29 "charmap-kw.gperf"
148 {"comment_char", tok_comment_char, 1},
149 #line 25 "charmap-kw.gperf"
150 {"code_set_name", tok_code_set_name, 1},
151 #line 40 "charmap-kw.gperf"
152 {"WIDTH_VARIABLE", tok_width_variable, 0},
153 #line 26 "charmap-kw.gperf"
154 {"mb_cur_max", tok_mb_cur_max, 1},
155 #line 35 "charmap-kw.gperf"
156 {"addset", tok_addset, 1},
157 #line 37 "charmap-kw.gperf"
158 {"CHARMAP", tok_charmap, 0},
159 #line 41 "charmap-kw.gperf"
160 {"WIDTH_DEFAULT", tok_width_default, 0},
161 {""},
162 #line 33 "charmap-kw.gperf"
163 {"g3esc", tok_g3esc, 1},
164 {""}, {""}, {""}, {""},
165 #line 32 "charmap-kw.gperf"
166 {"g2esc", tok_g2esc, 1},
167 {""}, {""}, {""}, {""},
168 #line 31 "charmap-kw.gperf"
169 {"g1esc", tok_g1esc, 1},
170 {""}, {""}, {""}, {""},
171 #line 30 "charmap-kw.gperf"
172 {"g0esc", tok_g0esc, 1}
173 };
174
175 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
176 {
177 register unsigned int key = hash (str, len);
178
179 if (key <= MAX_HASH_VALUE)
180 {
181 register const char *s = wordlist[key].name;
182
183 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
184 return &wordlist[key];
185 }
186 }
187 return 0;
188 }
189