1 /*
2                             __  __            _
3                          ___\ \/ /_ __   __ _| |_
4                         / _ \\  /| '_ \ / _` | __|
5                        |  __//  \| |_) | (_| | |_
6                         \___/_/\_\ .__/ \__,_|\__|
7                                  |_| XML parser
8 
9    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
10    Copyright (c) 2000-2017 Expat development team
11    Licensed under the MIT license:
12 
13    Permission is  hereby granted,  free of charge,  to any  person obtaining
14    a  copy  of  this  software   and  associated  documentation  files  (the
15    "Software"),  to  deal in  the  Software  without restriction,  including
16    without  limitation the  rights  to use,  copy,  modify, merge,  publish,
17    distribute, sublicense, and/or sell copies of the Software, and to permit
18    persons  to whom  the Software  is  furnished to  do so,  subject to  the
19    following conditions:
20 
21    The above copyright  notice and this permission notice  shall be included
22    in all copies or substantial portions of the Software.
23 
24    THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT  WARRANTY  OF  ANY  KIND,
25    EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF
26    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
27    NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28    DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR
29    OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
30    USE OR OTHER DEALINGS IN THE SOFTWARE.
31 */
32 
33 static const unsigned namingBitmap[] = {
34 0x00000000, 0x00000000, 0x00000000, 0x00000000,
35 0x00000000, 0x00000000, 0x00000000, 0x00000000,
36 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
37 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
38 0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE,
39 0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,
40 0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF,
41 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF,
42 0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
43 0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000,
44 0x00000000, 0x00000000, 0x00000000, 0x00000000,
45 0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
46 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
47 0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
48 0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
49 0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF,
50 0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000,
51 0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
52 0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003,
53 0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003,
54 0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
55 0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001,
56 0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003,
57 0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
58 0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003,
59 0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003,
60 0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
61 0x00000000, 0x00000000, 0x00000000, 0x00000000,
62 0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000,
63 0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,
64 0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF,
65 0x00000000, 0x00000000, 0x00000000, 0x00000000,
66 0x00000000, 0x00000000, 0x00000000, 0x00000000,
67 0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF,
68 0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB,
69 0x40000000, 0xF580C900, 0x00000007, 0x02010800,
70 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
71 0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF,
72 0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
73 0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,
74 0x00000000, 0x00004C40, 0x00000000, 0x00000000,
75 0x00000007, 0x00000000, 0x00000000, 0x00000000,
76 0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF,
77 0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF,
78 0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,
79 0x00000000, 0x00000000, 0x00000000, 0x00000000,
80 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
81 0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
82 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
83 0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000,
84 0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
85 0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF,
86 0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
87 0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,
88 0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003,
89 0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
90 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
91 0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
92 0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
93 0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
94 0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,
95 0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,
96 0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
97 0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,
98 0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,
99 0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
100 0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,
101 0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,
102 0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
103 0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,
104 0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,
105 0x00000000, 0x00000000, 0x00000000, 0x00000000,
106 0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,
107 0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000,
108 0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
109 0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,
110 0x00000000, 0x00000000, 0x00000000, 0x00000000,
111 0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
112 0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
113 0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF,
114 };
115 static const unsigned char nmstrtPages[] = {
116 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00,
117 0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
118 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
119 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
120 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
121 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
122 0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
123 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
124 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
125 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
126 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
127 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
128 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
129 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
130 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
131 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
132 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
133 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
134 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
135 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
137 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
138 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
139 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
140 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
141 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
142 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
144 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
145 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
146 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
147 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
148 };
149 static const unsigned char namePages[] = {
150 0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00,
151 0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
152 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
153 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
154 0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
156 0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
160 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
161 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
162 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
163 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
164 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
165 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
166 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
167 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
168 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
169 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
170 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
171 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
172 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
173 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
174 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
175 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
176 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
177 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
178 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
179 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
180 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
181 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
182 };
183