diff --git a/case_switch/tolower_unicode.c b/case_switch/tolower_unicode.c new file mode 100644 index 0000000..1df8867 --- /dev/null +++ b/case_switch/tolower_unicode.c @@ -0,0 +1,660 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../build.h" + +static unsigned int tolower_00c0_00df(unsigned int uc) __attribute__((noinline)); + +static unsigned int tolower_0100_01ff(unsigned int uc) __attribute__((noinline)); +static unsigned int tolower_0200_024f(unsigned int uc) __attribute__((noinline)); +static unsigned int tolower_0370_03ff(unsigned int uc) __attribute__((noinline)); +static unsigned int tolower_0460_04ff(unsigned int uc) __attribute__((noinline)); +static unsigned int tolower_0500_055f(unsigned int uc) __attribute__((noinline)); +static unsigned int tolower_10a0_10cf(unsigned int uc) __attribute__((noinline)); +static unsigned int tolower_13a0_13ff(unsigned int uc) __attribute__((noinline)); +static unsigned int tolower_1c90_1cbf(unsigned int uc) __attribute__((noinline)); +static unsigned int tolower_1e00_1eff(unsigned int uc) __attribute__((noinline)); +static unsigned int tolower_1f00_1fff(unsigned int uc) __attribute__((noinline)); +static unsigned int tolower_2c00_2cff(unsigned int uc) __attribute__((noinline)); +static unsigned int tolower_a640_a69f(unsigned int uc) __attribute__((noinline)); +static unsigned int tolower_a720_a7cf(unsigned int uc) __attribute__((noinline)); + +static unsigned int tolower_010400_0104df(unsigned int uc) __attribute__((noinline)); +static unsigned int tolower_010c80_010cbf(unsigned int uc) __attribute__((noinline)); +static unsigned int tolower_0118a0_0118bf(unsigned int uc) __attribute__((noinline)); + + + +static unsigned int tolower_00c0_00df(unsigned int uc) { + if (uc <= 0x00de) { + if (uc >= 0x00c0 && uc != 0x00d7) return uc | 0x20; + } + + return uc; +} + +static unsigned int tolower_0100_01ff(unsigned int uc) { + static unsigned char table[] = { + /* 0x000100 - 0x000107 */ 0x01, 0x00, 0x03, 0x00, 0x05, 0x00, 0x07, 0x00, + /* 0x000108 - 0x00010f */ 0x09, 0x00, 0x0b, 0x00, 0x0d, 0x00, 0x0f, 0x00, + /* 0x000110 - 0x000117 */ 0x11, 0x00, 0x13, 0x00, 0x15, 0x00, 0x17, 0x00, + /* 0x000118 - 0x00011f */ 0x19, 0x00, 0x1b, 0x00, 0x1d, 0x00, 0x1f, 0x00, + /* 0x000120 - 0x000127 */ 0x21, 0x00, 0x23, 0x00, 0x25, 0x00, 0x27, 0x00, + /* 0x000128 - 0x00012f */ 0x29, 0x00, 0x2b, 0x00, 0x2d, 0x00, 0x2f, 0x00, + /* 0x000130 - 0x000137 */ 0x31, 0x00, 0x33, 0x00, 0x35, 0x00, 0x37, 0x00, + /* 0x000138 - 0x00013f */ 0x00, 0x3a, 0x00, 0x3c, 0x00, 0x3e, 0x00, 0x40, + /* 0x000140 - 0x000147 */ 0x00, 0x42, 0x00, 0x44, 0x00, 0x46, 0x00, 0x48, + /* 0x000148 - 0x00014f */ 0x00, 0x00, 0x4b, 0x00, 0x4d, 0x00, 0x4f, 0x00, + /* 0x000150 - 0x000157 */ 0x51, 0x00, 0x53, 0x00, 0x55, 0x00, 0x57, 0x00, + /* 0x000158 - 0x00015f */ 0x59, 0x00, 0x5b, 0x00, 0x5d, 0x00, 0x5f, 0x00, + /* 0x000160 - 0x000167 */ 0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x67, 0x00, + /* 0x000168 - 0x00016f */ 0x69, 0x00, 0x6b, 0x00, 0x6d, 0x00, 0x6f, 0x00, + /* 0x000170 - 0x000177 */ 0x71, 0x00, 0x73, 0x00, 0x75, 0x00, 0x77, 0x00, + /* 0x000178 - 0x00017f */ 0x00, 0x7a, 0x00, 0x7c, 0x00, 0x7e, 0x00, 0x00, + #ifndef LATIN_EXTENDED_B_DISABLE + /* 0x000180 - 0x000187 */ 0x00, 0x00, 0x83, 0x00, 0x85, 0x00, 0x00, 0x88, + /* 0x000188 - 0x00018f */ 0x00, 0x8a, 0x00, 0x8c, 0x00, 0x8e, 0xdd, 0x90, + /* 0x000190 - 0x000197 */ 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x000198 - 0x00019f */ 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0001a0 - 0x0001a7 */ 0xa1, 0x00, 0xa3, 0x00, 0xa5, 0x00, 0x00, 0x00, + /* 0x0001a8 - 0x0001af */ 0xa9, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, 0xb0, + /* 0x0001b0 - 0x0001b7 */ 0x00, 0x00, 0x00, 0xb4, 0x00, 0xb6, 0x00, 0x00, + /* 0x0001b8 - 0x0001bf */ 0xb9, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, + /* 0x0001c0 - 0x0001c7 */ 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0x00, 0xc9, + /* 0x0001c8 - 0x0001cf */ 0xc9, 0x00, 0xcc, 0xcc, 0x00, 0xce, 0x00, 0xd0, + /* 0x0001d0 - 0x0001d7 */ 0x00, 0xd2, 0x00, 0xd4, 0x00, 0xd6, 0x00, 0xd8, + /* 0x0001d8 - 0x0001df */ 0x00, 0xda, 0x00, 0xdc, 0x00, 0x00, 0xdf, 0x00, + /* 0x0001e0 - 0x0001e7 */ 0xe1, 0x00, 0xe3, 0x00, 0xe5, 0x00, 0xe7, 0x00, + /* 0x0001e8 - 0x0001ef */ 0xe9, 0x00, 0xeb, 0x00, 0xed, 0x00, 0xef, 0x00, + /* 0x0001f0 - 0x0001f7 */ 0x00, 0xf3, 0xf3, 0x00, 0xf5, 0x00, 0x95, 0x00, + /* 0x0001f8 - 0x0001ff */ 0xf9, 0x00, 0xfb, 0x00, 0xfd, 0x00, 0xff, 0x00, + #endif + }; + + #ifdef LATIN_EXTENDED_B_DISABLE + if (uc >= 0x0180) return uc; + #endif + + unsigned char v = uc - 0x0100; + + if (table[v]) return 0x0100 | table[v]; + + switch(v) { default: return uc; + case 0x78: return 0x00ff; + + #if !defined(LATIN_EXTENDED_B_DISABLE) && !defined(IPA_EXTENSIONS_DISABLE) + case 0x81: return 0x0253; + case 0x86: return 0x0254; + case 0x90: return 0x025b; + case 0x93: return 0x0260; + case 0x94: return 0x0263; + case 0x96: return 0x0269; + case 0x97: return 0x0268; + case 0x9c: return 0x026f; + case 0x9d: return 0x0272; + case 0x9f: return 0x0275; + case 0xa6: return 0x0280; + case 0xa9: return 0x0283; + case 0xae: return 0x0288; + case 0xb1: return 0x028a; + case 0xb2: return 0x028b; + case 0xb7: return 0x0292; + case 0xbf: return 0x0259; + case 0xf7: return 0x02bf; + #endif + } +} + +static unsigned int tolower_0200_024f(unsigned int uc) { + #ifndef LATIN_EXTENDED_B_DISABLE + static unsigned char table[] = { + /* 0x000200 - 0x000207 */ 0x01, 0x00, 0x03, 0x00, 0x05, 0x00, 0x07, 0x00, + /* 0x000208 - 0x00020f */ 0x09, 0x00, 0x0b, 0x00, 0x0d, 0x00, 0x0f, 0x00, + /* 0x000210 - 0x000217 */ 0x11, 0x00, 0x13, 0x00, 0x15, 0x00, 0x17, 0x00, + /* 0x000218 - 0x00021f */ 0x19, 0x00, 0x1b, 0x00, 0x1d, 0x00, 0x1f, 0x00, + /* 0x000220 - 0x000227 */ 0x00, 0x00, 0x23, 0x00, 0x25, 0x00, 0x27, 0x00, + /* 0x000228 - 0x00022f */ 0x29, 0x00, 0x2b, 0x00, 0x2d, 0x00, 0x2f, 0x00, + /* 0x000230 - 0x000237 */ 0x31, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x000238 - 0x00023f */ 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3f, 0x00, + /* 0x000240 - 0x000247 */ 0x00, 0x42, 0x00, 0x00, 0x89, 0x8c, 0x47, 0x00, + /* 0x000248 - 0x00024f */ 0x49, 0x00, 0x4b, 0x00, 0x4d, 0x00, 0x4f, 0x00, + }; + + unsigned char v = uc - 0x0200; + + if (table[v]) return 0x0200 | table[v]; + + switch(v) { default: break; + case 0x20: return 0x019e; + case 0x3d: return 0x019a; + case 0x43: return 0x0180; + + #ifndef LATIN_EXTENDED_C_DISABLE + case 0x3a: return 0x2c65; + #endif + } + #endif + + return uc; +} + +static unsigned int tolower_0370_03ff(unsigned int uc) { + static unsigned char table[] = { + /* 0x000370 - 0x000377 */ 0x71, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, + /* 0x000378 - 0x00037f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf3, + /* 0x000380 - 0x000387 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, + /* 0x000388 - 0x00038f */ 0xad, 0xae, 0xaf, 0x00, 0xcc, 0x00, 0xcd, 0xce, + /* 0x000390 - 0x000397 */ 0x00, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + /* 0x000398 - 0x00039f */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + /* 0x0003a0 - 0x0003a7 */ 0xc0, 0xc1, 0x00, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + /* 0x0003a8 - 0x0003af */ 0xc8, 0xc9, 0xca, 0xcb, 0x00, 0x00, 0x00, 0x00, + /* 0x0003b0 - 0x0003b7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0003b8 - 0x0003bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0003c0 - 0x0003c7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0003c8 - 0x0003cf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0003d0 - 0x0003d7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0003d8 - 0x0003df */ 0xd9, 0x00, 0xdb, 0x00, 0xdd, 0x00, 0xdf, 0x00, + /* 0x0003e0 - 0x0003e7 */ 0xe1, 0x00, 0xe3, 0x00, 0xe5, 0x00, 0xe7, 0x00, + /* 0x0003e8 - 0x0003ef */ 0xe9, 0x00, 0xeb, 0x00, 0xed, 0x00, 0xef, 0x00, + /* 0x0003f0 - 0x0003f7 */ 0x00, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0xf8, + /* 0x0003f8 - 0x0003ff */ 0x00, 0xf2, 0xfb, 0x00, 0x00, 0x7b, 0x7c, 0x7d, + }; + + unsigned char v = uc - 0x0370; + + if (table[v]) return 0x0300 | table[v]; + + return uc; +} + +static unsigned int tolower_0460_04ff(unsigned int uc) { + static unsigned char table[] = { + /* 0x000460 - 0x000467 */ 0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x67, 0x00, + /* 0x000468 - 0x00046f */ 0x69, 0x00, 0x6b, 0x00, 0x6d, 0x00, 0x6f, 0x00, + /* 0x000470 - 0x000477 */ 0x71, 0x00, 0x73, 0x00, 0x75, 0x00, 0x77, 0x00, + /* 0x000478 - 0x00047f */ 0x79, 0x00, 0x7b, 0x00, 0x7d, 0x00, 0x7f, 0x00, + /* 0x000480 - 0x000487 */ 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x000488 - 0x00048f */ 0x00, 0x00, 0x8b, 0x00, 0x8d, 0x00, 0x8f, 0x00, + /* 0x000490 - 0x000497 */ 0x91, 0x00, 0x93, 0x00, 0x95, 0x00, 0x97, 0x00, + /* 0x000498 - 0x00049f */ 0x99, 0x00, 0x9b, 0x00, 0x9d, 0x00, 0x9f, 0x00, + /* 0x0004a0 - 0x0004a7 */ 0xa1, 0x00, 0xa3, 0x00, 0xa5, 0x00, 0xa7, 0x00, + /* 0x0004a8 - 0x0004af */ 0xa9, 0x00, 0xab, 0x00, 0xad, 0x00, 0xaf, 0x00, + /* 0x0004b0 - 0x0004b7 */ 0xb1, 0x00, 0xb3, 0x00, 0xb5, 0x00, 0xb7, 0x00, + /* 0x0004b8 - 0x0004bf */ 0xb9, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0xbf, 0x00, + /* 0x0004c0 - 0x0004c7 */ 0xcf, 0xc2, 0x00, 0xc4, 0x00, 0xc6, 0x00, 0xc8, + /* 0x0004c8 - 0x0004cf */ 0x00, 0xca, 0x00, 0xcc, 0x00, 0xce, 0x00, 0x00, + /* 0x0004d0 - 0x0004d7 */ 0xd1, 0x00, 0xd3, 0x00, 0xd5, 0x00, 0xd7, 0x00, + /* 0x0004d8 - 0x0004df */ 0xd9, 0x00, 0xdb, 0x00, 0xdd, 0x00, 0xdf, 0x00, + /* 0x0004e0 - 0x0004e7 */ 0xe1, 0x00, 0xe3, 0x00, 0xe5, 0x00, 0xe7, 0x00, + /* 0x0004e8 - 0x0004ef */ 0xe9, 0x00, 0xeb, 0x00, 0xed, 0x00, 0xef, 0x00, + /* 0x0004f0 - 0x0004f7 */ 0xf1, 0x00, 0xf3, 0x00, 0xf5, 0x00, 0xf7, 0x00, + /* 0x0004f8 - 0x0004ff */ 0xf9, 0x00, 0xfb, 0x00, 0xfd, 0x00, 0xff, 0x00, + }; + + unsigned char v = uc - 0x0460; + + if (table[v]) return 0x0400 | table[v]; + + return uc; +} + +static unsigned int tolower_0500_055f(unsigned int uc) { + static unsigned char table[] = { + #ifndef CYRILLIC_SUPLEMENT_DISABLE + /* 0x000500 - 0x000507 */ 0x01, 0x00, 0x03, 0x00, 0x05, 0x00, 0x07, 0x00, + /* 0x000508 - 0x00050f */ 0x09, 0x00, 0x0b, 0x00, 0x0d, 0x00, 0x0f, 0x00, + /* 0x000510 - 0x000517 */ 0x11, 0x00, 0x13, 0x00, 0x15, 0x00, 0x17, 0x00, + /* 0x000518 - 0x00051f */ 0x19, 0x00, 0x1b, 0x00, 0x1d, 0x00, 0x1f, 0x00, + /* 0x000520 - 0x000527 */ 0x21, 0x00, 0x23, 0x00, 0x25, 0x00, 0x27, 0x00, + /* 0x000528 - 0x00052f */ 0x29, 0x00, 0x2b, 0x00, 0x2d, 0x00, 0x2f, 0x00, + #endif + /* 0x000530 - 0x000537 */ 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + /* 0x000538 - 0x00053f */ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + /* 0x000540 - 0x000547 */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + /* 0x000548 - 0x00054f */ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + /* 0x000550 - 0x000557 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x00, + }; + + #ifndef CYRILLIC_SUPLEMENT_DISABLE + unsigned char v = uc - 0x0500; + #else + if (uc <= 0x052f) return uc; + + unsigned char v = uc - 0x0530; + #endif + if (table[v]) return 0x0500 | table[v]; + + return uc; +} + +static unsigned int tolower_10a0_10cf(unsigned int uc) { + static unsigned char table[] = { + /* 0x0010a0 - 0x0010a7 */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + /* 0x0010a8 - 0x0010af */ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, + /* 0x0010b0 - 0x0010b7 */ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, + /* 0x0010b8 - 0x0010bf */ 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, + /* 0x0010c0 - 0x0010c7 */ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x00, 0x28, + /* 0x0010c8 - 0x0010cf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, + }; + + unsigned char v = uc - 0x10a0; + + if (table[v]) return 0x2d00 | table[v] - 1; + + return uc; +} + +static unsigned int tolower_13a0_13ff(unsigned int uc) { + #ifndef CHEROKEE_DISABLE + static unsigned char table[] = { + /* 0x0013a0 - 0x0013a7 */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + /* 0x0013a8 - 0x0013af */ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + /* 0x0013b0 - 0x0013b7 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + /* 0x0013b8 - 0x0013bf */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + /* 0x0013c0 - 0x0013c7 */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + /* 0x0013c8 - 0x0013cf */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + /* 0x0013d0 - 0x0013d7 */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + /* 0x0013d8 - 0x0013df */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + /* 0x0013e0 - 0x0013e7 */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + /* 0x0013e8 - 0x0013ef */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + /* 0x0013f0 - 0x0013f7 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0x00, 0x00, + }; + + unsigned char v = uc - 0x13a0; + + if (v <= 0x4f) { + if (table[v]) return 0xab00 | table[v]; + } else if (v <= 0x57) { + if (table[v]) return 0x1300 | table[v]; + } + #endif + + return uc; +} + +static unsigned int tolower_1c90_1cbf(unsigned int uc) { + static unsigned char table[] = { + /* 0x001c90 - 0x001c97 */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + /* 0x001c98 - 0x001c9f */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + /* 0x001ca0 - 0x001ca7 */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + /* 0x001ca8 - 0x001caf */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + /* 0x001cb0 - 0x001cb7 */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + /* 0x001cb8 - 0x001cbf */ 0xf8, 0xf9, 0xfa, 0x00, 0x00, 0xfd, 0xfe, 0xff, + }; + + unsigned char v = uc - 0x1c90; + + if (table[v]) return 0x1000 | table[v]; + + return uc; +} + +static unsigned int tolower_1e00_1eff(unsigned int uc) { + #ifndef LATIN_EXTENDED_ADDITIONAL_DISABLE + static unsigned char table[] = { + /* 0x001e00 - 0x001e07 */ 0x01, 0x00, 0x03, 0x00, 0x05, 0x00, 0x07, 0x00, + /* 0x001e08 - 0x001e0f */ 0x09, 0x00, 0x0b, 0x00, 0x0d, 0x00, 0x0f, 0x00, + /* 0x001e10 - 0x001e17 */ 0x11, 0x00, 0x13, 0x00, 0x15, 0x00, 0x17, 0x00, + /* 0x001e18 - 0x001e1f */ 0x19, 0x00, 0x1b, 0x00, 0x1d, 0x00, 0x1f, 0x00, + /* 0x001e20 - 0x001e27 */ 0x21, 0x00, 0x23, 0x00, 0x25, 0x00, 0x27, 0x00, + /* 0x001e28 - 0x001e2f */ 0x29, 0x00, 0x2b, 0x00, 0x2d, 0x00, 0x2f, 0x00, + /* 0x001e30 - 0x001e37 */ 0x31, 0x00, 0x33, 0x00, 0x35, 0x00, 0x37, 0x00, + /* 0x001e38 - 0x001e3f */ 0x39, 0x00, 0x3b, 0x00, 0x3d, 0x00, 0x3f, 0x00, + /* 0x001e40 - 0x001e47 */ 0x41, 0x00, 0x43, 0x00, 0x45, 0x00, 0x47, 0x00, + /* 0x001e48 - 0x001e4f */ 0x49, 0x00, 0x4b, 0x00, 0x4d, 0x00, 0x4f, 0x00, + /* 0x001e50 - 0x001e57 */ 0x51, 0x00, 0x53, 0x00, 0x55, 0x00, 0x57, 0x00, + /* 0x001e58 - 0x001e5f */ 0x59, 0x00, 0x5b, 0x00, 0x5d, 0x00, 0x5f, 0x00, + /* 0x001e60 - 0x001e67 */ 0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x67, 0x00, + /* 0x001e68 - 0x001e6f */ 0x69, 0x00, 0x6b, 0x00, 0x6d, 0x00, 0x6f, 0x00, + /* 0x001e70 - 0x001e77 */ 0x71, 0x00, 0x73, 0x00, 0x75, 0x00, 0x77, 0x00, + /* 0x001e78 - 0x001e7f */ 0x79, 0x00, 0x7b, 0x00, 0x7d, 0x00, 0x7f, 0x00, + /* 0x001e80 - 0x001e87 */ 0x81, 0x00, 0x83, 0x00, 0x85, 0x00, 0x87, 0x00, + /* 0x001e88 - 0x001e8f */ 0x89, 0x00, 0x8b, 0x00, 0x8d, 0x00, 0x8f, 0x00, + /* 0x001e90 - 0x001e97 */ 0x91, 0x00, 0x93, 0x00, 0x95, 0x00, 0x00, 0x00, + /* 0x001e98 - 0x001e9f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001ea0 - 0x001ea7 */ 0xa1, 0x00, 0xa3, 0x00, 0xa5, 0x00, 0xa7, 0x00, + /* 0x001ea8 - 0x001eaf */ 0xa9, 0x00, 0xab, 0x00, 0xad, 0x00, 0xaf, 0x00, + /* 0x001eb0 - 0x001eb7 */ 0xb1, 0x00, 0xb3, 0x00, 0xb5, 0x00, 0xb7, 0x00, + /* 0x001eb8 - 0x001ebf */ 0xb9, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0xbf, 0x00, + /* 0x001ec0 - 0x001ec7 */ 0xc1, 0x00, 0xc3, 0x00, 0xc5, 0x00, 0xc7, 0x00, + /* 0x001ec8 - 0x001ecf */ 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0x00, 0xcf, 0x00, + /* 0x001ed0 - 0x001ed7 */ 0xd1, 0x00, 0xd3, 0x00, 0xd5, 0x00, 0xd7, 0x00, + /* 0x001ed8 - 0x001edf */ 0xd9, 0x00, 0xdb, 0x00, 0xdd, 0x00, 0xdf, 0x00, + /* 0x001ee0 - 0x001ee7 */ 0xe1, 0x00, 0xe3, 0x00, 0xe5, 0x00, 0xe7, 0x00, + /* 0x001ee8 - 0x001eef */ 0xe9, 0x00, 0xeb, 0x00, 0xed, 0x00, 0xef, 0x00, + /* 0x001ef0 - 0x001ef7 */ 0xf1, 0x00, 0xf3, 0x00, 0xf5, 0x00, 0xf7, 0x00, + /* 0x001ef8 - 0x001eff */ 0xf9, 0x00, 0xfb, 0x00, 0xfd, 0x00, 0xff, 0x00, + }; + + unsigned char v = uc - 0x1e00; + + if (table[v]) return 0x1e00 | table[v]; + + switch (v) { default: break; + case 0x9e: return 0xdf; + } + #endif + + return uc; +} + +static unsigned int tolower_1f00_1fff(unsigned int uc) { + #ifndef GREEK_EXTENDED_DISABLE + static unsigned char table[] = { + /* 0x001f00 - 0x001f07 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f08 - 0x001f0f */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + /* 0x001f10 - 0x001f17 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f18 - 0x001f1f */ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x00, 0x00, + /* 0x001f20 - 0x001f27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f28 - 0x001f2f */ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, + /* 0x001f30 - 0x001f37 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f38 - 0x001f3f */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, + /* 0x001f40 - 0x001f47 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f48 - 0x001f4f */ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x00, 0x00, + /* 0x001f50 - 0x001f57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f58 - 0x001f5f */ 0x00, 0x52, 0x00, 0x54, 0x00, 0x56, 0x00, 0x58, + /* 0x001f60 - 0x001f67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f68 - 0x001f6f */ 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, + /* 0x001f70 - 0x001f77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f78 - 0x001f7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f80 - 0x001f87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f88 - 0x001f8f */ 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, + /* 0x001f90 - 0x001f97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f98 - 0x001f9f */ 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, + /* 0x001fa0 - 0x001fa7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001fa8 - 0x001faf */ 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, + /* 0x001fb0 - 0x001fb7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001fb8 - 0x001fbf */ 0xb1, 0xb2, 0x71, 0x72, 0x00, 0x00, 0x00, 0x00, + /* 0x001fc0 - 0x001fc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001fc8 - 0x001fcf */ 0x73, 0x74, 0x75, 0x76, 0xc4, 0x00, 0x00, 0x00, + /* 0x001fd0 - 0x001fd7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001fd8 - 0x001fdf */ 0xd1, 0xd2, 0x77, 0x78, 0x00, 0x00, 0x00, 0x00, + /* 0x001fe0 - 0x001fe7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001fe8 - 0x001fef */ 0xe1, 0xe2, 0x7b, 0x7c, 0xe6, 0x00, 0x00, 0x00, + /* 0x001ff0 - 0x001ff7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001ff8 - 0x001fff */ 0x79, 0x7a, 0x7d, 0x7e, 0xf4, 0x00, 0x00, 0x00, + }; + + unsigned char v = uc - 0x1f00; + + if (table[v]) return 0x1f00 | table[v] - 1; + #endif + + return uc; +} + +static unsigned int tolower_2c00_2cff(unsigned int uc) { + + #if !defined(GLAGOLITIC_DISABLE) || !defined(LATIN_EXTENDED_C_DISABLE) || !defined(COPTIC_DISABLE) + #ifndef GLAGOLITIC_DISABLE + static unsigned char table_2c00[] = { + /* 0x002c00 - 0x002c07 */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + /* 0x002c08 - 0x002c0f */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + /* 0x002c10 - 0x002c17 */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + /* 0x002c18 - 0x002c1f */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + /* 0x002c20 - 0x002c27 */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + /* 0x002c28 - 0x002c2f */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x00, + }; + #endif + + static unsigned char table_2c60[] = { + #ifndef LATIN_EXTENDED_C_DISABLE + /* 0x002c60 - 0x002c67 */ 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, + /* 0x002c68 - 0x002c6f */ 0x00, 0x6a, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, + /* 0x002c70 - 0x002c77 */ 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x002c78 - 0x002c7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + #endif + #ifndef COPTIC_DISABLE + /* 0x002c80 - 0x002c87 */ 0x81, 0x00, 0x83, 0x00, 0x85, 0x00, 0x87, 0x00, + /* 0x002c88 - 0x002c8f */ 0x89, 0x00, 0x8b, 0x00, 0x8d, 0x00, 0x8f, 0x00, + /* 0x002c90 - 0x002c97 */ 0x91, 0x00, 0x93, 0x00, 0x95, 0x00, 0x97, 0x00, + /* 0x002c98 - 0x002c9f */ 0x99, 0x00, 0x9b, 0x00, 0x9d, 0x00, 0x9f, 0x00, + /* 0x002ca0 - 0x002ca7 */ 0xa1, 0x00, 0xa3, 0x00, 0xa5, 0x00, 0xa7, 0x00, + /* 0x002ca8 - 0x002caf */ 0xa9, 0x00, 0xab, 0x00, 0xad, 0x00, 0xaf, 0x00, + /* 0x002cb0 - 0x002cb7 */ 0xb1, 0x00, 0xb3, 0x00, 0xb5, 0x00, 0xb7, 0x00, + /* 0x002cb8 - 0x002cbf */ 0xb9, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0xbf, 0x00, + /* 0x002cc0 - 0x002cc7 */ 0xc1, 0x00, 0xc3, 0x00, 0xc5, 0x00, 0xc7, 0x00, + /* 0x002cc8 - 0x002ccf */ 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0x00, 0xcf, 0x00, + /* 0x002cd0 - 0x002cd7 */ 0xd1, 0x00, 0xd3, 0x00, 0xd5, 0x00, 0xd7, 0x00, + /* 0x002cd8 - 0x002cdf */ 0xd9, 0x00, 0xdb, 0x00, 0xdd, 0x00, 0xdf, 0x00, + /* 0x002ce0 - 0x002ce7 */ 0xe1, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x002ce8 - 0x002cef */ 0x00, 0x00, 0x00, 0xec, 0x00, 0xee, 0x00, 0x00, + /* 0x002cf0 - 0x002cf7 */ 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, + #endif + }; + + unsigned char v = uc - 0x002c00; + + if (v <= 0x2f) { + #ifndef GLAGOLITIC_DISABLE + if (table_2c00[v]) return 0x2c00 | table_2c00[v]; + #endif + } else if (v >= 0x60) { + + #if !defined(LATIN_EXTENDED_C_DISABLE) + #if defined(COPTIC_DISABLE) + if (uc >= 0x2c80) return uc; + #endif + if (table_2c60[v -= 0x60]) return 0x2c00 | table_2c60[v]; + #elif defined(LATIN_EXTENDED_C_DISABLE) &&!defined(COPTIC_DISABLE) + if (uc <= 0x2c7f) return uc; + if (table_2c60[v -= 0x80]) return 0x2c00 | table_2c60[v]; + #endif + + #if !defined(LATIN_EXTENDED_C_DISABLE) + switch (v) { default: break; + + #if !defined(PHONETIC_EXTENSIONS_DISABLE) + case 0x03: return 0x001d7d; + #endif + #ifndef LATIN_EXTENDED_B_DISABLE + case 0x02: return 0x00026b; + case 0x04: return 0x00027d; + case 0x0d: return 0x000251; + case 0x0e: return 0x000271; + case 0x0f: return 0x000250; + case 0x10: return 0x000252; + case 0x1e: return 0x00023f; + case 0x1f: return 0x000240; + #endif + } + } + #endif + #endif + + return uc; +} + +static unsigned int tolower_a640_a69f(unsigned int uc) { + #ifndef CYRILLIC_EXTENDED_B_DISABLE + static unsigned char table[] = { + /* 0x00a640 - 0x00a647 */ 0x41, 0x00, 0x43, 0x00, 0x45, 0x00, 0x47, 0x00, + /* 0x00a648 - 0x00a64f */ 0x49, 0x00, 0x4b, 0x00, 0x4d, 0x00, 0x4f, 0x00, + /* 0x00a650 - 0x00a657 */ 0x51, 0x00, 0x53, 0x00, 0x55, 0x00, 0x57, 0x00, + /* 0x00a658 - 0x00a65f */ 0x59, 0x00, 0x5b, 0x00, 0x5d, 0x00, 0x5f, 0x00, + /* 0x00a660 - 0x00a667 */ 0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x67, 0x00, + /* 0x00a668 - 0x00a66f */ 0x69, 0x00, 0x6b, 0x00, 0x6d, 0x00, 0x00, 0x00, + /* 0x00a670 - 0x00a677 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00a678 - 0x00a67f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00a680 - 0x00a687 */ 0x81, 0x00, 0x83, 0x00, 0x85, 0x00, 0x87, 0x00, + /* 0x00a688 - 0x00a68f */ 0x89, 0x00, 0x8b, 0x00, 0x8d, 0x00, 0x8f, 0x00, + /* 0x00a690 - 0x00a697 */ 0x91, 0x00, 0x93, 0x00, 0x95, 0x00, 0x97, 0x00, + /* 0x00a698 - 0x00a69f */ 0x99, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + + unsigned char v = uc - 0xa640; + + if (table[v]) return 0xa600 | table[v]; + #endif + + return uc; +} + +static unsigned int tolower_a720_a7cf(unsigned int uc) { + #ifndef LATIN_EXTENDED_D_DISABLE + static unsigned char table[] = { + /* 0x00a720 - 0x00a727 */ 0x00, 0x00, 0x23, 0x00, 0x25, 0x00, 0x27, 0x00, + /* 0x00a728 - 0x00a72f */ 0x29, 0x00, 0x2b, 0x00, 0x2d, 0x00, 0x2f, 0x00, + /* 0x00a730 - 0x00a737 */ 0x00, 0x00, 0x33, 0x00, 0x35, 0x00, 0x37, 0x00, + /* 0x00a738 - 0x00a73f */ 0x39, 0x00, 0x3b, 0x00, 0x3d, 0x00, 0x3f, 0x00, + /* 0x00a740 - 0x00a747 */ 0x41, 0x00, 0x43, 0x00, 0x45, 0x00, 0x47, 0x00, + /* 0x00a748 - 0x00a74f */ 0x49, 0x00, 0x4b, 0x00, 0x4d, 0x00, 0x4f, 0x00, + /* 0x00a750 - 0x00a757 */ 0x51, 0x00, 0x53, 0x00, 0x55, 0x00, 0x57, 0x00, + /* 0x00a758 - 0x00a75f */ 0x59, 0x00, 0x5b, 0x00, 0x5d, 0x00, 0x5f, 0x00, + /* 0x00a760 - 0x00a767 */ 0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x67, 0x00, + /* 0x00a768 - 0x00a76f */ 0x69, 0x00, 0x6b, 0x00, 0x6d, 0x00, 0x6f, 0x00, + /* 0x00a770 - 0x00a777 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00a778 - 0x00a77f */ 0x00, 0x7a, 0x00, 0x7c, 0x00, 0x00, 0x7f, 0x00, + /* 0x00a780 - 0x00a787 */ 0x81, 0x00, 0x83, 0x00, 0x85, 0x00, 0x87, 0x00, + /* 0x00a788 - 0x00a78f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00a790 - 0x00a797 */ 0x91, 0x00, 0x93, 0x00, 0x00, 0x00, 0x97, 0x00, + /* 0x00a798 - 0x00a79f */ 0x99, 0x00, 0x9b, 0x00, 0x9d, 0x00, 0x9f, 0x00, + /* 0x00a7a0 - 0x00a7a7 */ 0xa1, 0x00, 0xa3, 0x00, 0xa5, 0x00, 0xa7, 0x00, + /* 0x00a7a8 - 0x00a7af */ 0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00a7b0 - 0x00a7b7 */ 0x00, 0x00, 0x00, 0x00, 0xb5, 0x00, 0xb7, 0x00, + /* 0x00a7b8 - 0x00a7bf */ 0xb9, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0xbf, 0x00, + /* 0x00a7c0 - 0x00a7c7 */ 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x00, 0xc8, + /* 0x00a7c8 - 0x00a7cf */ 0x00, 0xca, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + + unsigned char v = uc - 0xa720; + + if (table[v]) return 0xa700 | table[v]; + + switch (v) { default: break; + + #ifndef PHONETIC_EXTENSIONS_DISABLE + case 0x5d: return 0x001d79; + #endif + #ifndef LATIN_EXTENDED_B_DISABLE + case 0x6d: return 0x000265; + case 0x8a: return 0x000266; + case 0x8b: return 0x00025c; + case 0x8c: return 0x000261; + case 0x8d: return 0x00026c; + case 0x8e: return 0x00026a; + case 0x90: return 0x00029e; + case 0x91: return 0x000287; + case 0x92: return 0x00029d; + #endif + #ifndef LATIN_EXTENDED_E_DISABLE + case 0x93: return 0x00ab53; + #endif + } + #endif + + return uc; +} + + + +static unsigned int tolower_010400_0104df(unsigned int uc) { + #ifndef DESERET_DISABLE + static unsigned char table_0400[] = { + /* 0x010400 - 0x010407 */ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + /* 0x010408 - 0x01040f */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + /* 0x010410 - 0x010417 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + /* 0x010418 - 0x01041f */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + /* 0x010420 - 0x010427 */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + }; + #endif + + #ifndef OSAGE_DISABLE + static unsigned char table_04b0[] = { + /* 0x0104b0 - 0x0104b7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + /* 0x0104b8 - 0x0104bf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + /* 0x0104c0 - 0x0104c7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + /* 0x0104c8 - 0x0104cf */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + /* 0x0104d0 - 0x0104d7 */ 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, + }; + #endif + + unsigned char v = uc - 0x010400; + + if (v <= 0x27) { + #ifndef DESERET_DISABLE + if (table_0400[v]) return 0x010400 | table_0400[v]; + #endif + } else if (v >= 0xb0 && v <= 0xd7) { + #ifndef OSAGE_DISABLE + if (table_04b0[v -= 0xb0]) return 0x010400 | table_04b0[v]; + #endif + } + + return uc; +} + +static unsigned int tolower_010c80_010cbf(unsigned int uc) { + #ifndef OLD_HUNGARIAN_DISABLE + static unsigned char table[] = { + /* 0x010c80 - 0x010c87 */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + /* 0x010c88 - 0x010c8f */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + /* 0x010c90 - 0x010c97 */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + /* 0x010c98 - 0x010c9f */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + /* 0x010ca0 - 0x010ca7 */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + /* 0x010ca8 - 0x010caf */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + /* 0x010cb0 - 0x010cb7 */ 0xf0, 0xf1, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + + if (uc <= 0x010cb7) { + unsigned char v = uc - 0x010c80; + + if (table[v]) return 0x010c00 | table[v]; + } + #endif + + return uc; +} + +static unsigned int tolower_0118a0_0118bf(unsigned int uc) { + #ifndef WARANG_CITI_DISABLE + static unsigned char table[] = { + /* 0x0118a0 - 0x0118a7 */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + /* 0x0118a8 - 0x0118af */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + /* 0x0118b0 - 0x0118b7 */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + /* 0x0118b8 - 0x0118bf */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, + }; + + unsigned char v = uc - 0x0118a0; + + return 0x011800 | table[v]; + #else + return uc; + #endif +} + + + +unsigned int tolower_unicode(unsigned int uc) { + + if (uc <= 0x005a) return (uc >= 0x0041) ? uc | 0x20 : uc; + + if (uc <= 0x042f) { + if (uc >= 0x0410) return uc + 0x20; + if (uc >= 0x0400) return uc + 0x50; + + if (uc <= 0x00df) return (uc >= 0x00c0) ? tolower_00c0_00df(uc) : uc; + if (uc <= 0x01ff) return (uc >= 0x0100) ? tolower_0100_01ff(uc) : uc; + if (uc <= 0x024f) return (uc >= 0x0200) ? tolower_0200_024f(uc) : uc; + if (uc <= 0x03ff) return (uc >= 0x0370) ? tolower_0370_03ff(uc) : uc; + + return uc; + } + + if (uc <= 0x04ff && uc >= 0x0460) return tolower_0460_04ff(uc); + if (uc <= 0x055f && uc >= 0x0500) return tolower_0500_055f(uc); + if (uc <= 0x10cf && uc >= 0x10a0) return tolower_10a0_10cf(uc); + if (uc <= 0x13ff && uc >= 0x13a0) return tolower_13a0_13ff(uc); + if (uc <= 0x1cbf && uc >= 0x1c90) return tolower_1c90_1cbf(uc); + if (uc <= 0x1eff && uc >= 0x1e00) return tolower_1e00_1eff(uc); + if (uc <= 0x1fff && uc >= 0x1f00) return tolower_1f00_1fff(uc); + if (uc <= 0x2cff && uc >= 0x2c00) return tolower_2c00_2cff(uc); + if (uc <= 0xa69f && uc >= 0xa640) return tolower_a640_a69f(uc); + if (uc <= 0xa7cf && uc >= 0xa720) return tolower_a720_a7cf(uc); + + if (uc <= 0x0104df && uc >= 0x010400) return tolower_010400_0104df(uc); + if (uc <= 0x010cbf && uc >= 0x010c80) return tolower_010c80_010cbf(uc); + if (uc <= 0x0118bf && uc >= 0x0118a0) return tolower_0118a0_0118bf(uc); + + return uc; +} diff --git a/case_switch/toupper_unicode.c b/case_switch/toupper_unicode.c new file mode 100644 index 0000000..2dc3073 --- /dev/null +++ b/case_switch/toupper_unicode.c @@ -0,0 +1,716 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../build.h" + +static unsigned int toupper_00d0_00ff(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_0100_01ff(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_0200_029f(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_0370_03ff(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_0450_04ff(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_0500_058f(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_10d0_10ff(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_13f0_13ff(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_1c80_1c8f(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_1d70_1d7f(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_1e00_1eff(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_1f00_1fff(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_2c30_2cff(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_2d00_2d2f(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_a640_a69f(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_a720_a7cf(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_ab70_abbf(unsigned int uc) __attribute__((noinline)); + +static unsigned int toupper_010420_0104ff(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_010cc0_010cff(unsigned int uc) __attribute__((noinline)); +static unsigned int toupper_0118c0_0118df(unsigned int uc) __attribute__((noinline)); + + +static unsigned int toupper_00d0_00ff(unsigned int uc) { + if (uc <= 0x00fe) { + if (uc >= 0x00e0 && uc != 0x00f7) return uc ^ 0x20; + + #ifndef LATIN_EXTENDED_ADDITIONAL_DISABLE + if (uc == 0x00df) return 0x1e9e; + #endif + return uc; + } + + return (uc == 0x00ff) ? 0x0178 : uc; +} + +static unsigned int toupper_0100_01ff(unsigned int uc) { + + static unsigned char table[] = { + /* 0x000100 - 0x000107 */ 0x00, 0x01, 0x00, 0x03, 0x00, 0x05, 0x00, 0x07, + /* 0x000108 - 0x00010f */ 0x00, 0x09, 0x00, 0x0b, 0x00, 0x0d, 0x00, 0x0f, + /* 0x000110 - 0x000117 */ 0x00, 0x11, 0x00, 0x13, 0x00, 0x15, 0x00, 0x17, + /* 0x000118 - 0x00011f */ 0x00, 0x19, 0x00, 0x1b, 0x00, 0x1d, 0x00, 0x1f, + /* 0x000120 - 0x000127 */ 0x00, 0x21, 0x00, 0x23, 0x00, 0x25, 0x00, 0x27, + /* 0x000128 - 0x00012f */ 0x00, 0x29, 0x00, 0x2b, 0x00, 0x2d, 0x00, 0x2f, + /* 0x000130 - 0x000137 */ 0x00, 0x31, 0x00, 0x33, 0x00, 0x35, 0x00, 0x37, + /* 0x000138 - 0x00013f */ 0x00, 0x00, 0x3a, 0x00, 0x3c, 0x00, 0x3e, 0x00, + /* 0x000140 - 0x000147 */ 0x40, 0x00, 0x42, 0x00, 0x44, 0x00, 0x46, 0x00, + /* 0x000148 - 0x00014f */ 0x48, 0x00, 0x00, 0x4b, 0x00, 0x4d, 0x00, 0x4f, + /* 0x000150 - 0x000157 */ 0x00, 0x51, 0x00, 0x53, 0x00, 0x55, 0x00, 0x57, + /* 0x000158 - 0x00015f */ 0x00, 0x59, 0x00, 0x5b, 0x00, 0x5d, 0x00, 0x5f, + /* 0x000160 - 0x000167 */ 0x00, 0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x67, + /* 0x000168 - 0x00016f */ 0x00, 0x69, 0x00, 0x6b, 0x00, 0x6d, 0x00, 0x6f, + /* 0x000170 - 0x000177 */ 0x00, 0x71, 0x00, 0x73, 0x00, 0x75, 0x00, 0x77, + /* 0x000178 - 0x00017f */ 0x00, 0x00, 0x7a, 0x00, 0x7c, 0x00, 0x7e, 0x00, + + #ifndef LATIN_EXTENDED_B_DISABLE + /* 0x000180 - 0x000187 */ 0x00, 0x00, 0x00, 0x83, 0x00, 0x85, 0x00, 0x00, + /* 0x000188 - 0x00018f */ 0x88, 0x00, 0x8a, 0x00, 0x8c, 0x00, 0x8e, 0x00, + /* 0x000190 - 0x000197 */ 0x90, 0x00, 0x92, 0x00, 0x00, 0xf7, 0x00, 0x00, + /* 0x000198 - 0x00019f */ 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0001a0 - 0x0001a7 */ 0x00, 0xa1, 0x00, 0xa3, 0x00, 0xa5, 0x00, 0xa7, + /* 0x0001a8 - 0x0001af */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, + /* 0x0001b0 - 0x0001b7 */ 0xb0, 0x00, 0x00, 0x00, 0xb4, 0x00, 0xb6, 0x00, + /* 0x0001b8 - 0x0001bf */ 0x00, 0xb9, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, + /* 0x0001c0 - 0x0001c7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc5, 0x00, + /* 0x0001c8 - 0x0001cf */ 0x00, 0xc8, 0x00, 0x00, 0xcb, 0x00, 0xce, 0x00, + /* 0x0001d0 - 0x0001d7 */ 0xd0, 0x00, 0xd2, 0x00, 0xd4, 0x00, 0xd6, 0x00, + /* 0x0001d8 - 0x0001df */ 0xd8, 0x00, 0xda, 0x00, 0xdc, 0x8f, 0x00, 0xdf, + /* 0x0001e0 - 0x0001e7 */ 0x00, 0xe1, 0x00, 0xe3, 0x00, 0xe5, 0x00, 0xe7, + /* 0x0001e8 - 0x0001ef */ 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0x00, 0xef, + /* 0x0001f0 - 0x0001f7 */ 0x00, 0x00, 0x00, 0xf2, 0x00, 0xf5, 0x00, 0x00, + /* 0x0001f8 - 0x0001ff */ 0x00, 0xf9, 0x00, 0xfb, 0x00, 0xfd, 0x00, 0xff, + #endif + }; + + #ifdef LATIN_EXTENDED_B_DISABLE + if (uc >= 0x0180) return uc; + #endif + + unsigned char v = uc - 0x0100; + + if (table[v]) return 0x0100 | (table[v]-1); + + #ifndef LATIN_EXTENDED_B_DISABLE + if (v == 0x80) return 0x0243; + if (v == 0x9a) return 0x023d; + if (v == 0x9e) return 0x0220; + #endif + + return uc; +} + +static unsigned int toupper_0200_029f(unsigned int uc) { + + #if !defined(LATIN_EXTENDED_B_DISABLE) || !defined(IPA_EXTENSIONS_DISABLE) + static unsigned short table[] = { + + # ifndef LATIN_EXTENDED_B_DISABLE + /* 0x000200 - 0x000207 */ 0x0000, 0x0200, 0x0000, 0x0202, 0x0000, 0x0204, 0x0000, 0x0206, + /* 0x000208 - 0x00020f */ 0x0000, 0x0208, 0x0000, 0x020a, 0x0000, 0x020c, 0x0000, 0x020e, + /* 0x000210 - 0x000217 */ 0x0000, 0x0210, 0x0000, 0x0212, 0x0000, 0x0214, 0x0000, 0x0216, + /* 0x000218 - 0x00021f */ 0x0000, 0x0218, 0x0000, 0x021a, 0x0000, 0x021c, 0x0000, 0x021e, + /* 0x000220 - 0x000227 */ 0x0000, 0x0000, 0x0000, 0x0222, 0x0000, 0x0224, 0x0000, 0x0226, + /* 0x000228 - 0x00022f */ 0x0000, 0x0228, 0x0000, 0x022a, 0x0000, 0x022c, 0x0000, 0x022e, + /* 0x000230 - 0x000237 */ 0x0000, 0x0230, 0x0000, 0x0232, 0x0000, 0x0000, 0x0000, 0x0000, + # ifndef LATIN_EXTENDED_C_DISABLE + /* 0x000238 - 0x00023f */ 0x0000, 0x0000, 0x0000, 0x0000, 0x023b, 0x023c, 0x0000, 0x2c7e, + /* 0x000240 - 0x000247 */ 0x2c7f, 0x0000, 0x0241, 0x0000, 0x0000, 0x0000, 0x0000, 0x0246, + # else + /* 0x000238 - 0x00023f */ 0x0000, 0x0000, 0x0000, 0x0000, 0x023b, 0x023c, 0x0000, 0x0000, + /* 0x000240 - 0x000247 */ 0x0000, 0x0000, 0x0241, 0x0000, 0x0000, 0x0000, 0x0000, 0x0246, + # endif + /* 0x000248 - 0x00024f */ 0x0000, 0x0248, 0x0000, 0x024a, 0x0000, 0x024c, 0x0000, 0x024e, + # endif + + # ifndef IPA_EXTENSIONS_DISABLE + + # ifndef LATIN_EXTENDED_C_DISABLE + /* 0x000250 - 0x000257 */ 0x2c6f, 0x2c6d, 0x2c70, 0x0181, 0x0186, 0x0000, 0x0000, 0x0000, + # else + /* 0x000250 - 0x000257 */ 0x0000, 0x0000, 0x0000, 0x0181, 0x0186, 0x0000, 0x0000, 0x0000, + # endif + + # ifndef LATIN_EXTENDED_D_DISABLE + /* 0x000258 - 0x00025f */ 0x0000, 0x01bf, 0x0000, 0x0190, 0xa7ab, 0x0000, 0x0000, 0x0000, + /* 0x000260 - 0x000267 */ 0x0193, 0xa7ac, 0x0000, 0x0194, 0x0000, 0xa78d, 0xa7aa, 0x0000, + # ifndef LATIN_EXTENDED_C_DISABLE + /* 0x000268 - 0x00026f */ 0x0197, 0x0196, 0xa7ae, 0x2c62, 0xa7ad, 0x0000, 0x0000, 0x019c, + # else + /* 0x000268 - 0x00026f */ 0x0197, 0x0196, 0xa7ae, 0x0000, 0xa7ad, 0x0000, 0x0000, 0x019c, + # endif + # else + /* 0x000258 - 0x00025f */ 0x0000, 0x01bf, 0x0000, 0x0190, 0x0000, 0x0000, 0x0000, 0x0000, + /* 0x000260 - 0x000267 */ 0x0193, 0x0000, 0x0000, 0x0194, 0x0000, 0x0000, 0x0000, 0x0000, + # ifndef LATIN_EXTENDED_C_DISABLE + /* 0x000268 - 0x00026f */ 0x0197, 0x0196, 0x0000, 0x2c62, 0x0000, 0x0000, 0x0000, 0x019c, + # else + /* 0x000268 - 0x00026f */ 0x0197, 0x0196, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x019c, + # endif + # endif + + # ifndef LATIN_EXTENDED_C_DISABLE + /* 0x000270 - 0x000277 */ 0x0000, 0x2c6e, 0x019d, 0x0000, 0x0000, 0x019f, 0x0000, 0x0000, + /* 0x000278 - 0x00027f */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2c64, 0x0000, 0x0000, + # else + /* 0x000270 - 0x000277 */ 0x0000, 0x0000, 0x019d, 0x0000, 0x0000, 0x019f, 0x0000, 0x0000, + /* 0x000278 - 0x00027f */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + # endif + + # ifndef LATIN_EXTENDED_D_DISABLE + /* 0x000280 - 0x000287 */ 0x01a6, 0x0000, 0x0000, 0x01a9, 0x0000, 0x0000, 0x0000, 0xa7b1, + # else + /* 0x000280 - 0x000287 */ 0x01a6, 0x0000, 0x0000, 0x01a9, 0x0000, 0x0000, 0x0000, 0x0000, + # endif + + /* 0x000288 - 0x00028f */ 0x01ae, 0x0244, 0x01b1, 0x01b2, 0x0245, 0x0000, 0x0000, 0x0000, + /* 0x000290 - 0x000297 */ 0x0000, 0x0000, 0x01b7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + + # ifndef LATIN_EXTENDED_D_DISABLE + /* 0x000298 - 0x00029f */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa7b2, 0xa7b0, 0x0000, + # else + /* 0x000298 - 0x00029f */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + # endif + + # endif + }; + + # if defined(LATIN_EXTENDED_B_DISABLE) + if (uc <= 0x024f) return uc; + # elif defined(IPA_EXTENSIONS_DISABLE) + if (uc >= 0x0250) return uc; + # endif + + unsigned char v = uc - 0x0200; + + if (table[v]) return table[v]; + #endif + return uc; +} + +static unsigned int toupper_0370_03ff(unsigned int uc) { + static unsigned char table[] = { + /* 0x000370 - 0x000377 */ 0x00, 0x70, 0x00, 0x72, 0x00, 0x00, 0x00, 0x76, + /* 0x000378 - 0x00037f */ 0x00, 0x00, 0x00, 0xfd, 0xfe, 0xff, 0x00, 0x00, + /* 0x000380 - 0x000387 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x000388 - 0x00038f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x000390 - 0x000397 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x000398 - 0x00039f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0003a0 - 0x0003a7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0003a8 - 0x0003af */ 0x00, 0x00, 0x00, 0x00, 0x86, 0x88, 0x89, 0x8a, + /* 0x0003b0 - 0x0003b7 */ 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + /* 0x0003b8 - 0x0003bf */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + /* 0x0003c0 - 0x0003c7 */ 0xa0, 0xa1, 0xa3, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + /* 0x0003c8 - 0x0003cf */ 0xa8, 0xa9, 0xaa, 0xab, 0x8c, 0x8e, 0x8f, 0x00, + /* 0x0003d0 - 0x0003d7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0003d8 - 0x0003df */ 0x00, 0xd8, 0x00, 0xda, 0x00, 0xdc, 0x00, 0xde, + /* 0x0003e0 - 0x0003e7 */ 0x00, 0xe0, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, + /* 0x0003e8 - 0x0003ef */ 0x00, 0xe8, 0x00, 0xea, 0x00, 0xec, 0x00, 0xee, + /* 0x0003f0 - 0x0003f7 */ 0x9a, 0xa1, 0xf9, 0x7f, 0x00, 0x95, 0x00, 0x00, + /* 0x0003f8 - 0x0003ff */ 0xf7, 0x00, 0x00, 0xfa, 0x00, 0x00, 0x00, 0x00, + }; + + unsigned char v = uc - 0x0370; + + if (table[v]) return 0x0300 | table[v]; + + return uc; +} + +static unsigned int toupper_0450_04ff(unsigned int uc) { + static unsigned char table[] = { + /* 0x0450 - 0x0457 */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + /* 0x0458 - 0x045f */ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, + /* 0x0460 - 0x0467 */ 0x00, 0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x67, + /* 0x0468 - 0x046f */ 0x00, 0x69, 0x00, 0x6b, 0x00, 0x6d, 0x00, 0x6f, + /* 0x0470 - 0x0477 */ 0x00, 0x71, 0x00, 0x73, 0x00, 0x75, 0x00, 0x77, + /* 0x0478 - 0x047f */ 0x00, 0x79, 0x00, 0x7b, 0x00, 0x7d, 0x00, 0x7f, + /* 0x0480 - 0x0487 */ 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0488 - 0x048f */ 0x00, 0x00, 0x00, 0x8b, 0x00, 0x8d, 0x00, 0x8f, + /* 0x0490 - 0x0497 */ 0x00, 0x91, 0x00, 0x93, 0x00, 0x95, 0x00, 0x97, + /* 0x0498 - 0x049f */ 0x00, 0x99, 0x00, 0x9b, 0x00, 0x9d, 0x00, 0x9f, + /* 0x04a0 - 0x04a7 */ 0x00, 0xa1, 0x00, 0xa3, 0x00, 0xa5, 0x00, 0xa7, + /* 0x04a8 - 0x04af */ 0x00, 0xa9, 0x00, 0xab, 0x00, 0xad, 0x00, 0xaf, + /* 0x04b0 - 0x04b7 */ 0x00, 0xb1, 0x00, 0xb3, 0x00, 0xb5, 0x00, 0xb7, + /* 0x04b8 - 0x04bf */ 0x00, 0xb9, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0xbf, + /* 0x04c0 - 0x04c7 */ 0x00, 0x00, 0xc2, 0x00, 0xc4, 0x00, 0xc6, 0x00, + /* 0x04c8 - 0x04cf */ 0xc8, 0x00, 0xca, 0x00, 0xcc, 0x00, 0xce, 0xc1, + /* 0x04d0 - 0x04d7 */ 0x00, 0xd1, 0x00, 0xd3, 0x00, 0xd5, 0x00, 0xd7, + /* 0x04d8 - 0x04df */ 0x00, 0xd9, 0x00, 0xdb, 0x00, 0xdd, 0x00, 0xdf, + /* 0x04e0 - 0x04e7 */ 0x00, 0xe1, 0x00, 0xe3, 0x00, 0xe5, 0x00, 0xe7, + /* 0x04e8 - 0x04ef */ 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0x00, 0xef, + /* 0x04f0 - 0x04f7 */ 0x00, 0xf1, 0x00, 0xf3, 0x00, 0xf5, 0x00, 0xf7, + /* 0x04f8 - 0x04ff */ 0x00, 0xf9, 0x00, 0xfb, 0x00, 0xfd, 0x00, 0xff, + }; + + unsigned char v = uc - 0x0450; + + if (table[v]) return 0x0400 | (table[v]-1); + + return uc; +} + +static unsigned int toupper_0500_058f(unsigned int uc) { + #ifndef CYRILLIC_SUPLEMENT_DISABLE + static unsigned char table_0500[] = { + /* 0x0500 - 0x0507 */ 0x00, 0x01, 0x00, 0x03, 0x00, 0x05, 0x00, 0x07, + /* 0x0508 - 0x050f */ 0x00, 0x09, 0x00, 0x0b, 0x00, 0x0d, 0x00, 0x0f, + /* 0x0510 - 0x0517 */ 0x00, 0x11, 0x00, 0x13, 0x00, 0x15, 0x00, 0x17, + /* 0x0518 - 0x051f */ 0x00, 0x19, 0x00, 0x1b, 0x00, 0x1d, 0x00, 0x1f, + /* 0x0520 - 0x0527 */ 0x00, 0x21, 0x00, 0x23, 0x00, 0x25, 0x00, 0x27, + /* 0x0528 - 0x052f */ 0x00, 0x29, 0x00, 0x2b, 0x00, 0x2d, 0x00, 0x2f, + }; + #endif + + static unsigned char table_0560[] = { + /* 0x0560 - 0x0567 */ 0x00, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + /* 0x0568 - 0x056f */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + /* 0x0570 - 0x0577 */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + /* 0x0578 - 0x057f */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + /* 0x0580 - 0x0587 */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x00, + /* 0x0588 - 0x058f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + + unsigned char v = uc - 0x0500; + + #ifndef CYRILLIC_SUPLEMENT_DISABLE + if (v < 0x30 && table_0500[v ]) return 0x0500 | (table_0500[v]-1); + #endif + if (v > 0x60 && table_0560[v -= 0x60]) return 0x0500 | table_0560[v]; + + return uc; +} + +static unsigned int toupper_10d0_10ff(unsigned int uc) { + static unsigned char table[] = { + /* 0x0010d0 - 0x0010d7 */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + /* 0x0010d8 - 0x0010df */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + /* 0x0010e0 - 0x0010e7 */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + /* 0x0010e8 - 0x0010ef */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + /* 0x0010f0 - 0x0010f7 */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + /* 0x0010f8 - 0x0010ff */ 0xb8, 0xb9, 0xba, 0x00, 0x00, 0xbd, 0xbe, 0xbf, + }; + + unsigned char v = uc - 0x10d0; + + if (table[v]) return 0x1c00 | table[v]; + + return uc; +} + +static unsigned int toupper_13f0_13ff(unsigned int uc) { + #ifndef CHEROKEE_DISABLE + static unsigned char table[] = { + /* 0x0013f0 - 0x0013f7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0013f8 - 0x0013ff */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0x00, 0x00, + }; + + unsigned char v = uc - 0x13f0; + + if (table[v]) return 0x1300 | table[v]; + #endif + + return uc; +} + +static unsigned int toupper_1c80_1c8f(unsigned int uc) { + #ifndef CYRILLIC_EXTENDED_C_DISABLE + static unsigned char table[] = { + /* 0x001c80 - 0x001c87 */ 0x12, 0x14, 0x1e, 0x21, 0x22, 0x22, 0x2a, 0x62, + }; + + if (uc <= 0x1c87) return 0x0400 | table[uc-0x1c80]; + #ifndef CYRILLIC_EXTENDED_B_DISABLE + if (uc == 0x1c88) return 0xa64a; + #endif + #endif + + return uc; +} + +static unsigned int toupper_1d70_1d7f(unsigned int uc) { + #ifndef PHONETIC_EXTENSIONS_DISABLE + if (uc == 0x1d79) return 0xa77d; + if (uc == 0x1d7d) return 0x2c63; + #endif + + return uc; +} + +static unsigned int toupper_1e00_1eff(unsigned int uc) { + #ifndef LATIN_EXTENDED_ADDITIONAL_DISABLE + static unsigned char table[] = { + /* 0x001e00 - 0x001e07 */ 0x00, 0x01, 0x00, 0x03, 0x00, 0x05, 0x00, 0x07, + /* 0x001e08 - 0x001e0f */ 0x00, 0x09, 0x00, 0x0b, 0x00, 0x0d, 0x00, 0x0f, + /* 0x001e10 - 0x001e17 */ 0x00, 0x11, 0x00, 0x13, 0x00, 0x15, 0x00, 0x17, + /* 0x001e18 - 0x001e1f */ 0x00, 0x19, 0x00, 0x1b, 0x00, 0x1d, 0x00, 0x1f, + /* 0x001e20 - 0x001e27 */ 0x00, 0x21, 0x00, 0x23, 0x00, 0x25, 0x00, 0x27, + /* 0x001e28 - 0x001e2f */ 0x00, 0x29, 0x00, 0x2b, 0x00, 0x2d, 0x00, 0x2f, + /* 0x001e30 - 0x001e37 */ 0x00, 0x31, 0x00, 0x33, 0x00, 0x35, 0x00, 0x37, + /* 0x001e38 - 0x001e3f */ 0x00, 0x39, 0x00, 0x3b, 0x00, 0x3d, 0x00, 0x3f, + /* 0x001e40 - 0x001e47 */ 0x00, 0x41, 0x00, 0x43, 0x00, 0x45, 0x00, 0x47, + /* 0x001e48 - 0x001e4f */ 0x00, 0x49, 0x00, 0x4b, 0x00, 0x4d, 0x00, 0x4f, + /* 0x001e50 - 0x001e57 */ 0x00, 0x51, 0x00, 0x53, 0x00, 0x55, 0x00, 0x57, + /* 0x001e58 - 0x001e5f */ 0x00, 0x59, 0x00, 0x5b, 0x00, 0x5d, 0x00, 0x5f, + /* 0x001e60 - 0x001e67 */ 0x00, 0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x67, + /* 0x001e68 - 0x001e6f */ 0x00, 0x69, 0x00, 0x6b, 0x00, 0x6d, 0x00, 0x6f, + /* 0x001e70 - 0x001e77 */ 0x00, 0x71, 0x00, 0x73, 0x00, 0x75, 0x00, 0x77, + /* 0x001e78 - 0x001e7f */ 0x00, 0x79, 0x00, 0x7b, 0x00, 0x7d, 0x00, 0x7f, + /* 0x001e80 - 0x001e87 */ 0x00, 0x81, 0x00, 0x83, 0x00, 0x85, 0x00, 0x87, + /* 0x001e88 - 0x001e8f */ 0x00, 0x89, 0x00, 0x8b, 0x00, 0x8d, 0x00, 0x8f, + /* 0x001e90 - 0x001e97 */ 0x00, 0x91, 0x00, 0x93, 0x00, 0x95, 0x00, 0x00, + /* 0x001e98 - 0x001e9f */ 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, + /* 0x001ea0 - 0x001ea7 */ 0x00, 0xa1, 0x00, 0xa3, 0x00, 0xa5, 0x00, 0xa7, + /* 0x001ea8 - 0x001eaf */ 0x00, 0xa9, 0x00, 0xab, 0x00, 0xad, 0x00, 0xaf, + /* 0x001eb0 - 0x001eb7 */ 0x00, 0xb1, 0x00, 0xb3, 0x00, 0xb5, 0x00, 0xb7, + /* 0x001eb8 - 0x001ebf */ 0x00, 0xb9, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0xbf, + /* 0x001ec0 - 0x001ec7 */ 0x00, 0xc1, 0x00, 0xc3, 0x00, 0xc5, 0x00, 0xc7, + /* 0x001ec8 - 0x001ecf */ 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0x00, 0xcf, + /* 0x001ed0 - 0x001ed7 */ 0x00, 0xd1, 0x00, 0xd3, 0x00, 0xd5, 0x00, 0xd7, + /* 0x001ed8 - 0x001edf */ 0x00, 0xd9, 0x00, 0xdb, 0x00, 0xdd, 0x00, 0xdf, + /* 0x001ee0 - 0x001ee7 */ 0x00, 0xe1, 0x00, 0xe3, 0x00, 0xe5, 0x00, 0xe7, + /* 0x001ee8 - 0x001eef */ 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0x00, 0xef, + /* 0x001ef0 - 0x001ef7 */ 0x00, 0xf1, 0x00, 0xf3, 0x00, 0xf5, 0x00, 0xf7, + /* 0x001ef8 - 0x001eff */ 0x00, 0xf9, 0x00, 0xfb, 0x00, 0xfd, 0x00, 0xff, + }; + + unsigned char v = uc - 0x1e00; + + if (table[v]) return 0x1e00 | (table[v]-1); + #endif + + return uc; +} + +static unsigned int toupper_1f00_1fff(unsigned int uc) { + #ifndef GREEK_EXTENDED_DISABLE + static unsigned char table[] = { + /* 0x001f00 - 0x001f07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + /* 0x001f08 - 0x001f0f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f10 - 0x001f17 */ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x00, 0x00, + /* 0x001f18 - 0x001f1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f20 - 0x001f27 */ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + /* 0x001f28 - 0x001f2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f30 - 0x001f37 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + /* 0x001f38 - 0x001f3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f40 - 0x001f47 */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x00, 0x00, + /* 0x001f48 - 0x001f4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f50 - 0x001f57 */ 0x00, 0x59, 0x00, 0x5b, 0x00, 0x5d, 0x00, 0x5f, + /* 0x001f58 - 0x001f5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f60 - 0x001f67 */ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + /* 0x001f68 - 0x001f6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f70 - 0x001f77 */ 0xba, 0xbb, 0xc8, 0xc9, 0xca, 0xcb, 0xda, 0xdb, + /* 0x001f78 - 0x001f7f */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfa, 0xfb, 0x00, 0x00, + /* 0x001f80 - 0x001f87 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + /* 0x001f88 - 0x001f8f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001f90 - 0x001f97 */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + /* 0x001f98 - 0x001f9f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001fa0 - 0x001fa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + /* 0x001fa8 - 0x001faf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001fb0 - 0x001fb7 */ 0xb8, 0xb9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001fb8 - 0x001fbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001fc0 - 0x001fc7 */ 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00, + /* 0x001fc8 - 0x001fcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001fd0 - 0x001fd7 */ 0xd8, 0xd9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001fd8 - 0x001fdf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001fe0 - 0x001fe7 */ 0xe8, 0xe9, 0x00, 0x00, 0x00, 0xec, 0x00, 0x00, + /* 0x001fe8 - 0x001fef */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x001ff0 - 0x001ff7 */ 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, + /* 0x001ff8 - 0x001fff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + + unsigned char v = uc - 0x1f00; + + if (table[v]) return 0x1f00 | table[v]; + + switch (v) { default: break; + case 0xbe: return 0x0399; + } + #endif + + + return uc; +} + +static unsigned int toupper_2c30_2cff(unsigned int uc) { + + #if !defined(GLAGOLITIC_DISABLE) || !defined(LATIN_EXTENDED_C_DISABLE) || !defined(COPTIC_DISABLE) + static unsigned char table[] = { + #ifndef GLAGOLITIC_DISABLE + /* 0x002c30 - 0x002c37 */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + /* 0x002c38 - 0x002c3f */ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, + /* 0x002c40 - 0x002c47 */ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, + /* 0x002c48 - 0x002c4f */ 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, + /* 0x002c50 - 0x002c57 */ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, + /* 0x002c58 - 0x002c5f */ 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x00, + #endif + #ifndef LATIN_EXTENDED_C_DISABLE + /* 0x002c60 - 0x002c67 */ 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x002c68 - 0x002c6f */ 0x68, 0x00, 0x6a, 0x00, 0x6c, 0x00, 0x00, 0x00, + /* 0x002c70 - 0x002c77 */ 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, + /* 0x002c78 - 0x002c7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + #endif + #ifndef COPTIC_DISABLE + /* 0x002c80 - 0x002c87 */ 0x00, 0x81, 0x00, 0x83, 0x00, 0x85, 0x00, 0x87, + /* 0x002c88 - 0x002c8f */ 0x00, 0x89, 0x00, 0x8b, 0x00, 0x8d, 0x00, 0x8f, + /* 0x002c90 - 0x002c97 */ 0x00, 0x91, 0x00, 0x93, 0x00, 0x95, 0x00, 0x97, + /* 0x002c98 - 0x002c9f */ 0x00, 0x99, 0x00, 0x9b, 0x00, 0x9d, 0x00, 0x9f, + /* 0x002ca0 - 0x002ca7 */ 0x00, 0xa1, 0x00, 0xa3, 0x00, 0xa5, 0x00, 0xa7, + /* 0x002ca8 - 0x002caf */ 0x00, 0xa9, 0x00, 0xab, 0x00, 0xad, 0x00, 0xaf, + /* 0x002cb0 - 0x002cb7 */ 0x00, 0xb1, 0x00, 0xb3, 0x00, 0xb5, 0x00, 0xb7, + /* 0x002cb8 - 0x002cbf */ 0x00, 0xb9, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0xbf, + /* 0x002cc0 - 0x002cc7 */ 0x00, 0xc1, 0x00, 0xc3, 0x00, 0xc5, 0x00, 0xc7, + /* 0x002cc8 - 0x002ccf */ 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0x00, 0xcf, + /* 0x002cd0 - 0x002cd7 */ 0x00, 0xd1, 0x00, 0xd3, 0x00, 0xd5, 0x00, 0xd7, + /* 0x002cd8 - 0x002cdf */ 0x00, 0xd9, 0x00, 0xdb, 0x00, 0xdd, 0x00, 0xdf, + /* 0x002ce0 - 0x002ce7 */ 0x00, 0xe1, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x00, + /* 0x002ce8 - 0x002cef */ 0x00, 0x00, 0x00, 0x00, 0xec, 0x00, 0xee, 0x00, + /* 0x002cf0 - 0x002cf7 */ 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 0x00, + /* 0x002cf8 - 0x002cff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + #endif + }; + + + #ifndef GLAGOLITIC_DISABLE + unsigned char v = uc - 0x2c30; + + # if !defined(LATIN_EXTENDED_C_DISABLE) + if (v == 0x35) return 0x023a; + # endif + + # if defined(LATIN_EXTENDED_C_DISABLE) && !defined(COPTIC_DISABLE) + if (uc <= 0x2c5f && table[v]) return 0x2c00 | (table[v]-1); + if (uc <= 0x2c7f) else return uc; + + v -= 0x20; + # elif !defined(LATIN_EXTENDED_C_DISABLE) && defined(COPTIC_DISABLE) + if (uc >= 0x2c80) return uc; + # elif defined(LATIN_EXTENDED_C_DISABLE) && defined(COPTIC_DISABLE) + if (uc >= 0x2c60) return uc; + # endif + + #elif !defined(LATIN_EXTENDED_C_DISABLE) + unsigned char v = uc - 0x2c60; + + if (uc <= 0x2c5f) return uc; + if (v == 0x35) return 0x023a; + + #if defined(COPTIC_DISABLE) + if (uc >= 0x2c80) return uc; + #endif + + #else + unsigned char v = uc - 0x2c80; + + if (uc <= 0x2c7f) return uc; + #endif + + if (table[v]) return 0x2c00 | (table[v]-1); + + #endif + return uc; +} + +static unsigned int toupper_2d00_2d2f(unsigned int uc) { + #ifndef GEORGIAN_SUPPLEMENT_DISABLE + static unsigned char table[] = { + /* 0x002d00 - 0x002d07 */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + /* 0x002d08 - 0x002d0f */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + /* 0x002d10 - 0x002d17 */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + /* 0x002d18 - 0x002d1f */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + /* 0x002d20 - 0x002d27 */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0x00, 0xc7, + /* 0x002d28 - 0x002d2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcd, 0x00, 0x00, + }; + + unsigned char v = uc - 0x2d00; + + if (table[v]) return 0x1000 | table[v]; + #endif + return uc; +} + +static unsigned int toupper_a640_a69f(unsigned int uc) { + #ifndef CYRILLIC_EXTENDED_B_DISABLE + static unsigned char table[] = { + /* 0x00a640 - 0x00a647 */ 0x00, 0x40, 0x00, 0x42, 0x00, 0x44, 0x00, 0x46, + /* 0x00a648 - 0x00a64f */ 0x00, 0x48, 0x00, 0x4a, 0x00, 0x4c, 0x00, 0x4e, + /* 0x00a650 - 0x00a657 */ 0x00, 0x50, 0x00, 0x52, 0x00, 0x54, 0x00, 0x56, + /* 0x00a658 - 0x00a65f */ 0x00, 0x58, 0x00, 0x5a, 0x00, 0x5c, 0x00, 0x5e, + /* 0x00a660 - 0x00a667 */ 0x00, 0x60, 0x00, 0x62, 0x00, 0x64, 0x00, 0x66, + /* 0x00a668 - 0x00a66f */ 0x00, 0x68, 0x00, 0x6a, 0x00, 0x6c, 0x00, 0x00, + /* 0x00a670 - 0x00a677 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00a678 - 0x00a67f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00a680 - 0x00a687 */ 0x00, 0x80, 0x00, 0x82, 0x00, 0x84, 0x00, 0x86, + /* 0x00a688 - 0x00a68f */ 0x00, 0x88, 0x00, 0x8a, 0x00, 0x8c, 0x00, 0x8e, + /* 0x00a690 - 0x00a697 */ 0x00, 0x90, 0x00, 0x92, 0x00, 0x94, 0x00, 0x96, + /* 0x00a698 - 0x00a69f */ 0x00, 0x98, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, + }; + + unsigned char v = uc - 0xa640; + + if (table[v]) return 0xa600 | table[v]; + #endif + + return uc; +} + +static unsigned int toupper_a720_a7cf(unsigned int uc) { + #ifndef LATIN_EXTENDED_D_DISABLE + static unsigned char table[] = { + /* 0x00a720 - 0x00a727 */ 0x00, 0x00, 0x00, 0x22, 0x00, 0x24, 0x00, 0x26, + /* 0x00a728 - 0x00a72f */ 0x00, 0x28, 0x00, 0x2a, 0x00, 0x2c, 0x00, 0x2e, + /* 0x00a730 - 0x00a737 */ 0x00, 0x00, 0x00, 0x32, 0x00, 0x34, 0x00, 0x36, + /* 0x00a738 - 0x00a73f */ 0x00, 0x38, 0x00, 0x3a, 0x00, 0x3c, 0x00, 0x3e, + /* 0x00a740 - 0x00a747 */ 0x00, 0x40, 0x00, 0x42, 0x00, 0x44, 0x00, 0x46, + /* 0x00a748 - 0x00a74f */ 0x00, 0x48, 0x00, 0x4a, 0x00, 0x4c, 0x00, 0x4e, + /* 0x00a750 - 0x00a757 */ 0x00, 0x50, 0x00, 0x52, 0x00, 0x54, 0x00, 0x56, + /* 0x00a758 - 0x00a75f */ 0x00, 0x58, 0x00, 0x5a, 0x00, 0x5c, 0x00, 0x5e, + /* 0x00a760 - 0x00a767 */ 0x00, 0x60, 0x00, 0x62, 0x00, 0x64, 0x00, 0x66, + /* 0x00a768 - 0x00a76f */ 0x00, 0x68, 0x00, 0x6a, 0x00, 0x6c, 0x00, 0x6e, + /* 0x00a770 - 0x00a777 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00a778 - 0x00a77f */ 0x00, 0x00, 0x79, 0x00, 0x7b, 0x00, 0x00, 0x7e, + /* 0x00a780 - 0x00a787 */ 0x00, 0x80, 0x00, 0x82, 0x00, 0x84, 0x00, 0x86, + /* 0x00a788 - 0x00a78f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00a790 - 0x00a797 */ 0x00, 0x90, 0x00, 0x92, 0x00, 0x00, 0x00, 0x96, + /* 0x00a798 - 0x00a79f */ 0x00, 0x98, 0x00, 0x9a, 0x00, 0x9c, 0x00, 0x9e, + /* 0x00a7a0 - 0x00a7a7 */ 0x00, 0xa0, 0x00, 0xa2, 0x00, 0xa4, 0x00, 0xa6, + /* 0x00a7a8 - 0x00a7af */ 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00a7b0 - 0x00a7b7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0xb6, + /* 0x00a7b8 - 0x00a7bf */ 0x00, 0xb8, 0x00, 0xba, 0x00, 0xbc, 0x00, 0xbe, + /* 0x00a7c0 - 0x00a7c7 */ 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0x00, + /* 0x00a7c8 - 0x00a7cf */ 0xc7, 0x00, 0xc9, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + + unsigned char v = uc - 0xa720; + + if (table[v]) return 0xa700 | table[v]; + #endif + + return uc; +} + +static unsigned int toupper_ab70_abbf(unsigned int uc) { + #ifndef CHEROKEE_DISABLE + static unsigned char table[] = { + /* 0x00ab70 - 0x00ab77 */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + /* 0x00ab78 - 0x00ab7f */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + /* 0x00ab80 - 0x00ab87 */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + /* 0x00ab88 - 0x00ab8f */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + /* 0x00ab90 - 0x00ab97 */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + /* 0x00ab98 - 0x00ab9f */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + /* 0x00aba0 - 0x00aba7 */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + /* 0x00aba8 - 0x00abaf */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + /* 0x00abb0 - 0x00abb7 */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + /* 0x00abb8 - 0x00abbf */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + }; + + if (uc < 0xab70) return (uc == 0xab53) ? 0xa7b3 : uc; + + unsigned char v = uc - 0xab70; + + if (table[v]) return 0x1300 | table[v]; + #endif + return uc; +} + + +static unsigned int toupper_010420_0104ff(unsigned int uc) { + #ifndef DESERET_DISABLE + static unsigned char table_0428[] = { + /* 0x010428 - 0x01042f */ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + /* 0x010430 - 0x010437 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + /* 0x010438 - 0x01043f */ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + /* 0x010440 - 0x010447 */ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + /* 0x010448 - 0x01044f */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + }; + + static unsigned char table_04d8[] = { + /* 0x0104d8 - 0x0104df */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + /* 0x0104e0 - 0x0104e7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + /* 0x0104e8 - 0x0104ef */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + /* 0x0104f0 - 0x0104f7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + /* 0x0104f8 - 0x0104ff */ 0xd0, 0xd1, 0xd2, 0xd3, 0x00, 0x00, 0x00, 0x00, + }; + + if (uc >= 0x010428) { + unsigned char v = uc - 0x010428; + + if (v <= 0x27) return 0x010400 | table_0428[v]; + if (v >= 0xb0 && table_04d8[v -= 0xb0]) return 0x010400 | table_04d8[v]; + } + #endif + + return uc; +} + +static unsigned int toupper_010cc0_010cff(unsigned int uc) { + #ifndef OLD_HUNGARIAN_DISABLE + static unsigned char table[] = { + /* 0x010cc0 - 0x010cc7 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + /* 0x010cc8 - 0x010ccf */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + /* 0x010cd0 - 0x010cd7 */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + /* 0x010cd8 - 0x010cdf */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + /* 0x010ce0 - 0x010ce7 */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + /* 0x010ce8 - 0x010cef */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + /* 0x010cf0 - 0x010cf7 */ 0xb0, 0xb1, 0xb2, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + + if (uc <= 0x010cf7) { + unsigned char v = uc - 0x010cc0; + + if (table[v]) return 0x010c00 | table[v]; + } + #endif + + return uc; +} + +static unsigned int toupper_0118c0_0118df(unsigned int uc) { + #ifndef WARANG_CITI_DISABLE + static unsigned char table[] = { + /* 0x0118c0 - 0x0118c7 */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + /* 0x0118c8 - 0x0118cf */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + /* 0x0118d0 - 0x0118d7 */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + /* 0x0118d8 - 0x0118df */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + }; + + unsigned char v = uc - 0x0118c0; + + if (table[v]) return 0x011800 | table[v]; + #endif + + return uc; +} + + +unsigned int toupper_unicode(unsigned int uc) { + + if (uc <= 0x007a) return (uc >= 0x0061) ? uc ^ 0x20 : uc; + + if (uc <= 0x044f) { + if (uc >= 0x0430) return uc - 0x20; + + if (uc <= 0x00ff) return (uc >= 0x00d0) ? toupper_00d0_00ff(uc) : uc; + if (uc <= 0x01ff) return (uc >= 0x0100) ? toupper_0100_01ff(uc) : uc; + if (uc <= 0x029f) return (uc >= 0x0200) ? toupper_0200_029f(uc) : uc; + if (uc <= 0x03ff) return (uc >= 0x0370) ? toupper_0370_03ff(uc) : uc; + + return uc; + } + + if (uc <= 0x04ff && uc >= 0x0450) return toupper_0450_04ff(uc); + if (uc <= 0x058f && uc >= 0x0500) return toupper_0500_058f(uc); + if (uc <= 0x10ff && uc >= 0x10d0) return toupper_10d0_10ff(uc); + if (uc <= 0x13ff && uc >= 0x13f0) return toupper_13f0_13ff(uc); + if (uc <= 0x1c8f && uc >= 0x1c80) return toupper_1c80_1c8f(uc); + if (uc <= 0x1d7f && uc >= 0x1d70) return toupper_1d70_1d7f(uc); + if (uc <= 0x1eff && uc >= 0x1e00) return toupper_1e00_1eff(uc); + if (uc <= 0x1fff && uc >= 0x1f00) return toupper_1f00_1fff(uc); + if (uc <= 0x2cff && uc >= 0x2c30) return toupper_2c30_2cff(uc); + if (uc <= 0x2d2f && uc >= 0x2d00) return toupper_2d00_2d2f(uc); + if (uc <= 0xa69f && uc >= 0xa640) return toupper_a640_a69f(uc); + if (uc <= 0xa7cf && uc >= 0xa720) return toupper_a720_a7cf(uc); + if (uc <= 0xabbf && uc >= 0xab50) return toupper_ab70_abbf(uc); + + if (uc <= 0x0104ff && uc >= 0x010420) return toupper_010420_0104ff(uc); + if (uc <= 0x010cff && uc >= 0x010cc0) return toupper_010cc0_010cff(uc); + if (uc <= 0x0118df && uc >= 0x0118c0) return toupper_0118c0_0118df(uc); + + return uc; +}