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. */
24 #include "locfile-token.h"
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 */
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
;
62 hval
+= asso_values
[(int) str
[4]];
66 hval
+= asso_values
[(int) str
[1]];
68 hval
+= asso_values
[(int) str
[0]];
71 return hval
+ asso_values
[(int) str
[len
- 1]];
77 const struct keyword_t
*
78 charmap_hash (register const char *str
, register int len
)
80 static const struct keyword_t wordlist
[] =
85 {"WIDTH", tok_width
, 0},
87 {"CHARMAP", tok_charmap
, 0},
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},
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
];