From c5a650e815204eba6c812890bd67227daf337750 Mon Sep 17 00:00:00 2001 From: Rui Hirokawa Date: Tue, 2 Aug 2011 03:50:10 +0000 Subject: [PATCH] MFH (updated libmbfl for 1.3.0.). --- ext/mbstring/config.m4 | 2 + ext/mbstring/config.w32 | 2 +- ext/mbstring/libmbfl/filters/Makefile.am | 17 +- ext/mbstring/libmbfl/filters/emoji2uni.h | 1155 +++++++++++++++++ .../libmbfl/filters/mbfilter_cp5022x.c | 7 +- .../libmbfl/filters/mbfilter_sjis_mac.c | 865 ++++++++++++ .../libmbfl/filters/mbfilter_sjis_mac.h | 45 + .../libmbfl/filters/mbfilter_sjis_mobile.c | 1103 ++++++++++++++++ .../libmbfl/filters/mbfilter_sjis_mobile.h | 64 + ext/mbstring/libmbfl/filters/mk_emoji_tbl.pl | 425 ++++++ ext/mbstring/libmbfl/filters/sjis_mac2uni.h | 214 +++ ext/mbstring/libmbfl/mbfl/eaw_table.h | 32 +- ext/mbstring/libmbfl/mbfl/mbfilter.h | 2 +- ext/mbstring/libmbfl/mbfl/mbfl_convert.c | 18 + ext/mbstring/libmbfl/mbfl/mbfl_encoding.c | 10 + ext/mbstring/libmbfl/mbfl/mbfl_encoding.h | 8 + ext/mbstring/libmbfl/mbfl/mbfl_ident.c | 1 + ext/mbstring/libmbfl/mbfl/mk_eaw_tbl.awk | 7 +- ext/mbstring/libmbfl/tests/emoji.c | 119 ++ ext/mbstring/mbstring.c | 7 +- 20 files changed, 4078 insertions(+), 25 deletions(-) create mode 100644 ext/mbstring/libmbfl/filters/emoji2uni.h create mode 100644 ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c create mode 100644 ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.h create mode 100644 ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.c create mode 100644 ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.h create mode 100755 ext/mbstring/libmbfl/filters/mk_emoji_tbl.pl create mode 100644 ext/mbstring/libmbfl/filters/sjis_mac2uni.h create mode 100644 ext/mbstring/libmbfl/tests/emoji.c diff --git a/ext/mbstring/config.m4 b/ext/mbstring/config.m4 index a28af46629..f8763c6da3 100644 --- a/ext/mbstring/config.m4 +++ b/ext/mbstring/config.m4 @@ -264,6 +264,8 @@ AC_DEFUN([PHP_MBSTRING_SETUP_LIBMBFL], [ libmbfl/filters/mbfilter_qprint.c libmbfl/filters/mbfilter_sjis.c libmbfl/filters/mbfilter_sjis_open.c + libmbfl/filters/mbfilter_sjis_mobile.c + libmbfl/filters/mbfilter_sjis_mac.c libmbfl/filters/mbfilter_tl_jisx0201_jisx0208.c libmbfl/filters/mbfilter_ucs2.c libmbfl/filters/mbfilter_ucs4.c diff --git a/ext/mbstring/config.w32 b/ext/mbstring/config.w32 index ae0972f62a..3dc792de77 100644 --- a/ext/mbstring/config.w32 +++ b/ext/mbstring/config.w32 @@ -35,7 +35,7 @@ if (PHP_MBSTRING != "no") { mbfilter_utf7.c mbfilter_utf7imap.c mbfilter_utf8.c \ mbfilter_koi8u.c mbfilter_cp1254.c \ mbfilter_uuencode.c mbfilter_armscii8.c mbfilter_cp850.c \ - mbfilter_cp5022x.c mbfilter_sjis_open.c \ + mbfilter_cp5022x.c mbfilter_sjis_open.c mbfilter_sjis_mobile.c mbfilter_sjis_mac.c \ mbfilter_tl_jisx0201_jisx0208.c", "mbstring"); ADD_SOURCES("ext/mbstring/libmbfl/mbfl", "mbfilter.c mbfilter_8bit.c \ diff --git a/ext/mbstring/libmbfl/filters/Makefile.am b/ext/mbstring/libmbfl/filters/Makefile.am index 99df73b8dc..d4d781c3df 100644 --- a/ext/mbstring/libmbfl/filters/Makefile.am +++ b/ext/mbstring/libmbfl/filters/Makefile.am @@ -1,6 +1,7 @@ EXTRA_DIST=mk_sb_tbl.awk noinst_LTLIBRARIES=libmbfl_filters.la INCLUDES=-I../mbfl +PERL=perl libmbfl_filters_la_LDFLAGS=-version-info $(SHLIB_VERSION) libmbfl_filters_la_SOURCES=mbfilter_cp936.c \ mbfilter_hz.c \ @@ -33,6 +34,8 @@ libmbfl_filters_la_SOURCES=mbfilter_cp936.c \ mbfilter_base64.c \ mbfilter_sjis.c \ mbfilter_sjis_open.c \ + mbfilter_sjis_mobile.c \ + mbfilter_sjis_mac.c \ mbfilter_7bit.c \ mbfilter_qprint.c \ mbfilter_ucs4.c \ @@ -102,6 +105,8 @@ libmbfl_filters_la_SOURCES=mbfilter_cp936.c \ mbfilter_qprint.h \ mbfilter_sjis.h \ mbfilter_sjis_open.h \ + mbfilter_sjis_mobile.h \ + mbfilter_sjis_mac.h \ mbfilter_ucs2.h \ mbfilter_ucs4.h \ mbfilter_uhc.h \ @@ -143,7 +148,9 @@ libmbfl_filters_la_SOURCES=mbfilter_cp936.c \ unicode_table_armscii8.h \ unicode_table_cp850.h \ unicode_table_uhc.h \ - translit_kana_jisx0201_jisx0208.h + translit_kana_jisx0201_jisx0208.h \ + emoji2uni.h \ + sjis_mac2uni.h mbfilter_iso8859_2.c: unicode_table_iso8859_2.h @@ -238,8 +245,14 @@ unicode_table_iso8859_16.h: mk_sb_tbl.awk $(AWK) -v TABLE_NAME=iso8859_16_ucs_table \ -v IFNDEF_NAME=UNICODE_TABLEISO8859_16_H -f mk_sb_tbl.awk 8859-16.TXT > $@ +EmojiSources.txt : + $(FETCH_VIA_FTP) ftp://ftp.unicode.org/Public/UNIDATA/$@ + +emoji2uni.h : mk_emoji_tbl.pl + $(PERL) mk_emoji_tbl.pl EmojiSources.txt + unidata: 8859-1.TXT 8859-2.TXT 8859-3.TXT 8859-4.TXT 8859-5.TXT 8859-6.TXT \ 8859-7.TXT 8859-8.TXT 8859-9.TXT 8859-10.TXT 8859-11.TXT 8859-13.TXT \ -8859-14.TXT 8859-15.TXT 8859-16.TXT +8859-14.TXT 8859-15.TXT 8859-16.TXT EmojiSources.txt .PHONY: unidata diff --git a/ext/mbstring/libmbfl/filters/emoji2uni.h b/ext/mbstring/libmbfl/filters/emoji2uni.h new file mode 100644 index 0000000000..99c7cc2d9d --- /dev/null +++ b/ext/mbstring/libmbfl/filters/emoji2uni.h @@ -0,0 +1,1155 @@ +const int mb_tbl_code2uni_docomo1_min = 0x28c2; +const int mb_tbl_code2uni_docomo1_max = 0x29db; + +const int mb_tbl_code2uni_docomo1[] = { // 0x28c2 - 0x29db + 0x02600, 0x02601, 0x02614, 0x026c4, + 0x026a1, 0x1f300, 0x1f301, 0x1f302, + 0x02648, 0x02649, 0x0264a, 0x0264b, + 0x0264c, 0x0264d, 0x0264e, 0x0264f, + 0x02650, 0x02651, 0x02652, 0x02653, + 0x1f3bd, 0x026be, 0x026f3, 0x1f3be, + 0x026bd, 0x1f3bf, 0x1f3c0, 0x1f3c1, + 0x1f4df, 0x1f683, 0x024c2, 0x1f684, + 0x1f697, 0x1f699, 0x1f68c, 0x1f6a2, + 0x02708, 0x1f3e0, 0x1f3e2, 0x1f3e3, + 0x1f3e5, 0x1f3e6, 0x1f3e7, 0x1f3e8, + 0x1f3ea, 0x026fd, 0x1f17f, 0x1f6a5, + 0x1f6bb, 0x1f374, 0x02615, 0x1f378, + 0x1f37a, 0x1f354, 0x1f460, 0x02702, + 0x1f3a4, 0x1f3a5, 0x02197, 0x1f3a0, + 0x1f3a7, 0x1f3a8, 0x1f3a9, 0x1f3aa, + 0x1f3ab, 0x1f6ac, 0x1f6ad, 0x1f4f7, + 0x1f45c, 0x1f4d6, 0x1f380, 0x1f381, + 0x1f382, 0x0260e, 0x1f4f1, 0x1f4dd, + 0x1f4fa, 0x1f3ae, 0x1f4bf, 0x02665, + 0x02660, 0x02666, 0x02663, 0x1f440, + 0x1f442, 0x0270a, 0x0270c, 0x0270b, + 0x02198, 0x02196, 0x1f463, 0x1f45f, + 0x1f453, 0x0267f, 0x1f311, 0x1f314, + 0x1f313, 0x1f319, 0x1f315, 0x1f436, + 0x1f431, 0x026f5, 0x1f384, 0x02199, + 0x00000, 0x00000, 0x00000, 0x00000, + 0x00000, 0x00000, 0x1f3ac, 0x1f45d, + 0x02712, 0x00000, 0x00000, 0x1f464, + 0x1f4ba, 0x1f303, 0x00000, 0x00000, + 0x00000, 0x1f51c, 0x1f51b, 0x1f51a, + 0x023f0, 0x00000, 0x00000, 0x00000, + 0x00000, 0x00000, 0x00000, 0x00000, + 0x00000, 0x00000, 0x00000, 0x00000, + 0x00000, 0x00000, 0x00000, 0x00000, + 0x00000, 0x00000, 0x00000, 0x00000, + 0x1f4f2, 0x1f4e9, 0x1f4e0, 0x00000, + 0x00000, 0x02709, 0x00000, 0x00000, + 0x1f4b4, 0x1f193, 0x1f194, 0x1f511, + 0x021a9, 0x1f191, 0x1f50d, 0x1f195, + 0x1f6a9, 0x00000, 0x00023, 0x00000, + 0x00031, 0x00032, 0x00033, 0x00034, + 0x00035, 0x00036, 0x00037, 0x00038, + 0x00039, 0x00030, 0x02764, 0x1f493, + 0x1f494, 0x1f495, 0x1f603, 0x1f620, + 0x1f61e, 0x1f616, 0x1f635, 0x02934, + 0x1f3b5, 0x02668, 0x1f4a0, 0x1f48b, + 0x02728, 0x1f4a1, 0x1f4a2, 0x1f44a, + 0x1f4a3, 0x1f3b6, 0x02935, 0x1f4a4, + 0x02757, 0x02049, 0x0203c, 0x1f4a5, + 0x1f4a6, 0x1f4a7, 0x1f4a8, 0x03030, + 0x027b0, 0x1f197, 0x00000, 0x00000, + 0x1f455, 0x1f45b, 0x1f484, 0x1f456, + 0x1f3c2, 0x1f514, 0x1f6aa, 0x1f4b0, + 0x1f4bb, 0x1f48c, 0x1f527, 0x0270f, + 0x1f451, 0x1f48d, 0x023f3, 0x1f6b2, + 0x1f375, 0x0231a, 0x1f614, 0x1f60c, + 0x1f605, 0x1f613, 0x1f621, 0x1f612, + 0x1f60d, 0x1f44d, 0x1f61c, 0x1f609, + 0x1f606, 0x1f623, 0x1f60f, 0x1f62d, + 0x1f622, 0x1f196, 0x1f4ce, 0x000a9, + 0x02122, 0x1f3c3, 0x03299, 0x0267b, + 0x000ae, 0x026a0, 0x1f232, 0x1f233, + 0x1f234, 0x1f235, 0x02194, 0x02195, + 0x1f3eb, 0x1f30a, 0x1f5fb, 0x1f340, + 0x1f352, 0x1f337, 0x1f34c, 0x1f34e, + 0x1f331, 0x1f341, 0x1f338, 0x1f359, + 0x1f370, 0x1f376, 0x1f35c, 0x1f35e, + 0x1f40c, 0x1f424, 0x1f427, 0x1f41f, + 0x1f60b, 0x1f601, 0x1f434, 0x1f437, + 0x1f377, 0x1f631, }; + +const int mb_tbl_code2uni_kddi1_min = 0x24b8; +const int mb_tbl_code2uni_kddi1_max = 0x25c0; + +const int mb_tbl_code2uni_kddi1[] = { // 0x24b8 - 0x25c0 + 0x1f342, 0x1f4bc, 0x026f2, 0x026fa, + 0x1f004, 0x1f19a, 0x1f3c6, 0x1f422, + 0x1f1ea, 0x1f1f7, 0x1f6a7, 0x1f6c0, + 0x1f38c, 0x1f306, 0x1f423, 0x1f4b9, + 0x1f46e, 0x1f3e3, 0x1f3e5, 0x1f3eb, + 0x1f3e8, 0x1f6a2, 0x1f51e, 0x1f4f6, + 0x1f192, 0x1f239, 0x1f202, 0x1f194, + 0x1f235, 0x1f233, 0x1f22f, 0x1f23a, + 0x1f446, 0x1f447, 0x1f52e, 0x1f4f3, + 0x1f4f4, 0x1f4dd, 0x1f454, 0x1f33a, + 0x1f490, 0x1f335, 0x1f376, 0x1f37b, + 0x03297, 0x1f48a, 0x1f388, 0x1f389, + 0x00000, 0x1f452, 0x1f462, 0x1f485, + 0x1f487, 0x1f488, 0x1f458, 0x1f459, + 0x02665, 0x1f496, 0x1f499, 0x1f49a, + 0x1f49b, 0x1f49c, 0x02728, 0x1f3bf, + 0x02b55, 0x1f375, 0x1f35e, 0x1f366, + 0x1f35f, 0x1f361, 0x1f358, 0x1f35a, + 0x1f35d, 0x1f35b, 0x1f362, 0x1f363, + 0x1f34e, 0x1f34a, 0x1f345, 0x1f346, + 0x1f371, 0x1f372, 0x1f60f, 0x1f614, + 0x1f624, 0x1f623, 0x1f616, 0x1f62a, + 0x1f60c, 0x1f628, 0x1f637, 0x1f633, + 0x1f612, 0x1f632, 0x1f630, 0x1f3bc, + 0x1f60a, 0x1f61a, 0x1f618, 0x1f443, + 0x1f444, 0x1f64f, 0x1f44f, 0x1f44c, + 0x1f44e, 0x1f44b, 0x1f645, 0x1f646, + 0x1f647, 0x1f491, 0x1f46f, 0x1f3ba, + 0x1f3b1, 0x1f3ca, 0x1f692, 0x1f691, + 0x1f693, 0x1f3a2, 0x1f38d, 0x1f38e, + 0x1f393, 0x1f392, 0x1f38f, 0x1f302, + 0x1f470, 0x1f367, 0x1f387, 0x1f41a, + 0x1f390, 0x1f383, 0x1f391, 0x1f385, + 0x1f303, 0x1f308, 0x1f3e9, 0x1f305, + 0x1f3a9, 0x1f3ec, 0x1f3ef, 0x1f3f0, + 0x1f3ed, 0x1f1eb, 0x1f1e9, 0x1f1ee, + 0x1f1ec, 0x1f1e8, 0x1f1f0, 0x1f471, + 0x1f472, 0x1f473, 0x1f474, 0x1f475, + 0x1f476, 0x1f477, 0x1f478, 0x1f42c, + 0x1f483, 0x1f420, 0x1f41b, 0x1f418, + 0x1f428, 0x1f42e, 0x1f40d, 0x1f414, + 0x1f417, 0x1f42b, 0x1f170, 0x1f171, + 0x1f17e, 0x1f18e, 0x1f463, 0x1f45f, + 0x1f6a9, 0x02934, 0x02935, 0x02049, + 0x0203c, 0x027b0, 0x1f348, 0x1f34d, + 0x1f347, 0x1f34c, 0x1f33d, 0x1f344, + 0x1f330, 0x1f351, 0x1f360, 0x1f355, + 0x1f357, 0x1f38b, 0x1f379, 0x1f432, + 0x1f3b9, 0x1f3c4, 0x1f3a3, 0x1f3b3, + 0x1f479, 0x1f47a, 0x1f43c, 0x1f445, + 0x1f43d, 0x1f33c, 0x1f368, 0x1f369, + 0x1f36a, 0x1f36b, 0x1f36c, 0x1f36d, + 0x1f648, 0x1f64a, 0x1f649, 0x1f30b, + 0x1f49d, 0x1f524, 0x1f36e, 0x1f41d, + 0x1f41e, 0x1f36f, 0x1f34f, 0x1f4b8, + 0x1f4ab, 0x1f621, 0x1f63e, 0x1f30c, + 0x1f63d, 0x1f63a, 0x1f4e9, 0x1f639, + 0x1f602, 0x1f63b, 0x1f640, 0x1f629, + 0x1f63f, 0x1f622, 0x1f63c, 0x1f457, + 0x1f5ff, 0x1f689, 0x1f3b4, 0x1f0cf, + 0x1f364, 0x1f4e7, 0x1f6b6, 0x1f6a8, + 0x00000, 0x1f493, 0x1f425, 0x1f456, + 0x1f48c, 0x0267b, 0x02194, 0x02195, + 0x1f30a, 0x1f331, 0x1f40c, 0x1f638, + 0x1f601, 0x00000, 0x1f33f, 0x0270a, + 0x00023, 0x1f64b, 0x1f64c, 0x1f64d, + 0x1f64e, }; +const int mb_tbl_code2uni_kddi2_min = 0x26ec; +const int mb_tbl_code2uni_kddi2_max = 0x2863; + +const int mb_tbl_code2uni_kddi2[] = { // 0x26ec - 0x2863 + 0x1f320, 0x1f300, 0x1f6a5, 0x1f3c3, + 0x02747, 0x1f3a1, 0x1f3b0, 0x1f38a, + 0x1f433, 0x1f603, 0x1f620, 0x1f62d, + 0x1f62b, 0x1f4a4, 0x1f4a1, 0x1f494, + 0x1f495, 0x02734, 0x1f4a3, 0x1f525, + 0x023f3, 0x1f6ac, 0x1f6ad, 0x0267f, + 0x1f530, 0x026a0, 0x02757, 0x02753, + 0x026d4, 0x026c4, 0x1f319, 0x026a1, + 0x02600, 0x1f31b, 0x02744, 0x02b50, + 0x02614, 0x02601, 0x026c5, 0x02648, + 0x02649, 0x0264a, 0x0264b, 0x0264c, + 0x0264d, 0x0264e, 0x0264f, 0x02650, + 0x02651, 0x02652, 0x02653, 0x026ce, + 0x1f45c, 0x1f4d4, 0x1f3ab, 0x1f4d6, + 0x1f4ce, 0x0270f, 0x1f4d0, 0x1f3e7, + 0x1f3ea, 0x1f6bb, 0x1f17f, 0x1f68f, + 0x1f4e1, 0x02693, 0x1f3e6, 0x1f3e0, + 0x1f374, 0x1f3e2, 0x1f6b2, 0x1f68c, + 0x1f685, 0x1f697, 0x1f69a, 0x02708, + 0x026f5, 0x1f683, 0x026bd, 0x1f3be, + 0x1f3c2, 0x1f3c1, 0x026be, 0x1f3c8, + 0x02668, 0x1f3ee, 0x1f3ac, 0x1f309, + 0x1f5fc, 0x1f377, 0x1f378, 0x1f37a, + 0x1f356, 0x1f3af, 0x1f3ae, 0x1f4b0, + 0x1f3b2, 0x1f384, 0x1f338, 0x1f47b, + 0x1f1ef, 0x1f349, 0x1f341, 0x1f381, + 0x1f370, 0x1f373, 0x1f352, 0x1f421, + 0x1f353, 0x1f359, 0x1f354, 0x1f430, + 0x1f434, 0x1f435, 0x1f438, 0x1f431, + 0x1f427, 0x1f41c, 0x1f437, 0x1f429, + 0x1f424, 0x1f436, 0x1f334, 0x1f33b, + 0x1f337, 0x1f4a2, 0x1f4a7, 0x1f61c, + 0x1f198, 0x1f4aa, 0x1f498, 0x1f48b, + 0x1f47e, 0x1f365, 0x1f43e, 0x1f47f, + 0x1f4ae, 0x03299, 0x1f4af, 0x1f44a, + 0x1f4a8, 0x1f4a9, 0x0261d, 0x1f250, + 0x1f480, 0x1f44d, 0x1f469, 0x0263a, + 0x1f468, 0x1f4ac, 0x1f453, 0x1f448, + 0x1f449, 0x1f46a, 0x1f4fa, 0x1f3a4, + 0x1f45b, 0x1f3b6, 0x1f3b8, 0x1f3bb, + 0x1f3a7, 0x1f484, 0x1f52b, 0x1f486, + 0x1f4bf, 0x1f45a, 0x1f47d, 0x1f199, + 0x1f489, 0x1f50a, 0x1f514, 0x1f340, + 0x1f48d, 0x1f4f7, 0x02702, 0x1f3a5, + 0x1f50d, 0x1f511, 0x1f460, 0x1f4ea, + 0x1f512, 0x1f4db, 0x1f4de, 0x1f4e6, + 0x1f4e0, 0x02709, 0x00031, 0x00032, + 0x00033, 0x00034, 0x00035, 0x00036, + 0x00037, 0x00038, 0x00039, 0x1f51f, + 0x00000, 0x025c0, 0x025b6, 0x023ea, + 0x023e9, 0x025ab, 0x025aa, 0x02139, + 0x025fd, 0x025fe, 0x1f538, 0x1f539, + 0x025fb, 0x025fc, 0x026aa, 0x026ab, + 0x02795, 0x02796, 0x02733, 0x02b06, + 0x02b07, 0x1f6ab, 0x1f53d, 0x1f53c, + 0x023ec, 0x023eb, 0x1f536, 0x1f537, + 0x02b1c, 0x02b1b, 0x1f534, 0x1f535, + 0x02196, 0x02198, 0x02122, 0x02716, + 0x0274c, 0x0274e, 0x027a1, 0x02b05, + 0x02797, 0x02197, 0x02199, 0x02714, + 0x000a9, 0x000ae, 0x1f53a, 0x1f53b, + 0x021aa, 0x021a9, 0x02705, 0x1f4dc, + 0x1f4cd, 0x1f4c3, 0x1f4be, 0x1f4c5, + 0x1f4cb, 0x1f4d7, 0x1f4d8, 0x1f4d9, + 0x1f4d5, 0x1f4c4, 0x1f4c6, 0x1f4d3, + 0x1f4c7, 0x1f4cc, 0x1f4d2, 0x1f4da, + 0x1f4cf, 0x026fd, 0x1f5fe, 0x1f1fa, + 0x1f4ca, 0x1f4c8, 0x1f4c9, 0x00000, + 0x1f193, 0x1f4b2, 0x0231a, 0x0231b, + 0x1f4b3, 0x1f4b4, 0x1f4f9, 0x1f52a, + 0x1f4fc, 0x1f529, 0x1f4bd, 0x1f526, + 0x1f50b, 0x1f4b5, 0x00000, 0x1f527, + 0x1f4f1, 0x1f50c, 0x1f517, 0x1f4f0, + 0x02003, 0x02002, 0x02005, 0x1f4c1, + 0x1f4c2, 0x1f4e8, 0x1f4e4, 0x1f4e5, + 0x023f0, 0x02764, 0x0260e, 0x02615, + 0x1f301, 0x026f3, 0x1f3c0, 0x1f4df, + 0x1f3a8, 0x1f3ad, 0x1f3aa, 0x1f380, + 0x1f382, 0x02660, 0x02666, 0x02663, + 0x1f440, 0x1f442, 0x0270c, 0x0270b, + 0x1f311, 0x1f314, 0x1f313, 0x1f191, + 0x00030, 0x1f197, 0x1f635, 0x1f49e, + 0x1f4a5, 0x1f4a6, 0x00000, 0x1f30f, + 0x1f35c, 0x00000, 0x1f510, 0x1f520, + 0x1f521, 0x1f522, 0x1f523, 0x1f251, + 0x02611, 0x02712, 0x1f518, 0x1f50e, + 0x1f519, 0x1f516, 0x1f4f2, 0x1f3e1, + 0x1f4eb, 0x1f4d1, 0x1f50f, 0x1f503, + 0x1f195, 0x1f455, 0x1f45e, 0x1f4bb, + 0x1f4fb, 0x1f339, 0x026ea, 0x1f687, + 0x1f5fb, 0x1f3b5, 0x1f47c, 0x1f42f, + 0x1f43b, 0x1f42d, 0x1f609, 0x1f60d, + 0x1f631, 0x1f613, 0x1f419, 0x1f680, + 0x1f451, 0x1f48f, 0x1f528, 0x1f386, + }; +const int mb_tbl_code2uni_sb1_min = 0x27a9; +const int mb_tbl_code2uni_sb1_max = 0x285a; + +const int mb_tbl_code2uni_sb1[] = { // 0x27a9 - 0x285a + 0x1f4eb, 0x1f4ee, 0x1f4e9, 0x1f4f2, + 0x1f61c, 0x1f60d, 0x1f631, 0x1f613, + 0x1f435, 0x1f419, 0x1f437, 0x1f47d, + 0x1f680, 0x1f451, 0x1f4a1, 0x1f340, + 0x1f48f, 0x1f381, 0x1f52b, 0x1f50d, + 0x1f3c3, 0x1f528, 0x1f386, 0x1f341, + 0x1f342, 0x1f47f, 0x1f47b, 0x1f480, + 0x1f525, 0x1f4bc, 0x1f4ba, 0x1f354, + 0x026f2, 0x026fa, 0x02668, 0x1f3a1, + 0x1f3ab, 0x1f4bf, 0x1f4c0, 0x1f4fb, + 0x1f4fc, 0x1f4fa, 0x1f47e, 0x0303d, + 0x1f004, 0x1f19a, 0x1f4b0, 0x1f3af, + 0x1f3c6, 0x1f3c1, 0x1f3b0, 0x1f40e, + 0x1f6a4, 0x1f6b2, 0x1f6a7, 0x1f6b9, + 0x1f6ba, 0x1f6bc, 0x1f489, 0x1f4a4, + 0x026a1, 0x1f460, 0x1f6c0, 0x1f6bd, + 0x1f50a, 0x1f4e2, 0x1f38c, 0x1f512, + 0x1f513, 0x1f306, 0x1f373, 0x1f4d6, + 0x1f4b1, 0x1f4b9, 0x1f4e1, 0x1f4aa, + 0x1f3e6, 0x1f6a5, 0x1f17f, 0x1f68f, + 0x1f6bb, 0x1f46e, 0x1f3e3, 0x1f3e7, + 0x1f3e5, 0x1f3ea, 0x1f3eb, 0x1f3e8, + 0x1f68c, 0x1f695, 0x00000, 0x00000, + 0x00000, 0x00000, 0x00000, 0x1f6b6, + 0x1f6a2, 0x1f201, 0x1f49f, 0x02734, + 0x02733, 0x1f51e, 0x1f6ad, 0x1f530, + 0x0267f, 0x1f4f6, 0x02665, 0x02666, + 0x02660, 0x02663, 0x00023, 0x00000, + 0x1f195, 0x1f199, 0x1f192, 0x1f236, + 0x1f21a, 0x1f237, 0x1f238, 0x1f534, + 0x1f532, 0x1f533, 0x00031, 0x00032, + 0x00033, 0x00034, 0x00035, 0x00036, + 0x00037, 0x00038, 0x00039, 0x00030, + 0x1f250, 0x1f239, 0x1f202, 0x1f194, + 0x1f235, 0x1f233, 0x1f22f, 0x1f23a, + 0x1f446, 0x1f447, 0x1f448, 0x1f449, + 0x02b06, 0x02b07, 0x027a1, 0x02b05, + 0x02197, 0x02196, 0x02198, 0x02199, + 0x025b6, 0x025c0, 0x023e9, 0x023ea, + 0x1f52f, 0x02648, 0x02649, 0x0264a, + 0x0264b, 0x0264c, 0x0264d, 0x0264e, + 0x0264f, 0x02650, 0x02651, 0x02652, + 0x02653, 0x026ce, 0x1f51d, 0x1f197, + 0x000a9, 0x000ae, 0x1f4f3, 0x1f4f4, + 0x026a0, 0x1f481, }; +const int mb_tbl_code2uni_sb2_min = 0x2921; +const int mb_tbl_code2uni_sb2_max = 0x29cc; + +const int mb_tbl_code2uni_sb2[] = { // 0x2921 - 0x29cc + 0x1f466, 0x1f467, 0x1f48b, 0x1f468, + 0x1f469, 0x1f455, 0x1f45f, 0x1f4f7, + 0x0260e, 0x1f4f1, 0x1f4e0, 0x1f4bb, + 0x1f44a, 0x1f44d, 0x0261d, 0x0270a, + 0x0270c, 0x0270b, 0x1f3bf, 0x026f3, + 0x1f3be, 0x026be, 0x1f3c4, 0x026bd, + 0x1f41f, 0x1f434, 0x1f697, 0x026f5, + 0x02708, 0x1f683, 0x1f685, 0x02753, + 0x02757, 0x02764, 0x1f494, 0x1f550, + 0x1f551, 0x1f552, 0x1f553, 0x1f554, + 0x1f555, 0x1f556, 0x1f557, 0x1f558, + 0x1f559, 0x1f55a, 0x1f55b, 0x1f338, + 0x1f531, 0x1f339, 0x1f384, 0x1f48d, + 0x1f48e, 0x1f3e0, 0x026ea, 0x1f3e2, + 0x1f689, 0x026fd, 0x1f5fb, 0x1f3a4, + 0x1f3a5, 0x1f3b5, 0x1f511, 0x1f3b7, + 0x1f3b8, 0x1f3ba, 0x1f374, 0x1f378, + 0x02615, 0x1f370, 0x1f37a, 0x026c4, + 0x02601, 0x02600, 0x02614, 0x1f319, + 0x1f304, 0x1f47c, 0x1f431, 0x1f42f, + 0x1f43b, 0x1f436, 0x1f42d, 0x1f433, + 0x1f427, 0x1f60a, 0x1f603, 0x1f61e, + 0x1f620, 0x1f4a9, 0x00000, 0x00000, + 0x00000, 0x00000, 0x00000, 0x1f4dd, + 0x1f454, 0x1f33a, 0x1f337, 0x1f33b, + 0x1f490, 0x1f334, 0x1f335, 0x1f6be, + 0x1f3a7, 0x1f376, 0x1f37b, 0x03297, + 0x1f6ac, 0x1f48a, 0x1f388, 0x1f4a3, + 0x1f389, 0x02702, 0x1f380, 0x03299, + 0x1f4bd, 0x1f4e3, 0x1f452, 0x1f457, + 0x1f461, 0x1f462, 0x1f484, 0x1f485, + 0x1f486, 0x1f487, 0x1f488, 0x1f458, + 0x1f459, 0x1f45c, 0x1f3ac, 0x1f514, + 0x1f3b6, 0x1f493, 0x1f497, 0x1f498, + 0x1f499, 0x1f49a, 0x1f49b, 0x1f49c, + 0x02728, 0x02b50, 0x1f4a8, 0x1f4a6, + 0x02b55, 0x0274c, 0x1f4a2, 0x1f31f, + 0x02754, 0x02755, 0x1f375, 0x1f35e, + 0x1f366, 0x1f35f, 0x1f361, 0x1f358, + 0x1f35a, 0x1f35d, 0x1f35c, 0x1f35b, + 0x1f359, 0x1f362, 0x1f363, 0x1f34e, + 0x1f34a, 0x1f353, 0x1f349, 0x1f345, + 0x1f346, 0x1f382, 0x1f371, 0x1f372, + }; +const int mb_tbl_code2uni_sb3_min = 0x2a99; +const int mb_tbl_code2uni_sb3_max = 0x2b2e; + +const int mb_tbl_code2uni_sb3[] = { // 0x2a99 - 0x2b2e + 0x1f625, 0x1f60f, 0x1f614, 0x1f601, + 0x1f609, 0x1f623, 0x1f616, 0x1f62a, + 0x1f61d, 0x1f60c, 0x1f628, 0x1f637, + 0x1f633, 0x1f612, 0x1f630, 0x1f632, + 0x1f62d, 0x1f602, 0x1f622, 0x0263a, + 0x1f604, 0x1f621, 0x1f61a, 0x1f618, + 0x1f440, 0x1f443, 0x1f442, 0x1f444, + 0x1f64f, 0x1f44b, 0x1f44f, 0x1f44c, + 0x1f44e, 0x1f450, 0x1f645, 0x1f646, + 0x1f491, 0x1f647, 0x1f64c, 0x1f46b, + 0x1f46f, 0x1f3c0, 0x1f3c8, 0x1f3b1, + 0x1f3ca, 0x1f699, 0x1f69a, 0x1f692, + 0x1f691, 0x1f693, 0x1f3a2, 0x1f687, + 0x1f684, 0x1f38d, 0x1f49d, 0x1f38e, + 0x1f393, 0x1f392, 0x1f38f, 0x1f302, + 0x1f492, 0x1f30a, 0x1f367, 0x1f387, + 0x1f41a, 0x1f390, 0x1f300, 0x1f33e, + 0x1f383, 0x1f391, 0x1f343, 0x1f385, + 0x1f305, 0x1f307, 0x1f303, 0x1f308, + 0x00000, 0x00000, 0x00000, 0x00000, + 0x00000, 0x00000, 0x00000, 0x00000, + 0x00000, 0x00000, 0x00000, 0x00000, + 0x00000, 0x00000, 0x00000, 0x00000, + 0x00000, 0x00000, 0x00000, 0x1f3e9, + 0x1f3a8, 0x1f3a9, 0x1f3ec, 0x1f3ef, + 0x1f3f0, 0x1f3a6, 0x1f3ed, 0x1f5fc, + 0x00000, 0x1f1ef, 0x1f1fa, 0x1f1eb, + 0x1f1e9, 0x1f1ee, 0x1f1ec, 0x1f1ea, + 0x1f1f7, 0x1f1e8, 0x1f1f0, 0x1f471, + 0x1f472, 0x1f473, 0x1f474, 0x1f475, + 0x1f476, 0x1f477, 0x1f478, 0x1f5fd, + 0x1f482, 0x1f483, 0x1f42c, 0x1f426, + 0x1f420, 0x1f424, 0x1f439, 0x1f41b, + 0x1f418, 0x1f428, 0x1f412, 0x1f411, + 0x1f43a, 0x1f42e, 0x1f430, 0x1f40d, + 0x1f414, 0x1f417, 0x1f42b, 0x1f438, + 0x1f170, 0x1f171, 0x1f18e, 0x1f17e, + 0x1f463, 0x02122, }; + + + +const int mb_tbl_uni_docomo2code1_min = 0x0023; +const int mb_tbl_uni_docomo2code1_max = 0x00ae; + +const int mb_tbl_uni_docomo2code1_key[] = { // 0x0023 - 0x00ae + 0x0023, 0x0030, 0x0031, 0x0032, + 0x0033, 0x0034, 0x0035, 0x0036, + 0x0037, 0x0038, 0x0039, 0x00a9, + 0x00ae, }; + +const int mb_tbl_uni_docomo2code1_value[] = { // 0x0023 - 0x00ae + 0x2964, 0x296f, 0x2966, 0x2967, + 0x2968, 0x2969, 0x296a, 0x296b, + 0x296c, 0x296d, 0x296e, 0x29b5, + 0x29ba, }; + + + + + + + + + + + + + + + +const int mb_tbl_uni_docomo2code2_min = 0x203c; +const int mb_tbl_uni_docomo2code2_max = 0x3299; + +const int mb_tbl_uni_docomo2code2_key[] = { // 0x203c - 0x3299 + 0x203c, 0x2049, 0x2122, 0x2194, + 0x2195, 0x2196, 0x2197, 0x2198, + 0x2199, 0x21a9, 0x231a, 0x23f0, + 0x23f3, 0x24c2, 0x2600, 0x2601, + 0x260e, 0x2614, 0x2615, 0x2648, + 0x2649, 0x264a, 0x264b, 0x264c, + 0x264d, 0x264e, 0x264f, 0x2650, + 0x2651, 0x2652, 0x2653, 0x2660, + 0x2663, 0x2665, 0x2666, 0x2668, + 0x267b, 0x267f, 0x26a0, 0x26a1, + 0x26bd, 0x26be, 0x26c4, 0x26f3, + 0x26f5, 0x26fd, 0x2702, 0x2708, + 0x2709, 0x270a, 0x270b, 0x270c, + 0x270f, 0x2712, 0x2728, 0x2757, + 0x2764, 0x27b0, 0x2934, 0x2935, + 0x3030, 0x3299, }; + +const int mb_tbl_uni_docomo2code2_value[] = { // 0x203c - 0x3299 + 0x2988, 0x2987, 0x29b6, 0x29c0, + 0x29c1, 0x291b, 0x28fc, 0x291a, + 0x2929, 0x295e, 0x29a3, 0x293e, + 0x29a0, 0x28e0, 0x28c2, 0x28c3, + 0x290b, 0x28c4, 0x28f4, 0x28ca, + 0x28cb, 0x28cc, 0x28cd, 0x28ce, + 0x28cf, 0x28d0, 0x28d1, 0x28d2, + 0x28d3, 0x28d4, 0x28d5, 0x2912, + 0x2914, 0x2911, 0x2913, 0x297b, + 0x29b9, 0x291f, 0x29bb, 0x28c6, + 0x28da, 0x28d7, 0x28c5, 0x28d8, + 0x2927, 0x28ef, 0x28f9, 0x28e6, + 0x2957, 0x2917, 0x2919, 0x2918, + 0x299d, 0x2932, 0x297e, 0x2986, + 0x2970, 0x298e, 0x2979, 0x2984, + 0x298d, 0x29b8, }; + + +const int mb_tbl_uni_docomo2code3_min = 0x1f17f; +const int mb_tbl_uni_docomo2code3_max = 0x1f6bb; + +const int mb_tbl_uni_docomo2code3_key[] = { // 0x1f17f - 0x1f6bb + 0x1f17f, 0x1f191, 0x1f193, 0x1f194, + 0x1f195, 0x1f196, 0x1f197, 0x1f232, + 0x1f233, 0x1f234, 0x1f235, 0x1f300, + 0x1f301, 0x1f302, 0x1f303, 0x1f30a, + 0x1f311, 0x1f313, 0x1f314, 0x1f315, + 0x1f319, 0x1f331, 0x1f337, 0x1f338, + 0x1f340, 0x1f341, 0x1f34c, 0x1f34e, + 0x1f352, 0x1f354, 0x1f359, 0x1f35c, + 0x1f35e, 0x1f370, 0x1f374, 0x1f375, + 0x1f376, 0x1f377, 0x1f378, 0x1f37a, + 0x1f380, 0x1f381, 0x1f382, 0x1f384, + 0x1f3a0, 0x1f3a4, 0x1f3a5, 0x1f3a7, + 0x1f3a8, 0x1f3a9, 0x1f3aa, 0x1f3ab, + 0x1f3ac, 0x1f3ae, 0x1f3b5, 0x1f3b6, + 0x1f3bd, 0x1f3be, 0x1f3bf, 0x1f3c0, + 0x1f3c1, 0x1f3c2, 0x1f3c3, 0x1f3e0, + 0x1f3e2, 0x1f3e3, 0x1f3e5, 0x1f3e6, + 0x1f3e7, 0x1f3e8, 0x1f3ea, 0x1f3eb, + 0x1f40c, 0x1f41f, 0x1f424, 0x1f427, + 0x1f431, 0x1f434, 0x1f436, 0x1f437, + 0x1f440, 0x1f442, 0x1f44a, 0x1f44d, + 0x1f451, 0x1f453, 0x1f455, 0x1f456, + 0x1f45b, 0x1f45c, 0x1f45d, 0x1f45f, + 0x1f460, 0x1f463, 0x1f464, 0x1f484, + 0x1f48b, 0x1f48c, 0x1f48d, 0x1f493, + 0x1f494, 0x1f495, 0x1f4a0, 0x1f4a1, + 0x1f4a2, 0x1f4a3, 0x1f4a4, 0x1f4a5, + 0x1f4a6, 0x1f4a7, 0x1f4a8, 0x1f4b0, + 0x1f4b4, 0x1f4ba, 0x1f4bb, 0x1f4bf, + 0x1f4ce, 0x1f4d6, 0x1f4dd, 0x1f4df, + 0x1f4e0, 0x1f4e9, 0x1f4f1, 0x1f4f2, + 0x1f4f7, 0x1f4fa, 0x1f50d, 0x1f511, + 0x1f514, 0x1f51a, 0x1f51b, 0x1f51c, + 0x1f527, 0x1f5fb, 0x1f601, 0x1f603, + 0x1f605, 0x1f606, 0x1f609, 0x1f60b, + 0x1f60c, 0x1f60d, 0x1f60f, 0x1f612, + 0x1f613, 0x1f614, 0x1f616, 0x1f61c, + 0x1f61e, 0x1f620, 0x1f621, 0x1f622, + 0x1f623, 0x1f62d, 0x1f631, 0x1f635, + 0x1f683, 0x1f684, 0x1f68c, 0x1f697, + 0x1f699, 0x1f6a2, 0x1f6a5, 0x1f6a9, + 0x1f6aa, 0x1f6ac, 0x1f6ad, 0x1f6b2, + 0x1f6bb, }; + +const int mb_tbl_uni_docomo2code3_value[] = { // 0x1f17f - 0x1f6bb + 0x28f0, 0x295f, 0x295b, 0x295c, + 0x2961, 0x29b3, 0x298f, 0x29bc, + 0x29bd, 0x29be, 0x29bf, 0x28c7, + 0x28c8, 0x28c9, 0x2937, 0x29c3, + 0x2920, 0x2922, 0x2921, 0x2924, + 0x2923, 0x29ca, 0x29c7, 0x29cc, + 0x29c5, 0x29cb, 0x29c8, 0x29c9, + 0x29c6, 0x28f7, 0x29cd, 0x29d0, + 0x29d1, 0x29ce, 0x28f3, 0x29a2, + 0x29cf, 0x29da, 0x28f5, 0x28f6, + 0x2908, 0x2909, 0x290a, 0x2928, + 0x28fd, 0x28fa, 0x28fb, 0x28fe, + 0x28ff, 0x2900, 0x2901, 0x2902, + 0x2930, 0x290f, 0x297a, 0x2983, + 0x28d6, 0x28d9, 0x28db, 0x28dc, + 0x28dd, 0x2996, 0x29b7, 0x28e7, + 0x28e8, 0x28e9, 0x28ea, 0x28eb, + 0x28ec, 0x28ed, 0x28ee, 0x29c2, + 0x29d2, 0x29d5, 0x29d3, 0x29d4, + 0x2926, 0x29d8, 0x2925, 0x29d9, + 0x2915, 0x2916, 0x2981, 0x29ab, + 0x299e, 0x291e, 0x2992, 0x2995, + 0x2993, 0x2906, 0x2931, 0x291d, + 0x28f8, 0x291c, 0x2935, 0x2994, + 0x297d, 0x299b, 0x299f, 0x2971, + 0x2972, 0x2973, 0x297c, 0x297f, + 0x2980, 0x2982, 0x2985, 0x2989, + 0x298a, 0x298b, 0x298c, 0x2999, + 0x295a, 0x2936, 0x299a, 0x2910, + 0x29b4, 0x2907, 0x290d, 0x28de, + 0x2954, 0x2953, 0x290c, 0x2952, + 0x2905, 0x290e, 0x2960, 0x295d, + 0x2997, 0x293d, 0x293c, 0x293b, + 0x299c, 0x29c4, 0x29d7, 0x2974, + 0x29a6, 0x29ae, 0x29ad, 0x29d6, + 0x29a5, 0x29aa, 0x29b0, 0x29a9, + 0x29a7, 0x29a4, 0x2977, 0x29ac, + 0x2976, 0x2975, 0x29a8, 0x29b2, + 0x29af, 0x29b1, 0x29db, 0x2978, + 0x28df, 0x28e1, 0x28e4, 0x28e2, + 0x28e3, 0x28e5, 0x28f1, 0x2962, + 0x2998, 0x2903, 0x2904, 0x29a1, + 0x28f2, }; + + + +const int mb_tbl_uni_kddi2code1_min = 0x0023; +const int mb_tbl_uni_kddi2code1_max = 0x00ae; + +const int mb_tbl_uni_kddi2code1_key[] = { // 0x0023 - 0x00ae + 0x0023, 0x0030, 0x0031, 0x0032, + 0x0033, 0x0034, 0x0035, 0x0036, + 0x0037, 0x0038, 0x0039, 0x00a9, + 0x00ae, }; + +const int mb_tbl_uni_kddi2code1_value[] = { // 0x0023 - 0x00ae + 0x25bc, 0x2830, 0x27a6, 0x27a7, + 0x27a8, 0x27a9, 0x27aa, 0x27ab, + 0x27ac, 0x27ad, 0x27ae, 0x27dc, + 0x27dd, }; + +const int mb_tbl_uni_kddi2code2_min = 0x2002; +const int mb_tbl_uni_kddi2code2_max = 0x3299; + +const int mb_tbl_uni_kddi2code2_key[] = { // 0x2002 - 0x3299 + 0x2002, 0x2003, 0x2005, 0x203c, + 0x2049, 0x2122, 0x2139, 0x2194, + 0x2195, 0x2196, 0x2197, 0x2198, + 0x2199, 0x21a9, 0x21aa, 0x231a, + 0x231b, 0x23e9, 0x23ea, 0x23eb, + 0x23ec, 0x23f0, 0x23f3, 0x25aa, + 0x25ab, 0x25b6, 0x25c0, 0x25fb, + 0x25fc, 0x25fd, 0x25fe, 0x2600, + 0x2601, 0x260e, 0x2611, 0x2614, + 0x2615, 0x261d, 0x263a, 0x2648, + 0x2649, 0x264a, 0x264b, 0x264c, + 0x264d, 0x264e, 0x264f, 0x2650, + 0x2651, 0x2652, 0x2653, 0x2660, + 0x2663, 0x2665, 0x2666, 0x2668, + 0x267b, 0x267f, 0x2693, 0x26a0, + 0x26a1, 0x26aa, 0x26ab, 0x26bd, + 0x26be, 0x26c4, 0x26c5, 0x26ce, + 0x26d4, 0x26ea, 0x26f2, 0x26f3, + 0x26f5, 0x26fa, 0x26fd, 0x2702, + 0x2705, 0x2708, 0x2709, 0x270a, + 0x270b, 0x270c, 0x270f, 0x2712, + 0x2714, 0x2716, 0x2728, 0x2733, + 0x2734, 0x2744, 0x2747, 0x274c, + 0x274e, 0x2753, 0x2757, 0x2764, + 0x2795, 0x2796, 0x2797, 0x27a1, + 0x27b0, 0x2934, 0x2935, 0x2b05, + 0x2b06, 0x2b07, 0x2b1b, 0x2b1c, + 0x2b50, 0x2b55, 0x3297, 0x3299, + }; + +const int mb_tbl_uni_kddi2code2_value[] = { // 0x2002 - 0x3299 + 0x2811, 0x2810, 0x2812, 0x2568, + 0x2567, 0x27d2, 0x27b7, 0x25b2, + 0x25b3, 0x27d0, 0x27d9, 0x27d1, + 0x27da, 0x27e1, 0x27e0, 0x27fe, + 0x27ff, 0x27b4, 0x27b3, 0x27c9, + 0x27c8, 0x2818, 0x2700, 0x27b6, + 0x27b5, 0x27b2, 0x27b1, 0x27bc, + 0x27bd, 0x27b8, 0x27b9, 0x270c, + 0x2711, 0x281a, 0x2840, 0x2710, + 0x281b, 0x277a, 0x277f, 0x2713, + 0x2714, 0x2715, 0x2716, 0x2717, + 0x2718, 0x2719, 0x271a, 0x271b, + 0x271c, 0x271d, 0x271e, 0x2825, + 0x2827, 0x24f0, 0x2826, 0x2740, + 0x25b1, 0x2703, 0x272d, 0x2705, + 0x270b, 0x27be, 0x27bf, 0x273a, + 0x273e, 0x2709, 0x2712, 0x271f, + 0x2708, 0x2852, 0x24ba, 0x281d, + 0x2738, 0x24bb, 0x27f5, 0x279a, + 0x27e2, 0x2737, 0x27a5, 0x25bb, + 0x282b, 0x282a, 0x2725, 0x2841, + 0x27db, 0x27d3, 0x24f6, 0x27c2, + 0x26fd, 0x270e, 0x26f0, 0x27d4, + 0x27d5, 0x2707, 0x2706, 0x2819, + 0x27c0, 0x27c1, 0x27d8, 0x27d6, + 0x2569, 0x2565, 0x2566, 0x27d7, + 0x27c3, 0x27c4, 0x27cd, 0x27cc, + 0x270f, 0x24f8, 0x24e4, 0x2775, + }; + +const int mb_tbl_uni_kddi2code3_min = 0x1f004; +const int mb_tbl_uni_kddi2code3_max = 0x1f6c0; + +const int mb_tbl_uni_kddi2code3_key[] = { // 0x1f004 - 0x1f6c0 + 0x1f004, 0x1f0cf, 0x1f170, 0x1f171, + 0x1f17e, 0x1f17f, 0x1f18e, 0x1f191, + 0x1f192, 0x1f193, 0x1f194, 0x1f195, + 0x1f197, 0x1f198, 0x1f199, 0x1f19a, + 0x1f1e8, 0x1f1e9, 0x1f1ea, 0x1f1eb, + 0x1f1ec, 0x1f1ee, 0x1f1ef, 0x1f1f0, + 0x1f1f7, 0x1f1fa, 0x1f202, 0x1f22f, + 0x1f233, 0x1f235, 0x1f239, 0x1f23a, + 0x1f250, 0x1f251, 0x1f300, 0x1f301, + 0x1f302, 0x1f303, 0x1f305, 0x1f306, + 0x1f308, 0x1f309, 0x1f30a, 0x1f30b, + 0x1f30c, 0x1f30f, 0x1f311, 0x1f313, + 0x1f314, 0x1f319, 0x1f31b, 0x1f320, + 0x1f330, 0x1f331, 0x1f334, 0x1f335, + 0x1f337, 0x1f338, 0x1f339, 0x1f33a, + 0x1f33b, 0x1f33c, 0x1f33d, 0x1f33f, + 0x1f340, 0x1f341, 0x1f342, 0x1f344, + 0x1f345, 0x1f346, 0x1f347, 0x1f348, + 0x1f349, 0x1f34a, 0x1f34c, 0x1f34d, + 0x1f34e, 0x1f34f, 0x1f351, 0x1f352, + 0x1f353, 0x1f354, 0x1f355, 0x1f356, + 0x1f357, 0x1f358, 0x1f359, 0x1f35a, + 0x1f35b, 0x1f35c, 0x1f35d, 0x1f35e, + 0x1f35f, 0x1f360, 0x1f361, 0x1f362, + 0x1f363, 0x1f364, 0x1f365, 0x1f366, + 0x1f367, 0x1f368, 0x1f369, 0x1f36a, + 0x1f36b, 0x1f36c, 0x1f36d, 0x1f36e, + 0x1f36f, 0x1f370, 0x1f371, 0x1f372, + 0x1f373, 0x1f374, 0x1f375, 0x1f376, + 0x1f377, 0x1f378, 0x1f379, 0x1f37a, + 0x1f37b, 0x1f380, 0x1f381, 0x1f382, + 0x1f383, 0x1f384, 0x1f385, 0x1f386, + 0x1f387, 0x1f388, 0x1f389, 0x1f38a, + 0x1f38b, 0x1f38c, 0x1f38d, 0x1f38e, + 0x1f38f, 0x1f390, 0x1f391, 0x1f392, + 0x1f393, 0x1f3a1, 0x1f3a2, 0x1f3a3, + 0x1f3a4, 0x1f3a5, 0x1f3a7, 0x1f3a8, + 0x1f3a9, 0x1f3aa, 0x1f3ab, 0x1f3ac, + 0x1f3ad, 0x1f3ae, 0x1f3af, 0x1f3b0, + 0x1f3b1, 0x1f3b2, 0x1f3b3, 0x1f3b4, + 0x1f3b5, 0x1f3b6, 0x1f3b8, 0x1f3b9, + 0x1f3ba, 0x1f3bb, 0x1f3bc, 0x1f3be, + 0x1f3bf, 0x1f3c0, 0x1f3c1, 0x1f3c2, + 0x1f3c3, 0x1f3c4, 0x1f3c6, 0x1f3c8, + 0x1f3ca, 0x1f3e0, 0x1f3e1, 0x1f3e2, + 0x1f3e3, 0x1f3e5, 0x1f3e6, 0x1f3e7, + 0x1f3e8, 0x1f3e9, 0x1f3ea, 0x1f3eb, + 0x1f3ec, 0x1f3ed, 0x1f3ee, 0x1f3ef, + 0x1f3f0, 0x1f40c, 0x1f40d, 0x1f414, + 0x1f417, 0x1f418, 0x1f419, 0x1f41a, + 0x1f41b, 0x1f41c, 0x1f41d, 0x1f41e, + 0x1f420, 0x1f421, 0x1f422, 0x1f423, + 0x1f424, 0x1f425, 0x1f427, 0x1f428, + 0x1f429, 0x1f42b, 0x1f42c, 0x1f42d, + 0x1f42e, 0x1f42f, 0x1f430, 0x1f431, + 0x1f432, 0x1f433, 0x1f434, 0x1f435, + 0x1f436, 0x1f437, 0x1f438, 0x1f43b, + 0x1f43c, 0x1f43d, 0x1f43e, 0x1f440, + 0x1f442, 0x1f443, 0x1f444, 0x1f445, + 0x1f446, 0x1f447, 0x1f448, 0x1f449, + 0x1f44a, 0x1f44b, 0x1f44c, 0x1f44d, + 0x1f44e, 0x1f44f, 0x1f451, 0x1f452, + 0x1f453, 0x1f454, 0x1f455, 0x1f456, + 0x1f457, 0x1f458, 0x1f459, 0x1f45a, + 0x1f45b, 0x1f45c, 0x1f45e, 0x1f45f, + 0x1f460, 0x1f462, 0x1f463, 0x1f468, + 0x1f469, 0x1f46a, 0x1f46e, 0x1f46f, + 0x1f470, 0x1f471, 0x1f472, 0x1f473, + 0x1f474, 0x1f475, 0x1f476, 0x1f477, + 0x1f478, 0x1f479, 0x1f47a, 0x1f47b, + 0x1f47c, 0x1f47d, 0x1f47e, 0x1f47f, + 0x1f480, 0x1f483, 0x1f484, 0x1f485, + 0x1f486, 0x1f487, 0x1f488, 0x1f489, + 0x1f48a, 0x1f48b, 0x1f48c, 0x1f48d, + 0x1f48f, 0x1f490, 0x1f491, 0x1f493, + 0x1f494, 0x1f495, 0x1f496, 0x1f498, + 0x1f499, 0x1f49a, 0x1f49b, 0x1f49c, + 0x1f49d, 0x1f49e, 0x1f4a1, 0x1f4a2, + 0x1f4a3, 0x1f4a4, 0x1f4a5, 0x1f4a6, + 0x1f4a7, 0x1f4a8, 0x1f4a9, 0x1f4aa, + 0x1f4ab, 0x1f4ac, 0x1f4ae, 0x1f4af, + 0x1f4b0, 0x1f4b2, 0x1f4b3, 0x1f4b4, + 0x1f4b5, 0x1f4b8, 0x1f4b9, 0x1f4bb, + 0x1f4bc, 0x1f4bd, 0x1f4be, 0x1f4bf, + 0x1f4c1, 0x1f4c2, 0x1f4c3, 0x1f4c4, + 0x1f4c5, 0x1f4c6, 0x1f4c7, 0x1f4c8, + 0x1f4c9, 0x1f4ca, 0x1f4cb, 0x1f4cc, + 0x1f4cd, 0x1f4ce, 0x1f4cf, 0x1f4d0, + 0x1f4d1, 0x1f4d2, 0x1f4d3, 0x1f4d4, + 0x1f4d5, 0x1f4d6, 0x1f4d7, 0x1f4d8, + 0x1f4d9, 0x1f4da, 0x1f4db, 0x1f4dc, + 0x1f4dd, 0x1f4de, 0x1f4df, 0x1f4e0, + 0x1f4e1, 0x1f4e4, 0x1f4e5, 0x1f4e6, + 0x1f4e7, 0x1f4e8, 0x1f4e9, 0x1f4ea, + 0x1f4eb, 0x1f4f0, 0x1f4f1, 0x1f4f2, + 0x1f4f3, 0x1f4f4, 0x1f4f6, 0x1f4f7, + 0x1f4f9, 0x1f4fa, 0x1f4fb, 0x1f4fc, + 0x1f503, 0x1f50a, 0x1f50b, 0x1f50c, + 0x1f50d, 0x1f50e, 0x1f50f, 0x1f510, + 0x1f511, 0x1f512, 0x1f514, 0x1f516, + 0x1f517, 0x1f518, 0x1f519, 0x1f51e, + 0x1f51f, 0x1f520, 0x1f521, 0x1f522, + 0x1f523, 0x1f524, 0x1f525, 0x1f526, + 0x1f527, 0x1f528, 0x1f529, 0x1f52a, + 0x1f52b, 0x1f52e, 0x1f530, 0x1f534, + 0x1f535, 0x1f536, 0x1f537, 0x1f538, + 0x1f539, 0x1f53a, 0x1f53b, 0x1f53c, + 0x1f53d, 0x1f5fb, 0x1f5fc, 0x1f5fe, + 0x1f5ff, 0x1f601, 0x1f602, 0x1f603, + 0x1f609, 0x1f60a, 0x1f60c, 0x1f60d, + 0x1f60f, 0x1f612, 0x1f613, 0x1f614, + 0x1f616, 0x1f618, 0x1f61a, 0x1f61c, + 0x1f620, 0x1f621, 0x1f622, 0x1f623, + 0x1f624, 0x1f628, 0x1f629, 0x1f62a, + 0x1f62b, 0x1f62d, 0x1f630, 0x1f631, + 0x1f632, 0x1f633, 0x1f635, 0x1f637, + 0x1f638, 0x1f639, 0x1f63a, 0x1f63b, + 0x1f63c, 0x1f63d, 0x1f63e, 0x1f63f, + 0x1f640, 0x1f645, 0x1f646, 0x1f647, + 0x1f648, 0x1f649, 0x1f64a, 0x1f64b, + 0x1f64c, 0x1f64d, 0x1f64e, 0x1f64f, + 0x1f680, 0x1f683, 0x1f685, 0x1f687, + 0x1f689, 0x1f68c, 0x1f68f, 0x1f691, + 0x1f692, 0x1f693, 0x1f697, 0x1f69a, + 0x1f6a2, 0x1f6a5, 0x1f6a7, 0x1f6a8, + 0x1f6a9, 0x1f6ab, 0x1f6ac, 0x1f6ad, + 0x1f6b2, 0x1f6b6, 0x1f6bb, 0x1f6c0, + }; + +const int mb_tbl_uni_kddi2code3_value[] = { // 0x1f004 - 0x1f6c0 + 0x24bc, 0x25a7, 0x255e, 0x255f, + 0x2560, 0x272a, 0x2561, 0x282f, + 0x24d0, 0x27fc, 0x24d3, 0x284c, + 0x2831, 0x276c, 0x2793, 0x24bd, + 0x2549, 0x2546, 0x24c0, 0x2545, + 0x2548, 0x2547, 0x2750, 0x254a, + 0x24c1, 0x27f7, 0x24d2, 0x24d6, + 0x24d5, 0x24d4, 0x24d1, 0x24d7, + 0x277b, 0x283f, 0x26ed, 0x281c, + 0x2533, 0x253c, 0x253f, 0x24c5, + 0x253d, 0x2743, 0x25b4, 0x258b, + 0x2597, 0x2837, 0x282c, 0x282e, + 0x282d, 0x270a, 0x270d, 0x26ec, + 0x2570, 0x25b5, 0x2766, 0x24e1, + 0x2768, 0x274e, 0x2851, 0x24df, + 0x2767, 0x2581, 0x256e, 0x25ba, + 0x2797, 0x2752, 0x24b8, 0x256f, + 0x2506, 0x2507, 0x256c, 0x256a, + 0x2751, 0x2505, 0x256d, 0x256b, + 0x2504, 0x2592, 0x2571, 0x2756, + 0x2758, 0x275a, 0x2573, 0x2748, + 0x2574, 0x24fe, 0x2759, 0x24ff, + 0x2501, 0x2838, 0x2500, 0x24fa, + 0x24fc, 0x2572, 0x24fd, 0x2502, + 0x2503, 0x25a8, 0x2771, 0x24fb, + 0x2535, 0x2582, 0x2583, 0x2584, + 0x2585, 0x2586, 0x2587, 0x258e, + 0x2591, 0x2754, 0x2508, 0x2509, + 0x2755, 0x2730, 0x24f9, 0x24e2, + 0x2745, 0x2746, 0x2576, 0x2747, + 0x24e3, 0x2823, 0x2753, 0x2824, + 0x2539, 0x274d, 0x253b, 0x2863, + 0x2536, 0x24e6, 0x24e7, 0x26f3, + 0x2575, 0x24c4, 0x252e, 0x252f, + 0x2532, 0x2538, 0x253a, 0x2531, + 0x2530, 0x26f1, 0x252d, 0x257a, + 0x2787, 0x279b, 0x278c, 0x2820, + 0x2540, 0x2822, 0x2722, 0x2742, + 0x2821, 0x274a, 0x2749, 0x26f2, + 0x2528, 0x274c, 0x257b, 0x25a6, + 0x2855, 0x2789, 0x278a, 0x2578, + 0x2527, 0x278b, 0x2517, 0x273b, + 0x24f7, 0x281e, 0x273d, 0x273c, + 0x26ef, 0x2579, 0x24be, 0x273f, + 0x2529, 0x272f, 0x2847, 0x2731, + 0x24c9, 0x24ca, 0x272e, 0x2727, + 0x24cc, 0x253e, 0x2728, 0x24cb, + 0x2541, 0x2544, 0x2741, 0x2542, + 0x2543, 0x25b6, 0x255a, 0x255b, + 0x255c, 0x2557, 0x285e, 0x2537, + 0x2556, 0x2761, 0x258f, 0x2590, + 0x2555, 0x2757, 0x24bf, 0x24c6, + 0x2764, 0x25ae, 0x2760, 0x2558, + 0x2763, 0x255d, 0x2553, 0x2859, + 0x2559, 0x2857, 0x275b, 0x275f, + 0x2577, 0x26f4, 0x275c, 0x275d, + 0x2765, 0x2762, 0x275e, 0x2858, + 0x257e, 0x2580, 0x2772, 0x2828, + 0x2829, 0x251b, 0x251c, 0x257f, + 0x24d8, 0x24d9, 0x2783, 0x2784, + 0x2777, 0x2521, 0x251f, 0x277d, + 0x2520, 0x251e, 0x2860, 0x24e9, + 0x2782, 0x24de, 0x284d, 0x25af, + 0x25a3, 0x24ee, 0x24ef, 0x2791, + 0x2788, 0x2720, 0x284e, 0x2563, + 0x279e, 0x24ea, 0x2562, 0x2780, + 0x277e, 0x2785, 0x24c8, 0x2526, + 0x2534, 0x254b, 0x254c, 0x254d, + 0x254e, 0x254f, 0x2550, 0x2551, + 0x2552, 0x257c, 0x257d, 0x274f, + 0x2856, 0x2792, 0x2770, 0x2773, + 0x277c, 0x2554, 0x278d, 0x24eb, + 0x278f, 0x24ec, 0x24ed, 0x2794, + 0x24e5, 0x276f, 0x25b0, 0x2798, + 0x2861, 0x24e0, 0x2525, 0x25ad, + 0x26fb, 0x26fc, 0x24f1, 0x276e, + 0x24f2, 0x24f3, 0x24f4, 0x24f5, + 0x258c, 0x2833, 0x26fa, 0x2769, + 0x26fe, 0x26f9, 0x2834, 0x2835, + 0x276a, 0x2778, 0x2779, 0x276d, + 0x2594, 0x2781, 0x2774, 0x2776, + 0x274b, 0x27fd, 0x2800, 0x2801, + 0x2809, 0x2593, 0x24c7, 0x284f, + 0x24b9, 0x2806, 0x27e6, 0x2790, + 0x2813, 0x2814, 0x27e5, 0x27ed, + 0x27e7, 0x27ee, 0x27f0, 0x27f9, + 0x27fa, 0x27f8, 0x27e8, 0x27f1, + 0x27e4, 0x2724, 0x27f4, 0x2726, + 0x2849, 0x27f2, 0x27ef, 0x2721, + 0x27ec, 0x2723, 0x27e9, 0x27ea, + 0x27eb, 0x27f3, 0x27a1, 0x27e3, + 0x24dd, 0x27a2, 0x281f, 0x27a4, + 0x272c, 0x2816, 0x2817, 0x27a3, + 0x25a9, 0x2815, 0x259a, 0x279f, + 0x2848, 0x280f, 0x280c, 0x2846, + 0x24db, 0x24dc, 0x24cf, 0x2799, + 0x2802, 0x2786, 0x2850, 0x2804, + 0x284b, 0x2795, 0x2808, 0x280d, + 0x279c, 0x2843, 0x284a, 0x283a, + 0x279d, 0x27a0, 0x2796, 0x2845, + 0x280e, 0x2842, 0x2844, 0x24ce, + 0x27af, 0x283b, 0x283c, 0x283d, + 0x283e, 0x258d, 0x26ff, 0x2807, + 0x280b, 0x2862, 0x2805, 0x2803, + 0x278e, 0x24da, 0x2704, 0x27ce, + 0x27cf, 0x27ca, 0x27cb, 0x27ba, + 0x27bb, 0x27de, 0x27df, 0x27c7, + 0x27c6, 0x2854, 0x2744, 0x27f6, + 0x25a4, 0x25b8, 0x259c, 0x26f5, + 0x285a, 0x2518, 0x2510, 0x285b, + 0x250a, 0x2514, 0x285d, 0x250b, + 0x250e, 0x251a, 0x2519, 0x276b, + 0x26f6, 0x2595, 0x25a1, 0x250d, + 0x250c, 0x2511, 0x259f, 0x250f, + 0x26f8, 0x26f7, 0x2516, 0x285c, + 0x2515, 0x2513, 0x2832, 0x2512, + 0x25b7, 0x259b, 0x2599, 0x259d, + 0x25a2, 0x2598, 0x2596, 0x25a0, + 0x259e, 0x2522, 0x2523, 0x2524, + 0x2588, 0x258a, 0x2589, 0x25bd, + 0x25be, 0x25bf, 0x25c0, 0x251d, + 0x285f, 0x2739, 0x2734, 0x2853, + 0x25a5, 0x2733, 0x272b, 0x252b, + 0x252a, 0x252c, 0x2735, 0x2736, + 0x24cd, 0x26ee, 0x24c2, 0x25ab, + 0x2564, 0x27c5, 0x2701, 0x2702, + 0x2732, 0x25aa, 0x2729, 0x24c3, + }; + + + +const int mb_tbl_uni_sb2code1_min = 0x0023; +const int mb_tbl_uni_sb2code1_max = 0x00ae; + +const int mb_tbl_uni_sb2code1_key[] = { // 0x0023 - 0x00ae + 0x0023, 0x0030, 0x0031, 0x0032, + 0x0033, 0x0034, 0x0035, 0x0036, + 0x0037, 0x0038, 0x0039, 0x00a9, + 0x00ae, }; + +const int mb_tbl_uni_sb2code1_value[] = { // 0x0023 - 0x00ae + 0x2817, 0x282c, 0x2823, 0x2824, + 0x2825, 0x2826, 0x2827, 0x2828, + 0x2829, 0x282a, 0x282b, 0x2855, + 0x2856, }; + +const int mb_tbl_uni_sb2code2_min = 0x2122; +const int mb_tbl_uni_sb2code2_max = 0x3299; + +const int mb_tbl_uni_sb2code2_key[] = { // 0x2122 - 0x3299 + 0x2122, 0x2196, 0x2197, 0x2198, + 0x2199, 0x23e9, 0x23ea, 0x25b6, + 0x25c0, 0x2600, 0x2601, 0x260e, + 0x2614, 0x2615, 0x261d, 0x263a, + 0x2648, 0x2649, 0x264a, 0x264b, + 0x264c, 0x264d, 0x264e, 0x264f, + 0x2650, 0x2651, 0x2652, 0x2653, + 0x2660, 0x2663, 0x2665, 0x2666, + 0x2668, 0x267f, 0x26a0, 0x26a1, + 0x26bd, 0x26be, 0x26c4, 0x26ce, + 0x26ea, 0x26f2, 0x26f3, 0x26f5, + 0x26fa, 0x26fd, 0x2702, 0x2708, + 0x270a, 0x270b, 0x270c, 0x2728, + 0x2733, 0x2734, 0x274c, 0x2753, + 0x2754, 0x2755, 0x2757, 0x2764, + 0x27a1, 0x2b05, 0x2b06, 0x2b07, + 0x2b50, 0x2b55, 0x303d, 0x3297, + 0x3299, }; + +const int mb_tbl_uni_sb2code2_value[] = { // 0x2122 - 0x3299 + 0x2b2e, 0x283e, 0x283d, 0x283f, + 0x2840, 0x2843, 0x2844, 0x2841, + 0x2842, 0x296a, 0x2969, 0x2929, + 0x296b, 0x2965, 0x292f, 0x2aac, + 0x2846, 0x2847, 0x2848, 0x2849, + 0x284a, 0x284b, 0x284c, 0x284d, + 0x284e, 0x284f, 0x2850, 0x2851, + 0x2815, 0x2816, 0x2813, 0x2814, + 0x27cb, 0x2811, 0x2859, 0x27e5, + 0x2938, 0x2936, 0x2968, 0x2852, + 0x2957, 0x27c9, 0x2934, 0x293c, + 0x27ca, 0x295a, 0x2992, 0x293d, + 0x2930, 0x2932, 0x2931, 0x29ad, + 0x280d, 0x280c, 0x29b2, 0x2940, + 0x29b5, 0x29b6, 0x2941, 0x2942, + 0x283b, 0x283c, 0x2839, 0x283a, + 0x29ae, 0x29b1, 0x27d4, 0x298c, + 0x2994, }; + +const int mb_tbl_uni_sb2code3_min = 0x1f004; +const int mb_tbl_uni_sb2code3_max = 0x1f6c0; + +const int mb_tbl_uni_sb2code3_key[] = { // 0x1f004 - 0x1f6c0 + 0x1f004, 0x1f170, 0x1f171, 0x1f17e, + 0x1f17f, 0x1f18e, 0x1f192, 0x1f194, + 0x1f195, 0x1f197, 0x1f199, 0x1f19a, + 0x1f1e8, 0x1f1e9, 0x1f1ea, 0x1f1eb, + 0x1f1ec, 0x1f1ee, 0x1f1ef, 0x1f1f0, + 0x1f1f7, 0x1f1fa, 0x1f201, 0x1f202, + 0x1f21a, 0x1f22f, 0x1f233, 0x1f235, + 0x1f236, 0x1f237, 0x1f238, 0x1f239, + 0x1f23a, 0x1f250, 0x1f300, 0x1f302, + 0x1f303, 0x1f304, 0x1f305, 0x1f306, + 0x1f307, 0x1f308, 0x1f30a, 0x1f319, + 0x1f31f, 0x1f334, 0x1f335, 0x1f337, + 0x1f338, 0x1f339, 0x1f33a, 0x1f33b, + 0x1f33e, 0x1f340, 0x1f341, 0x1f342, + 0x1f343, 0x1f345, 0x1f346, 0x1f349, + 0x1f34a, 0x1f34e, 0x1f353, 0x1f354, + 0x1f358, 0x1f359, 0x1f35a, 0x1f35b, + 0x1f35c, 0x1f35d, 0x1f35e, 0x1f35f, + 0x1f361, 0x1f362, 0x1f363, 0x1f366, + 0x1f367, 0x1f370, 0x1f371, 0x1f372, + 0x1f373, 0x1f374, 0x1f375, 0x1f376, + 0x1f378, 0x1f37a, 0x1f37b, 0x1f380, + 0x1f381, 0x1f382, 0x1f383, 0x1f384, + 0x1f385, 0x1f386, 0x1f387, 0x1f388, + 0x1f389, 0x1f38c, 0x1f38d, 0x1f38e, + 0x1f38f, 0x1f390, 0x1f391, 0x1f392, + 0x1f393, 0x1f3a1, 0x1f3a2, 0x1f3a4, + 0x1f3a5, 0x1f3a6, 0x1f3a7, 0x1f3a8, + 0x1f3a9, 0x1f3ab, 0x1f3ac, 0x1f3af, + 0x1f3b0, 0x1f3b1, 0x1f3b5, 0x1f3b6, + 0x1f3b7, 0x1f3b8, 0x1f3ba, 0x1f3be, + 0x1f3bf, 0x1f3c0, 0x1f3c1, 0x1f3c3, + 0x1f3c4, 0x1f3c6, 0x1f3c8, 0x1f3ca, + 0x1f3e0, 0x1f3e2, 0x1f3e3, 0x1f3e5, + 0x1f3e6, 0x1f3e7, 0x1f3e8, 0x1f3e9, + 0x1f3ea, 0x1f3eb, 0x1f3ec, 0x1f3ed, + 0x1f3ef, 0x1f3f0, 0x1f40d, 0x1f40e, + 0x1f411, 0x1f412, 0x1f414, 0x1f417, + 0x1f418, 0x1f419, 0x1f41a, 0x1f41b, + 0x1f41f, 0x1f420, 0x1f424, 0x1f426, + 0x1f427, 0x1f428, 0x1f42b, 0x1f42c, + 0x1f42d, 0x1f42e, 0x1f42f, 0x1f430, + 0x1f431, 0x1f433, 0x1f434, 0x1f435, + 0x1f436, 0x1f437, 0x1f438, 0x1f439, + 0x1f43a, 0x1f43b, 0x1f440, 0x1f442, + 0x1f443, 0x1f444, 0x1f446, 0x1f447, + 0x1f448, 0x1f449, 0x1f44a, 0x1f44b, + 0x1f44c, 0x1f44d, 0x1f44e, 0x1f44f, + 0x1f450, 0x1f451, 0x1f452, 0x1f454, + 0x1f455, 0x1f457, 0x1f458, 0x1f459, + 0x1f45c, 0x1f45f, 0x1f460, 0x1f461, + 0x1f462, 0x1f463, 0x1f466, 0x1f467, + 0x1f468, 0x1f469, 0x1f46b, 0x1f46e, + 0x1f46f, 0x1f471, 0x1f472, 0x1f473, + 0x1f474, 0x1f475, 0x1f476, 0x1f477, + 0x1f478, 0x1f47b, 0x1f47c, 0x1f47d, + 0x1f47e, 0x1f47f, 0x1f480, 0x1f481, + 0x1f482, 0x1f483, 0x1f484, 0x1f485, + 0x1f486, 0x1f487, 0x1f488, 0x1f489, + 0x1f48a, 0x1f48b, 0x1f48d, 0x1f48e, + 0x1f48f, 0x1f490, 0x1f491, 0x1f492, + 0x1f493, 0x1f494, 0x1f497, 0x1f498, + 0x1f499, 0x1f49a, 0x1f49b, 0x1f49c, + 0x1f49d, 0x1f49f, 0x1f4a1, 0x1f4a2, + 0x1f4a3, 0x1f4a4, 0x1f4a6, 0x1f4a8, + 0x1f4a9, 0x1f4aa, 0x1f4b0, 0x1f4b1, + 0x1f4b9, 0x1f4ba, 0x1f4bb, 0x1f4bc, + 0x1f4bd, 0x1f4bf, 0x1f4c0, 0x1f4d6, + 0x1f4dd, 0x1f4e0, 0x1f4e1, 0x1f4e2, + 0x1f4e3, 0x1f4e9, 0x1f4eb, 0x1f4ee, + 0x1f4f1, 0x1f4f2, 0x1f4f3, 0x1f4f4, + 0x1f4f6, 0x1f4f7, 0x1f4fa, 0x1f4fb, + 0x1f4fc, 0x1f50a, 0x1f50d, 0x1f511, + 0x1f512, 0x1f513, 0x1f514, 0x1f51d, + 0x1f51e, 0x1f525, 0x1f528, 0x1f52b, + 0x1f52f, 0x1f530, 0x1f531, 0x1f532, + 0x1f533, 0x1f534, 0x1f550, 0x1f551, + 0x1f552, 0x1f553, 0x1f554, 0x1f555, + 0x1f556, 0x1f557, 0x1f558, 0x1f559, + 0x1f55a, 0x1f55b, 0x1f5fb, 0x1f5fc, + 0x1f5fd, 0x1f601, 0x1f602, 0x1f603, + 0x1f604, 0x1f609, 0x1f60a, 0x1f60c, + 0x1f60d, 0x1f60f, 0x1f612, 0x1f613, + 0x1f614, 0x1f616, 0x1f618, 0x1f61a, + 0x1f61c, 0x1f61d, 0x1f61e, 0x1f620, + 0x1f621, 0x1f622, 0x1f623, 0x1f625, + 0x1f628, 0x1f62a, 0x1f62d, 0x1f630, + 0x1f631, 0x1f632, 0x1f633, 0x1f637, + 0x1f645, 0x1f646, 0x1f647, 0x1f64c, + 0x1f64f, 0x1f680, 0x1f683, 0x1f684, + 0x1f685, 0x1f687, 0x1f689, 0x1f68c, + 0x1f68f, 0x1f691, 0x1f692, 0x1f693, + 0x1f695, 0x1f697, 0x1f699, 0x1f69a, + 0x1f6a2, 0x1f6a4, 0x1f6a5, 0x1f6a7, + 0x1f6ac, 0x1f6ad, 0x1f6b2, 0x1f6b6, + 0x1f6b9, 0x1f6ba, 0x1f6bb, 0x1f6bc, + 0x1f6bd, 0x1f6be, 0x1f6c0, }; + +const int mb_tbl_uni_sb2code3_value[] = { // 0x1f004 - 0x1f6c0 + 0x27d5, 0x2b29, 0x2b2a, 0x2b2c, + 0x27f7, 0x2b2b, 0x281b, 0x2830, + 0x2819, 0x2854, 0x281a, 0x27d6, + 0x2b0a, 0x2b05, 0x2b08, 0x2b04, + 0x2b07, 0x2b06, 0x2b02, 0x2b0b, + 0x2b09, 0x2b03, 0x280a, 0x282f, + 0x281d, 0x2833, 0x2832, 0x2831, + 0x281c, 0x281e, 0x281f, 0x282e, + 0x2834, 0x282d, 0x2adb, 0x2ad4, + 0x2ae3, 0x296d, 0x2ae1, 0x27ee, + 0x2ae2, 0x2ae4, 0x2ad6, 0x296c, + 0x29b4, 0x2986, 0x2987, 0x2983, + 0x2950, 0x2952, 0x2982, 0x2984, + 0x2adc, 0x27b8, 0x27c0, 0x27c1, + 0x2adf, 0x29c8, 0x29c9, 0x29c7, + 0x29c5, 0x29c4, 0x29c6, 0x27c8, + 0x29bc, 0x29c1, 0x29bd, 0x29c0, + 0x29bf, 0x29be, 0x29b8, 0x29ba, + 0x29bb, 0x29c2, 0x29c3, 0x29b9, + 0x2ad7, 0x2966, 0x29cb, 0x29cc, + 0x27ef, 0x2963, 0x29b7, 0x298a, + 0x2964, 0x2967, 0x298b, 0x2993, + 0x27ba, 0x29ca, 0x2add, 0x2953, + 0x2ae0, 0x27bf, 0x2ad8, 0x298f, + 0x2991, 0x27eb, 0x2ace, 0x2ad0, + 0x2ad3, 0x2ada, 0x2ade, 0x2ad2, + 0x2ad1, 0x27cc, 0x2acb, 0x295c, + 0x295d, 0x2afe, 0x2989, 0x2af9, + 0x2afa, 0x27cd, 0x29a3, 0x27d8, + 0x27db, 0x2ac4, 0x295e, 0x29a5, + 0x2960, 0x2961, 0x2962, 0x2935, + 0x2933, 0x2ac2, 0x27da, 0x27bd, + 0x2937, 0x27d9, 0x2ac3, 0x2ac5, + 0x2956, 0x2958, 0x27fb, 0x27fd, + 0x27f5, 0x27fc, 0x2800, 0x2af8, + 0x27fe, 0x27ff, 0x2afb, 0x2aff, + 0x2afc, 0x2afd, 0x2b24, 0x27dc, + 0x2b20, 0x2b1f, 0x2b25, 0x2b26, + 0x2b1d, 0x27b2, 0x2ad9, 0x2b1c, + 0x2939, 0x2b19, 0x2b1a, 0x2b18, + 0x2975, 0x2b1e, 0x2b27, 0x2b17, + 0x2973, 0x2b22, 0x2970, 0x2b23, + 0x296f, 0x2974, 0x293a, 0x27b1, + 0x2972, 0x27b3, 0x2b28, 0x2b1b, + 0x2b21, 0x2971, 0x2ab1, 0x2ab3, + 0x2ab2, 0x2ab4, 0x2835, 0x2836, + 0x2837, 0x2838, 0x292d, 0x2ab6, + 0x2ab8, 0x292e, 0x2ab9, 0x2ab7, + 0x2aba, 0x27b6, 0x2997, 0x2981, + 0x2926, 0x2998, 0x29a0, 0x29a1, + 0x29a2, 0x2927, 0x27e6, 0x2999, + 0x299a, 0x2b2d, 0x2921, 0x2922, + 0x2924, 0x2925, 0x2ac0, 0x27fa, + 0x2ac1, 0x2b0c, 0x2b0d, 0x2b0e, + 0x2b0f, 0x2b10, 0x2b11, 0x2b12, + 0x2b13, 0x27c3, 0x296e, 0x27b4, + 0x27d3, 0x27c2, 0x27c4, 0x285a, + 0x2b15, 0x2b16, 0x299b, 0x299c, + 0x299d, 0x299e, 0x299f, 0x27e3, + 0x298e, 0x2923, 0x2954, 0x2955, + 0x27b9, 0x2985, 0x2abd, 0x2ad5, + 0x29a6, 0x2943, 0x29a7, 0x29a8, + 0x29a9, 0x29aa, 0x29ab, 0x29ac, + 0x2acf, 0x280b, 0x27b7, 0x29b3, + 0x2990, 0x27e4, 0x29b0, 0x29af, + 0x297a, 0x27f4, 0x27d7, 0x27f1, + 0x27f2, 0x27c7, 0x292c, 0x27c6, + 0x2995, 0x27ce, 0x27cf, 0x27f0, + 0x2980, 0x292b, 0x27f3, 0x27ea, + 0x2996, 0x27ab, 0x27a9, 0x27aa, + 0x292a, 0x27ac, 0x2857, 0x2858, + 0x2812, 0x2928, 0x27d2, 0x27d0, + 0x27d1, 0x27e9, 0x27bc, 0x295f, + 0x27ec, 0x27ed, 0x29a4, 0x2853, + 0x280e, 0x27c5, 0x27be, 0x27bb, + 0x2845, 0x2810, 0x2951, 0x2821, + 0x2822, 0x2820, 0x2944, 0x2945, + 0x2946, 0x2947, 0x2948, 0x2949, + 0x294a, 0x294b, 0x294c, 0x294d, + 0x294e, 0x294f, 0x295b, 0x2b00, + 0x2b14, 0x2a9c, 0x2aaa, 0x2977, + 0x2aad, 0x2a9d, 0x2976, 0x2aa2, + 0x27ae, 0x2a9a, 0x2aa6, 0x27b0, + 0x2a9b, 0x2a9f, 0x2ab0, 0x2aaf, + 0x27ad, 0x2aa1, 0x2978, 0x2979, + 0x2aae, 0x2aab, 0x2a9e, 0x2a99, + 0x2aa3, 0x2aa0, 0x2aa9, 0x2aa7, + 0x27af, 0x2aa8, 0x2aa5, 0x2aa4, + 0x2abb, 0x2abc, 0x2abe, 0x2abf, + 0x2ab5, 0x27b5, 0x293e, 0x2acd, + 0x293f, 0x2acc, 0x2959, 0x2801, + 0x27f8, 0x2ac9, 0x2ac8, 0x2aca, + 0x2802, 0x293b, 0x2ac6, 0x2ac7, + 0x2809, 0x27dd, 0x27f6, 0x27df, + 0x298d, 0x280f, 0x27de, 0x2808, + 0x27e0, 0x27e1, 0x27f9, 0x27e2, + 0x27e8, 0x2988, 0x27e7, }; diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c b/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c index 96a8758879..8d733a9d19 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c @@ -250,7 +250,7 @@ retry: CK((*filter->output_function)(0x203e, filter->data)); } else if (filter->status == 0x20 && c > 0x20 && c < 0x60) { /* kana */ CK((*filter->output_function)(0xff40 + c, filter->data)); - } else if ((filter->status == 0x80 || filter->status == 0x90) && c > 0x20 && c < 0x7f) { /* kanji first char */ + } else if ((filter->status == 0x80 || filter->status == 0x90) && c > 0x20 && c < 0x93) { /* kanji first char */ filter->cache = c; filter->status += 1; } else if (c >= 0 && c < 0x80) { /* latin, CTLs */ @@ -282,10 +282,7 @@ retry: w = cp932ext3_ucs_table[s - cp932ext3_ucs_table_min]; } else if (s >= 94 * 94 && s < 114 * 94) { /* user-defined => PUA (Microsoft extended) */ - w = (s & 0xff) + ((s >> 8) - 94) * 94 + 0xe000; - } else if (s >= 212 * 94 && s < 222 * 94) { - /* user-defined => PUA (G3 85 - 94 Ku) */ - w = (s & 0xff) + ((s >> 8) - 212) * 94 + 0xe000 + 10 * 94; + w = s - 94*94 + 0xe000; } else { w = 0; } diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c new file mode 100644 index 0000000000..b70515f632 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c @@ -0,0 +1,865 @@ +/* + * "streamable kanji code filter and converter" + * Copyright (c) 1998-2002 HappySize, Inc. All rights reserved. + * + * LICENSE NOTICES + * + * This file is part of "streamable kanji code filter and converter", + * which is distributed under the terms of GNU Lesser General Public + * License (version 2) as published by the Free Software Foundation. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with "streamable kanji code filter and converter"; + * if not, write to the Free Software Foundation, Inc., 59 Temple Place, + * Suite 330, Boston, MA 02111-1307 USA + * + * The author of this file: + * + */ +/* + * the source code included in this files was separated from mbfilter_sjis_open.c + * by Rui Hirokawa on 25 July 2011. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_sjis_mac.h" + +#include "unicode_table_cp932_ext.h" +#include "unicode_table_jis.h" + +static int mbfl_filt_ident_sjis_mac(int c, mbfl_identify_filter *filter); + +static const unsigned char mblen_table_sjis[] = { /* 0x80-0x9f,0xE0-0xFF */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 +}; + +static const char *mbfl_encoding_sjis_mac_aliases[] = {"MacJapanese", "x-Mac-Japanese", NULL}; + +const mbfl_encoding mbfl_encoding_sjis_mac = { + mbfl_no_encoding_sjis_mac, + "SJIS-mac", + "Shift_JIS", + (const char *(*)[])&mbfl_encoding_sjis_mac_aliases, + mblen_table_sjis, + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE +}; + +const struct mbfl_identify_vtbl vtbl_identify_sjis_mac = { + mbfl_no_encoding_sjis_mac, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_sjis_mac +}; + +const struct mbfl_convert_vtbl vtbl_sjis_mac_wchar = { + mbfl_no_encoding_sjis_mac, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_sjis_mac_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_sjis_mac = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_sjis_mac, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_sjis_mac, + mbfl_filt_conv_sjis_mac_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +#define SJIS_ENCODE(c1,c2,s1,s2) \ + do { \ + s1 = c1; \ + s1--; \ + s1 >>= 1; \ + if ((c1) < 0x5f) { \ + s1 += 0x71; \ + } else { \ + s1 += 0xb1; \ + } \ + s2 = c2; \ + if ((c1) & 1) { \ + if ((c2) < 0x60) { \ + s2--; \ + } \ + s2 += 0x20; \ + } else { \ + s2 += 0x7e; \ + } \ + } while (0) + +#define SJIS_DECODE(c1,c2,s1,s2) \ + do { \ + s1 = c1; \ + if (s1 < 0xa0) { \ + s1 -= 0x81; \ + } else { \ + s1 -= 0xc1; \ + } \ + s1 <<= 1; \ + s1 += 0x21; \ + s2 = c2; \ + if (s2 < 0x9f) { \ + if (s2 < 0x7f) { \ + s2++; \ + } \ + s2 -= 0x20; \ + } else { \ + s1++; \ + s2 -= 0x7e; \ + } \ + } while (0) + +#include "sjis_mac2uni.h" + +const int code_tbl[][3] = { + {0x02f0, 0x0303, 0x2460}, + {0x030e, 0x0321, 0x2474}, + {0x032c, 0x0334, 0x2776}, + {0x0341, 0x0349, 0x2488}, + {0x034e, 0x0359, 0x2160}, + {0x0362, 0x036d, 0x2170}, + {0x038a, 0x03a3, 0x249c}, +}; + +const int code_ofst_tbl[] [2]= { + {0x03ac, 0x03c9}, + {0x0406, 0x0420}, + {0x0432, 0x0441}, + {0x0468, 0x0480}, + {0x04b8, 0x04e8}, + {0x050c, 0x0551}, + {0x1ed9, 0x1f18}, + {0x1ff2, 0x20a5}, +}; + +const int *code_map[] = { + sjis_mac2wchar1, sjis_mac2wchar2, sjis_mac2wchar3, sjis_mac2wchar4, + sjis_mac2wchar5, sjis_mac2wchar6, sjis_mac2wchar7, sjis_mac2wchar8}; + +const int code_tbl_m[][6] = { + {0x0340, 0xf860, 0x0030, 0x002e, 0x0000, 0x0000}, + {0x03c9, 0xf860, 0x0054, 0x0042, 0x0000, 0x0000}, + {0x035c, 0xf860, 0x0058, 0x0056, 0x0000, 0x0000}, + {0x0370, 0xf860, 0x0078, 0x0076, 0x0000, 0x0000}, + {0x0439, 0xf860, 0x2193, 0x2191, 0x0000, 0x0000}, + {0x0409, 0xf861, 0x0046, 0x0041, 0x0058, 0x0000}, + {0x035b, 0xf861, 0x0058, 0x0049, 0x0056, 0x0000}, + {0x036f, 0xf861, 0x0078, 0x0069, 0x0076, 0x0000}, + {0x035a, 0xf862, 0x0058, 0x0049, 0x0049, 0x0049}, + {0x036e, 0xf862, 0x0078, 0x0069, 0x0069, 0x0069}, + {0x0522, 0xf862, 0x6709, 0x9650, 0x4f1a, 0x793e}, + {0x0523, 0xf862, 0x8ca1, 0x56e3, 0x6cd5, 0x4eba}, +}; + +const int s_form_tbl[] = { + 0x2010,0x2016,0x2026, + 0x3001,0x3002,0x301c,0x3041,0x3043,0x3045,0x3047,0x3049, + 0x3063,0x3083,0x3085,0x3087,0x308e,0x30a1,0x30a3,0x30a5, + 0x30a7,0x30a9,0x30c3,0x30e3,0x30e5,0x30e7,0x30ee,0x30f5, + 0x30f6,0x30fc,0xff1d,0xff3b,0xff3d,0xff5c,0xffe3, // vertical f87e (34) + 0x2026,0xff47,0xff4d, // halfwidth f87f (3) + 0x5927,0x5c0f,0x63a7, // enclosing circle 20dd (3) + 0x21e6,0x21e7,0x21e8,0x21e9, // black arrow f87a (4) +}; + +const int s_form_sjis_tbl[] = { + 0xeb5d,0xeb61,0xeb63, + 0xeb41,0xeb42,0xeb60,0xec9f,0xeca1,0xeca3,0xeca5,0xeca7, + 0xecc1,0xece1,0xece3,0xece5,0xecec,0xed40,0xed42,0xed44, + 0xed46,0xed48,0xed62,0xed83,0xed85,0xed87,0xed8e,0xed95, + 0xed96,0xeb5b,0xeb81,0xeb6d,0xeb6e,0xeb62,0xeb50, // vertical + 0x00ff,0x864b,0x8645, // halfwidth + 0x8791,0x8792,0x879d, // enclosing circle + 0x86d4,0x86d5,0x86d3,0x86d6, // black arrow +}; + +const int s_form_sjis_fallback_tbl[] = { + 0x815d,0x8161,0x8163, + 0x8141,0x8142,0x8160,0x829f,0x82a1,0x82a3,0x82a5,0x82a7, + 0x82c1,0x82e1,0x82e3,0x82e5,0x82ec,0x8340,0x8342,0x8344, + 0x8346,0x8348,0x8362,0x8383,0x8385,0x8387,0x838e,0x8395, + 0x8396,0x815b,0x8181,0x816d,0x816e,0x8162,0x8150, // vertical + 0x815d,0x8287,0x828d, // halfwidth + 0x91e5,0x8fac,0x8d54, // enclosing circle + 0x86d0,0x86d1,0x86cf,0x86d2, // arrow +}; + +const int wchar2sjis_mac_r_tbl[][3] = { + {0x2160, 0x216b, 0x034e}, + {0x2170, 0x217b, 0x0362}, + {0x2460, 0x2473, 0x02f0}, + {0x2474, 0x2487, 0x030e}, + {0x2488, 0x2490, 0x0341}, + {0x249c, 0x24b5, 0x038a}, + {0x2776, 0x277e, 0x032c}, + {0x30f7, 0x30fa, 0x054e}, + {0x32a4, 0x32a9, 0x04ba}, +}; + +const int wchar2sjis_mac_r_map[][2] = { + {0x2660, 0x2667}, + {0x322a, 0x3243}, + {0x3296, 0x329e}, + {0x3300, 0x33d4}, + {0xfe30, 0xfe44}, +}; + +const int *wchar2sjis_mac_code_map[] = { + wchar2sjis_mac4, wchar2sjis_mac7, wchar2sjis_mac8, wchar2sjis_mac9, wchar2sjis_mac10}; + +const int wchar2sjis_mac_wchar_tbl[][2] = { + {0x2109, 0x03c2}, + {0x2110, 0x21ef5}, + {0x2113, 0x03bc}, + {0x2116, 0x0406}, + {0x2121, 0x0408}, + {0x21c4, 0x0437}, + {0x21c5, 0x0438}, + {0x21c6, 0x0436}, + {0x21e6, 0x043b}, + {0x21e7, 0x043c}, + {0x21e8, 0x043a}, + {0x21e9, 0x043d}, + {0x221f, 0x0525}, + {0x222e, 0x0524}, + {0x22bf, 0x0526}, + {0x260e, 0x041f}, + {0x261c, 0x0433}, + {0x261d, 0x0434}, + {0x261e, 0x0432}, + {0x261f, 0x0435}, + {0x3004, 0x0420}, + {0x301d, 0x0538}, + {0x301f, 0x0539}, + {0x3020, 0x041e}, + {0x3094, 0x054c}, +}; + + + +/* + * SJIS-mac => wchar + */ +int +mbfl_filt_conv_sjis_mac_wchar(int c, mbfl_convert_filter *filter) +{ + int i, j, n; + int c1, s, s1, s2, w; + + switch (filter->status) { + case 0: + if (c >= 0 && c < 0x80 && c != 0x5c) { /* latin */ + CK((*filter->output_function)(c, filter->data)); + } else if (c > 0xa0 && c < 0xe0) { /* kana */ + CK((*filter->output_function)(0xfec0 + c, filter->data)); + } else if (c > 0x80 && c < 0xfd && c != 0xa0) { /* kanji first char */ + filter->status = 1; + filter->cache = c; + } else if (c == 0x5c) { + CK((*filter->output_function)(0x00a5, filter->data)); + } else if (c == 0x80) { + CK((*filter->output_function)(0x005c, filter->data)); + } else if (c == 0xa0) { + CK((*filter->output_function)(0x00a0, filter->data)); + } else if (c == 0xfd) { + CK((*filter->output_function)(0x00a9, filter->data)); + } else if (c == 0xfe) { + CK((*filter->output_function)(0x2122, filter->data)); + } else if (c == 0xff) { + CK((*filter->output_function)(0x2026, filter->data)); + CK((*filter->output_function)(0xf87f, filter->data)); + } else { + w = c & MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + + case 1: /* kanji second char */ + filter->status = 0; + c1 = filter->cache; + if (c >= 0x40 && c <= 0xfc && c != 0x7f) { + w = 0; + SJIS_DECODE(c1, c, s1, s2); + s = (s1 - 0x21)*94 + s2 - 0x21; + if (s <= 0x89) { + if (s == 0x1c) { + w = 0x2014; /* EM DASH */ + } else if (s == 0x1f) { + w = 0xff3c; /* FULLWIDTH REVERSE SOLIDUS */ + } else if (s == 0x20) { + w = 0x301c; /* FULLWIDTH TILDE */ + } else if (s == 0x21) { + w = 0x2016; /* PARALLEL TO */ + } else if (s == 0x3c) { + w = 0x2212; /* FULLWIDTH HYPHEN-MINUS */ + } else if (s == 0x50) { + w = 0x00a2; /* FULLWIDTH CENT SIGN */ + } else if (s == 0x51) { + w = 0x00a3; /* FULLWIDTH POUND SIGN */ + } else if (s == 0x89) { + w = 0x00ac; /* FULLWIDTH NOT SIGN */ + } + } + + /* apple gaiji area 0x8540 - 0x886d */ + if (w == 0) { + for (i=0; i<7; i++) { + if (s >= code_tbl[i][0] && s <= code_tbl[i][1]) { + w = s - code_tbl[i][0] + code_tbl[i][2]; + break; + } + } + } + + if (w == 0) { + + for (i=0; i<12; i++) { + if (s == code_tbl_m[i][0]) { + if (code_tbl_m[i][1] == 0xf860) { + n = 4; + } else if (code_tbl_m[i][1] == 0xf861) { + n = 5; + } else { + n = 6; + } + for (j=1; joutput_function)(code_tbl_m[i][j], filter->data)); + } + w = code_tbl_m[i][n-1]; + break; + } + } + } + + if (w == 0) { + for (i=0; i<8; i++) { + if (s >= code_ofst_tbl[i][0] && s <= code_ofst_tbl[i][1]) { + w = code_map[i][s - code_ofst_tbl[i][0]]; + if (w >= 0x10000) { + CK((*filter->output_function)(w & 0xffff, filter->data)); + if (w & 0x10000) { + w = 0xf87a; + } else if (w & 0x20000) { + w = 0xf87e; + } else if (w & 0x40000) { + w = 0xf87f; + } else if (w & 0x80000) { + w = 0x20dd; + } else if (w & 0xF0000) { + // TBD + w = 0; + } else { + w = 0; + } + } + + break; + } + } + } + + if (w == 0 && s >= 0 && s < jisx0208_ucs_table_size) { /* X 0208 */ + w = jisx0208_ucs_table[s]; + } + + if (w <= 0) { + w = (s1 << 8) | s2; + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_WINCP932; + } + CK((*filter->output_function)(w, filter->data)); + } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ + CK((*filter->output_function)(c, filter->data)); + } else { + w = (c1 << 8) | c; + w &= MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + + default: + filter->status = 0; + break; + } + + return c; +} + +/* + * wchar => SJIS-mac + */ +int +mbfl_filt_conv_wchar_sjis_mac(int c, mbfl_convert_filter *filter) +{ + int i, j; + int c1, c2, s1, s2, mode; + + s1 = 0; + s2 = 0; + + // a1: U+0000 -> U+046F + // a2: U+2000 -> U+30FF + // i: U+4E00 -> U+9FFF + // r: U+FF00 -> U+FFFF + + switch (filter->status) { + + case 1: + c1 = filter->cache; + filter->cache = 0; + filter->status = 0; + + s1 = 0; + s2 = 0; + + if (c == 0xf87a) { + for (i=0;i<4;i++) { + if (c1 == s_form_tbl[i+34+3+3]) { + s1 = s_form_sjis_tbl[i+34+3+3]; + break; + } + } + if (s1 <= 0) { + s2 = c1; + } + } else if (c == 0x20dd) { + for (i=0;i<3;i++) { + if (c1 == s_form_tbl[i+34+3]) { + s1 = s_form_sjis_tbl[i+34+3]; + break; + } + } + if (s1 <= 0) { + s2 = c1; + } + } else if (c == 0xf87f) { + for (i=0;i<3;i++) { + if (c1 == s_form_tbl[i+34]) { + s1 = s_form_sjis_tbl[i+34]; + break; + } + } + if (s1 <= 0) { + s2 = c1; s1 = -1; + } + } else if (c == 0xf87e) { + for (i=0;i<34;i++) { + if (c1 == s_form_tbl[i]) { + s1 = s_form_sjis_tbl[i]; + break; + } + } + if (s1 <= 0) { + s2 = c1; s1 = -1; + } + } else { + s2 = c1; + s1 = c; + } + + if (s2 > 0) { + for (i=0;i= 0) { + if (s1 < 0x100) { + CK((*filter->output_function)(s1, filter->data)); + } else { + CK((*filter->output_function)((s1 >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(s1 & 0xff, filter->data)); + } + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + if (s2 <= 0 || s1 == -1) { + break; + } + + case 0: + + if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) { + s1 = ucs_a1_jis_table[c - ucs_a1_jis_table_min]; + if (c == 0x5c) { + s1 = 0x80; + } else if (c == 0xa9) { + s1 = 0xfd; + } + } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) { + s1 = ucs_a2_jis_table[c - ucs_a2_jis_table_min]; + if (c == 0x2122) { + s1 = 0xfe; + } else if (c == 0x2014) { + s1 = 0x213d; + } else if (c == 0x2116) { + s1 = 0x2c1d; + } + } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) { + s1 = ucs_i_jis_table[c - ucs_i_jis_table_min]; + } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) { + s1 = ucs_r_jis_table[c - ucs_r_jis_table_min]; + } + + if (c >= 0x2000) { + for (i=0;istatus = 1; + filter->cache = c; + return c; + } + } + + if (c == 0xf860 || c == 0xf861 || c == 0xf862) { + filter->status = 2; + filter->cache = c; + return c; + } + } + + if (s1 <= 0) { + c1 = c & ~MBFL_WCSPLANE_MASK; + if (c1 == MBFL_WCSPLANE_WINCP932) { + s1 = c & MBFL_WCSPLANE_MASK; + s2 = 1; + } else if (c1 == MBFL_WCSPLANE_JIS0208) { + s1 = c & MBFL_WCSPLANE_MASK; + } else if (c1 == MBFL_WCSPLANE_JIS0212) { + s1 = c & MBFL_WCSPLANE_MASK; + s1 |= 0x8080; + } else if (c == 0xa0) { + s1 = 0x00a0; + } else if (c == 0xa5) { /* YEN SIGN */ + s1 = 0x005c; + } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */ + s1 = 0x2140; + } + } + + if (s1 <= 0) { + for (i=0; i= wchar2sjis_mac_r_tbl[i][0] && c <= wchar2sjis_mac_r_tbl[i][1]) { + s1 = c - wchar2sjis_mac_r_tbl[i][0] + wchar2sjis_mac_r_tbl[i][2]; + break; + } + } + + if (s1 <= 0) { + for (i=0; i= wchar2sjis_mac_r_map[i][0] && c <= wchar2sjis_mac_r_map[i][1]) { + s1 = wchar2sjis_mac_code_map[i][c-wchar2sjis_mac_r_map[i][0]]; + break; + } + } + } + + if (s1 <= 0) { + for (i=0; i 0) { + c1 = s1/94+0x21; + c2 = s1-94*(c1-0x21)+0x21; + s1 = (c1 << 8) | c2; + s2 = 1; + } + } + + if ((s1 <= 0) || (s1 >= 0x8080 && s2 == 0)) { /* not found or X 0212 */ + s1 = -1; + c1 = 0; + + if (c == 0) { + s1 = 0; + } else if (s1 <= 0) { + s1 = -1; + } + } + + if (s1 >= 0) { + if (s1 < 0x100) { /* latin or kana */ + CK((*filter->output_function)(s1, filter->data)); + } else { /* kanji */ + c1 = (s1 >> 8) & 0xff; + c2 = s1 & 0xff; + SJIS_ENCODE(c1, c2, s1, s2); + CK((*filter->output_function)(s1, filter->data)); + CK((*filter->output_function)(s2, filter->data)); + } + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + break; + + + case 2: + c1 = filter->cache; + filter->cache = 0; + filter->status = 0; + if (c1 == 0xf860) { + for (i=0; i<5; i++) { + if (c == code_tbl_m[i][2]) { + filter->cache = c | 0x10000; + filter->status = 3; + break; + } + } + } else if (c1 == 0xf861) { + for (i=0; i<3; i++) { + if (c == code_tbl_m[i+5][2]) { + filter->cache = c | 0x20000; + filter->status = 3; + break; + } + } + } else if (c1 == 0xf862) { + for (i=0; i<4; i++) { + if (c == code_tbl_m[i+5+3][2]) { + filter->cache = c | 0x40000; + filter->status = 3; + break; + } + } + } + + if (filter->status == 0 && filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c1, filter)); + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + + break; + + case 3: + s1 = 0; + c1 = filter->cache & 0xffff; + mode = (filter->cache & 0xf0000) >> 16; + + filter->cache = 0; + filter->status = 0; + + if (mode == 0x1) { + for (i=0; i<5; i++) { + if (c1 == code_tbl_m[i][2] && c == code_tbl_m[i][3]) { + s1 = code_tbl_m[i][0]; + break; + } + } + + if (s1 > 0) { + c1 = s1/94+0x21; + c2 = s1-94*(c1-0x21)+0x21; + SJIS_ENCODE(c1, c2, s1, s2); + CK((*filter->output_function)(s1, filter->data)); + CK((*filter->output_function)(s2, filter->data)); + } + + if (s1 <= 0 && filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(0xf860, filter)); + CK(mbfl_filt_conv_illegal_output(c1, filter)); + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + + } else if (mode == 0x2) { + for (i=0; i<3; i++) { + if (c1 == code_tbl_m[i+5][2] && c == code_tbl_m[i+5][3]) { + filter->cache = c | 0x20000; + filter->status = 4; + break; + } + } + } else if (mode == 0x4) { + for (i=0; i<4; i++) { + if (c1 == code_tbl_m[i+8][2] && c == code_tbl_m[i+8][3]) { + filter->cache = c | 0x40000; + filter->status = 4; + break; + } + } + } + break; + + case 4: + s1 = 0; + c1 = filter->cache & 0xffff; + mode = (filter->cache & 0xf0000) >> 16; + + filter->cache = 0; + filter->status = 0; + + if (mode == 0x2) { + for (i=0; i<3; i++) { + if (c1 == code_tbl_m[i+5][3] && c == code_tbl_m[i+5][4]) { + s1 = code_tbl_m[i+5][0]; + break; + } + } + + if (s1 > 0) { + c1 = s1/94+0x21; + c2 = s1-94*(c1-0x21)+0x21; + SJIS_ENCODE(c1, c2, s1, s2); + CK((*filter->output_function)(s1, filter->data)); + CK((*filter->output_function)(s2, filter->data)); + } + + if (s1 <= 0 && filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(0xf861, filter)); + for (i=0; i<3; i++) { + if (c1 == code_tbl_m[i+5][3]) { + CK(mbfl_filt_conv_illegal_output(code_tbl_m[i+5][2], filter)); + break; + } + } + CK(mbfl_filt_conv_illegal_output(c1, filter)); + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } else if (mode == 0x4) { + for (i=0; i<4; i++) { + if (c1 == code_tbl_m[i+8][3] && c == code_tbl_m[i+8][4]) { + filter->cache = c | 0x40000; + filter->status = 5; + break; + } + } + } + break; + + case 5: + s1 = 0; + c1 = filter->cache & 0xffff; + mode = (filter->cache & 0xf0000) >> 16; + + filter->cache = 0; + filter->status = 0; + + if (mode == 0x4) { + for (i=0; i<4; i++) { + if (c1 == code_tbl_m[i+8][4] && c == code_tbl_m[i+8][5]) { + s1 = code_tbl_m[i+8][0]; + break; + } + } + + if (s1 > 0) { + c1 = s1/94+0x21; + c2 = s1-94*(c1-0x21)+0x21; + SJIS_ENCODE(c1, c2, s1, s2); + CK((*filter->output_function)(s1, filter->data)); + CK((*filter->output_function)(s2, filter->data)); + } + + if (s1 <= 0 && filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(0xf862, filter)); + for (i=0; i<4; i++) { + if (c1 == code_tbl_m[i+8][4]) { + CK(mbfl_filt_conv_illegal_output( code_tbl_m[i+8][2], filter)); + CK(mbfl_filt_conv_illegal_output( code_tbl_m[i+8][3], filter)); + break; + } + } + CK(mbfl_filt_conv_illegal_output(c1, filter)); + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + break; + + default: + filter->status = 0; + break; + } + return c; +} + +int +mbfl_filt_conv_sjis_mac_flush(mbfl_convert_filter *filter) +{ + int i, c1, s1 = 0; + if (filter->status == 1 && filter->cache > 0) { + c1 = filter->cache; + for (i=0;i 0) { + CK((*filter->output_function)((s1 >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(s1 & 0xff, filter->data)); + } + } + filter->cache = 0; + filter->status = 0; + + if (filter->flush_function != NULL) { + return (*filter->flush_function)(filter->data); + } + + return 0; +} + +static int mbfl_filt_ident_sjis_mac(int c, mbfl_identify_filter *filter) +{ + if (filter->status) { /* kanji second char */ + if (c < 0x40 || c > 0xfc || c == 0x7f) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + } else if (c >= 0 && c < 0x80) { /* latin ok */ + ; + } else if (c > 0xa0 && c < 0xe0) { /* kana ok */ + ; + } else if (c > 0x80 && c < 0xfd && c != 0xa0) { /* kanji first char */ + filter->status = 1; + } else { /* bad */ + filter->flag = 1; + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.h b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.h new file mode 100644 index 0000000000..3f332d9a6c --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.h @@ -0,0 +1,45 @@ +/* + * "streamable kanji code filter and converter" + * Copyright (c) 1998-2002 HappySize, Inc. All rights reserved. + * + * LICENSE NOTICES + * + * This file is part of "streamable kanji code filter and converter", + * which is distributed under the terms of GNU Lesser General Public + * License (version 2) as published by the Free Software Foundation. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with "streamable kanji code filter and converter"; + * if not, write to the Free Software Foundation, Inc., 59 Temple Place, + * Suite 330, Boston, MA 02111-1307 USA + * + * The author of this file: + * + */ +/* + * the source code included in this files was separated from mbfilter_sjis_open.c + * by Rui Hirokawa on 25 July 2011. + * + */ + +#ifndef MBFL_MBFILTER_SJIS_MAC_H +#define MBFL_MBFILTER_SJIS_MAC_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_sjis_mac; + +extern const struct mbfl_identify_vtbl vtbl_identify_sjis_mac; +extern const struct mbfl_convert_vtbl vtbl_sjis_mac_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_sjis_mac; + +int mbfl_filt_conv_sjis_mac_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_sjis_mac(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_sjis_mac_flush(mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_SJIS_MAC_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.c b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.c new file mode 100644 index 0000000000..62cb186f9f --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.c @@ -0,0 +1,1103 @@ + +/* + * "streamable kanji code filter and converter" + * Copyright (c) 1998-2002 HappySize, Inc. All rights reserved. + * + * LICENSE NOTICES + * + * This file is part of "streamable kanji code filter and converter", + * which is distributed under the terms of GNU Lesser General Public + * License (version 2) as published by the Free Software Foundation. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with "streamable kanji code filter and converter"; + * if not, write to the Free Software Foundation, Inc., 59 Temple Place, + * Suite 330, Boston, MA 02111-1307 USA + * + * The author of this file: + * + */ +/* + * the source code included in this files was separated from mbfilter_sjis_open.c + * by Rui Hirokawa on 25 July 2011. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_sjis_mobile.h" + +#include "unicode_table_cp932_ext.h" +#include "unicode_table_jis.h" + +#include "emoji2uni.h" + +static int mbfl_filt_ident_sjis_mobile(int c, mbfl_identify_filter *filter); + +static const unsigned char mblen_table_sjis[] = { /* 0x80-0x9f,0xE0-0xFF */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 +}; + +const mbfl_encoding mbfl_encoding_sjis_docomo = { + mbfl_no_encoding_sjis_docomo, + "SJIS-Mobile#DOCOMO", + "Shift_JIS", + NULL, + mblen_table_sjis, + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE +}; + +const mbfl_encoding mbfl_encoding_sjis_kddi = { + mbfl_no_encoding_sjis_kddi, + "SJIS-Mobile#KDDI", + "Shift_JIS", + NULL, + mblen_table_sjis, + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE +}; + +const mbfl_encoding mbfl_encoding_sjis_sb = { + mbfl_no_encoding_sjis_sb, + "SJIS-Mobile#SOFTBANK", + "Shift_JIS", + NULL, + mblen_table_sjis, + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE +}; + +const mbfl_encoding mbfl_encoding_sjis_docomo_pua = { + mbfl_no_encoding_sjis_docomo_pua, + "SJIS-Mobile#DOCOMO-PUA", + "Shift_JIS", + NULL, + mblen_table_sjis, + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE +}; + +const mbfl_encoding mbfl_encoding_sjis_kddi_pua = { + mbfl_no_encoding_sjis_kddi_pua, + "SJIS-Mobile#KDDI-PUA", + "Shift_JIS", + NULL, + mblen_table_sjis, + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE +}; + +const mbfl_encoding mbfl_encoding_sjis_kddi_pua_b = { + mbfl_no_encoding_sjis_kddi_pua_b, + "SJIS-Mobile#KDDI-PUA-B", + "Shift_JIS", + NULL, + mblen_table_sjis, + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE +}; + +const mbfl_encoding mbfl_encoding_sjis_sb_pua = { + mbfl_no_encoding_sjis_sb_pua, + "SJIS-Mobile#SOFTBANK-PUA", + "Shift_JIS", + NULL, + mblen_table_sjis, + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE +}; + +const struct mbfl_convert_vtbl vtbl_sjis_docomo_wchar = { + mbfl_no_encoding_sjis_docomo, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_sjis_mobile_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_sjis_docomo = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_sjis_docomo, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_sjis_mobile, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_sjis_kddi_wchar = { + mbfl_no_encoding_sjis_kddi, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_sjis_mobile_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_sjis_kddi = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_sjis_kddi, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_sjis_mobile, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_sjis_sb_wchar = { + mbfl_no_encoding_sjis_sb, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_sjis_mobile_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_sjis_sb = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_sjis_sb, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_sjis_mobile, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_sjis_docomo_pua_wchar = { + mbfl_no_encoding_sjis_docomo_pua, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_sjis_mobile_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_sjis_docomo_pua = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_sjis_docomo_pua, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_sjis_mobile, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_sjis_kddi_pua_wchar = { + mbfl_no_encoding_sjis_kddi_pua, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_sjis_mobile_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_sjis_kddi_pua = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_sjis_kddi_pua, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_sjis_mobile, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_sjis_kddi_pua_b_wchar = { + mbfl_no_encoding_sjis_kddi_pua_b, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_sjis_mobile_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_sjis_kddi_pua_b = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_sjis_kddi_pua_b, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_sjis_mobile, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_sjis_sb_pua_wchar = { + mbfl_no_encoding_sjis_sb_pua, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_sjis_mobile_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_sjis_sb_pua = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_sjis_sb_pua, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_sjis_mobile, + mbfl_filt_conv_common_flush +}; + + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +#define SJIS_ENCODE(c1,c2,s1,s2) \ + do { \ + s1 = c1; \ + s1--; \ + s1 >>= 1; \ + if ((c1) < 0x5f) { \ + s1 += 0x71; \ + } else { \ + s1 += 0xb1; \ + } \ + s2 = c2; \ + if ((c1) & 1) { \ + if ((c2) < 0x60) { \ + s2--; \ + } \ + s2 += 0x20; \ + } else { \ + s2 += 0x7e; \ + } \ + } while (0) + +#define SJIS_DECODE(c1,c2,s1,s2) \ + do { \ + s1 = c1; \ + if (s1 < 0xa0) { \ + s1 -= 0x81; \ + } else { \ + s1 -= 0xc1; \ + } \ + s1 <<= 1; \ + s1 += 0x21; \ + s2 = c2; \ + if (s2 < 0x9f) { \ + if (s2 < 0x7f) { \ + s2++; \ + } \ + s2 -= 0x20; \ + } else { \ + s1++; \ + s2 -= 0x7e; \ + } \ + } while (0) + +int +mbfiler_sjis_emoji_docomo2unicode(int s, int *snd) +{ + int w = s; + if (s >= mb_tbl_code2uni_docomo1_min && s <= mb_tbl_code2uni_docomo1_max) { + if (s >= mb_tbl_code2uni_docomo1_min + 0x00a2 && + s <= mb_tbl_code2uni_docomo1_min + 0x00ad && + s != mb_tbl_code2uni_docomo1_min + 0x00a3) { + w = 0x20E3; + *snd = mb_tbl_code2uni_docomo1[s - mb_tbl_code2uni_docomo1_min]; + } else { + w = mb_tbl_code2uni_docomo1[s - mb_tbl_code2uni_docomo1_min]; + *snd = 0; + if (!w) { + w = s; + } + } + } + return w; +} + +int +mbfiler_sjis_emoji_kddi2unicode(int s, int *snd) +{ + int w = s, si; + const char flags[][2] = {"FR","DE","IT","GB","CN","KR","ES","RU","JP","US"}; + + *snd = 0; + if (s >= mb_tbl_code2uni_kddi1_min && + s <= mb_tbl_code2uni_kddi1_max) { + si = s - mb_tbl_code2uni_kddi1_min; + if (si == 0x0008) { + *snd = 0x1F1A5 + flags[6][0]; w = 0x1F1A5 + flags[6][1]; + } else if (si == 0x0009) { + *snd = 0x1F1A5 + flags[7][0]; w = 0x1F1A5 + flags[7][1]; + } else if (si >= 0x008d && si <= 0x0092) { + *snd = 0x1F1A5 + flags[si - 0x8d][0]; + w = 0x1F1A5 + flags[si - 0x8d][1]; + } else if (si == 0x0104) { + *snd = 0x0023; w = 0x20E3; + } else { + w = mb_tbl_code2uni_kddi1[si]; + } + } else if (s >= mb_tbl_code2uni_kddi2_min && + s <= mb_tbl_code2uni_kddi2_max) { + si = s - mb_tbl_code2uni_kddi2_min; + if (si == 100) { + *snd = 0x1F1A5 + flags[8][0]; w = 0x1F1A5 + flags[8][1]; + } else if (si >= 0x00ba && si <= 0x00c2) { + *snd = si-0x00ba+0x0031; w = 0x20E3; + } else if (si == 0x010b) { + *snd = 0x1F1A5 + flags[9][0]; w = 0x1F1A5 + flags[9][1]; + } else if (si == 0x0144) { + *snd = 0x0030; w = 0x20E3; + } else { + w = mb_tbl_code2uni_kddi2[si]; + } + } + return w; +} + +int +mbfiler_sjis_emoji_sb2unicode(int s, int *snd) +{ + int w = s, si; + const char flags[][2] = {"JP","US","FR","DE","IT","GB","ES","RU","CN","KR"}; + + *snd = 0; + if (s >= mb_tbl_code2uni_sb1_min && + s <= mb_tbl_code2uni_sb1_max) { + si = s - mb_tbl_code2uni_sb1_min; + if (si == 0x006e || (si >= 0x007a && si <= 0x0083)) { + *snd = mb_tbl_code2uni_sb1[si]; + w = 0x20E3; + } else { + w = mb_tbl_code2uni_sb1[si]; + } + } else if (s >= mb_tbl_code2uni_sb2_min && + s <= mb_tbl_code2uni_sb2_max) { + si = s - mb_tbl_code2uni_sb2_min; + w = mb_tbl_code2uni_sb2[si]; + } else if (s >= mb_tbl_code2uni_sb3_min && + s <= mb_tbl_code2uni_sb3_max) { + si = s - mb_tbl_code2uni_sb3_min; + if (si >= 0x0069 && si <= 0x0072) { + *snd = 0x1F1A5 + flags[si - 0x0069][0]; + w = 0x1F1A5 + flags[si - 0x0069][1]; + } else { + w = mb_tbl_code2uni_sb3[si]; + } + } + return w; +} + +int +mbfiler_sjis_emoji_kddi2unicode_pua(int s, int *w) +{ + + if (s >= 0x26ec && s <= 0x2838) { + *w = s - 0x26ec + 0xe468; + } else if (s >= 0x284c && s <= 0x2863) { + *w = s - 0x284c + 0xe5b5; + } else if (s >= 0x24b8 && s <= 0x24ca) { + *w = s - 0x24b8 + 0xe5cd; + } else if (s >= 0x24cb && s <= 0x2545) { + *w = s - 0x24cb + 0xea80; + } else if (s >= 0x2839 && s <= 0x284b) { + *w = s - 0x2839 + 0xeafb; + } else if (s >= 0x2546 && s <= 0x25c0) { + *w = s - 0x2546 + 0xeb0e; + } + + return *w; +} + +int +mbfiler_sjis_emoji_kddi2unicode_pua_b(int s, int c1, int c, int *w) +{ + if ((c1 == 0xf3 && (c >= 0x40 && c<=0xfc && c != 0x7f)) || + (c1 == 0xf4 && (c >= 0x40 && c<=0x93 && c != 0x7f)) || + ((c1 == 0xf6 || c1 == 0xf7) && (c >= 0x40 && c<=0xfc && c != 0x7f))) { + *w = (c1 << 8) + c - 0x0700; /* KDDI unofficial UTF-8 encoding */ + } + return *w; +} + +int +mbfiler_sjis_emoji2unicode_pua(int s, int *w) +{ + if (s >= 0x27a9 && s <= 0x2802) { + *w = s - 0x27a9 + 0xe101; + } else if (s >= 0x2808 && s <= 0x285a) { + *w = s - 0x2808 + 0xe201; + } else if (s >= 0x2921 && s <= 0x297a) { + *w = s - 0x2921 + 0xe001; + } else if (s >= 0x2980 && s <= 0x29cc) { + *w = s - 0x2980 + 0xe301; + } else if (s >= 0x2a99 && s <= 0x2ae4) { + *w = s - 0x2a99 + 0xe401; + } else if (s >= 0x2af8 && s <= 0x2b2e) { + *w = s - 0x2af8 + 0xe501; + } + return *w; +} + +int +mbfiler_unicode_pua2sjis_emoji_kddi(int c, int *s1, int *s2, int *c1, int *c2) +{ + int match = 1; + + if (c >= 0xe468 && c <= 0xe5b4) { + *s1 = c - 0xe468 + 0x26ec; + } else if (c >= 0xe5b5 && c <= 0xe5cc) { + *s1 = c - 0xe5b5 + 0x284c; + } else if (c >= 0xe5cd && c <= 0xe5df) { + *s1 = c - 0xe5cd + 0x24b8; + } else if (c >= 0xea80 && c <= 0xeafa) { + *s1 = c - 0xea80 + 0x24cb; + } else if (c >= 0xeafb && c <= 0xeb0d) { + *s1 = c - 0xeafb + 0x2839; + } else if (c >= 0xeb0e && c <= 0xeb88) { + *s1 = c - 0xeb0e + 0x2546; + } else { + match = 0; + } + if (match && *s1 >0) { + *c1 = *s1/94+0x21; + *c2 = *s1-94*(*c1-0x21)+0x21; + *s1 = (*c1 << 8) | *c2; + *s2 = 1; + } + + return 1; +} + + + +int +mbfiler_unicode_pua2sjis_emoji(int c, int *s1, int *s2, int *c1, int *c2, int *sjis_encoded) +{ + int match = 1; + + if (c >= 0xe001 && c <= 0xe05a) { + *s1 = c - 0xe001 + 0x2921; + } else if (c >= 0xe101 && c <= 0xe15a) { + *s1 = c - 0xe101 + 0x27a9; + } else if (c >= 0xe201 && c <= 0xe253) { + *s1 = c - 0xe201 + 0x2808; + } else if (c >= 0xe301 && c <= 0xe34d) { + *s1 = c - 0xe301 + 0x2980; + } else if (c >= 0xe401 && c <= 0xe44c) { + *s1 = c - 0xe401 + 0x2a99; + } else if (c >= 0xe501 && c <= 0xe537) { + *s1 = c - 0xe501 + 0x2af8; + } else if ( + ((c >= 0xec40 && c<=0xecfc) && c != 0xec7f) || + ((c >= 0xed40 && c<=0xed93) && c != 0xed7f) || + ((c >= 0xef40 && c<=0xeffc) && c != 0xef7f) || + ((c >= 0xf040 && c<=0xf0fc) && c != 0xf07f)) { + /* KDDI unofficial UTF-8 encoding */ + *s1 = c + 0x0700; + *sjis_encoded = 1; + } else { + match = 0; + } + if (match && *sjis_encoded == 0 && *s1 >0) { + *c1 = *s1/94+0x21; + *c2 = *s1-94*(*c1-0x21)+0x21; + *s1 = (*c1 << 8) | *c2; + *s2 = 1; + } + + return 1; +} + +int +mbfiler_unicode2sjis_emoji_docomo(int c, int *s1, int *s2, int *c1, int *c2, mbfl_convert_filter *filter) +{ + int i, match = 0, c1s; + + if (filter->status == 1) { + c1s = filter->cache; + filter->cache = 0; + filter->status = 0; + if (c == 0x20E3) { + if (c1s == 0x0023) { + *s1 = 0x2964; + match = 1; + } else if (c1s == 0x0030) { + *s1 = 0x296f; + match = 1; + } else if (c1s >= 0x0031 && c1s <= 0x0039) { + *s1 = 0x2966 + (c1s - 0x0031); + match = 1; + } + } else { + if (c1s >= ucs_a1_jis_table_min && c1s < ucs_a1_jis_table_max) { + c1s = ucs_a1_jis_table[c1s - ucs_a1_jis_table_min]; + CK((*filter->output_function)(c1s, filter->data)); + } + } + } else { + if (c == 0x0023 || (c >= 0x0030 && c<=0x0039)) { + filter->status = 1; + filter->cache = c; + *s1 = -1; + return 0; + } + + if (c == 0x00A9) { + *s1 = 0x29b5; match = 1; + } else if (c == 0x00AE) { + *s1 = 0x29ba; match = 1; + } else if (c >= mb_tbl_uni_docomo2code2_min && c <= mb_tbl_uni_docomo2code2_max) { + for (i=0; i < sizeof(mb_tbl_uni_docomo2code2_key)/sizeof(int); i++) { + if (c >0 && mb_tbl_uni_docomo2code2_key[i] == c) { + *s1 = mb_tbl_uni_docomo2code2_value[i]; + match = 1; + break; + } + } + } else if (c >= mb_tbl_uni_docomo2code3_min && c <= mb_tbl_uni_docomo2code3_max) { + for (i=0; i < sizeof(mb_tbl_uni_docomo2code3_key)/sizeof(int); i++) { + if (c >0 && mb_tbl_uni_docomo2code3_key[i] == c) { + *s1 = mb_tbl_uni_docomo2code3_value[i]; + match = 1; + break; + } + } + } + } + + if (match && *s1 >0) { + *c1 = *s1/94+0x21; + *c2 = *s1-94*(*c1-0x21)+0x21; + *s1 = (*c1 << 8) | *c2; + *s2 = 1; + } + + return 1; +} + +const char nflags_s[][2] = {"CN","DE","ES","FR","GB","IT","JP","KR","RU","US"}; +const int nflags_code_kddi[] = {0x2549, 0x2546, 0x24c0, 0x2545, 0x2548, 0x2547, 0x2750, 0x254a, 0x24c1, 0x27f7}; +const int nflags_code_sb[] = {0x2b0a, 0x2b05, 0x2b08, 0x2b04, 0x2b07, 0x2b06, 0x2b02, 0x2b0b, 0x2b09, 0x2b03}; + +int +mbfiler_unicode2sjis_emoji_kddi(int c, int *s1, int *s2, int *c1, int *c2, mbfl_convert_filter *filter) +{ + int i, match = 0, c1s; + + if (filter->status == 1) { + c1s = filter->cache; + filter->cache = 0; + filter->status = 0; + if (c == 0x20E3) { + if (c1s == 0x0023) { + *s1 = 0x25bc; + match = 1; + } else if (c1s == 0x0030) { + *s1 = 0x2830; + match = 1; + } else if (c1s >= 0x0031 && c1s <= 0x0039) { + *s1 = 0x27a6 + (c1s - 0x0031); + match = 1; + } + } else if ((c >= 0x1F1A5 + 0x41 && c <= 0x1F1A5 + 0x5A) && + (c1s >= 0x1F1A5 + 0x41 && c1s <= 0x1F1A5 + 0x5A)) { + for (i=0;i<10;i++) { + if (c1s == 0x1F1A5 + nflags_s[i][0] && c == 0x1F1A5 + nflags_s[i][1]) { + *s1 = nflags_code_kddi[i]; + match = 1; + break; + } + } + } else { + if (c1s >= ucs_a1_jis_table_min && c1s < ucs_a1_jis_table_max) { + c1s = ucs_a1_jis_table[c1s - ucs_a1_jis_table_min]; + CK((*filter->output_function)(c1s, filter->data)); + } + } + } else { + if (c == 0x0023 || ( c >= 0x0030 && c<=0x0039) || + (c >= 0x1F1A5 + 0x41 && c<= 0x1F1A5 + 0x5A)) { + filter->status = 1; + filter->cache = c; + *s1 = -1; + return 0; + } + + if (c == 0x00A9) { + *s1 = 0x27dc; match = 1; + } else if (c == 0x00AE) { + *s1 = 0x27dd; match = 1; + } else if (c >= mb_tbl_uni_kddi2code2_min && c <= mb_tbl_uni_kddi2code2_max) { + for (i=0; i < sizeof(mb_tbl_uni_kddi2code2_key)/sizeof(int); i++) { + if (c >0 && mb_tbl_uni_kddi2code2_key[i] == c) { + *s1 = mb_tbl_uni_kddi2code2_value[i]; + match = 1; + break; + } + } + } else if (c >= mb_tbl_uni_kddi2code3_min && c <= mb_tbl_uni_kddi2code3_max) { + for (i=0; i < sizeof(mb_tbl_uni_kddi2code3_key)/sizeof(int); i++) { + if (c >0 && mb_tbl_uni_kddi2code3_key[i] == c) { + *s1 = mb_tbl_uni_kddi2code3_value[i]; + match = 1; + break; + } + } + } + } + + if (match && *s1 >0) { + *c1 = *s1/94+0x21; + *c2 = *s1-94*(*c1-0x21)+0x21; + *s1 = (*c1 << 8) | *c2; + *s2 = 1; + } + + return 1; +} + +int +mbfiler_unicode2sjis_emoji_sb(int c, int *s1, int *s2, int *c1, int *c2, mbfl_convert_filter *filter) +{ + int i, match = 0, c1s; + + if (filter->status == 1) { + filter->status = 0; + c1s = filter->cache; + filter->cache = 0; + if (c == 0x20E3) { + if (c1s == 0x0023) { + *s1 = 0x2817; + match = 1; + } else if (c1s == 0x0030) { + *s1 = 0x282c; + match = 1; + } else if (c1s >= 0x0031 && c1s <= 0x0039) { + *s1 = 0x2823 + (c1s - 0x0031); + match = 1; + } + } else if ((c >= 0x1F1A5 + 0x41 && c <= 0x1F1A5 + 0x5A) && + (c1s >= 0x1F1A5 + 0x41 && c1s <= 0x1F1A5 + 0x5A)) { + for (i=0;i<10;i++) { + if (c1s == 0x1F1A5 + nflags_s[i][0] && c == 0x1F1A5 + nflags_s[i][1]) { + *s1 = nflags_code_sb[i]; + match = 1; + break; + } + } + } else { + if (c1s >= ucs_a1_jis_table_min && c1s < ucs_a1_jis_table_max) { + c1s = ucs_a1_jis_table[c1s - ucs_a1_jis_table_min]; + CK((*filter->output_function)(c1s, filter->data)); + } + } + } else { + if (c == 0x0023 || ( c >= 0x0030 && c<=0x0039) || + (c >= 0x1F1A5 + 0x41 && c<= 0x1F1A5 + 0x5A)) { + filter->status = 1; + filter->cache = c; + *s1 = -1; + return 0; + } + + if (c == 0x00A9) { + *s1 = 0x2855; match = 1; + } else if (c == 0x00AE) { + *s1 = 0x2856; match = 1; + } else if (c >= mb_tbl_uni_sb2code2_min && c <= mb_tbl_uni_sb2code2_max) { + for (i=0; i < sizeof(mb_tbl_uni_sb2code2_key)/sizeof(int); i++) { + if (c >0 && mb_tbl_uni_sb2code2_key[i] == c) { + *s1 = mb_tbl_uni_sb2code2_value[i]; + match = 1; + break; + } + } + } else if (c >= mb_tbl_uni_sb2code3_min && c <= mb_tbl_uni_sb2code3_max) { + for (i=0; i < sizeof(mb_tbl_uni_sb2code3_key)/sizeof(int); i++) { + if (c >0 && mb_tbl_uni_sb2code3_key[i] == c) { + *s1 = mb_tbl_uni_sb2code3_value[i]; + match = 1; + break; + } + } + } + } + + if (match && *s1 >0) { + *c1 = *s1/94+0x21; + *c2 = *s1-94*(*c1-0x21)+0x21; + *s1 = (*c1 << 8) | *c2; + *s2 = 1; + } + + return 1; +} + +/* + * SJIS-win => wchar + */ +int +mbfl_filt_conv_sjis_mobile_wchar(int c, mbfl_convert_filter *filter) +{ + int c1, s, s1, s2, w; + int snd = 0; + + switch (filter->status) { + case 0: + if (c >= 0 && c < 0x80) { /* latin */ + if ((filter->from->no_encoding == mbfl_no_encoding_sjis_sb_pua || + filter->from->no_encoding == mbfl_no_encoding_sjis_sb) && c == 0x1b) { + filter->cache = c; + filter->status = 2; + } else { + CK((*filter->output_function)(c, filter->data)); + } + } else if (c > 0xa0 && c < 0xe0) { /* kana */ + CK((*filter->output_function)(0xfec0 + c, filter->data)); + } else if (c > 0x80 && c < 0xfd && c != 0xa0) { /* kanji first char */ + filter->status = 1; + filter->cache = c; + } else { + w = c & MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + + case 1: /* kanji second char */ + filter->status = 0; + c1 = filter->cache; + if (c >= 0x40 && c <= 0xfc && c != 0x7f) { + w = 0; + SJIS_DECODE(c1, c, s1, s2); + s = (s1 - 0x21)*94 + s2 - 0x21; + if (s <= 137) { + if (s == 31) { + w = 0xff3c; /* FULLWIDTH REVERSE SOLIDUS */ + } else if (s == 32) { + w = 0xff5e; /* FULLWIDTH TILDE */ + } else if (s == 33) { + w = 0x2225; /* PARALLEL TO */ + } else if (s == 60) { + w = 0xff0d; /* FULLWIDTH HYPHEN-MINUS */ + } else if (s == 80) { + w = 0xffe0; /* FULLWIDTH CENT SIGN */ + } else if (s == 81) { + w = 0xffe1; /* FULLWIDTH POUND SIGN */ + } else if (s == 137) { + w = 0xffe2; /* FULLWIDTH NOT SIGN */ + } + } + if (w == 0) { + if (s >= cp932ext1_ucs_table_min && s < cp932ext1_ucs_table_max) { /* vendor ext1 (13ku) */ + w = cp932ext1_ucs_table[s - cp932ext1_ucs_table_min]; + } else if (s >= 0 && s < jisx0208_ucs_table_size) { /* X 0208 */ + w = jisx0208_ucs_table[s]; + } else if (s >= cp932ext2_ucs_table_min && s < cp932ext2_ucs_table_max) { /* vendor ext2 (89ku - 92ku) */ + w = cp932ext2_ucs_table[s - cp932ext2_ucs_table_min]; + } else if (s >= cp932ext3_ucs_table_min && s < cp932ext3_ucs_table_max) { /* vendor ext3 (115ku - 119ku) */ + w = cp932ext3_ucs_table[s - cp932ext3_ucs_table_min]; + } else if (s >= (94*94) && s < (114*94)) { /* user (95ku - 114ku) */ + w = s - (94*94) + 0xe000; + } + + if (s >= (94*94) && s < 119*94) { + if (filter->from->no_encoding == mbfl_no_encoding_sjis_docomo) { + w = mbfiler_sjis_emoji_docomo2unicode(s, &snd); + } else if (filter->from->no_encoding == mbfl_no_encoding_sjis_kddi) { + w = mbfiler_sjis_emoji_kddi2unicode(s, &snd); + } else if (filter->from->no_encoding == mbfl_no_encoding_sjis_sb) { + w = mbfiler_sjis_emoji_sb2unicode(s, &snd); + } else if (filter->from->no_encoding == mbfl_no_encoding_sjis_kddi_pua) { + mbfiler_sjis_emoji_kddi2unicode_pua(s, &w); + } else if (filter->from->no_encoding == mbfl_no_encoding_sjis_kddi_pua_b) { + mbfiler_sjis_emoji_kddi2unicode_pua_b(s, c1, c, &w); + } else if (filter->from->no_encoding == mbfl_no_encoding_sjis_sb_pua) { + mbfiler_sjis_emoji2unicode_pua(s, &w); + } + if (w > 0 && snd > 0) { + CK((*filter->output_function)(snd, filter->data)); + } + } + } + if (w <= 0) { + w = (s1 << 8) | s2; + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_WINCP932; + } + CK((*filter->output_function)(w, filter->data)); + } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ + CK((*filter->output_function)(c, filter->data)); + } else { + w = (c1 << 8) | c; + w &= MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + case 2: + if ((filter->from->no_encoding == mbfl_no_encoding_sjis_sb_pua || + filter->from->no_encoding == mbfl_no_encoding_sjis_sb) && + c == 0x24) { + filter->cache = c; + filter->status = 3; + } else { + filter->cache = 0; + filter->status = 0; + CK((*filter->output_function)(0x1b, filter->data)); + } + break; + + case 3: + /* Softbank Emoji: ESC $ [GEFOPQ] X 0x0f */ + if ((filter->from->no_encoding == mbfl_no_encoding_sjis_sb_pua || + filter->from->no_encoding == mbfl_no_encoding_sjis_sb) && + ((c >= 0x45 && c <= 0x47) || (c >= 0x4f && c <= 0x51))) { + filter->cache = c; + filter->status = 4; + } else { + filter->cache = 0; + filter->status = 0; + CK((*filter->output_function)(0x1b, filter->data)); + CK((*filter->output_function)(0x24, filter->data)); + } + break; + + case 4: + /* Softbank Emoji Web code: ESC $ [GEFOPQ] X 0x0f */ + w = 0; + if (filter->from->no_encoding == mbfl_no_encoding_sjis_sb_pua || + filter->from->no_encoding == mbfl_no_encoding_sjis_sb) { + c1 = filter->cache; + + if (c == 0x0f) { + w = c; + filter->cache = 0; + filter->status = 0; + } else { + if (filter->from->no_encoding == mbfl_no_encoding_sjis_sb_pua) { + if (c1 == 0x47 && c >= 0x21 && c <= 0x7a) { + w = c - 0x0021 + 0xe001; + } else if (c1 == 0x45 && c >= 0x21 && c <= 0x7a) { + w = c - 0x0021 + 0xe101; + } else if (c1 == 0x46 && c >= 0x21 && c <= 0x7a) { + w = c - 0x0021 + 0xe201; + } else if (c1 == 0x4f && c >= 0x21 && c <= 0x6d) { + w = c - 0x0021 + 0xe301; + } else if (c1 == 0x50 && c >= 0x21 && c <= 0x6c) { + w = c - 0x0021 + 0xe401; + } else if (c1 == 0x51 && c >= 0x21 && c <= 0x5e) { + w = c - 0x0021 + 0xe501; + } + } else { + if (c1 == 0x47 && c >= 0x21 && c <= 0x7a) { + s1 = 0x91; s2 = c; + } else if (c1 == 0x45 && c >= 0x21 && c <= 0x7a) { + s1 = 0x8d; s2 = c; + } else if (c1 == 0x46 && c >= 0x21 && c <= 0x7a) { + s1 = 0x8e; s2 = c; + } else if (c1 == 0x4f && c >= 0x21 && c <= 0x6d) { + s1 = 0x92; s2 = c; + } else if (c1 == 0x50 && c >= 0x21 && c <= 0x6c) { + s1 = 0x95; s2 = c; + } else if (c1 == 0x51 && c >= 0x21 && c <= 0x5e) { + s1 = 0x96; s2 = c; + } + s = (s1 - 0x21)*94 + s2 - 0x21; + w = mbfiler_sjis_emoji_sb2unicode(s, &snd); + if (w > 0 && snd > 0) { + CK((*filter->output_function)(snd, filter->data)); + } + } + if (w > 0) { + CK((*filter->output_function)(w, filter->data)); + } + } + } + + if (w <= 0) { + c1 = filter->cache; + filter->cache = 0; + filter->status = 0; + w = c & MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(0x1b, filter->data)); + CK((*filter->output_function)(0x24, filter->data)); + CK((*filter->output_function)(c1 & 0xff, filter->data)); + CK((*filter->output_function)(w, filter->data)); + } + break; + + default: + filter->status = 0; + break; + } + + return c; +} + +/* + * wchar => SJIS-win + */ +int +mbfl_filt_conv_wchar_sjis_mobile(int c, mbfl_convert_filter *filter) +{ + int c1, c2, s1, s2; + int sjis_encoded = 0; + + s1 = 0; + s2 = 0; + if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) { + s1 = ucs_a1_jis_table[c - ucs_a1_jis_table_min]; + } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) { + s1 = ucs_a2_jis_table[c - ucs_a2_jis_table_min]; + } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) { + s1 = ucs_i_jis_table[c - ucs_i_jis_table_min]; + } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) { + s1 = ucs_r_jis_table[c - ucs_r_jis_table_min]; + } else if (c >= 0xe000 && c < (0xe000 + 20*94)) { /* user (95ku - 114ku) */ + s1 = c - 0xe000; + c1 = s1/94 + 0x7f; + c2 = s1%94 + 0x21; + s1 = (c1 << 8) | c2; + s2 = 1; + } + if (s1 <= 0) { + c1 = c & ~MBFL_WCSPLANE_MASK; + if (c1 == MBFL_WCSPLANE_WINCP932) { + s1 = c & MBFL_WCSPLANE_MASK; + s2 = 1; + } else if (c1 == MBFL_WCSPLANE_JIS0208) { + s1 = c & MBFL_WCSPLANE_MASK; + } else if (c1 == MBFL_WCSPLANE_JIS0212) { + s1 = c & MBFL_WCSPLANE_MASK; + s1 |= 0x8080; + } else if (c == 0xa5) { /* YEN SIGN */ + s1 = 0x216f; /* FULLWIDTH YEN SIGN */ + } else if (c == 0x203e) { /* OVER LINE */ + s1 = 0x2131; /* FULLWIDTH MACRON */ + } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */ + s1 = 0x2140; + } else if (c == 0xff5e) { /* FULLWIDTH TILDE */ + s1 = 0x2141; + } else if (c == 0x2225) { /* PARALLEL TO */ + s1 = 0x2142; + } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */ + s1 = 0x215d; + } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */ + s1 = 0x2171; + } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */ + s1 = 0x2172; + } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */ + s1 = 0x224c; + } + } + + if ((s1 <= 0) || (s1 >= 0x8080 && s2 == 0)) { /* not found or X 0212 */ + s1 = -1; + c1 = 0; + c2 = cp932ext1_ucs_table_max - cp932ext1_ucs_table_min; + while (c1 < c2) { /* CP932 vendor ext1 (13ku) */ + if (c == cp932ext1_ucs_table[c1]) { + s1 = ((c1/94 + 0x2d) << 8) + (c1%94 + 0x21); + break; + } + c1++; + } + if (s1 <= 0) { + c1 = 0; + c2 = cp932ext2_ucs_table_max - cp932ext2_ucs_table_min; + while (c1 < c2) { /* CP932 vendor ext2 (115ku - 119ku) */ + if (c == cp932ext2_ucs_table[c1]) { + s1 = ((c1/94 + 0x93) << 8) + (c1%94 + 0x21); + break; + } + c1++; + } + } + + if (s1 <= 0) { + c1 = 0; + c2 = cp932ext3_ucs_table_max - cp932ext3_ucs_table_min; + while (c1 < c2) { /* CP932 vendor ext3 (115ku - 119ku) */ + if (c == cp932ext3_ucs_table[c1]) { + s1 = ((c1/94 + 0x93) << 8) + (c1%94 + 0x21); + break; + } + c1++; + } + } + if (c == 0) { + s1 = 0; + } else if (s1 <= 0) { + s1 = -1; + } + } + + if (filter->to->no_encoding == mbfl_no_encoding_sjis_docomo) { + mbfiler_unicode2sjis_emoji_docomo(c, &s1, &s2, &c1, &c2, filter); + } else if (filter->to->no_encoding == mbfl_no_encoding_sjis_kddi) { + mbfiler_unicode2sjis_emoji_kddi(c, &s1, &s2, &c1, &c2, filter); + } else if (filter->to->no_encoding == mbfl_no_encoding_sjis_sb) { + mbfiler_unicode2sjis_emoji_sb(c, &s1, &s2, &c1, &c2, filter); + } else if (filter->to->no_encoding == mbfl_no_encoding_sjis_kddi_pua) { + mbfiler_unicode_pua2sjis_emoji_kddi(c, &s1, &s2, &c1, &c2); + } else if (filter->to->no_encoding == mbfl_no_encoding_sjis_docomo_pua || + filter->to->no_encoding == mbfl_no_encoding_sjis_kddi_pua_b || + filter->to->no_encoding == mbfl_no_encoding_sjis_sb_pua) { + mbfiler_unicode_pua2sjis_emoji(c, &s1, &s2, &c1, &c2, &sjis_encoded); + } + + if (filter->status == 1 && filter->cache > 0) { + return c; + } + + if (s1 >= 0) { + if (s1 < 0x100) { /* latin or kana */ + CK((*filter->output_function)(s1, filter->data)); + } else { /* kanji */ + if (sjis_encoded) { + s2 = s1 & 0xff; + s1 = (s1 >> 8) & 0xff; + } else { + c1 = (s1 >> 8) & 0xff; + c2 = s1 & 0xff; + SJIS_ENCODE(c1, c2, s1, s2); + } + CK((*filter->output_function)(s1, filter->data)); + CK((*filter->output_function)(s2, filter->data)); + } + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + +static int mbfl_filt_ident_sjis_mobile(int c, mbfl_identify_filter *filter) +{ + if (filter->status) { /* kanji second char */ + if (c < 0x40 || c > 0xfc || c == 0x7f) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + } else if (c >= 0 && c < 0x80) { /* latin ok */ + ; + } else if (c > 0xa0 && c < 0xe0) { /* kana ok */ + ; + } else if (c > 0x80 && c < 0xfd && c != 0xa0) { /* kanji first char */ + filter->status = 1; + } else { /* bad */ + filter->flag = 1; + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.h b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.h new file mode 100644 index 0000000000..405577ca89 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.h @@ -0,0 +1,64 @@ +/* + * "streamable kanji code filter and converter" + * Copyright (c) 1998-2002 HappySize, Inc. All rights reserved. + * + * LICENSE NOTICES + * + * This file is part of "streamable kanji code filter and converter", + * which is distributed under the terms of GNU Lesser General Public + * License (version 2) as published by the Free Software Foundation. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with "streamable kanji code filter and converter"; + * if not, write to the Free Software Foundation, Inc., 59 Temple Place, + * Suite 330, Boston, MA 02111-1307 USA + * + * The author of this file: + * + */ +/* + * the source code included in this files was separated from mbfilter_sjis_open.c + * by Rui Hirokawa on 25 July 2011. + * + */ + +#ifndef MBFL_MBFILTER_SJIS_MOBILE_H +#define MBFL_MBFILTER_SJIS_MOBILE_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_sjis_docomo; +extern const mbfl_encoding mbfl_encoding_sjis_kddi; +extern const mbfl_encoding mbfl_encoding_sjis_sb; +extern const mbfl_encoding mbfl_encoding_sjis_docomo_pua; +extern const mbfl_encoding mbfl_encoding_sjis_kddi_pua; +extern const mbfl_encoding mbfl_encoding_sjis_kddi_pua_b; +extern const mbfl_encoding mbfl_encoding_sjis_sb_pua; + +extern const struct mbfl_identify_vtbl vtbl_identify_sjis_mobile; + +extern const struct mbfl_convert_vtbl vtbl_sjis_docomo_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_sjis_docomo; +extern const struct mbfl_convert_vtbl vtbl_sjis_kddi_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_sjis_kddi; +extern const struct mbfl_convert_vtbl vtbl_sjis_sb_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_sjis_sb; + +extern const struct mbfl_convert_vtbl vtbl_sjis_docomo_pua_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_sjis_docomo_pua; +extern const struct mbfl_convert_vtbl vtbl_sjis_kddi_pua_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_sjis_kddi_pua; +extern const struct mbfl_convert_vtbl vtbl_sjis_kddi_pua_b_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_sjis_kddi_pua_b; +extern const struct mbfl_convert_vtbl vtbl_sjis_sb_pua_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_sjis_sb_pua; + +int mbfl_filt_conv_sjis_mobile_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_sjis_mobile(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_SJIS_MOBILE_H */ diff --git a/ext/mbstring/libmbfl/filters/mk_emoji_tbl.pl b/ext/mbstring/libmbfl/filters/mk_emoji_tbl.pl new file mode 100755 index 0000000000..5b5c3d63ff --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mk_emoji_tbl.pl @@ -0,0 +1,425 @@ +#!/usr/bin/perl +# script to generate Shift_JIS encoded Emoji to/from Unicode conversion table. +# Rui Hirokawa +# +# usage: mktbl.pl EmojiSources.txt +# +# Unicoe;DoCoMo;KDDI;SoftBank + +@docomo = (); +@kddi = (); +@softbank = (); + +@to_docomo = (); +@to_kddi = (); +@to_sb = (); + +$fname = "emoji2uni.h"; +open(OUT,">$fname") or die $!; + +sub sjis2code { + my @c = unpack("C*", pack("H4", $_[0])); + + # Shift_JIS -> JIS + $c[0] = (($c[0]-($c[0]<160?112:176))<<1)-($c[1]<159?1:0); + $c[1] -= ($c[1]<159?($c[1]>127?32:31):126); + + $s = ($c[0] - 0x21)*94 + $c[1]-0x21; + + return $s; +} + +sub show_code { + my @c = @_; + $s = "\t"; + for ($i=0; $i<=$#c; $i++) {# + if ($c[$i]) { + @v = split(' ',$c[$i]); + $s .= "0x$v[0], \t"; + if ($#v > 0) { + print "$i $v[0] $v[1]\n"; + } + } else { + $s .= "0x0000, \t"; + } + if ($i % 4 == 3) { + $s .= "\n\t"; + } + } + return $s; +} + +while(<>) { + if ($_ =~ /^\d+/) { + @v = split(/;/,$_); + if ($v[1] =~ /[\dA-F]+/) { + $code = &sjis2code($v[1]); + $docomo{$code} = $v[0]; + $to_docomo{$v[0]} = $code; + } + if ($v[2] =~ /[\dA-F]+/) { + $code = &sjis2code($v[2]); + $kddi{$code} = $v[0]; + $to_kddi{$v[0]} = $code; + } + if ($v[3] =~ /[\dA-F]+/) { + $code = &sjis2code($v[3]); + $softbank{$code} = $v[0]; + $to_sb{$v[0]} = $code; + } + } +} + +print "DoCoMo\n"; + +$docomo_min = 10434; +$docomo_max = 10434+281; +@docomo_v = (); + +foreach $key (sort {hex($a) <=> hex($b)} keys(%docomo)) { + $s = $key; + $pos = $s % 94; + $ku = ($s - $pos)/94; + $v = $key - $docomo_min; + #print "$ku:$pos - ". $v ."=> $docomo{$key}\n"; + $docomo_v[$key-$docomo_min] = $docomo{$key}; +} + +$to_docomo_min = 10434; + +$to_docomo_min1 = 0x0023; +$to_docomo_max1 = 0x00AE; +$to_docomo_min2 = 0x203C; +$to_docomo_max2 = 0x3299; +$to_docomo_min3 = 0x1F17F; +$to_docomo_max3 = 0x1F6BB; + +@r_docomo1_key = (); +@r_docomo1_val = (); + +@r_docomo2_key = (); +@r_docomo2_val = (); + +@r_docomo3_key = (); +@r_docomo3_val = (); + + +foreach $key (sort {hex($a) <=> hex($b)} keys(%to_docomo)) { + $s = $to_docomo{$key}; + + $pos = $s % 94; + $ku = ($s - $pos)/94; + $v = $to_docomo{$key} - $to_docomo_min; + $h = sprintf("%x",$s); + #print "$ku:$pos = $h ($v) <= $key\n"; + if (hex($key) <= $to_docomo_max1) { + push(@r_docomo1_key, $key); + push(@r_docomo1_val, sprintf("%x", $to_docomo{$key})); + } elsif (hex($key) <= $to_docomo_max2) { + push(@r_docomo2_key, $key); + push(@r_docomo2_val, $h); + } elsif (hex($key) >= $to_docomo_max3) { + push(@r_docomo3_key, $key); + push(@r_docomo3_val, $h); + } +} + +push(@r_docomo1_key, 0x00); +push(@r_docomo1_val, 0x00); +push(@r_docomo2_key, 0x00); +push(@r_docomo2_val, 0x00); +push(@r_docomo3_key, 0x00); +push(@r_docomo3_val, 0x00); + +print OUT "int mb_tbl_code2uni_docomo_min = $docomo_min;\n"; +print OUT "int mb_tbl_code2uni_docomo_max = $docomo_max;\n\n"; + +print OUT "int mb_tbl_code2uni_docomo[] = {\n"; +print OUT &show_code(@docomo_v); +print OUT "};\n\n"; + +print OUT "int mb_tbl_uni_docomo2code_min1 = $to_docomo_min1;\n"; +print OUT "int mb_tbl_uni_docomo2code_max1 = $to_docomo_max1;\n"; +print OUT "int mb_tbl_uni_docomo2code_min2 = $to_docomo_min2;\n"; +print OUT "int mb_tbl_uni_docomo2code_max2 = $to_docomo_max2;\n"; +print OUT "int mb_tbl_uni_docomo2code_min3 = $to_docomo_min3;\n"; +print OUT "int mb_tbl_uni_docomo2code_max3 = $to_docomo_max3;\n\n"; + +#print "DOCOMO reverse 1\n"; + +print OUT "int mb_tbl_uni_docomo2code_key1[] = {\n"; +print OUT &show_code(@r_docomo1_key),"\n"; +print OUT "};\n\n"; +print OUT "int mb_tbl_uni_docomo2code_val1[] = {\n"; +print OUT &show_code(@r_docomo1_val),"\n"; +print OUT "};\n\n"; + +#print "DOCOMO reverse 2\n"; + +print OUT "int mb_tbl_uni_docomo2code_key2[] = {\n"; +print OUT &show_code(@r_docomo2_key),"\n"; +print OUT "};\n\n"; +print OUT "int mb_tbl_uni_docomo2code_val2[] = {\n"; +print OUT &show_code(@r_docomo2_val),"\n"; +print OUT "};\n\n"; + +print "DOCOMO reverse 3\n"; + +print OUT "int mb_tbl_uni_docomo2code_key3[] = {\n"; +print OUT &show_code(@r_docomo3_key),"\n"; +print OUT "};\n\n"; +print OUT "int mb_tbl_uni_docomo2code_val3[] = {\n"; +print OUT &show_code(@r_docomo3_val),"\n"; +print OUT "};\n\n"; + +#print "DOCOMO reverse end \n"; + +$kddi_min1 = 9400; +$kddi_max1 = 9400+264; +$kddi_min2 = 9400+564; +$kddi_max2 = 9400+939; + +@kddi_v1 = (); +@kddi_v2 = (); + +#print "KDDI\n"; + +foreach $key (sort {hex($a) <=> hex($b)} keys(%kddi)) { + $s = $key; + $pos = $s % 94; + $ku = ($s - $pos)/94; + $v = $key - $kddi_min1; + $h = sprintf("%x",$key); + #print "$ku:$pos :: $v ($h) => $kddi{$key}\n"; + + if ($key <= $kddi_max1) { + $kddi_v1[$key-$kddi_min1] = $kddi{$key}; + } elsif ($key <= $kddi_max2) { + $kddi_v2[$key-$kddi_min2] = $kddi{$key}; + } +} + +$to_kddi_min = 9660; +$to_kddi_min1 = 0x0030; +$to_kddi_max1 = 0x00AE; +$to_kddi_min2 = 0x2002; +$to_kddi_max2 = 0x3299; +$to_kddi_min3 = 0x1F004; +$to_kddi_max3 = 0x1F6C0; + +@r_kddi1_key = (); @r_kddi1_val = (); +@r_kddi2_key = (); @r_kddi2_val = (); +@r_kddi3_key = (); @r_kddi3_val = (); + +foreach $key (sort {hex($a) <=> hex($b)} keys(%to_kddi)) { + $s = $to_kddi{$key}; + + $pos = $s % 94; + $ku = ($s - $pos)/94; + $v = $to_kddi{$key} - $to_kddi_min; + $h = sprintf("%x",$s); + #print "$ku:$pos = $h ($v) <= $key\n"; + if (hex($key) <= $to_kddi_max1) { + push(@r_kddi1_key, $key); + push(@r_kddi1_val, $h); + } elsif (hex($key) <= $to_kddi_max2) { + push(@r_kddi2_key, $key); + push(@r_kddi2_val, $h); + } else { + push(@r_kddi3_key, $key); + push(@r_kddi3_val, $h); + } +} + +push(@r_kddi1_key, 0x00); +push(@r_kddi1_val, 0x00); +push(@r_kddi2_key, 0x00); +push(@r_kddi2_val, 0x00); +push(@r_kddi3_key, 0x00); +push(@r_kddi3_val, 0x00); + +print OUT "int mb_tbl_code2uni_kddi1_min = $kddi_min1;\n"; +print OUT "int mb_tbl_code2uni_kddi1_max = $kddi_max1;\n"; +print OUT "int mb_tbl_code2uni_kddi2_min = $kddi_min2;\n"; +print OUT "int mb_tbl_code2uni_kddi2_max = $kddi_max2;\n\n"; + +#print "KDDI 1\n"; + +print OUT "int mb_tbl_code2uni_kddi1[] = {\n"; +print OUT &show_code(@kddi_v1); +print OUT "};\n\n"; + +#print "KDDI 2\n"; + +print OUT "int mb_tbl_code2uni_kddi2[] = {\n"; +print OUT &show_code(@kddi_v2); +print OUT "};\n\n"; + +print OUT "int mb_tbl_uni_kddi2code_min1 = $to_kddi_min1;\n"; +print OUT "int mb_tbl_uni_kddi2code_max1 = $to_kddi_max1;\n"; +print OUT "int mb_tbl_uni_kddi2code_min2 = $to_kddi_min2;\n"; +print OUT "int mb_tbl_uni_kddi2code_max2 = $to_kddi_max2;\n"; +print OUT "int mb_tbl_uni_kddi2code_min3 = $to_kddi_min3;\n"; +print OUT "int mb_tbl_uni_kddi2code_max3 = $to_kddi_max3;\n\n"; + +#print "KDDI reverse 1\n"; + +print OUT "int mb_tbl_uni_kddi2code_key1[] = {\n"; +print OUT &show_code(@r_kddi1_key),"\n"; +print OUT "};\n\n"; +print OUT "int mb_tbl_uni_kddi2code_val1[] = {\n"; +print OUT &show_code(@r_kddi1_val),"\n"; +print OUT "};\n\n"; + +#print "KDDI reverse 1\n"; + +print OUT "int mb_tbl_uni_kddi2code_key2[] = {\n"; +print OUT &show_code(@r_kddi2_key),"\n"; +print OUT "};\n\n"; +print OUT "int mb_tbl_uni_kddi2code_val2[] = {\n"; +print OUT &show_code(@r_kddi2_val),"\n"; +print OUT "};\n\n"; + +#print "KDDI reverse 3\n"; + +print OUT "int mb_tbl_uni_kddi2code_key3[] = {\n"; +print OUT &show_code(@r_kddi3_key),"\n"; +print OUT "};\n\n"; +print OUT "int mb_tbl_uni_kddi2code_val3[] = {\n"; +print OUT &show_code(@r_kddi3_val),"\n"; +print OUT "};\n\n"; + + +$sb_min1 = 10153; +$sb_max1 = 10153+177; +$sb_min2 = 10153+376; +$sb_max2 = 10153+547; +$sb_min3 = 10153+752; +$sb_max3 = 10153+901; + +@sb_v1 = (); +@sb_v2 = (); +@sb_v3 = (); + +if (1) { + print "SoftBank\n"; + + foreach $key (sort {hex($a) <=> hex($b)} keys(%softbank)) { + $s = $key; + $pos = $s % 94; + $ku = ($s - $pos)/94; + $v = $key - $sb_min1; + $h = sprintf("%x",$key); + #print "$ku:$pos :: $v ($h) => $softbank{$key}\n"; + if ($key <= $sb_max1) { + $sb_v1[$key-$sb_min1] = $softbank{$key}; + } elsif ($key <= $sb_max2) { + $sb_v2[$key-$sb_min2] = $softbank{$key}; + } elsif ($key <= $sb_max3) { + $sb_v3[$key-$sb_min3] = $softbank{$key}; + } + } + +} + +$to_sb_min = 10263; +$to_sb_min1 = 0x0023; +$to_sb_max1 = 0x00AE; +$to_sb_min2 = 0x2122; +$to_sb_max2 = 0x3299; +$to_sb_min3 = 0x1F004; +$to_sb_max3 = 0x1F6C0; + +@r_sb1_key = (); @r_sb1_val = (); +@r_sb2_key = (); @r_sb2_val = (); +@r_sb3_key = (); @r_sb3_val = (); + +foreach $key (sort {hex($a) <=> hex($b)} keys(%to_sb)) { + $s = $to_sb{$key}; + + $pos = $s % 94; + $ku = ($s - $pos)/94; + $v = $to_sb{$key} - $to_sb_min; + $h = sprintf("%x",$s); + #print "$ku:$pos = $h ($v) <= $key\n"; + if (hex($key) <= $to_sb_max1) { + push(@r_sb1_key, $key); + push(@r_sb1_val, $h); + } elsif (hex($key) >= $to_sb_min2 && hex($key) <= $to_sb_max2) { + push(@r_sb2_key, $key); + push(@r_sb2_val, $h); + } else { + push(@r_sb3_key, $key); + push(@r_sb3_val, $h); + } +} + +push(@r_sb1_key, 0x00); +push(@r_sb1_val, 0x00); +push(@r_sb2_key, 0x00); +push(@r_sb2_val, 0x00); +push(@r_sb3_key, 0x00); +push(@r_sb3_val, 0x00); + + +print OUT "int mb_tbl_code2uni_sb1_min = $sb_min1;\n"; +print OUT "int mb_tbl_code2uni_sb1_max = $sb_max1;\n"; +print OUT "int mb_tbl_code2uni_sb2_min = $sb_min2;\n"; +print OUT "int mb_tbl_code2uni_sb2_max = $sb_max2;\n"; +print OUT "int mb_tbl_code2uni_sb3_min = $sb_min3;\n"; +print OUT "int mb_tbl_code2uni_sb3_max = $sb_max3;\n\n"; + +#print "SoftBank 1\n"; + +print OUT "int mb_tbl_code2uni_sb1[] = {\n"; +print OUT &show_code(@sb_v1); +print OUT "};\n\n"; + +#print "SoftBank 2\n"; + +print OUT "int mb_tbl_code2uni_sb2[] = {\n"; +print OUT &show_code(@sb_v2); +print OUT "};\n\n"; + +#print "SoftBank 3\n"; + +print OUT "int mb_tbl_code2uni_sb3[] = {\n"; +print OUT &show_code(@sb_v3); +print OUT "};\n\n"; + +print OUT "int mb_tbl_uni_sb2code_min1 = $to_sb_min1;\n"; +print OUT "int mb_tbl_uni_sb2code_max1 = $to_sb_max1;\n"; +print OUT "int mb_tbl_uni_sb2code_min2 = $to_sb_min2;\n"; +print OUT "int mb_tbl_uni_sb2code_max2 = $to_sb_max2;\n"; +print OUT "int mb_tbl_uni_sb2code_min3 = $to_sb_min3;\n"; +print OUT "int mb_tbl_uni_sb2code_max3 = $to_sb_max3;\n\n"; + +#print "SB reverse 1\n"; + +print OUT "int mb_tbl_uni_sb2code_key1[] = {\n"; +print OUT &show_code(@r_sb1_key),"\n"; +print OUT "};\n\n"; +print OUT "int mb_tbl_uni_sb2code_val1[] = {\n"; +print OUT &show_code(@r_sb1_val),"\n"; +print OUT "};\n\n"; + +#print "SB reverse 2\n"; + +print OUT "int mb_tbl_uni_sb2code_key2[] = {\n"; +print OUT &show_code(@r_sb2_key),"\n"; +print OUT "};\n\n"; +print OUT "int mb_tbl_uni_sb2code_val2[] = {\n"; +print OUT &show_code(@r_sb2_val),"\n"; +print OUT "};\n\n"; + +#print "SB reverse 3\n"; + +print OUT "int mb_tbl_uni_sb2code_key3[] = {\n"; +print OUT &show_code(@r_sb3_key),"\n"; +print OUT "};\n\n"; +print OUT "int mb_tbl_uni_sb2code_val3[] = {\n"; +print OUT &show_code(@r_sb3_val),"\n"; +print OUT "};\n\n"; + + +close(OUT); diff --git a/ext/mbstring/libmbfl/filters/sjis_mac2uni.h b/ext/mbstring/libmbfl/filters/sjis_mac2uni.h new file mode 100644 index 0000000000..cbfdf311da --- /dev/null +++ b/ext/mbstring/libmbfl/filters/sjis_mac2uni.h @@ -0,0 +1,214 @@ +const int sjis_mac2wchar1[] = { // 0x03ac - 0x03c9 +0x0339c, 0x0339f, 0x0339d, 0x033a0, +0x033a4, 0x4ff4d, 0x033a1, 0x033a5, +0x0339e, 0x033a2, 0x0338e, 0x4ff47, +0x0338f, 0x033c4, 0x03396, 0x03397, +0x02113, 0x03398, 0x033b3, 0x033b2, +0x033b1, 0x033b0, 0x02109, 0x033d4, +0x033cb, 0x03390, 0x03385, 0x03386, +0x03387, 0xff860, }; +const int sjis_mac2wchar2[] = { // 0x0406 - 0x0420 +0x02116, 0x033cd, +0x02121, 0xff861, 0x02664, 0x02667, +0x02661, 0x02662, 0x02660, 0x02663, +0x02665, 0x02666, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x03020, 0x0260e, +0x03004, }; +const int sjis_mac2wchar3[] = { // 0x0432 - 0x0441 +0x0261e, 0x0261c, +0x0261d, 0x0261f, 0x021c6, 0x021c4, +0x021c5, 0xff860, 0x021e8, 0x021e6, +0x021e7, 0x021e9, 0x121e8, 0x121e6, +0x121e7, 0x121e9, }; +const int sjis_mac2wchar4[] = { // 0x0468 - 0x0480 +0x03230, 0x0322a, 0x0322b, 0x0322c, +0x0322d, 0x0322e, 0x0322f, 0x03240, +0x03237, 0x03242, 0x03243, 0x03239, +0x0323a, 0x03231, 0x0323e, 0x03234, +0x03232, 0x0323b, 0x03236, 0x03233, +0x03235, 0x0323c, 0x0323d, 0x0323f, +0x03238, }; +const int sjis_mac2wchar5[] = { // 0x04b8 - 0x04e8 +0x85927, 0x85c0f, 0x032a4, 0x032a5, +0x032a6, 0x032a7, 0x032a8, 0x032a9, +0x03296, 0x0329d, 0x03298, 0x0329e, +0x863a7, 0x03299, 0x03349, 0x03322, +0x0334d, 0x03314, 0x03316, 0x03305, +0x03333, 0x0334e, 0x03303, 0x03336, +0x03318, 0x03315, 0x03327, 0x03351, +0x0334a, 0x03339, 0x03357, 0x0330d, +0x03342, 0x03323, 0x03326, 0x0333b, +0x0332b, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x03300, 0x0331e, 0x0332a, 0x03331, +0x03347, }; +const int sjis_mac2wchar6[] = { // 0x050c - 0x0551 +0x0337e, 0x0337d, 0x0337c, 0x0337b, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x0337f, 0xff862, 0xff862, +0x0222e, 0x0221f, 0x022bf, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x0301d, 0x0301f, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x03094, 0x00000, 0x030f7, 0x030f8, +0x030f9, 0x030fa, }; +const int sjis_mac2wchar7[] = { // 0x1ed9 - 0x1f18 +0x23001, 0x23002, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x2ffe3, 0x0fe33, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x230fc, +0x0fe31, 0x22010, 0x00000, 0x00000, +0x2301c, 0x22016, 0x2ff5c, 0x22026, +0x0fe30, 0x00000, 0x00000, 0x00000, +0x00000, 0x0fe35, 0x0fe36, 0x0fe39, +0x0fe3a, 0x2ff3b, 0x2ff3d, 0x0fe37, +0x0fe38, 0x0fe3f, 0x0fe40, 0x0fe3d, +0x0fe3e, 0x0fe41, 0x0fe42, 0x0fe43, +0x0fe44, 0x0fe3b, 0x0fe3c, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x2ff1d, }; +const int sjis_mac2wchar8[] = { // 0x1ff2 - 0x20a5 +0x23041, 0x00000, +0x23043, 0x00000, 0x23045, 0x00000, +0x23047, 0x00000, 0x23049, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x23063, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x23083, 0x00000, 0x23085, 0x00000, +0x23087, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x2308e, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x230a1, 0x00000, 0x230a3, 0x00000, +0x230a5, 0x00000, 0x230a7, 0x00000, +0x230a9, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x230c3, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x00000, 0x230e3, 0x00000, +0x230e5, 0x00000, 0x230e7, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x00000, 0x230ee, 0x00000, 0x00000, +0x00000, 0x00000, 0x00000, 0x00000, +0x230f5, 0x230f6, }; + +const int wchar2sjis_mac4[] = { // 0x2660 - 0x2667 +0x040e, 0x040c, 0x040d, 0x040f, +0x040a, 0x0410, 0x0411, 0x040b, +}; + +const int wchar2sjis_mac7[] = { // 0x322a - 0x3243 +0x0469, 0x046a, +0x046b, 0x046c, 0x046d, 0x046e, +0x0468, 0x0475, 0x0478, 0x047b, +0x0477, 0x047c, 0x047a, 0x0470, +0x0480, 0x0473, 0x0474, 0x0479, +0x047d, 0x047e, 0x0476, 0x047f, +0x046f, 0x0000, 0x0471, 0x0472, +}; + +const int wchar2sjis_mac8[] = { // 0x3296 - 0x329e +0x04c0, 0x0000, +0x04c2, 0x04c5, 0x0000, 0x0000, +0x0000, 0x04c1, 0x04c3, }; + +const int wchar2sjis_mac9[] = { // 0x3300 - 0x33d4 +0x04e4, 0x0000, 0x0000, 0x04ce, +0x0000, 0x04cb, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x04d7, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x04c9, 0x04d1, 0x04ca, 0x0000, +0x04d0, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x04e5, 0x0000, +0x0000, 0x0000, 0x04c7, 0x04d9, +0x0000, 0x0000, 0x04da, 0x04d2, +0x0000, 0x0000, 0x04e6, 0x04dc, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x04e7, 0x0000, 0x04cc, +0x0000, 0x0000, 0x04cf, 0x0000, +0x0000, 0x04d5, 0x0000, 0x04db, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x04d8, 0x0000, +0x0000, 0x0000, 0x0000, 0x04e8, +0x0000, 0x04c6, 0x04d4, 0x0000, +0x0000, 0x04c8, 0x04cd, 0x0000, +0x0000, 0x04d3, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x04d6, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x050f, +0x050e, 0x050d, 0x050c, 0x0521, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x03c6, 0x03c7, 0x03c8, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x03b6, 0x03b8, +0x03c5, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x03ba, 0x03bb, +0x03bd, 0x0000, 0x0000, 0x0000, +0x03ac, 0x03ae, 0x03b4, 0x03ad, +0x03af, 0x03b2, 0x03b5, 0x0000, +0x03b0, 0x03b3, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x03c1, 0x03c0, 0x03bf, 0x03be, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x03b9, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x03c4, +0x0000, 0x0407, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, +0x03c3, }; + +const int wchar2sjis_mac10[] = { // 0xfe30 - 0xfe44 +0x1efc, 0x1ef4, 0x0000, 0x1ee9, +0x0000, 0x1f01, 0x1f02, 0x1f07, +0x1f08, 0x1f03, 0x1f04, 0x1f11, +0x1f12, 0x1f0b, 0x1f0c, 0x1f09, +0x1f0a, 0x1f0d, 0x1f0e, 0x1f0f, +0x1f10, }; diff --git a/ext/mbstring/libmbfl/mbfl/eaw_table.h b/ext/mbstring/libmbfl/mbfl/eaw_table.h index a4f1e4fdf1..af310ea1d8 100644 --- a/ext/mbstring/libmbfl/mbfl/eaw_table.h +++ b/ext/mbstring/libmbfl/mbfl/eaw_table.h @@ -2,8 +2,9 @@ static const struct { int begin; int end; } mbfl_eaw_table[] = { - { 0x1100, 0x1159 }, - { 0x115f, 0x115f }, + { 0x1100, 0x115f }, + { 0x11a3, 0x11a7 }, + { 0x11fa, 0x11ff }, { 0x2329, 0x232a }, { 0x2e80, 0x2e99 }, { 0x2e9b, 0x2ef3 }, @@ -12,25 +13,32 @@ static const struct { { 0x3000, 0x303e }, { 0x3041, 0x3096 }, { 0x3099, 0x30ff }, - { 0x3105, 0x312c }, + { 0x3105, 0x312d }, { 0x3131, 0x318e }, - { 0x3190, 0x31b7 }, + { 0x3190, 0x31ba }, + { 0x31c0, 0x31e3 }, { 0x31f0, 0x321e }, - { 0x3220, 0x3243 }, - { 0x3250, 0x327d }, - { 0x327f, 0x32fe }, - { 0x3300, 0x4db5 }, - { 0x4e00, 0x9fa5 }, - { 0xa000, 0xa48c }, + { 0x3220, 0x3247 }, + { 0x3250, 0x32fe }, + { 0x3300, 0x4dbf }, + { 0x4e00, 0xa48c }, { 0xa490, 0xa4c6 }, + { 0xa960, 0xa97c }, { 0xac00, 0xd7a3 }, - { 0xf900, 0xfa2d }, - { 0xfa30, 0xfa6a }, + { 0xd7b0, 0xd7c6 }, + { 0xd7cb, 0xd7fb }, + { 0xf900, 0xfaff }, + { 0xfe10, 0xfe19 }, { 0xfe30, 0xfe52 }, { 0xfe54, 0xfe66 }, { 0xfe68, 0xfe6b }, { 0xff01, 0xff60 }, { 0xffe0, 0xffe6 }, + { 0x1b000, 0x1b001 }, + { 0x1f200, 0x1f202 }, + { 0x1f210, 0x1f23a }, + { 0x1f240, 0x1f248 }, + { 0x1f250, 0x1f251 }, { 0x20000, 0x2fffd }, { 0x30000, 0x3fffd } }; diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter.h b/ext/mbstring/libmbfl/mbfl/mbfilter.h index 8e073c94d2..4db78d01f5 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfilter.h +++ b/ext/mbstring/libmbfl/mbfl/mbfilter.h @@ -102,7 +102,7 @@ * version information */ #define MBFL_VERSION_MAJOR 1 -#define MBFL_VERSION_MINOR 1 +#define MBFL_VERSION_MINOR 3 #define MBFL_VERSION_TEENY 0 /* diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_convert.c b/ext/mbstring/libmbfl/mbfl/mbfl_convert.c index d81b533dd1..776ff986eb 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_convert.c +++ b/ext/mbstring/libmbfl/mbfl/mbfl_convert.c @@ -52,6 +52,8 @@ #include "filters/mbfilter_iso2022_kr.h" #include "filters/mbfilter_sjis.h" #include "filters/mbfilter_sjis_open.h" +#include "filters/mbfilter_sjis_mobile.h" +#include "filters/mbfilter_sjis_mac.h" #include "filters/mbfilter_cp51932.h" #include "filters/mbfilter_jis.h" #include "filters/mbfilter_iso2022_jp_ms.h" @@ -125,6 +127,22 @@ const struct mbfl_convert_vtbl *mbfl_convert_filter_list[] = { &vtbl_wchar_eucjpwin, &vtbl_cp932_wchar, &vtbl_wchar_cp932, + &vtbl_sjis_docomo_wchar, + &vtbl_wchar_sjis_docomo, + &vtbl_sjis_kddi_wchar, + &vtbl_wchar_sjis_kddi, + &vtbl_sjis_sb_wchar, + &vtbl_wchar_sjis_sb, + &vtbl_sjis_docomo_pua_wchar, + &vtbl_wchar_sjis_docomo_pua, + &vtbl_sjis_kddi_pua_wchar, + &vtbl_wchar_sjis_kddi_pua, + &vtbl_sjis_kddi_pua_b_wchar, + &vtbl_wchar_sjis_kddi_pua_b, + &vtbl_sjis_sb_pua_wchar, + &vtbl_wchar_sjis_sb_pua, + &vtbl_sjis_mac_wchar, + &vtbl_wchar_sjis_mac, &vtbl_euccn_wchar, &vtbl_wchar_euccn, &vtbl_cp936_wchar, diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_encoding.c b/ext/mbstring/libmbfl/mbfl/mbfl_encoding.c index 17955b2c9a..c91ffa0622 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_encoding.c +++ b/ext/mbstring/libmbfl/mbfl/mbfl_encoding.c @@ -58,6 +58,8 @@ #include "filters/mbfilter_iso2022_kr.h" #include "filters/mbfilter_sjis.h" #include "filters/mbfilter_sjis_open.h" +#include "filters/mbfilter_sjis_mobile.h" +#include "filters/mbfilter_sjis_mac.h" #include "filters/mbfilter_cp51932.h" #include "filters/mbfilter_jis.h" #include "filters/mbfilter_iso2022_jp_ms.h" @@ -156,6 +158,14 @@ static const mbfl_encoding *mbfl_encoding_ptr_list[] = { &mbfl_encoding_sjis, &mbfl_encoding_eucjp_win, &mbfl_encoding_sjis_open, + &mbfl_encoding_sjis_docomo, + &mbfl_encoding_sjis_kddi, + &mbfl_encoding_sjis_sb, + &mbfl_encoding_sjis_docomo_pua, + &mbfl_encoding_sjis_kddi_pua, + &mbfl_encoding_sjis_kddi_pua_b, + &mbfl_encoding_sjis_sb_pua, + &mbfl_encoding_sjis_mac, &mbfl_encoding_cp932, &mbfl_encoding_cp51932, &mbfl_encoding_jis, diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_encoding.h b/ext/mbstring/libmbfl/mbfl/mbfl_encoding.h index fd3a66df6e..9c152ef7af 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_encoding.h +++ b/ext/mbstring/libmbfl/mbfl/mbfl_encoding.h @@ -69,6 +69,14 @@ enum mbfl_no_encoding { mbfl_no_encoding_sjis, mbfl_no_encoding_eucjp_win, mbfl_no_encoding_sjis_open, + mbfl_no_encoding_sjis_docomo, + mbfl_no_encoding_sjis_kddi, + mbfl_no_encoding_sjis_sb, + mbfl_no_encoding_sjis_docomo_pua, + mbfl_no_encoding_sjis_kddi_pua, + mbfl_no_encoding_sjis_kddi_pua_b, + mbfl_no_encoding_sjis_sb_pua, + mbfl_no_encoding_sjis_mac, mbfl_no_encoding_cp932, mbfl_no_encoding_cp51932, mbfl_no_encoding_jis, diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_ident.c b/ext/mbstring/libmbfl/mbfl/mbfl_ident.c index 0d61169af3..21dd898060 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_ident.c +++ b/ext/mbstring/libmbfl/mbfl/mbfl_ident.c @@ -51,6 +51,7 @@ #include "filters/mbfilter_iso2022_kr.h" #include "filters/mbfilter_sjis.h" #include "filters/mbfilter_sjis_open.h" +#include "filters/mbfilter_sjis_mobile.h" #include "filters/mbfilter_jis.h" #include "filters/mbfilter_iso2022_jp_ms.h" #include "filters/mbfilter_euc_jp.h" diff --git a/ext/mbstring/libmbfl/mbfl/mk_eaw_tbl.awk b/ext/mbstring/libmbfl/mbfl/mk_eaw_tbl.awk index c7deb4cdf5..02c73f2025 100644 --- a/ext/mbstring/libmbfl/mbfl/mk_eaw_tbl.awk +++ b/ext/mbstring/libmbfl/mbfl/mk_eaw_tbl.awk @@ -18,7 +18,8 @@ BEGIN { /^[0-9a-fA-F]+;/ { if ($2 == "W" || $2 == "F") { - v = ( "0x" $1 ) + 0 + + v = strtonum( "0x" $1 ) if (prev < 0) { first = v } else if (v - prev > 1) { @@ -44,8 +45,8 @@ BEGIN { /^[0-9a-fA-F]+\.\./ { if ($4 == "W" || $4 == "F") { - vs = ( "0x" $1 ) + 0 - ve = ( "0x" $3 ) + 0 + vs = strtonum( "0x" $1 ) + ve = strtonum( "0x" $3 ) if (prev < 0) { first = vs } else if (vs - prev > 1) { diff --git a/ext/mbstring/libmbfl/tests/emoji.c b/ext/mbstring/libmbfl/tests/emoji.c new file mode 100644 index 0000000000..4f6a346576 --- /dev/null +++ b/ext/mbstring/libmbfl/tests/emoji.c @@ -0,0 +1,119 @@ +/** + * this is a small sample script to use libmbfl. + * Rui Hirokawa + * + * this file is encoded in EUC-JP. + */ + +#include +#include +#include +#include "mbfl/mbfilter.h" + +static void hexdump(const mbfl_string *ptr) +{ + unsigned int i; + + for (i = 0; i < ptr->len; i++) { + printf("%%%02x", ptr->val[i]); + } + + printf(" (%u)\n", ptr->len); +} + +//#define TEST_DOCOMO +//#define TEST_KDDI +#define TEST_SOFTBANK + +int main(int argc, char **argv) +{ + enum mbfl_no_encoding from_encoding, to_encoding; + enum mbfl_no_language no_language; + mbfl_buffer_converter *convd = NULL, *convd2 = NULL; + mbfl_memory_device dev, dev2; + mbfl_string string, result, *ret; +#ifdef TEST_DOCOMO + //char str[] = {0xF9,0xD7,0x00}; // U+2122 + //char str[] = {0xF9,0x82,0x00}; // U+1F195 + char str[] = {0xF9,0xD6,0x00}; // U+00A9 +#endif +#ifdef TEST_KDDI + //char str[] = {0xF7,0x6A,0x00};// U+2122 + //char str[] = {0xF7,0xE5,0x00}; // U+1F195 + //char str[] = {0xF3,0xD2,0x00}; // U+1F1E8 U+1F1F3 + char str[] = {0xF7,0x74,0x00}; // U+00A9 +#endif +#ifdef TEST_SOFTBANK + //char str[] = {0xFB,0xD7,0x00};// U+2122 + //char str[] = {0xF7,0xB2,0x00}; // U+1F195 + //char str[] = {0xFB,0xB3,0x00}; // U+1F1E8 U+1F1F3 + char str[] = {0xF7,0xEE,0x00}; // U+00A9 +#endif + int final = 0; + int state = 0; + int i; + + no_language = mbfl_name2no_language("Japanese"); +#ifdef TEST_DOCOMO + from_encoding = mbfl_name2no_encoding("SJIS-win#DOCOMO"); +#endif +#ifdef TEST_KDDI + from_encoding = mbfl_name2no_encoding("SJIS-win#KDDI"); +#endif +#ifdef TEST_SOFTBANK + from_encoding = mbfl_name2no_encoding("SJIS-win#SOFTBANK"); +#endif + to_encoding = mbfl_name2no_encoding("UTF-8"); + + convd = mbfl_buffer_converter_new(from_encoding, to_encoding, 0); + + mbfl_memory_device_init(&dev, 0, 4096); + mbfl_string_init_set(&string, no_language, from_encoding); + mbfl_memory_device_realloc(&dev, dev.length + dev.allocsz, dev.allocsz); + + strcpy(dev.buffer, str); + dev.pos += strlen(str); + + mbfl_memory_device_result(&dev, &string); + mbfl_string_init_set(&result, no_language, to_encoding); + ret = mbfl_buffer_converter_feed_result(convd, &string, &result); + +#if 0 + for (i = 0; i < result.len; i+= 2) { + if (result.val[i] >= 0xD8 && result.val[i] < 0xE0) { // Surrogate pair + int h = (result.val[i] & 0x07)<<8 | result.val[i+1]; + int l = (result.val[i+2] & 0x03)<<8 | result.val[i+3]; + int c = (h<<(2+8)) | l; + printf("U+%x\n",c+0x10000); + i+=2; + } else { + printf("U+%x\n",(result.val[i] << 8) | result.val[i+1]); + } + } + hexdump(&result); +#endif + + +#if 1 + convd2 = mbfl_buffer_converter_new(to_encoding, from_encoding, 0); + mbfl_memory_device_init(&dev2, 0, 4096); + mbfl_string_init_set(&string, no_language, to_encoding); + mbfl_memory_device_realloc(&dev2, dev2.length + dev2.allocsz, dev2.allocsz); + + memcpy(dev2.buffer, result.val, result.len+1); + dev2.pos += strlen(dev2.buffer); + + mbfl_memory_device_result(&dev2, &string); + mbfl_string_init_set(&result, no_language, from_encoding); + ret = mbfl_buffer_converter_feed_result(convd2, &string, &result); + hexdump(&result); + mbfl_buffer_converter_delete(convd2); +#endif + mbfl_string_clear(&result); + mbfl_string_clear(&string); + + mbfl_buffer_converter_delete(convd); + + + return EXIT_SUCCESS; +} diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 1600f97252..accbe2a208 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -1681,7 +1681,12 @@ PHP_MINFO_FUNCTION(mbstring) php_info_print_table_start(); php_info_print_table_row(2, "Multibyte Support", "enabled"); php_info_print_table_row(2, "Multibyte string engine", "libmbfl"); - php_info_print_table_row(2, "HTTP input encoding translation", MBSTRG(encoding_translation) ? "enabled": "disabled"); + php_info_print_table_row(2, "HTTP input encoding translation", MBSTRG(encoding_translation) ? "enabled": "disabled"); + { + char tmp[256]; + snprintf(tmp, sizeof(tmp), "%d.%d.%d", MBFL_VERSION_MAJOR, MBFL_VERSION_MINOR, MBFL_VERSION_TEENY); + php_info_print_table_row(2, "libmbfl version", tmp); + } php_info_print_table_end(); php_info_print_table_start(); -- 2.40.0