* sysdeps/hppa/bits/setjmp.h: Add _BITS_SETJMP_H preprocessor
[glibc.git] / locale / programs / charmap-kw.h
blob089f45d7d8ba9ed3dc94b1db43f846c3a07a3f52
1 /* ANSI-C code produced by gperf version 2.7.2 */
2 /* Command-line: gperf -acCgopt -k'1,2,5,9,$' -L ANSI-C -N charmap_hash programs/charmap-kw.gperf */
3 /* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Contributed by Ulrich Drepper, <drepper@gnu.org>.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the 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 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, write to the Free
19 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 02111-1307 USA. */
22 #include <string.h>
24 #include "locfile-token.h"
25 struct keyword_t ;
27 #define TOTAL_KEYWORDS 17
28 #define MIN_WORD_LENGTH 3
29 #define MAX_WORD_LENGTH 14
30 #define MIN_HASH_VALUE 3
31 #define MAX_HASH_VALUE 35
32 /* maximum key range = 33, duplicates = 0 */
34 #ifdef __GNUC__
35 __inline
36 #else
37 #ifdef __cplusplus
38 inline
39 #endif
40 #endif
41 static unsigned int
42 hash (register const char *str, register unsigned int len)
44 static const unsigned char asso_values[] =
46 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
47 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
48 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
49 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
50 36, 36, 36, 36, 36, 36, 36, 36, 25, 10,
51 15, 20, 36, 36, 36, 36, 36, 36, 36, 36,
52 36, 36, 36, 36, 36, 36, 36, 10, 0, 0,
53 5, 36, 0, 0, 36, 36, 36, 0, 0, 36,
54 0, 36, 0, 36, 0, 36, 36, 0, 36, 36,
55 36, 36, 36, 36, 36, 0, 36, 0, 0, 0,
56 10, 0, 36, 0, 0, 0, 36, 36, 36, 0,
57 0, 0, 0, 0, 0, 0, 0, 0, 36, 36,
58 25, 36, 36, 36, 36, 36, 36, 36, 36, 36,
59 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
60 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
61 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
62 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
63 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
64 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
65 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
66 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
67 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
68 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
69 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
70 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
71 36, 36, 36, 36, 36, 36
73 register int hval = len;
75 switch (hval)
77 default:
78 case 9:
79 hval += asso_values[(unsigned char)str[8]];
80 case 8:
81 case 7:
82 case 6:
83 case 5:
84 hval += asso_values[(unsigned char)str[4]];
85 case 4:
86 case 3:
87 case 2:
88 hval += asso_values[(unsigned char)str[1]];
89 case 1:
90 hval += asso_values[(unsigned char)str[0]];
91 break;
93 return hval + asso_values[(unsigned char)str[len - 1]];
96 #ifdef __GNUC__
97 __inline
98 #endif
99 const struct keyword_t *
100 charmap_hash (register const char *str, register unsigned int len)
102 static const struct keyword_t wordlist[] =
104 {""}, {""}, {""},
105 {"END", tok_end, 0},
106 {""},
107 {"WIDTH", tok_width, 0},
108 {"escseq", tok_escseq, 1},
109 {"include", tok_include, 1},
110 {""}, {""},
111 {"mb_cur_min", tok_mb_cur_min, 1},
112 {"escape_char", tok_escape_char, 1},
113 {"comment_char", tok_comment_char, 1},
114 {"code_set_name", tok_code_set_name, 1},
115 {"WIDTH_VARIABLE", tok_width_variable, 0},
116 {"g1esc", tok_g1esc, 1},
117 {"addset", tok_addset, 1},
118 {"CHARMAP", tok_charmap, 0},
119 {"WIDTH_DEFAULT", tok_width_default, 0},
120 {""},
121 {"g2esc", tok_g2esc, 1},
122 {""}, {""}, {""}, {""},
123 {"g3esc", tok_g3esc, 1},
124 {""}, {""}, {""}, {""},
125 {"g0esc", tok_g0esc, 1},
126 {""}, {""}, {""}, {""},
127 {"mb_cur_max", tok_mb_cur_max, 1}
130 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
132 register int key = hash (str, len);
134 if (key <= MAX_HASH_VALUE && key >= 0)
136 register const char *s = wordlist[key].name;
138 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
139 return &wordlist[key];
142 return 0;