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 PdfKeywordHash keyword_list  */
24 /* Computed positions: -k'4-5,$' */
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 "keyword_list"
54 struct hash_entry { const char* name; enum parseKey eKey; };
55 
56 #if defined __GNUC__
57 #pragma GCC system_header
58 #endif
59 
60 #define TOTAL_KEYWORDS 46
61 #define MIN_WORD_LENGTH 7
62 #define MAX_WORD_LENGTH 19
63 #define MIN_HASH_VALUE 8
64 #define MAX_HASH_VALUE 68
65 /* maximum key range = 61, duplicates = 0 */
66 
67 class PdfKeywordHash
68 {
69 private:
70   static inline unsigned int hash (const char *str, unsigned int len);
71 public:
72   static const struct hash_entry *in_word_set (const char *str, unsigned int len);
73 };
74 
75 inline unsigned int
hash(register const char * str,register unsigned int len)76 PdfKeywordHash::hash (register const char *str, register unsigned int len)
77 {
78   static const unsigned char asso_values[] =
79     {
80       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
81       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
82       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
83       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
84       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
85       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
86       69, 69, 69, 69, 69, 69,  9, 69, 38, 69,
87        1, 69, 69, 69, 31, 69, 16, 35, 21, 69,
88       15,  0, 69, 21, 15, 69, 69, 69, 69, 69,
89       69, 69, 69, 69, 69, 69, 69,  0, 15, 69,
90       69,  5,  8, 69,  4,  8,  0, 20,  2, 27,
91       11, 31,  0, 69,  0,  9,  0,  5, 69,  5,
92       69, 13, 69, 69, 69, 69, 69, 69, 69, 69,
93       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
94       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
95       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
96       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
97       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
98       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
99       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
100       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
101       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
102       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
103       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
104       69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
105       69, 69, 69, 69, 69, 69, 69
106     };
107   return len + asso_values[(unsigned char)str[4]+1] + asso_values[(unsigned char)str[3]] + asso_values[(unsigned char)str[len - 1]];
108 }
109 
110 const struct hash_entry *
in_word_set(register const char * str,register unsigned int len)111 PdfKeywordHash::in_word_set (register const char *str, register unsigned int len)
112 {
113   static const unsigned char lengthtable[] =
114     {
115        0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  8, 12,
116        8, 10, 10, 12, 13,  9, 15, 16, 17, 14, 15, 15, 10, 13,
117       14, 15, 14, 11, 12,  9,  9, 17, 13, 19, 11,  8, 14,  9,
118        7,  9, 19, 17, 15, 10, 13, 10,  9,  8, 17, 12,  8,  0,
119        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  8
120     };
121   static const struct hash_entry wordlist[] =
122     {
123       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
124 #line 29 "keyword_list"
125       {"setFont",SETFONT},
126       {""}, {""}, {""},
127 #line 8 "keyword_list"
128       {"clipPath",CLIPPATH},
129 #line 28 "keyword_list"
130       {"setFillColor",SETFILLCOLOR},
131 #line 19 "keyword_list"
132       {"fillPath",FILLPATH},
133 #line 46 "keyword_list"
134       {"updateFont",UPDATEFONT},
135 #line 17 "keyword_list"
136       {"eoClipPath",EOCLIPPATH},
137 #line 25 "keyword_list"
138       {"restoreState",RESTORESTATE},
139 #line 47 "keyword_list"
140       {"updateLineCap",UPDATELINECAP},
141 #line 39 "keyword_list"
142       {"startPage",STARTPAGE},
143 #line 43 "keyword_list"
144       {"updateFillColor",UPDATEFILLCOLOR},
145 #line 51 "keyword_list"
146       {"updateMiterLimit",UPDATEMITERLIMIT},
147 #line 52 "keyword_list"
148       {"updateStrokeColor",UPDATESTROKECOLOR},
149 #line 48 "keyword_list"
150       {"updateLineDash",UPDATELINEDASH},
151 #line 50 "keyword_list"
152       {"updateLineWidth",UPDATELINEWIDTH},
153 #line 41 "keyword_list"
154       {"updateBlendMode",UPDATEBLENDMODE},
155 #line 30 "keyword_list"
156       {"setLineCap",SETLINECAP},
157 #line 21 "keyword_list"
158       {"intersectClip",INTERSECTCLIP},
159 #line 45 "keyword_list"
160       {"updateFlatness",UPDATEFLATNESS},
161 #line 22 "keyword_list"
162       {"intersectEoClip",INTERSECTEOCLIP},
163 #line 49 "keyword_list"
164       {"updateLineJoin",UPDATELINEJOIN},
165 #line 31 "keyword_list"
166       {"setLineDash",SETLINEDASH},
167 #line 33 "keyword_list"
168       {"setLineWidth",SETLINEWIDTH},
169 #line 24 "keyword_list"
170       {"pushState",PUSHSTATE},
171 #line 26 "keyword_list"
172       {"saveState",SAVESTATE},
173 #line 44 "keyword_list"
174       {"updateFillOpacity",UPDATEFILLOPACITY},
175 #line 16 "keyword_list"
176       {"endTextObject",ENDTEXTOBJECT},
177 #line 53 "keyword_list"
178       {"updateStrokeOpacity",UPDATESTROKEOPACITY},
179 #line 32 "keyword_list"
180       {"setLineJoin",SETLINEJOIN},
181 #line 23 "keyword_list"
182       {"popState",POPSTATE},
183 #line 36 "keyword_list"
184       {"setStrokeColor",SETSTROKECOLOR},
185 #line 42 "keyword_list"
186       {"updateCtm",UPDATECTM},
187 #line 15 "keyword_list"
188       {"endPage",ENDPAGE},
189 #line 20 "keyword_list"
190       {"hyperLink",HYPERLINK},
191 #line 14 "keyword_list"
192       {"drawSoftMaskedImage",DRAWSOFTMASKEDIMAGE},
193 #line 37 "keyword_list"
194       {"setTextRenderMode",SETTEXTRENDERMODE},
195 #line 13 "keyword_list"
196       {"drawMaskedImage",DRAWMASKEDIMAGE},
197 #line 40 "keyword_list"
198       {"strokePath",STROKEPATH},
199 #line 34 "keyword_list"
200       {"setMiterLimit",SETMITERLIMIT},
201 #line 18 "keyword_list"
202       {"eoFillPath",EOFILLPATH},
203 #line 10 "keyword_list"
204       {"drawImage",DRAWIMAGE},
205 #line 9 "keyword_list"
206       {"drawChar",DRAWCHAR},
207 #line 38 "keyword_list"
208       {"setTransformation",SETTRANSFORMATION},
209 #line 27 "keyword_list"
210       {"setBlendMode",SETBLENDMODE},
211 #line 12 "keyword_list"
212       {"drawMask",DRAWMASK},
213       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
214       {""}, {""}, {""},
215 #line 35 "keyword_list"
216       {"setPageNum",SETPAGENUM},
217 #line 11 "keyword_list"
218       {"drawLink",DRAWLINK	}
219     };
220 
221   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
222     {
223       register int key = hash (str, len);
224 
225       if (key <= MAX_HASH_VALUE && key >= 0)
226         if (len == lengthtable[key])
227           {
228             register const char *s = wordlist[key].name;
229 
230             if (*str == *s && !memcmp (str + 1, s + 1, len - 1))
231               return &wordlist[key];
232           }
233     }
234   return 0;
235 }
236