* posix/glob.h (__glob_opendir_hook, __glob_readdir_hook,
[glibc.git] / locale / programs / charmap-kw.h
blob93326d03829a9f6cbba484d5df37dc14b30df6ee
1 /* C code produced by gperf version 2.5 (GNU C++ version) */
2 /* Command-line: gperf -acCgopt -k1,2,5,$ -N charmap_hash programs/charmap-kw.gperf */
3 /* Copyright (C) 1995, 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. */
22 #include <string.h>
24 #include "locfile-token.h"
25 struct keyword_t ;
27 #define TOTAL_KEYWORDS 14
28 #define MIN_WORD_LENGTH 3
29 #define MAX_WORD_LENGTH 14
30 #define MIN_HASH_VALUE 3
31 #define MAX_HASH_VALUE 25
32 /* maximum key range = 23, 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 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
43 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
44 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
45 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
46 26, 26, 26, 26, 26, 26, 26, 26, 14, 10,
47 15, 4, 26, 26, 26, 26, 26, 26, 26, 26,
48 26, 26, 26, 26, 26, 26, 26, 0, 0, 0,
49 26, 26, 0, 0, 26, 26, 26, 0, 0, 26,
50 0, 26, 26, 26, 5, 26, 26, 0, 26, 26,
51 26, 26, 26, 26, 26, 0, 26, 26, 0, 0,
52 26, 0, 26, 0, 26, 26, 26, 26, 26, 0,
53 15, 0, 0, 26, 0, 0, 26, 0, 26, 26,
54 0, 26, 26, 26, 26, 26, 26, 26,
56 register int hval = len;
58 switch (hval)
60 default:
61 case 5:
62 hval += asso_values[(int) str[4]];
63 case 4:
64 case 3:
65 case 2:
66 hval += asso_values[(int) str[1]];
67 case 1:
68 hval += asso_values[(int) str[0]];
69 break;
71 return hval + asso_values[(int) str[len - 1]];
74 #ifdef __GNUC__
75 inline
76 #endif
77 const struct keyword_t *
78 charmap_hash (register const char *str, register int len)
80 static const struct keyword_t wordlist[] =
82 {"",}, {"",}, {"",},
83 {"END", tok_end, 0},
84 {"",},
85 {"WIDTH", tok_width, 0},
86 {"",},
87 {"CHARMAP", tok_charmap, 0},
88 {"",},
89 {"g3esc", tok_g3esc, 1},
90 {"mb_cur_max", tok_mb_cur_max, 1},
91 {"escape_char", tok_escape_char, 1},
92 {"comment_char", tok_comment_char, 1},
93 {"code_set_name", tok_code_set_name, 1},
94 {"WIDTH_VARIABLE", tok_width_variable, 0},
95 {"g1esc", tok_g1esc, 1},
96 {"",}, {"",},
97 {"WIDTH_DEFAULT", tok_width_default, 0},
98 {"g0esc", tok_g0esc, 1},
99 {"g2esc", tok_g2esc, 1},
100 {"",}, {"",}, {"",}, {"",},
101 {"mb_cur_min", tok_mb_cur_min, 1},
104 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
106 register int key = hash (str, len);
108 if (key <= MAX_HASH_VALUE && key >= 0)
110 register const char *s = wordlist[key].name;
112 if (*s == *str && !strncmp (str + 1, s + 1, len - 1))
113 return &wordlist[key];
116 return 0;