comparison src/mbyte.c @ 2041:d5867fd6b2b7 v7.2.330

updated for version 7.2.330 Problem: Tables for Unicode case operators are outdated. Solution: Add a Vim script for generating the tables. Include tables for Unicode 5.2.
author Bram Moolenaar <bram@zimbu.org>
date Tue, 12 Jan 2010 19:52:03 +0100
parents 89189f7aaad9
children 1378bc45ebe5
comparison
equal deleted inserted replaced
2040:70c67b1bb1f1 2041:d5867fd6b2b7
24 * The cell width on the display needs to be determined from 24 * The cell width on the display needs to be determined from
25 * the character value. 25 * the character value.
26 * Recognizing bytes is easy: 0xxx.xxxx is a single-byte 26 * Recognizing bytes is easy: 0xxx.xxxx is a single-byte
27 * char, 10xx.xxxx is a trailing byte, 11xx.xxxx is a leading 27 * char, 10xx.xxxx is a trailing byte, 11xx.xxxx is a leading
28 * byte of a multi-byte character. 28 * byte of a multi-byte character.
29 * To make things complicated, up to two composing characters 29 * To make things complicated, up to six composing characters
30 * are allowed. These are drawn on top of the first char. 30 * are allowed. These are drawn on top of the first char.
31 * For most editing the sequence of bytes with composing 31 * For most editing the sequence of bytes with composing
32 * characters included is considered to be one character. 32 * characters included is considered to be one character.
33 * "enc_unicode" When 2 use 16-bit Unicode characters (or UTF-16). 33 * "enc_unicode" When 2 use 16-bit Unicode characters (or UTF-16).
34 * When 4 use 32-but Unicode characters. 34 * When 4 use 32-but Unicode characters.
1151 return len; 1151 return len;
1152 } 1152 }
1153 1153
1154 struct interval 1154 struct interval
1155 { 1155 {
1156 unsigned short first; 1156 long first;
1157 unsigned short last; 1157 long last;
1158 }; 1158 };
1159 static int intable __ARGS((struct interval *table, size_t size, int c)); 1159 static int intable __ARGS((struct interval *table, size_t size, int c));
1160 1160
1161 /* 1161 /*
1162 * Return TRUE if "c" is in "table[size / sizeof(struct interval)]". 1162 * Return TRUE if "c" is in "table[size / sizeof(struct interval)]".
1198 */ 1198 */
1199 int 1199 int
1200 utf_char2cells(c) 1200 utf_char2cells(c)
1201 int c; 1201 int c;
1202 { 1202 {
1203 /* sorted list of non-overlapping intervals of East Asian Ambiguous 1203 /* Sorted list of non-overlapping intervals of East Asian Ambiguous
1204 * characters, generated with: 1204 * characters, generated with ../runtime/tools/unicode.vim. */
1205 * "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ 1205 static struct interval ambiguous[] =
1206 static struct interval ambiguous[] = { 1206 {
1207 {0x00A1, 0x00A1}, {0x00A4, 0x00A4}, {0x00A7, 0x00A8}, 1207 {0x00a1, 0x00a1},
1208 {0x00AA, 0x00AA}, {0x00AE, 0x00AE}, {0x00B0, 0x00B4}, 1208 {0x00a4, 0x00a4},
1209 {0x00B6, 0x00BA}, {0x00BC, 0x00BF}, {0x00C6, 0x00C6}, 1209 {0x00a7, 0x00a8},
1210 {0x00D0, 0x00D0}, {0x00D7, 0x00D8}, {0x00DE, 0x00E1}, 1210 {0x00aa, 0x00aa},
1211 {0x00E6, 0x00E6}, {0x00E8, 0x00EA}, {0x00EC, 0x00ED}, 1211 {0x00ad, 0x00ae},
1212 {0x00F0, 0x00F0}, {0x00F2, 0x00F3}, {0x00F7, 0x00FA}, 1212 {0x00b0, 0x00b4},
1213 {0x00FC, 0x00FC}, {0x00FE, 0x00FE}, {0x0101, 0x0101}, 1213 {0x00b6, 0x00ba},
1214 {0x0111, 0x0111}, {0x0113, 0x0113}, {0x011B, 0x011B}, 1214 {0x00bc, 0x00bf},
1215 {0x0126, 0x0127}, {0x012B, 0x012B}, {0x0131, 0x0133}, 1215 {0x00c6, 0x00c6},
1216 {0x0138, 0x0138}, {0x013F, 0x0142}, {0x0144, 0x0144}, 1216 {0x00d0, 0x00d0},
1217 {0x0148, 0x014B}, {0x014D, 0x014D}, {0x0152, 0x0153}, 1217 {0x00d7, 0x00d8},
1218 {0x0166, 0x0167}, {0x016B, 0x016B}, {0x01CE, 0x01CE}, 1218 {0x00de, 0x00e1},
1219 {0x01D0, 0x01D0}, {0x01D2, 0x01D2}, {0x01D4, 0x01D4}, 1219 {0x00e6, 0x00e6},
1220 {0x01D6, 0x01D6}, {0x01D8, 0x01D8}, {0x01DA, 0x01DA}, 1220 {0x00e8, 0x00ea},
1221 {0x01DC, 0x01DC}, {0x0251, 0x0251}, {0x0261, 0x0261}, 1221 {0x00ec, 0x00ed},
1222 {0x02C4, 0x02C4}, {0x02C7, 0x02C7}, {0x02C9, 0x02CB}, 1222 {0x00f0, 0x00f0},
1223 {0x02CD, 0x02CD}, {0x02D0, 0x02D0}, {0x02D8, 0x02DB}, 1223 {0x00f2, 0x00f3},
1224 {0x02DD, 0x02DD}, {0x02DF, 0x02DF}, {0x0391, 0x03A1}, 1224 {0x00f7, 0x00fa},
1225 {0x03A3, 0x03A9}, {0x03B1, 0x03C1}, {0x03C3, 0x03C9}, 1225 {0x00fc, 0x00fc},
1226 {0x0401, 0x0401}, {0x0410, 0x044F}, {0x0451, 0x0451}, 1226 {0x00fe, 0x00fe},
1227 {0x2010, 0x2010}, {0x2013, 0x2016}, {0x2018, 0x2019}, 1227 {0x0101, 0x0101},
1228 {0x201C, 0x201D}, {0x2020, 0x2022}, {0x2024, 0x2027}, 1228 {0x0111, 0x0111},
1229 {0x2030, 0x2030}, {0x2032, 0x2033}, {0x2035, 0x2035}, 1229 {0x0113, 0x0113},
1230 {0x203B, 0x203B}, {0x203E, 0x203E}, {0x2074, 0x2074}, 1230 {0x011b, 0x011b},
1231 {0x207F, 0x207F}, {0x2081, 0x2084}, {0x20AC, 0x20AC}, 1231 {0x0126, 0x0127},
1232 {0x2103, 0x2103}, {0x2105, 0x2105}, {0x2109, 0x2109}, 1232 {0x012b, 0x012b},
1233 {0x2113, 0x2113}, {0x2116, 0x2116}, {0x2121, 0x2122}, 1233 {0x0131, 0x0133},
1234 {0x2126, 0x2126}, {0x212B, 0x212B}, {0x2153, 0x2154}, 1234 {0x0138, 0x0138},
1235 {0x215B, 0x215E}, {0x2160, 0x216B}, {0x2170, 0x2179}, 1235 {0x013f, 0x0142},
1236 {0x2190, 0x2199}, {0x21B8, 0x21B9}, {0x21D2, 0x21D2}, 1236 {0x0144, 0x0144},
1237 {0x21D4, 0x21D4}, {0x21E7, 0x21E7}, {0x2200, 0x2200}, 1237 {0x0148, 0x014b},
1238 {0x2202, 0x2203}, {0x2207, 0x2208}, {0x220B, 0x220B}, 1238 {0x014d, 0x014d},
1239 {0x220F, 0x220F}, {0x2211, 0x2211}, {0x2215, 0x2215}, 1239 {0x0152, 0x0153},
1240 {0x221A, 0x221A}, {0x221D, 0x2220}, {0x2223, 0x2223}, 1240 {0x0166, 0x0167},
1241 {0x2225, 0x2225}, {0x2227, 0x222C}, {0x222E, 0x222E}, 1241 {0x016b, 0x016b},
1242 {0x2234, 0x2237}, {0x223C, 0x223D}, {0x2248, 0x2248}, 1242 {0x01ce, 0x01ce},
1243 {0x224C, 0x224C}, {0x2252, 0x2252}, {0x2260, 0x2261}, 1243 {0x01d0, 0x01d0},
1244 {0x2264, 0x2267}, {0x226A, 0x226B}, {0x226E, 0x226F}, 1244 {0x01d2, 0x01d2},
1245 {0x2282, 0x2283}, {0x2286, 0x2287}, {0x2295, 0x2295}, 1245 {0x01d4, 0x01d4},
1246 {0x2299, 0x2299}, {0x22A5, 0x22A5}, {0x22BF, 0x22BF}, 1246 {0x01d6, 0x01d6},
1247 {0x2312, 0x2312}, {0x2460, 0x24E9}, {0x24EB, 0x254B}, 1247 {0x01d8, 0x01d8},
1248 {0x2550, 0x2573}, {0x2580, 0x258F}, {0x2592, 0x2595}, 1248 {0x01da, 0x01da},
1249 {0x25A0, 0x25A1}, {0x25A3, 0x25A9}, {0x25B2, 0x25B3}, 1249 {0x01dc, 0x01dc},
1250 {0x25B6, 0x25B7}, {0x25BC, 0x25BD}, {0x25C0, 0x25C1}, 1250 {0x0251, 0x0251},
1251 {0x25C6, 0x25C8}, {0x25CB, 0x25CB}, {0x25CE, 0x25D1}, 1251 {0x0261, 0x0261},
1252 {0x25E2, 0x25E5}, {0x25EF, 0x25EF}, {0x2605, 0x2606}, 1252 {0x02c4, 0x02c4},
1253 {0x2609, 0x2609}, {0x260E, 0x260F}, {0x2614, 0x2615}, 1253 {0x02c7, 0x02c7},
1254 {0x261C, 0x261C}, {0x261E, 0x261E}, {0x2640, 0x2640}, 1254 {0x02c9, 0x02cb},
1255 {0x2642, 0x2642}, {0x2660, 0x2661}, {0x2663, 0x2665}, 1255 {0x02cd, 0x02cd},
1256 {0x2667, 0x266A}, {0x266C, 0x266D}, {0x266F, 0x266F}, 1256 {0x02d0, 0x02d0},
1257 {0x273D, 0x273D}, {0x2776, 0x277F}, {0xE000, 0xF8FF}, 1257 {0x02d8, 0x02db},
1258 {0xFFFD, 0xFFFD}, /* {0xF0000, 0xFFFFD}, {0x100000, 0x10FFFD} */ 1258 {0x02dd, 0x02dd},
1259 {0x02df, 0x02df},
1260 {0x0391, 0x03a1},
1261 {0x03a3, 0x03a9},
1262 {0x03b1, 0x03c1},
1263 {0x03c3, 0x03c9},
1264 {0x0401, 0x0401},
1265 {0x0410, 0x044f},
1266 {0x0451, 0x0451},
1267 {0x2010, 0x2010},
1268 {0x2013, 0x2016},
1269 {0x2018, 0x2019},
1270 {0x201c, 0x201d},
1271 {0x2020, 0x2022},
1272 {0x2024, 0x2027},
1273 {0x2030, 0x2030},
1274 {0x2032, 0x2033},
1275 {0x2035, 0x2035},
1276 {0x203b, 0x203b},
1277 {0x203e, 0x203e},
1278 {0x2074, 0x2074},
1279 {0x207f, 0x207f},
1280 {0x2081, 0x2084},
1281 {0x20ac, 0x20ac},
1282 {0x2103, 0x2103},
1283 {0x2105, 0x2105},
1284 {0x2109, 0x2109},
1285 {0x2113, 0x2113},
1286 {0x2116, 0x2116},
1287 {0x2121, 0x2122},
1288 {0x2126, 0x2126},
1289 {0x212b, 0x212b},
1290 {0x2153, 0x2154},
1291 {0x215b, 0x215e},
1292 {0x2160, 0x216b},
1293 {0x2170, 0x2179},
1294 {0x2189, 0x2189},
1295 {0x2190, 0x2199},
1296 {0x21b8, 0x21b9},
1297 {0x21d2, 0x21d2},
1298 {0x21d4, 0x21d4},
1299 {0x21e7, 0x21e7},
1300 {0x2200, 0x2200},
1301 {0x2202, 0x2203},
1302 {0x2207, 0x2208},
1303 {0x220b, 0x220b},
1304 {0x220f, 0x220f},
1305 {0x2211, 0x2211},
1306 {0x2215, 0x2215},
1307 {0x221a, 0x221a},
1308 {0x221d, 0x2220},
1309 {0x2223, 0x2223},
1310 {0x2225, 0x2225},
1311 {0x2227, 0x222c},
1312 {0x222e, 0x222e},
1313 {0x2234, 0x2237},
1314 {0x223c, 0x223d},
1315 {0x2248, 0x2248},
1316 {0x224c, 0x224c},
1317 {0x2252, 0x2252},
1318 {0x2260, 0x2261},
1319 {0x2264, 0x2267},
1320 {0x226a, 0x226b},
1321 {0x226e, 0x226f},
1322 {0x2282, 0x2283},
1323 {0x2286, 0x2287},
1324 {0x2295, 0x2295},
1325 {0x2299, 0x2299},
1326 {0x22a5, 0x22a5},
1327 {0x22bf, 0x22bf},
1328 {0x2312, 0x2312},
1329 {0x2460, 0x24e9},
1330 {0x24eb, 0x254b},
1331 {0x2550, 0x2573},
1332 {0x2580, 0x258f},
1333 {0x2592, 0x2595},
1334 {0x25a0, 0x25a1},
1335 {0x25a3, 0x25a9},
1336 {0x25b2, 0x25b3},
1337 {0x25b6, 0x25b7},
1338 {0x25bc, 0x25bd},
1339 {0x25c0, 0x25c1},
1340 {0x25c6, 0x25c8},
1341 {0x25cb, 0x25cb},
1342 {0x25ce, 0x25d1},
1343 {0x25e2, 0x25e5},
1344 {0x25ef, 0x25ef},
1345 {0x2605, 0x2606},
1346 {0x2609, 0x2609},
1347 {0x260e, 0x260f},
1348 {0x2614, 0x2615},
1349 {0x261c, 0x261c},
1350 {0x261e, 0x261e},
1351 {0x2640, 0x2640},
1352 {0x2642, 0x2642},
1353 {0x2660, 0x2661},
1354 {0x2663, 0x2665},
1355 {0x2667, 0x266a},
1356 {0x266c, 0x266d},
1357 {0x266f, 0x266f},
1358 {0x269e, 0x269f},
1359 {0x26be, 0x26bf},
1360 {0x26c4, 0x26cd},
1361 {0x26cf, 0x26e1},
1362 {0x26e3, 0x26e3},
1363 {0x26e8, 0x26ff},
1364 {0x273d, 0x273d},
1365 {0x2757, 0x2757},
1366 {0x2776, 0x277f},
1367 {0x2b55, 0x2b59},
1368 {0x3248, 0x324f},
1369 {0xe000, 0xf8ff},
1370 {0xfffd, 0xfffd},
1371 {0x1f100, 0x1f10a},
1372 {0x1f110, 0x1f12d},
1373 {0x1f131, 0x1f131},
1374 {0x1f13d, 0x1f13d},
1375 {0x1f13f, 0x1f13f},
1376 {0x1f142, 0x1f142},
1377 {0x1f146, 0x1f146},
1378 {0x1f14a, 0x1f14e},
1379 {0x1f157, 0x1f157},
1380 {0x1f15f, 0x1f15f},
1381 {0x1f179, 0x1f179},
1382 {0x1f17b, 0x1f17c},
1383 {0x1f17f, 0x1f17f},
1384 {0x1f18a, 0x1f18d},
1385 {0x1f190, 0x1f190},
1386 {0xf0000, 0xffffd},
1387 {0x100000, 0x10fffd}
1259 }; 1388 };
1260 1389
1261 if (c >= 0x100) 1390 if (c >= 0x100)
1262 { 1391 {
1263 #ifdef USE_WCHAR_FUNCTIONS 1392 #ifdef USE_WCHAR_FUNCTIONS
1805 /* Check for illegal byte. */ 1934 /* Check for illegal byte. */
1806 if (len == 1 && b0 >= 0x80) 1935 if (len == 1 && b0 >= 0x80)
1807 return 1; 1936 return 1;
1808 1937
1809 /* 1938 /*
1810 * Check for composing characters. We can handle only the first two, but 1939 * Check for composing characters. We can handle only the first six, but
1811 * skip all of them (otherwise the cursor would get stuck). 1940 * skip all of them (otherwise the cursor would get stuck).
1812 */ 1941 */
1813 #ifdef FEAT_ARABIC 1942 #ifdef FEAT_ARABIC
1814 prevlen = 0; 1943 prevlen = 0;
1815 #endif 1944 #endif
1853 /* Check for illegal byte and incomplete byte sequence. */ 1982 /* Check for illegal byte and incomplete byte sequence. */
1854 if ((len == 1 && p[0] >= 0x80) || len > size) 1983 if ((len == 1 && p[0] >= 0x80) || len > size)
1855 return 1; 1984 return 1;
1856 1985
1857 /* 1986 /*
1858 * Check for composing characters. We can handle only the first two, but 1987 * Check for composing characters. We can handle only the first six, but
1859 * skip all of them (otherwise the cursor would get stuck). 1988 * skip all of them (otherwise the cursor would get stuck).
1860 */ 1989 */
1861 #ifdef FEAT_ARABIC 1990 #ifdef FEAT_ARABIC
1862 prevlen = 0; 1991 prevlen = 0;
1863 #endif 1992 #endif
1971 */ 2100 */
1972 int 2101 int
1973 utf_iscomposing(c) 2102 utf_iscomposing(c)
1974 int c; 2103 int c;
1975 { 2104 {
1976 /* sorted list of non-overlapping intervals */ 2105 /* Sorted list of non-overlapping intervals.
2106 * Generated by ../runtime/tools/unicode.vim. */
1977 static struct interval combining[] = 2107 static struct interval combining[] =
1978 { 2108 {
1979 {0x0300, 0x034f}, {0x0360, 0x036f}, {0x0483, 0x0486}, {0x0488, 0x0489}, 2109 {0x0300, 0x036f},
1980 {0x0591, 0x05a1}, {0x05a3, 0x05b9}, {0x05bb, 0x05bd}, {0x05bf, 0x05bf}, 2110 {0x0483, 0x0489},
1981 {0x05c1, 0x05c2}, {0x05c4, 0x05c4}, {0x0610, 0x0615}, {0x064b, 0x0658}, 2111 {0x0591, 0x05bd},
1982 {0x0670, 0x0670}, {0x06d6, 0x06dc}, {0x06de, 0x06e4}, {0x06e7, 0x06e8}, 2112 {0x05bf, 0x05bf},
1983 {0x06ea, 0x06ed}, {0x0711, 0x0711}, {0x0730, 0x074a}, {0x07a6, 0x07b0}, 2113 {0x05c1, 0x05c2},
1984 {0x0901, 0x0903}, {0x093c, 0x093c}, {0x093e, 0x094d}, {0x0951, 0x0954}, 2114 {0x05c4, 0x05c5},
1985 {0x0962, 0x0963}, {0x0981, 0x0983}, {0x09bc, 0x09bc}, {0x09be, 0x09c4}, 2115 {0x05c7, 0x05c7},
1986 {0x09c7, 0x09c8}, {0x09cb, 0x09cd}, {0x09d7, 0x09d7}, {0x09e2, 0x09e3}, 2116 {0x0610, 0x061a},
1987 {0x0a01, 0x0a03}, {0x0a3c, 0x0a3c}, {0x0a3e, 0x0a42}, {0x0a47, 0x0a48}, 2117 {0x064b, 0x065e},
1988 {0x0a4b, 0x0a4d}, {0x0a70, 0x0a71}, {0x0a81, 0x0a83}, {0x0abc, 0x0abc}, 2118 {0x0670, 0x0670},
1989 {0x0abe, 0x0ac5}, {0x0ac7, 0x0ac9}, {0x0acb, 0x0acd}, {0x0ae2, 0x0ae3}, 2119 {0x06d6, 0x06dc},
1990 {0x0b01, 0x0b03}, {0x0b3c, 0x0b3c}, {0x0b3e, 0x0b43}, {0x0b47, 0x0b48}, 2120 {0x06de, 0x06e4},
1991 {0x0b4b, 0x0b4d}, {0x0b56, 0x0b57}, {0x0b82, 0x0b82}, {0x0bbe, 0x0bc2}, 2121 {0x06e7, 0x06e8},
1992 {0x0bc6, 0x0bc8}, {0x0bca, 0x0bcd}, {0x0bd7, 0x0bd7}, {0x0c01, 0x0c03}, 2122 {0x06ea, 0x06ed},
1993 {0x0c3e, 0x0c44}, {0x0c46, 0x0c48}, {0x0c4a, 0x0c4d}, {0x0c55, 0x0c56}, 2123 {0x0711, 0x0711},
1994 {0x0c82, 0x0c83}, {0x0cbc, 0x0cbc}, {0x0cbe, 0x0cc4}, {0x0cc6, 0x0cc8}, 2124 {0x0730, 0x074a},
1995 {0x0cca, 0x0ccd}, {0x0cd5, 0x0cd6}, {0x0d02, 0x0d03}, {0x0d3e, 0x0d43}, 2125 {0x07a6, 0x07b0},
1996 {0x0d46, 0x0d48}, {0x0d4a, 0x0d4d}, {0x0d57, 0x0d57}, {0x0d82, 0x0d83}, 2126 {0x07eb, 0x07f3},
1997 {0x0dca, 0x0dca}, {0x0dcf, 0x0dd4}, {0x0dd6, 0x0dd6}, {0x0dd8, 0x0ddf}, 2127 {0x0816, 0x0819},
1998 {0x0df2, 0x0df3}, {0x0e31, 0x0e31}, {0x0e34, 0x0e3a}, {0x0e47, 0x0e4e}, 2128 {0x081b, 0x0823},
1999 {0x0eb1, 0x0eb1}, {0x0eb4, 0x0eb9}, {0x0ebb, 0x0ebc}, {0x0ec8, 0x0ecd}, 2129 {0x0825, 0x0827},
2000 {0x0f18, 0x0f19}, {0x0f35, 0x0f35}, {0x0f37, 0x0f37}, {0x0f39, 0x0f39}, 2130 {0x0829, 0x082d},
2001 {0x0f3e, 0x0f3f}, {0x0f71, 0x0f84}, {0x0f86, 0x0f87}, {0x0f90, 0x0f97}, 2131 {0x0900, 0x0903},
2002 {0x0f99, 0x0fbc}, {0x0fc6, 0x0fc6}, {0x102c, 0x1032}, {0x1036, 0x1039}, 2132 {0x093c, 0x093c},
2003 {0x1056, 0x1059}, {0x1712, 0x1714}, {0x1732, 0x1734}, {0x1752, 0x1753}, 2133 {0x093e, 0x094e},
2004 {0x1772, 0x1773}, {0x17b6, 0x17d3}, {0x17dd, 0x17dd}, {0x180b, 0x180d}, 2134 {0x0951, 0x0955},
2005 {0x18a9, 0x18a9}, {0x1920, 0x192b}, {0x1930, 0x193b}, {0x20d0, 0x20ea}, 2135 {0x0962, 0x0963},
2006 {0x302a, 0x302f}, {0x3099, 0x309a}, {0xfb1e, 0xfb1e}, {0xfe00, 0xfe0f}, 2136 {0x0981, 0x0983},
2007 {0xfe20, 0xfe23}, 2137 {0x09bc, 0x09bc},
2138 {0x09be, 0x09c4},
2139 {0x09c7, 0x09c8},
2140 {0x09cb, 0x09cd},
2141 {0x09d7, 0x09d7},
2142 {0x09e2, 0x09e3},
2143 {0x0a01, 0x0a03},
2144 {0x0a3c, 0x0a3c},
2145 {0x0a3e, 0x0a42},
2146 {0x0a47, 0x0a48},
2147 {0x0a4b, 0x0a4d},
2148 {0x0a51, 0x0a51},
2149 {0x0a70, 0x0a71},
2150 {0x0a75, 0x0a75},
2151 {0x0a81, 0x0a83},
2152 {0x0abc, 0x0abc},
2153 {0x0abe, 0x0ac5},
2154 {0x0ac7, 0x0ac9},
2155 {0x0acb, 0x0acd},
2156 {0x0ae2, 0x0ae3},
2157 {0x0b01, 0x0b03},
2158 {0x0b3c, 0x0b3c},
2159 {0x0b3e, 0x0b44},
2160 {0x0b47, 0x0b48},
2161 {0x0b4b, 0x0b4d},
2162 {0x0b56, 0x0b57},
2163 {0x0b62, 0x0b63},
2164 {0x0b82, 0x0b82},
2165 {0x0bbe, 0x0bc2},
2166 {0x0bc6, 0x0bc8},
2167 {0x0bca, 0x0bcd},
2168 {0x0bd7, 0x0bd7},
2169 {0x0c01, 0x0c03},
2170 {0x0c3e, 0x0c44},
2171 {0x0c46, 0x0c48},
2172 {0x0c4a, 0x0c4d},
2173 {0x0c55, 0x0c56},
2174 {0x0c62, 0x0c63},
2175 {0x0c82, 0x0c83},
2176 {0x0cbc, 0x0cbc},
2177 {0x0cbe, 0x0cc4},
2178 {0x0cc6, 0x0cc8},
2179 {0x0cca, 0x0ccd},
2180 {0x0cd5, 0x0cd6},
2181 {0x0ce2, 0x0ce3},
2182 {0x0d02, 0x0d03},
2183 {0x0d3e, 0x0d44},
2184 {0x0d46, 0x0d48},
2185 {0x0d4a, 0x0d4d},
2186 {0x0d57, 0x0d57},
2187 {0x0d62, 0x0d63},
2188 {0x0d82, 0x0d83},
2189 {0x0dca, 0x0dca},
2190 {0x0dcf, 0x0dd4},
2191 {0x0dd6, 0x0dd6},
2192 {0x0dd8, 0x0ddf},
2193 {0x0df2, 0x0df3},
2194 {0x0e31, 0x0e31},
2195 {0x0e34, 0x0e3a},
2196 {0x0e47, 0x0e4e},
2197 {0x0eb1, 0x0eb1},
2198 {0x0eb4, 0x0eb9},
2199 {0x0ebb, 0x0ebc},
2200 {0x0ec8, 0x0ecd},
2201 {0x0f18, 0x0f19},
2202 {0x0f35, 0x0f35},
2203 {0x0f37, 0x0f37},
2204 {0x0f39, 0x0f39},
2205 {0x0f3e, 0x0f3f},
2206 {0x0f71, 0x0f84},
2207 {0x0f86, 0x0f87},
2208 {0x0f90, 0x0f97},
2209 {0x0f99, 0x0fbc},
2210 {0x0fc6, 0x0fc6},
2211 {0x102b, 0x103e},
2212 {0x1056, 0x1059},
2213 {0x105e, 0x1060},
2214 {0x1062, 0x1064},
2215 {0x1067, 0x106d},
2216 {0x1071, 0x1074},
2217 {0x1082, 0x108d},
2218 {0x108f, 0x108f},
2219 {0x109a, 0x109d},
2220 {0x135f, 0x135f},
2221 {0x1712, 0x1714},
2222 {0x1732, 0x1734},
2223 {0x1752, 0x1753},
2224 {0x1772, 0x1773},
2225 {0x17b6, 0x17d3},
2226 {0x17dd, 0x17dd},
2227 {0x180b, 0x180d},
2228 {0x18a9, 0x18a9},
2229 {0x1920, 0x192b},
2230 {0x1930, 0x193b},
2231 {0x19b0, 0x19c0},
2232 {0x19c8, 0x19c9},
2233 {0x1a17, 0x1a1b},
2234 {0x1a55, 0x1a5e},
2235 {0x1a60, 0x1a7c},
2236 {0x1a7f, 0x1a7f},
2237 {0x1b00, 0x1b04},
2238 {0x1b34, 0x1b44},
2239 {0x1b6b, 0x1b73},
2240 {0x1b80, 0x1b82},
2241 {0x1ba1, 0x1baa},
2242 {0x1c24, 0x1c37},
2243 {0x1cd0, 0x1cd2},
2244 {0x1cd4, 0x1ce8},
2245 {0x1ced, 0x1ced},
2246 {0x1cf2, 0x1cf2},
2247 {0x1dc0, 0x1de6},
2248 {0x1dfd, 0x1dff},
2249 {0x20d0, 0x20f0},
2250 {0x2cef, 0x2cf1},
2251 {0x2de0, 0x2dff},
2252 {0x302a, 0x302f},
2253 {0x3099, 0x309a},
2254 {0xa66f, 0xa672},
2255 {0xa67c, 0xa67d},
2256 {0xa6f0, 0xa6f1},
2257 {0xa802, 0xa802},
2258 {0xa806, 0xa806},
2259 {0xa80b, 0xa80b},
2260 {0xa823, 0xa827},
2261 {0xa880, 0xa881},
2262 {0xa8b4, 0xa8c4},
2263 {0xa8e0, 0xa8f1},
2264 {0xa926, 0xa92d},
2265 {0xa947, 0xa953},
2266 {0xa980, 0xa983},
2267 {0xa9b3, 0xa9c0},
2268 {0xaa29, 0xaa36},
2269 {0xaa43, 0xaa43},
2270 {0xaa4c, 0xaa4d},
2271 {0xaa7b, 0xaa7b},
2272 {0xaab0, 0xaab0},
2273 {0xaab2, 0xaab4},
2274 {0xaab7, 0xaab8},
2275 {0xaabe, 0xaabf},
2276 {0xaac1, 0xaac1},
2277 {0xabe3, 0xabea},
2278 {0xabec, 0xabed},
2279 {0xfb1e, 0xfb1e},
2280 {0xfe00, 0xfe0f},
2281 {0xfe20, 0xfe26},
2282 {0x101fd, 0x101fd},
2283 {0x10a01, 0x10a03},
2284 {0x10a05, 0x10a06},
2285 {0x10a0c, 0x10a0f},
2286 {0x10a38, 0x10a3a},
2287 {0x10a3f, 0x10a3f},
2288 {0x11080, 0x11082},
2289 {0x110b0, 0x110ba},
2290 {0x1d165, 0x1d169},
2291 {0x1d16d, 0x1d172},
2292 {0x1d17b, 0x1d182},
2293 {0x1d185, 0x1d18b},
2294 {0x1d1aa, 0x1d1ad},
2295 {0x1d242, 0x1d244},
2296 {0xe0100, 0xe01ef}
2008 }; 2297 };
2009 2298
2010 return intable(combining, sizeof(combining), c); 2299 return intable(combining, sizeof(combining), c);
2011 } 2300 }
2012 2301
2150 2439
2151 /* 2440 /*
2152 * Code for Unicode case-dependent operations. Based on notes in 2441 * Code for Unicode case-dependent operations. Based on notes in
2153 * http://www.unicode.org/Public/UNIDATA/CaseFolding.txt 2442 * http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
2154 * This code uses simple case folding, not full case folding. 2443 * This code uses simple case folding, not full case folding.
2155 */ 2444 * Last updated for Unicode 5.2.
2156 2445 */
2157 /* 2446
2158 * The following table is built by foldExtract.pl < CaseFolding.txt . 2447 /*
2159 * It must be in numeric order, because we use binary search on it. 2448 * The following tables are built by ../runtime/tools/unicode.vim.
2160 * An entry such as {0x41,0x5a,1,32} means that UCS-4 characters in the range 2449 * They must be in numeric order, because we use binary search.
2161 * from 0x41 to 0x5a inclusive, stepping by 1, are folded by adding 32. 2450 * An entry such as {0x41,0x5a,1,32} means that Unicode characters in the
2162 */ 2451 * range from 0x41 to 0x5a inclusive, stepping by 1, are changed to
2163 2452 * folded/upper/lower by adding 32.
2453 */
2164 typedef struct 2454 typedef struct
2165 { 2455 {
2166 int rangeStart; 2456 int rangeStart;
2167 int rangeEnd; 2457 int rangeEnd;
2168 int step; 2458 int step;
2169 int offset; 2459 int offset;
2170 } convertStruct; 2460 } convertStruct;
2171 2461
2172 static convertStruct foldCase[] = 2462 static convertStruct foldCase[] =
2173 { 2463 {
2174 {0x41,0x5a,1,32}, {0xc0,0xd6,1,32}, {0xd8,0xde,1,32}, 2464 {0x41,0x5a,1,32},
2175 {0x100,0x12e,2,1}, {0x130,0x130,-1,-199}, {0x132,0x136,2,1}, 2465 {0xb5,0xb5,-1,775},
2176 {0x139,0x147,2,1}, {0x14a,0x176,2,1}, {0x178,0x178,-1,-121}, 2466 {0xc0,0xd6,1,32},
2177 {0x179,0x17d,2,1}, {0x181,0x181,-1,210}, {0x182,0x184,2,1}, 2467 {0xd8,0xde,1,32},
2178 {0x186,0x186,-1,206}, {0x187,0x187,-1,1}, {0x189,0x18a,1,205}, 2468 {0x100,0x12e,2,1},
2179 {0x18b,0x18b,-1,1}, {0x18e,0x18e,-1,79}, {0x18f,0x18f,-1,202}, 2469 {0x132,0x136,2,1},
2180 {0x190,0x190,-1,203}, {0x191,0x191,-1,1}, {0x193,0x193,-1,205}, 2470 {0x139,0x147,2,1},
2181 {0x194,0x194,-1,207}, {0x196,0x196,-1,211}, {0x197,0x197,-1,209}, 2471 {0x14a,0x176,2,1},
2182 {0x198,0x198,-1,1}, {0x19c,0x19c,-1,211}, {0x19d,0x19d,-1,213}, 2472 {0x178,0x178,-1,-121},
2183 {0x19f,0x19f,-1,214}, {0x1a0,0x1a4,2,1}, {0x1a6,0x1a6,-1,218}, 2473 {0x179,0x17d,2,1},
2184 {0x1a7,0x1a7,-1,1}, {0x1a9,0x1a9,-1,218}, {0x1ac,0x1ac,-1,1}, 2474 {0x17f,0x17f,-1,-268},
2185 {0x1ae,0x1ae,-1,218}, {0x1af,0x1af,-1,1}, {0x1b1,0x1b2,1,217}, 2475 {0x181,0x181,-1,210},
2186 {0x1b3,0x1b5,2,1}, {0x1b7,0x1b7,-1,219}, {0x1b8,0x1bc,4,1}, 2476 {0x182,0x184,2,1},
2187 {0x1c4,0x1c4,-1,2}, {0x1c5,0x1c5,-1,1}, {0x1c7,0x1c7,-1,2}, 2477 {0x186,0x186,-1,206},
2188 {0x1c8,0x1c8,-1,1}, {0x1ca,0x1ca,-1,2}, {0x1cb,0x1db,2,1}, 2478 {0x187,0x187,-1,1},
2189 {0x1de,0x1ee,2,1}, {0x1f1,0x1f1,-1,2}, {0x1f2,0x1f4,2,1}, 2479 {0x189,0x18a,1,205},
2190 {0x1f6,0x1f6,-1,-97}, {0x1f7,0x1f7,-1,-56}, {0x1f8,0x21e,2,1}, 2480 {0x18b,0x18b,-1,1},
2191 {0x220,0x220,-1,-130}, {0x222,0x232,2,1}, {0x386,0x386,-1,38}, 2481 {0x18e,0x18e,-1,79},
2192 {0x388,0x38a,1,37}, {0x38c,0x38c,-1,64}, {0x38e,0x38f,1,63}, 2482 {0x18f,0x18f,-1,202},
2193 {0x391,0x3a1,1,32}, {0x3a3,0x3ab,1,32}, {0x3d8,0x3ee,2,1}, 2483 {0x190,0x190,-1,203},
2194 {0x3f4,0x3f4,-1,-60}, {0x3f7,0x3f7,-1,1}, {0x3f9,0x3f9,-1,-7}, 2484 {0x191,0x191,-1,1},
2195 {0x3fa,0x3fa,-1,1}, {0x400,0x40f,1,80}, {0x410,0x42f,1,32}, 2485 {0x193,0x193,-1,205},
2196 {0x460,0x480,2,1}, {0x48a,0x4be,2,1}, {0x4c1,0x4cd,2,1}, 2486 {0x194,0x194,-1,207},
2197 {0x4d0,0x4f4,2,1}, {0x4f8,0x500,8,1}, {0x502,0x50e,2,1}, 2487 {0x196,0x196,-1,211},
2198 {0x531,0x556,1,48}, {0x1e00,0x1e94,2,1}, {0x1ea0,0x1ef8,2,1}, 2488 {0x197,0x197,-1,209},
2199 {0x1f08,0x1f0f,1,-8}, {0x1f18,0x1f1d,1,-8}, {0x1f28,0x1f2f,1,-8}, 2489 {0x198,0x198,-1,1},
2200 {0x1f38,0x1f3f,1,-8}, {0x1f48,0x1f4d,1,-8}, {0x1f59,0x1f5f,2,-8}, 2490 {0x19c,0x19c,-1,211},
2201 {0x1f68,0x1f6f,1,-8}, {0x1f88,0x1f8f,1,-8}, {0x1f98,0x1f9f,1,-8}, 2491 {0x19d,0x19d,-1,213},
2202 {0x1fa8,0x1faf,1,-8}, {0x1fb8,0x1fb9,1,-8}, {0x1fba,0x1fbb,1,-74}, 2492 {0x19f,0x19f,-1,214},
2203 {0x1fbc,0x1fbc,-1,-9}, {0x1fc8,0x1fcb,1,-86}, {0x1fcc,0x1fcc,-1,-9}, 2493 {0x1a0,0x1a4,2,1},
2204 {0x1fd8,0x1fd9,1,-8}, {0x1fda,0x1fdb,1,-100}, {0x1fe8,0x1fe9,1,-8}, 2494 {0x1a6,0x1a6,-1,218},
2205 {0x1fea,0x1feb,1,-112}, {0x1fec,0x1fec,-1,-7}, {0x1ff8,0x1ff9,1,-128}, 2495 {0x1a7,0x1a7,-1,1},
2206 {0x1ffa,0x1ffb,1,-126}, {0x1ffc,0x1ffc,-1,-9}, {0x2126,0x2126,-1,-7517}, 2496 {0x1a9,0x1a9,-1,218},
2207 {0x212a,0x212a,-1,-8383}, {0x212b,0x212b,-1,-8262}, 2497 {0x1ac,0x1ac,-1,1},
2208 {0x2160,0x216f,1,16}, {0x24b6,0x24cf,1,26}, {0xff21,0xff3a,1,32}, 2498 {0x1ae,0x1ae,-1,218},
2499 {0x1af,0x1af,-1,1},
2500 {0x1b1,0x1b2,1,217},
2501 {0x1b3,0x1b5,2,1},
2502 {0x1b7,0x1b7,-1,219},
2503 {0x1b8,0x1bc,4,1},
2504 {0x1c4,0x1c4,-1,2},
2505 {0x1c5,0x1c5,-1,1},
2506 {0x1c7,0x1c7,-1,2},
2507 {0x1c8,0x1c8,-1,1},
2508 {0x1ca,0x1ca,-1,2},
2509 {0x1cb,0x1db,2,1},
2510 {0x1de,0x1ee,2,1},
2511 {0x1f1,0x1f1,-1,2},
2512 {0x1f2,0x1f4,2,1},
2513 {0x1f6,0x1f6,-1,-97},
2514 {0x1f7,0x1f7,-1,-56},
2515 {0x1f8,0x21e,2,1},
2516 {0x220,0x220,-1,-130},
2517 {0x222,0x232,2,1},
2518 {0x23a,0x23a,-1,10795},
2519 {0x23b,0x23b,-1,1},
2520 {0x23d,0x23d,-1,-163},
2521 {0x23e,0x23e,-1,10792},
2522 {0x241,0x241,-1,1},
2523 {0x243,0x243,-1,-195},
2524 {0x244,0x244,-1,69},
2525 {0x245,0x245,-1,71},
2526 {0x246,0x24e,2,1},
2527 {0x345,0x345,-1,116},
2528 {0x370,0x372,2,1},
2529 {0x376,0x376,-1,1},
2530 {0x386,0x386,-1,38},
2531 {0x388,0x38a,1,37},
2532 {0x38c,0x38c,-1,64},
2533 {0x38e,0x38f,1,63},
2534 {0x391,0x3a1,1,32},
2535 {0x3a3,0x3ab,1,32},
2536 {0x3c2,0x3c2,-1,1},
2537 {0x3cf,0x3cf,-1,8},
2538 {0x3d0,0x3d0,-1,-30},
2539 {0x3d1,0x3d1,-1,-25},
2540 {0x3d5,0x3d5,-1,-15},
2541 {0x3d6,0x3d6,-1,-22},
2542 {0x3d8,0x3ee,2,1},
2543 {0x3f0,0x3f0,-1,-54},
2544 {0x3f1,0x3f1,-1,-48},
2545 {0x3f4,0x3f4,-1,-60},
2546 {0x3f5,0x3f5,-1,-64},
2547 {0x3f7,0x3f7,-1,1},
2548 {0x3f9,0x3f9,-1,-7},
2549 {0x3fa,0x3fa,-1,1},
2550 {0x3fd,0x3ff,1,-130},
2551 {0x400,0x40f,1,80},
2552 {0x410,0x42f,1,32},
2553 {0x460,0x480,2,1},
2554 {0x48a,0x4be,2,1},
2555 {0x4c0,0x4c0,-1,15},
2556 {0x4c1,0x4cd,2,1},
2557 {0x4d0,0x524,2,1},
2558 {0x531,0x556,1,48},
2559 {0x10a0,0x10c5,1,7264},
2560 {0x1e00,0x1e94,2,1},
2561 {0x1e9b,0x1e9b,-1,-58},
2562 {0x1e9e,0x1e9e,-1,-7615},
2563 {0x1ea0,0x1efe,2,1},
2564 {0x1f08,0x1f0f,1,-8},
2565 {0x1f18,0x1f1d,1,-8},
2566 {0x1f28,0x1f2f,1,-8},
2567 {0x1f38,0x1f3f,1,-8},
2568 {0x1f48,0x1f4d,1,-8},
2569 {0x1f59,0x1f5f,2,-8},
2570 {0x1f68,0x1f6f,1,-8},
2571 {0x1f88,0x1f8f,1,-8},
2572 {0x1f98,0x1f9f,1,-8},
2573 {0x1fa8,0x1faf,1,-8},
2574 {0x1fb8,0x1fb9,1,-8},
2575 {0x1fba,0x1fbb,1,-74},
2576 {0x1fbc,0x1fbc,-1,-9},
2577 {0x1fbe,0x1fbe,-1,-7173},
2578 {0x1fc8,0x1fcb,1,-86},
2579 {0x1fcc,0x1fcc,-1,-9},
2580 {0x1fd8,0x1fd9,1,-8},
2581 {0x1fda,0x1fdb,1,-100},
2582 {0x1fe8,0x1fe9,1,-8},
2583 {0x1fea,0x1feb,1,-112},
2584 {0x1fec,0x1fec,-1,-7},
2585 {0x1ff8,0x1ff9,1,-128},
2586 {0x1ffa,0x1ffb,1,-126},
2587 {0x1ffc,0x1ffc,-1,-9},
2588 {0x2126,0x2126,-1,-7517},
2589 {0x212a,0x212a,-1,-8383},
2590 {0x212b,0x212b,-1,-8262},
2591 {0x2132,0x2132,-1,28},
2592 {0x2160,0x216f,1,16},
2593 {0x2183,0x2183,-1,1},
2594 {0x24b6,0x24cf,1,26},
2595 {0x2c00,0x2c2e,1,48},
2596 {0x2c60,0x2c60,-1,1},
2597 {0x2c62,0x2c62,-1,-10743},
2598 {0x2c63,0x2c63,-1,-3814},
2599 {0x2c64,0x2c64,-1,-10727},
2600 {0x2c67,0x2c6b,2,1},
2601 {0x2c6d,0x2c6d,-1,-10780},
2602 {0x2c6e,0x2c6e,-1,-10749},
2603 {0x2c6f,0x2c6f,-1,-10783},
2604 {0x2c70,0x2c70,-1,-10782},
2605 {0x2c72,0x2c75,3,1},
2606 {0x2c7e,0x2c7f,1,-10815},
2607 {0x2c80,0x2ce2,2,1},
2608 {0x2ceb,0x2ced,2,1},
2609 {0xa640,0xa65e,2,1},
2610 {0xa662,0xa66c,2,1},
2611 {0xa680,0xa696,2,1},
2612 {0xa722,0xa72e,2,1},
2613 {0xa732,0xa76e,2,1},
2614 {0xa779,0xa77b,2,1},
2615 {0xa77d,0xa77d,-1,-35332},
2616 {0xa77e,0xa786,2,1},
2617 {0xa78b,0xa78b,-1,1},
2618 {0xff21,0xff3a,1,32},
2209 {0x10400,0x10427,1,40} 2619 {0x10400,0x10427,1,40}
2210 }; 2620 };
2211 2621
2212 static int utf_convert(int a, convertStruct table[], int tableSize); 2622 static int utf_convert(int a, convertStruct table[], int tableSize);
2213 2623
2251 int a; 2661 int a;
2252 { 2662 {
2253 return utf_convert(a, foldCase, sizeof(foldCase)); 2663 return utf_convert(a, foldCase, sizeof(foldCase));
2254 } 2664 }
2255 2665
2256 /*
2257 * The following tables are built by upperLowerExtract.pl < UnicodeData.txt .
2258 * They must be in numeric order, because we use binary search on them.
2259 * An entry such as {0x41,0x5a,1,32} means that UCS-4 characters in the range
2260 * from 0x41 to 0x5a inclusive, stepping by 1, are switched to lower (for
2261 * example) by adding 32.
2262 */
2263 static convertStruct toLower[] = 2666 static convertStruct toLower[] =
2264 { 2667 {
2265 {0x41,0x5a,1,32}, {0xc0,0xd6,1,32}, {0xd8,0xde,1,32}, 2668 {0x41,0x5a,1,32},
2266 {0x100,0x12e,2,1}, {0x130,0x130,-1,-199}, {0x132,0x136,2,1}, 2669 {0xc0,0xd6,1,32},
2267 {0x139,0x147,2,1}, {0x14a,0x176,2,1}, {0x178,0x178,-1,-121}, 2670 {0xd8,0xde,1,32},
2268 {0x179,0x17d,2,1}, {0x181,0x181,-1,210}, {0x182,0x184,2,1}, 2671 {0x100,0x12e,2,1},
2269 {0x186,0x186,-1,206}, {0x187,0x187,-1,1}, {0x189,0x18a,1,205}, 2672 {0x130,0x130,-1,-199},
2270 {0x18b,0x18b,-1,1}, {0x18e,0x18e,-1,79}, {0x18f,0x18f,-1,202}, 2673 {0x132,0x136,2,1},
2271 {0x190,0x190,-1,203}, {0x191,0x191,-1,1}, {0x193,0x193,-1,205}, 2674 {0x139,0x147,2,1},
2272 {0x194,0x194,-1,207}, {0x196,0x196,-1,211}, {0x197,0x197,-1,209}, 2675 {0x14a,0x176,2,1},
2273 {0x198,0x198,-1,1}, {0x19c,0x19c,-1,211}, {0x19d,0x19d,-1,213}, 2676 {0x178,0x178,-1,-121},
2274 {0x19f,0x19f,-1,214}, {0x1a0,0x1a4,2,1}, {0x1a6,0x1a6,-1,218}, 2677 {0x179,0x17d,2,1},
2275 {0x1a7,0x1a7,-1,1}, {0x1a9,0x1a9,-1,218}, {0x1ac,0x1ac,-1,1}, 2678 {0x181,0x181,-1,210},
2276 {0x1ae,0x1ae,-1,218}, {0x1af,0x1af,-1,1}, {0x1b1,0x1b2,1,217}, 2679 {0x182,0x184,2,1},
2277 {0x1b3,0x1b5,2,1}, {0x1b7,0x1b7,-1,219}, {0x1b8,0x1bc,4,1}, 2680 {0x186,0x186,-1,206},
2278 {0x1c4,0x1ca,3,2}, {0x1cd,0x1db,2,1}, {0x1de,0x1ee,2,1}, 2681 {0x187,0x187,-1,1},
2279 {0x1f1,0x1f1,-1,2}, {0x1f4,0x1f4,-1,1}, {0x1f6,0x1f6,-1,-97}, 2682 {0x189,0x18a,1,205},
2280 {0x1f7,0x1f7,-1,-56}, {0x1f8,0x21e,2,1}, {0x220,0x220,-1,-130}, 2683 {0x18b,0x18b,-1,1},
2281 {0x222,0x232,2,1}, {0x386,0x386,-1,38}, {0x388,0x38a,1,37}, 2684 {0x18e,0x18e,-1,79},
2282 {0x38c,0x38c,-1,64}, {0x38e,0x38f,1,63}, {0x391,0x3a1,1,32}, 2685 {0x18f,0x18f,-1,202},
2283 {0x3a3,0x3ab,1,32}, {0x3d8,0x3ee,2,1}, {0x3f4,0x3f4,-1,-60}, 2686 {0x190,0x190,-1,203},
2284 {0x3f7,0x3f7,-1,1}, {0x3f9,0x3f9,-1,-7}, {0x3fa,0x3fa,-1,1}, 2687 {0x191,0x191,-1,1},
2285 {0x400,0x40f,1,80}, {0x410,0x42f,1,32}, {0x460,0x480,2,1}, 2688 {0x193,0x193,-1,205},
2286 {0x48a,0x4be,2,1}, {0x4c1,0x4cd,2,1}, {0x4d0,0x4f4,2,1}, 2689 {0x194,0x194,-1,207},
2287 {0x4f8,0x500,8,1}, {0x502,0x50e,2,1}, {0x531,0x556,1,48}, 2690 {0x196,0x196,-1,211},
2288 {0x1e00,0x1e94,2,1}, {0x1ea0,0x1ef8,2,1}, {0x1f08,0x1f0f,1,-8}, 2691 {0x197,0x197,-1,209},
2289 {0x1f18,0x1f1d,1,-8}, {0x1f28,0x1f2f,1,-8}, {0x1f38,0x1f3f,1,-8}, 2692 {0x198,0x198,-1,1},
2290 {0x1f48,0x1f4d,1,-8}, {0x1f59,0x1f5f,2,-8}, {0x1f68,0x1f6f,1,-8}, 2693 {0x19c,0x19c,-1,211},
2291 {0x1fb8,0x1fb9,1,-8}, {0x1fba,0x1fbb,1,-74}, {0x1fc8,0x1fcb,1,-86}, 2694 {0x19d,0x19d,-1,213},
2292 {0x1fd8,0x1fd9,1,-8}, {0x1fda,0x1fdb,1,-100}, {0x1fe8,0x1fe9,1,-8}, 2695 {0x19f,0x19f,-1,214},
2293 {0x1fea,0x1feb,1,-112}, {0x1fec,0x1fec,-1,-7}, {0x1ff8,0x1ff9,1,-128}, 2696 {0x1a0,0x1a4,2,1},
2294 {0x1ffa,0x1ffb,1,-126}, {0x2126,0x2126,-1,-7517}, {0x212a,0x212a,-1,-8383}, 2697 {0x1a6,0x1a6,-1,218},
2295 {0x212b,0x212b,-1,-8262}, {0xff21,0xff3a,1,32}, {0x10400,0x10427,1,40} 2698 {0x1a7,0x1a7,-1,1},
2699 {0x1a9,0x1a9,-1,218},
2700 {0x1ac,0x1ac,-1,1},
2701 {0x1ae,0x1ae,-1,218},
2702 {0x1af,0x1af,-1,1},
2703 {0x1b1,0x1b2,1,217},
2704 {0x1b3,0x1b5,2,1},
2705 {0x1b7,0x1b7,-1,219},
2706 {0x1b8,0x1bc,4,1},
2707 {0x1c4,0x1c4,-1,2},
2708 {0x1c5,0x1c5,-1,1},
2709 {0x1c7,0x1c7,-1,2},
2710 {0x1c8,0x1c8,-1,1},
2711 {0x1ca,0x1ca,-1,2},
2712 {0x1cb,0x1db,2,1},
2713 {0x1de,0x1ee,2,1},
2714 {0x1f1,0x1f1,-1,2},
2715 {0x1f2,0x1f4,2,1},
2716 {0x1f6,0x1f6,-1,-97},
2717 {0x1f7,0x1f7,-1,-56},
2718 {0x1f8,0x21e,2,1},
2719 {0x220,0x220,-1,-130},
2720 {0x222,0x232,2,1},
2721 {0x23a,0x23a,-1,10795},
2722 {0x23b,0x23b,-1,1},
2723 {0x23d,0x23d,-1,-163},
2724 {0x23e,0x23e,-1,10792},
2725 {0x241,0x241,-1,1},
2726 {0x243,0x243,-1,-195},
2727 {0x244,0x244,-1,69},
2728 {0x245,0x245,-1,71},
2729 {0x246,0x24e,2,1},
2730 {0x370,0x372,2,1},
2731 {0x376,0x376,-1,1},
2732 {0x386,0x386,-1,38},
2733 {0x388,0x38a,1,37},
2734 {0x38c,0x38c,-1,64},
2735 {0x38e,0x38f,1,63},
2736 {0x391,0x3a1,1,32},
2737 {0x3a3,0x3ab,1,32},
2738 {0x3cf,0x3cf,-1,8},
2739 {0x3d8,0x3ee,2,1},
2740 {0x3f4,0x3f4,-1,-60},
2741 {0x3f7,0x3f7,-1,1},
2742 {0x3f9,0x3f9,-1,-7},
2743 {0x3fa,0x3fa,-1,1},
2744 {0x3fd,0x3ff,1,-130},
2745 {0x400,0x40f,1,80},
2746 {0x410,0x42f,1,32},
2747 {0x460,0x480,2,1},
2748 {0x48a,0x4be,2,1},
2749 {0x4c0,0x4c0,-1,15},
2750 {0x4c1,0x4cd,2,1},
2751 {0x4d0,0x524,2,1},
2752 {0x531,0x556,1,48},
2753 {0x10a0,0x10c5,1,7264},
2754 {0x1e00,0x1e94,2,1},
2755 {0x1e9e,0x1e9e,-1,-7615},
2756 {0x1ea0,0x1efe,2,1},
2757 {0x1f08,0x1f0f,1,-8},
2758 {0x1f18,0x1f1d,1,-8},
2759 {0x1f28,0x1f2f,1,-8},
2760 {0x1f38,0x1f3f,1,-8},
2761 {0x1f48,0x1f4d,1,-8},
2762 {0x1f59,0x1f5f,2,-8},
2763 {0x1f68,0x1f6f,1,-8},
2764 {0x1f88,0x1f8f,1,-8},
2765 {0x1f98,0x1f9f,1,-8},
2766 {0x1fa8,0x1faf,1,-8},
2767 {0x1fb8,0x1fb9,1,-8},
2768 {0x1fba,0x1fbb,1,-74},
2769 {0x1fbc,0x1fbc,-1,-9},
2770 {0x1fc8,0x1fcb,1,-86},
2771 {0x1fcc,0x1fcc,-1,-9},
2772 {0x1fd8,0x1fd9,1,-8},
2773 {0x1fda,0x1fdb,1,-100},
2774 {0x1fe8,0x1fe9,1,-8},
2775 {0x1fea,0x1feb,1,-112},
2776 {0x1fec,0x1fec,-1,-7},
2777 {0x1ff8,0x1ff9,1,-128},
2778 {0x1ffa,0x1ffb,1,-126},
2779 {0x1ffc,0x1ffc,-1,-9},
2780 {0x2126,0x2126,-1,-7517},
2781 {0x212a,0x212a,-1,-8383},
2782 {0x212b,0x212b,-1,-8262},
2783 {0x2132,0x2132,-1,28},
2784 {0x2160,0x216f,1,16},
2785 {0x2183,0x2183,-1,1},
2786 {0x24b6,0x24cf,1,26},
2787 {0x2c00,0x2c2e,1,48},
2788 {0x2c60,0x2c60,-1,1},
2789 {0x2c62,0x2c62,-1,-10743},
2790 {0x2c63,0x2c63,-1,-3814},
2791 {0x2c64,0x2c64,-1,-10727},
2792 {0x2c67,0x2c6b,2,1},
2793 {0x2c6d,0x2c6d,-1,-10780},
2794 {0x2c6e,0x2c6e,-1,-10749},
2795 {0x2c6f,0x2c6f,-1,-10783},
2796 {0x2c70,0x2c70,-1,-10782},
2797 {0x2c72,0x2c75,3,1},
2798 {0x2c7e,0x2c7f,1,-10815},
2799 {0x2c80,0x2ce2,2,1},
2800 {0x2ceb,0x2ced,2,1},
2801 {0xa640,0xa65e,2,1},
2802 {0xa662,0xa66c,2,1},
2803 {0xa680,0xa696,2,1},
2804 {0xa722,0xa72e,2,1},
2805 {0xa732,0xa76e,2,1},
2806 {0xa779,0xa77b,2,1},
2807 {0xa77d,0xa77d,-1,-35332},
2808 {0xa77e,0xa786,2,1},
2809 {0xa78b,0xa78b,-1,1},
2810 {0xff21,0xff3a,1,32},
2811 {0x10400,0x10427,1,40}
2296 }; 2812 };
2297 2813
2298 static convertStruct toUpper[] = 2814 static convertStruct toUpper[] =
2299 { 2815 {
2300 {0x61,0x7a,1,-32}, {0xb5,0xb5,-1,743}, {0xe0,0xf6,1,-32}, 2816 {0x61,0x7a,1,-32},
2301 {0xf8,0xfe,1,-32}, {0xff,0xff,-1,121}, {0x101,0x12f,2,-1}, 2817 {0xb5,0xb5,-1,743},
2302 {0x131,0x131,-1,-232}, {0x133,0x137,2,-1}, {0x13a,0x148,2,-1}, 2818 {0xe0,0xf6,1,-32},
2303 {0x14b,0x177,2,-1}, {0x17a,0x17e,2,-1}, {0x17f,0x17f,-1,-300}, 2819 {0xf8,0xfe,1,-32},
2304 {0x183,0x185,2,-1}, {0x188,0x18c,4,-1}, {0x192,0x192,-1,-1}, 2820 {0xff,0xff,-1,121},
2305 {0x195,0x195,-1,97}, {0x199,0x199,-1,-1}, {0x19e,0x19e,-1,130}, 2821 {0x101,0x12f,2,-1},
2306 {0x1a1,0x1a5,2,-1}, {0x1a8,0x1ad,5,-1}, {0x1b0,0x1b4,4,-1}, 2822 {0x131,0x131,-1,-232},
2307 {0x1b6,0x1b9,3,-1}, {0x1bd,0x1bd,-1,-1}, {0x1bf,0x1bf,-1,56}, 2823 {0x133,0x137,2,-1},
2308 {0x1c5,0x1c6,1,-1}, {0x1c8,0x1c9,1,-1}, {0x1cb,0x1cc,1,-1}, 2824 {0x13a,0x148,2,-1},
2309 {0x1ce,0x1dc,2,-1}, {0x1dd,0x1dd,-1,-79}, {0x1df,0x1ef,2,-1}, 2825 {0x14b,0x177,2,-1},
2310 {0x1f2,0x1f3,1,-1}, {0x1f5,0x1f9,4,-1}, {0x1fb,0x21f,2,-1}, 2826 {0x17a,0x17e,2,-1},
2311 {0x223,0x233,2,-1}, {0x253,0x253,-1,-210}, {0x254,0x254,-1,-206}, 2827 {0x17f,0x17f,-1,-300},
2312 {0x256,0x257,1,-205}, {0x259,0x259,-1,-202}, {0x25b,0x25b,-1,-203}, 2828 {0x180,0x180,-1,195},
2313 {0x260,0x260,-1,-205}, {0x263,0x263,-1,-207}, {0x268,0x268,-1,-209}, 2829 {0x183,0x185,2,-1},
2314 {0x269,0x26f,6,-211}, {0x272,0x272,-1,-213}, {0x275,0x275,-1,-214}, 2830 {0x188,0x18c,4,-1},
2315 {0x280,0x283,3,-218}, {0x288,0x288,-1,-218}, {0x28a,0x28b,1,-217}, 2831 {0x192,0x192,-1,-1},
2316 {0x292,0x292,-1,-219}, {0x3ac,0x3ac,-1,-38}, {0x3ad,0x3af,1,-37}, 2832 {0x195,0x195,-1,97},
2317 {0x3b1,0x3c1,1,-32}, {0x3c2,0x3c2,-1,-31}, {0x3c3,0x3cb,1,-32}, 2833 {0x199,0x199,-1,-1},
2318 {0x3cc,0x3cc,-1,-64}, {0x3cd,0x3ce,1,-63}, {0x3d0,0x3d0,-1,-62}, 2834 {0x19a,0x19a,-1,163},
2319 {0x3d1,0x3d1,-1,-57}, {0x3d5,0x3d5,-1,-47}, {0x3d6,0x3d6,-1,-54}, 2835 {0x19e,0x19e,-1,130},
2320 {0x3d9,0x3ef,2,-1}, {0x3f0,0x3f0,-1,-86}, {0x3f1,0x3f1,-1,-80}, 2836 {0x1a1,0x1a5,2,-1},
2321 {0x3f2,0x3f2,-1,7}, {0x3f5,0x3f5,-1,-96}, {0x3f8,0x3fb,3,-1}, 2837 {0x1a8,0x1ad,5,-1},
2322 {0x430,0x44f,1,-32}, {0x450,0x45f,1,-80}, {0x461,0x481,2,-1}, 2838 {0x1b0,0x1b4,4,-1},
2323 {0x48b,0x4bf,2,-1}, {0x4c2,0x4ce,2,-1}, {0x4d1,0x4f5,2,-1}, 2839 {0x1b6,0x1b9,3,-1},
2324 {0x4f9,0x501,8,-1}, {0x503,0x50f,2,-1}, {0x561,0x586,1,-48}, 2840 {0x1bd,0x1bd,-1,-1},
2325 {0x1e01,0x1e95,2,-1}, {0x1e9b,0x1e9b,-1,-59}, {0x1ea1,0x1ef9,2,-1}, 2841 {0x1bf,0x1bf,-1,56},
2326 {0x1f00,0x1f07,1,8}, {0x1f10,0x1f15,1,8}, {0x1f20,0x1f27,1,8}, 2842 {0x1c5,0x1c5,-1,-1},
2327 {0x1f30,0x1f37,1,8}, {0x1f40,0x1f45,1,8}, {0x1f51,0x1f57,2,8}, 2843 {0x1c6,0x1c6,-1,-2},
2328 {0x1f60,0x1f67,1,8}, {0x1f70,0x1f71,1,74}, {0x1f72,0x1f75,1,86}, 2844 {0x1c8,0x1c8,-1,-1},
2329 {0x1f76,0x1f77,1,100}, {0x1f78,0x1f79,1,128}, {0x1f7a,0x1f7b,1,112}, 2845 {0x1c9,0x1c9,-1,-2},
2330 {0x1f7c,0x1f7d,1,126}, {0x1f80,0x1f87,1,8}, {0x1f90,0x1f97,1,8}, 2846 {0x1cb,0x1cb,-1,-1},
2331 {0x1fa0,0x1fa7,1,8}, {0x1fb0,0x1fb1,1,8}, {0x1fb3,0x1fb3,-1,9}, 2847 {0x1cc,0x1cc,-1,-2},
2332 {0x1fbe,0x1fbe,-1,-7205}, {0x1fc3,0x1fc3,-1,9}, {0x1fd0,0x1fd1,1,8}, 2848 {0x1ce,0x1dc,2,-1},
2333 {0x1fe0,0x1fe1,1,8}, {0x1fe5,0x1fe5,-1,7}, {0x1ff3,0x1ff3,-1,9}, 2849 {0x1dd,0x1dd,-1,-79},
2334 {0xff41,0xff5a,1,-32}, {0x10428,0x1044f,1,-40} 2850 {0x1df,0x1ef,2,-1},
2851 {0x1f2,0x1f2,-1,-1},
2852 {0x1f3,0x1f3,-1,-2},
2853 {0x1f5,0x1f9,4,-1},
2854 {0x1fb,0x21f,2,-1},
2855 {0x223,0x233,2,-1},
2856 {0x23c,0x23c,-1,-1},
2857 {0x23f,0x240,1,10815},
2858 {0x242,0x247,5,-1},
2859 {0x249,0x24f,2,-1},
2860 {0x250,0x250,-1,10783},
2861 {0x251,0x251,-1,10780},
2862 {0x252,0x252,-1,10782},
2863 {0x253,0x253,-1,-210},
2864 {0x254,0x254,-1,-206},
2865 {0x256,0x257,1,-205},
2866 {0x259,0x259,-1,-202},
2867 {0x25b,0x25b,-1,-203},
2868 {0x260,0x260,-1,-205},
2869 {0x263,0x263,-1,-207},
2870 {0x268,0x268,-1,-209},
2871 {0x269,0x269,-1,-211},
2872 {0x26b,0x26b,-1,10743},
2873 {0x26f,0x26f,-1,-211},
2874 {0x271,0x271,-1,10749},
2875 {0x272,0x272,-1,-213},
2876 {0x275,0x275,-1,-214},
2877 {0x27d,0x27d,-1,10727},
2878 {0x280,0x283,3,-218},
2879 {0x288,0x288,-1,-218},
2880 {0x289,0x289,-1,-69},
2881 {0x28a,0x28b,1,-217},
2882 {0x28c,0x28c,-1,-71},
2883 {0x292,0x292,-1,-219},
2884 {0x345,0x345,-1,84},
2885 {0x371,0x373,2,-1},
2886 {0x377,0x377,-1,-1},
2887 {0x37b,0x37d,1,130},
2888 {0x3ac,0x3ac,-1,-38},
2889 {0x3ad,0x3af,1,-37},
2890 {0x3b1,0x3c1,1,-32},
2891 {0x3c2,0x3c2,-1,-31},
2892 {0x3c3,0x3cb,1,-32},
2893 {0x3cc,0x3cc,-1,-64},
2894 {0x3cd,0x3ce,1,-63},
2895 {0x3d0,0x3d0,-1,-62},
2896 {0x3d1,0x3d1,-1,-57},
2897 {0x3d5,0x3d5,-1,-47},
2898 {0x3d6,0x3d6,-1,-54},
2899 {0x3d7,0x3d7,-1,-8},
2900 {0x3d9,0x3ef,2,-1},
2901 {0x3f0,0x3f0,-1,-86},
2902 {0x3f1,0x3f1,-1,-80},
2903 {0x3f2,0x3f2,-1,7},
2904 {0x3f5,0x3f5,-1,-96},
2905 {0x3f8,0x3fb,3,-1},
2906 {0x430,0x44f,1,-32},
2907 {0x450,0x45f,1,-80},
2908 {0x461,0x481,2,-1},
2909 {0x48b,0x4bf,2,-1},
2910 {0x4c2,0x4ce,2,-1},
2911 {0x4cf,0x4cf,-1,-15},
2912 {0x4d1,0x525,2,-1},
2913 {0x561,0x586,1,-48},
2914 {0x1d79,0x1d79,-1,35332},
2915 {0x1d7d,0x1d7d,-1,3814},
2916 {0x1e01,0x1e95,2,-1},
2917 {0x1e9b,0x1e9b,-1,-59},
2918 {0x1ea1,0x1eff,2,-1},
2919 {0x1f00,0x1f07,1,8},
2920 {0x1f10,0x1f15,1,8},
2921 {0x1f20,0x1f27,1,8},
2922 {0x1f30,0x1f37,1,8},
2923 {0x1f40,0x1f45,1,8},
2924 {0x1f51,0x1f57,2,8},
2925 {0x1f60,0x1f67,1,8},
2926 {0x1f70,0x1f71,1,74},
2927 {0x1f72,0x1f75,1,86},
2928 {0x1f76,0x1f77,1,100},
2929 {0x1f78,0x1f79,1,128},
2930 {0x1f7a,0x1f7b,1,112},
2931 {0x1f7c,0x1f7d,1,126},
2932 {0x1f80,0x1f87,1,8},
2933 {0x1f90,0x1f97,1,8},
2934 {0x1fa0,0x1fa7,1,8},
2935 {0x1fb0,0x1fb1,1,8},
2936 {0x1fb3,0x1fb3,-1,9},
2937 {0x1fbe,0x1fbe,-1,-7205},
2938 {0x1fc3,0x1fc3,-1,9},
2939 {0x1fd0,0x1fd1,1,8},
2940 {0x1fe0,0x1fe1,1,8},
2941 {0x1fe5,0x1fe5,-1,7},
2942 {0x1ff3,0x1ff3,-1,9},
2943 {0x214e,0x214e,-1,-28},
2944 {0x2170,0x217f,1,-16},
2945 {0x2184,0x2184,-1,-1},
2946 {0x24d0,0x24e9,1,-26},
2947 {0x2c30,0x2c5e,1,-48},
2948 {0x2c61,0x2c61,-1,-1},
2949 {0x2c65,0x2c65,-1,-10795},
2950 {0x2c66,0x2c66,-1,-10792},
2951 {0x2c68,0x2c6c,2,-1},
2952 {0x2c73,0x2c76,3,-1},
2953 {0x2c81,0x2ce3,2,-1},
2954 {0x2cec,0x2cee,2,-1},
2955 {0x2d00,0x2d25,1,-7264},
2956 {0xa641,0xa65f,2,-1},
2957 {0xa663,0xa66d,2,-1},
2958 {0xa681,0xa697,2,-1},
2959 {0xa723,0xa72f,2,-1},
2960 {0xa733,0xa76f,2,-1},
2961 {0xa77a,0xa77c,2,-1},
2962 {0xa77f,0xa787,2,-1},
2963 {0xa78c,0xa78c,-1,-1},
2964 {0xff41,0xff5a,1,-32},
2965 {0x10428,0x1044f,1,-40}
2335 }; 2966 };
2336 2967
2337 /* 2968 /*
2338 * Return the upper-case equivalent of "a", which is a UCS-4 character. Use 2969 * Return the upper-case equivalent of "a", which is a UCS-4 character. Use
2339 * simple case folding. 2970 * simple case folding.