1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22 /* C++ code produced by gperf version 3.0.1 */
23 /* Command-line: gperf -C -t -l -L C++ -m 20 -Z AfmKeywordHash afm_keyword_list */
24 /* Computed positions: -k'1,4,6,$' */
25
26 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
27 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
28 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
29 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
30 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
31 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
32 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
33 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
34 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
35 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
36 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
37 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
38 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
39 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
40 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
41 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
42 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
43 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
44 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
45 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
46 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
47 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
48 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
49 /* The character set is not based on ISO-646. */
50 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
51 #endif
52
53 #line 1 "afm_keyword_list"
54 struct hash_entry { const char* name; enum parseKey eKey; };
55
56 #define TOTAL_KEYWORDS 56
57 #define MIN_WORD_LENGTH 1
58 #define MAX_WORD_LENGTH 18
59 #define MIN_HASH_VALUE 1
60 #define MAX_HASH_VALUE 57
61 /* maximum key range = 57, duplicates = 0 */
62
63 class AfmKeywordHash
64 {
65 private:
66 static inline unsigned int hash (const char *str, unsigned int len);
67 public:
68 static const struct hash_entry *in_word_set (const char *str, unsigned int len);
69 };
70
71 inline unsigned int
hash(register const char * str,register unsigned int len)72 AfmKeywordHash::hash (register const char *str, register unsigned int len)
73 {
74 static const unsigned char asso_values[] =
75 {
76 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
77 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
78 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
79 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
80 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
81 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
82 58, 58, 58, 58, 58, 28, 1, 0, 9, 0,
83 19, 58, 2, 10, 58, 0, 28, 0, 20, 58,
84 44, 58, 58, 0, 16, 10, 24, 2, 3, 58,
85 58, 58, 58, 58, 58, 58, 58, 6, 58, 0,
86 19, 0, 58, 25, 14, 6, 58, 58, 17, 11,
87 0, 17, 39, 58, 0, 0, 10, 58, 58, 58,
88 13, 4, 58, 58, 58, 58, 58, 58, 58, 58,
89 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
90 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
91 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
92 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
93 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
94 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
95 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
96 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
97 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
98 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
99 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
100 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
101 58, 58, 58, 58, 58, 58
102 };
103 register int hval = len;
104
105 switch (hval)
106 {
107 default:
108 hval += asso_values[(unsigned char)str[5]];
109 /*FALLTHROUGH*/
110 case 5:
111 case 4:
112 hval += asso_values[(unsigned char)str[3]];
113 /*FALLTHROUGH*/
114 case 3:
115 case 2:
116 case 1:
117 hval += asso_values[(unsigned char)str[0]];
118 break;
119 }
120 return hval + asso_values[(unsigned char)str[len - 1]];
121 }
122
123 const struct hash_entry *
in_word_set(register const char * str,register unsigned int len)124 AfmKeywordHash::in_word_set (register const char *str, register unsigned int len)
125 {
126 static const unsigned char lengthtable[] =
127 {
128 0, 1, 2, 1, 2, 1, 3, 2, 3, 5, 10, 11, 12, 2,
129 14, 15, 16, 11, 9, 13, 14, 12, 12, 14, 13, 9, 7, 9,
130 7, 9, 14, 5, 6, 14, 12, 16, 10, 14, 11, 10, 7, 1,
131 12, 8, 17, 18, 2, 3, 7, 1, 8, 8, 13, 6, 6, 8,
132 0, 1
133 };
134 static const struct hash_entry wordlist[] =
135 {
136 {"",NOPE},
137 #line 6 "afm_keyword_list"
138 {"C",CODE},
139 #line 7 "afm_keyword_list"
140 {"CC",COMPCHAR},
141 #line 5 "afm_keyword_list"
142 {"B",CHARBBOX},
143 #line 8 "afm_keyword_list"
144 {"CH",CODEHEX},
145 #line 54 "afm_keyword_list"
146 {"W",XYWIDTH},
147 #line 33 "afm_keyword_list"
148 {"KPX",KERNPAIRXAMT},
149 #line 56 "afm_keyword_list"
150 {"WX",XWIDTH},
151 #line 55 "afm_keyword_list"
152 {"W0X",X0WIDTH},
153 #line 47 "afm_keyword_list"
154 {"StdHW",STDHW},
155 #line 12 "afm_keyword_list"
156 {"Characters",CHARACTERS},
157 #line 36 "afm_keyword_list"
158 {"MetricsSets",METRICSSETS},
159 #line 23 "afm_keyword_list"
160 {"EndKernPairs",ENDKERNPAIRS},
161 #line 16 "afm_keyword_list"
162 {"Em",EM},
163 #line 45 "afm_keyword_list"
164 {"StartKernPairs",STARTKERNPAIRS},
165 #line 41 "afm_keyword_list"
166 {"StartComposites",STARTCOMPOSITES},
167 #line 40 "afm_keyword_list"
168 {"StartCharMetrics",STARTCHARMETRICS},
169 #line 22 "afm_keyword_list"
170 {"EndKernData",ENDKERNDATA},
171 #line 14 "afm_keyword_list"
172 {"Descender",DESCENDER},
173 #line 44 "afm_keyword_list"
174 {"StartKernData",STARTKERNDATA},
175 #line 18 "afm_keyword_list"
176 {"EndCharMetrics",ENDCHARMETRICS},
177 #line 20 "afm_keyword_list"
178 {"EndDirection",ENDDIRECTION},
179 #line 11 "afm_keyword_list"
180 {"CharacterSet",CHARACTERSET},
181 #line 42 "afm_keyword_list"
182 {"StartDirection",STARTDIRECTION},
183 #line 19 "afm_keyword_list"
184 {"EndComposites",ENDCOMPOSITES},
185 #line 49 "afm_keyword_list"
186 {"TrackKern",TRACKKERN},
187 #line 15 "afm_keyword_list"
188 {"Descent",DESCENT},
189 #line 9 "afm_keyword_list"
190 {"CapHeight",CAPHEIGHT},
191 #line 13 "afm_keyword_list"
192 {"Comment",COMMENT},
193 #line 10 "afm_keyword_list"
194 {"CharWidth",CHARWIDTH},
195 #line 46 "afm_keyword_list"
196 {"StartTrackKern",STARTTRACKKERN},
197 #line 48 "afm_keyword_list"
198 {"StdVW",STDVW},
199 #line 38 "afm_keyword_list"
200 {"Notice",NOTICE},
201 #line 21 "afm_keyword_list"
202 {"EndFontMetrics",ENDFONTMETRICS},
203 #line 24 "afm_keyword_list"
204 {"EndTrackKern",ENDTRACKKERN},
205 #line 43 "afm_keyword_list"
206 {"StartFontMetrics",STARTFONTMETRICS},
207 #line 29 "afm_keyword_list"
208 {"IsBaseFont",ISBASEFONT},
209 #line 17 "afm_keyword_list"
210 {"EncodingScheme",ENCODINGSCHEME},
211 #line 31 "afm_keyword_list"
212 {"ItalicAngle",ITALICANGLE},
213 #line 25 "afm_keyword_list"
214 {"FamilyName",FAMILYNAME},
215 #line 58 "afm_keyword_list"
216 {"XHeight",XHEIGHT},
217 #line 37 "afm_keyword_list"
218 {"N",CHARNAME},
219 #line 30 "afm_keyword_list"
220 {"IsFixedPitch",ISFIXEDPITCH},
221 #line 27 "afm_keyword_list"
222 {"FontName",FONTNAME},
223 #line 50 "afm_keyword_list"
224 {"UnderlinePosition",UNDERLINEPOSITION},
225 #line 51 "afm_keyword_list"
226 {"UnderlineThickness",UNDERLINETHICKNESS},
227 #line 32 "afm_keyword_list"
228 {"KP",KERNPAIR},
229 #line 39 "afm_keyword_list"
230 {"PCC",COMPCHARPIECE},
231 #line 53 "afm_keyword_list"
232 {"Version",VERSION},
233 #line 52 "afm_keyword_list"
234 {"V",VVECTOR},
235 #line 28 "afm_keyword_list"
236 {"FullName",FULLNAME},
237 #line 26 "afm_keyword_list"
238 {"FontBBox",FONTBBOX},
239 #line 35 "afm_keyword_list"
240 {"MappingScheme",MAPPINGSCHEME},
241 #line 57 "afm_keyword_list"
242 {"Weight",WEIGHT},
243 #line 4 "afm_keyword_list"
244 {"Ascent",ASCENT},
245 #line 3 "afm_keyword_list"
246 {"Ascender",ASCENDER},
247 {"",NOPE},
248 #line 34 "afm_keyword_list"
249 {"L",LIGATURE}
250 };
251
252 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
253 {
254 register int key = hash (str, len);
255
256 if (key <= MAX_HASH_VALUE && key >= 0)
257 if (len == lengthtable[key])
258 {
259 register const char *s = wordlist[key].name;
260
261 if (*str == *s && !memcmp (str + 1, s + 1, len - 1))
262 return &wordlist[key];
263 }
264 }
265 return 0;
266 }
267