Coverage Report

Created: 2026-03-31 07:30

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