aboutsummaryrefslogtreecommitdiffstats
path: root/prism
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2023-11-30 11:36:10 -0500
committerKevin Newton <kddnewton@gmail.com>2023-11-30 21:37:56 -0500
commitabb1fe286804a35fc4cbcc431434f9e5b42c544f (patch)
tree97c66ca49519b1abda45d1755dd6c399d5f7c5e9 /prism
parent19a321bff0b12516f6fff644c3642627a6fcebae (diff)
downloadruby-abb1fe286804a35fc4cbcc431434f9e5b42c544f.tar.gz
[PRISM] Consolidate prism encoding files
Diffstat (limited to 'prism')
-rw-r--r--prism/encoding.c (renamed from prism/enc/pm_tables.c)3230
-rw-r--r--prism/encoding.h (renamed from prism/enc/pm_encoding.h)2
-rw-r--r--prism/parser.h2
-rw-r--r--prism/regexp.h2
-rw-r--r--prism/util/pm_memchr.h2
5 files changed, 3121 insertions, 117 deletions
diff --git a/prism/enc/pm_tables.c b/prism/encoding.c
index 6eede35e32..1acebeda15 100644
--- a/prism/enc/pm_tables.c
+++ b/prism/encoding.c
@@ -1,10 +1,2452 @@
-#include "prism/enc/pm_encoding.h"
+#include "prism/encoding.h"
+
+typedef uint32_t pm_unicode_codepoint_t;
+
+#define UNICODE_ALPHA_CODEPOINTS_LENGTH 1450
+static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEPOINTS_LENGTH] = {
+ 0x100, 0x2C1,
+ 0x2C6, 0x2D1,
+ 0x2E0, 0x2E4,
+ 0x2EC, 0x2EC,
+ 0x2EE, 0x2EE,
+ 0x345, 0x345,
+ 0x370, 0x374,
+ 0x376, 0x377,
+ 0x37A, 0x37D,
+ 0x37F, 0x37F,
+ 0x386, 0x386,
+ 0x388, 0x38A,
+ 0x38C, 0x38C,
+ 0x38E, 0x3A1,
+ 0x3A3, 0x3F5,
+ 0x3F7, 0x481,
+ 0x48A, 0x52F,
+ 0x531, 0x556,
+ 0x559, 0x559,
+ 0x560, 0x588,
+ 0x5B0, 0x5BD,
+ 0x5BF, 0x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xFB1D, 0xFB28,
+ 0xFB2A, 0xFB36,
+ 0xFB38, 0xFB3C,
+ 0xFB3E, 0xFB3E,
+ 0xFB40, 0xFB41,
+ 0xFB43, 0xFB44,
+ 0xFB46, 0xFBB1,
+ 0xFBD3, 0xFD3D,
+ 0xFD50, 0xFD8F,
+ 0xFD92, 0xFDC7,
+ 0xFDF0, 0xFDFB,
+ 0xFE70, 0xFE74,
+ 0xFE76, 0xFEFC,
+ 0xFF21, 0xFF3A,
+ 0xFF41, 0xFF5A,
+ 0xFF66, 0xFFBE,
+ 0xFFC2, 0xFFC7,
+ 0xFFCA, 0xFFCF,
+ 0xFFD2, 0xFFD7,
+ 0xFFDA, 0xFFDC,
+ 0x10000, 0x1000B,
+ 0x1000D, 0x10026,
+ 0x10028, 0x1003A,
+ 0x1003C, 0x1003D,
+ 0x1003F, 0x1004D,
+ 0x10050, 0x1005D,
+ 0x10080, 0x100FA,
+ 0x10140, 0x10174,
+ 0x10280, 0x1029C,
+ 0x102A0, 0x102D0,
+ 0x10300, 0x1031F,
+ 0x1032D, 0x1034A,
+ 0x10350, 0x1037A,
+ 0x10380, 0x1039D,
+ 0x103A0, 0x103C3,
+ 0x103C8, 0x103CF,
+ 0x103D1, 0x103D5,
+ 0x10400, 0x1049D,
+ 0x104B0, 0x104D3,
+ 0x104D8, 0x104FB,
+ 0x10500, 0x10527,
+ 0x10530, 0x10563,
+ 0x10570, 0x1057A,
+ 0x1057C, 0x1058A,
+ 0x1058C, 0x10592,
+ 0x10594, 0x10595,
+ 0x10597, 0x105A1,
+ 0x105A3, 0x105B1,
+ 0x105B3, 0x105B9,
+ 0x105BB, 0x105BC,
+ 0x10600, 0x10736,
+ 0x10740, 0x10755,
+ 0x10760, 0x10767,
+ 0x10780, 0x10785,
+ 0x10787, 0x107B0,
+ 0x107B2, 0x107BA,
+ 0x10800, 0x10805,
+ 0x10808, 0x10808,
+ 0x1080A, 0x10835,
+ 0x10837, 0x10838,
+ 0x1083C, 0x1083C,
+ 0x1083F, 0x10855,
+ 0x10860, 0x10876,
+ 0x10880, 0x1089E,
+ 0x108E0, 0x108F2,
+ 0x108F4, 0x108F5,
+ 0x10900, 0x10915,
+ 0x10920, 0x10939,
+ 0x10980, 0x109B7,
+ 0x109BE, 0x109BF,
+ 0x10A00, 0x10A03,
+ 0x10A05, 0x10A06,
+ 0x10A0C, 0x10A13,
+ 0x10A15, 0x10A17,
+ 0x10A19, 0x10A35,
+ 0x10A60, 0x10A7C,
+ 0x10A80, 0x10A9C,
+ 0x10AC0, 0x10AC7,
+ 0x10AC9, 0x10AE4,
+ 0x10B00, 0x10B35,
+ 0x10B40, 0x10B55,
+ 0x10B60, 0x10B72,
+ 0x10B80, 0x10B91,
+ 0x10C00, 0x10C48,
+ 0x10C80, 0x10CB2,
+ 0x10CC0, 0x10CF2,
+ 0x10D00, 0x10D27,
+ 0x10E80, 0x10EA9,
+ 0x10EAB, 0x10EAC,
+ 0x10EB0, 0x10EB1,
+ 0x10F00, 0x10F1C,
+ 0x10F27, 0x10F27,
+ 0x10F30, 0x10F45,
+ 0x10F70, 0x10F81,
+ 0x10FB0, 0x10FC4,
+ 0x10FE0, 0x10FF6,
+ 0x11000, 0x11045,
+ 0x11071, 0x11075,
+ 0x11080, 0x110B8,
+ 0x110C2, 0x110C2,
+ 0x110D0, 0x110E8,
+ 0x11100, 0x11132,
+ 0x11144, 0x11147,
+ 0x11150, 0x11172,
+ 0x11176, 0x11176,
+ 0x11180, 0x111BF,
+ 0x111C1, 0x111C4,
+ 0x111CE, 0x111CF,
+ 0x111DA, 0x111DA,
+ 0x111DC, 0x111DC,
+ 0x11200, 0x11211,
+ 0x11213, 0x11234,
+ 0x11237, 0x11237,
+ 0x1123E, 0x11241,
+ 0x11280, 0x11286,
+ 0x11288, 0x11288,
+ 0x1128A, 0x1128D,
+ 0x1128F, 0x1129D,
+ 0x1129F, 0x112A8,
+ 0x112B0, 0x112E8,
+ 0x11300, 0x11303,
+ 0x11305, 0x1130C,
+ 0x1130F, 0x11310,
+ 0x11313, 0x11328,
+ 0x1132A, 0x11330,
+ 0x11332, 0x11333,
+ 0x11335, 0x11339,
+ 0x1133D, 0x11344,
+ 0x11347, 0x11348,
+ 0x1134B, 0x1134C,
+ 0x11350, 0x11350,
+ 0x11357, 0x11357,
+ 0x1135D, 0x11363,
+ 0x11400, 0x11441,
+ 0x11443, 0x11445,
+ 0x11447, 0x1144A,
+ 0x1145F, 0x11461,
+ 0x11480, 0x114C1,
+ 0x114C4, 0x114C5,
+ 0x114C7, 0x114C7,
+ 0x11580, 0x115B5,
+ 0x115B8, 0x115BE,
+ 0x115D8, 0x115DD,
+ 0x11600, 0x1163E,
+ 0x11640, 0x11640,
+ 0x11644, 0x11644,
+ 0x11680, 0x116B5,
+ 0x116B8, 0x116B8,
+ 0x11700, 0x1171A,
+ 0x1171D, 0x1172A,
+ 0x11740, 0x11746,
+ 0x11800, 0x11838,
+ 0x118A0, 0x118DF,
+ 0x118FF, 0x11906,
+ 0x11909, 0x11909,
+ 0x1190C, 0x11913,
+ 0x11915, 0x11916,
+ 0x11918, 0x11935,
+ 0x11937, 0x11938,
+ 0x1193B, 0x1193C,
+ 0x1193F, 0x11942,
+ 0x119A0, 0x119A7,
+ 0x119AA, 0x119D7,
+ 0x119DA, 0x119DF,
+ 0x119E1, 0x119E1,
+ 0x119E3, 0x119E4,
+ 0x11A00, 0x11A32,
+ 0x11A35, 0x11A3E,
+ 0x11A50, 0x11A97,
+ 0x11A9D, 0x11A9D,
+ 0x11AB0, 0x11AF8,
+ 0x11C00, 0x11C08,
+ 0x11C0A, 0x11C36,
+ 0x11C38, 0x11C3E,
+ 0x11C40, 0x11C40,
+ 0x11C72, 0x11C8F,
+ 0x11C92, 0x11CA7,
+ 0x11CA9, 0x11CB6,
+ 0x11D00, 0x11D06,
+ 0x11D08, 0x11D09,
+ 0x11D0B, 0x11D36,
+ 0x11D3A, 0x11D3A,
+ 0x11D3C, 0x11D3D,
+ 0x11D3F, 0x11D41,
+ 0x11D43, 0x11D43,
+ 0x11D46, 0x11D47,
+ 0x11D60, 0x11D65,
+ 0x11D67, 0x11D68,
+ 0x11D6A, 0x11D8E,
+ 0x11D90, 0x11D91,
+ 0x11D93, 0x11D96,
+ 0x11D98, 0x11D98,
+ 0x11EE0, 0x11EF6,
+ 0x11F00, 0x11F10,
+ 0x11F12, 0x11F3A,
+ 0x11F3E, 0x11F40,
+ 0x11FB0, 0x11FB0,
+ 0x12000, 0x12399,
+ 0x12400, 0x1246E,
+ 0x12480, 0x12543,
+ 0x12F90, 0x12FF0,
+ 0x13000, 0x1342F,
+ 0x13441, 0x13446,
+ 0x14400, 0x14646,
+ 0x16800, 0x16A38,
+ 0x16A40, 0x16A5E,
+ 0x16A70, 0x16ABE,
+ 0x16AD0, 0x16AED,
+ 0x16B00, 0x16B2F,
+ 0x16B40, 0x16B43,
+ 0x16B63, 0x16B77,
+ 0x16B7D, 0x16B8F,
+ 0x16E40, 0x16E7F,
+ 0x16F00, 0x16F4A,
+ 0x16F4F, 0x16F87,
+ 0x16F8F, 0x16F9F,
+ 0x16FE0, 0x16FE1,
+ 0x16FE3, 0x16FE3,
+ 0x16FF0, 0x16FF1,
+ 0x17000, 0x187F7,
+ 0x18800, 0x18CD5,
+ 0x18D00, 0x18D08,
+ 0x1AFF0, 0x1AFF3,
+ 0x1AFF5, 0x1AFFB,
+ 0x1AFFD, 0x1AFFE,
+ 0x1B000, 0x1B122,
+ 0x1B132, 0x1B132,
+ 0x1B150, 0x1B152,
+ 0x1B155, 0x1B155,
+ 0x1B164, 0x1B167,
+ 0x1B170, 0x1B2FB,
+ 0x1BC00, 0x1BC6A,
+ 0x1BC70, 0x1BC7C,
+ 0x1BC80, 0x1BC88,
+ 0x1BC90, 0x1BC99,
+ 0x1BC9E, 0x1BC9E,
+ 0x1D400, 0x1D454,
+ 0x1D456, 0x1D49C,
+ 0x1D49E, 0x1D49F,
+ 0x1D4A2, 0x1D4A2,
+ 0x1D4A5, 0x1D4A6,
+ 0x1D4A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10C5,
+ 0x10C7, 0x10C7,
+ 0x10CD, 0x10CD,
+ 0x10D0, 0x10FA,
+ 0x10FC, 0x1248,
+ 0x124A, 0x124D,
+ 0x1250, 0x1256,
+ 0x1258, 0x1258,
+ 0x125A, 0x125D,
+ 0x1260, 0x1288,
+ 0x128A, 0x128D,
+ 0x1290, 0x12B0,
+ 0x12B2, 0x12B5,
+ 0x12B8, 0x12BE,
+ 0x12C0, 0x12C0,
+ 0x12C2, 0x12C5,
+ 0x12C8, 0x12D6,
+ 0x12D8, 0x1310,
+ 0x1312, 0x1315,
+ 0x1318, 0x135A,
+ 0x1380, 0x138F,
+ 0x13A0, 0x13F5,
+ 0x13F8, 0x13FD,
+ 0x1401, 0x166C,
+ 0x166F, 0x167F,
+ 0x1681, 0x169A,
+ 0x16A0, 0x16EA,
+ 0x16EE, 0x16F8,
+ 0x1700, 0x1713,
+ 0x171F, 0x1733,
+ 0x1740, 0x1753,
+ 0x1760, 0x176C,
+ 0x176E, 0x1770,
+ 0x1772, 0x1773,
+ 0x1780, 0x17B3,
+ 0x17B6, 0x17C8,
+ 0x17D7, 0x17D7,
+ 0x17DC, 0x17DC,
+ 0x17E0, 0x17E9,
+ 0x1810, 0x1819,
+ 0x1820, 0x1878,
+ 0x1880, 0x18AA,
+ 0x18B0, 0x18F5,
+ 0x1900, 0x191E,
+ 0x1920, 0x192B,
+ 0x1930, 0x1938,
+ 0x1946, 0x196D,
+ 0x1970, 0x1974,
+ 0x1980, 0x19AB,
+ 0x19B0, 0x19C9,
+ 0x19D0, 0x19D9,
+ 0x1A00, 0x1A1B,
+ 0x1A20, 0x1A5E,
+ 0x1A61, 0x1A74,
+ 0x1A80, 0x1A89,
+ 0x1A90, 0x1A99,
+ 0x1AA7, 0x1AA7,
+ 0x1ABF, 0x1AC0,
+ 0x1ACC, 0x1ACE,
+ 0x1B00, 0x1B33,
+ 0x1B35, 0x1B43,
+ 0x1B45, 0x1B4C,
+ 0x1B50, 0x1B59,
+ 0x1B80, 0x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104A0, 0x104A9,
+ 0x104B0, 0x104D3,
+ 0x104D8, 0x104FB,
+ 0x10500, 0x10527,
+ 0x10530, 0x10563,
+ 0x10570, 0x1057A,
+ 0x1057C, 0x1058A,
+ 0x1058C, 0x10592,
+ 0x10594, 0x10595,
+ 0x10597, 0x105A1,
+ 0x105A3, 0x105B1,
+ 0x105B3, 0x105B9,
+ 0x105BB, 0x105BC,
+ 0x10600, 0x10736,
+ 0x10740, 0x10755,
+ 0x10760, 0x10767,
+ 0x10780, 0x10785,
+ 0x10787, 0x107B0,
+ 0x107B2, 0x107BA,
+ 0x10800, 0x10805,
+ 0x10808, 0x10808,
+ 0x1080A, 0x10835,
+ 0x10837, 0x10838,
+ 0x1083C, 0x1083C,
+ 0x1083F, 0x10855,
+ 0x10860, 0x10876,
+ 0x10880, 0x1089E,
+ 0x108E0, 0x108F2,
+ 0x108F4, 0x108F5,
+ 0x10900, 0x10915,
+ 0x10920, 0x10939,
+ 0x10980, 0x109B7,
+ 0x109BE, 0x109BF,
+ 0x10A00, 0x10A03,
+ 0x10A05, 0x10A06,
+ 0x10A0C, 0x10A13,
+ 0x10A15, 0x10A17,
+ 0x10A19, 0x10A35,
+ 0x10A60, 0x10A7C,
+ 0x10A80, 0x10A9C,
+ 0x10AC0, 0x10AC7,
+ 0x10AC9, 0x10AE4,
+ 0x10B00, 0x10B35,
+ 0x10B40, 0x10B55,
+ 0x10B60, 0x10B72,
+ 0x10B80, 0x10B91,
+ 0x10C00, 0x10C48,
+ 0x10C80, 0x10CB2,
+ 0x10CC0, 0x10CF2,
+ 0x10D00, 0x10D27,
+ 0x10D30, 0x10D39,
+ 0x10E80, 0x10EA9,
+ 0x10EAB, 0x10EAC,
+ 0x10EB0, 0x10EB1,
+ 0x10F00, 0x10F1C,
+ 0x10F27, 0x10F27,
+ 0x10F30, 0x10F45,
+ 0x10F70, 0x10F81,
+ 0x10FB0, 0x10FC4,
+ 0x10FE0, 0x10FF6,
+ 0x11000, 0x11045,
+ 0x11066, 0x1106F,
+ 0x11071, 0x11075,
+ 0x11080, 0x110B8,
+ 0x110C2, 0x110C2,
+ 0x110D0, 0x110E8,
+ 0x110F0, 0x110F9,
+ 0x11100, 0x11132,
+ 0x11136, 0x1113F,
+ 0x11144, 0x11147,
+ 0x11150, 0x11172,
+ 0x11176, 0x11176,
+ 0x11180, 0x111BF,
+ 0x111C1, 0x111C4,
+ 0x111CE, 0x111DA,
+ 0x111DC, 0x111DC,
+ 0x11200, 0x11211,
+ 0x11213, 0x11234,
+ 0x11237, 0x11237,
+ 0x1123E, 0x11241,
+ 0x11280, 0x11286,
+ 0x11288, 0x11288,
+ 0x1128A, 0x1128D,
+ 0x1128F, 0x1129D,
+ 0x1129F, 0x112A8,
+ 0x112B0, 0x112E8,
+ 0x112F0, 0x112F9,
+ 0x11300, 0x11303,
+ 0x11305, 0x1130C,
+ 0x1130F, 0x11310,
+ 0x11313, 0x11328,
+ 0x1132A, 0x11330,
+ 0x11332, 0x11333,
+ 0x11335, 0x11339,
+ 0x1133D, 0x11344,
+ 0x11347, 0x11348,
+ 0x1134B, 0x1134C,
+ 0x11350, 0x11350,
+ 0x11357, 0x11357,
+ 0x1135D, 0x11363,
+ 0x11400, 0x11441,
+ 0x11443, 0x11445,
+ 0x11447, 0x1144A,
+ 0x11450, 0x11459,
+ 0x1145F, 0x11461,
+ 0x11480, 0x114C1,
+ 0x114C4, 0x114C5,
+ 0x114C7, 0x114C7,
+ 0x114D0, 0x114D9,
+ 0x11580, 0x115B5,
+ 0x115B8, 0x115BE,
+ 0x115D8, 0x115DD,
+ 0x11600, 0x1163E,
+ 0x11640, 0x11640,
+ 0x11644, 0x11644,
+ 0x11650, 0x11659,
+ 0x11680, 0x116B5,
+ 0x116B8, 0x116B8,
+ 0x116C0, 0x116C9,
+ 0x11700, 0x1171A,
+ 0x1171D, 0x1172A,
+ 0x11730, 0x11739,
+ 0x11740, 0x11746,
+ 0x11800, 0x11838,
+ 0x118A0, 0x118E9,
+ 0x118FF, 0x11906,
+ 0x11909, 0x11909,
+ 0x1190C, 0x11913,
+ 0x11915, 0x11916,
+ 0x11918, 0x11935,
+ 0x11937, 0x11938,
+ 0x1193B, 0x1193C,
+ 0x1193F, 0x11942,
+ 0x11950, 0x11959,
+ 0x119A0, 0x119A7,
+ 0x119AA, 0x119D7,
+ 0x119DA, 0x119DF,
+ 0x119E1, 0x119E1,
+ 0x119E3, 0x119E4,
+ 0x11A00, 0x11A32,
+ 0x11A35, 0x11A3E,
+ 0x11A50, 0x11A97,
+ 0x11A9D, 0x11A9D,
+ 0x11AB0, 0x11AF8,
+ 0x11C00, 0x11C08,
+ 0x11C0A, 0x11C36,
+ 0x11C38, 0x11C3E,
+ 0x11C40, 0x11C40,
+ 0x11C50, 0x11C59,
+ 0x11C72, 0x11C8F,
+ 0x11C92, 0x11CA7,
+ 0x11CA9, 0x11CB6,
+ 0x11D00, 0x11D06,
+ 0x11D08, 0x11D09,
+ 0x11D0B, 0x11D36,
+ 0x11D3A, 0x11D3A,
+ 0x11D3C, 0x11D3D,
+ 0x11D3F, 0x11D41,
+ 0x11D43, 0x11D43,
+ 0x11D46, 0x11D47,
+ 0x11D50, 0x11D59,
+ 0x11D60, 0x11D65,
+ 0x11D67, 0x11D68,
+ 0x11D6A, 0x11D8E,
+ 0x11D90, 0x11D91,
+ 0x11D93, 0x11D96,
+ 0x11D98, 0x11D98,
+ 0x11DA0, 0x11DA9,
+ 0x11EE0, 0x11EF6,
+ 0x11F00, 0x11F10,
+ 0x11F12, 0x11F3A,
+ 0x11F3E, 0x11F40,
+ 0x11F50, 0x11F59,
+ 0x11FB0, 0x11FB0,
+ 0x12000, 0x12399,
+ 0x12400, 0x1246E,
+ 0x12480, 0x12543,
+ 0x12F90, 0x12FF0,
+ 0x13000, 0x1342F,
+ 0x13441, 0x13446,
+ 0x14400, 0x14646,
+ 0x16800, 0x16A38,
+ 0x16A40, 0x16A5E,
+ 0x16A60, 0x16A69,
+ 0x16A70, 0x16ABE,
+ 0x16AC0, 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, 0x1EE5D,
+ 0x1EE5F, 0x1EE5F,
+ 0x1EE61, 0x1EE62,
+ 0x1EE64, 0x1EE64,
+ 0x1EE67, 0x1EE6A,
+ 0x1EE6C, 0x1EE72,
+ 0x1EE74, 0x1EE77,
+ 0x1EE79, 0x1EE7C,
+ 0x1EE7E, 0x1EE7E,
+ 0x1EE80, 0x1EE89,
+ 0x1EE8B, 0x1EE9B,
+ 0x1EEA1, 0x1EEA3,
+ 0x1EEA5, 0x1EEA9,
+ 0x1EEAB, 0x1EEBB,
+ 0x1F130, 0x1F149,
+ 0x1F150, 0x1F169,
+ 0x1F170, 0x1F189,
+ 0x1FBF0, 0x1FBF9,
+ 0x20000, 0x2A6DF,
+ 0x2A700, 0x2B739,
+ 0x2B740, 0x2B81D,
+ 0x2B820, 0x2CEA1,
+ 0x2CEB0, 0x2EBE0,
+ 0x2F800, 0x2FA1D,
+ 0x30000, 0x3134A,
+ 0x31350, 0x323AF,
+};
+
+#define UNICODE_ISUPPER_CODEPOINTS_LENGTH 1296
+static const pm_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_CODEPOINTS_LENGTH] = {
+ 0x100, 0x100,
+ 0x102, 0x102,
+ 0x104, 0x104,
+ 0x106, 0x106,
+ 0x108, 0x108,
+ 0x10A, 0x10A,
+ 0x10C, 0x10C,
+ 0x10E, 0x10E,
+ 0x110, 0x110,
+ 0x112, 0x112,
+ 0x114, 0x114,
+ 0x116, 0x116,
+ 0x118, 0x118,
+ 0x11A, 0x11A,
+ 0x11C, 0x11C,
+ 0x11E, 0x11E,
+ 0x120, 0x120,
+ 0x122, 0x122,
+ 0x124, 0x124,
+ 0x126, 0x126,
+ 0x128, 0x128,
+ 0x12A, 0x12A,
+ 0x12C, 0x12C,
+ 0x12E, 0x12E,
+ 0x130, 0x130,
+ 0x132, 0x132,
+ 0x134, 0x134,
+ 0x136, 0x136,
+ 0x139, 0x139,
+ 0x13B, 0x13B,
+ 0x13D, 0x13D,
+ 0x13F, 0x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0xA69A, 0xA69A,
+ 0xA722, 0xA722,
+ 0xA724, 0xA724,
+ 0xA726, 0xA726,
+ 0xA728, 0xA728,
+ 0xA72A, 0xA72A,
+ 0xA72C, 0xA72C,
+ 0xA72E, 0xA72E,
+ 0xA732, 0xA732,
+ 0xA734, 0xA734,
+ 0xA736, 0xA736,
+ 0xA738, 0xA738,
+ 0xA73A, 0xA73A,
+ 0xA73C, 0xA73C,
+ 0xA73E, 0xA73E,
+ 0xA740, 0xA740,
+ 0xA742, 0xA742,
+ 0xA744, 0xA744,
+ 0xA746, 0xA746,
+ 0xA748, 0xA748,
+ 0xA74A, 0xA74A,
+ 0xA74C, 0xA74C,
+ 0xA74E, 0xA74E,
+ 0xA750, 0xA750,
+ 0xA752, 0xA752,
+ 0xA754, 0xA754,
+ 0xA756, 0xA756,
+ 0xA758, 0xA758,
+ 0xA75A, 0xA75A,
+ 0xA75C, 0xA75C,
+ 0xA75E, 0xA75E,
+ 0xA760, 0xA760,
+ 0xA762, 0xA762,
+ 0xA764, 0xA764,
+ 0xA766, 0xA766,
+ 0xA768, 0xA768,
+ 0xA76A, 0xA76A,
+ 0xA76C, 0xA76C,
+ 0xA76E, 0xA76E,
+ 0xA779, 0xA779,
+ 0xA77B, 0xA77B,
+ 0xA77D, 0xA77E,
+ 0xA780, 0xA780,
+ 0xA782, 0xA782,
+ 0xA784, 0xA784,
+ 0xA786, 0xA786,
+ 0xA78B, 0xA78B,
+ 0xA78D, 0xA78D,
+ 0xA790, 0xA790,
+ 0xA792, 0xA792,
+ 0xA796, 0xA796,
+ 0xA798, 0xA798,
+ 0xA79A, 0xA79A,
+ 0xA79C, 0xA79C,
+ 0xA79E, 0xA79E,
+ 0xA7A0, 0xA7A0,
+ 0xA7A2, 0xA7A2,
+ 0xA7A4, 0xA7A4,
+ 0xA7A6, 0xA7A6,
+ 0xA7A8, 0xA7A8,
+ 0xA7AA, 0xA7AE,
+ 0xA7B0, 0xA7B4,
+ 0xA7B6, 0xA7B6,
+ 0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,
+ 0x1F170, 0x1F189,
+};
+
+/**
+ * Each element of the following table contains a bitfield that indicates a
+ * piece of information about the corresponding unicode codepoint. Note that
+ * this table is different from other encodings where we used a lookup table
+ * because the indices of those tables are the byte representations, not the
+ * codepoints themselves.
+ */
+const uint8_t pm_encoding_unicode_table[256] = {
+// 0 1 2 3 4 5 6 7 8 9 A B C D E F
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
+ 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
+ 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Ax
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Bx
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
+ 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
+ 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
+};
+
+/**
+ * Binary search through the given list of codepoints to see if the given
+ * codepoint is in the list.
+ */
+static bool
+pm_unicode_codepoint_match(pm_unicode_codepoint_t codepoint, const pm_unicode_codepoint_t *codepoints, size_t size) {
+ size_t start = 0;
+ size_t end = size;
+
+ while (start < end) {
+ size_t middle = start + (end - start) / 2;
+ if ((middle % 2) != 0) middle--;
+
+ if (codepoint >= codepoints[middle] && codepoint <= codepoints[middle + 1]) {
+ return true;
+ }
+
+ if (codepoint < codepoints[middle]) {
+ end = middle;
+ } else {
+ start = middle + 2;
+ }
+ }
+
+ return false;
+}
+
+/**
+ * A state transition table for decoding UTF-8.
+ *
+ * Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+static const uint8_t pm_utf_8_dfa[] = {
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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the number of bytes remaining in the string,
+ * decode the next UTF-8 codepoint and return it. The number of bytes consumed
+ * is returned in the width out parameter.
+ */
+static pm_unicode_codepoint_t
+pm_utf_8_codepoint(const uint8_t *b, ptrdiff_t n, size_t *width) {
+ assert(n >= 1);
+ size_t maximum = (size_t) n;
+
+ uint32_t codepoint;
+ uint32_t state = 0;
+
+ for (size_t index = 0; index < 4 && index < maximum; index++) {
+ uint32_t byte = b[index];
+ uint32_t type = pm_utf_8_dfa[byte];
+
+ codepoint = (state != 0) ?
+ (byte & 0x3fu) | (codepoint << 6) :
+ (0xffu >> type) & (byte);
+
+ state = pm_utf_8_dfa[256 + (state * 16) + type];
+ if (!state) {
+ *width = index + 1;
+ return (pm_unicode_codepoint_t) codepoint;
+ }
+ }
+
+ *width = 0;
+ return 0;
+}
+
+static size_t
+pm_encoding_utf_8_char_width(const uint8_t *b, ptrdiff_t n) {
+ size_t width;
+ pm_utf_8_codepoint(b, n, &width);
+ return width;
+}
+
+/**
+ * Return the size of the next character in the UTF-8 encoding if it is an
+ * alphabetical character.
+ */
+size_t
+pm_encoding_utf_8_alpha_char(const uint8_t *b, ptrdiff_t n) {
+ if (*b < 0x80) {
+ return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT) ? 1 : 0;
+ }
+
+ size_t width;
+ pm_unicode_codepoint_t codepoint = pm_utf_8_codepoint(b, n, &width);
+
+ if (codepoint <= 0xFF) {
+ return (pm_encoding_unicode_table[(uint8_t) codepoint] & PRISM_ENCODING_ALPHABETIC_BIT) ? width : 0;
+ } else {
+ return pm_unicode_codepoint_match(codepoint, unicode_alpha_codepoints, UNICODE_ALPHA_CODEPOINTS_LENGTH) ? width : 0;
+ }
+}
+
+/**
+ * Return the size of the next character in the UTF-8 encoding if it is an
+ * alphanumeric character.
+ */
+size_t
+pm_encoding_utf_8_alnum_char(const uint8_t *b, ptrdiff_t n) {
+ if (*b < 0x80) {
+ return (pm_encoding_unicode_table[*b] & (PRISM_ENCODING_ALPHANUMERIC_BIT)) ? 1 : 0;
+ }
+
+ size_t width;
+ pm_unicode_codepoint_t codepoint = pm_utf_8_codepoint(b, n, &width);
+
+ if (codepoint <= 0xFF) {
+ return (pm_encoding_unicode_table[(uint8_t) codepoint] & (PRISM_ENCODING_ALPHANUMERIC_BIT)) ? width : 0;
+ } else {
+ return pm_unicode_codepoint_match(codepoint, unicode_alnum_codepoints, UNICODE_ALNUM_CODEPOINTS_LENGTH) ? width : 0;
+ }
+}
+
+/**
+ * Return true if the next character in the UTF-8 encoding if it is an uppercase
+ * character.
+ */
+bool
+pm_encoding_utf_8_isupper_char(const uint8_t *b, ptrdiff_t n) {
+ if (*b < 0x80) {
+ return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false;
+ }
+
+ size_t width;
+ pm_unicode_codepoint_t codepoint = pm_utf_8_codepoint(b, n, &width);
+
+ if (codepoint <= 0xFF) {
+ return (pm_encoding_unicode_table[(uint8_t) codepoint] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false;
+ } else {
+ return pm_unicode_codepoint_match(codepoint, unicode_isupper_codepoints, UNICODE_ISUPPER_CODEPOINTS_LENGTH) ? true : false;
+ }
+}
+
+static pm_unicode_codepoint_t
+pm_cesu_8_codepoint(const uint8_t *b, ptrdiff_t n, size_t *width) {
+ if (b[0] < 0x80) {
+ *width = 1;
+ return (pm_unicode_codepoint_t) b[0];
+ }
+
+ if (n > 1 && b[0] >= 0xC2 && b[0] <= 0xDF && b[1] >= 0x80 && b[1] <= 0xBF) {
+ *width = 2;
+
+ // 110xxxxx 10xxxxxx
+ return (pm_unicode_codepoint_t) (((b[0] & 0x1F) << 6) | (b[1] & 0x3F));
+ }
+
+ 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) {
+ *width = 6;
+
+ // 11101101 1010xxxx 10xxxxxx 11101101 1011xxxx 10xxxxxx
+ return (pm_unicode_codepoint_t) (0x10000 + (((b[1] & 0xF) << 16) | ((b[2] & 0x3F) << 10) | ((b[4] & 0xF) << 6) | (b[5] & 0x3F)));
+ }
+
+ if (n > 2 && b[0] == 0xED && b[1] >= 0xA0 && b[1] <= 0xBF) {
+ *width = 3;
+
+ // 11101101 1010xxxx 10xxxxx
+ return (pm_unicode_codepoint_t) (0x10000 + (((b[0] & 0x03) << 16) | ((b[1] & 0x3F) << 10) | (b[2] & 0x3F)));
+ }
+
+ 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) {
+ *width = 3;
+
+ // 1110xxxx 10xxxxxx 10xxxxx
+ return (pm_unicode_codepoint_t) (((b[0] & 0xF) << 12) | ((b[1] & 0x3F) << 6) | (b[2] & 0x3F));
+ }
+
+ *width = 0;
+ return 0;
+}
+
+static size_t
+pm_encoding_cesu_8_char_width(const uint8_t *b, ptrdiff_t n) {
+ size_t width;
+ pm_cesu_8_codepoint(b, n, &width);
+ return width;
+}
+
+static size_t
+pm_encoding_cesu_8_alpha_char(const uint8_t *b, ptrdiff_t n) {
+ if (*b < 0x80) {
+ return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT) ? 1 : 0;
+ }
+
+ size_t width;
+ pm_unicode_codepoint_t codepoint = pm_cesu_8_codepoint(b, n, &width);
+
+ if (codepoint <= 0xFF) {
+ return (pm_encoding_unicode_table[(uint8_t) codepoint] & PRISM_ENCODING_ALPHABETIC_BIT) ? width : 0;
+ } else {
+ return pm_unicode_codepoint_match(codepoint, unicode_alpha_codepoints, UNICODE_ALPHA_CODEPOINTS_LENGTH) ? width : 0;
+ }
+}
+
+static size_t
+pm_encoding_cesu_8_alnum_char(const uint8_t *b, ptrdiff_t n) {
+ if (*b < 0x80) {
+ return (pm_encoding_unicode_table[*b] & (PRISM_ENCODING_ALPHANUMERIC_BIT)) ? 1 : 0;
+ }
+
+ size_t width;
+ pm_unicode_codepoint_t codepoint = pm_cesu_8_codepoint(b, n, &width);
+
+ if (codepoint <= 0xFF) {
+ return (pm_encoding_unicode_table[(uint8_t) codepoint] & (PRISM_ENCODING_ALPHANUMERIC_BIT)) ? width : 0;
+ } else {
+ return pm_unicode_codepoint_match(codepoint, unicode_alnum_codepoints, UNICODE_ALNUM_CODEPOINTS_LENGTH) ? width : 0;
+ }
+}
+
+static bool
+pm_encoding_cesu_8_isupper_char(const uint8_t *b, ptrdiff_t n) {
+ if (*b < 0x80) {
+ return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false;
+ }
+
+ size_t width;
+ pm_unicode_codepoint_t codepoint = pm_cesu_8_codepoint(b, n, &width);
+
+ if (codepoint <= 0xFF) {
+ return (pm_encoding_unicode_table[(uint8_t) codepoint] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false;
+ } else {
+ return pm_unicode_codepoint_match(codepoint, unicode_isupper_codepoints, UNICODE_ISUPPER_CODEPOINTS_LENGTH) ? true : false;
+ }
+}
+
+#undef UNICODE_ALPHA_CODEPOINTS_LENGTH
+#undef UNICODE_ALNUM_CODEPOINTS_LENGTH
+#undef UNICODE_ISUPPER_CODEPOINTS_LENGTH
/**
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ASCII character.
*/
-static uint8_t pm_encoding_ascii_table[256] = {
+static const uint8_t pm_encoding_ascii_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -28,7 +2470,7 @@ static uint8_t pm_encoding_ascii_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding CP850 character.
*/
-static uint8_t pm_encoding_cp850_table[256] = {
+static const uint8_t pm_encoding_cp850_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -52,7 +2494,7 @@ static uint8_t pm_encoding_cp850_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding CP852 character.
*/
-static uint8_t pm_encoding_cp852_table[256] = {
+static const uint8_t pm_encoding_cp852_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -76,7 +2518,7 @@ static uint8_t pm_encoding_cp852_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding CP855 character.
*/
-static uint8_t pm_encoding_cp855_table[256] = {
+static const uint8_t pm_encoding_cp855_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -100,7 +2542,7 @@ static uint8_t pm_encoding_cp855_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding GB1988 character.
*/
-static uint8_t pm_encoding_gb1988_table[256] = {
+static const uint8_t pm_encoding_gb1988_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -124,7 +2566,7 @@ static uint8_t pm_encoding_gb1988_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM437 character.
*/
-static uint8_t pm_encoding_ibm437_table[256] = {
+static const uint8_t pm_encoding_ibm437_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -148,7 +2590,7 @@ static uint8_t pm_encoding_ibm437_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM720 character.
*/
-static uint8_t pm_encoding_ibm720_table[256] = {
+static const uint8_t pm_encoding_ibm720_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -172,7 +2614,7 @@ static uint8_t pm_encoding_ibm720_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM737 character.
*/
-static uint8_t pm_encoding_ibm737_table[256] = {
+static const uint8_t pm_encoding_ibm737_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -196,7 +2638,7 @@ static uint8_t pm_encoding_ibm737_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM775 character.
*/
-static uint8_t pm_encoding_ibm775_table[256] = {
+static const uint8_t pm_encoding_ibm775_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -220,7 +2662,7 @@ static uint8_t pm_encoding_ibm775_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM852 character.
*/
-static uint8_t pm_encoding_ibm852_table[256] = {
+static const uint8_t pm_encoding_ibm852_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -244,7 +2686,7 @@ static uint8_t pm_encoding_ibm852_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM855 character.
*/
-static uint8_t pm_encoding_ibm855_table[256] = {
+static const uint8_t pm_encoding_ibm855_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -268,7 +2710,7 @@ static uint8_t pm_encoding_ibm855_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM857 character.
*/
-static uint8_t pm_encoding_ibm857_table[256] = {
+static const uint8_t pm_encoding_ibm857_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -292,7 +2734,7 @@ static uint8_t pm_encoding_ibm857_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM860 character.
*/
-static uint8_t pm_encoding_ibm860_table[256] = {
+static const uint8_t pm_encoding_ibm860_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -316,7 +2758,7 @@ static uint8_t pm_encoding_ibm860_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM861 character.
*/
-static uint8_t pm_encoding_ibm861_table[256] = {
+static const uint8_t pm_encoding_ibm861_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -340,7 +2782,7 @@ static uint8_t pm_encoding_ibm861_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM862 character.
*/
-static uint8_t pm_encoding_ibm862_table[256] = {
+static const uint8_t pm_encoding_ibm862_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -364,7 +2806,7 @@ static uint8_t pm_encoding_ibm862_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM863 character.
*/
-static uint8_t pm_encoding_ibm863_table[256] = {
+static const uint8_t pm_encoding_ibm863_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -388,7 +2830,7 @@ static uint8_t pm_encoding_ibm863_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM864 character.
*/
-static uint8_t pm_encoding_ibm864_table[256] = {
+static const uint8_t pm_encoding_ibm864_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -412,7 +2854,7 @@ static uint8_t pm_encoding_ibm864_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM865 character.
*/
-static uint8_t pm_encoding_ibm865_table[256] = {
+static const uint8_t pm_encoding_ibm865_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -436,7 +2878,7 @@ static uint8_t pm_encoding_ibm865_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM866 character.
*/
-static uint8_t pm_encoding_ibm866_table[256] = {
+static const uint8_t pm_encoding_ibm866_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -460,7 +2902,7 @@ static uint8_t pm_encoding_ibm866_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM869 character.
*/
-static uint8_t pm_encoding_ibm869_table[256] = {
+static const uint8_t pm_encoding_ibm869_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -484,7 +2926,7 @@ static uint8_t pm_encoding_ibm869_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-1 character.
*/
-static uint8_t pm_encoding_iso_8859_1_table[256] = {
+static const uint8_t pm_encoding_iso_8859_1_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -508,7 +2950,7 @@ static uint8_t pm_encoding_iso_8859_1_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-2 character.
*/
-static uint8_t pm_encoding_iso_8859_2_table[256] = {
+static const uint8_t pm_encoding_iso_8859_2_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -532,7 +2974,7 @@ static uint8_t pm_encoding_iso_8859_2_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-3 character.
*/
-static uint8_t pm_encoding_iso_8859_3_table[256] = {
+static const uint8_t pm_encoding_iso_8859_3_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -556,7 +2998,7 @@ static uint8_t pm_encoding_iso_8859_3_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-4 character.
*/
-static uint8_t pm_encoding_iso_8859_4_table[256] = {
+static const uint8_t pm_encoding_iso_8859_4_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -580,7 +3022,7 @@ static uint8_t pm_encoding_iso_8859_4_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-5 character.
*/
-static uint8_t pm_encoding_iso_8859_5_table[256] = {
+static const uint8_t pm_encoding_iso_8859_5_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -604,7 +3046,7 @@ static uint8_t pm_encoding_iso_8859_5_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-6 character.
*/
-static uint8_t pm_encoding_iso_8859_6_table[256] = {
+static const uint8_t pm_encoding_iso_8859_6_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -628,7 +3070,7 @@ static uint8_t pm_encoding_iso_8859_6_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-7 character.
*/
-static uint8_t pm_encoding_iso_8859_7_table[256] = {
+static const uint8_t pm_encoding_iso_8859_7_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -652,7 +3094,7 @@ static uint8_t pm_encoding_iso_8859_7_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-8 character.
*/
-static uint8_t pm_encoding_iso_8859_8_table[256] = {
+static const uint8_t pm_encoding_iso_8859_8_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -676,7 +3118,7 @@ static uint8_t pm_encoding_iso_8859_8_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-9 character.
*/
-static uint8_t pm_encoding_iso_8859_9_table[256] = {
+static const uint8_t pm_encoding_iso_8859_9_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -700,7 +3142,7 @@ static uint8_t pm_encoding_iso_8859_9_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-10 character.
*/
-static uint8_t pm_encoding_iso_8859_10_table[256] = {
+static const uint8_t pm_encoding_iso_8859_10_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -724,7 +3166,7 @@ static uint8_t pm_encoding_iso_8859_10_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-11 character.
*/
-static uint8_t pm_encoding_iso_8859_11_table[256] = {
+static const uint8_t pm_encoding_iso_8859_11_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -748,7 +3190,7 @@ static uint8_t pm_encoding_iso_8859_11_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-13 character.
*/
-static uint8_t pm_encoding_iso_8859_13_table[256] = {
+static const uint8_t pm_encoding_iso_8859_13_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -772,7 +3214,7 @@ static uint8_t pm_encoding_iso_8859_13_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-14 character.
*/
-static uint8_t pm_encoding_iso_8859_14_table[256] = {
+static const uint8_t pm_encoding_iso_8859_14_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -796,7 +3238,7 @@ static uint8_t pm_encoding_iso_8859_14_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-15 character.
*/
-static uint8_t pm_encoding_iso_8859_15_table[256] = {
+static const uint8_t pm_encoding_iso_8859_15_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -820,7 +3262,7 @@ static uint8_t pm_encoding_iso_8859_15_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-16 character.
*/
-static uint8_t pm_encoding_iso_8859_16_table[256] = {
+static const uint8_t pm_encoding_iso_8859_16_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -844,7 +3286,7 @@ static uint8_t pm_encoding_iso_8859_16_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding KOI8-R character.
*/
-static uint8_t pm_encoding_koi8_r_table[256] = {
+static const uint8_t pm_encoding_koi8_r_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -868,7 +3310,7 @@ static uint8_t pm_encoding_koi8_r_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding KOI8-U character.
*/
-static uint8_t pm_encoding_koi8_u_table[256] = {
+static const uint8_t pm_encoding_koi8_u_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -892,7 +3334,7 @@ static uint8_t pm_encoding_koi8_u_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding macCentEuro character.
*/
-static uint8_t pm_encoding_mac_cent_euro_table[256] = {
+static const uint8_t pm_encoding_mac_cent_euro_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -916,7 +3358,7 @@ static uint8_t pm_encoding_mac_cent_euro_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding macCroatian character.
*/
-static uint8_t pm_encoding_mac_croatian_table[256] = {
+static const uint8_t pm_encoding_mac_croatian_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -940,7 +3382,7 @@ static uint8_t pm_encoding_mac_croatian_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding macCyrillic character.
*/
-static uint8_t pm_encoding_mac_cyrillic_table[256] = {
+static const uint8_t pm_encoding_mac_cyrillic_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -964,7 +3406,7 @@ static uint8_t pm_encoding_mac_cyrillic_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding macGreek character.
*/
-static uint8_t pm_encoding_mac_greek_table[256] = {
+static const uint8_t pm_encoding_mac_greek_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -988,7 +3430,7 @@ static uint8_t pm_encoding_mac_greek_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding macIceland character.
*/
-static uint8_t pm_encoding_mac_iceland_table[256] = {
+static const uint8_t pm_encoding_mac_iceland_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1012,7 +3454,7 @@ static uint8_t pm_encoding_mac_iceland_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding macRoman character.
*/
-static uint8_t pm_encoding_mac_roman_table[256] = {
+static const uint8_t pm_encoding_mac_roman_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1036,7 +3478,7 @@ static uint8_t pm_encoding_mac_roman_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding macRomania character.
*/
-static uint8_t pm_encoding_mac_romania_table[256] = {
+static const uint8_t pm_encoding_mac_romania_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1060,7 +3502,7 @@ static uint8_t pm_encoding_mac_romania_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding macThai character.
*/
-static uint8_t pm_encoding_mac_thai_table[256] = {
+static const uint8_t pm_encoding_mac_thai_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1084,7 +3526,7 @@ static uint8_t pm_encoding_mac_thai_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding TIS-620 character.
*/
-static uint8_t pm_encoding_tis_620_table[256] = {
+static const uint8_t pm_encoding_tis_620_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1108,7 +3550,7 @@ static uint8_t pm_encoding_tis_620_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding macTurkish character.
*/
-static uint8_t pm_encoding_mac_turkish_table[256] = {
+static const uint8_t pm_encoding_mac_turkish_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1132,7 +3574,7 @@ static uint8_t pm_encoding_mac_turkish_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding macUkraine character.
*/
-static uint8_t pm_encoding_mac_ukraine_table[256] = {
+static const uint8_t pm_encoding_mac_ukraine_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1156,7 +3598,7 @@ static uint8_t pm_encoding_mac_ukraine_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding windows-1250 character.
*/
-static uint8_t pm_encoding_windows_1250_table[256] = {
+static const uint8_t pm_encoding_windows_1250_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1180,7 +3622,7 @@ static uint8_t pm_encoding_windows_1250_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding windows-1251 character.
*/
-static uint8_t pm_encoding_windows_1251_table[256] = {
+static const uint8_t pm_encoding_windows_1251_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1204,7 +3646,7 @@ static uint8_t pm_encoding_windows_1251_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding windows-1252 character.
*/
-static uint8_t pm_encoding_windows_1252_table[256] = {
+static const uint8_t pm_encoding_windows_1252_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1228,7 +3670,7 @@ static uint8_t pm_encoding_windows_1252_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding windows-1253 character.
*/
-static uint8_t pm_encoding_windows_1253_table[256] = {
+static const uint8_t pm_encoding_windows_1253_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1252,7 +3694,7 @@ static uint8_t pm_encoding_windows_1253_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding windows-1254 character.
*/
-static uint8_t pm_encoding_windows_1254_table[256] = {
+static const uint8_t pm_encoding_windows_1254_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1276,7 +3718,7 @@ static uint8_t pm_encoding_windows_1254_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding windows-1255 character.
*/
-static uint8_t pm_encoding_windows_1255_table[256] = {
+static const uint8_t pm_encoding_windows_1255_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1300,7 +3742,7 @@ static uint8_t pm_encoding_windows_1255_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding windows-1256 character.
*/
-static uint8_t pm_encoding_windows_1256_table[256] = {
+static const uint8_t pm_encoding_windows_1256_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1324,7 +3766,7 @@ static uint8_t pm_encoding_windows_1256_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding windows-1257 character.
*/
-static uint8_t pm_encoding_windows_1257_table[256] = {
+static const uint8_t pm_encoding_windows_1257_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1348,7 +3790,7 @@ static uint8_t pm_encoding_windows_1257_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding windows-1258 character.
*/
-static uint8_t pm_encoding_windows_1258_table[256] = {
+static const uint8_t pm_encoding_windows_1258_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1372,7 +3814,7 @@ static uint8_t pm_encoding_windows_1258_table[256] = {
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding windows-874 character.
*/
-static uint8_t pm_encoding_windows_874_table[256] = {
+static const uint8_t pm_encoding_windows_874_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
@@ -1392,60 +3834,6 @@ static uint8_t pm_encoding_windows_874_table[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
};
-/**
- * Returns the size of the next character in the ASCII encoding. This basically
- * means that if the top bit is not set, the character is 1 byte long.
- */
-static size_t
-pm_encoding_ascii_char_width(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
- return *b < 0x80 ? 1 : 0;
-}
-
-/**
- * Return the size of the next character in the ASCII encoding if it is an
- * alphabetical character.
- */
-size_t
-pm_encoding_ascii_alpha_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
- return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT);
-}
-
-/**
- * Return the size of the next character in the ASCII encoding if it is an
- * alphanumeric character.
- */
-size_t
-pm_encoding_ascii_alnum_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
- return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHANUMERIC_BIT) ? 1 : 0;
-}
-
-/**
- * Return true if the next character in the ASCII encoding if it is an uppercase
- * character.
- */
-bool
-pm_encoding_ascii_isupper_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
- return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_UPPERCASE_BIT);
-}
-
-/**
- * For a lot of encodings the default is that they are a single byte long no
- * matter what the codepoint, so this function is shared between them.
- */
-static size_t
-pm_encoding_single_char_width(PRISM_ATTRIBUTE_UNUSED const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
- return 1;
-}
-
-/**
- * Returns the size of the next character in the KOI-8 encoding. This means
- * checking if it's a valid codepoint in KOI-8 and if it is returning 1.
- */
-static size_t
-pm_encoding_koi8_char_width(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
- return ((*b >= 0x20 && *b <= 0x7E) || (*b >= 0x80)) ? 1 : 0;
-}
-
#define PRISM_ENCODING_TABLE(name) \
static size_t pm_encoding_ ##name ## _alpha_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { \
return (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_ALPHABETIC_BIT); \
@@ -1517,6 +3905,312 @@ PRISM_ENCODING_TABLE(windows_874)
#undef PRISM_ENCODING_TABLE
+/**
+ * Returns the size of the next character in the ASCII encoding. This basically
+ * means that if the top bit is not set, the character is 1 byte long.
+ */
+static size_t
+pm_encoding_ascii_char_width(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
+ return *b < 0x80 ? 1 : 0;
+}
+
+/**
+ * Return the size of the next character in the ASCII encoding if it is an
+ * alphabetical character.
+ */
+size_t
+pm_encoding_ascii_alpha_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
+ return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT);
+}
+
+/**
+ * Certain encodings are equivalent to ASCII below 0x80, so it works for our
+ * purposes to have a function here that first checks the bounds and then falls
+ * back to checking the ASCII lookup table.
+ */
+static size_t
+pm_encoding_ascii_alpha_char_7bit(const uint8_t *b, ptrdiff_t n) {
+ return (*b < 0x80) ? pm_encoding_ascii_alpha_char(b, n) : 0;
+}
+
+/**
+ * Return the size of the next character in the ASCII encoding if it is an
+ * alphanumeric character.
+ */
+size_t
+pm_encoding_ascii_alnum_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
+ return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHANUMERIC_BIT) ? 1 : 0;
+}
+
+/**
+ * Certain encodings are equivalent to ASCII below 0x80, so it works for our
+ * purposes to have a function here that first checks the bounds and then falls
+ * back to checking the ASCII lookup table.
+ */
+static size_t
+pm_encoding_ascii_alnum_char_7bit(const uint8_t *b, ptrdiff_t n) {
+ return (*b < 0x80) ? pm_encoding_ascii_alnum_char(b, n) : 0;
+}
+
+/**
+ * Return true if the next character in the ASCII encoding if it is an uppercase
+ * character.
+ */
+bool
+pm_encoding_ascii_isupper_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
+ return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_UPPERCASE_BIT);
+}
+
+/**
+ * Certain encodings are equivalent to ASCII below 0x80, so it works for our
+ * purposes to have a function here that first checks the bounds and then falls
+ * back to checking the ASCII lookup table.
+ */
+static bool
+pm_encoding_ascii_isupper_char_7bit(const uint8_t *b, ptrdiff_t n) {
+ return (*b < 0x80) && pm_encoding_ascii_isupper_char(b, n);
+}
+
+/**
+ * For a lot of encodings the default is that they are a single byte long no
+ * matter what the codepoint, so this function is shared between them.
+ */
+static size_t
+pm_encoding_single_char_width(PRISM_ATTRIBUTE_UNUSED const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
+ return 1;
+}
+
+/**
+ * Returns the size of the next character in the Big5 encoding, or 0 if a
+ * character cannot be decoded from the given bytes.
+ */
+static size_t
+pm_encoding_big5_char_width(const uint8_t *b, ptrdiff_t n) {
+ // These are the single byte characters.
+ if (*b < 0x80) {
+ return 1;
+ }
+
+ // These are the double byte characters.
+ if ((n > 1) && (b[0] >= 0xA1 && b[0] <= 0xFE) && ((b[1] >= 0x40 && b[1] <= 0x7E) || (b[1] >= 0xA1 && b[1] <= 0xFE))) {
+ return 2;
+ }
+
+ return 0;
+}
+
+/**
+ * Returns the size of the next character in the CP949 encoding, or 0 if a
+ * character cannot be decoded from the given bytes.
+ */
+static size_t
+pm_encoding_cp949_char_width(const uint8_t *b, ptrdiff_t n) {
+ // These are the single byte characters
+ if (*b <= 0x80) {
+ return 1;
+ }
+
+ // These are the double byte characters
+ if ((n > 1) && (b[0] >= 0x81 && b[0] <= 0xfe) && (b[1] >= 0x41 && b[1] <= 0xfe)) {
+ return 2;
+ }
+
+ return 0;
+}
+
+/**
+ * Returns the size of the next character in the Emacs MULE encoding, or 0 if a
+ * character cannot be decoded from the given bytes.
+ */
+static size_t
+pm_encoding_emacs_mule_char_width(const uint8_t *b, ptrdiff_t n) {
+ // These are the 1 byte characters.
+ if (*b < 0x80) {
+ return 1;
+ }
+
+ // These are the 2 byte characters.
+ if ((n > 1) && (b[0] >= 0x81 && b[0] <= 0x8F) && (b[1] >= 0xA0)) {
+ return 2;
+ }
+
+ // These are the 3 byte characters.
+ if (
+ (n > 2) &&
+ (
+ ((b[0] >= 0x90 && b[0] <= 0x99) && (b[1] >= 0xA0)) ||
+ ((b[0] == 0x9A || b[0] == 0x9B) && (b[1] >= 0xE0 && b[1] <= 0xEF))
+ ) &&
+ (b[2] >= 0xA0)
+ ) {
+ return 3;
+ }
+
+ // These are the 4 byte characters.
+ if (
+ (n > 3) &&
+ (
+ ((b[0] == 0x9C) && (b[1] >= 0xF0) && (b[1] <= 0xF4)) ||
+ ((b[0] == 0x9D) && (b[1] >= 0xF5) && (b[1] <= 0xFE))
+ ) &&
+ (b[2] >= 0xA0) && (b[3] >= 0xA0)
+ ) {
+ return 4;
+ }
+
+ return 0;
+}
+
+/**
+ * Returns the size of the next character in the EUC-JP encoding, or 0 if a
+ * character cannot be decoded from the given bytes.
+ */
+static size_t
+pm_encoding_euc_jp_char_width(const uint8_t *b, ptrdiff_t n) {
+ // These are the single byte characters.
+ if (*b < 0x80) {
+ return 1;
+ }
+
+ // These are the double byte characters.
+ if ((n > 1) && ((b[0] == 0x8E) || (b[0] >= 0xA1 && b[0] <= 0xFE)) && (b[1] >= 0xA1 && b[1] <= 0xFE)) {
+ return 2;
+ }
+
+ // These are the triple byte characters.
+ if ((n > 2) && (b[0] == 0x8F) && (b[1] >= 0xA1 && b[2] <= 0xFE) && (b[2] >= 0xA1 && b[2] <= 0xFE)) {
+ return 3;
+ }
+
+ return 0;
+}
+
+/**
+ * Returns the size of the next character in the EUC-KR encoding, or 0 if a
+ * character cannot be decoded from the given bytes.
+ */
+static size_t
+pm_encoding_euc_kr_char_width(const uint8_t *b, ptrdiff_t n) {
+ // These are the single byte characters.
+ if (*b < 0x80) {
+ return 1;
+ }
+
+ // These are the double byte characters.
+ if ((n > 1) && (b[0] >= 0xA1 && b[0] <= 0xFE) && (b[1] >= 0xA1 && b[1] <= 0xFE)) {
+ return 2;
+ }
+
+ return 0;
+}
+
+/**
+ * Returns the size of the next character in the EUC-TW encoding, or 0 if a
+ * character cannot be decoded from the given bytes.
+ */
+static size_t
+pm_encoding_euc_tw_char_width(const uint8_t *b, ptrdiff_t n) {
+ // These are the single byte characters.
+ if (*b < 0x80) {
+ return 1;
+ }
+
+ // These are the double byte characters.
+ if ((n > 1) && (b[0] >= 0xA1) && (b[0] <= 0xFE) && (b[1] >= 0xA1) && (b[1] <= 0xFE)) {
+ return 2;
+ }
+
+ // These are the quadruple byte characters.
+ if ((n > 3) && (b[0] == 0x8E) && (b[1] >= 0xA1) && (b[1] <= 0xB0) && (b[2] >= 0xA1) && (b[2] <= 0xFE) && (b[3] >= 0xA1) && (b[3] <= 0xFE)) {
+ return 4;
+ }
+
+ return 0;
+}
+
+/**
+ * Returns the size of the next character in the GB18030 encoding, or 0 if a
+ * character cannot be decoded from the given bytes.
+ */
+static size_t
+pm_encoding_gb18030_char_width(const uint8_t *b, ptrdiff_t n) {
+ // These are the 1 byte characters.
+ if (*b < 0x80) {
+ return 1;
+ }
+
+ // These are the 2 byte characters.
+ if ((n > 1) && (b[0] >= 0x81 && b[0] <= 0xFE) && (b[1] >= 0x40 && b[1] <= 0xFE && b[1] != 0x7F)) {
+ return 2;
+ }
+
+ // These are the 4 byte characters.
+ 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))) {
+ return 4;
+ }
+
+ return 0;
+}
+
+/**
+ * Returns the size of the next character in the GBK encoding, or 0 if a
+ * character cannot be decoded from the given bytes.
+ */
+static size_t
+pm_encoding_gbk_char_width(const uint8_t *b, ptrdiff_t n) {
+ // These are the single byte characters.
+ if (*b <= 0x80) {
+ return 1;
+ }
+
+ // These are the double byte characters.
+ if (
+ (n > 1) &&
+ (
+ ((b[0] >= 0xA1 && b[0] <= 0xA9) && (b[1] >= 0xA1 && b[1] <= 0xFE)) || // GBK/1
+ ((b[0] >= 0xB0 && b[0] <= 0xF7) && (b[1] >= 0xA1 && b[1] <= 0xFE)) || // GBK/2
+ ((b[0] >= 0x81 && b[0] <= 0xA0) && (b[1] >= 0x40 && b[1] <= 0xFE) && (b[1] != 0x7F)) || // GBK/3
+ ((b[0] >= 0xAA && b[0] <= 0xFE) && (b[1] >= 0x40 && b[1] <= 0xA0) && (b[1] != 0x7F)) || // GBK/4
+ ((b[0] >= 0xA8 && b[0] <= 0xA9) && (b[1] >= 0x40 && b[1] <= 0xA0) && (b[1] != 0x7F)) || // GBK/5
+ ((b[0] >= 0xAA && b[0] <= 0xAF) && (b[1] >= 0xA1 && b[1] <= 0xFE)) || // user-defined 1
+ ((b[0] >= 0xF8 && b[0] <= 0xFE) && (b[1] >= 0xA1 && b[1] <= 0xFE)) || // user-defined 2
+ ((b[0] >= 0xA1 && b[0] <= 0xA7) && (b[1] >= 0x40 && b[1] <= 0xA0) && (b[1] != 0x7F)) // user-defined 3
+ )
+ ) {
+ return 2;
+ }
+
+ return 0;
+}
+
+/**
+ * Returns the size of the next character in the KOI-8 encoding. This means
+ * checking if it's a valid codepoint in KOI-8 and if it is returning 1.
+ */
+static size_t
+pm_encoding_koi8_char_width(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
+ return ((*b >= 0x20 && *b <= 0x7E) || (*b >= 0x80)) ? 1 : 0;
+}
+
+/**
+ * Returns the size of the next character in the Shift_JIS encoding, or 0 if a
+ * character cannot be decoded from the given bytes.
+ */
+static size_t
+pm_encoding_shift_jis_char_width(const uint8_t *b, ptrdiff_t n) {
+ // These are the single byte characters.
+ if (*b < 0x80 || (*b >= 0xA1 && *b <= 0xDF)) {
+ return 1;
+ }
+
+ // These are the double byte characters.
+ if ((n > 1) && ((b[0] >= 0x81 && b[0] <= 0x9F) || (b[0] >= 0xE0 && b[0] <= 0xFC)) && (b[1] >= 0x40 && b[1] <= 0xFC)) {
+ return 2;
+ }
+
+ return 0;
+}
+
/** US-ASCII encoding */
pm_encoding_t pm_encoding_ascii = {
.name = "US-ASCII",
@@ -2106,3 +4800,313 @@ pm_encoding_t pm_encoding_windows_874 = {
.isupper_char = pm_encoding_windows_874_isupper_char,
.multibyte = false
};
+
+/** Big5 encoding */
+pm_encoding_t pm_encoding_big5 = {
+ .name = "Big5",
+ .char_width = pm_encoding_big5_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** CP950 encoding */
+pm_encoding_t pm_encoding_cp950 = {
+ .name = "CP950",
+ .char_width = pm_encoding_big5_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** Big5-HKSCS encoding */
+pm_encoding_t pm_encoding_big5_hkscs = {
+ .name = "Big5-HKSCS",
+ .char_width = pm_encoding_big5_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** CP951 encoding */
+pm_encoding_t pm_encoding_cp951 = {
+ .name = "CP951",
+ .char_width = pm_encoding_big5_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** Big5-UAO encoding */
+pm_encoding_t pm_encoding_big5_uao = {
+ .name = "Big5-UAO",
+ .char_width = pm_encoding_big5_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** Emacs-Mule encoding */
+pm_encoding_t pm_encoding_emacs_mule = {
+ .name = "Emacs-Mule",
+ .char_width = pm_encoding_emacs_mule_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** stateless-ISO-2022-JP encoding */
+pm_encoding_t pm_encoding_stateless_iso_2022_jp = {
+ .name = "stateless-ISO-2022-JP",
+ .char_width = pm_encoding_emacs_mule_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** stateless-ISO-2022-JP-KDDI encoding */
+pm_encoding_t pm_encoding_stateless_iso_2022_jp_kddi = {
+ .name = "stateless-ISO-2022-JP-KDDI",
+ .char_width = pm_encoding_emacs_mule_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** GB18030 encoding */
+pm_encoding_t pm_encoding_gb18030 = {
+ .name = "GB18030",
+ .char_width = pm_encoding_gb18030_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** EUC-JP encoding */
+pm_encoding_t pm_encoding_euc_jp = {
+ .name = "EUC-JP",
+ .char_width = pm_encoding_euc_jp_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** eucJP-ms encoding */
+pm_encoding_t pm_encoding_euc_jp_ms = {
+ .name = "eucJP-ms",
+ .char_width = pm_encoding_euc_jp_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** EUC-JIS-2004 encoding */
+pm_encoding_t pm_encoding_euc_jis_2004 = {
+ .name = "EUC-JIS-2004",
+ .char_width = pm_encoding_euc_jp_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** CP51932 encoding */
+pm_encoding_t pm_encoding_cp51932 = {
+ .name = "CP51932",
+ .char_width = pm_encoding_euc_jp_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** EUC-KR encoding */
+pm_encoding_t pm_encoding_euc_kr = {
+ .name = "EUC-KR",
+ .char_width = pm_encoding_euc_kr_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** GB2312 encoding */
+pm_encoding_t pm_encoding_gb2312 = {
+ .name = "GB2312",
+ .char_width = pm_encoding_euc_kr_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** GB12345 encoding */
+pm_encoding_t pm_encoding_gb12345 = {
+ .name = "GB12345",
+ .char_width = pm_encoding_euc_kr_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** EUC-TW encoding */
+pm_encoding_t pm_encoding_euc_tw = {
+ .name = "EUC-TW",
+ .char_width = pm_encoding_euc_tw_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** GBK encoding */
+pm_encoding_t pm_encoding_gbk = {
+ .name = "GBK",
+ .char_width = pm_encoding_gbk_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** CP949 encoding */
+pm_encoding_t pm_encoding_cp949 = {
+ .name = "CP949",
+ .char_width = pm_encoding_cp949_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** Shift_JIS encoding */
+pm_encoding_t pm_encoding_shift_jis = {
+ .name = "Shift_JIS",
+ .char_width = pm_encoding_shift_jis_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** SJIS-DoCoMo encoding */
+pm_encoding_t pm_encoding_sjis_docomo = {
+ .name = "SJIS-DoCoMo",
+ .char_width = pm_encoding_shift_jis_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** SJIS-KDDI encoding */
+pm_encoding_t pm_encoding_sjis_kddi = {
+ .name = "SJIS-KDDI",
+ .char_width = pm_encoding_shift_jis_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** SJIS-SoftBank encoding */
+pm_encoding_t pm_encoding_sjis_softbank = {
+ .name = "SJIS-SoftBank",
+ .char_width = pm_encoding_shift_jis_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** MacJapanese encoding */
+pm_encoding_t pm_encoding_mac_japanese = {
+ .name = "MacJapanese",
+ .char_width = pm_encoding_shift_jis_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** Windows-31J */
+pm_encoding_t pm_encoding_windows_31j = {
+ .name = "Windows-31J",
+ .char_width = pm_encoding_shift_jis_char_width,
+ .alnum_char = pm_encoding_ascii_alnum_char_7bit,
+ .alpha_char = pm_encoding_ascii_alpha_char_7bit,
+ .isupper_char = pm_encoding_ascii_isupper_char_7bit,
+ .multibyte = true
+};
+
+/** UTF-8 */
+pm_encoding_t pm_encoding_utf_8 = {
+ .name = "UTF-8",
+ .char_width = pm_encoding_utf_8_char_width,
+ .alnum_char = pm_encoding_utf_8_alnum_char,
+ .alpha_char = pm_encoding_utf_8_alpha_char,
+ .isupper_char = pm_encoding_utf_8_isupper_char,
+ .multibyte = true
+};
+
+/** UTF8-MAC */
+pm_encoding_t pm_encoding_utf8_mac = {
+ .name = "UTF8-MAC",
+ .char_width = pm_encoding_utf_8_char_width,
+ .alnum_char = pm_encoding_utf_8_alnum_char,
+ .alpha_char = pm_encoding_utf_8_alpha_char,
+ .isupper_char = pm_encoding_utf_8_isupper_char,
+ .multibyte = true
+};
+
+/** UTF8-DoCoMo */
+pm_encoding_t pm_encoding_utf8_docomo = {
+ .name = "UTF8-DoCoMo",
+ .char_width = pm_encoding_utf_8_char_width,
+ .alnum_char = pm_encoding_utf_8_alnum_char,
+ .alpha_char = pm_encoding_utf_8_alpha_char,
+ .isupper_char = pm_encoding_utf_8_isupper_char,
+ .multibyte = true
+};
+
+/** UTF8-KDDI */
+pm_encoding_t pm_encoding_utf8_kddi = {
+ .name = "UTF8-KDDI",
+ .char_width = pm_encoding_utf_8_char_width,
+ .alnum_char = pm_encoding_utf_8_alnum_char,
+ .alpha_char = pm_encoding_utf_8_alpha_char,
+ .isupper_char = pm_encoding_utf_8_isupper_char,
+ .multibyte = true
+};
+
+/** UTF8-SoftBank */
+pm_encoding_t pm_encoding_utf8_softbank = {
+ .name = "UTF8-SoftBank",
+ .char_width = pm_encoding_utf_8_char_width,
+ .alnum_char = pm_encoding_utf_8_alnum_char,
+ .alpha_char = pm_encoding_utf_8_alpha_char,
+ .isupper_char = pm_encoding_utf_8_isupper_char,
+ .multibyte = true
+};
+
+/** CESU-8 */
+pm_encoding_t pm_encoding_cesu_8 = {
+ .name = "CESU-8",
+ .char_width = pm_encoding_cesu_8_char_width,
+ .alnum_char = pm_encoding_cesu_8_alnum_char,
+ .alpha_char = pm_encoding_cesu_8_alpha_char,
+ .isupper_char = pm_encoding_cesu_8_isupper_char,
+ .multibyte = true
+};
diff --git a/prism/enc/pm_encoding.h b/prism/encoding.h
index ac594d97ca..866913206a 100644
--- a/prism/enc/pm_encoding.h
+++ b/prism/encoding.h
@@ -1,5 +1,5 @@
/**
- * @file pm_encoding.h
+ * @file encoding.h
*
* The encoding interface and implementations used by the parser.
*/
diff --git a/prism/parser.h b/prism/parser.h
index dfc15e19b7..424d150ebe 100644
--- a/prism/parser.h
+++ b/prism/parser.h
@@ -8,7 +8,7 @@
#include "prism/ast.h"
#include "prism/defines.h"
-#include "prism/enc/pm_encoding.h"
+#include "prism/encoding.h"
#include "prism/util/pm_constant_pool.h"
#include "prism/util/pm_list.h"
#include "prism/util/pm_newline_list.h"
diff --git a/prism/regexp.h b/prism/regexp.h
index 09bdaca89a..f969eb45d4 100644
--- a/prism/regexp.h
+++ b/prism/regexp.h
@@ -8,7 +8,7 @@
#include "prism/defines.h"
#include "prism/parser.h"
-#include "prism/enc/pm_encoding.h"
+#include "prism/encoding.h"
#include "prism/util/pm_memchr.h"
#include "prism/util/pm_string_list.h"
#include "prism/util/pm_string.h"
diff --git a/prism/util/pm_memchr.h b/prism/util/pm_memchr.h
index 1eae6ab1ba..fd5879a201 100644
--- a/prism/util/pm_memchr.h
+++ b/prism/util/pm_memchr.h
@@ -7,7 +7,7 @@
#define PRISM_MEMCHR_H
#include "prism/defines.h"
-#include "prism/enc/pm_encoding.h"
+#include "prism/encoding.h"
#include <stddef.h>