1 /* ANSI-C code produced by gperf version 2.7.1 (19981006 egcs) */
2 /* Command-line: gperf -acCgopt -k1,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 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. */
24 #include "locfile-token.h"
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 */
38 hash (register const char *str, register unsigned int len)
40 static const unsigned char asso_values[] =
42 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
43 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
44 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
45 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
46 36, 36, 36, 36, 36, 36, 36, 36, 25, 10,
47 15, 20, 36, 36, 36, 36, 36, 36, 36, 36,
48 36, 36, 36, 36, 36, 36, 36, 10, 0, 0,
49 5, 36, 0, 0, 36, 36, 36, 0, 0, 36,
50 0, 36, 0, 36, 0, 36, 36, 0, 36, 36,
51 36, 36, 36, 36, 36, 0, 36, 0, 0, 0,
52 10, 0, 36, 0, 0, 0, 36, 36, 36, 0,
53 0, 0, 0, 0, 0, 0, 0, 0, 36, 36,
54 25, 36, 36, 36, 36, 36, 36, 36, 36, 36,
55 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
56 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
57 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
58 36, 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
69 register int hval = len;
75 hval += asso_values[(unsigned char)str[8]];
80 hval += asso_values[(unsigned char)str[4]];
84 hval += asso_values[(unsigned char)str[1]];
86 hval += asso_values[(unsigned char)str[0]];
89 return hval + asso_values[(unsigned char)str[len - 1]];
95 const struct keyword_t *
96 charmap_hash (register const char *str, register unsigned int len)
98 static const struct keyword_t wordlist[] =
103 {"WIDTH", tok_width, 0},
104 {"escseq", tok_escseq, 1},
105 {"include", tok_include, 1},
107 {"mb_cur_min", tok_mb_cur_min, 1},
108 {"escape_char", tok_escape_char, 1},
109 {"comment_char", tok_comment_char, 1},
110 {"code_set_name", tok_code_set_name, 1},
111 {"WIDTH_VARIABLE", tok_width_variable, 0},
112 {"g1esc", tok_g1esc, 1},
113 {"addset", tok_addset, 1},
114 {"CHARMAP", tok_charmap, 0},
115 {"WIDTH_DEFAULT", tok_width_default, 0},
117 {"g2esc", tok_g2esc, 1},
118 {""}, {""}, {""}, {""},
119 {"g3esc", tok_g3esc, 1},
120 {""}, {""}, {""}, {""},
121 {"g0esc", tok_g0esc, 1},
122 {""}, {""}, {""}, {""},
123 {"mb_cur_max", tok_mb_cur_max, 1}
126 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
128 register int key = hash (str, len);
130 if (key <= MAX_HASH_VALUE && key >= 0)
132 register const char *s = wordlist[key].name;
134 if (*str == *s && !strncmp (str + 1, s + 1, len - 1))
135 return &wordlist[key];