xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame^] | 1 | /* ANSI-C code produced by gperf version 3.0.4 */ |
| 2 | /* Command-line: gperf -acCgopt -k'1,2,5,9,$' -L ANSI-C -N charmap_hash charmap-kw.gperf */ |
| 3 | |
| 4 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ |
| 5 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ |
| 6 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ |
| 7 | && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ |
| 8 | && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ |
| 9 | && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ |
| 10 | && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ |
| 11 | && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ |
| 12 | && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ |
| 13 | && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ |
| 14 | && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ |
| 15 | && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ |
| 16 | && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ |
| 17 | && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ |
| 18 | && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ |
| 19 | && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ |
| 20 | && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ |
| 21 | && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ |
| 22 | && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ |
| 23 | && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ |
| 24 | && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ |
| 25 | && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ |
| 26 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) |
| 27 | /* The character set is not based on ISO-646. */ |
| 28 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." |
| 29 | #endif |
| 30 | |
| 31 | #line 1 "charmap-kw.gperf" |
| 32 | |
| 33 | /* Copyright (C) 1995-2016 Free Software Foundation, Inc. |
| 34 | This file is part of the GNU C Library. |
| 35 | Contributed by Ulrich Drepper, <drepper@gnu.org>. |
| 36 | |
| 37 | This program is free software; you can redistribute it and/or modify |
| 38 | it under the terms of the GNU General Public License as published |
| 39 | by the Free Software Foundation; version 2 of the License, or |
| 40 | (at your option) any later version. |
| 41 | |
| 42 | This program is distributed in the hope that it will be useful, |
| 43 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 44 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 45 | GNU General Public License for more details. |
| 46 | |
| 47 | You should have received a copy of the GNU General Public License |
| 48 | along with this program; if not, see |
| 49 | <http://www.gnu.org/licenses/>. */ |
| 50 | |
| 51 | #include <string.h> |
| 52 | |
| 53 | #include "locfile-token.h" |
| 54 | #line 24 "charmap-kw.gperf" |
| 55 | struct keyword_t ; |
| 56 | |
| 57 | #define TOTAL_KEYWORDS 17 |
| 58 | #define MIN_WORD_LENGTH 3 |
| 59 | #define MAX_WORD_LENGTH 14 |
| 60 | #define MIN_HASH_VALUE 3 |
| 61 | #define MAX_HASH_VALUE 35 |
| 62 | /* maximum key range = 33, duplicates = 0 */ |
| 63 | |
| 64 | #ifdef __GNUC__ |
| 65 | __inline |
| 66 | #else |
| 67 | #ifdef __cplusplus |
| 68 | inline |
| 69 | #endif |
| 70 | #endif |
| 71 | static unsigned int |
| 72 | hash (register const char *str, register unsigned int len) |
| 73 | { |
| 74 | static const unsigned char asso_values[] = |
| 75 | { |
| 76 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 77 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 78 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 79 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 80 | 36, 36, 36, 36, 36, 36, 36, 36, 25, 20, |
| 81 | 15, 10, 36, 36, 36, 36, 36, 36, 36, 36, |
| 82 | 36, 36, 36, 36, 36, 36, 36, 5, 0, 0, |
| 83 | 5, 36, 0, 0, 36, 36, 36, 5, 0, 36, |
| 84 | 0, 36, 0, 36, 0, 36, 36, 0, 36, 36, |
| 85 | 36, 36, 36, 36, 36, 0, 36, 5, 0, 0, |
| 86 | 5, 0, 36, 5, 0, 0, 36, 36, 36, 0, |
| 87 | 0, 0, 0, 0, 0, 0, 0, 0, 36, 36, |
| 88 | 0, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 89 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 90 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 91 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 92 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 93 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 94 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 95 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 96 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 97 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 98 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 99 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 100 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 101 | 36, 36, 36, 36, 36, 36 |
| 102 | }; |
| 103 | register int hval = len; |
| 104 | |
| 105 | switch (hval) |
| 106 | { |
| 107 | default: |
| 108 | hval += asso_values[(unsigned char)str[8]]; |
| 109 | /*FALLTHROUGH*/ |
| 110 | case 8: |
| 111 | case 7: |
| 112 | case 6: |
| 113 | case 5: |
| 114 | hval += asso_values[(unsigned char)str[4]]; |
| 115 | /*FALLTHROUGH*/ |
| 116 | case 4: |
| 117 | case 3: |
| 118 | case 2: |
| 119 | hval += asso_values[(unsigned char)str[1]]; |
| 120 | /*FALLTHROUGH*/ |
| 121 | case 1: |
| 122 | hval += asso_values[(unsigned char)str[0]]; |
| 123 | break; |
| 124 | } |
| 125 | return hval + asso_values[(unsigned char)str[len - 1]]; |
| 126 | } |
| 127 | |
| 128 | #ifdef __GNUC__ |
| 129 | __inline |
| 130 | #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ |
| 131 | __attribute__ ((__gnu_inline__)) |
| 132 | #endif |
| 133 | #endif |
| 134 | const struct keyword_t * |
| 135 | charmap_hash (register const char *str, register unsigned int len) |
| 136 | { |
| 137 | static const struct keyword_t wordlist[] = |
| 138 | { |
| 139 | {""}, {""}, {""}, |
| 140 | #line 39 "charmap-kw.gperf" |
| 141 | {"END", tok_end, 0}, |
| 142 | {""}, |
| 143 | #line 40 "charmap-kw.gperf" |
| 144 | {"WIDTH", tok_width, 0}, |
| 145 | #line 35 "charmap-kw.gperf" |
| 146 | {"escseq", tok_escseq, 1}, |
| 147 | #line 37 "charmap-kw.gperf" |
| 148 | {"include", tok_include, 1}, |
| 149 | {""}, {""}, |
| 150 | #line 28 "charmap-kw.gperf" |
| 151 | {"mb_cur_min", tok_mb_cur_min, 1}, |
| 152 | #line 29 "charmap-kw.gperf" |
| 153 | {"escape_char", tok_escape_char, 1}, |
| 154 | #line 30 "charmap-kw.gperf" |
| 155 | {"comment_char", tok_comment_char, 1}, |
| 156 | #line 26 "charmap-kw.gperf" |
| 157 | {"code_set_name", tok_code_set_name, 1}, |
| 158 | #line 41 "charmap-kw.gperf" |
| 159 | {"WIDTH_VARIABLE", tok_width_variable, 0}, |
| 160 | #line 27 "charmap-kw.gperf" |
| 161 | {"mb_cur_max", tok_mb_cur_max, 1}, |
| 162 | #line 36 "charmap-kw.gperf" |
| 163 | {"addset", tok_addset, 1}, |
| 164 | #line 38 "charmap-kw.gperf" |
| 165 | {"CHARMAP", tok_charmap, 0}, |
| 166 | #line 42 "charmap-kw.gperf" |
| 167 | {"WIDTH_DEFAULT", tok_width_default, 0}, |
| 168 | {""}, |
| 169 | #line 34 "charmap-kw.gperf" |
| 170 | {"g3esc", tok_g3esc, 1}, |
| 171 | {""}, {""}, {""}, {""}, |
| 172 | #line 33 "charmap-kw.gperf" |
| 173 | {"g2esc", tok_g2esc, 1}, |
| 174 | {""}, {""}, {""}, {""}, |
| 175 | #line 32 "charmap-kw.gperf" |
| 176 | {"g1esc", tok_g1esc, 1}, |
| 177 | {""}, {""}, {""}, {""}, |
| 178 | #line 31 "charmap-kw.gperf" |
| 179 | {"g0esc", tok_g0esc, 1} |
| 180 | }; |
| 181 | |
| 182 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) |
| 183 | { |
| 184 | register int key = hash (str, len); |
| 185 | |
| 186 | if (key <= MAX_HASH_VALUE && key >= 0) |
| 187 | { |
| 188 | register const char *s = wordlist[key].name; |
| 189 | |
| 190 | if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') |
| 191 | return &wordlist[key]; |
| 192 | } |
| 193 | } |
| 194 | return 0; |
| 195 | } |