* stdio/vfscanf.c (conv_error): Simplify expression to avoid
[glibc.git] / locale / keyword.h
blob1dc442aee510d4b03cf9641050b0921d82b35d68
1 /* C code produced by gperf version 2.5 (GNU C++ version) */
2 /* Command-line: gperf -acCgopt -k1,2,5, keyword.gperf */
3 /* `strncmp' is used for comparison. */
4 #include <string.h>
6 /* This file defines `enum token'. */
7 #include "token.h"
8 struct locale_keyword { char *name; enum token token_id; };
10 #define TOTAL_KEYWORDS 68
11 #define MIN_WORD_LENGTH 3
12 #define MAX_WORD_LENGTH 17
13 #define MIN_HASH_VALUE 4
14 #define MAX_HASH_VALUE 140
15 /* maximum key range = 137, duplicates = 0 */
17 #ifdef __GNUC__
18 inline
19 #endif
20 static unsigned int
21 hash (register const char *str, register int len)
23 static const unsigned char asso_values[] =
25 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
26 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
27 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
28 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
29 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
30 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
31 141, 141, 141, 141, 141, 141, 141, 0, 141, 65,
32 5, 0, 141, 30, 141, 141, 0, 141, 0, 95,
33 141, 141, 0, 141, 45, 10, 141, 141, 141, 141,
34 141, 141, 141, 141, 141, 5, 141, 10, 85, 0,
35 20, 0, 40, 35, 30, 10, 141, 0, 30, 15,
36 15, 0, 0, 141, 55, 0, 0, 80, 141, 15,
37 10, 0, 141, 141, 141, 141, 141, 141,
39 register int hval = len;
41 switch (hval)
43 default:
44 case 5:
45 hval += asso_values[str[4]];
46 case 4:
47 case 3:
48 case 2:
49 hval += asso_values[str[1]];
50 case 1:
51 hval += asso_values[str[0]];
53 return hval;
56 #ifdef __GNUC__
57 inline
58 #endif
59 const struct locale_keyword *
60 in_word_set (register const char *str, register int len)
62 static const struct locale_keyword wordlist[] =
64 {"",}, {"",}, {"",}, {"",},
65 {"copy", TOK_COPY},
66 {"space", TOK_SPACE},
67 {"yesstr", YESSTR},
68 {"toupper", TOK_TOUPPER},
69 {"position", TOK_POSITION},
70 {"",},
71 {"t_fmt", T_FMT},
72 {"escape_char", TOK_ESCAPE_CHAR},
73 {"comment_char", TOK_COMMENT_CHAR},
74 {"positive_sign", POSITIVE_SIGN},
75 {"",},
76 {"t_fmt_ampm", T_FMT_AMPM},
77 {"",},
78 {"yesexpr", YESEXPR},
79 {"mon", MON_1},
80 {"p_sep_by_space", P_SEP_BY_SPACE},
81 {"LC_NUMERIC", _NL_NUM_LC_NUMERIC},
82 {"noexpr", NOEXPR},
83 {"tolower", TOK_TOLOWER},
84 {"p_cs_precedes", P_CS_PRECEDES},
85 {"UNDEFINED", TOK_UNDEFINED},
86 {"",},
87 {"collating_symbol", TOK_COLLATING_SYMBOL},
88 {"collating_element", TOK_COLLATING_ELEMENT},
89 {"negative_sign", NEGATIVE_SIGN},
90 {"",},
91 {"d_fmt", D_FMT},
92 {"",},
93 {"mon_thousands_sep", MON_THOUSANDS_SEP},
94 {"day", DAY_1},
95 {"n_sep_by_space", N_SEP_BY_SPACE},
96 {"digit", TOK_DIGIT},
97 {"IGNORE", TOK_IGNORE},
98 {"LC_TIME", _NL_NUM_LC_TIME},
99 {"n_cs_precedes", N_CS_PRECEDES},
100 {"",},
101 {"int_curr_symbol", INT_CURR_SYMBOL},
102 {"",}, {"",},
103 {"thousands_sep", THOUSANDS_SEP},
104 {"",},
105 {"am_pm", AM_STR},
106 {"xdigit", TOK_XDIGIT},
107 {"",},
108 {"decimal_point", DECIMAL_POINT},
109 {"",},
110 {"cntrl", TOK_CNTRL},
111 {"p_sign_posn", P_SIGN_POSN},
112 {"mon_decimal_point", MON_DECIMAL_POINT},
113 {"LC_CTYPE", _NL_NUM_LC_CTYPE},
114 {"",},
115 {"alpha", TOK_ALPHA},
116 {"",},
117 {"forward", TOK_FORWARD},
118 {"era", ERA},
119 {"",},
120 {"print", TOK_PRINT},
121 {"",},
122 {"mon_grouping", MON_GROUPING},
123 {"era_year", ERA_YEAR},
124 {"",}, {"",},
125 {"n_sign_posn", N_SIGN_POSN},
126 {"",},
127 {"END", TOK_END},
128 {"",},
129 {"alt_digits", ALT_DIGITS},
130 {"",},
131 {"d_t_fmt", D_T_FMT},
132 {"",}, {"",},
133 {"nostr", NOSTR},
134 {"LC_MESSAGES", _NL_NUM_LC_MESSAGES},
135 {"",}, {"",}, {"",},
136 {"int_frac_digits", INT_FRAC_DIGITS},
137 {"",}, {"",}, {"",},
138 {"era_d_fmt", ERA_D_FMT},
139 {"punct", TOK_PUNCT},
140 {"",}, {"",}, {"",}, {"",},
141 {"lower", TOK_LOWER},
142 {"",}, {"",}, {"",}, {"",},
143 {"currency_symbol", CURRENCY_SYMBOL},
144 {"",}, {"",},
145 {"grouping", GROUPING},
146 {"from", TOK_FROM},
147 {"abday", ABDAY_1},
148 {"",}, {"",}, {"",}, {"",},
149 {"LC_COLLATE", _NL_NUM_LC_COLLATE},
150 {"LC_MONETARY", _NL_NUM_LC_MONETARY},
151 {"",}, {"",}, {"",}, {"",},
152 {"frac_digits", FRAC_DIGITS},
153 {"",}, {"",}, {"",},
154 {"abmon", ABMON_1},
155 {"",}, {"",},
156 {"backward", TOK_BACKWARD},
157 {"order_end", TOK_ORDER_END},
158 {"blank", TOK_BLANK},
159 {"order_start", TOK_ORDER_START},
160 {"",}, {"",}, {"",},
161 {"graph", TOK_GRAPH},
162 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
163 {"",}, {"",}, {"",}, {"",}, {"",},
164 {"upper", TOK_UPPER},
167 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
169 register int key = hash (str, len);
171 if (key <= MAX_HASH_VALUE && key >= 0)
173 register const char *s = wordlist[key].name;
175 if (*s == *str && !strncmp (str + 1, s + 1, len - 1))
176 return &wordlist[key];
179 return 0;