Back to index

glibc  2.9
charmap-kw.h
Go to the documentation of this file.
00001 /* ANSI-C code produced by gperf version 3.0.1 */
00002 /* Command-line: gperf -acCgopt -k'1,2,5,9,$' -L ANSI-C -N charmap_hash charmap-kw.gperf  */
00003 
00004 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
00005       && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
00006       && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
00007       && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
00008       && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
00009       && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
00010       && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
00011       && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
00012       && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
00013       && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
00014       && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
00015       && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
00016       && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
00017       && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
00018       && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
00019       && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
00020       && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
00021       && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
00022       && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
00023       && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
00024       && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
00025       && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
00026       && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
00027 /* The character set is not based on ISO-646.  */
00028 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
00029 #endif
00030 
00031 #line 1 "charmap-kw.gperf"
00032 
00033 /* Copyright (C) 1995,1996,1997,1998,1999,2005 Free Software Foundation, Inc.
00034    This file is part of the GNU C Library.
00035    Contributed by Ulrich Drepper, <drepper@gnu.org>.
00036 
00037    This program is free software; you can redistribute it and/or modify
00038    it under the terms of the GNU General Public License as published
00039    by the Free Software Foundation; version 2 of the License, or
00040    (at your option) any later version.
00041 
00042    This program is distributed in the hope that it will be useful,
00043    but WITHOUT ANY WARRANTY; without even the implied warranty of
00044    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00045    GNU General Public License for more details.
00046 
00047    You should have received a copy of the GNU General Public License
00048    along with this program; if not, write to the Free Software Foundation,
00049    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00050 
00051 #include <string.h>
00052 
00053 #include "locfile-token.h"
00054 #line 23 "charmap-kw.gperf"
00055 struct keyword_t ;
00056 
00057 #define TOTAL_KEYWORDS 17
00058 #define MIN_WORD_LENGTH 3
00059 #define MAX_WORD_LENGTH 14
00060 #define MIN_HASH_VALUE 3
00061 #define MAX_HASH_VALUE 35
00062 /* maximum key range = 33, duplicates = 0 */
00063 
00064 #ifdef __GNUC__
00065 __inline
00066 #else
00067 #ifdef __cplusplus
00068 inline
00069 #endif
00070 #endif
00071 static unsigned int
00072 hash (register const char *str, register unsigned int len)
00073 {
00074   static const unsigned char asso_values[] =
00075     {
00076       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00077       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00078       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00079       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00080       36, 36, 36, 36, 36, 36, 36, 36, 25, 20,
00081       15, 10, 36, 36, 36, 36, 36, 36, 36, 36,
00082       36, 36, 36, 36, 36, 36, 36,  5,  0,  0,
00083        5, 36,  0,  0, 36, 36, 36,  5,  0, 36,
00084        0, 36,  0, 36,  0, 36, 36,  0, 36, 36,
00085       36, 36, 36, 36, 36,  0, 36,  5,  0,  0,
00086        5,  0, 36,  5,  0,  0, 36, 36, 36,  0,
00087        0,  0,  0,  0,  0,  0,  0,  0, 36, 36,
00088        0, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00089       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00090       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00091       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00092       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00093       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00094       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00095       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00096       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00097       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00098       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00099       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00100       36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
00101       36, 36, 36, 36, 36, 36
00102     };
00103   register int hval = len;
00104 
00105   switch (hval)
00106     {
00107       default:
00108         hval += asso_values[(unsigned char)str[8]];
00109       /*FALLTHROUGH*/
00110       case 8:
00111       case 7:
00112       case 6:
00113       case 5:
00114         hval += asso_values[(unsigned char)str[4]];
00115       /*FALLTHROUGH*/
00116       case 4:
00117       case 3:
00118       case 2:
00119         hval += asso_values[(unsigned char)str[1]];
00120       /*FALLTHROUGH*/
00121       case 1:
00122         hval += asso_values[(unsigned char)str[0]];
00123         break;
00124     }
00125   return hval + asso_values[(unsigned char)str[len - 1]];
00126 }
00127 
00128 #ifdef __GNUC__
00129 __inline
00130 #endif
00131 const struct keyword_t *
00132 charmap_hash (register const char *str, register unsigned int len)
00133 {
00134   static const struct keyword_t wordlist[] =
00135     {
00136       {""}, {""}, {""},
00137 #line 38 "charmap-kw.gperf"
00138       {"END",             tok_end,             0},
00139       {""},
00140 #line 39 "charmap-kw.gperf"
00141       {"WIDTH",           tok_width,           0},
00142 #line 34 "charmap-kw.gperf"
00143       {"escseq",          tok_escseq,          1},
00144 #line 36 "charmap-kw.gperf"
00145       {"include",         tok_include,         1},
00146       {""}, {""},
00147 #line 27 "charmap-kw.gperf"
00148       {"mb_cur_min",      tok_mb_cur_min,      1},
00149 #line 28 "charmap-kw.gperf"
00150       {"escape_char",     tok_escape_char,     1},
00151 #line 29 "charmap-kw.gperf"
00152       {"comment_char",    tok_comment_char,    1},
00153 #line 25 "charmap-kw.gperf"
00154       {"code_set_name",   tok_code_set_name,   1},
00155 #line 40 "charmap-kw.gperf"
00156       {"WIDTH_VARIABLE",  tok_width_variable,  0},
00157 #line 26 "charmap-kw.gperf"
00158       {"mb_cur_max",      tok_mb_cur_max,      1},
00159 #line 35 "charmap-kw.gperf"
00160       {"addset",          tok_addset,          1},
00161 #line 37 "charmap-kw.gperf"
00162       {"CHARMAP",         tok_charmap,         0},
00163 #line 41 "charmap-kw.gperf"
00164       {"WIDTH_DEFAULT",   tok_width_default,   0},
00165       {""},
00166 #line 33 "charmap-kw.gperf"
00167       {"g3esc",           tok_g3esc,           1},
00168       {""}, {""}, {""}, {""},
00169 #line 32 "charmap-kw.gperf"
00170       {"g2esc",           tok_g2esc,           1},
00171       {""}, {""}, {""}, {""},
00172 #line 31 "charmap-kw.gperf"
00173       {"g1esc",           tok_g1esc,           1},
00174       {""}, {""}, {""}, {""},
00175 #line 30 "charmap-kw.gperf"
00176       {"g0esc",           tok_g0esc,           1}
00177     };
00178 
00179   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
00180     {
00181       register int key = hash (str, len);
00182 
00183       if (key <= MAX_HASH_VALUE && key >= 0)
00184         {
00185           register const char *s = wordlist[key].name;
00186 
00187           if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
00188             return &wordlist[key];
00189         }
00190     }
00191   return 0;
00192 }