Coverage Report

Created: 2026-08-26 07:26

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/mruby/mrbgems/mruby-compiler/lib/prism/src/encoding.c
Line
Count
Source
1
#include "prism/encoding.h"
2
3
typedef uint32_t pm_unicode_codepoint_t;
4
5
0
#define UNICODE_ALPHA_CODEPOINTS_LENGTH 1508
6
static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEPOINTS_LENGTH] = {
7
    0x100, 0x2C1,
8
    0x2C6, 0x2D1,
9
    0x2E0, 0x2E4,
10
    0x2EC, 0x2EC,
11
    0x2EE, 0x2EE,
12
    0x345, 0x345,
13
    0x363, 0x374,
14
    0x376, 0x377,
15
    0x37A, 0x37D,
16
    0x37F, 0x37F,
17
    0x386, 0x386,
18
    0x388, 0x38A,
19
    0x38C, 0x38C,
20
    0x38E, 0x3A1,
21
    0x3A3, 0x3F5,
22
    0x3F7, 0x481,
23
    0x48A, 0x52F,
24
    0x531, 0x556,
25
    0x559, 0x559,
26
    0x560, 0x588,
27
    0x5B0, 0x5BD,
28
    0x5BF, 0x5BF,
29
    0x5C1, 0x5C2,
30
    0x5C4, 0x5C5,
31
    0x5C7, 0x5C7,
32
    0x5D0, 0x5EA,
33
    0x5EF, 0x5F2,
34
    0x610, 0x61A,
35
    0x620, 0x657,
36
    0x659, 0x65F,
37
    0x66E, 0x6D3,
38
    0x6D5, 0x6DC,
39
    0x6E1, 0x6E8,
40
    0x6ED, 0x6EF,
41
    0x6FA, 0x6FC,
42
    0x6FF, 0x6FF,
43
    0x710, 0x73F,
44
    0x74D, 0x7B1,
45
    0x7CA, 0x7EA,
46
    0x7F4, 0x7F5,
47
    0x7FA, 0x7FA,
48
    0x800, 0x817,
49
    0x81A, 0x82C,
50
    0x840, 0x858,
51
    0x860, 0x86A,
52
    0x870, 0x887,
53
    0x889, 0x88F,
54
    0x897, 0x897,
55
    0x8A0, 0x8C9,
56
    0x8D4, 0x8DF,
57
    0x8E3, 0x8E9,
58
    0x8F0, 0x93B,
59
    0x93D, 0x94C,
60
    0x94E, 0x950,
61
    0x955, 0x963,
62
    0x971, 0x983,
63
    0x985, 0x98C,
64
    0x98F, 0x990,
65
    0x993, 0x9A8,
66
    0x9AA, 0x9B0,
67
    0x9B2, 0x9B2,
68
    0x9B6, 0x9B9,
69
    0x9BD, 0x9C4,
70
    0x9C7, 0x9C8,
71
    0x9CB, 0x9CC,
72
    0x9CE, 0x9CE,
73
    0x9D7, 0x9D7,
74
    0x9DC, 0x9DD,
75
    0x9DF, 0x9E3,
76
    0x9F0, 0x9F1,
77
    0x9FC, 0x9FC,
78
    0xA01, 0xA03,
79
    0xA05, 0xA0A,
80
    0xA0F, 0xA10,
81
    0xA13, 0xA28,
82
    0xA2A, 0xA30,
83
    0xA32, 0xA33,
84
    0xA35, 0xA36,
85
    0xA38, 0xA39,
86
    0xA3E, 0xA42,
87
    0xA47, 0xA48,
88
    0xA4B, 0xA4C,
89
    0xA51, 0xA51,
90
    0xA59, 0xA5C,
91
    0xA5E, 0xA5E,
92
    0xA70, 0xA75,
93
    0xA81, 0xA83,
94
    0xA85, 0xA8D,
95
    0xA8F, 0xA91,
96
    0xA93, 0xAA8,
97
    0xAAA, 0xAB0,
98
    0xAB2, 0xAB3,
99
    0xAB5, 0xAB9,
100
    0xABD, 0xAC5,
101
    0xAC7, 0xAC9,
102
    0xACB, 0xACC,
103
    0xAD0, 0xAD0,
104
    0xAE0, 0xAE3,
105
    0xAF9, 0xAFC,
106
    0xB01, 0xB03,
107
    0xB05, 0xB0C,
108
    0xB0F, 0xB10,
109
    0xB13, 0xB28,
110
    0xB2A, 0xB30,
111
    0xB32, 0xB33,
112
    0xB35, 0xB39,
113
    0xB3D, 0xB44,
114
    0xB47, 0xB48,
115
    0xB4B, 0xB4C,
116
    0xB56, 0xB57,
117
    0xB5C, 0xB5D,
118
    0xB5F, 0xB63,
119
    0xB71, 0xB71,
120
    0xB82, 0xB83,
121
    0xB85, 0xB8A,
122
    0xB8E, 0xB90,
123
    0xB92, 0xB95,
124
    0xB99, 0xB9A,
125
    0xB9C, 0xB9C,
126
    0xB9E, 0xB9F,
127
    0xBA3, 0xBA4,
128
    0xBA8, 0xBAA,
129
    0xBAE, 0xBB9,
130
    0xBBE, 0xBC2,
131
    0xBC6, 0xBC8,
132
    0xBCA, 0xBCC,
133
    0xBD0, 0xBD0,
134
    0xBD7, 0xBD7,
135
    0xC00, 0xC0C,
136
    0xC0E, 0xC10,
137
    0xC12, 0xC28,
138
    0xC2A, 0xC39,
139
    0xC3D, 0xC44,
140
    0xC46, 0xC48,
141
    0xC4A, 0xC4C,
142
    0xC55, 0xC56,
143
    0xC58, 0xC5A,
144
    0xC5C, 0xC5D,
145
    0xC60, 0xC63,
146
    0xC80, 0xC83,
147
    0xC85, 0xC8C,
148
    0xC8E, 0xC90,
149
    0xC92, 0xCA8,
150
    0xCAA, 0xCB3,
151
    0xCB5, 0xCB9,
152
    0xCBD, 0xCC4,
153
    0xCC6, 0xCC8,
154
    0xCCA, 0xCCC,
155
    0xCD5, 0xCD6,
156
    0xCDC, 0xCDE,
157
    0xCE0, 0xCE3,
158
    0xCF1, 0xCF3,
159
    0xD00, 0xD0C,
160
    0xD0E, 0xD10,
161
    0xD12, 0xD3A,
162
    0xD3D, 0xD44,
163
    0xD46, 0xD48,
164
    0xD4A, 0xD4C,
165
    0xD4E, 0xD4E,
166
    0xD54, 0xD57,
167
    0xD5F, 0xD63,
168
    0xD7A, 0xD7F,
169
    0xD81, 0xD83,
170
    0xD85, 0xD96,
171
    0xD9A, 0xDB1,
172
    0xDB3, 0xDBB,
173
    0xDBD, 0xDBD,
174
    0xDC0, 0xDC6,
175
    0xDCF, 0xDD4,
176
    0xDD6, 0xDD6,
177
    0xDD8, 0xDDF,
178
    0xDF2, 0xDF3,
179
    0xE01, 0xE3A,
180
    0xE40, 0xE46,
181
    0xE4D, 0xE4D,
182
    0xE81, 0xE82,
183
    0xE84, 0xE84,
184
    0xE86, 0xE8A,
185
    0xE8C, 0xEA3,
186
    0xEA5, 0xEA5,
187
    0xEA7, 0xEB9,
188
    0xEBB, 0xEBD,
189
    0xEC0, 0xEC4,
190
    0xEC6, 0xEC6,
191
    0xECD, 0xECD,
192
    0xEDC, 0xEDF,
193
    0xF00, 0xF00,
194
    0xF40, 0xF47,
195
    0xF49, 0xF6C,
196
    0xF71, 0xF83,
197
    0xF88, 0xF97,
198
    0xF99, 0xFBC,
199
    0x1000, 0x1036,
200
    0x1038, 0x1038,
201
    0x103B, 0x103F,
202
    0x1050, 0x108F,
203
    0x109A, 0x109D,
204
    0x10A0, 0x10C5,
205
    0x10C7, 0x10C7,
206
    0x10CD, 0x10CD,
207
    0x10D0, 0x10FA,
208
    0x10FC, 0x1248,
209
    0x124A, 0x124D,
210
    0x1250, 0x1256,
211
    0x1258, 0x1258,
212
    0x125A, 0x125D,
213
    0x1260, 0x1288,
214
    0x128A, 0x128D,
215
    0x1290, 0x12B0,
216
    0x12B2, 0x12B5,
217
    0x12B8, 0x12BE,
218
    0x12C0, 0x12C0,
219
    0x12C2, 0x12C5,
220
    0x12C8, 0x12D6,
221
    0x12D8, 0x1310,
222
    0x1312, 0x1315,
223
    0x1318, 0x135A,
224
    0x1380, 0x138F,
225
    0x13A0, 0x13F5,
226
    0x13F8, 0x13FD,
227
    0x1401, 0x166C,
228
    0x166F, 0x167F,
229
    0x1681, 0x169A,
230
    0x16A0, 0x16EA,
231
    0x16EE, 0x16F8,
232
    0x1700, 0x1713,
233
    0x171F, 0x1733,
234
    0x1740, 0x1753,
235
    0x1760, 0x176C,
236
    0x176E, 0x1770,
237
    0x1772, 0x1773,
238
    0x1780, 0x17B3,
239
    0x17B6, 0x17C8,
240
    0x17D7, 0x17D7,
241
    0x17DC, 0x17DC,
242
    0x1820, 0x1878,
243
    0x1880, 0x18AA,
244
    0x18B0, 0x18F5,
245
    0x1900, 0x191E,
246
    0x1920, 0x192B,
247
    0x1930, 0x1938,
248
    0x1950, 0x196D,
249
    0x1970, 0x1974,
250
    0x1980, 0x19AB,
251
    0x19B0, 0x19C9,
252
    0x1A00, 0x1A1B,
253
    0x1A20, 0x1A5E,
254
    0x1A61, 0x1A74,
255
    0x1AA7, 0x1AA7,
256
    0x1ABF, 0x1AC0,
257
    0x1ACC, 0x1ACE,
258
    0x1B00, 0x1B33,
259
    0x1B35, 0x1B43,
260
    0x1B45, 0x1B4C,
261
    0x1B80, 0x1BA9,
262
    0x1BAC, 0x1BAF,
263
    0x1BBA, 0x1BE5,
264
    0x1BE7, 0x1BF1,
265
    0x1C00, 0x1C36,
266
    0x1C4D, 0x1C4F,
267
    0x1C5A, 0x1C7D,
268
    0x1C80, 0x1C8A,
269
    0x1C90, 0x1CBA,
270
    0x1CBD, 0x1CBF,
271
    0x1CE9, 0x1CEC,
272
    0x1CEE, 0x1CF3,
273
    0x1CF5, 0x1CF6,
274
    0x1CFA, 0x1CFA,
275
    0x1D00, 0x1DBF,
276
    0x1DD3, 0x1DF4,
277
    0x1E00, 0x1F15,
278
    0x1F18, 0x1F1D,
279
    0x1F20, 0x1F45,
280
    0x1F48, 0x1F4D,
281
    0x1F50, 0x1F57,
282
    0x1F59, 0x1F59,
283
    0x1F5B, 0x1F5B,
284
    0x1F5D, 0x1F5D,
285
    0x1F5F, 0x1F7D,
286
    0x1F80, 0x1FB4,
287
    0x1FB6, 0x1FBC,
288
    0x1FBE, 0x1FBE,
289
    0x1FC2, 0x1FC4,
290
    0x1FC6, 0x1FCC,
291
    0x1FD0, 0x1FD3,
292
    0x1FD6, 0x1FDB,
293
    0x1FE0, 0x1FEC,
294
    0x1FF2, 0x1FF4,
295
    0x1FF6, 0x1FFC,
296
    0x2071, 0x2071,
297
    0x207F, 0x207F,
298
    0x2090, 0x209C,
299
    0x2102, 0x2102,
300
    0x2107, 0x2107,
301
    0x210A, 0x2113,
302
    0x2115, 0x2115,
303
    0x2119, 0x211D,
304
    0x2124, 0x2124,
305
    0x2126, 0x2126,
306
    0x2128, 0x2128,
307
    0x212A, 0x212D,
308
    0x212F, 0x2139,
309
    0x213C, 0x213F,
310
    0x2145, 0x2149,
311
    0x214E, 0x214E,
312
    0x2160, 0x2188,
313
    0x24B6, 0x24E9,
314
    0x2C00, 0x2CE4,
315
    0x2CEB, 0x2CEE,
316
    0x2CF2, 0x2CF3,
317
    0x2D00, 0x2D25,
318
    0x2D27, 0x2D27,
319
    0x2D2D, 0x2D2D,
320
    0x2D30, 0x2D67,
321
    0x2D6F, 0x2D6F,
322
    0x2D80, 0x2D96,
323
    0x2DA0, 0x2DA6,
324
    0x2DA8, 0x2DAE,
325
    0x2DB0, 0x2DB6,
326
    0x2DB8, 0x2DBE,
327
    0x2DC0, 0x2DC6,
328
    0x2DC8, 0x2DCE,
329
    0x2DD0, 0x2DD6,
330
    0x2DD8, 0x2DDE,
331
    0x2DE0, 0x2DFF,
332
    0x2E2F, 0x2E2F,
333
    0x3005, 0x3007,
334
    0x3021, 0x3029,
335
    0x3031, 0x3035,
336
    0x3038, 0x303C,
337
    0x3041, 0x3096,
338
    0x309D, 0x309F,
339
    0x30A1, 0x30FA,
340
    0x30FC, 0x30FF,
341
    0x3105, 0x312F,
342
    0x3131, 0x318E,
343
    0x31A0, 0x31BF,
344
    0x31F0, 0x31FF,
345
    0x3400, 0x4DBF,
346
    0x4E00, 0xA48C,
347
    0xA4D0, 0xA4FD,
348
    0xA500, 0xA60C,
349
    0xA610, 0xA61F,
350
    0xA62A, 0xA62B,
351
    0xA640, 0xA66E,
352
    0xA674, 0xA67B,
353
    0xA67F, 0xA6EF,
354
    0xA717, 0xA71F,
355
    0xA722, 0xA788,
356
    0xA78B, 0xA7DC,
357
    0xA7F1, 0xA805,
358
    0xA807, 0xA827,
359
    0xA840, 0xA873,
360
    0xA880, 0xA8C3,
361
    0xA8C5, 0xA8C5,
362
    0xA8F2, 0xA8F7,
363
    0xA8FB, 0xA8FB,
364
    0xA8FD, 0xA8FF,
365
    0xA90A, 0xA92A,
366
    0xA930, 0xA952,
367
    0xA960, 0xA97C,
368
    0xA980, 0xA9B2,
369
    0xA9B4, 0xA9BF,
370
    0xA9CF, 0xA9CF,
371
    0xA9E0, 0xA9EF,
372
    0xA9FA, 0xA9FE,
373
    0xAA00, 0xAA36,
374
    0xAA40, 0xAA4D,
375
    0xAA60, 0xAA76,
376
    0xAA7A, 0xAABE,
377
    0xAAC0, 0xAAC0,
378
    0xAAC2, 0xAAC2,
379
    0xAADB, 0xAADD,
380
    0xAAE0, 0xAAEF,
381
    0xAAF2, 0xAAF5,
382
    0xAB01, 0xAB06,
383
    0xAB09, 0xAB0E,
384
    0xAB11, 0xAB16,
385
    0xAB20, 0xAB26,
386
    0xAB28, 0xAB2E,
387
    0xAB30, 0xAB5A,
388
    0xAB5C, 0xAB69,
389
    0xAB70, 0xABEA,
390
    0xAC00, 0xD7A3,
391
    0xD7B0, 0xD7C6,
392
    0xD7CB, 0xD7FB,
393
    0xF900, 0xFA6D,
394
    0xFA70, 0xFAD9,
395
    0xFB00, 0xFB06,
396
    0xFB13, 0xFB17,
397
    0xFB1D, 0xFB28,
398
    0xFB2A, 0xFB36,
399
    0xFB38, 0xFB3C,
400
    0xFB3E, 0xFB3E,
401
    0xFB40, 0xFB41,
402
    0xFB43, 0xFB44,
403
    0xFB46, 0xFBB1,
404
    0xFBD3, 0xFD3D,
405
    0xFD50, 0xFD8F,
406
    0xFD92, 0xFDC7,
407
    0xFDF0, 0xFDFB,
408
    0xFE70, 0xFE74,
409
    0xFE76, 0xFEFC,
410
    0xFF21, 0xFF3A,
411
    0xFF41, 0xFF5A,
412
    0xFF66, 0xFFBE,
413
    0xFFC2, 0xFFC7,
414
    0xFFCA, 0xFFCF,
415
    0xFFD2, 0xFFD7,
416
    0xFFDA, 0xFFDC,
417
    0x10000, 0x1000B,
418
    0x1000D, 0x10026,
419
    0x10028, 0x1003A,
420
    0x1003C, 0x1003D,
421
    0x1003F, 0x1004D,
422
    0x10050, 0x1005D,
423
    0x10080, 0x100FA,
424
    0x10140, 0x10174,
425
    0x10280, 0x1029C,
426
    0x102A0, 0x102D0,
427
    0x10300, 0x1031F,
428
    0x1032D, 0x1034A,
429
    0x10350, 0x1037A,
430
    0x10380, 0x1039D,
431
    0x103A0, 0x103C3,
432
    0x103C8, 0x103CF,
433
    0x103D1, 0x103D5,
434
    0x10400, 0x1049D,
435
    0x104B0, 0x104D3,
436
    0x104D8, 0x104FB,
437
    0x10500, 0x10527,
438
    0x10530, 0x10563,
439
    0x10570, 0x1057A,
440
    0x1057C, 0x1058A,
441
    0x1058C, 0x10592,
442
    0x10594, 0x10595,
443
    0x10597, 0x105A1,
444
    0x105A3, 0x105B1,
445
    0x105B3, 0x105B9,
446
    0x105BB, 0x105BC,
447
    0x105C0, 0x105F3,
448
    0x10600, 0x10736,
449
    0x10740, 0x10755,
450
    0x10760, 0x10767,
451
    0x10780, 0x10785,
452
    0x10787, 0x107B0,
453
    0x107B2, 0x107BA,
454
    0x10800, 0x10805,
455
    0x10808, 0x10808,
456
    0x1080A, 0x10835,
457
    0x10837, 0x10838,
458
    0x1083C, 0x1083C,
459
    0x1083F, 0x10855,
460
    0x10860, 0x10876,
461
    0x10880, 0x1089E,
462
    0x108E0, 0x108F2,
463
    0x108F4, 0x108F5,
464
    0x10900, 0x10915,
465
    0x10920, 0x10939,
466
    0x10940, 0x10959,
467
    0x10980, 0x109B7,
468
    0x109BE, 0x109BF,
469
    0x10A00, 0x10A03,
470
    0x10A05, 0x10A06,
471
    0x10A0C, 0x10A13,
472
    0x10A15, 0x10A17,
473
    0x10A19, 0x10A35,
474
    0x10A60, 0x10A7C,
475
    0x10A80, 0x10A9C,
476
    0x10AC0, 0x10AC7,
477
    0x10AC9, 0x10AE4,
478
    0x10B00, 0x10B35,
479
    0x10B40, 0x10B55,
480
    0x10B60, 0x10B72,
481
    0x10B80, 0x10B91,
482
    0x10C00, 0x10C48,
483
    0x10C80, 0x10CB2,
484
    0x10CC0, 0x10CF2,
485
    0x10D00, 0x10D27,
486
    0x10D4A, 0x10D65,
487
    0x10D69, 0x10D69,
488
    0x10D6F, 0x10D85,
489
    0x10E80, 0x10EA9,
490
    0x10EAB, 0x10EAC,
491
    0x10EB0, 0x10EB1,
492
    0x10EC2, 0x10EC7,
493
    0x10EFA, 0x10EFC,
494
    0x10F00, 0x10F1C,
495
    0x10F27, 0x10F27,
496
    0x10F30, 0x10F45,
497
    0x10F70, 0x10F81,
498
    0x10FB0, 0x10FC4,
499
    0x10FE0, 0x10FF6,
500
    0x11000, 0x11045,
501
    0x11071, 0x11075,
502
    0x11080, 0x110B8,
503
    0x110C2, 0x110C2,
504
    0x110D0, 0x110E8,
505
    0x11100, 0x11132,
506
    0x11144, 0x11147,
507
    0x11150, 0x11172,
508
    0x11176, 0x11176,
509
    0x11180, 0x111BF,
510
    0x111C1, 0x111C4,
511
    0x111CE, 0x111CF,
512
    0x111DA, 0x111DA,
513
    0x111DC, 0x111DC,
514
    0x11200, 0x11211,
515
    0x11213, 0x11234,
516
    0x11237, 0x11237,
517
    0x1123E, 0x11241,
518
    0x11280, 0x11286,
519
    0x11288, 0x11288,
520
    0x1128A, 0x1128D,
521
    0x1128F, 0x1129D,
522
    0x1129F, 0x112A8,
523
    0x112B0, 0x112E8,
524
    0x11300, 0x11303,
525
    0x11305, 0x1130C,
526
    0x1130F, 0x11310,
527
    0x11313, 0x11328,
528
    0x1132A, 0x11330,
529
    0x11332, 0x11333,
530
    0x11335, 0x11339,
531
    0x1133D, 0x11344,
532
    0x11347, 0x11348,
533
    0x1134B, 0x1134C,
534
    0x11350, 0x11350,
535
    0x11357, 0x11357,
536
    0x1135D, 0x11363,
537
    0x11380, 0x11389,
538
    0x1138B, 0x1138B,
539
    0x1138E, 0x1138E,
540
    0x11390, 0x113B5,
541
    0x113B7, 0x113C0,
542
    0x113C2, 0x113C2,
543
    0x113C5, 0x113C5,
544
    0x113C7, 0x113CA,
545
    0x113CC, 0x113CD,
546
    0x113D1, 0x113D1,
547
    0x113D3, 0x113D3,
548
    0x11400, 0x11441,
549
    0x11443, 0x11445,
550
    0x11447, 0x1144A,
551
    0x1145F, 0x11461,
552
    0x11480, 0x114C1,
553
    0x114C4, 0x114C5,
554
    0x114C7, 0x114C7,
555
    0x11580, 0x115B5,
556
    0x115B8, 0x115BE,
557
    0x115D8, 0x115DD,
558
    0x11600, 0x1163E,
559
    0x11640, 0x11640,
560
    0x11644, 0x11644,
561
    0x11680, 0x116B5,
562
    0x116B8, 0x116B8,
563
    0x11700, 0x1171A,
564
    0x1171D, 0x1172A,
565
    0x11740, 0x11746,
566
    0x11800, 0x11838,
567
    0x118A0, 0x118DF,
568
    0x118FF, 0x11906,
569
    0x11909, 0x11909,
570
    0x1190C, 0x11913,
571
    0x11915, 0x11916,
572
    0x11918, 0x11935,
573
    0x11937, 0x11938,
574
    0x1193B, 0x1193C,
575
    0x1193F, 0x11942,
576
    0x119A0, 0x119A7,
577
    0x119AA, 0x119D7,
578
    0x119DA, 0x119DF,
579
    0x119E1, 0x119E1,
580
    0x119E3, 0x119E4,
581
    0x11A00, 0x11A32,
582
    0x11A35, 0x11A3E,
583
    0x11A50, 0x11A97,
584
    0x11A9D, 0x11A9D,
585
    0x11AB0, 0x11AF8,
586
    0x11B60, 0x11B67,
587
    0x11BC0, 0x11BE0,
588
    0x11C00, 0x11C08,
589
    0x11C0A, 0x11C36,
590
    0x11C38, 0x11C3E,
591
    0x11C40, 0x11C40,
592
    0x11C72, 0x11C8F,
593
    0x11C92, 0x11CA7,
594
    0x11CA9, 0x11CB6,
595
    0x11D00, 0x11D06,
596
    0x11D08, 0x11D09,
597
    0x11D0B, 0x11D36,
598
    0x11D3A, 0x11D3A,
599
    0x11D3C, 0x11D3D,
600
    0x11D3F, 0x11D41,
601
    0x11D43, 0x11D43,
602
    0x11D46, 0x11D47,
603
    0x11D60, 0x11D65,
604
    0x11D67, 0x11D68,
605
    0x11D6A, 0x11D8E,
606
    0x11D90, 0x11D91,
607
    0x11D93, 0x11D96,
608
    0x11D98, 0x11D98,
609
    0x11DB0, 0x11DDB,
610
    0x11EE0, 0x11EF6,
611
    0x11F00, 0x11F10,
612
    0x11F12, 0x11F3A,
613
    0x11F3E, 0x11F40,
614
    0x11FB0, 0x11FB0,
615
    0x12000, 0x12399,
616
    0x12400, 0x1246E,
617
    0x12480, 0x12543,
618
    0x12F90, 0x12FF0,
619
    0x13000, 0x1342F,
620
    0x13441, 0x13446,
621
    0x13460, 0x143FA,
622
    0x14400, 0x14646,
623
    0x16100, 0x1612E,
624
    0x16800, 0x16A38,
625
    0x16A40, 0x16A5E,
626
    0x16A70, 0x16ABE,
627
    0x16AD0, 0x16AED,
628
    0x16B00, 0x16B2F,
629
    0x16B40, 0x16B43,
630
    0x16B63, 0x16B77,
631
    0x16B7D, 0x16B8F,
632
    0x16D40, 0x16D6C,
633
    0x16E40, 0x16E7F,
634
    0x16EA0, 0x16EB8,
635
    0x16EBB, 0x16ED3,
636
    0x16F00, 0x16F4A,
637
    0x16F4F, 0x16F87,
638
    0x16F8F, 0x16F9F,
639
    0x16FE0, 0x16FE1,
640
    0x16FE3, 0x16FE3,
641
    0x16FF0, 0x16FF6,
642
    0x17000, 0x18CD5,
643
    0x18CFF, 0x18D1E,
644
    0x18D80, 0x18DF2,
645
    0x1AFF0, 0x1AFF3,
646
    0x1AFF5, 0x1AFFB,
647
    0x1AFFD, 0x1AFFE,
648
    0x1B000, 0x1B122,
649
    0x1B132, 0x1B132,
650
    0x1B150, 0x1B152,
651
    0x1B155, 0x1B155,
652
    0x1B164, 0x1B167,
653
    0x1B170, 0x1B2FB,
654
    0x1BC00, 0x1BC6A,
655
    0x1BC70, 0x1BC7C,
656
    0x1BC80, 0x1BC88,
657
    0x1BC90, 0x1BC99,
658
    0x1BC9E, 0x1BC9E,
659
    0x1D400, 0x1D454,
660
    0x1D456, 0x1D49C,
661
    0x1D49E, 0x1D49F,
662
    0x1D4A2, 0x1D4A2,
663
    0x1D4A5, 0x1D4A6,
664
    0x1D4A9, 0x1D4AC,
665
    0x1D4AE, 0x1D4B9,
666
    0x1D4BB, 0x1D4BB,
667
    0x1D4BD, 0x1D4C3,
668
    0x1D4C5, 0x1D505,
669
    0x1D507, 0x1D50A,
670
    0x1D50D, 0x1D514,
671
    0x1D516, 0x1D51C,
672
    0x1D51E, 0x1D539,
673
    0x1D53B, 0x1D53E,
674
    0x1D540, 0x1D544,
675
    0x1D546, 0x1D546,
676
    0x1D54A, 0x1D550,
677
    0x1D552, 0x1D6A5,
678
    0x1D6A8, 0x1D6C0,
679
    0x1D6C2, 0x1D6DA,
680
    0x1D6DC, 0x1D6FA,
681
    0x1D6FC, 0x1D714,
682
    0x1D716, 0x1D734,
683
    0x1D736, 0x1D74E,
684
    0x1D750, 0x1D76E,
685
    0x1D770, 0x1D788,
686
    0x1D78A, 0x1D7A8,
687
    0x1D7AA, 0x1D7C2,
688
    0x1D7C4, 0x1D7CB,
689
    0x1DF00, 0x1DF1E,
690
    0x1DF25, 0x1DF2A,
691
    0x1E000, 0x1E006,
692
    0x1E008, 0x1E018,
693
    0x1E01B, 0x1E021,
694
    0x1E023, 0x1E024,
695
    0x1E026, 0x1E02A,
696
    0x1E030, 0x1E06D,
697
    0x1E08F, 0x1E08F,
698
    0x1E100, 0x1E12C,
699
    0x1E137, 0x1E13D,
700
    0x1E14E, 0x1E14E,
701
    0x1E290, 0x1E2AD,
702
    0x1E2C0, 0x1E2EB,
703
    0x1E4D0, 0x1E4EB,
704
    0x1E5D0, 0x1E5ED,
705
    0x1E5F0, 0x1E5F0,
706
    0x1E6C0, 0x1E6DE,
707
    0x1E6E0, 0x1E6F5,
708
    0x1E6FE, 0x1E6FF,
709
    0x1E7E0, 0x1E7E6,
710
    0x1E7E8, 0x1E7EB,
711
    0x1E7ED, 0x1E7EE,
712
    0x1E7F0, 0x1E7FE,
713
    0x1E800, 0x1E8C4,
714
    0x1E900, 0x1E943,
715
    0x1E947, 0x1E947,
716
    0x1E94B, 0x1E94B,
717
    0x1EE00, 0x1EE03,
718
    0x1EE05, 0x1EE1F,
719
    0x1EE21, 0x1EE22,
720
    0x1EE24, 0x1EE24,
721
    0x1EE27, 0x1EE27,
722
    0x1EE29, 0x1EE32,
723
    0x1EE34, 0x1EE37,
724
    0x1EE39, 0x1EE39,
725
    0x1EE3B, 0x1EE3B,
726
    0x1EE42, 0x1EE42,
727
    0x1EE47, 0x1EE47,
728
    0x1EE49, 0x1EE49,
729
    0x1EE4B, 0x1EE4B,
730
    0x1EE4D, 0x1EE4F,
731
    0x1EE51, 0x1EE52,
732
    0x1EE54, 0x1EE54,
733
    0x1EE57, 0x1EE57,
734
    0x1EE59, 0x1EE59,
735
    0x1EE5B, 0x1EE5B,
736
    0x1EE5D, 0x1EE5D,
737
    0x1EE5F, 0x1EE5F,
738
    0x1EE61, 0x1EE62,
739
    0x1EE64, 0x1EE64,
740
    0x1EE67, 0x1EE6A,
741
    0x1EE6C, 0x1EE72,
742
    0x1EE74, 0x1EE77,
743
    0x1EE79, 0x1EE7C,
744
    0x1EE7E, 0x1EE7E,
745
    0x1EE80, 0x1EE89,
746
    0x1EE8B, 0x1EE9B,
747
    0x1EEA1, 0x1EEA3,
748
    0x1EEA5, 0x1EEA9,
749
    0x1EEAB, 0x1EEBB,
750
    0x1F130, 0x1F149,
751
    0x1F150, 0x1F169,
752
    0x1F170, 0x1F189,
753
    0x20000, 0x2A6DF,
754
    0x2A700, 0x2B81D,
755
    0x2B820, 0x2CEAD,
756
    0x2CEB0, 0x2EBE0,
757
    0x2EBF0, 0x2EE5D,
758
    0x2F800, 0x2FA1D,
759
    0x30000, 0x3134A,
760
    0x31350, 0x33479,
761
};
762
763
0
#define UNICODE_ALNUM_CODEPOINTS_LENGTH 1598
764
static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEPOINTS_LENGTH] = {
765
    0x100, 0x2C1,
766
    0x2C6, 0x2D1,
767
    0x2E0, 0x2E4,
768
    0x2EC, 0x2EC,
769
    0x2EE, 0x2EE,
770
    0x345, 0x345,
771
    0x363, 0x374,
772
    0x376, 0x377,
773
    0x37A, 0x37D,
774
    0x37F, 0x37F,
775
    0x386, 0x386,
776
    0x388, 0x38A,
777
    0x38C, 0x38C,
778
    0x38E, 0x3A1,
779
    0x3A3, 0x3F5,
780
    0x3F7, 0x481,
781
    0x48A, 0x52F,
782
    0x531, 0x556,
783
    0x559, 0x559,
784
    0x560, 0x588,
785
    0x5B0, 0x5BD,
786
    0x5BF, 0x5BF,
787
    0x5C1, 0x5C2,
788
    0x5C4, 0x5C5,
789
    0x5C7, 0x5C7,
790
    0x5D0, 0x5EA,
791
    0x5EF, 0x5F2,
792
    0x610, 0x61A,
793
    0x620, 0x657,
794
    0x659, 0x669,
795
    0x66E, 0x6D3,
796
    0x6D5, 0x6DC,
797
    0x6E1, 0x6E8,
798
    0x6ED, 0x6FC,
799
    0x6FF, 0x6FF,
800
    0x710, 0x73F,
801
    0x74D, 0x7B1,
802
    0x7C0, 0x7EA,
803
    0x7F4, 0x7F5,
804
    0x7FA, 0x7FA,
805
    0x800, 0x817,
806
    0x81A, 0x82C,
807
    0x840, 0x858,
808
    0x860, 0x86A,
809
    0x870, 0x887,
810
    0x889, 0x88F,
811
    0x897, 0x897,
812
    0x8A0, 0x8C9,
813
    0x8D4, 0x8DF,
814
    0x8E3, 0x8E9,
815
    0x8F0, 0x93B,
816
    0x93D, 0x94C,
817
    0x94E, 0x950,
818
    0x955, 0x963,
819
    0x966, 0x96F,
820
    0x971, 0x983,
821
    0x985, 0x98C,
822
    0x98F, 0x990,
823
    0x993, 0x9A8,
824
    0x9AA, 0x9B0,
825
    0x9B2, 0x9B2,
826
    0x9B6, 0x9B9,
827
    0x9BD, 0x9C4,
828
    0x9C7, 0x9C8,
829
    0x9CB, 0x9CC,
830
    0x9CE, 0x9CE,
831
    0x9D7, 0x9D7,
832
    0x9DC, 0x9DD,
833
    0x9DF, 0x9E3,
834
    0x9E6, 0x9F1,
835
    0x9FC, 0x9FC,
836
    0xA01, 0xA03,
837
    0xA05, 0xA0A,
838
    0xA0F, 0xA10,
839
    0xA13, 0xA28,
840
    0xA2A, 0xA30,
841
    0xA32, 0xA33,
842
    0xA35, 0xA36,
843
    0xA38, 0xA39,
844
    0xA3E, 0xA42,
845
    0xA47, 0xA48,
846
    0xA4B, 0xA4C,
847
    0xA51, 0xA51,
848
    0xA59, 0xA5C,
849
    0xA5E, 0xA5E,
850
    0xA66, 0xA75,
851
    0xA81, 0xA83,
852
    0xA85, 0xA8D,
853
    0xA8F, 0xA91,
854
    0xA93, 0xAA8,
855
    0xAAA, 0xAB0,
856
    0xAB2, 0xAB3,
857
    0xAB5, 0xAB9,
858
    0xABD, 0xAC5,
859
    0xAC7, 0xAC9,
860
    0xACB, 0xACC,
861
    0xAD0, 0xAD0,
862
    0xAE0, 0xAE3,
863
    0xAE6, 0xAEF,
864
    0xAF9, 0xAFC,
865
    0xB01, 0xB03,
866
    0xB05, 0xB0C,
867
    0xB0F, 0xB10,
868
    0xB13, 0xB28,
869
    0xB2A, 0xB30,
870
    0xB32, 0xB33,
871
    0xB35, 0xB39,
872
    0xB3D, 0xB44,
873
    0xB47, 0xB48,
874
    0xB4B, 0xB4C,
875
    0xB56, 0xB57,
876
    0xB5C, 0xB5D,
877
    0xB5F, 0xB63,
878
    0xB66, 0xB6F,
879
    0xB71, 0xB71,
880
    0xB82, 0xB83,
881
    0xB85, 0xB8A,
882
    0xB8E, 0xB90,
883
    0xB92, 0xB95,
884
    0xB99, 0xB9A,
885
    0xB9C, 0xB9C,
886
    0xB9E, 0xB9F,
887
    0xBA3, 0xBA4,
888
    0xBA8, 0xBAA,
889
    0xBAE, 0xBB9,
890
    0xBBE, 0xBC2,
891
    0xBC6, 0xBC8,
892
    0xBCA, 0xBCC,
893
    0xBD0, 0xBD0,
894
    0xBD7, 0xBD7,
895
    0xBE6, 0xBEF,
896
    0xC00, 0xC0C,
897
    0xC0E, 0xC10,
898
    0xC12, 0xC28,
899
    0xC2A, 0xC39,
900
    0xC3D, 0xC44,
901
    0xC46, 0xC48,
902
    0xC4A, 0xC4C,
903
    0xC55, 0xC56,
904
    0xC58, 0xC5A,
905
    0xC5C, 0xC5D,
906
    0xC60, 0xC63,
907
    0xC66, 0xC6F,
908
    0xC80, 0xC83,
909
    0xC85, 0xC8C,
910
    0xC8E, 0xC90,
911
    0xC92, 0xCA8,
912
    0xCAA, 0xCB3,
913
    0xCB5, 0xCB9,
914
    0xCBD, 0xCC4,
915
    0xCC6, 0xCC8,
916
    0xCCA, 0xCCC,
917
    0xCD5, 0xCD6,
918
    0xCDC, 0xCDE,
919
    0xCE0, 0xCE3,
920
    0xCE6, 0xCEF,
921
    0xCF1, 0xCF3,
922
    0xD00, 0xD0C,
923
    0xD0E, 0xD10,
924
    0xD12, 0xD3A,
925
    0xD3D, 0xD44,
926
    0xD46, 0xD48,
927
    0xD4A, 0xD4C,
928
    0xD4E, 0xD4E,
929
    0xD54, 0xD57,
930
    0xD5F, 0xD63,
931
    0xD66, 0xD6F,
932
    0xD7A, 0xD7F,
933
    0xD81, 0xD83,
934
    0xD85, 0xD96,
935
    0xD9A, 0xDB1,
936
    0xDB3, 0xDBB,
937
    0xDBD, 0xDBD,
938
    0xDC0, 0xDC6,
939
    0xDCF, 0xDD4,
940
    0xDD6, 0xDD6,
941
    0xDD8, 0xDDF,
942
    0xDE6, 0xDEF,
943
    0xDF2, 0xDF3,
944
    0xE01, 0xE3A,
945
    0xE40, 0xE46,
946
    0xE4D, 0xE4D,
947
    0xE50, 0xE59,
948
    0xE81, 0xE82,
949
    0xE84, 0xE84,
950
    0xE86, 0xE8A,
951
    0xE8C, 0xEA3,
952
    0xEA5, 0xEA5,
953
    0xEA7, 0xEB9,
954
    0xEBB, 0xEBD,
955
    0xEC0, 0xEC4,
956
    0xEC6, 0xEC6,
957
    0xECD, 0xECD,
958
    0xED0, 0xED9,
959
    0xEDC, 0xEDF,
960
    0xF00, 0xF00,
961
    0xF20, 0xF29,
962
    0xF40, 0xF47,
963
    0xF49, 0xF6C,
964
    0xF71, 0xF83,
965
    0xF88, 0xF97,
966
    0xF99, 0xFBC,
967
    0x1000, 0x1036,
968
    0x1038, 0x1038,
969
    0x103B, 0x1049,
970
    0x1050, 0x109D,
971
    0x10A0, 0x10C5,
972
    0x10C7, 0x10C7,
973
    0x10CD, 0x10CD,
974
    0x10D0, 0x10FA,
975
    0x10FC, 0x1248,
976
    0x124A, 0x124D,
977
    0x1250, 0x1256,
978
    0x1258, 0x1258,
979
    0x125A, 0x125D,
980
    0x1260, 0x1288,
981
    0x128A, 0x128D,
982
    0x1290, 0x12B0,
983
    0x12B2, 0x12B5,
984
    0x12B8, 0x12BE,
985
    0x12C0, 0x12C0,
986
    0x12C2, 0x12C5,
987
    0x12C8, 0x12D6,
988
    0x12D8, 0x1310,
989
    0x1312, 0x1315,
990
    0x1318, 0x135A,
991
    0x1380, 0x138F,
992
    0x13A0, 0x13F5,
993
    0x13F8, 0x13FD,
994
    0x1401, 0x166C,
995
    0x166F, 0x167F,
996
    0x1681, 0x169A,
997
    0x16A0, 0x16EA,
998
    0x16EE, 0x16F8,
999
    0x1700, 0x1713,
1000
    0x171F, 0x1733,
1001
    0x1740, 0x1753,
1002
    0x1760, 0x176C,
1003
    0x176E, 0x1770,
1004
    0x1772, 0x1773,
1005
    0x1780, 0x17B3,
1006
    0x17B6, 0x17C8,
1007
    0x17D7, 0x17D7,
1008
    0x17DC, 0x17DC,
1009
    0x17E0, 0x17E9,
1010
    0x1810, 0x1819,
1011
    0x1820, 0x1878,
1012
    0x1880, 0x18AA,
1013
    0x18B0, 0x18F5,
1014
    0x1900, 0x191E,
1015
    0x1920, 0x192B,
1016
    0x1930, 0x1938,
1017
    0x1946, 0x196D,
1018
    0x1970, 0x1974,
1019
    0x1980, 0x19AB,
1020
    0x19B0, 0x19C9,
1021
    0x19D0, 0x19D9,
1022
    0x1A00, 0x1A1B,
1023
    0x1A20, 0x1A5E,
1024
    0x1A61, 0x1A74,
1025
    0x1A80, 0x1A89,
1026
    0x1A90, 0x1A99,
1027
    0x1AA7, 0x1AA7,
1028
    0x1ABF, 0x1AC0,
1029
    0x1ACC, 0x1ACE,
1030
    0x1B00, 0x1B33,
1031
    0x1B35, 0x1B43,
1032
    0x1B45, 0x1B4C,
1033
    0x1B50, 0x1B59,
1034
    0x1B80, 0x1BA9,
1035
    0x1BAC, 0x1BE5,
1036
    0x1BE7, 0x1BF1,
1037
    0x1C00, 0x1C36,
1038
    0x1C40, 0x1C49,
1039
    0x1C4D, 0x1C7D,
1040
    0x1C80, 0x1C8A,
1041
    0x1C90, 0x1CBA,
1042
    0x1CBD, 0x1CBF,
1043
    0x1CE9, 0x1CEC,
1044
    0x1CEE, 0x1CF3,
1045
    0x1CF5, 0x1CF6,
1046
    0x1CFA, 0x1CFA,
1047
    0x1D00, 0x1DBF,
1048
    0x1DD3, 0x1DF4,
1049
    0x1E00, 0x1F15,
1050
    0x1F18, 0x1F1D,
1051
    0x1F20, 0x1F45,
1052
    0x1F48, 0x1F4D,
1053
    0x1F50, 0x1F57,
1054
    0x1F59, 0x1F59,
1055
    0x1F5B, 0x1F5B,
1056
    0x1F5D, 0x1F5D,
1057
    0x1F5F, 0x1F7D,
1058
    0x1F80, 0x1FB4,
1059
    0x1FB6, 0x1FBC,
1060
    0x1FBE, 0x1FBE,
1061
    0x1FC2, 0x1FC4,
1062
    0x1FC6, 0x1FCC,
1063
    0x1FD0, 0x1FD3,
1064
    0x1FD6, 0x1FDB,
1065
    0x1FE0, 0x1FEC,
1066
    0x1FF2, 0x1FF4,
1067
    0x1FF6, 0x1FFC,
1068
    0x2071, 0x2071,
1069
    0x207F, 0x207F,
1070
    0x2090, 0x209C,
1071
    0x2102, 0x2102,
1072
    0x2107, 0x2107,
1073
    0x210A, 0x2113,
1074
    0x2115, 0x2115,
1075
    0x2119, 0x211D,
1076
    0x2124, 0x2124,
1077
    0x2126, 0x2126,
1078
    0x2128, 0x2128,
1079
    0x212A, 0x212D,
1080
    0x212F, 0x2139,
1081
    0x213C, 0x213F,
1082
    0x2145, 0x2149,
1083
    0x214E, 0x214E,
1084
    0x2160, 0x2188,
1085
    0x24B6, 0x24E9,
1086
    0x2C00, 0x2CE4,
1087
    0x2CEB, 0x2CEE,
1088
    0x2CF2, 0x2CF3,
1089
    0x2D00, 0x2D25,
1090
    0x2D27, 0x2D27,
1091
    0x2D2D, 0x2D2D,
1092
    0x2D30, 0x2D67,
1093
    0x2D6F, 0x2D6F,
1094
    0x2D80, 0x2D96,
1095
    0x2DA0, 0x2DA6,
1096
    0x2DA8, 0x2DAE,
1097
    0x2DB0, 0x2DB6,
1098
    0x2DB8, 0x2DBE,
1099
    0x2DC0, 0x2DC6,
1100
    0x2DC8, 0x2DCE,
1101
    0x2DD0, 0x2DD6,
1102
    0x2DD8, 0x2DDE,
1103
    0x2DE0, 0x2DFF,
1104
    0x2E2F, 0x2E2F,
1105
    0x3005, 0x3007,
1106
    0x3021, 0x3029,
1107
    0x3031, 0x3035,
1108
    0x3038, 0x303C,
1109
    0x3041, 0x3096,
1110
    0x309D, 0x309F,
1111
    0x30A1, 0x30FA,
1112
    0x30FC, 0x30FF,
1113
    0x3105, 0x312F,
1114
    0x3131, 0x318E,
1115
    0x31A0, 0x31BF,
1116
    0x31F0, 0x31FF,
1117
    0x3400, 0x4DBF,
1118
    0x4E00, 0xA48C,
1119
    0xA4D0, 0xA4FD,
1120
    0xA500, 0xA60C,
1121
    0xA610, 0xA62B,
1122
    0xA640, 0xA66E,
1123
    0xA674, 0xA67B,
1124
    0xA67F, 0xA6EF,
1125
    0xA717, 0xA71F,
1126
    0xA722, 0xA788,
1127
    0xA78B, 0xA7DC,
1128
    0xA7F1, 0xA805,
1129
    0xA807, 0xA827,
1130
    0xA840, 0xA873,
1131
    0xA880, 0xA8C3,
1132
    0xA8C5, 0xA8C5,
1133
    0xA8D0, 0xA8D9,
1134
    0xA8F2, 0xA8F7,
1135
    0xA8FB, 0xA8FB,
1136
    0xA8FD, 0xA92A,
1137
    0xA930, 0xA952,
1138
    0xA960, 0xA97C,
1139
    0xA980, 0xA9B2,
1140
    0xA9B4, 0xA9BF,
1141
    0xA9CF, 0xA9D9,
1142
    0xA9E0, 0xA9FE,
1143
    0xAA00, 0xAA36,
1144
    0xAA40, 0xAA4D,
1145
    0xAA50, 0xAA59,
1146
    0xAA60, 0xAA76,
1147
    0xAA7A, 0xAABE,
1148
    0xAAC0, 0xAAC0,
1149
    0xAAC2, 0xAAC2,
1150
    0xAADB, 0xAADD,
1151
    0xAAE0, 0xAAEF,
1152
    0xAAF2, 0xAAF5,
1153
    0xAB01, 0xAB06,
1154
    0xAB09, 0xAB0E,
1155
    0xAB11, 0xAB16,
1156
    0xAB20, 0xAB26,
1157
    0xAB28, 0xAB2E,
1158
    0xAB30, 0xAB5A,
1159
    0xAB5C, 0xAB69,
1160
    0xAB70, 0xABEA,
1161
    0xABF0, 0xABF9,
1162
    0xAC00, 0xD7A3,
1163
    0xD7B0, 0xD7C6,
1164
    0xD7CB, 0xD7FB,
1165
    0xF900, 0xFA6D,
1166
    0xFA70, 0xFAD9,
1167
    0xFB00, 0xFB06,
1168
    0xFB13, 0xFB17,
1169
    0xFB1D, 0xFB28,
1170
    0xFB2A, 0xFB36,
1171
    0xFB38, 0xFB3C,
1172
    0xFB3E, 0xFB3E,
1173
    0xFB40, 0xFB41,
1174
    0xFB43, 0xFB44,
1175
    0xFB46, 0xFBB1,
1176
    0xFBD3, 0xFD3D,
1177
    0xFD50, 0xFD8F,
1178
    0xFD92, 0xFDC7,
1179
    0xFDF0, 0xFDFB,
1180
    0xFE70, 0xFE74,
1181
    0xFE76, 0xFEFC,
1182
    0xFF10, 0xFF19,
1183
    0xFF21, 0xFF3A,
1184
    0xFF41, 0xFF5A,
1185
    0xFF66, 0xFFBE,
1186
    0xFFC2, 0xFFC7,
1187
    0xFFCA, 0xFFCF,
1188
    0xFFD2, 0xFFD7,
1189
    0xFFDA, 0xFFDC,
1190
    0x10000, 0x1000B,
1191
    0x1000D, 0x10026,
1192
    0x10028, 0x1003A,
1193
    0x1003C, 0x1003D,
1194
    0x1003F, 0x1004D,
1195
    0x10050, 0x1005D,
1196
    0x10080, 0x100FA,
1197
    0x10140, 0x10174,
1198
    0x10280, 0x1029C,
1199
    0x102A0, 0x102D0,
1200
    0x10300, 0x1031F,
1201
    0x1032D, 0x1034A,
1202
    0x10350, 0x1037A,
1203
    0x10380, 0x1039D,
1204
    0x103A0, 0x103C3,
1205
    0x103C8, 0x103CF,
1206
    0x103D1, 0x103D5,
1207
    0x10400, 0x1049D,
1208
    0x104A0, 0x104A9,
1209
    0x104B0, 0x104D3,
1210
    0x104D8, 0x104FB,
1211
    0x10500, 0x10527,
1212
    0x10530, 0x10563,
1213
    0x10570, 0x1057A,
1214
    0x1057C, 0x1058A,
1215
    0x1058C, 0x10592,
1216
    0x10594, 0x10595,
1217
    0x10597, 0x105A1,
1218
    0x105A3, 0x105B1,
1219
    0x105B3, 0x105B9,
1220
    0x105BB, 0x105BC,
1221
    0x105C0, 0x105F3,
1222
    0x10600, 0x10736,
1223
    0x10740, 0x10755,
1224
    0x10760, 0x10767,
1225
    0x10780, 0x10785,
1226
    0x10787, 0x107B0,
1227
    0x107B2, 0x107BA,
1228
    0x10800, 0x10805,
1229
    0x10808, 0x10808,
1230
    0x1080A, 0x10835,
1231
    0x10837, 0x10838,
1232
    0x1083C, 0x1083C,
1233
    0x1083F, 0x10855,
1234
    0x10860, 0x10876,
1235
    0x10880, 0x1089E,
1236
    0x108E0, 0x108F2,
1237
    0x108F4, 0x108F5,
1238
    0x10900, 0x10915,
1239
    0x10920, 0x10939,
1240
    0x10940, 0x10959,
1241
    0x10980, 0x109B7,
1242
    0x109BE, 0x109BF,
1243
    0x10A00, 0x10A03,
1244
    0x10A05, 0x10A06,
1245
    0x10A0C, 0x10A13,
1246
    0x10A15, 0x10A17,
1247
    0x10A19, 0x10A35,
1248
    0x10A60, 0x10A7C,
1249
    0x10A80, 0x10A9C,
1250
    0x10AC0, 0x10AC7,
1251
    0x10AC9, 0x10AE4,
1252
    0x10B00, 0x10B35,
1253
    0x10B40, 0x10B55,
1254
    0x10B60, 0x10B72,
1255
    0x10B80, 0x10B91,
1256
    0x10C00, 0x10C48,
1257
    0x10C80, 0x10CB2,
1258
    0x10CC0, 0x10CF2,
1259
    0x10D00, 0x10D27,
1260
    0x10D30, 0x10D39,
1261
    0x10D40, 0x10D65,
1262
    0x10D69, 0x10D69,
1263
    0x10D6F, 0x10D85,
1264
    0x10E80, 0x10EA9,
1265
    0x10EAB, 0x10EAC,
1266
    0x10EB0, 0x10EB1,
1267
    0x10EC2, 0x10EC7,
1268
    0x10EFA, 0x10EFC,
1269
    0x10F00, 0x10F1C,
1270
    0x10F27, 0x10F27,
1271
    0x10F30, 0x10F45,
1272
    0x10F70, 0x10F81,
1273
    0x10FB0, 0x10FC4,
1274
    0x10FE0, 0x10FF6,
1275
    0x11000, 0x11045,
1276
    0x11066, 0x1106F,
1277
    0x11071, 0x11075,
1278
    0x11080, 0x110B8,
1279
    0x110C2, 0x110C2,
1280
    0x110D0, 0x110E8,
1281
    0x110F0, 0x110F9,
1282
    0x11100, 0x11132,
1283
    0x11136, 0x1113F,
1284
    0x11144, 0x11147,
1285
    0x11150, 0x11172,
1286
    0x11176, 0x11176,
1287
    0x11180, 0x111BF,
1288
    0x111C1, 0x111C4,
1289
    0x111CE, 0x111DA,
1290
    0x111DC, 0x111DC,
1291
    0x11200, 0x11211,
1292
    0x11213, 0x11234,
1293
    0x11237, 0x11237,
1294
    0x1123E, 0x11241,
1295
    0x11280, 0x11286,
1296
    0x11288, 0x11288,
1297
    0x1128A, 0x1128D,
1298
    0x1128F, 0x1129D,
1299
    0x1129F, 0x112A8,
1300
    0x112B0, 0x112E8,
1301
    0x112F0, 0x112F9,
1302
    0x11300, 0x11303,
1303
    0x11305, 0x1130C,
1304
    0x1130F, 0x11310,
1305
    0x11313, 0x11328,
1306
    0x1132A, 0x11330,
1307
    0x11332, 0x11333,
1308
    0x11335, 0x11339,
1309
    0x1133D, 0x11344,
1310
    0x11347, 0x11348,
1311
    0x1134B, 0x1134C,
1312
    0x11350, 0x11350,
1313
    0x11357, 0x11357,
1314
    0x1135D, 0x11363,
1315
    0x11380, 0x11389,
1316
    0x1138B, 0x1138B,
1317
    0x1138E, 0x1138E,
1318
    0x11390, 0x113B5,
1319
    0x113B7, 0x113C0,
1320
    0x113C2, 0x113C2,
1321
    0x113C5, 0x113C5,
1322
    0x113C7, 0x113CA,
1323
    0x113CC, 0x113CD,
1324
    0x113D1, 0x113D1,
1325
    0x113D3, 0x113D3,
1326
    0x11400, 0x11441,
1327
    0x11443, 0x11445,
1328
    0x11447, 0x1144A,
1329
    0x11450, 0x11459,
1330
    0x1145F, 0x11461,
1331
    0x11480, 0x114C1,
1332
    0x114C4, 0x114C5,
1333
    0x114C7, 0x114C7,
1334
    0x114D0, 0x114D9,
1335
    0x11580, 0x115B5,
1336
    0x115B8, 0x115BE,
1337
    0x115D8, 0x115DD,
1338
    0x11600, 0x1163E,
1339
    0x11640, 0x11640,
1340
    0x11644, 0x11644,
1341
    0x11650, 0x11659,
1342
    0x11680, 0x116B5,
1343
    0x116B8, 0x116B8,
1344
    0x116C0, 0x116C9,
1345
    0x116D0, 0x116E3,
1346
    0x11700, 0x1171A,
1347
    0x1171D, 0x1172A,
1348
    0x11730, 0x11739,
1349
    0x11740, 0x11746,
1350
    0x11800, 0x11838,
1351
    0x118A0, 0x118E9,
1352
    0x118FF, 0x11906,
1353
    0x11909, 0x11909,
1354
    0x1190C, 0x11913,
1355
    0x11915, 0x11916,
1356
    0x11918, 0x11935,
1357
    0x11937, 0x11938,
1358
    0x1193B, 0x1193C,
1359
    0x1193F, 0x11942,
1360
    0x11950, 0x11959,
1361
    0x119A0, 0x119A7,
1362
    0x119AA, 0x119D7,
1363
    0x119DA, 0x119DF,
1364
    0x119E1, 0x119E1,
1365
    0x119E3, 0x119E4,
1366
    0x11A00, 0x11A32,
1367
    0x11A35, 0x11A3E,
1368
    0x11A50, 0x11A97,
1369
    0x11A9D, 0x11A9D,
1370
    0x11AB0, 0x11AF8,
1371
    0x11B60, 0x11B67,
1372
    0x11BC0, 0x11BE0,
1373
    0x11BF0, 0x11BF9,
1374
    0x11C00, 0x11C08,
1375
    0x11C0A, 0x11C36,
1376
    0x11C38, 0x11C3E,
1377
    0x11C40, 0x11C40,
1378
    0x11C50, 0x11C59,
1379
    0x11C72, 0x11C8F,
1380
    0x11C92, 0x11CA7,
1381
    0x11CA9, 0x11CB6,
1382
    0x11D00, 0x11D06,
1383
    0x11D08, 0x11D09,
1384
    0x11D0B, 0x11D36,
1385
    0x11D3A, 0x11D3A,
1386
    0x11D3C, 0x11D3D,
1387
    0x11D3F, 0x11D41,
1388
    0x11D43, 0x11D43,
1389
    0x11D46, 0x11D47,
1390
    0x11D50, 0x11D59,
1391
    0x11D60, 0x11D65,
1392
    0x11D67, 0x11D68,
1393
    0x11D6A, 0x11D8E,
1394
    0x11D90, 0x11D91,
1395
    0x11D93, 0x11D96,
1396
    0x11D98, 0x11D98,
1397
    0x11DA0, 0x11DA9,
1398
    0x11DB0, 0x11DDB,
1399
    0x11DE0, 0x11DE9,
1400
    0x11EE0, 0x11EF6,
1401
    0x11F00, 0x11F10,
1402
    0x11F12, 0x11F3A,
1403
    0x11F3E, 0x11F40,
1404
    0x11F50, 0x11F59,
1405
    0x11FB0, 0x11FB0,
1406
    0x12000, 0x12399,
1407
    0x12400, 0x1246E,
1408
    0x12480, 0x12543,
1409
    0x12F90, 0x12FF0,
1410
    0x13000, 0x1342F,
1411
    0x13441, 0x13446,
1412
    0x13460, 0x143FA,
1413
    0x14400, 0x14646,
1414
    0x16100, 0x1612E,
1415
    0x16130, 0x16139,
1416
    0x16800, 0x16A38,
1417
    0x16A40, 0x16A5E,
1418
    0x16A60, 0x16A69,
1419
    0x16A70, 0x16ABE,
1420
    0x16AC0, 0x16AC9,
1421
    0x16AD0, 0x16AED,
1422
    0x16B00, 0x16B2F,
1423
    0x16B40, 0x16B43,
1424
    0x16B50, 0x16B59,
1425
    0x16B63, 0x16B77,
1426
    0x16B7D, 0x16B8F,
1427
    0x16D40, 0x16D6C,
1428
    0x16D70, 0x16D79,
1429
    0x16E40, 0x16E7F,
1430
    0x16EA0, 0x16EB8,
1431
    0x16EBB, 0x16ED3,
1432
    0x16F00, 0x16F4A,
1433
    0x16F4F, 0x16F87,
1434
    0x16F8F, 0x16F9F,
1435
    0x16FE0, 0x16FE1,
1436
    0x16FE3, 0x16FE3,
1437
    0x16FF0, 0x16FF6,
1438
    0x17000, 0x18CD5,
1439
    0x18CFF, 0x18D1E,
1440
    0x18D80, 0x18DF2,
1441
    0x1AFF0, 0x1AFF3,
1442
    0x1AFF5, 0x1AFFB,
1443
    0x1AFFD, 0x1AFFE,
1444
    0x1B000, 0x1B122,
1445
    0x1B132, 0x1B132,
1446
    0x1B150, 0x1B152,
1447
    0x1B155, 0x1B155,
1448
    0x1B164, 0x1B167,
1449
    0x1B170, 0x1B2FB,
1450
    0x1BC00, 0x1BC6A,
1451
    0x1BC70, 0x1BC7C,
1452
    0x1BC80, 0x1BC88,
1453
    0x1BC90, 0x1BC99,
1454
    0x1BC9E, 0x1BC9E,
1455
    0x1CCF0, 0x1CCF9,
1456
    0x1D400, 0x1D454,
1457
    0x1D456, 0x1D49C,
1458
    0x1D49E, 0x1D49F,
1459
    0x1D4A2, 0x1D4A2,
1460
    0x1D4A5, 0x1D4A6,
1461
    0x1D4A9, 0x1D4AC,
1462
    0x1D4AE, 0x1D4B9,
1463
    0x1D4BB, 0x1D4BB,
1464
    0x1D4BD, 0x1D4C3,
1465
    0x1D4C5, 0x1D505,
1466
    0x1D507, 0x1D50A,
1467
    0x1D50D, 0x1D514,
1468
    0x1D516, 0x1D51C,
1469
    0x1D51E, 0x1D539,
1470
    0x1D53B, 0x1D53E,
1471
    0x1D540, 0x1D544,
1472
    0x1D546, 0x1D546,
1473
    0x1D54A, 0x1D550,
1474
    0x1D552, 0x1D6A5,
1475
    0x1D6A8, 0x1D6C0,
1476
    0x1D6C2, 0x1D6DA,
1477
    0x1D6DC, 0x1D6FA,
1478
    0x1D6FC, 0x1D714,
1479
    0x1D716, 0x1D734,
1480
    0x1D736, 0x1D74E,
1481
    0x1D750, 0x1D76E,
1482
    0x1D770, 0x1D788,
1483
    0x1D78A, 0x1D7A8,
1484
    0x1D7AA, 0x1D7C2,
1485
    0x1D7C4, 0x1D7CB,
1486
    0x1D7CE, 0x1D7FF,
1487
    0x1DF00, 0x1DF1E,
1488
    0x1DF25, 0x1DF2A,
1489
    0x1E000, 0x1E006,
1490
    0x1E008, 0x1E018,
1491
    0x1E01B, 0x1E021,
1492
    0x1E023, 0x1E024,
1493
    0x1E026, 0x1E02A,
1494
    0x1E030, 0x1E06D,
1495
    0x1E08F, 0x1E08F,
1496
    0x1E100, 0x1E12C,
1497
    0x1E137, 0x1E13D,
1498
    0x1E140, 0x1E149,
1499
    0x1E14E, 0x1E14E,
1500
    0x1E290, 0x1E2AD,
1501
    0x1E2C0, 0x1E2EB,
1502
    0x1E2F0, 0x1E2F9,
1503
    0x1E4D0, 0x1E4EB,
1504
    0x1E4F0, 0x1E4F9,
1505
    0x1E5D0, 0x1E5ED,
1506
    0x1E5F0, 0x1E5FA,
1507
    0x1E6C0, 0x1E6DE,
1508
    0x1E6E0, 0x1E6F5,
1509
    0x1E6FE, 0x1E6FF,
1510
    0x1E7E0, 0x1E7E6,
1511
    0x1E7E8, 0x1E7EB,
1512
    0x1E7ED, 0x1E7EE,
1513
    0x1E7F0, 0x1E7FE,
1514
    0x1E800, 0x1E8C4,
1515
    0x1E900, 0x1E943,
1516
    0x1E947, 0x1E947,
1517
    0x1E94B, 0x1E94B,
1518
    0x1E950, 0x1E959,
1519
    0x1EE00, 0x1EE03,
1520
    0x1EE05, 0x1EE1F,
1521
    0x1EE21, 0x1EE22,
1522
    0x1EE24, 0x1EE24,
1523
    0x1EE27, 0x1EE27,
1524
    0x1EE29, 0x1EE32,
1525
    0x1EE34, 0x1EE37,
1526
    0x1EE39, 0x1EE39,
1527
    0x1EE3B, 0x1EE3B,
1528
    0x1EE42, 0x1EE42,
1529
    0x1EE47, 0x1EE47,
1530
    0x1EE49, 0x1EE49,
1531
    0x1EE4B, 0x1EE4B,
1532
    0x1EE4D, 0x1EE4F,
1533
    0x1EE51, 0x1EE52,
1534
    0x1EE54, 0x1EE54,
1535
    0x1EE57, 0x1EE57,
1536
    0x1EE59, 0x1EE59,
1537
    0x1EE5B, 0x1EE5B,
1538
    0x1EE5D, 0x1EE5D,
1539
    0x1EE5F, 0x1EE5F,
1540
    0x1EE61, 0x1EE62,
1541
    0x1EE64, 0x1EE64,
1542
    0x1EE67, 0x1EE6A,
1543
    0x1EE6C, 0x1EE72,
1544
    0x1EE74, 0x1EE77,
1545
    0x1EE79, 0x1EE7C,
1546
    0x1EE7E, 0x1EE7E,
1547
    0x1EE80, 0x1EE89,
1548
    0x1EE8B, 0x1EE9B,
1549
    0x1EEA1, 0x1EEA3,
1550
    0x1EEA5, 0x1EEA9,
1551
    0x1EEAB, 0x1EEBB,
1552
    0x1F130, 0x1F149,
1553
    0x1F150, 0x1F169,
1554
    0x1F170, 0x1F189,
1555
    0x1FBF0, 0x1FBF9,
1556
    0x20000, 0x2A6DF,
1557
    0x2A700, 0x2B81D,
1558
    0x2B820, 0x2CEAD,
1559
    0x2CEB0, 0x2EBE0,
1560
    0x2EBF0, 0x2EE5D,
1561
    0x2F800, 0x2FA1D,
1562
    0x30000, 0x3134A,
1563
    0x31350, 0x33479,
1564
};
1565
1566
53
#define UNICODE_ISUPPER_CODEPOINTS_LENGTH 1320
1567
static const pm_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_CODEPOINTS_LENGTH] = {
1568
    0x100, 0x100,
1569
    0x102, 0x102,
1570
    0x104, 0x104,
1571
    0x106, 0x106,
1572
    0x108, 0x108,
1573
    0x10A, 0x10A,
1574
    0x10C, 0x10C,
1575
    0x10E, 0x10E,
1576
    0x110, 0x110,
1577
    0x112, 0x112,
1578
    0x114, 0x114,
1579
    0x116, 0x116,
1580
    0x118, 0x118,
1581
    0x11A, 0x11A,
1582
    0x11C, 0x11C,
1583
    0x11E, 0x11E,
1584
    0x120, 0x120,
1585
    0x122, 0x122,
1586
    0x124, 0x124,
1587
    0x126, 0x126,
1588
    0x128, 0x128,
1589
    0x12A, 0x12A,
1590
    0x12C, 0x12C,
1591
    0x12E, 0x12E,
1592
    0x130, 0x130,
1593
    0x132, 0x132,
1594
    0x134, 0x134,
1595
    0x136, 0x136,
1596
    0x139, 0x139,
1597
    0x13B, 0x13B,
1598
    0x13D, 0x13D,
1599
    0x13F, 0x13F,
1600
    0x141, 0x141,
1601
    0x143, 0x143,
1602
    0x145, 0x145,
1603
    0x147, 0x147,
1604
    0x14A, 0x14A,
1605
    0x14C, 0x14C,
1606
    0x14E, 0x14E,
1607
    0x150, 0x150,
1608
    0x152, 0x152,
1609
    0x154, 0x154,
1610
    0x156, 0x156,
1611
    0x158, 0x158,
1612
    0x15A, 0x15A,
1613
    0x15C, 0x15C,
1614
    0x15E, 0x15E,
1615
    0x160, 0x160,
1616
    0x162, 0x162,
1617
    0x164, 0x164,
1618
    0x166, 0x166,
1619
    0x168, 0x168,
1620
    0x16A, 0x16A,
1621
    0x16C, 0x16C,
1622
    0x16E, 0x16E,
1623
    0x170, 0x170,
1624
    0x172, 0x172,
1625
    0x174, 0x174,
1626
    0x176, 0x176,
1627
    0x178, 0x179,
1628
    0x17B, 0x17B,
1629
    0x17D, 0x17D,
1630
    0x181, 0x182,
1631
    0x184, 0x184,
1632
    0x186, 0x187,
1633
    0x189, 0x18B,
1634
    0x18E, 0x191,
1635
    0x193, 0x194,
1636
    0x196, 0x198,
1637
    0x19C, 0x19D,
1638
    0x19F, 0x1A0,
1639
    0x1A2, 0x1A2,
1640
    0x1A4, 0x1A4,
1641
    0x1A6, 0x1A7,
1642
    0x1A9, 0x1A9,
1643
    0x1AC, 0x1AC,
1644
    0x1AE, 0x1AF,
1645
    0x1B1, 0x1B3,
1646
    0x1B5, 0x1B5,
1647
    0x1B7, 0x1B8,
1648
    0x1BC, 0x1BC,
1649
    0x1C4, 0x1C5,
1650
    0x1C7, 0x1C8,
1651
    0x1CA, 0x1CB,
1652
    0x1CD, 0x1CD,
1653
    0x1CF, 0x1CF,
1654
    0x1D1, 0x1D1,
1655
    0x1D3, 0x1D3,
1656
    0x1D5, 0x1D5,
1657
    0x1D7, 0x1D7,
1658
    0x1D9, 0x1D9,
1659
    0x1DB, 0x1DB,
1660
    0x1DE, 0x1DE,
1661
    0x1E0, 0x1E0,
1662
    0x1E2, 0x1E2,
1663
    0x1E4, 0x1E4,
1664
    0x1E6, 0x1E6,
1665
    0x1E8, 0x1E8,
1666
    0x1EA, 0x1EA,
1667
    0x1EC, 0x1EC,
1668
    0x1EE, 0x1EE,
1669
    0x1F1, 0x1F2,
1670
    0x1F4, 0x1F4,
1671
    0x1F6, 0x1F8,
1672
    0x1FA, 0x1FA,
1673
    0x1FC, 0x1FC,
1674
    0x1FE, 0x1FE,
1675
    0x200, 0x200,
1676
    0x202, 0x202,
1677
    0x204, 0x204,
1678
    0x206, 0x206,
1679
    0x208, 0x208,
1680
    0x20A, 0x20A,
1681
    0x20C, 0x20C,
1682
    0x20E, 0x20E,
1683
    0x210, 0x210,
1684
    0x212, 0x212,
1685
    0x214, 0x214,
1686
    0x216, 0x216,
1687
    0x218, 0x218,
1688
    0x21A, 0x21A,
1689
    0x21C, 0x21C,
1690
    0x21E, 0x21E,
1691
    0x220, 0x220,
1692
    0x222, 0x222,
1693
    0x224, 0x224,
1694
    0x226, 0x226,
1695
    0x228, 0x228,
1696
    0x22A, 0x22A,
1697
    0x22C, 0x22C,
1698
    0x22E, 0x22E,
1699
    0x230, 0x230,
1700
    0x232, 0x232,
1701
    0x23A, 0x23B,
1702
    0x23D, 0x23E,
1703
    0x241, 0x241,
1704
    0x243, 0x246,
1705
    0x248, 0x248,
1706
    0x24A, 0x24A,
1707
    0x24C, 0x24C,
1708
    0x24E, 0x24E,
1709
    0x370, 0x370,
1710
    0x372, 0x372,
1711
    0x376, 0x376,
1712
    0x37F, 0x37F,
1713
    0x386, 0x386,
1714
    0x388, 0x38A,
1715
    0x38C, 0x38C,
1716
    0x38E, 0x38F,
1717
    0x391, 0x3A1,
1718
    0x3A3, 0x3AB,
1719
    0x3CF, 0x3CF,
1720
    0x3D2, 0x3D4,
1721
    0x3D8, 0x3D8,
1722
    0x3DA, 0x3DA,
1723
    0x3DC, 0x3DC,
1724
    0x3DE, 0x3DE,
1725
    0x3E0, 0x3E0,
1726
    0x3E2, 0x3E2,
1727
    0x3E4, 0x3E4,
1728
    0x3E6, 0x3E6,
1729
    0x3E8, 0x3E8,
1730
    0x3EA, 0x3EA,
1731
    0x3EC, 0x3EC,
1732
    0x3EE, 0x3EE,
1733
    0x3F4, 0x3F4,
1734
    0x3F7, 0x3F7,
1735
    0x3F9, 0x3FA,
1736
    0x3FD, 0x42F,
1737
    0x460, 0x460,
1738
    0x462, 0x462,
1739
    0x464, 0x464,
1740
    0x466, 0x466,
1741
    0x468, 0x468,
1742
    0x46A, 0x46A,
1743
    0x46C, 0x46C,
1744
    0x46E, 0x46E,
1745
    0x470, 0x470,
1746
    0x472, 0x472,
1747
    0x474, 0x474,
1748
    0x476, 0x476,
1749
    0x478, 0x478,
1750
    0x47A, 0x47A,
1751
    0x47C, 0x47C,
1752
    0x47E, 0x47E,
1753
    0x480, 0x480,
1754
    0x48A, 0x48A,
1755
    0x48C, 0x48C,
1756
    0x48E, 0x48E,
1757
    0x490, 0x490,
1758
    0x492, 0x492,
1759
    0x494, 0x494,
1760
    0x496, 0x496,
1761
    0x498, 0x498,
1762
    0x49A, 0x49A,
1763
    0x49C, 0x49C,
1764
    0x49E, 0x49E,
1765
    0x4A0, 0x4A0,
1766
    0x4A2, 0x4A2,
1767
    0x4A4, 0x4A4,
1768
    0x4A6, 0x4A6,
1769
    0x4A8, 0x4A8,
1770
    0x4AA, 0x4AA,
1771
    0x4AC, 0x4AC,
1772
    0x4AE, 0x4AE,
1773
    0x4B0, 0x4B0,
1774
    0x4B2, 0x4B2,
1775
    0x4B4, 0x4B4,
1776
    0x4B6, 0x4B6,
1777
    0x4B8, 0x4B8,
1778
    0x4BA, 0x4BA,
1779
    0x4BC, 0x4BC,
1780
    0x4BE, 0x4BE,
1781
    0x4C0, 0x4C1,
1782
    0x4C3, 0x4C3,
1783
    0x4C5, 0x4C5,
1784
    0x4C7, 0x4C7,
1785
    0x4C9, 0x4C9,
1786
    0x4CB, 0x4CB,
1787
    0x4CD, 0x4CD,
1788
    0x4D0, 0x4D0,
1789
    0x4D2, 0x4D2,
1790
    0x4D4, 0x4D4,
1791
    0x4D6, 0x4D6,
1792
    0x4D8, 0x4D8,
1793
    0x4DA, 0x4DA,
1794
    0x4DC, 0x4DC,
1795
    0x4DE, 0x4DE,
1796
    0x4E0, 0x4E0,
1797
    0x4E2, 0x4E2,
1798
    0x4E4, 0x4E4,
1799
    0x4E6, 0x4E6,
1800
    0x4E8, 0x4E8,
1801
    0x4EA, 0x4EA,
1802
    0x4EC, 0x4EC,
1803
    0x4EE, 0x4EE,
1804
    0x4F0, 0x4F0,
1805
    0x4F2, 0x4F2,
1806
    0x4F4, 0x4F4,
1807
    0x4F6, 0x4F6,
1808
    0x4F8, 0x4F8,
1809
    0x4FA, 0x4FA,
1810
    0x4FC, 0x4FC,
1811
    0x4FE, 0x4FE,
1812
    0x500, 0x500,
1813
    0x502, 0x502,
1814
    0x504, 0x504,
1815
    0x506, 0x506,
1816
    0x508, 0x508,
1817
    0x50A, 0x50A,
1818
    0x50C, 0x50C,
1819
    0x50E, 0x50E,
1820
    0x510, 0x510,
1821
    0x512, 0x512,
1822
    0x514, 0x514,
1823
    0x516, 0x516,
1824
    0x518, 0x518,
1825
    0x51A, 0x51A,
1826
    0x51C, 0x51C,
1827
    0x51E, 0x51E,
1828
    0x520, 0x520,
1829
    0x522, 0x522,
1830
    0x524, 0x524,
1831
    0x526, 0x526,
1832
    0x528, 0x528,
1833
    0x52A, 0x52A,
1834
    0x52C, 0x52C,
1835
    0x52E, 0x52E,
1836
    0x531, 0x556,
1837
    0x10A0, 0x10C5,
1838
    0x10C7, 0x10C7,
1839
    0x10CD, 0x10CD,
1840
    0x13A0, 0x13F5,
1841
    0x1C89, 0x1C89,
1842
    0x1C90, 0x1CBA,
1843
    0x1CBD, 0x1CBF,
1844
    0x1E00, 0x1E00,
1845
    0x1E02, 0x1E02,
1846
    0x1E04, 0x1E04,
1847
    0x1E06, 0x1E06,
1848
    0x1E08, 0x1E08,
1849
    0x1E0A, 0x1E0A,
1850
    0x1E0C, 0x1E0C,
1851
    0x1E0E, 0x1E0E,
1852
    0x1E10, 0x1E10,
1853
    0x1E12, 0x1E12,
1854
    0x1E14, 0x1E14,
1855
    0x1E16, 0x1E16,
1856
    0x1E18, 0x1E18,
1857
    0x1E1A, 0x1E1A,
1858
    0x1E1C, 0x1E1C,
1859
    0x1E1E, 0x1E1E,
1860
    0x1E20, 0x1E20,
1861
    0x1E22, 0x1E22,
1862
    0x1E24, 0x1E24,
1863
    0x1E26, 0x1E26,
1864
    0x1E28, 0x1E28,
1865
    0x1E2A, 0x1E2A,
1866
    0x1E2C, 0x1E2C,
1867
    0x1E2E, 0x1E2E,
1868
    0x1E30, 0x1E30,
1869
    0x1E32, 0x1E32,
1870
    0x1E34, 0x1E34,
1871
    0x1E36, 0x1E36,
1872
    0x1E38, 0x1E38,
1873
    0x1E3A, 0x1E3A,
1874
    0x1E3C, 0x1E3C,
1875
    0x1E3E, 0x1E3E,
1876
    0x1E40, 0x1E40,
1877
    0x1E42, 0x1E42,
1878
    0x1E44, 0x1E44,
1879
    0x1E46, 0x1E46,
1880
    0x1E48, 0x1E48,
1881
    0x1E4A, 0x1E4A,
1882
    0x1E4C, 0x1E4C,
1883
    0x1E4E, 0x1E4E,
1884
    0x1E50, 0x1E50,
1885
    0x1E52, 0x1E52,
1886
    0x1E54, 0x1E54,
1887
    0x1E56, 0x1E56,
1888
    0x1E58, 0x1E58,
1889
    0x1E5A, 0x1E5A,
1890
    0x1E5C, 0x1E5C,
1891
    0x1E5E, 0x1E5E,
1892
    0x1E60, 0x1E60,
1893
    0x1E62, 0x1E62,
1894
    0x1E64, 0x1E64,
1895
    0x1E66, 0x1E66,
1896
    0x1E68, 0x1E68,
1897
    0x1E6A, 0x1E6A,
1898
    0x1E6C, 0x1E6C,
1899
    0x1E6E, 0x1E6E,
1900
    0x1E70, 0x1E70,
1901
    0x1E72, 0x1E72,
1902
    0x1E74, 0x1E74,
1903
    0x1E76, 0x1E76,
1904
    0x1E78, 0x1E78,
1905
    0x1E7A, 0x1E7A,
1906
    0x1E7C, 0x1E7C,
1907
    0x1E7E, 0x1E7E,
1908
    0x1E80, 0x1E80,
1909
    0x1E82, 0x1E82,
1910
    0x1E84, 0x1E84,
1911
    0x1E86, 0x1E86,
1912
    0x1E88, 0x1E88,
1913
    0x1E8A, 0x1E8A,
1914
    0x1E8C, 0x1E8C,
1915
    0x1E8E, 0x1E8E,
1916
    0x1E90, 0x1E90,
1917
    0x1E92, 0x1E92,
1918
    0x1E94, 0x1E94,
1919
    0x1E9E, 0x1E9E,
1920
    0x1EA0, 0x1EA0,
1921
    0x1EA2, 0x1EA2,
1922
    0x1EA4, 0x1EA4,
1923
    0x1EA6, 0x1EA6,
1924
    0x1EA8, 0x1EA8,
1925
    0x1EAA, 0x1EAA,
1926
    0x1EAC, 0x1EAC,
1927
    0x1EAE, 0x1EAE,
1928
    0x1EB0, 0x1EB0,
1929
    0x1EB2, 0x1EB2,
1930
    0x1EB4, 0x1EB4,
1931
    0x1EB6, 0x1EB6,
1932
    0x1EB8, 0x1EB8,
1933
    0x1EBA, 0x1EBA,
1934
    0x1EBC, 0x1EBC,
1935
    0x1EBE, 0x1EBE,
1936
    0x1EC0, 0x1EC0,
1937
    0x1EC2, 0x1EC2,
1938
    0x1EC4, 0x1EC4,
1939
    0x1EC6, 0x1EC6,
1940
    0x1EC8, 0x1EC8,
1941
    0x1ECA, 0x1ECA,
1942
    0x1ECC, 0x1ECC,
1943
    0x1ECE, 0x1ECE,
1944
    0x1ED0, 0x1ED0,
1945
    0x1ED2, 0x1ED2,
1946
    0x1ED4, 0x1ED4,
1947
    0x1ED6, 0x1ED6,
1948
    0x1ED8, 0x1ED8,
1949
    0x1EDA, 0x1EDA,
1950
    0x1EDC, 0x1EDC,
1951
    0x1EDE, 0x1EDE,
1952
    0x1EE0, 0x1EE0,
1953
    0x1EE2, 0x1EE2,
1954
    0x1EE4, 0x1EE4,
1955
    0x1EE6, 0x1EE6,
1956
    0x1EE8, 0x1EE8,
1957
    0x1EEA, 0x1EEA,
1958
    0x1EEC, 0x1EEC,
1959
    0x1EEE, 0x1EEE,
1960
    0x1EF0, 0x1EF0,
1961
    0x1EF2, 0x1EF2,
1962
    0x1EF4, 0x1EF4,
1963
    0x1EF6, 0x1EF6,
1964
    0x1EF8, 0x1EF8,
1965
    0x1EFA, 0x1EFA,
1966
    0x1EFC, 0x1EFC,
1967
    0x1EFE, 0x1EFE,
1968
    0x1F08, 0x1F0F,
1969
    0x1F18, 0x1F1D,
1970
    0x1F28, 0x1F2F,
1971
    0x1F38, 0x1F3F,
1972
    0x1F48, 0x1F4D,
1973
    0x1F59, 0x1F59,
1974
    0x1F5B, 0x1F5B,
1975
    0x1F5D, 0x1F5D,
1976
    0x1F5F, 0x1F5F,
1977
    0x1F68, 0x1F6F,
1978
    0x1F88, 0x1F8F,
1979
    0x1F98, 0x1F9F,
1980
    0x1FA8, 0x1FAF,
1981
    0x1FB8, 0x1FBC,
1982
    0x1FC8, 0x1FCC,
1983
    0x1FD8, 0x1FDB,
1984
    0x1FE8, 0x1FEC,
1985
    0x1FF8, 0x1FFC,
1986
    0x2102, 0x2102,
1987
    0x2107, 0x2107,
1988
    0x210B, 0x210D,
1989
    0x2110, 0x2112,
1990
    0x2115, 0x2115,
1991
    0x2119, 0x211D,
1992
    0x2124, 0x2124,
1993
    0x2126, 0x2126,
1994
    0x2128, 0x2128,
1995
    0x212A, 0x212D,
1996
    0x2130, 0x2133,
1997
    0x213E, 0x213F,
1998
    0x2145, 0x2145,
1999
    0x2160, 0x216F,
2000
    0x2183, 0x2183,
2001
    0x24B6, 0x24CF,
2002
    0x2C00, 0x2C2F,
2003
    0x2C60, 0x2C60,
2004
    0x2C62, 0x2C64,
2005
    0x2C67, 0x2C67,
2006
    0x2C69, 0x2C69,
2007
    0x2C6B, 0x2C6B,
2008
    0x2C6D, 0x2C70,
2009
    0x2C72, 0x2C72,
2010
    0x2C75, 0x2C75,
2011
    0x2C7E, 0x2C80,
2012
    0x2C82, 0x2C82,
2013
    0x2C84, 0x2C84,
2014
    0x2C86, 0x2C86,
2015
    0x2C88, 0x2C88,
2016
    0x2C8A, 0x2C8A,
2017
    0x2C8C, 0x2C8C,
2018
    0x2C8E, 0x2C8E,
2019
    0x2C90, 0x2C90,
2020
    0x2C92, 0x2C92,
2021
    0x2C94, 0x2C94,
2022
    0x2C96, 0x2C96,
2023
    0x2C98, 0x2C98,
2024
    0x2C9A, 0x2C9A,
2025
    0x2C9C, 0x2C9C,
2026
    0x2C9E, 0x2C9E,
2027
    0x2CA0, 0x2CA0,
2028
    0x2CA2, 0x2CA2,
2029
    0x2CA4, 0x2CA4,
2030
    0x2CA6, 0x2CA6,
2031
    0x2CA8, 0x2CA8,
2032
    0x2CAA, 0x2CAA,
2033
    0x2CAC, 0x2CAC,
2034
    0x2CAE, 0x2CAE,
2035
    0x2CB0, 0x2CB0,
2036
    0x2CB2, 0x2CB2,
2037
    0x2CB4, 0x2CB4,
2038
    0x2CB6, 0x2CB6,
2039
    0x2CB8, 0x2CB8,
2040
    0x2CBA, 0x2CBA,
2041
    0x2CBC, 0x2CBC,
2042
    0x2CBE, 0x2CBE,
2043
    0x2CC0, 0x2CC0,
2044
    0x2CC2, 0x2CC2,
2045
    0x2CC4, 0x2CC4,
2046
    0x2CC6, 0x2CC6,
2047
    0x2CC8, 0x2CC8,
2048
    0x2CCA, 0x2CCA,
2049
    0x2CCC, 0x2CCC,
2050
    0x2CCE, 0x2CCE,
2051
    0x2CD0, 0x2CD0,
2052
    0x2CD2, 0x2CD2,
2053
    0x2CD4, 0x2CD4,
2054
    0x2CD6, 0x2CD6,
2055
    0x2CD8, 0x2CD8,
2056
    0x2CDA, 0x2CDA,
2057
    0x2CDC, 0x2CDC,
2058
    0x2CDE, 0x2CDE,
2059
    0x2CE0, 0x2CE0,
2060
    0x2CE2, 0x2CE2,
2061
    0x2CEB, 0x2CEB,
2062
    0x2CED, 0x2CED,
2063
    0x2CF2, 0x2CF2,
2064
    0xA640, 0xA640,
2065
    0xA642, 0xA642,
2066
    0xA644, 0xA644,
2067
    0xA646, 0xA646,
2068
    0xA648, 0xA648,
2069
    0xA64A, 0xA64A,
2070
    0xA64C, 0xA64C,
2071
    0xA64E, 0xA64E,
2072
    0xA650, 0xA650,
2073
    0xA652, 0xA652,
2074
    0xA654, 0xA654,
2075
    0xA656, 0xA656,
2076
    0xA658, 0xA658,
2077
    0xA65A, 0xA65A,
2078
    0xA65C, 0xA65C,
2079
    0xA65E, 0xA65E,
2080
    0xA660, 0xA660,
2081
    0xA662, 0xA662,
2082
    0xA664, 0xA664,
2083
    0xA666, 0xA666,
2084
    0xA668, 0xA668,
2085
    0xA66A, 0xA66A,
2086
    0xA66C, 0xA66C,
2087
    0xA680, 0xA680,
2088
    0xA682, 0xA682,
2089
    0xA684, 0xA684,
2090
    0xA686, 0xA686,
2091
    0xA688, 0xA688,
2092
    0xA68A, 0xA68A,
2093
    0xA68C, 0xA68C,
2094
    0xA68E, 0xA68E,
2095
    0xA690, 0xA690,
2096
    0xA692, 0xA692,
2097
    0xA694, 0xA694,
2098
    0xA696, 0xA696,
2099
    0xA698, 0xA698,
2100
    0xA69A, 0xA69A,
2101
    0xA722, 0xA722,
2102
    0xA724, 0xA724,
2103
    0xA726, 0xA726,
2104
    0xA728, 0xA728,
2105
    0xA72A, 0xA72A,
2106
    0xA72C, 0xA72C,
2107
    0xA72E, 0xA72E,
2108
    0xA732, 0xA732,
2109
    0xA734, 0xA734,
2110
    0xA736, 0xA736,
2111
    0xA738, 0xA738,
2112
    0xA73A, 0xA73A,
2113
    0xA73C, 0xA73C,
2114
    0xA73E, 0xA73E,
2115
    0xA740, 0xA740,
2116
    0xA742, 0xA742,
2117
    0xA744, 0xA744,
2118
    0xA746, 0xA746,
2119
    0xA748, 0xA748,
2120
    0xA74A, 0xA74A,
2121
    0xA74C, 0xA74C,
2122
    0xA74E, 0xA74E,
2123
    0xA750, 0xA750,
2124
    0xA752, 0xA752,
2125
    0xA754, 0xA754,
2126
    0xA756, 0xA756,
2127
    0xA758, 0xA758,
2128
    0xA75A, 0xA75A,
2129
    0xA75C, 0xA75C,
2130
    0xA75E, 0xA75E,
2131
    0xA760, 0xA760,
2132
    0xA762, 0xA762,
2133
    0xA764, 0xA764,
2134
    0xA766, 0xA766,
2135
    0xA768, 0xA768,
2136
    0xA76A, 0xA76A,
2137
    0xA76C, 0xA76C,
2138
    0xA76E, 0xA76E,
2139
    0xA779, 0xA779,
2140
    0xA77B, 0xA77B,
2141
    0xA77D, 0xA77E,
2142
    0xA780, 0xA780,
2143
    0xA782, 0xA782,
2144
    0xA784, 0xA784,
2145
    0xA786, 0xA786,
2146
    0xA78B, 0xA78B,
2147
    0xA78D, 0xA78D,
2148
    0xA790, 0xA790,
2149
    0xA792, 0xA792,
2150
    0xA796, 0xA796,
2151
    0xA798, 0xA798,
2152
    0xA79A, 0xA79A,
2153
    0xA79C, 0xA79C,
2154
    0xA79E, 0xA79E,
2155
    0xA7A0, 0xA7A0,
2156
    0xA7A2, 0xA7A2,
2157
    0xA7A4, 0xA7A4,
2158
    0xA7A6, 0xA7A6,
2159
    0xA7A8, 0xA7A8,
2160
    0xA7AA, 0xA7AE,
2161
    0xA7B0, 0xA7B4,
2162
    0xA7B6, 0xA7B6,
2163
    0xA7B8, 0xA7B8,
2164
    0xA7BA, 0xA7BA,
2165
    0xA7BC, 0xA7BC,
2166
    0xA7BE, 0xA7BE,
2167
    0xA7C0, 0xA7C0,
2168
    0xA7C2, 0xA7C2,
2169
    0xA7C4, 0xA7C7,
2170
    0xA7C9, 0xA7C9,
2171
    0xA7CB, 0xA7CC,
2172
    0xA7CE, 0xA7CE,
2173
    0xA7D0, 0xA7D0,
2174
    0xA7D2, 0xA7D2,
2175
    0xA7D4, 0xA7D4,
2176
    0xA7D6, 0xA7D6,
2177
    0xA7D8, 0xA7D8,
2178
    0xA7DA, 0xA7DA,
2179
    0xA7DC, 0xA7DC,
2180
    0xA7F5, 0xA7F5,
2181
    0xFF21, 0xFF3A,
2182
    0x10400, 0x10427,
2183
    0x104B0, 0x104D3,
2184
    0x10570, 0x1057A,
2185
    0x1057C, 0x1058A,
2186
    0x1058C, 0x10592,
2187
    0x10594, 0x10595,
2188
    0x10C80, 0x10CB2,
2189
    0x10D50, 0x10D65,
2190
    0x118A0, 0x118BF,
2191
    0x16E40, 0x16E5F,
2192
    0x16EA0, 0x16EB8,
2193
    0x1D400, 0x1D419,
2194
    0x1D434, 0x1D44D,
2195
    0x1D468, 0x1D481,
2196
    0x1D49C, 0x1D49C,
2197
    0x1D49E, 0x1D49F,
2198
    0x1D4A2, 0x1D4A2,
2199
    0x1D4A5, 0x1D4A6,
2200
    0x1D4A9, 0x1D4AC,
2201
    0x1D4AE, 0x1D4B5,
2202
    0x1D4D0, 0x1D4E9,
2203
    0x1D504, 0x1D505,
2204
    0x1D507, 0x1D50A,
2205
    0x1D50D, 0x1D514,
2206
    0x1D516, 0x1D51C,
2207
    0x1D538, 0x1D539,
2208
    0x1D53B, 0x1D53E,
2209
    0x1D540, 0x1D544,
2210
    0x1D546, 0x1D546,
2211
    0x1D54A, 0x1D550,
2212
    0x1D56C, 0x1D585,
2213
    0x1D5A0, 0x1D5B9,
2214
    0x1D5D4, 0x1D5ED,
2215
    0x1D608, 0x1D621,
2216
    0x1D63C, 0x1D655,
2217
    0x1D670, 0x1D689,
2218
    0x1D6A8, 0x1D6C0,
2219
    0x1D6E2, 0x1D6FA,
2220
    0x1D71C, 0x1D734,
2221
    0x1D756, 0x1D76E,
2222
    0x1D790, 0x1D7A8,
2223
    0x1D7CA, 0x1D7CA,
2224
    0x1E900, 0x1E921,
2225
    0x1F130, 0x1F149,
2226
    0x1F150, 0x1F169,
2227
    0x1F170, 0x1F189,
2228
};
2229
2230
/**
2231
 * Each element of the following table contains a bitfield that indicates a
2232
 * piece of information about the corresponding unicode codepoint. Note that
2233
 * this table is different from other encodings where we used a lookup table
2234
 * because the indices of those tables are the byte representations, not the
2235
 * codepoints themselves.
2236
 */
2237
const uint8_t pm_encoding_unicode_table[256] = {
2238
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2239
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2240
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2241
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2242
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2243
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2244
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2245
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2246
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2247
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2248
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2249
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Ax
2250
    0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Bx
2251
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
2252
    7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
2253
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
2254
    3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
2255
};
2256
2257
/**
2258
 * Binary search through the given list of codepoints to see if the given
2259
 * codepoint is in the list.
2260
 */
2261
static bool
2262
53
pm_unicode_codepoint_match(pm_unicode_codepoint_t codepoint, const pm_unicode_codepoint_t *codepoints, size_t size) {
2263
53
    size_t start = 0;
2264
53
    size_t end = size;
2265
2266
548
    while (start < end) {
2267
495
        size_t middle = start + (end - start) / 2;
2268
495
        if ((middle % 2) != 0) middle--;
2269
2270
495
        if (codepoint >= codepoints[middle] && codepoint <= codepoints[middle + 1]) {
2271
0
            return true;
2272
0
        }
2273
2274
495
        if (codepoint < codepoints[middle]) {
2275
201
            end = middle;
2276
294
        } else {
2277
294
            start = middle + 2;
2278
294
        }
2279
495
    }
2280
2281
53
    return false;
2282
53
}
2283
2284
/**
2285
 * A state transition table for decoding UTF-8.
2286
 *
2287
 * Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>
2288
 *
2289
 * Permission is hereby granted, free of charge, to any person obtaining a copy
2290
 * of this software and associated documentation files (the "Software"), to deal
2291
 * in the Software without restriction, including without limitation the rights
2292
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2293
 * copies of the Software, and to permit persons to whom the Software is
2294
 * furnished to do so, subject to the following conditions:
2295
 *
2296
 * The above copyright notice and this permission notice shall be included in
2297
 * all copies or substantial portions of the Software.
2298
 *
2299
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2300
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2301
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2302
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2303
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2304
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2305
 * SOFTWARE.
2306
 */
2307
static const uint8_t pm_utf_8_dfa[] = {
2308
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 00..1f
2309
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 20..3f
2310
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 40..5f
2311
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 60..7f
2312
    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, // 80..9f
2313
    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, // a0..bf
2314
    8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // c0..df
2315
    0xa,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x4,0x3,0x3, // e0..ef
2316
    0xb,0x6,0x6,0x6,0x5,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, // f0..ff
2317
    0x0,0x1,0x2,0x3,0x5,0x8,0x7,0x1,0x1,0x1,0x4,0x6,0x1,0x1,0x1,0x1, // s0..s0
2318
    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1, // s1..s2
2319
    1,2,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1, // s3..s4
2320
    1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,3,1,1,1,1,1,1, // s5..s6
2321
    1,3,1,1,1,1,1,3,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // s7..s8
2322
};
2323
2324
/**
2325
 * Given a pointer to a string and the number of bytes remaining in the string,
2326
 * decode the next UTF-8 codepoint and return it. The number of bytes consumed
2327
 * is returned in the width out parameter.
2328
 */
2329
static pm_unicode_codepoint_t
2330
55
pm_utf_8_codepoint(const uint8_t *b, ptrdiff_t n, size_t *width) {
2331
55
    assert(n >= 0);
2332
2333
55
    size_t maximum = (n > 4) ? 4 : ((size_t) n);
2334
55
    uint32_t codepoint;
2335
55
    uint32_t state = 0;
2336
2337
153
    for (size_t index = 0; index < maximum; index++) {
2338
151
        uint32_t byte = b[index];
2339
151
        uint32_t type = pm_utf_8_dfa[byte];
2340
2341
151
        codepoint = (state != 0) ?
2342
96
            (byte & 0x3fu) | (codepoint << 6) :
2343
151
            (0xffu >> type) & (byte);
2344
2345
151
        state = pm_utf_8_dfa[256 + (state * 16) + type];
2346
151
        if (state == 0) {
2347
53
            *width = index + 1;
2348
53
            return (pm_unicode_codepoint_t) codepoint;
2349
53
        }
2350
151
    }
2351
2352
2
    *width = 0;
2353
2
    return 0;
2354
55
}
2355
2356
/**
2357
 * Return the size of the next character in the UTF-8 encoding.
2358
 */
2359
size_t
2360
296k
pm_encoding_utf_8_char_width(const uint8_t *b, ptrdiff_t n) {
2361
296k
    assert(n >= 0);
2362
2363
296k
    size_t maximum = (n > 4) ? 4 : ((size_t) n);
2364
296k
    uint32_t state = 0;
2365
2366
1.07M
    for (size_t index = 0; index < maximum; index++) {
2367
882k
        state = pm_utf_8_dfa[256 + (state * 16) + pm_utf_8_dfa[b[index]]];
2368
882k
        if (state == 0) return index + 1;
2369
882k
    }
2370
2371
194k
    return 0;
2372
296k
}
2373
2374
/**
2375
 * Return the size of the next character in the UTF-8 encoding if it is an
2376
 * alphabetical character.
2377
 */
2378
size_t
2379
0
pm_encoding_utf_8_alpha_char(const uint8_t *b, ptrdiff_t n) {
2380
0
    if (n == 0) {
2381
0
        return 0;
2382
0
    }
2383
2384
0
    if (*b < 0x80) {
2385
0
        return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT) ? 1 : 0;
2386
0
    }
2387
2388
0
    size_t width;
2389
0
    pm_unicode_codepoint_t codepoint = pm_utf_8_codepoint(b, n, &width);
2390
2391
0
    if (codepoint <= 0xFF) {
2392
0
        return (pm_encoding_unicode_table[(uint8_t) codepoint] & PRISM_ENCODING_ALPHABETIC_BIT) ? width : 0;
2393
0
    } else {
2394
0
        return pm_unicode_codepoint_match(codepoint, unicode_alpha_codepoints, UNICODE_ALPHA_CODEPOINTS_LENGTH) ? width : 0;
2395
0
    }
2396
0
}
2397
2398
/**
2399
 * Return the size of the next character in the UTF-8 encoding if it is an
2400
 * alphanumeric character.
2401
 */
2402
size_t
2403
5.05k
pm_encoding_utf_8_alnum_char(const uint8_t *b, ptrdiff_t n) {
2404
5.05k
    if (n == 0) {
2405
0
        return 0;
2406
0
    }
2407
2408
5.05k
    if (*b < 0x80) {
2409
5.05k
        return (pm_encoding_unicode_table[*b] & (PRISM_ENCODING_ALPHANUMERIC_BIT)) ? 1 : 0;
2410
5.05k
    }
2411
2412
2
    size_t width;
2413
2
    pm_unicode_codepoint_t codepoint = pm_utf_8_codepoint(b, n, &width);
2414
2415
2
    if (codepoint <= 0xFF) {
2416
2
        return (pm_encoding_unicode_table[(uint8_t) codepoint] & (PRISM_ENCODING_ALPHANUMERIC_BIT)) ? width : 0;
2417
2
    } else {
2418
0
        return pm_unicode_codepoint_match(codepoint, unicode_alnum_codepoints, UNICODE_ALNUM_CODEPOINTS_LENGTH) ? width : 0;
2419
0
    }
2420
2
}
2421
2422
/**
2423
 * Return true if the next character in the UTF-8 encoding if it is an uppercase
2424
 * character.
2425
 */
2426
bool
2427
1.22M
pm_encoding_utf_8_isupper_char(const uint8_t *b, ptrdiff_t n) {
2428
1.22M
    if (n == 0) {
2429
0
        return 0;
2430
0
    }
2431
2432
1.22M
    if (*b < 0x80) {
2433
1.22M
        return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false;
2434
1.22M
    }
2435
2436
53
    size_t width;
2437
53
    pm_unicode_codepoint_t codepoint = pm_utf_8_codepoint(b, n, &width);
2438
2439
53
    if (codepoint <= 0xFF) {
2440
0
        return (pm_encoding_unicode_table[(uint8_t) codepoint] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false;
2441
53
    } else {
2442
53
        return pm_unicode_codepoint_match(codepoint, unicode_isupper_codepoints, UNICODE_ISUPPER_CODEPOINTS_LENGTH) ? true : false;
2443
53
    }
2444
53
}
2445
2446
#ifndef PRISM_ENCODING_EXCLUDE_FULL
2447
2448
static pm_unicode_codepoint_t
2449
pm_cesu_8_codepoint(const uint8_t *b, ptrdiff_t n, size_t *width) {
2450
2451
    if ((n > 0) && (b[0] < 0x80)) {
2452
        *width = 1;
2453
        return (pm_unicode_codepoint_t) b[0];
2454
    }
2455
2456
    if (n > 1 && b[0] >= 0xC2 && b[0] <= 0xDF && b[1] >= 0x80 && b[1] <= 0xBF) {
2457
        *width = 2;
2458
2459
        // 110xxxxx 10xxxxxx
2460
        return (pm_unicode_codepoint_t) (((b[0] & 0x1F) << 6) | (b[1] & 0x3F));
2461
    }
2462
2463
    if (n > 5 && b[0] == 0xED && b[1] >= 0xA0 && b[1] <= 0xAF && b[2] >= 0x80 && b[2] <= 0xBF && b[3] == 0xED && b[4] >= 0xB0 && b[4] <= 0xBF && b[5] >= 0x80 && b[5] <= 0xBF) {
2464
        *width = 6;
2465
2466
        // 11101101 1010xxxx 10xxxxxx 11101101 1011xxxx 10xxxxxx
2467
        return (pm_unicode_codepoint_t) (0x10000 + (((b[1] & 0xF) << 16) | ((b[2] & 0x3F) << 10) | ((b[4] & 0xF) << 6) | (b[5] & 0x3F)));
2468
    }
2469
2470
    if (n > 2 && b[0] == 0xED && b[1] >= 0xA0 && b[1] <= 0xBF) {
2471
        *width = 3;
2472
2473
        // 11101101 1010xxxx 10xxxxx
2474
        return (pm_unicode_codepoint_t) (0x10000 + (((b[0] & 0x03) << 16) | ((b[1] & 0x3F) << 10) | (b[2] & 0x3F)));
2475
    }
2476
2477
    if (n > 2 && ((b[0] == 0xE0 && b[1] >= 0xA0) || (b[0] >= 0xE1 && b[0] <= 0xEF && b[1] >= 0x80)) && b[1] <= 0xBF && b[2] >= 0x80 && b[2] <= 0xBF) {
2478
        *width = 3;
2479
2480
        // 1110xxxx 10xxxxxx 10xxxxx
2481
        return (pm_unicode_codepoint_t) (((b[0] & 0xF) << 12) | ((b[1] & 0x3F) << 6) | (b[2] & 0x3F));
2482
    }
2483
2484
    *width = 0;
2485
    return 0;
2486
}
2487
2488
static size_t
2489
pm_encoding_cesu_8_char_width(const uint8_t *b, ptrdiff_t n) {
2490
    if (n == 0) {
2491
        return 0;
2492
    }
2493
2494
    size_t width;
2495
    pm_cesu_8_codepoint(b, n, &width);
2496
    return width;
2497
}
2498
2499
static size_t
2500
pm_encoding_cesu_8_alpha_char(const uint8_t *b, ptrdiff_t n) {
2501
    if (n == 0) {
2502
        return 0;
2503
    }
2504
2505
    if (*b < 0x80) {
2506
        return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT) ? 1 : 0;
2507
    }
2508
2509
    size_t width;
2510
    pm_unicode_codepoint_t codepoint = pm_cesu_8_codepoint(b, n, &width);
2511
2512
    if (codepoint <= 0xFF) {
2513
        return (pm_encoding_unicode_table[(uint8_t) codepoint] & PRISM_ENCODING_ALPHABETIC_BIT) ? width : 0;
2514
    } else {
2515
        return pm_unicode_codepoint_match(codepoint, unicode_alpha_codepoints, UNICODE_ALPHA_CODEPOINTS_LENGTH) ? width : 0;
2516
    }
2517
}
2518
2519
static size_t
2520
pm_encoding_cesu_8_alnum_char(const uint8_t *b, ptrdiff_t n) {
2521
    if (n == 0) {
2522
        return 0;
2523
    }
2524
2525
    if (*b < 0x80) {
2526
        return (pm_encoding_unicode_table[*b] & (PRISM_ENCODING_ALPHANUMERIC_BIT)) ? 1 : 0;
2527
    }
2528
2529
    size_t width;
2530
    pm_unicode_codepoint_t codepoint = pm_cesu_8_codepoint(b, n, &width);
2531
2532
    if (codepoint <= 0xFF) {
2533
        return (pm_encoding_unicode_table[(uint8_t) codepoint] & (PRISM_ENCODING_ALPHANUMERIC_BIT)) ? width : 0;
2534
    } else {
2535
        return pm_unicode_codepoint_match(codepoint, unicode_alnum_codepoints, UNICODE_ALNUM_CODEPOINTS_LENGTH) ? width : 0;
2536
    }
2537
}
2538
2539
static bool
2540
pm_encoding_cesu_8_isupper_char(const uint8_t *b, ptrdiff_t n) {
2541
    if (n == 0) {
2542
        return 0;
2543
    }
2544
2545
    if (*b < 0x80) {
2546
        return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false;
2547
    }
2548
2549
    size_t width;
2550
    pm_unicode_codepoint_t codepoint = pm_cesu_8_codepoint(b, n, &width);
2551
2552
    if (codepoint <= 0xFF) {
2553
        return (pm_encoding_unicode_table[(uint8_t) codepoint] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false;
2554
    } else {
2555
        return pm_unicode_codepoint_match(codepoint, unicode_isupper_codepoints, UNICODE_ISUPPER_CODEPOINTS_LENGTH) ? true : false;
2556
    }
2557
}
2558
2559
#endif
2560
2561
#undef UNICODE_ALPHA_CODEPOINTS_LENGTH
2562
#undef UNICODE_ALNUM_CODEPOINTS_LENGTH
2563
#undef UNICODE_ISUPPER_CODEPOINTS_LENGTH
2564
2565
/**
2566
 * Each element of the following table contains a bitfield that indicates a
2567
 * piece of information about the corresponding US-ASCII character.
2568
 */
2569
static const uint8_t pm_encoding_ascii_table[256] = {
2570
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2571
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2572
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2573
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2574
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2575
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2576
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2577
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2578
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2579
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2580
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2581
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2582
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2583
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2584
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2585
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2586
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2587
};
2588
2589
#ifndef PRISM_ENCODING_EXCLUDE_FULL
2590
2591
/**
2592
 * Each element of the following table contains a bitfield that indicates a
2593
 * piece of information about the corresponding CP850 character.
2594
 */
2595
static const uint8_t pm_encoding_cp850_table[256] = {
2596
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2597
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2598
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2599
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2600
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2601
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2602
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2603
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2604
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2605
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2606
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2607
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2608
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2609
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2610
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2611
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2612
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2613
};
2614
2615
/**
2616
 * Each element of the following table contains a bitfield that indicates a
2617
 * piece of information about the corresponding CP852 character.
2618
 */
2619
static const uint8_t pm_encoding_cp852_table[256] = {
2620
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2621
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2622
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2623
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2624
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2625
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2626
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2627
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2628
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2629
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2630
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2631
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2632
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2633
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2634
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2635
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2636
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2637
};
2638
2639
/**
2640
 * Each element of the following table contains a bitfield that indicates a
2641
 * piece of information about the corresponding CP855 character.
2642
 */
2643
static const uint8_t pm_encoding_cp855_table[256] = {
2644
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2645
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2646
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2647
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2648
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2649
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2650
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2651
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2652
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2653
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2654
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2655
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2656
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2657
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2658
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2659
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2660
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2661
};
2662
2663
/**
2664
 * Each element of the following table contains a bitfield that indicates a
2665
 * piece of information about the corresponding GB1988 character.
2666
 */
2667
static const uint8_t pm_encoding_gb1988_table[256] = {
2668
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2669
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2670
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2671
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2672
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2673
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2674
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2675
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2676
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2677
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2678
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2679
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2680
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2681
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2682
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2683
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2684
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2685
};
2686
2687
/**
2688
 * Each element of the following table contains a bitfield that indicates a
2689
 * piece of information about the corresponding IBM437 character.
2690
 */
2691
static const uint8_t pm_encoding_ibm437_table[256] = {
2692
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2693
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2694
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2695
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2696
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2697
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2698
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2699
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2700
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2701
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2702
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2703
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2704
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2705
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2706
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2707
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2708
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2709
};
2710
2711
/**
2712
 * Each element of the following table contains a bitfield that indicates a
2713
 * piece of information about the corresponding IBM720 character.
2714
 */
2715
static const uint8_t pm_encoding_ibm720_table[256] = {
2716
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2717
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2718
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2719
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2720
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2721
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2722
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2723
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2724
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2725
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2726
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2727
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2728
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2729
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2730
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2731
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2732
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2733
};
2734
2735
/**
2736
 * Each element of the following table contains a bitfield that indicates a
2737
 * piece of information about the corresponding IBM737 character.
2738
 */
2739
static const uint8_t pm_encoding_ibm737_table[256] = {
2740
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2741
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2742
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2743
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2744
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2745
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2746
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2747
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2748
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2749
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2750
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2751
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2752
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2753
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2754
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2755
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2756
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2757
};
2758
2759
/**
2760
 * Each element of the following table contains a bitfield that indicates a
2761
 * piece of information about the corresponding IBM775 character.
2762
 */
2763
static const uint8_t pm_encoding_ibm775_table[256] = {
2764
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2765
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2766
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2767
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2768
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2769
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2770
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2771
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2772
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2773
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2774
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2775
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2776
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2777
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2778
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2779
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2780
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2781
};
2782
2783
/**
2784
 * Each element of the following table contains a bitfield that indicates a
2785
 * piece of information about the corresponding IBM852 character.
2786
 */
2787
static const uint8_t pm_encoding_ibm852_table[256] = {
2788
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2789
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2790
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2791
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2792
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2793
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2794
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2795
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2796
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2797
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2798
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2799
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2800
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2801
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2802
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2803
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2804
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2805
};
2806
2807
/**
2808
 * Each element of the following table contains a bitfield that indicates a
2809
 * piece of information about the corresponding IBM855 character.
2810
 */
2811
static const uint8_t pm_encoding_ibm855_table[256] = {
2812
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2813
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2814
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2815
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2816
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2817
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2818
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2819
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2820
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2821
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2822
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2823
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2824
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2825
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2826
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2827
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2828
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2829
};
2830
2831
/**
2832
 * Each element of the following table contains a bitfield that indicates a
2833
 * piece of information about the corresponding IBM857 character.
2834
 */
2835
static const uint8_t pm_encoding_ibm857_table[256] = {
2836
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2837
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2838
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2839
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2840
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2841
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2842
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2843
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2844
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2845
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2846
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2847
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2848
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2849
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2850
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2851
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2852
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2853
};
2854
2855
/**
2856
 * Each element of the following table contains a bitfield that indicates a
2857
 * piece of information about the corresponding IBM860 character.
2858
 */
2859
static const uint8_t pm_encoding_ibm860_table[256] = {
2860
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2861
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2862
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2863
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2864
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2865
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2866
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2867
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2868
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2869
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2870
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2871
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2872
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2873
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2874
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2875
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2876
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2877
};
2878
2879
/**
2880
 * Each element of the following table contains a bitfield that indicates a
2881
 * piece of information about the corresponding IBM861 character.
2882
 */
2883
static const uint8_t pm_encoding_ibm861_table[256] = {
2884
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2885
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2886
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2887
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2888
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2889
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2890
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2891
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2892
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2893
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2894
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2895
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2896
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2897
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2898
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2899
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2900
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2901
};
2902
2903
/**
2904
 * Each element of the following table contains a bitfield that indicates a
2905
 * piece of information about the corresponding IBM862 character.
2906
 */
2907
static const uint8_t pm_encoding_ibm862_table[256] = {
2908
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2909
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2910
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2911
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2912
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2913
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2914
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2915
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2916
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2917
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2918
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2919
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2920
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2921
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2922
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2923
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2924
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2925
};
2926
2927
/**
2928
 * Each element of the following table contains a bitfield that indicates a
2929
 * piece of information about the corresponding IBM863 character.
2930
 */
2931
static const uint8_t pm_encoding_ibm863_table[256] = {
2932
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2933
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2934
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2935
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2936
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2937
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2938
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2939
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2940
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2941
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2942
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2943
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2944
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2945
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2946
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2947
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2948
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2949
};
2950
2951
/**
2952
 * Each element of the following table contains a bitfield that indicates a
2953
 * piece of information about the corresponding IBM864 character.
2954
 */
2955
static const uint8_t pm_encoding_ibm864_table[256] = {
2956
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2957
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2958
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2959
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2960
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2961
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2962
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2963
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2964
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2965
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2966
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2967
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2968
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2969
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2970
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2971
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2972
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2973
};
2974
2975
/**
2976
 * Each element of the following table contains a bitfield that indicates a
2977
 * piece of information about the corresponding IBM865 character.
2978
 */
2979
static const uint8_t pm_encoding_ibm865_table[256] = {
2980
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
2981
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2982
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2983
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2984
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2985
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2986
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2987
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2988
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2989
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2990
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2991
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2992
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2993
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2994
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2995
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2996
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2997
};
2998
2999
/**
3000
 * Each element of the following table contains a bitfield that indicates a
3001
 * piece of information about the corresponding IBM866 character.
3002
 */
3003
static const uint8_t pm_encoding_ibm866_table[256] = {
3004
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3005
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3006
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3007
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3008
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3009
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3010
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3011
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3012
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3013
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3014
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3015
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3016
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3017
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3018
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3019
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3020
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3021
};
3022
3023
/**
3024
 * Each element of the following table contains a bitfield that indicates a
3025
 * piece of information about the corresponding IBM869 character.
3026
 */
3027
static const uint8_t pm_encoding_ibm869_table[256] = {
3028
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3029
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3030
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3031
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3032
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3033
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3034
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3035
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3036
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3037
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3038
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3039
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3040
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3041
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3042
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3043
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3044
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3045
};
3046
3047
/**
3048
 * Each element of the following table contains a bitfield that indicates a
3049
 * piece of information about the corresponding ISO-8859-1 character.
3050
 */
3051
static const uint8_t pm_encoding_iso_8859_1_table[256] = {
3052
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3053
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3054
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3055
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3056
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3057
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3058
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3059
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3060
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3061
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3062
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3063
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Ax
3064
    0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Bx
3065
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3066
    7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3067
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3068
    3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3069
};
3070
3071
/**
3072
 * Each element of the following table contains a bitfield that indicates a
3073
 * piece of information about the corresponding ISO-8859-2 character.
3074
 */
3075
static const uint8_t pm_encoding_iso_8859_2_table[256] = {
3076
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3077
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3078
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3079
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3080
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3081
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3082
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3083
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3084
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3085
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3086
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3087
    0, 7, 0, 7, 0, 7, 7, 0, 0, 7, 7, 7, 7, 0, 7, 7, // Ax
3088
    0, 3, 0, 3, 0, 3, 3, 0, 0, 3, 3, 3, 3, 0, 3, 3, // Bx
3089
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3090
    7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3091
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3092
    3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3093
};
3094
3095
/**
3096
 * Each element of the following table contains a bitfield that indicates a
3097
 * piece of information about the corresponding ISO-8859-3 character.
3098
 */
3099
static const uint8_t pm_encoding_iso_8859_3_table[256] = {
3100
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3101
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3102
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3103
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3104
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3105
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3106
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3107
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3108
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3109
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3110
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3111
    0, 7, 0, 0, 0, 0, 7, 0, 0, 7, 7, 7, 7, 0, 0, 7, // Ax
3112
    0, 3, 0, 0, 0, 3, 3, 0, 0, 3, 3, 3, 3, 0, 0, 3, // Bx
3113
    7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3114
    0, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3115
    3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3116
    0, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3117
};
3118
3119
/**
3120
 * Each element of the following table contains a bitfield that indicates a
3121
 * piece of information about the corresponding ISO-8859-4 character.
3122
 */
3123
static const uint8_t pm_encoding_iso_8859_4_table[256] = {
3124
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3125
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3126
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3127
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3128
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3129
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3130
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3131
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3132
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3133
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3134
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3135
    0, 7, 3, 7, 0, 7, 7, 0, 0, 7, 7, 7, 7, 0, 7, 0, // Ax
3136
    0, 3, 0, 3, 0, 3, 3, 0, 0, 3, 3, 3, 3, 7, 3, 3, // Bx
3137
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3138
    7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3139
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3140
    3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3141
};
3142
3143
/**
3144
 * Each element of the following table contains a bitfield that indicates a
3145
 * piece of information about the corresponding ISO-8859-5 character.
3146
 */
3147
static const uint8_t pm_encoding_iso_8859_5_table[256] = {
3148
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3149
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3150
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3151
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3152
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3153
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3154
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3155
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3156
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3157
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3158
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3159
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, // Ax
3160
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Bx
3161
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3162
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Dx
3163
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3164
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, // Fx
3165
};
3166
3167
/**
3168
 * Each element of the following table contains a bitfield that indicates a
3169
 * piece of information about the corresponding ISO-8859-6 character.
3170
 */
3171
static const uint8_t pm_encoding_iso_8859_6_table[256] = {
3172
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3173
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3174
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3175
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3176
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3177
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3178
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3179
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3180
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3181
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3182
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3183
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3184
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3185
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
3186
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // Dx
3187
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3188
    3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3189
};
3190
3191
/**
3192
 * Each element of the following table contains a bitfield that indicates a
3193
 * piece of information about the corresponding ISO-8859-7 character.
3194
 */
3195
static const uint8_t pm_encoding_iso_8859_7_table[256] = {
3196
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3197
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3198
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3199
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3200
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3201
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3202
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3203
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3204
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3205
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3206
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3207
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3208
    0, 0, 0, 0, 0, 0, 7, 0, 7, 7, 7, 0, 7, 0, 7, 7, // Bx
3209
    3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3210
    7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, // Dx
3211
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3212
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3213
};
3214
3215
/**
3216
 * Each element of the following table contains a bitfield that indicates a
3217
 * piece of information about the corresponding ISO-8859-8 character.
3218
 */
3219
static const uint8_t pm_encoding_iso_8859_8_table[256] = {
3220
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3221
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3222
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3223
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3224
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3225
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3226
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3227
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3228
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3229
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3230
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3231
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3232
    0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3233
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3234
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3235
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3236
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // Fx
3237
};
3238
3239
/**
3240
 * Each element of the following table contains a bitfield that indicates a
3241
 * piece of information about the corresponding ISO-8859-9 character.
3242
 */
3243
static const uint8_t pm_encoding_iso_8859_9_table[256] = {
3244
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3245
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3246
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3247
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3248
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3249
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3250
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3251
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3252
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3253
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3254
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3255
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Ax
3256
    0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Bx
3257
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3258
    7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3259
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3260
    3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3261
};
3262
3263
/**
3264
 * Each element of the following table contains a bitfield that indicates a
3265
 * piece of information about the corresponding ISO-8859-10 character.
3266
 */
3267
static const uint8_t pm_encoding_iso_8859_10_table[256] = {
3268
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3269
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3270
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3271
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3272
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3273
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3274
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3275
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3276
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3277
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3278
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3279
    0, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 0, 7, 7, // Ax
3280
    0, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 0, 3, 3, // Bx
3281
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3282
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3283
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3284
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3285
};
3286
3287
/**
3288
 * Each element of the following table contains a bitfield that indicates a
3289
 * piece of information about the corresponding ISO-8859-11 character.
3290
 */
3291
static const uint8_t pm_encoding_iso_8859_11_table[256] = {
3292
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3293
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3294
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3295
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3296
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3297
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3298
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3299
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3300
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3301
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3302
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3303
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ax
3304
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Bx
3305
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
3306
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, // Dx
3307
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3308
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, // Fx
3309
};
3310
3311
/**
3312
 * Each element of the following table contains a bitfield that indicates a
3313
 * piece of information about the corresponding ISO-8859-13 character.
3314
 */
3315
static const uint8_t pm_encoding_iso_8859_13_table[256] = {
3316
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3317
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3318
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3319
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3320
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3321
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3322
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3323
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3324
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3325
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3326
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3327
    0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 7, // Ax
3328
    0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 3, 0, 0, 0, 0, 3, // Bx
3329
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3330
    7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3331
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3332
    3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3333
};
3334
3335
/**
3336
 * Each element of the following table contains a bitfield that indicates a
3337
 * piece of information about the corresponding ISO-8859-14 character.
3338
 */
3339
static const uint8_t pm_encoding_iso_8859_14_table[256] = {
3340
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3341
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3342
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3343
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3344
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3345
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3346
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3347
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3348
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3349
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3350
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3351
    0, 7, 3, 0, 7, 3, 7, 0, 7, 0, 7, 3, 7, 0, 0, 7, // Ax
3352
    7, 3, 7, 3, 7, 3, 0, 7, 3, 3, 3, 7, 3, 7, 3, 3, // Bx
3353
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3354
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3355
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3356
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3357
};
3358
3359
/**
3360
 * Each element of the following table contains a bitfield that indicates a
3361
 * piece of information about the corresponding ISO-8859-15 character.
3362
 */
3363
static const uint8_t pm_encoding_iso_8859_15_table[256] = {
3364
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3365
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3366
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3367
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3368
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3369
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3370
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3371
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3372
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3373
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3374
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3375
    0, 0, 0, 0, 0, 0, 7, 0, 3, 0, 3, 0, 0, 0, 0, 0, // Ax
3376
    0, 0, 0, 0, 7, 3, 0, 0, 3, 0, 3, 0, 7, 3, 7, 0, // Bx
3377
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3378
    7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3379
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3380
    3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3381
};
3382
3383
/**
3384
 * Each element of the following table contains a bitfield that indicates a
3385
 * piece of information about the corresponding ISO-8859-16 character.
3386
 */
3387
static const uint8_t pm_encoding_iso_8859_16_table[256] = {
3388
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3389
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3390
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3391
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3392
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3393
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3394
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3395
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3396
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3397
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3398
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3399
    0, 7, 3, 7, 0, 0, 7, 0, 3, 0, 7, 0, 7, 0, 3, 7, // Ax
3400
    0, 0, 7, 3, 7, 0, 0, 0, 3, 3, 3, 0, 7, 3, 7, 3, // Bx
3401
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3402
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3403
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3404
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3405
};
3406
3407
/**
3408
 * Each element of the following table contains a bitfield that indicates a
3409
 * piece of information about the corresponding KOI8-R character.
3410
 */
3411
static const uint8_t pm_encoding_koi8_r_table[256] = {
3412
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3413
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3414
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3415
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3416
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3417
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3418
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3419
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3420
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3421
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3422
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3423
    0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3424
    0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3425
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
3426
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Dx
3427
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Ex
3428
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Fx
3429
};
3430
3431
/**
3432
 * Each element of the following table contains a bitfield that indicates a
3433
 * piece of information about the corresponding KOI8-U character.
3434
 */
3435
static const uint8_t pm_encoding_koi8_u_table[256] = {
3436
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3437
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3438
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3439
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3440
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3441
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3442
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3443
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3444
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3445
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3446
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3447
    0, 0, 0, 3, 3, 0, 3, 3, 0, 0, 0, 0, 0, 3, 0, 0, // Ax
3448
    0, 0, 0, 7, 7, 0, 7, 7, 0, 0, 0, 0, 0, 7, 0, 0, // Bx
3449
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
3450
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Dx
3451
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Ex
3452
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Fx
3453
};
3454
3455
/**
3456
 * Each element of the following table contains a bitfield that indicates a
3457
 * piece of information about the corresponding macCentEuro character.
3458
 */
3459
static const uint8_t pm_encoding_mac_cent_euro_table[256] = {
3460
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3461
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3462
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3463
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3464
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3465
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3466
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3467
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3468
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3469
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3470
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3471
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3472
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3473
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3474
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3475
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3476
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3477
};
3478
3479
/**
3480
 * Each element of the following table contains a bitfield that indicates a
3481
 * piece of information about the corresponding macCroatian character.
3482
 */
3483
static const uint8_t pm_encoding_mac_croatian_table[256] = {
3484
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3485
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3486
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3487
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3488
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3489
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3490
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3491
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3492
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3493
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3494
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3495
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3496
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3497
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3498
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3499
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3500
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3501
};
3502
3503
 /**
3504
 * Each element of the following table contains a bitfield that indicates a
3505
 * piece of information about the corresponding macCyrillic character.
3506
 */
3507
static const uint8_t pm_encoding_mac_cyrillic_table[256] = {
3508
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3509
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3510
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3511
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3512
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3513
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3514
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3515
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3516
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3517
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3518
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3519
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3520
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3521
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3522
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3523
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3524
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3525
};
3526
3527
/**
3528
 * Each element of the following table contains a bitfield that indicates a
3529
 * piece of information about the corresponding macGreek character.
3530
 */
3531
static const uint8_t pm_encoding_mac_greek_table[256] = {
3532
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3533
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3534
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3535
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3536
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3537
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3538
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3539
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3540
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3541
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3542
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3543
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3544
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3545
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3546
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3547
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3548
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3549
};
3550
3551
/**
3552
 * Each element of the following table contains a bitfield that indicates a
3553
 * piece of information about the corresponding macIceland character.
3554
 */
3555
static const uint8_t pm_encoding_mac_iceland_table[256] = {
3556
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3557
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3558
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3559
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3560
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3561
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3562
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3563
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3564
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3565
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3566
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3567
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3568
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3569
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3570
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3571
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3572
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3573
};
3574
3575
/**
3576
 * Each element of the following table contains a bitfield that indicates a
3577
 * piece of information about the corresponding macRoman character.
3578
 */
3579
static const uint8_t pm_encoding_mac_roman_table[256] = {
3580
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3581
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3582
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3583
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3584
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3585
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3586
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3587
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3588
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3589
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3590
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3591
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3592
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3593
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3594
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3595
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3596
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3597
};
3598
3599
/**
3600
 * Each element of the following table contains a bitfield that indicates a
3601
 * piece of information about the corresponding macRomania character.
3602
 */
3603
static const uint8_t pm_encoding_mac_romania_table[256] = {
3604
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3605
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3606
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3607
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3608
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3609
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3610
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3611
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3612
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3613
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3614
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3615
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3616
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3617
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3618
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3619
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3620
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3621
};
3622
3623
/**
3624
 * Each element of the following table contains a bitfield that indicates a
3625
 * piece of information about the corresponding macThai character.
3626
 */
3627
static const uint8_t pm_encoding_mac_thai_table[256] = {
3628
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3629
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3630
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3631
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3632
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3633
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3634
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3635
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3636
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3637
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3638
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3639
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3640
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3641
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3642
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3643
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3644
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3645
};
3646
3647
/**
3648
 * Each element of the following table contains a bitfield that indicates a
3649
 * piece of information about the corresponding TIS-620 character.
3650
 */
3651
static const uint8_t pm_encoding_tis_620_table[256] = {
3652
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3653
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3654
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3655
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3656
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3657
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3658
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3659
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3660
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3661
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3662
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3663
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ax
3664
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Bx
3665
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
3666
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, // Dx
3667
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3668
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, // Fx
3669
};
3670
3671
/**
3672
 * Each element of the following table contains a bitfield that indicates a
3673
 * piece of information about the corresponding macTurkish character.
3674
 */
3675
static const uint8_t pm_encoding_mac_turkish_table[256] = {
3676
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3677
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3678
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3679
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3680
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3681
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3682
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3683
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3684
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3685
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3686
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3687
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3688
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3689
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3690
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3691
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3692
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3693
};
3694
3695
/**
3696
 * Each element of the following table contains a bitfield that indicates a
3697
 * piece of information about the corresponding macUkraine character.
3698
 */
3699
static const uint8_t pm_encoding_mac_ukraine_table[256] = {
3700
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3701
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3702
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3703
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3704
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3705
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3706
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3707
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3708
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3709
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3710
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3711
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3712
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3713
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3714
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3715
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3716
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3717
};
3718
3719
/**
3720
 * Each element of the following table contains a bitfield that indicates a
3721
 * piece of information about the corresponding windows-1250 character.
3722
 */
3723
static const uint8_t pm_encoding_windows_1250_table[256] = {
3724
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3725
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3726
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3727
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3728
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3729
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3730
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3731
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3732
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3733
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 7, 7, 7, // 8x
3734
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3, 3, 3, 3, // 9x
3735
    0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, // Ax
3736
    0, 0, 0, 3, 0, 3, 0, 0, 0, 3, 3, 0, 7, 0, 3, 3, // Bx
3737
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3738
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3739
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3740
    3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3741
};
3742
3743
/**
3744
 * Each element of the following table contains a bitfield that indicates a
3745
 * piece of information about the corresponding windows-1251 character.
3746
 */
3747
static const uint8_t pm_encoding_windows_1251_table[256] = {
3748
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3749
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3750
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3751
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3752
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3753
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3754
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3755
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3756
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3757
    7, 7, 0, 3, 0, 0, 0, 0, 0, 0, 7, 0, 7, 7, 7, 7, // 8x
3758
    3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3, 3, 3, 3, // 9x
3759
    0, 7, 3, 7, 0, 7, 0, 0, 7, 0, 7, 0, 0, 0, 0, 7, // Ax
3760
    0, 0, 7, 3, 3, 3, 0, 0, 3, 0, 3, 0, 3, 7, 3, 3, // Bx
3761
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3762
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Dx
3763
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3764
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3765
};
3766
3767
/**
3768
 * Each element of the following table contains a bitfield that indicates a
3769
 * piece of information about the corresponding windows-1252 character.
3770
 */
3771
static const uint8_t pm_encoding_windows_1252_table[256] = {
3772
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3773
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3774
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3775
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3776
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3777
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3778
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3779
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3780
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3781
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 0, 7, 0, // 8x
3782
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3, 0, 3, 7, // 9x
3783
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Ax
3784
    0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Bx
3785
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3786
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3787
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3788
    3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3789
};
3790
3791
/**
3792
 * Each element of the following table contains a bitfield that indicates a
3793
 * piece of information about the corresponding windows-1253 character.
3794
 */
3795
static const uint8_t pm_encoding_windows_1253_table[256] = {
3796
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3797
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3798
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3799
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3800
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3801
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3802
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3803
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3804
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3805
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3806
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3807
    0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3808
    0, 0, 0, 0, 0, 3, 7, 0, 7, 7, 7, 0, 7, 0, 7, 7, // Bx
3809
    3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3810
    7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, // Dx
3811
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3812
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3813
};
3814
3815
/**
3816
 * Each element of the following table contains a bitfield that indicates a
3817
 * piece of information about the corresponding windows-1254 character.
3818
 */
3819
static const uint8_t pm_encoding_windows_1254_table[256] = {
3820
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3821
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3822
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3823
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3824
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3825
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3826
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3827
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3828
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3829
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, // 8x
3830
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3, 0, 0, 7, // 9x
3831
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Ax
3832
    0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Bx
3833
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3834
    7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3835
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3836
    3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3837
};
3838
3839
/**
3840
 * Each element of the following table contains a bitfield that indicates a
3841
 * piece of information about the corresponding windows-1255 character.
3842
 */
3843
static const uint8_t pm_encoding_windows_1255_table[256] = {
3844
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3845
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3846
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3847
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3848
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3849
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3850
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3851
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3852
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3853
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3854
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3855
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3856
    0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3857
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3858
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3859
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3860
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // Fx
3861
};
3862
3863
/**
3864
 * Each element of the following table contains a bitfield that indicates a
3865
 * piece of information about the corresponding windows-1256 character.
3866
 */
3867
static const uint8_t pm_encoding_windows_1256_table[256] = {
3868
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3869
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3870
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3871
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3872
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3873
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3874
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3875
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3876
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3877
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3878
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3879
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3880
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3881
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
3882
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // Dx
3883
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3884
    3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3885
};
3886
3887
/**
3888
 * Each element of the following table contains a bitfield that indicates a
3889
 * piece of information about the corresponding windows-1257 character.
3890
 */
3891
static const uint8_t pm_encoding_windows_1257_table[256] = {
3892
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3893
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3894
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3895
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3896
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3897
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3898
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3899
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3900
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3901
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3902
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3903
    0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 7, // Ax
3904
    0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 3, 0, 0, 0, 0, 3, // Bx
3905
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3906
    7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3907
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3908
    3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3909
};
3910
3911
/**
3912
 * Each element of the following table contains a bitfield that indicates a
3913
 * piece of information about the corresponding windows-1258 character.
3914
 */
3915
static const uint8_t pm_encoding_windows_1258_table[256] = {
3916
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3917
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3918
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3919
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3920
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3921
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3922
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3923
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3924
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3925
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3926
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3927
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3928
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3929
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3930
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3931
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3932
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3933
};
3934
3935
/**
3936
 * Each element of the following table contains a bitfield that indicates a
3937
 * piece of information about the corresponding windows-874 character.
3938
 */
3939
static const uint8_t pm_encoding_windows_874_table[256] = {
3940
//  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
3941
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3942
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3943
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3944
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3945
    0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3946
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3947
    0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3948
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3949
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3950
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3951
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3952
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3953
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3954
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3955
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3956
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3957
};
3958
3959
#define PRISM_ENCODING_TABLE(name) \
3960
    static size_t pm_encoding_ ##name ## _alpha_char(const uint8_t *b, ptrdiff_t n) {           \
3961
        return ((n > 0) && (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_ALPHABETIC_BIT));           \
3962
    }                                                                                                         \
3963
    static size_t pm_encoding_ ##name ## _alnum_char(const uint8_t *b, ptrdiff_t n) {           \
3964
        return ((n > 0) && (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_ALPHANUMERIC_BIT)) ? 1 : 0; \
3965
    }                                                                                                         \
3966
    static bool pm_encoding_ ##name ## _isupper_char(const uint8_t *b, ptrdiff_t n) {           \
3967
        return ((n > 0) && (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_UPPERCASE_BIT));            \
3968
    }
3969
3970
PRISM_ENCODING_TABLE(cp850)
3971
PRISM_ENCODING_TABLE(cp852)
3972
PRISM_ENCODING_TABLE(cp855)
3973
PRISM_ENCODING_TABLE(gb1988)
3974
PRISM_ENCODING_TABLE(ibm437)
3975
PRISM_ENCODING_TABLE(ibm720)
3976
PRISM_ENCODING_TABLE(ibm737)
3977
PRISM_ENCODING_TABLE(ibm775)
3978
PRISM_ENCODING_TABLE(ibm852)
3979
PRISM_ENCODING_TABLE(ibm855)
3980
PRISM_ENCODING_TABLE(ibm857)
3981
PRISM_ENCODING_TABLE(ibm860)
3982
PRISM_ENCODING_TABLE(ibm861)
3983
PRISM_ENCODING_TABLE(ibm862)
3984
PRISM_ENCODING_TABLE(ibm863)
3985
PRISM_ENCODING_TABLE(ibm864)
3986
PRISM_ENCODING_TABLE(ibm865)
3987
PRISM_ENCODING_TABLE(ibm866)
3988
PRISM_ENCODING_TABLE(ibm869)
3989
PRISM_ENCODING_TABLE(iso_8859_1)
3990
PRISM_ENCODING_TABLE(iso_8859_2)
3991
PRISM_ENCODING_TABLE(iso_8859_3)
3992
PRISM_ENCODING_TABLE(iso_8859_4)
3993
PRISM_ENCODING_TABLE(iso_8859_5)
3994
PRISM_ENCODING_TABLE(iso_8859_6)
3995
PRISM_ENCODING_TABLE(iso_8859_7)
3996
PRISM_ENCODING_TABLE(iso_8859_8)
3997
PRISM_ENCODING_TABLE(iso_8859_9)
3998
PRISM_ENCODING_TABLE(iso_8859_10)
3999
PRISM_ENCODING_TABLE(iso_8859_11)
4000
PRISM_ENCODING_TABLE(iso_8859_13)
4001
PRISM_ENCODING_TABLE(iso_8859_14)
4002
PRISM_ENCODING_TABLE(iso_8859_15)
4003
PRISM_ENCODING_TABLE(iso_8859_16)
4004
PRISM_ENCODING_TABLE(koi8_r)
4005
PRISM_ENCODING_TABLE(koi8_u)
4006
PRISM_ENCODING_TABLE(mac_cent_euro)
4007
PRISM_ENCODING_TABLE(mac_croatian)
4008
PRISM_ENCODING_TABLE(mac_cyrillic)
4009
PRISM_ENCODING_TABLE(mac_greek)
4010
PRISM_ENCODING_TABLE(mac_iceland)
4011
PRISM_ENCODING_TABLE(mac_roman)
4012
PRISM_ENCODING_TABLE(mac_romania)
4013
PRISM_ENCODING_TABLE(mac_thai)
4014
PRISM_ENCODING_TABLE(mac_turkish)
4015
PRISM_ENCODING_TABLE(mac_ukraine)
4016
PRISM_ENCODING_TABLE(tis_620)
4017
PRISM_ENCODING_TABLE(windows_1250)
4018
PRISM_ENCODING_TABLE(windows_1251)
4019
PRISM_ENCODING_TABLE(windows_1252)
4020
PRISM_ENCODING_TABLE(windows_1253)
4021
PRISM_ENCODING_TABLE(windows_1254)
4022
PRISM_ENCODING_TABLE(windows_1255)
4023
PRISM_ENCODING_TABLE(windows_1256)
4024
PRISM_ENCODING_TABLE(windows_1257)
4025
PRISM_ENCODING_TABLE(windows_1258)
4026
PRISM_ENCODING_TABLE(windows_874)
4027
4028
#undef PRISM_ENCODING_TABLE
4029
#endif
4030
4031
/**
4032
 * Returns the size of the next character in the ASCII encoding. This basically
4033
 * means that if the top bit is not set, the character is 1 byte long.
4034
 */
4035
static size_t
4036
0
pm_encoding_ascii_char_width(const uint8_t *b, ptrdiff_t n) {
4037
0
    return ((n > 0) && (*b < 0x80)) ? 1 : 0;
4038
0
}
4039
4040
/**
4041
 * Return the size of the next character in the ASCII encoding if it is an
4042
 * alphabetical character.
4043
 */
4044
static size_t
4045
2.45k
pm_encoding_ascii_alpha_char(const uint8_t *b, ptrdiff_t n) {
4046
2.45k
    return (n > 0) ? (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT) : 0;
4047
2.45k
}
4048
4049
/**
4050
 * Certain encodings are equivalent to ASCII below 0x80, so it works for our
4051
 * purposes to have a function here that first checks the bounds and then falls
4052
 * back to checking the ASCII lookup table.
4053
 */
4054
static size_t
4055
0
pm_encoding_ascii_alpha_char_7bit(const uint8_t *b, ptrdiff_t n) {
4056
0
    return ((n > 0) && (*b < 0x80)) ? pm_encoding_ascii_alpha_char(b, n) : 0;
4057
0
}
4058
4059
/**
4060
 * Return the size of the next character in the ASCII encoding if it is an
4061
 * alphanumeric character.
4062
 */
4063
static size_t
4064
14.1k
pm_encoding_ascii_alnum_char(const uint8_t *b, ptrdiff_t n) {
4065
14.1k
    return ((n > 0) && (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHANUMERIC_BIT)) ? 1 : 0;
4066
14.1k
}
4067
4068
/**
4069
 * Certain encodings are equivalent to ASCII below 0x80, so it works for our
4070
 * purposes to have a function here that first checks the bounds and then falls
4071
 * back to checking the ASCII lookup table.
4072
 */
4073
static size_t
4074
0
pm_encoding_ascii_alnum_char_7bit(const uint8_t *b, ptrdiff_t n) {
4075
0
    return ((n > 0) && (*b < 0x80)) ? pm_encoding_ascii_alnum_char(b, n) : 0;
4076
0
}
4077
4078
/**
4079
 * Return true if the next character in the ASCII encoding if it is an uppercase
4080
 * character.
4081
 */
4082
static bool
4083
1.58k
pm_encoding_ascii_isupper_char(const uint8_t *b, ptrdiff_t n) {
4084
1.58k
    return (n > 0) && (pm_encoding_ascii_table[*b] & PRISM_ENCODING_UPPERCASE_BIT);
4085
1.58k
}
4086
4087
/**
4088
 * For a lot of encodings the default is that they are a single byte long no
4089
 * matter what the codepoint, so this function is shared between them.
4090
 */
4091
static size_t
4092
0
pm_encoding_single_char_width(PRISM_ATTRIBUTE_UNUSED const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
4093
0
    return 1;
4094
0
}
4095
4096
/**
4097
 * Returns the size of the next character in the EUC-JP encoding, or 0 if a
4098
 * character cannot be decoded from the given bytes.
4099
 */
4100
static size_t
4101
0
pm_encoding_euc_jp_char_width(const uint8_t *b, ptrdiff_t n) {
4102
    // These are the single byte characters.
4103
0
    if ((n > 0) && (*b < 0x80)) {
4104
0
        return 1;
4105
0
    }
4106
4107
    // These are the double byte characters.
4108
0
    if ((n > 1) && ((b[0] == 0x8E) || (b[0] >= 0xA1 && b[0] <= 0xFE)) && (b[1] >= 0xA1 && b[1] <= 0xFE)) {
4109
0
        return 2;
4110
0
    }
4111
4112
    // These are the triple byte characters.
4113
0
    if ((n > 2) && (b[0] == 0x8F) && (b[1] >= 0xA1 && b[2] <= 0xFE) && (b[2] >= 0xA1 && b[2] <= 0xFE)) {
4114
0
        return 3;
4115
0
    }
4116
4117
0
    return 0;
4118
0
}
4119
4120
/**
4121
 * Returns the size of the next character in the EUC-JP encoding if it is an
4122
 * uppercase character.
4123
 */
4124
static bool
4125
0
pm_encoding_euc_jp_isupper_char(const uint8_t *b, ptrdiff_t n) {
4126
0
    size_t width = pm_encoding_euc_jp_char_width(b, n);
4127
4128
0
    if (width == 1) {
4129
0
        return pm_encoding_ascii_isupper_char(b, n);
4130
0
    } else if (width == 2) {
4131
0
        return (
4132
0
            (b[0] == 0xA3 && b[1] >= 0xC1 && b[1] <= 0xDA) ||
4133
0
            (b[0] == 0xA6 && b[1] >= 0xA1 && b[1] <= 0xB8) ||
4134
0
            (b[0] == 0xA7 && b[1] >= 0xA1 && b[1] <= 0xC1)
4135
0
        );
4136
0
    } else {
4137
0
        return false;
4138
0
    }
4139
0
}
4140
4141
/**
4142
 * Returns the size of the next character in the Shift_JIS encoding, or 0 if a
4143
 * character cannot be decoded from the given bytes.
4144
 */
4145
static size_t
4146
18.1k
pm_encoding_shift_jis_char_width(const uint8_t *b, ptrdiff_t n) {
4147
18.1k
    if (n == 0) {
4148
0
        return 0;
4149
0
    }
4150
    // These are the single byte characters.
4151
18.1k
    if (b[0] < 0x80 || (b[0] >= 0xA1 && b[0] <= 0xDF)) {
4152
18.1k
        return 1;
4153
18.1k
    }
4154
4155
    // These are the double byte characters.
4156
0
    if ((n > 1) && ((b[0] >= 0x81 && b[0] <= 0x9F) || (b[0] >= 0xE0 && b[0] <= 0xFC)) && (b[1] >= 0x40 && b[1] <= 0xFC && b[1] != 0x7F)) {
4157
0
        return 2;
4158
0
    }
4159
4160
0
    return 0;
4161
0
}
4162
4163
/**
4164
 * Returns the size of the next character in the Shift_JIS encoding if it is an
4165
 * alphanumeric character.
4166
 */
4167
static size_t
4168
14.1k
pm_encoding_shift_jis_alnum_char(const uint8_t *b, ptrdiff_t n) {
4169
14.1k
    size_t width = pm_encoding_shift_jis_char_width(b, n);
4170
14.1k
    return width == 1 ? ((b[0] >= 0x80) || pm_encoding_ascii_alnum_char(b, n)) : width;
4171
14.1k
}
4172
4173
/**
4174
 * Returns the size of the next character in the Shift_JIS encoding if it is an
4175
 * alphabetical character.
4176
 */
4177
static size_t
4178
2.45k
pm_encoding_shift_jis_alpha_char(const uint8_t *b, ptrdiff_t n) {
4179
2.45k
    size_t width = pm_encoding_shift_jis_char_width(b, n);
4180
2.45k
    return width == 1 ? ((b[0] >= 0x80) || pm_encoding_ascii_alpha_char(b, n)) : width;
4181
2.45k
}
4182
4183
/**
4184
 * Returns the size of the next character in the Shift_JIS encoding if it is an
4185
 * uppercase character.
4186
 */
4187
static bool
4188
1.58k
pm_encoding_shift_jis_isupper_char(const uint8_t *b, ptrdiff_t n) {
4189
1.58k
    size_t width = pm_encoding_shift_jis_char_width(b, n);
4190
4191
1.58k
    if (width == 1) {
4192
1.58k
        return pm_encoding_ascii_isupper_char(b, n);
4193
1.58k
    } else if (width == 2) {
4194
0
        return (
4195
0
            ((b[0] == 0x82) && (b[1] >= 0x60 && b[1] <= 0x79)) ||
4196
0
            ((b[0] == 0x83) && (b[1] >= 0x9F && b[1] <= 0xB6)) ||
4197
0
            ((b[0] == 0x84) && (b[1] >= 0x40 && b[1] <= 0x60))
4198
0
        );
4199
0
    } else {
4200
0
        return width;
4201
0
    }
4202
1.58k
}
4203
4204
#ifndef PRISM_ENCODING_EXCLUDE_FULL
4205
4206
/**
4207
 * Certain encodings are equivalent to ASCII below 0x80, so it works for our
4208
 * purposes to have a function here that first checks the bounds and then falls
4209
 * back to checking the ASCII lookup table.
4210
 */
4211
static bool
4212
pm_encoding_ascii_isupper_char_7bit(const uint8_t *b, ptrdiff_t n) {
4213
    return (n > 0) && (*b < 0x80) && pm_encoding_ascii_isupper_char(b, n);
4214
}
4215
4216
/**
4217
 * Returns the size of the next character in the Big5 encoding, or 0 if a
4218
 * character cannot be decoded from the given bytes.
4219
 */
4220
static size_t
4221
pm_encoding_big5_char_width(const uint8_t *b, ptrdiff_t n) {
4222
    // These are the single byte characters.
4223
    if ((n > 0) && (*b < 0x80)) {
4224
        return 1;
4225
    }
4226
4227
    // These are the double byte characters.
4228
    if ((n > 1) && (b[0] >= 0xA1 && b[0] <= 0xFE) && ((b[1] >= 0x40 && b[1] <= 0x7E) || (b[1] >= 0xA1 && b[1] <= 0xFE))) {
4229
        return 2;
4230
    }
4231
4232
    return 0;
4233
}
4234
4235
/**
4236
 * Returns the size of the next character in the CP949 encoding, or 0 if a
4237
 * character cannot be decoded from the given bytes.
4238
 */
4239
static size_t
4240
pm_encoding_cp949_char_width(const uint8_t *b, ptrdiff_t n) {
4241
    // These are the single byte characters
4242
    if ((n > 0) && (*b <= 0x80)) {
4243
        return 1;
4244
    }
4245
4246
    // These are the double byte characters
4247
    if ((n > 1) && (b[0] >= 0x81 && b[0] <= 0xFE) && ((b[1] >= 0x41 && b[1] <= 0x5A) || (b[1] >= 0x61 && b[1] <= 0x7A) || (b[1] >= 0x81 && b[1] <= 0xFE))) {
4248
        return 2;
4249
    }
4250
4251
    return 0;
4252
}
4253
4254
/**
4255
 * Returns the size of the next character in the Emacs MULE encoding, or 0 if a
4256
 * character cannot be decoded from the given bytes.
4257
 */
4258
static size_t
4259
pm_encoding_emacs_mule_char_width(const uint8_t *b, ptrdiff_t n) {
4260
    // These are the 1 byte characters.
4261
    if ((n > 0) && (*b < 0x80)) {
4262
        return 1;
4263
    }
4264
4265
    // These are the 2 byte characters.
4266
    if ((n > 1) && (b[0] >= 0x81 && b[0] <= 0x8F) && (b[1] >= 0xA0)) {
4267
        return 2;
4268
    }
4269
4270
    // These are the 3 byte characters.
4271
    if (
4272
        (n > 2) &&
4273
        (
4274
            ((b[0] >= 0x90 && b[0] <= 0x99) && (b[1] >= 0xA0)) ||
4275
            ((b[0] == 0x9A || b[0] == 0x9B) && (b[1] >= 0xE0 && b[1] <= 0xEF))
4276
        ) &&
4277
        (b[2] >= 0xA0)
4278
    ) {
4279
        return 3;
4280
    }
4281
4282
    // These are the 4 byte characters.
4283
    if (
4284
        (n > 3) &&
4285
        (
4286
            ((b[0] == 0x9C) && (b[1] >= 0xF0) && (b[1] <= 0xF4)) ||
4287
            ((b[0] == 0x9D) && (b[1] >= 0xF5) && (b[1] <= 0xFE))
4288
        ) &&
4289
        (b[2] >= 0xA0) && (b[3] >= 0xA0)
4290
    ) {
4291
        return 4;
4292
    }
4293
4294
    return 0;
4295
}
4296
4297
/**
4298
 * Returns the size of the next character in the EUC-KR encoding, or 0 if a
4299
 * character cannot be decoded from the given bytes.
4300
 */
4301
static size_t
4302
pm_encoding_euc_kr_char_width(const uint8_t *b, ptrdiff_t n) {
4303
    // These are the single byte characters.
4304
    if ((n > 0) && (*b < 0x80)) {
4305
        return 1;
4306
    }
4307
4308
    // These are the double byte characters.
4309
    if ((n > 1) && (b[0] >= 0xA1 && b[0] <= 0xFE) && (b[1] >= 0xA1 && b[1] <= 0xFE)) {
4310
        return 2;
4311
    }
4312
4313
    return 0;
4314
}
4315
4316
/**
4317
 * Returns the size of the next character in the EUC-TW encoding, or 0 if a
4318
 * character cannot be decoded from the given bytes.
4319
 */
4320
static size_t
4321
pm_encoding_euc_tw_char_width(const uint8_t *b, ptrdiff_t n) {
4322
    // These are the single byte characters.
4323
    if ((n > 0) && (*b < 0x80)) {
4324
        return 1;
4325
    }
4326
4327
    // These are the double byte characters.
4328
    if ((n > 1) && (b[0] >= 0xA1) && (b[0] <= 0xFE) && (b[1] >= 0xA1) && (b[1] <= 0xFE)) {
4329
        return 2;
4330
    }
4331
4332
    // These are the quadruple byte characters.
4333
    if ((n > 3) && (b[0] == 0x8E) && (b[1] >= 0xA1) && (b[1] <= 0xB0) && (b[2] >= 0xA1) && (b[2] <= 0xFE) && (b[3] >= 0xA1) && (b[3] <= 0xFE)) {
4334
        return 4;
4335
    }
4336
4337
    return 0;
4338
}
4339
4340
/**
4341
 * Returns the size of the next character in the GB18030 encoding, or 0 if a
4342
 * character cannot be decoded from the given bytes.
4343
 */
4344
static size_t
4345
pm_encoding_gb18030_char_width(const uint8_t *b, ptrdiff_t n) {
4346
    // These are the 1 byte characters.
4347
    if ((n > 0) && (*b < 0x80)) {
4348
        return 1;
4349
    }
4350
4351
    // These are the 2 byte characters.
4352
    if ((n > 1) && (b[0] >= 0x81 && b[0] <= 0xFE) && (b[1] >= 0x40 && b[1] <= 0xFE && b[1] != 0x7F)) {
4353
        return 2;
4354
    }
4355
4356
    // These are the 4 byte characters.
4357
    if ((n > 3) && ((b[0] >= 0x81 && b[0] <= 0xFE) && (b[1] >= 0x30 && b[1] <= 0x39) && (b[2] >= 0x81 && b[2] <= 0xFE) && (b[3] >= 0x30 && b[3] <= 0x39))) {
4358
        return 4;
4359
    }
4360
4361
    return 0;
4362
}
4363
4364
/**
4365
 * Returns the size of the next character in the GBK encoding, or 0 if a
4366
 * character cannot be decoded from the given bytes.
4367
 */
4368
static size_t
4369
pm_encoding_gbk_char_width(const uint8_t *b, ptrdiff_t n) {
4370
    // These are the single byte characters.
4371
    if ((n > 0) && (*b <= 0x80)) {
4372
        return 1;
4373
    }
4374
4375
    // These are the double byte characters.
4376
    if (
4377
        (n > 1) &&
4378
        (
4379
            ((b[0] >= 0xA1 && b[0] <= 0xA9) && (b[1] >= 0xA1 && b[1] <= 0xFE)) || // GBK/1
4380
            ((b[0] >= 0xB0 && b[0] <= 0xF7) && (b[1] >= 0xA1 && b[1] <= 0xFE)) || // GBK/2
4381
            ((b[0] >= 0x81 && b[0] <= 0xA0) && (b[1] >= 0x40 && b[1] <= 0xFE) && (b[1] != 0x7F)) || // GBK/3
4382
            ((b[0] >= 0xAA && b[0] <= 0xFE) && (b[1] >= 0x40 && b[1] <= 0xA0) && (b[1] != 0x7F)) || // GBK/4
4383
            ((b[0] >= 0xA8 && b[0] <= 0xA9) && (b[1] >= 0x40 && b[1] <= 0xA0) && (b[1] != 0x7F)) || // GBK/5
4384
            ((b[0] >= 0xAA && b[0] <= 0xAF) && (b[1] >= 0xA1 && b[1] <= 0xFE)) || // user-defined 1
4385
            ((b[0] >= 0xF8 && b[0] <= 0xFE) && (b[1] >= 0xA1 && b[1] <= 0xFE)) || // user-defined 2
4386
            ((b[0] >= 0xA1 && b[0] <= 0xA7) && (b[1] >= 0x40 && b[1] <= 0xA0) && (b[1] != 0x7F)) // user-defined 3
4387
        )
4388
    ) {
4389
        return 2;
4390
    }
4391
4392
    return 0;
4393
}
4394
4395
#endif
4396
4397
/**
4398
 * This is the table of all of the encodings that prism supports.
4399
 */
4400
const pm_encoding_t pm_encodings[] = {
4401
    [PM_ENCODING_UTF_8] = {
4402
        .name = "UTF-8",
4403
        .char_width = pm_encoding_utf_8_char_width,
4404
        .alnum_char = pm_encoding_utf_8_alnum_char,
4405
        .alpha_char = pm_encoding_utf_8_alpha_char,
4406
        .isupper_char = pm_encoding_utf_8_isupper_char,
4407
        .multibyte = true
4408
    },
4409
    [PM_ENCODING_US_ASCII] = {
4410
        .name = "US-ASCII",
4411
        .char_width = pm_encoding_ascii_char_width,
4412
        .alnum_char = pm_encoding_ascii_alnum_char,
4413
        .alpha_char = pm_encoding_ascii_alpha_char,
4414
        .isupper_char = pm_encoding_ascii_isupper_char,
4415
        .multibyte = false
4416
    },
4417
    [PM_ENCODING_ASCII_8BIT] = {
4418
        .name = "ASCII-8BIT",
4419
        .char_width = pm_encoding_single_char_width,
4420
        .alnum_char = pm_encoding_ascii_alnum_char,
4421
        .alpha_char = pm_encoding_ascii_alpha_char,
4422
        .isupper_char = pm_encoding_ascii_isupper_char,
4423
        .multibyte = false
4424
    },
4425
    [PM_ENCODING_EUC_JP] = {
4426
        .name = "EUC-JP",
4427
        .char_width = pm_encoding_euc_jp_char_width,
4428
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4429
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4430
        .isupper_char = pm_encoding_euc_jp_isupper_char,
4431
        .multibyte = true
4432
    },
4433
    [PM_ENCODING_WINDOWS_31J] = {
4434
        .name = "Windows-31J",
4435
        .char_width = pm_encoding_shift_jis_char_width,
4436
        .alnum_char = pm_encoding_shift_jis_alnum_char,
4437
        .alpha_char = pm_encoding_shift_jis_alpha_char,
4438
        .isupper_char = pm_encoding_shift_jis_isupper_char,
4439
        .multibyte = true
4440
    },
4441
4442
#ifndef PRISM_ENCODING_EXCLUDE_FULL
4443
    [PM_ENCODING_BIG5] = {
4444
        .name = "Big5",
4445
        .char_width = pm_encoding_big5_char_width,
4446
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4447
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4448
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4449
        .multibyte = true
4450
    },
4451
    [PM_ENCODING_BIG5_HKSCS] = {
4452
        .name = "Big5-HKSCS",
4453
        .char_width = pm_encoding_big5_char_width,
4454
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4455
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4456
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4457
        .multibyte = true
4458
    },
4459
    [PM_ENCODING_BIG5_UAO] = {
4460
        .name = "Big5-UAO",
4461
        .char_width = pm_encoding_big5_char_width,
4462
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4463
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4464
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4465
        .multibyte = true
4466
    },
4467
    [PM_ENCODING_CESU_8] = {
4468
        .name = "CESU-8",
4469
        .char_width = pm_encoding_cesu_8_char_width,
4470
        .alnum_char = pm_encoding_cesu_8_alnum_char,
4471
        .alpha_char = pm_encoding_cesu_8_alpha_char,
4472
        .isupper_char = pm_encoding_cesu_8_isupper_char,
4473
        .multibyte = true
4474
    },
4475
    [PM_ENCODING_CP51932] = {
4476
        .name = "CP51932",
4477
        .char_width = pm_encoding_euc_jp_char_width,
4478
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4479
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4480
        .isupper_char = pm_encoding_euc_jp_isupper_char,
4481
        .multibyte = true
4482
    },
4483
    [PM_ENCODING_CP850] = {
4484
        .name = "CP850",
4485
        .char_width = pm_encoding_single_char_width,
4486
        .alnum_char = pm_encoding_cp850_alnum_char,
4487
        .alpha_char = pm_encoding_cp850_alpha_char,
4488
        .isupper_char = pm_encoding_cp850_isupper_char,
4489
        .multibyte = false
4490
    },
4491
    [PM_ENCODING_CP852] = {
4492
        .name = "CP852",
4493
        .char_width = pm_encoding_single_char_width,
4494
        .alnum_char = pm_encoding_cp852_alnum_char,
4495
        .alpha_char = pm_encoding_cp852_alpha_char,
4496
        .isupper_char = pm_encoding_cp852_isupper_char,
4497
        .multibyte = false
4498
    },
4499
    [PM_ENCODING_CP855] = {
4500
        .name = "CP855",
4501
        .char_width = pm_encoding_single_char_width,
4502
        .alnum_char = pm_encoding_cp855_alnum_char,
4503
        .alpha_char = pm_encoding_cp855_alpha_char,
4504
        .isupper_char = pm_encoding_cp855_isupper_char,
4505
        .multibyte = false
4506
    },
4507
    [PM_ENCODING_CP949] = {
4508
        .name = "CP949",
4509
        .char_width = pm_encoding_cp949_char_width,
4510
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4511
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4512
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4513
        .multibyte = true
4514
    },
4515
    [PM_ENCODING_CP950] = {
4516
        .name = "CP950",
4517
        .char_width = pm_encoding_big5_char_width,
4518
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4519
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4520
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4521
        .multibyte = true
4522
    },
4523
    [PM_ENCODING_CP951] = {
4524
        .name = "CP951",
4525
        .char_width = pm_encoding_big5_char_width,
4526
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4527
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4528
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4529
        .multibyte = true
4530
    },
4531
    [PM_ENCODING_EMACS_MULE] = {
4532
        .name = "Emacs-Mule",
4533
        .char_width = pm_encoding_emacs_mule_char_width,
4534
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4535
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4536
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4537
        .multibyte = true
4538
    },
4539
    [PM_ENCODING_EUC_JP_MS] = {
4540
        .name = "eucJP-ms",
4541
        .char_width = pm_encoding_euc_jp_char_width,
4542
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4543
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4544
        .isupper_char = pm_encoding_euc_jp_isupper_char,
4545
        .multibyte = true
4546
    },
4547
    [PM_ENCODING_EUC_JIS_2004] = {
4548
        .name = "EUC-JIS-2004",
4549
        .char_width = pm_encoding_euc_jp_char_width,
4550
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4551
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4552
        .isupper_char = pm_encoding_euc_jp_isupper_char,
4553
        .multibyte = true
4554
    },
4555
    [PM_ENCODING_EUC_KR] = {
4556
        .name = "EUC-KR",
4557
        .char_width = pm_encoding_euc_kr_char_width,
4558
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4559
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4560
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4561
        .multibyte = true
4562
    },
4563
    [PM_ENCODING_EUC_TW] = {
4564
        .name = "EUC-TW",
4565
        .char_width = pm_encoding_euc_tw_char_width,
4566
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4567
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4568
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4569
        .multibyte = true
4570
    },
4571
    [PM_ENCODING_GB12345] = {
4572
        .name = "GB12345",
4573
        .char_width = pm_encoding_euc_kr_char_width,
4574
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4575
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4576
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4577
        .multibyte = true
4578
    },
4579
    [PM_ENCODING_GB18030] = {
4580
        .name = "GB18030",
4581
        .char_width = pm_encoding_gb18030_char_width,
4582
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4583
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4584
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4585
        .multibyte = true
4586
    },
4587
    [PM_ENCODING_GB1988] = {
4588
        .name = "GB1988",
4589
        .char_width = pm_encoding_single_char_width,
4590
        .alnum_char = pm_encoding_gb1988_alnum_char,
4591
        .alpha_char = pm_encoding_gb1988_alpha_char,
4592
        .isupper_char = pm_encoding_gb1988_isupper_char,
4593
        .multibyte = false
4594
    },
4595
    [PM_ENCODING_GB2312] = {
4596
        .name = "GB2312",
4597
        .char_width = pm_encoding_euc_kr_char_width,
4598
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4599
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4600
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4601
        .multibyte = true
4602
    },
4603
    [PM_ENCODING_GBK] = {
4604
        .name = "GBK",
4605
        .char_width = pm_encoding_gbk_char_width,
4606
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4607
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4608
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4609
        .multibyte = true
4610
    },
4611
    [PM_ENCODING_IBM437] = {
4612
        .name = "IBM437",
4613
        .char_width = pm_encoding_single_char_width,
4614
        .alnum_char = pm_encoding_ibm437_alnum_char,
4615
        .alpha_char = pm_encoding_ibm437_alpha_char,
4616
        .isupper_char = pm_encoding_ibm437_isupper_char,
4617
        .multibyte = false
4618
    },
4619
    [PM_ENCODING_IBM720] = {
4620
        .name = "IBM720",
4621
        .char_width = pm_encoding_single_char_width,
4622
        .alnum_char = pm_encoding_ibm720_alnum_char,
4623
        .alpha_char = pm_encoding_ibm720_alpha_char,
4624
        .isupper_char = pm_encoding_ibm720_isupper_char,
4625
        .multibyte = false
4626
    },
4627
    [PM_ENCODING_IBM737] = {
4628
        .name = "IBM737",
4629
        .char_width = pm_encoding_single_char_width,
4630
        .alnum_char = pm_encoding_ibm737_alnum_char,
4631
        .alpha_char = pm_encoding_ibm737_alpha_char,
4632
        .isupper_char = pm_encoding_ibm737_isupper_char,
4633
        .multibyte = false
4634
    },
4635
    [PM_ENCODING_IBM775] = {
4636
        .name = "IBM775",
4637
        .char_width = pm_encoding_single_char_width,
4638
        .alnum_char = pm_encoding_ibm775_alnum_char,
4639
        .alpha_char = pm_encoding_ibm775_alpha_char,
4640
        .isupper_char = pm_encoding_ibm775_isupper_char,
4641
        .multibyte = false
4642
    },
4643
    [PM_ENCODING_IBM852] = {
4644
        .name = "IBM852",
4645
        .char_width = pm_encoding_single_char_width,
4646
        .alnum_char = pm_encoding_ibm852_alnum_char,
4647
        .alpha_char = pm_encoding_ibm852_alpha_char,
4648
        .isupper_char = pm_encoding_ibm852_isupper_char,
4649
        .multibyte = false
4650
    },
4651
    [PM_ENCODING_IBM855] = {
4652
        .name = "IBM855",
4653
        .char_width = pm_encoding_single_char_width,
4654
        .alnum_char = pm_encoding_ibm855_alnum_char,
4655
        .alpha_char = pm_encoding_ibm855_alpha_char,
4656
        .isupper_char = pm_encoding_ibm855_isupper_char,
4657
        .multibyte = false
4658
    },
4659
    [PM_ENCODING_IBM857] = {
4660
        .name = "IBM857",
4661
        .char_width = pm_encoding_single_char_width,
4662
        .alnum_char = pm_encoding_ibm857_alnum_char,
4663
        .alpha_char = pm_encoding_ibm857_alpha_char,
4664
        .isupper_char = pm_encoding_ibm857_isupper_char,
4665
        .multibyte = false
4666
    },
4667
    [PM_ENCODING_IBM860] = {
4668
        .name = "IBM860",
4669
        .char_width = pm_encoding_single_char_width,
4670
        .alnum_char = pm_encoding_ibm860_alnum_char,
4671
        .alpha_char = pm_encoding_ibm860_alpha_char,
4672
        .isupper_char = pm_encoding_ibm860_isupper_char,
4673
        .multibyte = false
4674
    },
4675
    [PM_ENCODING_IBM861] = {
4676
        .name = "IBM861",
4677
        .char_width = pm_encoding_single_char_width,
4678
        .alnum_char = pm_encoding_ibm861_alnum_char,
4679
        .alpha_char = pm_encoding_ibm861_alpha_char,
4680
        .isupper_char = pm_encoding_ibm861_isupper_char,
4681
        .multibyte = false
4682
    },
4683
    [PM_ENCODING_IBM862] = {
4684
        .name = "IBM862",
4685
        .char_width = pm_encoding_single_char_width,
4686
        .alnum_char = pm_encoding_ibm862_alnum_char,
4687
        .alpha_char = pm_encoding_ibm862_alpha_char,
4688
        .isupper_char = pm_encoding_ibm862_isupper_char,
4689
        .multibyte = false
4690
    },
4691
    [PM_ENCODING_IBM863] = {
4692
        .name = "IBM863",
4693
        .char_width = pm_encoding_single_char_width,
4694
        .alnum_char = pm_encoding_ibm863_alnum_char,
4695
        .alpha_char = pm_encoding_ibm863_alpha_char,
4696
        .isupper_char = pm_encoding_ibm863_isupper_char,
4697
        .multibyte = false
4698
    },
4699
    [PM_ENCODING_IBM864] = {
4700
        .name = "IBM864",
4701
        .char_width = pm_encoding_single_char_width,
4702
        .alnum_char = pm_encoding_ibm864_alnum_char,
4703
        .alpha_char = pm_encoding_ibm864_alpha_char,
4704
        .isupper_char = pm_encoding_ibm864_isupper_char,
4705
        .multibyte = false
4706
    },
4707
    [PM_ENCODING_IBM865] = {
4708
        .name = "IBM865",
4709
        .char_width = pm_encoding_single_char_width,
4710
        .alnum_char = pm_encoding_ibm865_alnum_char,
4711
        .alpha_char = pm_encoding_ibm865_alpha_char,
4712
        .isupper_char = pm_encoding_ibm865_isupper_char,
4713
        .multibyte = false
4714
    },
4715
    [PM_ENCODING_IBM866] = {
4716
        .name = "IBM866",
4717
        .char_width = pm_encoding_single_char_width,
4718
        .alnum_char = pm_encoding_ibm866_alnum_char,
4719
        .alpha_char = pm_encoding_ibm866_alpha_char,
4720
        .isupper_char = pm_encoding_ibm866_isupper_char,
4721
        .multibyte = false
4722
    },
4723
    [PM_ENCODING_IBM869] = {
4724
        .name = "IBM869",
4725
        .char_width = pm_encoding_single_char_width,
4726
        .alnum_char = pm_encoding_ibm869_alnum_char,
4727
        .alpha_char = pm_encoding_ibm869_alpha_char,
4728
        .isupper_char = pm_encoding_ibm869_isupper_char,
4729
        .multibyte = false
4730
    },
4731
    [PM_ENCODING_ISO_8859_1] = {
4732
        .name = "ISO-8859-1",
4733
        .char_width = pm_encoding_single_char_width,
4734
        .alnum_char = pm_encoding_iso_8859_1_alnum_char,
4735
        .alpha_char = pm_encoding_iso_8859_1_alpha_char,
4736
        .isupper_char = pm_encoding_iso_8859_1_isupper_char,
4737
        .multibyte = false
4738
    },
4739
    [PM_ENCODING_ISO_8859_2] = {
4740
        .name = "ISO-8859-2",
4741
        .char_width = pm_encoding_single_char_width,
4742
        .alnum_char = pm_encoding_iso_8859_2_alnum_char,
4743
        .alpha_char = pm_encoding_iso_8859_2_alpha_char,
4744
        .isupper_char = pm_encoding_iso_8859_2_isupper_char,
4745
        .multibyte = false
4746
    },
4747
    [PM_ENCODING_ISO_8859_3] = {
4748
        .name = "ISO-8859-3",
4749
        .char_width = pm_encoding_single_char_width,
4750
        .alnum_char = pm_encoding_iso_8859_3_alnum_char,
4751
        .alpha_char = pm_encoding_iso_8859_3_alpha_char,
4752
        .isupper_char = pm_encoding_iso_8859_3_isupper_char,
4753
        .multibyte = false
4754
    },
4755
    [PM_ENCODING_ISO_8859_4] = {
4756
        .name = "ISO-8859-4",
4757
        .char_width = pm_encoding_single_char_width,
4758
        .alnum_char = pm_encoding_iso_8859_4_alnum_char,
4759
        .alpha_char = pm_encoding_iso_8859_4_alpha_char,
4760
        .isupper_char = pm_encoding_iso_8859_4_isupper_char,
4761
        .multibyte = false
4762
    },
4763
    [PM_ENCODING_ISO_8859_5] = {
4764
        .name = "ISO-8859-5",
4765
        .char_width = pm_encoding_single_char_width,
4766
        .alnum_char = pm_encoding_iso_8859_5_alnum_char,
4767
        .alpha_char = pm_encoding_iso_8859_5_alpha_char,
4768
        .isupper_char = pm_encoding_iso_8859_5_isupper_char,
4769
        .multibyte = false
4770
    },
4771
    [PM_ENCODING_ISO_8859_6] = {
4772
        .name = "ISO-8859-6",
4773
        .char_width = pm_encoding_single_char_width,
4774
        .alnum_char = pm_encoding_iso_8859_6_alnum_char,
4775
        .alpha_char = pm_encoding_iso_8859_6_alpha_char,
4776
        .isupper_char = pm_encoding_iso_8859_6_isupper_char,
4777
        .multibyte = false
4778
    },
4779
    [PM_ENCODING_ISO_8859_7] = {
4780
        .name = "ISO-8859-7",
4781
        .char_width = pm_encoding_single_char_width,
4782
        .alnum_char = pm_encoding_iso_8859_7_alnum_char,
4783
        .alpha_char = pm_encoding_iso_8859_7_alpha_char,
4784
        .isupper_char = pm_encoding_iso_8859_7_isupper_char,
4785
        .multibyte = false
4786
    },
4787
    [PM_ENCODING_ISO_8859_8] = {
4788
        .name = "ISO-8859-8",
4789
        .char_width = pm_encoding_single_char_width,
4790
        .alnum_char = pm_encoding_iso_8859_8_alnum_char,
4791
        .alpha_char = pm_encoding_iso_8859_8_alpha_char,
4792
        .isupper_char = pm_encoding_iso_8859_8_isupper_char,
4793
        .multibyte = false
4794
    },
4795
    [PM_ENCODING_ISO_8859_9] = {
4796
        .name = "ISO-8859-9",
4797
        .char_width = pm_encoding_single_char_width,
4798
        .alnum_char = pm_encoding_iso_8859_9_alnum_char,
4799
        .alpha_char = pm_encoding_iso_8859_9_alpha_char,
4800
        .isupper_char = pm_encoding_iso_8859_9_isupper_char,
4801
        .multibyte = false
4802
    },
4803
    [PM_ENCODING_ISO_8859_10] = {
4804
        .name = "ISO-8859-10",
4805
        .char_width = pm_encoding_single_char_width,
4806
        .alnum_char = pm_encoding_iso_8859_10_alnum_char,
4807
        .alpha_char = pm_encoding_iso_8859_10_alpha_char,
4808
        .isupper_char = pm_encoding_iso_8859_10_isupper_char,
4809
        .multibyte = false
4810
    },
4811
    [PM_ENCODING_ISO_8859_11] = {
4812
        .name = "ISO-8859-11",
4813
        .char_width = pm_encoding_single_char_width,
4814
        .alnum_char = pm_encoding_iso_8859_11_alnum_char,
4815
        .alpha_char = pm_encoding_iso_8859_11_alpha_char,
4816
        .isupper_char = pm_encoding_iso_8859_11_isupper_char,
4817
        .multibyte = false
4818
    },
4819
    [PM_ENCODING_ISO_8859_13] = {
4820
        .name = "ISO-8859-13",
4821
        .char_width = pm_encoding_single_char_width,
4822
        .alnum_char = pm_encoding_iso_8859_13_alnum_char,
4823
        .alpha_char = pm_encoding_iso_8859_13_alpha_char,
4824
        .isupper_char = pm_encoding_iso_8859_13_isupper_char,
4825
        .multibyte = false
4826
    },
4827
    [PM_ENCODING_ISO_8859_14] = {
4828
        .name = "ISO-8859-14",
4829
        .char_width = pm_encoding_single_char_width,
4830
        .alnum_char = pm_encoding_iso_8859_14_alnum_char,
4831
        .alpha_char = pm_encoding_iso_8859_14_alpha_char,
4832
        .isupper_char = pm_encoding_iso_8859_14_isupper_char,
4833
        .multibyte = false
4834
    },
4835
    [PM_ENCODING_ISO_8859_15] = {
4836
        .name = "ISO-8859-15",
4837
        .char_width = pm_encoding_single_char_width,
4838
        .alnum_char = pm_encoding_iso_8859_15_alnum_char,
4839
        .alpha_char = pm_encoding_iso_8859_15_alpha_char,
4840
        .isupper_char = pm_encoding_iso_8859_15_isupper_char,
4841
        .multibyte = false
4842
    },
4843
    [PM_ENCODING_ISO_8859_16] = {
4844
        .name = "ISO-8859-16",
4845
        .char_width = pm_encoding_single_char_width,
4846
        .alnum_char = pm_encoding_iso_8859_16_alnum_char,
4847
        .alpha_char = pm_encoding_iso_8859_16_alpha_char,
4848
        .isupper_char = pm_encoding_iso_8859_16_isupper_char,
4849
        .multibyte = false
4850
    },
4851
    [PM_ENCODING_KOI8_R] = {
4852
        .name = "KOI8-R",
4853
        .char_width = pm_encoding_single_char_width,
4854
        .alnum_char = pm_encoding_koi8_r_alnum_char,
4855
        .alpha_char = pm_encoding_koi8_r_alpha_char,
4856
        .isupper_char = pm_encoding_koi8_r_isupper_char,
4857
        .multibyte = false
4858
    },
4859
    [PM_ENCODING_KOI8_U] = {
4860
        .name = "KOI8-U",
4861
        .char_width = pm_encoding_single_char_width,
4862
        .alnum_char = pm_encoding_koi8_u_alnum_char,
4863
        .alpha_char = pm_encoding_koi8_u_alpha_char,
4864
        .isupper_char = pm_encoding_koi8_u_isupper_char,
4865
        .multibyte = false
4866
    },
4867
    [PM_ENCODING_MAC_CENT_EURO] = {
4868
        .name = "macCentEuro",
4869
        .char_width = pm_encoding_single_char_width,
4870
        .alnum_char = pm_encoding_mac_cent_euro_alnum_char,
4871
        .alpha_char = pm_encoding_mac_cent_euro_alpha_char,
4872
        .isupper_char = pm_encoding_mac_cent_euro_isupper_char,
4873
        .multibyte = false
4874
    },
4875
    [PM_ENCODING_MAC_CROATIAN] = {
4876
        .name = "macCroatian",
4877
        .char_width = pm_encoding_single_char_width,
4878
        .alnum_char = pm_encoding_mac_croatian_alnum_char,
4879
        .alpha_char = pm_encoding_mac_croatian_alpha_char,
4880
        .isupper_char = pm_encoding_mac_croatian_isupper_char,
4881
        .multibyte = false
4882
    },
4883
    [PM_ENCODING_MAC_CYRILLIC] = {
4884
        .name = "macCyrillic",
4885
        .char_width = pm_encoding_single_char_width,
4886
        .alnum_char = pm_encoding_mac_cyrillic_alnum_char,
4887
        .alpha_char = pm_encoding_mac_cyrillic_alpha_char,
4888
        .isupper_char = pm_encoding_mac_cyrillic_isupper_char,
4889
        .multibyte = false
4890
    },
4891
    [PM_ENCODING_MAC_GREEK] = {
4892
        .name = "macGreek",
4893
        .char_width = pm_encoding_single_char_width,
4894
        .alnum_char = pm_encoding_mac_greek_alnum_char,
4895
        .alpha_char = pm_encoding_mac_greek_alpha_char,
4896
        .isupper_char = pm_encoding_mac_greek_isupper_char,
4897
        .multibyte = false
4898
    },
4899
    [PM_ENCODING_MAC_ICELAND] = {
4900
        .name = "macIceland",
4901
        .char_width = pm_encoding_single_char_width,
4902
        .alnum_char = pm_encoding_mac_iceland_alnum_char,
4903
        .alpha_char = pm_encoding_mac_iceland_alpha_char,
4904
        .isupper_char = pm_encoding_mac_iceland_isupper_char,
4905
        .multibyte = false
4906
    },
4907
    [PM_ENCODING_MAC_JAPANESE] = {
4908
        .name = "MacJapanese",
4909
        .char_width = pm_encoding_shift_jis_char_width,
4910
        .alnum_char = pm_encoding_shift_jis_alnum_char,
4911
        .alpha_char = pm_encoding_shift_jis_alpha_char,
4912
        .isupper_char = pm_encoding_shift_jis_isupper_char,
4913
        .multibyte = true
4914
    },
4915
    [PM_ENCODING_MAC_ROMAN] = {
4916
        .name = "macRoman",
4917
        .char_width = pm_encoding_single_char_width,
4918
        .alnum_char = pm_encoding_mac_roman_alnum_char,
4919
        .alpha_char = pm_encoding_mac_roman_alpha_char,
4920
        .isupper_char = pm_encoding_mac_roman_isupper_char,
4921
        .multibyte = false
4922
    },
4923
    [PM_ENCODING_MAC_ROMANIA] = {
4924
        .name = "macRomania",
4925
        .char_width = pm_encoding_single_char_width,
4926
        .alnum_char = pm_encoding_mac_romania_alnum_char,
4927
        .alpha_char = pm_encoding_mac_romania_alpha_char,
4928
        .isupper_char = pm_encoding_mac_romania_isupper_char,
4929
        .multibyte = false
4930
    },
4931
    [PM_ENCODING_MAC_THAI] = {
4932
        .name = "macThai",
4933
        .char_width = pm_encoding_single_char_width,
4934
        .alnum_char = pm_encoding_mac_thai_alnum_char,
4935
        .alpha_char = pm_encoding_mac_thai_alpha_char,
4936
        .isupper_char = pm_encoding_mac_thai_isupper_char,
4937
        .multibyte = false
4938
    },
4939
    [PM_ENCODING_MAC_TURKISH] = {
4940
        .name = "macTurkish",
4941
        .char_width = pm_encoding_single_char_width,
4942
        .alnum_char = pm_encoding_mac_turkish_alnum_char,
4943
        .alpha_char = pm_encoding_mac_turkish_alpha_char,
4944
        .isupper_char = pm_encoding_mac_turkish_isupper_char,
4945
        .multibyte = false
4946
    },
4947
    [PM_ENCODING_MAC_UKRAINE] = {
4948
        .name = "macUkraine",
4949
        .char_width = pm_encoding_single_char_width,
4950
        .alnum_char = pm_encoding_mac_ukraine_alnum_char,
4951
        .alpha_char = pm_encoding_mac_ukraine_alpha_char,
4952
        .isupper_char = pm_encoding_mac_ukraine_isupper_char,
4953
        .multibyte = false
4954
    },
4955
    [PM_ENCODING_SHIFT_JIS] = {
4956
        .name = "Shift_JIS",
4957
        .char_width = pm_encoding_shift_jis_char_width,
4958
        .alnum_char = pm_encoding_shift_jis_alnum_char,
4959
        .alpha_char = pm_encoding_shift_jis_alpha_char,
4960
        .isupper_char = pm_encoding_shift_jis_isupper_char,
4961
        .multibyte = true
4962
    },
4963
    [PM_ENCODING_SJIS_DOCOMO] = {
4964
        .name = "SJIS-DoCoMo",
4965
        .char_width = pm_encoding_shift_jis_char_width,
4966
        .alnum_char = pm_encoding_shift_jis_alnum_char,
4967
        .alpha_char = pm_encoding_shift_jis_alpha_char,
4968
        .isupper_char = pm_encoding_shift_jis_isupper_char,
4969
        .multibyte = true
4970
    },
4971
    [PM_ENCODING_SJIS_KDDI] = {
4972
        .name = "SJIS-KDDI",
4973
        .char_width = pm_encoding_shift_jis_char_width,
4974
        .alnum_char = pm_encoding_shift_jis_alnum_char,
4975
        .alpha_char = pm_encoding_shift_jis_alpha_char,
4976
        .isupper_char = pm_encoding_shift_jis_isupper_char,
4977
        .multibyte = true
4978
    },
4979
    [PM_ENCODING_SJIS_SOFTBANK] = {
4980
        .name = "SJIS-SoftBank",
4981
        .char_width = pm_encoding_shift_jis_char_width,
4982
        .alnum_char = pm_encoding_shift_jis_alnum_char,
4983
        .alpha_char = pm_encoding_shift_jis_alpha_char,
4984
        .isupper_char = pm_encoding_shift_jis_isupper_char,
4985
        .multibyte = true
4986
    },
4987
    [PM_ENCODING_STATELESS_ISO_2022_JP] = {
4988
        .name = "stateless-ISO-2022-JP",
4989
        .char_width = pm_encoding_emacs_mule_char_width,
4990
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4991
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4992
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4993
        .multibyte = true
4994
    },
4995
    [PM_ENCODING_STATELESS_ISO_2022_JP_KDDI] = {
4996
        .name = "stateless-ISO-2022-JP-KDDI",
4997
        .char_width = pm_encoding_emacs_mule_char_width,
4998
        .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4999
        .alpha_char = pm_encoding_ascii_alpha_char_7bit,
5000
        .isupper_char = pm_encoding_ascii_isupper_char_7bit,
5001
        .multibyte = true
5002
    },
5003
    [PM_ENCODING_TIS_620] = {
5004
        .name = "TIS-620",
5005
        .char_width = pm_encoding_single_char_width,
5006
        .alnum_char = pm_encoding_tis_620_alnum_char,
5007
        .alpha_char = pm_encoding_tis_620_alpha_char,
5008
        .isupper_char = pm_encoding_tis_620_isupper_char,
5009
        .multibyte = false
5010
    },
5011
    [PM_ENCODING_UTF8_MAC] = {
5012
        .name = "UTF8-MAC",
5013
        .char_width = pm_encoding_utf_8_char_width,
5014
        .alnum_char = pm_encoding_utf_8_alnum_char,
5015
        .alpha_char = pm_encoding_utf_8_alpha_char,
5016
        .isupper_char = pm_encoding_utf_8_isupper_char,
5017
        .multibyte = true
5018
    },
5019
    [PM_ENCODING_UTF8_DOCOMO] = {
5020
        .name = "UTF8-DoCoMo",
5021
        .char_width = pm_encoding_utf_8_char_width,
5022
        .alnum_char = pm_encoding_utf_8_alnum_char,
5023
        .alpha_char = pm_encoding_utf_8_alpha_char,
5024
        .isupper_char = pm_encoding_utf_8_isupper_char,
5025
        .multibyte = true
5026
    },
5027
    [PM_ENCODING_UTF8_KDDI] = {
5028
        .name = "UTF8-KDDI",
5029
        .char_width = pm_encoding_utf_8_char_width,
5030
        .alnum_char = pm_encoding_utf_8_alnum_char,
5031
        .alpha_char = pm_encoding_utf_8_alpha_char,
5032
        .isupper_char = pm_encoding_utf_8_isupper_char,
5033
        .multibyte = true
5034
    },
5035
    [PM_ENCODING_UTF8_SOFTBANK] = {
5036
        .name = "UTF8-SoftBank",
5037
        .char_width = pm_encoding_utf_8_char_width,
5038
        .alnum_char = pm_encoding_utf_8_alnum_char,
5039
        .alpha_char = pm_encoding_utf_8_alpha_char,
5040
        .isupper_char = pm_encoding_utf_8_isupper_char,
5041
        .multibyte = true
5042
    },
5043
    [PM_ENCODING_WINDOWS_1250] = {
5044
        .name = "Windows-1250",
5045
        .char_width = pm_encoding_single_char_width,
5046
        .alnum_char = pm_encoding_windows_1250_alnum_char,
5047
        .alpha_char = pm_encoding_windows_1250_alpha_char,
5048
        .isupper_char = pm_encoding_windows_1250_isupper_char,
5049
        .multibyte = false
5050
    },
5051
    [PM_ENCODING_WINDOWS_1251] = {
5052
        .name = "Windows-1251",
5053
        .char_width = pm_encoding_single_char_width,
5054
        .alnum_char = pm_encoding_windows_1251_alnum_char,
5055
        .alpha_char = pm_encoding_windows_1251_alpha_char,
5056
        .isupper_char = pm_encoding_windows_1251_isupper_char,
5057
        .multibyte = false
5058
    },
5059
    [PM_ENCODING_WINDOWS_1252] = {
5060
        .name = "Windows-1252",
5061
        .char_width = pm_encoding_single_char_width,
5062
        .alnum_char = pm_encoding_windows_1252_alnum_char,
5063
        .alpha_char = pm_encoding_windows_1252_alpha_char,
5064
        .isupper_char = pm_encoding_windows_1252_isupper_char,
5065
        .multibyte = false
5066
    },
5067
    [PM_ENCODING_WINDOWS_1253] = {
5068
        .name = "Windows-1253",
5069
        .char_width = pm_encoding_single_char_width,
5070
        .alnum_char = pm_encoding_windows_1253_alnum_char,
5071
        .alpha_char = pm_encoding_windows_1253_alpha_char,
5072
        .isupper_char = pm_encoding_windows_1253_isupper_char,
5073
        .multibyte = false
5074
    },
5075
    [PM_ENCODING_WINDOWS_1254] = {
5076
        .name = "Windows-1254",
5077
        .char_width = pm_encoding_single_char_width,
5078
        .alnum_char = pm_encoding_windows_1254_alnum_char,
5079
        .alpha_char = pm_encoding_windows_1254_alpha_char,
5080
        .isupper_char = pm_encoding_windows_1254_isupper_char,
5081
        .multibyte = false
5082
    },
5083
    [PM_ENCODING_WINDOWS_1255] = {
5084
        .name = "Windows-1255",
5085
        .char_width = pm_encoding_single_char_width,
5086
        .alnum_char = pm_encoding_windows_1255_alnum_char,
5087
        .alpha_char = pm_encoding_windows_1255_alpha_char,
5088
        .isupper_char = pm_encoding_windows_1255_isupper_char,
5089
        .multibyte = false
5090
    },
5091
    [PM_ENCODING_WINDOWS_1256] = {
5092
        .name = "Windows-1256",
5093
        .char_width = pm_encoding_single_char_width,
5094
        .alnum_char = pm_encoding_windows_1256_alnum_char,
5095
        .alpha_char = pm_encoding_windows_1256_alpha_char,
5096
        .isupper_char = pm_encoding_windows_1256_isupper_char,
5097
        .multibyte = false
5098
    },
5099
    [PM_ENCODING_WINDOWS_1257] = {
5100
        .name = "Windows-1257",
5101
        .char_width = pm_encoding_single_char_width,
5102
        .alnum_char = pm_encoding_windows_1257_alnum_char,
5103
        .alpha_char = pm_encoding_windows_1257_alpha_char,
5104
        .isupper_char = pm_encoding_windows_1257_isupper_char,
5105
        .multibyte = false
5106
    },
5107
    [PM_ENCODING_WINDOWS_1258] = {
5108
        .name = "Windows-1258",
5109
        .char_width = pm_encoding_single_char_width,
5110
        .alnum_char = pm_encoding_windows_1258_alnum_char,
5111
        .alpha_char = pm_encoding_windows_1258_alpha_char,
5112
        .isupper_char = pm_encoding_windows_1258_isupper_char,
5113
        .multibyte = false
5114
    },
5115
    [PM_ENCODING_WINDOWS_874] = {
5116
        .name = "Windows-874",
5117
        .char_width = pm_encoding_single_char_width,
5118
        .alnum_char = pm_encoding_windows_874_alnum_char,
5119
        .alpha_char = pm_encoding_windows_874_alpha_char,
5120
        .isupper_char = pm_encoding_windows_874_isupper_char,
5121
        .multibyte = false
5122
    }
5123
#endif
5124
};
5125
5126
/**
5127
 * Parse the given name of an encoding and return a pointer to the corresponding
5128
 * encoding struct if one can be found, otherwise return NULL.
5129
 */
5130
const pm_encoding_t *
5131
19.0k
pm_encoding_find(const uint8_t *start, const uint8_t *end) {
5132
19.0k
    size_t width = (size_t) (end - start);
5133
5134
    // First, we're going to check for UTF-8. This is the most common encoding.
5135
    // UTF-8 can contain extra information at the end about the platform it is
5136
    // encoded on, such as UTF-8-MAC or UTF-8-UNIX. We'll ignore those suffixes.
5137
19.0k
    if ((start + 5 <= end) && (pm_strncasecmp(start, (const uint8_t *) "UTF-8", 5) == 0)) {
5138
#ifndef PRISM_ENCODING_EXCLUDE_FULL
5139
        // We need to explicitly handle UTF-8-HFS, as that one needs to switch
5140
        // over to being UTF8-MAC.
5141
        if (width == 9 && (pm_strncasecmp(start + 5, (const uint8_t *) "-HFS", 4) == 0)) {
5142
            return &pm_encodings[PM_ENCODING_UTF8_MAC];
5143
        }
5144
#endif
5145
5146
        // Otherwise we'll return the default UTF-8 encoding.
5147
19.0k
        return PM_ENCODING_UTF_8_ENTRY;
5148
19.0k
    }
5149
5150
    // Next, we're going to loop through each of the encodings that we handle
5151
    // explicitly. If we found one that we understand, we'll use that value.
5152
2
#define ENCODING1(name, encoding) if (width == sizeof(name) - 1 && pm_strncasecmp(start, (const uint8_t *) name, width) == 0) return &pm_encodings[encoding];
5153
2
#define ENCODING2(name1, name2, encoding) ENCODING1(name1, encoding) ENCODING1(name2, encoding)
5154
5155
2
    if (width >= 3) {
5156
2
        switch (*start) {
5157
0
            case 'A': case 'a':
5158
0
                ENCODING1("ASCII", PM_ENCODING_US_ASCII);
5159
0
                ENCODING1("ASCII-8BIT", PM_ENCODING_ASCII_8BIT);
5160
0
                ENCODING1("ANSI_X3.4-1968", PM_ENCODING_US_ASCII);
5161
0
                break;
5162
0
            case 'B': case 'b':
5163
0
                ENCODING1("BINARY", PM_ENCODING_ASCII_8BIT);
5164
#ifndef PRISM_ENCODING_EXCLUDE_FULL
5165
                ENCODING1("Big5", PM_ENCODING_BIG5);
5166
                ENCODING2("Big5-HKSCS", "Big5-HKSCS:2008", PM_ENCODING_BIG5_HKSCS);
5167
                ENCODING1("Big5-UAO", PM_ENCODING_BIG5_UAO);
5168
#endif
5169
0
                break;
5170
0
            case 'C': case 'c':
5171
0
                ENCODING1("CP65001", PM_ENCODING_UTF_8);
5172
0
                ENCODING2("CP932", "csWindows31J", PM_ENCODING_WINDOWS_31J);
5173
#ifndef PRISM_ENCODING_EXCLUDE_FULL
5174
                ENCODING1("CESU-8", PM_ENCODING_CESU_8);
5175
                ENCODING1("CP437", PM_ENCODING_IBM437);
5176
                ENCODING1("CP720", PM_ENCODING_IBM720);
5177
                ENCODING1("CP737", PM_ENCODING_IBM737);
5178
                ENCODING1("CP775", PM_ENCODING_IBM775);
5179
                ENCODING1("CP850", PM_ENCODING_CP850);
5180
                ENCODING1("CP852", PM_ENCODING_CP852);
5181
                ENCODING1("CP855", PM_ENCODING_CP855);
5182
                ENCODING1("CP857", PM_ENCODING_IBM857);
5183
                ENCODING1("CP860", PM_ENCODING_IBM860);
5184
                ENCODING1("CP861", PM_ENCODING_IBM861);
5185
                ENCODING1("CP862", PM_ENCODING_IBM862);
5186
                ENCODING1("CP864", PM_ENCODING_IBM864);
5187
                ENCODING1("CP865", PM_ENCODING_IBM865);
5188
                ENCODING1("CP866", PM_ENCODING_IBM866);
5189
                ENCODING1("CP869", PM_ENCODING_IBM869);
5190
                ENCODING1("CP874", PM_ENCODING_WINDOWS_874);
5191
                ENCODING1("CP878", PM_ENCODING_KOI8_R);
5192
                ENCODING1("CP863", PM_ENCODING_IBM863);
5193
                ENCODING1("CP936", PM_ENCODING_GBK);
5194
                ENCODING1("CP949", PM_ENCODING_CP949);
5195
                ENCODING1("CP950", PM_ENCODING_CP950);
5196
                ENCODING1("CP951", PM_ENCODING_CP951);
5197
                ENCODING1("CP1250", PM_ENCODING_WINDOWS_1250);
5198
                ENCODING1("CP1251", PM_ENCODING_WINDOWS_1251);
5199
                ENCODING1("CP1252", PM_ENCODING_WINDOWS_1252);
5200
                ENCODING1("CP1253", PM_ENCODING_WINDOWS_1253);
5201
                ENCODING1("CP1254", PM_ENCODING_WINDOWS_1254);
5202
                ENCODING1("CP1255", PM_ENCODING_WINDOWS_1255);
5203
                ENCODING1("CP1256", PM_ENCODING_WINDOWS_1256);
5204
                ENCODING1("CP1257", PM_ENCODING_WINDOWS_1257);
5205
                ENCODING1("CP1258", PM_ENCODING_WINDOWS_1258);
5206
                ENCODING1("CP51932", PM_ENCODING_CP51932);
5207
#endif
5208
0
                break;
5209
0
            case 'E': case 'e':
5210
0
                ENCODING2("EUC-JP", "eucJP", PM_ENCODING_EUC_JP);
5211
#ifndef PRISM_ENCODING_EXCLUDE_FULL
5212
                ENCODING2("eucJP-ms", "euc-jp-ms", PM_ENCODING_EUC_JP_MS);
5213
                ENCODING2("EUC-JIS-2004", "EUC-JISX0213", PM_ENCODING_EUC_JIS_2004);
5214
                ENCODING2("EUC-KR", "eucKR", PM_ENCODING_EUC_KR);
5215
                ENCODING2("EUC-CN", "eucCN", PM_ENCODING_GB2312);
5216
                ENCODING2("EUC-TW", "eucTW", PM_ENCODING_EUC_TW);
5217
                ENCODING1("Emacs-Mule", PM_ENCODING_EMACS_MULE);
5218
#endif
5219
0
                break;
5220
0
            case 'G': case 'g':
5221
#ifndef PRISM_ENCODING_EXCLUDE_FULL
5222
                ENCODING1("GBK", PM_ENCODING_GBK);
5223
                ENCODING1("GB12345", PM_ENCODING_GB12345);
5224
                ENCODING1("GB18030", PM_ENCODING_GB18030);
5225
                ENCODING1("GB1988", PM_ENCODING_GB1988);
5226
                ENCODING1("GB2312", PM_ENCODING_GB2312);
5227
#endif
5228
0
                break;
5229
0
            case 'I': case 'i':
5230
#ifndef PRISM_ENCODING_EXCLUDE_FULL
5231
                ENCODING1("IBM437", PM_ENCODING_IBM437);
5232
                ENCODING1("IBM720", PM_ENCODING_IBM720);
5233
                ENCODING1("IBM737", PM_ENCODING_IBM737);
5234
                ENCODING1("IBM775", PM_ENCODING_IBM775);
5235
                ENCODING1("IBM850", PM_ENCODING_CP850);
5236
                ENCODING1("IBM852", PM_ENCODING_IBM852);
5237
                ENCODING1("IBM855", PM_ENCODING_IBM855);
5238
                ENCODING1("IBM857", PM_ENCODING_IBM857);
5239
                ENCODING1("IBM860", PM_ENCODING_IBM860);
5240
                ENCODING1("IBM861", PM_ENCODING_IBM861);
5241
                ENCODING1("IBM862", PM_ENCODING_IBM862);
5242
                ENCODING1("IBM863", PM_ENCODING_IBM863);
5243
                ENCODING1("IBM864", PM_ENCODING_IBM864);
5244
                ENCODING1("IBM865", PM_ENCODING_IBM865);
5245
                ENCODING1("IBM866", PM_ENCODING_IBM866);
5246
                ENCODING1("IBM869", PM_ENCODING_IBM869);
5247
                ENCODING2("ISO-8859-1", "ISO8859-1", PM_ENCODING_ISO_8859_1);
5248
                ENCODING2("ISO-8859-2", "ISO8859-2", PM_ENCODING_ISO_8859_2);
5249
                ENCODING2("ISO-8859-3", "ISO8859-3", PM_ENCODING_ISO_8859_3);
5250
                ENCODING2("ISO-8859-4", "ISO8859-4", PM_ENCODING_ISO_8859_4);
5251
                ENCODING2("ISO-8859-5", "ISO8859-5", PM_ENCODING_ISO_8859_5);
5252
                ENCODING2("ISO-8859-6", "ISO8859-6", PM_ENCODING_ISO_8859_6);
5253
                ENCODING2("ISO-8859-7", "ISO8859-7", PM_ENCODING_ISO_8859_7);
5254
                ENCODING2("ISO-8859-8", "ISO8859-8", PM_ENCODING_ISO_8859_8);
5255
                ENCODING2("ISO-8859-9", "ISO8859-9", PM_ENCODING_ISO_8859_9);
5256
                ENCODING2("ISO-8859-10", "ISO8859-10", PM_ENCODING_ISO_8859_10);
5257
                ENCODING2("ISO-8859-11", "ISO8859-11", PM_ENCODING_ISO_8859_11);
5258
                ENCODING2("ISO-8859-13", "ISO8859-13", PM_ENCODING_ISO_8859_13);
5259
                ENCODING2("ISO-8859-14", "ISO8859-14", PM_ENCODING_ISO_8859_14);
5260
                ENCODING2("ISO-8859-15", "ISO8859-15", PM_ENCODING_ISO_8859_15);
5261
                ENCODING2("ISO-8859-16", "ISO8859-16", PM_ENCODING_ISO_8859_16);
5262
#endif
5263
0
                break;
5264
0
            case 'K': case 'k':
5265
#ifndef PRISM_ENCODING_EXCLUDE_FULL
5266
                ENCODING1("KOI8-R", PM_ENCODING_KOI8_R);
5267
                ENCODING1("KOI8-U", PM_ENCODING_KOI8_U);
5268
#endif
5269
0
                break;
5270
0
            case 'M': case 'm':
5271
#ifndef PRISM_ENCODING_EXCLUDE_FULL
5272
                ENCODING1("macCentEuro", PM_ENCODING_MAC_CENT_EURO);
5273
                ENCODING1("macCroatian", PM_ENCODING_MAC_CROATIAN);
5274
                ENCODING1("macCyrillic", PM_ENCODING_MAC_CYRILLIC);
5275
                ENCODING1("macGreek", PM_ENCODING_MAC_GREEK);
5276
                ENCODING1("macIceland", PM_ENCODING_MAC_ICELAND);
5277
                ENCODING1("MacJapanese", PM_ENCODING_MAC_JAPANESE);
5278
                ENCODING1("MacJapan", PM_ENCODING_MAC_JAPANESE);
5279
                ENCODING1("macRoman", PM_ENCODING_MAC_ROMAN);
5280
                ENCODING1("macRomania", PM_ENCODING_MAC_ROMANIA);
5281
                ENCODING1("macThai", PM_ENCODING_MAC_THAI);
5282
                ENCODING1("macTurkish", PM_ENCODING_MAC_TURKISH);
5283
                ENCODING1("macUkraine", PM_ENCODING_MAC_UKRAINE);
5284
#endif
5285
0
                break;
5286
2
            case 'P': case 'p':
5287
2
                ENCODING1("PCK", PM_ENCODING_WINDOWS_31J);
5288
0
                break;
5289
0
            case 'S': case 's':
5290
0
                ENCODING1("SJIS", PM_ENCODING_WINDOWS_31J);
5291
#ifndef PRISM_ENCODING_EXCLUDE_FULL
5292
                ENCODING1("Shift_JIS", PM_ENCODING_SHIFT_JIS);
5293
                ENCODING1("SJIS-DoCoMo", PM_ENCODING_SJIS_DOCOMO);
5294
                ENCODING1("SJIS-KDDI", PM_ENCODING_SJIS_KDDI);
5295
                ENCODING1("SJIS-SoftBank", PM_ENCODING_SJIS_SOFTBANK);
5296
                ENCODING1("stateless-ISO-2022-JP", PM_ENCODING_STATELESS_ISO_2022_JP);
5297
                ENCODING1("stateless-ISO-2022-JP-KDDI", PM_ENCODING_STATELESS_ISO_2022_JP_KDDI);
5298
#endif
5299
0
                break;
5300
0
            case 'T': case 't':
5301
#ifndef PRISM_ENCODING_EXCLUDE_FULL
5302
                ENCODING1("TIS-620", PM_ENCODING_TIS_620);
5303
#endif
5304
0
                break;
5305
0
            case 'U': case 'u':
5306
0
                ENCODING1("US-ASCII", PM_ENCODING_US_ASCII);
5307
#ifndef PRISM_ENCODING_EXCLUDE_FULL
5308
                ENCODING2("UTF8-MAC", "UTF-8-HFS", PM_ENCODING_UTF8_MAC);
5309
                ENCODING1("UTF8-DoCoMo", PM_ENCODING_UTF8_DOCOMO);
5310
                ENCODING1("UTF8-KDDI", PM_ENCODING_UTF8_KDDI);
5311
                ENCODING1("UTF8-SoftBank", PM_ENCODING_UTF8_SOFTBANK);
5312
#endif
5313
0
                break;
5314
0
            case 'W': case 'w':
5315
0
                ENCODING1("Windows-31J", PM_ENCODING_WINDOWS_31J);
5316
#ifndef PRISM_ENCODING_EXCLUDE_FULL
5317
                ENCODING1("Windows-874", PM_ENCODING_WINDOWS_874);
5318
                ENCODING1("Windows-1250", PM_ENCODING_WINDOWS_1250);
5319
                ENCODING1("Windows-1251", PM_ENCODING_WINDOWS_1251);
5320
                ENCODING1("Windows-1252", PM_ENCODING_WINDOWS_1252);
5321
                ENCODING1("Windows-1253", PM_ENCODING_WINDOWS_1253);
5322
                ENCODING1("Windows-1254", PM_ENCODING_WINDOWS_1254);
5323
                ENCODING1("Windows-1255", PM_ENCODING_WINDOWS_1255);
5324
                ENCODING1("Windows-1256", PM_ENCODING_WINDOWS_1256);
5325
                ENCODING1("Windows-1257", PM_ENCODING_WINDOWS_1257);
5326
                ENCODING1("Windows-1258", PM_ENCODING_WINDOWS_1258);
5327
#endif
5328
0
                break;
5329
0
            case '6':
5330
0
                ENCODING1("646", PM_ENCODING_US_ASCII);
5331
0
                break;
5332
2
        }
5333
2
    }
5334
5335
0
#undef ENCODING2
5336
0
#undef ENCODING1
5337
5338
    // If we didn't match any encodings, return NULL.
5339
0
    return NULL;
5340
2
}