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