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