############################################################################### # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice (including the next # paragraph) shall be included in all copies or substantial portions of the # Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. # diff --git a/src/xlibi18n/lcUniConv/jisx0208.h b/src/xlibi18n/lcUniConv/jisx0208.h index 5888f6f..daf4797 100644 --- a/src/xlibi18n/lcUniConv/jisx0208.h +++ b/src/xlibi18n/lcUniConv/jisx0208.h @@ -3,6 +3,451 @@ * JISX0208.1990-0 */ +#ifdef sun +static const unsigned short jisx0208vdc_2uni_page21[167] = { + /* 0x21 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xff3c, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x22 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x222a, + 0x2229, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0x00ac, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0x2220, 0x22a5, 0xfffd, 0xfffd, 0xfffd, + 0x2261, 0x2252, 0xfffd, 0xfffd, 0x221a, 0xfffd, 0xfffd, 0x2235, + 0x222b, +}; +static const unsigned short jisx0208vdc_2uni_page2d[92] = { + /* 0x2d */ + 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, + 0x2468, 0x2469, 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, + 0x2470, 0x2471, 0x2472, 0x2473, 0x2160, 0x2161, 0x2162, 0x2163, + 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0xfffd, 0x3349, + 0x3314, 0x3322, 0x334d, 0x3318, 0x3327, 0x3303, 0x3336, 0x3351, + 0x3357, 0x330d, 0x3326, 0x3323, 0x332b, 0x334a, 0x333b, 0x339c, + 0x339d, 0x339e, 0x338e, 0x338f, 0x33c4, 0x33a1, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x337b, 0x301d, + 0x301f, 0x2116, 0x33cd, 0x2121, 0x32a4, 0x32a5, 0x32a6, 0x32a7, + 0x32a8, 0x3231, 0x3232, 0x3239, 0x337e, 0x337d, 0x337c, 0x2252, + 0x2261, 0x222b, 0x222e, 0x2211, 0x221a, 0x22a5, 0x2220, 0x221f, + 0x22bf, 0x2235, 0x2229, 0x222a, +}; +static const unsigned short jisx0208vdc_2uni_page75[940] = { + /* 0x75 */ + 0xe000, 0xe001, 0xe002, 0xe003, 0xe004, 0xe005, 0xe006, 0xe007, + 0xe008, 0xe009, 0xe00a, 0xe00b, 0xe00c, 0xe00d, 0xe00e, 0xe00f, + 0xe010, 0xe011, 0xe012, 0xe013, 0xe014, 0xe015, 0xe016, 0xe017, + 0xe018, 0xe019, 0xe01a, 0xe01b, 0xe01c, 0xe01d, 0xe01e, 0xe01f, + 0xe020, 0xe021, 0xe022, 0xe023, 0xe024, 0xe025, 0xe026, 0xe027, + 0xe028, 0xe029, 0xe02a, 0xe02b, 0xe02c, 0xe02d, 0xe02e, 0xe02f, + 0xe030, 0xe031, 0xe032, 0xe033, 0xe034, 0xe035, 0xe036, 0xe037, + 0xe038, 0xe039, 0xe03a, 0xe03b, 0xe03c, 0xe03d, 0xe03e, 0xe03f, + 0xe040, 0xe041, 0xe042, 0xe043, 0xe044, 0xe045, 0xe046, 0xe047, + 0xe048, 0xe049, 0xe04a, 0xe04b, 0xe04c, 0xe04d, 0xe04e, 0xe04f, + 0xe050, 0xe051, 0xe052, 0xe053, 0xe054, 0xe055, 0xe056, 0xe057, + 0xe058, 0xe059, 0xe05a, 0xe05b, 0xe05c, 0xe05d, + /* 0x76 */ + 0xe05e, 0xe05f, 0xe060, 0xe061, 0xe062, 0xe063, 0xe064, 0xe065, + 0xe066, 0xe067, 0xe068, 0xe069, 0xe06a, 0xe06b, 0xe06c, 0xe06d, + 0xe06e, 0xe06f, 0xe070, 0xe071, 0xe072, 0xe073, 0xe074, 0xe075, + 0xe076, 0xe077, 0xe078, 0xe079, 0xe07a, 0xe07b, 0xe07c, 0xe07d, + 0xe07e, 0xe07f, 0xe080, 0xe081, 0xe082, 0xe083, 0xe084, 0xe085, + 0xe086, 0xe087, 0xe088, 0xe089, 0xe08a, 0xe08b, 0xe08c, 0xe08d, + 0xe08e, 0xe08f, 0xe090, 0xe091, 0xe092, 0xe093, 0xe094, 0xe095, + 0xe096, 0xe097, 0xe098, 0xe099, 0xe09a, 0xe09b, 0xe09c, 0xe09d, + 0xe09e, 0xe09f, 0xe0a0, 0xe0a1, 0xe0a2, 0xe0a3, 0xe0a4, 0xe0a5, + 0xe0a6, 0xe0a7, 0xe0a8, 0xe0a9, 0xe0aa, 0xe0ab, 0xe0ac, 0xe0ad, + 0xe0ae, 0xe0af, 0xe0b0, 0xe0b1, 0xe0b2, 0xe0b3, 0xe0b4, 0xe0b5, + 0xe0b6, 0xe0b7, 0xe0b8, 0xe0b9, 0xe0ba, 0xe0bb, + /* 0x77 */ + 0xe0bc, 0xe0bd, 0xe0be, 0xe0bf, 0xe0c0, 0xe0c1, 0xe0c2, 0xe0c3, + 0xe0c4, 0xe0c5, 0xe0c6, 0xe0c7, 0xe0c8, 0xe0c9, 0xe0ca, 0xe0cb, + 0xe0cc, 0xe0cd, 0xe0ce, 0xe0cf, 0xe0d0, 0xe0d1, 0xe0d2, 0xe0d3, + 0xe0d4, 0xe0d5, 0xe0d6, 0xe0d7, 0xe0d8, 0xe0d9, 0xe0da, 0xe0db, + 0xe0dc, 0xe0dd, 0xe0de, 0xe0df, 0xe0e0, 0xe0e1, 0xe0e2, 0xe0e3, + 0xe0e4, 0xe0e5, 0xe0e6, 0xe0e7, 0xe0e8, 0xe0e9, 0xe0ea, 0xe0eb, + 0xe0ec, 0xe0ed, 0xe0ee, 0xe0ef, 0xe0f0, 0xe0f1, 0xe0f2, 0xe0f3, + 0xe0f4, 0xe0f5, 0xe0f6, 0xe0f7, 0xe0f8, 0xe0f9, 0xe0fa, 0xe0fb, + 0xe0fc, 0xe0fd, 0xe0fe, 0xe0ff, 0xe100, 0xe101, 0xe102, 0xe103, + 0xe104, 0xe105, 0xe106, 0xe107, 0xe108, 0xe109, 0xe10a, 0xe10b, + 0xe10c, 0xe10d, 0xe10e, 0xe10f, 0xe110, 0xe111, 0xe112, 0xe113, + 0xe114, 0xe115, 0xe116, 0xe117, 0xe118, 0xe119, + /* 0x78 */ + 0xe11a, 0xe11b, 0xe11c, 0xe11d, 0xe11e, 0xe11f, 0xe120, 0xe121, + 0xe122, 0xe123, 0xe124, 0xe125, 0xe126, 0xe127, 0xe128, 0xe129, + 0xe12a, 0xe12b, 0xe12c, 0xe12d, 0xe12e, 0xe12f, 0xe130, 0xe131, + 0xe132, 0xe133, 0xe134, 0xe135, 0xe136, 0xe137, 0xe138, 0xe139, + 0xe13a, 0xe13b, 0xe13c, 0xe13d, 0xe13e, 0xe13f, 0xe140, 0xe141, + 0xe142, 0xe143, 0xe144, 0xe145, 0xe146, 0xe147, 0xe148, 0xe149, + 0xe14a, 0xe14b, 0xe14c, 0xe14d, 0xe14e, 0xe14f, 0xe150, 0xe151, + 0xe152, 0xe153, 0xe154, 0xe155, 0xe156, 0xe157, 0xe158, 0xe159, + 0xe15a, 0xe15b, 0xe15c, 0xe15d, 0xe15e, 0xe15f, 0xe160, 0xe161, + 0xe162, 0xe163, 0xe164, 0xe165, 0xe166, 0xe167, 0xe168, 0xe169, + 0xe16a, 0xe16b, 0xe16c, 0xe16d, 0xe16e, 0xe16f, 0xe170, 0xe171, + 0xe172, 0xe173, 0xe174, 0xe175, 0xe176, 0xe177, + /* 0x79 */ + 0xe178, 0xe179, 0xe17a, 0xe17b, 0xe17c, 0xe17d, 0xe17e, 0xe17f, + 0xe180, 0xe181, 0xe182, 0xe183, 0xe184, 0xe185, 0xe186, 0xe187, + 0xe188, 0xe189, 0xe18a, 0xe18b, 0xe18c, 0xe18d, 0xe18e, 0xe18f, + 0xe190, 0xe191, 0xe192, 0xe193, 0xe194, 0xe195, 0xe196, 0xe197, + 0xe198, 0xe199, 0xe19a, 0xe19b, 0xe19c, 0xe19d, 0xe19e, 0xe19f, + 0xe1a0, 0xe1a1, 0xe1a2, 0xe1a3, 0xe1a4, 0xe1a5, 0xe1a6, 0xe1a7, + 0xe1a8, 0xe1a9, 0xe1aa, 0xe1ab, 0xe1ac, 0xe1ad, 0xe1ae, 0xe1af, + 0xe1b0, 0xe1b1, 0xe1b2, 0xe1b3, 0xe1b4, 0xe1b5, 0xe1b6, 0xe1b7, + 0xe1b8, 0xe1b9, 0xe1ba, 0xe1bb, 0xe1bc, 0xe1bd, 0xe1be, 0xe1bf, + 0xe1c0, 0xe1c1, 0xe1c2, 0xe1c3, 0xe1c4, 0xe1c5, 0xe1c6, 0xe1c7, + 0xe1c8, 0xe1c9, 0xe1ca, 0xe1cb, 0xe1cc, 0xe1cd, 0xe1ce, 0xe1cf, + 0xe1d0, 0xe1d1, 0xe1d2, 0xe1d3, 0xe1d4, 0xe1d5, + /* 0x7a */ + 0xe1d6, 0xe1d7, 0xe1d8, 0xe1d9, 0xe1da, 0xe1db, 0xe1dc, 0xe1dd, + 0xe1de, 0xe1df, 0xe1e0, 0xe1e1, 0xe1e2, 0xe1e3, 0xe1e4, 0xe1e5, + 0xe1e6, 0xe1e7, 0xe1e8, 0xe1e9, 0xe1ea, 0xe1eb, 0xe1ec, 0xe1ed, + 0xe1ee, 0xe1ef, 0xe1f0, 0xe1f1, 0xe1f2, 0xe1f3, 0xe1f4, 0xe1f5, + 0xe1f6, 0xe1f7, 0xe1f8, 0xe1f9, 0xe1fa, 0xe1fb, 0xe1fc, 0xe1fd, + 0xe1fe, 0xe1ff, 0xe200, 0xe201, 0xe202, 0xe203, 0xe204, 0xe205, + 0xe206, 0xe207, 0xe208, 0xe209, 0xe20a, 0xe20b, 0xe20c, 0xe20d, + 0xe20e, 0xe20f, 0xe210, 0xe211, 0xe212, 0xe213, 0xe214, 0xe215, + 0xe216, 0xe217, 0xe218, 0xe219, 0xe21a, 0xe21b, 0xe21c, 0xe21d, + 0xe21e, 0xe21f, 0xe220, 0xe221, 0xe222, 0xe223, 0xe224, 0xe225, + 0xe226, 0xe227, 0xe228, 0xe229, 0xe22a, 0xe22b, 0xe22c, 0xe22d, + 0xe22e, 0xe22f, 0xe230, 0xe231, 0xe232, 0xe233, + /* 0x7b */ + 0xe234, 0xe235, 0xe236, 0xe237, 0xe238, 0xe239, 0xe23a, 0xe23b, + 0xe23c, 0xe23d, 0xe23e, 0xe23f, 0xe240, 0xe241, 0xe242, 0xe243, + 0xe244, 0xe245, 0xe246, 0xe247, 0xe248, 0xe249, 0xe24a, 0xe24b, + 0xe24c, 0xe24d, 0xe24e, 0xe24f, 0xe250, 0xe251, 0xe252, 0xe253, + 0xe254, 0xe255, 0xe256, 0xe257, 0xe258, 0xe259, 0xe25a, 0xe25b, + 0xe25c, 0xe25d, 0xe25e, 0xe25f, 0xe260, 0xe261, 0xe262, 0xe263, + 0xe264, 0xe265, 0xe266, 0xe267, 0xe268, 0xe269, 0xe26a, 0xe26b, + 0xe26c, 0xe26d, 0xe26e, 0xe26f, 0xe270, 0xe271, 0xe272, 0xe273, + 0xe274, 0xe275, 0xe276, 0xe277, 0xe278, 0xe279, 0xe27a, 0xe27b, + 0xe27c, 0xe27d, 0xe27e, 0xe27f, 0xe280, 0xe281, 0xe282, 0xe283, + 0xe284, 0xe285, 0xe286, 0xe287, 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e30b, 0xe30c, 0xe30d, 0xe30e, 0xe30f, + 0xe310, 0xe311, 0xe312, 0xe313, 0xe314, 0xe315, 0xe316, 0xe317, + 0xe318, 0xe319, 0xe31a, 0xe31b, 0xe31c, 0xe31d, 0xe31e, 0xe31f, + 0xe320, 0xe321, 0xe322, 0xe323, 0xe324, 0xe325, 0xe326, 0xe327, + 0xe328, 0xe329, 0xe32a, 0xe32b, 0xe32c, 0xe32d, 0xe32e, 0xe32f, + 0xe330, 0xe331, 0xe332, 0xe333, 0xe334, 0xe335, 0xe336, 0xe337, + 0xe338, 0xe339, 0xe33a, 0xe33b, 0xe33c, 0xe33d, 0xe33e, 0xe33f, + 0xe340, 0xe341, 0xe342, 0xe343, 0xe344, 0xe345, 0xe346, 0xe347, + 0xe348, 0xe349, 0xe34a, 0xe34b, 0xe34c, 0xe34d, + /* 0x7e */ + 0xe34e, 0xe34f, 0xe350, 0xe351, 0xe352, 0xe353, 0xe354, 0xe355, + 0xe356, 0xe357, 0xe358, 0xe359, 0xe35a, 0xe35b, 0xe35c, 0xe35d, + 0xe35e, 0xe35f, 0xe360, 0xe361, 0xe362, 0xe363, 0xe364, 0xe365, + 0xe366, 0xe367, 0xe368, 0xe369, 0xe36a, 0xe36b, 0xe36c, 0xe36d, + 0xe36e, 0xe36f, 0xe370, 0xe371, 0xe372, 0xe373, 0xe374, 0xe375, + 0xe376, 0xe377, 0xe378, 0xe379, 0xe37a, 0xe37b, 0xe37c, 0xe37d, + 0xe37e, 0xe37f, 0xe380, 0xe381, 0xe382, 0xe383, 0xe384, 0xe385, + 0xe386, 0xe387, 0xe388, 0xe389, 0xe38a, 0xe38b, 0xe38c, 0xe38d, + 0xe38e, 0xe38f, 0xe390, 0xe391, 0xe392, 0xe393, 0xe394, 0xe395, + 0xe396, 0xe397, 0xe398, 0xe399, 0xe39a, 0xe39b, 0xe39c, 0xe39d, + 0xe39e, 0xe39f, 0xe3a0, 0xe3a1, 0xe3a2, 0xe3a3, 0xe3a4, 0xe3a5, + 0xe3a6, 0xe3a7, 0xe3a8, 0xe3a9, 0xe3aa, 0xe3ab, +}; + +static int +jisx0208vdc_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c1 = s[0]; + if ((c1 >= 0x21 && c1 <= 0x22) || (c1 == 0x2d) || (c1 >= 0x75 && c1 <= 0x7e)) { + if (n >= 2) { + unsigned char c2 = s[1]; + if (c2 >= 0x21 && c2 < 0x7f) { + unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); + unsigned short wc = 0xfffd; + if (i < 1128) { + if (i < 167) + wc = jisx0208vdc_2uni_page21[i]; + } else if (i < 7896) { + if (i < 1220) + wc = jisx0208vdc_2uni_page2d[i-1128]; + } else { + if (i < 8836) + wc = jisx0208vdc_2uni_page75[i-7896]; + } + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOFEW(0); + } + return RET_ILSEQ; +} + +static const unsigned short jisx0208vdc_2charset[1025] = { + 0x224c, 0x2d62, 0x2d64, 0x2d35, 0x2d36, 0x2d37, 0x2d38, 0x2d39, + 0x2d3a, 0x2d3b, 0x2d3c, 0x2d3d, 0x2d3e, 0x2d74, 0x2d75, 0x2d78, + 0x2d77, 0x2d7b, 0x2d7c, 0x2d72, 0x2d73, 0x2d7a, 0x2d70, 0x2d71, + 0x2d76, 0x2d79, 0x2d21, 0x2d22, 0x2d23, 0x2d24, 0x2d25, 0x2d26, + 0x2d27, 0x2d28, 0x2d29, 0x2d2a, 0x2d2b, 0x2d2c, 0x2d2d, 0x2d2e, + 0x2d2f, 0x2d30, 0x2d31, 0x2d32, 0x2d33, 0x2d34, 0x2d60, 0x2d61, + 0x2d6a, 0x2d6b, 0x2d6c, 0x2d65, 0x2d66, 0x2d67, 0x2d68, 0x2d69, + 0x2d46, 0x2d4a, 0x2d41, 0x2d44, 0x2d42, 0x2d4c, 0x2d4b, 0x2d45, + 0x2d4d, 0x2d47, 0x2d4f, 0x2d40, 0x2d4e, 0x2d43, 0x2d48, 0x2d49, + 0x2d5f, 0x2d6f, 0x2d6e, 0x2d6d, 0x2d53, 0x2d54, 0x2d50, 0x2d51, + 0x2d52, 0x2d56, 0x2d55, 0x2d63, 0x7521, 0x7522, 0x7523, 0x7524, + 0x7525, 0x7526, 0x7527, 0x7528, 0x7529, 0x752a, 0x752b, 0x752c, + 0x752d, 0x752e, 0x752f, 0x7530, 0x7531, 0x7532, 0x7533, 0x7534, + 0x7535, 0x7536, 0x7537, 0x7538, 0x7539, 0x753a, 0x753b, 0x753c, + 0x753d, 0x753e, 0x753f, 0x7540, 0x7541, 0x7542, 0x7543, 0x7544, + 0x7545, 0x7546, 0x7547, 0x7548, 0x7549, 0x754a, 0x754b, 0x754c, + 0x754d, 0x754e, 0x754f, 0x7550, 0x7551, 0x7552, 0x7553, 0x7554, + 0x7555, 0x7556, 0x7557, 0x7558, 0x7559, 0x755a, 0x755b, 0x755c, + 0x755d, 0x755e, 0x755f, 0x7560, 0x7561, 0x7562, 0x7563, 0x7564, + 0x7565, 0x7566, 0x7567, 0x7568, 0x7569, 0x756a, 0x756b, 0x756c, + 0x756d, 0x756e, 0x756f, 0x7570, 0x7571, 0x7572, 0x7573, 0x7574, + 0x7575, 0x7576, 0x7577, 0x7578, 0x7579, 0x757a, 0x757b, 0x757c, + 0x757d, 0x757e, 0x7621, 0x7622, 0x7623, 0x7624, 0x7625, 0x7626, + 0x7627, 0x7628, 0x7629, 0x762a, 0x762b, 0x762c, 0x762d, 0x762e, + 0x762f, 0x7630, 0x7631, 0x7632, 0x7633, 0x7634, 0x7635, 0x7636, + 0x7637, 0x7638, 0x7639, 0x763a, 0x763b, 0x763c, 0x763d, 0x763e, + 0x763f, 0x7640, 0x7641, 0x7642, 0x7643, 0x7644, 0x7645, 0x7646, + 0x7647, 0x7648, 0x7649, 0x764a, 0x764b, 0x764c, 0x764d, 0x764e, + 0x764f, 0x7650, 0x7651, 0x7652, 0x7653, 0x7654, 0x7655, 0x7656, + 0x7657, 0x7658, 0x7659, 0x765a, 0x765b, 0x765c, 0x765d, 0x765e, + 0x765f, 0x7660, 0x7661, 0x7662, 0x7663, 0x7664, 0x7665, 0x7666, + 0x7667, 0x7668, 0x7669, 0x766a, 0x766b, 0x766c, 0x766d, 0x766e, + 0x766f, 0x7670, 0x7671, 0x7672, 0x7673, 0x7674, 0x7675, 0x7676, + 0x7677, 0x7678, 0x7679, 0x767a, 0x767b, 0x767c, 0x767d, 0x767e, + 0x7721, 0x7722, 0x7723, 0x7724, 0x7725, 0x7726, 0x7727, 0x7728, + 0x7729, 0x772a, 0x772b, 0x772c, 0x772d, 0x772e, 0x772f, 0x7730, + 0x7731, 0x7732, 0x7733, 0x7734, 0x7735, 0x7736, 0x7737, 0x7738, + 0x7739, 0x773a, 0x773b, 0x773c, 0x773d, 0x773e, 0x773f, 0x7740, + 0x7741, 0x7742, 0x7743, 0x7744, 0x7745, 0x7746, 0x7747, 0x7748, + 0x7749, 0x774a, 0x774b, 0x774c, 0x774d, 0x774e, 0x774f, 0x7750, + 0x7751, 0x7752, 0x7753, 0x7754, 0x7755, 0x7756, 0x7757, 0x7758, + 0x7759, 0x775a, 0x775b, 0x775c, 0x775d, 0x775e, 0x775f, 0x7760, + 0x7761, 0x7762, 0x7763, 0x7764, 0x7765, 0x7766, 0x7767, 0x7768, + 0x7769, 0x776a, 0x776b, 0x776c, 0x776d, 0x776e, 0x776f, 0x7770, + 0x7771, 0x7772, 0x7773, 0x7774, 0x7775, 0x7776, 0x7777, 0x7778, + 0x7779, 0x777a, 0x777b, 0x777c, 0x777d, 0x777e, 0x7821, 0x7822, + 0x7823, 0x7824, 0x7825, 0x7826, 0x7827, 0x7828, 0x7829, 0x782a, + 0x782b, 0x782c, 0x782d, 0x782e, 0x782f, 0x7830, 0x7831, 0x7832, + 0x7833, 0x7834, 0x7835, 0x7836, 0x7837, 0x7838, 0x7839, 0x783a, + 0x783b, 0x783c, 0x783d, 0x783e, 0x783f, 0x7840, 0x7841, 0x7842, + 0x7843, 0x7844, 0x7845, 0x7846, 0x7847, 0x7848, 0x7849, 0x784a, + 0x784b, 0x784c, 0x784d, 0x784e, 0x784f, 0x7850, 0x7851, 0x7852, + 0x7853, 0x7854, 0x7855, 0x7856, 0x7857, 0x7858, 0x7859, 0x785a, + 0x785b, 0x785c, 0x785d, 0x785e, 0x785f, 0x7860, 0x7861, 0x7862, + 0x7863, 0x7864, 0x7865, 0x7866, 0x7867, 0x7868, 0x7869, 0x786a, + 0x786b, 0x786c, 0x786d, 0x786e, 0x786f, 0x7870, 0x7871, 0x7872, + 0x7873, 0x7874, 0x7875, 0x7876, 0x7877, 0x7878, 0x7879, 0x787a, + 0x787b, 0x787c, 0x787d, 0x787e, 0x7921, 0x7922, 0x7923, 0x7924, + 0x7925, 0x7926, 0x7927, 0x7928, 0x7929, 0x792a, 0x792b, 0x792c, + 0x792d, 0x792e, 0x792f, 0x7930, 0x7931, 0x7932, 0x7933, 0x7934, + 0x7935, 0x7936, 0x7937, 0x7938, 0x7939, 0x793a, 0x793b, 0x793c, + 0x793d, 0x793e, 0x793f, 0x7940, 0x7941, 0x7942, 0x7943, 0x7944, + 0x7945, 0x7946, 0x7947, 0x7948, 0x7949, 0x794a, 0x794b, 0x794c, + 0x794d, 0x794e, 0x794f, 0x7950, 0x7951, 0x7952, 0x7953, 0x7954, + 0x7955, 0x7956, 0x7957, 0x7958, 0x7959, 0x795a, 0x795b, 0x795c, + 0x795d, 0x795e, 0x795f, 0x7960, 0x7961, 0x7962, 0x7963, 0x7964, + 0x7965, 0x7966, 0x7967, 0x7968, 0x7969, 0x796a, 0x796b, 0x796c, + 0x796d, 0x796e, 0x796f, 0x7970, 0x7971, 0x7972, 0x7973, 0x7974, + 0x7975, 0x7976, 0x7977, 0x7978, 0x7979, 0x797a, 0x797b, 0x797c, + 0x797d, 0x797e, 0x7a21, 0x7a22, 0x7a23, 0x7a24, 0x7a25, 0x7a26, + 0x7a27, 0x7a28, 0x7a29, 0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 0x7d21, 0x7d22, 0x7d23, 0x7d24, + 0x7d25, 0x7d26, 0x7d27, 0x7d28, 0x7d29, 0x7d2a, 0x7d2b, 0x7d2c, + 0x7d2d, 0x7d2e, 0x7d2f, 0x7d30, 0x7d31, 0x7d32, 0x7d33, 0x7d34, + 0x7d35, 0x7d36, 0x7d37, 0x7d38, 0x7d39, 0x7d3a, 0x7d3b, 0x7d3c, + 0x7d3d, 0x7d3e, 0x7d3f, 0x7d40, 0x7d41, 0x7d42, 0x7d43, 0x7d44, + 0x7d45, 0x7d46, 0x7d47, 0x7d48, 0x7d49, 0x7d4a, 0x7d4b, 0x7d4c, + 0x7d4d, 0x7d4e, 0x7d4f, 0x7d50, 0x7d51, 0x7d52, 0x7d53, 0x7d54, + 0x7d55, 0x7d56, 0x7d57, 0x7d58, 0x7d59, 0x7d5a, 0x7d5b, 0x7d5c, + 0x7d5d, 0x7d5e, 0x7d5f, 0x7d60, 0x7d61, 0x7d62, 0x7d63, 0x7d64, + 0x7d65, 0x7d66, 0x7d67, 0x7d68, 0x7d69, 0x7d6a, 0x7d6b, 0x7d6c, + 0x7d6d, 0x7d6e, 0x7d6f, 0x7d70, 0x7d71, 0x7d72, 0x7d73, 0x7d74, + 0x7d75, 0x7d76, 0x7d77, 0x7d78, 0x7d79, 0x7d7a, 0x7d7b, 0x7d7c, + 0x7d7d, 0x7d7e, 0x7e21, 0x7e22, 0x7e23, 0x7e24, 0x7e25, 0x7e26, + 0x7e27, 0x7e28, 0x7e29, 0x7e2a, 0x7e2b, 0x7e2c, 0x7e2d, 0x7e2e, + 0x7e2f, 0x7e30, 0x7e31, 0x7e32, 0x7e33, 0x7e34, 0x7e35, 0x7e36, + 0x7e37, 0x7e38, 0x7e39, 0x7e3a, 0x7e3b, 0x7e3c, 0x7e3d, 0x7e3e, + 0x7e3f, 0x7e40, 0x7e41, 0x7e42, 0x7e43, 0x7e44, 0x7e45, 0x7e46, + 0x7e47, 0x7e48, 0x7e49, 0x7e4a, 0x7e4b, 0x7e4c, 0x7e4d, 0x7e4e, + 0x7e4f, 0x7e50, 0x7e51, 0x7e52, 0x7e53, 0x7e54, 0x7e55, 0x7e56, + 0x7e57, 0x7e58, 0x7e59, 0x7e5a, 0x7e5b, 0x7e5c, 0x7e5d, 0x7e5e, + 0x7e5f, 0x7e60, 0x7e61, 0x7e62, 0x7e63, 0x7e64, 0x7e65, 0x7e66, + 0x7e67, 0x7e68, 0x7e69, 0x7e6a, 0x7e6b, 0x7e6c, 0x7e6d, 0x7e6e, + 0x7e6f, 0x7e70, 0x7e71, 0x7e72, 0x7e73, 0x7e74, 0x7e75, 0x7e76, + 0x7e77, 0x7e78, 0x7e79, 0x7e7a, 0x7e7b, 0x7e7c, 0x7e7d, 0x7e7e, + 0x2140, +}; + +static const Summary16 jisx0208vdc_uni2indx_page00[11] = { + /* 0x0000 */ + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x1000 }, +}; +static const Summary16 jisx0208vdc_uni2indx_page21[28] = { + /* 0x2100 */ + { 1, 0x0000 }, { 1, 0x0040 }, { 2, 0x0002 }, { 3, 0x0000 }, + { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x03ff }, { 13, 0x0000 }, + { 13, 0x0000 }, { 13, 0x0000 }, { 13, 0x0000 }, { 13, 0x0000 }, + { 13, 0x0000 }, { 13, 0x0000 }, { 13, 0x0000 }, { 13, 0x0000 }, + /* 0x2200 */ + { 13, 0x0000 }, { 13, 0x8402 }, { 16, 0x4e01 }, { 21, 0x0020 }, + { 22, 0x0000 }, { 22, 0x0004 }, { 23, 0x0002 }, { 24, 0x0000 }, + { 24, 0x0000 }, { 24, 0x0000 }, { 24, 0x0020 }, { 25, 0x8000 }, +}; +static const Summary16 jisx0208vdc_uni2indx_page24[8] = { + /* 0x2400 */ + { 26, 0x0000 }, { 26, 0x0000 }, { 26, 0x0000 }, { 26, 0x0000 }, + { 26, 0x0000 }, { 26, 0x0000 }, { 26, 0xffff }, { 42, 0x000f }, +}; +static const Summary16 jisx0208vdc_uni2indx_page30[2] = { + /* 0x3000 */ + { 46, 0x0000 }, { 46, 0xa000 }, +}; +static const Summary16 jisx0208vdc_uni2indx_page32[29] = { + /* 0x3200 */ + { 48, 0x0000 }, { 48, 0x0000 }, { 48, 0x0000 }, { 48, 0x0206 }, + { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x0000 }, + { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x01f0 }, { 56, 0x0000 }, + { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, + /* 0x3300 */ + { 56, 0x2008 }, { 58, 0x0110 }, { 60, 0x08cc }, { 65, 0x0840 }, + { 67, 0x2600 }, { 70, 0x0082 }, { 72, 0x0000 }, { 72, 0x7800 }, + { 76, 0xc000 }, { 78, 0x7000 }, { 81, 0x0002 }, { 82, 0x0000 }, + { 82, 0x2010 }, +}; +static const Summary16 jisx0208vdc_uni2indx_pagee0[59] = { + /* 0xe000 */ + { 84, 0xffff }, { 100, 0xffff }, { 116, 0xffff }, { 132, 0xffff }, + { 148, 0xffff }, { 164, 0xffff }, { 180, 0xffff }, { 196, 0xffff }, + { 212, 0xffff }, { 228, 0xffff }, { 244, 0xffff }, { 260, 0xffff }, + { 276, 0xffff }, { 292, 0xffff }, { 308, 0xffff }, { 324, 0xffff }, + /* 0xe100 */ + { 340, 0xffff }, { 356, 0xffff }, { 372, 0xffff }, { 388, 0xffff }, + { 404, 0xffff }, { 420, 0xffff }, { 436, 0xffff }, { 452, 0xffff }, + { 468, 0xffff }, { 484, 0xffff }, { 500, 0xffff }, { 516, 0xffff }, + { 532, 0xffff }, { 548, 0xffff }, { 564, 0xffff }, { 580, 0xffff }, + /* 0xe200 */ + { 596, 0xffff }, { 612, 0xffff }, { 628, 0xffff }, { 644, 0xffff }, + { 660, 0xffff }, { 676, 0xffff }, { 692, 0xffff }, { 708, 0xffff }, + { 724, 0xffff }, { 740, 0xffff }, { 756, 0xffff }, { 772, 0xffff }, + { 788, 0xffff }, { 804, 0xffff }, { 820, 0xffff }, { 836, 0xffff }, + /* 0xe300 */ + { 852, 0xffff }, { 868, 0xffff }, { 884, 0xffff }, { 900, 0xffff }, + { 916, 0xffff }, { 932, 0xffff }, { 948, 0xffff }, { 964, 0xffff }, + { 980, 0xffff }, { 996, 0xffff }, { 1012, 0x0fff }, +}; +static const Summary16 jisx0208vdc_uni2indx_pageff[4] = { + /* 0xff00 */ + { 1024, 0x0000 }, { 1024, 0x0000 }, { 1024, 0x0000 }, { 1024, 0x1000 }, +}; + +static int +jisx0208vdc_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + if (n >= 2) { + const Summary16 *summary = NULL; + if (wc >= 0x0000 && wc < 0x00b0) + summary = &jisx0208vdc_uni2indx_page00[(wc>>4)]; + else if (wc >= 0x2100 && wc < 0x22c0) + summary = &jisx0208vdc_uni2indx_page21[(wc>>4)-0x210]; + else if (wc >= 0x2400 && wc < 0x2480) + summary = &jisx0208vdc_uni2indx_page24[(wc>>4)-0x240]; + else if (wc >= 0x3000 && wc < 0x3020) + summary = &jisx0208vdc_uni2indx_page30[(wc>>4)-0x300]; + else if (wc >= 0x3200 && wc < 0x33d0) + summary = &jisx0208vdc_uni2indx_page32[(wc>>4)-0x320]; + else if (wc >= 0xe000 && wc < 0xe3b0) + summary = &jisx0208vdc_uni2indx_pagee0[(wc>>4)-0xe00]; + else if (wc >= 0xff00 && wc < 0xff40) + summary = &jisx0208vdc_uni2indx_pageff[(wc>>4)-0xff0]; + if (summary) { + unsigned short used = summary->used; + unsigned int i = wc & 0x0f; + if (used & ((unsigned short) 1 << i)) { + unsigned short c; + /* Keep in `used' only the bits 0..i-1. */ + used &= ((unsigned short) 1 << i) - 1; + /* Add `summary->indx' and the number of bits set in `used'. */ + used = (used & 0x5555) + ((used & 0xaaaa) >> 1); + used = (used & 0x3333) + ((used & 0xcccc) >> 2); + used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); + used = (used & 0x00ff) + (used >> 8); + c = jisx0208vdc_2charset[summary->indx + used]; + r[0] = (c >> 8); r[1] = (c & 0xff); + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOSMALL; +} +#endif + static const unsigned short jisx0208_2uni_page21[690] = { /* 0x21 */ 0x3000, 0x3001, 0x3002, 0xff0c, 0xff0e, 0x30fb, 0xff1a, 0xff1b, @@ -1012,11 +1457,19 @@ jisx0208_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) return 2; } } +#ifdef sun + return jisx0208vdc_mbtowc (conv, pwc, s, n); +#else return RET_ILSEQ; +#endif } return RET_TOOFEW(0); } +#ifdef sun + return jisx0208vdc_mbtowc (conv, pwc, s, n); +#else return RET_ILSEQ; +#endif } static const unsigned short jisx0208_2charset[6879] = { @@ -2359,7 +2812,7 @@ jisx0208_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { if (n >= 2) { const Summary16 *summary = NULL; - if (wc < 0x0100) + if (wc >= 0x0000 && wc < 0x0100) summary = &jisx0208_uni2indx_page00[(wc>>4)]; else if (wc >= 0x0300 && wc < 0x0460) summary = &jisx0208_uni2indx_page03[(wc>>4)-0x030]; @@ -2390,7 +2843,11 @@ jisx0208_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) return 2; } } +#ifdef sun + return jisx0208vdc_wctomb (conv, r, wc, n); +#else return RET_ILSEQ; +#endif } return RET_TOOSMALL; }