Update to 2.1.x development version
[glibc.git] / locale / programs / locfile-kw.h
blob0fb0b5ca5f4dc04f6c2942e32368ee122a586f32
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, 1997 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
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 not,
19 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 #include <string.h>
24 #include "locfile-token.h"
25 struct keyword_t ;
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 132
32 /* maximum key range = 130, duplicates = 0 */
34 #ifdef __GNUC__
35 inline
36 #endif
37 static unsigned int
38 hash (register const char *str, register int len)
40 static const unsigned char asso_values[] =
42 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
43 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
44 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
45 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
46 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
47 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
48 133, 133, 133, 133, 133, 133, 133, 0, 0, 0,
49 0, 0, 133, 0, 133, 133, 0, 133, 0, 20,
50 133, 133, 0, 0, 0, 5, 133, 133, 133, 5,
51 133, 133, 133, 133, 133, 5, 133, 0, 60, 0,
52 15, 10, 20, 40, 5, 20, 133, 0, 45, 40,
53 10, 0, 0, 133, 15, 50, 0, 30, 0, 10,
54 15, 15, 133, 133, 133, 133, 133, 133,
56 register int hval = len;
58 switch (hval)
60 default:
61 case 5:
62 hval += asso_values[str[4]];
63 case 4:
64 case 3:
65 case 2:
66 hval += asso_values[str[1]];
67 case 1:
68 hval += asso_values[str[0]];
69 break;
71 return hval + asso_values[str[len - 1]];
74 #ifdef __GNUC__
75 inline
76 #endif
77 const struct keyword_t *
78 locfile_hash (register const char *str, register int len)
80 static const struct keyword_t wordlist[] =
82 {"",}, {"",}, {"",},
83 {"END", tok_end, 0},
84 {"",}, {"",},
85 {"IGNORE", tok_ignore, 0},
86 {"LC_TIME", tok_lc_time, 0},
87 {"LC_CTYPE", tok_lc_ctype, 0},
88 {"",},
89 {"t_fmt", tok_t_fmt, 0},
90 {"LC_MESSAGES", tok_lc_messages, 0},
91 {"",},
92 {"charconv", tok_charconv, 0},
93 {"UNDEFINED", tok_undefined, 0},
94 {"LC_NUMERIC", tok_lc_numeric, 0},
95 {"",},
96 {"collating-element", tok_collating_element, 0},
97 {"position", tok_position, 0},
98 {"copy", tok_copy, 0},
99 {"print", tok_print, 0},
100 {"",},
101 {"toupper", tok_toupper, 0},
102 {"positive_sign", tok_positive_sign, 0},
103 {"",},
104 {"d_fmt", tok_d_fmt, 0},
105 {"",}, {"",},
106 {"era", tok_era, 0},
107 {"p_sep_by_space", tok_p_sep_by_space, 0},
108 {"LC_COLLATE", tok_lc_collate, 0},
109 {"noexpr", tok_noexpr, 0},
110 {"tolower", tok_tolower, 0},
111 {"day", tok_day, 0},
112 {"era_t_fmt", tok_era_t_fmt, 0},
113 {"punct", tok_punct, 0},
114 {"LC_MONETARY", tok_lc_monetary, 0},
115 {"comment_char", tok_comment_char, 0},
116 {"",},
117 {"n_sep_by_space", tok_n_sep_by_space, 0},
118 {"digit", tok_digit, 0},
119 {"order_start", tok_order_start, 0},
120 {"forward", tok_forward, 0},
121 {"negative_sign", tok_negative_sign, 0},
122 {"",},
123 {"nostr", tok_nostr, 0},
124 {"yesstr", tok_yesstr, 0},
125 {"d_t_fmt", tok_d_t_fmt, 0},
126 {"",},
127 {"era_d_fmt", tok_era_d_fmt, 0},
128 {"alpha", tok_alpha, 0},
129 {"era_d_t_fmt", tok_era_d_t_fmt, 0},
130 {"",},
131 {"mon", tok_mon, 0},
132 {"order_end", tok_order_end, 0},
133 {"t_fmt_ampm", tok_t_fmt_ampm, 0},
134 {"xdigit", tok_xdigit, 0},
135 {"mon_thousands_sep", tok_mon_thousands_sep, 0},
136 {"",}, {"",}, {"",},
137 {"collating-symbol", tok_collating_symbol, 0},
138 {"yesexpr", tok_yesexpr, 0},
139 {"era_year", tok_era_year, 0},
140 {"charclass", tok_charclass, 0},
141 {"upper", tok_upper, 0},
142 {"p_sign_posn", tok_p_sign_posn, 0},
143 {"",},
144 {"thousands_sep", tok_thousands_sep, 0},
145 {"",},
146 {"graph", tok_graph, 0},
147 {"",},
148 {"mon_decimal_point", tok_mon_decimal_point, 0},
149 {"p_cs_precedes", tok_p_cs_precedes, 0},
150 {"",},
151 {"space", tok_space, 0},
152 {"n_sign_posn", tok_n_sign_posn, 0},
153 {"",},
154 {"decimal_point", tok_decimal_point, 0},
155 {"from", tok_from, 0},
156 {"lower", tok_lower, 0},
157 {"",}, {"",},
158 {"n_cs_precedes", tok_n_cs_precedes, 0},
159 {"",},
160 {"abmon", tok_abmon, 0},
161 {"escape_char", tok_escape_char, 0},
162 {"",}, {"",}, {"",},
163 {"int_curr_symbol", tok_int_curr_symbol, 0},
164 {"",}, {"",},
165 {"backward", tok_backward, 0},
166 {"",},
167 {"abday", tok_abday, 0},
168 {"",}, {"",}, {"",}, {"",},
169 {"currency_symbol", tok_currency_symbol, 0},
170 {"frac_digits", tok_frac_digits, 0},
171 {"",},
172 {"grouping", tok_grouping, 0},
173 {"",},
174 {"cntrl", tok_cntrl, 0},
175 {"",}, {"",}, {"",}, {"",},
176 {"blank", tok_blank, 0},
177 {"",}, {"",}, {"",}, {"",},
178 {"int_frac_digits", tok_int_frac_digits, 0},
179 {"",}, {"",}, {"",}, {"",},
180 {"alt_digits", tok_alt_digits, 0},
181 {"",}, {"",}, {"",}, {"",},
182 {"am_pm", tok_am_pm, 0},
183 {"",}, {"",}, {"",}, {"",},
184 {"alnum", tok_alnum, 0},
185 {"",},
186 {"mon_grouping", tok_mon_grouping, 0},
189 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
191 register int key = hash (str, len);
193 if (key <= MAX_HASH_VALUE && key >= 0)
195 register const char *s = wordlist[key].name;
197 if (*s == *str && !strncmp (str + 1, s + 1, len - 1))
198 return &wordlist[key];
201 return 0;