1 /* C code produced by gperf version 2.5 (GNU C++ version) */
2 /* Command-line: gperf -acCgopt -k1,2,5,$ -N locfile_hash programs/locfile-kw.gperf */
3 /* Copyright (C) 1996 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with the GNU C Library; see the file COPYING.LIB. If
19 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
24 #include "locfile-token.h"
27 #define TOTAL_KEYWORDS 73
28 #define MIN_WORD_LENGTH 3
29 #define MAX_WORD_LENGTH 17
30 #define MIN_HASH_VALUE 3
31 #define MAX_HASH_VALUE 185
32 /* maximum key range = 183, duplicates = 0 */
38 hash (register const char *str, register int len)
40 static const unsigned char asso_values[] =
42 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
43 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
44 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
45 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
46 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
47 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
48 186, 186, 186, 186, 186, 186, 186, 0, 0, 0,
49 0, 0, 186, 0, 186, 186, 0, 186, 0, 35,
50 186, 186, 0, 0, 0, 5, 186, 186, 186, 0,
51 186, 186, 186, 186, 186, 15, 186, 0, 0, 5,
52 15, 10, 55, 30, 15, 75, 186, 20, 5, 40,
53 10, 0, 0, 186, 35, 30, 0, 70, 186, 10,
54 20, 75, 186, 186, 186, 186, 186, 186,
56 register int hval = len;
62 hval += asso_values[(int) str[4]];
66 hval += asso_values[(int) str[1]];
68 hval += asso_values[(int) str[0]];
71 return hval + asso_values[(int) str[len - 1]];
77 const struct keyword_t *
78 locfile_hash (register const char *str, register int len)
80 static const struct keyword_t wordlist[] =
85 {"IGNORE", tok_ignore, 0},
86 {"LC_TIME", tok_lc_time, 0},
87 {"LC_CTYPE", tok_lc_ctype, 0},
89 {"alpha", tok_alpha, 0},
90 {"LC_MESSAGES", tok_lc_messages, 0},
92 {"UNDEFINED", tok_undefined, 0},
93 {"LC_NUMERIC", tok_lc_numeric, 0},
95 {"position", tok_position, 0},
97 {"t_fmt", tok_t_fmt, 0},
99 {"collating-element", tok_collating_element, 0},
100 {"positive_sign", tok_positive_sign, 0},
102 {"abmon", tok_abmon, 0},
103 {"collating-symbol", tok_collating_symbol, 0},
105 {"cntrl", tok_cntrl, 0},
107 {"backward", tok_backward, 0},
109 {"d_fmt", tok_d_fmt, 0},
111 {"p_sep_by_space", tok_p_sep_by_space, 0},
112 {"print", tok_print, 0},
114 {"toupper", tok_toupper, 0},
115 {"negative_sign", tok_negative_sign, 0},
117 {"LC_COLLATE", tok_lc_collate, 0},
118 {"LC_MONETARY", tok_lc_monetary, 0},
121 {"n_sep_by_space", tok_n_sep_by_space, 0},
122 {"blank", tok_blank, 0},
123 {"noexpr", tok_noexpr, 0},
124 {"tolower", tok_tolower, 0},
126 {"era_t_fmt", tok_era_t_fmt, 0},
127 {"space", tok_space, 0},
129 {"mon_thousands_sep", tok_mon_thousands_sep, 0},
130 {"thousands_sep", tok_thousands_sep, 0},
132 {"alt_digits", tok_alt_digits, 0},
134 {"comment_char", tok_comment_char, 0},
136 {"charclass", tok_charclass, 0},
137 {"t_fmt_ampm", tok_t_fmt_ampm, 0},
138 {"p_sign_posn", tok_p_sign_posn, 0},
139 {"charmap", tok_charmap, 0},
141 {"era_d_fmt", tok_era_d_fmt, 0},
143 {"era_d_t_fmt", tok_era_d_t_fmt, 0},
144 {"mon_decimal_point", tok_mon_decimal_point, 0},
145 {"p_cs_precedes", tok_p_cs_precedes, 0},
147 {"punct", tok_punct, 0},
148 {"n_sign_posn", tok_n_sign_posn, 0},
149 {"forward", tok_forward, 0},
150 {"decimal_point", tok_decimal_point, 0},
152 {"lower", tok_lower, 0},
153 {"order_start", tok_order_start, 0},
155 {"n_cs_precedes", tok_n_cs_precedes, 0},
156 {"copy", tok_copy, 0},
157 {"nostr", tok_nostr, 0},
158 {"escape_char", tok_escape_char, 0},
160 {"alnum", tok_alnum, 0},
162 {"d_t_fmt", tok_d_t_fmt, 0},
164 {"order_end", tok_order_end, 0},
165 {"digit", tok_digit, 0},
166 {"",}, {"",}, {"",}, {"",},
167 {"graph", tok_graph, 0},
169 {"grouping", tok_grouping, 0},
171 {"currency_symbol", tok_currency_symbol, 0},
172 {"",}, {"",}, {"",}, {"",},
173 {"int_curr_symbol", tok_int_curr_symbol, 0},
175 {"mon_grouping", tok_mon_grouping, 0},
177 {"xdigit", tok_xdigit, 0},
178 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
179 {"am_pm", tok_am_pm, 0},
180 {"yesstr", tok_yesstr, 0},
181 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
182 {"from", tok_from, 0},
183 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
185 {"upper", tok_upper, 0},
186 {"frac_digits", tok_frac_digits, 0},
187 {"yesexpr", tok_yesexpr, 0},
188 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
189 {"abday", tok_abday, 0},
190 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
191 {"era_year", tok_era_year, 0},
192 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
193 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
195 {"int_frac_digits", tok_int_frac_digits, 0},
198 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
200 register int key = hash (str, len);
202 if (key <= MAX_HASH_VALUE && key >= 0)
204 register const char *s = wordlist[key].name;
206 if (*s == *str && !strncmp (str + 1, s + 1, len - 1))
207 return &wordlist[key];