diff options
235 files changed, 45634 insertions, 24071 deletions
diff --git a/ext/mbstring/README.libmbfl b/ext/mbstring/README.libmbfl new file mode 100644 index 0000000000..4f1174e2f7 --- /dev/null +++ b/ext/mbstring/README.libmbfl @@ -0,0 +1,16 @@ + +libmbfl is a streamable multibyte character code filter and +converter library. +libmbfl is distributed under LGPL 2.1 and bundled with PHP. + +The original version of libmbfl is developed and distributed +at http://sourceforge.jp/project/php-i18n/ . + +If you need to modify the bundled libmbfl, the change also have to be applied for +the libmbfl on sourceforge.jp. + +If you have question about libmbfl, please ask to + hirokawa@php.net, moriyoshi@php.net. + +See libmbfl/DISCLAIMER for licensing information of libmbfl. + diff --git a/ext/mbstring/config.m4 b/ext/mbstring/config.m4 index af99d893e1..1639da8578 100644 --- a/ext/mbstring/config.m4 +++ b/ext/mbstring/config.m4 @@ -2,41 +2,194 @@ dnl dnl $Id$ dnl -PHP_ARG_ENABLE(mbstring, whether to enable multibyte string support, -[ --enable-mbstring Enable multibyte string support]) +AC_DEFUN([PHP_MBSTRING_INIT], [ + PHP_MBSTRING_SOURCES="" + PHP_MBSTRING_EXTRA_BUILD_DIRS="" + PHP_MBSTRING_EXTRA_CONFIG_HEADERS="" + PHP_MBSTRING="" + PHP_MBREGEX="" + PHP_MBSTRING_CFLAGS="" +]) -if test "$PHP_MBSTRING" != "no"; then - AC_DEFINE(HAVE_MBSTRING,1,[whether to have multibyte string support]) +AC_DEFUN([PHP_MBSTRING_ADD_SOURCES], [ + PHP_MBSTRING_SOURCES="$PHP_MBSTRING_SOURCES $1" +]) - if test "$PHP_MBSTRING" != "no" -o "$PHP_MBSTRING" = "ja"; then - AC_DEFINE(HAVE_MBSTR_JA,1,[whether to have japanese support]) - fi - if test "$PHP_MBSTRING" = "cn"; then - AC_DEFINE(HAVE_MBSTR_CN,1,[whether to have simplified chinese support]) - fi - if test "$PHP_MBSTRING" = "tw"; then - AC_DEFINE(HAVE_MBSTR_TW,1,[whether to have traditional chinese support]) - fi - if test "$PHP_MBSTRING" = "kr"; then - AC_DEFINE(HAVE_MBSTR_KR,1,[whether to have korean support]) +AC_DEFUN([PHP_MBSTRING_ADD_BUILD_DIR], [ + PHP_MBSTRING_EXTRA_BUILD_DIRS="$PHP_MBSTRING_EXTRA_BUILD_DIRS $1" +]) + +AC_DEFUN([PHP_MBSTRING_CONFIG_HEADER], [ + PHP_MBSTRING_EXTRA_CONFIG_HEADERS="$PHP_MBSTRING_EXTRA_CONFIG_HEADERS $1" +]) + +AC_DEFUN([PHP_MBSTRING_EXTENSION], [ + PHP_NEW_EXTENSION(mbstring, $PHP_MBSTRING_SOURCES, $ext_shared,, \\$(PHP_MBSTRING_CFLAGS)) + for dir in $PHP_MBSTRING_EXTRA_BUILD_DIRS; do + PHP_ADD_BUILD_DIR([$ext_builddir/$dir]) + done + for cfg in $PHP_MBSTRING_EXTRA_CONFIG_HEADERS; do + AC_CONFIG_HEADER([$ext_builddir/$cfg]) + done + + if test "$LIBMBFL_MODULE_TYPE" = "builtin"; then + PHP_MBSTRING_CFLAGS="-I$ext_srcdir/libmbfl/mbfl $PHP_MBSTRING_CFLAGS" + PHP_MBSTRING_CFLAGS="-I$ext_srcdir/libmbfl $PHP_MBSTRING_CFLAGS" fi - if test "$PHP_MBSTRING" = "ru"; then - AC_DEFINE(HAVE_MBSTR_RU,1,[whether to have russian support]) + PHP_SUBST(PHP_MBSTRING_CFLAGS) +]) + + +AC_DEFUN([PHP_MBSTRING_SETUP], [ + PHP_ARG_ENABLE(mbstring, whether to enable multibyte string support, + [ --enable-mbstring Enable multibyte string support]) + + if test "$PHP_MBSTRING" != "no"; then + AC_DEFINE([HAVE_MBSTRING],1,[whether to have multibyte string support]) + + if test -z "$PHP_MBSTRING" -o "$PHP_MBSTRING" = "all" -o "$PHP_MBSTRING" = "ja"; then + AC_DEFINE([HAVE_MBSTR_JA],1,[whether to have japanese support]) + fi + if test "$PHP_MBSTRING" = "all" -o "$PHP_MBSTRING" = "cn"; then + AC_DEFINE([HAVE_MBSTR_CN],1,[whether to have simplified chinese support]) + fi + if test "$PHP_MBSTRING" = "all" -o "$PHP_MBSTRING" = "tw"; then + AC_DEFINE([HAVE_MBSTR_TW],1,[whether to have traditional chinese support]) + fi + if test "$PHP_MBSTRING" = "all" -o "$PHP_MBSTIRNG" = "kr"; then + AC_DEFINE([HAVE_MBSTR_KR],1,[whether to have korean support]) + fi + if test "$PHP_MBSTRING" = "all" -o "$PHP_MBSTRING" = "ru"; then + AC_DEFINE([HAVE_MBSTR_RU],1,[whether to have russian support]) + fi + + PHP_MBSTRING_ADD_SOURCES([ + mbstring.c php_unicode.c mb_gpc.c php_mbfl_allocators.c + ]) fi - if test "$PHP_MBSTRING" = "all"; then - AC_DEFINE(HAVE_MBSTR_JA,1,[whether to have japanese support]) - AC_DEFINE(HAVE_MBSTR_CN,1,[whether to have simplified chinese support]) - AC_DEFINE(HAVE_MBSTR_TW,1,[whether to have traditional chinese support]) - AC_DEFINE(HAVE_MBSTR_KR,1,[whether to have korean support]) - AC_DEFINE(HAVE_MBSTR_RU,1,[whether to have russian support]) +]) + +AC_DEFUN([PHP_MBSTRING_SETUP_MBREGEX], [ + PHP_ARG_ENABLE([mbregex], [whether to enable multibyte regex support], + [ --disable-mbregex Disable multibyte regex support], yes, no) + + if test "$PHP_MBREGEX" != "no" -a "$PHP_MBSTRING" != "no"; then + AC_CACHE_CHECK(for variable length prototypes and stdarg.h, cv_php_mbstring_stdarg, [ + AC_TRY_COMPILE([#include <stdarg.h>], [ +int foo(int x, ...) { + va_list va; + va_start(va, x); + va_arg(va, int); + va_arg(va, char *); + va_arg(va, double); + return 0; +} +int main() { return foo(10, "", 3.14); } + ], [cv_php_mbstring_stdarg=yes], [cv_php_mbstring_stdarg=no]) + ]) + if test "$cv_php_mbstring_stdarg" = "yes"; then + AC_DEFINE([HAVE_STDARG_PROTOTYPES], 1, [Define if stdarg.h is available]) + fi + AC_DEFINE([HAVE_MBREGEX], 1, [whether to have multibyte regex support]) + PHP_MBSTRING_CFLAGS="-DNOT_RUBY $PHP_MBSTRING_CFLAGS" + + PHP_MBSTRING_ADD_BUILD_DIR([oniguruma]) + PHP_MBSTRING_CONFIG_HEADER([oniguruma/config.h]) + PHP_MBSTRING_ADD_SOURCES([ + php_mbregex.c + oniguruma/regcomp.c + oniguruma/regerror.c + oniguruma/regexec.c + oniguruma/reggnu.c + oniguruma/regparse.c + oniguruma/regposerr.c + ]) fi +]) + +AC_DEFUN([PHP_MBSTRING_SETUP_LIBMBFL], [ + PHP_ARG_WITH(libmbfl, [ include libmbfl support], + [ --with-libmbfl[=DIR] Include libmbfl support where DIR is libmbfl install prefix. + If DIR is not set, the bundled libmbfl will be used.], no, no) - PHP_NEW_EXTENSION(mbstring, mbfilter_ja.c mbfilter_cn.c mbfilter_tw.c mbfilter_kr.c mbfilter_ru.c mbfilter.c mbstring.c mbregex.c php_mbregex.c html_entities.c php_unicode.c mb_gpc.c, $ext_shared) -fi + if test "$PHP_MBSTRING" != "no"; then + LIBMBFL_MODULE_TYPE=builtin + AC_DEFINE([HAVE_LIBMBFL], 1, [whether to have libmbfl support]) + PHP_MBSTRING_ADD_BUILD_DIR([libmbfl]) + PHP_MBSTRING_CONFIG_HEADER([libmbfl/config.h]) + PHP_MBSTRING_ADD_SOURCES([ + libmbfl/filters/html_entities.c + libmbfl/filters/mbfilter_7bit.c + libmbfl/filters/mbfilter_ascii.c + libmbfl/filters/mbfilter_base64.c + libmbfl/filters/mbfilter_big5.c + libmbfl/filters/mbfilter_byte2.c + libmbfl/filters/mbfilter_byte4.c + libmbfl/filters/mbfilter_cp1251.c + libmbfl/filters/mbfilter_cp1252.c + libmbfl/filters/mbfilter_cp866.c + libmbfl/filters/mbfilter_cp932.c + libmbfl/filters/mbfilter_cp936.c + libmbfl/filters/mbfilter_euc_cn.c + libmbfl/filters/mbfilter_euc_jp.c + libmbfl/filters/mbfilter_euc_jp_win.c + libmbfl/filters/mbfilter_euc_kr.c + libmbfl/filters/mbfilter_euc_tw.c + libmbfl/filters/mbfilter_htmlent.c + libmbfl/filters/mbfilter_hz.c + libmbfl/filters/mbfilter_iso2022_kr.c + libmbfl/filters/mbfilter_iso8859_1.c + libmbfl/filters/mbfilter_iso8859_10.c + libmbfl/filters/mbfilter_iso8859_13.c + libmbfl/filters/mbfilter_iso8859_14.c + libmbfl/filters/mbfilter_iso8859_15.c + libmbfl/filters/mbfilter_iso8859_2.c + libmbfl/filters/mbfilter_iso8859_3.c + libmbfl/filters/mbfilter_iso8859_4.c + libmbfl/filters/mbfilter_iso8859_5.c + libmbfl/filters/mbfilter_iso8859_6.c + libmbfl/filters/mbfilter_iso8859_7.c + libmbfl/filters/mbfilter_iso8859_8.c + libmbfl/filters/mbfilter_iso8859_9.c + libmbfl/filters/mbfilter_jis.c + libmbfl/filters/mbfilter_koi8r.c + libmbfl/filters/mbfilter_qprint.c + libmbfl/filters/mbfilter_sjis.c + libmbfl/filters/mbfilter_ucs2.c + libmbfl/filters/mbfilter_ucs4.c + libmbfl/filters/mbfilter_uhc.c + libmbfl/filters/mbfilter_utf16.c + libmbfl/filters/mbfilter_utf32.c + libmbfl/filters/mbfilter_utf7.c + libmbfl/filters/mbfilter_utf7imap.c + libmbfl/filters/mbfilter_utf8.c + libmbfl/filters/mbfilter_uuencode.c + libmbfl/mbfl/mbfilter.c + libmbfl/mbfl/mbfilter_8bit.c + libmbfl/mbfl/mbfilter_pass.c + libmbfl/mbfl/mbfilter_wchar.c + libmbfl/mbfl/mbfl_convert.c + libmbfl/mbfl/mbfl_encoding.c + libmbfl/mbfl/mbfl_filter_output.c + libmbfl/mbfl/mbfl_ident.c + libmbfl/mbfl/mbfl_language.c + libmbfl/mbfl/mbfl_memory_device.c + libmbfl/mbfl/mbfl_string.c + libmbfl/nls/nls_de.c + libmbfl/nls/nls_en.c + libmbfl/nls/nls_ja.c + libmbfl/nls/nls_kr.c + libmbfl/nls/nls_neutral.c + libmbfl/nls/nls_ru.c + libmbfl/nls/nls_uni.c + libmbfl/nls/nls_zh.c + ]) + fi +]) -PHP_ARG_ENABLE(mbregex, whether to enable multibyte regex support, -[ --disable-mbregex Disable multibyte regex support], yes, no) +PHP_MBSTRING_INIT +PHP_MBSTRING_SETUP +PHP_MBSTRING_SETUP_MBREGEX +PHP_MBSTRING_SETUP_LIBMBFL +PHP_MBSTRING_EXTENSION -if test "$PHP_MBREGEX" != "no" -a "$PHP_MBSTRING" != "no"; then - AC_DEFINE(HAVE_MBREGEX, 1, [whether to have multibyte regex support]) -fi diff --git a/ext/mbstring/libmbfl/AUTHORS b/ext/mbstring/libmbfl/AUTHORS new file mode 100644 index 0000000000..8e6eb49264 --- /dev/null +++ b/ext/mbstring/libmbfl/AUTHORS @@ -0,0 +1,8 @@ +Hironori Sato <satoh@jpnnet.com> +Shigeru Kanemoto <sgk@happysize.co.jp> +Tsukada Takuya <tsukada@fminn.nagano.nagano.jp> +U. Kenkichi <kenkichi@axes.co.jp> +Tateyama <tateyan@amy.hi-ho.ne.jp> +Moriyoshi Koizumi <moriyoshi@php.net> +Rui Hirokawa <hirokawa@php.net> +Other gracious contributors diff --git a/ext/mbstring/libmbfl/DISCLAIMER b/ext/mbstring/libmbfl/DISCLAIMER new file mode 100644 index 0000000000..1aa586050c --- /dev/null +++ b/ext/mbstring/libmbfl/DISCLAIMER @@ -0,0 +1,68 @@ +# charset=UTF-8 + + "streamable kanji code filter and converter" + + Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved. + + This software is released under the GNU Lesser General Public License. + (Version 2.1, February 1999) + Please read the following detail of the licence (in japanese). + + ◆使用許諾æ¡ä»¶â—† + + ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•れã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ + ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•トウェアã«é–¢ + ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ + ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•トウェアを使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利 + ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•トウェアを使用 + ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 + + ã“ã®ã‚½ãƒ•トウェアを「GNU Lesser General Public License (Version 2.1, February + 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser + General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢ + ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ + + 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã + ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“れã¾ã§Library General + Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚ + http://www.gnu.org/ --- GNUウェブサイト + http://www.gnu.org/copyleft/lesser.html --- ãƒ©ã‚¤ã‚»ãƒ³ã‚¹æ–‡é¢ + ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。 + + ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプãƒã‚¸ã‚§ã‚¯ãƒˆã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§ + ã¯ã‚りã¾ã›ã‚“。 + + â—†ä¿è¨¼å†…容◆ + + ã“ã®ã‚½ãƒ•トウェアã¯ã€æœŸå¾…ã•れãŸå‹•作・機能・性能をæŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨è¨ˆã•れ + 開発ã•れã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚りã¾ã›ã‚“。ã“ã®ã‚½ãƒ•トウェアã¯ã€Œã“ + ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•れã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定㮠+ 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•らã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•れãŸã‚Šæš—é»™ã«ç¤ºã•れã¦ã„ + ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åйã§ã™ã€‚ã“ã®ã‚½ãƒ•トウェアを使用ã—ãŸçµæžœãªã„ã—使 + 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æå®³ + ã€ãƒ‡ãƒ¼ã‚¿ã®æå¤±ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æå®³ã«ã¤ã„ã¦ã¯ã€ãã®æå®³ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€… + ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è¦å‘Šã•れã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æå®³ã®è³ + 償ãŠã‚ˆã³è£œå¡«ã‚’行ã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ» + 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚ + + ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—† + + 〒102-0073 + æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F + æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ + Phone: 03-3512-3655, Fax: 03-3512-3656 + Email: sales@happysize.co.jp + Web: http://happysize.com/ + + ◆著者◆ + + 金本 茂 <sgk@happysize.co.jp> + + ◆履æ´â—† + + 1998/11/10 sgk implementation in C++ + 1999/4/25 sgk Cã§æ›¸ããªãŠã—。 + 1999/4/26 sgk 入力フィルタを実装。漢å—コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’è¿½åŠ ã€‚ + 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚ + 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚ + diff --git a/ext/mbstring/libmbfl/INSTALL b/ext/mbstring/libmbfl/INSTALL new file mode 100644 index 0000000000..b07c9157cd --- /dev/null +++ b/ext/mbstring/libmbfl/INSTALL @@ -0,0 +1,12 @@ + +For UNIX compatible system, + +./buildconf +./configure +make +make install + +For Windows, + +Visual C++ 6.0 and Borland C++ 5.0 is suppoted. + diff --git a/ext/mbstring/libmbfl/Makefile.am b/ext/mbstring/libmbfl/Makefile.am new file mode 100644 index 0000000000..72c855eec6 --- /dev/null +++ b/ext/mbstring/libmbfl/Makefile.am @@ -0,0 +1,2 @@ +EXTRA_DIST=AUTHORS DISCLAIMER +SUBDIRS = nls filters mbfl diff --git a/ext/mbstring/libmbfl/README b/ext/mbstring/libmbfl/README new file mode 100644 index 0000000000..cac373227b --- /dev/null +++ b/ext/mbstring/libmbfl/README @@ -0,0 +1,8 @@ +This is Libmbfl, a streamable multibyte character code filter and +converter library. + +See DISCLAIMER for licensing information. + +See the file INSTALL for instructions on how to build and install +libmbfl. + diff --git a/ext/mbstring/libmbfl/buildconf b/ext/mbstring/libmbfl/buildconf new file mode 100755 index 0000000000..981812ad64 --- /dev/null +++ b/ext/mbstring/libmbfl/buildconf @@ -0,0 +1,6 @@ +#!/bin/sh +libtoolize -c -f --automake +aclocal +autoheader +automake -a -c --foreign +autoconf diff --git a/ext/mbstring/libmbfl/config.h b/ext/mbstring/libmbfl/config.h new file mode 100644 index 0000000000..2f15684fbe --- /dev/null +++ b/ext/mbstring/libmbfl/config.h @@ -0,0 +1,79 @@ +/* ext/mbstring/libmbfl/config.h. Generated by configure. */ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the <assert.h> header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +/* #undef HAVE_INTTYPES_H */ + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +/* #undef HAVE_MALLOC */ + +/* Define to 1 if you have the <memory.h> header file. */ +/* #undef HAVE_MEMORY_H */ + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +/* #undef HAVE_REALLOC */ + +/* Define to 1 if you have the <stddef.h> header file. */ +/* #undef HAVE_STDDEF_H */ + +/* Define to 1 if you have the <stdint.h> header file. */ +/* #undef HAVE_STDINT_H */ + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strchr' function. */ +/* #undef HAVE_STRCHR */ + +/* Define to 1 if you have the <strings.h> header file. */ +/* #undef HAVE_STRINGS_H */ + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +/* #undef HAVE_SYS_STAT_H */ + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to rpl_malloc if the replacement function should be used. */ +/* #undef malloc */ + +/* Define to rpl_realloc if the replacement function should be used. */ +/* #undef realloc */ + +/* Define to `unsigned' if <sys/types.h> does not define. */ +/* #undef size_t */ diff --git a/ext/mbstring/libmbfl/config.h.bcc32 b/ext/mbstring/libmbfl/config.h.bcc32 new file mode 100644 index 0000000000..7458e441eb --- /dev/null +++ b/ext/mbstring/libmbfl/config.h.bcc32 @@ -0,0 +1,12 @@ +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDDEF_H 1 +#define HAVE_ASSERT_H 1 +#define HAVE_MEMORY_H 1 +/* #undef HAVE_STRINGS_H */ +#define HAVE_STRING_H 1 +/* #undef HAVE_STRCASECMP */ +#define HAVE_STRICMP 1 +#define HAVE_WIN32_NATIVE_THREAD 1 +#define USE_WIN32_NATIVE_THREAD 1 +#define ENABLE_THREADS 1 diff --git a/ext/mbstring/libmbfl/config.h.in b/ext/mbstring/libmbfl/config.h.in new file mode 100644 index 0000000000..17458c857b --- /dev/null +++ b/ext/mbstring/libmbfl/config.h.in @@ -0,0 +1,78 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the <assert.h> header file. */ +#undef HAVE_ASSERT_H + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +#undef HAVE_REALLOC + +/* Define to 1 if you have the <stddef.h> header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to rpl_realloc if the replacement function should be used. */ +#undef realloc + +/* Define to `unsigned' if <sys/types.h> does not define. */ +#undef size_t diff --git a/ext/mbstring/libmbfl/config.h.vc6 b/ext/mbstring/libmbfl/config.h.vc6 new file mode 100644 index 0000000000..aaa5a5c299 --- /dev/null +++ b/ext/mbstring/libmbfl/config.h.vc6 @@ -0,0 +1,14 @@ +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDDEF_H 1 +#define HAVE_ASSERT_H 1 +#define HAVE_MEMORY_H 1 +/* #undef HAVE_STRINGS_H */ +#define HAVE_STRING_H 1 +/* #undef HAVE_STRCASECMP */ +#define HAVE_STRICMP 1 +#define HAVE_WIN32_NATIVE_THREAD 1 +#define USE_WIN32_NATIVE_THREAD 1 +#define ENABLE_THREADS 1 + +#define strcasecmp(s1, s2) stricmp(s1, s2) diff --git a/ext/mbstring/libmbfl/configure.in b/ext/mbstring/libmbfl/configure.in new file mode 100644 index 0000000000..96da1e85a3 --- /dev/null +++ b/ext/mbstring/libmbfl/configure.in @@ -0,0 +1,29 @@ +# Process this file with autoconf to produce a configure script. +AC_INIT([libmbfl],[1.0.0]) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([mbfl/mbfilter.c]) +AC_CONFIG_HEADER([config.h]) + +# Checks for programs. +AC_PROG_CC +AC_PROG_CXX +AC_PROG_LIBTOOL +AC_PROG_RANLIB + +# Checks for libraries. + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([stdlib.h stddef.h assert.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_SIZE_T + +# Checks for library functions. +AC_FUNC_MALLOC +AC_FUNC_REALLOC +AC_CHECK_FUNCS([strcasecmp strchr]) + +AC_CONFIG_FILES([Makefile mbfl/Makefile filters/Makefile nls/Makefile]) +AC_OUTPUT diff --git a/ext/mbstring/libmbfl/cvsclean b/ext/mbstring/libmbfl/cvsclean new file mode 100755 index 0000000000..60ae246a50 --- /dev/null +++ b/ext/mbstring/libmbfl/cvsclean @@ -0,0 +1,14 @@ +#!/bin/sh +function cvsclean_sub() { + prev_pwd=`pwd` + cd $1 + cat .cvsignore | while read fname; do + rm -r -f $fname + done + cd "$prev_pwd" +} + +cvsclean_sub . +cvsclean_sub mbfl +cvsclean_sub filters +cvsclean_sub nls diff --git a/ext/mbstring/libmbfl/filters/Makefile.am b/ext/mbstring/libmbfl/filters/Makefile.am new file mode 100644 index 0000000000..b8d8b7926a --- /dev/null +++ b/ext/mbstring/libmbfl/filters/Makefile.am @@ -0,0 +1,3 @@ +noinst_LTLIBRARIES=libmbfl_filters.la +INCLUDES=-I../mbfl +libmbfl_filters_la_SOURCES=mbfilter_cp936.c mbfilter_hz.c mbfilter_euc_tw.c mbfilter_big5.c mbfilter_euc_jp.c mbfilter_jis.c mbfilter_iso8859_1.c mbfilter_iso8859_2.c mbfilter_cp1252.c mbfilter_cp1251.c mbfilter_ascii.c mbfilter_iso8859_3.c mbfilter_iso8859_4.c mbfilter_iso8859_5.c mbfilter_iso8859_6.c mbfilter_iso8859_7.c mbfilter_iso8859_8.c mbfilter_iso8859_9.c mbfilter_iso8859_10.c mbfilter_iso8859_13.c mbfilter_iso8859_14.c mbfilter_iso8859_15.c mbfilter_htmlent.c mbfilter_byte2.c mbfilter_byte4.c mbfilter_uuencode.c mbfilter_base64.c mbfilter_sjis.c mbfilter_7bit.c mbfilter_qprint.c mbfilter_ucs4.c mbfilter_ucs2.c mbfilter_utf32.c mbfilter_utf16.c mbfilter_utf8.c mbfilter_utf7.c mbfilter_utf7imap.c mbfilter_euc_jp_win.c mbfilter_cp932.c mbfilter_euc_cn.c mbfilter_euc_kr.c mbfilter_uhc.c mbfilter_iso2022_kr.c mbfilter_cp866.c mbfilter_koi8r.c html_entities.c diff --git a/ext/mbstring/cp932_table.h b/ext/mbstring/libmbfl/filters/cp932_table.h index 7f3d6d9735..d8cbb7f0a8 100644 --- a/ext/mbstring/cp932_table.h +++ b/ext/mbstring/libmbfl/filters/cp932_table.h @@ -1,4 +1,31 @@ /* + * "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: + * + */ + +#ifndef CP932_TABLE_H +#define CP932_TABLE_H + +/* * cp932 table */ static const unsigned short cp932ext3_eucjp_table[] = { @@ -64,3 +91,5 @@ static const unsigned short cp932ext3_eucjp_table[] = { }; static const int cp932ext3_eucjp_table_size = (sizeof (cp932ext3_eucjp_table) / sizeof (unsigned short)); + +#endif /* CP932_TABLE_H */ diff --git a/ext/mbstring/html_entities.c b/ext/mbstring/libmbfl/filters/html_entities.c index 1e87fbfca2..0f7ec86b7d 100644 --- a/ext/mbstring/html_entities.c +++ b/ext/mbstring/libmbfl/filters/html_entities.c @@ -1,31 +1,36 @@ /* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Marcus Boerger <helly@php.net> | - +----------------------------------------------------------------------+ + * "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 part: Marcus Boerger <marcus.boerger@t-online.de> + * + */ +/* + * The source code included in this files was separated from mbfilter.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * */ - -/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "php.h" -#include "php_globals.h" - -#include <stdlib.h> #include "mbfilter.h" const mbfl_html_entity mbfl_html_entity_list[] = { /* diff --git a/ext/mbstring/libmbfl/filters/html_entities.h b/ext/mbstring/libmbfl/filters/html_entities.h new file mode 100644 index 0000000000..e571356da0 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/html_entities.h @@ -0,0 +1,38 @@ +/* + * "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 part: Marcus Boerger <marcus.boerger@t-online.de> + * + */ +/* + * The source code included in this files was separated from mbfilter.h + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_HTML_ENTITIES_H +#define MBFL_HTML_ENTITIES_H + +#include "mbfilter.h" + +extern mbfl_html_entity mbfl_html_entity_list[]; + +#endif /* MBFL_HTML_ENTITIES_H */ + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_7bit.c b/ext/mbstring/libmbfl/filters/mbfilter_7bit.c new file mode 100644 index 0000000000..7b793cd540 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_7bit.c @@ -0,0 +1,82 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_7bit.h" + +const mbfl_encoding mbfl_encoding_7bit = { + mbfl_no_encoding_7bit, + "7bit", + "7bit", + NULL, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_convert_vtbl vtbl_8bit_7bit = { + mbfl_no_encoding_8bit, + mbfl_no_encoding_7bit, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_any_7bit, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_7bit_8bit = { + mbfl_no_encoding_7bit, + mbfl_no_encoding_8bit, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_7bit_any, + mbfl_filt_conv_common_flush +}; + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +int mbfl_filt_conv_7bit_any(int c, mbfl_convert_filter *filter) +{ + return (*filter->output_function)(c, filter->data); +} + + +int mbfl_filt_conv_any_7bit(int c, mbfl_convert_filter *filter) +{ + if (c >= 0 && c < 0x80) { + CK((*filter->output_function)(c, filter->data)); + } + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_7bit.h b/ext/mbstring/libmbfl/filters/mbfilter_7bit.h new file mode 100644 index 0000000000..d9a285fb1b --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_7bit.h @@ -0,0 +1,43 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifndef MBFL_MBFILTER_7BIT_H +#define MBFL_MBFILTER_7BIT_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_7bit; +extern const struct mbfl_convert_vtbl vtbl_8bit_7bit; +extern const struct mbfl_convert_vtbl vtbl_7bit_8bit; + +int mbfl_filt_conv_7bit_any(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_any_7bit(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_7BIT_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_ascii.c b/ext/mbstring/libmbfl/filters/mbfilter_ascii.c new file mode 100644 index 0000000000..34366db6c0 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_ascii.c @@ -0,0 +1,114 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_ascii.h" + +static int mbfl_filt_ident_ascii(int c, mbfl_identify_filter *filter); + +static const char *mbfl_encoding_ascii_aliases[] = {"ANSI_X3.4-1968", "iso-ir-6", "ANSI_X3.4-1986", "ISO_646.irv:1991", "US-ASCII", "ISO646-US", "us", "IBM367", "cp367", "csASCII", NULL}; + +const mbfl_encoding mbfl_encoding_ascii = { + mbfl_no_encoding_ascii, + "ASCII", + "US-ASCII", /* preferred MIME name */ + (const char *(*)[])&mbfl_encoding_ascii_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_ascii = { + mbfl_no_encoding_ascii, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_ascii +}; + +const struct mbfl_convert_vtbl vtbl_ascii_wchar = { + mbfl_no_encoding_ascii, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_ascii_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_ascii = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_ascii, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_ascii, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ASCII => wchar + */ +int mbfl_filt_conv_ascii_wchar(int c, mbfl_convert_filter *filter) +{ + return (*filter->output_function)(c, filter->data); +} + + +/* + * wchar => ASCII + */ +int mbfl_filt_conv_wchar_ascii(int c, mbfl_convert_filter *filter) +{ + if (c >= 0 && c < 0x80) { + CK((*filter->output_function)(c, 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_ascii(int c, mbfl_identify_filter *filter) +{ + if (c >= 0x20 && c < 0x80) { + ; + } else if (c == 0x0d || c == 0x0a || c == 0x09 || c == 0) { /* CR or LF or HTAB or null */ + ; + } else { + filter->flag = 1; + } + + return c; +} diff --git a/ext/mbstring/libmbfl/filters/mbfilter_ascii.h b/ext/mbstring/libmbfl/filters/mbfilter_ascii.h new file mode 100644 index 0000000000..c48ced6447 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_ascii.h @@ -0,0 +1,46 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifndef MBFL_MBFILTER_ASCII_H +#define MBFL_MBFILTER_ASCII_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_ascii; +extern const struct mbfl_identify_vtbl vtbl_identify_ascii; +extern const struct mbfl_convert_vtbl vtbl_ascii_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_ascii; + +int mbfl_filt_conv_ascii_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_ascii(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ASCII_H */ + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_base64.c b/ext/mbstring/libmbfl/filters/mbfilter_base64.c new file mode 100644 index 0000000000..13341f9e9f --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_base64.c @@ -0,0 +1,214 @@ + /* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_base64.h" + +const mbfl_encoding mbfl_encoding_base64 = { + mbfl_no_encoding_base64, + "BASE64", + "BASE64", + NULL, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_convert_vtbl vtbl_8bit_b64 = { + mbfl_no_encoding_8bit, + mbfl_no_encoding_base64, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_base64enc, + mbfl_filt_conv_base64enc_flush +}; + +const struct mbfl_convert_vtbl vtbl_b64_8bit = { + mbfl_no_encoding_base64, + mbfl_no_encoding_8bit, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_base64dec, + mbfl_filt_conv_base64dec_flush +}; + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * any => BASE64 + */ +static const unsigned char mbfl_base64_table[] = { + /* 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', */ + 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d, + /* 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', */ + 0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a, + /* 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', */ + 0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d, + /* 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', */ + 0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a, + /* '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '\0' */ + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x2b,0x2f,0x00 +}; + +int mbfl_filt_conv_base64enc(int c, mbfl_convert_filter *filter) +{ + int n; + + n = (filter->status & 0xff); + if (n == 0) { + filter->status++; + filter->cache = (c & 0xff) << 16; + } else if (n == 1) { + filter->status++; + filter->cache |= (c & 0xff) << 8; + } else { + filter->status &= ~0xff; + if ((filter->status & MBFL_BASE64_STS_MIME_HEADER) == 0) { + n = (filter->status & 0xff00) >> 8; + if (n > 72) { + CK((*filter->output_function)(0x0d, filter->data)); /* CR */ + CK((*filter->output_function)(0x0a, filter->data)); /* LF */ + filter->status &= ~0xff00; + } + filter->status += 0x400; + } + n = filter->cache | (c & 0xff); + CK((*filter->output_function)(mbfl_base64_table[(n >> 18) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[(n >> 12) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[(n >> 6) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[n & 0x3f], filter->data)); + } + + return c; +} + +int mbfl_filt_conv_base64enc_flush(mbfl_convert_filter *filter) +{ + int status, cache, len; + + status = filter->status & 0xff; + cache = filter->cache; + len = (filter->status & 0xff00) >> 8; + filter->status &= ~0xffff; + filter->cache = 0; + /* flush fragments */ + if (status >= 1) { + if ((filter->status & MBFL_BASE64_STS_MIME_HEADER) == 0) { + if (len > 72){ + CK((*filter->output_function)(0x0d, filter->data)); /* CR */ + CK((*filter->output_function)(0x0a, filter->data)); /* LF */ + } + } + CK((*filter->output_function)(mbfl_base64_table[(cache >> 18) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[(cache >> 12) & 0x3f], filter->data)); + if (status == 1) { + CK((*filter->output_function)(0x3d, filter->data)); /* '=' */ + CK((*filter->output_function)(0x3d, filter->data)); /* '=' */ + } else { + CK((*filter->output_function)(mbfl_base64_table[(cache >> 6) & 0x3f], filter->data)); + CK((*filter->output_function)(0x3d, filter->data)); /* '=' */ + } + } + return 0; +} + +/* + * BASE64 => any + */ +int mbfl_filt_conv_base64dec(int c, mbfl_convert_filter *filter) +{ + int n; + + if (c == 0x0d || c == 0x0a || c == 0x20 || c == 0x09 || c == 0x3d) { /* CR or LF or SPACE or HTAB or '=' */ + return c; + } + + n = 0; + if (c >= 0x41 && c <= 0x5a) { /* A - Z */ + n = c - 65; + } else if (c >= 0x61 && c <= 0x7a) { /* a - z */ + n = c - 71; + } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */ + n = c + 4; + } else if (c == 0x2b) { /* '+' */ + n = 62; + } else if (c == 0x2f) { /* '/' */ + n = 63; + } + n &= 0x3f; + + switch (filter->status) { + case 0: + filter->status = 1; + filter->cache = n << 18; + break; + case 1: + filter->status = 2; + filter->cache |= n << 12; + break; + case 2: + filter->status = 3; + filter->cache |= n << 6; + break; + default: + filter->status = 0; + n |= filter->cache; + CK((*filter->output_function)((n >> 16) & 0xff, filter->data)); + CK((*filter->output_function)((n >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(n & 0xff, filter->data)); + break; + } + + return c; +} + +int mbfl_filt_conv_base64dec_flush(mbfl_convert_filter *filter) +{ + int status, cache; + + status = filter->status; + cache = filter->cache; + filter->status = 0; + filter->cache = 0; + /* flush fragments */ + if (status >= 2) { + CK((*filter->output_function)((cache >> 16) & 0xff, filter->data)); + if (status >= 3) { + CK((*filter->output_function)((cache >> 8) & 0xff, filter->data)); + } + } + return 0; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_base64.h b/ext/mbstring/libmbfl/filters/mbfilter_base64.h new file mode 100644 index 0000000000..6bd525fd3e --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_base64.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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifndef MBFL_MBFILTER_BASE64_H +#define MBFL_MBFILTER_BASE64_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_base64; +extern const struct mbfl_convert_vtbl vtbl_b64_8bit; +extern const struct mbfl_convert_vtbl vtbl_8bit_b64; + +int mbfl_filt_conv_base64enc(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_base64enc_flush(mbfl_convert_filter *filter); +int mbfl_filt_conv_base64dec(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_base64dec_flush(mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_BASE64_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_big5.c b/ext/mbstring/libmbfl/filters/mbfilter_big5.c new file mode 100644 index 0000000000..fe5effe044 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_big5.c @@ -0,0 +1,227 @@ +/* + * "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: Rui Hirokawa <hirokawa@php.net> + * + */ +/* + * The source code included in this files was separated from mbfilter_tw.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_big5.h" + +#include "unicode_table_big5.h" + +static int mbfl_filt_ident_big5(int c, mbfl_identify_filter *filter); + +static const unsigned char mblen_table_big5[] = { /* 0x81-0xFE */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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, 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 +}; + +static const char *mbfl_encoding_big5_aliases[] = {"CN-BIG5", "BIG-FIVE", "BIGFIVE", "CP950", NULL}; + +const mbfl_encoding mbfl_encoding_big5 = { + mbfl_no_encoding_big5, + "BIG-5", + "BIG5", + (const char *(*)[])&mbfl_encoding_big5_aliases, + mblen_table_big5, + MBFL_ENCTYPE_MBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_big5 = { + mbfl_no_encoding_big5, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_big5 +}; + +const struct mbfl_convert_vtbl vtbl_big5_wchar = { + mbfl_no_encoding_big5, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_big5_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_big5 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_big5, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_big5, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * Big5 => wchar + */ +int +mbfl_filt_conv_big5_wchar(int c, mbfl_convert_filter *filter) +{ + int c1, w; + + switch (filter->status) { + case 0: + if (c >= 0 && c < 0x80) { /* latin */ + CK((*filter->output_function)(c, filter->data)); + } else if (c > 0xa0 && c < 0xff) { /* dbcs lead byte */ + 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: /* dbcs second byte */ + filter->status = 0; + c1 = filter->cache; + if ((c > 0x39 && c < 0x7f) | (c > 0xa0 && c < 0xff)) { + if (c < 0x7f){ + w = (c1 - 0xa1)*157 + (c - 0x40); + } else { + w = (c1 - 0xa1)*157 + (c - 0xa1) + 0x3f; + } + if (w >= 0 && w < big5_ucs_table_size) { + w = big5_ucs_table[w]; + } else { + w = 0; + } + if (w <= 0) { + w = (c1 << 8) | c; + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_BIG5; + } + 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 => Big5 + */ +int +mbfl_filt_conv_wchar_big5(int c, mbfl_convert_filter *filter) +{ + int c1, s; + + s = 0; + if (c >= ucs_a1_big5_table_min && c < ucs_a1_big5_table_max) { + s = ucs_a1_big5_table[c - ucs_a1_big5_table_min]; + } else if (c >= ucs_a2_big5_table_min && c < ucs_a2_big5_table_max) { + s = ucs_a2_big5_table[c - ucs_a2_big5_table_min]; + } else if (c >= ucs_a3_big5_table_min && c < ucs_a3_big5_table_max) { + s = ucs_a3_big5_table[c - ucs_a3_big5_table_min]; + } else if (c >= ucs_i_big5_table_min && c < ucs_i_big5_table_max) { + s = ucs_i_big5_table[c - ucs_i_big5_table_min]; + } else if (c >= ucs_pua_big5_table_min && c < ucs_pua_big5_table_max) { + s = ucs_pua_big5_table[c - ucs_pua_big5_table_min]; + } else if (c >= ucs_r1_big5_table_min && c < ucs_r1_big5_table_max) { + s = ucs_r1_big5_table[c - ucs_r1_big5_table_min]; + } else if (c >= ucs_r2_big5_table_min && c < ucs_r2_big5_table_max) { + s = ucs_r2_big5_table[c - ucs_r2_big5_table_min]; + } + if (s <= 0) { + c1 = c & ~MBFL_WCSPLANE_MASK; + if (c1 == MBFL_WCSPLANE_BIG5) { + s = c & MBFL_WCSPLANE_MASK; + } + if (c == 0) { + s = 0; + } else if (s <= 0) { + s = -1; + } + } + if (s >= 0) { + if (s < 0x80) { /* latin */ + CK((*filter->output_function)(s, filter->data)); + } else { + CK((*filter->output_function)((s >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(s & 0xff, 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_big5(int c, mbfl_identify_filter *filter) +{ + if (filter->status) { /* kanji second char */ + if (c < 0x40 || (c > 0x7e && c < 0xa1) ||c > 0xfe) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + } else if (c >= 0 && c < 0x80) { /* latin ok */ + ; + } else if (c > 0xa0 && c < 0xff) { /* DBCS lead byte */ + filter->status = 1; + } else { /* bad */ + filter->flag = 1; + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_big5.h b/ext/mbstring/libmbfl/filters/mbfilter_big5.h new file mode 100644 index 0000000000..6b6a26563b --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_big5.h @@ -0,0 +1,43 @@ +/* + * "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: Rui Hirokawa <hirokawa@php.net> + * + */ +/* + * The source code included in this files was separated from mbfilter_tw.h + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_BIG5_H +#define MBFL_MBFILTER_BIG5_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_big5; +extern const struct mbfl_identify_vtbl vtbl_identify_big5; +extern const struct mbfl_convert_vtbl vtbl_big5_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_big5; + +int mbfl_filt_conv_big5_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_big5(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_BIG5_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_byte2.c b/ext/mbstring/libmbfl/filters/mbfilter_byte2.c new file mode 100644 index 0000000000..03b471bf5b --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_byte2.c @@ -0,0 +1,137 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_byte2.h" + +const mbfl_encoding mbfl_encoding_byte2be = { + mbfl_no_encoding_byte2be, + "byte2be", + NULL, + NULL, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const mbfl_encoding mbfl_encoding_byte2le = { + mbfl_no_encoding_byte2le, + "byte2le", + NULL, + NULL, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_convert_vtbl vtbl_byte2be_wchar = { + mbfl_no_encoding_byte2be, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_byte2be_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_byte2be = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_byte2be, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_byte2be, + mbfl_filt_conv_common_flush }; + +const struct mbfl_convert_vtbl vtbl_byte2le_wchar = { + mbfl_no_encoding_byte2le, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_byte2le_wchar, + mbfl_filt_conv_common_flush }; + +const struct mbfl_convert_vtbl vtbl_wchar_byte2le = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_byte2le, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_byte2le, + mbfl_filt_conv_common_flush }; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +int mbfl_filt_conv_byte2be_wchar(int c, mbfl_convert_filter *filter) +{ + int n; + + if (filter->status == 0) { + filter->status = 1; + n = (c & 0xff) << 8; + filter->cache = n; + } else { + filter->status = 0; + n = (c & 0xff) | filter->cache; + CK((*filter->output_function)(n, filter->data)); + } + return c; +} + +int mbfl_filt_conv_wchar_byte2be(int c, mbfl_convert_filter *filter) +{ + CK((*filter->output_function)((c >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(c & 0xff, filter->data)); + return c; +} + +int mbfl_filt_conv_byte2le_wchar(int c, mbfl_convert_filter *filter) +{ + int n; + + if (filter->status == 0) { + filter->status = 1; + n = c & 0xff; + filter->cache = n; + } else { + filter->status = 0; + n = ((c & 0xff) << 8) | filter->cache; + CK((*filter->output_function)(n, filter->data)); + } + return c; +} + +int mbfl_filt_conv_wchar_byte2le(int c, mbfl_convert_filter *filter) +{ + CK((*filter->output_function)(c & 0xff, filter->data)); + CK((*filter->output_function)((c >> 8) & 0xff, filter->data)); + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_byte2.h b/ext/mbstring/libmbfl/filters/mbfilter_byte2.h new file mode 100644 index 0000000000..e762a9db7f --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_byte2.h @@ -0,0 +1,48 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifndef MBFL_MBFILTER_BYTE2_H +#define MBFL_MBFILTER_BYTE2_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_byte2be; +extern const mbfl_encoding mbfl_encoding_byte2le; +extern const struct mbfl_convert_vtbl vtbl_byte2be_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_byte2be; +extern const struct mbfl_convert_vtbl vtbl_byte2le_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_byte2le; + +int mbfl_filt_conv_wchar_byte2be(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_byte2be_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_byte2le(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_byte2le_wchar(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_BYTE2_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_byte4.c b/ext/mbstring/libmbfl/filters/mbfilter_byte4.c new file mode 100644 index 0000000000..24b7367fea --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_byte4.c @@ -0,0 +1,159 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_byte4.h" + +const mbfl_encoding mbfl_encoding_byte4be = { + mbfl_no_encoding_byte4be, + "byte4be", + NULL, + NULL, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const mbfl_encoding mbfl_encoding_byte4le = { + mbfl_no_encoding_byte4le, + "byte4le", + NULL, + NULL, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_convert_vtbl vtbl_byte4be_wchar = { + mbfl_no_encoding_byte4be, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_byte4be_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_byte4be = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_byte4be, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_byte4be, + mbfl_filt_conv_common_flush }; + +const struct mbfl_convert_vtbl vtbl_byte4le_wchar = { + mbfl_no_encoding_byte4le, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_byte4le_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_byte4le = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_byte4le, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_byte4le, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +int mbfl_filt_conv_byte4be_wchar(int c, mbfl_convert_filter *filter) +{ + int n; + + if (filter->status == 0) { + filter->status = 1; + n = (c & 0xff) << 24; + filter->cache = n; + } else if (filter->status == 1) { + filter->status = 2; + n = (c & 0xff) << 16; + filter->cache |= n; + } else if (filter->status == 2) { + filter->status = 3; + n = (c & 0xff) << 8; + filter->cache |= n; + } else { + filter->status = 0; + n = (c & 0xff) | filter->cache; + CK((*filter->output_function)(n, filter->data)); + } + return c; +} + +int mbfl_filt_conv_wchar_byte4be(int c, mbfl_convert_filter *filter) +{ + CK((*filter->output_function)((c >> 24) & 0xff, filter->data)); + CK((*filter->output_function)((c >> 16) & 0xff, filter->data)); + CK((*filter->output_function)((c >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(c & 0xff, filter->data)); + return c; +} + +int mbfl_filt_conv_byte4le_wchar(int c, mbfl_convert_filter *filter) +{ + int n; + + if (filter->status == 0) { + filter->status = 1; + n = (c & 0xff); + filter->cache = n; + } else if (filter->status == 1) { + filter->status = 2; + n = (c & 0xff) << 8; + filter->cache |= n; + } else if (filter->status == 2) { + filter->status = 3; + n = (c & 0xff) << 16; + filter->cache |= n; + } else { + filter->status = 0; + n = ((c & 0xff) << 24) | filter->cache; + CK((*filter->output_function)(n, filter->data)); + } + return c; +} + +int mbfl_filt_conv_wchar_byte4le(int c, mbfl_convert_filter *filter) +{ + CK((*filter->output_function)(c & 0xff, filter->data)); + CK((*filter->output_function)((c >> 8) & 0xff, filter->data)); + CK((*filter->output_function)((c >> 16) & 0xff, filter->data)); + CK((*filter->output_function)((c >> 24) & 0xff, filter->data)); + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_byte4.h b/ext/mbstring/libmbfl/filters/mbfilter_byte4.h new file mode 100644 index 0000000000..f6c0aed2be --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_byte4.h @@ -0,0 +1,46 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifndef MBFL_MBFILTER_BYTE4_H +#define MBFL_MBFILTER_BYTE4_H + +extern const mbfl_encoding mbfl_encoding_byte4be; +extern const mbfl_encoding mbfl_encoding_byte4le; +extern const struct mbfl_convert_vtbl vtbl_byte4be_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_byte4be; +extern const struct mbfl_convert_vtbl vtbl_byte4le_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_byte4le; + +int mbfl_filt_conv_wchar_byte4be(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_byte4be_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_byte4le(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_byte4le_wchar(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_BYTE4_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp1251.c b/ext/mbstring/libmbfl/filters/mbfilter_cp1251.c new file mode 100644 index 0000000000..b5ab8e71b5 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp1251.c @@ -0,0 +1,152 @@ +/* + * "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 part: Den V. Tsopa <tdv@edisoft.ru> + * + */ +/* + * The source code included in this files was separated from mbfilter_ru.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_cp1251.h" +#include "unicode_table_cp1251.h" + +static int mbfl_filt_ident_cp1251(int c, mbfl_identify_filter *filter); + +static const char *mbfl_encoding_cp1251_aliases[] = {"CP1251", "CP-1251", "WINDOWS-1251", NULL}; + +const mbfl_encoding mbfl_encoding_cp1251 = { + mbfl_no_encoding_cp1251, + "Windows-1251", + "Windows-1251", + (const char *(*)[])&mbfl_encoding_cp1251_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_cp1251 = { + mbfl_no_encoding_cp1251, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_cp1251 +}; + +const struct mbfl_convert_vtbl vtbl_wchar_cp1251 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_cp1251, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_cp1251, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_cp1251_wchar = { + mbfl_no_encoding_cp1251, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_cp1251_wchar, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * cp1251 => wchar + */ +int +mbfl_filt_conv_cp1251_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < cp1251_ucs_table_min) { + s = c; + } else if (c >= cp1251_ucs_table_min && c < 0x100) { + s = cp1251_ucs_table[c - cp1251_ucs_table_min]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_CP1251; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => cp1251 + */ +int +mbfl_filt_conv_wchar_cp1251(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c < 0x80) { + s = c; + } else { + s = -1; + n = cp1251_ucs_table_len-1; + while (n >= 0) { + if (c == cp1251_ucs_table[n]) { + s = cp1251_ucs_table_min + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_CP1251) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + +/* all of this is so ugly now! */ +static int mbfl_filt_ident_cp1251(int c, mbfl_identify_filter *filter) +{ + if (c >= 0x80 && c < 0xff) + filter->flag = 0; + else + filter->flag = 1; /* not it */ + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp1251.h b/ext/mbstring/libmbfl/filters/mbfilter_cp1251.h new file mode 100644 index 0000000000..6c0f680b29 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp1251.h @@ -0,0 +1,44 @@ +/* + * "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 part: Den V. Tsopa <tdv@edisoft.ru> + * + */ +/* + * the source code included in this files was separated from mbfilter_ru.h + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_CP1251_H +#define MBFL_MBFILTER_CP1251_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_cp1251; +extern const struct mbfl_identify_vtbl vtbl_identify_cp1251; +extern const struct mbfl_convert_vtbl vtbl_wchar_cp1251; +extern const struct mbfl_convert_vtbl vtbl_cp1251_wchar; + +int mbfl_filt_conv_wchar_cp1251(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_cp1251_wchar(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_CP1251_H */ + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp1252.c b/ext/mbstring/libmbfl/filters/mbfilter_cp1252.c new file mode 100644 index 0000000000..ad160821a5 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp1252.c @@ -0,0 +1,147 @@ +/* + * "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 part: Wez Furlong <wez@thebrainroom.com> + * + */ +/* + * the source code included in this files was separated from mbfilter.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_cp1252.h" +#include "unicode_table_cp1252.h" + +static int mbfl_filt_ident_cp1252(int c, mbfl_identify_filter *filter); + +static const char *mbfl_encoding_cp1252_aliases[] = {"cp1252", NULL}; + +const mbfl_encoding mbfl_encoding_cp1252 = { + mbfl_no_encoding_cp1252, + "Windows-1252", + "Windows-1252", + (const char *(*)[])&mbfl_encoding_cp1252_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_cp1252 = { + mbfl_no_encoding_cp1252, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_cp1252 +}; + +const struct mbfl_convert_vtbl vtbl_cp1252_wchar = { + mbfl_no_encoding_cp1252, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_cp1252_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_cp1252 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_cp1252, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_cp1252, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * wchar => cp1252 + */ +int mbfl_filt_conv_wchar_cp1252(int c, mbfl_convert_filter *filter) +{ + int s=-1, n; + + if (c >= 0x100) { + /* look it up from the cp1252 table */ + s = -1; + n = 31; + while (n >= 0) { + if (c == cp1252_ucs_table[n] && c != 0xfffe) { + s = 0x80 + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_1) + { + s = c & MBFL_WCSPLANE_MASK; + } + } + else if (c >= 0 && c < 0x100) { + s = c; + } + if (s >= 0) { + CK((*filter->output_function)(s, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + return c; +} + +/* + * cp1252 => wchar + */ +int mbfl_filt_conv_cp1252_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0x80 && c < 0xa0) { + s = cp1252_ucs_table[c - 0x80]; + } else { + s = c; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* We only distinguish the MS extensions to ISO-8859-1. + * Actually, this is pretty much a NO-OP, since the identification + * system doesn't allow us to discriminate between a positive match, + * a possible match and a definite non-match. + * The problem here is that cp1252 looks like SJIS for certain chars. + * */ +static int mbfl_filt_ident_cp1252(int c, mbfl_identify_filter *filter) +{ + if (c >= 0x80 && c < 0xa0) + filter->flag = 0; + else + filter->flag = 1; /* not it */ + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp1252.h b/ext/mbstring/libmbfl/filters/mbfilter_cp1252.h new file mode 100644 index 0000000000..032c30eb9e --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp1252.h @@ -0,0 +1,43 @@ +/* + * "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 part: Wez Furlong <wez@thebrainroom.com> + * + */ +/* + * the source code included in this files was separated from mbfilter.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_CP1252_H +#define MBFL_MBFILTER_CP1252_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_cp1252; +extern const struct mbfl_identify_vtbl vtbl_identify_cp1252; +extern const struct mbfl_convert_vtbl vtbl_cp1252_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_cp1252; + +int mbfl_filt_conv_wchar_cp1252(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_cp1252_wchar(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_CP1252_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp866.c b/ext/mbstring/libmbfl/filters/mbfilter_cp866.c new file mode 100644 index 0000000000..7725d7a266 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp866.c @@ -0,0 +1,151 @@ +/* + * "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 part: Den V. Tsopa <tdv@edisoft.ru> + * + */ +/* + * The source code included in this files was separated from mbfilter_ru.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_cp866.h" +#include "unicode_table_cp866.h" + +static int mbfl_filt_ident_cp866(int c, mbfl_identify_filter *filter); + +static const char *mbfl_encoding_cp866_aliases[] = {"CP866", "CP-866", "IBM-866", NULL}; + +const mbfl_encoding mbfl_encoding_cp866 = { + mbfl_no_encoding_cp866, + "CP866", + "CP866", + (const char *(*)[])&mbfl_encoding_cp866_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_cp866 = { + mbfl_no_encoding_cp866, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_cp866 +}; + +const struct mbfl_convert_vtbl vtbl_wchar_cp866 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_cp866, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_cp866, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_cp866_wchar = { + mbfl_no_encoding_cp866, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_cp866_wchar, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * cp866 => wchar + */ +int +mbfl_filt_conv_cp866_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < cp866_ucs_table_min) { + s = c; + } else if (c >= cp866_ucs_table_min && c < 0x100) { + s = cp866_ucs_table[c - cp866_ucs_table_min]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_CP866; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => cp866 + */ +int +mbfl_filt_conv_wchar_cp866(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c < 0x80) { + s = c; + } else { + s = -1; + n = cp866_ucs_table_len-1; + while (n >= 0) { + if (c == cp866_ucs_table[n]) { + s = cp866_ucs_table_min + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_CP866) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, 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_cp866(int c, mbfl_identify_filter *filter) +{ + if (c >= 0x80 && c < 0xff) + filter->flag = 0; + else + filter->flag = 1; /* not it */ + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp866.h b/ext/mbstring/libmbfl/filters/mbfilter_cp866.h new file mode 100644 index 0000000000..9cb4e257e3 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp866.h @@ -0,0 +1,41 @@ +/* + * "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 part: Den V. Tsopa <tdv@edisoft.ru> + * + */ +/* + * The source code included in this files was separated from mbfilter_ru.h + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_CP866_H +#define MBFL_MBFILTER_CP866_H + +extern const mbfl_encoding mbfl_encoding_cp866; +extern const struct mbfl_identify_vtbl vtbl_identify_cp866; +extern const struct mbfl_convert_vtbl vtbl_wchar_cp866; +extern const struct mbfl_convert_vtbl vtbl_cp866_wchar; + +int mbfl_filt_conv_cp866_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_cp866(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_CP866_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp932.c b/ext/mbstring/libmbfl/filters/mbfilter_cp932.c new file mode 100644 index 0000000000..80f7bfbc6b --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp932.c @@ -0,0 +1,350 @@ +/* + * "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_ja.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_cp932.h" + +#include "unicode_table_cp932_ext.h" +#include "unicode_table_jis.h" + +static int mbfl_filt_ident_sjiswin(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_win_aliases[] = {"SJIS-open", "CP932", "Windows-31J", "MS_Kanji", NULL}; + +const mbfl_encoding mbfl_encoding_sjis_win = { + mbfl_no_encoding_sjis_win, + "SJIS-win", + "Shift_JIS", + (const char *(*)[])&mbfl_encoding_sjis_win_aliases, + mblen_table_sjis, + MBFL_ENCTYPE_MBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_sjiswin = { + mbfl_no_encoding_sjis_win, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_sjiswin +}; + +const struct mbfl_convert_vtbl vtbl_sjiswin_wchar = { + mbfl_no_encoding_sjis_win, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_sjiswin_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_sjiswin = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_sjis_win, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_sjiswin, + 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) + + +/* + * SJIS-win => wchar + */ +int +mbfl_filt_conv_sjiswin_wchar(int c, mbfl_convert_filter *filter) +{ + int c1, s, s1, s2, w; + + switch (filter->status) { + case 0: + if (c >= 0 && c < 0x80) { /* 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 { + 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 > 0x39 && c < 0xfd && 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 (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-win + */ +int +mbfl_filt_conv_wchar_sjiswin(int c, mbfl_convert_filter *filter) +{ + int c1, c2, s1, s2; + + 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 = 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 (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)); + } + } + + return c; +} + +static int mbfl_filt_ident_sjiswin(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_cp932.h b/ext/mbstring/libmbfl/filters/mbfilter_cp932.h new file mode 100644 index 0000000000..f66baabea5 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp932.h @@ -0,0 +1,43 @@ +/* + * "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_ja.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_CP932_H +#define MBFL_MBFILTER_CP932_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_sjis_win; +extern const struct mbfl_identify_vtbl vtbl_identify_sjiswin; +extern const struct mbfl_convert_vtbl vtbl_sjiswin_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_sjiswin; + +int mbfl_filt_conv_sjiswin_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_sjiswin(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_CP932_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp936.c b/ext/mbstring/libmbfl/filters/mbfilter_cp936.c new file mode 100644 index 0000000000..9cdd0520e8 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp936.c @@ -0,0 +1,228 @@ +/* + * "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_cn.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_cp936.h" + +#include "unicode_table_cp936.h" + +static int mbfl_filt_ident_cp936(int c, mbfl_identify_filter *filter); + +static const unsigned char mblen_table_cp936[] = { /* 0x81-0xFE */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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, 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 +}; + +static const char *mbfl_encoding_cp936_aliases[] = {"CP-936", "GBK", NULL}; + +const mbfl_encoding mbfl_encoding_cp936 = { + mbfl_no_encoding_cp936, + "CP936", + "CP936", + (const char *(*)[])&mbfl_encoding_cp936_aliases, + mblen_table_cp936, + MBFL_ENCTYPE_MBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_cp936 = { + mbfl_no_encoding_cp936, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_cp936 +}; + +const struct mbfl_convert_vtbl vtbl_cp936_wchar = { + mbfl_no_encoding_cp936, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_cp936_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_cp936 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_cp936, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_cp936, + mbfl_filt_conv_common_flush +}; + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * CP936 => wchar + */ +int +mbfl_filt_conv_cp936_wchar(int c, mbfl_convert_filter *filter) +{ + int c1, w; + + switch (filter->status) { + case 0: + if (c >= 0 && c < 0x80) { /* latin */ + CK((*filter->output_function)(c, filter->data)); + } else if (c == 0x80) { /* euro sign */ + CK((*filter->output_function)(0x20ac, filter->data)); + } else if (c > 0x80 && c < 0xff) { /* dbcs lead byte */ + 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: /* dbcs second byte */ + filter->status = 0; + c1 = filter->cache; + if ( c1 < 0xff && c1 > 0x80 && c > 0x39 && c < 0xff && c != 0x7f) { + w = (c1 - 0x81)*192 + (c - 0x40); + if (w >= 0 && w < cp936_ucs_table_size) { + w = cp936_ucs_table[w]; + } else { + w = 0; + } + if (w <= 0) { + w = (c1 << 8) | c; + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_WINCP936; + } + 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 => CP936 + */ +int +mbfl_filt_conv_wchar_cp936(int c, mbfl_convert_filter *filter) +{ + int c1, s; + + s = 0; + if (c >= ucs_a1_cp936_table_min && c < ucs_a1_cp936_table_max) { + s = ucs_a1_cp936_table[c - ucs_a1_cp936_table_min]; + } else if (c >= ucs_a2_cp936_table_min && c < ucs_a2_cp936_table_max) { + s = ucs_a2_cp936_table[c - ucs_a2_cp936_table_min]; + } else if (c >= ucs_a3_cp936_table_min && c < ucs_a3_cp936_table_max) { + s = ucs_a3_cp936_table[c - ucs_a3_cp936_table_min]; + } else if (c >= ucs_i_cp936_table_min && c < ucs_i_cp936_table_max) { + s = ucs_i_cp936_table[c - ucs_i_cp936_table_min]; + } else if (c >= ucs_ci_cp936_table_min && c < ucs_ci_cp936_table_max) { + s = ucs_ci_cp936_table[c - ucs_ci_cp936_table_min]; + } else if (c >= ucs_cf_cp936_table_min && c < ucs_cf_cp936_table_max) { + s = ucs_cf_cp936_table[c - ucs_cf_cp936_table_min]; + } else if (c >= ucs_sfv_cp936_table_min && c < ucs_sfv_cp936_table_max) { + s = ucs_sfv_cp936_table[c - ucs_sfv_cp936_table_min]; + } else if (c >= ucs_hff_cp936_table_min && c < ucs_hff_cp936_table_max) { + s = ucs_hff_cp936_table[c - ucs_hff_cp936_table_min]; + } + if (s <= 0) { + c1 = c & ~MBFL_WCSPLANE_MASK; + if (c1 == MBFL_WCSPLANE_WINCP936) { + s = c & MBFL_WCSPLANE_MASK; + } + if (c == 0) { + s = 0; + } else if (s <= 0) { + s = -1; + } + } + if (s >= 0) { + if (s < 0x80) { /* latin */ + CK((*filter->output_function)(s, filter->data)); + } else { + CK((*filter->output_function)((s >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(s & 0xff, 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_cp936(int c, mbfl_identify_filter *filter) +{ + if (filter->status) { /* kanji second char */ + if (c < 0x40 || c > 0xfe || c == 0x7f) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + } else if (c >= 0 && c < 0x80) { /* latin ok */ + ; + } else if (c > 0x80 && c < 0xff) { /* DBCS lead byte */ + filter->status = 1; + } else { /* bad */ + filter->flag = 1; + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp936.h b/ext/mbstring/libmbfl/filters/mbfilter_cp936.h new file mode 100644 index 0000000000..1bd603d157 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp936.h @@ -0,0 +1,43 @@ +/* + * "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_cn.h + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_CP936_H +#define MBFL_MBFILTER_CP936_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_cp936; +extern const struct mbfl_identify_vtbl vtbl_identify_cp936; +extern const struct mbfl_convert_vtbl vtbl_cp936_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_cp936; + +int mbfl_filt_conv_cp936_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_cp936(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_CP936_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_cn.c b/ext/mbstring/libmbfl/filters/mbfilter_euc_cn.c new file mode 100644 index 0000000000..cc2bcc1cee --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_cn.c @@ -0,0 +1,236 @@ +/* + * "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_cn.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_euc_cn.h" + +#include "unicode_table_cp936.h" + +static int mbfl_filt_ident_euccn(int c, mbfl_identify_filter *filter); + +static const unsigned char mblen_table_euccn[] = { /* 0xA1-0xFE */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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 +}; + +static const char *mbfl_encoding_euc_cn_aliases[] = {"CN-GB", "EUC_CN", "eucCN", "x-euc-cn", "gb2312", NULL}; + +const mbfl_encoding mbfl_encoding_euc_cn = { + mbfl_no_encoding_euc_cn, + "EUC-CN", + "CN-GB", + (const char *(*)[])&mbfl_encoding_euc_cn_aliases, + mblen_table_euccn, + MBFL_ENCTYPE_MBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_euccn = { + mbfl_no_encoding_euc_cn, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_euccn +}; + +const struct mbfl_convert_vtbl vtbl_euccn_wchar = { + mbfl_no_encoding_euc_cn, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_euccn_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_euccn = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_euc_cn, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_euccn, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * EUC-CN => wchar + */ +int +mbfl_filt_conv_euccn_wchar(int c, mbfl_convert_filter *filter) +{ + int c1, w; + + switch (filter->status) { + case 0: + if (c >= 0 && c < 0x80) { /* latin */ + CK((*filter->output_function)(c, filter->data)); + } else if (c > 0xa0 && c < 0xff) { /* dbcs lead byte */ + 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: /* dbcs second byte */ + filter->status = 0; + c1 = filter->cache; + if (c1 > 0xa0 && c1 < 0xff && c > 0xa0 && c < 0xff) { + w = (c1 - 0x81)*192 + (c - 0x40); + if (w >= 0 && w < cp936_ucs_table_size) { + w = cp936_ucs_table[w]; + } else { + w = 0; + } + if (w <= 0) { + w = (c1 << 8) | c; + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_GB2312; + } + 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 => EUC-CN + */ +int +mbfl_filt_conv_wchar_euccn(int c, mbfl_convert_filter *filter) +{ + int c1, c2, s; + + s = 0; + if (c >= ucs_a1_cp936_table_min && c < ucs_a1_cp936_table_max) { + s = ucs_a1_cp936_table[c - ucs_a1_cp936_table_min]; + } else if (c >= ucs_a2_cp936_table_min && c < ucs_a2_cp936_table_max) { + s = ucs_a2_cp936_table[c - ucs_a2_cp936_table_min]; + } else if (c >= ucs_a3_cp936_table_min && c < ucs_a3_cp936_table_max) { + s = ucs_a3_cp936_table[c - ucs_a3_cp936_table_min]; + } else if (c >= ucs_i_cp936_table_min && c < ucs_i_cp936_table_max) { + s = ucs_i_cp936_table[c - ucs_i_cp936_table_min]; + } else if (c >= ucs_hff_cp936_table_min && c < ucs_hff_cp936_table_max) { + s = ucs_hff_cp936_table[c - ucs_hff_cp936_table_min]; + } + c1 = (s >> 8) & 0xff; + c2 = s & 0xff; + + if (c1 < 0xa1 || c2 < 0xa1) { /* exclude CP936 extension */ + s = c; + } + + if (s <= 0) { + c1 = c & ~MBFL_WCSPLANE_MASK; + if (c1 == MBFL_WCSPLANE_GB2312) { + s = c & MBFL_WCSPLANE_MASK; + } + if (c == 0) { + s = 0; + } else if (s <= 0) { + s = -1; + } + } + if (s >= 0) { + if (s < 0x80) { /* latin */ + CK((*filter->output_function)(s, filter->data)); + } else { + CK((*filter->output_function)((s >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(s & 0xff, 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_euccn(int c, mbfl_identify_filter *filter) +{ + switch (filter->status) { + case 0: /* latin */ + if (c >= 0 && c < 0x80) { /* ok */ + ; + } else if (c > 0xa0 && c < 0xff) { /* DBCS lead byte */ + filter->status = 1; + } else { /* bad */ + filter->flag = 1; + } + break; + + case 1: /* got lead byte */ + if (c < 0xa1 || c > 0xfe) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + break; + + default: + filter->status = 0; + break; + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_cn.h b/ext/mbstring/libmbfl/filters/mbfilter_euc_cn.h new file mode 100644 index 0000000000..e72bc08ebf --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_cn.h @@ -0,0 +1,43 @@ +/* + * "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_euc_cn.h + * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_EUC_CN_H +#define MBFL_MBFILTER_EUC_CN_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_euc_cn; +extern const struct mbfl_identify_vtbl vtbl_identify_euccn; +extern const struct mbfl_convert_vtbl vtbl_euccn_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_euccn; + +int mbfl_filt_conv_euccn_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_euccn(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_EUC_CN_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_jp.c b/ext/mbstring/libmbfl/filters/mbfilter_euc_jp.c new file mode 100644 index 0000000000..f5c9643772 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_jp.c @@ -0,0 +1,331 @@ +/* + * "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_ja.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_euc_jp.h" + +#include "unicode_table_cp932_ext.h" +#include "unicode_table_jis.h" + +static int mbfl_filt_ident_eucjp(int c, mbfl_identify_filter *filter); + +static const unsigned char mblen_table_eucjp[] = { /* 0xA1-0xFE */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 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, 3, + 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, 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, 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 +}; + +static const char *mbfl_encoding_euc_jp_aliases[] = {"EUC", "EUC_JP", "eucJP", "x-euc-jp", NULL}; + +const mbfl_encoding mbfl_encoding_euc_jp = { + mbfl_no_encoding_euc_jp, + "EUC-JP", + "EUC-JP", + (const char *(*)[])&mbfl_encoding_euc_jp_aliases, + mblen_table_eucjp, + MBFL_ENCTYPE_MBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_eucjp = { + mbfl_no_encoding_euc_jp, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_eucjp +}; + +const struct mbfl_convert_vtbl vtbl_eucjp_wchar = { + mbfl_no_encoding_euc_jp, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_eucjp_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_eucjp = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_euc_jp, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_eucjp, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * EUC-JP => wchar + */ +int +mbfl_filt_conv_eucjp_wchar(int c, mbfl_convert_filter *filter) +{ + int c1, s, w; + + switch (filter->status) { + case 0: + if (c >= 0 && c < 0x80) { /* latin */ + CK((*filter->output_function)(c, filter->data)); + } else if (c > 0xa0 && c < 0xff) { /* X 0208 first char */ + filter->status = 1; + filter->cache = c; + } else if (c == 0x8e) { /* kana first char */ + filter->status = 2; + } else if (c == 0x8f) { /* X 0212 first char */ + filter->status = 3; + } else { + w = c & MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + + case 1: /* got first half */ + filter->status = 0; + c1 = filter->cache; + if (c > 0xa0 && c < 0xff) { + s = (c1 - 0xa1)*94 + c - 0xa1; + if (s >= 0 && s < jisx0208_ucs_table_size) { + w = jisx0208_ucs_table[s]; + } else { + w = 0; + } + if (w <= 0) { + w = ((c1 & 0x7f) << 8) | (c & 0x7f); + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_JIS0208; + } + 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: /* got 0x8e */ + filter->status = 0; + if (c > 0xa0 && c < 0xe0) { + w = 0xfec0 + c; + 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 = 0x8e00 | c; + w &= MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + + case 3: /* got 0x8f, X 0212 first char */ + if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ + CK((*filter->output_function)(c, filter->data)); + filter->status = 0; + } else { + filter->status++; + filter->cache = c; + } + break; + case 4: /* got 0x8f, X 0212 second char */ + filter->status = 0; + c1 = filter->cache; + if (c1 > 0xa0 && c1 < 0xff && c > 0xa0 && c < 0xff) { + s = (c1 - 0xa1)*94 + c - 0xa1; + if (s >= 0 && s < jisx0212_ucs_table_size) { + w = jisx0212_ucs_table[s]; + } else { + w = 0; + } + if (w <= 0) { + w = ((c1 & 0x7f) << 8) | (c & 0x7f); + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_JIS0212; + } + 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 | 0x8f0000; + w &= MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + + default: + filter->status = 0; + break; + } + + return c; +} + +/* + * wchar => EUC-JP + */ +int +mbfl_filt_conv_wchar_eucjp(int c, mbfl_convert_filter *filter) +{ + int c1, s; + + s = 0; + if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) { + s = ucs_a1_jis_table[c - ucs_a1_jis_table_min]; + } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) { + s = ucs_a2_jis_table[c - ucs_a2_jis_table_min]; + } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) { + s = ucs_i_jis_table[c - ucs_i_jis_table_min]; + } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) { + s = ucs_r_jis_table[c - ucs_r_jis_table_min]; + } + if (s <= 0) { + c1 = c & ~MBFL_WCSPLANE_MASK; + if (c1 == MBFL_WCSPLANE_JIS0208) { + s = c & MBFL_WCSPLANE_MASK; + } else if (c1 == MBFL_WCSPLANE_JIS0212) { + s = c & MBFL_WCSPLANE_MASK; + s |= 0x8080; + } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */ + s = 0x2140; + } else if (c == 0xff5e) { /* FULLWIDTH TILDE */ + s = 0x2141; + } else if (c == 0x2225) { /* PARALLEL TO */ + s = 0x2142; + } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */ + s = 0x215d; + } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */ + s = 0x2171; + } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */ + s = 0x2172; + } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */ + s = 0x224c; + } + if (c == 0) { + s = 0; + } else if (s <= 0) { + s = -1; + } + } + if (s >= 0) { + if (s < 0x80) { /* latin */ + CK((*filter->output_function)(s, filter->data)); + } else if (s < 0x100) { /* kana */ + CK((*filter->output_function)(0x8e, filter->data)); + CK((*filter->output_function)(s, filter->data)); + } else if (s < 0x8080) { /* X 0208 */ + CK((*filter->output_function)(((s >> 8) & 0xff) | 0x80, filter->data)); + CK((*filter->output_function)((s & 0xff) | 0x80, filter->data)); + } else { /* X 0212 */ + CK((*filter->output_function)(0x8f, filter->data)); + CK((*filter->output_function)(((s >> 8) & 0xff) | 0x80, filter->data)); + CK((*filter->output_function)((s & 0xff) | 0x80, 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_eucjp(int c, mbfl_identify_filter *filter) +{ + switch (filter->status) { + case 0: /* latin */ + if (c >= 0 && c < 0x80) { /* ok */ + ; + } else if (c > 0xa0 && c < 0xff) { /* kanji first char */ + filter->status = 1; + } else if (c == 0x8e) { /* kana first char */ + filter->status = 2; + } else if (c == 0x8f) { /* X 0212 first char */ + filter->status = 3; + } else { /* bad */ + filter->flag = 1; + } + break; + + case 1: /* got first half */ + if (c < 0xa1 || c > 0xfe) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + break; + + case 2: /* got 0x8e */ + if (c < 0xa1 || c > 0xdf) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + break; + + case 3: /* got 0x8f */ + if (c < 0xa1 || c > 0xfe) { /* bad */ + filter->flag = 1; + } + filter->status++; + break; + case 4: /* got 0x8f */ + if (c < 0xa1 || c > 0xfe) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + break; + + default: + filter->status = 0; + break; + } + + return c; +} + + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_jp.h b/ext/mbstring/libmbfl/filters/mbfilter_euc_jp.h new file mode 100644 index 0000000000..de1212dfa8 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_jp.h @@ -0,0 +1,43 @@ +/* + * "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_ja.h + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_EUC_JP_H +#define MBFL_MBFILTER_EUC_JP_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_euc_jp; +extern const struct mbfl_identify_vtbl vtbl_identify_eucjp; +extern const struct mbfl_convert_vtbl vtbl_eucjp_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_eucjp; + +int mbfl_filt_conv_eucjp_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_eucjp(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_EUC_JP_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_jp_win.c b/ext/mbstring/libmbfl/filters/mbfilter_euc_jp_win.c new file mode 100644 index 0000000000..e57ae69356 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_jp_win.c @@ -0,0 +1,420 @@ +/* + * "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_ja.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_euc_jp_win.h" + +#include "unicode_table_cp932_ext.h" +#include "unicode_table_jis.h" +#include "cp932_table.h" + +static int mbfl_filt_ident_eucjp_win(int c, mbfl_identify_filter *filter); + +static const unsigned char mblen_table_eucjp[] = { /* 0xA1-0xFE */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 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, 3, + 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, 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, 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 +}; + + +static const char *mbfl_encoding_eucjp_win_aliases[] = {"eucJP-open", NULL}; + +const struct mbfl_identify_vtbl vtbl_identify_eucjpwin = { + mbfl_no_encoding_eucjp_win, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_eucjp_win +}; + +const mbfl_encoding mbfl_encoding_eucjp_win = { + mbfl_no_encoding_eucjp_win, + "eucJP-win", + "EUC-JP", + (const char *(*)[])&mbfl_encoding_eucjp_win_aliases, + mblen_table_eucjp, + MBFL_ENCTYPE_MBCS +}; + +const struct mbfl_convert_vtbl vtbl_eucjpwin_wchar = { + mbfl_no_encoding_eucjp_win, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_eucjpwin_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_eucjpwin = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_eucjp_win, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_eucjpwin, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * eucJP-win => wchar + */ +int +mbfl_filt_conv_eucjpwin_wchar(int c, mbfl_convert_filter *filter) +{ + int c1, s, w, n; + + switch (filter->status) { + case 0: + if (c >= 0 && c < 0x80) { /* latin */ + CK((*filter->output_function)(c, filter->data)); + } else if (c > 0xa0 && c < 0xff) { /* CP932 first char */ + filter->status = 1; + filter->cache = c; + } else if (c == 0x8e) { /* kana first char */ + filter->status = 2; + } else if (c == 0x8f) { /* X 0212 first char */ + filter->status = 3; + } else { + w = c & MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + + case 1: /* got first half */ + filter->status = 0; + c1 = filter->cache; + if (c > 0xa0 && c < 0xff) { + w = 0; + s = (c1 - 0xa1)*94 + c - 0xa1; + 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 >= (84*94)) { /* user (85ku - 94ku) */ + w = s - (84*94) + 0xe000; + } + } + if (w <= 0) { + w = ((c1 & 0x7f) << 8) | (c & 0x7f); + 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: /* got 0x8e, X0201 kana */ + filter->status = 0; + if (c > 0xa0 && c < 0xe0) { + w = 0xfec0 + c; + 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 = 0x8e00 | c; + w &= MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + + case 3: /* got 0x8f, X 0212 first char */ + if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ + CK((*filter->output_function)(c, filter->data)); + filter->status = 0; + } else { + filter->status++; + filter->cache = c; + } + break; + case 4: /* got 0x8f, X 0212 second char */ + filter->status = 0; + c1 = filter->cache; + if (c1 > 0xa0 && c1 < 0xff && c > 0xa0 && c < 0xff) { + s = (c1 - 0xa1)*94 + c - 0xa1; + if (s >= 0 && s < jisx0212_ucs_table_size) { + w = jisx0212_ucs_table[s]; + } else if (s >= (82*94) && s < (84*94)) { /* vender ext3 (83ku - 84ku) <-> CP932 (115ku -120ku) */ + s = (c1<< 8) | c; + w = 0; + n = 0; + while (n < cp932ext3_eucjp_table_size) { + if (s == cp932ext3_eucjp_table[n]) { + if (n < (cp932ext3_ucs_table_max - cp932ext3_ucs_table_min)) { + w = cp932ext3_ucs_table[n]; + } + break; + } + n++; + } + } else if (s >= (84*94)) { /* user (85ku - 94ku) */ + w = s - (84*94) + (0xe000 + (94*10)); + } else { + w = 0; + } + if (w <= 0) { + w = ((c1 & 0x7f) << 8) | (c & 0x7f); + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_JIS0212; + } + 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 | 0x8f0000; + w &= MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + + default: + filter->status = 0; + break; + } + + return c; +} + +/* + * wchar => eucJP-win + */ +int +mbfl_filt_conv_wchar_eucjpwin(int c, mbfl_convert_filter *filter) +{ + int c1, c2, s1; + + s1 = 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 + 10*94)) { /* user (X0208 85ku - 94ku) */ + s1 = c - 0xe000; + c1 = s1/94 + 0x75; + c2 = s1%94 + 0x21; + s1 = (c1 << 8) | c2; + } else if (c >= (0xe000 + 10*94) && c < (0xe000 + 20*94)) { /* user (X0212 85ku - 94ku) */ + s1 = c - (0xe000 + 10*94); + c1 = s1/94 + 0xf5; + c2 = s1%94 + 0xa1; + s1 = (c1 << 8) | c2; + } + if (s1 <= 0) { + c1 = c & ~MBFL_WCSPLANE_MASK; + if (c1 == MBFL_WCSPLANE_WINCP932) { + s1 = c & MBFL_WCSPLANE_MASK; + if (s1 >= ((85 + 0x20) << 8)) { /* 85ku - 120ku */ + s1 = -1; + } + } else if (c1 == MBFL_WCSPLANE_JIS0208) { + s1 = c & MBFL_WCSPLANE_MASK; + if (s1 >= ((85 + 0x20) << 8)) { /* 85ku - 94ku */ + s1 = -1; + } + } else if (c1 == MBFL_WCSPLANE_JIS0212) { + s1 = c & MBFL_WCSPLANE_MASK; + if (s1 >= ((83 + 0x20) << 8)) { /* 83ku - 94ku */ + s1 = -1; + } else { + 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; + } else { + 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 = cp932ext3_ucs_table_max - cp932ext3_ucs_table_min; + while (c1 < c2) { /* CP932 vendor ext3 (115ku - 119ku) */ + if (c == cp932ext3_ucs_table[c1]) { + if (c1 < cp932ext3_eucjp_table_size) { + s1 = cp932ext3_eucjp_table[c1]; + } + break; + } + c1++; + } + } + } + if (c == 0) { + s1 = 0; + } else if (s1 <= 0) { + s1 = -1; + } + } + + if (s1 >= 0) { + if (s1 < 0x80) { /* latin */ + CK((*filter->output_function)(s1, filter->data)); + } else if (s1 < 0x100) { /* kana */ + CK((*filter->output_function)(0x8e, filter->data)); + CK((*filter->output_function)(s1, filter->data)); + } else if (s1 < 0x8080) { /* X 0208 */ + CK((*filter->output_function)(((s1 >> 8) & 0xff) | 0x80, filter->data)); + CK((*filter->output_function)((s1 & 0xff) | 0x80, filter->data)); + } else { /* X 0212 */ + CK((*filter->output_function)(0x8f, filter->data)); + CK((*filter->output_function)(((s1 >> 8) & 0xff) | 0x80, filter->data)); + CK((*filter->output_function)((s1 & 0xff) | 0x80, 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_eucjp_win(int c, mbfl_identify_filter *filter) +{ + switch (filter->status) { + case 0: /* latin */ + if (c >= 0 && c < 0x80) { /* ok */ + ; + } else if (c > 0xa0 && c < 0xff) { /* kanji first char */ + filter->status = 1; + } else if (c == 0x8e) { /* kana first char */ + filter->status = 2; + } else if (c == 0x8f) { /* X 0212 first char */ + filter->status = 3; + } else { /* bad */ + filter->flag = 1; + } + break; + + case 1: /* got first half */ + if (c < 0xa1 || c > 0xfe) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + break; + + case 2: /* got 0x8e */ + if (c < 0xa1 || c > 0xdf) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + break; + + case 3: /* got 0x8f */ + if (c < 0xa1 || c > 0xfe) { /* bad */ + filter->flag = 1; + } + filter->status++; + break; + case 4: /* got 0x8f */ + if (c < 0xa1 || c > 0xfe) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + break; + + default: + filter->status = 0; + break; + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_jp_win.h b/ext/mbstring/libmbfl/filters/mbfilter_euc_jp_win.h new file mode 100644 index 0000000000..8b79a7241f --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_jp_win.h @@ -0,0 +1,43 @@ +/* + * "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_ja.h + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_EUC_JP_WIN_H +#define MBFL_MBFILTER_EUC_JP_WIN_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_eucjp_win; +extern const struct mbfl_identify_vtbl vtbl_identify_eucjpwin; +extern const struct mbfl_convert_vtbl vtbl_eucjpwin_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_eucjpwin; + +int mbfl_filt_conv_eucjpwin_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_eucjpwin(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_EUC_JP_WIN_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_kr.c b/ext/mbstring/libmbfl/filters/mbfilter_euc_kr.c new file mode 100644 index 0000000000..211a3ad5ad --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_kr.c @@ -0,0 +1,256 @@ +/* + * "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_kr.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_euc_kr.h" +#include "unicode_table_uhc.h" + +static int mbfl_filt_ident_euckr(int c, mbfl_identify_filter *filter); + +static const unsigned char mblen_table_euckr[] = { /* 0xA1-0xFE */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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 +}; + +static const char *mbfl_encoding_euc_kr_aliases[] = {"EUC_KR", "eucKR", "x-euc-kr", NULL}; + +const mbfl_encoding mbfl_encoding_euc_kr = { + mbfl_no_encoding_euc_kr, + "EUC-KR", + "EUC-KR", + (const char *(*)[])&mbfl_encoding_euc_kr_aliases, + mblen_table_euckr, + MBFL_ENCTYPE_MBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_euckr = { + mbfl_no_encoding_euc_kr, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_euckr +}; + +const struct mbfl_convert_vtbl vtbl_euckr_wchar = { + mbfl_no_encoding_euc_kr, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_euckr_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_euckr = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_euc_kr, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_euckr, + mbfl_filt_conv_common_flush +}; + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * EUC-KR => wchar + */ +int +mbfl_filt_conv_euckr_wchar(int c, mbfl_convert_filter *filter) +{ + int c1, w, flag; + + switch (filter->status) { + case 0: + if (c >= 0 && c < 0x80) { /* latin */ + CK((*filter->output_function)(c, filter->data)); + } else if (c > 0xa0 && c < 0xff && c != 0xc9) { /* dbcs lead byte */ + 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: /* dbcs second byte */ + filter->status = 0; + c1 = filter->cache; + flag = 0; + if (c1 >= 0xa1 && c1 <= 0xc6) { + flag = 1; + } else if (c1 >= 0xc7 && c1 <= 0xfe && c1 != 0xc9) { + flag = 2; + } + if (flag > 0 && c >= 0xa1 && c <= 0xfe) { + if (flag == 1){ /* 1st: 0xa1..0xc6, 2nd: 0x41..0x7a, 0x81..0xfe */ + w = (c1 - 0xa1)*190 + (c - 0x41); + if (w >= 0 && w < uhc2_ucs_table_size) { + w = uhc2_ucs_table[w]; + } else { + w = 0; + } + } else { /* 1st: 0xc7..0xc8,0xca..0xfe, 2nd: 0xa1..0xfe */ + w = (c1 - 0xc7)*94 + (c - 0xa1); + if (w >= 0 && w < uhc3_ucs_table_size) { + w = uhc3_ucs_table[w]; + } else { + w = 0; + } + } + + if (w <= 0) { + w = (c1 << 8) | c; + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_KSC5601; + } + 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 => EUC-KR + */ +int +mbfl_filt_conv_wchar_euckr(int c, mbfl_convert_filter *filter) +{ + int c1, c2, s; + + s = 0; + + if (c >= ucs_a1_uhc_table_min && c < ucs_a1_uhc_table_max) { + s = ucs_a1_uhc_table[c - ucs_a1_uhc_table_min]; + } else if (c >= ucs_a2_uhc_table_min && c < ucs_a2_uhc_table_max) { + s = ucs_a2_uhc_table[c - ucs_a2_uhc_table_min]; + } else if (c >= ucs_a3_uhc_table_min && c < ucs_a3_uhc_table_max) { + s = ucs_a3_uhc_table[c - ucs_a3_uhc_table_min]; + } else if (c >= ucs_i_uhc_table_min && c < ucs_i_uhc_table_max) { + s = ucs_i_uhc_table[c - ucs_i_uhc_table_min]; + } else if (c >= ucs_s_uhc_table_min && c < ucs_s_uhc_table_max) { + s = ucs_s_uhc_table[c - ucs_s_uhc_table_min]; + } else if (c >= ucs_r1_uhc_table_min && c < ucs_r1_uhc_table_max) { + s = ucs_r1_uhc_table[c - ucs_r1_uhc_table_min]; + } else if (c >= ucs_r2_uhc_table_min && c < ucs_r2_uhc_table_max) { + s = ucs_r2_uhc_table[c - ucs_r2_uhc_table_min]; + } + + c1 = (s >> 8) & 0xff; + c2 = s & 0xff; + /* exclude UHC extension area */ + if (c1 < 0xa1 || c2 < 0xa1){ + s = c; + } + + if (s <= 0) { + c1 = c & ~MBFL_WCSPLANE_MASK; + if (c1 == MBFL_WCSPLANE_KSC5601) { + s = c & MBFL_WCSPLANE_MASK; + } + if (c == 0) { + s = 0; + } else if (s <= 0) { + s = -1; + } + } + if (s >= 0) { + if (s < 0x80) { /* latin */ + CK((*filter->output_function)(s, filter->data)); + } else { + CK((*filter->output_function)((s >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(s & 0xff, 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_euckr(int c, mbfl_identify_filter *filter) +{ + switch (filter->status) { + case 0: /* latin */ + if (c >= 0 && c < 0x80) { /* ok */ + ; + } else if (c > 0xa0 && c < 0xff) { /* DBCS lead byte */ + filter->status = 1; + } else { /* bad */ + filter->flag = 1; + } + break; + + case 1: /* got lead byte */ + if (c < 0xa1 || c > 0xfe) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + break; + + default: + filter->status = 0; + break; + } + + return c; +} diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_kr.h b/ext/mbstring/libmbfl/filters/mbfilter_euc_kr.h new file mode 100644 index 0000000000..5ccbe79445 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_kr.h @@ -0,0 +1,43 @@ +/* + * "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_kr.h + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_EUC_KR_H +#define MBFL_MBFILTER_EUC_KR_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_euc_kr; +extern const struct mbfl_identify_vtbl vtbl_identify_euckr; +extern const struct mbfl_convert_vtbl vtbl_euckr_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_euckr; + +int mbfl_filt_conv_euckr_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_euckr(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_EUC_KR_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_tw.c b/ext/mbstring/libmbfl/filters/mbfilter_euc_tw.c new file mode 100644 index 0000000000..95665d0562 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_tw.c @@ -0,0 +1,329 @@ +/* + * "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: Rui Hirokawa <hirokawa@php.net> + * + */ +/* + * The source code included in this files was separated from mbfilter_tw.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_euc_tw.h" + +#include "unicode_table_cns11643.h" + +static int mbfl_filt_ident_euctw(int c, mbfl_identify_filter *filter); + +static const unsigned char mblen_table_euctw[] = { /* 0xA1-0xFE */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 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, 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, 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 +}; + + +static const char *mbfl_encoding_euc_tw_aliases[] = {"EUC_TW", "eucTW", "x-euc-tw", NULL}; + +const mbfl_encoding mbfl_encoding_euc_tw = { + mbfl_no_encoding_euc_tw, + "EUC-TW", + "EUC-TW", + (const char *(*)[])&mbfl_encoding_euc_tw_aliases, + mblen_table_euctw, + MBFL_ENCTYPE_MBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_euctw = { + mbfl_no_encoding_euc_tw, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_euctw +}; + +const struct mbfl_convert_vtbl vtbl_euctw_wchar = { + mbfl_no_encoding_euc_tw, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_euctw_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_euctw = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_euc_tw, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_euctw, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * EUC-TW => wchar + */ +int +mbfl_filt_conv_euctw_wchar(int c, mbfl_convert_filter *filter) +{ + int c1, s, w, plane; + + switch (filter->status) { + case 0: + if (c >= 0 && c < 0x80) { /* latin */ + CK((*filter->output_function)(c, filter->data)); + } else if (c > 0xa0 && c < 0xff) { /* dbcs first byte */ + filter->status = 1; + filter->cache = c; + } else if (c == 0x8e) { /* mbcs first byte */ + filter->status = 2; + filter->cache = c; + } else { + w = c & MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + + case 1: /* mbcs second byte */ + filter->status = 0; + c1 = filter->cache; + if (c > 0xa0 && c < 0xff) { + w = (c1 - 0xa1)*94 + (c - 0xa1); + if (w >= 0 && w < cns11643_1_ucs_table_size) { + w = cns11643_1_ucs_table[w]; + } else { + w = 0; + } + if (w <= 0) { + w = (c1 << 8) | c; + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_CNS11643; + } + 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: /* got 0x8e, first char */ + c1 = filter->cache; + if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ + CK((*filter->output_function)(c, filter->data)); + filter->status = 0; + } else if (c > 0xa0 && c < 0xaf) { + filter->status = 3; + filter->cache = c - 0xa1; + } else { + w = (c1 << 8) | c; + w &= MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + + case 3: /* got 0x8e, third char */ + filter->status = 0; + c1 = filter->cache; + if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ + CK((*filter->output_function)(c, filter->data)); + filter->status = 0; + } else if (c > 0xa0 && c < 0xff) { + filter->status = 4; + filter->cache = (c1 << 8) + c - 0xa1; + } else { + w = (c1 << 8) | c; + w &= MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + + case 4: /* mbcs fourth char */ + filter->status = 0; + c1 = filter->cache; + if (c1 >= 0x100 && c1 <= 0xdff && c > 0xa0 && c < 0xff) { + plane = (c1 & 0xf00) >> 8; + s = (c1 & 0xff)*94 + c - 0xa1; + w = 0; + if (s >= 0) { + if (plane == 1 && s < cns11643_2_ucs_table_size) { + w = cns11643_2_ucs_table[s]; + } + if (plane == 13 && s < cns11643_14_ucs_table_size) { + w = cns11643_14_ucs_table[s]; + } + } + if (w <= 0) { + w = ((c1 & 0x7f) << 8) | (c & 0x7f); + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_CNS11643; + } + 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 | 0x8e0000; + w &= MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + + default: + filter->status = 0; + break; + } + + return c; +} + +/* + * wchar => EUC-TW + */ +int +mbfl_filt_conv_wchar_euctw(int c, mbfl_convert_filter *filter) +{ + int c1, s, plane; + + s = 0; + if (c >= ucs_a1_cns11643_table_min && c < ucs_a1_cns11643_table_max) { + s = ucs_a1_cns11643_table[c - ucs_a1_cns11643_table_min]; + } else if (c >= ucs_a2_cns11643_table_min && c < ucs_a2_cns11643_table_max) { + s = ucs_a2_cns11643_table[c - ucs_a2_cns11643_table_min]; + } else if (c >= ucs_a3_cns11643_table_min && c < ucs_a3_cns11643_table_max) { + s = ucs_a3_cns11643_table[c - ucs_a3_cns11643_table_min]; + } else if (c >= ucs_i_cns11643_table_min && c < ucs_i_cns11643_table_max) { + s = ucs_i_cns11643_table[c - ucs_i_cns11643_table_min]; + } else if (c >= ucs_r_cns11643_table_min && c < ucs_r_cns11643_table_max) { + s = ucs_r_cns11643_table[c - ucs_r_cns11643_table_min]; + } + if (s <= 0) { + c1 = c & ~MBFL_WCSPLANE_MASK; + if (c1 == MBFL_WCSPLANE_CNS11643) { + s = c & MBFL_WCSPLANE_MASK; + } + if (c == 0) { + s = 0; + } else if (s <= 0) { + s = -1; + } + } + if (s >= 0) { + plane = (s & 0x1f0000) >> 16; + if (plane <= 1){ + if (s < 0x80) { /* latin */ + CK((*filter->output_function)(s, filter->data)); + } else { + s = (s & 0xffff) | 0x8080; + CK((*filter->output_function)((s >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(s & 0xff, filter->data)); + } + } else { + s = (0x8ea00000 + (plane << 16)) | ((s & 0xffff) | 0x8080); + CK((*filter->output_function)(0x8e , filter->data)); + CK((*filter->output_function)((s >> 16) & 0xff, filter->data)); + CK((*filter->output_function)((s >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(s & 0xff, 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_euctw(int c, mbfl_identify_filter *filter) +{ + switch (filter->status) { + case 0: /* latin */ + if (c >= 0 && c < 0x80) { /* ok */ + ; + } else if (c > 0xa0 && c < 0xff) { /* DBCS lead byte */ + filter->status = 1; + } else if (c == 0x8e) { /* DBCS lead byte */ + filter->status = 2; + } else { /* bad */ + filter->flag = 1; + } + break; + + case 1: /* got lead byte */ + if (c < 0xa1 || c > 0xfe) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + break; + + case 2: /* got lead byte */ + if (c >= 0xa1 && c < 0xaf) { /* ok */ + filter->status = 3; + } else { + filter->flag = 1; /* bad */ + } + break; + + case 3: /* got lead byte */ + if (c < 0xa1 || c > 0xfe) { /* bad */ + filter->flag = 1; + } + filter->status = 4; + break; + + case 4: /* got lead byte */ + if (c < 0xa1 || c > 0xfe) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + break; + + default: + filter->status = 0; + break; + } + + return c; +} + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_euc_tw.h b/ext/mbstring/libmbfl/filters/mbfilter_euc_tw.h new file mode 100644 index 0000000000..64071809d0 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_euc_tw.h @@ -0,0 +1,43 @@ +/* + * "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: Rui Hirokawa <hirokawa@php.net> + * + */ +/* + * The source code included in this files was separated from mbfilter_tw.h + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_EUC_TW_H +#define MBFL_MBFILTER_EUC_TW_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_euc_tw; +extern const struct mbfl_identify_vtbl vtbl_identify_euctw; +extern const struct mbfl_convert_vtbl vtbl_euctw_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_euctw; + +int mbfl_filt_conv_euctw_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_euctw(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_EUC_TW_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_htmlent.c b/ext/mbstring/libmbfl/filters/mbfilter_htmlent.c new file mode 100644 index 0000000000..39023af475 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_htmlent.c @@ -0,0 +1,255 @@ +/* + * "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 part: Marcus Boerger <marcus.boerger@t-online.de> + * + */ +/* + * The source code included in this files was separated from mbfilter.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif + +#include "mbfilter.h" +#include "mbfilter_htmlent.h" +#include "html_entities.h" + +static const unsigned char mblen_table_html[] = { /* 0x00, 0x80 - 0xFF, only valid for numeric entities */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 +}; + +static const char *mbfl_encoding_html_ent_aliases[] = {"HTML", "html", NULL}; + +const mbfl_encoding mbfl_encoding_html_ent = { + mbfl_no_encoding_html_ent, + "HTML-ENTITIES", + "US-ASCII", + (const char *(*)[])&mbfl_encoding_html_ent_aliases, + NULL, /* mblen_table_html, Do not use table instead calulate length based on entities actually used */ + MBFL_ENCTYPE_HTML_ENT +}; + +const struct mbfl_convert_vtbl vtbl_wchar_html = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_html_ent, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_html_enc, + mbfl_filt_conv_html_enc_flush +}; + +const struct mbfl_convert_vtbl vtbl_html_wchar = { + mbfl_no_encoding_html_ent, + mbfl_no_encoding_wchar, + mbfl_filt_conv_html_dec_ctor, + mbfl_filt_conv_html_dec_dtor, + mbfl_filt_conv_html_dec, + mbfl_filt_conv_html_dec_flush }; + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * any => HTML + */ +int mbfl_filt_conv_html_enc(int c, mbfl_convert_filter *filter) +{ + int tmp[10]; + int i = 0, p = 0, e; + unsigned int uc; + + if (c<256 && mblen_table_html[c]==1) { + CK((*filter->output_function)(c, filter->data)); + } else { + /*php_error_docref("ref.mbstring" TSRMLS_CC, E_NOTICE, "mbfl_filt_conv_html_enc(0x%08X = %d)", c, c);*/ + CK((*filter->output_function)('&', filter->data)); + while (1) { + e = mbfl_html_entity_list[i].code; + if (c < e || e == -1) { + break; + } + if (c == e) { + while(mbfl_html_entity_list[i].name[p]) { + CK((*filter->output_function)((int)mbfl_html_entity_list[i].name[p++], filter->data)); + } + break; + } + i++; + } + i=0; + if (!p) { + CK((*filter->output_function)('#', filter->data)); + uc = (unsigned int)c; + do { + tmp[i++] = '0'+uc%10; + uc /= 10; + } while (uc); + do { + CK((*filter->output_function)(tmp[--i], filter->data)); + } while (i); + } + CK((*filter->output_function)(';', filter->data)); + } + return c; +} + +int mbfl_filt_conv_html_enc_flush(mbfl_convert_filter *filter) +{ + filter->status = 0; + filter->cache = 0; + return 0; +} + +/* + * HTML => any + */ +#define html_enc_buffer_size 16 +static const char html_entity_chars[] = "#0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + +void mbfl_filt_conv_html_dec_ctor(mbfl_convert_filter *filter) +{ + filter->status = 0; + filter->cache = (int)mbfl_malloc(html_enc_buffer_size+1); +} + +void mbfl_filt_conv_html_dec_dtor(mbfl_convert_filter *filter) +{ + filter->status = 0; + if (filter->cache) + { + mbfl_free((void*)filter->cache); + } + filter->cache = 0; +} + +int mbfl_filt_conv_html_dec(int c, mbfl_convert_filter *filter) +{ + int pos, ent = 0; + mbfl_html_entity *entity; + char *buffer = (char*)filter->cache; + + if (!filter->status) { + if (c == '&' ) { + filter->status = 1; + buffer[0] = '&'; + } else { + CK((*filter->output_function)(c, filter->data)); + } + } else { + if (c == ';') { + buffer[filter->status] = 0; + if (buffer[1]=='#') { + /* numeric entity */ + for (pos=2; pos<filter->status; pos++) { + ent = ent*10 + (buffer[pos] - '0'); + } + CK((*filter->output_function)(ent, filter->data)); + filter->status = 0; + /*php_error_docref("ref.mbstring" TSRMLS_CC, E_NOTICE, "mbstring decoded '%s'=%d", buffer, ent);*/ + } else { + /* named entity */ + entity = (mbfl_html_entity *)mbfl_html_entity_list; + while (entity->name) { + if (!strcmp(buffer+1, entity->name)) { + ent = entity->code; + break; + } + entity++; + } + if (ent) { + /* decoded */ + CK((*filter->output_function)(ent, filter->data)); + filter->status = 0; + /*php_error_docref("ref.mbstring" TSRMLS_CC, E_NOTICE,"mbstring decoded '%s'=%d", buffer, ent);*/ + } else { + /* failure */ + buffer[filter->status++] = ';'; + buffer[filter->status] = 0; + /* php_error_docref("ref.mbstring" TSRMLS_CC, E_WARNING, "mbstring cannot decode '%s'", buffer); */ + mbfl_filt_conv_html_dec_flush(filter); + } + } + } else { + /* add character */ + buffer[filter->status++] = c; + /* add character and check */ + if (!strchr(html_entity_chars, c) || filter->status+1==html_enc_buffer_size || (c=='#' && filter->status>2)) + { + /* illegal character or end of buffer */ + if (c=='&') + filter->status--; + buffer[filter->status] = 0; + /* php_error_docref("ref.mbstring" TSRMLS_CC, E_WARNING, "mbstring cannot decode '%s'", buffer)l */ + mbfl_filt_conv_html_dec_flush(filter); + if (c=='&') + { + filter->status = 1; + buffer[0] = '&'; + } + } + } + } + return c; +} + +int mbfl_filt_conv_html_dec_flush(mbfl_convert_filter *filter) +{ + int status, pos = 0; + char *buffer; + + buffer = (char*)filter->cache; + status = filter->status; + /* flush fragments */ + while (status--) { + CK((*filter->output_function)(buffer[pos++], filter->data)); + } + filter->status = 0; + /*filter->buffer = 0; of cause NOT*/ + return 0; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_htmlent.h b/ext/mbstring/libmbfl/filters/mbfilter_htmlent.h new file mode 100644 index 0000000000..bf9e9e305e --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_htmlent.h @@ -0,0 +1,48 @@ +/* + * "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 part: Marcus Boerger <marcus.boerger@t-online.de> + * + */ +/* + * The source code included in this files was separated from mbfilter.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_HTMLENT_H +#define MBFL_MBFILTER_HTMLENT_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_html_ent; +extern const struct mbfl_convert_vtbl vtbl_wchar_html; +extern const struct mbfl_convert_vtbl vtbl_html_wchar; + +void mbfl_filt_conv_html_dec_ctor(mbfl_convert_filter *filter); +void mbfl_filt_conv_html_dec_dtor(mbfl_convert_filter *filter); +int mbfl_filt_conv_html_enc(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_html_enc_flush(mbfl_convert_filter *filter); +int mbfl_filt_conv_html_dec(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_html_dec_flush(mbfl_convert_filter *filter); +void mbfl_filt_conv_html_dec_ctor(mbfl_convert_filter *filter); +void mbfl_filt_conv_html_dec_dtor(mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_HTMLENT_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_hz.c b/ext/mbstring/libmbfl/filters/mbfilter_hz.c new file mode 100644 index 0000000000..7c7eaffc07 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_hz.c @@ -0,0 +1,276 @@ +/* + * "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_cn.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_hz.h" + +#include "unicode_table_cp936.h" + +static int mbfl_filt_ident_hz(int c, mbfl_identify_filter *filter); + +const mbfl_encoding mbfl_encoding_hz = { + mbfl_no_encoding_hz, + "HZ", + "HZ-GB-2312", + NULL, + NULL, + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE +}; + +const struct mbfl_identify_vtbl vtbl_identify_hz = { + mbfl_no_encoding_hz, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_hz +}; + +const struct mbfl_convert_vtbl vtbl_hz_wchar = { + mbfl_no_encoding_hz, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_hz_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_hz = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_hz, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_hz, + mbfl_filt_conv_any_hz_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * HZ => wchar + */ +int +mbfl_filt_conv_hz_wchar(int c, mbfl_convert_filter *filter) +{ + int c1, s, w; + + switch (filter->status & 0xf) { +/* case 0x00: ASCII */ +/* case 0x10: GB2312 */ + case 0: + if (c == 0x7e) { + filter->status += 2; + } else if (filter->status == 0x10 && c > 0x20 && c < 0x7f) { /* DBCS first char */ + filter->cache = c; + filter->status += 1; + } else if (c >= 0 && c < 0x80) { /* latin, CTLs */ + CK((*filter->output_function)(c, filter->data)); + } else { + w = c & MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + +/* case 0x11: GB2312 second char */ + case 1: + filter->status &= ~0xf; + c1 = filter->cache; + if (c1 > 0x20 && c1 < 0x7f && c > 0x20 && c < 0x7f) { + s = (c1 - 1)*192 + c + 0x40; /* GB2312 */ + if (s >= 0 && s < cp936_ucs_table_size) { + w = cp936_ucs_table[s]; + } else { + w = 0; + } + if (w <= 0) { + w = (c1 << 8) | c; + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_GB2312; + } + 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 (c == 0x7d) { /* '}' */ + filter->status = 0x0; + } else if (c == 0x7b) { /* '{' */ + filter->status = 0x10; + } else if (c == 0x7e) { /* '~' */ + filter->status = 0x0; + CK((*filter->output_function)(0x007e, filter->data)); + } + break; + + default: + filter->status = 0; + break; + } + + return c; +} + +/* + * wchar => HZ + */ +int +mbfl_filt_conv_wchar_hz(int c, mbfl_convert_filter *filter) +{ + int s; + + s = 0; + if (c >= ucs_a1_cp936_table_min && c < ucs_a1_cp936_table_max) { + s = ucs_a1_cp936_table[c - ucs_a1_cp936_table_min]; + } else if (c >= ucs_a2_cp936_table_min && c < ucs_a2_cp936_table_max) { + s = ucs_a2_cp936_table[c - ucs_a2_cp936_table_min]; + } else if (c >= ucs_a3_cp936_table_min && c < ucs_a3_cp936_table_max) { + s = ucs_a3_cp936_table[c - ucs_a3_cp936_table_min]; + } else if (c >= ucs_i_cp936_table_min && c < ucs_i_cp936_table_max) { + s = ucs_i_cp936_table[c - ucs_i_cp936_table_min]; + } else if (c >= ucs_hff_cp936_table_min && c < ucs_hff_cp936_table_max) { + s = ucs_hff_cp936_table[c - ucs_hff_cp936_table_min]; + } + if (s & 0x8000) { + s -= 0x8080; + } + + if (s <= 0) { + if (c == 0) { + s = 0; + } else if (s <= 0) { + s = -1; + } + } else if ((s >= 0x80 && s < 0x2121) || (s > 0x8080)) { + s = -1; + } + if (s >= 0) { + if (s < 0x80) { /* ASCII */ + if ((filter->status & 0xff00) != 0) { + CK((*filter->output_function)(0x7e, filter->data)); /* '~' */ + CK((*filter->output_function)(0x7d, filter->data)); /* '}' */ + } + filter->status = 0; + if (s == 0x7e){ + CK((*filter->output_function)(0x7e, filter->data)); + } + CK((*filter->output_function)(s, filter->data)); + } else { /* GB 2312-80 */ + if ((filter->status & 0xff00) != 0x200) { + CK((*filter->output_function)(0x7e, filter->data)); /* '~' */ + CK((*filter->output_function)(0x7b, filter->data)); /* '{' */ + } + filter->status = 0x200; + CK((*filter->output_function)((s >> 8) & 0x7f, filter->data)); + CK((*filter->output_function)(s & 0x7f, filter->data)); + } + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + +int +mbfl_filt_conv_any_hz_flush(mbfl_convert_filter *filter) +{ + /* back to latin */ + if ((filter->status & 0xff00) != 0) { + CK((*filter->output_function)(0x7e, filter->data)); /* ~ */ + CK((*filter->output_function)(0x7d, filter->data)); /* '{' */ + } + filter->status &= 0xff; + return 0; +} + +static int mbfl_filt_ident_hz(int c, mbfl_identify_filter *filter) +{ + switch (filter->status & 0xf) { +/* case 0x00: ASCII */ +/* case 0x10: GB2312 */ + case 0: + if (c == 0x7e) { + filter->status += 2; + } else if (filter->status == 0x10 && c > 0x20 && c < 0x7f) { /* DBCS first char */ + filter->status += 1; + } else if (c >= 0 && c < 0x80) { /* latin, CTLs */ + ; + } else { + filter->flag = 1; /* bad */ + } + break; + +/* case 0x11: GB2312 second char */ + case 1: + filter->status &= ~0xf; + if (c < 0x21 || c > 0x7e) { /* bad */ + filter->flag = 1; + } + break; + + case 2: + if (c == 0x7d) { /* '}' */ + filter->status = 0; + } else if (c == 0x7b) { /* '{' */ + filter->status = 0x10; + } else if (c == 0x7e) { /* '~' */ + filter->status = 0; + } else { + filter->flag = 1; /* bad */ + filter->status &= ~0xf; + } + break; + + default: + filter->status = 0; + break; + } + + return c; +} + + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_hz.h b/ext/mbstring/libmbfl/filters/mbfilter_hz.h new file mode 100644 index 0000000000..1e7ebc334d --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_hz.h @@ -0,0 +1,44 @@ +/* + * "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_cn.h + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_HZ_H +#define MBFL_MBFILTER_HZ_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_hz; +extern const struct mbfl_identify_vtbl vtbl_identify_hz; +extern const struct mbfl_convert_vtbl vtbl_hz_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_hz; + +int mbfl_filt_conv_hz_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_hz(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_any_hz_flush(mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_HZ_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso2022_kr.c b/ext/mbstring/libmbfl/filters/mbfilter_iso2022_kr.c new file mode 100644 index 0000000000..263476d628 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso2022_kr.c @@ -0,0 +1,353 @@ +/* + * "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_kr.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_iso2022_kr.h" +#include "unicode_table_uhc.h" + +static int mbfl_filt_ident_2022kr(int c, mbfl_identify_filter *filter); + +const mbfl_encoding mbfl_encoding_2022kr = { + mbfl_no_encoding_2022kr, + "ISO-2022-KR", + "ISO-2022-KR", + NULL, + NULL, + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE +}; + +const struct mbfl_identify_vtbl vtbl_identify_2022kr = { + mbfl_no_encoding_2022kr, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_2022kr +}; + +const struct mbfl_convert_vtbl vtbl_wchar_2022kr = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_2022kr, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_2022kr, + mbfl_filt_conv_any_2022kr_flush +}; + +const struct mbfl_convert_vtbl vtbl_2022kr_wchar = { + mbfl_no_encoding_2022kr, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_2022kr_wchar, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ISO-2022-KR => wchar + */ +int +mbfl_filt_conv_2022kr_wchar(int c, mbfl_convert_filter *filter) +{ + int c1, w, flag; + +retry: + switch (filter->status & 0xf) { + /* case 0x00: ASCII */ + /* case 0x10: KSC5601 */ + case 0: + if (c == 0x1b) { /* ESC */ + filter->status += 2; + } else if (c == 0x0f) { /* SI (ASCII) */ + filter->status &= ~0xff; + } else if (c == 0x0e) { /* SO (KSC5601) */ + filter->status |= 0x10; + } else if ((filter->status & 0x10) != 0 && c > 0x20 && c < 0x7f) { + /* KSC5601 lead byte */ + filter->cache = c; + filter->status += 1; + } else if ((filter->status & 0x10) == 0 && c >= 0 && c < 0x80) { + /* latin, CTLs */ + CK((*filter->output_function)(c, filter->data)); + } else { + w = c & MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + + case 1: /* dbcs second byte */ + filter->status &= ~0xf; + c1 = filter->cache; + flag = 0; + if (c1 > 0x20 && c1 < 0x47) { + flag = 1; + } else if (c1 >= 0x47 && c1 <= 0x7e && c1 != 0x49) { + flag = 2; + } + if (flag > 0 && c > 0x20 && c < 0x7f) { + if (flag == 1){ + w = (c1 - 0x21)*190 + (c - 0x41) + 0x80; + if (w >= 0 && w < uhc2_ucs_table_size) { + w = uhc2_ucs_table[w]; + } else { + w = 0; + } + } else { + w = (c1 - 0x47)*94 + (c - 0x21); + if (w >= 0 && w < uhc3_ucs_table_size) { + w = uhc3_ucs_table[w]; + } else { + w = 0; + } + } + + if (w <= 0) { + w = (c1 << 8) | c; + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_KSC5601; + } + CK((*filter->output_function)(w, filter->data)); + } else if (c == 0x1b) { /* ESC */ + filter->status++; + } 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: /* ESC */ + if (c == 0x24) { /* '$' */ + filter->status++; + } else { + filter->status &= ~0xf; + CK((*filter->output_function)(0x1b, filter->data)); + goto retry; + } + break; + case 3: /* ESC $ */ + if (c == 0x29) { /* ')' */ + filter->status++; + } else { + filter->status &= ~0xf; + CK((*filter->output_function)(0x1b, filter->data)); + CK((*filter->output_function)(0x24, filter->data)); + goto retry; + } + break; + case 4: /* ESC $ ) */ + if (c == 0x43) { /* 'C' */ + filter->status &= ~0xf; + filter->status |= 0x100; + } else { + filter->status &= ~0xf; + CK((*filter->output_function)(0x1b, filter->data)); + CK((*filter->output_function)(0x24, filter->data)); + CK((*filter->output_function)(0x29, filter->data)); + goto retry; + } + break; + default: + filter->status = 0; + break; + } + + return c; +} + +/* + * wchar => ISO-2022-KR + */ +int +mbfl_filt_conv_wchar_2022kr(int c, mbfl_convert_filter *filter) +{ + int c1, c2, s; + + s = 0; + + if (c >= ucs_a1_uhc_table_min && c < ucs_a1_uhc_table_max) { + s = ucs_a1_uhc_table[c - ucs_a1_uhc_table_min]; + } else if (c >= ucs_a2_uhc_table_min && c < ucs_a2_uhc_table_max) { + s = ucs_a2_uhc_table[c - ucs_a2_uhc_table_min]; + } else if (c >= ucs_a3_uhc_table_min && c < ucs_a3_uhc_table_max) { + s = ucs_a3_uhc_table[c - ucs_a3_uhc_table_min]; + } else if (c >= ucs_i_uhc_table_min && c < ucs_i_uhc_table_max) { + s = ucs_i_uhc_table[c - ucs_i_uhc_table_min]; + } else if (c >= ucs_s_uhc_table_min && c < ucs_s_uhc_table_max) { + s = ucs_s_uhc_table[c - ucs_s_uhc_table_min]; + } else if (c >= ucs_r1_uhc_table_min && c < ucs_r1_uhc_table_max) { + s = ucs_r1_uhc_table[c - ucs_r1_uhc_table_min]; + } else if (c >= ucs_r2_uhc_table_min && c < ucs_r2_uhc_table_max) { + s = ucs_r2_uhc_table[c - ucs_r2_uhc_table_min]; + } + + c1 = (s >> 8) & 0xff; + c2 = s & 0xff; + /* exclude UHC extension area */ + if (c1 < 0xa1 || c2 < 0xa1){ + s = c; + } + if (s & 0x8000) { + s -= 0x8080; + } + + if (s <= 0) { + c1 = c & ~MBFL_WCSPLANE_MASK; + if (c1 == MBFL_WCSPLANE_KSC5601) { + s = c & MBFL_WCSPLANE_MASK; + } + if (c == 0) { + s = 0; + } else if (s <= 0) { + s = -1; + } + } else if ((s >= 0x80 && s < 0x2121) || (s > 0x8080)) { + s = -1; + } + if (s >= 0) { + if (s < 0x80 && s > 0) { /* ASCII */ + if ((filter->status & 0x10) != 0) { + CK((*filter->output_function)(0x0f, filter->data)); /* SI */ + filter->status &= ~0x10; + } + CK((*filter->output_function)(s, filter->data)); + } else { + if ( (filter->status & 0x100) == 0) { + CK((*filter->output_function)(0x1b, filter->data)); /* ESC */ + CK((*filter->output_function)(0x24, filter->data)); /* '$' */ + CK((*filter->output_function)(0x29, filter->data)); /* ')' */ + CK((*filter->output_function)(0x43, filter->data)); /* 'C' */ + filter->status |= 0x100; + } + if ((filter->status & 0x10) == 0) { + CK((*filter->output_function)(0x0e, filter->data)); /* SO */ + filter->status |= 0x10; + } + CK((*filter->output_function)((s >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(s & 0xff, filter->data)); + } + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + +int +mbfl_filt_conv_any_2022kr_flush(mbfl_convert_filter *filter) +{ + /* back to ascii */ + if ((filter->status & 0xff00) != 0) { + CK((*filter->output_function)(0x0f, filter->data)); /* SI */ + } + filter->status &= 0xff; + return 0; +} + +static int mbfl_filt_ident_2022kr(int c, mbfl_identify_filter *filter) +{ +retry: + switch (filter->status & 0xf) { +/* case 0x00: ASCII */ +/* case 0x10: KSC5601 mode */ +/* case 0x20: KSC5601 DBCS */ +/* case 0x40: KSC5601 SBCS */ + case 0: + if (!(filter->status & 0x10)) { + if (c == 0x1b) + filter->status += 2; + } else if (filter->status == 0x20 && c > 0x20 && c < 0x7f) { /* kanji first char */ + filter->status += 1; + } else if (c >= 0 && c < 0x80) { /* latin, CTLs */ + ; + } else { + filter->flag = 1; /* bad */ + } + break; + +/* case 0x21: KSC5601 second char */ + case 1: + filter->status &= ~0xf; + if (c < 0x21 || c > 0x7e) { /* bad */ + filter->flag = 1; + } + break; + + /* ESC */ + case 2: + if (c == 0x24) { /* '$' */ + filter->status++; + } else { + filter->flag = 1; /* bad */ + filter->status &= ~0xf; + goto retry; + } + break; + + /* ESC $ */ + case 3: + if (c == 0x29) { /* ')' */ + filter->status++; + } else { + filter->flag = 1; /* bad */ + filter->status &= ~0xf; + goto retry; + } + break; + + /* ESC $) */ + case 5: + if (c == 0x43) { /* 'C' */ + filter->status = 0x10; + } else { + filter->flag = 1; /* bad */ + filter->status &= ~0xf; + goto retry; + } + break; + + default: + filter->status = 0; + break; + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso2022_kr.h b/ext/mbstring/libmbfl/filters/mbfilter_iso2022_kr.h new file mode 100644 index 0000000000..1dd9f69351 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso2022_kr.h @@ -0,0 +1,44 @@ +/* + * "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_kr.h + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_ISO2022_KR_H +#define MBFL_MBFILTER_ISO2022_KR_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_2022kr; +extern const struct mbfl_identify_vtbl vtbl_identify_2022kr; +extern const struct mbfl_convert_vtbl vtbl_wchar_2022kr; +extern const struct mbfl_convert_vtbl vtbl_2022kr_wchar; + +int mbfl_filt_conv_2022kr_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_2022kr(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_any_2022kr_flush(mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ISO2022_KR_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_1.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_1.c new file mode 100644 index 0000000000..901bbb7eec --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_1.c @@ -0,0 +1,100 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_iso8859_1.h" + +static const char *mbfl_encoding_8859_1_aliases[] = {"ISO_8859-1", "latin1", NULL}; + +const mbfl_encoding mbfl_encoding_8859_1 = { + mbfl_no_encoding_8859_1, + "ISO-8859-1", + "ISO-8859-1", + (const char *(*)[])&mbfl_encoding_8859_1_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_8859_1 = { + mbfl_no_encoding_8859_1, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_true +}; + +const struct mbfl_convert_vtbl vtbl_8859_1_wchar = { + mbfl_no_encoding_8859_1, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_8859_1_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_8859_1 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_8859_1, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_8859_1, + mbfl_filt_conv_common_flush +}; + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ISO-8859-1 => wchar + */ +int mbfl_filt_conv_8859_1_wchar(int c, mbfl_convert_filter *filter) +{ + return (*filter->output_function)(c, filter->data); +} + +/* + * wchar => ISO-8859-1 + */ +int mbfl_filt_conv_wchar_8859_1(int c, mbfl_convert_filter *filter) +{ + if (c >= 0 && c < 0x100) { + CK((*filter->output_function)(c, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_1.h b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_1.h new file mode 100644 index 0000000000..d55a457679 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_1.h @@ -0,0 +1,43 @@ +/* + * "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.h + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_ISO8859_1_H +#define MBFL_MBFILTER_ISO8859_1_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_8859_1; +extern const struct mbfl_identify_vtbl vtbl_identify_8859_1; +extern const struct mbfl_convert_vtbl vtbl_8859_1_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_8859_1; + +int mbfl_filt_conv_8859_1_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_8859_1(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ISO8859_1_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_10.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_10.c new file mode 100644 index 0000000000..b0f80e7a17 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_10.c @@ -0,0 +1,138 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_iso8859_10.h" +#include "unicode_table_iso8859_10.h" + +static const char *mbfl_encoding_8859_10_aliases[] = {"ISO_8859-10", "latin6", NULL}; + +const mbfl_encoding mbfl_encoding_8859_10 = { + mbfl_no_encoding_8859_10, + "ISO-8859-10", + "ISO-8859-10", + (const char *(*)[])&mbfl_encoding_8859_10_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_8859_10 = { + mbfl_no_encoding_8859_10, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_true +}; + +const struct mbfl_convert_vtbl vtbl_8859_10_wchar = { + mbfl_no_encoding_8859_10, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_8859_10_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_8859_10 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_8859_10, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_8859_10, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ISO-8859-10 => wchar + */ +int mbfl_filt_conv_8859_10_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < 0xa0) { + s = c; + } else if (c >= 0xa0 && c < 0x100) { + s = iso8859_10_ucs_table[c - 0xa0]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_8859_10; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => ISO-8859-10 + */ +int mbfl_filt_conv_wchar_8859_10(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c >= 0 && c < 0xa0) { + s = c; + } else { + s = -1; + n = 95; + while (n >= 0) { + if (c == iso8859_10_ucs_table[n]) { + s = 0xa0 + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_10) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_10.h b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_10.h new file mode 100644 index 0000000000..3743422c6d --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_10.h @@ -0,0 +1,43 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_ISO8859_10_H +#define MBFL_MBFILTER_ISO8859_10_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_8859_10; +extern const struct mbfl_identify_vtbl vtbl_identify_8859_10; +extern const struct mbfl_convert_vtbl vtbl_8859_10_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_8859_10; + +int mbfl_filt_conv_8859_10_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_8859_10(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ISO8859_10_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_13.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_13.c new file mode 100644 index 0000000000..674db7e469 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_13.c @@ -0,0 +1,138 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_iso8859_13.h" +#include "unicode_table_iso8859_13.h" + +static const char *mbfl_encoding_8859_13_aliases[] = {"ISO_8859-13", NULL}; + +const mbfl_encoding mbfl_encoding_8859_13 = { + mbfl_no_encoding_8859_13, + "ISO-8859-13", + "ISO-8859-13", + (const char *(*)[])&mbfl_encoding_8859_13_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_8859_13 = { + mbfl_no_encoding_8859_13, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_true +}; + +const struct mbfl_convert_vtbl vtbl_8859_13_wchar = { + mbfl_no_encoding_8859_13, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_8859_13_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_8859_13 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_8859_13, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_8859_13, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ISO-8859-13 => wchar + */ +int mbfl_filt_conv_8859_13_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < 0xa0) { + s = c; + } else if (c >= 0xa0 && c < 0x100) { + s = iso8859_13_ucs_table[c - 0xa0]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_8859_13; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => ISO-8859-13 + */ +int mbfl_filt_conv_wchar_8859_13(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c >= 0 && c < 0xa0) { + s = c; + } else { + s = -1; + n = 95; + while (n >= 0) { + if (c == iso8859_13_ucs_table[n]) { + s = 0xa0 + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_13) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_13.h b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_13.h new file mode 100644 index 0000000000..594575c981 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_13.h @@ -0,0 +1,43 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_ISO8859_13_H +#define MBFL_MBFILTER_ISO8859_13_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_8859_13; +extern const struct mbfl_identify_vtbl vtbl_identify_8859_13; +extern const struct mbfl_convert_vtbl vtbl_8859_13_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_8859_13; + +int mbfl_filt_conv_8859_13_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_8859_13(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ISO8859_13_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_14.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_14.c new file mode 100644 index 0000000000..c0d241c842 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_14.c @@ -0,0 +1,138 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_iso8859_14.h" +#include "unicode_table_iso8859_14.h" + +static const char *mbfl_encoding_8859_14_aliases[] = {"ISO_8859-14", "latin8", NULL}; + +const mbfl_encoding mbfl_encoding_8859_14 = { + mbfl_no_encoding_8859_14, + "ISO-8859-14", + "ISO-8859-14", + (const char *(*)[])&mbfl_encoding_8859_14_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_8859_14 = { + mbfl_no_encoding_8859_14, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_true +}; + +const struct mbfl_convert_vtbl vtbl_8859_14_wchar = { + mbfl_no_encoding_8859_14, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_8859_14_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_8859_14 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_8859_14, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_8859_14, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ISO-8859-14 => wchar + */ +int mbfl_filt_conv_8859_14_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < 0xa0) { + s = c; + } else if (c >= 0xa0 && c < 0x100) { + s = iso8859_14_ucs_table[c - 0xa0]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_8859_14; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => ISO-8859-14 + */ +int mbfl_filt_conv_wchar_8859_14(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c >= 0 && c < 0xa0) { + s = c; + } else { + s = -1; + n = 95; + while (n >= 0) { + if (c == iso8859_14_ucs_table[n]) { + s = 0xa0 + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_14) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_14.h b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_14.h new file mode 100644 index 0000000000..0006baedb6 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_14.h @@ -0,0 +1,26 @@ +/* + * COPYRIGHT NOTICE + * + * This file is a portion of "streamable kanji code filter and converter" + * library, which is distributed under GNU Lesser General Public License + * version 2.1. + * + * The source code included in this files was separated from mbfilter.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_ISO8859_14_H +#define MBFL_MBFILTER_ISO8859_14_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_8859_14; +extern const struct mbfl_identify_vtbl vtbl_identify_8859_14; +extern const struct mbfl_convert_vtbl vtbl_8859_14_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_8859_14; + +int mbfl_filt_conv_8859_14_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_8859_14(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ISO8859_14_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_15.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_15.c new file mode 100644 index 0000000000..af321d671f --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_15.c @@ -0,0 +1,136 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_iso8859_15.h" +#include "unicode_table_iso8859_15.h" + +static const char *mbfl_encoding_8859_15_aliases[] = {"ISO_8859-15", NULL}; + +const mbfl_encoding mbfl_encoding_8859_15 = { + mbfl_no_encoding_8859_15, + "ISO-8859-15", + "ISO-8859-15", + (const char *(*)[])&mbfl_encoding_8859_15_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_8859_15 = { + mbfl_no_encoding_8859_15, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_true +}; + +const struct mbfl_convert_vtbl vtbl_8859_15_wchar = { + mbfl_no_encoding_8859_15, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_8859_15_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_8859_15 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_8859_15, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_8859_15, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ISO-8859-15 => wchar + */ +int mbfl_filt_conv_8859_15_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < 0xa0) { + s = c; + } else if (c >= 0xa0 && c < 0x100) { + s = iso8859_15_ucs_table[c - 0xa0]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_8859_15; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => ISO-8859-15 + */ +int mbfl_filt_conv_wchar_8859_15(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c >= 0 && c < 0xa0) { + s = c; + } else { + s = -1; + n = 95; + while (n >= 0) { + if (c == iso8859_15_ucs_table[n]) { + s = 0xa0 + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_15) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_15.h b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_15.h new file mode 100644 index 0000000000..b5054dec2c --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_15.h @@ -0,0 +1,26 @@ +/* + * COPYRIGHT NOTICE + * + * This file is a portion of "streamable kanji code filter and converter" + * library, which is distributed under GNU Lesser General Public License + * version 2.1. + * + * The source code included in this files was separated from mbfilter.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_ISO8859_15_H +#define MBFL_MBFILTER_ISO8859_15_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_8859_15; +extern const struct mbfl_identify_vtbl vtbl_identify_8859_15; +extern const struct mbfl_convert_vtbl vtbl_8859_15_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_8859_15; + +int mbfl_filt_conv_8859_15_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_8859_15(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ISO8859_15_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_2.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_2.c new file mode 100644 index 0000000000..c52c72ae62 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_2.c @@ -0,0 +1,139 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_iso8859_2.h" +#include "unicode_table_iso8859_2.h" + +static const char *mbfl_encoding_8859_2_aliases[] = {"ISO_8859-2", "latin2", NULL}; + +const mbfl_encoding mbfl_encoding_8859_2 = { + mbfl_no_encoding_8859_2, + "ISO-8859-2", + "ISO-8859-2", + (const char *(*)[])&mbfl_encoding_8859_2_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_8859_2 = { + mbfl_no_encoding_8859_2, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_true +}; + +const struct mbfl_convert_vtbl vtbl_8859_2_wchar = { + mbfl_no_encoding_8859_2, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_8859_2_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_8859_2 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_8859_2, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_8859_2, + mbfl_filt_conv_common_flush +}; + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ISO-8859-2 => wchar + */ +int mbfl_filt_conv_8859_2_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < 0xa0) { + s = c; + } else if (c >= 0xa0 && c < 0x100) { + s = iso8859_2_ucs_table[c - 0xa0]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_8859_2; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => ISO-8859-2 + */ +int mbfl_filt_conv_wchar_8859_2(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c >= 0 && c < 0xa0) { + s = c; + } else { + s = -1; + n = 95; + while (n >= 0) { + if (c == iso8859_2_ucs_table[n]) { + s = 0xa0 + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_2) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_2.h b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_2.h new file mode 100644 index 0000000000..732e9194e6 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_2.h @@ -0,0 +1,43 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_ISO8859_2_H +#define MBFL_MBFILTER_ISO8859_2_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_8859_2; +extern const struct mbfl_identify_vtbl vtbl_identify_8859_2; +extern const struct mbfl_convert_vtbl vtbl_8859_2_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_8859_2; + +int mbfl_filt_conv_8859_2_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_8859_2(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ISO8859_2_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_3.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_3.c new file mode 100644 index 0000000000..d47098ceb5 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_3.c @@ -0,0 +1,139 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_iso8859_3.h" +#include "unicode_table_iso8859_3.h" + +static const char *mbfl_encoding_8859_3_aliases[] = {"ISO_8859-3", "latin3", NULL}; + +const mbfl_encoding mbfl_encoding_8859_3 = { + mbfl_no_encoding_8859_3, + "ISO-8859-3", + "ISO-8859-3", + (const char *(*)[])&mbfl_encoding_8859_3_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_8859_3 = { + mbfl_no_encoding_8859_3, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_true +}; + +const struct mbfl_convert_vtbl vtbl_8859_3_wchar = { + mbfl_no_encoding_8859_3, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_8859_3_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_8859_3 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_8859_3, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_8859_3, + mbfl_filt_conv_common_flush +}; + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ISO-8859-3 => wchar + */ +int mbfl_filt_conv_8859_3_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < 0xa0) { + s = c; + } else if (c >= 0xa0 && c < 0x100) { + s = iso8859_3_ucs_table[c - 0xa0]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_8859_3; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => ISO-8859-3 + */ +int mbfl_filt_conv_wchar_8859_3(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c >= 0 && c < 0xa0) { + s = c; + } else { + s = -1; + n = 95; + while (n >= 0) { + if (c == iso8859_3_ucs_table[n]) { + s = 0xa0 + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_3) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_3.h b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_3.h new file mode 100644 index 0000000000..88ab3be6cd --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_3.h @@ -0,0 +1,43 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_ISO8859_3_H +#define MBFL_MBFILTER_ISO8859_3_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_8859_3; +extern const struct mbfl_identify_vtbl vtbl_identify_8859_3; +extern const struct mbfl_convert_vtbl vtbl_8859_3_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_8859_3; + +int mbfl_filt_conv_8859_3_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_8859_3(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ISO8859_3_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_4.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_4.c new file mode 100644 index 0000000000..65c539eb4a --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_4.c @@ -0,0 +1,137 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_iso8859_4.h" +#include "unicode_table_iso8859_4.h" + +static const char *mbfl_encoding_8859_4_aliases[] = {"ISO_8859-4", "latin4", NULL}; + +const mbfl_encoding mbfl_encoding_8859_4 = { + mbfl_no_encoding_8859_4, + "ISO-8859-4", + "ISO-8859-4", + (const char *(*)[])&mbfl_encoding_8859_4_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_8859_4 = { + mbfl_no_encoding_8859_4, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_true }; + +const struct mbfl_convert_vtbl vtbl_8859_4_wchar = { + mbfl_no_encoding_8859_4, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_8859_4_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_8859_4 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_8859_4, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_8859_4, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ISO-8859-4 => wchar + */ +int mbfl_filt_conv_8859_4_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < 0xa0) { + s = c; + } else if (c >= 0xa0 && c < 0x100) { + s = iso8859_4_ucs_table[c - 0xa0]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_8859_4; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => ISO-8859-4 + */ +int mbfl_filt_conv_wchar_8859_4(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c >= 0 && c < 0xa0) { + s = c; + } else { + s = -1; + n = 95; + while (n >= 0) { + if (c == iso8859_4_ucs_table[n]) { + s = 0xa0 + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_4) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_4.h b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_4.h new file mode 100644 index 0000000000..c68239100a --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_4.h @@ -0,0 +1,41 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_ISO8859_4_H +#define MBFL_MBFILTER_ISO8859_4_H + +extern const mbfl_encoding mbfl_encoding_8859_4; +extern const struct mbfl_identify_vtbl vtbl_identify_8859_4; +extern const struct mbfl_convert_vtbl vtbl_8859_4_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_8859_4; + +int mbfl_filt_conv_8859_4_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_8859_4(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ISO8859_4_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_5.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_5.c new file mode 100644 index 0000000000..3a41398bf3 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_5.c @@ -0,0 +1,139 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_iso8859_5.h" +#include "unicode_table_iso8859_5.h" + +static const char *mbfl_encoding_8859_5_aliases[] = {"ISO_8859-5", "cyrillic", NULL}; + +const mbfl_encoding mbfl_encoding_8859_5 = { + mbfl_no_encoding_8859_5, + "ISO-8859-5", + "ISO-8859-5", + (const char *(*)[])&mbfl_encoding_8859_5_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_8859_5 = { + mbfl_no_encoding_8859_5, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_true +}; + +const struct mbfl_convert_vtbl vtbl_8859_5_wchar = { + mbfl_no_encoding_8859_5, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_8859_5_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_8859_5 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_8859_5, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_8859_5, + mbfl_filt_conv_common_flush +}; + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ISO-8859-5 => wchar + */ +int mbfl_filt_conv_8859_5_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < 0xa0) { + s = c; + } else if (c >= 0xa0 && c < 0x100) { + s = iso8859_5_ucs_table[c - 0xa0]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_8859_5; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => ISO-8859-5 + */ +int mbfl_filt_conv_wchar_8859_5(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c >= 0 && c < 0xa0) { + s = c; + } else { + s = -1; + n = 95; + while (n >= 0) { + if (c == iso8859_5_ucs_table[n]) { + s = 0xa0 + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_5) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_5.h b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_5.h new file mode 100644 index 0000000000..531c1c1a72 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_5.h @@ -0,0 +1,43 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_ISO8859_5_H +#define MBFL_MBFILTER_ISO8859_5_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_8859_5; +extern const struct mbfl_identify_vtbl vtbl_identify_8859_5; +extern const struct mbfl_convert_vtbl vtbl_8859_5_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_8859_5; + +int mbfl_filt_conv_8859_5_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_8859_5(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ISO8859_5_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_6.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_6.c new file mode 100644 index 0000000000..9823064e7e --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_6.c @@ -0,0 +1,139 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_iso8859_6.h" +#include "unicode_table_iso8859_6.h" + +static const char *mbfl_encoding_8859_6_aliases[] = {"ISO_8859-6", "arabic", NULL}; + +const mbfl_encoding mbfl_encoding_8859_6 = { + mbfl_no_encoding_8859_6, + "ISO-8859-6", + "ISO-8859-6", + (const char *(*)[])&mbfl_encoding_8859_6_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_8859_6 = { + mbfl_no_encoding_8859_6, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_true +}; + +const struct mbfl_convert_vtbl vtbl_8859_6_wchar = { + mbfl_no_encoding_8859_6, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_8859_6_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_8859_6 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_8859_6, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_8859_6, + mbfl_filt_conv_common_flush +}; + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ISO-8859-6 => wchar + */ +int mbfl_filt_conv_8859_6_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < 0xa0) { + s = c; + } else if (c >= 0xa0 && c < 0x100) { + s = iso8859_6_ucs_table[c - 0xa0]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_8859_6; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => ISO-8859-6 + */ +int mbfl_filt_conv_wchar_8859_6(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c >= 0 && c < 0xa0) { + s = c; + } else { + s = -1; + n = 95; + while (n >= 0) { + if (c == iso8859_6_ucs_table[n]) { + s = 0xa0 + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_6) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_6.h b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_6.h new file mode 100644 index 0000000000..bc27f3eb31 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_6.h @@ -0,0 +1,43 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_ISO8859_6_H +#define MBFL_MBFILTER_ISO8859_6_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_8859_6; +extern const struct mbfl_identify_vtbl vtbl_identify_8859_6; +extern const struct mbfl_convert_vtbl vtbl_8859_6_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_8859_6; + +int mbfl_filt_conv_8859_6_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_8859_6(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ISO8859_6_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_7.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_7.c new file mode 100644 index 0000000000..a02ce7fb67 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_7.c @@ -0,0 +1,139 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_iso8859_7.h" +#include "unicode_table_iso8859_7.h" + +static const char *mbfl_encoding_8859_7_aliases[] = {"ISO_8859-7", "greek", NULL}; + +const mbfl_encoding mbfl_encoding_8859_7 = { + mbfl_no_encoding_8859_7, + "ISO-8859-7", + "ISO-8859-7", + (const char *(*)[])&mbfl_encoding_8859_7_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_8859_7 = { + mbfl_no_encoding_8859_7, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_true +}; + +const struct mbfl_convert_vtbl vtbl_8859_7_wchar = { + mbfl_no_encoding_8859_7, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_8859_7_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_8859_7 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_8859_7, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_8859_7, + mbfl_filt_conv_common_flush +}; + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ISO-8859-7 => wchar + */ +int mbfl_filt_conv_8859_7_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < 0xa0) { + s = c; + } else if (c >= 0xa0 && c < 0x100) { + s = iso8859_7_ucs_table[c - 0xa0]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_8859_7; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => ISO-8859-7 + */ +int mbfl_filt_conv_wchar_8859_7(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c >= 0 && c < 0xa0) { + s = c; + } else { + s = -1; + n = 95; + while (n >= 0) { + if (c == iso8859_7_ucs_table[n]) { + s = 0xa0 + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_7) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_7.h b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_7.h new file mode 100644 index 0000000000..d3042f3e4b --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_7.h @@ -0,0 +1,43 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_ISO8859_7_H +#define MBFL_MBFILTER_ISO8859_7_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_8859_7; +extern const struct mbfl_identify_vtbl vtbl_identify_8859_7; +extern const struct mbfl_convert_vtbl vtbl_8859_7_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_8859_7; + +int mbfl_filt_conv_8859_7_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_8859_7(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ISO8859_7_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_8.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_8.c new file mode 100644 index 0000000000..fa4571aa31 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_8.c @@ -0,0 +1,137 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_iso8859_8.h" +#include "unicode_table_iso8859_8.h" + +static const char *mbfl_encoding_8859_8_aliases[] = {"ISO_8859-8", "hebrew", NULL}; + +const mbfl_encoding mbfl_encoding_8859_8 = { + mbfl_no_encoding_8859_8, + "ISO-8859-8", + "ISO-8859-8", + (const char *(*)[])&mbfl_encoding_8859_8_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_8859_8 = { + mbfl_no_encoding_8859_8, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_true +}; + +const struct mbfl_convert_vtbl vtbl_8859_8_wchar = { + mbfl_no_encoding_8859_8, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_8859_8_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_8859_8 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_8859_8, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_8859_8, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ISO-8859-8 => wchar + */ +int mbfl_filt_conv_8859_8_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < 0xa0) { + s = c; + } else if (c >= 0xa0 && c < 0x100) { + s = iso8859_8_ucs_table[c - 0xa0]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_8859_8; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => ISO-8859-8 + */ +int mbfl_filt_conv_wchar_8859_8(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c >= 0 && c < 0xa0) { + s = c; + } else { + s = -1; + n = 95; + while (n >= 0) { + if (c == iso8859_8_ucs_table[n]) { + s = 0xa0 + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_8) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_8.h b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_8.h new file mode 100644 index 0000000000..884d5095e0 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_8.h @@ -0,0 +1,43 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_ISO8859_8_H +#define MBFL_MBFILTER_ISO8859_8_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_8859_8; +extern const struct mbfl_identify_vtbl vtbl_identify_8859_8; +extern const struct mbfl_convert_vtbl vtbl_8859_8_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_8859_8; + +int mbfl_filt_conv_8859_8_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_8859_8(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ISO8859_8_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_9.c b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_9.c new file mode 100644 index 0000000000..57d2e3777c --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_9.c @@ -0,0 +1,138 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_iso8859_9.h" +#include "unicode_table_iso8859_9.h" + +static const char *mbfl_encoding_8859_9_aliases[] = {"ISO_8859-9", "latin5", NULL}; + +const mbfl_encoding mbfl_encoding_8859_9 = { + mbfl_no_encoding_8859_9, + "ISO-8859-9", + "ISO-8859-9", + (const char *(*)[])&mbfl_encoding_8859_9_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_8859_9 = { + mbfl_no_encoding_8859_9, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_true +}; + +const struct mbfl_convert_vtbl vtbl_8859_9_wchar = { + mbfl_no_encoding_8859_9, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_8859_9_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_8859_9 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_8859_9, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_8859_9, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * ISO-8859-9 => wchar + */ +int mbfl_filt_conv_8859_9_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < 0xa0) { + s = c; + } else if (c >= 0xa0 && c < 0x100) { + s = iso8859_9_ucs_table[c - 0xa0]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_8859_9; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => ISO-8859-9 + */ +int mbfl_filt_conv_wchar_8859_9(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c >= 0 && c < 0xa0) { + s = c; + } else { + s = -1; + n = 95; + while (n >= 0) { + if (c == iso8859_9_ucs_table[n]) { + s = 0xa0 + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_9) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso8859_9.h b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_9.h new file mode 100644 index 0000000000..3731eda82a --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_iso8859_9.h @@ -0,0 +1,43 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_ISO8859_9_H +#define MBFL_MBFILTER_ISO8859_9_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_8859_9; +extern const struct mbfl_identify_vtbl vtbl_identify_8859_9; +extern const struct mbfl_convert_vtbl vtbl_8859_9_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_8859_9; + +int mbfl_filt_conv_8859_9_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_8859_9(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ISO8859_9_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_jis.c b/ext/mbstring/libmbfl/filters/mbfilter_jis.c new file mode 100644 index 0000000000..58336d4e28 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_jis.c @@ -0,0 +1,658 @@ +/* + * "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_ja.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_jis.h" + +#include "unicode_table_cp932_ext.h" +#include "unicode_table_jis.h" + +static int mbfl_filt_ident_jis(int c, mbfl_identify_filter *filter); +static int mbfl_filt_ident_2022jp(int c, mbfl_identify_filter *filter); + +const mbfl_encoding mbfl_encoding_jis = { + mbfl_no_encoding_jis, + "JIS", + "ISO-2022-JP", + NULL, + NULL, + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE +}; + +const mbfl_encoding mbfl_encoding_2022jp = { + mbfl_no_encoding_2022jp, + "ISO-2022-JP", + "ISO-2022-JP", + NULL, + NULL, + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE +}; + +const struct mbfl_identify_vtbl vtbl_identify_jis = { + mbfl_no_encoding_jis, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_jis +}; + +const struct mbfl_identify_vtbl vtbl_identify_2022jp = { + mbfl_no_encoding_2022jp, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_2022jp +}; + +const struct mbfl_convert_vtbl vtbl_jis_wchar = { + mbfl_no_encoding_jis, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_jis_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_jis = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_jis, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_jis, + mbfl_filt_conv_any_jis_flush +}; + +const struct mbfl_convert_vtbl vtbl_2022jp_wchar = { + mbfl_no_encoding_2022jp, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_jis_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_2022jp = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_2022jp, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_2022jp, + mbfl_filt_conv_any_jis_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * JIS => wchar + */ +int +mbfl_filt_conv_jis_wchar(int c, mbfl_convert_filter *filter) +{ + int c1, s, w; + +retry: + switch (filter->status & 0xf) { +/* case 0x00: ASCII */ +/* case 0x10: X 0201 latin */ +/* case 0x20: X 0201 kana */ +/* case 0x80: X 0208 */ +/* case 0x90: X 0212 */ + case 0: + if (c == 0x1b) { + filter->status += 2; + } else if (c == 0x0e) { /* "kana in" */ + filter->status = 0x20; + } else if (c == 0x0f) { /* "kana out" */ + filter->status = 0; + } else if (filter->status == 0x10 && c == 0x5c) { /* YEN SIGN */ + CK((*filter->output_function)(0xa5, filter->data)); + } else if (filter->status == 0x10 && c == 0x7e) { /* OVER LINE */ + 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 */ + filter->cache = c; + filter->status += 1; + } else if (c >= 0 && c < 0x80) { /* latin, CTLs */ + CK((*filter->output_function)(c, filter->data)); + } else if (c > 0xa0 && c < 0xe0) { /* GR kana */ + CK((*filter->output_function)(0xfec0 + c, filter->data)); + } else { + w = c & MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(w, filter->data)); + } + break; + +/* case 0x81: X 0208 second char */ +/* case 0x91: X 0212 second char */ + case 1: + filter->status &= ~0xf; + c1 = filter->cache; + if (c > 0x20 && c < 0x7f) { + s = (c1 - 0x21)*94 + c - 0x21; + if (filter->status == 0x80) { + if (s >= 0 && s < jisx0208_ucs_table_size) { + w = jisx0208_ucs_table[s]; + } else { + w = 0; + } + if (w <= 0) { + w = (c1 << 8) | c; + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_JIS0208; + } + } else { + if (s >= 0 && s < jisx0212_ucs_table_size) { + w = jisx0212_ucs_table[s]; + } else { + w = 0; + } + if (w <= 0) { + w = (c1 << 8) | c; + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_JIS0212; + } + } + CK((*filter->output_function)(w, filter->data)); + } else if (c == 0x1b) { + filter->status += 2; + } 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; + + /* ESC */ +/* case 0x02: */ +/* case 0x12: */ +/* case 0x22: */ +/* case 0x82: */ +/* case 0x92: */ + case 2: + if (c == 0x24) { /* '$' */ + filter->status++; + } else if (c == 0x28) { /* '(' */ + filter->status += 3; + } else { + filter->status &= ~0xf; + CK((*filter->output_function)(0x1b, filter->data)); + goto retry; + } + break; + + /* ESC $ */ +/* case 0x03: */ +/* case 0x13: */ +/* case 0x23: */ +/* case 0x83: */ +/* case 0x93: */ + case 3: + if (c == 0x40 || c == 0x42) { /* '@' or 'B' */ + filter->status = 0x80; + } else if (c == 0x28) { /* '(' */ + filter->status++; + } else { + filter->status &= ~0xf; + CK((*filter->output_function)(0x1b, filter->data)); + CK((*filter->output_function)(0x24, filter->data)); + goto retry; + } + break; + + /* ESC $ ( */ +/* case 0x04: */ +/* case 0x14: */ +/* case 0x24: */ +/* case 0x84: */ +/* case 0x94: */ + case 4: + if (c == 0x40 || c == 0x42) { /* '@' or 'B' */ + filter->status = 0x80; + } else if (c == 0x44) { /* 'D' */ + filter->status = 0x90; + } else { + filter->status &= ~0xf; + CK((*filter->output_function)(0x1b, filter->data)); + CK((*filter->output_function)(0x24, filter->data)); + CK((*filter->output_function)(0x28, filter->data)); + goto retry; + } + break; + + /* ESC ( */ +/* case 0x05: */ +/* case 0x15: */ +/* case 0x25: */ +/* case 0x85: */ +/* case 0x95: */ + case 5: + if (c == 0x42 || c == 0x48) { /* 'B' or 'H' */ + filter->status = 0; + } else if (c == 0x4a) { /* 'J' */ + filter->status = 0x10; + } else if (c == 0x49) { /* 'I' */ + filter->status = 0x20; + } else { + filter->status &= ~0xf; + CK((*filter->output_function)(0x1b, filter->data)); + CK((*filter->output_function)(0x28, filter->data)); + goto retry; + } + break; + + default: + filter->status = 0; + break; + } + + return c; +} + +/* + * wchar => JIS + */ +int +mbfl_filt_conv_wchar_jis(int c, mbfl_convert_filter *filter) +{ + int c1, s; + + s = 0; + if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) { + s = ucs_a1_jis_table[c - ucs_a1_jis_table_min]; + } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) { + s = ucs_a2_jis_table[c - ucs_a2_jis_table_min]; + } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) { + s = ucs_i_jis_table[c - ucs_i_jis_table_min]; + } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) { + s = ucs_r_jis_table[c - ucs_r_jis_table_min]; + } + if (s <= 0) { + c1 = c & ~MBFL_WCSPLANE_MASK; + if (c1 == MBFL_WCSPLANE_JIS0208) { + s = c & MBFL_WCSPLANE_MASK; + } else if (c1 == MBFL_WCSPLANE_JIS0212) { + s = c & MBFL_WCSPLANE_MASK; + s |= 0x8080; + } else if (c == 0xa5) { /* YEN SIGN */ + s = 0x1005c; + } else if (c == 0x203e) { /* OVER LINE */ + s = 0x1007e; + } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */ + s = 0x2140; + } else if (c == 0xff5e) { /* FULLWIDTH TILDE */ + s = 0x2141; + } else if (c == 0x2225) { /* PARALLEL TO */ + s = 0x2142; + } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */ + s = 0x215d; + } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */ + s = 0x2171; + } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */ + s = 0x2172; + } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */ + s = 0x224c; + } + if (c == 0) { + s = 0; + } else if (s <= 0) { + s = -1; + } + } + if (s >= 0) { + if (s < 0x80) { /* ASCII */ + if ((filter->status & 0xff00) != 0) { + CK((*filter->output_function)(0x1b, filter->data)); /* ESC */ + CK((*filter->output_function)(0x28, filter->data)); /* '(' */ + CK((*filter->output_function)(0x42, filter->data)); /* 'B' */ + } + filter->status = 0; + CK((*filter->output_function)(s, filter->data)); + } else if (s < 0x100) { /* kana */ + if ((filter->status & 0xff00) != 0x100) { + CK((*filter->output_function)(0x1b, filter->data)); /* ESC */ + CK((*filter->output_function)(0x28, filter->data)); /* '(' */ + CK((*filter->output_function)(0x49, filter->data)); /* 'I' */ + } + filter->status = 0x100; + CK((*filter->output_function)(s & 0x7f, filter->data)); + } else if (s < 0x8080) { /* X 0208 */ + if ((filter->status & 0xff00) != 0x200) { + CK((*filter->output_function)(0x1b, filter->data)); /* ESC */ + CK((*filter->output_function)(0x24, filter->data)); /* '$' */ + CK((*filter->output_function)(0x42, filter->data)); /* 'B' */ + } + filter->status = 0x200; + CK((*filter->output_function)((s >> 8) & 0x7f, filter->data)); + CK((*filter->output_function)(s & 0x7f, filter->data)); + } else if (s < 0x10000) { /* X 0212 */ + if ((filter->status & 0xff00) != 0x300) { + CK((*filter->output_function)(0x1b, filter->data)); /* ESC */ + CK((*filter->output_function)(0x24, filter->data)); /* '$' */ + CK((*filter->output_function)(0x28, filter->data)); /* '(' */ + CK((*filter->output_function)(0x44, filter->data)); /* 'D' */ + } + filter->status = 0x300; + CK((*filter->output_function)((s >> 8) & 0x7f, filter->data)); + CK((*filter->output_function)(s & 0x7f, filter->data)); + } else { /* X 0201 latin */ + if ((filter->status & 0xff00) != 0x400) { + CK((*filter->output_function)(0x1b, filter->data)); /* ESC */ + CK((*filter->output_function)(0x28, filter->data)); /* '(' */ + CK((*filter->output_function)(0x4a, filter->data)); /* 'J' */ + } + filter->status = 0x400; + CK((*filter->output_function)(s & 0x7f, filter->data)); + } + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + +/* + * wchar => ISO-2022-JP + */ +int +mbfl_filt_conv_wchar_2022jp(int c, mbfl_convert_filter *filter) +{ + int s; + + s = 0; + if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) { + s = ucs_a1_jis_table[c - ucs_a1_jis_table_min]; + } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) { + s = ucs_a2_jis_table[c - ucs_a2_jis_table_min]; + } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) { + s = ucs_i_jis_table[c - ucs_i_jis_table_min]; + } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) { + s = ucs_r_jis_table[c - ucs_r_jis_table_min]; + } + if (s <= 0) { + if (c == 0xa5) { /* YEN SIGN */ + s = 0x1005c; + } else if (c == 0x203e) { /* OVER LINE */ + s = 0x1007e; + } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */ + s = 0x2140; + } else if (c == 0xff5e) { /* FULLWIDTH TILDE */ + s = 0x2141; + } else if (c == 0x2225) { /* PARALLEL TO */ + s = 0x2142; + } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */ + s = 0x215d; + } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */ + s = 0x2171; + } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */ + s = 0x2172; + } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */ + s = 0x224c; + } + if (c == 0) { + s = 0; + } else if (s <= 0) { + s = -1; + } + } else if ((s >= 0x80 && s < 0x2121) || (s > 0x8080)) { + s = -1; + } + if (s >= 0) { + if (s < 0x80) { /* ASCII */ + if ((filter->status & 0xff00) != 0) { + CK((*filter->output_function)(0x1b, filter->data)); /* ESC */ + CK((*filter->output_function)(0x28, filter->data)); /* '(' */ + CK((*filter->output_function)(0x42, filter->data)); /* 'B' */ + } + filter->status = 0; + CK((*filter->output_function)(s, filter->data)); + } else if (s < 0x10000) { /* X 0208 */ + if ((filter->status & 0xff00) != 0x200) { + CK((*filter->output_function)(0x1b, filter->data)); /* ESC */ + CK((*filter->output_function)(0x24, filter->data)); /* '$' */ + CK((*filter->output_function)(0x42, filter->data)); /* 'B' */ + } + filter->status = 0x200; + CK((*filter->output_function)((s >> 8) & 0x7f, filter->data)); + CK((*filter->output_function)(s & 0x7f, filter->data)); + } else { /* X 0201 latin */ + if ((filter->status & 0xff00) != 0x400) { + CK((*filter->output_function)(0x1b, filter->data)); /* ESC */ + CK((*filter->output_function)(0x28, filter->data)); /* '(' */ + CK((*filter->output_function)(0x4a, filter->data)); /* 'J' */ + } + filter->status = 0x400; + CK((*filter->output_function)(s & 0x7f, filter->data)); + } + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + +int +mbfl_filt_conv_any_jis_flush(mbfl_convert_filter *filter) +{ + /* back to latin */ + if ((filter->status & 0xff00) != 0) { + CK((*filter->output_function)(0x1b, filter->data)); /* ESC */ + CK((*filter->output_function)(0x28, filter->data)); /* '(' */ + CK((*filter->output_function)(0x42, filter->data)); /* 'B' */ + } + filter->status &= 0xff; + return 0; +} + +static int mbfl_filt_ident_jis(int c, mbfl_identify_filter *filter) +{ +retry: + switch (filter->status & 0xf) { +/* case 0x00: ASCII */ +/* case 0x10: X 0201 latin */ +/* case 0x20: X 0201 kana */ +/* case 0x80: X 0208 */ +/* case 0x90: X 0212 */ + case 0: + if (c == 0x1b) { + filter->status += 2; + } else if (c == 0x0e) { /* "kana in" */ + filter->status = 0x20; + } else if (c == 0x0f) { /* "kana out" */ + filter->status = 0; + } else if ((filter->status == 0x80 || filter->status == 0x90) && c > 0x20 && c < 0x7f) { /* kanji first char */ + filter->status += 1; + } else if (c >= 0 && c < 0x80) { /* latin, CTLs */ + ; + } else { + filter->flag = 1; /* bad */ + } + break; + +/* case 0x81: X 0208 second char */ +/* case 0x91: X 0212 second char */ + case 1: + filter->status &= ~0xf; + if (c == 0x1b) { + goto retry; + } else if (c < 0x21 || c > 0x7e) { /* bad */ + filter->flag = 1; + } + break; + + /* ESC */ + case 2: + if (c == 0x24) { /* '$' */ + filter->status++; + } else if (c == 0x28) { /* '(' */ + filter->status += 3; + } else { + filter->flag = 1; /* bad */ + filter->status &= ~0xf; + goto retry; + } + break; + + /* ESC $ */ + case 3: + if (c == 0x40 || c == 0x42) { /* '@' or 'B' */ + filter->status = 0x80; + } else if (c == 0x28) { /* '(' */ + filter->status++; + } else { + filter->flag = 1; /* bad */ + filter->status &= ~0xf; + goto retry; + } + break; + + /* ESC $ ( */ + case 4: + if (c == 0x40 || c == 0x42) { /* '@' or 'B' */ + filter->status = 0x80; + } else if (c == 0x44) { /* 'D' */ + filter->status = 0x90; + } else { + filter->flag = 1; /* bad */ + filter->status &= ~0xf; + goto retry; + } + break; + + /* ESC ( */ + case 5: + if (c == 0x42 || c == 0x48) { /* 'B' or 'H' */ + filter->status = 0; + } else if (c == 0x4a) { /* 'J' */ + filter->status = 0x10; + } else if (c == 0x49) { /* 'I' */ + filter->status = 0x20; + } else { + filter->flag = 1; /* bad */ + filter->status &= ~0xf; + goto retry; + } + break; + + default: + filter->status = 0; + break; + } + + return c; +} + +static int mbfl_filt_ident_2022jp(int c, mbfl_identify_filter *filter) +{ +retry: + switch (filter->status & 0xf) { +/* case 0x00: ASCII */ +/* case 0x10: X 0201 latin */ +/* case 0x80: X 0208 */ + case 0: + if (c == 0x1b) { + filter->status += 2; + } else if (filter->status == 0x80 && c > 0x20 && c < 0x7f) { /* kanji first char */ + filter->status += 1; + } else if (c >= 0 && c < 0x80) { /* latin, CTLs */ + ; + } else { + filter->flag = 1; /* bad */ + } + break; + +/* case 0x81: X 0208 second char */ + case 1: + if (c == 0x1b) { + filter->status++; + } else { + filter->status &= ~0xf; + if (c < 0x21 || c > 0x7e) { /* bad */ + filter->flag = 1; + } + } + break; + + /* ESC */ + case 2: + if (c == 0x24) { /* '$' */ + filter->status++; + } else if (c == 0x28) { /* '(' */ + filter->status += 3; + } else { + filter->flag = 1; /* bad */ + filter->status &= ~0xf; + goto retry; + } + break; + + /* ESC $ */ + case 3: + if (c == 0x40 || c == 0x42) { /* '@' or 'B' */ + filter->status = 0x80; + } else { + filter->flag = 1; /* bad */ + filter->status &= ~0xf; + goto retry; + } + break; + + /* ESC ( */ + case 5: + if (c == 0x42) { /* 'B' */ + filter->status = 0; + } else if (c == 0x4a) { /* 'J' */ + filter->status = 0x10; + } else { + filter->flag = 1; /* bad */ + filter->status &= ~0xf; + goto retry; + } + break; + + default: + filter->status = 0; + break; + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_jis.h b/ext/mbstring/libmbfl/filters/mbfilter_jis.h new file mode 100644 index 0000000000..0375307263 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_jis.h @@ -0,0 +1,49 @@ +/* + * "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_ja.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_JIS_H +#define MBFL_MBFILTER_JIS_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_jis; +extern const mbfl_encoding mbfl_encoding_2022jp; +extern const struct mbfl_identify_vtbl vtbl_identify_2022jp; +extern const struct mbfl_identify_vtbl vtbl_identify_jis; +extern const struct mbfl_convert_vtbl vtbl_jis_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_jis; +extern const struct mbfl_convert_vtbl vtbl_2022jp_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_2022jp; + +int mbfl_filt_conv_jis_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_jis(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_2022jp(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_any_jis_flush(mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_JIS_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_koi8r.c b/ext/mbstring/libmbfl/filters/mbfilter_koi8r.c new file mode 100644 index 0000000000..892bf15213 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_koi8r.c @@ -0,0 +1,149 @@ +/* + * "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 part: Den V. Tsopa <tdv@edisoft.ru> + * + */ +/* + * The source code included in this files was separated from mbfilter_ru.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_koi8r.h" +#include "unicode_table_koi8r.h" + +static int mbfl_filt_ident_koi8r(int c, mbfl_identify_filter *filter); + +static const char *mbfl_encoding_koi8r_aliases[] = {"KOI8-R", "KOI8R", NULL}; + +const mbfl_encoding mbfl_encoding_koi8r = { + mbfl_no_encoding_koi8r, + "KOI8-R", + "KOI8-R", + (const char *(*)[])&mbfl_encoding_koi8r_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_koi8r = { + mbfl_no_encoding_koi8r, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_koi8r +}; + +const struct mbfl_convert_vtbl vtbl_wchar_koi8r = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_koi8r, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_koi8r, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_koi8r_wchar = { + mbfl_no_encoding_koi8r, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_koi8r_wchar, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * koi8r => wchar + */ +int +mbfl_filt_conv_koi8r_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c >= 0 && c < koi8r_ucs_table_min) { + s = c; + } else if (c >= koi8r_ucs_table_min && c < 0x100) { + s = koi8r_ucs_table[c - koi8r_ucs_table_min]; + if (s <= 0) { + s = c; + s &= MBFL_WCSPLANE_MASK; + s |= MBFL_WCSPLANE_KOI8R; + } + } else { + s = c; + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + } + + CK((*filter->output_function)(s, filter->data)); + + return c; +} + +/* + * wchar => koi8r + */ +int +mbfl_filt_conv_wchar_koi8r(int c, mbfl_convert_filter *filter) +{ + int s, n; + + if (c < 0x80) { + s = c; + } else { + s = -1; + n = koi8r_ucs_table_len-1; + while (n >= 0) { + if (c == koi8r_ucs_table[n]) { + s = koi8r_ucs_table_min + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_KOI8R) { + s = c & MBFL_WCSPLANE_MASK; + } + } + + if (s >= 0) { + CK((*filter->output_function)(s, 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_koi8r(int c, mbfl_identify_filter *filter) +{ + if (c >= 0x80 && c < 0xff) + filter->flag = 0; + else + filter->flag = 1; /* not it */ + return c; +} diff --git a/ext/mbstring/libmbfl/filters/mbfilter_koi8r.h b/ext/mbstring/libmbfl/filters/mbfilter_koi8r.h new file mode 100644 index 0000000000..8298631f97 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_koi8r.h @@ -0,0 +1,50 @@ +/* + * "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 part: Den V. Tsopa <tdv@edisoft.ru> + * + */ +/* + * The source code included in this files was separated from mbfilter_ru.h + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_KOI8R_H +#define MBFL_MBFILTER_KOI8R_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_koi8r; +extern const struct mbfl_identify_vtbl vtbl_identify_koi8r; +extern const struct mbfl_convert_vtbl vtbl_wchar_koi8r; +extern const struct mbfl_convert_vtbl vtbl_koi8r_wchar; + +int mbfl_filt_conv_koi8r_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_koi8r(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_KOI8R_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_qprint.c b/ext/mbstring/libmbfl/filters/mbfilter_qprint.c new file mode 100644 index 0000000000..9b18a1cb2b --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_qprint.c @@ -0,0 +1,233 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_qprint.h" +#include "unicode_prop.h" + +static const char *mbfl_encoding_qprint_aliases[] = {"qprint", NULL}; + +const mbfl_encoding mbfl_encoding_qprint = { + mbfl_no_encoding_qprint, + "Quoted-Printable", + "Quoted-Printable", + (const char *(*)[])&mbfl_encoding_qprint_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_convert_vtbl vtbl_8bit_qprint = { + mbfl_no_encoding_8bit, + mbfl_no_encoding_qprint, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_qprintenc, + mbfl_filt_conv_qprintenc_flush }; + +const struct mbfl_convert_vtbl vtbl_qprint_8bit = { + mbfl_no_encoding_qprint, + mbfl_no_encoding_8bit, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_qprintdec, + mbfl_filt_conv_qprintdec_flush }; + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * any => Quoted-Printable + */ + +int mbfl_filt_conv_qprintenc(int c, mbfl_convert_filter *filter) +{ + int s, n; + + switch (filter->status & 0xff) { + case 0: + filter->cache = c; + filter->status++; + break; + default: + s = filter->cache; + filter->cache = c; + n = (filter->status & 0xff00) >> 8; + + if (s == 0) { /* null */ + CK((*filter->output_function)(s, filter->data)); + filter->status &= ~0xff00; + break; + } + + if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0) { + if (s == 0x0a || (s == 0x0d && c != 0x0a)) { /* line feed */ + CK((*filter->output_function)(0x0d, filter->data)); /* CR */ + CK((*filter->output_function)(0x0a, filter->data)); /* LF */ + filter->status &= ~0xff00; + break; + } else if (s == 0x0d) { + break; + } + } + + if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0 && n >= 72) { /* soft line feed */ + CK((*filter->output_function)(0x3d, filter->data)); /* '=' */ + CK((*filter->output_function)(0x0d, filter->data)); /* CR */ + CK((*filter->output_function)(0x0a, filter->data)); /* LF */ + filter->status &= ~0xff00; + } + + if (s <= 0 || s >= 0x80 || s == 0x3d /* not ASCII or '=' */ + || ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) != 0 && + (mbfl_charprop_table[s] & MBFL_CHP_MMHQENC) != 0)) { + /* hex-octet */ + CK((*filter->output_function)(0x3d, filter->data)); /* '=' */ + n = (s >> 4) & 0xf; + if (n < 10) { + n += 48; /* '0' */ + } else { + n += 55; /* 'A' - 10 */ + } + CK((*filter->output_function)(n, filter->data)); + n = s & 0xf; + if (n < 10) { + n += 48; + } else { + n += 55; + } + CK((*filter->output_function)(n, filter->data)); + if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0) { + filter->status += 0x300; + } + } else { + CK((*filter->output_function)(s, filter->data)); + if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0) { + filter->status += 0x100; + } + } + break; + } + + return c; +} + +int mbfl_filt_conv_qprintenc_flush(mbfl_convert_filter *filter) +{ + /* flush filter cache */ + (*filter->filter_function)('\0', filter); + filter->status &= ~0xffff; + filter->cache = 0; + return 0; +} + +/* + * Quoted-Printable => any + */ +int mbfl_filt_conv_qprintdec(int c, mbfl_convert_filter *filter) +{ + int n; + + switch (filter->status) { + case 1: + if ((c >= 0x30 && c <= 0x39) || (c >= 0x41 && c <= 0x46)) { /* 0 - 9 or A - F */ + filter->cache = c; + filter->status = 2; + } else if (c == 0x0d) { /* soft line feed */ + filter->status = 3; + } else if (c == 0x0a) { /* soft line feed */ + filter->status = 0; + } else { + CK((*filter->output_function)(0x3d, filter->data)); /* '=' */ + CK((*filter->output_function)(c, filter->data)); + filter->status = 0; + } + break; + case 2: + n = filter->cache; + if (n >= 0x30 && n <= 0x39) { /* '0' - '9' */ + n -= 48; /* 48 = '0' */ + } else { + n -= 55; /* 55 = 'A' - 10 */ + } + n <<= 4; + if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */ + n += (c - 48); + } else if (c >= 0x41 && c <= 0x46) { /* 'A' - 'F' */ + n += (c - 55); + } else { + CK((*filter->output_function)(0x3d, filter->data)); /* '=' */ + CK((*filter->output_function)(filter->cache, filter->data)); + n = c; + } + CK((*filter->output_function)(n, filter->data)); + filter->status = 0; + break; + case 3: + if (c != 0x0a) { /* LF */ + CK((*filter->output_function)(c, filter->data)); + } + filter->status = 0; + break; + default: + if (c == 0x3d) { /* '=' */ + filter->status = 1; + } else { + CK((*filter->output_function)(c, filter->data)); + } + break; + } + + return c; +} + +int mbfl_filt_conv_qprintdec_flush(mbfl_convert_filter *filter) +{ + int status, cache; + + status = filter->status; + cache = filter->cache; + filter->status = 0; + filter->cache = 0; + /* flush fragments */ + if (status == 1) { + CK((*filter->output_function)(0x3d, filter->data)); /* '=' */ + } else if (status == 2) { + CK((*filter->output_function)(0x3d, filter->data)); /* '=' */ + CK((*filter->output_function)(cache, filter->data)); + } + + return 0; +} + + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_qprint.h b/ext/mbstring/libmbfl/filters/mbfilter_qprint.h new file mode 100644 index 0000000000..3a39fa7402 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_qprint.h @@ -0,0 +1,44 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_QPRINT_H +#define MBFL_MBFILTER_QPRINT_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_qprint; +extern const struct mbfl_convert_vtbl vtbl_8bit_qprint; +extern const struct mbfl_convert_vtbl vtbl_qprint_8bit; + +int mbfl_filt_conv_qprintenc(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_qprintenc_flush(mbfl_convert_filter *filter); +int mbfl_filt_conv_qprintdec(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_qprintdec_flush(mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_ASCII_H */ diff --git a/ext/mbstring/mbfilter_ru.c b/ext/mbstring/libmbfl/filters/mbfilter_ru.c~ index f0bbe69a5f..24847aed5e 100644 --- a/ext/mbstring/mbfilter_ru.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_ru.c~ @@ -4,10 +4,10 @@ +----------------------------------------------------------------------+ | Copyright (c) 2001 The PHP Group | +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | + | This source file is subject to version 2.02 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | + | available at through the world-wide-web at | + | http://www.php.net/license/2_02.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | diff --git a/ext/mbstring/mbfilter_ru.h b/ext/mbstring/libmbfl/filters/mbfilter_ru.h~ index 70613b5ed6..fda4d076b9 100644 --- a/ext/mbstring/mbfilter_ru.h +++ b/ext/mbstring/libmbfl/filters/mbfilter_ru.h~ @@ -4,10 +4,10 @@ +----------------------------------------------------------------------+ | Copyright (c) 2001 The PHP Group | +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | + | This source file is subject to version 2.02 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | + | available at through the world-wide-web at | + | http://www.php.net/license/2_02.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis.c b/ext/mbstring/libmbfl/filters/mbfilter_sjis.c new file mode 100644 index 0000000000..f9d7ff671d --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis.c @@ -0,0 +1,295 @@ +/* + * "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_ja.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_sjis.h" + +#include "unicode_table_cp932_ext.h" +#include "unicode_table_jis.h" + +static int mbfl_filt_ident_sjis(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_aliases[] = {"x-sjis", "SHIFT-JIS", NULL}; + +const mbfl_encoding mbfl_encoding_sjis = { + mbfl_no_encoding_sjis, + "SJIS", + "Shift_JIS", + (const char *(*)[])&mbfl_encoding_sjis_aliases, + mblen_table_sjis, + MBFL_ENCTYPE_MBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_sjis = { + mbfl_no_encoding_sjis, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_sjis +}; + +const struct mbfl_convert_vtbl vtbl_sjis_wchar = { + mbfl_no_encoding_sjis, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_sjis_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_sjis = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_sjis, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_sjis, + 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) + + +/* + * SJIS => wchar + */ +int +mbfl_filt_conv_sjis_wchar(int c, mbfl_convert_filter *filter) +{ + int c1, s1, s2, w; + + switch (filter->status) { + case 0: + if (c >= 0 && c < 0x80) { /* 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 { + 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 > 0x39 && c < 0xfd && c != 0x7f) { + SJIS_DECODE(c1, c, s1, s2); + w = (s1 - 0x21)*94 + s2 - 0x21; + if (w >= 0 && w < jisx0208_ucs_table_size) { + w = jisx0208_ucs_table[w]; + } else { + w = 0; + } + if (w <= 0) { + if (s1 < 0x7f && s2 < 0x7f) { + w = (s1 << 8) | s2; + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_JIS0208; + } else { + w = (c1 << 8) | c; + w &= MBFL_WCSGROUP_MASK; + w |= MBFL_WCSGROUP_THROUGH; + } + } + 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 + */ +int +mbfl_filt_conv_wchar_sjis(int c, mbfl_convert_filter *filter) +{ + int c1, c2, s1, s2; + + s1 = 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]; + } + if (s1 <= 0) { + c1 = c & ~MBFL_WCSPLANE_MASK; + if (c1 == MBFL_WCSPLANE_JIS0208) { + s1 = c & MBFL_WCSPLANE_MASK; + } 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 (c == 0) { + s1 = 0; + } else if (s1 <= 0) { + s1 = -1; + } + } else if (s1 >= 0x8080) { + 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)); + } + } + + return c; +} + +static int mbfl_filt_ident_sjis(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 < 0xf0 && c != 0xa0) { /* kanji first char */ + filter->status = 1; + } else { /* bad */ + filter->flag = 1; + } + + return c; +} + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis.h b/ext/mbstring/libmbfl/filters/mbfilter_sjis.h new file mode 100644 index 0000000000..cb9146fd89 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis.h @@ -0,0 +1,47 @@ +/* + * "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_ja.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_SJIS_H +#define MBFL_MBFILTER_SJIS_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_sjis; +extern const struct mbfl_identify_vtbl vtbl_identify_sjis; +extern const struct mbfl_convert_vtbl vtbl_sjis_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_sjis; + +int mbfl_filt_conv_sjis_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_sjis(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_SJIS_H */ + +/* + * charset=UTF-8 + */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_ucs2.c b/ext/mbstring/libmbfl/filters/mbfilter_ucs2.c new file mode 100644 index 0000000000..4d83af0bf1 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_ucs2.c @@ -0,0 +1,238 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_ucs2.h" + +static const char *mbfl_encoding_ucs2_aliases[] = {"ISO-10646-UCS-2", "UCS2" , "UNICODE", NULL}; + +const mbfl_encoding mbfl_encoding_ucs2 = { + mbfl_no_encoding_ucs2, + "UCS-2", + "UCS-2", + (const char *(*)[])&mbfl_encoding_ucs2_aliases, + NULL, + MBFL_ENCTYPE_WCS2BE +}; + +const mbfl_encoding mbfl_encoding_ucs2be = { + mbfl_no_encoding_ucs2be, + "UCS-2BE", + "UCS-2BE", + NULL, + NULL, + MBFL_ENCTYPE_WCS2BE +}; + +const mbfl_encoding mbfl_encoding_ucs2le = { + mbfl_no_encoding_ucs2le, + "UCS-2LE", + "UCS-2LE", + NULL, + NULL, + MBFL_ENCTYPE_WCS2LE +}; + +const struct mbfl_convert_vtbl vtbl_ucs2_wchar = { + mbfl_no_encoding_ucs2, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_ucs2_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_ucs2 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_ucs2, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_ucs2be, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_ucs2be_wchar = { + mbfl_no_encoding_ucs2be, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_ucs2be_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_ucs2be = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_ucs2be, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_ucs2be, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_ucs2le_wchar = { + mbfl_no_encoding_ucs2le, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_ucs2le_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_ucs2le = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_ucs2le, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_ucs2le, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * UCS-2 => wchar + */ +int mbfl_filt_conv_ucs2_wchar(int c, mbfl_convert_filter *filter) +{ + int n, endian; + + endian = filter->status & 0xff00; + switch (filter->status & 0xff) { + case 0: + if (endian) { + n = c & 0xff; + } else { + n = (c & 0xff) << 8; + } + filter->cache = n; + filter->status++; + break; + default: + if (endian) { + n = (c & 0xff) << 8; + } else { + n = c & 0xff; + } + n |= filter->cache; + if (n == 0xfffe) { + if (endian) { + filter->status = 0; /* big-endian */ + } else { + filter->status = 0x100; /* little-endian */ + } + CK((*filter->output_function)(0xfeff, filter->data)); + } else { + filter->status &= ~0xff; + CK((*filter->output_function)(n, filter->data)); + } + break; + } + + return c; +} + +/* + * UCS-2BE => wchar + */ +int mbfl_filt_conv_ucs2be_wchar(int c, mbfl_convert_filter *filter) +{ + int n; + + if (filter->status == 0) { + filter->status = 1; + n = (c & 0xff) << 8; + filter->cache = n; + } else { + filter->status = 0; + n = (c & 0xff) | filter->cache; + CK((*filter->output_function)(n, filter->data)); + } + return c; +} + +/* + * wchar => UCS-2BE + */ +int mbfl_filt_conv_wchar_ucs2be(int c, mbfl_convert_filter *filter) +{ + if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) { + CK((*filter->output_function)((c >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(c & 0xff, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + +/* + * UCS-2LE => wchar + */ +int mbfl_filt_conv_ucs2le_wchar(int c, mbfl_convert_filter *filter) +{ + int n; + + if (filter->status == 0) { + filter->status = 1; + n = c & 0xff; + filter->cache = n; + } else { + filter->status = 0; + n = ((c & 0xff) << 8) | filter->cache; + CK((*filter->output_function)(n, filter->data)); + } + return c; +} + + +/* + * wchar => UCS-2LE + */ +int mbfl_filt_conv_wchar_ucs2le(int c, mbfl_convert_filter *filter) +{ + if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) { + CK((*filter->output_function)(c & 0xff, filter->data)); + CK((*filter->output_function)((c >> 8) & 0xff, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_ucs2.h b/ext/mbstring/libmbfl/filters/mbfilter_ucs2.h new file mode 100644 index 0000000000..6dd1e65697 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_ucs2.h @@ -0,0 +1,51 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_UCS2_H +#define MBFL_MBFILTER_UCS2_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_ucs2; +extern const mbfl_encoding mbfl_encoding_ucs2be; +extern const mbfl_encoding mbfl_encoding_ucs2le; +extern const struct mbfl_convert_vtbl vtbl_ucs2_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_ucs2; +extern const struct mbfl_convert_vtbl vtbl_ucs2be_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_ucs2be; +extern const struct mbfl_convert_vtbl vtbl_ucs2le_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_ucs2le; + +int mbfl_filt_conv_ucs2_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_ucs2be_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_ucs2be(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_ucs2le_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_ucs2le(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_UCS2_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_ucs4.c b/ext/mbstring/libmbfl/filters/mbfilter_ucs4.c new file mode 100644 index 0000000000..12a2033e0c --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_ucs4.c @@ -0,0 +1,275 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_ucs4.h" + +static const char *mbfl_encoding_ucs4_aliases[] = {"ISO-10646-UCS-4", "UCS4", NULL}; + +const mbfl_encoding mbfl_encoding_ucs4 = { + mbfl_no_encoding_ucs4, + "UCS-4", + "UCS-4", + (const char *(*)[])&mbfl_encoding_ucs4_aliases, + NULL, + MBFL_ENCTYPE_WCS4BE +}; + +const mbfl_encoding mbfl_encoding_ucs4be = { + mbfl_no_encoding_ucs4be, + "UCS-4BE", + "UCS-4BE", + NULL, + NULL, + MBFL_ENCTYPE_WCS4BE +}; + +const mbfl_encoding mbfl_encoding_ucs4le = { + mbfl_no_encoding_ucs4le, + "UCS-4LE", + "UCS-4LE", + NULL, + NULL, + MBFL_ENCTYPE_WCS4LE +}; + +const struct mbfl_convert_vtbl vtbl_ucs4_wchar = { + mbfl_no_encoding_ucs4, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_ucs4_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_ucs4 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_ucs4, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_ucs4be, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_ucs4be_wchar = { + mbfl_no_encoding_ucs4be, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_ucs4be_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_ucs4be = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_ucs4be, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_ucs4be, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_ucs4le_wchar = { + mbfl_no_encoding_ucs4le, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_ucs4le_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_ucs4le = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_ucs4le, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_ucs4le, + mbfl_filt_conv_common_flush +}; + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * UCS-4 => wchar + */ +int mbfl_filt_conv_ucs4_wchar(int c, mbfl_convert_filter *filter) +{ + int n, endian; + + endian = filter->status & 0xff00; + switch (filter->status & 0xff) { + case 0: + if (endian) { + n = c & 0xff; + } else { + n = (c & 0xff) << 24; + } + filter->cache = n; + filter->status++; + break; + case 1: + if (endian) { + n = (c & 0xff) << 8; + } else { + n = (c & 0xff) << 16; + } + filter->cache |= n; + filter->status++; + break; + case 2: + if (endian) { + n = (c & 0xff) << 16; + } else { + n = (c & 0xff) << 8; + } + filter->cache |= n; + filter->status++; + break; + default: + if (endian) { + n = (c & 0xff) << 24; + } else { + n = c & 0xff; + } + n |= filter->cache; + if ((n & 0xffff) == 0 && ((n >> 16) & 0xffff) == 0xfffe) { + if (endian) { + filter->status = 0; /* big-endian */ + } else { + filter->status = 0x100; /* little-endian */ + } + CK((*filter->output_function)(0xfeff, filter->data)); + } else { + filter->status &= ~0xff; + CK((*filter->output_function)(n, filter->data)); + } + break; + } + + return c; +} + +/* + * UCS-4BE => wchar + */ +int mbfl_filt_conv_ucs4be_wchar(int c, mbfl_convert_filter *filter) +{ + int n; + + if (filter->status == 0) { + filter->status = 1; + n = (c & 0xff) << 24; + filter->cache = n; + } else if (filter->status == 1) { + filter->status = 2; + n = (c & 0xff) << 16; + filter->cache |= n; + } else if (filter->status == 2) { + filter->status = 3; + n = (c & 0xff) << 8; + filter->cache |= n; + } else { + filter->status = 0; + n = (c & 0xff) | filter->cache; + CK((*filter->output_function)(n, filter->data)); + } + return c; +} + +/* + * wchar => UCS-4BE + */ +int mbfl_filt_conv_wchar_ucs4be(int c, mbfl_convert_filter *filter) +{ + if (c >= 0 && c < MBFL_WCSGROUP_UCS4MAX) { + CK((*filter->output_function)((c >> 24) & 0xff, filter->data)); + CK((*filter->output_function)((c >> 16) & 0xff, filter->data)); + CK((*filter->output_function)((c >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(c & 0xff, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + +/* + * UCS-4LE => wchar + */ +int mbfl_filt_conv_ucs4le_wchar(int c, mbfl_convert_filter *filter) +{ + int n; + + if (filter->status == 0) { + filter->status = 1; + n = (c & 0xff); + filter->cache = n; + } else if (filter->status == 1) { + filter->status = 2; + n = (c & 0xff) << 8; + filter->cache |= n; + } else if (filter->status == 2) { + filter->status = 3; + n = (c & 0xff) << 16; + filter->cache |= n; + } else { + filter->status = 0; + n = ((c & 0xff) << 24) | filter->cache; + CK((*filter->output_function)(n, filter->data)); + } + return c; +} + +/* + * wchar => UCS-4LE + */ +int mbfl_filt_conv_wchar_ucs4le(int c, mbfl_convert_filter *filter) +{ + if (c >= 0 && c < MBFL_WCSGROUP_UCS4MAX) { + CK((*filter->output_function)(c & 0xff, filter->data)); + CK((*filter->output_function)((c >> 8) & 0xff, filter->data)); + CK((*filter->output_function)((c >> 16) & 0xff, filter->data)); + CK((*filter->output_function)((c >> 24) & 0xff, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_ucs4.h b/ext/mbstring/libmbfl/filters/mbfilter_ucs4.h new file mode 100644 index 0000000000..718c7e1c2c --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_ucs4.h @@ -0,0 +1,49 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_UCS4_H +#define MBFL_MBFILTER_UCS4_H + +extern const mbfl_encoding mbfl_encoding_ucs4; +extern const mbfl_encoding mbfl_encoding_ucs4le; +extern const mbfl_encoding mbfl_encoding_ucs4be; +extern const struct mbfl_convert_vtbl vtbl_ucs4_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_ucs4; +extern const struct mbfl_convert_vtbl vtbl_ucs4be_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_ucs4be; +extern const struct mbfl_convert_vtbl vtbl_ucs4le_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_ucs4le; + +int mbfl_filt_conv_ucs4_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_ucs4be_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_ucs4be(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_ucs4le_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_ucs4le(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_UCS4_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_uhc.c b/ext/mbstring/libmbfl/filters/mbfilter_uhc.c new file mode 100644 index 0000000000..c72d93f5fb --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_uhc.c @@ -0,0 +1,266 @@ +/* + * "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_kr.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_uhc.h" +#include "unicode_table_uhc.h" + +static int mbfl_filt_ident_uhc(int c, mbfl_identify_filter *filter); + +static const unsigned char mblen_table_uhc[] = { /* 0x81-0xFE */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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, 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 +}; + +static const char *mbfl_encoding_uhc_aliases[] = {"CP949", NULL}; + +const mbfl_encoding mbfl_encoding_uhc = { + mbfl_no_encoding_uhc, + "UHC", + "UHC", + (const char *(*)[])&mbfl_encoding_uhc_aliases, + mblen_table_uhc, + MBFL_ENCTYPE_MBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_uhc = { + mbfl_no_encoding_uhc, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_uhc +}; + +const struct mbfl_convert_vtbl vtbl_uhc_wchar = { + mbfl_no_encoding_uhc, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_uhc_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_uhc = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_uhc, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_uhc, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * UHC => wchar + */ +int +mbfl_filt_conv_uhc_wchar(int c, mbfl_convert_filter *filter) +{ + int c1, w = 0, flag = 0; + + switch (filter->status) { + case 0: + if (c >= 0 && c < 0x80) { /* latin */ + CK((*filter->output_function)(c, filter->data)); + } else if (c > 0x80 && c < 0xff && c != 0xc9) { /* dbcs lead byte */ + 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: /* dbcs second byte */ + filter->status = 0; + c1 = filter->cache; + + if ( c1 >= 0x81 && c1 <= 0xa0){ + w = (c1 - 0x81)*190 + (c - 0x41); + if (w >= 0 && w < uhc1_ucs_table_size) { + flag = 1; + w = uhc1_ucs_table[w]; + } else { + w = 0; + } + } else if ( c1 >= 0xa1 && c1 <= 0xc6){ + w = (c1 - 0xa1)*190 + (c - 0x41); + if (w >= 0 && w < uhc2_ucs_table_size) { + flag = 2; + w = uhc2_ucs_table[w]; + } else { + w = 0; + } + } else if ( c1 >= 0xc7 && c1 <= 0xfe){ + w = (c1 - 0xc7)*94 + (c - 0xa1); + if (w >= 0 && w < uhc3_ucs_table_size) { + flag = 3; + w = uhc3_ucs_table[w]; + } else { + w = 0; + } + } + if (flag > 0){ + if (w <= 0) { + w = (c1 << 8) | c; + w &= MBFL_WCSPLANE_MASK; + w |= MBFL_WCSPLANE_UHC; + } + 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 => UHC + */ +int +mbfl_filt_conv_wchar_uhc(int c, mbfl_convert_filter *filter) +{ + int c1, s; + + s = 0; + if (c >= ucs_a1_uhc_table_min && c < ucs_a1_uhc_table_max) { + s = ucs_a1_uhc_table[c - ucs_a1_uhc_table_min]; + } else if (c >= ucs_a2_uhc_table_min && c < ucs_a2_uhc_table_max) { + s = ucs_a2_uhc_table[c - ucs_a2_uhc_table_min]; + } else if (c >= ucs_a3_uhc_table_min && c < ucs_a3_uhc_table_max) { + s = ucs_a3_uhc_table[c - ucs_a3_uhc_table_min]; + } else if (c >= ucs_i_uhc_table_min && c < ucs_i_uhc_table_max) { + s = ucs_i_uhc_table[c - ucs_i_uhc_table_min]; + } else if (c >= ucs_s_uhc_table_min && c < ucs_s_uhc_table_max) { + s = ucs_s_uhc_table[c - ucs_s_uhc_table_min]; + } else if (c >= ucs_r1_uhc_table_min && c < ucs_r1_uhc_table_max) { + s = ucs_r1_uhc_table[c - ucs_r1_uhc_table_min]; + } else if (c >= ucs_r2_uhc_table_min && c < ucs_r2_uhc_table_max) { + s = ucs_r2_uhc_table[c - ucs_r2_uhc_table_min]; + } + if (s <= 0) { + c1 = c & ~MBFL_WCSPLANE_MASK; + if (c1 == MBFL_WCSPLANE_UHC) { + s = c & MBFL_WCSPLANE_MASK; + } + if (c == 0) { + s = 0; + } else if (s <= 0) { + s = -1; + } + } + if (s >= 0) { + if (s < 0x80) { /* latin */ + CK((*filter->output_function)(s, filter->data)); + } else { + CK((*filter->output_function)((s >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(s & 0xff, 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_uhc(int c, mbfl_identify_filter *filter) +{ + switch (filter->status) { + case 0: /* latin */ + if (c >= 0 && c < 0x80) { /* ok */ + ; + } else if (c >= 0x81 && c <= 0xa0) { /* dbcs first char */ + filter->status= 1; + } else if (c >= 0xa1 && c <= 0xc6) { /* dbcs first char */ + filter->status= 2; + } else if (c >= 0xc7 && c <= 0xfe) { /* dbcs first char */ + filter->status= 3; + } else { /* bad */ + filter->flag = 1; + } + + case 1: + case 2: + if (c < 0x41 || (c > 0x5a && c < 0x61) + || (c > 0x7a && c < 0x81) || c > 0xfe) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + break; + + case 3: + if (c < 0xa1 || c > 0xfe) { /* bad */ + filter->flag = 1; + } + filter->status = 0; + break; + + default: + filter->status = 0; + break; + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_uhc.h b/ext/mbstring/libmbfl/filters/mbfilter_uhc.h new file mode 100644 index 0000000000..f964249197 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_uhc.h @@ -0,0 +1,43 @@ +/* + * "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_kr.h + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_UHC_H +#define MBFL_MBFILTER_UHC_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_uhc; +extern const struct mbfl_identify_vtbl vtbl_identify_uhc; +extern const struct mbfl_convert_vtbl vtbl_uhc_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_uhc; + +int mbfl_filt_conv_uhc_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_uhc(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_UHC_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf16.c b/ext/mbstring/libmbfl/filters/mbfilter_utf16.c new file mode 100644 index 0000000000..b6c2aeda5b --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf16.c @@ -0,0 +1,309 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_utf16.h" + +static const char *mbfl_encoding_utf16_aliases[] = {"utf16", NULL}; + +const mbfl_encoding mbfl_encoding_utf16 = { + mbfl_no_encoding_utf16, + "UTF-16", + "UTF-16", + (const char *(*)[])&mbfl_encoding_utf16_aliases, + NULL, + MBFL_ENCTYPE_MWC2BE +}; + +const mbfl_encoding mbfl_encoding_utf16be = { + mbfl_no_encoding_utf16be, + "UTF-16BE", + "UTF-16BE", + NULL, + NULL, + MBFL_ENCTYPE_MWC2BE +}; + +const mbfl_encoding mbfl_encoding_utf16le = { + mbfl_no_encoding_utf16le, + "UTF-16LE", + "UTF-16LE", + NULL, + NULL, + MBFL_ENCTYPE_MWC2LE +}; + +const struct mbfl_convert_vtbl vtbl_utf16_wchar = { + mbfl_no_encoding_utf16, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_utf16_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_utf16 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_utf16, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_utf16be, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_utf16be_wchar = { + mbfl_no_encoding_utf16be, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_utf16be_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_utf16be = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_utf16be, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_utf16be, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_utf16le_wchar = { + mbfl_no_encoding_utf16le, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_utf16le_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_utf16le = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_utf16le, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_utf16le, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * UTF-16 => wchar + */ +int mbfl_filt_conv_utf16_wchar(int c, mbfl_convert_filter *filter) +{ + int n, endian; + + endian = filter->status & 0xff00; + switch (filter->status & 0xff) { + case 0: + if (endian) { + n = c & 0xff; + } else { + n = (c & 0xff) << 8; + } + filter->cache |= n; + filter->status++; + break; + default: + if (endian) { + n = (c & 0xff) << 8; + } else { + n = c & 0xff; + } + n |= filter->cache & 0xffff; + filter->status &= ~0xff; + if (n == 0xfffe) { + if (endian) { + filter->status = 0; /* big-endian */ + } else { + filter->status = 0x100; /* little-endian */ + } + CK((*filter->output_function)(0xfeff, filter->data)); + } else if (n >= 0xd800 && n < 0xdc00) { + filter->cache = ((n & 0x3ff) << 16) + 0x400000; + } else if (n >= 0xdc00 && n < 0xe000) { + n &= 0x3ff; + n |= (filter->cache & 0xfff0000) >> 6; + filter->cache = 0; + if (n >= MBFL_WCSPLANE_SUPMIN && n < MBFL_WCSPLANE_SUPMAX) { + CK((*filter->output_function)(n, filter->data)); + } else { /* illegal character */ + n &= MBFL_WCSGROUP_MASK; + n |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(n, filter->data)); + } + } else { + filter->cache = 0; + CK((*filter->output_function)(n, filter->data)); + } + break; + } + + return c; +} + +/* + * UTF-16BE => wchar + */ +int mbfl_filt_conv_utf16be_wchar(int c, mbfl_convert_filter *filter) +{ + int n; + + switch (filter->status) { + case 0: + filter->status = 1; + n = (c & 0xff) << 8; + filter->cache |= n; + break; + default: + filter->status = 0; + n = (filter->cache & 0xff00) | (c & 0xff); + if (n >= 0xd800 && n < 0xdc00) { + filter->cache = ((n & 0x3ff) << 16) + 0x400000; + } else if (n >= 0xdc00 && n < 0xe000) { + n &= 0x3ff; + n |= (filter->cache & 0xfff0000) >> 6; + filter->cache = 0; + if (n >= MBFL_WCSPLANE_SUPMIN && n < MBFL_WCSPLANE_SUPMAX) { + CK((*filter->output_function)(n, filter->data)); + } else { /* illegal character */ + n &= MBFL_WCSGROUP_MASK; + n |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(n, filter->data)); + } + } else { + filter->cache = 0; + CK((*filter->output_function)(n, filter->data)); + } + break; + } + + return c; +} + +/* + * wchar => UTF-16BE + */ +int mbfl_filt_conv_wchar_utf16be(int c, mbfl_convert_filter *filter) +{ + int n; + + if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) { + CK((*filter->output_function)((c >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(c & 0xff, filter->data)); + } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) { + n = ((c >> 10) - 0x40) | 0xd800; + CK((*filter->output_function)((n >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(n & 0xff, filter->data)); + n = (c & 0x3ff) | 0xdc00; + CK((*filter->output_function)((n >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(n & 0xff, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + +/* + * UTF-16LE => wchar + */ +int mbfl_filt_conv_utf16le_wchar(int c, mbfl_convert_filter *filter) +{ + int n; + + switch (filter->status) { + case 0: + filter->status = 1; + n = c & 0xff; + filter->cache |= n; + break; + default: + filter->status = 0; + n = (filter->cache & 0xff) | ((c & 0xff) << 8); + if (n >= 0xd800 && n < 0xdc00) { + filter->cache = ((n & 0x3ff) << 16) + 0x400000; + } else if (n >= 0xdc00 && n < 0xe000) { + n &= 0x3ff; + n |= (filter->cache & 0xfff0000) >> 6; + filter->cache = 0; + if (n >= MBFL_WCSPLANE_SUPMIN && n < MBFL_WCSPLANE_SUPMAX) { + CK((*filter->output_function)(n, filter->data)); + } else { /* illegal character */ + n &= MBFL_WCSGROUP_MASK; + n |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(n, filter->data)); + } + } else { + filter->cache = 0; + CK((*filter->output_function)(n, filter->data)); + } + break; + } + + return c; +} + +/* + * wchar => UTF-16LE + */ +int mbfl_filt_conv_wchar_utf16le(int c, mbfl_convert_filter *filter) +{ + int n; + + if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) { + CK((*filter->output_function)(c & 0xff, filter->data)); + CK((*filter->output_function)((c >> 8) & 0xff, filter->data)); + } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) { + n = ((c >> 10) - 0x40) | 0xd800; + CK((*filter->output_function)(n & 0xff, filter->data)); + CK((*filter->output_function)((n >> 8) & 0xff, filter->data)); + n = (c & 0x3ff) | 0xdc00; + CK((*filter->output_function)(n & 0xff, filter->data)); + CK((*filter->output_function)((n >> 8) & 0xff, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf16.h b/ext/mbstring/libmbfl/filters/mbfilter_utf16.h new file mode 100644 index 0000000000..f54bb00573 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf16.h @@ -0,0 +1,49 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_UTF16_H +#define MBFL_MBFILTER_UTF16_H + +extern const mbfl_encoding mbfl_encoding_utf16; +extern const mbfl_encoding mbfl_encoding_utf16be; +extern const mbfl_encoding mbfl_encoding_utf16le; +extern const struct mbfl_convert_vtbl vtbl_utf16_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_utf16; +extern const struct mbfl_convert_vtbl vtbl_utf16be_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_utf16be; +extern const struct mbfl_convert_vtbl vtbl_utf16le_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_utf16le; + +int mbfl_filt_conv_utf16_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_utf16be_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_utf16be(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_utf16le_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_utf16le(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_UTF16_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf32.c b/ext/mbstring/libmbfl/filters/mbfilter_utf32.c new file mode 100644 index 0000000000..4b0e9b9e0f --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf32.c @@ -0,0 +1,272 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 20 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_utf32.h" + +static const char *mbfl_encoding_utf32_aliases[] = {"utf32", NULL}; + +const mbfl_encoding mbfl_encoding_utf32 = { + mbfl_no_encoding_utf32, + "UTF-32", + "UTF-32", + (const char *(*)[])&mbfl_encoding_utf32_aliases, + NULL, + MBFL_ENCTYPE_WCS4BE +}; + +const mbfl_encoding mbfl_encoding_utf32be = { + mbfl_no_encoding_utf32be, + "UTF-32BE", + "UTF-32BE", + NULL, + NULL, + MBFL_ENCTYPE_WCS4BE +}; + +const mbfl_encoding mbfl_encoding_utf32le = { + mbfl_no_encoding_utf32le, + "UTF-32LE", + "UTF-32LE", + NULL, + NULL, + MBFL_ENCTYPE_WCS4LE +}; + +const struct mbfl_convert_vtbl vtbl_utf32_wchar = { + mbfl_no_encoding_utf32, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_utf32_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_utf32 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_utf32, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_utf32be, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_utf32be_wchar = { + mbfl_no_encoding_utf32be, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_utf32be_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_utf32be = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_utf32be, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_utf32be, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_utf32le_wchar = { + mbfl_no_encoding_utf32le, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_utf32le_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_utf32le = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_utf32le, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_utf32le, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * UTF-32 => wchar + */ +int mbfl_filt_conv_utf32_wchar(int c, mbfl_convert_filter *filter) +{ + int n, endian; + + endian = filter->status & 0xff00; + switch (filter->status & 0xff) { + case 0: + if (endian) { + n = c & 0xff; + } else { + n = (c & 0xff) << 24; + } + filter->cache = n; + filter->status++; + break; + case 1: + if (endian) { + n = (c & 0xff) << 8; + } else { + n = (c & 0xff) << 16; + } + filter->cache |= n; + filter->status++; + break; + case 2: + if (endian) { + n = (c & 0xff) << 16; + } else { + n = (c & 0xff) << 8; + } + filter->cache |= n; + filter->status++; + break; + default: + if (endian) { + n = (c & 0xff) << 24; + } else { + n = c & 0xff; + } + n |= filter->cache; + if ((n & 0xffff) == 0 && ((n >> 16) & 0xffff) == 0xfffe) { + if (endian) { + filter->status = 0; /* big-endian */ + } else { + filter->status = 0x100; /* little-endian */ + } + CK((*filter->output_function)(0xfeff, filter->data)); + } else { + filter->status &= ~0xff; + CK((*filter->output_function)(n, filter->data)); + } + break; + } + + return c; +} + +/* + * UTF-32BE => wchar + */ +int mbfl_filt_conv_utf32be_wchar(int c, mbfl_convert_filter *filter) +{ + int n; + + if (filter->status == 0) { + filter->status = 1; + n = (c & 0xff) << 24; + filter->cache = n; + } else if (filter->status == 1) { + filter->status = 2; + n = (c & 0xff) << 16; + filter->cache |= n; + } else if (filter->status == 2) { + filter->status = 3; + n = (c & 0xff) << 8; + filter->cache |= n; + } else { + filter->status = 0; + n = (c & 0xff) | filter->cache; + CK((*filter->output_function)(n, filter->data)); + } + return c; +} + +/* + * wchar => UTF-32BE + */ +int mbfl_filt_conv_wchar_utf32be(int c, mbfl_convert_filter *filter) +{ + if (c >= 0 && c < MBFL_WCSGROUP_UCS4MAX) { + CK((*filter->output_function)((c >> 24) & 0xff, filter->data)); + CK((*filter->output_function)((c >> 16) & 0xff, filter->data)); + CK((*filter->output_function)((c >> 8) & 0xff, filter->data)); + CK((*filter->output_function)(c & 0xff, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} + +/* + * UTF-32LE => wchar + */ +int mbfl_filt_conv_utf32le_wchar(int c, mbfl_convert_filter *filter) +{ + int n; + + if (filter->status == 0) { + filter->status = 1; + n = (c & 0xff); + filter->cache = n; + } else if (filter->status == 1) { + filter->status = 2; + n = (c & 0xff) << 8; + filter->cache |= n; + } else if (filter->status == 2) { + filter->status = 3; + n = (c & 0xff) << 16; + filter->cache |= n; + } else { + filter->status = 0; + n = ((c & 0xff) << 24) | filter->cache; + CK((*filter->output_function)(n, filter->data)); + } + return c; +} + +/* + * wchar => UTF-32LE + */ +int mbfl_filt_conv_wchar_utf32le(int c, mbfl_convert_filter *filter) +{ + if (c >= 0 && c < MBFL_WCSGROUP_UCS4MAX) { + CK((*filter->output_function)(c & 0xff, filter->data)); + CK((*filter->output_function)((c >> 8) & 0xff, filter->data)); + CK((*filter->output_function)((c >> 16) & 0xff, filter->data)); + CK((*filter->output_function)((c >> 24) & 0xff, filter->data)); + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + } + + return c; +} diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf32.h b/ext/mbstring/libmbfl/filters/mbfilter_utf32.h new file mode 100644 index 0000000000..c280e9f376 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf32.h @@ -0,0 +1,50 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 20 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_UTF32_H +#define MBFL_MBFILTER_UTF32_H + +extern const mbfl_encoding mbfl_encoding_utf32; +extern const mbfl_encoding mbfl_encoding_utf32be; +extern const mbfl_encoding mbfl_encoding_utf32le; +extern const struct mbfl_convert_vtbl vtbl_utf32_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_utf32; +extern const struct mbfl_convert_vtbl vtbl_utf32be_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_utf32be; +extern const struct mbfl_convert_vtbl vtbl_utf32le_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_utf32le; + +int mbfl_filt_conv_utf32_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_utf32be_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_utf32be(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_utf32le_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_utf32le(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_UTF32_H */ + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf7.c b/ext/mbstring/libmbfl/filters/mbfilter_utf7.c new file mode 100644 index 0000000000..ea37073761 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf7.c @@ -0,0 +1,460 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_utf7.h" + +static int mbfl_filt_ident_utf7(int c, mbfl_identify_filter *filter); + +static const unsigned char mbfl_base64_table[] = { + /* 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', */ + 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d, + /* 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', */ + 0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a, + /* 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', */ + 0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d, + /* 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', */ + 0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a, + /* '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '\0' */ + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x2b,0x2f,0x00 +}; + +static const char *mbfl_encoding_utf7_aliases[] = {"utf7", NULL}; + +const mbfl_encoding mbfl_encoding_utf7 = { + mbfl_no_encoding_utf7, + "UTF-7", + "UTF-7", + (const char *(*)[])&mbfl_encoding_utf7_aliases, + NULL, + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE +}; + +const struct mbfl_identify_vtbl vtbl_identify_utf7 = { + mbfl_no_encoding_utf7, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_utf7 +}; + +const struct mbfl_convert_vtbl vtbl_utf7_wchar = { + mbfl_no_encoding_utf7, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_utf7_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_utf7 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_utf7, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_utf7, + mbfl_filt_conv_wchar_utf7_flush +}; + + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * UTF-7 => wchar + */ +int mbfl_filt_conv_utf7_wchar(int c, mbfl_convert_filter *filter) +{ + int s, n; + + n = -1; + if (filter->status != 0) { /* Modified Base64 */ + if (c >= 0x41 && c <= 0x5a) { /* A - Z */ + n = c - 65; + } else if (c >= 0x61 && c <= 0x7a) { /* a - z */ + n = c - 71; + } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */ + n = c + 4; + } else if (c == 0x2b) { /* '+' */ + n = 62; + } else if (c == 0x2f) { /* '/' */ + n = 63; + } + if (n < 0 || n > 63) { + if (c == 0x2d) { + if (filter->status == 1) { /* "+-" -> "+" */ + CK((*filter->output_function)(0x2b, filter->data)); + } + } else if (c >= 0 && c < 0x80) { /* ASCII exclude '-' */ + CK((*filter->output_function)(c, filter->data)); + } else { /* illegal character */ + s = c & MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(s, filter->data)); + } + filter->cache = 0; + filter->status = 0; + return c; + } + } + + switch (filter->status) { + /* directly encoded characters */ + case 0: + if (c == 0x2b) { /* '+' shift character */ + filter->status = 1; + } else if (c >= 0 && c < 0x80) { /* ASCII */ + CK((*filter->output_function)(c, filter->data)); + } else { /* illegal character */ + s = c & MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(s, filter->data)); + } + break; + + /* decode Modified Base64 */ + case 1: + case 2: + filter->cache |= n << 10; + filter->status = 3; + break; + case 3: + filter->cache |= n << 4; + filter->status = 4; + break; + case 4: + s = ((n >> 2) & 0xf) | (filter->cache & 0xffff); + n = (n & 0x3) << 14; + filter->status = 5; + if (s >= 0xd800 && s < 0xdc00) { + s = (((s & 0x3ff) << 16) + 0x400000) | n; + filter->cache = s; + } else if (s >= 0xdc00 && s < 0xe000) { + s &= 0x3ff; + s |= (filter->cache & 0xfff0000) >> 6; + filter->cache = n; + if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) { + CK((*filter->output_function)(s, filter->data)); + } else { /* illegal character */ + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(s, filter->data)); + } + } else { + filter->cache = n; + CK((*filter->output_function)(s, filter->data)); + } + break; + + case 5: + filter->cache |= n << 8; + filter->status = 6; + break; + case 6: + filter->cache |= n << 2; + filter->status = 7; + break; + case 7: + s = ((n >> 4) & 0x3) | (filter->cache & 0xffff); + n = (n & 0xf) << 12; + filter->status = 8; + if (s >= 0xd800 && s < 0xdc00) { + s = (((s & 0x3ff) << 16) + 0x400000) | n; + filter->cache = s; + } else if (s >= 0xdc00 && s < 0xe000) { + s &= 0x3ff; + s |= (filter->cache & 0xfff0000) >> 6; + filter->cache = n; + if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) { + CK((*filter->output_function)(s, filter->data)); + } else { /* illegal character */ + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(s, filter->data)); + } + } else { + filter->cache = n; + CK((*filter->output_function)(s, filter->data)); + } + break; + + case 8: + filter->cache |= n << 6; + filter->status = 9; + break; + case 9: + s = n | (filter->cache & 0xffff); + filter->status = 2; + if (s >= 0xd800 && s < 0xdc00) { + s = (((s & 0x3ff) << 16) + 0x400000); + filter->cache = s; + } else if (s >= 0xdc00 && s < 0xe000) { + s &= 0x3ff; + s |= (filter->cache & 0xfff0000) >> 6; + filter->cache = 0; + if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) { + CK((*filter->output_function)(s, filter->data)); + } else { /* illegal character */ + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(s, filter->data)); + } + } else { + filter->cache = 0; + CK((*filter->output_function)(s, filter->data)); + } + break; + + default: + filter->status = 0; + break; + } + + return c; +} + +/* + * wchar => UTF-7 + */ +int mbfl_filt_conv_wchar_utf7(int c, mbfl_convert_filter *filter) +{ + int s, n; + + n = 0; + if (c >= 0 && c < 0x80) { /* ASCII */ + if (c >= 0x41 && c <= 0x5a) { /* A - Z */ + n = 1; + } else if (c >= 0x61 && c <= 0x7a) { /* a - z */ + n = 1; + } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */ + n = 1; + } else if (c == '\0') { /* '\0' */ + n = 1; + } else if (c == 0x2f) { /* '/' */ + n = 1; + } else if (c == 0x2d) { /* '-' */ + n = 1; + } else if (c == 0x20) { /* SPACE */ + n = 2; + } else if (c == 0x09) { /* HTAB */ + n = 2; + } else if (c == 0x0d) { /* CR */ + n = 2; + } else if (c == 0x0a) { /* LF */ + n = 2; + } else if (c == 0x27) { /* "'" */ + n = 2; + } else if (c == 0x28) { /* '(' */ + n = 2; + } else if (c == 0x29) { /* ')' */ + n = 2; + } else if (c == 0x2c) { /* ',' */ + n = 2; + } else if (c == 0x2e) { /* '.' */ + n = 2; + } else if (c == 0x3a) { /* ':' */ + n = 2; + } else if (c == 0x3f) { /* '?' */ + n = 2; + } + } else if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) { + ; + } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) { + s = ((c >> 10) - 0x40) | 0xd800; + CK((*filter->filter_function)(s, filter)); + s = (c & 0x3ff) | 0xdc00; + CK((*filter->filter_function)(s, filter)); + return c; + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + return c; + } + + switch (filter->status) { + case 0: + if (n != 0) { /* directly encode characters */ + CK((*filter->output_function)(c, filter->data)); + } else { /* Modified Base64 */ + CK((*filter->output_function)(0x2b, filter->data)); /* '+' */ + filter->status++; + filter->cache = c; + } + break; + + /* encode Modified Base64 */ + case 1: + s = filter->cache; + CK((*filter->output_function)(mbfl_base64_table[(s >> 10) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[(s >> 4) & 0x3f], filter->data)); + if (n != 0) { + CK((*filter->output_function)(mbfl_base64_table[(s << 2) & 0x3c], filter->data)); + if (n == 1) { + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + } + CK((*filter->output_function)(c, filter->data)); + filter->status = 0; + } else { + filter->status++; + filter->cache = ((s & 0xf) << 16) | c; + } + break; + + case 2: + s = filter->cache; + CK((*filter->output_function)(mbfl_base64_table[(s >> 14) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[(s >> 8) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[(s >> 2) & 0x3f], filter->data)); + if (n != 0) { + CK((*filter->output_function)(mbfl_base64_table[(s << 4) & 0x30], filter->data)); + if (n == 1) { + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + } + CK((*filter->output_function)(c, filter->data)); + filter->status = 0; + } else { + filter->status++; + filter->cache = ((s & 0x3) << 16) | c; + } + break; + + case 3: + s = filter->cache; + CK((*filter->output_function)(mbfl_base64_table[(s >> 12) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[(s >> 6) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[s & 0x3f], filter->data)); + if (n != 0) { + if (n == 1) { + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + } + CK((*filter->output_function)(c, filter->data)); + filter->status = 0; + } else { + filter->status = 1; + filter->cache = c; + } + break; + + default: + filter->status = 0; + break; + } + + return c; + +} + +int mbfl_filt_conv_wchar_utf7_flush(mbfl_convert_filter *filter) +{ + int status, cache; + + status = filter->status; + cache = filter->cache; + filter->status = 0; + filter->cache = 0; + /* flush fragments */ + switch (status) { + case 1: + CK((*filter->output_function)(mbfl_base64_table[(cache >> 10) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[(cache >> 4) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[(cache << 2) & 0x3c], filter->data)); + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + break; + + case 2: + CK((*filter->output_function)(mbfl_base64_table[(cache >> 14) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[(cache >> 8) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[(cache >> 2) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[(cache << 4) & 0x30], filter->data)); + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + break; + + case 3: + CK((*filter->output_function)(mbfl_base64_table[(cache >> 12) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[(cache >> 6) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_base64_table[cache & 0x3f], filter->data)); + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + break; + } + return 0; +} + +static int mbfl_filt_ident_utf7(int c, mbfl_identify_filter *filter) +{ + int n; + + switch (filter->status) { + /* directly encoded characters */ + case 0: + if (c == 0x2b) { /* '+' shift character */ + filter->status++; + } else if (c == 0x5c || c == 0x7e || c < 0 || c > 0x7f) { /* illegal character */ + filter->flag = 1; /* bad */ + } + break; + + /* Modified Base64 */ + case 1: + case 2: + n = 0; + if (c >= 0x41 && c <= 0x5a) { /* A - Z */ + n = 1; + } else if (c >= 0x61 && c <= 0x7a) { /* a - z */ + n = 1; + } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */ + n = 1; + } else if (c == 0x2b) { /* '+' */ + n = 1; + } else if (c == 0x2f) { /* '/' */ + n = 1; + } + if (n <= 0) { + if (filter->status == 1 && c != 0x2d) { + filter->flag = 1; /* bad */ + } else if (c < 0 || c > 0x7f) { + filter->flag = 1; /* bad */ + } + filter->status = 0; + } else { + filter->status = 2; + } + break; + + default: + filter->status = 0; + break; + } + + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf7.h b/ext/mbstring/libmbfl/filters/mbfilter_utf7.h new file mode 100644 index 0000000000..0da3b02c0e --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf7.h @@ -0,0 +1,44 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_UTF7_H +#define MBFL_MBFILTER_UTF7_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_utf7; +extern const struct mbfl_identify_vtbl vtbl_identify_utf7; +extern const struct mbfl_convert_vtbl vtbl_utf7_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_utf7; + +int mbfl_filt_conv_utf7_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_utf7(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_utf7_flush(mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_UTF7_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf7imap.c b/ext/mbstring/libmbfl/filters/mbfilter_utf7imap.c new file mode 100644 index 0000000000..b32095cd33 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf7imap.c @@ -0,0 +1,372 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_utf7imap.h" + +const mbfl_encoding mbfl_encoding_utf7imap = { + mbfl_no_encoding_utf7imap, + "UTF7-IMAP", + NULL, + NULL, + NULL, + MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE +}; + +const struct mbfl_convert_vtbl vtbl_utf7imap_wchar = { + mbfl_no_encoding_utf7imap, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_utf7imap_wchar, + mbfl_filt_conv_common_flush }; + +const struct mbfl_convert_vtbl vtbl_wchar_utf7imap = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_utf7imap, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_utf7imap, + mbfl_filt_conv_wchar_utf7imap_flush }; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * UTF7-IMAP => wchar + */ +int mbfl_filt_conv_utf7imap_wchar(int c, mbfl_convert_filter *filter) +{ + int s, n; + + n = -1; + if (filter->status != 0) { /* Modified Base64 */ + if (c >= 0x41 && c <= 0x5a) { /* A - Z */ + n = c - 65; + } else if (c >= 0x61 && c <= 0x7a) { /* a - z */ + n = c - 71; + } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */ + n = c + 4; + } else if (c == 0x2b) { /* '+' */ + n = 62; + } else if (c == 0x2c) { /* ',' */ + n = 63; + } + if (n < 0 || n > 63) { + if (c == 0x2d) { + if (filter->status == 1) { /* "&-" -> "&" */ + CK((*filter->output_function)(0x26, filter->data)); + } + } else if (c >= 0 && c < 0x80) { /* ASCII exclude '-' */ + CK((*filter->output_function)(c, filter->data)); + } else { /* illegal character */ + s = c & MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(s, filter->data)); + } + filter->cache = 0; + filter->status = 0; + return c; + } + } + + switch (filter->status) { + /* directly encoded characters */ + case 0: + if (c == 0x26) { /* '&' shift character */ + filter->status++; + } else if (c >= 0 && c < 0x80) { /* ASCII */ + CK((*filter->output_function)(c, filter->data)); + } else { /* illegal character */ + s = c & MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(s, filter->data)); + } + break; + + /* decode Modified Base64 */ + case 1: + case 2: + filter->cache |= n << 10; + filter->status = 3; + break; + case 3: + filter->cache |= n << 4; + filter->status = 4; + break; + case 4: + s = ((n >> 2) & 0xf) | (filter->cache & 0xffff); + n = (n & 0x3) << 14; + filter->status = 5; + if (s >= 0xd800 && s < 0xdc00) { + s = (((s & 0x3ff) << 16) + 0x400000) | n; + filter->cache = s; + } else if (s >= 0xdc00 && s < 0xe000) { + s &= 0x3ff; + s |= (filter->cache & 0xfff0000) >> 6; + filter->cache = n; + if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) { + CK((*filter->output_function)(s, filter->data)); + } else { /* illegal character */ + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(s, filter->data)); + } + } else { + filter->cache = n; + CK((*filter->output_function)(s, filter->data)); + } + break; + + case 5: + filter->cache |= n << 8; + filter->status = 6; + break; + case 6: + filter->cache |= n << 2; + filter->status = 7; + break; + case 7: + s = ((n >> 4) & 0x3) | (filter->cache & 0xffff); + n = (n & 0xf) << 12; + filter->status = 8; + if (s >= 0xd800 && s < 0xdc00) { + s = (((s & 0x3ff) << 16) + 0x400000) | n; + filter->cache = s; + } else if (s >= 0xdc00 && s < 0xe000) { + s &= 0x3ff; + s |= (filter->cache & 0xfff0000) >> 6; + filter->cache = n; + if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) { + CK((*filter->output_function)(s, filter->data)); + } else { /* illegal character */ + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(s, filter->data)); + } + } else { + filter->cache = n; + CK((*filter->output_function)(s, filter->data)); + } + break; + + case 8: + filter->cache |= n << 6; + filter->status = 9; + break; + case 9: + s = n | (filter->cache & 0xffff); + filter->status = 2; + if (s >= 0xd800 && s < 0xdc00) { + s = (((s & 0x3ff) << 16) + 0x400000); + filter->cache = s; + } else if (s >= 0xdc00 && s < 0xe000) { + s &= 0x3ff; + s |= (filter->cache & 0xfff0000) >> 6; + filter->cache = 0; + if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) { + CK((*filter->output_function)(s, filter->data)); + } else { /* illegal character */ + s &= MBFL_WCSGROUP_MASK; + s |= MBFL_WCSGROUP_THROUGH; + CK((*filter->output_function)(s, filter->data)); + } + } else { + filter->cache = 0; + CK((*filter->output_function)(s, filter->data)); + } + break; + + default: + filter->status = 0; + break; + } + + return c; +} + +static const unsigned char mbfl_utf7imap_base64_table[] = +{ + /* 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', */ + 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d, + /* 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', */ + 0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a, + /* 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', */ + 0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d, + /* 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', */ + 0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a, + /* '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', ',', '\0' */ + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x2b,0x2c,0x00 +}; + +/* + * wchar => UTF7-IMAP + */ +int mbfl_filt_conv_wchar_utf7imap(int c, mbfl_convert_filter *filter) +{ + int n, s; + + n = 0; + if (c == 0x26) { + n = 1; + } else if ((c >= 0x20 && c <= 0x7e) || c == 0) { + n = 2; + } else if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) { + ; + } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) { + s = ((c >> 10) - 0x40) | 0xd800; + CK((*filter->filter_function)(s, filter)); + s = (c & 0x3ff) | 0xdc00; + CK((*filter->filter_function)(s, filter)); + return c; + } else { + if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + CK(mbfl_filt_conv_illegal_output(c, filter)); + } + return c; + } + + switch (filter->status) { + case 0: + if (n != 0) { /* directly encode characters */ + CK((*filter->output_function)(c, filter->data)); + if (n == 1) { + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + } + } else { /* Modified Base64 */ + CK((*filter->output_function)(0x26, filter->data)); /* '&' */ + filter->status = 1; + filter->cache = c; + } + break; + + /* encode Modified Base64 */ + case 1: + s = filter->cache; + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 10) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 4) & 0x3f], filter->data)); + if (n != 0) { + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s << 2) & 0x3c], filter->data)); + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + CK((*filter->output_function)(c, filter->data)); + if (n == 1) { + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + } + filter->status = 0; + } else { + filter->status = 2; + filter->cache = ((s & 0xf) << 16) | c; + } + break; + + case 2: + s = filter->cache; + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 14) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 8) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 2) & 0x3f], filter->data)); + if (n != 0) { + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s << 4) & 0x30], filter->data)); + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + CK((*filter->output_function)(c, filter->data)); + if (n == 1) { + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + } + filter->status = 0; + } else { + filter->status = 3; + filter->cache = ((s & 0x3) << 16) | c; + } + break; + + case 3: + s = filter->cache; + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 12) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 6) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_utf7imap_base64_table[s & 0x3f], filter->data)); + if (n != 0) { + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + CK((*filter->output_function)(c, filter->data)); + if (n == 1) { + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + } + filter->status = 0; + } else { + filter->status = 1; + filter->cache = c; + } + break; + + default: + filter->status = 0; + break; + } + + return c; + +} + +int mbfl_filt_conv_wchar_utf7imap_flush(mbfl_convert_filter *filter) +{ + int status, cache; + + status = filter->status; + cache = filter->cache; + filter->status = 0; + filter->cache = 0; + /* flush fragments */ + switch (status) { + case 1: + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 10) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 4) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache << 2) & 0x3c], filter->data)); + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + break; + + case 2: + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 14) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 8) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 2) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache << 4) & 0x30], filter->data)); + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + break; + + case 3: + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 12) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 6) & 0x3f], filter->data)); + CK((*filter->output_function)(mbfl_utf7imap_base64_table[cache & 0x3f], filter->data)); + CK((*filter->output_function)(0x2d, filter->data)); /* '-' */ + break; + } + return 0; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf7imap.h b/ext/mbstring/libmbfl/filters/mbfilter_utf7imap.h new file mode 100644 index 0000000000..d6c54789c3 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf7imap.h @@ -0,0 +1,43 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_UTF7IMAP_H +#define MBFL_MBFILTER_UTF7IMAP_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_utf7imap; +extern const struct mbfl_convert_vtbl vtbl_utf7imap_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_utf7imap; + +int mbfl_filt_conv_utf7imap_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_utf7imap(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_utf7imap_flush(mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_UTF7IMAP_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf8.c b/ext/mbstring/libmbfl/filters/mbfilter_utf8.c new file mode 100644 index 0000000000..8b95897eac --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf8.c @@ -0,0 +1,269 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_utf8.h" + +static int mbfl_filt_ident_utf8(int c, mbfl_identify_filter *filter); + +static const unsigned char mblen_table_utf8[] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 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, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1 +}; + +static const char *mbfl_encoding_utf8_aliases[] = {"utf8", NULL}; + +const mbfl_encoding mbfl_encoding_utf8 = { + mbfl_no_encoding_utf8, + "UTF-8", + "UTF-8", + (const char *(*)[])&mbfl_encoding_utf8_aliases, + mblen_table_utf8, + MBFL_ENCTYPE_MBCS +}; + +const struct mbfl_identify_vtbl vtbl_identify_utf8 = { + mbfl_no_encoding_utf8, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_utf8 +}; + +const struct mbfl_convert_vtbl vtbl_utf8_wchar = { + mbfl_no_encoding_utf8, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_utf8_wchar, + mbfl_filt_conv_common_flush +}; + +const struct mbfl_convert_vtbl vtbl_wchar_utf8 = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_utf8, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_utf8, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* + * UTF-8 => wchar + */ +int mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter) +{ + int s; + + if (c < 0x80) { + if (c >= 0) { + CK((*filter->output_function)(c, filter->data)); + } + filter->status = 0; + } else if (c < 0xc0) { + switch (filter->status & 0xff) { + case 0x10: /* 2byte code 2nd char */ + case 0x21: /* 3byte code 3rd char */ + case 0x32: /* 4byte code 4th char */ + case 0x43: /* 5byte code 5th char */ + case 0x54: /* 6byte code 6th char */ + filter->status = 0; + s = filter->cache | (c & 0x3f); + if (s >= 0x80) { + CK((*filter->output_function)(s, filter->data)); + } + break; + case 0x20: /* 3byte code 2nd char */ + case 0x31: /* 4byte code 3rd char */ + case 0x42: /* 5byte code 4th char */ + case 0x53: /* 6byte code 5th char */ + filter->cache |= ((c & 0x3f) << 6); + filter->status++; + break; + case 0x30: /* 4byte code 2nd char */ + case 0x41: /* 5byte code 3rd char */ + case 0x52: /* 6byte code 4th char */ + filter->cache |= ((c & 0x3f) << 12); + filter->status++; + break; + case 0x40: /* 5byte code 2nd char */ + case 0x51: /* 6byte code 3rd char */ + filter->cache |= ((c & 0x3f) << 18); + filter->status++; + break; + case 0x50: /* 6byte code 2nd char */ + filter->cache |= ((c & 0x3f) << 24); + filter->status++; + break; + default: + filter->status = 0; + break; + } + } else if (c < 0xe0) { /* 2byte code first char */ + filter->status = 0x10; + filter->cache = (c & 0x1f) << 6; + } else if (c < 0xf0) { /* 3byte code first char */ + filter->status = 0x20; + filter->cache = (c & 0xf) << 12; + } else if (c < 0xf8) { /* 4byte code first char */ + filter->status = 0x30; + filter->cache = (c & 0x7) << 18; + } else if (c < 0xfc) { /* 5byte code first char */ + filter->status = 0x40; + filter->cache = (c & 0x3) << 24; + } else if (c < 0xfe) { /* 6 byte code first char */ + filter->status = 0x50; + filter->cache = (c & 0x1) << 30; + } else { + filter->status = 0; + filter->cache = 0; + } + + return c; +} + +/* + * wchar => UTF-8 + */ +int mbfl_filt_conv_wchar_utf8(int c, mbfl_convert_filter *filter) +{ + if (c >= 0 && c < MBFL_WCSGROUP_UCS4MAX) { + if (c < 0x80) { + CK((*filter->output_function)(c, filter->data)); + } else if (c < 0x800) { + CK((*filter->output_function)(((c >> 6) & 0x1f) | 0xc0, filter->data)); + CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data)); + } else if (c < 0x10000) { + CK((*filter->output_function)(((c >> 12) & 0x0f) | 0xe0, filter->data)); + CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data)); + CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data)); + } else if (c < 0x200000) { + CK((*filter->output_function)(((c >> 18) & 0x07) | 0xf0, filter->data)); + CK((*filter->output_function)(((c >> 12) & 0x3f) | 0x80, filter->data)); + CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data)); + CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data)); + } else if (c < 0x4000000) { + CK((*filter->output_function)(((c >> 24) & 0x03) | 0xf8, filter->data)); + CK((*filter->output_function)(((c >> 18) & 0x3f) | 0x80, filter->data)); + CK((*filter->output_function)(((c >> 12) & 0x3f) | 0x80, filter->data)); + CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data)); + CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data)); + } else { + CK((*filter->output_function)(((c >> 30) & 0x01) | 0xfc, filter->data)); + CK((*filter->output_function)(((c >> 24) & 0x3f) | 0x80, filter->data)); + CK((*filter->output_function)(((c >> 18) & 0x3f) | 0x80, filter->data)); + CK((*filter->output_function)(((c >> 12) & 0x3f) | 0x80, filter->data)); + CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data)); + CK((*filter->output_function)((c & 0x3f) | 0x80, 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_utf8(int c, mbfl_identify_filter *filter) +{ + if (c < 0x80) { + if (c < 0) { + filter->flag = 1; /* bad */ + } else if (c != 0 && filter->status) { + filter->flag = 1; /* bad */ + } + filter->status = 0; + } else if (c < 0xc0) { + switch (filter->status) { + case 0x20: /* 3 byte code 2nd char */ + case 0x30: /* 4 byte code 2nd char */ + case 0x31: /* 4 byte code 3rd char */ + case 0x40: /* 5 byte code 2nd char */ + case 0x41: /* 5 byte code 3rd char */ + case 0x42: /* 5 byte code 4th char */ + case 0x50: /* 6 byte code 2nd char */ + case 0x51: /* 6 byte code 3rd char */ + case 0x52: /* 6 byte code 4th char */ + case 0x53: /* 6 byte code 5th char */ + filter->status++; + break; + case 0x10: /* 2 byte code 2nd char */ + case 0x21: /* 3 byte code 3rd char */ + case 0x32: /* 4 byte code 4th char */ + case 0x43: /* 5 byte code 5th char */ + case 0x54: /* 6 byte code 6th char */ + filter->status = 0; + break; + default: + filter->flag = 1; /* bad */ + filter->status = 0; + break; + } + } else { + if (filter->status) { + filter->flag = 1; /* bad */ + } + filter->status = 0; + if (c < 0xe0) { /* 2 byte code first char */ + filter->status = 0x10; + } else if (c < 0xf0) { /* 3 byte code 1st char */ + filter->status = 0x20; + } else if (c < 0xf8) { /* 4 byte code 1st char */ + filter->status = 0x30; + } else if (c < 0xfc) { /* 5 byte code 1st char */ + filter->status = 0x40; + } else if (c < 0xfe) { /* 6 byte code 1st char */ + filter->status = 0x50; + } else { + filter->flag = 1; /* bad */ + } + } + + return c; +} diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf8.h b/ext/mbstring/libmbfl/filters/mbfilter_utf8.h new file mode 100644 index 0000000000..07bf655022 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_utf8.h @@ -0,0 +1,41 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_UTF8_H +#define MBFL_MBFILTER_UTF8_H + +extern const mbfl_encoding mbfl_encoding_utf8; +extern const struct mbfl_identify_vtbl vtbl_identify_utf8; +extern const struct mbfl_convert_vtbl vtbl_utf8_wchar; +extern const struct mbfl_convert_vtbl vtbl_wchar_utf8; + +int mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter); +int mbfl_filt_conv_wchar_utf8(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_UTF8_H */ diff --git a/ext/mbstring/libmbfl/filters/mbfilter_uuencode.c b/ext/mbstring/libmbfl/filters/mbfilter_uuencode.c new file mode 100644 index 0000000000..64fc39d19b --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_uuencode.c @@ -0,0 +1,152 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfilter.h" +#include "mbfilter_uuencode.h" + +const mbfl_encoding mbfl_encoding_uuencode = { + mbfl_no_encoding_uuencode, + "UUENCODE", + "x-uuencode", + NULL, + NULL, + MBFL_ENCTYPE_SBCS +}; + +const struct mbfl_convert_vtbl vtbl_uuencode_8bit = { + mbfl_no_encoding_uuencode, + mbfl_no_encoding_8bit, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_uudec, + mbfl_filt_conv_common_flush +}; + +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + +/* uuencode => any */ +#define UUDEC(c) (char)(((c)-' ')&077) +static const char * uuenc_begin_text = "begin "; +enum { uudec_state_ground=0, uudec_state_inbegin, + uudec_state_until_newline, + uudec_state_size, uudec_state_a, uudec_state_b, uudec_state_c, uudec_state_d, + uudec_state_skip_newline}; + +int mbfl_filt_conv_uudec(int c, mbfl_convert_filter * filter) +{ + int n; + + switch(filter->status) { + case uudec_state_ground: + /* looking for "begin 0666 filename\n" line */ + if (filter->cache == 0 && c == 'b') + { + filter->status = uudec_state_inbegin; + filter->cache = 1; /* move to 'e' */ + } + else if (c == '\n') + filter->cache = 0; + else + filter->cache++; + break; + case uudec_state_inbegin: + if (uuenc_begin_text[filter->cache++] != c) { + /* doesn't match pattern */ + filter->status = uudec_state_ground; + break; + } + if (filter->cache == 5) + { + /* thats good enough - wait for a newline */ + filter->status = uudec_state_until_newline; + filter->cache = 0; + } + break; + case uudec_state_until_newline: + if (c == '\n') + filter->status = uudec_state_size; + break; + case uudec_state_size: + /* get "size" byte */ + n = UUDEC(c); + filter->cache = n << 24; + filter->status = uudec_state_a; + break; + case uudec_state_a: + /* get "a" byte */ + n = UUDEC(c); + filter->cache |= (n << 16); + filter->status = uudec_state_b; + break; + case uudec_state_b: + /* get "b" byte */ + n = UUDEC(c); + filter->cache |= (n << 8); + filter->status = uudec_state_c; + break; + case uudec_state_c: + /* get "c" byte */ + n = UUDEC(c); + filter->cache |= n; + filter->status = uudec_state_d; + break; + case uudec_state_d: + /* get "d" byte */ + { + int A, B, C, D = UUDEC(c); + A = (filter->cache >> 16) & 0xff; + B = (filter->cache >> 8) & 0xff; + C = (filter->cache) & 0xff; + n = (filter->cache >> 24) & 0xff; + if (n-- > 0) + CK((*filter->output_function)( (A << 2) | (B >> 4), filter->data)); + if (n-- > 0) + CK((*filter->output_function)( (B << 4) | (C >> 2), filter->data)); + if (n-- > 0) + CK((*filter->output_function)( (C << 6) | D, filter->data)); + filter->cache = n << 24; + + if (n == 0) + filter->status = uudec_state_skip_newline; /* skip next byte (newline) */ + else + filter->status = uudec_state_a; /* go back to fetch "A" byte */ + } + break; + case uudec_state_skip_newline: + /* skip newline */ + filter->status = uudec_state_size; + } + return c; +} + + diff --git a/ext/mbstring/libmbfl/filters/mbfilter_uuencode.h b/ext/mbstring/libmbfl/filters/mbfilter_uuencode.h new file mode 100644 index 0000000000..ca7521c39c --- /dev/null +++ b/ext/mbstring/libmbfl/filters/mbfilter_uuencode.h @@ -0,0 +1,39 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_UUENCODE_H +#define MBFL_MBFILTER_UUENCODE_H + +extern const mbfl_encoding mbfl_encoding_uuencode; +extern const struct mbfl_convert_vtbl vtbl_uuencode_8bit; + +int mbfl_filt_conv_uudec(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_UUENCODE_H */ + diff --git a/ext/mbstring/libmbfl/filters/unicode_prop.h b/ext/mbstring/libmbfl/filters/unicode_prop.h new file mode 100644 index 0000000000..d21ec61dfb --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_prop.h @@ -0,0 +1,167 @@ +/* + * "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 authors of this file: PHP3 Internationalization team + * + */ + +/* charactor property table */ +#define MBFL_CHP_CTL 0x01 +#define MBFL_CHP_DIGIT 0x02 +#define MBFL_CHP_UALPHA 0x04 +#define MBFL_CHP_LALPHA 0x08 +#define MBFL_CHP_MMHQENC 0x10 /* must Q-encoding in MIME Header encoded-word */ +#define MBFL_CHP_MSPECIAL 0x20 /* RFC822 Special characters */ + +/* + * Unicode table + */ + +static const unsigned char mbfl_charprop_table[] = { +/* NUL 0 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC, +/* SCH 1 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* SIX 2 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* EIX 3 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* EOT 4 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* ENQ 5 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* ACK 6 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* BEL 7 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* BS 8 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* HI 9 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* LF 10 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* VI 11 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* FF 12 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* CR 13 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* SO 14 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* SI 15 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* SLE 16 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* CSI 17 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* DC2 18 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* DC3 19 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* DC4 20 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* NAK 21 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* SYN 22 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* EIB 23 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* CAN 24 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* EM 25 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* SLB 26 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* ESC 27 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* FS 28 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* GS 29 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* RS 30 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* US 31 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , +/* SP 32 */ MBFL_CHP_MMHQENC , +/* ! 33 */ 0 , +/* " 34 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , +/* # 35 */ MBFL_CHP_MMHQENC , +/* $ 36 */ MBFL_CHP_MMHQENC , +/* % 37 */ MBFL_CHP_MMHQENC , +/* & 38 */ MBFL_CHP_MMHQENC , +/* ' 39 */ MBFL_CHP_MMHQENC , +/* ( 40 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , +/* ) 41 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , +/* * 42 */ 0 , +/* + 43 */ 0 , +/* , 44 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , +/* - 45 */ 0 , +/* . 46 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , +/* / 47 */ 0 , +/* 0 48 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , +/* 1 49 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , +/* 2 50 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , +/* 3 51 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , +/* 4 52 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , +/* 5 53 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , +/* 6 54 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , +/* 7 55 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , +/* 8 56 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , +/* 9 57 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , +/* : 58 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , +/* ; 59 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , +/* < 60 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , +/* = 61 */ 0 , +/* > 62 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , +/* ? 63 */ MBFL_CHP_MMHQENC , +/* @ 64 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , +/* A 65 */ MBFL_CHP_UALPHA , +/* B 66 */ MBFL_CHP_UALPHA , +/* C 67 */ MBFL_CHP_UALPHA , +/* D 68 */ MBFL_CHP_UALPHA , +/* E 69 */ MBFL_CHP_UALPHA , +/* F 70 */ MBFL_CHP_UALPHA , +/* G 71 */ MBFL_CHP_UALPHA , +/* H 72 */ MBFL_CHP_UALPHA , +/* I 73 */ MBFL_CHP_UALPHA , +/* J 74 */ MBFL_CHP_UALPHA , +/* K 75 */ MBFL_CHP_UALPHA , +/* L 76 */ MBFL_CHP_UALPHA , +/* M 77 */ MBFL_CHP_UALPHA , +/* N 78 */ MBFL_CHP_UALPHA , +/* O 79 */ MBFL_CHP_UALPHA , +/* P 80 */ MBFL_CHP_UALPHA , +/* Q 81 */ MBFL_CHP_UALPHA , +/* R 82 */ MBFL_CHP_UALPHA , +/* S 83 */ MBFL_CHP_UALPHA , +/* T 84 */ MBFL_CHP_UALPHA , +/* U 85 */ MBFL_CHP_UALPHA , +/* V 86 */ MBFL_CHP_UALPHA , +/* W 87 */ MBFL_CHP_UALPHA , +/* X 88 */ MBFL_CHP_UALPHA , +/* Y 89 */ MBFL_CHP_UALPHA , +/* Z 90 */ MBFL_CHP_UALPHA , +/* [ 91 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , +/* \ 92 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , +/* ] 93 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , +/* ^ 94 */ MBFL_CHP_MMHQENC , +/* _ 95 */ MBFL_CHP_MMHQENC , +/* ` 96 */ MBFL_CHP_MMHQENC , +/* a 97 */ MBFL_CHP_LALPHA , +/* b 98 */ MBFL_CHP_LALPHA , +/* c 99 */ MBFL_CHP_LALPHA , +/* d 100 */ MBFL_CHP_LALPHA , +/* e 101 */ MBFL_CHP_LALPHA , +/* f 102 */ MBFL_CHP_LALPHA , +/* g 103 */ MBFL_CHP_LALPHA , +/* h 104 */ MBFL_CHP_LALPHA , +/* i 105 */ MBFL_CHP_LALPHA , +/* j 106 */ MBFL_CHP_LALPHA , +/* k 107 */ MBFL_CHP_LALPHA , +/* l 108 */ MBFL_CHP_LALPHA , +/* m 109 */ MBFL_CHP_LALPHA , +/* n 110 */ MBFL_CHP_LALPHA , +/* o 111 */ MBFL_CHP_LALPHA , +/* p 112 */ MBFL_CHP_LALPHA , +/* q 113 */ MBFL_CHP_LALPHA , +/* r 114 */ MBFL_CHP_LALPHA , +/* s 115 */ MBFL_CHP_LALPHA , +/* t 116 */ MBFL_CHP_LALPHA , +/* u 117 */ MBFL_CHP_LALPHA , +/* v 118 */ MBFL_CHP_LALPHA , +/* w 119 */ MBFL_CHP_LALPHA , +/* x 120 */ MBFL_CHP_LALPHA , +/* y 121 */ MBFL_CHP_LALPHA , +/* z 122 */ MBFL_CHP_LALPHA , +/* { 123 */ MBFL_CHP_MMHQENC , +/* | 124 */ MBFL_CHP_MMHQENC , +/* } 125 */ MBFL_CHP_MMHQENC , +/* ~ 126 */ MBFL_CHP_MMHQENC , +/* DEL 127 */ MBFL_CHP_MMHQENC +}; + diff --git a/ext/mbstring/libmbfl/filters/unicode_table_big5.h b/ext/mbstring/libmbfl/filters/unicode_table_big5.h new file mode 100644 index 0000000000..2616d0433a --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_big5.h @@ -0,0 +1,5123 @@ +/* + * "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: Rui Hirokawa <hirokawa@php.net> + * + */ + +#ifndef UNICODE_TABLE_BIG5_H +#define UNICODE_TABLE_BIG5_H + +/* Big5 -> UCS */ +static const unsigned short big5_ucs_table[] = { +0x3000,0xff0c,0x3001,0x3002,0xff0e,0x2027,0xff1b,0xff1a, +0xff1f,0xff01,0xfe30,0x2026,0x2025,0xfe50,0xfe51,0xfe52, +0x00b7,0xfe54,0xfe55,0xfe56,0xfe57,0xff5c,0x2013,0xfe31, +0x2014,0xfe33,0x2574,0xfe34,0xfe4f,0xff08,0xff09,0xfe35, +0xfe36,0xff5b,0xff5d,0xfe37,0xfe38,0x3014,0x3015,0xfe39, +0xfe3a,0x3010,0x3011,0xfe3b,0xfe3c,0x300a,0x300b,0xfe3d, +0xfe3e,0x3008,0x3009,0xfe3f,0xfe40,0x300c,0x300d,0xfe41, +0xfe42,0x300e,0x300f,0xfe43,0xfe44,0xfe59,0xfe5a,0xfe5b, +0xfe5c,0xfe5d,0xfe5e,0x2018,0x2019,0x201c,0x201d,0x301d, +0x301e,0x2035,0x2032,0xff03,0xff06,0xff0a,0x203b,0x00a7, +0x3003,0x25cb,0x25cf,0x25b3,0x25b2,0x25ce,0x2606,0x2605, +0x25c7,0x25c6,0x25a1,0x25a0,0x25bd,0x25bc,0x32a3,0x2105, +0x00af,0xffe3,0xff3f,0x02cd,0xfe49,0xfe4a,0xfe4d,0xfe4e, +0xfe4b,0xfe4c,0xfe5f,0xfe60,0xfe61,0xff0b,0xff0d,0x00d7, +0x00f7,0x00b1,0x221a,0xff1c,0xff1e,0xff1d,0x2266,0x2267, +0x2260,0x221e,0x2252,0x2261,0xfe62,0xfe63,0xfe64,0xfe65, +0xfe66,0xff5e,0x2229,0x222a,0x22a5,0x2220,0x221f,0x22bf, +0x33d2,0x33d1,0x222b,0x222e,0x2235,0x2234,0x2640,0x2642, +0x2295,0x2299,0x2191,0x2193,0x2190,0x2192,0x2196,0x2197, +0x2199,0x2198,0x2225,0x2223,0xff0f,0xff3c,0x2215,0xfe68, +0xff04,0xffe5,0x3012,0xffe0,0xffe1,0xff05,0xff20,0x2103, +0x2109,0xfe69,0xfe6a,0xfe6b,0x33d5,0x339c,0x339d,0x339e, +0x33ce,0x33a1,0x338e,0x338f,0x33c4,0x00b0,0x5159,0x515b, +0x515e,0x515d,0x5161,0x5163,0x55e7,0x74e9,0x7cce,0x2581, +0x2582,0x2583,0x2584,0x2585,0x2586,0x2587,0x2588,0x258f, +0x258e,0x258d,0x258c,0x258b,0x258a,0x2589,0x253c,0x2534, +0x252c,0x2524,0x251c,0x2594,0x2500,0x2502,0x2595,0x250c, +0x2510,0x2514,0x2518,0x256d,0x256e,0x2570,0x256f,0x2550, +0x255e,0x256a,0x2561,0x25e2,0x25e3,0x25e5,0x25e4,0x2571, +0x2572,0x2573,0xff10,0xff11,0xff12,0xff13,0xff14,0xff15, +0xff16,0xff17,0xff18,0xff19,0x2160,0x2161,0x2162,0x2163, +0x2164,0x2165,0x2166,0x2167,0x2168,0x2169,0x3021,0x3022, +0x3023,0x3024,0x3025,0x3026,0x3027,0x3028,0x3029,0x5341, +0x5344,0x5345,0xff21,0xff22,0xff23,0xff24,0xff25,0xff26, +0xff27,0xff28,0xff29,0xff2a,0xff2b,0xff2c,0xff2d,0xff2e, +0xff2f,0xff30,0xff31,0xff32,0xff33,0xff34,0xff35,0xff36, +0xff37,0xff38,0xff39,0xff3a,0xff41,0xff42,0xff43,0xff44, +0xff45,0xff46,0xff47,0xff48,0xff49,0xff4a,0xff4b,0xff4c, +0xff4d,0xff4e,0xff4f,0xff50,0xff51,0xff52,0xff53,0xff54, +0xff55,0xff56,0xff57,0xff58,0xff59,0xff5a,0x0391,0x0392, +0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,0x0399,0x039a, +0x039b,0x039c,0x039d,0x039e,0x039f,0x03a0,0x03a1,0x03a3, +0x03a4,0x03a5,0x03a6,0x03a7,0x03a8,0x03a9,0x03b1,0x03b2, +0x03b3,0x03b4,0x03b5,0x03b6,0x03b7,0x03b8,0x03b9,0x03ba, +0x03bb,0x03bc,0x03bd,0x03be,0x03bf,0x03c0,0x03c1,0x03c3, +0x03c4,0x03c5,0x03c6,0x03c7,0x03c8,0x03c9,0x3105,0x3106, +0x3107,0x3108,0x3109,0x310a,0x310b,0x310c,0x310d,0x310e, +0x310f,0x3110,0x3111,0x3112,0x3113,0x3114,0x3115,0x3116, +0x3117,0x3118,0x3119,0x311a,0x311b,0x311c,0x311d,0x311e, +0x311f,0x3120,0x3121,0x3122,0x3123,0x3124,0x3125,0x3126, +0x3127,0x3128,0x3129,0x02d9,0x02c9,0x02ca,0x02c7,0x02cb, +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,0x20ac,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,0x4e00, +0x4e59,0x4e01,0x4e03,0x4e43,0x4e5d,0x4e86,0x4e8c,0x4eba, +0x513f,0x5165,0x516b,0x51e0,0x5200,0x5201,0x529b,0x5315, +0x5341,0x535c,0x53c8,0x4e09,0x4e0b,0x4e08,0x4e0a,0x4e2b, +0x4e38,0x51e1,0x4e45,0x4e48,0x4e5f,0x4e5e,0x4e8e,0x4ea1, +0x5140,0x5203,0x52fa,0x5343,0x53c9,0x53e3,0x571f,0x58eb, +0x5915,0x5927,0x5973,0x5b50,0x5b51,0x5b53,0x5bf8,0x5c0f, +0x5c22,0x5c38,0x5c71,0x5ddd,0x5de5,0x5df1,0x5df2,0x5df3, +0x5dfe,0x5e72,0x5efe,0x5f0b,0x5f13,0x624d,0x4e11,0x4e10, +0x4e0d,0x4e2d,0x4e30,0x4e39,0x4e4b,0x5c39,0x4e88,0x4e91, +0x4e95,0x4e92,0x4e94,0x4ea2,0x4ec1,0x4ec0,0x4ec3,0x4ec6, +0x4ec7,0x4ecd,0x4eca,0x4ecb,0x4ec4,0x5143,0x5141,0x5167, +0x516d,0x516e,0x516c,0x5197,0x51f6,0x5206,0x5207,0x5208, +0x52fb,0x52fe,0x52ff,0x5316,0x5339,0x5348,0x5347,0x5345, +0x535e,0x5384,0x53cb,0x53ca,0x53cd,0x58ec,0x5929,0x592b, +0x592a,0x592d,0x5b54,0x5c11,0x5c24,0x5c3a,0x5c6f,0x5df4, +0x5e7b,0x5eff,0x5f14,0x5f15,0x5fc3,0x6208,0x6236,0x624b, +0x624e,0x652f,0x6587,0x6597,0x65a4,0x65b9,0x65e5,0x66f0, +0x6708,0x6728,0x6b20,0x6b62,0x6b79,0x6bcb,0x6bd4,0x6bdb, +0x6c0f,0x6c34,0x706b,0x722a,0x7236,0x723b,0x7247,0x7259, +0x725b,0x72ac,0x738b,0x4e19,0x4e16,0x4e15,0x4e14,0x4e18, +0x4e3b,0x4e4d,0x4e4f,0x4e4e,0x4ee5,0x4ed8,0x4ed4,0x4ed5, +0x4ed6,0x4ed7,0x4ee3,0x4ee4,0x4ed9,0x4ede,0x5145,0x5144, +0x5189,0x518a,0x51ac,0x51f9,0x51fa,0x51f8,0x520a,0x52a0, +0x529f,0x5305,0x5306,0x5317,0x531d,0x4edf,0x534a,0x5349, +0x5361,0x5360,0x536f,0x536e,0x53bb,0x53ef,0x53e4,0x53f3, +0x53ec,0x53ee,0x53e9,0x53e8,0x53fc,0x53f8,0x53f5,0x53eb, +0x53e6,0x53ea,0x53f2,0x53f1,0x53f0,0x53e5,0x53ed,0x53fb, +0x56db,0x56da,0x5916,0x592e,0x5931,0x5974,0x5976,0x5b55, +0x5b83,0x5c3c,0x5de8,0x5de7,0x5de6,0x5e02,0x5e03,0x5e73, +0x5e7c,0x5f01,0x5f18,0x5f17,0x5fc5,0x620a,0x6253,0x6254, +0x6252,0x6251,0x65a5,0x65e6,0x672e,0x672c,0x672a,0x672b, +0x672d,0x6b63,0x6bcd,0x6c11,0x6c10,0x6c38,0x6c41,0x6c40, +0x6c3e,0x72af,0x7384,0x7389,0x74dc,0x74e6,0x7518,0x751f, +0x7528,0x7529,0x7530,0x7531,0x7532,0x7533,0x758b,0x767d, +0x76ae,0x76bf,0x76ee,0x77db,0x77e2,0x77f3,0x793a,0x79be, +0x7a74,0x7acb,0x4e1e,0x4e1f,0x4e52,0x4e53,0x4e69,0x4e99, +0x4ea4,0x4ea6,0x4ea5,0x4eff,0x4f09,0x4f19,0x4f0a,0x4f15, +0x4f0d,0x4f10,0x4f11,0x4f0f,0x4ef2,0x4ef6,0x4efb,0x4ef0, +0x4ef3,0x4efd,0x4f01,0x4f0b,0x5149,0x5147,0x5146,0x5148, +0x5168,0x5171,0x518d,0x51b0,0x5217,0x5211,0x5212,0x520e, +0x5216,0x52a3,0x5308,0x5321,0x5320,0x5370,0x5371,0x5409, +0x540f,0x540c,0x540a,0x5410,0x5401,0x540b,0x5404,0x5411, +0x540d,0x5408,0x5403,0x540e,0x5406,0x5412,0x56e0,0x56de, +0x56dd,0x5733,0x5730,0x5728,0x572d,0x572c,0x572f,0x5729, +0x5919,0x591a,0x5937,0x5938,0x5984,0x5978,0x5983,0x597d, +0x5979,0x5982,0x5981,0x5b57,0x5b58,0x5b87,0x5b88,0x5b85, +0x5b89,0x5bfa,0x5c16,0x5c79,0x5dde,0x5e06,0x5e76,0x5e74, +0x5f0f,0x5f1b,0x5fd9,0x5fd6,0x620e,0x620c,0x620d,0x6210, +0x6263,0x625b,0x6258,0x6536,0x65e9,0x65e8,0x65ec,0x65ed, +0x66f2,0x66f3,0x6709,0x673d,0x6734,0x6731,0x6735,0x6b21, +0x6b64,0x6b7b,0x6c16,0x6c5d,0x6c57,0x6c59,0x6c5f,0x6c60, +0x6c50,0x6c55,0x6c61,0x6c5b,0x6c4d,0x6c4e,0x7070,0x725f, +0x725d,0x767e,0x7af9,0x7c73,0x7cf8,0x7f36,0x7f8a,0x7fbd, +0x8001,0x8003,0x800c,0x8012,0x8033,0x807f,0x8089,0x808b, +0x808c,0x81e3,0x81ea,0x81f3,0x81fc,0x820c,0x821b,0x821f, +0x826e,0x8272,0x827e,0x866b,0x8840,0x884c,0x8863,0x897f, +0x9621,0x4e32,0x4ea8,0x4f4d,0x4f4f,0x4f47,0x4f57,0x4f5e, +0x4f34,0x4f5b,0x4f55,0x4f30,0x4f50,0x4f51,0x4f3d,0x4f3a, +0x4f38,0x4f43,0x4f54,0x4f3c,0x4f46,0x4f63,0x4f5c,0x4f60, +0x4f2f,0x4f4e,0x4f36,0x4f59,0x4f5d,0x4f48,0x4f5a,0x514c, +0x514b,0x514d,0x5175,0x51b6,0x51b7,0x5225,0x5224,0x5229, +0x522a,0x5228,0x52ab,0x52a9,0x52aa,0x52ac,0x5323,0x5373, +0x5375,0x541d,0x542d,0x541e,0x543e,0x5426,0x544e,0x5427, +0x5446,0x5443,0x5433,0x5448,0x5442,0x541b,0x5429,0x544a, +0x5439,0x543b,0x5438,0x542e,0x5435,0x5436,0x5420,0x543c, +0x5440,0x5431,0x542b,0x541f,0x542c,0x56ea,0x56f0,0x56e4, +0x56eb,0x574a,0x5751,0x5740,0x574d,0x5747,0x574e,0x573e, +0x5750,0x574f,0x573b,0x58ef,0x593e,0x599d,0x5992,0x59a8, +0x599e,0x59a3,0x5999,0x5996,0x598d,0x59a4,0x5993,0x598a, +0x59a5,0x5b5d,0x5b5c,0x5b5a,0x5b5b,0x5b8c,0x5b8b,0x5b8f, +0x5c2c,0x5c40,0x5c41,0x5c3f,0x5c3e,0x5c90,0x5c91,0x5c94, +0x5c8c,0x5deb,0x5e0c,0x5e8f,0x5e87,0x5e8a,0x5ef7,0x5f04, +0x5f1f,0x5f64,0x5f62,0x5f77,0x5f79,0x5fd8,0x5fcc,0x5fd7, +0x5fcd,0x5ff1,0x5feb,0x5ff8,0x5fea,0x6212,0x6211,0x6284, +0x6297,0x6296,0x6280,0x6276,0x6289,0x626d,0x628a,0x627c, +0x627e,0x6279,0x6273,0x6292,0x626f,0x6298,0x626e,0x6295, +0x6293,0x6291,0x6286,0x6539,0x653b,0x6538,0x65f1,0x66f4, +0x675f,0x674e,0x674f,0x6750,0x6751,0x675c,0x6756,0x675e, +0x6749,0x6746,0x6760,0x6753,0x6757,0x6b65,0x6bcf,0x6c42, +0x6c5e,0x6c99,0x6c81,0x6c88,0x6c89,0x6c85,0x6c9b,0x6c6a, +0x6c7a,0x6c90,0x6c70,0x6c8c,0x6c68,0x6c96,0x6c92,0x6c7d, +0x6c83,0x6c72,0x6c7e,0x6c74,0x6c86,0x6c76,0x6c8d,0x6c94, +0x6c98,0x6c82,0x7076,0x707c,0x707d,0x7078,0x7262,0x7261, +0x7260,0x72c4,0x72c2,0x7396,0x752c,0x752b,0x7537,0x7538, +0x7682,0x76ef,0x77e3,0x79c1,0x79c0,0x79bf,0x7a76,0x7cfb, +0x7f55,0x8096,0x8093,0x809d,0x8098,0x809b,0x809a,0x80b2, +0x826f,0x8292,0x828b,0x828d,0x898b,0x89d2,0x8a00,0x8c37, +0x8c46,0x8c55,0x8c9d,0x8d64,0x8d70,0x8db3,0x8eab,0x8eca, +0x8f9b,0x8fb0,0x8fc2,0x8fc6,0x8fc5,0x8fc4,0x5de1,0x9091, +0x90a2,0x90aa,0x90a6,0x90a3,0x9149,0x91c6,0x91cc,0x9632, +0x962e,0x9631,0x962a,0x962c,0x4e26,0x4e56,0x4e73,0x4e8b, +0x4e9b,0x4e9e,0x4eab,0x4eac,0x4f6f,0x4f9d,0x4f8d,0x4f73, +0x4f7f,0x4f6c,0x4f9b,0x4f8b,0x4f86,0x4f83,0x4f70,0x4f75, +0x4f88,0x4f69,0x4f7b,0x4f96,0x4f7e,0x4f8f,0x4f91,0x4f7a, +0x5154,0x5152,0x5155,0x5169,0x5177,0x5176,0x5178,0x51bd, +0x51fd,0x523b,0x5238,0x5237,0x523a,0x5230,0x522e,0x5236, +0x5241,0x52be,0x52bb,0x5352,0x5354,0x5353,0x5351,0x5366, +0x5377,0x5378,0x5379,0x53d6,0x53d4,0x53d7,0x5473,0x5475, +0x5496,0x5478,0x5495,0x5480,0x547b,0x5477,0x5484,0x5492, +0x5486,0x547c,0x5490,0x5471,0x5476,0x548c,0x549a,0x5462, +0x5468,0x548b,0x547d,0x548e,0x56fa,0x5783,0x5777,0x576a, +0x5769,0x5761,0x5766,0x5764,0x577c,0x591c,0x5949,0x5947, +0x5948,0x5944,0x5954,0x59be,0x59bb,0x59d4,0x59b9,0x59ae, +0x59d1,0x59c6,0x59d0,0x59cd,0x59cb,0x59d3,0x59ca,0x59af, +0x59b3,0x59d2,0x59c5,0x5b5f,0x5b64,0x5b63,0x5b97,0x5b9a, +0x5b98,0x5b9c,0x5b99,0x5b9b,0x5c1a,0x5c48,0x5c45,0x5c46, +0x5cb7,0x5ca1,0x5cb8,0x5ca9,0x5cab,0x5cb1,0x5cb3,0x5e18, +0x5e1a,0x5e16,0x5e15,0x5e1b,0x5e11,0x5e78,0x5e9a,0x5e97, +0x5e9c,0x5e95,0x5e96,0x5ef6,0x5f26,0x5f27,0x5f29,0x5f80, +0x5f81,0x5f7f,0x5f7c,0x5fdd,0x5fe0,0x5ffd,0x5ff5,0x5fff, +0x600f,0x6014,0x602f,0x6035,0x6016,0x602a,0x6015,0x6021, +0x6027,0x6029,0x602b,0x601b,0x6216,0x6215,0x623f,0x623e, +0x6240,0x627f,0x62c9,0x62cc,0x62c4,0x62bf,0x62c2,0x62b9, +0x62d2,0x62db,0x62ab,0x62d3,0x62d4,0x62cb,0x62c8,0x62a8, +0x62bd,0x62bc,0x62d0,0x62d9,0x62c7,0x62cd,0x62b5,0x62da, +0x62b1,0x62d8,0x62d6,0x62d7,0x62c6,0x62ac,0x62ce,0x653e, +0x65a7,0x65bc,0x65fa,0x6614,0x6613,0x660c,0x6606,0x6602, +0x660e,0x6600,0x660f,0x6615,0x660a,0x6607,0x670d,0x670b, +0x676d,0x678b,0x6795,0x6771,0x679c,0x6773,0x6777,0x6787, +0x679d,0x6797,0x676f,0x6770,0x677f,0x6789,0x677e,0x6790, +0x6775,0x679a,0x6793,0x677c,0x676a,0x6772,0x6b23,0x6b66, +0x6b67,0x6b7f,0x6c13,0x6c1b,0x6ce3,0x6ce8,0x6cf3,0x6cb1, +0x6ccc,0x6ce5,0x6cb3,0x6cbd,0x6cbe,0x6cbc,0x6ce2,0x6cab, +0x6cd5,0x6cd3,0x6cb8,0x6cc4,0x6cb9,0x6cc1,0x6cae,0x6cd7, +0x6cc5,0x6cf1,0x6cbf,0x6cbb,0x6ce1,0x6cdb,0x6cca,0x6cac, +0x6cef,0x6cdc,0x6cd6,0x6ce0,0x7095,0x708e,0x7092,0x708a, +0x7099,0x722c,0x722d,0x7238,0x7248,0x7267,0x7269,0x72c0, +0x72ce,0x72d9,0x72d7,0x72d0,0x73a9,0x73a8,0x739f,0x73ab, +0x73a5,0x753d,0x759d,0x7599,0x759a,0x7684,0x76c2,0x76f2, +0x76f4,0x77e5,0x77fd,0x793e,0x7940,0x7941,0x79c9,0x79c8, +0x7a7a,0x7a79,0x7afa,0x7cfe,0x7f54,0x7f8c,0x7f8b,0x8005, +0x80ba,0x80a5,0x80a2,0x80b1,0x80a1,0x80ab,0x80a9,0x80b4, +0x80aa,0x80af,0x81e5,0x81fe,0x820d,0x82b3,0x829d,0x8299, +0x82ad,0x82bd,0x829f,0x82b9,0x82b1,0x82ac,0x82a5,0x82af, +0x82b8,0x82a3,0x82b0,0x82be,0x82b7,0x864e,0x8671,0x521d, +0x8868,0x8ecb,0x8fce,0x8fd4,0x8fd1,0x90b5,0x90b8,0x90b1, +0x90b6,0x91c7,0x91d1,0x9577,0x9580,0x961c,0x9640,0x963f, +0x963b,0x9644,0x9642,0x96b9,0x96e8,0x9752,0x975e,0x4e9f, +0x4ead,0x4eae,0x4fe1,0x4fb5,0x4faf,0x4fbf,0x4fe0,0x4fd1, +0x4fcf,0x4fdd,0x4fc3,0x4fb6,0x4fd8,0x4fdf,0x4fca,0x4fd7, +0x4fae,0x4fd0,0x4fc4,0x4fc2,0x4fda,0x4fce,0x4fde,0x4fb7, +0x5157,0x5192,0x5191,0x51a0,0x524e,0x5243,0x524a,0x524d, +0x524c,0x524b,0x5247,0x52c7,0x52c9,0x52c3,0x52c1,0x530d, +0x5357,0x537b,0x539a,0x53db,0x54ac,0x54c0,0x54a8,0x54ce, +0x54c9,0x54b8,0x54a6,0x54b3,0x54c7,0x54c2,0x54bd,0x54aa, +0x54c1,0x54c4,0x54c8,0x54af,0x54ab,0x54b1,0x54bb,0x54a9, +0x54a7,0x54bf,0x56ff,0x5782,0x578b,0x57a0,0x57a3,0x57a2, +0x57ce,0x57ae,0x5793,0x5955,0x5951,0x594f,0x594e,0x5950, +0x59dc,0x59d8,0x59ff,0x59e3,0x59e8,0x5a03,0x59e5,0x59ea, +0x59da,0x59e6,0x5a01,0x59fb,0x5b69,0x5ba3,0x5ba6,0x5ba4, +0x5ba2,0x5ba5,0x5c01,0x5c4e,0x5c4f,0x5c4d,0x5c4b,0x5cd9, +0x5cd2,0x5df7,0x5e1d,0x5e25,0x5e1f,0x5e7d,0x5ea0,0x5ea6, +0x5efa,0x5f08,0x5f2d,0x5f65,0x5f88,0x5f85,0x5f8a,0x5f8b, +0x5f87,0x5f8c,0x5f89,0x6012,0x601d,0x6020,0x6025,0x600e, +0x6028,0x604d,0x6070,0x6068,0x6062,0x6046,0x6043,0x606c, +0x606b,0x606a,0x6064,0x6241,0x62dc,0x6316,0x6309,0x62fc, +0x62ed,0x6301,0x62ee,0x62fd,0x6307,0x62f1,0x62f7,0x62ef, +0x62ec,0x62fe,0x62f4,0x6311,0x6302,0x653f,0x6545,0x65ab, +0x65bd,0x65e2,0x6625,0x662d,0x6620,0x6627,0x662f,0x661f, +0x6628,0x6631,0x6624,0x66f7,0x67ff,0x67d3,0x67f1,0x67d4, +0x67d0,0x67ec,0x67b6,0x67af,0x67f5,0x67e9,0x67ef,0x67c4, +0x67d1,0x67b4,0x67da,0x67e5,0x67b8,0x67cf,0x67de,0x67f3, +0x67b0,0x67d9,0x67e2,0x67dd,0x67d2,0x6b6a,0x6b83,0x6b86, +0x6bb5,0x6bd2,0x6bd7,0x6c1f,0x6cc9,0x6d0b,0x6d32,0x6d2a, +0x6d41,0x6d25,0x6d0c,0x6d31,0x6d1e,0x6d17,0x6d3b,0x6d3d, +0x6d3e,0x6d36,0x6d1b,0x6cf5,0x6d39,0x6d27,0x6d38,0x6d29, +0x6d2e,0x6d35,0x6d0e,0x6d2b,0x70ab,0x70ba,0x70b3,0x70ac, +0x70af,0x70ad,0x70b8,0x70ae,0x70a4,0x7230,0x7272,0x726f, +0x7274,0x72e9,0x72e0,0x72e1,0x73b7,0x73ca,0x73bb,0x73b2, +0x73cd,0x73c0,0x73b3,0x751a,0x752d,0x754f,0x754c,0x754e, +0x754b,0x75ab,0x75a4,0x75a5,0x75a2,0x75a3,0x7678,0x7686, +0x7687,0x7688,0x76c8,0x76c6,0x76c3,0x76c5,0x7701,0x76f9, +0x76f8,0x7709,0x770b,0x76fe,0x76fc,0x7707,0x77dc,0x7802, +0x7814,0x780c,0x780d,0x7946,0x7949,0x7948,0x7947,0x79b9, +0x79ba,0x79d1,0x79d2,0x79cb,0x7a7f,0x7a81,0x7aff,0x7afd, +0x7c7d,0x7d02,0x7d05,0x7d00,0x7d09,0x7d07,0x7d04,0x7d06, +0x7f38,0x7f8e,0x7fbf,0x8004,0x8010,0x800d,0x8011,0x8036, +0x80d6,0x80e5,0x80da,0x80c3,0x80c4,0x80cc,0x80e1,0x80db, +0x80ce,0x80de,0x80e4,0x80dd,0x81f4,0x8222,0x82e7,0x8303, +0x8305,0x82e3,0x82db,0x82e6,0x8304,0x82e5,0x8302,0x8309, +0x82d2,0x82d7,0x82f1,0x8301,0x82dc,0x82d4,0x82d1,0x82de, +0x82d3,0x82df,0x82ef,0x8306,0x8650,0x8679,0x867b,0x867a, +0x884d,0x886b,0x8981,0x89d4,0x8a08,0x8a02,0x8a03,0x8c9e, +0x8ca0,0x8d74,0x8d73,0x8db4,0x8ecd,0x8ecc,0x8ff0,0x8fe6, +0x8fe2,0x8fea,0x8fe5,0x8fed,0x8feb,0x8fe4,0x8fe8,0x90ca, +0x90ce,0x90c1,0x90c3,0x914b,0x914a,0x91cd,0x9582,0x9650, +0x964b,0x964c,0x964d,0x9762,0x9769,0x97cb,0x97ed,0x97f3, +0x9801,0x98a8,0x98db,0x98df,0x9996,0x9999,0x4e58,0x4eb3, +0x500c,0x500d,0x5023,0x4fef,0x5026,0x5025,0x4ff8,0x5029, +0x5016,0x5006,0x503c,0x501f,0x501a,0x5012,0x5011,0x4ffa, +0x5000,0x5014,0x5028,0x4ff1,0x5021,0x500b,0x5019,0x5018, +0x4ff3,0x4fee,0x502d,0x502a,0x4ffe,0x502b,0x5009,0x517c, +0x51a4,0x51a5,0x51a2,0x51cd,0x51cc,0x51c6,0x51cb,0x5256, +0x525c,0x5254,0x525b,0x525d,0x532a,0x537f,0x539f,0x539d, +0x53df,0x54e8,0x5510,0x5501,0x5537,0x54fc,0x54e5,0x54f2, +0x5506,0x54fa,0x5514,0x54e9,0x54ed,0x54e1,0x5509,0x54ee, +0x54ea,0x54e6,0x5527,0x5507,0x54fd,0x550f,0x5703,0x5704, +0x57c2,0x57d4,0x57cb,0x57c3,0x5809,0x590f,0x5957,0x5958, +0x595a,0x5a11,0x5a18,0x5a1c,0x5a1f,0x5a1b,0x5a13,0x59ec, +0x5a20,0x5a23,0x5a29,0x5a25,0x5a0c,0x5a09,0x5b6b,0x5c58, +0x5bb0,0x5bb3,0x5bb6,0x5bb4,0x5bae,0x5bb5,0x5bb9,0x5bb8, +0x5c04,0x5c51,0x5c55,0x5c50,0x5ced,0x5cfd,0x5cfb,0x5cea, +0x5ce8,0x5cf0,0x5cf6,0x5d01,0x5cf4,0x5dee,0x5e2d,0x5e2b, +0x5eab,0x5ead,0x5ea7,0x5f31,0x5f92,0x5f91,0x5f90,0x6059, +0x6063,0x6065,0x6050,0x6055,0x606d,0x6069,0x606f,0x6084, +0x609f,0x609a,0x608d,0x6094,0x608c,0x6085,0x6096,0x6247, +0x62f3,0x6308,0x62ff,0x634e,0x633e,0x632f,0x6355,0x6342, +0x6346,0x634f,0x6349,0x633a,0x6350,0x633d,0x632a,0x632b, +0x6328,0x634d,0x634c,0x6548,0x6549,0x6599,0x65c1,0x65c5, +0x6642,0x6649,0x664f,0x6643,0x6652,0x664c,0x6645,0x6641, +0x66f8,0x6714,0x6715,0x6717,0x6821,0x6838,0x6848,0x6846, +0x6853,0x6839,0x6842,0x6854,0x6829,0x68b3,0x6817,0x684c, +0x6851,0x683d,0x67f4,0x6850,0x6840,0x683c,0x6843,0x682a, +0x6845,0x6813,0x6818,0x6841,0x6b8a,0x6b89,0x6bb7,0x6c23, +0x6c27,0x6c28,0x6c26,0x6c24,0x6cf0,0x6d6a,0x6d95,0x6d88, +0x6d87,0x6d66,0x6d78,0x6d77,0x6d59,0x6d93,0x6d6c,0x6d89, +0x6d6e,0x6d5a,0x6d74,0x6d69,0x6d8c,0x6d8a,0x6d79,0x6d85, +0x6d65,0x6d94,0x70ca,0x70d8,0x70e4,0x70d9,0x70c8,0x70cf, +0x7239,0x7279,0x72fc,0x72f9,0x72fd,0x72f8,0x72f7,0x7386, +0x73ed,0x7409,0x73ee,0x73e0,0x73ea,0x73de,0x7554,0x755d, +0x755c,0x755a,0x7559,0x75be,0x75c5,0x75c7,0x75b2,0x75b3, +0x75bd,0x75bc,0x75b9,0x75c2,0x75b8,0x768b,0x76b0,0x76ca, +0x76cd,0x76ce,0x7729,0x771f,0x7720,0x7728,0x77e9,0x7830, +0x7827,0x7838,0x781d,0x7834,0x7837,0x7825,0x782d,0x7820, +0x781f,0x7832,0x7955,0x7950,0x7960,0x795f,0x7956,0x795e, +0x795d,0x7957,0x795a,0x79e4,0x79e3,0x79e7,0x79df,0x79e6, +0x79e9,0x79d8,0x7a84,0x7a88,0x7ad9,0x7b06,0x7b11,0x7c89, +0x7d21,0x7d17,0x7d0b,0x7d0a,0x7d20,0x7d22,0x7d14,0x7d10, +0x7d15,0x7d1a,0x7d1c,0x7d0d,0x7d19,0x7d1b,0x7f3a,0x7f5f, +0x7f94,0x7fc5,0x7fc1,0x8006,0x8018,0x8015,0x8019,0x8017, +0x803d,0x803f,0x80f1,0x8102,0x80f0,0x8105,0x80ed,0x80f4, +0x8106,0x80f8,0x80f3,0x8108,0x80fd,0x810a,0x80fc,0x80ef, +0x81ed,0x81ec,0x8200,0x8210,0x822a,0x822b,0x8228,0x822c, +0x82bb,0x832b,0x8352,0x8354,0x834a,0x8338,0x8350,0x8349, +0x8335,0x8334,0x834f,0x8332,0x8339,0x8336,0x8317,0x8340, +0x8331,0x8328,0x8343,0x8654,0x868a,0x86aa,0x8693,0x86a4, +0x86a9,0x868c,0x86a3,0x869c,0x8870,0x8877,0x8881,0x8882, +0x887d,0x8879,0x8a18,0x8a10,0x8a0e,0x8a0c,0x8a15,0x8a0a, +0x8a17,0x8a13,0x8a16,0x8a0f,0x8a11,0x8c48,0x8c7a,0x8c79, +0x8ca1,0x8ca2,0x8d77,0x8eac,0x8ed2,0x8ed4,0x8ecf,0x8fb1, +0x9001,0x9006,0x8ff7,0x9000,0x8ffa,0x8ff4,0x9003,0x8ffd, +0x9005,0x8ff8,0x9095,0x90e1,0x90dd,0x90e2,0x9152,0x914d, +0x914c,0x91d8,0x91dd,0x91d7,0x91dc,0x91d9,0x9583,0x9662, +0x9663,0x9661,0x965b,0x965d,0x9664,0x9658,0x965e,0x96bb, +0x98e2,0x99ac,0x9aa8,0x9ad8,0x9b25,0x9b32,0x9b3c,0x4e7e, +0x507a,0x507d,0x505c,0x5047,0x5043,0x504c,0x505a,0x5049, +0x5065,0x5076,0x504e,0x5055,0x5075,0x5074,0x5077,0x504f, +0x500f,0x506f,0x506d,0x515c,0x5195,0x51f0,0x526a,0x526f, +0x52d2,0x52d9,0x52d8,0x52d5,0x5310,0x530f,0x5319,0x533f, +0x5340,0x533e,0x53c3,0x66fc,0x5546,0x556a,0x5566,0x5544, +0x555e,0x5561,0x5543,0x554a,0x5531,0x5556,0x554f,0x5555, +0x552f,0x5564,0x5538,0x552e,0x555c,0x552c,0x5563,0x5533, +0x5541,0x5557,0x5708,0x570b,0x5709,0x57df,0x5805,0x580a, +0x5806,0x57e0,0x57e4,0x57fa,0x5802,0x5835,0x57f7,0x57f9, +0x5920,0x5962,0x5a36,0x5a41,0x5a49,0x5a66,0x5a6a,0x5a40, +0x5a3c,0x5a62,0x5a5a,0x5a46,0x5a4a,0x5b70,0x5bc7,0x5bc5, +0x5bc4,0x5bc2,0x5bbf,0x5bc6,0x5c09,0x5c08,0x5c07,0x5c60, +0x5c5c,0x5c5d,0x5d07,0x5d06,0x5d0e,0x5d1b,0x5d16,0x5d22, +0x5d11,0x5d29,0x5d14,0x5d19,0x5d24,0x5d27,0x5d17,0x5de2, +0x5e38,0x5e36,0x5e33,0x5e37,0x5eb7,0x5eb8,0x5eb6,0x5eb5, +0x5ebe,0x5f35,0x5f37,0x5f57,0x5f6c,0x5f69,0x5f6b,0x5f97, +0x5f99,0x5f9e,0x5f98,0x5fa1,0x5fa0,0x5f9c,0x607f,0x60a3, +0x6089,0x60a0,0x60a8,0x60cb,0x60b4,0x60e6,0x60bd,0x60c5, +0x60bb,0x60b5,0x60dc,0x60bc,0x60d8,0x60d5,0x60c6,0x60df, +0x60b8,0x60da,0x60c7,0x621a,0x621b,0x6248,0x63a0,0x63a7, +0x6372,0x6396,0x63a2,0x63a5,0x6377,0x6367,0x6398,0x63aa, +0x6371,0x63a9,0x6389,0x6383,0x639b,0x636b,0x63a8,0x6384, +0x6388,0x6399,0x63a1,0x63ac,0x6392,0x638f,0x6380,0x637b, +0x6369,0x6368,0x637a,0x655d,0x6556,0x6551,0x6559,0x6557, +0x555f,0x654f,0x6558,0x6555,0x6554,0x659c,0x659b,0x65ac, +0x65cf,0x65cb,0x65cc,0x65ce,0x665d,0x665a,0x6664,0x6668, +0x6666,0x665e,0x66f9,0x52d7,0x671b,0x6881,0x68af,0x68a2, +0x6893,0x68b5,0x687f,0x6876,0x68b1,0x68a7,0x6897,0x68b0, +0x6883,0x68c4,0x68ad,0x6886,0x6885,0x6894,0x689d,0x68a8, +0x689f,0x68a1,0x6882,0x6b32,0x6bba,0x6beb,0x6bec,0x6c2b, +0x6d8e,0x6dbc,0x6df3,0x6dd9,0x6db2,0x6de1,0x6dcc,0x6de4, +0x6dfb,0x6dfa,0x6e05,0x6dc7,0x6dcb,0x6daf,0x6dd1,0x6dae, +0x6dde,0x6df9,0x6db8,0x6df7,0x6df5,0x6dc5,0x6dd2,0x6e1a, +0x6db5,0x6dda,0x6deb,0x6dd8,0x6dea,0x6df1,0x6dee,0x6de8, +0x6dc6,0x6dc4,0x6daa,0x6dec,0x6dbf,0x6de6,0x70f9,0x7109, +0x710a,0x70fd,0x70ef,0x723d,0x727d,0x7281,0x731c,0x731b, +0x7316,0x7313,0x7319,0x7387,0x7405,0x740a,0x7403,0x7406, +0x73fe,0x740d,0x74e0,0x74f6,0x74f7,0x751c,0x7522,0x7565, +0x7566,0x7562,0x7570,0x758f,0x75d4,0x75d5,0x75b5,0x75ca, +0x75cd,0x768e,0x76d4,0x76d2,0x76db,0x7737,0x773e,0x773c, +0x7736,0x7738,0x773a,0x786b,0x7843,0x784e,0x7965,0x7968, +0x796d,0x79fb,0x7a92,0x7a95,0x7b20,0x7b28,0x7b1b,0x7b2c, +0x7b26,0x7b19,0x7b1e,0x7b2e,0x7c92,0x7c97,0x7c95,0x7d46, +0x7d43,0x7d71,0x7d2e,0x7d39,0x7d3c,0x7d40,0x7d30,0x7d33, +0x7d44,0x7d2f,0x7d42,0x7d32,0x7d31,0x7f3d,0x7f9e,0x7f9a, +0x7fcc,0x7fce,0x7fd2,0x801c,0x804a,0x8046,0x812f,0x8116, +0x8123,0x812b,0x8129,0x8130,0x8124,0x8202,0x8235,0x8237, +0x8236,0x8239,0x838e,0x839e,0x8398,0x8378,0x83a2,0x8396, +0x83bd,0x83ab,0x8392,0x838a,0x8393,0x8389,0x83a0,0x8377, +0x837b,0x837c,0x8386,0x83a7,0x8655,0x5f6a,0x86c7,0x86c0, +0x86b6,0x86c4,0x86b5,0x86c6,0x86cb,0x86b1,0x86af,0x86c9, +0x8853,0x889e,0x8888,0x88ab,0x8892,0x8896,0x888d,0x888b, +0x8993,0x898f,0x8a2a,0x8a1d,0x8a23,0x8a25,0x8a31,0x8a2d, +0x8a1f,0x8a1b,0x8a22,0x8c49,0x8c5a,0x8ca9,0x8cac,0x8cab, +0x8ca8,0x8caa,0x8ca7,0x8d67,0x8d66,0x8dbe,0x8dba,0x8edb, +0x8edf,0x9019,0x900d,0x901a,0x9017,0x9023,0x901f,0x901d, +0x9010,0x9015,0x901e,0x9020,0x900f,0x9022,0x9016,0x901b, +0x9014,0x90e8,0x90ed,0x90fd,0x9157,0x91ce,0x91f5,0x91e6, +0x91e3,0x91e7,0x91ed,0x91e9,0x9589,0x966a,0x9675,0x9673, +0x9678,0x9670,0x9674,0x9676,0x9677,0x966c,0x96c0,0x96ea, +0x96e9,0x7ae0,0x7adf,0x9802,0x9803,0x9b5a,0x9ce5,0x9e75, +0x9e7f,0x9ea5,0x9ebb,0x50a2,0x508d,0x5085,0x5099,0x5091, +0x5080,0x5096,0x5098,0x509a,0x6700,0x51f1,0x5272,0x5274, +0x5275,0x5269,0x52de,0x52dd,0x52db,0x535a,0x53a5,0x557b, +0x5580,0x55a7,0x557c,0x558a,0x559d,0x5598,0x5582,0x559c, +0x55aa,0x5594,0x5587,0x558b,0x5583,0x55b3,0x55ae,0x559f, +0x553e,0x55b2,0x559a,0x55bb,0x55ac,0x55b1,0x557e,0x5589, +0x55ab,0x5599,0x570d,0x582f,0x582a,0x5834,0x5824,0x5830, +0x5831,0x5821,0x581d,0x5820,0x58f9,0x58fa,0x5960,0x5a77, +0x5a9a,0x5a7f,0x5a92,0x5a9b,0x5aa7,0x5b73,0x5b71,0x5bd2, +0x5bcc,0x5bd3,0x5bd0,0x5c0a,0x5c0b,0x5c31,0x5d4c,0x5d50, +0x5d34,0x5d47,0x5dfd,0x5e45,0x5e3d,0x5e40,0x5e43,0x5e7e, +0x5eca,0x5ec1,0x5ec2,0x5ec4,0x5f3c,0x5f6d,0x5fa9,0x5faa, +0x5fa8,0x60d1,0x60e1,0x60b2,0x60b6,0x60e0,0x611c,0x6123, +0x60fa,0x6115,0x60f0,0x60fb,0x60f4,0x6168,0x60f1,0x610e, +0x60f6,0x6109,0x6100,0x6112,0x621f,0x6249,0x63a3,0x638c, +0x63cf,0x63c0,0x63e9,0x63c9,0x63c6,0x63cd,0x63d2,0x63e3, +0x63d0,0x63e1,0x63d6,0x63ed,0x63ee,0x6376,0x63f4,0x63ea, +0x63db,0x6452,0x63da,0x63f9,0x655e,0x6566,0x6562,0x6563, +0x6591,0x6590,0x65af,0x666e,0x6670,0x6674,0x6676,0x666f, +0x6691,0x667a,0x667e,0x6677,0x66fe,0x66ff,0x671f,0x671d, +0x68fa,0x68d5,0x68e0,0x68d8,0x68d7,0x6905,0x68df,0x68f5, +0x68ee,0x68e7,0x68f9,0x68d2,0x68f2,0x68e3,0x68cb,0x68cd, +0x690d,0x6912,0x690e,0x68c9,0x68da,0x696e,0x68fb,0x6b3e, +0x6b3a,0x6b3d,0x6b98,0x6b96,0x6bbc,0x6bef,0x6c2e,0x6c2f, +0x6c2c,0x6e2f,0x6e38,0x6e54,0x6e21,0x6e32,0x6e67,0x6e4a, +0x6e20,0x6e25,0x6e23,0x6e1b,0x6e5b,0x6e58,0x6e24,0x6e56, +0x6e6e,0x6e2d,0x6e26,0x6e6f,0x6e34,0x6e4d,0x6e3a,0x6e2c, +0x6e43,0x6e1d,0x6e3e,0x6ecb,0x6e89,0x6e19,0x6e4e,0x6e63, +0x6e44,0x6e72,0x6e69,0x6e5f,0x7119,0x711a,0x7126,0x7130, +0x7121,0x7136,0x716e,0x711c,0x724c,0x7284,0x7280,0x7336, +0x7325,0x7334,0x7329,0x743a,0x742a,0x7433,0x7422,0x7425, +0x7435,0x7436,0x7434,0x742f,0x741b,0x7426,0x7428,0x7525, +0x7526,0x756b,0x756a,0x75e2,0x75db,0x75e3,0x75d9,0x75d8, +0x75de,0x75e0,0x767b,0x767c,0x7696,0x7693,0x76b4,0x76dc, +0x774f,0x77ed,0x785d,0x786c,0x786f,0x7a0d,0x7a08,0x7a0b, +0x7a05,0x7a00,0x7a98,0x7a97,0x7a96,0x7ae5,0x7ae3,0x7b49, +0x7b56,0x7b46,0x7b50,0x7b52,0x7b54,0x7b4d,0x7b4b,0x7b4f, +0x7b51,0x7c9f,0x7ca5,0x7d5e,0x7d50,0x7d68,0x7d55,0x7d2b, +0x7d6e,0x7d72,0x7d61,0x7d66,0x7d62,0x7d70,0x7d73,0x5584, +0x7fd4,0x7fd5,0x800b,0x8052,0x8085,0x8155,0x8154,0x814b, +0x8151,0x814e,0x8139,0x8146,0x813e,0x814c,0x8153,0x8174, +0x8212,0x821c,0x83e9,0x8403,0x83f8,0x840d,0x83e0,0x83c5, +0x840b,0x83c1,0x83ef,0x83f1,0x83f4,0x8457,0x840a,0x83f0, +0x840c,0x83cc,0x83fd,0x83f2,0x83ca,0x8438,0x840e,0x8404, +0x83dc,0x8407,0x83d4,0x83df,0x865b,0x86df,0x86d9,0x86ed, +0x86d4,0x86db,0x86e4,0x86d0,0x86de,0x8857,0x88c1,0x88c2, +0x88b1,0x8983,0x8996,0x8a3b,0x8a60,0x8a55,0x8a5e,0x8a3c, +0x8a41,0x8a54,0x8a5b,0x8a50,0x8a46,0x8a34,0x8a3a,0x8a36, +0x8a56,0x8c61,0x8c82,0x8caf,0x8cbc,0x8cb3,0x8cbd,0x8cc1, +0x8cbb,0x8cc0,0x8cb4,0x8cb7,0x8cb6,0x8cbf,0x8cb8,0x8d8a, +0x8d85,0x8d81,0x8dce,0x8ddd,0x8dcb,0x8dda,0x8dd1,0x8dcc, +0x8ddb,0x8dc6,0x8efb,0x8ef8,0x8efc,0x8f9c,0x902e,0x9035, +0x9031,0x9038,0x9032,0x9036,0x9102,0x90f5,0x9109,0x90fe, +0x9163,0x9165,0x91cf,0x9214,0x9215,0x9223,0x9209,0x921e, +0x920d,0x9210,0x9207,0x9211,0x9594,0x958f,0x958b,0x9591, +0x9593,0x9592,0x958e,0x968a,0x968e,0x968b,0x967d,0x9685, +0x9686,0x968d,0x9672,0x9684,0x96c1,0x96c5,0x96c4,0x96c6, +0x96c7,0x96ef,0x96f2,0x97cc,0x9805,0x9806,0x9808,0x98e7, +0x98ea,0x98ef,0x98e9,0x98f2,0x98ed,0x99ae,0x99ad,0x9ec3, +0x9ecd,0x9ed1,0x4e82,0x50ad,0x50b5,0x50b2,0x50b3,0x50c5, +0x50be,0x50ac,0x50b7,0x50bb,0x50af,0x50c7,0x527f,0x5277, +0x527d,0x52df,0x52e6,0x52e4,0x52e2,0x52e3,0x532f,0x55df, +0x55e8,0x55d3,0x55e6,0x55ce,0x55dc,0x55c7,0x55d1,0x55e3, +0x55e4,0x55ef,0x55da,0x55e1,0x55c5,0x55c6,0x55e5,0x55c9, +0x5712,0x5713,0x585e,0x5851,0x5858,0x5857,0x585a,0x5854, +0x586b,0x584c,0x586d,0x584a,0x5862,0x5852,0x584b,0x5967, +0x5ac1,0x5ac9,0x5acc,0x5abe,0x5abd,0x5abc,0x5ab3,0x5ac2, +0x5ab2,0x5d69,0x5d6f,0x5e4c,0x5e79,0x5ec9,0x5ec8,0x5f12, +0x5f59,0x5fac,0x5fae,0x611a,0x610f,0x6148,0x611f,0x60f3, +0x611b,0x60f9,0x6101,0x6108,0x614e,0x614c,0x6144,0x614d, +0x613e,0x6134,0x6127,0x610d,0x6106,0x6137,0x6221,0x6222, +0x6413,0x643e,0x641e,0x642a,0x642d,0x643d,0x642c,0x640f, +0x641c,0x6414,0x640d,0x6436,0x6416,0x6417,0x6406,0x656c, +0x659f,0x65b0,0x6697,0x6689,0x6687,0x6688,0x6696,0x6684, +0x6698,0x668d,0x6703,0x6994,0x696d,0x695a,0x6977,0x6960, +0x6954,0x6975,0x6930,0x6982,0x694a,0x6968,0x696b,0x695e, +0x6953,0x6979,0x6986,0x695d,0x6963,0x695b,0x6b47,0x6b72, +0x6bc0,0x6bbf,0x6bd3,0x6bfd,0x6ea2,0x6eaf,0x6ed3,0x6eb6, +0x6ec2,0x6e90,0x6e9d,0x6ec7,0x6ec5,0x6ea5,0x6e98,0x6ebc, +0x6eba,0x6eab,0x6ed1,0x6e96,0x6e9c,0x6ec4,0x6ed4,0x6eaa, +0x6ea7,0x6eb4,0x714e,0x7159,0x7169,0x7164,0x7149,0x7167, +0x715c,0x716c,0x7166,0x714c,0x7165,0x715e,0x7146,0x7168, +0x7156,0x723a,0x7252,0x7337,0x7345,0x733f,0x733e,0x746f, +0x745a,0x7455,0x745f,0x745e,0x7441,0x743f,0x7459,0x745b, +0x745c,0x7576,0x7578,0x7600,0x75f0,0x7601,0x75f2,0x75f1, +0x75fa,0x75ff,0x75f4,0x75f3,0x76de,0x76df,0x775b,0x776b, +0x7766,0x775e,0x7763,0x7779,0x776a,0x776c,0x775c,0x7765, +0x7768,0x7762,0x77ee,0x788e,0x78b0,0x7897,0x7898,0x788c, +0x7889,0x787c,0x7891,0x7893,0x787f,0x797a,0x797f,0x7981, +0x842c,0x79bd,0x7a1c,0x7a1a,0x7a20,0x7a14,0x7a1f,0x7a1e, +0x7a9f,0x7aa0,0x7b77,0x7bc0,0x7b60,0x7b6e,0x7b67,0x7cb1, +0x7cb3,0x7cb5,0x7d93,0x7d79,0x7d91,0x7d81,0x7d8f,0x7d5b, +0x7f6e,0x7f69,0x7f6a,0x7f72,0x7fa9,0x7fa8,0x7fa4,0x8056, +0x8058,0x8086,0x8084,0x8171,0x8170,0x8178,0x8165,0x816e, +0x8173,0x816b,0x8179,0x817a,0x8166,0x8205,0x8247,0x8482, +0x8477,0x843d,0x8431,0x8475,0x8466,0x846b,0x8449,0x846c, +0x845b,0x843c,0x8435,0x8461,0x8463,0x8469,0x846d,0x8446, +0x865e,0x865c,0x865f,0x86f9,0x8713,0x8708,0x8707,0x8700, +0x86fe,0x86fb,0x8702,0x8703,0x8706,0x870a,0x8859,0x88df, +0x88d4,0x88d9,0x88dc,0x88d8,0x88dd,0x88e1,0x88ca,0x88d5, +0x88d2,0x899c,0x89e3,0x8a6b,0x8a72,0x8a73,0x8a66,0x8a69, +0x8a70,0x8a87,0x8a7c,0x8a63,0x8aa0,0x8a71,0x8a85,0x8a6d, +0x8a62,0x8a6e,0x8a6c,0x8a79,0x8a7b,0x8a3e,0x8a68,0x8c62, +0x8c8a,0x8c89,0x8cca,0x8cc7,0x8cc8,0x8cc4,0x8cb2,0x8cc3, +0x8cc2,0x8cc5,0x8de1,0x8ddf,0x8de8,0x8def,0x8df3,0x8dfa, +0x8dea,0x8de4,0x8de6,0x8eb2,0x8f03,0x8f09,0x8efe,0x8f0a, +0x8f9f,0x8fb2,0x904b,0x904a,0x9053,0x9042,0x9054,0x903c, +0x9055,0x9050,0x9047,0x904f,0x904e,0x904d,0x9051,0x903e, +0x9041,0x9112,0x9117,0x916c,0x916a,0x9169,0x91c9,0x9237, +0x9257,0x9238,0x923d,0x9240,0x923e,0x925b,0x924b,0x9264, +0x9251,0x9234,0x9249,0x924d,0x9245,0x9239,0x923f,0x925a, +0x9598,0x9698,0x9694,0x9695,0x96cd,0x96cb,0x96c9,0x96ca, +0x96f7,0x96fb,0x96f9,0x96f6,0x9756,0x9774,0x9776,0x9810, +0x9811,0x9813,0x980a,0x9812,0x980c,0x98fc,0x98f4,0x98fd, +0x98fe,0x99b3,0x99b1,0x99b4,0x9ae1,0x9ce9,0x9e82,0x9f0e, +0x9f13,0x9f20,0x50e7,0x50ee,0x50e5,0x50d6,0x50ed,0x50da, +0x50d5,0x50cf,0x50d1,0x50f1,0x50ce,0x50e9,0x5162,0x51f3, +0x5283,0x5282,0x5331,0x53ad,0x55fe,0x5600,0x561b,0x5617, +0x55fd,0x5614,0x5606,0x5609,0x560d,0x560e,0x55f7,0x5616, +0x561f,0x5608,0x5610,0x55f6,0x5718,0x5716,0x5875,0x587e, +0x5883,0x5893,0x588a,0x5879,0x5885,0x587d,0x58fd,0x5925, +0x5922,0x5924,0x596a,0x5969,0x5ae1,0x5ae6,0x5ae9,0x5ad7, +0x5ad6,0x5ad8,0x5ae3,0x5b75,0x5bde,0x5be7,0x5be1,0x5be5, +0x5be6,0x5be8,0x5be2,0x5be4,0x5bdf,0x5c0d,0x5c62,0x5d84, +0x5d87,0x5e5b,0x5e63,0x5e55,0x5e57,0x5e54,0x5ed3,0x5ed6, +0x5f0a,0x5f46,0x5f70,0x5fb9,0x6147,0x613f,0x614b,0x6177, +0x6162,0x6163,0x615f,0x615a,0x6158,0x6175,0x622a,0x6487, +0x6458,0x6454,0x64a4,0x6478,0x645f,0x647a,0x6451,0x6467, +0x6434,0x646d,0x647b,0x6572,0x65a1,0x65d7,0x65d6,0x66a2, +0x66a8,0x669d,0x699c,0x69a8,0x6995,0x69c1,0x69ae,0x69d3, +0x69cb,0x699b,0x69b7,0x69bb,0x69ab,0x69b4,0x69d0,0x69cd, +0x69ad,0x69cc,0x69a6,0x69c3,0x69a3,0x6b49,0x6b4c,0x6c33, +0x6f33,0x6f14,0x6efe,0x6f13,0x6ef4,0x6f29,0x6f3e,0x6f20, +0x6f2c,0x6f0f,0x6f02,0x6f22,0x6eff,0x6eef,0x6f06,0x6f31, +0x6f38,0x6f32,0x6f23,0x6f15,0x6f2b,0x6f2f,0x6f88,0x6f2a, +0x6eec,0x6f01,0x6ef2,0x6ecc,0x6ef7,0x7194,0x7199,0x717d, +0x718a,0x7184,0x7192,0x723e,0x7292,0x7296,0x7344,0x7350, +0x7464,0x7463,0x746a,0x7470,0x746d,0x7504,0x7591,0x7627, +0x760d,0x760b,0x7609,0x7613,0x76e1,0x76e3,0x7784,0x777d, +0x777f,0x7761,0x78c1,0x789f,0x78a7,0x78b3,0x78a9,0x78a3, +0x798e,0x798f,0x798d,0x7a2e,0x7a31,0x7aaa,0x7aa9,0x7aed, +0x7aef,0x7ba1,0x7b95,0x7b8b,0x7b75,0x7b97,0x7b9d,0x7b94, +0x7b8f,0x7bb8,0x7b87,0x7b84,0x7cb9,0x7cbd,0x7cbe,0x7dbb, +0x7db0,0x7d9c,0x7dbd,0x7dbe,0x7da0,0x7dca,0x7db4,0x7db2, +0x7db1,0x7dba,0x7da2,0x7dbf,0x7db5,0x7db8,0x7dad,0x7dd2, +0x7dc7,0x7dac,0x7f70,0x7fe0,0x7fe1,0x7fdf,0x805e,0x805a, +0x8087,0x8150,0x8180,0x818f,0x8188,0x818a,0x817f,0x8182, +0x81e7,0x81fa,0x8207,0x8214,0x821e,0x824b,0x84c9,0x84bf, +0x84c6,0x84c4,0x8499,0x849e,0x84b2,0x849c,0x84cb,0x84b8, +0x84c0,0x84d3,0x8490,0x84bc,0x84d1,0x84ca,0x873f,0x871c, +0x873b,0x8722,0x8725,0x8734,0x8718,0x8755,0x8737,0x8729, +0x88f3,0x8902,0x88f4,0x88f9,0x88f8,0x88fd,0x88e8,0x891a, +0x88ef,0x8aa6,0x8a8c,0x8a9e,0x8aa3,0x8a8d,0x8aa1,0x8a93, +0x8aa4,0x8aaa,0x8aa5,0x8aa8,0x8a98,0x8a91,0x8a9a,0x8aa7, +0x8c6a,0x8c8d,0x8c8c,0x8cd3,0x8cd1,0x8cd2,0x8d6b,0x8d99, +0x8d95,0x8dfc,0x8f14,0x8f12,0x8f15,0x8f13,0x8fa3,0x9060, +0x9058,0x905c,0x9063,0x9059,0x905e,0x9062,0x905d,0x905b, +0x9119,0x9118,0x911e,0x9175,0x9178,0x9177,0x9174,0x9278, +0x9280,0x9285,0x9298,0x9296,0x927b,0x9293,0x929c,0x92a8, +0x927c,0x9291,0x95a1,0x95a8,0x95a9,0x95a3,0x95a5,0x95a4, +0x9699,0x969c,0x969b,0x96cc,0x96d2,0x9700,0x977c,0x9785, +0x97f6,0x9817,0x9818,0x98af,0x98b1,0x9903,0x9905,0x990c, +0x9909,0x99c1,0x9aaf,0x9ab0,0x9ae6,0x9b41,0x9b42,0x9cf4, +0x9cf6,0x9cf3,0x9ebc,0x9f3b,0x9f4a,0x5104,0x5100,0x50fb, +0x50f5,0x50f9,0x5102,0x5108,0x5109,0x5105,0x51dc,0x5287, +0x5288,0x5289,0x528d,0x528a,0x52f0,0x53b2,0x562e,0x563b, +0x5639,0x5632,0x563f,0x5634,0x5629,0x5653,0x564e,0x5657, +0x5674,0x5636,0x562f,0x5630,0x5880,0x589f,0x589e,0x58b3, +0x589c,0x58ae,0x58a9,0x58a6,0x596d,0x5b09,0x5afb,0x5b0b, +0x5af5,0x5b0c,0x5b08,0x5bee,0x5bec,0x5be9,0x5beb,0x5c64, +0x5c65,0x5d9d,0x5d94,0x5e62,0x5e5f,0x5e61,0x5ee2,0x5eda, +0x5edf,0x5edd,0x5ee3,0x5ee0,0x5f48,0x5f71,0x5fb7,0x5fb5, +0x6176,0x6167,0x616e,0x615d,0x6155,0x6182,0x617c,0x6170, +0x616b,0x617e,0x61a7,0x6190,0x61ab,0x618e,0x61ac,0x619a, +0x61a4,0x6194,0x61ae,0x622e,0x6469,0x646f,0x6479,0x649e, +0x64b2,0x6488,0x6490,0x64b0,0x64a5,0x6493,0x6495,0x64a9, +0x6492,0x64ae,0x64ad,0x64ab,0x649a,0x64ac,0x6499,0x64a2, +0x64b3,0x6575,0x6577,0x6578,0x66ae,0x66ab,0x66b4,0x66b1, +0x6a23,0x6a1f,0x69e8,0x6a01,0x6a1e,0x6a19,0x69fd,0x6a21, +0x6a13,0x6a0a,0x69f3,0x6a02,0x6a05,0x69ed,0x6a11,0x6b50, +0x6b4e,0x6ba4,0x6bc5,0x6bc6,0x6f3f,0x6f7c,0x6f84,0x6f51, +0x6f66,0x6f54,0x6f86,0x6f6d,0x6f5b,0x6f78,0x6f6e,0x6f8e, +0x6f7a,0x6f70,0x6f64,0x6f97,0x6f58,0x6ed5,0x6f6f,0x6f60, +0x6f5f,0x719f,0x71ac,0x71b1,0x71a8,0x7256,0x729b,0x734e, +0x7357,0x7469,0x748b,0x7483,0x747e,0x7480,0x757f,0x7620, +0x7629,0x761f,0x7624,0x7626,0x7621,0x7622,0x769a,0x76ba, +0x76e4,0x778e,0x7787,0x778c,0x7791,0x778b,0x78cb,0x78c5, +0x78ba,0x78ca,0x78be,0x78d5,0x78bc,0x78d0,0x7a3f,0x7a3c, +0x7a40,0x7a3d,0x7a37,0x7a3b,0x7aaf,0x7aae,0x7bad,0x7bb1, +0x7bc4,0x7bb4,0x7bc6,0x7bc7,0x7bc1,0x7ba0,0x7bcc,0x7cca, +0x7de0,0x7df4,0x7def,0x7dfb,0x7dd8,0x7dec,0x7ddd,0x7de8, +0x7de3,0x7dda,0x7dde,0x7de9,0x7d9e,0x7dd9,0x7df2,0x7df9, +0x7f75,0x7f77,0x7faf,0x7fe9,0x8026,0x819b,0x819c,0x819d, +0x81a0,0x819a,0x8198,0x8517,0x853d,0x851a,0x84ee,0x852c, +0x852d,0x8513,0x8511,0x8523,0x8521,0x8514,0x84ec,0x8525, +0x84ff,0x8506,0x8782,0x8774,0x8776,0x8760,0x8766,0x8778, +0x8768,0x8759,0x8757,0x874c,0x8753,0x885b,0x885d,0x8910, +0x8907,0x8912,0x8913,0x8915,0x890a,0x8abc,0x8ad2,0x8ac7, +0x8ac4,0x8a95,0x8acb,0x8af8,0x8ab2,0x8ac9,0x8ac2,0x8abf, +0x8ab0,0x8ad6,0x8acd,0x8ab6,0x8ab9,0x8adb,0x8c4c,0x8c4e, +0x8c6c,0x8ce0,0x8cde,0x8ce6,0x8ce4,0x8cec,0x8ced,0x8ce2, +0x8ce3,0x8cdc,0x8cea,0x8ce1,0x8d6d,0x8d9f,0x8da3,0x8e2b, +0x8e10,0x8e1d,0x8e22,0x8e0f,0x8e29,0x8e1f,0x8e21,0x8e1e, +0x8eba,0x8f1d,0x8f1b,0x8f1f,0x8f29,0x8f26,0x8f2a,0x8f1c, +0x8f1e,0x8f25,0x9069,0x906e,0x9068,0x906d,0x9077,0x9130, +0x912d,0x9127,0x9131,0x9187,0x9189,0x918b,0x9183,0x92c5, +0x92bb,0x92b7,0x92ea,0x92ac,0x92e4,0x92c1,0x92b3,0x92bc, +0x92d2,0x92c7,0x92f0,0x92b2,0x95ad,0x95b1,0x9704,0x9706, +0x9707,0x9709,0x9760,0x978d,0x978b,0x978f,0x9821,0x982b, +0x981c,0x98b3,0x990a,0x9913,0x9912,0x9918,0x99dd,0x99d0, +0x99df,0x99db,0x99d1,0x99d5,0x99d2,0x99d9,0x9ab7,0x9aee, +0x9aef,0x9b27,0x9b45,0x9b44,0x9b77,0x9b6f,0x9d06,0x9d09, +0x9d03,0x9ea9,0x9ebe,0x9ece,0x58a8,0x9f52,0x5112,0x5118, +0x5114,0x5110,0x5115,0x5180,0x51aa,0x51dd,0x5291,0x5293, +0x52f3,0x5659,0x566b,0x5679,0x5669,0x5664,0x5678,0x566a, +0x5668,0x5665,0x5671,0x566f,0x566c,0x5662,0x5676,0x58c1, +0x58be,0x58c7,0x58c5,0x596e,0x5b1d,0x5b34,0x5b78,0x5bf0, +0x5c0e,0x5f4a,0x61b2,0x6191,0x61a9,0x618a,0x61cd,0x61b6, +0x61be,0x61ca,0x61c8,0x6230,0x64c5,0x64c1,0x64cb,0x64bb, +0x64bc,0x64da,0x64c4,0x64c7,0x64c2,0x64cd,0x64bf,0x64d2, +0x64d4,0x64be,0x6574,0x66c6,0x66c9,0x66b9,0x66c4,0x66c7, +0x66b8,0x6a3d,0x6a38,0x6a3a,0x6a59,0x6a6b,0x6a58,0x6a39, +0x6a44,0x6a62,0x6a61,0x6a4b,0x6a47,0x6a35,0x6a5f,0x6a48, +0x6b59,0x6b77,0x6c05,0x6fc2,0x6fb1,0x6fa1,0x6fc3,0x6fa4, +0x6fc1,0x6fa7,0x6fb3,0x6fc0,0x6fb9,0x6fb6,0x6fa6,0x6fa0, +0x6fb4,0x71be,0x71c9,0x71d0,0x71d2,0x71c8,0x71d5,0x71b9, +0x71ce,0x71d9,0x71dc,0x71c3,0x71c4,0x7368,0x749c,0x74a3, +0x7498,0x749f,0x749e,0x74e2,0x750c,0x750d,0x7634,0x7638, +0x763a,0x76e7,0x76e5,0x77a0,0x779e,0x779f,0x77a5,0x78e8, +0x78da,0x78ec,0x78e7,0x79a6,0x7a4d,0x7a4e,0x7a46,0x7a4c, +0x7a4b,0x7aba,0x7bd9,0x7c11,0x7bc9,0x7be4,0x7bdb,0x7be1, +0x7be9,0x7be6,0x7cd5,0x7cd6,0x7e0a,0x7e11,0x7e08,0x7e1b, +0x7e23,0x7e1e,0x7e1d,0x7e09,0x7e10,0x7f79,0x7fb2,0x7ff0, +0x7ff1,0x7fee,0x8028,0x81b3,0x81a9,0x81a8,0x81fb,0x8208, +0x8258,0x8259,0x854a,0x8559,0x8548,0x8568,0x8569,0x8543, +0x8549,0x856d,0x856a,0x855e,0x8783,0x879f,0x879e,0x87a2, +0x878d,0x8861,0x892a,0x8932,0x8925,0x892b,0x8921,0x89aa, +0x89a6,0x8ae6,0x8afa,0x8aeb,0x8af1,0x8b00,0x8adc,0x8ae7, +0x8aee,0x8afe,0x8b01,0x8b02,0x8af7,0x8aed,0x8af3,0x8af6, +0x8afc,0x8c6b,0x8c6d,0x8c93,0x8cf4,0x8e44,0x8e31,0x8e34, +0x8e42,0x8e39,0x8e35,0x8f3b,0x8f2f,0x8f38,0x8f33,0x8fa8, +0x8fa6,0x9075,0x9074,0x9078,0x9072,0x907c,0x907a,0x9134, +0x9192,0x9320,0x9336,0x92f8,0x9333,0x932f,0x9322,0x92fc, +0x932b,0x9304,0x931a,0x9310,0x9326,0x9321,0x9315,0x932e, +0x9319,0x95bb,0x96a7,0x96a8,0x96aa,0x96d5,0x970e,0x9711, +0x9716,0x970d,0x9713,0x970f,0x975b,0x975c,0x9766,0x9798, +0x9830,0x9838,0x983b,0x9837,0x982d,0x9839,0x9824,0x9910, +0x9928,0x991e,0x991b,0x9921,0x991a,0x99ed,0x99e2,0x99f1, +0x9ab8,0x9abc,0x9afb,0x9aed,0x9b28,0x9b91,0x9d15,0x9d23, +0x9d26,0x9d28,0x9d12,0x9d1b,0x9ed8,0x9ed4,0x9f8d,0x9f9c, +0x512a,0x511f,0x5121,0x5132,0x52f5,0x568e,0x5680,0x5690, +0x5685,0x5687,0x568f,0x58d5,0x58d3,0x58d1,0x58ce,0x5b30, +0x5b2a,0x5b24,0x5b7a,0x5c37,0x5c68,0x5dbc,0x5dba,0x5dbd, +0x5db8,0x5e6b,0x5f4c,0x5fbd,0x61c9,0x61c2,0x61c7,0x61e6, +0x61cb,0x6232,0x6234,0x64ce,0x64ca,0x64d8,0x64e0,0x64f0, +0x64e6,0x64ec,0x64f1,0x64e2,0x64ed,0x6582,0x6583,0x66d9, +0x66d6,0x6a80,0x6a94,0x6a84,0x6aa2,0x6a9c,0x6adb,0x6aa3, +0x6a7e,0x6a97,0x6a90,0x6aa0,0x6b5c,0x6bae,0x6bda,0x6c08, +0x6fd8,0x6ff1,0x6fdf,0x6fe0,0x6fdb,0x6fe4,0x6feb,0x6fef, +0x6f80,0x6fec,0x6fe1,0x6fe9,0x6fd5,0x6fee,0x6ff0,0x71e7, +0x71df,0x71ee,0x71e6,0x71e5,0x71ed,0x71ec,0x71f4,0x71e0, +0x7235,0x7246,0x7370,0x7372,0x74a9,0x74b0,0x74a6,0x74a8, +0x7646,0x7642,0x764c,0x76ea,0x77b3,0x77aa,0x77b0,0x77ac, +0x77a7,0x77ad,0x77ef,0x78f7,0x78fa,0x78f4,0x78ef,0x7901, +0x79a7,0x79aa,0x7a57,0x7abf,0x7c07,0x7c0d,0x7bfe,0x7bf7, +0x7c0c,0x7be0,0x7ce0,0x7cdc,0x7cde,0x7ce2,0x7cdf,0x7cd9, +0x7cdd,0x7e2e,0x7e3e,0x7e46,0x7e37,0x7e32,0x7e43,0x7e2b, +0x7e3d,0x7e31,0x7e45,0x7e41,0x7e34,0x7e39,0x7e48,0x7e35, +0x7e3f,0x7e2f,0x7f44,0x7ff3,0x7ffc,0x8071,0x8072,0x8070, +0x806f,0x8073,0x81c6,0x81c3,0x81ba,0x81c2,0x81c0,0x81bf, +0x81bd,0x81c9,0x81be,0x81e8,0x8209,0x8271,0x85aa,0x8584, +0x857e,0x859c,0x8591,0x8594,0x85af,0x859b,0x8587,0x85a8, +0x858a,0x8667,0x87c0,0x87d1,0x87b3,0x87d2,0x87c6,0x87ab, +0x87bb,0x87ba,0x87c8,0x87cb,0x893b,0x8936,0x8944,0x8938, +0x893d,0x89ac,0x8b0e,0x8b17,0x8b19,0x8b1b,0x8b0a,0x8b20, +0x8b1d,0x8b04,0x8b10,0x8c41,0x8c3f,0x8c73,0x8cfa,0x8cfd, +0x8cfc,0x8cf8,0x8cfb,0x8da8,0x8e49,0x8e4b,0x8e48,0x8e4a, +0x8f44,0x8f3e,0x8f42,0x8f45,0x8f3f,0x907f,0x907d,0x9084, +0x9081,0x9082,0x9080,0x9139,0x91a3,0x919e,0x919c,0x934d, +0x9382,0x9328,0x9375,0x934a,0x9365,0x934b,0x9318,0x937e, +0x936c,0x935b,0x9370,0x935a,0x9354,0x95ca,0x95cb,0x95cc, +0x95c8,0x95c6,0x96b1,0x96b8,0x96d6,0x971c,0x971e,0x97a0, +0x97d3,0x9846,0x98b6,0x9935,0x9a01,0x99ff,0x9bae,0x9bab, +0x9baa,0x9bad,0x9d3b,0x9d3f,0x9e8b,0x9ecf,0x9ede,0x9edc, +0x9edd,0x9edb,0x9f3e,0x9f4b,0x53e2,0x5695,0x56ae,0x58d9, +0x58d8,0x5b38,0x5f5d,0x61e3,0x6233,0x64f4,0x64f2,0x64fe, +0x6506,0x64fa,0x64fb,0x64f7,0x65b7,0x66dc,0x6726,0x6ab3, +0x6aac,0x6ac3,0x6abb,0x6ab8,0x6ac2,0x6aae,0x6aaf,0x6b5f, +0x6b78,0x6baf,0x7009,0x700b,0x6ffe,0x7006,0x6ffa,0x7011, +0x700f,0x71fb,0x71fc,0x71fe,0x71f8,0x7377,0x7375,0x74a7, +0x74bf,0x7515,0x7656,0x7658,0x7652,0x77bd,0x77bf,0x77bb, +0x77bc,0x790e,0x79ae,0x7a61,0x7a62,0x7a60,0x7ac4,0x7ac5, +0x7c2b,0x7c27,0x7c2a,0x7c1e,0x7c23,0x7c21,0x7ce7,0x7e54, +0x7e55,0x7e5e,0x7e5a,0x7e61,0x7e52,0x7e59,0x7f48,0x7ff9, +0x7ffb,0x8077,0x8076,0x81cd,0x81cf,0x820a,0x85cf,0x85a9, +0x85cd,0x85d0,0x85c9,0x85b0,0x85ba,0x85b9,0x85a6,0x87ef, +0x87ec,0x87f2,0x87e0,0x8986,0x89b2,0x89f4,0x8b28,0x8b39, +0x8b2c,0x8b2b,0x8c50,0x8d05,0x8e59,0x8e63,0x8e66,0x8e64, +0x8e5f,0x8e55,0x8ec0,0x8f49,0x8f4d,0x9087,0x9083,0x9088, +0x91ab,0x91ac,0x91d0,0x9394,0x938a,0x9396,0x93a2,0x93b3, +0x93ae,0x93ac,0x93b0,0x9398,0x939a,0x9397,0x95d4,0x95d6, +0x95d0,0x95d5,0x96e2,0x96dc,0x96d9,0x96db,0x96de,0x9724, +0x97a3,0x97a6,0x97ad,0x97f9,0x984d,0x984f,0x984c,0x984e, +0x9853,0x98ba,0x993e,0x993f,0x993d,0x992e,0x99a5,0x9a0e, +0x9ac1,0x9b03,0x9b06,0x9b4f,0x9b4e,0x9b4d,0x9bca,0x9bc9, +0x9bfd,0x9bc8,0x9bc0,0x9d51,0x9d5d,0x9d60,0x9ee0,0x9f15, +0x9f2c,0x5133,0x56a5,0x58de,0x58df,0x58e2,0x5bf5,0x9f90, +0x5eec,0x61f2,0x61f7,0x61f6,0x61f5,0x6500,0x650f,0x66e0, +0x66dd,0x6ae5,0x6add,0x6ada,0x6ad3,0x701b,0x701f,0x7028, +0x701a,0x701d,0x7015,0x7018,0x7206,0x720d,0x7258,0x72a2, +0x7378,0x737a,0x74bd,0x74ca,0x74e3,0x7587,0x7586,0x765f, +0x7661,0x77c7,0x7919,0x79b1,0x7a6b,0x7a69,0x7c3e,0x7c3f, +0x7c38,0x7c3d,0x7c37,0x7c40,0x7e6b,0x7e6d,0x7e79,0x7e69, +0x7e6a,0x7f85,0x7e73,0x7fb6,0x7fb9,0x7fb8,0x81d8,0x85e9, +0x85dd,0x85ea,0x85d5,0x85e4,0x85e5,0x85f7,0x87fb,0x8805, +0x880d,0x87f9,0x87fe,0x8960,0x895f,0x8956,0x895e,0x8b41, +0x8b5c,0x8b58,0x8b49,0x8b5a,0x8b4e,0x8b4f,0x8b46,0x8b59, +0x8d08,0x8d0a,0x8e7c,0x8e72,0x8e87,0x8e76,0x8e6c,0x8e7a, +0x8e74,0x8f54,0x8f4e,0x8fad,0x908a,0x908b,0x91b1,0x91ae, +0x93e1,0x93d1,0x93df,0x93c3,0x93c8,0x93dc,0x93dd,0x93d6, +0x93e2,0x93cd,0x93d8,0x93e4,0x93d7,0x93e8,0x95dc,0x96b4, +0x96e3,0x972a,0x9727,0x9761,0x97dc,0x97fb,0x985e,0x9858, +0x985b,0x98bc,0x9945,0x9949,0x9a16,0x9a19,0x9b0d,0x9be8, +0x9be7,0x9bd6,0x9bdb,0x9d89,0x9d61,0x9d72,0x9d6a,0x9d6c, +0x9e92,0x9e97,0x9e93,0x9eb4,0x52f8,0x56a8,0x56b7,0x56b6, +0x56b4,0x56bc,0x58e4,0x5b40,0x5b43,0x5b7d,0x5bf6,0x5dc9, +0x61f8,0x61fa,0x6518,0x6514,0x6519,0x66e6,0x6727,0x6aec, +0x703e,0x7030,0x7032,0x7210,0x737b,0x74cf,0x7662,0x7665, +0x7926,0x792a,0x792c,0x792b,0x7ac7,0x7af6,0x7c4c,0x7c43, +0x7c4d,0x7cef,0x7cf0,0x8fae,0x7e7d,0x7e7c,0x7e82,0x7f4c, +0x8000,0x81da,0x8266,0x85fb,0x85f9,0x8611,0x85fa,0x8606, +0x860b,0x8607,0x860a,0x8814,0x8815,0x8964,0x89ba,0x89f8, +0x8b70,0x8b6c,0x8b66,0x8b6f,0x8b5f,0x8b6b,0x8d0f,0x8d0d, +0x8e89,0x8e81,0x8e85,0x8e82,0x91b4,0x91cb,0x9418,0x9403, +0x93fd,0x95e1,0x9730,0x98c4,0x9952,0x9951,0x99a8,0x9a2b, +0x9a30,0x9a37,0x9a35,0x9c13,0x9c0d,0x9e79,0x9eb5,0x9ee8, +0x9f2f,0x9f5f,0x9f63,0x9f61,0x5137,0x5138,0x56c1,0x56c0, +0x56c2,0x5914,0x5c6c,0x5dcd,0x61fc,0x61fe,0x651d,0x651c, +0x6595,0x66e9,0x6afb,0x6b04,0x6afa,0x6bb2,0x704c,0x721b, +0x72a7,0x74d6,0x74d4,0x7669,0x77d3,0x7c50,0x7e8f,0x7e8c, +0x7fbc,0x8617,0x862d,0x861a,0x8823,0x8822,0x8821,0x881f, +0x896a,0x896c,0x89bd,0x8b74,0x8b77,0x8b7d,0x8d13,0x8e8a, +0x8e8d,0x8e8b,0x8f5f,0x8faf,0x91ba,0x942e,0x9433,0x9435, +0x943a,0x9438,0x9432,0x942b,0x95e2,0x9738,0x9739,0x9732, +0x97ff,0x9867,0x9865,0x9957,0x9a45,0x9a43,0x9a40,0x9a3e, +0x9acf,0x9b54,0x9b51,0x9c2d,0x9c25,0x9daf,0x9db4,0x9dc2, +0x9db8,0x9e9d,0x9eef,0x9f19,0x9f5c,0x9f66,0x9f67,0x513c, +0x513b,0x56c8,0x56ca,0x56c9,0x5b7f,0x5dd4,0x5dd2,0x5f4e, +0x61ff,0x6524,0x6b0a,0x6b61,0x7051,0x7058,0x7380,0x74e4, +0x758a,0x766e,0x766c,0x79b3,0x7c60,0x7c5f,0x807e,0x807d, +0x81df,0x8972,0x896f,0x89fc,0x8b80,0x8d16,0x8d17,0x8e91, +0x8e93,0x8f61,0x9148,0x9444,0x9451,0x9452,0x973d,0x973e, +0x97c3,0x97c1,0x986b,0x9955,0x9a55,0x9a4d,0x9ad2,0x9b1a, +0x9c49,0x9c31,0x9c3e,0x9c3b,0x9dd3,0x9dd7,0x9f34,0x9f6c, +0x9f6a,0x9f94,0x56cc,0x5dd6,0x6200,0x6523,0x652b,0x652a, +0x66ec,0x6b10,0x74da,0x7aca,0x7c64,0x7c63,0x7c65,0x7e93, +0x7e96,0x7e94,0x81e2,0x8638,0x863f,0x8831,0x8b8a,0x9090, +0x908f,0x9463,0x9460,0x9464,0x9768,0x986f,0x995c,0x9a5a, +0x9a5b,0x9a57,0x9ad3,0x9ad4,0x9ad1,0x9c54,0x9c57,0x9c56, +0x9de5,0x9e9f,0x9ef4,0x56d1,0x58e9,0x652c,0x705e,0x7671, +0x7672,0x77d7,0x7f50,0x7f88,0x8836,0x8839,0x8862,0x8b93, +0x8b92,0x8b96,0x8277,0x8d1b,0x91c0,0x946a,0x9742,0x9748, +0x9744,0x97c6,0x9870,0x9a5f,0x9b22,0x9b58,0x9c5f,0x9df9, +0x9dfa,0x9e7c,0x9e7d,0x9f07,0x9f77,0x9f72,0x5ef3,0x6b16, +0x7063,0x7c6c,0x7c6e,0x883b,0x89c0,0x8ea1,0x91c1,0x9472, +0x9470,0x9871,0x995e,0x9ad6,0x9b23,0x9ecc,0x7064,0x77da, +0x8b9a,0x9477,0x97c9,0x9a62,0x9a65,0x7e9c,0x8b9c,0x8eaa, +0x91c5,0x947d,0x947e,0x947c,0x9c77,0x9c78,0x9ef7,0x8c54, +0x947f,0x9e1a,0x7228,0x9a6a,0x9b31,0x9e1b,0x9e1e,0x7c72, +0xf6b1,0xf6b2,0xf6b3,0xf6b4,0xf6b5,0xf6b6,0xf6b7,0xf6b8, +0xf6b9,0xf6ba,0xf6bb,0xf6bc,0xf6bd,0xf6be,0xf6bf,0xf6c0, +0xf6c1,0xf6c2,0xf6c3,0xf6c4,0xf6c5,0xf6c6,0xf6c7,0xf6c8, +0xf6c9,0xf6ca,0xf6cb,0xf6cc,0xf6cd,0xf6ce,0xf6cf,0xf6d0, +0xf6d1,0xf6d2,0xf6d3,0xf6d4,0xf6d5,0xf6d6,0xf6d7,0xf6d8, +0xf6d9,0xf6da,0xf6db,0xf6dc,0xf6dd,0xf6de,0xf6df,0xf6e0, +0xf6e1,0xf6e2,0xf6e3,0xf6e4,0xf6e5,0xf6e6,0xf6e7,0xf6e8, +0xf6e9,0xf6ea,0xf6eb,0xf6ec,0xf6ed,0xf6ee,0xf6ef,0xf6f0, +0xf6f1,0xf6f2,0xf6f3,0xf6f4,0xf6f5,0xf6f6,0xf6f7,0xf6f8, +0xf6f9,0xf6fa,0xf6fb,0xf6fc,0xf6fd,0xf6fe,0xf6ff,0xf700, +0xf701,0xf702,0xf703,0xf704,0xf705,0xf706,0xf707,0xf708, +0xf709,0xf70a,0xf70b,0xf70c,0xf70d,0xf70e,0xf70f,0xf710, +0xf711,0xf712,0xf713,0xf714,0xf715,0xf716,0xf717,0xf718, +0xf719,0xf71a,0xf71b,0xf71c,0xf71d,0xf71e,0xf71f,0xf720, +0xf721,0xf722,0xf723,0xf724,0xf725,0xf726,0xf727,0xf728, +0xf729,0xf72a,0xf72b,0xf72c,0xf72d,0xf72e,0xf72f,0xf730, +0xf731,0xf732,0xf733,0xf734,0xf735,0xf736,0xf737,0xf738, +0xf739,0xf73a,0xf73b,0xf73c,0xf73d,0xf73e,0xf73f,0xf740, +0xf741,0xf742,0xf743,0xf744,0xf745,0xf746,0xf747,0xf748, +0xf749,0xf74a,0xf74b,0xf74c,0xf74d,0xf74e,0xf74f,0xf750, +0xf751,0xf752,0xf753,0xf754,0xf755,0xf756,0xf757,0xf758, +0xf759,0xf75a,0xf75b,0xf75c,0xf75d,0xf75e,0xf75f,0xf760, +0xf761,0xf762,0xf763,0xf764,0xf765,0xf766,0xf767,0xf768, +0xf769,0xf76a,0xf76b,0xf76c,0xf76d,0xf76e,0xf76f,0xf770, +0xf771,0xf772,0xf773,0xf774,0xf775,0xf776,0xf777,0xf778, +0xf779,0xf77a,0xf77b,0xf77c,0xf77d,0xf77e,0xf77f,0xf780, +0xf781,0xf782,0xf783,0xf784,0xf785,0xf786,0xf787,0xf788, +0xf789,0xf78a,0xf78b,0xf78c,0xf78d,0xf78e,0xf78f,0xf790, +0xf791,0xf792,0xf793,0xf794,0xf795,0xf796,0xf797,0xf798, +0xf799,0xf79a,0xf79b,0xf79c,0xf79d,0xf79e,0xf79f,0xf7a0, +0xf7a1,0xf7a2,0xf7a3,0xf7a4,0xf7a5,0xf7a6,0xf7a7,0xf7a8, +0xf7a9,0xf7aa,0xf7ab,0xf7ac,0xf7ad,0xf7ae,0xf7af,0xf7b0, +0xf7b1,0xf7b2,0xf7b3,0xf7b4,0xf7b5,0xf7b6,0xf7b7,0xf7b8, +0xf7b9,0xf7ba,0xf7bb,0xf7bc,0xf7bd,0xf7be,0xf7bf,0xf7c0, +0xf7c1,0xf7c2,0xf7c3,0xf7c4,0xf7c5,0xf7c6,0xf7c7,0xf7c8, +0xf7c9,0xf7ca,0xf7cb,0xf7cc,0xf7cd,0xf7ce,0xf7cf,0xf7d0, +0xf7d1,0xf7d2,0xf7d3,0xf7d4,0xf7d5,0xf7d6,0xf7d7,0xf7d8, +0xf7d9,0xf7da,0xf7db,0xf7dc,0xf7dd,0xf7de,0xf7df,0xf7e0, +0xf7e1,0xf7e2,0xf7e3,0xf7e4,0xf7e5,0xf7e6,0xf7e7,0xf7e8, +0xf7e9,0xf7ea,0xf7eb,0xf7ec,0xf7ed,0xf7ee,0xf7ef,0xf7f0, +0xf7f1,0xf7f2,0xf7f3,0xf7f4,0xf7f5,0xf7f6,0xf7f7,0xf7f8, +0xf7f9,0xf7fa,0xf7fb,0xf7fc,0xf7fd,0xf7fe,0xf7ff,0xf800, +0xf801,0xf802,0xf803,0xf804,0xf805,0xf806,0xf807,0xf808, +0xf809,0xf80a,0xf80b,0xf80c,0xf80d,0xf80e,0xf80f,0xf810, +0xf811,0xf812,0xf813,0xf814,0xf815,0xf816,0xf817,0xf818, +0xf819,0xf81a,0xf81b,0xf81c,0xf81d,0xf81e,0xf81f,0xf820, +0xf821,0xf822,0xf823,0xf824,0xf825,0xf826,0xf827,0xf828, +0xf829,0xf82a,0xf82b,0xf82c,0xf82d,0xf82e,0xf82f,0xf830, +0xf831,0xf832,0xf833,0xf834,0xf835,0xf836,0xf837,0xf838, +0xf839,0xf83a,0xf83b,0xf83c,0xf83d,0xf83e,0xf83f,0xf840, +0xf841,0xf842,0xf843,0xf844,0xf845,0xf846,0xf847,0xf848, +0x4e42,0x4e5c,0x51f5,0x531a,0x5382,0x4e07,0x4e0c,0x4e47, +0x4e8d,0x56d7,0xfa0c,0x5c6e,0x5f73,0x4e0f,0x5187,0x4e0e, +0x4e2e,0x4e93,0x4ec2,0x4ec9,0x4ec8,0x5198,0x52fc,0x536c, +0x53b9,0x5720,0x5903,0x592c,0x5c10,0x5dff,0x65e1,0x6bb3, +0x6bcc,0x6c14,0x723f,0x4e31,0x4e3c,0x4ee8,0x4edc,0x4ee9, +0x4ee1,0x4edd,0x4eda,0x520c,0x531c,0x534c,0x5722,0x5723, +0x5917,0x592f,0x5b81,0x5b84,0x5c12,0x5c3b,0x5c74,0x5c73, +0x5e04,0x5e80,0x5e82,0x5fc9,0x6209,0x6250,0x6c15,0x6c36, +0x6c43,0x6c3f,0x6c3b,0x72ae,0x72b0,0x738a,0x79b8,0x808a, +0x961e,0x4f0e,0x4f18,0x4f2c,0x4ef5,0x4f14,0x4ef1,0x4f00, +0x4ef7,0x4f08,0x4f1d,0x4f02,0x4f05,0x4f22,0x4f13,0x4f04, +0x4ef4,0x4f12,0x51b1,0x5213,0x5209,0x5210,0x52a6,0x5322, +0x531f,0x534d,0x538a,0x5407,0x56e1,0x56df,0x572e,0x572a, +0x5734,0x593c,0x5980,0x597c,0x5985,0x597b,0x597e,0x5977, +0x597f,0x5b56,0x5c15,0x5c25,0x5c7c,0x5c7a,0x5c7b,0x5c7e, +0x5ddf,0x5e75,0x5e84,0x5f02,0x5f1a,0x5f74,0x5fd5,0x5fd4, +0x5fcf,0x625c,0x625e,0x6264,0x6261,0x6266,0x6262,0x6259, +0x6260,0x625a,0x6265,0x65ef,0x65ee,0x673e,0x6739,0x6738, +0x673b,0x673a,0x673f,0x673c,0x6733,0x6c18,0x6c46,0x6c52, +0x6c5c,0x6c4f,0x6c4a,0x6c54,0x6c4b,0x6c4c,0x7071,0x725e, +0x72b4,0x72b5,0x738e,0x752a,0x767f,0x7a75,0x7f51,0x8278, +0x827c,0x8280,0x827d,0x827f,0x864d,0x897e,0x9099,0x9097, +0x9098,0x909b,0x9094,0x9622,0x9624,0x9620,0x9623,0x4f56, +0x4f3b,0x4f62,0x4f49,0x4f53,0x4f64,0x4f3e,0x4f67,0x4f52, +0x4f5f,0x4f41,0x4f58,0x4f2d,0x4f33,0x4f3f,0x4f61,0x518f, +0x51b9,0x521c,0x521e,0x5221,0x52ad,0x52ae,0x5309,0x5363, +0x5372,0x538e,0x538f,0x5430,0x5437,0x542a,0x5454,0x5445, +0x5419,0x541c,0x5425,0x5418,0x543d,0x544f,0x5441,0x5428, +0x5424,0x5447,0x56ee,0x56e7,0x56e5,0x5741,0x5745,0x574c, +0x5749,0x574b,0x5752,0x5906,0x5940,0x59a6,0x5998,0x59a0, +0x5997,0x598e,0x59a2,0x5990,0x598f,0x59a7,0x59a1,0x5b8e, +0x5b92,0x5c28,0x5c2a,0x5c8d,0x5c8f,0x5c88,0x5c8b,0x5c89, +0x5c92,0x5c8a,0x5c86,0x5c93,0x5c95,0x5de0,0x5e0a,0x5e0e, +0x5e8b,0x5e89,0x5e8c,0x5e88,0x5e8d,0x5f05,0x5f1d,0x5f78, +0x5f76,0x5fd2,0x5fd1,0x5fd0,0x5fed,0x5fe8,0x5fee,0x5ff3, +0x5fe1,0x5fe4,0x5fe3,0x5ffa,0x5fef,0x5ff7,0x5ffb,0x6000, +0x5ff4,0x623a,0x6283,0x628c,0x628e,0x628f,0x6294,0x6287, +0x6271,0x627b,0x627a,0x6270,0x6281,0x6288,0x6277,0x627d, +0x6272,0x6274,0x6537,0x65f0,0x65f4,0x65f3,0x65f2,0x65f5, +0x6745,0x6747,0x6759,0x6755,0x674c,0x6748,0x675d,0x674d, +0x675a,0x674b,0x6bd0,0x6c19,0x6c1a,0x6c78,0x6c67,0x6c6b, +0x6c84,0x6c8b,0x6c8f,0x6c71,0x6c6f,0x6c69,0x6c9a,0x6c6d, +0x6c87,0x6c95,0x6c9c,0x6c66,0x6c73,0x6c65,0x6c7b,0x6c8e, +0x7074,0x707a,0x7263,0x72bf,0x72bd,0x72c3,0x72c6,0x72c1, +0x72ba,0x72c5,0x7395,0x7397,0x7393,0x7394,0x7392,0x753a, +0x7539,0x7594,0x7595,0x7681,0x793d,0x8034,0x8095,0x8099, +0x8090,0x8092,0x809c,0x8290,0x828f,0x8285,0x828e,0x8291, +0x8293,0x828a,0x8283,0x8284,0x8c78,0x8fc9,0x8fbf,0x909f, +0x90a1,0x90a5,0x909e,0x90a7,0x90a0,0x9630,0x9628,0x962f, +0x962d,0x4e33,0x4f98,0x4f7c,0x4f85,0x4f7d,0x4f80,0x4f87, +0x4f76,0x4f74,0x4f89,0x4f84,0x4f77,0x4f4c,0x4f97,0x4f6a, +0x4f9a,0x4f79,0x4f81,0x4f78,0x4f90,0x4f9c,0x4f94,0x4f9e, +0x4f92,0x4f82,0x4f95,0x4f6b,0x4f6e,0x519e,0x51bc,0x51be, +0x5235,0x5232,0x5233,0x5246,0x5231,0x52bc,0x530a,0x530b, +0x533c,0x5392,0x5394,0x5487,0x547f,0x5481,0x5491,0x5482, +0x5488,0x546b,0x547a,0x547e,0x5465,0x546c,0x5474,0x5466, +0x548d,0x546f,0x5461,0x5460,0x5498,0x5463,0x5467,0x5464, +0x56f7,0x56f9,0x576f,0x5772,0x576d,0x576b,0x5771,0x5770, +0x5776,0x5780,0x5775,0x577b,0x5773,0x5774,0x5762,0x5768, +0x577d,0x590c,0x5945,0x59b5,0x59ba,0x59cf,0x59ce,0x59b2, +0x59cc,0x59c1,0x59b6,0x59bc,0x59c3,0x59d6,0x59b1,0x59bd, +0x59c0,0x59c8,0x59b4,0x59c7,0x5b62,0x5b65,0x5b93,0x5b95, +0x5c44,0x5c47,0x5cae,0x5ca4,0x5ca0,0x5cb5,0x5caf,0x5ca8, +0x5cac,0x5c9f,0x5ca3,0x5cad,0x5ca2,0x5caa,0x5ca7,0x5c9d, +0x5ca5,0x5cb6,0x5cb0,0x5ca6,0x5e17,0x5e14,0x5e19,0x5f28, +0x5f22,0x5f23,0x5f24,0x5f54,0x5f82,0x5f7e,0x5f7d,0x5fde, +0x5fe5,0x602d,0x6026,0x6019,0x6032,0x600b,0x6034,0x600a, +0x6017,0x6033,0x601a,0x601e,0x602c,0x6022,0x600d,0x6010, +0x602e,0x6013,0x6011,0x600c,0x6009,0x601c,0x6214,0x623d, +0x62ad,0x62b4,0x62d1,0x62be,0x62aa,0x62b6,0x62ca,0x62ae, +0x62b3,0x62af,0x62bb,0x62a9,0x62b0,0x62b8,0x653d,0x65a8, +0x65bb,0x6609,0x65fc,0x6604,0x6612,0x6608,0x65fb,0x6603, +0x660b,0x660d,0x6605,0x65fd,0x6611,0x6610,0x66f6,0x670a, +0x6785,0x676c,0x678e,0x6792,0x6776,0x677b,0x6798,0x6786, +0x6784,0x6774,0x678d,0x678c,0x677a,0x679f,0x6791,0x6799, +0x6783,0x677d,0x6781,0x6778,0x6779,0x6794,0x6b25,0x6b80, +0x6b7e,0x6bde,0x6c1d,0x6c93,0x6cec,0x6ceb,0x6cee,0x6cd9, +0x6cb6,0x6cd4,0x6cad,0x6ce7,0x6cb7,0x6cd0,0x6cc2,0x6cba, +0x6cc3,0x6cc6,0x6ced,0x6cf2,0x6cd2,0x6cdd,0x6cb4,0x6c8a, +0x6c9d,0x6c80,0x6cde,0x6cc0,0x6d30,0x6ccd,0x6cc7,0x6cb0, +0x6cf9,0x6ccf,0x6ce9,0x6cd1,0x7094,0x7098,0x7085,0x7093, +0x7086,0x7084,0x7091,0x7096,0x7082,0x709a,0x7083,0x726a, +0x72d6,0x72cb,0x72d8,0x72c9,0x72dc,0x72d2,0x72d4,0x72da, +0x72cc,0x72d1,0x73a4,0x73a1,0x73ad,0x73a6,0x73a2,0x73a0, +0x73ac,0x739d,0x74dd,0x74e8,0x753f,0x7540,0x753e,0x758c, +0x7598,0x76af,0x76f3,0x76f1,0x76f0,0x76f5,0x77f8,0x77fc, +0x77f9,0x77fb,0x77fa,0x77f7,0x7942,0x793f,0x79c5,0x7a78, +0x7a7b,0x7afb,0x7c75,0x7cfd,0x8035,0x808f,0x80ae,0x80a3, +0x80b8,0x80b5,0x80ad,0x8220,0x82a0,0x82c0,0x82ab,0x829a, +0x8298,0x829b,0x82b5,0x82a7,0x82ae,0x82bc,0x829e,0x82ba, +0x82b4,0x82a8,0x82a1,0x82a9,0x82c2,0x82a4,0x82c3,0x82b6, +0x82a2,0x8670,0x866f,0x866d,0x866e,0x8c56,0x8fd2,0x8fcb, +0x8fd3,0x8fcd,0x8fd6,0x8fd5,0x8fd7,0x90b2,0x90b4,0x90af, +0x90b3,0x90b0,0x9639,0x963d,0x963c,0x963a,0x9643,0x4fcd, +0x4fc5,0x4fd3,0x4fb2,0x4fc9,0x4fcb,0x4fc1,0x4fd4,0x4fdc, +0x4fd9,0x4fbb,0x4fb3,0x4fdb,0x4fc7,0x4fd6,0x4fba,0x4fc0, +0x4fb9,0x4fec,0x5244,0x5249,0x52c0,0x52c2,0x533d,0x537c, +0x5397,0x5396,0x5399,0x5398,0x54ba,0x54a1,0x54ad,0x54a5, +0x54cf,0x54c3,0x830d,0x54b7,0x54ae,0x54d6,0x54b6,0x54c5, +0x54c6,0x54a0,0x5470,0x54bc,0x54a2,0x54be,0x5472,0x54de, +0x54b0,0x57b5,0x579e,0x579f,0x57a4,0x578c,0x5797,0x579d, +0x579b,0x5794,0x5798,0x578f,0x5799,0x57a5,0x579a,0x5795, +0x58f4,0x590d,0x5953,0x59e1,0x59de,0x59ee,0x5a00,0x59f1, +0x59dd,0x59fa,0x59fd,0x59fc,0x59f6,0x59e4,0x59f2,0x59f7, +0x59db,0x59e9,0x59f3,0x59f5,0x59e0,0x59fe,0x59f4,0x59ed, +0x5ba8,0x5c4c,0x5cd0,0x5cd8,0x5ccc,0x5cd7,0x5ccb,0x5cdb, +0x5cde,0x5cda,0x5cc9,0x5cc7,0x5cca,0x5cd6,0x5cd3,0x5cd4, +0x5ccf,0x5cc8,0x5cc6,0x5cce,0x5cdf,0x5cf8,0x5df9,0x5e21, +0x5e22,0x5e23,0x5e20,0x5e24,0x5eb0,0x5ea4,0x5ea2,0x5e9b, +0x5ea3,0x5ea5,0x5f07,0x5f2e,0x5f56,0x5f86,0x6037,0x6039, +0x6054,0x6072,0x605e,0x6045,0x6053,0x6047,0x6049,0x605b, +0x604c,0x6040,0x6042,0x605f,0x6024,0x6044,0x6058,0x6066, +0x606e,0x6242,0x6243,0x62cf,0x630d,0x630b,0x62f5,0x630e, +0x6303,0x62eb,0x62f9,0x630f,0x630c,0x62f8,0x62f6,0x6300, +0x6313,0x6314,0x62fa,0x6315,0x62fb,0x62f0,0x6541,0x6543, +0x65aa,0x65bf,0x6636,0x6621,0x6632,0x6635,0x661c,0x6626, +0x6622,0x6633,0x662b,0x663a,0x661d,0x6634,0x6639,0x662e, +0x670f,0x6710,0x67c1,0x67f2,0x67c8,0x67ba,0x67dc,0x67bb, +0x67f8,0x67d8,0x67c0,0x67b7,0x67c5,0x67eb,0x67e4,0x67df, +0x67b5,0x67cd,0x67b3,0x67f7,0x67f6,0x67ee,0x67e3,0x67c2, +0x67b9,0x67ce,0x67e7,0x67f0,0x67b2,0x67fc,0x67c6,0x67ed, +0x67cc,0x67ae,0x67e6,0x67db,0x67fa,0x67c9,0x67ca,0x67c3, +0x67ea,0x67cb,0x6b28,0x6b82,0x6b84,0x6bb6,0x6bd6,0x6bd8, +0x6be0,0x6c20,0x6c21,0x6d28,0x6d34,0x6d2d,0x6d1f,0x6d3c, +0x6d3f,0x6d12,0x6d0a,0x6cda,0x6d33,0x6d04,0x6d19,0x6d3a, +0x6d1a,0x6d11,0x6d00,0x6d1d,0x6d42,0x6d01,0x6d18,0x6d37, +0x6d03,0x6d0f,0x6d40,0x6d07,0x6d20,0x6d2c,0x6d08,0x6d22, +0x6d09,0x6d10,0x70b7,0x709f,0x70be,0x70b1,0x70b0,0x70a1, +0x70b4,0x70b5,0x70a9,0x7241,0x7249,0x724a,0x726c,0x7270, +0x7273,0x726e,0x72ca,0x72e4,0x72e8,0x72eb,0x72df,0x72ea, +0x72e6,0x72e3,0x7385,0x73cc,0x73c2,0x73c8,0x73c5,0x73b9, +0x73b6,0x73b5,0x73b4,0x73eb,0x73bf,0x73c7,0x73be,0x73c3, +0x73c6,0x73b8,0x73cb,0x74ec,0x74ee,0x752e,0x7547,0x7548, +0x75a7,0x75aa,0x7679,0x76c4,0x7708,0x7703,0x7704,0x7705, +0x770a,0x76f7,0x76fb,0x76fa,0x77e7,0x77e8,0x7806,0x7811, +0x7812,0x7805,0x7810,0x780f,0x780e,0x7809,0x7803,0x7813, +0x794a,0x794c,0x794b,0x7945,0x7944,0x79d5,0x79cd,0x79cf, +0x79d6,0x79ce,0x7a80,0x7a7e,0x7ad1,0x7b00,0x7b01,0x7c7a, +0x7c78,0x7c79,0x7c7f,0x7c80,0x7c81,0x7d03,0x7d08,0x7d01, +0x7f58,0x7f91,0x7f8d,0x7fbe,0x8007,0x800e,0x800f,0x8014, +0x8037,0x80d8,0x80c7,0x80e0,0x80d1,0x80c8,0x80c2,0x80d0, +0x80c5,0x80e3,0x80d9,0x80dc,0x80ca,0x80d5,0x80c9,0x80cf, +0x80d7,0x80e6,0x80cd,0x81ff,0x8221,0x8294,0x82d9,0x82fe, +0x82f9,0x8307,0x82e8,0x8300,0x82d5,0x833a,0x82eb,0x82d6, +0x82f4,0x82ec,0x82e1,0x82f2,0x82f5,0x830c,0x82fb,0x82f6, +0x82f0,0x82ea,0x82e4,0x82e0,0x82fa,0x82f3,0x82ed,0x8677, +0x8674,0x867c,0x8673,0x8841,0x884e,0x8867,0x886a,0x8869, +0x89d3,0x8a04,0x8a07,0x8d72,0x8fe3,0x8fe1,0x8fee,0x8fe0, +0x90f1,0x90bd,0x90bf,0x90d5,0x90c5,0x90be,0x90c7,0x90cb, +0x90c8,0x91d4,0x91d3,0x9654,0x964f,0x9651,0x9653,0x964a, +0x964e,0x501e,0x5005,0x5007,0x5013,0x5022,0x5030,0x501b, +0x4ff5,0x4ff4,0x5033,0x5037,0x502c,0x4ff6,0x4ff7,0x5017, +0x501c,0x5020,0x5027,0x5035,0x502f,0x5031,0x500e,0x515a, +0x5194,0x5193,0x51ca,0x51c4,0x51c5,0x51c8,0x51ce,0x5261, +0x525a,0x5252,0x525e,0x525f,0x5255,0x5262,0x52cd,0x530e, +0x539e,0x5526,0x54e2,0x5517,0x5512,0x54e7,0x54f3,0x54e4, +0x551a,0x54ff,0x5504,0x5508,0x54eb,0x5511,0x5505,0x54f1, +0x550a,0x54fb,0x54f7,0x54f8,0x54e0,0x550e,0x5503,0x550b, +0x5701,0x5702,0x57cc,0x5832,0x57d5,0x57d2,0x57ba,0x57c6, +0x57bd,0x57bc,0x57b8,0x57b6,0x57bf,0x57c7,0x57d0,0x57b9, +0x57c1,0x590e,0x594a,0x5a19,0x5a16,0x5a2d,0x5a2e,0x5a15, +0x5a0f,0x5a17,0x5a0a,0x5a1e,0x5a33,0x5b6c,0x5ba7,0x5bad, +0x5bac,0x5c03,0x5c56,0x5c54,0x5cec,0x5cff,0x5cee,0x5cf1, +0x5cf7,0x5d00,0x5cf9,0x5e29,0x5e28,0x5ea8,0x5eae,0x5eaa, +0x5eac,0x5f33,0x5f30,0x5f67,0x605d,0x605a,0x6067,0x6041, +0x60a2,0x6088,0x6080,0x6092,0x6081,0x609d,0x6083,0x6095, +0x609b,0x6097,0x6087,0x609c,0x608e,0x6219,0x6246,0x62f2, +0x6310,0x6356,0x632c,0x6344,0x6345,0x6336,0x6343,0x63e4, +0x6339,0x634b,0x634a,0x633c,0x6329,0x6341,0x6334,0x6358, +0x6354,0x6359,0x632d,0x6347,0x6333,0x635a,0x6351,0x6338, +0x6357,0x6340,0x6348,0x654a,0x6546,0x65c6,0x65c3,0x65c4, +0x65c2,0x664a,0x665f,0x6647,0x6651,0x6712,0x6713,0x681f, +0x681a,0x6849,0x6832,0x6833,0x683b,0x684b,0x684f,0x6816, +0x6831,0x681c,0x6835,0x682b,0x682d,0x682f,0x684e,0x6844, +0x6834,0x681d,0x6812,0x6814,0x6826,0x6828,0x682e,0x684d, +0x683a,0x6825,0x6820,0x6b2c,0x6b2f,0x6b2d,0x6b31,0x6b34, +0x6b6d,0x8082,0x6b88,0x6be6,0x6be4,0x6be8,0x6be3,0x6be2, +0x6be7,0x6c25,0x6d7a,0x6d63,0x6d64,0x6d76,0x6d0d,0x6d61, +0x6d92,0x6d58,0x6d62,0x6d6d,0x6d6f,0x6d91,0x6d8d,0x6def, +0x6d7f,0x6d86,0x6d5e,0x6d67,0x6d60,0x6d97,0x6d70,0x6d7c, +0x6d5f,0x6d82,0x6d98,0x6d2f,0x6d68,0x6d8b,0x6d7e,0x6d80, +0x6d84,0x6d16,0x6d83,0x6d7b,0x6d7d,0x6d75,0x6d90,0x70dc, +0x70d3,0x70d1,0x70dd,0x70cb,0x7f39,0x70e2,0x70d7,0x70d2, +0x70de,0x70e0,0x70d4,0x70cd,0x70c5,0x70c6,0x70c7,0x70da, +0x70ce,0x70e1,0x7242,0x7278,0x7277,0x7276,0x7300,0x72fa, +0x72f4,0x72fe,0x72f6,0x72f3,0x72fb,0x7301,0x73d3,0x73d9, +0x73e5,0x73d6,0x73bc,0x73e7,0x73e3,0x73e9,0x73dc,0x73d2, +0x73db,0x73d4,0x73dd,0x73da,0x73d7,0x73d8,0x73e8,0x74de, +0x74df,0x74f4,0x74f5,0x7521,0x755b,0x755f,0x75b0,0x75c1, +0x75bb,0x75c4,0x75c0,0x75bf,0x75b6,0x75ba,0x768a,0x76c9, +0x771d,0x771b,0x7710,0x7713,0x7712,0x7723,0x7711,0x7715, +0x7719,0x771a,0x7722,0x7727,0x7823,0x782c,0x7822,0x7835, +0x782f,0x7828,0x782e,0x782b,0x7821,0x7829,0x7833,0x782a, +0x7831,0x7954,0x795b,0x794f,0x795c,0x7953,0x7952,0x7951, +0x79eb,0x79ec,0x79e0,0x79ee,0x79ed,0x79ea,0x79dc,0x79de, +0x79dd,0x7a86,0x7a89,0x7a85,0x7a8b,0x7a8c,0x7a8a,0x7a87, +0x7ad8,0x7b10,0x7b04,0x7b13,0x7b05,0x7b0f,0x7b08,0x7b0a, +0x7b0e,0x7b09,0x7b12,0x7c84,0x7c91,0x7c8a,0x7c8c,0x7c88, +0x7c8d,0x7c85,0x7d1e,0x7d1d,0x7d11,0x7d0e,0x7d18,0x7d16, +0x7d13,0x7d1f,0x7d12,0x7d0f,0x7d0c,0x7f5c,0x7f61,0x7f5e, +0x7f60,0x7f5d,0x7f5b,0x7f96,0x7f92,0x7fc3,0x7fc2,0x7fc0, +0x8016,0x803e,0x8039,0x80fa,0x80f2,0x80f9,0x80f5,0x8101, +0x80fb,0x8100,0x8201,0x822f,0x8225,0x8333,0x832d,0x8344, +0x8319,0x8351,0x8325,0x8356,0x833f,0x8341,0x8326,0x831c, +0x8322,0x8342,0x834e,0x831b,0x832a,0x8308,0x833c,0x834d, +0x8316,0x8324,0x8320,0x8337,0x832f,0x8329,0x8347,0x8345, +0x834c,0x8353,0x831e,0x832c,0x834b,0x8327,0x8348,0x8653, +0x8652,0x86a2,0x86a8,0x8696,0x868d,0x8691,0x869e,0x8687, +0x8697,0x8686,0x868b,0x869a,0x8685,0x86a5,0x8699,0x86a1, +0x86a7,0x8695,0x8698,0x868e,0x869d,0x8690,0x8694,0x8843, +0x8844,0x886d,0x8875,0x8876,0x8872,0x8880,0x8871,0x887f, +0x886f,0x8883,0x887e,0x8874,0x887c,0x8a12,0x8c47,0x8c57, +0x8c7b,0x8ca4,0x8ca3,0x8d76,0x8d78,0x8db5,0x8db7,0x8db6, +0x8ed1,0x8ed3,0x8ffe,0x8ff5,0x9002,0x8fff,0x8ffb,0x9004, +0x8ffc,0x8ff6,0x90d6,0x90e0,0x90d9,0x90da,0x90e3,0x90df, +0x90e5,0x90d8,0x90db,0x90d7,0x90dc,0x90e4,0x9150,0x914e, +0x914f,0x91d5,0x91e2,0x91da,0x965c,0x965f,0x96bc,0x98e3, +0x9adf,0x9b2f,0x4e7f,0x5070,0x506a,0x5061,0x505e,0x5060, +0x5053,0x504b,0x505d,0x5072,0x5048,0x504d,0x5041,0x505b, +0x504a,0x5062,0x5015,0x5045,0x505f,0x5069,0x506b,0x5063, +0x5064,0x5046,0x5040,0x506e,0x5073,0x5057,0x5051,0x51d0, +0x526b,0x526d,0x526c,0x526e,0x52d6,0x52d3,0x532d,0x539c, +0x5575,0x5576,0x553c,0x554d,0x5550,0x5534,0x552a,0x5551, +0x5562,0x5536,0x5535,0x5530,0x5552,0x5545,0x550c,0x5532, +0x5565,0x554e,0x5539,0x5548,0x552d,0x553b,0x5540,0x554b, +0x570a,0x5707,0x57fb,0x5814,0x57e2,0x57f6,0x57dc,0x57f4, +0x5800,0x57ed,0x57fd,0x5808,0x57f8,0x580b,0x57f3,0x57cf, +0x5807,0x57ee,0x57e3,0x57f2,0x57e5,0x57ec,0x57e1,0x580e, +0x57fc,0x5810,0x57e7,0x5801,0x580c,0x57f1,0x57e9,0x57f0, +0x580d,0x5804,0x595c,0x5a60,0x5a58,0x5a55,0x5a67,0x5a5e, +0x5a38,0x5a35,0x5a6d,0x5a50,0x5a5f,0x5a65,0x5a6c,0x5a53, +0x5a64,0x5a57,0x5a43,0x5a5d,0x5a52,0x5a44,0x5a5b,0x5a48, +0x5a8e,0x5a3e,0x5a4d,0x5a39,0x5a4c,0x5a70,0x5a69,0x5a47, +0x5a51,0x5a56,0x5a42,0x5a5c,0x5b72,0x5b6e,0x5bc1,0x5bc0, +0x5c59,0x5d1e,0x5d0b,0x5d1d,0x5d1a,0x5d20,0x5d0c,0x5d28, +0x5d0d,0x5d26,0x5d25,0x5d0f,0x5d30,0x5d12,0x5d23,0x5d1f, +0x5d2e,0x5e3e,0x5e34,0x5eb1,0x5eb4,0x5eb9,0x5eb2,0x5eb3, +0x5f36,0x5f38,0x5f9b,0x5f96,0x5f9f,0x608a,0x6090,0x6086, +0x60be,0x60b0,0x60ba,0x60d3,0x60d4,0x60cf,0x60e4,0x60d9, +0x60dd,0x60c8,0x60b1,0x60db,0x60b7,0x60ca,0x60bf,0x60c3, +0x60cd,0x60c0,0x6332,0x6365,0x638a,0x6382,0x637d,0x63bd, +0x639e,0x63ad,0x639d,0x6397,0x63ab,0x638e,0x636f,0x6387, +0x6390,0x636e,0x63af,0x6375,0x639c,0x636d,0x63ae,0x637c, +0x63a4,0x633b,0x639f,0x6378,0x6385,0x6381,0x6391,0x638d, +0x6370,0x6553,0x65cd,0x6665,0x6661,0x665b,0x6659,0x665c, +0x6662,0x6718,0x6879,0x6887,0x6890,0x689c,0x686d,0x686e, +0x68ae,0x68ab,0x6956,0x686f,0x68a3,0x68ac,0x68a9,0x6875, +0x6874,0x68b2,0x688f,0x6877,0x6892,0x687c,0x686b,0x6872, +0x68aa,0x6880,0x6871,0x687e,0x689b,0x6896,0x688b,0x68a0, +0x6889,0x68a4,0x6878,0x687b,0x6891,0x688c,0x688a,0x687d, +0x6b36,0x6b33,0x6b37,0x6b38,0x6b91,0x6b8f,0x6b8d,0x6b8e, +0x6b8c,0x6c2a,0x6dc0,0x6dab,0x6db4,0x6db3,0x6e74,0x6dac, +0x6de9,0x6de2,0x6db7,0x6df6,0x6dd4,0x6e00,0x6dc8,0x6de0, +0x6ddf,0x6dd6,0x6dbe,0x6de5,0x6ddc,0x6ddd,0x6ddb,0x6df4, +0x6dca,0x6dbd,0x6ded,0x6df0,0x6dba,0x6dd5,0x6dc2,0x6dcf, +0x6dc9,0x6dd0,0x6df2,0x6dd3,0x6dfd,0x6dd7,0x6dcd,0x6de3, +0x6dbb,0x70fa,0x710d,0x70f7,0x7117,0x70f4,0x710c,0x70f0, +0x7104,0x70f3,0x7110,0x70fc,0x70ff,0x7106,0x7113,0x7100, +0x70f8,0x70f6,0x710b,0x7102,0x710e,0x727e,0x727b,0x727c, +0x727f,0x731d,0x7317,0x7307,0x7311,0x7318,0x730a,0x7308, +0x72ff,0x730f,0x731e,0x7388,0x73f6,0x73f8,0x73f5,0x7404, +0x7401,0x73fd,0x7407,0x7400,0x73fa,0x73fc,0x73ff,0x740c, +0x740b,0x73f4,0x7408,0x7564,0x7563,0x75ce,0x75d2,0x75cf, +0x75cb,0x75cc,0x75d1,0x75d0,0x768f,0x7689,0x76d3,0x7739, +0x772f,0x772d,0x7731,0x7732,0x7734,0x7733,0x773d,0x7725, +0x773b,0x7735,0x7848,0x7852,0x7849,0x784d,0x784a,0x784c, +0x7826,0x7845,0x7850,0x7964,0x7967,0x7969,0x796a,0x7963, +0x796b,0x7961,0x79bb,0x79fa,0x79f8,0x79f6,0x79f7,0x7a8f, +0x7a94,0x7a90,0x7b35,0x7b47,0x7b34,0x7b25,0x7b30,0x7b22, +0x7b24,0x7b33,0x7b18,0x7b2a,0x7b1d,0x7b31,0x7b2b,0x7b2d, +0x7b2f,0x7b32,0x7b38,0x7b1a,0x7b23,0x7c94,0x7c98,0x7c96, +0x7ca3,0x7d35,0x7d3d,0x7d38,0x7d36,0x7d3a,0x7d45,0x7d2c, +0x7d29,0x7d41,0x7d47,0x7d3e,0x7d3f,0x7d4a,0x7d3b,0x7d28, +0x7f63,0x7f95,0x7f9c,0x7f9d,0x7f9b,0x7fca,0x7fcb,0x7fcd, +0x7fd0,0x7fd1,0x7fc7,0x7fcf,0x7fc9,0x801f,0x801e,0x801b, +0x8047,0x8043,0x8048,0x8118,0x8125,0x8119,0x811b,0x812d, +0x811f,0x812c,0x811e,0x8121,0x8115,0x8127,0x811d,0x8122, +0x8211,0x8238,0x8233,0x823a,0x8234,0x8232,0x8274,0x8390, +0x83a3,0x83a8,0x838d,0x837a,0x8373,0x83a4,0x8374,0x838f, +0x8381,0x8395,0x8399,0x8375,0x8394,0x83a9,0x837d,0x8383, +0x838c,0x839d,0x839b,0x83aa,0x838b,0x837e,0x83a5,0x83af, +0x8388,0x8397,0x83b0,0x837f,0x83a6,0x8387,0x83ae,0x8376, +0x839a,0x8659,0x8656,0x86bf,0x86b7,0x86c2,0x86c1,0x86c5, +0x86ba,0x86b0,0x86c8,0x86b9,0x86b3,0x86b8,0x86cc,0x86b4, +0x86bb,0x86bc,0x86c3,0x86bd,0x86be,0x8852,0x8889,0x8895, +0x88a8,0x88a2,0x88aa,0x889a,0x8891,0x88a1,0x889f,0x8898, +0x88a7,0x8899,0x889b,0x8897,0x88a4,0x88ac,0x888c,0x8893, +0x888e,0x8982,0x89d6,0x89d9,0x89d5,0x8a30,0x8a27,0x8a2c, +0x8a1e,0x8c39,0x8c3b,0x8c5c,0x8c5d,0x8c7d,0x8ca5,0x8d7d, +0x8d7b,0x8d79,0x8dbc,0x8dc2,0x8db9,0x8dbf,0x8dc1,0x8ed8, +0x8ede,0x8edd,0x8edc,0x8ed7,0x8ee0,0x8ee1,0x9024,0x900b, +0x9011,0x901c,0x900c,0x9021,0x90ef,0x90ea,0x90f0,0x90f4, +0x90f2,0x90f3,0x90d4,0x90eb,0x90ec,0x90e9,0x9156,0x9158, +0x915a,0x9153,0x9155,0x91ec,0x91f4,0x91f1,0x91f3,0x91f8, +0x91e4,0x91f9,0x91ea,0x91eb,0x91f7,0x91e8,0x91ee,0x957a, +0x9586,0x9588,0x967c,0x966d,0x966b,0x9671,0x966f,0x96bf, +0x976a,0x9804,0x98e5,0x9997,0x509b,0x5095,0x5094,0x509e, +0x508b,0x50a3,0x5083,0x508c,0x508e,0x509d,0x5068,0x509c, +0x5092,0x5082,0x5087,0x515f,0x51d4,0x5312,0x5311,0x53a4, +0x53a7,0x5591,0x55a8,0x55a5,0x55ad,0x5577,0x5645,0x55a2, +0x5593,0x5588,0x558f,0x55b5,0x5581,0x55a3,0x5592,0x55a4, +0x557d,0x558c,0x55a6,0x557f,0x5595,0x55a1,0x558e,0x570c, +0x5829,0x5837,0x5819,0x581e,0x5827,0x5823,0x5828,0x57f5, +0x5848,0x5825,0x581c,0x581b,0x5833,0x583f,0x5836,0x582e, +0x5839,0x5838,0x582d,0x582c,0x583b,0x5961,0x5aaf,0x5a94, +0x5a9f,0x5a7a,0x5aa2,0x5a9e,0x5a78,0x5aa6,0x5a7c,0x5aa5, +0x5aac,0x5a95,0x5aae,0x5a37,0x5a84,0x5a8a,0x5a97,0x5a83, +0x5a8b,0x5aa9,0x5a7b,0x5a7d,0x5a8c,0x5a9c,0x5a8f,0x5a93, +0x5a9d,0x5bea,0x5bcd,0x5bcb,0x5bd4,0x5bd1,0x5bca,0x5bce, +0x5c0c,0x5c30,0x5d37,0x5d43,0x5d6b,0x5d41,0x5d4b,0x5d3f, +0x5d35,0x5d51,0x5d4e,0x5d55,0x5d33,0x5d3a,0x5d52,0x5d3d, +0x5d31,0x5d59,0x5d42,0x5d39,0x5d49,0x5d38,0x5d3c,0x5d32, +0x5d36,0x5d40,0x5d45,0x5e44,0x5e41,0x5f58,0x5fa6,0x5fa5, +0x5fab,0x60c9,0x60b9,0x60cc,0x60e2,0x60ce,0x60c4,0x6114, +0x60f2,0x610a,0x6116,0x6105,0x60f5,0x6113,0x60f8,0x60fc, +0x60fe,0x60c1,0x6103,0x6118,0x611d,0x6110,0x60ff,0x6104, +0x610b,0x624a,0x6394,0x63b1,0x63b0,0x63ce,0x63e5,0x63e8, +0x63ef,0x63c3,0x649d,0x63f3,0x63ca,0x63e0,0x63f6,0x63d5, +0x63f2,0x63f5,0x6461,0x63df,0x63be,0x63dd,0x63dc,0x63c4, +0x63d8,0x63d3,0x63c2,0x63c7,0x63cc,0x63cb,0x63c8,0x63f0, +0x63d7,0x63d9,0x6532,0x6567,0x656a,0x6564,0x655c,0x6568, +0x6565,0x658c,0x659d,0x659e,0x65ae,0x65d0,0x65d2,0x667c, +0x666c,0x667b,0x6680,0x6671,0x6679,0x666a,0x6672,0x6701, +0x690c,0x68d3,0x6904,0x68dc,0x692a,0x68ec,0x68ea,0x68f1, +0x690f,0x68d6,0x68f7,0x68eb,0x68e4,0x68f6,0x6913,0x6910, +0x68f3,0x68e1,0x6907,0x68cc,0x6908,0x6970,0x68b4,0x6911, +0x68ef,0x68c6,0x6914,0x68f8,0x68d0,0x68fd,0x68fc,0x68e8, +0x690b,0x690a,0x6917,0x68ce,0x68c8,0x68dd,0x68de,0x68e6, +0x68f4,0x68d1,0x6906,0x68d4,0x68e9,0x6915,0x6925,0x68c7, +0x6b39,0x6b3b,0x6b3f,0x6b3c,0x6b94,0x6b97,0x6b99,0x6b95, +0x6bbd,0x6bf0,0x6bf2,0x6bf3,0x6c30,0x6dfc,0x6e46,0x6e47, +0x6e1f,0x6e49,0x6e88,0x6e3c,0x6e3d,0x6e45,0x6e62,0x6e2b, +0x6e3f,0x6e41,0x6e5d,0x6e73,0x6e1c,0x6e33,0x6e4b,0x6e40, +0x6e51,0x6e3b,0x6e03,0x6e2e,0x6e5e,0x6e68,0x6e5c,0x6e61, +0x6e31,0x6e28,0x6e60,0x6e71,0x6e6b,0x6e39,0x6e22,0x6e30, +0x6e53,0x6e65,0x6e27,0x6e78,0x6e64,0x6e77,0x6e55,0x6e79, +0x6e52,0x6e66,0x6e35,0x6e36,0x6e5a,0x7120,0x711e,0x712f, +0x70fb,0x712e,0x7131,0x7123,0x7125,0x7122,0x7132,0x711f, +0x7128,0x713a,0x711b,0x724b,0x725a,0x7288,0x7289,0x7286, +0x7285,0x728b,0x7312,0x730b,0x7330,0x7322,0x7331,0x7333, +0x7327,0x7332,0x732d,0x7326,0x7323,0x7335,0x730c,0x742e, +0x742c,0x7430,0x742b,0x7416,0x741a,0x7421,0x742d,0x7431, +0x7424,0x7423,0x741d,0x7429,0x7420,0x7432,0x74fb,0x752f, +0x756f,0x756c,0x75e7,0x75da,0x75e1,0x75e6,0x75dd,0x75df, +0x75e4,0x75d7,0x7695,0x7692,0x76da,0x7746,0x7747,0x7744, +0x774d,0x7745,0x774a,0x774e,0x774b,0x774c,0x77de,0x77ec, +0x7860,0x7864,0x7865,0x785c,0x786d,0x7871,0x786a,0x786e, +0x7870,0x7869,0x7868,0x785e,0x7862,0x7974,0x7973,0x7972, +0x7970,0x7a02,0x7a0a,0x7a03,0x7a0c,0x7a04,0x7a99,0x7ae6, +0x7ae4,0x7b4a,0x7b3b,0x7b44,0x7b48,0x7b4c,0x7b4e,0x7b40, +0x7b58,0x7b45,0x7ca2,0x7c9e,0x7ca8,0x7ca1,0x7d58,0x7d6f, +0x7d63,0x7d53,0x7d56,0x7d67,0x7d6a,0x7d4f,0x7d6d,0x7d5c, +0x7d6b,0x7d52,0x7d54,0x7d69,0x7d51,0x7d5f,0x7d4e,0x7f3e, +0x7f3f,0x7f65,0x7f66,0x7fa2,0x7fa0,0x7fa1,0x7fd7,0x8051, +0x804f,0x8050,0x80fe,0x80d4,0x8143,0x814a,0x8152,0x814f, +0x8147,0x813d,0x814d,0x813a,0x81e6,0x81ee,0x81f7,0x81f8, +0x81f9,0x8204,0x823c,0x823d,0x823f,0x8275,0x833b,0x83cf, +0x83f9,0x8423,0x83c0,0x83e8,0x8412,0x83e7,0x83e4,0x83fc, +0x83f6,0x8410,0x83c6,0x83c8,0x83eb,0x83e3,0x83bf,0x8401, +0x83dd,0x83e5,0x83d8,0x83ff,0x83e1,0x83cb,0x83ce,0x83d6, +0x83f5,0x83c9,0x8409,0x840f,0x83de,0x8411,0x8406,0x83c2, +0x83f3,0x83d5,0x83fa,0x83c7,0x83d1,0x83ea,0x8413,0x83c3, +0x83ec,0x83ee,0x83c4,0x83fb,0x83d7,0x83e2,0x841b,0x83db, +0x83fe,0x86d8,0x86e2,0x86e6,0x86d3,0x86e3,0x86da,0x86ea, +0x86dd,0x86eb,0x86dc,0x86ec,0x86e9,0x86d7,0x86e8,0x86d1, +0x8848,0x8856,0x8855,0x88ba,0x88d7,0x88b9,0x88b8,0x88c0, +0x88be,0x88b6,0x88bc,0x88b7,0x88bd,0x88b2,0x8901,0x88c9, +0x8995,0x8998,0x8997,0x89dd,0x89da,0x89db,0x8a4e,0x8a4d, +0x8a39,0x8a59,0x8a40,0x8a57,0x8a58,0x8a44,0x8a45,0x8a52, +0x8a48,0x8a51,0x8a4a,0x8a4c,0x8a4f,0x8c5f,0x8c81,0x8c80, +0x8cba,0x8cbe,0x8cb0,0x8cb9,0x8cb5,0x8d84,0x8d80,0x8d89, +0x8dd8,0x8dd3,0x8dcd,0x8dc7,0x8dd6,0x8ddc,0x8dcf,0x8dd5, +0x8dd9,0x8dc8,0x8dd7,0x8dc5,0x8eef,0x8ef7,0x8efa,0x8ef9, +0x8ee6,0x8eee,0x8ee5,0x8ef5,0x8ee7,0x8ee8,0x8ef6,0x8eeb, +0x8ef1,0x8eec,0x8ef4,0x8ee9,0x902d,0x9034,0x902f,0x9106, +0x912c,0x9104,0x90ff,0x90fc,0x9108,0x90f9,0x90fb,0x9101, +0x9100,0x9107,0x9105,0x9103,0x9161,0x9164,0x915f,0x9162, +0x9160,0x9201,0x920a,0x9225,0x9203,0x921a,0x9226,0x920f, +0x920c,0x9200,0x9212,0x91ff,0x91fd,0x9206,0x9204,0x9227, +0x9202,0x921c,0x9224,0x9219,0x9217,0x9205,0x9216,0x957b, +0x958d,0x958c,0x9590,0x9687,0x967e,0x9688,0x9689,0x9683, +0x9680,0x96c2,0x96c8,0x96c3,0x96f1,0x96f0,0x976c,0x9770, +0x976e,0x9807,0x98a9,0x98eb,0x9ce6,0x9ef9,0x4e83,0x4e84, +0x4eb6,0x50bd,0x50bf,0x50c6,0x50ae,0x50c4,0x50ca,0x50b4, +0x50c8,0x50c2,0x50b0,0x50c1,0x50ba,0x50b1,0x50cb,0x50c9, +0x50b6,0x50b8,0x51d7,0x527a,0x5278,0x527b,0x527c,0x55c3, +0x55db,0x55cc,0x55d0,0x55cb,0x55ca,0x55dd,0x55c0,0x55d4, +0x55c4,0x55e9,0x55bf,0x55d2,0x558d,0x55cf,0x55d5,0x55e2, +0x55d6,0x55c8,0x55f2,0x55cd,0x55d9,0x55c2,0x5714,0x5853, +0x5868,0x5864,0x584f,0x584d,0x5849,0x586f,0x5855,0x584e, +0x585d,0x5859,0x5865,0x585b,0x583d,0x5863,0x5871,0x58fc, +0x5ac7,0x5ac4,0x5acb,0x5aba,0x5ab8,0x5ab1,0x5ab5,0x5ab0, +0x5abf,0x5ac8,0x5abb,0x5ac6,0x5ab7,0x5ac0,0x5aca,0x5ab4, +0x5ab6,0x5acd,0x5ab9,0x5a90,0x5bd6,0x5bd8,0x5bd9,0x5c1f, +0x5c33,0x5d71,0x5d63,0x5d4a,0x5d65,0x5d72,0x5d6c,0x5d5e, +0x5d68,0x5d67,0x5d62,0x5df0,0x5e4f,0x5e4e,0x5e4a,0x5e4d, +0x5e4b,0x5ec5,0x5ecc,0x5ec6,0x5ecb,0x5ec7,0x5f40,0x5faf, +0x5fad,0x60f7,0x6149,0x614a,0x612b,0x6145,0x6136,0x6132, +0x612e,0x6146,0x612f,0x614f,0x6129,0x6140,0x6220,0x9168, +0x6223,0x6225,0x6224,0x63c5,0x63f1,0x63eb,0x6410,0x6412, +0x6409,0x6420,0x6424,0x6433,0x6443,0x641f,0x6415,0x6418, +0x6439,0x6437,0x6422,0x6423,0x640c,0x6426,0x6430,0x6428, +0x6441,0x6435,0x642f,0x640a,0x641a,0x6440,0x6425,0x6427, +0x640b,0x63e7,0x641b,0x642e,0x6421,0x640e,0x656f,0x6592, +0x65d3,0x6686,0x668c,0x6695,0x6690,0x668b,0x668a,0x6699, +0x6694,0x6678,0x6720,0x6966,0x695f,0x6938,0x694e,0x6962, +0x6971,0x693f,0x6945,0x696a,0x6939,0x6942,0x6957,0x6959, +0x697a,0x6948,0x6949,0x6935,0x696c,0x6933,0x693d,0x6965, +0x68f0,0x6978,0x6934,0x6969,0x6940,0x696f,0x6944,0x6976, +0x6958,0x6941,0x6974,0x694c,0x693b,0x694b,0x6937,0x695c, +0x694f,0x6951,0x6932,0x6952,0x692f,0x697b,0x693c,0x6b46, +0x6b45,0x6b43,0x6b42,0x6b48,0x6b41,0x6b9b,0xfa0d,0x6bfb, +0x6bfc,0x6bf9,0x6bf7,0x6bf8,0x6e9b,0x6ed6,0x6ec8,0x6e8f, +0x6ec0,0x6e9f,0x6e93,0x6e94,0x6ea0,0x6eb1,0x6eb9,0x6ec6, +0x6ed2,0x6ebd,0x6ec1,0x6e9e,0x6ec9,0x6eb7,0x6eb0,0x6ecd, +0x6ea6,0x6ecf,0x6eb2,0x6ebe,0x6ec3,0x6edc,0x6ed8,0x6e99, +0x6e92,0x6e8e,0x6e8d,0x6ea4,0x6ea1,0x6ebf,0x6eb3,0x6ed0, +0x6eca,0x6e97,0x6eae,0x6ea3,0x7147,0x7154,0x7152,0x7163, +0x7160,0x7141,0x715d,0x7162,0x7172,0x7178,0x716a,0x7161, +0x7142,0x7158,0x7143,0x714b,0x7170,0x715f,0x7150,0x7153, +0x7144,0x714d,0x715a,0x724f,0x728d,0x728c,0x7291,0x7290, +0x728e,0x733c,0x7342,0x733b,0x733a,0x7340,0x734a,0x7349, +0x7444,0x744a,0x744b,0x7452,0x7451,0x7457,0x7440,0x744f, +0x7450,0x744e,0x7442,0x7446,0x744d,0x7454,0x74e1,0x74ff, +0x74fe,0x74fd,0x751d,0x7579,0x7577,0x6983,0x75ef,0x760f, +0x7603,0x75f7,0x75fe,0x75fc,0x75f9,0x75f8,0x7610,0x75fb, +0x75f6,0x75ed,0x75f5,0x75fd,0x7699,0x76b5,0x76dd,0x7755, +0x775f,0x7760,0x7752,0x7756,0x775a,0x7769,0x7767,0x7754, +0x7759,0x776d,0x77e0,0x7887,0x789a,0x7894,0x788f,0x7884, +0x7895,0x7885,0x7886,0x78a1,0x7883,0x7879,0x7899,0x7880, +0x7896,0x787b,0x797c,0x7982,0x797d,0x7979,0x7a11,0x7a18, +0x7a19,0x7a12,0x7a17,0x7a15,0x7a22,0x7a13,0x7a1b,0x7a10, +0x7aa3,0x7aa2,0x7a9e,0x7aeb,0x7b66,0x7b64,0x7b6d,0x7b74, +0x7b69,0x7b72,0x7b65,0x7b73,0x7b71,0x7b70,0x7b61,0x7b78, +0x7b76,0x7b63,0x7cb2,0x7cb4,0x7caf,0x7d88,0x7d86,0x7d80, +0x7d8d,0x7d7f,0x7d85,0x7d7a,0x7d8e,0x7d7b,0x7d83,0x7d7c, +0x7d8c,0x7d94,0x7d84,0x7d7d,0x7d92,0x7f6d,0x7f6b,0x7f67, +0x7f68,0x7f6c,0x7fa6,0x7fa5,0x7fa7,0x7fdb,0x7fdc,0x8021, +0x8164,0x8160,0x8177,0x815c,0x8169,0x815b,0x8162,0x8172, +0x6721,0x815e,0x8176,0x8167,0x816f,0x8144,0x8161,0x821d, +0x8249,0x8244,0x8240,0x8242,0x8245,0x84f1,0x843f,0x8456, +0x8476,0x8479,0x848f,0x848d,0x8465,0x8451,0x8440,0x8486, +0x8467,0x8430,0x844d,0x847d,0x845a,0x8459,0x8474,0x8473, +0x845d,0x8507,0x845e,0x8437,0x843a,0x8434,0x847a,0x8443, +0x8478,0x8432,0x8445,0x8429,0x83d9,0x844b,0x842f,0x8442, +0x842d,0x845f,0x8470,0x8439,0x844e,0x844c,0x8452,0x846f, +0x84c5,0x848e,0x843b,0x8447,0x8436,0x8433,0x8468,0x847e, +0x8444,0x842b,0x8460,0x8454,0x846e,0x8450,0x870b,0x8704, +0x86f7,0x870c,0x86fa,0x86d6,0x86f5,0x874d,0x86f8,0x870e, +0x8709,0x8701,0x86f6,0x870d,0x8705,0x88d6,0x88cb,0x88cd, +0x88ce,0x88de,0x88db,0x88da,0x88cc,0x88d0,0x8985,0x899b, +0x89df,0x89e5,0x89e4,0x89e1,0x89e0,0x89e2,0x89dc,0x89e6, +0x8a76,0x8a86,0x8a7f,0x8a61,0x8a3f,0x8a77,0x8a82,0x8a84, +0x8a75,0x8a83,0x8a81,0x8a74,0x8a7a,0x8c3c,0x8c4b,0x8c4a, +0x8c65,0x8c64,0x8c66,0x8c86,0x8c84,0x8c85,0x8ccc,0x8d68, +0x8d69,0x8d91,0x8d8c,0x8d8e,0x8d8f,0x8d8d,0x8d93,0x8d94, +0x8d90,0x8d92,0x8df0,0x8de0,0x8dec,0x8df1,0x8dee,0x8dd0, +0x8de9,0x8de3,0x8de2,0x8de7,0x8df2,0x8deb,0x8df4,0x8f06, +0x8eff,0x8f01,0x8f00,0x8f05,0x8f07,0x8f08,0x8f02,0x8f0b, +0x9052,0x903f,0x9044,0x9049,0x903d,0x9110,0x910d,0x910f, +0x9111,0x9116,0x9114,0x910b,0x910e,0x916e,0x916f,0x9248, +0x9252,0x9230,0x923a,0x9266,0x9233,0x9265,0x925e,0x9283, +0x922e,0x924a,0x9246,0x926d,0x926c,0x924f,0x9260,0x9267, +0x926f,0x9236,0x9261,0x9270,0x9231,0x9254,0x9263,0x9250, +0x9272,0x924e,0x9253,0x924c,0x9256,0x9232,0x959f,0x959c, +0x959e,0x959b,0x9692,0x9693,0x9691,0x9697,0x96ce,0x96fa, +0x96fd,0x96f8,0x96f5,0x9773,0x9777,0x9778,0x9772,0x980f, +0x980d,0x980e,0x98ac,0x98f6,0x98f9,0x99af,0x99b2,0x99b0, +0x99b5,0x9aad,0x9aab,0x9b5b,0x9cea,0x9ced,0x9ce7,0x9e80, +0x9efd,0x50e6,0x50d4,0x50d7,0x50e8,0x50f3,0x50db,0x50ea, +0x50dd,0x50e4,0x50d3,0x50ec,0x50f0,0x50ef,0x50e3,0x50e0, +0x51d8,0x5280,0x5281,0x52e9,0x52eb,0x5330,0x53ac,0x5627, +0x5615,0x560c,0x5612,0x55fc,0x560f,0x561c,0x5601,0x5613, +0x5602,0x55fa,0x561d,0x5604,0x55ff,0x55f9,0x5889,0x587c, +0x5890,0x5898,0x5886,0x5881,0x587f,0x5874,0x588b,0x587a, +0x5887,0x5891,0x588e,0x5876,0x5882,0x5888,0x587b,0x5894, +0x588f,0x58fe,0x596b,0x5adc,0x5aee,0x5ae5,0x5ad5,0x5aea, +0x5ada,0x5aed,0x5aeb,0x5af3,0x5ae2,0x5ae0,0x5adb,0x5aec, +0x5ade,0x5add,0x5ad9,0x5ae8,0x5adf,0x5b77,0x5be0,0x5be3, +0x5c63,0x5d82,0x5d80,0x5d7d,0x5d86,0x5d7a,0x5d81,0x5d77, +0x5d8a,0x5d89,0x5d88,0x5d7e,0x5d7c,0x5d8d,0x5d79,0x5d7f, +0x5e58,0x5e59,0x5e53,0x5ed8,0x5ed1,0x5ed7,0x5ece,0x5edc, +0x5ed5,0x5ed9,0x5ed2,0x5ed4,0x5f44,0x5f43,0x5f6f,0x5fb6, +0x612c,0x6128,0x6141,0x615e,0x6171,0x6173,0x6152,0x6153, +0x6172,0x616c,0x6180,0x6174,0x6154,0x617a,0x615b,0x6165, +0x613b,0x616a,0x6161,0x6156,0x6229,0x6227,0x622b,0x642b, +0x644d,0x645b,0x645d,0x6474,0x6476,0x6472,0x6473,0x647d, +0x6475,0x6466,0x64a6,0x644e,0x6482,0x645e,0x645c,0x644b, +0x6453,0x6460,0x6450,0x647f,0x643f,0x646c,0x646b,0x6459, +0x6465,0x6477,0x6573,0x65a0,0x66a1,0x66a0,0x669f,0x6705, +0x6704,0x6722,0x69b1,0x69b6,0x69c9,0x69a0,0x69ce,0x6996, +0x69b0,0x69ac,0x69bc,0x6991,0x6999,0x698e,0x69a7,0x698d, +0x69a9,0x69be,0x69af,0x69bf,0x69c4,0x69bd,0x69a4,0x69d4, +0x69b9,0x69ca,0x699a,0x69cf,0x69b3,0x6993,0x69aa,0x69a1, +0x699e,0x69d9,0x6997,0x6990,0x69c2,0x69b5,0x69a5,0x69c6, +0x6b4a,0x6b4d,0x6b4b,0x6b9e,0x6b9f,0x6ba0,0x6bc3,0x6bc4, +0x6bfe,0x6ece,0x6ef5,0x6ef1,0x6f03,0x6f25,0x6ef8,0x6f37, +0x6efb,0x6f2e,0x6f09,0x6f4e,0x6f19,0x6f1a,0x6f27,0x6f18, +0x6f3b,0x6f12,0x6eed,0x6f0a,0x6f36,0x6f73,0x6ef9,0x6eee, +0x6f2d,0x6f40,0x6f30,0x6f3c,0x6f35,0x6eeb,0x6f07,0x6f0e, +0x6f43,0x6f05,0x6efd,0x6ef6,0x6f39,0x6f1c,0x6efc,0x6f3a, +0x6f1f,0x6f0d,0x6f1e,0x6f08,0x6f21,0x7187,0x7190,0x7189, +0x7180,0x7185,0x7182,0x718f,0x717b,0x7186,0x7181,0x7197, +0x7244,0x7253,0x7297,0x7295,0x7293,0x7343,0x734d,0x7351, +0x734c,0x7462,0x7473,0x7471,0x7475,0x7472,0x7467,0x746e, +0x7500,0x7502,0x7503,0x757d,0x7590,0x7616,0x7608,0x760c, +0x7615,0x7611,0x760a,0x7614,0x76b8,0x7781,0x777c,0x7785, +0x7782,0x776e,0x7780,0x776f,0x777e,0x7783,0x78b2,0x78aa, +0x78b4,0x78ad,0x78a8,0x787e,0x78ab,0x789e,0x78a5,0x78a0, +0x78ac,0x78a2,0x78a4,0x7998,0x798a,0x798b,0x7996,0x7995, +0x7994,0x7993,0x7997,0x7988,0x7992,0x7990,0x7a2b,0x7a4a, +0x7a30,0x7a2f,0x7a28,0x7a26,0x7aa8,0x7aab,0x7aac,0x7aee, +0x7b88,0x7b9c,0x7b8a,0x7b91,0x7b90,0x7b96,0x7b8d,0x7b8c, +0x7b9b,0x7b8e,0x7b85,0x7b98,0x5284,0x7b99,0x7ba4,0x7b82, +0x7cbb,0x7cbf,0x7cbc,0x7cba,0x7da7,0x7db7,0x7dc2,0x7da3, +0x7daa,0x7dc1,0x7dc0,0x7dc5,0x7d9d,0x7dce,0x7dc4,0x7dc6, +0x7dcb,0x7dcc,0x7daf,0x7db9,0x7d96,0x7dbc,0x7d9f,0x7da6, +0x7dae,0x7da9,0x7da1,0x7dc9,0x7f73,0x7fe2,0x7fe3,0x7fe5, +0x7fde,0x8024,0x805d,0x805c,0x8189,0x8186,0x8183,0x8187, +0x818d,0x818c,0x818b,0x8215,0x8497,0x84a4,0x84a1,0x849f, +0x84ba,0x84ce,0x84c2,0x84ac,0x84ae,0x84ab,0x84b9,0x84b4, +0x84c1,0x84cd,0x84aa,0x849a,0x84b1,0x84d0,0x849d,0x84a7, +0x84bb,0x84a2,0x8494,0x84c7,0x84cc,0x849b,0x84a9,0x84af, +0x84a8,0x84d6,0x8498,0x84b6,0x84cf,0x84a0,0x84d7,0x84d4, +0x84d2,0x84db,0x84b0,0x8491,0x8661,0x8733,0x8723,0x8728, +0x876b,0x8740,0x872e,0x871e,0x8721,0x8719,0x871b,0x8743, +0x872c,0x8741,0x873e,0x8746,0x8720,0x8732,0x872a,0x872d, +0x873c,0x8712,0x873a,0x8731,0x8735,0x8742,0x8726,0x8727, +0x8738,0x8724,0x871a,0x8730,0x8711,0x88f7,0x88e7,0x88f1, +0x88f2,0x88fa,0x88fe,0x88ee,0x88fc,0x88f6,0x88fb,0x88f0, +0x88ec,0x88eb,0x899d,0x89a1,0x899f,0x899e,0x89e9,0x89eb, +0x89e8,0x8aab,0x8a99,0x8a8b,0x8a92,0x8a8f,0x8a96,0x8c3d, +0x8c68,0x8c69,0x8cd5,0x8ccf,0x8cd7,0x8d96,0x8e09,0x8e02, +0x8dff,0x8e0d,0x8dfd,0x8e0a,0x8e03,0x8e07,0x8e06,0x8e05, +0x8dfe,0x8e00,0x8e04,0x8f10,0x8f11,0x8f0e,0x8f0d,0x9123, +0x911c,0x9120,0x9122,0x911f,0x911d,0x911a,0x9124,0x9121, +0x911b,0x917a,0x9172,0x9179,0x9173,0x92a5,0x92a4,0x9276, +0x929b,0x927a,0x92a0,0x9294,0x92aa,0x928d,0x92a6,0x929a, +0x92ab,0x9279,0x9297,0x927f,0x92a3,0x92ee,0x928e,0x9282, +0x9295,0x92a2,0x927d,0x9288,0x92a1,0x928a,0x9286,0x928c, +0x9299,0x92a7,0x927e,0x9287,0x92a9,0x929d,0x928b,0x922d, +0x969e,0x96a1,0x96ff,0x9758,0x977d,0x977a,0x977e,0x9783, +0x9780,0x9782,0x977b,0x9784,0x9781,0x977f,0x97ce,0x97cd, +0x9816,0x98ad,0x98ae,0x9902,0x9900,0x9907,0x999d,0x999c, +0x99c3,0x99b9,0x99bb,0x99ba,0x99c2,0x99bd,0x99c7,0x9ab1, +0x9ae3,0x9ae7,0x9b3e,0x9b3f,0x9b60,0x9b61,0x9b5f,0x9cf1, +0x9cf2,0x9cf5,0x9ea7,0x50ff,0x5103,0x5130,0x50f8,0x5106, +0x5107,0x50f6,0x50fe,0x510b,0x510c,0x50fd,0x510a,0x528b, +0x528c,0x52f1,0x52ef,0x5648,0x5642,0x564c,0x5635,0x5641, +0x564a,0x5649,0x5646,0x5658,0x565a,0x5640,0x5633,0x563d, +0x562c,0x563e,0x5638,0x562a,0x563a,0x571a,0x58ab,0x589d, +0x58b1,0x58a0,0x58a3,0x58af,0x58ac,0x58a5,0x58a1,0x58ff, +0x5aff,0x5af4,0x5afd,0x5af7,0x5af6,0x5b03,0x5af8,0x5b02, +0x5af9,0x5b01,0x5b07,0x5b05,0x5b0f,0x5c67,0x5d99,0x5d97, +0x5d9f,0x5d92,0x5da2,0x5d93,0x5d95,0x5da0,0x5d9c,0x5da1, +0x5d9a,0x5d9e,0x5e69,0x5e5d,0x5e60,0x5e5c,0x7df3,0x5edb, +0x5ede,0x5ee1,0x5f49,0x5fb2,0x618b,0x6183,0x6179,0x61b1, +0x61b0,0x61a2,0x6189,0x619b,0x6193,0x61af,0x61ad,0x619f, +0x6192,0x61aa,0x61a1,0x618d,0x6166,0x61b3,0x622d,0x646e, +0x6470,0x6496,0x64a0,0x6485,0x6497,0x649c,0x648f,0x648b, +0x648a,0x648c,0x64a3,0x649f,0x6468,0x64b1,0x6498,0x6576, +0x657a,0x6579,0x657b,0x65b2,0x65b3,0x66b5,0x66b0,0x66a9, +0x66b2,0x66b7,0x66aa,0x66af,0x6a00,0x6a06,0x6a17,0x69e5, +0x69f8,0x6a15,0x69f1,0x69e4,0x6a20,0x69ff,0x69ec,0x69e2, +0x6a1b,0x6a1d,0x69fe,0x6a27,0x69f2,0x69ee,0x6a14,0x69f7, +0x69e7,0x6a40,0x6a08,0x69e6,0x69fb,0x6a0d,0x69fc,0x69eb, +0x6a09,0x6a04,0x6a18,0x6a25,0x6a0f,0x69f6,0x6a26,0x6a07, +0x69f4,0x6a16,0x6b51,0x6ba5,0x6ba3,0x6ba2,0x6ba6,0x6c01, +0x6c00,0x6bff,0x6c02,0x6f41,0x6f26,0x6f7e,0x6f87,0x6fc6, +0x6f92,0x6f8d,0x6f89,0x6f8c,0x6f62,0x6f4f,0x6f85,0x6f5a, +0x6f96,0x6f76,0x6f6c,0x6f82,0x6f55,0x6f72,0x6f52,0x6f50, +0x6f57,0x6f94,0x6f93,0x6f5d,0x6f00,0x6f61,0x6f6b,0x6f7d, +0x6f67,0x6f90,0x6f53,0x6f8b,0x6f69,0x6f7f,0x6f95,0x6f63, +0x6f77,0x6f6a,0x6f7b,0x71b2,0x71af,0x719b,0x71b0,0x71a0, +0x719a,0x71a9,0x71b5,0x719d,0x71a5,0x719e,0x71a4,0x71a1, +0x71aa,0x719c,0x71a7,0x71b3,0x7298,0x729a,0x7358,0x7352, +0x735e,0x735f,0x7360,0x735d,0x735b,0x7361,0x735a,0x7359, +0x7362,0x7487,0x7489,0x748a,0x7486,0x7481,0x747d,0x7485, +0x7488,0x747c,0x7479,0x7508,0x7507,0x757e,0x7625,0x761e, +0x7619,0x761d,0x761c,0x7623,0x761a,0x7628,0x761b,0x769c, +0x769d,0x769e,0x769b,0x778d,0x778f,0x7789,0x7788,0x78cd, +0x78bb,0x78cf,0x78cc,0x78d1,0x78ce,0x78d4,0x78c8,0x78c3, +0x78c4,0x78c9,0x799a,0x79a1,0x79a0,0x799c,0x79a2,0x799b, +0x6b76,0x7a39,0x7ab2,0x7ab4,0x7ab3,0x7bb7,0x7bcb,0x7bbe, +0x7bac,0x7bce,0x7baf,0x7bb9,0x7bca,0x7bb5,0x7cc5,0x7cc8, +0x7ccc,0x7ccb,0x7df7,0x7ddb,0x7dea,0x7de7,0x7dd7,0x7de1, +0x7e03,0x7dfa,0x7de6,0x7df6,0x7df1,0x7df0,0x7dee,0x7ddf, +0x7f76,0x7fac,0x7fb0,0x7fad,0x7fed,0x7feb,0x7fea,0x7fec, +0x7fe6,0x7fe8,0x8064,0x8067,0x81a3,0x819f,0x819e,0x8195, +0x81a2,0x8199,0x8197,0x8216,0x824f,0x8253,0x8252,0x8250, +0x824e,0x8251,0x8524,0x853b,0x850f,0x8500,0x8529,0x850e, +0x8509,0x850d,0x851f,0x850a,0x8527,0x851c,0x84fb,0x852b, +0x84fa,0x8508,0x850c,0x84f4,0x852a,0x84f2,0x8515,0x84f7, +0x84eb,0x84f3,0x84fc,0x8512,0x84ea,0x84e9,0x8516,0x84fe, +0x8528,0x851d,0x852e,0x8502,0x84fd,0x851e,0x84f6,0x8531, +0x8526,0x84e7,0x84e8,0x84f0,0x84ef,0x84f9,0x8518,0x8520, +0x8530,0x850b,0x8519,0x852f,0x8662,0x8756,0x8763,0x8764, +0x8777,0x87e1,0x8773,0x8758,0x8754,0x875b,0x8752,0x8761, +0x875a,0x8751,0x875e,0x876d,0x876a,0x8750,0x874e,0x875f, +0x875d,0x876f,0x876c,0x877a,0x876e,0x875c,0x8765,0x874f, +0x877b,0x8775,0x8762,0x8767,0x8769,0x885a,0x8905,0x890c, +0x8914,0x890b,0x8917,0x8918,0x8919,0x8906,0x8916,0x8911, +0x890e,0x8909,0x89a2,0x89a4,0x89a3,0x89ed,0x89f0,0x89ec, +0x8acf,0x8ac6,0x8ab8,0x8ad3,0x8ad1,0x8ad4,0x8ad5,0x8abb, +0x8ad7,0x8abe,0x8ac0,0x8ac5,0x8ad8,0x8ac3,0x8aba,0x8abd, +0x8ad9,0x8c3e,0x8c4d,0x8c8f,0x8ce5,0x8cdf,0x8cd9,0x8ce8, +0x8cda,0x8cdd,0x8ce7,0x8da0,0x8d9c,0x8da1,0x8d9b,0x8e20, +0x8e23,0x8e25,0x8e24,0x8e2e,0x8e15,0x8e1b,0x8e16,0x8e11, +0x8e19,0x8e26,0x8e27,0x8e14,0x8e12,0x8e18,0x8e13,0x8e1c, +0x8e17,0x8e1a,0x8f2c,0x8f24,0x8f18,0x8f1a,0x8f20,0x8f23, +0x8f16,0x8f17,0x9073,0x9070,0x906f,0x9067,0x906b,0x912f, +0x912b,0x9129,0x912a,0x9132,0x9126,0x912e,0x9185,0x9186, +0x918a,0x9181,0x9182,0x9184,0x9180,0x92d0,0x92c3,0x92c4, +0x92c0,0x92d9,0x92b6,0x92cf,0x92f1,0x92df,0x92d8,0x92e9, +0x92d7,0x92dd,0x92cc,0x92ef,0x92c2,0x92e8,0x92ca,0x92c8, +0x92ce,0x92e6,0x92cd,0x92d5,0x92c9,0x92e0,0x92de,0x92e7, +0x92d1,0x92d3,0x92b5,0x92e1,0x92c6,0x92b4,0x957c,0x95ac, +0x95ab,0x95ae,0x95b0,0x96a4,0x96a2,0x96d3,0x9705,0x9708, +0x9702,0x975a,0x978a,0x978e,0x9788,0x97d0,0x97cf,0x981e, +0x981d,0x9826,0x9829,0x9828,0x9820,0x981b,0x9827,0x98b2, +0x9908,0x98fa,0x9911,0x9914,0x9916,0x9917,0x9915,0x99dc, +0x99cd,0x99cf,0x99d3,0x99d4,0x99ce,0x99c9,0x99d6,0x99d8, +0x99cb,0x99d7,0x99cc,0x9ab3,0x9aec,0x9aeb,0x9af3,0x9af2, +0x9af1,0x9b46,0x9b43,0x9b67,0x9b74,0x9b71,0x9b66,0x9b76, +0x9b75,0x9b70,0x9b68,0x9b64,0x9b6c,0x9cfc,0x9cfa,0x9cfd, +0x9cff,0x9cf7,0x9d07,0x9d00,0x9cf9,0x9cfb,0x9d08,0x9d05, +0x9d04,0x9e83,0x9ed3,0x9f0f,0x9f10,0x511c,0x5113,0x5117, +0x511a,0x5111,0x51de,0x5334,0x53e1,0x5670,0x5660,0x566e, +0x5673,0x5666,0x5663,0x566d,0x5672,0x565e,0x5677,0x571c, +0x571b,0x58c8,0x58bd,0x58c9,0x58bf,0x58ba,0x58c2,0x58bc, +0x58c6,0x5b17,0x5b19,0x5b1b,0x5b21,0x5b14,0x5b13,0x5b10, +0x5b16,0x5b28,0x5b1a,0x5b20,0x5b1e,0x5bef,0x5dac,0x5db1, +0x5da9,0x5da7,0x5db5,0x5db0,0x5dae,0x5daa,0x5da8,0x5db2, +0x5dad,0x5daf,0x5db4,0x5e67,0x5e68,0x5e66,0x5e6f,0x5ee9, +0x5ee7,0x5ee6,0x5ee8,0x5ee5,0x5f4b,0x5fbc,0x619d,0x61a8, +0x6196,0x61c5,0x61b4,0x61c6,0x61c1,0x61cc,0x61ba,0x61bf, +0x61b8,0x618c,0x64d7,0x64d6,0x64d0,0x64cf,0x64c9,0x64bd, +0x6489,0x64c3,0x64db,0x64f3,0x64d9,0x6533,0x657f,0x657c, +0x65a2,0x66c8,0x66be,0x66c0,0x66ca,0x66cb,0x66cf,0x66bd, +0x66bb,0x66ba,0x66cc,0x6723,0x6a34,0x6a66,0x6a49,0x6a67, +0x6a32,0x6a68,0x6a3e,0x6a5d,0x6a6d,0x6a76,0x6a5b,0x6a51, +0x6a28,0x6a5a,0x6a3b,0x6a3f,0x6a41,0x6a6a,0x6a64,0x6a50, +0x6a4f,0x6a54,0x6a6f,0x6a69,0x6a60,0x6a3c,0x6a5e,0x6a56, +0x6a55,0x6a4d,0x6a4e,0x6a46,0x6b55,0x6b54,0x6b56,0x6ba7, +0x6baa,0x6bab,0x6bc8,0x6bc7,0x6c04,0x6c03,0x6c06,0x6fad, +0x6fcb,0x6fa3,0x6fc7,0x6fbc,0x6fce,0x6fc8,0x6f5e,0x6fc4, +0x6fbd,0x6f9e,0x6fca,0x6fa8,0x7004,0x6fa5,0x6fae,0x6fba, +0x6fac,0x6faa,0x6fcf,0x6fbf,0x6fb8,0x6fa2,0x6fc9,0x6fab, +0x6fcd,0x6faf,0x6fb2,0x6fb0,0x71c5,0x71c2,0x71bf,0x71b8, +0x71d6,0x71c0,0x71c1,0x71cb,0x71d4,0x71ca,0x71c7,0x71cf, +0x71bd,0x71d8,0x71bc,0x71c6,0x71da,0x71db,0x729d,0x729e, +0x7369,0x7366,0x7367,0x736c,0x7365,0x736b,0x736a,0x747f, +0x749a,0x74a0,0x7494,0x7492,0x7495,0x74a1,0x750b,0x7580, +0x762f,0x762d,0x7631,0x763d,0x7633,0x763c,0x7635,0x7632, +0x7630,0x76bb,0x76e6,0x779a,0x779d,0x77a1,0x779c,0x779b, +0x77a2,0x77a3,0x7795,0x7799,0x7797,0x78dd,0x78e9,0x78e5, +0x78ea,0x78de,0x78e3,0x78db,0x78e1,0x78e2,0x78ed,0x78df, +0x78e0,0x79a4,0x7a44,0x7a48,0x7a47,0x7ab6,0x7ab8,0x7ab5, +0x7ab1,0x7ab7,0x7bde,0x7be3,0x7be7,0x7bdd,0x7bd5,0x7be5, +0x7bda,0x7be8,0x7bf9,0x7bd4,0x7bea,0x7be2,0x7bdc,0x7beb, +0x7bd8,0x7bdf,0x7cd2,0x7cd4,0x7cd7,0x7cd0,0x7cd1,0x7e12, +0x7e21,0x7e17,0x7e0c,0x7e1f,0x7e20,0x7e13,0x7e0e,0x7e1c, +0x7e15,0x7e1a,0x7e22,0x7e0b,0x7e0f,0x7e16,0x7e0d,0x7e14, +0x7e25,0x7e24,0x7f43,0x7f7b,0x7f7c,0x7f7a,0x7fb1,0x7fef, +0x802a,0x8029,0x806c,0x81b1,0x81a6,0x81ae,0x81b9,0x81b5, +0x81ab,0x81b0,0x81ac,0x81b4,0x81b2,0x81b7,0x81a7,0x81f2, +0x8255,0x8256,0x8257,0x8556,0x8545,0x856b,0x854d,0x8553, +0x8561,0x8558,0x8540,0x8546,0x8564,0x8541,0x8562,0x8544, +0x8551,0x8547,0x8563,0x853e,0x855b,0x8571,0x854e,0x856e, +0x8575,0x8555,0x8567,0x8560,0x858c,0x8566,0x855d,0x8554, +0x8565,0x856c,0x8663,0x8665,0x8664,0x879b,0x878f,0x8797, +0x8793,0x8792,0x8788,0x8781,0x8796,0x8798,0x8779,0x8787, +0x87a3,0x8785,0x8790,0x8791,0x879d,0x8784,0x8794,0x879c, +0x879a,0x8789,0x891e,0x8926,0x8930,0x892d,0x892e,0x8927, +0x8931,0x8922,0x8929,0x8923,0x892f,0x892c,0x891f,0x89f1, +0x8ae0,0x8ae2,0x8af2,0x8af4,0x8af5,0x8add,0x8b14,0x8ae4, +0x8adf,0x8af0,0x8ac8,0x8ade,0x8ae1,0x8ae8,0x8aff,0x8aef, +0x8afb,0x8c91,0x8c92,0x8c90,0x8cf5,0x8cee,0x8cf1,0x8cf0, +0x8cf3,0x8d6c,0x8d6e,0x8da5,0x8da7,0x8e33,0x8e3e,0x8e38, +0x8e40,0x8e45,0x8e36,0x8e3c,0x8e3d,0x8e41,0x8e30,0x8e3f, +0x8ebd,0x8f36,0x8f2e,0x8f35,0x8f32,0x8f39,0x8f37,0x8f34, +0x9076,0x9079,0x907b,0x9086,0x90fa,0x9133,0x9135,0x9136, +0x9193,0x9190,0x9191,0x918d,0x918f,0x9327,0x931e,0x9308, +0x931f,0x9306,0x930f,0x937a,0x9338,0x933c,0x931b,0x9323, +0x9312,0x9301,0x9346,0x932d,0x930e,0x930d,0x92cb,0x931d, +0x92fa,0x9325,0x9313,0x92f9,0x92f7,0x9334,0x9302,0x9324, +0x92ff,0x9329,0x9339,0x9335,0x932a,0x9314,0x930c,0x930b, +0x92fe,0x9309,0x9300,0x92fb,0x9316,0x95bc,0x95cd,0x95be, +0x95b9,0x95ba,0x95b6,0x95bf,0x95b5,0x95bd,0x96a9,0x96d4, +0x970b,0x9712,0x9710,0x9799,0x9797,0x9794,0x97f0,0x97f8, +0x9835,0x982f,0x9832,0x9924,0x991f,0x9927,0x9929,0x999e, +0x99ee,0x99ec,0x99e5,0x99e4,0x99f0,0x99e3,0x99ea,0x99e9, +0x99e7,0x9ab9,0x9abf,0x9ab4,0x9abb,0x9af6,0x9afa,0x9af9, +0x9af7,0x9b33,0x9b80,0x9b85,0x9b87,0x9b7c,0x9b7e,0x9b7b, +0x9b82,0x9b93,0x9b92,0x9b90,0x9b7a,0x9b95,0x9b7d,0x9b88, +0x9d25,0x9d17,0x9d20,0x9d1e,0x9d14,0x9d29,0x9d1d,0x9d18, +0x9d22,0x9d10,0x9d19,0x9d1f,0x9e88,0x9e86,0x9e87,0x9eae, +0x9ead,0x9ed5,0x9ed6,0x9efa,0x9f12,0x9f3d,0x5126,0x5125, +0x5122,0x5124,0x5120,0x5129,0x52f4,0x5693,0x568c,0x568d, +0x5686,0x5684,0x5683,0x567e,0x5682,0x567f,0x5681,0x58d6, +0x58d4,0x58cf,0x58d2,0x5b2d,0x5b25,0x5b32,0x5b23,0x5b2c, +0x5b27,0x5b26,0x5b2f,0x5b2e,0x5b7b,0x5bf1,0x5bf2,0x5db7, +0x5e6c,0x5e6a,0x5fbe,0x5fbb,0x61c3,0x61b5,0x61bc,0x61e7, +0x61e0,0x61e5,0x61e4,0x61e8,0x61de,0x64ef,0x64e9,0x64e3, +0x64eb,0x64e4,0x64e8,0x6581,0x6580,0x65b6,0x65da,0x66d2, +0x6a8d,0x6a96,0x6a81,0x6aa5,0x6a89,0x6a9f,0x6a9b,0x6aa1, +0x6a9e,0x6a87,0x6a93,0x6a8e,0x6a95,0x6a83,0x6aa8,0x6aa4, +0x6a91,0x6a7f,0x6aa6,0x6a9a,0x6a85,0x6a8c,0x6a92,0x6b5b, +0x6bad,0x6c09,0x6fcc,0x6fa9,0x6ff4,0x6fd4,0x6fe3,0x6fdc, +0x6fed,0x6fe7,0x6fe6,0x6fde,0x6ff2,0x6fdd,0x6fe2,0x6fe8, +0x71e1,0x71f1,0x71e8,0x71f2,0x71e4,0x71f0,0x71e2,0x7373, +0x736e,0x736f,0x7497,0x74b2,0x74ab,0x7490,0x74aa,0x74ad, +0x74b1,0x74a5,0x74af,0x7510,0x7511,0x7512,0x750f,0x7584, +0x7643,0x7648,0x7649,0x7647,0x76a4,0x76e9,0x77b5,0x77ab, +0x77b2,0x77b7,0x77b6,0x77b4,0x77b1,0x77a8,0x77f0,0x78f3, +0x78fd,0x7902,0x78fb,0x78fc,0x78f2,0x7905,0x78f9,0x78fe, +0x7904,0x79ab,0x79a8,0x7a5c,0x7a5b,0x7a56,0x7a58,0x7a54, +0x7a5a,0x7abe,0x7ac0,0x7ac1,0x7c05,0x7c0f,0x7bf2,0x7c00, +0x7bff,0x7bfb,0x7c0e,0x7bf4,0x7c0b,0x7bf3,0x7c02,0x7c09, +0x7c03,0x7c01,0x7bf8,0x7bfd,0x7c06,0x7bf0,0x7bf1,0x7c10, +0x7c0a,0x7ce8,0x7e2d,0x7e3c,0x7e42,0x7e33,0x9848,0x7e38, +0x7e2a,0x7e49,0x7e40,0x7e47,0x7e29,0x7e4c,0x7e30,0x7e3b, +0x7e36,0x7e44,0x7e3a,0x7f45,0x7f7f,0x7f7e,0x7f7d,0x7ff4, +0x7ff2,0x802c,0x81bb,0x81c4,0x81cc,0x81ca,0x81c5,0x81c7, +0x81bc,0x81e9,0x825b,0x825a,0x825c,0x8583,0x8580,0x858f, +0x85a7,0x8595,0x85a0,0x858b,0x85a3,0x857b,0x85a4,0x859a, +0x859e,0x8577,0x857c,0x8589,0x85a1,0x857a,0x8578,0x8557, +0x858e,0x8596,0x8586,0x858d,0x8599,0x859d,0x8581,0x85a2, +0x8582,0x8588,0x8585,0x8579,0x8576,0x8598,0x8590,0x859f, +0x8668,0x87be,0x87aa,0x87ad,0x87c5,0x87b0,0x87ac,0x87b9, +0x87b5,0x87bc,0x87ae,0x87c9,0x87c3,0x87c2,0x87cc,0x87b7, +0x87af,0x87c4,0x87ca,0x87b4,0x87b6,0x87bf,0x87b8,0x87bd, +0x87de,0x87b2,0x8935,0x8933,0x893c,0x893e,0x8941,0x8952, +0x8937,0x8942,0x89ad,0x89af,0x89ae,0x89f2,0x89f3,0x8b1e, +0x8b18,0x8b16,0x8b11,0x8b05,0x8b0b,0x8b22,0x8b0f,0x8b12, +0x8b15,0x8b07,0x8b0d,0x8b08,0x8b06,0x8b1c,0x8b13,0x8b1a, +0x8c4f,0x8c70,0x8c72,0x8c71,0x8c6f,0x8c95,0x8c94,0x8cf9, +0x8d6f,0x8e4e,0x8e4d,0x8e53,0x8e50,0x8e4c,0x8e47,0x8f43, +0x8f40,0x9085,0x907e,0x9138,0x919a,0x91a2,0x919b,0x9199, +0x919f,0x91a1,0x919d,0x91a0,0x93a1,0x9383,0x93af,0x9364, +0x9356,0x9347,0x937c,0x9358,0x935c,0x9376,0x9349,0x9350, +0x9351,0x9360,0x936d,0x938f,0x934c,0x936a,0x9379,0x9357, +0x9355,0x9352,0x934f,0x9371,0x9377,0x937b,0x9361,0x935e, +0x9363,0x9367,0x9380,0x934e,0x9359,0x95c7,0x95c0,0x95c9, +0x95c3,0x95c5,0x95b7,0x96ae,0x96b0,0x96ac,0x9720,0x971f, +0x9718,0x971d,0x9719,0x979a,0x97a1,0x979c,0x979e,0x979d, +0x97d5,0x97d4,0x97f1,0x9841,0x9844,0x984a,0x9849,0x9845, +0x9843,0x9925,0x992b,0x992c,0x992a,0x9933,0x9932,0x992f, +0x992d,0x9931,0x9930,0x9998,0x99a3,0x99a1,0x9a02,0x99fa, +0x99f4,0x99f7,0x99f9,0x99f8,0x99f6,0x99fb,0x99fd,0x99fe, +0x99fc,0x9a03,0x9abe,0x9afe,0x9afd,0x9b01,0x9afc,0x9b48, +0x9b9a,0x9ba8,0x9b9e,0x9b9b,0x9ba6,0x9ba1,0x9ba5,0x9ba4, +0x9b86,0x9ba2,0x9ba0,0x9baf,0x9d33,0x9d41,0x9d67,0x9d36, +0x9d2e,0x9d2f,0x9d31,0x9d38,0x9d30,0x9d45,0x9d42,0x9d43, +0x9d3e,0x9d37,0x9d40,0x9d3d,0x7ff5,0x9d2d,0x9e8a,0x9e89, +0x9e8d,0x9eb0,0x9ec8,0x9eda,0x9efb,0x9eff,0x9f24,0x9f23, +0x9f22,0x9f54,0x9fa0,0x5131,0x512d,0x512e,0x5698,0x569c, +0x5697,0x569a,0x569d,0x5699,0x5970,0x5b3c,0x5c69,0x5c6a, +0x5dc0,0x5e6d,0x5e6e,0x61d8,0x61df,0x61ed,0x61ee,0x61f1, +0x61ea,0x61f0,0x61eb,0x61d6,0x61e9,0x64ff,0x6504,0x64fd, +0x64f8,0x6501,0x6503,0x64fc,0x6594,0x65db,0x66da,0x66db, +0x66d8,0x6ac5,0x6ab9,0x6abd,0x6ae1,0x6ac6,0x6aba,0x6ab6, +0x6ab7,0x6ac7,0x6ab4,0x6aad,0x6b5e,0x6bc9,0x6c0b,0x7007, +0x700c,0x700d,0x7001,0x7005,0x7014,0x700e,0x6fff,0x7000, +0x6ffb,0x7026,0x6ffc,0x6ff7,0x700a,0x7201,0x71ff,0x71f9, +0x7203,0x71fd,0x7376,0x74b8,0x74c0,0x74b5,0x74c1,0x74be, +0x74b6,0x74bb,0x74c2,0x7514,0x7513,0x765c,0x7664,0x7659, +0x7650,0x7653,0x7657,0x765a,0x76a6,0x76bd,0x76ec,0x77c2, +0x77ba,0x78ff,0x790c,0x7913,0x7914,0x7909,0x7910,0x7912, +0x7911,0x79ad,0x79ac,0x7a5f,0x7c1c,0x7c29,0x7c19,0x7c20, +0x7c1f,0x7c2d,0x7c1d,0x7c26,0x7c28,0x7c22,0x7c25,0x7c30, +0x7e5c,0x7e50,0x7e56,0x7e63,0x7e58,0x7e62,0x7e5f,0x7e51, +0x7e60,0x7e57,0x7e53,0x7fb5,0x7fb3,0x7ff7,0x7ff8,0x8075, +0x81d1,0x81d2,0x81d0,0x825f,0x825e,0x85b4,0x85c6,0x85c0, +0x85c3,0x85c2,0x85b3,0x85b5,0x85bd,0x85c7,0x85c4,0x85bf, +0x85cb,0x85ce,0x85c8,0x85c5,0x85b1,0x85b6,0x85d2,0x8624, +0x85b8,0x85b7,0x85be,0x8669,0x87e7,0x87e6,0x87e2,0x87db, +0x87eb,0x87ea,0x87e5,0x87df,0x87f3,0x87e4,0x87d4,0x87dc, +0x87d3,0x87ed,0x87d8,0x87e3,0x87a4,0x87d7,0x87d9,0x8801, +0x87f4,0x87e8,0x87dd,0x8953,0x894b,0x894f,0x894c,0x8946, +0x8950,0x8951,0x8949,0x8b2a,0x8b27,0x8b23,0x8b33,0x8b30, +0x8b35,0x8b47,0x8b2f,0x8b3c,0x8b3e,0x8b31,0x8b25,0x8b37, +0x8b26,0x8b36,0x8b2e,0x8b24,0x8b3b,0x8b3d,0x8b3a,0x8c42, +0x8c75,0x8c99,0x8c98,0x8c97,0x8cfe,0x8d04,0x8d02,0x8d00, +0x8e5c,0x8e62,0x8e60,0x8e57,0x8e56,0x8e5e,0x8e65,0x8e67, +0x8e5b,0x8e5a,0x8e61,0x8e5d,0x8e69,0x8e54,0x8f46,0x8f47, +0x8f48,0x8f4b,0x9128,0x913a,0x913b,0x913e,0x91a8,0x91a5, +0x91a7,0x91af,0x91aa,0x93b5,0x938c,0x9392,0x93b7,0x939b, +0x939d,0x9389,0x93a7,0x938e,0x93aa,0x939e,0x93a6,0x9395, +0x9388,0x9399,0x939f,0x938d,0x93b1,0x9391,0x93b2,0x93a4, +0x93a8,0x93b4,0x93a3,0x93a5,0x95d2,0x95d3,0x95d1,0x96b3, +0x96d7,0x96da,0x5dc2,0x96df,0x96d8,0x96dd,0x9723,0x9722, +0x9725,0x97ac,0x97ae,0x97a8,0x97ab,0x97a4,0x97aa,0x97a2, +0x97a5,0x97d7,0x97d9,0x97d6,0x97d8,0x97fa,0x9850,0x9851, +0x9852,0x98b8,0x9941,0x993c,0x993a,0x9a0f,0x9a0b,0x9a09, +0x9a0d,0x9a04,0x9a11,0x9a0a,0x9a05,0x9a07,0x9a06,0x9ac0, +0x9adc,0x9b08,0x9b04,0x9b05,0x9b29,0x9b35,0x9b4a,0x9b4c, +0x9b4b,0x9bc7,0x9bc6,0x9bc3,0x9bbf,0x9bc1,0x9bb5,0x9bb8, +0x9bd3,0x9bb6,0x9bc4,0x9bb9,0x9bbd,0x9d5c,0x9d53,0x9d4f, +0x9d4a,0x9d5b,0x9d4b,0x9d59,0x9d56,0x9d4c,0x9d57,0x9d52, +0x9d54,0x9d5f,0x9d58,0x9d5a,0x9e8e,0x9e8c,0x9edf,0x9f01, +0x9f00,0x9f16,0x9f25,0x9f2b,0x9f2a,0x9f29,0x9f28,0x9f4c, +0x9f55,0x5134,0x5135,0x5296,0x52f7,0x53b4,0x56ab,0x56ad, +0x56a6,0x56a7,0x56aa,0x56ac,0x58da,0x58dd,0x58db,0x5912, +0x5b3d,0x5b3e,0x5b3f,0x5dc3,0x5e70,0x5fbf,0x61fb,0x6507, +0x6510,0x650d,0x6509,0x650c,0x650e,0x6584,0x65de,0x65dd, +0x66de,0x6ae7,0x6ae0,0x6acc,0x6ad1,0x6ad9,0x6acb,0x6adf, +0x6adc,0x6ad0,0x6aeb,0x6acf,0x6acd,0x6ade,0x6b60,0x6bb0, +0x6c0c,0x7019,0x7027,0x7020,0x7016,0x702b,0x7021,0x7022, +0x7023,0x7029,0x7017,0x7024,0x701c,0x702a,0x720c,0x720a, +0x7207,0x7202,0x7205,0x72a5,0x72a6,0x72a4,0x72a3,0x72a1, +0x74cb,0x74c5,0x74b7,0x74c3,0x7516,0x7660,0x77c9,0x77ca, +0x77c4,0x77f1,0x791d,0x791b,0x7921,0x791c,0x7917,0x791e, +0x79b0,0x7a67,0x7a68,0x7c33,0x7c3c,0x7c39,0x7c2c,0x7c3b, +0x7cec,0x7cea,0x7e76,0x7e75,0x7e78,0x7e70,0x7e77,0x7e6f, +0x7e7a,0x7e72,0x7e74,0x7e68,0x7f4b,0x7f4a,0x7f83,0x7f86, +0x7fb7,0x7ffd,0x7ffe,0x8078,0x81d7,0x81d5,0x8264,0x8261, +0x8263,0x85eb,0x85f1,0x85ed,0x85d9,0x85e1,0x85e8,0x85da, +0x85d7,0x85ec,0x85f2,0x85f8,0x85d8,0x85df,0x85e3,0x85dc, +0x85d1,0x85f0,0x85e6,0x85ef,0x85de,0x85e2,0x8800,0x87fa, +0x8803,0x87f6,0x87f7,0x8809,0x880c,0x880b,0x8806,0x87fc, +0x8808,0x87ff,0x880a,0x8802,0x8962,0x895a,0x895b,0x8957, +0x8961,0x895c,0x8958,0x895d,0x8959,0x8988,0x89b7,0x89b6, +0x89f6,0x8b50,0x8b48,0x8b4a,0x8b40,0x8b53,0x8b56,0x8b54, +0x8b4b,0x8b55,0x8b51,0x8b42,0x8b52,0x8b57,0x8c43,0x8c77, +0x8c76,0x8c9a,0x8d06,0x8d07,0x8d09,0x8dac,0x8daa,0x8dad, +0x8dab,0x8e6d,0x8e78,0x8e73,0x8e6a,0x8e6f,0x8e7b,0x8ec2, +0x8f52,0x8f51,0x8f4f,0x8f50,0x8f53,0x8fb4,0x9140,0x913f, +0x91b0,0x91ad,0x93de,0x93c7,0x93cf,0x93c2,0x93da,0x93d0, +0x93f9,0x93ec,0x93cc,0x93d9,0x93a9,0x93e6,0x93ca,0x93d4, +0x93ee,0x93e3,0x93d5,0x93c4,0x93ce,0x93c0,0x93d2,0x93e7, +0x957d,0x95da,0x95db,0x96e1,0x9729,0x972b,0x972c,0x9728, +0x9726,0x97b3,0x97b7,0x97b6,0x97dd,0x97de,0x97df,0x985c, +0x9859,0x985d,0x9857,0x98bf,0x98bd,0x98bb,0x98be,0x9948, +0x9947,0x9943,0x99a6,0x99a7,0x9a1a,0x9a15,0x9a25,0x9a1d, +0x9a24,0x9a1b,0x9a22,0x9a20,0x9a27,0x9a23,0x9a1e,0x9a1c, +0x9a14,0x9ac2,0x9b0b,0x9b0a,0x9b0e,0x9b0c,0x9b37,0x9bea, +0x9beb,0x9be0,0x9bde,0x9be4,0x9be6,0x9be2,0x9bf0,0x9bd4, +0x9bd7,0x9bec,0x9bdc,0x9bd9,0x9be5,0x9bd5,0x9be1,0x9bda, +0x9d77,0x9d81,0x9d8a,0x9d84,0x9d88,0x9d71,0x9d80,0x9d78, +0x9d86,0x9d8b,0x9d8c,0x9d7d,0x9d6b,0x9d74,0x9d75,0x9d70, +0x9d69,0x9d85,0x9d73,0x9d7b,0x9d82,0x9d6f,0x9d79,0x9d7f, +0x9d87,0x9d68,0x9e94,0x9e91,0x9ec0,0x9efc,0x9f2d,0x9f40, +0x9f41,0x9f4d,0x9f56,0x9f57,0x9f58,0x5337,0x56b2,0x56b5, +0x56b3,0x58e3,0x5b45,0x5dc6,0x5dc7,0x5eee,0x5eef,0x5fc0, +0x5fc1,0x61f9,0x6517,0x6516,0x6515,0x6513,0x65df,0x66e8, +0x66e3,0x66e4,0x6af3,0x6af0,0x6aea,0x6ae8,0x6af9,0x6af1, +0x6aee,0x6aef,0x703c,0x7035,0x702f,0x7037,0x7034,0x7031, +0x7042,0x7038,0x703f,0x703a,0x7039,0x7040,0x703b,0x7033, +0x7041,0x7213,0x7214,0x72a8,0x737d,0x737c,0x74ba,0x76ab, +0x76aa,0x76be,0x76ed,0x77cc,0x77ce,0x77cf,0x77cd,0x77f2, +0x7925,0x7923,0x7927,0x7928,0x7924,0x7929,0x79b2,0x7a6e, +0x7a6c,0x7a6d,0x7af7,0x7c49,0x7c48,0x7c4a,0x7c47,0x7c45, +0x7cee,0x7e7b,0x7e7e,0x7e81,0x7e80,0x7fba,0x7fff,0x8079, +0x81db,0x81d9,0x820b,0x8268,0x8269,0x8622,0x85ff,0x8601, +0x85fe,0x861b,0x8600,0x85f6,0x8604,0x8609,0x8605,0x860c, +0x85fd,0x8819,0x8810,0x8811,0x8817,0x8813,0x8816,0x8963, +0x8966,0x89b9,0x89f7,0x8b60,0x8b6a,0x8b5d,0x8b68,0x8b63, +0x8b65,0x8b67,0x8b6d,0x8dae,0x8e86,0x8e88,0x8e84,0x8f59, +0x8f56,0x8f57,0x8f55,0x8f58,0x8f5a,0x908d,0x9143,0x9141, +0x91b7,0x91b5,0x91b2,0x91b3,0x940b,0x9413,0x93fb,0x9420, +0x940f,0x9414,0x93fe,0x9415,0x9410,0x9428,0x9419,0x940d, +0x93f5,0x9400,0x93f7,0x9407,0x940e,0x9416,0x9412,0x93fa, +0x9409,0x93f8,0x940a,0x93ff,0x93fc,0x940c,0x93f6,0x9411, +0x9406,0x95de,0x95e0,0x95df,0x972e,0x972f,0x97b9,0x97bb, +0x97fd,0x97fe,0x9860,0x9862,0x9863,0x985f,0x98c1,0x98c2, +0x9950,0x994e,0x9959,0x994c,0x994b,0x9953,0x9a32,0x9a34, +0x9a31,0x9a2c,0x9a2a,0x9a36,0x9a29,0x9a2e,0x9a38,0x9a2d, +0x9ac7,0x9aca,0x9ac6,0x9b10,0x9b12,0x9b11,0x9c0b,0x9c08, +0x9bf7,0x9c05,0x9c12,0x9bf8,0x9c40,0x9c07,0x9c0e,0x9c06, +0x9c17,0x9c14,0x9c09,0x9d9f,0x9d99,0x9da4,0x9d9d,0x9d92, +0x9d98,0x9d90,0x9d9b,0x9da0,0x9d94,0x9d9c,0x9daa,0x9d97, +0x9da1,0x9d9a,0x9da2,0x9da8,0x9d9e,0x9da3,0x9dbf,0x9da9, +0x9d96,0x9da6,0x9da7,0x9e99,0x9e9b,0x9e9a,0x9ee5,0x9ee4, +0x9ee7,0x9ee6,0x9f30,0x9f2e,0x9f5b,0x9f60,0x9f5e,0x9f5d, +0x9f59,0x9f91,0x513a,0x5139,0x5298,0x5297,0x56c3,0x56bd, +0x56be,0x5b48,0x5b47,0x5dcb,0x5dcf,0x5ef1,0x61fd,0x651b, +0x6b02,0x6afc,0x6b03,0x6af8,0x6b00,0x7043,0x7044,0x704a, +0x7048,0x7049,0x7045,0x7046,0x721d,0x721a,0x7219,0x737e, +0x7517,0x766a,0x77d0,0x792d,0x7931,0x792f,0x7c54,0x7c53, +0x7cf2,0x7e8a,0x7e87,0x7e88,0x7e8b,0x7e86,0x7e8d,0x7f4d, +0x7fbb,0x8030,0x81dd,0x8618,0x862a,0x8626,0x861f,0x8623, +0x861c,0x8619,0x8627,0x862e,0x8621,0x8620,0x8629,0x861e, +0x8625,0x8829,0x881d,0x881b,0x8820,0x8824,0x881c,0x882b, +0x884a,0x896d,0x8969,0x896e,0x896b,0x89fa,0x8b79,0x8b78, +0x8b45,0x8b7a,0x8b7b,0x8d10,0x8d14,0x8daf,0x8e8e,0x8e8c, +0x8f5e,0x8f5b,0x8f5d,0x9146,0x9144,0x9145,0x91b9,0x943f, +0x943b,0x9436,0x9429,0x943d,0x943c,0x9430,0x9439,0x942a, +0x9437,0x942c,0x9440,0x9431,0x95e5,0x95e4,0x95e3,0x9735, +0x973a,0x97bf,0x97e1,0x9864,0x98c9,0x98c6,0x98c0,0x9958, +0x9956,0x9a39,0x9a3d,0x9a46,0x9a44,0x9a42,0x9a41,0x9a3a, +0x9a3f,0x9acd,0x9b15,0x9b17,0x9b18,0x9b16,0x9b3a,0x9b52, +0x9c2b,0x9c1d,0x9c1c,0x9c2c,0x9c23,0x9c28,0x9c29,0x9c24, +0x9c21,0x9db7,0x9db6,0x9dbc,0x9dc1,0x9dc7,0x9dca,0x9dcf, +0x9dbe,0x9dc5,0x9dc3,0x9dbb,0x9db5,0x9dce,0x9db9,0x9dba, +0x9dac,0x9dc8,0x9db1,0x9dad,0x9dcc,0x9db3,0x9dcd,0x9db2, +0x9e7a,0x9e9c,0x9eeb,0x9eee,0x9eed,0x9f1b,0x9f18,0x9f1a, +0x9f31,0x9f4e,0x9f65,0x9f64,0x9f92,0x4eb9,0x56c6,0x56c5, +0x56cb,0x5971,0x5b4b,0x5b4c,0x5dd5,0x5dd1,0x5ef2,0x6521, +0x6520,0x6526,0x6522,0x6b0b,0x6b08,0x6b09,0x6c0d,0x7055, +0x7056,0x7057,0x7052,0x721e,0x721f,0x72a9,0x737f,0x74d8, +0x74d5,0x74d9,0x74d7,0x766d,0x76ad,0x7935,0x79b4,0x7a70, +0x7a71,0x7c57,0x7c5c,0x7c59,0x7c5b,0x7c5a,0x7cf4,0x7cf1, +0x7e91,0x7f4f,0x7f87,0x81de,0x826b,0x8634,0x8635,0x8633, +0x862c,0x8632,0x8636,0x882c,0x8828,0x8826,0x882a,0x8825, +0x8971,0x89bf,0x89be,0x89fb,0x8b7e,0x8b84,0x8b82,0x8b86, +0x8b85,0x8b7f,0x8d15,0x8e95,0x8e94,0x8e9a,0x8e92,0x8e90, +0x8e96,0x8e97,0x8f60,0x8f62,0x9147,0x944c,0x9450,0x944a, +0x944b,0x944f,0x9447,0x9445,0x9448,0x9449,0x9446,0x973f, +0x97e3,0x986a,0x9869,0x98cb,0x9954,0x995b,0x9a4e,0x9a53, +0x9a54,0x9a4c,0x9a4f,0x9a48,0x9a4a,0x9a49,0x9a52,0x9a50, +0x9ad0,0x9b19,0x9b2b,0x9b3b,0x9b56,0x9b55,0x9c46,0x9c48, +0x9c3f,0x9c44,0x9c39,0x9c33,0x9c41,0x9c3c,0x9c37,0x9c34, +0x9c32,0x9c3d,0x9c36,0x9ddb,0x9dd2,0x9dde,0x9dda,0x9dcb, +0x9dd0,0x9ddc,0x9dd1,0x9ddf,0x9de9,0x9dd9,0x9dd8,0x9dd6, +0x9df5,0x9dd5,0x9ddd,0x9eb6,0x9ef0,0x9f35,0x9f33,0x9f32, +0x9f42,0x9f6b,0x9f95,0x9fa2,0x513d,0x5299,0x58e8,0x58e7, +0x5972,0x5b4d,0x5dd8,0x882f,0x5f4f,0x6201,0x6203,0x6204, +0x6529,0x6525,0x6596,0x66eb,0x6b11,0x6b12,0x6b0f,0x6bca, +0x705b,0x705a,0x7222,0x7382,0x7381,0x7383,0x7670,0x77d4, +0x7c67,0x7c66,0x7e95,0x826c,0x863a,0x8640,0x8639,0x863c, +0x8631,0x863b,0x863e,0x8830,0x8832,0x882e,0x8833,0x8976, +0x8974,0x8973,0x89fe,0x8b8c,0x8b8e,0x8b8b,0x8b88,0x8c45, +0x8d19,0x8e98,0x8f64,0x8f63,0x91bc,0x9462,0x9455,0x945d, +0x9457,0x945e,0x97c4,0x97c5,0x9800,0x9a56,0x9a59,0x9b1e, +0x9b1f,0x9b20,0x9c52,0x9c58,0x9c50,0x9c4a,0x9c4d,0x9c4b, +0x9c55,0x9c59,0x9c4c,0x9c4e,0x9dfb,0x9df7,0x9def,0x9de3, +0x9deb,0x9df8,0x9de4,0x9df6,0x9de1,0x9dee,0x9de6,0x9df2, +0x9df0,0x9de2,0x9dec,0x9df4,0x9df3,0x9de8,0x9ded,0x9ec2, +0x9ed0,0x9ef2,0x9ef3,0x9f06,0x9f1c,0x9f38,0x9f37,0x9f36, +0x9f43,0x9f4f,0x9f71,0x9f70,0x9f6e,0x9f6f,0x56d3,0x56cd, +0x5b4e,0x5c6d,0x652d,0x66ed,0x66ee,0x6b13,0x705f,0x7061, +0x705d,0x7060,0x7223,0x74db,0x74e5,0x77d5,0x7938,0x79b7, +0x79b6,0x7c6a,0x7e97,0x7f89,0x826d,0x8643,0x8838,0x8837, +0x8835,0x884b,0x8b94,0x8b95,0x8e9e,0x8e9f,0x8ea0,0x8e9d, +0x91be,0x91bd,0x91c2,0x946b,0x9468,0x9469,0x96e5,0x9746, +0x9743,0x9747,0x97c7,0x97e5,0x9a5e,0x9ad5,0x9b59,0x9c63, +0x9c67,0x9c66,0x9c62,0x9c5e,0x9c60,0x9e02,0x9dfe,0x9e07, +0x9e03,0x9e06,0x9e05,0x9e00,0x9e01,0x9e09,0x9dff,0x9dfd, +0x9e04,0x9ea0,0x9f1e,0x9f46,0x9f74,0x9f75,0x9f76,0x56d4, +0x652e,0x65b8,0x6b18,0x6b19,0x6b17,0x6b1a,0x7062,0x7226, +0x72aa,0x77d8,0x77d9,0x7939,0x7c69,0x7c6b,0x7cf6,0x7e9a, +0x7e98,0x7e9b,0x7e99,0x81e0,0x81e1,0x8646,0x8647,0x8648, +0x8979,0x897a,0x897c,0x897b,0x89ff,0x8b98,0x8b99,0x8ea5, +0x8ea4,0x8ea3,0x946e,0x946d,0x946f,0x9471,0x9473,0x9749, +0x9872,0x995f,0x9c68,0x9c6e,0x9c6d,0x9e0b,0x9e0d,0x9e10, +0x9e0f,0x9e12,0x9e11,0x9ea1,0x9ef5,0x9f09,0x9f47,0x9f78, +0x9f7b,0x9f7a,0x9f79,0x571e,0x7066,0x7c6f,0x883c,0x8db2, +0x8ea6,0x91c3,0x9474,0x9478,0x9476,0x9475,0x9a60,0x9c74, +0x9c73,0x9c71,0x9c75,0x9e14,0x9e13,0x9ef6,0x9f0a,0x9fa4, +0x7068,0x7065,0x7cf7,0x866a,0x883e,0x883d,0x883f,0x8b9e, +0x8c9c,0x8ea9,0x8ec9,0x974b,0x9873,0x9874,0x98cc,0x9961, +0x99ab,0x9a64,0x9a66,0x9a67,0x9b24,0x9e15,0x9e17,0x9f48, +0x6207,0x6b1e,0x7227,0x864c,0x8ea8,0x9482,0x9480,0x9481, +0x9a69,0x9a68,0x9b2e,0x9e19,0x7229,0x864b,0x8b9f,0x9483, +0x9c79,0x9eb7,0x7675,0x9a6b,0x9c7a,0x9e1d,0x7069,0x706a, +0x9ea4,0x9f7e,0x9f49,0x9f98,0x7881,0x92b9,0x88cf,0x58bb, +0x6052,0x7ca7,0x5afa,0x2554,0x2566,0x2557,0x2560,0x256c, +0x2563,0x255a,0x2569,0x255d,0x2552,0x2564,0x2555,0x255e, +0x256a,0x2561,0x2558,0x2567,0x255b,0x2553,0x2565,0x2556, +0x255f,0x256b,0x2562,0x2559,0x2568,0x255c,0x2551,0x2550, +0x256d,0x256e,0x2570,0x256f,0x2593}; + +static const int big5_ucs_table_size = sizeof(big5_ucs_table)/sizeof(unsigned short); + +/* UCS -> Big5 */ +static const unsigned short ucs_a1_big5_table[] = { +/* 0x0000 */ +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f, +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,0x0000,0x0000,0x0000,0x0000,0xa1b1, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1c2, +0xa258,0xa1d3,0x0000,0x0000,0x0000,0x0000,0x0000,0xa150, +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,0xa1d1, +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,0xa1d2, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +/* 0x0100 */ +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,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,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,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,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,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,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,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +/* 0x0200 */ +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,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,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,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,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,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa3be, +0x0000,0xa3bc,0xa3bd,0xa3bf,0x0000,0xa1c5,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xa3bb,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,0x0000,0x0000,0x0000, +/* 0x0300 */ +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,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,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,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,0x0000,0x0000,0x0000,0x0000, +0x0000,0xa344,0xa345,0xa346,0xa347,0xa348,0xa349,0xa34a, +0xa34b,0xa34c,0xa34d,0xa34e,0xa34f,0xa350,0xa351,0xa352, +0xa353,0xa354,0x0000,0xa355,0xa356,0xa357,0xa358,0xa359, +0xa35a,0xa35b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xa35c,0xa35d,0xa35e,0xa35f,0xa360,0xa361,0xa362, +0xa363,0xa364,0xa365,0xa366,0xa367,0xa368,0xa369,0xa36a, +0xa36b,0xa36c,0x0000,0xa36d,0xa36e,0xa36f,0xa370,0xa371, +0xa372,0xa373}; + +static const int ucs_a1_big5_table_min = 0x0000; +static const int ucs_a1_big5_table_max = 0x0000 + (sizeof (ucs_a1_big5_table) / sizeof (unsigned short)); + + +static const unsigned short ucs_a2_big5_table[] = { +/* 0x2000 */ +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xa156,0xa158,0x0000,0x0000,0x0000, +0xa1a5,0xa1a6,0x0000,0x0000,0xa1a7,0xa1a8,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xa14c,0xa14b,0xa145, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xa1ac,0x0000,0x0000,0xa1ab,0x0000,0x0000, +0x0000,0x0000,0x0000,0xa1b0,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,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,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,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xa3e1,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, +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,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +/* 0x2100 */ +0x0000,0x0000,0x0000,0xa24a,0x0000,0xa1c1,0x0000,0x0000, +0x0000,0xa24b,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,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, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xa2b9,0xa2ba,0xa2bb,0xa2bc,0xa2bd,0xa2be,0xa2bf,0xa2c0, +0xa2c1,0xa2c2,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,0x0000,0x0000,0x0000, +0xa1f6,0xa1f4,0xa1f7,0xa1f5,0x0000,0x0000,0xa1f8,0xa1f9, +0xa1fb,0xa1fa,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,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, +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, +/* 0x2200 */ +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xa241,0x0000,0x0000, +0x0000,0x0000,0xa1d4,0x0000,0x0000,0x0000,0xa1db,0xa1e8, +0xa1e7,0x0000,0x0000,0xa1fd,0x0000,0xa1fc,0x0000,0x0000, +0x0000,0xa1e4,0xa1e5,0xa1ec,0x0000,0x0000,0xa1ed,0x0000, +0x0000,0x0000,0x0000,0x0000,0xa1ef,0xa1ee,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,0xa1dc,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xa1da,0xa1dd,0x0000,0x0000,0x0000,0x0000,0xa1d8,0xa1d9, +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,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xa1f2,0x0000,0x0000, +0x0000,0xa1f3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xa1e6,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,0xa1e9, +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,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, +/* 0x2300 */ +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,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,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,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,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,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,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,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +/* 0x2400 */ +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,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,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,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,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,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,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,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xa277,0x0000,0xa278,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xa27a,0x0000,0x0000,0x0000, +0xa27b,0x0000,0x0000,0x0000,0xa27c,0x0000,0x0000,0x0000, +0xa27d,0x0000,0x0000,0x0000,0xa275,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xa274,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xa273,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xa272,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xa271,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xf9f9,0xf9f8,0xf9e6,0xf9ef,0xf9dd,0xf9e8,0xf9f1,0xf9df, +0xf9ec,0xf9f5,0xf9e3,0xf9ee,0xf9f7,0xf9e5,0xf9e9,0xf9f2, +0xf9e0,0xf9eb,0xf9f4,0xf9e2,0xf9e7,0xf9f0,0xf9de,0xf9ed, +0xf9f6,0xf9e4,0xf9ea,0xf9f3,0xf9e1,0xf9fa,0xf9fb,0xf9fd, +0xf9fc,0xa2ac,0xa2ad,0xa2ae,0xa15a,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xa262,0xa263,0xa264,0xa265,0xa266,0xa267,0xa268, +0xa269,0xa270,0xa26f,0xa26e,0xa26d,0xa26c,0xa26b,0xa26a, +0x0000,0x0000,0x0000,0xf9fe,0xa276,0xa279,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xa1bd,0xa1bc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xa1b6,0xa1b5,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xa1bf,0xa1be,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1bb,0xa1ba, +0x0000,0x0000,0x0000,0xa1b3,0x0000,0x0000,0xa1b7,0xa1b4, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xa2a8,0xa2a9,0xa2ab,0xa2aa,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, +/* 0x2600 */ +0x0000,0x0000,0x0000,0x0000,0x0000,0xa1b9,0xa1b8,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,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xa1f0,0x0000,0xa1f1}; + +static const int ucs_a2_big5_table_min = 0x2000; +static const int ucs_a2_big5_table_max = 0x2000 + (sizeof (ucs_a2_big5_table) / sizeof (unsigned short)); + + +static const unsigned short ucs_a3_big5_table[] = { +/* 0x2f00 */ +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,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,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,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,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,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,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,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xa140,0xa142,0xa143,0xa1b2,0x0000,0x0000,0x0000,0x0000, +0xa171,0xa172,0xa16d,0xa16e,0xa175,0xa176,0xa179,0xa17a, +0xa169,0xa16a,0xa245,0x0000,0xa165,0xa166,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xa1a9,0xa1aa,0x0000, +0x0000,0xa2c3,0xa2c4,0xa2c5,0xa2c6,0xa2c7,0xa2c8,0xa2c9, +0xa2ca,0xa2cb,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,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, +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,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,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,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,0x0000,0x0000,0x0000,0x0000, +/* 0x3100 */ +0x0000,0x0000,0x0000,0x0000,0x0000,0xa374,0xa375,0xa376, +0xa377,0xa378,0xa379,0xa37a,0xa37b,0xa37c,0xa37d,0xa37e, +0xa3a1,0xa3a2,0xa3a3,0xa3a4,0xa3a5,0xa3a6,0xa3a7,0xa3a8, +0xa3a9,0xa3aa,0xa3ab,0xa3ac,0xa3ad,0xa3ae,0xa3af,0xa3b0, +0xa3b1,0xa3b2,0xa3b3,0xa3b4,0xa3b5,0xa3b6,0xa3b7,0xa3b8, +0xa3b9,0xa3ba,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,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, +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,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,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,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,0x0000,0x0000,0x0000,0x0000, +/* 0x3200 */ +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,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,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,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,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xa1c0,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,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,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +/* 0x3300 */ +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,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,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,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,0x0000,0x0000,0xa255,0xa256, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xa250,0xa251,0xa252,0x0000, +0x0000,0xa254,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,0xa257,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa253,0x0000, +0x0000,0xa1eb,0xa1ea,0x0000,0x0000,0xa24f}; + +static const int ucs_a3_big5_table_min = 0x2f00; +static const int ucs_a3_big5_table_max = 0x2f00 + (sizeof (ucs_a3_big5_table) / sizeof (unsigned short)); + +static const unsigned short ucs_i_big5_table[] = { +/* 0x4d00 */ +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,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,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,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,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,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,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,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xa440,0xa442,0x0000,0xa443,0x0000,0x0000,0x0000,0xc945, +0xa456,0xa454,0xa457,0xa455,0xc946,0xa4a3,0xc94f,0xc94d, +0xa4a2,0xa4a1,0x0000,0x0000,0xa542,0xa541,0xa540,0x0000, +0xa543,0xa4fe,0x0000,0x0000,0x0000,0x0000,0xa5e0,0xa5e1, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa8c3,0x0000, +0x0000,0x0000,0x0000,0xa458,0x0000,0xa4a4,0xc950,0x0000, +0xa4a5,0xc963,0xa6ea,0xcbb1,0x0000,0x0000,0x0000,0x0000, +0xa459,0xa4a6,0x0000,0xa544,0xc964,0x0000,0x0000,0x0000, +0x0000,0x0000,0xc940,0xa444,0x0000,0xa45b,0x0000,0xc947, +0xa45c,0x0000,0x0000,0xa4a7,0x0000,0xa545,0xa547,0xa546, +0x0000,0x0000,0xa5e2,0xa5e3,0x0000,0x0000,0xa8c4,0x0000, +0xadbc,0xa441,0x0000,0x0000,0xc941,0xa445,0xa45e,0xa45d, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xa5e4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xa8c5,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb0ae,0xd44b, +0x0000,0x0000,0xb6c3,0xdcb1,0xdcb2,0x0000,0xa446,0x0000, +0xa4a9,0x0000,0x0000,0xa8c6,0xa447,0xc948,0xa45f,0x0000, +0x0000,0xa4aa,0xa4ac,0xc951,0xa4ad,0xa4ab,0x0000,0x0000, +0x0000,0xa5e5,0x0000,0xa8c7,0x0000,0x0000,0xa8c8,0xab45, +0x0000,0xa460,0xa4ae,0x0000,0xa5e6,0xa5e8,0xa5e7,0x0000, +0xa6eb,0x0000,0x0000,0xa8c9,0xa8ca,0xab46,0xab47,0x0000, +0x0000,0x0000,0x0000,0xadbd,0x0000,0x0000,0xdcb3,0x0000, +0x0000,0xf6d6,0xa448,0x0000,0x0000,0x0000,0x0000,0x0000, +0xa4b0,0xa4af,0xc952,0xa4b1,0xa4b7,0x0000,0xa4b2,0xa4b3, +0xc954,0xc953,0xa4b5,0xa4b6,0x0000,0xa4b4,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xa54a,0xa54b,0xa54c,0xa54d, +0xa549,0xa550,0xc96a,0x0000,0xc966,0xc969,0xa551,0xa561, +0x0000,0xc968,0x0000,0xa54e,0xa54f,0xa548,0x0000,0x0000, +0xc965,0xc967,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xa5f5,0xc9b0,0xa5f2,0xa5f6,0xc9ba,0xc9ae,0xa5f3,0xc9b2, +0x0000,0x0000,0x0000,0xa5f4,0x0000,0xa5f7,0x0000,0xa5e9, +0xc9b1,0xa5f8,0xc9b5,0x0000,0xc9b9,0xc9b6,0x0000,0x0000, +0xc9b3,0xa5ea,0xa5ec,0xa5f9,0x0000,0xa5ee,0xc9ab,0xa5f1, +0xa5ef,0xa5f0,0xc9bb,0xc9b8,0xc9af,0xa5ed,0x0000,0x0000, +0xc9ac,0xa5eb,0x0000,0x0000,0x0000,0xc9b4,0x0000,0x0000, +0x0000,0x0000,0xc9b7,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xc9ad,0xca66,0x0000,0xa742, +0xa6f4,0x0000,0x0000,0xca67,0xa6f1,0x0000,0xa744,0x0000, +0xa6f9,0x0000,0xa6f8,0xca5b,0xa6fc,0xa6f7,0xca60,0xca68, +0x0000,0xca64,0x0000,0xa6fa,0x0000,0x0000,0xa6fd,0xa6ee, +0xa747,0xca5d,0x0000,0x0000,0xcbbd,0xa6ec,0xa743,0xa6ed, +0xa6f5,0xa6f6,0xca62,0xca5e,0xa6fb,0xa6f3,0xca5a,0xa6ef, +0xca65,0xa745,0xa748,0xa6f2,0xa740,0xa746,0xa6f0,0xca63, +0xa741,0xca69,0xca5c,0xa6fe,0xca5f,0x0000,0x0000,0xca61, +0x0000,0xa8d8,0xcbbf,0xcbcb,0xa8d0,0x0000,0xcbcc,0xa8cb, +0xa8d5,0x0000,0x0000,0xa8ce,0xcbb9,0xa8d6,0xcbb8,0xcbbc, +0xcbc3,0xcbc1,0xa8de,0xa8d9,0xcbb3,0xcbb5,0xa8db,0xa8cf, +0xcbb6,0xcbc2,0xcbc9,0xa8d4,0xcbbb,0xcbb4,0xa8d3,0xcbb7, +0xa8d7,0xcbba,0x0000,0xa8d2,0x0000,0xa8cd,0x0000,0xa8dc, +0xcbc4,0xa8dd,0xcbc8,0x0000,0xcbc6,0xcbca,0xa8da,0xcbbe, +0xcbb2,0x0000,0xcbc0,0xa8d1,0xcbc5,0xa8cc,0xcbc7,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xab56,0xab4a, +0x0000,0x0000,0xcde0,0xcde8,0x0000,0xab49,0xab51,0xab5d, +0x0000,0xcdee,0xcdec,0xcde7,0x0000,0x0000,0x0000,0xab4b, +0xcded,0xcde3,0xab59,0xab50,0xab58,0xcdde,0x0000,0xcdea, +0x0000,0xcde1,0xab54,0xcde2,0x0000,0xcddd,0xab5b,0xab4e, +0xab57,0xab4d,0x0000,0xcddf,0xcde4,0x0000,0xcdeb,0xab55, +0xab52,0xcde6,0xab5a,0xcde9,0xcde5,0xab4f,0xab5c,0xab53, +0xab4c,0xab48,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xcdef,0x0000,0xadd7,0xadc1, +0x0000,0xadd1,0x0000,0xadd6,0xd0d0,0xd0cf,0xd0d4,0xd0d5, +0xadc4,0x0000,0xadcd,0x0000,0x0000,0x0000,0xadda,0x0000, +0xadce,0x0000,0x0000,0x0000,0x0000,0xd0c9,0xadc7,0xd0ca, +0x0000,0xaddc,0x0000,0xadd3,0xadbe,0xadbf,0xd0dd,0xb0bf, +0x0000,0xadcc,0xadcb,0xd0cb,0xadcf,0xd45b,0xadc6,0xd0d6, +0xadd5,0xadd4,0xadca,0xd0ce,0xd0d7,0x0000,0xd0c8,0xadc9, +0xd0d8,0xadd2,0xd0cc,0xadc0,0x0000,0xadc3,0xadc2,0xd0d9, +0xadd0,0xadc5,0xadd9,0xaddb,0xd0d3,0xadd8,0x0000,0xd0db, +0xd0cd,0xd0dc,0x0000,0xd0d1,0x0000,0xd0da,0x0000,0xd0d2, +0x0000,0x0000,0x0000,0x0000,0xadc8,0x0000,0x0000,0x0000, +0xd463,0xd457,0x0000,0xb0b3,0x0000,0xd45c,0xd462,0xb0b2, +0xd455,0xb0b6,0xd459,0xd452,0xb0b4,0xd456,0xb0b9,0xb0be, +0x0000,0xd467,0x0000,0xd451,0x0000,0xb0ba,0x0000,0xd466, +0x0000,0x0000,0xb0b5,0xd458,0xb0b1,0xd453,0xd44f,0xd45d, +0xd450,0xd44e,0xd45a,0xd460,0xd461,0xb0b7,0x0000,0x0000, +0xd85b,0xd45e,0xd44d,0xd45f,0x0000,0xb0c1,0xd464,0xb0c0, +0xd44c,0x0000,0xd454,0xd465,0xb0bc,0xb0bb,0xb0b8,0xb0bd, +0x0000,0x0000,0xb0af,0x0000,0x0000,0xb0b0,0x0000,0x0000, +0xb3c8,0x0000,0xd85e,0xd857,0x0000,0xb3c5,0x0000,0xd85f, +0x0000,0x0000,0x0000,0xd855,0xd858,0xb3c4,0xd859,0x0000, +0x0000,0xb3c7,0xd85d,0x0000,0xd853,0xd852,0xb3c9,0x0000, +0xb3ca,0xb3c6,0xb3cb,0xd851,0xd85c,0xd85a,0xd854,0x0000, +0x0000,0x0000,0xb3c3,0xd856,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xb6ca,0xb6c4,0xdcb7,0xb6cd, +0xdcbd,0xdcc0,0xb6c6,0xb6c7,0xdcba,0xb6c5,0xdcc3,0xb6cb, +0xdcc4,0x0000,0xdcbf,0xb6cc,0x0000,0xdcb4,0xb6c9,0xdcb5, +0x0000,0xdcbe,0xdcbc,0x0000,0xdcb8,0xb6c8,0xdcb6,0xb6ce, +0xdcbb,0xdcc2,0xdcb9,0xdcc1,0x0000,0x0000,0xb9b6,0xb9b3, +0x0000,0xb9b4,0x0000,0xe0f9,0xe0f1,0xb9b2,0xb9af,0xe0f2, +0x0000,0x0000,0xb9b1,0xe0f5,0x0000,0xe0f7,0x0000,0x0000, +0xe0fe,0x0000,0x0000,0xe0fd,0xe0f8,0xb9ae,0xe0f0,0xb9ac, +0xe0f3,0xb9b7,0xe0f6,0x0000,0xe0fa,0xb9b0,0xb9ad,0xe0fc, +0xe0fb,0xb9b5,0x0000,0xe0f4,0x0000,0xbbf8,0xe4ec,0x0000, +0xe4e9,0xbbf9,0x0000,0xbbf7,0x0000,0xe4f0,0xe4ed,0xe4e6, +0xbbf6,0x0000,0xbbfa,0xe4e7,0xbbf5,0xbbfd,0xe4ea,0xe4eb, +0xbbfb,0xbbfc,0xe4f1,0xe4ee,0xe4ef,0x0000,0x0000,0x0000, +0xbeaa,0xe8f8,0xbea7,0xe8f5,0xbea9,0xbeab,0x0000,0xe8f6, +0xbea8,0x0000,0xe8f7,0x0000,0xe8f4,0x0000,0x0000,0xc076, +0xecbd,0xc077,0xecbb,0x0000,0xecbc,0xecba,0xecb9,0x0000, +0x0000,0xecbe,0xc075,0x0000,0x0000,0xefb8,0xefb9,0x0000, +0xe4e8,0xefb7,0xc078,0xc35f,0xf1eb,0xf1ec,0x0000,0xc4d7, +0xc4d8,0xf5c1,0xf5c0,0xc56c,0xc56b,0xf7d0,0x0000,0xa449, +0xa461,0xa4b9,0x0000,0xa4b8,0xa553,0xa552,0xa5fc,0xa5fb, +0xa5fd,0xa5fa,0x0000,0xa74a,0xa749,0xa74b,0x0000,0x0000, +0x0000,0x0000,0xa8e0,0x0000,0xa8df,0xa8e1,0x0000,0xab5e, +0x0000,0xa259,0xd0de,0xa25a,0xb0c2,0xa25c,0xa25b,0xd860, +0x0000,0xa25d,0xb9b8,0xa25e,0x0000,0xa44a,0x0000,0xa4ba, +0xa5fe,0xa8e2,0x0000,0xa44b,0xa4bd,0xa4bb,0xa4bc,0x0000, +0x0000,0xa640,0x0000,0x0000,0x0000,0xa74c,0xa8e4,0xa8e3, +0xa8e5,0x0000,0x0000,0x0000,0xaddd,0x0000,0x0000,0x0000, +0xbeac,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc94e, +0x0000,0xa554,0xa555,0x0000,0x0000,0xa641,0x0000,0xca6a, +0x0000,0xab60,0xab5f,0xd0e0,0xd0df,0xb0c3,0x0000,0xa4be, +0xc955,0x0000,0x0000,0x0000,0x0000,0x0000,0xcbcd,0x0000, +0xab61,0x0000,0xade0,0x0000,0xadde,0xaddf,0x0000,0x0000, +0x0000,0x0000,0xbead,0x0000,0xa556,0x0000,0x0000,0x0000, +0xa642,0xc9bc,0x0000,0x0000,0x0000,0x0000,0xa74d,0xa74e, +0x0000,0xca6b,0x0000,0x0000,0xcbce,0xa8e6,0xcbcf,0x0000, +0x0000,0x0000,0x0000,0x0000,0xd0e2,0xd0e3,0xade3,0x0000, +0xd0e4,0x0000,0xd0e1,0xade4,0xade2,0xade1,0xd0e5,0x0000, +0xd468,0x0000,0x0000,0x0000,0xd861,0x0000,0x0000,0xdcc5, +0xe140,0x0000,0x0000,0x0000,0xbbfe,0xbeae,0xe8f9,0x0000, +0xa44c,0xa45a,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xb0c4,0xb3cd,0x0000,0xb9b9,0x0000,0xc942,0xa4bf,0x0000, +0xa559,0xa557,0xa558,0x0000,0x0000,0xa8e7,0x0000,0x0000, +0xa44d,0xa44e,0x0000,0xa462,0x0000,0x0000,0xa4c0,0xa4c1, +0xa4c2,0xc9be,0xa55a,0x0000,0xc96b,0x0000,0xa646,0x0000, +0xc9bf,0xa644,0xa645,0xc9bd,0x0000,0x0000,0xa647,0xa643, +0x0000,0x0000,0x0000,0x0000,0xca6c,0xaaec,0xca6d,0x0000, +0x0000,0xca6e,0x0000,0x0000,0xa750,0xa74f,0x0000,0x0000, +0xa753,0xa751,0xa752,0x0000,0x0000,0x0000,0xa8ed,0x0000, +0xa8ec,0xcbd4,0xcbd1,0xcbd2,0x0000,0xcbd0,0xa8ee,0xa8ea, +0xa8e9,0x0000,0xa8eb,0xa8e8,0x0000,0x0000,0x0000,0x0000, +0x0000,0xa8ef,0x0000,0xab63,0xcdf0,0x0000,0xcbd3,0xab68, +0x0000,0xcdf1,0xab64,0xab67,0xab66,0xab65,0xab62,0x0000, +0x0000,0x0000,0xd0e8,0x0000,0xade7,0xd0eb,0xade5,0x0000, +0x0000,0x0000,0xd0e7,0xade8,0xade6,0xade9,0xd0e9,0xd0ea, +0x0000,0xd0e6,0xd0ec,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xb3d1,0xb0c5,0xd469,0xd46b,0xd46a,0xd46c,0xb0c6, +0x0000,0x0000,0xb3ce,0x0000,0xb3cf,0xb3d0,0x0000,0xb6d0, +0xdcc7,0x0000,0xdcc6,0xdcc8,0xdcc9,0xb6d1,0x0000,0xb6cf, +0xe141,0xe142,0xb9bb,0xb9ba,0xe35a,0x0000,0x0000,0xbc40, +0xbc41,0xbc42,0xbc44,0xe4f2,0xe4f3,0xbc43,0x0000,0x0000, +0x0000,0xbeaf,0x0000,0xbeb0,0x0000,0x0000,0xf1ed,0xf5c3, +0xf5c2,0xf7d1,0x0000,0xa44f,0x0000,0x0000,0x0000,0xa55c, +0xa55b,0x0000,0x0000,0xa648,0x0000,0x0000,0xc9c0,0x0000, +0x0000,0xa755,0xa756,0xa754,0xa757,0xca6f,0xca70,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xa8f1,0xcbd5,0x0000,0xa8f0,0x0000, +0xcdf2,0xab6c,0xcdf3,0xab6b,0x0000,0x0000,0x0000,0xab69, +0x0000,0xab6a,0x0000,0x0000,0x0000,0xd0ed,0x0000,0x0000, +0x0000,0x0000,0xb0c7,0xd46e,0x0000,0xb0ca,0xd46d,0xb1e5, +0xb0c9,0xb0c8,0x0000,0xb3d4,0x0000,0xb3d3,0xb3d2,0xb6d2, +0x0000,0x0000,0xb6d5,0xb6d6,0xb6d4,0x0000,0xb6d3,0x0000, +0x0000,0xe143,0x0000,0xe144,0x0000,0x0000,0x0000,0xe4f5, +0xbc45,0xe4f4,0x0000,0xbeb1,0xecbf,0xc079,0x0000,0xf1ee, +0xc455,0x0000,0xa463,0xa4c3,0xc956,0x0000,0xa4c4,0xa4c5, +/* 0x5300 */ +0x0000,0x0000,0x0000,0x0000,0x0000,0xa55d,0xa55e,0x0000, +0xa649,0xca71,0xcbd6,0xcbd7,0x0000,0xab6d,0xd0ee,0xb0cc, +0xb0cb,0xd863,0xd862,0x0000,0x0000,0xa450,0xa4c6,0xa55f, +0x0000,0xb0cd,0xc943,0x0000,0xc96c,0xa560,0x0000,0xc9c2, +0xa64b,0xa64a,0xc9c1,0xa758,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xadea,0x0000,0x0000,0xd46f,0x0000,0xb6d7, +0xe145,0xb9bc,0x0000,0x0000,0xe8fa,0x0000,0x0000,0xf3fd, +0x0000,0xa4c7,0x0000,0x0000,0xcbd8,0xcdf4,0xb0d0,0xb0ce, +0xb0cf,0xa451,0x0000,0xa464,0xa2cd,0xa4ca,0x0000,0xa4c9, +0xa4c8,0xa563,0xa562,0x0000,0xc96d,0xc9c3,0x0000,0x0000, +0x0000,0xa8f5,0xa8f2,0xa8f4,0xa8f3,0x0000,0x0000,0xab6e, +0x0000,0x0000,0xb3d5,0x0000,0xa452,0x0000,0xa4cb,0x0000, +0xa565,0xa564,0x0000,0xca72,0x0000,0x0000,0xa8f6,0x0000, +0x0000,0x0000,0x0000,0x0000,0xc957,0x0000,0xa567,0xa566, +0xa64c,0xa64d,0xca73,0xa759,0x0000,0xa75a,0x0000,0xa8f7, +0xa8f8,0xa8f9,0x0000,0xab6f,0xcdf5,0x0000,0x0000,0xadeb, +0x0000,0x0000,0xc944,0x0000,0xa4cc,0x0000,0x0000,0x0000, +0x0000,0x0000,0xc9c4,0x0000,0x0000,0x0000,0xca74,0xca75, +0x0000,0x0000,0xcbd9,0x0000,0xcbda,0x0000,0xcdf7,0xcdf6, +0xcdf9,0xcdf8,0xab70,0x0000,0xd470,0xaded,0xd0ef,0xadec, +0x0000,0x0000,0x0000,0x0000,0xd864,0xb3d6,0x0000,0xd865, +0x0000,0x0000,0x0000,0x0000,0xe146,0xb9bd,0x0000,0x0000, +0x0000,0x0000,0xbc46,0x0000,0xf1ef,0x0000,0x0000,0x0000, +0x0000,0xc958,0x0000,0xa568,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xb0d1,0x0000,0x0000,0x0000,0x0000, +0xa453,0xa465,0xa4ce,0xa4cd,0x0000,0xa4cf,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xa8fb,0x0000,0xa8fa,0xa8fc, +0x0000,0x0000,0x0000,0xab71,0x0000,0x0000,0x0000,0xadee, +0x0000,0xe8fb,0xc24f,0xa466,0xa56a,0xa579,0xa574,0x0000, +0xa56f,0xa56e,0xa575,0xa573,0xa56c,0xa57a,0xa56d,0xa569, +0xa578,0xa577,0xa576,0xa56b,0x0000,0xa572,0x0000,0x0000, +0xa571,0x0000,0x0000,0xa57b,0xa570,0x0000,0x0000,0x0000, +/* 0x5400 */ +0x0000,0xa653,0x0000,0xa659,0xa655,0x0000,0xa65b,0xc9c5, +0xa658,0xa64e,0xa651,0xa654,0xa650,0xa657,0xa65a,0xa64f, +0xa652,0xa656,0xa65c,0x0000,0x0000,0x0000,0x0000,0x0000, +0xca7e,0xca7b,0x0000,0xa767,0xca7c,0xa75b,0xa75d,0xa775, +0xa770,0x0000,0x0000,0x0000,0xcaa5,0xca7d,0xa75f,0xa761, +0xcaa4,0xa768,0xca78,0xa774,0xa776,0xa75c,0xa76d,0x0000, +0xca76,0xa773,0x0000,0xa764,0x0000,0xa76e,0xa76f,0xca77, +0xa76c,0xa76a,0x0000,0xa76b,0xa771,0xcaa1,0xa75e,0x0000, +0xa772,0xcaa3,0xa766,0xa763,0x0000,0xca7a,0xa762,0xcaa6, +0xa765,0x0000,0xa769,0x0000,0x0000,0x0000,0xa760,0xcaa2, +0x0000,0x0000,0x0000,0x0000,0xca79,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xcbeb,0xcbea,0xa94f,0xcbed,0xcbef,0xcbe4,0xcbe7,0xcbee, +0xa950,0x0000,0x0000,0xcbe1,0xcbe5,0x0000,0x0000,0xcbe9, +0xce49,0xa94b,0xce4d,0xa8fd,0xcbe6,0xa8fe,0xa94c,0xa945, +0xa941,0x0000,0xcbe2,0xa944,0xa949,0xa952,0xcbe3,0xcbdc, +0xa943,0xcbdd,0xcbdf,0x0000,0xa946,0x0000,0xa948,0xcbdb, +0xcbe0,0x0000,0x0000,0xa951,0xa94d,0xcbe8,0xa953,0x0000, +0xa94a,0xcbde,0xa947,0x0000,0x0000,0xa942,0xa940,0x0000, +0xcbec,0x0000,0xa94e,0x0000,0x0000,0x0000,0x0000,0x0000, +0xce48,0xcdfb,0xce4b,0x0000,0x0000,0xcdfd,0xab78,0xaba8, +0xab74,0xaba7,0xab7d,0xaba4,0xab72,0xcdfc,0xce43,0xaba3, +0xce4f,0xaba5,0x0000,0xab79,0x0000,0x0000,0xce45,0xce42, +0xab77,0x0000,0xcdfa,0xaba6,0xce4a,0xab7c,0xce4c,0xaba9, +0xab73,0xab7e,0xab7b,0xce40,0xaba1,0xce46,0xce47,0xab7a, +0xaba2,0xab76,0x0000,0x0000,0x0000,0x0000,0xab75,0xcdfe, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xce44,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xce4e,0x0000, +0xd144,0xadfb,0xd0f1,0x0000,0xd0f6,0xadf4,0xae40,0xd0f4, +0xadef,0xadf9,0xadfe,0xd0fb,0x0000,0xadfa,0xadfd,0x0000, +0x0000,0xd0fe,0xadf5,0xd0f5,0x0000,0x0000,0x0000,0xd142, +0xd143,0x0000,0xadf7,0xd141,0xadf3,0xae43,0x0000,0xd0f8, +/* 0x5500 */ +0x0000,0xadf1,0x0000,0xd146,0xd0f9,0xd0fd,0xadf6,0xae42, +0xd0fa,0xadfc,0xd140,0xd147,0xd4a1,0x0000,0xd145,0xae44, +0xadf0,0xd0fc,0xd0f3,0x0000,0xadf8,0x0000,0x0000,0xd0f2, +0x0000,0x0000,0xd0f7,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd0f0,0xae41, +0x0000,0x0000,0xd477,0x0000,0xb0e4,0xd4a7,0xb0e2,0xb0df, +0xd47c,0xb0db,0xd4a2,0xb0e6,0xd476,0xd47b,0xd47a,0xadf2, +0xb0e1,0xd4a5,0x0000,0xd4a8,0xd473,0x0000,0xb3e8,0x0000, +0xd4a9,0xb0e7,0x0000,0xb0d9,0xb0d6,0xd47e,0xb0d3,0x0000, +0xd4a6,0x0000,0xb0da,0xd4aa,0x0000,0xd474,0xd4a4,0xb0dd, +0xd475,0xd478,0xd47d,0x0000,0x0000,0xb0de,0xb0dc,0xb0e8, +0x0000,0x0000,0x0000,0x0000,0xb0e3,0x0000,0xb0d7,0xb1d2, +0x0000,0xb0d8,0xd479,0xb0e5,0xb0e0,0xd4a3,0xb0d5,0x0000, +0x0000,0x0000,0xb0d4,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xd471,0xd472,0xd86a, +0x0000,0x0000,0x0000,0xb3d7,0xb3da,0xd875,0xb3ee,0xd878, +0xb3d8,0xd871,0xb3de,0xb3e4,0xb5bd,0x0000,0x0000,0xb3e2, +0xd86e,0xb3ef,0xb3db,0xb3e3,0xd876,0xdcd7,0xd87b,0xd86f, +0x0000,0xd866,0xd873,0xd86d,0xb3e1,0xd879,0x0000,0x0000, +0xb3dd,0xb3f1,0xb3ea,0x0000,0xb3df,0xb3dc,0x0000,0xb3e7, +0x0000,0xd87a,0xd86c,0xd872,0xd874,0xd868,0xd877,0xb3d9, +0xd867,0x0000,0xb3e0,0xb3f0,0xb3ec,0xd869,0xb3e6,0x0000, +0x0000,0xb3ed,0xb3e9,0xb3e5,0x0000,0xd870,0x0000,0x0000, +0x0000,0x0000,0x0000,0xb3eb,0x0000,0x0000,0x0000,0xdcd5, +0xdcd1,0x0000,0xdce0,0xdcca,0xdcd3,0xb6e5,0xb6e6,0xb6de, +0xdcdc,0xb6e8,0xdccf,0xdcce,0xdccc,0xdcde,0xb6dc,0xdcd8, +0xdccd,0xb6df,0xdcd6,0xb6da,0xdcd2,0xdcd9,0xdcdb,0x0000, +0x0000,0xdcdf,0xb6e3,0xdccb,0xb6dd,0xdcd0,0x0000,0xb6d8, +0x0000,0xb6e4,0xdcda,0xb6e0,0xb6e1,0xb6e7,0xb6db,0xa25f, +0xb6d9,0xdcd4,0x0000,0x0000,0x0000,0x0000,0x0000,0xb6e2, +0x0000,0x0000,0xdcdd,0x0000,0x0000,0x0000,0xb9cd,0xb9c8, +0x0000,0xe155,0xe151,0x0000,0xe14b,0xb9c2,0xb9be,0xe154, +0xb9bf,0xe14e,0xe150,0x0000,0xe153,0x0000,0xb9c4,0x0000, +0xb9cb,0xb9c5,0x0000,0x0000,0xe149,0xb9c6,0xb9c7,0xe14c, +0xb9cc,0x0000,0xe14a,0xe14f,0xb9c3,0xe148,0xb9c9,0xb9c1, +0x0000,0x0000,0x0000,0xb9c0,0xe14d,0xe152,0x0000,0xb9ca, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe147, +0x0000,0xbc4d,0xe547,0x0000,0xe544,0x0000,0xbc47,0xbc53, +0xbc54,0x0000,0xbc4a,0xe542,0xbc4c,0xe4f9,0xbc52,0x0000, +0xe546,0xbc49,0xe548,0xbc48,0x0000,0xe543,0xe545,0xbc4b, +0xe541,0xe4fa,0xe4f7,0x0000,0x0000,0xd86b,0xe4fd,0x0000, +0xe4f6,0xe4fc,0xe4fb,0x0000,0xe4f8,0x0000,0xbc4f,0x0000, +0x0000,0x0000,0x0000,0xbc4e,0x0000,0x0000,0x0000,0xbc50, +0xe4fe,0xbeb2,0xe540,0x0000,0x0000,0x0000,0xe945,0x0000, +0xe8fd,0x0000,0xbebe,0xe942,0xbeb6,0xbeba,0xe941,0x0000, +0xbeb9,0xbeb5,0xbeb8,0xbeb3,0xbebd,0xe943,0xe8fe,0xbebc, +0xe8fc,0xbebb,0xe944,0xe940,0xbc51,0x0000,0xbebf,0xe946, +0xbeb7,0xbeb4,0x0000,0x0000,0x0000,0x0000,0xecc6,0xecc8, +0xc07b,0xecc9,0xecc7,0xecc5,0xecc4,0xc07d,0xecc3,0xc07e, +0x0000,0x0000,0x0000,0x0000,0xecc1,0xecc2,0xc07a,0xc0a1, +0xc07c,0x0000,0x0000,0xecc0,0x0000,0xc250,0x0000,0xefbc, +0xefba,0xefbf,0xefbd,0x0000,0xefbb,0xefbe,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xc360,0xf1f2,0xf1f3, +0xc456,0x0000,0xf1f4,0xf1f0,0xf1f5,0xf1f1,0xc251,0x0000, +0x0000,0x0000,0xf3fe,0xf441,0xc459,0xf440,0xc458,0xc457, +0x0000,0x0000,0x0000,0x0000,0xc45a,0xf5c5,0xf5c6,0x0000, +0xc4da,0xc4d9,0xc4db,0xf5c4,0x0000,0xf6d8,0xf6d7,0x0000, +0xc56d,0xc56f,0xc56e,0xf6d9,0xc5c8,0xf8a6,0x0000,0x0000, +0x0000,0xc5f1,0x0000,0xf8a5,0xf8ee,0x0000,0x0000,0xc949, +0x0000,0x0000,0xa57d,0xa57c,0x0000,0xa65f,0xa65e,0xc9c7, +0xa65d,0xc9c6,0x0000,0x0000,0xa779,0xcaa9,0x0000,0xcaa8, +0x0000,0x0000,0xa777,0xa77a,0x0000,0x0000,0xcaa7,0x0000, +0xa778,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcbf0, +0x0000,0xcbf1,0xa954,0x0000,0x0000,0x0000,0x0000,0xabaa, +/* 0x5700 */ +0x0000,0xd148,0xd149,0xae45,0xae46,0x0000,0x0000,0xd4ac, +0xb0e9,0xb0eb,0xd4ab,0xb0ea,0xd87c,0xb3f2,0x0000,0x0000, +0x0000,0x0000,0xb6e9,0xb6ea,0xdce1,0x0000,0xb9cf,0x0000, +0xb9ce,0x0000,0xe549,0xe948,0xe947,0x0000,0xf96b,0xa467, +0xc959,0x0000,0xc96e,0xc96f,0x0000,0x0000,0x0000,0x0000, +0xa662,0xa666,0xc9c9,0x0000,0xa664,0xa663,0xc9c8,0xa665, +0xa661,0x0000,0x0000,0xa660,0xc9ca,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xa7a6,0x0000,0x0000,0xa7a3,0x0000, +0xa77d,0xcaaa,0x0000,0x0000,0x0000,0xcaab,0x0000,0xa7a1, +0x0000,0xcaad,0xa77b,0xcaae,0xcaac,0xa77e,0xa7a2,0xa7a5, +0xa7a4,0xa77c,0xcaaf,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xa959,0xcbfe,0x0000,0xa95b,0x0000,0xa95a,0x0000, +0xcc40,0xa958,0xa957,0xcbf5,0x0000,0xcbf4,0x0000,0xcbf2, +0xcbf7,0xcbf6,0xcbf3,0xcbfc,0xcbfd,0xcbfa,0xcbf8,0xa956, +0x0000,0x0000,0x0000,0xcbfb,0xa95c,0xcc41,0x0000,0x0000, +0xcbf9,0x0000,0xabab,0xa955,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xabac,0xce54,0x0000,0x0000,0xce5a, +0x0000,0x0000,0x0000,0xabb2,0xce58,0xce5e,0x0000,0xce55, +0xce59,0xce5b,0xce5d,0xce57,0x0000,0xce56,0xce51,0xce52, +0xabad,0x0000,0xabaf,0xabae,0xce53,0xce5c,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xabb1,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xce50,0xd153,0x0000, +0xd152,0xd157,0xd14e,0x0000,0xd151,0xd150,0x0000,0xd154, +0x0000,0xd158,0xae47,0xae4a,0x0000,0x0000,0xd14f,0xd155, +0x0000,0x0000,0x0000,0xae49,0xd14a,0x0000,0xabb0,0xd4ba, +0xd156,0x0000,0xd14d,0x0000,0xae48,0xd14c,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xd4b1,0x0000,0x0000,0xb0ec, +0xb0f0,0xd4c1,0xd4af,0xd4bd,0xb0f1,0xd4bf,0x0000,0xd4c5, +0x0000,0xd4c9,0x0000,0x0000,0xd4c0,0xd4b4,0xd4bc,0x0000, +0xd4ca,0xd4c8,0xd4be,0xd4b9,0xd4b2,0xd8a6,0xd4b0,0xb0f5, +0xd4b7,0xb0f6,0xb0f2,0xd4ad,0xd4c3,0xd4b5,0x0000,0x0000, +0xd4b3,0xd4c6,0xb0f3,0x0000,0xd4cc,0xb0ed,0xb0ef,0xd4bb, +0xd4b6,0xae4b,0xb0ee,0xd4b8,0xd4c7,0xd4cb,0xd4c2,0x0000, +0xd4c4,0x0000,0x0000,0x0000,0xd4ae,0x0000,0x0000,0x0000, +0x0000,0xd8a1,0x0000,0xd8aa,0xd8a9,0xb3fa,0xd8a2,0x0000, +0xb3fb,0xb3f9,0x0000,0xd8a4,0xb3f6,0xd8a8,0x0000,0xd8a3, +0xd8a5,0xd87d,0xb3f4,0x0000,0xd8b2,0xd8b1,0xd8ae,0xb3f3, +0xb3f7,0xb3f8,0xd14b,0xd8ab,0xb3f5,0xb0f4,0xd8ad,0xd87e, +0xd8b0,0xd8af,0x0000,0xd8b3,0x0000,0xdcef,0x0000,0xd8ac, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xd8a7,0xdce7,0xb6f4,0xb6f7,0xb6f2,0xdce6,0xdcea,0xdce5, +0x0000,0xb6ec,0xb6f6,0xdce2,0xb6f0,0xdce9,0x0000,0xb6ee, +0xb6ed,0xdcec,0xb6ef,0xdcee,0x0000,0xdceb,0xb6eb,0x0000, +0x0000,0x0000,0xb6f5,0xdcf0,0xdce4,0xdced,0x0000,0x0000, +0xdce3,0x0000,0x0000,0xb6f1,0x0000,0xb6f3,0x0000,0xdce8, +0x0000,0xdcf1,0x0000,0x0000,0xe15d,0xb9d0,0xe163,0x0000, +0x0000,0xb9d5,0xe15f,0xe166,0xe157,0xb9d7,0xb9d1,0xe15c, +0xbc55,0xe15b,0xe164,0xb9d2,0x0000,0xb9d6,0xe15a,0xe160, +0xe165,0xe156,0xb9d4,0xe15e,0x0000,0x0000,0xe162,0xe168, +0xe158,0xe161,0x0000,0xb9d3,0xe167,0x0000,0x0000,0x0000, +0xe159,0x0000,0x0000,0x0000,0xbc59,0xe54b,0xbc57,0xbc56, +0xe54d,0xe552,0x0000,0xe54e,0x0000,0xe551,0xbc5c,0x0000, +0xbea5,0xbc5b,0x0000,0xe54a,0xe550,0x0000,0xbc5a,0xe54f, +0x0000,0xe54c,0x0000,0xbc58,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xe94d,0xf9d9,0xe94f,0xe94a,0xbec1,0xe94c, +0x0000,0xbec0,0xe94e,0x0000,0x0000,0xbec3,0xe950,0xbec2, +0xe949,0xe94b,0x0000,0x0000,0x0000,0x0000,0xc0a5,0xeccc, +0x0000,0xc0a4,0xeccd,0xc0a3,0xeccb,0xc0a2,0xecca,0x0000, +0xc253,0xc252,0xf1f6,0xf1f8,0x0000,0xf1f7,0xc361,0xc362, +0x0000,0x0000,0xc363,0xf442,0xc45b,0x0000,0x0000,0xf7d3, +0xf7d2,0xc5f2,0x0000,0xa468,0xa4d0,0x0000,0x0000,0xa7a7, +0x0000,0x0000,0x0000,0x0000,0xce5f,0x0000,0x0000,0x0000, +0x0000,0xb3fc,0xb3fd,0x0000,0xdcf2,0xb9d8,0xe169,0xe553, +/* 0x5900 */ +0x0000,0x0000,0x0000,0xc95a,0x0000,0x0000,0xcab0,0x0000, +0x0000,0x0000,0x0000,0x0000,0xcc42,0xce60,0xd159,0xae4c, +0x0000,0x0000,0xf1f9,0x0000,0xc4dc,0xa469,0xa57e,0xc970, +0x0000,0xa667,0xa668,0x0000,0xa95d,0x0000,0x0000,0x0000, +0xb0f7,0x0000,0xb9da,0x0000,0xb9db,0xb9d9,0x0000,0xa46a, +0x0000,0xa4d1,0xa4d3,0xa4d2,0xc95b,0xa4d4,0xa5a1,0xc971, +0x0000,0xa5a2,0x0000,0x0000,0x0000,0x0000,0x0000,0xa669, +0xa66a,0x0000,0x0000,0x0000,0xc9cb,0x0000,0xa7a8,0x0000, +0xcab1,0x0000,0x0000,0x0000,0xa961,0xcc43,0x0000,0xa95f, +0xa960,0xa95e,0xd15a,0x0000,0x0000,0x0000,0xabb6,0xabb5, +0xabb7,0xabb4,0x0000,0xce61,0xa962,0xabb3,0x0000,0xae4d, +0xae4e,0x0000,0xae4f,0x0000,0xd4cd,0x0000,0x0000,0x0000, +0xb3fe,0xd8b4,0xb0f8,0x0000,0x0000,0x0000,0x0000,0xb6f8, +0x0000,0xb9dd,0xb9dc,0xe16a,0x0000,0xbc5d,0xbec4,0x0000, +0xefc0,0xf6da,0xf7d4,0xa46b,0xa5a3,0x0000,0xa5a4,0xc9d1, +0xa66c,0xa66f,0x0000,0xc9cf,0xc9cd,0xa66e,0xc9d0,0xc9d2, +0xc9cc,0xa671,0xa670,0xa66d,0xa66b,0xc9ce,0x0000,0x0000, +0x0000,0x0000,0xa7b3,0x0000,0x0000,0xa7b0,0xcab6,0xcab9, +0xcab8,0x0000,0xa7aa,0xa7b2,0x0000,0x0000,0xa7af,0xcab5, +0xcab3,0xa7ae,0x0000,0x0000,0x0000,0xa7a9,0xa7ac,0x0000, +0xcab4,0xcabb,0xcab7,0xa7ad,0xa7b1,0xa7b4,0xcab2,0xcaba, +0xa7ab,0x0000,0x0000,0x0000,0x0000,0x0000,0xa967,0xa96f, +0x0000,0xcc4f,0xcc48,0xa970,0xcc53,0xcc44,0xcc4b,0x0000, +0x0000,0xa966,0xcc45,0xa964,0xcc4c,0xcc50,0xa963,0x0000, +0xcc51,0xcc4a,0x0000,0xcc4d,0x0000,0xa972,0xa969,0xcc54, +0xcc52,0x0000,0xa96e,0xa96c,0xcc49,0xa96b,0xcc47,0xcc46, +0xa96a,0xa968,0xa971,0xa96d,0xa965,0x0000,0xcc4e,0x0000, +0xabb9,0x0000,0xabc0,0xce6f,0xabb8,0xce67,0xce63,0x0000, +0xce73,0xce62,0x0000,0xabbb,0xce6c,0xabbe,0xabc1,0x0000, +0xabbc,0xce70,0xabbf,0x0000,0xae56,0xce76,0xce64,0x0000, +0x0000,0xce66,0xce6d,0xce71,0xce75,0xce72,0xce6b,0xce6e, +0x0000,0x0000,0xce68,0xabc3,0xce6a,0xce69,0xce74,0xabba, +0xce65,0xabc2,0x0000,0xabbd,0x0000,0x0000,0x0000,0x0000, +0x0000,0xae5c,0xd162,0x0000,0xae5b,0x0000,0x0000,0xd160, +0x0000,0xae50,0x0000,0xae55,0x0000,0xd15f,0xd15c,0xd161, +0xae51,0xd15b,0x0000,0xae54,0xae52,0x0000,0xd163,0xae53, +0xae57,0x0000,0x0000,0xae58,0x0000,0xae5a,0x0000,0x0000, +0x0000,0xae59,0x0000,0x0000,0x0000,0xd15d,0xd15e,0x0000, +0x0000,0x0000,0x0000,0xd164,0x0000,0xd4d4,0xb0f9,0xd8c2, +0xd4d3,0xd4e6,0x0000,0x0000,0xb140,0x0000,0xd4e4,0x0000, +0xb0fe,0xb0fa,0xd4ed,0xd4dd,0xd4e0,0x0000,0xb143,0xd4ea, +0xd4e2,0xb0fb,0xb144,0x0000,0xd4e7,0xd4e5,0x0000,0x0000, +0xd4d6,0xd4eb,0xd4df,0xd4da,0x0000,0xd4d0,0xd4ec,0xd4dc, +0xd4cf,0x0000,0xb142,0xd4e1,0xd4ee,0xd4de,0xd4d2,0xd4d7, +0xd4ce,0x0000,0xb141,0x0000,0xd4db,0xd4d8,0xb0fc,0xd4d1, +0x0000,0xd4e9,0xb0fd,0x0000,0xd4d9,0xd4d5,0x0000,0x0000, +0xd4e8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb440, +0xd8bb,0x0000,0xd8b8,0xd8c9,0xd8bd,0xd8ca,0x0000,0xb442, +0x0000,0x0000,0x0000,0xd8c6,0xd8c3,0x0000,0x0000,0x0000, +0x0000,0x0000,0xd8c4,0xd8c7,0xd8cb,0x0000,0xd4e3,0xd8cd, +0xdd47,0x0000,0xb443,0xd8ce,0xd8b6,0xd8c0,0x0000,0xd8c5, +0x0000,0x0000,0xb441,0xb444,0xd8cc,0xd8cf,0xd8ba,0xd8b7, +0x0000,0x0000,0xd8b9,0x0000,0x0000,0xd8be,0xd8bc,0xb445, +0x0000,0xd8c8,0x0000,0x0000,0xd8bf,0x0000,0xd8c1,0xd8b5, +0xdcfa,0xdcf8,0xb742,0xb740,0xdd43,0xdcf9,0xdd44,0xdd40, +0xdcf7,0xdd46,0xdcf6,0xdcfd,0xb6fe,0xb6fd,0xb6fc,0xdcfb, +0xdd41,0xb6f9,0xb741,0x0000,0xdcf4,0x0000,0xdcfe,0xdcf3, +0xdcfc,0xb6fa,0xdd42,0xdcf5,0xb6fb,0xdd45,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xe16e,0xb9e2,0xb9e1, +0xb9e3,0xe17a,0xe170,0xe176,0xe16b,0xe179,0xe178,0xe17c, +0xe175,0xb9de,0xe174,0xb9e4,0x0000,0xe16d,0xb9df,0x0000, +0xe17b,0xb9e0,0xe16f,0xe172,0xe177,0xe171,0xe16c,0x0000, +0x0000,0x0000,0x0000,0xe173,0xe555,0xbc61,0xe558,0xe557, +0xe55a,0xe55c,0xf9dc,0xbc5f,0x0000,0xe556,0x0000,0xe554, +/* 0x5b00 */ +0x0000,0xe55d,0xe55b,0xe559,0x0000,0xe55f,0x0000,0xe55e, +0xbc63,0xbc5e,0x0000,0xbc60,0xbc62,0x0000,0x0000,0xe560, +0xe957,0x0000,0x0000,0xe956,0xe955,0x0000,0xe958,0xe951, +0x0000,0xe952,0xe95a,0xe953,0x0000,0xbec5,0xe95c,0x0000, +0xe95b,0xe954,0x0000,0xecd1,0xc0a8,0xeccf,0xecd4,0xecd3, +0xe959,0x0000,0xc0a7,0x0000,0xecd2,0xecce,0xecd6,0xecd5, +0xc0a6,0x0000,0xecd0,0x0000,0xbec6,0x0000,0x0000,0x0000, +0xc254,0x0000,0x0000,0x0000,0xefc1,0xf1fa,0xf1fb,0xf1fc, +0xc45c,0x0000,0x0000,0xc45d,0x0000,0xf443,0x0000,0xf5c8, +0xf5c7,0x0000,0x0000,0xf6db,0xf6dc,0xf7d5,0xf8a7,0x0000, +0xa46c,0xa46d,0x0000,0xa46e,0xa4d5,0xa5a5,0xc9d3,0xa672, +0xa673,0x0000,0xa7b7,0xa7b8,0xa7b6,0xa7b5,0x0000,0xa973, +0x0000,0x0000,0xcc55,0xa975,0xa974,0xcc56,0x0000,0x0000, +0x0000,0xabc4,0x0000,0xae5d,0xd165,0x0000,0xd4f0,0x0000, +0xb145,0xb447,0xd4ef,0xb446,0x0000,0xb9e5,0x0000,0xe17d, +0xbec7,0x0000,0xc0a9,0xecd7,0x0000,0xc45e,0x0000,0xc570, +0x0000,0xc972,0x0000,0xa5a6,0xc973,0xa676,0x0000,0xa674, +0xa675,0xa677,0x0000,0xa7ba,0xa7b9,0x0000,0xcabc,0xa7bb, +0x0000,0x0000,0xcabd,0xcc57,0x0000,0xcc58,0x0000,0xa976, +0xa978,0xa97a,0xa977,0xa97b,0xa979,0x0000,0x0000,0x0000, +0x0000,0x0000,0xabc8,0xabc5,0xabc7,0xabc9,0xabc6,0xd166, +0xce77,0x0000,0x0000,0x0000,0xd168,0xd167,0xae63,0x0000, +0xae5f,0x0000,0x0000,0xae60,0xae62,0xae64,0xae61,0x0000, +0xae66,0xae65,0x0000,0x0000,0x0000,0x0000,0x0000,0xb14a, +0xd4f2,0xd4f1,0xb149,0x0000,0xb148,0xb147,0xb14b,0xb146, +0x0000,0x0000,0xd8d5,0xd8d2,0xb449,0xd8d1,0xd8d6,0x0000, +0xb44b,0xd8d4,0xb448,0xb44a,0xd8d3,0x0000,0xdd48,0x0000, +0xdd49,0xdd4a,0x0000,0x0000,0x0000,0x0000,0xb9e6,0xb9ee, +0xe17e,0xb9e8,0xb9ec,0xe1a1,0xb9ed,0xb9e9,0xb9ea,0xb9e7, +0xb9eb,0xbc66,0xd8d0,0xbc67,0xbc65,0x0000,0xbc64,0xe95d, +0xbec8,0xecd8,0xecd9,0x0000,0x0000,0xc364,0xc45f,0x0000, +0xa46f,0x0000,0xa678,0x0000,0x0000,0x0000,0x0000,0x0000, +/* 0x5c00 */ +0x0000,0xabca,0x0000,0xd169,0xae67,0x0000,0x0000,0xb14e, +0xb14d,0xb14c,0xb44c,0xb44d,0xd8d7,0xb9ef,0xbec9,0xa470, +0xc95c,0xa4d6,0xc974,0x0000,0x0000,0xc9d4,0xa679,0x0000, +0x0000,0x0000,0xa97c,0x0000,0x0000,0x0000,0x0000,0xdd4b, +0x0000,0x0000,0xa471,0x0000,0xa4d7,0xc9d5,0x0000,0x0000, +0xcabe,0x0000,0xcabf,0x0000,0xa7bc,0x0000,0x0000,0x0000, +0xd8d8,0xb44e,0x0000,0xdd4c,0x0000,0x0000,0x0000,0xc0aa, +0xa472,0xa4a8,0xa4d8,0xc975,0xa5a7,0x0000,0xa7c0,0xa7bf, +0xa7bd,0xa7be,0x0000,0x0000,0xcc59,0xa97e,0xa9a1,0xcc5a, +0xa97d,0x0000,0x0000,0xabce,0xce78,0xabcd,0xabcb,0xabcc, +0xae6a,0xae68,0x0000,0x0000,0xd16b,0xae69,0xd16a,0x0000, +0xae5e,0xd4f3,0x0000,0x0000,0xb150,0xb151,0x0000,0x0000, +0xb14f,0x0000,0xb9f0,0xe1a2,0xbc68,0xbc69,0x0000,0xe561, +0xc0ab,0xefc2,0xefc3,0x0000,0xc4dd,0xf8a8,0xc94b,0xa4d9, +0x0000,0xa473,0x0000,0xc977,0xc976,0x0000,0x0000,0x0000, +0x0000,0xa67a,0xc9d7,0xc9d8,0xc9d6,0x0000,0xc9d9,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcac7,0x0000, +0xcac2,0xcac4,0xcac6,0xcac3,0xa7c4,0xcac0,0x0000,0xcac1, +0xa7c1,0xa7c2,0xcac5,0xcac8,0xa7c3,0xcac9,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xcc68,0x0000,0xcc62, +0xcc5d,0xa9a3,0xcc65,0xcc63,0xcc5c,0xcc69,0xcc6c,0xcc67, +0xcc60,0xa9a5,0xcc66,0xa9a6,0xcc61,0xcc64,0xcc5b,0xcc5f, +0xcc6b,0xa9a7,0x0000,0xa9a8,0x0000,0xcc5e,0xcc6a,0xa9a2, +0xa9a4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xceab,0xcea4, +0xceaa,0xcea3,0xcea5,0xce7d,0xce7b,0x0000,0xceac,0xcea9, +0xce79,0x0000,0xabd0,0xcea7,0xcea8,0x0000,0xcea6,0xce7c, +0xce7a,0xabcf,0xcea2,0xce7e,0x0000,0x0000,0xcea1,0xcead, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xae6f,0x0000,0xae6e,0x0000,0xd16c,0xae6b,0xd16e,0x0000, +0xae70,0xd16f,0x0000,0x0000,0xae73,0x0000,0xae71,0xd170, +0xceae,0xd172,0x0000,0xae6d,0x0000,0xae6c,0x0000,0xd16d, +0xd171,0xae72,0x0000,0x0000,0x0000,0x0000,0xb153,0xb152, +0x0000,0x0000,0x0000,0xd4f5,0xd4f9,0xd4fb,0xb154,0xd4fe, +0x0000,0xb158,0xd541,0x0000,0xb15a,0x0000,0xb156,0xb15e, +0x0000,0xb15b,0xd4f7,0xb155,0x0000,0xd4f6,0xd4f4,0xd543, +0xd4f8,0x0000,0xb157,0xd542,0xb15c,0xd4fd,0xd4fc,0xb15d, +0xd4fa,0xb159,0x0000,0x0000,0x0000,0x0000,0xd544,0x0000, +0xd540,0xd8e7,0xd8ee,0xd8e3,0xb451,0xd8df,0xd8ef,0xd8d9, +0xd8ec,0xd8ea,0xd8e4,0x0000,0xd8ed,0xd8e6,0x0000,0xd8de, +0xd8f0,0xd8dc,0xd8e9,0xd8da,0x0000,0xd8f1,0x0000,0xb452, +0x0000,0xd8eb,0xdd4f,0xd8dd,0xb44f,0x0000,0xd8e1,0x0000, +0xb450,0xd8e0,0xd8e5,0x0000,0x0000,0xd8e2,0x0000,0x0000, +0x0000,0xd8e8,0x0000,0x0000,0x0000,0x0000,0xdd53,0x0000, +0x0000,0x0000,0xdd56,0xdd4e,0x0000,0xdd50,0x0000,0xdd55, +0xdd54,0xb743,0x0000,0xd8db,0xdd52,0x0000,0x0000,0xb744, +0x0000,0xdd4d,0xdd51,0x0000,0x0000,0x0000,0x0000,0xe1a9, +0x0000,0xe1b0,0xe1a7,0x0000,0xe1ae,0xe1a5,0xe1ad,0xe1b1, +0xe1a4,0xe1a8,0xe1a3,0x0000,0xb9f1,0x0000,0xe1a6,0xb9f2, +0xe1ac,0xe1ab,0xe1aa,0x0000,0x0000,0xe1af,0x0000,0x0000, +0x0000,0x0000,0xe565,0xe567,0xbc6b,0xe568,0x0000,0xe563, +0x0000,0xe562,0xe56c,0x0000,0xe56a,0xbc6a,0xe56d,0xe564, +0xe569,0xe56b,0xe566,0x0000,0x0000,0x0000,0x0000,0xe961, +0xe966,0xe960,0xe965,0x0000,0xe95e,0xe968,0xe964,0xe969, +0xe963,0xe95f,0xe967,0x0000,0xe96a,0xe962,0x0000,0xecda, +0xc0af,0x0000,0xc0ad,0x0000,0xc0ac,0xc0ae,0x0000,0x0000, +0xefc4,0x0000,0xf172,0xf1fd,0x0000,0x0000,0xf444,0xf445, +0x0000,0xc460,0x0000,0xf5c9,0x0000,0xc4de,0x0000,0xf5ca, +0x0000,0xf6de,0xc572,0x0000,0xc571,0xf6dd,0xc5c9,0x0000, +0xf7d6,0x0000,0x0000,0x0000,0x0000,0xa474,0xa67b,0xc9da, +0xcaca,0xa8b5,0xb15f,0x0000,0x0000,0xa475,0xa5aa,0xa5a9, +0xa5a8,0x0000,0x0000,0xa7c5,0x0000,0x0000,0xae74,0x0000, +0xdd57,0xa476,0xa477,0xa478,0xa4da,0x0000,0x0000,0xabd1, +0x0000,0xceaf,0x0000,0x0000,0x0000,0xb453,0xa479,0xc95d, +/* 0x5e00 */ +0x0000,0x0000,0xa5ab,0xa5ac,0xc978,0x0000,0xa67c,0x0000, +0x0000,0x0000,0xcacb,0x0000,0xa7c6,0x0000,0xcacc,0x0000, +0x0000,0xa9ae,0x0000,0x0000,0xcc6e,0xa9ac,0xa9ab,0xcc6d, +0xa9a9,0xcc6f,0xa9aa,0xa9ad,0x0000,0xabd2,0x0000,0xabd4, +0xceb3,0xceb0,0xceb1,0xceb2,0xceb4,0xabd3,0x0000,0x0000, +0xd174,0xd173,0x0000,0xae76,0x0000,0xae75,0x0000,0x0000, +0x0000,0x0000,0x0000,0xb162,0xd546,0x0000,0xb161,0xb163, +0xb160,0x0000,0x0000,0x0000,0x0000,0xb455,0xd545,0x0000, +0xb456,0xd8f3,0x0000,0xb457,0xd8f2,0xb454,0x0000,0x0000, +0x0000,0x0000,0xdd5a,0xdd5c,0xb745,0xdd5b,0xdd59,0xdd58, +0x0000,0x0000,0x0000,0xe1b4,0xb9f7,0xb9f5,0x0000,0xb9f6, +0xe1b2,0xe1b3,0x0000,0xb9f3,0xe571,0xe56f,0x0000,0xbc6d, +0xe570,0xbc6e,0xbc6c,0xb9f4,0x0000,0x0000,0xe96d,0xe96b, +0xe96c,0xe56e,0xecdc,0xc0b0,0xecdb,0xefc5,0xefc6,0xe96e, +0xf1fe,0x0000,0xa47a,0xa5ad,0xa67e,0xc9db,0xa67d,0x0000, +0xa9af,0xb746,0x0000,0xa4db,0xa5ae,0xabd5,0xb458,0x0000, +0xc979,0x0000,0xc97a,0x0000,0xc9dc,0x0000,0x0000,0xa7c8, +0xcad0,0xcace,0xa7c9,0xcacd,0xcacf,0xcad1,0x0000,0xa7c7, +0x0000,0x0000,0x0000,0x0000,0x0000,0xa9b3,0xa9b4,0xa9b1, +0x0000,0x0000,0xa9b0,0xceb8,0xa9b2,0x0000,0x0000,0x0000, +0xabd6,0x0000,0xceb7,0xceb9,0xceb6,0xceba,0xabd7,0xae79, +0xd175,0x0000,0xd177,0xae77,0xd178,0xae78,0xd176,0x0000, +0xceb5,0xd547,0xd54a,0xd54b,0xd548,0xb167,0xb166,0xb164, +0xb165,0xd549,0x0000,0x0000,0x0000,0x0000,0xb168,0x0000, +0x0000,0xb45a,0xb45b,0x0000,0xb45c,0xdd5d,0xdd5f,0xdd61, +0xb748,0xb747,0xb459,0xdd60,0xdd5e,0x0000,0xe1b8,0x0000, +0x0000,0xe1b6,0xe1bc,0xb9f8,0xe1bd,0xe1ba,0xb9f9,0xe1b7, +0xe1b5,0xe1bb,0xbc70,0xe573,0xe1b9,0xbc72,0xe574,0xbc71, +0xbc74,0xe575,0xbc6f,0xbc73,0x0000,0xe973,0xe971,0xe970, +0xe972,0xe96f,0x0000,0x0000,0xc366,0x0000,0xf446,0xf447, +0x0000,0xf5cb,0xf6df,0xc655,0x0000,0x0000,0xa9b5,0xa7ca, +0x0000,0x0000,0xabd8,0x0000,0x0000,0x0000,0xa47b,0xa4dc, +/* 0x5f00 */ +0x0000,0xa5af,0xc9dd,0x0000,0xa7cb,0xcad2,0x0000,0xcebb, +0xabd9,0x0000,0xb9fa,0xa47c,0x0000,0x0000,0x0000,0xa6a1, +0x0000,0x0000,0xb749,0xa47d,0xa4dd,0xa4de,0x0000,0xa5b1, +0xa5b0,0x0000,0xc9de,0xa6a2,0x0000,0xcad3,0x0000,0xa7cc, +0x0000,0x0000,0xcc71,0xcc72,0xcc73,0x0000,0xa9b6,0xa9b7, +0xcc70,0xa9b8,0x0000,0x0000,0x0000,0xabda,0xcebc,0x0000, +0xd17a,0xae7a,0x0000,0xd179,0x0000,0xb169,0xd54c,0xb16a, +0xd54d,0x0000,0x0000,0x0000,0xb45d,0x0000,0x0000,0x0000, +0xdd62,0x0000,0x0000,0xe1bf,0xe1be,0x0000,0xb9fb,0x0000, +0xbc75,0xe576,0xbeca,0xe974,0xc0b1,0x0000,0xc573,0xf7d8, +0x0000,0x0000,0x0000,0x0000,0xcc74,0x0000,0xcebd,0xb16b, +0xd8f4,0xb74a,0x0000,0x0000,0x0000,0xc255,0x0000,0x0000, +0x0000,0x0000,0xa7ce,0x0000,0xa7cd,0xabdb,0x0000,0xd17b, +0x0000,0xb16d,0xb343,0xb16e,0xb16c,0xb45e,0x0000,0xe1c0, +0xb9fc,0xbc76,0x0000,0xc94c,0xc9df,0x0000,0xcad5,0xa7cf, +0xcad4,0xa7d0,0x0000,0x0000,0xa9bc,0xcc77,0xcc76,0xa9bb, +0xa9b9,0xa9ba,0xcc75,0x0000,0x0000,0xabdd,0xcebe,0xabe0, +0xabdc,0xabe2,0xabde,0xabdf,0xabe1,0x0000,0x0000,0x0000, +0xae7d,0xae7c,0xae7b,0x0000,0x0000,0x0000,0xd54f,0xb16f, +0xb172,0xb170,0x0000,0xd54e,0xb175,0x0000,0xb171,0xd550, +0xb174,0xb173,0x0000,0x0000,0x0000,0xd8f6,0xd8f5,0x0000, +0xb461,0xb45f,0xb460,0xd8f7,0xb74b,0xdd64,0xb74c,0xdd63, +0x0000,0x0000,0xe577,0x0000,0x0000,0xbc78,0xe1c1,0xbc77, +0x0000,0xb9fd,0x0000,0xecde,0xe975,0xc0b2,0xecdd,0xf240, +0xf448,0xf449,0x0000,0xa4df,0x0000,0xa5b2,0x0000,0x0000, +0x0000,0xc97b,0x0000,0x0000,0xa7d2,0xa7d4,0x0000,0xc9e2, +0xcad8,0xcad7,0xcad6,0x0000,0xc9e1,0xc9e0,0xa6a4,0xa7d3, +0xa7d1,0xa6a3,0x0000,0x0000,0x0000,0xa9bd,0xcc78,0x0000, +0xa9be,0xcadd,0x0000,0xcadf,0xcade,0xcc79,0x0000,0x0000, +0xcada,0x0000,0xa7d8,0xa7d6,0x0000,0xcad9,0xcadb,0xcae1, +0x0000,0xa7d5,0x0000,0xcadc,0xcae5,0xa9c0,0x0000,0xcae2, +0xa7d7,0x0000,0xcae0,0xcae3,0x0000,0xa9bf,0x0000,0xa9c1, +0xcae4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xccaf,0xcca2,0xcc7e,0xccae,0xcca9,0xabe7,0xa9c2, +0xccaa,0xccad,0xabe3,0xccac,0xa9c3,0xa9c8,0xa9c6,0xcca3, +0x0000,0xcc7c,0xcca5,0xa9cd,0xccb0,0xabe4,0xcca6,0x0000, +0xabe5,0xa9c9,0xcca8,0x0000,0xcecd,0xabe6,0xcc7b,0xa9ca, +0xabe8,0xa9cb,0xa9c7,0xa9cc,0xcca7,0xcc7a,0xccab,0xa9c4, +0x0000,0x0000,0xcc7d,0xcca4,0xcca1,0xa9c5,0x0000,0xcebf, +0x0000,0xcec0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xceca,0xd1a1,0xcecb,0xabee,0xcece,0xcec4,0xabed,0xcec6, +0x0000,0xcec7,0x0000,0x0000,0xcec9,0xabe9,0x0000,0x0000, +0xaea3,0x0000,0xf9da,0xcec5,0xcec1,0xaea4,0x0000,0x0000, +0xcecf,0xae7e,0xd17d,0xcec8,0x0000,0xd17c,0xcec3,0xcecc, +0x0000,0x0000,0xabec,0xaea1,0xabf2,0xaea2,0xced0,0xd17e, +0xabeb,0xaea6,0xabf1,0xabf0,0xabef,0xaea5,0xced1,0xaea7, +0xabea,0x0000,0xcec2,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb176, +0xd1a4,0xd1a6,0x0000,0xd1a8,0xaea8,0xaeae,0xd553,0xd1ac, +0xd1a3,0xb178,0xd551,0x0000,0xaead,0xaeab,0xd1ae,0x0000, +0xd552,0x0000,0xd1a5,0x0000,0xaeac,0xd1a9,0xaeaf,0xd1ab, +0x0000,0x0000,0xaeaa,0xd1aa,0xd1ad,0xd1a7,0x0000,0xaea9, +0xb179,0x0000,0xd1a2,0xb177,0x0000,0x0000,0x0000,0x0000, +0xb17a,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xd555,0xd55e,0xb464,0x0000,0xb17c,0xb1a3,0xb465,0xd560, +0xb1aa,0xd8f9,0xd556,0xb1a2,0xb1a5,0xb17e,0xd554,0xd562, +0xd565,0xd949,0x0000,0xd563,0xd8fd,0xb1a1,0xb1a8,0xb1ac, +0xd55d,0xd8f8,0xd561,0xb17b,0xd8fa,0xd564,0xd8fc,0xd559, +0x0000,0xb462,0x0000,0xd557,0xd558,0xb1a7,0x0000,0x0000, +0xb1a6,0xd55b,0xb1ab,0xd55f,0xb1a4,0xd55c,0x0000,0xb1a9, +0xb466,0xb463,0xd8fb,0x0000,0xd55a,0x0000,0xb17d,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xb46b,0xb46f,0xd940,0xb751,0xb46d,0xd944,0xb471,0xdd65, +0xd946,0xb753,0xb469,0xb46c,0xd947,0x0000,0xd948,0xd94e, +0xb473,0xb754,0x0000,0xd94a,0xd94f,0xd943,0xb75e,0x0000, +0xb755,0xb472,0xd941,0xd950,0x0000,0xb75d,0xb470,0xb74e, +0xd94d,0x0000,0xb474,0xd945,0xd8fe,0xb46a,0xd942,0x0000, +0xd94b,0x0000,0xb74d,0xb752,0xb467,0xd94c,0x0000,0xb750, +0x0000,0x0000,0x0000,0xb468,0x0000,0x0000,0x0000,0xb75c, +0xe1c3,0xdd70,0x0000,0xdd68,0xe1c2,0x0000,0xdd6c,0xdd6e, +0x0000,0x0000,0xdd6b,0x0000,0xb75b,0x0000,0xdd6a,0xb75f, +0x0000,0x0000,0x0000,0xe1d2,0x0000,0x0000,0xb75a,0xba40, +0xdd71,0xe1c4,0x0000,0x0000,0xb758,0xdd69,0xdd6d,0xb9fe, +0xb74f,0xdd66,0xdd67,0xba41,0xb757,0xb759,0xb756,0xdd6f, +0x0000,0x0000,0xe1c8,0xe1c9,0xe1ce,0xbc7d,0xe1d5,0x0000, +0xba47,0x0000,0xba46,0xe1d0,0x0000,0xbc7c,0xe1c5,0xba45, +0x0000,0xe1d4,0xba43,0xba44,0x0000,0xe1d1,0xe5aa,0xbc7a, +0xb46e,0x0000,0xe1d3,0xbca3,0xe1cb,0x0000,0xbc7b,0x0000, +0xbca2,0xe1c6,0xe1ca,0xe1c7,0xe1cd,0xba48,0xbc79,0xba42, +0x0000,0xe57a,0xe1cf,0x0000,0xbca1,0x0000,0xbca4,0x0000, +0xe1cc,0x0000,0xbc7e,0xe579,0x0000,0x0000,0x0000,0x0000, +0x0000,0xe57e,0xbece,0xe578,0xe9a3,0xe5a9,0xbca8,0x0000, +0xbca6,0xbecc,0xe5a6,0xe5a2,0xbcac,0x0000,0xe978,0x0000, +0x0000,0x0000,0xbcaa,0xe5a1,0x0000,0xe976,0x0000,0xe5a5, +0x0000,0xe5a8,0xe57d,0x0000,0xbcab,0x0000,0x0000,0xbca5, +0xe977,0xbecd,0xe5a7,0xbca7,0xbca9,0xe5a4,0xbcad,0xe5a3, +0xe57c,0xe57b,0xbecb,0xe5ab,0xe97a,0xece0,0xbed0,0x0000, +0xe9a2,0x0000,0xe97e,0x0000,0xece1,0x0000,0xbed1,0xe9a1, +0x0000,0xe97c,0xc0b4,0xecdf,0x0000,0xe979,0xe97b,0xc0b5, +0xbed3,0xc0b3,0xbed2,0xc0b7,0xe97d,0xbecf,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xefcf,0x0000, +0xefc7,0x0000,0x0000,0x0000,0x0000,0x0000,0xece7,0xefc8, +0xece3,0x0000,0x0000,0xc256,0xece5,0xece4,0xc0b6,0xece2, +0xece6,0xefd0,0xefcc,0xefce,0x0000,0xefc9,0xefca,0x0000, +0xefcd,0xefcb,0xc367,0x0000,0x0000,0xc36a,0xc369,0xc368, +0xc461,0xf44a,0xc462,0xf241,0xc4df,0xf5cc,0xc4e0,0xc574, +0xc5ca,0xf7d9,0x0000,0xf7da,0xf7db,0x0000,0x0000,0xf9ba, +0xa4e0,0xc97c,0xa5b3,0x0000,0xa6a6,0xa6a7,0xa6a5,0x0000, +0xa6a8,0xa7da,0xa7d9,0x0000,0xccb1,0xa9cf,0xa9ce,0x0000, +0x0000,0xd1af,0xb1ad,0xb1ae,0x0000,0x0000,0x0000,0xb475, +0xdd72,0xb760,0xb761,0xdd74,0xdd76,0xdd75,0x0000,0xe1d7, +0x0000,0xe1d6,0xba49,0xe1d8,0x0000,0xe5ac,0xbcae,0x0000, +0xbed4,0x0000,0xc0b8,0xc257,0xc0b9,0x0000,0xa4e1,0x0000, +0x0000,0x0000,0xcae6,0x0000,0x0000,0xccb2,0xa9d1,0xa9d0, +0xa9d2,0xabf3,0xced2,0xced3,0x0000,0x0000,0xd1b0,0xaeb0, +0xb1af,0xb476,0xd951,0xa4e2,0x0000,0xa47e,0xa4e3,0x0000, +0xc97d,0xa5b7,0xa5b6,0xa5b4,0xa5b5,0x0000,0x0000,0x0000, +0xa6ab,0xc9e9,0xc9eb,0xa6aa,0xc9e3,0x0000,0xc9e4,0x0000, +0xc9ea,0xc9e6,0xc9e8,0xa6a9,0xc9e5,0xc9ec,0xc9e7,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xa7e1,0xa7ea,0xa7e8, +0xcaf0,0xcaed,0xcaf5,0xa7e6,0xcaf6,0x0000,0xa7df,0xcaf3, +0x0000,0xa7e5,0xcaef,0xcaee,0xa7e3,0xcaf4,0xa7e4,0xa9d3, +0xa7de,0xcaf1,0x0000,0xcae7,0xa7db,0x0000,0xa7ee,0xcaec, +0xcaf2,0xa7e0,0xa7e2,0x0000,0xcae8,0x0000,0xcae9,0xcaea, +0x0000,0xa7ed,0xa7e7,0xa7ec,0xcaeb,0xa7eb,0xa7dd,0xa7dc, +0xa7e9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xa9e1,0xccbe,0xccb7,0xa9dc,0xa9ef,0xccb3,0xccba,0xccbc, +0xccbf,0xa9ea,0x0000,0xccbb,0xccb4,0xa9e8,0xccb8,0x0000, +0xccc0,0xa9d9,0x0000,0xccbd,0xa9e3,0xa9e2,0xccb6,0xa9d7, +0x0000,0x0000,0xa9d8,0x0000,0xa9d6,0x0000,0xa9ee,0xa9e6, +0xa9e0,0xa9d4,0xccb9,0xa9df,0xa9d5,0xa9e7,0xa9f0,0xced4, +0xa9e4,0xccb5,0xa9da,0xa9dd,0xa9de,0x0000,0xa9ec,0xa9ed, +0xa9eb,0xa9e5,0xa9e9,0xa9db,0xabf4,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xceda,0xac41,0xabf8,0xabfa,0xac40, +0xcee6,0xabfd,0xd1b1,0xaeb1,0xac43,0xced7,0xcedf,0xabfe, +0xcede,0xcedb,0xcee3,0xcee5,0xabf7,0xabfb,0xac42,0xaeb3, +0xcee0,0xabf9,0xac45,0xced9,0x0000,0x0000,0x0000,0xabfc, +0xaeb2,0xabf6,0x0000,0xced6,0xcedd,0xced5,0xced8,0xcedc, +0xd1b2,0xac44,0x0000,0xcee1,0xcee2,0xcee4,0xabf5,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xaec1,0xd1be,0xaebf,0xaec0,0xd1b4,0xd1c4,0x0000,0xaeb6, +0x0000,0x0000,0xd566,0xd1c6,0xd1c0,0x0000,0xd1b7,0x0000, +0xd1c9,0xd1ba,0xaebc,0xd57d,0xd1bd,0xaebe,0xaeb5,0x0000, +0xd1cb,0xd1bf,0xaeb8,0xd1b8,0xd1b5,0xd1b6,0xaeb9,0xd1c5, +0xd1cc,0xaebb,0xd1bc,0xd1bb,0xaec3,0xaec2,0xaeb4,0xaeba, +0xaebd,0xd1c8,0x0000,0x0000,0xd1c2,0xaeb7,0xd1b3,0xd1ca, +0xd1c1,0xd1c3,0xd1c7,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xd567,0x0000,0xb1b7, +0xb1cb,0xb1ca,0x0000,0xb1bf,0x0000,0xd579,0xd575,0xd572, +0xd5a6,0xb1ba,0xb1b2,0x0000,0x0000,0xd577,0xb4a8,0xb1b6, +0xd5a1,0x0000,0xb1cc,0xb1c9,0xd57b,0xd56a,0x0000,0x0000, +0xb1c8,0xd5a3,0xd569,0xb1bd,0xb1c1,0xd5a2,0x0000,0xd573, +0xb1c2,0xb1bc,0xd568,0x0000,0xb478,0xd5a5,0xd571,0xb1c7, +0xd574,0xd5a4,0xb1c6,0x0000,0xd952,0x0000,0xb1b3,0xd56f, +0xb1b8,0xb1c3,0x0000,0xb1be,0xd578,0xd56e,0xd56c,0xd57e, +0xb1b0,0xb1c4,0xb1b4,0xb477,0xd57c,0xb1b5,0x0000,0xb1b1, +0xb1c0,0xb1bb,0xb1b9,0xd570,0xb1c5,0xd56d,0xd57a,0xd576, +0xd954,0xd953,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xd56b,0xd964,0x0000, +0xb47a,0x0000,0xd96a,0xd959,0xd967,0xdd77,0xb47d,0xd96b, +0xd96e,0xb47c,0xd95c,0xd96d,0xd96c,0xb47e,0xd955,0xb479, +0xb4a3,0x0000,0xb4a1,0xd969,0x0000,0xd95f,0xb4a5,0xd970, +0xd968,0xd971,0xb4ad,0xb4ab,0xd966,0xd965,0x0000,0xd963, +0xd95d,0xb4a4,0x0000,0xb4a2,0xd1b9,0xd956,0x0000,0xddb7, +0xd957,0xb47b,0xb4aa,0xdd79,0x0000,0xb4a6,0xb4a7,0xd958, +0xd96f,0xdd78,0xd960,0xd95b,0xb4a9,0xd961,0xd95e,0x0000, +0x0000,0xb4ae,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +/* 0x6400 */ +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb770,0x0000, +0x0000,0xdd7c,0xddb1,0xddb6,0xddaa,0xb76c,0xddbb,0xb769, +0xdd7a,0x0000,0xdd7b,0xb762,0xb76b,0xdda4,0xb76e,0xb76f, +0xdda5,0x0000,0xddb2,0xddb8,0xb76a,0x0000,0xb764,0xdda3, +0xdd7d,0xddba,0xdda8,0xdda9,0xdd7e,0xddb4,0xddab,0xddb5, +0xddad,0x0000,0xb765,0xe1d9,0xb768,0xb766,0xddb9,0xddb0, +0xddac,0x0000,0x0000,0xdda1,0xba53,0xddaf,0xb76d,0xdda7, +0x0000,0xdda6,0x0000,0x0000,0x0000,0xb767,0xb763,0xe1ee, +0xddb3,0xddae,0x0000,0xdda2,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xe1e9,0x0000,0xe1da,0xe1e5,0x0000, +0xe1ec,0xba51,0xb4ac,0xe1ea,0xba4c,0x0000,0x0000,0x0000, +0xba4b,0xe1f1,0x0000,0xe1db,0xe1e8,0xe1dc,0xe1e7,0xba4f, +0xe1eb,0xd962,0x0000,0x0000,0x0000,0xe1f2,0xe1e3,0xba52, +0xe5ba,0xbcaf,0x0000,0xe1f0,0xe1ef,0xba54,0xe5ad,0xbcb0, +0xe5ae,0x0000,0xe1df,0xe1e0,0xe1dd,0xe1e2,0xe1de,0xe1f3, +0xba4e,0xbcb1,0xba50,0xba55,0x0000,0xe1e1,0x0000,0xe1ed, +0x0000,0x0000,0xe1e6,0x0000,0x0000,0xe5b1,0x0000,0xba4a, +0xbcb4,0xe9aa,0xe5b6,0xe5b5,0xe5b7,0x0000,0x0000,0xe5b4, +0xbcb5,0x0000,0xbcbb,0xbcb8,0x0000,0xbcb9,0xe5af,0xe5b2, +0xe5bc,0xbcc1,0xbcbf,0x0000,0xe5b3,0xd95a,0xbcb2,0xe5b9, +0xe5b0,0x0000,0xbcc2,0xe5b8,0xba4d,0xbcb7,0xe1e4,0x0000, +0x0000,0xbcba,0x0000,0xbcbe,0xbcc0,0xbcbd,0xbcbc,0x0000, +0xbcb6,0xe5bb,0xbcb3,0xbcc3,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xbed8,0xbed9,0xe9a9,0xbee2,0xbedf, +0x0000,0xbed6,0xbedd,0xe9ab,0xbedb,0xbed5,0x0000,0xbedc, +0x0000,0xe9a8,0xc0bb,0xbed7,0x0000,0xbede,0xc0ba,0xe9a7, +0xe9a6,0x0000,0xbee0,0x0000,0xbee1,0x0000,0xe9a5,0xe9a4, +0xc0bc,0xe9ae,0xbeda,0xe9ac,0x0000,0x0000,0x0000,0x0000, +0xc0bd,0x0000,0xc0c2,0xecea,0xecec,0x0000,0xc0bf,0x0000, +0xeced,0xece9,0x0000,0xeceb,0xc0c0,0xc0c3,0x0000,0xece8, +0xc0be,0xc0c1,0xc259,0xe9ad,0xc258,0x0000,0x0000,0xc25e, +0xefd4,0x0000,0xc25c,0xc25d,0xefd7,0xefd3,0xc25a,0xefd1, +0xc36b,0xefd5,0x0000,0xefd6,0xefd2,0x0000,0xc25b,0xf242, +0x0000,0xf245,0x0000,0x0000,0xf246,0xf244,0xf247,0xc36c, +0xf243,0x0000,0x0000,0xf44e,0xc464,0xf44d,0xf44c,0xf44b, +0xc463,0xc465,0x0000,0xf5cd,0xc4e2,0xc4e1,0x0000,0x0000, +0xf6e1,0xf6e0,0xf6e3,0xc5cb,0xc575,0xf7dd,0xf6e2,0x0000, +0x0000,0xf7dc,0xc5cd,0xc5cc,0xc5f3,0xf8a9,0xf8ef,0xa4e4, +0x0000,0x0000,0xd972,0xe9af,0x0000,0x0000,0xa6ac,0xcaf7, +0xa7f1,0xa7ef,0x0000,0xa7f0,0x0000,0xccc1,0xa9f1,0xac46, +0x0000,0xcee7,0x0000,0xcee8,0x0000,0xac47,0xd1ce,0x0000, +0xaec4,0xaec5,0xd1cd,0x0000,0x0000,0x0000,0x0000,0xb1d3, +0x0000,0xb1cf,0x0000,0xd5a7,0xb1d6,0xb1d5,0xb1ce,0xb1d1, +0xb1d4,0xb1d0,0x0000,0x0000,0xd976,0xb1cd,0xb4af,0x0000, +0x0000,0x0000,0xb4b1,0xb4b2,0xd975,0xd978,0xb4b0,0xd973, +0xd977,0x0000,0xd974,0x0000,0xb771,0x0000,0x0000,0xddbc, +0x0000,0x0000,0xba56,0xe1f4,0xbee3,0xbcc4,0xe5bd,0xbcc5, +0xbcc6,0xe5bf,0xe5be,0xe5c0,0xe9b1,0x0000,0x0000,0xe9b0, +0xecef,0xecee,0xc0c4,0xc0c5,0xf248,0x0000,0x0000,0xa4e5, +0x0000,0x0000,0x0000,0x0000,0xd979,0x0000,0x0000,0x0000, +0xb4b4,0xb4b3,0xddbd,0x0000,0xefd8,0xc4e3,0xf7de,0xa4e6, +0x0000,0xaec6,0x0000,0xb1d8,0xb1d7,0xd97a,0xd97b,0xb772, +0xe1f5,0xba57,0xe9b2,0x0000,0xa4e7,0xa5b8,0x0000,0xa9f2, +0xccc2,0x0000,0xcee9,0xac48,0xb1d9,0x0000,0xd97c,0xb4b5, +0xb773,0x0000,0xe5c1,0xe5c2,0x0000,0x0000,0xecf0,0xc25f, +0xf8f0,0xa4e8,0x0000,0xccc3,0xa9f3,0xac49,0x0000,0xceea, +0x0000,0xaec7,0xd1d2,0xd1d0,0xd1d1,0xaec8,0xd1cf,0x0000, +0x0000,0x0000,0x0000,0xb1db,0xb1dc,0xd5a8,0xb1dd,0xb1da, +0xd97d,0x0000,0xd97e,0xddbe,0x0000,0x0000,0xba59,0xba58, +0x0000,0x0000,0xecf1,0xefd9,0x0000,0xf24a,0xf249,0xf44f, +0x0000,0xc95e,0xac4a,0x0000,0x0000,0xa4e9,0xa5b9,0x0000, +0xa6ae,0xa6ad,0x0000,0x0000,0xa6af,0xa6b0,0xc9ee,0xc9ed, +0xcaf8,0xa7f2,0xcafb,0xcafa,0xcaf9,0xcafc,0x0000,0x0000, +0x0000,0x0000,0xa9f4,0xccc9,0xccc5,0xccce,0x0000,0x0000, +0xa9fb,0x0000,0xa9f9,0xccca,0xccc6,0xcccd,0xa9f8,0xaa40, +0xccc8,0xccc4,0xa9fe,0xcccb,0xa9f7,0xcccc,0xa9fa,0xa9fc, +0xccd0,0xcccf,0xccc7,0xa9f6,0xa9f5,0xa9fd,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xceef,0xcef5,0x0000,0xac50, +0xac4d,0xceec,0xcef1,0x0000,0xac53,0xac4b,0xcef0,0xac4e, +0xac51,0x0000,0x0000,0xcef3,0x0000,0xac4c,0xcef8,0xac4f, +0x0000,0xac52,0xceed,0xcef2,0xcef6,0xceee,0xceeb,0x0000, +0x0000,0xcef7,0xcef4,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xaed0,0xaec9,0xaecc,0x0000,0xaecf,0x0000,0xd1d5, +0x0000,0xaeca,0xd1d3,0x0000,0xaece,0x0000,0x0000,0xaecb, +0x0000,0xd1d6,0xaecd,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xd5ac,0xb1df,0xd5ab,0xd5ad,0xb1de,0xb1e3,0xd1d4, +0x0000,0xd5aa,0xd5ae,0x0000,0xb1e0,0xd5a9,0xb1e2,0x0000, +0xb1e1,0x0000,0xd9a7,0x0000,0xd9a2,0x0000,0xb4b6,0xb4ba, +0xb4b7,0xd9a5,0xd9a8,0x0000,0xb4b8,0x0000,0xb4b9,0xb4be, +0xddc7,0xd9a6,0xb4bc,0xd9a3,0xd9a1,0x0000,0xb4bd,0x0000, +0xd9a4,0x0000,0x0000,0x0000,0xb779,0x0000,0xddbf,0xb776, +0xb777,0xb775,0xddc4,0xddc3,0xddc0,0xb77b,0x0000,0x0000, +0xddc2,0xb4bb,0x0000,0x0000,0xddc6,0xddc1,0xb778,0xb774, +0xb77a,0xddc5,0x0000,0x0000,0x0000,0xba5c,0x0000,0xe1f8, +0xe1f7,0xe1f6,0xba5a,0x0000,0x0000,0x0000,0x0000,0x0000, +0xba5b,0xe5c5,0xe5c8,0xbcc8,0x0000,0x0000,0xbcc7,0xe5c9, +0xe5c4,0xbcca,0xe5c6,0x0000,0xbcc9,0xe5c3,0x0000,0xe5c7, +0xbee9,0xbee6,0xe9bb,0xe9ba,0x0000,0xe9b9,0xe9b4,0x0000, +0xe9b5,0x0000,0x0000,0x0000,0xbee7,0x0000,0xbee4,0xbee8, +0xe9b3,0xbee5,0xe9b6,0xe9b7,0xe9bc,0x0000,0x0000,0xe9b8, +0x0000,0x0000,0xecf2,0x0000,0x0000,0x0000,0xc0c7,0x0000, +0xefdc,0xc0c6,0xefda,0xefdb,0xc260,0xc36e,0xf24b,0x0000, +0xc36d,0x0000,0x0000,0xf451,0xf452,0x0000,0xc466,0x0000, +0xf450,0xc4e4,0x0000,0xf7df,0xc5ce,0xf8aa,0xf8ab,0x0000, +0xa4ea,0x0000,0xa6b1,0xa6b2,0xa7f3,0x0000,0xccd1,0xac54, +0xaed1,0xb1e4,0x0000,0x0000,0xb0d2,0x0000,0xb4bf,0xb4c0, +0xb3cc,0xd9a9,0x0000,0xb77c,0xe1fa,0xe1f9,0x0000,0x0000, +0xa4eb,0xa6b3,0xccd2,0xaa42,0x0000,0xaa41,0x0000,0xcef9, +0xcefa,0x0000,0xd1d7,0xd1d8,0xaed2,0xaed3,0x0000,0xaed4, +0xd5af,0x0000,0x0000,0xb1e6,0x0000,0xb4c2,0x0000,0xb4c1, +0xddc8,0xdf7a,0xe1fb,0xe9bd,0x0000,0x0000,0xc261,0xc467, +0xa4ec,0x0000,0xa5bc,0xa5bd,0xa5bb,0xa5be,0xa5ba,0x0000, +0x0000,0xa6b6,0x0000,0xc9f6,0xa6b5,0xa6b7,0x0000,0x0000, +0xc9f1,0xc9f0,0xc9f3,0xc9f2,0xc9f5,0xa6b4,0xc9ef,0xc9f4, +0x0000,0x0000,0x0000,0x0000,0x0000,0xcafd,0xa7fd,0xcafe, +0xcb43,0xa7fc,0x0000,0xcb47,0xcb42,0xcb45,0xa7f5,0xa7f6, +0xa7f7,0xa7f8,0x0000,0xa840,0x0000,0xcb41,0xa7fa,0xa841, +0x0000,0xcb40,0xcb46,0x0000,0xa7f9,0xcb44,0xa7fb,0xa7f4, +0xa7fe,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xaa57,0x0000,0xccd4,0xaa43,0x0000,0xaa4d, +0xaa4e,0xaa46,0xaa58,0xaa48,0xccdc,0xaa53,0xccd7,0xaa49, +0xcce6,0xcce7,0xccdf,0xccd8,0xaa56,0xcce4,0xaa51,0xaa4f, +0x0000,0xcce5,0x0000,0xcce3,0xccdb,0xccd3,0xccda,0xaa4a, +0x0000,0xaa50,0x0000,0xaa44,0xccde,0xccdd,0xccd5,0x0000, +0xaa52,0xcce1,0xccd6,0xaa55,0xcce8,0xaa45,0x0000,0xaa4c, +0xccd9,0xcce2,0xaa54,0x0000,0xaa47,0xaa4b,0x0000,0xcce0, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcf5b,0xac5c, +0xac69,0x0000,0xcf56,0xcf4c,0xac62,0xcf4a,0xac5b,0xcf45, +0xac65,0xcf52,0xcefe,0xcf41,0x0000,0x0000,0x0000,0x0000, +0xcf44,0xcefb,0xcf51,0xcf61,0xac60,0xcf46,0xcf58,0x0000, +0xcefd,0xcf5f,0xcf60,0xcf63,0xcf5a,0xcf4b,0xcf53,0xac66, +0xac59,0xac61,0xac6d,0xac56,0xac58,0x0000,0x0000,0x0000, +0xcf43,0xac6a,0xac63,0xcf5d,0xcf40,0xac6c,0xac67,0xcf49, +0x0000,0x0000,0xac6b,0xcf50,0xcf48,0xac64,0xcf5c,0xcf54, +0x0000,0xac5e,0xcf62,0xcf47,0xac5a,0xcf59,0xcf4f,0xac5f, +0xcf55,0xac57,0xcefc,0xac68,0xaee3,0xac5d,0xcf4e,0xcf4d, +0xcf42,0x0000,0xcf5e,0x0000,0xcf57,0x0000,0x0000,0xac55, +/* 0x6800 */ +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xd1ec,0xaeea,0xd1ed,0x0000,0xd1e1,0xaedf, +0xaeeb,0x0000,0xd1da,0x0000,0xd1e3,0xd1eb,0x0000,0xd1d9, +0xd1f4,0xaed5,0x0000,0x0000,0x0000,0xd1f3,0xd1ee,0x0000, +0xd1ef,0xaedd,0xaee8,0xd1e5,0x0000,0xd1e6,0xd1f0,0xd1e7, +0x0000,0xd1e2,0xd1dc,0xd1dd,0xd1ea,0xd1e4,0x0000,0x0000, +0xaed6,0xaeda,0xd1f2,0xd1de,0xaee6,0xaee2,0x0000,0x0000, +0xaee5,0xaeec,0xaedb,0xaee7,0xd1e9,0xaee9,0xaed8,0x0000, +0xaed7,0xd1db,0x0000,0xd1df,0xaee0,0xd1f1,0xd1e8,0xd1e0, +0xaee4,0xaee1,0x0000,0xaed9,0xaedc,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xd5c4,0x0000,0xd5b4,0xd5b5,0xd5b9, +0x0000,0xd5c8,0xd5c5,0x0000,0xd5be,0xd5bd,0xb1ed,0xd5c1, +0xd5d0,0xd5b0,0x0000,0xd5d1,0xd5c3,0xd5d5,0xd5c9,0xb1ec, +0xd5c7,0xb1e7,0xb1fc,0xb1f2,0x0000,0xb1f6,0xb1f5,0xd5b1, +0x0000,0xd5ce,0xd5d4,0xd5cc,0xd5d3,0x0000,0x0000,0xd5c0, +0xd5b2,0xd5d2,0xd5c2,0xb1ea,0xb1f7,0x0000,0xd5cb,0xb1f0, +0x0000,0x0000,0x0000,0xd5ca,0xd5b3,0xb1f8,0x0000,0xb1fa, +0xd5cd,0xb1fb,0xb1e9,0xd5ba,0xd5cf,0x0000,0x0000,0xb1ef, +0xb1f9,0xd5bc,0xd5c6,0xd5b7,0xd5bb,0xb1f4,0xd5b6,0xb1e8, +0xb1f1,0xb1ee,0xd5bf,0xaede,0xd9c0,0xb1eb,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xb1f3,0x0000,0xd9c3,0xd9d9, +0xd9ce,0xb4d6,0x0000,0xb4d1,0xd9bd,0xb4d2,0xd9cd,0x0000, +0xd9c6,0xd9d3,0xb4ce,0xd9ab,0xd9d5,0xb4c4,0xd9b3,0xb4c7, +0xb4c6,0x0000,0xb4d7,0x0000,0xd9ad,0xd9cf,0xd9d0,0xb4c9, +0xb4c5,0xd9bb,0x0000,0xb4d0,0xd9b6,0x0000,0xd9d1,0xb4cc, +0xd9c9,0xd9d6,0xd9b0,0xd9b5,0xd9af,0x0000,0xb4cb,0xd9c2, +0xddde,0xd9b1,0xb4cf,0xd9ba,0xd9d2,0xb4ca,0xd9b7,0xd9b4, +0xd9c5,0xb4cd,0xb4c3,0xb4d9,0xd9c8,0xd9c7,0x0000,0x0000, +/* 0x6900 */ +0x0000,0x0000,0x0000,0x0000,0xd9ac,0xb4c8,0xd9d4,0xd9bc, +0xd9be,0x0000,0xd9cb,0xd9ca,0xd9aa,0xb4d3,0xb4d5,0xd9b2, +0xd9b9,0xd9c1,0xb4d4,0xd9b8,0xd9c4,0xd9d7,0x0000,0xd9cc, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xd9d8,0x0000,0x0000, +0x0000,0x0000,0xd9ae,0x0000,0x0000,0x0000,0x0000,0xddf2, +0xb7a6,0x0000,0xddf0,0xdddb,0xdde0,0xddd9,0x0000,0xddec, +0xddcb,0xddd2,0x0000,0xddea,0xddf4,0xdddc,0x0000,0xddcf, +0xdde2,0xdde7,0xddd3,0x0000,0xdde4,0xddd0,0x0000,0x0000, +0xddd7,0xddd8,0xb7a8,0xddeb,0xdde9,0x0000,0xddcc,0xddee, +0x0000,0xddef,0xddf1,0xb7ac,0xb7a4,0x0000,0xd5b8,0xddd4, +0xdde6,0xddd5,0xb7a1,0xb7b1,0xdded,0xb7af,0xb7ab,0xddca, +0xb7a3,0x0000,0xddcd,0xb7b0,0x0000,0xdddd,0xddc9,0x0000, +0xb7a9,0xdde1,0xddd1,0xb7aa,0xddda,0xb77e,0xb4d8,0xdde3, +0xd9bf,0xddce,0x0000,0x0000,0xdde8,0xb7a5,0xdde5,0xb7a2, +0xdddf,0xb7ad,0xddd6,0xddf3,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xb7a7,0xdec6,0x0000,0x0000,0xb7ae,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xe24a,0xe248,0x0000, +0xe25e,0xe246,0x0000,0xe258,0xb77d,0xba5f,0xe242,0xe25d, +0x0000,0xe247,0xe255,0xba64,0xba5d,0x0000,0xe25b,0x0000, +0xe240,0xe25a,0x0000,0xba6f,0xe251,0xe261,0xba6d,0xe249, +0xba5e,0xe24b,0xe259,0xba67,0xe244,0xba6b,0xba61,0xe24d, +0xe243,0xe1fc,0x0000,0xe257,0xba68,0xe260,0xe1fd,0xba65, +0x0000,0xe253,0x0000,0xba66,0xe245,0xe250,0xe24c,0xe24e, +0x0000,0xba60,0xe25f,0xba6e,0xe24f,0x0000,0xe262,0x0000, +0x0000,0xe1fe,0xe254,0xba63,0xba6c,0xba6a,0xe241,0xe256, +0xba69,0x0000,0x0000,0xba62,0xe252,0x0000,0x0000,0x0000, +0x0000,0xe25c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xe5d5,0x0000,0xe5d1,0xe5cd,0xe5e1,0xe5de, +0xbccd,0x0000,0x0000,0xe5e5,0xe5d4,0xbcd8,0xe5db,0x0000, +0x0000,0xe5d0,0xe5da,0xbcd5,0xe5ee,0x0000,0xe5eb,0xe5dd, +0xe5ce,0x0000,0x0000,0xe5e2,0xe5e4,0xbcd1,0xe5d8,0xe5d3, +0xe5ca,0xbcce,0xbcd6,0x0000,0xe5e7,0xbcd7,0xe5cb,0xe5ed, +0xe5e0,0xe5e6,0xbcd4,0x0000,0x0000,0xe5e3,0x0000,0xe5ea, +0x0000,0xbcd9,0x0000,0xbcd3,0xe5dc,0xe5cf,0xe5ef,0xe5cc, +0xe5e8,0xbcd0,0x0000,0xe5d6,0x0000,0xe5d7,0xbccf,0xbccc, +0xe5d2,0xbcd2,0x0000,0xbccb,0x0000,0xe5e9,0xe5ec,0xe5d9, +0xe9ca,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xe9c2,0x0000,0xe9be,0xbef6,0x0000,0x0000, +0xbeeb,0xbef0,0xbeec,0xe9cc,0xe9d7,0xbeea,0xe9c4,0xe9cd, +0xe5df,0xe9ce,0x0000,0x0000,0xbef1,0x0000,0xe9dd,0xbef5, +0xbef8,0xe9c0,0x0000,0xbef4,0x0000,0xe9db,0xe9dc,0xe9d2, +0xe9d1,0xe9c9,0x0000,0x0000,0xe9d3,0xe9da,0xe9d9,0x0000, +0xbeef,0xbeed,0xe9cb,0xe9c8,0x0000,0xe9c5,0xe9d8,0xbef7, +0xe9d6,0xbef3,0xbef2,0x0000,0xe9d0,0x0000,0xe9bf,0xe9c1, +0xe9c3,0xe9d5,0xe9cf,0xbeee,0x0000,0xe9c6,0x0000,0xe9d4, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe9c7,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc0cf,0xed45, +0xc0c8,0xecf5,0x0000,0xed41,0xc0ca,0xed48,0x0000,0xecfc, +0x0000,0xecf7,0x0000,0x0000,0xed49,0xecf3,0xecfe,0x0000, +0xc0d1,0xed44,0xed4a,0xecfd,0xc0c9,0xed40,0xecf4,0xc0d0, +0x0000,0x0000,0xed47,0xecf9,0xc0cc,0x0000,0xecfb,0xecf8, +0xc0d2,0xecfa,0xc0cb,0xc0ce,0xed43,0xecf6,0xed46,0x0000, +0xed42,0x0000,0x0000,0x0000,0xc263,0xefe7,0xc268,0xc269, +0x0000,0x0000,0x0000,0xc262,0xefe6,0x0000,0xefe3,0xefe4, +0xc266,0xefde,0xefe2,0xc265,0x0000,0xefdf,0x0000,0x0000, +0x0000,0x0000,0xc267,0xc264,0x0000,0xefdd,0xefe1,0xefe5, +0x0000,0x0000,0x0000,0xf251,0xf24e,0xf257,0x0000,0xf256, +0xf254,0xf24f,0x0000,0xc372,0x0000,0x0000,0x0000,0x0000, +0x0000,0xf250,0xc371,0xc0cd,0xf253,0xc370,0xf258,0xf252, +0xf24d,0xefe0,0x0000,0x0000,0x0000,0xc36f,0x0000,0xf24c, +0xf456,0x0000,0xf455,0xf255,0xc468,0x0000,0xf459,0xf45a, +0xf454,0xf458,0x0000,0xf453,0x0000,0x0000,0x0000,0x0000, +0xf5d1,0xf457,0xc4e7,0xc4e5,0xf5cf,0x0000,0x0000,0x0000, +0xf5d2,0x0000,0xf5ce,0xf5d0,0xc4e6,0x0000,0x0000,0x0000, +0xf6e5,0xf6e6,0xc576,0xf6e4,0x0000,0x0000,0x0000,0xf7e2, +0xc5cf,0xf7e0,0xf7e1,0xf8ac,0x0000,0x0000,0xc656,0xf8f3, +0xf8f1,0xf8f2,0xf8f4,0x0000,0x0000,0x0000,0xf9bb,0x0000, +0xa4ed,0xa6b8,0x0000,0xaa59,0x0000,0xcce9,0x0000,0x0000, +0xcf64,0x0000,0x0000,0x0000,0xd1f5,0xd1f7,0x0000,0xd1f6, +0x0000,0xd1f8,0xb1fd,0xd5d7,0xd1f9,0x0000,0xd5d6,0xd5d8, +0xd5d9,0xd9da,0xb4db,0xd9db,0xd9dd,0xb4dc,0xb4da,0xd9dc, +0x0000,0xddfa,0xddf8,0xddf7,0x0000,0xddf6,0xddf5,0xb7b2, +0xddf9,0xba70,0xe263,0xe265,0xba71,0xe264,0xbcdb,0x0000, +0xbcda,0xe5f0,0x0000,0x0000,0xe9df,0xe9de,0xe9e0,0x0000, +0x0000,0xbef9,0x0000,0xed4b,0xc0d3,0x0000,0xefe8,0xc26a, +0xf259,0xc577,0xa4ee,0xa5bf,0xa6b9,0xa842,0xaa5a,0xaa5b, +0x0000,0x0000,0xac6e,0x0000,0x0000,0xd1fa,0x0000,0x0000, +0x0000,0x0000,0xb7b3,0x0000,0x0000,0x0000,0xe6d1,0xbefa, +0xc26b,0xa4ef,0x0000,0xa6ba,0x0000,0x0000,0xcceb,0xaa5c, +0xccea,0x0000,0xcf65,0xac6f,0xcf66,0x0000,0xac70,0x0000, +0xd1fc,0xaeee,0xaeed,0x0000,0xd5de,0xd5dc,0xd5dd,0xd5db, +0x0000,0xd5da,0x0000,0x0000,0xd9de,0xd9e1,0xb4de,0xd9df, +0xb4dd,0xd9e0,0x0000,0xddfb,0x0000,0x0000,0xe266,0xe267, +0xe268,0x0000,0xe5f3,0xe5f2,0xbcdc,0xe5f1,0xe5f4,0xe9e1, +0x0000,0x0000,0xe9e2,0xe9e3,0x0000,0xed4c,0xc0d4,0xc26c, +0xf25a,0x0000,0xc4e8,0xc95f,0x0000,0xac71,0xcf67,0xaeef, +0x0000,0x0000,0xb1fe,0x0000,0xb4df,0xd9e2,0x0000,0xb7b5, +0xb7b4,0x0000,0x0000,0xe269,0xe26a,0xbcdd,0xbcde,0xe9e5, +0xe9e4,0xefe9,0xf7e3,0xa4f0,0xc960,0xa5c0,0x0000,0xa843, +0xcb48,0x0000,0xac72,0xb7b6,0xa4f1,0x0000,0xcf68,0xac73, +0xcf69,0x0000,0xc0d5,0xa4f2,0x0000,0x0000,0xccec,0x0000, +0xcf6a,0x0000,0xd242,0xd241,0xd1fe,0x0000,0xd1fd,0xd243, +0xd240,0x0000,0x0000,0xb240,0xb241,0x0000,0x0000,0xb4e0, +0xd9e3,0x0000,0xd9e4,0xd9e5,0x0000,0x0000,0x0000,0xde41, +0xde42,0xde40,0x0000,0xddfd,0xddfe,0xb7b7,0xe26b,0xe5f7, +0xe5f6,0xe5f5,0xe5f8,0xe9e7,0xe9e6,0xbefb,0xe9e8,0x0000, +0xc0d6,0xed4d,0x0000,0xefea,0xf25b,0xf6e7,0x0000,0xa4f3, +0xa5c2,0xa5c1,0x0000,0xaa5d,0xc961,0xc97e,0xa6bb,0x0000, +0xc9f7,0xcb49,0xcb4a,0xaa5e,0x0000,0xcced,0x0000,0xac74, +0xcf6b,0xcf6c,0x0000,0xaef0,0xaef4,0xd244,0xaef3,0xaef1, +0xaef2,0x0000,0xd5df,0xb242,0xb4e3,0x0000,0xb4e1,0xb4e2, +0xd9e6,0x0000,0x0000,0xba72,0xa4f4,0x0000,0xc9a1,0x0000, +0xa5c3,0x0000,0x0000,0xc9a4,0x0000,0x0000,0xa5c6,0xc9a3, +0xa5c5,0xa5c4,0xa844,0xc9a2,0x0000,0x0000,0xc9f8,0x0000, +0x0000,0x0000,0xc9fc,0xc9fe,0xca40,0xa6c5,0xa6c6,0xc9fb, +0xa6c1,0x0000,0xc9f9,0x0000,0xc9fd,0xa6c2,0x0000,0xa6bd, +0x0000,0xa6be,0x0000,0xa6c4,0xc9fa,0xa6bc,0xa845,0xa6bf, +0xa6c0,0xa6c3,0x0000,0x0000,0x0000,0xcb5b,0xcb59,0xcb4c, +0xa851,0xcb53,0xa84c,0xcb4d,0x0000,0xcb55,0x0000,0xcb52, +0xa84f,0xcb51,0xa856,0xcb5a,0xa858,0x0000,0xa85a,0x0000, +0xcb4b,0x0000,0xa84d,0xcb5c,0x0000,0xa854,0xa857,0x0000, +0xcd45,0xa847,0xa85e,0xa855,0xcb4e,0xa84a,0xa859,0xcb56, +0xa848,0xa849,0xcd43,0xcb4f,0xa850,0xa85b,0xcb5d,0xcb50, +0xa84e,0x0000,0xa853,0xccee,0xa85c,0xcb57,0xa852,0x0000, +0xa85d,0xa846,0xcb54,0xa84b,0xcb58,0xcd44,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xaa6a,0xaa7a,0xccf5,0xaa71,0x0000, +0xcd4b,0xaa62,0x0000,0xaa65,0xcd42,0x0000,0xccf3,0xccf7, +0xaa6d,0xaa6f,0xccfa,0xaa76,0xaa68,0xaa66,0xaa67,0xaa75, +0xcd47,0xaa70,0xccf9,0xccfb,0xaa6e,0xaa73,0xccfc,0xcd4a, +0x0000,0xac75,0xaa79,0x0000,0xaa63,0xcd49,0x0000,0xcd4d, +0xccf8,0xcd4f,0xcd40,0xaa6c,0xccf4,0xaa6b,0xaa7d,0xaa72, +0x0000,0xccf2,0xcf75,0xaa78,0xaa7c,0xcd41,0xcd46,0x0000, +0xaa7e,0xaa77,0xaa69,0xaa5f,0x0000,0xaa64,0x0000,0xccf6, +0xaa60,0xcd4e,0x0000,0xccf0,0xccef,0xccfd,0xccf1,0xaa7b, +0xaef5,0xaa74,0xccfe,0xaa61,0x0000,0xaca6,0x0000,0x0000, +0x0000,0xcd4c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xcf7c,0xcfa1,0x0000,0xcfa4,0xcf77,0x0000,0x0000,0xcfa7, +0xcfaa,0xcfac,0xcf74,0xac76,0xac7b,0xd249,0xacad,0xcfa5, +0xcfad,0xcf7b,0xcf73,0x0000,0x0000,0x0000,0xd264,0xac7e, +0xcfa2,0xcf78,0xcf7a,0xaca5,0x0000,0xcf7d,0xac7d,0xcf70, +0xcfa8,0x0000,0xcfab,0x0000,0x0000,0xac7a,0x0000,0xaca8, +0xcf6d,0xacaa,0xac78,0xacae,0xcfa9,0xcf6f,0xacab,0xd25e, +0xcd48,0xac7c,0xac77,0xcf76,0xcf6e,0xacac,0xaca4,0xcfa3, +0xaca9,0xaca7,0xcf79,0xaca1,0xcf71,0xaca2,0xaca3,0xcf72, +0xcfa6,0xac79,0xcf7e,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xd24c,0xaefd,0xaf43,0x0000,0x0000,0x0000,0xd255,0xd25b, +0xd257,0xd24a,0xd24d,0xd246,0xd247,0xaf4a,0xaefa,0xd256, +0xd25f,0xaf45,0xaef6,0x0000,0xaf40,0xd24e,0xaf42,0xd24f, +0xd259,0x0000,0x0000,0x0000,0xaf44,0xd268,0xd248,0xaefc, +0xaefb,0xaf48,0xd245,0xd266,0xd25a,0xd267,0xd261,0xd253, +0xd262,0x0000,0xd25c,0xd265,0xd263,0xaf49,0xd254,0xaef9, +0xaef8,0xaf41,0xaf47,0xd260,0xaf46,0xd251,0xb243,0x0000, +0xd269,0xd250,0xd24b,0xaefe,0xaf4b,0xaef7,0x0000,0xd258, +0xd25d,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xb265,0xd5e1,0xd5e5,0x0000,0xb252,0xb250, +0x0000,0x0000,0xb247,0xd5e3,0xd5e2,0xb25b,0x0000,0xd5e8, +0xb255,0x0000,0xd5fa,0xd647,0xb244,0xd5f7,0xd5f0,0xb267, +0xd5e0,0x0000,0xd5fc,0x0000,0xb264,0xb258,0xb263,0xb24e, +0xd5ec,0xd5fe,0xd5f6,0xb24f,0xb249,0xd645,0x0000,0xd5fd, +0xd640,0xb251,0xb259,0xd642,0xd5ea,0xd5fb,0xd5ef,0xd644, +0xb25e,0xb246,0xb25c,0xd5f4,0xd5f2,0xd5f3,0xb253,0xd5ee, +0xd5ed,0xb248,0xd5e7,0xd646,0xb24a,0xd5f1,0xb268,0x0000, +0xb262,0xd5e6,0xb25f,0xb25d,0xb266,0xd5f8,0xb261,0xd252, +0xd5f9,0xb260,0xd641,0xb245,0xd5f5,0xb257,0xd5e9,0xb256, +0x0000,0xb254,0xb24c,0xb24b,0xd9e7,0xd643,0x0000,0x0000, +0xd5eb,0x0000,0x0000,0xd9fc,0x0000,0xb24d,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xb541,0xb25a,0xb4ee,0xd9f6,0xb4fc,0x0000,0xd9ea, +0xb4eb,0xb4e7,0xda49,0xb4ed,0xb4f1,0xb4ec,0xb4f5,0xda4d, +0xda44,0x0000,0x0000,0xd9f1,0xb4fa,0xb4f4,0xd9fd,0xb4e4, +0xda4a,0xda43,0xb4e8,0xd9f7,0xb4f7,0xda55,0xda56,0x0000, +0xb4e5,0xda48,0xb4f9,0xd9fb,0xd9ed,0xd9ee,0xb4fd,0xd9f2, +0xd9f9,0xd9f3,0x0000,0xb4fb,0xb544,0xd9ef,0xd9e8,0xd9e9, +0x0000,0xd9eb,0xb4ea,0xd9f8,0x0000,0xb4f8,0xb542,0x0000, +0x0000,0xd9fa,0xda53,0xda4b,0xb4e6,0xda51,0xb4f2,0x0000, +0xb4f0,0x0000,0xda57,0xb4ef,0xda41,0xd9f4,0xd9fe,0xb547, +0xda45,0xda42,0xd9f0,0xb543,0xda4f,0xda4c,0xda54,0xb4e9, +0xda40,0xb546,0x0000,0xda47,0x0000,0x0000,0xb4f3,0xb4f6, +0x0000,0xda46,0xb545,0xd9f5,0xd5e4,0x0000,0x0000,0xda50, +0xda4e,0xda52,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xd9ec,0xb540,0x0000,0x0000,0x0000,0xde61,0xde60,0xde46, +0xb7bd,0x0000,0xde5f,0xde49,0xde4a,0x0000,0xb7c7,0xde68, +0xb7c2,0xde5e,0x0000,0xde43,0xb7c8,0xb7be,0xde52,0xde48, +0xde4b,0xde63,0xb7b8,0xde6a,0xde62,0xb7c1,0xde57,0xb7cc, +0x0000,0x0000,0xb7cb,0xb7c5,0x0000,0x0000,0xde69,0xb7b9, +0xde55,0xde4c,0xde59,0xde65,0xb7cd,0x0000,0xb7bb,0xde54, +0x0000,0xde4d,0xb7c4,0x0000,0xb7c3,0xde50,0xde5a,0xde64, +0xde47,0xde51,0xb7bc,0xde5b,0xb7c9,0xb7c0,0xde4e,0xb7bf, +0xde45,0xde53,0xde67,0xb4fe,0xbab0,0xde56,0xe26c,0xde58, +0xde66,0xb7c6,0xde4f,0xb7ba,0xb7ca,0xbcf0,0xde44,0x0000, +0xde5d,0x0000,0x0000,0x0000,0xde5c,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xe2aa,0xbaad,0xe27d,0xe2a4,0xbaa2, +0x0000,0xe26e,0xbaaf,0x0000,0xba77,0xe26d,0xe2b0,0xbab1, +0xe271,0xe2a3,0x0000,0xe273,0xe2b3,0xe2af,0xba75,0xbaa1, +0xe653,0xbaae,0xba7d,0xe26f,0x0000,0xe2ae,0xbaa3,0xe2ab, +0xe2b8,0xe275,0xe27e,0x0000,0x0000,0xe2b6,0xe2ac,0xba7c, +0x0000,0x0000,0xe27c,0xba76,0xba74,0xbaa8,0x0000,0x0000, +0xe27a,0xe277,0xe278,0x0000,0xe2b2,0x0000,0xe2b7,0xe2b5, +0xba7a,0xe2b9,0xba7e,0xbaa7,0x0000,0xe270,0xe5fa,0xe279, +0x0000,0xba78,0xbaac,0xbaa9,0xba7b,0xe2a5,0xe274,0xbaaa, +0xe2a7,0xbaa4,0xbaa6,0xba73,0x0000,0xe2a9,0xe2a1,0xe272, +0xbaa5,0xe2b1,0xe2b4,0xe27b,0xe2a8,0x0000,0xba79,0xbcdf, +0xe2a6,0xe5f9,0x0000,0xe2ad,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe276,0xe644, +0xe64e,0xbce2,0xe64d,0xe659,0xbce4,0xe64b,0x0000,0xe64f, +0xbcef,0x0000,0xe646,0xbce7,0x0000,0xe652,0xe9f0,0xbcf3, +0xbcf2,0xe654,0xe643,0xe65e,0xbced,0x0000,0xbce3,0xe657, +0x0000,0xe65b,0xe660,0xe655,0xe649,0xbce6,0xbce9,0xbcf1, +0xbcec,0x0000,0xe64c,0xe2a2,0x0000,0x0000,0xe648,0xe65f, +0xbce8,0x0000,0xbceb,0xe661,0xbce0,0xe656,0xe5fb,0xe65c, +0xc0df,0x0000,0xe64a,0x0000,0xbce1,0xe645,0xbce5,0xe5fc, +0xbaab,0xe641,0x0000,0xe65a,0xe642,0xe640,0xbcea,0x0000, +0xe658,0x0000,0xe5fe,0xe651,0xe650,0xe65d,0xe647,0xbcee, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe9f3,0x0000, +0xbf49,0xbefe,0xea40,0xe9eb,0xbf41,0xe9f7,0xbf48,0xbf43, +0xe9f5,0xed4f,0xe9fb,0xea42,0xe9fa,0xe9e9,0xe9f8,0xea44, +0xea46,0xbefd,0xea45,0xbf44,0xbf4a,0x0000,0xbf47,0x0000, +0xe9fe,0xbf46,0xe9f9,0x0000,0xe9ed,0xe9f2,0x0000,0xe9fd, +0xbf45,0xbf42,0xbefc,0xbf40,0xe9f1,0x0000,0xe5fd,0xe9ec, +0xe9ef,0xea41,0xe9f4,0xe9ea,0xed4e,0xea43,0xe9ee,0xe9fc, +0x0000,0x0000,0x0000,0x0000,0xed51,0xc0e3,0x0000,0x0000, +0xc0d7,0x0000,0x0000,0xc0db,0xed53,0xed59,0xed57,0xc0d9, +0xc0da,0xc0e1,0xed5a,0xed52,0xc0dc,0x0000,0xed56,0xed55, +0xed5b,0xc0e2,0x0000,0xc0dd,0xc0e0,0xed54,0xc0e4,0xc0de, +0xc0e5,0xc0d8,0xed58,0x0000,0xed50,0x0000,0x0000,0xeff7, +0x0000,0x0000,0xc271,0xeff4,0xeff6,0x0000,0xc26f,0xeff2, +0xeff3,0xefee,0x0000,0x0000,0xe9f6,0xefef,0xc270,0xefeb, +0x0000,0xc26d,0xeff8,0xc26e,0xefec,0xefed,0xeff1,0xc273, +0x0000,0xc272,0x0000,0x0000,0xeff0,0xc378,0xf25f,0xf265, +0xc379,0xf25c,0xc376,0xc373,0xf267,0xc377,0x0000,0xc374, +0xf25e,0xf261,0xf262,0xf263,0xf266,0x0000,0xeff5,0xf25d, +0xc375,0xf264,0xf268,0xf260,0x0000,0x0000,0x0000,0xf45d, +0xc46a,0xf460,0xc46b,0xf468,0xf45f,0xf45c,0x0000,0xf45e, +0xf462,0xf465,0xf464,0xf467,0xf45b,0x0000,0xc469,0xf463, +0xf466,0xf469,0xf461,0xf5d3,0xf5d4,0xf5d8,0xf5d9,0x0000, +0xf5d6,0xf5d7,0xf5d5,0x0000,0xc4e9,0x0000,0x0000,0x0000, +0x0000,0xc578,0xf6eb,0x0000,0x0000,0xf6e8,0xf6e9,0xf6ea, +0xc579,0x0000,0xf7e5,0xf7e4,0x0000,0xf8af,0xc5f4,0xf8ad, +0xf8b0,0xf8ae,0xf8f5,0xc657,0xc665,0xf9a3,0xf96c,0x0000, +0xf9a2,0xf9d0,0xf9d1,0xa4f5,0x0000,0x0000,0x0000,0x0000, +0xa6c7,0xca41,0x0000,0x0000,0xcb5e,0x0000,0xa85f,0x0000, +0xa862,0x0000,0xcb5f,0x0000,0xa860,0xa861,0x0000,0x0000, +0x0000,0x0000,0xcd58,0xcd5a,0xcd55,0xcd52,0xcd54,0x0000, +0x0000,0x0000,0xaaa4,0x0000,0x0000,0x0000,0xaaa2,0x0000, +0x0000,0xcd56,0xaaa3,0xcd53,0xcd50,0xaaa1,0xcd57,0x0000, +0xcd51,0xaaa5,0xcd59,0x0000,0x0000,0x0000,0x0000,0xcfaf, +0x0000,0xcfb3,0x0000,0x0000,0xacb7,0x0000,0x0000,0x0000, +0x0000,0xcfb6,0x0000,0xacaf,0xacb2,0xacb4,0xacb6,0xacb3, +0xcfb2,0xcfb1,0x0000,0xacb1,0xcfb4,0xcfb5,0x0000,0xcfae, +0xacb5,0x0000,0xacb0,0x0000,0x0000,0x0000,0xcfb0,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xd277,0xd278,0xd279, +0xaf50,0x0000,0xaf4c,0xd26e,0x0000,0xd276,0xd27b,0xaf51, +0x0000,0xd26c,0xd272,0xd26b,0xd275,0x0000,0x0000,0xd271, +0xaf4d,0xaf4f,0xd27a,0x0000,0xd26a,0xd26d,0xd273,0x0000, +0xd274,0xd27c,0xd270,0x0000,0xaf4e,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb26d, +0xd64e,0x0000,0x0000,0xd650,0xd64c,0x0000,0xd658,0xd64a, +0xd657,0xb269,0xd648,0xda5b,0xd652,0xb26c,0x0000,0xd653, +0xd656,0x0000,0xd65a,0x0000,0xd64f,0x0000,0xd654,0x0000, +0x0000,0xb26a,0xb26b,0xd659,0xd64d,0xd649,0xd65b,0x0000, +0xd651,0x0000,0x0000,0xd655,0x0000,0x0000,0x0000,0xd64b, +0x0000,0xb548,0xb549,0xda65,0xb54f,0x0000,0xda59,0xda62, +0xda58,0xb54c,0xda60,0xda5e,0x0000,0xda5f,0xb54a,0x0000, +0xda63,0x0000,0x0000,0x0000,0x0000,0x0000,0xda5c,0xda5a, +0xb54b,0xda5d,0xda61,0x0000,0x0000,0x0000,0xb54d,0x0000, +0x0000,0x0000,0xda64,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xde70,0xde77,0xde79,0xdea1,0x0000,0xb7da,0xde6b, +0x0000,0xb7d2,0x0000,0xde7a,0xb7d7,0xdea2,0xb7ce,0x0000, +0xde7d,0x0000,0xde6d,0xde7e,0xde6c,0x0000,0xb7dc,0x0000, +0xde78,0xb7cf,0xdea3,0x0000,0xb7d4,0xde71,0xb7d9,0xde7c, +0xde6f,0xde76,0xde72,0xde6e,0xb7d1,0xb7d8,0xb7d6,0xb7d3, +0xb7db,0xb7d0,0xde75,0x0000,0xb7d5,0x0000,0xb54e,0x0000, +0xde7b,0x0000,0xde73,0x0000,0x0000,0x0000,0x0000,0x0000, +0xde74,0x0000,0x0000,0xe2c1,0x0000,0xbab4,0x0000,0x0000, +0xe2bd,0xe2c3,0xe2bf,0x0000,0xbab6,0xe2be,0xe2c2,0xe2ba, +0x0000,0xe2bc,0xbab5,0x0000,0x0000,0x0000,0x0000,0xe2c0, +0xe2bb,0x0000,0xbab7,0x0000,0xbab2,0x0000,0x0000,0xe2c4, +0x0000,0xbab3,0xe667,0xe664,0xe670,0xe66a,0xe66c,0xbcf4, +0xe666,0xe66e,0x0000,0x0000,0xe66d,0xe66b,0x0000,0xe671, +0xbcf7,0xe668,0xe66f,0x0000,0xbcf5,0x0000,0x0000,0xe663, +0xe665,0xbcf6,0xe662,0xe672,0x0000,0xe669,0x0000,0x0000, +0xea4a,0xbf51,0x0000,0x0000,0xea55,0xea53,0xbf4b,0xea49, +0xea4c,0xea4d,0xea48,0xbf55,0xbf56,0xea47,0xea56,0xea51, +0xbf4f,0xbf4c,0xea50,0xea4e,0x0000,0x0000,0xbf52,0xea52, +0xbf4d,0x0000,0xbf4e,0x0000,0xea4f,0xbf50,0xea4b,0x0000, +0xea54,0xbf53,0xea57,0xea58,0xbf54,0x0000,0x0000,0xc0e7, +0xc0ee,0xed5c,0xed62,0x0000,0xed60,0xc0ea,0xc0e9,0xc0e6, +0xed5e,0x0000,0x0000,0x0000,0xc0ec,0xc0eb,0xc0e8,0x0000, +0xed61,0xed5d,0xed5f,0x0000,0xc0ed,0x0000,0x0000,0x0000, +0xc277,0xeffb,0x0000,0xc274,0xc275,0xeffd,0xc276,0xeffa, +/* 0x7200 */ +0x0000,0xeff9,0xf26c,0xeffc,0x0000,0xf26d,0xc37a,0xf26b, +0x0000,0x0000,0xf26a,0x0000,0xf269,0xc37b,0x0000,0x0000, +0xc46c,0x0000,0x0000,0xf46a,0xf46b,0x0000,0x0000,0x0000, +0x0000,0xf5dc,0xf5db,0xc4ea,0x0000,0xf5da,0xf6ec,0xf6ed, +0x0000,0x0000,0xf7e6,0xf8b1,0x0000,0x0000,0xf8f6,0xf9bc, +0xc679,0xf9c6,0xa4f6,0x0000,0xaaa6,0xaaa7,0x0000,0x0000, +0xacb8,0x0000,0x0000,0x0000,0x0000,0xc0ef,0xa4f7,0x0000, +0xaaa8,0xaf52,0xb7dd,0xa4f8,0x0000,0xb26e,0xbab8,0xc962, +0x0000,0xcfb7,0xd27d,0x0000,0xe2c5,0x0000,0xc0f0,0xa4f9, +0xaaa9,0xcfb8,0xcfb9,0xda66,0xb550,0x0000,0x0000,0xdea4, +0x0000,0x0000,0xb7de,0xe2c6,0x0000,0x0000,0xbcf8,0x0000, +0xc37c,0xa4fa,0xda67,0xa4fb,0x0000,0xa6c9,0xca42,0xa6c8, +0xa865,0xa864,0xa863,0xcb60,0x0000,0x0000,0x0000,0xaaaa, +0x0000,0xaaab,0xcd5b,0x0000,0xcfba,0x0000,0xcfbd,0xacba, +0xcfbb,0x0000,0xacb9,0xcfbc,0xacbb,0x0000,0xd2a2,0xd2a1, +0xd27e,0xaf53,0x0000,0xd65d,0xd65e,0xb26f,0xd65c,0xd65f, +0xb552,0xb270,0x0000,0x0000,0xb551,0xda6b,0xda6a,0x0000, +0xda68,0xda69,0x0000,0xda6c,0xdea6,0xdea5,0xdea9,0x0000, +0xdea8,0xdea7,0xbab9,0xe2c9,0x0000,0xe2c8,0xbaba,0xe2c7, +0xe673,0x0000,0xe674,0xbcf9,0x0000,0xea59,0xea5a,0x0000, +0x0000,0xf272,0xc37d,0xf271,0xf270,0xf26e,0xf26f,0xc4eb, +0xf46c,0xf6ee,0xf8f7,0x0000,0xa4fc,0x0000,0xc9a5,0xa5c7, +0xc9a6,0x0000,0x0000,0x0000,0xca43,0xca44,0x0000,0x0000, +0x0000,0x0000,0xcb66,0x0000,0x0000,0xcb62,0x0000,0xcb61, +0xaaac,0xcb65,0xa867,0xcb63,0xa866,0xcb67,0xcb64,0x0000, +0x0000,0xcd5f,0xcfbe,0xcd5d,0xcd64,0x0000,0xaaad,0x0000, +0xaab0,0xcd65,0xcd61,0x0000,0xcd62,0x0000,0xcd5c,0xaaaf, +0xcd5e,0xaaae,0xcd63,0x0000,0xcd60,0x0000,0x0000,0xcfc2, +0xacbd,0xacbe,0x0000,0xcfc5,0xcfbf,0x0000,0xcfc4,0x0000, +0xcfc0,0xacbc,0xcfc3,0xcfc1,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xd2a8,0xd2a5,0x0000,0xd2a7,0xaf58, +0xaf57,0xaf55,0xd2a4,0xd2a9,0xaf54,0xaf56,0xd2a6,0xd667, +0xd2a3,0xd2aa,0x0000,0x0000,0x0000,0x0000,0x0000,0xd662, +0xd666,0x0000,0xd665,0xda6e,0xda79,0x0000,0x0000,0xd668, +0x0000,0xd663,0xda6d,0xb274,0x0000,0x0000,0xb273,0xd661, +0xd664,0xb275,0x0000,0xb272,0xb271,0xd660,0xd669,0x0000, +0x0000,0x0000,0xda70,0xda77,0x0000,0xb554,0xda76,0xda73, +0x0000,0xb556,0x0000,0x0000,0x0000,0xda75,0x0000,0x0000, +0xda6f,0xda71,0xda74,0xda72,0xb555,0xda78,0xb553,0xb7df, +0x0000,0x0000,0xdead,0xdeac,0xdeaa,0x0000,0xb7e2,0xb7e1, +0xdeae,0x0000,0xdeab,0xe2ca,0xbabb,0xb7e0,0x0000,0x0000, +0x0000,0xdeb0,0xdeaf,0x0000,0xe2cd,0xe2cb,0xbcfa,0x0000, +0xbabc,0xe2cc,0xe676,0x0000,0x0000,0x0000,0x0000,0xbcfb, +0xe675,0xe67e,0xe67d,0xe67b,0x0000,0xe67a,0xe677,0xe678, +0xe679,0xe67c,0xe6a1,0x0000,0x0000,0xea5f,0xea5c,0xea5d, +0xbf57,0xea5b,0xea61,0xea60,0xea5e,0x0000,0xed64,0xed65, +0xc0f1,0x0000,0xc0f2,0xed63,0x0000,0xc279,0xeffe,0xc278, +0xc37e,0x0000,0xc3a1,0xc46d,0xf46e,0xf46d,0xf5dd,0xf6ef, +0xc57a,0xf7e8,0xf7e7,0xf7e9,0xa5c8,0xcfc6,0xaf59,0xb276, +0xd66a,0xa5c9,0xc9a7,0xa4fd,0x0000,0x0000,0xca45,0x0000, +0x0000,0x0000,0xcb6c,0xcb6a,0xcb6b,0xcb68,0xa868,0xcb69, +0x0000,0x0000,0x0000,0x0000,0x0000,0xcd6d,0x0000,0xaab3, +0xcd6b,0xcd67,0xcd6a,0x0000,0xcd66,0xaab5,0xcd69,0x0000, +0xaab2,0xaab1,0x0000,0xaab4,0xcd6c,0xcd68,0x0000,0x0000, +0x0000,0x0000,0xacc2,0xacc5,0xcfce,0xcfcd,0xcfcc,0xacbf, +0xcfd5,0xcfcb,0x0000,0xacc1,0xd2af,0x0000,0xcfd2,0xcfd0, +0xacc4,0x0000,0xcfc8,0xcfd3,0x0000,0xcfca,0xcfd4,0xcfd1, +0xcfc9,0x0000,0xacc0,0xcfd6,0xcfc7,0xacc3,0x0000,0x0000, +0x0000,0x0000,0xd2b4,0xd2ab,0xd2b6,0x0000,0xd2ae,0xd2b9, +0xd2ba,0xd2ac,0xd2b8,0xd2b5,0xd2b3,0xd2b7,0xaf5f,0x0000, +0xaf5d,0x0000,0x0000,0xd2b1,0x0000,0xd2ad,0x0000,0xd2b0, +0xd2bb,0xd2b2,0xaf5e,0xcfcf,0x0000,0xaf5a,0xaf5c,0x0000, +0x0000,0x0000,0x0000,0x0000,0xd678,0xd66d,0xd66b,0x0000, +0xd66c,0x0000,0xd673,0x0000,0xd674,0xd670,0xb27b,0xd675, +0xd672,0xd66f,0x0000,0xb279,0xd66e,0xb277,0xb27a,0xd671, +0xd679,0xaf5b,0xb278,0xd677,0xd676,0xb27c,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xda7e,0x0000, +0x0000,0x0000,0xdaa1,0xb560,0x0000,0xdaa7,0x0000,0x0000, +0xdaa9,0xdaa2,0xb55a,0xdaa6,0xdaa5,0xb55b,0xb561,0x0000, +0xb562,0xdaa8,0xb558,0xda7d,0xda7b,0xdaa3,0xda7a,0xb55f, +0xda7c,0xdaa4,0xdaaa,0xb559,0xb55e,0xb55c,0xb55d,0x0000, +0x0000,0x0000,0xb557,0x0000,0x0000,0x0000,0x0000,0xb7e9, +0xdeb7,0xb7e8,0xdebb,0x0000,0xdeb1,0x0000,0xdebc,0x0000, +0x0000,0x0000,0xdeb2,0xdeb3,0x0000,0xdebd,0xdeba,0xdeb8, +0xdeb9,0xdeb5,0xdeb4,0x0000,0xdebe,0xb7e5,0x0000,0xdeb6, +0x0000,0xb7ea,0xb7e4,0xb7eb,0xb7ec,0x0000,0xb7e7,0xb7e6, +0x0000,0x0000,0xe2ce,0xbabe,0xbabd,0x0000,0x0000,0xe2d3, +0x0000,0xbcfc,0xbabf,0x0000,0x0000,0xbac1,0xe2d4,0xb7e3, +0xbac0,0xe2d0,0xe2d2,0xe2cf,0x0000,0xe2d1,0x0000,0x0000, +0x0000,0xe6ab,0x0000,0x0000,0xe6aa,0xe6a7,0xbd40,0xea62, +0xbd41,0xe6a6,0x0000,0xbcfe,0x0000,0xe6a8,0xe6a5,0xe6a2, +0xe6a9,0xe6a3,0xe6a4,0xbcfd,0x0000,0x0000,0x0000,0x0000, +0xed69,0x0000,0xea66,0x0000,0xea65,0xea67,0x0000,0xed66, +0xbf5a,0x0000,0xea63,0x0000,0xbf58,0x0000,0xbf5c,0xbf5b, +0xea64,0xea68,0x0000,0xbf59,0x0000,0xed6d,0xc0f5,0xc27a, +0xc0f6,0xc0f3,0xed6a,0xed68,0x0000,0xed6b,0x0000,0xed6e, +0xc0f4,0xed6c,0xed67,0x0000,0x0000,0xf042,0xf045,0xf275, +0xf040,0x0000,0xf46f,0xf046,0x0000,0xc3a2,0xf044,0xc27b, +0xf041,0xf043,0xf047,0xf276,0x0000,0xf274,0x0000,0x0000, +0x0000,0x0000,0xc3a3,0xf273,0x0000,0x0000,0x0000,0xc46e, +0x0000,0x0000,0x0000,0x0000,0xc4ed,0xf6f1,0xc4ec,0xf6f3, +0xf6f0,0xf6f2,0xc5d0,0xf8b2,0xa5ca,0xcd6e,0xd2bc,0xd2bd, +0xb27d,0xdebf,0xbf5d,0xc3a4,0xc57b,0xf8b3,0xa5cb,0x0000, +0xcd6f,0xa260,0x0000,0x0000,0xcfd7,0x0000,0xcfd8,0x0000, +0x0000,0x0000,0x0000,0x0000,0xd2be,0xd2bf,0xb27e,0xb2a1, +0x0000,0x0000,0x0000,0xdaab,0x0000,0xdec2,0xdec1,0xdec0, +0xe2d5,0x0000,0xe2d6,0xe2d7,0xbac2,0x0000,0x0000,0xe6ad, +0xe6ac,0x0000,0x0000,0xea69,0xbf5e,0xbf5f,0x0000,0xed72, +0xed6f,0xed70,0xed71,0xf049,0xf048,0xc27c,0xf277,0xf5de, +0xa5cc,0x0000,0xacc6,0x0000,0xb2a2,0xdec3,0x0000,0xa5cd, +0x0000,0xd2c0,0xb2a3,0x0000,0x0000,0xb563,0xb564,0x0000, +0xa5ce,0xa5cf,0xca46,0xa86a,0xa869,0xacc7,0xcfd9,0xdaac, +0xa5d0,0xa5d1,0xa5d2,0xa5d3,0x0000,0x0000,0x0000,0xa86b, +0xa86c,0xcb6e,0xcb6d,0x0000,0x0000,0xaab6,0xcd72,0xcd70, +0xcd71,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcfda, +0xcfdb,0x0000,0x0000,0xaccb,0xacc9,0x0000,0xacca,0xacc8, +0x0000,0x0000,0x0000,0x0000,0xaf60,0x0000,0x0000,0x0000, +0x0000,0xaf64,0xaf63,0xd2c1,0xaf62,0xaf61,0x0000,0xd2c2, +0x0000,0x0000,0xb2a6,0xd67b,0xd67a,0xb2a4,0xb2a5,0x0000, +0x0000,0x0000,0xb566,0xb565,0xdaae,0x0000,0x0000,0xdaad, +0xb2a7,0x0000,0x0000,0x0000,0x0000,0x0000,0xb7ed,0xdec5, +0xb7ee,0xdec4,0x0000,0x0000,0x0000,0xe2d8,0xe6ae,0xbd42, +0xea6a,0x0000,0x0000,0x0000,0xed73,0x0000,0xc3a6,0xc3a5, +0x0000,0x0000,0xc57c,0xa5d4,0xcd73,0x0000,0x0000,0xb2a8, +0xe2d9,0xbac3,0x0000,0x0000,0xcb6f,0xcb70,0x0000,0x0000, +0xcd74,0xaab8,0xaab9,0x0000,0x0000,0xaab7,0x0000,0x0000, +0x0000,0x0000,0xaccf,0xacd0,0xaccd,0xacce,0x0000,0xcfdc, +0x0000,0x0000,0xcfdd,0xaccc,0x0000,0x0000,0x0000,0x0000, +0xd2c3,0x0000,0xaf68,0xaf69,0x0000,0xb2ab,0xd2c9,0x0000, +0xaf6e,0xaf6c,0xd2ca,0xd2c5,0xaf6b,0xaf6a,0xaf65,0xd2c8, +0xd2c7,0xd2c4,0xaf6d,0x0000,0xd2c6,0xaf66,0x0000,0xaf67, +0x0000,0x0000,0xb2ac,0xd6a1,0xd6a2,0xb2ad,0xd67c,0xd67e, +0xd6a4,0xd6a3,0xd67d,0x0000,0xb2a9,0xb2aa,0x0000,0xdab6, +0xb56b,0xb56a,0xdab0,0xb568,0x0000,0xdab3,0xb56c,0xdab4, +0xb56d,0xdab1,0xb567,0xb569,0xdab5,0x0000,0xdab2,0xdaaf, +0x0000,0x0000,0x0000,0x0000,0x0000,0xded2,0x0000,0xdec7, +0xb7f0,0xb7f3,0xb7f2,0xb7f7,0xb7f6,0xded3,0xded1,0xdeca, +0xdece,0xdecd,0xb7f4,0xded0,0xdecc,0xded4,0xdecb,0xb7f5, +0xb7ef,0xb7f1,0x0000,0xdec9,0x0000,0x0000,0x0000,0x0000, +0xe2db,0xbac7,0xe2df,0xbac6,0xe2dc,0xbac5,0x0000,0xdec8, +0xdecf,0xe2de,0x0000,0xbac8,0xe2e0,0xe2dd,0xe2da,0x0000, +0x0000,0xe6b1,0xe6b5,0xe6b7,0xe6b3,0xe6b2,0xe6b0,0xbd45, +0xbd43,0xbd48,0xbd49,0xe6b4,0xbd46,0xe6af,0xbd47,0xbac4, +0xe6b6,0xbd44,0x0000,0x0000,0x0000,0xea6c,0x0000,0xea6b, +0xea73,0xea6d,0xea72,0xea6f,0xbf60,0xea71,0x0000,0x0000, +0xbf61,0x0000,0xbf62,0x0000,0xea70,0xea6e,0x0000,0x0000, +0x0000,0x0000,0xc0f8,0xed74,0x0000,0x0000,0xc0f7,0xed77, +0xed75,0xed76,0x0000,0x0000,0xc0f9,0x0000,0x0000,0x0000, +0xf04d,0x0000,0xc2a1,0xf04e,0x0000,0x0000,0xc27d,0xf04f, +0xc27e,0xf04c,0xf050,0x0000,0xf04a,0x0000,0x0000,0xc3a7, +0xf278,0xc3a8,0xc46f,0x0000,0xf04b,0xc470,0x0000,0x0000, +0x0000,0xc4ee,0xf5df,0x0000,0xc57e,0xf6f4,0xc57d,0x0000, +0xf7ea,0xc5f5,0xc5f6,0x0000,0x0000,0xf9cc,0x0000,0x0000, +0xacd1,0xcfde,0x0000,0xb56e,0xb56f,0xa5d5,0xa6ca,0xca47, +0x0000,0xcb71,0xa86d,0x0000,0xaaba,0x0000,0xacd2,0xacd3, +0xacd4,0xd6a6,0xd2cb,0xaf6f,0x0000,0x0000,0xb2ae,0xd6a5, +0x0000,0x0000,0xdab8,0xb571,0x0000,0xdab7,0xb570,0x0000, +0x0000,0xded5,0xbd4a,0xe6bb,0xe6b8,0xe6b9,0xe6ba,0x0000, +0x0000,0x0000,0x0000,0x0000,0xed78,0x0000,0xf051,0x0000, +0x0000,0x0000,0xf471,0xf470,0x0000,0xf6f5,0xa5d6,0xcd75, +0xaf70,0x0000,0x0000,0x0000,0xb572,0xded6,0x0000,0x0000, +0xe2e1,0x0000,0xbd4b,0xea74,0x0000,0xf052,0xf472,0xa5d7, +0x0000,0x0000,0xaabb,0xacd7,0xcfdf,0xacd8,0xacd6,0x0000, +0xacd5,0xd2cc,0xaf71,0x0000,0x0000,0xaf72,0xaf73,0x0000, +0x0000,0x0000,0xb2b0,0xd6a7,0xb2af,0x0000,0x0000,0x0000, +0x0000,0x0000,0xdab9,0xb2b1,0xb573,0xded7,0xb7f8,0xb7f9, +0x0000,0xbac9,0x0000,0xbaca,0xbd4c,0xbf64,0xea75,0xbf63, +0x0000,0xed79,0xc0fa,0x0000,0xf053,0xf473,0xa5d8,0xa86e, +0xcd78,0xcd77,0xaabc,0xcd76,0xaabd,0xcd79,0x0000,0xcfe5, +0xacdb,0xacda,0xcfe7,0xcfe6,0xacdf,0x0000,0xacde,0x0000, +/* 0x7700 */ +0x0000,0xacd9,0x0000,0xcfe1,0xcfe2,0xcfe3,0x0000,0xace0, +0xcfe0,0xacdc,0xcfe4,0xacdd,0x0000,0x0000,0x0000,0x0000, +0xd2cf,0xd2d3,0xd2d1,0xd2d0,0x0000,0xd2d4,0x0000,0x0000, +0x0000,0xd2d5,0xd2d6,0xd2ce,0x0000,0xd2cd,0x0000,0xaf75, +0xaf76,0x0000,0xd2d7,0xd2d2,0x0000,0xd6b0,0x0000,0xd2d8, +0xaf77,0xaf74,0x0000,0x0000,0x0000,0xd6aa,0x0000,0xd6a9, +0x0000,0xd6ab,0xd6ac,0xd6ae,0xd6ad,0xd6b2,0xb2b5,0xb2b2, +0xb2b6,0xd6a8,0xb2b7,0xd6b1,0xb2b4,0xd6af,0xb2b3,0x0000, +0x0000,0x0000,0x0000,0x0000,0xdabc,0xdabe,0xdaba,0xdabb, +0x0000,0x0000,0xdabf,0xdac1,0xdac2,0xdabd,0xdac0,0xb574, +0x0000,0x0000,0xdedb,0x0000,0xdee0,0xded8,0xdedc,0x0000, +0x0000,0xdee1,0xdedd,0xb7fa,0xb843,0x0000,0xb7fd,0xded9, +0xdeda,0xbace,0xb846,0xb7fe,0x0000,0xb844,0xb7fc,0xdedf, +0xb845,0xdede,0xb841,0xb7fb,0xb842,0xdee2,0xe2e6,0xe2e8, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xb840,0x0000,0x0000,0xe2e3,0xbacc,0xe2e9,0xbacd, +0xe2e7,0xe2e2,0xe2e5,0xe2ea,0xbacb,0xe2e4,0x0000,0xbd4e, +0xe6bf,0xe6be,0x0000,0xbd51,0xbd4f,0xe6bc,0xbd4d,0xe6bd, +0x0000,0xbd50,0x0000,0x0000,0x0000,0xea7d,0x0000,0xeaa1, +0x0000,0xea7e,0xea76,0xea7a,0xea79,0xea77,0xbf66,0xbf67, +0xbf65,0xea78,0xea7b,0xea7c,0x0000,0xbf68,0x0000,0xc140, +0xeda3,0x0000,0xc0fc,0xed7b,0xc0fe,0xc141,0x0000,0x0000, +0xc0fd,0xeda2,0xed7c,0xc0fb,0xeda1,0xed7a,0xed7e,0xed7d, +0x0000,0x0000,0xf055,0xc2a4,0xc2a5,0xc2a2,0x0000,0xc2a3, +0x0000,0x0000,0xf054,0x0000,0xf27b,0x0000,0x0000,0xc3a9, +0x0000,0xf279,0xf27a,0x0000,0xf474,0xf477,0xf475,0xf476, +0xf5e0,0x0000,0x0000,0xc4ef,0xf7eb,0xf8b4,0x0000,0xc5f7, +0xf8f8,0xf8f9,0xc666,0xa5d9,0xace1,0x0000,0xdac3,0x0000, +0xdee3,0x0000,0xa5da,0xa86f,0x0000,0xaabe,0x0000,0xcfe8, +0xcfe9,0xaf78,0x0000,0x0000,0xdac4,0xb575,0xb847,0xc142, +0xeda4,0xf27c,0xf478,0xa5db,0x0000,0x0000,0x0000,0xcda1, +0xcd7a,0xcd7c,0xcd7e,0xcd7d,0xcd7b,0xaabf,0x0000,0x0000, +/* 0x7800 */ +0x0000,0x0000,0xace2,0xcff2,0x0000,0xcfed,0xcfea,0x0000, +0x0000,0xcff1,0x0000,0x0000,0xace4,0xace5,0xcff0,0xcfef, +0xcfee,0xcfeb,0xcfec,0xcff3,0xace3,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xaf7c,0x0000,0xafa4, +0xafa3,0xd2e1,0xd2db,0xd2d9,0x0000,0xafa1,0xd6b9,0xaf7a, +0xd2de,0xd2e2,0xd2e4,0xd2e0,0xd2da,0xafa2,0xd2df,0xd2dd, +0xaf79,0xd2e5,0xafa5,0xd2e3,0xaf7d,0xd2dc,0x0000,0xaf7e, +0xaf7b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xb2b9,0x0000,0xd6ba,0x0000,0x0000, +0xd6b3,0xd6b5,0xd6b7,0x0000,0xd6b8,0xd6b6,0xb2ba,0x0000, +0xd6bb,0x0000,0xd6b4,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xdac8,0xb576,0xdad0,0x0000, +0xdac5,0x0000,0xdad1,0x0000,0xdac6,0xdac7,0x0000,0x0000, +0xdacf,0xdace,0xdacb,0xb2b8,0xb577,0xdac9,0xdacc,0xb578, +0xdacd,0xdaca,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xdeee,0x0000,0xdef2,0xb84e,0x0000,0xe2f0,0xb851, +0xdef0,0xf9d6,0x0000,0xdeed,0xdee8,0xdeea,0xdeeb,0xdee4, +0x0000,0xb84d,0x0000,0x0000,0xb84c,0x0000,0xb848,0xdee7, +0x0000,0xb84f,0x0000,0xb850,0xdee6,0xdee9,0xdef1,0xb84a, +0xb84b,0xdeef,0xdee5,0x0000,0x0000,0x0000,0xe2f2,0xbad0, +0xe2f4,0xdeec,0xe2f6,0xbad4,0xe2f7,0xe2f3,0x0000,0xbad1, +0xe2ef,0xbad3,0xe2ec,0xe2f1,0xe2f5,0xe2ee,0x0000,0x0000, +0xb849,0x0000,0xe2eb,0xbad2,0xe2ed,0x0000,0x0000,0x0000, +0x0000,0x0000,0xbd54,0xe6c1,0xbd58,0x0000,0xbd56,0x0000, +0x0000,0xbacf,0x0000,0xe6c8,0xe6c9,0xbd53,0x0000,0x0000, +0xe6c7,0xe6ca,0xbd55,0xbd52,0xe6c3,0xe6c0,0xe6c5,0xe6c2, +0xbd59,0xe6c4,0x0000,0x0000,0xe6c6,0xbd57,0x0000,0x0000, +0x0000,0x0000,0xbf6a,0xeaa8,0x0000,0xeaa2,0xeaa6,0xeaac, +0xeaad,0xeaa9,0xeaaa,0xeaa7,0x0000,0xeaa4,0x0000,0xbf6c, +0xbf69,0xeaa3,0xeaa5,0x0000,0xbf6b,0xeaab,0x0000,0xc146, +0x0000,0x0000,0xedaa,0xeda5,0xc145,0x0000,0x0000,0xc143, +0x0000,0xedac,0xc144,0xeda8,0xeda9,0xeda6,0xedad,0xf056, +/* 0x7900 */ +0x0000,0xc147,0xeda7,0x0000,0xedae,0xedab,0x0000,0x0000, +0x0000,0xf05a,0x0000,0x0000,0xf057,0x0000,0xc2a6,0x0000, +0xf05b,0xf05d,0xf05c,0xf058,0xf059,0x0000,0x0000,0xf2a3, +0x0000,0xc3aa,0x0000,0xf27e,0xf2a2,0xf27d,0xf2a4,0x0000, +0x0000,0xf2a1,0x0000,0xf47a,0xf47d,0xf479,0xc471,0xf47b, +0xf47c,0xf47e,0xc472,0xc474,0xc473,0xf5e1,0x0000,0xf5e3, +0x0000,0xf5e2,0x0000,0x0000,0x0000,0xf6f6,0x0000,0x0000, +0xf8b5,0xf8fa,0xa5dc,0x0000,0x0000,0xcb72,0xaac0,0xcda3, +0xaac1,0xaac2,0xcda2,0x0000,0xcff8,0xcff7,0xace6,0xace9, +0xace8,0xace7,0xcff4,0xcff6,0xcff5,0x0000,0x0000,0xd2e8, +0xafa7,0xd2ec,0xd2eb,0xd2ea,0xd2e6,0xafa6,0xafaa,0xafad, +0x0000,0x0000,0xafae,0xd2e7,0xd2e9,0xafac,0xafab,0xafa9, +0xafa8,0xd6c2,0x0000,0xd6c0,0xd6bc,0xb2bb,0x0000,0xd6bd, +0xb2bc,0xd6be,0xd6bf,0xd6c1,0x0000,0xb2bd,0x0000,0x0000, +0xdad5,0x0000,0xdad4,0xdad3,0xdad2,0x0000,0x0000,0x0000, +0x0000,0xdef6,0xb852,0x0000,0xdef3,0xdef5,0x0000,0xb853, +0x0000,0xb854,0xdef4,0x0000,0x0000,0x0000,0x0000,0x0000, +0xe341,0x0000,0xe2f9,0xe2fa,0x0000,0xbad7,0xbad5,0xbad6, +0xe343,0x0000,0xe342,0xe2fe,0xe2fd,0xe2fc,0xe2fb,0xe340, +0xe2f8,0x0000,0xe6cb,0xe6d0,0xe6ce,0x0000,0x0000,0x0000, +0xe6cd,0xe6cc,0xe6cf,0x0000,0xeaae,0x0000,0xbf6d,0xc148, +0xedb0,0x0000,0xc149,0xedaf,0xf05f,0xf05e,0xc2a7,0x0000, +0xf2a5,0xc3ab,0xf4a1,0xc5a1,0xf6f7,0x0000,0xf8b7,0xf8b6, +0xc9a8,0xacea,0xaceb,0xd6c3,0x0000,0xb856,0xa5dd,0xa872, +0xa871,0xa870,0x0000,0x0000,0x0000,0xcda4,0x0000,0x0000, +0xaac4,0xaac3,0x0000,0xacee,0x0000,0xcffa,0xcffd,0xcffb, +0x0000,0xacec,0xaced,0x0000,0x0000,0xcff9,0xcffc,0x0000, +0xafb5,0x0000,0x0000,0x0000,0xd2f3,0xd2f5,0xd2f4,0xafb2, +0xd2ef,0x0000,0x0000,0xafb0,0xafaf,0x0000,0xafb3,0xafb1, +0x0000,0xafb4,0xd2f2,0xd2ed,0xd2ee,0xd2f1,0xd2f0,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd6c6,0xd6c7, +0xd6c5,0x0000,0xd6c4,0xb2be,0x0000,0x0000,0x0000,0x0000, +0xb57d,0x0000,0xdad6,0xdad8,0xdada,0xb57c,0x0000,0x0000, +0xb57a,0x0000,0xdad7,0xb57b,0xdad9,0xb579,0x0000,0x0000, +0xdf41,0xdef7,0xdefa,0xdefe,0xb85a,0xdefc,0x0000,0xdefb, +0xdef8,0xdef9,0xb858,0xdf40,0xb857,0x0000,0xb85c,0xb85b, +0xb859,0x0000,0xdefd,0x0000,0x0000,0x0000,0xe349,0x0000, +0xe348,0x0000,0x0000,0xe344,0x0000,0x0000,0xbad8,0xe347, +0xe346,0xbad9,0x0000,0x0000,0x0000,0x0000,0x0000,0xbd5e, +0x0000,0xe6d2,0x0000,0xbd5f,0xbd5b,0xbd5d,0x0000,0xbd5a, +0xbd5c,0x0000,0x0000,0x0000,0xeaaf,0x0000,0xbf70,0xeab1, +0xeab0,0x0000,0xe345,0xbf72,0xbf71,0xbf6e,0xbf6f,0x0000, +0x0000,0x0000,0x0000,0x0000,0xedb5,0x0000,0xedb3,0xc14a, +0xedb4,0x0000,0xedb6,0xedb2,0xedb1,0x0000,0x0000,0xf060, +0xc2aa,0xc2a8,0xc2a9,0x0000,0x0000,0x0000,0x0000,0xf2a6, +0xf2a7,0xc3ad,0x0000,0xc3ac,0xf4a3,0xf4a4,0xf4a2,0x0000, +0xf6f8,0xf6f9,0x0000,0x0000,0xa5de,0xca48,0xa873,0x0000, +0xcda5,0xaac6,0xaac5,0xcda6,0x0000,0x0000,0xd040,0xacef, +0xcffe,0xacf0,0x0000,0x0000,0xafb6,0xd2f8,0xd2f6,0xd2fc, +0xafb7,0xd2f7,0xd2fb,0xd2f9,0xd2fa,0x0000,0x0000,0xd6c8, +0xd6ca,0x0000,0xb2bf,0x0000,0xd6c9,0xb2c0,0xb5a2,0xb5a1, +0xb57e,0xdadb,0x0000,0x0000,0x0000,0x0000,0xdf44,0xb85d, +0xb85e,0x0000,0xdf43,0xdf42,0x0000,0x0000,0x0000,0x0000, +0xe34a,0xbadb,0xbada,0xe34b,0xe34c,0x0000,0xbd61,0xbd60, +0x0000,0xeab5,0xe6d3,0xe6d5,0xe6d4,0xeab4,0xeab2,0xeab6, +0xeab3,0x0000,0xbf73,0x0000,0x0000,0x0000,0xedb7,0xc14b, +0xedb8,0xedb9,0x0000,0x0000,0xc2ab,0xc2ac,0x0000,0xc475, +0x0000,0x0000,0xc5d1,0xa5df,0x0000,0x0000,0x0000,0x0000, +0x0000,0xd041,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xd2fd,0xafb8,0x0000,0x0000,0x0000,0x0000,0x0000,0xb3ba, +0xb3b9,0x0000,0x0000,0xb5a4,0xdadd,0xb5a3,0xdadc,0x0000, +0x0000,0x0000,0x0000,0xdf45,0x0000,0xbadc,0xe34d,0xbadd, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc476,0xf4a5, +0x0000,0xa6cb,0xaac7,0xcda7,0x0000,0xacf2,0x0000,0xacf1, +0xd042,0xd043,0x0000,0x0000,0xd340,0xd342,0xafb9,0x0000, +0xd344,0xd347,0xd345,0x0000,0x0000,0x0000,0xd346,0xd343, +0xd2fe,0xafba,0xd348,0xd341,0x0000,0x0000,0x0000,0x0000, +0xd6d3,0xb2c6,0xd6dc,0xb2c3,0x0000,0xd6d5,0xb2c7,0x0000, +0xb2c1,0x0000,0xd6d0,0xd6dd,0xd6d1,0xd6ce,0xb2c5,0x0000, +0xb2c2,0x0000,0xd6d4,0xd6d7,0xb2c4,0xd6d8,0xb2c8,0xd6d9, +0xd6cf,0xd6d6,0xd6da,0xd6d2,0xd6cd,0xd6cb,0x0000,0x0000, +0xd6db,0x0000,0x0000,0xdadf,0x0000,0x0000,0x0000,0x0000, +0xdae4,0x0000,0x0000,0x0000,0xdae0,0xdae6,0xb5a7,0xd6cc, +0xdae1,0xb5a5,0xdade,0xb5ac,0xdae2,0xb5ab,0xdae3,0xb5ad, +0xb5a8,0xb5ae,0xb5a9,0x0000,0xb5aa,0x0000,0xb5a6,0x0000, +0xdae5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xb861,0xdf50,0x0000,0xdf53,0xdf47,0xdf4c,0xdf46,0xb863, +0x0000,0xdf4a,0x0000,0x0000,0x0000,0xdf48,0xb862,0x0000, +0xdf4f,0xdf4e,0xdf4b,0xdf4d,0xdf49,0xbae1,0xdf52,0xb85f, +0xdf51,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xe35d,0x0000,0xbae8,0xe358,0x0000,0xbae7, +0xe34e,0x0000,0xe350,0xbae0,0xe355,0xe354,0xe357,0xbae5, +0xe352,0xe351,0x0000,0x0000,0xbae4,0xbadf,0xe353,0xbae2, +0xe359,0xe35b,0x0000,0xe356,0xe34f,0xbae3,0x0000,0x0000, +0xbd69,0xbade,0x0000,0x0000,0xe35c,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xe6d9,0xbd62,0x0000,0xe6db, +0x0000,0xbd63,0x0000,0x0000,0xbd65,0xe6de,0x0000,0xe6d6, +0xbae6,0xe6dc,0x0000,0x0000,0x0000,0x0000,0xe6d8,0x0000, +0xb860,0xbd68,0x0000,0x0000,0xbd64,0x0000,0xbd66,0xbd67, +0x0000,0xbf76,0xe6dd,0xe6d7,0xbd6a,0x0000,0xe6da,0x0000, +0x0000,0x0000,0x0000,0x0000,0xeac0,0xeabb,0x0000,0x0000, +0xeac5,0xbf74,0xeabd,0xbf78,0xeac3,0xeaba,0xeab7,0xeac6, +0xc151,0xbf79,0xeac2,0xeab8,0xbf77,0xeabc,0xbf7b,0xeab9, +0xeabe,0xbf7a,0xeac1,0xeac4,0x0000,0x0000,0x0000,0x0000, +0xedcb,0xedcc,0xedbc,0xedc3,0xedc1,0x0000,0x0000,0xc14f, +0xedc8,0xeabf,0x0000,0xedbf,0x0000,0xedc9,0xc14e,0xedbe, +0xedbd,0xedc7,0xedc4,0xedc6,0x0000,0xedba,0xedca,0xc14c, +0x0000,0xedc5,0xedce,0xedc2,0xc150,0xc14d,0xedc0,0xedbb, +0xedcd,0xbf75,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xf063,0x0000,0x0000,0xf061,0xf067,0xc2b0,0xf065, +0xf064,0xc2b2,0xf06a,0xc2b1,0x0000,0xf06b,0xf068,0xc2ae, +0xf069,0xf062,0xc2af,0xc2ad,0xf2ab,0xf066,0x0000,0x0000, +0xf06c,0x0000,0x0000,0xf2a8,0x0000,0x0000,0x0000,0xc3b2, +0xc3b0,0xf2aa,0x0000,0xf2ac,0xf2a9,0xc3b1,0xc3ae,0xc3af, +0xc3b3,0x0000,0x0000,0xc478,0x0000,0xf4aa,0x0000,0xf4a9, +0xf4a7,0xf4a6,0xf4a8,0x0000,0xc477,0xc479,0x0000,0x0000, +0xc4f0,0x0000,0x0000,0xf5e5,0xf5e4,0x0000,0x0000,0xf6fa, +0x0000,0xf6fc,0xf6fe,0xf6fd,0xf6fb,0x0000,0x0000,0xc5a3, +0xc5a2,0x0000,0x0000,0xc5d3,0xc5d2,0xc5d4,0xf7ed,0xf7ec, +0x0000,0xf8fb,0xf8b8,0xf8fc,0xc658,0x0000,0xc659,0xf96d, +0x0000,0x0000,0xc67e,0xa6cc,0x0000,0xcda8,0x0000,0x0000, +0xd045,0xd046,0xd044,0x0000,0x0000,0xacf3,0x0000,0xd047, +0xd048,0xd049,0x0000,0x0000,0xd349,0xd34f,0x0000,0x0000, +0xd34d,0xafbb,0xd34b,0x0000,0xd34c,0xd34e,0x0000,0x0000, +0x0000,0xd34a,0xb2c9,0x0000,0xd6de,0xb2cb,0xd6e0,0xb2ca, +0xd6df,0x0000,0x0000,0x0000,0x0000,0x0000,0xdae8,0xb5af, +0x0000,0xdaea,0xdae7,0xd6e1,0x0000,0xb5b0,0x0000,0xf9db, +0xdae9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdf56, +0x0000,0xb864,0xdf54,0xb865,0xdf55,0xb866,0x0000,0x0000, +0x0000,0xbae9,0xe361,0xe35e,0xe360,0xbaea,0xbaeb,0xe35f, +0x0000,0x0000,0x0000,0x0000,0x0000,0xe6df,0x0000,0x0000, +0xe6e0,0x0000,0xbd6b,0xe6e2,0xe6e1,0x0000,0xa261,0x0000, +0xeaca,0xeacb,0xeac7,0x0000,0xeac8,0xbf7c,0xbf7d,0xeac9, +0x0000,0xc157,0x0000,0x0000,0xc153,0xc158,0xc154,0xc156, +0xc152,0x0000,0xc155,0x0000,0x0000,0x0000,0x0000,0xc2b3, +0xedcf,0x0000,0xf2ae,0x0000,0xf2ad,0x0000,0xf4ab,0xc47a, +0xc47b,0xf741,0xf5e6,0x0000,0xf740,0x0000,0xf8fd,0xf9a4, +0xa6cd,0x0000,0x0000,0xa874,0x0000,0xcda9,0xaac8,0x0000, +0xacf6,0xd04c,0xacf4,0xd04a,0xacf9,0xacf5,0xacfa,0xacf8, +0xd04b,0xacf7,0xafbf,0xafbe,0xd35a,0xafc7,0xd353,0xd359, +0xafc3,0xd352,0xd358,0xd356,0xafc2,0xafc4,0xd355,0xafbd, +0xd354,0xafc8,0xafc5,0xafc9,0xafc6,0xd351,0xd350,0xd357, +0xafc0,0xafbc,0xafc1,0x0000,0x0000,0x0000,0x0000,0x0000, +0xd6f0,0xd6e9,0x0000,0xb5b5,0xd6e8,0x0000,0xb2cf,0xb2d6, +0xb2d3,0xb2d9,0xb2d8,0xb2d4,0x0000,0xd6e2,0xd6e5,0x0000, +0xd6e4,0xb2d0,0xd6e6,0xd6ef,0xb2d1,0xd6e3,0xd6ec,0xd6ed, +0xb2d2,0xd6ea,0xb2d7,0xb2cd,0xb2d5,0xd6e7,0xb2cc,0xd6eb, +0x0000,0x0000,0xd6ee,0x0000,0x0000,0x0000,0xdafb,0xdaf2, +0xb5b2,0xdaf9,0xdaf6,0xdaee,0xdaf7,0xb5b4,0xdaef,0x0000, +0xdaeb,0x0000,0x0000,0xb86c,0xdaf4,0x0000,0xb5b1,0xdafa, +0x0000,0xb5b8,0xb5ba,0xdaed,0x0000,0x0000,0xb5b9,0xdaf0, +0xb5b3,0xdaf8,0xdaf1,0xdaf5,0x0000,0xdaf3,0xb5b6,0xdaec, +0xb5bb,0xb2ce,0xb5b7,0xb5bc,0x0000,0x0000,0x0000,0x0000, +0x0000,0xb868,0xdf5d,0xdf5f,0xdf61,0xdf65,0x0000,0xdf5b, +0xdf59,0xb86a,0x0000,0xdf60,0xdf64,0xdf5c,0xdf58,0x0000, +0xdf57,0x0000,0x0000,0x0000,0xdf62,0xdf5a,0xdf5e,0xb86b, +0x0000,0xb869,0xdf66,0xb867,0xdf63,0x0000,0xe372,0x0000, +0x0000,0x0000,0x0000,0x0000,0xbaee,0xe36a,0xbd78,0xe374, +0xbaf1,0xe378,0xbaf7,0xe365,0x0000,0x0000,0xe375,0xe362, +0x0000,0xe377,0xe366,0x0000,0xbafe,0xbafb,0xe376,0xe370, +0xbaed,0xbaf5,0xbaf4,0x0000,0xbaf3,0xbaf9,0x0000,0xe363, +0xbafa,0xe371,0xbaf6,0xbaec,0xe373,0xbaef,0xbaf0,0xbaf8, +0xe368,0xe367,0xe364,0x0000,0xe36c,0xe369,0xe36d,0xbafd, +0x0000,0xe379,0xbaf2,0xe36e,0xe36f,0x0000,0xe36b,0x0000, +0x0000,0x0000,0xbafc,0x0000,0x0000,0x0000,0x0000,0xe6e7, +0xbd70,0xbd79,0xbd75,0xe6e4,0x0000,0xbd72,0xbd76,0xe6f0, +0xbd6c,0xe6e8,0x0000,0xbd74,0x0000,0x0000,0xe6eb,0xe6e6, +0xbd73,0xbd77,0xe6e5,0x0000,0xbd71,0x0000,0xe6ef,0xbd6e, +0xe6ee,0xe6ed,0xbd7a,0xe572,0xbd6d,0x0000,0xe6ec,0xe6e3, +0x0000,0xbd7b,0xe6ea,0xbd6f,0x0000,0x0000,0x0000,0x0000, +/* 0x7e00 */ +0x0000,0x0000,0x0000,0xe6e9,0x0000,0x0000,0x0000,0x0000, +0xbfa2,0xbfa7,0xbf7e,0xead8,0xeacf,0xeadb,0xead3,0xead9, +0xbfa8,0xbfa1,0xeacc,0xead2,0xeadc,0xead5,0xeada,0xeace, +0x0000,0x0000,0xead6,0xbfa3,0xead4,0xbfa6,0xbfa5,0xead0, +0xead1,0xeacd,0xead7,0xbfa4,0xeade,0xeadd,0x0000,0x0000, +0x0000,0xedda,0xedd6,0xc15f,0x0000,0xedd0,0xc159,0xc169, +0xeddc,0xc161,0xc15d,0xedd3,0xc164,0xc167,0xedde,0xc15c, +0xedd5,0xc165,0xede0,0xeddd,0xedd1,0xc160,0xc15a,0xc168, +0xedd8,0xc163,0xedd2,0xc15e,0xeddf,0xc162,0xc15b,0xedd9, +0xc166,0xedd7,0x0000,0x0000,0xeddb,0x0000,0x0000,0x0000, +0xf06e,0xf074,0xc2b9,0xf077,0xc2b4,0xc2b5,0xf06f,0xf076, +0xf071,0xc2ba,0xc2b7,0x0000,0xf06d,0x0000,0xc2b6,0xf073, +0xf075,0xc2b8,0xf072,0xf070,0x0000,0x0000,0x0000,0x0000, +0xf2b8,0xc3b7,0xc3b8,0xc3b4,0x0000,0xc3b5,0x0000,0xf2b4, +0xf2b2,0x0000,0xf2b6,0xc3ba,0xf2b7,0xf2b0,0xf2af,0xf2b3, +0xf2b1,0xc3b6,0xf2b5,0xf4ac,0xc47e,0xc47d,0xf4ad,0x0000, +0xf4af,0xf4ae,0xc4a1,0x0000,0x0000,0x0000,0xf5eb,0xf5e8, +0xf5e9,0x0000,0xf5e7,0xf5ea,0xc4f2,0xf5ec,0x0000,0xc4f1, +0x0000,0xf742,0x0000,0xc5d5,0xc5d7,0xf7ee,0xc5d6,0xf8b9, +0xf940,0xf942,0xf8fe,0xf941,0xc66c,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, +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,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, +/* 0x7f00 */ +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,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa6ce,0x0000, +0xacfb,0xd26f,0xafca,0x0000,0x0000,0xb2da,0xdafc,0xdafd, +0x0000,0x0000,0x0000,0xeadf,0xc16a,0xede1,0x0000,0x0000, +0xc2bb,0x0000,0xf2ba,0xf2b9,0xc4a2,0xf5ed,0x0000,0xf743, +0xc5f8,0xca49,0x0000,0x0000,0xaac9,0xa875,0x0000,0x0000, +0xd04d,0x0000,0x0000,0xd360,0xd35b,0xd35f,0xd35d,0xafcb, +0xd35e,0xd35c,0x0000,0xd6f1,0x0000,0xdafe,0xdb40,0xdf69, +0xdf6a,0xb86e,0xb86f,0xdf68,0xdf6b,0xdf67,0xb86d,0x0000, +0xbb40,0x0000,0xb870,0xe37a,0x0000,0xbd7c,0xe6f1,0xbd7d, +0x0000,0xbfa9,0xeae2,0xeae0,0xeae1,0xede4,0xede3,0xede2, +0x0000,0x0000,0x0000,0xf2bb,0x0000,0xc3b9,0xf2bc,0xf744, +0xc5f9,0xf8ba,0xa6cf,0xaacb,0xaaca,0xd04f,0xacfc,0x0000, +0x0000,0xd04e,0xd362,0x0000,0xafcc,0xd6f2,0xd361,0x0000, +0x0000,0x0000,0xb2dc,0xd6f5,0xd6f3,0xd6f4,0xb2db,0x0000, +0xdb42,0xdb43,0xdb41,0x0000,0xb873,0xdf6d,0xdf6c,0xdf6e, +0xb872,0xb871,0x0000,0x0000,0xe6f2,0xe6f4,0x0000,0xbd7e, +0xe6f3,0xeae3,0xbfaa,0xf079,0x0000,0xf078,0xc3bb,0xf2bd, +0xc3bd,0xc3bc,0xf4b0,0xf5ee,0xc4f3,0xa6d0,0xd050,0xacfd, +0xd365,0xafce,0xd364,0xd363,0x0000,0xafcd,0x0000,0xd6fb, +0x0000,0xd6fd,0xd6f6,0xd6f7,0xb2dd,0xd6f8,0xb2de,0xd6fc, +0xd6f9,0xd6fa,0xb2df,0x0000,0xb5be,0xb5bf,0x0000,0xdb44, +0x0000,0x0000,0x0000,0xdf6f,0xdf70,0x0000,0xe37e,0xbb43, +0xbb41,0xbb42,0xe37b,0xe37c,0x0000,0xe37d,0xe6f9,0x0000, +0xe6fa,0xbda1,0xe6f7,0xe6f6,0xe6f8,0xe6f5,0xbfad,0xeae4, +0xbfab,0xbfac,0xede6,0xc16b,0xede5,0xefa8,0x0000,0xf07a, +0xf07b,0xc2bc,0x0000,0xc2bd,0xc16c,0xf2be,0xf2bf,0xf4b1, +0xc4a3,0xa6d1,0x0000,0xa6d2,0xacfe,0xaacc,0xafcf,0xd051, +0x0000,0x0000,0x0000,0xb5c0,0xa6d3,0xad41,0xd052,0xd053, +0xad40,0xad42,0xa6d4,0x0000,0xd054,0xafd1,0xd366,0xafd3, +0xafd0,0xafd2,0x0000,0xd741,0xb2e0,0x0000,0xd740,0xd6fe, +0x0000,0xdf71,0x0000,0x0000,0xe3a1,0x0000,0xbda2,0x0000, +0xbfae,0xeae6,0xeae5,0x0000,0xede7,0x0000,0x0000,0x0000, +0xf5ef,0x0000,0x0000,0xa6d5,0xcb73,0xcdaa,0xad43,0xd055, +0x0000,0xd368,0x0000,0x0000,0x0000,0xafd4,0xd367,0xafd5, +0x0000,0x0000,0x0000,0xd743,0x0000,0x0000,0xb2e2,0xd742, +0xd744,0x0000,0xb2e1,0x0000,0x0000,0x0000,0x0000,0xdb46, +0xdb47,0xdb45,0xb5c1,0x0000,0x0000,0x0000,0xb874,0x0000, +0xb875,0x0000,0xbb45,0x0000,0xe3a3,0xe3a2,0xbb44,0x0000, +0x0000,0x0000,0x0000,0x0000,0xe6fb,0x0000,0x0000,0xe6fc, +0x0000,0x0000,0x0000,0x0000,0xeae7,0x0000,0x0000,0xc170, +0xc16f,0xc16d,0xc16e,0xc171,0x0000,0xf07c,0xc2bf,0xc2be, +0xf2c0,0xf4b2,0x0000,0x0000,0x0000,0xc5a5,0xc5a4,0xa6d6, +0x0000,0x0000,0xd1fb,0x0000,0xb877,0xb5c2,0xb876,0xbb46, +0x0000,0xa6d7,0xc9a9,0xa6d8,0xa6d9,0x0000,0x0000,0xcdab, +0xcb76,0x0000,0xcb77,0xa877,0x0000,0xcb74,0xa876,0x0000, +0xa879,0xcb75,0xa87b,0xa87a,0xcb78,0xa878,0x0000,0x0000, +0x0000,0xaad1,0xaacf,0xcdad,0x0000,0xaace,0x0000,0x0000, +0x0000,0xaad3,0xaad5,0xaad2,0x0000,0xcdb0,0xcdac,0xaad6, +0x0000,0xaad0,0xa87c,0x0000,0xaad4,0xcdaf,0x0000,0x0000, +0xcdae,0x0000,0xaacd,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xd05b,0xad47,0xad48,0xd05d,0x0000,0xd057, +0xd05a,0xd063,0xd061,0x0000,0xad49,0xd067,0xad4c,0xd064, +0xd05c,0xd059,0x0000,0x0000,0xdb49,0xd062,0xad44,0xd065, +0xd056,0xd05f,0xad46,0xad4b,0xd060,0xad4f,0xad4d,0x0000, +0xd058,0xad4a,0x0000,0xd05e,0xad4e,0xad45,0xd066,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xafda,0x0000,0xafe3, +0xafd8,0xafd6,0xd36a,0xafde,0xafdb,0xd36c,0x0000,0x0000, +0xafdd,0xd36b,0xd369,0xd36e,0xafe2,0xafe0,0xdb48,0x0000, +0xd36f,0xd36d,0xafd7,0x0000,0x0000,0xafd9,0xafdc,0x0000, +0xafdf,0x0000,0xafe1,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xd74e,0xb2e4,0x0000, +0xd745,0xd747,0x0000,0xd748,0x0000,0xd750,0xd74c,0xd74a, +0x0000,0xd74d,0xd751,0xb2e5,0xb2e9,0xd746,0x0000,0xd74f, +0x0000,0xb2e7,0x0000,0xb2e6,0xd74b,0xd749,0x0000,0xb2e3, +0xb2e8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xb5c8,0xdb51,0x0000,0x0000,0xdb4f,0xb5ca,0x0000, +0x0000,0x0000,0x0000,0xdb4a,0xdfa1,0x0000,0xb5c9,0xdb4e, +0x0000,0x0000,0xdb4b,0xb5c5,0xb5cb,0xdb50,0xb5c7,0xdb4d, +0xbb47,0xb5c6,0xdb4c,0xb5cc,0xb5c4,0xb5c3,0x0000,0x0000, +0x0000,0x0000,0x0000,0xdf77,0xdf75,0x0000,0xdf7b,0x0000, +0xdf73,0xdfa2,0xdf78,0x0000,0xdf72,0xb87b,0xb8a3,0xdf7d, +0x0000,0xdf76,0x0000,0xb87e,0x0000,0x0000,0xb87c,0xdf7e, +0xb879,0xb878,0xdf79,0xb87d,0xb5cd,0x0000,0xdf7c,0xdf74, +0xb87a,0xb8a1,0xb8a2,0x0000,0x0000,0x0000,0x0000,0xbb4c, +0xbb48,0x0000,0xbb4d,0xe3a6,0x0000,0x0000,0xe3a5,0xe3a7, +0xbb4a,0xe3a4,0xbb4b,0xe3aa,0xe3a9,0xe3a8,0x0000,0xbb49, +0x0000,0x0000,0x0000,0x0000,0x0000,0xe741,0x0000,0xe744, +0xbda8,0xe743,0xbda7,0xbda3,0xbda4,0xbda5,0xe740,0xe6fe, +0xbda6,0x0000,0xe742,0xe6fd,0x0000,0x0000,0xeae9,0xeaf3, +0xbfb1,0xbfb0,0x0000,0xeaed,0xeaef,0x0000,0xeaea,0x0000, +0xeaee,0xeae8,0xeaf1,0xbfaf,0xeaf0,0xeaec,0x0000,0xeaf2, +0x0000,0xeaeb,0xc174,0xede8,0xedee,0xc178,0xc17a,0xc177, +0xc176,0x0000,0xc175,0xc173,0xede9,0xedec,0xc172,0xeded, +0x0000,0xc179,0xedeb,0x0000,0xedea,0xc2c0,0x0000,0xc2c1, +0xf0a1,0xf07d,0xf07e,0x0000,0x0000,0xf2c2,0x0000,0xf2c1, +0xc3be,0xf4b4,0xc4a4,0xf4b3,0x0000,0xf5f0,0xf745,0xc5a6, +0xf943,0xf944,0xc5d8,0xa6da,0x0000,0xaad7,0xdb52,0xbb4e, +0xc17b,0xedef,0xa6db,0x0000,0xafe5,0xafe4,0xdb53,0x0000, +0x0000,0x0000,0xeaf4,0xa6dc,0xad50,0x0000,0x0000,0xdb54, +0xdb55,0xdb56,0xbb4f,0xbfb2,0xa6dd,0x0000,0xaad8,0xd068, +0xafe6,0xd370,0xb2ea,0x0000,0xdb57,0xb8a4,0x0000,0xbb50, +0xbfb3,0xc17c,0xc2c2,0xf4b5,0xa6de,0xaad9,0x0000,0x0000, +0xafe7,0xd752,0xb5ce,0x0000,0xbb51,0xe3ab,0xe745,0x0000, +0x0000,0x0000,0x0000,0xa6df,0xb5cf,0xdfa3,0xbb52,0xa6e0, +0xcdb1,0xd069,0xad51,0x0000,0x0000,0xd372,0x0000,0x0000, +0xafea,0x0000,0xafe8,0xafe9,0xafeb,0x0000,0x0000,0xd371, +0x0000,0x0000,0xd757,0xd754,0xd756,0xb2eb,0xb2ed,0xb2ec, +0xd753,0xb2ee,0xd755,0x0000,0xdb58,0xdb59,0x0000,0xdb5a, +0xdfa6,0x0000,0xdfa7,0x0000,0xdfa5,0xdfa8,0x0000,0xb8a5, +0x0000,0xdfa4,0x0000,0xbb53,0x0000,0x0000,0xe74a,0xe746, +0xe749,0xe74b,0xe748,0xe747,0x0000,0xeaf5,0xeaf6,0xeaf7, +0xbfb4,0xbfb5,0xedf1,0xedf0,0xedf2,0x0000,0xf0a3,0xf0a2, +0x0000,0xf2c4,0x0000,0xf2c5,0xf2c3,0x0000,0xc4a5,0x0000, +0xf4b6,0xf4b7,0x0000,0xf746,0xf7ef,0xf8bb,0xa6e1,0xa87d, +0x0000,0xc17d,0xa6e2,0x0000,0xd758,0xdb5b,0x0000,0xc641, +0xca4a,0x0000,0x0000,0x0000,0xca4b,0xca4d,0xa6e3,0xca4e, +0xca4c,0x0000,0x0000,0xcba2,0xcba3,0xcb7b,0x0000,0x0000, +0x0000,0x0000,0xcba1,0xa8a1,0x0000,0xa8a2,0xcb7c,0xcb7a, +0xcb79,0xcb7d,0xa87e,0xcb7e,0xd06a,0x0000,0x0000,0x0000, +0xcdb6,0xaadc,0xcdb5,0xcdb7,0x0000,0xaadb,0xcdbc,0xaadf, +0xcdb2,0xcdc0,0xcdc6,0xaae6,0xcdc3,0xaae3,0x0000,0xcdb9, +0xcdbf,0xcdc1,0x0000,0xcdb4,0xaae2,0xaadd,0xcdba,0xaae4, +0xaae7,0xaae1,0x0000,0xaada,0xcdbe,0xcdb8,0xcdc5,0xaae9, +0xaae5,0xaae0,0xcdbd,0xafec,0xcdbb,0xaade,0xaae8,0x0000, +0xcdb3,0x0000,0xcdc2,0xcdc4,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xad62,0xad5c,0xad64,0xad61,0xd071,0xd074,0xad5d, +0x0000,0xd06b,0x0000,0xad56,0xad60,0x0000,0xad63,0xad65, +0xd0a2,0xd077,0x0000,0xad55,0xd0a1,0xad59,0xad57,0xad52, +0xd06f,0x0000,0xd07e,0xd073,0xd076,0xd0a5,0x0000,0xad66, +0xd07d,0xad5e,0xd078,0xd0a4,0xd075,0xd079,0xd07c,0x0000, +0x0000,0xd06d,0xd0a3,0xd07b,0x0000,0x0000,0xd06c,0x0000, +0xd070,0xad5f,0xad5a,0xad53,0xad58,0xad54,0xad67,0xd06e, +0xd3a5,0xad5b,0x0000,0x0000,0xd07a,0xce41,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd3a8,0xaffa, +0x0000,0xd376,0x0000,0xd3a3,0xd37d,0x0000,0xd3b2,0x0000, +0xd3aa,0x0000,0xd37e,0x0000,0xd3a9,0xd378,0xd37c,0xd3b5, +0xaffd,0xd3ad,0xd3a4,0xafed,0xd3b3,0xd374,0x0000,0xd3ac, +0x0000,0xaffc,0xaff7,0xd373,0xaff5,0xaff4,0xaff9,0xd3ab, +0xaff1,0xaff8,0xd072,0xdb5c,0xd3a6,0x0000,0x0000,0xd37a, +0xaffb,0xd37b,0xd3a1,0xaffe,0xd375,0xd3af,0x0000,0xd3ae, +0xd3b6,0xaff3,0xaff0,0xd3b4,0xd3b0,0xd3a7,0xd3a2,0xaff6, +0xaff2,0xd377,0xafee,0xd3b1,0xafef,0x0000,0xd379,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,0xd75e,0xd760,0xd765,0xd779,0xb2fc, +0xb2f2,0x0000,0xd75d,0xb2fd,0xb2fe,0xd768,0xd76f,0xd775, +0x0000,0xd762,0x0000,0xd769,0x0000,0x0000,0xb340,0xd777, +0xd772,0xb2fa,0xb2f8,0xd76e,0xd76a,0xd75c,0xb2ef,0xd761, +0xd759,0x0000,0xb2f7,0xb2f9,0xd766,0xd763,0xb2f4,0xd773, +0xb2f1,0xd764,0xd77a,0xd76c,0x0000,0xd76b,0xb2f0,0x0000, +0xb2fb,0x0000,0xb2f3,0xd75a,0xd75f,0xd770,0xd776,0xb341, +0xd75b,0xd767,0xd76d,0xb2f6,0x0000,0x0000,0xd778,0xd771, +0xd774,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xb2f5,0x0000,0xdb6c, +0xdb60,0xb5d7,0xdb7d,0xdba7,0xdbaa,0xb5d5,0xdb68,0xdba3, +0xdb69,0xdb77,0xb5e2,0xdb73,0xb5df,0x0000,0xdb74,0xdb5d, +0x0000,0xdba4,0x0000,0x0000,0xb5e8,0xdba1,0xdb75,0xdbac, +0xdb70,0xdfc8,0x0000,0xdbaf,0xb5e6,0xdb6e,0xdb7a,0xb5e9, +0xb5d4,0xdb72,0xdbad,0xdb6b,0xdb64,0xdb6f,0x0000,0xdb63, +0xdb61,0xb5d0,0xdba5,0xdb6a,0xdba8,0x0000,0xdba9,0xb5d8, +0xb5dd,0xb5d9,0xb5e1,0xdb7e,0xb5da,0xdb76,0xdb66,0x0000, +0xb5d2,0xdb5e,0xdba2,0xdbab,0xdb65,0xb5e0,0xdbb0,0xdb71, +/* 0x8400 */ +0x0000,0xdb6d,0x0000,0xb5d1,0xb5e5,0x0000,0xdb7c,0xb5e7, +0x0000,0xdb78,0xb5dc,0xb5d6,0xb5de,0xb5d3,0xb5e4,0xdb79, +0xdb67,0xdb7b,0xdb62,0xdba6,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xdbae,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xdb5f,0x0000,0x0000,0x0000,0x0000, +0x0000,0xdfc7,0x0000,0xdfdd,0xb855,0xdfcc,0x0000,0xdfca, +0xdfb5,0xb8a9,0xdfc5,0xdfd9,0xdfc1,0xb8b1,0xdfd8,0xdfbf, +0xb5e3,0xdfcf,0xdfc0,0xdfd6,0xb8b0,0xb8a8,0x0000,0xdfaa, +0xdfb2,0x0000,0xdfcb,0xdfc3,0xdfdc,0xdfc6,0xb8b6,0xdfd7, +0x0000,0xb8ad,0x0000,0xdfc9,0xdfd1,0xdfb6,0xdfd0,0x0000, +0xdfe1,0xdfb1,0xdfd2,0x0000,0xdfdf,0x0000,0xdfab,0xb5db, +0x0000,0xdfb9,0xdfb8,0xb8af,0x0000,0xdfbc,0xdfbe,0xdfcd, +0xdfde,0xb8b2,0x0000,0xb8b3,0x0000,0xdfb0,0xb8ab,0xdfb4, +0xdfda,0xb8b4,0x0000,0xb8ac,0xb8ae,0xb8b5,0xdfe0,0xdfd3, +0xdfce,0x0000,0x0000,0xdfbb,0xdfba,0xb8aa,0xdfac,0xb8a7, +0xdfc4,0xdfad,0xdfc2,0x0000,0x0000,0xdfb7,0xdfdb,0x0000, +0x0000,0x0000,0xb8a6,0x0000,0x0000,0x0000,0xdfb3,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xdfaf,0xdfd5,0xdfae, +0xbb60,0xe3d3,0x0000,0x0000,0xe3c2,0x0000,0x0000,0xe3ac, +0xe3ca,0xbb58,0xe3bb,0xe3c5,0xbb5b,0xe3be,0xbb59,0xe3af, +0xe3cd,0xe3ae,0xe3c1,0x0000,0xe3ad,0x0000,0x0000,0xe3bf, +0xe3c8,0xe3c6,0xe3ba,0xe3b5,0xe3b3,0x0000,0xe3b4,0xe3c7, +0xe3d2,0xe3bc,0xbb5a,0x0000,0xe3b7,0x0000,0xe3cb,0x0000, +0xbb5d,0xe3b6,0xe3b0,0xe3c0,0xbb61,0x0000,0x0000,0xbb55, +0xbb5e,0xe3b8,0xe3b2,0x0000,0xbb57,0xdfd4,0xbb56,0xe3c3, +0x0000,0xbb54,0xbb63,0xbb5c,0xe3c4,0xe3b9,0xe3b1,0xe3cc, +0xe3bd,0xbb62,0xe3d0,0xbb5f,0xe3cf,0x0000,0xe3c9,0xe3ce, +0x0000,0x0000,0x0000,0xe3d1,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe773, +0xe774,0xe767,0xe766,0xe762,0xbdb4,0x0000,0xbdac,0xe776, +0xe775,0xdfa9,0xe75f,0xe763,0xe75d,0x0000,0xe770,0xe761, +0x0000,0xe777,0xe75a,0xe758,0xe764,0xe76e,0xe769,0xbdb6, +0xe74f,0x0000,0xe76d,0x0000,0x0000,0x0000,0xbdb7,0xdfbd, +0xe75b,0xe752,0xe755,0xe77b,0xe75c,0xe753,0xe751,0xe74e, +0x0000,0xbdb0,0xe765,0xbdaf,0xbdb3,0xe760,0xe768,0xbda9, +0xe778,0xe77c,0xbdab,0x0000,0xe757,0xe76b,0xe76f,0xe754, +0xe779,0xbdb2,0x0000,0xbdb1,0xe74c,0xbdb5,0xe772,0xe756, +0xe76a,0xe750,0xe75e,0xe759,0xbdad,0xbdae,0xe76c,0xe77d, +0xe77a,0xe771,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xe74d,0x0000,0xbdaa,0xeb49,0x0000, +0xeb40,0xeb43,0x0000,0xbfbb,0xeb45,0xeaf9,0xeb41,0xeb47, +0xbfb8,0xbfbc,0xbfb6,0x0000,0x0000,0xeafb,0xeb4c,0x0000, +0x0000,0xeb46,0x0000,0xeafc,0xeb55,0xeb4f,0xeaf8,0xee46, +0xeafe,0xbfb7,0x0000,0xeb4a,0x0000,0xeb54,0xbfbf,0x0000, +0xeb51,0xeafd,0xeb44,0xeb48,0xeb42,0xeb56,0xeb53,0xeb50, +0xbfb9,0xbfba,0xbfbe,0xeafa,0xeb57,0xbfbd,0xeb4d,0x0000, +0x0000,0xeb4b,0x0000,0x0000,0x0000,0xeb4e,0xee53,0xee40, +0xee45,0xee52,0xee44,0xedfb,0xee41,0x0000,0xc1a2,0x0000, +0xedf4,0xee4d,0xee4f,0xedf3,0xc1a1,0xee51,0xee49,0xc1a8, +0xee50,0xee42,0xc1aa,0xedf9,0xeb52,0xee4a,0xee47,0xedf5, +0xee55,0xc1a4,0x0000,0x0000,0xc1a5,0xedf7,0xee48,0x0000, +0xee54,0xee4b,0xedfd,0xc1a7,0xc1a3,0xee4c,0xedfe,0xee56, +0xedf8,0xee43,0xee4e,0xedfa,0xedfc,0x0000,0xc2cb,0xedf6, +0xc1a9,0xc2c4,0xc17e,0x0000,0x0000,0x0000,0x0000,0xc1a6, +0xc2c8,0xf0b3,0x0000,0xf0a9,0xf0a4,0xf0aa,0xf0b4,0xf0b8, +0xf0b7,0xc2ca,0xc2c9,0x0000,0x0000,0xf0ab,0xf0b9,0xf0ae, +0xf0a6,0x0000,0xf0a8,0xf0a7,0xf0ad,0xf0b2,0xf0a5,0xf0ac, +0xf0b1,0xc2c7,0x0000,0xf0af,0x0000,0xc2c5,0xf0b0,0xc2c3, +0xc2c6,0xf2d5,0xf0b5,0x0000,0x0000,0xc3c2,0x0000,0xf2cd, +0xf2d1,0xf2c9,0xf2cc,0x0000,0xf2d4,0xc3c0,0xf2d9,0xf2d2, +0x0000,0xf2ca,0xf2da,0xf2d3,0xc3c3,0xc3c4,0xf2d7,0x0000, +0xf2cb,0xc3bf,0xc3c1,0xf2c6,0xf2ce,0xf2c8,0x0000,0xf2d8, +0xf2d6,0xf2c7,0xf2cf,0x0000,0x0000,0x0000,0xf4be,0xc3c5, +0xf2d0,0xc4a7,0xc4a9,0xc4a6,0x0000,0xf4c3,0xf4bb,0xf4b9, +0xf4bd,0xf4ba,0x0000,0x0000,0xf4bf,0xf4c1,0xc4aa,0xc4ac, +0x0000,0xf4c0,0xc4ad,0xc4ab,0xf4c2,0x0000,0x0000,0x0000, +0x0000,0xc4a8,0x0000,0x0000,0x0000,0x0000,0x0000,0xc4f4, +0xf5f1,0xf5f7,0xc4f6,0xf4bc,0xf5f6,0x0000,0xf5fd,0xf5f4, +0xf5fb,0xf5fa,0xf4b8,0xf5f5,0xf0b6,0xf5fe,0xf5f3,0xf5f8, +0x0000,0xf5fc,0xf5f2,0x0000,0xf74a,0xc4f5,0xf5f9,0x0000, +0x0000,0xf7f4,0xf74b,0xf749,0xf747,0xf748,0xf74c,0x0000, +0xc5d9,0xf7f2,0xf7f0,0xf7f5,0xf7f3,0x0000,0xf7f6,0xc5da, +0xf7f1,0x0000,0x0000,0xf8bc,0x0000,0x0000,0xf945,0xf946, +0xf947,0x0000,0x0000,0xf9c7,0xf9bd,0xca4f,0xaaea,0x0000, +0xad68,0x0000,0xd3b8,0xd3b7,0xb040,0xb342,0xd77c,0x0000, +0x0000,0xd77b,0x0000,0xb5ea,0xb8b8,0x0000,0xb8b7,0xb8b9, +0x0000,0xe3d4,0xe77e,0xeb58,0xeb5a,0xeb59,0x0000,0xc1ab, +0xee57,0xf0ba,0xf9a5,0xa6e4,0x0000,0xcdc9,0xcdca,0xcdc8, +0xcdc7,0xaaeb,0x0000,0xd0a9,0xd0a7,0x0000,0x0000,0xd0a6, +0x0000,0xad69,0xad6b,0xad6a,0xd0a8,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xd3c4,0xd3c1,0xd3bf, +0x0000,0x0000,0xb041,0xd3c2,0xb046,0xd3bc,0xd3cb,0x0000, +0xd3cd,0xd3bd,0x0000,0xb043,0xd3ce,0xd3c9,0xd3bb,0xd3c0, +0xd3ca,0xd3c6,0xd3c3,0x0000,0xb048,0xd3cc,0xd3be,0x0000, +0x0000,0xd3c7,0xd3b9,0xb047,0xb044,0xd3c5,0x0000,0xd3c8, +0xd3ba,0xb045,0xb042,0x0000,0x0000,0x0000,0x0000,0xb34c, +0xd7a5,0xb34b,0x0000,0xd7a8,0xd7ab,0xb348,0xb346,0xd77e, +0xd7a9,0xd7a7,0xd7a4,0xd7ac,0xd7ad,0xd7af,0xd7b0,0xd77d, +0xb345,0xd7a2,0xd7a1,0xd7ae,0xb347,0xd7a3,0xb349,0xb344, +0xd7a6,0xb34d,0x0000,0xb34a,0xd7aa,0x0000,0x0000,0x0000, +0xb5f1,0xdbbf,0x0000,0xdbb4,0xb5ee,0x0000,0xdfe7,0xdbbd, +0xdbb1,0xb5ec,0xdbb6,0xb5ef,0xdbba,0xdbb8,0xb5f2,0xb5eb, +0x0000,0x0000,0xdbb2,0xdbb5,0xb5f0,0x0000,0xdbb3,0x0000, +0xdbbe,0xdbbc,0xdbb7,0xdbb9,0xdbbb,0xb5ed,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xdfe8,0xdfee,0xdfe4, +0xdfea,0xb8ba,0xdfe6,0xb8c0,0x0000,0x0000,0xb8bf,0x0000, +0xb8be,0xdfed,0xb8c1,0xb8c2,0xdfe3,0xdff0,0xb8c3,0xb8bd, +0xb8bc,0xdfec,0xb8c4,0xdfe2,0xdfe5,0xdfef,0xdfeb,0x0000, +0x0000,0xe3f4,0xe3e9,0xb8bb,0x0000,0x0000,0x0000,0x0000, +0xbb6a,0xe3dd,0xe3f2,0xe3de,0xbb65,0x0000,0xe3db,0x0000, +0xe3e4,0xe3dc,0xbb67,0xe3d6,0xe3f1,0xbb68,0xe3ee,0xe3ef, +0xe3d7,0xbb6d,0xe3e6,0x0000,0xe3e0,0xe3e7,0xe3da,0x0000, +0xe3f3,0xe3eb,0xe3e5,0xe3d5,0xbb69,0xe3ec,0x0000,0xbb6c, +0xe3f0,0x0000,0xe3ea,0xbb66,0xe3e8,0x0000,0xe3e2,0xbb64, +0xe3d9,0xe3e1,0xe3ed,0xe3df,0x0000,0x0000,0xe3e3,0x0000, +0x0000,0x0000,0x0000,0x0000,0xbdc1,0xdfe9,0xe7b2,0xe7bb, +0xe7b1,0xe7ad,0xe7aa,0xbdc2,0xe7a8,0xbb6b,0xe7a1,0xbdc0, +0xe7a7,0xbdbf,0xe7ac,0xe7a9,0xe7b9,0xe7b4,0xe7ae,0xe7b3, +0xbdbb,0xe7ab,0xe7be,0xe7a2,0xe7a3,0xe7ba,0xbdbc,0xe7bf, +0xbdbe,0xe7c0,0xe7b0,0xe3d8,0xe7b6,0xe7af,0xe7b8,0xe7b5, +0x0000,0x0000,0x0000,0xe7a6,0xbdb9,0xe7bd,0xbdba,0xe7a4, +0xbdbd,0xeb64,0xe7b7,0xe7bc,0x0000,0x0000,0x0000,0x0000, +0x0000,0xeb61,0xbdb8,0xbfc0,0xeb6b,0xeb67,0x0000,0xeb65, +0xeb60,0xeb6f,0x0000,0x0000,0x0000,0xbfc4,0x0000,0xeb5c, +0xeb68,0xeb69,0xeb5f,0xeb5e,0xeb6c,0x0000,0xeb62,0xeb5d, +0xeb63,0x0000,0xeb6e,0xeb5b,0xeb6d,0xeb6a,0xbfc2,0xbfc1, +0x0000,0x0000,0xbfc3,0xeb66,0xf0cb,0x0000,0x0000,0x0000, +0x0000,0x0000,0xee59,0xc1b1,0xee5d,0xee5a,0xee61,0xee67, +0xee5c,0x0000,0xee70,0xc1ae,0xee6a,0xee5f,0xee6b,0xee66, +0xee6d,0xee5e,0xc1b3,0xc1b2,0xee60,0xee6e,0xee58,0xee6c, +0xc1ac,0x0000,0xee64,0xee63,0xee68,0xee5b,0xc1b0,0x0000, +0xc1b4,0xee62,0xee69,0xc1b5,0xee65,0x0000,0x0000,0x0000, +0x0000,0xc1ad,0xc1af,0xf0c7,0xf0c5,0x0000,0x0000,0xf0cc, +0xf0c9,0xf0cd,0x0000,0xf0be,0xf0c6,0xf0d1,0xee6f,0xf0c2, +0xc2cf,0xe7a5,0xf0bd,0xf0ca,0xf0c4,0xf0c1,0xf0bc,0xf0bb, +0xf0d0,0x0000,0xf0c0,0xf0bf,0xc2cd,0xf0c8,0x0000,0xc2cc, +0x0000,0x0000,0xc2ce,0xf0c3,0xf0cf,0x0000,0xf2de,0xf2df, +0x0000,0xc3c9,0xf2dc,0xc3c6,0xf2e4,0x0000,0xc3ca,0xf2e6, +0xf2db,0xf0ce,0xf2e8,0xf2dd,0x0000,0xc3c7,0xf2e3,0x0000, +0xf2e5,0xf2e0,0xf2e7,0xf2e2,0xf2e1,0xc3c8,0x0000,0x0000, +0xf4c5,0xf4c6,0x0000,0xf4c8,0xc4ae,0xc4af,0xf4c9,0xf4c7, +0x0000,0xf4c4,0x0000,0xf642,0xf645,0xf641,0x0000,0xc4fa, +0xf643,0xc4f9,0xc4f8,0xc4f7,0xf644,0xf751,0xf74f,0x0000, +0xf74e,0xf640,0xf750,0xf646,0xf74d,0x0000,0xf7f9,0xf7d7, +0xf7f7,0xc5db,0xf7f8,0xf7fa,0x0000,0xf8bf,0xc5fa,0xf8be, +0xf8bd,0xc5fb,0x0000,0xc65a,0xf96e,0xf9a7,0xf9a6,0xf9a8, +0xa6e5,0xd0aa,0x0000,0xd3cf,0xd3d0,0x0000,0x0000,0x0000, +0xdbc0,0x0000,0xf647,0xf8c0,0xa6e6,0xad6c,0xd0ab,0x0000, +0x0000,0x0000,0xd7b1,0xb34e,0x0000,0xdbc2,0xdbc1,0xb5f3, +0x0000,0xb8c5,0xe7c1,0xbdc3,0x0000,0xbdc4,0x0000,0x0000, +0x0000,0xbfc5,0xc5fc,0xa6e7,0x0000,0x0000,0x0000,0xd0ac, +0xaaed,0xd0ae,0xd0ad,0xad6d,0x0000,0xd3d1,0x0000,0xd3d8, +0xb049,0xd3d6,0xd3d4,0x0000,0xd3db,0xd3d2,0xd3d3,0xb04a, +0x0000,0xb04e,0x0000,0x0000,0xd3dc,0xb04d,0xd3da,0xd3d7, +0xd3d5,0xb04b,0xb04c,0xd3d9,0x0000,0x0000,0x0000,0x0000, +0xb350,0xd7b2,0x0000,0xb355,0xd7c2,0xb354,0xd7c4,0x0000, +0x0000,0xd7b8,0xb352,0xd7c3,0x0000,0xd7b3,0xb353,0xd7bf, +0xd7bb,0xd7bd,0xd7b7,0xd7be,0x0000,0x0000,0xb34f,0xd7ba, +0x0000,0xd7b9,0xd7b5,0x0000,0xd7c0,0x0000,0x0000,0xd7bc, +0xd7b4,0x0000,0xd7b6,0xb351,0xd7c1,0x0000,0x0000,0x0000, +0x0000,0xb5f6,0xdbcd,0x0000,0x0000,0x0000,0xdbc9,0xdbcb, +0xdbc6,0xdbc5,0xdbc3,0x0000,0xdbca,0xdbcc,0xdbc8,0x0000, +0xdbc7,0xb5f4,0xb5f5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xdbcf,0xb8cd,0xdff2,0xdff8,0xdff3,0xdff4,0xf9d8, +0xdff9,0x0000,0xb8cf,0x0000,0xb8c7,0xb8ce,0xdff1,0xdbc4, +0xb8ca,0xb8c8,0xdff7,0xdff6,0xb8c9,0xb8cb,0xdff5,0xb8c6, +0x0000,0xb8cc,0x0000,0x0000,0x0000,0x0000,0x0000,0xe3f6, +0xbb74,0x0000,0x0000,0xe442,0xe441,0x0000,0xe3fb,0xbb76, +0xe440,0xe3f7,0xe3f8,0xbb6e,0xbb70,0x0000,0xe3fd,0xe3f5, +0xbb72,0xbb71,0xe3f9,0xe3fe,0xe3fc,0xbb73,0xe3fa,0x0000, +/* 0x8900 */ +0x0000,0xdbce,0xbb6f,0x0000,0x0000,0xe7c2,0xe7c9,0xbdc6, +0x0000,0xe7cd,0xbdca,0xe7c5,0xe7c3,0x0000,0xe7cc,0x0000, +0xbdc5,0xe7cb,0xbdc7,0xbdc8,0xe7c4,0xbdc9,0xe7ca,0xe7c6, +0xe7c7,0xe7c8,0xbb75,0x0000,0x0000,0x0000,0xeb70,0xeb7c, +0x0000,0xbfca,0xeb77,0xeb79,0x0000,0xbfc8,0xeb71,0xeb75, +0x0000,0xeb78,0xbfc6,0xbfc9,0xeb7b,0xeb73,0xeb74,0xeb7a, +0xeb72,0xeb76,0xbfc7,0xee72,0x0000,0xee71,0xc1b7,0xee77, +0xc1b9,0x0000,0x0000,0xc1b6,0xee73,0xc1ba,0xee74,0x0000, +0x0000,0xee75,0xee78,0x0000,0xc1b8,0x0000,0xf0d6,0x0000, +0x0000,0xf0d9,0x0000,0xf0d3,0xf0d5,0x0000,0x0000,0xf0d4, +0xf0d7,0xf0d8,0xee76,0xf0d2,0x0000,0x0000,0xc3cd,0xf2ec, +0xf2ef,0xf2f1,0xf2ea,0xf2eb,0xf2ee,0xf2f0,0xc3ce,0xc3cc, +0xc3cb,0xf2ed,0xf2e9,0xf4ca,0xc4b0,0x0000,0xf4cb,0x0000, +0x0000,0xf649,0xc4fb,0xf64b,0xc4fc,0xf648,0xf64a,0xc5a8, +0x0000,0xf752,0xc5a7,0xf7fd,0xf7fc,0x0000,0xf7fb,0x0000, +0x0000,0xf948,0xf949,0xf94b,0xf94a,0x0000,0xca50,0xa6e8, +0x0000,0xad6e,0xd7c5,0xb5f7,0x0000,0xdffa,0xc2d0,0x0000, +0xf2f2,0x0000,0x0000,0xa8a3,0x0000,0x0000,0x0000,0xb357, +0x0000,0x0000,0x0000,0xb356,0x0000,0xdbd0,0xb5f8,0xdbd2, +0xdbd1,0x0000,0x0000,0xdffb,0xb8d0,0xe443,0xe446,0xe445, +0x0000,0xe444,0xe7ce,0xe7d0,0xe7cf,0x0000,0xbfcc,0x0000, +0x0000,0x0000,0xbfcb,0x0000,0xc1bb,0xee79,0xee7b,0xee7a, +0x0000,0x0000,0xc2d1,0x0000,0x0000,0x0000,0xf2f4,0xf2f3, +0x0000,0xf4cc,0xc4b1,0x0000,0x0000,0xc4fd,0xf754,0xf753, +0xc65b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xa8a4,0xd0af,0xad6f,0xd7c8,0xd7c6,0x0000, +0x0000,0xd7c7,0xdbd4,0xdbd5,0xe043,0xdbd3,0x0000,0xdffc, +0xe041,0xe040,0xe042,0xb8d1,0xdffe,0xdffd,0xe044,0x0000, +0xe449,0xe447,0x0000,0xe448,0xe7d3,0xe7d1,0x0000,0x0000, +0xe7d2,0xeb7d,0xee7c,0xee7d,0xc2d2,0x0000,0xf2f5,0xf4cd, +0xc4b2,0x0000,0xf64c,0xf755,0xc5a9,0x0000,0xf7fe,0xf94c, +0xa8a5,0x0000,0xad71,0xad72,0xd0b0,0x0000,0x0000,0xd0b1, +0xad70,0x0000,0xb054,0x0000,0xb052,0x0000,0xb051,0xb058, +0xb050,0xb059,0xd3dd,0xb056,0x0000,0xb053,0xb057,0xb055, +0xb04f,0x0000,0x0000,0xb35f,0x0000,0xb359,0xd7cc,0xb35e, +0x0000,0x0000,0xb360,0xb35a,0x0000,0xb35b,0x0000,0xd7ca, +0x0000,0x0000,0xb358,0x0000,0xd7cb,0xb35d,0x0000,0x0000, +0xd7c9,0xb35c,0x0000,0x0000,0xb644,0x0000,0xb646,0x0000, +0x0000,0xdbd8,0xb645,0xb5f9,0xb5fd,0x0000,0xb8e4,0xe049, +0xdbda,0xb5fe,0x0000,0x0000,0xdbdd,0xdbde,0xb643,0x0000, +0xdbe0,0x0000,0xdbe2,0x0000,0xdbe3,0xdbd7,0xdbd6,0xdbe4, +0xb642,0xdbe1,0xdbdf,0x0000,0xb640,0xb5fb,0xb647,0xdbdb, +0xdbdc,0xdbd9,0x0000,0xb641,0x0000,0x0000,0xb5fc,0x0000, +0xb5fa,0xe048,0xb8df,0xb8da,0x0000,0x0000,0xb8d5,0x0000, +0xb8e5,0xb8d6,0x0000,0xb8d2,0xb8e1,0xb8de,0xb8e0,0x0000, +0xb8d7,0xb8dc,0xb8d3,0xb8d4,0xe050,0xe04d,0xe045,0xe04a, +0x0000,0xb8e2,0xe051,0xb8e3,0xb8d9,0x0000,0x0000,0xe047, +0x0000,0xe04f,0xe04b,0xe04e,0xe04c,0xb8dd,0xe046,0xb8d8, +0x0000,0x0000,0x0000,0xe44c,0xbb78,0xbb7b,0x0000,0xe44e, +0x0000,0xbba5,0xe44d,0xbb7d,0x0000,0xbdcf,0xe44f,0x0000, +0xbba4,0xe44b,0xbba6,0x0000,0x0000,0x0000,0xbb79,0x0000, +0xb8db,0xbb7c,0x0000,0xbb7a,0xbb7e,0xbba2,0xbb77,0xbba7, +0xbba3,0x0000,0xbba1,0xe44a,0x0000,0x0000,0x0000,0x0000, +0xbdd6,0x0000,0xbdd2,0x0000,0x0000,0x0000,0xbdd9,0x0000, +0xe7d6,0xbdda,0xe7e2,0xe7db,0xbdcb,0xe7e3,0xe7dd,0xbdd5, +0xe7de,0x0000,0xbdd4,0xe7e1,0xbdce,0xe7df,0xe7d5,0xbdcd, +0xebaa,0xbdd3,0x0000,0xbdd0,0x0000,0xbdd8,0x0000,0xe7d4, +0x0000,0xe7d8,0xbdcc,0xe7d7,0xe7d9,0xe7da,0xbdd7,0xe7dc, +0xe7e0,0xe7e4,0x0000,0xbddb,0xbfd2,0xeba5,0xebab,0xeba8, +0xeb7e,0xebac,0xeba1,0x0000,0xeba7,0x0000,0xbfcd,0xbfd3, +0xebad,0x0000,0x0000,0xbfcf,0x0000,0xbfd9,0xbfd4,0xebaf, +0xeba9,0xbfd0,0xeba2,0xbfda,0xeba3,0xeba4,0xbfdb,0xbfd8, +0xbdd1,0x0000,0xbfce,0xebb0,0xbfdc,0x0000,0xbfd5,0xebae, +0xbfd1,0xbfd6,0xbfd7,0x0000,0xc1c3,0xeea4,0xeead,0xeeaa, +0xeeac,0x0000,0xc1c0,0xeea5,0x0000,0xeeab,0xc1bc,0xeea7, +0xc1c4,0xeea3,0xeea8,0xeeaf,0xeba6,0xeea9,0xeea2,0xc1bd, +0xeea1,0xc1be,0xeeb0,0xc1bf,0xeeae,0xc1c2,0xee7e,0x0000, +0xc1c1,0x0000,0xeea6,0xf0dc,0xf0ea,0xf0e5,0xf0e7,0xf0db, +0xc2d3,0x0000,0xf0da,0xc2d6,0xc2d5,0x0000,0xf0e9,0xf0e1, +0xf0de,0xf0e4,0x0000,0xf0dd,0x0000,0xf0df,0xf0e8,0xf0e6, +0x0000,0xc2d4,0xf0ed,0xf0eb,0xf0e2,0xf0ec,0xf0e3,0x0000, +0xf2f9,0xc3cf,0xf341,0x0000,0x0000,0xf64f,0xc3d6,0xf0e0, +0xf2f7,0xc3d2,0xf2f8,0xf2fd,0x0000,0x0000,0xc3d4,0xc3d5, +0xf2f6,0xf340,0xf342,0xf2fa,0xf2fc,0xf2fe,0xf2fb,0xf343, +0xc3d1,0xc3d7,0xc3d3,0x0000,0xc3d0,0xf4d0,0x0000,0xc4b7, +0xf4ce,0x0000,0x0000,0xf4d2,0x0000,0xf4d3,0xc4b5,0xf4d4, +0xf4d1,0x0000,0xf4cf,0xc4b8,0xc4b4,0xf4d5,0x0000,0xc4b6, +0xc4b3,0x0000,0x0000,0x0000,0xc4fe,0x0000,0x0000,0xc540, +0xf64e,0xf64d,0xf650,0xf651,0x0000,0xc541,0xf756,0xf75b, +0xc5aa,0x0000,0xf758,0x0000,0xf757,0xf75a,0xf759,0x0000, +0xf843,0x0000,0xc5dc,0xf842,0xf840,0x0000,0xf841,0x0000, +0x0000,0x0000,0xc5fe,0xc5fd,0xf8c1,0xf8c2,0xc640,0x0000, +0xf94d,0xf94e,0xc667,0x0000,0xc66d,0x0000,0xf9a9,0xf9c8, +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,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,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, +/* 0x8c00 */ +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,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa8a6, +0x0000,0xd7cd,0x0000,0xd7ce,0xe052,0xe450,0xe7e5,0xc1c6, +0x0000,0xc1c5,0xf0ee,0xf344,0x0000,0xf844,0xa8a7,0xd3de, +0xb05a,0xb361,0xe054,0xe053,0xbddc,0xe7e6,0xbddd,0xeeb1, +0xc2d7,0x0000,0x0000,0x0000,0xc676,0xa8a8,0xcdcb,0xd3df, +0x0000,0x0000,0xb362,0x0000,0xd7cf,0xd7d0,0x0000,0xdbe5, +0x0000,0xb648,0xb8e6,0x0000,0xe056,0xe055,0xe057,0x0000, +0xe451,0xe452,0xbba8,0xbfdd,0xbdde,0xbfde,0x0000,0xeeb5, +0xeeb2,0xeeb4,0xeeb3,0xc1c7,0x0000,0xf0ef,0xf346,0xf345, +0xcba4,0xb05c,0xb05b,0xd3e0,0x0000,0xd7d1,0x0000,0x0000, +0xdbe7,0xdbe6,0xb649,0x0000,0xe059,0xe05a,0xe058,0x0000, +0x0000,0xb8e8,0xb8e7,0x0000,0xbbaa,0xbba9,0x0000,0xe7e7, +0xebb3,0xebb1,0xebb2,0xbfdf,0xeeb7,0xeeb6,0x0000,0xf0f2, +0xf0f1,0xf0f0,0xf347,0x0000,0xf9aa,0xa8a9,0xad73,0x0000, +0xad74,0xb05d,0xb05e,0xd3e2,0xd3e1,0xd7d2,0x0000,0xb368, +0xb366,0xb363,0xb367,0xb365,0xb364,0x0000,0x0000,0xb64a, +0xdbea,0x0000,0xb8ed,0xb64c,0xb651,0xdbec,0xb653,0xb652, +0xb655,0xdbeb,0xdbe8,0xb64f,0xb64b,0xb64d,0xdbe9,0xb654, +0xb650,0xb64e,0xb8ef,0xb8ee,0xb8ec,0xb8f0,0x0000,0xb8ea, +0xb8eb,0x0000,0xb8e9,0x0000,0xe05b,0x0000,0x0000,0xe454, +0x0000,0xbbac,0xbbad,0xbbab,0x0000,0xe453,0x0000,0xe455, +0x0000,0xe7ea,0xe7ec,0x0000,0xbde7,0xe7ed,0xbde0,0xe7e9, +0xbddf,0xbde9,0xbde5,0xbde6,0xbde2,0xe7e8,0xbde1,0xe7ee, +0xe7eb,0x0000,0xbde8,0x0000,0xbde3,0xbde4,0xebb5,0x0000, +0xebb7,0xebb6,0x0000,0xebb8,0xbfe0,0xebb4,0x0000,0x0000, +0xc1cb,0xeeb8,0xc1c8,0xc1cc,0xc1ca,0xc1c9,0xf0f3,0x0000, +0xf0f6,0x0000,0xf0f5,0x0000,0xf0f4,0xc2d8,0xf348,0xf349, +0xc3d8,0xf34a,0xc3d9,0x0000,0x0000,0xc4ba,0x0000,0xc4b9, +0xf652,0x0000,0x0000,0xc542,0xf653,0xf75c,0xc5ab,0xc5ac, +0x0000,0xf845,0x0000,0xc642,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,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,0x0000,0x0000,0xa8aa,0x0000,0xb36a,0xb369, +0xe05c,0xe05d,0x0000,0xbbae,0xebb9,0xbdea,0xebba,0xeeb9, +0xa8ab,0x0000,0xd0b2,0xad76,0xad75,0x0000,0xd3e3,0xb05f, +0xd3e4,0xd7d5,0x0000,0xd7d4,0x0000,0xd7d3,0x0000,0x0000, +0xdbee,0xb658,0x0000,0x0000,0xdbed,0xb657,0x0000,0x0000, +0x0000,0xdbef,0xb656,0x0000,0xe05f,0xe062,0xe060,0xe061, +0xe065,0xe05e,0xe066,0xe063,0xe064,0xbbb0,0xe456,0x0000, +0x0000,0xbbaf,0x0000,0xe7f2,0xe7f0,0x0000,0x0000,0xbdeb, +0xe7ef,0xe7f1,0x0000,0xbdec,0x0000,0xebbb,0x0000,0xebbc, +0xc1cd,0x0000,0xf34c,0xf34e,0xf34b,0xf34d,0xf4d6,0xf654, +0x0000,0x0000,0xf96f,0xa8ac,0xad77,0xd3e5,0xd3e7,0xd3e6, +0x0000,0xd7d8,0xb36c,0x0000,0xd7d6,0x0000,0xb36b,0xd7d9, +0x0000,0xd7da,0xd7d7,0x0000,0x0000,0xdbfb,0xb660,0xdbf3, +0xdbf9,0x0000,0x0000,0xb65b,0xb65e,0xdbf2,0xb659,0xdbf6, +0xe06c,0xb65d,0x0000,0xdbf1,0x0000,0xdbf7,0xdbf4,0xdbfa, +0xdbf0,0xdbf8,0xb65c,0xb65f,0xdbf5,0xb65a,0x0000,0xb8f2, +0xe068,0xb8f1,0xe06f,0xe06e,0xb8f8,0x0000,0xb8f9,0xe070, +0xb8f3,0xe06d,0xb8f7,0xe072,0xe069,0x0000,0xe06b,0xb8f4, +0xe067,0xe06a,0xe071,0xb8f5,0xe073,0x0000,0x0000,0x0000, +0x0000,0x0000,0xb8f6,0x0000,0xbbb1,0xe45b,0xe461,0xe459, +0xe462,0x0000,0xe458,0xe45d,0xe463,0xe460,0xe45f,0xe45e, +0x0000,0xe457,0xe45c,0x0000,0x0000,0xe45a,0x0000,0xbdf1, +0xbdee,0xe7fb,0xe841,0xe843,0xe840,0xe7f8,0xe7fa,0xe845, +0xe842,0xe7fc,0xe846,0xe7f9,0xe844,0xbdef,0xbdf5,0xbdf3, +0xe7f3,0xbdf4,0xbdf0,0xe7f4,0xe7f6,0xe7f5,0xe7fd,0xe7fe, +0x0000,0xbdf2,0x0000,0xbded,0x0000,0x0000,0xe7f7,0x0000, +0xebc6,0xbfe2,0x0000,0xebbd,0xbfe3,0xbfe6,0xebc2,0x0000, +0xebbf,0xbfe5,0x0000,0x0000,0xebc3,0xebc4,0xebbe,0xebc7, +0xebc0,0xebc5,0xbfe4,0x0000,0xbfe1,0xebc1,0x0000,0xeebf, +0xc1d0,0xc1ce,0xc1d1,0xc1cf,0xeebe,0xeebb,0xeeba,0x0000, +0xeebd,0x0000,0x0000,0xeebc,0xf145,0xc2de,0xf0fb,0xf0fa, +0x0000,0xc2d9,0xf141,0xf140,0xf0f7,0xf143,0xf0fc,0xc2dd, +0xf0f9,0xf142,0xf0f8,0xc2da,0xc2dc,0xf0fd,0xc2db,0xf0fe, +0x0000,0xf144,0xf352,0x0000,0xc3de,0xf34f,0x0000,0xf353, +0x0000,0x0000,0xc3db,0xf351,0xc3e0,0x0000,0xc3dd,0x0000, +0xf350,0x0000,0xc3df,0xf354,0xc3da,0x0000,0x0000,0x0000, +0x0000,0xc4bc,0xc4be,0x0000,0xf4d9,0xc4bd,0xf4d7,0xc3dc, +0xf4d8,0xc4bb,0xc543,0xc545,0xf656,0xc544,0xf655,0x0000, +0xf761,0xc5ad,0xf760,0xc5ae,0xf75e,0xf75d,0xf762,0xf763, +0xf846,0x0000,0xf75f,0x0000,0x0000,0xf8c6,0xf8c3,0xf8c4, +0xf8c5,0xc65c,0x0000,0xf951,0xf950,0xf94f,0xf970,0x0000, +0xf9be,0xf9ab,0xc66e,0xa8ad,0xb060,0x0000,0x0000,0x0000, +0x0000,0x0000,0xb8fa,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xbdf6,0x0000,0x0000,0xebc8,0x0000,0x0000, +0xc2df,0x0000,0xf355,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xf9ac,0xa8ae,0xaaee,0xad79,0xad78,0x0000,0xb063, +0x0000,0xd3e8,0xb061,0xd3e9,0xb062,0x0000,0x0000,0xd7df, +0xd7db,0x0000,0x0000,0xb36d,0xd7de,0xd7dd,0xd7dc,0xb36e, +0xd7e0,0xd7e1,0x0000,0x0000,0x0000,0xdc43,0xdc41,0xdc45, +0xdc46,0xdc4c,0x0000,0xdc48,0xdc4a,0x0000,0xdc42,0xdbfc, +0x0000,0xdc49,0x0000,0x0000,0xdc4b,0xdc44,0xdc47,0xdbfd, +0xb662,0xdc40,0xdbfe,0xb661,0xb663,0x0000,0xb8fd,0xe075, +0xe077,0xe076,0xe07b,0xb8fb,0x0000,0xe078,0xe074,0xe079, +0xe07a,0xb8fc,0xb8fe,0xe07c,0x0000,0xe467,0xe466,0x0000, +0xe464,0xe465,0xbbb3,0xbbb5,0xbbb2,0xbbb4,0xe84d,0xe84e, +0xe849,0x0000,0xe84a,0xbdf8,0xbdfd,0xbdf7,0xbdfe,0xbdf9, +0xe84b,0x0000,0x0000,0xe84c,0xe848,0xbe40,0xbdfb,0x0000, +0x0000,0xbdfa,0xbdfc,0x0000,0xe847,0x0000,0xebca,0xbfe8, +0x0000,0x0000,0xebcc,0xbfea,0xebcf,0xebcb,0xebc9,0xebce, +0xbfe9,0xebcd,0x0000,0xbfe7,0x0000,0x0000,0xc1d3,0xc1d6, +0xeec1,0x0000,0xc1d4,0xeec0,0xc1d2,0xc1d5,0xf146,0xf147, +0xf148,0xc2e0,0x0000,0xf149,0x0000,0xc2e1,0xc3e2,0xf358, +0xf359,0xf357,0xf356,0xf35a,0xc3e1,0xf4dd,0xf4db,0xf4dc, +0xf4de,0xf4da,0xf4df,0xf658,0x0000,0xf659,0xf657,0xc546, +0xf764,0xc5af,0xf765,0xf848,0xf847,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, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xa8af,0xb664,0x0000,0x0000,0xb940, +0x0000,0x0000,0x0000,0xbbb6,0x0000,0x0000,0xbfec,0x0000, +0xbfeb,0x0000,0x0000,0x0000,0x0000,0xc3e3,0xc47c,0xc547, +0xa8b0,0xb064,0xb941,0x0000,0xf35b,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcba6, +0x0000,0x0000,0xa8b1,0x0000,0xa8b4,0xa8b3,0xa8b2,0x0000, +0x0000,0xcba5,0x0000,0xcdcd,0x0000,0xcdcf,0xaaef,0x0000, +0x0000,0xaaf1,0xcdcc,0xcdce,0xaaf0,0xcdd1,0xcdd0,0xcdd2, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xd0b6,0xd0b4,0xad7c,0xd0b3,0xada3,0xad7e,0xad7b,0x0000, +0xada4,0x0000,0xad7d,0xada2,0x0000,0xada1,0xd0b5,0x0000, +0xad7a,0x0000,0x0000,0x0000,0xb06a,0xd3eb,0xd3f1,0xb067, +0xb06e,0x0000,0xb069,0xd3ee,0xd3f0,0xb06c,0xd3ea,0xd3ed, +0xb068,0xb065,0xd3ec,0xb06b,0xd3ef,0xb06d,0xb066,0x0000, +0x0000,0x0000,0x0000,0xd7e3,0xd7e6,0xb370,0x0000,0xb37a, +0xb376,0xd7e4,0x0000,0x0000,0xb37e,0xb377,0xb37c,0xb372, +0x0000,0xb36f,0xb371,0xb37d,0xd7e5,0xb375,0xb378,0xb374, +0xb379,0xd7e7,0xb37b,0xb373,0xd7e2,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xdc4d,0xb665,0xdc4f, +0x0000,0xb667,0xb669,0x0000,0xdc4e,0xb666,0xb66a,0x0000, +0xb668,0x0000,0x0000,0x0000,0xb947,0xe0a3,0xb94f,0xe07e, +0x0000,0xb950,0xb945,0x0000,0xe0a1,0x0000,0x0000,0xb94a, +0x0000,0xe0a2,0xb943,0xb942,0x0000,0xb94d,0xb94c,0xb94b, +0xb949,0xb94e,0xe07d,0xb944,0xb946,0xb948,0x0000,0x0000, +0xbbb8,0xbbbb,0x0000,0xbbbf,0xbbb9,0xbbbe,0xbbbc,0x0000, +0xbbb7,0x0000,0xbbbd,0xbbba,0x0000,0x0000,0x0000,0xe852, +0xbe43,0xbe41,0x0000,0xe853,0x0000,0xbe44,0xbe42,0xe851, +0xe850,0x0000,0xbff0,0xe84f,0xbfee,0xbfed,0xebd0,0xbe45, +0xbfef,0xebd1,0xbff2,0xebd2,0xbff1,0xc1d8,0xeec3,0xc1d7, +0xc1dc,0xc1da,0xc1db,0xc2e3,0xc1d9,0xeec2,0xebd3,0xc2e2, +0xc2e4,0x0000,0xc3e4,0xc3e5,0x0000,0xf4e0,0x0000,0xc5de, +0xc5dd,0xa8b6,0x0000,0x0000,0xca55,0xb06f,0x0000,0xca52, +0xca53,0xca51,0x0000,0xca54,0x0000,0x0000,0xcbaa,0xcba7, +0xcbac,0xcba8,0xa8b7,0xa8ba,0x0000,0xcba9,0xa8b9,0xcbab, +0x0000,0x0000,0xa8b8,0x0000,0x0000,0x0000,0x0000,0xcdd5, +0xcdd7,0xaaf4,0xcdd3,0xcdd6,0xcdd4,0xaaf2,0xaaf5,0x0000, +0xaaf3,0x0000,0x0000,0x0000,0x0000,0xd0b8,0xd0bc,0xd0b9, +0x0000,0xada7,0x0000,0xada8,0x0000,0xd0bb,0x0000,0xd0bd, +0xd0bf,0x0000,0xada5,0xd0be,0x0000,0x0000,0xada6,0x0000, +0x0000,0x0000,0x0000,0x0000,0xd7ee,0xd0ba,0xd3f2,0xd3fb, +0xd3f9,0xd3f4,0xd3f5,0xd3fa,0xd3fc,0xb071,0x0000,0xd3f7, +0xd3f3,0xb070,0xb072,0xd3f6,0xd3fd,0xd3f8,0x0000,0x0000, +0xb3a1,0xd7f1,0xd7e9,0xd7ef,0xd7f0,0xb3a2,0x0000,0xd7e8, +0xd7ea,0xd0b7,0xd7ec,0xd7ed,0xd7eb,0xb66c,0x0000,0x0000, +0x0000,0xdc56,0xebd4,0xdc57,0xdc54,0xb3a3,0xb66e,0xdc53, +0xdc59,0xdc58,0xb66b,0xdc5c,0xdc52,0xdc5b,0xdc50,0xdc5a, +0xdc55,0xb66d,0x0000,0xe0aa,0x0000,0xe0a5,0xe0ab,0xe0a6, +0xe0a4,0xe0a7,0xb951,0x0000,0xe0a9,0x0000,0xe0a8,0xb952, +0xbbc1,0xbbc0,0xe46e,0xe471,0xe469,0xe46d,0xbbc2,0xe46c, +0xe46a,0xe470,0xe46b,0xe468,0xe46f,0x0000,0xe859,0xbe48, +0xf14a,0xe856,0xe857,0xe855,0xdc51,0xbe47,0xe85a,0xe854, +0xbe46,0xbe49,0xe858,0xebd5,0xbff3,0xebd6,0xebd7,0x0000, +0xeec4,0xc1dd,0xf14b,0xf14c,0x0000,0x0000,0xf14d,0xf35d, +0xf35c,0xf4e2,0x0000,0xf4e1,0xf65b,0xf65c,0xf65a,0xf766, +0xc5b0,0xa8bb,0xadaa,0xada9,0xb075,0xb074,0xd440,0xd441, +0xd3fe,0x0000,0xb073,0xd7f5,0x0000,0xd7f6,0xd7f2,0xb3a4, +0xd7f3,0x0000,0xd7f4,0x0000,0x0000,0x0000,0x0000,0xdc5f, +0xdc61,0xdc5d,0xdc60,0xb66f,0xdc5e,0xb670,0x0000,0x0000, +0xdd73,0xb955,0xb954,0x0000,0xb953,0x0000,0xe0ac,0xe0ad, +0x0000,0x0000,0xe473,0xe475,0xbbc6,0xbbc3,0x0000,0xbbc5, +0xbbc4,0xe474,0xe472,0x0000,0x0000,0x0000,0x0000,0x0000, +0xe861,0xe85e,0xe85f,0xbe4d,0xe860,0xe85b,0xe85c,0xbe4a, +0x0000,0xbe4b,0xe85d,0xbe4c,0x0000,0xebdb,0x0000,0xebdc, +0xebd9,0xebda,0xbff4,0xebd8,0x0000,0x0000,0x0000,0x0000, +0x0000,0xeec8,0xeec5,0xeec7,0xc1e0,0xeecb,0xc1df,0xeec9, +0xeecc,0xeeca,0xeec6,0xc1de,0x0000,0xf14f,0x0000,0xf150, +0xf14e,0x0000,0xf152,0xc2e5,0xc2e6,0xf35f,0xc3e7,0xf151, +0xf35e,0xc3e6,0xf4e5,0xf4e6,0xc4bf,0xf4e4,0x0000,0xf4e3, +0x0000,0xf65d,0xc548,0x0000,0xf849,0xf8c8,0xf8c7,0x0000, +0xc643,0xc65d,0xf8c9,0xf971,0x0000,0xc66f,0xa8bc,0xaaf6, +0x0000,0xb956,0x0000,0xc4c0,0xa8bd,0xadab,0xb3a5,0xb671, +0xc2e7,0xaaf7,0x0000,0xd0c1,0xd0c0,0xd442,0x0000,0xb078, +0xb076,0xb07a,0xd444,0x0000,0xb079,0xb077,0x0000,0x0000, +0x0000,0x0000,0xd443,0xb3a8,0xd7fc,0x0000,0xb3a7,0xb3a9, +0xd842,0xb3ab,0xd7fe,0xd840,0xd7f7,0xb3aa,0xd843,0x0000, +0x0000,0xd7f9,0x0000,0xd7fa,0xd7f8,0xb3a6,0x0000,0xd841, +0xd7fb,0xd7fd,0x0000,0x0000,0x0000,0xdc6d,0x0000,0xdc6c, +0xdc6a,0xdc62,0xdc71,0xdc65,0xdc6f,0xdc76,0xdc6e,0xb679, +0x0000,0xb675,0xdc63,0x0000,0xdc69,0xb677,0x0000,0xdc68, +0xb678,0xb67a,0xdc6b,0x0000,0xb672,0xb673,0xdc77,0xdc75, +0x0000,0xdc74,0xdc66,0x0000,0xdc72,0x0000,0xb676,0x0000, +0x0000,0x0000,0x0000,0xb674,0xdc73,0xdc64,0xdc67,0xdc70, +0x0000,0x0000,0x0000,0x0000,0x0000,0xe4ba,0xe0b7,0x0000, +0xe0b0,0xe0c3,0xe0cc,0xe0b3,0xb961,0x0000,0xe0c0,0xb957, +0xb959,0xb965,0xe0b1,0x0000,0x0000,0xb95a,0xb95c,0xb966, +0xb95b,0x0000,0x0000,0x0000,0x0000,0xb964,0xe0b9,0x0000, +0xe0ae,0xb962,0xe0b8,0xb95e,0xe0ca,0xb963,0xe0c8,0xe0bc, +0xe0c6,0xb960,0xe0af,0xe0c9,0xe0c4,0x0000,0xe0cb,0xb958, +0x0000,0x0000,0xb967,0xb95d,0x0000,0x0000,0xe0b5,0x0000, +0xe0bd,0xe0c1,0x0000,0xe0c5,0xb95f,0xe0b4,0xe0b2,0xe0be, +0x0000,0x0000,0x0000,0x0000,0xe0bb,0xe0ba,0x0000,0xe0bf, +0xe0c2,0x0000,0xe0c7,0x0000,0x0000,0x0000,0xe478,0x0000, +0xbbc7,0xe4a4,0xe47a,0xbbcc,0xbbd0,0xe4ad,0xe4b5,0xe4a6, +0xbbc8,0x0000,0xe4aa,0xe0b6,0x0000,0xbbc9,0xe4b1,0xe4b6, +0xe4ae,0x0000,0xe4b0,0xe4b9,0xe4b2,0xe47e,0xe4a9,0x0000, +0x0000,0xbbd1,0x0000,0xbbcd,0xe47c,0xe4ab,0xbbcb,0xe4a5, +0xbbca,0xe4b3,0xe4a2,0xe479,0xbbce,0xe4b8,0x0000,0x0000, +0xe47b,0xe4af,0xe4ac,0xe4a7,0xe477,0xe476,0xe4a1,0xe4b4, +0xbbcf,0xe4b7,0xe47d,0xe4a3,0xbe52,0x0000,0x0000,0x0000, +0x0000,0x0000,0xbe5a,0xbe55,0xe8a4,0xe8a1,0xe867,0xbe50, +0x0000,0xf9d7,0x0000,0xbe4f,0xbe56,0x0000,0x0000,0x0000, +0xe865,0xbe54,0xe871,0xe863,0xe864,0xbe4e,0xe8a3,0xbe58, +0xe874,0xe879,0xe873,0xebee,0xe86f,0xe877,0xe875,0xe868, +0xe862,0xe87d,0xbe57,0xe87e,0x0000,0xe878,0x0000,0xe86d, +0xe86b,0xe866,0x0000,0x0000,0x0000,0xe86e,0xe87b,0xe86a, +0xe87a,0xe8a2,0x0000,0x0000,0xbe53,0x0000,0xe876,0xe87c, +0xe872,0xe86c,0xbe51,0x0000,0x0000,0x0000,0xe4a8,0xe870, +0xbe59,0xe869,0x0000,0x0000,0x0000,0x0000,0x0000,0xebf4, +0xbff7,0xebf3,0xebf0,0xec44,0xbffb,0x0000,0xec41,0xebf8, +0xec43,0xebe9,0xebf6,0x0000,0xbffd,0x0000,0xebe1,0x0000, +0xebdf,0xec42,0x0000,0xec40,0xebfe,0xebed,0xebec,0xebe2, +0xc040,0x0000,0xebe8,0xebf2,0xebfd,0xc043,0xec45,0x0000, +0xc1e8,0xc045,0xbffe,0xebe6,0x0000,0xebef,0xebde,0xebe0, +0xbff5,0xc042,0xbffa,0xebe7,0xebf7,0xebf1,0xc041,0xebdd, +0xc1e3,0xebf9,0xebfc,0xbffc,0x0000,0xebeb,0xc044,0xbff9, +0x0000,0x0000,0x0000,0xbff8,0xebf5,0xebfb,0xbff6,0x0000, +0xebe4,0xebfa,0x0000,0x0000,0xebe5,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xebea,0xeed2, +0x0000,0xeed7,0xc1e5,0xc1e7,0xeedd,0xc1e1,0xeeec,0xeee3, +0xeed8,0xeed9,0xeee2,0x0000,0xc1ee,0xeee1,0xeed1,0xeee0, +0xeed4,0xeeed,0xc1ed,0xc1eb,0xeed5,0x0000,0xeee8,0x0000, +0xeeda,0xeee7,0x0000,0xeee9,0xeed0,0xc1e6,0x0000,0xeeea, +0x0000,0x0000,0xeede,0x0000,0xc1ea,0xeedb,0x0000,0x0000, +0xc1ec,0xeee4,0x0000,0x0000,0x0000,0xc1e4,0xeed6,0xeee5, +0x0000,0xeedf,0xebe3,0xeee6,0xeed3,0x0000,0xc1e9,0x0000, +0xeeeb,0x0000,0xc1e2,0xeece,0x0000,0x0000,0x0000,0x0000, +0xf160,0xf159,0xc2e9,0x0000,0xf154,0xf163,0xf15b,0xeedc, +0x0000,0xf165,0xf155,0x0000,0xc2e8,0xf15f,0xc2ea,0xc2f2, +0xc2f0,0xf161,0xc2f1,0xf157,0x0000,0xf158,0xf15d,0xf162, +0x0000,0xeecd,0xc2eb,0xf16a,0xf167,0xf16b,0xf15e,0xf15a, +0xf168,0xf36a,0xf15c,0x0000,0xc2ee,0x0000,0xc2ed,0xeecf, +0xc2ef,0xf164,0xf166,0xc2ec,0xf169,0xf153,0x0000,0xf156, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xf373,0x0000,0xf363,0xc3eb,0xf371,0x0000,0x0000,0xf361, +0xc3ec,0x0000,0xf36c,0x0000,0xf368,0xc3f1,0xf372,0xf362, +0xf365,0xc3e9,0xf374,0x0000,0xf36d,0xf370,0xc3ef,0xc3f4, +0xc3f2,0xf369,0xf364,0x0000,0xc3ed,0xc3ee,0xf360,0xc3ea, +0x0000,0xc3e8,0xc3f0,0xf36f,0xc3f3,0x0000,0xf36b,0xf375, +0xc3f5,0x0000,0x0000,0x0000,0xf367,0x0000,0xf36e,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xf4f3,0xf542,0xf4f5, +0xf4fc,0xf366,0xf4fa,0xf4e9,0xf540,0xc4c3,0xf4ed,0xf4fe, +0xf4f4,0x0000,0x0000,0xc4c2,0x0000,0x0000,0xf544,0xf4f6, +0x0000,0xf4fb,0xf4fd,0xf4e7,0xf541,0xf4f2,0xf4f7,0xf4eb, +0xf4ef,0xf543,0xf4f9,0xf4e8,0xf4ec,0xf4ee,0xf4f8,0x0000, +0xc4c1,0xf4f1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xf4ea,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xf4f0,0xf661,0xf666,0xc54f,0xf668,0x0000,0xc549,0x0000, +0xf664,0xf66a,0xc54e,0xc54a,0x0000,0xc54b,0xf660,0xf667, +0xc54d,0xf665,0xc54c,0xf65f,0xf663,0xf662,0x0000,0xf65e, +0xf669,0x0000,0x0000,0x0000,0xc5b1,0xf76d,0xf770,0xf76c, +0xf76e,0xf76f,0xf769,0xf76a,0xf767,0x0000,0x0000,0xf76b, +0xf768,0xc5b2,0xc5b3,0x0000,0x0000,0xf84b,0x0000,0xf84d, +0x0000,0x0000,0x0000,0x0000,0x0000,0xf84c,0xf84e,0x0000, +0xc5e0,0x0000,0xf84a,0xc5df,0xc5e1,0x0000,0x0000,0x0000, +0xf8cb,0xf8cc,0xc644,0xf8ca,0x0000,0xf953,0xf952,0xf954, +0xc65f,0xf955,0xc65e,0xf956,0xf972,0xf975,0xf974,0xc668, +0xf973,0x0000,0x0000,0x0000,0xc672,0xc670,0xc671,0xc677, +0xf9c0,0xf9c1,0xf9bf,0xf9c9,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,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,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,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +/* 0x9500 */ +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,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,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,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xaaf8, +0x0000,0x0000,0xd844,0xdc78,0xe8a5,0xf376,0x0000,0x0000, +0xaaf9,0x0000,0xadac,0xb07b,0x0000,0x0000,0xd845,0x0000, +0xd846,0xb3ac,0x0000,0xb67d,0xdc7a,0xdc79,0xb6a3,0xb67c, +0xdc7b,0xb67e,0xb6a2,0xb6a1,0xb67b,0x0000,0x0000,0x0000, +0xb968,0x0000,0x0000,0xe0d0,0xe0ce,0x0000,0xe0cf,0xe0cd, +0x0000,0xbbd2,0x0000,0xbbd5,0xbbd7,0xbbd6,0x0000,0x0000, +0xbbd3,0xbbd4,0x0000,0xe8a7,0xe8a6,0xbe5b,0xe8a8,0x0000, +0xe8a9,0xbe5c,0x0000,0x0000,0x0000,0xec4d,0xec4b,0xeef3, +0x0000,0xec49,0xec4a,0xc046,0xec46,0xec4e,0xec48,0xec4c, +0xeeef,0x0000,0x0000,0xeef1,0x0000,0xeef2,0xc1f3,0xeeee, +0xc1f2,0xeef0,0xc1ef,0xc1f0,0xc1f1,0xec47,0x0000,0x0000, +0xc2f5,0xf16e,0xf16c,0xf16d,0xc2f3,0xc2f6,0xc2f4,0x0000, +0x0000,0x0000,0xf377,0xf378,0xc3f6,0x0000,0xf545,0xf547, +0xf546,0xc4c4,0xc550,0xf66d,0xf66c,0xf66b,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, +/* 0x9600 */ +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,0xaafa,0x0000,0xc9aa,0x0000, +0xca58,0xa6e9,0xca56,0xca59,0xca57,0x0000,0x0000,0x0000, +0xcbae,0x0000,0xa8c1,0x0000,0xa8c2,0xcbb0,0xa8bf,0xcbaf, +0xcbad,0xa8c0,0xa8be,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xcdd8,0xcddb,0xaafd,0xcdda,0xcdd9,0x0000,0xaafc, +0xaafb,0x0000,0xab40,0xcddc,0xaafe,0x0000,0x0000,0x0000, +0x0000,0x0000,0xd0c6,0xadae,0xadaf,0xadb0,0xd0c7,0xd0c3, +0xadad,0xd0c4,0x0000,0xd0c5,0xd0c2,0x0000,0x0000,0x0000, +0xb0a4,0x0000,0x0000,0xb0a1,0xd445,0xb0a2,0xb0a5,0xd446, +0x0000,0xb07e,0xb07c,0xb07d,0xb0a3,0x0000,0x0000,0x0000, +0x0000,0x0000,0xb3ad,0xd849,0xb3b5,0xd848,0x0000,0xd84b, +0xb3b1,0xd84a,0xb6ab,0xb3af,0xb3b2,0xb3ae,0xb3b3,0xb3b4, +0xb3b0,0x0000,0x0000,0x0000,0xd847,0xb6a7,0xdc7d,0x0000, +0xdca3,0x0000,0x0000,0xdca2,0xb6ac,0xb6a8,0xb6a9,0xdc7c, +0xdc7e,0xdca1,0xb6a4,0xb6a6,0x0000,0xb6aa,0xb6a5,0x0000, +0x0000,0xe0d3,0xe0d1,0xe0d2,0xb96a,0xb96b,0x0000,0xe0d4, +0xb969,0xbbd8,0x0000,0xbbda,0xbbd9,0x0000,0xe4bb,0x0000, +0x0000,0xe4bc,0xe8ab,0x0000,0xe8aa,0x0000,0x0000,0xc047, +0xc048,0xec4f,0xc049,0x0000,0xeef6,0x0000,0xeef4,0x0000, +0xeef5,0xc1f4,0x0000,0xf16f,0xc3f7,0x0000,0x0000,0x0000, +0xc1f5,0xab41,0x0000,0xb0a6,0xd447,0x0000,0x0000,0xd84c, +0xb3b6,0xb6ad,0xdca4,0xdca6,0xb6af,0xb6ae,0xb6b0,0xb6b1, +0xdca5,0xb96e,0xb96f,0xb96d,0xbbdb,0xb96c,0xe0d5,0x0000, +0x0000,0x0000,0xbbdc,0xe8ac,0xec50,0xc04a,0xc1f6,0xf170, +0xf174,0xc2f9,0xf171,0xc2fa,0xc2f8,0xf175,0xc2fb,0xf173, +0x0000,0xf379,0xc2f7,0xc3f8,0x0000,0xf8cd,0x0000,0x0000, +0xab42,0xb3b8,0xb3b7,0x0000,0x0000,0x0000,0x0000,0xb6b2, +0xdca8,0xdca7,0xb6b3,0x0000,0x0000,0xe0d9,0xb973,0xb970, +0xe0d8,0xb972,0xe0d6,0xb971,0x0000,0xe0d7,0x0000,0xe4bd, +0xbbdd,0x0000,0xe8af,0x0000,0xbe5d,0xe8ad,0xbe5e,0xbe5f, +0xe8ae,0xbe60,0x0000,0xec51,0x0000,0xc04e,0xc04b,0xc050, +0xec53,0xc04c,0xec52,0xc04f,0x0000,0x0000,0xc04d,0x0000, +0xeef9,0xeefb,0x0000,0x0000,0xc1f7,0xeefa,0xc1f8,0xeef8, +0xeef7,0x0000,0xf177,0xf176,0xc2fc,0xf178,0xf37e,0xc3fa, +0xf37d,0xf37a,0xc3f9,0xf37b,0xf37c,0x0000,0xf548,0xf549, +0xc4c5,0x0000,0xc553,0x0000,0x0000,0xf66e,0x0000,0x0000, +0xc551,0xc552,0xf66f,0x0000,0x0000,0xc5b4,0xc5b5,0xf771, +0x0000,0x0000,0xc645,0xf8cf,0xc647,0x0000,0xf8ce,0xf8d0, +0xc646,0xf957,0x0000,0xf9ad,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0xab43,0x0000,0x0000,0x0000,0xb974,0x0000, +0xe4be,0x0000,0xe8b0,0xc051,0xc052,0x0000,0xab44,0x0000, +0xbe61,0xc3fb,0xadb1,0x0000,0x0000,0x0000,0xc053,0x0000, +0xc5e2,0xadb2,0xd84d,0x0000,0xdca9,0x0000,0xdcab,0x0000, +0xdcaa,0x0000,0xe0dd,0xe0da,0xb975,0x0000,0xb976,0xe0db, +0xe0dc,0x0000,0xe4c0,0xe4c5,0xbbde,0xe4bf,0xe4c1,0xe4c8, +0xe4c3,0xe4c7,0xe4c4,0xe4c2,0xe4c6,0xbbdf,0x0000,0x0000, +0xe8b3,0x0000,0xe8b1,0xbe63,0x0000,0xbe62,0xe8b2,0xbe64, +0x0000,0x0000,0x0000,0x0000,0xec56,0x0000,0x0000,0xec55, +0xc054,0xec54,0xeefc,0x0000,0xeefe,0xef41,0xef40,0x0000, +0xc1f9,0xeefd,0xf1a1,0xc2fd,0xf17d,0xf1a2,0xc2fe,0x0000, +0xf17b,0x0000,0xf17e,0xf17c,0xf179,0xc340,0xf17a,0x0000, +0x0000,0x0000,0x0000,0xf3a1,0x0000,0x0000,0xf3a3,0xf3a2, +0x0000,0xf54a,0x0000,0xf54b,0x0000,0x0000,0x0000,0xf670, +0x0000,0xc5b7,0x0000,0xc5b6,0xf84f,0xf850,0xc648,0xf8d1, +0x0000,0xc669,0x0000,0xadb3,0xb6b4,0xe4ca,0xe4c9,0xe8b5, +0xe8b4,0x0000,0x0000,0xc1fa,0xef43,0xef42,0xf1a5,0xf1a3, +0xf1a6,0xf1a4,0x0000,0x0000,0xc3fc,0xf3a4,0xf3a5,0xf3a6, +0x0000,0xf671,0x0000,0xf772,0x0000,0xf8d2,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xadb4,0x0000,0x0000, +0xec57,0xef44,0x0000,0xadb5,0x0000,0x0000,0xbbe0,0x0000, +0xec58,0xc341,0xf1a7,0xc3fd,0x0000,0xf54c,0xf54d,0xc554, +0xf851,0xadb6,0xb3bb,0xb3bc,0xd84e,0xb6b5,0xb6b6,0xdcac, +0xb6b7,0x0000,0xb97a,0x0000,0xb97c,0xe0df,0xe0e0,0xe0de, +0xb977,0xb978,0xb97b,0xb979,0x0000,0x0000,0xe4cb,0xbbe1, +0xbbe2,0x0000,0x0000,0xe8bc,0xbe67,0xe8b7,0xe8b6,0x0000, +0xe8bb,0xbe65,0x0000,0x0000,0xc05b,0x0000,0xe8b8,0xe8bd, +0xe8ba,0xe8b9,0x0000,0xbe66,0x0000,0xc059,0x0000,0xec5a, +0xc055,0x0000,0xec5b,0x0000,0x0000,0xec59,0x0000,0xc058, +0xc056,0xc05a,0x0000,0xc057,0x0000,0x0000,0x0000,0x0000, +0x0000,0xef45,0x0000,0xef4a,0xef46,0xef49,0xc1fb,0x0000, +0xedd4,0xef48,0xef47,0x0000,0xc344,0xc342,0xc345,0xc343, +0xf1a8,0xf1a9,0xf1aa,0xc346,0x0000,0x0000,0x0000,0xf3aa, +0xc440,0xf3a8,0x0000,0xc441,0xf3a7,0xf3a9,0xc3fe,0xf551, +0xf54e,0x0000,0xf54f,0xf550,0xf672,0xc556,0x0000,0xc555, +0x0000,0xf774,0xf773,0xc5b8,0x0000,0x0000,0x0000,0xc5e3, +0xc649,0xc660,0xf958,0xf9ae,0xf9af,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, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xadb7,0xdcad,0x0000,0x0000,0xe0e1,0xe4cc,0xe4cd,0xbbe3, +0x0000,0xbbe4,0xe8be,0xbe68,0x0000,0x0000,0xc1fc,0x0000, +0xf1ab,0x0000,0xc347,0xf3ad,0xc442,0xf3ac,0xf3ae,0xf3ab, +0xf675,0xf552,0xf553,0x0000,0xc4c6,0x0000,0xf674,0x0000, +0x0000,0xf673,0x0000,0xf775,0xf9b0,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xadb8,0x0000,0x0000,0x0000,0xadb9, +0x0000,0x0000,0xb0a7,0xd448,0x0000,0xd84f,0x0000,0xb6b8, +0x0000,0xb6bb,0xb6b9,0xdcae,0x0000,0xb6bd,0x0000,0xb6ba, +0x0000,0x0000,0xb6bc,0x0000,0xb97e,0x0000,0xe0e2,0x0000, +0x0000,0xe0e3,0xe8c0,0x0000,0xb97d,0xb9a1,0xb9a2,0x0000, +0xe4cf,0x0000,0xe4ce,0xbbe5,0x0000,0xbbe6,0x0000,0xe4d0, +0xe8bf,0xbbe8,0xbe69,0x0000,0xbbe7,0x0000,0x0000,0x0000, +0xc05c,0xe8c1,0xbe6b,0xbe6a,0xe8c2,0xe8c5,0xe8c3,0xe8c4, +0xbe6c,0x0000,0xc061,0xc05f,0x0000,0x0000,0xc05e,0xec5d, +0x0000,0xc060,0x0000,0x0000,0xec5c,0xef4b,0x0000,0xec5e, +0xc05d,0xec5f,0xef4e,0xef4c,0xef4d,0xef52,0xc34b,0xef51, +0xef54,0xef53,0xef50,0xef4f,0x0000,0xc1fd,0x0000,0x0000, +0x0000,0x0000,0xf1ae,0x0000,0xf1ad,0xc34a,0xc348,0xc349, +0x0000,0xf1ac,0x0000,0xf3b1,0x0000,0xc443,0x0000,0xf3b0, +0xf3af,0xc444,0x0000,0xf558,0xf557,0x0000,0xf555,0x0000, +0xf554,0xc4c8,0xc4c7,0xf559,0xf776,0xc5b9,0xf677,0xc557, +0xf676,0xf556,0x0000,0xf777,0xc5e4,0x0000,0xc661,0xf959, +0x0000,0xf9b1,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,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xadba,0xd850, +0xef55,0xadbb,0x0000,0x0000,0xe4d2,0xe4d1,0xec60,0x0000, +0x0000,0xef57,0x0000,0xef56,0x0000,0xc34c,0xf3b2,0xf3b3, +0xc4c9,0x0000,0x0000,0xf9b2,0xb0a8,0xb6bf,0xb6be,0xe0e4, +0xe0e6,0xb9a4,0xe0e5,0xb9a3,0xb9a5,0xe0e7,0x0000,0x0000, +0x0000,0xe4d4,0xe4d6,0xe4d5,0x0000,0xe4d8,0x0000,0x0000, +0x0000,0xbbe9,0xe4d7,0xe4d3,0x0000,0x0000,0x0000,0xe4d9, +0x0000,0xe8cc,0x0000,0xe8cf,0xe8d1,0xe8c7,0xe8cb,0xe8c8, +0xbe6e,0xbe71,0xbe73,0xe8c9,0xe8ca,0xbe72,0xe8cd,0xe8d0, +0xe8ce,0xbe74,0x0000,0xbe70,0xe8c6,0xbe6d,0x0000,0xbe6f, +0x0000,0x0000,0xc063,0xec66,0xec64,0xec63,0x0000,0xec69, +0x0000,0xec68,0xec67,0x0000,0xec62,0xc062,0xec61,0x0000, +0xec65,0xc064,0x0000,0x0000,0xef5a,0x0000,0xef5e,0xef5b, +0xef5d,0xef5c,0xef59,0xef5f,0xef62,0xef60,0xef61,0xc240, +/* 0x9a00 */ +0x0000,0xc1fe,0xef58,0xef63,0xf1b3,0xf1b6,0xf1b8,0xf1b7, +0x0000,0xf1b1,0xf1b5,0xf1b0,0x0000,0xf1b2,0xc34d,0xf1af, +0x0000,0xf1b4,0x0000,0x0000,0xf3c0,0xf3b5,0xc445,0x0000, +0x0000,0xc446,0xf3b4,0xf3b9,0xf3bf,0xf3b7,0xf3be,0x0000, +0xf3bb,0x0000,0xf3ba,0xf3bd,0xf3b8,0xf3b6,0x0000,0xf3bc, +0x0000,0xf560,0xf55e,0xc4ca,0xf55d,0xf563,0xf561,0x0000, +0xc4cb,0xf55c,0xf55a,0x0000,0xf55b,0xc4cd,0xf55f,0xc4cc, +0xf562,0xf678,0xf67e,0x0000,0x0000,0xf679,0xc55b,0xf6a1, +0xc55a,0xf67d,0xf67c,0xc559,0xf67b,0xc558,0xf67a,0x0000, +0xf77d,0xf7a1,0xf77e,0x0000,0xf77b,0xc5bb,0xf778,0xf77c, +0xf7a3,0x0000,0xf7a2,0xf779,0xf77a,0xc5ba,0xf852,0xc5e7, +0x0000,0xf853,0xc5e5,0xc5e6,0x0000,0x0000,0xf8d3,0xc64a, +0xf976,0x0000,0xc66a,0x0000,0xf9b3,0xc66b,0xf9b4,0xf9b5, +0xf9c3,0xf9c2,0xc67a,0xf9cd,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,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, +0xb0a9,0x0000,0x0000,0xe0e9,0x0000,0xe0e8,0x0000,0xbbea, +0xbbeb,0xe4da,0x0000,0xe8d2,0xec6c,0x0000,0x0000,0xbe75, +0xc065,0xec6a,0x0000,0xec6d,0xc066,0x0000,0xef64,0xec6b, +0xf1b9,0xc34e,0xf3c1,0x0000,0x0000,0x0000,0xf566,0xf564, +0x0000,0x0000,0xf565,0x0000,0x0000,0xf6a2,0x0000,0xc55c, +0xf7a4,0xc5ea,0xc5bc,0xc5e8,0xc5e9,0xf8d4,0xc662,0x0000, +0xb0aa,0x0000,0x0000,0x0000,0xf1ba,0x0000,0x0000,0xd449, +0x0000,0xb9a6,0x0000,0xe4db,0x0000,0x0000,0xbbec,0xe4dc, +0x0000,0x0000,0x0000,0xe8d4,0xe8d3,0xc068,0xbe76,0xbe77, +0x0000,0xe8d7,0xe8d6,0xe8d5,0x0000,0x0000,0xec6e,0xec71, +0x0000,0xec70,0xec6f,0xc067,0xef68,0xef66,0xef65,0x0000, +/* 0x9b00 */ +0x0000,0xef67,0x0000,0xc34f,0xf1bc,0xf1bd,0xc350,0x0000, +0xf1bb,0x0000,0xf3c3,0xf3c2,0xf3c5,0xc447,0xf3c4,0x0000, +0xf567,0xf569,0xf568,0x0000,0x0000,0xf6a3,0xf6a6,0xf6a4, +0xf6a5,0xf7a5,0xc5bd,0x0000,0x0000,0x0000,0xf854,0xf855, +0xf856,0x0000,0xc64b,0xc663,0xf9b6,0xb0ab,0x0000,0xbe78, +0xc069,0xf1be,0x0000,0xf7a6,0x0000,0x0000,0xf9c4,0xd44a, +0x0000,0xc67b,0xb0ac,0xec72,0x0000,0xf1bf,0x0000,0xf3c6, +0x0000,0x0000,0xf6a7,0xf7a7,0xb0ad,0x0000,0xe4dd,0xe4de, +0x0000,0xbbed,0xbbee,0xe8d9,0xbe7a,0xbe79,0xe8d8,0x0000, +0xef69,0x0000,0xf1c0,0xf1c2,0xf1c1,0xc353,0xc352,0xc351, +0x0000,0xc55e,0xf6a8,0x0000,0xc55d,0xf7a9,0xf7a8,0x0000, +0xc64c,0xf8d5,0xb3bd,0xe0ea,0x0000,0x0000,0x0000,0xe4e1, +0xe4df,0xe4e0,0x0000,0x0000,0xe8e2,0x0000,0xe8dd,0xe8da, +0xe8e1,0x0000,0x0000,0x0000,0xe8e3,0x0000,0x0000,0xbe7c, +0xe8e0,0xe8dc,0x0000,0x0000,0xe8db,0xe8df,0xe8de,0xbe7b, +0x0000,0x0000,0xec7d,0xec78,0xec76,0xeca1,0xec77,0x0000, +0xec73,0x0000,0xec79,0x0000,0x0000,0xec74,0xef72,0xec75, +0xeca2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xec7c,0xc06a,0xec7b,0xec7a,0x0000,0xec7e,0x0000,0x0000, +0x0000,0x0000,0xef6a,0xef6d,0x0000,0x0000,0xef6c,0x0000, +0xef74,0xef6f,0xef73,0x0000,0xef71,0xef70,0xef6e,0x0000, +0xef6b,0x0000,0xc243,0xc242,0x0000,0xc244,0xc241,0xef75, +0x0000,0x0000,0x0000,0x0000,0x0000,0xf1c8,0xf1cb,0x0000, +0xf1c9,0xf1cd,0x0000,0x0000,0x0000,0xf1ce,0x0000,0xf1c6, +0xc358,0xf1c7,0x0000,0xf1c5,0xf1cc,0x0000,0xf1c4,0xf1c3, +0xc357,0xc355,0xc354,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0xf1ca,0xf3cf,0xf3d5,0xc44a,0xf3d0, +0x0000,0xf3d3,0xf3d7,0xc44b,0xf3d2,0x0000,0xf3ca,0x0000, +0xf3c9,0xf3d6,0xf3cd,0x0000,0xf3cb,0xf3d4,0xf3cc,0xc449, +0xc448,0x0000,0xf3c7,0xf3c8,0xf3d1,0x0000,0x0000,0x0000, +0xf3ce,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf56c, +0xf56f,0x0000,0x0000,0x0000,0x0000,0xc356,0x0000,0x0000, +/* 0x9c00 */ +0x0000,0x0000,0x0000,0x0000,0x0000,0xf56d,0xf573,0xf571, +0xf56b,0xf576,0x0000,0xf56a,0x0000,0xc4cf,0xf572,0x0000, +0x0000,0x0000,0xf56e,0xc4ce,0xf575,0x0000,0x0000,0xf574, +0x0000,0x0000,0x0000,0x0000,0xf6ab,0xf6aa,0x0000,0x0000, +0x0000,0xf6b1,0x0000,0xf6ad,0xf6b0,0xc560,0x0000,0x0000, +0xf6ae,0xf6af,0x0000,0xf6a9,0xf6ac,0xc55f,0x0000,0x0000, +0x0000,0xc5bf,0xf7b4,0xf7af,0xf7b3,0x0000,0xf7b6,0xf7b2, +0x0000,0xf7ae,0x0000,0xc5c1,0xf7b1,0xf7b5,0xc5c0,0xf7ac, +0xf570,0xf7b0,0x0000,0x0000,0xf7ad,0x0000,0xf7aa,0x0000, +0xf7ab,0xc5be,0xf85a,0xf85c,0xf85f,0xf85b,0xf860,0x0000, +0xf859,0x0000,0xf857,0x0000,0xc5eb,0xf85d,0xc5ed,0xc5ec, +0xf858,0xf85e,0x0000,0x0000,0x0000,0x0000,0xf8da,0xc64d, +0xf8db,0x0000,0xf8d9,0xf8d6,0x0000,0x0000,0xf8d8,0xf8d7, +0xf95a,0x0000,0x0000,0x0000,0x0000,0xf95c,0xf95b,0x0000, +0x0000,0xf979,0x0000,0xf978,0xf977,0xf97a,0x0000,0xc673, +0xc674,0xf9ca,0xf9ce,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,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,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,0x0000,0xb3be,0xdcaf,0xe0ed, +0x0000,0xb9a7,0xe0eb,0x0000,0x0000,0xe0ec,0x0000,0x0000, +0x0000,0xe4e2,0xe4e3,0xbbf1,0xbbef,0xe4e4,0xbbf0,0xe8e8, +0x0000,0xe8eb,0xe8e5,0xe8ec,0xe8e4,0xe8e6,0x0000,0xe8e7, +0xe8ea,0x0000,0x0000,0xbea1,0xe8ef,0xe8ee,0xbe7d,0xe8e9, +0xe8ed,0xbe7e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xecac,0x0000,0xc06f,0x0000,0xeca7,0xc06b,0x0000,0xeca4, +0xecaa,0xecad,0x0000,0xc070,0x0000,0xeca9,0xeca6,0xecae, +0xeca5,0x0000,0xecab,0xc06c,0x0000,0xeca3,0xc06d,0x0000, +0xc06e,0xeca8,0x0000,0x0000,0x0000,0xefa9,0xef7a,0xef7b, +0xef7e,0xef7c,0x0000,0xef76,0x0000,0x0000,0xef79,0xefa5, +0xef7d,0x0000,0x0000,0xc245,0x0000,0xefa7,0xefa4,0xc246, +0xefa6,0xef77,0xefa2,0xefa3,0x0000,0xefa1,0x0000,0x0000, +0x0000,0x0000,0xf1d2,0xf1d4,0xf1d7,0x0000,0x0000,0xf1d1, +0x0000,0xc359,0xf1d9,0xf1d0,0xf1da,0x0000,0xf1d6,0xf1d8, +0xf1dc,0xf1d5,0xf1dd,0xf1d3,0xf1cf,0xc35a,0x0000,0xf1db, +0xc35b,0xc44d,0x0000,0x0000,0x0000,0x0000,0x0000,0xef78, +0xf3f1,0xf3e8,0xc44f,0xf3e4,0xc450,0x0000,0x0000,0xf3ed, +0xf3e7,0xf3dd,0xc44e,0xf3ea,0xf3e5,0xf3e6,0x0000,0xf3d8, +0xf3df,0xf3ee,0x0000,0xf3eb,0x0000,0xf3e3,0x0000,0xf3ef, +0xf3de,0xf3d9,0xf3ec,0x0000,0xf3db,0xf3e9,0xf3e0,0xf3f0, +0xf3dc,0xc44c,0xf3da,0xf3e1,0xf3e2,0x0000,0x0000,0x0000, +0xf57d,0x0000,0xf57b,0x0000,0xf5a2,0x0000,0xf5ae,0xf5a5, +0xf57c,0xf578,0xf5a7,0xf57e,0xf5a3,0xf57a,0xf5aa,0xf577, +0xf5a1,0xf5a6,0xf5a8,0xf5ab,0xf579,0x0000,0xf5af,0xf5b0, +0xf5a9,0xf5ad,0xf5a4,0x0000,0xf6c1,0xf6c4,0x0000,0xc561, +0x0000,0xf6c3,0xf6c8,0xf6c6,0xc562,0xf6bd,0xf6b3,0xf6b2, +0xc564,0xf6bf,0xf6c0,0xf6bc,0xf6b4,0x0000,0xf6b9,0xf5ac, +0x0000,0xf6b5,0xc563,0xf6bb,0x0000,0xf6ba,0x0000,0xf6b6, +0xf6c2,0x0000,0xf6b7,0xf7bb,0xf6c5,0xf6c7,0xf6be,0xf6b8, +0xf7bc,0xf7be,0xf7b8,0xc5c2,0x0000,0xf7c5,0xf7c3,0xc5c3, +0xf7c2,0xf7c1,0xf7ba,0xf7b7,0xf7bd,0xf7c6,0xf7b9,0xf7bf, +0x0000,0xf869,0xf86e,0xf864,0xf867,0xc5ee,0xf86b,0x0000, +0xf872,0xf7c0,0x0000,0xf865,0xf86f,0xf873,0xf86a,0xf863, +0xf86d,0x0000,0xf86c,0xf871,0xf870,0xf7c4,0xf868,0xf862, +0xf866,0xc64e,0xc64f,0xf861,0x0000,0xf8e6,0xf8dd,0xf8e5, +0xf8e2,0xf8e3,0xf8dc,0xf8df,0xf8e7,0xf8e1,0xf8e0,0xf8de, +0x0000,0xf8e4,0x0000,0xf95d,0x0000,0xf95e,0x0000,0xf960, +0xf95f,0xf962,0xf961,0xf97c,0xf97b,0xf9b7,0x0000,0xf9b8, +0x0000,0xf9c5,0xc678,0xc67c,0x0000,0xf9cf,0xc67d,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,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,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xb3bf,0x0000,0x0000, +0x0000,0xc4d0,0xf6c9,0x0000,0xc650,0xc651,0x0000,0xb3c0, +0xe0ee,0x0000,0xb9a8,0xe8f0,0x0000,0x0000,0xecb0,0xecb1, +0xecaf,0xefab,0xefaa,0xc247,0xf1df,0xefac,0xf1de,0x0000, +0x0000,0xf3f3,0xc451,0xc453,0xf3f2,0x0000,0x0000,0xc452, +0x0000,0xf5b1,0xf5b3,0xf5b2,0xf6ca,0xc565,0x0000,0xc5ef, +0xf8e8,0xf963,0x0000,0x0000,0xf9d2,0xb3c1,0x0000,0xe4e5, +0x0000,0xbea2,0x0000,0x0000,0x0000,0xecb3,0xecb2,0x0000, +0xefad,0x0000,0x0000,0x0000,0xc454,0xc4d1,0xf7c7,0xf9cb, +0x0000,0x0000,0x0000,0xb3c2,0xbbf2,0x0000,0xbea3,0x0000, +0xf3f4,0x0000,0xf874,0xb6c0,0x0000,0x0000,0x0000,0x0000, +0xefae,0x0000,0x0000,0x0000,0xc664,0xb6c1,0xbea4,0xc248, +0xf875,0xb6c2,0x0000,0xe8f1,0xc072,0xecb4,0xecb5,0x0000, +0xc071,0x0000,0xefaf,0xc24c,0xc24a,0xc24b,0xc249,0xf1e0, +0xc35c,0x0000,0x0000,0x0000,0xf5b5,0xf5b4,0xf5b7,0xf5b6, +0xc4d2,0x0000,0x0000,0xf6cb,0x0000,0xf6cd,0xf6cc,0xc566, +0xf7c8,0x0000,0xf876,0xf877,0xc5f0,0xf964,0xf97d,0xc675, +0x0000,0xdcb0,0xecb6,0xefb0,0xf3f5,0xe0ef,0x0000,0xefb1, +0xf1e2,0xf1e1,0x0000,0x0000,0x0000,0x0000,0xf878,0xc652, +0x0000,0xf965,0xf97e,0x0000,0x0000,0x0000,0xb9a9,0xe8f2, +0xe8f3,0x0000,0xecb7,0xb9aa,0x0000,0xc35d,0xf1e3,0x0000, +0xf6cf,0xc567,0xf6d0,0xf6ce,0xf879,0x0000,0xf8e9,0x0000, +0xb9ab,0x0000,0xefb4,0xefb3,0xefb2,0xf1e4,0x0000,0x0000, +0xf1e8,0xf1e7,0xf1e6,0xf1e5,0xc35e,0xf3f6,0xf5b9,0xc4d3, +0xf5b8,0xf6d1,0xf7cb,0xf7ca,0xc5c4,0xf7c9,0xf87c,0xf87b, +0xf87a,0x0000,0x0000,0xbbf3,0x0000,0xecb8,0xc24d,0x0000, +0xf3f7,0xf3f8,0xf7cc,0xf87d,0x0000,0x0000,0xf8ea,0xf966, +0xf9b9,0xf9d4,0xbbf4,0xc24e,0xf1e9,0xf3f9,0xf6d2,0xf87e, +0x0000,0x0000,0xbea6,0x0000,0xefb5,0xf1ea,0xf3fa,0xf3fb, +0xf3fc,0xf5be,0x0000,0xf5ba,0xc568,0xf5bd,0xf5bc,0xc4d4, +0xf5bb,0xc4d6,0x0000,0xc4d5,0xf6d4,0xf6d3,0xc569,0xc56a, +0x0000,0x0000,0xc5c6,0xf7cd,0xc5c5,0x0000,0xf8a3,0xf8a4, +0xf8a2,0xf8a1,0xc654,0x0000,0xf8eb,0xf8ec,0xf8ed,0xc653, +0xf967,0xf96a,0xf969,0xf968,0x0000,0x0000,0xf9d3,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xc073,0x0000,0x0000, +0xc365,0xf5bf,0xf6d5,0x0000,0xc5c7,0xf7ce,0x0000,0x0000, +0xf9d5,0x0000,0x0000,0x0000,0xc074,0x0000,0x0000,0x0000, +0xefb6,0x0000,0xf7cf,0x0000,0xf9a1}; + +static const int ucs_i_big5_table_min = 0x4d00; +static const int ucs_i_big5_table_max = 0x4d00 + (sizeof (ucs_i_big5_table) / sizeof (unsigned short)); + +static const unsigned short ucs_pua_big5_table[] = { +/* 0xf600 */ +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,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,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,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,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,0x0000, +0x0000,0xc6a1,0xc6a2,0xc6a3,0xc6a4,0xc6a5,0xc6a6,0xc6a7, +0xc6a8,0xc6a9,0xc6aa,0xc6ab,0xc6ac,0xc6ad,0xc6ae,0xc6af, +0xc6b0,0xc6b1,0xc6b2,0xc6b3,0xc6b4,0xc6b5,0xc6b6,0xc6b7, +0xc6b8,0xc6b9,0xc6ba,0xc6bb,0xc6bc,0xc6bd,0xc6be,0xc6bf, +0xc6c0,0xc6c1,0xc6c2,0xc6c3,0xc6c4,0xc6c5,0xc6c6,0xc6c7, +0xc6c8,0xc6c9,0xc6ca,0xc6cb,0xc6cc,0xc6cd,0xc6ce,0xc6cf, +0xc6d0,0xc6d1,0xc6d2,0xc6d3,0xc6d4,0xc6d5,0xc6d6,0xc6d7, +0xc6d8,0xc6d9,0xc6da,0xc6db,0xc6dc,0xc6dd,0xc6de,0xc6df, +0xc6e0,0xc6e1,0xc6e2,0xc6e3,0xc6e4,0xc6e5,0xc6e6,0xc6e7, +0xc6e8,0xc6e9,0xc6ea,0xc6eb,0xc6ec,0xc6ed,0xc6ee,0xc6ef, +0xc6f0,0xc6f1,0xc6f2,0xc6f3,0xc6f4,0xc6f5,0xc6f6,0xc6f7, +0xc6f8,0xc6f9,0xc6fa,0xc6fb,0xc6fc,0xc6fd,0xc6fe,0xc740, +0xc741,0xc742,0xc743,0xc744,0xc745,0xc746,0xc747,0xc748, +0xc749,0xc74a,0xc74b,0xc74c,0xc74d,0xc74e,0xc74f,0xc750, +0xc751,0xc752,0xc753,0xc754,0xc755,0xc756,0xc757,0xc758, +0xc759,0xc75a,0xc75b,0xc75c,0xc75d,0xc75e,0xc75f,0xc760, +0xc761,0xc762,0xc763,0xc764,0xc765,0xc766,0xc767,0xc768, +0xc769,0xc76a,0xc76b,0xc76c,0xc76d,0xc76e,0xc76f,0xc770, +0xc771,0xc772,0xc773,0xc774,0xc775,0xc776,0xc777,0xc778, +0xc779,0xc77a,0xc77b,0xc77c,0xc77d,0xc77e,0xc7a1,0xc7a2, +0xc7a3,0xc7a4,0xc7a5,0xc7a6,0xc7a7,0xc7a8,0xc7a9,0xc7aa, +0xc7ab,0xc7ac,0xc7ad,0xc7ae,0xc7af,0xc7b0,0xc7b1,0xc7b2, +0xc7b3,0xc7b4,0xc7b5,0xc7b6,0xc7b7,0xc7b8,0xc7b9,0xc7ba, +0xc7bb,0xc7bc,0xc7bd,0xc7be,0xc7bf,0xc7c0,0xc7c1,0xc7c2, +0xc7c3,0xc7c4,0xc7c5,0xc7c6,0xc7c7,0xc7c8,0xc7c9,0xc7ca, +0xc7cb,0xc7cc,0xc7cd,0xc7ce,0xc7cf,0xc7d0,0xc7d1,0xc7d2, +0xc7d3,0xc7d4,0xc7d5,0xc7d6,0xc7d7,0xc7d8,0xc7d9,0xc7da, +0xc7db,0xc7dc,0xc7dd,0xc7de,0xc7df,0xc7e0,0xc7e1,0xc7e2, +0xc7e3,0xc7e4,0xc7e5,0xc7e6,0xc7e7,0xc7e8,0xc7e9,0xc7ea, +0xc7eb,0xc7ec,0xc7ed,0xc7ee,0xc7ef,0xc7f0,0xc7f1,0xc7f2, +0xc7f3,0xc7f4,0xc7f5,0xc7f6,0xc7f7,0xc7f8,0xc7f9,0xc7fa, +0xc7fb,0xc7fc,0xc7fd,0xc7fe,0xc840,0xc841,0xc842,0xc843, +0xc844,0xc845,0xc846,0xc847,0xc848,0xc849,0xc84a,0xc84b, +0xc84c,0xc84d,0xc84e,0xc84f,0xc850,0xc851,0xc852,0xc853, +0xc854,0xc855,0xc856,0xc857,0xc858,0xc859,0xc85a,0xc85b, +0xc85c,0xc85d,0xc85e,0xc85f,0xc860,0xc861,0xc862,0xc863, +0xc864,0xc865,0xc866,0xc867,0xc868,0xc869,0xc86a,0xc86b, +0xc86c,0xc86d,0xc86e,0xc86f,0xc870,0xc871,0xc872,0xc873, +0xc874,0xc875,0xc876,0xc877,0xc878,0xc879,0xc87a,0xc87b, +0xc87c,0xc87d,0xc87e,0xc8a1,0xc8a2,0xc8a3,0xc8a4,0xc8a5, +0xc8a6,0xc8a7,0xc8a8,0xc8a9,0xc8aa,0xc8ab,0xc8ac,0xc8ad, +0xc8ae,0xc8af,0xc8b0,0xc8b1,0xc8b2,0xc8b3,0xc8b4,0xc8b5, +0xc8b6,0xc8b7,0xc8b8,0xc8b9,0xc8ba,0xc8bb,0xc8bc,0xc8bd, +0xc8be,0xc8bf,0xc8c0,0xc8c1,0xc8c2,0xc8c3,0xc8c4,0xc8c5, +0xc8c6,0xc8c7,0xc8c8,0xc8c9,0xc8ca,0xc8cb,0xc8cc,0xc8cd, +0xc8ce,0xc8cf,0xc8d0,0xc8d1,0xc8d2,0xc8d3,0xc8d4,0xc8d5, +0xc8d6,0xc8d7,0xc8d8,0xc8d9,0xc8da,0xc8db,0xc8dc,0xc8dd, +0xc8de,0xc8df,0xc8e0,0xc8e1,0xc8e2,0xc8e3,0xc8e4,0xc8e5, +0xc8e6,0xc8e7,0xc8e8,0xc8e9,0xc8ea,0xc8eb,0xc8ec,0xc8ed, +0xc8ee,0xc8ef,0xc8f0,0xc8f1,0xc8f2,0xc8f3,0xc8f4,0xc8f5, +0xc8f6,0xc8f7,0xc8f8,0xc8f9,0xc8fa,0xc8fb,0xc8fc,0xc8fd, +0xc8fe}; + +static const int ucs_pua_big5_table_min = 0xf600; +static const int ucs_pua_big5_table_max = 0xf600 + (sizeof (ucs_pua_big5_table) / sizeof (unsigned short)); + +static const unsigned short ucs_r1_big5_table[] = { +/* 0xfa00 */ +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xc94a,0xddfc}; + +static const int ucs_r1_big5_table_min = 0xfa00; +static const int ucs_r1_big5_table_max = 0xfa00 + (sizeof (ucs_r1_big5_table) / sizeof (unsigned short)); + +static const unsigned short ucs_r2_big5_table[] = { +/* 0xfe00 */ +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,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xa14a,0xa157,0x0000,0xa159,0xa15b,0xa15f,0xa160,0xa163, +0xa164,0xa167,0xa168,0xa16b,0xa16c,0xa16f,0xa170,0xa173, +0xa174,0xa177,0xa178,0xa17b,0xa17c,0x0000,0x0000,0x0000, +0x0000,0xa1c6,0xa1c7,0xa1ca,0xa1cb,0xa1c8,0xa1c9,0xa15c, +0xa14d,0xa14e,0xa14f,0x0000,0xa151,0xa152,0xa153,0xa154, +0x0000,0xa17d,0xa17e,0xa1a1,0xa1a2,0xa1a3,0xa1a4,0xa1cc, +0xa1cd,0xa1ce,0xa1de,0xa1df,0xa1e0,0xa1e1,0xa1e2,0x0000, +0xa242,0xa24c,0xa24d,0xa24e,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,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,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,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, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +/* 0xff00 */ +0x0000,0xa149,0x0000,0xa1ad,0xa243,0xa248,0xa1ae,0x0000, +0xa15d,0xa15e,0xa1af,0xa1cf,0xa141,0xa1d0,0xa144,0xa1fe, +0xa2af,0xa2b0,0xa2b1,0xa2b2,0xa2b3,0xa2b4,0xa2b5,0xa2b6, +0xa2b7,0xa2b8,0xa147,0xa146,0xa1d5,0xa1d7,0xa1d6,0xa148, +0xa249,0xa2cf,0xa2d0,0xa2d1,0xa2d2,0xa2d3,0xa2d4,0xa2d5, +0xa2d6,0xa2d7,0xa2d8,0xa2d9,0xa2da,0xa2db,0xa2dc,0xa2dd, +0xa2de,0xa2df,0xa2e0,0xa2e1,0xa2e2,0xa2e3,0xa2e4,0xa2e5, +0xa2e6,0xa2e7,0xa2e8,0x0000,0xa240,0x0000,0x0000,0xa1c4, +0x0000,0xa2e9,0xa2ea,0xa2eb,0xa2ec,0xa2ed,0xa2ee,0xa2ef, +0xa2f0,0xa2f1,0xa2f2,0xa2f3,0xa2f4,0xa2f5,0xa2f6,0xa2f7, +0xa2f8,0xa2f9,0xa2fa,0xa2fb,0xa2fc,0xa2fd,0xa2fe,0xa340, +0xa341,0xa342,0xa343,0xa161,0xa155,0xa162,0xa1e3,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,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,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, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xa246,0xa247,0x0000,0xa1c3,0x0000,0xa244}; + +static const int ucs_r2_big5_table_min = 0xfe00; +static const int ucs_r2_big5_table_max = 0xfe00 + (sizeof (ucs_r2_big5_table) / sizeof (unsigned short)); + +#endif /* UNICODE_TABLE_BIG5_H */ diff --git a/ext/mbstring/unicode_table_tw.h b/ext/mbstring/libmbfl/filters/unicode_table_cns11643.h index ac29cc818a..0c17e1e616 100644 --- a/ext/mbstring/unicode_table_tw.h +++ b/ext/mbstring/libmbfl/filters/unicode_table_cns11643.h @@ -1,4 +1,31 @@ /* + * "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: Rui Hirokawa <hirokawa@php.net> + * + */ + +#ifndef UNICODE_TABLE_CNS11643_H +#define UNICODE_TABLE_CNS11643_H + +/* * Unicode table */ @@ -6119,5097 +6146,4 @@ static const int ucs_r_cns11643_table_min = 0xfe00; static const int ucs_r_cns11643_table_max = 0xfe00 + (sizeof (ucs_r_cns11643_table) / sizeof (unsigned int)); -/* Big5 -> UCS */ -static const unsigned short big5_ucs_table[] = { -0x3000,0xff0c,0x3001,0x3002,0xff0e,0x2027,0xff1b,0xff1a, -0xff1f,0xff01,0xfe30,0x2026,0x2025,0xfe50,0xfe51,0xfe52, -0x00b7,0xfe54,0xfe55,0xfe56,0xfe57,0xff5c,0x2013,0xfe31, -0x2014,0xfe33,0x2574,0xfe34,0xfe4f,0xff08,0xff09,0xfe35, -0xfe36,0xff5b,0xff5d,0xfe37,0xfe38,0x3014,0x3015,0xfe39, -0xfe3a,0x3010,0x3011,0xfe3b,0xfe3c,0x300a,0x300b,0xfe3d, -0xfe3e,0x3008,0x3009,0xfe3f,0xfe40,0x300c,0x300d,0xfe41, -0xfe42,0x300e,0x300f,0xfe43,0xfe44,0xfe59,0xfe5a,0xfe5b, -0xfe5c,0xfe5d,0xfe5e,0x2018,0x2019,0x201c,0x201d,0x301d, -0x301e,0x2035,0x2032,0xff03,0xff06,0xff0a,0x203b,0x00a7, -0x3003,0x25cb,0x25cf,0x25b3,0x25b2,0x25ce,0x2606,0x2605, -0x25c7,0x25c6,0x25a1,0x25a0,0x25bd,0x25bc,0x32a3,0x2105, -0x00af,0xffe3,0xff3f,0x02cd,0xfe49,0xfe4a,0xfe4d,0xfe4e, -0xfe4b,0xfe4c,0xfe5f,0xfe60,0xfe61,0xff0b,0xff0d,0x00d7, -0x00f7,0x00b1,0x221a,0xff1c,0xff1e,0xff1d,0x2266,0x2267, -0x2260,0x221e,0x2252,0x2261,0xfe62,0xfe63,0xfe64,0xfe65, -0xfe66,0xff5e,0x2229,0x222a,0x22a5,0x2220,0x221f,0x22bf, -0x33d2,0x33d1,0x222b,0x222e,0x2235,0x2234,0x2640,0x2642, -0x2295,0x2299,0x2191,0x2193,0x2190,0x2192,0x2196,0x2197, -0x2199,0x2198,0x2225,0x2223,0xff0f,0xff3c,0x2215,0xfe68, -0xff04,0xffe5,0x3012,0xffe0,0xffe1,0xff05,0xff20,0x2103, -0x2109,0xfe69,0xfe6a,0xfe6b,0x33d5,0x339c,0x339d,0x339e, -0x33ce,0x33a1,0x338e,0x338f,0x33c4,0x00b0,0x5159,0x515b, -0x515e,0x515d,0x5161,0x5163,0x55e7,0x74e9,0x7cce,0x2581, -0x2582,0x2583,0x2584,0x2585,0x2586,0x2587,0x2588,0x258f, -0x258e,0x258d,0x258c,0x258b,0x258a,0x2589,0x253c,0x2534, -0x252c,0x2524,0x251c,0x2594,0x2500,0x2502,0x2595,0x250c, -0x2510,0x2514,0x2518,0x256d,0x256e,0x2570,0x256f,0x2550, -0x255e,0x256a,0x2561,0x25e2,0x25e3,0x25e5,0x25e4,0x2571, -0x2572,0x2573,0xff10,0xff11,0xff12,0xff13,0xff14,0xff15, -0xff16,0xff17,0xff18,0xff19,0x2160,0x2161,0x2162,0x2163, -0x2164,0x2165,0x2166,0x2167,0x2168,0x2169,0x3021,0x3022, -0x3023,0x3024,0x3025,0x3026,0x3027,0x3028,0x3029,0x5341, -0x5344,0x5345,0xff21,0xff22,0xff23,0xff24,0xff25,0xff26, -0xff27,0xff28,0xff29,0xff2a,0xff2b,0xff2c,0xff2d,0xff2e, -0xff2f,0xff30,0xff31,0xff32,0xff33,0xff34,0xff35,0xff36, -0xff37,0xff38,0xff39,0xff3a,0xff41,0xff42,0xff43,0xff44, -0xff45,0xff46,0xff47,0xff48,0xff49,0xff4a,0xff4b,0xff4c, -0xff4d,0xff4e,0xff4f,0xff50,0xff51,0xff52,0xff53,0xff54, -0xff55,0xff56,0xff57,0xff58,0xff59,0xff5a,0x0391,0x0392, -0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,0x0399,0x039a, -0x039b,0x039c,0x039d,0x039e,0x039f,0x03a0,0x03a1,0x03a3, -0x03a4,0x03a5,0x03a6,0x03a7,0x03a8,0x03a9,0x03b1,0x03b2, -0x03b3,0x03b4,0x03b5,0x03b6,0x03b7,0x03b8,0x03b9,0x03ba, -0x03bb,0x03bc,0x03bd,0x03be,0x03bf,0x03c0,0x03c1,0x03c3, -0x03c4,0x03c5,0x03c6,0x03c7,0x03c8,0x03c9,0x3105,0x3106, -0x3107,0x3108,0x3109,0x310a,0x310b,0x310c,0x310d,0x310e, -0x310f,0x3110,0x3111,0x3112,0x3113,0x3114,0x3115,0x3116, -0x3117,0x3118,0x3119,0x311a,0x311b,0x311c,0x311d,0x311e, -0x311f,0x3120,0x3121,0x3122,0x3123,0x3124,0x3125,0x3126, -0x3127,0x3128,0x3129,0x02d9,0x02c9,0x02ca,0x02c7,0x02cb, -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,0x20ac,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,0x4e00, -0x4e59,0x4e01,0x4e03,0x4e43,0x4e5d,0x4e86,0x4e8c,0x4eba, -0x513f,0x5165,0x516b,0x51e0,0x5200,0x5201,0x529b,0x5315, -0x5341,0x535c,0x53c8,0x4e09,0x4e0b,0x4e08,0x4e0a,0x4e2b, -0x4e38,0x51e1,0x4e45,0x4e48,0x4e5f,0x4e5e,0x4e8e,0x4ea1, -0x5140,0x5203,0x52fa,0x5343,0x53c9,0x53e3,0x571f,0x58eb, -0x5915,0x5927,0x5973,0x5b50,0x5b51,0x5b53,0x5bf8,0x5c0f, -0x5c22,0x5c38,0x5c71,0x5ddd,0x5de5,0x5df1,0x5df2,0x5df3, -0x5dfe,0x5e72,0x5efe,0x5f0b,0x5f13,0x624d,0x4e11,0x4e10, -0x4e0d,0x4e2d,0x4e30,0x4e39,0x4e4b,0x5c39,0x4e88,0x4e91, -0x4e95,0x4e92,0x4e94,0x4ea2,0x4ec1,0x4ec0,0x4ec3,0x4ec6, -0x4ec7,0x4ecd,0x4eca,0x4ecb,0x4ec4,0x5143,0x5141,0x5167, -0x516d,0x516e,0x516c,0x5197,0x51f6,0x5206,0x5207,0x5208, -0x52fb,0x52fe,0x52ff,0x5316,0x5339,0x5348,0x5347,0x5345, -0x535e,0x5384,0x53cb,0x53ca,0x53cd,0x58ec,0x5929,0x592b, -0x592a,0x592d,0x5b54,0x5c11,0x5c24,0x5c3a,0x5c6f,0x5df4, -0x5e7b,0x5eff,0x5f14,0x5f15,0x5fc3,0x6208,0x6236,0x624b, -0x624e,0x652f,0x6587,0x6597,0x65a4,0x65b9,0x65e5,0x66f0, -0x6708,0x6728,0x6b20,0x6b62,0x6b79,0x6bcb,0x6bd4,0x6bdb, -0x6c0f,0x6c34,0x706b,0x722a,0x7236,0x723b,0x7247,0x7259, -0x725b,0x72ac,0x738b,0x4e19,0x4e16,0x4e15,0x4e14,0x4e18, -0x4e3b,0x4e4d,0x4e4f,0x4e4e,0x4ee5,0x4ed8,0x4ed4,0x4ed5, -0x4ed6,0x4ed7,0x4ee3,0x4ee4,0x4ed9,0x4ede,0x5145,0x5144, -0x5189,0x518a,0x51ac,0x51f9,0x51fa,0x51f8,0x520a,0x52a0, -0x529f,0x5305,0x5306,0x5317,0x531d,0x4edf,0x534a,0x5349, -0x5361,0x5360,0x536f,0x536e,0x53bb,0x53ef,0x53e4,0x53f3, -0x53ec,0x53ee,0x53e9,0x53e8,0x53fc,0x53f8,0x53f5,0x53eb, -0x53e6,0x53ea,0x53f2,0x53f1,0x53f0,0x53e5,0x53ed,0x53fb, -0x56db,0x56da,0x5916,0x592e,0x5931,0x5974,0x5976,0x5b55, -0x5b83,0x5c3c,0x5de8,0x5de7,0x5de6,0x5e02,0x5e03,0x5e73, -0x5e7c,0x5f01,0x5f18,0x5f17,0x5fc5,0x620a,0x6253,0x6254, -0x6252,0x6251,0x65a5,0x65e6,0x672e,0x672c,0x672a,0x672b, -0x672d,0x6b63,0x6bcd,0x6c11,0x6c10,0x6c38,0x6c41,0x6c40, -0x6c3e,0x72af,0x7384,0x7389,0x74dc,0x74e6,0x7518,0x751f, -0x7528,0x7529,0x7530,0x7531,0x7532,0x7533,0x758b,0x767d, -0x76ae,0x76bf,0x76ee,0x77db,0x77e2,0x77f3,0x793a,0x79be, -0x7a74,0x7acb,0x4e1e,0x4e1f,0x4e52,0x4e53,0x4e69,0x4e99, -0x4ea4,0x4ea6,0x4ea5,0x4eff,0x4f09,0x4f19,0x4f0a,0x4f15, -0x4f0d,0x4f10,0x4f11,0x4f0f,0x4ef2,0x4ef6,0x4efb,0x4ef0, -0x4ef3,0x4efd,0x4f01,0x4f0b,0x5149,0x5147,0x5146,0x5148, -0x5168,0x5171,0x518d,0x51b0,0x5217,0x5211,0x5212,0x520e, -0x5216,0x52a3,0x5308,0x5321,0x5320,0x5370,0x5371,0x5409, -0x540f,0x540c,0x540a,0x5410,0x5401,0x540b,0x5404,0x5411, -0x540d,0x5408,0x5403,0x540e,0x5406,0x5412,0x56e0,0x56de, -0x56dd,0x5733,0x5730,0x5728,0x572d,0x572c,0x572f,0x5729, -0x5919,0x591a,0x5937,0x5938,0x5984,0x5978,0x5983,0x597d, -0x5979,0x5982,0x5981,0x5b57,0x5b58,0x5b87,0x5b88,0x5b85, -0x5b89,0x5bfa,0x5c16,0x5c79,0x5dde,0x5e06,0x5e76,0x5e74, -0x5f0f,0x5f1b,0x5fd9,0x5fd6,0x620e,0x620c,0x620d,0x6210, -0x6263,0x625b,0x6258,0x6536,0x65e9,0x65e8,0x65ec,0x65ed, -0x66f2,0x66f3,0x6709,0x673d,0x6734,0x6731,0x6735,0x6b21, -0x6b64,0x6b7b,0x6c16,0x6c5d,0x6c57,0x6c59,0x6c5f,0x6c60, -0x6c50,0x6c55,0x6c61,0x6c5b,0x6c4d,0x6c4e,0x7070,0x725f, -0x725d,0x767e,0x7af9,0x7c73,0x7cf8,0x7f36,0x7f8a,0x7fbd, -0x8001,0x8003,0x800c,0x8012,0x8033,0x807f,0x8089,0x808b, -0x808c,0x81e3,0x81ea,0x81f3,0x81fc,0x820c,0x821b,0x821f, -0x826e,0x8272,0x827e,0x866b,0x8840,0x884c,0x8863,0x897f, -0x9621,0x4e32,0x4ea8,0x4f4d,0x4f4f,0x4f47,0x4f57,0x4f5e, -0x4f34,0x4f5b,0x4f55,0x4f30,0x4f50,0x4f51,0x4f3d,0x4f3a, -0x4f38,0x4f43,0x4f54,0x4f3c,0x4f46,0x4f63,0x4f5c,0x4f60, -0x4f2f,0x4f4e,0x4f36,0x4f59,0x4f5d,0x4f48,0x4f5a,0x514c, -0x514b,0x514d,0x5175,0x51b6,0x51b7,0x5225,0x5224,0x5229, -0x522a,0x5228,0x52ab,0x52a9,0x52aa,0x52ac,0x5323,0x5373, -0x5375,0x541d,0x542d,0x541e,0x543e,0x5426,0x544e,0x5427, -0x5446,0x5443,0x5433,0x5448,0x5442,0x541b,0x5429,0x544a, -0x5439,0x543b,0x5438,0x542e,0x5435,0x5436,0x5420,0x543c, -0x5440,0x5431,0x542b,0x541f,0x542c,0x56ea,0x56f0,0x56e4, -0x56eb,0x574a,0x5751,0x5740,0x574d,0x5747,0x574e,0x573e, -0x5750,0x574f,0x573b,0x58ef,0x593e,0x599d,0x5992,0x59a8, -0x599e,0x59a3,0x5999,0x5996,0x598d,0x59a4,0x5993,0x598a, -0x59a5,0x5b5d,0x5b5c,0x5b5a,0x5b5b,0x5b8c,0x5b8b,0x5b8f, -0x5c2c,0x5c40,0x5c41,0x5c3f,0x5c3e,0x5c90,0x5c91,0x5c94, -0x5c8c,0x5deb,0x5e0c,0x5e8f,0x5e87,0x5e8a,0x5ef7,0x5f04, -0x5f1f,0x5f64,0x5f62,0x5f77,0x5f79,0x5fd8,0x5fcc,0x5fd7, -0x5fcd,0x5ff1,0x5feb,0x5ff8,0x5fea,0x6212,0x6211,0x6284, -0x6297,0x6296,0x6280,0x6276,0x6289,0x626d,0x628a,0x627c, -0x627e,0x6279,0x6273,0x6292,0x626f,0x6298,0x626e,0x6295, -0x6293,0x6291,0x6286,0x6539,0x653b,0x6538,0x65f1,0x66f4, -0x675f,0x674e,0x674f,0x6750,0x6751,0x675c,0x6756,0x675e, -0x6749,0x6746,0x6760,0x6753,0x6757,0x6b65,0x6bcf,0x6c42, -0x6c5e,0x6c99,0x6c81,0x6c88,0x6c89,0x6c85,0x6c9b,0x6c6a, -0x6c7a,0x6c90,0x6c70,0x6c8c,0x6c68,0x6c96,0x6c92,0x6c7d, -0x6c83,0x6c72,0x6c7e,0x6c74,0x6c86,0x6c76,0x6c8d,0x6c94, -0x6c98,0x6c82,0x7076,0x707c,0x707d,0x7078,0x7262,0x7261, -0x7260,0x72c4,0x72c2,0x7396,0x752c,0x752b,0x7537,0x7538, -0x7682,0x76ef,0x77e3,0x79c1,0x79c0,0x79bf,0x7a76,0x7cfb, -0x7f55,0x8096,0x8093,0x809d,0x8098,0x809b,0x809a,0x80b2, -0x826f,0x8292,0x828b,0x828d,0x898b,0x89d2,0x8a00,0x8c37, -0x8c46,0x8c55,0x8c9d,0x8d64,0x8d70,0x8db3,0x8eab,0x8eca, -0x8f9b,0x8fb0,0x8fc2,0x8fc6,0x8fc5,0x8fc4,0x5de1,0x9091, -0x90a2,0x90aa,0x90a6,0x90a3,0x9149,0x91c6,0x91cc,0x9632, -0x962e,0x9631,0x962a,0x962c,0x4e26,0x4e56,0x4e73,0x4e8b, -0x4e9b,0x4e9e,0x4eab,0x4eac,0x4f6f,0x4f9d,0x4f8d,0x4f73, -0x4f7f,0x4f6c,0x4f9b,0x4f8b,0x4f86,0x4f83,0x4f70,0x4f75, -0x4f88,0x4f69,0x4f7b,0x4f96,0x4f7e,0x4f8f,0x4f91,0x4f7a, -0x5154,0x5152,0x5155,0x5169,0x5177,0x5176,0x5178,0x51bd, -0x51fd,0x523b,0x5238,0x5237,0x523a,0x5230,0x522e,0x5236, -0x5241,0x52be,0x52bb,0x5352,0x5354,0x5353,0x5351,0x5366, -0x5377,0x5378,0x5379,0x53d6,0x53d4,0x53d7,0x5473,0x5475, -0x5496,0x5478,0x5495,0x5480,0x547b,0x5477,0x5484,0x5492, -0x5486,0x547c,0x5490,0x5471,0x5476,0x548c,0x549a,0x5462, -0x5468,0x548b,0x547d,0x548e,0x56fa,0x5783,0x5777,0x576a, -0x5769,0x5761,0x5766,0x5764,0x577c,0x591c,0x5949,0x5947, -0x5948,0x5944,0x5954,0x59be,0x59bb,0x59d4,0x59b9,0x59ae, -0x59d1,0x59c6,0x59d0,0x59cd,0x59cb,0x59d3,0x59ca,0x59af, -0x59b3,0x59d2,0x59c5,0x5b5f,0x5b64,0x5b63,0x5b97,0x5b9a, -0x5b98,0x5b9c,0x5b99,0x5b9b,0x5c1a,0x5c48,0x5c45,0x5c46, -0x5cb7,0x5ca1,0x5cb8,0x5ca9,0x5cab,0x5cb1,0x5cb3,0x5e18, -0x5e1a,0x5e16,0x5e15,0x5e1b,0x5e11,0x5e78,0x5e9a,0x5e97, -0x5e9c,0x5e95,0x5e96,0x5ef6,0x5f26,0x5f27,0x5f29,0x5f80, -0x5f81,0x5f7f,0x5f7c,0x5fdd,0x5fe0,0x5ffd,0x5ff5,0x5fff, -0x600f,0x6014,0x602f,0x6035,0x6016,0x602a,0x6015,0x6021, -0x6027,0x6029,0x602b,0x601b,0x6216,0x6215,0x623f,0x623e, -0x6240,0x627f,0x62c9,0x62cc,0x62c4,0x62bf,0x62c2,0x62b9, -0x62d2,0x62db,0x62ab,0x62d3,0x62d4,0x62cb,0x62c8,0x62a8, -0x62bd,0x62bc,0x62d0,0x62d9,0x62c7,0x62cd,0x62b5,0x62da, -0x62b1,0x62d8,0x62d6,0x62d7,0x62c6,0x62ac,0x62ce,0x653e, -0x65a7,0x65bc,0x65fa,0x6614,0x6613,0x660c,0x6606,0x6602, -0x660e,0x6600,0x660f,0x6615,0x660a,0x6607,0x670d,0x670b, -0x676d,0x678b,0x6795,0x6771,0x679c,0x6773,0x6777,0x6787, -0x679d,0x6797,0x676f,0x6770,0x677f,0x6789,0x677e,0x6790, -0x6775,0x679a,0x6793,0x677c,0x676a,0x6772,0x6b23,0x6b66, -0x6b67,0x6b7f,0x6c13,0x6c1b,0x6ce3,0x6ce8,0x6cf3,0x6cb1, -0x6ccc,0x6ce5,0x6cb3,0x6cbd,0x6cbe,0x6cbc,0x6ce2,0x6cab, -0x6cd5,0x6cd3,0x6cb8,0x6cc4,0x6cb9,0x6cc1,0x6cae,0x6cd7, -0x6cc5,0x6cf1,0x6cbf,0x6cbb,0x6ce1,0x6cdb,0x6cca,0x6cac, -0x6cef,0x6cdc,0x6cd6,0x6ce0,0x7095,0x708e,0x7092,0x708a, -0x7099,0x722c,0x722d,0x7238,0x7248,0x7267,0x7269,0x72c0, -0x72ce,0x72d9,0x72d7,0x72d0,0x73a9,0x73a8,0x739f,0x73ab, -0x73a5,0x753d,0x759d,0x7599,0x759a,0x7684,0x76c2,0x76f2, -0x76f4,0x77e5,0x77fd,0x793e,0x7940,0x7941,0x79c9,0x79c8, -0x7a7a,0x7a79,0x7afa,0x7cfe,0x7f54,0x7f8c,0x7f8b,0x8005, -0x80ba,0x80a5,0x80a2,0x80b1,0x80a1,0x80ab,0x80a9,0x80b4, -0x80aa,0x80af,0x81e5,0x81fe,0x820d,0x82b3,0x829d,0x8299, -0x82ad,0x82bd,0x829f,0x82b9,0x82b1,0x82ac,0x82a5,0x82af, -0x82b8,0x82a3,0x82b0,0x82be,0x82b7,0x864e,0x8671,0x521d, -0x8868,0x8ecb,0x8fce,0x8fd4,0x8fd1,0x90b5,0x90b8,0x90b1, -0x90b6,0x91c7,0x91d1,0x9577,0x9580,0x961c,0x9640,0x963f, -0x963b,0x9644,0x9642,0x96b9,0x96e8,0x9752,0x975e,0x4e9f, -0x4ead,0x4eae,0x4fe1,0x4fb5,0x4faf,0x4fbf,0x4fe0,0x4fd1, -0x4fcf,0x4fdd,0x4fc3,0x4fb6,0x4fd8,0x4fdf,0x4fca,0x4fd7, -0x4fae,0x4fd0,0x4fc4,0x4fc2,0x4fda,0x4fce,0x4fde,0x4fb7, -0x5157,0x5192,0x5191,0x51a0,0x524e,0x5243,0x524a,0x524d, -0x524c,0x524b,0x5247,0x52c7,0x52c9,0x52c3,0x52c1,0x530d, -0x5357,0x537b,0x539a,0x53db,0x54ac,0x54c0,0x54a8,0x54ce, -0x54c9,0x54b8,0x54a6,0x54b3,0x54c7,0x54c2,0x54bd,0x54aa, -0x54c1,0x54c4,0x54c8,0x54af,0x54ab,0x54b1,0x54bb,0x54a9, -0x54a7,0x54bf,0x56ff,0x5782,0x578b,0x57a0,0x57a3,0x57a2, -0x57ce,0x57ae,0x5793,0x5955,0x5951,0x594f,0x594e,0x5950, -0x59dc,0x59d8,0x59ff,0x59e3,0x59e8,0x5a03,0x59e5,0x59ea, -0x59da,0x59e6,0x5a01,0x59fb,0x5b69,0x5ba3,0x5ba6,0x5ba4, -0x5ba2,0x5ba5,0x5c01,0x5c4e,0x5c4f,0x5c4d,0x5c4b,0x5cd9, -0x5cd2,0x5df7,0x5e1d,0x5e25,0x5e1f,0x5e7d,0x5ea0,0x5ea6, -0x5efa,0x5f08,0x5f2d,0x5f65,0x5f88,0x5f85,0x5f8a,0x5f8b, -0x5f87,0x5f8c,0x5f89,0x6012,0x601d,0x6020,0x6025,0x600e, -0x6028,0x604d,0x6070,0x6068,0x6062,0x6046,0x6043,0x606c, -0x606b,0x606a,0x6064,0x6241,0x62dc,0x6316,0x6309,0x62fc, -0x62ed,0x6301,0x62ee,0x62fd,0x6307,0x62f1,0x62f7,0x62ef, -0x62ec,0x62fe,0x62f4,0x6311,0x6302,0x653f,0x6545,0x65ab, -0x65bd,0x65e2,0x6625,0x662d,0x6620,0x6627,0x662f,0x661f, -0x6628,0x6631,0x6624,0x66f7,0x67ff,0x67d3,0x67f1,0x67d4, -0x67d0,0x67ec,0x67b6,0x67af,0x67f5,0x67e9,0x67ef,0x67c4, -0x67d1,0x67b4,0x67da,0x67e5,0x67b8,0x67cf,0x67de,0x67f3, -0x67b0,0x67d9,0x67e2,0x67dd,0x67d2,0x6b6a,0x6b83,0x6b86, -0x6bb5,0x6bd2,0x6bd7,0x6c1f,0x6cc9,0x6d0b,0x6d32,0x6d2a, -0x6d41,0x6d25,0x6d0c,0x6d31,0x6d1e,0x6d17,0x6d3b,0x6d3d, -0x6d3e,0x6d36,0x6d1b,0x6cf5,0x6d39,0x6d27,0x6d38,0x6d29, -0x6d2e,0x6d35,0x6d0e,0x6d2b,0x70ab,0x70ba,0x70b3,0x70ac, -0x70af,0x70ad,0x70b8,0x70ae,0x70a4,0x7230,0x7272,0x726f, -0x7274,0x72e9,0x72e0,0x72e1,0x73b7,0x73ca,0x73bb,0x73b2, -0x73cd,0x73c0,0x73b3,0x751a,0x752d,0x754f,0x754c,0x754e, -0x754b,0x75ab,0x75a4,0x75a5,0x75a2,0x75a3,0x7678,0x7686, -0x7687,0x7688,0x76c8,0x76c6,0x76c3,0x76c5,0x7701,0x76f9, -0x76f8,0x7709,0x770b,0x76fe,0x76fc,0x7707,0x77dc,0x7802, -0x7814,0x780c,0x780d,0x7946,0x7949,0x7948,0x7947,0x79b9, -0x79ba,0x79d1,0x79d2,0x79cb,0x7a7f,0x7a81,0x7aff,0x7afd, -0x7c7d,0x7d02,0x7d05,0x7d00,0x7d09,0x7d07,0x7d04,0x7d06, -0x7f38,0x7f8e,0x7fbf,0x8004,0x8010,0x800d,0x8011,0x8036, -0x80d6,0x80e5,0x80da,0x80c3,0x80c4,0x80cc,0x80e1,0x80db, -0x80ce,0x80de,0x80e4,0x80dd,0x81f4,0x8222,0x82e7,0x8303, -0x8305,0x82e3,0x82db,0x82e6,0x8304,0x82e5,0x8302,0x8309, -0x82d2,0x82d7,0x82f1,0x8301,0x82dc,0x82d4,0x82d1,0x82de, -0x82d3,0x82df,0x82ef,0x8306,0x8650,0x8679,0x867b,0x867a, -0x884d,0x886b,0x8981,0x89d4,0x8a08,0x8a02,0x8a03,0x8c9e, -0x8ca0,0x8d74,0x8d73,0x8db4,0x8ecd,0x8ecc,0x8ff0,0x8fe6, -0x8fe2,0x8fea,0x8fe5,0x8fed,0x8feb,0x8fe4,0x8fe8,0x90ca, -0x90ce,0x90c1,0x90c3,0x914b,0x914a,0x91cd,0x9582,0x9650, -0x964b,0x964c,0x964d,0x9762,0x9769,0x97cb,0x97ed,0x97f3, -0x9801,0x98a8,0x98db,0x98df,0x9996,0x9999,0x4e58,0x4eb3, -0x500c,0x500d,0x5023,0x4fef,0x5026,0x5025,0x4ff8,0x5029, -0x5016,0x5006,0x503c,0x501f,0x501a,0x5012,0x5011,0x4ffa, -0x5000,0x5014,0x5028,0x4ff1,0x5021,0x500b,0x5019,0x5018, -0x4ff3,0x4fee,0x502d,0x502a,0x4ffe,0x502b,0x5009,0x517c, -0x51a4,0x51a5,0x51a2,0x51cd,0x51cc,0x51c6,0x51cb,0x5256, -0x525c,0x5254,0x525b,0x525d,0x532a,0x537f,0x539f,0x539d, -0x53df,0x54e8,0x5510,0x5501,0x5537,0x54fc,0x54e5,0x54f2, -0x5506,0x54fa,0x5514,0x54e9,0x54ed,0x54e1,0x5509,0x54ee, -0x54ea,0x54e6,0x5527,0x5507,0x54fd,0x550f,0x5703,0x5704, -0x57c2,0x57d4,0x57cb,0x57c3,0x5809,0x590f,0x5957,0x5958, -0x595a,0x5a11,0x5a18,0x5a1c,0x5a1f,0x5a1b,0x5a13,0x59ec, -0x5a20,0x5a23,0x5a29,0x5a25,0x5a0c,0x5a09,0x5b6b,0x5c58, -0x5bb0,0x5bb3,0x5bb6,0x5bb4,0x5bae,0x5bb5,0x5bb9,0x5bb8, -0x5c04,0x5c51,0x5c55,0x5c50,0x5ced,0x5cfd,0x5cfb,0x5cea, -0x5ce8,0x5cf0,0x5cf6,0x5d01,0x5cf4,0x5dee,0x5e2d,0x5e2b, -0x5eab,0x5ead,0x5ea7,0x5f31,0x5f92,0x5f91,0x5f90,0x6059, -0x6063,0x6065,0x6050,0x6055,0x606d,0x6069,0x606f,0x6084, -0x609f,0x609a,0x608d,0x6094,0x608c,0x6085,0x6096,0x6247, -0x62f3,0x6308,0x62ff,0x634e,0x633e,0x632f,0x6355,0x6342, -0x6346,0x634f,0x6349,0x633a,0x6350,0x633d,0x632a,0x632b, -0x6328,0x634d,0x634c,0x6548,0x6549,0x6599,0x65c1,0x65c5, -0x6642,0x6649,0x664f,0x6643,0x6652,0x664c,0x6645,0x6641, -0x66f8,0x6714,0x6715,0x6717,0x6821,0x6838,0x6848,0x6846, -0x6853,0x6839,0x6842,0x6854,0x6829,0x68b3,0x6817,0x684c, -0x6851,0x683d,0x67f4,0x6850,0x6840,0x683c,0x6843,0x682a, -0x6845,0x6813,0x6818,0x6841,0x6b8a,0x6b89,0x6bb7,0x6c23, -0x6c27,0x6c28,0x6c26,0x6c24,0x6cf0,0x6d6a,0x6d95,0x6d88, -0x6d87,0x6d66,0x6d78,0x6d77,0x6d59,0x6d93,0x6d6c,0x6d89, -0x6d6e,0x6d5a,0x6d74,0x6d69,0x6d8c,0x6d8a,0x6d79,0x6d85, -0x6d65,0x6d94,0x70ca,0x70d8,0x70e4,0x70d9,0x70c8,0x70cf, -0x7239,0x7279,0x72fc,0x72f9,0x72fd,0x72f8,0x72f7,0x7386, -0x73ed,0x7409,0x73ee,0x73e0,0x73ea,0x73de,0x7554,0x755d, -0x755c,0x755a,0x7559,0x75be,0x75c5,0x75c7,0x75b2,0x75b3, -0x75bd,0x75bc,0x75b9,0x75c2,0x75b8,0x768b,0x76b0,0x76ca, -0x76cd,0x76ce,0x7729,0x771f,0x7720,0x7728,0x77e9,0x7830, -0x7827,0x7838,0x781d,0x7834,0x7837,0x7825,0x782d,0x7820, -0x781f,0x7832,0x7955,0x7950,0x7960,0x795f,0x7956,0x795e, -0x795d,0x7957,0x795a,0x79e4,0x79e3,0x79e7,0x79df,0x79e6, -0x79e9,0x79d8,0x7a84,0x7a88,0x7ad9,0x7b06,0x7b11,0x7c89, -0x7d21,0x7d17,0x7d0b,0x7d0a,0x7d20,0x7d22,0x7d14,0x7d10, -0x7d15,0x7d1a,0x7d1c,0x7d0d,0x7d19,0x7d1b,0x7f3a,0x7f5f, -0x7f94,0x7fc5,0x7fc1,0x8006,0x8018,0x8015,0x8019,0x8017, -0x803d,0x803f,0x80f1,0x8102,0x80f0,0x8105,0x80ed,0x80f4, -0x8106,0x80f8,0x80f3,0x8108,0x80fd,0x810a,0x80fc,0x80ef, -0x81ed,0x81ec,0x8200,0x8210,0x822a,0x822b,0x8228,0x822c, -0x82bb,0x832b,0x8352,0x8354,0x834a,0x8338,0x8350,0x8349, -0x8335,0x8334,0x834f,0x8332,0x8339,0x8336,0x8317,0x8340, -0x8331,0x8328,0x8343,0x8654,0x868a,0x86aa,0x8693,0x86a4, -0x86a9,0x868c,0x86a3,0x869c,0x8870,0x8877,0x8881,0x8882, -0x887d,0x8879,0x8a18,0x8a10,0x8a0e,0x8a0c,0x8a15,0x8a0a, -0x8a17,0x8a13,0x8a16,0x8a0f,0x8a11,0x8c48,0x8c7a,0x8c79, -0x8ca1,0x8ca2,0x8d77,0x8eac,0x8ed2,0x8ed4,0x8ecf,0x8fb1, -0x9001,0x9006,0x8ff7,0x9000,0x8ffa,0x8ff4,0x9003,0x8ffd, -0x9005,0x8ff8,0x9095,0x90e1,0x90dd,0x90e2,0x9152,0x914d, -0x914c,0x91d8,0x91dd,0x91d7,0x91dc,0x91d9,0x9583,0x9662, -0x9663,0x9661,0x965b,0x965d,0x9664,0x9658,0x965e,0x96bb, -0x98e2,0x99ac,0x9aa8,0x9ad8,0x9b25,0x9b32,0x9b3c,0x4e7e, -0x507a,0x507d,0x505c,0x5047,0x5043,0x504c,0x505a,0x5049, -0x5065,0x5076,0x504e,0x5055,0x5075,0x5074,0x5077,0x504f, -0x500f,0x506f,0x506d,0x515c,0x5195,0x51f0,0x526a,0x526f, -0x52d2,0x52d9,0x52d8,0x52d5,0x5310,0x530f,0x5319,0x533f, -0x5340,0x533e,0x53c3,0x66fc,0x5546,0x556a,0x5566,0x5544, -0x555e,0x5561,0x5543,0x554a,0x5531,0x5556,0x554f,0x5555, -0x552f,0x5564,0x5538,0x552e,0x555c,0x552c,0x5563,0x5533, -0x5541,0x5557,0x5708,0x570b,0x5709,0x57df,0x5805,0x580a, -0x5806,0x57e0,0x57e4,0x57fa,0x5802,0x5835,0x57f7,0x57f9, -0x5920,0x5962,0x5a36,0x5a41,0x5a49,0x5a66,0x5a6a,0x5a40, -0x5a3c,0x5a62,0x5a5a,0x5a46,0x5a4a,0x5b70,0x5bc7,0x5bc5, -0x5bc4,0x5bc2,0x5bbf,0x5bc6,0x5c09,0x5c08,0x5c07,0x5c60, -0x5c5c,0x5c5d,0x5d07,0x5d06,0x5d0e,0x5d1b,0x5d16,0x5d22, -0x5d11,0x5d29,0x5d14,0x5d19,0x5d24,0x5d27,0x5d17,0x5de2, -0x5e38,0x5e36,0x5e33,0x5e37,0x5eb7,0x5eb8,0x5eb6,0x5eb5, -0x5ebe,0x5f35,0x5f37,0x5f57,0x5f6c,0x5f69,0x5f6b,0x5f97, -0x5f99,0x5f9e,0x5f98,0x5fa1,0x5fa0,0x5f9c,0x607f,0x60a3, -0x6089,0x60a0,0x60a8,0x60cb,0x60b4,0x60e6,0x60bd,0x60c5, -0x60bb,0x60b5,0x60dc,0x60bc,0x60d8,0x60d5,0x60c6,0x60df, -0x60b8,0x60da,0x60c7,0x621a,0x621b,0x6248,0x63a0,0x63a7, -0x6372,0x6396,0x63a2,0x63a5,0x6377,0x6367,0x6398,0x63aa, -0x6371,0x63a9,0x6389,0x6383,0x639b,0x636b,0x63a8,0x6384, -0x6388,0x6399,0x63a1,0x63ac,0x6392,0x638f,0x6380,0x637b, -0x6369,0x6368,0x637a,0x655d,0x6556,0x6551,0x6559,0x6557, -0x555f,0x654f,0x6558,0x6555,0x6554,0x659c,0x659b,0x65ac, -0x65cf,0x65cb,0x65cc,0x65ce,0x665d,0x665a,0x6664,0x6668, -0x6666,0x665e,0x66f9,0x52d7,0x671b,0x6881,0x68af,0x68a2, -0x6893,0x68b5,0x687f,0x6876,0x68b1,0x68a7,0x6897,0x68b0, -0x6883,0x68c4,0x68ad,0x6886,0x6885,0x6894,0x689d,0x68a8, -0x689f,0x68a1,0x6882,0x6b32,0x6bba,0x6beb,0x6bec,0x6c2b, -0x6d8e,0x6dbc,0x6df3,0x6dd9,0x6db2,0x6de1,0x6dcc,0x6de4, -0x6dfb,0x6dfa,0x6e05,0x6dc7,0x6dcb,0x6daf,0x6dd1,0x6dae, -0x6dde,0x6df9,0x6db8,0x6df7,0x6df5,0x6dc5,0x6dd2,0x6e1a, -0x6db5,0x6dda,0x6deb,0x6dd8,0x6dea,0x6df1,0x6dee,0x6de8, -0x6dc6,0x6dc4,0x6daa,0x6dec,0x6dbf,0x6de6,0x70f9,0x7109, -0x710a,0x70fd,0x70ef,0x723d,0x727d,0x7281,0x731c,0x731b, -0x7316,0x7313,0x7319,0x7387,0x7405,0x740a,0x7403,0x7406, -0x73fe,0x740d,0x74e0,0x74f6,0x74f7,0x751c,0x7522,0x7565, -0x7566,0x7562,0x7570,0x758f,0x75d4,0x75d5,0x75b5,0x75ca, -0x75cd,0x768e,0x76d4,0x76d2,0x76db,0x7737,0x773e,0x773c, -0x7736,0x7738,0x773a,0x786b,0x7843,0x784e,0x7965,0x7968, -0x796d,0x79fb,0x7a92,0x7a95,0x7b20,0x7b28,0x7b1b,0x7b2c, -0x7b26,0x7b19,0x7b1e,0x7b2e,0x7c92,0x7c97,0x7c95,0x7d46, -0x7d43,0x7d71,0x7d2e,0x7d39,0x7d3c,0x7d40,0x7d30,0x7d33, -0x7d44,0x7d2f,0x7d42,0x7d32,0x7d31,0x7f3d,0x7f9e,0x7f9a, -0x7fcc,0x7fce,0x7fd2,0x801c,0x804a,0x8046,0x812f,0x8116, -0x8123,0x812b,0x8129,0x8130,0x8124,0x8202,0x8235,0x8237, -0x8236,0x8239,0x838e,0x839e,0x8398,0x8378,0x83a2,0x8396, -0x83bd,0x83ab,0x8392,0x838a,0x8393,0x8389,0x83a0,0x8377, -0x837b,0x837c,0x8386,0x83a7,0x8655,0x5f6a,0x86c7,0x86c0, -0x86b6,0x86c4,0x86b5,0x86c6,0x86cb,0x86b1,0x86af,0x86c9, -0x8853,0x889e,0x8888,0x88ab,0x8892,0x8896,0x888d,0x888b, -0x8993,0x898f,0x8a2a,0x8a1d,0x8a23,0x8a25,0x8a31,0x8a2d, -0x8a1f,0x8a1b,0x8a22,0x8c49,0x8c5a,0x8ca9,0x8cac,0x8cab, -0x8ca8,0x8caa,0x8ca7,0x8d67,0x8d66,0x8dbe,0x8dba,0x8edb, -0x8edf,0x9019,0x900d,0x901a,0x9017,0x9023,0x901f,0x901d, -0x9010,0x9015,0x901e,0x9020,0x900f,0x9022,0x9016,0x901b, -0x9014,0x90e8,0x90ed,0x90fd,0x9157,0x91ce,0x91f5,0x91e6, -0x91e3,0x91e7,0x91ed,0x91e9,0x9589,0x966a,0x9675,0x9673, -0x9678,0x9670,0x9674,0x9676,0x9677,0x966c,0x96c0,0x96ea, -0x96e9,0x7ae0,0x7adf,0x9802,0x9803,0x9b5a,0x9ce5,0x9e75, -0x9e7f,0x9ea5,0x9ebb,0x50a2,0x508d,0x5085,0x5099,0x5091, -0x5080,0x5096,0x5098,0x509a,0x6700,0x51f1,0x5272,0x5274, -0x5275,0x5269,0x52de,0x52dd,0x52db,0x535a,0x53a5,0x557b, -0x5580,0x55a7,0x557c,0x558a,0x559d,0x5598,0x5582,0x559c, -0x55aa,0x5594,0x5587,0x558b,0x5583,0x55b3,0x55ae,0x559f, -0x553e,0x55b2,0x559a,0x55bb,0x55ac,0x55b1,0x557e,0x5589, -0x55ab,0x5599,0x570d,0x582f,0x582a,0x5834,0x5824,0x5830, -0x5831,0x5821,0x581d,0x5820,0x58f9,0x58fa,0x5960,0x5a77, -0x5a9a,0x5a7f,0x5a92,0x5a9b,0x5aa7,0x5b73,0x5b71,0x5bd2, -0x5bcc,0x5bd3,0x5bd0,0x5c0a,0x5c0b,0x5c31,0x5d4c,0x5d50, -0x5d34,0x5d47,0x5dfd,0x5e45,0x5e3d,0x5e40,0x5e43,0x5e7e, -0x5eca,0x5ec1,0x5ec2,0x5ec4,0x5f3c,0x5f6d,0x5fa9,0x5faa, -0x5fa8,0x60d1,0x60e1,0x60b2,0x60b6,0x60e0,0x611c,0x6123, -0x60fa,0x6115,0x60f0,0x60fb,0x60f4,0x6168,0x60f1,0x610e, -0x60f6,0x6109,0x6100,0x6112,0x621f,0x6249,0x63a3,0x638c, -0x63cf,0x63c0,0x63e9,0x63c9,0x63c6,0x63cd,0x63d2,0x63e3, -0x63d0,0x63e1,0x63d6,0x63ed,0x63ee,0x6376,0x63f4,0x63ea, -0x63db,0x6452,0x63da,0x63f9,0x655e,0x6566,0x6562,0x6563, -0x6591,0x6590,0x65af,0x666e,0x6670,0x6674,0x6676,0x666f, -0x6691,0x667a,0x667e,0x6677,0x66fe,0x66ff,0x671f,0x671d, -0x68fa,0x68d5,0x68e0,0x68d8,0x68d7,0x6905,0x68df,0x68f5, -0x68ee,0x68e7,0x68f9,0x68d2,0x68f2,0x68e3,0x68cb,0x68cd, -0x690d,0x6912,0x690e,0x68c9,0x68da,0x696e,0x68fb,0x6b3e, -0x6b3a,0x6b3d,0x6b98,0x6b96,0x6bbc,0x6bef,0x6c2e,0x6c2f, -0x6c2c,0x6e2f,0x6e38,0x6e54,0x6e21,0x6e32,0x6e67,0x6e4a, -0x6e20,0x6e25,0x6e23,0x6e1b,0x6e5b,0x6e58,0x6e24,0x6e56, -0x6e6e,0x6e2d,0x6e26,0x6e6f,0x6e34,0x6e4d,0x6e3a,0x6e2c, -0x6e43,0x6e1d,0x6e3e,0x6ecb,0x6e89,0x6e19,0x6e4e,0x6e63, -0x6e44,0x6e72,0x6e69,0x6e5f,0x7119,0x711a,0x7126,0x7130, -0x7121,0x7136,0x716e,0x711c,0x724c,0x7284,0x7280,0x7336, -0x7325,0x7334,0x7329,0x743a,0x742a,0x7433,0x7422,0x7425, -0x7435,0x7436,0x7434,0x742f,0x741b,0x7426,0x7428,0x7525, -0x7526,0x756b,0x756a,0x75e2,0x75db,0x75e3,0x75d9,0x75d8, -0x75de,0x75e0,0x767b,0x767c,0x7696,0x7693,0x76b4,0x76dc, -0x774f,0x77ed,0x785d,0x786c,0x786f,0x7a0d,0x7a08,0x7a0b, -0x7a05,0x7a00,0x7a98,0x7a97,0x7a96,0x7ae5,0x7ae3,0x7b49, -0x7b56,0x7b46,0x7b50,0x7b52,0x7b54,0x7b4d,0x7b4b,0x7b4f, -0x7b51,0x7c9f,0x7ca5,0x7d5e,0x7d50,0x7d68,0x7d55,0x7d2b, -0x7d6e,0x7d72,0x7d61,0x7d66,0x7d62,0x7d70,0x7d73,0x5584, -0x7fd4,0x7fd5,0x800b,0x8052,0x8085,0x8155,0x8154,0x814b, -0x8151,0x814e,0x8139,0x8146,0x813e,0x814c,0x8153,0x8174, -0x8212,0x821c,0x83e9,0x8403,0x83f8,0x840d,0x83e0,0x83c5, -0x840b,0x83c1,0x83ef,0x83f1,0x83f4,0x8457,0x840a,0x83f0, -0x840c,0x83cc,0x83fd,0x83f2,0x83ca,0x8438,0x840e,0x8404, -0x83dc,0x8407,0x83d4,0x83df,0x865b,0x86df,0x86d9,0x86ed, -0x86d4,0x86db,0x86e4,0x86d0,0x86de,0x8857,0x88c1,0x88c2, -0x88b1,0x8983,0x8996,0x8a3b,0x8a60,0x8a55,0x8a5e,0x8a3c, -0x8a41,0x8a54,0x8a5b,0x8a50,0x8a46,0x8a34,0x8a3a,0x8a36, -0x8a56,0x8c61,0x8c82,0x8caf,0x8cbc,0x8cb3,0x8cbd,0x8cc1, -0x8cbb,0x8cc0,0x8cb4,0x8cb7,0x8cb6,0x8cbf,0x8cb8,0x8d8a, -0x8d85,0x8d81,0x8dce,0x8ddd,0x8dcb,0x8dda,0x8dd1,0x8dcc, -0x8ddb,0x8dc6,0x8efb,0x8ef8,0x8efc,0x8f9c,0x902e,0x9035, -0x9031,0x9038,0x9032,0x9036,0x9102,0x90f5,0x9109,0x90fe, -0x9163,0x9165,0x91cf,0x9214,0x9215,0x9223,0x9209,0x921e, -0x920d,0x9210,0x9207,0x9211,0x9594,0x958f,0x958b,0x9591, -0x9593,0x9592,0x958e,0x968a,0x968e,0x968b,0x967d,0x9685, -0x9686,0x968d,0x9672,0x9684,0x96c1,0x96c5,0x96c4,0x96c6, -0x96c7,0x96ef,0x96f2,0x97cc,0x9805,0x9806,0x9808,0x98e7, -0x98ea,0x98ef,0x98e9,0x98f2,0x98ed,0x99ae,0x99ad,0x9ec3, -0x9ecd,0x9ed1,0x4e82,0x50ad,0x50b5,0x50b2,0x50b3,0x50c5, -0x50be,0x50ac,0x50b7,0x50bb,0x50af,0x50c7,0x527f,0x5277, -0x527d,0x52df,0x52e6,0x52e4,0x52e2,0x52e3,0x532f,0x55df, -0x55e8,0x55d3,0x55e6,0x55ce,0x55dc,0x55c7,0x55d1,0x55e3, -0x55e4,0x55ef,0x55da,0x55e1,0x55c5,0x55c6,0x55e5,0x55c9, -0x5712,0x5713,0x585e,0x5851,0x5858,0x5857,0x585a,0x5854, -0x586b,0x584c,0x586d,0x584a,0x5862,0x5852,0x584b,0x5967, -0x5ac1,0x5ac9,0x5acc,0x5abe,0x5abd,0x5abc,0x5ab3,0x5ac2, -0x5ab2,0x5d69,0x5d6f,0x5e4c,0x5e79,0x5ec9,0x5ec8,0x5f12, -0x5f59,0x5fac,0x5fae,0x611a,0x610f,0x6148,0x611f,0x60f3, -0x611b,0x60f9,0x6101,0x6108,0x614e,0x614c,0x6144,0x614d, -0x613e,0x6134,0x6127,0x610d,0x6106,0x6137,0x6221,0x6222, -0x6413,0x643e,0x641e,0x642a,0x642d,0x643d,0x642c,0x640f, -0x641c,0x6414,0x640d,0x6436,0x6416,0x6417,0x6406,0x656c, -0x659f,0x65b0,0x6697,0x6689,0x6687,0x6688,0x6696,0x6684, -0x6698,0x668d,0x6703,0x6994,0x696d,0x695a,0x6977,0x6960, -0x6954,0x6975,0x6930,0x6982,0x694a,0x6968,0x696b,0x695e, -0x6953,0x6979,0x6986,0x695d,0x6963,0x695b,0x6b47,0x6b72, -0x6bc0,0x6bbf,0x6bd3,0x6bfd,0x6ea2,0x6eaf,0x6ed3,0x6eb6, -0x6ec2,0x6e90,0x6e9d,0x6ec7,0x6ec5,0x6ea5,0x6e98,0x6ebc, -0x6eba,0x6eab,0x6ed1,0x6e96,0x6e9c,0x6ec4,0x6ed4,0x6eaa, -0x6ea7,0x6eb4,0x714e,0x7159,0x7169,0x7164,0x7149,0x7167, -0x715c,0x716c,0x7166,0x714c,0x7165,0x715e,0x7146,0x7168, -0x7156,0x723a,0x7252,0x7337,0x7345,0x733f,0x733e,0x746f, -0x745a,0x7455,0x745f,0x745e,0x7441,0x743f,0x7459,0x745b, -0x745c,0x7576,0x7578,0x7600,0x75f0,0x7601,0x75f2,0x75f1, -0x75fa,0x75ff,0x75f4,0x75f3,0x76de,0x76df,0x775b,0x776b, -0x7766,0x775e,0x7763,0x7779,0x776a,0x776c,0x775c,0x7765, -0x7768,0x7762,0x77ee,0x788e,0x78b0,0x7897,0x7898,0x788c, -0x7889,0x787c,0x7891,0x7893,0x787f,0x797a,0x797f,0x7981, -0x842c,0x79bd,0x7a1c,0x7a1a,0x7a20,0x7a14,0x7a1f,0x7a1e, -0x7a9f,0x7aa0,0x7b77,0x7bc0,0x7b60,0x7b6e,0x7b67,0x7cb1, -0x7cb3,0x7cb5,0x7d93,0x7d79,0x7d91,0x7d81,0x7d8f,0x7d5b, -0x7f6e,0x7f69,0x7f6a,0x7f72,0x7fa9,0x7fa8,0x7fa4,0x8056, -0x8058,0x8086,0x8084,0x8171,0x8170,0x8178,0x8165,0x816e, -0x8173,0x816b,0x8179,0x817a,0x8166,0x8205,0x8247,0x8482, -0x8477,0x843d,0x8431,0x8475,0x8466,0x846b,0x8449,0x846c, -0x845b,0x843c,0x8435,0x8461,0x8463,0x8469,0x846d,0x8446, -0x865e,0x865c,0x865f,0x86f9,0x8713,0x8708,0x8707,0x8700, -0x86fe,0x86fb,0x8702,0x8703,0x8706,0x870a,0x8859,0x88df, -0x88d4,0x88d9,0x88dc,0x88d8,0x88dd,0x88e1,0x88ca,0x88d5, -0x88d2,0x899c,0x89e3,0x8a6b,0x8a72,0x8a73,0x8a66,0x8a69, -0x8a70,0x8a87,0x8a7c,0x8a63,0x8aa0,0x8a71,0x8a85,0x8a6d, -0x8a62,0x8a6e,0x8a6c,0x8a79,0x8a7b,0x8a3e,0x8a68,0x8c62, -0x8c8a,0x8c89,0x8cca,0x8cc7,0x8cc8,0x8cc4,0x8cb2,0x8cc3, -0x8cc2,0x8cc5,0x8de1,0x8ddf,0x8de8,0x8def,0x8df3,0x8dfa, -0x8dea,0x8de4,0x8de6,0x8eb2,0x8f03,0x8f09,0x8efe,0x8f0a, -0x8f9f,0x8fb2,0x904b,0x904a,0x9053,0x9042,0x9054,0x903c, -0x9055,0x9050,0x9047,0x904f,0x904e,0x904d,0x9051,0x903e, -0x9041,0x9112,0x9117,0x916c,0x916a,0x9169,0x91c9,0x9237, -0x9257,0x9238,0x923d,0x9240,0x923e,0x925b,0x924b,0x9264, -0x9251,0x9234,0x9249,0x924d,0x9245,0x9239,0x923f,0x925a, -0x9598,0x9698,0x9694,0x9695,0x96cd,0x96cb,0x96c9,0x96ca, -0x96f7,0x96fb,0x96f9,0x96f6,0x9756,0x9774,0x9776,0x9810, -0x9811,0x9813,0x980a,0x9812,0x980c,0x98fc,0x98f4,0x98fd, -0x98fe,0x99b3,0x99b1,0x99b4,0x9ae1,0x9ce9,0x9e82,0x9f0e, -0x9f13,0x9f20,0x50e7,0x50ee,0x50e5,0x50d6,0x50ed,0x50da, -0x50d5,0x50cf,0x50d1,0x50f1,0x50ce,0x50e9,0x5162,0x51f3, -0x5283,0x5282,0x5331,0x53ad,0x55fe,0x5600,0x561b,0x5617, -0x55fd,0x5614,0x5606,0x5609,0x560d,0x560e,0x55f7,0x5616, -0x561f,0x5608,0x5610,0x55f6,0x5718,0x5716,0x5875,0x587e, -0x5883,0x5893,0x588a,0x5879,0x5885,0x587d,0x58fd,0x5925, -0x5922,0x5924,0x596a,0x5969,0x5ae1,0x5ae6,0x5ae9,0x5ad7, -0x5ad6,0x5ad8,0x5ae3,0x5b75,0x5bde,0x5be7,0x5be1,0x5be5, -0x5be6,0x5be8,0x5be2,0x5be4,0x5bdf,0x5c0d,0x5c62,0x5d84, -0x5d87,0x5e5b,0x5e63,0x5e55,0x5e57,0x5e54,0x5ed3,0x5ed6, -0x5f0a,0x5f46,0x5f70,0x5fb9,0x6147,0x613f,0x614b,0x6177, -0x6162,0x6163,0x615f,0x615a,0x6158,0x6175,0x622a,0x6487, -0x6458,0x6454,0x64a4,0x6478,0x645f,0x647a,0x6451,0x6467, -0x6434,0x646d,0x647b,0x6572,0x65a1,0x65d7,0x65d6,0x66a2, -0x66a8,0x669d,0x699c,0x69a8,0x6995,0x69c1,0x69ae,0x69d3, -0x69cb,0x699b,0x69b7,0x69bb,0x69ab,0x69b4,0x69d0,0x69cd, -0x69ad,0x69cc,0x69a6,0x69c3,0x69a3,0x6b49,0x6b4c,0x6c33, -0x6f33,0x6f14,0x6efe,0x6f13,0x6ef4,0x6f29,0x6f3e,0x6f20, -0x6f2c,0x6f0f,0x6f02,0x6f22,0x6eff,0x6eef,0x6f06,0x6f31, -0x6f38,0x6f32,0x6f23,0x6f15,0x6f2b,0x6f2f,0x6f88,0x6f2a, -0x6eec,0x6f01,0x6ef2,0x6ecc,0x6ef7,0x7194,0x7199,0x717d, -0x718a,0x7184,0x7192,0x723e,0x7292,0x7296,0x7344,0x7350, -0x7464,0x7463,0x746a,0x7470,0x746d,0x7504,0x7591,0x7627, -0x760d,0x760b,0x7609,0x7613,0x76e1,0x76e3,0x7784,0x777d, -0x777f,0x7761,0x78c1,0x789f,0x78a7,0x78b3,0x78a9,0x78a3, -0x798e,0x798f,0x798d,0x7a2e,0x7a31,0x7aaa,0x7aa9,0x7aed, -0x7aef,0x7ba1,0x7b95,0x7b8b,0x7b75,0x7b97,0x7b9d,0x7b94, -0x7b8f,0x7bb8,0x7b87,0x7b84,0x7cb9,0x7cbd,0x7cbe,0x7dbb, -0x7db0,0x7d9c,0x7dbd,0x7dbe,0x7da0,0x7dca,0x7db4,0x7db2, -0x7db1,0x7dba,0x7da2,0x7dbf,0x7db5,0x7db8,0x7dad,0x7dd2, -0x7dc7,0x7dac,0x7f70,0x7fe0,0x7fe1,0x7fdf,0x805e,0x805a, -0x8087,0x8150,0x8180,0x818f,0x8188,0x818a,0x817f,0x8182, -0x81e7,0x81fa,0x8207,0x8214,0x821e,0x824b,0x84c9,0x84bf, -0x84c6,0x84c4,0x8499,0x849e,0x84b2,0x849c,0x84cb,0x84b8, -0x84c0,0x84d3,0x8490,0x84bc,0x84d1,0x84ca,0x873f,0x871c, -0x873b,0x8722,0x8725,0x8734,0x8718,0x8755,0x8737,0x8729, -0x88f3,0x8902,0x88f4,0x88f9,0x88f8,0x88fd,0x88e8,0x891a, -0x88ef,0x8aa6,0x8a8c,0x8a9e,0x8aa3,0x8a8d,0x8aa1,0x8a93, -0x8aa4,0x8aaa,0x8aa5,0x8aa8,0x8a98,0x8a91,0x8a9a,0x8aa7, -0x8c6a,0x8c8d,0x8c8c,0x8cd3,0x8cd1,0x8cd2,0x8d6b,0x8d99, -0x8d95,0x8dfc,0x8f14,0x8f12,0x8f15,0x8f13,0x8fa3,0x9060, -0x9058,0x905c,0x9063,0x9059,0x905e,0x9062,0x905d,0x905b, -0x9119,0x9118,0x911e,0x9175,0x9178,0x9177,0x9174,0x9278, -0x9280,0x9285,0x9298,0x9296,0x927b,0x9293,0x929c,0x92a8, -0x927c,0x9291,0x95a1,0x95a8,0x95a9,0x95a3,0x95a5,0x95a4, -0x9699,0x969c,0x969b,0x96cc,0x96d2,0x9700,0x977c,0x9785, -0x97f6,0x9817,0x9818,0x98af,0x98b1,0x9903,0x9905,0x990c, -0x9909,0x99c1,0x9aaf,0x9ab0,0x9ae6,0x9b41,0x9b42,0x9cf4, -0x9cf6,0x9cf3,0x9ebc,0x9f3b,0x9f4a,0x5104,0x5100,0x50fb, -0x50f5,0x50f9,0x5102,0x5108,0x5109,0x5105,0x51dc,0x5287, -0x5288,0x5289,0x528d,0x528a,0x52f0,0x53b2,0x562e,0x563b, -0x5639,0x5632,0x563f,0x5634,0x5629,0x5653,0x564e,0x5657, -0x5674,0x5636,0x562f,0x5630,0x5880,0x589f,0x589e,0x58b3, -0x589c,0x58ae,0x58a9,0x58a6,0x596d,0x5b09,0x5afb,0x5b0b, -0x5af5,0x5b0c,0x5b08,0x5bee,0x5bec,0x5be9,0x5beb,0x5c64, -0x5c65,0x5d9d,0x5d94,0x5e62,0x5e5f,0x5e61,0x5ee2,0x5eda, -0x5edf,0x5edd,0x5ee3,0x5ee0,0x5f48,0x5f71,0x5fb7,0x5fb5, -0x6176,0x6167,0x616e,0x615d,0x6155,0x6182,0x617c,0x6170, -0x616b,0x617e,0x61a7,0x6190,0x61ab,0x618e,0x61ac,0x619a, -0x61a4,0x6194,0x61ae,0x622e,0x6469,0x646f,0x6479,0x649e, -0x64b2,0x6488,0x6490,0x64b0,0x64a5,0x6493,0x6495,0x64a9, -0x6492,0x64ae,0x64ad,0x64ab,0x649a,0x64ac,0x6499,0x64a2, -0x64b3,0x6575,0x6577,0x6578,0x66ae,0x66ab,0x66b4,0x66b1, -0x6a23,0x6a1f,0x69e8,0x6a01,0x6a1e,0x6a19,0x69fd,0x6a21, -0x6a13,0x6a0a,0x69f3,0x6a02,0x6a05,0x69ed,0x6a11,0x6b50, -0x6b4e,0x6ba4,0x6bc5,0x6bc6,0x6f3f,0x6f7c,0x6f84,0x6f51, -0x6f66,0x6f54,0x6f86,0x6f6d,0x6f5b,0x6f78,0x6f6e,0x6f8e, -0x6f7a,0x6f70,0x6f64,0x6f97,0x6f58,0x6ed5,0x6f6f,0x6f60, -0x6f5f,0x719f,0x71ac,0x71b1,0x71a8,0x7256,0x729b,0x734e, -0x7357,0x7469,0x748b,0x7483,0x747e,0x7480,0x757f,0x7620, -0x7629,0x761f,0x7624,0x7626,0x7621,0x7622,0x769a,0x76ba, -0x76e4,0x778e,0x7787,0x778c,0x7791,0x778b,0x78cb,0x78c5, -0x78ba,0x78ca,0x78be,0x78d5,0x78bc,0x78d0,0x7a3f,0x7a3c, -0x7a40,0x7a3d,0x7a37,0x7a3b,0x7aaf,0x7aae,0x7bad,0x7bb1, -0x7bc4,0x7bb4,0x7bc6,0x7bc7,0x7bc1,0x7ba0,0x7bcc,0x7cca, -0x7de0,0x7df4,0x7def,0x7dfb,0x7dd8,0x7dec,0x7ddd,0x7de8, -0x7de3,0x7dda,0x7dde,0x7de9,0x7d9e,0x7dd9,0x7df2,0x7df9, -0x7f75,0x7f77,0x7faf,0x7fe9,0x8026,0x819b,0x819c,0x819d, -0x81a0,0x819a,0x8198,0x8517,0x853d,0x851a,0x84ee,0x852c, -0x852d,0x8513,0x8511,0x8523,0x8521,0x8514,0x84ec,0x8525, -0x84ff,0x8506,0x8782,0x8774,0x8776,0x8760,0x8766,0x8778, -0x8768,0x8759,0x8757,0x874c,0x8753,0x885b,0x885d,0x8910, -0x8907,0x8912,0x8913,0x8915,0x890a,0x8abc,0x8ad2,0x8ac7, -0x8ac4,0x8a95,0x8acb,0x8af8,0x8ab2,0x8ac9,0x8ac2,0x8abf, -0x8ab0,0x8ad6,0x8acd,0x8ab6,0x8ab9,0x8adb,0x8c4c,0x8c4e, -0x8c6c,0x8ce0,0x8cde,0x8ce6,0x8ce4,0x8cec,0x8ced,0x8ce2, -0x8ce3,0x8cdc,0x8cea,0x8ce1,0x8d6d,0x8d9f,0x8da3,0x8e2b, -0x8e10,0x8e1d,0x8e22,0x8e0f,0x8e29,0x8e1f,0x8e21,0x8e1e, -0x8eba,0x8f1d,0x8f1b,0x8f1f,0x8f29,0x8f26,0x8f2a,0x8f1c, -0x8f1e,0x8f25,0x9069,0x906e,0x9068,0x906d,0x9077,0x9130, -0x912d,0x9127,0x9131,0x9187,0x9189,0x918b,0x9183,0x92c5, -0x92bb,0x92b7,0x92ea,0x92ac,0x92e4,0x92c1,0x92b3,0x92bc, -0x92d2,0x92c7,0x92f0,0x92b2,0x95ad,0x95b1,0x9704,0x9706, -0x9707,0x9709,0x9760,0x978d,0x978b,0x978f,0x9821,0x982b, -0x981c,0x98b3,0x990a,0x9913,0x9912,0x9918,0x99dd,0x99d0, -0x99df,0x99db,0x99d1,0x99d5,0x99d2,0x99d9,0x9ab7,0x9aee, -0x9aef,0x9b27,0x9b45,0x9b44,0x9b77,0x9b6f,0x9d06,0x9d09, -0x9d03,0x9ea9,0x9ebe,0x9ece,0x58a8,0x9f52,0x5112,0x5118, -0x5114,0x5110,0x5115,0x5180,0x51aa,0x51dd,0x5291,0x5293, -0x52f3,0x5659,0x566b,0x5679,0x5669,0x5664,0x5678,0x566a, -0x5668,0x5665,0x5671,0x566f,0x566c,0x5662,0x5676,0x58c1, -0x58be,0x58c7,0x58c5,0x596e,0x5b1d,0x5b34,0x5b78,0x5bf0, -0x5c0e,0x5f4a,0x61b2,0x6191,0x61a9,0x618a,0x61cd,0x61b6, -0x61be,0x61ca,0x61c8,0x6230,0x64c5,0x64c1,0x64cb,0x64bb, -0x64bc,0x64da,0x64c4,0x64c7,0x64c2,0x64cd,0x64bf,0x64d2, -0x64d4,0x64be,0x6574,0x66c6,0x66c9,0x66b9,0x66c4,0x66c7, -0x66b8,0x6a3d,0x6a38,0x6a3a,0x6a59,0x6a6b,0x6a58,0x6a39, -0x6a44,0x6a62,0x6a61,0x6a4b,0x6a47,0x6a35,0x6a5f,0x6a48, -0x6b59,0x6b77,0x6c05,0x6fc2,0x6fb1,0x6fa1,0x6fc3,0x6fa4, -0x6fc1,0x6fa7,0x6fb3,0x6fc0,0x6fb9,0x6fb6,0x6fa6,0x6fa0, -0x6fb4,0x71be,0x71c9,0x71d0,0x71d2,0x71c8,0x71d5,0x71b9, -0x71ce,0x71d9,0x71dc,0x71c3,0x71c4,0x7368,0x749c,0x74a3, -0x7498,0x749f,0x749e,0x74e2,0x750c,0x750d,0x7634,0x7638, -0x763a,0x76e7,0x76e5,0x77a0,0x779e,0x779f,0x77a5,0x78e8, -0x78da,0x78ec,0x78e7,0x79a6,0x7a4d,0x7a4e,0x7a46,0x7a4c, -0x7a4b,0x7aba,0x7bd9,0x7c11,0x7bc9,0x7be4,0x7bdb,0x7be1, -0x7be9,0x7be6,0x7cd5,0x7cd6,0x7e0a,0x7e11,0x7e08,0x7e1b, -0x7e23,0x7e1e,0x7e1d,0x7e09,0x7e10,0x7f79,0x7fb2,0x7ff0, -0x7ff1,0x7fee,0x8028,0x81b3,0x81a9,0x81a8,0x81fb,0x8208, -0x8258,0x8259,0x854a,0x8559,0x8548,0x8568,0x8569,0x8543, -0x8549,0x856d,0x856a,0x855e,0x8783,0x879f,0x879e,0x87a2, -0x878d,0x8861,0x892a,0x8932,0x8925,0x892b,0x8921,0x89aa, -0x89a6,0x8ae6,0x8afa,0x8aeb,0x8af1,0x8b00,0x8adc,0x8ae7, -0x8aee,0x8afe,0x8b01,0x8b02,0x8af7,0x8aed,0x8af3,0x8af6, -0x8afc,0x8c6b,0x8c6d,0x8c93,0x8cf4,0x8e44,0x8e31,0x8e34, -0x8e42,0x8e39,0x8e35,0x8f3b,0x8f2f,0x8f38,0x8f33,0x8fa8, -0x8fa6,0x9075,0x9074,0x9078,0x9072,0x907c,0x907a,0x9134, -0x9192,0x9320,0x9336,0x92f8,0x9333,0x932f,0x9322,0x92fc, -0x932b,0x9304,0x931a,0x9310,0x9326,0x9321,0x9315,0x932e, -0x9319,0x95bb,0x96a7,0x96a8,0x96aa,0x96d5,0x970e,0x9711, -0x9716,0x970d,0x9713,0x970f,0x975b,0x975c,0x9766,0x9798, -0x9830,0x9838,0x983b,0x9837,0x982d,0x9839,0x9824,0x9910, -0x9928,0x991e,0x991b,0x9921,0x991a,0x99ed,0x99e2,0x99f1, -0x9ab8,0x9abc,0x9afb,0x9aed,0x9b28,0x9b91,0x9d15,0x9d23, -0x9d26,0x9d28,0x9d12,0x9d1b,0x9ed8,0x9ed4,0x9f8d,0x9f9c, -0x512a,0x511f,0x5121,0x5132,0x52f5,0x568e,0x5680,0x5690, -0x5685,0x5687,0x568f,0x58d5,0x58d3,0x58d1,0x58ce,0x5b30, -0x5b2a,0x5b24,0x5b7a,0x5c37,0x5c68,0x5dbc,0x5dba,0x5dbd, -0x5db8,0x5e6b,0x5f4c,0x5fbd,0x61c9,0x61c2,0x61c7,0x61e6, -0x61cb,0x6232,0x6234,0x64ce,0x64ca,0x64d8,0x64e0,0x64f0, -0x64e6,0x64ec,0x64f1,0x64e2,0x64ed,0x6582,0x6583,0x66d9, -0x66d6,0x6a80,0x6a94,0x6a84,0x6aa2,0x6a9c,0x6adb,0x6aa3, -0x6a7e,0x6a97,0x6a90,0x6aa0,0x6b5c,0x6bae,0x6bda,0x6c08, -0x6fd8,0x6ff1,0x6fdf,0x6fe0,0x6fdb,0x6fe4,0x6feb,0x6fef, -0x6f80,0x6fec,0x6fe1,0x6fe9,0x6fd5,0x6fee,0x6ff0,0x71e7, -0x71df,0x71ee,0x71e6,0x71e5,0x71ed,0x71ec,0x71f4,0x71e0, -0x7235,0x7246,0x7370,0x7372,0x74a9,0x74b0,0x74a6,0x74a8, -0x7646,0x7642,0x764c,0x76ea,0x77b3,0x77aa,0x77b0,0x77ac, -0x77a7,0x77ad,0x77ef,0x78f7,0x78fa,0x78f4,0x78ef,0x7901, -0x79a7,0x79aa,0x7a57,0x7abf,0x7c07,0x7c0d,0x7bfe,0x7bf7, -0x7c0c,0x7be0,0x7ce0,0x7cdc,0x7cde,0x7ce2,0x7cdf,0x7cd9, -0x7cdd,0x7e2e,0x7e3e,0x7e46,0x7e37,0x7e32,0x7e43,0x7e2b, -0x7e3d,0x7e31,0x7e45,0x7e41,0x7e34,0x7e39,0x7e48,0x7e35, -0x7e3f,0x7e2f,0x7f44,0x7ff3,0x7ffc,0x8071,0x8072,0x8070, -0x806f,0x8073,0x81c6,0x81c3,0x81ba,0x81c2,0x81c0,0x81bf, -0x81bd,0x81c9,0x81be,0x81e8,0x8209,0x8271,0x85aa,0x8584, -0x857e,0x859c,0x8591,0x8594,0x85af,0x859b,0x8587,0x85a8, -0x858a,0x8667,0x87c0,0x87d1,0x87b3,0x87d2,0x87c6,0x87ab, -0x87bb,0x87ba,0x87c8,0x87cb,0x893b,0x8936,0x8944,0x8938, -0x893d,0x89ac,0x8b0e,0x8b17,0x8b19,0x8b1b,0x8b0a,0x8b20, -0x8b1d,0x8b04,0x8b10,0x8c41,0x8c3f,0x8c73,0x8cfa,0x8cfd, -0x8cfc,0x8cf8,0x8cfb,0x8da8,0x8e49,0x8e4b,0x8e48,0x8e4a, -0x8f44,0x8f3e,0x8f42,0x8f45,0x8f3f,0x907f,0x907d,0x9084, -0x9081,0x9082,0x9080,0x9139,0x91a3,0x919e,0x919c,0x934d, -0x9382,0x9328,0x9375,0x934a,0x9365,0x934b,0x9318,0x937e, -0x936c,0x935b,0x9370,0x935a,0x9354,0x95ca,0x95cb,0x95cc, -0x95c8,0x95c6,0x96b1,0x96b8,0x96d6,0x971c,0x971e,0x97a0, -0x97d3,0x9846,0x98b6,0x9935,0x9a01,0x99ff,0x9bae,0x9bab, -0x9baa,0x9bad,0x9d3b,0x9d3f,0x9e8b,0x9ecf,0x9ede,0x9edc, -0x9edd,0x9edb,0x9f3e,0x9f4b,0x53e2,0x5695,0x56ae,0x58d9, -0x58d8,0x5b38,0x5f5d,0x61e3,0x6233,0x64f4,0x64f2,0x64fe, -0x6506,0x64fa,0x64fb,0x64f7,0x65b7,0x66dc,0x6726,0x6ab3, -0x6aac,0x6ac3,0x6abb,0x6ab8,0x6ac2,0x6aae,0x6aaf,0x6b5f, -0x6b78,0x6baf,0x7009,0x700b,0x6ffe,0x7006,0x6ffa,0x7011, -0x700f,0x71fb,0x71fc,0x71fe,0x71f8,0x7377,0x7375,0x74a7, -0x74bf,0x7515,0x7656,0x7658,0x7652,0x77bd,0x77bf,0x77bb, -0x77bc,0x790e,0x79ae,0x7a61,0x7a62,0x7a60,0x7ac4,0x7ac5, -0x7c2b,0x7c27,0x7c2a,0x7c1e,0x7c23,0x7c21,0x7ce7,0x7e54, -0x7e55,0x7e5e,0x7e5a,0x7e61,0x7e52,0x7e59,0x7f48,0x7ff9, -0x7ffb,0x8077,0x8076,0x81cd,0x81cf,0x820a,0x85cf,0x85a9, -0x85cd,0x85d0,0x85c9,0x85b0,0x85ba,0x85b9,0x85a6,0x87ef, -0x87ec,0x87f2,0x87e0,0x8986,0x89b2,0x89f4,0x8b28,0x8b39, -0x8b2c,0x8b2b,0x8c50,0x8d05,0x8e59,0x8e63,0x8e66,0x8e64, -0x8e5f,0x8e55,0x8ec0,0x8f49,0x8f4d,0x9087,0x9083,0x9088, -0x91ab,0x91ac,0x91d0,0x9394,0x938a,0x9396,0x93a2,0x93b3, -0x93ae,0x93ac,0x93b0,0x9398,0x939a,0x9397,0x95d4,0x95d6, -0x95d0,0x95d5,0x96e2,0x96dc,0x96d9,0x96db,0x96de,0x9724, -0x97a3,0x97a6,0x97ad,0x97f9,0x984d,0x984f,0x984c,0x984e, -0x9853,0x98ba,0x993e,0x993f,0x993d,0x992e,0x99a5,0x9a0e, -0x9ac1,0x9b03,0x9b06,0x9b4f,0x9b4e,0x9b4d,0x9bca,0x9bc9, -0x9bfd,0x9bc8,0x9bc0,0x9d51,0x9d5d,0x9d60,0x9ee0,0x9f15, -0x9f2c,0x5133,0x56a5,0x58de,0x58df,0x58e2,0x5bf5,0x9f90, -0x5eec,0x61f2,0x61f7,0x61f6,0x61f5,0x6500,0x650f,0x66e0, -0x66dd,0x6ae5,0x6add,0x6ada,0x6ad3,0x701b,0x701f,0x7028, -0x701a,0x701d,0x7015,0x7018,0x7206,0x720d,0x7258,0x72a2, -0x7378,0x737a,0x74bd,0x74ca,0x74e3,0x7587,0x7586,0x765f, -0x7661,0x77c7,0x7919,0x79b1,0x7a6b,0x7a69,0x7c3e,0x7c3f, -0x7c38,0x7c3d,0x7c37,0x7c40,0x7e6b,0x7e6d,0x7e79,0x7e69, -0x7e6a,0x7f85,0x7e73,0x7fb6,0x7fb9,0x7fb8,0x81d8,0x85e9, -0x85dd,0x85ea,0x85d5,0x85e4,0x85e5,0x85f7,0x87fb,0x8805, -0x880d,0x87f9,0x87fe,0x8960,0x895f,0x8956,0x895e,0x8b41, -0x8b5c,0x8b58,0x8b49,0x8b5a,0x8b4e,0x8b4f,0x8b46,0x8b59, -0x8d08,0x8d0a,0x8e7c,0x8e72,0x8e87,0x8e76,0x8e6c,0x8e7a, -0x8e74,0x8f54,0x8f4e,0x8fad,0x908a,0x908b,0x91b1,0x91ae, -0x93e1,0x93d1,0x93df,0x93c3,0x93c8,0x93dc,0x93dd,0x93d6, -0x93e2,0x93cd,0x93d8,0x93e4,0x93d7,0x93e8,0x95dc,0x96b4, -0x96e3,0x972a,0x9727,0x9761,0x97dc,0x97fb,0x985e,0x9858, -0x985b,0x98bc,0x9945,0x9949,0x9a16,0x9a19,0x9b0d,0x9be8, -0x9be7,0x9bd6,0x9bdb,0x9d89,0x9d61,0x9d72,0x9d6a,0x9d6c, -0x9e92,0x9e97,0x9e93,0x9eb4,0x52f8,0x56a8,0x56b7,0x56b6, -0x56b4,0x56bc,0x58e4,0x5b40,0x5b43,0x5b7d,0x5bf6,0x5dc9, -0x61f8,0x61fa,0x6518,0x6514,0x6519,0x66e6,0x6727,0x6aec, -0x703e,0x7030,0x7032,0x7210,0x737b,0x74cf,0x7662,0x7665, -0x7926,0x792a,0x792c,0x792b,0x7ac7,0x7af6,0x7c4c,0x7c43, -0x7c4d,0x7cef,0x7cf0,0x8fae,0x7e7d,0x7e7c,0x7e82,0x7f4c, -0x8000,0x81da,0x8266,0x85fb,0x85f9,0x8611,0x85fa,0x8606, -0x860b,0x8607,0x860a,0x8814,0x8815,0x8964,0x89ba,0x89f8, -0x8b70,0x8b6c,0x8b66,0x8b6f,0x8b5f,0x8b6b,0x8d0f,0x8d0d, -0x8e89,0x8e81,0x8e85,0x8e82,0x91b4,0x91cb,0x9418,0x9403, -0x93fd,0x95e1,0x9730,0x98c4,0x9952,0x9951,0x99a8,0x9a2b, -0x9a30,0x9a37,0x9a35,0x9c13,0x9c0d,0x9e79,0x9eb5,0x9ee8, -0x9f2f,0x9f5f,0x9f63,0x9f61,0x5137,0x5138,0x56c1,0x56c0, -0x56c2,0x5914,0x5c6c,0x5dcd,0x61fc,0x61fe,0x651d,0x651c, -0x6595,0x66e9,0x6afb,0x6b04,0x6afa,0x6bb2,0x704c,0x721b, -0x72a7,0x74d6,0x74d4,0x7669,0x77d3,0x7c50,0x7e8f,0x7e8c, -0x7fbc,0x8617,0x862d,0x861a,0x8823,0x8822,0x8821,0x881f, -0x896a,0x896c,0x89bd,0x8b74,0x8b77,0x8b7d,0x8d13,0x8e8a, -0x8e8d,0x8e8b,0x8f5f,0x8faf,0x91ba,0x942e,0x9433,0x9435, -0x943a,0x9438,0x9432,0x942b,0x95e2,0x9738,0x9739,0x9732, -0x97ff,0x9867,0x9865,0x9957,0x9a45,0x9a43,0x9a40,0x9a3e, -0x9acf,0x9b54,0x9b51,0x9c2d,0x9c25,0x9daf,0x9db4,0x9dc2, -0x9db8,0x9e9d,0x9eef,0x9f19,0x9f5c,0x9f66,0x9f67,0x513c, -0x513b,0x56c8,0x56ca,0x56c9,0x5b7f,0x5dd4,0x5dd2,0x5f4e, -0x61ff,0x6524,0x6b0a,0x6b61,0x7051,0x7058,0x7380,0x74e4, -0x758a,0x766e,0x766c,0x79b3,0x7c60,0x7c5f,0x807e,0x807d, -0x81df,0x8972,0x896f,0x89fc,0x8b80,0x8d16,0x8d17,0x8e91, -0x8e93,0x8f61,0x9148,0x9444,0x9451,0x9452,0x973d,0x973e, -0x97c3,0x97c1,0x986b,0x9955,0x9a55,0x9a4d,0x9ad2,0x9b1a, -0x9c49,0x9c31,0x9c3e,0x9c3b,0x9dd3,0x9dd7,0x9f34,0x9f6c, -0x9f6a,0x9f94,0x56cc,0x5dd6,0x6200,0x6523,0x652b,0x652a, -0x66ec,0x6b10,0x74da,0x7aca,0x7c64,0x7c63,0x7c65,0x7e93, -0x7e96,0x7e94,0x81e2,0x8638,0x863f,0x8831,0x8b8a,0x9090, -0x908f,0x9463,0x9460,0x9464,0x9768,0x986f,0x995c,0x9a5a, -0x9a5b,0x9a57,0x9ad3,0x9ad4,0x9ad1,0x9c54,0x9c57,0x9c56, -0x9de5,0x9e9f,0x9ef4,0x56d1,0x58e9,0x652c,0x705e,0x7671, -0x7672,0x77d7,0x7f50,0x7f88,0x8836,0x8839,0x8862,0x8b93, -0x8b92,0x8b96,0x8277,0x8d1b,0x91c0,0x946a,0x9742,0x9748, -0x9744,0x97c6,0x9870,0x9a5f,0x9b22,0x9b58,0x9c5f,0x9df9, -0x9dfa,0x9e7c,0x9e7d,0x9f07,0x9f77,0x9f72,0x5ef3,0x6b16, -0x7063,0x7c6c,0x7c6e,0x883b,0x89c0,0x8ea1,0x91c1,0x9472, -0x9470,0x9871,0x995e,0x9ad6,0x9b23,0x9ecc,0x7064,0x77da, -0x8b9a,0x9477,0x97c9,0x9a62,0x9a65,0x7e9c,0x8b9c,0x8eaa, -0x91c5,0x947d,0x947e,0x947c,0x9c77,0x9c78,0x9ef7,0x8c54, -0x947f,0x9e1a,0x7228,0x9a6a,0x9b31,0x9e1b,0x9e1e,0x7c72, -0xf6b1,0xf6b2,0xf6b3,0xf6b4,0xf6b5,0xf6b6,0xf6b7,0xf6b8, -0xf6b9,0xf6ba,0xf6bb,0xf6bc,0xf6bd,0xf6be,0xf6bf,0xf6c0, -0xf6c1,0xf6c2,0xf6c3,0xf6c4,0xf6c5,0xf6c6,0xf6c7,0xf6c8, -0xf6c9,0xf6ca,0xf6cb,0xf6cc,0xf6cd,0xf6ce,0xf6cf,0xf6d0, -0xf6d1,0xf6d2,0xf6d3,0xf6d4,0xf6d5,0xf6d6,0xf6d7,0xf6d8, -0xf6d9,0xf6da,0xf6db,0xf6dc,0xf6dd,0xf6de,0xf6df,0xf6e0, -0xf6e1,0xf6e2,0xf6e3,0xf6e4,0xf6e5,0xf6e6,0xf6e7,0xf6e8, -0xf6e9,0xf6ea,0xf6eb,0xf6ec,0xf6ed,0xf6ee,0xf6ef,0xf6f0, -0xf6f1,0xf6f2,0xf6f3,0xf6f4,0xf6f5,0xf6f6,0xf6f7,0xf6f8, -0xf6f9,0xf6fa,0xf6fb,0xf6fc,0xf6fd,0xf6fe,0xf6ff,0xf700, -0xf701,0xf702,0xf703,0xf704,0xf705,0xf706,0xf707,0xf708, -0xf709,0xf70a,0xf70b,0xf70c,0xf70d,0xf70e,0xf70f,0xf710, -0xf711,0xf712,0xf713,0xf714,0xf715,0xf716,0xf717,0xf718, -0xf719,0xf71a,0xf71b,0xf71c,0xf71d,0xf71e,0xf71f,0xf720, -0xf721,0xf722,0xf723,0xf724,0xf725,0xf726,0xf727,0xf728, -0xf729,0xf72a,0xf72b,0xf72c,0xf72d,0xf72e,0xf72f,0xf730, -0xf731,0xf732,0xf733,0xf734,0xf735,0xf736,0xf737,0xf738, -0xf739,0xf73a,0xf73b,0xf73c,0xf73d,0xf73e,0xf73f,0xf740, -0xf741,0xf742,0xf743,0xf744,0xf745,0xf746,0xf747,0xf748, -0xf749,0xf74a,0xf74b,0xf74c,0xf74d,0xf74e,0xf74f,0xf750, -0xf751,0xf752,0xf753,0xf754,0xf755,0xf756,0xf757,0xf758, -0xf759,0xf75a,0xf75b,0xf75c,0xf75d,0xf75e,0xf75f,0xf760, -0xf761,0xf762,0xf763,0xf764,0xf765,0xf766,0xf767,0xf768, -0xf769,0xf76a,0xf76b,0xf76c,0xf76d,0xf76e,0xf76f,0xf770, -0xf771,0xf772,0xf773,0xf774,0xf775,0xf776,0xf777,0xf778, -0xf779,0xf77a,0xf77b,0xf77c,0xf77d,0xf77e,0xf77f,0xf780, -0xf781,0xf782,0xf783,0xf784,0xf785,0xf786,0xf787,0xf788, -0xf789,0xf78a,0xf78b,0xf78c,0xf78d,0xf78e,0xf78f,0xf790, -0xf791,0xf792,0xf793,0xf794,0xf795,0xf796,0xf797,0xf798, -0xf799,0xf79a,0xf79b,0xf79c,0xf79d,0xf79e,0xf79f,0xf7a0, -0xf7a1,0xf7a2,0xf7a3,0xf7a4,0xf7a5,0xf7a6,0xf7a7,0xf7a8, -0xf7a9,0xf7aa,0xf7ab,0xf7ac,0xf7ad,0xf7ae,0xf7af,0xf7b0, -0xf7b1,0xf7b2,0xf7b3,0xf7b4,0xf7b5,0xf7b6,0xf7b7,0xf7b8, -0xf7b9,0xf7ba,0xf7bb,0xf7bc,0xf7bd,0xf7be,0xf7bf,0xf7c0, -0xf7c1,0xf7c2,0xf7c3,0xf7c4,0xf7c5,0xf7c6,0xf7c7,0xf7c8, -0xf7c9,0xf7ca,0xf7cb,0xf7cc,0xf7cd,0xf7ce,0xf7cf,0xf7d0, -0xf7d1,0xf7d2,0xf7d3,0xf7d4,0xf7d5,0xf7d6,0xf7d7,0xf7d8, -0xf7d9,0xf7da,0xf7db,0xf7dc,0xf7dd,0xf7de,0xf7df,0xf7e0, -0xf7e1,0xf7e2,0xf7e3,0xf7e4,0xf7e5,0xf7e6,0xf7e7,0xf7e8, -0xf7e9,0xf7ea,0xf7eb,0xf7ec,0xf7ed,0xf7ee,0xf7ef,0xf7f0, -0xf7f1,0xf7f2,0xf7f3,0xf7f4,0xf7f5,0xf7f6,0xf7f7,0xf7f8, -0xf7f9,0xf7fa,0xf7fb,0xf7fc,0xf7fd,0xf7fe,0xf7ff,0xf800, -0xf801,0xf802,0xf803,0xf804,0xf805,0xf806,0xf807,0xf808, -0xf809,0xf80a,0xf80b,0xf80c,0xf80d,0xf80e,0xf80f,0xf810, -0xf811,0xf812,0xf813,0xf814,0xf815,0xf816,0xf817,0xf818, -0xf819,0xf81a,0xf81b,0xf81c,0xf81d,0xf81e,0xf81f,0xf820, -0xf821,0xf822,0xf823,0xf824,0xf825,0xf826,0xf827,0xf828, -0xf829,0xf82a,0xf82b,0xf82c,0xf82d,0xf82e,0xf82f,0xf830, -0xf831,0xf832,0xf833,0xf834,0xf835,0xf836,0xf837,0xf838, -0xf839,0xf83a,0xf83b,0xf83c,0xf83d,0xf83e,0xf83f,0xf840, -0xf841,0xf842,0xf843,0xf844,0xf845,0xf846,0xf847,0xf848, -0x4e42,0x4e5c,0x51f5,0x531a,0x5382,0x4e07,0x4e0c,0x4e47, -0x4e8d,0x56d7,0xfa0c,0x5c6e,0x5f73,0x4e0f,0x5187,0x4e0e, -0x4e2e,0x4e93,0x4ec2,0x4ec9,0x4ec8,0x5198,0x52fc,0x536c, -0x53b9,0x5720,0x5903,0x592c,0x5c10,0x5dff,0x65e1,0x6bb3, -0x6bcc,0x6c14,0x723f,0x4e31,0x4e3c,0x4ee8,0x4edc,0x4ee9, -0x4ee1,0x4edd,0x4eda,0x520c,0x531c,0x534c,0x5722,0x5723, -0x5917,0x592f,0x5b81,0x5b84,0x5c12,0x5c3b,0x5c74,0x5c73, -0x5e04,0x5e80,0x5e82,0x5fc9,0x6209,0x6250,0x6c15,0x6c36, -0x6c43,0x6c3f,0x6c3b,0x72ae,0x72b0,0x738a,0x79b8,0x808a, -0x961e,0x4f0e,0x4f18,0x4f2c,0x4ef5,0x4f14,0x4ef1,0x4f00, -0x4ef7,0x4f08,0x4f1d,0x4f02,0x4f05,0x4f22,0x4f13,0x4f04, -0x4ef4,0x4f12,0x51b1,0x5213,0x5209,0x5210,0x52a6,0x5322, -0x531f,0x534d,0x538a,0x5407,0x56e1,0x56df,0x572e,0x572a, -0x5734,0x593c,0x5980,0x597c,0x5985,0x597b,0x597e,0x5977, -0x597f,0x5b56,0x5c15,0x5c25,0x5c7c,0x5c7a,0x5c7b,0x5c7e, -0x5ddf,0x5e75,0x5e84,0x5f02,0x5f1a,0x5f74,0x5fd5,0x5fd4, -0x5fcf,0x625c,0x625e,0x6264,0x6261,0x6266,0x6262,0x6259, -0x6260,0x625a,0x6265,0x65ef,0x65ee,0x673e,0x6739,0x6738, -0x673b,0x673a,0x673f,0x673c,0x6733,0x6c18,0x6c46,0x6c52, -0x6c5c,0x6c4f,0x6c4a,0x6c54,0x6c4b,0x6c4c,0x7071,0x725e, -0x72b4,0x72b5,0x738e,0x752a,0x767f,0x7a75,0x7f51,0x8278, -0x827c,0x8280,0x827d,0x827f,0x864d,0x897e,0x9099,0x9097, -0x9098,0x909b,0x9094,0x9622,0x9624,0x9620,0x9623,0x4f56, -0x4f3b,0x4f62,0x4f49,0x4f53,0x4f64,0x4f3e,0x4f67,0x4f52, -0x4f5f,0x4f41,0x4f58,0x4f2d,0x4f33,0x4f3f,0x4f61,0x518f, -0x51b9,0x521c,0x521e,0x5221,0x52ad,0x52ae,0x5309,0x5363, -0x5372,0x538e,0x538f,0x5430,0x5437,0x542a,0x5454,0x5445, -0x5419,0x541c,0x5425,0x5418,0x543d,0x544f,0x5441,0x5428, -0x5424,0x5447,0x56ee,0x56e7,0x56e5,0x5741,0x5745,0x574c, -0x5749,0x574b,0x5752,0x5906,0x5940,0x59a6,0x5998,0x59a0, -0x5997,0x598e,0x59a2,0x5990,0x598f,0x59a7,0x59a1,0x5b8e, -0x5b92,0x5c28,0x5c2a,0x5c8d,0x5c8f,0x5c88,0x5c8b,0x5c89, -0x5c92,0x5c8a,0x5c86,0x5c93,0x5c95,0x5de0,0x5e0a,0x5e0e, -0x5e8b,0x5e89,0x5e8c,0x5e88,0x5e8d,0x5f05,0x5f1d,0x5f78, -0x5f76,0x5fd2,0x5fd1,0x5fd0,0x5fed,0x5fe8,0x5fee,0x5ff3, -0x5fe1,0x5fe4,0x5fe3,0x5ffa,0x5fef,0x5ff7,0x5ffb,0x6000, -0x5ff4,0x623a,0x6283,0x628c,0x628e,0x628f,0x6294,0x6287, -0x6271,0x627b,0x627a,0x6270,0x6281,0x6288,0x6277,0x627d, -0x6272,0x6274,0x6537,0x65f0,0x65f4,0x65f3,0x65f2,0x65f5, -0x6745,0x6747,0x6759,0x6755,0x674c,0x6748,0x675d,0x674d, -0x675a,0x674b,0x6bd0,0x6c19,0x6c1a,0x6c78,0x6c67,0x6c6b, -0x6c84,0x6c8b,0x6c8f,0x6c71,0x6c6f,0x6c69,0x6c9a,0x6c6d, -0x6c87,0x6c95,0x6c9c,0x6c66,0x6c73,0x6c65,0x6c7b,0x6c8e, -0x7074,0x707a,0x7263,0x72bf,0x72bd,0x72c3,0x72c6,0x72c1, -0x72ba,0x72c5,0x7395,0x7397,0x7393,0x7394,0x7392,0x753a, -0x7539,0x7594,0x7595,0x7681,0x793d,0x8034,0x8095,0x8099, -0x8090,0x8092,0x809c,0x8290,0x828f,0x8285,0x828e,0x8291, -0x8293,0x828a,0x8283,0x8284,0x8c78,0x8fc9,0x8fbf,0x909f, -0x90a1,0x90a5,0x909e,0x90a7,0x90a0,0x9630,0x9628,0x962f, -0x962d,0x4e33,0x4f98,0x4f7c,0x4f85,0x4f7d,0x4f80,0x4f87, -0x4f76,0x4f74,0x4f89,0x4f84,0x4f77,0x4f4c,0x4f97,0x4f6a, -0x4f9a,0x4f79,0x4f81,0x4f78,0x4f90,0x4f9c,0x4f94,0x4f9e, -0x4f92,0x4f82,0x4f95,0x4f6b,0x4f6e,0x519e,0x51bc,0x51be, -0x5235,0x5232,0x5233,0x5246,0x5231,0x52bc,0x530a,0x530b, -0x533c,0x5392,0x5394,0x5487,0x547f,0x5481,0x5491,0x5482, -0x5488,0x546b,0x547a,0x547e,0x5465,0x546c,0x5474,0x5466, -0x548d,0x546f,0x5461,0x5460,0x5498,0x5463,0x5467,0x5464, -0x56f7,0x56f9,0x576f,0x5772,0x576d,0x576b,0x5771,0x5770, -0x5776,0x5780,0x5775,0x577b,0x5773,0x5774,0x5762,0x5768, -0x577d,0x590c,0x5945,0x59b5,0x59ba,0x59cf,0x59ce,0x59b2, -0x59cc,0x59c1,0x59b6,0x59bc,0x59c3,0x59d6,0x59b1,0x59bd, -0x59c0,0x59c8,0x59b4,0x59c7,0x5b62,0x5b65,0x5b93,0x5b95, -0x5c44,0x5c47,0x5cae,0x5ca4,0x5ca0,0x5cb5,0x5caf,0x5ca8, -0x5cac,0x5c9f,0x5ca3,0x5cad,0x5ca2,0x5caa,0x5ca7,0x5c9d, -0x5ca5,0x5cb6,0x5cb0,0x5ca6,0x5e17,0x5e14,0x5e19,0x5f28, -0x5f22,0x5f23,0x5f24,0x5f54,0x5f82,0x5f7e,0x5f7d,0x5fde, -0x5fe5,0x602d,0x6026,0x6019,0x6032,0x600b,0x6034,0x600a, -0x6017,0x6033,0x601a,0x601e,0x602c,0x6022,0x600d,0x6010, -0x602e,0x6013,0x6011,0x600c,0x6009,0x601c,0x6214,0x623d, -0x62ad,0x62b4,0x62d1,0x62be,0x62aa,0x62b6,0x62ca,0x62ae, -0x62b3,0x62af,0x62bb,0x62a9,0x62b0,0x62b8,0x653d,0x65a8, -0x65bb,0x6609,0x65fc,0x6604,0x6612,0x6608,0x65fb,0x6603, -0x660b,0x660d,0x6605,0x65fd,0x6611,0x6610,0x66f6,0x670a, -0x6785,0x676c,0x678e,0x6792,0x6776,0x677b,0x6798,0x6786, -0x6784,0x6774,0x678d,0x678c,0x677a,0x679f,0x6791,0x6799, -0x6783,0x677d,0x6781,0x6778,0x6779,0x6794,0x6b25,0x6b80, -0x6b7e,0x6bde,0x6c1d,0x6c93,0x6cec,0x6ceb,0x6cee,0x6cd9, -0x6cb6,0x6cd4,0x6cad,0x6ce7,0x6cb7,0x6cd0,0x6cc2,0x6cba, -0x6cc3,0x6cc6,0x6ced,0x6cf2,0x6cd2,0x6cdd,0x6cb4,0x6c8a, -0x6c9d,0x6c80,0x6cde,0x6cc0,0x6d30,0x6ccd,0x6cc7,0x6cb0, -0x6cf9,0x6ccf,0x6ce9,0x6cd1,0x7094,0x7098,0x7085,0x7093, -0x7086,0x7084,0x7091,0x7096,0x7082,0x709a,0x7083,0x726a, -0x72d6,0x72cb,0x72d8,0x72c9,0x72dc,0x72d2,0x72d4,0x72da, -0x72cc,0x72d1,0x73a4,0x73a1,0x73ad,0x73a6,0x73a2,0x73a0, -0x73ac,0x739d,0x74dd,0x74e8,0x753f,0x7540,0x753e,0x758c, -0x7598,0x76af,0x76f3,0x76f1,0x76f0,0x76f5,0x77f8,0x77fc, -0x77f9,0x77fb,0x77fa,0x77f7,0x7942,0x793f,0x79c5,0x7a78, -0x7a7b,0x7afb,0x7c75,0x7cfd,0x8035,0x808f,0x80ae,0x80a3, -0x80b8,0x80b5,0x80ad,0x8220,0x82a0,0x82c0,0x82ab,0x829a, -0x8298,0x829b,0x82b5,0x82a7,0x82ae,0x82bc,0x829e,0x82ba, -0x82b4,0x82a8,0x82a1,0x82a9,0x82c2,0x82a4,0x82c3,0x82b6, -0x82a2,0x8670,0x866f,0x866d,0x866e,0x8c56,0x8fd2,0x8fcb, -0x8fd3,0x8fcd,0x8fd6,0x8fd5,0x8fd7,0x90b2,0x90b4,0x90af, -0x90b3,0x90b0,0x9639,0x963d,0x963c,0x963a,0x9643,0x4fcd, -0x4fc5,0x4fd3,0x4fb2,0x4fc9,0x4fcb,0x4fc1,0x4fd4,0x4fdc, -0x4fd9,0x4fbb,0x4fb3,0x4fdb,0x4fc7,0x4fd6,0x4fba,0x4fc0, -0x4fb9,0x4fec,0x5244,0x5249,0x52c0,0x52c2,0x533d,0x537c, -0x5397,0x5396,0x5399,0x5398,0x54ba,0x54a1,0x54ad,0x54a5, -0x54cf,0x54c3,0x830d,0x54b7,0x54ae,0x54d6,0x54b6,0x54c5, -0x54c6,0x54a0,0x5470,0x54bc,0x54a2,0x54be,0x5472,0x54de, -0x54b0,0x57b5,0x579e,0x579f,0x57a4,0x578c,0x5797,0x579d, -0x579b,0x5794,0x5798,0x578f,0x5799,0x57a5,0x579a,0x5795, -0x58f4,0x590d,0x5953,0x59e1,0x59de,0x59ee,0x5a00,0x59f1, -0x59dd,0x59fa,0x59fd,0x59fc,0x59f6,0x59e4,0x59f2,0x59f7, -0x59db,0x59e9,0x59f3,0x59f5,0x59e0,0x59fe,0x59f4,0x59ed, -0x5ba8,0x5c4c,0x5cd0,0x5cd8,0x5ccc,0x5cd7,0x5ccb,0x5cdb, -0x5cde,0x5cda,0x5cc9,0x5cc7,0x5cca,0x5cd6,0x5cd3,0x5cd4, -0x5ccf,0x5cc8,0x5cc6,0x5cce,0x5cdf,0x5cf8,0x5df9,0x5e21, -0x5e22,0x5e23,0x5e20,0x5e24,0x5eb0,0x5ea4,0x5ea2,0x5e9b, -0x5ea3,0x5ea5,0x5f07,0x5f2e,0x5f56,0x5f86,0x6037,0x6039, -0x6054,0x6072,0x605e,0x6045,0x6053,0x6047,0x6049,0x605b, -0x604c,0x6040,0x6042,0x605f,0x6024,0x6044,0x6058,0x6066, -0x606e,0x6242,0x6243,0x62cf,0x630d,0x630b,0x62f5,0x630e, -0x6303,0x62eb,0x62f9,0x630f,0x630c,0x62f8,0x62f6,0x6300, -0x6313,0x6314,0x62fa,0x6315,0x62fb,0x62f0,0x6541,0x6543, -0x65aa,0x65bf,0x6636,0x6621,0x6632,0x6635,0x661c,0x6626, -0x6622,0x6633,0x662b,0x663a,0x661d,0x6634,0x6639,0x662e, -0x670f,0x6710,0x67c1,0x67f2,0x67c8,0x67ba,0x67dc,0x67bb, -0x67f8,0x67d8,0x67c0,0x67b7,0x67c5,0x67eb,0x67e4,0x67df, -0x67b5,0x67cd,0x67b3,0x67f7,0x67f6,0x67ee,0x67e3,0x67c2, -0x67b9,0x67ce,0x67e7,0x67f0,0x67b2,0x67fc,0x67c6,0x67ed, -0x67cc,0x67ae,0x67e6,0x67db,0x67fa,0x67c9,0x67ca,0x67c3, -0x67ea,0x67cb,0x6b28,0x6b82,0x6b84,0x6bb6,0x6bd6,0x6bd8, -0x6be0,0x6c20,0x6c21,0x6d28,0x6d34,0x6d2d,0x6d1f,0x6d3c, -0x6d3f,0x6d12,0x6d0a,0x6cda,0x6d33,0x6d04,0x6d19,0x6d3a, -0x6d1a,0x6d11,0x6d00,0x6d1d,0x6d42,0x6d01,0x6d18,0x6d37, -0x6d03,0x6d0f,0x6d40,0x6d07,0x6d20,0x6d2c,0x6d08,0x6d22, -0x6d09,0x6d10,0x70b7,0x709f,0x70be,0x70b1,0x70b0,0x70a1, -0x70b4,0x70b5,0x70a9,0x7241,0x7249,0x724a,0x726c,0x7270, -0x7273,0x726e,0x72ca,0x72e4,0x72e8,0x72eb,0x72df,0x72ea, -0x72e6,0x72e3,0x7385,0x73cc,0x73c2,0x73c8,0x73c5,0x73b9, -0x73b6,0x73b5,0x73b4,0x73eb,0x73bf,0x73c7,0x73be,0x73c3, -0x73c6,0x73b8,0x73cb,0x74ec,0x74ee,0x752e,0x7547,0x7548, -0x75a7,0x75aa,0x7679,0x76c4,0x7708,0x7703,0x7704,0x7705, -0x770a,0x76f7,0x76fb,0x76fa,0x77e7,0x77e8,0x7806,0x7811, -0x7812,0x7805,0x7810,0x780f,0x780e,0x7809,0x7803,0x7813, -0x794a,0x794c,0x794b,0x7945,0x7944,0x79d5,0x79cd,0x79cf, -0x79d6,0x79ce,0x7a80,0x7a7e,0x7ad1,0x7b00,0x7b01,0x7c7a, -0x7c78,0x7c79,0x7c7f,0x7c80,0x7c81,0x7d03,0x7d08,0x7d01, -0x7f58,0x7f91,0x7f8d,0x7fbe,0x8007,0x800e,0x800f,0x8014, -0x8037,0x80d8,0x80c7,0x80e0,0x80d1,0x80c8,0x80c2,0x80d0, -0x80c5,0x80e3,0x80d9,0x80dc,0x80ca,0x80d5,0x80c9,0x80cf, -0x80d7,0x80e6,0x80cd,0x81ff,0x8221,0x8294,0x82d9,0x82fe, -0x82f9,0x8307,0x82e8,0x8300,0x82d5,0x833a,0x82eb,0x82d6, -0x82f4,0x82ec,0x82e1,0x82f2,0x82f5,0x830c,0x82fb,0x82f6, -0x82f0,0x82ea,0x82e4,0x82e0,0x82fa,0x82f3,0x82ed,0x8677, -0x8674,0x867c,0x8673,0x8841,0x884e,0x8867,0x886a,0x8869, -0x89d3,0x8a04,0x8a07,0x8d72,0x8fe3,0x8fe1,0x8fee,0x8fe0, -0x90f1,0x90bd,0x90bf,0x90d5,0x90c5,0x90be,0x90c7,0x90cb, -0x90c8,0x91d4,0x91d3,0x9654,0x964f,0x9651,0x9653,0x964a, -0x964e,0x501e,0x5005,0x5007,0x5013,0x5022,0x5030,0x501b, -0x4ff5,0x4ff4,0x5033,0x5037,0x502c,0x4ff6,0x4ff7,0x5017, -0x501c,0x5020,0x5027,0x5035,0x502f,0x5031,0x500e,0x515a, -0x5194,0x5193,0x51ca,0x51c4,0x51c5,0x51c8,0x51ce,0x5261, -0x525a,0x5252,0x525e,0x525f,0x5255,0x5262,0x52cd,0x530e, -0x539e,0x5526,0x54e2,0x5517,0x5512,0x54e7,0x54f3,0x54e4, -0x551a,0x54ff,0x5504,0x5508,0x54eb,0x5511,0x5505,0x54f1, -0x550a,0x54fb,0x54f7,0x54f8,0x54e0,0x550e,0x5503,0x550b, -0x5701,0x5702,0x57cc,0x5832,0x57d5,0x57d2,0x57ba,0x57c6, -0x57bd,0x57bc,0x57b8,0x57b6,0x57bf,0x57c7,0x57d0,0x57b9, -0x57c1,0x590e,0x594a,0x5a19,0x5a16,0x5a2d,0x5a2e,0x5a15, -0x5a0f,0x5a17,0x5a0a,0x5a1e,0x5a33,0x5b6c,0x5ba7,0x5bad, -0x5bac,0x5c03,0x5c56,0x5c54,0x5cec,0x5cff,0x5cee,0x5cf1, -0x5cf7,0x5d00,0x5cf9,0x5e29,0x5e28,0x5ea8,0x5eae,0x5eaa, -0x5eac,0x5f33,0x5f30,0x5f67,0x605d,0x605a,0x6067,0x6041, -0x60a2,0x6088,0x6080,0x6092,0x6081,0x609d,0x6083,0x6095, -0x609b,0x6097,0x6087,0x609c,0x608e,0x6219,0x6246,0x62f2, -0x6310,0x6356,0x632c,0x6344,0x6345,0x6336,0x6343,0x63e4, -0x6339,0x634b,0x634a,0x633c,0x6329,0x6341,0x6334,0x6358, -0x6354,0x6359,0x632d,0x6347,0x6333,0x635a,0x6351,0x6338, -0x6357,0x6340,0x6348,0x654a,0x6546,0x65c6,0x65c3,0x65c4, -0x65c2,0x664a,0x665f,0x6647,0x6651,0x6712,0x6713,0x681f, -0x681a,0x6849,0x6832,0x6833,0x683b,0x684b,0x684f,0x6816, -0x6831,0x681c,0x6835,0x682b,0x682d,0x682f,0x684e,0x6844, -0x6834,0x681d,0x6812,0x6814,0x6826,0x6828,0x682e,0x684d, -0x683a,0x6825,0x6820,0x6b2c,0x6b2f,0x6b2d,0x6b31,0x6b34, -0x6b6d,0x8082,0x6b88,0x6be6,0x6be4,0x6be8,0x6be3,0x6be2, -0x6be7,0x6c25,0x6d7a,0x6d63,0x6d64,0x6d76,0x6d0d,0x6d61, -0x6d92,0x6d58,0x6d62,0x6d6d,0x6d6f,0x6d91,0x6d8d,0x6def, -0x6d7f,0x6d86,0x6d5e,0x6d67,0x6d60,0x6d97,0x6d70,0x6d7c, -0x6d5f,0x6d82,0x6d98,0x6d2f,0x6d68,0x6d8b,0x6d7e,0x6d80, -0x6d84,0x6d16,0x6d83,0x6d7b,0x6d7d,0x6d75,0x6d90,0x70dc, -0x70d3,0x70d1,0x70dd,0x70cb,0x7f39,0x70e2,0x70d7,0x70d2, -0x70de,0x70e0,0x70d4,0x70cd,0x70c5,0x70c6,0x70c7,0x70da, -0x70ce,0x70e1,0x7242,0x7278,0x7277,0x7276,0x7300,0x72fa, -0x72f4,0x72fe,0x72f6,0x72f3,0x72fb,0x7301,0x73d3,0x73d9, -0x73e5,0x73d6,0x73bc,0x73e7,0x73e3,0x73e9,0x73dc,0x73d2, -0x73db,0x73d4,0x73dd,0x73da,0x73d7,0x73d8,0x73e8,0x74de, -0x74df,0x74f4,0x74f5,0x7521,0x755b,0x755f,0x75b0,0x75c1, -0x75bb,0x75c4,0x75c0,0x75bf,0x75b6,0x75ba,0x768a,0x76c9, -0x771d,0x771b,0x7710,0x7713,0x7712,0x7723,0x7711,0x7715, -0x7719,0x771a,0x7722,0x7727,0x7823,0x782c,0x7822,0x7835, -0x782f,0x7828,0x782e,0x782b,0x7821,0x7829,0x7833,0x782a, -0x7831,0x7954,0x795b,0x794f,0x795c,0x7953,0x7952,0x7951, -0x79eb,0x79ec,0x79e0,0x79ee,0x79ed,0x79ea,0x79dc,0x79de, -0x79dd,0x7a86,0x7a89,0x7a85,0x7a8b,0x7a8c,0x7a8a,0x7a87, -0x7ad8,0x7b10,0x7b04,0x7b13,0x7b05,0x7b0f,0x7b08,0x7b0a, -0x7b0e,0x7b09,0x7b12,0x7c84,0x7c91,0x7c8a,0x7c8c,0x7c88, -0x7c8d,0x7c85,0x7d1e,0x7d1d,0x7d11,0x7d0e,0x7d18,0x7d16, -0x7d13,0x7d1f,0x7d12,0x7d0f,0x7d0c,0x7f5c,0x7f61,0x7f5e, -0x7f60,0x7f5d,0x7f5b,0x7f96,0x7f92,0x7fc3,0x7fc2,0x7fc0, -0x8016,0x803e,0x8039,0x80fa,0x80f2,0x80f9,0x80f5,0x8101, -0x80fb,0x8100,0x8201,0x822f,0x8225,0x8333,0x832d,0x8344, -0x8319,0x8351,0x8325,0x8356,0x833f,0x8341,0x8326,0x831c, -0x8322,0x8342,0x834e,0x831b,0x832a,0x8308,0x833c,0x834d, -0x8316,0x8324,0x8320,0x8337,0x832f,0x8329,0x8347,0x8345, -0x834c,0x8353,0x831e,0x832c,0x834b,0x8327,0x8348,0x8653, -0x8652,0x86a2,0x86a8,0x8696,0x868d,0x8691,0x869e,0x8687, -0x8697,0x8686,0x868b,0x869a,0x8685,0x86a5,0x8699,0x86a1, -0x86a7,0x8695,0x8698,0x868e,0x869d,0x8690,0x8694,0x8843, -0x8844,0x886d,0x8875,0x8876,0x8872,0x8880,0x8871,0x887f, -0x886f,0x8883,0x887e,0x8874,0x887c,0x8a12,0x8c47,0x8c57, -0x8c7b,0x8ca4,0x8ca3,0x8d76,0x8d78,0x8db5,0x8db7,0x8db6, -0x8ed1,0x8ed3,0x8ffe,0x8ff5,0x9002,0x8fff,0x8ffb,0x9004, -0x8ffc,0x8ff6,0x90d6,0x90e0,0x90d9,0x90da,0x90e3,0x90df, -0x90e5,0x90d8,0x90db,0x90d7,0x90dc,0x90e4,0x9150,0x914e, -0x914f,0x91d5,0x91e2,0x91da,0x965c,0x965f,0x96bc,0x98e3, -0x9adf,0x9b2f,0x4e7f,0x5070,0x506a,0x5061,0x505e,0x5060, -0x5053,0x504b,0x505d,0x5072,0x5048,0x504d,0x5041,0x505b, -0x504a,0x5062,0x5015,0x5045,0x505f,0x5069,0x506b,0x5063, -0x5064,0x5046,0x5040,0x506e,0x5073,0x5057,0x5051,0x51d0, -0x526b,0x526d,0x526c,0x526e,0x52d6,0x52d3,0x532d,0x539c, -0x5575,0x5576,0x553c,0x554d,0x5550,0x5534,0x552a,0x5551, -0x5562,0x5536,0x5535,0x5530,0x5552,0x5545,0x550c,0x5532, -0x5565,0x554e,0x5539,0x5548,0x552d,0x553b,0x5540,0x554b, -0x570a,0x5707,0x57fb,0x5814,0x57e2,0x57f6,0x57dc,0x57f4, -0x5800,0x57ed,0x57fd,0x5808,0x57f8,0x580b,0x57f3,0x57cf, -0x5807,0x57ee,0x57e3,0x57f2,0x57e5,0x57ec,0x57e1,0x580e, -0x57fc,0x5810,0x57e7,0x5801,0x580c,0x57f1,0x57e9,0x57f0, -0x580d,0x5804,0x595c,0x5a60,0x5a58,0x5a55,0x5a67,0x5a5e, -0x5a38,0x5a35,0x5a6d,0x5a50,0x5a5f,0x5a65,0x5a6c,0x5a53, -0x5a64,0x5a57,0x5a43,0x5a5d,0x5a52,0x5a44,0x5a5b,0x5a48, -0x5a8e,0x5a3e,0x5a4d,0x5a39,0x5a4c,0x5a70,0x5a69,0x5a47, -0x5a51,0x5a56,0x5a42,0x5a5c,0x5b72,0x5b6e,0x5bc1,0x5bc0, -0x5c59,0x5d1e,0x5d0b,0x5d1d,0x5d1a,0x5d20,0x5d0c,0x5d28, -0x5d0d,0x5d26,0x5d25,0x5d0f,0x5d30,0x5d12,0x5d23,0x5d1f, -0x5d2e,0x5e3e,0x5e34,0x5eb1,0x5eb4,0x5eb9,0x5eb2,0x5eb3, -0x5f36,0x5f38,0x5f9b,0x5f96,0x5f9f,0x608a,0x6090,0x6086, -0x60be,0x60b0,0x60ba,0x60d3,0x60d4,0x60cf,0x60e4,0x60d9, -0x60dd,0x60c8,0x60b1,0x60db,0x60b7,0x60ca,0x60bf,0x60c3, -0x60cd,0x60c0,0x6332,0x6365,0x638a,0x6382,0x637d,0x63bd, -0x639e,0x63ad,0x639d,0x6397,0x63ab,0x638e,0x636f,0x6387, -0x6390,0x636e,0x63af,0x6375,0x639c,0x636d,0x63ae,0x637c, -0x63a4,0x633b,0x639f,0x6378,0x6385,0x6381,0x6391,0x638d, -0x6370,0x6553,0x65cd,0x6665,0x6661,0x665b,0x6659,0x665c, -0x6662,0x6718,0x6879,0x6887,0x6890,0x689c,0x686d,0x686e, -0x68ae,0x68ab,0x6956,0x686f,0x68a3,0x68ac,0x68a9,0x6875, -0x6874,0x68b2,0x688f,0x6877,0x6892,0x687c,0x686b,0x6872, -0x68aa,0x6880,0x6871,0x687e,0x689b,0x6896,0x688b,0x68a0, -0x6889,0x68a4,0x6878,0x687b,0x6891,0x688c,0x688a,0x687d, -0x6b36,0x6b33,0x6b37,0x6b38,0x6b91,0x6b8f,0x6b8d,0x6b8e, -0x6b8c,0x6c2a,0x6dc0,0x6dab,0x6db4,0x6db3,0x6e74,0x6dac, -0x6de9,0x6de2,0x6db7,0x6df6,0x6dd4,0x6e00,0x6dc8,0x6de0, -0x6ddf,0x6dd6,0x6dbe,0x6de5,0x6ddc,0x6ddd,0x6ddb,0x6df4, -0x6dca,0x6dbd,0x6ded,0x6df0,0x6dba,0x6dd5,0x6dc2,0x6dcf, -0x6dc9,0x6dd0,0x6df2,0x6dd3,0x6dfd,0x6dd7,0x6dcd,0x6de3, -0x6dbb,0x70fa,0x710d,0x70f7,0x7117,0x70f4,0x710c,0x70f0, -0x7104,0x70f3,0x7110,0x70fc,0x70ff,0x7106,0x7113,0x7100, -0x70f8,0x70f6,0x710b,0x7102,0x710e,0x727e,0x727b,0x727c, -0x727f,0x731d,0x7317,0x7307,0x7311,0x7318,0x730a,0x7308, -0x72ff,0x730f,0x731e,0x7388,0x73f6,0x73f8,0x73f5,0x7404, -0x7401,0x73fd,0x7407,0x7400,0x73fa,0x73fc,0x73ff,0x740c, -0x740b,0x73f4,0x7408,0x7564,0x7563,0x75ce,0x75d2,0x75cf, -0x75cb,0x75cc,0x75d1,0x75d0,0x768f,0x7689,0x76d3,0x7739, -0x772f,0x772d,0x7731,0x7732,0x7734,0x7733,0x773d,0x7725, -0x773b,0x7735,0x7848,0x7852,0x7849,0x784d,0x784a,0x784c, -0x7826,0x7845,0x7850,0x7964,0x7967,0x7969,0x796a,0x7963, -0x796b,0x7961,0x79bb,0x79fa,0x79f8,0x79f6,0x79f7,0x7a8f, -0x7a94,0x7a90,0x7b35,0x7b47,0x7b34,0x7b25,0x7b30,0x7b22, -0x7b24,0x7b33,0x7b18,0x7b2a,0x7b1d,0x7b31,0x7b2b,0x7b2d, -0x7b2f,0x7b32,0x7b38,0x7b1a,0x7b23,0x7c94,0x7c98,0x7c96, -0x7ca3,0x7d35,0x7d3d,0x7d38,0x7d36,0x7d3a,0x7d45,0x7d2c, -0x7d29,0x7d41,0x7d47,0x7d3e,0x7d3f,0x7d4a,0x7d3b,0x7d28, -0x7f63,0x7f95,0x7f9c,0x7f9d,0x7f9b,0x7fca,0x7fcb,0x7fcd, -0x7fd0,0x7fd1,0x7fc7,0x7fcf,0x7fc9,0x801f,0x801e,0x801b, -0x8047,0x8043,0x8048,0x8118,0x8125,0x8119,0x811b,0x812d, -0x811f,0x812c,0x811e,0x8121,0x8115,0x8127,0x811d,0x8122, -0x8211,0x8238,0x8233,0x823a,0x8234,0x8232,0x8274,0x8390, -0x83a3,0x83a8,0x838d,0x837a,0x8373,0x83a4,0x8374,0x838f, -0x8381,0x8395,0x8399,0x8375,0x8394,0x83a9,0x837d,0x8383, -0x838c,0x839d,0x839b,0x83aa,0x838b,0x837e,0x83a5,0x83af, -0x8388,0x8397,0x83b0,0x837f,0x83a6,0x8387,0x83ae,0x8376, -0x839a,0x8659,0x8656,0x86bf,0x86b7,0x86c2,0x86c1,0x86c5, -0x86ba,0x86b0,0x86c8,0x86b9,0x86b3,0x86b8,0x86cc,0x86b4, -0x86bb,0x86bc,0x86c3,0x86bd,0x86be,0x8852,0x8889,0x8895, -0x88a8,0x88a2,0x88aa,0x889a,0x8891,0x88a1,0x889f,0x8898, -0x88a7,0x8899,0x889b,0x8897,0x88a4,0x88ac,0x888c,0x8893, -0x888e,0x8982,0x89d6,0x89d9,0x89d5,0x8a30,0x8a27,0x8a2c, -0x8a1e,0x8c39,0x8c3b,0x8c5c,0x8c5d,0x8c7d,0x8ca5,0x8d7d, -0x8d7b,0x8d79,0x8dbc,0x8dc2,0x8db9,0x8dbf,0x8dc1,0x8ed8, -0x8ede,0x8edd,0x8edc,0x8ed7,0x8ee0,0x8ee1,0x9024,0x900b, -0x9011,0x901c,0x900c,0x9021,0x90ef,0x90ea,0x90f0,0x90f4, -0x90f2,0x90f3,0x90d4,0x90eb,0x90ec,0x90e9,0x9156,0x9158, -0x915a,0x9153,0x9155,0x91ec,0x91f4,0x91f1,0x91f3,0x91f8, -0x91e4,0x91f9,0x91ea,0x91eb,0x91f7,0x91e8,0x91ee,0x957a, -0x9586,0x9588,0x967c,0x966d,0x966b,0x9671,0x966f,0x96bf, -0x976a,0x9804,0x98e5,0x9997,0x509b,0x5095,0x5094,0x509e, -0x508b,0x50a3,0x5083,0x508c,0x508e,0x509d,0x5068,0x509c, -0x5092,0x5082,0x5087,0x515f,0x51d4,0x5312,0x5311,0x53a4, -0x53a7,0x5591,0x55a8,0x55a5,0x55ad,0x5577,0x5645,0x55a2, -0x5593,0x5588,0x558f,0x55b5,0x5581,0x55a3,0x5592,0x55a4, -0x557d,0x558c,0x55a6,0x557f,0x5595,0x55a1,0x558e,0x570c, -0x5829,0x5837,0x5819,0x581e,0x5827,0x5823,0x5828,0x57f5, -0x5848,0x5825,0x581c,0x581b,0x5833,0x583f,0x5836,0x582e, -0x5839,0x5838,0x582d,0x582c,0x583b,0x5961,0x5aaf,0x5a94, -0x5a9f,0x5a7a,0x5aa2,0x5a9e,0x5a78,0x5aa6,0x5a7c,0x5aa5, -0x5aac,0x5a95,0x5aae,0x5a37,0x5a84,0x5a8a,0x5a97,0x5a83, -0x5a8b,0x5aa9,0x5a7b,0x5a7d,0x5a8c,0x5a9c,0x5a8f,0x5a93, -0x5a9d,0x5bea,0x5bcd,0x5bcb,0x5bd4,0x5bd1,0x5bca,0x5bce, -0x5c0c,0x5c30,0x5d37,0x5d43,0x5d6b,0x5d41,0x5d4b,0x5d3f, -0x5d35,0x5d51,0x5d4e,0x5d55,0x5d33,0x5d3a,0x5d52,0x5d3d, -0x5d31,0x5d59,0x5d42,0x5d39,0x5d49,0x5d38,0x5d3c,0x5d32, -0x5d36,0x5d40,0x5d45,0x5e44,0x5e41,0x5f58,0x5fa6,0x5fa5, -0x5fab,0x60c9,0x60b9,0x60cc,0x60e2,0x60ce,0x60c4,0x6114, -0x60f2,0x610a,0x6116,0x6105,0x60f5,0x6113,0x60f8,0x60fc, -0x60fe,0x60c1,0x6103,0x6118,0x611d,0x6110,0x60ff,0x6104, -0x610b,0x624a,0x6394,0x63b1,0x63b0,0x63ce,0x63e5,0x63e8, -0x63ef,0x63c3,0x649d,0x63f3,0x63ca,0x63e0,0x63f6,0x63d5, -0x63f2,0x63f5,0x6461,0x63df,0x63be,0x63dd,0x63dc,0x63c4, -0x63d8,0x63d3,0x63c2,0x63c7,0x63cc,0x63cb,0x63c8,0x63f0, -0x63d7,0x63d9,0x6532,0x6567,0x656a,0x6564,0x655c,0x6568, -0x6565,0x658c,0x659d,0x659e,0x65ae,0x65d0,0x65d2,0x667c, -0x666c,0x667b,0x6680,0x6671,0x6679,0x666a,0x6672,0x6701, -0x690c,0x68d3,0x6904,0x68dc,0x692a,0x68ec,0x68ea,0x68f1, -0x690f,0x68d6,0x68f7,0x68eb,0x68e4,0x68f6,0x6913,0x6910, -0x68f3,0x68e1,0x6907,0x68cc,0x6908,0x6970,0x68b4,0x6911, -0x68ef,0x68c6,0x6914,0x68f8,0x68d0,0x68fd,0x68fc,0x68e8, -0x690b,0x690a,0x6917,0x68ce,0x68c8,0x68dd,0x68de,0x68e6, -0x68f4,0x68d1,0x6906,0x68d4,0x68e9,0x6915,0x6925,0x68c7, -0x6b39,0x6b3b,0x6b3f,0x6b3c,0x6b94,0x6b97,0x6b99,0x6b95, -0x6bbd,0x6bf0,0x6bf2,0x6bf3,0x6c30,0x6dfc,0x6e46,0x6e47, -0x6e1f,0x6e49,0x6e88,0x6e3c,0x6e3d,0x6e45,0x6e62,0x6e2b, -0x6e3f,0x6e41,0x6e5d,0x6e73,0x6e1c,0x6e33,0x6e4b,0x6e40, -0x6e51,0x6e3b,0x6e03,0x6e2e,0x6e5e,0x6e68,0x6e5c,0x6e61, -0x6e31,0x6e28,0x6e60,0x6e71,0x6e6b,0x6e39,0x6e22,0x6e30, -0x6e53,0x6e65,0x6e27,0x6e78,0x6e64,0x6e77,0x6e55,0x6e79, -0x6e52,0x6e66,0x6e35,0x6e36,0x6e5a,0x7120,0x711e,0x712f, -0x70fb,0x712e,0x7131,0x7123,0x7125,0x7122,0x7132,0x711f, -0x7128,0x713a,0x711b,0x724b,0x725a,0x7288,0x7289,0x7286, -0x7285,0x728b,0x7312,0x730b,0x7330,0x7322,0x7331,0x7333, -0x7327,0x7332,0x732d,0x7326,0x7323,0x7335,0x730c,0x742e, -0x742c,0x7430,0x742b,0x7416,0x741a,0x7421,0x742d,0x7431, -0x7424,0x7423,0x741d,0x7429,0x7420,0x7432,0x74fb,0x752f, -0x756f,0x756c,0x75e7,0x75da,0x75e1,0x75e6,0x75dd,0x75df, -0x75e4,0x75d7,0x7695,0x7692,0x76da,0x7746,0x7747,0x7744, -0x774d,0x7745,0x774a,0x774e,0x774b,0x774c,0x77de,0x77ec, -0x7860,0x7864,0x7865,0x785c,0x786d,0x7871,0x786a,0x786e, -0x7870,0x7869,0x7868,0x785e,0x7862,0x7974,0x7973,0x7972, -0x7970,0x7a02,0x7a0a,0x7a03,0x7a0c,0x7a04,0x7a99,0x7ae6, -0x7ae4,0x7b4a,0x7b3b,0x7b44,0x7b48,0x7b4c,0x7b4e,0x7b40, -0x7b58,0x7b45,0x7ca2,0x7c9e,0x7ca8,0x7ca1,0x7d58,0x7d6f, -0x7d63,0x7d53,0x7d56,0x7d67,0x7d6a,0x7d4f,0x7d6d,0x7d5c, -0x7d6b,0x7d52,0x7d54,0x7d69,0x7d51,0x7d5f,0x7d4e,0x7f3e, -0x7f3f,0x7f65,0x7f66,0x7fa2,0x7fa0,0x7fa1,0x7fd7,0x8051, -0x804f,0x8050,0x80fe,0x80d4,0x8143,0x814a,0x8152,0x814f, -0x8147,0x813d,0x814d,0x813a,0x81e6,0x81ee,0x81f7,0x81f8, -0x81f9,0x8204,0x823c,0x823d,0x823f,0x8275,0x833b,0x83cf, -0x83f9,0x8423,0x83c0,0x83e8,0x8412,0x83e7,0x83e4,0x83fc, -0x83f6,0x8410,0x83c6,0x83c8,0x83eb,0x83e3,0x83bf,0x8401, -0x83dd,0x83e5,0x83d8,0x83ff,0x83e1,0x83cb,0x83ce,0x83d6, -0x83f5,0x83c9,0x8409,0x840f,0x83de,0x8411,0x8406,0x83c2, -0x83f3,0x83d5,0x83fa,0x83c7,0x83d1,0x83ea,0x8413,0x83c3, -0x83ec,0x83ee,0x83c4,0x83fb,0x83d7,0x83e2,0x841b,0x83db, -0x83fe,0x86d8,0x86e2,0x86e6,0x86d3,0x86e3,0x86da,0x86ea, -0x86dd,0x86eb,0x86dc,0x86ec,0x86e9,0x86d7,0x86e8,0x86d1, -0x8848,0x8856,0x8855,0x88ba,0x88d7,0x88b9,0x88b8,0x88c0, -0x88be,0x88b6,0x88bc,0x88b7,0x88bd,0x88b2,0x8901,0x88c9, -0x8995,0x8998,0x8997,0x89dd,0x89da,0x89db,0x8a4e,0x8a4d, -0x8a39,0x8a59,0x8a40,0x8a57,0x8a58,0x8a44,0x8a45,0x8a52, -0x8a48,0x8a51,0x8a4a,0x8a4c,0x8a4f,0x8c5f,0x8c81,0x8c80, -0x8cba,0x8cbe,0x8cb0,0x8cb9,0x8cb5,0x8d84,0x8d80,0x8d89, -0x8dd8,0x8dd3,0x8dcd,0x8dc7,0x8dd6,0x8ddc,0x8dcf,0x8dd5, -0x8dd9,0x8dc8,0x8dd7,0x8dc5,0x8eef,0x8ef7,0x8efa,0x8ef9, -0x8ee6,0x8eee,0x8ee5,0x8ef5,0x8ee7,0x8ee8,0x8ef6,0x8eeb, -0x8ef1,0x8eec,0x8ef4,0x8ee9,0x902d,0x9034,0x902f,0x9106, -0x912c,0x9104,0x90ff,0x90fc,0x9108,0x90f9,0x90fb,0x9101, -0x9100,0x9107,0x9105,0x9103,0x9161,0x9164,0x915f,0x9162, -0x9160,0x9201,0x920a,0x9225,0x9203,0x921a,0x9226,0x920f, -0x920c,0x9200,0x9212,0x91ff,0x91fd,0x9206,0x9204,0x9227, -0x9202,0x921c,0x9224,0x9219,0x9217,0x9205,0x9216,0x957b, -0x958d,0x958c,0x9590,0x9687,0x967e,0x9688,0x9689,0x9683, -0x9680,0x96c2,0x96c8,0x96c3,0x96f1,0x96f0,0x976c,0x9770, -0x976e,0x9807,0x98a9,0x98eb,0x9ce6,0x9ef9,0x4e83,0x4e84, -0x4eb6,0x50bd,0x50bf,0x50c6,0x50ae,0x50c4,0x50ca,0x50b4, -0x50c8,0x50c2,0x50b0,0x50c1,0x50ba,0x50b1,0x50cb,0x50c9, -0x50b6,0x50b8,0x51d7,0x527a,0x5278,0x527b,0x527c,0x55c3, -0x55db,0x55cc,0x55d0,0x55cb,0x55ca,0x55dd,0x55c0,0x55d4, -0x55c4,0x55e9,0x55bf,0x55d2,0x558d,0x55cf,0x55d5,0x55e2, -0x55d6,0x55c8,0x55f2,0x55cd,0x55d9,0x55c2,0x5714,0x5853, -0x5868,0x5864,0x584f,0x584d,0x5849,0x586f,0x5855,0x584e, -0x585d,0x5859,0x5865,0x585b,0x583d,0x5863,0x5871,0x58fc, -0x5ac7,0x5ac4,0x5acb,0x5aba,0x5ab8,0x5ab1,0x5ab5,0x5ab0, -0x5abf,0x5ac8,0x5abb,0x5ac6,0x5ab7,0x5ac0,0x5aca,0x5ab4, -0x5ab6,0x5acd,0x5ab9,0x5a90,0x5bd6,0x5bd8,0x5bd9,0x5c1f, -0x5c33,0x5d71,0x5d63,0x5d4a,0x5d65,0x5d72,0x5d6c,0x5d5e, -0x5d68,0x5d67,0x5d62,0x5df0,0x5e4f,0x5e4e,0x5e4a,0x5e4d, -0x5e4b,0x5ec5,0x5ecc,0x5ec6,0x5ecb,0x5ec7,0x5f40,0x5faf, -0x5fad,0x60f7,0x6149,0x614a,0x612b,0x6145,0x6136,0x6132, -0x612e,0x6146,0x612f,0x614f,0x6129,0x6140,0x6220,0x9168, -0x6223,0x6225,0x6224,0x63c5,0x63f1,0x63eb,0x6410,0x6412, -0x6409,0x6420,0x6424,0x6433,0x6443,0x641f,0x6415,0x6418, -0x6439,0x6437,0x6422,0x6423,0x640c,0x6426,0x6430,0x6428, -0x6441,0x6435,0x642f,0x640a,0x641a,0x6440,0x6425,0x6427, -0x640b,0x63e7,0x641b,0x642e,0x6421,0x640e,0x656f,0x6592, -0x65d3,0x6686,0x668c,0x6695,0x6690,0x668b,0x668a,0x6699, -0x6694,0x6678,0x6720,0x6966,0x695f,0x6938,0x694e,0x6962, -0x6971,0x693f,0x6945,0x696a,0x6939,0x6942,0x6957,0x6959, -0x697a,0x6948,0x6949,0x6935,0x696c,0x6933,0x693d,0x6965, -0x68f0,0x6978,0x6934,0x6969,0x6940,0x696f,0x6944,0x6976, -0x6958,0x6941,0x6974,0x694c,0x693b,0x694b,0x6937,0x695c, -0x694f,0x6951,0x6932,0x6952,0x692f,0x697b,0x693c,0x6b46, -0x6b45,0x6b43,0x6b42,0x6b48,0x6b41,0x6b9b,0xfa0d,0x6bfb, -0x6bfc,0x6bf9,0x6bf7,0x6bf8,0x6e9b,0x6ed6,0x6ec8,0x6e8f, -0x6ec0,0x6e9f,0x6e93,0x6e94,0x6ea0,0x6eb1,0x6eb9,0x6ec6, -0x6ed2,0x6ebd,0x6ec1,0x6e9e,0x6ec9,0x6eb7,0x6eb0,0x6ecd, -0x6ea6,0x6ecf,0x6eb2,0x6ebe,0x6ec3,0x6edc,0x6ed8,0x6e99, -0x6e92,0x6e8e,0x6e8d,0x6ea4,0x6ea1,0x6ebf,0x6eb3,0x6ed0, -0x6eca,0x6e97,0x6eae,0x6ea3,0x7147,0x7154,0x7152,0x7163, -0x7160,0x7141,0x715d,0x7162,0x7172,0x7178,0x716a,0x7161, -0x7142,0x7158,0x7143,0x714b,0x7170,0x715f,0x7150,0x7153, -0x7144,0x714d,0x715a,0x724f,0x728d,0x728c,0x7291,0x7290, -0x728e,0x733c,0x7342,0x733b,0x733a,0x7340,0x734a,0x7349, -0x7444,0x744a,0x744b,0x7452,0x7451,0x7457,0x7440,0x744f, -0x7450,0x744e,0x7442,0x7446,0x744d,0x7454,0x74e1,0x74ff, -0x74fe,0x74fd,0x751d,0x7579,0x7577,0x6983,0x75ef,0x760f, -0x7603,0x75f7,0x75fe,0x75fc,0x75f9,0x75f8,0x7610,0x75fb, -0x75f6,0x75ed,0x75f5,0x75fd,0x7699,0x76b5,0x76dd,0x7755, -0x775f,0x7760,0x7752,0x7756,0x775a,0x7769,0x7767,0x7754, -0x7759,0x776d,0x77e0,0x7887,0x789a,0x7894,0x788f,0x7884, -0x7895,0x7885,0x7886,0x78a1,0x7883,0x7879,0x7899,0x7880, -0x7896,0x787b,0x797c,0x7982,0x797d,0x7979,0x7a11,0x7a18, -0x7a19,0x7a12,0x7a17,0x7a15,0x7a22,0x7a13,0x7a1b,0x7a10, -0x7aa3,0x7aa2,0x7a9e,0x7aeb,0x7b66,0x7b64,0x7b6d,0x7b74, -0x7b69,0x7b72,0x7b65,0x7b73,0x7b71,0x7b70,0x7b61,0x7b78, -0x7b76,0x7b63,0x7cb2,0x7cb4,0x7caf,0x7d88,0x7d86,0x7d80, -0x7d8d,0x7d7f,0x7d85,0x7d7a,0x7d8e,0x7d7b,0x7d83,0x7d7c, -0x7d8c,0x7d94,0x7d84,0x7d7d,0x7d92,0x7f6d,0x7f6b,0x7f67, -0x7f68,0x7f6c,0x7fa6,0x7fa5,0x7fa7,0x7fdb,0x7fdc,0x8021, -0x8164,0x8160,0x8177,0x815c,0x8169,0x815b,0x8162,0x8172, -0x6721,0x815e,0x8176,0x8167,0x816f,0x8144,0x8161,0x821d, -0x8249,0x8244,0x8240,0x8242,0x8245,0x84f1,0x843f,0x8456, -0x8476,0x8479,0x848f,0x848d,0x8465,0x8451,0x8440,0x8486, -0x8467,0x8430,0x844d,0x847d,0x845a,0x8459,0x8474,0x8473, -0x845d,0x8507,0x845e,0x8437,0x843a,0x8434,0x847a,0x8443, -0x8478,0x8432,0x8445,0x8429,0x83d9,0x844b,0x842f,0x8442, -0x842d,0x845f,0x8470,0x8439,0x844e,0x844c,0x8452,0x846f, -0x84c5,0x848e,0x843b,0x8447,0x8436,0x8433,0x8468,0x847e, -0x8444,0x842b,0x8460,0x8454,0x846e,0x8450,0x870b,0x8704, -0x86f7,0x870c,0x86fa,0x86d6,0x86f5,0x874d,0x86f8,0x870e, -0x8709,0x8701,0x86f6,0x870d,0x8705,0x88d6,0x88cb,0x88cd, -0x88ce,0x88de,0x88db,0x88da,0x88cc,0x88d0,0x8985,0x899b, -0x89df,0x89e5,0x89e4,0x89e1,0x89e0,0x89e2,0x89dc,0x89e6, -0x8a76,0x8a86,0x8a7f,0x8a61,0x8a3f,0x8a77,0x8a82,0x8a84, -0x8a75,0x8a83,0x8a81,0x8a74,0x8a7a,0x8c3c,0x8c4b,0x8c4a, -0x8c65,0x8c64,0x8c66,0x8c86,0x8c84,0x8c85,0x8ccc,0x8d68, -0x8d69,0x8d91,0x8d8c,0x8d8e,0x8d8f,0x8d8d,0x8d93,0x8d94, -0x8d90,0x8d92,0x8df0,0x8de0,0x8dec,0x8df1,0x8dee,0x8dd0, -0x8de9,0x8de3,0x8de2,0x8de7,0x8df2,0x8deb,0x8df4,0x8f06, -0x8eff,0x8f01,0x8f00,0x8f05,0x8f07,0x8f08,0x8f02,0x8f0b, -0x9052,0x903f,0x9044,0x9049,0x903d,0x9110,0x910d,0x910f, -0x9111,0x9116,0x9114,0x910b,0x910e,0x916e,0x916f,0x9248, -0x9252,0x9230,0x923a,0x9266,0x9233,0x9265,0x925e,0x9283, -0x922e,0x924a,0x9246,0x926d,0x926c,0x924f,0x9260,0x9267, -0x926f,0x9236,0x9261,0x9270,0x9231,0x9254,0x9263,0x9250, -0x9272,0x924e,0x9253,0x924c,0x9256,0x9232,0x959f,0x959c, -0x959e,0x959b,0x9692,0x9693,0x9691,0x9697,0x96ce,0x96fa, -0x96fd,0x96f8,0x96f5,0x9773,0x9777,0x9778,0x9772,0x980f, -0x980d,0x980e,0x98ac,0x98f6,0x98f9,0x99af,0x99b2,0x99b0, -0x99b5,0x9aad,0x9aab,0x9b5b,0x9cea,0x9ced,0x9ce7,0x9e80, -0x9efd,0x50e6,0x50d4,0x50d7,0x50e8,0x50f3,0x50db,0x50ea, -0x50dd,0x50e4,0x50d3,0x50ec,0x50f0,0x50ef,0x50e3,0x50e0, -0x51d8,0x5280,0x5281,0x52e9,0x52eb,0x5330,0x53ac,0x5627, -0x5615,0x560c,0x5612,0x55fc,0x560f,0x561c,0x5601,0x5613, -0x5602,0x55fa,0x561d,0x5604,0x55ff,0x55f9,0x5889,0x587c, -0x5890,0x5898,0x5886,0x5881,0x587f,0x5874,0x588b,0x587a, -0x5887,0x5891,0x588e,0x5876,0x5882,0x5888,0x587b,0x5894, -0x588f,0x58fe,0x596b,0x5adc,0x5aee,0x5ae5,0x5ad5,0x5aea, -0x5ada,0x5aed,0x5aeb,0x5af3,0x5ae2,0x5ae0,0x5adb,0x5aec, -0x5ade,0x5add,0x5ad9,0x5ae8,0x5adf,0x5b77,0x5be0,0x5be3, -0x5c63,0x5d82,0x5d80,0x5d7d,0x5d86,0x5d7a,0x5d81,0x5d77, -0x5d8a,0x5d89,0x5d88,0x5d7e,0x5d7c,0x5d8d,0x5d79,0x5d7f, -0x5e58,0x5e59,0x5e53,0x5ed8,0x5ed1,0x5ed7,0x5ece,0x5edc, -0x5ed5,0x5ed9,0x5ed2,0x5ed4,0x5f44,0x5f43,0x5f6f,0x5fb6, -0x612c,0x6128,0x6141,0x615e,0x6171,0x6173,0x6152,0x6153, -0x6172,0x616c,0x6180,0x6174,0x6154,0x617a,0x615b,0x6165, -0x613b,0x616a,0x6161,0x6156,0x6229,0x6227,0x622b,0x642b, -0x644d,0x645b,0x645d,0x6474,0x6476,0x6472,0x6473,0x647d, -0x6475,0x6466,0x64a6,0x644e,0x6482,0x645e,0x645c,0x644b, -0x6453,0x6460,0x6450,0x647f,0x643f,0x646c,0x646b,0x6459, -0x6465,0x6477,0x6573,0x65a0,0x66a1,0x66a0,0x669f,0x6705, -0x6704,0x6722,0x69b1,0x69b6,0x69c9,0x69a0,0x69ce,0x6996, -0x69b0,0x69ac,0x69bc,0x6991,0x6999,0x698e,0x69a7,0x698d, -0x69a9,0x69be,0x69af,0x69bf,0x69c4,0x69bd,0x69a4,0x69d4, -0x69b9,0x69ca,0x699a,0x69cf,0x69b3,0x6993,0x69aa,0x69a1, -0x699e,0x69d9,0x6997,0x6990,0x69c2,0x69b5,0x69a5,0x69c6, -0x6b4a,0x6b4d,0x6b4b,0x6b9e,0x6b9f,0x6ba0,0x6bc3,0x6bc4, -0x6bfe,0x6ece,0x6ef5,0x6ef1,0x6f03,0x6f25,0x6ef8,0x6f37, -0x6efb,0x6f2e,0x6f09,0x6f4e,0x6f19,0x6f1a,0x6f27,0x6f18, -0x6f3b,0x6f12,0x6eed,0x6f0a,0x6f36,0x6f73,0x6ef9,0x6eee, -0x6f2d,0x6f40,0x6f30,0x6f3c,0x6f35,0x6eeb,0x6f07,0x6f0e, -0x6f43,0x6f05,0x6efd,0x6ef6,0x6f39,0x6f1c,0x6efc,0x6f3a, -0x6f1f,0x6f0d,0x6f1e,0x6f08,0x6f21,0x7187,0x7190,0x7189, -0x7180,0x7185,0x7182,0x718f,0x717b,0x7186,0x7181,0x7197, -0x7244,0x7253,0x7297,0x7295,0x7293,0x7343,0x734d,0x7351, -0x734c,0x7462,0x7473,0x7471,0x7475,0x7472,0x7467,0x746e, -0x7500,0x7502,0x7503,0x757d,0x7590,0x7616,0x7608,0x760c, -0x7615,0x7611,0x760a,0x7614,0x76b8,0x7781,0x777c,0x7785, -0x7782,0x776e,0x7780,0x776f,0x777e,0x7783,0x78b2,0x78aa, -0x78b4,0x78ad,0x78a8,0x787e,0x78ab,0x789e,0x78a5,0x78a0, -0x78ac,0x78a2,0x78a4,0x7998,0x798a,0x798b,0x7996,0x7995, -0x7994,0x7993,0x7997,0x7988,0x7992,0x7990,0x7a2b,0x7a4a, -0x7a30,0x7a2f,0x7a28,0x7a26,0x7aa8,0x7aab,0x7aac,0x7aee, -0x7b88,0x7b9c,0x7b8a,0x7b91,0x7b90,0x7b96,0x7b8d,0x7b8c, -0x7b9b,0x7b8e,0x7b85,0x7b98,0x5284,0x7b99,0x7ba4,0x7b82, -0x7cbb,0x7cbf,0x7cbc,0x7cba,0x7da7,0x7db7,0x7dc2,0x7da3, -0x7daa,0x7dc1,0x7dc0,0x7dc5,0x7d9d,0x7dce,0x7dc4,0x7dc6, -0x7dcb,0x7dcc,0x7daf,0x7db9,0x7d96,0x7dbc,0x7d9f,0x7da6, -0x7dae,0x7da9,0x7da1,0x7dc9,0x7f73,0x7fe2,0x7fe3,0x7fe5, -0x7fde,0x8024,0x805d,0x805c,0x8189,0x8186,0x8183,0x8187, -0x818d,0x818c,0x818b,0x8215,0x8497,0x84a4,0x84a1,0x849f, -0x84ba,0x84ce,0x84c2,0x84ac,0x84ae,0x84ab,0x84b9,0x84b4, -0x84c1,0x84cd,0x84aa,0x849a,0x84b1,0x84d0,0x849d,0x84a7, -0x84bb,0x84a2,0x8494,0x84c7,0x84cc,0x849b,0x84a9,0x84af, -0x84a8,0x84d6,0x8498,0x84b6,0x84cf,0x84a0,0x84d7,0x84d4, -0x84d2,0x84db,0x84b0,0x8491,0x8661,0x8733,0x8723,0x8728, -0x876b,0x8740,0x872e,0x871e,0x8721,0x8719,0x871b,0x8743, -0x872c,0x8741,0x873e,0x8746,0x8720,0x8732,0x872a,0x872d, -0x873c,0x8712,0x873a,0x8731,0x8735,0x8742,0x8726,0x8727, -0x8738,0x8724,0x871a,0x8730,0x8711,0x88f7,0x88e7,0x88f1, -0x88f2,0x88fa,0x88fe,0x88ee,0x88fc,0x88f6,0x88fb,0x88f0, -0x88ec,0x88eb,0x899d,0x89a1,0x899f,0x899e,0x89e9,0x89eb, -0x89e8,0x8aab,0x8a99,0x8a8b,0x8a92,0x8a8f,0x8a96,0x8c3d, -0x8c68,0x8c69,0x8cd5,0x8ccf,0x8cd7,0x8d96,0x8e09,0x8e02, -0x8dff,0x8e0d,0x8dfd,0x8e0a,0x8e03,0x8e07,0x8e06,0x8e05, -0x8dfe,0x8e00,0x8e04,0x8f10,0x8f11,0x8f0e,0x8f0d,0x9123, -0x911c,0x9120,0x9122,0x911f,0x911d,0x911a,0x9124,0x9121, -0x911b,0x917a,0x9172,0x9179,0x9173,0x92a5,0x92a4,0x9276, -0x929b,0x927a,0x92a0,0x9294,0x92aa,0x928d,0x92a6,0x929a, -0x92ab,0x9279,0x9297,0x927f,0x92a3,0x92ee,0x928e,0x9282, -0x9295,0x92a2,0x927d,0x9288,0x92a1,0x928a,0x9286,0x928c, -0x9299,0x92a7,0x927e,0x9287,0x92a9,0x929d,0x928b,0x922d, -0x969e,0x96a1,0x96ff,0x9758,0x977d,0x977a,0x977e,0x9783, -0x9780,0x9782,0x977b,0x9784,0x9781,0x977f,0x97ce,0x97cd, -0x9816,0x98ad,0x98ae,0x9902,0x9900,0x9907,0x999d,0x999c, -0x99c3,0x99b9,0x99bb,0x99ba,0x99c2,0x99bd,0x99c7,0x9ab1, -0x9ae3,0x9ae7,0x9b3e,0x9b3f,0x9b60,0x9b61,0x9b5f,0x9cf1, -0x9cf2,0x9cf5,0x9ea7,0x50ff,0x5103,0x5130,0x50f8,0x5106, -0x5107,0x50f6,0x50fe,0x510b,0x510c,0x50fd,0x510a,0x528b, -0x528c,0x52f1,0x52ef,0x5648,0x5642,0x564c,0x5635,0x5641, -0x564a,0x5649,0x5646,0x5658,0x565a,0x5640,0x5633,0x563d, -0x562c,0x563e,0x5638,0x562a,0x563a,0x571a,0x58ab,0x589d, -0x58b1,0x58a0,0x58a3,0x58af,0x58ac,0x58a5,0x58a1,0x58ff, -0x5aff,0x5af4,0x5afd,0x5af7,0x5af6,0x5b03,0x5af8,0x5b02, -0x5af9,0x5b01,0x5b07,0x5b05,0x5b0f,0x5c67,0x5d99,0x5d97, -0x5d9f,0x5d92,0x5da2,0x5d93,0x5d95,0x5da0,0x5d9c,0x5da1, -0x5d9a,0x5d9e,0x5e69,0x5e5d,0x5e60,0x5e5c,0x7df3,0x5edb, -0x5ede,0x5ee1,0x5f49,0x5fb2,0x618b,0x6183,0x6179,0x61b1, -0x61b0,0x61a2,0x6189,0x619b,0x6193,0x61af,0x61ad,0x619f, -0x6192,0x61aa,0x61a1,0x618d,0x6166,0x61b3,0x622d,0x646e, -0x6470,0x6496,0x64a0,0x6485,0x6497,0x649c,0x648f,0x648b, -0x648a,0x648c,0x64a3,0x649f,0x6468,0x64b1,0x6498,0x6576, -0x657a,0x6579,0x657b,0x65b2,0x65b3,0x66b5,0x66b0,0x66a9, -0x66b2,0x66b7,0x66aa,0x66af,0x6a00,0x6a06,0x6a17,0x69e5, -0x69f8,0x6a15,0x69f1,0x69e4,0x6a20,0x69ff,0x69ec,0x69e2, -0x6a1b,0x6a1d,0x69fe,0x6a27,0x69f2,0x69ee,0x6a14,0x69f7, -0x69e7,0x6a40,0x6a08,0x69e6,0x69fb,0x6a0d,0x69fc,0x69eb, -0x6a09,0x6a04,0x6a18,0x6a25,0x6a0f,0x69f6,0x6a26,0x6a07, -0x69f4,0x6a16,0x6b51,0x6ba5,0x6ba3,0x6ba2,0x6ba6,0x6c01, -0x6c00,0x6bff,0x6c02,0x6f41,0x6f26,0x6f7e,0x6f87,0x6fc6, -0x6f92,0x6f8d,0x6f89,0x6f8c,0x6f62,0x6f4f,0x6f85,0x6f5a, -0x6f96,0x6f76,0x6f6c,0x6f82,0x6f55,0x6f72,0x6f52,0x6f50, -0x6f57,0x6f94,0x6f93,0x6f5d,0x6f00,0x6f61,0x6f6b,0x6f7d, -0x6f67,0x6f90,0x6f53,0x6f8b,0x6f69,0x6f7f,0x6f95,0x6f63, -0x6f77,0x6f6a,0x6f7b,0x71b2,0x71af,0x719b,0x71b0,0x71a0, -0x719a,0x71a9,0x71b5,0x719d,0x71a5,0x719e,0x71a4,0x71a1, -0x71aa,0x719c,0x71a7,0x71b3,0x7298,0x729a,0x7358,0x7352, -0x735e,0x735f,0x7360,0x735d,0x735b,0x7361,0x735a,0x7359, -0x7362,0x7487,0x7489,0x748a,0x7486,0x7481,0x747d,0x7485, -0x7488,0x747c,0x7479,0x7508,0x7507,0x757e,0x7625,0x761e, -0x7619,0x761d,0x761c,0x7623,0x761a,0x7628,0x761b,0x769c, -0x769d,0x769e,0x769b,0x778d,0x778f,0x7789,0x7788,0x78cd, -0x78bb,0x78cf,0x78cc,0x78d1,0x78ce,0x78d4,0x78c8,0x78c3, -0x78c4,0x78c9,0x799a,0x79a1,0x79a0,0x799c,0x79a2,0x799b, -0x6b76,0x7a39,0x7ab2,0x7ab4,0x7ab3,0x7bb7,0x7bcb,0x7bbe, -0x7bac,0x7bce,0x7baf,0x7bb9,0x7bca,0x7bb5,0x7cc5,0x7cc8, -0x7ccc,0x7ccb,0x7df7,0x7ddb,0x7dea,0x7de7,0x7dd7,0x7de1, -0x7e03,0x7dfa,0x7de6,0x7df6,0x7df1,0x7df0,0x7dee,0x7ddf, -0x7f76,0x7fac,0x7fb0,0x7fad,0x7fed,0x7feb,0x7fea,0x7fec, -0x7fe6,0x7fe8,0x8064,0x8067,0x81a3,0x819f,0x819e,0x8195, -0x81a2,0x8199,0x8197,0x8216,0x824f,0x8253,0x8252,0x8250, -0x824e,0x8251,0x8524,0x853b,0x850f,0x8500,0x8529,0x850e, -0x8509,0x850d,0x851f,0x850a,0x8527,0x851c,0x84fb,0x852b, -0x84fa,0x8508,0x850c,0x84f4,0x852a,0x84f2,0x8515,0x84f7, -0x84eb,0x84f3,0x84fc,0x8512,0x84ea,0x84e9,0x8516,0x84fe, -0x8528,0x851d,0x852e,0x8502,0x84fd,0x851e,0x84f6,0x8531, -0x8526,0x84e7,0x84e8,0x84f0,0x84ef,0x84f9,0x8518,0x8520, -0x8530,0x850b,0x8519,0x852f,0x8662,0x8756,0x8763,0x8764, -0x8777,0x87e1,0x8773,0x8758,0x8754,0x875b,0x8752,0x8761, -0x875a,0x8751,0x875e,0x876d,0x876a,0x8750,0x874e,0x875f, -0x875d,0x876f,0x876c,0x877a,0x876e,0x875c,0x8765,0x874f, -0x877b,0x8775,0x8762,0x8767,0x8769,0x885a,0x8905,0x890c, -0x8914,0x890b,0x8917,0x8918,0x8919,0x8906,0x8916,0x8911, -0x890e,0x8909,0x89a2,0x89a4,0x89a3,0x89ed,0x89f0,0x89ec, -0x8acf,0x8ac6,0x8ab8,0x8ad3,0x8ad1,0x8ad4,0x8ad5,0x8abb, -0x8ad7,0x8abe,0x8ac0,0x8ac5,0x8ad8,0x8ac3,0x8aba,0x8abd, -0x8ad9,0x8c3e,0x8c4d,0x8c8f,0x8ce5,0x8cdf,0x8cd9,0x8ce8, -0x8cda,0x8cdd,0x8ce7,0x8da0,0x8d9c,0x8da1,0x8d9b,0x8e20, -0x8e23,0x8e25,0x8e24,0x8e2e,0x8e15,0x8e1b,0x8e16,0x8e11, -0x8e19,0x8e26,0x8e27,0x8e14,0x8e12,0x8e18,0x8e13,0x8e1c, -0x8e17,0x8e1a,0x8f2c,0x8f24,0x8f18,0x8f1a,0x8f20,0x8f23, -0x8f16,0x8f17,0x9073,0x9070,0x906f,0x9067,0x906b,0x912f, -0x912b,0x9129,0x912a,0x9132,0x9126,0x912e,0x9185,0x9186, -0x918a,0x9181,0x9182,0x9184,0x9180,0x92d0,0x92c3,0x92c4, -0x92c0,0x92d9,0x92b6,0x92cf,0x92f1,0x92df,0x92d8,0x92e9, -0x92d7,0x92dd,0x92cc,0x92ef,0x92c2,0x92e8,0x92ca,0x92c8, -0x92ce,0x92e6,0x92cd,0x92d5,0x92c9,0x92e0,0x92de,0x92e7, -0x92d1,0x92d3,0x92b5,0x92e1,0x92c6,0x92b4,0x957c,0x95ac, -0x95ab,0x95ae,0x95b0,0x96a4,0x96a2,0x96d3,0x9705,0x9708, -0x9702,0x975a,0x978a,0x978e,0x9788,0x97d0,0x97cf,0x981e, -0x981d,0x9826,0x9829,0x9828,0x9820,0x981b,0x9827,0x98b2, -0x9908,0x98fa,0x9911,0x9914,0x9916,0x9917,0x9915,0x99dc, -0x99cd,0x99cf,0x99d3,0x99d4,0x99ce,0x99c9,0x99d6,0x99d8, -0x99cb,0x99d7,0x99cc,0x9ab3,0x9aec,0x9aeb,0x9af3,0x9af2, -0x9af1,0x9b46,0x9b43,0x9b67,0x9b74,0x9b71,0x9b66,0x9b76, -0x9b75,0x9b70,0x9b68,0x9b64,0x9b6c,0x9cfc,0x9cfa,0x9cfd, -0x9cff,0x9cf7,0x9d07,0x9d00,0x9cf9,0x9cfb,0x9d08,0x9d05, -0x9d04,0x9e83,0x9ed3,0x9f0f,0x9f10,0x511c,0x5113,0x5117, -0x511a,0x5111,0x51de,0x5334,0x53e1,0x5670,0x5660,0x566e, -0x5673,0x5666,0x5663,0x566d,0x5672,0x565e,0x5677,0x571c, -0x571b,0x58c8,0x58bd,0x58c9,0x58bf,0x58ba,0x58c2,0x58bc, -0x58c6,0x5b17,0x5b19,0x5b1b,0x5b21,0x5b14,0x5b13,0x5b10, -0x5b16,0x5b28,0x5b1a,0x5b20,0x5b1e,0x5bef,0x5dac,0x5db1, -0x5da9,0x5da7,0x5db5,0x5db0,0x5dae,0x5daa,0x5da8,0x5db2, -0x5dad,0x5daf,0x5db4,0x5e67,0x5e68,0x5e66,0x5e6f,0x5ee9, -0x5ee7,0x5ee6,0x5ee8,0x5ee5,0x5f4b,0x5fbc,0x619d,0x61a8, -0x6196,0x61c5,0x61b4,0x61c6,0x61c1,0x61cc,0x61ba,0x61bf, -0x61b8,0x618c,0x64d7,0x64d6,0x64d0,0x64cf,0x64c9,0x64bd, -0x6489,0x64c3,0x64db,0x64f3,0x64d9,0x6533,0x657f,0x657c, -0x65a2,0x66c8,0x66be,0x66c0,0x66ca,0x66cb,0x66cf,0x66bd, -0x66bb,0x66ba,0x66cc,0x6723,0x6a34,0x6a66,0x6a49,0x6a67, -0x6a32,0x6a68,0x6a3e,0x6a5d,0x6a6d,0x6a76,0x6a5b,0x6a51, -0x6a28,0x6a5a,0x6a3b,0x6a3f,0x6a41,0x6a6a,0x6a64,0x6a50, -0x6a4f,0x6a54,0x6a6f,0x6a69,0x6a60,0x6a3c,0x6a5e,0x6a56, -0x6a55,0x6a4d,0x6a4e,0x6a46,0x6b55,0x6b54,0x6b56,0x6ba7, -0x6baa,0x6bab,0x6bc8,0x6bc7,0x6c04,0x6c03,0x6c06,0x6fad, -0x6fcb,0x6fa3,0x6fc7,0x6fbc,0x6fce,0x6fc8,0x6f5e,0x6fc4, -0x6fbd,0x6f9e,0x6fca,0x6fa8,0x7004,0x6fa5,0x6fae,0x6fba, -0x6fac,0x6faa,0x6fcf,0x6fbf,0x6fb8,0x6fa2,0x6fc9,0x6fab, -0x6fcd,0x6faf,0x6fb2,0x6fb0,0x71c5,0x71c2,0x71bf,0x71b8, -0x71d6,0x71c0,0x71c1,0x71cb,0x71d4,0x71ca,0x71c7,0x71cf, -0x71bd,0x71d8,0x71bc,0x71c6,0x71da,0x71db,0x729d,0x729e, -0x7369,0x7366,0x7367,0x736c,0x7365,0x736b,0x736a,0x747f, -0x749a,0x74a0,0x7494,0x7492,0x7495,0x74a1,0x750b,0x7580, -0x762f,0x762d,0x7631,0x763d,0x7633,0x763c,0x7635,0x7632, -0x7630,0x76bb,0x76e6,0x779a,0x779d,0x77a1,0x779c,0x779b, -0x77a2,0x77a3,0x7795,0x7799,0x7797,0x78dd,0x78e9,0x78e5, -0x78ea,0x78de,0x78e3,0x78db,0x78e1,0x78e2,0x78ed,0x78df, -0x78e0,0x79a4,0x7a44,0x7a48,0x7a47,0x7ab6,0x7ab8,0x7ab5, -0x7ab1,0x7ab7,0x7bde,0x7be3,0x7be7,0x7bdd,0x7bd5,0x7be5, -0x7bda,0x7be8,0x7bf9,0x7bd4,0x7bea,0x7be2,0x7bdc,0x7beb, -0x7bd8,0x7bdf,0x7cd2,0x7cd4,0x7cd7,0x7cd0,0x7cd1,0x7e12, -0x7e21,0x7e17,0x7e0c,0x7e1f,0x7e20,0x7e13,0x7e0e,0x7e1c, -0x7e15,0x7e1a,0x7e22,0x7e0b,0x7e0f,0x7e16,0x7e0d,0x7e14, -0x7e25,0x7e24,0x7f43,0x7f7b,0x7f7c,0x7f7a,0x7fb1,0x7fef, -0x802a,0x8029,0x806c,0x81b1,0x81a6,0x81ae,0x81b9,0x81b5, -0x81ab,0x81b0,0x81ac,0x81b4,0x81b2,0x81b7,0x81a7,0x81f2, -0x8255,0x8256,0x8257,0x8556,0x8545,0x856b,0x854d,0x8553, -0x8561,0x8558,0x8540,0x8546,0x8564,0x8541,0x8562,0x8544, -0x8551,0x8547,0x8563,0x853e,0x855b,0x8571,0x854e,0x856e, -0x8575,0x8555,0x8567,0x8560,0x858c,0x8566,0x855d,0x8554, -0x8565,0x856c,0x8663,0x8665,0x8664,0x879b,0x878f,0x8797, -0x8793,0x8792,0x8788,0x8781,0x8796,0x8798,0x8779,0x8787, -0x87a3,0x8785,0x8790,0x8791,0x879d,0x8784,0x8794,0x879c, -0x879a,0x8789,0x891e,0x8926,0x8930,0x892d,0x892e,0x8927, -0x8931,0x8922,0x8929,0x8923,0x892f,0x892c,0x891f,0x89f1, -0x8ae0,0x8ae2,0x8af2,0x8af4,0x8af5,0x8add,0x8b14,0x8ae4, -0x8adf,0x8af0,0x8ac8,0x8ade,0x8ae1,0x8ae8,0x8aff,0x8aef, -0x8afb,0x8c91,0x8c92,0x8c90,0x8cf5,0x8cee,0x8cf1,0x8cf0, -0x8cf3,0x8d6c,0x8d6e,0x8da5,0x8da7,0x8e33,0x8e3e,0x8e38, -0x8e40,0x8e45,0x8e36,0x8e3c,0x8e3d,0x8e41,0x8e30,0x8e3f, -0x8ebd,0x8f36,0x8f2e,0x8f35,0x8f32,0x8f39,0x8f37,0x8f34, -0x9076,0x9079,0x907b,0x9086,0x90fa,0x9133,0x9135,0x9136, -0x9193,0x9190,0x9191,0x918d,0x918f,0x9327,0x931e,0x9308, -0x931f,0x9306,0x930f,0x937a,0x9338,0x933c,0x931b,0x9323, -0x9312,0x9301,0x9346,0x932d,0x930e,0x930d,0x92cb,0x931d, -0x92fa,0x9325,0x9313,0x92f9,0x92f7,0x9334,0x9302,0x9324, -0x92ff,0x9329,0x9339,0x9335,0x932a,0x9314,0x930c,0x930b, -0x92fe,0x9309,0x9300,0x92fb,0x9316,0x95bc,0x95cd,0x95be, -0x95b9,0x95ba,0x95b6,0x95bf,0x95b5,0x95bd,0x96a9,0x96d4, -0x970b,0x9712,0x9710,0x9799,0x9797,0x9794,0x97f0,0x97f8, -0x9835,0x982f,0x9832,0x9924,0x991f,0x9927,0x9929,0x999e, -0x99ee,0x99ec,0x99e5,0x99e4,0x99f0,0x99e3,0x99ea,0x99e9, -0x99e7,0x9ab9,0x9abf,0x9ab4,0x9abb,0x9af6,0x9afa,0x9af9, -0x9af7,0x9b33,0x9b80,0x9b85,0x9b87,0x9b7c,0x9b7e,0x9b7b, -0x9b82,0x9b93,0x9b92,0x9b90,0x9b7a,0x9b95,0x9b7d,0x9b88, -0x9d25,0x9d17,0x9d20,0x9d1e,0x9d14,0x9d29,0x9d1d,0x9d18, -0x9d22,0x9d10,0x9d19,0x9d1f,0x9e88,0x9e86,0x9e87,0x9eae, -0x9ead,0x9ed5,0x9ed6,0x9efa,0x9f12,0x9f3d,0x5126,0x5125, -0x5122,0x5124,0x5120,0x5129,0x52f4,0x5693,0x568c,0x568d, -0x5686,0x5684,0x5683,0x567e,0x5682,0x567f,0x5681,0x58d6, -0x58d4,0x58cf,0x58d2,0x5b2d,0x5b25,0x5b32,0x5b23,0x5b2c, -0x5b27,0x5b26,0x5b2f,0x5b2e,0x5b7b,0x5bf1,0x5bf2,0x5db7, -0x5e6c,0x5e6a,0x5fbe,0x5fbb,0x61c3,0x61b5,0x61bc,0x61e7, -0x61e0,0x61e5,0x61e4,0x61e8,0x61de,0x64ef,0x64e9,0x64e3, -0x64eb,0x64e4,0x64e8,0x6581,0x6580,0x65b6,0x65da,0x66d2, -0x6a8d,0x6a96,0x6a81,0x6aa5,0x6a89,0x6a9f,0x6a9b,0x6aa1, -0x6a9e,0x6a87,0x6a93,0x6a8e,0x6a95,0x6a83,0x6aa8,0x6aa4, -0x6a91,0x6a7f,0x6aa6,0x6a9a,0x6a85,0x6a8c,0x6a92,0x6b5b, -0x6bad,0x6c09,0x6fcc,0x6fa9,0x6ff4,0x6fd4,0x6fe3,0x6fdc, -0x6fed,0x6fe7,0x6fe6,0x6fde,0x6ff2,0x6fdd,0x6fe2,0x6fe8, -0x71e1,0x71f1,0x71e8,0x71f2,0x71e4,0x71f0,0x71e2,0x7373, -0x736e,0x736f,0x7497,0x74b2,0x74ab,0x7490,0x74aa,0x74ad, -0x74b1,0x74a5,0x74af,0x7510,0x7511,0x7512,0x750f,0x7584, -0x7643,0x7648,0x7649,0x7647,0x76a4,0x76e9,0x77b5,0x77ab, -0x77b2,0x77b7,0x77b6,0x77b4,0x77b1,0x77a8,0x77f0,0x78f3, -0x78fd,0x7902,0x78fb,0x78fc,0x78f2,0x7905,0x78f9,0x78fe, -0x7904,0x79ab,0x79a8,0x7a5c,0x7a5b,0x7a56,0x7a58,0x7a54, -0x7a5a,0x7abe,0x7ac0,0x7ac1,0x7c05,0x7c0f,0x7bf2,0x7c00, -0x7bff,0x7bfb,0x7c0e,0x7bf4,0x7c0b,0x7bf3,0x7c02,0x7c09, -0x7c03,0x7c01,0x7bf8,0x7bfd,0x7c06,0x7bf0,0x7bf1,0x7c10, -0x7c0a,0x7ce8,0x7e2d,0x7e3c,0x7e42,0x7e33,0x9848,0x7e38, -0x7e2a,0x7e49,0x7e40,0x7e47,0x7e29,0x7e4c,0x7e30,0x7e3b, -0x7e36,0x7e44,0x7e3a,0x7f45,0x7f7f,0x7f7e,0x7f7d,0x7ff4, -0x7ff2,0x802c,0x81bb,0x81c4,0x81cc,0x81ca,0x81c5,0x81c7, -0x81bc,0x81e9,0x825b,0x825a,0x825c,0x8583,0x8580,0x858f, -0x85a7,0x8595,0x85a0,0x858b,0x85a3,0x857b,0x85a4,0x859a, -0x859e,0x8577,0x857c,0x8589,0x85a1,0x857a,0x8578,0x8557, -0x858e,0x8596,0x8586,0x858d,0x8599,0x859d,0x8581,0x85a2, -0x8582,0x8588,0x8585,0x8579,0x8576,0x8598,0x8590,0x859f, -0x8668,0x87be,0x87aa,0x87ad,0x87c5,0x87b0,0x87ac,0x87b9, -0x87b5,0x87bc,0x87ae,0x87c9,0x87c3,0x87c2,0x87cc,0x87b7, -0x87af,0x87c4,0x87ca,0x87b4,0x87b6,0x87bf,0x87b8,0x87bd, -0x87de,0x87b2,0x8935,0x8933,0x893c,0x893e,0x8941,0x8952, -0x8937,0x8942,0x89ad,0x89af,0x89ae,0x89f2,0x89f3,0x8b1e, -0x8b18,0x8b16,0x8b11,0x8b05,0x8b0b,0x8b22,0x8b0f,0x8b12, -0x8b15,0x8b07,0x8b0d,0x8b08,0x8b06,0x8b1c,0x8b13,0x8b1a, -0x8c4f,0x8c70,0x8c72,0x8c71,0x8c6f,0x8c95,0x8c94,0x8cf9, -0x8d6f,0x8e4e,0x8e4d,0x8e53,0x8e50,0x8e4c,0x8e47,0x8f43, -0x8f40,0x9085,0x907e,0x9138,0x919a,0x91a2,0x919b,0x9199, -0x919f,0x91a1,0x919d,0x91a0,0x93a1,0x9383,0x93af,0x9364, -0x9356,0x9347,0x937c,0x9358,0x935c,0x9376,0x9349,0x9350, -0x9351,0x9360,0x936d,0x938f,0x934c,0x936a,0x9379,0x9357, -0x9355,0x9352,0x934f,0x9371,0x9377,0x937b,0x9361,0x935e, -0x9363,0x9367,0x9380,0x934e,0x9359,0x95c7,0x95c0,0x95c9, -0x95c3,0x95c5,0x95b7,0x96ae,0x96b0,0x96ac,0x9720,0x971f, -0x9718,0x971d,0x9719,0x979a,0x97a1,0x979c,0x979e,0x979d, -0x97d5,0x97d4,0x97f1,0x9841,0x9844,0x984a,0x9849,0x9845, -0x9843,0x9925,0x992b,0x992c,0x992a,0x9933,0x9932,0x992f, -0x992d,0x9931,0x9930,0x9998,0x99a3,0x99a1,0x9a02,0x99fa, -0x99f4,0x99f7,0x99f9,0x99f8,0x99f6,0x99fb,0x99fd,0x99fe, -0x99fc,0x9a03,0x9abe,0x9afe,0x9afd,0x9b01,0x9afc,0x9b48, -0x9b9a,0x9ba8,0x9b9e,0x9b9b,0x9ba6,0x9ba1,0x9ba5,0x9ba4, -0x9b86,0x9ba2,0x9ba0,0x9baf,0x9d33,0x9d41,0x9d67,0x9d36, -0x9d2e,0x9d2f,0x9d31,0x9d38,0x9d30,0x9d45,0x9d42,0x9d43, -0x9d3e,0x9d37,0x9d40,0x9d3d,0x7ff5,0x9d2d,0x9e8a,0x9e89, -0x9e8d,0x9eb0,0x9ec8,0x9eda,0x9efb,0x9eff,0x9f24,0x9f23, -0x9f22,0x9f54,0x9fa0,0x5131,0x512d,0x512e,0x5698,0x569c, -0x5697,0x569a,0x569d,0x5699,0x5970,0x5b3c,0x5c69,0x5c6a, -0x5dc0,0x5e6d,0x5e6e,0x61d8,0x61df,0x61ed,0x61ee,0x61f1, -0x61ea,0x61f0,0x61eb,0x61d6,0x61e9,0x64ff,0x6504,0x64fd, -0x64f8,0x6501,0x6503,0x64fc,0x6594,0x65db,0x66da,0x66db, -0x66d8,0x6ac5,0x6ab9,0x6abd,0x6ae1,0x6ac6,0x6aba,0x6ab6, -0x6ab7,0x6ac7,0x6ab4,0x6aad,0x6b5e,0x6bc9,0x6c0b,0x7007, -0x700c,0x700d,0x7001,0x7005,0x7014,0x700e,0x6fff,0x7000, -0x6ffb,0x7026,0x6ffc,0x6ff7,0x700a,0x7201,0x71ff,0x71f9, -0x7203,0x71fd,0x7376,0x74b8,0x74c0,0x74b5,0x74c1,0x74be, -0x74b6,0x74bb,0x74c2,0x7514,0x7513,0x765c,0x7664,0x7659, -0x7650,0x7653,0x7657,0x765a,0x76a6,0x76bd,0x76ec,0x77c2, -0x77ba,0x78ff,0x790c,0x7913,0x7914,0x7909,0x7910,0x7912, -0x7911,0x79ad,0x79ac,0x7a5f,0x7c1c,0x7c29,0x7c19,0x7c20, -0x7c1f,0x7c2d,0x7c1d,0x7c26,0x7c28,0x7c22,0x7c25,0x7c30, -0x7e5c,0x7e50,0x7e56,0x7e63,0x7e58,0x7e62,0x7e5f,0x7e51, -0x7e60,0x7e57,0x7e53,0x7fb5,0x7fb3,0x7ff7,0x7ff8,0x8075, -0x81d1,0x81d2,0x81d0,0x825f,0x825e,0x85b4,0x85c6,0x85c0, -0x85c3,0x85c2,0x85b3,0x85b5,0x85bd,0x85c7,0x85c4,0x85bf, -0x85cb,0x85ce,0x85c8,0x85c5,0x85b1,0x85b6,0x85d2,0x8624, -0x85b8,0x85b7,0x85be,0x8669,0x87e7,0x87e6,0x87e2,0x87db, -0x87eb,0x87ea,0x87e5,0x87df,0x87f3,0x87e4,0x87d4,0x87dc, -0x87d3,0x87ed,0x87d8,0x87e3,0x87a4,0x87d7,0x87d9,0x8801, -0x87f4,0x87e8,0x87dd,0x8953,0x894b,0x894f,0x894c,0x8946, -0x8950,0x8951,0x8949,0x8b2a,0x8b27,0x8b23,0x8b33,0x8b30, -0x8b35,0x8b47,0x8b2f,0x8b3c,0x8b3e,0x8b31,0x8b25,0x8b37, -0x8b26,0x8b36,0x8b2e,0x8b24,0x8b3b,0x8b3d,0x8b3a,0x8c42, -0x8c75,0x8c99,0x8c98,0x8c97,0x8cfe,0x8d04,0x8d02,0x8d00, -0x8e5c,0x8e62,0x8e60,0x8e57,0x8e56,0x8e5e,0x8e65,0x8e67, -0x8e5b,0x8e5a,0x8e61,0x8e5d,0x8e69,0x8e54,0x8f46,0x8f47, -0x8f48,0x8f4b,0x9128,0x913a,0x913b,0x913e,0x91a8,0x91a5, -0x91a7,0x91af,0x91aa,0x93b5,0x938c,0x9392,0x93b7,0x939b, -0x939d,0x9389,0x93a7,0x938e,0x93aa,0x939e,0x93a6,0x9395, -0x9388,0x9399,0x939f,0x938d,0x93b1,0x9391,0x93b2,0x93a4, -0x93a8,0x93b4,0x93a3,0x93a5,0x95d2,0x95d3,0x95d1,0x96b3, -0x96d7,0x96da,0x5dc2,0x96df,0x96d8,0x96dd,0x9723,0x9722, -0x9725,0x97ac,0x97ae,0x97a8,0x97ab,0x97a4,0x97aa,0x97a2, -0x97a5,0x97d7,0x97d9,0x97d6,0x97d8,0x97fa,0x9850,0x9851, -0x9852,0x98b8,0x9941,0x993c,0x993a,0x9a0f,0x9a0b,0x9a09, -0x9a0d,0x9a04,0x9a11,0x9a0a,0x9a05,0x9a07,0x9a06,0x9ac0, -0x9adc,0x9b08,0x9b04,0x9b05,0x9b29,0x9b35,0x9b4a,0x9b4c, -0x9b4b,0x9bc7,0x9bc6,0x9bc3,0x9bbf,0x9bc1,0x9bb5,0x9bb8, -0x9bd3,0x9bb6,0x9bc4,0x9bb9,0x9bbd,0x9d5c,0x9d53,0x9d4f, -0x9d4a,0x9d5b,0x9d4b,0x9d59,0x9d56,0x9d4c,0x9d57,0x9d52, -0x9d54,0x9d5f,0x9d58,0x9d5a,0x9e8e,0x9e8c,0x9edf,0x9f01, -0x9f00,0x9f16,0x9f25,0x9f2b,0x9f2a,0x9f29,0x9f28,0x9f4c, -0x9f55,0x5134,0x5135,0x5296,0x52f7,0x53b4,0x56ab,0x56ad, -0x56a6,0x56a7,0x56aa,0x56ac,0x58da,0x58dd,0x58db,0x5912, -0x5b3d,0x5b3e,0x5b3f,0x5dc3,0x5e70,0x5fbf,0x61fb,0x6507, -0x6510,0x650d,0x6509,0x650c,0x650e,0x6584,0x65de,0x65dd, -0x66de,0x6ae7,0x6ae0,0x6acc,0x6ad1,0x6ad9,0x6acb,0x6adf, -0x6adc,0x6ad0,0x6aeb,0x6acf,0x6acd,0x6ade,0x6b60,0x6bb0, -0x6c0c,0x7019,0x7027,0x7020,0x7016,0x702b,0x7021,0x7022, -0x7023,0x7029,0x7017,0x7024,0x701c,0x702a,0x720c,0x720a, -0x7207,0x7202,0x7205,0x72a5,0x72a6,0x72a4,0x72a3,0x72a1, -0x74cb,0x74c5,0x74b7,0x74c3,0x7516,0x7660,0x77c9,0x77ca, -0x77c4,0x77f1,0x791d,0x791b,0x7921,0x791c,0x7917,0x791e, -0x79b0,0x7a67,0x7a68,0x7c33,0x7c3c,0x7c39,0x7c2c,0x7c3b, -0x7cec,0x7cea,0x7e76,0x7e75,0x7e78,0x7e70,0x7e77,0x7e6f, -0x7e7a,0x7e72,0x7e74,0x7e68,0x7f4b,0x7f4a,0x7f83,0x7f86, -0x7fb7,0x7ffd,0x7ffe,0x8078,0x81d7,0x81d5,0x8264,0x8261, -0x8263,0x85eb,0x85f1,0x85ed,0x85d9,0x85e1,0x85e8,0x85da, -0x85d7,0x85ec,0x85f2,0x85f8,0x85d8,0x85df,0x85e3,0x85dc, -0x85d1,0x85f0,0x85e6,0x85ef,0x85de,0x85e2,0x8800,0x87fa, -0x8803,0x87f6,0x87f7,0x8809,0x880c,0x880b,0x8806,0x87fc, -0x8808,0x87ff,0x880a,0x8802,0x8962,0x895a,0x895b,0x8957, -0x8961,0x895c,0x8958,0x895d,0x8959,0x8988,0x89b7,0x89b6, -0x89f6,0x8b50,0x8b48,0x8b4a,0x8b40,0x8b53,0x8b56,0x8b54, -0x8b4b,0x8b55,0x8b51,0x8b42,0x8b52,0x8b57,0x8c43,0x8c77, -0x8c76,0x8c9a,0x8d06,0x8d07,0x8d09,0x8dac,0x8daa,0x8dad, -0x8dab,0x8e6d,0x8e78,0x8e73,0x8e6a,0x8e6f,0x8e7b,0x8ec2, -0x8f52,0x8f51,0x8f4f,0x8f50,0x8f53,0x8fb4,0x9140,0x913f, -0x91b0,0x91ad,0x93de,0x93c7,0x93cf,0x93c2,0x93da,0x93d0, -0x93f9,0x93ec,0x93cc,0x93d9,0x93a9,0x93e6,0x93ca,0x93d4, -0x93ee,0x93e3,0x93d5,0x93c4,0x93ce,0x93c0,0x93d2,0x93e7, -0x957d,0x95da,0x95db,0x96e1,0x9729,0x972b,0x972c,0x9728, -0x9726,0x97b3,0x97b7,0x97b6,0x97dd,0x97de,0x97df,0x985c, -0x9859,0x985d,0x9857,0x98bf,0x98bd,0x98bb,0x98be,0x9948, -0x9947,0x9943,0x99a6,0x99a7,0x9a1a,0x9a15,0x9a25,0x9a1d, -0x9a24,0x9a1b,0x9a22,0x9a20,0x9a27,0x9a23,0x9a1e,0x9a1c, -0x9a14,0x9ac2,0x9b0b,0x9b0a,0x9b0e,0x9b0c,0x9b37,0x9bea, -0x9beb,0x9be0,0x9bde,0x9be4,0x9be6,0x9be2,0x9bf0,0x9bd4, -0x9bd7,0x9bec,0x9bdc,0x9bd9,0x9be5,0x9bd5,0x9be1,0x9bda, -0x9d77,0x9d81,0x9d8a,0x9d84,0x9d88,0x9d71,0x9d80,0x9d78, -0x9d86,0x9d8b,0x9d8c,0x9d7d,0x9d6b,0x9d74,0x9d75,0x9d70, -0x9d69,0x9d85,0x9d73,0x9d7b,0x9d82,0x9d6f,0x9d79,0x9d7f, -0x9d87,0x9d68,0x9e94,0x9e91,0x9ec0,0x9efc,0x9f2d,0x9f40, -0x9f41,0x9f4d,0x9f56,0x9f57,0x9f58,0x5337,0x56b2,0x56b5, -0x56b3,0x58e3,0x5b45,0x5dc6,0x5dc7,0x5eee,0x5eef,0x5fc0, -0x5fc1,0x61f9,0x6517,0x6516,0x6515,0x6513,0x65df,0x66e8, -0x66e3,0x66e4,0x6af3,0x6af0,0x6aea,0x6ae8,0x6af9,0x6af1, -0x6aee,0x6aef,0x703c,0x7035,0x702f,0x7037,0x7034,0x7031, -0x7042,0x7038,0x703f,0x703a,0x7039,0x7040,0x703b,0x7033, -0x7041,0x7213,0x7214,0x72a8,0x737d,0x737c,0x74ba,0x76ab, -0x76aa,0x76be,0x76ed,0x77cc,0x77ce,0x77cf,0x77cd,0x77f2, -0x7925,0x7923,0x7927,0x7928,0x7924,0x7929,0x79b2,0x7a6e, -0x7a6c,0x7a6d,0x7af7,0x7c49,0x7c48,0x7c4a,0x7c47,0x7c45, -0x7cee,0x7e7b,0x7e7e,0x7e81,0x7e80,0x7fba,0x7fff,0x8079, -0x81db,0x81d9,0x820b,0x8268,0x8269,0x8622,0x85ff,0x8601, -0x85fe,0x861b,0x8600,0x85f6,0x8604,0x8609,0x8605,0x860c, -0x85fd,0x8819,0x8810,0x8811,0x8817,0x8813,0x8816,0x8963, -0x8966,0x89b9,0x89f7,0x8b60,0x8b6a,0x8b5d,0x8b68,0x8b63, -0x8b65,0x8b67,0x8b6d,0x8dae,0x8e86,0x8e88,0x8e84,0x8f59, -0x8f56,0x8f57,0x8f55,0x8f58,0x8f5a,0x908d,0x9143,0x9141, -0x91b7,0x91b5,0x91b2,0x91b3,0x940b,0x9413,0x93fb,0x9420, -0x940f,0x9414,0x93fe,0x9415,0x9410,0x9428,0x9419,0x940d, -0x93f5,0x9400,0x93f7,0x9407,0x940e,0x9416,0x9412,0x93fa, -0x9409,0x93f8,0x940a,0x93ff,0x93fc,0x940c,0x93f6,0x9411, -0x9406,0x95de,0x95e0,0x95df,0x972e,0x972f,0x97b9,0x97bb, -0x97fd,0x97fe,0x9860,0x9862,0x9863,0x985f,0x98c1,0x98c2, -0x9950,0x994e,0x9959,0x994c,0x994b,0x9953,0x9a32,0x9a34, -0x9a31,0x9a2c,0x9a2a,0x9a36,0x9a29,0x9a2e,0x9a38,0x9a2d, -0x9ac7,0x9aca,0x9ac6,0x9b10,0x9b12,0x9b11,0x9c0b,0x9c08, -0x9bf7,0x9c05,0x9c12,0x9bf8,0x9c40,0x9c07,0x9c0e,0x9c06, -0x9c17,0x9c14,0x9c09,0x9d9f,0x9d99,0x9da4,0x9d9d,0x9d92, -0x9d98,0x9d90,0x9d9b,0x9da0,0x9d94,0x9d9c,0x9daa,0x9d97, -0x9da1,0x9d9a,0x9da2,0x9da8,0x9d9e,0x9da3,0x9dbf,0x9da9, -0x9d96,0x9da6,0x9da7,0x9e99,0x9e9b,0x9e9a,0x9ee5,0x9ee4, -0x9ee7,0x9ee6,0x9f30,0x9f2e,0x9f5b,0x9f60,0x9f5e,0x9f5d, -0x9f59,0x9f91,0x513a,0x5139,0x5298,0x5297,0x56c3,0x56bd, -0x56be,0x5b48,0x5b47,0x5dcb,0x5dcf,0x5ef1,0x61fd,0x651b, -0x6b02,0x6afc,0x6b03,0x6af8,0x6b00,0x7043,0x7044,0x704a, -0x7048,0x7049,0x7045,0x7046,0x721d,0x721a,0x7219,0x737e, -0x7517,0x766a,0x77d0,0x792d,0x7931,0x792f,0x7c54,0x7c53, -0x7cf2,0x7e8a,0x7e87,0x7e88,0x7e8b,0x7e86,0x7e8d,0x7f4d, -0x7fbb,0x8030,0x81dd,0x8618,0x862a,0x8626,0x861f,0x8623, -0x861c,0x8619,0x8627,0x862e,0x8621,0x8620,0x8629,0x861e, -0x8625,0x8829,0x881d,0x881b,0x8820,0x8824,0x881c,0x882b, -0x884a,0x896d,0x8969,0x896e,0x896b,0x89fa,0x8b79,0x8b78, -0x8b45,0x8b7a,0x8b7b,0x8d10,0x8d14,0x8daf,0x8e8e,0x8e8c, -0x8f5e,0x8f5b,0x8f5d,0x9146,0x9144,0x9145,0x91b9,0x943f, -0x943b,0x9436,0x9429,0x943d,0x943c,0x9430,0x9439,0x942a, -0x9437,0x942c,0x9440,0x9431,0x95e5,0x95e4,0x95e3,0x9735, -0x973a,0x97bf,0x97e1,0x9864,0x98c9,0x98c6,0x98c0,0x9958, -0x9956,0x9a39,0x9a3d,0x9a46,0x9a44,0x9a42,0x9a41,0x9a3a, -0x9a3f,0x9acd,0x9b15,0x9b17,0x9b18,0x9b16,0x9b3a,0x9b52, -0x9c2b,0x9c1d,0x9c1c,0x9c2c,0x9c23,0x9c28,0x9c29,0x9c24, -0x9c21,0x9db7,0x9db6,0x9dbc,0x9dc1,0x9dc7,0x9dca,0x9dcf, -0x9dbe,0x9dc5,0x9dc3,0x9dbb,0x9db5,0x9dce,0x9db9,0x9dba, -0x9dac,0x9dc8,0x9db1,0x9dad,0x9dcc,0x9db3,0x9dcd,0x9db2, -0x9e7a,0x9e9c,0x9eeb,0x9eee,0x9eed,0x9f1b,0x9f18,0x9f1a, -0x9f31,0x9f4e,0x9f65,0x9f64,0x9f92,0x4eb9,0x56c6,0x56c5, -0x56cb,0x5971,0x5b4b,0x5b4c,0x5dd5,0x5dd1,0x5ef2,0x6521, -0x6520,0x6526,0x6522,0x6b0b,0x6b08,0x6b09,0x6c0d,0x7055, -0x7056,0x7057,0x7052,0x721e,0x721f,0x72a9,0x737f,0x74d8, -0x74d5,0x74d9,0x74d7,0x766d,0x76ad,0x7935,0x79b4,0x7a70, -0x7a71,0x7c57,0x7c5c,0x7c59,0x7c5b,0x7c5a,0x7cf4,0x7cf1, -0x7e91,0x7f4f,0x7f87,0x81de,0x826b,0x8634,0x8635,0x8633, -0x862c,0x8632,0x8636,0x882c,0x8828,0x8826,0x882a,0x8825, -0x8971,0x89bf,0x89be,0x89fb,0x8b7e,0x8b84,0x8b82,0x8b86, -0x8b85,0x8b7f,0x8d15,0x8e95,0x8e94,0x8e9a,0x8e92,0x8e90, -0x8e96,0x8e97,0x8f60,0x8f62,0x9147,0x944c,0x9450,0x944a, -0x944b,0x944f,0x9447,0x9445,0x9448,0x9449,0x9446,0x973f, -0x97e3,0x986a,0x9869,0x98cb,0x9954,0x995b,0x9a4e,0x9a53, -0x9a54,0x9a4c,0x9a4f,0x9a48,0x9a4a,0x9a49,0x9a52,0x9a50, -0x9ad0,0x9b19,0x9b2b,0x9b3b,0x9b56,0x9b55,0x9c46,0x9c48, -0x9c3f,0x9c44,0x9c39,0x9c33,0x9c41,0x9c3c,0x9c37,0x9c34, -0x9c32,0x9c3d,0x9c36,0x9ddb,0x9dd2,0x9dde,0x9dda,0x9dcb, -0x9dd0,0x9ddc,0x9dd1,0x9ddf,0x9de9,0x9dd9,0x9dd8,0x9dd6, -0x9df5,0x9dd5,0x9ddd,0x9eb6,0x9ef0,0x9f35,0x9f33,0x9f32, -0x9f42,0x9f6b,0x9f95,0x9fa2,0x513d,0x5299,0x58e8,0x58e7, -0x5972,0x5b4d,0x5dd8,0x882f,0x5f4f,0x6201,0x6203,0x6204, -0x6529,0x6525,0x6596,0x66eb,0x6b11,0x6b12,0x6b0f,0x6bca, -0x705b,0x705a,0x7222,0x7382,0x7381,0x7383,0x7670,0x77d4, -0x7c67,0x7c66,0x7e95,0x826c,0x863a,0x8640,0x8639,0x863c, -0x8631,0x863b,0x863e,0x8830,0x8832,0x882e,0x8833,0x8976, -0x8974,0x8973,0x89fe,0x8b8c,0x8b8e,0x8b8b,0x8b88,0x8c45, -0x8d19,0x8e98,0x8f64,0x8f63,0x91bc,0x9462,0x9455,0x945d, -0x9457,0x945e,0x97c4,0x97c5,0x9800,0x9a56,0x9a59,0x9b1e, -0x9b1f,0x9b20,0x9c52,0x9c58,0x9c50,0x9c4a,0x9c4d,0x9c4b, -0x9c55,0x9c59,0x9c4c,0x9c4e,0x9dfb,0x9df7,0x9def,0x9de3, -0x9deb,0x9df8,0x9de4,0x9df6,0x9de1,0x9dee,0x9de6,0x9df2, -0x9df0,0x9de2,0x9dec,0x9df4,0x9df3,0x9de8,0x9ded,0x9ec2, -0x9ed0,0x9ef2,0x9ef3,0x9f06,0x9f1c,0x9f38,0x9f37,0x9f36, -0x9f43,0x9f4f,0x9f71,0x9f70,0x9f6e,0x9f6f,0x56d3,0x56cd, -0x5b4e,0x5c6d,0x652d,0x66ed,0x66ee,0x6b13,0x705f,0x7061, -0x705d,0x7060,0x7223,0x74db,0x74e5,0x77d5,0x7938,0x79b7, -0x79b6,0x7c6a,0x7e97,0x7f89,0x826d,0x8643,0x8838,0x8837, -0x8835,0x884b,0x8b94,0x8b95,0x8e9e,0x8e9f,0x8ea0,0x8e9d, -0x91be,0x91bd,0x91c2,0x946b,0x9468,0x9469,0x96e5,0x9746, -0x9743,0x9747,0x97c7,0x97e5,0x9a5e,0x9ad5,0x9b59,0x9c63, -0x9c67,0x9c66,0x9c62,0x9c5e,0x9c60,0x9e02,0x9dfe,0x9e07, -0x9e03,0x9e06,0x9e05,0x9e00,0x9e01,0x9e09,0x9dff,0x9dfd, -0x9e04,0x9ea0,0x9f1e,0x9f46,0x9f74,0x9f75,0x9f76,0x56d4, -0x652e,0x65b8,0x6b18,0x6b19,0x6b17,0x6b1a,0x7062,0x7226, -0x72aa,0x77d8,0x77d9,0x7939,0x7c69,0x7c6b,0x7cf6,0x7e9a, -0x7e98,0x7e9b,0x7e99,0x81e0,0x81e1,0x8646,0x8647,0x8648, -0x8979,0x897a,0x897c,0x897b,0x89ff,0x8b98,0x8b99,0x8ea5, -0x8ea4,0x8ea3,0x946e,0x946d,0x946f,0x9471,0x9473,0x9749, -0x9872,0x995f,0x9c68,0x9c6e,0x9c6d,0x9e0b,0x9e0d,0x9e10, -0x9e0f,0x9e12,0x9e11,0x9ea1,0x9ef5,0x9f09,0x9f47,0x9f78, -0x9f7b,0x9f7a,0x9f79,0x571e,0x7066,0x7c6f,0x883c,0x8db2, -0x8ea6,0x91c3,0x9474,0x9478,0x9476,0x9475,0x9a60,0x9c74, -0x9c73,0x9c71,0x9c75,0x9e14,0x9e13,0x9ef6,0x9f0a,0x9fa4, -0x7068,0x7065,0x7cf7,0x866a,0x883e,0x883d,0x883f,0x8b9e, -0x8c9c,0x8ea9,0x8ec9,0x974b,0x9873,0x9874,0x98cc,0x9961, -0x99ab,0x9a64,0x9a66,0x9a67,0x9b24,0x9e15,0x9e17,0x9f48, -0x6207,0x6b1e,0x7227,0x864c,0x8ea8,0x9482,0x9480,0x9481, -0x9a69,0x9a68,0x9b2e,0x9e19,0x7229,0x864b,0x8b9f,0x9483, -0x9c79,0x9eb7,0x7675,0x9a6b,0x9c7a,0x9e1d,0x7069,0x706a, -0x9ea4,0x9f7e,0x9f49,0x9f98,0x7881,0x92b9,0x88cf,0x58bb, -0x6052,0x7ca7,0x5afa,0x2554,0x2566,0x2557,0x2560,0x256c, -0x2563,0x255a,0x2569,0x255d,0x2552,0x2564,0x2555,0x255e, -0x256a,0x2561,0x2558,0x2567,0x255b,0x2553,0x2565,0x2556, -0x255f,0x256b,0x2562,0x2559,0x2568,0x255c,0x2551,0x2550, -0x256d,0x256e,0x2570,0x256f,0x2593}; - -static const int big5_ucs_table_size = sizeof(big5_ucs_table)/sizeof(unsigned short); - -/* UCS -> Big5 */ -static const unsigned short ucs_a1_big5_table[] = { -/* 0x0000 */ -0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, -0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f, -0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, -0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f, -0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, -0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f, -0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, -0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f, -0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, -0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f, -0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, -0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f, -0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, -0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f, -0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, -0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f, -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,0x0000,0x0000,0x0000,0x0000,0xa1b1, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1c2, -0xa258,0xa1d3,0x0000,0x0000,0x0000,0x0000,0x0000,0xa150, -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,0xa1d1, -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,0xa1d2, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -/* 0x0100 */ -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,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,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,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,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,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,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,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -/* 0x0200 */ -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,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,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,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,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,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa3be, -0x0000,0xa3bc,0xa3bd,0xa3bf,0x0000,0xa1c5,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xa3bb,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,0x0000,0x0000,0x0000, -/* 0x0300 */ -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,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,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,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,0x0000,0x0000,0x0000,0x0000, -0x0000,0xa344,0xa345,0xa346,0xa347,0xa348,0xa349,0xa34a, -0xa34b,0xa34c,0xa34d,0xa34e,0xa34f,0xa350,0xa351,0xa352, -0xa353,0xa354,0x0000,0xa355,0xa356,0xa357,0xa358,0xa359, -0xa35a,0xa35b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xa35c,0xa35d,0xa35e,0xa35f,0xa360,0xa361,0xa362, -0xa363,0xa364,0xa365,0xa366,0xa367,0xa368,0xa369,0xa36a, -0xa36b,0xa36c,0x0000,0xa36d,0xa36e,0xa36f,0xa370,0xa371, -0xa372,0xa373}; - -static const int ucs_a1_big5_table_min = 0x0000; -static const int ucs_a1_big5_table_max = 0x0000 + (sizeof (ucs_a1_big5_table) / sizeof (unsigned short)); - - -static const unsigned short ucs_a2_big5_table[] = { -/* 0x2000 */ -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xa156,0xa158,0x0000,0x0000,0x0000, -0xa1a5,0xa1a6,0x0000,0x0000,0xa1a7,0xa1a8,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xa14c,0xa14b,0xa145, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xa1ac,0x0000,0x0000,0xa1ab,0x0000,0x0000, -0x0000,0x0000,0x0000,0xa1b0,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,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,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,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xa3e1,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, -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,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -/* 0x2100 */ -0x0000,0x0000,0x0000,0xa24a,0x0000,0xa1c1,0x0000,0x0000, -0x0000,0xa24b,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,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, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xa2b9,0xa2ba,0xa2bb,0xa2bc,0xa2bd,0xa2be,0xa2bf,0xa2c0, -0xa2c1,0xa2c2,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,0x0000,0x0000,0x0000, -0xa1f6,0xa1f4,0xa1f7,0xa1f5,0x0000,0x0000,0xa1f8,0xa1f9, -0xa1fb,0xa1fa,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,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, -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, -/* 0x2200 */ -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xa241,0x0000,0x0000, -0x0000,0x0000,0xa1d4,0x0000,0x0000,0x0000,0xa1db,0xa1e8, -0xa1e7,0x0000,0x0000,0xa1fd,0x0000,0xa1fc,0x0000,0x0000, -0x0000,0xa1e4,0xa1e5,0xa1ec,0x0000,0x0000,0xa1ed,0x0000, -0x0000,0x0000,0x0000,0x0000,0xa1ef,0xa1ee,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,0xa1dc,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xa1da,0xa1dd,0x0000,0x0000,0x0000,0x0000,0xa1d8,0xa1d9, -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,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xa1f2,0x0000,0x0000, -0x0000,0xa1f3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xa1e6,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,0xa1e9, -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,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, -/* 0x2300 */ -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,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,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,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,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,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,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,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -/* 0x2400 */ -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,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,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,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,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,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,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,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xa277,0x0000,0xa278,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xa27a,0x0000,0x0000,0x0000, -0xa27b,0x0000,0x0000,0x0000,0xa27c,0x0000,0x0000,0x0000, -0xa27d,0x0000,0x0000,0x0000,0xa275,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xa274,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xa273,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xa272,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xa271,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xf9f9,0xf9f8,0xf9e6,0xf9ef,0xf9dd,0xf9e8,0xf9f1,0xf9df, -0xf9ec,0xf9f5,0xf9e3,0xf9ee,0xf9f7,0xf9e5,0xf9e9,0xf9f2, -0xf9e0,0xf9eb,0xf9f4,0xf9e2,0xf9e7,0xf9f0,0xf9de,0xf9ed, -0xf9f6,0xf9e4,0xf9ea,0xf9f3,0xf9e1,0xf9fa,0xf9fb,0xf9fd, -0xf9fc,0xa2ac,0xa2ad,0xa2ae,0xa15a,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xa262,0xa263,0xa264,0xa265,0xa266,0xa267,0xa268, -0xa269,0xa270,0xa26f,0xa26e,0xa26d,0xa26c,0xa26b,0xa26a, -0x0000,0x0000,0x0000,0xf9fe,0xa276,0xa279,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xa1bd,0xa1bc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xa1b6,0xa1b5,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xa1bf,0xa1be,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa1bb,0xa1ba, -0x0000,0x0000,0x0000,0xa1b3,0x0000,0x0000,0xa1b7,0xa1b4, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xa2a8,0xa2a9,0xa2ab,0xa2aa,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, -/* 0x2600 */ -0x0000,0x0000,0x0000,0x0000,0x0000,0xa1b9,0xa1b8,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,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xa1f0,0x0000,0xa1f1}; - -static const int ucs_a2_big5_table_min = 0x2000; -static const int ucs_a2_big5_table_max = 0x2000 + (sizeof (ucs_a2_big5_table) / sizeof (unsigned short)); - - -static const unsigned short ucs_a3_big5_table[] = { -/* 0x2f00 */ -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,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,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,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,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,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,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,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xa140,0xa142,0xa143,0xa1b2,0x0000,0x0000,0x0000,0x0000, -0xa171,0xa172,0xa16d,0xa16e,0xa175,0xa176,0xa179,0xa17a, -0xa169,0xa16a,0xa245,0x0000,0xa165,0xa166,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xa1a9,0xa1aa,0x0000, -0x0000,0xa2c3,0xa2c4,0xa2c5,0xa2c6,0xa2c7,0xa2c8,0xa2c9, -0xa2ca,0xa2cb,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,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, -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,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,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,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,0x0000,0x0000,0x0000,0x0000, -/* 0x3100 */ -0x0000,0x0000,0x0000,0x0000,0x0000,0xa374,0xa375,0xa376, -0xa377,0xa378,0xa379,0xa37a,0xa37b,0xa37c,0xa37d,0xa37e, -0xa3a1,0xa3a2,0xa3a3,0xa3a4,0xa3a5,0xa3a6,0xa3a7,0xa3a8, -0xa3a9,0xa3aa,0xa3ab,0xa3ac,0xa3ad,0xa3ae,0xa3af,0xa3b0, -0xa3b1,0xa3b2,0xa3b3,0xa3b4,0xa3b5,0xa3b6,0xa3b7,0xa3b8, -0xa3b9,0xa3ba,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,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, -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,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,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,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,0x0000,0x0000,0x0000,0x0000, -/* 0x3200 */ -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,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,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,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,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xa1c0,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,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,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -/* 0x3300 */ -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,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,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,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,0x0000,0x0000,0xa255,0xa256, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xa250,0xa251,0xa252,0x0000, -0x0000,0xa254,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,0xa257,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa253,0x0000, -0x0000,0xa1eb,0xa1ea,0x0000,0x0000,0xa24f}; - -static const int ucs_a3_big5_table_min = 0x2f00; -static const int ucs_a3_big5_table_max = 0x2f00 + (sizeof (ucs_a3_big5_table) / sizeof (unsigned short)); - -static const unsigned short ucs_i_big5_table[] = { -/* 0x4d00 */ -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,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,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,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,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,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,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,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xa440,0xa442,0x0000,0xa443,0x0000,0x0000,0x0000,0xc945, -0xa456,0xa454,0xa457,0xa455,0xc946,0xa4a3,0xc94f,0xc94d, -0xa4a2,0xa4a1,0x0000,0x0000,0xa542,0xa541,0xa540,0x0000, -0xa543,0xa4fe,0x0000,0x0000,0x0000,0x0000,0xa5e0,0xa5e1, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa8c3,0x0000, -0x0000,0x0000,0x0000,0xa458,0x0000,0xa4a4,0xc950,0x0000, -0xa4a5,0xc963,0xa6ea,0xcbb1,0x0000,0x0000,0x0000,0x0000, -0xa459,0xa4a6,0x0000,0xa544,0xc964,0x0000,0x0000,0x0000, -0x0000,0x0000,0xc940,0xa444,0x0000,0xa45b,0x0000,0xc947, -0xa45c,0x0000,0x0000,0xa4a7,0x0000,0xa545,0xa547,0xa546, -0x0000,0x0000,0xa5e2,0xa5e3,0x0000,0x0000,0xa8c4,0x0000, -0xadbc,0xa441,0x0000,0x0000,0xc941,0xa445,0xa45e,0xa45d, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xa5e4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xa8c5,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb0ae,0xd44b, -0x0000,0x0000,0xb6c3,0xdcb1,0xdcb2,0x0000,0xa446,0x0000, -0xa4a9,0x0000,0x0000,0xa8c6,0xa447,0xc948,0xa45f,0x0000, -0x0000,0xa4aa,0xa4ac,0xc951,0xa4ad,0xa4ab,0x0000,0x0000, -0x0000,0xa5e5,0x0000,0xa8c7,0x0000,0x0000,0xa8c8,0xab45, -0x0000,0xa460,0xa4ae,0x0000,0xa5e6,0xa5e8,0xa5e7,0x0000, -0xa6eb,0x0000,0x0000,0xa8c9,0xa8ca,0xab46,0xab47,0x0000, -0x0000,0x0000,0x0000,0xadbd,0x0000,0x0000,0xdcb3,0x0000, -0x0000,0xf6d6,0xa448,0x0000,0x0000,0x0000,0x0000,0x0000, -0xa4b0,0xa4af,0xc952,0xa4b1,0xa4b7,0x0000,0xa4b2,0xa4b3, -0xc954,0xc953,0xa4b5,0xa4b6,0x0000,0xa4b4,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xa54a,0xa54b,0xa54c,0xa54d, -0xa549,0xa550,0xc96a,0x0000,0xc966,0xc969,0xa551,0xa561, -0x0000,0xc968,0x0000,0xa54e,0xa54f,0xa548,0x0000,0x0000, -0xc965,0xc967,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xa5f5,0xc9b0,0xa5f2,0xa5f6,0xc9ba,0xc9ae,0xa5f3,0xc9b2, -0x0000,0x0000,0x0000,0xa5f4,0x0000,0xa5f7,0x0000,0xa5e9, -0xc9b1,0xa5f8,0xc9b5,0x0000,0xc9b9,0xc9b6,0x0000,0x0000, -0xc9b3,0xa5ea,0xa5ec,0xa5f9,0x0000,0xa5ee,0xc9ab,0xa5f1, -0xa5ef,0xa5f0,0xc9bb,0xc9b8,0xc9af,0xa5ed,0x0000,0x0000, -0xc9ac,0xa5eb,0x0000,0x0000,0x0000,0xc9b4,0x0000,0x0000, -0x0000,0x0000,0xc9b7,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xc9ad,0xca66,0x0000,0xa742, -0xa6f4,0x0000,0x0000,0xca67,0xa6f1,0x0000,0xa744,0x0000, -0xa6f9,0x0000,0xa6f8,0xca5b,0xa6fc,0xa6f7,0xca60,0xca68, -0x0000,0xca64,0x0000,0xa6fa,0x0000,0x0000,0xa6fd,0xa6ee, -0xa747,0xca5d,0x0000,0x0000,0xcbbd,0xa6ec,0xa743,0xa6ed, -0xa6f5,0xa6f6,0xca62,0xca5e,0xa6fb,0xa6f3,0xca5a,0xa6ef, -0xca65,0xa745,0xa748,0xa6f2,0xa740,0xa746,0xa6f0,0xca63, -0xa741,0xca69,0xca5c,0xa6fe,0xca5f,0x0000,0x0000,0xca61, -0x0000,0xa8d8,0xcbbf,0xcbcb,0xa8d0,0x0000,0xcbcc,0xa8cb, -0xa8d5,0x0000,0x0000,0xa8ce,0xcbb9,0xa8d6,0xcbb8,0xcbbc, -0xcbc3,0xcbc1,0xa8de,0xa8d9,0xcbb3,0xcbb5,0xa8db,0xa8cf, -0xcbb6,0xcbc2,0xcbc9,0xa8d4,0xcbbb,0xcbb4,0xa8d3,0xcbb7, -0xa8d7,0xcbba,0x0000,0xa8d2,0x0000,0xa8cd,0x0000,0xa8dc, -0xcbc4,0xa8dd,0xcbc8,0x0000,0xcbc6,0xcbca,0xa8da,0xcbbe, -0xcbb2,0x0000,0xcbc0,0xa8d1,0xcbc5,0xa8cc,0xcbc7,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xab56,0xab4a, -0x0000,0x0000,0xcde0,0xcde8,0x0000,0xab49,0xab51,0xab5d, -0x0000,0xcdee,0xcdec,0xcde7,0x0000,0x0000,0x0000,0xab4b, -0xcded,0xcde3,0xab59,0xab50,0xab58,0xcdde,0x0000,0xcdea, -0x0000,0xcde1,0xab54,0xcde2,0x0000,0xcddd,0xab5b,0xab4e, -0xab57,0xab4d,0x0000,0xcddf,0xcde4,0x0000,0xcdeb,0xab55, -0xab52,0xcde6,0xab5a,0xcde9,0xcde5,0xab4f,0xab5c,0xab53, -0xab4c,0xab48,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xcdef,0x0000,0xadd7,0xadc1, -0x0000,0xadd1,0x0000,0xadd6,0xd0d0,0xd0cf,0xd0d4,0xd0d5, -0xadc4,0x0000,0xadcd,0x0000,0x0000,0x0000,0xadda,0x0000, -0xadce,0x0000,0x0000,0x0000,0x0000,0xd0c9,0xadc7,0xd0ca, -0x0000,0xaddc,0x0000,0xadd3,0xadbe,0xadbf,0xd0dd,0xb0bf, -0x0000,0xadcc,0xadcb,0xd0cb,0xadcf,0xd45b,0xadc6,0xd0d6, -0xadd5,0xadd4,0xadca,0xd0ce,0xd0d7,0x0000,0xd0c8,0xadc9, -0xd0d8,0xadd2,0xd0cc,0xadc0,0x0000,0xadc3,0xadc2,0xd0d9, -0xadd0,0xadc5,0xadd9,0xaddb,0xd0d3,0xadd8,0x0000,0xd0db, -0xd0cd,0xd0dc,0x0000,0xd0d1,0x0000,0xd0da,0x0000,0xd0d2, -0x0000,0x0000,0x0000,0x0000,0xadc8,0x0000,0x0000,0x0000, -0xd463,0xd457,0x0000,0xb0b3,0x0000,0xd45c,0xd462,0xb0b2, -0xd455,0xb0b6,0xd459,0xd452,0xb0b4,0xd456,0xb0b9,0xb0be, -0x0000,0xd467,0x0000,0xd451,0x0000,0xb0ba,0x0000,0xd466, -0x0000,0x0000,0xb0b5,0xd458,0xb0b1,0xd453,0xd44f,0xd45d, -0xd450,0xd44e,0xd45a,0xd460,0xd461,0xb0b7,0x0000,0x0000, -0xd85b,0xd45e,0xd44d,0xd45f,0x0000,0xb0c1,0xd464,0xb0c0, -0xd44c,0x0000,0xd454,0xd465,0xb0bc,0xb0bb,0xb0b8,0xb0bd, -0x0000,0x0000,0xb0af,0x0000,0x0000,0xb0b0,0x0000,0x0000, -0xb3c8,0x0000,0xd85e,0xd857,0x0000,0xb3c5,0x0000,0xd85f, -0x0000,0x0000,0x0000,0xd855,0xd858,0xb3c4,0xd859,0x0000, -0x0000,0xb3c7,0xd85d,0x0000,0xd853,0xd852,0xb3c9,0x0000, -0xb3ca,0xb3c6,0xb3cb,0xd851,0xd85c,0xd85a,0xd854,0x0000, -0x0000,0x0000,0xb3c3,0xd856,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xb6ca,0xb6c4,0xdcb7,0xb6cd, -0xdcbd,0xdcc0,0xb6c6,0xb6c7,0xdcba,0xb6c5,0xdcc3,0xb6cb, -0xdcc4,0x0000,0xdcbf,0xb6cc,0x0000,0xdcb4,0xb6c9,0xdcb5, -0x0000,0xdcbe,0xdcbc,0x0000,0xdcb8,0xb6c8,0xdcb6,0xb6ce, -0xdcbb,0xdcc2,0xdcb9,0xdcc1,0x0000,0x0000,0xb9b6,0xb9b3, -0x0000,0xb9b4,0x0000,0xe0f9,0xe0f1,0xb9b2,0xb9af,0xe0f2, -0x0000,0x0000,0xb9b1,0xe0f5,0x0000,0xe0f7,0x0000,0x0000, -0xe0fe,0x0000,0x0000,0xe0fd,0xe0f8,0xb9ae,0xe0f0,0xb9ac, -0xe0f3,0xb9b7,0xe0f6,0x0000,0xe0fa,0xb9b0,0xb9ad,0xe0fc, -0xe0fb,0xb9b5,0x0000,0xe0f4,0x0000,0xbbf8,0xe4ec,0x0000, -0xe4e9,0xbbf9,0x0000,0xbbf7,0x0000,0xe4f0,0xe4ed,0xe4e6, -0xbbf6,0x0000,0xbbfa,0xe4e7,0xbbf5,0xbbfd,0xe4ea,0xe4eb, -0xbbfb,0xbbfc,0xe4f1,0xe4ee,0xe4ef,0x0000,0x0000,0x0000, -0xbeaa,0xe8f8,0xbea7,0xe8f5,0xbea9,0xbeab,0x0000,0xe8f6, -0xbea8,0x0000,0xe8f7,0x0000,0xe8f4,0x0000,0x0000,0xc076, -0xecbd,0xc077,0xecbb,0x0000,0xecbc,0xecba,0xecb9,0x0000, -0x0000,0xecbe,0xc075,0x0000,0x0000,0xefb8,0xefb9,0x0000, -0xe4e8,0xefb7,0xc078,0xc35f,0xf1eb,0xf1ec,0x0000,0xc4d7, -0xc4d8,0xf5c1,0xf5c0,0xc56c,0xc56b,0xf7d0,0x0000,0xa449, -0xa461,0xa4b9,0x0000,0xa4b8,0xa553,0xa552,0xa5fc,0xa5fb, -0xa5fd,0xa5fa,0x0000,0xa74a,0xa749,0xa74b,0x0000,0x0000, -0x0000,0x0000,0xa8e0,0x0000,0xa8df,0xa8e1,0x0000,0xab5e, -0x0000,0xa259,0xd0de,0xa25a,0xb0c2,0xa25c,0xa25b,0xd860, -0x0000,0xa25d,0xb9b8,0xa25e,0x0000,0xa44a,0x0000,0xa4ba, -0xa5fe,0xa8e2,0x0000,0xa44b,0xa4bd,0xa4bb,0xa4bc,0x0000, -0x0000,0xa640,0x0000,0x0000,0x0000,0xa74c,0xa8e4,0xa8e3, -0xa8e5,0x0000,0x0000,0x0000,0xaddd,0x0000,0x0000,0x0000, -0xbeac,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc94e, -0x0000,0xa554,0xa555,0x0000,0x0000,0xa641,0x0000,0xca6a, -0x0000,0xab60,0xab5f,0xd0e0,0xd0df,0xb0c3,0x0000,0xa4be, -0xc955,0x0000,0x0000,0x0000,0x0000,0x0000,0xcbcd,0x0000, -0xab61,0x0000,0xade0,0x0000,0xadde,0xaddf,0x0000,0x0000, -0x0000,0x0000,0xbead,0x0000,0xa556,0x0000,0x0000,0x0000, -0xa642,0xc9bc,0x0000,0x0000,0x0000,0x0000,0xa74d,0xa74e, -0x0000,0xca6b,0x0000,0x0000,0xcbce,0xa8e6,0xcbcf,0x0000, -0x0000,0x0000,0x0000,0x0000,0xd0e2,0xd0e3,0xade3,0x0000, -0xd0e4,0x0000,0xd0e1,0xade4,0xade2,0xade1,0xd0e5,0x0000, -0xd468,0x0000,0x0000,0x0000,0xd861,0x0000,0x0000,0xdcc5, -0xe140,0x0000,0x0000,0x0000,0xbbfe,0xbeae,0xe8f9,0x0000, -0xa44c,0xa45a,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xb0c4,0xb3cd,0x0000,0xb9b9,0x0000,0xc942,0xa4bf,0x0000, -0xa559,0xa557,0xa558,0x0000,0x0000,0xa8e7,0x0000,0x0000, -0xa44d,0xa44e,0x0000,0xa462,0x0000,0x0000,0xa4c0,0xa4c1, -0xa4c2,0xc9be,0xa55a,0x0000,0xc96b,0x0000,0xa646,0x0000, -0xc9bf,0xa644,0xa645,0xc9bd,0x0000,0x0000,0xa647,0xa643, -0x0000,0x0000,0x0000,0x0000,0xca6c,0xaaec,0xca6d,0x0000, -0x0000,0xca6e,0x0000,0x0000,0xa750,0xa74f,0x0000,0x0000, -0xa753,0xa751,0xa752,0x0000,0x0000,0x0000,0xa8ed,0x0000, -0xa8ec,0xcbd4,0xcbd1,0xcbd2,0x0000,0xcbd0,0xa8ee,0xa8ea, -0xa8e9,0x0000,0xa8eb,0xa8e8,0x0000,0x0000,0x0000,0x0000, -0x0000,0xa8ef,0x0000,0xab63,0xcdf0,0x0000,0xcbd3,0xab68, -0x0000,0xcdf1,0xab64,0xab67,0xab66,0xab65,0xab62,0x0000, -0x0000,0x0000,0xd0e8,0x0000,0xade7,0xd0eb,0xade5,0x0000, -0x0000,0x0000,0xd0e7,0xade8,0xade6,0xade9,0xd0e9,0xd0ea, -0x0000,0xd0e6,0xd0ec,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xb3d1,0xb0c5,0xd469,0xd46b,0xd46a,0xd46c,0xb0c6, -0x0000,0x0000,0xb3ce,0x0000,0xb3cf,0xb3d0,0x0000,0xb6d0, -0xdcc7,0x0000,0xdcc6,0xdcc8,0xdcc9,0xb6d1,0x0000,0xb6cf, -0xe141,0xe142,0xb9bb,0xb9ba,0xe35a,0x0000,0x0000,0xbc40, -0xbc41,0xbc42,0xbc44,0xe4f2,0xe4f3,0xbc43,0x0000,0x0000, -0x0000,0xbeaf,0x0000,0xbeb0,0x0000,0x0000,0xf1ed,0xf5c3, -0xf5c2,0xf7d1,0x0000,0xa44f,0x0000,0x0000,0x0000,0xa55c, -0xa55b,0x0000,0x0000,0xa648,0x0000,0x0000,0xc9c0,0x0000, -0x0000,0xa755,0xa756,0xa754,0xa757,0xca6f,0xca70,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xa8f1,0xcbd5,0x0000,0xa8f0,0x0000, -0xcdf2,0xab6c,0xcdf3,0xab6b,0x0000,0x0000,0x0000,0xab69, -0x0000,0xab6a,0x0000,0x0000,0x0000,0xd0ed,0x0000,0x0000, -0x0000,0x0000,0xb0c7,0xd46e,0x0000,0xb0ca,0xd46d,0xb1e5, -0xb0c9,0xb0c8,0x0000,0xb3d4,0x0000,0xb3d3,0xb3d2,0xb6d2, -0x0000,0x0000,0xb6d5,0xb6d6,0xb6d4,0x0000,0xb6d3,0x0000, -0x0000,0xe143,0x0000,0xe144,0x0000,0x0000,0x0000,0xe4f5, -0xbc45,0xe4f4,0x0000,0xbeb1,0xecbf,0xc079,0x0000,0xf1ee, -0xc455,0x0000,0xa463,0xa4c3,0xc956,0x0000,0xa4c4,0xa4c5, -/* 0x5300 */ -0x0000,0x0000,0x0000,0x0000,0x0000,0xa55d,0xa55e,0x0000, -0xa649,0xca71,0xcbd6,0xcbd7,0x0000,0xab6d,0xd0ee,0xb0cc, -0xb0cb,0xd863,0xd862,0x0000,0x0000,0xa450,0xa4c6,0xa55f, -0x0000,0xb0cd,0xc943,0x0000,0xc96c,0xa560,0x0000,0xc9c2, -0xa64b,0xa64a,0xc9c1,0xa758,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xadea,0x0000,0x0000,0xd46f,0x0000,0xb6d7, -0xe145,0xb9bc,0x0000,0x0000,0xe8fa,0x0000,0x0000,0xf3fd, -0x0000,0xa4c7,0x0000,0x0000,0xcbd8,0xcdf4,0xb0d0,0xb0ce, -0xb0cf,0xa451,0x0000,0xa464,0xa2cd,0xa4ca,0x0000,0xa4c9, -0xa4c8,0xa563,0xa562,0x0000,0xc96d,0xc9c3,0x0000,0x0000, -0x0000,0xa8f5,0xa8f2,0xa8f4,0xa8f3,0x0000,0x0000,0xab6e, -0x0000,0x0000,0xb3d5,0x0000,0xa452,0x0000,0xa4cb,0x0000, -0xa565,0xa564,0x0000,0xca72,0x0000,0x0000,0xa8f6,0x0000, -0x0000,0x0000,0x0000,0x0000,0xc957,0x0000,0xa567,0xa566, -0xa64c,0xa64d,0xca73,0xa759,0x0000,0xa75a,0x0000,0xa8f7, -0xa8f8,0xa8f9,0x0000,0xab6f,0xcdf5,0x0000,0x0000,0xadeb, -0x0000,0x0000,0xc944,0x0000,0xa4cc,0x0000,0x0000,0x0000, -0x0000,0x0000,0xc9c4,0x0000,0x0000,0x0000,0xca74,0xca75, -0x0000,0x0000,0xcbd9,0x0000,0xcbda,0x0000,0xcdf7,0xcdf6, -0xcdf9,0xcdf8,0xab70,0x0000,0xd470,0xaded,0xd0ef,0xadec, -0x0000,0x0000,0x0000,0x0000,0xd864,0xb3d6,0x0000,0xd865, -0x0000,0x0000,0x0000,0x0000,0xe146,0xb9bd,0x0000,0x0000, -0x0000,0x0000,0xbc46,0x0000,0xf1ef,0x0000,0x0000,0x0000, -0x0000,0xc958,0x0000,0xa568,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xb0d1,0x0000,0x0000,0x0000,0x0000, -0xa453,0xa465,0xa4ce,0xa4cd,0x0000,0xa4cf,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xa8fb,0x0000,0xa8fa,0xa8fc, -0x0000,0x0000,0x0000,0xab71,0x0000,0x0000,0x0000,0xadee, -0x0000,0xe8fb,0xc24f,0xa466,0xa56a,0xa579,0xa574,0x0000, -0xa56f,0xa56e,0xa575,0xa573,0xa56c,0xa57a,0xa56d,0xa569, -0xa578,0xa577,0xa576,0xa56b,0x0000,0xa572,0x0000,0x0000, -0xa571,0x0000,0x0000,0xa57b,0xa570,0x0000,0x0000,0x0000, -/* 0x5400 */ -0x0000,0xa653,0x0000,0xa659,0xa655,0x0000,0xa65b,0xc9c5, -0xa658,0xa64e,0xa651,0xa654,0xa650,0xa657,0xa65a,0xa64f, -0xa652,0xa656,0xa65c,0x0000,0x0000,0x0000,0x0000,0x0000, -0xca7e,0xca7b,0x0000,0xa767,0xca7c,0xa75b,0xa75d,0xa775, -0xa770,0x0000,0x0000,0x0000,0xcaa5,0xca7d,0xa75f,0xa761, -0xcaa4,0xa768,0xca78,0xa774,0xa776,0xa75c,0xa76d,0x0000, -0xca76,0xa773,0x0000,0xa764,0x0000,0xa76e,0xa76f,0xca77, -0xa76c,0xa76a,0x0000,0xa76b,0xa771,0xcaa1,0xa75e,0x0000, -0xa772,0xcaa3,0xa766,0xa763,0x0000,0xca7a,0xa762,0xcaa6, -0xa765,0x0000,0xa769,0x0000,0x0000,0x0000,0xa760,0xcaa2, -0x0000,0x0000,0x0000,0x0000,0xca79,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xcbeb,0xcbea,0xa94f,0xcbed,0xcbef,0xcbe4,0xcbe7,0xcbee, -0xa950,0x0000,0x0000,0xcbe1,0xcbe5,0x0000,0x0000,0xcbe9, -0xce49,0xa94b,0xce4d,0xa8fd,0xcbe6,0xa8fe,0xa94c,0xa945, -0xa941,0x0000,0xcbe2,0xa944,0xa949,0xa952,0xcbe3,0xcbdc, -0xa943,0xcbdd,0xcbdf,0x0000,0xa946,0x0000,0xa948,0xcbdb, -0xcbe0,0x0000,0x0000,0xa951,0xa94d,0xcbe8,0xa953,0x0000, -0xa94a,0xcbde,0xa947,0x0000,0x0000,0xa942,0xa940,0x0000, -0xcbec,0x0000,0xa94e,0x0000,0x0000,0x0000,0x0000,0x0000, -0xce48,0xcdfb,0xce4b,0x0000,0x0000,0xcdfd,0xab78,0xaba8, -0xab74,0xaba7,0xab7d,0xaba4,0xab72,0xcdfc,0xce43,0xaba3, -0xce4f,0xaba5,0x0000,0xab79,0x0000,0x0000,0xce45,0xce42, -0xab77,0x0000,0xcdfa,0xaba6,0xce4a,0xab7c,0xce4c,0xaba9, -0xab73,0xab7e,0xab7b,0xce40,0xaba1,0xce46,0xce47,0xab7a, -0xaba2,0xab76,0x0000,0x0000,0x0000,0x0000,0xab75,0xcdfe, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xce44,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xce4e,0x0000, -0xd144,0xadfb,0xd0f1,0x0000,0xd0f6,0xadf4,0xae40,0xd0f4, -0xadef,0xadf9,0xadfe,0xd0fb,0x0000,0xadfa,0xadfd,0x0000, -0x0000,0xd0fe,0xadf5,0xd0f5,0x0000,0x0000,0x0000,0xd142, -0xd143,0x0000,0xadf7,0xd141,0xadf3,0xae43,0x0000,0xd0f8, -/* 0x5500 */ -0x0000,0xadf1,0x0000,0xd146,0xd0f9,0xd0fd,0xadf6,0xae42, -0xd0fa,0xadfc,0xd140,0xd147,0xd4a1,0x0000,0xd145,0xae44, -0xadf0,0xd0fc,0xd0f3,0x0000,0xadf8,0x0000,0x0000,0xd0f2, -0x0000,0x0000,0xd0f7,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd0f0,0xae41, -0x0000,0x0000,0xd477,0x0000,0xb0e4,0xd4a7,0xb0e2,0xb0df, -0xd47c,0xb0db,0xd4a2,0xb0e6,0xd476,0xd47b,0xd47a,0xadf2, -0xb0e1,0xd4a5,0x0000,0xd4a8,0xd473,0x0000,0xb3e8,0x0000, -0xd4a9,0xb0e7,0x0000,0xb0d9,0xb0d6,0xd47e,0xb0d3,0x0000, -0xd4a6,0x0000,0xb0da,0xd4aa,0x0000,0xd474,0xd4a4,0xb0dd, -0xd475,0xd478,0xd47d,0x0000,0x0000,0xb0de,0xb0dc,0xb0e8, -0x0000,0x0000,0x0000,0x0000,0xb0e3,0x0000,0xb0d7,0xb1d2, -0x0000,0xb0d8,0xd479,0xb0e5,0xb0e0,0xd4a3,0xb0d5,0x0000, -0x0000,0x0000,0xb0d4,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xd471,0xd472,0xd86a, -0x0000,0x0000,0x0000,0xb3d7,0xb3da,0xd875,0xb3ee,0xd878, -0xb3d8,0xd871,0xb3de,0xb3e4,0xb5bd,0x0000,0x0000,0xb3e2, -0xd86e,0xb3ef,0xb3db,0xb3e3,0xd876,0xdcd7,0xd87b,0xd86f, -0x0000,0xd866,0xd873,0xd86d,0xb3e1,0xd879,0x0000,0x0000, -0xb3dd,0xb3f1,0xb3ea,0x0000,0xb3df,0xb3dc,0x0000,0xb3e7, -0x0000,0xd87a,0xd86c,0xd872,0xd874,0xd868,0xd877,0xb3d9, -0xd867,0x0000,0xb3e0,0xb3f0,0xb3ec,0xd869,0xb3e6,0x0000, -0x0000,0xb3ed,0xb3e9,0xb3e5,0x0000,0xd870,0x0000,0x0000, -0x0000,0x0000,0x0000,0xb3eb,0x0000,0x0000,0x0000,0xdcd5, -0xdcd1,0x0000,0xdce0,0xdcca,0xdcd3,0xb6e5,0xb6e6,0xb6de, -0xdcdc,0xb6e8,0xdccf,0xdcce,0xdccc,0xdcde,0xb6dc,0xdcd8, -0xdccd,0xb6df,0xdcd6,0xb6da,0xdcd2,0xdcd9,0xdcdb,0x0000, -0x0000,0xdcdf,0xb6e3,0xdccb,0xb6dd,0xdcd0,0x0000,0xb6d8, -0x0000,0xb6e4,0xdcda,0xb6e0,0xb6e1,0xb6e7,0xb6db,0xa25f, -0xb6d9,0xdcd4,0x0000,0x0000,0x0000,0x0000,0x0000,0xb6e2, -0x0000,0x0000,0xdcdd,0x0000,0x0000,0x0000,0xb9cd,0xb9c8, -0x0000,0xe155,0xe151,0x0000,0xe14b,0xb9c2,0xb9be,0xe154, -0xb9bf,0xe14e,0xe150,0x0000,0xe153,0x0000,0xb9c4,0x0000, -0xb9cb,0xb9c5,0x0000,0x0000,0xe149,0xb9c6,0xb9c7,0xe14c, -0xb9cc,0x0000,0xe14a,0xe14f,0xb9c3,0xe148,0xb9c9,0xb9c1, -0x0000,0x0000,0x0000,0xb9c0,0xe14d,0xe152,0x0000,0xb9ca, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe147, -0x0000,0xbc4d,0xe547,0x0000,0xe544,0x0000,0xbc47,0xbc53, -0xbc54,0x0000,0xbc4a,0xe542,0xbc4c,0xe4f9,0xbc52,0x0000, -0xe546,0xbc49,0xe548,0xbc48,0x0000,0xe543,0xe545,0xbc4b, -0xe541,0xe4fa,0xe4f7,0x0000,0x0000,0xd86b,0xe4fd,0x0000, -0xe4f6,0xe4fc,0xe4fb,0x0000,0xe4f8,0x0000,0xbc4f,0x0000, -0x0000,0x0000,0x0000,0xbc4e,0x0000,0x0000,0x0000,0xbc50, -0xe4fe,0xbeb2,0xe540,0x0000,0x0000,0x0000,0xe945,0x0000, -0xe8fd,0x0000,0xbebe,0xe942,0xbeb6,0xbeba,0xe941,0x0000, -0xbeb9,0xbeb5,0xbeb8,0xbeb3,0xbebd,0xe943,0xe8fe,0xbebc, -0xe8fc,0xbebb,0xe944,0xe940,0xbc51,0x0000,0xbebf,0xe946, -0xbeb7,0xbeb4,0x0000,0x0000,0x0000,0x0000,0xecc6,0xecc8, -0xc07b,0xecc9,0xecc7,0xecc5,0xecc4,0xc07d,0xecc3,0xc07e, -0x0000,0x0000,0x0000,0x0000,0xecc1,0xecc2,0xc07a,0xc0a1, -0xc07c,0x0000,0x0000,0xecc0,0x0000,0xc250,0x0000,0xefbc, -0xefba,0xefbf,0xefbd,0x0000,0xefbb,0xefbe,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xc360,0xf1f2,0xf1f3, -0xc456,0x0000,0xf1f4,0xf1f0,0xf1f5,0xf1f1,0xc251,0x0000, -0x0000,0x0000,0xf3fe,0xf441,0xc459,0xf440,0xc458,0xc457, -0x0000,0x0000,0x0000,0x0000,0xc45a,0xf5c5,0xf5c6,0x0000, -0xc4da,0xc4d9,0xc4db,0xf5c4,0x0000,0xf6d8,0xf6d7,0x0000, -0xc56d,0xc56f,0xc56e,0xf6d9,0xc5c8,0xf8a6,0x0000,0x0000, -0x0000,0xc5f1,0x0000,0xf8a5,0xf8ee,0x0000,0x0000,0xc949, -0x0000,0x0000,0xa57d,0xa57c,0x0000,0xa65f,0xa65e,0xc9c7, -0xa65d,0xc9c6,0x0000,0x0000,0xa779,0xcaa9,0x0000,0xcaa8, -0x0000,0x0000,0xa777,0xa77a,0x0000,0x0000,0xcaa7,0x0000, -0xa778,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcbf0, -0x0000,0xcbf1,0xa954,0x0000,0x0000,0x0000,0x0000,0xabaa, -/* 0x5700 */ -0x0000,0xd148,0xd149,0xae45,0xae46,0x0000,0x0000,0xd4ac, -0xb0e9,0xb0eb,0xd4ab,0xb0ea,0xd87c,0xb3f2,0x0000,0x0000, -0x0000,0x0000,0xb6e9,0xb6ea,0xdce1,0x0000,0xb9cf,0x0000, -0xb9ce,0x0000,0xe549,0xe948,0xe947,0x0000,0xf96b,0xa467, -0xc959,0x0000,0xc96e,0xc96f,0x0000,0x0000,0x0000,0x0000, -0xa662,0xa666,0xc9c9,0x0000,0xa664,0xa663,0xc9c8,0xa665, -0xa661,0x0000,0x0000,0xa660,0xc9ca,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xa7a6,0x0000,0x0000,0xa7a3,0x0000, -0xa77d,0xcaaa,0x0000,0x0000,0x0000,0xcaab,0x0000,0xa7a1, -0x0000,0xcaad,0xa77b,0xcaae,0xcaac,0xa77e,0xa7a2,0xa7a5, -0xa7a4,0xa77c,0xcaaf,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xa959,0xcbfe,0x0000,0xa95b,0x0000,0xa95a,0x0000, -0xcc40,0xa958,0xa957,0xcbf5,0x0000,0xcbf4,0x0000,0xcbf2, -0xcbf7,0xcbf6,0xcbf3,0xcbfc,0xcbfd,0xcbfa,0xcbf8,0xa956, -0x0000,0x0000,0x0000,0xcbfb,0xa95c,0xcc41,0x0000,0x0000, -0xcbf9,0x0000,0xabab,0xa955,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xabac,0xce54,0x0000,0x0000,0xce5a, -0x0000,0x0000,0x0000,0xabb2,0xce58,0xce5e,0x0000,0xce55, -0xce59,0xce5b,0xce5d,0xce57,0x0000,0xce56,0xce51,0xce52, -0xabad,0x0000,0xabaf,0xabae,0xce53,0xce5c,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xabb1,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xce50,0xd153,0x0000, -0xd152,0xd157,0xd14e,0x0000,0xd151,0xd150,0x0000,0xd154, -0x0000,0xd158,0xae47,0xae4a,0x0000,0x0000,0xd14f,0xd155, -0x0000,0x0000,0x0000,0xae49,0xd14a,0x0000,0xabb0,0xd4ba, -0xd156,0x0000,0xd14d,0x0000,0xae48,0xd14c,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xd4b1,0x0000,0x0000,0xb0ec, -0xb0f0,0xd4c1,0xd4af,0xd4bd,0xb0f1,0xd4bf,0x0000,0xd4c5, -0x0000,0xd4c9,0x0000,0x0000,0xd4c0,0xd4b4,0xd4bc,0x0000, -0xd4ca,0xd4c8,0xd4be,0xd4b9,0xd4b2,0xd8a6,0xd4b0,0xb0f5, -0xd4b7,0xb0f6,0xb0f2,0xd4ad,0xd4c3,0xd4b5,0x0000,0x0000, -0xd4b3,0xd4c6,0xb0f3,0x0000,0xd4cc,0xb0ed,0xb0ef,0xd4bb, -0xd4b6,0xae4b,0xb0ee,0xd4b8,0xd4c7,0xd4cb,0xd4c2,0x0000, -0xd4c4,0x0000,0x0000,0x0000,0xd4ae,0x0000,0x0000,0x0000, -0x0000,0xd8a1,0x0000,0xd8aa,0xd8a9,0xb3fa,0xd8a2,0x0000, -0xb3fb,0xb3f9,0x0000,0xd8a4,0xb3f6,0xd8a8,0x0000,0xd8a3, -0xd8a5,0xd87d,0xb3f4,0x0000,0xd8b2,0xd8b1,0xd8ae,0xb3f3, -0xb3f7,0xb3f8,0xd14b,0xd8ab,0xb3f5,0xb0f4,0xd8ad,0xd87e, -0xd8b0,0xd8af,0x0000,0xd8b3,0x0000,0xdcef,0x0000,0xd8ac, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xd8a7,0xdce7,0xb6f4,0xb6f7,0xb6f2,0xdce6,0xdcea,0xdce5, -0x0000,0xb6ec,0xb6f6,0xdce2,0xb6f0,0xdce9,0x0000,0xb6ee, -0xb6ed,0xdcec,0xb6ef,0xdcee,0x0000,0xdceb,0xb6eb,0x0000, -0x0000,0x0000,0xb6f5,0xdcf0,0xdce4,0xdced,0x0000,0x0000, -0xdce3,0x0000,0x0000,0xb6f1,0x0000,0xb6f3,0x0000,0xdce8, -0x0000,0xdcf1,0x0000,0x0000,0xe15d,0xb9d0,0xe163,0x0000, -0x0000,0xb9d5,0xe15f,0xe166,0xe157,0xb9d7,0xb9d1,0xe15c, -0xbc55,0xe15b,0xe164,0xb9d2,0x0000,0xb9d6,0xe15a,0xe160, -0xe165,0xe156,0xb9d4,0xe15e,0x0000,0x0000,0xe162,0xe168, -0xe158,0xe161,0x0000,0xb9d3,0xe167,0x0000,0x0000,0x0000, -0xe159,0x0000,0x0000,0x0000,0xbc59,0xe54b,0xbc57,0xbc56, -0xe54d,0xe552,0x0000,0xe54e,0x0000,0xe551,0xbc5c,0x0000, -0xbea5,0xbc5b,0x0000,0xe54a,0xe550,0x0000,0xbc5a,0xe54f, -0x0000,0xe54c,0x0000,0xbc58,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xe94d,0xf9d9,0xe94f,0xe94a,0xbec1,0xe94c, -0x0000,0xbec0,0xe94e,0x0000,0x0000,0xbec3,0xe950,0xbec2, -0xe949,0xe94b,0x0000,0x0000,0x0000,0x0000,0xc0a5,0xeccc, -0x0000,0xc0a4,0xeccd,0xc0a3,0xeccb,0xc0a2,0xecca,0x0000, -0xc253,0xc252,0xf1f6,0xf1f8,0x0000,0xf1f7,0xc361,0xc362, -0x0000,0x0000,0xc363,0xf442,0xc45b,0x0000,0x0000,0xf7d3, -0xf7d2,0xc5f2,0x0000,0xa468,0xa4d0,0x0000,0x0000,0xa7a7, -0x0000,0x0000,0x0000,0x0000,0xce5f,0x0000,0x0000,0x0000, -0x0000,0xb3fc,0xb3fd,0x0000,0xdcf2,0xb9d8,0xe169,0xe553, -/* 0x5900 */ -0x0000,0x0000,0x0000,0xc95a,0x0000,0x0000,0xcab0,0x0000, -0x0000,0x0000,0x0000,0x0000,0xcc42,0xce60,0xd159,0xae4c, -0x0000,0x0000,0xf1f9,0x0000,0xc4dc,0xa469,0xa57e,0xc970, -0x0000,0xa667,0xa668,0x0000,0xa95d,0x0000,0x0000,0x0000, -0xb0f7,0x0000,0xb9da,0x0000,0xb9db,0xb9d9,0x0000,0xa46a, -0x0000,0xa4d1,0xa4d3,0xa4d2,0xc95b,0xa4d4,0xa5a1,0xc971, -0x0000,0xa5a2,0x0000,0x0000,0x0000,0x0000,0x0000,0xa669, -0xa66a,0x0000,0x0000,0x0000,0xc9cb,0x0000,0xa7a8,0x0000, -0xcab1,0x0000,0x0000,0x0000,0xa961,0xcc43,0x0000,0xa95f, -0xa960,0xa95e,0xd15a,0x0000,0x0000,0x0000,0xabb6,0xabb5, -0xabb7,0xabb4,0x0000,0xce61,0xa962,0xabb3,0x0000,0xae4d, -0xae4e,0x0000,0xae4f,0x0000,0xd4cd,0x0000,0x0000,0x0000, -0xb3fe,0xd8b4,0xb0f8,0x0000,0x0000,0x0000,0x0000,0xb6f8, -0x0000,0xb9dd,0xb9dc,0xe16a,0x0000,0xbc5d,0xbec4,0x0000, -0xefc0,0xf6da,0xf7d4,0xa46b,0xa5a3,0x0000,0xa5a4,0xc9d1, -0xa66c,0xa66f,0x0000,0xc9cf,0xc9cd,0xa66e,0xc9d0,0xc9d2, -0xc9cc,0xa671,0xa670,0xa66d,0xa66b,0xc9ce,0x0000,0x0000, -0x0000,0x0000,0xa7b3,0x0000,0x0000,0xa7b0,0xcab6,0xcab9, -0xcab8,0x0000,0xa7aa,0xa7b2,0x0000,0x0000,0xa7af,0xcab5, -0xcab3,0xa7ae,0x0000,0x0000,0x0000,0xa7a9,0xa7ac,0x0000, -0xcab4,0xcabb,0xcab7,0xa7ad,0xa7b1,0xa7b4,0xcab2,0xcaba, -0xa7ab,0x0000,0x0000,0x0000,0x0000,0x0000,0xa967,0xa96f, -0x0000,0xcc4f,0xcc48,0xa970,0xcc53,0xcc44,0xcc4b,0x0000, -0x0000,0xa966,0xcc45,0xa964,0xcc4c,0xcc50,0xa963,0x0000, -0xcc51,0xcc4a,0x0000,0xcc4d,0x0000,0xa972,0xa969,0xcc54, -0xcc52,0x0000,0xa96e,0xa96c,0xcc49,0xa96b,0xcc47,0xcc46, -0xa96a,0xa968,0xa971,0xa96d,0xa965,0x0000,0xcc4e,0x0000, -0xabb9,0x0000,0xabc0,0xce6f,0xabb8,0xce67,0xce63,0x0000, -0xce73,0xce62,0x0000,0xabbb,0xce6c,0xabbe,0xabc1,0x0000, -0xabbc,0xce70,0xabbf,0x0000,0xae56,0xce76,0xce64,0x0000, -0x0000,0xce66,0xce6d,0xce71,0xce75,0xce72,0xce6b,0xce6e, -0x0000,0x0000,0xce68,0xabc3,0xce6a,0xce69,0xce74,0xabba, -0xce65,0xabc2,0x0000,0xabbd,0x0000,0x0000,0x0000,0x0000, -0x0000,0xae5c,0xd162,0x0000,0xae5b,0x0000,0x0000,0xd160, -0x0000,0xae50,0x0000,0xae55,0x0000,0xd15f,0xd15c,0xd161, -0xae51,0xd15b,0x0000,0xae54,0xae52,0x0000,0xd163,0xae53, -0xae57,0x0000,0x0000,0xae58,0x0000,0xae5a,0x0000,0x0000, -0x0000,0xae59,0x0000,0x0000,0x0000,0xd15d,0xd15e,0x0000, -0x0000,0x0000,0x0000,0xd164,0x0000,0xd4d4,0xb0f9,0xd8c2, -0xd4d3,0xd4e6,0x0000,0x0000,0xb140,0x0000,0xd4e4,0x0000, -0xb0fe,0xb0fa,0xd4ed,0xd4dd,0xd4e0,0x0000,0xb143,0xd4ea, -0xd4e2,0xb0fb,0xb144,0x0000,0xd4e7,0xd4e5,0x0000,0x0000, -0xd4d6,0xd4eb,0xd4df,0xd4da,0x0000,0xd4d0,0xd4ec,0xd4dc, -0xd4cf,0x0000,0xb142,0xd4e1,0xd4ee,0xd4de,0xd4d2,0xd4d7, -0xd4ce,0x0000,0xb141,0x0000,0xd4db,0xd4d8,0xb0fc,0xd4d1, -0x0000,0xd4e9,0xb0fd,0x0000,0xd4d9,0xd4d5,0x0000,0x0000, -0xd4e8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb440, -0xd8bb,0x0000,0xd8b8,0xd8c9,0xd8bd,0xd8ca,0x0000,0xb442, -0x0000,0x0000,0x0000,0xd8c6,0xd8c3,0x0000,0x0000,0x0000, -0x0000,0x0000,0xd8c4,0xd8c7,0xd8cb,0x0000,0xd4e3,0xd8cd, -0xdd47,0x0000,0xb443,0xd8ce,0xd8b6,0xd8c0,0x0000,0xd8c5, -0x0000,0x0000,0xb441,0xb444,0xd8cc,0xd8cf,0xd8ba,0xd8b7, -0x0000,0x0000,0xd8b9,0x0000,0x0000,0xd8be,0xd8bc,0xb445, -0x0000,0xd8c8,0x0000,0x0000,0xd8bf,0x0000,0xd8c1,0xd8b5, -0xdcfa,0xdcf8,0xb742,0xb740,0xdd43,0xdcf9,0xdd44,0xdd40, -0xdcf7,0xdd46,0xdcf6,0xdcfd,0xb6fe,0xb6fd,0xb6fc,0xdcfb, -0xdd41,0xb6f9,0xb741,0x0000,0xdcf4,0x0000,0xdcfe,0xdcf3, -0xdcfc,0xb6fa,0xdd42,0xdcf5,0xb6fb,0xdd45,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xe16e,0xb9e2,0xb9e1, -0xb9e3,0xe17a,0xe170,0xe176,0xe16b,0xe179,0xe178,0xe17c, -0xe175,0xb9de,0xe174,0xb9e4,0x0000,0xe16d,0xb9df,0x0000, -0xe17b,0xb9e0,0xe16f,0xe172,0xe177,0xe171,0xe16c,0x0000, -0x0000,0x0000,0x0000,0xe173,0xe555,0xbc61,0xe558,0xe557, -0xe55a,0xe55c,0xf9dc,0xbc5f,0x0000,0xe556,0x0000,0xe554, -/* 0x5b00 */ -0x0000,0xe55d,0xe55b,0xe559,0x0000,0xe55f,0x0000,0xe55e, -0xbc63,0xbc5e,0x0000,0xbc60,0xbc62,0x0000,0x0000,0xe560, -0xe957,0x0000,0x0000,0xe956,0xe955,0x0000,0xe958,0xe951, -0x0000,0xe952,0xe95a,0xe953,0x0000,0xbec5,0xe95c,0x0000, -0xe95b,0xe954,0x0000,0xecd1,0xc0a8,0xeccf,0xecd4,0xecd3, -0xe959,0x0000,0xc0a7,0x0000,0xecd2,0xecce,0xecd6,0xecd5, -0xc0a6,0x0000,0xecd0,0x0000,0xbec6,0x0000,0x0000,0x0000, -0xc254,0x0000,0x0000,0x0000,0xefc1,0xf1fa,0xf1fb,0xf1fc, -0xc45c,0x0000,0x0000,0xc45d,0x0000,0xf443,0x0000,0xf5c8, -0xf5c7,0x0000,0x0000,0xf6db,0xf6dc,0xf7d5,0xf8a7,0x0000, -0xa46c,0xa46d,0x0000,0xa46e,0xa4d5,0xa5a5,0xc9d3,0xa672, -0xa673,0x0000,0xa7b7,0xa7b8,0xa7b6,0xa7b5,0x0000,0xa973, -0x0000,0x0000,0xcc55,0xa975,0xa974,0xcc56,0x0000,0x0000, -0x0000,0xabc4,0x0000,0xae5d,0xd165,0x0000,0xd4f0,0x0000, -0xb145,0xb447,0xd4ef,0xb446,0x0000,0xb9e5,0x0000,0xe17d, -0xbec7,0x0000,0xc0a9,0xecd7,0x0000,0xc45e,0x0000,0xc570, -0x0000,0xc972,0x0000,0xa5a6,0xc973,0xa676,0x0000,0xa674, -0xa675,0xa677,0x0000,0xa7ba,0xa7b9,0x0000,0xcabc,0xa7bb, -0x0000,0x0000,0xcabd,0xcc57,0x0000,0xcc58,0x0000,0xa976, -0xa978,0xa97a,0xa977,0xa97b,0xa979,0x0000,0x0000,0x0000, -0x0000,0x0000,0xabc8,0xabc5,0xabc7,0xabc9,0xabc6,0xd166, -0xce77,0x0000,0x0000,0x0000,0xd168,0xd167,0xae63,0x0000, -0xae5f,0x0000,0x0000,0xae60,0xae62,0xae64,0xae61,0x0000, -0xae66,0xae65,0x0000,0x0000,0x0000,0x0000,0x0000,0xb14a, -0xd4f2,0xd4f1,0xb149,0x0000,0xb148,0xb147,0xb14b,0xb146, -0x0000,0x0000,0xd8d5,0xd8d2,0xb449,0xd8d1,0xd8d6,0x0000, -0xb44b,0xd8d4,0xb448,0xb44a,0xd8d3,0x0000,0xdd48,0x0000, -0xdd49,0xdd4a,0x0000,0x0000,0x0000,0x0000,0xb9e6,0xb9ee, -0xe17e,0xb9e8,0xb9ec,0xe1a1,0xb9ed,0xb9e9,0xb9ea,0xb9e7, -0xb9eb,0xbc66,0xd8d0,0xbc67,0xbc65,0x0000,0xbc64,0xe95d, -0xbec8,0xecd8,0xecd9,0x0000,0x0000,0xc364,0xc45f,0x0000, -0xa46f,0x0000,0xa678,0x0000,0x0000,0x0000,0x0000,0x0000, -/* 0x5c00 */ -0x0000,0xabca,0x0000,0xd169,0xae67,0x0000,0x0000,0xb14e, -0xb14d,0xb14c,0xb44c,0xb44d,0xd8d7,0xb9ef,0xbec9,0xa470, -0xc95c,0xa4d6,0xc974,0x0000,0x0000,0xc9d4,0xa679,0x0000, -0x0000,0x0000,0xa97c,0x0000,0x0000,0x0000,0x0000,0xdd4b, -0x0000,0x0000,0xa471,0x0000,0xa4d7,0xc9d5,0x0000,0x0000, -0xcabe,0x0000,0xcabf,0x0000,0xa7bc,0x0000,0x0000,0x0000, -0xd8d8,0xb44e,0x0000,0xdd4c,0x0000,0x0000,0x0000,0xc0aa, -0xa472,0xa4a8,0xa4d8,0xc975,0xa5a7,0x0000,0xa7c0,0xa7bf, -0xa7bd,0xa7be,0x0000,0x0000,0xcc59,0xa97e,0xa9a1,0xcc5a, -0xa97d,0x0000,0x0000,0xabce,0xce78,0xabcd,0xabcb,0xabcc, -0xae6a,0xae68,0x0000,0x0000,0xd16b,0xae69,0xd16a,0x0000, -0xae5e,0xd4f3,0x0000,0x0000,0xb150,0xb151,0x0000,0x0000, -0xb14f,0x0000,0xb9f0,0xe1a2,0xbc68,0xbc69,0x0000,0xe561, -0xc0ab,0xefc2,0xefc3,0x0000,0xc4dd,0xf8a8,0xc94b,0xa4d9, -0x0000,0xa473,0x0000,0xc977,0xc976,0x0000,0x0000,0x0000, -0x0000,0xa67a,0xc9d7,0xc9d8,0xc9d6,0x0000,0xc9d9,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcac7,0x0000, -0xcac2,0xcac4,0xcac6,0xcac3,0xa7c4,0xcac0,0x0000,0xcac1, -0xa7c1,0xa7c2,0xcac5,0xcac8,0xa7c3,0xcac9,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xcc68,0x0000,0xcc62, -0xcc5d,0xa9a3,0xcc65,0xcc63,0xcc5c,0xcc69,0xcc6c,0xcc67, -0xcc60,0xa9a5,0xcc66,0xa9a6,0xcc61,0xcc64,0xcc5b,0xcc5f, -0xcc6b,0xa9a7,0x0000,0xa9a8,0x0000,0xcc5e,0xcc6a,0xa9a2, -0xa9a4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xceab,0xcea4, -0xceaa,0xcea3,0xcea5,0xce7d,0xce7b,0x0000,0xceac,0xcea9, -0xce79,0x0000,0xabd0,0xcea7,0xcea8,0x0000,0xcea6,0xce7c, -0xce7a,0xabcf,0xcea2,0xce7e,0x0000,0x0000,0xcea1,0xcead, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xae6f,0x0000,0xae6e,0x0000,0xd16c,0xae6b,0xd16e,0x0000, -0xae70,0xd16f,0x0000,0x0000,0xae73,0x0000,0xae71,0xd170, -0xceae,0xd172,0x0000,0xae6d,0x0000,0xae6c,0x0000,0xd16d, -0xd171,0xae72,0x0000,0x0000,0x0000,0x0000,0xb153,0xb152, -0x0000,0x0000,0x0000,0xd4f5,0xd4f9,0xd4fb,0xb154,0xd4fe, -0x0000,0xb158,0xd541,0x0000,0xb15a,0x0000,0xb156,0xb15e, -0x0000,0xb15b,0xd4f7,0xb155,0x0000,0xd4f6,0xd4f4,0xd543, -0xd4f8,0x0000,0xb157,0xd542,0xb15c,0xd4fd,0xd4fc,0xb15d, -0xd4fa,0xb159,0x0000,0x0000,0x0000,0x0000,0xd544,0x0000, -0xd540,0xd8e7,0xd8ee,0xd8e3,0xb451,0xd8df,0xd8ef,0xd8d9, -0xd8ec,0xd8ea,0xd8e4,0x0000,0xd8ed,0xd8e6,0x0000,0xd8de, -0xd8f0,0xd8dc,0xd8e9,0xd8da,0x0000,0xd8f1,0x0000,0xb452, -0x0000,0xd8eb,0xdd4f,0xd8dd,0xb44f,0x0000,0xd8e1,0x0000, -0xb450,0xd8e0,0xd8e5,0x0000,0x0000,0xd8e2,0x0000,0x0000, -0x0000,0xd8e8,0x0000,0x0000,0x0000,0x0000,0xdd53,0x0000, -0x0000,0x0000,0xdd56,0xdd4e,0x0000,0xdd50,0x0000,0xdd55, -0xdd54,0xb743,0x0000,0xd8db,0xdd52,0x0000,0x0000,0xb744, -0x0000,0xdd4d,0xdd51,0x0000,0x0000,0x0000,0x0000,0xe1a9, -0x0000,0xe1b0,0xe1a7,0x0000,0xe1ae,0xe1a5,0xe1ad,0xe1b1, -0xe1a4,0xe1a8,0xe1a3,0x0000,0xb9f1,0x0000,0xe1a6,0xb9f2, -0xe1ac,0xe1ab,0xe1aa,0x0000,0x0000,0xe1af,0x0000,0x0000, -0x0000,0x0000,0xe565,0xe567,0xbc6b,0xe568,0x0000,0xe563, -0x0000,0xe562,0xe56c,0x0000,0xe56a,0xbc6a,0xe56d,0xe564, -0xe569,0xe56b,0xe566,0x0000,0x0000,0x0000,0x0000,0xe961, -0xe966,0xe960,0xe965,0x0000,0xe95e,0xe968,0xe964,0xe969, -0xe963,0xe95f,0xe967,0x0000,0xe96a,0xe962,0x0000,0xecda, -0xc0af,0x0000,0xc0ad,0x0000,0xc0ac,0xc0ae,0x0000,0x0000, -0xefc4,0x0000,0xf172,0xf1fd,0x0000,0x0000,0xf444,0xf445, -0x0000,0xc460,0x0000,0xf5c9,0x0000,0xc4de,0x0000,0xf5ca, -0x0000,0xf6de,0xc572,0x0000,0xc571,0xf6dd,0xc5c9,0x0000, -0xf7d6,0x0000,0x0000,0x0000,0x0000,0xa474,0xa67b,0xc9da, -0xcaca,0xa8b5,0xb15f,0x0000,0x0000,0xa475,0xa5aa,0xa5a9, -0xa5a8,0x0000,0x0000,0xa7c5,0x0000,0x0000,0xae74,0x0000, -0xdd57,0xa476,0xa477,0xa478,0xa4da,0x0000,0x0000,0xabd1, -0x0000,0xceaf,0x0000,0x0000,0x0000,0xb453,0xa479,0xc95d, -/* 0x5e00 */ -0x0000,0x0000,0xa5ab,0xa5ac,0xc978,0x0000,0xa67c,0x0000, -0x0000,0x0000,0xcacb,0x0000,0xa7c6,0x0000,0xcacc,0x0000, -0x0000,0xa9ae,0x0000,0x0000,0xcc6e,0xa9ac,0xa9ab,0xcc6d, -0xa9a9,0xcc6f,0xa9aa,0xa9ad,0x0000,0xabd2,0x0000,0xabd4, -0xceb3,0xceb0,0xceb1,0xceb2,0xceb4,0xabd3,0x0000,0x0000, -0xd174,0xd173,0x0000,0xae76,0x0000,0xae75,0x0000,0x0000, -0x0000,0x0000,0x0000,0xb162,0xd546,0x0000,0xb161,0xb163, -0xb160,0x0000,0x0000,0x0000,0x0000,0xb455,0xd545,0x0000, -0xb456,0xd8f3,0x0000,0xb457,0xd8f2,0xb454,0x0000,0x0000, -0x0000,0x0000,0xdd5a,0xdd5c,0xb745,0xdd5b,0xdd59,0xdd58, -0x0000,0x0000,0x0000,0xe1b4,0xb9f7,0xb9f5,0x0000,0xb9f6, -0xe1b2,0xe1b3,0x0000,0xb9f3,0xe571,0xe56f,0x0000,0xbc6d, -0xe570,0xbc6e,0xbc6c,0xb9f4,0x0000,0x0000,0xe96d,0xe96b, -0xe96c,0xe56e,0xecdc,0xc0b0,0xecdb,0xefc5,0xefc6,0xe96e, -0xf1fe,0x0000,0xa47a,0xa5ad,0xa67e,0xc9db,0xa67d,0x0000, -0xa9af,0xb746,0x0000,0xa4db,0xa5ae,0xabd5,0xb458,0x0000, -0xc979,0x0000,0xc97a,0x0000,0xc9dc,0x0000,0x0000,0xa7c8, -0xcad0,0xcace,0xa7c9,0xcacd,0xcacf,0xcad1,0x0000,0xa7c7, -0x0000,0x0000,0x0000,0x0000,0x0000,0xa9b3,0xa9b4,0xa9b1, -0x0000,0x0000,0xa9b0,0xceb8,0xa9b2,0x0000,0x0000,0x0000, -0xabd6,0x0000,0xceb7,0xceb9,0xceb6,0xceba,0xabd7,0xae79, -0xd175,0x0000,0xd177,0xae77,0xd178,0xae78,0xd176,0x0000, -0xceb5,0xd547,0xd54a,0xd54b,0xd548,0xb167,0xb166,0xb164, -0xb165,0xd549,0x0000,0x0000,0x0000,0x0000,0xb168,0x0000, -0x0000,0xb45a,0xb45b,0x0000,0xb45c,0xdd5d,0xdd5f,0xdd61, -0xb748,0xb747,0xb459,0xdd60,0xdd5e,0x0000,0xe1b8,0x0000, -0x0000,0xe1b6,0xe1bc,0xb9f8,0xe1bd,0xe1ba,0xb9f9,0xe1b7, -0xe1b5,0xe1bb,0xbc70,0xe573,0xe1b9,0xbc72,0xe574,0xbc71, -0xbc74,0xe575,0xbc6f,0xbc73,0x0000,0xe973,0xe971,0xe970, -0xe972,0xe96f,0x0000,0x0000,0xc366,0x0000,0xf446,0xf447, -0x0000,0xf5cb,0xf6df,0xc655,0x0000,0x0000,0xa9b5,0xa7ca, -0x0000,0x0000,0xabd8,0x0000,0x0000,0x0000,0xa47b,0xa4dc, -/* 0x5f00 */ -0x0000,0xa5af,0xc9dd,0x0000,0xa7cb,0xcad2,0x0000,0xcebb, -0xabd9,0x0000,0xb9fa,0xa47c,0x0000,0x0000,0x0000,0xa6a1, -0x0000,0x0000,0xb749,0xa47d,0xa4dd,0xa4de,0x0000,0xa5b1, -0xa5b0,0x0000,0xc9de,0xa6a2,0x0000,0xcad3,0x0000,0xa7cc, -0x0000,0x0000,0xcc71,0xcc72,0xcc73,0x0000,0xa9b6,0xa9b7, -0xcc70,0xa9b8,0x0000,0x0000,0x0000,0xabda,0xcebc,0x0000, -0xd17a,0xae7a,0x0000,0xd179,0x0000,0xb169,0xd54c,0xb16a, -0xd54d,0x0000,0x0000,0x0000,0xb45d,0x0000,0x0000,0x0000, -0xdd62,0x0000,0x0000,0xe1bf,0xe1be,0x0000,0xb9fb,0x0000, -0xbc75,0xe576,0xbeca,0xe974,0xc0b1,0x0000,0xc573,0xf7d8, -0x0000,0x0000,0x0000,0x0000,0xcc74,0x0000,0xcebd,0xb16b, -0xd8f4,0xb74a,0x0000,0x0000,0x0000,0xc255,0x0000,0x0000, -0x0000,0x0000,0xa7ce,0x0000,0xa7cd,0xabdb,0x0000,0xd17b, -0x0000,0xb16d,0xb343,0xb16e,0xb16c,0xb45e,0x0000,0xe1c0, -0xb9fc,0xbc76,0x0000,0xc94c,0xc9df,0x0000,0xcad5,0xa7cf, -0xcad4,0xa7d0,0x0000,0x0000,0xa9bc,0xcc77,0xcc76,0xa9bb, -0xa9b9,0xa9ba,0xcc75,0x0000,0x0000,0xabdd,0xcebe,0xabe0, -0xabdc,0xabe2,0xabde,0xabdf,0xabe1,0x0000,0x0000,0x0000, -0xae7d,0xae7c,0xae7b,0x0000,0x0000,0x0000,0xd54f,0xb16f, -0xb172,0xb170,0x0000,0xd54e,0xb175,0x0000,0xb171,0xd550, -0xb174,0xb173,0x0000,0x0000,0x0000,0xd8f6,0xd8f5,0x0000, -0xb461,0xb45f,0xb460,0xd8f7,0xb74b,0xdd64,0xb74c,0xdd63, -0x0000,0x0000,0xe577,0x0000,0x0000,0xbc78,0xe1c1,0xbc77, -0x0000,0xb9fd,0x0000,0xecde,0xe975,0xc0b2,0xecdd,0xf240, -0xf448,0xf449,0x0000,0xa4df,0x0000,0xa5b2,0x0000,0x0000, -0x0000,0xc97b,0x0000,0x0000,0xa7d2,0xa7d4,0x0000,0xc9e2, -0xcad8,0xcad7,0xcad6,0x0000,0xc9e1,0xc9e0,0xa6a4,0xa7d3, -0xa7d1,0xa6a3,0x0000,0x0000,0x0000,0xa9bd,0xcc78,0x0000, -0xa9be,0xcadd,0x0000,0xcadf,0xcade,0xcc79,0x0000,0x0000, -0xcada,0x0000,0xa7d8,0xa7d6,0x0000,0xcad9,0xcadb,0xcae1, -0x0000,0xa7d5,0x0000,0xcadc,0xcae5,0xa9c0,0x0000,0xcae2, -0xa7d7,0x0000,0xcae0,0xcae3,0x0000,0xa9bf,0x0000,0xa9c1, -0xcae4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xccaf,0xcca2,0xcc7e,0xccae,0xcca9,0xabe7,0xa9c2, -0xccaa,0xccad,0xabe3,0xccac,0xa9c3,0xa9c8,0xa9c6,0xcca3, -0x0000,0xcc7c,0xcca5,0xa9cd,0xccb0,0xabe4,0xcca6,0x0000, -0xabe5,0xa9c9,0xcca8,0x0000,0xcecd,0xabe6,0xcc7b,0xa9ca, -0xabe8,0xa9cb,0xa9c7,0xa9cc,0xcca7,0xcc7a,0xccab,0xa9c4, -0x0000,0x0000,0xcc7d,0xcca4,0xcca1,0xa9c5,0x0000,0xcebf, -0x0000,0xcec0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xceca,0xd1a1,0xcecb,0xabee,0xcece,0xcec4,0xabed,0xcec6, -0x0000,0xcec7,0x0000,0x0000,0xcec9,0xabe9,0x0000,0x0000, -0xaea3,0x0000,0xf9da,0xcec5,0xcec1,0xaea4,0x0000,0x0000, -0xcecf,0xae7e,0xd17d,0xcec8,0x0000,0xd17c,0xcec3,0xcecc, -0x0000,0x0000,0xabec,0xaea1,0xabf2,0xaea2,0xced0,0xd17e, -0xabeb,0xaea6,0xabf1,0xabf0,0xabef,0xaea5,0xced1,0xaea7, -0xabea,0x0000,0xcec2,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb176, -0xd1a4,0xd1a6,0x0000,0xd1a8,0xaea8,0xaeae,0xd553,0xd1ac, -0xd1a3,0xb178,0xd551,0x0000,0xaead,0xaeab,0xd1ae,0x0000, -0xd552,0x0000,0xd1a5,0x0000,0xaeac,0xd1a9,0xaeaf,0xd1ab, -0x0000,0x0000,0xaeaa,0xd1aa,0xd1ad,0xd1a7,0x0000,0xaea9, -0xb179,0x0000,0xd1a2,0xb177,0x0000,0x0000,0x0000,0x0000, -0xb17a,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xd555,0xd55e,0xb464,0x0000,0xb17c,0xb1a3,0xb465,0xd560, -0xb1aa,0xd8f9,0xd556,0xb1a2,0xb1a5,0xb17e,0xd554,0xd562, -0xd565,0xd949,0x0000,0xd563,0xd8fd,0xb1a1,0xb1a8,0xb1ac, -0xd55d,0xd8f8,0xd561,0xb17b,0xd8fa,0xd564,0xd8fc,0xd559, -0x0000,0xb462,0x0000,0xd557,0xd558,0xb1a7,0x0000,0x0000, -0xb1a6,0xd55b,0xb1ab,0xd55f,0xb1a4,0xd55c,0x0000,0xb1a9, -0xb466,0xb463,0xd8fb,0x0000,0xd55a,0x0000,0xb17d,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xb46b,0xb46f,0xd940,0xb751,0xb46d,0xd944,0xb471,0xdd65, -0xd946,0xb753,0xb469,0xb46c,0xd947,0x0000,0xd948,0xd94e, -0xb473,0xb754,0x0000,0xd94a,0xd94f,0xd943,0xb75e,0x0000, -0xb755,0xb472,0xd941,0xd950,0x0000,0xb75d,0xb470,0xb74e, -0xd94d,0x0000,0xb474,0xd945,0xd8fe,0xb46a,0xd942,0x0000, -0xd94b,0x0000,0xb74d,0xb752,0xb467,0xd94c,0x0000,0xb750, -0x0000,0x0000,0x0000,0xb468,0x0000,0x0000,0x0000,0xb75c, -0xe1c3,0xdd70,0x0000,0xdd68,0xe1c2,0x0000,0xdd6c,0xdd6e, -0x0000,0x0000,0xdd6b,0x0000,0xb75b,0x0000,0xdd6a,0xb75f, -0x0000,0x0000,0x0000,0xe1d2,0x0000,0x0000,0xb75a,0xba40, -0xdd71,0xe1c4,0x0000,0x0000,0xb758,0xdd69,0xdd6d,0xb9fe, -0xb74f,0xdd66,0xdd67,0xba41,0xb757,0xb759,0xb756,0xdd6f, -0x0000,0x0000,0xe1c8,0xe1c9,0xe1ce,0xbc7d,0xe1d5,0x0000, -0xba47,0x0000,0xba46,0xe1d0,0x0000,0xbc7c,0xe1c5,0xba45, -0x0000,0xe1d4,0xba43,0xba44,0x0000,0xe1d1,0xe5aa,0xbc7a, -0xb46e,0x0000,0xe1d3,0xbca3,0xe1cb,0x0000,0xbc7b,0x0000, -0xbca2,0xe1c6,0xe1ca,0xe1c7,0xe1cd,0xba48,0xbc79,0xba42, -0x0000,0xe57a,0xe1cf,0x0000,0xbca1,0x0000,0xbca4,0x0000, -0xe1cc,0x0000,0xbc7e,0xe579,0x0000,0x0000,0x0000,0x0000, -0x0000,0xe57e,0xbece,0xe578,0xe9a3,0xe5a9,0xbca8,0x0000, -0xbca6,0xbecc,0xe5a6,0xe5a2,0xbcac,0x0000,0xe978,0x0000, -0x0000,0x0000,0xbcaa,0xe5a1,0x0000,0xe976,0x0000,0xe5a5, -0x0000,0xe5a8,0xe57d,0x0000,0xbcab,0x0000,0x0000,0xbca5, -0xe977,0xbecd,0xe5a7,0xbca7,0xbca9,0xe5a4,0xbcad,0xe5a3, -0xe57c,0xe57b,0xbecb,0xe5ab,0xe97a,0xece0,0xbed0,0x0000, -0xe9a2,0x0000,0xe97e,0x0000,0xece1,0x0000,0xbed1,0xe9a1, -0x0000,0xe97c,0xc0b4,0xecdf,0x0000,0xe979,0xe97b,0xc0b5, -0xbed3,0xc0b3,0xbed2,0xc0b7,0xe97d,0xbecf,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xefcf,0x0000, -0xefc7,0x0000,0x0000,0x0000,0x0000,0x0000,0xece7,0xefc8, -0xece3,0x0000,0x0000,0xc256,0xece5,0xece4,0xc0b6,0xece2, -0xece6,0xefd0,0xefcc,0xefce,0x0000,0xefc9,0xefca,0x0000, -0xefcd,0xefcb,0xc367,0x0000,0x0000,0xc36a,0xc369,0xc368, -0xc461,0xf44a,0xc462,0xf241,0xc4df,0xf5cc,0xc4e0,0xc574, -0xc5ca,0xf7d9,0x0000,0xf7da,0xf7db,0x0000,0x0000,0xf9ba, -0xa4e0,0xc97c,0xa5b3,0x0000,0xa6a6,0xa6a7,0xa6a5,0x0000, -0xa6a8,0xa7da,0xa7d9,0x0000,0xccb1,0xa9cf,0xa9ce,0x0000, -0x0000,0xd1af,0xb1ad,0xb1ae,0x0000,0x0000,0x0000,0xb475, -0xdd72,0xb760,0xb761,0xdd74,0xdd76,0xdd75,0x0000,0xe1d7, -0x0000,0xe1d6,0xba49,0xe1d8,0x0000,0xe5ac,0xbcae,0x0000, -0xbed4,0x0000,0xc0b8,0xc257,0xc0b9,0x0000,0xa4e1,0x0000, -0x0000,0x0000,0xcae6,0x0000,0x0000,0xccb2,0xa9d1,0xa9d0, -0xa9d2,0xabf3,0xced2,0xced3,0x0000,0x0000,0xd1b0,0xaeb0, -0xb1af,0xb476,0xd951,0xa4e2,0x0000,0xa47e,0xa4e3,0x0000, -0xc97d,0xa5b7,0xa5b6,0xa5b4,0xa5b5,0x0000,0x0000,0x0000, -0xa6ab,0xc9e9,0xc9eb,0xa6aa,0xc9e3,0x0000,0xc9e4,0x0000, -0xc9ea,0xc9e6,0xc9e8,0xa6a9,0xc9e5,0xc9ec,0xc9e7,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xa7e1,0xa7ea,0xa7e8, -0xcaf0,0xcaed,0xcaf5,0xa7e6,0xcaf6,0x0000,0xa7df,0xcaf3, -0x0000,0xa7e5,0xcaef,0xcaee,0xa7e3,0xcaf4,0xa7e4,0xa9d3, -0xa7de,0xcaf1,0x0000,0xcae7,0xa7db,0x0000,0xa7ee,0xcaec, -0xcaf2,0xa7e0,0xa7e2,0x0000,0xcae8,0x0000,0xcae9,0xcaea, -0x0000,0xa7ed,0xa7e7,0xa7ec,0xcaeb,0xa7eb,0xa7dd,0xa7dc, -0xa7e9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xa9e1,0xccbe,0xccb7,0xa9dc,0xa9ef,0xccb3,0xccba,0xccbc, -0xccbf,0xa9ea,0x0000,0xccbb,0xccb4,0xa9e8,0xccb8,0x0000, -0xccc0,0xa9d9,0x0000,0xccbd,0xa9e3,0xa9e2,0xccb6,0xa9d7, -0x0000,0x0000,0xa9d8,0x0000,0xa9d6,0x0000,0xa9ee,0xa9e6, -0xa9e0,0xa9d4,0xccb9,0xa9df,0xa9d5,0xa9e7,0xa9f0,0xced4, -0xa9e4,0xccb5,0xa9da,0xa9dd,0xa9de,0x0000,0xa9ec,0xa9ed, -0xa9eb,0xa9e5,0xa9e9,0xa9db,0xabf4,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xceda,0xac41,0xabf8,0xabfa,0xac40, -0xcee6,0xabfd,0xd1b1,0xaeb1,0xac43,0xced7,0xcedf,0xabfe, -0xcede,0xcedb,0xcee3,0xcee5,0xabf7,0xabfb,0xac42,0xaeb3, -0xcee0,0xabf9,0xac45,0xced9,0x0000,0x0000,0x0000,0xabfc, -0xaeb2,0xabf6,0x0000,0xced6,0xcedd,0xced5,0xced8,0xcedc, -0xd1b2,0xac44,0x0000,0xcee1,0xcee2,0xcee4,0xabf5,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xaec1,0xd1be,0xaebf,0xaec0,0xd1b4,0xd1c4,0x0000,0xaeb6, -0x0000,0x0000,0xd566,0xd1c6,0xd1c0,0x0000,0xd1b7,0x0000, -0xd1c9,0xd1ba,0xaebc,0xd57d,0xd1bd,0xaebe,0xaeb5,0x0000, -0xd1cb,0xd1bf,0xaeb8,0xd1b8,0xd1b5,0xd1b6,0xaeb9,0xd1c5, -0xd1cc,0xaebb,0xd1bc,0xd1bb,0xaec3,0xaec2,0xaeb4,0xaeba, -0xaebd,0xd1c8,0x0000,0x0000,0xd1c2,0xaeb7,0xd1b3,0xd1ca, -0xd1c1,0xd1c3,0xd1c7,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xd567,0x0000,0xb1b7, -0xb1cb,0xb1ca,0x0000,0xb1bf,0x0000,0xd579,0xd575,0xd572, -0xd5a6,0xb1ba,0xb1b2,0x0000,0x0000,0xd577,0xb4a8,0xb1b6, -0xd5a1,0x0000,0xb1cc,0xb1c9,0xd57b,0xd56a,0x0000,0x0000, -0xb1c8,0xd5a3,0xd569,0xb1bd,0xb1c1,0xd5a2,0x0000,0xd573, -0xb1c2,0xb1bc,0xd568,0x0000,0xb478,0xd5a5,0xd571,0xb1c7, -0xd574,0xd5a4,0xb1c6,0x0000,0xd952,0x0000,0xb1b3,0xd56f, -0xb1b8,0xb1c3,0x0000,0xb1be,0xd578,0xd56e,0xd56c,0xd57e, -0xb1b0,0xb1c4,0xb1b4,0xb477,0xd57c,0xb1b5,0x0000,0xb1b1, -0xb1c0,0xb1bb,0xb1b9,0xd570,0xb1c5,0xd56d,0xd57a,0xd576, -0xd954,0xd953,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xd56b,0xd964,0x0000, -0xb47a,0x0000,0xd96a,0xd959,0xd967,0xdd77,0xb47d,0xd96b, -0xd96e,0xb47c,0xd95c,0xd96d,0xd96c,0xb47e,0xd955,0xb479, -0xb4a3,0x0000,0xb4a1,0xd969,0x0000,0xd95f,0xb4a5,0xd970, -0xd968,0xd971,0xb4ad,0xb4ab,0xd966,0xd965,0x0000,0xd963, -0xd95d,0xb4a4,0x0000,0xb4a2,0xd1b9,0xd956,0x0000,0xddb7, -0xd957,0xb47b,0xb4aa,0xdd79,0x0000,0xb4a6,0xb4a7,0xd958, -0xd96f,0xdd78,0xd960,0xd95b,0xb4a9,0xd961,0xd95e,0x0000, -0x0000,0xb4ae,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -/* 0x6400 */ -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb770,0x0000, -0x0000,0xdd7c,0xddb1,0xddb6,0xddaa,0xb76c,0xddbb,0xb769, -0xdd7a,0x0000,0xdd7b,0xb762,0xb76b,0xdda4,0xb76e,0xb76f, -0xdda5,0x0000,0xddb2,0xddb8,0xb76a,0x0000,0xb764,0xdda3, -0xdd7d,0xddba,0xdda8,0xdda9,0xdd7e,0xddb4,0xddab,0xddb5, -0xddad,0x0000,0xb765,0xe1d9,0xb768,0xb766,0xddb9,0xddb0, -0xddac,0x0000,0x0000,0xdda1,0xba53,0xddaf,0xb76d,0xdda7, -0x0000,0xdda6,0x0000,0x0000,0x0000,0xb767,0xb763,0xe1ee, -0xddb3,0xddae,0x0000,0xdda2,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xe1e9,0x0000,0xe1da,0xe1e5,0x0000, -0xe1ec,0xba51,0xb4ac,0xe1ea,0xba4c,0x0000,0x0000,0x0000, -0xba4b,0xe1f1,0x0000,0xe1db,0xe1e8,0xe1dc,0xe1e7,0xba4f, -0xe1eb,0xd962,0x0000,0x0000,0x0000,0xe1f2,0xe1e3,0xba52, -0xe5ba,0xbcaf,0x0000,0xe1f0,0xe1ef,0xba54,0xe5ad,0xbcb0, -0xe5ae,0x0000,0xe1df,0xe1e0,0xe1dd,0xe1e2,0xe1de,0xe1f3, -0xba4e,0xbcb1,0xba50,0xba55,0x0000,0xe1e1,0x0000,0xe1ed, -0x0000,0x0000,0xe1e6,0x0000,0x0000,0xe5b1,0x0000,0xba4a, -0xbcb4,0xe9aa,0xe5b6,0xe5b5,0xe5b7,0x0000,0x0000,0xe5b4, -0xbcb5,0x0000,0xbcbb,0xbcb8,0x0000,0xbcb9,0xe5af,0xe5b2, -0xe5bc,0xbcc1,0xbcbf,0x0000,0xe5b3,0xd95a,0xbcb2,0xe5b9, -0xe5b0,0x0000,0xbcc2,0xe5b8,0xba4d,0xbcb7,0xe1e4,0x0000, -0x0000,0xbcba,0x0000,0xbcbe,0xbcc0,0xbcbd,0xbcbc,0x0000, -0xbcb6,0xe5bb,0xbcb3,0xbcc3,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xbed8,0xbed9,0xe9a9,0xbee2,0xbedf, -0x0000,0xbed6,0xbedd,0xe9ab,0xbedb,0xbed5,0x0000,0xbedc, -0x0000,0xe9a8,0xc0bb,0xbed7,0x0000,0xbede,0xc0ba,0xe9a7, -0xe9a6,0x0000,0xbee0,0x0000,0xbee1,0x0000,0xe9a5,0xe9a4, -0xc0bc,0xe9ae,0xbeda,0xe9ac,0x0000,0x0000,0x0000,0x0000, -0xc0bd,0x0000,0xc0c2,0xecea,0xecec,0x0000,0xc0bf,0x0000, -0xeced,0xece9,0x0000,0xeceb,0xc0c0,0xc0c3,0x0000,0xece8, -0xc0be,0xc0c1,0xc259,0xe9ad,0xc258,0x0000,0x0000,0xc25e, -0xefd4,0x0000,0xc25c,0xc25d,0xefd7,0xefd3,0xc25a,0xefd1, -0xc36b,0xefd5,0x0000,0xefd6,0xefd2,0x0000,0xc25b,0xf242, -0x0000,0xf245,0x0000,0x0000,0xf246,0xf244,0xf247,0xc36c, -0xf243,0x0000,0x0000,0xf44e,0xc464,0xf44d,0xf44c,0xf44b, -0xc463,0xc465,0x0000,0xf5cd,0xc4e2,0xc4e1,0x0000,0x0000, -0xf6e1,0xf6e0,0xf6e3,0xc5cb,0xc575,0xf7dd,0xf6e2,0x0000, -0x0000,0xf7dc,0xc5cd,0xc5cc,0xc5f3,0xf8a9,0xf8ef,0xa4e4, -0x0000,0x0000,0xd972,0xe9af,0x0000,0x0000,0xa6ac,0xcaf7, -0xa7f1,0xa7ef,0x0000,0xa7f0,0x0000,0xccc1,0xa9f1,0xac46, -0x0000,0xcee7,0x0000,0xcee8,0x0000,0xac47,0xd1ce,0x0000, -0xaec4,0xaec5,0xd1cd,0x0000,0x0000,0x0000,0x0000,0xb1d3, -0x0000,0xb1cf,0x0000,0xd5a7,0xb1d6,0xb1d5,0xb1ce,0xb1d1, -0xb1d4,0xb1d0,0x0000,0x0000,0xd976,0xb1cd,0xb4af,0x0000, -0x0000,0x0000,0xb4b1,0xb4b2,0xd975,0xd978,0xb4b0,0xd973, -0xd977,0x0000,0xd974,0x0000,0xb771,0x0000,0x0000,0xddbc, -0x0000,0x0000,0xba56,0xe1f4,0xbee3,0xbcc4,0xe5bd,0xbcc5, -0xbcc6,0xe5bf,0xe5be,0xe5c0,0xe9b1,0x0000,0x0000,0xe9b0, -0xecef,0xecee,0xc0c4,0xc0c5,0xf248,0x0000,0x0000,0xa4e5, -0x0000,0x0000,0x0000,0x0000,0xd979,0x0000,0x0000,0x0000, -0xb4b4,0xb4b3,0xddbd,0x0000,0xefd8,0xc4e3,0xf7de,0xa4e6, -0x0000,0xaec6,0x0000,0xb1d8,0xb1d7,0xd97a,0xd97b,0xb772, -0xe1f5,0xba57,0xe9b2,0x0000,0xa4e7,0xa5b8,0x0000,0xa9f2, -0xccc2,0x0000,0xcee9,0xac48,0xb1d9,0x0000,0xd97c,0xb4b5, -0xb773,0x0000,0xe5c1,0xe5c2,0x0000,0x0000,0xecf0,0xc25f, -0xf8f0,0xa4e8,0x0000,0xccc3,0xa9f3,0xac49,0x0000,0xceea, -0x0000,0xaec7,0xd1d2,0xd1d0,0xd1d1,0xaec8,0xd1cf,0x0000, -0x0000,0x0000,0x0000,0xb1db,0xb1dc,0xd5a8,0xb1dd,0xb1da, -0xd97d,0x0000,0xd97e,0xddbe,0x0000,0x0000,0xba59,0xba58, -0x0000,0x0000,0xecf1,0xefd9,0x0000,0xf24a,0xf249,0xf44f, -0x0000,0xc95e,0xac4a,0x0000,0x0000,0xa4e9,0xa5b9,0x0000, -0xa6ae,0xa6ad,0x0000,0x0000,0xa6af,0xa6b0,0xc9ee,0xc9ed, -0xcaf8,0xa7f2,0xcafb,0xcafa,0xcaf9,0xcafc,0x0000,0x0000, -0x0000,0x0000,0xa9f4,0xccc9,0xccc5,0xccce,0x0000,0x0000, -0xa9fb,0x0000,0xa9f9,0xccca,0xccc6,0xcccd,0xa9f8,0xaa40, -0xccc8,0xccc4,0xa9fe,0xcccb,0xa9f7,0xcccc,0xa9fa,0xa9fc, -0xccd0,0xcccf,0xccc7,0xa9f6,0xa9f5,0xa9fd,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xceef,0xcef5,0x0000,0xac50, -0xac4d,0xceec,0xcef1,0x0000,0xac53,0xac4b,0xcef0,0xac4e, -0xac51,0x0000,0x0000,0xcef3,0x0000,0xac4c,0xcef8,0xac4f, -0x0000,0xac52,0xceed,0xcef2,0xcef6,0xceee,0xceeb,0x0000, -0x0000,0xcef7,0xcef4,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xaed0,0xaec9,0xaecc,0x0000,0xaecf,0x0000,0xd1d5, -0x0000,0xaeca,0xd1d3,0x0000,0xaece,0x0000,0x0000,0xaecb, -0x0000,0xd1d6,0xaecd,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xd5ac,0xb1df,0xd5ab,0xd5ad,0xb1de,0xb1e3,0xd1d4, -0x0000,0xd5aa,0xd5ae,0x0000,0xb1e0,0xd5a9,0xb1e2,0x0000, -0xb1e1,0x0000,0xd9a7,0x0000,0xd9a2,0x0000,0xb4b6,0xb4ba, -0xb4b7,0xd9a5,0xd9a8,0x0000,0xb4b8,0x0000,0xb4b9,0xb4be, -0xddc7,0xd9a6,0xb4bc,0xd9a3,0xd9a1,0x0000,0xb4bd,0x0000, -0xd9a4,0x0000,0x0000,0x0000,0xb779,0x0000,0xddbf,0xb776, -0xb777,0xb775,0xddc4,0xddc3,0xddc0,0xb77b,0x0000,0x0000, -0xddc2,0xb4bb,0x0000,0x0000,0xddc6,0xddc1,0xb778,0xb774, -0xb77a,0xddc5,0x0000,0x0000,0x0000,0xba5c,0x0000,0xe1f8, -0xe1f7,0xe1f6,0xba5a,0x0000,0x0000,0x0000,0x0000,0x0000, -0xba5b,0xe5c5,0xe5c8,0xbcc8,0x0000,0x0000,0xbcc7,0xe5c9, -0xe5c4,0xbcca,0xe5c6,0x0000,0xbcc9,0xe5c3,0x0000,0xe5c7, -0xbee9,0xbee6,0xe9bb,0xe9ba,0x0000,0xe9b9,0xe9b4,0x0000, -0xe9b5,0x0000,0x0000,0x0000,0xbee7,0x0000,0xbee4,0xbee8, -0xe9b3,0xbee5,0xe9b6,0xe9b7,0xe9bc,0x0000,0x0000,0xe9b8, -0x0000,0x0000,0xecf2,0x0000,0x0000,0x0000,0xc0c7,0x0000, -0xefdc,0xc0c6,0xefda,0xefdb,0xc260,0xc36e,0xf24b,0x0000, -0xc36d,0x0000,0x0000,0xf451,0xf452,0x0000,0xc466,0x0000, -0xf450,0xc4e4,0x0000,0xf7df,0xc5ce,0xf8aa,0xf8ab,0x0000, -0xa4ea,0x0000,0xa6b1,0xa6b2,0xa7f3,0x0000,0xccd1,0xac54, -0xaed1,0xb1e4,0x0000,0x0000,0xb0d2,0x0000,0xb4bf,0xb4c0, -0xb3cc,0xd9a9,0x0000,0xb77c,0xe1fa,0xe1f9,0x0000,0x0000, -0xa4eb,0xa6b3,0xccd2,0xaa42,0x0000,0xaa41,0x0000,0xcef9, -0xcefa,0x0000,0xd1d7,0xd1d8,0xaed2,0xaed3,0x0000,0xaed4, -0xd5af,0x0000,0x0000,0xb1e6,0x0000,0xb4c2,0x0000,0xb4c1, -0xddc8,0xdf7a,0xe1fb,0xe9bd,0x0000,0x0000,0xc261,0xc467, -0xa4ec,0x0000,0xa5bc,0xa5bd,0xa5bb,0xa5be,0xa5ba,0x0000, -0x0000,0xa6b6,0x0000,0xc9f6,0xa6b5,0xa6b7,0x0000,0x0000, -0xc9f1,0xc9f0,0xc9f3,0xc9f2,0xc9f5,0xa6b4,0xc9ef,0xc9f4, -0x0000,0x0000,0x0000,0x0000,0x0000,0xcafd,0xa7fd,0xcafe, -0xcb43,0xa7fc,0x0000,0xcb47,0xcb42,0xcb45,0xa7f5,0xa7f6, -0xa7f7,0xa7f8,0x0000,0xa840,0x0000,0xcb41,0xa7fa,0xa841, -0x0000,0xcb40,0xcb46,0x0000,0xa7f9,0xcb44,0xa7fb,0xa7f4, -0xa7fe,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xaa57,0x0000,0xccd4,0xaa43,0x0000,0xaa4d, -0xaa4e,0xaa46,0xaa58,0xaa48,0xccdc,0xaa53,0xccd7,0xaa49, -0xcce6,0xcce7,0xccdf,0xccd8,0xaa56,0xcce4,0xaa51,0xaa4f, -0x0000,0xcce5,0x0000,0xcce3,0xccdb,0xccd3,0xccda,0xaa4a, -0x0000,0xaa50,0x0000,0xaa44,0xccde,0xccdd,0xccd5,0x0000, -0xaa52,0xcce1,0xccd6,0xaa55,0xcce8,0xaa45,0x0000,0xaa4c, -0xccd9,0xcce2,0xaa54,0x0000,0xaa47,0xaa4b,0x0000,0xcce0, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcf5b,0xac5c, -0xac69,0x0000,0xcf56,0xcf4c,0xac62,0xcf4a,0xac5b,0xcf45, -0xac65,0xcf52,0xcefe,0xcf41,0x0000,0x0000,0x0000,0x0000, -0xcf44,0xcefb,0xcf51,0xcf61,0xac60,0xcf46,0xcf58,0x0000, -0xcefd,0xcf5f,0xcf60,0xcf63,0xcf5a,0xcf4b,0xcf53,0xac66, -0xac59,0xac61,0xac6d,0xac56,0xac58,0x0000,0x0000,0x0000, -0xcf43,0xac6a,0xac63,0xcf5d,0xcf40,0xac6c,0xac67,0xcf49, -0x0000,0x0000,0xac6b,0xcf50,0xcf48,0xac64,0xcf5c,0xcf54, -0x0000,0xac5e,0xcf62,0xcf47,0xac5a,0xcf59,0xcf4f,0xac5f, -0xcf55,0xac57,0xcefc,0xac68,0xaee3,0xac5d,0xcf4e,0xcf4d, -0xcf42,0x0000,0xcf5e,0x0000,0xcf57,0x0000,0x0000,0xac55, -/* 0x6800 */ -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xd1ec,0xaeea,0xd1ed,0x0000,0xd1e1,0xaedf, -0xaeeb,0x0000,0xd1da,0x0000,0xd1e3,0xd1eb,0x0000,0xd1d9, -0xd1f4,0xaed5,0x0000,0x0000,0x0000,0xd1f3,0xd1ee,0x0000, -0xd1ef,0xaedd,0xaee8,0xd1e5,0x0000,0xd1e6,0xd1f0,0xd1e7, -0x0000,0xd1e2,0xd1dc,0xd1dd,0xd1ea,0xd1e4,0x0000,0x0000, -0xaed6,0xaeda,0xd1f2,0xd1de,0xaee6,0xaee2,0x0000,0x0000, -0xaee5,0xaeec,0xaedb,0xaee7,0xd1e9,0xaee9,0xaed8,0x0000, -0xaed7,0xd1db,0x0000,0xd1df,0xaee0,0xd1f1,0xd1e8,0xd1e0, -0xaee4,0xaee1,0x0000,0xaed9,0xaedc,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xd5c4,0x0000,0xd5b4,0xd5b5,0xd5b9, -0x0000,0xd5c8,0xd5c5,0x0000,0xd5be,0xd5bd,0xb1ed,0xd5c1, -0xd5d0,0xd5b0,0x0000,0xd5d1,0xd5c3,0xd5d5,0xd5c9,0xb1ec, -0xd5c7,0xb1e7,0xb1fc,0xb1f2,0x0000,0xb1f6,0xb1f5,0xd5b1, -0x0000,0xd5ce,0xd5d4,0xd5cc,0xd5d3,0x0000,0x0000,0xd5c0, -0xd5b2,0xd5d2,0xd5c2,0xb1ea,0xb1f7,0x0000,0xd5cb,0xb1f0, -0x0000,0x0000,0x0000,0xd5ca,0xd5b3,0xb1f8,0x0000,0xb1fa, -0xd5cd,0xb1fb,0xb1e9,0xd5ba,0xd5cf,0x0000,0x0000,0xb1ef, -0xb1f9,0xd5bc,0xd5c6,0xd5b7,0xd5bb,0xb1f4,0xd5b6,0xb1e8, -0xb1f1,0xb1ee,0xd5bf,0xaede,0xd9c0,0xb1eb,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xb1f3,0x0000,0xd9c3,0xd9d9, -0xd9ce,0xb4d6,0x0000,0xb4d1,0xd9bd,0xb4d2,0xd9cd,0x0000, -0xd9c6,0xd9d3,0xb4ce,0xd9ab,0xd9d5,0xb4c4,0xd9b3,0xb4c7, -0xb4c6,0x0000,0xb4d7,0x0000,0xd9ad,0xd9cf,0xd9d0,0xb4c9, -0xb4c5,0xd9bb,0x0000,0xb4d0,0xd9b6,0x0000,0xd9d1,0xb4cc, -0xd9c9,0xd9d6,0xd9b0,0xd9b5,0xd9af,0x0000,0xb4cb,0xd9c2, -0xddde,0xd9b1,0xb4cf,0xd9ba,0xd9d2,0xb4ca,0xd9b7,0xd9b4, -0xd9c5,0xb4cd,0xb4c3,0xb4d9,0xd9c8,0xd9c7,0x0000,0x0000, -/* 0x6900 */ -0x0000,0x0000,0x0000,0x0000,0xd9ac,0xb4c8,0xd9d4,0xd9bc, -0xd9be,0x0000,0xd9cb,0xd9ca,0xd9aa,0xb4d3,0xb4d5,0xd9b2, -0xd9b9,0xd9c1,0xb4d4,0xd9b8,0xd9c4,0xd9d7,0x0000,0xd9cc, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xd9d8,0x0000,0x0000, -0x0000,0x0000,0xd9ae,0x0000,0x0000,0x0000,0x0000,0xddf2, -0xb7a6,0x0000,0xddf0,0xdddb,0xdde0,0xddd9,0x0000,0xddec, -0xddcb,0xddd2,0x0000,0xddea,0xddf4,0xdddc,0x0000,0xddcf, -0xdde2,0xdde7,0xddd3,0x0000,0xdde4,0xddd0,0x0000,0x0000, -0xddd7,0xddd8,0xb7a8,0xddeb,0xdde9,0x0000,0xddcc,0xddee, -0x0000,0xddef,0xddf1,0xb7ac,0xb7a4,0x0000,0xd5b8,0xddd4, -0xdde6,0xddd5,0xb7a1,0xb7b1,0xdded,0xb7af,0xb7ab,0xddca, -0xb7a3,0x0000,0xddcd,0xb7b0,0x0000,0xdddd,0xddc9,0x0000, -0xb7a9,0xdde1,0xddd1,0xb7aa,0xddda,0xb77e,0xb4d8,0xdde3, -0xd9bf,0xddce,0x0000,0x0000,0xdde8,0xb7a5,0xdde5,0xb7a2, -0xdddf,0xb7ad,0xddd6,0xddf3,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xb7a7,0xdec6,0x0000,0x0000,0xb7ae,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xe24a,0xe248,0x0000, -0xe25e,0xe246,0x0000,0xe258,0xb77d,0xba5f,0xe242,0xe25d, -0x0000,0xe247,0xe255,0xba64,0xba5d,0x0000,0xe25b,0x0000, -0xe240,0xe25a,0x0000,0xba6f,0xe251,0xe261,0xba6d,0xe249, -0xba5e,0xe24b,0xe259,0xba67,0xe244,0xba6b,0xba61,0xe24d, -0xe243,0xe1fc,0x0000,0xe257,0xba68,0xe260,0xe1fd,0xba65, -0x0000,0xe253,0x0000,0xba66,0xe245,0xe250,0xe24c,0xe24e, -0x0000,0xba60,0xe25f,0xba6e,0xe24f,0x0000,0xe262,0x0000, -0x0000,0xe1fe,0xe254,0xba63,0xba6c,0xba6a,0xe241,0xe256, -0xba69,0x0000,0x0000,0xba62,0xe252,0x0000,0x0000,0x0000, -0x0000,0xe25c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xe5d5,0x0000,0xe5d1,0xe5cd,0xe5e1,0xe5de, -0xbccd,0x0000,0x0000,0xe5e5,0xe5d4,0xbcd8,0xe5db,0x0000, -0x0000,0xe5d0,0xe5da,0xbcd5,0xe5ee,0x0000,0xe5eb,0xe5dd, -0xe5ce,0x0000,0x0000,0xe5e2,0xe5e4,0xbcd1,0xe5d8,0xe5d3, -0xe5ca,0xbcce,0xbcd6,0x0000,0xe5e7,0xbcd7,0xe5cb,0xe5ed, -0xe5e0,0xe5e6,0xbcd4,0x0000,0x0000,0xe5e3,0x0000,0xe5ea, -0x0000,0xbcd9,0x0000,0xbcd3,0xe5dc,0xe5cf,0xe5ef,0xe5cc, -0xe5e8,0xbcd0,0x0000,0xe5d6,0x0000,0xe5d7,0xbccf,0xbccc, -0xe5d2,0xbcd2,0x0000,0xbccb,0x0000,0xe5e9,0xe5ec,0xe5d9, -0xe9ca,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xe9c2,0x0000,0xe9be,0xbef6,0x0000,0x0000, -0xbeeb,0xbef0,0xbeec,0xe9cc,0xe9d7,0xbeea,0xe9c4,0xe9cd, -0xe5df,0xe9ce,0x0000,0x0000,0xbef1,0x0000,0xe9dd,0xbef5, -0xbef8,0xe9c0,0x0000,0xbef4,0x0000,0xe9db,0xe9dc,0xe9d2, -0xe9d1,0xe9c9,0x0000,0x0000,0xe9d3,0xe9da,0xe9d9,0x0000, -0xbeef,0xbeed,0xe9cb,0xe9c8,0x0000,0xe9c5,0xe9d8,0xbef7, -0xe9d6,0xbef3,0xbef2,0x0000,0xe9d0,0x0000,0xe9bf,0xe9c1, -0xe9c3,0xe9d5,0xe9cf,0xbeee,0x0000,0xe9c6,0x0000,0xe9d4, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe9c7,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc0cf,0xed45, -0xc0c8,0xecf5,0x0000,0xed41,0xc0ca,0xed48,0x0000,0xecfc, -0x0000,0xecf7,0x0000,0x0000,0xed49,0xecf3,0xecfe,0x0000, -0xc0d1,0xed44,0xed4a,0xecfd,0xc0c9,0xed40,0xecf4,0xc0d0, -0x0000,0x0000,0xed47,0xecf9,0xc0cc,0x0000,0xecfb,0xecf8, -0xc0d2,0xecfa,0xc0cb,0xc0ce,0xed43,0xecf6,0xed46,0x0000, -0xed42,0x0000,0x0000,0x0000,0xc263,0xefe7,0xc268,0xc269, -0x0000,0x0000,0x0000,0xc262,0xefe6,0x0000,0xefe3,0xefe4, -0xc266,0xefde,0xefe2,0xc265,0x0000,0xefdf,0x0000,0x0000, -0x0000,0x0000,0xc267,0xc264,0x0000,0xefdd,0xefe1,0xefe5, -0x0000,0x0000,0x0000,0xf251,0xf24e,0xf257,0x0000,0xf256, -0xf254,0xf24f,0x0000,0xc372,0x0000,0x0000,0x0000,0x0000, -0x0000,0xf250,0xc371,0xc0cd,0xf253,0xc370,0xf258,0xf252, -0xf24d,0xefe0,0x0000,0x0000,0x0000,0xc36f,0x0000,0xf24c, -0xf456,0x0000,0xf455,0xf255,0xc468,0x0000,0xf459,0xf45a, -0xf454,0xf458,0x0000,0xf453,0x0000,0x0000,0x0000,0x0000, -0xf5d1,0xf457,0xc4e7,0xc4e5,0xf5cf,0x0000,0x0000,0x0000, -0xf5d2,0x0000,0xf5ce,0xf5d0,0xc4e6,0x0000,0x0000,0x0000, -0xf6e5,0xf6e6,0xc576,0xf6e4,0x0000,0x0000,0x0000,0xf7e2, -0xc5cf,0xf7e0,0xf7e1,0xf8ac,0x0000,0x0000,0xc656,0xf8f3, -0xf8f1,0xf8f2,0xf8f4,0x0000,0x0000,0x0000,0xf9bb,0x0000, -0xa4ed,0xa6b8,0x0000,0xaa59,0x0000,0xcce9,0x0000,0x0000, -0xcf64,0x0000,0x0000,0x0000,0xd1f5,0xd1f7,0x0000,0xd1f6, -0x0000,0xd1f8,0xb1fd,0xd5d7,0xd1f9,0x0000,0xd5d6,0xd5d8, -0xd5d9,0xd9da,0xb4db,0xd9db,0xd9dd,0xb4dc,0xb4da,0xd9dc, -0x0000,0xddfa,0xddf8,0xddf7,0x0000,0xddf6,0xddf5,0xb7b2, -0xddf9,0xba70,0xe263,0xe265,0xba71,0xe264,0xbcdb,0x0000, -0xbcda,0xe5f0,0x0000,0x0000,0xe9df,0xe9de,0xe9e0,0x0000, -0x0000,0xbef9,0x0000,0xed4b,0xc0d3,0x0000,0xefe8,0xc26a, -0xf259,0xc577,0xa4ee,0xa5bf,0xa6b9,0xa842,0xaa5a,0xaa5b, -0x0000,0x0000,0xac6e,0x0000,0x0000,0xd1fa,0x0000,0x0000, -0x0000,0x0000,0xb7b3,0x0000,0x0000,0x0000,0xe6d1,0xbefa, -0xc26b,0xa4ef,0x0000,0xa6ba,0x0000,0x0000,0xcceb,0xaa5c, -0xccea,0x0000,0xcf65,0xac6f,0xcf66,0x0000,0xac70,0x0000, -0xd1fc,0xaeee,0xaeed,0x0000,0xd5de,0xd5dc,0xd5dd,0xd5db, -0x0000,0xd5da,0x0000,0x0000,0xd9de,0xd9e1,0xb4de,0xd9df, -0xb4dd,0xd9e0,0x0000,0xddfb,0x0000,0x0000,0xe266,0xe267, -0xe268,0x0000,0xe5f3,0xe5f2,0xbcdc,0xe5f1,0xe5f4,0xe9e1, -0x0000,0x0000,0xe9e2,0xe9e3,0x0000,0xed4c,0xc0d4,0xc26c, -0xf25a,0x0000,0xc4e8,0xc95f,0x0000,0xac71,0xcf67,0xaeef, -0x0000,0x0000,0xb1fe,0x0000,0xb4df,0xd9e2,0x0000,0xb7b5, -0xb7b4,0x0000,0x0000,0xe269,0xe26a,0xbcdd,0xbcde,0xe9e5, -0xe9e4,0xefe9,0xf7e3,0xa4f0,0xc960,0xa5c0,0x0000,0xa843, -0xcb48,0x0000,0xac72,0xb7b6,0xa4f1,0x0000,0xcf68,0xac73, -0xcf69,0x0000,0xc0d5,0xa4f2,0x0000,0x0000,0xccec,0x0000, -0xcf6a,0x0000,0xd242,0xd241,0xd1fe,0x0000,0xd1fd,0xd243, -0xd240,0x0000,0x0000,0xb240,0xb241,0x0000,0x0000,0xb4e0, -0xd9e3,0x0000,0xd9e4,0xd9e5,0x0000,0x0000,0x0000,0xde41, -0xde42,0xde40,0x0000,0xddfd,0xddfe,0xb7b7,0xe26b,0xe5f7, -0xe5f6,0xe5f5,0xe5f8,0xe9e7,0xe9e6,0xbefb,0xe9e8,0x0000, -0xc0d6,0xed4d,0x0000,0xefea,0xf25b,0xf6e7,0x0000,0xa4f3, -0xa5c2,0xa5c1,0x0000,0xaa5d,0xc961,0xc97e,0xa6bb,0x0000, -0xc9f7,0xcb49,0xcb4a,0xaa5e,0x0000,0xcced,0x0000,0xac74, -0xcf6b,0xcf6c,0x0000,0xaef0,0xaef4,0xd244,0xaef3,0xaef1, -0xaef2,0x0000,0xd5df,0xb242,0xb4e3,0x0000,0xb4e1,0xb4e2, -0xd9e6,0x0000,0x0000,0xba72,0xa4f4,0x0000,0xc9a1,0x0000, -0xa5c3,0x0000,0x0000,0xc9a4,0x0000,0x0000,0xa5c6,0xc9a3, -0xa5c5,0xa5c4,0xa844,0xc9a2,0x0000,0x0000,0xc9f8,0x0000, -0x0000,0x0000,0xc9fc,0xc9fe,0xca40,0xa6c5,0xa6c6,0xc9fb, -0xa6c1,0x0000,0xc9f9,0x0000,0xc9fd,0xa6c2,0x0000,0xa6bd, -0x0000,0xa6be,0x0000,0xa6c4,0xc9fa,0xa6bc,0xa845,0xa6bf, -0xa6c0,0xa6c3,0x0000,0x0000,0x0000,0xcb5b,0xcb59,0xcb4c, -0xa851,0xcb53,0xa84c,0xcb4d,0x0000,0xcb55,0x0000,0xcb52, -0xa84f,0xcb51,0xa856,0xcb5a,0xa858,0x0000,0xa85a,0x0000, -0xcb4b,0x0000,0xa84d,0xcb5c,0x0000,0xa854,0xa857,0x0000, -0xcd45,0xa847,0xa85e,0xa855,0xcb4e,0xa84a,0xa859,0xcb56, -0xa848,0xa849,0xcd43,0xcb4f,0xa850,0xa85b,0xcb5d,0xcb50, -0xa84e,0x0000,0xa853,0xccee,0xa85c,0xcb57,0xa852,0x0000, -0xa85d,0xa846,0xcb54,0xa84b,0xcb58,0xcd44,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xaa6a,0xaa7a,0xccf5,0xaa71,0x0000, -0xcd4b,0xaa62,0x0000,0xaa65,0xcd42,0x0000,0xccf3,0xccf7, -0xaa6d,0xaa6f,0xccfa,0xaa76,0xaa68,0xaa66,0xaa67,0xaa75, -0xcd47,0xaa70,0xccf9,0xccfb,0xaa6e,0xaa73,0xccfc,0xcd4a, -0x0000,0xac75,0xaa79,0x0000,0xaa63,0xcd49,0x0000,0xcd4d, -0xccf8,0xcd4f,0xcd40,0xaa6c,0xccf4,0xaa6b,0xaa7d,0xaa72, -0x0000,0xccf2,0xcf75,0xaa78,0xaa7c,0xcd41,0xcd46,0x0000, -0xaa7e,0xaa77,0xaa69,0xaa5f,0x0000,0xaa64,0x0000,0xccf6, -0xaa60,0xcd4e,0x0000,0xccf0,0xccef,0xccfd,0xccf1,0xaa7b, -0xaef5,0xaa74,0xccfe,0xaa61,0x0000,0xaca6,0x0000,0x0000, -0x0000,0xcd4c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xcf7c,0xcfa1,0x0000,0xcfa4,0xcf77,0x0000,0x0000,0xcfa7, -0xcfaa,0xcfac,0xcf74,0xac76,0xac7b,0xd249,0xacad,0xcfa5, -0xcfad,0xcf7b,0xcf73,0x0000,0x0000,0x0000,0xd264,0xac7e, -0xcfa2,0xcf78,0xcf7a,0xaca5,0x0000,0xcf7d,0xac7d,0xcf70, -0xcfa8,0x0000,0xcfab,0x0000,0x0000,0xac7a,0x0000,0xaca8, -0xcf6d,0xacaa,0xac78,0xacae,0xcfa9,0xcf6f,0xacab,0xd25e, -0xcd48,0xac7c,0xac77,0xcf76,0xcf6e,0xacac,0xaca4,0xcfa3, -0xaca9,0xaca7,0xcf79,0xaca1,0xcf71,0xaca2,0xaca3,0xcf72, -0xcfa6,0xac79,0xcf7e,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xd24c,0xaefd,0xaf43,0x0000,0x0000,0x0000,0xd255,0xd25b, -0xd257,0xd24a,0xd24d,0xd246,0xd247,0xaf4a,0xaefa,0xd256, -0xd25f,0xaf45,0xaef6,0x0000,0xaf40,0xd24e,0xaf42,0xd24f, -0xd259,0x0000,0x0000,0x0000,0xaf44,0xd268,0xd248,0xaefc, -0xaefb,0xaf48,0xd245,0xd266,0xd25a,0xd267,0xd261,0xd253, -0xd262,0x0000,0xd25c,0xd265,0xd263,0xaf49,0xd254,0xaef9, -0xaef8,0xaf41,0xaf47,0xd260,0xaf46,0xd251,0xb243,0x0000, -0xd269,0xd250,0xd24b,0xaefe,0xaf4b,0xaef7,0x0000,0xd258, -0xd25d,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xb265,0xd5e1,0xd5e5,0x0000,0xb252,0xb250, -0x0000,0x0000,0xb247,0xd5e3,0xd5e2,0xb25b,0x0000,0xd5e8, -0xb255,0x0000,0xd5fa,0xd647,0xb244,0xd5f7,0xd5f0,0xb267, -0xd5e0,0x0000,0xd5fc,0x0000,0xb264,0xb258,0xb263,0xb24e, -0xd5ec,0xd5fe,0xd5f6,0xb24f,0xb249,0xd645,0x0000,0xd5fd, -0xd640,0xb251,0xb259,0xd642,0xd5ea,0xd5fb,0xd5ef,0xd644, -0xb25e,0xb246,0xb25c,0xd5f4,0xd5f2,0xd5f3,0xb253,0xd5ee, -0xd5ed,0xb248,0xd5e7,0xd646,0xb24a,0xd5f1,0xb268,0x0000, -0xb262,0xd5e6,0xb25f,0xb25d,0xb266,0xd5f8,0xb261,0xd252, -0xd5f9,0xb260,0xd641,0xb245,0xd5f5,0xb257,0xd5e9,0xb256, -0x0000,0xb254,0xb24c,0xb24b,0xd9e7,0xd643,0x0000,0x0000, -0xd5eb,0x0000,0x0000,0xd9fc,0x0000,0xb24d,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xb541,0xb25a,0xb4ee,0xd9f6,0xb4fc,0x0000,0xd9ea, -0xb4eb,0xb4e7,0xda49,0xb4ed,0xb4f1,0xb4ec,0xb4f5,0xda4d, -0xda44,0x0000,0x0000,0xd9f1,0xb4fa,0xb4f4,0xd9fd,0xb4e4, -0xda4a,0xda43,0xb4e8,0xd9f7,0xb4f7,0xda55,0xda56,0x0000, -0xb4e5,0xda48,0xb4f9,0xd9fb,0xd9ed,0xd9ee,0xb4fd,0xd9f2, -0xd9f9,0xd9f3,0x0000,0xb4fb,0xb544,0xd9ef,0xd9e8,0xd9e9, -0x0000,0xd9eb,0xb4ea,0xd9f8,0x0000,0xb4f8,0xb542,0x0000, -0x0000,0xd9fa,0xda53,0xda4b,0xb4e6,0xda51,0xb4f2,0x0000, -0xb4f0,0x0000,0xda57,0xb4ef,0xda41,0xd9f4,0xd9fe,0xb547, -0xda45,0xda42,0xd9f0,0xb543,0xda4f,0xda4c,0xda54,0xb4e9, -0xda40,0xb546,0x0000,0xda47,0x0000,0x0000,0xb4f3,0xb4f6, -0x0000,0xda46,0xb545,0xd9f5,0xd5e4,0x0000,0x0000,0xda50, -0xda4e,0xda52,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xd9ec,0xb540,0x0000,0x0000,0x0000,0xde61,0xde60,0xde46, -0xb7bd,0x0000,0xde5f,0xde49,0xde4a,0x0000,0xb7c7,0xde68, -0xb7c2,0xde5e,0x0000,0xde43,0xb7c8,0xb7be,0xde52,0xde48, -0xde4b,0xde63,0xb7b8,0xde6a,0xde62,0xb7c1,0xde57,0xb7cc, -0x0000,0x0000,0xb7cb,0xb7c5,0x0000,0x0000,0xde69,0xb7b9, -0xde55,0xde4c,0xde59,0xde65,0xb7cd,0x0000,0xb7bb,0xde54, -0x0000,0xde4d,0xb7c4,0x0000,0xb7c3,0xde50,0xde5a,0xde64, -0xde47,0xde51,0xb7bc,0xde5b,0xb7c9,0xb7c0,0xde4e,0xb7bf, -0xde45,0xde53,0xde67,0xb4fe,0xbab0,0xde56,0xe26c,0xde58, -0xde66,0xb7c6,0xde4f,0xb7ba,0xb7ca,0xbcf0,0xde44,0x0000, -0xde5d,0x0000,0x0000,0x0000,0xde5c,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xe2aa,0xbaad,0xe27d,0xe2a4,0xbaa2, -0x0000,0xe26e,0xbaaf,0x0000,0xba77,0xe26d,0xe2b0,0xbab1, -0xe271,0xe2a3,0x0000,0xe273,0xe2b3,0xe2af,0xba75,0xbaa1, -0xe653,0xbaae,0xba7d,0xe26f,0x0000,0xe2ae,0xbaa3,0xe2ab, -0xe2b8,0xe275,0xe27e,0x0000,0x0000,0xe2b6,0xe2ac,0xba7c, -0x0000,0x0000,0xe27c,0xba76,0xba74,0xbaa8,0x0000,0x0000, -0xe27a,0xe277,0xe278,0x0000,0xe2b2,0x0000,0xe2b7,0xe2b5, -0xba7a,0xe2b9,0xba7e,0xbaa7,0x0000,0xe270,0xe5fa,0xe279, -0x0000,0xba78,0xbaac,0xbaa9,0xba7b,0xe2a5,0xe274,0xbaaa, -0xe2a7,0xbaa4,0xbaa6,0xba73,0x0000,0xe2a9,0xe2a1,0xe272, -0xbaa5,0xe2b1,0xe2b4,0xe27b,0xe2a8,0x0000,0xba79,0xbcdf, -0xe2a6,0xe5f9,0x0000,0xe2ad,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe276,0xe644, -0xe64e,0xbce2,0xe64d,0xe659,0xbce4,0xe64b,0x0000,0xe64f, -0xbcef,0x0000,0xe646,0xbce7,0x0000,0xe652,0xe9f0,0xbcf3, -0xbcf2,0xe654,0xe643,0xe65e,0xbced,0x0000,0xbce3,0xe657, -0x0000,0xe65b,0xe660,0xe655,0xe649,0xbce6,0xbce9,0xbcf1, -0xbcec,0x0000,0xe64c,0xe2a2,0x0000,0x0000,0xe648,0xe65f, -0xbce8,0x0000,0xbceb,0xe661,0xbce0,0xe656,0xe5fb,0xe65c, -0xc0df,0x0000,0xe64a,0x0000,0xbce1,0xe645,0xbce5,0xe5fc, -0xbaab,0xe641,0x0000,0xe65a,0xe642,0xe640,0xbcea,0x0000, -0xe658,0x0000,0xe5fe,0xe651,0xe650,0xe65d,0xe647,0xbcee, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe9f3,0x0000, -0xbf49,0xbefe,0xea40,0xe9eb,0xbf41,0xe9f7,0xbf48,0xbf43, -0xe9f5,0xed4f,0xe9fb,0xea42,0xe9fa,0xe9e9,0xe9f8,0xea44, -0xea46,0xbefd,0xea45,0xbf44,0xbf4a,0x0000,0xbf47,0x0000, -0xe9fe,0xbf46,0xe9f9,0x0000,0xe9ed,0xe9f2,0x0000,0xe9fd, -0xbf45,0xbf42,0xbefc,0xbf40,0xe9f1,0x0000,0xe5fd,0xe9ec, -0xe9ef,0xea41,0xe9f4,0xe9ea,0xed4e,0xea43,0xe9ee,0xe9fc, -0x0000,0x0000,0x0000,0x0000,0xed51,0xc0e3,0x0000,0x0000, -0xc0d7,0x0000,0x0000,0xc0db,0xed53,0xed59,0xed57,0xc0d9, -0xc0da,0xc0e1,0xed5a,0xed52,0xc0dc,0x0000,0xed56,0xed55, -0xed5b,0xc0e2,0x0000,0xc0dd,0xc0e0,0xed54,0xc0e4,0xc0de, -0xc0e5,0xc0d8,0xed58,0x0000,0xed50,0x0000,0x0000,0xeff7, -0x0000,0x0000,0xc271,0xeff4,0xeff6,0x0000,0xc26f,0xeff2, -0xeff3,0xefee,0x0000,0x0000,0xe9f6,0xefef,0xc270,0xefeb, -0x0000,0xc26d,0xeff8,0xc26e,0xefec,0xefed,0xeff1,0xc273, -0x0000,0xc272,0x0000,0x0000,0xeff0,0xc378,0xf25f,0xf265, -0xc379,0xf25c,0xc376,0xc373,0xf267,0xc377,0x0000,0xc374, -0xf25e,0xf261,0xf262,0xf263,0xf266,0x0000,0xeff5,0xf25d, -0xc375,0xf264,0xf268,0xf260,0x0000,0x0000,0x0000,0xf45d, -0xc46a,0xf460,0xc46b,0xf468,0xf45f,0xf45c,0x0000,0xf45e, -0xf462,0xf465,0xf464,0xf467,0xf45b,0x0000,0xc469,0xf463, -0xf466,0xf469,0xf461,0xf5d3,0xf5d4,0xf5d8,0xf5d9,0x0000, -0xf5d6,0xf5d7,0xf5d5,0x0000,0xc4e9,0x0000,0x0000,0x0000, -0x0000,0xc578,0xf6eb,0x0000,0x0000,0xf6e8,0xf6e9,0xf6ea, -0xc579,0x0000,0xf7e5,0xf7e4,0x0000,0xf8af,0xc5f4,0xf8ad, -0xf8b0,0xf8ae,0xf8f5,0xc657,0xc665,0xf9a3,0xf96c,0x0000, -0xf9a2,0xf9d0,0xf9d1,0xa4f5,0x0000,0x0000,0x0000,0x0000, -0xa6c7,0xca41,0x0000,0x0000,0xcb5e,0x0000,0xa85f,0x0000, -0xa862,0x0000,0xcb5f,0x0000,0xa860,0xa861,0x0000,0x0000, -0x0000,0x0000,0xcd58,0xcd5a,0xcd55,0xcd52,0xcd54,0x0000, -0x0000,0x0000,0xaaa4,0x0000,0x0000,0x0000,0xaaa2,0x0000, -0x0000,0xcd56,0xaaa3,0xcd53,0xcd50,0xaaa1,0xcd57,0x0000, -0xcd51,0xaaa5,0xcd59,0x0000,0x0000,0x0000,0x0000,0xcfaf, -0x0000,0xcfb3,0x0000,0x0000,0xacb7,0x0000,0x0000,0x0000, -0x0000,0xcfb6,0x0000,0xacaf,0xacb2,0xacb4,0xacb6,0xacb3, -0xcfb2,0xcfb1,0x0000,0xacb1,0xcfb4,0xcfb5,0x0000,0xcfae, -0xacb5,0x0000,0xacb0,0x0000,0x0000,0x0000,0xcfb0,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xd277,0xd278,0xd279, -0xaf50,0x0000,0xaf4c,0xd26e,0x0000,0xd276,0xd27b,0xaf51, -0x0000,0xd26c,0xd272,0xd26b,0xd275,0x0000,0x0000,0xd271, -0xaf4d,0xaf4f,0xd27a,0x0000,0xd26a,0xd26d,0xd273,0x0000, -0xd274,0xd27c,0xd270,0x0000,0xaf4e,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xb26d, -0xd64e,0x0000,0x0000,0xd650,0xd64c,0x0000,0xd658,0xd64a, -0xd657,0xb269,0xd648,0xda5b,0xd652,0xb26c,0x0000,0xd653, -0xd656,0x0000,0xd65a,0x0000,0xd64f,0x0000,0xd654,0x0000, -0x0000,0xb26a,0xb26b,0xd659,0xd64d,0xd649,0xd65b,0x0000, -0xd651,0x0000,0x0000,0xd655,0x0000,0x0000,0x0000,0xd64b, -0x0000,0xb548,0xb549,0xda65,0xb54f,0x0000,0xda59,0xda62, -0xda58,0xb54c,0xda60,0xda5e,0x0000,0xda5f,0xb54a,0x0000, -0xda63,0x0000,0x0000,0x0000,0x0000,0x0000,0xda5c,0xda5a, -0xb54b,0xda5d,0xda61,0x0000,0x0000,0x0000,0xb54d,0x0000, -0x0000,0x0000,0xda64,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xde70,0xde77,0xde79,0xdea1,0x0000,0xb7da,0xde6b, -0x0000,0xb7d2,0x0000,0xde7a,0xb7d7,0xdea2,0xb7ce,0x0000, -0xde7d,0x0000,0xde6d,0xde7e,0xde6c,0x0000,0xb7dc,0x0000, -0xde78,0xb7cf,0xdea3,0x0000,0xb7d4,0xde71,0xb7d9,0xde7c, -0xde6f,0xde76,0xde72,0xde6e,0xb7d1,0xb7d8,0xb7d6,0xb7d3, -0xb7db,0xb7d0,0xde75,0x0000,0xb7d5,0x0000,0xb54e,0x0000, -0xde7b,0x0000,0xde73,0x0000,0x0000,0x0000,0x0000,0x0000, -0xde74,0x0000,0x0000,0xe2c1,0x0000,0xbab4,0x0000,0x0000, -0xe2bd,0xe2c3,0xe2bf,0x0000,0xbab6,0xe2be,0xe2c2,0xe2ba, -0x0000,0xe2bc,0xbab5,0x0000,0x0000,0x0000,0x0000,0xe2c0, -0xe2bb,0x0000,0xbab7,0x0000,0xbab2,0x0000,0x0000,0xe2c4, -0x0000,0xbab3,0xe667,0xe664,0xe670,0xe66a,0xe66c,0xbcf4, -0xe666,0xe66e,0x0000,0x0000,0xe66d,0xe66b,0x0000,0xe671, -0xbcf7,0xe668,0xe66f,0x0000,0xbcf5,0x0000,0x0000,0xe663, -0xe665,0xbcf6,0xe662,0xe672,0x0000,0xe669,0x0000,0x0000, -0xea4a,0xbf51,0x0000,0x0000,0xea55,0xea53,0xbf4b,0xea49, -0xea4c,0xea4d,0xea48,0xbf55,0xbf56,0xea47,0xea56,0xea51, -0xbf4f,0xbf4c,0xea50,0xea4e,0x0000,0x0000,0xbf52,0xea52, -0xbf4d,0x0000,0xbf4e,0x0000,0xea4f,0xbf50,0xea4b,0x0000, -0xea54,0xbf53,0xea57,0xea58,0xbf54,0x0000,0x0000,0xc0e7, -0xc0ee,0xed5c,0xed62,0x0000,0xed60,0xc0ea,0xc0e9,0xc0e6, -0xed5e,0x0000,0x0000,0x0000,0xc0ec,0xc0eb,0xc0e8,0x0000, -0xed61,0xed5d,0xed5f,0x0000,0xc0ed,0x0000,0x0000,0x0000, -0xc277,0xeffb,0x0000,0xc274,0xc275,0xeffd,0xc276,0xeffa, -/* 0x7200 */ -0x0000,0xeff9,0xf26c,0xeffc,0x0000,0xf26d,0xc37a,0xf26b, -0x0000,0x0000,0xf26a,0x0000,0xf269,0xc37b,0x0000,0x0000, -0xc46c,0x0000,0x0000,0xf46a,0xf46b,0x0000,0x0000,0x0000, -0x0000,0xf5dc,0xf5db,0xc4ea,0x0000,0xf5da,0xf6ec,0xf6ed, -0x0000,0x0000,0xf7e6,0xf8b1,0x0000,0x0000,0xf8f6,0xf9bc, -0xc679,0xf9c6,0xa4f6,0x0000,0xaaa6,0xaaa7,0x0000,0x0000, -0xacb8,0x0000,0x0000,0x0000,0x0000,0xc0ef,0xa4f7,0x0000, -0xaaa8,0xaf52,0xb7dd,0xa4f8,0x0000,0xb26e,0xbab8,0xc962, -0x0000,0xcfb7,0xd27d,0x0000,0xe2c5,0x0000,0xc0f0,0xa4f9, -0xaaa9,0xcfb8,0xcfb9,0xda66,0xb550,0x0000,0x0000,0xdea4, -0x0000,0x0000,0xb7de,0xe2c6,0x0000,0x0000,0xbcf8,0x0000, -0xc37c,0xa4fa,0xda67,0xa4fb,0x0000,0xa6c9,0xca42,0xa6c8, -0xa865,0xa864,0xa863,0xcb60,0x0000,0x0000,0x0000,0xaaaa, -0x0000,0xaaab,0xcd5b,0x0000,0xcfba,0x0000,0xcfbd,0xacba, -0xcfbb,0x0000,0xacb9,0xcfbc,0xacbb,0x0000,0xd2a2,0xd2a1, -0xd27e,0xaf53,0x0000,0xd65d,0xd65e,0xb26f,0xd65c,0xd65f, -0xb552,0xb270,0x0000,0x0000,0xb551,0xda6b,0xda6a,0x0000, -0xda68,0xda69,0x0000,0xda6c,0xdea6,0xdea5,0xdea9,0x0000, -0xdea8,0xdea7,0xbab9,0xe2c9,0x0000,0xe2c8,0xbaba,0xe2c7, -0xe673,0x0000,0xe674,0xbcf9,0x0000,0xea59,0xea5a,0x0000, -0x0000,0xf272,0xc37d,0xf271,0xf270,0xf26e,0xf26f,0xc4eb, -0xf46c,0xf6ee,0xf8f7,0x0000,0xa4fc,0x0000,0xc9a5,0xa5c7, -0xc9a6,0x0000,0x0000,0x0000,0xca43,0xca44,0x0000,0x0000, -0x0000,0x0000,0xcb66,0x0000,0x0000,0xcb62,0x0000,0xcb61, -0xaaac,0xcb65,0xa867,0xcb63,0xa866,0xcb67,0xcb64,0x0000, -0x0000,0xcd5f,0xcfbe,0xcd5d,0xcd64,0x0000,0xaaad,0x0000, -0xaab0,0xcd65,0xcd61,0x0000,0xcd62,0x0000,0xcd5c,0xaaaf, -0xcd5e,0xaaae,0xcd63,0x0000,0xcd60,0x0000,0x0000,0xcfc2, -0xacbd,0xacbe,0x0000,0xcfc5,0xcfbf,0x0000,0xcfc4,0x0000, -0xcfc0,0xacbc,0xcfc3,0xcfc1,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xd2a8,0xd2a5,0x0000,0xd2a7,0xaf58, -0xaf57,0xaf55,0xd2a4,0xd2a9,0xaf54,0xaf56,0xd2a6,0xd667, -0xd2a3,0xd2aa,0x0000,0x0000,0x0000,0x0000,0x0000,0xd662, -0xd666,0x0000,0xd665,0xda6e,0xda79,0x0000,0x0000,0xd668, -0x0000,0xd663,0xda6d,0xb274,0x0000,0x0000,0xb273,0xd661, -0xd664,0xb275,0x0000,0xb272,0xb271,0xd660,0xd669,0x0000, -0x0000,0x0000,0xda70,0xda77,0x0000,0xb554,0xda76,0xda73, -0x0000,0xb556,0x0000,0x0000,0x0000,0xda75,0x0000,0x0000, -0xda6f,0xda71,0xda74,0xda72,0xb555,0xda78,0xb553,0xb7df, -0x0000,0x0000,0xdead,0xdeac,0xdeaa,0x0000,0xb7e2,0xb7e1, -0xdeae,0x0000,0xdeab,0xe2ca,0xbabb,0xb7e0,0x0000,0x0000, -0x0000,0xdeb0,0xdeaf,0x0000,0xe2cd,0xe2cb,0xbcfa,0x0000, -0xbabc,0xe2cc,0xe676,0x0000,0x0000,0x0000,0x0000,0xbcfb, -0xe675,0xe67e,0xe67d,0xe67b,0x0000,0xe67a,0xe677,0xe678, -0xe679,0xe67c,0xe6a1,0x0000,0x0000,0xea5f,0xea5c,0xea5d, -0xbf57,0xea5b,0xea61,0xea60,0xea5e,0x0000,0xed64,0xed65, -0xc0f1,0x0000,0xc0f2,0xed63,0x0000,0xc279,0xeffe,0xc278, -0xc37e,0x0000,0xc3a1,0xc46d,0xf46e,0xf46d,0xf5dd,0xf6ef, -0xc57a,0xf7e8,0xf7e7,0xf7e9,0xa5c8,0xcfc6,0xaf59,0xb276, -0xd66a,0xa5c9,0xc9a7,0xa4fd,0x0000,0x0000,0xca45,0x0000, -0x0000,0x0000,0xcb6c,0xcb6a,0xcb6b,0xcb68,0xa868,0xcb69, -0x0000,0x0000,0x0000,0x0000,0x0000,0xcd6d,0x0000,0xaab3, -0xcd6b,0xcd67,0xcd6a,0x0000,0xcd66,0xaab5,0xcd69,0x0000, -0xaab2,0xaab1,0x0000,0xaab4,0xcd6c,0xcd68,0x0000,0x0000, -0x0000,0x0000,0xacc2,0xacc5,0xcfce,0xcfcd,0xcfcc,0xacbf, -0xcfd5,0xcfcb,0x0000,0xacc1,0xd2af,0x0000,0xcfd2,0xcfd0, -0xacc4,0x0000,0xcfc8,0xcfd3,0x0000,0xcfca,0xcfd4,0xcfd1, -0xcfc9,0x0000,0xacc0,0xcfd6,0xcfc7,0xacc3,0x0000,0x0000, -0x0000,0x0000,0xd2b4,0xd2ab,0xd2b6,0x0000,0xd2ae,0xd2b9, -0xd2ba,0xd2ac,0xd2b8,0xd2b5,0xd2b3,0xd2b7,0xaf5f,0x0000, -0xaf5d,0x0000,0x0000,0xd2b1,0x0000,0xd2ad,0x0000,0xd2b0, -0xd2bb,0xd2b2,0xaf5e,0xcfcf,0x0000,0xaf5a,0xaf5c,0x0000, -0x0000,0x0000,0x0000,0x0000,0xd678,0xd66d,0xd66b,0x0000, -0xd66c,0x0000,0xd673,0x0000,0xd674,0xd670,0xb27b,0xd675, -0xd672,0xd66f,0x0000,0xb279,0xd66e,0xb277,0xb27a,0xd671, -0xd679,0xaf5b,0xb278,0xd677,0xd676,0xb27c,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xda7e,0x0000, -0x0000,0x0000,0xdaa1,0xb560,0x0000,0xdaa7,0x0000,0x0000, -0xdaa9,0xdaa2,0xb55a,0xdaa6,0xdaa5,0xb55b,0xb561,0x0000, -0xb562,0xdaa8,0xb558,0xda7d,0xda7b,0xdaa3,0xda7a,0xb55f, -0xda7c,0xdaa4,0xdaaa,0xb559,0xb55e,0xb55c,0xb55d,0x0000, -0x0000,0x0000,0xb557,0x0000,0x0000,0x0000,0x0000,0xb7e9, -0xdeb7,0xb7e8,0xdebb,0x0000,0xdeb1,0x0000,0xdebc,0x0000, -0x0000,0x0000,0xdeb2,0xdeb3,0x0000,0xdebd,0xdeba,0xdeb8, -0xdeb9,0xdeb5,0xdeb4,0x0000,0xdebe,0xb7e5,0x0000,0xdeb6, -0x0000,0xb7ea,0xb7e4,0xb7eb,0xb7ec,0x0000,0xb7e7,0xb7e6, -0x0000,0x0000,0xe2ce,0xbabe,0xbabd,0x0000,0x0000,0xe2d3, -0x0000,0xbcfc,0xbabf,0x0000,0x0000,0xbac1,0xe2d4,0xb7e3, -0xbac0,0xe2d0,0xe2d2,0xe2cf,0x0000,0xe2d1,0x0000,0x0000, -0x0000,0xe6ab,0x0000,0x0000,0xe6aa,0xe6a7,0xbd40,0xea62, -0xbd41,0xe6a6,0x0000,0xbcfe,0x0000,0xe6a8,0xe6a5,0xe6a2, -0xe6a9,0xe6a3,0xe6a4,0xbcfd,0x0000,0x0000,0x0000,0x0000, -0xed69,0x0000,0xea66,0x0000,0xea65,0xea67,0x0000,0xed66, -0xbf5a,0x0000,0xea63,0x0000,0xbf58,0x0000,0xbf5c,0xbf5b, -0xea64,0xea68,0x0000,0xbf59,0x0000,0xed6d,0xc0f5,0xc27a, -0xc0f6,0xc0f3,0xed6a,0xed68,0x0000,0xed6b,0x0000,0xed6e, -0xc0f4,0xed6c,0xed67,0x0000,0x0000,0xf042,0xf045,0xf275, -0xf040,0x0000,0xf46f,0xf046,0x0000,0xc3a2,0xf044,0xc27b, -0xf041,0xf043,0xf047,0xf276,0x0000,0xf274,0x0000,0x0000, -0x0000,0x0000,0xc3a3,0xf273,0x0000,0x0000,0x0000,0xc46e, -0x0000,0x0000,0x0000,0x0000,0xc4ed,0xf6f1,0xc4ec,0xf6f3, -0xf6f0,0xf6f2,0xc5d0,0xf8b2,0xa5ca,0xcd6e,0xd2bc,0xd2bd, -0xb27d,0xdebf,0xbf5d,0xc3a4,0xc57b,0xf8b3,0xa5cb,0x0000, -0xcd6f,0xa260,0x0000,0x0000,0xcfd7,0x0000,0xcfd8,0x0000, -0x0000,0x0000,0x0000,0x0000,0xd2be,0xd2bf,0xb27e,0xb2a1, -0x0000,0x0000,0x0000,0xdaab,0x0000,0xdec2,0xdec1,0xdec0, -0xe2d5,0x0000,0xe2d6,0xe2d7,0xbac2,0x0000,0x0000,0xe6ad, -0xe6ac,0x0000,0x0000,0xea69,0xbf5e,0xbf5f,0x0000,0xed72, -0xed6f,0xed70,0xed71,0xf049,0xf048,0xc27c,0xf277,0xf5de, -0xa5cc,0x0000,0xacc6,0x0000,0xb2a2,0xdec3,0x0000,0xa5cd, -0x0000,0xd2c0,0xb2a3,0x0000,0x0000,0xb563,0xb564,0x0000, -0xa5ce,0xa5cf,0xca46,0xa86a,0xa869,0xacc7,0xcfd9,0xdaac, -0xa5d0,0xa5d1,0xa5d2,0xa5d3,0x0000,0x0000,0x0000,0xa86b, -0xa86c,0xcb6e,0xcb6d,0x0000,0x0000,0xaab6,0xcd72,0xcd70, -0xcd71,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcfda, -0xcfdb,0x0000,0x0000,0xaccb,0xacc9,0x0000,0xacca,0xacc8, -0x0000,0x0000,0x0000,0x0000,0xaf60,0x0000,0x0000,0x0000, -0x0000,0xaf64,0xaf63,0xd2c1,0xaf62,0xaf61,0x0000,0xd2c2, -0x0000,0x0000,0xb2a6,0xd67b,0xd67a,0xb2a4,0xb2a5,0x0000, -0x0000,0x0000,0xb566,0xb565,0xdaae,0x0000,0x0000,0xdaad, -0xb2a7,0x0000,0x0000,0x0000,0x0000,0x0000,0xb7ed,0xdec5, -0xb7ee,0xdec4,0x0000,0x0000,0x0000,0xe2d8,0xe6ae,0xbd42, -0xea6a,0x0000,0x0000,0x0000,0xed73,0x0000,0xc3a6,0xc3a5, -0x0000,0x0000,0xc57c,0xa5d4,0xcd73,0x0000,0x0000,0xb2a8, -0xe2d9,0xbac3,0x0000,0x0000,0xcb6f,0xcb70,0x0000,0x0000, -0xcd74,0xaab8,0xaab9,0x0000,0x0000,0xaab7,0x0000,0x0000, -0x0000,0x0000,0xaccf,0xacd0,0xaccd,0xacce,0x0000,0xcfdc, -0x0000,0x0000,0xcfdd,0xaccc,0x0000,0x0000,0x0000,0x0000, -0xd2c3,0x0000,0xaf68,0xaf69,0x0000,0xb2ab,0xd2c9,0x0000, -0xaf6e,0xaf6c,0xd2ca,0xd2c5,0xaf6b,0xaf6a,0xaf65,0xd2c8, -0xd2c7,0xd2c4,0xaf6d,0x0000,0xd2c6,0xaf66,0x0000,0xaf67, -0x0000,0x0000,0xb2ac,0xd6a1,0xd6a2,0xb2ad,0xd67c,0xd67e, -0xd6a4,0xd6a3,0xd67d,0x0000,0xb2a9,0xb2aa,0x0000,0xdab6, -0xb56b,0xb56a,0xdab0,0xb568,0x0000,0xdab3,0xb56c,0xdab4, -0xb56d,0xdab1,0xb567,0xb569,0xdab5,0x0000,0xdab2,0xdaaf, -0x0000,0x0000,0x0000,0x0000,0x0000,0xded2,0x0000,0xdec7, -0xb7f0,0xb7f3,0xb7f2,0xb7f7,0xb7f6,0xded3,0xded1,0xdeca, -0xdece,0xdecd,0xb7f4,0xded0,0xdecc,0xded4,0xdecb,0xb7f5, -0xb7ef,0xb7f1,0x0000,0xdec9,0x0000,0x0000,0x0000,0x0000, -0xe2db,0xbac7,0xe2df,0xbac6,0xe2dc,0xbac5,0x0000,0xdec8, -0xdecf,0xe2de,0x0000,0xbac8,0xe2e0,0xe2dd,0xe2da,0x0000, -0x0000,0xe6b1,0xe6b5,0xe6b7,0xe6b3,0xe6b2,0xe6b0,0xbd45, -0xbd43,0xbd48,0xbd49,0xe6b4,0xbd46,0xe6af,0xbd47,0xbac4, -0xe6b6,0xbd44,0x0000,0x0000,0x0000,0xea6c,0x0000,0xea6b, -0xea73,0xea6d,0xea72,0xea6f,0xbf60,0xea71,0x0000,0x0000, -0xbf61,0x0000,0xbf62,0x0000,0xea70,0xea6e,0x0000,0x0000, -0x0000,0x0000,0xc0f8,0xed74,0x0000,0x0000,0xc0f7,0xed77, -0xed75,0xed76,0x0000,0x0000,0xc0f9,0x0000,0x0000,0x0000, -0xf04d,0x0000,0xc2a1,0xf04e,0x0000,0x0000,0xc27d,0xf04f, -0xc27e,0xf04c,0xf050,0x0000,0xf04a,0x0000,0x0000,0xc3a7, -0xf278,0xc3a8,0xc46f,0x0000,0xf04b,0xc470,0x0000,0x0000, -0x0000,0xc4ee,0xf5df,0x0000,0xc57e,0xf6f4,0xc57d,0x0000, -0xf7ea,0xc5f5,0xc5f6,0x0000,0x0000,0xf9cc,0x0000,0x0000, -0xacd1,0xcfde,0x0000,0xb56e,0xb56f,0xa5d5,0xa6ca,0xca47, -0x0000,0xcb71,0xa86d,0x0000,0xaaba,0x0000,0xacd2,0xacd3, -0xacd4,0xd6a6,0xd2cb,0xaf6f,0x0000,0x0000,0xb2ae,0xd6a5, -0x0000,0x0000,0xdab8,0xb571,0x0000,0xdab7,0xb570,0x0000, -0x0000,0xded5,0xbd4a,0xe6bb,0xe6b8,0xe6b9,0xe6ba,0x0000, -0x0000,0x0000,0x0000,0x0000,0xed78,0x0000,0xf051,0x0000, -0x0000,0x0000,0xf471,0xf470,0x0000,0xf6f5,0xa5d6,0xcd75, -0xaf70,0x0000,0x0000,0x0000,0xb572,0xded6,0x0000,0x0000, -0xe2e1,0x0000,0xbd4b,0xea74,0x0000,0xf052,0xf472,0xa5d7, -0x0000,0x0000,0xaabb,0xacd7,0xcfdf,0xacd8,0xacd6,0x0000, -0xacd5,0xd2cc,0xaf71,0x0000,0x0000,0xaf72,0xaf73,0x0000, -0x0000,0x0000,0xb2b0,0xd6a7,0xb2af,0x0000,0x0000,0x0000, -0x0000,0x0000,0xdab9,0xb2b1,0xb573,0xded7,0xb7f8,0xb7f9, -0x0000,0xbac9,0x0000,0xbaca,0xbd4c,0xbf64,0xea75,0xbf63, -0x0000,0xed79,0xc0fa,0x0000,0xf053,0xf473,0xa5d8,0xa86e, -0xcd78,0xcd77,0xaabc,0xcd76,0xaabd,0xcd79,0x0000,0xcfe5, -0xacdb,0xacda,0xcfe7,0xcfe6,0xacdf,0x0000,0xacde,0x0000, -/* 0x7700 */ -0x0000,0xacd9,0x0000,0xcfe1,0xcfe2,0xcfe3,0x0000,0xace0, -0xcfe0,0xacdc,0xcfe4,0xacdd,0x0000,0x0000,0x0000,0x0000, -0xd2cf,0xd2d3,0xd2d1,0xd2d0,0x0000,0xd2d4,0x0000,0x0000, -0x0000,0xd2d5,0xd2d6,0xd2ce,0x0000,0xd2cd,0x0000,0xaf75, -0xaf76,0x0000,0xd2d7,0xd2d2,0x0000,0xd6b0,0x0000,0xd2d8, -0xaf77,0xaf74,0x0000,0x0000,0x0000,0xd6aa,0x0000,0xd6a9, -0x0000,0xd6ab,0xd6ac,0xd6ae,0xd6ad,0xd6b2,0xb2b5,0xb2b2, -0xb2b6,0xd6a8,0xb2b7,0xd6b1,0xb2b4,0xd6af,0xb2b3,0x0000, -0x0000,0x0000,0x0000,0x0000,0xdabc,0xdabe,0xdaba,0xdabb, -0x0000,0x0000,0xdabf,0xdac1,0xdac2,0xdabd,0xdac0,0xb574, -0x0000,0x0000,0xdedb,0x0000,0xdee0,0xded8,0xdedc,0x0000, -0x0000,0xdee1,0xdedd,0xb7fa,0xb843,0x0000,0xb7fd,0xded9, -0xdeda,0xbace,0xb846,0xb7fe,0x0000,0xb844,0xb7fc,0xdedf, -0xb845,0xdede,0xb841,0xb7fb,0xb842,0xdee2,0xe2e6,0xe2e8, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xb840,0x0000,0x0000,0xe2e3,0xbacc,0xe2e9,0xbacd, -0xe2e7,0xe2e2,0xe2e5,0xe2ea,0xbacb,0xe2e4,0x0000,0xbd4e, -0xe6bf,0xe6be,0x0000,0xbd51,0xbd4f,0xe6bc,0xbd4d,0xe6bd, -0x0000,0xbd50,0x0000,0x0000,0x0000,0xea7d,0x0000,0xeaa1, -0x0000,0xea7e,0xea76,0xea7a,0xea79,0xea77,0xbf66,0xbf67, -0xbf65,0xea78,0xea7b,0xea7c,0x0000,0xbf68,0x0000,0xc140, -0xeda3,0x0000,0xc0fc,0xed7b,0xc0fe,0xc141,0x0000,0x0000, -0xc0fd,0xeda2,0xed7c,0xc0fb,0xeda1,0xed7a,0xed7e,0xed7d, -0x0000,0x0000,0xf055,0xc2a4,0xc2a5,0xc2a2,0x0000,0xc2a3, -0x0000,0x0000,0xf054,0x0000,0xf27b,0x0000,0x0000,0xc3a9, -0x0000,0xf279,0xf27a,0x0000,0xf474,0xf477,0xf475,0xf476, -0xf5e0,0x0000,0x0000,0xc4ef,0xf7eb,0xf8b4,0x0000,0xc5f7, -0xf8f8,0xf8f9,0xc666,0xa5d9,0xace1,0x0000,0xdac3,0x0000, -0xdee3,0x0000,0xa5da,0xa86f,0x0000,0xaabe,0x0000,0xcfe8, -0xcfe9,0xaf78,0x0000,0x0000,0xdac4,0xb575,0xb847,0xc142, -0xeda4,0xf27c,0xf478,0xa5db,0x0000,0x0000,0x0000,0xcda1, -0xcd7a,0xcd7c,0xcd7e,0xcd7d,0xcd7b,0xaabf,0x0000,0x0000, -/* 0x7800 */ -0x0000,0x0000,0xace2,0xcff2,0x0000,0xcfed,0xcfea,0x0000, -0x0000,0xcff1,0x0000,0x0000,0xace4,0xace5,0xcff0,0xcfef, -0xcfee,0xcfeb,0xcfec,0xcff3,0xace3,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xaf7c,0x0000,0xafa4, -0xafa3,0xd2e1,0xd2db,0xd2d9,0x0000,0xafa1,0xd6b9,0xaf7a, -0xd2de,0xd2e2,0xd2e4,0xd2e0,0xd2da,0xafa2,0xd2df,0xd2dd, -0xaf79,0xd2e5,0xafa5,0xd2e3,0xaf7d,0xd2dc,0x0000,0xaf7e, -0xaf7b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xb2b9,0x0000,0xd6ba,0x0000,0x0000, -0xd6b3,0xd6b5,0xd6b7,0x0000,0xd6b8,0xd6b6,0xb2ba,0x0000, -0xd6bb,0x0000,0xd6b4,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xdac8,0xb576,0xdad0,0x0000, -0xdac5,0x0000,0xdad1,0x0000,0xdac6,0xdac7,0x0000,0x0000, -0xdacf,0xdace,0xdacb,0xb2b8,0xb577,0xdac9,0xdacc,0xb578, -0xdacd,0xdaca,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xdeee,0x0000,0xdef2,0xb84e,0x0000,0xe2f0,0xb851, -0xdef0,0xf9d6,0x0000,0xdeed,0xdee8,0xdeea,0xdeeb,0xdee4, -0x0000,0xb84d,0x0000,0x0000,0xb84c,0x0000,0xb848,0xdee7, -0x0000,0xb84f,0x0000,0xb850,0xdee6,0xdee9,0xdef1,0xb84a, -0xb84b,0xdeef,0xdee5,0x0000,0x0000,0x0000,0xe2f2,0xbad0, -0xe2f4,0xdeec,0xe2f6,0xbad4,0xe2f7,0xe2f3,0x0000,0xbad1, -0xe2ef,0xbad3,0xe2ec,0xe2f1,0xe2f5,0xe2ee,0x0000,0x0000, -0xb849,0x0000,0xe2eb,0xbad2,0xe2ed,0x0000,0x0000,0x0000, -0x0000,0x0000,0xbd54,0xe6c1,0xbd58,0x0000,0xbd56,0x0000, -0x0000,0xbacf,0x0000,0xe6c8,0xe6c9,0xbd53,0x0000,0x0000, -0xe6c7,0xe6ca,0xbd55,0xbd52,0xe6c3,0xe6c0,0xe6c5,0xe6c2, -0xbd59,0xe6c4,0x0000,0x0000,0xe6c6,0xbd57,0x0000,0x0000, -0x0000,0x0000,0xbf6a,0xeaa8,0x0000,0xeaa2,0xeaa6,0xeaac, -0xeaad,0xeaa9,0xeaaa,0xeaa7,0x0000,0xeaa4,0x0000,0xbf6c, -0xbf69,0xeaa3,0xeaa5,0x0000,0xbf6b,0xeaab,0x0000,0xc146, -0x0000,0x0000,0xedaa,0xeda5,0xc145,0x0000,0x0000,0xc143, -0x0000,0xedac,0xc144,0xeda8,0xeda9,0xeda6,0xedad,0xf056, -/* 0x7900 */ -0x0000,0xc147,0xeda7,0x0000,0xedae,0xedab,0x0000,0x0000, -0x0000,0xf05a,0x0000,0x0000,0xf057,0x0000,0xc2a6,0x0000, -0xf05b,0xf05d,0xf05c,0xf058,0xf059,0x0000,0x0000,0xf2a3, -0x0000,0xc3aa,0x0000,0xf27e,0xf2a2,0xf27d,0xf2a4,0x0000, -0x0000,0xf2a1,0x0000,0xf47a,0xf47d,0xf479,0xc471,0xf47b, -0xf47c,0xf47e,0xc472,0xc474,0xc473,0xf5e1,0x0000,0xf5e3, -0x0000,0xf5e2,0x0000,0x0000,0x0000,0xf6f6,0x0000,0x0000, -0xf8b5,0xf8fa,0xa5dc,0x0000,0x0000,0xcb72,0xaac0,0xcda3, -0xaac1,0xaac2,0xcda2,0x0000,0xcff8,0xcff7,0xace6,0xace9, -0xace8,0xace7,0xcff4,0xcff6,0xcff5,0x0000,0x0000,0xd2e8, -0xafa7,0xd2ec,0xd2eb,0xd2ea,0xd2e6,0xafa6,0xafaa,0xafad, -0x0000,0x0000,0xafae,0xd2e7,0xd2e9,0xafac,0xafab,0xafa9, -0xafa8,0xd6c2,0x0000,0xd6c0,0xd6bc,0xb2bb,0x0000,0xd6bd, -0xb2bc,0xd6be,0xd6bf,0xd6c1,0x0000,0xb2bd,0x0000,0x0000, -0xdad5,0x0000,0xdad4,0xdad3,0xdad2,0x0000,0x0000,0x0000, -0x0000,0xdef6,0xb852,0x0000,0xdef3,0xdef5,0x0000,0xb853, -0x0000,0xb854,0xdef4,0x0000,0x0000,0x0000,0x0000,0x0000, -0xe341,0x0000,0xe2f9,0xe2fa,0x0000,0xbad7,0xbad5,0xbad6, -0xe343,0x0000,0xe342,0xe2fe,0xe2fd,0xe2fc,0xe2fb,0xe340, -0xe2f8,0x0000,0xe6cb,0xe6d0,0xe6ce,0x0000,0x0000,0x0000, -0xe6cd,0xe6cc,0xe6cf,0x0000,0xeaae,0x0000,0xbf6d,0xc148, -0xedb0,0x0000,0xc149,0xedaf,0xf05f,0xf05e,0xc2a7,0x0000, -0xf2a5,0xc3ab,0xf4a1,0xc5a1,0xf6f7,0x0000,0xf8b7,0xf8b6, -0xc9a8,0xacea,0xaceb,0xd6c3,0x0000,0xb856,0xa5dd,0xa872, -0xa871,0xa870,0x0000,0x0000,0x0000,0xcda4,0x0000,0x0000, -0xaac4,0xaac3,0x0000,0xacee,0x0000,0xcffa,0xcffd,0xcffb, -0x0000,0xacec,0xaced,0x0000,0x0000,0xcff9,0xcffc,0x0000, -0xafb5,0x0000,0x0000,0x0000,0xd2f3,0xd2f5,0xd2f4,0xafb2, -0xd2ef,0x0000,0x0000,0xafb0,0xafaf,0x0000,0xafb3,0xafb1, -0x0000,0xafb4,0xd2f2,0xd2ed,0xd2ee,0xd2f1,0xd2f0,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd6c6,0xd6c7, -0xd6c5,0x0000,0xd6c4,0xb2be,0x0000,0x0000,0x0000,0x0000, -0xb57d,0x0000,0xdad6,0xdad8,0xdada,0xb57c,0x0000,0x0000, -0xb57a,0x0000,0xdad7,0xb57b,0xdad9,0xb579,0x0000,0x0000, -0xdf41,0xdef7,0xdefa,0xdefe,0xb85a,0xdefc,0x0000,0xdefb, -0xdef8,0xdef9,0xb858,0xdf40,0xb857,0x0000,0xb85c,0xb85b, -0xb859,0x0000,0xdefd,0x0000,0x0000,0x0000,0xe349,0x0000, -0xe348,0x0000,0x0000,0xe344,0x0000,0x0000,0xbad8,0xe347, -0xe346,0xbad9,0x0000,0x0000,0x0000,0x0000,0x0000,0xbd5e, -0x0000,0xe6d2,0x0000,0xbd5f,0xbd5b,0xbd5d,0x0000,0xbd5a, -0xbd5c,0x0000,0x0000,0x0000,0xeaaf,0x0000,0xbf70,0xeab1, -0xeab0,0x0000,0xe345,0xbf72,0xbf71,0xbf6e,0xbf6f,0x0000, -0x0000,0x0000,0x0000,0x0000,0xedb5,0x0000,0xedb3,0xc14a, -0xedb4,0x0000,0xedb6,0xedb2,0xedb1,0x0000,0x0000,0xf060, -0xc2aa,0xc2a8,0xc2a9,0x0000,0x0000,0x0000,0x0000,0xf2a6, -0xf2a7,0xc3ad,0x0000,0xc3ac,0xf4a3,0xf4a4,0xf4a2,0x0000, -0xf6f8,0xf6f9,0x0000,0x0000,0xa5de,0xca48,0xa873,0x0000, -0xcda5,0xaac6,0xaac5,0xcda6,0x0000,0x0000,0xd040,0xacef, -0xcffe,0xacf0,0x0000,0x0000,0xafb6,0xd2f8,0xd2f6,0xd2fc, -0xafb7,0xd2f7,0xd2fb,0xd2f9,0xd2fa,0x0000,0x0000,0xd6c8, -0xd6ca,0x0000,0xb2bf,0x0000,0xd6c9,0xb2c0,0xb5a2,0xb5a1, -0xb57e,0xdadb,0x0000,0x0000,0x0000,0x0000,0xdf44,0xb85d, -0xb85e,0x0000,0xdf43,0xdf42,0x0000,0x0000,0x0000,0x0000, -0xe34a,0xbadb,0xbada,0xe34b,0xe34c,0x0000,0xbd61,0xbd60, -0x0000,0xeab5,0xe6d3,0xe6d5,0xe6d4,0xeab4,0xeab2,0xeab6, -0xeab3,0x0000,0xbf73,0x0000,0x0000,0x0000,0xedb7,0xc14b, -0xedb8,0xedb9,0x0000,0x0000,0xc2ab,0xc2ac,0x0000,0xc475, -0x0000,0x0000,0xc5d1,0xa5df,0x0000,0x0000,0x0000,0x0000, -0x0000,0xd041,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xd2fd,0xafb8,0x0000,0x0000,0x0000,0x0000,0x0000,0xb3ba, -0xb3b9,0x0000,0x0000,0xb5a4,0xdadd,0xb5a3,0xdadc,0x0000, -0x0000,0x0000,0x0000,0xdf45,0x0000,0xbadc,0xe34d,0xbadd, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xc476,0xf4a5, -0x0000,0xa6cb,0xaac7,0xcda7,0x0000,0xacf2,0x0000,0xacf1, -0xd042,0xd043,0x0000,0x0000,0xd340,0xd342,0xafb9,0x0000, -0xd344,0xd347,0xd345,0x0000,0x0000,0x0000,0xd346,0xd343, -0xd2fe,0xafba,0xd348,0xd341,0x0000,0x0000,0x0000,0x0000, -0xd6d3,0xb2c6,0xd6dc,0xb2c3,0x0000,0xd6d5,0xb2c7,0x0000, -0xb2c1,0x0000,0xd6d0,0xd6dd,0xd6d1,0xd6ce,0xb2c5,0x0000, -0xb2c2,0x0000,0xd6d4,0xd6d7,0xb2c4,0xd6d8,0xb2c8,0xd6d9, -0xd6cf,0xd6d6,0xd6da,0xd6d2,0xd6cd,0xd6cb,0x0000,0x0000, -0xd6db,0x0000,0x0000,0xdadf,0x0000,0x0000,0x0000,0x0000, -0xdae4,0x0000,0x0000,0x0000,0xdae0,0xdae6,0xb5a7,0xd6cc, -0xdae1,0xb5a5,0xdade,0xb5ac,0xdae2,0xb5ab,0xdae3,0xb5ad, -0xb5a8,0xb5ae,0xb5a9,0x0000,0xb5aa,0x0000,0xb5a6,0x0000, -0xdae5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xb861,0xdf50,0x0000,0xdf53,0xdf47,0xdf4c,0xdf46,0xb863, -0x0000,0xdf4a,0x0000,0x0000,0x0000,0xdf48,0xb862,0x0000, -0xdf4f,0xdf4e,0xdf4b,0xdf4d,0xdf49,0xbae1,0xdf52,0xb85f, -0xdf51,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xe35d,0x0000,0xbae8,0xe358,0x0000,0xbae7, -0xe34e,0x0000,0xe350,0xbae0,0xe355,0xe354,0xe357,0xbae5, -0xe352,0xe351,0x0000,0x0000,0xbae4,0xbadf,0xe353,0xbae2, -0xe359,0xe35b,0x0000,0xe356,0xe34f,0xbae3,0x0000,0x0000, -0xbd69,0xbade,0x0000,0x0000,0xe35c,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xe6d9,0xbd62,0x0000,0xe6db, -0x0000,0xbd63,0x0000,0x0000,0xbd65,0xe6de,0x0000,0xe6d6, -0xbae6,0xe6dc,0x0000,0x0000,0x0000,0x0000,0xe6d8,0x0000, -0xb860,0xbd68,0x0000,0x0000,0xbd64,0x0000,0xbd66,0xbd67, -0x0000,0xbf76,0xe6dd,0xe6d7,0xbd6a,0x0000,0xe6da,0x0000, -0x0000,0x0000,0x0000,0x0000,0xeac0,0xeabb,0x0000,0x0000, -0xeac5,0xbf74,0xeabd,0xbf78,0xeac3,0xeaba,0xeab7,0xeac6, -0xc151,0xbf79,0xeac2,0xeab8,0xbf77,0xeabc,0xbf7b,0xeab9, -0xeabe,0xbf7a,0xeac1,0xeac4,0x0000,0x0000,0x0000,0x0000, -0xedcb,0xedcc,0xedbc,0xedc3,0xedc1,0x0000,0x0000,0xc14f, -0xedc8,0xeabf,0x0000,0xedbf,0x0000,0xedc9,0xc14e,0xedbe, -0xedbd,0xedc7,0xedc4,0xedc6,0x0000,0xedba,0xedca,0xc14c, -0x0000,0xedc5,0xedce,0xedc2,0xc150,0xc14d,0xedc0,0xedbb, -0xedcd,0xbf75,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xf063,0x0000,0x0000,0xf061,0xf067,0xc2b0,0xf065, -0xf064,0xc2b2,0xf06a,0xc2b1,0x0000,0xf06b,0xf068,0xc2ae, -0xf069,0xf062,0xc2af,0xc2ad,0xf2ab,0xf066,0x0000,0x0000, -0xf06c,0x0000,0x0000,0xf2a8,0x0000,0x0000,0x0000,0xc3b2, -0xc3b0,0xf2aa,0x0000,0xf2ac,0xf2a9,0xc3b1,0xc3ae,0xc3af, -0xc3b3,0x0000,0x0000,0xc478,0x0000,0xf4aa,0x0000,0xf4a9, -0xf4a7,0xf4a6,0xf4a8,0x0000,0xc477,0xc479,0x0000,0x0000, -0xc4f0,0x0000,0x0000,0xf5e5,0xf5e4,0x0000,0x0000,0xf6fa, -0x0000,0xf6fc,0xf6fe,0xf6fd,0xf6fb,0x0000,0x0000,0xc5a3, -0xc5a2,0x0000,0x0000,0xc5d3,0xc5d2,0xc5d4,0xf7ed,0xf7ec, -0x0000,0xf8fb,0xf8b8,0xf8fc,0xc658,0x0000,0xc659,0xf96d, -0x0000,0x0000,0xc67e,0xa6cc,0x0000,0xcda8,0x0000,0x0000, -0xd045,0xd046,0xd044,0x0000,0x0000,0xacf3,0x0000,0xd047, -0xd048,0xd049,0x0000,0x0000,0xd349,0xd34f,0x0000,0x0000, -0xd34d,0xafbb,0xd34b,0x0000,0xd34c,0xd34e,0x0000,0x0000, -0x0000,0xd34a,0xb2c9,0x0000,0xd6de,0xb2cb,0xd6e0,0xb2ca, -0xd6df,0x0000,0x0000,0x0000,0x0000,0x0000,0xdae8,0xb5af, -0x0000,0xdaea,0xdae7,0xd6e1,0x0000,0xb5b0,0x0000,0xf9db, -0xdae9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xdf56, -0x0000,0xb864,0xdf54,0xb865,0xdf55,0xb866,0x0000,0x0000, -0x0000,0xbae9,0xe361,0xe35e,0xe360,0xbaea,0xbaeb,0xe35f, -0x0000,0x0000,0x0000,0x0000,0x0000,0xe6df,0x0000,0x0000, -0xe6e0,0x0000,0xbd6b,0xe6e2,0xe6e1,0x0000,0xa261,0x0000, -0xeaca,0xeacb,0xeac7,0x0000,0xeac8,0xbf7c,0xbf7d,0xeac9, -0x0000,0xc157,0x0000,0x0000,0xc153,0xc158,0xc154,0xc156, -0xc152,0x0000,0xc155,0x0000,0x0000,0x0000,0x0000,0xc2b3, -0xedcf,0x0000,0xf2ae,0x0000,0xf2ad,0x0000,0xf4ab,0xc47a, -0xc47b,0xf741,0xf5e6,0x0000,0xf740,0x0000,0xf8fd,0xf9a4, -0xa6cd,0x0000,0x0000,0xa874,0x0000,0xcda9,0xaac8,0x0000, -0xacf6,0xd04c,0xacf4,0xd04a,0xacf9,0xacf5,0xacfa,0xacf8, -0xd04b,0xacf7,0xafbf,0xafbe,0xd35a,0xafc7,0xd353,0xd359, -0xafc3,0xd352,0xd358,0xd356,0xafc2,0xafc4,0xd355,0xafbd, -0xd354,0xafc8,0xafc5,0xafc9,0xafc6,0xd351,0xd350,0xd357, -0xafc0,0xafbc,0xafc1,0x0000,0x0000,0x0000,0x0000,0x0000, -0xd6f0,0xd6e9,0x0000,0xb5b5,0xd6e8,0x0000,0xb2cf,0xb2d6, -0xb2d3,0xb2d9,0xb2d8,0xb2d4,0x0000,0xd6e2,0xd6e5,0x0000, -0xd6e4,0xb2d0,0xd6e6,0xd6ef,0xb2d1,0xd6e3,0xd6ec,0xd6ed, -0xb2d2,0xd6ea,0xb2d7,0xb2cd,0xb2d5,0xd6e7,0xb2cc,0xd6eb, -0x0000,0x0000,0xd6ee,0x0000,0x0000,0x0000,0xdafb,0xdaf2, -0xb5b2,0xdaf9,0xdaf6,0xdaee,0xdaf7,0xb5b4,0xdaef,0x0000, -0xdaeb,0x0000,0x0000,0xb86c,0xdaf4,0x0000,0xb5b1,0xdafa, -0x0000,0xb5b8,0xb5ba,0xdaed,0x0000,0x0000,0xb5b9,0xdaf0, -0xb5b3,0xdaf8,0xdaf1,0xdaf5,0x0000,0xdaf3,0xb5b6,0xdaec, -0xb5bb,0xb2ce,0xb5b7,0xb5bc,0x0000,0x0000,0x0000,0x0000, -0x0000,0xb868,0xdf5d,0xdf5f,0xdf61,0xdf65,0x0000,0xdf5b, -0xdf59,0xb86a,0x0000,0xdf60,0xdf64,0xdf5c,0xdf58,0x0000, -0xdf57,0x0000,0x0000,0x0000,0xdf62,0xdf5a,0xdf5e,0xb86b, -0x0000,0xb869,0xdf66,0xb867,0xdf63,0x0000,0xe372,0x0000, -0x0000,0x0000,0x0000,0x0000,0xbaee,0xe36a,0xbd78,0xe374, -0xbaf1,0xe378,0xbaf7,0xe365,0x0000,0x0000,0xe375,0xe362, -0x0000,0xe377,0xe366,0x0000,0xbafe,0xbafb,0xe376,0xe370, -0xbaed,0xbaf5,0xbaf4,0x0000,0xbaf3,0xbaf9,0x0000,0xe363, -0xbafa,0xe371,0xbaf6,0xbaec,0xe373,0xbaef,0xbaf0,0xbaf8, -0xe368,0xe367,0xe364,0x0000,0xe36c,0xe369,0xe36d,0xbafd, -0x0000,0xe379,0xbaf2,0xe36e,0xe36f,0x0000,0xe36b,0x0000, -0x0000,0x0000,0xbafc,0x0000,0x0000,0x0000,0x0000,0xe6e7, -0xbd70,0xbd79,0xbd75,0xe6e4,0x0000,0xbd72,0xbd76,0xe6f0, -0xbd6c,0xe6e8,0x0000,0xbd74,0x0000,0x0000,0xe6eb,0xe6e6, -0xbd73,0xbd77,0xe6e5,0x0000,0xbd71,0x0000,0xe6ef,0xbd6e, -0xe6ee,0xe6ed,0xbd7a,0xe572,0xbd6d,0x0000,0xe6ec,0xe6e3, -0x0000,0xbd7b,0xe6ea,0xbd6f,0x0000,0x0000,0x0000,0x0000, -/* 0x7e00 */ -0x0000,0x0000,0x0000,0xe6e9,0x0000,0x0000,0x0000,0x0000, -0xbfa2,0xbfa7,0xbf7e,0xead8,0xeacf,0xeadb,0xead3,0xead9, -0xbfa8,0xbfa1,0xeacc,0xead2,0xeadc,0xead5,0xeada,0xeace, -0x0000,0x0000,0xead6,0xbfa3,0xead4,0xbfa6,0xbfa5,0xead0, -0xead1,0xeacd,0xead7,0xbfa4,0xeade,0xeadd,0x0000,0x0000, -0x0000,0xedda,0xedd6,0xc15f,0x0000,0xedd0,0xc159,0xc169, -0xeddc,0xc161,0xc15d,0xedd3,0xc164,0xc167,0xedde,0xc15c, -0xedd5,0xc165,0xede0,0xeddd,0xedd1,0xc160,0xc15a,0xc168, -0xedd8,0xc163,0xedd2,0xc15e,0xeddf,0xc162,0xc15b,0xedd9, -0xc166,0xedd7,0x0000,0x0000,0xeddb,0x0000,0x0000,0x0000, -0xf06e,0xf074,0xc2b9,0xf077,0xc2b4,0xc2b5,0xf06f,0xf076, -0xf071,0xc2ba,0xc2b7,0x0000,0xf06d,0x0000,0xc2b6,0xf073, -0xf075,0xc2b8,0xf072,0xf070,0x0000,0x0000,0x0000,0x0000, -0xf2b8,0xc3b7,0xc3b8,0xc3b4,0x0000,0xc3b5,0x0000,0xf2b4, -0xf2b2,0x0000,0xf2b6,0xc3ba,0xf2b7,0xf2b0,0xf2af,0xf2b3, -0xf2b1,0xc3b6,0xf2b5,0xf4ac,0xc47e,0xc47d,0xf4ad,0x0000, -0xf4af,0xf4ae,0xc4a1,0x0000,0x0000,0x0000,0xf5eb,0xf5e8, -0xf5e9,0x0000,0xf5e7,0xf5ea,0xc4f2,0xf5ec,0x0000,0xc4f1, -0x0000,0xf742,0x0000,0xc5d5,0xc5d7,0xf7ee,0xc5d6,0xf8b9, -0xf940,0xf942,0xf8fe,0xf941,0xc66c,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, -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,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, -/* 0x7f00 */ -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,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa6ce,0x0000, -0xacfb,0xd26f,0xafca,0x0000,0x0000,0xb2da,0xdafc,0xdafd, -0x0000,0x0000,0x0000,0xeadf,0xc16a,0xede1,0x0000,0x0000, -0xc2bb,0x0000,0xf2ba,0xf2b9,0xc4a2,0xf5ed,0x0000,0xf743, -0xc5f8,0xca49,0x0000,0x0000,0xaac9,0xa875,0x0000,0x0000, -0xd04d,0x0000,0x0000,0xd360,0xd35b,0xd35f,0xd35d,0xafcb, -0xd35e,0xd35c,0x0000,0xd6f1,0x0000,0xdafe,0xdb40,0xdf69, -0xdf6a,0xb86e,0xb86f,0xdf68,0xdf6b,0xdf67,0xb86d,0x0000, -0xbb40,0x0000,0xb870,0xe37a,0x0000,0xbd7c,0xe6f1,0xbd7d, -0x0000,0xbfa9,0xeae2,0xeae0,0xeae1,0xede4,0xede3,0xede2, -0x0000,0x0000,0x0000,0xf2bb,0x0000,0xc3b9,0xf2bc,0xf744, -0xc5f9,0xf8ba,0xa6cf,0xaacb,0xaaca,0xd04f,0xacfc,0x0000, -0x0000,0xd04e,0xd362,0x0000,0xafcc,0xd6f2,0xd361,0x0000, -0x0000,0x0000,0xb2dc,0xd6f5,0xd6f3,0xd6f4,0xb2db,0x0000, -0xdb42,0xdb43,0xdb41,0x0000,0xb873,0xdf6d,0xdf6c,0xdf6e, -0xb872,0xb871,0x0000,0x0000,0xe6f2,0xe6f4,0x0000,0xbd7e, -0xe6f3,0xeae3,0xbfaa,0xf079,0x0000,0xf078,0xc3bb,0xf2bd, -0xc3bd,0xc3bc,0xf4b0,0xf5ee,0xc4f3,0xa6d0,0xd050,0xacfd, -0xd365,0xafce,0xd364,0xd363,0x0000,0xafcd,0x0000,0xd6fb, -0x0000,0xd6fd,0xd6f6,0xd6f7,0xb2dd,0xd6f8,0xb2de,0xd6fc, -0xd6f9,0xd6fa,0xb2df,0x0000,0xb5be,0xb5bf,0x0000,0xdb44, -0x0000,0x0000,0x0000,0xdf6f,0xdf70,0x0000,0xe37e,0xbb43, -0xbb41,0xbb42,0xe37b,0xe37c,0x0000,0xe37d,0xe6f9,0x0000, -0xe6fa,0xbda1,0xe6f7,0xe6f6,0xe6f8,0xe6f5,0xbfad,0xeae4, -0xbfab,0xbfac,0xede6,0xc16b,0xede5,0xefa8,0x0000,0xf07a, -0xf07b,0xc2bc,0x0000,0xc2bd,0xc16c,0xf2be,0xf2bf,0xf4b1, -0xc4a3,0xa6d1,0x0000,0xa6d2,0xacfe,0xaacc,0xafcf,0xd051, -0x0000,0x0000,0x0000,0xb5c0,0xa6d3,0xad41,0xd052,0xd053, -0xad40,0xad42,0xa6d4,0x0000,0xd054,0xafd1,0xd366,0xafd3, -0xafd0,0xafd2,0x0000,0xd741,0xb2e0,0x0000,0xd740,0xd6fe, -0x0000,0xdf71,0x0000,0x0000,0xe3a1,0x0000,0xbda2,0x0000, -0xbfae,0xeae6,0xeae5,0x0000,0xede7,0x0000,0x0000,0x0000, -0xf5ef,0x0000,0x0000,0xa6d5,0xcb73,0xcdaa,0xad43,0xd055, -0x0000,0xd368,0x0000,0x0000,0x0000,0xafd4,0xd367,0xafd5, -0x0000,0x0000,0x0000,0xd743,0x0000,0x0000,0xb2e2,0xd742, -0xd744,0x0000,0xb2e1,0x0000,0x0000,0x0000,0x0000,0xdb46, -0xdb47,0xdb45,0xb5c1,0x0000,0x0000,0x0000,0xb874,0x0000, -0xb875,0x0000,0xbb45,0x0000,0xe3a3,0xe3a2,0xbb44,0x0000, -0x0000,0x0000,0x0000,0x0000,0xe6fb,0x0000,0x0000,0xe6fc, -0x0000,0x0000,0x0000,0x0000,0xeae7,0x0000,0x0000,0xc170, -0xc16f,0xc16d,0xc16e,0xc171,0x0000,0xf07c,0xc2bf,0xc2be, -0xf2c0,0xf4b2,0x0000,0x0000,0x0000,0xc5a5,0xc5a4,0xa6d6, -0x0000,0x0000,0xd1fb,0x0000,0xb877,0xb5c2,0xb876,0xbb46, -0x0000,0xa6d7,0xc9a9,0xa6d8,0xa6d9,0x0000,0x0000,0xcdab, -0xcb76,0x0000,0xcb77,0xa877,0x0000,0xcb74,0xa876,0x0000, -0xa879,0xcb75,0xa87b,0xa87a,0xcb78,0xa878,0x0000,0x0000, -0x0000,0xaad1,0xaacf,0xcdad,0x0000,0xaace,0x0000,0x0000, -0x0000,0xaad3,0xaad5,0xaad2,0x0000,0xcdb0,0xcdac,0xaad6, -0x0000,0xaad0,0xa87c,0x0000,0xaad4,0xcdaf,0x0000,0x0000, -0xcdae,0x0000,0xaacd,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xd05b,0xad47,0xad48,0xd05d,0x0000,0xd057, -0xd05a,0xd063,0xd061,0x0000,0xad49,0xd067,0xad4c,0xd064, -0xd05c,0xd059,0x0000,0x0000,0xdb49,0xd062,0xad44,0xd065, -0xd056,0xd05f,0xad46,0xad4b,0xd060,0xad4f,0xad4d,0x0000, -0xd058,0xad4a,0x0000,0xd05e,0xad4e,0xad45,0xd066,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xafda,0x0000,0xafe3, -0xafd8,0xafd6,0xd36a,0xafde,0xafdb,0xd36c,0x0000,0x0000, -0xafdd,0xd36b,0xd369,0xd36e,0xafe2,0xafe0,0xdb48,0x0000, -0xd36f,0xd36d,0xafd7,0x0000,0x0000,0xafd9,0xafdc,0x0000, -0xafdf,0x0000,0xafe1,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xd74e,0xb2e4,0x0000, -0xd745,0xd747,0x0000,0xd748,0x0000,0xd750,0xd74c,0xd74a, -0x0000,0xd74d,0xd751,0xb2e5,0xb2e9,0xd746,0x0000,0xd74f, -0x0000,0xb2e7,0x0000,0xb2e6,0xd74b,0xd749,0x0000,0xb2e3, -0xb2e8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xb5c8,0xdb51,0x0000,0x0000,0xdb4f,0xb5ca,0x0000, -0x0000,0x0000,0x0000,0xdb4a,0xdfa1,0x0000,0xb5c9,0xdb4e, -0x0000,0x0000,0xdb4b,0xb5c5,0xb5cb,0xdb50,0xb5c7,0xdb4d, -0xbb47,0xb5c6,0xdb4c,0xb5cc,0xb5c4,0xb5c3,0x0000,0x0000, -0x0000,0x0000,0x0000,0xdf77,0xdf75,0x0000,0xdf7b,0x0000, -0xdf73,0xdfa2,0xdf78,0x0000,0xdf72,0xb87b,0xb8a3,0xdf7d, -0x0000,0xdf76,0x0000,0xb87e,0x0000,0x0000,0xb87c,0xdf7e, -0xb879,0xb878,0xdf79,0xb87d,0xb5cd,0x0000,0xdf7c,0xdf74, -0xb87a,0xb8a1,0xb8a2,0x0000,0x0000,0x0000,0x0000,0xbb4c, -0xbb48,0x0000,0xbb4d,0xe3a6,0x0000,0x0000,0xe3a5,0xe3a7, -0xbb4a,0xe3a4,0xbb4b,0xe3aa,0xe3a9,0xe3a8,0x0000,0xbb49, -0x0000,0x0000,0x0000,0x0000,0x0000,0xe741,0x0000,0xe744, -0xbda8,0xe743,0xbda7,0xbda3,0xbda4,0xbda5,0xe740,0xe6fe, -0xbda6,0x0000,0xe742,0xe6fd,0x0000,0x0000,0xeae9,0xeaf3, -0xbfb1,0xbfb0,0x0000,0xeaed,0xeaef,0x0000,0xeaea,0x0000, -0xeaee,0xeae8,0xeaf1,0xbfaf,0xeaf0,0xeaec,0x0000,0xeaf2, -0x0000,0xeaeb,0xc174,0xede8,0xedee,0xc178,0xc17a,0xc177, -0xc176,0x0000,0xc175,0xc173,0xede9,0xedec,0xc172,0xeded, -0x0000,0xc179,0xedeb,0x0000,0xedea,0xc2c0,0x0000,0xc2c1, -0xf0a1,0xf07d,0xf07e,0x0000,0x0000,0xf2c2,0x0000,0xf2c1, -0xc3be,0xf4b4,0xc4a4,0xf4b3,0x0000,0xf5f0,0xf745,0xc5a6, -0xf943,0xf944,0xc5d8,0xa6da,0x0000,0xaad7,0xdb52,0xbb4e, -0xc17b,0xedef,0xa6db,0x0000,0xafe5,0xafe4,0xdb53,0x0000, -0x0000,0x0000,0xeaf4,0xa6dc,0xad50,0x0000,0x0000,0xdb54, -0xdb55,0xdb56,0xbb4f,0xbfb2,0xa6dd,0x0000,0xaad8,0xd068, -0xafe6,0xd370,0xb2ea,0x0000,0xdb57,0xb8a4,0x0000,0xbb50, -0xbfb3,0xc17c,0xc2c2,0xf4b5,0xa6de,0xaad9,0x0000,0x0000, -0xafe7,0xd752,0xb5ce,0x0000,0xbb51,0xe3ab,0xe745,0x0000, -0x0000,0x0000,0x0000,0xa6df,0xb5cf,0xdfa3,0xbb52,0xa6e0, -0xcdb1,0xd069,0xad51,0x0000,0x0000,0xd372,0x0000,0x0000, -0xafea,0x0000,0xafe8,0xafe9,0xafeb,0x0000,0x0000,0xd371, -0x0000,0x0000,0xd757,0xd754,0xd756,0xb2eb,0xb2ed,0xb2ec, -0xd753,0xb2ee,0xd755,0x0000,0xdb58,0xdb59,0x0000,0xdb5a, -0xdfa6,0x0000,0xdfa7,0x0000,0xdfa5,0xdfa8,0x0000,0xb8a5, -0x0000,0xdfa4,0x0000,0xbb53,0x0000,0x0000,0xe74a,0xe746, -0xe749,0xe74b,0xe748,0xe747,0x0000,0xeaf5,0xeaf6,0xeaf7, -0xbfb4,0xbfb5,0xedf1,0xedf0,0xedf2,0x0000,0xf0a3,0xf0a2, -0x0000,0xf2c4,0x0000,0xf2c5,0xf2c3,0x0000,0xc4a5,0x0000, -0xf4b6,0xf4b7,0x0000,0xf746,0xf7ef,0xf8bb,0xa6e1,0xa87d, -0x0000,0xc17d,0xa6e2,0x0000,0xd758,0xdb5b,0x0000,0xc641, -0xca4a,0x0000,0x0000,0x0000,0xca4b,0xca4d,0xa6e3,0xca4e, -0xca4c,0x0000,0x0000,0xcba2,0xcba3,0xcb7b,0x0000,0x0000, -0x0000,0x0000,0xcba1,0xa8a1,0x0000,0xa8a2,0xcb7c,0xcb7a, -0xcb79,0xcb7d,0xa87e,0xcb7e,0xd06a,0x0000,0x0000,0x0000, -0xcdb6,0xaadc,0xcdb5,0xcdb7,0x0000,0xaadb,0xcdbc,0xaadf, -0xcdb2,0xcdc0,0xcdc6,0xaae6,0xcdc3,0xaae3,0x0000,0xcdb9, -0xcdbf,0xcdc1,0x0000,0xcdb4,0xaae2,0xaadd,0xcdba,0xaae4, -0xaae7,0xaae1,0x0000,0xaada,0xcdbe,0xcdb8,0xcdc5,0xaae9, -0xaae5,0xaae0,0xcdbd,0xafec,0xcdbb,0xaade,0xaae8,0x0000, -0xcdb3,0x0000,0xcdc2,0xcdc4,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xad62,0xad5c,0xad64,0xad61,0xd071,0xd074,0xad5d, -0x0000,0xd06b,0x0000,0xad56,0xad60,0x0000,0xad63,0xad65, -0xd0a2,0xd077,0x0000,0xad55,0xd0a1,0xad59,0xad57,0xad52, -0xd06f,0x0000,0xd07e,0xd073,0xd076,0xd0a5,0x0000,0xad66, -0xd07d,0xad5e,0xd078,0xd0a4,0xd075,0xd079,0xd07c,0x0000, -0x0000,0xd06d,0xd0a3,0xd07b,0x0000,0x0000,0xd06c,0x0000, -0xd070,0xad5f,0xad5a,0xad53,0xad58,0xad54,0xad67,0xd06e, -0xd3a5,0xad5b,0x0000,0x0000,0xd07a,0xce41,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xd3a8,0xaffa, -0x0000,0xd376,0x0000,0xd3a3,0xd37d,0x0000,0xd3b2,0x0000, -0xd3aa,0x0000,0xd37e,0x0000,0xd3a9,0xd378,0xd37c,0xd3b5, -0xaffd,0xd3ad,0xd3a4,0xafed,0xd3b3,0xd374,0x0000,0xd3ac, -0x0000,0xaffc,0xaff7,0xd373,0xaff5,0xaff4,0xaff9,0xd3ab, -0xaff1,0xaff8,0xd072,0xdb5c,0xd3a6,0x0000,0x0000,0xd37a, -0xaffb,0xd37b,0xd3a1,0xaffe,0xd375,0xd3af,0x0000,0xd3ae, -0xd3b6,0xaff3,0xaff0,0xd3b4,0xd3b0,0xd3a7,0xd3a2,0xaff6, -0xaff2,0xd377,0xafee,0xd3b1,0xafef,0x0000,0xd379,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,0xd75e,0xd760,0xd765,0xd779,0xb2fc, -0xb2f2,0x0000,0xd75d,0xb2fd,0xb2fe,0xd768,0xd76f,0xd775, -0x0000,0xd762,0x0000,0xd769,0x0000,0x0000,0xb340,0xd777, -0xd772,0xb2fa,0xb2f8,0xd76e,0xd76a,0xd75c,0xb2ef,0xd761, -0xd759,0x0000,0xb2f7,0xb2f9,0xd766,0xd763,0xb2f4,0xd773, -0xb2f1,0xd764,0xd77a,0xd76c,0x0000,0xd76b,0xb2f0,0x0000, -0xb2fb,0x0000,0xb2f3,0xd75a,0xd75f,0xd770,0xd776,0xb341, -0xd75b,0xd767,0xd76d,0xb2f6,0x0000,0x0000,0xd778,0xd771, -0xd774,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xb2f5,0x0000,0xdb6c, -0xdb60,0xb5d7,0xdb7d,0xdba7,0xdbaa,0xb5d5,0xdb68,0xdba3, -0xdb69,0xdb77,0xb5e2,0xdb73,0xb5df,0x0000,0xdb74,0xdb5d, -0x0000,0xdba4,0x0000,0x0000,0xb5e8,0xdba1,0xdb75,0xdbac, -0xdb70,0xdfc8,0x0000,0xdbaf,0xb5e6,0xdb6e,0xdb7a,0xb5e9, -0xb5d4,0xdb72,0xdbad,0xdb6b,0xdb64,0xdb6f,0x0000,0xdb63, -0xdb61,0xb5d0,0xdba5,0xdb6a,0xdba8,0x0000,0xdba9,0xb5d8, -0xb5dd,0xb5d9,0xb5e1,0xdb7e,0xb5da,0xdb76,0xdb66,0x0000, -0xb5d2,0xdb5e,0xdba2,0xdbab,0xdb65,0xb5e0,0xdbb0,0xdb71, -/* 0x8400 */ -0x0000,0xdb6d,0x0000,0xb5d1,0xb5e5,0x0000,0xdb7c,0xb5e7, -0x0000,0xdb78,0xb5dc,0xb5d6,0xb5de,0xb5d3,0xb5e4,0xdb79, -0xdb67,0xdb7b,0xdb62,0xdba6,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xdbae,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xdb5f,0x0000,0x0000,0x0000,0x0000, -0x0000,0xdfc7,0x0000,0xdfdd,0xb855,0xdfcc,0x0000,0xdfca, -0xdfb5,0xb8a9,0xdfc5,0xdfd9,0xdfc1,0xb8b1,0xdfd8,0xdfbf, -0xb5e3,0xdfcf,0xdfc0,0xdfd6,0xb8b0,0xb8a8,0x0000,0xdfaa, -0xdfb2,0x0000,0xdfcb,0xdfc3,0xdfdc,0xdfc6,0xb8b6,0xdfd7, -0x0000,0xb8ad,0x0000,0xdfc9,0xdfd1,0xdfb6,0xdfd0,0x0000, -0xdfe1,0xdfb1,0xdfd2,0x0000,0xdfdf,0x0000,0xdfab,0xb5db, -0x0000,0xdfb9,0xdfb8,0xb8af,0x0000,0xdfbc,0xdfbe,0xdfcd, -0xdfde,0xb8b2,0x0000,0xb8b3,0x0000,0xdfb0,0xb8ab,0xdfb4, -0xdfda,0xb8b4,0x0000,0xb8ac,0xb8ae,0xb8b5,0xdfe0,0xdfd3, -0xdfce,0x0000,0x0000,0xdfbb,0xdfba,0xb8aa,0xdfac,0xb8a7, -0xdfc4,0xdfad,0xdfc2,0x0000,0x0000,0xdfb7,0xdfdb,0x0000, -0x0000,0x0000,0xb8a6,0x0000,0x0000,0x0000,0xdfb3,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xdfaf,0xdfd5,0xdfae, -0xbb60,0xe3d3,0x0000,0x0000,0xe3c2,0x0000,0x0000,0xe3ac, -0xe3ca,0xbb58,0xe3bb,0xe3c5,0xbb5b,0xe3be,0xbb59,0xe3af, -0xe3cd,0xe3ae,0xe3c1,0x0000,0xe3ad,0x0000,0x0000,0xe3bf, -0xe3c8,0xe3c6,0xe3ba,0xe3b5,0xe3b3,0x0000,0xe3b4,0xe3c7, -0xe3d2,0xe3bc,0xbb5a,0x0000,0xe3b7,0x0000,0xe3cb,0x0000, -0xbb5d,0xe3b6,0xe3b0,0xe3c0,0xbb61,0x0000,0x0000,0xbb55, -0xbb5e,0xe3b8,0xe3b2,0x0000,0xbb57,0xdfd4,0xbb56,0xe3c3, -0x0000,0xbb54,0xbb63,0xbb5c,0xe3c4,0xe3b9,0xe3b1,0xe3cc, -0xe3bd,0xbb62,0xe3d0,0xbb5f,0xe3cf,0x0000,0xe3c9,0xe3ce, -0x0000,0x0000,0x0000,0xe3d1,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xe773, -0xe774,0xe767,0xe766,0xe762,0xbdb4,0x0000,0xbdac,0xe776, -0xe775,0xdfa9,0xe75f,0xe763,0xe75d,0x0000,0xe770,0xe761, -0x0000,0xe777,0xe75a,0xe758,0xe764,0xe76e,0xe769,0xbdb6, -0xe74f,0x0000,0xe76d,0x0000,0x0000,0x0000,0xbdb7,0xdfbd, -0xe75b,0xe752,0xe755,0xe77b,0xe75c,0xe753,0xe751,0xe74e, -0x0000,0xbdb0,0xe765,0xbdaf,0xbdb3,0xe760,0xe768,0xbda9, -0xe778,0xe77c,0xbdab,0x0000,0xe757,0xe76b,0xe76f,0xe754, -0xe779,0xbdb2,0x0000,0xbdb1,0xe74c,0xbdb5,0xe772,0xe756, -0xe76a,0xe750,0xe75e,0xe759,0xbdad,0xbdae,0xe76c,0xe77d, -0xe77a,0xe771,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xe74d,0x0000,0xbdaa,0xeb49,0x0000, -0xeb40,0xeb43,0x0000,0xbfbb,0xeb45,0xeaf9,0xeb41,0xeb47, -0xbfb8,0xbfbc,0xbfb6,0x0000,0x0000,0xeafb,0xeb4c,0x0000, -0x0000,0xeb46,0x0000,0xeafc,0xeb55,0xeb4f,0xeaf8,0xee46, -0xeafe,0xbfb7,0x0000,0xeb4a,0x0000,0xeb54,0xbfbf,0x0000, -0xeb51,0xeafd,0xeb44,0xeb48,0xeb42,0xeb56,0xeb53,0xeb50, -0xbfb9,0xbfba,0xbfbe,0xeafa,0xeb57,0xbfbd,0xeb4d,0x0000, -0x0000,0xeb4b,0x0000,0x0000,0x0000,0xeb4e,0xee53,0xee40, -0xee45,0xee52,0xee44,0xedfb,0xee41,0x0000,0xc1a2,0x0000, -0xedf4,0xee4d,0xee4f,0xedf3,0xc1a1,0xee51,0xee49,0xc1a8, -0xee50,0xee42,0xc1aa,0xedf9,0xeb52,0xee4a,0xee47,0xedf5, -0xee55,0xc1a4,0x0000,0x0000,0xc1a5,0xedf7,0xee48,0x0000, -0xee54,0xee4b,0xedfd,0xc1a7,0xc1a3,0xee4c,0xedfe,0xee56, -0xedf8,0xee43,0xee4e,0xedfa,0xedfc,0x0000,0xc2cb,0xedf6, -0xc1a9,0xc2c4,0xc17e,0x0000,0x0000,0x0000,0x0000,0xc1a6, -0xc2c8,0xf0b3,0x0000,0xf0a9,0xf0a4,0xf0aa,0xf0b4,0xf0b8, -0xf0b7,0xc2ca,0xc2c9,0x0000,0x0000,0xf0ab,0xf0b9,0xf0ae, -0xf0a6,0x0000,0xf0a8,0xf0a7,0xf0ad,0xf0b2,0xf0a5,0xf0ac, -0xf0b1,0xc2c7,0x0000,0xf0af,0x0000,0xc2c5,0xf0b0,0xc2c3, -0xc2c6,0xf2d5,0xf0b5,0x0000,0x0000,0xc3c2,0x0000,0xf2cd, -0xf2d1,0xf2c9,0xf2cc,0x0000,0xf2d4,0xc3c0,0xf2d9,0xf2d2, -0x0000,0xf2ca,0xf2da,0xf2d3,0xc3c3,0xc3c4,0xf2d7,0x0000, -0xf2cb,0xc3bf,0xc3c1,0xf2c6,0xf2ce,0xf2c8,0x0000,0xf2d8, -0xf2d6,0xf2c7,0xf2cf,0x0000,0x0000,0x0000,0xf4be,0xc3c5, -0xf2d0,0xc4a7,0xc4a9,0xc4a6,0x0000,0xf4c3,0xf4bb,0xf4b9, -0xf4bd,0xf4ba,0x0000,0x0000,0xf4bf,0xf4c1,0xc4aa,0xc4ac, -0x0000,0xf4c0,0xc4ad,0xc4ab,0xf4c2,0x0000,0x0000,0x0000, -0x0000,0xc4a8,0x0000,0x0000,0x0000,0x0000,0x0000,0xc4f4, -0xf5f1,0xf5f7,0xc4f6,0xf4bc,0xf5f6,0x0000,0xf5fd,0xf5f4, -0xf5fb,0xf5fa,0xf4b8,0xf5f5,0xf0b6,0xf5fe,0xf5f3,0xf5f8, -0x0000,0xf5fc,0xf5f2,0x0000,0xf74a,0xc4f5,0xf5f9,0x0000, -0x0000,0xf7f4,0xf74b,0xf749,0xf747,0xf748,0xf74c,0x0000, -0xc5d9,0xf7f2,0xf7f0,0xf7f5,0xf7f3,0x0000,0xf7f6,0xc5da, -0xf7f1,0x0000,0x0000,0xf8bc,0x0000,0x0000,0xf945,0xf946, -0xf947,0x0000,0x0000,0xf9c7,0xf9bd,0xca4f,0xaaea,0x0000, -0xad68,0x0000,0xd3b8,0xd3b7,0xb040,0xb342,0xd77c,0x0000, -0x0000,0xd77b,0x0000,0xb5ea,0xb8b8,0x0000,0xb8b7,0xb8b9, -0x0000,0xe3d4,0xe77e,0xeb58,0xeb5a,0xeb59,0x0000,0xc1ab, -0xee57,0xf0ba,0xf9a5,0xa6e4,0x0000,0xcdc9,0xcdca,0xcdc8, -0xcdc7,0xaaeb,0x0000,0xd0a9,0xd0a7,0x0000,0x0000,0xd0a6, -0x0000,0xad69,0xad6b,0xad6a,0xd0a8,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xd3c4,0xd3c1,0xd3bf, -0x0000,0x0000,0xb041,0xd3c2,0xb046,0xd3bc,0xd3cb,0x0000, -0xd3cd,0xd3bd,0x0000,0xb043,0xd3ce,0xd3c9,0xd3bb,0xd3c0, -0xd3ca,0xd3c6,0xd3c3,0x0000,0xb048,0xd3cc,0xd3be,0x0000, -0x0000,0xd3c7,0xd3b9,0xb047,0xb044,0xd3c5,0x0000,0xd3c8, -0xd3ba,0xb045,0xb042,0x0000,0x0000,0x0000,0x0000,0xb34c, -0xd7a5,0xb34b,0x0000,0xd7a8,0xd7ab,0xb348,0xb346,0xd77e, -0xd7a9,0xd7a7,0xd7a4,0xd7ac,0xd7ad,0xd7af,0xd7b0,0xd77d, -0xb345,0xd7a2,0xd7a1,0xd7ae,0xb347,0xd7a3,0xb349,0xb344, -0xd7a6,0xb34d,0x0000,0xb34a,0xd7aa,0x0000,0x0000,0x0000, -0xb5f1,0xdbbf,0x0000,0xdbb4,0xb5ee,0x0000,0xdfe7,0xdbbd, -0xdbb1,0xb5ec,0xdbb6,0xb5ef,0xdbba,0xdbb8,0xb5f2,0xb5eb, -0x0000,0x0000,0xdbb2,0xdbb5,0xb5f0,0x0000,0xdbb3,0x0000, -0xdbbe,0xdbbc,0xdbb7,0xdbb9,0xdbbb,0xb5ed,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xdfe8,0xdfee,0xdfe4, -0xdfea,0xb8ba,0xdfe6,0xb8c0,0x0000,0x0000,0xb8bf,0x0000, -0xb8be,0xdfed,0xb8c1,0xb8c2,0xdfe3,0xdff0,0xb8c3,0xb8bd, -0xb8bc,0xdfec,0xb8c4,0xdfe2,0xdfe5,0xdfef,0xdfeb,0x0000, -0x0000,0xe3f4,0xe3e9,0xb8bb,0x0000,0x0000,0x0000,0x0000, -0xbb6a,0xe3dd,0xe3f2,0xe3de,0xbb65,0x0000,0xe3db,0x0000, -0xe3e4,0xe3dc,0xbb67,0xe3d6,0xe3f1,0xbb68,0xe3ee,0xe3ef, -0xe3d7,0xbb6d,0xe3e6,0x0000,0xe3e0,0xe3e7,0xe3da,0x0000, -0xe3f3,0xe3eb,0xe3e5,0xe3d5,0xbb69,0xe3ec,0x0000,0xbb6c, -0xe3f0,0x0000,0xe3ea,0xbb66,0xe3e8,0x0000,0xe3e2,0xbb64, -0xe3d9,0xe3e1,0xe3ed,0xe3df,0x0000,0x0000,0xe3e3,0x0000, -0x0000,0x0000,0x0000,0x0000,0xbdc1,0xdfe9,0xe7b2,0xe7bb, -0xe7b1,0xe7ad,0xe7aa,0xbdc2,0xe7a8,0xbb6b,0xe7a1,0xbdc0, -0xe7a7,0xbdbf,0xe7ac,0xe7a9,0xe7b9,0xe7b4,0xe7ae,0xe7b3, -0xbdbb,0xe7ab,0xe7be,0xe7a2,0xe7a3,0xe7ba,0xbdbc,0xe7bf, -0xbdbe,0xe7c0,0xe7b0,0xe3d8,0xe7b6,0xe7af,0xe7b8,0xe7b5, -0x0000,0x0000,0x0000,0xe7a6,0xbdb9,0xe7bd,0xbdba,0xe7a4, -0xbdbd,0xeb64,0xe7b7,0xe7bc,0x0000,0x0000,0x0000,0x0000, -0x0000,0xeb61,0xbdb8,0xbfc0,0xeb6b,0xeb67,0x0000,0xeb65, -0xeb60,0xeb6f,0x0000,0x0000,0x0000,0xbfc4,0x0000,0xeb5c, -0xeb68,0xeb69,0xeb5f,0xeb5e,0xeb6c,0x0000,0xeb62,0xeb5d, -0xeb63,0x0000,0xeb6e,0xeb5b,0xeb6d,0xeb6a,0xbfc2,0xbfc1, -0x0000,0x0000,0xbfc3,0xeb66,0xf0cb,0x0000,0x0000,0x0000, -0x0000,0x0000,0xee59,0xc1b1,0xee5d,0xee5a,0xee61,0xee67, -0xee5c,0x0000,0xee70,0xc1ae,0xee6a,0xee5f,0xee6b,0xee66, -0xee6d,0xee5e,0xc1b3,0xc1b2,0xee60,0xee6e,0xee58,0xee6c, -0xc1ac,0x0000,0xee64,0xee63,0xee68,0xee5b,0xc1b0,0x0000, -0xc1b4,0xee62,0xee69,0xc1b5,0xee65,0x0000,0x0000,0x0000, -0x0000,0xc1ad,0xc1af,0xf0c7,0xf0c5,0x0000,0x0000,0xf0cc, -0xf0c9,0xf0cd,0x0000,0xf0be,0xf0c6,0xf0d1,0xee6f,0xf0c2, -0xc2cf,0xe7a5,0xf0bd,0xf0ca,0xf0c4,0xf0c1,0xf0bc,0xf0bb, -0xf0d0,0x0000,0xf0c0,0xf0bf,0xc2cd,0xf0c8,0x0000,0xc2cc, -0x0000,0x0000,0xc2ce,0xf0c3,0xf0cf,0x0000,0xf2de,0xf2df, -0x0000,0xc3c9,0xf2dc,0xc3c6,0xf2e4,0x0000,0xc3ca,0xf2e6, -0xf2db,0xf0ce,0xf2e8,0xf2dd,0x0000,0xc3c7,0xf2e3,0x0000, -0xf2e5,0xf2e0,0xf2e7,0xf2e2,0xf2e1,0xc3c8,0x0000,0x0000, -0xf4c5,0xf4c6,0x0000,0xf4c8,0xc4ae,0xc4af,0xf4c9,0xf4c7, -0x0000,0xf4c4,0x0000,0xf642,0xf645,0xf641,0x0000,0xc4fa, -0xf643,0xc4f9,0xc4f8,0xc4f7,0xf644,0xf751,0xf74f,0x0000, -0xf74e,0xf640,0xf750,0xf646,0xf74d,0x0000,0xf7f9,0xf7d7, -0xf7f7,0xc5db,0xf7f8,0xf7fa,0x0000,0xf8bf,0xc5fa,0xf8be, -0xf8bd,0xc5fb,0x0000,0xc65a,0xf96e,0xf9a7,0xf9a6,0xf9a8, -0xa6e5,0xd0aa,0x0000,0xd3cf,0xd3d0,0x0000,0x0000,0x0000, -0xdbc0,0x0000,0xf647,0xf8c0,0xa6e6,0xad6c,0xd0ab,0x0000, -0x0000,0x0000,0xd7b1,0xb34e,0x0000,0xdbc2,0xdbc1,0xb5f3, -0x0000,0xb8c5,0xe7c1,0xbdc3,0x0000,0xbdc4,0x0000,0x0000, -0x0000,0xbfc5,0xc5fc,0xa6e7,0x0000,0x0000,0x0000,0xd0ac, -0xaaed,0xd0ae,0xd0ad,0xad6d,0x0000,0xd3d1,0x0000,0xd3d8, -0xb049,0xd3d6,0xd3d4,0x0000,0xd3db,0xd3d2,0xd3d3,0xb04a, -0x0000,0xb04e,0x0000,0x0000,0xd3dc,0xb04d,0xd3da,0xd3d7, -0xd3d5,0xb04b,0xb04c,0xd3d9,0x0000,0x0000,0x0000,0x0000, -0xb350,0xd7b2,0x0000,0xb355,0xd7c2,0xb354,0xd7c4,0x0000, -0x0000,0xd7b8,0xb352,0xd7c3,0x0000,0xd7b3,0xb353,0xd7bf, -0xd7bb,0xd7bd,0xd7b7,0xd7be,0x0000,0x0000,0xb34f,0xd7ba, -0x0000,0xd7b9,0xd7b5,0x0000,0xd7c0,0x0000,0x0000,0xd7bc, -0xd7b4,0x0000,0xd7b6,0xb351,0xd7c1,0x0000,0x0000,0x0000, -0x0000,0xb5f6,0xdbcd,0x0000,0x0000,0x0000,0xdbc9,0xdbcb, -0xdbc6,0xdbc5,0xdbc3,0x0000,0xdbca,0xdbcc,0xdbc8,0x0000, -0xdbc7,0xb5f4,0xb5f5,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xdbcf,0xb8cd,0xdff2,0xdff8,0xdff3,0xdff4,0xf9d8, -0xdff9,0x0000,0xb8cf,0x0000,0xb8c7,0xb8ce,0xdff1,0xdbc4, -0xb8ca,0xb8c8,0xdff7,0xdff6,0xb8c9,0xb8cb,0xdff5,0xb8c6, -0x0000,0xb8cc,0x0000,0x0000,0x0000,0x0000,0x0000,0xe3f6, -0xbb74,0x0000,0x0000,0xe442,0xe441,0x0000,0xe3fb,0xbb76, -0xe440,0xe3f7,0xe3f8,0xbb6e,0xbb70,0x0000,0xe3fd,0xe3f5, -0xbb72,0xbb71,0xe3f9,0xe3fe,0xe3fc,0xbb73,0xe3fa,0x0000, -/* 0x8900 */ -0x0000,0xdbce,0xbb6f,0x0000,0x0000,0xe7c2,0xe7c9,0xbdc6, -0x0000,0xe7cd,0xbdca,0xe7c5,0xe7c3,0x0000,0xe7cc,0x0000, -0xbdc5,0xe7cb,0xbdc7,0xbdc8,0xe7c4,0xbdc9,0xe7ca,0xe7c6, -0xe7c7,0xe7c8,0xbb75,0x0000,0x0000,0x0000,0xeb70,0xeb7c, -0x0000,0xbfca,0xeb77,0xeb79,0x0000,0xbfc8,0xeb71,0xeb75, -0x0000,0xeb78,0xbfc6,0xbfc9,0xeb7b,0xeb73,0xeb74,0xeb7a, -0xeb72,0xeb76,0xbfc7,0xee72,0x0000,0xee71,0xc1b7,0xee77, -0xc1b9,0x0000,0x0000,0xc1b6,0xee73,0xc1ba,0xee74,0x0000, -0x0000,0xee75,0xee78,0x0000,0xc1b8,0x0000,0xf0d6,0x0000, -0x0000,0xf0d9,0x0000,0xf0d3,0xf0d5,0x0000,0x0000,0xf0d4, -0xf0d7,0xf0d8,0xee76,0xf0d2,0x0000,0x0000,0xc3cd,0xf2ec, -0xf2ef,0xf2f1,0xf2ea,0xf2eb,0xf2ee,0xf2f0,0xc3ce,0xc3cc, -0xc3cb,0xf2ed,0xf2e9,0xf4ca,0xc4b0,0x0000,0xf4cb,0x0000, -0x0000,0xf649,0xc4fb,0xf64b,0xc4fc,0xf648,0xf64a,0xc5a8, -0x0000,0xf752,0xc5a7,0xf7fd,0xf7fc,0x0000,0xf7fb,0x0000, -0x0000,0xf948,0xf949,0xf94b,0xf94a,0x0000,0xca50,0xa6e8, -0x0000,0xad6e,0xd7c5,0xb5f7,0x0000,0xdffa,0xc2d0,0x0000, -0xf2f2,0x0000,0x0000,0xa8a3,0x0000,0x0000,0x0000,0xb357, -0x0000,0x0000,0x0000,0xb356,0x0000,0xdbd0,0xb5f8,0xdbd2, -0xdbd1,0x0000,0x0000,0xdffb,0xb8d0,0xe443,0xe446,0xe445, -0x0000,0xe444,0xe7ce,0xe7d0,0xe7cf,0x0000,0xbfcc,0x0000, -0x0000,0x0000,0xbfcb,0x0000,0xc1bb,0xee79,0xee7b,0xee7a, -0x0000,0x0000,0xc2d1,0x0000,0x0000,0x0000,0xf2f4,0xf2f3, -0x0000,0xf4cc,0xc4b1,0x0000,0x0000,0xc4fd,0xf754,0xf753, -0xc65b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xa8a4,0xd0af,0xad6f,0xd7c8,0xd7c6,0x0000, -0x0000,0xd7c7,0xdbd4,0xdbd5,0xe043,0xdbd3,0x0000,0xdffc, -0xe041,0xe040,0xe042,0xb8d1,0xdffe,0xdffd,0xe044,0x0000, -0xe449,0xe447,0x0000,0xe448,0xe7d3,0xe7d1,0x0000,0x0000, -0xe7d2,0xeb7d,0xee7c,0xee7d,0xc2d2,0x0000,0xf2f5,0xf4cd, -0xc4b2,0x0000,0xf64c,0xf755,0xc5a9,0x0000,0xf7fe,0xf94c, -0xa8a5,0x0000,0xad71,0xad72,0xd0b0,0x0000,0x0000,0xd0b1, -0xad70,0x0000,0xb054,0x0000,0xb052,0x0000,0xb051,0xb058, -0xb050,0xb059,0xd3dd,0xb056,0x0000,0xb053,0xb057,0xb055, -0xb04f,0x0000,0x0000,0xb35f,0x0000,0xb359,0xd7cc,0xb35e, -0x0000,0x0000,0xb360,0xb35a,0x0000,0xb35b,0x0000,0xd7ca, -0x0000,0x0000,0xb358,0x0000,0xd7cb,0xb35d,0x0000,0x0000, -0xd7c9,0xb35c,0x0000,0x0000,0xb644,0x0000,0xb646,0x0000, -0x0000,0xdbd8,0xb645,0xb5f9,0xb5fd,0x0000,0xb8e4,0xe049, -0xdbda,0xb5fe,0x0000,0x0000,0xdbdd,0xdbde,0xb643,0x0000, -0xdbe0,0x0000,0xdbe2,0x0000,0xdbe3,0xdbd7,0xdbd6,0xdbe4, -0xb642,0xdbe1,0xdbdf,0x0000,0xb640,0xb5fb,0xb647,0xdbdb, -0xdbdc,0xdbd9,0x0000,0xb641,0x0000,0x0000,0xb5fc,0x0000, -0xb5fa,0xe048,0xb8df,0xb8da,0x0000,0x0000,0xb8d5,0x0000, -0xb8e5,0xb8d6,0x0000,0xb8d2,0xb8e1,0xb8de,0xb8e0,0x0000, -0xb8d7,0xb8dc,0xb8d3,0xb8d4,0xe050,0xe04d,0xe045,0xe04a, -0x0000,0xb8e2,0xe051,0xb8e3,0xb8d9,0x0000,0x0000,0xe047, -0x0000,0xe04f,0xe04b,0xe04e,0xe04c,0xb8dd,0xe046,0xb8d8, -0x0000,0x0000,0x0000,0xe44c,0xbb78,0xbb7b,0x0000,0xe44e, -0x0000,0xbba5,0xe44d,0xbb7d,0x0000,0xbdcf,0xe44f,0x0000, -0xbba4,0xe44b,0xbba6,0x0000,0x0000,0x0000,0xbb79,0x0000, -0xb8db,0xbb7c,0x0000,0xbb7a,0xbb7e,0xbba2,0xbb77,0xbba7, -0xbba3,0x0000,0xbba1,0xe44a,0x0000,0x0000,0x0000,0x0000, -0xbdd6,0x0000,0xbdd2,0x0000,0x0000,0x0000,0xbdd9,0x0000, -0xe7d6,0xbdda,0xe7e2,0xe7db,0xbdcb,0xe7e3,0xe7dd,0xbdd5, -0xe7de,0x0000,0xbdd4,0xe7e1,0xbdce,0xe7df,0xe7d5,0xbdcd, -0xebaa,0xbdd3,0x0000,0xbdd0,0x0000,0xbdd8,0x0000,0xe7d4, -0x0000,0xe7d8,0xbdcc,0xe7d7,0xe7d9,0xe7da,0xbdd7,0xe7dc, -0xe7e0,0xe7e4,0x0000,0xbddb,0xbfd2,0xeba5,0xebab,0xeba8, -0xeb7e,0xebac,0xeba1,0x0000,0xeba7,0x0000,0xbfcd,0xbfd3, -0xebad,0x0000,0x0000,0xbfcf,0x0000,0xbfd9,0xbfd4,0xebaf, -0xeba9,0xbfd0,0xeba2,0xbfda,0xeba3,0xeba4,0xbfdb,0xbfd8, -0xbdd1,0x0000,0xbfce,0xebb0,0xbfdc,0x0000,0xbfd5,0xebae, -0xbfd1,0xbfd6,0xbfd7,0x0000,0xc1c3,0xeea4,0xeead,0xeeaa, -0xeeac,0x0000,0xc1c0,0xeea5,0x0000,0xeeab,0xc1bc,0xeea7, -0xc1c4,0xeea3,0xeea8,0xeeaf,0xeba6,0xeea9,0xeea2,0xc1bd, -0xeea1,0xc1be,0xeeb0,0xc1bf,0xeeae,0xc1c2,0xee7e,0x0000, -0xc1c1,0x0000,0xeea6,0xf0dc,0xf0ea,0xf0e5,0xf0e7,0xf0db, -0xc2d3,0x0000,0xf0da,0xc2d6,0xc2d5,0x0000,0xf0e9,0xf0e1, -0xf0de,0xf0e4,0x0000,0xf0dd,0x0000,0xf0df,0xf0e8,0xf0e6, -0x0000,0xc2d4,0xf0ed,0xf0eb,0xf0e2,0xf0ec,0xf0e3,0x0000, -0xf2f9,0xc3cf,0xf341,0x0000,0x0000,0xf64f,0xc3d6,0xf0e0, -0xf2f7,0xc3d2,0xf2f8,0xf2fd,0x0000,0x0000,0xc3d4,0xc3d5, -0xf2f6,0xf340,0xf342,0xf2fa,0xf2fc,0xf2fe,0xf2fb,0xf343, -0xc3d1,0xc3d7,0xc3d3,0x0000,0xc3d0,0xf4d0,0x0000,0xc4b7, -0xf4ce,0x0000,0x0000,0xf4d2,0x0000,0xf4d3,0xc4b5,0xf4d4, -0xf4d1,0x0000,0xf4cf,0xc4b8,0xc4b4,0xf4d5,0x0000,0xc4b6, -0xc4b3,0x0000,0x0000,0x0000,0xc4fe,0x0000,0x0000,0xc540, -0xf64e,0xf64d,0xf650,0xf651,0x0000,0xc541,0xf756,0xf75b, -0xc5aa,0x0000,0xf758,0x0000,0xf757,0xf75a,0xf759,0x0000, -0xf843,0x0000,0xc5dc,0xf842,0xf840,0x0000,0xf841,0x0000, -0x0000,0x0000,0xc5fe,0xc5fd,0xf8c1,0xf8c2,0xc640,0x0000, -0xf94d,0xf94e,0xc667,0x0000,0xc66d,0x0000,0xf9a9,0xf9c8, -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,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,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, -/* 0x8c00 */ -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,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xa8a6, -0x0000,0xd7cd,0x0000,0xd7ce,0xe052,0xe450,0xe7e5,0xc1c6, -0x0000,0xc1c5,0xf0ee,0xf344,0x0000,0xf844,0xa8a7,0xd3de, -0xb05a,0xb361,0xe054,0xe053,0xbddc,0xe7e6,0xbddd,0xeeb1, -0xc2d7,0x0000,0x0000,0x0000,0xc676,0xa8a8,0xcdcb,0xd3df, -0x0000,0x0000,0xb362,0x0000,0xd7cf,0xd7d0,0x0000,0xdbe5, -0x0000,0xb648,0xb8e6,0x0000,0xe056,0xe055,0xe057,0x0000, -0xe451,0xe452,0xbba8,0xbfdd,0xbdde,0xbfde,0x0000,0xeeb5, -0xeeb2,0xeeb4,0xeeb3,0xc1c7,0x0000,0xf0ef,0xf346,0xf345, -0xcba4,0xb05c,0xb05b,0xd3e0,0x0000,0xd7d1,0x0000,0x0000, -0xdbe7,0xdbe6,0xb649,0x0000,0xe059,0xe05a,0xe058,0x0000, -0x0000,0xb8e8,0xb8e7,0x0000,0xbbaa,0xbba9,0x0000,0xe7e7, -0xebb3,0xebb1,0xebb2,0xbfdf,0xeeb7,0xeeb6,0x0000,0xf0f2, -0xf0f1,0xf0f0,0xf347,0x0000,0xf9aa,0xa8a9,0xad73,0x0000, -0xad74,0xb05d,0xb05e,0xd3e2,0xd3e1,0xd7d2,0x0000,0xb368, -0xb366,0xb363,0xb367,0xb365,0xb364,0x0000,0x0000,0xb64a, -0xdbea,0x0000,0xb8ed,0xb64c,0xb651,0xdbec,0xb653,0xb652, -0xb655,0xdbeb,0xdbe8,0xb64f,0xb64b,0xb64d,0xdbe9,0xb654, -0xb650,0xb64e,0xb8ef,0xb8ee,0xb8ec,0xb8f0,0x0000,0xb8ea, -0xb8eb,0x0000,0xb8e9,0x0000,0xe05b,0x0000,0x0000,0xe454, -0x0000,0xbbac,0xbbad,0xbbab,0x0000,0xe453,0x0000,0xe455, -0x0000,0xe7ea,0xe7ec,0x0000,0xbde7,0xe7ed,0xbde0,0xe7e9, -0xbddf,0xbde9,0xbde5,0xbde6,0xbde2,0xe7e8,0xbde1,0xe7ee, -0xe7eb,0x0000,0xbde8,0x0000,0xbde3,0xbde4,0xebb5,0x0000, -0xebb7,0xebb6,0x0000,0xebb8,0xbfe0,0xebb4,0x0000,0x0000, -0xc1cb,0xeeb8,0xc1c8,0xc1cc,0xc1ca,0xc1c9,0xf0f3,0x0000, -0xf0f6,0x0000,0xf0f5,0x0000,0xf0f4,0xc2d8,0xf348,0xf349, -0xc3d8,0xf34a,0xc3d9,0x0000,0x0000,0xc4ba,0x0000,0xc4b9, -0xf652,0x0000,0x0000,0xc542,0xf653,0xf75c,0xc5ab,0xc5ac, -0x0000,0xf845,0x0000,0xc642,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,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,0x0000,0x0000,0xa8aa,0x0000,0xb36a,0xb369, -0xe05c,0xe05d,0x0000,0xbbae,0xebb9,0xbdea,0xebba,0xeeb9, -0xa8ab,0x0000,0xd0b2,0xad76,0xad75,0x0000,0xd3e3,0xb05f, -0xd3e4,0xd7d5,0x0000,0xd7d4,0x0000,0xd7d3,0x0000,0x0000, -0xdbee,0xb658,0x0000,0x0000,0xdbed,0xb657,0x0000,0x0000, -0x0000,0xdbef,0xb656,0x0000,0xe05f,0xe062,0xe060,0xe061, -0xe065,0xe05e,0xe066,0xe063,0xe064,0xbbb0,0xe456,0x0000, -0x0000,0xbbaf,0x0000,0xe7f2,0xe7f0,0x0000,0x0000,0xbdeb, -0xe7ef,0xe7f1,0x0000,0xbdec,0x0000,0xebbb,0x0000,0xebbc, -0xc1cd,0x0000,0xf34c,0xf34e,0xf34b,0xf34d,0xf4d6,0xf654, -0x0000,0x0000,0xf96f,0xa8ac,0xad77,0xd3e5,0xd3e7,0xd3e6, -0x0000,0xd7d8,0xb36c,0x0000,0xd7d6,0x0000,0xb36b,0xd7d9, -0x0000,0xd7da,0xd7d7,0x0000,0x0000,0xdbfb,0xb660,0xdbf3, -0xdbf9,0x0000,0x0000,0xb65b,0xb65e,0xdbf2,0xb659,0xdbf6, -0xe06c,0xb65d,0x0000,0xdbf1,0x0000,0xdbf7,0xdbf4,0xdbfa, -0xdbf0,0xdbf8,0xb65c,0xb65f,0xdbf5,0xb65a,0x0000,0xb8f2, -0xe068,0xb8f1,0xe06f,0xe06e,0xb8f8,0x0000,0xb8f9,0xe070, -0xb8f3,0xe06d,0xb8f7,0xe072,0xe069,0x0000,0xe06b,0xb8f4, -0xe067,0xe06a,0xe071,0xb8f5,0xe073,0x0000,0x0000,0x0000, -0x0000,0x0000,0xb8f6,0x0000,0xbbb1,0xe45b,0xe461,0xe459, -0xe462,0x0000,0xe458,0xe45d,0xe463,0xe460,0xe45f,0xe45e, -0x0000,0xe457,0xe45c,0x0000,0x0000,0xe45a,0x0000,0xbdf1, -0xbdee,0xe7fb,0xe841,0xe843,0xe840,0xe7f8,0xe7fa,0xe845, -0xe842,0xe7fc,0xe846,0xe7f9,0xe844,0xbdef,0xbdf5,0xbdf3, -0xe7f3,0xbdf4,0xbdf0,0xe7f4,0xe7f6,0xe7f5,0xe7fd,0xe7fe, -0x0000,0xbdf2,0x0000,0xbded,0x0000,0x0000,0xe7f7,0x0000, -0xebc6,0xbfe2,0x0000,0xebbd,0xbfe3,0xbfe6,0xebc2,0x0000, -0xebbf,0xbfe5,0x0000,0x0000,0xebc3,0xebc4,0xebbe,0xebc7, -0xebc0,0xebc5,0xbfe4,0x0000,0xbfe1,0xebc1,0x0000,0xeebf, -0xc1d0,0xc1ce,0xc1d1,0xc1cf,0xeebe,0xeebb,0xeeba,0x0000, -0xeebd,0x0000,0x0000,0xeebc,0xf145,0xc2de,0xf0fb,0xf0fa, -0x0000,0xc2d9,0xf141,0xf140,0xf0f7,0xf143,0xf0fc,0xc2dd, -0xf0f9,0xf142,0xf0f8,0xc2da,0xc2dc,0xf0fd,0xc2db,0xf0fe, -0x0000,0xf144,0xf352,0x0000,0xc3de,0xf34f,0x0000,0xf353, -0x0000,0x0000,0xc3db,0xf351,0xc3e0,0x0000,0xc3dd,0x0000, -0xf350,0x0000,0xc3df,0xf354,0xc3da,0x0000,0x0000,0x0000, -0x0000,0xc4bc,0xc4be,0x0000,0xf4d9,0xc4bd,0xf4d7,0xc3dc, -0xf4d8,0xc4bb,0xc543,0xc545,0xf656,0xc544,0xf655,0x0000, -0xf761,0xc5ad,0xf760,0xc5ae,0xf75e,0xf75d,0xf762,0xf763, -0xf846,0x0000,0xf75f,0x0000,0x0000,0xf8c6,0xf8c3,0xf8c4, -0xf8c5,0xc65c,0x0000,0xf951,0xf950,0xf94f,0xf970,0x0000, -0xf9be,0xf9ab,0xc66e,0xa8ad,0xb060,0x0000,0x0000,0x0000, -0x0000,0x0000,0xb8fa,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xbdf6,0x0000,0x0000,0xebc8,0x0000,0x0000, -0xc2df,0x0000,0xf355,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xf9ac,0xa8ae,0xaaee,0xad79,0xad78,0x0000,0xb063, -0x0000,0xd3e8,0xb061,0xd3e9,0xb062,0x0000,0x0000,0xd7df, -0xd7db,0x0000,0x0000,0xb36d,0xd7de,0xd7dd,0xd7dc,0xb36e, -0xd7e0,0xd7e1,0x0000,0x0000,0x0000,0xdc43,0xdc41,0xdc45, -0xdc46,0xdc4c,0x0000,0xdc48,0xdc4a,0x0000,0xdc42,0xdbfc, -0x0000,0xdc49,0x0000,0x0000,0xdc4b,0xdc44,0xdc47,0xdbfd, -0xb662,0xdc40,0xdbfe,0xb661,0xb663,0x0000,0xb8fd,0xe075, -0xe077,0xe076,0xe07b,0xb8fb,0x0000,0xe078,0xe074,0xe079, -0xe07a,0xb8fc,0xb8fe,0xe07c,0x0000,0xe467,0xe466,0x0000, -0xe464,0xe465,0xbbb3,0xbbb5,0xbbb2,0xbbb4,0xe84d,0xe84e, -0xe849,0x0000,0xe84a,0xbdf8,0xbdfd,0xbdf7,0xbdfe,0xbdf9, -0xe84b,0x0000,0x0000,0xe84c,0xe848,0xbe40,0xbdfb,0x0000, -0x0000,0xbdfa,0xbdfc,0x0000,0xe847,0x0000,0xebca,0xbfe8, -0x0000,0x0000,0xebcc,0xbfea,0xebcf,0xebcb,0xebc9,0xebce, -0xbfe9,0xebcd,0x0000,0xbfe7,0x0000,0x0000,0xc1d3,0xc1d6, -0xeec1,0x0000,0xc1d4,0xeec0,0xc1d2,0xc1d5,0xf146,0xf147, -0xf148,0xc2e0,0x0000,0xf149,0x0000,0xc2e1,0xc3e2,0xf358, -0xf359,0xf357,0xf356,0xf35a,0xc3e1,0xf4dd,0xf4db,0xf4dc, -0xf4de,0xf4da,0xf4df,0xf658,0x0000,0xf659,0xf657,0xc546, -0xf764,0xc5af,0xf765,0xf848,0xf847,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, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xa8af,0xb664,0x0000,0x0000,0xb940, -0x0000,0x0000,0x0000,0xbbb6,0x0000,0x0000,0xbfec,0x0000, -0xbfeb,0x0000,0x0000,0x0000,0x0000,0xc3e3,0xc47c,0xc547, -0xa8b0,0xb064,0xb941,0x0000,0xf35b,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xcba6, -0x0000,0x0000,0xa8b1,0x0000,0xa8b4,0xa8b3,0xa8b2,0x0000, -0x0000,0xcba5,0x0000,0xcdcd,0x0000,0xcdcf,0xaaef,0x0000, -0x0000,0xaaf1,0xcdcc,0xcdce,0xaaf0,0xcdd1,0xcdd0,0xcdd2, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xd0b6,0xd0b4,0xad7c,0xd0b3,0xada3,0xad7e,0xad7b,0x0000, -0xada4,0x0000,0xad7d,0xada2,0x0000,0xada1,0xd0b5,0x0000, -0xad7a,0x0000,0x0000,0x0000,0xb06a,0xd3eb,0xd3f1,0xb067, -0xb06e,0x0000,0xb069,0xd3ee,0xd3f0,0xb06c,0xd3ea,0xd3ed, -0xb068,0xb065,0xd3ec,0xb06b,0xd3ef,0xb06d,0xb066,0x0000, -0x0000,0x0000,0x0000,0xd7e3,0xd7e6,0xb370,0x0000,0xb37a, -0xb376,0xd7e4,0x0000,0x0000,0xb37e,0xb377,0xb37c,0xb372, -0x0000,0xb36f,0xb371,0xb37d,0xd7e5,0xb375,0xb378,0xb374, -0xb379,0xd7e7,0xb37b,0xb373,0xd7e2,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xdc4d,0xb665,0xdc4f, -0x0000,0xb667,0xb669,0x0000,0xdc4e,0xb666,0xb66a,0x0000, -0xb668,0x0000,0x0000,0x0000,0xb947,0xe0a3,0xb94f,0xe07e, -0x0000,0xb950,0xb945,0x0000,0xe0a1,0x0000,0x0000,0xb94a, -0x0000,0xe0a2,0xb943,0xb942,0x0000,0xb94d,0xb94c,0xb94b, -0xb949,0xb94e,0xe07d,0xb944,0xb946,0xb948,0x0000,0x0000, -0xbbb8,0xbbbb,0x0000,0xbbbf,0xbbb9,0xbbbe,0xbbbc,0x0000, -0xbbb7,0x0000,0xbbbd,0xbbba,0x0000,0x0000,0x0000,0xe852, -0xbe43,0xbe41,0x0000,0xe853,0x0000,0xbe44,0xbe42,0xe851, -0xe850,0x0000,0xbff0,0xe84f,0xbfee,0xbfed,0xebd0,0xbe45, -0xbfef,0xebd1,0xbff2,0xebd2,0xbff1,0xc1d8,0xeec3,0xc1d7, -0xc1dc,0xc1da,0xc1db,0xc2e3,0xc1d9,0xeec2,0xebd3,0xc2e2, -0xc2e4,0x0000,0xc3e4,0xc3e5,0x0000,0xf4e0,0x0000,0xc5de, -0xc5dd,0xa8b6,0x0000,0x0000,0xca55,0xb06f,0x0000,0xca52, -0xca53,0xca51,0x0000,0xca54,0x0000,0x0000,0xcbaa,0xcba7, -0xcbac,0xcba8,0xa8b7,0xa8ba,0x0000,0xcba9,0xa8b9,0xcbab, -0x0000,0x0000,0xa8b8,0x0000,0x0000,0x0000,0x0000,0xcdd5, -0xcdd7,0xaaf4,0xcdd3,0xcdd6,0xcdd4,0xaaf2,0xaaf5,0x0000, -0xaaf3,0x0000,0x0000,0x0000,0x0000,0xd0b8,0xd0bc,0xd0b9, -0x0000,0xada7,0x0000,0xada8,0x0000,0xd0bb,0x0000,0xd0bd, -0xd0bf,0x0000,0xada5,0xd0be,0x0000,0x0000,0xada6,0x0000, -0x0000,0x0000,0x0000,0x0000,0xd7ee,0xd0ba,0xd3f2,0xd3fb, -0xd3f9,0xd3f4,0xd3f5,0xd3fa,0xd3fc,0xb071,0x0000,0xd3f7, -0xd3f3,0xb070,0xb072,0xd3f6,0xd3fd,0xd3f8,0x0000,0x0000, -0xb3a1,0xd7f1,0xd7e9,0xd7ef,0xd7f0,0xb3a2,0x0000,0xd7e8, -0xd7ea,0xd0b7,0xd7ec,0xd7ed,0xd7eb,0xb66c,0x0000,0x0000, -0x0000,0xdc56,0xebd4,0xdc57,0xdc54,0xb3a3,0xb66e,0xdc53, -0xdc59,0xdc58,0xb66b,0xdc5c,0xdc52,0xdc5b,0xdc50,0xdc5a, -0xdc55,0xb66d,0x0000,0xe0aa,0x0000,0xe0a5,0xe0ab,0xe0a6, -0xe0a4,0xe0a7,0xb951,0x0000,0xe0a9,0x0000,0xe0a8,0xb952, -0xbbc1,0xbbc0,0xe46e,0xe471,0xe469,0xe46d,0xbbc2,0xe46c, -0xe46a,0xe470,0xe46b,0xe468,0xe46f,0x0000,0xe859,0xbe48, -0xf14a,0xe856,0xe857,0xe855,0xdc51,0xbe47,0xe85a,0xe854, -0xbe46,0xbe49,0xe858,0xebd5,0xbff3,0xebd6,0xebd7,0x0000, -0xeec4,0xc1dd,0xf14b,0xf14c,0x0000,0x0000,0xf14d,0xf35d, -0xf35c,0xf4e2,0x0000,0xf4e1,0xf65b,0xf65c,0xf65a,0xf766, -0xc5b0,0xa8bb,0xadaa,0xada9,0xb075,0xb074,0xd440,0xd441, -0xd3fe,0x0000,0xb073,0xd7f5,0x0000,0xd7f6,0xd7f2,0xb3a4, -0xd7f3,0x0000,0xd7f4,0x0000,0x0000,0x0000,0x0000,0xdc5f, -0xdc61,0xdc5d,0xdc60,0xb66f,0xdc5e,0xb670,0x0000,0x0000, -0xdd73,0xb955,0xb954,0x0000,0xb953,0x0000,0xe0ac,0xe0ad, -0x0000,0x0000,0xe473,0xe475,0xbbc6,0xbbc3,0x0000,0xbbc5, -0xbbc4,0xe474,0xe472,0x0000,0x0000,0x0000,0x0000,0x0000, -0xe861,0xe85e,0xe85f,0xbe4d,0xe860,0xe85b,0xe85c,0xbe4a, -0x0000,0xbe4b,0xe85d,0xbe4c,0x0000,0xebdb,0x0000,0xebdc, -0xebd9,0xebda,0xbff4,0xebd8,0x0000,0x0000,0x0000,0x0000, -0x0000,0xeec8,0xeec5,0xeec7,0xc1e0,0xeecb,0xc1df,0xeec9, -0xeecc,0xeeca,0xeec6,0xc1de,0x0000,0xf14f,0x0000,0xf150, -0xf14e,0x0000,0xf152,0xc2e5,0xc2e6,0xf35f,0xc3e7,0xf151, -0xf35e,0xc3e6,0xf4e5,0xf4e6,0xc4bf,0xf4e4,0x0000,0xf4e3, -0x0000,0xf65d,0xc548,0x0000,0xf849,0xf8c8,0xf8c7,0x0000, -0xc643,0xc65d,0xf8c9,0xf971,0x0000,0xc66f,0xa8bc,0xaaf6, -0x0000,0xb956,0x0000,0xc4c0,0xa8bd,0xadab,0xb3a5,0xb671, -0xc2e7,0xaaf7,0x0000,0xd0c1,0xd0c0,0xd442,0x0000,0xb078, -0xb076,0xb07a,0xd444,0x0000,0xb079,0xb077,0x0000,0x0000, -0x0000,0x0000,0xd443,0xb3a8,0xd7fc,0x0000,0xb3a7,0xb3a9, -0xd842,0xb3ab,0xd7fe,0xd840,0xd7f7,0xb3aa,0xd843,0x0000, -0x0000,0xd7f9,0x0000,0xd7fa,0xd7f8,0xb3a6,0x0000,0xd841, -0xd7fb,0xd7fd,0x0000,0x0000,0x0000,0xdc6d,0x0000,0xdc6c, -0xdc6a,0xdc62,0xdc71,0xdc65,0xdc6f,0xdc76,0xdc6e,0xb679, -0x0000,0xb675,0xdc63,0x0000,0xdc69,0xb677,0x0000,0xdc68, -0xb678,0xb67a,0xdc6b,0x0000,0xb672,0xb673,0xdc77,0xdc75, -0x0000,0xdc74,0xdc66,0x0000,0xdc72,0x0000,0xb676,0x0000, -0x0000,0x0000,0x0000,0xb674,0xdc73,0xdc64,0xdc67,0xdc70, -0x0000,0x0000,0x0000,0x0000,0x0000,0xe4ba,0xe0b7,0x0000, -0xe0b0,0xe0c3,0xe0cc,0xe0b3,0xb961,0x0000,0xe0c0,0xb957, -0xb959,0xb965,0xe0b1,0x0000,0x0000,0xb95a,0xb95c,0xb966, -0xb95b,0x0000,0x0000,0x0000,0x0000,0xb964,0xe0b9,0x0000, -0xe0ae,0xb962,0xe0b8,0xb95e,0xe0ca,0xb963,0xe0c8,0xe0bc, -0xe0c6,0xb960,0xe0af,0xe0c9,0xe0c4,0x0000,0xe0cb,0xb958, -0x0000,0x0000,0xb967,0xb95d,0x0000,0x0000,0xe0b5,0x0000, -0xe0bd,0xe0c1,0x0000,0xe0c5,0xb95f,0xe0b4,0xe0b2,0xe0be, -0x0000,0x0000,0x0000,0x0000,0xe0bb,0xe0ba,0x0000,0xe0bf, -0xe0c2,0x0000,0xe0c7,0x0000,0x0000,0x0000,0xe478,0x0000, -0xbbc7,0xe4a4,0xe47a,0xbbcc,0xbbd0,0xe4ad,0xe4b5,0xe4a6, -0xbbc8,0x0000,0xe4aa,0xe0b6,0x0000,0xbbc9,0xe4b1,0xe4b6, -0xe4ae,0x0000,0xe4b0,0xe4b9,0xe4b2,0xe47e,0xe4a9,0x0000, -0x0000,0xbbd1,0x0000,0xbbcd,0xe47c,0xe4ab,0xbbcb,0xe4a5, -0xbbca,0xe4b3,0xe4a2,0xe479,0xbbce,0xe4b8,0x0000,0x0000, -0xe47b,0xe4af,0xe4ac,0xe4a7,0xe477,0xe476,0xe4a1,0xe4b4, -0xbbcf,0xe4b7,0xe47d,0xe4a3,0xbe52,0x0000,0x0000,0x0000, -0x0000,0x0000,0xbe5a,0xbe55,0xe8a4,0xe8a1,0xe867,0xbe50, -0x0000,0xf9d7,0x0000,0xbe4f,0xbe56,0x0000,0x0000,0x0000, -0xe865,0xbe54,0xe871,0xe863,0xe864,0xbe4e,0xe8a3,0xbe58, -0xe874,0xe879,0xe873,0xebee,0xe86f,0xe877,0xe875,0xe868, -0xe862,0xe87d,0xbe57,0xe87e,0x0000,0xe878,0x0000,0xe86d, -0xe86b,0xe866,0x0000,0x0000,0x0000,0xe86e,0xe87b,0xe86a, -0xe87a,0xe8a2,0x0000,0x0000,0xbe53,0x0000,0xe876,0xe87c, -0xe872,0xe86c,0xbe51,0x0000,0x0000,0x0000,0xe4a8,0xe870, -0xbe59,0xe869,0x0000,0x0000,0x0000,0x0000,0x0000,0xebf4, -0xbff7,0xebf3,0xebf0,0xec44,0xbffb,0x0000,0xec41,0xebf8, -0xec43,0xebe9,0xebf6,0x0000,0xbffd,0x0000,0xebe1,0x0000, -0xebdf,0xec42,0x0000,0xec40,0xebfe,0xebed,0xebec,0xebe2, -0xc040,0x0000,0xebe8,0xebf2,0xebfd,0xc043,0xec45,0x0000, -0xc1e8,0xc045,0xbffe,0xebe6,0x0000,0xebef,0xebde,0xebe0, -0xbff5,0xc042,0xbffa,0xebe7,0xebf7,0xebf1,0xc041,0xebdd, -0xc1e3,0xebf9,0xebfc,0xbffc,0x0000,0xebeb,0xc044,0xbff9, -0x0000,0x0000,0x0000,0xbff8,0xebf5,0xebfb,0xbff6,0x0000, -0xebe4,0xebfa,0x0000,0x0000,0xebe5,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xebea,0xeed2, -0x0000,0xeed7,0xc1e5,0xc1e7,0xeedd,0xc1e1,0xeeec,0xeee3, -0xeed8,0xeed9,0xeee2,0x0000,0xc1ee,0xeee1,0xeed1,0xeee0, -0xeed4,0xeeed,0xc1ed,0xc1eb,0xeed5,0x0000,0xeee8,0x0000, -0xeeda,0xeee7,0x0000,0xeee9,0xeed0,0xc1e6,0x0000,0xeeea, -0x0000,0x0000,0xeede,0x0000,0xc1ea,0xeedb,0x0000,0x0000, -0xc1ec,0xeee4,0x0000,0x0000,0x0000,0xc1e4,0xeed6,0xeee5, -0x0000,0xeedf,0xebe3,0xeee6,0xeed3,0x0000,0xc1e9,0x0000, -0xeeeb,0x0000,0xc1e2,0xeece,0x0000,0x0000,0x0000,0x0000, -0xf160,0xf159,0xc2e9,0x0000,0xf154,0xf163,0xf15b,0xeedc, -0x0000,0xf165,0xf155,0x0000,0xc2e8,0xf15f,0xc2ea,0xc2f2, -0xc2f0,0xf161,0xc2f1,0xf157,0x0000,0xf158,0xf15d,0xf162, -0x0000,0xeecd,0xc2eb,0xf16a,0xf167,0xf16b,0xf15e,0xf15a, -0xf168,0xf36a,0xf15c,0x0000,0xc2ee,0x0000,0xc2ed,0xeecf, -0xc2ef,0xf164,0xf166,0xc2ec,0xf169,0xf153,0x0000,0xf156, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xf373,0x0000,0xf363,0xc3eb,0xf371,0x0000,0x0000,0xf361, -0xc3ec,0x0000,0xf36c,0x0000,0xf368,0xc3f1,0xf372,0xf362, -0xf365,0xc3e9,0xf374,0x0000,0xf36d,0xf370,0xc3ef,0xc3f4, -0xc3f2,0xf369,0xf364,0x0000,0xc3ed,0xc3ee,0xf360,0xc3ea, -0x0000,0xc3e8,0xc3f0,0xf36f,0xc3f3,0x0000,0xf36b,0xf375, -0xc3f5,0x0000,0x0000,0x0000,0xf367,0x0000,0xf36e,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xf4f3,0xf542,0xf4f5, -0xf4fc,0xf366,0xf4fa,0xf4e9,0xf540,0xc4c3,0xf4ed,0xf4fe, -0xf4f4,0x0000,0x0000,0xc4c2,0x0000,0x0000,0xf544,0xf4f6, -0x0000,0xf4fb,0xf4fd,0xf4e7,0xf541,0xf4f2,0xf4f7,0xf4eb, -0xf4ef,0xf543,0xf4f9,0xf4e8,0xf4ec,0xf4ee,0xf4f8,0x0000, -0xc4c1,0xf4f1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xf4ea,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xf4f0,0xf661,0xf666,0xc54f,0xf668,0x0000,0xc549,0x0000, -0xf664,0xf66a,0xc54e,0xc54a,0x0000,0xc54b,0xf660,0xf667, -0xc54d,0xf665,0xc54c,0xf65f,0xf663,0xf662,0x0000,0xf65e, -0xf669,0x0000,0x0000,0x0000,0xc5b1,0xf76d,0xf770,0xf76c, -0xf76e,0xf76f,0xf769,0xf76a,0xf767,0x0000,0x0000,0xf76b, -0xf768,0xc5b2,0xc5b3,0x0000,0x0000,0xf84b,0x0000,0xf84d, -0x0000,0x0000,0x0000,0x0000,0x0000,0xf84c,0xf84e,0x0000, -0xc5e0,0x0000,0xf84a,0xc5df,0xc5e1,0x0000,0x0000,0x0000, -0xf8cb,0xf8cc,0xc644,0xf8ca,0x0000,0xf953,0xf952,0xf954, -0xc65f,0xf955,0xc65e,0xf956,0xf972,0xf975,0xf974,0xc668, -0xf973,0x0000,0x0000,0x0000,0xc672,0xc670,0xc671,0xc677, -0xf9c0,0xf9c1,0xf9bf,0xf9c9,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,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,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,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -/* 0x9500 */ -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,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,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,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xaaf8, -0x0000,0x0000,0xd844,0xdc78,0xe8a5,0xf376,0x0000,0x0000, -0xaaf9,0x0000,0xadac,0xb07b,0x0000,0x0000,0xd845,0x0000, -0xd846,0xb3ac,0x0000,0xb67d,0xdc7a,0xdc79,0xb6a3,0xb67c, -0xdc7b,0xb67e,0xb6a2,0xb6a1,0xb67b,0x0000,0x0000,0x0000, -0xb968,0x0000,0x0000,0xe0d0,0xe0ce,0x0000,0xe0cf,0xe0cd, -0x0000,0xbbd2,0x0000,0xbbd5,0xbbd7,0xbbd6,0x0000,0x0000, -0xbbd3,0xbbd4,0x0000,0xe8a7,0xe8a6,0xbe5b,0xe8a8,0x0000, -0xe8a9,0xbe5c,0x0000,0x0000,0x0000,0xec4d,0xec4b,0xeef3, -0x0000,0xec49,0xec4a,0xc046,0xec46,0xec4e,0xec48,0xec4c, -0xeeef,0x0000,0x0000,0xeef1,0x0000,0xeef2,0xc1f3,0xeeee, -0xc1f2,0xeef0,0xc1ef,0xc1f0,0xc1f1,0xec47,0x0000,0x0000, -0xc2f5,0xf16e,0xf16c,0xf16d,0xc2f3,0xc2f6,0xc2f4,0x0000, -0x0000,0x0000,0xf377,0xf378,0xc3f6,0x0000,0xf545,0xf547, -0xf546,0xc4c4,0xc550,0xf66d,0xf66c,0xf66b,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, -/* 0x9600 */ -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,0xaafa,0x0000,0xc9aa,0x0000, -0xca58,0xa6e9,0xca56,0xca59,0xca57,0x0000,0x0000,0x0000, -0xcbae,0x0000,0xa8c1,0x0000,0xa8c2,0xcbb0,0xa8bf,0xcbaf, -0xcbad,0xa8c0,0xa8be,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0xcdd8,0xcddb,0xaafd,0xcdda,0xcdd9,0x0000,0xaafc, -0xaafb,0x0000,0xab40,0xcddc,0xaafe,0x0000,0x0000,0x0000, -0x0000,0x0000,0xd0c6,0xadae,0xadaf,0xadb0,0xd0c7,0xd0c3, -0xadad,0xd0c4,0x0000,0xd0c5,0xd0c2,0x0000,0x0000,0x0000, -0xb0a4,0x0000,0x0000,0xb0a1,0xd445,0xb0a2,0xb0a5,0xd446, -0x0000,0xb07e,0xb07c,0xb07d,0xb0a3,0x0000,0x0000,0x0000, -0x0000,0x0000,0xb3ad,0xd849,0xb3b5,0xd848,0x0000,0xd84b, -0xb3b1,0xd84a,0xb6ab,0xb3af,0xb3b2,0xb3ae,0xb3b3,0xb3b4, -0xb3b0,0x0000,0x0000,0x0000,0xd847,0xb6a7,0xdc7d,0x0000, -0xdca3,0x0000,0x0000,0xdca2,0xb6ac,0xb6a8,0xb6a9,0xdc7c, -0xdc7e,0xdca1,0xb6a4,0xb6a6,0x0000,0xb6aa,0xb6a5,0x0000, -0x0000,0xe0d3,0xe0d1,0xe0d2,0xb96a,0xb96b,0x0000,0xe0d4, -0xb969,0xbbd8,0x0000,0xbbda,0xbbd9,0x0000,0xe4bb,0x0000, -0x0000,0xe4bc,0xe8ab,0x0000,0xe8aa,0x0000,0x0000,0xc047, -0xc048,0xec4f,0xc049,0x0000,0xeef6,0x0000,0xeef4,0x0000, -0xeef5,0xc1f4,0x0000,0xf16f,0xc3f7,0x0000,0x0000,0x0000, -0xc1f5,0xab41,0x0000,0xb0a6,0xd447,0x0000,0x0000,0xd84c, -0xb3b6,0xb6ad,0xdca4,0xdca6,0xb6af,0xb6ae,0xb6b0,0xb6b1, -0xdca5,0xb96e,0xb96f,0xb96d,0xbbdb,0xb96c,0xe0d5,0x0000, -0x0000,0x0000,0xbbdc,0xe8ac,0xec50,0xc04a,0xc1f6,0xf170, -0xf174,0xc2f9,0xf171,0xc2fa,0xc2f8,0xf175,0xc2fb,0xf173, -0x0000,0xf379,0xc2f7,0xc3f8,0x0000,0xf8cd,0x0000,0x0000, -0xab42,0xb3b8,0xb3b7,0x0000,0x0000,0x0000,0x0000,0xb6b2, -0xdca8,0xdca7,0xb6b3,0x0000,0x0000,0xe0d9,0xb973,0xb970, -0xe0d8,0xb972,0xe0d6,0xb971,0x0000,0xe0d7,0x0000,0xe4bd, -0xbbdd,0x0000,0xe8af,0x0000,0xbe5d,0xe8ad,0xbe5e,0xbe5f, -0xe8ae,0xbe60,0x0000,0xec51,0x0000,0xc04e,0xc04b,0xc050, -0xec53,0xc04c,0xec52,0xc04f,0x0000,0x0000,0xc04d,0x0000, -0xeef9,0xeefb,0x0000,0x0000,0xc1f7,0xeefa,0xc1f8,0xeef8, -0xeef7,0x0000,0xf177,0xf176,0xc2fc,0xf178,0xf37e,0xc3fa, -0xf37d,0xf37a,0xc3f9,0xf37b,0xf37c,0x0000,0xf548,0xf549, -0xc4c5,0x0000,0xc553,0x0000,0x0000,0xf66e,0x0000,0x0000, -0xc551,0xc552,0xf66f,0x0000,0x0000,0xc5b4,0xc5b5,0xf771, -0x0000,0x0000,0xc645,0xf8cf,0xc647,0x0000,0xf8ce,0xf8d0, -0xc646,0xf957,0x0000,0xf9ad,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0xab43,0x0000,0x0000,0x0000,0xb974,0x0000, -0xe4be,0x0000,0xe8b0,0xc051,0xc052,0x0000,0xab44,0x0000, -0xbe61,0xc3fb,0xadb1,0x0000,0x0000,0x0000,0xc053,0x0000, -0xc5e2,0xadb2,0xd84d,0x0000,0xdca9,0x0000,0xdcab,0x0000, -0xdcaa,0x0000,0xe0dd,0xe0da,0xb975,0x0000,0xb976,0xe0db, -0xe0dc,0x0000,0xe4c0,0xe4c5,0xbbde,0xe4bf,0xe4c1,0xe4c8, -0xe4c3,0xe4c7,0xe4c4,0xe4c2,0xe4c6,0xbbdf,0x0000,0x0000, -0xe8b3,0x0000,0xe8b1,0xbe63,0x0000,0xbe62,0xe8b2,0xbe64, -0x0000,0x0000,0x0000,0x0000,0xec56,0x0000,0x0000,0xec55, -0xc054,0xec54,0xeefc,0x0000,0xeefe,0xef41,0xef40,0x0000, -0xc1f9,0xeefd,0xf1a1,0xc2fd,0xf17d,0xf1a2,0xc2fe,0x0000, -0xf17b,0x0000,0xf17e,0xf17c,0xf179,0xc340,0xf17a,0x0000, -0x0000,0x0000,0x0000,0xf3a1,0x0000,0x0000,0xf3a3,0xf3a2, -0x0000,0xf54a,0x0000,0xf54b,0x0000,0x0000,0x0000,0xf670, -0x0000,0xc5b7,0x0000,0xc5b6,0xf84f,0xf850,0xc648,0xf8d1, -0x0000,0xc669,0x0000,0xadb3,0xb6b4,0xe4ca,0xe4c9,0xe8b5, -0xe8b4,0x0000,0x0000,0xc1fa,0xef43,0xef42,0xf1a5,0xf1a3, -0xf1a6,0xf1a4,0x0000,0x0000,0xc3fc,0xf3a4,0xf3a5,0xf3a6, -0x0000,0xf671,0x0000,0xf772,0x0000,0xf8d2,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xadb4,0x0000,0x0000, -0xec57,0xef44,0x0000,0xadb5,0x0000,0x0000,0xbbe0,0x0000, -0xec58,0xc341,0xf1a7,0xc3fd,0x0000,0xf54c,0xf54d,0xc554, -0xf851,0xadb6,0xb3bb,0xb3bc,0xd84e,0xb6b5,0xb6b6,0xdcac, -0xb6b7,0x0000,0xb97a,0x0000,0xb97c,0xe0df,0xe0e0,0xe0de, -0xb977,0xb978,0xb97b,0xb979,0x0000,0x0000,0xe4cb,0xbbe1, -0xbbe2,0x0000,0x0000,0xe8bc,0xbe67,0xe8b7,0xe8b6,0x0000, -0xe8bb,0xbe65,0x0000,0x0000,0xc05b,0x0000,0xe8b8,0xe8bd, -0xe8ba,0xe8b9,0x0000,0xbe66,0x0000,0xc059,0x0000,0xec5a, -0xc055,0x0000,0xec5b,0x0000,0x0000,0xec59,0x0000,0xc058, -0xc056,0xc05a,0x0000,0xc057,0x0000,0x0000,0x0000,0x0000, -0x0000,0xef45,0x0000,0xef4a,0xef46,0xef49,0xc1fb,0x0000, -0xedd4,0xef48,0xef47,0x0000,0xc344,0xc342,0xc345,0xc343, -0xf1a8,0xf1a9,0xf1aa,0xc346,0x0000,0x0000,0x0000,0xf3aa, -0xc440,0xf3a8,0x0000,0xc441,0xf3a7,0xf3a9,0xc3fe,0xf551, -0xf54e,0x0000,0xf54f,0xf550,0xf672,0xc556,0x0000,0xc555, -0x0000,0xf774,0xf773,0xc5b8,0x0000,0x0000,0x0000,0xc5e3, -0xc649,0xc660,0xf958,0xf9ae,0xf9af,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, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xadb7,0xdcad,0x0000,0x0000,0xe0e1,0xe4cc,0xe4cd,0xbbe3, -0x0000,0xbbe4,0xe8be,0xbe68,0x0000,0x0000,0xc1fc,0x0000, -0xf1ab,0x0000,0xc347,0xf3ad,0xc442,0xf3ac,0xf3ae,0xf3ab, -0xf675,0xf552,0xf553,0x0000,0xc4c6,0x0000,0xf674,0x0000, -0x0000,0xf673,0x0000,0xf775,0xf9b0,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xadb8,0x0000,0x0000,0x0000,0xadb9, -0x0000,0x0000,0xb0a7,0xd448,0x0000,0xd84f,0x0000,0xb6b8, -0x0000,0xb6bb,0xb6b9,0xdcae,0x0000,0xb6bd,0x0000,0xb6ba, -0x0000,0x0000,0xb6bc,0x0000,0xb97e,0x0000,0xe0e2,0x0000, -0x0000,0xe0e3,0xe8c0,0x0000,0xb97d,0xb9a1,0xb9a2,0x0000, -0xe4cf,0x0000,0xe4ce,0xbbe5,0x0000,0xbbe6,0x0000,0xe4d0, -0xe8bf,0xbbe8,0xbe69,0x0000,0xbbe7,0x0000,0x0000,0x0000, -0xc05c,0xe8c1,0xbe6b,0xbe6a,0xe8c2,0xe8c5,0xe8c3,0xe8c4, -0xbe6c,0x0000,0xc061,0xc05f,0x0000,0x0000,0xc05e,0xec5d, -0x0000,0xc060,0x0000,0x0000,0xec5c,0xef4b,0x0000,0xec5e, -0xc05d,0xec5f,0xef4e,0xef4c,0xef4d,0xef52,0xc34b,0xef51, -0xef54,0xef53,0xef50,0xef4f,0x0000,0xc1fd,0x0000,0x0000, -0x0000,0x0000,0xf1ae,0x0000,0xf1ad,0xc34a,0xc348,0xc349, -0x0000,0xf1ac,0x0000,0xf3b1,0x0000,0xc443,0x0000,0xf3b0, -0xf3af,0xc444,0x0000,0xf558,0xf557,0x0000,0xf555,0x0000, -0xf554,0xc4c8,0xc4c7,0xf559,0xf776,0xc5b9,0xf677,0xc557, -0xf676,0xf556,0x0000,0xf777,0xc5e4,0x0000,0xc661,0xf959, -0x0000,0xf9b1,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,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xadba,0xd850, -0xef55,0xadbb,0x0000,0x0000,0xe4d2,0xe4d1,0xec60,0x0000, -0x0000,0xef57,0x0000,0xef56,0x0000,0xc34c,0xf3b2,0xf3b3, -0xc4c9,0x0000,0x0000,0xf9b2,0xb0a8,0xb6bf,0xb6be,0xe0e4, -0xe0e6,0xb9a4,0xe0e5,0xb9a3,0xb9a5,0xe0e7,0x0000,0x0000, -0x0000,0xe4d4,0xe4d6,0xe4d5,0x0000,0xe4d8,0x0000,0x0000, -0x0000,0xbbe9,0xe4d7,0xe4d3,0x0000,0x0000,0x0000,0xe4d9, -0x0000,0xe8cc,0x0000,0xe8cf,0xe8d1,0xe8c7,0xe8cb,0xe8c8, -0xbe6e,0xbe71,0xbe73,0xe8c9,0xe8ca,0xbe72,0xe8cd,0xe8d0, -0xe8ce,0xbe74,0x0000,0xbe70,0xe8c6,0xbe6d,0x0000,0xbe6f, -0x0000,0x0000,0xc063,0xec66,0xec64,0xec63,0x0000,0xec69, -0x0000,0xec68,0xec67,0x0000,0xec62,0xc062,0xec61,0x0000, -0xec65,0xc064,0x0000,0x0000,0xef5a,0x0000,0xef5e,0xef5b, -0xef5d,0xef5c,0xef59,0xef5f,0xef62,0xef60,0xef61,0xc240, -/* 0x9a00 */ -0x0000,0xc1fe,0xef58,0xef63,0xf1b3,0xf1b6,0xf1b8,0xf1b7, -0x0000,0xf1b1,0xf1b5,0xf1b0,0x0000,0xf1b2,0xc34d,0xf1af, -0x0000,0xf1b4,0x0000,0x0000,0xf3c0,0xf3b5,0xc445,0x0000, -0x0000,0xc446,0xf3b4,0xf3b9,0xf3bf,0xf3b7,0xf3be,0x0000, -0xf3bb,0x0000,0xf3ba,0xf3bd,0xf3b8,0xf3b6,0x0000,0xf3bc, -0x0000,0xf560,0xf55e,0xc4ca,0xf55d,0xf563,0xf561,0x0000, -0xc4cb,0xf55c,0xf55a,0x0000,0xf55b,0xc4cd,0xf55f,0xc4cc, -0xf562,0xf678,0xf67e,0x0000,0x0000,0xf679,0xc55b,0xf6a1, -0xc55a,0xf67d,0xf67c,0xc559,0xf67b,0xc558,0xf67a,0x0000, -0xf77d,0xf7a1,0xf77e,0x0000,0xf77b,0xc5bb,0xf778,0xf77c, -0xf7a3,0x0000,0xf7a2,0xf779,0xf77a,0xc5ba,0xf852,0xc5e7, -0x0000,0xf853,0xc5e5,0xc5e6,0x0000,0x0000,0xf8d3,0xc64a, -0xf976,0x0000,0xc66a,0x0000,0xf9b3,0xc66b,0xf9b4,0xf9b5, -0xf9c3,0xf9c2,0xc67a,0xf9cd,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,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, -0xb0a9,0x0000,0x0000,0xe0e9,0x0000,0xe0e8,0x0000,0xbbea, -0xbbeb,0xe4da,0x0000,0xe8d2,0xec6c,0x0000,0x0000,0xbe75, -0xc065,0xec6a,0x0000,0xec6d,0xc066,0x0000,0xef64,0xec6b, -0xf1b9,0xc34e,0xf3c1,0x0000,0x0000,0x0000,0xf566,0xf564, -0x0000,0x0000,0xf565,0x0000,0x0000,0xf6a2,0x0000,0xc55c, -0xf7a4,0xc5ea,0xc5bc,0xc5e8,0xc5e9,0xf8d4,0xc662,0x0000, -0xb0aa,0x0000,0x0000,0x0000,0xf1ba,0x0000,0x0000,0xd449, -0x0000,0xb9a6,0x0000,0xe4db,0x0000,0x0000,0xbbec,0xe4dc, -0x0000,0x0000,0x0000,0xe8d4,0xe8d3,0xc068,0xbe76,0xbe77, -0x0000,0xe8d7,0xe8d6,0xe8d5,0x0000,0x0000,0xec6e,0xec71, -0x0000,0xec70,0xec6f,0xc067,0xef68,0xef66,0xef65,0x0000, -/* 0x9b00 */ -0x0000,0xef67,0x0000,0xc34f,0xf1bc,0xf1bd,0xc350,0x0000, -0xf1bb,0x0000,0xf3c3,0xf3c2,0xf3c5,0xc447,0xf3c4,0x0000, -0xf567,0xf569,0xf568,0x0000,0x0000,0xf6a3,0xf6a6,0xf6a4, -0xf6a5,0xf7a5,0xc5bd,0x0000,0x0000,0x0000,0xf854,0xf855, -0xf856,0x0000,0xc64b,0xc663,0xf9b6,0xb0ab,0x0000,0xbe78, -0xc069,0xf1be,0x0000,0xf7a6,0x0000,0x0000,0xf9c4,0xd44a, -0x0000,0xc67b,0xb0ac,0xec72,0x0000,0xf1bf,0x0000,0xf3c6, -0x0000,0x0000,0xf6a7,0xf7a7,0xb0ad,0x0000,0xe4dd,0xe4de, -0x0000,0xbbed,0xbbee,0xe8d9,0xbe7a,0xbe79,0xe8d8,0x0000, -0xef69,0x0000,0xf1c0,0xf1c2,0xf1c1,0xc353,0xc352,0xc351, -0x0000,0xc55e,0xf6a8,0x0000,0xc55d,0xf7a9,0xf7a8,0x0000, -0xc64c,0xf8d5,0xb3bd,0xe0ea,0x0000,0x0000,0x0000,0xe4e1, -0xe4df,0xe4e0,0x0000,0x0000,0xe8e2,0x0000,0xe8dd,0xe8da, -0xe8e1,0x0000,0x0000,0x0000,0xe8e3,0x0000,0x0000,0xbe7c, -0xe8e0,0xe8dc,0x0000,0x0000,0xe8db,0xe8df,0xe8de,0xbe7b, -0x0000,0x0000,0xec7d,0xec78,0xec76,0xeca1,0xec77,0x0000, -0xec73,0x0000,0xec79,0x0000,0x0000,0xec74,0xef72,0xec75, -0xeca2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xec7c,0xc06a,0xec7b,0xec7a,0x0000,0xec7e,0x0000,0x0000, -0x0000,0x0000,0xef6a,0xef6d,0x0000,0x0000,0xef6c,0x0000, -0xef74,0xef6f,0xef73,0x0000,0xef71,0xef70,0xef6e,0x0000, -0xef6b,0x0000,0xc243,0xc242,0x0000,0xc244,0xc241,0xef75, -0x0000,0x0000,0x0000,0x0000,0x0000,0xf1c8,0xf1cb,0x0000, -0xf1c9,0xf1cd,0x0000,0x0000,0x0000,0xf1ce,0x0000,0xf1c6, -0xc358,0xf1c7,0x0000,0xf1c5,0xf1cc,0x0000,0xf1c4,0xf1c3, -0xc357,0xc355,0xc354,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0xf1ca,0xf3cf,0xf3d5,0xc44a,0xf3d0, -0x0000,0xf3d3,0xf3d7,0xc44b,0xf3d2,0x0000,0xf3ca,0x0000, -0xf3c9,0xf3d6,0xf3cd,0x0000,0xf3cb,0xf3d4,0xf3cc,0xc449, -0xc448,0x0000,0xf3c7,0xf3c8,0xf3d1,0x0000,0x0000,0x0000, -0xf3ce,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xf56c, -0xf56f,0x0000,0x0000,0x0000,0x0000,0xc356,0x0000,0x0000, -/* 0x9c00 */ -0x0000,0x0000,0x0000,0x0000,0x0000,0xf56d,0xf573,0xf571, -0xf56b,0xf576,0x0000,0xf56a,0x0000,0xc4cf,0xf572,0x0000, -0x0000,0x0000,0xf56e,0xc4ce,0xf575,0x0000,0x0000,0xf574, -0x0000,0x0000,0x0000,0x0000,0xf6ab,0xf6aa,0x0000,0x0000, -0x0000,0xf6b1,0x0000,0xf6ad,0xf6b0,0xc560,0x0000,0x0000, -0xf6ae,0xf6af,0x0000,0xf6a9,0xf6ac,0xc55f,0x0000,0x0000, -0x0000,0xc5bf,0xf7b4,0xf7af,0xf7b3,0x0000,0xf7b6,0xf7b2, -0x0000,0xf7ae,0x0000,0xc5c1,0xf7b1,0xf7b5,0xc5c0,0xf7ac, -0xf570,0xf7b0,0x0000,0x0000,0xf7ad,0x0000,0xf7aa,0x0000, -0xf7ab,0xc5be,0xf85a,0xf85c,0xf85f,0xf85b,0xf860,0x0000, -0xf859,0x0000,0xf857,0x0000,0xc5eb,0xf85d,0xc5ed,0xc5ec, -0xf858,0xf85e,0x0000,0x0000,0x0000,0x0000,0xf8da,0xc64d, -0xf8db,0x0000,0xf8d9,0xf8d6,0x0000,0x0000,0xf8d8,0xf8d7, -0xf95a,0x0000,0x0000,0x0000,0x0000,0xf95c,0xf95b,0x0000, -0x0000,0xf979,0x0000,0xf978,0xf977,0xf97a,0x0000,0xc673, -0xc674,0xf9ca,0xf9ce,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,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,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,0x0000,0xb3be,0xdcaf,0xe0ed, -0x0000,0xb9a7,0xe0eb,0x0000,0x0000,0xe0ec,0x0000,0x0000, -0x0000,0xe4e2,0xe4e3,0xbbf1,0xbbef,0xe4e4,0xbbf0,0xe8e8, -0x0000,0xe8eb,0xe8e5,0xe8ec,0xe8e4,0xe8e6,0x0000,0xe8e7, -0xe8ea,0x0000,0x0000,0xbea1,0xe8ef,0xe8ee,0xbe7d,0xe8e9, -0xe8ed,0xbe7e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xecac,0x0000,0xc06f,0x0000,0xeca7,0xc06b,0x0000,0xeca4, -0xecaa,0xecad,0x0000,0xc070,0x0000,0xeca9,0xeca6,0xecae, -0xeca5,0x0000,0xecab,0xc06c,0x0000,0xeca3,0xc06d,0x0000, -0xc06e,0xeca8,0x0000,0x0000,0x0000,0xefa9,0xef7a,0xef7b, -0xef7e,0xef7c,0x0000,0xef76,0x0000,0x0000,0xef79,0xefa5, -0xef7d,0x0000,0x0000,0xc245,0x0000,0xefa7,0xefa4,0xc246, -0xefa6,0xef77,0xefa2,0xefa3,0x0000,0xefa1,0x0000,0x0000, -0x0000,0x0000,0xf1d2,0xf1d4,0xf1d7,0x0000,0x0000,0xf1d1, -0x0000,0xc359,0xf1d9,0xf1d0,0xf1da,0x0000,0xf1d6,0xf1d8, -0xf1dc,0xf1d5,0xf1dd,0xf1d3,0xf1cf,0xc35a,0x0000,0xf1db, -0xc35b,0xc44d,0x0000,0x0000,0x0000,0x0000,0x0000,0xef78, -0xf3f1,0xf3e8,0xc44f,0xf3e4,0xc450,0x0000,0x0000,0xf3ed, -0xf3e7,0xf3dd,0xc44e,0xf3ea,0xf3e5,0xf3e6,0x0000,0xf3d8, -0xf3df,0xf3ee,0x0000,0xf3eb,0x0000,0xf3e3,0x0000,0xf3ef, -0xf3de,0xf3d9,0xf3ec,0x0000,0xf3db,0xf3e9,0xf3e0,0xf3f0, -0xf3dc,0xc44c,0xf3da,0xf3e1,0xf3e2,0x0000,0x0000,0x0000, -0xf57d,0x0000,0xf57b,0x0000,0xf5a2,0x0000,0xf5ae,0xf5a5, -0xf57c,0xf578,0xf5a7,0xf57e,0xf5a3,0xf57a,0xf5aa,0xf577, -0xf5a1,0xf5a6,0xf5a8,0xf5ab,0xf579,0x0000,0xf5af,0xf5b0, -0xf5a9,0xf5ad,0xf5a4,0x0000,0xf6c1,0xf6c4,0x0000,0xc561, -0x0000,0xf6c3,0xf6c8,0xf6c6,0xc562,0xf6bd,0xf6b3,0xf6b2, -0xc564,0xf6bf,0xf6c0,0xf6bc,0xf6b4,0x0000,0xf6b9,0xf5ac, -0x0000,0xf6b5,0xc563,0xf6bb,0x0000,0xf6ba,0x0000,0xf6b6, -0xf6c2,0x0000,0xf6b7,0xf7bb,0xf6c5,0xf6c7,0xf6be,0xf6b8, -0xf7bc,0xf7be,0xf7b8,0xc5c2,0x0000,0xf7c5,0xf7c3,0xc5c3, -0xf7c2,0xf7c1,0xf7ba,0xf7b7,0xf7bd,0xf7c6,0xf7b9,0xf7bf, -0x0000,0xf869,0xf86e,0xf864,0xf867,0xc5ee,0xf86b,0x0000, -0xf872,0xf7c0,0x0000,0xf865,0xf86f,0xf873,0xf86a,0xf863, -0xf86d,0x0000,0xf86c,0xf871,0xf870,0xf7c4,0xf868,0xf862, -0xf866,0xc64e,0xc64f,0xf861,0x0000,0xf8e6,0xf8dd,0xf8e5, -0xf8e2,0xf8e3,0xf8dc,0xf8df,0xf8e7,0xf8e1,0xf8e0,0xf8de, -0x0000,0xf8e4,0x0000,0xf95d,0x0000,0xf95e,0x0000,0xf960, -0xf95f,0xf962,0xf961,0xf97c,0xf97b,0xf9b7,0x0000,0xf9b8, -0x0000,0xf9c5,0xc678,0xc67c,0x0000,0xf9cf,0xc67d,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,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,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xb3bf,0x0000,0x0000, -0x0000,0xc4d0,0xf6c9,0x0000,0xc650,0xc651,0x0000,0xb3c0, -0xe0ee,0x0000,0xb9a8,0xe8f0,0x0000,0x0000,0xecb0,0xecb1, -0xecaf,0xefab,0xefaa,0xc247,0xf1df,0xefac,0xf1de,0x0000, -0x0000,0xf3f3,0xc451,0xc453,0xf3f2,0x0000,0x0000,0xc452, -0x0000,0xf5b1,0xf5b3,0xf5b2,0xf6ca,0xc565,0x0000,0xc5ef, -0xf8e8,0xf963,0x0000,0x0000,0xf9d2,0xb3c1,0x0000,0xe4e5, -0x0000,0xbea2,0x0000,0x0000,0x0000,0xecb3,0xecb2,0x0000, -0xefad,0x0000,0x0000,0x0000,0xc454,0xc4d1,0xf7c7,0xf9cb, -0x0000,0x0000,0x0000,0xb3c2,0xbbf2,0x0000,0xbea3,0x0000, -0xf3f4,0x0000,0xf874,0xb6c0,0x0000,0x0000,0x0000,0x0000, -0xefae,0x0000,0x0000,0x0000,0xc664,0xb6c1,0xbea4,0xc248, -0xf875,0xb6c2,0x0000,0xe8f1,0xc072,0xecb4,0xecb5,0x0000, -0xc071,0x0000,0xefaf,0xc24c,0xc24a,0xc24b,0xc249,0xf1e0, -0xc35c,0x0000,0x0000,0x0000,0xf5b5,0xf5b4,0xf5b7,0xf5b6, -0xc4d2,0x0000,0x0000,0xf6cb,0x0000,0xf6cd,0xf6cc,0xc566, -0xf7c8,0x0000,0xf876,0xf877,0xc5f0,0xf964,0xf97d,0xc675, -0x0000,0xdcb0,0xecb6,0xefb0,0xf3f5,0xe0ef,0x0000,0xefb1, -0xf1e2,0xf1e1,0x0000,0x0000,0x0000,0x0000,0xf878,0xc652, -0x0000,0xf965,0xf97e,0x0000,0x0000,0x0000,0xb9a9,0xe8f2, -0xe8f3,0x0000,0xecb7,0xb9aa,0x0000,0xc35d,0xf1e3,0x0000, -0xf6cf,0xc567,0xf6d0,0xf6ce,0xf879,0x0000,0xf8e9,0x0000, -0xb9ab,0x0000,0xefb4,0xefb3,0xefb2,0xf1e4,0x0000,0x0000, -0xf1e8,0xf1e7,0xf1e6,0xf1e5,0xc35e,0xf3f6,0xf5b9,0xc4d3, -0xf5b8,0xf6d1,0xf7cb,0xf7ca,0xc5c4,0xf7c9,0xf87c,0xf87b, -0xf87a,0x0000,0x0000,0xbbf3,0x0000,0xecb8,0xc24d,0x0000, -0xf3f7,0xf3f8,0xf7cc,0xf87d,0x0000,0x0000,0xf8ea,0xf966, -0xf9b9,0xf9d4,0xbbf4,0xc24e,0xf1e9,0xf3f9,0xf6d2,0xf87e, -0x0000,0x0000,0xbea6,0x0000,0xefb5,0xf1ea,0xf3fa,0xf3fb, -0xf3fc,0xf5be,0x0000,0xf5ba,0xc568,0xf5bd,0xf5bc,0xc4d4, -0xf5bb,0xc4d6,0x0000,0xc4d5,0xf6d4,0xf6d3,0xc569,0xc56a, -0x0000,0x0000,0xc5c6,0xf7cd,0xc5c5,0x0000,0xf8a3,0xf8a4, -0xf8a2,0xf8a1,0xc654,0x0000,0xf8eb,0xf8ec,0xf8ed,0xc653, -0xf967,0xf96a,0xf969,0xf968,0x0000,0x0000,0xf9d3,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0xc073,0x0000,0x0000, -0xc365,0xf5bf,0xf6d5,0x0000,0xc5c7,0xf7ce,0x0000,0x0000, -0xf9d5,0x0000,0x0000,0x0000,0xc074,0x0000,0x0000,0x0000, -0xefb6,0x0000,0xf7cf,0x0000,0xf9a1}; - -static const int ucs_i_big5_table_min = 0x4d00; -static const int ucs_i_big5_table_max = 0x4d00 + (sizeof (ucs_i_big5_table) / sizeof (unsigned short)); - -static const unsigned short ucs_pua_big5_table[] = { -/* 0xf600 */ -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,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,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,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,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,0x0000, -0x0000,0xc6a1,0xc6a2,0xc6a3,0xc6a4,0xc6a5,0xc6a6,0xc6a7, -0xc6a8,0xc6a9,0xc6aa,0xc6ab,0xc6ac,0xc6ad,0xc6ae,0xc6af, -0xc6b0,0xc6b1,0xc6b2,0xc6b3,0xc6b4,0xc6b5,0xc6b6,0xc6b7, -0xc6b8,0xc6b9,0xc6ba,0xc6bb,0xc6bc,0xc6bd,0xc6be,0xc6bf, -0xc6c0,0xc6c1,0xc6c2,0xc6c3,0xc6c4,0xc6c5,0xc6c6,0xc6c7, -0xc6c8,0xc6c9,0xc6ca,0xc6cb,0xc6cc,0xc6cd,0xc6ce,0xc6cf, -0xc6d0,0xc6d1,0xc6d2,0xc6d3,0xc6d4,0xc6d5,0xc6d6,0xc6d7, -0xc6d8,0xc6d9,0xc6da,0xc6db,0xc6dc,0xc6dd,0xc6de,0xc6df, -0xc6e0,0xc6e1,0xc6e2,0xc6e3,0xc6e4,0xc6e5,0xc6e6,0xc6e7, -0xc6e8,0xc6e9,0xc6ea,0xc6eb,0xc6ec,0xc6ed,0xc6ee,0xc6ef, -0xc6f0,0xc6f1,0xc6f2,0xc6f3,0xc6f4,0xc6f5,0xc6f6,0xc6f7, -0xc6f8,0xc6f9,0xc6fa,0xc6fb,0xc6fc,0xc6fd,0xc6fe,0xc740, -0xc741,0xc742,0xc743,0xc744,0xc745,0xc746,0xc747,0xc748, -0xc749,0xc74a,0xc74b,0xc74c,0xc74d,0xc74e,0xc74f,0xc750, -0xc751,0xc752,0xc753,0xc754,0xc755,0xc756,0xc757,0xc758, -0xc759,0xc75a,0xc75b,0xc75c,0xc75d,0xc75e,0xc75f,0xc760, -0xc761,0xc762,0xc763,0xc764,0xc765,0xc766,0xc767,0xc768, -0xc769,0xc76a,0xc76b,0xc76c,0xc76d,0xc76e,0xc76f,0xc770, -0xc771,0xc772,0xc773,0xc774,0xc775,0xc776,0xc777,0xc778, -0xc779,0xc77a,0xc77b,0xc77c,0xc77d,0xc77e,0xc7a1,0xc7a2, -0xc7a3,0xc7a4,0xc7a5,0xc7a6,0xc7a7,0xc7a8,0xc7a9,0xc7aa, -0xc7ab,0xc7ac,0xc7ad,0xc7ae,0xc7af,0xc7b0,0xc7b1,0xc7b2, -0xc7b3,0xc7b4,0xc7b5,0xc7b6,0xc7b7,0xc7b8,0xc7b9,0xc7ba, -0xc7bb,0xc7bc,0xc7bd,0xc7be,0xc7bf,0xc7c0,0xc7c1,0xc7c2, -0xc7c3,0xc7c4,0xc7c5,0xc7c6,0xc7c7,0xc7c8,0xc7c9,0xc7ca, -0xc7cb,0xc7cc,0xc7cd,0xc7ce,0xc7cf,0xc7d0,0xc7d1,0xc7d2, -0xc7d3,0xc7d4,0xc7d5,0xc7d6,0xc7d7,0xc7d8,0xc7d9,0xc7da, -0xc7db,0xc7dc,0xc7dd,0xc7de,0xc7df,0xc7e0,0xc7e1,0xc7e2, -0xc7e3,0xc7e4,0xc7e5,0xc7e6,0xc7e7,0xc7e8,0xc7e9,0xc7ea, -0xc7eb,0xc7ec,0xc7ed,0xc7ee,0xc7ef,0xc7f0,0xc7f1,0xc7f2, -0xc7f3,0xc7f4,0xc7f5,0xc7f6,0xc7f7,0xc7f8,0xc7f9,0xc7fa, -0xc7fb,0xc7fc,0xc7fd,0xc7fe,0xc840,0xc841,0xc842,0xc843, -0xc844,0xc845,0xc846,0xc847,0xc848,0xc849,0xc84a,0xc84b, -0xc84c,0xc84d,0xc84e,0xc84f,0xc850,0xc851,0xc852,0xc853, -0xc854,0xc855,0xc856,0xc857,0xc858,0xc859,0xc85a,0xc85b, -0xc85c,0xc85d,0xc85e,0xc85f,0xc860,0xc861,0xc862,0xc863, -0xc864,0xc865,0xc866,0xc867,0xc868,0xc869,0xc86a,0xc86b, -0xc86c,0xc86d,0xc86e,0xc86f,0xc870,0xc871,0xc872,0xc873, -0xc874,0xc875,0xc876,0xc877,0xc878,0xc879,0xc87a,0xc87b, -0xc87c,0xc87d,0xc87e,0xc8a1,0xc8a2,0xc8a3,0xc8a4,0xc8a5, -0xc8a6,0xc8a7,0xc8a8,0xc8a9,0xc8aa,0xc8ab,0xc8ac,0xc8ad, -0xc8ae,0xc8af,0xc8b0,0xc8b1,0xc8b2,0xc8b3,0xc8b4,0xc8b5, -0xc8b6,0xc8b7,0xc8b8,0xc8b9,0xc8ba,0xc8bb,0xc8bc,0xc8bd, -0xc8be,0xc8bf,0xc8c0,0xc8c1,0xc8c2,0xc8c3,0xc8c4,0xc8c5, -0xc8c6,0xc8c7,0xc8c8,0xc8c9,0xc8ca,0xc8cb,0xc8cc,0xc8cd, -0xc8ce,0xc8cf,0xc8d0,0xc8d1,0xc8d2,0xc8d3,0xc8d4,0xc8d5, -0xc8d6,0xc8d7,0xc8d8,0xc8d9,0xc8da,0xc8db,0xc8dc,0xc8dd, -0xc8de,0xc8df,0xc8e0,0xc8e1,0xc8e2,0xc8e3,0xc8e4,0xc8e5, -0xc8e6,0xc8e7,0xc8e8,0xc8e9,0xc8ea,0xc8eb,0xc8ec,0xc8ed, -0xc8ee,0xc8ef,0xc8f0,0xc8f1,0xc8f2,0xc8f3,0xc8f4,0xc8f5, -0xc8f6,0xc8f7,0xc8f8,0xc8f9,0xc8fa,0xc8fb,0xc8fc,0xc8fd, -0xc8fe}; - -static const int ucs_pua_big5_table_min = 0xf600; -static const int ucs_pua_big5_table_max = 0xf600 + (sizeof (ucs_pua_big5_table) / sizeof (unsigned short)); - -static const unsigned short ucs_r1_big5_table[] = { -/* 0xfa00 */ -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0xc94a,0xddfc}; - -static const int ucs_r1_big5_table_min = 0xfa00; -static const int ucs_r1_big5_table_max = 0xfa00 + (sizeof (ucs_r1_big5_table) / sizeof (unsigned short)); - -static const unsigned short ucs_r2_big5_table[] = { -/* 0xfe00 */ -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,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xa14a,0xa157,0x0000,0xa159,0xa15b,0xa15f,0xa160,0xa163, -0xa164,0xa167,0xa168,0xa16b,0xa16c,0xa16f,0xa170,0xa173, -0xa174,0xa177,0xa178,0xa17b,0xa17c,0x0000,0x0000,0x0000, -0x0000,0xa1c6,0xa1c7,0xa1ca,0xa1cb,0xa1c8,0xa1c9,0xa15c, -0xa14d,0xa14e,0xa14f,0x0000,0xa151,0xa152,0xa153,0xa154, -0x0000,0xa17d,0xa17e,0xa1a1,0xa1a2,0xa1a3,0xa1a4,0xa1cc, -0xa1cd,0xa1ce,0xa1de,0xa1df,0xa1e0,0xa1e1,0xa1e2,0x0000, -0xa242,0xa24c,0xa24d,0xa24e,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,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,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,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, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -/* 0xff00 */ -0x0000,0xa149,0x0000,0xa1ad,0xa243,0xa248,0xa1ae,0x0000, -0xa15d,0xa15e,0xa1af,0xa1cf,0xa141,0xa1d0,0xa144,0xa1fe, -0xa2af,0xa2b0,0xa2b1,0xa2b2,0xa2b3,0xa2b4,0xa2b5,0xa2b6, -0xa2b7,0xa2b8,0xa147,0xa146,0xa1d5,0xa1d7,0xa1d6,0xa148, -0xa249,0xa2cf,0xa2d0,0xa2d1,0xa2d2,0xa2d3,0xa2d4,0xa2d5, -0xa2d6,0xa2d7,0xa2d8,0xa2d9,0xa2da,0xa2db,0xa2dc,0xa2dd, -0xa2de,0xa2df,0xa2e0,0xa2e1,0xa2e2,0xa2e3,0xa2e4,0xa2e5, -0xa2e6,0xa2e7,0xa2e8,0x0000,0xa240,0x0000,0x0000,0xa1c4, -0x0000,0xa2e9,0xa2ea,0xa2eb,0xa2ec,0xa2ed,0xa2ee,0xa2ef, -0xa2f0,0xa2f1,0xa2f2,0xa2f3,0xa2f4,0xa2f5,0xa2f6,0xa2f7, -0xa2f8,0xa2f9,0xa2fa,0xa2fb,0xa2fc,0xa2fd,0xa2fe,0xa340, -0xa341,0xa342,0xa343,0xa161,0xa155,0xa162,0xa1e3,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,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,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, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0xa246,0xa247,0x0000,0xa1c3,0x0000,0xa244}; - -static const int ucs_r2_big5_table_min = 0xfe00; -static const int ucs_r2_big5_table_max = 0xfe00 + (sizeof (ucs_r2_big5_table) / sizeof (unsigned short)); +#endif /* UNICODE_TABLE_CNS11643_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_cp1251.h b/ext/mbstring/libmbfl/filters/unicode_table_cp1251.h new file mode 100644 index 0000000000..99ec985b36 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_cp1251.h @@ -0,0 +1,51 @@ +/* + * "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 authors of this file: PHP3 internationalization team + * You can contact the primary author 金本 茂 <sgk@happysize.co.jp>. + * + */ + +#ifndef UNICODE_TABLE_CP1251_H + +/* cp1251 to Unicode table */ +static const unsigned short cp1251_ucs_table[] = { + 0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, + 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f, + 0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0x003f, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f, + 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, + 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, + 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, + 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f +}; +static const int cp1251_ucs_table_min = 0x80; +static const int cp1251_ucs_table_len = (sizeof (cp1251_ucs_table) / sizeof (unsigned short)); +static const int cp1251_ucs_table_max = 0x80 + (sizeof (cp1251_ucs_table) / sizeof (unsigned short)); + +#endif /* UNICODE_TABLE_CP1251_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_cp1252.h b/ext/mbstring/libmbfl/filters/unicode_table_cp1252.h new file mode 100644 index 0000000000..8a33920f11 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_cp1252.h @@ -0,0 +1,40 @@ +/* + * "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 authors of this file: PHP3 internationalization team + * You can contact the primary author 金本 茂 <sgk@happysize.co.jp>. + * + */ + +#ifndef UNICODE_TABLE_CP1252_H +#define UNICODE_TABLE_CP1252_H + +/* Windows CodePage 1252 - it's the same as iso-8859-1 but + * defines extra symbols in the range 0x80-0x9f. + * This table differs from the rest of the unicode tables below + * as it only covers this range, while the rest cover 0xa0 onwards */ + +static const unsigned short cp1252_ucs_table[] = { + 0x20ac,0xfffe,0x201a,0x0192,0x201e,0x2026,0x2020,0x2021, + 0x02c6,0x2030,0x0160,0x2039,0x0152,0xfffe,0x017d,0xfffe, + 0xfffe,0x2018,0x2019,0x201c,0x201d,0x2022,0x2013,0x2014, + 0x02dc,0x2122,0x0161,0x203a,0x0153,0xfffe,0x017e,0x0178 +}; +#endif /* UNICODE_TABLE_CP1252_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_cp866.h b/ext/mbstring/libmbfl/filters/unicode_table_cp866.h new file mode 100644 index 0000000000..567493276f --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_cp866.h @@ -0,0 +1,51 @@ +/* + * "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 original author of this file: Den V. Tsopa <tdv@edisoft.ru> + * + */ + +#ifndef UNICODE_TABLE_CP866_H +#define UNICODE_TABLE_CP866_H + +/* cp866_DOSCyrillicRussian to Unicode table */ +static const unsigned short cp866_ucs_table[] = { + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510, + 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, + 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, + 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, + 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040e, 0x045e, + 0x00b0, 0x2219, 0x00b7, 0x221a, 0x2116, 0x00a4, 0x25a0, 0x00a0 +}; +static const int cp866_ucs_table_min = 0x80; +static const int cp866_ucs_table_len = (sizeof (cp866_ucs_table) / sizeof (unsigned short)); +static const int cp866_ucs_table_max = 0x80 + (sizeof (cp866_ucs_table) / sizeof (unsigned short)); + +#endif /* UNICODE_TABLE_CP866_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_cp932_ext.h b/ext/mbstring/libmbfl/filters/unicode_table_cp932_ext.h new file mode 100644 index 0000000000..c948dfa16b --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_cp932_ext.h @@ -0,0 +1,170 @@ +/* + * "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: Rui Hirokawa <hirokawa@php.net> + * + */ + +#ifndef UNICODE_TABLE_CP932_EXT_H +#define UNICODE_TABLE_CP932_EXT_H + +static const unsigned short cp932ext1_ucs_table[] = { + /* ku 13 */ + 0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467, + 0x2468,0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F, + 0x2470,0x2471,0x2472,0x2473,0x2160,0x2161,0x2162,0x2163, + 0x2164,0x2165,0x2166,0x2167,0x2168,0x2169,0x0000,0x3349, + 0x3314,0x3322,0x334D,0x3318,0x3327,0x3303,0x3336,0x3351, + 0x3357,0x330D,0x3326,0x3323,0x332B,0x334A,0x333B,0x339C, + 0x339D,0x339E,0x338E,0x338F,0x33C4,0x33A1,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x337B,0x301D, + 0x301F,0x2116,0x33CD,0x2121,0x32A4,0x32A5,0x32A6,0x32A7, + 0x32A8,0x3231,0x3232,0x3239,0x337E,0x337D,0x337C,0x2252, + 0x2261,0x222B,0x222E,0x2211,0x221A,0x22A5,0x2220,0x221F, + 0x22BF,0x2235,0x2229,0x222A,0x0000,0x0000 +}; +static const int cp932ext1_ucs_table_min = (13 - 1)*94; +static const int cp932ext1_ucs_table_max = (13 - 1)*94 + (sizeof (cp932ext1_ucs_table) / sizeof (unsigned short)); + +static const unsigned short cp932ext2_ucs_table[] = { + /* ku 89 */ + 0x7E8A,0x891C,0x9348,0x9288,0x84DC,0x4FC9,0x70BB,0x6631, + 0x68C8,0x92F9,0x66FB,0x5F45,0x4E28,0x4EE1,0x4EFC,0x4F00, + 0x4F03,0x4F39,0x4F56,0x4F92,0x4F8A,0x4F9A,0x4F94,0x4FCD, + 0x5040,0x5022,0x4FFF,0x501E,0x5046,0x5070,0x5042,0x5094, + 0x50F4,0x50D8,0x514A,0x5164,0x519D,0x51BE,0x51EC,0x5215, + 0x529C,0x52A6,0x52C0,0x52DB,0x5300,0x5307,0x5324,0x5372, + 0x5393,0x53B2,0x53DD,0xFA0E,0x549C,0x548A,0x54A9,0x54FF, + 0x5586,0x5759,0x5765,0x57AC,0x57C8,0x57C7,0xFA0F,0xFA10, + 0x589E,0x58B2,0x590B,0x5953,0x595B,0x595D,0x5963,0x59A4, + 0x59BA,0x5B56,0x5BC0,0x752F,0x5BD8,0x5BEC,0x5C1E,0x5CA6, + 0x5CBA,0x5CF5,0x5D27,0x5D53,0xFA11,0x5D42,0x5D6D,0x5DB8, + 0x5DB9,0x5DD0,0x5F21,0x5F34,0x5F67,0x5FB7, + + /* ku 90 */ + 0x5FDE,0x605D,0x6085,0x608A,0x60DE,0x60D5,0x6120,0x60F2, + 0x6111,0x6137,0x6130,0x6198,0x6213,0x62A6,0x63F5,0x6460, + 0x649D,0x64CE,0x654E,0x6600,0x6615,0x663B,0x6609,0x662E, + 0x661E,0x6624,0x6665,0x6657,0x6659,0xFA12,0x6673,0x6699, + 0x66A0,0x66B2,0x66BF,0x66FA,0x670E,0xF929,0x6766,0x67BB, + 0x6852,0x67C0,0x6801,0x6844,0x68CF,0xFA13,0x6968,0xFA14, + 0x6998,0x69E2,0x6A30,0x6A6B,0x6A46,0x6A73,0x6A7E,0x6AE2, + 0x6AE4,0x6BD6,0x6C3F,0x6C5C,0x6C86,0x6C6F,0x6CDA,0x6D04, + 0x6D87,0x6D6F,0x6D96,0x6DAC,0x6DCF,0x6DF8,0x6DF2,0x6DFC, + 0x6E39,0x6E5C,0x6E27,0x6E3C,0x6EBF,0x6F88,0x6FB5,0x6FF5, + 0x7005,0x7007,0x7028,0x7085,0x70AB,0x710F,0x7104,0x715C, + 0x7146,0x7147,0xFA15,0x71C1,0x71FE,0x72B1, + + /* ku 91 */ + 0x72BE,0x7324,0xFA16,0x7377,0x73BD,0x73C9,0x73D6,0x73E3, + 0x73D2,0x7407,0x73F5,0x7426,0x742A,0x7429,0x742E,0x7462, + 0x7489,0x749F,0x7501,0x756F,0x7682,0x769C,0x769E,0x769B, + 0x76A6,0xFA17,0x7746,0x52AF,0x7821,0x784E,0x7864,0x787A, + 0x7930,0xFA18,0xFA19,0xFA1A,0x7994,0xFA1B,0x799B,0x7AD1, + 0x7AE7,0xFA1C,0x7AEB,0x7B9E,0xFA1D,0x7D48,0x7D5C,0x7DB7, + 0x7DA0,0x7DD6,0x7E52,0x7F47,0x7FA1,0xFA1E,0x8301,0x8362, + 0x837F,0x83C7,0x83F6,0x8448,0x84B4,0x8553,0x8559,0x856B, + 0xFA1F,0x85B0,0xFA20,0xFA21,0x8807,0x88F5,0x8A12,0x8A37, + 0x8A79,0x8AA7,0x8ABE,0x8ADF,0xFA22,0x8AF6,0x8B53,0x8B7F, + 0x8CF0,0x8CF4,0x8D12,0x8D76,0xFA23,0x8ECF,0xFA24,0xFA25, + 0x9067,0x90DE,0xFA26,0x9115,0x9127,0x91DA, + + /* ku 92 */ + 0x91D7,0x91DE,0x91ED,0x91EE,0x91E4,0x91E5,0x9206,0x9210, + 0x920A,0x923A,0x9240,0x923C,0x924E,0x9259,0x9251,0x9239, + 0x9267,0x92A7,0x9277,0x9278,0x92E7,0x92D7,0x92D9,0x92D0, + 0xFA27,0x92D5,0x92E0,0x92D3,0x9325,0x9321,0x92FB,0xFA28, + 0x931E,0x92FF,0x931D,0x9302,0x9370,0x9357,0x93A4,0x93C6, + 0x93DE,0x93F8,0x9431,0x9445,0x9448,0x9592,0xF9DC,0xFA29, + 0x969D,0x96AF,0x9733,0x973B,0x9743,0x974D,0x974F,0x9751, + 0x9755,0x9857,0x9865,0xFA2A,0xFA2B,0x9927,0xFA2C,0x999E, + 0x9A4E,0x9AD9,0x9ADC,0x9B75,0x9B72,0x9B8F,0x9BB1,0x9BBB, + 0x9C00,0x9D70,0x9D6B,0xFA2D,0x9E19,0x9ED1,0x0000,0x0000, + 0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177, + 0x2178,0x2179,0xFFE2,0xFFE4,0xFF07,0xFF02 +}; +static const int cp932ext2_ucs_table_min = (89 - 1)*94; +static const int cp932ext2_ucs_table_max = (89 - 1)*94 + (sizeof (cp932ext2_ucs_table) / sizeof (unsigned short)); + +static const unsigned short cp932ext3_ucs_table[] = { + /* ku 115 */ + 0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177, + 0x2178,0x2179,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165, + 0x2166,0x2167,0x2168,0x2169,0xFFE2,0xFFE4,0xFF07,0xFF02, + 0x3231,0x2116,0x2121,0x2235,0x7E8A,0x891C,0x9348,0x9288, + 0x84DC,0x4FC9,0x70BB,0x6631,0x68C8,0x92F9,0x66FB,0x5F45, + 0x4E28,0x4EE1,0x4EFC,0x4F00,0x4F03,0x4F39,0x4F56,0x4F92, + 0x4F8A,0x4F9A,0x4F94,0x4FCD,0x5040,0x5022,0x4FFF,0x501E, + 0x5046,0x5070,0x5042,0x5094,0x50F4,0x50D8,0x514A,0x5164, + 0x519D,0x51BE,0x51EC,0x5215,0x529C,0x52A6,0x52C0,0x52DB, + 0x5300,0x5307,0x5324,0x5372,0x5393,0x53B2,0x53DD,0xFA0E, + 0x549C,0x548A,0x54A9,0x54FF,0x5586,0x5759,0x5765,0x57AC, + 0x57C8,0x57C7,0xFA0F,0xFA10,0x589E,0x58B2, + + /* ku 116 */ + 0x590B,0x5953,0x595B,0x595D,0x5963,0x59A4,0x59BA,0x5B56, + 0x5BC0,0x752F,0x5BD8,0x5BEC,0x5C1E,0x5CA6,0x5CBA,0x5CF5, + 0x5D27,0x5D53,0xFA11,0x5D42,0x5D6D,0x5DB8,0x5DB9,0x5DD0, + 0x5F21,0x5F34,0x5F67,0x5FB7,0x5FDE,0x605D,0x6085,0x608A, + 0x60DE,0x60D5,0x6120,0x60F2,0x6111,0x6137,0x6130,0x6198, + 0x6213,0x62A6,0x63F5,0x6460,0x649D,0x64CE,0x654E,0x6600, + 0x6615,0x663B,0x6609,0x662E,0x661E,0x6624,0x6665,0x6657, + 0x6659,0xFA12,0x6673,0x6699,0x66A0,0x66B2,0x66BF,0x66FA, + 0x670E,0xF929,0x6766,0x67BB,0x6852,0x67C0,0x6801,0x6844, + 0x68CF,0xFA13,0x6968,0xFA14,0x6998,0x69E2,0x6A30,0x6A6B, + 0x6A46,0x6A73,0x6A7E,0x6AE2,0x6AE4,0x6BD6,0x6C3F,0x6C5C, + 0x6C86,0x6C6F,0x6CDA,0x6D04,0x6D87,0x6D6F, + + /* ku 117 */ + 0x6D96,0x6DAC,0x6DCF,0x6DF8,0x6DF2,0x6DFC,0x6E39,0x6E5C, + 0x6E27,0x6E3C,0x6EBF,0x6F88,0x6FB5,0x6FF5,0x7005,0x7007, + 0x7028,0x7085,0x70AB,0x710F,0x7104,0x715C,0x7146,0x7147, + 0xFA15,0x71C1,0x71FE,0x72B1,0x72BE,0x7324,0xFA16,0x7377, + 0x73BD,0x73C9,0x73D6,0x73E3,0x73D2,0x7407,0x73F5,0x7426, + 0x742A,0x7429,0x742E,0x7462,0x7489,0x749F,0x7501,0x756F, + 0x7682,0x769C,0x769E,0x769B,0x76A6,0xFA17,0x7746,0x52AF, + 0x7821,0x784E,0x7864,0x787A,0x7930,0xFA18,0xFA19,0xFA1A, + 0x7994,0xFA1B,0x799B,0x7AD1,0x7AE7,0xFA1C,0x7AEB,0x7B9E, + 0xFA1D,0x7D48,0x7D5C,0x7DB7,0x7DA0,0x7DD6,0x7E52,0x7F47, + 0x7FA1,0xFA1E,0x8301,0x8362,0x837F,0x83C7,0x83F6,0x8448, + 0x84B4,0x8553,0x8559,0x856B,0xFA1F,0x85B0, + + /* ku 118 */ + 0xFA20,0xFA21,0x8807,0x88F5,0x8A12,0x8A37,0x8A79,0x8AA7, + 0x8ABE,0x8ADF,0xFA22,0x8AF6,0x8B53,0x8B7F,0x8CF0,0x8CF4, + 0x8D12,0x8D76,0xFA23,0x8ECF,0xFA24,0xFA25,0x9067,0x90DE, + 0xFA26,0x9115,0x9127,0x91DA,0x91D7,0x91DE,0x91ED,0x91EE, + 0x91E4,0x91E5,0x9206,0x9210,0x920A,0x923A,0x9240,0x923C, + 0x924E,0x9259,0x9251,0x9239,0x9267,0x92A7,0x9277,0x9278, + 0x92E7,0x92D7,0x92D9,0x92D0,0xFA27,0x92D5,0x92E0,0x92D3, + 0x9325,0x9321,0x92FB,0xFA28,0x931E,0x92FF,0x931D,0x9302, + 0x9370,0x9357,0x93A4,0x93C6,0x93DE,0x93F8,0x9431,0x9445, + 0x9448,0x9592,0xF9DC,0xFA29,0x969D,0x96AF,0x9733,0x973B, + 0x9743,0x974D,0x974F,0x9751,0x9755,0x9857,0x9865,0xFA2A, + 0xFA2B,0x9927,0xFA2C,0x999E,0x9A4E,0x9AD9, + + /* ku 119 */ + 0x9ADC,0x9B75,0x9B72,0x9B8F,0x9BB1,0x9BBB,0x9C00,0x9D70, + 0x9D6B,0xFA2D,0x9E19,0x9ED1 +}; +static const int cp932ext3_ucs_table_min = (115 - 1)*94; +static const int cp932ext3_ucs_table_max = (115 - 1)*94 + (sizeof (cp932ext3_ucs_table) / sizeof (unsigned short)); + +#endif /* UNICODE_TABLE_CP932_EXT_H */ diff --git a/ext/mbstring/unicode_table_cn.h b/ext/mbstring/libmbfl/filters/unicode_table_cp936.h index ca440a3de9..aa024d1a45 100644 --- a/ext/mbstring/unicode_table_cn.h +++ b/ext/mbstring/libmbfl/filters/unicode_table_cp936.h @@ -1,4 +1,31 @@ /* + * "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: Rui Hirokawa <hirokawa@php.net> + * + */ + +#ifndef UNICODE_TABLE_CP936_H +#define UNICODE_TABLE_CP936_H + +/* * Unicode table */ @@ -6459,5 +6486,4 @@ static const unsigned short ucs_hff_cp936_table[] = { static const int ucs_hff_cp936_table_min = 0xff00; static const int ucs_hff_cp936_table_max = 0xff00 + (sizeof (ucs_hff_cp936_table) / sizeof (unsigned short)); - - +#endif /* UNICODE_TABLE_CP936_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_iso8859_10.h b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_10.h new file mode 100644 index 0000000000..0de0d17eb4 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_10.h @@ -0,0 +1,44 @@ +/* + * "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 authors of this file: PHP3 internationalization team + * You can contact the primary author 金本 茂 <sgk@happysize.co.jp>. + * + */ + +#ifndef UNICODE_TABLE_ISO8859_10_H +#define UNICODE_TABLE_ISO8859_10_H + +static const unsigned short iso8859_10_ucs_table[] = { + 0x00A0,0x0104,0x0112,0x0122,0x0124,0x0128,0x0136,0x00A7, + 0x013B,0x0110,0x0160,0x0166,0x017D,0x00AD,0x016A,0x014A, + 0x00B0,0x0105,0x0113,0x0123,0x012B,0x0129,0x0137,0x00B7, + 0x013C,0x0111,0x0161,0x0167,0x017E,0x2015,0x016B,0x014B, + 0x0100,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x012E, + 0x010C,0x00C9,0x0118,0x00CB,0x0116,0x00CD,0x00CE,0x00CF, + 0x00D0,0x0145,0x014C,0x00D3,0x00D4,0x00D5,0x00D6,0x0168, + 0x00D8,0x0172,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, + 0x0101,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x012F, + 0x010D,0x00E9,0x0119,0x00EB,0x0117,0x00ED,0x00EE,0x00EF, + 0x00F0,0x0146,0x014D,0x00F3,0x00F4,0x00F5,0x00F6,0x0169, + 0x00F8,0x0173,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x0138 +}; + +#endif /* UNICODE_TABLE_ISO8859_10_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_iso8859_13.h b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_13.h new file mode 100644 index 0000000000..ee69310bdb --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_13.h @@ -0,0 +1,44 @@ +/* + * "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 authors of this file: PHP3 internationalization team + * You can contact the primary author 金本 茂 <sgk@happysize.co.jp>. + * + */ + +#ifndef UNICODE_TABLE_ISO8859_13_H +#define UNICODE_TABLE_ISO8859_13_H + +static const unsigned short iso8859_13_ucs_table[] = { + 0x00A0,0x201D,0x00A2,0x00A3,0x00A4,0x201E,0x00A6,0x00A7, + 0x00D8,0x00A9,0x0156,0x00AB,0x00AC,0x00AD,0x00AE,0x00C6, + 0x00B0,0x00B1,0x00B2,0x00B3,0x201C,0x00B5,0x00B6,0x00B7, + 0x00F8,0x00B9,0x0157,0x00BB,0x00BC,0x00BD,0x00BE,0x00E6, + 0x0104,0x012E,0x0100,0x0106,0x00C4,0x00C5,0x0118,0x0112, + 0x010C,0x00C9,0x0179,0x0116,0x0122,0x0136,0x012A,0x013B, + 0x0160,0x0143,0x0145,0x00D3,0x014C,0x00D5,0x00D6,0x00D7, + 0x0172,0x0141,0x015A,0x016A,0x00DC,0x017B,0x017D,0x00DF, + 0x0105,0x012F,0x0101,0x0107,0x00E4,0x00E5,0x0119,0x0113, + 0x010D,0x00E9,0x017A,0x0117,0x0123,0x0137,0x012B,0x013C, + 0x0161,0x0144,0x0146,0x00F3,0x014D,0x00F5,0x00F6,0x00F7, + 0x0173,0x0142,0x015B,0x016B,0x00FC,0x017C,0x017E,0x2019 +}; + +#endif /* UNICODE_TABLE_ISO8859_13_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_iso8859_14.h b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_14.h new file mode 100644 index 0000000000..f0633963ff --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_14.h @@ -0,0 +1,44 @@ +/* + * "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 authors of this file: PHP3 internationalization team + * You can contact the primary author 金本 茂 <sgk@happysize.co.jp>. + * + */ + +#ifndef UNICODE_TABLE_ISO8859_14_H +#define UNICODE_TABLE_ISO8859_14_H + +static const unsigned short iso8859_14_ucs_table[] = { + 0x00A0,0x1E02,0x1E03,0x00A3,0x010A,0x010B,0x1E0A,0x00A7, + 0x1E80,0x00A9,0x1E82,0x1E0B,0x1EF2,0x00AD,0x00AE,0x0178, + 0x1E1E,0x1E1F,0x0120,0x0121,0x1E40,0x1E41,0x00B6,0x1E56, + 0x1E81,0x1E57,0x1E83,0x1E60,0x1EF3,0x1E84,0x1E85,0x1E61, + 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, + 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, + 0x0174,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x1E6A, + 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x0176,0x00DF, + 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, + 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, + 0x0175,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x1E6B, + 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x0177,0x00FF +}; + +#endif /* UNICODE_TABLE_ISO8859_14_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_iso8859_15.h b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_15.h new file mode 100644 index 0000000000..ab2f1a82b6 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_15.h @@ -0,0 +1,44 @@ +/* + * "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 authors of this file: PHP3 internationalization team + * You can contact the primary author 金本 茂 <sgk@happysize.co.jp>. + * + */ + +#ifndef UNICODE_TABLE_ISO8859_15_H +#define UNICODE_TABLE_ISO8859_15_H + +static const unsigned short iso8859_15_ucs_table[] = { + 0x00A0,0x00A1,0x00A2,0x00A3,0x20AC,0x00A5,0x0160,0x00A7, + 0x0161,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, + 0x00B0,0x00B1,0x00B2,0x00B3,0x017D,0x00B5,0x00B6,0x00B7, + 0x017E,0x00B9,0x00BA,0x00BB,0x0152,0x0153,0x0178,0x00BF, + 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, + 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, + 0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, + 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, + 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, + 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, + 0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, + 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF +}; + +#endif /* UNICODE_TABLE_ISO8859_15_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_iso8859_2.h b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_2.h new file mode 100644 index 0000000000..148fdbfff5 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_2.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 authors of this file: PHP3 internationalization team + * You can contact the primary author 金本 茂 <sgk@happysize.co.jp>. + * + */ + +#ifndef UNICODE_TABLE_ISO8859_2_H +#define UNICODE_TABLE_ISO8859_2_H + +static const unsigned short iso8859_2_ucs_table[] = { + 0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7, + 0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B, + 0x00B0,0x0105,0x02DB,0x0142,0x00B4,0x013E,0x015B,0x02C7, + 0x00B8,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C, + 0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7, + 0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E, + 0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7, + 0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF, + 0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7, + 0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F, + 0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7, + 0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 +}; + + +#endif /* UNICODE_TABLE_ISO8859_2_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_iso8859_3.h b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_3.h new file mode 100644 index 0000000000..40aa5d635a --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_3.h @@ -0,0 +1,43 @@ +/* + * "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 authors of this file: PHP3 internationalization team + * You can contact the primary author 金本 茂 <sgk@happysize.co.jp>. + * + */ +#ifndef UNICODE_TABLE_ISO8859_3_H +#define UNICODE_TABLE_ISO8859_3_H + +static const unsigned short iso8859_3_ucs_table[] = { + 0x00A0,0x0126,0x02D8,0x00A3,0x00A4,0x0000,0x0124,0x00A7, + 0x00A8,0x0130,0x015E,0x011E,0x0134,0x00AD,0x0000,0x017B, + 0x00B0,0x0127,0x00B2,0x00B3,0x00B4,0x00B5,0x0125,0x00B7, + 0x00B8,0x0131,0x015F,0x011F,0x0135,0x00BD,0x0000,0x017C, + 0x00C0,0x00C1,0x00C2,0x0000,0x00C4,0x010A,0x0108,0x00C7, + 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, + 0x0000,0x00D1,0x00D2,0x00D3,0x00D4,0x0120,0x00D6,0x00D7, + 0x011C,0x00D9,0x00DA,0x00DB,0x00DC,0x016C,0x015C,0x00DF, + 0x00E0,0x00E1,0x00E2,0x0000,0x00E4,0x010B,0x0109,0x00E7, + 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, + 0x0000,0x00F1,0x00F2,0x00F3,0x00F4,0x0121,0x00F6,0x00F7, + 0x011D,0x00F9,0x00FA,0x00FB,0x00FC,0x016D,0x015D,0x02D9 +}; + +#endif /* UNICODE_TABLE_ISO8859_3_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_iso8859_4.h b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_4.h new file mode 100644 index 0000000000..4aaa276c00 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_4.h @@ -0,0 +1,44 @@ +/* + * "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 authors of this file: PHP3 internationalization team + * You can contact the primary author 金本 茂 <sgk@happysize.co.jp>. + * + */ + +#ifndef UNICODE_TABLE_ISO8859_4_H +#define UNICODE_TABLE_ISO8859_4_H + +static const unsigned short iso8859_4_ucs_table[] = { + 0x00A0,0x0104,0x0138,0x0156,0x00A4,0x0128,0x013B,0x00A7, + 0x00A8,0x0160,0x0112,0x0122,0x0166,0x00AD,0x017D,0x00AF, + 0x00B0,0x0105,0x02DB,0x0157,0x00B4,0x0129,0x013C,0x02C7, + 0x00B8,0x0161,0x0113,0x0123,0x0167,0x014A,0x017E,0x014B, + 0x0100,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x012E, + 0x010C,0x00C9,0x0118,0x00CB,0x0116,0x00CD,0x00CE,0x012A, + 0x0110,0x0145,0x014C,0x0136,0x00D4,0x00D5,0x00D6,0x00D7, + 0x00D8,0x0172,0x00DA,0x00DB,0x00DC,0x0168,0x016A,0x00DF, + 0x0101,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x012F, + 0x010D,0x00E9,0x0119,0x00EB,0x0117,0x00ED,0x00EE,0x012B, + 0x0111,0x0146,0x014D,0x0137,0x00F4,0x00F5,0x00F6,0x00F7, + 0x00F8,0x0173,0x00FA,0x00FB,0x00FC,0x0169,0x016B,0x02D9 +}; + +#endif /* UNICODE_TABLE_ISO8859_4_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_iso8859_5.h b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_5.h new file mode 100644 index 0000000000..58fc0e2ada --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_5.h @@ -0,0 +1,44 @@ +/* + * "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 authors of this file: PHP3 internationalization team + * You can contact the primary author 金本 茂 <sgk@happysize.co.jp>. + * + */ + +#ifndef UNICODE_TABLE_ISO8859_5_H +#define UNICODE_TABLE_ISO8859_5_H + +static const unsigned short iso8859_5_ucs_table[] = { + 0x00A0,0x0401,0x0402,0x0403,0x0404,0x0405,0x0406,0x0407, + 0x0408,0x0409,0x040A,0x040B,0x040C,0x00AD,0x040E,0x040F, + 0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417, + 0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F, + 0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427, + 0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F, + 0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437, + 0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F, + 0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447, + 0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F, + 0x2116,0x0451,0x0452,0x0453,0x0454,0x0455,0x0456,0x0457, + 0x0458,0x0459,0x045A,0x045B,0x045C,0x00A7,0x045E,0x045F +}; + +#endif /* UNICODE_TABLE_ISO8859_5_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_iso8859_6.h b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_6.h new file mode 100644 index 0000000000..9dba3ad895 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_6.h @@ -0,0 +1,44 @@ +/* + * "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 authors of this file: PHP3 internationalization team + * You can contact the primary author 金本 茂 <sgk@happysize.co.jp>. + * + */ + +#ifndef UNICODE_TABLE_ISO8859_6_H +#define UNICODE_TABLE_ISO8859_6_H + +static const unsigned short iso8859_6_ucs_table[] = { + 0x00A0,0x0000,0x0000,0x0000,0x00A4,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x060C,0x00AD,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x061B,0x0000,0x0000,0x0000,0x061F, + 0x0000,0x0621,0x0622,0x0623,0x0624,0x0625,0x0626,0x0627, + 0x0628,0x0629,0x062A,0x062B,0x062C,0x062D,0x062E,0x062F, + 0x0630,0x0631,0x0632,0x0633,0x0634,0x0635,0x0636,0x0637, + 0x0638,0x0639,0x063A,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0640,0x0641,0x0642,0x0643,0x0644,0x0645,0x0646,0x0647, + 0x0648,0x0649,0x064A,0x064B,0x064C,0x064D,0x064E,0x064F, + 0x0650,0x0651,0x0652,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x060C,0x00AD,0x0000,0x0000 +}; + +#endif /* UNICODE_TABLE_ISO8859_6_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_iso8859_7.h b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_7.h new file mode 100644 index 0000000000..0dfde9bb84 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_7.h @@ -0,0 +1,44 @@ +/* + * "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 authors of this file: PHP3 internationalization team + * You can contact the primary author 金本 茂 <sgk@happysize.co.jp>. + * + */ + +#ifndef UNICODE_TABLE_ISO8859_7_H +#define UNICODE_TABLE_ISO8859_7_H + +static const unsigned short iso8859_7_ucs_table[] = { + 0x00A0,0x2018,0x2019,0x00A3,0x0000,0x0000,0x00A6,0x00A7, + 0x00A8,0x00A9,0x0000,0x00AB,0x00AC,0x00AD,0x0000,0x2015, + 0x00B0,0x00B1,0x00B2,0x00B3,0x0384,0x0385,0x0386,0x00B7, + 0x0388,0x0389,0x038A,0x00BB,0x038C,0x00BD,0x038E,0x038F, + 0x0390,0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397, + 0x0398,0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F, + 0x03A0,0x03A1,0x0000,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7, + 0x03A8,0x03A9,0x03AA,0x03AB,0x03AC,0x03AD,0x03AE,0x03AF, + 0x03B0,0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7, + 0x03B8,0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF, + 0x03C0,0x03C1,0x03C2,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7, + 0x03C8,0x03C9,0x03CA,0x03CB,0x03CC,0x03CD,0x03CE,0x0000 +}; + +#endif /* UNICODE_TABLE_ISO8859_7_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_iso8859_8.h b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_8.h new file mode 100644 index 0000000000..756004f913 --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_8.h @@ -0,0 +1,44 @@ +/* + * "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 authors of this file: PHP3 internationalization team + * You can contact the primary author 金本 茂 <sgk@happysize.co.jp>. + * + */ + +#ifndef UNICODE_TABLE_ISO8859_8_H +#define UNICODE_TABLE_ISO8859_8_H + +static const unsigned short iso8859_8_ucs_table[] = { + 0x00A0,0x0000,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, + 0x00A8,0x00A9,0x00D7,0x00AB,0x00AC,0x00AD,0x00AE,0x203E, + 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, + 0x00B8,0x00B9,0x00F7,0x00BB,0x00BC,0x00BD,0x00BE,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,0x2017, + 0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7, + 0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF, + 0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7, + 0x05E8,0x05E9,0x05EA,0x0000,0x0000,0x0000,0x0000,0x0000 +}; + +#endif /* UNICODE_TABLE_ISO8859_8_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_iso8859_9.h b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_9.h new file mode 100644 index 0000000000..f39e83f45e --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_iso8859_9.h @@ -0,0 +1,44 @@ +/* + * "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 authors of this file: PHP3 internationalization team + * You can contact the primary author 金本 茂 <sgk@happysize.co.jp>. + * + */ + +#ifndef UNICODE_TABLE_ISO8859_9_H +#define UNICODE_TABLE_ISO8859_9_H + +static const unsigned short iso8859_9_ucs_table[] = { + 0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, + 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, + 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, + 0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, + 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, + 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, + 0x011E,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, + 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x0130,0x015E,0x00DF, + 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, + 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, + 0x011F,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, + 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x0131,0x015F,0x00FF +}; + +#endif /* UNICODE_TABLE_ISO8859_9_H */ diff --git a/ext/mbstring/unicode_table_ja.h b/ext/mbstring/libmbfl/filters/unicode_table_jis.h index 961eb4731c..5671c4e851 100644 --- a/ext/mbstring/unicode_table_ja.h +++ b/ext/mbstring/libmbfl/filters/unicode_table_jis.h @@ -1,4 +1,33 @@ /* + * "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 authors of this file: PHP3 internationalization team + * You can contact the primary authors; 金本 茂 <sgk@happysize.co.jp>, + * Tsukada Takuya <tsukada@fminn.nagano.nagano.jp>. + * + */ + +#ifndef UNICODE_TABLE_JIS_H +#define UNICODE_TABLE_JIS_H + +/* * Unicode table */ static const unsigned short jisx0208_ucs_table[] = { @@ -1170,149 +1199,6 @@ static const unsigned short jisx0208_ucs_table[] = { static const int jisx0208_ucs_table_size = (sizeof (jisx0208_ucs_table) / sizeof (unsigned short)); -static const unsigned short cp932ext1_ucs_table[] = { - /* ku 13 */ - 0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467, - 0x2468,0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F, - 0x2470,0x2471,0x2472,0x2473,0x2160,0x2161,0x2162,0x2163, - 0x2164,0x2165,0x2166,0x2167,0x2168,0x2169,0x0000,0x3349, - 0x3314,0x3322,0x334D,0x3318,0x3327,0x3303,0x3336,0x3351, - 0x3357,0x330D,0x3326,0x3323,0x332B,0x334A,0x333B,0x339C, - 0x339D,0x339E,0x338E,0x338F,0x33C4,0x33A1,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x337B,0x301D, - 0x301F,0x2116,0x33CD,0x2121,0x32A4,0x32A5,0x32A6,0x32A7, - 0x32A8,0x3231,0x3232,0x3239,0x337E,0x337D,0x337C,0x2252, - 0x2261,0x222B,0x222E,0x2211,0x221A,0x22A5,0x2220,0x221F, - 0x22BF,0x2235,0x2229,0x222A,0x0000,0x0000 -}; -static const int cp932ext1_ucs_table_min = (13 - 1)*94; -static const int cp932ext1_ucs_table_max = (13 - 1)*94 + (sizeof (cp932ext1_ucs_table) / sizeof (unsigned short)); - -static const unsigned short cp932ext2_ucs_table[] = { - /* ku 89 */ - 0x7E8A,0x891C,0x9348,0x9288,0x84DC,0x4FC9,0x70BB,0x6631, - 0x68C8,0x92F9,0x66FB,0x5F45,0x4E28,0x4EE1,0x4EFC,0x4F00, - 0x4F03,0x4F39,0x4F56,0x4F92,0x4F8A,0x4F9A,0x4F94,0x4FCD, - 0x5040,0x5022,0x4FFF,0x501E,0x5046,0x5070,0x5042,0x5094, - 0x50F4,0x50D8,0x514A,0x5164,0x519D,0x51BE,0x51EC,0x5215, - 0x529C,0x52A6,0x52C0,0x52DB,0x5300,0x5307,0x5324,0x5372, - 0x5393,0x53B2,0x53DD,0xFA0E,0x549C,0x548A,0x54A9,0x54FF, - 0x5586,0x5759,0x5765,0x57AC,0x57C8,0x57C7,0xFA0F,0xFA10, - 0x589E,0x58B2,0x590B,0x5953,0x595B,0x595D,0x5963,0x59A4, - 0x59BA,0x5B56,0x5BC0,0x752F,0x5BD8,0x5BEC,0x5C1E,0x5CA6, - 0x5CBA,0x5CF5,0x5D27,0x5D53,0xFA11,0x5D42,0x5D6D,0x5DB8, - 0x5DB9,0x5DD0,0x5F21,0x5F34,0x5F67,0x5FB7, - - /* ku 90 */ - 0x5FDE,0x605D,0x6085,0x608A,0x60DE,0x60D5,0x6120,0x60F2, - 0x6111,0x6137,0x6130,0x6198,0x6213,0x62A6,0x63F5,0x6460, - 0x649D,0x64CE,0x654E,0x6600,0x6615,0x663B,0x6609,0x662E, - 0x661E,0x6624,0x6665,0x6657,0x6659,0xFA12,0x6673,0x6699, - 0x66A0,0x66B2,0x66BF,0x66FA,0x670E,0xF929,0x6766,0x67BB, - 0x6852,0x67C0,0x6801,0x6844,0x68CF,0xFA13,0x6968,0xFA14, - 0x6998,0x69E2,0x6A30,0x6A6B,0x6A46,0x6A73,0x6A7E,0x6AE2, - 0x6AE4,0x6BD6,0x6C3F,0x6C5C,0x6C86,0x6C6F,0x6CDA,0x6D04, - 0x6D87,0x6D6F,0x6D96,0x6DAC,0x6DCF,0x6DF8,0x6DF2,0x6DFC, - 0x6E39,0x6E5C,0x6E27,0x6E3C,0x6EBF,0x6F88,0x6FB5,0x6FF5, - 0x7005,0x7007,0x7028,0x7085,0x70AB,0x710F,0x7104,0x715C, - 0x7146,0x7147,0xFA15,0x71C1,0x71FE,0x72B1, - - /* ku 91 */ - 0x72BE,0x7324,0xFA16,0x7377,0x73BD,0x73C9,0x73D6,0x73E3, - 0x73D2,0x7407,0x73F5,0x7426,0x742A,0x7429,0x742E,0x7462, - 0x7489,0x749F,0x7501,0x756F,0x7682,0x769C,0x769E,0x769B, - 0x76A6,0xFA17,0x7746,0x52AF,0x7821,0x784E,0x7864,0x787A, - 0x7930,0xFA18,0xFA19,0xFA1A,0x7994,0xFA1B,0x799B,0x7AD1, - 0x7AE7,0xFA1C,0x7AEB,0x7B9E,0xFA1D,0x7D48,0x7D5C,0x7DB7, - 0x7DA0,0x7DD6,0x7E52,0x7F47,0x7FA1,0xFA1E,0x8301,0x8362, - 0x837F,0x83C7,0x83F6,0x8448,0x84B4,0x8553,0x8559,0x856B, - 0xFA1F,0x85B0,0xFA20,0xFA21,0x8807,0x88F5,0x8A12,0x8A37, - 0x8A79,0x8AA7,0x8ABE,0x8ADF,0xFA22,0x8AF6,0x8B53,0x8B7F, - 0x8CF0,0x8CF4,0x8D12,0x8D76,0xFA23,0x8ECF,0xFA24,0xFA25, - 0x9067,0x90DE,0xFA26,0x9115,0x9127,0x91DA, - - /* ku 92 */ - 0x91D7,0x91DE,0x91ED,0x91EE,0x91E4,0x91E5,0x9206,0x9210, - 0x920A,0x923A,0x9240,0x923C,0x924E,0x9259,0x9251,0x9239, - 0x9267,0x92A7,0x9277,0x9278,0x92E7,0x92D7,0x92D9,0x92D0, - 0xFA27,0x92D5,0x92E0,0x92D3,0x9325,0x9321,0x92FB,0xFA28, - 0x931E,0x92FF,0x931D,0x9302,0x9370,0x9357,0x93A4,0x93C6, - 0x93DE,0x93F8,0x9431,0x9445,0x9448,0x9592,0xF9DC,0xFA29, - 0x969D,0x96AF,0x9733,0x973B,0x9743,0x974D,0x974F,0x9751, - 0x9755,0x9857,0x9865,0xFA2A,0xFA2B,0x9927,0xFA2C,0x999E, - 0x9A4E,0x9AD9,0x9ADC,0x9B75,0x9B72,0x9B8F,0x9BB1,0x9BBB, - 0x9C00,0x9D70,0x9D6B,0xFA2D,0x9E19,0x9ED1,0x0000,0x0000, - 0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177, - 0x2178,0x2179,0xFFE2,0xFFE4,0xFF07,0xFF02 -}; -static const int cp932ext2_ucs_table_min = (89 - 1)*94; -static const int cp932ext2_ucs_table_max = (89 - 1)*94 + (sizeof (cp932ext2_ucs_table) / sizeof (unsigned short)); - -static const unsigned short cp932ext3_ucs_table[] = { - /* ku 115 */ - 0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177, - 0x2178,0x2179,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165, - 0x2166,0x2167,0x2168,0x2169,0xFFE2,0xFFE4,0xFF07,0xFF02, - 0x3231,0x2116,0x2121,0x2235,0x7E8A,0x891C,0x9348,0x9288, - 0x84DC,0x4FC9,0x70BB,0x6631,0x68C8,0x92F9,0x66FB,0x5F45, - 0x4E28,0x4EE1,0x4EFC,0x4F00,0x4F03,0x4F39,0x4F56,0x4F92, - 0x4F8A,0x4F9A,0x4F94,0x4FCD,0x5040,0x5022,0x4FFF,0x501E, - 0x5046,0x5070,0x5042,0x5094,0x50F4,0x50D8,0x514A,0x5164, - 0x519D,0x51BE,0x51EC,0x5215,0x529C,0x52A6,0x52C0,0x52DB, - 0x5300,0x5307,0x5324,0x5372,0x5393,0x53B2,0x53DD,0xFA0E, - 0x549C,0x548A,0x54A9,0x54FF,0x5586,0x5759,0x5765,0x57AC, - 0x57C8,0x57C7,0xFA0F,0xFA10,0x589E,0x58B2, - - /* ku 116 */ - 0x590B,0x5953,0x595B,0x595D,0x5963,0x59A4,0x59BA,0x5B56, - 0x5BC0,0x752F,0x5BD8,0x5BEC,0x5C1E,0x5CA6,0x5CBA,0x5CF5, - 0x5D27,0x5D53,0xFA11,0x5D42,0x5D6D,0x5DB8,0x5DB9,0x5DD0, - 0x5F21,0x5F34,0x5F67,0x5FB7,0x5FDE,0x605D,0x6085,0x608A, - 0x60DE,0x60D5,0x6120,0x60F2,0x6111,0x6137,0x6130,0x6198, - 0x6213,0x62A6,0x63F5,0x6460,0x649D,0x64CE,0x654E,0x6600, - 0x6615,0x663B,0x6609,0x662E,0x661E,0x6624,0x6665,0x6657, - 0x6659,0xFA12,0x6673,0x6699,0x66A0,0x66B2,0x66BF,0x66FA, - 0x670E,0xF929,0x6766,0x67BB,0x6852,0x67C0,0x6801,0x6844, - 0x68CF,0xFA13,0x6968,0xFA14,0x6998,0x69E2,0x6A30,0x6A6B, - 0x6A46,0x6A73,0x6A7E,0x6AE2,0x6AE4,0x6BD6,0x6C3F,0x6C5C, - 0x6C86,0x6C6F,0x6CDA,0x6D04,0x6D87,0x6D6F, - - /* ku 117 */ - 0x6D96,0x6DAC,0x6DCF,0x6DF8,0x6DF2,0x6DFC,0x6E39,0x6E5C, - 0x6E27,0x6E3C,0x6EBF,0x6F88,0x6FB5,0x6FF5,0x7005,0x7007, - 0x7028,0x7085,0x70AB,0x710F,0x7104,0x715C,0x7146,0x7147, - 0xFA15,0x71C1,0x71FE,0x72B1,0x72BE,0x7324,0xFA16,0x7377, - 0x73BD,0x73C9,0x73D6,0x73E3,0x73D2,0x7407,0x73F5,0x7426, - 0x742A,0x7429,0x742E,0x7462,0x7489,0x749F,0x7501,0x756F, - 0x7682,0x769C,0x769E,0x769B,0x76A6,0xFA17,0x7746,0x52AF, - 0x7821,0x784E,0x7864,0x787A,0x7930,0xFA18,0xFA19,0xFA1A, - 0x7994,0xFA1B,0x799B,0x7AD1,0x7AE7,0xFA1C,0x7AEB,0x7B9E, - 0xFA1D,0x7D48,0x7D5C,0x7DB7,0x7DA0,0x7DD6,0x7E52,0x7F47, - 0x7FA1,0xFA1E,0x8301,0x8362,0x837F,0x83C7,0x83F6,0x8448, - 0x84B4,0x8553,0x8559,0x856B,0xFA1F,0x85B0, - - /* ku 118 */ - 0xFA20,0xFA21,0x8807,0x88F5,0x8A12,0x8A37,0x8A79,0x8AA7, - 0x8ABE,0x8ADF,0xFA22,0x8AF6,0x8B53,0x8B7F,0x8CF0,0x8CF4, - 0x8D12,0x8D76,0xFA23,0x8ECF,0xFA24,0xFA25,0x9067,0x90DE, - 0xFA26,0x9115,0x9127,0x91DA,0x91D7,0x91DE,0x91ED,0x91EE, - 0x91E4,0x91E5,0x9206,0x9210,0x920A,0x923A,0x9240,0x923C, - 0x924E,0x9259,0x9251,0x9239,0x9267,0x92A7,0x9277,0x9278, - 0x92E7,0x92D7,0x92D9,0x92D0,0xFA27,0x92D5,0x92E0,0x92D3, - 0x9325,0x9321,0x92FB,0xFA28,0x931E,0x92FF,0x931D,0x9302, - 0x9370,0x9357,0x93A4,0x93C6,0x93DE,0x93F8,0x9431,0x9445, - 0x9448,0x9592,0xF9DC,0xFA29,0x969D,0x96AF,0x9733,0x973B, - 0x9743,0x974D,0x974F,0x9751,0x9755,0x9857,0x9865,0xFA2A, - 0xFA2B,0x9927,0xFA2C,0x999E,0x9A4E,0x9AD9, - - /* ku 119 */ - 0x9ADC,0x9B75,0x9B72,0x9B8F,0x9BB1,0x9BBB,0x9C00,0x9D70, - 0x9D6B,0xFA2D,0x9E19,0x9ED1 -}; -static const int cp932ext3_ucs_table_min = (115 - 1)*94; -static const int cp932ext3_ucs_table_max = (115 - 1)*94 + (sizeof (cp932ext3_ucs_table) / sizeof (unsigned short)); - - static const unsigned short jisx0212_ucs_table[] = { /* ku 1 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, @@ -2392,7 +2278,6 @@ static const unsigned short jisx0212_ucs_table[] = { static const int jisx0212_ucs_table_size = (sizeof (jisx0212_ucs_table) / sizeof (unsigned short)); - static const unsigned short ucs_a1_jis_table[] = { /* 0000h */ 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -5959,3 +5844,4 @@ static const unsigned short ucs_r_jis_table[] = { static const int ucs_r_jis_table_min = 0xFF00; static const int ucs_r_jis_table_max = 0xFF00 + (sizeof (ucs_r_jis_table) / sizeof (unsigned short)); +#endif /* UNICODE_TABLE_JIS_H */ diff --git a/ext/mbstring/libmbfl/filters/unicode_table_koi8r.h b/ext/mbstring/libmbfl/filters/unicode_table_koi8r.h new file mode 100644 index 0000000000..ad3a68cd3d --- /dev/null +++ b/ext/mbstring/libmbfl/filters/unicode_table_koi8r.h @@ -0,0 +1,53 @@ +/* + * "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 original author of this file: Den V. Tsopa <tdv@edisoft.ru> + * + */ + +#ifndef UNICODE_TABLE_KOI8R_H +#define UNICODE_TABLE_KOI8R_H + +/* KOI8-R (RFC1489) to Unicode */ +static const unsigned short koi8r_ucs_table[] = { + 0x2500, 0x2502, 0x250c, 0x2510, 0x2514, 0x2518, 0x251c, 0x2524, + 0x252c, 0x2534, 0x253c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590, + 0x2591, 0x2592, 0x2593, 0x2320, 0x25a0, 0x2219, 0x221a, 0x2248, + 0x2264, 0x2265, 0x00a0, 0x2321, 0x00b0, 0x00b2, 0x00b7, 0x00f7, + 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, + 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, 0x255e, + 0x255f, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565, + 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x00a9, + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a +}; +static const int koi8r_ucs_table_min = 0x80; +static const int koi8r_ucs_table_len = (sizeof (koi8r_ucs_table) / sizeof (unsigned short)); +static const int koi8r_ucs_table_max = 0x80 + (sizeof (koi8r_ucs_table) / sizeof (unsigned short)); + + + +#endif /* UNNICODE_TABLE_KOI8R_H */ diff --git a/ext/mbstring/unicode_table_kr.h b/ext/mbstring/libmbfl/filters/unicode_table_uhc.h index d4f7e78014..802e120e08 100644 --- a/ext/mbstring/unicode_table_kr.h +++ b/ext/mbstring/libmbfl/filters/unicode_table_uhc.h @@ -1,4 +1,31 @@ /* + * "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: Rui Hirokawa <hirokawa@php.net> + * + */ + +#ifndef UNICODE_TABLE_UHC_H +#define UNICODE_TABLE_UHC_H + +/* * Unicode table */ @@ -7155,3 +7182,5 @@ static const int ucs_r2_uhc_table_max = 0xff00 + (sizeof (ucs_r2_uhc_table) / si + +#endif /* UNICODE_TABLE_UHC_H */ diff --git a/ext/mbstring/libmbfl/libmbfl.dsp b/ext/mbstring/libmbfl/libmbfl.dsp new file mode 100644 index 0000000000..bf3fe06557 --- /dev/null +++ b/ext/mbstring/libmbfl/libmbfl.dsp @@ -0,0 +1,763 @@ +# Microsoft Developer Studio Project File - Name="libmbfl" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libmbfl - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libmbfl.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libmbfl.mak" CFG="libmbfl - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libmbfl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libmbfl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libmbfl - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMBFL_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "mbfl" /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMBFL_EXPORTS" /D "HAVE_CONFIG_H" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x411 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+
+!ELSEIF "$(CFG)" == "libmbfl - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMBFL_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "mbfl" /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMBFL_EXPORTS" /D "MBFL_DLL_EXPORT" /D HAVE_CONFIG_H=1 /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x411 /d "_DEBUG"
+# ADD RSC /l 0x411 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "libmbfl - Win32 Release"
+# Name "libmbfl - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "vc6"
+# Begin Source File
+
+SOURCE=.\filters\html_entities.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfilter.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_7bit.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfilter_8bit.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_ascii.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_base64.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_big5.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_byte2.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_byte4.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_cp1251.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_cp1252.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_cp866.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_cp932.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_cp936.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_euc_cn.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_euc_jp.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_euc_jp_win.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_euc_kr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_euc_tw.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_htmlent.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_hz.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso2022_kr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_1.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_10.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_13.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_14.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_15.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_2.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_3.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_4.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_5.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_6.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_7.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_8.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_9.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_jis.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_koi8r.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfilter_pass.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_qprint.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_sjis.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_ucs2.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_ucs4.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_uhc.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_utf16.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_utf32.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_utf7.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_utf7imap.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_utf8.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_uuencode.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfilter_wchar.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_allocators.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_convert.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_encoding.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_filter_output.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_ident.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_language.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_memory_device.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_string.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_de.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_en.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_ja.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_kr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_neutral.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_ru.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_uni.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_zh.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\config.h.vc6
+
+!IF "$(CFG)" == "libmbfl - Win32 Release"
+
+# Begin Custom Build
+InputDir=.
+InputPath=.\config.h.vc6
+
+"$(InputDir)\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ copy $(InputDir)\config.h.vc6 "$(InputDir)\config.h"
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "libmbfl - Win32 Debug"
+
+# Begin Custom Build
+InputDir=.
+InputPath=.\config.h.vc6
+
+"$(InputDir)\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ copy $(InputDir)\config.h.vc6 "$(InputDir)\config.h"
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\cp932_table.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\html_entities.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfilter.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_7bit.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfilter_8bit.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_ascii.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_base64.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_big5.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_byte2.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_byte4.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_cp1251.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_cp1252.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_cp866.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_cp932.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_cp936.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_euc_cn.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_euc_jp.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_euc_jp_win.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_euc_kr.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_euc_tw.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_htmlent.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_hz.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso2022_kr.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_1.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_10.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_13.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_14.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_15.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_2.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_3.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_4.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_5.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_6.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_7.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_8.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_iso8859_9.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_jis.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_koi8r.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfilter_pass.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_qprint.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_sjis.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_ucs2.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_ucs4.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_uhc.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_utf16.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_utf32.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_utf7.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_utf7imap.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_utf8.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\mbfilter_uuencode.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfilter_wchar.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_allocators.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_consts.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_convert.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_encoding.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_filter_output.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_ident.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_language.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_memory_device.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mbfl\mbfl_string.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_de.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_en.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_ja.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_kr.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_neutral.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_ru.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_uni.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\nls\nls_zh.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_prop.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_big5.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_cns11643.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_cp1251.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_cp1252.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_cp866.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_cp932_ext.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_cp936.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_iso8859_10.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_iso8859_13.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_iso8859_14.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_iso8859_15.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_iso8859_2.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_iso8859_3.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_iso8859_4.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_iso8859_5.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_iso8859_6.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_iso8859_7.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_iso8859_8.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_iso8859_9.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_jis.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_koi8r.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\filters\unicode_table_uhc.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\mbfl.rc
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/ext/mbstring/libmbfl/libmbfl.dsw b/ext/mbstring/libmbfl/libmbfl.dsw new file mode 100644 index 0000000000..69e7bf1b9d --- /dev/null +++ b/ext/mbstring/libmbfl/libmbfl.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "libmbfl"=".\libmbfl.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/ext/mbstring/libmbfl/mbfl.def b/ext/mbstring/libmbfl/mbfl.def new file mode 100644 index 0000000000..4471746f23 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl.def @@ -0,0 +1,95 @@ +LIBRARY mbfl.dll + +DESCRIPTION "streamable kanji code filter" + +EXPORTS + _mbfl_encoding_detector_new @1 + _mbfl_encoding_detector_delete @2 + _mbfl_encoding_detector_feed @3 + _mbfl_encoding_detector_judge @4 + _mbfl_convert_encoding @5 + _mbfl_identify_encoding @6 + _mbfl_identify_encoding_name @7 + _mbfl_identify_encoding_no @8 + _mbfl_strlen @9 + _mbfl_strpos @10 + _mbfl_substr_count @11 + _mbfl_substr @12 + _mbfl_strcut @13 + _mbfl_strwidth @14 + _mbfl_strimwidth @15 + _mime_header_encoder_new @16 + _mime_header_encoder_delete @17 + _mime_header_encoder_feed @18 + _mime_header_encoder_result @19 + _mbfl_mime_header_encode @20 + _mime_header_decoder_new @21 + _mime_header_decoder_delete @22 + _mime_header_decoder_feed @23 + _mime_header_decoder_result @24 + _mbfl_mime_header_decode @25 + _mbfl_html_numeric_entity @26 + _mbfl_ja_jp_hantozen @27 + ___mbfl_allocators @28 + _mbfl_convert_filter_new @29 + _mbfl_convert_filter_delete @30 + _mbfl_convert_filter_feed @31 + _mbfl_convert_filter_flush @32 + _mbfl_convert_filter_reset @33 + _mbfl_convert_filter_copy @34 + _mbfl_filt_conv_illegal_output @35 + _mbfl_convert_filter_select_vtbl @36 + _mbfl_convert_filter_get_vtbl @37 + _mbfl_filt_conv_common_ctor @38 + _mbfl_filt_conv_common_flush @39 + _mbfl_filt_conv_common_dtor @40 + _mbfl_convert_filter_devcat @41 + _mbfl_convert_filter_strcat @42 + _mbfl_get_encoding_by_name @43 + _mbfl_get_encoding_by_id @44 + _mbfl_encoding_get_id_by_name @45 + _mbfl_encoding_get_name_by_id @46 + _mbfl_encoding_get_mime_preferred_name_by_id @47 + _mbfl_is_supported_encoding @48 + _mbfl_filter_output_pipe @49 + _mbfl_filter_output_null @50 + _mbfl_identify_filter_set_vtbl @51 + _mbfl_identify_filter_select_vtbl @52 + _mbfl_identify_filter_new @53 + _mbfl_identify_filter_delete @54 + _mbfl_filt_ident_common_ctor @55 + _mbfl_filt_ident_common_dtor @56 + _mbfl_filt_ident_false_ctor @57 + _mbfl_filt_ident_false @58 + _mbfl_filt_ident_true @59 + _mbfl_get_language_by_name @60 + _mbfl_get_language_by_id @61 + _mbfl_language_get_id_by_name @62 + _mbfl_language_get_name_by_id @63 + _mbfl_memory_device_ctor @64 + _mbfl_memory_device_realloc @65 + _mbfl_memory_device_dtor @66 + _mbfl_memory_device_reset @67 + _mbfl_memory_device_result @68 + _mbfl_memory_device_unput @69 + _mbfl_memory_device_output @70 + _mbfl_memory_device_output2 @71 + _mbfl_memory_device_output4 @72 + _mbfl_memory_device_strcat @73 + _mbfl_memory_device_strncat @74 + _mbfl_memory_device_devcat @75 + _mbfl_wchar_device_ctor @76 + _mbfl_wchar_device_output @77 + _mbfl_wchar_device_dtor @78 + _mbfl_string_ctor @79 + _mbfl_string_ctor2 @80 + _mbfl_string_dtor @81 + _mbfl_collection_ctor @82 + __mbfl_collection_dtor @83 + _mbfl_list_ctor @84 + __mbfl_list_dtor @85 + _mbfl_arraylist_ctor @86 + __mbfl_arraylist_dtor @87 + _mbfl_iterator_free @88 + _mbfl_register_language @89 + _mbfl_language_id_uni @90 diff --git a/ext/mbstring/libmbfl/mbfl.rc b/ext/mbstring/libmbfl/mbfl.rc new file mode 100644 index 0000000000..655e61893a --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl.rc @@ -0,0 +1,24 @@ +/* $Id$ */ +1 VERSIONINFO +FILEVERSION 1,1,0,0 +PRODUCTVERSION 1,1,0,0 +FILEFLAGSMASK 0 +FILEOS 0x40000 +FILETYPE 1 +{ + BLOCK "StringFileInfo" + { + BLOCK "040904E4" + { + VALUE "CompanyName", "-\0" + VALUE "FileDescription", "streamable kanji code filter\0" + VALUE "FileVersion", "1.1.0\0" + VALUE "InternalName", "mbfl\0" + VALUE "LegalCopyright", "GNU Lesser Public License Version 2.0\0" + VALUE "OriginalFilename", "mbfl.dll\0" + VALUE "ProductName", "mbfl\0" + VALUE "ProductVersion", "1.1.0\0" + } + } +} + diff --git a/ext/mbstring/libmbfl/mbfl/Makefile.am b/ext/mbstring/libmbfl/mbfl/Makefile.am new file mode 100644 index 0000000000..d26d6cd9cf --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/Makefile.am @@ -0,0 +1,13 @@ +lib_LTLIBRARIES=libmbfl.la +libmbfl_la_SOURCES=mbfilter.c mbfl_string.c mbfl_language.c mbfl_encoding.c mbfl_convert.c mbfl_ident.c mbfl_memory_device.c mbfl_allocators.c mbfl_filter_output.c mbfilter_pass.c mbfilter_wchar.c mbfilter_8bit.c +libmbfl_filters_la=../filters/libmbfl_filters.la +libmbfl_nls_la=../nls/libmbfl_nls.la +libmbfl_la_LIBADD=$(libmbfl_filters_la) $(libmbfl_nls_la) +libmbfl_includedir=$(includedir)/mbfl +libmbfl_include_HEADERS=mbfilter.h mbfl_consts.h mbfl_encoding.h mbfl_language.h mbfl_string.h mbfl_convert.h mbfl_ident.h mbfl_memory_device.h mbfl_allocators.h + +$(libmbfl_filters_la): + $(MAKE) -C `dirname $(libmbfl_filters_la)` + +$(libmbfl_nls_la): + $(MAKE) -C `dirname $(libmbfl_nls_la)` diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter.c b/ext/mbstring/libmbfl/mbfl/mbfilter.c new file mode 100644 index 0000000000..640100f0c4 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfilter.c @@ -0,0 +1,2719 @@ +/* + * charset=UTF-8 + * vim600: encoding=utf-8 + */ + +/* + * "streamable kanji code filter and converter" + * + * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved. + * + * This software is released under the GNU Lesser General Public License. + * (Version 2.1, February 1999) + * Please read the following detail of the licence (in japanese). + * + * ◆使用許諾æ¡ä»¶â—† + * + * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•れã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ + * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•トウェアã«é–¢ + * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ + * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•トウェアを使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利 + * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•トウェアを使用 + * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 + * + * ã“ã®ã‚½ãƒ•トウェアを「GNU Lesser General Public License (Version 2.1, February + * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser + * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢ + * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ + * + * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã + * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“れã¾ã§Library General + * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚ + * http://www.gnu.org/ --- GNUウェブサイト + * http://www.gnu.org/copyleft/lesser.html --- ãƒ©ã‚¤ã‚»ãƒ³ã‚¹æ–‡é¢ + * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。 + * + * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプãƒã‚¸ã‚§ã‚¯ãƒˆã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§ + * ã¯ã‚りã¾ã›ã‚“。 + * + * â—†ä¿è¨¼å†…容◆ + * + * ã“ã®ã‚½ãƒ•トウェアã¯ã€æœŸå¾…ã•れãŸå‹•作・機能・性能をæŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨è¨ˆã•れ + * 開発ã•れã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚りã¾ã›ã‚“。ã“ã®ã‚½ãƒ•トウェアã¯ã€Œã“ + * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•れã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定㮠+ * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•らã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•れãŸã‚Šæš—é»™ã«ç¤ºã•れã¦ã„ + * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åйã§ã™ã€‚ã“ã®ã‚½ãƒ•トウェアを使用ã—ãŸçµæžœãªã„ã—使 + * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æå®³ + * ã€ãƒ‡ãƒ¼ã‚¿ã®æå¤±ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æå®³ã«ã¤ã„ã¦ã¯ã€ãã®æå®³ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€… + * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è¦å‘Šã•れã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æå®³ã®è³ + * 償ãŠã‚ˆã³è£œå¡«ã‚’行ã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ» + * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚ + * + * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—† + * + * 〒102-0073 + * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F + * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ + * Phone: 03-3512-3655, Fax: 03-3512-3656 + * Email: sales@happysize.co.jp + * Web: http://happysize.com/ + * + * ◆著者◆ + * + * 金本 茂 <sgk@happysize.co.jp> + * + * ◆履æ´â—† + * + * 1998/11/10 sgk implementation in C++ + * 1999/4/25 sgk Cã§æ›¸ããªãŠã—。 + * 1999/4/26 sgk 入力フィルタを実装。漢å—コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’è¿½åŠ ã€‚ + * 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚ + * 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚ + * + */ + +/* + * Unicode support + * + * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team. + * All rights reserved. + * + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stddef.h> + +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfilter.h" +#include "mbfl_filter_output.h" +#include "mbfilter_pass.h" + +/* hex character table "0123456789ABCDEF" */ +static char mbfl_hexchar_table[] = { + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46 +}; + + + +/* + * encoding filter + */ +#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) + + +/* + * buffering converter + */ +mbfl_buffer_converter * +mbfl_buffer_converter_new( + enum mbfl_no_encoding from, + enum mbfl_no_encoding to, + int buf_initsz) +{ + mbfl_buffer_converter *convd; + + /* allocate */ + convd = (mbfl_buffer_converter*)mbfl_malloc(sizeof (mbfl_buffer_converter)); + if (convd == NULL) { + return NULL; + } + + /* initialize */ + convd->from = mbfl_no2encoding(from); + convd->to = mbfl_no2encoding(to); + if (convd->from == NULL) { + convd->from = &mbfl_encoding_pass; + } + if (convd->to == NULL) { + convd->to = &mbfl_encoding_pass; + } + + /* create convert filter */ + convd->filter1 = NULL; + convd->filter2 = NULL; + if (mbfl_convert_filter_get_vtbl(convd->from->no_encoding, convd->to->no_encoding) != NULL) { + convd->filter1 = mbfl_convert_filter_new(convd->from->no_encoding, convd->to->no_encoding, mbfl_memory_device_output, 0, &convd->device); + } else { + convd->filter2 = mbfl_convert_filter_new(mbfl_no_encoding_wchar, convd->to->no_encoding, mbfl_memory_device_output, 0, &convd->device); + if (convd->filter2 != NULL) { + convd->filter1 = mbfl_convert_filter_new(convd->from->no_encoding, mbfl_no_encoding_wchar, (int (*)(int, void*))convd->filter2->filter_function, NULL, convd->filter2); + if (convd->filter1 == NULL) { + mbfl_convert_filter_delete(convd->filter2); + } + } + } + if (convd->filter1 == NULL) { + return NULL; + } + + mbfl_memory_device_init(&convd->device, buf_initsz, buf_initsz/4); + + return convd; +} + +void +mbfl_buffer_converter_delete(mbfl_buffer_converter *convd) +{ + if (convd != NULL) { + if (convd->filter1) { + mbfl_convert_filter_delete(convd->filter1); + } + if (convd->filter2) { + mbfl_convert_filter_delete(convd->filter2); + } + mbfl_memory_device_clear(&convd->device); + mbfl_free((void*)convd); + } +} + +void +mbfl_buffer_converter_reset(mbfl_buffer_converter *convd) +{ + mbfl_memory_device_reset(&convd->device); +} + +int +mbfl_buffer_converter_illegal_mode(mbfl_buffer_converter *convd, int mode) +{ + if (convd != NULL) { + if (convd->filter2 != NULL) { + convd->filter2->illegal_mode = mode; + } else if (convd->filter1 != NULL) { + convd->filter1->illegal_mode = mode; + } else { + return 0; + } + } + + return 1; +} + +int +mbfl_buffer_converter_illegal_substchar(mbfl_buffer_converter *convd, int substchar) +{ + if (convd != NULL) { + if (convd->filter2 != NULL) { + convd->filter2->illegal_substchar = substchar; + } else if (convd->filter1 != NULL) { + convd->filter1->illegal_substchar = substchar; + } else { + return 0; + } + } + + return 1; +} + +int +mbfl_buffer_converter_strncat(mbfl_buffer_converter *convd, const unsigned char *p, int n) +{ + mbfl_convert_filter *filter; + int (*filter_function)(int c, mbfl_convert_filter *filter); + + if (convd != NULL && p != NULL) { + filter = convd->filter1; + if (filter != NULL) { + filter_function = filter->filter_function; + while (n > 0) { + if ((*filter_function)(*p++, filter) < 0) { + break; + } + n--; + } + } + } + + return n; +} + +int +mbfl_buffer_converter_feed(mbfl_buffer_converter *convd, mbfl_string *string) +{ + int n; + unsigned char *p; + mbfl_convert_filter *filter; + int (*filter_function)(int c, mbfl_convert_filter *filter); + + if (convd == NULL || string == NULL) { + return -1; + } + mbfl_memory_device_realloc(&convd->device, convd->device.pos + string->len, string->len/4); + /* feed data */ + n = string->len; + p = string->val; + filter = convd->filter1; + if (filter != NULL) { + filter_function = filter->filter_function; + while (n > 0) { + if ((*filter_function)(*p++, filter) < 0) { + return -1; + } + n--; + } + } + + return 0; +} + +int +mbfl_buffer_converter_flush(mbfl_buffer_converter *convd) +{ + if (convd == NULL) { + return -1; + } + + if (convd->filter1 != NULL) { + mbfl_convert_filter_flush(convd->filter1); + } + if (convd->filter2 != NULL) { + mbfl_convert_filter_flush(convd->filter2); + } + + return 0; +} + +mbfl_string * +mbfl_buffer_converter_getbuffer(mbfl_buffer_converter *convd, mbfl_string *result) +{ + if (convd != NULL && result != NULL && convd->device.buffer != NULL) { + result->no_encoding = convd->to->no_encoding; + result->val = convd->device.buffer; + result->len = convd->device.pos; + } else { + result = NULL; + } + + return result; +} + +mbfl_string * +mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result) +{ + if (convd == NULL || result == NULL) { + return NULL; + } + result->no_encoding = convd->to->no_encoding; + return mbfl_memory_device_result(&convd->device, result); +} + +mbfl_string * +mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string, + mbfl_string *result) +{ + if (convd == NULL || string == NULL || result == NULL) { + return NULL; + } + mbfl_buffer_converter_feed(convd, string); + if (convd->filter1 != NULL) { + mbfl_convert_filter_flush(convd->filter1); + } + if (convd->filter2 != NULL) { + mbfl_convert_filter_flush(convd->filter2); + } + result->no_encoding = convd->to->no_encoding; + return mbfl_memory_device_result(&convd->device, result); +} + + +/* + * encoding detector + */ +mbfl_encoding_detector * +mbfl_encoding_detector_new(enum mbfl_no_encoding *elist, int eliztsz) +{ + mbfl_encoding_detector *identd; + + int i, num; + mbfl_identify_filter *filter; + + if (elist == NULL || eliztsz <= 0) { + return NULL; + } + + /* allocate */ + identd = (mbfl_encoding_detector*)mbfl_malloc(sizeof(mbfl_encoding_detector)); + if (identd == NULL) { + return NULL; + } + identd->filter_list = (mbfl_identify_filter **)mbfl_calloc(eliztsz, sizeof(mbfl_identify_filter *)); + if (identd->filter_list == NULL) { + mbfl_free(identd); + return NULL; + } + + /* create filters */ + i = 0; + num = 0; + while (i < eliztsz) { + filter = mbfl_identify_filter_new(elist[i]); + if (filter != NULL) { + identd->filter_list[num] = filter; + num++; + } + i++; + } + identd->filter_list_size = num; + + return identd; +} + +void +mbfl_encoding_detector_delete(mbfl_encoding_detector *identd) +{ + int i; + + if (identd != NULL) { + if (identd->filter_list != NULL) { + i = identd->filter_list_size; + while (i > 0) { + i--; + mbfl_identify_filter_delete(identd->filter_list[i]); + } + mbfl_free((void *)identd->filter_list); + } + mbfl_free((void *)identd); + } +} + +int +mbfl_encoding_detector_feed(mbfl_encoding_detector *identd, mbfl_string *string) +{ + int i, n, num, bad, res; + unsigned char *p; + mbfl_identify_filter *filter; + + res = 0; + /* feed data */ + if (identd != NULL && string != NULL && string->val != NULL) { + num = identd->filter_list_size; + n = string->len; + p = string->val; + while (n > 0) { + i = 0; + bad = 0; + while (i < num) { + filter = identd->filter_list[i]; + (*filter->filter_function)(*p, filter); + if (filter->flag) { + bad++; + } + i++; + } + if ((num - 1) <= bad) { + res = 1; + break; + } + p++; + n--; + } + } + + return res; +} + +enum mbfl_no_encoding mbfl_encoding_detector_judge(mbfl_encoding_detector *identd) +{ + mbfl_identify_filter *filter; + enum mbfl_no_encoding encoding; + int n; + + /* judge */ + encoding = mbfl_no_encoding_invalid; + if (identd != NULL) { + n = identd->filter_list_size - 1; + while (n >= 0) { + filter = identd->filter_list[n]; + if (!filter->flag) { + encoding = filter->encoding->no_encoding; + } + n--; + } + } + + return encoding; +} + + +/* + * encoding converter + */ +mbfl_string * +mbfl_convert_encoding( + mbfl_string *string, + mbfl_string *result, + enum mbfl_no_encoding toenc) +{ + int n; + unsigned char *p; + const mbfl_encoding *encoding; + mbfl_memory_device device; + mbfl_convert_filter *filter1; + mbfl_convert_filter *filter2; + + /* initialize */ + encoding = mbfl_no2encoding(toenc); + if (encoding == NULL || string == NULL || result == NULL) { + return NULL; + } + + filter1 = NULL; + filter2 = NULL; + if (mbfl_convert_filter_get_vtbl(string->no_encoding, toenc) != NULL) { + filter1 = mbfl_convert_filter_new(string->no_encoding, toenc, mbfl_memory_device_output, 0, &device); + } else { + filter2 = mbfl_convert_filter_new(mbfl_no_encoding_wchar, toenc, mbfl_memory_device_output, 0, &device); + if (filter2 != NULL) { + filter1 = mbfl_convert_filter_new(string->no_encoding, mbfl_no_encoding_wchar, (int (*)(int, void*))filter2->filter_function, NULL, filter2); + if (filter1 == NULL) { + mbfl_convert_filter_delete(filter2); + } + } + } + if (filter1 == NULL) { + return NULL; + } + + if (filter2 != NULL) { + filter2->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; + filter2->illegal_substchar = 0x3f; /* '?' */ + } + + mbfl_memory_device_init(&device, string->len, (string->len >> 2) + 8); + + /* feed data */ + n = string->len; + p = string->val; + if (p != NULL) { + while (n > 0) { + if ((*filter1->filter_function)(*p++, filter1) < 0) { + break; + } + n--; + } + } + + mbfl_convert_filter_flush(filter1); + mbfl_convert_filter_delete(filter1); + if (filter2 != NULL) { + mbfl_convert_filter_flush(filter2); + mbfl_convert_filter_delete(filter2); + } + + return mbfl_memory_device_result(&device, result); +} + + +/* + * identify encoding + */ +const mbfl_encoding * +mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz, int strict) +{ + int i, n, num, bad; + unsigned char *p; + const struct mbfl_identify_vtbl *vtbl; + mbfl_identify_filter *flist, *filter; + const mbfl_encoding *encoding; + + /* initialize */ + flist = (mbfl_identify_filter *)mbfl_calloc(eliztsz, sizeof(mbfl_identify_filter)); + if (flist == NULL) { + return NULL; + } + i = 0; + num = 0; + if (elist != NULL) { + while (i < eliztsz) { + vtbl = mbfl_identify_filter_get_vtbl(elist[i]); + if (vtbl != NULL) { + filter = &flist[num]; + mbfl_identify_filter_set_vtbl(filter, vtbl); + filter->encoding = mbfl_no2encoding(vtbl->encoding); + (*filter->filter_ctor)(filter); + num++; + } + i++; + } + } + + /* feed data */ + n = string->len; + p = string->val; + if (p != NULL) { + while (n > 0) { + i = 0; + bad = 0; + while (i < num) { + filter = &flist[i]; + (*filter->filter_function)(*p, filter); + if (filter->flag) { + bad++; + } + i++; + } + if ((num - 1) <= bad && !strict) { + break; + } + p++; + n--; + } + } + + /* judge */ + i = num - 1; + bad = 1; + encoding = NULL; + while (i >= 0) { + filter = &flist[i]; + if (filter->flag) { + bad++; + } else { + encoding = filter->encoding; + } + i--; + } +#if 0 + if (bad < num) { + encoding = NULL; + } +#endif + + i = 0; + while (i < num) { + filter = &flist[i]; + (*filter->filter_dtor)(filter); + i++; + } + mbfl_free((void *)flist); + + return encoding; +} + +const char* +mbfl_identify_encoding_name(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz, int strict) +{ + const mbfl_encoding *encoding; + + encoding = mbfl_identify_encoding(string, elist, eliztsz, strict); + if (encoding != NULL && + encoding->no_encoding > mbfl_no_encoding_charset_min && + encoding->no_encoding < mbfl_no_encoding_charset_max) { + return encoding->name; + } else { + return NULL; + } +} + +const enum mbfl_no_encoding +mbfl_identify_encoding_no(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz) +{ + const mbfl_encoding *encoding; + + encoding = mbfl_identify_encoding(string, elist, eliztsz, 0); + if (encoding != NULL && + encoding->no_encoding > mbfl_no_encoding_charset_min && + encoding->no_encoding < mbfl_no_encoding_charset_max) { + return encoding->no_encoding; + } else { + return mbfl_no_encoding_invalid; + } +} + + +/* + * strlen + */ +static int +filter_count_output(int c, void *data) +{ + (*(int *)data)++; + return c; +} + +int +mbfl_strlen(mbfl_string *string) +{ + int len, n, m, k; + unsigned char *p; + const unsigned char *mbtab; + const mbfl_encoding *encoding; + + encoding = mbfl_no2encoding(string->no_encoding); + if (encoding == NULL || string == NULL) { + return -1; + } + + len = 0; + if (encoding->flag & MBFL_ENCTYPE_SBCS) { + len = string->len; + } else if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) { + len = string->len/2; + } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) { + len = string->len/4; + } else if (encoding->mblen_table != NULL) { + mbtab = encoding->mblen_table; + n = 0; + p = string->val; + k = string->len; + /* count */ + if (p != NULL) { + while (n < k) { + m = mbtab[*p]; + n += m; + p += m; + len++; + }; + } + } else { + /* wchar filter */ + mbfl_convert_filter *filter = mbfl_convert_filter_new( + string->no_encoding, + mbfl_no_encoding_wchar, + filter_count_output, 0, &len); + if (filter == NULL) { + return -1; + } + /* count */ + n = string->len; + p = string->val; + if (p != NULL) { + while (n > 0) { + (*filter->filter_function)(*p++, filter); + n--; + } + } + mbfl_convert_filter_delete(filter); + } + + return len; +} + + +/* + * strpos + */ +struct collector_strpos_data { + mbfl_convert_filter *next_filter; + mbfl_wchar_device needle; + int needle_len; + int start; + int output; + int found_pos; + int needle_pos; + int matched_pos; +}; + +static int +collector_strpos(int c, void* data) +{ + int *p, *h, *m, n; + struct collector_strpos_data *pc = (struct collector_strpos_data*)data; + + if (pc->output >= pc->start) { + if (c == (int)pc->needle.buffer[pc->needle_pos]) { + if (pc->needle_pos == 0) { + pc->found_pos = pc->output; /* found position */ + } + pc->needle_pos++; /* needle pointer */ + if (pc->needle_pos >= pc->needle_len) { + pc->matched_pos = pc->found_pos; /* matched position */ + pc->needle_pos--; + goto retry; + } + } else if (pc->needle_pos != 0) { +retry: + h = (int *)pc->needle.buffer; + h++; + for (;;) { + pc->found_pos++; + p = h; + m = pc->needle.buffer; + n = pc->needle_pos - 1; + while (n > 0 && *p == *m) { + n--; + p++; + m++; + } + if (n <= 0) { + if (*m != c) { + pc->needle_pos = 0; + } + break; + } else { + h++; + pc->needle_pos--; + } + } + } + } + + pc->output++; + return c; +} + +/* + * oddlen + */ +int +mbfl_oddlen(mbfl_string *string) +{ + int len, n, m, k; + unsigned char *p; + const unsigned char *mbtab; + const mbfl_encoding *encoding; + + + if (string == NULL) { + return -1; + } + encoding = mbfl_no2encoding(string->no_encoding); + if (encoding == NULL) { + return -1; + } + + len = 0; + if (encoding->flag & MBFL_ENCTYPE_SBCS) { + return 0; + } else if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) { + return len % 2; + } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) { + return len % 4; + } else if (encoding->mblen_table != NULL) { + mbtab = encoding->mblen_table; + n = 0; + p = string->val; + k = string->len; + /* count */ + if (p != NULL) { + while (n < k) { + m = mbtab[*p]; + n += m; + p += m; + }; + } + return n-k; + } else { + /* how can i do ? */ + return 0; + } + /* NOT REACHED */ +} + +int +mbfl_strpos( + mbfl_string *haystack, + mbfl_string *needle, + int offset, + int reverse) +{ + int n, result; + unsigned char *p; + mbfl_convert_filter *filter; + struct collector_strpos_data pc; + + if (haystack == NULL || needle == NULL) { + return -8; + } + /* needle is converted into wchar */ + mbfl_wchar_device_init(&pc.needle); + filter = mbfl_convert_filter_new( + needle->no_encoding, + mbfl_no_encoding_wchar, + mbfl_wchar_device_output, 0, &pc.needle); + if (filter == NULL) { + return -4; + } + p = needle->val; + n = needle->len; + if (p != NULL) { + while (n > 0) { + if ((*filter->filter_function)(*p++, filter) < 0) { + break; + } + n--; + } + } + mbfl_convert_filter_flush(filter); + mbfl_convert_filter_delete(filter); + pc.needle_len = pc.needle.pos; + if (pc.needle.buffer == NULL) { + return -4; + } + if (pc.needle_len <= 0) { + mbfl_wchar_device_clear(&pc.needle); + return -2; + } + /* initialize filter and collector data */ + filter = mbfl_convert_filter_new( + haystack->no_encoding, + mbfl_no_encoding_wchar, + collector_strpos, 0, &pc); + if (filter == NULL) { + mbfl_wchar_device_clear(&pc.needle); + return -4; + } + pc.start = offset; + pc.output = 0; + pc.needle_pos = 0; + pc.found_pos = 0; + pc.matched_pos = -1; + + /* feed data */ + p = haystack->val; + n = haystack->len; + if (p != NULL) { + while (n > 0) { + if ((*filter->filter_function)(*p++, filter) < 0) { + pc.matched_pos = -4; + break; + } + if (pc.matched_pos >= 0 && !reverse) { + break; + } + n--; + } + } + mbfl_convert_filter_flush(filter); + result = pc.matched_pos; + mbfl_convert_filter_delete(filter); + mbfl_wchar_device_clear(&pc.needle); + + return result; +} + +/* + * substr_count + */ + +int +mbfl_substr_count( + mbfl_string *haystack, + mbfl_string *needle + ) +{ + int n, result = 0; + unsigned char *p; + mbfl_convert_filter *filter; + struct collector_strpos_data pc; + + if (haystack == NULL || needle == NULL) { + return -8; + } + /* needle is converted into wchar */ + mbfl_wchar_device_init(&pc.needle); + filter = mbfl_convert_filter_new( + needle->no_encoding, + mbfl_no_encoding_wchar, + mbfl_wchar_device_output, 0, &pc.needle); + if (filter == NULL) { + return -4; + } + p = needle->val; + n = needle->len; + if (p != NULL) { + while (n > 0) { + if ((*filter->filter_function)(*p++, filter) < 0) { + break; + } + n--; + } + } + mbfl_convert_filter_flush(filter); + mbfl_convert_filter_delete(filter); + pc.needle_len = pc.needle.pos; + if (pc.needle.buffer == NULL) { + return -4; + } + if (pc.needle_len <= 0) { + mbfl_wchar_device_clear(&pc.needle); + return -2; + } + /* initialize filter and collector data */ + filter = mbfl_convert_filter_new( + haystack->no_encoding, + mbfl_no_encoding_wchar, + collector_strpos, 0, &pc); + if (filter == NULL) { + mbfl_wchar_device_clear(&pc.needle); + return -4; + } + pc.start = 0; + pc.output = 0; + pc.needle_pos = 0; + pc.found_pos = 0; + pc.matched_pos = -1; + + /* feed data */ + p = haystack->val; + n = haystack->len; + if (p != NULL) { + while (n > 0) { + if ((*filter->filter_function)(*p++, filter) < 0) { + pc.matched_pos = -4; + break; + } + if (pc.matched_pos >= 0) { + ++result; + pc.matched_pos = -1; + } + n--; + } + } + mbfl_convert_filter_flush(filter); + mbfl_convert_filter_delete(filter); + mbfl_wchar_device_clear(&pc.needle); + + return result; +} + +/* + * substr + */ +struct collector_substr_data { + mbfl_convert_filter *next_filter; + int start; + int stop; + int output; +}; + +static int +collector_substr(int c, void* data) +{ + struct collector_substr_data *pc = (struct collector_substr_data*)data; + + if (pc->output >= pc->stop) { + return -1; + } + + if (pc->output >= pc->start) { + (*pc->next_filter->filter_function)(c, pc->next_filter); + } + + pc->output++; + + return c; +} + +mbfl_string * +mbfl_substr( + mbfl_string *string, + mbfl_string *result, + int from, + int length) +{ + const mbfl_encoding *encoding; + int n, m, k, len, start, end; + unsigned char *p, *w; + const unsigned char *mbtab; + + encoding = mbfl_no2encoding(string->no_encoding); + if (encoding == NULL || string == NULL || result == NULL) { + return NULL; + } + mbfl_string_init(result); + result->no_language = string->no_language; + result->no_encoding = string->no_encoding; + + if ((encoding->flag & (MBFL_ENCTYPE_SBCS | MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE | MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) || + encoding->mblen_table != NULL) { + len = string->len; + start = from; + end = from + length; + if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_MWC2LE)) { + start *= 2; + end = start + length*2; + } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_MWC4LE)) { + start *= 4; + end = start + length*4; + } else if (encoding->mblen_table != NULL) { + mbtab = encoding->mblen_table; + start = 0; + end = 0; + n = 0; + k = 0; + p = string->val; + if (p != NULL) { + /* search start position */ + while (k <= from) { + start = n; + if (n >= len) { + break; + } + m = mbtab[*p]; + n += m; + p += m; + k++; + } + /* detect end position */ + k = 0; + end = start; + while (k < length) { + end = n; + if (n >= len) { + break; + } + m = mbtab[*p]; + n += m; + p += m; + k++; + } + } + } + + if (start > len) { + start = len; + } + if (start < 0) { + start = 0; + } + if (end > len) { + end = len; + } + if (end < 0) { + end = 0; + } + if (start > end) { + start = end; + } + + /* allocate memory and copy */ + n = end - start; + result->len = 0; + result->val = w = (unsigned char*)mbfl_malloc((n + 8)*sizeof(unsigned char)); + if (w != NULL) { + p = string->val; + if (p != NULL) { + p += start; + result->len = n; + while (n > 0) { + *w++ = *p++; + n--; + } + } + *w++ = '\0'; + *w++ = '\0'; + *w++ = '\0'; + *w = '\0'; + } else { + result = NULL; + } + } else { + mbfl_memory_device device; + struct collector_substr_data pc; + mbfl_convert_filter *decoder; + mbfl_convert_filter *encoder; + + mbfl_memory_device_init(&device, length + 1, 0); + mbfl_string_init(result); + result->no_language = string->no_language; + result->no_encoding = string->no_encoding; + /* output code filter */ + decoder = mbfl_convert_filter_new( + mbfl_no_encoding_wchar, + string->no_encoding, + mbfl_memory_device_output, 0, &device); + /* wchar filter */ + encoder = mbfl_convert_filter_new( + string->no_encoding, + mbfl_no_encoding_wchar, + collector_substr, 0, &pc); + if (decoder == NULL || encoder == NULL) { + mbfl_convert_filter_delete(encoder); + mbfl_convert_filter_delete(decoder); + return NULL; + } + pc.next_filter = decoder; + pc.start = from; + pc.stop = from + length; + pc.output = 0; + + /* feed data */ + p = string->val; + n = string->len; + if (p != NULL) { + while (n > 0) { + if ((*encoder->filter_function)(*p++, encoder) < 0) { + break; + } + n--; + } + } + + mbfl_convert_filter_flush(encoder); + mbfl_convert_filter_flush(decoder); + result = mbfl_memory_device_result(&device, result); + mbfl_convert_filter_delete(encoder); + mbfl_convert_filter_delete(decoder); + } + + return result; +} + + +/* + * strcut + */ +mbfl_string * +mbfl_strcut( + mbfl_string *string, + mbfl_string *result, + int from, + int length) +{ + const mbfl_encoding *encoding; + int n, m, k, len, start, end; + unsigned char *p, *w; + const unsigned char *mbtab; + mbfl_memory_device device; + mbfl_convert_filter *encoder, *encoder_tmp, *decoder, *decoder_tmp; + + encoding = mbfl_no2encoding(string->no_encoding); + if (encoding == NULL || string == NULL || result == NULL) { + return NULL; + } + mbfl_string_init(result); + result->no_language = string->no_language; + result->no_encoding = string->no_encoding; + + if ((encoding->flag & (MBFL_ENCTYPE_SBCS | MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE | MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) || + encoding->mblen_table != NULL) { + len = string->len; + start = from; + end = from + length; + if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) { + start /= 2; + start *= 2; + end = length/2; + end *= 2; + end += start; + } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) { + start /= 4; + start *= 4; + end = length/4; + end *= 4; + end += start; + } else if (encoding->mblen_table != NULL) { + mbtab = encoding->mblen_table; + start = 0; + end = 0; + n = 0; + p = string->val; + if (p != NULL) { + /* search start position */ + for (;;) { + m = mbtab[*p]; + n += m; + p += m; + if (n > from) { + break; + } + start = n; + } + /* search end position */ + k = start + length; + if (k >= (int)string->len) { + end = string->len; + } else { + end = start; + while (n <= k) { + end = n; + m = mbtab[*p]; + n += m; + p += m; + } + } + } + } + + if (start > len) { + start = len; + } + if (start < 0) { + start = 0; + } + if (end > len) { + end = len; + } + if (end < 0) { + end = 0; + } + if (start > end) { + start = end; + } + /* allocate memory and copy string */ + n = end - start; + result->len = 0; + result->val = w = (unsigned char*)mbfl_malloc((n + 8)*sizeof(unsigned char)); + if (w != NULL) { + result->len = n; + p = &(string->val[start]); + while (n > 0) { + *w++ = *p++; + n--; + } + *w++ = '\0'; + *w++ = '\0'; + *w++ = '\0'; + *w = '\0'; + } else { + result = NULL; + } + } else { + /* wchar filter */ + encoder = mbfl_convert_filter_new( + string->no_encoding, + mbfl_no_encoding_wchar, + mbfl_filter_output_null, 0, 0); + encoder_tmp = mbfl_convert_filter_new( + string->no_encoding, + mbfl_no_encoding_wchar, + mbfl_filter_output_null, 0, 0); + /* output code filter */ + decoder = mbfl_convert_filter_new( + mbfl_no_encoding_wchar, + string->no_encoding, + mbfl_memory_device_output, 0, &device); + decoder_tmp = mbfl_convert_filter_new( + mbfl_no_encoding_wchar, + string->no_encoding, + mbfl_memory_device_output, 0, &device); + if (encoder == NULL || encoder_tmp == NULL || decoder == NULL || decoder_tmp == NULL) { + mbfl_convert_filter_delete(encoder); + mbfl_convert_filter_delete(encoder_tmp); + mbfl_convert_filter_delete(decoder); + mbfl_convert_filter_delete(decoder_tmp); + return NULL; + } + mbfl_memory_device_init(&device, length + 8, 0); + k = 0; + n = 0; + p = string->val; + if (p != NULL) { + /* seartch start position */ + while (n < from) { + (*encoder->filter_function)(*p++, encoder); + n++; + } + /* output a little shorter than "length" */ + encoder->output_function = mbfl_filter_output_pipe; + encoder->data = decoder; + k = length - 20; + len = string->len; + while (n < len && device.pos < k) { + (*encoder->filter_function)(*p++, encoder); + n++; + } + /* detect end position */ + for (;;) { + /* backup current state */ + k = device.pos; + mbfl_convert_filter_copy(encoder, encoder_tmp); + mbfl_convert_filter_copy(decoder, decoder_tmp); + if (n >= len) { + break; + } + /* feed 1byte and flush */ + (*encoder->filter_function)(*p, encoder); + (*encoder->filter_flush)(encoder); + (*decoder->filter_flush)(decoder); + if (device.pos > length) { + break; + } + /* restore filter and re-feed data */ + device.pos = k; + mbfl_convert_filter_copy(encoder_tmp, encoder); + mbfl_convert_filter_copy(decoder_tmp, decoder); + (*encoder->filter_function)(*p, encoder); + p++; + n++; + } + device.pos = k; + mbfl_convert_filter_copy(encoder_tmp, encoder); + mbfl_convert_filter_copy(decoder_tmp, decoder); + mbfl_convert_filter_flush(encoder); + mbfl_convert_filter_flush(decoder); + } + result = mbfl_memory_device_result(&device, result); + mbfl_convert_filter_delete(encoder); + mbfl_convert_filter_delete(encoder_tmp); + mbfl_convert_filter_delete(decoder); + mbfl_convert_filter_delete(decoder_tmp); + } + + return result; +} + + +/* + * strwidth + */ +static int +filter_count_width(int c, void* data) +{ + if (c >= 0x20) { + if (c < 0x2000 || (c > 0xff60 && c < 0xffa0)) { + (*(int *)data)++; + } else { + (*(int *)data) += 2; + } + } + + return c; +} + +int +mbfl_strwidth(mbfl_string *string) +{ + int len, n; + unsigned char *p; + mbfl_convert_filter *filter; + + len = 0; + if (string->len > 0 && string->val != NULL) { + /* wchar filter */ + filter = mbfl_convert_filter_new( + string->no_encoding, + mbfl_no_encoding_wchar, + filter_count_width, 0, &len); + if (filter == NULL) { + mbfl_convert_filter_delete(filter); + return -1; + } + + /* feed data */ + p = string->val; + n = string->len; + while (n > 0) { + (*filter->filter_function)(*p++, filter); + n--; + } + + mbfl_convert_filter_flush(filter); + mbfl_convert_filter_delete(filter); + } + + return len; +} + + +/* + * strimwidth + */ +struct collector_strimwidth_data { + mbfl_convert_filter *decoder; + mbfl_convert_filter *decoder_backup; + mbfl_memory_device device; + int from; + int width; + int outwidth; + int outchar; + int status; + int endpos; +}; + +static int +collector_strimwidth(int c, void* data) +{ + struct collector_strimwidth_data *pc = (struct collector_strimwidth_data*)data; + + switch (pc->status) { + case 10: + (*pc->decoder->filter_function)(c, pc->decoder); + break; + default: + if (pc->outchar >= pc->from) { + if (c >= 0x20) { + if (c < 0x2000 || (c > 0xff60 && c < 0xffa0)) { + pc->outwidth++; + } else { + pc->outwidth += 2; + } + } + if (pc->outwidth > pc->width) { + if (pc->status == 0) { + pc->endpos = pc->device.pos; + mbfl_convert_filter_copy(pc->decoder, pc->decoder_backup); + } + pc->status++; + (*pc->decoder->filter_function)(c, pc->decoder); + c = -1; + } else { + (*pc->decoder->filter_function)(c, pc->decoder); + } + } + pc->outchar++; + break; + } + + return c; +} + +mbfl_string * +mbfl_strimwidth( + mbfl_string *string, + mbfl_string *marker, + mbfl_string *result, + int from, + int width) +{ + struct collector_strimwidth_data pc; + mbfl_convert_filter *encoder; + int n, mkwidth; + unsigned char *p; + + if (string == NULL || result == NULL) { + return NULL; + } + mbfl_string_init(result); + result->no_language = string->no_language; + result->no_encoding = string->no_encoding; + mbfl_memory_device_init(&pc.device, width, 0); + + /* output code filter */ + pc.decoder = mbfl_convert_filter_new( + mbfl_no_encoding_wchar, + string->no_encoding, + mbfl_memory_device_output, 0, &pc.device); + pc.decoder_backup = mbfl_convert_filter_new( + mbfl_no_encoding_wchar, + string->no_encoding, + mbfl_memory_device_output, 0, &pc.device); + /* wchar filter */ + encoder = mbfl_convert_filter_new( + string->no_encoding, + mbfl_no_encoding_wchar, + collector_strimwidth, 0, &pc); + if (pc.decoder == NULL || pc.decoder_backup == NULL || encoder == NULL) { + mbfl_convert_filter_delete(encoder); + mbfl_convert_filter_delete(pc.decoder); + mbfl_convert_filter_delete(pc.decoder_backup); + return NULL; + } + mkwidth = 0; + if (marker) { + mkwidth = mbfl_strwidth(marker); + } + pc.from = from; + pc.width = width - mkwidth; + pc.outwidth = 0; + pc.outchar = 0; + pc.status = 0; + pc.endpos = 0; + + /* feed data */ + p = string->val; + n = string->len; + if (p != NULL) { + while (n > 0) { + n--; + if ((*encoder->filter_function)(*p++, encoder) < 0) { + break; + } + } + mbfl_convert_filter_flush(encoder); + if (pc.status != 0 && mkwidth > 0) { + pc.width += mkwidth; + while (n > 0) { + if ((*encoder->filter_function)(*p++, encoder) < 0) { + break; + } + n--; + } + mbfl_convert_filter_flush(encoder); + if (pc.status != 1) { + pc.status = 10; + pc.device.pos = pc.endpos; + mbfl_convert_filter_copy(pc.decoder_backup, pc.decoder); + mbfl_convert_filter_reset(encoder, marker->no_encoding, mbfl_no_encoding_wchar); + p = marker->val; + n = marker->len; + while (n > 0) { + if ((*encoder->filter_function)(*p++, encoder) < 0) { + break; + } + n--; + } + mbfl_convert_filter_flush(encoder); + } + } else if (pc.status != 0) { + pc.device.pos = pc.endpos; + mbfl_convert_filter_copy(pc.decoder_backup, pc.decoder); + } + mbfl_convert_filter_flush(pc.decoder); + } + result = mbfl_memory_device_result(&pc.device, result); + mbfl_convert_filter_delete(encoder); + mbfl_convert_filter_delete(pc.decoder); + mbfl_convert_filter_delete(pc.decoder_backup); + + return result; +} + + + +/* + * convert Hankaku and Zenkaku + */ +struct collector_hantozen_data { + mbfl_convert_filter *next_filter; + int mode; + int status; + int cache; +}; + +static const unsigned char hankana2zenkata_table[64] = { + 0x00,0x02,0x0C,0x0D,0x01,0xFB,0xF2,0xA1,0xA3,0xA5, + 0xA7,0xA9,0xE3,0xE5,0xE7,0xC3,0xFC,0xA2,0xA4,0xA6, + 0xA8,0xAA,0xAB,0xAD,0xAF,0xB1,0xB3,0xB5,0xB7,0xB9, + 0xBB,0xBD,0xBF,0xC1,0xC4,0xC6,0xC8,0xCA,0xCB,0xCC, + 0xCD,0xCE,0xCF,0xD2,0xD5,0xD8,0xDB,0xDE,0xDF,0xE0, + 0xE1,0xE2,0xE4,0xE6,0xE8,0xE9,0xEA,0xEB,0xEC,0xED, + 0xEF,0xF3,0x9B,0x9C +}; +static const unsigned char hankana2zenhira_table[64] = { + 0x00,0x02,0x0C,0x0D,0x01,0xFB,0x92,0x41,0x43,0x45, + 0x47,0x49,0x83,0x85,0x87,0x63,0xFC,0x42,0x44,0x46, + 0x48,0x4A,0x4B,0x4D,0x4F,0x51,0x53,0x55,0x57,0x59, + 0x5B,0x5D,0x5F,0x61,0x64,0x66,0x68,0x6A,0x6B,0x6C, + 0x6D,0x6E,0x6F,0x72,0x75,0x78,0x7B,0x7E,0x7F,0x80, + 0x81,0x82,0x84,0x86,0x88,0x89,0x8A,0x8B,0x8C,0x8D, + 0x8F,0x93,0x9B,0x9C +}; +static const unsigned char zenkana2hankana_table[84][2] = { + {0x67,0x00},{0x71,0x00},{0x68,0x00},{0x72,0x00},{0x69,0x00}, + {0x73,0x00},{0x6A,0x00},{0x74,0x00},{0x6B,0x00},{0x75,0x00}, + {0x76,0x00},{0x76,0x9E},{0x77,0x00},{0x77,0x9E},{0x78,0x00}, + {0x78,0x9E},{0x79,0x00},{0x79,0x9E},{0x7A,0x00},{0x7A,0x9E}, + {0x7B,0x00},{0x7B,0x9E},{0x7C,0x00},{0x7C,0x9E},{0x7D,0x00}, + {0x7D,0x9E},{0x7E,0x00},{0x7E,0x9E},{0x7F,0x00},{0x7F,0x9E}, + {0x80,0x00},{0x80,0x9E},{0x81,0x00},{0x81,0x9E},{0x6F,0x00}, + {0x82,0x00},{0x82,0x9E},{0x83,0x00},{0x83,0x9E},{0x84,0x00}, + {0x84,0x9E},{0x85,0x00},{0x86,0x00},{0x87,0x00},{0x88,0x00}, + {0x89,0x00},{0x8A,0x00},{0x8A,0x9E},{0x8A,0x9F},{0x8B,0x00}, + {0x8B,0x9E},{0x8B,0x9F},{0x8C,0x00},{0x8C,0x9E},{0x8C,0x9F}, + {0x8D,0x00},{0x8D,0x9E},{0x8D,0x9F},{0x8E,0x00},{0x8E,0x9E}, + {0x8E,0x9F},{0x8F,0x00},{0x90,0x00},{0x91,0x00},{0x92,0x00}, + {0x93,0x00},{0x6C,0x00},{0x94,0x00},{0x6D,0x00},{0x95,0x00}, + {0x6E,0x00},{0x96,0x00},{0x97,0x00},{0x98,0x00},{0x99,0x00}, + {0x9A,0x00},{0x9B,0x00},{0x9C,0x00},{0x9C,0x00},{0x72,0x00}, + {0x74,0x00},{0x66,0x00},{0x9D,0x00},{0x73,0x9E} +}; + +static int +collector_hantozen(int c, void* data) +{ + int s, mode, n; + struct collector_hantozen_data *pc = (struct collector_hantozen_data*)data; + + s = c; + mode = pc->mode; + + if (mode & 0xf) { /* hankaku to zenkaku */ + if ((mode & 0x1) && c >= 0x21 && c <= 0x7d && c != 0x22 && c != 0x27 && c != 0x5c) { /* all except <"> <'> <\> <~> */ + s = c + 0xfee0; + } else if ((mode & 0x2) && ((c >= 0x41 && c <= 0x5a) || (c >= 0x61 && c <= 0x7a))) { /* alpha */ + s = c + 0xfee0; + } else if ((mode & 0x4) && c >= 0x30 && c <= 0x39) { /* num */ + s = c + 0xfee0; + } else if ((mode & 0x8) && c == 0x20) { /* spase */ + s = 0x3000; + } + } + + if (mode & 0xf0) { /* zenkaku to hankaku */ + if ((mode & 0x10) && c >= 0xff01 && c <= 0xff5d && c != 0xff02 && c != 0xff07 && c!= 0xff3c) { /* all except <"> <'> <\> <~> */ + s = c - 0xfee0; + } else if ((mode & 0x20) && ((c >= 0xff21 && c <= 0xff3a) || (c >= 0xff41 && c <= 0xff5a))) { /* alpha */ + s = c - 0xfee0; + } else if ((mode & 0x40) && (c >= 0xff10 && c <= 0xff19)) { /* num */ + s = c - 0xfee0; + } else if ((mode & 0x80) && (c == 0x3000)) { /* spase */ + s = 0x20; + } else if ((mode & 0x10) && (c == 0x2212)) { /* MINUS SIGN */ + s = 0x2d; + } + } + + if (mode & 0x300) { /* hankaku kana to zenkaku kana */ + if ((mode & 0x100) && (mode & 0x800)) { /* hankaku kana to zenkaku katakana and glue voiced sound mark */ + if (c >= 0xff61 && c <= 0xff9f) { + if (pc->status) { + n = (pc->cache - 0xff60) & 0x3f; + if (c == 0xff9e && ((n >= 22 && n <= 36) || (n >= 42 && n <= 46))) { + pc->status = 0; + s = 0x3001 + hankana2zenkata_table[n]; + } else if (c == 0xff9e && n == 19) { + pc->status = 0; + s = 0x30f4; + } else if (c == 0xff9f && (n >= 42 && n <= 46)) { + pc->status = 0; + s = 0x3002 + hankana2zenkata_table[n]; + } else { + pc->status = 1; + pc->cache = c; + s = 0x3000 + hankana2zenkata_table[n]; + } + } else { + pc->status = 1; + pc->cache = c; + return c; + } + } else { + if (pc->status) { + n = (pc->cache - 0xff60) & 0x3f; + pc->status = 0; + (*pc->next_filter->filter_function)(0x3000 + hankana2zenkata_table[n], pc->next_filter); + } + } + } else if ((mode & 0x200) && (mode & 0x800)) { /* hankaku kana to zenkaku hirangana and glue voiced sound mark */ + if (c >= 0xff61 && c <= 0xff9f) { + if (pc->status) { + n = (pc->cache - 0xff60) & 0x3f; + if (c == 0xff9e && ((n >= 22 && n <= 36) || (n >= 42 && n <= 46))) { + pc->status = 0; + s = 0x3001 + hankana2zenhira_table[n]; + } else if (c == 0xff9f && (n >= 42 && n <= 46)) { + pc->status = 0; + s = 0x3002 + hankana2zenhira_table[n]; + } else { + pc->status = 1; + pc->cache = c; + s = 0x3000 + hankana2zenhira_table[n]; + } + } else { + pc->status = 1; + pc->cache = c; + return c; + } + } else { + if (pc->status) { + n = (pc->cache - 0xff60) & 0x3f; + pc->status = 0; + (*pc->next_filter->filter_function)(0x3000 + hankana2zenhira_table[n], pc->next_filter); + } + } + } else if ((mode & 0x100) && c >= 0xff61 && c <= 0xff9f) { /* hankaku kana to zenkaku katakana */ + s = 0x3000 + hankana2zenkata_table[c - 0xff60]; + } else if ((mode & 0x200) && c >= 0xff61 && c <= 0xff9f) { /* hankaku kana to zenkaku hirangana */ + s = 0x3000 + hankana2zenhira_table[c - 0xff60]; + } + } + + if (mode & 0x3000) { /* Zenkaku kana to hankaku kana */ + if ((mode & 0x1000) && c >= 0x30a1 && c <= 0x30f4) { /* Zenkaku katakana to hankaku kana */ + n = c - 0x30a1; + if (zenkana2hankana_table[n][1] != 0) { + (*pc->next_filter->filter_function)(0xff00 + zenkana2hankana_table[n][0], pc->next_filter); + s = 0xff00 + zenkana2hankana_table[n][1]; + } else { + s = 0xff00 + zenkana2hankana_table[n][0]; + } + } else if ((mode & 0x2000) && c >= 0x3041 && c <= 0x3093) { /* Zenkaku hirangana to hankaku kana */ + n = c - 0x3041; + if (zenkana2hankana_table[n][1] != 0) { + (*pc->next_filter->filter_function)(0xff00 + zenkana2hankana_table[n][0], pc->next_filter); + s = 0xff00 + zenkana2hankana_table[n][1]; + } else { + s = 0xff00 + zenkana2hankana_table[n][0]; + } + } else if (c == 0x3001) { + s = 0xff64; /* HALFWIDTH IDEOGRAPHIC COMMA */ + } else if (c == 0x3002) { + s = 0xff61; /* HALFWIDTH IDEOGRAPHIC FULL STOP */ + } else if (c == 0x300c) { + s = 0xff62; /* HALFWIDTH LEFT CORNER BRACKET */ + } else if (c == 0x300d) { + s = 0xff63; /* HALFWIDTH RIGHT CORNER BRACKET */ + } else if (c == 0x309b) { + s = 0xff9e; /* HALFWIDTH KATAKANA VOICED SOUND MARK */ + } else if (c == 0x309c) { + s = 0xff9f; /* HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK */ + } else if (c == 0x30fc) { + s = 0xff70; /* HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK */ + } else if (c == 0x30fb) { + s = 0xff65; /* HALFWIDTH KATAKANA MIDDLE DOT */ + } + } else if (mode & 0x30000) { + if ((mode & 0x10000) && c >= 0x3041 && c <= 0x3093) { /* Zenkaku hirangana to Zenkaku katakana */ + s = c + 0x60; + } else if ((mode & 0x20000) && c >= 0x30a1 && c <= 0x30f3) { /* Zenkaku katakana to Zenkaku hirangana */ + s = c - 0x60; + } + } + + if (mode & 0x100000) { /* special ascii to symbol */ + if (c == 0x5c) { + s = 0xffe5; /* FULLWIDTH YEN SIGN */ + } else if (c == 0xa5) { /* YEN SIGN */ + s = 0xffe5; /* FULLWIDTH YEN SIGN */ + } else if (c == 0x7e) { + s = 0xffe3; /* FULLWIDTH MACRON */ + } else if (c == 0x203e) { /* OVERLINE */ + s = 0xffe3; /* FULLWIDTH MACRON */ + } else if (c == 0x27) { + s = 0x2019; /* RIGHT SINGLE QUOTATION MARK */ + } else if (c == 0x22) { + s = 0x201d; /* RIGHT DOUBLE QUOTATION MARK */ + } + } else if (mode & 0x200000) { /* special symbol to ascii */ + if (c == 0xffe5) { /* FULLWIDTH YEN SIGN */ + s = 0x5c; + } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */ + s = 0x5c; + } else if (c == 0xffe3) { /* FULLWIDTH MACRON */ + s = 0x7e; + } else if (c == 0x203e) { /* OVERLINE */ + s = 0x7e; + } else if (c == 0x2018) { /* LEFT SINGLE QUOTATION MARK*/ + s = 0x27; + } else if (c == 0x2019) { /* RIGHT SINGLE QUOTATION MARK */ + s = 0x27; + } else if (c == 0x201c) { /* LEFT DOUBLE QUOTATION MARK */ + s = 0x22; + } else if (c == 0x201d) { /* RIGHT DOUBLE QUOTATION MARK */ + s = 0x22; + } + } + + if (mode & 0x400000) { /* special ascii to symbol */ + if (c == 0x5c) { + s = 0xff3c; /* FULLWIDTH REVERSE SOLIDUS */ + } else if (c == 0x7e) { + s = 0xff5e; /* FULLWIDTH TILDE */ + } else if (c == 0x27) { + s = 0xff07; /* FULLWIDTH APOSTROPHE */ + } else if (c == 0x22) { + s = 0xff02; /* FULLWIDTH QUOTATION MARK */ + } + } else if (mode & 0x800000) { /* special symbol to ascii */ + if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */ + s = 0x5c; + } else if (c == 0xff5e) { /* FULLWIDTH TILDE */ + s = 0x7e; + } else if (c == 0xff07) { /* FULLWIDTH APOSTROPHE */ + s = 0x27; + } else if (c == 0xff02) { /* FULLWIDTH QUOTATION MARK */ + s = 0x22; + } + } + + return (*pc->next_filter->filter_function)(s, pc->next_filter); +} + +static int +collector_hantozen_flush(struct collector_hantozen_data *pc) +{ + int ret, n; + + ret = 0; + if (pc->status) { + n = (pc->cache - 0xff60) & 0x3f; + if (pc->mode & 0x100) { /* hankaku kana to zenkaku katakana */ + ret = (*pc->next_filter->filter_function)(0x3000 + hankana2zenkata_table[n], pc->next_filter); + } else if (pc->mode & 0x200) { /* hankaku kana to zenkaku hirangana */ + ret = (*pc->next_filter->filter_function)(0x3000 + hankana2zenhira_table[n], pc->next_filter); + } + pc->status = 0; + } + + return ret; +} + +mbfl_string * +mbfl_ja_jp_hantozen( + mbfl_string *string, + mbfl_string *result, + int mode) +{ + int n; + unsigned char *p; + const mbfl_encoding *encoding; + mbfl_memory_device device; + struct collector_hantozen_data pc; + mbfl_convert_filter *decoder; + mbfl_convert_filter *encoder; + + /* initialize */ + if (string == NULL || result == NULL) { + return NULL; + } + encoding = mbfl_no2encoding(string->no_encoding); + if (encoding == NULL) { + return NULL; + } + mbfl_memory_device_init(&device, string->len, 0); + mbfl_string_init(result); + result->no_language = string->no_language; + result->no_encoding = string->no_encoding; + decoder = mbfl_convert_filter_new( + mbfl_no_encoding_wchar, + string->no_encoding, + mbfl_memory_device_output, 0, &device); + encoder = mbfl_convert_filter_new( + string->no_encoding, + mbfl_no_encoding_wchar, + collector_hantozen, 0, &pc); + if (decoder == NULL || encoder == NULL) { + mbfl_convert_filter_delete(encoder); + mbfl_convert_filter_delete(decoder); + return NULL; + } + pc.next_filter = decoder; + pc.mode = mode; + pc.status = 0; + pc.cache = 0; + + /* feed data */ + p = string->val; + n = string->len; + if (p != NULL) { + while (n > 0) { + if ((*encoder->filter_function)(*p++, encoder) < 0) { + break; + } + n--; + } + } + + mbfl_convert_filter_flush(encoder); + collector_hantozen_flush(&pc); + mbfl_convert_filter_flush(decoder); + result = mbfl_memory_device_result(&device, result); + mbfl_convert_filter_delete(encoder); + mbfl_convert_filter_delete(decoder); + + return result; +} + + +/* + * MIME header encode + */ +struct mime_header_encoder_data { + mbfl_convert_filter *conv1_filter; + mbfl_convert_filter *block_filter; + mbfl_convert_filter *conv2_filter; + mbfl_convert_filter *conv2_filter_backup; + mbfl_convert_filter *encod_filter; + mbfl_convert_filter *encod_filter_backup; + mbfl_memory_device outdev; + mbfl_memory_device tmpdev; + int status1; + int status2; + int prevpos; + int linehead; + int firstindent; + int encnamelen; + int lwsplen; + char encname[128]; + char lwsp[16]; +}; + +static int +mime_header_encoder_block_collector(int c, void *data) +{ + int n; + struct mime_header_encoder_data *pe = (struct mime_header_encoder_data *)data; + + switch (pe->status2) { + case 1: /* encoded word */ + pe->prevpos = pe->outdev.pos; + mbfl_convert_filter_copy(pe->conv2_filter, pe->conv2_filter_backup); + mbfl_convert_filter_copy(pe->encod_filter, pe->encod_filter_backup); + (*pe->conv2_filter->filter_function)(c, pe->conv2_filter); + (*pe->conv2_filter->filter_flush)(pe->conv2_filter); + (*pe->encod_filter->filter_flush)(pe->encod_filter); + n = pe->outdev.pos - pe->linehead + pe->firstindent; + pe->outdev.pos = pe->prevpos; + mbfl_convert_filter_copy(pe->conv2_filter_backup, pe->conv2_filter); + mbfl_convert_filter_copy(pe->encod_filter_backup, pe->encod_filter); + if (n >= 74) { + (*pe->conv2_filter->filter_flush)(pe->conv2_filter); + (*pe->encod_filter->filter_flush)(pe->encod_filter); + mbfl_memory_device_strncat(&pe->outdev, "\x3f\x3d", 2); /* ?= */ + mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen); + pe->linehead = pe->outdev.pos; + pe->firstindent = 0; + mbfl_memory_device_strncat(&pe->outdev, pe->encname, pe->encnamelen); + c = (*pe->conv2_filter->filter_function)(c, pe->conv2_filter); + } else { + c = (*pe->conv2_filter->filter_function)(c, pe->conv2_filter); + } + break; + + default: + mbfl_memory_device_strncat(&pe->outdev, pe->encname, pe->encnamelen); + c = (*pe->conv2_filter->filter_function)(c, pe->conv2_filter); + pe->status2 = 1; + break; + } + + return c; +} + +static int +mime_header_encoder_collector(int c, void *data) +{ + int n; + struct mime_header_encoder_data *pe = (struct mime_header_encoder_data *)data; + + switch (pe->status1) { + case 11: /* encoded word */ + (*pe->block_filter->filter_function)(c, pe->block_filter); + break; + + default: /* ASCII */ + if (c >= 0x21 && c < 0x7f) { /* ASCII exclude SPACE and CTLs */ + mbfl_memory_device_output(c, &pe->tmpdev); + pe->status1 = 1; + } else if (pe->status1 == 0 && c == 0x20) { /* repeat SPACE */ + mbfl_memory_device_output(c, &pe->tmpdev); + } else { + if (pe->tmpdev.pos < 74 && c == 0x20) { + n = pe->outdev.pos - pe->linehead + pe->tmpdev.pos + pe->firstindent; + if (n > 74) { + mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen); /* LWSP */ + pe->linehead = pe->outdev.pos; + pe->firstindent = 0; + } else if (pe->outdev.pos > 0) { + mbfl_memory_device_output(0x20, &pe->outdev); + } + mbfl_memory_device_devcat(&pe->outdev, &pe->tmpdev); + mbfl_memory_device_reset(&pe->tmpdev); + pe->status1 = 0; + } else { + n = pe->outdev.pos - pe->linehead + pe->encnamelen + pe->firstindent; + if (n > 60) { + mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen); /* LWSP */ + pe->linehead = pe->outdev.pos; + pe->firstindent = 0; + } else if (pe->outdev.pos > 0) { + mbfl_memory_device_output(0x20, &pe->outdev); + } + mbfl_convert_filter_devcat(pe->block_filter, &pe->tmpdev); + mbfl_memory_device_reset(&pe->tmpdev); + (*pe->block_filter->filter_function)(c, pe->block_filter); + pe->status1 = 11; + } + } + break; + } + + return c; +} + +mbfl_string * +mime_header_encoder_result(struct mime_header_encoder_data *pe, mbfl_string *result) +{ + if (pe->status1 >= 10) { + (*pe->conv2_filter->filter_flush)(pe->conv2_filter); + (*pe->encod_filter->filter_flush)(pe->encod_filter); + mbfl_memory_device_strncat(&pe->outdev, "\x3f\x3d", 2); /* ?= */ + } else if (pe->tmpdev.pos > 0) { + if (pe->outdev.pos > 0) { + if ((pe->outdev.pos - pe->linehead + pe->tmpdev.pos) > 74) { + mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen); + } else { + mbfl_memory_device_output(0x20, &pe->outdev); + } + } + mbfl_memory_device_devcat(&pe->outdev, &pe->tmpdev); + } + mbfl_memory_device_reset(&pe->tmpdev); + pe->prevpos = 0; + pe->linehead = 0; + pe->status1 = 0; + pe->status2 = 0; + + return mbfl_memory_device_result(&pe->outdev, result); +} + +struct mime_header_encoder_data* +mime_header_encoder_new( + enum mbfl_no_encoding incode, + enum mbfl_no_encoding outcode, + enum mbfl_no_encoding transenc) +{ + int n; + const char *s; + const mbfl_encoding *outencoding; + struct mime_header_encoder_data *pe; + + /* get output encoding and check MIME charset name */ + outencoding = mbfl_no2encoding(outcode); + if (outencoding == NULL || outencoding->mime_name == NULL || outencoding->mime_name[0] == '\0') { + return NULL; + } + + pe = (struct mime_header_encoder_data*)mbfl_malloc(sizeof(struct mime_header_encoder_data)); + if (pe == NULL) { + return NULL; + } + + mbfl_memory_device_init(&pe->outdev, 0, 0); + mbfl_memory_device_init(&pe->tmpdev, 0, 0); + pe->prevpos = 0; + pe->linehead = 0; + pe->firstindent = 0; + pe->status1 = 0; + pe->status2 = 0; + + /* make the encoding description string exp. "=?ISO-2022-JP?B?" */ + n = 0; + pe->encname[n++] = 0x3d; + pe->encname[n++] = 0x3f; + s = outencoding->mime_name; + while (*s) { + pe->encname[n++] = *s++; + } + pe->encname[n++] = 0x3f; + if (transenc == mbfl_no_encoding_qprint) { + pe->encname[n++] = 0x51; + } else { + pe->encname[n++] = 0x42; + transenc = mbfl_no_encoding_base64; + } + pe->encname[n++] = 0x3f; + pe->encname[n] = '\0'; + pe->encnamelen = n; + + n = 0; + pe->lwsp[n++] = 0x0d; + pe->lwsp[n++] = 0x0a; + pe->lwsp[n++] = 0x20; + pe->lwsp[n] = '\0'; + pe->lwsplen = n; + + /* transfer encode filter */ + pe->encod_filter = mbfl_convert_filter_new(outcode, transenc, mbfl_memory_device_output, 0, &(pe->outdev)); + pe->encod_filter_backup = mbfl_convert_filter_new(outcode, transenc, mbfl_memory_device_output, 0, &(pe->outdev)); + + /* Output code filter */ + pe->conv2_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, outcode, mbfl_filter_output_pipe, 0, pe->encod_filter); + pe->conv2_filter_backup = mbfl_convert_filter_new(mbfl_no_encoding_wchar, outcode, mbfl_filter_output_pipe, 0, pe->encod_filter); + + /* encoded block filter */ + pe->block_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, mbfl_no_encoding_wchar, mime_header_encoder_block_collector, 0, pe); + + /* Input code filter */ + pe->conv1_filter = mbfl_convert_filter_new(incode, mbfl_no_encoding_wchar, mime_header_encoder_collector, 0, pe); + + if (pe->encod_filter == NULL || + pe->encod_filter_backup == NULL || + pe->conv2_filter == NULL || + pe->conv2_filter_backup == NULL || + pe->conv1_filter == NULL) { + mime_header_encoder_delete(pe); + return NULL; + } + + if (transenc == mbfl_no_encoding_qprint) { + pe->encod_filter->status |= MBFL_QPRINT_STS_MIME_HEADER; + pe->encod_filter_backup->status |= MBFL_QPRINT_STS_MIME_HEADER; + } else { + pe->encod_filter->status |= MBFL_BASE64_STS_MIME_HEADER; + pe->encod_filter_backup->status |= MBFL_BASE64_STS_MIME_HEADER; + } + + return pe; +} + +void +mime_header_encoder_delete(struct mime_header_encoder_data *pe) +{ + if (pe) { + mbfl_convert_filter_delete(pe->conv1_filter); + mbfl_convert_filter_delete(pe->block_filter); + mbfl_convert_filter_delete(pe->conv2_filter); + mbfl_convert_filter_delete(pe->conv2_filter_backup); + mbfl_convert_filter_delete(pe->encod_filter); + mbfl_convert_filter_delete(pe->encod_filter_backup); + mbfl_memory_device_clear(&pe->outdev); + mbfl_memory_device_clear(&pe->tmpdev); + mbfl_free((void*)pe); + } +} + +int +mime_header_encoder_feed(int c, struct mime_header_encoder_data *pe) +{ + return (*pe->conv1_filter->filter_function)(c, pe->conv1_filter); +} + +mbfl_string * +mbfl_mime_header_encode( + mbfl_string *string, + mbfl_string *result, + enum mbfl_no_encoding outcode, + enum mbfl_no_encoding encoding, + const char *linefeed, + int indent) +{ + int n; + unsigned char *p; + struct mime_header_encoder_data *pe; + + mbfl_string_init(result); + result->no_language = string->no_language; + result->no_encoding = mbfl_no_encoding_ascii; + + pe = mime_header_encoder_new(string->no_encoding, outcode, encoding); + if (pe == NULL) { + return NULL; + } + + if (linefeed != NULL) { + n = 0; + while (*linefeed && n < 8) { + pe->lwsp[n++] = *linefeed++; + } + pe->lwsp[n++] = 0x20; + pe->lwsp[n] = '\0'; + pe->lwsplen = n; + } + if (indent > 0 && indent < 74) { + pe->firstindent = indent; + } + + n = string->len; + p = string->val; + while (n > 0) { + (*pe->conv1_filter->filter_function)(*p++, pe->conv1_filter); + n--; + } + + result = mime_header_encoder_result(pe, result); + mime_header_encoder_delete(pe); + + return result; +} + + +/* + * MIME header decode + */ +struct mime_header_decoder_data { + mbfl_convert_filter *deco_filter; + mbfl_convert_filter *conv1_filter; + mbfl_convert_filter *conv2_filter; + mbfl_memory_device outdev; + mbfl_memory_device tmpdev; + int cspos; + int status; + enum mbfl_no_encoding encoding; + enum mbfl_no_encoding incode; + enum mbfl_no_encoding outcode; +}; + +static int +mime_header_decoder_collector(int c, void* data) +{ + const mbfl_encoding *encoding; + struct mime_header_decoder_data *pd = (struct mime_header_decoder_data*)data; + + switch (pd->status) { + case 1: + if (c == 0x3f) { /* ? */ + mbfl_memory_device_output(c, &pd->tmpdev); + pd->cspos = pd->tmpdev.pos; + pd->status = 2; + } else { + mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev); + mbfl_memory_device_reset(&pd->tmpdev); + if (c == 0x3d) { /* = */ + mbfl_memory_device_output(c, &pd->tmpdev); + } else if (c == 0x0d || c == 0x0a) { /* CR or LF */ + pd->status = 9; + } else { + (*pd->conv1_filter->filter_function)(c, pd->conv1_filter); + pd->status = 0; + } + } + break; + case 2: /* store charset string */ + if (c == 0x3f) { /* ? */ + /* identify charset */ + mbfl_memory_device_output('\0', &pd->tmpdev); + encoding = mbfl_name2encoding((const char *)&pd->tmpdev.buffer[pd->cspos]); + if (encoding != NULL) { + pd->incode = encoding->no_encoding; + pd->status = 3; + } + mbfl_memory_device_unput(&pd->tmpdev); + mbfl_memory_device_output(c, &pd->tmpdev); + } else { + mbfl_memory_device_output(c, &pd->tmpdev); + if (pd->tmpdev.pos > 100) { /* too long charset string */ + pd->status = 0; + } else if (c == 0x0d || c == 0x0a) { /* CR or LF */ + mbfl_memory_device_unput(&pd->tmpdev); + pd->status = 9; + } + if (pd->status != 2) { + mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev); + mbfl_memory_device_reset(&pd->tmpdev); + } + } + break; + case 3: /* identify encoding */ + mbfl_memory_device_output(c, &pd->tmpdev); + if (c == 0x42 || c == 0x62) { /* 'B' or 'b' */ + pd->encoding = mbfl_no_encoding_base64; + pd->status = 4; + } else if (c == 0x51 || c == 0x71) { /* 'Q' or 'q' */ + pd->encoding = mbfl_no_encoding_qprint; + pd->status = 4; + } else { + if (c == 0x0d || c == 0x0a) { /* CR or LF */ + mbfl_memory_device_unput(&pd->tmpdev); + pd->status = 9; + } else { + pd->status = 0; + } + mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev); + mbfl_memory_device_reset(&pd->tmpdev); + } + break; + case 4: /* reset filter */ + mbfl_memory_device_output(c, &pd->tmpdev); + if (c == 0x3f) { /* ? */ + /* charset convert filter */ + mbfl_convert_filter_reset(pd->conv1_filter, pd->incode, mbfl_no_encoding_wchar); + /* decode filter */ + mbfl_convert_filter_reset(pd->deco_filter, pd->encoding, mbfl_no_encoding_8bit); + pd->status = 5; + } else { + if (c == 0x0d || c == 0x0a) { /* CR or LF */ + mbfl_memory_device_unput(&pd->tmpdev); + pd->status = 9; + } else { + pd->status = 0; + } + mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev); + } + mbfl_memory_device_reset(&pd->tmpdev); + break; + case 5: /* encoded block */ + if (c == 0x3f) { /* ? */ + pd->status = 6; + } else { + (*pd->deco_filter->filter_function)(c, pd->deco_filter); + } + break; + case 6: /* check end position */ + if (c == 0x3d) { /* = */ + /* flush and reset filter */ + (*pd->deco_filter->filter_flush)(pd->deco_filter); + (*pd->conv1_filter->filter_flush)(pd->conv1_filter); + mbfl_convert_filter_reset(pd->conv1_filter, mbfl_no_encoding_ascii, mbfl_no_encoding_wchar); + pd->status = 7; + } else { + (*pd->deco_filter->filter_function)(0x3f, pd->deco_filter); + if (c != 0x3f) { /* ? */ + (*pd->deco_filter->filter_function)(c, pd->deco_filter); + pd->status = 5; + } + } + break; + case 7: /* after encoded block */ + if (c == 0x0d || c == 0x0a) { /* CR LF */ + pd->status = 8; + } else { + mbfl_memory_device_output(c, &pd->tmpdev); + if (c == 0x3d) { /* = */ + pd->status = 1; + } else if (c != 0x20 && c != 0x09) { /* not space */ + mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev); + mbfl_memory_device_reset(&pd->tmpdev); + pd->status = 0; + } + } + break; + case 8: /* folding */ + case 9: /* folding */ + if (c != 0x0d && c != 0x0a && c != 0x20 && c != 0x09) { + if (c == 0x3d) { /* = */ + if (pd->status == 8) { + mbfl_memory_device_output(0x20, &pd->tmpdev); /* SPACE */ + } else { + (*pd->conv1_filter->filter_function)(0x20, pd->conv1_filter); + } + mbfl_memory_device_output(c, &pd->tmpdev); + pd->status = 1; + } else { + mbfl_memory_device_output(0x20, &pd->tmpdev); + mbfl_memory_device_output(c, &pd->tmpdev); + mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev); + mbfl_memory_device_reset(&pd->tmpdev); + pd->status = 0; + } + } + break; + default: /* non encoded block */ + if (c == 0x0d || c == 0x0a) { /* CR LF */ + pd->status = 9; + } else if (c == 0x3d) { /* = */ + mbfl_memory_device_output(c, &pd->tmpdev); + pd->status = 1; + } else { + (*pd->conv1_filter->filter_function)(c, pd->conv1_filter); + } + break; + } + + return c; +} + +mbfl_string * +mime_header_decoder_result(struct mime_header_decoder_data *pd, mbfl_string *result) +{ + switch (pd->status) { + case 1: + case 2: + case 3: + case 4: + case 7: + case 8: + case 9: + mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev); + break; + case 5: + case 6: + (*pd->deco_filter->filter_flush)(pd->deco_filter); + (*pd->conv1_filter->filter_flush)(pd->conv1_filter); + break; + } + (*pd->conv2_filter->filter_flush)(pd->conv2_filter); + mbfl_memory_device_reset(&pd->tmpdev); + pd->status = 0; + + return mbfl_memory_device_result(&pd->outdev, result); +} + +struct mime_header_decoder_data* +mime_header_decoder_new(enum mbfl_no_encoding outcode) +{ + struct mime_header_decoder_data *pd; + + pd = (struct mime_header_decoder_data*)mbfl_malloc(sizeof(struct mime_header_decoder_data)); + if (pd == NULL) { + return NULL; + } + + mbfl_memory_device_init(&pd->outdev, 0, 0); + mbfl_memory_device_init(&pd->tmpdev, 0, 0); + pd->cspos = 0; + pd->status = 0; + pd->encoding = mbfl_no_encoding_pass; + pd->incode = mbfl_no_encoding_ascii; + pd->outcode = outcode; + /* charset convert filter */ + pd->conv2_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, pd->outcode, mbfl_memory_device_output, 0, &pd->outdev); + pd->conv1_filter = mbfl_convert_filter_new(pd->incode, mbfl_no_encoding_wchar, mbfl_filter_output_pipe, 0, pd->conv2_filter); + /* decode filter */ + pd->deco_filter = mbfl_convert_filter_new(pd->encoding, mbfl_no_encoding_8bit, mbfl_filter_output_pipe, 0, pd->conv1_filter); + + if (pd->conv1_filter == NULL || pd->conv2_filter == NULL || pd->deco_filter == NULL) { + mime_header_decoder_delete(pd); + return NULL; + } + + return pd; +} + +void +mime_header_decoder_delete(struct mime_header_decoder_data *pd) +{ + if (pd) { + mbfl_convert_filter_delete(pd->conv2_filter); + mbfl_convert_filter_delete(pd->conv1_filter); + mbfl_convert_filter_delete(pd->deco_filter); + mbfl_memory_device_clear(&pd->outdev); + mbfl_memory_device_clear(&pd->tmpdev); + mbfl_free((void*)pd); + } +} + +int +mime_header_decoder_feed(int c, struct mime_header_decoder_data *pd) +{ + return mime_header_decoder_collector(c, pd); +} + +mbfl_string * +mbfl_mime_header_decode( + mbfl_string *string, + mbfl_string *result, + enum mbfl_no_encoding outcode) +{ + int n; + unsigned char *p; + struct mime_header_decoder_data *pd; + + mbfl_string_init(result); + result->no_language = string->no_language; + result->no_encoding = outcode; + + pd = mime_header_decoder_new(outcode); + if (pd == NULL) { + return NULL; + } + + /* feed data */ + n = string->len; + p = string->val; + while (n > 0) { + mime_header_decoder_collector(*p++, pd); + n--; + } + + result = mime_header_decoder_result(pd, result); + mime_header_decoder_delete(pd); + + return result; +} + + + +/* + * convert HTML numeric entity + */ +struct collector_htmlnumericentity_data { + mbfl_convert_filter *decoder; + int status; + int cache; + int digit; + int *convmap; + int mapsize; +}; + +static int +collector_encode_htmlnumericentity(int c, void *data) +{ + struct collector_htmlnumericentity_data *pc = (struct collector_htmlnumericentity_data *)data; + int f, n, s, r, d, size, *mapelm; + + size = pc->mapsize; + f = 0; + n = 0; + while (n < size) { + mapelm = &(pc->convmap[n*4]); + if (c >= mapelm[0] && c <= mapelm[1]) { + s = (c + mapelm[2]) & mapelm[3]; + if (s >= 0) { + (*pc->decoder->filter_function)(0x26, pc->decoder); /* '&' */ + (*pc->decoder->filter_function)(0x23, pc->decoder); /* '#' */ + r = 100000000; + s %= r; + while (r > 0) { + d = s/r; + if (d || f) { + f = 1; + s %= r; + (*pc->decoder->filter_function)(mbfl_hexchar_table[d], pc->decoder); + } + r /= 10; + } + if (!f) { + f = 1; + (*pc->decoder->filter_function)(mbfl_hexchar_table[0], pc->decoder); + } + (*pc->decoder->filter_function)(0x3b, pc->decoder); /* ';' */ + } + } + if (f) { + break; + } + n++; + } + if (!f) { + (*pc->decoder->filter_function)(c, pc->decoder); + } + + return c; +} + +static int +collector_decode_htmlnumericentity(int c, void *data) +{ + struct collector_htmlnumericentity_data *pc = (struct collector_htmlnumericentity_data *)data; + int f, n, s, r, d, size, *mapelm; + + switch (pc->status) { + case 1: + if (c == 0x23) { /* '#' */ + pc->status = 2; + } else { + pc->status = 0; + (*pc->decoder->filter_function)(0x26, pc->decoder); /* '&' */ + (*pc->decoder->filter_function)(c, pc->decoder); + } + break; + case 2: + if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */ + pc->cache = c - 0x30; + pc->status = 3; + pc->digit = 1; + } else { + pc->status = 0; + (*pc->decoder->filter_function)(0x26, pc->decoder); /* '&' */ + (*pc->decoder->filter_function)(0x23, pc->decoder); /* '#' */ + (*pc->decoder->filter_function)(c, pc->decoder); + } + break; + case 3: + s = 0; + f = 0; + if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */ + if (pc->digit > 9) { + pc->status = 0; + s = pc->cache; + f = 1; + } else { + s = pc->cache*10 + c - 0x30; + pc->cache = s; + pc->digit++; + } + } else { + pc->status = 0; + s = pc->cache; + f = 1; + n = 0; + size = pc->mapsize; + while (n < size) { + mapelm = &(pc->convmap[n*4]); + d = s - mapelm[2]; + if (d >= mapelm[0] && d <= mapelm[1]) { + f = 0; + (*pc->decoder->filter_function)(d, pc->decoder); + if (c != 0x3b) { /* ';' */ + (*pc->decoder->filter_function)(c, pc->decoder); + } + break; + } + n++; + } + } + if (f) { + (*pc->decoder->filter_function)(0x26, pc->decoder); /* '&' */ + (*pc->decoder->filter_function)(0x23, pc->decoder); /* '#' */ + r = 1; + n = pc->digit; + while (n > 0) { + r *= 10; + n--; + } + s %= r; + r /= 10; + while (r > 0) { + d = s/r; + s %= r; + r /= 10; + (*pc->decoder->filter_function)(mbfl_hexchar_table[d], pc->decoder); + } + (*pc->decoder->filter_function)(c, pc->decoder); + } + break; + default: + if (c == 0x26) { /* '&' */ + pc->status = 1; + } else { + (*pc->decoder->filter_function)(c, pc->decoder); + } + break; + } + + return c; +} + +mbfl_string * +mbfl_html_numeric_entity( + mbfl_string *string, + mbfl_string *result, + int *convmap, + int mapsize, + int type) +{ + struct collector_htmlnumericentity_data pc; + mbfl_memory_device device; + mbfl_convert_filter *encoder; + int n; + unsigned char *p; + + if (string == NULL || result == NULL) { + return NULL; + } + mbfl_string_init(result); + result->no_language = string->no_language; + result->no_encoding = string->no_encoding; + mbfl_memory_device_init(&device, string->len, 0); + + /* output code filter */ + pc.decoder = mbfl_convert_filter_new( + mbfl_no_encoding_wchar, + string->no_encoding, + mbfl_memory_device_output, 0, &device); + /* wchar filter */ + if (type == 0) { + encoder = mbfl_convert_filter_new( + string->no_encoding, + mbfl_no_encoding_wchar, + collector_encode_htmlnumericentity, 0, &pc); + } else { + encoder = mbfl_convert_filter_new( + string->no_encoding, + mbfl_no_encoding_wchar, + collector_decode_htmlnumericentity, 0, &pc); + } + if (pc.decoder == NULL || encoder == NULL) { + mbfl_convert_filter_delete(encoder); + mbfl_convert_filter_delete(pc.decoder); + return NULL; + } + pc.status = 0; + pc.cache = 0; + pc.digit = 0; + pc.convmap = convmap; + pc.mapsize = mapsize; + + /* feed data */ + p = string->val; + n = string->len; + if (p != NULL) { + while (n > 0) { + if ((*encoder->filter_function)(*p++, encoder) < 0) { + break; + } + n--; + } + } + mbfl_convert_filter_flush(encoder); + mbfl_convert_filter_flush(pc.decoder); + result = mbfl_memory_device_result(&device, result); + mbfl_convert_filter_delete(encoder); + mbfl_convert_filter_delete(pc.decoder); + + return result; +} + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter.h b/ext/mbstring/libmbfl/mbfl/mbfilter.h new file mode 100644 index 0000000000..6dab193d6e --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfilter.h @@ -0,0 +1,297 @@ +/* charset=UTF-8 + * vim: encoding=utf-8: + * */ + +/* + * "streamable kanji code filter and converter" + * + * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved. + * + * This software is released under the GNU Lesser General Public License. + * (Version 2.1, February 1999) + * Please read the following detail of the licence (in japanese). + * + * ◆使用許諾æ¡ä»¶â—† + * + * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•れã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ + * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•トウェアã«é–¢ + * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ + * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•トウェアを使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利 + * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•トウェアを使用 + * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 + * + * ã“ã®ã‚½ãƒ•トウェアを「GNU Lesser General Public License (Version 2.1, February + * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser + * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢ + * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ + * + * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã + * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“れã¾ã§Library General + * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚ + * http://www.gnu.org/ --- GNUウェブサイト + * http://www.gnu.org/copyleft/lesser.html --- ãƒ©ã‚¤ã‚»ãƒ³ã‚¹æ–‡é¢ + * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。 + * + * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプãƒã‚¸ã‚§ã‚¯ãƒˆã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§ + * ã¯ã‚りã¾ã›ã‚“。 + * + * â—†ä¿è¨¼å†…容◆ + * + * ã“ã®ã‚½ãƒ•トウェアã¯ã€æœŸå¾…ã•れãŸå‹•作・機能・性能をæŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨è¨ˆã•れ + * 開発ã•れã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚りã¾ã›ã‚“。ã“ã®ã‚½ãƒ•トウェアã¯ã€Œã“ + * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•れã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定㮠+ * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•らã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•れãŸã‚Šæš—é»™ã«ç¤ºã•れã¦ã„ + * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åйã§ã™ã€‚ã“ã®ã‚½ãƒ•トウェアを使用ã—ãŸçµæžœãªã„ã—使 + * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æå®³ + * ã€ãƒ‡ãƒ¼ã‚¿ã®æå¤±ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æå®³ã«ã¤ã„ã¦ã¯ã€ãã®æå®³ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€… + * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è¦å‘Šã•れã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æå®³ã®è³ + * 償ãŠã‚ˆã³è£œå¡«ã‚’行ã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ» + * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚ + * + * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—† + * + * 〒102-0073 + * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F + * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ + * Phone: 03-3512-3655, Fax: 03-3512-3656 + * Email: sales@happysize.co.jp + * Web: http://happysize.com/ + * + * ◆著者◆ + * + * 金本 茂 <sgk@happysize.co.jp> + * + * ◆履æ´â—† + * + * 1998/11/10 sgk implementation in C++ + * 1999/4/25 sgk Cã§æ›¸ããªãŠã—。 + * 1999/4/26 sgk 入力フィルタを実装。漢å—コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’è¿½åŠ ã€‚ + * 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚ + * 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚ + * + */ + +/* + * Unicode support + * + * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team. + * All rights reserved. + * + */ + +/* + * + * streamable kanji code filter and converter + * mbfl : Multi Byte FiLter Liblary + * + */ + +#ifndef MBFL_MBFILTER_H +#define MBFL_MBFILTER_H + +#include "mbfl_consts.h" +#include "mbfl_allocators.h" +#include "mbfl_encoding.h" +#include "mbfl_language.h" +#include "mbfl_string.h" +#include "mbfl_convert.h" +#include "mbfl_ident.h" + +#ifndef NULL +#ifdef __cplusplus +#define NULL (0L) +#else +#define NULL (void *)(0L) +#endif +#endif + +/* + * convert filter + */ +#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE 0 +#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR 1 +#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG 2 + +/* + * buffering converter + */ +typedef struct _mbfl_buffer_converter mbfl_buffer_converter; + +struct _mbfl_buffer_converter { + mbfl_convert_filter *filter1; + mbfl_convert_filter *filter2; + mbfl_memory_device device; + const mbfl_encoding *from; + const mbfl_encoding *to; +}; + +mbfl_buffer_converter * mbfl_buffer_converter_new(enum mbfl_no_encoding from, enum mbfl_no_encoding to, int buf_initsz); +void mbfl_buffer_converter_delete(mbfl_buffer_converter *convd); +void mbfl_buffer_converter_reset(mbfl_buffer_converter *convd); +int mbfl_buffer_converter_illegal_mode(mbfl_buffer_converter *convd, int mode); +int mbfl_buffer_converter_illegal_substchar(mbfl_buffer_converter *convd, int substchar); +int mbfl_buffer_converter_strncat(mbfl_buffer_converter *convd, const unsigned char *p, int n); +int mbfl_buffer_converter_feed(mbfl_buffer_converter *convd, mbfl_string *string); +int mbfl_buffer_converter_flush(mbfl_buffer_converter *convd); +mbfl_string * mbfl_buffer_converter_getbuffer(mbfl_buffer_converter *convd, mbfl_string *result); +mbfl_string * mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result); +mbfl_string * mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string, mbfl_string *result); + +/* + * encoding detector + */ +typedef struct _mbfl_encoding_detector mbfl_encoding_detector; + +struct _mbfl_encoding_detector { + mbfl_identify_filter **filter_list; + int filter_list_size; +}; + +mbfl_encoding_detector * mbfl_encoding_detector_new(enum mbfl_no_encoding *elist, int eliztsz); +void mbfl_encoding_detector_delete(mbfl_encoding_detector *identd); +int mbfl_encoding_detector_feed(mbfl_encoding_detector *identd, mbfl_string *string); +enum mbfl_no_encoding mbfl_encoding_detector_judge(mbfl_encoding_detector *identd); + + +/* + * encoding converter + */ +mbfl_string * +mbfl_convert_encoding(mbfl_string *string, mbfl_string *result, enum mbfl_no_encoding toenc); + + +/* + * identify encoding + */ +const mbfl_encoding * +mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz, int strict); + +const char * +mbfl_identify_encoding_name(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz, int strict); + +const enum mbfl_no_encoding +mbfl_identify_encoding_no(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz); + +/* + * strlen + */ +int +mbfl_strlen(mbfl_string *string); + +/* + * oddlen + */ +int +mbfl_oddlen(mbfl_string *string); + +/* + * strpos + */ +int +mbfl_strpos(mbfl_string *haystack, mbfl_string *needle, int offset, int reverse); + + +/* + * substr_count + */ +int +mbfl_substr_count(mbfl_string *haystack, mbfl_string *needle); + +/* + * substr + */ +mbfl_string * +mbfl_substr(mbfl_string *string, mbfl_string *result, int from, int length); + +/* + * strcut + */ +mbfl_string * +mbfl_strcut(mbfl_string *string, mbfl_string *result, int from, int length); + +/* + * strwidth + */ +int +mbfl_strwidth(mbfl_string *string); + +/* + * strimwidth + */ +mbfl_string * +mbfl_strimwidth(mbfl_string *string, mbfl_string *marker, mbfl_string *result, int from, int width); + +/* + * MIME header encode + */ +struct mime_header_encoder_data; /* forward declaration */ + +struct mime_header_encoder_data * +mime_header_encoder_new( + enum mbfl_no_encoding incode, + enum mbfl_no_encoding outcode, + enum mbfl_no_encoding encoding); + +void +mime_header_encoder_delete(struct mime_header_encoder_data *pe); + +int +mime_header_encoder_feed(int c, struct mime_header_encoder_data *pe); + +mbfl_string * +mime_header_encoder_result(struct mime_header_encoder_data *pe, mbfl_string *result); + +mbfl_string * +mbfl_mime_header_encode( + mbfl_string *string, mbfl_string *result, + enum mbfl_no_encoding outcode, + enum mbfl_no_encoding encoding, + const char *linefeed, + int indent); + +/* + * MIME header decode + */ +struct mime_header_decoder_data; /* forward declaration */ + +struct mime_header_decoder_data * +mime_header_decoder_new(enum mbfl_no_encoding outcode); + +void +mime_header_decoder_delete(struct mime_header_decoder_data *pd); + +int +mime_header_decoder_feed(int c, struct mime_header_decoder_data *pd); + +mbfl_string * +mime_header_decoder_result(struct mime_header_decoder_data *pd, mbfl_string *result); + +mbfl_string * +mbfl_mime_header_decode( + mbfl_string *string, + mbfl_string *result, + enum mbfl_no_encoding outcode); + + +/* + * convert HTML numeric entity + */ +mbfl_string * +mbfl_html_numeric_entity(mbfl_string *string, mbfl_string *result, int *convmap, int mapsize, int type); + + +/* + * convert of harfwidth and fullwidth for japanese + */ +mbfl_string * +mbfl_ja_jp_hantozen(mbfl_string *string, mbfl_string *result, int mode); + +/* + * HTML Entity table + */ +typedef struct _mbfl_html_entity { + char * name; + int code; +} mbfl_html_entity; + +#endif /* MBFL_MBFILTER_H */ diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter_8bit.c b/ext/mbstring/libmbfl/mbfl/mbfilter_8bit.c new file mode 100644 index 0000000000..f91c971dd1 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfilter_8bit.c @@ -0,0 +1,48 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfilter.h" + +const mbfl_encoding mbfl_encoding_8bit = { + mbfl_no_encoding_8bit, + "8bit", + "8bit", + NULL, + NULL, + MBFL_ENCTYPE_SBCS +}; diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter_8bit.h b/ext/mbstring/libmbfl/mbfl/mbfilter_8bit.h new file mode 100644 index 0000000000..57bd4b7932 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfilter_8bit.h @@ -0,0 +1,38 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifndef MBFL_MBFILTER_8BIT_H +#define MBFL_MBFILTER_8BIT_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_8bit; + +#endif /* MBFL_MBFILTER_8BIT_H */ diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter_pass.c b/ext/mbstring/libmbfl/mbfl/mbfilter_pass.c new file mode 100644 index 0000000000..b6da879b6e --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfilter_pass.c @@ -0,0 +1,65 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfilter.h" +#include "mbfilter_pass.h" + +static const char *mbfl_encoding_pass_aliases[] = {"none", NULL}; + +const mbfl_encoding mbfl_encoding_pass = { + mbfl_no_encoding_pass, + "pass", + NULL, + (const char *(*)[])&mbfl_encoding_pass_aliases, + NULL, + 0 +}; + +const struct mbfl_convert_vtbl vtbl_pass = { + mbfl_no_encoding_pass, + mbfl_no_encoding_pass, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_pass, + mbfl_filt_conv_common_flush +}; + +int mbfl_filt_conv_pass(int c, mbfl_convert_filter *filter) +{ + return (*filter->output_function)(c, filter->data); +} + diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter_pass.h b/ext/mbstring/libmbfl/mbfl/mbfilter_pass.h new file mode 100644 index 0000000000..587b5d642d --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfilter_pass.h @@ -0,0 +1,40 @@ +/* + * "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.c + * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002. + * + */ + +#ifndef MBFL_MBFILTER_PASS_H +#define MBFL_MBFILTER_PASS_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_pass; +extern const struct mbfl_convert_vtbl vtbl_pass; + +int mbfl_filt_conv_pass(int c, mbfl_convert_filter *filter); + +#endif /* MBFL_MBFILTER_PASS_H */ diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter_wchar.c b/ext/mbstring/libmbfl/mbfl/mbfilter_wchar.c new file mode 100644 index 0000000000..50f7629849 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfilter_wchar.c @@ -0,0 +1,48 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfilter.h" + +const mbfl_encoding mbfl_encoding_wchar = { + mbfl_no_encoding_wchar, + "wchar", + NULL, + NULL, + NULL, + MBFL_ENCTYPE_WCS4BE +}; diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter_wchar.h b/ext/mbstring/libmbfl/mbfl/mbfilter_wchar.h new file mode 100644 index 0000000000..e7c9563b75 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfilter_wchar.h @@ -0,0 +1,38 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifndef MBFL_MBFILTER_WCHAR_H +#define MBFL_MBFILTER_WCHAR_H + +#include "mbfilter.h" + +extern const mbfl_encoding mbfl_encoding_wchar; + +#endif /* MBFL_MBFILTER_WCHAR_H */ diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_allocators.c b/ext/mbstring/libmbfl/mbfl/mbfl_allocators.c new file mode 100644 index 0000000000..be9d345b06 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_allocators.c @@ -0,0 +1,93 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + +#ifdef HAVE_MEMORY_H +#include <memory.h> +#endif + +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfl_allocators.h" + +static void *__mbfl__malloc(unsigned int); +static void *__mbfl__realloc(void *, unsigned int); +static void *__mbfl__calloc(unsigned int, unsigned int); +static void __mbfl__free(void *); + +static mbfl_allocators default_allocators = { + __mbfl__malloc, + __mbfl__realloc, + __mbfl__calloc, + __mbfl__free, + __mbfl__malloc, + __mbfl__realloc, + __mbfl__free +}; + +mbfl_allocators *__mbfl_allocators = &default_allocators; + +static void *__mbfl__malloc(unsigned int sz) +{ + return malloc(sz); +} + +static void *__mbfl__realloc(void *ptr, unsigned int sz) +{ + return realloc(ptr, sz); +} + +static void *__mbfl__calloc(unsigned int nelems, unsigned int szelem) +{ + return calloc(nelems, szelem); +} + +static void __mbfl__free(void *ptr) +{ + free(ptr); +} + diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_allocators.h b/ext/mbstring/libmbfl/mbfl/mbfl_allocators.h new file mode 100644 index 0000000000..47f8397104 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_allocators.h @@ -0,0 +1,54 @@ +/* + * "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.h + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.h is included in this package . + * + */ + +#ifndef MBFL_ALLOCATORS_H +#define MBFL_ALLOCATORS_H + +typedef struct _mbfl_allocators { + void *(*malloc)(unsigned int); + void *(*realloc)(void *, unsigned int); + void *(*calloc)(unsigned int, unsigned int); + void (*free)(void *); + void *(*pmalloc)(unsigned int); + void *(*prealloc)(void *, unsigned int); + void (*pfree)(void *); +} mbfl_allocators; + +extern mbfl_allocators *__mbfl_allocators; + +#define mbfl_malloc __mbfl_allocators->malloc +#define mbfl_realloc __mbfl_allocators->realloc +#define mbfl_calloc __mbfl_allocators->calloc +#define mbfl_free __mbfl_allocators->free +#define mbfl_pmalloc __mbfl_allocators->pmalloc +#define mbfl_prealloc __mbfl_allocators->preallloc +#define mbfl_pfree __mbfl_allocators->pfree + +#endif /* MBFL_ALLOCATORS_H */ diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_consts.h b/ext/mbstring/libmbfl/mbfl/mbfl_consts.h new file mode 100644 index 0000000000..d907512ec2 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_consts.h @@ -0,0 +1,85 @@ +/* + * "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.h + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.h is included in this package . + * + */ + +#ifndef MBFL_CONSTS_H +#define MBFL_CONSTS_H + +#define MBFL_ENCTYPE_SBCS 0x00000001 +#define MBFL_ENCTYPE_MBCS 0x00000002 +#define MBFL_ENCTYPE_WCS2BE 0x00000010 +#define MBFL_ENCTYPE_WCS2LE 0x00000020 +#define MBFL_ENCTYPE_MWC2BE 0x00000040 +#define MBFL_ENCTYPE_MWC2LE 0x00000080 +#define MBFL_ENCTYPE_WCS4BE 0x00000100 +#define MBFL_ENCTYPE_WCS4LE 0x00000200 +#define MBFL_ENCTYPE_MWC4BE 0x00000400 +#define MBFL_ENCTYPE_MWC4LE 0x00000800 +#define MBFL_ENCTYPE_SHFTCODE 0x00001000 +#define MBFL_ENCTYPE_HTML_ENT 0x00002000 + +/* wchar plane, special charactor */ +#define MBFL_WCSPLANE_MASK 0xffff +#define MBFL_WCSPLANE_UCS2MAX 0x00010000 +#define MBFL_WCSPLANE_SUPMIN 0x00010000 +#define MBFL_WCSPLANE_SUPMAX 0x00200000 +#define MBFL_WCSPLANE_JIS0208 0x70e10000 /* JIS HEX : 2121h - 7E7Eh */ +#define MBFL_WCSPLANE_JIS0212 0x70e20000 /* JIS HEX : 2121h - 7E7Eh */ +#define MBFL_WCSPLANE_WINCP932 0x70e30000 /* JIS HEX : 2121h - 9898h */ +#define MBFL_WCSPLANE_8859_1 0x70e40000 /* 00h - FFh */ +#define MBFL_WCSPLANE_8859_2 0x70e50000 /* 00h - FFh */ +#define MBFL_WCSPLANE_8859_3 0x70e60000 /* 00h - FFh */ +#define MBFL_WCSPLANE_8859_4 0x70e70000 /* 00h - FFh */ +#define MBFL_WCSPLANE_8859_5 0x70e80000 /* 00h - FFh */ +#define MBFL_WCSPLANE_8859_6 0x70e90000 /* 00h - FFh */ +#define MBFL_WCSPLANE_8859_7 0x70ea0000 /* 00h - FFh */ +#define MBFL_WCSPLANE_8859_8 0x70eb0000 /* 00h - FFh */ +#define MBFL_WCSPLANE_8859_9 0x70ec0000 /* 00h - FFh */ +#define MBFL_WCSPLANE_8859_10 0x70ed0000 /* 00h - FFh */ +#define MBFL_WCSPLANE_8859_13 0x70ee0000 /* 00h - FFh */ +#define MBFL_WCSPLANE_8859_14 0x70ef0000 /* 00h - FFh */ +#define MBFL_WCSPLANE_8859_15 0x70f00000 /* 00h - FFh */ +#define MBFL_WCSPLANE_KSC5601 0x70f10000 /* 2121h - 7E7Eh */ +#define MBFL_WCSPLANE_GB2312 0x70f20000 /* 2121h - 7E7Eh */ +#define MBFL_WCSPLANE_WINCP936 0x70f30000 /* 2121h - 9898h */ +#define MBFL_WCSPLANE_BIG5 0x70f40000 /* 2121h - 9898h */ +#define MBFL_WCSPLANE_CNS11643 0x70f50000 /* 2121h - 9898h */ +#define MBFL_WCSPLANE_UHC 0x70f60000 /* 8141h - fefeh */ +#define MBFL_WCSPLANE_CP1251 0x70f70000 +#define MBFL_WCSPLANE_CP866 0x70f80000 +#define MBFL_WCSPLANE_KOI8R 0x70f90000 +#define MBFL_WCSGROUP_MASK 0xffffff +#define MBFL_WCSGROUP_UCS4MAX 0x70000000 +#define MBFL_WCSGROUP_WCHARMAX 0x78000000 +#define MBFL_WCSGROUP_THROUGH 0x78000000 /* 000000h - FFFFFFh */ + +#define MBFL_QPRINT_STS_MIME_HEADER 0x1000000 +#define MBFL_BASE64_STS_MIME_HEADER 0x1000000 + +#endif /* MBFL_CONSTS_H */ diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_convert.c b/ext/mbstring/libmbfl/mbfl/mbfl_convert.c new file mode 100644 index 0000000000..2b9090eb59 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_convert.c @@ -0,0 +1,507 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfl_encoding.h" +#include "mbfl_allocators.h" +#include "mbfl_filter_output.h" +#include "mbfilter_pass.h" +#include "mbfilter_8bit.h" +#include "mbfilter_wchar.h" + +#include "filters/mbfilter_euc_cn.h" +#include "filters/mbfilter_hz.h" +#include "filters/mbfilter_euc_tw.h" +#include "filters/mbfilter_big5.h" +#include "filters/mbfilter_uhc.h" +#include "filters/mbfilter_euc_kr.h" +#include "filters/mbfilter_iso2022_kr.h" +#include "filters/mbfilter_sjis.h" +#include "filters/mbfilter_jis.h" +#include "filters/mbfilter_euc_jp.h" +#include "filters/mbfilter_euc_jp_win.h" +#include "filters/mbfilter_ascii.h" +#include "filters/mbfilter_koi8r.h" +#include "filters/mbfilter_cp866.h" +#include "filters/mbfilter_cp932.h" +#include "filters/mbfilter_cp936.h" +#include "filters/mbfilter_cp1251.h" +#include "filters/mbfilter_cp1252.h" +#include "filters/mbfilter_iso8859_1.h" +#include "filters/mbfilter_iso8859_2.h" +#include "filters/mbfilter_iso8859_3.h" +#include "filters/mbfilter_iso8859_4.h" +#include "filters/mbfilter_iso8859_5.h" +#include "filters/mbfilter_iso8859_6.h" +#include "filters/mbfilter_iso8859_7.h" +#include "filters/mbfilter_iso8859_8.h" +#include "filters/mbfilter_iso8859_9.h" +#include "filters/mbfilter_iso8859_10.h" +#include "filters/mbfilter_iso8859_13.h" +#include "filters/mbfilter_iso8859_14.h" +#include "filters/mbfilter_iso8859_15.h" +#include "filters/mbfilter_base64.h" +#include "filters/mbfilter_qprint.h" +#include "filters/mbfilter_uuencode.h" +#include "filters/mbfilter_7bit.h" +#include "filters/mbfilter_utf7.h" +#include "filters/mbfilter_utf7imap.h" +#include "filters/mbfilter_utf8.h" +#include "filters/mbfilter_utf16.h" +#include "filters/mbfilter_utf32.h" +#include "filters/mbfilter_byte2.h" +#include "filters/mbfilter_byte4.h" +#include "filters/mbfilter_ucs4.h" +#include "filters/mbfilter_ucs2.h" +#include "filters/mbfilter_htmlent.h" + +/* hex character table "0123456789ABCDEF" */ +static char mbfl_hexchar_table[] = { + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46 +}; + +const struct mbfl_convert_vtbl *mbfl_convert_filter_list[] = { + &vtbl_utf8_wchar, + &vtbl_wchar_utf8, + &vtbl_eucjp_wchar, + &vtbl_wchar_eucjp, + &vtbl_sjis_wchar, + &vtbl_wchar_sjis, + &vtbl_jis_wchar, + &vtbl_wchar_jis, + &vtbl_2022jp_wchar, + &vtbl_wchar_2022jp, + &vtbl_eucjpwin_wchar, + &vtbl_wchar_eucjpwin, + &vtbl_sjiswin_wchar, + &vtbl_wchar_sjiswin, + &vtbl_euccn_wchar, + &vtbl_wchar_euccn, + &vtbl_cp936_wchar, + &vtbl_wchar_cp936, + &vtbl_hz_wchar, + &vtbl_wchar_hz, + &vtbl_euctw_wchar, + &vtbl_wchar_euctw, + &vtbl_big5_wchar, + &vtbl_wchar_big5, + &vtbl_euckr_wchar, + &vtbl_wchar_euckr, + &vtbl_uhc_wchar, + &vtbl_wchar_uhc, + &vtbl_2022kr_wchar, + &vtbl_wchar_2022kr, + &vtbl_cp1251_wchar, + &vtbl_wchar_cp1251, + &vtbl_cp866_wchar, + &vtbl_wchar_cp866, + &vtbl_koi8r_wchar, + &vtbl_wchar_koi8r, + &vtbl_cp1252_wchar, + &vtbl_wchar_cp1252, + &vtbl_ascii_wchar, + &vtbl_wchar_ascii, + &vtbl_8859_1_wchar, + &vtbl_wchar_8859_1, + &vtbl_8859_2_wchar, + &vtbl_wchar_8859_2, + &vtbl_8859_3_wchar, + &vtbl_wchar_8859_3, + &vtbl_8859_4_wchar, + &vtbl_wchar_8859_4, + &vtbl_8859_5_wchar, + &vtbl_wchar_8859_5, + &vtbl_8859_6_wchar, + &vtbl_wchar_8859_6, + &vtbl_8859_7_wchar, + &vtbl_wchar_8859_7, + &vtbl_8859_8_wchar, + &vtbl_wchar_8859_8, + &vtbl_8859_9_wchar, + &vtbl_wchar_8859_9, + &vtbl_8859_10_wchar, + &vtbl_wchar_8859_10, + &vtbl_8859_13_wchar, + &vtbl_wchar_8859_13, + &vtbl_8859_14_wchar, + &vtbl_wchar_8859_14, + &vtbl_8859_15_wchar, + &vtbl_wchar_8859_15, + &vtbl_8bit_b64, + &vtbl_b64_8bit, + &vtbl_uuencode_8bit, + &vtbl_wchar_html, + &vtbl_html_wchar, + &vtbl_8bit_qprint, + &vtbl_qprint_8bit, + &vtbl_8bit_7bit, + &vtbl_7bit_8bit, + &vtbl_utf7_wchar, + &vtbl_wchar_utf7, + &vtbl_utf7imap_wchar, + &vtbl_wchar_utf7imap, + &vtbl_utf16_wchar, + &vtbl_wchar_utf16, + &vtbl_utf16be_wchar, + &vtbl_wchar_utf16be, + &vtbl_utf16le_wchar, + &vtbl_wchar_utf16le, + &vtbl_utf32_wchar, + &vtbl_wchar_utf32, + &vtbl_utf32be_wchar, + &vtbl_wchar_utf32be, + &vtbl_utf32le_wchar, + &vtbl_wchar_utf32le, + &vtbl_ucs4_wchar, + &vtbl_wchar_ucs4, + &vtbl_ucs4be_wchar, + &vtbl_wchar_ucs4be, + &vtbl_ucs4le_wchar, + &vtbl_wchar_ucs4le, + &vtbl_ucs2_wchar, + &vtbl_wchar_ucs2, + &vtbl_ucs2be_wchar, + &vtbl_wchar_ucs2be, + &vtbl_ucs2le_wchar, + &vtbl_wchar_ucs2le, + &vtbl_byte4be_wchar, + &vtbl_wchar_byte4be, + &vtbl_byte4le_wchar, + &vtbl_wchar_byte4le, + &vtbl_byte2be_wchar, + &vtbl_wchar_byte2be, + &vtbl_byte2le_wchar, + &vtbl_wchar_byte2le, + &vtbl_pass, + NULL +}; + +mbfl_convert_filter * +mbfl_convert_filter_new( + enum mbfl_no_encoding from, + enum mbfl_no_encoding to, + int (*output_function)(int, void* ), + int (*flush_function)(void*), + void* data) +{ + mbfl_convert_filter * filter; + + /* allocate */ + filter = (mbfl_convert_filter *)mbfl_malloc(sizeof(mbfl_convert_filter)); + if (filter == NULL) { + return NULL; + } + + /* encoding structure */ + filter->from = mbfl_no2encoding(from); + filter->to = mbfl_no2encoding(to); + if (filter->from == NULL) { + filter->from = &mbfl_encoding_pass; + } + if (filter->to == NULL) { + filter->to = &mbfl_encoding_pass; + } + + if (output_function != NULL) { + filter->output_function = output_function; + } else { + filter->output_function = mbfl_filter_output_null; + } + filter->flush_function = flush_function; + filter->data = data; + filter->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; + filter->illegal_substchar = 0x3f; /* '?' */ + + /* setup the function table */ + mbfl_convert_filter_select_vtbl(filter); + + /* constructor */ + (*filter->filter_ctor)(filter); + + return filter; +} + +void +mbfl_convert_filter_delete(mbfl_convert_filter *filter) +{ + if (filter) { + (*filter->filter_dtor)(filter); + mbfl_free((void*)filter); + } +} + +int +mbfl_convert_filter_feed(int c, mbfl_convert_filter *filter) +{ + return (*filter->filter_function)(c, filter); +} + +int +mbfl_convert_filter_flush(mbfl_convert_filter *filter) +{ + (*filter->filter_flush)(filter); + return (filter->flush_function ? (*filter->flush_function)(filter->data) : 0); +} + +void +mbfl_convert_filter_reset( + mbfl_convert_filter *filter, + enum mbfl_no_encoding from, + enum mbfl_no_encoding to) +{ + /* destruct old filter */ + (*filter->filter_dtor)(filter); + + /* resset filter member */ + filter->from = mbfl_no2encoding(from); + filter->to = mbfl_no2encoding(to); + + /* set the vtbl */ + mbfl_convert_filter_select_vtbl(filter); + + /* construct new filter */ + (*filter->filter_ctor)(filter); +} + +void +mbfl_convert_filter_copy( + mbfl_convert_filter *src, + mbfl_convert_filter *dist) +{ + dist->filter_ctor = src->filter_ctor; + dist->filter_dtor = src->filter_dtor; + dist->filter_function = src->filter_function; + dist->filter_flush = src->filter_flush; + dist->output_function = src->output_function; + dist->flush_function = src->flush_function; + dist->data = src->data; + dist->status = src->status; + dist->cache = src->cache; + dist->from = src->from; + dist->to = src->to; + dist->illegal_mode = src->illegal_mode; + dist->illegal_substchar = src->illegal_substchar; +} + +int mbfl_convert_filter_devcat(mbfl_convert_filter *filter, mbfl_memory_device *src) +{ + int n; + unsigned char *p; + + p = src->buffer; + n = src->pos; + while (n > 0) { + if ((*filter->filter_function)(*p++, filter) < 0) { + return -1; + } + n--; + } + + return n; +} + +int mbfl_convert_filter_strcat(mbfl_convert_filter *filter, const unsigned char *p) +{ + int c; + + while ((c = *p++) != '\0') { + if ((*filter->filter_function)(c, filter) < 0) { + return -1; + } + } + + return 0; +} + +#if 0 +static int +mbfl_convert_filter_strncat(mbfl_convert_filter *filter, const unsigned char *p, + int n) +{ + while (n > 0) { + if ((*filter->filter_function)(*p++, filter) < 0) { + return -1; + } + n--; + } + + return n; +} +#endif + +/* illegal character output function for conv-filter */ +int +mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter) +{ + int mode_backup, ret, n, m, r; + + ret = 0; + mode_backup = filter->illegal_mode; + filter->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE; + switch (mode_backup) { + case MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR: + ret = (*filter->filter_function)(filter->illegal_substchar, filter); + break; + case MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG: + if (c >= 0) { + if (c < MBFL_WCSGROUP_UCS4MAX) { /* unicode */ + ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"U+"); + } else { + if (c < MBFL_WCSGROUP_WCHARMAX) { + m = c & ~MBFL_WCSPLANE_MASK; + switch (m) { + case MBFL_WCSPLANE_JIS0208: + ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"JIS+"); + break; + case MBFL_WCSPLANE_JIS0212: + ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"JIS2+"); + break; + case MBFL_WCSPLANE_WINCP932: + ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"W932+"); + break; + case MBFL_WCSPLANE_8859_1: + ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"I8859_1+"); + break; + default: + ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"?+"); + break; + } + c &= MBFL_WCSPLANE_MASK; + } else { + ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"BAD+"); + c &= MBFL_WCSGROUP_MASK; + } + } + if (ret >= 0) { + m = 0; + r = 28; + while (r >= 0) { + n = (c >> r) & 0xf; + if (n || m) { + m = 1; + ret = (*filter->filter_function)(mbfl_hexchar_table[n], filter); + if (ret < 0) { + break; + } + } + r -= 4; + } + if (m == 0 && ret >= 0) { + ret = (*filter->filter_function)(mbfl_hexchar_table[0], filter); + } + } + } + break; + default: + break; + } + filter->illegal_mode = mode_backup; + + return ret; +} + +void mbfl_convert_filter_set_vtbl(mbfl_convert_filter *filter, const struct mbfl_convert_vtbl *vtbl) +{ + if (filter && vtbl) { + filter->filter_ctor = vtbl->filter_ctor; + filter->filter_dtor = vtbl->filter_dtor; + filter->filter_function = vtbl->filter_function; + filter->filter_flush = vtbl->filter_flush; + } +} + + +const struct mbfl_convert_vtbl * mbfl_convert_filter_get_vtbl(enum mbfl_no_encoding from, enum mbfl_no_encoding to) +{ + const struct mbfl_convert_vtbl *vtbl; + int i; + + if (to == mbfl_no_encoding_base64 || + to == mbfl_no_encoding_qprint || + to == mbfl_no_encoding_7bit) { + from = mbfl_no_encoding_8bit; + } else if (from == mbfl_no_encoding_base64 || + from == mbfl_no_encoding_qprint || + from == mbfl_no_encoding_uuencode) { + to = mbfl_no_encoding_8bit; + } + + i = 0; + while ((vtbl = mbfl_convert_filter_list[i++]) != NULL){ + if (vtbl->from == from && vtbl->to == to) { + return vtbl; + } + } + + return NULL; +} + + +void mbfl_convert_filter_select_vtbl(mbfl_convert_filter *filter) +{ + const struct mbfl_convert_vtbl *vtbl; + + vtbl = mbfl_convert_filter_get_vtbl(filter->from->no_encoding, filter->to->no_encoding); + if (vtbl == NULL) { + vtbl = &vtbl_pass; + } + mbfl_convert_filter_set_vtbl(filter, vtbl); +} + +/* + * commonly used constructor and destructor + */ +void mbfl_filt_conv_common_ctor(mbfl_convert_filter *filter) +{ + filter->status = 0; + filter->cache = 0; +} + +int mbfl_filt_conv_common_flush(mbfl_convert_filter *filter) +{ + filter->status = 0; + filter->cache = 0; + return 0; +} + +void mbfl_filt_conv_common_dtor(mbfl_convert_filter *filter) +{ + filter->status = 0; + filter->cache = 0; +} + + diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_convert.h b/ext/mbstring/libmbfl/mbfl/mbfl_convert.h new file mode 100644 index 0000000000..7265467127 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_convert.h @@ -0,0 +1,88 @@ +/* + * "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.h + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.h is included in this package . + * + */ + +#ifndef MBFL_CONVERT_H +#define MBFL_CONVERT_H + +#include "mbfl_encoding.h" +#include "mbfl_memory_device.h" + +typedef struct _mbfl_convert_filter mbfl_convert_filter; + +struct _mbfl_convert_filter { + void (*filter_ctor)(mbfl_convert_filter *filter); + void (*filter_dtor)(mbfl_convert_filter *filter); + int (*filter_function)(int c, mbfl_convert_filter *filter); + int (*filter_flush)(mbfl_convert_filter *filter); + int (*output_function)(int c, void *data); + int (*flush_function)(void *data); + void *data; + int status; + int cache; + const mbfl_encoding *from; + const mbfl_encoding *to; + int illegal_mode; + int illegal_substchar; +}; + +struct mbfl_convert_vtbl { + enum mbfl_no_encoding from; + enum mbfl_no_encoding to; + void (*filter_ctor)(mbfl_convert_filter *filter); + void (*filter_dtor)(mbfl_convert_filter *filter); + int (*filter_function)(int c, mbfl_convert_filter *filter); + int (*filter_flush)(mbfl_convert_filter *filter); +}; + +extern const struct mbfl_convert_vtbl *mbfl_convert_filter_list[]; + +mbfl_convert_filter *mbfl_convert_filter_new( + enum mbfl_no_encoding from, + enum mbfl_no_encoding to, + int (*output_function)(int, void *), + int (*flush_function)(void *), + void *data ); +void mbfl_convert_filter_delete(mbfl_convert_filter *filter); +int mbfl_convert_filter_feed(int c, mbfl_convert_filter *filter); +int mbfl_convert_filter_flush(mbfl_convert_filter *filter); +void mbfl_convert_filter_reset(mbfl_convert_filter *filter, enum mbfl_no_encoding from, enum mbfl_no_encoding to); +void mbfl_convert_filter_copy(mbfl_convert_filter *src, mbfl_convert_filter *dist); +int mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter); +void mbfl_convert_filter_select_vtbl(mbfl_convert_filter *filter); +const struct mbfl_convert_vtbl * mbfl_convert_filter_get_vtbl(enum mbfl_no_encoding from, enum mbfl_no_encoding to); + +void mbfl_filt_conv_common_ctor(mbfl_convert_filter *filter); +int mbfl_filt_conv_common_flush(mbfl_convert_filter *filter); +void mbfl_filt_conv_common_dtor(mbfl_convert_filter *filter); + +int mbfl_convert_filter_devcat(mbfl_convert_filter *filter, mbfl_memory_device *src); +int mbfl_convert_filter_strcat(mbfl_convert_filter *filter, const unsigned char *p); + +#endif /* MBFL_CONVERT_H */ diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_encoding.c b/ext/mbstring/libmbfl/mbfl/mbfl_encoding.c new file mode 100644 index 0000000000..a30a8f3810 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_encoding.c @@ -0,0 +1,288 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif + +#include "mbfl_encoding.h" +#include "mbfilter_pass.h" +#include "mbfilter_8bit.h" +#include "mbfilter_wchar.h" + +#include "filters/mbfilter_euc_cn.h" +#include "filters/mbfilter_hz.h" +#include "filters/mbfilter_euc_tw.h" +#include "filters/mbfilter_big5.h" +#include "filters/mbfilter_uhc.h" +#include "filters/mbfilter_euc_kr.h" +#include "filters/mbfilter_iso2022_kr.h" +#include "filters/mbfilter_sjis.h" +#include "filters/mbfilter_jis.h" +#include "filters/mbfilter_euc_jp.h" +#include "filters/mbfilter_euc_jp_win.h" +#include "filters/mbfilter_ascii.h" +#include "filters/mbfilter_koi8r.h" +#include "filters/mbfilter_cp866.h" +#include "filters/mbfilter_cp932.h" +#include "filters/mbfilter_cp936.h" +#include "filters/mbfilter_cp1251.h" +#include "filters/mbfilter_cp1252.h" +#include "filters/mbfilter_iso8859_1.h" +#include "filters/mbfilter_iso8859_2.h" +#include "filters/mbfilter_iso8859_3.h" +#include "filters/mbfilter_iso8859_4.h" +#include "filters/mbfilter_iso8859_5.h" +#include "filters/mbfilter_iso8859_6.h" +#include "filters/mbfilter_iso8859_7.h" +#include "filters/mbfilter_iso8859_8.h" +#include "filters/mbfilter_iso8859_9.h" +#include "filters/mbfilter_iso8859_10.h" +#include "filters/mbfilter_iso8859_13.h" +#include "filters/mbfilter_iso8859_14.h" +#include "filters/mbfilter_iso8859_15.h" +#include "filters/mbfilter_base64.h" +#include "filters/mbfilter_qprint.h" +#include "filters/mbfilter_uuencode.h" +#include "filters/mbfilter_7bit.h" +#include "filters/mbfilter_utf7.h" +#include "filters/mbfilter_utf7imap.h" +#include "filters/mbfilter_utf8.h" +#include "filters/mbfilter_utf16.h" +#include "filters/mbfilter_utf32.h" +#include "filters/mbfilter_byte2.h" +#include "filters/mbfilter_byte4.h" +#include "filters/mbfilter_ucs4.h" +#include "filters/mbfilter_ucs2.h" +#include "filters/mbfilter_htmlent.h" + +static const char *mbfl_encoding_auto_aliases[] = {"unknown", NULL}; + +static const mbfl_encoding mbfl_encoding_auto = { + mbfl_no_encoding_auto, + "auto", + NULL, + (const char *(*)[])&mbfl_encoding_auto_aliases, + NULL, + 0 +}; + +static const mbfl_encoding *mbfl_encoding_ptr_list[] = { + &mbfl_encoding_pass, + &mbfl_encoding_auto, + &mbfl_encoding_wchar, + &mbfl_encoding_byte2be, + &mbfl_encoding_byte2le, + &mbfl_encoding_byte4be, + &mbfl_encoding_byte4le, + &mbfl_encoding_base64, + &mbfl_encoding_uuencode, + &mbfl_encoding_html_ent, + &mbfl_encoding_qprint, + &mbfl_encoding_7bit, + &mbfl_encoding_8bit, + &mbfl_encoding_ucs4, + &mbfl_encoding_ucs4be, + &mbfl_encoding_ucs4le, + &mbfl_encoding_ucs2, + &mbfl_encoding_ucs2be, + &mbfl_encoding_ucs2le, + &mbfl_encoding_utf32, + &mbfl_encoding_utf32be, + &mbfl_encoding_utf32le, + &mbfl_encoding_utf16, + &mbfl_encoding_utf16be, + &mbfl_encoding_utf16le, + &mbfl_encoding_utf8, + &mbfl_encoding_utf7, + &mbfl_encoding_utf7imap, + &mbfl_encoding_ascii, + &mbfl_encoding_euc_jp, + &mbfl_encoding_sjis, + &mbfl_encoding_eucjp_win, + &mbfl_encoding_sjis_win, + &mbfl_encoding_jis, + &mbfl_encoding_2022jp, + &mbfl_encoding_cp1252, + &mbfl_encoding_8859_1, + &mbfl_encoding_8859_2, + &mbfl_encoding_8859_3, + &mbfl_encoding_8859_4, + &mbfl_encoding_8859_5, + &mbfl_encoding_8859_6, + &mbfl_encoding_8859_7, + &mbfl_encoding_8859_8, + &mbfl_encoding_8859_9, + &mbfl_encoding_8859_10, + &mbfl_encoding_8859_13, + &mbfl_encoding_8859_14, + &mbfl_encoding_8859_15, + &mbfl_encoding_euc_cn, + &mbfl_encoding_cp936, + &mbfl_encoding_hz, + &mbfl_encoding_euc_tw, + &mbfl_encoding_big5, + &mbfl_encoding_euc_kr, + &mbfl_encoding_uhc, + &mbfl_encoding_2022kr, + &mbfl_encoding_cp1251, + &mbfl_encoding_cp866, + &mbfl_encoding_koi8r, + NULL +}; + +/* encoding resolver */ +const mbfl_encoding * +mbfl_name2encoding(const char *name) +{ + const mbfl_encoding *encoding; + int i, j; + + if (name == NULL) { + return NULL; + } + + i = 0; + while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL){ + if (strcasecmp(encoding->name, name) == 0) { + return encoding; + } + } + + /* serch MIME charset name */ + i = 0; + while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) { + if (encoding->mime_name != NULL) { + if (strcasecmp(encoding->mime_name, name) == 0) { + return encoding; + } + } + } + + /* serch aliases */ + i = 0; + while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) { + if (encoding->aliases != NULL) { + j = 0; + while ((*encoding->aliases)[j] != NULL) { + if (strcasecmp((*encoding->aliases)[j], name) == 0) { + return encoding; + } + j++; + } + } + } + + return NULL; +} + +const mbfl_encoding * +mbfl_no2encoding(enum mbfl_no_encoding no_encoding) +{ + const mbfl_encoding *encoding; + int i; + + i = 0; + while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL){ + if (encoding->no_encoding == no_encoding) { + return encoding; + } + } + + return NULL; +} + +enum mbfl_no_encoding +mbfl_name2no_encoding(const char *name) +{ + const mbfl_encoding *encoding; + + encoding = mbfl_name2encoding(name); + if (encoding == NULL) { + return mbfl_no_encoding_invalid; + } else { + return encoding->no_encoding; + } +} + +const char * +mbfl_no_encoding2name(enum mbfl_no_encoding no_encoding) +{ + const mbfl_encoding *encoding; + + encoding = mbfl_no2encoding(no_encoding); + if (encoding == NULL) { + return ""; + } else { + return encoding->name; + } +} + +const char * +mbfl_no2preferred_mime_name(enum mbfl_no_encoding no_encoding) +{ + const mbfl_encoding *encoding; + + encoding = mbfl_no2encoding(no_encoding); + if (encoding != NULL && encoding->mime_name != NULL && encoding->mime_name[0] != '\0') { + return encoding->mime_name; + } else { + return NULL; + } +} + +int +mbfl_is_support_encoding(const char *name) +{ + const mbfl_encoding *encoding; + + encoding = mbfl_name2encoding(name); + if (encoding == NULL) { + return 0; + } else { + return 1; + } +} + + + + diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_encoding.h b/ext/mbstring/libmbfl/mbfl/mbfl_encoding.h new file mode 100644 index 0000000000..4d038a13c8 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_encoding.h @@ -0,0 +1,123 @@ +/* + * "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.h + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.h is included in this package . + * + */ + +#ifndef MBFL_ENCODING_H +#define MBFL_ENCODING_H + +enum mbfl_no_encoding { + mbfl_no_encoding_invalid = -1, + mbfl_no_encoding_pass, + mbfl_no_encoding_auto, + mbfl_no_encoding_wchar, + mbfl_no_encoding_byte2be, + mbfl_no_encoding_byte2le, + mbfl_no_encoding_byte4be, + mbfl_no_encoding_byte4le, + mbfl_no_encoding_base64, + mbfl_no_encoding_uuencode, + mbfl_no_encoding_html_ent, + mbfl_no_encoding_qprint, + mbfl_no_encoding_7bit, + mbfl_no_encoding_8bit, + mbfl_no_encoding_charset_min, + mbfl_no_encoding_ucs4, + mbfl_no_encoding_ucs4be, + mbfl_no_encoding_ucs4le, + mbfl_no_encoding_ucs2, + mbfl_no_encoding_ucs2be, + mbfl_no_encoding_ucs2le, + mbfl_no_encoding_utf32, + mbfl_no_encoding_utf32be, + mbfl_no_encoding_utf32le, + mbfl_no_encoding_utf16, + mbfl_no_encoding_utf16be, + mbfl_no_encoding_utf16le, + mbfl_no_encoding_utf8, + mbfl_no_encoding_utf7, + mbfl_no_encoding_utf7imap, + mbfl_no_encoding_ascii, + mbfl_no_encoding_euc_jp, + mbfl_no_encoding_sjis, + mbfl_no_encoding_eucjp_win, + mbfl_no_encoding_sjis_win, + mbfl_no_encoding_sjis_mac, + mbfl_no_encoding_jis, + mbfl_no_encoding_2022jp, + mbfl_no_encoding_cp1252, + mbfl_no_encoding_8859_1, + mbfl_no_encoding_8859_2, + mbfl_no_encoding_8859_3, + mbfl_no_encoding_8859_4, + mbfl_no_encoding_8859_5, + mbfl_no_encoding_8859_6, + mbfl_no_encoding_8859_7, + mbfl_no_encoding_8859_8, + mbfl_no_encoding_8859_9, + mbfl_no_encoding_8859_10, + mbfl_no_encoding_8859_13, + mbfl_no_encoding_8859_14, + mbfl_no_encoding_8859_15, + mbfl_no_encoding_euc_cn, + mbfl_no_encoding_cp936, + mbfl_no_encoding_euc_tw, + mbfl_no_encoding_big5, + mbfl_no_encoding_euc_kr, + mbfl_no_encoding_2022kr, + mbfl_no_encoding_uhc, + mbfl_no_encoding_hz, + mbfl_no_encoding_cp1251, + mbfl_no_encoding_cp866, + mbfl_no_encoding_koi8r, + mbfl_no_encoding_charset_max +}; + +typedef enum mbfl_no_encoding mbfl_encoding_id; + +/* + * encoding + */ +typedef struct _mbfl_encoding { + enum mbfl_no_encoding no_encoding; + const char *name; + const char *mime_name; + const char *(*aliases)[]; + const unsigned char *mblen_table; + unsigned int flag; +} mbfl_encoding; + +const mbfl_encoding * mbfl_name2encoding(const char *name); +const mbfl_encoding * mbfl_no2encoding(enum mbfl_no_encoding no_encoding); +enum mbfl_no_encoding mbfl_name2no_encoding(const char *name); +const char * mbfl_no_encoding2name(enum mbfl_no_encoding no_encoding); +const char * mbfl_no2preferred_mime_name(enum mbfl_no_encoding no_encoding); +int mbfl_is_support_encoding(const char *name); + + +#endif /* MBFL_ENCODING_H */ diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_filter_output.c b/ext/mbstring/libmbfl/mbfl/mbfl_filter_output.c new file mode 100644 index 0000000000..2b63478214 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_filter_output.c @@ -0,0 +1,49 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mbfl_convert.h" +#include "mbfl_filter_output.h" + +int mbfl_filter_output_pipe(int c, void* data) +{ + mbfl_convert_filter *filter = (mbfl_convert_filter*)data; + return (*filter->filter_function)(c, filter); +} + +int mbfl_filter_output_null(int c, void* data) +{ + return c; +} + + diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_filter_output.h b/ext/mbstring/libmbfl/mbfl/mbfl_filter_output.h new file mode 100644 index 0000000000..127ca7a419 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_filter_output.h @@ -0,0 +1,37 @@ +/* + * "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.h + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.h is included in this package . + * + */ + +#ifndef MBFL_FILTER_OUTPUT_H +#define MBFL_FILTER_OUTPUT_H + +int mbfl_filter_output_pipe(int c, void* data); +int mbfl_filter_output_null(int c, void* data); + +#endif /* MBFL_FILTER_OUTPUT_H */ diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_ident.c b/ext/mbstring/libmbfl/mbfl/mbfl_ident.c new file mode 100644 index 0000000000..5b581bf566 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_ident.c @@ -0,0 +1,241 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfl_ident.h" +#include "mbfl_allocators.h" +#include "mbfilter_pass.h" +#include "mbfilter_8bit.h" +#include "mbfilter_wchar.h" + +#include "filters/mbfilter_euc_cn.h" +#include "filters/mbfilter_hz.h" +#include "filters/mbfilter_euc_tw.h" +#include "filters/mbfilter_big5.h" +#include "filters/mbfilter_uhc.h" +#include "filters/mbfilter_euc_kr.h" +#include "filters/mbfilter_iso2022_kr.h" +#include "filters/mbfilter_sjis.h" +#include "filters/mbfilter_jis.h" +#include "filters/mbfilter_euc_jp.h" +#include "filters/mbfilter_euc_jp_win.h" +#include "filters/mbfilter_ascii.h" +#include "filters/mbfilter_koi8r.h" +#include "filters/mbfilter_cp866.h" +#include "filters/mbfilter_cp932.h" +#include "filters/mbfilter_cp936.h" +#include "filters/mbfilter_cp1251.h" +#include "filters/mbfilter_cp1252.h" +#include "filters/mbfilter_iso8859_1.h" +#include "filters/mbfilter_iso8859_2.h" +#include "filters/mbfilter_iso8859_3.h" +#include "filters/mbfilter_iso8859_4.h" +#include "filters/mbfilter_iso8859_5.h" +#include "filters/mbfilter_iso8859_6.h" +#include "filters/mbfilter_iso8859_7.h" +#include "filters/mbfilter_iso8859_8.h" +#include "filters/mbfilter_iso8859_9.h" +#include "filters/mbfilter_iso8859_10.h" +#include "filters/mbfilter_iso8859_13.h" +#include "filters/mbfilter_iso8859_14.h" +#include "filters/mbfilter_iso8859_15.h" +#include "filters/mbfilter_base64.h" +#include "filters/mbfilter_qprint.h" +#include "filters/mbfilter_uuencode.h" +#include "filters/mbfilter_7bit.h" +#include "filters/mbfilter_utf7.h" +#include "filters/mbfilter_utf7imap.h" +#include "filters/mbfilter_utf8.h" +#include "filters/mbfilter_utf16.h" +#include "filters/mbfilter_utf32.h" +#include "filters/mbfilter_byte2.h" +#include "filters/mbfilter_byte4.h" +#include "filters/mbfilter_ucs4.h" +#include "filters/mbfilter_ucs2.h" +#include "filters/mbfilter_htmlent.h" + +static const struct mbfl_identify_vtbl vtbl_identify_false = { + mbfl_no_encoding_pass, + mbfl_filt_ident_false_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_false }; + + +static const struct mbfl_identify_vtbl *mbfl_identify_filter_list[] = { + &vtbl_identify_utf8, + &vtbl_identify_utf7, + &vtbl_identify_ascii, + &vtbl_identify_eucjp, + &vtbl_identify_sjis, + &vtbl_identify_eucjpwin, + &vtbl_identify_sjiswin, + &vtbl_identify_jis, + &vtbl_identify_2022jp, + &vtbl_identify_euccn, + &vtbl_identify_cp936, + &vtbl_identify_hz, + &vtbl_identify_euctw, + &vtbl_identify_big5, + &vtbl_identify_euckr, + &vtbl_identify_uhc, + &vtbl_identify_2022kr, + &vtbl_identify_cp1251, + &vtbl_identify_cp866, + &vtbl_identify_koi8r, + &vtbl_identify_cp1252, + &vtbl_identify_8859_1, + &vtbl_identify_8859_2, + &vtbl_identify_8859_3, + &vtbl_identify_8859_4, + &vtbl_identify_8859_5, + &vtbl_identify_8859_6, + &vtbl_identify_8859_7, + &vtbl_identify_8859_8, + &vtbl_identify_8859_9, + &vtbl_identify_8859_10, + &vtbl_identify_8859_13, + &vtbl_identify_8859_14, + &vtbl_identify_8859_15, + &vtbl_identify_false, + NULL +}; + + + +/* + * identify filter + */ + +void mbfl_identify_filter_set_vtbl(mbfl_identify_filter *filter, const struct mbfl_identify_vtbl *vtbl) +{ + if (filter && vtbl) { + filter->filter_ctor = vtbl->filter_ctor; + filter->filter_dtor = vtbl->filter_dtor; + filter->filter_function = vtbl->filter_function; + } +} + +const struct mbfl_identify_vtbl * mbfl_identify_filter_get_vtbl(enum mbfl_no_encoding encoding) +{ + const struct mbfl_identify_vtbl * vtbl; + int i; + + i = 0; + while ((vtbl = mbfl_identify_filter_list[i++]) != NULL) { + if (vtbl->encoding == encoding) { + break; + } + } + + return vtbl; +} + +void mbfl_identify_filter_select_vtbl(mbfl_identify_filter *filter) +{ + const struct mbfl_identify_vtbl *vtbl; + + vtbl = mbfl_identify_filter_get_vtbl(filter->encoding->no_encoding); + if (vtbl == NULL) { + vtbl = &vtbl_identify_false; + } + mbfl_identify_filter_set_vtbl(filter, vtbl); +} + +mbfl_identify_filter *mbfl_identify_filter_new(enum mbfl_no_encoding encoding) +{ + mbfl_identify_filter * filter; + + /* allocate */ + filter = (mbfl_identify_filter *)mbfl_malloc(sizeof(mbfl_identify_filter)); + if (filter == NULL) { + return NULL; + } + + /* encoding structure */ + filter->encoding = mbfl_no2encoding(encoding); + if (filter->encoding == NULL) { + filter->encoding = &mbfl_encoding_pass; + } + + filter->status = 0; + filter->flag = 0; + filter->score = 0; + + /* setup the function table */ + mbfl_identify_filter_select_vtbl(filter); + + /* constructor */ + (*filter->filter_ctor)(filter); + + return filter; +} + +void mbfl_identify_filter_delete(mbfl_identify_filter *filter) +{ + if (filter) { + (*filter->filter_dtor)(filter); + mbfl_free((void*)filter); + } +} + +void mbfl_filt_ident_common_ctor(mbfl_identify_filter *filter) +{ + filter->status = 0; + filter->flag = 0; +} + +void mbfl_filt_ident_common_dtor(mbfl_identify_filter *filter) +{ + filter->status = 0; +} + +int mbfl_filt_ident_false(int c, mbfl_identify_filter *filter) +{ + filter->flag = 1; /* bad */ + return c; +} + +void mbfl_filt_ident_false_ctor(mbfl_identify_filter *filter) +{ + filter->status = 0; + filter->flag = 1; +} + +int mbfl_filt_ident_true(int c, mbfl_identify_filter *filter) +{ + return c; +} diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_ident.h b/ext/mbstring/libmbfl/mbfl/mbfl_ident.h new file mode 100644 index 0000000000..b876f80d95 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_ident.h @@ -0,0 +1,71 @@ +/* + * "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.h + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.h is included in this package . + * + */ + +#ifndef MBFL_IDENT_H +#define MBFL_IDENT_H + +#include "mbfl_encoding.h" + +/* + * identify filter + */ +typedef struct _mbfl_identify_filter mbfl_identify_filter; + +struct _mbfl_identify_filter { + void (*filter_ctor)(mbfl_identify_filter *filter); + void (*filter_dtor)(mbfl_identify_filter *filter); + int (*filter_function)(int c, mbfl_identify_filter *filter); + int status; + int flag; + int score; + const mbfl_encoding *encoding; +}; + +struct mbfl_identify_vtbl { + enum mbfl_no_encoding encoding; + void (*filter_ctor)(mbfl_identify_filter *filter); + void (*filter_dtor)(mbfl_identify_filter *filter); + int (*filter_function)(int c, mbfl_identify_filter *filter); +}; + +void mbfl_identify_filter_set_vtbl(mbfl_identify_filter *filter, const struct mbfl_identify_vtbl *vtbl); +const struct mbfl_identify_vtbl * mbfl_identify_filter_get_vtbl(enum mbfl_no_encoding encoding); +void mbfl_identify_filter_select_vtbl(mbfl_identify_filter *filter); +mbfl_identify_filter * mbfl_identify_filter_new(enum mbfl_no_encoding encoding); +void mbfl_identify_filter_delete(mbfl_identify_filter *filter); + +void mbfl_filt_ident_common_ctor(mbfl_identify_filter *filter); +void mbfl_filt_ident_common_dtor(mbfl_identify_filter *filter); +void mbfl_filt_ident_false_ctor(mbfl_identify_filter *filter); + +int mbfl_filt_ident_false(int c, mbfl_identify_filter *filter); +int mbfl_filt_ident_true(int c, mbfl_identify_filter *filter); + +#endif /* MBFL_IDENT_H */ diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_language.c b/ext/mbstring/libmbfl/mbfl/mbfl_language.c new file mode 100644 index 0000000000..2a8146b84f --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_language.c @@ -0,0 +1,159 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif + +#include "mbfl_encoding.h" +#include "mbfl_language.h" + +#include "nls/nls_ja.h" +#include "nls/nls_kr.h" +#include "nls/nls_zh.h" +#include "nls/nls_uni.h" +#include "nls/nls_de.h" +#include "nls/nls_ru.h" +#include "nls/nls_en.h" +#include "nls/nls_neutral.h" + +static const mbfl_language *mbfl_language_ptr_table[] = { + &mbfl_language_uni, + &mbfl_language_japanese, + &mbfl_language_korean, + &mbfl_language_simplified_chinese, + &mbfl_language_traditional_chinese, + &mbfl_language_english, + &mbfl_language_german, + &mbfl_language_russian, + &mbfl_language_neutral, + NULL +}; + +/* language resolver */ +const mbfl_language * +mbfl_name2language(const char *name) +{ + const mbfl_language *language; + int i, j; + + if (name == NULL) { + return NULL; + } + + i = 0; + while ((language = mbfl_language_ptr_table[i++]) != NULL){ + if (strcasecmp(language->name, name) == 0) { + return language; + } + } + + i = 0; + while ((language = mbfl_language_ptr_table[i++]) != NULL){ + if (strcasecmp(language->short_name, name) == 0) { + return language; + } + } + + /* serch aliases */ + i = 0; + while ((language = mbfl_language_ptr_table[i++]) != NULL) { + if (language->aliases != NULL) { + j = 0; + while ((*language->aliases)[j] != NULL) { + if (strcasecmp((*language->aliases)[j], name) == 0) { + return language; + } + j++; + } + } + } + + return NULL; +} + +const mbfl_language * +mbfl_no2language(enum mbfl_no_language no_language) +{ + const mbfl_language *language; + int i; + + i = 0; + while ((language = mbfl_language_ptr_table[i++]) != NULL){ + if (language->no_language == no_language) { + return language; + } + } + + return NULL; +} + +enum mbfl_no_language +mbfl_name2no_language(const char *name) +{ + const mbfl_language *language; + + language = mbfl_name2language(name); + if (language == NULL) { + return mbfl_no_language_invalid; + } else { + return language->no_language; + } +} + +const char * +mbfl_no_language2name(enum mbfl_no_language no_language) +{ + const mbfl_language *language; + + language = mbfl_no2language(no_language); + if (language == NULL) { + return ""; + } else { + return language->name; + } +} + diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_language.h b/ext/mbstring/libmbfl/mbfl/mbfl_language.h new file mode 100644 index 0000000000..e5a1237ce0 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_language.h @@ -0,0 +1,83 @@ +/* + * "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.h + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.h is included in this package . + * + */ + +#ifndef MBFL_LANGUAGE_H +#define MBFL_LANGUAGE_H + +#include "mbfl_encoding.h" + +enum mbfl_no_language { + mbfl_no_language_invalid = -1, + mbfl_no_language_neutral, + mbfl_no_language_uni, + mbfl_no_language_min, + mbfl_no_language_catalan, /* ca */ + mbfl_no_language_danish, /* da */ + mbfl_no_language_german, /* de */ + mbfl_no_language_english, /* en */ + mbfl_no_language_estonian, /* et */ + mbfl_no_language_greek, /* el */ + mbfl_no_language_spanish, /* es */ + mbfl_no_language_french, /* fr */ + mbfl_no_language_italian, /* it */ + mbfl_no_language_japanese, /* ja */ + mbfl_no_language_korean, /* ko */ + mbfl_no_language_dutch, /* nl */ + mbfl_no_language_polish, /* pl */ + mbfl_no_language_portuguese, /* pt */ + mbfl_no_language_swedish, /* sv */ + mbfl_no_language_simplified_chinese, /* zh-cn */ + mbfl_no_language_traditional_chinese, /* zh-tw */ + mbfl_no_language_russian, /* ru */ + mbfl_no_language_max +}; + +typedef enum mbfl_no_language mbfl_language_id; + +/* + * language + */ +typedef struct _mbfl_language { + enum mbfl_no_language no_language; + const char *name; + const char *short_name; + const char *(*aliases)[]; + enum mbfl_no_encoding mail_charset; + enum mbfl_no_encoding mail_header_encoding; + enum mbfl_no_encoding mail_body_encoding; +} mbfl_language; + +const mbfl_language * mbfl_name2language(const char *name); +const mbfl_language * mbfl_no2language(enum mbfl_no_language no_language); +enum mbfl_no_language mbfl_name2no_language(const char *name); +const char * mbfl_no_language2name(enum mbfl_no_language no_language); + + +#endif /* MBFL_LANGUAGE_H */ diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c b/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c new file mode 100644 index 0000000000..6d93fa3529 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c @@ -0,0 +1,350 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfl_allocators.h" +#include "mbfl_string.h" +#include "mbfl_memory_device.h" + +/* + * memory device output functions + */ +void +mbfl_memory_device_init(mbfl_memory_device *device, int initsz, int allocsz) +{ + if (device) { + device->length = 0; + device->buffer = (unsigned char *)0; + if (initsz > 0) { + device->buffer = (unsigned char *)mbfl_malloc(initsz*sizeof(unsigned char)); + if (device->buffer != NULL) { + device->length = initsz; + } + } + device->pos= 0; + if (allocsz > MBFL_MEMORY_DEVICE_ALLOC_SIZE) { + device->allocsz = allocsz; + } else { + device->allocsz = MBFL_MEMORY_DEVICE_ALLOC_SIZE; + } + } +} + +void +mbfl_memory_device_realloc(mbfl_memory_device *device, int initsz, int allocsz) +{ + unsigned char *tmp; + + if (device) { + if (initsz > device->length) { + tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, initsz*sizeof(unsigned char)); + if (tmp != NULL) { + device->buffer = tmp; + device->length = initsz; + } + } + if (allocsz > MBFL_MEMORY_DEVICE_ALLOC_SIZE) { + device->allocsz = allocsz; + } else { + device->allocsz = MBFL_MEMORY_DEVICE_ALLOC_SIZE; + } + } +} + +void +mbfl_memory_device_clear(mbfl_memory_device *device) +{ + if (device) { + if (device->buffer) { + mbfl_free(device->buffer); + } + device->buffer = (unsigned char *)0; + device->length = 0; + device->pos = 0; + } +} + +void +mbfl_memory_device_reset(mbfl_memory_device *device) +{ + if (device) { + device->pos = 0; + } +} + +void +mbfl_memory_device_unput(mbfl_memory_device *device) +{ + if (device->pos > 0) { + device->pos--; + } +} + +mbfl_string * +mbfl_memory_device_result(mbfl_memory_device *device, mbfl_string *result) +{ + if (device && result) { + result->len = device->pos; + mbfl_memory_device_output4('\0', device); + result->val = device->buffer; + device->buffer = (unsigned char *)0; + device->length = 0; + device->pos= 0; + if (result->val == NULL) { + result->len = 0; + result = NULL; + } + } else { + result = NULL; + } + + return result; +} + +int +mbfl_memory_device_output(int c, void *data) +{ + mbfl_memory_device *device = (mbfl_memory_device *)data; + + if (device->pos >= device->length) { + /* reallocate buffer */ + int newlen; + unsigned char *tmp; + + newlen = device->length + device->allocsz; + tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); + if (tmp == NULL) { + return -1; + } + device->length = newlen; + device->buffer = tmp; + } + + device->buffer[device->pos++] = (unsigned char)c; + return c; +} + +int +mbfl_memory_device_output2(int c, void *data) +{ + mbfl_memory_device *device = (mbfl_memory_device *)data; + + if ((device->pos + 2) >= device->length) { + /* reallocate buffer */ + int newlen; + unsigned char *tmp; + + newlen = device->length + device->allocsz; + tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); + if (tmp == NULL) { + return -1; + } + device->length = newlen; + device->buffer = tmp; + } + + device->buffer[device->pos++] = (unsigned char)((c >> 8) & 0xff); + device->buffer[device->pos++] = (unsigned char)(c & 0xff); + + return c; +} + +int +mbfl_memory_device_output4(int c, void* data) +{ + mbfl_memory_device *device = (mbfl_memory_device *)data; + + if ((device->pos + 4) >= device->length) { + /* reallocate buffer */ + int newlen; + unsigned char *tmp; + + newlen = device->length + device->allocsz; + tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); + if (tmp == NULL) { + return -1; + } + device->length = newlen; + device->buffer = tmp; + } + + device->buffer[device->pos++] = (unsigned char)((c >> 24) & 0xff); + device->buffer[device->pos++] = (unsigned char)((c >> 16) & 0xff); + device->buffer[device->pos++] = (unsigned char)((c >> 8) & 0xff); + device->buffer[device->pos++] = (unsigned char)(c & 0xff); + + return c; +} + +int +mbfl_memory_device_strcat(mbfl_memory_device *device, const char *psrc) +{ + int len; + unsigned char *w; + const unsigned char *p; + + len = 0; + p = psrc; + while (*p) { + p++; + len++; + } + + if ((device->pos + len) >= device->length) { + /* reallocate buffer */ + int newlen = device->length + (len + MBFL_MEMORY_DEVICE_ALLOC_SIZE)*sizeof(unsigned char); + unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); + if (tmp == NULL) { + return -1; + } + device->length = newlen; + device->buffer = tmp; + } + + p = psrc; + w = &device->buffer[device->pos]; + device->pos += len; + while (len > 0) { + *w++ = *p++; + len--; + } + + return len; +} + +int +mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, int len) +{ + unsigned char *w; + + if ((device->pos + len) >= device->length) { + /* reallocate buffer */ + int newlen = device->length + len + MBFL_MEMORY_DEVICE_ALLOC_SIZE; + unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); + if (tmp == NULL) { + return -1; + } + device->length = newlen; + device->buffer = tmp; + } + + w = &device->buffer[device->pos]; + device->pos += len; + while (len > 0) { + *w++ = *psrc++; + len--; + } + + return len; +} + +int +mbfl_memory_device_devcat(mbfl_memory_device *dest, mbfl_memory_device *src) +{ + int n; + unsigned char *p, *w; + + if ((dest->pos + src->pos) >= dest->length) { + /* reallocate buffer */ + int newlen = dest->length + src->pos + MBFL_MEMORY_DEVICE_ALLOC_SIZE; + unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)dest->buffer, newlen*sizeof(unsigned char)); + if (tmp == NULL) { + return -1; + } + dest->length = newlen; + dest->buffer = tmp; + } + + p = src->buffer; + w = &dest->buffer[dest->pos]; + n = src->pos; + dest->pos += n; + while (n > 0) { + *w++ = *p++; + n--; + } + + return n; +} + +void +mbfl_wchar_device_init(mbfl_wchar_device *device) +{ + if (device) { + device->buffer = (unsigned int *)0; + device->length = 0; + device->pos= 0; + device->allocsz = MBFL_MEMORY_DEVICE_ALLOC_SIZE; + } +} + +void +mbfl_wchar_device_clear(mbfl_wchar_device *device) +{ + if (device) { + if (device->buffer) { + mbfl_free(device->buffer); + } + device->buffer = (unsigned int*)0; + device->length = 0; + device->pos = 0; + } +} + +int +mbfl_wchar_device_output(int c, void *data) +{ + mbfl_wchar_device *device = (mbfl_wchar_device *)data; + + if (device->pos >= device->length) { + /* reallocate buffer */ + int newlen; + unsigned int *tmp; + + newlen = device->length + device->allocsz; + tmp = (unsigned int *)mbfl_realloc((void *)device->buffer, newlen*sizeof(int)); + if (tmp == NULL) { + return -1; + } + device->length = newlen; + device->buffer = tmp; + } + + device->buffer[device->pos++] = c; + + return c; +} diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.h b/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.h new file mode 100644 index 0000000000..b87e4907c7 --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.h @@ -0,0 +1,70 @@ +/* + * "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.h + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.h is included in this package . + * + */ + +#ifndef MBFL_MEMORY_DEVICE_H +#define MBFL_MEMORY_DEVICE_H + +#include "mbfl_string.h" + +#define MBFL_MEMORY_DEVICE_ALLOC_SIZE 64 + +typedef struct _mbfl_memory_device { + unsigned char *buffer; + int length; + int pos; + int allocsz; +} mbfl_memory_device; + +typedef struct _mbfl_wchar_device { + unsigned int *buffer; + int length; + int pos; + int allocsz; +} mbfl_wchar_device; + +void mbfl_memory_device_init(mbfl_memory_device *device, int initsz, int allocsz); +void mbfl_memory_device_realloc(mbfl_memory_device *device, int initsz, int allocsz); +void mbfl_memory_device_clear(mbfl_memory_device *device); +void mbfl_memory_device_reset(mbfl_memory_device *device); +mbfl_string * mbfl_memory_device_result(mbfl_memory_device *device, mbfl_string *result); +int mbfl_memory_device_output(int c, void *data); +int mbfl_memory_device_output2(int c, void *data); +int mbfl_memory_device_output4(int c, void *data); +int mbfl_memory_device_strcat(mbfl_memory_device *device, const char *psrc); +int mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, int len); +int mbfl_memory_device_devcat(mbfl_memory_device *dest, mbfl_memory_device *src); + +void mbfl_wchar_device_init(mbfl_wchar_device *device); +int mbfl_wchar_device_output(int c, void *data); + + + +#endif /* MBFL_MEMORY_DEVICE_H */ + diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_string.c b/ext/mbstring/libmbfl/mbfl/mbfl_string.c new file mode 100644 index 0000000000..e0351a437b --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_string.c @@ -0,0 +1,79 @@ +/* + * "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.c + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.c is included in this package . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfl_allocators.h" +#include "mbfl_string.h" + +/* + * string object + */ +void +mbfl_string_init(mbfl_string *string) +{ + if (string) { + string->no_language = mbfl_no_language_uni; + string->no_encoding = mbfl_no_encoding_pass; + string->val = (unsigned char*)NULL; + string->len = 0; + } +} + +void +mbfl_string_init_set(mbfl_string *string, mbfl_language_id no_language, mbfl_encoding_id no_encoding) +{ + if (string) { + string->no_language = no_language; + string->no_encoding = no_encoding; + string->val = (unsigned char*)NULL; + string->len = 0; + } +} + +void +mbfl_string_clear(mbfl_string *string) +{ + if (string) { + if (string->val != (unsigned char*)NULL) { + mbfl_free(string->val); + } + string->val = (unsigned char*)NULL; + string->len = 0; + } +} + + diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_string.h b/ext/mbstring/libmbfl/mbfl/mbfl_string.h new file mode 100644 index 0000000000..27c7ad1d9c --- /dev/null +++ b/ext/mbstring/libmbfl/mbfl/mbfl_string.h @@ -0,0 +1,55 @@ +/* + * "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.h + * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file + * mbfilter.h is included in this package . + * + */ + +#ifndef MBFL_STRING_H +#define MBFL_STRING_H + +#include "mbfl_encoding.h" +#include "mbfl_language.h" + +/* + * string object + */ +typedef struct _mbfl_string { + enum mbfl_no_language no_language; + enum mbfl_no_encoding no_encoding; + unsigned char *val; + unsigned int len; +} mbfl_string; + +void mbfl_string_init(mbfl_string *string); +void mbfl_string_init_set(mbfl_string *string, mbfl_language_id no_language, mbfl_encoding_id no_encoding); +void mbfl_string_clear(mbfl_string *string); + +#ifndef NULL +#define NULL 0 +#endif + +#endif /* MBFL_STRING_H */ diff --git a/ext/mbstring/libmbfl/missing b/ext/mbstring/libmbfl/missing new file mode 100755 index 0000000000..6a37006e8f --- /dev/null +++ b/ext/mbstring/libmbfl/missing @@ -0,0 +1,336 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program 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 General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.4 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. + You can get \`$1Help2man' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/ext/mbstring/libmbfl/mksbcc32.bat b/ext/mbstring/libmbfl/mksbcc32.bat new file mode 100644 index 0000000000..cdc3dd6ca3 --- /dev/null +++ b/ext/mbstring/libmbfl/mksbcc32.bat @@ -0,0 +1,5 @@ +@echo off +cd %2 +%1 -f Makefile.bcc32 %3 +cd .. +exit diff --git a/ext/mbstring/libmbfl/nls/Makefile.am b/ext/mbstring/libmbfl/nls/Makefile.am new file mode 100644 index 0000000000..14ddba733f --- /dev/null +++ b/ext/mbstring/libmbfl/nls/Makefile.am @@ -0,0 +1,3 @@ +noinst_LTLIBRARIES=libmbfl_nls.la +INCLUDES=-I../mbfl +libmbfl_nls_la_SOURCES=nls_ja.c nls_de.c nls_en.c nls_kr.c nls_ru.c nls_zh.c nls_uni.c nls_neutral.c diff --git a/ext/mbstring/libmbfl/nls/nls_de.c b/ext/mbstring/libmbfl/nls/nls_de.c new file mode 100644 index 0000000000..b559e2dee3 --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_de.c @@ -0,0 +1,23 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfilter.h" +#include "nls_de.h" + +static const char *mbfl_language_german_aliases[] = {"Deutsch", NULL}; + +const mbfl_language mbfl_language_german = { + mbfl_no_language_german, + "German", + "de", + (const char *(*)[])&mbfl_language_german_aliases, + mbfl_no_encoding_8859_15, + mbfl_no_encoding_qprint, + mbfl_no_encoding_8bit +}; + diff --git a/ext/mbstring/libmbfl/nls/nls_de.h b/ext/mbstring/libmbfl/nls/nls_de.h new file mode 100644 index 0000000000..a6c289bfad --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_de.h @@ -0,0 +1,8 @@ +#ifndef MBFL_NLS_DE_H +#define MBFL_NLS_DE_H + +#include "mbfilter.h" + +extern const mbfl_language mbfl_language_german; + +#endif /* MBFL_NLS_DE_H */ diff --git a/ext/mbstring/libmbfl/nls/nls_en.c b/ext/mbstring/libmbfl/nls/nls_en.c new file mode 100644 index 0000000000..0700e4f2c4 --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_en.c @@ -0,0 +1,21 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfilter.h" +#include "nls_en.h" + +const mbfl_language mbfl_language_english = { + mbfl_no_language_english, + "English", + "en", + NULL, + mbfl_no_encoding_8859_1, + mbfl_no_encoding_qprint, + mbfl_no_encoding_8bit +}; + diff --git a/ext/mbstring/libmbfl/nls/nls_en.h b/ext/mbstring/libmbfl/nls/nls_en.h new file mode 100644 index 0000000000..aa9297d5c2 --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_en.h @@ -0,0 +1,8 @@ +#ifndef MBFL_NLS_EN_H +#define MBFL_NLS_EN_H + +#include "mbfilter.h" + +extern const mbfl_language mbfl_language_english; + +#endif /* MBFL_NLS_EN_H */ diff --git a/ext/mbstring/libmbfl/nls/nls_ja.c b/ext/mbstring/libmbfl/nls/nls_ja.c new file mode 100644 index 0000000000..d5541fa73a --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_ja.c @@ -0,0 +1,20 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfilter.h" +#include "nls_ja.h" + +const mbfl_language mbfl_language_japanese = { + mbfl_no_language_japanese, + "Japanese", + "ja", + NULL, + mbfl_no_encoding_2022jp, + mbfl_no_encoding_base64, + mbfl_no_encoding_7bit +}; diff --git a/ext/mbstring/libmbfl/nls/nls_ja.h b/ext/mbstring/libmbfl/nls/nls_ja.h new file mode 100644 index 0000000000..bf1c9e909c --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_ja.h @@ -0,0 +1,8 @@ +#ifndef MBFL_NLS_JA_H +#define MBFL_NLS_JA_H + +#include "mbfilter.h" + +extern const mbfl_language mbfl_language_japanese; + +#endif /* MBFL_NLS_JA_H */ diff --git a/ext/mbstring/libmbfl/nls/nls_kr.c b/ext/mbstring/libmbfl/nls/nls_kr.c new file mode 100644 index 0000000000..afff43af48 --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_kr.c @@ -0,0 +1,21 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfilter.h" +#include "nls_kr.h" + +const mbfl_language mbfl_language_korean = { + mbfl_no_language_korean, + "Korean", + "ko", + NULL, + mbfl_no_encoding_2022kr, + mbfl_no_encoding_base64, + mbfl_no_encoding_7bit +}; + diff --git a/ext/mbstring/libmbfl/nls/nls_kr.h b/ext/mbstring/libmbfl/nls/nls_kr.h new file mode 100644 index 0000000000..1aeb357d85 --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_kr.h @@ -0,0 +1,8 @@ +#ifndef MBFL_NLS_KR_H +#define MBFL_NLS_KR_H + +#include "mbfilter.h" + +extern const mbfl_language mbfl_language_korean; + +#endif /* MBFL_NLS_KR_H */ diff --git a/ext/mbstring/libmbfl/nls/nls_neutral.c b/ext/mbstring/libmbfl/nls/nls_neutral.c new file mode 100644 index 0000000000..87a6a194c3 --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_neutral.c @@ -0,0 +1,21 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfilter.h" +#include "nls_neutral.h" + +const mbfl_language mbfl_language_neutral = { + mbfl_no_language_neutral, + "neutral", + "neutral", + NULL, + mbfl_no_encoding_utf8, + mbfl_no_encoding_base64, + mbfl_no_encoding_base64 +}; + diff --git a/ext/mbstring/libmbfl/nls/nls_neutral.h b/ext/mbstring/libmbfl/nls/nls_neutral.h new file mode 100644 index 0000000000..50c6499a6d --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_neutral.h @@ -0,0 +1,8 @@ +#ifndef MBFL_NLS_NEUTRAL_H +#define MBFL_NLS_NEUTRAL_H + +#include "mbfilter.h" + +extern const mbfl_language mbfl_language_neutral; + +#endif /* MBFL_NLS_NEUTRAL_H */ diff --git a/ext/mbstring/libmbfl/nls/nls_ru.c b/ext/mbstring/libmbfl/nls/nls_ru.c new file mode 100644 index 0000000000..7e4cf9c3b0 --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_ru.c @@ -0,0 +1,20 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfilter.h" +#include "nls_ru.h" + +const mbfl_language mbfl_language_russian = { + mbfl_no_language_russian, + "Russian", + "ru", + NULL, + mbfl_no_encoding_koi8r, + mbfl_no_encoding_qprint, + mbfl_no_encoding_8bit +}; diff --git a/ext/mbstring/libmbfl/nls/nls_ru.h b/ext/mbstring/libmbfl/nls/nls_ru.h new file mode 100644 index 0000000000..ba21b9a3d4 --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_ru.h @@ -0,0 +1,9 @@ +#ifndef MBFL_NLS_RU_H +#define MBFL_NLS_RU_H + +#include "mbfilter.h" +#include "nls_ru.h" + +extern const mbfl_language mbfl_language_russian; + +#endif /* MBFL_NLS_RU_H */ diff --git a/ext/mbstring/libmbfl/nls/nls_uni.c b/ext/mbstring/libmbfl/nls/nls_uni.c new file mode 100644 index 0000000000..6a0100105b --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_uni.c @@ -0,0 +1,23 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfilter.h" +#include "nls_uni.h" + +static const char *mbfl_language_uni_aliases[] = {"universal", NULL}; + +const mbfl_language mbfl_language_uni = { + mbfl_no_language_uni, + "uni", + "uni", + (const char *(*)[])&mbfl_language_uni_aliases, + mbfl_no_encoding_utf8, + mbfl_no_encoding_base64, + mbfl_no_encoding_base64 +}; + diff --git a/ext/mbstring/libmbfl/nls/nls_uni.h b/ext/mbstring/libmbfl/nls/nls_uni.h new file mode 100644 index 0000000000..1e3f94dc8e --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_uni.h @@ -0,0 +1,8 @@ +#ifndef MBFL_NLS_UNI_H +#define MBFL_NLS_UNI_H + +#include "mbfilter.h" + +extern const mbfl_language mbfl_language_uni; + +#endif /* MBFL_NLS_UNI_H */ diff --git a/ext/mbstring/libmbfl/nls/nls_zh.c b/ext/mbstring/libmbfl/nls/nls_zh.c new file mode 100644 index 0000000000..d9a49931ea --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_zh.c @@ -0,0 +1,31 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfilter.h" +#include "nls_zh.h" + +const mbfl_language mbfl_language_simplified_chinese = { + mbfl_no_language_simplified_chinese, + "Simplified Chinese", + "zh-cn", + NULL, + mbfl_no_encoding_hz, + mbfl_no_encoding_base64, + mbfl_no_encoding_7bit +}; + +const mbfl_language mbfl_language_traditional_chinese = { + mbfl_no_language_traditional_chinese, + "Traditional Chinese", + "zh-tw", + NULL, + mbfl_no_encoding_big5, + mbfl_no_encoding_base64, + mbfl_no_encoding_8bit +}; + diff --git a/ext/mbstring/libmbfl/nls/nls_zh.h b/ext/mbstring/libmbfl/nls/nls_zh.h new file mode 100644 index 0000000000..218160295f --- /dev/null +++ b/ext/mbstring/libmbfl/nls/nls_zh.h @@ -0,0 +1,9 @@ +#ifndef MBFL_NLS_ZH_H +#define MBFL_NLS_ZH_H + +#include "mbfilter.h" + +extern const mbfl_language mbfl_language_simplified_chinese; +extern const mbfl_language mbfl_language_traditional_chinese; + +#endif /* MBFL_NLS_ZH_H */ diff --git a/ext/mbstring/libmbfl/rules.mak.bcc32 b/ext/mbstring/libmbfl/rules.mak.bcc32 new file mode 100644 index 0000000000..506b1bc40e --- /dev/null +++ b/ext/mbstring/libmbfl/rules.mak.bcc32 @@ -0,0 +1,7 @@ +.suffixes .c +CFLAGS=-DHAVE_CONFIG_H -DMBFL_DLL_EXPORT -u +INCLUDES=-I. -I.. +LIBS=import32.lib cw32mt.lib c0d32.obj +LDFLAGS=-c -Tpd -Gn +.c.obj: + bcc32 $(CFLAGS) $(INCLUDES) -c $< diff --git a/ext/mbstring/libmbfl/tests/sample.c b/ext/mbstring/libmbfl/tests/sample.c new file mode 100644 index 0000000000..54f809378a --- /dev/null +++ b/ext/mbstring/libmbfl/tests/sample.c @@ -0,0 +1,38 @@ +/* + this is a small sample script to use libmbfl. + Rui Hirokawa <hirokawa@php.net> + + this file is encoded in EUC-JP. + */ + +#include <stdio.h> +#include "../mbfl/mbfilter.h" + +int main() +{ + enum mbfl_no_encoding from_encoding, to_encoding; + enum mbfl_no_language no_language; + mbfl_buffer_converter *convd = NULL; + mbfl_string string, result, *ret; + mbfl_language lang; + unsigned char input[] = "ÆüËܸìʸ»úÎó"; /* EUC-JP kanji string */ + + no_language = mbfl_name2no_language("Japanese"); + from_encoding = mbfl_name2no_encoding("EUC-JP"); + to_encoding = mbfl_name2no_encoding("SJIS"); + + mbfl_string_init(&string); + mbfl_string_init(&result); + + string.no_encoding = from_encoding; + string.no_language = no_language; + string.val = (unsigned char *)input; + string.len = strlen(input); + + convd = mbfl_buffer_converter_new(from_encoding, to_encoding, 0); + ret = mbfl_buffer_converter_feed_result(convd, &string, &result); + mbfl_buffer_converter_delete(convd); + + puts(ret->val); + return 1; +} diff --git a/ext/mbstring/mbfilter.c b/ext/mbstring/mbfilter.c deleted file mode 100644 index 427221dee8..0000000000 --- a/ext/mbstring/mbfilter.c +++ /dev/null @@ -1,9677 +0,0 @@ -/* - * charset=UTF-8 - * vim600: encoding=utf-8 - */ - -/* - * "streamable kanji code filter and converter" - * - * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved. - * - * This software is released under the GNU Lesser General Public License. - * (Version 2.1, February 1999) - * Please read the following detail of the licence (in japanese). - * - * ◆使用許諾æ¡ä»¶â—† - * - * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•れã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ - * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•トウェアã«é–¢ - * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ - * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•トウェアを使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利 - * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•トウェアを使用 - * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - * - * ã“ã®ã‚½ãƒ•トウェアを「GNU Lesser General Public License (Version 2.1, February - * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser - * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢ - * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ - * - * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã - * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“れã¾ã§Library General - * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚ - * http://www.gnu.org/ --- GNUウェブサイト - * http://www.gnu.org/copyleft/lesser.html --- ãƒ©ã‚¤ã‚»ãƒ³ã‚¹æ–‡é¢ - * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。 - * - * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプãƒã‚¸ã‚§ã‚¯ãƒˆã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§ - * ã¯ã‚りã¾ã›ã‚“。 - * - * â—†ä¿è¨¼å†…容◆ - * - * ã“ã®ã‚½ãƒ•トウェアã¯ã€æœŸå¾…ã•れãŸå‹•作・機能・性能をæŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨è¨ˆã•れ - * 開発ã•れã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚りã¾ã›ã‚“。ã“ã®ã‚½ãƒ•トウェアã¯ã€Œã“ - * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•れã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定㮠- * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•らã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•れãŸã‚Šæš—é»™ã«ç¤ºã•れã¦ã„ - * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åйã§ã™ã€‚ã“ã®ã‚½ãƒ•トウェアを使用ã—ãŸçµæžœãªã„ã—使 - * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æå®³ - * ã€ãƒ‡ãƒ¼ã‚¿ã®æå¤±ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æå®³ã«ã¤ã„ã¦ã¯ã€ãã®æå®³ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€… - * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è¦å‘Šã•れã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æå®³ã®è³ - * 償ãŠã‚ˆã³è£œå¡«ã‚’行ã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ» - * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚ - * - * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—† - * - * 〒102-0073 - * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F - * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ - * Phone: 03-3512-3655, Fax: 03-3512-3656 - * Email: sales@happysize.co.jp - * Web: http://happysize.com/ - * - * ◆著者◆ - * - * 金本 茂 <sgk@happysize.co.jp> - * - * ◆履æ´â—† - * - * 1998/11/10 sgk implementation in C++ - * 1999/4/25 sgk Cã§æ›¸ããªãŠã—。 - * 1999/4/26 sgk 入力フィルタを実装。漢å—コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’è¿½åŠ ã€‚ - * 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚ - * 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚ - * - */ - -/* - * Unicode support - * - * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team. - * All rights reserved. - * - */ - -/* $Id$ */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_globals.h" - -#ifdef HAVE_MBSTRING - -#include <stdlib.h> -#include "mbfilter.h" - -#if defined(HAVE_MBSTR_JA) -#include "mbfilter_ja.h" -#endif -#if defined(HAVE_MBSTR_CN) -#include "mbfilter_cn.h" -#endif -#if defined(HAVE_MBSTR_TW) -#include "mbfilter_tw.h" -#endif -#if defined(HAVE_MBSTR_KR) -#include "mbfilter_kr.h" -#endif -#if defined(HAVE_MBSTR_RU) -#include "mbfilter_ru.h" -#endif - -#include "zend.h" - -#ifdef PHP_WIN32 -#include "win95nt.h" -#endif - -#define mbfl_malloc emalloc -#define mbfl_realloc erealloc -#define mbfl_calloc ecalloc -#define mbfl_free efree - -#define mbfl_pmalloc malloc -#define mbfl_prealloc realloc -#define mbfl_pfree free - -#include "unicode_table.h" - -/* language structure */ -static const mbfl_language mbfl_language_neutral = { - mbfl_no_language_neutral, - "neutral", - "neutral", - NULL, - mbfl_no_encoding_utf8, - mbfl_no_encoding_base64, - mbfl_no_encoding_base64 -}; - -static const char *mbfl_language_uni_aliases[] = {"universal", NULL}; - -static const mbfl_language mbfl_language_uni = { - mbfl_no_language_uni, - "uni", - "uni", - (const char *(*)[])&mbfl_language_uni_aliases, - mbfl_no_encoding_utf8, - mbfl_no_encoding_base64, - mbfl_no_encoding_base64 -}; - -static const mbfl_language mbfl_language_japanese = { - mbfl_no_language_japanese, - "Japanese", - "ja", - NULL, - mbfl_no_encoding_2022jp, - mbfl_no_encoding_base64, - mbfl_no_encoding_7bit -}; - -static const mbfl_language mbfl_language_korean = { - mbfl_no_language_korean, - "Korean", - "ko", - NULL, - mbfl_no_encoding_2022kr, - mbfl_no_encoding_base64, - mbfl_no_encoding_7bit -}; - -static const mbfl_language mbfl_language_english = { - mbfl_no_language_english, - "English", - "en", - NULL, - mbfl_no_encoding_8859_1, - mbfl_no_encoding_qprint, - mbfl_no_encoding_8bit -}; - -static const char *mbfl_language_german_aliases[] = {"Deutsch", NULL}; - -static const mbfl_language mbfl_language_german = { - mbfl_no_language_german, - "German", - "de", - (const char *(*)[])&mbfl_language_german_aliases, - mbfl_no_encoding_8859_15, - mbfl_no_encoding_qprint, - mbfl_no_encoding_8bit -}; - -static mbfl_language mbfl_language_simplified_chinese = { - mbfl_no_language_simplified_chinese, - "Simplified Chinese", - "zh-cn", - NULL, - mbfl_no_encoding_hz, - mbfl_no_encoding_base64, - mbfl_no_encoding_7bit -}; - -static mbfl_language mbfl_language_traditional_chinese = { - mbfl_no_language_traditional_chinese, - "Traditional Chinese", - "zh-tw", - NULL, - mbfl_no_encoding_big5, - mbfl_no_encoding_base64, - mbfl_no_encoding_8bit -}; - -static mbfl_language mbfl_language_russian = { - mbfl_no_language_russian, - "Russian", - "ru", - NULL, - mbfl_no_encoding_koi8r, - mbfl_no_encoding_qprint, - mbfl_no_encoding_8bit -}; - -static const mbfl_language *mbfl_language_ptr_table[] = { - &mbfl_language_uni, - &mbfl_language_japanese, - &mbfl_language_korean, - &mbfl_language_simplified_chinese, - &mbfl_language_traditional_chinese, - &mbfl_language_english, - &mbfl_language_german, - &mbfl_language_russian, - &mbfl_language_neutral, - NULL -}; - - -/* encoding byte width table */ -static const unsigned char mblen_table_utf8[] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 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, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1 -}; - -static const unsigned char mblen_table_eucjp[] = { /* 0xA1-0xFE */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 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, 3, - 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, 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, 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 -}; - -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 unsigned char mblen_table_euccn[] = { /* 0xA1-0xFE */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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 -}; - -static const unsigned char mblen_table_cp936[] = { /* 0x81-0xFE */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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, 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 -}; - -static const unsigned char mblen_table_euctw[] = { /* 0xA1-0xFE */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 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, 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, 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 -}; - -static const unsigned char mblen_table_big5[] = { /* 0x81-0xFE */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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, 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 -}; - - -static const unsigned char mblen_table_euckr[] = { /* 0xA1-0xFE */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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 -}; - -static const unsigned char mblen_table_uhc[] = { /* 0x81-0xFE */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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, 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 -}; - -static const unsigned char mblen_table_html[] = { /* 0x00, 0x80 - 0xFF, only valid for numeric entities */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 -}; - -/* encoding structure */ -static const char *mbfl_encoding_pass_aliases[] = {"none", NULL}; - -static const mbfl_encoding mbfl_encoding_pass = { - mbfl_no_encoding_pass, - "pass", - NULL, - (const char *(*)[])&mbfl_encoding_pass_aliases, - NULL, - 0 -}; - -static const char *mbfl_encoding_auto_aliases[] = {"unknown", NULL}; - -static const mbfl_encoding mbfl_encoding_auto = { - mbfl_no_encoding_auto, - "auto", - NULL, - (const char *(*)[])&mbfl_encoding_auto_aliases, - NULL, - 0 -}; - -static const mbfl_encoding mbfl_encoding_wchar = { - mbfl_no_encoding_wchar, - "wchar", - NULL, - NULL, - NULL, - MBFL_ENCTYPE_WCS4BE -}; - -static const mbfl_encoding mbfl_encoding_byte2be = { - mbfl_no_encoding_byte2be, - "byte2be", - NULL, - NULL, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const mbfl_encoding mbfl_encoding_byte2le = { - mbfl_no_encoding_byte2le, - "byte2le", - NULL, - NULL, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const mbfl_encoding mbfl_encoding_byte4be = { - mbfl_no_encoding_byte4be, - "byte4be", - NULL, - NULL, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const mbfl_encoding mbfl_encoding_byte4le = { - mbfl_no_encoding_byte4le, - "byte4le", - NULL, - NULL, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const mbfl_encoding mbfl_encoding_base64 = { - mbfl_no_encoding_base64, - "BASE64", - "BASE64", - NULL, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const mbfl_encoding mbfl_encoding_uuencode = { - mbfl_no_encoding_uuencode, - "UUENCODE", - "x-uuencode", - NULL, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_html_ent_aliases[] = {"HTML", "html", NULL}; - -static const mbfl_encoding mbfl_encoding_html_ent = { - mbfl_no_encoding_html_ent, - "HTML-ENTITIES", - "US-ASCII", - (const char *(*)[])&mbfl_encoding_html_ent_aliases, - NULL, /* mblen_table_html, Do not use table instead calulate length based on entities actually used */ - MBFL_ENCTYPE_HTML_ENT -}; - -static const char *mbfl_encoding_qprint_aliases[] = {"qprint", NULL}; - -static const mbfl_encoding mbfl_encoding_qprint = { - mbfl_no_encoding_qprint, - "Quoted-Printable", - "Quoted-Printable", - (const char *(*)[])&mbfl_encoding_qprint_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const mbfl_encoding mbfl_encoding_7bit = { - mbfl_no_encoding_7bit, - "7bit", - "7bit", - NULL, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const mbfl_encoding mbfl_encoding_8bit = { - mbfl_no_encoding_8bit, - "8bit", - "8bit", - NULL, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_ucs2_aliases[] = {"ISO-10646-UCS-2", "UCS2" , "UNICODE", NULL}; - -static const mbfl_encoding mbfl_encoding_ucs2 = { - mbfl_no_encoding_ucs2, - "UCS-2", - "UCS-2", - (const char *(*)[])&mbfl_encoding_ucs2_aliases, - NULL, - MBFL_ENCTYPE_WCS2BE -}; - -static const mbfl_encoding mbfl_encoding_ucs2be = { - mbfl_no_encoding_ucs2be, - "UCS-2BE", - "UCS-2BE", - NULL, - NULL, - MBFL_ENCTYPE_WCS2BE -}; - -static const mbfl_encoding mbfl_encoding_ucs2le = { - mbfl_no_encoding_ucs2le, - "UCS-2LE", - "UCS-2LE", - NULL, - NULL, - MBFL_ENCTYPE_WCS2LE -}; - -static const char *mbfl_encoding_ucs4_aliases[] = {"ISO-10646-UCS-4", "UCS4", NULL}; - -static const mbfl_encoding mbfl_encoding_ucs4 = { - mbfl_no_encoding_ucs4, - "UCS-4", - "UCS-4", - (const char *(*)[])&mbfl_encoding_ucs4_aliases, - NULL, - MBFL_ENCTYPE_WCS4BE -}; - -static const mbfl_encoding mbfl_encoding_ucs4be = { - mbfl_no_encoding_ucs4be, - "UCS-4BE", - "UCS-4BE", - NULL, - NULL, - MBFL_ENCTYPE_WCS4BE -}; - -static const mbfl_encoding mbfl_encoding_ucs4le = { - mbfl_no_encoding_ucs4le, - "UCS-4LE", - "UCS-4LE", - NULL, - NULL, - MBFL_ENCTYPE_WCS4LE -}; - -static const char *mbfl_encoding_utf32_aliases[] = {"utf32", NULL}; - -static const mbfl_encoding mbfl_encoding_utf32 = { - mbfl_no_encoding_utf32, - "UTF-32", - "UTF-32", - (const char *(*)[])&mbfl_encoding_utf32_aliases, - NULL, - MBFL_ENCTYPE_WCS4BE -}; - -static const mbfl_encoding mbfl_encoding_utf32be = { - mbfl_no_encoding_utf32be, - "UTF-32BE", - "UTF-32BE", - NULL, - NULL, - MBFL_ENCTYPE_WCS4BE -}; - -static const mbfl_encoding mbfl_encoding_utf32le = { - mbfl_no_encoding_utf32le, - "UTF-32LE", - "UTF-32LE", - NULL, - NULL, - MBFL_ENCTYPE_WCS4LE -}; - -static const char *mbfl_encoding_utf16_aliases[] = {"utf16", NULL}; - -static const mbfl_encoding mbfl_encoding_utf16 = { - mbfl_no_encoding_utf16, - "UTF-16", - "UTF-16", - (const char *(*)[])&mbfl_encoding_utf16_aliases, - NULL, - MBFL_ENCTYPE_MWC2BE -}; - -static const mbfl_encoding mbfl_encoding_utf16be = { - mbfl_no_encoding_utf16be, - "UTF-16BE", - "UTF-16BE", - NULL, - NULL, - MBFL_ENCTYPE_MWC2BE -}; - -static const mbfl_encoding mbfl_encoding_utf16le = { - mbfl_no_encoding_utf16le, - "UTF-16LE", - "UTF-16LE", - NULL, - NULL, - MBFL_ENCTYPE_MWC2LE -}; - -static const char *mbfl_encoding_utf8_aliases[] = {"utf8", NULL}; - -static const mbfl_encoding mbfl_encoding_utf8 = { - mbfl_no_encoding_utf8, - "UTF-8", - "UTF-8", - (const char *(*)[])&mbfl_encoding_utf8_aliases, - mblen_table_utf8, - MBFL_ENCTYPE_MBCS -}; - -static const char *mbfl_encoding_utf7_aliases[] = {"utf7", NULL}; - -static const mbfl_encoding mbfl_encoding_utf7 = { - mbfl_no_encoding_utf7, - "UTF-7", - "UTF-7", - (const char *(*)[])&mbfl_encoding_utf7_aliases, - NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE -}; - -static const mbfl_encoding mbfl_encoding_utf7imap = { - mbfl_no_encoding_utf7imap, - "UTF7-IMAP", - NULL, - NULL, - NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE -}; - - -static const char *mbfl_encoding_ascii_aliases[] = {"ANSI_X3.4-1968", "iso-ir-6", "ANSI_X3.4-1986", "ISO_646.irv:1991", "US-ASCII", "ISO646-US", "us", "IBM367", "cp367", "csASCII", NULL}; - -static const mbfl_encoding mbfl_encoding_ascii = { - mbfl_no_encoding_ascii, - "ASCII", - "US-ASCII", /* preferred MIME name */ - (const char *(*)[])&mbfl_encoding_ascii_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -#if defined(HAVE_MBSTR_JA) -static const char *mbfl_encoding_euc_jp_aliases[] = {"EUC", "EUC_JP", "eucJP", "x-euc-jp", NULL}; - -static const mbfl_encoding mbfl_encoding_euc_jp = { - mbfl_no_encoding_euc_jp, - "EUC-JP", - "EUC-JP", - (const char *(*)[])&mbfl_encoding_euc_jp_aliases, - mblen_table_eucjp, - MBFL_ENCTYPE_MBCS -}; - -static const char *mbfl_encoding_sjis_aliases[] = {"x-sjis", "SHIFT-JIS", NULL}; - -static const mbfl_encoding mbfl_encoding_sjis = { - mbfl_no_encoding_sjis, - "SJIS", - "Shift_JIS", - (const char *(*)[])&mbfl_encoding_sjis_aliases, - mblen_table_sjis, - MBFL_ENCTYPE_MBCS -}; - -static const char *mbfl_encoding_eucjp_win_aliases[] = {"eucJP-open", NULL}; - -static const mbfl_encoding mbfl_encoding_eucjp_win = { - mbfl_no_encoding_eucjp_win, - "eucJP-win", - "EUC-JP", - (const char *(*)[])&mbfl_encoding_eucjp_win_aliases, - mblen_table_eucjp, - MBFL_ENCTYPE_MBCS -}; - -static const char *mbfl_encoding_sjis_win_aliases[] = {"SJIS-open", "MS_Kanji", "Windows-31J", "CP932", NULL}; - -static const mbfl_encoding mbfl_encoding_sjis_win = { - mbfl_no_encoding_sjis_win, - "SJIS-win", - "Shift_JIS", - (const char *(*)[])&mbfl_encoding_sjis_win_aliases, - mblen_table_sjis, - MBFL_ENCTYPE_MBCS -}; - -static const mbfl_encoding mbfl_encoding_jis = { - mbfl_no_encoding_jis, - "JIS", - "ISO-2022-JP", - NULL, - NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE -}; - -static const mbfl_encoding mbfl_encoding_2022jp = { - mbfl_no_encoding_2022jp, - "ISO-2022-JP", - "ISO-2022-JP", - NULL, - NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE -}; -#endif /* HAVE_MBSTR_JA */ - - -#if defined(HAVE_MBSTR_CN) -static const char *mbfl_encoding_euc_cn_aliases[] = {"CN-GB", "EUC_CN", "eucCN", "x-euc-cn", "gb2312", NULL}; - -static mbfl_encoding mbfl_encoding_euc_cn = { - mbfl_no_encoding_euc_cn, - "EUC-CN", - "CN-GB", - (const char *(*)[])&mbfl_encoding_euc_cn_aliases, - mblen_table_euccn, - MBFL_ENCTYPE_MBCS -}; - -static const char *mbfl_encoding_cp936_aliases[] = {"CP-936", NULL}; - -static mbfl_encoding mbfl_encoding_cp936 = { - mbfl_no_encoding_cp936, - "CP936", - "CP936", - (const char *(*)[])&mbfl_encoding_cp936_aliases, - mblen_table_cp936, - MBFL_ENCTYPE_MBCS -}; - -static mbfl_encoding mbfl_encoding_hz = { - mbfl_no_encoding_hz, - "HZ", - "HZ-GB-2312", - NULL, - NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE -}; - -#endif /* HAVE_MBSTR_CN */ - -#if defined(HAVE_MBSTR_TW) -static const char *mbfl_encoding_euc_tw_aliases[] = {"EUC_TW", "eucTW", "x-euc-tw", NULL}; - -static mbfl_encoding mbfl_encoding_euc_tw = { - mbfl_no_encoding_euc_tw, - "EUC-TW", - "EUC-TW", - (const char *(*)[])&mbfl_encoding_euc_tw_aliases, - mblen_table_euctw, - MBFL_ENCTYPE_MBCS -}; - -static const char *mbfl_encoding_big5_aliases[] = {"CN-BIG5", "BIG-FIVE", "BIGFIVE", "CP950", NULL}; - -static mbfl_encoding mbfl_encoding_big5 = { - mbfl_no_encoding_big5, - "BIG-5", - "BIG5", - (const char *(*)[])&mbfl_encoding_big5_aliases, - mblen_table_big5, - MBFL_ENCTYPE_MBCS -}; - -#endif /* HAVE_MBSTR_TW */ - -#if defined(HAVE_MBSTR_KR) -static const char *mbfl_encoding_euc_kr_aliases[] = {"EUC_KR", "eucKR", "x-euc-kr", NULL}; - -static const mbfl_encoding mbfl_encoding_euc_kr = { - mbfl_no_encoding_euc_kr, - "EUC-KR", - "EUC-KR", - (const char *(*)[])&mbfl_encoding_euc_kr_aliases, - mblen_table_euckr, - MBFL_ENCTYPE_MBCS -}; - -static const char *mbfl_encoding_uhc_aliases[] = {"CP949", NULL}; - -static const mbfl_encoding mbfl_encoding_uhc = { - mbfl_no_encoding_uhc, - "UHC", - "UHC", - (const char *(*)[])&mbfl_encoding_uhc_aliases, - mblen_table_uhc, - MBFL_ENCTYPE_MBCS -}; - -static const mbfl_encoding mbfl_encoding_2022kr = { - mbfl_no_encoding_2022kr, - "ISO-2022-KR", - "ISO-2022-KR", - NULL, - NULL, - MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE -}; - -#endif /* HAVE_MBSTR_KR */ - -static const char *mbfl_encoding_cp1252_aliases[] = {"cp1252", NULL}; - -static const mbfl_encoding mbfl_encoding_cp1252 = { - mbfl_no_encoding_cp1252, - "Windows-1252", - "Windows-1252", - (const char *(*)[])&mbfl_encoding_cp1252_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_8859_1_aliases[] = {"ISO_8859-1", "latin1", NULL}; - -static const mbfl_encoding mbfl_encoding_8859_1 = { - mbfl_no_encoding_8859_1, - "ISO-8859-1", - "ISO-8859-1", - (const char *(*)[])&mbfl_encoding_8859_1_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_8859_2_aliases[] = {"ISO_8859-2", "latin2", NULL}; - -static const mbfl_encoding mbfl_encoding_8859_2 = { - mbfl_no_encoding_8859_2, - "ISO-8859-2", - "ISO-8859-2", - (const char *(*)[])&mbfl_encoding_8859_2_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_8859_3_aliases[] = {"ISO_8859-3", "latin3", NULL}; - -static const mbfl_encoding mbfl_encoding_8859_3 = { - mbfl_no_encoding_8859_3, - "ISO-8859-3", - "ISO-8859-3", - (const char *(*)[])&mbfl_encoding_8859_3_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_8859_4_aliases[] = {"ISO_8859-4", "latin4", NULL}; - -static const mbfl_encoding mbfl_encoding_8859_4 = { - mbfl_no_encoding_8859_4, - "ISO-8859-4", - "ISO-8859-4", - (const char *(*)[])&mbfl_encoding_8859_4_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_8859_5_aliases[] = {"ISO_8859-5", "cyrillic", NULL}; - -static const mbfl_encoding mbfl_encoding_8859_5 = { - mbfl_no_encoding_8859_5, - "ISO-8859-5", - "ISO-8859-5", - (const char *(*)[])&mbfl_encoding_8859_5_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_8859_6_aliases[] = {"ISO_8859-6", "arabic", NULL}; - -static const mbfl_encoding mbfl_encoding_8859_6 = { - mbfl_no_encoding_8859_6, - "ISO-8859-6", - "ISO-8859-6", - (const char *(*)[])&mbfl_encoding_8859_6_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_8859_7_aliases[] = {"ISO_8859-7", "greek", NULL}; - -static const mbfl_encoding mbfl_encoding_8859_7 = { - mbfl_no_encoding_8859_7, - "ISO-8859-7", - "ISO-8859-7", - (const char *(*)[])&mbfl_encoding_8859_7_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_8859_8_aliases[] = {"ISO_8859-8", "hebrew", NULL}; - -static const mbfl_encoding mbfl_encoding_8859_8 = { - mbfl_no_encoding_8859_8, - "ISO-8859-8", - "ISO-8859-8", - (const char *(*)[])&mbfl_encoding_8859_8_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_8859_9_aliases[] = {"ISO_8859-9", "latin5", NULL}; - -static const mbfl_encoding mbfl_encoding_8859_9 = { - mbfl_no_encoding_8859_9, - "ISO-8859-9", - "ISO-8859-9", - (const char *(*)[])&mbfl_encoding_8859_9_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_8859_10_aliases[] = {"ISO_8859-10", "latin6", NULL}; - -static const mbfl_encoding mbfl_encoding_8859_10 = { - mbfl_no_encoding_8859_10, - "ISO-8859-10", - "ISO-8859-10", - (const char *(*)[])&mbfl_encoding_8859_10_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_8859_13_aliases[] = {"ISO_8859-13", NULL}; - -static const mbfl_encoding mbfl_encoding_8859_13 = { - mbfl_no_encoding_8859_13, - "ISO-8859-13", - "ISO-8859-13", - (const char *(*)[])&mbfl_encoding_8859_13_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_8859_14_aliases[] = {"ISO_8859-14", "latin8", NULL}; - -static const mbfl_encoding mbfl_encoding_8859_14 = { - mbfl_no_encoding_8859_14, - "ISO-8859-14", - "ISO-8859-14", - (const char *(*)[])&mbfl_encoding_8859_14_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_8859_15_aliases[] = {"ISO_8859-15", NULL}; - -static const mbfl_encoding mbfl_encoding_8859_15 = { - mbfl_no_encoding_8859_15, - "ISO-8859-15", - "ISO-8859-15", - (const char *(*)[])&mbfl_encoding_8859_15_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -#if defined(HAVE_MBSTR_RU) -static const char *mbfl_encoding_cp1251_aliases[] = {"CP1251", "CP-1251", "WINDOWS-1251", NULL}; - -static const mbfl_encoding mbfl_encoding_cp1251 = { - mbfl_no_encoding_cp1251, - "Windows-1251", - "Windows-1251", - (const char *(*)[])&mbfl_encoding_cp1251_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_cp866_aliases[] = {"CP866", "CP-866", "IBM-866", NULL}; - -static const mbfl_encoding mbfl_encoding_cp866 = { - mbfl_no_encoding_cp866, - "CP866", - "CP866", - (const char *(*)[])&mbfl_encoding_cp866_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; - -static const char *mbfl_encoding_koi8r_aliases[] = {"KOI8-R", "KOI8R", NULL}; - -static const mbfl_encoding mbfl_encoding_koi8r = { - mbfl_no_encoding_koi8r, - "KOI8-R", - "KOI8-R", - (const char *(*)[])&mbfl_encoding_koi8r_aliases, - NULL, - MBFL_ENCTYPE_SBCS -}; -#endif - -static const mbfl_encoding *mbfl_encoding_ptr_list[] = { - &mbfl_encoding_pass, - &mbfl_encoding_auto, - &mbfl_encoding_wchar, - &mbfl_encoding_byte2be, - &mbfl_encoding_byte2le, - &mbfl_encoding_byte4be, - &mbfl_encoding_byte4le, - &mbfl_encoding_base64, - &mbfl_encoding_uuencode, - &mbfl_encoding_html_ent, - &mbfl_encoding_qprint, - &mbfl_encoding_7bit, - &mbfl_encoding_8bit, - &mbfl_encoding_ucs4, - &mbfl_encoding_ucs4be, - &mbfl_encoding_ucs4le, - &mbfl_encoding_ucs2, - &mbfl_encoding_ucs2be, - &mbfl_encoding_ucs2le, - &mbfl_encoding_utf32, - &mbfl_encoding_utf32be, - &mbfl_encoding_utf32le, - &mbfl_encoding_utf16, - &mbfl_encoding_utf16be, - &mbfl_encoding_utf16le, - &mbfl_encoding_utf8, - &mbfl_encoding_utf7, - &mbfl_encoding_utf7imap, - &mbfl_encoding_ascii, -#if defined(HAVE_MBSTR_JA) - &mbfl_encoding_euc_jp, - &mbfl_encoding_sjis, - &mbfl_encoding_eucjp_win, - &mbfl_encoding_sjis_win, - &mbfl_encoding_jis, - &mbfl_encoding_2022jp, -#endif - &mbfl_encoding_cp1252, - &mbfl_encoding_8859_1, - &mbfl_encoding_8859_2, - &mbfl_encoding_8859_3, - &mbfl_encoding_8859_4, - &mbfl_encoding_8859_5, - &mbfl_encoding_8859_6, - &mbfl_encoding_8859_7, - &mbfl_encoding_8859_8, - &mbfl_encoding_8859_9, - &mbfl_encoding_8859_10, - &mbfl_encoding_8859_13, - &mbfl_encoding_8859_14, - &mbfl_encoding_8859_15, -#if defined(HAVE_MBSTR_CN) - &mbfl_encoding_euc_cn, - &mbfl_encoding_cp936, - &mbfl_encoding_hz, -#endif -#if defined(HAVE_MBSTR_TW) - &mbfl_encoding_euc_tw, - &mbfl_encoding_big5, -#endif -#if defined(HAVE_MBSTR_KR) - &mbfl_encoding_euc_kr, - &mbfl_encoding_uhc, - &mbfl_encoding_2022kr, -#endif -#if defined(HAVE_MBSTR_RU) - &mbfl_encoding_cp1251, - &mbfl_encoding_cp866, - &mbfl_encoding_koi8r, -#endif - NULL -}; - -/* hex character table "0123456789ABCDEF" */ -static char mbfl_hexchar_table[] = { - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46 -}; - -/* forward */ -static void mbfl_filt_conv_common_ctor(mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_common_flush(mbfl_convert_filter *filter TSRMLS_DC); -static void mbfl_filt_conv_common_dtor(mbfl_convert_filter *filter TSRMLS_DC); - -static int mbfl_filt_conv_pass(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_byte2be(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_byte2be_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_byte2le(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_byte2le_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_byte4be(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_byte4be_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_byte4le(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_byte4le_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_any_7bit(int c, mbfl_convert_filter *filter TSRMLS_DC); - -static int mbfl_filt_conv_base64enc(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_base64enc_flush(mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_base64dec(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_base64dec_flush(mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_uudec(int c, mbfl_convert_filter *filter TSRMLS_DC); - -static void mbfl_filt_conv_html_dec_ctor(mbfl_convert_filter *filter TSRMLS_DC); -static void mbfl_filt_conv_html_dec_dtor(mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_html_enc(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_html_enc_flush(mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_html_dec(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_html_dec_flush(mbfl_convert_filter *filter TSRMLS_DC); - -static int mbfl_filt_conv_qprintenc(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_qprintenc_flush(mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_qprintdec(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_qprintdec_flush(mbfl_convert_filter *filter TSRMLS_DC); - -static int mbfl_filt_conv_ucs4_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_ucs4be(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_ucs4le(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_ucs2_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_ucs2be(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_ucs2le(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_utf16_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_utf16be_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_utf16be(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_utf16le_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_utf16le(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_utf8(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_utf7_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_utf7(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_utf7_flush(mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_utf7imap_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_utf7imap(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_utf7imap_flush(mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_ascii(int c, mbfl_convert_filter *filter TSRMLS_DC); - -static int mbfl_filt_conv_wchar_cp1252(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_cp1252_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_8859_1(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_8859_2_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_8859_2(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_8859_3_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_8859_3(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_8859_4_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_8859_4(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_8859_5_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_8859_5(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_8859_6_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_8859_6(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_8859_7_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_8859_7(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_8859_8_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_8859_8(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_8859_9_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_8859_9(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_8859_10_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_8859_10(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_8859_13_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_8859_13(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_8859_14_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_8859_14(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_8859_15_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -static int mbfl_filt_conv_wchar_8859_15(int c, mbfl_convert_filter *filter TSRMLS_DC); - -static void mbfl_filt_ident_common_ctor(mbfl_identify_filter *filter TSRMLS_DC); -static void mbfl_filt_ident_common_dtor(mbfl_identify_filter *filter TSRMLS_DC); -static void mbfl_filt_ident_false_ctor(mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_utf8(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_utf7(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_ascii(int c, mbfl_identify_filter *filter TSRMLS_DC); -#if defined(HAVE_MBSTR_JA) -static int mbfl_filt_ident_eucjp(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_sjis(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_sjiswin(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_jis(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_2022jp(int c, mbfl_identify_filter *filter TSRMLS_DC); -#endif /* HAVE_MBSTR_JA */ - -#if defined(HAVE_MBSTR_CN) -static int mbfl_filt_ident_euccn(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_cp936(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_hz(int c, mbfl_identify_filter *filter TSRMLS_DC); -#endif /* HAVE_MBSTR_CN */ - -#if defined(HAVE_MBSTR_TW) -static int mbfl_filt_ident_euctw(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_big5(int c, mbfl_identify_filter *filter TSRMLS_DC); -#endif /* HAVE_MBSTR_TW */ - -#if defined(HAVE_MBSTR_KR) -static int mbfl_filt_ident_euckr(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_uhc(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_2022kr(int c, mbfl_identify_filter *filter TSRMLS_DC); -#endif /* HAVE_MBSTR_KR */ - -#if defined(HAVE_MBSTR_RU) -static int mbfl_filt_ident_cp1251(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_cp866(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_koi8r(int c, mbfl_identify_filter *filter TSRMLS_DC); -#endif /* HAVE_MBSTR_RU */ - -static int mbfl_filt_ident_cp1252(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_false(int c, mbfl_identify_filter *filter TSRMLS_DC); -static int mbfl_filt_ident_true(int c, mbfl_identify_filter *filter TSRMLS_DC); - -/* convert filter function table */ -static const struct mbfl_convert_vtbl vtbl_pass = { - mbfl_no_encoding_pass, - mbfl_no_encoding_pass, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_pass, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_byte2be_wchar = { - mbfl_no_encoding_byte2be, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_byte2be_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_byte2be = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_byte2be, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_byte2be, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_byte2le_wchar = { - mbfl_no_encoding_byte2le, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_byte2le_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_byte2le = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_byte2le, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_byte2le, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_byte4be_wchar = { - mbfl_no_encoding_byte4be, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_byte4be_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_byte4be = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_byte4be, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_byte4be, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_byte4le_wchar = { - mbfl_no_encoding_byte4le, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_byte4le_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_byte4le = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_byte4le, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_byte4le, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_8bit_b64 = { - mbfl_no_encoding_8bit, - mbfl_no_encoding_base64, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_base64enc, - mbfl_filt_conv_base64enc_flush }; - -static const struct mbfl_convert_vtbl vtbl_b64_8bit = { - mbfl_no_encoding_base64, - mbfl_no_encoding_8bit, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_base64dec, - mbfl_filt_conv_base64dec_flush }; - -static const struct mbfl_convert_vtbl vtbl_uuencode_8bit = { - mbfl_no_encoding_uuencode, - mbfl_no_encoding_8bit, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_uudec, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_html = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_html_ent, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_html_enc, - mbfl_filt_conv_html_enc_flush }; - -static const struct mbfl_convert_vtbl vtbl_html_wchar = { - mbfl_no_encoding_html_ent, - mbfl_no_encoding_wchar, - mbfl_filt_conv_html_dec_ctor, - mbfl_filt_conv_html_dec_dtor, - mbfl_filt_conv_html_dec, - mbfl_filt_conv_html_dec_flush }; - -static const struct mbfl_convert_vtbl vtbl_8bit_qprint = { - mbfl_no_encoding_8bit, - mbfl_no_encoding_qprint, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_qprintenc, - mbfl_filt_conv_qprintenc_flush }; - -static const struct mbfl_convert_vtbl vtbl_qprint_8bit = { - mbfl_no_encoding_qprint, - mbfl_no_encoding_8bit, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_qprintdec, - mbfl_filt_conv_qprintdec_flush }; - -static const struct mbfl_convert_vtbl vtbl_8bit_7bit = { - mbfl_no_encoding_8bit, - mbfl_no_encoding_7bit, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_any_7bit, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_7bit_8bit = { - mbfl_no_encoding_7bit, - mbfl_no_encoding_8bit, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_pass, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_ucs4_wchar = { - mbfl_no_encoding_ucs4, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_ucs4_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_ucs4 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_ucs4, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_ucs4be, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_ucs4be_wchar = { - mbfl_no_encoding_ucs4be, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_byte4be_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_ucs4be = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_ucs4be, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_ucs4be, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_ucs4le_wchar = { - mbfl_no_encoding_ucs4le, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_byte4le_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_ucs4le = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_ucs4le, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_ucs4le, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_ucs2_wchar = { - mbfl_no_encoding_ucs2, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_ucs2_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_ucs2 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_ucs2, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_ucs2be, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_ucs2be_wchar = { - mbfl_no_encoding_ucs2be, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_byte2be_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_ucs2be = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_ucs2be, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_ucs2be, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_ucs2le_wchar = { - mbfl_no_encoding_ucs2le, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_byte2le_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_ucs2le = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_ucs2le, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_ucs2le, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_utf32_wchar = { - mbfl_no_encoding_utf32, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_ucs4_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_utf32 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_utf32, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_ucs4be, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_utf32be_wchar = { - mbfl_no_encoding_utf32be, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_byte4be_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_utf32be = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_utf32be, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_ucs4be, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_utf32le_wchar = { - mbfl_no_encoding_utf32le, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_byte4le_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_utf32le = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_utf32le, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_ucs4le, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_utf16_wchar = { - mbfl_no_encoding_utf16, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_utf16_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_utf16 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_utf16, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_utf16be, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_utf16be_wchar = { - mbfl_no_encoding_utf16be, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_utf16be_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_utf16be = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_utf16be, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_utf16be, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_utf16le_wchar = { - mbfl_no_encoding_utf16le, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_utf16le_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_utf16le = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_utf16le, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_utf16le, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_utf8_wchar = { - mbfl_no_encoding_utf8, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_utf8_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_utf8 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_utf8, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_utf8, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_utf7_wchar = { - mbfl_no_encoding_utf7, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_utf7_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_utf7 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_utf7, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_utf7, - mbfl_filt_conv_wchar_utf7_flush }; - -static const struct mbfl_convert_vtbl vtbl_utf7imap_wchar = { - mbfl_no_encoding_utf7imap, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_utf7imap_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_utf7imap = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_utf7imap, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_utf7imap, - mbfl_filt_conv_wchar_utf7imap_flush }; - -static const struct mbfl_convert_vtbl vtbl_ascii_wchar = { - mbfl_no_encoding_ascii, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_pass, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_ascii = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_ascii, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_ascii, - mbfl_filt_conv_common_flush }; - -#if defined(HAVE_MBSTR_JA) -static const struct mbfl_convert_vtbl vtbl_eucjp_wchar = { - mbfl_no_encoding_euc_jp, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_eucjp_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_eucjp = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_euc_jp, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_eucjp, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_sjis_wchar = { - mbfl_no_encoding_sjis, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_sjis_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_sjis = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_sjis, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_sjis, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_jis_wchar = { - mbfl_no_encoding_jis, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_jis_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_jis = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_jis, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_jis, - mbfl_filt_conv_any_jis_flush }; - -static const struct mbfl_convert_vtbl vtbl_2022jp_wchar = { - mbfl_no_encoding_2022jp, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_jis_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_2022jp = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_2022jp, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_2022jp, - mbfl_filt_conv_any_jis_flush }; - -static const struct mbfl_convert_vtbl vtbl_eucjpwin_wchar = { - mbfl_no_encoding_eucjp_win, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_eucjpwin_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_eucjpwin = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_eucjp_win, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_eucjpwin, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_sjiswin_wchar = { - mbfl_no_encoding_sjis_win, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_sjiswin_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_sjiswin = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_sjis_win, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_sjiswin, - mbfl_filt_conv_common_flush }; -#endif /* HAVE_MBSTR_JA */ - -#if defined(HAVE_MBSTR_CN) -static const struct mbfl_convert_vtbl vtbl_euccn_wchar = { - mbfl_no_encoding_euc_cn, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_euccn_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_euccn = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_euc_cn, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_euccn, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_cp936_wchar = { - mbfl_no_encoding_cp936, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_cp936_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_cp936 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_cp936, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_cp936, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_hz_wchar = { - mbfl_no_encoding_hz, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_hz_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_hz = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_hz, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_hz, - mbfl_filt_conv_any_hz_flush }; - -#endif /* HAVE_MBSTR_CN */ - -#if defined(HAVE_MBSTR_TW) -static const struct mbfl_convert_vtbl vtbl_euctw_wchar = { - mbfl_no_encoding_euc_tw, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_euctw_wchar, - mbfl_filt_conv_common_flush }; - -static struct mbfl_convert_vtbl vtbl_wchar_euctw = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_euc_tw, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_euctw, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_big5_wchar = { - mbfl_no_encoding_big5, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_big5_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_big5 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_big5, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_big5, - mbfl_filt_conv_common_flush }; -#endif /* HAVE_MBSTR_TW */ - -#if defined(HAVE_MBSTR_KR) -static const struct mbfl_convert_vtbl vtbl_euckr_wchar = { - mbfl_no_encoding_euc_kr, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_euckr_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_euckr = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_euc_kr, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_euckr, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_uhc_wchar = { - mbfl_no_encoding_uhc, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_uhc_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_uhc = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_uhc, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_uhc, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_2022kr = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_2022kr, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_2022kr, - mbfl_filt_conv_any_2022kr_flush }; - -static const struct mbfl_convert_vtbl vtbl_2022kr_wchar = { - mbfl_no_encoding_2022kr, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_2022kr_wchar, - mbfl_filt_conv_common_flush }; -#endif /* HAVE_MBSTR_KR */ - -#if defined(HAVE_MBSTR_RU) -static const struct mbfl_convert_vtbl vtbl_wchar_cp1251 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_cp1251, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_cp1251, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_cp1251_wchar = { - mbfl_no_encoding_cp1251, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_cp1251_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_cp866 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_cp866, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_cp866, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_cp866_wchar = { - mbfl_no_encoding_cp866, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_cp866_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_koi8r = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_koi8r, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_koi8r, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_koi8r_wchar = { - mbfl_no_encoding_koi8r, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_koi8r_wchar, - mbfl_filt_conv_common_flush }; -#endif /* HAVE_MBSTR_RU */ - -static const struct mbfl_convert_vtbl vtbl_cp1252_wchar = { - mbfl_no_encoding_cp1252, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_cp1252_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_cp1252 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_cp1252, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_cp1252, - mbfl_filt_conv_common_flush }; - - -static const struct mbfl_convert_vtbl vtbl_8859_1_wchar = { - mbfl_no_encoding_8859_1, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_pass, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_8859_1 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_8859_1, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_8859_1, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_8859_2_wchar = { - mbfl_no_encoding_8859_2, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_8859_2_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_8859_2 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_8859_2, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_8859_2, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_8859_3_wchar = { - mbfl_no_encoding_8859_3, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_8859_3_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_8859_3 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_8859_3, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_8859_3, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_8859_4_wchar = { - mbfl_no_encoding_8859_4, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_8859_4_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_8859_4 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_8859_4, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_8859_4, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_8859_5_wchar = { - mbfl_no_encoding_8859_5, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_8859_5_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_8859_5 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_8859_5, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_8859_5, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_8859_6_wchar = { - mbfl_no_encoding_8859_6, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_8859_6_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_8859_6 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_8859_6, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_8859_6, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_8859_7_wchar = { - mbfl_no_encoding_8859_7, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_8859_7_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_8859_7 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_8859_7, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_8859_7, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_8859_8_wchar = { - mbfl_no_encoding_8859_8, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_8859_8_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_8859_8 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_8859_8, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_8859_8, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_8859_9_wchar = { - mbfl_no_encoding_8859_9, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_8859_9_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_8859_9 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_8859_9, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_8859_9, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_8859_10_wchar = { - mbfl_no_encoding_8859_10, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_8859_10_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_8859_10 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_8859_10, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_8859_10, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_8859_13_wchar = { - mbfl_no_encoding_8859_13, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_8859_13_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_8859_13 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_8859_13, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_8859_13, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_8859_14_wchar = { - mbfl_no_encoding_8859_14, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_8859_14_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_8859_14 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_8859_14, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_8859_14, - mbfl_filt_conv_common_flush }; - -static struct mbfl_convert_vtbl vtbl_8859_15_wchar = { - mbfl_no_encoding_8859_15, - mbfl_no_encoding_wchar, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_8859_15_wchar, - mbfl_filt_conv_common_flush }; - -static const struct mbfl_convert_vtbl vtbl_wchar_8859_15 = { - mbfl_no_encoding_wchar, - mbfl_no_encoding_8859_15, - mbfl_filt_conv_common_ctor, - mbfl_filt_conv_common_dtor, - mbfl_filt_conv_wchar_8859_15, - mbfl_filt_conv_common_flush }; - - -static const struct mbfl_convert_vtbl *mbfl_convert_filter_list[] = { - &vtbl_utf8_wchar, - &vtbl_wchar_utf8, -#if defined(HAVE_MBSTR_JA) - &vtbl_eucjp_wchar, - &vtbl_wchar_eucjp, - &vtbl_sjis_wchar, - &vtbl_wchar_sjis, - &vtbl_jis_wchar, - &vtbl_wchar_jis, - &vtbl_2022jp_wchar, - &vtbl_wchar_2022jp, - &vtbl_eucjpwin_wchar, - &vtbl_wchar_eucjpwin, - &vtbl_sjiswin_wchar, - &vtbl_wchar_sjiswin, -#endif -#if defined(HAVE_MBSTR_CN) - &vtbl_euccn_wchar, - &vtbl_wchar_euccn, - &vtbl_cp936_wchar, - &vtbl_wchar_cp936, - &vtbl_hz_wchar, - &vtbl_wchar_hz, -#endif -#if defined(HAVE_MBSTR_TW) - &vtbl_euctw_wchar, - &vtbl_wchar_euctw, - &vtbl_big5_wchar, - &vtbl_wchar_big5, -#endif -#if defined(HAVE_MBSTR_KR) - &vtbl_euckr_wchar, - &vtbl_wchar_euckr, - &vtbl_uhc_wchar, - &vtbl_wchar_uhc, - &vtbl_2022kr_wchar, - &vtbl_wchar_2022kr, -#endif -#if defined(HAVE_MBSTR_RU) - &vtbl_cp1251_wchar, - &vtbl_wchar_cp1251, - &vtbl_cp866_wchar, - &vtbl_wchar_cp866, - &vtbl_koi8r_wchar, - &vtbl_wchar_koi8r, -#endif - &vtbl_cp1252_wchar, - &vtbl_wchar_cp1252, - &vtbl_ascii_wchar, - &vtbl_wchar_ascii, - &vtbl_8859_1_wchar, - &vtbl_wchar_8859_1, - &vtbl_8859_2_wchar, - &vtbl_wchar_8859_2, - &vtbl_8859_3_wchar, - &vtbl_wchar_8859_3, - &vtbl_8859_4_wchar, - &vtbl_wchar_8859_4, - &vtbl_8859_5_wchar, - &vtbl_wchar_8859_5, - &vtbl_8859_6_wchar, - &vtbl_wchar_8859_6, - &vtbl_8859_7_wchar, - &vtbl_wchar_8859_7, - &vtbl_8859_8_wchar, - &vtbl_wchar_8859_8, - &vtbl_8859_9_wchar, - &vtbl_wchar_8859_9, - &vtbl_8859_10_wchar, - &vtbl_wchar_8859_10, - &vtbl_8859_13_wchar, - &vtbl_wchar_8859_13, - &vtbl_8859_14_wchar, - &vtbl_wchar_8859_14, - &vtbl_8859_15_wchar, - &vtbl_wchar_8859_15, - &vtbl_8bit_b64, - &vtbl_b64_8bit, - &vtbl_uuencode_8bit, - &vtbl_wchar_html, - &vtbl_html_wchar, - &vtbl_8bit_qprint, - &vtbl_qprint_8bit, - &vtbl_8bit_7bit, - &vtbl_7bit_8bit, - &vtbl_utf7_wchar, - &vtbl_wchar_utf7, - &vtbl_utf7imap_wchar, - &vtbl_wchar_utf7imap, - &vtbl_utf16_wchar, - &vtbl_wchar_utf16, - &vtbl_utf16be_wchar, - &vtbl_wchar_utf16be, - &vtbl_utf16le_wchar, - &vtbl_wchar_utf16le, - &vtbl_utf32_wchar, - &vtbl_wchar_utf32, - &vtbl_utf32be_wchar, - &vtbl_wchar_utf32be, - &vtbl_utf32le_wchar, - &vtbl_wchar_utf32le, - &vtbl_ucs4_wchar, - &vtbl_wchar_ucs4, - &vtbl_ucs4be_wchar, - &vtbl_wchar_ucs4be, - &vtbl_ucs4le_wchar, - &vtbl_wchar_ucs4le, - &vtbl_ucs2_wchar, - &vtbl_wchar_ucs2, - &vtbl_ucs2be_wchar, - &vtbl_wchar_ucs2be, - &vtbl_ucs2le_wchar, - &vtbl_wchar_ucs2le, - &vtbl_byte4be_wchar, - &vtbl_wchar_byte4be, - &vtbl_byte4le_wchar, - &vtbl_wchar_byte4le, - &vtbl_byte2be_wchar, - &vtbl_wchar_byte2be, - &vtbl_byte2le_wchar, - &vtbl_wchar_byte2le, - &vtbl_pass, - NULL -}; - - -/* identify filter function table */ -static const struct mbfl_identify_vtbl vtbl_identify_ascii = { - mbfl_no_encoding_ascii, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_ascii }; - -static const struct mbfl_identify_vtbl vtbl_identify_utf8 = { - mbfl_no_encoding_utf8, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_utf8 }; - -static const struct mbfl_identify_vtbl vtbl_identify_utf7 = { - mbfl_no_encoding_utf7, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_utf7 }; - -#if defined(HAVE_MBSTR_JA) -static const struct mbfl_identify_vtbl vtbl_identify_eucjp = { - mbfl_no_encoding_euc_jp, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_eucjp }; - -static const struct mbfl_identify_vtbl vtbl_identify_eucjpwin = { - mbfl_no_encoding_eucjp_win, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_eucjp }; - -static const struct mbfl_identify_vtbl vtbl_identify_sjis = { - mbfl_no_encoding_sjis, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_sjis }; - -static const struct mbfl_identify_vtbl vtbl_identify_sjiswin = { - mbfl_no_encoding_sjis_win, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_sjiswin }; - -static const struct mbfl_identify_vtbl vtbl_identify_jis = { - mbfl_no_encoding_jis, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_jis }; - -static const struct mbfl_identify_vtbl vtbl_identify_2022jp = { - mbfl_no_encoding_2022jp, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_2022jp }; -#endif /* HAVE_MBSTR_JA */ - -#if defined(HAVE_MBSTR_CN) -static struct mbfl_identify_vtbl vtbl_identify_euccn = { - mbfl_no_encoding_euc_cn, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_euccn }; - -static struct mbfl_identify_vtbl vtbl_identify_cp936 = { - mbfl_no_encoding_cp936, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_cp936 }; - -static struct mbfl_identify_vtbl vtbl_identify_hz = { - mbfl_no_encoding_hz, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_hz }; - -#endif /* HAVE_MBSTR_CN */ - -#if defined(HAVE_MBSTR_TW) -static struct mbfl_identify_vtbl vtbl_identify_euctw = { - mbfl_no_encoding_euc_tw, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_euctw }; - -static struct mbfl_identify_vtbl vtbl_identify_big5 = { - mbfl_no_encoding_big5, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_big5 }; -#endif /* HAVE_MBSTR_TW */ - -#if defined(HAVE_MBSTR_KR) -static struct mbfl_identify_vtbl vtbl_identify_euckr = { - mbfl_no_encoding_euc_kr, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_euckr }; - -static struct mbfl_identify_vtbl vtbl_identify_uhc = { - mbfl_no_encoding_uhc, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_uhc }; - -static struct mbfl_identify_vtbl vtbl_identify_2022kr = { - mbfl_no_encoding_2022kr, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_2022kr }; - -#endif /* HAVE_MBSTR_KR */ - -#if defined(HAVE_MBSTR_RU) -static struct mbfl_identify_vtbl vtbl_identify_cp1251 = { - mbfl_no_encoding_cp1251, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_cp1251 }; - -static struct mbfl_identify_vtbl vtbl_identify_cp866 = { - mbfl_no_encoding_cp866, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_cp866 }; - -static struct mbfl_identify_vtbl vtbl_identify_koi8r = { - mbfl_no_encoding_koi8r, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_koi8r }; -#endif /* HAVE_MBSTR_RU */ - -static const struct mbfl_identify_vtbl vtbl_identify_cp1252 = { - mbfl_no_encoding_cp1252, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_cp1252 }; - -static const struct mbfl_identify_vtbl vtbl_identify_8859_1 = { - mbfl_no_encoding_8859_1, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_true }; - -static const struct mbfl_identify_vtbl vtbl_identify_8859_2 = { - mbfl_no_encoding_8859_2, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_true }; - -static const struct mbfl_identify_vtbl vtbl_identify_8859_3 = { - mbfl_no_encoding_8859_3, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_true }; - -static const struct mbfl_identify_vtbl vtbl_identify_8859_4 = { - mbfl_no_encoding_8859_4, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_true }; - -static const struct mbfl_identify_vtbl vtbl_identify_8859_5 = { - mbfl_no_encoding_8859_5, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_true }; - -static const struct mbfl_identify_vtbl vtbl_identify_8859_6 = { - mbfl_no_encoding_8859_6, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_true }; - -static const struct mbfl_identify_vtbl vtbl_identify_8859_7 = { - mbfl_no_encoding_8859_7, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_true }; - -static const struct mbfl_identify_vtbl vtbl_identify_8859_8 = { - mbfl_no_encoding_8859_8, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_true }; - -static const struct mbfl_identify_vtbl vtbl_identify_8859_9 = { - mbfl_no_encoding_8859_9, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_true }; - -static const struct mbfl_identify_vtbl vtbl_identify_8859_10 = { - mbfl_no_encoding_8859_10, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_true }; - -static const struct mbfl_identify_vtbl vtbl_identify_8859_13 = { - mbfl_no_encoding_8859_13, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_true }; - -static const struct mbfl_identify_vtbl vtbl_identify_8859_14 = { - mbfl_no_encoding_8859_14, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_true }; - -static const struct mbfl_identify_vtbl vtbl_identify_8859_15 = { - mbfl_no_encoding_8859_15, - mbfl_filt_ident_common_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_true }; - -static const struct mbfl_identify_vtbl vtbl_identify_false = { - mbfl_no_encoding_pass, - mbfl_filt_ident_false_ctor, - mbfl_filt_ident_common_dtor, - mbfl_filt_ident_false }; - -static const struct mbfl_identify_vtbl *mbfl_identify_filter_list[] = { - &vtbl_identify_utf8, - &vtbl_identify_utf7, - &vtbl_identify_ascii, -#if defined(HAVE_MBSTR_JA) - &vtbl_identify_eucjp, - &vtbl_identify_sjis, - &vtbl_identify_eucjpwin, - &vtbl_identify_sjiswin, - &vtbl_identify_jis, - &vtbl_identify_2022jp, -#endif -#if defined(HAVE_MBSTR_CN) - &vtbl_identify_euccn, - &vtbl_identify_cp936, - &vtbl_identify_hz, -#endif -#if defined(HAVE_MBSTR_TW) - &vtbl_identify_euctw, - &vtbl_identify_big5, -#endif -#if defined(HAVE_MBSTR_KR) - &vtbl_identify_euckr, - &vtbl_identify_uhc, - &vtbl_identify_2022kr, -#endif -#if defined(HAVE_MBSTR_RU) - &vtbl_identify_cp1251, - &vtbl_identify_cp866, - &vtbl_identify_koi8r, -#endif - &vtbl_identify_cp1252, - &vtbl_identify_8859_1, - &vtbl_identify_8859_2, - &vtbl_identify_8859_3, - &vtbl_identify_8859_4, - &vtbl_identify_8859_5, - &vtbl_identify_8859_6, - &vtbl_identify_8859_7, - &vtbl_identify_8859_8, - &vtbl_identify_8859_9, - &vtbl_identify_8859_10, - &vtbl_identify_8859_13, - &vtbl_identify_8859_14, - &vtbl_identify_8859_15, - &vtbl_identify_false, - NULL -}; - - -/* language resolver */ -const mbfl_language * -mbfl_name2language(const char *name) -{ - const mbfl_language *language; - int i, j; - - if (name == NULL) { - return NULL; - } - - i = 0; - while ((language = mbfl_language_ptr_table[i++]) != NULL){ - if (strcasecmp(language->name, name) == 0) { - return language; - } - } - - i = 0; - while ((language = mbfl_language_ptr_table[i++]) != NULL){ - if (strcasecmp(language->short_name, name) == 0) { - return language; - } - } - - /* serch aliases */ - i = 0; - while ((language = mbfl_language_ptr_table[i++]) != NULL) { - if (language->aliases != NULL) { - j = 0; - while ((*language->aliases)[j] != NULL) { - if (strcasecmp((*language->aliases)[j], name) == 0) { - return language; - } - j++; - } - } - } - - return NULL; -} - -const mbfl_language * -mbfl_no2language(enum mbfl_no_language no_language) -{ - const mbfl_language *language; - int i; - - i = 0; - while ((language = mbfl_language_ptr_table[i++]) != NULL){ - if (language->no_language == no_language) { - return language; - } - } - - return NULL; -} - -enum mbfl_no_language -mbfl_name2no_language(const char *name) -{ - const mbfl_language *language; - - language = mbfl_name2language(name); - if (language == NULL) { - return mbfl_no_language_invalid; - } else { - return language->no_language; - } -} - -const char * -mbfl_no_language2name(enum mbfl_no_language no_language) -{ - const mbfl_language *language; - - language = mbfl_no2language(no_language); - if (language == NULL) { - return ""; - } else { - return language->name; - } -} - - - -/* encoding resolver */ -const mbfl_encoding * -mbfl_name2encoding(const char *name) -{ - const mbfl_encoding *encoding; - int i, j; - - if (name == NULL) { - return NULL; - } - - i = 0; - while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL){ - if (strcasecmp(encoding->name, name) == 0) { - return encoding; - } - } - - /* serch MIME charset name */ - i = 0; - while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) { - if (encoding->mime_name != NULL) { - if (strcasecmp(encoding->mime_name, name) == 0) { - return encoding; - } - } - } - - /* serch aliases */ - i = 0; - while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) { - if (encoding->aliases != NULL) { - j = 0; - while ((*encoding->aliases)[j] != NULL) { - if (strcasecmp((*encoding->aliases)[j], name) == 0) { - return encoding; - } - j++; - } - } - } - - return NULL; -} - -const mbfl_encoding * -mbfl_no2encoding(enum mbfl_no_encoding no_encoding) -{ - const mbfl_encoding *encoding; - int i; - - i = 0; - while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL){ - if (encoding->no_encoding == no_encoding) { - return encoding; - } - } - - return NULL; -} - -enum mbfl_no_encoding -mbfl_name2no_encoding(const char *name) -{ - const mbfl_encoding *encoding; - - encoding = mbfl_name2encoding(name); - if (encoding == NULL) { - return mbfl_no_encoding_invalid; - } else { - return encoding->no_encoding; - } -} - -const char * -mbfl_no_encoding2name(enum mbfl_no_encoding no_encoding) -{ - const mbfl_encoding *encoding; - - encoding = mbfl_no2encoding(no_encoding); - if (encoding == NULL) { - return ""; - } else { - return encoding->name; - } -} - -const char * -mbfl_no2preferred_mime_name(enum mbfl_no_encoding no_encoding) -{ - const mbfl_encoding *encoding; - - encoding = mbfl_no2encoding(no_encoding); - if (encoding != NULL && encoding->mime_name != NULL && encoding->mime_name[0] != '\0') { - return encoding->mime_name; - } else { - return NULL; - } -} - -int -mbfl_is_support_encoding(const char *name) -{ - const mbfl_encoding *encoding; - - encoding = mbfl_name2encoding(name); - if (encoding == NULL) { - return 0; - } else { - return 1; - } -} - - - -/* - * memory device output functions - */ -void -mbfl_memory_device_init(mbfl_memory_device *device, int initsz, int allocsz TSRMLS_DC) -{ - if (device) { - device->length = 0; - device->buffer = (unsigned char *)0; - if (initsz > 0) { - device->buffer = (unsigned char *)mbfl_malloc(initsz*sizeof(unsigned char)); - if (device->buffer != NULL) { - device->length = initsz; - } - } - device->pos= 0; - if (allocsz > MBFL_MEMORY_DEVICE_ALLOC_SIZE) { - device->allocsz = allocsz; - } else { - device->allocsz = MBFL_MEMORY_DEVICE_ALLOC_SIZE; - } - } -} - -void -mbfl_memory_device_realloc(mbfl_memory_device *device, int initsz, int allocsz TSRMLS_DC) -{ - unsigned char *tmp; - - if (device) { - if (initsz > device->length) { - tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, initsz*sizeof(unsigned char)); - if (tmp != NULL) { - device->buffer = tmp; - device->length = initsz; - } - } - if (allocsz > MBFL_MEMORY_DEVICE_ALLOC_SIZE) { - device->allocsz = allocsz; - } else { - device->allocsz = MBFL_MEMORY_DEVICE_ALLOC_SIZE; - } - } -} - -void -mbfl_memory_device_clear(mbfl_memory_device *device TSRMLS_DC) -{ - if (device) { - if (device->buffer) { - mbfl_free(device->buffer); - } - device->buffer = (unsigned char *)0; - device->length = 0; - device->pos = 0; - } -} - -void -mbfl_memory_device_reset(mbfl_memory_device *device TSRMLS_DC) -{ - if (device) { - device->pos = 0; - } -} - -void -mbfl_memory_device_unput(mbfl_memory_device *device TSRMLS_DC) -{ - if (device->pos > 0) { - device->pos--; - } -} - -mbfl_string * -mbfl_memory_device_result(mbfl_memory_device *device, mbfl_string *result TSRMLS_DC) -{ - if (device && result) { - result->len = device->pos; - mbfl_memory_device_output4('\0', device TSRMLS_CC); - result->val = device->buffer; - device->buffer = (unsigned char *)0; - device->length = 0; - device->pos= 0; - if (result->val == NULL) { - result->len = 0; - result = NULL; - } - } else { - result = NULL; - } - - return result; -} - -int -mbfl_memory_device_output(int c, void *data TSRMLS_DC) -{ - mbfl_memory_device *device = (mbfl_memory_device *)data; - - if (device->pos >= device->length) { - /* reallocate buffer */ - int newlen; - unsigned char *tmp; - - newlen = device->length + device->allocsz; - tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); - if (tmp == NULL) { - return -1; - } - device->length = newlen; - device->buffer = tmp; - } - - device->buffer[device->pos++] = (unsigned char)c; - return c; -} - -int -mbfl_memory_device_output2(int c, void *data TSRMLS_DC) -{ - mbfl_memory_device *device = (mbfl_memory_device *)data; - - if ((device->pos + 2) >= device->length) { - /* reallocate buffer */ - int newlen; - unsigned char *tmp; - - newlen = device->length + device->allocsz; - tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); - if (tmp == NULL) { - return -1; - } - device->length = newlen; - device->buffer = tmp; - } - - device->buffer[device->pos++] = (unsigned char)((c >> 8) & 0xff); - device->buffer[device->pos++] = (unsigned char)(c & 0xff); - - return c; -} - -int -mbfl_memory_device_output4(int c, void* data TSRMLS_DC) -{ - mbfl_memory_device *device = (mbfl_memory_device *)data; - - if ((device->pos + 4) >= device->length) { - /* reallocate buffer */ - int newlen; - unsigned char *tmp; - - newlen = device->length + device->allocsz; - tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); - if (tmp == NULL) { - return -1; - } - device->length = newlen; - device->buffer = tmp; - } - - device->buffer[device->pos++] = (unsigned char)((c >> 24) & 0xff); - device->buffer[device->pos++] = (unsigned char)((c >> 16) & 0xff); - device->buffer[device->pos++] = (unsigned char)((c >> 8) & 0xff); - device->buffer[device->pos++] = (unsigned char)(c & 0xff); - - return c; -} - -int -mbfl_memory_device_strcat(mbfl_memory_device *device, const char *psrc TSRMLS_DC) -{ - int len; - unsigned char *w; - const unsigned char *p; - - len = 0; - p = (const unsigned char *)psrc; - while (*p) { - p++; - len++; - } - - if ((device->pos + len) >= device->length) { - /* reallocate buffer */ - int newlen = device->length + (len + MBFL_MEMORY_DEVICE_ALLOC_SIZE)*sizeof(unsigned char); - unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); - if (tmp == NULL) { - return -1; - } - device->length = newlen; - device->buffer = tmp; - } - - p = (const unsigned char *)psrc; - w = &device->buffer[device->pos]; - device->pos += len; - while (len > 0) { - *w++ = *p++; - len--; - } - - return len; -} - -int -mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, int len TSRMLS_DC) -{ - unsigned char *w; - - if ((device->pos + len) >= device->length) { - /* reallocate buffer */ - int newlen = device->length + len + MBFL_MEMORY_DEVICE_ALLOC_SIZE; - unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char)); - if (tmp == NULL) { - return -1; - } - device->length = newlen; - device->buffer = tmp; - } - - w = &device->buffer[device->pos]; - device->pos += len; - while (len > 0) { - *w++ = *psrc++; - len--; - } - - return len; -} - -int -mbfl_memory_device_devcat(mbfl_memory_device *dest, mbfl_memory_device *src TSRMLS_DC) -{ - int n; - unsigned char *p, *w; - - if ((dest->pos + src->pos) >= dest->length) { - /* reallocate buffer */ - int newlen = dest->length + src->pos + MBFL_MEMORY_DEVICE_ALLOC_SIZE; - unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)dest->buffer, newlen*sizeof(unsigned char)); - if (tmp == NULL) { - return -1; - } - dest->length = newlen; - dest->buffer = tmp; - } - - p = src->buffer; - w = &dest->buffer[dest->pos]; - n = src->pos; - dest->pos += n; - while (n > 0) { - *w++ = *p++; - n--; - } - - return n; -} - -void -mbfl_wchar_device_init(mbfl_wchar_device *device TSRMLS_DC) -{ - if (device) { - device->buffer = (unsigned int *)0; - device->length = 0; - device->pos= 0; - device->allocsz = MBFL_MEMORY_DEVICE_ALLOC_SIZE; - } -} - -void -mbfl_wchar_device_clear(mbfl_wchar_device *device TSRMLS_DC) -{ - if (device) { - if (device->buffer) { - mbfl_free(device->buffer); - } - device->buffer = (unsigned int*)0; - device->length = 0; - device->pos = 0; - } -} - -int -mbfl_wchar_device_output(int c, void *data TSRMLS_DC) -{ - mbfl_wchar_device *device = (mbfl_wchar_device *)data; - - if (device->pos >= device->length) { - /* reallocate buffer */ - int newlen; - unsigned int *tmp; - - newlen = device->length + device->allocsz; - tmp = (unsigned int *)mbfl_realloc((void *)device->buffer, newlen*sizeof(int)); - if (tmp == NULL) { - return -1; - } - device->length = newlen; - device->buffer = tmp; - } - - device->buffer[device->pos++] = c; - - return c; -} - - -/* - * string object - */ -void -mbfl_string_init(mbfl_string *string) -{ - if (string) { - string->no_language = mbfl_no_language_uni; - string->no_encoding = mbfl_no_encoding_pass; - string->val = (unsigned char*)0; - string->len = 0; - } -} - -void -mbfl_string_init_set(mbfl_string *string, enum mbfl_no_language no_language, enum mbfl_no_encoding no_encoding) -{ - if (string) { - string->no_language = no_language; - string->no_encoding = no_encoding; - string->val = (unsigned char*)0; - string->len = 0; - } -} - -void -mbfl_string_clear(mbfl_string *string) -{ - if (string) { - if (string->val != (unsigned char*)0) { - mbfl_free(string->val); - } - string->val = (unsigned char*)0; - string->len = 0; - } -} - - - -/* - * encoding filter - */ -#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) - -/* - * commonly used constructor and destructor - */ -static void -mbfl_filt_conv_common_ctor(mbfl_convert_filter *filter TSRMLS_DC) -{ - filter->status = 0; - filter->cache = 0; -} - -static int -mbfl_filt_conv_common_flush(mbfl_convert_filter *filter TSRMLS_DC) -{ - filter->status = 0; - filter->cache = 0; - return 0; -} - -static void -mbfl_filt_conv_common_dtor(mbfl_convert_filter *filter TSRMLS_DC) -{ - filter->status = 0; - filter->cache = 0; -} - -static int -mbfl_filt_conv_pass(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - return (*filter->output_function)(c, filter->data TSRMLS_CC); -} - -static int -mbfl_filt_conv_any_7bit(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - if (c >= 0 && c < 0x80) { - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } - return c; -} - -static int -mbfl_filt_conv_byte2be_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n; - - if (filter->status == 0) { - filter->status = 1; - n = (c & 0xff) << 8; - filter->cache = n; - } else { - filter->status = 0; - n = (c & 0xff) | filter->cache; - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } - return c; -} - -static int -mbfl_filt_conv_wchar_byte2be(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC)); - return c; -} - -static int -mbfl_filt_conv_byte2le_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n; - - if (filter->status == 0) { - filter->status = 1; - n = c & 0xff; - filter->cache = n; - } else { - filter->status = 0; - n = ((c & 0xff) << 8) | filter->cache; - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } - return c; -} - -static int -mbfl_filt_conv_wchar_byte2le(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC)); - return c; -} - -static int -mbfl_filt_conv_byte4be_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n; - - if (filter->status == 0) { - filter->status = 1; - n = (c & 0xff) << 24; - filter->cache = n; - } else if (filter->status == 1) { - filter->status = 2; - n = (c & 0xff) << 16; - filter->cache |= n; - } else if (filter->status == 2) { - filter->status = 3; - n = (c & 0xff) << 8; - filter->cache |= n; - } else { - filter->status = 0; - n = (c & 0xff) | filter->cache; - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } - return c; -} - -static int -mbfl_filt_conv_wchar_byte4be(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - CK((*filter->output_function)((c >> 24) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c >> 16) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC)); - return c; -} - -static int -mbfl_filt_conv_byte4le_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n; - - if (filter->status == 0) { - filter->status = 1; - n = (c & 0xff); - filter->cache = n; - } else if (filter->status == 1) { - filter->status = 2; - n = (c & 0xff) << 8; - filter->cache |= n; - } else if (filter->status == 2) { - filter->status = 3; - n = (c & 0xff) << 16; - filter->cache |= n; - } else { - filter->status = 0; - n = ((c & 0xff) << 24) | filter->cache; - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } - return c; -} - -static int -mbfl_filt_conv_wchar_byte4le(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c >> 16) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c >> 24) & 0xff, filter->data TSRMLS_CC)); - return c; -} - - -/* uuencode => any */ -#define UUDEC(c) (char)(((c)-' ')&077) -static const char * uuenc_begin_text = "begin "; -enum { uudec_state_ground=0, uudec_state_inbegin, - uudec_state_until_newline, - uudec_state_size, uudec_state_a, uudec_state_b, uudec_state_c, uudec_state_d, - uudec_state_skip_newline}; -static int -mbfl_filt_conv_uudec(int c, mbfl_convert_filter * filter TSRMLS_DC) -{ - int n; - - switch(filter->status) { - case uudec_state_ground: - /* looking for "begin 0666 filename\n" line */ - if (filter->cache == 0 && c == 'b') - { - filter->status = uudec_state_inbegin; - filter->cache = 1; /* move to 'e' */ - } - else if (c == '\n') - filter->cache = 0; - else - filter->cache++; - break; - case uudec_state_inbegin: - if (uuenc_begin_text[filter->cache++] != c) { - /* doesn't match pattern */ - filter->status = uudec_state_ground; - break; - } - if (filter->cache == 5) - { - /* thats good enough - wait for a newline */ - filter->status = uudec_state_until_newline; - filter->cache = 0; - } - break; - case uudec_state_until_newline: - if (c == '\n') - filter->status = uudec_state_size; - break; - case uudec_state_size: - /* get "size" byte */ - n = UUDEC(c); - filter->cache = n << 24; - filter->status = uudec_state_a; - break; - case uudec_state_a: - /* get "a" byte */ - n = UUDEC(c); - filter->cache |= (n << 16); - filter->status = uudec_state_b; - break; - case uudec_state_b: - /* get "b" byte */ - n = UUDEC(c); - filter->cache |= (n << 8); - filter->status = uudec_state_c; - break; - case uudec_state_c: - /* get "c" byte */ - n = UUDEC(c); - filter->cache |= n; - filter->status = uudec_state_d; - break; - case uudec_state_d: - /* get "d" byte */ - { - int A, B, C, D = UUDEC(c); - A = (filter->cache >> 16) & 0xff; - B = (filter->cache >> 8) & 0xff; - C = (filter->cache) & 0xff; - n = (filter->cache >> 24) & 0xff; - if (n-- > 0) - CK((*filter->output_function)( (A << 2) | (B >> 4), filter->data TSRMLS_CC)); - if (n-- > 0) - CK((*filter->output_function)( (B << 4) | (C >> 2), filter->data TSRMLS_CC)); - if (n-- > 0) - CK((*filter->output_function)( (C << 6) | D, filter->data TSRMLS_CC)); - filter->cache = n << 24; - - if (n == 0) - filter->status = uudec_state_skip_newline; /* skip next byte (newline) */ - else - filter->status = uudec_state_a; /* go back to fetch "A" byte */ - } - break; - case uudec_state_skip_newline: - /* skip newline */ - filter->status = uudec_state_size; - } - return c; -} - -/* - * any => BASE64 - */ -static const unsigned char mbfl_base64_table[] = -{ - /* 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', */ - 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d, - /* 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', */ - 0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a, - /* 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', */ - 0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d, - /* 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', */ - 0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a, - /* '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '\0' */ - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x2b,0x2f,0x00 -}; - -#define MBFL_BASE64_STS_MIME_HEADER 0x1000000 - -static int -mbfl_filt_conv_base64enc(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n; - - n = (filter->status & 0xff); - if (n == 0) { - filter->status++; - filter->cache = (c & 0xff) << 16; - } else if (n == 1) { - filter->status++; - filter->cache |= (c & 0xff) << 8; - } else { - filter->status &= ~0xff; - if ((filter->status & MBFL_BASE64_STS_MIME_HEADER) == 0) { - n = (filter->status & 0xff00) >> 8; - if (n > 72) { - CK((*filter->output_function)(0x0d, filter->data TSRMLS_CC)); /* CR */ - CK((*filter->output_function)(0x0a, filter->data TSRMLS_CC)); /* LF */ - filter->status &= ~0xff00; - } - filter->status += 0x400; - } - n = filter->cache | (c & 0xff); - CK((*filter->output_function)(mbfl_base64_table[(n >> 18) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[(n >> 12) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[(n >> 6) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[n & 0x3f], filter->data TSRMLS_CC)); - } - - return c; -} - -static int -mbfl_filt_conv_base64enc_flush(mbfl_convert_filter *filter TSRMLS_DC) -{ - int status, cache, len; - - status = filter->status & 0xff; - cache = filter->cache; - len = (filter->status & 0xff00) >> 8; - filter->status &= ~0xffff; - filter->cache = 0; - /* flush fragments */ - if (status >= 1) { - if ((filter->status & MBFL_BASE64_STS_MIME_HEADER) == 0) { - if (len > 72){ - CK((*filter->output_function)(0x0d, filter->data TSRMLS_CC)); /* CR */ - CK((*filter->output_function)(0x0a, filter->data TSRMLS_CC)); /* LF */ - } - } - CK((*filter->output_function)(mbfl_base64_table[(cache >> 18) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[(cache >> 12) & 0x3f], filter->data TSRMLS_CC)); - if (status == 1) { - CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */ - CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */ - } else { - CK((*filter->output_function)(mbfl_base64_table[(cache >> 6) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */ - } - } - return 0; -} - -/* - * BASE64 => any - */ -static int -mbfl_filt_conv_base64dec(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n; - - if (c == 0x0d || c == 0x0a || c == 0x20 || c == 0x09 || c == 0x3d) { /* CR or LF or SPACE or HTAB or '=' */ - return c; - } - - n = 0; - if (c >= 0x41 && c <= 0x5a) { /* A - Z */ - n = c - 65; - } else if (c >= 0x61 && c <= 0x7a) { /* a - z */ - n = c - 71; - } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */ - n = c + 4; - } else if (c == 0x2b) { /* '+' */ - n = 62; - } else if (c == 0x2f) { /* '/' */ - n = 63; - } - n &= 0x3f; - - switch (filter->status) { - case 0: - filter->status = 1; - filter->cache = n << 18; - break; - case 1: - filter->status = 2; - filter->cache |= n << 12; - break; - case 2: - filter->status = 3; - filter->cache |= n << 6; - break; - default: - filter->status = 0; - n |= filter->cache; - CK((*filter->output_function)((n >> 16) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((n >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(n & 0xff, filter->data TSRMLS_CC)); - break; - } - - return c; -} - -static int -mbfl_filt_conv_base64dec_flush(mbfl_convert_filter *filter TSRMLS_DC) -{ - int status, cache; - - status = filter->status; - cache = filter->cache; - filter->status = 0; - filter->cache = 0; - /* flush fragments */ - if (status >= 2) { - CK((*filter->output_function)((cache >> 16) & 0xff, filter->data TSRMLS_CC)); - if (status >= 3) { - CK((*filter->output_function)((cache >> 8) & 0xff, filter->data TSRMLS_CC)); - } - } - return 0; -} - -/* - * any => HTML - */ -static int -mbfl_filt_conv_html_enc(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int tmp[10]; - int i = 0, p = 0, e; - unsigned int uc; - - if (c<256 && mblen_table_html[c]==1) { - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - /*php_error_docref("ref.mbstring" TSRMLS_CC, E_NOTICE, "mbfl_filt_conv_html_enc(0x%08X = %d)", c, c);*/ - CK((*filter->output_function)('&', filter->data TSRMLS_CC)); - while (1) { - e = mbfl_html_entity_list[i].code; - if (c < e || e == -1) { - break; - } - if (c == e) { - while(mbfl_html_entity_list[i].name[p]) { - CK((*filter->output_function)((int)mbfl_html_entity_list[i].name[p++], filter->data TSRMLS_CC)); - } - break; - } - i++; - } - i=0; - if (!p) { - CK((*filter->output_function)('#', filter->data TSRMLS_CC)); - uc = (unsigned int)c; - do { - tmp[i++] = '0'+uc%10; - uc /= 10; - } while (uc); - do { - CK((*filter->output_function)(tmp[--i], filter->data TSRMLS_CC)); - } while (i); - } - CK((*filter->output_function)(';', filter->data TSRMLS_CC)); - } - return c; -} - -static int -mbfl_filt_conv_html_enc_flush(mbfl_convert_filter *filter TSRMLS_DC) -{ - filter->status = 0; - filter->cache = 0; - return 0; -} - -/* - * HTML => any - */ -#define html_enc_buffer_size 16 -static const char html_entity_chars[] = "#0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - -static void -mbfl_filt_conv_html_dec_ctor(mbfl_convert_filter *filter TSRMLS_DC) -{ - filter->status = 0; - filter->cache = (int)mbfl_malloc(html_enc_buffer_size+1); -} - -static void -mbfl_filt_conv_html_dec_dtor(mbfl_convert_filter *filter TSRMLS_DC) -{ - filter->status = 0; - if (filter->cache) - { - mbfl_free((void*)filter->cache); - } - filter->cache = 0; -} - -static int -mbfl_filt_conv_html_dec(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int pos, ent = 0; - const mbfl_html_entity *entity; - char *buffer = (char*)filter->cache; - - if (!filter->status) - { - if (c == '&' ) - { - filter->status = 1; - buffer[0] = '&'; - } - else - { - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } - } - else - { - if (c == ';') - { - buffer[filter->status] = 0; - if (buffer[1]=='#') - { - /* numeric entity */ - for (pos=2; pos<filter->status; pos++) - ent = ent*10 + (buffer[pos] - '0'); - CK((*filter->output_function)(ent, filter->data TSRMLS_CC)); - filter->status = 0; - /*php_error_docref("ref.mbstring" TSRMLS_CC, E_NOTICE, "mbstring decoded '%s'=%d", buffer, ent);*/ - } - else - { - /* named entity */ - entity = mbfl_html_entity_list; - while (entity->name) - { - if (!strcmp(buffer+1, entity->name)) - { - ent = entity->code; - break; - } - entity++; - } - if (ent) - { - /* decoded */ - CK((*filter->output_function)(ent, filter->data TSRMLS_CC)); - filter->status = 0; - /*php_error_docref("ref.mbstring" TSRMLS_CC, E_NOTICE,"mbstring decoded '%s'=%d", buffer, ent);*/ - } - else - { - /* failure */ - buffer[filter->status++] = ';'; - buffer[filter->status] = 0; - php_error_docref("ref.mbstring" TSRMLS_CC, E_WARNING, "mbstring cannot decode '%s'", buffer); - mbfl_filt_conv_html_dec_flush(filter TSRMLS_CC); - } - } - } - else - { - /* add character */ - buffer[filter->status++] = c; - /* add character and check */ - if (!strchr(html_entity_chars, c) || filter->status+1==html_enc_buffer_size || (c=='#' && filter->status>2)) - { - /* illegal character or end of buffer */ - if (c=='&') - filter->status--; - buffer[filter->status] = 0; - php_error_docref("ref.mbstring" TSRMLS_CC, E_WARNING, "mbstring cannot decode '%s'", buffer); - mbfl_filt_conv_html_dec_flush(filter TSRMLS_CC); - if (c=='&') - { - filter->status = 1; - buffer[0] = '&'; - } - } - } - } - return c; -} - -static int -mbfl_filt_conv_html_dec_flush(mbfl_convert_filter *filter TSRMLS_DC) -{ - int status, pos = 0; - char *buffer; - - buffer = (char*)filter->cache; - status = filter->status; - /* flush fragments */ - while (status--) - { - CK((*filter->output_function)(buffer[pos++], filter->data TSRMLS_CC)); - } - filter->status = 0; - /*filter->buffer = 0; of cause NOT*/ - return 0; -} - -/* - * any => Quoted-Printable - */ -#define MBFL_QPRINT_STS_MIME_HEADER 0x1000000 - -static int -mbfl_filt_conv_qprintenc(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - switch (filter->status & 0xff) { - case 0: - filter->cache = c; - filter->status++; - break; - default: - s = filter->cache; - filter->cache = c; - n = (filter->status & 0xff00) >> 8; - - if (s == 0) { /* null */ - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - filter->status &= ~0xff00; - break; - } - - if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0) { - if (s == 0x0a || (s == 0x0d && c != 0x0a)) { /* line feed */ - CK((*filter->output_function)(0x0d, filter->data TSRMLS_CC)); /* CR */ - CK((*filter->output_function)(0x0a, filter->data TSRMLS_CC)); /* LF */ - filter->status &= ~0xff00; - break; - } else if (s == 0x0d) { - break; - } - } - - if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0 && n >= 72) { /* soft line feed */ - CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */ - CK((*filter->output_function)(0x0d, filter->data TSRMLS_CC)); /* CR */ - CK((*filter->output_function)(0x0a, filter->data TSRMLS_CC)); /* LF */ - filter->status &= ~0xff00; - } - - if (s <= 0 || s >= 0x80 || s == 0x3d /* not ASCII or '=' */ - || ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) != 0 && - (mbfl_charprop_table[s] & MBFL_CHP_MMHQENC) != 0)) { - /* hex-octet */ - CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */ - n = (s >> 4) & 0xf; - if (n < 10) { - n += 48; /* '0' */ - } else { - n += 55; /* 'A' - 10 */ - } - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - n = s & 0xf; - if (n < 10) { - n += 48; - } else { - n += 55; - } - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0) { - filter->status += 0x300; - } - } else { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0) { - filter->status += 0x100; - } - } - break; - } - - return c; -} - -static int -mbfl_filt_conv_qprintenc_flush(mbfl_convert_filter *filter TSRMLS_DC) -{ - /* flush filter cache */ - (*filter->filter_function)('\0', filter TSRMLS_CC); - filter->status &= ~0xffff; - filter->cache = 0; - return 0; -} - -/* - * Quoted-Printable => any - */ -static int -mbfl_filt_conv_qprintdec(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n; - - switch (filter->status) { - case 1: - if ((c >= 0x30 && c <= 0x39) || (c >= 0x41 && c <= 0x46)) { /* 0 - 9 or A - F */ - filter->cache = c; - filter->status = 2; - } else if (c == 0x0d) { /* soft line feed */ - filter->status = 3; - } else if (c == 0x0a) { /* soft line feed */ - filter->status = 0; - } else { - CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - filter->status = 0; - } - break; - case 2: - n = filter->cache; - if (n >= 0x30 && n <= 0x39) { /* '0' - '9' */ - n -= 48; /* 48 = '0' */ - } else { - n -= 55; /* 55 = 'A' - 10 */ - } - n <<= 4; - if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */ - n += (c - 48); - } else if (c >= 0x41 && c <= 0x46) { /* 'A' - 'F' */ - n += (c - 55); - } else { - CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */ - CK((*filter->output_function)(filter->cache, filter->data TSRMLS_CC)); - n = c; - } - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - filter->status = 0; - break; - case 3: - if (c != 0x0a) { /* LF */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } - filter->status = 0; - break; - default: - if (c == 0x3d) { /* '=' */ - filter->status = 1; - } else { - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } - break; - } - - return c; -} - -static int -mbfl_filt_conv_qprintdec_flush(mbfl_convert_filter *filter TSRMLS_DC) -{ - int status, cache; - - status = filter->status; - cache = filter->cache; - filter->status = 0; - filter->cache = 0; - /* flush fragments */ - if (status == 1) { - CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */ - } else if (status == 2) { - CK((*filter->output_function)(0x3d, filter->data TSRMLS_CC)); /* '=' */ - CK((*filter->output_function)(cache, filter->data TSRMLS_CC)); - } - - return 0; -} - - -/* - * UCS-4 => wchar - */ -static int -mbfl_filt_conv_ucs4_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n, endian; - - endian = filter->status & 0xff00; - switch (filter->status & 0xff) { - case 0: - if (endian) { - n = c & 0xff; - } else { - n = (c & 0xff) << 24; - } - filter->cache = n; - filter->status++; - break; - case 1: - if (endian) { - n = (c & 0xff) << 8; - } else { - n = (c & 0xff) << 16; - } - filter->cache |= n; - filter->status++; - break; - case 2: - if (endian) { - n = (c & 0xff) << 16; - } else { - n = (c & 0xff) << 8; - } - filter->cache |= n; - filter->status++; - break; - default: - if (endian) { - n = (c & 0xff) << 24; - } else { - n = c & 0xff; - } - n |= filter->cache; - if ((n & 0xffff) == 0 && ((n >> 16) & 0xffff) == 0xfffe) { - if (endian) { - filter->status = 0; /* big-endian */ - } else { - filter->status = 0x100; /* little-endian */ - } - CK((*filter->output_function)(0xfeff, filter->data TSRMLS_CC)); - } else { - filter->status &= ~0xff; - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } - break; - } - - return c; -} - -/* - * wchar => UCS-4BE - */ -static int -mbfl_filt_conv_wchar_ucs4be(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - if (c >= 0 && c < MBFL_WCSGROUP_UCS4MAX) { - CK((*filter->output_function)((c >> 24) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c >> 16) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * wchar => UCS-4LE - */ -static int -mbfl_filt_conv_wchar_ucs4le(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - if (c >= 0 && c < MBFL_WCSGROUP_UCS4MAX) { - CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c >> 16) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c >> 24) & 0xff, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * UCS-2 => wchar - */ -static int -mbfl_filt_conv_ucs2_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n, endian; - - endian = filter->status & 0xff00; - switch (filter->status & 0xff) { - case 0: - if (endian) { - n = c & 0xff; - } else { - n = (c & 0xff) << 8; - } - filter->cache = n; - filter->status++; - break; - default: - if (endian) { - n = (c & 0xff) << 8; - } else { - n = c & 0xff; - } - n |= filter->cache; - if (n == 0xfffe) { - if (endian) { - filter->status = 0; /* big-endian */ - } else { - filter->status = 0x100; /* little-endian */ - } - CK((*filter->output_function)(0xfeff, filter->data TSRMLS_CC)); - } else { - filter->status &= ~0xff; - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } - break; - } - - return c; -} - -/* - * wchar => UCS-2BE - */ -static int -mbfl_filt_conv_wchar_ucs2be(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) { - CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * wchar => UCS-2LE - */ -static int -mbfl_filt_conv_wchar_ucs2le(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) { - CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - - -/* - * UTF-16 => wchar - */ -static int -mbfl_filt_conv_utf16_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n, endian; - - endian = filter->status & 0xff00; - switch (filter->status & 0xff) { - case 0: - if (endian) { - n = c & 0xff; - } else { - n = (c & 0xff) << 8; - } - filter->cache |= n; - filter->status++; - break; - default: - if (endian) { - n = (c & 0xff) << 8; - } else { - n = c & 0xff; - } - n |= filter->cache & 0xffff; - filter->status &= ~0xff; - if (n == 0xfffe) { - if (endian) { - filter->status = 0; /* big-endian */ - } else { - filter->status = 0x100; /* little-endian */ - } - CK((*filter->output_function)(0xfeff, filter->data TSRMLS_CC)); - } else if (n >= 0xd800 && n < 0xdc00) { - filter->cache = ((n & 0x3ff) << 16) + 0x400000; - } else if (n >= 0xdc00 && n < 0xe000) { - n &= 0x3ff; - n |= (filter->cache & 0xfff0000) >> 6; - filter->cache = 0; - if (n >= MBFL_WCSPLANE_SUPMIN && n < MBFL_WCSPLANE_SUPMAX) { - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } else { /* illegal character */ - n &= MBFL_WCSGROUP_MASK; - n |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } - } else { - filter->cache = 0; - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } - break; - } - - return c; -} - -/* - * UTF-16BE => wchar - */ -static int -mbfl_filt_conv_utf16be_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n; - - switch (filter->status) { - case 0: - filter->status = 1; - n = (c & 0xff) << 8; - filter->cache |= n; - break; - default: - filter->status = 0; - n = (filter->cache & 0xff00) | (c & 0xff); - if (n >= 0xd800 && n < 0xdc00) { - filter->cache = ((n & 0x3ff) << 16) + 0x400000; - } else if (n >= 0xdc00 && n < 0xe000) { - n &= 0x3ff; - n |= (filter->cache & 0xfff0000) >> 6; - filter->cache = 0; - if (n >= MBFL_WCSPLANE_SUPMIN && n < MBFL_WCSPLANE_SUPMAX) { - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } else { /* illegal character */ - n &= MBFL_WCSGROUP_MASK; - n |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } - } else { - filter->cache = 0; - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } - break; - } - - return c; -} - -/* - * wchar => UTF-16BE - */ -static int -mbfl_filt_conv_wchar_utf16be(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n; - - if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) { - CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC)); - } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) { - n = ((c >> 10) - 0x40) | 0xd800; - CK((*filter->output_function)((n >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(n & 0xff, filter->data TSRMLS_CC)); - n = (c & 0x3ff) | 0xdc00; - CK((*filter->output_function)((n >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(n & 0xff, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * UTF-16LE => wchar - */ -static int -mbfl_filt_conv_utf16le_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n; - - switch (filter->status) { - case 0: - filter->status = 1; - n = c & 0xff; - filter->cache |= n; - break; - default: - filter->status = 0; - n = (filter->cache & 0xff) | ((c & 0xff) << 8); - if (n >= 0xd800 && n < 0xdc00) { - filter->cache = ((n & 0x3ff) << 16) + 0x400000; - } else if (n >= 0xdc00 && n < 0xe000) { - n &= 0x3ff; - n |= (filter->cache & 0xfff0000) >> 6; - filter->cache = 0; - if (n >= MBFL_WCSPLANE_SUPMIN && n < MBFL_WCSPLANE_SUPMAX) { - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } else { /* illegal character */ - n &= MBFL_WCSGROUP_MASK; - n |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } - } else { - filter->cache = 0; - CK((*filter->output_function)(n, filter->data TSRMLS_CC)); - } - break; - } - - return c; -} - -/* - * wchar => UTF-16LE - */ -static int -mbfl_filt_conv_wchar_utf16le(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n; - - if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) { - CK((*filter->output_function)(c & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c >> 8) & 0xff, filter->data TSRMLS_CC)); - } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) { - n = ((c >> 10) - 0x40) | 0xd800; - CK((*filter->output_function)(n & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((n >> 8) & 0xff, filter->data TSRMLS_CC)); - n = (c & 0x3ff) | 0xdc00; - CK((*filter->output_function)(n & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((n >> 8) & 0xff, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - - -/* - * UTF-8 => wchar - */ -static int -mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - if (c < 0x80) { - if (c >= 0) { - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } - filter->status = 0; - } else if (c < 0xc0) { - switch (filter->status & 0xff) { - case 0x10: /* 2byte code 2nd char */ - case 0x21: /* 3byte code 3rd char */ - case 0x32: /* 4byte code 4th char */ - case 0x43: /* 5byte code 5th char */ - case 0x54: /* 6byte code 6th char */ - filter->status = 0; - s = filter->cache | (c & 0x3f); - if (s >= 0x80) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - break; - case 0x20: /* 3byte code 2nd char */ - case 0x31: /* 4byte code 3rd char */ - case 0x42: /* 5byte code 4th char */ - case 0x53: /* 6byte code 5th char */ - filter->cache |= ((c & 0x3f) << 6); - filter->status++; - break; - case 0x30: /* 4byte code 2nd char */ - case 0x41: /* 5byte code 3rd char */ - case 0x52: /* 6byte code 4th char */ - filter->cache |= ((c & 0x3f) << 12); - filter->status++; - break; - case 0x40: /* 5byte code 2nd char */ - case 0x51: /* 6byte code 3rd char */ - filter->cache |= ((c & 0x3f) << 18); - filter->status++; - break; - case 0x50: /* 6byte code 2nd char */ - filter->cache |= ((c & 0x3f) << 24); - filter->status++; - break; - default: - filter->status = 0; - break; - } - } else if (c < 0xe0) { /* 2byte code first char */ - filter->status = 0x10; - filter->cache = (c & 0x1f) << 6; - } else if (c < 0xf0) { /* 3byte code first char */ - filter->status = 0x20; - filter->cache = (c & 0xf) << 12; - } else if (c < 0xf8) { /* 4byte code first char */ - filter->status = 0x30; - filter->cache = (c & 0x7) << 18; - } else if (c < 0xfc) { /* 5byte code first char */ - filter->status = 0x40; - filter->cache = (c & 0x3) << 24; - } else if (c < 0xfe) { /* 6 byte code first char */ - filter->status = 0x50; - filter->cache = (c & 0x1) << 30; - } else { - filter->status = 0; - filter->cache = 0; - } - - return c; -} - -/* - * wchar => UTF-8 - */ -static int -mbfl_filt_conv_wchar_utf8(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - if (c >= 0 && c < MBFL_WCSGROUP_UCS4MAX) { - if (c < 0x80) { - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else if (c < 0x800) { - CK((*filter->output_function)(((c >> 6) & 0x1f) | 0xc0, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data TSRMLS_CC)); - } else if (c < 0x10000) { - CK((*filter->output_function)(((c >> 12) & 0x0f) | 0xe0, filter->data TSRMLS_CC)); - CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data TSRMLS_CC)); - } else if (c < 0x200000) { - CK((*filter->output_function)(((c >> 18) & 0x07) | 0xf0, filter->data TSRMLS_CC)); - CK((*filter->output_function)(((c >> 12) & 0x3f) | 0x80, filter->data TSRMLS_CC)); - CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data TSRMLS_CC)); - } else if (c < 0x4000000) { - CK((*filter->output_function)(((c >> 24) & 0x03) | 0xf8, filter->data TSRMLS_CC)); - CK((*filter->output_function)(((c >> 18) & 0x3f) | 0x80, filter->data TSRMLS_CC)); - CK((*filter->output_function)(((c >> 12) & 0x3f) | 0x80, filter->data TSRMLS_CC)); - CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data TSRMLS_CC)); - } else { - CK((*filter->output_function)(((c >> 30) & 0x01) | 0xfc, filter->data TSRMLS_CC)); - CK((*filter->output_function)(((c >> 24) & 0x3f) | 0x80, filter->data TSRMLS_CC)); - CK((*filter->output_function)(((c >> 18) & 0x3f) | 0x80, filter->data TSRMLS_CC)); - CK((*filter->output_function)(((c >> 12) & 0x3f) | 0x80, filter->data TSRMLS_CC)); - CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data TSRMLS_CC)); - CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - - -/* - * UTF-7 => wchar - */ -static int -mbfl_filt_conv_utf7_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - n = -1; - if (filter->status != 0) { /* Modified Base64 */ - if (c >= 0x41 && c <= 0x5a) { /* A - Z */ - n = c - 65; - } else if (c >= 0x61 && c <= 0x7a) { /* a - z */ - n = c - 71; - } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */ - n = c + 4; - } else if (c == 0x2b) { /* '+' */ - n = 62; - } else if (c == 0x2f) { /* '/' */ - n = 63; - } - if (n < 0 || n > 63) { - if (c == 0x2d) { - if (filter->status == 1) { /* "+-" -> "+" */ - CK((*filter->output_function)(0x2b, filter->data TSRMLS_CC)); - } - } else if (c >= 0 && c < 0x80) { /* ASCII exclude '-' */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { /* illegal character */ - s = c & MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - filter->cache = 0; - filter->status = 0; - return c; - } - } - - switch (filter->status) { - /* directly encoded characters */ - case 0: - if (c == 0x2b) { /* '+' shift character */ - filter->status = 1; - } else if (c >= 0 && c < 0x80) { /* ASCII */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { /* illegal character */ - s = c & MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - break; - - /* decode Modified Base64 */ - case 1: - case 2: - filter->cache |= n << 10; - filter->status = 3; - break; - case 3: - filter->cache |= n << 4; - filter->status = 4; - break; - case 4: - s = ((n >> 2) & 0xf) | (filter->cache & 0xffff); - n = (n & 0x3) << 14; - filter->status = 5; - if (s >= 0xd800 && s < 0xdc00) { - s = (((s & 0x3ff) << 16) + 0x400000) | n; - filter->cache = s; - } else if (s >= 0xdc00 && s < 0xe000) { - s &= 0x3ff; - s |= (filter->cache & 0xfff0000) >> 6; - filter->cache = n; - if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { /* illegal character */ - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - } else { - filter->cache = n; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - break; - - case 5: - filter->cache |= n << 8; - filter->status = 6; - break; - case 6: - filter->cache |= n << 2; - filter->status = 7; - break; - case 7: - s = ((n >> 4) & 0x3) | (filter->cache & 0xffff); - n = (n & 0xf) << 12; - filter->status = 8; - if (s >= 0xd800 && s < 0xdc00) { - s = (((s & 0x3ff) << 16) + 0x400000) | n; - filter->cache = s; - } else if (s >= 0xdc00 && s < 0xe000) { - s &= 0x3ff; - s |= (filter->cache & 0xfff0000) >> 6; - filter->cache = n; - if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { /* illegal character */ - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - } else { - filter->cache = n; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - break; - - case 8: - filter->cache |= n << 6; - filter->status = 9; - break; - case 9: - s = n | (filter->cache & 0xffff); - filter->status = 2; - if (s >= 0xd800 && s < 0xdc00) { - s = (((s & 0x3ff) << 16) + 0x400000); - filter->cache = s; - } else if (s >= 0xdc00 && s < 0xe000) { - s &= 0x3ff; - s |= (filter->cache & 0xfff0000) >> 6; - filter->cache = 0; - if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { /* illegal character */ - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - } else { - filter->cache = 0; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -/* - * wchar => UTF-7 - */ -static int -mbfl_filt_conv_wchar_utf7(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - n = 0; - if (c >= 0 && c < 0x80) { /* ASCII */ - if (c >= 0x41 && c <= 0x5a) { /* A - Z */ - n = 1; - } else if (c >= 0x61 && c <= 0x7a) { /* a - z */ - n = 1; - } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */ - n = 1; - } else if (c == '\0') { /* '\0' */ - n = 1; - } else if (c == 0x2f) { /* '/' */ - n = 1; - } else if (c == 0x2d) { /* '-' */ - n = 1; - } else if (c == 0x20) { /* SPACE */ - n = 2; - } else if (c == 0x09) { /* HTAB */ - n = 2; - } else if (c == 0x0d) { /* CR */ - n = 2; - } else if (c == 0x0a) { /* LF */ - n = 2; - } else if (c == 0x27) { /* "'" */ - n = 2; - } else if (c == 0x28) { /* '(' */ - n = 2; - } else if (c == 0x29) { /* ')' */ - n = 2; - } else if (c == 0x2c) { /* ',' */ - n = 2; - } else if (c == 0x2e) { /* '.' */ - n = 2; - } else if (c == 0x3a) { /* ':' */ - n = 2; - } else if (c == 0x3f) { /* '?' */ - n = 2; - } - } else if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) { - ; - } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) { - s = ((c >> 10) - 0x40) | 0xd800; - CK((*filter->filter_function)(s, filter TSRMLS_CC)); - s = (c & 0x3ff) | 0xdc00; - CK((*filter->filter_function)(s, filter TSRMLS_CC)); - return c; - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - return c; - } - - switch (filter->status) { - case 0: - if (n != 0) { /* directly encode characters */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { /* Modified Base64 */ - CK((*filter->output_function)(0x2b, filter->data TSRMLS_CC)); /* '+' */ - filter->status++; - filter->cache = c; - } - break; - - /* encode Modified Base64 */ - case 1: - s = filter->cache; - CK((*filter->output_function)(mbfl_base64_table[(s >> 10) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[(s >> 4) & 0x3f], filter->data TSRMLS_CC)); - if (n != 0) { - CK((*filter->output_function)(mbfl_base64_table[(s << 2) & 0x3c], filter->data TSRMLS_CC)); - if (n == 1) { - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - } - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - filter->status = 0; - } else { - filter->status++; - filter->cache = ((s & 0xf) << 16) | c; - } - break; - - case 2: - s = filter->cache; - CK((*filter->output_function)(mbfl_base64_table[(s >> 14) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[(s >> 8) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[(s >> 2) & 0x3f], filter->data TSRMLS_CC)); - if (n != 0) { - CK((*filter->output_function)(mbfl_base64_table[(s << 4) & 0x30], filter->data TSRMLS_CC)); - if (n == 1) { - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - } - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - filter->status = 0; - } else { - filter->status++; - filter->cache = ((s & 0x3) << 16) | c; - } - break; - - case 3: - s = filter->cache; - CK((*filter->output_function)(mbfl_base64_table[(s >> 12) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[(s >> 6) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[s & 0x3f], filter->data TSRMLS_CC)); - if (n != 0) { - if (n == 1) { - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - } - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - filter->status = 0; - } else { - filter->status = 1; - filter->cache = c; - } - break; - - default: - filter->status = 0; - break; - } - - return c; - -} - -static int -mbfl_filt_conv_wchar_utf7_flush(mbfl_convert_filter *filter TSRMLS_DC) -{ - int status, cache; - - status = filter->status; - cache = filter->cache; - filter->status = 0; - filter->cache = 0; - /* flush fragments */ - switch (status) { - case 1: - CK((*filter->output_function)(mbfl_base64_table[(cache >> 10) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[(cache >> 4) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[(cache << 2) & 0x3c], filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - break; - - case 2: - CK((*filter->output_function)(mbfl_base64_table[(cache >> 14) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[(cache >> 8) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[(cache >> 2) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[(cache << 4) & 0x30], filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - break; - - case 3: - CK((*filter->output_function)(mbfl_base64_table[(cache >> 12) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[(cache >> 6) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_base64_table[cache & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - break; - } - return 0; -} - - -/* - * UTF7-IMAP => wchar - */ -static int -mbfl_filt_conv_utf7imap_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - n = -1; - if (filter->status != 0) { /* Modified Base64 */ - if (c >= 0x41 && c <= 0x5a) { /* A - Z */ - n = c - 65; - } else if (c >= 0x61 && c <= 0x7a) { /* a - z */ - n = c - 71; - } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */ - n = c + 4; - } else if (c == 0x2b) { /* '+' */ - n = 62; - } else if (c == 0x2c) { /* ',' */ - n = 63; - } - if (n < 0 || n > 63) { - if (c == 0x2d) { - if (filter->status == 1) { /* "&-" -> "&" */ - CK((*filter->output_function)(0x26, filter->data TSRMLS_CC)); - } - } else if (c >= 0 && c < 0x80) { /* ASCII exclude '-' */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { /* illegal character */ - s = c & MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - filter->cache = 0; - filter->status = 0; - return c; - } - } - - switch (filter->status) { - /* directly encoded characters */ - case 0: - if (c == 0x26) { /* '&' shift character */ - filter->status++; - } else if (c >= 0 && c < 0x80) { /* ASCII */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { /* illegal character */ - s = c & MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - break; - - /* decode Modified Base64 */ - case 1: - case 2: - filter->cache |= n << 10; - filter->status = 3; - break; - case 3: - filter->cache |= n << 4; - filter->status = 4; - break; - case 4: - s = ((n >> 2) & 0xf) | (filter->cache & 0xffff); - n = (n & 0x3) << 14; - filter->status = 5; - if (s >= 0xd800 && s < 0xdc00) { - s = (((s & 0x3ff) << 16) + 0x400000) | n; - filter->cache = s; - } else if (s >= 0xdc00 && s < 0xe000) { - s &= 0x3ff; - s |= (filter->cache & 0xfff0000) >> 6; - filter->cache = n; - if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { /* illegal character */ - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - } else { - filter->cache = n; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - break; - - case 5: - filter->cache |= n << 8; - filter->status = 6; - break; - case 6: - filter->cache |= n << 2; - filter->status = 7; - break; - case 7: - s = ((n >> 4) & 0x3) | (filter->cache & 0xffff); - n = (n & 0xf) << 12; - filter->status = 8; - if (s >= 0xd800 && s < 0xdc00) { - s = (((s & 0x3ff) << 16) + 0x400000) | n; - filter->cache = s; - } else if (s >= 0xdc00 && s < 0xe000) { - s &= 0x3ff; - s |= (filter->cache & 0xfff0000) >> 6; - filter->cache = n; - if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { /* illegal character */ - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - } else { - filter->cache = n; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - break; - - case 8: - filter->cache |= n << 6; - filter->status = 9; - break; - case 9: - s = n | (filter->cache & 0xffff); - filter->status = 2; - if (s >= 0xd800 && s < 0xdc00) { - s = (((s & 0x3ff) << 16) + 0x400000); - filter->cache = s; - } else if (s >= 0xdc00 && s < 0xe000) { - s &= 0x3ff; - s |= (filter->cache & 0xfff0000) >> 6; - filter->cache = 0; - if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { /* illegal character */ - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - } else { - filter->cache = 0; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -static const unsigned char mbfl_utf7imap_base64_table[] = -{ - /* 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', */ - 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d, - /* 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', */ - 0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a, - /* 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', */ - 0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d, - /* 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', */ - 0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a, - /* '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', ',', '\0' */ - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x2b,0x2c,0x00 -}; - -/* - * wchar => UTF7-IMAP - */ -static int -mbfl_filt_conv_wchar_utf7imap(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int n, s; - - n = 0; - if (c == 0x26) { - n = 1; - } else if ((c >= 0x20 && c <= 0x7e) || c == 0) { - n = 2; - } else if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) { - ; - } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) { - s = ((c >> 10) - 0x40) | 0xd800; - CK((*filter->filter_function)(s, filter TSRMLS_CC)); - s = (c & 0x3ff) | 0xdc00; - CK((*filter->filter_function)(s, filter TSRMLS_CC)); - return c; - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - return c; - } - - switch (filter->status) { - case 0: - if (n != 0) { /* directly encode characters */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - if (n == 1) { - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - } - } else { /* Modified Base64 */ - CK((*filter->output_function)(0x26, filter->data TSRMLS_CC)); /* '&' */ - filter->status = 1; - filter->cache = c; - } - break; - - /* encode Modified Base64 */ - case 1: - s = filter->cache; - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 10) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 4) & 0x3f], filter->data TSRMLS_CC)); - if (n != 0) { - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s << 2) & 0x3c], filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - if (n == 1) { - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - } - filter->status = 0; - } else { - filter->status = 2; - filter->cache = ((s & 0xf) << 16) | c; - } - break; - - case 2: - s = filter->cache; - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 14) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 8) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 2) & 0x3f], filter->data TSRMLS_CC)); - if (n != 0) { - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s << 4) & 0x30], filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - if (n == 1) { - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - } - filter->status = 0; - } else { - filter->status = 3; - filter->cache = ((s & 0x3) << 16) | c; - } - break; - - case 3: - s = filter->cache; - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 12) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 6) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_utf7imap_base64_table[s & 0x3f], filter->data TSRMLS_CC)); - if (n != 0) { - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - if (n == 1) { - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - } - filter->status = 0; - } else { - filter->status = 1; - filter->cache = c; - } - break; - - default: - filter->status = 0; - break; - } - - return c; - -} - -static int -mbfl_filt_conv_wchar_utf7imap_flush(mbfl_convert_filter *filter TSRMLS_DC) -{ - int status, cache; - - status = filter->status; - cache = filter->cache; - filter->status = 0; - filter->cache = 0; - /* flush fragments */ - switch (status) { - case 1: - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 10) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 4) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache << 2) & 0x3c], filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - break; - - case 2: - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 14) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 8) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 2) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache << 4) & 0x30], filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - break; - - case 3: - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 12) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 6) & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(mbfl_utf7imap_base64_table[cache & 0x3f], filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x2d, filter->data TSRMLS_CC)); /* '-' */ - break; - } - return 0; -} - - -/* - * wchar => ASCII - */ -static int -mbfl_filt_conv_wchar_ascii(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - if (c >= 0 && c < 0x80) { - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * wchar => cp1252 - */ -static int -mbfl_filt_conv_wchar_cp1252(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s=-1, n; - - if (c >= 0x100) { - /* look it up from the cp1252 table */ - s = -1; - n = 31; - while (n >= 0) { - if (c == cp1252_ucs_table[n] && c != 0xfffe) { - s = 0x80 + n; - break; - } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_1) - { - s = c & MBFL_WCSPLANE_MASK; - } - } - else if (c >= 0 && c < 0x100) { - s = c; - } - if (s >= 0) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - return c; -} - -/* - * cp1252 => wchar - */ -static int -mbfl_filt_conv_cp1252_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - if (c >= 0x80 && c < 0xa0) { - s = cp1252_ucs_table[c - 0x80]; - } else { - s = c; - } - - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - - return c; -} - -/* - * wchar => ISO-8859-1 - */ -static int -mbfl_filt_conv_wchar_8859_1(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - if (c >= 0 && c < 0x100) { - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * ISO-8859-2 => wchar - */ -static int -mbfl_filt_conv_8859_2_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - if (c >= 0 && c < 0xa0) { - s = c; - } else if (c >= 0xa0 && c < 0x100) { - s = iso8859_2_ucs_table[c - 0xa0]; - if (s <= 0) { - s = c; - s &= MBFL_WCSPLANE_MASK; - s |= MBFL_WCSPLANE_8859_2; - } - } else { - s = c; - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - } - - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - - return c; -} - -/* - * wchar => ISO-8859-2 - */ -static int -mbfl_filt_conv_wchar_8859_2(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - if (c >= 0 && c < 0xa0) { - s = c; - } else { - s = -1; - n = 95; - while (n >= 0) { - if (c == iso8859_2_ucs_table[n]) { - s = 0xa0 + n; - break; - } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_2) { - s = c & MBFL_WCSPLANE_MASK; - } - } - - if (s >= 0) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * ISO-8859-3 => wchar - */ -static int -mbfl_filt_conv_8859_3_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - if (c >= 0 && c < 0xa0) { - s = c; - } else if (c >= 0xa0 && c < 0x100) { - s = iso8859_3_ucs_table[c - 0xa0]; - if (s <= 0) { - s = c; - s &= MBFL_WCSPLANE_MASK; - s |= MBFL_WCSPLANE_8859_3; - } - } else { - s = c; - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - } - - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - - return c; -} - -/* - * wchar => ISO-8859-3 - */ -static int -mbfl_filt_conv_wchar_8859_3(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - if (c >= 0 && c < 0xa0) { - s = c; - } else { - s = -1; - n = 95; - while (n >= 0) { - if (c == iso8859_3_ucs_table[n]) { - s = 0xa0 + n; - break; - } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_3) { - s = c & MBFL_WCSPLANE_MASK; - } - } - - if (s >= 0) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * ISO-8859-4 => wchar - */ -static int -mbfl_filt_conv_8859_4_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - if (c >= 0 && c < 0xa0) { - s = c; - } else if (c >= 0xa0 && c < 0x100) { - s = iso8859_4_ucs_table[c - 0xa0]; - if (s <= 0) { - s = c; - s &= MBFL_WCSPLANE_MASK; - s |= MBFL_WCSPLANE_8859_4; - } - } else { - s = c; - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - } - - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - - return c; -} - -/* - * wchar => ISO-8859-4 - */ -static int -mbfl_filt_conv_wchar_8859_4(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - if (c >= 0 && c < 0xa0) { - s = c; - } else { - s = -1; - n = 95; - while (n >= 0) { - if (c == iso8859_4_ucs_table[n]) { - s = 0xa0 + n; - break; - } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_4) { - s = c & MBFL_WCSPLANE_MASK; - } - } - - if (s >= 0) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * ISO-8859-5 => wchar - */ -static int -mbfl_filt_conv_8859_5_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - if (c >= 0 && c < 0xa0) { - s = c; - } else if (c >= 0xa0 && c < 0x100) { - s = iso8859_5_ucs_table[c - 0xa0]; - if (s <= 0) { - s = c; - s &= MBFL_WCSPLANE_MASK; - s |= MBFL_WCSPLANE_8859_5; - } - } else { - s = c; - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - } - - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - - return c; -} - -/* - * wchar => ISO-8859-5 - */ -static int -mbfl_filt_conv_wchar_8859_5(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - if (c >= 0 && c < 0xa0) { - s = c; - } else { - s = -1; - n = 95; - while (n >= 0) { - if (c == iso8859_5_ucs_table[n]) { - s = 0xa0 + n; - break; - } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_5) { - s = c & MBFL_WCSPLANE_MASK; - } - } - - if (s >= 0) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * ISO-8859-6 => wchar - */ -static int -mbfl_filt_conv_8859_6_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - if (c >= 0 && c < 0xa0) { - s = c; - } else if (c >= 0xa0 && c < 0x100) { - s = iso8859_6_ucs_table[c - 0xa0]; - if (s <= 0) { - s = c; - s &= MBFL_WCSPLANE_MASK; - s |= MBFL_WCSPLANE_8859_6; - } - } else { - s = c; - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - } - - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - - return c; -} - -/* - * wchar => ISO-8859-6 - */ -static int -mbfl_filt_conv_wchar_8859_6(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - if (c >= 0 && c < 0xa0) { - s = c; - } else { - s = -1; - n = 95; - while (n >= 0) { - if (c == iso8859_6_ucs_table[n]) { - s = 0xa0 + n; - break; - } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_6) { - s = c & MBFL_WCSPLANE_MASK; - } - } - - if (s >= 0) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * ISO-8859-7 => wchar - */ -static int -mbfl_filt_conv_8859_7_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - if (c >= 0 && c < 0xa0) { - s = c; - } else if (c >= 0xa0 && c < 0x100) { - s = iso8859_7_ucs_table[c - 0xa0]; - if (s <= 0) { - s = c; - s &= MBFL_WCSPLANE_MASK; - s |= MBFL_WCSPLANE_8859_7; - } - } else { - s = c; - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - } - - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - - return c; -} - -/* - * wchar => ISO-8859-7 - */ -static int -mbfl_filt_conv_wchar_8859_7(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - if (c >= 0 && c < 0xa0) { - s = c; - } else { - s = -1; - n = 95; - while (n >= 0) { - if (c == iso8859_7_ucs_table[n]) { - s = 0xa0 + n; - break; - } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_7) { - s = c & MBFL_WCSPLANE_MASK; - } - } - - if (s >= 0) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * ISO-8859-8 => wchar - */ -static int -mbfl_filt_conv_8859_8_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - if (c >= 0 && c < 0xa0) { - s = c; - } else if (c >= 0xa0 && c < 0x100) { - s = iso8859_8_ucs_table[c - 0xa0]; - if (s <= 0) { - s = c; - s &= MBFL_WCSPLANE_MASK; - s |= MBFL_WCSPLANE_8859_8; - } - } else { - s = c; - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - } - - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - - return c; -} - -/* - * wchar => ISO-8859-8 - */ -static int -mbfl_filt_conv_wchar_8859_8(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - if (c >= 0 && c < 0xa0) { - s = c; - } else { - s = -1; - n = 95; - while (n >= 0) { - if (c == iso8859_8_ucs_table[n]) { - s = 0xa0 + n; - break; - } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_8) { - s = c & MBFL_WCSPLANE_MASK; - } - } - - if (s >= 0) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * ISO-8859-9 => wchar - */ -static int -mbfl_filt_conv_8859_9_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - if (c >= 0 && c < 0xa0) { - s = c; - } else if (c >= 0xa0 && c < 0x100) { - s = iso8859_9_ucs_table[c - 0xa0]; - if (s <= 0) { - s = c; - s &= MBFL_WCSPLANE_MASK; - s |= MBFL_WCSPLANE_8859_9; - } - } else { - s = c; - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - } - - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - - return c; -} - -/* - * wchar => ISO-8859-9 - */ -static int -mbfl_filt_conv_wchar_8859_9(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - if (c >= 0 && c < 0xa0) { - s = c; - } else { - s = -1; - n = 95; - while (n >= 0) { - if (c == iso8859_9_ucs_table[n]) { - s = 0xa0 + n; - break; - } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_9) { - s = c & MBFL_WCSPLANE_MASK; - } - } - - if (s >= 0) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * ISO-8859-10 => wchar - */ -static int -mbfl_filt_conv_8859_10_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - if (c >= 0 && c < 0xa0) { - s = c; - } else if (c >= 0xa0 && c < 0x100) { - s = iso8859_10_ucs_table[c - 0xa0]; - if (s <= 0) { - s = c; - s &= MBFL_WCSPLANE_MASK; - s |= MBFL_WCSPLANE_8859_10; - } - } else { - s = c; - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - } - - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - - return c; -} - -/* - * wchar => ISO-8859-10 - */ -static int -mbfl_filt_conv_wchar_8859_10(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - if (c >= 0 && c < 0xa0) { - s = c; - } else { - s = -1; - n = 95; - while (n >= 0) { - if (c == iso8859_10_ucs_table[n]) { - s = 0xa0 + n; - break; - } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_10) { - s = c & MBFL_WCSPLANE_MASK; - } - } - - if (s >= 0) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * ISO-8859-13 => wchar - */ -static int -mbfl_filt_conv_8859_13_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - if (c >= 0 && c < 0xa0) { - s = c; - } else if (c >= 0xa0 && c < 0x100) { - s = iso8859_13_ucs_table[c - 0xa0]; - if (s <= 0) { - s = c; - s &= MBFL_WCSPLANE_MASK; - s |= MBFL_WCSPLANE_8859_13; - } - } else { - s = c; - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - } - - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - - return c; -} - -/* - * wchar => ISO-8859-13 - */ -static int -mbfl_filt_conv_wchar_8859_13(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - if (c >= 0 && c < 0xa0) { - s = c; - } else { - s = -1; - n = 95; - while (n >= 0) { - if (c == iso8859_13_ucs_table[n]) { - s = 0xa0 + n; - break; - } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_13) { - s = c & MBFL_WCSPLANE_MASK; - } - } - - if (s >= 0) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * ISO-8859-14 => wchar - */ -static int -mbfl_filt_conv_8859_14_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - if (c >= 0 && c < 0xa0) { - s = c; - } else if (c >= 0xa0 && c < 0x100) { - s = iso8859_14_ucs_table[c - 0xa0]; - if (s <= 0) { - s = c; - s &= MBFL_WCSPLANE_MASK; - s |= MBFL_WCSPLANE_8859_14; - } - } else { - s = c; - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - } - - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - - return c; -} - -/* - * wchar => ISO-8859-14 - */ -static int -mbfl_filt_conv_wchar_8859_14(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - if (c >= 0 && c < 0xa0) { - s = c; - } else { - s = -1; - n = 95; - while (n >= 0) { - if (c == iso8859_14_ucs_table[n]) { - s = 0xa0 + n; - break; - } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_14) { - s = c & MBFL_WCSPLANE_MASK; - } - } - - if (s >= 0) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * ISO-8859-15 => wchar - */ -static int -mbfl_filt_conv_8859_15_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - if (c >= 0 && c < 0xa0) { - s = c; - } else if (c >= 0xa0 && c < 0x100) { - s = iso8859_15_ucs_table[c - 0xa0]; - if (s <= 0) { - s = c; - s &= MBFL_WCSPLANE_MASK; - s |= MBFL_WCSPLANE_8859_15; - } - } else { - s = c; - s &= MBFL_WCSGROUP_MASK; - s |= MBFL_WCSGROUP_THROUGH; - } - - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - - return c; -} - -/* - * wchar => ISO-8859-15 - */ -static int -mbfl_filt_conv_wchar_8859_15(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s, n; - - if (c >= 0 && c < 0xa0) { - s = c; - } else { - s = -1; - n = 95; - while (n >= 0) { - if (c == iso8859_15_ucs_table[n]) { - s = 0xa0 + n; - break; - } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_15) { - s = c & MBFL_WCSPLANE_MASK; - } - } - - if (s >= 0) { - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - - - -/* - * - * identify filter functions - * - */ - -static void -mbfl_filt_ident_common_ctor(mbfl_identify_filter *filter TSRMLS_DC) -{ - filter->status = 0; - filter->flag = 0; -} - -static void -mbfl_filt_ident_common_dtor(mbfl_identify_filter *filter TSRMLS_DC) -{ - filter->status = 0; -} - -static int -mbfl_filt_ident_ascii(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - if (c >= 0x20 && c < 0x80) { - ; - } else if (c == 0x0d || c == 0x0a || c == 0x09 || c == 0) { /* CR or LF or HTAB or null */ - ; - } else { - filter->flag = 1; - } - - return c; -} - -static int -mbfl_filt_ident_utf8(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - if (c < 0x80) { - if (c < 0) { - filter->flag = 1; /* bad */ - } else if (c != 0 && filter->status) { - filter->flag = 1; /* bad */ - } - filter->status = 0; - } else if (c < 0xc0) { - switch (filter->status) { - case 0x20: /* 3 byte code 2nd char */ - case 0x30: /* 4 byte code 2nd char */ - case 0x31: /* 4 byte code 3rd char */ - case 0x40: /* 5 byte code 2nd char */ - case 0x41: /* 5 byte code 3rd char */ - case 0x42: /* 5 byte code 4th char */ - case 0x50: /* 6 byte code 2nd char */ - case 0x51: /* 6 byte code 3rd char */ - case 0x52: /* 6 byte code 4th char */ - case 0x53: /* 6 byte code 5th char */ - filter->status++; - break; - case 0x10: /* 2 byte code 2nd char */ - case 0x21: /* 3 byte code 3rd char */ - case 0x32: /* 4 byte code 4th char */ - case 0x43: /* 5 byte code 5th char */ - case 0x54: /* 6 byte code 6th char */ - filter->status = 0; - break; - default: - filter->flag = 1; /* bad */ - filter->status = 0; - break; - } - } else { - if (filter->status) { - filter->flag = 1; /* bad */ - } - filter->status = 0; - if (c < 0xe0) { /* 2 byte code first char */ - filter->status = 0x10; - } else if (c < 0xf0) { /* 3 byte code 1st char */ - filter->status = 0x20; - } else if (c < 0xf8) { /* 4 byte code 1st char */ - filter->status = 0x30; - } else if (c < 0xfc) { /* 5 byte code 1st char */ - filter->status = 0x40; - } else if (c < 0xfe) { /* 6 byte code 1st char */ - filter->status = 0x50; - } else { - filter->flag = 1; /* bad */ - } - } - - return c; -} - -static int -mbfl_filt_ident_utf7(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - int n; - - switch (filter->status) { - /* directly encoded characters */ - case 0: - if (c == 0x2b) { /* '+' shift character */ - filter->status++; - } else if (c == 0x5c || c == 0x7e || c < 0 || c > 0x7f) { /* illegal character */ - filter->flag = 1; /* bad */ - } - break; - - /* Modified Base64 */ - case 1: - case 2: - n = 0; - if (c >= 0x41 && c <= 0x5a) { /* A - Z */ - n = 1; - } else if (c >= 0x61 && c <= 0x7a) { /* a - z */ - n = 1; - } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */ - n = 1; - } else if (c == 0x2b) { /* '+' */ - n = 1; - } else if (c == 0x2f) { /* '/' */ - n = 1; - } - if (n <= 0) { - if (filter->status == 1 && c != 0x2d) { - filter->flag = 1; /* bad */ - } else if (c < 0 || c > 0x7f) { - filter->flag = 1; /* bad */ - } - filter->status = 0; - } else { - filter->status = 2; - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -#if defined(HAVE_MBSTR_JA) -static int -mbfl_filt_ident_eucjp(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - switch (filter->status) { - case 0: /* latin */ - if (c >= 0 && c < 0x80) { /* ok */ - ; - } else if (c > 0xa0 && c < 0xff) { /* kanji first char */ - filter->status = 1; - } else if (c == 0x8e) { /* kana first char */ - filter->status = 2; - } else if (c == 0x8f) { /* X 0212 first char */ - filter->status = 3; - } else { /* bad */ - filter->flag = 1; - } - break; - - case 1: /* got first half */ - if (c < 0xa1 || c > 0xfe) { /* bad */ - filter->flag = 1; - } - filter->status = 0; - break; - - case 2: /* got 0x8e */ - if (c < 0xa1 || c > 0xdf) { /* bad */ - filter->flag = 1; - } - filter->status = 0; - break; - - case 3: /* got 0x8f */ - if (c < 0xa1 || c > 0xfe) { /* bad */ - filter->flag = 1; - } - filter->status++; - break; - case 4: /* got 0x8f */ - if (c < 0xa1 || c > 0xfe) { /* bad */ - filter->flag = 1; - } - filter->status = 0; - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -static int -mbfl_filt_ident_sjis(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - 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 < 0xf0 && c != 0xa0) { /* kanji first char */ - filter->status = 1; - } else { /* bad */ - filter->flag = 1; - } - - return c; -} - -static int -mbfl_filt_ident_sjiswin(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - 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; -} - -static int -mbfl_filt_ident_jis(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ -retry: - switch (filter->status & 0xf) { -/* case 0x00: ASCII */ -/* case 0x10: X 0201 latin */ -/* case 0x20: X 0201 kana */ -/* case 0x80: X 0208 */ -/* case 0x90: X 0212 */ - case 0: - if (c == 0x1b) { - filter->status += 2; - } else if (c == 0x0e) { /* "kana in" */ - filter->status = 0x20; - } else if (c == 0x0f) { /* "kana out" */ - filter->status = 0; - } else if ((filter->status == 0x80 || filter->status == 0x90) && c > 0x20 && c < 0x7f) { /* kanji first char */ - filter->status += 1; - } else if (c >= 0 && c < 0x80) { /* latin, CTLs */ - ; - } else { - filter->flag = 1; /* bad */ - } - break; - -/* case 0x81: X 0208 second char */ -/* case 0x91: X 0212 second char */ - case 1: - filter->status &= ~0xf; - if (c == 0x1b) { - goto retry; - } else if (c < 0x21 || c > 0x7e) { /* bad */ - filter->flag = 1; - } - break; - - /* ESC */ - case 2: - if (c == 0x24) { /* '$' */ - filter->status++; - } else if (c == 0x28) { /* '(' */ - filter->status += 3; - } else { - filter->flag = 1; /* bad */ - filter->status &= ~0xf; - goto retry; - } - break; - - /* ESC $ */ - case 3: - if (c == 0x40 || c == 0x42) { /* '@' or 'B' */ - filter->status = 0x80; - } else if (c == 0x28) { /* '(' */ - filter->status++; - } else { - filter->flag = 1; /* bad */ - filter->status &= ~0xf; - goto retry; - } - break; - - /* ESC $ ( */ - case 4: - if (c == 0x40 || c == 0x42) { /* '@' or 'B' */ - filter->status = 0x80; - } else if (c == 0x44) { /* 'D' */ - filter->status = 0x90; - } else { - filter->flag = 1; /* bad */ - filter->status &= ~0xf; - goto retry; - } - break; - - /* ESC ( */ - case 5: - if (c == 0x42 || c == 0x48) { /* 'B' or 'H' */ - filter->status = 0; - } else if (c == 0x4a) { /* 'J' */ - filter->status = 0x10; - } else if (c == 0x49) { /* 'I' */ - filter->status = 0x20; - } else { - filter->flag = 1; /* bad */ - filter->status &= ~0xf; - goto retry; - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} -#endif /* HAVE_MBSTR_JA */ - -#if defined(HAVE_MBSTR_CN) -static int -mbfl_filt_ident_euccn(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - switch (filter->status) { - case 0: /* latin */ - if (c >= 0 && c < 0x80) { /* ok */ - ; - } else if (c > 0xa0 && c < 0xff) { /* DBCS lead byte */ - filter->status = 1; - } else { /* bad */ - filter->flag = 1; - } - break; - - case 1: /* got lead byte */ - if (c < 0xa1 || c > 0xfe) { /* bad */ - filter->flag = 1; - } - filter->status = 0; - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -static int -mbfl_filt_ident_cp936(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - if (filter->status) { /* kanji second char */ - if (c < 0x40 || c > 0xfe || c == 0x7f) { /* bad */ - filter->flag = 1; - } - filter->status = 0; - } else if (c >= 0 && c < 0x80) { /* latin ok */ - ; - } else if (c > 0x80 && c < 0xff) { /* DBCS lead byte */ - filter->status = 1; - } else { /* bad */ - filter->flag = 1; - } - - return c; -} - -static int -mbfl_filt_ident_hz(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - switch (filter->status & 0xf) { -/* case 0x00: ASCII */ -/* case 0x10: GB2312 */ - case 0: - if (c == 0x7e) { - filter->status += 2; - } else if (filter->status == 0x10 && c > 0x20 && c < 0x7f) { /* DBCS first char */ - filter->status += 1; - } else if (c >= 0 && c < 0x80) { /* latin, CTLs */ - ; - } else { - filter->flag = 1; /* bad */ - } - break; - -/* case 0x11: GB2312 second char */ - case 1: - filter->status &= ~0xf; - if (c < 0x21 || c > 0x7e) { /* bad */ - filter->flag = 1; - } - break; - - case 2: - if (c == 0x7d) { /* '}' */ - filter->status = 0; - } else if (c == 0x7b) { /* '{' */ - filter->status = 0x10; - } else if (c == 0x7e) { /* '~' */ - filter->status = 0; - } else { - filter->flag = 1; /* bad */ - filter->status &= ~0xf; - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -#endif /* HAVE_MBSTR_CN */ - -#if defined(HAVE_MBSTR_TW) -static int -mbfl_filt_ident_euctw(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - switch (filter->status) { - case 0: /* latin */ - if (c >= 0 && c < 0x80) { /* ok */ - ; - } else if (c > 0xa0 && c < 0xff) { /* DBCS lead byte */ - filter->status = 1; - } else if (c == 0x8e) { /* DBCS lead byte */ - filter->status = 2; - } else { /* bad */ - filter->flag = 1; - } - break; - - case 1: /* got lead byte */ - if (c < 0xa1 || c > 0xfe) { /* bad */ - filter->flag = 1; - } - filter->status = 0; - break; - - case 2: /* got lead byte */ - if (c >= 0xa1 && c < 0xaf) { /* ok */ - filter->status = 3; - } else { - filter->flag = 1; /* bad */ - } - break; - - case 3: /* got lead byte */ - if (c < 0xa1 || c > 0xfe) { /* bad */ - filter->flag = 1; - } - filter->status = 4; - break; - - case 4: /* got lead byte */ - if (c < 0xa1 || c > 0xfe) { /* bad */ - filter->flag = 1; - } - filter->status = 0; - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -static int -mbfl_filt_ident_big5(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - if (filter->status) { /* kanji second char */ - if (c < 0x40 || (c > 0x7e && c < 0xa1) ||c > 0xfe) { /* bad */ - filter->flag = 1; - } - filter->status = 0; - } else if (c >= 0 && c < 0x80) { /* latin ok */ - ; - } else if (c > 0xa0 && c < 0xff) { /* DBCS lead byte */ - filter->status = 1; - } else { /* bad */ - filter->flag = 1; - } - - return c; -} - -#endif /* HAVE_MBSTR_TW */ - -#if defined(HAVE_MBSTR_KR) -static int -mbfl_filt_ident_euckr(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - switch (filter->status) { - case 0: /* latin */ - if (c >= 0 && c < 0x80) { /* ok */ - ; - } else if (c > 0xa0 && c < 0xff) { /* DBCS lead byte */ - filter->status = 1; - } else { /* bad */ - filter->flag = 1; - } - break; - - case 1: /* got lead byte */ - if (c < 0xa1 || c > 0xfe) { /* bad */ - filter->flag = 1; - } - filter->status = 0; - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -static int -mbfl_filt_ident_uhc(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - switch (filter->status) { - case 0: /* latin */ - if (c >= 0 && c < 0x80) { /* ok */ - ; - } else if (c >= 0x81 && c <= 0xa0) { /* dbcs first char */ - filter->status= 1; - } else if (c >= 0xa1 && c <= 0xc6) { /* dbcs first char */ - filter->status= 2; - } else if (c >= 0xc7 && c <= 0xfe) { /* dbcs first char */ - filter->status= 3; - } else { /* bad */ - filter->flag = 1; - } - - case 1: - case 2: - if (c < 0x41 || (c > 0x5a && c < 0x61) - || (c > 0x7a && c < 0x81) || c > 0xfe) { /* bad */ - filter->flag = 1; - } - filter->status = 0; - break; - - case 3: - if (c < 0xa1 || c > 0xfe) { /* bad */ - filter->flag = 1; - } - filter->status = 0; - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -static int -mbfl_filt_ident_2022kr(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ -retry: - switch (filter->status & 0xf) { -/* case 0x00: ASCII */ -/* case 0x10: KSC5601 mode */ -/* case 0x20: KSC5601 DBCS */ -/* case 0x40: KSC5601 SBCS */ - case 0: - if (!(filter->status & 0x10)) { - if (c == 0x1b) - filter->status += 2; - } else if (filter->status == 0x20 && c > 0x20 && c < 0x7f) { /* kanji first char */ - filter->status += 1; - } else if (c >= 0 && c < 0x80) { /* latin, CTLs */ - ; - } else { - filter->flag = 1; /* bad */ - } - break; - -/* case 0x21: KSC5601 second char */ - case 1: - filter->status &= ~0xf; - if (c < 0x21 || c > 0x7e) { /* bad */ - filter->flag = 1; - } - break; - - /* ESC */ - case 2: - if (c == 0x24) { /* '$' */ - filter->status++; - } else { - filter->flag = 1; /* bad */ - filter->status &= ~0xf; - goto retry; - } - break; - - /* ESC $ */ - case 3: - if (c == 0x29) { /* ')' */ - filter->status++; - } else { - filter->flag = 1; /* bad */ - filter->status &= ~0xf; - goto retry; - } - break; - - /* ESC $) */ - case 5: - if (c == 0x43) { /* 'C' */ - filter->status = 0x10; - } else { - filter->flag = 1; /* bad */ - filter->status &= ~0xf; - goto retry; - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -#endif /* HAVE_MBSTR_KR */ - - -/* We only distinguish the MS extensions to ISO-8859-1. - * Actually, this is pretty much a NO-OP, since the identification - * system doesn't allow us to discriminate between a positive match, - * a possible match and a definite non-match. - * The problem here is that cp1252 looks like SJIS for certain chars. - * */ -static int -mbfl_filt_ident_cp1252(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - if (c >= 0x80 && c < 0xa0) - filter->flag = 0; - else - filter->flag = 1; /* not it */ - return c; -} - -#if defined(HAVE_MBSTR_RU) -/* all of this is so ugly now! */ -static int -mbfl_filt_ident_cp1251(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - if (c >= 0x80 && c < 0xff) - filter->flag = 0; - else - filter->flag = 1; /* not it */ - return c; -} - -static int -mbfl_filt_ident_cp866(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - if (c >= 0x80 && c < 0xff) - filter->flag = 0; - else - filter->flag = 1; /* not it */ - return c; -} - -static int -mbfl_filt_ident_koi8r(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - if (c >= 0x80 && c < 0xff) - filter->flag = 0; - else - filter->flag = 1; /* not it */ - return c; -} -#endif /* HAVE_MBSTR_RU */ - -static int -mbfl_filt_ident_2022jp(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ -retry: - switch (filter->status & 0xf) { -/* case 0x00: ASCII */ -/* case 0x10: X 0201 latin */ -/* case 0x80: X 0208 */ - case 0: - if (c == 0x1b) { - filter->status += 2; - } else if (filter->status == 0x80 && c > 0x20 && c < 0x7f) { /* kanji first char */ - filter->status += 1; - } else if (c >= 0 && c < 0x80) { /* latin, CTLs */ - ; - } else { - filter->flag = 1; /* bad */ - } - break; - -/* case 0x81: X 0208 second char */ - case 1: - if (c == 0x1b) { - filter->status++; - } else { - filter->status &= ~0xf; - if (c < 0x21 || c > 0x7e) { /* bad */ - filter->flag = 1; - } - } - break; - - /* ESC */ - case 2: - if (c == 0x24) { /* '$' */ - filter->status++; - } else if (c == 0x28) { /* '(' */ - filter->status += 3; - } else { - filter->flag = 1; /* bad */ - filter->status &= ~0xf; - goto retry; - } - break; - - /* ESC $ */ - case 3: - if (c == 0x40 || c == 0x42) { /* '@' or 'B' */ - filter->status = 0x80; - } else { - filter->flag = 1; /* bad */ - filter->status &= ~0xf; - goto retry; - } - break; - - /* ESC ( */ - case 5: - if (c == 0x42) { /* 'B' */ - filter->status = 0; - } else if (c == 0x4a) { /* 'J' */ - filter->status = 0x10; - } else { - filter->flag = 1; /* bad */ - filter->status &= ~0xf; - goto retry; - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -static void -mbfl_filt_ident_false_ctor(mbfl_identify_filter *filter TSRMLS_DC) -{ - filter->status = 0; - filter->flag = 1; -} - -static int -mbfl_filt_ident_false(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - filter->flag = 1; /* bad */ - return c; -} - -static int -mbfl_filt_ident_true(int c, mbfl_identify_filter *filter TSRMLS_DC) -{ - return c; -} - - - -/* - * convert filter - */ - -/* setup filter function table */ -static void -mbfl_convert_filter_set_vtbl(mbfl_convert_filter *filter, const struct mbfl_convert_vtbl *vtbl) -{ - if (filter && vtbl) { - filter->filter_ctor = vtbl->filter_ctor; - filter->filter_dtor = vtbl->filter_dtor; - filter->filter_function = vtbl->filter_function; - filter->filter_flush = vtbl->filter_flush; - } -} - - -static const struct mbfl_convert_vtbl * -mbfl_convert_filter_get_vtbl(enum mbfl_no_encoding from, enum mbfl_no_encoding to) -{ - const struct mbfl_convert_vtbl *vtbl; - int i; - - if (to == mbfl_no_encoding_base64 || - to == mbfl_no_encoding_qprint || - to == mbfl_no_encoding_7bit) { - from = mbfl_no_encoding_8bit; - } else if (from == mbfl_no_encoding_base64 || - from == mbfl_no_encoding_qprint || - from == mbfl_no_encoding_uuencode) { - to = mbfl_no_encoding_8bit; - } - - i = 0; - while ((vtbl = mbfl_convert_filter_list[i++]) != NULL){ - if (vtbl->from == from && vtbl->to == to) { - return vtbl; - } - } - - return NULL; -} - - -static void -mbfl_convert_filter_select_vtbl(mbfl_convert_filter *filter) -{ - const struct mbfl_convert_vtbl *vtbl; - - vtbl = mbfl_convert_filter_get_vtbl(filter->from->no_encoding, filter->to->no_encoding); - if (vtbl == NULL) { - vtbl = &vtbl_pass; - } - mbfl_convert_filter_set_vtbl(filter, vtbl); -} - - -/* filter pipe */ -static int -mbfl_filter_output_pipe(int c, void* data TSRMLS_DC) -{ - mbfl_convert_filter *filter = (mbfl_convert_filter*)data; - return (*filter->filter_function)(c, filter TSRMLS_CC); -} - - -/* null output */ -static int -mbfl_filter_output_null(int c, void* data TSRMLS_DC) -{ - return c; -} - - -mbfl_convert_filter * -mbfl_convert_filter_new( - enum mbfl_no_encoding from, - enum mbfl_no_encoding to, - int (*output_function)(int, void* TSRMLS_DC), - int (*flush_function)(void* TSRMLS_DC), - void* data TSRMLS_DC) -{ - mbfl_convert_filter * filter; - - /* allocate */ - filter = (mbfl_convert_filter *)mbfl_malloc(sizeof(mbfl_convert_filter)); - if (filter == NULL) { - return NULL; - } - - /* encoding structure */ - filter->from = mbfl_no2encoding(from); - filter->to = mbfl_no2encoding(to); - if (filter->from == NULL) { - filter->from = &mbfl_encoding_pass; - } - if (filter->to == NULL) { - filter->to = &mbfl_encoding_pass; - } - - if (output_function != NULL) { - filter->output_function = output_function; - } else { - filter->output_function = mbfl_filter_output_null; - } - filter->flush_function = flush_function; - filter->data = data; - filter->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; - filter->illegal_substchar = 0x3f; /* '?' */ - - /* setup the function table */ - mbfl_convert_filter_select_vtbl(filter); - - /* constructor */ - (*filter->filter_ctor)(filter TSRMLS_CC); - - return filter; -} - -void -mbfl_convert_filter_delete(mbfl_convert_filter *filter TSRMLS_DC) -{ - if (filter) { - (*filter->filter_dtor)(filter TSRMLS_CC); - mbfl_free((void*)filter); - } -} - -int -mbfl_convert_filter_feed(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - return (*filter->filter_function)(c, filter TSRMLS_CC); -} - -int -mbfl_convert_filter_flush(mbfl_convert_filter *filter TSRMLS_DC) -{ - (*filter->filter_flush)(filter TSRMLS_CC); - return (filter->flush_function ? (*filter->flush_function)(filter->data TSRMLS_CC) : 0); -} - -void -mbfl_convert_filter_reset( - mbfl_convert_filter *filter, - enum mbfl_no_encoding from, - enum mbfl_no_encoding to TSRMLS_DC) -{ - /* destruct old filter */ - (*filter->filter_dtor)(filter TSRMLS_CC); - - /* resset filter member */ - filter->from = mbfl_no2encoding(from); - filter->to = mbfl_no2encoding(to); - - /* set the vtbl */ - mbfl_convert_filter_select_vtbl(filter); - - /* construct new filter */ - (*filter->filter_ctor)(filter TSRMLS_CC); -} - -void -mbfl_convert_filter_copy( - mbfl_convert_filter *src, - mbfl_convert_filter *dist TSRMLS_DC) -{ - dist->filter_ctor = src->filter_ctor; - dist->filter_dtor = src->filter_dtor; - dist->filter_function = src->filter_function; - dist->filter_flush = src->filter_flush; - dist->output_function = src->output_function; - dist->flush_function = src->flush_function; - dist->data = src->data; - dist->status = src->status; - dist->cache = src->cache; - dist->from = src->from; - dist->to = src->to; - dist->illegal_mode = src->illegal_mode; - dist->illegal_substchar = src->illegal_substchar; -} - -static int -mbfl_convert_filter_devcat(mbfl_convert_filter *filter, mbfl_memory_device *src - TSRMLS_DC) -{ - int n; - unsigned char *p; - - p = src->buffer; - n = src->pos; - while (n > 0) { - if ((*filter->filter_function)(*p++, filter TSRMLS_CC) < 0) { - return -1; - } - n--; - } - - return n; -} - -static int -mbfl_convert_filter_strcat(mbfl_convert_filter *filter, const unsigned char *p TSRMLS_DC) -{ - int c; - - while ((c = *p++) != '\0') { - if ((*filter->filter_function)(c, filter TSRMLS_CC) < 0) { - return -1; - } - } - - return 0; -} - -#if 0 -static int -mbfl_convert_filter_strncat(mbfl_convert_filter *filter, const unsigned char *p, - int n TSRMLS_DC) -{ - while (n > 0) { - if ((*filter->filter_function)(*p++, filter TSRMLS_CC) < 0) { - return -1; - } - n--; - } - - return n; -} -#endif - -/* illegal character output function for conv-filter */ -int -mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int mode_backup, ret, n, m, r; - - ret = 0; - mode_backup = filter->illegal_mode; - filter->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE; - switch (mode_backup) { - case MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR: - ret = (*filter->filter_function)(filter->illegal_substchar, filter TSRMLS_CC); - break; - case MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG: - if (c >= 0) { - if (c < MBFL_WCSGROUP_UCS4MAX) { /* unicode */ - ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"U+" TSRMLS_CC); - } else { - if (c < MBFL_WCSGROUP_WCHARMAX) { - m = c & ~MBFL_WCSPLANE_MASK; - switch (m) { - case MBFL_WCSPLANE_JIS0208: - ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"JIS+" TSRMLS_CC); - break; - case MBFL_WCSPLANE_JIS0212: - ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"JIS2+" TSRMLS_CC); - break; - case MBFL_WCSPLANE_WINCP932: - ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"W932+" TSRMLS_CC); - break; - case MBFL_WCSPLANE_8859_1: - ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"I8859_1+" TSRMLS_CC); - break; - default: - ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"?+" TSRMLS_CC); - break; - } - c &= MBFL_WCSPLANE_MASK; - } else { - ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"BAD+" TSRMLS_CC); - c &= MBFL_WCSGROUP_MASK; - } - } - if (ret >= 0) { - m = 0; - r = 28; - while (r >= 0) { - n = (c >> r) & 0xf; - if (n || m) { - m = 1; - ret = (*filter->filter_function)(mbfl_hexchar_table[n], filter TSRMLS_CC); - if (ret < 0) { - break; - } - } - r -= 4; - } - if (m == 0 && ret >= 0) { - ret = (*filter->filter_function)(mbfl_hexchar_table[0], filter TSRMLS_CC); - } - } - } - break; - default: - break; - } - filter->illegal_mode = mode_backup; - - return ret; -} - - -/* - * identify filter - */ - -static void -mbfl_identify_filter_set_vtbl(mbfl_identify_filter *filter, const struct mbfl_identify_vtbl *vtbl) -{ - if (filter && vtbl) { - filter->filter_ctor = vtbl->filter_ctor; - filter->filter_dtor = vtbl->filter_dtor; - filter->filter_function = vtbl->filter_function; - } -} - -static const struct mbfl_identify_vtbl * -mbfl_identify_filter_get_vtbl(enum mbfl_no_encoding encoding) -{ - const struct mbfl_identify_vtbl * vtbl; - int i; - - i = 0; - while ((vtbl = mbfl_identify_filter_list[i++]) != NULL) { - if (vtbl->encoding == encoding) { - break; - } - } - - return vtbl; -} - -static void -mbfl_identify_filter_select_vtbl(mbfl_identify_filter *filter) -{ - const struct mbfl_identify_vtbl *vtbl; - - vtbl = mbfl_identify_filter_get_vtbl(filter->encoding->no_encoding); - if (vtbl == NULL) { - vtbl = &vtbl_identify_false; - } - mbfl_identify_filter_set_vtbl(filter, vtbl); -} - -mbfl_identify_filter * -mbfl_identify_filter_new(enum mbfl_no_encoding encoding TSRMLS_DC) -{ - mbfl_identify_filter * filter; - - /* allocate */ - filter = (mbfl_identify_filter *)mbfl_malloc(sizeof(mbfl_identify_filter)); - if (filter == NULL) { - return NULL; - } - - /* encoding structure */ - filter->encoding = mbfl_no2encoding(encoding); - if (filter->encoding == NULL) { - filter->encoding = &mbfl_encoding_pass; - } - - filter->status = 0; - filter->flag = 0; - filter->score = 0; - - /* setup the function table */ - mbfl_identify_filter_select_vtbl(filter); - - /* constructor */ - (*filter->filter_ctor)(filter TSRMLS_CC); - - return filter; -} - -void -mbfl_identify_filter_delete(mbfl_identify_filter *filter TSRMLS_DC) -{ - if (filter) { - (*filter->filter_dtor)(filter TSRMLS_CC); - mbfl_free((void*)filter); - } -} - - - -/* - * buffering converter - */ -mbfl_buffer_converter * -mbfl_buffer_converter_new( - enum mbfl_no_encoding from, - enum mbfl_no_encoding to, - int buf_initsz TSRMLS_DC) -{ - mbfl_buffer_converter *convd; - - /* allocate */ - convd = (mbfl_buffer_converter*)mbfl_malloc(sizeof (mbfl_buffer_converter)); - if (convd == NULL) { - return NULL; - } - - /* initialize */ - convd->from = mbfl_no2encoding(from); - convd->to = mbfl_no2encoding(to); - if (convd->from == NULL) { - convd->from = &mbfl_encoding_pass; - } - if (convd->to == NULL) { - convd->to = &mbfl_encoding_pass; - } - - /* create convert filter */ - convd->filter1 = NULL; - convd->filter2 = NULL; - if (mbfl_convert_filter_get_vtbl(convd->from->no_encoding, convd->to->no_encoding) != NULL) { - convd->filter1 = mbfl_convert_filter_new(convd->from->no_encoding, convd->to->no_encoding, mbfl_memory_device_output, 0, &convd->device TSRMLS_CC); - } else { - convd->filter2 = mbfl_convert_filter_new(mbfl_no_encoding_wchar, convd->to->no_encoding, mbfl_memory_device_output, 0, &convd->device TSRMLS_CC); - if (convd->filter2 != NULL) { - convd->filter1 = mbfl_convert_filter_new(convd->from->no_encoding, mbfl_no_encoding_wchar, (int (*)(int, void* TSRMLS_DC))convd->filter2->filter_function, NULL, convd->filter2 TSRMLS_CC); - if (convd->filter1 == NULL) { - mbfl_convert_filter_delete(convd->filter2 TSRMLS_CC); - } - } - } - if (convd->filter1 == NULL) { - return NULL; - } - - mbfl_memory_device_init(&convd->device, buf_initsz, buf_initsz/4 TSRMLS_CC); - - return convd; -} - -void -mbfl_buffer_converter_delete(mbfl_buffer_converter *convd TSRMLS_DC) -{ - if (convd != NULL) { - if (convd->filter1) { - mbfl_convert_filter_delete(convd->filter1 TSRMLS_CC); - } - if (convd->filter2) { - mbfl_convert_filter_delete(convd->filter2 TSRMLS_CC); - } - mbfl_memory_device_clear(&convd->device TSRMLS_CC); - mbfl_free((void*)convd); - } -} - -void -mbfl_buffer_converter_reset(mbfl_buffer_converter *convd TSRMLS_DC) -{ - mbfl_memory_device_reset(&convd->device TSRMLS_CC); -} - -int -mbfl_buffer_converter_illegal_mode(mbfl_buffer_converter *convd, int mode TSRMLS_DC) -{ - if (convd != NULL) { - if (convd->filter2 != NULL) { - convd->filter2->illegal_mode = mode; - } else if (convd->filter1 != NULL) { - convd->filter1->illegal_mode = mode; - } else { - return 0; - } - } - - return 1; -} - -int -mbfl_buffer_converter_illegal_substchar(mbfl_buffer_converter *convd, int substchar TSRMLS_DC) -{ - if (convd != NULL) { - if (convd->filter2 != NULL) { - convd->filter2->illegal_substchar = substchar; - } else if (convd->filter1 != NULL) { - convd->filter1->illegal_substchar = substchar; - } else { - return 0; - } - } - - return 1; -} - -int -mbfl_buffer_converter_strncat(mbfl_buffer_converter *convd, const unsigned char *p, int n TSRMLS_DC) -{ - mbfl_convert_filter *filter; - int (*filter_function)(int c, mbfl_convert_filter *filter TSRMLS_DC); - - if (convd != NULL && p != NULL) { - filter = convd->filter1; - if (filter != NULL) { - filter_function = filter->filter_function; - while (n > 0) { - if ((*filter_function)(*p++, filter TSRMLS_CC) < 0) { - break; - } - n--; - } - } - } - - return n; -} - -int -mbfl_buffer_converter_feed(mbfl_buffer_converter *convd, mbfl_string *string TSRMLS_DC) -{ - int n; - unsigned char *p; - mbfl_convert_filter *filter; - int (*filter_function)(int c, mbfl_convert_filter *filter TSRMLS_DC); - - if (convd == NULL || string == NULL) { - return -1; - } - mbfl_memory_device_realloc(&convd->device, convd->device.pos + string->len, string->len/4 TSRMLS_CC); - /* feed data */ - n = string->len; - p = string->val; - filter = convd->filter1; - if (filter != NULL) { - filter_function = filter->filter_function; - while (n > 0) { - if ((*filter_function)(*p++, filter TSRMLS_CC) < 0) { - return -1; - } - n--; - } - } - - return 0; -} - -int -mbfl_buffer_converter_flush(mbfl_buffer_converter *convd TSRMLS_DC) -{ - if (convd == NULL) { - return -1; - } - - if (convd->filter1 != NULL) { - mbfl_convert_filter_flush(convd->filter1 TSRMLS_CC); - } - if (convd->filter2 != NULL) { - mbfl_convert_filter_flush(convd->filter2 TSRMLS_CC); - } - - return 0; -} - -mbfl_string * -mbfl_buffer_converter_getbuffer(mbfl_buffer_converter *convd, mbfl_string *result TSRMLS_DC) -{ - if (convd != NULL && result != NULL && convd->device.buffer != NULL) { - result->no_encoding = convd->to->no_encoding; - result->val = convd->device.buffer; - result->len = convd->device.pos; - } else { - result = NULL; - } - - return result; -} - -mbfl_string * -mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result TSRMLS_DC) -{ - if (convd == NULL || result == NULL) { - return NULL; - } - result->no_encoding = convd->to->no_encoding; - return mbfl_memory_device_result(&convd->device, result TSRMLS_CC); -} - -mbfl_string * -mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string, - mbfl_string *result TSRMLS_DC) -{ - if (convd == NULL || string == NULL || result == NULL) { - return NULL; - } - mbfl_buffer_converter_feed(convd, string TSRMLS_CC); - if (convd->filter1 != NULL) { - mbfl_convert_filter_flush(convd->filter1 TSRMLS_CC); - } - if (convd->filter2 != NULL) { - mbfl_convert_filter_flush(convd->filter2 TSRMLS_CC); - } - result->no_encoding = convd->to->no_encoding; - return mbfl_memory_device_result(&convd->device, result TSRMLS_CC); -} - - -/* - * encoding detector - */ -mbfl_encoding_detector * -mbfl_encoding_detector_new(enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC) -{ - mbfl_encoding_detector *identd; - - int i, num; - mbfl_identify_filter *filter; - - if (elist == NULL || eliztsz <= 0) { - return NULL; - } - - /* allocate */ - identd = (mbfl_encoding_detector*)mbfl_malloc(sizeof(mbfl_encoding_detector)); - if (identd == NULL) { - return NULL; - } - identd->filter_list = (mbfl_identify_filter **)mbfl_calloc(eliztsz, sizeof(mbfl_identify_filter *)); - if (identd->filter_list == NULL) { - mbfl_free(identd); - return NULL; - } - - /* create filters */ - i = 0; - num = 0; - while (i < eliztsz) { - filter = mbfl_identify_filter_new(elist[i] TSRMLS_CC); - if (filter != NULL) { - identd->filter_list[num] = filter; - num++; - } - i++; - } - identd->filter_list_size = num; - - return identd; -} - -void -mbfl_encoding_detector_delete(mbfl_encoding_detector *identd TSRMLS_DC) -{ - int i; - - if (identd != NULL) { - if (identd->filter_list != NULL) { - i = identd->filter_list_size; - while (i > 0) { - i--; - mbfl_identify_filter_delete(identd->filter_list[i] TSRMLS_CC); - } - mbfl_free((void *)identd->filter_list); - } - mbfl_free((void *)identd); - } -} - -int -mbfl_encoding_detector_feed(mbfl_encoding_detector *identd, mbfl_string *string TSRMLS_DC) -{ - int i, n, num, bad, res; - unsigned char *p; - mbfl_identify_filter *filter; - - res = 0; - /* feed data */ - if (identd != NULL && string != NULL && string->val != NULL) { - num = identd->filter_list_size; - n = string->len; - p = string->val; - while (n > 0) { - i = 0; - bad = 0; - while (i < num) { - filter = identd->filter_list[i]; - (*filter->filter_function)(*p, filter TSRMLS_CC); - if (filter->flag) { - bad++; - } - i++; - } - if ((num - 1) <= bad) { - res = 1; - break; - } - p++; - n--; - } - } - - return res; -} - -enum mbfl_no_encoding mbfl_encoding_detector_judge(mbfl_encoding_detector *identd TSRMLS_DC) -{ - mbfl_identify_filter *filter; - enum mbfl_no_encoding encoding; - int n; - - /* judge */ - encoding = mbfl_no_encoding_invalid; - if (identd != NULL) { - n = identd->filter_list_size - 1; - while (n >= 0) { - filter = identd->filter_list[n]; - if (!filter->flag) { - encoding = filter->encoding->no_encoding; - } - n--; - } - } - - return encoding; -} - - -/* - * encoding converter - */ -mbfl_string * -mbfl_convert_encoding( - mbfl_string *string, - mbfl_string *result, - enum mbfl_no_encoding toenc TSRMLS_DC) -{ - int n; - unsigned char *p; - const mbfl_encoding *encoding; - mbfl_memory_device device; - mbfl_convert_filter *filter1; - mbfl_convert_filter *filter2; - - /* initialize */ - encoding = mbfl_no2encoding(toenc); - if (encoding == NULL || string == NULL || result == NULL) { - return NULL; - } - - filter1 = NULL; - filter2 = NULL; - if (mbfl_convert_filter_get_vtbl(string->no_encoding, toenc) != NULL) { - filter1 = mbfl_convert_filter_new(string->no_encoding, toenc, mbfl_memory_device_output, 0, &device TSRMLS_CC); - } else { - filter2 = mbfl_convert_filter_new(mbfl_no_encoding_wchar, toenc, mbfl_memory_device_output, 0, &device TSRMLS_CC); - if (filter2 != NULL) { - filter1 = mbfl_convert_filter_new(string->no_encoding, mbfl_no_encoding_wchar, (int (*)(int, void* TSRMLS_DC))filter2->filter_function, NULL, filter2 TSRMLS_CC); - if (filter1 == NULL) { - mbfl_convert_filter_delete(filter2 TSRMLS_CC); - } - } - } - if (filter1 == NULL) { - return NULL; - } - if (filter2 != NULL) { - filter2->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; - filter2->illegal_substchar = 0x3f; /* '?' */ - } - mbfl_memory_device_init(&device, string->len, (string->len >> 2) + 8 TSRMLS_CC); - - /* feed data */ - n = string->len; - p = string->val; - if (p != NULL) { - while (n > 0) { - if ((*filter1->filter_function)(*p++, filter1 TSRMLS_CC) < 0) { - break; - } - n--; - } - } - - mbfl_convert_filter_flush(filter1 TSRMLS_CC); - mbfl_convert_filter_delete(filter1 TSRMLS_CC); - if (filter2 != NULL) { - mbfl_convert_filter_flush(filter2 TSRMLS_CC); - mbfl_convert_filter_delete(filter2 TSRMLS_CC); - } - - return mbfl_memory_device_result(&device, result TSRMLS_CC); -} - - -/* - * identify encoding - */ -const mbfl_encoding * -mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz, int strict TSRMLS_DC) -{ - int i, n, num, bad; - unsigned char *p; - const struct mbfl_identify_vtbl *vtbl; - mbfl_identify_filter *flist, *filter; - const mbfl_encoding *encoding; - - /* initialize */ - flist = (mbfl_identify_filter *)mbfl_calloc(eliztsz, sizeof(mbfl_identify_filter)); - if (flist == NULL) { - return NULL; - } - i = 0; - num = 0; - if (elist != NULL) { - while (i < eliztsz) { - vtbl = mbfl_identify_filter_get_vtbl(elist[i]); - if (vtbl != NULL) { - filter = &flist[num]; - mbfl_identify_filter_set_vtbl(filter, vtbl); - filter->encoding = mbfl_no2encoding(vtbl->encoding); - (*filter->filter_ctor)(filter TSRMLS_CC); - num++; - } - i++; - } - } - - /* feed data */ - n = string->len; - p = string->val; - if (p != NULL) { - while (n > 0) { - i = 0; - bad = 0; - while (i < num) { - filter = &flist[i]; - (*filter->filter_function)(*p, filter TSRMLS_CC); - if (filter->flag) { - bad++; - } - i++; - } - if ((num - 1) <= bad && !strict) { - break; - } - p++; - n--; - } - } - - /* judge */ - i = num - 1; - bad = 1; - encoding = NULL; - while (i >= 0) { - filter = &flist[i]; - if (filter->flag) { - bad++; - } else { - encoding = filter->encoding; - } - i--; - } -#if 0 - if (bad < num) { - encoding = NULL; - } -#endif - - i = 0; - while (i < num) { - filter = &flist[i]; - (*filter->filter_dtor)(filter TSRMLS_CC); - i++; - } - mbfl_free((void *)flist); - - return encoding; -} - -const char* -mbfl_identify_encoding_name(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz, int strict TSRMLS_DC) -{ - const mbfl_encoding *encoding; - - encoding = mbfl_identify_encoding(string, elist, eliztsz, strict TSRMLS_CC); - if (encoding != NULL && - encoding->no_encoding > mbfl_no_encoding_charset_min && - encoding->no_encoding < mbfl_no_encoding_charset_max) { - return encoding->name; - } else { - return NULL; - } -} - -const enum mbfl_no_encoding -mbfl_identify_encoding_no(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC) -{ - const mbfl_encoding *encoding; - - encoding = mbfl_identify_encoding(string, elist, eliztsz, 0 TSRMLS_CC); - if (encoding != NULL && - encoding->no_encoding > mbfl_no_encoding_charset_min && - encoding->no_encoding < mbfl_no_encoding_charset_max) { - return encoding->no_encoding; - } else { - return mbfl_no_encoding_invalid; - } -} - - -/* - * strlen - */ -static int -filter_count_output(int c, void *data TSRMLS_DC) -{ - (*(int *)data)++; - return c; -} - -int -mbfl_strlen(mbfl_string *string TSRMLS_DC) -{ - int len, n, m, k; - unsigned char *p; - const unsigned char *mbtab; - const mbfl_encoding *encoding; - - encoding = mbfl_no2encoding(string->no_encoding); - if (encoding == NULL || string == NULL) { - return -1; - } - - len = 0; - if (encoding->flag & MBFL_ENCTYPE_SBCS) { - len = string->len; - } else if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) { - len = string->len/2; - } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) { - len = string->len/4; - } else if (encoding->mblen_table != NULL) { - mbtab = encoding->mblen_table; - n = 0; - p = string->val; - k = string->len; - /* count */ - if (p != NULL) { - while (n < k) { - m = mbtab[*p]; - n += m; - p += m; - len++; - }; - } - } else { - /* wchar filter */ - mbfl_convert_filter *filter = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, - filter_count_output, 0, &len TSRMLS_CC); - if (filter == NULL) { - return -1; - } - /* count */ - n = string->len; - p = string->val; - if (p != NULL) { - while (n > 0) { - (*filter->filter_function)(*p++, filter TSRMLS_CC); - n--; - } - } - mbfl_convert_filter_delete(filter TSRMLS_CC); - } - - return len; -} - -#ifdef ZEND_MULTIBYTE -/* - * oddlen - */ -int -mbfl_oddlen(mbfl_string *string) -{ - int len, n, m, k; - unsigned char *p; - const unsigned char *mbtab; - const mbfl_encoding *encoding; - - encoding = mbfl_no2encoding(string->no_encoding); - if (encoding == NULL || string == NULL) { - return -1; - } - - len = 0; - if (encoding->flag & MBFL_ENCTYPE_SBCS) { - return 0; - } else if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) { - return len % 2; - } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) { - return len % 4; - } else if (encoding->mblen_table != NULL) { - mbtab = encoding->mblen_table; - n = 0; - p = string->val; - k = string->len; - /* count */ - if (p != NULL) { - while (n < k) { - m = mbtab[*p]; - n += m; - p += m; - }; - } - return n-k; - } else { - /* how can i do ? */ - return 0; - } - /* NOT REACHED */ -} -#endif /* ZEND_MULTIBYTE */ - - -/* - * strpos - */ -struct collector_strpos_data { - mbfl_convert_filter *next_filter; - mbfl_wchar_device needle; - int needle_len; - int start; - int output; - int found_pos; - int needle_pos; - int matched_pos; -}; - -static int -collector_strpos(int c, void* data TSRMLS_DC) -{ - int *p, *h, *m, n; - struct collector_strpos_data *pc = (struct collector_strpos_data*)data; - - if (pc->output >= pc->start) { - if (c == (int)pc->needle.buffer[pc->needle_pos]) { - if (pc->needle_pos == 0) { - pc->found_pos = pc->output; /* found position */ - } - pc->needle_pos++; /* needle pointer */ - if (pc->needle_pos >= pc->needle_len) { - pc->matched_pos = pc->found_pos; /* matched position */ - pc->needle_pos--; - goto retry; - } - } else if (pc->needle_pos != 0) { -retry: - h = (int *)pc->needle.buffer; - h++; - for (;;) { - pc->found_pos++; - p = h; - m = (int *)pc->needle.buffer; - n = pc->needle_pos - 1; - while (n > 0 && *p == *m) { - n--; - p++; - m++; - } - if (n <= 0) { - if (*m != c) { - pc->needle_pos = 0; - } - break; - } else { - h++; - pc->needle_pos--; - } - } - } - } - - pc->output++; - return c; -} - -int -mbfl_strpos( - mbfl_string *haystack, - mbfl_string *needle, - int offset, - int reverse TSRMLS_DC) -{ - int n, result; - unsigned char *p; - mbfl_convert_filter *filter; - struct collector_strpos_data pc; - - if (haystack == NULL || needle == NULL) { - return -8; - } - /* needle is converted into wchar */ - mbfl_wchar_device_init(&pc.needle TSRMLS_CC); - filter = mbfl_convert_filter_new( - needle->no_encoding, - mbfl_no_encoding_wchar, - mbfl_wchar_device_output, 0, &pc.needle TSRMLS_CC); - if (filter == NULL) { - return -4; - } - p = needle->val; - n = needle->len; - if (p != NULL) { - while (n > 0) { - if ((*filter->filter_function)(*p++, filter TSRMLS_CC) < 0) { - break; - } - n--; - } - } - mbfl_convert_filter_flush(filter TSRMLS_CC); - mbfl_convert_filter_delete(filter TSRMLS_CC); - pc.needle_len = pc.needle.pos; - if (pc.needle.buffer == NULL) { - return -4; - } - if (pc.needle_len <= 0) { - mbfl_wchar_device_clear(&pc.needle TSRMLS_CC); - return -2; - } - /* initialize filter and collector data */ - filter = mbfl_convert_filter_new( - haystack->no_encoding, - mbfl_no_encoding_wchar, - collector_strpos, 0, &pc TSRMLS_CC); - if (filter == NULL) { - mbfl_wchar_device_clear(&pc.needle TSRMLS_CC); - return -4; - } - pc.start = offset; - pc.output = 0; - pc.needle_pos = 0; - pc.found_pos = 0; - pc.matched_pos = -1; - - /* feed data */ - p = haystack->val; - n = haystack->len; - if (p != NULL) { - while (n > 0) { - if ((*filter->filter_function)(*p++, filter TSRMLS_CC) < 0) { - pc.matched_pos = -4; - break; - } - if (pc.matched_pos >= 0 && !reverse) { - break; - } - n--; - } - } - mbfl_convert_filter_flush(filter TSRMLS_CC); - result = pc.matched_pos; - mbfl_convert_filter_delete(filter TSRMLS_CC); - mbfl_wchar_device_clear(&pc.needle TSRMLS_CC); - - return result; -} - -/* - * substr_count - */ - -int -mbfl_substr_count( - mbfl_string *haystack, - mbfl_string *needle - TSRMLS_DC) -{ - int n, result = 0; - unsigned char *p; - mbfl_convert_filter *filter; - struct collector_strpos_data pc; - - if (haystack == NULL || needle == NULL) { - return -8; - } - /* needle is converted into wchar */ - mbfl_wchar_device_init(&pc.needle TSRMLS_CC); - filter = mbfl_convert_filter_new( - needle->no_encoding, - mbfl_no_encoding_wchar, - mbfl_wchar_device_output, 0, &pc.needle TSRMLS_CC); - if (filter == NULL) { - return -4; - } - p = needle->val; - n = needle->len; - if (p != NULL) { - while (n > 0) { - if ((*filter->filter_function)(*p++, filter TSRMLS_CC) < 0) { - break; - } - n--; - } - } - mbfl_convert_filter_flush(filter TSRMLS_CC); - mbfl_convert_filter_delete(filter TSRMLS_CC); - pc.needle_len = pc.needle.pos; - if (pc.needle.buffer == NULL) { - return -4; - } - if (pc.needle_len <= 0) { - mbfl_wchar_device_clear(&pc.needle TSRMLS_CC); - return -2; - } - /* initialize filter and collector data */ - filter = mbfl_convert_filter_new( - haystack->no_encoding, - mbfl_no_encoding_wchar, - collector_strpos, 0, &pc TSRMLS_CC); - if (filter == NULL) { - mbfl_wchar_device_clear(&pc.needle TSRMLS_CC); - return -4; - } - pc.start = 0; - pc.output = 0; - pc.needle_pos = 0; - pc.found_pos = 0; - pc.matched_pos = -1; - - /* feed data */ - p = haystack->val; - n = haystack->len; - if (p != NULL) { - while (n > 0) { - if ((*filter->filter_function)(*p++, filter TSRMLS_CC) < 0) { - pc.matched_pos = -4; - break; - } - if (pc.matched_pos >= 0) { - ++result; - pc.matched_pos = -1; - } - n--; - } - } - mbfl_convert_filter_flush(filter TSRMLS_CC); - mbfl_convert_filter_delete(filter TSRMLS_CC); - mbfl_wchar_device_clear(&pc.needle TSRMLS_CC); - - return result; -} - -/* - * substr - */ -struct collector_substr_data { - mbfl_convert_filter *next_filter; - int start; - int stop; - int output; -}; - -static int -collector_substr(int c, void* data TSRMLS_DC) -{ - struct collector_substr_data *pc = (struct collector_substr_data*)data; - - if (pc->output >= pc->stop) { - return -1; - } - - if (pc->output >= pc->start) { - (*pc->next_filter->filter_function)(c, pc->next_filter TSRMLS_CC); - } - - pc->output++; - - return c; -} - -mbfl_string * -mbfl_substr( - mbfl_string *string, - mbfl_string *result, - int from, - int length TSRMLS_DC) -{ - const mbfl_encoding *encoding; - int n, m, k, len, start, end; - unsigned char *p, *w; - const unsigned char *mbtab; - - encoding = mbfl_no2encoding(string->no_encoding); - if (encoding == NULL || string == NULL || result == NULL) { - return NULL; - } - mbfl_string_init(result); - result->no_language = string->no_language; - result->no_encoding = string->no_encoding; - - if ((encoding->flag & (MBFL_ENCTYPE_SBCS | MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE | MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) || - encoding->mblen_table != NULL) { - len = string->len; - start = from; - end = from + length; - if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_MWC2LE)) { - start *= 2; - end = start + length*2; - } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_MWC4LE)) { - start *= 4; - end = start + length*4; - } else if (encoding->mblen_table != NULL) { - mbtab = encoding->mblen_table; - start = 0; - end = 0; - n = 0; - k = 0; - p = string->val; - if (p != NULL) { - /* search start position */ - while (k <= from) { - start = n; - if (n >= len) { - break; - } - m = mbtab[*p]; - n += m; - p += m; - k++; - } - /* detect end position */ - k = 0; - end = start; - while (k < length) { - end = n; - if (n >= len) { - break; - } - m = mbtab[*p]; - n += m; - p += m; - k++; - } - } - } - - if (start > len) { - start = len; - } - if (start < 0) { - start = 0; - } - if (end > len) { - end = len; - } - if (end < 0) { - end = 0; - } - if (start > end) { - start = end; - } - - /* allocate memory and copy */ - n = end - start; - result->len = 0; - result->val = w = (unsigned char*)mbfl_malloc((n + 8)*sizeof(unsigned char)); - if (w != NULL) { - p = string->val; - if (p != NULL) { - p += start; - result->len = n; - while (n > 0) { - *w++ = *p++; - n--; - } - } - *w++ = '\0'; - *w++ = '\0'; - *w++ = '\0'; - *w = '\0'; - } else { - result = NULL; - } - } else { - mbfl_memory_device device; - struct collector_substr_data pc; - mbfl_convert_filter *decoder; - mbfl_convert_filter *encoder; - - mbfl_memory_device_init(&device, length + 1, 0 TSRMLS_CC); - mbfl_string_init(result); - result->no_language = string->no_language; - result->no_encoding = string->no_encoding; - /* output code filter */ - decoder = mbfl_convert_filter_new( - mbfl_no_encoding_wchar, - string->no_encoding, - mbfl_memory_device_output, 0, &device TSRMLS_CC); - /* wchar filter */ - encoder = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, - collector_substr, 0, &pc TSRMLS_CC); - if (decoder == NULL || encoder == NULL) { - mbfl_convert_filter_delete(encoder TSRMLS_CC); - mbfl_convert_filter_delete(decoder TSRMLS_CC); - return NULL; - } - pc.next_filter = decoder; - pc.start = from; - pc.stop = from + length; - pc.output = 0; - - /* feed data */ - p = string->val; - n = string->len; - if (p != NULL) { - while (n > 0) { - if ((*encoder->filter_function)(*p++, encoder TSRMLS_CC) < 0) { - break; - } - n--; - } - } - - mbfl_convert_filter_flush(encoder TSRMLS_CC); - mbfl_convert_filter_flush(decoder TSRMLS_CC); - result = mbfl_memory_device_result(&device, result TSRMLS_CC); - mbfl_convert_filter_delete(encoder TSRMLS_CC); - mbfl_convert_filter_delete(decoder TSRMLS_CC); - } - - return result; -} - - -/* - * strcut - */ -mbfl_string * -mbfl_strcut( - mbfl_string *string, - mbfl_string *result, - int from, - int length TSRMLS_DC) -{ - const mbfl_encoding *encoding; - int n, m, k, len, start, end; - unsigned char *p, *w; - const unsigned char *mbtab; - mbfl_memory_device device; - mbfl_convert_filter *encoder, *encoder_tmp, *decoder, *decoder_tmp; - - encoding = mbfl_no2encoding(string->no_encoding); - if (encoding == NULL || string == NULL || result == NULL) { - return NULL; - } - mbfl_string_init(result); - result->no_language = string->no_language; - result->no_encoding = string->no_encoding; - - if (from > (int)string->len) { - result->len = 0; - result->val = mbfl_malloc(1); - result->val[0] = '\0'; - return result; - } - - if ((encoding->flag & (MBFL_ENCTYPE_SBCS | MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE | MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) || - encoding->mblen_table != NULL) { - len = string->len; - start = from; - end = from + length; - if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) { - start /= 2; - start *= 2; - end = length/2; - end *= 2; - end += start; - } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) { - start /= 4; - start *= 4; - end = length/4; - end *= 4; - end += start; - } else if (encoding->mblen_table != NULL) { - mbtab = encoding->mblen_table; - start = 0; - end = 0; - n = 0; - p = string->val; - if (p != NULL) { - /* search start position */ - for (;;) { - m = mbtab[*p]; - n += m; - p += m; - if (n > from) { - break; - } - start = n; - } - /* search end position */ - k = start + length; - if (k >= (int)string->len) { - end = string->len; - } else { - end = start; - while (n <= k) { - end = n; - m = mbtab[*p]; - n += m; - p += m; - } - } - } - } - - if (start > len) { - start = len; - } - if (start < 0) { - start = 0; - } - if (end > len) { - end = len; - } - if (end < 0) { - end = 0; - } - if (start > end) { - start = end; - } - /* allocate memory and copy string */ - n = end - start; - result->len = 0; - result->val = w = (unsigned char*)mbfl_malloc((n + 8)*sizeof(unsigned char)); - if (w != NULL) { - result->len = n; - p = &(string->val[start]); - while (n > 0) { - *w++ = *p++; - n--; - } - *w++ = '\0'; - *w++ = '\0'; - *w++ = '\0'; - *w = '\0'; - } else { - result = NULL; - } - } else { - /* wchar filter */ - encoder = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, - mbfl_filter_output_null, 0, 0 TSRMLS_CC); - encoder_tmp = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, - mbfl_filter_output_null, 0, 0 TSRMLS_CC); - /* output code filter */ - decoder = mbfl_convert_filter_new( - mbfl_no_encoding_wchar, - string->no_encoding, - mbfl_memory_device_output, 0, &device TSRMLS_CC); - decoder_tmp = mbfl_convert_filter_new( - mbfl_no_encoding_wchar, - string->no_encoding, - mbfl_memory_device_output, 0, &device TSRMLS_CC); - if (encoder == NULL || encoder_tmp == NULL || decoder == NULL || decoder_tmp == NULL) { - mbfl_convert_filter_delete(encoder TSRMLS_CC); - mbfl_convert_filter_delete(encoder_tmp TSRMLS_CC); - mbfl_convert_filter_delete(decoder TSRMLS_CC); - mbfl_convert_filter_delete(decoder_tmp TSRMLS_CC); - return NULL; - } - mbfl_memory_device_init(&device, length + 8, 0 TSRMLS_CC); - k = 0; - n = 0; - p = string->val; - if (p != NULL) { - /* seartch start position */ - while (n < from) { - (*encoder->filter_function)(*p++, encoder TSRMLS_CC); - n++; - } - /* output a little shorter than "length" */ - encoder->output_function = mbfl_filter_output_pipe; - encoder->data = decoder; - k = length - 20; - len = string->len; - while (n < len && device.pos < k) { - (*encoder->filter_function)(*p++, encoder TSRMLS_CC); - n++; - } - /* detect end position */ - for (;;) { - /* backup current state */ - k = device.pos; - mbfl_convert_filter_copy(encoder, encoder_tmp TSRMLS_CC); - mbfl_convert_filter_copy(decoder, decoder_tmp TSRMLS_CC); - if (n >= len) { - break; - } - /* feed 1byte and flush */ - (*encoder->filter_function)(*p, encoder TSRMLS_CC); - (*encoder->filter_flush)(encoder TSRMLS_CC); - (*decoder->filter_flush)(decoder TSRMLS_CC); - if (device.pos > length) { - break; - } - /* restore filter and re-feed data */ - device.pos = k; - mbfl_convert_filter_copy(encoder_tmp, encoder TSRMLS_CC); - mbfl_convert_filter_copy(decoder_tmp, decoder TSRMLS_CC); - (*encoder->filter_function)(*p, encoder TSRMLS_CC); - p++; - n++; - } - device.pos = k; - mbfl_convert_filter_copy(encoder_tmp, encoder TSRMLS_CC); - mbfl_convert_filter_copy(decoder_tmp, decoder TSRMLS_CC); - mbfl_convert_filter_flush(encoder TSRMLS_CC); - mbfl_convert_filter_flush(decoder TSRMLS_CC); - } - result = mbfl_memory_device_result(&device, result TSRMLS_CC); - mbfl_convert_filter_delete(encoder TSRMLS_CC); - mbfl_convert_filter_delete(encoder_tmp TSRMLS_CC); - mbfl_convert_filter_delete(decoder TSRMLS_CC); - mbfl_convert_filter_delete(decoder_tmp TSRMLS_CC); - } - - return result; -} - - -/* - * strwidth - */ -static int -filter_count_width(int c, void* data TSRMLS_DC) -{ - if (c >= 0x20) { - if (c < 0x2000 || (c > 0xff60 && c < 0xffa0)) { - (*(int *)data)++; - } else { - (*(int *)data) += 2; - } - } - - return c; -} - -int -mbfl_strwidth(mbfl_string *string TSRMLS_DC) -{ - int len, n; - unsigned char *p; - mbfl_convert_filter *filter; - - len = 0; - if (string->len > 0 && string->val != NULL) { - /* wchar filter */ - filter = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, - filter_count_width, 0, &len TSRMLS_CC); - if (filter == NULL) { - mbfl_convert_filter_delete(filter TSRMLS_CC); - return -1; - } - - /* feed data */ - p = string->val; - n = string->len; - while (n > 0) { - (*filter->filter_function)(*p++, filter TSRMLS_CC); - n--; - } - - mbfl_convert_filter_flush(filter TSRMLS_CC); - mbfl_convert_filter_delete(filter TSRMLS_CC); - } - - return len; -} - - -/* - * strimwidth - */ -struct collector_strimwidth_data { - mbfl_convert_filter *decoder; - mbfl_convert_filter *decoder_backup; - mbfl_memory_device device; - int from; - int width; - int outwidth; - int outchar; - int status; - int endpos; -}; - -static int -collector_strimwidth(int c, void* data TSRMLS_DC) -{ - struct collector_strimwidth_data *pc = (struct collector_strimwidth_data*)data; - - switch (pc->status) { - case 10: - (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC); - break; - default: - if (pc->outchar >= pc->from) { - if (c >= 0x20) { - if (c < 0x2000 || (c > 0xff60 && c < 0xffa0)) { - pc->outwidth++; - } else { - pc->outwidth += 2; - } - } - if (pc->outwidth > pc->width) { - if (pc->status == 0) { - pc->endpos = pc->device.pos; - mbfl_convert_filter_copy(pc->decoder, pc->decoder_backup TSRMLS_CC); - } - pc->status++; - (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC); - c = -1; - } else { - (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC); - } - } - pc->outchar++; - break; - } - - return c; -} - -mbfl_string * -mbfl_strimwidth( - mbfl_string *string, - mbfl_string *marker, - mbfl_string *result, - int from, - int width TSRMLS_DC) -{ - struct collector_strimwidth_data pc; - mbfl_convert_filter *encoder; - int n, mkwidth; - unsigned char *p; - - if (string == NULL || result == NULL) { - return NULL; - } - mbfl_string_init(result); - result->no_language = string->no_language; - result->no_encoding = string->no_encoding; - mbfl_memory_device_init(&pc.device, width, 0 TSRMLS_CC); - - /* output code filter */ - pc.decoder = mbfl_convert_filter_new( - mbfl_no_encoding_wchar, - string->no_encoding, - mbfl_memory_device_output, 0, &pc.device TSRMLS_CC); - pc.decoder_backup = mbfl_convert_filter_new( - mbfl_no_encoding_wchar, - string->no_encoding, - mbfl_memory_device_output, 0, &pc.device TSRMLS_CC); - /* wchar filter */ - encoder = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, - collector_strimwidth, 0, &pc TSRMLS_CC); - if (pc.decoder == NULL || pc.decoder_backup == NULL || encoder == NULL) { - mbfl_convert_filter_delete(encoder TSRMLS_CC); - mbfl_convert_filter_delete(pc.decoder TSRMLS_CC); - mbfl_convert_filter_delete(pc.decoder_backup TSRMLS_CC); - return NULL; - } - mkwidth = 0; - if (marker) { - mkwidth = mbfl_strwidth(marker TSRMLS_CC); - } - pc.from = from; - pc.width = width - mkwidth; - pc.outwidth = 0; - pc.outchar = 0; - pc.status = 0; - pc.endpos = 0; - - /* feed data */ - p = string->val; - n = string->len; - if (p != NULL) { - while (n > 0) { - n--; - if ((*encoder->filter_function)(*p++, encoder TSRMLS_CC) < 0) { - break; - } - } - mbfl_convert_filter_flush(encoder TSRMLS_CC); - if (pc.status != 0 && mkwidth > 0) { - pc.width += mkwidth; - while (n > 0) { - if ((*encoder->filter_function)(*p++, encoder TSRMLS_CC) < 0) { - break; - } - n--; - } - mbfl_convert_filter_flush(encoder TSRMLS_CC); - if (pc.status != 1) { - pc.status = 10; - pc.device.pos = pc.endpos; - mbfl_convert_filter_copy(pc.decoder_backup, pc.decoder TSRMLS_CC); - mbfl_convert_filter_reset(encoder, marker->no_encoding, mbfl_no_encoding_wchar TSRMLS_CC); - p = marker->val; - n = marker->len; - while (n > 0) { - if ((*encoder->filter_function)(*p++, encoder TSRMLS_CC) < 0) { - break; - } - n--; - } - mbfl_convert_filter_flush(encoder TSRMLS_CC); - } - } else if (pc.status != 0) { - pc.device.pos = pc.endpos; - mbfl_convert_filter_copy(pc.decoder_backup, pc.decoder TSRMLS_CC); - } - mbfl_convert_filter_flush(pc.decoder TSRMLS_CC); - } - result = mbfl_memory_device_result(&pc.device, result TSRMLS_CC); - mbfl_convert_filter_delete(encoder TSRMLS_CC); - mbfl_convert_filter_delete(pc.decoder TSRMLS_CC); - mbfl_convert_filter_delete(pc.decoder_backup TSRMLS_CC); - - return result; -} - - - -/* - * convert Hankaku and Zenkaku - */ -struct collector_hantozen_data { - mbfl_convert_filter *next_filter; - int mode; - int status; - int cache; -}; - -static const unsigned char hankana2zenkata_table[64] = { - 0x00,0x02,0x0C,0x0D,0x01,0xFB,0xF2,0xA1,0xA3,0xA5, - 0xA7,0xA9,0xE3,0xE5,0xE7,0xC3,0xFC,0xA2,0xA4,0xA6, - 0xA8,0xAA,0xAB,0xAD,0xAF,0xB1,0xB3,0xB5,0xB7,0xB9, - 0xBB,0xBD,0xBF,0xC1,0xC4,0xC6,0xC8,0xCA,0xCB,0xCC, - 0xCD,0xCE,0xCF,0xD2,0xD5,0xD8,0xDB,0xDE,0xDF,0xE0, - 0xE1,0xE2,0xE4,0xE6,0xE8,0xE9,0xEA,0xEB,0xEC,0xED, - 0xEF,0xF3,0x9B,0x9C -}; -static const unsigned char hankana2zenhira_table[64] = { - 0x00,0x02,0x0C,0x0D,0x01,0xFB,0x92,0x41,0x43,0x45, - 0x47,0x49,0x83,0x85,0x87,0x63,0xFC,0x42,0x44,0x46, - 0x48,0x4A,0x4B,0x4D,0x4F,0x51,0x53,0x55,0x57,0x59, - 0x5B,0x5D,0x5F,0x61,0x64,0x66,0x68,0x6A,0x6B,0x6C, - 0x6D,0x6E,0x6F,0x72,0x75,0x78,0x7B,0x7E,0x7F,0x80, - 0x81,0x82,0x84,0x86,0x88,0x89,0x8A,0x8B,0x8C,0x8D, - 0x8F,0x93,0x9B,0x9C -}; -static const unsigned char zenkana2hankana_table[84][2] = { - {0x67,0x00},{0x71,0x00},{0x68,0x00},{0x72,0x00},{0x69,0x00}, - {0x73,0x00},{0x6A,0x00},{0x74,0x00},{0x6B,0x00},{0x75,0x00}, - {0x76,0x00},{0x76,0x9E},{0x77,0x00},{0x77,0x9E},{0x78,0x00}, - {0x78,0x9E},{0x79,0x00},{0x79,0x9E},{0x7A,0x00},{0x7A,0x9E}, - {0x7B,0x00},{0x7B,0x9E},{0x7C,0x00},{0x7C,0x9E},{0x7D,0x00}, - {0x7D,0x9E},{0x7E,0x00},{0x7E,0x9E},{0x7F,0x00},{0x7F,0x9E}, - {0x80,0x00},{0x80,0x9E},{0x81,0x00},{0x81,0x9E},{0x6F,0x00}, - {0x82,0x00},{0x82,0x9E},{0x83,0x00},{0x83,0x9E},{0x84,0x00}, - {0x84,0x9E},{0x85,0x00},{0x86,0x00},{0x87,0x00},{0x88,0x00}, - {0x89,0x00},{0x8A,0x00},{0x8A,0x9E},{0x8A,0x9F},{0x8B,0x00}, - {0x8B,0x9E},{0x8B,0x9F},{0x8C,0x00},{0x8C,0x9E},{0x8C,0x9F}, - {0x8D,0x00},{0x8D,0x9E},{0x8D,0x9F},{0x8E,0x00},{0x8E,0x9E}, - {0x8E,0x9F},{0x8F,0x00},{0x90,0x00},{0x91,0x00},{0x92,0x00}, - {0x93,0x00},{0x6C,0x00},{0x94,0x00},{0x6D,0x00},{0x95,0x00}, - {0x6E,0x00},{0x96,0x00},{0x97,0x00},{0x98,0x00},{0x99,0x00}, - {0x9A,0x00},{0x9B,0x00},{0x9C,0x00},{0x9C,0x00},{0x72,0x00}, - {0x74,0x00},{0x66,0x00},{0x9D,0x00},{0x73,0x9E} -}; - -static int -collector_hantozen(int c, void* data TSRMLS_DC) -{ - int s, mode, n; - struct collector_hantozen_data *pc = (struct collector_hantozen_data*)data; - - s = c; - mode = pc->mode; - - if (mode & 0xf) { /* hankaku to zenkaku */ - if ((mode & 0x1) && c >= 0x21 && c <= 0x7d && c != 0x22 && c != 0x27 && c != 0x5c) { /* all except <"> <'> <\> <~> */ - s = c + 0xfee0; - } else if ((mode & 0x2) && ((c >= 0x41 && c <= 0x5a) || (c >= 0x61 && c <= 0x7a))) { /* alpha */ - s = c + 0xfee0; - } else if ((mode & 0x4) && c >= 0x30 && c <= 0x39) { /* num */ - s = c + 0xfee0; - } else if ((mode & 0x8) && c == 0x20) { /* spase */ - s = 0x3000; - } - } - - if (mode & 0xf0) { /* zenkaku to hankaku */ - if ((mode & 0x10) && c >= 0xff01 && c <= 0xff5d && c != 0xff02 && c != 0xff07 && c!= 0xff3c) { /* all except <"> <'> <\> <~> */ - s = c - 0xfee0; - } else if ((mode & 0x20) && ((c >= 0xff21 && c <= 0xff3a) || (c >= 0xff41 && c <= 0xff5a))) { /* alpha */ - s = c - 0xfee0; - } else if ((mode & 0x40) && (c >= 0xff10 && c <= 0xff19)) { /* num */ - s = c - 0xfee0; - } else if ((mode & 0x80) && (c == 0x3000)) { /* spase */ - s = 0x20; - } else if ((mode & 0x10) && (c == 0x2212)) { /* MINUS SIGN */ - s = 0x2d; - } - } - - if (mode & 0x300) { /* hankaku kana to zenkaku kana */ - if ((mode & 0x100) && (mode & 0x800)) { /* hankaku kana to zenkaku katakana and glue voiced sound mark */ - if (c >= 0xff61 && c <= 0xff9f) { - if (pc->status) { - n = (pc->cache - 0xff60) & 0x3f; - if (c == 0xff9e && ((n >= 22 && n <= 36) || (n >= 42 && n <= 46))) { - pc->status = 0; - s = 0x3001 + hankana2zenkata_table[n]; - } else if (c == 0xff9e && n == 19) { - pc->status = 0; - s = 0x30f4; - } else if (c == 0xff9f && (n >= 42 && n <= 46)) { - pc->status = 0; - s = 0x3002 + hankana2zenkata_table[n]; - } else { - pc->status = 1; - pc->cache = c; - s = 0x3000 + hankana2zenkata_table[n]; - } - } else { - pc->status = 1; - pc->cache = c; - return c; - } - } else { - if (pc->status) { - n = (pc->cache - 0xff60) & 0x3f; - pc->status = 0; - (*pc->next_filter->filter_function)(0x3000 + hankana2zenkata_table[n], pc->next_filter TSRMLS_CC); - } - } - } else if ((mode & 0x200) && (mode & 0x800)) { /* hankaku kana to zenkaku hirangana and glue voiced sound mark */ - if (c >= 0xff61 && c <= 0xff9f) { - if (pc->status) { - n = (pc->cache - 0xff60) & 0x3f; - if (c == 0xff9e && ((n >= 22 && n <= 36) || (n >= 42 && n <= 46))) { - pc->status = 0; - s = 0x3001 + hankana2zenhira_table[n]; - } else if (c == 0xff9f && (n >= 42 && n <= 46)) { - pc->status = 0; - s = 0x3002 + hankana2zenhira_table[n]; - } else { - pc->status = 1; - pc->cache = c; - s = 0x3000 + hankana2zenhira_table[n]; - } - } else { - pc->status = 1; - pc->cache = c; - return c; - } - } else { - if (pc->status) { - n = (pc->cache - 0xff60) & 0x3f; - pc->status = 0; - (*pc->next_filter->filter_function)(0x3000 + hankana2zenhira_table[n], pc->next_filter TSRMLS_CC); - } - } - } else if ((mode & 0x100) && c >= 0xff61 && c <= 0xff9f) { /* hankaku kana to zenkaku katakana */ - s = 0x3000 + hankana2zenkata_table[c - 0xff60]; - } else if ((mode & 0x200) && c >= 0xff61 && c <= 0xff9f) { /* hankaku kana to zenkaku hirangana */ - s = 0x3000 + hankana2zenhira_table[c - 0xff60]; - } - } - - if (mode & 0x3000) { /* Zenkaku kana to hankaku kana */ - if ((mode & 0x1000) && c >= 0x30a1 && c <= 0x30f4) { /* Zenkaku katakana to hankaku kana */ - n = c - 0x30a1; - if (zenkana2hankana_table[n][1] != 0) { - (*pc->next_filter->filter_function)(0xff00 + zenkana2hankana_table[n][0], pc->next_filter TSRMLS_CC); - s = 0xff00 + zenkana2hankana_table[n][1]; - } else { - s = 0xff00 + zenkana2hankana_table[n][0]; - } - } else if ((mode & 0x2000) && c >= 0x3041 && c <= 0x3093) { /* Zenkaku hirangana to hankaku kana */ - n = c - 0x3041; - if (zenkana2hankana_table[n][1] != 0) { - (*pc->next_filter->filter_function)(0xff00 + zenkana2hankana_table[n][0], pc->next_filter TSRMLS_CC); - s = 0xff00 + zenkana2hankana_table[n][1]; - } else { - s = 0xff00 + zenkana2hankana_table[n][0]; - } - } else if (c == 0x3001) { - s = 0xff64; /* HALFWIDTH IDEOGRAPHIC COMMA */ - } else if (c == 0x3002) { - s = 0xff61; /* HALFWIDTH IDEOGRAPHIC FULL STOP */ - } else if (c == 0x300c) { - s = 0xff62; /* HALFWIDTH LEFT CORNER BRACKET */ - } else if (c == 0x300d) { - s = 0xff63; /* HALFWIDTH RIGHT CORNER BRACKET */ - } else if (c == 0x309b) { - s = 0xff9e; /* HALFWIDTH KATAKANA VOICED SOUND MARK */ - } else if (c == 0x309c) { - s = 0xff9f; /* HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK */ - } else if (c == 0x30fc) { - s = 0xff70; /* HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK */ - } else if (c == 0x30fb) { - s = 0xff65; /* HALFWIDTH KATAKANA MIDDLE DOT */ - } - } else if (mode & 0x30000) { - if ((mode & 0x10000) && c >= 0x3041 && c <= 0x3093) { /* Zenkaku hirangana to Zenkaku katakana */ - s = c + 0x60; - } else if ((mode & 0x20000) && c >= 0x30a1 && c <= 0x30f3) { /* Zenkaku katakana to Zenkaku hirangana */ - s = c - 0x60; - } - } - - if (mode & 0x100000) { /* special ascii to symbol */ - if (c == 0x5c) { - s = 0xffe5; /* FULLWIDTH YEN SIGN */ - } else if (c == 0xa5) { /* YEN SIGN */ - s = 0xffe5; /* FULLWIDTH YEN SIGN */ - } else if (c == 0x7e) { - s = 0xffe3; /* FULLWIDTH MACRON */ - } else if (c == 0x203e) { /* OVERLINE */ - s = 0xffe3; /* FULLWIDTH MACRON */ - } else if (c == 0x27) { - s = 0x2019; /* RIGHT SINGLE QUOTATION MARK */ - } else if (c == 0x22) { - s = 0x201d; /* RIGHT DOUBLE QUOTATION MARK */ - } - } else if (mode & 0x200000) { /* special symbol to ascii */ - if (c == 0xffe5) { /* FULLWIDTH YEN SIGN */ - s = 0x5c; - } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */ - s = 0x5c; - } else if (c == 0xffe3) { /* FULLWIDTH MACRON */ - s = 0x7e; - } else if (c == 0x203e) { /* OVERLINE */ - s = 0x7e; - } else if (c == 0x2018) { /* LEFT SINGLE QUOTATION MARK*/ - s = 0x27; - } else if (c == 0x2019) { /* RIGHT SINGLE QUOTATION MARK */ - s = 0x27; - } else if (c == 0x201c) { /* LEFT DOUBLE QUOTATION MARK */ - s = 0x22; - } else if (c == 0x201d) { /* RIGHT DOUBLE QUOTATION MARK */ - s = 0x22; - } - } - - if (mode & 0x400000) { /* special ascii to symbol */ - if (c == 0x5c) { - s = 0xff3c; /* FULLWIDTH REVERSE SOLIDUS */ - } else if (c == 0x7e) { - s = 0xff5e; /* FULLWIDTH TILDE */ - } else if (c == 0x27) { - s = 0xff07; /* FULLWIDTH APOSTROPHE */ - } else if (c == 0x22) { - s = 0xff02; /* FULLWIDTH QUOTATION MARK */ - } - } else if (mode & 0x800000) { /* special symbol to ascii */ - if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */ - s = 0x5c; - } else if (c == 0xff5e) { /* FULLWIDTH TILDE */ - s = 0x7e; - } else if (c == 0xff07) { /* FULLWIDTH APOSTROPHE */ - s = 0x27; - } else if (c == 0xff02) { /* FULLWIDTH QUOTATION MARK */ - s = 0x22; - } - } - - return (*pc->next_filter->filter_function)(s, pc->next_filter TSRMLS_CC); -} - -static int -collector_hantozen_flush(struct collector_hantozen_data *pc TSRMLS_DC) -{ - int ret, n; - - ret = 0; - if (pc->status) { - n = (pc->cache - 0xff60) & 0x3f; - if (pc->mode & 0x100) { /* hankaku kana to zenkaku katakana */ - ret = (*pc->next_filter->filter_function)(0x3000 + hankana2zenkata_table[n], pc->next_filter TSRMLS_CC); - } else if (pc->mode & 0x200) { /* hankaku kana to zenkaku hirangana */ - ret = (*pc->next_filter->filter_function)(0x3000 + hankana2zenhira_table[n], pc->next_filter TSRMLS_CC); - } - pc->status = 0; - } - - return ret; -} - -mbfl_string * -mbfl_ja_jp_hantozen( - mbfl_string *string, - mbfl_string *result, - int mode TSRMLS_DC) -{ - int n; - unsigned char *p; - const mbfl_encoding *encoding; - mbfl_memory_device device; - struct collector_hantozen_data pc; - mbfl_convert_filter *decoder; - mbfl_convert_filter *encoder; - - /* initialize */ - if (string == NULL || result == NULL) { - return NULL; - } - encoding = mbfl_no2encoding(string->no_encoding); - if (encoding == NULL) { - return NULL; - } - mbfl_memory_device_init(&device, string->len, 0 TSRMLS_CC); - mbfl_string_init(result); - result->no_language = string->no_language; - result->no_encoding = string->no_encoding; - decoder = mbfl_convert_filter_new( - mbfl_no_encoding_wchar, - string->no_encoding, - mbfl_memory_device_output, 0, &device TSRMLS_CC); - encoder = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, - collector_hantozen, 0, &pc TSRMLS_CC); - if (decoder == NULL || encoder == NULL) { - mbfl_convert_filter_delete(encoder TSRMLS_CC); - mbfl_convert_filter_delete(decoder TSRMLS_CC); - return NULL; - } - pc.next_filter = decoder; - pc.mode = mode; - pc.status = 0; - pc.cache = 0; - - /* feed data */ - p = string->val; - n = string->len; - if (p != NULL) { - while (n > 0) { - if ((*encoder->filter_function)(*p++, encoder TSRMLS_CC) < 0) { - break; - } - n--; - } - } - - mbfl_convert_filter_flush(encoder TSRMLS_CC); - collector_hantozen_flush(&pc TSRMLS_CC); - mbfl_convert_filter_flush(decoder TSRMLS_CC); - result = mbfl_memory_device_result(&device, result TSRMLS_CC); - mbfl_convert_filter_delete(encoder TSRMLS_CC); - mbfl_convert_filter_delete(decoder TSRMLS_CC); - - return result; -} - - -/* - * MIME header encode - */ -struct mime_header_encoder_data { - mbfl_convert_filter *conv1_filter; - mbfl_convert_filter *block_filter; - mbfl_convert_filter *conv2_filter; - mbfl_convert_filter *conv2_filter_backup; - mbfl_convert_filter *encod_filter; - mbfl_convert_filter *encod_filter_backup; - mbfl_memory_device outdev; - mbfl_memory_device tmpdev; - int status1; - int status2; - int prevpos; - int linehead; - int firstindent; - int encnamelen; - int lwsplen; - char encname[128]; - char lwsp[16]; -}; - -static int -mime_header_encoder_block_collector(int c, void *data TSRMLS_DC) -{ - int n; - struct mime_header_encoder_data *pe = (struct mime_header_encoder_data *)data; - - switch (pe->status2) { - case 1: /* encoded word */ - pe->prevpos = pe->outdev.pos; - mbfl_convert_filter_copy(pe->conv2_filter, pe->conv2_filter_backup TSRMLS_CC); - mbfl_convert_filter_copy(pe->encod_filter, pe->encod_filter_backup TSRMLS_CC); - (*pe->conv2_filter->filter_function)(c, pe->conv2_filter TSRMLS_CC); - (*pe->conv2_filter->filter_flush)(pe->conv2_filter TSRMLS_CC); - (*pe->encod_filter->filter_flush)(pe->encod_filter TSRMLS_CC); - n = pe->outdev.pos - pe->linehead + pe->firstindent; - pe->outdev.pos = pe->prevpos; - mbfl_convert_filter_copy(pe->conv2_filter_backup, pe->conv2_filter TSRMLS_CC); - mbfl_convert_filter_copy(pe->encod_filter_backup, pe->encod_filter TSRMLS_CC); - if (n >= 74) { - (*pe->conv2_filter->filter_flush)(pe->conv2_filter TSRMLS_CC); - (*pe->encod_filter->filter_flush)(pe->encod_filter TSRMLS_CC); - mbfl_memory_device_strncat(&pe->outdev, "\x3f\x3d", 2 TSRMLS_CC); /* ?= */ - mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen TSRMLS_CC); - pe->linehead = pe->outdev.pos; - pe->firstindent = 0; - mbfl_memory_device_strncat(&pe->outdev, pe->encname, pe->encnamelen TSRMLS_CC); - c = (*pe->conv2_filter->filter_function)(c, pe->conv2_filter TSRMLS_CC); - } else { - c = (*pe->conv2_filter->filter_function)(c, pe->conv2_filter TSRMLS_CC); - } - break; - - default: - mbfl_memory_device_strncat(&pe->outdev, pe->encname, pe->encnamelen TSRMLS_CC); - c = (*pe->conv2_filter->filter_function)(c, pe->conv2_filter TSRMLS_CC); - pe->status2 = 1; - break; - } - - return c; -} - -static int -mime_header_encoder_collector(int c, void *data TSRMLS_DC) -{ - int n; - struct mime_header_encoder_data *pe = (struct mime_header_encoder_data *)data; - - switch (pe->status1) { - case 11: /* encoded word */ - (*pe->block_filter->filter_function)(c, pe->block_filter TSRMLS_CC); - break; - - default: /* ASCII */ - if (c >= 0x21 && c < 0x7f) { /* ASCII exclude SPACE and CTLs */ - mbfl_memory_device_output(c, &pe->tmpdev TSRMLS_CC); - pe->status1 = 1; - } else if (pe->status1 == 0 && c == 0x20) { /* repeat SPACE */ - mbfl_memory_device_output(c, &pe->tmpdev TSRMLS_CC); - } else { - if (pe->tmpdev.pos < 74 && c == 0x20) { - n = pe->outdev.pos - pe->linehead + pe->tmpdev.pos + pe->firstindent; - if (n > 74) { - mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen TSRMLS_CC); /* LWSP */ - pe->linehead = pe->outdev.pos; - pe->firstindent = 0; - } else if (pe->outdev.pos > 0) { - mbfl_memory_device_output(0x20, &pe->outdev TSRMLS_CC); - } - mbfl_memory_device_devcat(&pe->outdev, &pe->tmpdev TSRMLS_CC); - mbfl_memory_device_reset(&pe->tmpdev TSRMLS_CC); - pe->status1 = 0; - } else { - n = pe->outdev.pos - pe->linehead + pe->encnamelen + pe->firstindent; - if (n > 60) { - mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen TSRMLS_CC); /* LWSP */ - pe->linehead = pe->outdev.pos; - pe->firstindent = 0; - } else if (pe->outdev.pos > 0) { - mbfl_memory_device_output(0x20, &pe->outdev TSRMLS_CC); - } - mbfl_convert_filter_devcat(pe->block_filter, &pe->tmpdev TSRMLS_CC); - mbfl_memory_device_reset(&pe->tmpdev TSRMLS_CC); - (*pe->block_filter->filter_function)(c, pe->block_filter TSRMLS_CC); - pe->status1 = 11; - } - } - break; - } - - return c; -} - -mbfl_string * -mime_header_encoder_result(struct mime_header_encoder_data *pe, mbfl_string *result TSRMLS_DC) -{ - if (pe->status1 >= 10) { - (*pe->conv2_filter->filter_flush)(pe->conv2_filter TSRMLS_CC); - (*pe->encod_filter->filter_flush)(pe->encod_filter TSRMLS_CC); - mbfl_memory_device_strncat(&pe->outdev, "\x3f\x3d", 2 TSRMLS_CC); /* ?= */ - } else if (pe->tmpdev.pos > 0) { - if (pe->outdev.pos > 0) { - if ((pe->outdev.pos - pe->linehead + pe->tmpdev.pos) > 74) { - mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen TSRMLS_CC); - } else { - mbfl_memory_device_output(0x20, &pe->outdev TSRMLS_CC); - } - } - mbfl_memory_device_devcat(&pe->outdev, &pe->tmpdev TSRMLS_CC); - } - mbfl_memory_device_reset(&pe->tmpdev TSRMLS_CC); - pe->prevpos = 0; - pe->linehead = 0; - pe->status1 = 0; - pe->status2 = 0; - - return mbfl_memory_device_result(&pe->outdev, result TSRMLS_CC); -} - -struct mime_header_encoder_data* -mime_header_encoder_new( - enum mbfl_no_encoding incode, - enum mbfl_no_encoding outcode, - enum mbfl_no_encoding transenc TSRMLS_DC) -{ - int n; - const char *s; - const mbfl_encoding *outencoding; - struct mime_header_encoder_data *pe; - - /* get output encoding and check MIME charset name */ - outencoding = mbfl_no2encoding(outcode); - if (outencoding == NULL || outencoding->mime_name == NULL || outencoding->mime_name[0] == '\0') { - return NULL; - } - - pe = (struct mime_header_encoder_data*)mbfl_malloc(sizeof(struct mime_header_encoder_data)); - if (pe == NULL) { - return NULL; - } - - mbfl_memory_device_init(&pe->outdev, 0, 0 TSRMLS_CC); - mbfl_memory_device_init(&pe->tmpdev, 0, 0 TSRMLS_CC); - pe->prevpos = 0; - pe->linehead = 0; - pe->firstindent = 0; - pe->status1 = 0; - pe->status2 = 0; - - /* make the encoding description string exp. "=?ISO-2022-JP?B?" */ - n = 0; - pe->encname[n++] = 0x3d; - pe->encname[n++] = 0x3f; - s = outencoding->mime_name; - while (*s) { - pe->encname[n++] = *s++; - } - pe->encname[n++] = 0x3f; - if (transenc == mbfl_no_encoding_qprint) { - pe->encname[n++] = 0x51; - } else { - pe->encname[n++] = 0x42; - transenc = mbfl_no_encoding_base64; - } - pe->encname[n++] = 0x3f; - pe->encname[n] = '\0'; - pe->encnamelen = n; - - n = 0; - pe->lwsp[n++] = 0x0d; - pe->lwsp[n++] = 0x0a; - pe->lwsp[n++] = 0x20; - pe->lwsp[n] = '\0'; - pe->lwsplen = n; - - /* transfer encode filter */ - pe->encod_filter = mbfl_convert_filter_new(outcode, transenc, mbfl_memory_device_output, 0, &(pe->outdev) TSRMLS_CC); - pe->encod_filter_backup = mbfl_convert_filter_new(outcode, transenc, mbfl_memory_device_output, 0, &(pe->outdev) TSRMLS_CC); - - /* Output code filter */ - pe->conv2_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, outcode, mbfl_filter_output_pipe, 0, pe->encod_filter TSRMLS_CC); - pe->conv2_filter_backup = mbfl_convert_filter_new(mbfl_no_encoding_wchar, outcode, mbfl_filter_output_pipe, 0, pe->encod_filter TSRMLS_CC); - - /* encoded block filter */ - pe->block_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, mbfl_no_encoding_wchar, mime_header_encoder_block_collector, 0, pe TSRMLS_CC); - - /* Input code filter */ - pe->conv1_filter = mbfl_convert_filter_new(incode, mbfl_no_encoding_wchar, mime_header_encoder_collector, 0, pe TSRMLS_CC); - - if (pe->encod_filter == NULL || - pe->encod_filter_backup == NULL || - pe->conv2_filter == NULL || - pe->conv2_filter_backup == NULL || - pe->conv1_filter == NULL) { - mime_header_encoder_delete(pe TSRMLS_CC); - return NULL; - } - - if (transenc == mbfl_no_encoding_qprint) { - pe->encod_filter->status |= MBFL_QPRINT_STS_MIME_HEADER; - pe->encod_filter_backup->status |= MBFL_QPRINT_STS_MIME_HEADER; - } else { - pe->encod_filter->status |= MBFL_BASE64_STS_MIME_HEADER; - pe->encod_filter_backup->status |= MBFL_BASE64_STS_MIME_HEADER; - } - - return pe; -} - -void -mime_header_encoder_delete(struct mime_header_encoder_data *pe TSRMLS_DC) -{ - if (pe) { - mbfl_convert_filter_delete(pe->conv1_filter TSRMLS_CC); - mbfl_convert_filter_delete(pe->block_filter TSRMLS_CC); - mbfl_convert_filter_delete(pe->conv2_filter TSRMLS_CC); - mbfl_convert_filter_delete(pe->conv2_filter_backup TSRMLS_CC); - mbfl_convert_filter_delete(pe->encod_filter TSRMLS_CC); - mbfl_convert_filter_delete(pe->encod_filter_backup TSRMLS_CC); - mbfl_memory_device_clear(&pe->outdev TSRMLS_CC); - mbfl_memory_device_clear(&pe->tmpdev TSRMLS_CC); - mbfl_free((void*)pe); - } -} - -int -mime_header_encoder_feed(int c, struct mime_header_encoder_data *pe TSRMLS_DC) -{ - return (*pe->conv1_filter->filter_function)(c, pe->conv1_filter TSRMLS_CC); -} - -mbfl_string * -mbfl_mime_header_encode( - mbfl_string *string, - mbfl_string *result, - enum mbfl_no_encoding outcode, - enum mbfl_no_encoding encoding, - const char *linefeed, - int indent TSRMLS_DC) -{ - int n; - unsigned char *p; - struct mime_header_encoder_data *pe; - - mbfl_string_init(result); - result->no_language = string->no_language; - result->no_encoding = mbfl_no_encoding_ascii; - - pe = mime_header_encoder_new(string->no_encoding, outcode, encoding TSRMLS_CC); - if (pe == NULL) { - return NULL; - } - - if (linefeed != NULL) { - n = 0; - while (*linefeed && n < 8) { - pe->lwsp[n++] = *linefeed++; - } - pe->lwsp[n++] = 0x20; - pe->lwsp[n] = '\0'; - pe->lwsplen = n; - } - if (indent > 0 && indent < 74) { - pe->firstindent = indent; - } - - n = string->len; - p = string->val; - while (n > 0) { - (*pe->conv1_filter->filter_function)(*p++, pe->conv1_filter TSRMLS_CC); - n--; - } - - result = mime_header_encoder_result(pe, result TSRMLS_CC); - mime_header_encoder_delete(pe TSRMLS_CC); - - return result; -} - - -/* - * MIME header decode - */ -struct mime_header_decoder_data { - mbfl_convert_filter *deco_filter; - mbfl_convert_filter *conv1_filter; - mbfl_convert_filter *conv2_filter; - mbfl_memory_device outdev; - mbfl_memory_device tmpdev; - int cspos; - int status; - enum mbfl_no_encoding encoding; - enum mbfl_no_encoding incode; - enum mbfl_no_encoding outcode; -}; - -static int -mime_header_decoder_collector(int c, void* data TSRMLS_DC) -{ - const mbfl_encoding *encoding; - struct mime_header_decoder_data *pd = (struct mime_header_decoder_data*)data; - - switch (pd->status) { - case 1: - if (c == 0x3f) { /* ? */ - mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC); - pd->cspos = pd->tmpdev.pos; - pd->status = 2; - } else { - mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev TSRMLS_CC); - mbfl_memory_device_reset(&pd->tmpdev TSRMLS_CC); - if (c == 0x3d) { /* = */ - mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC); - } else if (c == 0x0d || c == 0x0a) { /* CR or LF */ - pd->status = 9; - } else { - (*pd->conv1_filter->filter_function)(c, pd->conv1_filter TSRMLS_CC); - pd->status = 0; - } - } - break; - case 2: /* store charset string */ - if (c == 0x3f) { /* ? */ - /* identify charset */ - mbfl_memory_device_output('\0', &pd->tmpdev TSRMLS_CC); - encoding = mbfl_name2encoding((const char *)&pd->tmpdev.buffer[pd->cspos]); - if (encoding != NULL) { - pd->incode = encoding->no_encoding; - pd->status = 3; - } - mbfl_memory_device_unput(&pd->tmpdev TSRMLS_CC); - mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC); - } else { - mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC); - if (pd->tmpdev.pos > 100) { /* too long charset string */ - pd->status = 0; - } else if (c == 0x0d || c == 0x0a) { /* CR or LF */ - mbfl_memory_device_unput(&pd->tmpdev TSRMLS_CC); - pd->status = 9; - } - if (pd->status != 2) { - mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev TSRMLS_CC); - mbfl_memory_device_reset(&pd->tmpdev TSRMLS_CC); - } - } - break; - case 3: /* identify encoding */ - mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC); - if (c == 0x42 || c == 0x62) { /* 'B' or 'b' */ - pd->encoding = mbfl_no_encoding_base64; - pd->status = 4; - } else if (c == 0x51 || c == 0x71) { /* 'Q' or 'q' */ - pd->encoding = mbfl_no_encoding_qprint; - pd->status = 4; - } else { - if (c == 0x0d || c == 0x0a) { /* CR or LF */ - mbfl_memory_device_unput(&pd->tmpdev TSRMLS_CC); - pd->status = 9; - } else { - pd->status = 0; - } - mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev TSRMLS_CC); - mbfl_memory_device_reset(&pd->tmpdev TSRMLS_CC); - } - break; - case 4: /* reset filter */ - mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC); - if (c == 0x3f) { /* ? */ - /* charset convert filter */ - mbfl_convert_filter_reset(pd->conv1_filter, pd->incode, mbfl_no_encoding_wchar TSRMLS_CC); - /* decode filter */ - mbfl_convert_filter_reset(pd->deco_filter, pd->encoding, mbfl_no_encoding_8bit TSRMLS_CC); - pd->status = 5; - } else { - if (c == 0x0d || c == 0x0a) { /* CR or LF */ - mbfl_memory_device_unput(&pd->tmpdev TSRMLS_CC); - pd->status = 9; - } else { - pd->status = 0; - } - mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev TSRMLS_CC); - } - mbfl_memory_device_reset(&pd->tmpdev TSRMLS_CC); - break; - case 5: /* encoded block */ - if (c == 0x3f) { /* ? */ - pd->status = 6; - } else { - (*pd->deco_filter->filter_function)(c, pd->deco_filter TSRMLS_CC); - } - break; - case 6: /* check end position */ - if (c == 0x3d) { /* = */ - /* flush and reset filter */ - (*pd->deco_filter->filter_flush)(pd->deco_filter TSRMLS_CC); - (*pd->conv1_filter->filter_flush)(pd->conv1_filter TSRMLS_CC); - mbfl_convert_filter_reset(pd->conv1_filter, mbfl_no_encoding_ascii, mbfl_no_encoding_wchar TSRMLS_CC); - pd->status = 7; - } else { - (*pd->deco_filter->filter_function)(0x3f, pd->deco_filter TSRMLS_CC); - if (c != 0x3f) { /* ? */ - (*pd->deco_filter->filter_function)(c, pd->deco_filter TSRMLS_CC); - pd->status = 5; - } - } - break; - case 7: /* after encoded block */ - if (c == 0x0d || c == 0x0a) { /* CR LF */ - pd->status = 8; - } else { - mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC); - if (c == 0x3d) { /* = */ - pd->status = 1; - } else if (c != 0x20 && c != 0x09) { /* not space */ - mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev TSRMLS_CC); - mbfl_memory_device_reset(&pd->tmpdev TSRMLS_CC); - pd->status = 0; - } - } - break; - case 8: /* folding */ - case 9: /* folding */ - if (c != 0x0d && c != 0x0a && c != 0x20 && c != 0x09) { - if (c == 0x3d) { /* = */ - if (pd->status == 8) { - mbfl_memory_device_output(0x20, &pd->tmpdev TSRMLS_CC); /* SPACE */ - } else { - (*pd->conv1_filter->filter_function)(0x20, pd->conv1_filter TSRMLS_CC); - } - mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC); - pd->status = 1; - } else { - mbfl_memory_device_output(0x20, &pd->tmpdev TSRMLS_CC); - mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC); - mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev TSRMLS_CC); - mbfl_memory_device_reset(&pd->tmpdev TSRMLS_CC); - pd->status = 0; - } - } - break; - default: /* non encoded block */ - if (c == 0x0d || c == 0x0a) { /* CR LF */ - pd->status = 9; - } else if (c == 0x3d) { /* = */ - mbfl_memory_device_output(c, &pd->tmpdev TSRMLS_CC); - pd->status = 1; - } else { - (*pd->conv1_filter->filter_function)(c, pd->conv1_filter TSRMLS_CC); - } - break; - } - - return c; -} - -mbfl_string * -mime_header_decoder_result(struct mime_header_decoder_data *pd, mbfl_string *result TSRMLS_DC) -{ - switch (pd->status) { - case 1: - case 2: - case 3: - case 4: - case 7: - case 8: - case 9: - mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev TSRMLS_CC); - break; - case 5: - case 6: - (*pd->deco_filter->filter_flush)(pd->deco_filter TSRMLS_CC); - (*pd->conv1_filter->filter_flush)(pd->conv1_filter TSRMLS_CC); - break; - } - (*pd->conv2_filter->filter_flush)(pd->conv2_filter TSRMLS_CC); - mbfl_memory_device_reset(&pd->tmpdev TSRMLS_CC); - pd->status = 0; - - return mbfl_memory_device_result(&pd->outdev, result TSRMLS_CC); -} - -struct mime_header_decoder_data* -mime_header_decoder_new(enum mbfl_no_encoding outcode TSRMLS_DC) -{ - struct mime_header_decoder_data *pd; - - pd = (struct mime_header_decoder_data*)mbfl_malloc(sizeof(struct mime_header_decoder_data)); - if (pd == NULL) { - return NULL; - } - - mbfl_memory_device_init(&pd->outdev, 0, 0 TSRMLS_CC); - mbfl_memory_device_init(&pd->tmpdev, 0, 0 TSRMLS_CC); - pd->cspos = 0; - pd->status = 0; - pd->encoding = mbfl_no_encoding_pass; - pd->incode = mbfl_no_encoding_ascii; - pd->outcode = outcode; - /* charset convert filter */ - pd->conv2_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, pd->outcode, mbfl_memory_device_output, 0, &pd->outdev TSRMLS_CC); - pd->conv1_filter = mbfl_convert_filter_new(pd->incode, mbfl_no_encoding_wchar, mbfl_filter_output_pipe, 0, pd->conv2_filter TSRMLS_CC); - /* decode filter */ - pd->deco_filter = mbfl_convert_filter_new(pd->encoding, mbfl_no_encoding_8bit, mbfl_filter_output_pipe, 0, pd->conv1_filter TSRMLS_CC); - - if (pd->conv1_filter == NULL || pd->conv2_filter == NULL || pd->deco_filter == NULL) { - mime_header_decoder_delete(pd TSRMLS_CC); - return NULL; - } - - return pd; -} - -void -mime_header_decoder_delete(struct mime_header_decoder_data *pd TSRMLS_DC) -{ - if (pd) { - mbfl_convert_filter_delete(pd->conv2_filter TSRMLS_CC); - mbfl_convert_filter_delete(pd->conv1_filter TSRMLS_CC); - mbfl_convert_filter_delete(pd->deco_filter TSRMLS_CC); - mbfl_memory_device_clear(&pd->outdev TSRMLS_CC); - mbfl_memory_device_clear(&pd->tmpdev TSRMLS_CC); - mbfl_free((void*)pd); - } -} - -int -mime_header_decoder_feed(int c, struct mime_header_decoder_data *pd TSRMLS_DC) -{ - return mime_header_decoder_collector(c, pd TSRMLS_CC); -} - -mbfl_string * -mbfl_mime_header_decode( - mbfl_string *string, - mbfl_string *result, - enum mbfl_no_encoding outcode TSRMLS_DC) -{ - int n; - unsigned char *p; - struct mime_header_decoder_data *pd; - - mbfl_string_init(result); - result->no_language = string->no_language; - result->no_encoding = outcode; - - pd = mime_header_decoder_new(outcode TSRMLS_CC); - if (pd == NULL) { - return NULL; - } - - /* feed data */ - n = string->len; - p = string->val; - while (n > 0) { - mime_header_decoder_collector(*p++, pd TSRMLS_CC); - n--; - } - - result = mime_header_decoder_result(pd, result TSRMLS_CC); - mime_header_decoder_delete(pd TSRMLS_CC); - - return result; -} - - - -/* - * convert HTML numeric entity - */ -struct collector_htmlnumericentity_data { - mbfl_convert_filter *decoder; - int status; - int cache; - int digit; - int *convmap; - int mapsize; -}; - -static int -collector_encode_htmlnumericentity(int c, void *data TSRMLS_DC) -{ - struct collector_htmlnumericentity_data *pc = (struct collector_htmlnumericentity_data *)data; - int f, n, s, r, d, size, *mapelm; - - size = pc->mapsize; - f = 0; - n = 0; - while (n < size) { - mapelm = &(pc->convmap[n*4]); - if (c >= mapelm[0] && c <= mapelm[1]) { - s = (c + mapelm[2]) & mapelm[3]; - if (s >= 0) { - (*pc->decoder->filter_function)(0x26, pc->decoder TSRMLS_CC); /* '&' */ - (*pc->decoder->filter_function)(0x23, pc->decoder TSRMLS_CC); /* '#' */ - r = 100000000; - s %= r; - while (r > 0) { - d = s/r; - if (d || f) { - f = 1; - s %= r; - (*pc->decoder->filter_function)(mbfl_hexchar_table[d], pc->decoder TSRMLS_CC); - } - r /= 10; - } - if (!f) { - f = 1; - (*pc->decoder->filter_function)(mbfl_hexchar_table[0], pc->decoder TSRMLS_CC); - } - (*pc->decoder->filter_function)(0x3b, pc->decoder TSRMLS_CC); /* ';' */ - } - } - if (f) { - break; - } - n++; - } - if (!f) { - (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC); - } - - return c; -} - -static int -collector_decode_htmlnumericentity(int c, void *data TSRMLS_DC) -{ - struct collector_htmlnumericentity_data *pc = (struct collector_htmlnumericentity_data *)data; - int f, n, s, r, d, size, *mapelm; - - switch (pc->status) { - case 1: - if (c == 0x23) { /* '#' */ - pc->status = 2; - } else { - pc->status = 0; - (*pc->decoder->filter_function)(0x26, pc->decoder TSRMLS_CC); /* '&' */ - (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC); - } - break; - case 2: - if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */ - pc->cache = c - 0x30; - pc->status = 3; - pc->digit = 1; - } else { - pc->status = 0; - (*pc->decoder->filter_function)(0x26, pc->decoder TSRMLS_CC); /* '&' */ - (*pc->decoder->filter_function)(0x23, pc->decoder TSRMLS_CC); /* '#' */ - (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC); - } - break; - case 3: - s = 0; - f = 0; - if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */ - if (pc->digit > 9) { - pc->status = 0; - s = pc->cache; - f = 1; - } else { - s = pc->cache*10 + c - 0x30; - pc->cache = s; - pc->digit++; - } - } else { - pc->status = 0; - s = pc->cache; - f = 1; - n = 0; - size = pc->mapsize; - while (n < size) { - mapelm = &(pc->convmap[n*4]); - d = s - mapelm[2]; - if (d >= mapelm[0] && d <= mapelm[1]) { - f = 0; - (*pc->decoder->filter_function)(d, pc->decoder TSRMLS_CC); - if (c != 0x3b) { /* ';' */ - (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC); - } - break; - } - n++; - } - } - if (f) { - (*pc->decoder->filter_function)(0x26, pc->decoder TSRMLS_CC); /* '&' */ - (*pc->decoder->filter_function)(0x23, pc->decoder TSRMLS_CC); /* '#' */ - r = 1; - n = pc->digit; - while (n > 0) { - r *= 10; - n--; - } - s %= r; - r /= 10; - while (r > 0) { - d = s/r; - s %= r; - r /= 10; - (*pc->decoder->filter_function)(mbfl_hexchar_table[d], pc->decoder TSRMLS_CC); - } - (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC); - } - break; - default: - if (c == 0x26) { /* '&' */ - pc->status = 1; - } else { - (*pc->decoder->filter_function)(c, pc->decoder TSRMLS_CC); - } - break; - } - - return c; -} - -mbfl_string * -mbfl_html_numeric_entity( - mbfl_string *string, - mbfl_string *result, - int *convmap, - int mapsize, - int type TSRMLS_DC) -{ - struct collector_htmlnumericentity_data pc; - mbfl_memory_device device; - mbfl_convert_filter *encoder; - int n; - unsigned char *p; - - if (string == NULL || result == NULL) { - return NULL; - } - mbfl_string_init(result); - result->no_language = string->no_language; - result->no_encoding = string->no_encoding; - mbfl_memory_device_init(&device, string->len, 0 TSRMLS_CC); - - /* output code filter */ - pc.decoder = mbfl_convert_filter_new( - mbfl_no_encoding_wchar, - string->no_encoding, - mbfl_memory_device_output, 0, &device TSRMLS_CC); - /* wchar filter */ - if (type == 0) { - encoder = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, - collector_encode_htmlnumericentity, 0, &pc TSRMLS_CC); - } else { - encoder = mbfl_convert_filter_new( - string->no_encoding, - mbfl_no_encoding_wchar, - collector_decode_htmlnumericentity, 0, &pc TSRMLS_CC); - } - if (pc.decoder == NULL || encoder == NULL) { - mbfl_convert_filter_delete(encoder TSRMLS_CC); - mbfl_convert_filter_delete(pc.decoder TSRMLS_CC); - return NULL; - } - pc.status = 0; - pc.cache = 0; - pc.digit = 0; - pc.convmap = convmap; - pc.mapsize = mapsize; - - /* feed data */ - p = string->val; - n = string->len; - if (p != NULL) { - while (n > 0) { - if ((*encoder->filter_function)(*p++, encoder TSRMLS_CC) < 0) { - break; - } - n--; - } - } - mbfl_convert_filter_flush(encoder TSRMLS_CC); - mbfl_convert_filter_flush(pc.decoder TSRMLS_CC); - result = mbfl_memory_device_result(&device, result TSRMLS_CC); - mbfl_convert_filter_delete(encoder TSRMLS_CC); - mbfl_convert_filter_delete(pc.decoder TSRMLS_CC); - - return result; -} - -#endif /* HAVE_MBSTRING */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/mbstring/mbfilter.h b/ext/mbstring/mbfilter.h deleted file mode 100644 index a8a55ae40f..0000000000 --- a/ext/mbstring/mbfilter.h +++ /dev/null @@ -1,597 +0,0 @@ -/* charset=UTF-8 - * vim: encoding=utf-8: - * */ - -/* - * "streamable kanji code filter and converter" - * - * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved. - * - * This software is released under the GNU Lesser General Public License. - * (Version 2.1, February 1999) - * Please read the following detail of the licence (in japanese). - * - * ◆使用許諾æ¡ä»¶â—† - * - * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•れã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ - * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•トウェアã«é–¢ - * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ - * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•トウェアを使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利 - * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•トウェアを使用 - * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - * - * ã“ã®ã‚½ãƒ•トウェアを「GNU Lesser General Public License (Version 2.1, February - * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser - * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢ - * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ - * - * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã - * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“れã¾ã§Library General - * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚ - * http://www.gnu.org/ --- GNUウェブサイト - * http://www.gnu.org/copyleft/lesser.html --- ãƒ©ã‚¤ã‚»ãƒ³ã‚¹æ–‡é¢ - * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。 - * - * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプãƒã‚¸ã‚§ã‚¯ãƒˆã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§ - * ã¯ã‚りã¾ã›ã‚“。 - * - * â—†ä¿è¨¼å†…容◆ - * - * ã“ã®ã‚½ãƒ•トウェアã¯ã€æœŸå¾…ã•れãŸå‹•作・機能・性能をæŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨è¨ˆã•れ - * 開発ã•れã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚りã¾ã›ã‚“。ã“ã®ã‚½ãƒ•トウェアã¯ã€Œã“ - * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•れã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定㮠- * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•らã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•れãŸã‚Šæš—é»™ã«ç¤ºã•れã¦ã„ - * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åйã§ã™ã€‚ã“ã®ã‚½ãƒ•トウェアを使用ã—ãŸçµæžœãªã„ã—使 - * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æå®³ - * ã€ãƒ‡ãƒ¼ã‚¿ã®æå¤±ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æå®³ã«ã¤ã„ã¦ã¯ã€ãã®æå®³ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€… - * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è¦å‘Šã•れã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æå®³ã®è³ - * 償ãŠã‚ˆã³è£œå¡«ã‚’行ã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ» - * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚ - * - * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—† - * - * 〒102-0073 - * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F - * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ - * Phone: 03-3512-3655, Fax: 03-3512-3656 - * Email: sales@happysize.co.jp - * Web: http://happysize.com/ - * - * ◆著者◆ - * - * 金本 茂 <sgk@happysize.co.jp> - * - * ◆履æ´â—† - * - * 1998/11/10 sgk implementation in C++ - * 1999/4/25 sgk Cã§æ›¸ããªãŠã—。 - * 1999/4/26 sgk 入力フィルタを実装。漢å—コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’è¿½åŠ ã€‚ - * 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚ - * 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚ - * - */ - -/* - * Unicode support - * - * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team. - * All rights reserved. - * - */ - -/* - * - * streamable kanji code filter and converter - * mbfl : Multi Byte FiLter Liblary - * - */ - -/* $Id$ */ - - -#ifndef MBFL_MBFILTER_H -#define MBFL_MBFILTER_H - -enum mbfl_no_language { - mbfl_no_language_invalid = -1, - mbfl_no_language_neutral, - mbfl_no_language_uni, - mbfl_no_language_min, - mbfl_no_language_catalan, /* ca */ - mbfl_no_language_danish, /* da */ - mbfl_no_language_german, /* de */ - mbfl_no_language_english, /* en */ - mbfl_no_language_estonian, /* et */ - mbfl_no_language_greek, /* el */ - mbfl_no_language_spanish, /* es */ - mbfl_no_language_french, /* fr */ - mbfl_no_language_italian, /* it */ - mbfl_no_language_japanese, /* ja */ - mbfl_no_language_korean, /* ko */ - mbfl_no_language_dutch, /* nl */ - mbfl_no_language_polish, /* pl */ - mbfl_no_language_portuguese, /* pt */ - mbfl_no_language_swedish, /* sv */ - mbfl_no_language_simplified_chinese, /* zh-cn */ - mbfl_no_language_traditional_chinese, /* zh-tw */ - mbfl_no_language_russian, /* ru */ - mbfl_no_language_max -}; - -enum mbfl_no_encoding { - mbfl_no_encoding_invalid = -1, - mbfl_no_encoding_pass, - mbfl_no_encoding_auto, - mbfl_no_encoding_wchar, - mbfl_no_encoding_byte2be, - mbfl_no_encoding_byte2le, - mbfl_no_encoding_byte4be, - mbfl_no_encoding_byte4le, - mbfl_no_encoding_base64, - mbfl_no_encoding_uuencode, - mbfl_no_encoding_html_ent, - mbfl_no_encoding_qprint, - mbfl_no_encoding_7bit, - mbfl_no_encoding_8bit, - mbfl_no_encoding_charset_min, - mbfl_no_encoding_ucs4, - mbfl_no_encoding_ucs4be, - mbfl_no_encoding_ucs4le, - mbfl_no_encoding_ucs2, - mbfl_no_encoding_ucs2be, - mbfl_no_encoding_ucs2le, - mbfl_no_encoding_utf32, - mbfl_no_encoding_utf32be, - mbfl_no_encoding_utf32le, - mbfl_no_encoding_utf16, - mbfl_no_encoding_utf16be, - mbfl_no_encoding_utf16le, - mbfl_no_encoding_utf8, - mbfl_no_encoding_utf7, - mbfl_no_encoding_utf7imap, - mbfl_no_encoding_ascii, - mbfl_no_encoding_euc_jp, - mbfl_no_encoding_sjis, - mbfl_no_encoding_eucjp_win, - mbfl_no_encoding_sjis_win, - mbfl_no_encoding_sjis_mac, - mbfl_no_encoding_jis, - mbfl_no_encoding_2022jp, - mbfl_no_encoding_cp1252, - mbfl_no_encoding_8859_1, - mbfl_no_encoding_8859_2, - mbfl_no_encoding_8859_3, - mbfl_no_encoding_8859_4, - mbfl_no_encoding_8859_5, - mbfl_no_encoding_8859_6, - mbfl_no_encoding_8859_7, - mbfl_no_encoding_8859_8, - mbfl_no_encoding_8859_9, - mbfl_no_encoding_8859_10, - mbfl_no_encoding_8859_13, - mbfl_no_encoding_8859_14, - mbfl_no_encoding_8859_15, - mbfl_no_encoding_euc_cn, - mbfl_no_encoding_cp936, - mbfl_no_encoding_euc_tw, - mbfl_no_encoding_big5, - mbfl_no_encoding_euc_kr, - mbfl_no_encoding_2022kr, - mbfl_no_encoding_uhc, - mbfl_no_encoding_hz, - mbfl_no_encoding_cp1251, - mbfl_no_encoding_cp866, - mbfl_no_encoding_koi8r, - mbfl_no_encoding_charset_max -}; - - -/* - * language - */ -typedef struct _mbfl_language { - enum mbfl_no_language no_language; - const char *name; - const char *short_name; - const char *(*aliases)[]; - enum mbfl_no_encoding mail_charset; - enum mbfl_no_encoding mail_header_encoding; - enum mbfl_no_encoding mail_body_encoding; -} mbfl_language; - - -/* - * encoding - */ -typedef struct _mbfl_encoding { - enum mbfl_no_encoding no_encoding; - const char *name; - const char *mime_name; - const char *(*aliases)[]; - const unsigned char *mblen_table; - unsigned int flag; -} mbfl_encoding; - - -#define MBFL_ENCTYPE_SBCS 0x00000001 -#define MBFL_ENCTYPE_MBCS 0x00000002 -#define MBFL_ENCTYPE_WCS2BE 0x00000010 -#define MBFL_ENCTYPE_WCS2LE 0x00000020 -#define MBFL_ENCTYPE_MWC2BE 0x00000040 -#define MBFL_ENCTYPE_MWC2LE 0x00000080 -#define MBFL_ENCTYPE_WCS4BE 0x00000100 -#define MBFL_ENCTYPE_WCS4LE 0x00000200 -#define MBFL_ENCTYPE_MWC4BE 0x00000400 -#define MBFL_ENCTYPE_MWC4LE 0x00000800 -#define MBFL_ENCTYPE_SHFTCODE 0x00001000 -#define MBFL_ENCTYPE_HTML_ENT 0x00002000 - -/* wchar plane, special charactor */ -#define MBFL_WCSPLANE_MASK 0xffff -#define MBFL_WCSPLANE_UCS2MAX 0x00010000 -#define MBFL_WCSPLANE_SUPMIN 0x00010000 -#define MBFL_WCSPLANE_SUPMAX 0x00200000 -#define MBFL_WCSPLANE_JIS0208 0x70e10000 /* JIS HEX : 2121h - 7E7Eh */ -#define MBFL_WCSPLANE_JIS0212 0x70e20000 /* JIS HEX : 2121h - 7E7Eh */ -#define MBFL_WCSPLANE_WINCP932 0x70e30000 /* JIS HEX : 2121h - 9898h */ -#define MBFL_WCSPLANE_8859_1 0x70e40000 /* 00h - FFh */ -#define MBFL_WCSPLANE_8859_2 0x70e50000 /* 00h - FFh */ -#define MBFL_WCSPLANE_8859_3 0x70e60000 /* 00h - FFh */ -#define MBFL_WCSPLANE_8859_4 0x70e70000 /* 00h - FFh */ -#define MBFL_WCSPLANE_8859_5 0x70e80000 /* 00h - FFh */ -#define MBFL_WCSPLANE_8859_6 0x70e90000 /* 00h - FFh */ -#define MBFL_WCSPLANE_8859_7 0x70ea0000 /* 00h - FFh */ -#define MBFL_WCSPLANE_8859_8 0x70eb0000 /* 00h - FFh */ -#define MBFL_WCSPLANE_8859_9 0x70ec0000 /* 00h - FFh */ -#define MBFL_WCSPLANE_8859_10 0x70ed0000 /* 00h - FFh */ -#define MBFL_WCSPLANE_8859_13 0x70ee0000 /* 00h - FFh */ -#define MBFL_WCSPLANE_8859_14 0x70ef0000 /* 00h - FFh */ -#define MBFL_WCSPLANE_8859_15 0x70f00000 /* 00h - FFh */ -#define MBFL_WCSPLANE_KSC5601 0x70f10000 /* 2121h - 7E7Eh */ -#define MBFL_WCSPLANE_GB2312 0x70f20000 /* 2121h - 7E7Eh */ -#define MBFL_WCSPLANE_WINCP936 0x70f30000 /* 2121h - 9898h */ -#define MBFL_WCSPLANE_BIG5 0x70f40000 /* 2121h - 9898h */ -#define MBFL_WCSPLANE_CNS11643 0x70f50000 /* 2121h - 9898h */ -#define MBFL_WCSPLANE_UHC 0x70f60000 /* 8141h - fefeh */ -#define MBFL_WCSPLANE_CP1251 0x70f70000 -#define MBFL_WCSPLANE_CP866 0x70f80000 -#define MBFL_WCSPLANE_KOI8R 0x70f90000 -#define MBFL_WCSGROUP_MASK 0xffffff -#define MBFL_WCSGROUP_UCS4MAX 0x70000000 -#define MBFL_WCSGROUP_WCHARMAX 0x78000000 -#define MBFL_WCSGROUP_THROUGH 0x78000000 /* 000000h - FFFFFFh */ - - -/* - * string object - */ -typedef struct _mbfl_string { - enum mbfl_no_language no_language; - enum mbfl_no_encoding no_encoding; - unsigned char *val; - unsigned int len; -} mbfl_string; - -void mbfl_string_init(mbfl_string *string); -void mbfl_string_init_set(mbfl_string *string, enum mbfl_no_language no_language, enum mbfl_no_encoding no_encoding); -void mbfl_string_clear(mbfl_string *string); - - -/* - * language resolver - */ -const mbfl_language * mbfl_name2language(const char *name); -const mbfl_language * mbfl_no2language(enum mbfl_no_language no_language); -enum mbfl_no_language mbfl_name2no_language(const char *name); -const char * mbfl_no_language2name(enum mbfl_no_language no_language); - - -/* - * encoding resolver - */ -const mbfl_encoding * mbfl_name2encoding(const char *name); -const mbfl_encoding * mbfl_no2encoding(enum mbfl_no_encoding no_encoding); -enum mbfl_no_encoding mbfl_name2no_encoding(const char *name); -const char * mbfl_no_encoding2name(enum mbfl_no_encoding no_encoding); -const char * mbfl_no2preferred_mime_name(enum mbfl_no_encoding no_encoding); -int mbfl_is_support_encoding(const char *name); - - -/* - * memory output function - */ -#define MBFL_MEMORY_DEVICE_ALLOC_SIZE 64 - -typedef struct _mbfl_memory_device { - unsigned char *buffer; - int length; - int pos; - int allocsz; -} mbfl_memory_device; - -typedef struct _mbfl_wchar_device { - unsigned int *buffer; - int length; - int pos; - int allocsz; -} mbfl_wchar_device; - -void mbfl_memory_device_init(mbfl_memory_device *device, int initsz, int allocsz TSRMLS_DC); -void mbfl_memory_device_realloc(mbfl_memory_device *device, int initsz, int allocsz TSRMLS_DC); -void mbfl_memory_device_clear(mbfl_memory_device *device TSRMLS_DC); -void mbfl_memory_device_reset(mbfl_memory_device *device TSRMLS_DC); -mbfl_string * mbfl_memory_device_result(mbfl_memory_device *device, mbfl_string *result TSRMLS_DC); -int mbfl_memory_device_output(int c, void *data TSRMLS_DC); -int mbfl_memory_device_output2(int c, void *data TSRMLS_DC); -int mbfl_memory_device_output4(int c, void *data TSRMLS_DC); -int mbfl_memory_device_strcat(mbfl_memory_device *device, const char *psrc TSRMLS_DC); -int mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, int len TSRMLS_DC); -int mbfl_memory_device_devcat(mbfl_memory_device *dest, mbfl_memory_device *src TSRMLS_DC); - -void mbfl_wchar_device_init(mbfl_wchar_device *device TSRMLS_DC); -int mbfl_wchar_device_output(int c, void *data TSRMLS_DC); - - -/* - * convert filter - */ -#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE 0 -#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR 1 -#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG 2 - -typedef struct _mbfl_convert_filter mbfl_convert_filter; - -struct _mbfl_convert_filter { - void (*filter_ctor)(mbfl_convert_filter *filter TSRMLS_DC); - void (*filter_dtor)(mbfl_convert_filter *filter TSRMLS_DC); - int (*filter_function)(int c, mbfl_convert_filter *filter TSRMLS_DC); - int (*filter_flush)(mbfl_convert_filter *filter TSRMLS_DC); - int (*output_function)(int c, void *data TSRMLS_DC); - int (*flush_function)(void *data TSRMLS_DC); - void *data; - int status; - int cache; - const mbfl_encoding *from; - const mbfl_encoding *to; - int illegal_mode; - int illegal_substchar; -}; - -struct mbfl_convert_vtbl { - enum mbfl_no_encoding from; - enum mbfl_no_encoding to; - void (*filter_ctor)(mbfl_convert_filter *filter TSRMLS_DC); - void (*filter_dtor)(mbfl_convert_filter *filter TSRMLS_DC); - int (*filter_function)(int c, mbfl_convert_filter *filter TSRMLS_DC); - int (*filter_flush)(mbfl_convert_filter *filter TSRMLS_DC); -}; - -mbfl_convert_filter * -mbfl_convert_filter_new( - enum mbfl_no_encoding from, - enum mbfl_no_encoding to, - int (*output_function)(int, void * TSRMLS_DC), - int (*flush_function)(void * TSRMLS_DC), - void *data TSRMLS_DC); -void mbfl_convert_filter_delete(mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_convert_filter_feed(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_convert_filter_flush(mbfl_convert_filter *filter TSRMLS_DC); -void mbfl_convert_filter_reset(mbfl_convert_filter *filter, enum mbfl_no_encoding from, enum mbfl_no_encoding to TSRMLS_DC); -void mbfl_convert_filter_copy(mbfl_convert_filter *src, mbfl_convert_filter *dist TSRMLS_DC); -int mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter TSRMLS_DC); - - -/* - * identify filter - */ -typedef struct _mbfl_identify_filter mbfl_identify_filter; - -struct _mbfl_identify_filter { - void (*filter_ctor)(mbfl_identify_filter *filter TSRMLS_DC); - void (*filter_dtor)(mbfl_identify_filter *filter TSRMLS_DC); - int (*filter_function)(int c, mbfl_identify_filter *filter TSRMLS_DC); - int status; - int flag; - int score; - const mbfl_encoding *encoding; -}; - -struct mbfl_identify_vtbl { - enum mbfl_no_encoding encoding; - void (*filter_ctor)(mbfl_identify_filter *filter TSRMLS_DC); - void (*filter_dtor)(mbfl_identify_filter *filter TSRMLS_DC); - int (*filter_function)(int c, mbfl_identify_filter *filter TSRMLS_DC); -}; - -mbfl_identify_filter * mbfl_identify_filter_new(enum mbfl_no_encoding encoding TSRMLS_DC); -void mbfl_identify_filter_delete(mbfl_identify_filter *filter TSRMLS_DC); - - -/* - * buffering converter - */ -typedef struct _mbfl_buffer_converter mbfl_buffer_converter; - -struct _mbfl_buffer_converter { - mbfl_convert_filter *filter1; - mbfl_convert_filter *filter2; - mbfl_memory_device device; - const mbfl_encoding *from; - const mbfl_encoding *to; -}; - -mbfl_buffer_converter * mbfl_buffer_converter_new(enum mbfl_no_encoding from, enum mbfl_no_encoding to, int buf_initsz TSRMLS_DC); -void mbfl_buffer_converter_delete(mbfl_buffer_converter *convd TSRMLS_DC); -void mbfl_buffer_converter_reset(mbfl_buffer_converter *convd TSRMLS_DC); -int mbfl_buffer_converter_illegal_mode(mbfl_buffer_converter *convd, int mode TSRMLS_DC); -int mbfl_buffer_converter_illegal_substchar(mbfl_buffer_converter *convd, int substchar TSRMLS_DC); -int mbfl_buffer_converter_strncat(mbfl_buffer_converter *convd, const unsigned char *p, int n TSRMLS_DC); -int mbfl_buffer_converter_feed(mbfl_buffer_converter *convd, mbfl_string *string TSRMLS_DC); -int mbfl_buffer_converter_flush(mbfl_buffer_converter *convd TSRMLS_DC); -mbfl_string * mbfl_buffer_converter_getbuffer(mbfl_buffer_converter *convd, mbfl_string *result TSRMLS_DC); -mbfl_string * mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result TSRMLS_DC); -mbfl_string * mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string, mbfl_string *result TSRMLS_DC); - - -/* - * encoding detector - */ -typedef struct _mbfl_encoding_detector mbfl_encoding_detector; - -struct _mbfl_encoding_detector { - mbfl_identify_filter **filter_list; - int filter_list_size; -}; - -mbfl_encoding_detector * mbfl_encoding_detector_new(enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC); -void mbfl_encoding_detector_delete(mbfl_encoding_detector *identd TSRMLS_DC); -int mbfl_encoding_detector_feed(mbfl_encoding_detector *identd, mbfl_string *string TSRMLS_DC); -enum mbfl_no_encoding mbfl_encoding_detector_judge(mbfl_encoding_detector *identd TSRMLS_DC); - - -/* - * encoding converter - */ -mbfl_string * -mbfl_convert_encoding(mbfl_string *string, mbfl_string *result, enum mbfl_no_encoding toenc TSRMLS_DC); - - -/* - * identify encoding - */ -const mbfl_encoding * -mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz, int strict TSRMLS_DC); - -const char * -mbfl_identify_encoding_name(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz, int strict TSRMLS_DC); - -const enum mbfl_no_encoding -mbfl_identify_encoding_no(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC); - -/* - * strlen - */ -int -mbfl_strlen(mbfl_string *string TSRMLS_DC); - -#ifdef ZEND_MULTIBYTE -/* - * oddlen - */ -int -mbfl_oddlen(mbfl_string *string); -#endif /* ZEND_MULTIBYTE */ - -/* - * strpos - */ -int -mbfl_strpos(mbfl_string *haystack, mbfl_string *needle, int offset, int reverse TSRMLS_DC); - - -/* - * substr_count - */ -int -mbfl_substr_count(mbfl_string *haystack, mbfl_string *needle TSRMLS_DC); - -/* - * substr - */ -mbfl_string * -mbfl_substr(mbfl_string *string, mbfl_string *result, int from, int length TSRMLS_DC); - -/* - * strcut - */ -mbfl_string * -mbfl_strcut(mbfl_string *string, mbfl_string *result, int from, int length TSRMLS_DC); - -/* - * strwidth - */ -int -mbfl_strwidth(mbfl_string *string TSRMLS_DC); - -/* - * strimwidth - */ -mbfl_string * -mbfl_strimwidth(mbfl_string *string, mbfl_string *marker, mbfl_string *result, int from, int width TSRMLS_DC); - -/* - * MIME header encode - */ -struct mime_header_encoder_data; /* forward declaration */ - -struct mime_header_encoder_data * -mime_header_encoder_new( - enum mbfl_no_encoding incode, - enum mbfl_no_encoding outcode, - enum mbfl_no_encoding encoding TSRMLS_DC); - -void -mime_header_encoder_delete(struct mime_header_encoder_data *pe TSRMLS_DC); - -int -mime_header_encoder_feed(int c, struct mime_header_encoder_data *pe TSRMLS_DC); - -mbfl_string * -mime_header_encoder_result(struct mime_header_encoder_data *pe, mbfl_string *result TSRMLS_DC); - -mbfl_string * -mbfl_mime_header_encode( - mbfl_string *string, mbfl_string *result, - enum mbfl_no_encoding outcode, - enum mbfl_no_encoding encoding, - const char *linefeed, - int indent TSRMLS_DC); - -/* - * MIME header decode - */ -struct mime_header_decoder_data; /* forward declaration */ - -struct mime_header_decoder_data * -mime_header_decoder_new(enum mbfl_no_encoding outcode TSRMLS_DC); - -void -mime_header_decoder_delete(struct mime_header_decoder_data *pd TSRMLS_DC); - -int -mime_header_decoder_feed(int c, struct mime_header_decoder_data *pd TSRMLS_DC); - -mbfl_string * -mime_header_decoder_result(struct mime_header_decoder_data *pd, mbfl_string *result TSRMLS_DC); - -mbfl_string * -mbfl_mime_header_decode( - mbfl_string *string, - mbfl_string *result, - enum mbfl_no_encoding outcode TSRMLS_DC); - - -/* - * convert HTML numeric entity - */ -mbfl_string * -mbfl_html_numeric_entity(mbfl_string *string, mbfl_string *result, int *convmap, int mapsize, int type TSRMLS_DC); - - -/* - * convert of harfwidth and fullwidth for japanese - */ -mbfl_string * -mbfl_ja_jp_hantozen(mbfl_string *string, mbfl_string *result, int mode TSRMLS_DC); - -/* - * HTML Entity table - */ -typedef struct _mbfl_html_entity { - char * name; - int code; -} mbfl_html_entity; - -extern const mbfl_html_entity mbfl_html_entity_list[]; - -#endif /* MBFL_MBFILTER_H */ diff --git a/ext/mbstring/mbfilter_cn.c b/ext/mbstring/mbfilter_cn.c deleted file mode 100644 index 9f2d623fe4..0000000000 --- a/ext/mbstring/mbfilter_cn.c +++ /dev/null @@ -1,417 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Rui Hirokawa <hirokawa@php.net> | - +----------------------------------------------------------------------+ - */ - -/* - * "streamable simplified chinese code filter and converter" - */ - -/* $Id$ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_globals.h" - -#if defined(HAVE_MBSTR_CN) -#include "mbfilter.h" -#include "mbfilter_cn.h" - -#include "unicode_table_cn.h" - -#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) - - -/* - * EUC-CN => wchar - */ -int -mbfl_filt_conv_euccn_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, w; - - switch (filter->status) { - case 0: - if (c >= 0 && c < 0x80) { /* latin */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else if (c > 0xa0 && c < 0xff) { /* dbcs lead byte */ - filter->status = 1; - filter->cache = c; - } else { - w = c & MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 1: /* dbcs second byte */ - filter->status = 0; - c1 = filter->cache; - if (c1 > 0xa0 && c1 < 0xff && c > 0xa0 && c < 0xff) { - w = (c1 - 0x81)*192 + (c - 0x40); - if (w >= 0 && w < cp936_ucs_table_size) { - w = cp936_ucs_table[w]; - } else { - w = 0; - } - if (w <= 0) { - w = (c1 << 8) | c; - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_GB2312; - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -/* - * wchar => EUC-CN - */ -int -mbfl_filt_conv_wchar_euccn(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, c2, s; - - s = 0; - if (c >= ucs_a1_cp936_table_min && c < ucs_a1_cp936_table_max) { - s = ucs_a1_cp936_table[c - ucs_a1_cp936_table_min]; - } else if (c >= ucs_a2_cp936_table_min && c < ucs_a2_cp936_table_max) { - s = ucs_a2_cp936_table[c - ucs_a2_cp936_table_min]; - } else if (c >= ucs_a3_cp936_table_min && c < ucs_a3_cp936_table_max) { - s = ucs_a3_cp936_table[c - ucs_a3_cp936_table_min]; - } else if (c >= ucs_i_cp936_table_min && c < ucs_i_cp936_table_max) { - s = ucs_i_cp936_table[c - ucs_i_cp936_table_min]; - } else if (c >= ucs_hff_cp936_table_min && c < ucs_hff_cp936_table_max) { - s = ucs_hff_cp936_table[c - ucs_hff_cp936_table_min]; - } - c1 = (s >> 8) & 0xff; - c2 = s & 0xff; - - if (c1 < 0xa1 || c2 < 0xa1) { /* exclude CP936 extension */ - s = c; - } - - if (s <= 0) { - c1 = c & ~MBFL_WCSPLANE_MASK; - if (c1 == MBFL_WCSPLANE_GB2312) { - s = c & MBFL_WCSPLANE_MASK; - } - if (c == 0) { - s = 0; - } else if (s <= 0) { - s = -1; - } - } - if (s >= 0) { - if (s < 0x80) { /* latin */ - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * CP936 => wchar - */ -int -mbfl_filt_conv_cp936_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, w; - - switch (filter->status) { - case 0: - if (c >= 0 && c < 0x80) { /* latin */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else if (c == 0x80) { /* euro sign */ - CK((*filter->output_function)(0x20ac, filter->data TSRMLS_CC)); - } else if (c > 0x80 && c < 0xff) { /* dbcs lead byte */ - filter->status = 1; - filter->cache = c; - } else { - w = c & MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 1: /* dbcs second byte */ - filter->status = 0; - c1 = filter->cache; - if ( c1 < 0xff && c1 > 0x80 && c > 0x39 && c < 0xff && c != 0x7f) { - w = (c1 - 0x81)*192 + (c - 0x40); - if (w >= 0 && w < cp936_ucs_table_size) { - w = cp936_ucs_table[w]; - } else { - w = 0; - } - if (w <= 0) { - w = (c1 << 8) | c; - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_WINCP936; - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -/* - * wchar => CP936 - */ -int -mbfl_filt_conv_wchar_cp936(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, s; - - s = 0; - if (c >= ucs_a1_cp936_table_min && c < ucs_a1_cp936_table_max) { - s = ucs_a1_cp936_table[c - ucs_a1_cp936_table_min]; - } else if (c >= ucs_a2_cp936_table_min && c < ucs_a2_cp936_table_max) { - s = ucs_a2_cp936_table[c - ucs_a2_cp936_table_min]; - } else if (c >= ucs_a3_cp936_table_min && c < ucs_a3_cp936_table_max) { - s = ucs_a3_cp936_table[c - ucs_a3_cp936_table_min]; - } else if (c >= ucs_i_cp936_table_min && c < ucs_i_cp936_table_max) { - s = ucs_i_cp936_table[c - ucs_i_cp936_table_min]; - } else if (c >= ucs_ci_cp936_table_min && c < ucs_ci_cp936_table_max) { - s = ucs_ci_cp936_table[c - ucs_ci_cp936_table_min]; - } else if (c >= ucs_cf_cp936_table_min && c < ucs_cf_cp936_table_max) { - s = ucs_cf_cp936_table[c - ucs_cf_cp936_table_min]; - } else if (c >= ucs_sfv_cp936_table_min && c < ucs_sfv_cp936_table_max) { - s = ucs_sfv_cp936_table[c - ucs_sfv_cp936_table_min]; - } else if (c >= ucs_hff_cp936_table_min && c < ucs_hff_cp936_table_max) { - s = ucs_hff_cp936_table[c - ucs_hff_cp936_table_min]; - } - if (s <= 0) { - c1 = c & ~MBFL_WCSPLANE_MASK; - if (c1 == MBFL_WCSPLANE_WINCP936) { - s = c & MBFL_WCSPLANE_MASK; - } - if (c == 0) { - s = 0; - } else if (s <= 0) { - s = -1; - } - } - if (s >= 0) { - if (s < 0x80) { /* latin */ - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - - -/* - * HZ => wchar - */ -int -mbfl_filt_conv_hz_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, s, w; - - switch (filter->status & 0xf) { -/* case 0x00: ASCII */ -/* case 0x10: GB2312 */ - case 0: - if (c == 0x7e) { - filter->status += 2; - } else if (filter->status == 0x10 && c > 0x20 && c < 0x7f) { /* DBCS first char */ - filter->cache = c; - filter->status += 1; - } else if (c >= 0 && c < 0x80) { /* latin, CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = c & MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - -/* case 0x11: GB2312 second char */ - case 1: - filter->status &= ~0xf; - c1 = filter->cache; - if (c1 > 0x20 && c1 < 0x7f && c > 0x20 && c < 0x7f) { - s = (c1 - 1)*192 + c + 0x40; /* GB2312 */ - if (s >= 0 && s < cp936_ucs_table_size) { - w = cp936_ucs_table[s]; - } else { - w = 0; - } - if (w <= 0) { - w = (c1 << 8) | c; - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_GB2312; - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - /* '~' */ - case 2: - if (c == 0x7d) { /* '}' */ - filter->status = 0x0; - } else if (c == 0x7b) { /* '{' */ - filter->status = 0x10; - } else if (c == 0x7e) { /* '~' */ - filter->status = 0x0; - CK((*filter->output_function)(0x007e, filter->data TSRMLS_CC)); - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -/* - * wchar => HZ - */ -int -mbfl_filt_conv_wchar_hz(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - s = 0; - if (c >= ucs_a1_cp936_table_min && c < ucs_a1_cp936_table_max) { - s = ucs_a1_cp936_table[c - ucs_a1_cp936_table_min]; - } else if (c >= ucs_a2_cp936_table_min && c < ucs_a2_cp936_table_max) { - s = ucs_a2_cp936_table[c - ucs_a2_cp936_table_min]; - } else if (c >= ucs_a3_cp936_table_min && c < ucs_a3_cp936_table_max) { - s = ucs_a3_cp936_table[c - ucs_a3_cp936_table_min]; - } else if (c >= ucs_i_cp936_table_min && c < ucs_i_cp936_table_max) { - s = ucs_i_cp936_table[c - ucs_i_cp936_table_min]; - } else if (c >= ucs_hff_cp936_table_min && c < ucs_hff_cp936_table_max) { - s = ucs_hff_cp936_table[c - ucs_hff_cp936_table_min]; - } - if (s & 0x8000) { - s -= 0x8080; - } - - if (s <= 0) { - if (c == 0) { - s = 0; - } else if (s <= 0) { - s = -1; - } - } else if ((s >= 0x80 && s < 0x2121) || (s > 0x8080)) { - s = -1; - } - if (s >= 0) { - if (s < 0x80) { /* ASCII */ - if ((filter->status & 0xff00) != 0) { - CK((*filter->output_function)(0x7e, filter->data TSRMLS_CC)); /* '~' */ - CK((*filter->output_function)(0x7d, filter->data TSRMLS_CC)); /* '}' */ - } - filter->status = 0; - if (s == 0x7e){ - CK((*filter->output_function)(0x7e, filter->data TSRMLS_CC)); - } - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { /* GB 2312-80 */ - if ((filter->status & 0xff00) != 0x200) { - CK((*filter->output_function)(0x7e, filter->data TSRMLS_CC)); /* '~' */ - CK((*filter->output_function)(0x7b, filter->data TSRMLS_CC)); /* '{' */ - } - filter->status = 0x200; - CK((*filter->output_function)((s >> 8) & 0x7f, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s & 0x7f, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -int -mbfl_filt_conv_any_hz_flush(mbfl_convert_filter *filter TSRMLS_DC) -{ - /* back to latin */ - if ((filter->status & 0xff00) != 0) { - CK((*filter->output_function)(0x7e, filter->data TSRMLS_CC)); /* ~ */ - CK((*filter->output_function)(0x7d, filter->data TSRMLS_CC)); /* '{' */ - } - filter->status &= 0xff; - return 0; -} - -#endif /* HAVE_MBSTR_CN */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/mbstring/mbfilter_cn.h b/ext/mbstring/mbfilter_cn.h deleted file mode 100644 index 5f809e1ee5..0000000000 --- a/ext/mbstring/mbfilter_cn.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Rui Hirokawa <hirokawa@php.net> | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef MBFL_MBFILTER_CN_H -#define MBFL_MBFILTER_CN_H - -int mbfl_filt_conv_euccn_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_wchar_euccn(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_cp936_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_wchar_cp936(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_hz_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_wchar_hz(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_any_hz_flush(mbfl_convert_filter *filter TSRMLS_DC); - -#endif /* MBFL_MBFILTER_CN_H */ diff --git a/ext/mbstring/mbfilter_ja.c b/ext/mbstring/mbfilter_ja.c deleted file mode 100644 index bd473900cd..0000000000 --- a/ext/mbstring/mbfilter_ja.c +++ /dev/null @@ -1,1291 +0,0 @@ -/* charset=UTF-8 */ - -/* - * "streamable kanji code filter and converter" - * - * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved. - * - * This software is released under the GNU Lesser General Public License. - * (Version 2.1, February 1999) - * Please read the following detail of the licence (in japanese). - * - * ◆使用許諾æ¡ä»¶â—† - * - * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•れã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ - * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•トウェアã«é–¢ - * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ - * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•トウェアを使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利 - * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•トウェアを使用 - * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - * - * ã“ã®ã‚½ãƒ•トウェアを「GNU Lesser General Public License (Version 2.1, February - * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser - * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢ - * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ - * - * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã - * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“れã¾ã§Library General - * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚ - * http://www.gnu.org/ --- GNUウェブサイト - * http://www.gnu.org/copyleft/lesser.html --- ãƒ©ã‚¤ã‚»ãƒ³ã‚¹æ–‡é¢ - * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。 - * - * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプãƒã‚¸ã‚§ã‚¯ãƒˆã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§ - * ã¯ã‚りã¾ã›ã‚“。 - * - * â—†ä¿è¨¼å†…容◆ - * - * ã“ã®ã‚½ãƒ•トウェアã¯ã€æœŸå¾…ã•れãŸå‹•作・機能・性能をæŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨è¨ˆã•れ - * 開発ã•れã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚りã¾ã›ã‚“。ã“ã®ã‚½ãƒ•トウェアã¯ã€Œã“ - * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•れã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定㮠- * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•らã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•れãŸã‚Šæš—é»™ã«ç¤ºã•れã¦ã„ - * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åйã§ã™ã€‚ã“ã®ã‚½ãƒ•トウェアを使用ã—ãŸçµæžœãªã„ã—使 - * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æå®³ - * ã€ãƒ‡ãƒ¼ã‚¿ã®æå¤±ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æå®³ã«ã¤ã„ã¦ã¯ã€ãã®æå®³ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€… - * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è¦å‘Šã•れã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æå®³ã®è³ - * 償ãŠã‚ˆã³è£œå¡«ã‚’行ã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ» - * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚ - * - * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—† - * - * 〒102-0073 - * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F - * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ - * Phone: 03-3512-3655, Fax: 03-3512-3656 - * Email: sales@happysize.co.jp - * Web: http://happysize.com/ - * - * ◆著者◆ - * - * 金本 茂 <sgk@happysize.co.jp> - * - * ◆履æ´â—† - * - * 1998/11/10 sgk implementation in C++ - * 1999/4/25 sgk Cã§æ›¸ããªãŠã—。 - * 1999/4/26 sgk 入力フィルタを実装。漢å—コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’è¿½åŠ ã€‚ - * 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚ - * 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚ - * - */ - -/* - * Unicode support - * - * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team. - * All rights reserved. - * - */ - -/* $Id$ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_globals.h" - -#if defined(HAVE_MBSTR_JA) - -#include "mbfilter.h" -#include "mbfilter_ja.h" - -#include "cp932_table.h" -#include "unicode_table_ja.h" - -#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) - - -/* - * EUC-JP => wchar - */ -int -mbfl_filt_conv_eucjp_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, s, w; - - switch (filter->status) { - case 0: - if (c >= 0 && c < 0x80) { /* latin */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else if (c > 0xa0 && c < 0xff) { /* X 0208 first char */ - filter->status = 1; - filter->cache = c; - } else if (c == 0x8e) { /* kana first char */ - filter->status = 2; - } else if (c == 0x8f) { /* X 0212 first char */ - filter->status = 3; - } else { - w = c & MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 1: /* got first half */ - filter->status = 0; - c1 = filter->cache; - if (c > 0xa0 && c < 0xff) { - s = (c1 - 0xa1)*94 + c - 0xa1; - if (s >= 0 && s < jisx0208_ucs_table_size) { - w = jisx0208_ucs_table[s]; - } else { - w = 0; - } - if (w <= 0) { - w = ((c1 & 0x7f) << 8) | (c & 0x7f); - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_JIS0208; - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 2: /* got 0x8e */ - filter->status = 0; - if (c > 0xa0 && c < 0xe0) { - w = 0xfec0 + c; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = 0x8e00 | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 3: /* got 0x8f, X 0212 first char */ - if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - filter->status = 0; - } else { - filter->status++; - filter->cache = c; - } - break; - case 4: /* got 0x8f, X 0212 second char */ - filter->status = 0; - c1 = filter->cache; - if (c1 > 0xa0 && c1 < 0xff && c > 0xa0 && c < 0xff) { - s = (c1 - 0xa1)*94 + c - 0xa1; - if (s >= 0 && s < jisx0212_ucs_table_size) { - w = jisx0212_ucs_table[s]; - } else { - w = 0; - } - if (w <= 0) { - w = ((c1 & 0x7f) << 8) | (c & 0x7f); - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_JIS0212; - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c | 0x8f0000; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -/* - * wchar => EUC-JP - */ -int -mbfl_filt_conv_wchar_eucjp(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, s; - - s = 0; - if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) { - s = ucs_a1_jis_table[c - ucs_a1_jis_table_min]; - } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) { - s = ucs_a2_jis_table[c - ucs_a2_jis_table_min]; - } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) { - s = ucs_i_jis_table[c - ucs_i_jis_table_min]; - } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) { - s = ucs_r_jis_table[c - ucs_r_jis_table_min]; - } - if (s <= 0) { - c1 = c & ~MBFL_WCSPLANE_MASK; - if (c1 == MBFL_WCSPLANE_JIS0208) { - s = c & MBFL_WCSPLANE_MASK; - } else if (c1 == MBFL_WCSPLANE_JIS0212) { - s = c & MBFL_WCSPLANE_MASK; - s |= 0x8080; - } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */ - s = 0x2140; - } else if (c == 0xff5e) { /* FULLWIDTH TILDE */ - s = 0x2141; - } else if (c == 0x2225) { /* PARALLEL TO */ - s = 0x2142; - } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */ - s = 0x215d; - } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */ - s = 0x2171; - } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */ - s = 0x2172; - } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */ - s = 0x224c; - } - if (c == 0) { - s = 0; - } else if (s <= 0) { - s = -1; - } - } - if (s >= 0) { - if (s < 0x80) { /* latin */ - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else if (s < 0x100) { /* kana */ - CK((*filter->output_function)(0x8e, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else if (s < 0x8080) { /* X 0208 */ - CK((*filter->output_function)(((s >> 8) & 0xff) | 0x80, filter->data TSRMLS_CC)); - CK((*filter->output_function)((s & 0xff) | 0x80, filter->data TSRMLS_CC)); - } else { /* X 0212 */ - CK((*filter->output_function)(0x8f, filter->data TSRMLS_CC)); - CK((*filter->output_function)(((s >> 8) & 0xff) | 0x80, filter->data TSRMLS_CC)); - CK((*filter->output_function)((s & 0xff) | 0x80, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - - -/* - * eucJP-win => wchar - */ -int -mbfl_filt_conv_eucjpwin_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, s, w, n; - - switch (filter->status) { - case 0: - if (c >= 0 && c < 0x80) { /* latin */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else if (c > 0xa0 && c < 0xff) { /* CP932 first char */ - filter->status = 1; - filter->cache = c; - } else if (c == 0x8e) { /* kana first char */ - filter->status = 2; - } else if (c == 0x8f) { /* X 0212 first char */ - filter->status = 3; - } else { - w = c & MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 1: /* got first half */ - filter->status = 0; - c1 = filter->cache; - if (c > 0xa0 && c < 0xff) { - w = 0; - s = (c1 - 0xa1)*94 + c - 0xa1; - 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 >= (84*94)) { /* user (85ku - 94ku) */ - w = s - (84*94) + 0xe000; - } - } - if (w <= 0) { - w = ((c1 & 0x7f) << 8) | (c & 0x7f); - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_WINCP932; - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 2: /* got 0x8e, X0201 kana */ - filter->status = 0; - if (c > 0xa0 && c < 0xe0) { - w = 0xfec0 + c; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = 0x8e00 | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 3: /* got 0x8f, X 0212 first char */ - if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - filter->status = 0; - } else { - filter->status++; - filter->cache = c; - } - break; - case 4: /* got 0x8f, X 0212 second char */ - filter->status = 0; - c1 = filter->cache; - if (c1 > 0xa0 && c1 < 0xff && c > 0xa0 && c < 0xff) { - s = (c1 - 0xa1)*94 + c - 0xa1; - if (s >= 0 && s < jisx0212_ucs_table_size) { - w = jisx0212_ucs_table[s]; - } else if (s >= (82*94) && s < (84*94)) { /* vender ext3 (83ku - 84ku) <-> CP932 (115ku -120ku) */ - s = (c1<< 8) | c; - w = 0; - n = 0; - while (n < cp932ext3_eucjp_table_size) { - if (s == cp932ext3_eucjp_table[n]) { - if (n < (cp932ext3_ucs_table_max - cp932ext3_ucs_table_min)) { - w = cp932ext3_ucs_table[n]; - } - break; - } - n++; - } - } else if (s >= (84*94)) { /* user (85ku - 94ku) */ - w = s - (84*94) + (0xe000 + (94*10)); - } else { - w = 0; - } - if (w <= 0) { - w = ((c1 & 0x7f) << 8) | (c & 0x7f); - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_JIS0212; - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c | 0x8f0000; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -/* - * wchar => eucJP-win - */ -int -mbfl_filt_conv_wchar_eucjpwin(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, c2, s1; - - s1 = 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 + 10*94)) { /* user (X0208 85ku - 94ku) */ - s1 = c - 0xe000; - c1 = s1/94 + 0x75; - c2 = s1%94 + 0x21; - s1 = (c1 << 8) | c2; - } else if (c >= (0xe000 + 10*94) && c < (0xe000 + 20*94)) { /* user (X0212 85ku - 94ku) */ - s1 = c - (0xe000 + 10*94); - c1 = s1/94 + 0xf5; - c2 = s1%94 + 0xa1; - s1 = (c1 << 8) | c2; - } - if (s1 <= 0) { - c1 = c & ~MBFL_WCSPLANE_MASK; - if (c1 == MBFL_WCSPLANE_WINCP932) { - s1 = c & MBFL_WCSPLANE_MASK; - if (s1 >= ((85 + 0x20) << 8)) { /* 85ku - 120ku */ - s1 = -1; - } - } else if (c1 == MBFL_WCSPLANE_JIS0208) { - s1 = c & MBFL_WCSPLANE_MASK; - if (s1 >= ((85 + 0x20) << 8)) { /* 85ku - 94ku */ - s1 = -1; - } - } else if (c1 == MBFL_WCSPLANE_JIS0212) { - s1 = c & MBFL_WCSPLANE_MASK; - if (s1 >= ((83 + 0x20) << 8)) { /* 83ku - 94ku */ - s1 = -1; - } else { - 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; - } else { - 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 = cp932ext3_ucs_table_max - cp932ext3_ucs_table_min; - while (c1 < c2) { /* CP932 vendor ext3 (115ku - 119ku) */ - if (c == cp932ext3_ucs_table[c1]) { - if (c1 < cp932ext3_eucjp_table_size) { - s1 = cp932ext3_eucjp_table[c1]; - } - break; - } - c1++; - } - } - } - if (c == 0) { - s1 = 0; - } else if (s1 <= 0) { - s1 = -1; - } - } - - if (s1 >= 0) { - if (s1 < 0x80) { /* latin */ - CK((*filter->output_function)(s1, filter->data TSRMLS_CC)); - } else if (s1 < 0x100) { /* kana */ - CK((*filter->output_function)(0x8e, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s1, filter->data TSRMLS_CC)); - } else if (s1 < 0x8080) { /* X 0208 */ - CK((*filter->output_function)(((s1 >> 8) & 0xff) | 0x80, filter->data TSRMLS_CC)); - CK((*filter->output_function)((s1 & 0xff) | 0x80, filter->data TSRMLS_CC)); - } else { /* X 0212 */ - CK((*filter->output_function)(0x8f, filter->data TSRMLS_CC)); - CK((*filter->output_function)(((s1 >> 8) & 0xff) | 0x80, filter->data TSRMLS_CC)); - CK((*filter->output_function)((s1 & 0xff) | 0x80, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - - -/* - * SJIS => wchar - */ -int -mbfl_filt_conv_sjis_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, s1, s2, w; - - switch (filter->status) { - case 0: - if (c >= 0 && c < 0x80) { /* latin */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else if (c > 0xa0 && c < 0xe0) { /* kana */ - CK((*filter->output_function)(0xfec0 + c, filter->data TSRMLS_CC)); - } 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 TSRMLS_CC)); - } - break; - - case 1: /* kanji second char */ - filter->status = 0; - c1 = filter->cache; - if (c > 0x39 && c < 0xfd && c != 0x7f) { - SJIS_DECODE(c1, c, s1, s2); - w = (s1 - 0x21)*94 + s2 - 0x21; - if (w >= 0 && w < jisx0208_ucs_table_size) { - w = jisx0208_ucs_table[w]; - } else { - w = 0; - } - if (w <= 0) { - if (s1 < 0x7f && s2 < 0x7f) { - w = (s1 << 8) | s2; - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_JIS0208; - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - } - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -/* - * wchar => SJIS - */ -int -mbfl_filt_conv_wchar_sjis(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, c2, s1, s2; - - s1 = 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]; - } - if (s1 <= 0) { - c1 = c & ~MBFL_WCSPLANE_MASK; - if (c1 == MBFL_WCSPLANE_JIS0208) { - s1 = c & MBFL_WCSPLANE_MASK; - } 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 (c == 0) { - s1 = 0; - } else if (s1 <= 0) { - s1 = -1; - } - } else if (s1 >= 0x8080) { - s1 = -1; - } - if (s1 >= 0) { - if (s1 < 0x100) { /* latin or kana */ - CK((*filter->output_function)(s1, filter->data TSRMLS_CC)); - } else { /* kanji */ - c1 = (s1 >> 8) & 0xff; - c2 = s1 & 0xff; - SJIS_ENCODE(c1, c2, s1, s2); - CK((*filter->output_function)(s1, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s2, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - - -/* - * SJIS-win => wchar - */ -int -mbfl_filt_conv_sjiswin_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, s, s1, s2, w; - - switch (filter->status) { - case 0: - if (c >= 0 && c < 0x80) { /* latin */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else if (c > 0xa0 && c < 0xe0) { /* kana */ - CK((*filter->output_function)(0xfec0 + c, filter->data TSRMLS_CC)); - } 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 TSRMLS_CC)); - } - break; - - case 1: /* kanji second char */ - filter->status = 0; - c1 = filter->cache; - if (c > 0x39 && c < 0xfd && 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 (w <= 0) { - w = (s1 << 8) | s2; - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_WINCP932; - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -/* - * wchar => SJIS-win - */ -int -mbfl_filt_conv_wchar_sjiswin(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, c2, s1, s2; - - 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 = 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 (s1 >= 0) { - if (s1 < 0x100) { /* latin or kana */ - CK((*filter->output_function)(s1, filter->data TSRMLS_CC)); - } else { /* kanji */ - c1 = (s1 >> 8) & 0xff; - c2 = s1 & 0xff; - SJIS_ENCODE(c1, c2, s1, s2); - CK((*filter->output_function)(s1, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s2, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - - -/* - * JIS => wchar - */ -int -mbfl_filt_conv_jis_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, s, w; - -retry: - switch (filter->status & 0xf) { -/* case 0x00: ASCII */ -/* case 0x10: X 0201 latin */ -/* case 0x20: X 0201 kana */ -/* case 0x80: X 0208 */ -/* case 0x90: X 0212 */ - case 0: - if (c == 0x1b) { - filter->status += 2; - } else if (c == 0x0e) { /* "kana in" */ - filter->status = 0x20; - } else if (c == 0x0f) { /* "kana out" */ - filter->status = 0; - } else if (filter->status == 0x10 && c == 0x5c) { /* YEN SIGN */ - CK((*filter->output_function)(0xa5, filter->data TSRMLS_CC)); - } else if (filter->status == 0x10 && c == 0x7e) { /* OVER LINE */ - CK((*filter->output_function)(0x203e, filter->data TSRMLS_CC)); - } else if (filter->status == 0x20 && c > 0x20 && c < 0x60) { /* kana */ - CK((*filter->output_function)(0xff40 + c, filter->data TSRMLS_CC)); - } else if ((filter->status == 0x80 || filter->status == 0x90) && c > 0x20 && c < 0x7f) { /* kanji first char */ - filter->cache = c; - filter->status += 1; - } else if (c >= 0 && c < 0x80) { /* latin, CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else if (c > 0xa0 && c < 0xe0) { /* GR kana */ - CK((*filter->output_function)(0xfec0 + c, filter->data TSRMLS_CC)); - } else { - w = c & MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - -/* case 0x81: X 0208 second char */ -/* case 0x91: X 0212 second char */ - case 1: - filter->status &= ~0xf; - c1 = filter->cache; - if (c > 0x20 && c < 0x7f) { - s = (c1 - 0x21)*94 + c - 0x21; - if (filter->status == 0x80) { - if (s >= 0 && s < jisx0208_ucs_table_size) { - w = jisx0208_ucs_table[s]; - } else { - w = 0; - } - if (w <= 0) { - w = (c1 << 8) | c; - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_JIS0208; - } - } else { - if (s >= 0 && s < jisx0212_ucs_table_size) { - w = jisx0212_ucs_table[s]; - } else { - w = 0; - } - if (w <= 0) { - w = (c1 << 8) | c; - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_JIS0212; - } - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if (c == 0x1b) { - filter->status += 2; - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - /* ESC */ -/* case 0x02: */ -/* case 0x12: */ -/* case 0x22: */ -/* case 0x82: */ -/* case 0x92: */ - case 2: - if (c == 0x24) { /* '$' */ - filter->status++; - } else if (c == 0x28) { /* '(' */ - filter->status += 3; - } else { - filter->status &= ~0xf; - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); - goto retry; - } - break; - - /* ESC $ */ -/* case 0x03: */ -/* case 0x13: */ -/* case 0x23: */ -/* case 0x83: */ -/* case 0x93: */ - case 3: - if (c == 0x40 || c == 0x42) { /* '@' or 'B' */ - filter->status = 0x80; - } else if (c == 0x28) { /* '(' */ - filter->status++; - } else { - filter->status &= ~0xf; - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x24, filter->data TSRMLS_CC)); - goto retry; - } - break; - - /* ESC $ ( */ -/* case 0x04: */ -/* case 0x14: */ -/* case 0x24: */ -/* case 0x84: */ -/* case 0x94: */ - case 4: - if (c == 0x40 || c == 0x42) { /* '@' or 'B' */ - filter->status = 0x80; - } else if (c == 0x44) { /* 'D' */ - filter->status = 0x90; - } else { - filter->status &= ~0xf; - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x24, filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); - goto retry; - } - break; - - /* ESC ( */ -/* case 0x05: */ -/* case 0x15: */ -/* case 0x25: */ -/* case 0x85: */ -/* case 0x95: */ - case 5: - if (c == 0x42 || c == 0x48) { /* 'B' or 'H' */ - filter->status = 0; - } else if (c == 0x4a) { /* 'J' */ - filter->status = 0x10; - } else if (c == 0x49) { /* 'I' */ - filter->status = 0x20; - } else { - filter->status &= ~0xf; - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); - goto retry; - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -/* - * wchar => JIS - */ -int -mbfl_filt_conv_wchar_jis(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, s; - - s = 0; - if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) { - s = ucs_a1_jis_table[c - ucs_a1_jis_table_min]; - } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) { - s = ucs_a2_jis_table[c - ucs_a2_jis_table_min]; - } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) { - s = ucs_i_jis_table[c - ucs_i_jis_table_min]; - } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) { - s = ucs_r_jis_table[c - ucs_r_jis_table_min]; - } - if (s <= 0) { - c1 = c & ~MBFL_WCSPLANE_MASK; - if (c1 == MBFL_WCSPLANE_JIS0208) { - s = c & MBFL_WCSPLANE_MASK; - } else if (c1 == MBFL_WCSPLANE_JIS0212) { - s = c & MBFL_WCSPLANE_MASK; - s |= 0x8080; - } else if (c == 0xa5) { /* YEN SIGN */ - s = 0x1005c; - } else if (c == 0x203e) { /* OVER LINE */ - s = 0x1007e; - } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */ - s = 0x2140; - } else if (c == 0xff5e) { /* FULLWIDTH TILDE */ - s = 0x2141; - } else if (c == 0x2225) { /* PARALLEL TO */ - s = 0x2142; - } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */ - s = 0x215d; - } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */ - s = 0x2171; - } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */ - s = 0x2172; - } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */ - s = 0x224c; - } - if (c == 0) { - s = 0; - } else if (s <= 0) { - s = -1; - } - } - if (s >= 0) { - if (s < 0x80) { /* ASCII */ - if ((filter->status & 0xff00) != 0) { - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */ - CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); /* '(' */ - CK((*filter->output_function)(0x42, filter->data TSRMLS_CC)); /* 'B' */ - } - filter->status = 0; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else if (s < 0x100) { /* kana */ - if ((filter->status & 0xff00) != 0x100) { - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */ - CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); /* '(' */ - CK((*filter->output_function)(0x49, filter->data TSRMLS_CC)); /* 'I' */ - } - filter->status = 0x100; - CK((*filter->output_function)(s & 0x7f, filter->data TSRMLS_CC)); - } else if (s < 0x8080) { /* X 0208 */ - if ((filter->status & 0xff00) != 0x200) { - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */ - CK((*filter->output_function)(0x24, filter->data TSRMLS_CC)); /* '$' */ - CK((*filter->output_function)(0x42, filter->data TSRMLS_CC)); /* 'B' */ - } - filter->status = 0x200; - CK((*filter->output_function)((s >> 8) & 0x7f, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s & 0x7f, filter->data TSRMLS_CC)); - } else if (s < 0x10000) { /* X 0212 */ - if ((filter->status & 0xff00) != 0x300) { - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */ - CK((*filter->output_function)(0x24, filter->data TSRMLS_CC)); /* '$' */ - CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); /* '(' */ - CK((*filter->output_function)(0x44, filter->data TSRMLS_CC)); /* 'D' */ - } - filter->status = 0x300; - CK((*filter->output_function)((s >> 8) & 0x7f, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s & 0x7f, filter->data TSRMLS_CC)); - } else { /* X 0201 latin */ - if ((filter->status & 0xff00) != 0x400) { - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */ - CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); /* '(' */ - CK((*filter->output_function)(0x4a, filter->data TSRMLS_CC)); /* 'J' */ - } - filter->status = 0x400; - CK((*filter->output_function)(s & 0x7f, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - - -/* - * wchar => ISO-2022-JP - */ -int -mbfl_filt_conv_wchar_2022jp(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int s; - - s = 0; - if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) { - s = ucs_a1_jis_table[c - ucs_a1_jis_table_min]; - } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) { - s = ucs_a2_jis_table[c - ucs_a2_jis_table_min]; - } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) { - s = ucs_i_jis_table[c - ucs_i_jis_table_min]; - } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) { - s = ucs_r_jis_table[c - ucs_r_jis_table_min]; - } - if (s <= 0) { - if (c == 0xa5) { /* YEN SIGN */ - s = 0x1005c; - } else if (c == 0x203e) { /* OVER LINE */ - s = 0x1007e; - } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */ - s = 0x2140; - } else if (c == 0xff5e) { /* FULLWIDTH TILDE */ - s = 0x2141; - } else if (c == 0x2225) { /* PARALLEL TO */ - s = 0x2142; - } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */ - s = 0x215d; - } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */ - s = 0x2171; - } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */ - s = 0x2172; - } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */ - s = 0x224c; - } - if (c == 0) { - s = 0; - } else if (s <= 0) { - s = -1; - } - } else if ((s >= 0x80 && s < 0x2121) || (s > 0x8080)) { - s = -1; - } - if (s >= 0) { - if (s < 0x80) { /* ASCII */ - if ((filter->status & 0xff00) != 0) { - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */ - CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); /* '(' */ - CK((*filter->output_function)(0x42, filter->data TSRMLS_CC)); /* 'B' */ - } - filter->status = 0; - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else if (s < 0x10000) { /* X 0208 */ - if ((filter->status & 0xff00) != 0x200) { - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */ - CK((*filter->output_function)(0x24, filter->data TSRMLS_CC)); /* '$' */ - CK((*filter->output_function)(0x42, filter->data TSRMLS_CC)); /* 'B' */ - } - filter->status = 0x200; - CK((*filter->output_function)((s >> 8) & 0x7f, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s & 0x7f, filter->data TSRMLS_CC)); - } else { /* X 0201 latin */ - if ((filter->status & 0xff00) != 0x400) { - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */ - CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); /* '(' */ - CK((*filter->output_function)(0x4a, filter->data TSRMLS_CC)); /* 'J' */ - } - filter->status = 0x400; - CK((*filter->output_function)(s & 0x7f, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -int -mbfl_filt_conv_any_jis_flush(mbfl_convert_filter *filter TSRMLS_DC) -{ - /* back to latin */ - if ((filter->status & 0xff00) != 0) { - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */ - CK((*filter->output_function)(0x28, filter->data TSRMLS_CC)); /* '(' */ - CK((*filter->output_function)(0x42, filter->data TSRMLS_CC)); /* 'B' */ - } - filter->status &= 0xff; - return 0; -} - -#endif /* HAVE_MBSTR_JA */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/mbstring/mbfilter_ja.h b/ext/mbstring/mbfilter_ja.h deleted file mode 100644 index 5f15542d61..0000000000 --- a/ext/mbstring/mbfilter_ja.h +++ /dev/null @@ -1,98 +0,0 @@ -/* charset=UTF-8 */ - -/* - * "streamable kanji code filter and converter" - * - * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved. - * - * This software is released under the GNU Lesser General Public License. - * (Version 2.1, February 1999) - * Please read the following detail of the licence (in japanese). - * - * ◆使用許諾æ¡ä»¶â—† - * - * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•れã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ - * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•トウェアã«é–¢ - * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ - * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•トウェアを使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利 - * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•トウェアを使用 - * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - * - * ã“ã®ã‚½ãƒ•トウェアを「GNU Lesser General Public License (Version 2.1, February - * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser - * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢ - * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ - * - * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã - * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“れã¾ã§Library General - * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚ - * http://www.gnu.org/ --- GNUウェブサイト - * http://www.gnu.org/copyleft/lesser.html --- ãƒ©ã‚¤ã‚»ãƒ³ã‚¹æ–‡é¢ - * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。 - * - * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプãƒã‚¸ã‚§ã‚¯ãƒˆã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§ - * ã¯ã‚りã¾ã›ã‚“。 - * - * â—†ä¿è¨¼å†…容◆ - * - * ã“ã®ã‚½ãƒ•トウェアã¯ã€æœŸå¾…ã•れãŸå‹•作・機能・性能をæŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨è¨ˆã•れ - * 開発ã•れã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚りã¾ã›ã‚“。ã“ã®ã‚½ãƒ•トウェアã¯ã€Œã“ - * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•れã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定㮠- * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•らã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•れãŸã‚Šæš—é»™ã«ç¤ºã•れã¦ã„ - * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åйã§ã™ã€‚ã“ã®ã‚½ãƒ•トウェアを使用ã—ãŸçµæžœãªã„ã—使 - * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æå®³ - * ã€ãƒ‡ãƒ¼ã‚¿ã®æå¤±ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æå®³ã«ã¤ã„ã¦ã¯ã€ãã®æå®³ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€… - * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è¦å‘Šã•れã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æå®³ã®è³ - * 償ãŠã‚ˆã³è£œå¡«ã‚’行ã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ» - * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚ - * - * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—† - * - * 〒102-0073 - * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F - * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ - * Phone: 03-3512-3655, Fax: 03-3512-3656 - * Email: sales@happysize.co.jp - * Web: http://happysize.com/ - * - * ◆著者◆ - * - * 金本 茂 <sgk@happysize.co.jp> - * - * ◆履æ´â—† - * - * 1998/11/10 sgk implementation in C++ - * 1999/4/25 sgk Cã§æ›¸ããªãŠã—。 - * 1999/4/26 sgk 入力フィルタを実装。漢å—コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’è¿½åŠ ã€‚ - * 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚ - * 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚ - * - */ - -/* - * Unicode support - * - * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team. - * All rights reserved. - * - */ - -/* $Id$ */ - -#ifndef MBFL_MBFILTER_JA_H -#define MBFL_MBFILTER_JA_H - -int mbfl_filt_conv_eucjp_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_wchar_eucjp(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_eucjpwin_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_wchar_eucjpwin(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_sjis_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_wchar_sjis(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_sjiswin_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_wchar_sjiswin(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_jis_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_wchar_jis(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_wchar_2022jp(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_any_jis_flush(mbfl_convert_filter *filter TSRMLS_DC); - -#endif /* MBFL_MBFILTER_JA_H */ diff --git a/ext/mbstring/mbfilter_kr.c b/ext/mbstring/mbfilter_kr.c deleted file mode 100644 index 39ef127d22..0000000000 --- a/ext/mbstring/mbfilter_kr.c +++ /dev/null @@ -1,516 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Rui Hirokawa <hirokawa@php.net> | - +----------------------------------------------------------------------+ - */ - -/* - * "streamable korean code filter and converter" - */ - -/* $Id$ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_globals.h" - -#if defined(HAVE_MBSTR_KR) -#include "mbfilter.h" -#include "mbfilter_cn.h" - -#include "unicode_table_kr.h" - -#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) - - -/* - * EUC-KR => wchar - */ -int -mbfl_filt_conv_euckr_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, w, flag; - - switch (filter->status) { - case 0: - if (c >= 0 && c < 0x80) { /* latin */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else if (c > 0xa0 && c < 0xff && c != 0xc9) { /* dbcs lead byte */ - filter->status = 1; - filter->cache = c; - } else { - w = c & MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 1: /* dbcs second byte */ - filter->status = 0; - c1 = filter->cache; - flag = 0; - if (c1 >= 0xa1 && c1 <= 0xc6) { - flag = 1; - } else if (c1 >= 0xc7 && c1 <= 0xfe && c1 != 0xc9) { - flag = 2; - } - if (flag > 0 && c >= 0xa1 && c <= 0xfe) { - if (flag == 1){ /* 1st: 0xa1..0xc6, 2nd: 0x41..0x7a, 0x81..0xfe */ - w = (c1 - 0xa1)*190 + (c - 0x41); - if (w >= 0 && w < uhc2_ucs_table_size) { - w = uhc2_ucs_table[w]; - } else { - w = 0; - } - } else { /* 1st: 0xc7..0xc8,0xca..0xfe, 2nd: 0xa1..0xfe */ - w = (c1 - 0xc7)*94 + (c - 0xa1); - if (w >= 0 && w < uhc3_ucs_table_size) { - w = uhc3_ucs_table[w]; - } else { - w = 0; - } - } - - if (w <= 0) { - w = (c1 << 8) | c; - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_KSC5601; - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -/* - * wchar => EUC-KR - */ -int -mbfl_filt_conv_wchar_euckr(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, c2, s; - - s = 0; - - if (c >= ucs_a1_uhc_table_min && c < ucs_a1_uhc_table_max) { - s = ucs_a1_uhc_table[c - ucs_a1_uhc_table_min]; - } else if (c >= ucs_a2_uhc_table_min && c < ucs_a2_uhc_table_max) { - s = ucs_a2_uhc_table[c - ucs_a2_uhc_table_min]; - } else if (c >= ucs_a3_uhc_table_min && c < ucs_a3_uhc_table_max) { - s = ucs_a3_uhc_table[c - ucs_a3_uhc_table_min]; - } else if (c >= ucs_i_uhc_table_min && c < ucs_i_uhc_table_max) { - s = ucs_i_uhc_table[c - ucs_i_uhc_table_min]; - } else if (c >= ucs_s_uhc_table_min && c < ucs_s_uhc_table_max) { - s = ucs_s_uhc_table[c - ucs_s_uhc_table_min]; - } else if (c >= ucs_r1_uhc_table_min && c < ucs_r1_uhc_table_max) { - s = ucs_r1_uhc_table[c - ucs_r1_uhc_table_min]; - } else if (c >= ucs_r2_uhc_table_min && c < ucs_r2_uhc_table_max) { - s = ucs_r2_uhc_table[c - ucs_r2_uhc_table_min]; - } - - c1 = (s >> 8) & 0xff; - c2 = s & 0xff; - /* exclude UHC extension area */ - if (c1 < 0xa1 || c2 < 0xa1){ - s = c; - } - - if (s <= 0) { - c1 = c & ~MBFL_WCSPLANE_MASK; - if (c1 == MBFL_WCSPLANE_KSC5601) { - s = c & MBFL_WCSPLANE_MASK; - } - if (c == 0) { - s = 0; - } else if (s <= 0) { - s = -1; - } - } - if (s >= 0) { - if (s < 0x80) { /* latin */ - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - - -/* - * ISO-2022-KR => wchar - */ -int -mbfl_filt_conv_2022kr_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, w, flag; - -retry: - switch (filter->status & 0xf) { - /* case 0x00: ASCII */ - /* case 0x10: KSC5601 */ - case 0: - if (c == 0x1b) { /* ESC */ - filter->status += 2; - } else if (c == 0x0f) { /* SI (ASCII) */ - filter->status &= ~0xff; - } else if (c == 0x0e) { /* SO (KSC5601) */ - filter->status |= 0x10; - } else if ((filter->status & 0x10) != 0 && c > 0x20 && c < 0x7f) { - /* KSC5601 lead byte */ - filter->cache = c; - filter->status += 1; - } else if ((filter->status & 0x10) == 0 && c >= 0 && c < 0x80) { - /* latin, CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = c & MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 1: /* dbcs second byte */ - filter->status &= ~0xf; - c1 = filter->cache; - flag = 0; - if (c1 > 0x20 && c1 < 0x47) { - flag = 1; - } else if (c1 >= 0x47 && c1 <= 0x7e && c1 != 0x49) { - flag = 2; - } - if (flag > 0 && c > 0x20 && c < 0x7f) { - if (flag == 1){ - w = (c1 - 0x21)*190 + (c - 0x41) + 0x80; - if (w >= 0 && w < uhc2_ucs_table_size) { - w = uhc2_ucs_table[w]; - } else { - w = 0; - } - } else { - w = (c1 - 0x47)*94 + (c - 0x21); - if (w >= 0 && w < uhc3_ucs_table_size) { - w = uhc3_ucs_table[w]; - } else { - w = 0; - } - } - - if (w <= 0) { - w = (c1 << 8) | c; - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_KSC5601; - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if (c == 0x1b) { /* ESC */ - filter->status++; - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 2: /* ESC */ - if (c == 0x24) { /* '$' */ - filter->status++; - } else { - filter->status &= ~0xf; - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); - goto retry; - } - break; - case 3: /* ESC $ */ - if (c == 0x29) { /* ')' */ - filter->status++; - } else { - filter->status &= ~0xf; - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x24, filter->data TSRMLS_CC)); - goto retry; - } - break; - case 4: /* ESC $ ) */ - if (c == 0x43) { /* 'C' */ - filter->status &= ~0xf; - filter->status |= 0x100; - } else { - filter->status &= ~0xf; - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x24, filter->data TSRMLS_CC)); - CK((*filter->output_function)(0x29, filter->data TSRMLS_CC)); - goto retry; - } - break; - default: - filter->status = 0; - break; - } - - return c; -} - -/* - * wchar => ISO-2022-KR - */ -int -mbfl_filt_conv_wchar_2022kr(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, c2, s; - - s = 0; - - if (c >= ucs_a1_uhc_table_min && c < ucs_a1_uhc_table_max) { - s = ucs_a1_uhc_table[c - ucs_a1_uhc_table_min]; - } else if (c >= ucs_a2_uhc_table_min && c < ucs_a2_uhc_table_max) { - s = ucs_a2_uhc_table[c - ucs_a2_uhc_table_min]; - } else if (c >= ucs_a3_uhc_table_min && c < ucs_a3_uhc_table_max) { - s = ucs_a3_uhc_table[c - ucs_a3_uhc_table_min]; - } else if (c >= ucs_i_uhc_table_min && c < ucs_i_uhc_table_max) { - s = ucs_i_uhc_table[c - ucs_i_uhc_table_min]; - } else if (c >= ucs_s_uhc_table_min && c < ucs_s_uhc_table_max) { - s = ucs_s_uhc_table[c - ucs_s_uhc_table_min]; - } else if (c >= ucs_r1_uhc_table_min && c < ucs_r1_uhc_table_max) { - s = ucs_r1_uhc_table[c - ucs_r1_uhc_table_min]; - } else if (c >= ucs_r2_uhc_table_min && c < ucs_r2_uhc_table_max) { - s = ucs_r2_uhc_table[c - ucs_r2_uhc_table_min]; - } - - c1 = (s >> 8) & 0xff; - c2 = s & 0xff; - /* exclude UHC extension area */ - if (c1 < 0xa1 || c2 < 0xa1){ - s = c; - } - if (s & 0x8000) { - s -= 0x8080; - } - - if (s <= 0) { - c1 = c & ~MBFL_WCSPLANE_MASK; - if (c1 == MBFL_WCSPLANE_KSC5601) { - s = c & MBFL_WCSPLANE_MASK; - } - if (c == 0) { - s = 0; - } else if (s <= 0) { - s = -1; - } - } else if ((s >= 0x80 && s < 0x2121) || (s > 0x8080)) { - s = -1; - } - if (s >= 0) { - if (s < 0x80 && s > 0) { /* ASCII */ - if ((filter->status & 0x10) != 0) { - CK((*filter->output_function)(0x0f, filter->data TSRMLS_CC)); /* SI */ - filter->status &= ~0x10; - } - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - if ( (filter->status & 0x100) == 0) { - CK((*filter->output_function)(0x1b, filter->data TSRMLS_CC)); /* ESC */ - CK((*filter->output_function)(0x24, filter->data TSRMLS_CC)); /* '$' */ - CK((*filter->output_function)(0x29, filter->data TSRMLS_CC)); /* ')' */ - CK((*filter->output_function)(0x43, filter->data TSRMLS_CC)); /* 'C' */ - filter->status |= 0x100; - } - if ((filter->status & 0x10) == 0) { - CK((*filter->output_function)(0x0e, filter->data TSRMLS_CC)); /* SO */ - filter->status |= 0x10; - } - CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -/* - * UHC => wchar - */ -int -mbfl_filt_conv_uhc_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, w = 0, flag = 0; - - switch (filter->status) { - case 0: - if (c >= 0 && c < 0x80) { /* latin */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else if (c > 0x80 && c < 0xff && c != 0xc9) { /* dbcs lead byte */ - filter->status = 1; - filter->cache = c; - } else { - w = c & MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 1: /* dbcs second byte */ - filter->status = 0; - c1 = filter->cache; - if ( c1 >= 0x81 && c1 <= 0xa0){ - w = (c1 - 0x81)*190 + (c - 0x41); - if (w >= 0 && w < uhc1_ucs_table_size) { - flag = 1; - w = uhc1_ucs_table[w]; - } else { - w = 0; - } - } else if ( c1 >= 0xa1 && c1 <= 0xc6){ - w = (c1 - 0xa1)*190 + (c - 0x41); - if (w >= 0 && w < uhc2_ucs_table_size) { - flag = 2; - w = uhc2_ucs_table[w]; - } else { - w = 0; - } - } else if ( c1 >= 0xc7 && c1 <= 0xfe){ - w = (c1 - 0xc7)*94 + (c - 0xa1); - if (w >= 0 && w < uhc3_ucs_table_size) { - flag = 3; - w = uhc3_ucs_table[w]; - } else { - w = 0; - } - } - if (flag > 0){ - if (w <= 0) { - w = (c1 << 8) | c; - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_UHC; - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else { - if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -/* - * wchar => UHC - */ -int -mbfl_filt_conv_wchar_uhc(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, s; - - s = 0; - if (c >= ucs_a1_uhc_table_min && c < ucs_a1_uhc_table_max) { - s = ucs_a1_uhc_table[c - ucs_a1_uhc_table_min]; - } else if (c >= ucs_a2_uhc_table_min && c < ucs_a2_uhc_table_max) { - s = ucs_a2_uhc_table[c - ucs_a2_uhc_table_min]; - } else if (c >= ucs_a3_uhc_table_min && c < ucs_a3_uhc_table_max) { - s = ucs_a3_uhc_table[c - ucs_a3_uhc_table_min]; - } else if (c >= ucs_i_uhc_table_min && c < ucs_i_uhc_table_max) { - s = ucs_i_uhc_table[c - ucs_i_uhc_table_min]; - } else if (c >= ucs_s_uhc_table_min && c < ucs_s_uhc_table_max) { - s = ucs_s_uhc_table[c - ucs_s_uhc_table_min]; - } else if (c >= ucs_r1_uhc_table_min && c < ucs_r1_uhc_table_max) { - s = ucs_r1_uhc_table[c - ucs_r1_uhc_table_min]; - } else if (c >= ucs_r2_uhc_table_min && c < ucs_r2_uhc_table_max) { - s = ucs_r2_uhc_table[c - ucs_r2_uhc_table_min]; - } - if (s <= 0) { - c1 = c & ~MBFL_WCSPLANE_MASK; - if (c1 == MBFL_WCSPLANE_UHC) { - s = c & MBFL_WCSPLANE_MASK; - } - if (c == 0) { - s = 0; - } else if (s <= 0) { - s = -1; - } - } - if (s >= 0) { - if (s < 0x80) { /* latin */ - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -int -mbfl_filt_conv_any_2022kr_flush(mbfl_convert_filter *filter TSRMLS_DC) -{ - /* back to ascii */ - if ((filter->status & 0xff00) != 0) { - CK((*filter->output_function)(0x0f, filter->data TSRMLS_CC)); /* SI */ - } - filter->status &= 0xff; - return 0; -} - -#endif /* HAVE_MBSTR_KR */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/mbstring/mbfilter_kr.h b/ext/mbstring/mbfilter_kr.h deleted file mode 100644 index 9178360e62..0000000000 --- a/ext/mbstring/mbfilter_kr.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Rui Hirokawa <hirokawa@php.net> | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef MBFL_MBFILTER_KR_H -#define MBFL_MBFILTER_KR_H - -int mbfl_filt_conv_euckr_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_wchar_euckr(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_uhc_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_wchar_uhc(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_2022kr_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_wchar_2022kr(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_any_2022kr_flush(mbfl_convert_filter *filter TSRMLS_DC); - -#endif /* MBFL_MBFILTER_KR_H */ diff --git a/ext/mbstring/mbfilter_tw.c b/ext/mbstring/mbfilter_tw.c deleted file mode 100644 index a98a3d7fbb..0000000000 --- a/ext/mbstring/mbfilter_tw.c +++ /dev/null @@ -1,337 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Rui Hirokawa <hirokawa@php.net> | - +----------------------------------------------------------------------+ - */ - -/* - * "streamable traditional chinese code filter and converter" - */ - -/* $Id$ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_globals.h" - -#if defined(HAVE_MBSTR_TW) -#include "mbfilter.h" -#include "mbfilter_tw.h" - -#include "unicode_table_tw.h" - -#define CK(statement) do { if ((statement) < 0) return (-1); } while (0) - -/* - * EUC-TW => wchar - */ -int -mbfl_filt_conv_euctw_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, s, w, plane; - - switch (filter->status) { - case 0: - if (c >= 0 && c < 0x80) { /* latin */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else if (c > 0xa0 && c < 0xff) { /* dbcs first byte */ - filter->status = 1; - filter->cache = c; - } else if (c == 0x8e) { /* mbcs first byte */ - filter->status = 2; - filter->cache = c; - } else { - w = c & MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 1: /* mbcs second byte */ - filter->status = 0; - c1 = filter->cache; - if (c > 0xa0 && c < 0xff) { - w = (c1 - 0xa1)*94 + (c - 0xa1); - if (w >= 0 && w < cns11643_1_ucs_table_size) { - w = cns11643_1_ucs_table[w]; - } else { - w = 0; - } - if (w <= 0) { - w = (c1 << 8) | c; - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_CNS11643; - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 2: /* got 0x8e, first char */ - c1 = filter->cache; - if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - filter->status = 0; - } else if (c > 0xa0 && c < 0xaf) { - filter->status = 3; - filter->cache = c - 0xa1; - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 3: /* got 0x8e, third char */ - filter->status = 0; - c1 = filter->cache; - if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - filter->status = 0; - } else if (c > 0xa0 && c < 0xff) { - filter->status = 4; - filter->cache = (c1 << 8) + c - 0xa1; - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 4: /* mbcs fourth char */ - filter->status = 0; - c1 = filter->cache; - if (c1 >= 0x100 && c1 <= 0xdff && c > 0xa0 && c < 0xff) { - plane = (c1 & 0xf00) >> 8; - s = (c1 & 0xff)*94 + c - 0xa1; - w = 0; - if (s >= 0) { - if (plane == 1 && s < cns11643_2_ucs_table_size) { - w = cns11643_2_ucs_table[s]; - } - if (plane == 13 && s < cns11643_14_ucs_table_size) { - w = cns11643_14_ucs_table[s]; - } - } - if (w <= 0) { - w = ((c1 & 0x7f) << 8) | (c & 0x7f); - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_CNS11643; - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c | 0x8e0000; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -/* - * wchar => EUC-TW - */ -int -mbfl_filt_conv_wchar_euctw(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, s, plane; - - s = 0; - if (c >= ucs_a1_cns11643_table_min && c < ucs_a1_cns11643_table_max) { - s = ucs_a1_cns11643_table[c - ucs_a1_cns11643_table_min]; - } else if (c >= ucs_a2_cns11643_table_min && c < ucs_a2_cns11643_table_max) { - s = ucs_a2_cns11643_table[c - ucs_a2_cns11643_table_min]; - } else if (c >= ucs_a3_cns11643_table_min && c < ucs_a3_cns11643_table_max) { - s = ucs_a3_cns11643_table[c - ucs_a3_cns11643_table_min]; - } else if (c >= ucs_i_cns11643_table_min && c < ucs_i_cns11643_table_max) { - s = ucs_i_cns11643_table[c - ucs_i_cns11643_table_min]; - } else if (c >= ucs_r_cns11643_table_min && c < ucs_r_cns11643_table_max) { - s = ucs_r_cns11643_table[c - ucs_r_cns11643_table_min]; - } - if (s <= 0) { - c1 = c & ~MBFL_WCSPLANE_MASK; - if (c1 == MBFL_WCSPLANE_CNS11643) { - s = c & MBFL_WCSPLANE_MASK; - } - if (c == 0) { - s = 0; - } else if (s <= 0) { - s = -1; - } - } - if (s >= 0) { - plane = (s & 0x1f0000) >> 16; - if (plane <= 1){ - if (s < 0x80) { /* latin */ - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - s = (s & 0xffff) | 0x8080; - CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC)); - } - } else { - s = (0x8ea00000 + (plane << 16)) | ((s & 0xffff) | 0x8080); - CK((*filter->output_function)(0x8e , filter->data TSRMLS_CC)); - CK((*filter->output_function)((s >> 16) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - return c; -} - -/* - * Big5 => wchar - */ -int -mbfl_filt_conv_big5_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, w; - - switch (filter->status) { - case 0: - if (c >= 0 && c < 0x80) { /* latin */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else if (c > 0xa0 && c < 0xff) { /* dbcs lead byte */ - filter->status = 1; - filter->cache = c; - } else { - w = c & MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - case 1: /* dbcs second byte */ - filter->status = 0; - c1 = filter->cache; - if ((c > 0x39 && c < 0x7f) | (c > 0xa0 && c < 0xff)) { - if (c < 0x7f){ - w = (c1 - 0xa1)*157 + (c - 0x40); - } else { - w = (c1 - 0xa1)*157 + (c - 0xa1) + 0x3f; - } - if (w >= 0 && w < big5_ucs_table_size) { - w = big5_ucs_table[w]; - } else { - w = 0; - } - if (w <= 0) { - w = (c1 << 8) | c; - w &= MBFL_WCSPLANE_MASK; - w |= MBFL_WCSPLANE_BIG5; - } - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */ - CK((*filter->output_function)(c, filter->data TSRMLS_CC)); - } else { - w = (c1 << 8) | c; - w &= MBFL_WCSGROUP_MASK; - w |= MBFL_WCSGROUP_THROUGH; - CK((*filter->output_function)(w, filter->data TSRMLS_CC)); - } - break; - - default: - filter->status = 0; - break; - } - - return c; -} - -/* - * wchar => Big5 - */ -int -mbfl_filt_conv_wchar_big5(int c, mbfl_convert_filter *filter TSRMLS_DC) -{ - int c1, s; - - s = 0; - if (c >= ucs_a1_big5_table_min && c < ucs_a1_big5_table_max) { - s = ucs_a1_big5_table[c - ucs_a1_big5_table_min]; - } else if (c >= ucs_a2_big5_table_min && c < ucs_a2_big5_table_max) { - s = ucs_a2_big5_table[c - ucs_a2_big5_table_min]; - } else if (c >= ucs_a3_big5_table_min && c < ucs_a3_big5_table_max) { - s = ucs_a3_big5_table[c - ucs_a3_big5_table_min]; - } else if (c >= ucs_i_big5_table_min && c < ucs_i_big5_table_max) { - s = ucs_i_big5_table[c - ucs_i_big5_table_min]; - } else if (c >= ucs_pua_big5_table_min && c < ucs_pua_big5_table_max) { - s = ucs_pua_big5_table[c - ucs_pua_big5_table_min]; - } else if (c >= ucs_r1_big5_table_min && c < ucs_r1_big5_table_max) { - s = ucs_r1_big5_table[c - ucs_r1_big5_table_min]; - } else if (c >= ucs_r2_big5_table_min && c < ucs_r2_big5_table_max) { - s = ucs_r2_big5_table[c - ucs_r2_big5_table_min]; - } - if (s <= 0) { - c1 = c & ~MBFL_WCSPLANE_MASK; - if (c1 == MBFL_WCSPLANE_BIG5) { - s = c & MBFL_WCSPLANE_MASK; - } - if (c == 0) { - s = 0; - } else if (s <= 0) { - s = -1; - } - } - if (s >= 0) { - if (s < 0x80) { /* latin */ - CK((*filter->output_function)(s, filter->data TSRMLS_CC)); - } else { - CK((*filter->output_function)((s >> 8) & 0xff, filter->data TSRMLS_CC)); - CK((*filter->output_function)(s & 0xff, filter->data TSRMLS_CC)); - } - } else { - if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - CK(mbfl_filt_conv_illegal_output(c, filter TSRMLS_CC)); - } - } - - return c; -} - -#endif /* HAVE_MBSTR_TW */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/mbstring/mbfilter_tw.h b/ext/mbstring/mbfilter_tw.h deleted file mode 100644 index 00ccefb32a..0000000000 --- a/ext/mbstring/mbfilter_tw.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Rui Hirokawa <hirokawa@php.net> | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef MBFL_MBFILTER_TW_H -#define MBFL_MBFILTER_TW_H - -int mbfl_filt_conv_euctw_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_wchar_euctw(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_big5_wchar(int c, mbfl_convert_filter *filter TSRMLS_DC); -int mbfl_filt_conv_wchar_big5(int c, mbfl_convert_filter *filter TSRMLS_DC); - -#endif /* MBFL_MBFILTER_TW_H */ diff --git a/ext/mbstring/mbregex.c b/ext/mbstring/mbregex.c deleted file mode 100644 index 1e6c6effc1..0000000000 --- a/ext/mbstring/mbregex.c +++ /dev/null @@ -1,4712 +0,0 @@ -/* Extended regular expression matching and search library. - Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ -/* Multi-byte extension added May, 1993 by t^2 (Takahiro Tanimoto) - Last change: May 21, 1993 by t^2 */ -/* removed gapped buffer support, multiple syntax support by matz <matz@nts.co.jp> */ -/* Perl5 extension added by matz <matz@caelum.co.jp> */ -/* UTF-8 extension added Jan 16 1999 by Yoshida Masato <yoshidam@tau.bekkoame.ne.jp> */ - -#include "php.h" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#if HAVE_MBREGEX - -#define re_compile_pattern mbre_compile_pattern -#define re_free_pattern mbre_free_pattern -#define re_adjust_startpos mbre_adjust_startpos -#define re_compile_fastmap mbre_compile_fastmap -#define re_search mbre_search -#define re_match mbre_match -#define re_set_casetable mbre_set_casetable -#define re_copy_registers mbre_copy_registers -#define re_free_registers mbre_free_registers - -#ifdef HAVE_STRING_H -# include <string.h> -#else -# include <strings.h> -#endif - -/* We write fatal error messages on standard error. */ -#include <stdio.h> - -/* isalpha(3) etc. are used for the character classes. */ -#include <ctype.h> -#include <sys/types.h> - -#ifndef PARAMS -# if defined __GNUC__ || (defined __STDC__ && __STDC__) -# define PARAMS(args) args -# else -# define PARAMS(args) () -# endif /* GCC. */ -#endif /* Not PARAMS. */ - -#if defined(STDC_HEADERS) -# include <stddef.h> -#else -/* We need this for `regex.h', and perhaps for the Emacs include files. */ -# include <sys/types.h> -#endif - -#ifndef __STDC__ -# define volatile -#endif - -#ifdef HAVE_PROTOTYPES -# define _(args) args -#else -# define _(args) () -#endif - -#ifdef RUBY_PLATFORM -#include "defines.h" - -# define RUBY -extern int rb_prohibit_interrupt; -extern int rb_trap_pending; -void rb_trap_exec _((void)); - -# define CHECK_INTS if (!rb_prohibit_interrupt) {\ - if (rb_trap_pending) rb_trap_exec();\ -} - -#define xmalloc ruby_xmalloc -#define xcalloc ruby_xcalloc -#define xrealloc ruby_xrealloc -#define xfree ruby_xfree - -void *xmalloc _((size_t)); -void *xcalloc _((size_t,size_t)); -void *xrealloc _((void*,size_t)); -void xfree _((void*)); -#endif - - -#define xmalloc emalloc -#define xcalloc ecalloc -#define xrealloc erealloc -#define xfree efree - - -/* Make alloca work the best possible way. */ -#ifdef __GNUC__ -# ifndef atarist -# ifndef alloca -# define alloca __builtin_alloca -# endif -# endif /* atarist */ -#else -# if defined(HAVE_ALLOCA_H) -# include <alloca.h> -# elif !defined(alloca) -char *alloca(); -# endif -#endif /* __GNUC__ */ - -#ifdef _AIX -#pragma alloca -#endif - -#ifdef HAVE_STRING_H -# include <string.h> -#else -# include <strings.h> -#endif - -#ifdef C_ALLOCA -#define FREE_VARIABLES() alloca(0) -#else -#define FREE_VARIABLES() -#endif - -#define FREE_AND_RETURN_VOID(stackb) do { \ - FREE_VARIABLES(); \ - if (stackb != stacka) xfree(stackb); \ - return; \ -} while(0) - -#define FREE_AND_RETURN(stackb,val) do { \ - FREE_VARIABLES(); \ - if (stackb != stacka) xfree(stackb); \ - return(val); \ -} while(0) - -#define DOUBLE_STACK(type) do { \ - type *stackx; \ - unsigned int xlen = stacke - stackb; \ - if (stackb == stacka) { \ - stackx = (type*)xmalloc(2 * xlen * sizeof(type)); \ - memcpy(stackx, stackb, xlen * sizeof (type)); \ - } \ - else { \ - stackx = (type*)xrealloc(stackb, 2 * xlen * sizeof(type)); \ - } \ - /* Rearrange the pointers. */ \ - stackp = stackx + (stackp - stackb); \ - stackb = stackx; \ - stacke = stackb + 2 * xlen; \ -} while (0) - -#define RE_TALLOC(n,t) ((t*)alloca((n)*sizeof(t))) -#define TMALLOC(n,t) ((t*)xmalloc((n)*sizeof(t))) -#define TREALLOC(s,n,t) (s=((t*)xrealloc(s,(n)*sizeof(t)))) - -#define EXPAND_FAIL_STACK() DOUBLE_STACK(unsigned char*) -#define ENSURE_FAIL_STACK(n) \ - do { \ - if (stacke - stackp <= (n)) { \ - /* if (len > re_max_failures * MAX_NUM_FAILURE_ITEMS) \ - { \ - FREE_AND_RETURN(stackb,(-2)); \ - }*/ \ - \ - /* Roughly double the size of the stack. */ \ - EXPAND_FAIL_STACK(); \ - } \ - } while (0) - -/* Get the interface, including the syntax bits. */ -#include "mbregex.h" - -/* Subroutines for re_compile_pattern. */ -static void store_jump _((char*, int, char*)); -static void insert_jump _((int, char*, char*, char*)); -static void store_jump_n _((char*, int, char*, unsigned)); -static void insert_jump_n _((int, char*, char*, char*, unsigned)); -#if 0 -static void insert_op _((int, char*, char*)); -#endif -static void insert_op_2 _((int, char*, char*, int, int)); -static int memcmp_translate _((unsigned char*, unsigned char*, int, const unsigned char*)); -static const unsigned char* re_mbctab_get _((int)); - -/* Define the syntax stuff, so we can do the \<, \>, etc. */ - -/* This must be nonzero for the wordchar and notwordchar pattern - commands in re_match. */ -#define Sword 1 -#define Sword2 2 - -#define SYNTAX(c) re_syntax_table[c] - -static const char casetable[] = { - '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', - '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', - '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', - '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', - /* ' ' '!' '"' '#' '$' '%' '&' ''' */ - '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', - /* '(' ')' '*' '+' ',' '-' '.' '/' */ - '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', - /* '0' '1' '2' '3' '4' '5' '6' '7' */ - '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', - /* '8' '9' ':' ';' '<' '=' '>' '?' */ - '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', - /* '@' 'A' 'B' 'C' 'D' 'E' 'F' 'G' */ - '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - /* 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' */ - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - /* 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' */ - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - /* 'X' 'Y' 'Z' '[' '\' ']' '^' '_' */ - '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', - /* '`' 'a' 'b' 'c' 'd' 'e' 'f' 'g' */ - '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - /* 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' */ - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - /* 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' */ - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - /* 'x' 'y' 'z' '{' '|' '}' '~' */ - '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', - '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', - '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', - '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', - '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', - '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', - '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', - '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', - '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', - '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', - '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', - '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', - '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', - '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', -}; - -static char re_syntax_table[256]; -static void init_syntax_once _((void)); -static const unsigned char *translate = (const unsigned char*)casetable; -static void init_regs _((struct mbre_registers*, unsigned int)); -static void bm_init_skip _((int *, unsigned char*, int, const unsigned char*)); -#if 0 -static int current_mbctype = MBCTYPE_ASCII; -#endif - -#undef P - -static unsigned long -scan_oct(start, len, retlen) -const char *start; -int len; -int *retlen; -{ - register const char *s = start; - register unsigned long retval = 0; - - while (len-- && *s >= '0' && *s <= '7') { - retval <<= 3; - retval |= *s++ - '0'; - } - *retlen = s - start; - return retval; -} - -static unsigned long -scan_hex(start, len, retlen) -const char *start; -int len; -int *retlen; -{ - static char hexdigit[] = "0123456789abcdef0123456789ABCDEFx"; - register const char *s = start; - register unsigned long retval = 0; - char *tmp; - - while (len-- && *s && (tmp = strchr(hexdigit, *s))) { - retval <<= 4; - retval |= (tmp - hexdigit) & 15; - s++; - } - *retlen = s - start; - return retval; -} - -#define rt re_syntax_table -static void -init_syntax_once() -{ - register int c; - static int done = 0; - -#ifdef ZTS - extern MUTEX_T mbregex_locale_mutex; -#endif - - if (done) { - return; - } -#ifdef ZTS - tsrm_mutex_lock( mbregex_locale_mutex ); -#endif - - memset(re_syntax_table, 0, sizeof(re_syntax_table)); - - for (c=0; c<=0x7f; c++) { - if (isalnum(c)) { - re_syntax_table[c] = Sword; - } - } - re_syntax_table['_'] = Sword; - - for (c=0x80; c<=0xff; c++) { - if (isalnum(c)) { - re_syntax_table[c] = Sword2; - } - } -#ifdef ZTS - tsrm_mutex_unlock( mbregex_locale_mutex ); -#endif - done = 1; -} - -void -re_set_casetable(table) - const char *table; -{ - translate = (const unsigned char*)table; -} - -/* Jim Meyering writes: - - "... Some ctype macros are valid only for character codes that - isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when - using /bin/cc or gcc but without giving an ansi option). So, all - ctype uses should be through macros like ISPRINT... If - STDC_HEADERS is defined, then autoconf has verified that the ctype - macros don't need to be guarded with references to isascii. ... - Defining isascii to 1 should let any compiler worth its salt - eliminate the && through constant folding." - Solaris defines some of these symbols so we must undefine them first. */ - -#undef ISASCII -#if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII) -# define ISASCII(c) 1 -#else -# define ISASCII(c) isascii(c) -#endif - -#ifdef isblank -# define ISBLANK(c) (ISASCII(c) && isblank(c)) -#else -# define ISBLANK(c) ((c) == ' ' || (c) == '\t') -#endif -#ifdef isgraph -# define ISGRAPH(c) (ISASCII(c) && isgraph(c)) -#else -# define ISGRAPH(c) (ISASCII(c) && isprint(c) && !isspace(c)) -#endif - -#undef ISPRINT -#define ISPRINT(c) (ISASCII(c) && isprint(c)) -#define ISDIGIT(c) (ISASCII(c) && isdigit(c)) -#define ISALNUM(c) (ISASCII(c) && isalnum(c)) -#define ISALPHA(c) (ISASCII(c) && isalpha(c)) -#define ISCNTRL(c) (ISASCII(c) && iscntrl(c)) -#define ISLOWER(c) (ISASCII(c) && islower(c)) -#define ISPUNCT(c) (ISASCII(c) && ispunct(c)) -#define ISSPACE(c) (ISASCII(c) && isspace(c)) -#define ISUPPER(c) (ISASCII(c) && isupper(c)) -#define ISXDIGIT(c) (ISASCII(c) && isxdigit(c)) - -#ifndef NULL -# define NULL (void *)0 -#endif - -/* We remove any previous definition of `SIGN_EXTEND_CHAR', - since ours (we hope) works properly with all combinations of - machines, compilers, `char' and `unsigned char' argument types. - (Per Bothner suggested the basic approach.) */ -#undef SIGN_EXTEND_CHAR -#if __STDC__ -# define SIGN_EXTEND_CHAR(c) ((signed char)(c)) -#else /* not __STDC__ */ -/* As in Harbison and Steele. */ -# define SIGN_EXTEND_CHAR(c) ((((unsigned char)(c)) ^ 128) - 128) -#endif - -/* These are the command codes that appear in compiled regular - expressions, one per byte. Some command codes are followed by - argument bytes. A command code can specify any interpretation - whatsoever for its arguments. Zero-bytes may appear in the compiled - regular expression. - - The value of `exactn' is needed in search.c (search_buffer) in emacs. - So regex.h defines a symbol `RE_EXACTN_VALUE' to be 1; the value of - `exactn' we use here must also be 1. */ - -enum regexpcode - { - unused=0, - exactn=1, /* Followed by one byte giving n, then by n literal bytes. */ - begline, /* Fail unless at beginning of line. */ - endline, /* Fail unless at end of line. */ - begbuf, /* Succeeds if at beginning of buffer (if emacs) or at beginning - of string to be matched (if not). */ - endbuf, /* Analogously, for end of buffer/string. */ - endbuf2, /* End of buffer/string, or newline just before it. */ - begpos, /* Matches where last scan//gsub left off. */ - jump, /* Followed by two bytes giving relative address to jump to. */ - jump_past_alt,/* Same as jump, but marks the end of an alternative. */ - on_failure_jump, /* Followed by two bytes giving relative address of - place to resume at in case of failure. */ - finalize_jump, /* Throw away latest failure point and then jump to - address. */ - maybe_finalize_jump, /* Like jump but finalize if safe to do so. - This is used to jump back to the beginning - of a repeat. If the command that follows - this jump is clearly incompatible with the - one at the beginning of the repeat, such that - we can be sure that there is no use backtracking - out of repetitions already completed, - then we finalize. */ - dummy_failure_jump, /* Jump, and push a dummy failure point. This - failure point will be thrown away if an attempt - is made to use it for a failure. A + construct - makes this before the first repeat. Also - use it as an intermediary kind of jump when - compiling an or construct. */ - push_dummy_failure, /* Push a dummy failure point and continue. Used at the end of - alternatives. */ - succeed_n, /* Used like on_failure_jump except has to succeed n times; - then gets turned into an on_failure_jump. The relative - address following it is useless until then. The - address is followed by two bytes containing n. */ - jump_n, /* Similar to jump, but jump n times only; also the relative - address following is in turn followed by yet two more bytes - containing n. */ - try_next, /* Jump to next pattern for the first time, - leaving this pattern on the failure stack. */ - finalize_push, /* Finalize stack and push the beginning of the pattern - on the stack to retry (used for non-greedy match) */ - finalize_push_n, /* Similar to finalize_push, buf finalize n time only */ - set_number_at, /* Set the following relative location to the - subsequent number. */ - anychar, /* Matches any (more or less) one character excluding newlines. */ - anychar_repeat, /* Matches sequence of characters excluding newlines. */ - charset, /* Matches any one char belonging to specified set. - First following byte is number of bitmap bytes. - Then come bytes for a bitmap saying which chars are in. - Bits in each byte are ordered low-bit-first. - A character is in the set if its bit is 1. - A character too large to have a bit in the map - is automatically not in the set. */ - charset_not, /* Same parameters as charset, but match any character - that is not one of those specified. */ - start_memory, /* Start remembering the text that is matched, for - storing in a memory register. Followed by one - byte containing the register number. Register numbers - must be in the range 0 through MBRE_NREGS. */ - stop_memory, /* Stop remembering the text that is matched - and store it in a memory register. Followed by - one byte containing the register number. Register - numbers must be in the range 0 through MBRE_NREGS. */ - start_paren, /* Place holder at the start of (?:..). */ - stop_paren, /* Place holder at the end of (?:..). */ - casefold_on, /* Turn on casefold flag. */ - casefold_off, /* Turn off casefold flag. */ - option_set, /* Turn on multi line match (match with newlines). */ - start_nowidth, /* Save string point to the stack. */ - stop_nowidth, /* Restore string place at the point start_nowidth. */ - pop_and_fail, /* Fail after popping nowidth entry from stack. */ - stop_backtrack, /* Restore backtrack stack at the point start_nowidth. */ - duplicate, /* Match a duplicate of something remembered. - Followed by one byte containing the index of the memory - register. */ - fail, /* always fails. */ - wordchar, /* Matches any word-constituent character. */ - notwordchar, /* Matches any char that is not a word-constituent. */ - wordbeg, /* Succeeds if at word beginning. */ - wordend, /* Succeeds if at word end. */ - wordbound, /* Succeeds if at a word boundary. */ - notwordbound /* Succeeds if not at a word boundary. */ - }; - - -/* Number of failure points to allocate space for initially, - when matching. If this number is exceeded, more space is allocated, - so it is not a hard limit. */ - -#ifndef NFAILURES -#define NFAILURES 160 -#endif - -/* Store NUMBER in two contiguous bytes starting at DESTINATION. */ -#define STORE_NUMBER(destination, number) \ - do { (destination)[0] = (number) & 0377; \ - (destination)[1] = (number) >> 8; } while (0) - -/* Same as STORE_NUMBER, except increment the destination pointer to - the byte after where the number is stored. Watch out that values for - DESTINATION such as p + 1 won't work, whereas p will. */ -#define STORE_NUMBER_AND_INCR(destination, number) \ - do { STORE_NUMBER(destination, number); \ - (destination) += 2; } while (0) - - -/* Put into DESTINATION a number stored in two contingous bytes starting - at SOURCE. */ -#define EXTRACT_NUMBER(destination, source) \ - do { (destination) = *(source) & 0377; \ - (destination) += SIGN_EXTEND_CHAR(*(char*)((source) + 1)) << 8; } while (0) - -/* Same as EXTRACT_NUMBER, except increment the pointer for source to - point to second byte of SOURCE. Note that SOURCE has to be a value - such as p, not, e.g., p + 1. */ -#define EXTRACT_NUMBER_AND_INCR(destination, source) \ - do { EXTRACT_NUMBER(destination, source); \ - (source) += 2; } while (0) - - -/* Specify the precise syntax of regexps for compilation. This provides - for compatibility for various utilities which historically have - different, incompatible syntaxes. - - The argument SYNTAX is a bit-mask comprised of the various bits - defined in regex.h. */ -#if 0 -long -re_set_syntax(syntax) - long syntax; -{ - /* obsolete */ - return 0; -} -#endif - -/* Macros for re_compile_pattern, which is found below these definitions. */ - -#define TRANSLATE_P() ((options&MBRE_OPTION_IGNORECASE) && translate) -#define MAY_TRANSLATE() ((bufp->options&(MBRE_OPTION_IGNORECASE|MBRE_MAY_IGNORECASE)) && translate) -/* Fetch the next character in the uncompiled pattern---translating it - if necessary. Also cast from a signed character in the constant - string passed to us by the user to an unsigned char that we can use - as an array index (in, e.g., `translate'). */ -#define PATFETCH(c) \ - do {if (p == pend) goto end_of_pattern; \ - c = (unsigned char) *p++; \ - if (TRANSLATE_P()) c = (unsigned char)translate[c]; \ - } while (0) - -/* Fetch the next character in the uncompiled pattern, with no - translation. */ -#define PATFETCH_RAW(c) \ - do {if (p == pend) goto end_of_pattern; \ - c = (unsigned char)*p++; \ - } while (0) - -/* Go backwards one character in the pattern. */ -#define PATUNFETCH p-- - -#define MBC2WC(c, p) \ - do { \ - if (current_mbctype == MBCTYPE_UTF8) { \ - int n = mbclen(c) - 1; \ - c &= (1<<(MBRE_BYTEWIDTH-2-n)) - 1; \ - while (n--) { \ - c = c << 6 | (*p++ & ((1<<6)-1)); \ - } \ - } \ - else { \ - c <<= 8; \ - c |= (unsigned char)*(p)++; \ - } \ - } while (0) - -#define PATFETCH_MBC(c) \ - do { \ - if (p + mbclen(c) - 1 >= pend) goto end_of_pattern; \ - MBC2WC(c, p); \ - } while(0) - -#define WC2MBC1ST(c) \ - ((c<0x100)?(c):((current_mbctype != MBCTYPE_UTF8)?(((c)>>8)&0xff):utf8_firstbyte(c))) - -static unsigned int -utf8_firstbyte(c) - unsigned long c; -{ - if (c < 0x80) return c; - if (c <= 0x7ff) return ((c>>6)&0xff)|0xc0; - if (c <= 0xffff) return ((c>>12)&0xff)|0xe0; - if (c <= 0x1fffff) return ((c>>18)&0xff)|0xf0; - if (c <= 0x3ffffff) return ((c>>24)&0xff)|0xf8; - if (c <= 0x7fffffff) return ((c>>30)&0xff)|0xfc; -#if SIZEOF_INT > 4 - if (c <= 0xfffffffff) return 0xfe; -#else - return 0xfe; -#endif -} - -#if 0 -static void -print_mbc(c) - unsigned int c; -{ - if (current_mbctype == MBCTYPE_UTF8) { - if (c < 0x80) - printf("%c", c); - else if (c <= 0x7ff) - printf("%c%c", utf8_firstbyte(c), c&0x3f); - else if (c <= 0xffff) - printf("%c%c%c", utf8_firstbyte(c), (c>>6)&0x3f, c&0x3f); - else if (c <= 0x1fffff) - printf("%c%c%c%c", utf8_firstbyte(c), (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f); - else if (c <= 0x3ffffff) - printf("%c%c%c%c%c", utf8_firstbyte(c), (c>>18)&0x3f, (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f); - else if (c <= 0x7fffffff) - printf("%c%c%c%c%c%c", utf8_firstbyte(c), (c>>24)&0x3f, (c>>18)&0x3f, (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f); - } - else if (c < 0xff) { - printf("\\%o", c); - } - else { - printf("%c%c", c>>MBRE_BYTEWIDTH, c&0xff); - } -} -#endif - -/* If the buffer isn't allocated when it comes in, use this. */ -#define INIT_BUF_SIZE 28 - -/* Make sure we have at least N more bytes of space in buffer. */ -#define GET_BUFFER_SPACE(n) \ - do { \ - while (b - bufp->buffer + (size_t)(n) >= (size_t)bufp->allocated) \ - EXTEND_BUFFER; \ - } while (0) - -/* Make sure we have one more byte of buffer space and then add CH to it. */ -#define BUFPUSH(ch) \ - do { \ - GET_BUFFER_SPACE(1); \ - *b++ = (char)(ch); \ - } while (0) - -/* Extend the buffer by twice its current size via reallociation and - reset the pointers that pointed into the old allocation to point to - the correct places in the new allocation. If extending the buffer - results in it being larger than 1 << 16, then flag memory exhausted. */ -#define EXTEND_BUFFER \ - do { char *old_buffer = bufp->buffer; \ - if (bufp->allocated == (1L<<16)) goto too_big; \ - bufp->allocated *= 2; \ - if (bufp->allocated > (1L<<16)) bufp->allocated = (1L<<16); \ - bufp->buffer = (char*)xrealloc(bufp->buffer, bufp->allocated); \ - if (bufp->buffer == 0) \ - goto memory_exhausted; \ - b = (b - old_buffer) + bufp->buffer; \ - if (fixup_alt_jump) \ - fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer; \ - if (laststart) \ - laststart = (laststart - old_buffer) + bufp->buffer; \ - begalt = (begalt - old_buffer) + bufp->buffer; \ - if (pending_exact) \ - pending_exact = (pending_exact - old_buffer) + bufp->buffer; \ - } while (0) - - -/* Set the bit for character C in a character set list. */ -#define SET_LIST_BIT(c) \ - (b[(unsigned char)(c) / MBRE_BYTEWIDTH] \ - |= 1 << ((unsigned char)(c) % MBRE_BYTEWIDTH)) - -/* Get the next unsigned number in the uncompiled pattern. */ -#define GET_UNSIGNED_NUMBER(num) \ - do { if (p != pend) { \ - PATFETCH(c); \ - while (ISDIGIT(c)) { \ - if (num < 0) \ - num = 0; \ - num = num * 10 + c - '0'; \ - if (p == pend) \ - break; \ - PATFETCH(c); \ - } \ - } \ - } while (0) - -#define STREQ(s1, s2) ((strcmp(s1, s2) == 0)) - -#define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ - -#define IS_CHAR_CLASS(string) \ - (STREQ(string, "alpha") || STREQ(string, "upper") \ - || STREQ(string, "lower") || STREQ(string, "digit") \ - || STREQ(string, "alnum") || STREQ(string, "xdigit") \ - || STREQ(string, "space") || STREQ(string, "print") \ - || STREQ(string, "punct") || STREQ(string, "graph") \ - || STREQ(string, "cntrl") || STREQ(string, "blank")) - -#define STORE_MBC(p, c) \ - do { \ - (p)[0] = (unsigned char)(((c) >>24) & 0xff); \ - (p)[1] = (unsigned char)(((c) >>16) & 0xff); \ - (p)[2] = (unsigned char)(((c) >> 8) & 0xff); \ - (p)[3] = (unsigned char)(((c) >> 0) & 0xff); \ - } while (0) - -#define STORE_MBC_AND_INCR(p, c) \ - do { \ - *(p)++ = (unsigned char)(((c) >>24) & 0xff); \ - *(p)++ = (unsigned char)(((c) >>16) & 0xff); \ - *(p)++ = (unsigned char)(((c) >> 8) & 0xff); \ - *(p)++ = (unsigned char)(((c) >> 0) & 0xff); \ - } while (0) - -#define EXTRACT_MBC(p) \ - ((unsigned int)((unsigned char)(p)[0] << 24 | \ - (unsigned char)(p)[1] << 16 | \ - (unsigned char)(p)[2] << 8 | \ - (unsigned char)(p)[3])) - -#define EXTRACT_MBC_AND_INCR(p) \ - ((unsigned int)((p) += 4, \ - (unsigned char)(p)[-4] << 24 | \ - (unsigned char)(p)[-3] << 16 | \ - (unsigned char)(p)[-2] << 8 | \ - (unsigned char)(p)[-1])) - -#define EXTRACT_UNSIGNED(p) \ - ((unsigned char)(p)[0] | (unsigned char)(p)[1] << 8) -#define EXTRACT_UNSIGNED_AND_INCR(p) \ - ((p) += 2, (unsigned char)(p)[-2] | (unsigned char)(p)[-1] << 8) - -/* Handle (mb)?charset(_not)?. - - Structure of mbcharset(_not)? in compiled pattern. - - struct { - unsinged char id; mbcharset(_not)? - unsigned char sbc_size; - unsigned char sbc_map[sbc_size]; same as charset(_not)? up to here. - unsigned short mbc_size; number of intervals. - struct { - unsigned long beg; beginning of interval. - unsigned long end; end of interval. - } intervals[mbc_size]; - }; */ - -static void -set_list_bits(c1, c2, b) - unsigned long c1, c2; - unsigned char *b; -{ - unsigned char sbc_size = b[-1]; - unsigned short mbc_size = EXTRACT_UNSIGNED(&b[sbc_size]); - unsigned short beg, end, upb; - - if (c1 > c2) - return; - b = &b[sbc_size + 2]; - - for (beg = 0, upb = mbc_size; beg < upb; ) { - unsigned short mid = (unsigned short)(beg + upb) >> 1; - - if ((int)c1 - 1 > (int)EXTRACT_MBC(&b[mid*8+4])) - beg = mid + 1; - else - upb = mid; - } - - for (end = beg, upb = mbc_size; end < upb; ) { - unsigned short mid = (unsigned short)(end + upb) >> 1; - - if ((int)c2 >= (int)EXTRACT_MBC(&b[mid*8]) - 1) - end = mid + 1; - else - upb = mid; - } - - if (beg != end) { - if (c1 > EXTRACT_MBC(&b[beg*8])) - c1 = EXTRACT_MBC(&b[beg*8]); - if (c2 < EXTRACT_MBC(&b[(end - 1)*8+4])) - c2 = EXTRACT_MBC(&b[(end - 1)*8+4]); - } - if (end < mbc_size && end != beg + 1) - /* NOTE: memcpy() would not work here. */ - memmove(&b[(beg + 1)*8], &b[end*8], (mbc_size - end)*8); - STORE_MBC(&b[beg*8 + 0], c1); - STORE_MBC(&b[beg*8 + 4], c2); - mbc_size += beg - end + 1; - STORE_NUMBER(&b[-2], mbc_size); -} - -static int -is_in_list(c, b) - unsigned long c; - const unsigned char *b; -{ - unsigned short size; - unsigned short i, j; - - size = *b++; - if ((int)c / MBRE_BYTEWIDTH < (int)size && b[c / MBRE_BYTEWIDTH] & 1 << c % MBRE_BYTEWIDTH) { - return 1; - } - b += size + 2; - size = EXTRACT_UNSIGNED(&b[-2]); - if (size == 0) return 0; - - for (i = 0, j = size; i < j; ) { - unsigned short k = (unsigned short)(i + j) >> 1; - - if (c > EXTRACT_MBC(&b[k*8+4])) - i = k + 1; - else - j = k; - } - if (i < size && EXTRACT_MBC(&b[i*8]) <= c - && ((unsigned char)c != '\n' && (unsigned char)c != '\0')) - return 1; - return 0; -} - -#if 0 -static void -print_partial_compiled_pattern(start, end) - unsigned char *start; - unsigned char *end; -{ - int mcnt, mcnt2; - unsigned char *p = start; - unsigned char *pend = end; - - if (start == NULL) { - printf("(null)\n"); - return; - } - - /* Loop over pattern commands. */ - while (p < pend) { - switch ((enum regexpcode)*p++) { - case unused: - printf("/unused"); - break; - - case exactn: - mcnt = *p++; - printf("/exactn/%d", mcnt); - do { - putchar('/'); - printf("%c", *p++); - } - while (--mcnt); - break; - - case start_memory: - mcnt = *p++; - printf("/start_memory/%d/%d", mcnt, *p++); - break; - - case stop_memory: - mcnt = *p++; - printf("/stop_memory/%d/%d", mcnt, *p++); - break; - - case start_paren: - printf("/start_paren"); - break; - - case stop_paren: - printf("/stop_paren"); - break; - - case casefold_on: - printf("/casefold_on"); - break; - - case casefold_off: - printf("/casefold_off"); - break; - - case option_set: - printf("/option_set/%d", *p++); - break; - - case start_nowidth: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - printf("/start_nowidth//%d", mcnt); - break; - - case stop_nowidth: - printf("/stop_nowidth//"); - p += 2; - break; - - case pop_and_fail: - printf("/pop_and_fail"); - break; - - case stop_backtrack: - printf("/stop_backtrack//"); - p += 2; - break; - - case duplicate: - printf("/duplicate/%d", *p++); - break; - - case anychar: - printf("/anychar"); - break; - - case anychar_repeat: - printf("/anychar_repeat"); - break; - - case charset: - case charset_not: - { - register int c; - - printf("/charset%s", - (enum regexpcode)*(p - 1) == charset_not ? "_not" : ""); - - mcnt = *p++; - printf("/%d", mcnt); - for (c = 0; c < mcnt; c++) { - unsigned bit; - unsigned char map_byte = p[c]; - - putchar ('/'); - - for (bit = 0; bit < MBRE_BYTEWIDTH; bit++) - if (map_byte & (1 << bit)) - printf("%c", c * MBRE_BYTEWIDTH + bit); - } - p += mcnt; - mcnt = EXTRACT_UNSIGNED_AND_INCR(p); - printf("/"); - while (mcnt--) { - print_mbc(EXTRACT_MBC_AND_INCR(p)); - printf("-"); - print_mbc(EXTRACT_MBC_AND_INCR(p)); - } - break; - } - - case begline: - printf("/begline"); - break; - - case endline: - printf("/endline"); - break; - - case on_failure_jump: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - printf("/on_failure_jump//%d", mcnt); - break; - - case dummy_failure_jump: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - printf("/dummy_failure_jump//%d", mcnt); - break; - - case push_dummy_failure: - printf("/push_dummy_failure"); - break; - - case finalize_jump: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - printf("/finalize_jump//%d", mcnt); - break; - - case maybe_finalize_jump: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - printf("/maybe_finalize_jump//%d", mcnt); - break; - - case jump_past_alt: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - printf("/jump_past_alt//%d", mcnt); - break; - - case jump: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - printf("/jump//%d", mcnt); - break; - - case succeed_n: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - EXTRACT_NUMBER_AND_INCR(mcnt2, p); - printf("/succeed_n//%d//%d", mcnt, mcnt2); - break; - - case jump_n: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - EXTRACT_NUMBER_AND_INCR(mcnt2, p); - printf("/jump_n//%d//%d", mcnt, mcnt2); - break; - - case set_number_at: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - EXTRACT_NUMBER_AND_INCR(mcnt2, p); - printf("/set_number_at//%d//%d", mcnt, mcnt2); - break; - - case try_next: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - printf("/try_next//%d", mcnt); - break; - - case finalize_push: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - printf("/finalize_push//%d", mcnt); - break; - - case finalize_push_n: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - EXTRACT_NUMBER_AND_INCR(mcnt2, p); - printf("/finalize_push_n//%d//%d", mcnt, mcnt2); - break; - - case wordbound: - printf("/wordbound"); - break; - - case notwordbound: - printf("/notwordbound"); - break; - - case wordbeg: - printf("/wordbeg"); - break; - - case wordend: - printf("/wordend"); - - case wordchar: - printf("/wordchar"); - break; - - case notwordchar: - printf("/notwordchar"); - break; - - case begbuf: - printf("/begbuf"); - break; - - case endbuf: - printf("/endbuf"); - break; - - case endbuf2: - printf("/endbuf2"); - break; - - case begpos: - printf("/begpos"); - break; - - default: - printf("?%d", *(p-1)); - } - } - printf("/\n"); -} - - -static void -print_compiled_pattern(bufp) - struct mbre_pattern_buffer *bufp; -{ - unsigned char *buffer = (unsigned char*)bufp->buffer; - - print_partial_compiled_pattern(buffer, buffer + bufp->used); -} -#endif - -static char* -calculate_must_string(start, end) - char *start; - char *end; -{ - int mcnt; - int max = 0; - char *p = start; - char *pend = end; - char *must = 0; - - if (start == NULL) return 0; - - /* Loop over pattern commands. */ - while (p < pend) { - switch ((enum regexpcode)*p++) { - case unused: - break; - - case exactn: - mcnt = *p; - if (mcnt > max) { - must = p; - max = mcnt; - } - p += mcnt+1; - break; - - case start_memory: - case stop_memory: - p += 2; - break; - - case duplicate: - p++; - break; - - case casefold_on: - case casefold_off: - return 0; /* should not check must_string */ - - case pop_and_fail: - case anychar: - case anychar_repeat: - case begline: - case endline: - case wordbound: - case notwordbound: - case wordbeg: - case wordend: - case wordchar: - case notwordchar: - case begbuf: - case endbuf: - case endbuf2: - case begpos: - case push_dummy_failure: - case start_paren: - case stop_paren: - case option_set: - break; - - case charset: - case charset_not: - mcnt = *p++; - p += mcnt; - mcnt = EXTRACT_UNSIGNED_AND_INCR(p); - while (mcnt--) { - p += 4; - } - break; - - case on_failure_jump: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - if (mcnt > 0) p += mcnt; - if ((enum regexpcode)p[-3] == jump) { - p -= 2; - EXTRACT_NUMBER_AND_INCR(mcnt, p); - if (mcnt > 0) p += mcnt; - } - break; - - case dummy_failure_jump: - case succeed_n: - case try_next: - case jump: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - if (mcnt > 0) p += mcnt; - break; - - case start_nowidth: - case stop_nowidth: - case stop_backtrack: - case finalize_jump: - case maybe_finalize_jump: - case finalize_push: - p += 2; - break; - - case jump_n: - case set_number_at: - case finalize_push_n: - p += 4; - break; - - default: - break; - } - } - return must; -} - -static unsigned int -read_backslash(c) - int c; -{ - switch (c) { - case 'n': - return '\n'; - - case 't': - return '\t'; - - case 'r': - return '\r'; - - case 'f': - return '\f'; - - case 'v': - return '\v'; - - case 'a': - return '\007'; - - case 'b': - return '\010'; - - case 'e': - return '\033'; - } - return c; -} - -static unsigned int -read_special(p, pend, pp) - const char *p, *pend, **pp; -{ - int c; - - PATFETCH_RAW(c); - switch (c) { - case 'M': - PATFETCH_RAW(c); - if (c != '-') return -1; - PATFETCH_RAW(c); - *pp = p; - if (c == '\\') { - return read_special(p, pend, pp) | 0x80; - } - else if (c == -1) return ~0; - else { - return ((c & 0xff) | 0x80); - } - - case 'C': - PATFETCH_RAW(c); - if (c != '-') return ~0; - case 'c': - PATFETCH_RAW(c); - *pp = p; - if (c == '\\') { - c = read_special(p, pend, pp); - } - else if (c == '?') return 0177; - else if (c == -1) return ~0; - return c & 0x9f; - default: - return read_backslash(c); - } - - end_of_pattern: - return ~0; -} - -/* re_compile_pattern takes a regular-expression string - and converts it into a buffer full of byte commands for matching. - - PATTERN is the address of the pattern string - SIZE is the length of it. - BUFP is a struct mbre_pattern_buffer * which points to the info - on where to store the byte commands. - This structure contains a char * which points to the - actual space, which should have been obtained with malloc. - re_compile_pattern may use realloc to grow the buffer space. - - The number of bytes of commands can be found out by looking in - the `struct mbre_pattern_buffer' that bufp pointed to, after - re_compile_pattern returns. */ - -char * -re_compile_pattern(pattern, size, bufp) - const char *pattern; - int size; - struct mbre_pattern_buffer *bufp; -{ - register char *b = bufp->buffer; - register const char *p = pattern; - const char *nextp; - const char *pend = pattern + size; - register unsigned int c, c1=0; - const char *p0; - int numlen; -#define ERROR_MSG_MAX_SIZE 200 - static char error_msg[ERROR_MSG_MAX_SIZE+1]; - - /* Address of the count-byte of the most recently inserted `exactn' - command. This makes it possible to tell whether a new exact-match - character can be added to that command or requires a new `exactn' - command. */ - - char *pending_exact = 0; - - /* Address of the place where a forward-jump should go to the end of - the containing expression. Each alternative of an `or', except the - last, ends with a forward-jump of this sort. */ - - char *fixup_alt_jump = 0; - - /* Address of start of the most recently finished expression. - This tells postfix * where to find the start of its operand. */ - - char *laststart = 0; - - /* In processing a repeat, 1 means zero matches is allowed. */ - - char zero_times_ok; - - /* In processing a repeat, 1 means many matches is allowed. */ - - char many_times_ok; - - /* In processing a repeat, 1 means non-greedy matches. */ - - char greedy; - - /* Address of beginning of regexp, or inside of last (. */ - - char *begalt = b; - - /* Place in the uncompiled pattern (i.e., the {) to - which to go back if the interval is invalid. */ - const char *beg_interval; - - /* In processing an interval, at least this many matches must be made. */ - int lower_bound; - - /* In processing an interval, at most this many matches can be made. */ - int upper_bound; - - /* Stack of information saved by ( and restored by ). - Five stack elements are pushed by each (: - First, the value of b. - Second, the value of fixup_alt_jump. - Third, the value of begalt. - Fourth, the value of regnum. - Fifth, the type of the paren. */ - - int stacka[40]; - int *stackb = stacka; - int *stackp = stackb; - int *stacke = stackb + 40; - - /* Counts ('s as they are encountered. Remembered for the matching ), - where it becomes the register number to put in the stop_memory - command. */ - - int regnum = 1; - - int range = 0; - int had_mbchar = 0; - int had_num_literal = 0; - int had_char_class = 0; - - int options = bufp->options; - - int current_mbctype = bufp->mbctype; - const unsigned char *re_mbctab = re_mbctab_get(current_mbctype); - - bufp->fastmap_accurate = 0; - bufp->must = 0; - bufp->must_skip = 0; - bufp->stclass = 0; - - /* Initialize the syntax table. */ - init_syntax_once(); - - if (bufp->allocated == 0) { - bufp->allocated = INIT_BUF_SIZE; - if (bufp->buffer) - /* EXTEND_BUFFER loses when bufp->allocated is 0. */ - bufp->buffer = (char*)xrealloc(bufp->buffer, INIT_BUF_SIZE); - else - /* Caller did not allocate a buffer. Do it for them. */ - bufp->buffer = (char*)xmalloc(INIT_BUF_SIZE); - if (!bufp->buffer) goto memory_exhausted; - begalt = b = bufp->buffer; - } - - while (p != pend) { - PATFETCH(c); - - switch (c) { - case '$': - if (bufp->options & MBRE_OPTION_SINGLELINE) { - BUFPUSH(endbuf); - } - else { - p0 = p; - /* When testing what follows the $, - look past the \-constructs that don't consume anything. */ - - while (p0 != pend) { - if (*p0 == '\\' && p0 + 1 != pend - && (p0[1] == 'b' || p0[1] == 'B')) - p0 += 2; - else - break; - } - BUFPUSH(endline); - } - break; - - case '^': - if (bufp->options & MBRE_OPTION_SINGLELINE) - BUFPUSH(begbuf); - else - BUFPUSH(begline); - break; - - case '+': - case '?': - case '*': - /* If there is no previous pattern, char not special. */ - if (!laststart) { - snprintf(error_msg, ERROR_MSG_MAX_SIZE, - "invalid regular expression; there's no previous pattern, to which '%c' would define cardinality at %d", - c, p-pattern); - if (bufp->buffer) { - xfree(bufp->buffer); - } - FREE_AND_RETURN(stackb, error_msg); - } - /* If there is a sequence of repetition chars, - collapse it down to just one. */ - zero_times_ok = c != '+'; - many_times_ok = c != '?'; - greedy = 1; - if (p != pend) { - PATFETCH(c); - switch (c) { - case '?': - greedy = 0; - break; - case '*': - case '+': - goto nested_meta; - default: - PATUNFETCH; - break; - } - } - - repeat: - /* Star, etc. applied to an empty pattern is equivalent - to an empty pattern. */ - if (!laststart) - break; - - if (greedy && many_times_ok && *laststart == anychar && b - laststart <= 2) { - if (b[-1] == stop_paren) - b--; - if (zero_times_ok) - *laststart = anychar_repeat; - else { - BUFPUSH(anychar_repeat); - } - break; - } - /* Now we know whether or not zero matches is allowed - and also whether or not two or more matches is allowed. */ - if (many_times_ok) { - /* If more than one repetition is allowed, put in at the - end a backward relative jump from b to before the next - jump we're going to put in below (which jumps from - laststart to after this jump). */ - GET_BUFFER_SPACE(3); - store_jump(b,greedy?maybe_finalize_jump:finalize_push,laststart-3); - b += 3; /* Because store_jump put stuff here. */ - } - - /* On failure, jump from laststart to next pattern, which will be the - end of the buffer after this jump is inserted. */ - GET_BUFFER_SPACE(3); - insert_jump(on_failure_jump, laststart, b + 3, b); - b += 3; - - if (zero_times_ok) { - if (greedy == 0) { - GET_BUFFER_SPACE(3); - insert_jump(try_next, laststart, b + 3, b); - b += 3; - } - } - else { - /* At least one repetition is required, so insert a - `dummy_failure_jump' before the initial - `on_failure_jump' instruction of the loop. This - effects a skip over that instruction the first time - we hit that loop. */ - GET_BUFFER_SPACE(3); - insert_jump(dummy_failure_jump, laststart, laststart + 6, b); - b += 3; - } - break; - - case '.': - laststart = b; - BUFPUSH(anychar); - break; - - case '[': - if (p == pend) - FREE_AND_RETURN(stackb, "invalid regular expression; '[' can't be the last character ie. can't start range at the end of pattern"); - while ((b - bufp->buffer + 9 + (1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH) - > bufp->allocated) - EXTEND_BUFFER; - - laststart = b; - if (*p == '^') { - BUFPUSH(charset_not); - p++; - } - else - BUFPUSH(charset); - p0 = p; - - BUFPUSH((1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH); - /* Clear the whole map */ - memset(b, 0, (1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH + 2); - - had_mbchar = 0; - had_num_literal = 0; - had_char_class = 0; - - /* Read in characters and ranges, setting map bits. */ - for (;;) { - int size; - unsigned last = (unsigned)-1; - - if ((size = EXTRACT_UNSIGNED(&b[(1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH])) - || current_mbctype) { - /* Ensure the space is enough to hold another interval - of multi-byte chars in charset(_not)?. */ - size = (1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH + 2 + size*8 + 8; - while (b + size + 1 > bufp->buffer + bufp->allocated) - EXTEND_BUFFER; - } - range_retry: - if (range && had_char_class) { - FREE_AND_RETURN(stackb, "invalid regular expression; can't use character class as an end value of range"); - } - PATFETCH(c); - - if (c == ']') { - if (p == p0 + 1) { - if (p == pend) - FREE_AND_RETURN(stackb, "invalid regular expression; empty character class"); - } - else - /* Stop if this isn't merely a ] inside a bracket - expression, but rather the end of a bracket - expression. */ - break; - } - /* Look ahead to see if it's a range when the last thing - was a character class. */ - if (had_char_class && c == '-' && *p != ']') - FREE_AND_RETURN(stackb, "invalid regular expression; can't use character class as a start value of range"); - if (ismbchar(c)) { - PATFETCH_MBC(c); - had_mbchar++; - } - had_char_class = 0; - - /* \ escapes characters when inside [...]. */ - if (c == '\\') { - PATFETCH_RAW(c); - switch (c) { - case 'w': - for (c = 0; c < (1 << MBRE_BYTEWIDTH); c++) { - if (SYNTAX(c) == Sword || - (!current_mbctype && SYNTAX(c) == Sword2)) - SET_LIST_BIT(c); - } - if (current_mbctype) { - set_list_bits(0x80, 0xffffffff, b); - } - had_char_class = 1; - last = -1; - continue; - - case 'W': - for (c = 0; c < (1 << MBRE_BYTEWIDTH); c++) { - if (SYNTAX(c) != Sword && - ((current_mbctype && !re_mbctab[c]) || - (!current_mbctype && SYNTAX(c) != Sword2))) - SET_LIST_BIT(c); - } - had_char_class = 1; - last = -1; - continue; - - case 's': - for (c = 0; c < 256; c++) - if (ISSPACE(c)) - SET_LIST_BIT(c); - had_char_class = 1; - last = -1; - continue; - - case 'S': - for (c = 0; c < 256; c++) - if (!ISSPACE(c)) - SET_LIST_BIT(c); - if (current_mbctype) - set_list_bits(0x80, 0xffffffff, b); - had_char_class = 1; - last = -1; - continue; - - case 'd': - for (c = '0'; c <= '9'; c++) - SET_LIST_BIT(c); - had_char_class = 1; - last = -1; - continue; - - case 'D': - for (c = 0; c < 256; c++) - if (!ISDIGIT(c)) - SET_LIST_BIT(c); - if (current_mbctype) - set_list_bits(0x80, 0xffffffff, b); - had_char_class = 1; - last = -1; - continue; - - case 'x': - c = scan_hex(p, 2, &numlen); - p += numlen; - had_num_literal = 1; - break; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - PATUNFETCH; - c = scan_oct(p, 3, &numlen); - p += numlen; - had_num_literal = 1; - break; - - case 'M': - case 'C': - case 'c': - p0 = --p; - c = read_special(p, pend, &p0); - if (c > 255) goto invalid_escape; - p = p0; - had_num_literal = 1; - break; - - default: - c = read_backslash(c); - if (ismbchar(c)) { - PATFETCH_MBC(c); - had_mbchar++; - } - break; - } - } - - /* Get a range. */ - if (range) { - if (last > c) - goto invalid_pattern; - - range = 0; - if (had_mbchar == 0) { - for (;last<=c;last++) - SET_LIST_BIT(last); - } - else if (had_mbchar == 2) { - set_list_bits(last, c, b); - } - else { - /* restriction: range between sbc and mbc */ - goto invalid_pattern; - } - } - else if (p[0] == '-' && p[1] != ']') { - last = c; - PATFETCH(c1); - range = 1; - goto range_retry; - } - else if (c == '[' && *p == ':') { - /* Leave room for the null. */ - char str[CHAR_CLASS_MAX_LENGTH + 1]; - - PATFETCH_RAW(c); - c1 = 0; - - /* If pattern is `[[:'. */ - if (p == pend) - FREE_AND_RETURN(stackb, "invalid regular expression; re can't end '[[:'"); - - for (;;) { - PATFETCH (c); - if (c == ':' || c == ']' || p == pend - || c1 == CHAR_CLASS_MAX_LENGTH) - break; - str[c1++] = c; - } - str[c1] = '\0'; - - /* If isn't a word bracketed by `[:' and:`]': - undo the ending character, the letters, and leave - the leading `:' and `[' (but set bits for them). */ - if (c == ':' && *p == ']') { - int ch; - char is_alnum = STREQ(str, "alnum"); - char is_alpha = STREQ(str, "alpha"); - char is_blank = STREQ(str, "blank"); - char is_cntrl = STREQ(str, "cntrl"); - char is_digit = STREQ(str, "digit"); - char is_graph = STREQ(str, "graph"); - char is_lower = STREQ(str, "lower"); - char is_print = STREQ(str, "print"); - char is_punct = STREQ(str, "punct"); - char is_space = STREQ(str, "space"); - char is_upper = STREQ(str, "upper"); - char is_xdigit = STREQ(str, "xdigit"); - - if (!IS_CHAR_CLASS(str)){ - snprintf(error_msg, ERROR_MSG_MAX_SIZE, - "invalid regular expression; [:%s:] is not a character class", str); - FREE_AND_RETURN(stackb, error_msg); - } - - /* Throw away the ] at the end of the character class. */ - PATFETCH(c); - - if (p == pend) - FREE_AND_RETURN(stackb, "invalid regular expression; range doesn't have ending ']' after a character class"); - - for (ch = 0; ch < 1 << MBRE_BYTEWIDTH; ch++) { - if ( (is_alnum && ISALNUM(ch)) - || (is_alpha && ISALPHA(ch)) - || (is_blank && ISBLANK(ch)) - || (is_cntrl && ISCNTRL(ch)) - || (is_digit && ISDIGIT(ch)) - || (is_graph && ISGRAPH(ch)) - || (is_lower && ISLOWER(ch)) - || (is_print && ISPRINT(ch)) - || (is_punct && ISPUNCT(ch)) - || (is_space && ISSPACE(ch)) - || (is_upper && ISUPPER(ch)) - || (is_xdigit && ISXDIGIT(ch))) - SET_LIST_BIT(ch); - } - had_char_class = 1; - } - else { - c1++; - while (c1--) - PATUNFETCH; - SET_LIST_BIT(TRANSLATE_P()?translate['[']:'['); - SET_LIST_BIT(TRANSLATE_P()?translate[':']:':'); - had_char_class = 0; - last = ':'; - } - } - else if (had_mbchar == 0 && (!current_mbctype || !had_num_literal)) { - SET_LIST_BIT(c); - had_num_literal = 0; - } - else - set_list_bits(c, c, b); - had_mbchar = 0; - } - - /* Discard any character set/class bitmap bytes that are all - 0 at the end of the map. Decrement the map-length byte too. */ - while ((int)b[-1] > 0 && b[(int)b[-1] - 1] == 0) - b[-1]--; - if (b[-1] != (1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH) - memmove(&b[(int)b[-1]], &b[(1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH], - 2 + EXTRACT_UNSIGNED(&b[(1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH])*8); - b += b[-1] + 2 + EXTRACT_UNSIGNED(&b[(int)b[-1]])*8; - break; - - case '(': - { - int old_options = options; - int push_option = 0; - int casefold = 0; - - PATFETCH(c); - if (c == '?') { - int negative = 0; - - PATFETCH_RAW(c); - switch (c) { - case 'x': case 'p': case 'm': case 'i': case '-': - for (;;) { - switch (c) { - case '-': - negative = 1; - break; - - case ':': - case ')': - break; - - case 'x': - if (negative) - options &= ~MBRE_OPTION_EXTENDED; - else - options |= MBRE_OPTION_EXTENDED; - break; - - case 'p': - if (negative) { - if ((options&MBRE_OPTION_POSIXLINE) == MBRE_OPTION_POSIXLINE) { - options &= ~MBRE_OPTION_POSIXLINE; - } - } - else if ((options&MBRE_OPTION_POSIXLINE) != MBRE_OPTION_POSIXLINE) { - options |= MBRE_OPTION_POSIXLINE; - } - push_option = 1; - break; - - case 'm': - if (negative) { - if (options&MBRE_OPTION_MULTILINE) { - options &= ~MBRE_OPTION_MULTILINE; - } - } - else if (!(options&MBRE_OPTION_MULTILINE)) { - options |= MBRE_OPTION_MULTILINE; - } - push_option = 1; - break; - - case 'i': - if (negative) { - if (options&MBRE_OPTION_IGNORECASE) { - options &= ~MBRE_OPTION_IGNORECASE; - } - } - else if (!(options&MBRE_OPTION_IGNORECASE)) { - options |= MBRE_OPTION_IGNORECASE; - } - casefold = 1; - break; - - default: - FREE_AND_RETURN(stackb, "undefined (?...) inline option"); - } - if (c == ')') { - c = '#'; /* read whole in-line options */ - break; - } - if (c == ':') break; - PATFETCH_RAW(c); - } - break; - - case '#': - for (;;) { - PATFETCH(c); - if (c == ')') break; - } - c = '#'; - break; - - case ':': - case '=': - case '!': - case '>': - break; - - default: - FREE_AND_RETURN(stackb, "undefined (?...) sequence"); - } - } - else { - PATUNFETCH; - c = '('; - } - if (c == '#') { - if (push_option) { - BUFPUSH(option_set); - BUFPUSH(options); - } - if (casefold) { - if (options & MBRE_OPTION_IGNORECASE) - BUFPUSH(casefold_on); - else - BUFPUSH(casefold_off); - } - break; - } - if (stackp+8 >= stacke) { - DOUBLE_STACK(int); - } - - /* Laststart should point to the start_memory that we are about - to push (unless the pattern has MBRE_NREGS or more ('s). */ - /* obsolete: now MBRE_NREGS is just a default register size. */ - *stackp++ = b - bufp->buffer; - *stackp++ = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0; - *stackp++ = begalt - bufp->buffer; - switch (c) { - case '(': - BUFPUSH(start_memory); - BUFPUSH(regnum); - *stackp++ = regnum++; - *stackp++ = b - bufp->buffer; - BUFPUSH(0); - /* too many ()'s to fit in a byte. (max 254) */ - if (regnum >= MBRE_REG_MAX) goto too_big; - break; - - case '=': - case '!': - case '>': - BUFPUSH(start_nowidth); - *stackp++ = b - bufp->buffer; - BUFPUSH(0); /* temporary value */ - BUFPUSH(0); - if (c != '!') break; - - BUFPUSH(on_failure_jump); - *stackp++ = b - bufp->buffer; - BUFPUSH(0); /* temporary value */ - BUFPUSH(0); - break; - - case ':': - BUFPUSH(start_paren); - pending_exact = 0; - default: - break; - } - if (push_option) { - BUFPUSH(option_set); - BUFPUSH(options); - } - if (casefold) { - if (options & MBRE_OPTION_IGNORECASE) - BUFPUSH(casefold_on); - else - BUFPUSH(casefold_off); - } - *stackp++ = c; - *stackp++ = old_options; - fixup_alt_jump = 0; - laststart = 0; - begalt = b; - } - break; - - case ')': - if (stackp == stackb) - FREE_AND_RETURN(stackb, "unmatched )"); - - pending_exact = 0; - if (fixup_alt_jump) { - /* Push a dummy failure point at the end of the - alternative for a possible future - `finalize_jump' to pop. See comments at - `push_dummy_failure' in `re_match'. */ - BUFPUSH(push_dummy_failure); - - /* We allocated space for this jump when we assigned - to `fixup_alt_jump', in the `handle_alt' case below. */ - store_jump(fixup_alt_jump, jump, b); - } - if (options != stackp[-1]) { - if ((options ^ stackp[-1]) & MBRE_OPTION_IGNORECASE) { - BUFPUSH((options&MBRE_OPTION_IGNORECASE)?casefold_off:casefold_on); - } - if ((options ^ stackp[-1]) != MBRE_OPTION_IGNORECASE) { - BUFPUSH(option_set); - BUFPUSH(stackp[-1]); - } - } - p0 = b; - options = *--stackp; - switch (c = *--stackp) { - case '(': - { - char *loc = bufp->buffer + *--stackp; - *loc = regnum - stackp[-1]; - BUFPUSH(stop_memory); - BUFPUSH(stackp[-1]); - BUFPUSH(regnum - stackp[-1]); - stackp--; - } - break; - - case '!': - BUFPUSH(pop_and_fail); - /* back patch */ - STORE_NUMBER(bufp->buffer+stackp[-1], b - bufp->buffer - stackp[-1] - 2); - stackp--; - /* fall through */ - case '=': - BUFPUSH(stop_nowidth); - /* tell stack-pos place to start_nowidth */ - STORE_NUMBER(bufp->buffer+stackp[-1], b - bufp->buffer - stackp[-1] - 2); - BUFPUSH(0); /* space to hold stack pos */ - BUFPUSH(0); - stackp--; - break; - - case '>': - BUFPUSH(stop_backtrack); - /* tell stack-pos place to start_nowidth */ - STORE_NUMBER(bufp->buffer+stackp[-1], b - bufp->buffer - stackp[-1] - 2); - BUFPUSH(0); /* space to hold stack pos */ - BUFPUSH(0); - stackp--; - break; - - case ':': - BUFPUSH(stop_paren); - break; - - default: - break; - } - begalt = *--stackp + bufp->buffer; - stackp--; - fixup_alt_jump = *stackp ? *stackp + bufp->buffer - 1 : 0; - laststart = *--stackp + bufp->buffer; - if (c == '!' || c == '=') laststart = b; - break; - - case '|': - /* Insert before the previous alternative a jump which - jumps to this alternative if the former fails. */ - GET_BUFFER_SPACE(3); - insert_jump(on_failure_jump, begalt, b + 6, b); - pending_exact = 0; - b += 3; - /* The alternative before this one has a jump after it - which gets executed if it gets matched. Adjust that - jump so it will jump to this alternative's analogous - jump (put in below, which in turn will jump to the next - (if any) alternative's such jump, etc.). The last such - jump jumps to the correct final destination. A picture: - _____ _____ - | | | | - | v | v - a | b | c - - If we are at `b', then fixup_alt_jump right now points to a - three-byte space after `a'. We'll put in the jump, set - fixup_alt_jump to right after `b', and leave behind three - bytes which we'll fill in when we get to after `c'. */ - - if (fixup_alt_jump) - store_jump(fixup_alt_jump, jump_past_alt, b); - - /* Mark and leave space for a jump after this alternative, - to be filled in later either by next alternative or - when know we're at the end of a series of alternatives. */ - fixup_alt_jump = b; - GET_BUFFER_SPACE(3); - b += 3; - - laststart = 0; - begalt = b; - break; - - case '{': - /* If there is no previous pattern, this is an invalid pattern. */ - if (!laststart) { - snprintf(error_msg, ERROR_MSG_MAX_SIZE, - "invalid regular expression; there's no previous pattern, to which '{' would define cardinality at %d", - p-pattern); - FREE_AND_RETURN(stackb, error_msg); - } - if( p == pend) - FREE_AND_RETURN(stackb, "invalid regular expression; '{' can't be last character" ); - - beg_interval = p - 1; - - lower_bound = -1; /* So can see if are set. */ - upper_bound = -1; - GET_UNSIGNED_NUMBER(lower_bound); - if (c == ',') { - GET_UNSIGNED_NUMBER(upper_bound); - } - else - /* Interval such as `{1}' => match exactly once. */ - upper_bound = lower_bound; - - if (lower_bound < 0 || c != '}') - goto unfetch_interval; - - if (lower_bound >= MBRE_DUP_MAX || upper_bound >= MBRE_DUP_MAX) - FREE_AND_RETURN(stackb, "too big quantifier in {,}"); - if (upper_bound < 0) upper_bound = MBRE_DUP_MAX; - if (lower_bound > upper_bound) - FREE_AND_RETURN(stackb, "can't do {n,m} with n > m"); - - beg_interval = 0; - pending_exact = 0; - - greedy = 1; - if (p != pend) { - PATFETCH(c); - if (c == '?') greedy = 0; - else PATUNFETCH; - } - - if (lower_bound == 0) { - zero_times_ok = 1; - if (upper_bound == MBRE_DUP_MAX) { - many_times_ok = 1; - goto repeat; - } - if (upper_bound == 1) { - many_times_ok = 0; - goto repeat; - } - } - if (lower_bound == 1) { - if (upper_bound == 1) { - /* No need to repeat */ - break; - } - if (upper_bound == MBRE_DUP_MAX) { - many_times_ok = 1; - zero_times_ok = 0; - goto repeat; - } - } - - /* If upper_bound is zero, don't want to succeed at all; - jump from laststart to b + 3, which will be the end of - the buffer after this jump is inserted. */ - - if (upper_bound == 0) { - GET_BUFFER_SPACE(3); - insert_jump(jump, laststart, b + 3, b); - b += 3; - break; - } - - /* If lower_bound == upper_bound, repeat count can be removed */ - if (lower_bound == upper_bound) { - int mcnt; - int skip_stop_paren = 0; - - if (b[-1] == stop_paren) { - skip_stop_paren = 1; - b--; - } - - if (*laststart == exactn && laststart[1]+2 == b - laststart - && laststart[1]*lower_bound < 256) { - mcnt = laststart[1]; - GET_BUFFER_SPACE((lower_bound-1)*mcnt); - laststart[1] = lower_bound*mcnt; - while (--lower_bound) { - memcpy(b, laststart+2, mcnt); - b += mcnt; - } - if (skip_stop_paren) BUFPUSH(stop_paren); - break; - } - - if (lower_bound < 5 && b - laststart < 10) { - /* 5 and 10 are the magic numbers */ - - mcnt = b - laststart; - GET_BUFFER_SPACE((lower_bound-1)*mcnt); - while (--lower_bound) { - memcpy(b, laststart, mcnt); - b += mcnt; - } - if (skip_stop_paren) BUFPUSH(stop_paren); - break; - } - if (skip_stop_paren) b++; /* push back stop_paren */ - } - - /* Otherwise, we have a nontrivial interval. When - we're all done, the pattern will look like: - set_number_at <jump count> <upper bound> - set_number_at <succeed_n count> <lower bound> - succeed_n <after jump addr> <succed_n count> - <body of loop> - jump_n <succeed_n addr> <jump count> - (The upper bound and `jump_n' are omitted if - `upper_bound' is 1, though.) */ - { /* If the upper bound is > 1, we need to insert - more at the end of the loop. */ - unsigned int nbytes = (unsigned int)upper_bound == 1 ? 10 : 20; - - GET_BUFFER_SPACE(nbytes); - /* Initialize lower bound of the `succeed_n', even - though it will be set during matching by its - attendant `set_number_at' (inserted next), - because `re_compile_fastmap' needs to know. - Jump to the `jump_n' we might insert below. */ - insert_jump_n(succeed_n, laststart, b + (nbytes/2), - b, lower_bound); - b += 5; /* Just increment for the succeed_n here. */ - - /* Code to initialize the lower bound. Insert - before the `succeed_n'. The `5' is the last two - bytes of this `set_number_at', plus 3 bytes of - the following `succeed_n'. */ - insert_op_2(set_number_at, laststart, b, 5, lower_bound); - b += 5; - - if (upper_bound > 1) { - /* More than one repetition is allowed, so - append a backward jump to the `succeed_n' - that starts this interval. - - When we've reached this during matching, - we'll have matched the interval once, so - jump back only `upper_bound - 1' times. */ - GET_BUFFER_SPACE(5); - store_jump_n(b, greedy?jump_n:finalize_push_n, laststart + 5, - upper_bound - 1); - b += 5; - - /* The location we want to set is the second - parameter of the `jump_n'; that is `b-2' as - an absolute address. `laststart' will be - the `set_number_at' we're about to insert; - `laststart+3' the number to set, the source - for the relative address. But we are - inserting into the middle of the pattern -- - so everything is getting moved up by 5. - Conclusion: (b - 2) - (laststart + 3) + 5, - i.e., b - laststart. - - We insert this at the beginning of the loop - so that if we fail during matching, we'll - reinitialize the bounds. */ - insert_op_2(set_number_at, laststart, b, b - laststart, - upper_bound - 1); - b += 5; - } - } - break; - - unfetch_interval: - /* If an invalid interval, match the characters as literals. */ - p = beg_interval; - beg_interval = 0; - - /* normal_char and normal_backslash need `c'. */ - PATFETCH(c); - goto normal_char; - - case '\\': - if (p == pend) - FREE_AND_RETURN(stackb, "invalid regular expression; '\\' can't be last character"); - /* Do not translate the character after the \, so that we can - distinguish, e.g., \B from \b, even if we normally would - translate, e.g., B to b. */ - PATFETCH_RAW(c); - switch (c) { - case 's': - case 'S': - case 'd': - case 'D': - while (b - bufp->buffer + 9 + (1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH - > bufp->allocated) - EXTEND_BUFFER; - - laststart = b; - if (c == 's' || c == 'd') { - BUFPUSH(charset); - } - else { - BUFPUSH(charset_not); - } - - BUFPUSH((1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH); - memset(b, 0, (1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH + 2); - if (c == 's' || c == 'S') { - SET_LIST_BIT(' '); - SET_LIST_BIT('\t'); - SET_LIST_BIT('\n'); - SET_LIST_BIT('\r'); - SET_LIST_BIT('\f'); - } - else { - char cc; - - for (cc = '0'; cc <= '9'; cc++) { - SET_LIST_BIT(cc); - } - } - - while ((int)b[-1] > 0 && b[b[-1] - 1] == 0) - b[-1]--; - if (b[-1] != (1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH) - memmove(&b[(int)b[-1]], &b[(1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH], - 2 + EXTRACT_UNSIGNED(&b[(1 << MBRE_BYTEWIDTH) / MBRE_BYTEWIDTH])*8); - b += b[-1] + 2 + EXTRACT_UNSIGNED(&b[(int)b[-1]])*8; - break; - - case 'w': - laststart = b; - BUFPUSH(wordchar); - break; - - case 'W': - laststart = b; - BUFPUSH(notwordchar); - break; - -#ifndef RUBY - case '<': - BUFPUSH(wordbeg); - break; - - case '>': - BUFPUSH(wordend); - break; -#endif - - case 'b': - BUFPUSH(wordbound); - break; - - case 'B': - BUFPUSH(notwordbound); - break; - - case 'A': - BUFPUSH(begbuf); - break; - - case 'Z': - if ((bufp->options & MBRE_OPTION_SINGLELINE) == 0) { - BUFPUSH(endbuf2); - break; - } - /* fall through */ - case 'z': - BUFPUSH(endbuf); - break; - - case 'G': - BUFPUSH(begpos); - break; - - /* hex */ - case 'x': - had_mbchar = 0; - c = scan_hex(p, 2, &numlen); - p += numlen; - had_num_literal = 1; - goto numeric_char; - - /* octal */ - case '0': - had_mbchar = 0; - c = scan_oct(p, 3, &numlen); - p += numlen; - had_num_literal = 1; - goto numeric_char; - - /* back-ref or octal */ - case '1': case '2': case '3': - case '4': case '5': case '6': - case '7': case '8': case '9': - PATUNFETCH; - p0 = p; - - had_mbchar = 0; - c1 = 0; - GET_UNSIGNED_NUMBER(c1); - if (!ISDIGIT(c)) PATUNFETCH; - - if (9 < c1 && c1 >= (unsigned int)regnum) { - /* need to get octal */ - c = scan_oct(p0, 3, &numlen) & 0xff; - p = p0 + numlen; - c1 = 0; - had_num_literal = 1; - goto numeric_char; - } - - laststart = b; - BUFPUSH(duplicate); - BUFPUSH(c1); - break; - - case 'M': - case 'C': - case 'c': - p0 = --p; - c = read_special(p, pend, &p0); - if (c > 255) goto invalid_escape; - p = p0; - had_num_literal = 1; - goto numeric_char; - - default: - c = read_backslash(c); - goto normal_char; - } - break; - - case '#': - if (options & MBRE_OPTION_EXTENDED) { - while (p != pend) { - PATFETCH(c); - if (c == '\n') break; - } - break; - } - goto normal_char; - - case ' ': - case '\t': - case '\f': - case '\r': - case '\n': - if (options & MBRE_OPTION_EXTENDED) - break; - - default: - normal_char: /* Expects the character in `c'. */ - had_mbchar = 0; - if (ismbchar(c)) { - had_mbchar = 1; - c1 = p - pattern; - } - numeric_char: - nextp = p + mbclen(c) - 1; - if (!pending_exact || pending_exact + *pending_exact + 1 != b - || *pending_exact >= (c1 ? 0176 : 0177) - || *nextp == '+' || *nextp == '?' - || *nextp == '*' || *nextp == '^' - || *nextp == '{') { - laststart = b; - BUFPUSH(exactn); - pending_exact = b; - BUFPUSH(0); - } - if (had_num_literal || c == 0xff) { - BUFPUSH(0xff); - (*pending_exact)++; - had_num_literal = 0; - } - BUFPUSH(c); - (*pending_exact)++; - if (had_mbchar) { - int len = mbclen(c) - 1; - while (len--) { - PATFETCH_RAW(c); - BUFPUSH(c); - (*pending_exact)++; - } - } - } - } - - if (fixup_alt_jump) - store_jump(fixup_alt_jump, jump, b); - - if (stackp != stackb) - FREE_AND_RETURN(stackb, "unmatched ("); - - /* set optimize flags */ - laststart = bufp->buffer; - if (laststart != b) { - if (*laststart == start_memory) laststart += 3; - if (*laststart == dummy_failure_jump) laststart += 3; - else if (*laststart == try_next) laststart += 3; - if (*laststart == anychar_repeat) { - bufp->options |= MBRE_OPTIMIZE_ANCHOR; - } - else if (*laststart == on_failure_jump) { - int mcnt; - - laststart++; - EXTRACT_NUMBER_AND_INCR(mcnt, laststart); - if (*laststart == charset || *laststart == charset_not) { - p0 = laststart; - mcnt = *++p0; - p0 += mcnt+1; - mcnt = EXTRACT_UNSIGNED_AND_INCR(p0); - p0 += 8*mcnt; - if (*p0 == maybe_finalize_jump) { - bufp->stclass = laststart; - } - } - } - } - - bufp->used = b - bufp->buffer; - bufp->re_nsub = regnum; - laststart = bufp->buffer; - if (laststart != b) { - if (*laststart == start_memory) laststart += 3; - if (*laststart == exactn) { - bufp->options |= MBRE_OPTIMIZE_EXACTN; - bufp->must = laststart+1; - } - } - if (!bufp->must) { - bufp->must = calculate_must_string(bufp->buffer, b); - } - if (current_mbctype == MBCTYPE_SJIS) bufp->options |= MBRE_OPTIMIZE_NO_BM; - else if (bufp->must) { - int i; - int len = (unsigned char)bufp->must[0]; - - for (i=1; i<len; i++) { - if ((unsigned char)bufp->must[i] == 0xff || - (current_mbctype && ismbchar(bufp->must[i]))) { - bufp->options |= MBRE_OPTIMIZE_NO_BM; - break; - } - } - if (!(bufp->options & MBRE_OPTIMIZE_NO_BM)) { - bufp->must_skip = (int *) xmalloc((1 << MBRE_BYTEWIDTH)*sizeof(int)); - bm_init_skip(bufp->must_skip, (unsigned char*)bufp->must+1, - (unsigned char)bufp->must[0], - (unsigned char*)(MAY_TRANSLATE()?translate:0)); - } - } - - bufp->regstart = TMALLOC(regnum, unsigned char*); - bufp->regend = TMALLOC(regnum, unsigned char*); - bufp->old_regstart = TMALLOC(regnum, unsigned char*); - bufp->old_regend = TMALLOC(regnum, unsigned char*); - bufp->reg_info = TMALLOC(regnum, mbre_register_info_type); - bufp->best_regstart = TMALLOC(regnum, unsigned char*); - bufp->best_regend = TMALLOC(regnum, unsigned char*); - FREE_AND_RETURN(stackb, 0); - - invalid_pattern: - FREE_AND_RETURN(stackb, "invalid regular expression"); - - end_of_pattern: - FREE_AND_RETURN(stackb, "premature end of regular expression"); - - too_big: - FREE_AND_RETURN(stackb, "regular expression too big"); - - memory_exhausted: - FREE_AND_RETURN(stackb, "memory exhausted"); - - nested_meta: - FREE_AND_RETURN(stackb, "nested *?+ in regexp"); - - invalid_escape: - FREE_AND_RETURN(stackb, "Invalid escape character syntax"); -} - -void -re_free_pattern(bufp) - struct mbre_pattern_buffer *bufp; -{ - if(bufp){ - if (bufp->buffer) xfree(bufp->buffer); - if (bufp->fastmap) xfree(bufp->fastmap); - if (bufp->must_skip) xfree(bufp->must_skip); - - if (bufp->regstart) xfree(bufp->regstart); - if (bufp->regend) xfree(bufp->regend); - if (bufp->old_regstart) xfree(bufp->old_regstart); - if (bufp->old_regend) xfree(bufp->old_regend); - if (bufp->best_regstart) xfree(bufp->best_regstart); - if (bufp->best_regend) xfree(bufp->best_regend); - if (bufp->reg_info) xfree(bufp->reg_info); - } -} - -/* Store a jump of the form <OPCODE> <relative address>. - Store in the location FROM a jump operation to jump to relative - address FROM - TO. OPCODE is the opcode to store. */ - -static void -store_jump(from, opcode, to) - char *from, *to; - int opcode; -{ - from[0] = (char)opcode; - STORE_NUMBER(from + 1, to - (from + 3)); -} - - -/* Open up space before char FROM, and insert there a jump to TO. - CURRENT_END gives the end of the storage not in use, so we know - how much data to copy up. OP is the opcode of the jump to insert. - - If you call this function, you must zero out pending_exact. */ - -static void -insert_jump(op, from, to, current_end) - int op; - char *from, *to, *current_end; -{ - register char *pfrom = current_end; /* Copy from here... */ - register char *pto = current_end + 3; /* ...to here. */ - - while (pfrom != from) - *--pto = *--pfrom; - store_jump(from, op, to); -} - - -/* Store a jump of the form <opcode> <relative address> <n> . - - Store in the location FROM a jump operation to jump to relative - address FROM - TO. OPCODE is the opcode to store, N is a number the - jump uses, say, to decide how many times to jump. - - If you call this function, you must zero out pending_exact. */ - -static void -store_jump_n(from, opcode, to, n) - char *from, *to; - int opcode; - unsigned n; -{ - from[0] = (char)opcode; - STORE_NUMBER(from + 1, to - (from + 3)); - STORE_NUMBER(from + 3, n); -} - - -/* Similar to insert_jump, but handles a jump which needs an extra - number to handle minimum and maximum cases. Open up space at - location FROM, and insert there a jump to TO. CURRENT_END gives the - end of the storage in use, so we know how much data to copy up. OP is - the opcode of the jump to insert. - - If you call this function, you must zero out pending_exact. */ - -static void -insert_jump_n(op, from, to, current_end, n) - int op; - char *from, *to, *current_end; - unsigned n; -{ - register char *pfrom = current_end; /* Copy from here... */ - register char *pto = current_end + 5; /* ...to here. */ - - while (pfrom != from) - *--pto = *--pfrom; - store_jump_n(from, op, to, n); -} - - -/* Open up space at location THERE, and insert operation OP. - CURRENT_END gives the end of the storage in use, so - we know how much data to copy up. - - If you call this function, you must zero out pending_exact. */ - -#if 0 -static void -insert_op(op, there, current_end) - int op; - char *there, *current_end; -{ - register char *pfrom = current_end; /* Copy from here... */ - register char *pto = current_end + 1; /* ...to here. */ - - while (pfrom != there) - *--pto = *--pfrom; - - there[0] = (char)op; -} -#endif - -/* Open up space at location THERE, and insert operation OP followed by - NUM_1 and NUM_2. CURRENT_END gives the end of the storage in use, so - we know how much data to copy up. - - If you call this function, you must zero out pending_exact. */ - -static void -insert_op_2(op, there, current_end, num_1, num_2) - int op; - char *there, *current_end; - int num_1, num_2; -{ - register char *pfrom = current_end; /* Copy from here... */ - register char *pto = current_end + 5; /* ...to here. */ - - while (pfrom != there) - *--pto = *--pfrom; - - there[0] = (char)op; - STORE_NUMBER(there + 1, num_1); - STORE_NUMBER(there + 3, num_2); -} - - -#define trans_eq(c1, c2, translate) (translate?(translate[c1]==translate[c2]):((c1)==(c2))) -static int -slow_match(little, lend, big, bend, translate) - unsigned char *little, *lend; - unsigned char *big, *bend; - unsigned char *translate; -{ - int c; - - while (little < lend && big < bend) { - c = *little++; - if (c == 0xff) - c = *little++; - if (!trans_eq(*big++, c, translate)) break; - } - if (little == lend) return 1; - return 0; -} - -static int -slow_search(little, llen, big, blen, translate, re_mbctab) - unsigned char *little; - int llen; - unsigned char *big; - int blen; - char *translate; - const unsigned char *re_mbctab; -{ - unsigned char *bsave = big; - unsigned char *bend = big + blen; - register int c; - int fescape = 0; - - c = *little; - if (c == 0xff) { - c = little[1]; - fescape = 1; - } - else if (translate && !ismbchar(c)) { - c = translate[c]; - } - - while (big < bend) { - /* look for first character */ - if (fescape) { - while (big < bend) { - if (*big == c) break; - big++; - } - } - else if (translate && !ismbchar(c)) { - while (big < bend) { - if (ismbchar(*big)) big+=mbclen(*big)-1; - else if (translate[*big] == c) break; - big++; - } - } - else { - while (big < bend) { - if (*big == c) break; - if (ismbchar(*big)) big+=mbclen(*big)-1; - big++; - } - } - - if (slow_match(little, little+llen, big, bend, translate)) - return big - bsave; - - big+=mbclen(*big); - } - return -1; -} - -static void -bm_init_skip(skip, pat, m, translate) - int *skip; - unsigned char *pat; - int m; - const unsigned char *translate; -{ - int j, c; - - for (c=0; c<256; c++) { - skip[c] = m; - } - if (translate) { - for (j=0; j<m-1; j++) { - skip[translate[pat[j]]] = m-1-j; - } - } - else { - for (j=0; j<m-1; j++) { - skip[pat[j]] = m-1-j; - } - } -} - -static int -bm_search(little, llen, big, blen, skip, translate) - unsigned char *little; - int llen; - unsigned char *big; - int blen; - int *skip; - unsigned char *translate; -{ - int i, j, k; - - i = llen-1; - if (translate) { - while (i < blen) { - k = i; - j = llen-1; - while (j >= 0 && translate[big[k]] == translate[little[j]]) { - k--; - j--; - } - if (j < 0) return k+1; - - i += skip[translate[big[i]]]; - } - return -1; - } - while (i < blen) { - k = i; - j = llen-1; - while (j >= 0 && big[k] == little[j]) { - k--; - j--; - } - if (j < 0) return k+1; - - i += skip[big[i]]; - } - return -1; -} - -/* Given a pattern, compute a fastmap from it. The fastmap records - which of the (1 << MBRE_BYTEWIDTH) possible characters can start a string - that matches the pattern. This fastmap is used by re_search to skip - quickly over totally implausible text. - - The caller must supply the address of a (1 << MBRE_BYTEWIDTH)-byte data - area as bufp->fastmap. - The other components of bufp describe the pattern to be used. */ -void -re_compile_fastmap(bufp) - struct mbre_pattern_buffer *bufp; -{ - unsigned char *pattern = (unsigned char*)bufp->buffer; - int size = bufp->used; - register char *fastmap = bufp->fastmap; - register unsigned char *p = pattern; - register unsigned char *pend = pattern + size; - register int j, k; - unsigned is_a_succeed_n; - - - unsigned char *stacka[NFAILURES]; - unsigned char **stackb = stacka; - unsigned char **stackp = stackb; - unsigned char **stacke = stackb + NFAILURES; - int options = bufp->options; - - int current_mbctype = bufp->mbctype; - const unsigned char *re_mbctab = re_mbctab_get(current_mbctype); - - memset(fastmap, 0, (1 << MBRE_BYTEWIDTH)); - bufp->fastmap_accurate = 1; - bufp->can_be_null = 0; - - while (p) { - is_a_succeed_n = 0; - if (p == pend) { - bufp->can_be_null = 1; - break; - } -#ifdef SWITCH_ENUM_BUG - switch ((int)((enum regexpcode)*p++)) -#else - switch ((enum regexpcode)*p++) -#endif - { - case exactn: - if (p[1] == 0xff) { - if (TRANSLATE_P()) - fastmap[translate[p[2]]] = 2; - else - fastmap[p[2]] = 2; - bufp->options |= MBRE_OPTIMIZE_BMATCH; - } - else if (TRANSLATE_P()) - fastmap[translate[p[1]]] = 1; - else - fastmap[p[1]] = 1; - break; - - case begline: - case begbuf: - case endbuf: - case endbuf2: - case wordbound: - case notwordbound: - case wordbeg: - case wordend: - case pop_and_fail: - case push_dummy_failure: - case start_paren: - case stop_paren: - continue; - - case casefold_on: - bufp->options |= MBRE_MAY_IGNORECASE; - case casefold_off: - options ^= MBRE_OPTION_IGNORECASE; - continue; - - case option_set: - options = *p++; - continue; - - case endline: - if (TRANSLATE_P()) - fastmap[translate['\n']] = 1; - else - fastmap['\n'] = 1; - if ((options & MBRE_OPTION_SINGLELINE) == 0 && bufp->can_be_null == 0) - bufp->can_be_null = 2; - break; - - case jump_n: - case finalize_jump: - case maybe_finalize_jump: - case jump: - case jump_past_alt: - case dummy_failure_jump: - case finalize_push: - case finalize_push_n: - EXTRACT_NUMBER_AND_INCR(j, p); - p += j; - if (j > 0) - continue; - /* Jump backward reached implies we just went through - the body of a loop and matched nothing. - Opcode jumped to should be an on_failure_jump. - Just treat it like an ordinary jump. - For a * loop, it has pushed its failure point already; - If so, discard that as redundant. */ - - if ((enum regexpcode)*p != on_failure_jump - && (enum regexpcode)*p != try_next - && (enum regexpcode)*p != succeed_n) - continue; - p++; - EXTRACT_NUMBER_AND_INCR(j, p); - p += j; - if (stackp != stackb && *stackp == p) - stackp--; /* pop */ - continue; - - case try_next: - case start_nowidth: - case stop_nowidth: - case stop_backtrack: - p += 2; - continue; - - case succeed_n: - is_a_succeed_n = 1; - /* Get to the number of times to succeed. */ - EXTRACT_NUMBER(k, p + 2); - /* Increment p past the n for when k != 0. */ - if (k != 0) { - p += 4; - continue; - } - /* fall through */ - - case on_failure_jump: - EXTRACT_NUMBER_AND_INCR(j, p); - if (p + j < pend) { - if (stackp == stacke) { - EXPAND_FAIL_STACK(); - } - *++stackp = p + j; /* push */ - } - else { - bufp->can_be_null = 1; - } - if (is_a_succeed_n) - EXTRACT_NUMBER_AND_INCR(k, p); /* Skip the n. */ - continue; - - case set_number_at: - p += 4; - continue; - - case start_memory: - case stop_memory: - p += 2; - continue; - - case duplicate: - bufp->can_be_null = 1; - fastmap['\n'] = 1; - case anychar_repeat: - case anychar: - for (j = 0; j < (1 << MBRE_BYTEWIDTH); j++) { - if (j != '\n' || (options & MBRE_OPTION_MULTILINE)) - fastmap[j] = 1; - } - if (bufp->can_be_null) { - FREE_AND_RETURN_VOID(stackb); - } - /* Don't return; check the alternative paths - so we can set can_be_null if appropriate. */ - if ((enum regexpcode)p[-1] == anychar_repeat) { - continue; - } - break; - - case wordchar: - for (j = 0; j < 0x80; j++) { - if (SYNTAX(j) == Sword) - fastmap[j] = 1; - } - switch (current_mbctype) { - case MBCTYPE_ASCII: - for (j = 0x80; j < (1 << MBRE_BYTEWIDTH); j++) { - if (SYNTAX(j) == Sword2) - fastmap[j] = 1; - } - break; - case MBCTYPE_EUC: - case MBCTYPE_SJIS: - case MBCTYPE_UTF8: - for (j = 0x80; j < (1 << MBRE_BYTEWIDTH); j++) { - if (re_mbctab[j]) - fastmap[j] = 1; - } - break; - } - break; - - case notwordchar: - for (j = 0; j < 0x80; j++) - if (SYNTAX(j) != Sword) - fastmap[j] = 1; - switch (current_mbctype) { - case MBCTYPE_ASCII: - for (j = 0x80; j < (1 << MBRE_BYTEWIDTH); j++) { - if (SYNTAX(j) != Sword2) - fastmap[j] = 1; - } - break; - case MBCTYPE_EUC: - case MBCTYPE_SJIS: - case MBCTYPE_UTF8: - for (j = 0x80; j < (1 << MBRE_BYTEWIDTH); j++) { - if (!re_mbctab[j]) - fastmap[j] = 1; - } - break; - } - break; - - case charset: - /* NOTE: Charset for single-byte chars never contain - multi-byte char. See set_list_bits(). */ - for (j = *p++ * MBRE_BYTEWIDTH - 1; j >= 0; j--) - if (p[j / MBRE_BYTEWIDTH] & (1 << (j % MBRE_BYTEWIDTH))) { - int tmp = TRANSLATE_P()?translate[j]:j; - fastmap[tmp] = 1; - } - { - unsigned short size; - unsigned long c, beg, end; - - p += p[-1] + 2; - size = EXTRACT_UNSIGNED(&p[-2]); - for (j = 0; j < (int)size; j++) { - c = EXTRACT_MBC(&p[j*8]); - beg = WC2MBC1ST(c); - c = EXTRACT_MBC(&p[j*8+4]); - end = WC2MBC1ST(c); - /* set bits for 1st bytes of multi-byte chars. */ - while (beg <= end) { - /* NOTE: Charset for multi-byte chars might contain - single-byte chars. We must reject them. */ - if (c < 0x100) { - fastmap[beg] = 2; - bufp->options |= MBRE_OPTIMIZE_BMATCH; - } - else if (ismbchar(beg)) - fastmap[beg] = 1; - beg++; - } - } - } - break; - - case charset_not: - /* S: set of all single-byte chars. - M: set of all first bytes that can start multi-byte chars. - s: any set of single-byte chars. - m: any set of first bytes that can start multi-byte chars. - - We assume S+M = U. - ___ _ _ - s+m = (S*s+M*m). */ - /* Chars beyond end of map must be allowed */ - /* NOTE: Charset_not for single-byte chars might contain - multi-byte chars. See set_list_bits(). */ - for (j = *p * MBRE_BYTEWIDTH; j < (1 << MBRE_BYTEWIDTH); j++) - if (!ismbchar(j)) - fastmap[j] = 1; - - for (j = *p++ * MBRE_BYTEWIDTH - 1; j >= 0; j--) - if (!(p[j / MBRE_BYTEWIDTH] & (1 << (j % MBRE_BYTEWIDTH)))) { - if (!ismbchar(j)) - fastmap[j] = 1; - } - { - unsigned short size; - unsigned long c, beg; - int num_literal = 0; - - p += p[-1] + 2; - size = EXTRACT_UNSIGNED(&p[-2]); - if (size == 0) { - for (j = 0x80; j < (1 << MBRE_BYTEWIDTH); j++) - if (ismbchar(j)) - fastmap[j] = 1; - break; - } - for (j = 0,c = 0;j < (int)size; j++) { - unsigned int cc = EXTRACT_MBC(&p[j*8]); - beg = WC2MBC1ST(cc); - while (c <= beg) { - if (ismbchar(c)) - fastmap[c] = 1; - c++; - } - - cc = EXTRACT_MBC(&p[j*8+4]); - if (cc < 0xff) { - num_literal = 1; - while (c <= cc) { - if (ismbchar(c)) - fastmap[c] = 1; - c++; - } - } - c = WC2MBC1ST(cc); - } - - for (j = c; j < (1 << MBRE_BYTEWIDTH); j++) { - if (num_literal) - fastmap[j] = 1; - if (ismbchar(j)) - fastmap[j] = 1; - } - } - break; - - case begpos: - case unused: /* pacify gcc -Wall */ - break; - case fail: - break; - } - - /* Get here means we have successfully found the possible starting - characters of one path of the pattern. We need not follow this - path any farther. Instead, look at the next alternative - remembered in the stack. */ - if (stackp != stackb) - p = *stackp--; /* pop */ - else - break; - } - FREE_AND_RETURN_VOID(stackb); -} - -/* adjust startpos value to the position between characters. */ -int -re_adjust_startpos(bufp, string, size, startpos, range) - struct mbre_pattern_buffer *bufp; - const char *string; - int size, startpos, range; -{ - int current_mbctype = bufp->mbctype; - const unsigned char *re_mbctab = re_mbctab_get(current_mbctype); - - /* Update the fastmap now if not correct already. */ - if (!bufp->fastmap_accurate) { - re_compile_fastmap(bufp); - } - - /* Adjust startpos for mbc string */ - if (current_mbctype && startpos>0 && !(bufp->options&MBRE_OPTIMIZE_BMATCH)) { - int i = 0; - - if (range > 0) { - while (i<size) { - i += mbclen(string[i]); - if (startpos <= i) { - startpos = i; - break; - } - } - } - else { - int w; - - while (i<size) { - w = mbclen(string[i]); - if (startpos < i + w) { - startpos = i; - break; - } - i += w; - } - } - } - return startpos; -} - - -/* Using the compiled pattern in BUFP->buffer, first tries to match - STRING, starting first at index STARTPOS, then at STARTPOS + 1, and - so on. RANGE is the number of places to try before giving up. If - RANGE is negative, it searches backwards, i.e., the starting - positions tried are STARTPOS, STARTPOS - 1, etc. STRING is of SIZE. - In REGS, return the indices of STRING that matched the entire - BUFP->buffer and its contained subexpressions. - - The value returned is the position in the strings at which the match - was found, or -1 if no match was found, or -2 if error (such as - failure stack overflow). */ - -int -re_search(bufp, string, size, startpos, range, regs) - struct mbre_pattern_buffer *bufp; - const char *string; - int size, startpos, range; - struct mbre_registers *regs; -{ - register char *fastmap = bufp->fastmap; - int val, anchor = 0; - - int current_mbctype = bufp->mbctype; - const unsigned char *re_mbctab = re_mbctab_get(current_mbctype); - - /* Check for out-of-range starting position. */ - if (startpos < 0 || startpos > size) - return -1; - - /* Update the fastmap now if not correct already. */ - if (fastmap && !bufp->fastmap_accurate) { - re_compile_fastmap(bufp); - } - - - /* If the search isn't to be a backwards one, don't waste time in a - search for a pattern that must be anchored. */ - if (bufp->used > 0) { - switch ((enum regexpcode)bufp->buffer[0]) { - case begbuf: - begbuf_match: - if (range > 0) { - if (startpos > 0) return -1; - else { - val = re_match(bufp, string, size, 0, regs); - if (val >= 0) return 0; - return val; - } - } - break; - - case begline: - anchor = 1; - break; - - case begpos: - val = re_match(bufp, string, size, startpos, regs); - if (val >= 0) return startpos; - return val; - - default: - break; - } - } - if (bufp->options & MBRE_OPTIMIZE_ANCHOR) { - if (bufp->options&MBRE_OPTION_SINGLELINE) { - goto begbuf_match; - } - anchor = 1; - } - - if (bufp->must) { - int len = ((unsigned char*)bufp->must)[0]; - int pos, pbeg, pend; - - pbeg = startpos; - pend = startpos + range; - if (pbeg > pend) { /* swap pbeg,pend */ - pos = pend; pend = pbeg; pbeg = pos; - } - pend = size; - if (bufp->options & MBRE_OPTIMIZE_NO_BM) { - pos = slow_search(bufp->must+1, len, - string+pbeg, pend-pbeg, - MAY_TRANSLATE()?translate:0, re_mbctab); - } - else { - pos = bm_search(bufp->must+1, len, - string+pbeg, pend-pbeg, - bufp->must_skip, - MAY_TRANSLATE()?translate:0); - } - if (pos == -1) return -1; - if (range > 0 && (bufp->options & MBRE_OPTIMIZE_EXACTN)) { - startpos += pos; - range -= pos; - if (range < 0) return -1; - } - } - - for (;;) { - /* If a fastmap is supplied, skip quickly over characters that - cannot possibly be the start of a match. Note, however, that - if the pattern can possibly match the null string, we must - test it at each starting point so that we take the first null - string we get. */ - - if (fastmap && startpos < size - && bufp->can_be_null != 1 && !(anchor && startpos == 0)) { - if (range > 0) { /* Searching forwards. */ - register unsigned char *p, c; - int irange = range; - - p = (unsigned char*)string+startpos; - - while (range > 0) { - c = *p++; - if (ismbchar(c)) { - int len; - - if (fastmap[c]) - break; - len = mbclen(c) - 1; - while (len--) { - c = *p++; - range--; - if (fastmap[c] == 2) - goto startpos_adjust; - } - } - else { - if (fastmap[MAY_TRANSLATE() ? translate[c] : c]) - break; - } - range--; - } - startpos_adjust: - startpos += irange - range; - } - else { /* Searching backwards. */ - register unsigned char c; - - c = string[startpos]; - c &= 0xff; - if (MAY_TRANSLATE() ? !fastmap[translate[c]] : !fastmap[c]) - goto advance; - } - } - - if (startpos > size) return -1; - if ((anchor || !bufp->can_be_null) && range > 0 && size > 0 && startpos == size) - return -1; - val = re_match(bufp, string, size, startpos, regs); - if (val >= 0) return startpos; - if (val == -2) return -2; - -#ifndef NO_ALLOCA -#ifdef C_ALLOCA - alloca(0); -#endif /* C_ALLOCA */ -#endif /* NO_ALLOCA */ - - if (range > 0) { - if (anchor && startpos < size && - (startpos < 1 || string[startpos-1] != '\n')) { - while (range > 0 && string[startpos] != '\n') { - range--; - startpos++; - } - } - else if (fastmap && (bufp->stclass)) { - register unsigned char *p; - unsigned long c; - int irange = range; - - p = (unsigned char*)string+startpos; - while (range > 0) { - c = *p++; - if (ismbchar(c) && fastmap[c] != 2) { - MBC2WC(c, p); - } - else if (MAY_TRANSLATE()) - c = translate[c]; - if (*bufp->stclass == charset) { - if (!is_in_list(c, bufp->stclass+1)) break; - } - else { - if (is_in_list(c, bufp->stclass+1)) break; - } - range--; - if (c > 256) range--; - } - startpos += irange - range; - } - } - - advance: - if (!range) - break; - else if (range > 0) { - const char *d = string + startpos; - - if (ismbchar(*d)) { - int len = mbclen(*d) - 1; - range-=len, startpos+=len; - if (!range) - break; - } - range--, startpos++; - } - else { - range++, startpos--; - { - const char *s, *d, *p; - - s = string; d = string + startpos; - for (p = d; p-- > s && ismbchar(*p); ) - /* --p >= s would not work on 80[12]?86. - (when the offset of s equals 0 other than huge model.) */ - ; - if (!((d - p) & 1)) { - if (!range) - break; - range++, startpos--; - } - } - } - } - return -1; -} - - - - -/* The following are used for re_match, defined below: */ - -/* Accessing macros used in re_match: */ - -#define IS_ACTIVE(R) ((R).bits.is_active) -#define MATCHED_SOMETHING(R) ((R).bits.matched_something) - - -/* Macros used by re_match: */ - -/* I.e., regstart, regend, and reg_info. */ -#define NUM_REG_ITEMS 3 - -/* I.e., ptr and count. */ -#define NUM_COUNT_ITEMS 2 - -/* Individual items aside from the registers. */ -#define NUM_NONREG_ITEMS 4 - -/* We push at most this many things on the stack whenever we - fail. The `+ 2' refers to PATTERN_PLACE and STRING_PLACE, which are - arguments to the PUSH_FAILURE_POINT macro. */ -#define MAX_NUM_FAILURE_ITEMS (num_regs * NUM_REG_ITEMS + NUM_NONREG_ITEMS) - -/* We push this many things on the stack whenever we fail. */ -#define NUM_FAILURE_ITEMS (last_used_reg * NUM_REG_ITEMS + NUM_NONREG_ITEMS + 1) - -/* This pushes counter information for succeed_n and jump_n */ -#define PUSH_FAILURE_COUNT(ptr) \ - do { \ - int c; \ - EXTRACT_NUMBER(c, ptr); \ - ENSURE_FAIL_STACK(NUM_COUNT_ITEMS); \ - *stackp++ = (unsigned char*)(long)c; \ - *stackp++ = (ptr); \ - num_failure_counts++; \ - } while (0) - -/* This pushes most of the information about the current state we will want - if we ever fail back to it. */ - -#define PUSH_FAILURE_POINT(pattern_place, string_place) \ - do { \ - long last_used_reg, this_reg; \ - \ - /* Find out how many registers are active or have been matched. \ - (Aside from register zero, which is only set at the end.) */ \ - for (last_used_reg = num_regs-1; last_used_reg > 0; last_used_reg--)\ - if (!REG_UNSET(regstart[last_used_reg])) \ - break; \ - \ - ENSURE_FAIL_STACK(NUM_FAILURE_ITEMS); \ - *stackp++ = (unsigned char*)(long)num_failure_counts; \ - num_failure_counts = 0; \ - \ - /* Now push the info for each of those registers. */ \ - for (this_reg = 1; this_reg <= last_used_reg; this_reg++) { \ - *stackp++ = regstart[this_reg]; \ - *stackp++ = regend[this_reg]; \ - *stackp++ = reg_info[this_reg].word; \ - } \ - \ - /* Push how many registers we saved. */ \ - *stackp++ = (unsigned char*)last_used_reg; \ - \ - *stackp++ = pattern_place; \ - *stackp++ = string_place; \ - *stackp++ = (unsigned char*)options; /* current option status */ \ - *stackp++ = (unsigned char*)0; /* non-greedy flag */ \ - } while(0) - -#define NON_GREEDY ((unsigned char*)1) - -#define POP_FAILURE_COUNT() \ - do { \ - unsigned char *ptr = *--stackp; \ - int count = (long)*--stackp; \ - STORE_NUMBER(ptr, count); \ - } while (0) - -/* This pops what PUSH_FAILURE_POINT pushes. */ - -#define POP_FAILURE_POINT() \ - do { \ - long temp; \ - stackp -= NUM_NONREG_ITEMS; /* Remove failure points (and flag). */ \ - temp = (long)*--stackp; /* How many regs pushed. */ \ - temp *= NUM_REG_ITEMS; /* How much to take off the stack. */ \ - stackp -= temp; /* Remove the register info. */ \ - temp = (long)*--stackp; /* How many counters pushed. */ \ - while (temp--) { \ - POP_FAILURE_COUNT(); /* Remove the counter info. */ \ - } \ - num_failure_counts = 0; /* Reset num_failure_counts. */ \ - } while(0) - - /* Registers are set to a sentinel when they haven't yet matched. */ -#define REG_UNSET_VALUE ((unsigned char*)-1) -#define REG_UNSET(e) ((e) == REG_UNSET_VALUE) - -#define PREFETCH if (d == dend) goto fail - - /* Call this when have matched something; it sets `matched' flags for the - registers corresponding to the subexpressions of which we currently - are inside. */ -#define SET_REGS_MATCHED \ - do { unsigned this_reg; \ - for (this_reg = 0; this_reg < num_regs; this_reg++) { \ - if (IS_ACTIVE(reg_info[this_reg])) \ - MATCHED_SOMETHING(reg_info[this_reg]) = 1; \ - else \ - MATCHED_SOMETHING(reg_info[this_reg]) = 0; \ - } \ - } while(0) - -#define AT_STRINGS_BEG(d) ((d) == string) -#define AT_STRINGS_END(d) ((d) == dend) - -#define IS_A_LETTER(d) (SYNTAX(*(d)) == Sword || \ - (current_mbctype ? \ - (re_mbctab[*(d)] && ((d)+mbclen(*(d)))<=dend): \ - SYNTAX(*(d)) == Sword2)) - -#define PREV_IS_A_LETTER(d) ((current_mbctype == MBCTYPE_SJIS)? \ - IS_A_LETTER((d)-(!AT_STRINGS_BEG((d)-1)&& \ - ismbchar((d)[-2])?2:1)): \ - ((current_mbctype && ((d)[-1] >= 0x80)) || \ - IS_A_LETTER((d)-1))) - -static void -init_regs(regs, num_regs) - struct mbre_registers *regs; - unsigned int num_regs; -{ - int i; - - regs->num_regs = num_regs; - if (num_regs < MBRE_NREGS) - num_regs = MBRE_NREGS; - - if (regs->allocated == 0) { - regs->beg = TMALLOC(num_regs, int); - regs->end = TMALLOC(num_regs, int); - regs->allocated = num_regs; - } - else if (regs->allocated < (int)num_regs) { - TREALLOC(regs->beg, num_regs, int); - TREALLOC(regs->end, num_regs, int); - regs->allocated = num_regs; - } - for (i=0; i<(int)num_regs; i++) { - regs->beg[i] = regs->end[i] = -1; - } -} - -/* Match the pattern described by BUFP against STRING, which is of - SIZE. Start the match at index POS in STRING. In REGS, return the - indices of STRING that matched the entire BUFP->buffer and its - contained subexpressions. - - If bufp->fastmap is nonzero, then it had better be up to date. - - The reason that the data to match are specified as two components - which are to be regarded as concatenated is so this function can be - used directly on the contents of an Emacs buffer. - - -1 is returned if there is no match. -2 is returned if there is an - error (such as match stack overflow). Otherwise the value is the - length of the substring which was matched. */ - -int -re_match(bufp, string_arg, size, pos, regs) - struct mbre_pattern_buffer *bufp; - const char *string_arg; - int size, pos; - struct mbre_registers *regs; -{ - register unsigned char *p = (unsigned char*)bufp->buffer; - unsigned char *p1; - - /* Pointer to beyond end of buffer. */ - register unsigned char *pend = p + bufp->used; - - unsigned num_regs = bufp->re_nsub; - - unsigned char *string = (unsigned char*)string_arg; - - register unsigned char *d, *dend; - register int mcnt; /* Multipurpose. */ - int options = bufp->options; - - /* Failure point stack. Each place that can handle a failure further - down the line pushes a failure point on this stack. It consists of - restart, regend, and reg_info for all registers corresponding to the - subexpressions we're currently inside, plus the number of such - registers, and, finally, two char *'s. The first char * is where to - resume scanning the pattern; the second one is where to resume - scanning the strings. If the latter is zero, the failure point is a - ``dummy''; if a failure happens and the failure point is a dummy, it - gets discarded and the next next one is tried. */ - - unsigned char **stacka; - unsigned char **stackb; - unsigned char **stackp; - unsigned char **stacke; - - /* Information on the contents of registers. These are pointers into - the input strings; they record just what was matched (on this - attempt) by a subexpression part of the pattern, that is, the - regnum-th regstart pointer points to where in the pattern we began - matching and the regnum-th regend points to right after where we - stopped matching the regnum-th subexpression. (The zeroth register - keeps track of what the whole pattern matches.) */ - - unsigned char **regstart = bufp->regstart; - unsigned char **regend = bufp->regend; - - /* If a group that's operated upon by a repetition operator fails to - match anything, then the register for its start will need to be - restored because it will have been set to wherever in the string we - are when we last see its open-group operator. Similarly for a - register's end. */ - unsigned char **old_regstart = bufp->old_regstart; - unsigned char **old_regend = bufp->old_regend; - - /* The is_active field of reg_info helps us keep track of which (possibly - nested) subexpressions we are currently in. The matched_something - field of reg_info[reg_num] helps us tell whether or not we have - matched any of the pattern so far this time through the reg_num-th - subexpression. These two fields get reset each time through any - loop their register is in. */ - - mbre_register_info_type *reg_info = bufp->reg_info; - - /* The following record the register info as found in the above - variables when we find a match better than any we've seen before. - This happens as we backtrack through the failure points, which in - turn happens only if we have not yet matched the entire string. */ - - unsigned best_regs_set = 0; - unsigned char **best_regstart = bufp->best_regstart; - unsigned char **best_regend = bufp->best_regend; - - int num_failure_counts = 0; - - int current_mbctype = bufp->mbctype; - const unsigned char *re_mbctab = re_mbctab_get(current_mbctype); - - if (regs) { - init_regs(regs, num_regs); - } - - /* Initialize the stack. */ - stacka = RE_TALLOC(MAX_NUM_FAILURE_ITEMS * NFAILURES, unsigned char*); - stackb = stacka; - stackp = stackb; - stacke = &stackb[MAX_NUM_FAILURE_ITEMS * NFAILURES]; - -#ifdef DEBUG_REGEX - fprintf(stderr, "Entering re_match(%s)\n", string_arg); -#endif - - /* Initialize subexpression text positions to -1 to mark ones that no - ( or ( and ) or ) has been seen for. Also set all registers to - inactive and mark them as not having matched anything or ever - failed. */ - for (mcnt = 0; mcnt < (int)num_regs; mcnt++) { - regstart[mcnt] = regend[mcnt] - = old_regstart[mcnt] = old_regend[mcnt] - = best_regstart[mcnt] = best_regend[mcnt] = REG_UNSET_VALUE; -#ifdef __CHECKER__ - reg_info[mcnt].word = 0; -#endif - IS_ACTIVE (reg_info[mcnt]) = 0; - MATCHED_SOMETHING (reg_info[mcnt]) = 0; - } - - /* Set up pointers to ends of strings. - Don't allow the second string to be empty unless both are empty. */ - - - /* `p' scans through the pattern as `d' scans through the data. `dend' - is the end of the input string that `d' points within. `d' is - advanced into the following input string whenever necessary, but - this happens before fetching; therefore, at the beginning of the - loop, `d' can be pointing at the end of a string, but it cannot - equal string2. */ - - d = string + pos, dend = string + size; - - /* This loops over pattern commands. It exits by returning from the - function if match is complete, or it drops through if match fails - at this starting point in the input data. */ - - for (;;) { -#ifdef DEBUG_REGEX - fprintf(stderr, - "regex loop(%d): matching 0x%02d\n", - p - (unsigned char*)bufp->buffer, - *p); -#endif - /* End of pattern means we might have succeeded. */ - if (p == pend) { - /* If not end of string, try backtracking. Otherwise done. */ - if ((bufp->options & MBRE_OPTION_LONGEST) && d != dend) { - if (best_regs_set) /* non-greedy, no need to backtrack */ - goto restore_best_regs; - while (stackp != stackb && stackp[-1] == NON_GREEDY) { - if (best_regs_set) /* non-greedy, no need to backtrack */ - goto restore_best_regs; - POP_FAILURE_POINT(); - } - if (stackp != stackb) { - /* More failure points to try. */ - - /* If exceeds best match so far, save it. */ - if (! best_regs_set || (d > best_regend[0])) { - best_regs_set = 1; - best_regend[0] = d; /* Never use regstart[0]. */ - - for (mcnt = 1; mcnt < (int)num_regs; mcnt++) { - best_regstart[mcnt] = regstart[mcnt]; - best_regend[mcnt] = regend[mcnt]; - } - } - goto fail; - } - /* If no failure points, don't restore garbage. */ - else if (best_regs_set) { - restore_best_regs: - /* Restore best match. */ - d = best_regend[0]; - - for (mcnt = 0; mcnt < (int)num_regs; mcnt++) { - regstart[mcnt] = best_regstart[mcnt]; - regend[mcnt] = best_regend[mcnt]; - } - } - } - - /* If caller wants register contents data back, convert it - to indices. */ - if (regs) { - regs->beg[0] = pos; - regs->end[0] = d - string; - for (mcnt = 1; mcnt < (int)num_regs; mcnt++) { - if (REG_UNSET(regend[mcnt])) { - regs->beg[mcnt] = -1; - regs->end[mcnt] = -1; - continue; - } - regs->beg[mcnt] = regstart[mcnt] - string; - regs->end[mcnt] = regend[mcnt] - string; - } - } - FREE_AND_RETURN(stackb, (d - pos - string)); - } - - /* Otherwise match next pattern command. */ -#ifdef SWITCH_ENUM_BUG - switch ((int)((enum regexpcode)*p++)) -#else - switch ((enum regexpcode)*p++) -#endif - { - /* ( [or `(', as appropriate] is represented by start_memory, - ) by stop_memory. Both of those commands are followed by - a register number in the next byte. The text matched - within the ( and ) is recorded under that number. */ - case start_memory: - old_regstart[*p] = regstart[*p]; - regstart[*p] = d; - IS_ACTIVE(reg_info[*p]) = 1; - MATCHED_SOMETHING(reg_info[*p]) = 0; - p += 2; - continue; - - case stop_memory: - old_regend[*p] = regend[*p]; - regend[*p] = d; - IS_ACTIVE(reg_info[*p]) = 0; - p += 2; - continue; - - case start_paren: - case stop_paren: - break; - - /* \<digit> has been turned into a `duplicate' command which is - followed by the numeric value of <digit> as the register number. */ - case duplicate: - { - int regno = *p++; /* Get which register to match against */ - register unsigned char *d2, *dend2; - - /* Check if there's corresponding group */ - if (regno >= (int)num_regs) goto fail; - /* Check if corresponding group is still open */ - if (IS_ACTIVE(reg_info[regno])) goto fail; - - /* Where in input to try to start matching. */ - d2 = regstart[regno]; - if (REG_UNSET(d2)) goto fail; - - /* Where to stop matching; if both the place to start and - the place to stop matching are in the same string, then - set to the place to stop, otherwise, for now have to use - the end of the first string. */ - - dend2 = regend[regno]; - if (REG_UNSET(dend2)) goto fail; - for (;;) { - /* At end of register contents => success */ - if (d2 == dend2) break; - - /* If necessary, advance to next segment in data. */ - PREFETCH; - - /* How many characters left in this segment to match. */ - mcnt = dend - d; - - /* Want how many consecutive characters we can match in - one shot, so, if necessary, adjust the count. */ - if (mcnt > dend2 - d2) - mcnt = dend2 - d2; - - /* Compare that many; failure if mismatch, else move - past them. */ - if ((options & MBRE_OPTION_IGNORECASE) - ? memcmp_translate(d, d2, mcnt, re_mbctab) - : memcmp((char*)d, (char*)d2, mcnt)) - goto fail; - d += mcnt, d2 += mcnt; - } - } - break; - - case start_nowidth: - PUSH_FAILURE_POINT(0, d); - if (stackp - stackb > MBRE_DUP_MAX) { - FREE_AND_RETURN(stackb,(-2)); - } - EXTRACT_NUMBER_AND_INCR(mcnt, p); - STORE_NUMBER(p+mcnt, stackp - stackb); - continue; - - case stop_nowidth: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - stackp = stackb + mcnt; - d = stackp[-3]; - POP_FAILURE_POINT(); - continue; - - case stop_backtrack: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - stackp = stackb + mcnt; - POP_FAILURE_POINT(); - continue; - - case pop_and_fail: - EXTRACT_NUMBER(mcnt, p+1); - stackp = stackb + mcnt; - POP_FAILURE_POINT(); - goto fail; - - case anychar: - PREFETCH; - if (ismbchar(*d)) { - if (d + mbclen(*d) > dend) - goto fail; - SET_REGS_MATCHED; - d += mbclen(*d); - break; - } - if (!(options&MBRE_OPTION_MULTILINE) - && (TRANSLATE_P() ? translate[*d] : *d) == '\n') - goto fail; - SET_REGS_MATCHED; - d++; - break; - - case anychar_repeat: - for (;;) { - PUSH_FAILURE_POINT(p, d); - PREFETCH; - if (ismbchar(*d)) { - if (d + mbclen(*d) > dend) - goto fail; - SET_REGS_MATCHED; - d += mbclen(*d); - continue; - } - if (!(options&MBRE_OPTION_MULTILINE) && - (TRANSLATE_P() ? translate[*d] : *d) == '\n') - goto fail; - SET_REGS_MATCHED; - d++; - } - break; - - case charset: - case charset_not: - { - int not; /* Nonzero for charset_not. */ - int part = 0; /* true if matched part of mbc */ - unsigned char *dsave = d + 1; - int cc, c; - - PREFETCH; - cc = c = (unsigned char)*d++; - if (ismbchar(c)) { - if (d + mbclen(c) - 1 <= dend) { - MBC2WC(c, d); - } - } - else if (TRANSLATE_P()) - cc = c = (unsigned char)translate[c]; - - not = is_in_list(c, p); - if (!not && cc != c) { - part = not = is_in_list(cc, p); - } - if (*(p - 1) == (unsigned char)charset_not) { - not = !not; - } - if (!not) goto fail; - - p += 1 + *p + 2 + EXTRACT_UNSIGNED(&p[1 + *p])*8; - SET_REGS_MATCHED; - - if (part) d = dsave; - break; - } - - case begline: - if (size == 0 || AT_STRINGS_BEG(d)) - break; - if (d[-1] == '\n' && !AT_STRINGS_END(d)) - break; - goto fail; - - case endline: - if (AT_STRINGS_END(d)) { - if (size == 0 || d[-1] != '\n') - break; - } - else if (*d == '\n') - break; - goto fail; - - /* Match at the very beginning of the string. */ - case begbuf: - if (AT_STRINGS_BEG(d)) - break; - goto fail; - - /* Match at the very end of the data. */ - case endbuf: - if (AT_STRINGS_END(d)) - break; - goto fail; - - /* Match at the very end of the data. */ - case endbuf2: - if (AT_STRINGS_END(d)) { - if (size == 0 || d[-1] != '\n') - break; - } - /* .. or newline just before the end of the data. */ - if (*d == '\n' && AT_STRINGS_END(d+1)) - break; - goto fail; - - /* `or' constructs are handled by starting each alternative with - an on_failure_jump that points to the start of the next - alternative. Each alternative except the last ends with a - jump to the joining point. (Actually, each jump except for - the last one really jumps to the following jump, because - tensioning the jumps is a hassle.) */ - - /* The start of a stupid repeat has an on_failure_jump that points - past the end of the repeat text. This makes a failure point so - that on failure to match a repetition, matching restarts past - as many repetitions have been found with no way to fail and - look for another one. */ - - /* A smart repeat is similar but loops back to the on_failure_jump - so that each repetition makes another failure point. */ - - /* Match at the starting position. */ - case begpos: - if (d - string == pos) - break; - goto fail; - - case on_failure_jump: - on_failure: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - PUSH_FAILURE_POINT(p + mcnt, d); - continue; - - /* The end of a smart repeat has a maybe_finalize_jump back. - Change it either to a finalize_jump or an ordinary jump. */ - case maybe_finalize_jump: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - p1 = p; - - /* Compare the beginning of the repeat with what in the - pattern follows its end. If we can establish that there - is nothing that they would both match, i.e., that we - would have to backtrack because of (as in, e.g., `a*a') - then we can change to finalize_jump, because we'll - never have to backtrack. - - This is not true in the case of alternatives: in - `(a|ab)*' we do need to backtrack to the `ab' alternative - (e.g., if the string was `ab'). But instead of trying to - detect that here, the alternative has put on a dummy - failure point which is what we will end up popping. */ - - /* Skip over open/close-group commands. */ - while (p1 + 2 < pend) { - if ((enum regexpcode)*p1 == stop_memory || - (enum regexpcode)*p1 == start_memory) - p1 += 3; /* Skip over args, too. */ - else if (/*(enum regexpcode)*p1 == start_paren ||*/ - (enum regexpcode)*p1 == stop_paren) - p1 += 1; - else - break; - } - - if (p1 == pend) - p[-3] = (unsigned char)finalize_jump; - else if (*p1 == (unsigned char)exactn || - *p1 == (unsigned char)endline) { - register int c = *p1 == (unsigned char)endline ? '\n' : p1[2]; - register unsigned char *p2 = p + mcnt; - /* p2[0] ... p2[2] are an on_failure_jump. - Examine what follows that. */ - if (p2[3] == (unsigned char)exactn && p2[5] != c) - p[-3] = (unsigned char)finalize_jump; - else if (p2[3] == (unsigned char)charset || - p2[3] == (unsigned char)charset_not) { - int not; - if (ismbchar(c)) { - unsigned char *pp = p1+3; - MBC2WC(c, pp); - } - /* `is_in_list()' is TRUE if c would match */ - /* That means it is not safe to finalize. */ - not = is_in_list(c, p2 + 4); - if (p2[3] == (unsigned char)charset_not) - not = !not; - if (!not) - p[-3] = (unsigned char)finalize_jump; - } - } - p -= 2; /* Point at relative address again. */ - if (p[-1] != (unsigned char)finalize_jump) { - p[-1] = (unsigned char)jump; - goto nofinalize; - } - /* Note fall through. */ - - /* The end of a stupid repeat has a finalize_jump back to the - start, where another failure point will be made which will - point to after all the repetitions found so far. */ - - /* Take off failure points put on by matching on_failure_jump - because didn't fail. Also remove the register information - put on by the on_failure_jump. */ - case finalize_jump: - if (stackp > stackb && stackp[-3] == d) { - p = stackp[-4]; - POP_FAILURE_POINT(); - continue; - } - POP_FAILURE_POINT(); - /* Note fall through. */ - - /* We need this opcode so we can detect where alternatives end - in `group_match_null_string_p' et al. */ - case jump_past_alt: - /* fall through */ - - /* Jump without taking off any failure points. */ - case jump: - nofinalize: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - if (mcnt < 0 && stackp > stackb && stackp[-3] == d) /* avoid infinite loop */ - goto fail; - p += mcnt; - continue; - - case dummy_failure_jump: - /* Normally, the on_failure_jump pushes a failure point, which - then gets popped at finalize_jump. We will end up at - finalize_jump, also, and with a pattern of, say, `a+', we - are skipping over the on_failure_jump, so we have to push - something meaningless for finalize_jump to pop. */ - PUSH_FAILURE_POINT(0, 0); - goto nofinalize; - - /* At the end of an alternative, we need to push a dummy failure - point in case we are followed by a `finalize_jump', because - we don't want the failure point for the alternative to be - popped. For example, matching `(a|ab)*' against `aab' - requires that we match the `ab' alternative. */ - case push_dummy_failure: - /* See comments just above at `dummy_failure_jump' about the - two zeroes. */ - p1 = p; - /* Skip over open/close-group commands. */ - while (p1 + 2 < pend) { - if ((enum regexpcode)*p1 == stop_memory || - (enum regexpcode)*p1 == start_memory) - p1 += 3; /* Skip over args, too. */ - else if (/*(enum regexpcode)*p1 == start_paren ||*/ - (enum regexpcode)*p1 == stop_paren) - p1 += 1; - else - break; - } - if ((enum regexpcode)*p1 == jump) - p[-1] = unused; - else - PUSH_FAILURE_POINT(0, 0); - break; - - /* Have to succeed matching what follows at least n times. Then - just handle like an on_failure_jump. */ - case succeed_n: - EXTRACT_NUMBER(mcnt, p + 2); - /* Originally, this is how many times we HAVE to succeed. */ - if (mcnt != 0) { - mcnt--; - p += 2; - PUSH_FAILURE_COUNT(p); - STORE_NUMBER_AND_INCR(p, mcnt); - PUSH_FAILURE_POINT(0, 0); - } - else { - goto on_failure; - } - continue; - - case jump_n: - EXTRACT_NUMBER(mcnt, p + 2); - /* Originally, this is how many times we CAN jump. */ - if (mcnt) { - mcnt--; - PUSH_FAILURE_COUNT(p + 2); - STORE_NUMBER(p + 2, mcnt); - goto nofinalize; /* Do the jump without taking off - any failure points. */ - } - /* If don't have to jump any more, skip over the rest of command. */ - else - p += 4; - continue; - - case set_number_at: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - p1 = p + mcnt; - EXTRACT_NUMBER_AND_INCR(mcnt, p); - STORE_NUMBER(p1, mcnt); - continue; - - case try_next: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - if (p + mcnt < pend) { - PUSH_FAILURE_POINT(p, d); - stackp[-1] = NON_GREEDY; - } - p += mcnt; - continue; - - case finalize_push: - POP_FAILURE_POINT(); - EXTRACT_NUMBER_AND_INCR(mcnt, p); - if (mcnt < 0 && stackp > stackb && stackp[-3] == d) /* avoid infinite loop */ - goto fail; - PUSH_FAILURE_POINT(p + mcnt, d); - stackp[-1] = NON_GREEDY; - continue; - - case finalize_push_n: - EXTRACT_NUMBER(mcnt, p + 2); - /* Originally, this is how many times we CAN jump. */ - if (mcnt) { - int pos, i; - - mcnt--; - STORE_NUMBER(p + 2, mcnt); - EXTRACT_NUMBER(pos, p); - EXTRACT_NUMBER(i, p+pos+5); - if (i > 0) goto nofinalize; - POP_FAILURE_POINT(); - EXTRACT_NUMBER_AND_INCR(mcnt, p); - PUSH_FAILURE_POINT(p + mcnt, d); - stackp[-1] = NON_GREEDY; - p += 2; /* skip n */ - } - /* If don't have to push any more, skip over the rest of command. */ - else - p += 4; - continue; - - /* Ignore these. Used to ignore the n of succeed_n's which - currently have n == 0. */ - case unused: - continue; - - case casefold_on: - options |= MBRE_OPTION_IGNORECASE; - continue; - - case casefold_off: - options &= ~MBRE_OPTION_IGNORECASE; - continue; - - case option_set: - options = *p++; - continue; - - case wordbound: - if (AT_STRINGS_BEG(d)) { - if (IS_A_LETTER(d)) break; - else goto fail; - } - if (AT_STRINGS_END(d)) { - if (PREV_IS_A_LETTER(d)) break; - else goto fail; - } - if (PREV_IS_A_LETTER(d) != IS_A_LETTER(d)) - break; - goto fail; - - case notwordbound: - if (AT_STRINGS_BEG(d)) { - if (IS_A_LETTER(d)) goto fail; - else break; - } - if (AT_STRINGS_END(d)) { - if (PREV_IS_A_LETTER(d)) goto fail; - else break; - } - if (PREV_IS_A_LETTER(d) != IS_A_LETTER(d)) - goto fail; - break; - - case wordbeg: - if (IS_A_LETTER(d) && (AT_STRINGS_BEG(d) || !PREV_IS_A_LETTER(d))) - break; - goto fail; - - case wordend: - if (!AT_STRINGS_BEG(d) && PREV_IS_A_LETTER(d) - && (!IS_A_LETTER(d) || AT_STRINGS_END(d))) - break; - goto fail; - - case wordchar: - PREFETCH; - if (!IS_A_LETTER(d)) - goto fail; - if (ismbchar(*d) && d + mbclen(*d) - 1 < dend) - d += mbclen(*d) - 1; - d++; - SET_REGS_MATCHED; - break; - - case notwordchar: - PREFETCH; - if (IS_A_LETTER(d)) - goto fail; - if (ismbchar(*d) && d + mbclen(*d) - 1 < dend) - d += mbclen(*d) - 1; - d++; - SET_REGS_MATCHED; - break; - - case exactn: - /* Match the next few pattern characters exactly. - mcnt is how many characters to match. */ - mcnt = *p++; - /* This is written out as an if-else so we don't waste time - testing `translate' inside the loop. */ - if (TRANSLATE_P()) { - do { - unsigned char c; - - PREFETCH; - if (*p == 0xff) { - p++; - if (!--mcnt - || AT_STRINGS_END(d) - || (unsigned char)*d++ != (unsigned char)*p++) - goto fail; - continue; - } - c = *d++; - if (ismbchar(c)) { - int n; - - if (c != (unsigned char)*p++) - goto fail; - for (n = mbclen(c) - 1; n > 0; n--) - if (!--mcnt /* redundant check if pattern was - compiled properly. */ - || AT_STRINGS_END(d) - || (unsigned char)*d++ != (unsigned char)*p++) - goto fail; - continue; - } - /* compiled code translation needed for ruby */ - if ((unsigned char)translate[c] != (unsigned char)translate[*p++]) - goto fail; - } - while (--mcnt); - } - else { - do { - PREFETCH; - if (*p == 0xff) {p++; mcnt--;} - if (*d++ != *p++) goto fail; - } - while (--mcnt); - } - SET_REGS_MATCHED; - break; - case fail: - goto fail; - break; - } -#ifdef RUBY - CHECK_INTS; -#endif - continue; /* Successfully executed one pattern command; keep going. */ - - /* Jump here if any matching operation fails. */ - fail: - if (stackp != stackb) { - /* A restart point is known. Restart there and pop it. */ - long last_used_reg, this_reg; - - /* If this failure point is from a dummy_failure_point, just - skip it. */ - if (stackp[-4] == 0 || (best_regs_set && stackp[-1] == NON_GREEDY)) { - POP_FAILURE_POINT(); - goto fail; - } - stackp--; /* discard greedy flag */ - options = (int)*--stackp; - d = *--stackp; - p = *--stackp; - /* Restore register info. */ - last_used_reg = (long)*--stackp; - - /* Make the ones that weren't saved -1 or 0 again. */ - for (this_reg = num_regs - 1; this_reg > last_used_reg; this_reg--) { - regend[this_reg] = REG_UNSET_VALUE; - regstart[this_reg] = REG_UNSET_VALUE; - IS_ACTIVE(reg_info[this_reg]) = 0; - MATCHED_SOMETHING(reg_info[this_reg]) = 0; - } - - /* And restore the rest from the stack. */ - for ( ; this_reg > 0; this_reg--) { - reg_info[this_reg].word = *--stackp; - regend[this_reg] = *--stackp; - regstart[this_reg] = *--stackp; - } - mcnt = (long)*--stackp; - while (mcnt--) { - POP_FAILURE_COUNT(); - } - if (p < pend) { - int is_a_jump_n = 0; - int failed_paren = 0; - - p1 = p; - /* If failed to a backwards jump that's part of a repetition - loop, need to pop this failure point and use the next one. */ - switch ((enum regexpcode)*p1) { - case jump_n: - case finalize_push_n: - is_a_jump_n = 1; - case maybe_finalize_jump: - case finalize_jump: - case finalize_push: - case jump: - p1++; - EXTRACT_NUMBER_AND_INCR(mcnt, p1); - - if (mcnt >= 0) break; /* should be backward jump */ - p1 += mcnt; - - if (( is_a_jump_n && (enum regexpcode)*p1 == succeed_n) || - (!is_a_jump_n && (enum regexpcode)*p1 == on_failure_jump)) { - if (failed_paren) { - p1++; - EXTRACT_NUMBER_AND_INCR(mcnt, p1); - PUSH_FAILURE_POINT(p1 + mcnt, d); - } - goto fail; - } - break; - default: - /* do nothing */; - } - } - } - else - break; /* Matching at this starting point really fails. */ - } - - if (best_regs_set) - goto restore_best_regs; - - FREE_AND_RETURN(stackb,(-1)); /* Failure to match. */ -} - - -static int -memcmp_translate(s1, s2, len, re_mbctab) - unsigned char *s1, *s2; - register int len; - const unsigned char *re_mbctab; -{ - register unsigned char *p1 = s1, *p2 = s2, c; - while (len) { - c = *p1++; - if (ismbchar(c)) { - int n; - - if (c != *p2++) return 1; - for (n = mbclen(c) - 1; n > 0; n--) - if (!--len || *p1++ != *p2++) - return 1; - } - else - if (translate[c] != translate[*p2++]) - return 1; - len--; - } - return 0; -} - -void -re_copy_registers(regs1, regs2) - struct mbre_registers *regs1, *regs2; -{ - int i; - - if (regs1 == regs2) return; - if (regs1->allocated == 0) { - regs1->beg = TMALLOC(regs2->num_regs, int); - regs1->end = TMALLOC(regs2->num_regs, int); - regs1->allocated = regs2->num_regs; - } - else if (regs1->allocated < regs2->num_regs) { - TREALLOC(regs1->beg, regs2->num_regs, int); - TREALLOC(regs1->end, regs2->num_regs, int); - regs1->allocated = regs2->num_regs; - } - for (i=0; i<regs2->num_regs; i++) { - regs1->beg[i] = regs2->beg[i]; - regs1->end[i] = regs2->end[i]; - } - regs1->num_regs = regs2->num_regs; -} - -void -re_free_registers(regs) - struct mbre_registers *regs; -{ - if (regs->allocated == 0) return; - if (regs->beg) xfree(regs->beg); - if (regs->end) xfree(regs->end); -} - -/* Functions for multi-byte support. - Created for grep multi-byte extension Jul., 1993 by t^2 (Takahiro Tanimoto) - Last change: Jul. 9, 1993 by t^2 */ -static const unsigned char mbctab_ascii[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -static const unsigned char mbctab_euc[] = { /* 0xA1-0xFE */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 -}; - -static const unsigned char mbctab_sjis[] = { /* 0x80-0x9f,0xE0-0xFF */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 -}; - -static const unsigned char mbctab_utf8[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 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, - 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 0, 0 -}; - -#if 0 -const unsigned char *re_mbctab = mbctab_ascii; - -void -re_mbcinit(mbctype) - int mbctype; -{ - switch (mbctype) { - case MBCTYPE_ASCII: - re_mbctab = mbctab_ascii; - current_mbctype = MBCTYPE_ASCII; - break; - case MBCTYPE_EUC: - re_mbctab = mbctab_euc; - current_mbctype = MBCTYPE_EUC; - break; - case MBCTYPE_SJIS: - re_mbctab = mbctab_sjis; - current_mbctype = MBCTYPE_SJIS; - break; - case MBCTYPE_UTF8: - re_mbctab = mbctab_utf8; - current_mbctype = MBCTYPE_UTF8; - break; - } -} -#endif - -static const unsigned char* -re_mbctab_get(mbctype) - int mbctype; -{ - const unsigned char *p; - - switch (mbctype) { - case MBCTYPE_EUC: - p = mbctab_euc; - break; - case MBCTYPE_SJIS: - p = mbctab_sjis; - break; - case MBCTYPE_UTF8: - p = mbctab_utf8; - break; - default: - p = mbctab_ascii; - break; - } - - return p; -} - -#endif /* HAVE_MBREGEX */ diff --git a/ext/mbstring/mbregex.h b/ext/mbstring/mbregex.h deleted file mode 100644 index 03292bcd38..0000000000 --- a/ext/mbstring/mbregex.h +++ /dev/null @@ -1,213 +0,0 @@ -/* Definitions for data structures and routines for the regular - expression library, version 0.12. - Copyright (C) 1985,89,90,91,92,93,95,96,97,98 Free Software Foundation, Inc. - - This file is part of the GNU C Library. Its master source is NOT part of - the C library, however. The master source lives in /gd/gnu/lib. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ -/* Multi-byte extension added May, 1993 by t^2 (Takahiro Tanimoto) - Last change: May 21, 1993 by t^2 */ -/* modified for Ruby by matz@netlab.co.jp */ - -#ifndef __MB_REGEXP_LIBRARY -#define __MB_REGEXP_LIBRARY - -#include <stddef.h> - -/* Define number of parens for which we record the beginnings and ends. - This affects how much space the `struct re_registers' type takes up. */ -#ifndef MBRE_NREGS -#define MBRE_NREGS 10 -#endif - -#define MBRE_BYTEWIDTH 8 - -#define MBRE_REG_MAX ((1<<MBRE_BYTEWIDTH)-1) - -/* Maximum number of duplicates an interval can allow. */ -#ifndef MBRE_DUP_MAX -#define MBRE_DUP_MAX ((1 << 15) - 1) -#endif - - -/* If this bit is set, then character classes are supported; they are: - [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:], - [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:]. - If not set, then character classes are not supported. */ -#define MBRE_CHAR_CLASSES (1L << 9) - -/* match will be done case insensetively */ -#define MBRE_OPTION_IGNORECASE (1L) -/* perl-style extended pattern available */ -#define MBRE_OPTION_EXTENDED (MBRE_OPTION_IGNORECASE<<1) -/* newline will be included for . */ -#define MBRE_OPTION_MULTILINE (MBRE_OPTION_EXTENDED<<1) -/* ^ and $ ignore newline */ -#define MBRE_OPTION_SINGLELINE (MBRE_OPTION_MULTILINE<<1) -/* works line Perl's /s; it's called POSIX for wrong reason */ -#define MBRE_OPTION_POSIXLINE (MBRE_OPTION_MULTILINE|MBRE_OPTION_SINGLELINE) -/* search for longest match, in accord with POSIX regexp */ -#define MBRE_OPTION_LONGEST (MBRE_OPTION_SINGLELINE<<1) - -#define MBRE_MAY_IGNORECASE (MBRE_OPTION_LONGEST<<1) -#define MBRE_OPTIMIZE_ANCHOR (MBRE_MAY_IGNORECASE<<1) -#define MBRE_OPTIMIZE_EXACTN (MBRE_OPTIMIZE_ANCHOR<<1) -#define MBRE_OPTIMIZE_NO_BM (MBRE_OPTIMIZE_EXACTN<<1) -#define MBRE_OPTIMIZE_BMATCH (MBRE_OPTIMIZE_NO_BM<<1) - -/* For multi-byte char support */ -#define MBCTYPE_ASCII 0 -#define MBCTYPE_EUC 1 -#define MBCTYPE_SJIS 2 -#define MBCTYPE_UTF8 3 - -#if 0 -#if defined IMPORT || defined USEIMPORTLIB -extern __declspec(dllimport) -#elif defined EXPORT -extern __declspec(dllexport) -#else -extern -#endif -const unsigned char *re_mbctab; -#if defined(__STDC__) -void re_mbcinit (int); -#else -void re_mbcinit (); -#endif -#endif - -#undef ismbchar -#define ismbchar(c) re_mbctab[(unsigned char)(c)] -#define mbclen(c) (re_mbctab[(unsigned char)(c)]+1) - -/* Structure used in re_match() */ - -typedef union -{ - unsigned char *word; - struct { - unsigned is_active : 1; - unsigned matched_something : 1; - } bits; -} mbre_register_info_type; - -/* This data structure is used to represent a compiled pattern. */ - -struct mbre_pattern_buffer - { - char *buffer; /* Space holding the compiled pattern commands. */ - int allocated; /* Size of space that `buffer' points to. */ - int used; /* Length of portion of buffer actually occupied */ - char *fastmap; /* Pointer to fastmap, if any, or zero if none. */ - /* re_search uses the fastmap, if there is one, - to skip over totally implausible characters. */ - char *must; /* Pointer to exact pattern which strings should have - to be matched. */ - int *must_skip; /* Pointer to exact pattern skip table for bm_search */ - char *stclass; /* Pointer to character class list at top */ - long options; /* Flags for options such as extended_pattern. */ - long re_nsub; /* Number of subexpressions found by the compiler. */ - char fastmap_accurate; - /* Set to zero when a new pattern is stored, - set to one when the fastmap is updated from it. */ - char can_be_null; /* Set to one by compiling fastmap - if this pattern might match the null string. - It does not necessarily match the null string - in that case, but if this is zero, it cannot. - 2 as value means can match null string - but at end of range or before a character - listed in the fastmap. */ - - /* stack & working area for re_match() */ - unsigned char **regstart; - unsigned char **regend; - unsigned char **old_regstart; - unsigned char **old_regend; - mbre_register_info_type *reg_info; - unsigned char **best_regstart; - unsigned char **best_regend; - - int mbctype; - }; - -typedef struct mbre_pattern_buffer mb_regex_t; - -/* Structure to store register contents data in. - - Pass the address of such a structure as an argument to re_match, etc., - if you want this information back. - - For i from 1 to MBRE_NREGS - 1, start[i] records the starting index in - the string of where the ith subexpression matched, and end[i] records - one after the ending index. start[0] and end[0] are analogous, for - the entire pattern. */ - -struct mbre_registers - { - int allocated; - int num_regs; - int *beg; - int *end; - }; - -#if 0 -/* Type for byte offsets within the string. POSIX mandates this. */ -typedef size_t regoff_t; - -/* POSIX specification for registers. Aside from the different names than - `mbre_registers', POSIX uses an array of structures, instead of a - structure of arrays. */ -typedef struct -{ - regoff_t rm_so; /* Byte offset from string's start to substring's start. */ - regoff_t rm_eo; /* Byte offset from string's start to substring's end. */ -} regmatch_t; -#endif - - -#ifdef __STDC__ - -extern char *mbre_compile_pattern (const char *, int, struct mbre_pattern_buffer *); -void mbre_free_pattern (struct mbre_pattern_buffer *); -/* Is this really advertised? */ -extern int mbre_adjust_startpos (struct mbre_pattern_buffer *, const char*, int, int, int); -extern void mbre_compile_fastmap (struct mbre_pattern_buffer *); -extern int mbre_search (struct mbre_pattern_buffer *, const char*, int, int, int, - struct mbre_registers *); -extern int mbre_match (struct mbre_pattern_buffer *, const char *, int, int, - struct mbre_registers *); -extern void mbre_set_casetable (const char *table); -extern void mbre_copy_registers (struct mbre_registers*, struct mbre_registers*); -extern void mbre_free_registers (struct mbre_registers*); - -#else /* !__STDC__ */ - -extern char *mbre_compile_pattern (); -void mbre_free_pattern (); -/* Is this really advertised? */ -extern int mbre_adjust_startpos (); -extern void mbre_compile_fastmap (); -extern int mbre_search (); -extern int mbre_match (); -extern void mbre_set_casetable (); -extern void mbre_copy_registers (); -extern void mbre_free_registers (); - -#endif /* __STDC__ */ - -#endif /* !__MB_REGEXP_LIBRARY */ diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index e90c6967b8..581970f379 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -75,10 +75,6 @@ #endif /* ZEND_MULTIBYTE */ #if HAVE_MBSTRING - -#if HAVE_MBREGEX -#include "mbregex.h" -#endif /* }}} */ /* {{{ prototypes */ @@ -171,21 +167,6 @@ static const struct mb_overload_def mb_ovld[] = { }; /* }}} */ -#if HAVE_MBREGEX -struct def_mbctype_tbl { - enum mbfl_no_encoding mbfl_encoding; - int regex_encoding; -}; - -const struct def_mbctype_tbl mbctype_tbl[] = { - {mbfl_no_encoding_ascii,MBCTYPE_ASCII}, - {mbfl_no_encoding_euc_jp,MBCTYPE_EUC}, - {mbfl_no_encoding_sjis,MBCTYPE_SJIS}, - {mbfl_no_encoding_utf8,MBCTYPE_UTF8}, - {mbfl_no_encoding_pass,-1} -}; -#endif - /* {{{ function_entry mbstring_functions[] */ function_entry mbstring_functions[] = { PHP_FE(mb_convert_case, NULL) @@ -524,9 +505,6 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output) static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) { enum mbfl_no_encoding no_encoding; -#if HAVE_MBREGEX - const struct def_mbctype_tbl *p = NULL; -#endif if (new_value == NULL) { return SUCCESS; } @@ -536,14 +514,13 @@ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) MBSTRG(internal_encoding) = no_encoding; MBSTRG(current_internal_encoding) = no_encoding; #if HAVE_MBREGEX - p=&(mbctype_tbl[0]); - while (p->regex_encoding >= 0){ - if (p->mbfl_encoding == MBSTRG(internal_encoding)){ - MBSTRG(default_mbctype) = p->regex_encoding; - MBSTRG(current_mbctype) = p->regex_encoding; - break; - } - p++; + { + php_mb_reg_char_encoding mbctype; + mbctype = php_mb_regex_name2mbctype(new_value); + if (mbctype == REGCODE_UNDEF) { + mbctype = REGCODE_EUCJP; + } + MBSTRG(current_mbctype) = MBSTRG(default_mbctype) = mbctype; } #endif #ifdef ZEND_MULTIBYTE @@ -900,8 +877,11 @@ PHP_RSHUTDOWN_FUNCTION(mbstring) /* {{{ PHP_MINFO_FUNCTION(mbstring) */ PHP_MINFO_FUNCTION(mbstring) { + char buf[32]; + php_info_print_table_start(); php_info_print_table_row(2, "Multibyte Support", "enabled"); + php_info_print_table_row(2, "Multibyte string engine", "libmbfl"); #if defined(HAVE_MBSTR_JA) php_info_print_table_row(2, "Japanese support", "enabled"); #endif @@ -921,7 +901,10 @@ PHP_MINFO_FUNCTION(mbstring) php_info_print_table_row(2, "HTTP input encoding translation", "enabled"); } #if defined(HAVE_MBREGEX) - php_info_print_table_row(2, "Multibyte (japanese) regex support", "enabled"); + php_info_print_table_row(2, "Multibyte (japanese) regex support", "enabled"); + sprintf(buf, "%d.%d.%d", + ONIGURUMA_VERSION_MAJOR,ONIGURUMA_VERSION_MINOR,ONIGURUMA_VERSION_TEENY); + php_info_print_table_row(2, "Multibyte regex (oniguruma) version", buf); #endif php_info_print_table_end(); diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h index 197e160ecc..7e726294b2 100644 --- a/ext/mbstring/mbstring.h +++ b/ext/mbstring/mbstring.h @@ -66,7 +66,7 @@ #if HAVE_MBSTRING -#include "mbfilter.h" +#include "ext/mbstring/libmbfl/mbfl/mbfilter.h" #include "SAPI.h" #define PHP_MBSTRING_API 20021024 diff --git a/ext/mbstring/oniguruma/COPYING b/ext/mbstring/oniguruma/COPYING new file mode 100644 index 0000000000..7913cbf23f --- /dev/null +++ b/ext/mbstring/oniguruma/COPYING @@ -0,0 +1,32 @@ +OniGuruma LICENSE +----------------- + +When this software is partly used or it is distributed with Ruby, +this of Ruby follows the license of Ruby. +It follows the BSD license in the case of the one except for it. + +/*- + * Copyright (c) 2002 K.Kosako <kosako@sofnec.co.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff --git a/ext/mbstring/oniguruma/HISTORY b/ext/mbstring/oniguruma/HISTORY new file mode 100644 index 0000000000..d9627fced7 --- /dev/null +++ b/ext/mbstring/oniguruma/HISTORY @@ -0,0 +1,517 @@ +History + +2003/07/04: Version 1.9.1 + +2003/07/04: [new] add REG_OPTION_CAPTURE_ONLY_NAMED_GROUP. (thanks .NET) +2003/07/04: [spec] check mbuf member in the case of + REG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC in parse_char_class(). +2003/07/04: [impl] typo REG_SYN_WARN_FOR_CC_OP_NOT_ESCAPEED. + should be REG_SYN_WARN_FOR_CC_OP_NOT_ESCAPED. +2003/07/04: [bug] conflict values on REG_SYN_WARN_FOR_CC_OP_NOT_ESCAPEED and + REG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC. (thanks nobu) +2003/07/03: [spec] add REG_SYN_OP_ESC_CONTROL_CHAR flag. +2003/07/03: [spec] remove REG_SYN_OP_ESC_OCTAL3 and REG_SYN_OP_ESC_X_HEX2 + flag from RegSyntaxGnuRegex. +2003/07/03: [spec] remove REG_SYN_OP_NON_GREEDY flag from RegSyntaxGnuRegex. +2003/07/02: [dist] fix doc/RE. +2003/07/01: [impl] add config flag USE_VARIABLE_SYNTAX. + (turn off variable syntax on Ruby) +2003/07/01: [spec] add syntax behavior REG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND. +2003/06/30: [spec] allow different length top-level alternatives + in look-behind. ex. (?<=abc|abcd), (?<!a|bc) +2003/06/26: [spec] add option REG_OPTION_NEGATE_SINGLELINE. +2003/06/26: [spec] should default on REG_OPTION_SINGLELINE + for REG_SYNTAX_PERL and REG_SYNTAX_JAVA. +2003/06/26: [impl] add options member to RegStntaxType. +2003/06/26: [spec] don't change the meaning of '\Z' for REG_OPTION_SINGLELINE. +2003/06/25: [dist] don't use option REG_NEWLINE for sample/posix.c. +2003/06/25: [dist] modify testconv.rb. + should match and convert double quoted string data. + ex. x(/\ca/, "\001", 0, 1) +2003/06/25: [impl] add REG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL and + REG_SYN_OP2_ESC_M_BAR_META. +2003/06/25: [impl] add REG_SYN_OP_ESC_OCTAL3 and REG_SYN_OP_ESC_X_HEX2. +2003/06/24: [impl] add REG_SYN_OP2_ESC_V_VTAB. (\v is VTAB) +2003/06/24: [bug] should invert REG_OPTION_SINGLELINE flag + in REG_SYN_OP2_OPTION_PERL. +2003/06/24: [impl] add REG_SYN_OP2_OPTION_PERL and REG_SYN_OP2_OPTION_RUBY. + meaning of (?m) and (?s) are depend on syntax. + +2003/06/20: Version 1.9.0 + +2003/06/20: [spec] \Q...\E is not effective on REG_SYNTAX_RUBY. +2003/06/19: [inst] rename regex.h to oniguruma.h. +2003/06/18: [impl] change REG_EXTERN setting condition. (__CYGWIN__) +2003/06/18: [bug] return wrong result UTF-8 case in regex_mb2wc(). +2003/06/18: [impl] add REG_SYN_OP2_POSSESSIVE_INTERVAL. a{n,m}+ +2003/06/18: [new] add REG_SYNTAX_JAVA. +2003/06/18: [spec] add REG_SYN_OP_QUOTE. +2003/06/18: [spec] add op2 member to RegSyntaxType. + rename some REG_SYN_OP_XXX to REG_SYN_OP2. +2003/06/16: [new] Perl-like quotation operator \Q, \E. +2003/06/16: [spec] should not control ignore case mode by escaped char. + ex. /\J/i =~ "j", /[\J]/i =~ "j" (same as Perl) +2003/06/13: [bug] modify onigposix.h. +2003/06/13: [bug] should use -DIMPORT for link with DLL in win32/Makefile. +2003/06/13: [dist] add sample/names.c +2003/06/12: [bug] range should be from - 1 in not_wc_range_buf(). +2003/06/12: [spec] should warn for '-' befor '&&' operator in char-class. +2003/06/12: [new] add REG_SYNTAX_PERL. +2003/06/12: [spec] add syntax behavior REG_SYN_WARN_FOR_CC_OP_NOT_ESCAPEED. +2003/06/12: [spec] invalid POSIX bracket should be error. ex. [[:upper :]] +2003/06/11: [new] char-class in char-class (as Java(TM)). +2003/06/11: [spec] change AND operator in char-class from &&[..] to &&. +2003/06/04: [spec] {n,m}+ should not be possessive operator. + ex. a{3}+ should be (?:a{3})+ +2003/06/03: [bug] should compare strings with min-length in is_not_included(). +2003/06/03: [impl] automatic possessivate optimization. a*b ==> (?>a*)b + (thanks Jeffrey E. F. Friedl) +2003/06/02: [impl] remove multibyte-BitSet for OP_CCLASS_MB/OP_CCLASS_MB_NOT. +2003/05/30: [new] char class intersection operator &&[...] like Java(TM). + (thanks akr) +2003/05/30: [bug] should use bbuf_free() for CClassNode in regex_node_free(). +2003/05/29: [bug] wrong usage of syntax REG_SYN_ALLOW_EMPTY_RANGE_IN_CC. + /[d-a]/ should be error. +2003/05/28: [impl] optimize stop-backtrack compiled code. + (/(?>a*)/, /(?>\w+)/ etc...) + add OP_POP opcode. +2003/05/28: [new] possessive repeat operator. (?+, *+, ++, {n,m}+) +2003/05/27: [spec] '-' at beginning of char-class should be warn only if + it is start of range. (ex. /[--a]/) +2003/05/27: [spec] should not warn for right bracket at beginning of pattern. + ex. /]aaa/ +2003/05/27: [spec] change CCEND_ESC_WARN() from VERB_WARNING() to WARNING(). +2003/05/27: [spec] /[]aaa/ should be empty char-class error. + /[]aaa]/ should be warn for 'without backslash'. + (add char_exist_check() in regparse.c) +2003/05/26: [bug] OP_REPEAT in recursive subexp call. + ex. /(?<n>(a|b\g<n>c){3,5})/.match("baaaaca") => "baaaaca" + was wrong result. (should be "aaaa") +2003/05/26: [impl] add num_call member to regex_t. +2003/05/26: [impl] add repeat_range member to regex_t. + (for delete upper,lower members from StackType.u.repeat) +2003/05/26: [bug] change print_names() to external regex_print_names(). +2003/05/26: [tune] change OP_NULL_CHECK_END process in match_at(). +2003/05/26: [spec] change CCEND_ESC_WARN() from WARNING() to VERB_WARNING(). +2003/05/26: [spec] remove POSIXLINE option. (?p:...) + (be made the same as Ruby.) +2003/05/22: [spec] use OP_NULL_CHECK_XXX only if repeat is infinite. + prev. /(?:()|()){0,10}\1\2/ =~ "" ==> FAIL + now /(?:()|()){0,10}\1\2/ =~ "" ==> MATCH + +2003/05/22: [impl] change target_empty setting condition in setup_tree(). +2003/05/19: [impl] avoid zero length repeat optimization. (thanks matz) + /()*/ ==> /()?/, /()+/ ==> /()/ etc... +2003/05/19: [impl] minor changes for gcc -Wall. (-DREG_DEBUG_STATISTICS case) +2003/05/19: [spec] rename regex_foreach_names() to regex_foreach_name(). +2003/05/16: [new] add --with-statistics option to configure. +2003/05/16: [bug] move RegOpInfo[] definition to regint.h. +2003/05/16: [new] add regex_version(). + +2003/05/14: Version 1.8.6 + +2003/05/14: [bug] use _vsnprintf() on Win32. +2003/05/14: [spec] define USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE. + (/\n$/ =~ "\n", /\n\Z/ =~ "\n") [ruby-dev:20125] +2003/05/14: [impl] minor changes for gcc -Wall. +2003/05/14: [impl] add string.h check in AC_CHECK_HEADERS(). +2003/05/13: [impl] minor changes for gcc -Wall. +2003/05/13: [impl] add regex_snprintf_with_pattern(). +2003/05/13: [spec] add warning for char class meta character without escape + in Ruby mode ('[', '-', ']'). +2003/05/13: [impl] define WARNING() and VERB_WARNING() in regint.h. +2003/05/13: [bug] correct is_code_ascii() for /[[:ascii:]]/. +2003/05/12: [dist] add regular expression document (doc/RE). +2003/05/12: [spec] specification of $(END_LINE) was made the same as Ruby 1.8. + [ruby-dev:20130] (thanks matz) +2003/05/12: [memo] shifted to Subversion(version 0.21.0) from CVS. + +2003/03/19: Version 1.8.5 + +2003/03/19: [impl] change REG_EXTERN definition. (thanks nobu) +2003/03/19: [impl] abbreviation for long error_par in regex_error_code_to_str(). +2003/03/18: [dist] change re.c.XXX.patch for GNU regex API changes. +2003/03/18: [spec] change API regex_new(), regex_recompile() and + regex_error_code_to_str(). + change API re_compile_pattern() and re_recompile_pattern(). +2003/03/18: [spec] replace REGERR_END_PATTERN_AT_GROUP_{COMMENT|OPTION} to + REGERR_END_PATTERN_IN_GROUP. +2003/03/17: [impl] should free err_arg. +2003/03/17: [bug] mistake(high -> to) in add_wc_range_to_buf(). +2003/03/17: [spec] add err_arg argument to regex_new() and regex_recompile(). + for detail error message. (thanks akr) + +2003/03/12: Version 1.8.4 + +2003/03/12: [tune] use cached value of effect node in get_min_match_length(). +2003/03/12: [bug] escaped alphabet should be TK_RAW_BYTE + in fetch_token() and fetch_token_in_cc(). +2003/03/12: [spec] change named backref and subexp call format. + backref: \k<name>, call: \g<name> (thanks akr) +2003/03/11: [inst] add regparse.[ch] in win32/Makefile. +2003/03/11: [bug] if UNALIGNED_WORD_ACCESS isn't setted + then compile error in unset_addr_list_fix(). (thanks knu) +2003/03/10: [impl] divide regcomp.c to regcomp.c, regparse.c and regparse.h. +2003/03/10: [bug] should handle multi-byte code name in fetch_name(). +2003/03/10: [spec] remove REGERR_TABLE_FOR_IGNORE_CASE_IS_NOT_SETTED. +2003/03/10: [spec] support POSIX API option REG_NOSUB. + add comp_options member to POSIX API regex_t. + +2003/03/10: Version 1.8.3 + +2003/03/10: [bug] can not compile with Ruby 1.6.8. + (inconsistent st.h with 1.6 and 1.8) + use hash table on Ruby 1.8 only. +2003/03/10: [spec] forbid to use '\' in group name. +2003/03/08: [impl] remove check_backref_number(). +2003/03/08: [bug] called group in 0-repeat should not be eliminated from + compile code. ex. /(?*n)(?<n>){0}/ (thanks akr) + add is_refered member to QualifierNode. +2003/03/07: [impl] use hash table(st.[ch]) for implementation of name table. + (enable on Ruby in default) +2003/03/07: [new] add regex_foreach_names(). +2003/03/06: [impl] add member reg->stack_pop_level. +2003/03/06: [impl] add operator OP_MEMORY_START and member reg->backtrack_mem. +2003/03/06: [bug] if REG_OPTION_FIND_LONGEST or REG_OPTION_NOT_EMPTY, + should handle backtrack of MEM_END. + add OP_MEMORY_END_PUSH and OP_MEMORY_END_PUSH_REC. +2003/03/06: [impl] rename OP_MEMORY_END_PUSH to OP_MEMORY_END_MARK. +2003/03/06: [spec] change error messages. +2003/03/06: [tune] add tiny_pop check in STACK_POP. + +2003/03/05: Version 1.8.2 + +2003/03/05: [impl] use cache info in EFFECT_MEMORY case + in optimize_node_info(). +2003/03/05: [impl] add EFFECT_MEMORY node reference count check + in optimize_node_left(). +2003/03/05: [impl] add min-len, max-len, char-len cache in EffectNode. +2003/03/05: [spec] allow to call in look behind. ex. /(?<=(?*a))/ +2003/03/05: [bug] forgotten N_ANCHOR case in check_backref_number(), + subexp_inf_recursive_check_trav() etc... +2003/03/05: [impl] rename USE_ONIGURUMA_EXTENSION to USE_SBMB_CLASS. +2003/03/04: [impl] add CALL-node info in optimize_node_left(). +2003/03/04: [spec] prohibit left recursion of subexp call. ex. (?<n>|(?*n)a) + add subexp_inf_recursive_check_trav(). +2003/03/04: [spec] rename REG_SYN_STRICT_CHECK_BACKREF_NUMBER + to REG_SYN_STRICT_CHECK_BACKREF +2003/03/03: [bug] /(?<n>a(?*n)|)/ isn't infinite recursion. + fix N_LIST case in subexp_recursive_check(). (thanks akr) +2003/03/03: [bug] /(?<n>|(?*n))+/ segmentation fault. + should re-allocate in unset_addr_list_add(). (thanks akr) + +2003/03/01: Version 1.8.1 + +2003/03/01: [bug] change STACK_GET_MEM_START() and STACK_PUSH_MEM_END(). +2003/03/01: [new] add reg_name_to_group_numbers() to POSIX API. +2003/03/01: [impl] use OP_MEMORY_END_PUSH in callable subexp compiled code + only if subexp is recursive. +2003/03/01: [spec] rename regex_name_to_backrefs() to + regex_name_to_group_numbers(). +2003/02/28: [impl] use function stack_double() instead of macro. +2003/02/28: [new] subexp call. (?*name) (thanks akr) +2003/02/28: [spec] add match stack limit check. (MATCH_STACK_LIMIT_SIZE) +2003/02/28: [impl] check recursive subexp call. +2003/02/28: [impl] add opcode OP_MEMORY_END_PUSH for callable subexp. +2003/02/28: [impl] add opcode OP_CALL, OP_RETURN. + add stack type STK_CALL_FRAME, STK_RETURN, STK_MEM_END. +2003/02/26: [spec] add new syntax behavior REG_SYN_STRICT_CHECK_BACKREF_NUMBER. + if it is setted, then error /(\1)/, /\1(..)/ etc... +2003/02/26: [spec] if backref number is greater than max group number, + then return compile error. (REGERR_INVALID_BACKREF_NUMBER) +2003/02/26: [tune] bad implemented N_ALT case in get_min_match_length(). +2003/02/26: [dist] auto update testc.c and win32/testc.c in dist target. +2003/02/26: [impl] add -win option to testconv.rb. +2003/02/25: [spec] allow to assign same name to different group. + add OP_BACKREF_MULTI. +2003/02/24: [impl] reduce redundant repeat of empty target. + ex. /()*/ ==> /()?/, /()+/ ==> /()/, /(?:)+/ ==> // +2003/02/24: [impl] change condition in regex_is_allow_reverse_match(). +2003/02/24: [impl] convert i(/../, ...) functions in testconv.rb. +2003/02/24: [impl] change name table struct. + +2003/02/22: Version 1.8.0 + +2003/02/22: [new] named subexp, named back reference. (thanks akr) + define: (?<name>...), back-ref: \g<name> +2003/02/22: [impl] use str_node_can_be_split(). +2003/02/21: [dist] add sample/posix.c +2003/02/21: [spec] rename some error code symbols. +2003/02/21: [spec] max number of multibyte ranges(255) is small. + 255 --> 1000. (thanks MoonWolf) +2003/02/20: [new] supported Basic Regular Expression(BRE) in POSIX API. + (REG_EXTENDED option: Extended RE) +2003/02/20: [new] variable syntax. + +2003/02/12: Version 1.7.2 + +2003/02/12: [bug] mismatch /\?a/i.match('?A'). + check raw value in scan_make_node() and scan_backslash(). + (thanks Nobu) +2003/02/12: [impl] rename 'max_mem' to 'num_mem' in regex_t. +2003/02/12: [impl] rename 'code' to 'enc' in regex_t. +2003/02/12: [spec] remove transtable argument in regex_new and regex_recompile. + remove transtable member in regex_t. +2003/02/10: [inst] change backup file suffix name from '.orig' to '.ruby_orig'. + (win32/Makefile) +2003/02/10: [spec] number check in scan_char_class() ignore-case mode. + ex. /[\x58-\x64]/i +2003/02/10: [impl] don't use OP_MEMORY_END_PUSH (and STK_MEM_END). +2003/02/10: [impl] lift up head_exact value from child qualifier node to parent. +2003/02/10: [tune] change stack type values. +2003/02/10: [dist] add HISTORY. +2003/02/08: [tune] change stack type values. +2003/02/08: [tune] add STACK_BASE_CHECK(). +2003/02/08: [tune] add STACK_PUSH_ENSURED(). +2003/02/08: [dist] change contents of doc/API. +2003/02/07: [inst] change backup file suffix name from '.orig' to '.ruby_orig'. +2003/02/07: [spec] range in char-class should be same spec. with Ruby + in ignore-case mode. (ex. /[A-c]/i == /[a-c]/i) + (thanks MoonWolf) +2003/02/07: [spec] [!--] should be allowed. (thanks MoonWolf) +2003/02/07: [dist] refresh re.c.180.patch for re.c (2003-02-06). + +2003/02/07: Version 1.7.1 + +2003/02/07: [impl] check first byte of string in ignore-case mode. + (get_head_exact_node()) +2003/02/07: [impl] remove redundant statements in setup_tree(). +2003/02/06: [new] create Win32 DLL. +2003/02/06: [impl] use P_() macro for function prototype. +2003/02/06: [impl] add HAVE_PROTOTYPE, HAVE_STDARG_PROTOTYPES in + configure.in and config.h.in. +2003/02/06: [spec] /[0-9-a]/ is allowed as usual char '-' and 'a' in Ruby. + add USE_BETTER_COMPATIBILITY_FOR_ORIGINAL_REGEX in + regint.h. (thanks MoonWolf) +2003/02/06: [spec] rename REG_MBCTYPE_XXXX to REG_ENCODING_XXXX in onigposix.h. +2003/02/05: [spec] rename MBCTYPE_XXXX to REG_MBCTYPE_XXXX in onigposix.h. +2003/02/05: [spec] add POSIX API error REG_EONIG_THREAD to onigposix.h. +2003/02/05: [dist] add .cvsignore file. + +2003/02/04: Version 1.7 + +2003/02/04: [bug] typo miss in regex_region_copy(). +2003/02/04: [impl] change THREAD_PASS macro. (regint.h) +2003/02/04: [dist] add API document file doc/API. +2003/02/04: [tune] if sub_anchor has ANCHOR_BEGIN_LINE then + set REG_OPTIMIZE_EXACT_BM in set_optimize_exact_info(). +2003/02/04: [spec] reimplement regex_clone() and it is obsoleted. +2003/02/04: [bug] add REGERR_OVER_THREAD_PASS_LIMIT_COUNT + to regerror.c regposix.c. +2003/02/03: [bug] Hankaku-Kana may be second byte in Shift_JIS + regex_is_allow_reverse_match(). +2003/02/03: [impl] add optimization type REG_OPTIMIZE_EXACT_BM_NOT_REV. + remove exact_allow_reverse_match member in regex_t. +2003/02/03: [impl] add exact_allow_reverse_match member in regex_t. +2003/02/03: [impl] compile-search conflict in regex_search() is handled. +2003/02/01: [tune] decrease regex_region_clear() calling from regex_search(). +2003/02/01: [tune] remove region argument from match_at(). +2003/01/31: [tune] don't use strlen() in regexec() and regcomp(). +2003/01/31: [tune] decrease regex_reduce_chain() calling in regex_search(). +2003/01/31: [bug] STRING_CMP() in regexec.c was wrong in ignore-case. +2003/01/31: [impl] convert to lower-case char at string compile time. + change SBTRANSCMP() in regexec.c. +2003/01/31: [impl] rename TTRANS() to TOLOWER(). +2003/01/30: [bug] .c.o --> .c.obj in win32\Makefile. +2003/01/30: [impl] add -DNOT_RUBY to Makefile.in. + NOT_RUBY is refered in regint.h for escape double + including config.h. +2003/01/30: [impl] when string hasn't case ambiguity, don't compile + to ignore case opcode. +2003/01/29: [impl] add SJIS, UTF-8 test_sb() test. +2003/01/29: [dist] add INSTALL-RUBY file. +2003/01/28: [test] success in Cygwin, Ruby 1.8.0 (2003-01-27). +2003/01/24: [inst] add rback target to Makefile.in. +2003/01/24: [impl] change SBCMP() -> IS_NEWLINE() in match_at(). +2003/01/23: [impl] add encoding arg to scan_xxxx_number(). +2003/01/23: [impl] rename WCInt to WCINT. +2003/01/22: [bug] POSIX API regexec() was not thread safe. + remove region member from POSIX regex_t. + [new] add search time option REG_OPTION_POSIX_REGION. + (region argument is treated as regmatch_t[] type) + speed up regexec(). +2003/01/22: [memo] start CVS entry in my box. + +2003/01/21: Version 1.6 + +2003/01/21: [test] Mac OS X 10.1, Ruby 1.8.0 (2003-01-20) +2003/01/20: [impl] add UTF-8 check to test.rb. (thanks UENO Katsuhiro) +2003/01/18: [impl] change REGION_NOTPOS to REG_REGION_NOTPOS in regex.h. +2003/01/17: [dist] add sample/simple.c. +2003/01/17: [inst] add configure option --with-rubydir. +2003/01/17: [bug] bad implemeted POSIX API options. + default: /./ not match "\n", anchor not match "\n" + REG_NEWLINE: /./ not match "\n", anchor match "\n" +2003/01/16: [impl] rewrite POSIX API regexec() for speed up. +2003/01/16: [impl] add region member to POSIX regex_t struct. +2003/01/16: [inst] rename library file from 'libregex.a' to 'libonig.a'. +2003/01/15: [dist] add testc.c to distribution file. +2003/01/15: [test] success in 'make rtest/ctest/ptest' on Windows 2000. +2003/01/15: [bug] change '/' to \' in win32/Makefile. +2003/01/14: [test] success in Ruby make test on Windows 2000. + VC++6.0, Ruby 1.6.8 (2003-01-12) +2003/01/14: [inst] change Makefile.in and win32/Makefile. +2003/01/11: [inst] changes for Win32 platform. (regint.h, reggnu.c, regcomp.c) +2003/01/11: [dist] add win32 directory. (config.h, Makefile, testc.c) +2003/01/10: [inst] add onigposix.h to install target. (Makefile.in) +2003/01/10: [bug] lacked a comma in ESTRING[]. (regposerr.c) +2003/01/10: [bug] local variable name was wrong. buf -> tbuf (regerror()) +2003/01/10: [spec] remove REG_RUBY_M17N case from onigposix.h and regposix.c. + +2003/01/09: Version 1.5 + +2003/01/09: [inst] replace Ruby re.c.XXX.patch files. (166 -> 168, 172 -> 180) +2003/01/09: [new] implement POSIX API. (thanks knu) + (onigposix.h, regposix.c, regposerr.c) +2003/01/08: [spec] remove REGERR_END_PATTERN_AFTER_BACKSLASH in regex.h. +2003/01/08: [spec] region arg can be NULL in regex_search() and regex_match(). + +2003/01/08: Version 1.4 + +2003/01/08: [inst] add test program converter (test.rb -> testc.c). +2003/01/08: [bug] move GET_WCINT() from regcomp.c to regint.h. +2003/01/07: [inst] add new test script (test.rb). +2002/12/30: [bug] wrong merge in multibyte mode (alt_merge_opt_exact_info()). +2002/12/28: [inst] add rtest target to Makefile.in. +2002/12/28: [bug] /\xfe/.match("\xfe") mismatch in multibyte mode. + add "raw" flag arg to concat_opt_exact_info_str(). +2002/12/25: [bug] check condition was wrong in alt_merge_opt_map_info(). +2002/12/25: [impl] add threshold_len check in regex_search(). +2002/12/23: [bug] prec-read in alternative (/a|(?=z).f/.match("zf") => nil) +2002/12/23: [bug] \G in alternative (/a|\Gz/.match("bza") => "z"). + add start member in MatchArg. (regexec.c) +2002/12/21: [impl] **** rewrite all optimization process. **** +2002/12/16: [impl] remove node subtype EFFECT_EMPTY. +2002/12/12: [impl] reconstruct node types. (regcomp.c) +2002/12/11: [impl] add regerror.c +2002/12/10: [bug] [ruby-dev:19042] (thanks Nobu) + anchor(\G etc...) influenced outside of "|". (/a|\Gb/) +2002/11/30: [bug] [ruby-dev:18966] (thanks Nobu) + char-class(\S, [^\s] etc...) optimize map-info was wrong. +2002/11/29: [bug] infinite loop on NULL-pointer str search (regex_search()). + (thanks matz) +2002/11/29: [bug] change static -> extern (regex_chain_reduce()). +2002/11/29: [bug] change encoding to RegDefaultCharEncoding + in re_recompile_pattern(). (adapt to re.c) +2002/04/24: [spec] USE_ONIGURUMA_EXTENSION is disabled in default. +2002/04/24: [new] add searching time option: REG_OPTION_NOTBOL/NOTEOL. + add searching time option argument to regex_search() and + regex_match(). (prepare for POSIX API) +2002/04/20: [impl] divide regex.c file into regcomp.c, regexec.c, reggnu.c + and regint.h. +2002/04/09: [impl] move IS_MULTILINE() to outside of loop in OP_ANYCHAR_STAR. +2002/04/08: [impl] don't use OP_REPEAT operator for '??'. +2002/04/06: [impl] reduce redundant nested repeat operators(?,*,+,??,*?,+?). + ex. (?:a*)?, (?:a??)* etc.. +2002/04/06: [spec] should not warn for /(?:a?)+?/. +2002/04/04: [spec] should allow fixed length alternative and repeat pattern + in look-behind. ex. /(?<=(a|b){3})/ (thanks Guy Decoux) +2002/04/02: [spec] should warn for /(?:a+)?/ and /(?:a*)??/. (thanks akr) + +2002/04/01: Version 1.3 + +2002/04/01: [dist] add COPYING. +2002/03/30: [spec] warn redundant nested repeat operator + in Ruby verbose mode. ex. (?:a*)? +2002/03/30: [spec] nested repeat operator error check should be + same with GNU regex. (thanks Guy Decoux) +2002/03/30: [new] add \x{hexadecimal-wide-char}. (thanks matz) +2002/03/27: [bug] MBCTYPE_XXX symbol values should be same with GNU regex. +2002/03/27: [impl] add THREAD_ATOMIC to regex_clone(), regex_init(), regex_end(). +2002/03/25: [spec] if encoding is utf-8, allow combination of singlebyte and + multibyte code range in char class. + (cancelled 2002/04/01: for M17N compatibility) +2002/03/25: [dist] description of the license condition is added to README. +2002/03/23: [bug] should set all bits of reg->mem_stats, + if REG_OPTION_FIND_LONGEST or REG_OPTION_NOT_EMPTY. +2002/03/23: [new] add a new option REG_OPTION_NOT_EMPTY. +2002/03/20: [spec] allow incompleted left brace as an usual char. + ex. /{/, /({)/, /a{2,3/ etc... +2002/03/20: [impl] serialize integer in bytecode. + (switch by UNALIGNED_WORD_ACCESS in regex.c) +2002/03/20: [impl] change re_mbcinit() for REG_RUBY_M17N. +2002/03/19: [impl] word alignment of char class multi-byte code ranges. +2002/03/19: [impl] replace OP_EXACTMB4N with OP_EXACTMB3N. +2002/03/19: [bug] OP_CCLASS_MB_NOT process in matchAt() is wrong. +2002/03/19: [new] add re_mbctab[] for Ruby extension library compatibility. +2002/03/19: [spec] allow nested repeat operator, if operator is {n,m} type. +2002/03/19: [new] add REG_IS_PATTERN_ERROR(ecode) in regex.h +2002/03/18: [spec] /[a-b-c]/ should be error. +2002/03/18: [bug] /[\w-a]/ should be error. (thanks Guy Decoux) +2002/03/18: [bug] /[\]/ should be error. (thanks Guy Decoux) +2002/03/18: [bug] /()*/ etc.. should not be error. (thanks Guy Decoux) +2002/03/18: [spec] /a{1}*/ should not be error. (thanks Guy Decoux) +2002/03/18: [bug] ab{2}{3} was interpreded to (?:a(?:b{2})){3} + (thanks Guy Decoux) +2002/03/18: [bug] abort /(?i)*a/ etc... (thanks Guy Decoux) +2002/03/18: [bug] abort /a|*/,/a|{1}/ etc... (thanks Guy Decoux) + +2002/03/13: Version 1.2 + +2002/03/13: [test] success in rubicon/builtin/AllBuiltinTests.rb. + (thanks rubicon) +2002/03/13: [bug] OP_EXACTMBN process in matchAt() is wrong. +2002/03/13: [bug] start argument of BackwardSearchRange() is wrong. +2002/03/12: [spec] change function name style from CamelCase + to underline_separation. (includes API) +2002/03/12: [bug] if pattern has nested null-check, cause infinite loop. + correct STACK_NULL_CHECK() macro. (thanks Guy Decoux) +2002/03/11: [bug] it is wrong that four numbers to continue as + an octal value in scanBackSlash(). ex. /\0111/ + (thanks matz) +2002/03/11: [new] \k (single-byte word char), \K (multi-byte char). +2002/03/09: [inst] add two targets to Makefile.in (166 and 172). +2002/03/09: [spec] decrease REG_MAX_BACKREF_NUM, REG_MAX_REPEAT_NUM + values. +2002/03/08: [spec] allow use of "\A"(begin-buf) in look-behind. +2002/03/08: [impl] add a new opcode OP_PUSH_IF_PEEK_NEXT. +2002/03/08: [impl] add a new opcode OP_ANYCHAR_STAR_PEEK_NEXT. +2002/03/07: [spec] prohibit use of capture group "(...)" + in negative look-behind. +2002/03/07: [inst] add configure.in, config.h.in, Makefile.in. +2002/03/07: [impl] call Init_REGEX_STAT() in RegexInit(). +2002/03/07: [spec] less length string match with negative look-behind. + ex. /(?<!XXX)a/.match("Xa"). (thanks Nobu) +2002/03/06: [impl] expand repeated string, if expanded length <= 100. + ex. /(?:abc){10}/ +2002/03/06: [new] add a symbol REG_TRANSTABLE_USE_DEFAULT in regex.h. +2002/03/06: [impl] rename RegDefaultCharCode to RegDefaultCharEncoding. +2002/03/06: [bug] if pattern has NULL(\000) char, infinite loop happens + in ScanMakeNode(). (beware of strchr(). thanks Nobu) +2002/03/06: [bug] range argument of ForwardSearchRange() is wrong. + ex. /\A.a/, /\G.a/ mismatched with "aa". (thanks Nobu) +2002/03/05: [new] add RegexMatch() API. rename regexMatch() to matchAt(). +2002/03/05: [impl] change function definition style. +2002/03/05: [impl] abolish use of macro symbol which name begin with underline. +2002/03/04: [bug] make up a break-statement in compileTree(). + (compile error on Mac OS X 10.1.3) + +2002/03/04: Version 1.1 + +2002/03/04: [impl] replace STK_BOTTOM with STK_ALT. +2002/03/02: [impl] add new opcode OP_FINISH and new stack type + STK_BOTTOM for (little bit) speed up STACK_POP. +2002/03/02: [impl] add new opcode OP_EXACT1_IC, OP_EXACTN_IC + for compile time ignore case check. + remove opcode OP_EXACT1_RAW, OP_EXACTN_RAW. +2002/03/02: [impl] add OpTime info to statistical data. +2002/02/28: [bug] sub_anchor($) in ForwardSearch() and BackwardSearch(). + ex. /$\x0az/.match("\nz") +2002/02/28: [new] look-behind (?<=pattern), (?<!pattern). +2002/02/27: [bug] use StackIndex instead of StackType* for realloc problem. +2002/02/27: [impl] use m17n_codepoint() as mb2wc() in REG_RUBY_M17N. +2002/02/27: [spec] undefined POSIX bracket /[[:xyz:]]/ should be syntax error. +2002/02/26: [bug] ex. /$*/, /[a-]/, /((?i)a)b/ (thanks matz) + +2002/02/25: Version 1.0 (first release) + +-- +[bug: bug fix] +[new: new feature] +[spec: specification change] +[impl: implementation change] +[tune: tune for speed up] +[inst: changes for installation] +[dist: distribution change] +[test: test] +[memo: memo] diff --git a/ext/mbstring/oniguruma/INSTALL-RUBY b/ext/mbstring/oniguruma/INSTALL-RUBY new file mode 100644 index 0000000000..ea214b6127 --- /dev/null +++ b/ext/mbstring/oniguruma/INSTALL-RUBY @@ -0,0 +1,48 @@ +INSTALL-RUBY 2003/06/12 + +The way of installing into Ruby is shown. +First, prepare for the source of Ruby. +(http://www.ruby-lang.org/) + +A. Unix or Cygwin platform +B. Win32 platform (VC++) + + +A. Unix or Cygwin platform + + (in oniguruma directory) + 1. ./configure --with-rubydir=<ruby-source-dir> + 2. make 16 # for Ruby 1.6.8 + or + make 18 # for Ruby 1.8.0 + + Or you can specify ruby source directory. + (ex. make 16 RUBYDIR=../ruby) + + (in ruby source directory) + 3. ./configure (** If it doesn't go yet. **) + 4. make clean + 5. make + + + * test (ASCII and EUC-JP) + + (in oniguruma directory) + 6. make rtest + Or you can specify ruby program directory. + (ex. make rtest RUBYDIR=/usr/local/bin) + + +B. Win32 platform (VC++) + + * Requirement: Visual C++, patch.exe + + (in oniguruma directory) + 1. copy win32\Makefile Makefile + 2. nmake 16 RUBYDIR=<ruby-source-dir> # for Ruby 1.6.8 + or + nmake 18 RUBYDIR=<ruby-source-dir> # for Ruby 1.8.0 + + 3. Follow <ruby-source-dir>\win32\README.win32 description... + +// END diff --git a/ext/mbstring/oniguruma/Makefile.in b/ext/mbstring/oniguruma/Makefile.in new file mode 100644 index 0000000000..fd79cfb24f --- /dev/null +++ b/ext/mbstring/oniguruma/Makefile.in @@ -0,0 +1,188 @@ +# Oni Guruma Makefile + +product_name = oniguruma +dist_tag = `date '+%Y%m%d'` + +SHELL = /bin/sh +AUTOCONF = autoconf + +CPPFLAGS = +CFLAGS = @CFLAGS@ @STATISTICS@ +LDFLAGS = +LOADLIBES = +AR = ar +ARFLAGS = rc +RANLIB = @RANLIB@ +INSTALL = install -c +CP = cp -p +CC = @CC@ +DEFS = @DEFS@ -DNOT_RUBY +RUBYDIR = @RUBYDIR@ +WIN32 = win32 +DOC = doc + +srcdir = @srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = $(exec_prefix)/lib +includedir = $(prefix)/include + +subdirs = + +libname = libonig.a + +onigintheaders = regint.h regparse.h +onigheaders = oniguruma.h $(onigintheaders) +posixheaders = onigposix.h +headers = $(posixheaders) $(onigheaders) + +onigobjs = regerror.o regparse.o regcomp.o regexec.o reggnu.o +posixobjs = regposix.o regposerr.o +libobjs = $(onigobjs) $(posixobjs) + +onigsources = regerror.c regparse.c regcomp.c regexec.c reggnu.c +posixsources = regposix.c regposerr.c +libsources = $(posixsources) $(onigsources) +rubysources = regex.c $(onigsources) + +patchfiles = re.c.168.patch re.c.180.patch +distfiles = README COPYING INSTALL-RUBY HISTORY \ + .cvsignore Makefile.in configure.in config.h.in configure \ + $(headers) $(libsources) regex.c $(patchfiles) \ + test.rb testconv.rb $(testc).c +win32distfiles = $(WIN32)/Makefile $(WIN32)/config.h $(WIN32)/testc.c +docfiles = $(DOC)/API $(DOC)/RE + +samplefiles = sample/*.c + +testc = testc +testp = testp + +makeargs = $(MFLAGS) CPPFLAGS='$(CPPFLAGS)' CFLAGS='$(CFLAGS)' CC='$(CC)' + +.SUFFIXES: +.SUFFIXES: .o .c .h .ps .dvi .info .texinfo + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(srcdir) -c $< + +# targets +default: all + +all: $(libname) + +$(libname): $(libobjs) + rm -f $(libname) + $(AR) $(ARFLAGS) $(libname) $(libobjs) + $(RANLIB) $(libname) + +regparse.o: regparse.c $(onigheaders) config.h +regcomp.o: regcomp.c $(onigheaders) config.h +regexec.o: regexec.c regint.h oniguruma.h config.h +reggnu.o: reggnu.c regint.h oniguruma.h config.h +regerror.o: regerror.c regint.h oniguruma.h config.h +regposix.o: regposix.c $(posixheaders) oniguruma.h config.h +regposerr.o: regposerr.c $(posixheaders) config.h + +install: all + test -d $(libdir) || mkdir $(libdir) + test -d $(includedir) || mkdir $(includedir) + $(INSTALL) $(libname) $(libdir)/$(libname) + $(RANLIB) $(libdir)/$(libname) + $(INSTALL) $(srcdir)/oniguruma.h $(includedir)/oniguruma.h + $(INSTALL) $(srcdir)/onigposix.h $(includedir)/onigposix.h + +uninstall: + -rm -f $(libdir)/$(libname) + -rm -f $(includedir)/oniguruma.h + +# Ruby test +rtest: + $(RUBYDIR)/ruby -w -Ke test.rb + +# C library test +ctest: $(testc) + ./$(testc) + +# POSIX C library test +ptest: $(testp) + ./$(testp) + +$(testc): $(testc).c $(libname) + $(CC) $(CFLAGS) -o $@ $(testc).c $(libname) + +$(testp): $(testc).c $(libname) + $(CC) -DPOSIX_TEST $(CFLAGS) -o $@ $(testc).c $(libname) + +$(testc).c: test.rb testconv.rb + ruby -Ke testconv.rb < test.rb > $@ + +$(WIN32)/$(testc).c: test.rb testconv.rb + ruby -Ke testconv.rb -win < test.rb | nkf -cs > $@ + +clean: + rm -f *.o $(libname) $(testc) $(testp) $(testc) *~ win32/*~ + +distclean: clean + rm -f Makefile config.status + + +16: cpruby + patch -d $(RUBYDIR) -p0 < re.c.168.patch + +18: cpruby + patch -d $(RUBYDIR) -p0 < re.c.180.patch + +# backup file suffix +SORIG = ruby_orig + +cpruby: + $(CP) $(RUBYDIR)/regex.c $(RUBYDIR)/regex.c.$(SORIG) + $(CP) $(RUBYDIR)/regex.h $(RUBYDIR)/regex.h.$(SORIG) + $(CP) $(RUBYDIR)/re.c $(RUBYDIR)/re.c.$(SORIG) + $(CP) $(rubysources) $(onigintheaders) $(RUBYDIR) + $(CP) oniguruma.h $(RUBYDIR)/regex.h + +rback: + $(CP) $(RUBYDIR)/regex.c.$(SORIG) $(RUBYDIR)/regex.c + $(CP) $(RUBYDIR)/regex.h.$(SORIG) $(RUBYDIR)/regex.h + $(CP) $(RUBYDIR)/re.c.$(SORIG) $(RUBYDIR)/re.c + +samples: + $(CC) $(CFLAGS) -I. -o sample/simple sample/simple.c $(libname) + $(CC) $(CFLAGS) -I. -o sample/posix sample/posix.c $(libname) + $(CC) $(CFLAGS) -I. -o sample/names sample/names.c $(libname) + +configure: configure.in + $(AUTOCONF) + +config.status: configure + $(SHELL) ./config.status --recheck + +Makefile: Makefile.in config.status + $(SHELL) ./config.status + +# Prevent GNU make 3 from overflowing arg limit on system V. +.NOEXPORT: + +manifest: + for file in $(distfiles); do echo $$file; done + + +distdir = $(product_name) + +dist_auto: $(testc).c $(WIN32)/$(testc).c + +dist: configure dist_auto + rm -rf $(distdir) + mkdir $(distdir) + mkdir $(distdir)/$(DOC) + mkdir $(distdir)/$(WIN32) + mkdir $(distdir)/sample + ln $(distfiles) $(distdir) + ln $(docfiles) $(distdir)/$(DOC) + ln $(win32distfiles) $(distdir)/$(WIN32) + ln $(samplefiles) $(distdir)/sample + tar chf - $(distdir) | gzip > onigd$(dist_tag).tar.gz + rm -rf $(distdir) diff --git a/ext/mbstring/oniguruma/config.h b/ext/mbstring/oniguruma/config.h new file mode 100644 index 0000000000..9e37608fdc --- /dev/null +++ b/ext/mbstring/oniguruma/config.h @@ -0,0 +1,67 @@ +/* ext/mbstring/oniguruma/config.h. Generated by configure. */ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define if using alloca.c. */ +/* #undef C_ALLOCA */ + +/* Define to empty if the keyword does not work. */ +/* #undef const */ + +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +/* #undef CRAY_STACKSEG_END */ + +/* Define if you have alloca, as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ +#define HAVE_ALLOCA_H 1 + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown + */ +/* #undef STACK_DIRECTION */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +/* #undef TIME_WITH_SYS_TIME */ + +/* The number of bytes in a int. */ +#define SIZEOF_INT 4 + +/* The number of bytes in a long. */ +#define SIZEOF_LONG 4 + +/* The number of bytes in a short. */ +/* #undef SIZEOF_SHORT */ + +/* Define if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define if you have the <strings.h> header file. */ +/* #undef HAVE_STRINGS_H */ + +/* Define if you have the <sys/time.h> header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define if you have the <sys/times.h> header file. */ +/* #undef HAVE_SYS_TIMES_H */ + +/* Define if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if you have the function argument prototype */ +/* #undef HAVE_PROTOTYPES */ + +/* Define if you have the variable length prototypes and stdarg.h */ +#define HAVE_STDARG_PROTOTYPES 1 + diff --git a/ext/mbstring/oniguruma/config.h.in b/ext/mbstring/oniguruma/config.h.in new file mode 100644 index 0000000000..1a59a45dc0 --- /dev/null +++ b/ext/mbstring/oniguruma/config.h.in @@ -0,0 +1,66 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define if using alloca.c. */ +#undef C_ALLOCA + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +#undef CRAY_STACKSEG_END + +/* Define if you have alloca, as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown + */ +#undef STACK_DIRECTION + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#undef TIME_WITH_SYS_TIME + +/* The number of bytes in a int. */ +#undef SIZEOF_INT + +/* The number of bytes in a long. */ +#undef SIZEOF_LONG + +/* The number of bytes in a short. */ +#undef SIZEOF_SHORT + +/* Define if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H + +/* Define if you have the <sys/times.h> header file. */ +#undef HAVE_SYS_TIMES_H + +/* Define if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the function argument prototype */ +#undef HAVE_PROTOTYPES + +/* Define if you have the variable length prototypes and stdarg.h */ +#undef HAVE_STDARG_PROTOTYPES + diff --git a/ext/mbstring/oniguruma/configure.in b/ext/mbstring/oniguruma/configure.in new file mode 100644 index 0000000000..84af3fbdb8 --- /dev/null +++ b/ext/mbstring/oniguruma/configure.in @@ -0,0 +1,70 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(regex.c) + +AC_CONFIG_HEADER(config.h) + +dnl default value for RUBYDIR +RUBYDIR=".." +AC_ARG_WITH(rubydir, + [ --with-rubydir=RUBYDIR specify value for RUBYDIR (default ..)], + [ RUBYDIR=$withval ]) +AC_SUBST(RUBYDIR) + +dnl default value for STATISTICS +STATISTICS="" +AC_ARG_WITH(statistics, + [ --with-statistics take matching time statistical data], + [ STATISTICS=-DREG_DEBUG_STATISTICS ]) +AC_SUBST(STATISTICS) + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_RANLIB +dnl AC_PROG_INSTALL + +dnl Checks for libraries. + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(stdlib.h string.h strings.h sys/time.h unistd.h sys/times.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_CHECK_SIZEOF(int, 4) +AC_CHECK_SIZEOF(short, 2) +AC_CHECK_SIZEOF(long, 4) +AC_C_CONST +AC_HEADER_TIME + +dnl Checks for library functions. +AC_FUNC_ALLOCA +AC_FUNC_MEMCMP + +AC_CACHE_CHECK(for prototypes, cv_have_prototypes, + [AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);], + cv_have_prototypes=yes, + cv_have_prototypes=no)]) +if test "$cv_have_prototypes" = yes; then + AC_DEFINE(HAVE_PROTOTYPES) +fi + +AC_CACHE_CHECK(for variable length prototypes and stdarg.h, cv_stdarg, + [AC_TRY_COMPILE([ +#include <stdarg.h> +int foo(int x, ...) { + va_list va; + va_start(va, x); + va_arg(va, int); + va_arg(va, char *); + va_arg(va, double); + return 0; +} +], [return foo(10, "", 3.14);], + cv_stdarg=yes, + cv_stdarg=no)]) +if test "$cv_stdarg" = yes; then + AC_DEFINE(HAVE_STDARG_PROTOTYPES) +fi + +AC_SUBST() + +AC_OUTPUT(Makefile) diff --git a/ext/mbstring/oniguruma/doc/API b/ext/mbstring/oniguruma/doc/API new file mode 100644 index 0000000000..96f53ae9b8 --- /dev/null +++ b/ext/mbstring/oniguruma/doc/API @@ -0,0 +1,279 @@ +Oniguruma API 2003/07/04 + +declared in regex.h. + + +# int regex_init(void) + + Initialize library. + + You don't have to call it explicitly, because it is called in regex_new(). + + +# int regex_error_code_to_str(UChar* err_buf, int err_code, ...) + + Return error message string length. + + arguments + 1 err_buf: error message buffer. + (required size: REG_MAX_ERROR_MESSAGE_LEN) + 2 err_code: error code returned from other API functions. + 3 err_info (optional): error info returned from regex_new() + and regex_recompile(). + + +# int regex_new(regex_t** reg, UChar* pattern, UChar* pattern_end, + RegOptionType option, RegCharEncoding code, RegSyntaxType* syntax, + RegErrorInfo* err_info) + + Create new regex object(regex_t). + + normal return: REG_NORMAL + + arguments + 1 reg: return regex object's address. + 2 pattern: regex pattern string. + 3 pattern_end: terminate address of pattern. (pattern + pattern length) + 4 option: compile time options. + + REG_OPTION_NONE no option + REG_OPTION_SINGLELINE '^' -> '\A', '$' -> '\z', '\Z' -> '\z' + REG_OPTION_MULTILINE '.' match with newline + REG_OPTION_IGNORECASE ignore case (case-insensitive) + REG_OPTION_EXTEND extended pattern form + REG_OPTION_FIND_LONGEST find longest match + REG_OPTION_FIND_NOT_EMPTY ignore empty match + REG_OPTION_NEGATE_SINGLELINE + clear REG_OPTION_SINGLELINE which is default on + in REG_SYNTAX_POSIX_XXX, REG_SYNTAX_PERL and REG_SYNTAX_JAVA. + REG_OPTION_CAPTURE_ONLY_NAMED_GROUP named group only captured. + + 5 code: character encoding. + + REGCODE_ASCII ASCII + REGCODE_UTF8 UTF-8 + REGCODE_EUCJP EUC-JP + REGCODE_SJIS Shift_JIS + REGCODE_DEFAULT ASCII + + 6 syntax: pointer to pattern syntax definition. + + REG_SYNTAX_POSIX_BASIC POSIX Basic RE + REG_SYNTAX_POSIX_EXTENDED POSIX Extended RE + REG_SYNTAX_EMACS Emacs + REG_SYNTAX_GREP grep + REG_SYNTAX_GNU_REGEX GNU regex + REG_SYNTAX_JAVA Java (Sun java.util.regex) + REG_SYNTAX_PERL Perl + REG_SYNTAX_RUBY Ruby + REG_SYNTAX_DEFAULT default (== Ruby) + regex_set_default_syntax() + + or any RegSyntaxType data pointer defined by user. + + 7 err_info: address for return optional error info. + use this value as 3rd argument of regex_error_code_to_str(). + + +# void regex_free(regex_t* reg) + + Free memory used by regex object. + + arguments + 1 reg: regex object. + + +# int regex_recompile(regex_t* reg, UChar* pattern, UChar* pattern_end, + RegOptionType option, RegCharEncoding code, RegSyntaxType* syntax, + RegErrorInfo* err_info) + + Recompile regex object. + + normal return: REG_NORMAL + + arguments + 1 reg: regex object. + + Another arguments are same with regex_new(). + + +# int regex_search(regex_t* reg, UChar* str, UChar* end, UChar* start, + UChar* range, RegRegion* region, RegOptionType option) + + Search string and return search result and matching region. + + normal return: match position offset (i.e. p - str >= 0) + not found: REG_MISMATCH (< 0) + + arguments + 1 reg: regex object + 2 str: target string + 3 end: terminate address of target string + 4 start: search start address of target string + 5 range: search terminate address of target string + 6 region: address for return group match range info (NULL is allowed) + 7 option: search time option + + REG_OPTION_NOTBOL string head(str) isn't considered as begin of line + REG_OPTION_NOTEOL string end (end) isn't considered as end of line + REG_OPTION_POSIX_REGION region argument is regmatch_t[] of POSIX API. + + +# int regex_match(regex_t* reg, UChar* str, UChar* end, UChar* at, + RegRegion* region, RegOptionType option) + + Match string and return result and matching region. + + normal return: match length (i.e. p - at >= 0) + not match: REG_MISMATCH (< 0) + + arguments + 1 reg: regex object + 2 str: target string + 3 end: terminate address of target string + 4 at: match address of target string + 5 region: address for return group match range info (NULL is allowed) + 6 option: search time option + + REG_OPTION_NOTBOL string head(str) isn't considered as begin of line + REG_OPTION_NOTEOL string end (end) isn't considered as end of line + REG_OPTION_POSIX_REGION region argument is regmatch_t[] of POSIX API. + + +# RegRegion* regex_region_new(void) + + Create a region. + + +# void regex_region_free(RegRegion* region, int free_self) + + Free memory used by region. + + arguments + 1 region: target region + 2 free_self: [1: free all, 0: free memory used in region but not self] + + +# void regex_region_copy(RegRegion* to, RegRegion* from) + + Copy contents of region. + + arguments + 1 to: target region + 2 from: source region + + +# void regex_region_clear(RegRegion* region) + + Clear contents of region. + + arguments + 1 region: target region + + +# int regex_region_resize(RegRegion* region, int n) + + Resize group range area of region. + + normal return: REG_NORMAL + + arguments + 1 region: target region + 2 n: new size + + +# int regex_name_to_group_numbers(regex_t* reg, UChar* name, UChar* name_end, + int** num_list) + + Return group number list of name. + Named subexp is defined by (?<name>....). + + normal return: number of groups for the name. + (ex. /(?<x>..)...(?<x>..)/ ==> 2) + name not found: -1 + + arguments + 1 reg: regex object. + 2 name: subexp-name. + 3 name_end: terminate address of subexp-name. + 4 num_list: return list of group number. + + +# int regex_foreach_names(regex_t* reg, int (*func)(UChar*,int,int*,void*), + void* arg) + + Iterate function call for all names. + + normal return: 0 + error: func's return value. + + arguments + 1 reg: regex object. + 2 func: called function. + func(name, <number of groups>, <group number's list>, arg); + if func return non 0 value, iteration is stopped. + 3 arg: argument for func. + + +# UChar* regex_get_prev_char_head(RegCharEncoding code, UChar* start, UChar* s) + + Return previous character head address. + + arguments + 1 code: character encoding + 2 start: string address + 3 s: target address of string + + +# UChar* regex_get_left_adjust_char_head(RegCharEncoding code, + UChar* start, UChar* s) + + Return left-adjusted head address of a character. + + arguments + 1 code: character encoding + 2 start: string address + 3 s: target address of string + + +# UChar* regex_get_right_adjust_char_head(RegCharEncoding code, + UChar* start, UChar* s) + + Return right-adjusted head address of a character. + + arguments + 1 code: character encoding + 2 start: string address + 3 s: target address of string + + +# int regex_set_default_syntax(RegSyntaxType* syntax) + + Set default syntax. + + arguments + 1 syntax: pointer to pattern syntax definition. + + +# void regex_set_default_trans_table(UChar* table) + + Set default case transformation table. + + arguments + 1 table: case transformation table + + (* this function will be obsoleted in future version) + + +# int regex_end(void) + + The use of this library is finished. + + normal return: REG_NORMAL + + +# const char* regex_version(void) + + Return version string. (ex. "1.8.6") + +// END diff --git a/ext/mbstring/oniguruma/doc/RE b/ext/mbstring/oniguruma/doc/RE new file mode 100644 index 0000000000..3527b4556f --- /dev/null +++ b/ext/mbstring/oniguruma/doc/RE @@ -0,0 +1,224 @@ +Oniguruma Regular Expressions 2003/07/04 + +syntax: REG_SYNTAX_RUBY (default) + + +1. Syntax elements + + \ escape + | alternation + (...) group + [...] character class + + +2. Characters + + \t horizontal tab (0x09) + \v vertical tab (0x0B) + \n newline (0x0A) + \r return (0x0D) + \b back space (0x08) (* in character class only) + \f form feed (0x0C) + \a bell (0x07) + \e escape (0x1B) + \nnn octal char + \xHH hexadecimal char + \x{7HHHHHHH} wide hexadecimal char + \cx control char + \C-x control char + \M-x meta (x|0x80) + \M-\C-x meta control char + + +3. Character types + + . any character (except newline) + \w word character (alphanumeric, "_" and multibyte char) + \W non-word char + \s whitespace char (\t, \n, \v, \f, \r, \x20) + \S non-whitespace char + \d digit char + \D non-digit char + + +4. Quantifier + + greedy + + ? 1 or 0 times + * 0 or more times + + 1 or more times + {n,m} at least n but not more than m times + {n,} at least n times + {n} n times + + reluctant + + ?? 1 or 0 times + *? 0 or more times + +? 1 or more times + {n,m}? at least n but not more than m times + {n,}? at least n times + + possessive (greedy and does not backtrack after repeated) + + ?+ 1 or 0 times + *+ 0 or more times + ++ 1 or more times + + +5. Anchors + + ^ beginning of the line + $ end of the line + \b word boundary + \B not word boundary + \A beginning of string + \Z end of string, or before newline at the end + \z end of string + \G previous end-of-match position + + +6. POSIX character class ([:xxxxx:], negate [:^xxxxx:]) + + alnum alphabet or digit char + alpha alphabet + ascii code value: [0 - 127] + blank \t, \x20 + cntrl + digit 0-9 + graph + lower + print + punct + space \t, \n, \v, \f, \r, \x20 + upper + xdigit 0-9, a-f, A-F + + +7. Operators in character class + + [...] group (character class in character class) + && intersection + (lowest precedence operator in character class) + + ex. [a-w&&[^c-g]z] ==> ([a-w] and ([^c-g] or z)) ==> [abh-w] + + +8. Extended expressions + + (?#...) comment + (?imx-imx) option on/off + i: ignore case + m: multi-line (dot(.) match newline) + x: extended form + (?imx-imx:subexp) option on/off for subexp + (?:subexp) not captured + (?=subexp) look-ahead + (?!subexp) negative look-ahead + (?<=subexp) look-behind + (?<!subexp) negative look-behind + + Subexp of look-behind must be fixed character length. + But different character length is allowed in top level + alternatives only. + ex. (?<=a|bc) is OK. (?<=aaa(?:b|cd)) is not allowed. + + (?>subexp) don't backtrack + (?<name>subexp) define named group + (name can not include '>', ')', '\' and NUL character) + + +9. Back reference + + \n back reference by group number (n >= 1) + \k<name> back reference by group name + + +10. Subexp call ("Tanaka Akira special") + + \g<name> call by group name + \g<n> call by group number (only if 'n' is not defined as name) + + +----------------------------- +11. Original extensions + + + named group (?<name>...) + + named backref \k<name> + + subexp call \g<name>, \g<group-num> + + +12. Lacked features compare with perl 5.8.0 + + + [:word:] + + \N{name} + + \l,\u,\L,\U, \P, \X, \C + + (?{code}) + + (??{code}) + + (?(condition)yes-pat|no-pat) + + + \Q...\E (* This is effective on REG_SYNTAX_PERL and REG_SYNTAX_JAVA) + + +13. Syntax depend options + + + REG_SYNTAX_RUBY (default) + (?m): dot(.) match newline + + + REG_SYNTAX_PERL, REG_SYNTAX_JAVA + (?s): dot(.) match newline + (?m): ^ match after newline, $ match before newline + + +14. Differences with Japanized GNU regex(version 0.12) of Ruby + + + add look behind + (?<=fixed-char-length-pattern), (?<!fixed-char-length-pattern) + (in negative-look-behind, capture group isn't allowed, + shy group(?:) is allowed.) + + add possessive quantifier. ?+, *+, ++ + + add operations in character class. [], && + + add named group and subexp call. + + octal or hexadecimal number sequence can be treated as + a multibyte code char in char-class, if multibyte encoding is specified. + (ex. [\xa1\xa2], [\xa1\xa7-\xa4\xa1]) + + effect range of isolated option is to next ')'. + ex. (?:(?i)a|b) is interpreted as (?:(?i:a|b)), not (?:(?i:a)|b). + + isolated option is not transparent to previous pattern. + ex. a(?i)* is a syntax error pattern. + + allowed incompleted left brace as an usual char. + ex. /{/, /({)/, /a{2,3/ etc... + + negative POSIX bracket [:^xxxx:] is supported. + + POSIX bracket [:ascii:] is added. + + repeat of look-ahead is not allowd. + ex. /(?=a)*/, /(?!b){5}/ + + +14. Problems + + + Invalid first byte in UTF-8 is allowed. + (which is the same as GNU regex of Ruby) + + /./u =~ "\xa3" + + Of course, although it is possible to validate, + it will become later than now. + + + Zero-length match in infinite repeat stops the repeat, + and captured group status isn't checked as stop condition. + + /()*\1/ =~ "" #=> match + /(?:()|())*\1\2/ =~ "" #=> fail + + /(?:\1a|())*/ =~ "a" #=> match with "" + + + Ignore case option is not effect to an octal or hexadecimal + numbered char, but it becomes effective if it appears in the char class. + This doesn't have consistency, though they are the specifications + which are the same as GNU regex of Ruby. + + /\x61/i.match("A") # => nil + /[\x61]/i.match("A") # => match + +// END diff --git a/ext/mbstring/oniguruma/onigposix.h b/ext/mbstring/oniguruma/onigposix.h new file mode 100644 index 0000000000..ea93c6f9f7 --- /dev/null +++ b/ext/mbstring/oniguruma/onigposix.h @@ -0,0 +1,135 @@ +/********************************************************************** + + onigposix.h - Oniguruma (regular expression library) + + Copyright (C) 2003 K.Kosako (kosako@sofnec.co.jp) + +**********************************************************************/ +#ifndef ONIGPOSIX_H +#define ONIGPOSIX_H + +/* options */ +#define REG_ICASE (1<<0) +#define REG_NEWLINE (1<<1) +#define REG_NOTBOL (1<<2) +#define REG_NOTEOL (1<<3) +#define REG_EXTENDED (1<<4) /* if not setted, Basic Regular Expression */ +#define REG_NOSUB (1<<5) + +/* POSIX error codes */ +#define REG_NOMATCH 1 +#define REG_BADPAT 2 +#define REG_ECOLLATE 3 +#define REG_ECTYPE 4 +#define REG_EESCAPE 5 +#define REG_ESUBREG 6 +#define REG_EBRACK 7 +#define REG_EPAREN 8 +#define REG_EBRACE 9 +#define REG_BADBR 10 +#define REG_ERANGE 11 +#define REG_ESPACE 12 +#define REG_BADRPT 13 + +/* extended error codes */ +#define REG_EONIG_INTERNAL 14 +#define REG_EONIG_BADWC 15 +#define REG_EONIG_BADARG 16 +#define REG_EONIG_THREAD 17 + +/* character encodings (for reg_set_encoding()) */ +/* These value must be same with MBCTYPE_XXXX in oniguruma.h.*/ +#define REG_ENCODING_ASCII 0 +#define REG_ENCODING_EUC_JP 1 +#define REG_ENCODING_SJIS 2 +#define REG_ENCODING_UTF8 3 + +#include <stdlib.h> + + +typedef int regoff_t; + +typedef struct { + regoff_t rm_so; + regoff_t rm_eo; +} regmatch_t; + +/* POSIX regex_t */ +typedef struct { + void* onig; /* Oniguruma regex_t* */ + size_t re_nsub; + int comp_options; +} regex_t; + + +#ifndef P_ +#ifdef __STDC__ +# define P_(args) args +#else +# define P_(args) () +#endif +#endif + +#ifndef REG_EXTERN +#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(EXPORT) || defined(RUBY_EXPORT) +#define REG_EXTERN extern __declspec(dllexport) +#elif defined(IMPORT) +#define REG_EXTERN extern __declspec(dllimport) +#endif +#endif +#endif + +#ifndef REG_EXTERN +#define REG_EXTERN extern +#endif + +#ifndef ONIGURUMA_H +typedef unsigned int RegOptionType; + +/* syntax */ +typedef struct { + unsigned int op; + unsigned int op2; + unsigned int behavior; + RegOptionType options; /* default option */ +} RegSyntaxType; + +REG_EXTERN RegSyntaxType RegSyntaxPosixBasic; +REG_EXTERN RegSyntaxType RegSyntaxPosixExtended; +REG_EXTERN RegSyntaxType RegSyntaxEmacs; +REG_EXTERN RegSyntaxType RegSyntaxGrep; +REG_EXTERN RegSyntaxType RegSyntaxGnuRegex; +REG_EXTERN RegSyntaxType RegSyntaxJava; +REG_EXTERN RegSyntaxType RegSyntaxPerl; +REG_EXTERN RegSyntaxType RegSyntaxRuby; + +/* predefined syntaxes (see regcomp.c) */ +#define REG_SYNTAX_POSIX_BASIC (&RegSyntaxPosixBasic) +#define REG_SYNTAX_POSIX_EXTENDED (&RegSyntaxPosixExtended) +#define REG_SYNTAX_EMACS (&RegSyntaxEmacs) +#define REG_SYNTAX_GREP (&RegSyntaxGrep) +#define REG_SYNTAX_GNU_REGEX (&RegSyntaxGnuRegex) +#define REG_SYNTAX_JAVA (&RegSyntaxJava) +#define REG_SYNTAX_PERL (&RegSyntaxPerl) +#define REG_SYNTAX_RUBY (&RegSyntaxRuby) +/* default syntax */ +#define REG_SYNTAX_DEFAULT RegDefaultSyntax + +REG_EXTERN RegSyntaxType* RegDefaultSyntax; + +REG_EXTERN int regex_set_default_syntax P_((RegSyntaxType* syntax)); +#endif /* ONIGURUMA_H */ + + +REG_EXTERN int regcomp P_((regex_t* reg, const char* pat, int options)); +REG_EXTERN int regexec P_((regex_t* reg, const char* str, size_t nmatch, regmatch_t* matches, int options)); +REG_EXTERN void regfree P_((regex_t* reg)); +REG_EXTERN size_t regerror P_((int code, const regex_t* reg, char* buf, size_t size)); + +/* extended API */ +REG_EXTERN void reg_set_encoding P_((int enc)); +REG_EXTERN int reg_name_to_group_numbers P_((regex_t* reg, unsigned char* name, unsigned char* name_end, int** nums)); +REG_EXTERN int reg_foreach_name P_((regex_t* reg, int (*func)(unsigned char*,int,int*,void*), void* arg)); + +#endif /* ONIGPOSIX_H */ diff --git a/ext/mbstring/oniguruma/oniguruma.h b/ext/mbstring/oniguruma/oniguruma.h new file mode 100644 index 0000000000..e5236a80a7 --- /dev/null +++ b/ext/mbstring/oniguruma/oniguruma.h @@ -0,0 +1,447 @@ +/********************************************************************** + + oniguruma.h - Oniguruma (regular expression library) + + Copyright (C) 2002-2003 K.Kosako (kosako@sofnec.co.jp) + +**********************************************************************/ +#ifndef ONIGURUMA_H +#define ONIGURUMA_H + +#include "php_compat.h" + +#define ONIGURUMA +#define ONIGURUMA_VERSION_MAJOR 1 +#define ONIGURUMA_VERSION_MINOR 9 +#define ONIGURUMA_VERSION_TEENY 1 + +/* config parameters */ +#ifndef RE_NREGS +#define RE_NREGS 10 +#endif +#define REG_NREGION RE_NREGS +#define REG_MAX_BACKREF_NUM 1000 +#define REG_MAX_REPEAT_NUM 100000 +#define REG_MAX_MULTI_BYTE_RANGES_NUM 1000 +/* constants */ +#define REG_MAX_ERROR_MESSAGE_LEN 90 + +#ifndef P_ +#ifdef __STDC__ +# define P_(args) args +#else +# define P_(args) () +#endif +#endif + +#ifndef PV_ +#ifdef HAVE_STDARG_PROTOTYPES +# define PV_(args) args +#else +# define PV_(args) () +#endif +#endif + +#ifndef REG_EXTERN +#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(EXPORT) || defined(RUBY_EXPORT) +#define REG_EXTERN extern __declspec(dllexport) +#elif defined(IMPORT) +#define REG_EXTERN extern __declspec(dllimport) +#endif +#endif +#endif + +#ifndef REG_EXTERN +#define REG_EXTERN extern +#endif + +#define REG_CHAR_TABLE_SIZE 256 + +#define REGCODE_UNDEF ((RegCharEncoding )0) + +#if defined(RUBY_PLATFORM) && defined(M17N_H) +#define REG_RUBY_M17N +typedef m17n_encoding* RegCharEncoding; +#define REGCODE_DEFAULT REGCODE_UNDEF +#else +typedef const char* RegCharEncoding; +#define MBCTYPE_ASCII 0 +#define MBCTYPE_EUC 1 +#define MBCTYPE_SJIS 2 +#define MBCTYPE_UTF8 3 + +#define REGCODE_ASCII REG_MBLEN_TABLE[MBCTYPE_ASCII] +#define REGCODE_UTF8 REG_MBLEN_TABLE[MBCTYPE_UTF8] +#define REGCODE_EUCJP REG_MBLEN_TABLE[MBCTYPE_EUC] +#define REGCODE_SJIS REG_MBLEN_TABLE[MBCTYPE_SJIS] +#define REGCODE_DEFAULT REGCODE_ASCII + +REG_EXTERN const char REG_MBLEN_TABLE[][REG_CHAR_TABLE_SIZE]; +#endif /* else RUBY && M17N */ + +REG_EXTERN RegCharEncoding RegDefaultCharEncoding; + +#if defined(RUBY_PLATFORM) && !defined(M17N_H) +#undef ismbchar +#define ismbchar(c) (mbclen((c)) != 1) +#define mbclen(c) RegDefaultCharEncoding[(unsigned char )(c)] +#endif + +typedef unsigned int RegOptionType; +typedef unsigned char* RegTransTableType; +typedef unsigned int RegDistance; +typedef unsigned char UChar; + +#define REG_OPTION_DEFAULT REG_OPTION_NONE + +/* GNU regex options */ +#define RE_OPTION_IGNORECASE (1L) +#define RE_OPTION_EXTENDED (RE_OPTION_IGNORECASE << 1) +#define RE_OPTION_MULTILINE (RE_OPTION_EXTENDED << 1) +#define RE_OPTION_SINGLELINE (RE_OPTION_MULTILINE << 1) +#define RE_OPTION_POSIXLINE (RE_OPTION_MULTILINE|RE_OPTION_SINGLELINE) +#define RE_OPTION_LONGEST (RE_OPTION_SINGLELINE << 1) + +/* options */ +#define REG_OPTION_NONE 0 +#define REG_OPTION_SINGLELINE RE_OPTION_SINGLELINE +#define REG_OPTION_MULTILINE RE_OPTION_MULTILINE +#define REG_OPTION_IGNORECASE RE_OPTION_IGNORECASE +#define REG_OPTION_EXTEND RE_OPTION_EXTENDED +#define REG_OPTION_FIND_LONGEST RE_OPTION_LONGEST +#define REG_OPTION_FIND_NOT_EMPTY (REG_OPTION_FIND_LONGEST << 1) +#define REG_OPTION_NEGATE_SINGLELINE (REG_OPTION_FIND_NOT_EMPTY << 1) +#define REG_OPTION_CAPTURE_ONLY_NAMED_GROUP (REG_OPTION_NEGATE_SINGLELINE << 1) +/* options (search time) */ +#define REG_OPTION_NOTBOL (REG_OPTION_CAPTURE_ONLY_NAMED_GROUP << 1) +#define REG_OPTION_NOTEOL (REG_OPTION_NOTBOL << 1) +#define REG_OPTION_POSIX_REGION (REG_OPTION_NOTEOL << 1) + +#define REG_OPTION_ON(options,regopt) ((options) |= (regopt)) +#define REG_OPTION_OFF(options,regopt) ((options) &= ~(regopt)) +#define IS_REG_OPTION_ON(options,option) ((options) & (option)) + +/* syntax */ +typedef struct { + unsigned int op; + unsigned int op2; + unsigned int behavior; + RegOptionType options; /* default option */ +} RegSyntaxType; + +REG_EXTERN RegSyntaxType RegSyntaxPosixBasic; +REG_EXTERN RegSyntaxType RegSyntaxPosixExtended; +REG_EXTERN RegSyntaxType RegSyntaxEmacs; +REG_EXTERN RegSyntaxType RegSyntaxGrep; +REG_EXTERN RegSyntaxType RegSyntaxGnuRegex; +REG_EXTERN RegSyntaxType RegSyntaxJava; +REG_EXTERN RegSyntaxType RegSyntaxPerl; +REG_EXTERN RegSyntaxType RegSyntaxRuby; + +/* predefined syntaxes (see regcomp.c) */ +#define REG_SYNTAX_POSIX_BASIC (&RegSyntaxPosixBasic) +#define REG_SYNTAX_POSIX_EXTENDED (&RegSyntaxPosixExtended) +#define REG_SYNTAX_EMACS (&RegSyntaxEmacs) +#define REG_SYNTAX_GREP (&RegSyntaxGrep) +#define REG_SYNTAX_GNU_REGEX (&RegSyntaxGnuRegex) +#define REG_SYNTAX_JAVA (&RegSyntaxJava) +#define REG_SYNTAX_PERL (&RegSyntaxPerl) +#define REG_SYNTAX_RUBY (&RegSyntaxRuby) + +/* default syntax */ +#define REG_SYNTAX_DEFAULT RegDefaultSyntax + +REG_EXTERN RegSyntaxType* RegDefaultSyntax; + +/* syntax (operators) */ +#define REG_SYN_OP_ANYCHAR 1 /* . */ +#define REG_SYN_OP_0INF (1<<1) /* * */ +#define REG_SYN_OP_ESC_0INF (1<<2) +#define REG_SYN_OP_1INF (1<<3) /* + */ +#define REG_SYN_OP_ESC_1INF (1<<4) +#define REG_SYN_OP_01 (1<<5) /* ? */ +#define REG_SYN_OP_ESC_01 (1<<6) +#define REG_SYN_OP_INTERVAL (1<<7) /* {lower,upper} */ +#define REG_SYN_OP_ESC_INTERVAL (1<<8) +#define REG_SYN_OP_ALT (1<<9) /* | */ +#define REG_SYN_OP_ESC_ALT (1<<10) +#define REG_SYN_OP_SUBEXP (1<<11) /* (...) */ +#define REG_SYN_OP_ESC_SUBEXP (1<<12) +#define REG_SYN_OP_ESC_BUF_ANCHOR (1<<13) /* \A, \Z, \z */ +#define REG_SYN_OP_ESC_GNU_BUF_ANCHOR (1<<14) /* \`, \' */ +#define REG_SYN_OP_BACK_REF (1<<15) /* \num */ +#define REG_SYN_OP_CC (1<<16) /* [...] */ +#define REG_SYN_OP_ESC_WORD (1<<17) /* \w, \W */ +#define REG_SYN_OP_ESC_WORD_BEGIN_END (1<<18) /* \<. \> */ +#define REG_SYN_OP_ESC_WORD_BOUND (1<<19) /* \b, \B */ +#define REG_SYN_OP_ESC_WHITE_SPACE (1<<20) /* \s, \S */ +#define REG_SYN_OP_ESC_DIGIT (1<<21) /* \d, \D */ +#define REG_SYN_OP_LINE_ANCHOR (1<<22) /* ^, $ */ +#define REG_SYN_OP_POSIX_BRACKET (1<<23) /* [:xxxx:] */ +#define REG_SYN_OP_NON_GREEDY (1<<24) /* ??,*?,+?,{n,m}? */ +#define REG_SYN_OP_ESC_CONTROL_CHAR (1<<25) /* \n,\r,\t,\a ... */ +#define REG_SYN_OP_ESC_C_CONTROL (1<<26) /* \cx */ +#define REG_SYN_OP_ESC_OCTAL3 (1<<27) /* \OOO */ +#define REG_SYN_OP_ESC_X_HEX2 (1<<28) /* \xHH */ +#define REG_SYN_OP_ESC_X_BRACE_HEX8 (1<<29) /* \x{7HHHHHHH} */ +#define REG_SYN_OP_SUBEXP_EFFECT (1<<30) /* (?...) */ +#define REG_SYN_OP_QUOTE (1<<31) /* \Q...\E */ + +#define REG_SYN_OP2_OPTION_PERL (1<<0) /* (?imsx), (?-imsx) */ +#define REG_SYN_OP2_OPTION_RUBY (1<<1) /* (?imx), (?-imx) */ +#define REG_SYN_OP2_POSSESSIVE_REPEAT (1<<2) /* ?+,*+,++ */ +#define REG_SYN_OP2_POSSESSIVE_INTERVAL (1<<3) /* {n,m}+ */ +#define REG_SYN_OP2_CCLASS_SET (1<<4) /* [...&&..[..].] */ +#define REG_SYN_OP2_NAMED_SUBEXP (1<<5) /*(?<name>.),\k<name>*/ +#define REG_SYN_OP2_SUBEXP_CALL (1<<6) /* \g<name> */ +#define REG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL (1<<7) /* \C-x */ +#define REG_SYN_OP2_ESC_M_BAR_META (1<<8) /* \M-x */ +#define REG_SYN_OP2_ESC_V_VTAB (1<<9) /* \v as VTAB */ +#define REG_SYN_OP2_ESC_U_HEX4 (1<<10) /* \uHHHH */ + +/* syntax (behavior) */ +#define REG_SYN_CONTEXT_INDEP_ANCHORS (1<<0) /* not implemented */ +#define REG_SYN_CONTEXT_INDEP_OPS (1<<1) /* ?, *, +, {n,m} */ +#define REG_SYN_CONTEXT_INVALID_OPS (1<<2) /* error or ignore */ +#define REG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP (1<<3) /* ...)... */ +#define REG_SYN_ALLOW_INVALID_INTERVAL (1<<4) /* {??? */ +#define REG_SYN_STRICT_CHECK_BACKREF (1<<5) /* /(\1)/,/\1()/ etc.*/ +#define REG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND (1<<6) /* (?<=a|bc) */ + +/* syntax in char class [...] */ +#define REG_SYN_WARN_FOR_CC_OP_NOT_ESCAPED (1<<10) /* [,-,] */ +#define REG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC (1<<11) +#define REG_SYN_ESCAPE_IN_CC (1<<12) /* [...\w..] etc.. */ +#define REG_SYN_ALLOW_EMPTY_RANGE_IN_CC (1<<13) +#define REG_SYN_ALLOW_RANGE_OP_IN_CC (1<<14) /* [0-9-a] */ + + +/* error codes */ +#define REG_IS_PATTERN_ERROR(ecode) ((ecode) <= -100 && (ecode) > -300) +/* normal return */ +#define REG_NORMAL 0 +#define REG_MISMATCH -1 +#define REG_NO_SUPPORT_CONFIG -2 +/* internal error */ +#define REGERR_MEMORY -5 +#define REGERR_MATCH_STACK_LIMIT_OVER -6 +#define REGERR_TYPE_BUG -10 +#define REGERR_PARSER_BUG -11 +#define REGERR_STACK_BUG -12 +#define REGERR_UNDEFINED_BYTECODE -13 +#define REGERR_UNEXPECTED_BYTECODE -14 +#define REGERR_DEFAULT_ENCODING_IS_NOT_SETTED -21 +#define REGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR -22 +/* syntax error */ +#define REGERR_END_PATTERN_AT_LEFT_BRACE -100 +#define REGERR_END_PATTERN_AT_LEFT_BRACKET -101 +#define REGERR_EMPTY_CHAR_CLASS -102 +#define REGERR_PREMATURE_END_OF_CHAR_CLASS -103 +#define REGERR_END_PATTERN_AT_BACKSLASH -104 +#define REGERR_END_PATTERN_AT_META -105 +#define REGERR_END_PATTERN_AT_CONTROL -106 +#define REGERR_META_CODE_SYNTAX -108 +#define REGERR_CONTROL_CODE_SYNTAX -109 +#define REGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE -110 +#define REGERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE -111 +#define REGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS -112 +#define REGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED -113 +#define REGERR_TARGET_OF_REPEAT_OPERATOR_INVALID -114 +#define REGERR_NESTED_REPEAT_OPERATOR -115 +#define REGERR_UNMATCHED_CLOSE_PARENTHESIS -116 +#define REGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS -117 +#define REGERR_END_PATTERN_IN_GROUP -118 +#define REGERR_UNDEFINED_GROUP_OPTION -119 +#define REGERR_INVALID_POSIX_BRACKET_TYPE -121 +#define REGERR_INVALID_LOOK_BEHIND_PATTERN -122 +#define REGERR_INVALID_REPEAT_RANGE_PATTERN -123 +/* values error (syntax error) */ +#define REGERR_TOO_BIG_NUMBER -200 +#define REGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE -201 +#define REGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE -202 +#define REGERR_EMPTY_RANGE_IN_CHAR_CLASS -203 +#define REGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE -204 +#define REGERR_TOO_MANY_MULTI_BYTE_RANGES -205 +#define REGERR_TOO_SHORT_MULTI_BYTE_STRING -206 +#define REGERR_TOO_BIG_BACKREF_NUMBER -207 +#define REGERR_INVALID_BACKREF -208 +#define REGERR_TOO_BIG_WIDE_CHAR_VALUE -209 +#define REGERR_TOO_LONG_WIDE_CHAR_VALUE -210 +#define REGERR_INVALID_WIDE_CHAR_VALUE -211 +#define REGERR_INVALID_SUBEXP_NAME -212 +#define REGERR_UNDEFINED_NAME_REFERENCE -213 +#define REGERR_UNDEFINED_GROUP_REFERENCE -214 +#define REGERR_MULTIPLEX_DEFINITION_NAME_CALL -215 +#define REGERR_NEVER_ENDING_RECURSION -216 +/* errors related to thread */ +#define REGERR_OVER_THREAD_PASS_LIMIT_COUNT -301 + + +/* match result region type */ +struct re_registers { + int allocated; + int num_regs; + int* beg; + int* end; +}; + +#define REG_REGION_NOTPOS -1 + +typedef struct re_registers RegRegion; + +typedef struct { + UChar* par; + UChar* par_end; +} RegErrorInfo; + +typedef struct { + int lower; + int upper; +} RegRepeatRange; + +/* regex_t state */ +#define REG_STATE_NORMAL 0 +#define REG_STATE_SEARCHING 1 +#define REG_STATE_COMPILING -1 +#define REG_STATE_MODIFY -2 + +#define REG_STATE(regex) \ + ((regex)->state > 0 ? REG_STATE_SEARCHING : (regex)->state) + +typedef struct re_pattern_buffer { + /* common members in BBuf(bytes-buffer) type */ + unsigned char* p; /* compiled pattern */ + unsigned int used; /* used space for p */ + unsigned int alloc; /* allocated space for p */ + + int state; /* normal, searching, compiling */ + int num_mem; /* used memory(...) num counted from 1 */ + int num_repeat; /* OP_REPEAT/OP_REPEAT_NG id-counter */ + int num_null_check; /* OP_NULL_CHECK_START/END id counter */ + int num_call; /* number of subexp call */ + unsigned int backtrack_mem; + int stack_pop_level; + int repeat_range_alloc; + RegRepeatRange* repeat_range; + + RegCharEncoding enc; + RegOptionType options; + RegSyntaxType* syntax; + void* name_table; + + /* optimize info (string search and char-map and anchor) */ + int optimize; /* optimize flag */ + int threshold_len; /* search str-length for apply optimize */ + int anchor; /* BEGIN_BUF, BEGIN_POS, (SEMI_)END_BUF */ + RegDistance anchor_dmin; /* (SEMI_)END_BUF anchor distance */ + RegDistance anchor_dmax; /* (SEMI_)END_BUF anchor distance */ + int sub_anchor; /* start-anchor for exact or map */ + unsigned char *exact; + unsigned char *exact_end; + unsigned char map[REG_CHAR_TABLE_SIZE]; /* used as BM skip or char-map */ + int *int_map; /* BM skip for exact_len > 255 */ + int *int_map_backward; /* BM skip for backward search */ + RegDistance dmin; /* min-distance of exact or map */ + RegDistance dmax; /* max-distance of exact or map */ + + /* regex_t link chain */ + struct re_pattern_buffer* chain; /* escape compile-conflict on multi-thread */ +} regex_t; + +#ifdef RUBY_PLATFORM +#define re_mbcinit ruby_re_mbcinit +#define re_compile_pattern ruby_re_compile_pattern +#define re_recompile_pattern ruby_re_recompile_pattern +#define re_free_pattern ruby_re_free_pattern +#define re_adjust_startpos ruby_re_adjust_startpos +#define re_search ruby_re_search +#define re_match ruby_re_match +#define re_set_casetable ruby_re_set_casetable +#define re_copy_registers ruby_re_copy_registers +#define re_free_registers ruby_re_free_registers +#define register_info_type ruby_register_info_type +#define re_error_code_to_str ruby_error_code_to_str + +#define ruby_error_code_to_str regex_error_code_to_str +#define ruby_re_copy_registers regex_region_copy +#else +#define re_error_code_to_str regex_error_code_to_str +#define re_copy_registers regex_region_copy +#endif + +/* Oniguruma Native API */ +REG_EXTERN +int regex_init P_((void)); +REG_EXTERN +int regex_error_code_to_str PV_((UChar* s, int err_code, ...)); +REG_EXTERN +int regex_new P_((regex_t**, UChar* pattern, UChar* pattern_end, RegOptionType option, RegCharEncoding code, RegSyntaxType* syntax, RegErrorInfo* einfo)); +REG_EXTERN +void regex_free P_((regex_t*)); +REG_EXTERN +int regex_recompile P_((regex_t*, UChar* pattern, UChar* pattern_end, RegOptionType option, RegCharEncoding code, RegSyntaxType* syntax, RegErrorInfo* einfo)); +REG_EXTERN +int regex_search P_((regex_t*, UChar* str, UChar* end, UChar* start, UChar* range, RegRegion* region, RegOptionType option)); +REG_EXTERN +int regex_match P_((regex_t*, UChar* str, UChar* end, UChar* at, RegRegion* region, RegOptionType option)); +REG_EXTERN +RegRegion* regex_region_new P_((void)); +REG_EXTERN +void regex_region_free P_((RegRegion* region, int free_self)); +REG_EXTERN +void regex_region_copy P_((RegRegion* to, RegRegion* from)); +REG_EXTERN +void regex_region_clear P_((RegRegion* region)); +REG_EXTERN +int regex_region_resize P_((RegRegion* region, int n)); +REG_EXTERN +int regex_name_to_group_numbers P_((regex_t* reg, UChar* name, UChar* name_end, + int** nums)); +REG_EXTERN +int regex_foreach_name P_((regex_t* reg, int (*func)(UChar*,int,int*,void*), void* arg)); +REG_EXTERN +UChar* regex_get_prev_char_head P_((RegCharEncoding code, UChar* start, UChar* s)); +REG_EXTERN +UChar* regex_get_left_adjust_char_head P_((RegCharEncoding code, UChar* start, UChar* s)); +REG_EXTERN +UChar* regex_get_right_adjust_char_head P_((RegCharEncoding code, UChar* start, UChar* s)); +REG_EXTERN +void regex_set_default_trans_table P_((UChar* table)); +REG_EXTERN +int regex_set_default_syntax P_((RegSyntaxType* syntax)); +REG_EXTERN +int regex_end P_((void)); +REG_EXTERN +const char* regex_version P_((void)); + + +/* GNU regex API */ +#ifdef REG_RUBY_M17N +REG_EXTERN +void re_mbcinit P_((RegCharEncoding)); +#else +REG_EXTERN +void re_mbcinit P_((int)); +#endif + +REG_EXTERN +int re_compile_pattern P_((const char*, int, struct re_pattern_buffer*, char* err_buf)); +REG_EXTERN +int re_recompile_pattern P_((const char*, int, struct re_pattern_buffer*, char* err_buf)); +REG_EXTERN +void re_free_pattern P_((struct re_pattern_buffer*)); +REG_EXTERN +int re_adjust_startpos P_((struct re_pattern_buffer*, const char*, int, int, int)); +REG_EXTERN +int re_search P_((struct re_pattern_buffer*, const char*, int, int, int, struct re_registers*)); +REG_EXTERN +int re_match P_((struct re_pattern_buffer*, const char *, int, int, struct re_registers*)); +REG_EXTERN +void re_set_casetable P_((const char*)); +REG_EXTERN +void re_free_registers P_((struct re_registers*)); +REG_EXTERN +int re_alloc_pattern P_((struct re_pattern_buffer**)); /* added */ + +#endif /* ONIGURUMA_H */ diff --git a/ext/mbstring/oniguruma/php_compat.h b/ext/mbstring/oniguruma/php_compat.h new file mode 100644 index 0000000000..c261cc2bb0 --- /dev/null +++ b/ext/mbstring/oniguruma/php_compat.h @@ -0,0 +1,46 @@ +#ifndef _PHP_MBREGEX_COMPAT_H +#define _PHP_MBREGEX_COMPAT_H + +#define RegCharEncoding php_mb_reg_char_encoding +#define RegRegion php_mb_reg_region +#define RegDefaultCharEncoding php_mb_reg_default_char_encoding +#define REG_MBLEN_TABLE PHP_MBSTR_REG_MBLEN_TABLE +#define RegSyntaxType php_mb_reg_syntax_type +#define RegOptionType php_mb_reg_option_type +#define re_registers php_mb_re_registers +#define RegErrorInfo php_mb_reg_error_info +#define re_pattern_buffer php_mb_re_pattern_buffer +#define regex_t php_mb_regex_t +#define regex_init php_mb_regex_init +#define regex_new php_mb_regex_new +#define regex_free php_mb_regex_free +#define regex_recompile php_mb_regex_recompile +#define regex_search php_mb_regex_search +#define regex_match php_mb_regex_match +#define regex_region_new php_mb_regex_region_new +#define regex_region_free php_mb_regex_region_free +#define regex_region_copy php_mb_regex_region_copy +#define regex_region_clear php_mb_regex_region_clear +#define regex_region_resize php_mb_regex_region_resize +#define regex_name_to_group_numbers php_mb_regex_name_to_group_numbers +#define regex_foreach_names php_mb_regex_foreach_names +#define regex_get_prev_char_head php_mb_regex_get_prev_char_head +#define regex_get_left_adjust_char_head php_mb_get_left_adjust_char_head +#define regex_get_right_adjust_char_head php_mb_get_right_adjust_char_head +#define regex_set_default_trans_table php_mb_get_default_trans_table +#define regex_set_default_syntax php_mb_regex_set_default_syntax +#define regex_end php_mb_regex_end +#define re_mbcinit php_mb_re_mbcinit +#define re_compile_pattern php_mb_re_compile_pattern +#define re_recompile_pattern php_mb_re_recompile_pattern +#define re_free_pattern php_mb_re_free_pattern +#define re_adjust_startpos php_mb_re_adjust_startpos +#define re_search php_mb_re_search +#define re_match php_mb_re_match +#define re_set_casetable php_mb_re_set_casetable +#define php_mbregex_region_copy php_mb_re_copy_registers +#define re_free_registers php_mb_re_free_registers +#define register_info_type php_mb_register_info_type +#define regex_error_code_to_str php_mb_regex_error_code_to_str + +#endif /* _PHP_MBREGEX_COMPAT_H */ diff --git a/ext/mbstring/oniguruma/re.c.168.patch b/ext/mbstring/oniguruma/re.c.168.patch new file mode 100644 index 0000000000..fd1c1bf5d8 --- /dev/null +++ b/ext/mbstring/oniguruma/re.c.168.patch @@ -0,0 +1,56 @@ +--- re.c.ruby_orig Tue Feb 4 15:52:29 2003 ++++ re.c Tue Mar 18 19:37:49 2003 +@@ -380,7 +380,8 @@ make_regexp(s, len, flag) + int len, flag; + { + Regexp *rp; +- char *err; ++ char err[REG_MAX_ERROR_MESSAGE_LEN]; ++ int r; + + /* Handle escaped characters first. */ + +@@ -389,16 +390,17 @@ make_regexp(s, len, flag) + from that. + */ + +- rp = ALLOC(Regexp); +- MEMZERO((char *)rp, Regexp, 1); +- rp->buffer = ALLOC_N(char, 16); +- rp->allocated = 16; +- rp->fastmap = ALLOC_N(char, 256); ++ r = re_alloc_pattern(&rp); ++ if (r) { ++ re_error_code_to_str(err, r); ++ rb_reg_raise(s, len, err, 0); ++ } ++ + if (flag) { + rp->options = flag; + } +- err = re_compile_pattern(s, len, rp); +- if (err != NULL) { ++ r = re_compile_pattern(s, len, rp, err); ++ if (r != 0) { + rb_reg_raise(s, len, err, 0); + } + +@@ -532,14 +534,14 @@ rb_reg_prepare_re(re) + } + + if (need_recompile) { +- char *err; ++ char err[REG_MAX_ERROR_MESSAGE_LEN]; ++ int r; + + if (FL_TEST(re, KCODE_FIXED)) + kcode_set_option(re); + rb_reg_check(re); +- RREGEXP(re)->ptr->fastmap_accurate = 0; +- err = re_compile_pattern(RREGEXP(re)->str, RREGEXP(re)->len, RREGEXP(re)->ptr); +- if (err != NULL) { ++ r = re_recompile_pattern(RREGEXP(re)->str, RREGEXP(re)->len, RREGEXP(re)->ptr, err); ++ if (r != 0) { + rb_reg_raise(RREGEXP(re)->str, RREGEXP(re)->len, err, re); + } + } diff --git a/ext/mbstring/oniguruma/re.c.180.patch b/ext/mbstring/oniguruma/re.c.180.patch new file mode 100644 index 0000000000..08ef2397fb --- /dev/null +++ b/ext/mbstring/oniguruma/re.c.180.patch @@ -0,0 +1,66 @@ +--- re.c.ruby_orig Fri Feb 7 15:35:26 2003 ++++ re.c Tue Mar 18 18:51:21 2003 +@@ -444,7 +444,7 @@ rb_reg_to_s(re) + kcode_set_option(re); + rp = ALLOC(Regexp); + MEMZERO((char *)rp, Regexp, 1); +- err = re_compile_pattern(++ptr, len -= 2, rp) != 0; ++ err = (re_compile_pattern(++ptr, len -= 2, rp, NULL) != 0); + kcode_reset_option(); + re_free_pattern(rp); + } +@@ -538,7 +538,8 @@ make_regexp(s, len, flags) + int flags; + { + Regexp *rp; +- char *err; ++ char err[REG_MAX_ERROR_MESSAGE_LEN]; ++ int r; + + /* Handle escaped characters first. */ + +@@ -547,17 +548,18 @@ make_regexp(s, len, flags) + from that. + */ + +- rp = ALLOC(Regexp); +- MEMZERO((char *)rp, Regexp, 1); +- rp->buffer = ALLOC_N(char, 16); +- rp->allocated = 16; +- rp->fastmap = ALLOC_N(char, 256); ++ r = re_alloc_pattern(&rp); ++ if (r) { ++ re_error_code_to_str((UChar* )err, r); ++ rb_reg_raise(s, len, err, 0); ++ } ++ + if (flags) { + rp->options = flags; + } +- err = re_compile_pattern(s, len, rp); ++ r = re_compile_pattern(s, len, rp, err); + +- if (err != NULL) { ++ if (r != 0) { + rb_reg_raise(s, len, err, 0); + } + return rp; +@@ -692,14 +694,14 @@ rb_reg_prepare_re(re) + } + + if (need_recompile) { +- char *err; ++ char err[REG_MAX_ERROR_MESSAGE_LEN]; ++ int r; + + if (FL_TEST(re, KCODE_FIXED)) + kcode_set_option(re); + rb_reg_check(re); +- RREGEXP(re)->ptr->fastmap_accurate = 0; +- err = re_compile_pattern(RREGEXP(re)->str, RREGEXP(re)->len, RREGEXP(re)->ptr); +- if (err != NULL) { ++ r = re_recompile_pattern(RREGEXP(re)->str, RREGEXP(re)->len, RREGEXP(re)->ptr, err); ++ if (r != 0) { + rb_reg_raise(RREGEXP(re)->str, RREGEXP(re)->len, err, re); + } + } diff --git a/ext/mbstring/oniguruma/regcomp.c b/ext/mbstring/oniguruma/regcomp.c new file mode 100644 index 0000000000..fd8e56a7a7 --- /dev/null +++ b/ext/mbstring/oniguruma/regcomp.c @@ -0,0 +1,5282 @@ +/********************************************************************** + + regcomp.c - Oniguruma (regular expression library) + + Copyright (C) 2002-2003 K.Kosako (kosako@sofnec.co.jp) + +**********************************************************************/ +#include "regparse.h" + +#ifndef UNALIGNED_WORD_ACCESS +static unsigned char PadBuf[WORD_ALIGNMENT_SIZE]; +#endif + +static void +swap_node(Node* a, Node* b) +{ + Node c; + c = *a; *a = *b; *b = c; +} + +static RegDistance +distance_add(RegDistance d1, RegDistance d2) +{ + if (d1 == INFINITE_DISTANCE || d2 == INFINITE_DISTANCE) + return INFINITE_DISTANCE; + else { + if (d1 <= INFINITE_DISTANCE - d2) return d1 + d2; + else return INFINITE_DISTANCE; + } +} + +static RegDistance +distance_multiply(RegDistance d, int m) +{ + if (m == 0) return 0; + + if (d < INFINITE_DISTANCE / m) + return d * m; + else + return INFINITE_DISTANCE; +} + +#if 0 +static RegDistance +distance_distance(RegDistance d1, RegDistance d2) +{ + if (d1 == INFINITE_DISTANCE || d2 == INFINITE_DISTANCE) + return INFINITE_DISTANCE; + + if (d1 > d2) return d1 - d2; + else return d2 - d1; +} +#endif + +RegCharEncoding RegDefaultCharEncoding = REGCODE_DEFAULT; +static UChar AmbiguityTable[REG_CHAR_TABLE_SIZE]; + +#define IS_AMBIGUITY_CHAR(enc, c) (AmbiguityTable[(c)] >= 2) + +#ifdef DEFAULT_TRANSTABLE_EXIST + +static UChar DTT[] = { + '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', + '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', + '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', + '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', + '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', + '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', + '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', + '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', + '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', + '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', + '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', + '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', + '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', + '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', + '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', + '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', + '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', + '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', + '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', + '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', + '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', + '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', + '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', + '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', + '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', + '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', +}; +#endif + +static int +bitset_is_empty(BitSetRef bs) +{ + int i; + for (i = 0; i < BITSET_SIZE; i++) { + if (bs[i] != 0) return 0; + } + return 1; +} + +#ifdef REG_DEBUG +static int +bitset_on_num(BitSetRef bs) +{ + int i, n; + + n = 0; + for (i = 0; i < SINGLE_BYTE_SIZE; i++) { + if (BITSET_AT(bs, i)) n++; + } + return n; +} +#endif + +extern int +regex_bbuf_init(BBuf* buf, int size) +{ + buf->p = (UChar* )xmalloc(size); + if (IS_NULL(buf->p)) return(REGERR_MEMORY); + + buf->alloc = size; + buf->used = 0; + return 0; +} + + +#ifdef USE_SUBEXP_CALL + +static int +unset_addr_list_init(UnsetAddrList* uslist, int size) +{ + UnsetAddr* p; + + p = (UnsetAddr* )xmalloc(sizeof(UnsetAddr)* size); + CHECK_NULL_RETURN_VAL(p, REGERR_MEMORY); + uslist->num = 0; + uslist->alloc = size; + uslist->us = p; + return 0; +} + +static void +unset_addr_list_end(UnsetAddrList* uslist) +{ + if (IS_NOT_NULL(uslist->us)) + xfree(uslist->us); +} + +static int +unset_addr_list_add(UnsetAddrList* uslist, int offset, struct _Node* node) +{ + UnsetAddr* p; + int size; + + if (uslist->num >= uslist->alloc) { + size = uslist->alloc * 2; + p = (UnsetAddr* )xrealloc(uslist->us, sizeof(UnsetAddr) * size); + CHECK_NULL_RETURN_VAL(p, REGERR_MEMORY); + uslist->alloc = size; + uslist->us = p; + } + + uslist->us[uslist->num].offset = offset; + uslist->us[uslist->num].target = node; + uslist->num++; + return 0; +} +#endif /* USE_SUBEXP_CALL */ + + +#ifdef REG_RUBY_M17N + +extern int +regex_is_allow_reverse_match(RegCharEncoding enc, UChar* s, UChar* end) +{ + return IS_INDEPENDENT_TRAIL(enc); +} + +#else /* REG_RUBY_M17N */ + +const char REG_MBLEN_TABLE[][REG_CHAR_TABLE_SIZE] = { + { /* ascii */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }, + { /* euc-jp */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 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, 3, + 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, 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, 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 + }, + { /* sjis */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 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 + }, + { /* utf8 */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 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, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1 + } +}; + +extern int +regex_mb_max_length(RegCharEncoding code) +{ + /* can't use switch statement, code isn't int type. */ + if (code == REGCODE_ASCII) return 1; + else if (code == REGCODE_EUCJP) return 3; + else if (code == REGCODE_SJIS) return 2; + else return 6; /* REGCODE_UTF8 */ +} + +extern int +regex_is_allow_reverse_match(RegCharEncoding enc, UChar* s, UChar* end) +{ + UChar c; + + if (IS_INDEPENDENT_TRAIL(enc)) return 1; + + c = *s; + if (enc == REGCODE_EUCJP) { + if (c <= 0x7e || c == 0x8e || c == 0x8f) return 1; + } + else if (enc == REGCODE_SJIS) { + if (c <= 0x3f || c == 0x7f) return 1; + } + return 0; +} + +#endif /* not REG_RUBY_M17N */ + +static int +bitset_mbmaxlen(BitSetRef bs, int negative, RegCharEncoding enc) +{ + int i; + int len, maxlen = 0; + + if (negative) { + for (i = 0; i < SINGLE_BYTE_SIZE; i++) { + if (! BITSET_AT(bs, i)) { + len = mblen(enc, i); + if (len > maxlen) maxlen = len; + } + } + } + else { + for (i = 0; i < SINGLE_BYTE_SIZE; i++) { + if (BITSET_AT(bs, i)) { + len = mblen(enc, i); + if (len > maxlen) maxlen = len; + } + } + } + return maxlen; +} + + +static int +add_opcode(regex_t* reg, int opcode) +{ + BBUF_ADD1(reg, opcode); + return 0; +} + +static int +add_rel_addr(regex_t* reg, int addr) +{ + RelAddrType ra = (RelAddrType )addr; + +#ifdef UNALIGNED_WORD_ACCESS + BBUF_ADD(reg, &ra, SIZE_RELADDR); +#else + UChar buf[SERIALIZE_BUFSIZE]; + SERIALIZE_RELADDR(ra, buf); + BBUF_ADD(reg, buf, SIZE_RELADDR); +#endif + return 0; +} + +static int +add_abs_addr(regex_t* reg, int addr) +{ + AbsAddrType ra = (AbsAddrType )addr; + +#ifdef UNALIGNED_WORD_ACCESS + BBUF_ADD(reg, &ra, SIZE_ABSADDR); +#else + UChar buf[SERIALIZE_BUFSIZE]; + SERIALIZE_ABSADDR(ra, buf); + BBUF_ADD(reg, buf, SIZE_ABSADDR); +#endif + return 0; +} + +static int +add_length(regex_t* reg, int len) +{ + LengthType l = (LengthType )len; + +#ifdef UNALIGNED_WORD_ACCESS + BBUF_ADD(reg, &l, SIZE_LENGTH); +#else + UChar buf[SERIALIZE_BUFSIZE]; + SERIALIZE_LENGTH(l, buf); + BBUF_ADD(reg, buf, SIZE_LENGTH); +#endif + return 0; +} + +static int +add_mem_num(regex_t* reg, int num) +{ + MemNumType n = (MemNumType )num; + +#ifdef UNALIGNED_WORD_ACCESS + BBUF_ADD(reg, &n, SIZE_MEMNUM); +#else + UChar buf[SERIALIZE_BUFSIZE]; + SERIALIZE_MEMNUM(n, buf); + BBUF_ADD(reg, buf, SIZE_MEMNUM); +#endif + return 0; +} + +#if 0 +static int +add_repeat_num(regex_t* reg, int num) +{ + RepeatNumType n = (RepeatNumType )num; + +#ifdef UNALIGNED_WORD_ACCESS + BBUF_ADD(reg, &n, SIZE_REPEATNUM); +#else + UChar buf[SERIALIZE_BUFSIZE]; + SERIALIZE_REPEATNUM(n, buf); + BBUF_ADD(reg, buf, SIZE_REPEATNUM); +#endif + return 0; +} +#endif + +static int +add_option(regex_t* reg, RegOptionType option) +{ +#ifdef UNALIGNED_WORD_ACCESS + BBUF_ADD(reg, &option, SIZE_OPTION); +#else + UChar buf[SERIALIZE_BUFSIZE]; + SERIALIZE_OPTION(option, buf); + BBUF_ADD(reg, buf, SIZE_OPTION); +#endif + return 0; +} + +static int +add_opcode_rel_addr(regex_t* reg, int opcode, int addr) +{ + int r; + + r = add_opcode(reg, opcode); + if (r) return r; + r = add_rel_addr(reg, addr); + return r; +} + +static int +add_bytes(regex_t* reg, UChar* bytes, int len) +{ + BBUF_ADD(reg, bytes, len); + return 0; +} + +static int +add_bitset(regex_t* reg, BitSetRef bs) +{ + BBUF_ADD(reg, bs, SIZE_BITSET); + return 0; +} + +static int +add_opcode_option(regex_t* reg, int opcode, RegOptionType option) +{ + int r; + + r = add_opcode(reg, opcode); + if (r) return r; + r = add_option(reg, option); + return r; +} + +static int compile_length_tree(Node* node, regex_t* reg); +static int compile_tree(Node* node, regex_t* reg); + + +#define IS_NEED_STR_LEN_OP_EXACT(op) \ + ((op) == OP_EXACTN || (op) == OP_EXACTMB2N ||\ + (op) == OP_EXACTMB3N || (op) == OP_EXACTMBN || (op) == OP_EXACTN_IC) + +static int +select_str_opcode(int mb_len, int str_len, int ignore_case) +{ + int op; + + switch (mb_len) { + case 1: + if (ignore_case) { + switch (str_len) { + case 1: op = OP_EXACT1_IC; break; + default: op = OP_EXACTN_IC; break; + } + } + else { + switch (str_len) { + case 1: op = OP_EXACT1; break; + case 2: op = OP_EXACT2; break; + case 3: op = OP_EXACT3; break; + case 4: op = OP_EXACT4; break; + case 5: op = OP_EXACT5; break; + default: op = OP_EXACTN; break; + } + } + break; + + case 2: + switch (str_len) { + case 1: op = OP_EXACTMB2N1; break; + case 2: op = OP_EXACTMB2N2; break; + case 3: op = OP_EXACTMB2N3; break; + default: op = OP_EXACTMB2N; break; + } + break; + + case 3: + op = OP_EXACTMB3N; + break; + + default: + op = OP_EXACTMBN; + break; + } + return op; +} + +static int +compile_tree_empty_check(Node* node, regex_t* reg, int empty_check) +{ + int r; + int saved_num_null_check = reg->num_null_check; + + if (empty_check) { + r = add_opcode(reg, OP_NULL_CHECK_START); + if (r) return r; + r = add_mem_num(reg, reg->num_null_check); /* NULL CHECK ID */ + if (r) return r; + reg->num_null_check++; + } + + r = compile_tree(node, reg); + if (r) return r; + + if (empty_check) { + r = add_opcode(reg, OP_NULL_CHECK_END); + if (r) return r; + r = add_mem_num(reg, saved_num_null_check); /* NULL CHECK ID */ + } + return r; +} + +#ifdef USE_SUBEXP_CALL +static int +compile_call(CallNode* node, regex_t* reg) +{ + int r; + + r = add_opcode(reg, OP_CALL); + if (r) return r; + r = unset_addr_list_add(node->unset_addr_list, BBUF_GET_OFFSET_POS(reg), + node->target); + if (r) return r; + r = add_abs_addr(reg, 0 /*dummy addr.*/); + return r; +} +#endif + +static int +compile_tree_n_times(Node* node, int n, regex_t* reg) +{ + int i, r; + + for (i = 0; i < n; i++) { + r = compile_tree(node, reg); + if (r) return r; + } + return 0; +} + +static int +add_compile_string_length(UChar* s, int mb_len, int str_len, + regex_t* reg, int ignore_case) +{ + int len; + int op = select_str_opcode(mb_len, str_len, ignore_case); + + len = SIZE_OPCODE; + if (op == OP_EXACTMBN) + len += SIZE_LENGTH; + + if (IS_NEED_STR_LEN_OP_EXACT(op)) + len += SIZE_LENGTH; + + len += mb_len * str_len; + return len; +} + +static int +add_compile_string(UChar* s, int mb_len, int str_len, + regex_t* reg, int ignore_case) +{ + int op = select_str_opcode(mb_len, str_len, ignore_case); + add_opcode(reg, op); + + if (op == OP_EXACTMBN) + add_length(reg, mb_len); + + if (IS_NEED_STR_LEN_OP_EXACT(op)) + add_length(reg, str_len); + + add_bytes(reg, s, mb_len * str_len); + return 0; +} + + +static int +compile_length_string_node(StrNode* sn, regex_t* reg) +{ + int rlen, r, len, prev_len, slen, ambig, ic; + RegCharEncoding code = reg->enc; + UChar *p, *prev; + + if (sn->end <= sn->s) + return 0; + + ic = IS_IGNORECASE(reg->options); + + p = prev = sn->s; + prev_len = mblen(code, *p); + if (ic != 0 && prev_len == 1) + ambig = IS_AMBIGUITY_CHAR(reg->enc, *p); + else + ambig = 0; + + p += prev_len; + slen = 1; + rlen = 0; + + for (; p < sn->end; ) { + len = mblen(code, *p); + if (len == prev_len) { + slen++; + if (ic != 0 && ambig == 0 && len == 1) + ambig = IS_AMBIGUITY_CHAR(reg->enc, *p); + } + else { + r = add_compile_string_length(prev, prev_len, slen, reg, ambig); + rlen += r; + + if (ic != 0 && len == 1) + ambig = IS_AMBIGUITY_CHAR(reg->enc, *p); + else + ambig = 0; + + prev = p; + slen = 1; + prev_len = len; + } + + p += len; + } + r = add_compile_string_length(prev, prev_len, slen, reg, ambig); + rlen += r; + return rlen; +} + +static int +compile_length_string_raw_node(StrNode* sn, regex_t* reg) +{ + if (sn->end <= sn->s) + return 0; + + return add_compile_string_length(sn->s, 1 /* sb */, sn->end - sn->s, reg, 0); +} + +static int +compile_string_node(StrNode* sn, regex_t* reg) +{ + int r, len, prev_len, slen, ambig, ic; + RegCharEncoding code = reg->enc; + UChar *p, *prev; + + if (sn->end <= sn->s) + return 0; + + ic = IS_IGNORECASE(reg->options); + + p = prev = sn->s; + prev_len = mblen(code, *p); + if (ic != 0 && prev_len == 1) { + ambig = IS_AMBIGUITY_CHAR(reg->enc, *p); + if (ambig != 0) *p = TOLOWER(reg->enc, *p); + } + else + ambig = 0; + + p += prev_len; + slen = 1; + + for (; p < sn->end; ) { + len = mblen(code, *p); + if (len == prev_len) { + slen++; + if (ic != 0 && len == 1) { + if (ambig == 0) + ambig = IS_AMBIGUITY_CHAR(reg->enc, *p); + if (ambig != 0) *p = TOLOWER(reg->enc, *p); + } + } + else { + r = add_compile_string(prev, prev_len, slen, reg, ambig); + if (r) return r; + if (ic != 0 && len == 1) { + ambig = IS_AMBIGUITY_CHAR(reg->enc, *p); + if (ambig != 0) *p = TOLOWER(reg->enc, *p); + } + else + ambig = 0; + + prev = p; + slen = 1; + prev_len = len; + } + + p += len; + } + return add_compile_string(prev, prev_len, slen, reg, ambig); +} + +static int +compile_string_raw_node(StrNode* sn, regex_t* reg) +{ + if (sn->end <= sn->s) + return 0; + + return add_compile_string(sn->s, 1 /* sb */, sn->end - sn->s, reg, 0); +} + +static int +add_multi_byte_cclass_offset(BBuf* mbuf, regex_t* reg, int offset) +{ +#ifdef UNALIGNED_WORD_ACCESS + add_length(reg, mbuf->used - offset); + return add_bytes(reg, mbuf->p + offset, mbuf->used - offset); +#else + int r, pad_size; + UChar* p = BBUF_GET_ADD_ADDRESS(reg) + SIZE_LENGTH; + + GET_ALIGNMENT_PAD_SIZE(p, pad_size); + add_length(reg, mbuf->used - offset + (WORD_ALIGNMENT_SIZE - 1)); + if (pad_size != 0) add_bytes(reg, PadBuf, pad_size); + + r = add_bytes(reg, mbuf->p + offset, mbuf->used - offset); + + /* padding for return value from compile_length_cclass_node() to be fix. */ + pad_size = (WORD_ALIGNMENT_SIZE - 1) - pad_size; + if (pad_size != 0) add_bytes(reg, PadBuf, pad_size); + return r; +#endif +} + +static int +compile_length_cclass_node(CClassNode* cc, regex_t* reg) +{ + int len; + + if (IS_NULL(cc->mbuf)) { + len = SIZE_OPCODE + SIZE_BITSET; + } + else { + if (bitset_is_empty(cc->bs)) { + /* SIZE_BITSET is included in mbuf->used. */ + len = SIZE_OPCODE - SIZE_BITSET; + } + else { + len = SIZE_OPCODE; + } +#ifdef UNALIGNED_WORD_ACCESS + len += SIZE_LENGTH + cc->mbuf->used; +#else + len += SIZE_LENGTH + cc->mbuf->used + (WORD_ALIGNMENT_SIZE - 1); +#endif + } + + return len; +} + +static int +compile_cclass_node(CClassNode* cc, regex_t* reg) +{ + int r; + + if (IS_NULL(cc->mbuf)) { + if (cc->not) add_opcode(reg, OP_CCLASS_NOT); + else add_opcode(reg, OP_CCLASS); + + r = add_bitset(reg, cc->bs); + } + else { + if (bitset_is_empty(cc->bs)) { + if (cc->not) add_opcode(reg, OP_CCLASS_MB_NOT); + else add_opcode(reg, OP_CCLASS_MB); + + r = add_multi_byte_cclass_offset(cc->mbuf, reg, SIZE_BITSET); + } + else { + if (cc->not) add_opcode(reg, OP_CCLASS_MIX_NOT); + else add_opcode(reg, OP_CCLASS_MIX); + + r = add_bitset(reg, cc->bs); + if (r) return r; + r = add_multi_byte_cclass_offset(cc->mbuf, reg, SIZE_BITSET); + } + } + + return r; +} + +static int +entry_repeat_range(regex_t* reg, int id, int lower, int upper) +{ +#define REPEAT_RANGE_ALLOC 4 + + RegRepeatRange* p; + + if (reg->repeat_range_alloc == 0) { + p = (RegRepeatRange* )xmalloc(sizeof(RegRepeatRange) * REPEAT_RANGE_ALLOC); + CHECK_NULL_RETURN_VAL(p, REGERR_MEMORY); + reg->repeat_range = p; + reg->repeat_range_alloc = REPEAT_RANGE_ALLOC; + } + else if (reg->repeat_range_alloc <= id) { + int n; + n = reg->repeat_range_alloc + REPEAT_RANGE_ALLOC; + p = (RegRepeatRange* )xrealloc(reg->repeat_range, + sizeof(RegRepeatRange) * n); + CHECK_NULL_RETURN_VAL(p, REGERR_MEMORY); + reg->repeat_range = p; + reg->repeat_range_alloc = n; + } + else { + p = reg->repeat_range; + } + + p[id].lower = lower; + p[id].upper = upper; + return 0; +} + +static int +compile_range_repeat_node(QualifierNode* qn, int target_len, int empty_check, + regex_t* reg) +{ + int r; + int num_repeat = reg->num_repeat; + + r = add_opcode(reg, qn->greedy ? OP_REPEAT : OP_REPEAT_NG); + if (r) return r; + r = add_mem_num(reg, num_repeat); /* OP_REPEAT ID */ + reg->num_repeat++; + if (r) return r; + r = add_rel_addr(reg, target_len + SIZE_OP_REPEAT_INC); + if (r) return r; + + r = entry_repeat_range(reg, num_repeat, qn->lower, qn->upper); + if (r) return r; + + r = compile_tree_empty_check(qn->target, reg, empty_check); + if (r) return r; + + r = add_opcode(reg, qn->greedy ? OP_REPEAT_INC : OP_REPEAT_INC_NG); + if (r) return r; + r = add_mem_num(reg, num_repeat); /* OP_REPEAT ID */ + return r; +} + +#define QUALIFIER_EXPAND_LIMIT_SIZE 50 + +static int +compile_length_qualifier_node(QualifierNode* qn, regex_t* reg) +{ + int len, mod_tlen; + int infinite = IS_REPEAT_INFINITE(qn->upper); + int empty_check = (infinite && qn->target_may_empty); + int tlen = compile_length_tree(qn->target, reg); + + if (tlen < 0) return tlen; + + /* anychar repeat */ + if (NTYPE(qn->target) == N_ANYCHAR) { + if (qn->greedy && infinite) { + if (IS_NOT_NULL(qn->next_head_exact)) + return SIZE_OP_ANYCHAR_STAR_PEEK_NEXT + tlen * qn->lower; + else + return SIZE_OP_ANYCHAR_STAR + tlen * qn->lower; + } + } + + if (empty_check) + mod_tlen = tlen + (SIZE_OP_NULL_CHECK_START + SIZE_OP_NULL_CHECK_END); + else + mod_tlen = tlen; + + if (infinite && + (qn->lower <= 1 || tlen * qn->lower <= QUALIFIER_EXPAND_LIMIT_SIZE)) { + if (qn->lower == 1 && tlen > QUALIFIER_EXPAND_LIMIT_SIZE) { + len = SIZE_OP_JUMP; + } + else { + len = tlen * qn->lower; + } + + if (qn->greedy) { + if (IS_NOT_NULL(qn->head_exact)) + len += SIZE_OP_PUSH_OR_JUMP_EXACT1 + mod_tlen + SIZE_OP_JUMP; + else if (IS_NOT_NULL(qn->next_head_exact)) + len += SIZE_OP_PUSH_IF_PEEK_NEXT + mod_tlen + SIZE_OP_JUMP; + else + len += SIZE_OP_PUSH + mod_tlen + SIZE_OP_JUMP; + } + else + len += SIZE_OP_JUMP + mod_tlen + SIZE_OP_PUSH; + } + else if (qn->upper == 0 && qn->is_refered != 0) { /* /(?<n>..){0}/ */ + len = SIZE_OP_JUMP + tlen; + } + else if (!infinite && qn->greedy && + (tlen + SIZE_OP_PUSH) * qn->upper <= QUALIFIER_EXPAND_LIMIT_SIZE) { + len = tlen * qn->lower; + len += (SIZE_OP_PUSH + tlen) * (qn->upper - qn->lower); + } + else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */ + len = SIZE_OP_PUSH + SIZE_OP_JUMP + tlen; + } + else { + len = SIZE_OP_REPEAT_INC + + mod_tlen + SIZE_OPCODE + SIZE_RELADDR + SIZE_MEMNUM; + } + + return len; +} + +static int +is_anychar_star_qualifier(QualifierNode* qn) +{ + if (qn->greedy && IS_REPEAT_INFINITE(qn->upper) && + NTYPE(qn->target) == N_ANYCHAR) + return 1; + else + return 0; +} + +static int +compile_qualifier_node(QualifierNode* qn, regex_t* reg) +{ + int i, r, mod_tlen; + int infinite = IS_REPEAT_INFINITE(qn->upper); + int empty_check = (infinite && qn->target_may_empty); + int tlen = compile_length_tree(qn->target, reg); + + if (tlen < 0) return tlen; + + if (is_anychar_star_qualifier(qn)) { + r = compile_tree_n_times(qn->target, qn->lower, reg); + if (r) return r; + if (IS_NOT_NULL(qn->next_head_exact)) { + r = add_opcode(reg, OP_ANYCHAR_STAR_PEEK_NEXT); + if (r) return r; + return add_bytes(reg, NSTRING(qn->next_head_exact).s, 1); + } + else + return add_opcode(reg, OP_ANYCHAR_STAR); + } + + if (empty_check) + mod_tlen = tlen + (SIZE_OP_NULL_CHECK_START + SIZE_OP_NULL_CHECK_END); + else + mod_tlen = tlen; + + if (infinite && + (qn->lower <= 1 || tlen * qn->lower <= QUALIFIER_EXPAND_LIMIT_SIZE)) { + if (qn->lower == 1 && tlen > QUALIFIER_EXPAND_LIMIT_SIZE) { + if (qn->greedy) { + if (IS_NOT_NULL(qn->head_exact)) + r = add_opcode_rel_addr(reg, OP_JUMP, SIZE_OP_PUSH_OR_JUMP_EXACT1); + else if (IS_NOT_NULL(qn->next_head_exact)) + r = add_opcode_rel_addr(reg, OP_JUMP, SIZE_OP_PUSH_IF_PEEK_NEXT); + else + r = add_opcode_rel_addr(reg, OP_JUMP, SIZE_OP_PUSH); + } + else { + r = add_opcode_rel_addr(reg, OP_JUMP, SIZE_OP_JUMP); + } + if (r) return r; + } + else { + r = compile_tree_n_times(qn->target, qn->lower, reg); + if (r) return r; + } + + if (qn->greedy) { + if (IS_NOT_NULL(qn->head_exact)) { + r = add_opcode_rel_addr(reg, OP_PUSH_OR_JUMP_EXACT1, + mod_tlen + SIZE_OP_JUMP); + if (r) return r; + add_bytes(reg, NSTRING(qn->head_exact).s, 1); + r = compile_tree_empty_check(qn->target, reg, empty_check); + if (r) return r; + r = add_opcode_rel_addr(reg, OP_JUMP, + -(mod_tlen + SIZE_OP_JUMP + SIZE_OP_PUSH_OR_JUMP_EXACT1)); + } + else if (IS_NOT_NULL(qn->next_head_exact)) { + r = add_opcode_rel_addr(reg, OP_PUSH_IF_PEEK_NEXT, + mod_tlen + SIZE_OP_JUMP); + if (r) return r; + add_bytes(reg, NSTRING(qn->next_head_exact).s, 1); + r = compile_tree_empty_check(qn->target, reg, empty_check); + if (r) return r; + r = add_opcode_rel_addr(reg, OP_JUMP, + -(mod_tlen + SIZE_OP_JUMP + SIZE_OP_PUSH_IF_PEEK_NEXT)); + } + else { + r = add_opcode_rel_addr(reg, OP_PUSH, mod_tlen + SIZE_OP_JUMP); + if (r) return r; + r = compile_tree_empty_check(qn->target, reg, empty_check); + if (r) return r; + r = add_opcode_rel_addr(reg, OP_JUMP, + -(mod_tlen + SIZE_OP_JUMP + SIZE_OP_PUSH)); + } + } + else { + r = add_opcode_rel_addr(reg, OP_JUMP, mod_tlen); + if (r) return r; + r = compile_tree_empty_check(qn->target, reg, empty_check); + if (r) return r; + r = add_opcode_rel_addr(reg, OP_PUSH, -(mod_tlen + SIZE_OP_PUSH)); + } + } + else if (qn->upper == 0 && qn->is_refered != 0) { /* /(?<n>..){0}/ */ + r = add_opcode_rel_addr(reg, OP_JUMP, tlen); + if (r) return r; + r = compile_tree(qn->target, reg); + } + else if (!infinite && qn->greedy && + (tlen + SIZE_OP_PUSH) * qn->upper <= QUALIFIER_EXPAND_LIMIT_SIZE) { + int n = qn->upper - qn->lower; + + r = compile_tree_n_times(qn->target, qn->lower, reg); + if (r) return r; + + for (i = 0; i < n; i++) { + r = add_opcode_rel_addr(reg, OP_PUSH, + (n - i) * tlen + (n - i - 1) * SIZE_OP_PUSH); + if (r) return r; + r = compile_tree(qn->target, reg); + if (r) return r; + } + } + else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */ + r = add_opcode_rel_addr(reg, OP_PUSH, SIZE_OP_JUMP); + if (r) return r; + r = add_opcode_rel_addr(reg, OP_JUMP, tlen); + if (r) return r; + r = compile_tree(qn->target, reg); + } + else { + r = compile_range_repeat_node(qn, mod_tlen, empty_check, reg); + } + return r; +} + +static int +compile_length_option_node(EffectNode* node, regex_t* reg) +{ + int tlen; + RegOptionType prev = reg->options; + + reg->options = node->option; + tlen = compile_length_tree(node->target, reg); + reg->options = prev; + + if (tlen < 0) return tlen; + + return SIZE_OP_SET_OPTION_PUSH + SIZE_OP_SET_OPTION + SIZE_OP_FAIL + + tlen + SIZE_OP_SET_OPTION; +} + +static int +compile_option_node(EffectNode* node, regex_t* reg) +{ + int r; + RegOptionType prev = reg->options; + + r = add_opcode_option(reg, OP_SET_OPTION_PUSH, node->option); + if (r) return r; + r = add_opcode_option(reg, OP_SET_OPTION, prev); + if (r) return r; + r = add_opcode(reg, OP_FAIL); + if (r) return r; + + reg->options = node->option; + r = compile_tree(node->target, reg); + reg->options = prev; + if (r) return r; + + r = add_opcode_option(reg, OP_SET_OPTION, prev); + return r; +} + +static int +compile_length_effect_node(EffectNode* node, regex_t* reg) +{ + int len; + int tlen; + + if (node->type == EFFECT_OPTION) + return compile_length_option_node(node, reg); + + if (node->target) { + tlen = compile_length_tree(node->target, reg); + if (tlen < 0) return tlen; + } + else + tlen = 0; + + switch (node->type) { + case EFFECT_MEMORY: +#ifdef USE_SUBEXP_CALL + if (IS_EFFECT_CALLED(node)) { + len = SIZE_OP_MEMORY_START_PUSH + tlen + + SIZE_OP_CALL + SIZE_OP_JUMP + SIZE_OP_RETURN; + if (IS_FIND_CONDITION(reg->options)) + len += (IS_EFFECT_RECURSION(node) + ? SIZE_OP_MEMORY_END_PUSH_REC : SIZE_OP_MEMORY_END_PUSH); + else + len += (IS_EFFECT_RECURSION(node) + ? SIZE_OP_MEMORY_END_REC : SIZE_OP_MEMORY_END); + } + else +#endif + { + if (BIT_STATUS_AT(reg->backtrack_mem, node->regnum)) + len = SIZE_OP_MEMORY_START_PUSH; + else + len = SIZE_OP_MEMORY_START; + + len += tlen + (IS_FIND_CONDITION(reg->options) + ? SIZE_OP_MEMORY_END_PUSH : SIZE_OP_MEMORY_END); + } + break; + + case EFFECT_STOP_BACKTRACK: + if (IS_EFFECT_SIMPLE_REPEAT(node)) { + QualifierNode* qn = &NQUALIFIER(node->target); + tlen = compile_length_tree(qn->target, reg); + if (tlen < 0) return tlen; + + len = tlen * qn->lower + + SIZE_OP_PUSH + tlen + SIZE_OP_POP + SIZE_OP_JUMP; + } + else { + len = SIZE_OP_PUSH_STOP_BT + tlen + SIZE_OP_POP_STOP_BT; + } + break; + + default: + return REGERR_TYPE_BUG; + break; + } + + return len; +} + +static int get_char_length_tree(Node* node, regex_t* reg, int* len); + +static int +compile_effect_node(EffectNode* node, regex_t* reg) +{ + int r, len; + + if (node->type == EFFECT_OPTION) + return compile_option_node(node, reg); + + switch (node->type) { + case EFFECT_MEMORY: +#ifdef USE_SUBEXP_CALL + if (IS_EFFECT_CALLED(node)) { + r = add_opcode(reg, OP_CALL); + if (r) return r; + node->call_addr = BBUF_GET_OFFSET_POS(reg) + SIZE_ABSADDR + SIZE_OP_JUMP; + node->state |= NST_ADDR_FIXED; + r = add_abs_addr(reg, (int )node->call_addr); + if (r) return r; + len = compile_length_tree(node->target, reg); + len += (SIZE_OP_MEMORY_START_PUSH + SIZE_OP_RETURN); + if (IS_FIND_CONDITION(reg->options)) + len += (IS_EFFECT_RECURSION(node) + ? SIZE_OP_MEMORY_END_PUSH_REC : SIZE_OP_MEMORY_END_PUSH); + else + len += (IS_EFFECT_RECURSION(node) + ? SIZE_OP_MEMORY_END_REC : SIZE_OP_MEMORY_END); + + r = add_opcode_rel_addr(reg, OP_JUMP, len); + if (r) return r; + } +#endif + if (BIT_STATUS_AT(reg->backtrack_mem, node->regnum)) + r = add_opcode(reg, OP_MEMORY_START_PUSH); + else + r = add_opcode(reg, OP_MEMORY_START); + if (r) return r; + r = add_mem_num(reg, node->regnum); + if (r) return r; + r = compile_tree(node->target, reg); + if (r) return r; +#ifdef USE_SUBEXP_CALL + if (IS_EFFECT_CALLED(node)) { + if (IS_FIND_CONDITION(reg->options)) + r = add_opcode(reg, (IS_EFFECT_RECURSION(node) + ? OP_MEMORY_END_PUSH_REC : OP_MEMORY_END_PUSH)); + else + r = add_opcode(reg, (IS_EFFECT_RECURSION(node) + ? OP_MEMORY_END_REC : OP_MEMORY_END)); + + if (r) return r; + r = add_mem_num(reg, node->regnum); + if (r) return r; + r = add_opcode(reg, OP_RETURN); + } + else +#endif + { + if (IS_FIND_CONDITION(reg->options)) + r = add_opcode(reg, OP_MEMORY_END_PUSH); + else + r = add_opcode(reg, OP_MEMORY_END); + if (r) return r; + r = add_mem_num(reg, node->regnum); + } + break; + + case EFFECT_STOP_BACKTRACK: + if (IS_EFFECT_SIMPLE_REPEAT(node)) { + QualifierNode* qn = &NQUALIFIER(node->target); + r = compile_tree_n_times(qn->target, qn->lower, reg); + if (r) return r; + + len = compile_length_tree(qn->target, reg); + if (len < 0) return len; + + r = add_opcode_rel_addr(reg, OP_PUSH, len + SIZE_OP_POP + SIZE_OP_JUMP); + if (r) return r; + r = compile_tree(qn->target, reg); + if (r) return r; + r = add_opcode(reg, OP_POP); + if (r) return r; + r = add_opcode_rel_addr(reg, OP_JUMP, + -(SIZE_OP_PUSH + len + SIZE_OP_POP + SIZE_OP_JUMP)); + } + else { + r = add_opcode(reg, OP_PUSH_STOP_BT); + if (r) return r; + r = compile_tree(node->target, reg); + if (r) return r; + r = add_opcode(reg, OP_POP_STOP_BT); + } + break; + + default: + return REGERR_TYPE_BUG; + break; + } + + return r; +} + +static int +compile_length_anchor_node(AnchorNode* node, regex_t* reg) +{ + int len; + int tlen = 0; + + if (node->target) { + tlen = compile_length_tree(node->target, reg); + if (tlen < 0) return tlen; + } + + switch (node->type) { + case ANCHOR_PREC_READ: + len = SIZE_OP_PUSH_POS + tlen + SIZE_OP_POP_POS; + break; + case ANCHOR_PREC_READ_NOT: + len = SIZE_OP_PUSH_POS_NOT + tlen + SIZE_OP_FAIL_POS; + break; + case ANCHOR_LOOK_BEHIND: + len = SIZE_OP_LOOK_BEHIND + tlen; + break; + case ANCHOR_LOOK_BEHIND_NOT: + len = SIZE_OP_PUSH_LOOK_BEHIND_NOT + tlen + SIZE_OP_FAIL_LOOK_BEHIND_NOT; + break; + + default: + len = SIZE_OPCODE; + break; + } + + return len; +} + +static int +compile_anchor_node(AnchorNode* node, regex_t* reg) +{ + int r, len; + + switch (node->type) { + case ANCHOR_BEGIN_BUF: r = add_opcode(reg, OP_BEGIN_BUF); break; + case ANCHOR_END_BUF: r = add_opcode(reg, OP_END_BUF); break; + case ANCHOR_BEGIN_LINE: r = add_opcode(reg, OP_BEGIN_LINE); break; + case ANCHOR_END_LINE: r = add_opcode(reg, OP_END_LINE); break; + case ANCHOR_SEMI_END_BUF: r = add_opcode(reg, OP_SEMI_END_BUF); break; + case ANCHOR_BEGIN_POSITION: r = add_opcode(reg, OP_BEGIN_POSITION); break; + + case ANCHOR_WORD_BOUND: r = add_opcode(reg, OP_WORD_BOUND); break; + case ANCHOR_NOT_WORD_BOUND: r = add_opcode(reg, OP_NOT_WORD_BOUND); break; +#ifdef USE_WORD_BEGIN_END + case ANCHOR_WORD_BEGIN: r = add_opcode(reg, OP_WORD_BEGIN); break; + case ANCHOR_WORD_END: r = add_opcode(reg, OP_WORD_END); break; +#endif + + case ANCHOR_PREC_READ: + r = add_opcode(reg, OP_PUSH_POS); + if (r) return r; + r = compile_tree(node->target, reg); + if (r) return r; + r = add_opcode(reg, OP_POP_POS); + break; + + case ANCHOR_PREC_READ_NOT: + len = compile_length_tree(node->target, reg); + if (len < 0) return len; + r = add_opcode_rel_addr(reg, OP_PUSH_POS_NOT, len + SIZE_OP_FAIL_POS); + if (r) return r; + r = compile_tree(node->target, reg); + if (r) return r; + r = add_opcode(reg, OP_FAIL_POS); + break; + + case ANCHOR_LOOK_BEHIND: + { + int n; + r = add_opcode(reg, OP_LOOK_BEHIND); + if (r) return r; + if (node->char_len < 0) { + r = get_char_length_tree(node->target, reg, &n); + if (r) return REGERR_INVALID_LOOK_BEHIND_PATTERN; + } + else + n = node->char_len; + r = add_length(reg, n); + if (r) return r; + r = compile_tree(node->target, reg); + } + break; + + case ANCHOR_LOOK_BEHIND_NOT: + { + int n; + len = compile_length_tree(node->target, reg); + r = add_opcode_rel_addr(reg, OP_PUSH_LOOK_BEHIND_NOT, + len + SIZE_OP_FAIL_LOOK_BEHIND_NOT); + if (r) return r; + if (node->char_len < 0) { + r = get_char_length_tree(node->target, reg, &n); + if (r) return REGERR_INVALID_LOOK_BEHIND_PATTERN; + } + else + n = node->char_len; + r = add_length(reg, n); + if (r) return r; + r = compile_tree(node->target, reg); + if (r) return r; + r = add_opcode(reg, OP_FAIL_LOOK_BEHIND_NOT); + } + break; + + default: + return REGERR_TYPE_BUG; + break; + } + + return r; +} + +static int +compile_length_tree(Node* node, regex_t* reg) +{ + int len, type, r; + + type = NTYPE(node); + switch (type) { + case N_LIST: + len = 0; + do { + r = compile_length_tree(NCONS(node).left, reg); + if (r < 0) return r; + len += r; + } while (IS_NOT_NULL(node = NCONS(node).right)); + r = len; + break; + + case N_ALT: + { + int n; + + n = r = 0; + do { + r += compile_length_tree(NCONS(node).left, reg); + n++; + } while (IS_NOT_NULL(node = NCONS(node).right)); + r += (SIZE_OP_PUSH + SIZE_OP_JUMP) * (n - 1); + } + break; + + case N_STRING: + if (NSTRING_IS_RAW(node)) + r = compile_length_string_raw_node(&(NSTRING(node)), reg); + else + r = compile_length_string_node(&(NSTRING(node)), reg); + break; + + case N_CCLASS: + r = compile_length_cclass_node(&(NCCLASS(node)), reg); + break; + + case N_CTYPE: + case N_ANYCHAR: + r = SIZE_OPCODE; + break; + + case N_BACKREF: + { + BackrefNode* br = &(NBACKREF(node)); + + if (br->back_num == 1) { + r = (br->back_static[0] <= 3 + ? SIZE_OPCODE : (SIZE_OPCODE + SIZE_MEMNUM)); + } + else { + r = SIZE_OPCODE + SIZE_LENGTH + (SIZE_MEMNUM * br->back_num); + } + } + break; + +#ifdef USE_SUBEXP_CALL + case N_CALL: + r = SIZE_OP_CALL; + break; +#endif + + case N_QUALIFIER: + r = compile_length_qualifier_node(&(NQUALIFIER(node)), reg); + break; + + case N_EFFECT: + r = compile_length_effect_node(&NEFFECT(node), reg); + break; + + case N_ANCHOR: + r = compile_length_anchor_node(&(NANCHOR(node)), reg); + break; + + default: + return REGERR_TYPE_BUG; + break; + } + + return r; +} + +static int +compile_tree(Node* node, regex_t* reg) +{ + int n, type, len, pos, r = 0; + + type = NTYPE(node); + switch (type) { + case N_LIST: + do { + r = compile_tree(NCONS(node).left, reg); + } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); + break; + + case N_ALT: + { + Node* x = node; + len = 0; + do { + len += compile_length_tree(NCONS(x).left, reg); + if (NCONS(x).right != NULL) { + len += SIZE_OP_PUSH + SIZE_OP_JUMP; + } + } while (IS_NOT_NULL(x = NCONS(x).right)); + pos = reg->used + len; /* goal position */ + + do { + len = compile_length_tree(NCONS(node).left, reg); + if (IS_NOT_NULL(NCONS(node).right)) { + r = add_opcode_rel_addr(reg, OP_PUSH, len + SIZE_OP_JUMP); + if (r) break; + } + r = compile_tree(NCONS(node).left, reg); + if (r) break; + if (IS_NOT_NULL(NCONS(node).right)) { + len = pos - (reg->used + SIZE_OP_JUMP); + r = add_opcode_rel_addr(reg, OP_JUMP, len); + if (r) break; + } + } while (IS_NOT_NULL(node = NCONS(node).right)); + } + break; + + case N_STRING: + if (NSTRING_IS_RAW(node)) + r = compile_string_raw_node(&(NSTRING(node)), reg); + else + r = compile_string_node(&(NSTRING(node)), reg); + break; + + case N_CCLASS: + r = compile_cclass_node(&(NCCLASS(node)), reg); + break; + + case N_CTYPE: + { + int op; + + switch (NCTYPE(node).type) { + case CTYPE_WORD: op = OP_WORD; break; + case CTYPE_NOT_WORD: op = OP_NOT_WORD; break; +#ifdef USE_SBMB_CLASS + case CTYPE_WORD_SB: op = OP_WORD_SB; break; + case CTYPE_WORD_MB: op = OP_WORD_MB; break; +#endif + default: + return REGERR_TYPE_BUG; + break; + } + r = add_opcode(reg, op); + } + break; + + case N_ANYCHAR: + r = add_opcode(reg, OP_ANYCHAR); + break; + + case N_BACKREF: + { + int i; + BackrefNode* br = &(NBACKREF(node)); + + if (br->back_num == 1) { + n = br->back_static[0]; + switch (n) { + case 1: r = add_opcode(reg, OP_BACKREF1); break; + case 2: r = add_opcode(reg, OP_BACKREF2); break; + case 3: r = add_opcode(reg, OP_BACKREF3); break; + default: + r = add_opcode(reg, OP_BACKREFN); + if (r) return r; + r = add_mem_num(reg, n); + break; + } + } + else { + int* p; + add_opcode(reg, OP_BACKREF_MULTI); + if (r) return r; + add_length(reg, br->back_num); + if (r) return r; + p = BACKREFS_P(br); + for (i = br->back_num - 1; i >= 0; i--) { + r = add_mem_num(reg, p[i]); + if (r) return r; + } + } + } + break; + +#ifdef USE_SUBEXP_CALL + case N_CALL: + r = compile_call(&(NCALL(node)), reg); + break; +#endif + + case N_QUALIFIER: + r = compile_qualifier_node(&(NQUALIFIER(node)), reg); + break; + + case N_EFFECT: + r = compile_effect_node(&NEFFECT(node), reg); + break; + + case N_ANCHOR: + r = compile_anchor_node(&(NANCHOR(node)), reg); + break; + + default: +#ifdef REG_DEBUG + fprintf(stderr, "compile_tree: undefined node type %d\n", NTYPE(node)); +#endif + break; + } + + return r; +} + +#ifdef USE_SUBEXP_CALL +static int +unset_addr_list_fix(UnsetAddrList* uslist, regex_t* reg) +{ + int i, offset; + EffectNode* en; + AbsAddrType addr; +#ifndef UNALIGNED_WORD_ACCESS + UChar buf[SERIALIZE_BUFSIZE]; +#endif + + for (i = 0; i < uslist->num; i++) { + en = &(NEFFECT(uslist->us[i].target)); + if (! IS_EFFECT_ADDR_FIXED(en)) return REGERR_PARSER_BUG; + addr = en->call_addr; + offset = uslist->us[i].offset; + +#ifdef UNALIGNED_WORD_ACCESS + BBUF_WRITE(reg, offset, &addr, SIZE_ABSADDR); +#else + SERIALIZE_ABSADDR(addr, buf); + BBUF_WRITE(reg, offset, buf, SIZE_ABSADDR); +#endif + } + return 0; +} +#endif + +static int +get_min_match_length(Node* node, RegDistance *min, ScanEnv* env) +{ + RegDistance tmin; + int r = 0; + + *min = 0; + switch (NTYPE(node)) { + case N_BACKREF: + { + int i; + int* backs; + Node** nodes = SCANENV_MEM_NODES(env); + BackrefNode* br = &(NBACKREF(node)); + if (br->state & NST_RECURSION) break; + + backs = BACKREFS_P(br); + if (backs[0] > env->num_mem) return REGERR_INVALID_BACKREF; + r = get_min_match_length(nodes[backs[0]], min, env); + if (r != 0) break; + for (i = 1; i < br->back_num; i++) { + if (backs[i] > env->num_mem) return REGERR_INVALID_BACKREF; + r = get_min_match_length(nodes[backs[i]], &tmin, env); + if (r != 0) break; + if (*min > tmin) *min = tmin; + } + } + break; + +#ifdef USE_SUBEXP_CALL + case N_CALL: + if (IS_CALL_RECURSION(&NCALL(node))) { + EffectNode* en = &(NEFFECT(NCALL(node).target)); + if (IS_EFFECT_MIN_FIXED(en)) + *min = en->min_len; + } + else + r = get_min_match_length(NCALL(node).target, min, env); + break; +#endif + + case N_LIST: + do { + r = get_min_match_length(NCONS(node).left, &tmin, env); + if (r == 0) *min += tmin; + } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); + break; + + case N_ALT: + { + Node *x, *y; + y = node; + do { + x = NCONS(y).left; + r = get_min_match_length(x, &tmin, env); + if (r != 0) break; + if (y == node) *min = tmin; + else if (*min > tmin) *min = tmin; + } while (r == 0 && IS_NOT_NULL(y = NCONS(y).right)); + } + break; + + case N_STRING: + { + StrNode* sn = &(NSTRING(node)); + *min = sn->end - sn->s; + } + break; + + case N_CTYPE: + switch (NCTYPE(node).type) { + case CTYPE_WORD: *min = 1; break; + case CTYPE_NOT_WORD: *min = 1; break; +#ifdef USE_SBMB_CLASS + case CTYPE_WORD_SB: *min = 1; break; + case CTYPE_WORD_MB: *min = 2; break; +#endif + default: + break; + } + break; + + case N_CCLASS: + case N_ANYCHAR: + *min = 1; + break; + + case N_QUALIFIER: + { + QualifierNode* qn = &(NQUALIFIER(node)); + + if (qn->lower > 0) { + r = get_min_match_length(qn->target, min, env); + if (r == 0) + *min = distance_multiply(*min, qn->lower); + } + } + break; + + case N_EFFECT: + { + EffectNode* en = &(NEFFECT(node)); + switch (en->type) { + case EFFECT_MEMORY: +#ifdef USE_SUBEXP_CALL + if (IS_EFFECT_MIN_FIXED(en)) + *min = en->min_len; + else { + r = get_min_match_length(en->target, min, env); + if (r == 0) { + en->min_len = *min; + SET_EFFECT_STATUS(node, NST_MIN_FIXED); + } + } + break; +#endif + case EFFECT_OPTION: + case EFFECT_STOP_BACKTRACK: + r = get_min_match_length(en->target, min, env); + break; + } + } + break; + + case N_ANCHOR: + default: + break; + } + + return r; +} + +static int +get_max_match_length(Node* node, RegDistance *max, ScanEnv* env) +{ + RegDistance tmax; + int r = 0; + + *max = 0; + switch (NTYPE(node)) { + case N_LIST: + do { + r = get_max_match_length(NCONS(node).left, &tmax, env); + if (r == 0) + *max = distance_add(*max, tmax); + } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); + break; + + case N_ALT: + do { + r = get_max_match_length(NCONS(node).left, &tmax, env); + if (r == 0 && *max < tmax) *max = tmax; + } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); + break; + + case N_STRING: + { + StrNode* sn = &(NSTRING(node)); + *max = sn->end - sn->s; + } + break; + + case N_CTYPE: + switch (NCTYPE(node).type) { + case CTYPE_WORD: + case CTYPE_NOT_WORD: +#ifdef USE_SBMB_CLASS + case CTYPE_WORD_MB: +#endif + *max = mbmaxlen_dist(env->enc); + break; + +#ifdef USE_SBMB_CLASS + case CTYPE_WORD_SB: + *max = 1; + break; +#endif + + default: + break; + } + break; + + case N_CCLASS: + case N_ANYCHAR: + *max = mbmaxlen_dist(env->enc); + break; + + case N_BACKREF: + { + int i; + int* backs; + Node** nodes = SCANENV_MEM_NODES(env); + BackrefNode* br = &(NBACKREF(node)); + if (br->state & NST_RECURSION) { + *max = INFINITE_DISTANCE; + break; + } + backs = BACKREFS_P(br); + for (i = 0; i < br->back_num; i++) { + if (backs[i] > env->num_mem) return REGERR_INVALID_BACKREF; + r = get_max_match_length(nodes[backs[i]], &tmax, env); + if (r != 0) break; + if (*max < tmax) *max = tmax; + } + } + break; + +#ifdef USE_SUBEXP_CALL + case N_CALL: + if (! IS_CALL_RECURSION(&(NCALL(node)))) + r = get_max_match_length(NCALL(node).target, max, env); + else + *max = INFINITE_DISTANCE; + break; +#endif + + case N_QUALIFIER: + { + QualifierNode* qn = &(NQUALIFIER(node)); + + if (qn->upper != 0) { + r = get_max_match_length(qn->target, max, env); + if (r == 0 && *max != 0) { + if (! IS_REPEAT_INFINITE(qn->upper)) + *max = distance_multiply(*max, qn->upper); + else + *max = INFINITE_DISTANCE; + } + } + } + break; + + case N_EFFECT: + { + EffectNode* en = &(NEFFECT(node)); + switch (en->type) { + case EFFECT_MEMORY: +#ifdef USE_SUBEXP_CALL + if (IS_EFFECT_MAX_FIXED(en)) + *max = en->max_len; + else { + r = get_max_match_length(en->target, max, env); + if (r == 0) { + en->max_len = *max; + SET_EFFECT_STATUS(node, NST_MAX_FIXED); + } + } + break; +#endif + case EFFECT_OPTION: + case EFFECT_STOP_BACKTRACK: + r = get_max_match_length(en->target, max, env); + break; + } + } + break; + + case N_ANCHOR: + default: + break; + } + + return r; +} + +#define GET_CHAR_LEN_VARLEN -1 +#define GET_CHAR_LEN_TOP_ALT_VARLEN -2 + +/* fixed size pattern node only */ +static int +get_char_length_tree1(Node* node, regex_t* reg, int* len, int level) +{ + int tlen; + int r = 0; + + level++; + *len = 0; + switch (NTYPE(node)) { + case N_LIST: + do { + r = get_char_length_tree1(NCONS(node).left, reg, &tlen, level); + if (r == 0) + *len = distance_add(*len, tlen); + } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); + break; + + case N_ALT: + { + int tlen2; + int varlen = 0; + + r = get_char_length_tree1(NCONS(node).left, reg, &tlen, level); + while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)) { + r = get_char_length_tree1(NCONS(node).left, reg, &tlen2, level); + if (r == 0) { + if (tlen != tlen2) + varlen = 1; + } + } + if (r == 0) { + if (varlen != 0) { + if (level == 1) + r = GET_CHAR_LEN_TOP_ALT_VARLEN; + else + r = GET_CHAR_LEN_VARLEN; + } + else + *len = tlen; + } + } + break; + + case N_STRING: + { + StrNode* sn = &(NSTRING(node)); + UChar *s = sn->s; + while (s < sn->end) { + s += mblen(reg->enc, *s); + (*len)++; + } + } + break; + + case N_QUALIFIER: + { + QualifierNode* qn = &(NQUALIFIER(node)); + if (qn->lower == qn->upper) { + r = get_char_length_tree1(qn->target, reg, &tlen, level); + if (r == 0) + *len = distance_multiply(tlen, qn->lower); + } + else + r = GET_CHAR_LEN_VARLEN; + } + break; + +#ifdef USE_SUBEXP_CALL + case N_CALL: + if (! IS_CALL_RECURSION(&(NCALL(node)))) + r = get_char_length_tree1(NCALL(node).target, reg, len, level); + else + r = GET_CHAR_LEN_VARLEN; + break; +#endif + + case N_CTYPE: + switch (NCTYPE(node).type) { + case CTYPE_WORD: + case CTYPE_NOT_WORD: +#ifdef USE_SBMB_CLASS + case CTYPE_WORD_SB: + case CTYPE_WORD_MB: +#endif + *len = 1; + break; + } + break; + + case N_CCLASS: + case N_ANYCHAR: + *len = 1; + break; + + case N_EFFECT: + { + EffectNode* en = &(NEFFECT(node)); + switch (en->type) { + case EFFECT_MEMORY: +#ifdef USE_SUBEXP_CALL + if (IS_EFFECT_CLEN_FIXED(en)) + *len = en->char_len; + else { + r = get_char_length_tree1(en->target, reg, len, level); + if (r == 0) { + en->char_len = *len; + SET_EFFECT_STATUS(node, NST_CLEN_FIXED); + } + } + break; +#endif + case EFFECT_OPTION: + case EFFECT_STOP_BACKTRACK: + r = get_char_length_tree1(en->target, reg, len, level); + break; + default: + break; + } + } + break; + + case N_ANCHOR: + break; + + default: + r = GET_CHAR_LEN_VARLEN; + break; + } + + return r; +} + +static int +get_char_length_tree(Node* node, regex_t* reg, int* len) +{ + return get_char_length_tree1(node, reg, len, 0); +} + +/* x is not included y ==> 1 : 0 */ +static int +is_not_included(Node* x, Node* y, regex_t* reg) +{ + int i, len; + WCINT wc; + UChar *p, c; + int ytype; + + retry: + ytype = NTYPE(y); + switch (NTYPE(x)) { + case N_CTYPE: + { + switch (ytype) { + case N_CTYPE: + switch (NCTYPE(x).type) { + case CTYPE_WORD: + if (NCTYPE(y).type == CTYPE_NOT_WORD) + return 1; + else + return 0; + break; + case CTYPE_NOT_WORD: + if (NCTYPE(y).type == CTYPE_WORD) + return 1; + else + return 0; + break; +#ifdef USE_SBMB_CLASS + case CTYPE_WORD_SB: + case CTYPE_WORD_MB: + break; +#endif + default: + break; + } + break; + + case N_CCLASS: + swap: + { + Node* tmp; + tmp = x; x = y; y = tmp; + goto retry; + } + break; + + case N_STRING: + goto swap; + break; + + default: + break; + } + } + break; + + case N_CCLASS: + { + CClassNode* xc = &(NCCLASS(x)); + switch (ytype) { + case N_CTYPE: + switch (NCTYPE(y).type) { + case CTYPE_WORD: + if (IS_NULL(xc->mbuf) && xc->not == 0) { + for (i = 0; i < SINGLE_BYTE_SIZE; i++) { + if (BITSET_AT(xc->bs, i)) { + if (IS_SB_WORD(reg->enc, i)) return 0; + } + } + return 1; + } + return 0; + break; + case CTYPE_NOT_WORD: + for (i = 0; i < SINGLE_BYTE_SIZE; i++) { + if (! IS_SB_WORD(reg->enc, i)) { + if (xc->not == 0) { + if (BITSET_AT(xc->bs, i)) + return 0; + } + else { + if (! BITSET_AT(xc->bs, i)) + return 0; + } + } + } + return 1; + break; + +#ifdef USE_SBMB_CLASS + case CTYPE_WORD_SB: + case CTYPE_WORD_MB: + break; +#endif + default: + break; + } + break; + + case N_CCLASS: + { + int v; + CClassNode* yc = &(NCCLASS(y)); + + for (i = 0; i < SINGLE_BYTE_SIZE; i++) { + v = BITSET_AT(xc->bs, i); + if ((v != 0 && xc->not == 0) || (v == 0 && xc->not)) { + v = BITSET_AT(yc->bs, i); + if ((v != 0 && yc->not == 0) || (v == 0 && yc->not)) + return 0; + } + } + if ((IS_NULL(xc->mbuf) && xc->not == 0) || + (IS_NULL(yc->mbuf) && yc->not == 0)) + return 1; + return 0; + } + break; + + case N_STRING: + goto swap; + break; + + default: + break; + } + } + break; + + case N_STRING: + { + StrNode* xs = &(NSTRING(x)); + if (NSTRING_LEN(x) == 0) + break; + + c = *(xs->s); + switch (ytype) { + case N_CTYPE: + switch (NCTYPE(y).type) { + case CTYPE_WORD: + return (IS_WORD_STR(reg->enc, xs->s, xs->end) ? 0 : 1); + break; + case CTYPE_NOT_WORD: + return (IS_WORD_STR(reg->enc, xs->s, xs->end) ? 1 : 0); + break; +#ifdef USE_SBMB_CLASS + case CTYPE_WORD_SB: + return (ismb(reg->enc, c) ? 1 : 0); + break; + case CTYPE_WORD_MB: + return (ismb(reg->enc, c) ? 0 : 1); + break; +#endif + default: + break; + } + break; + + case N_CCLASS: + { + CClassNode* cc = &(NCCLASS(y)); + if (ismb(reg->enc, c)) { + if (IS_NULL(cc->mbuf)) + return (cc->not == 0 ? 1 : 0); + else { + len = mblen(reg->enc, c); + wc = MB2WC(xs->s, xs->s + len, reg->enc); + p = cc->mbuf->p + SIZE_BITSET; + if (regex_is_in_wc_range(p, wc)) + return (cc->not == 0 ? 0 : 1); + else + return (cc->not == 0 ? 1 : 0); + } + } + else { + if (BITSET_AT(cc->bs, c) == 0) + return (cc->not == 0 ? 1 : 0); + else + return (cc->not == 0 ? 0 : 1); + } + } + break; + + case N_STRING: + { + UChar *q; + StrNode* ys = &(NSTRING(y)); + len = NSTRING_LEN(x); + if (len > NSTRING_LEN(y)) len = NSTRING_LEN(y); + if (NSTRING_IS_CASE_AMBIG(x) || NSTRING_IS_CASE_AMBIG(y)) { + for (i = 0, p = ys->s, q = xs->s; i < len; i++, p++, q++) { + if (TOLOWER(reg->enc, *p) != TOLOWER(reg->enc, *q)) + return 1; + } + } + else { + for (i = 0, p = ys->s, q = xs->s; i < len; i++, p++, q++) { + if (*p != *q) return 1; + } + } + } + break; + + default: + break; + } + } + break; + + default: + break; + } + + return 0; +} + +static Node* +get_head_value_node(Node* node, int exact, regex_t* reg) +{ + Node* n = NULL_NODE; + + switch (NTYPE(node)) { + case N_BACKREF: + case N_ALT: + case N_ANYCHAR: +#ifdef USE_SUBEXP_CALL + case N_CALL: +#endif + break; + + case N_CTYPE: + case N_CCLASS: + if (exact == 0) { + n = node; + } + break; + + case N_LIST: + n = get_head_value_node(NCONS(node).left, exact, reg); + break; + + case N_STRING: + { + StrNode* sn = &(NSTRING(node)); + + if (sn->end <= sn->s) + break; + + if (exact != 0 && + !NSTRING_IS_RAW(node) && IS_IGNORECASE(reg->options)) { + if (! IS_AMBIGUITY_CHAR(reg->enc, *(sn->s))) + n = node; + } + else { + n = node; + } + } + break; + + case N_QUALIFIER: + { + QualifierNode* qn = &(NQUALIFIER(node)); + if (qn->lower > 0) { + if (IS_NOT_NULL(qn->head_exact)) + n = qn->head_exact; + else + n = get_head_value_node(qn->target, exact, reg); + } + } + break; + + case N_EFFECT: + { + EffectNode* en = &(NEFFECT(node)); + switch (en->type) { + case EFFECT_OPTION: + { + RegOptionType options = reg->options; + + reg->options = NEFFECT(node).option; + n = get_head_value_node(NEFFECT(node).target, exact, reg); + reg->options = options; + } + break; + + case EFFECT_MEMORY: + case EFFECT_STOP_BACKTRACK: + n = get_head_value_node(en->target, exact, reg); + break; + } + } + break; + + case N_ANCHOR: + if (NANCHOR(node).type == ANCHOR_PREC_READ) + n = get_head_value_node(NANCHOR(node).target, exact, reg); + break; + + default: + break; + } + + return n; +} + +static int +check_type_tree(Node* node, int type_mask, int effect_mask, int anchor_mask) +{ + int type, r = 0; + + type = NTYPE(node); + if ((type & type_mask) == 0) + return 1; + + switch (type) { + case N_LIST: + case N_ALT: + do { + r = check_type_tree(NCONS(node).left, type_mask, effect_mask, anchor_mask); + } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); + break; + + case N_QUALIFIER: + r = check_type_tree(NQUALIFIER(node).target, type_mask, effect_mask, + anchor_mask); + break; + + case N_EFFECT: + { + EffectNode* en = &(NEFFECT(node)); + if ((en->type & effect_mask) == 0) + return 1; + + r = check_type_tree(en->target, type_mask, effect_mask, anchor_mask); + } + break; + + case N_ANCHOR: + type = NANCHOR(node).type; + if ((type & anchor_mask) == 0) + return 1; + + if (NANCHOR(node).target) + r = check_type_tree(NANCHOR(node).target, + type_mask, effect_mask, anchor_mask); + break; + + default: + break; + } + return r; +} + +#ifdef USE_SUBEXP_CALL + +#define RECURSION_EXIST 1 +#define RECURSION_INFINITE 2 + +static int +subexp_inf_recursive_check(Node* node, ScanEnv* env, int head) +{ + int type; + int r = 0; + + type = NTYPE(node); + switch (type) { + case N_LIST: + { + Node *x; + RegDistance min; + int ret; + + x = node; + do { + ret = subexp_inf_recursive_check(NCONS(x).left, env, head); + if (ret < 0 || ret == RECURSION_INFINITE) return ret; + r |= ret; + if (head) { + ret = get_min_match_length(NCONS(x).left, &min, env); + if (ret != 0) return ret; + if (min != 0) head = 0; + } + } while (IS_NOT_NULL(x = NCONS(x).right)); + } + break; + + case N_ALT: + { + int ret; + r = RECURSION_EXIST; + do { + ret = subexp_inf_recursive_check(NCONS(node).left, env, head); + if (ret < 0 || ret == RECURSION_INFINITE) return ret; + r &= ret; + } while (IS_NOT_NULL(node = NCONS(node).right)); + } + break; + + case N_QUALIFIER: + r = subexp_inf_recursive_check(NQUALIFIER(node).target, env, head); + break; + + case N_ANCHOR: + { + AnchorNode* an = &(NANCHOR(node)); + switch (an->type) { + case ANCHOR_PREC_READ: + case ANCHOR_PREC_READ_NOT: + case ANCHOR_LOOK_BEHIND: + case ANCHOR_LOOK_BEHIND_NOT: + r = subexp_inf_recursive_check(an->target, env, head); + break; + } + } + break; + + case N_CALL: + r = subexp_inf_recursive_check(NCALL(node).target, env, head); + break; + + case N_EFFECT: + if (IS_EFFECT_MARK2(&(NEFFECT(node)))) + return 0; + else if (IS_EFFECT_MARK1(&(NEFFECT(node)))) + return (head == 0 ? RECURSION_EXIST : RECURSION_INFINITE); + else { + SET_EFFECT_STATUS(node, NST_MARK2); + r = subexp_inf_recursive_check(NEFFECT(node).target, env, head); + CLEAR_EFFECT_STATUS(node, NST_MARK2); + } + break; + + default: + break; + } + + return r; +} + +static int +subexp_inf_recursive_check_trav(Node* node, ScanEnv* env) +{ + int type; + int r = 0; + + type = NTYPE(node); + switch (type) { + case N_LIST: + case N_ALT: + do { + r = subexp_inf_recursive_check_trav(NCONS(node).left, env); + } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); + break; + + case N_QUALIFIER: + r = subexp_inf_recursive_check_trav(NQUALIFIER(node).target, env); + break; + + case N_ANCHOR: + { + AnchorNode* an = &(NANCHOR(node)); + switch (an->type) { + case ANCHOR_PREC_READ: + case ANCHOR_PREC_READ_NOT: + case ANCHOR_LOOK_BEHIND: + case ANCHOR_LOOK_BEHIND_NOT: + r = subexp_inf_recursive_check_trav(an->target, env); + break; + } + } + break; + + case N_EFFECT: + { + EffectNode* en = &(NEFFECT(node)); + + if (IS_EFFECT_RECURSION(en)) { + SET_EFFECT_STATUS(node, NST_MARK1); + r = subexp_inf_recursive_check(en->target, env, 1); + if (r > 0) return REGERR_NEVER_ENDING_RECURSION; + CLEAR_EFFECT_STATUS(node, NST_MARK1); + } + r = subexp_inf_recursive_check_trav(en->target, env); + } + + break; + + default: + break; + } + + return r; +} + +static int +subexp_recursive_check(Node* node) +{ + int type; + int r = 0; + + type = NTYPE(node); + switch (type) { + case N_LIST: + case N_ALT: + do { + r |= subexp_recursive_check(NCONS(node).left); + } while (IS_NOT_NULL(node = NCONS(node).right)); + break; + + case N_QUALIFIER: + r = subexp_recursive_check(NQUALIFIER(node).target); + break; + + case N_ANCHOR: + { + AnchorNode* an = &(NANCHOR(node)); + switch (an->type) { + case ANCHOR_PREC_READ: + case ANCHOR_PREC_READ_NOT: + case ANCHOR_LOOK_BEHIND: + case ANCHOR_LOOK_BEHIND_NOT: + r = subexp_recursive_check(an->target); + break; + } + } + break; + + case N_CALL: + r = subexp_recursive_check(NCALL(node).target); + if (r != 0) SET_CALL_RECURSION(node); + break; + + case N_EFFECT: + if (IS_EFFECT_MARK2(&(NEFFECT(node)))) + return 0; + else if (IS_EFFECT_MARK1(&(NEFFECT(node)))) + return 1; /* recursion */ + else { + SET_EFFECT_STATUS(node, NST_MARK2); + r = subexp_recursive_check(NEFFECT(node).target); + CLEAR_EFFECT_STATUS(node, NST_MARK2); + } + break; + + default: + break; + } + + return r; +} + + +static int +subexp_recursive_check_trav(Node* node, ScanEnv* env) +{ +#define FOUND_CALLED_NODE 1 + + int type; + int r = 0; + + type = NTYPE(node); + switch (type) { + case N_LIST: + case N_ALT: + { + int ret; + do { + ret = subexp_recursive_check_trav(NCONS(node).left, env); + if (ret == FOUND_CALLED_NODE) r = FOUND_CALLED_NODE; + else if (ret < 0) return ret; + } while (IS_NOT_NULL(node = NCONS(node).right)); + } + break; + + case N_QUALIFIER: + r = subexp_recursive_check_trav(NQUALIFIER(node).target, env); + if (NQUALIFIER(node).upper == 0) { + if (r == FOUND_CALLED_NODE) + NQUALIFIER(node).is_refered = 1; + } + break; + + case N_ANCHOR: + { + AnchorNode* an = &(NANCHOR(node)); + switch (an->type) { + case ANCHOR_PREC_READ: + case ANCHOR_PREC_READ_NOT: + case ANCHOR_LOOK_BEHIND: + case ANCHOR_LOOK_BEHIND_NOT: + r = subexp_recursive_check_trav(an->target, env); + break; + } + } + break; + + case N_EFFECT: + { + EffectNode* en = &(NEFFECT(node)); + + if (! IS_EFFECT_RECURSION(en)) { + if (IS_EFFECT_CALLED(en)) { + SET_EFFECT_STATUS(node, NST_MARK1); + r = subexp_recursive_check(en->target); + if (r != 0) SET_EFFECT_STATUS(node, NST_RECURSION); + CLEAR_EFFECT_STATUS(node, NST_MARK1); + } + } + r = subexp_recursive_check_trav(en->target, env); + if (IS_EFFECT_CALLED(en)) + r |= FOUND_CALLED_NODE; + } + break; + + default: + break; + } + + return r; +} + +static int +setup_subexp_call(Node* node, ScanEnv* env) +{ + int type; + int r = 0; + + type = NTYPE(node); + switch (type) { + case N_LIST: + do { + r = setup_subexp_call(NCONS(node).left, env); + } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); + break; + + case N_ALT: + do { + r = setup_subexp_call(NCONS(node).left, env); + } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); + break; + + case N_QUALIFIER: + r = setup_subexp_call(NQUALIFIER(node).target, env); + break; + case N_EFFECT: + r = setup_subexp_call(NEFFECT(node).target, env); + break; + + case N_CALL: + { + int n, num, *refs; + UChar *p; + CallNode* cn = &(NCALL(node)); + Node** nodes = SCANENV_MEM_NODES(env); + +#ifdef USE_NAMED_SUBEXP + n = regex_name_to_group_numbers(env->reg, cn->name, cn->name_end, &refs); +#else + n = REGERR_UNDEFINED_GROUP_REFERENCE; +#endif + if (n <= 0) { + /* name not found, check group number. (?*ddd) */ + p = cn->name; + num = regex_scan_unsigned_number(&p, cn->name_end, env->enc); + if (num <= 0 || p != cn->name_end) { + regex_scan_env_set_error_string(env, + REGERR_UNDEFINED_NAME_REFERENCE, cn->name, cn->name_end); + return REGERR_UNDEFINED_NAME_REFERENCE; + } + if (num > env->num_mem) return REGERR_UNDEFINED_GROUP_REFERENCE; + cn->ref_num = num; + goto set_call_attr; + } + else if (n > 1) { + regex_scan_env_set_error_string(env, + REGERR_MULTIPLEX_DEFINITION_NAME_CALL, cn->name, cn->name_end); + return REGERR_MULTIPLEX_DEFINITION_NAME_CALL; + } + else { + cn->ref_num = refs[0]; + set_call_attr: + cn->target = nodes[cn->ref_num]; + if (IS_NULL(cn->target)) return REGERR_INVALID_SUBEXP_NAME; + SET_EFFECT_STATUS(cn->target, NST_CALLED); + BIT_STATUS_ON_AT(env->backtrack_mem, cn->ref_num); + cn->unset_addr_list = env->unset_addr_list; + } + } + break; + + case N_ANCHOR: + { + AnchorNode* an = &(NANCHOR(node)); + + switch (an->type) { + case ANCHOR_PREC_READ: + case ANCHOR_PREC_READ_NOT: + case ANCHOR_LOOK_BEHIND: + case ANCHOR_LOOK_BEHIND_NOT: + r = setup_subexp_call(an->target, env); + break; + } + } + break; + + default: + break; + } + + return r; +} +#endif + +/* divide different length alternatives in look-behind. + (?<=A|B) ==> (?<=A)|(?<=B) + (?<!A|B) ==> (?<!A)(?<!B) +*/ +static int +divide_look_behind_alternatives(Node* node) +{ + Node tmp_node; + Node *head, *np, *insert_node; + AnchorNode* an = &(NANCHOR(node)); + int anc_type = an->type; + + head = an->target; + np = NCONS(head).left; + tmp_node = *node; *node = *head; *head = tmp_node; + NCONS(node).left = head; + NANCHOR(head).target = np; + + np = node; + while ((np = NCONS(np).right) != NULL_NODE) { + insert_node = regex_node_new_anchor(anc_type); + CHECK_NULL_RETURN_VAL(insert_node, REGERR_MEMORY); + NANCHOR(insert_node).target = NCONS(np).left; + NCONS(np).left = insert_node; + } + + if (anc_type == ANCHOR_LOOK_BEHIND_NOT) { + np = node; + do { + np->type = N_LIST; /* alt -> list */ + } while ((np = NCONS(np).right) != NULL_NODE); + } + return 0; +} + +static int +setup_look_behind(Node* node, regex_t* reg, ScanEnv* env) +{ + int r, len; + AnchorNode* an = &(NANCHOR(node)); + + r = get_char_length_tree(an->target, reg, &len); + if (r == 0) + an->char_len = len; + else if (r == GET_CHAR_LEN_VARLEN) + r = REGERR_INVALID_LOOK_BEHIND_PATTERN; + else if (r == GET_CHAR_LEN_TOP_ALT_VARLEN) { + if (IS_SYNTAX_BV(env->syntax, REG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND)) + r = divide_look_behind_alternatives(node); + else + r = REGERR_INVALID_LOOK_BEHIND_PATTERN; + } + + return r; +} + +static int +next_setup(Node* node, Node* next_node, regex_t* reg) +{ + int type; + + retry: + type = NTYPE(node); + if (type == N_QUALIFIER) { + QualifierNode* qn = &(NQUALIFIER(node)); + if (qn->greedy && IS_REPEAT_INFINITE(qn->upper)) { +#ifdef USE_QUALIFIER_PEEK_NEXT + qn->next_head_exact = get_head_value_node(next_node, 1, reg); +#endif + /* automatic posseivation a*b ==> (?>a*)b */ + if (qn->lower <= 1) { + int ttype = NTYPE(qn->target); + if (IS_NODE_TYPE_SIMPLE(ttype)) { + Node *x, *y; + x = get_head_value_node(qn->target, 0, reg); + if (IS_NOT_NULL(x)) { + y = get_head_value_node(next_node, 0, reg); + if (IS_NOT_NULL(y) && is_not_included(x, y, reg)) { + Node* en = regex_node_new_effect(EFFECT_STOP_BACKTRACK); + CHECK_NULL_RETURN_VAL(en, REGERR_MEMORY); + SET_EFFECT_STATUS(en, NST_SIMPLE_REPEAT); + swap_node(node, en); + NEFFECT(node).target = en; + } + } + } + } + } + } + else if (type == N_EFFECT) { + EffectNode* en = &(NEFFECT(node)); + if (en->type == EFFECT_MEMORY) { + node = en->target; + goto retry; + } + } + return 0; +} + +#define IN_ALT (1<<0) +#define IN_NOT (1<<1) +#define IN_REPEAT (1<<2) + +/* setup_tree does the following work. + 1. check empty loop. (set qn->target_may_empty) + 2. expand ignore-case in char class. + 3. set memory status bit flags. (reg->mem_stats) + 4. set qn->head_exact for [push, exact] -> [push_or_jump_exact1, exact]. + 5. find invalid patterns in look-behind. + 6. expand repeated string. + */ +static int +setup_tree(Node* node, regex_t* reg, int state, ScanEnv* env) +{ + int type; + int r = 0; + + type = NTYPE(node); + switch (type) { + case N_LIST: + { + Node* prev = NULL_NODE; + do { + r = setup_tree(NCONS(node).left, reg, state, env); + if (IS_NOT_NULL(prev) && r == 0) { + r = next_setup(prev, NCONS(node).left, reg); + } + prev = NCONS(node).left; + } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); + } + break; + + case N_ALT: + do { + r = setup_tree(NCONS(node).left, reg, (state | IN_ALT), env); + } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); + break; + + case N_CCLASS: + if (IS_IGNORECASE(reg->options)) { + int c, t; + BitSetRef bs = NCCLASS(node).bs; + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + t = TOLOWER(reg->enc, c); + if (t != c) { + if (BITSET_AT(bs, c)) BITSET_SET_BIT(bs, t); + if (BITSET_AT(bs, t)) BITSET_SET_BIT(bs, c); + } + } + } + break; + + case N_STRING: + if (IS_IGNORECASE(reg->options) && !NSTRING_IS_RAW(node)) { + StrNode* sn = &NSTRING(node); + UChar* p = sn->s; + + while (p < sn->end) { + if (IS_AMBIGUITY_CHAR(reg->enc, *p)) { + NSTRING_SET_CASE_AMBIG(node); + break; + } + p++; + } + } + break; + + case N_CTYPE: + case N_ANYCHAR: + break; + +#ifdef USE_SUBEXP_CALL + case N_CALL: + break; +#endif + + case N_BACKREF: + { + int i; + int* p; + Node** nodes = SCANENV_MEM_NODES(env); + BackrefNode* br = &(NBACKREF(node)); + p = BACKREFS_P(br); + for (i = 0; i < br->back_num; i++) { + if (p[i] > env->num_mem) return REGERR_INVALID_BACKREF; + BIT_STATUS_ON_AT(env->backrefed_mem, p[i]); + BIT_STATUS_ON_AT(env->backtrack_mem, p[i]); + SET_EFFECT_STATUS(nodes[p[i]], NST_MEM_BACKREFED); + } + } + break; + + case N_QUALIFIER: + { + RegDistance d; + QualifierNode* qn = &(NQUALIFIER(node)); + Node* target = qn->target; + + if (IS_REPEAT_INFINITE(qn->upper) || qn->upper >= 1) { + r = get_min_match_length(target, &d, env); + if (r) break; + if (d == 0) { + qn->target_may_empty = 1; +#if 0 + r = get_max_match_length(target, &d, env); + if (r == 0 && d == 0) { + /* ()* ==> ()?, ()+ ==> () */ + qn->upper = 1; + if (qn->lower > 1) qn->lower = 1; + if (NTYPE(target) == N_STRING) { + qn->upper = qn->lower = 0; /* /(?:)+/ ==> // */ + } + } +#endif + } + } + + if (qn->lower != qn->upper) + state |= IN_REPEAT; + r = setup_tree(target, reg, state, env); + if (r) break; + + /* expand string */ +#define EXPAND_STRING_MAX_LENGTH 100 + if (NTYPE(target) == N_STRING) { + if (!IS_REPEAT_INFINITE(qn->lower) && qn->lower == qn->upper && + qn->lower > 1 && qn->lower <= EXPAND_STRING_MAX_LENGTH) { + int len = NSTRING_LEN(target); + StrNode* sn = &(NSTRING(target)); + + if (len * qn->lower <= EXPAND_STRING_MAX_LENGTH) { + int i, n = qn->lower; + regex_node_conv_to_str_node(node, NSTRING(target).flag); + for (i = 0; i < n; i++) { + r = regex_node_str_cat(node, sn->s, sn->end); + if (r) break; + } + regex_node_free(target); + break; /* break case N_QUALIFIER: */ + } + } + } + +#ifdef USE_OP_PUSH_OR_JUMP_EXACT + if (qn->greedy && !qn->target_may_empty) { + if (NTYPE(target) == N_QUALIFIER) { + QualifierNode* tqn = &(NQUALIFIER(target)); + if (IS_NOT_NULL(tqn->head_exact)) { + qn->head_exact = tqn->head_exact; + tqn->head_exact = NULL; + } + } + else { + qn->head_exact = get_head_value_node(qn->target, 1, reg); + } + } +#endif + } + break; + + case N_EFFECT: + { + EffectNode* en = &(NEFFECT(node)); + + switch (en->type) { + case EFFECT_OPTION: + { + RegOptionType options = reg->options; + reg->options = NEFFECT(node).option; + r = setup_tree(NEFFECT(node).target, reg, state, env); + reg->options = options; + } + break; + + case EFFECT_MEMORY: + if ((state & (IN_ALT | IN_NOT | IN_REPEAT)) != 0) { + BIT_STATUS_ON_AT(env->backtrack_mem, en->regnum); + /* SET_EFFECT_STATUS(node, NST_MEM_IN_ALT_NOT); */ + } + /* fall */ + case EFFECT_STOP_BACKTRACK: + { + Node* target = en->target; + r = setup_tree(target, reg, state, env); + if (NTYPE(target) == N_QUALIFIER) { + QualifierNode* tqn = &(NQUALIFIER(target)); + if (IS_REPEAT_INFINITE(tqn->upper) && tqn->lower <= 1 && + tqn->greedy != 0) { /* (?>a*), a*+ etc... */ + int qtype = NTYPE(tqn->target); + if (IS_NODE_TYPE_SIMPLE(qtype)) + SET_EFFECT_STATUS(node, NST_SIMPLE_REPEAT); + } + } + } + break; + } + } + break; + + case N_ANCHOR: + { + AnchorNode* an = &(NANCHOR(node)); + + switch (an->type) { + case ANCHOR_PREC_READ: + r = setup_tree(an->target, reg, state, env); + break; + case ANCHOR_PREC_READ_NOT: + r = setup_tree(an->target, reg, (state | IN_NOT), env); + break; + +/* allowed node types in look-behind */ +#define ALLOWED_TYPE_IN_LB \ + ( N_LIST | N_ALT | N_STRING | N_CCLASS | N_CTYPE | \ + N_ANYCHAR | N_ANCHOR | N_EFFECT | N_QUALIFIER | N_CALL ) + +#define ALLOWED_EFFECT_IN_LB ( EFFECT_MEMORY ) +#define ALLOWED_EFFECT_IN_LB_NOT 0 + +#define ALLOWED_ANCHOR_IN_LB \ +( ANCHOR_LOOK_BEHIND | ANCHOR_BEGIN_LINE | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF ) +#define ALLOWED_ANCHOR_IN_LB_NOT \ +( ANCHOR_LOOK_BEHIND_NOT | ANCHOR_BEGIN_LINE | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF ) + /* can't allow all anchors, because \G in look-behind through Search(). + ex. /(?<=\G)zz/.match("azz") => success. */ + + case ANCHOR_LOOK_BEHIND: + { + r = check_type_tree(an->target, ALLOWED_TYPE_IN_LB, + ALLOWED_EFFECT_IN_LB, ALLOWED_ANCHOR_IN_LB); + if (r < 0) return r; + if (r > 0) return REGERR_INVALID_LOOK_BEHIND_PATTERN; + r = setup_look_behind(node, reg, env); + if (r != 0) return r; + r = setup_tree(an->target, reg, state, env); + } + break; + + case ANCHOR_LOOK_BEHIND_NOT: + { + r = check_type_tree(an->target, ALLOWED_TYPE_IN_LB, + ALLOWED_EFFECT_IN_LB_NOT, ALLOWED_ANCHOR_IN_LB_NOT); + if (r < 0) return r; + if (r > 0) return REGERR_INVALID_LOOK_BEHIND_PATTERN; + r = setup_look_behind(node, reg, env); + if (r != 0) return r; + r = setup_tree(an->target, reg, (state | IN_NOT), env); + } + break; + } + } + break; + + default: + break; + } + + return r; +} + +/* set skip map for Boyer-Moor search */ +static int +set_bm_skip(UChar* s, UChar* end, RegCharEncoding enc, int ignore_case, + UChar skip[], int** int_skip) +{ + int i, len; + + len = end - s; + if (len < REG_CHAR_TABLE_SIZE) { + for (i = 0; i < REG_CHAR_TABLE_SIZE; i++) skip[i] = len; + + if (ignore_case) { + for (i = 0; i < len - 1; i++) + skip[TOLOWER(enc, s[i])] = len - 1 - i; + } + else { + for (i = 0; i < len - 1; i++) + skip[s[i]] = len - 1 - i; + } + } + else { + if (IS_NULL(*int_skip)) { + *int_skip = (int* )xmalloc(sizeof(int) * REG_CHAR_TABLE_SIZE); + if (IS_NULL(*int_skip)) return REGERR_MEMORY; + } + for (i = 0; i < REG_CHAR_TABLE_SIZE; i++) (*int_skip)[i] = len; + + if (ignore_case) { + for (i = 0; i < len - 1; i++) + (*int_skip)[TOLOWER(enc, s[i])] = len - 1 - i; + } + else { + for (i = 0; i < len - 1; i++) + (*int_skip)[s[i]] = len - 1 - i; + } + } + return 0; +} + +#define OPT_EXACT_MAXLEN 24 + +typedef struct { + RegDistance min; /* min byte length */ + RegDistance max; /* max byte length */ +} MinMaxLen; + +typedef struct { + MinMaxLen mmd; + BitStatusType backrefed_status; + RegCharEncoding enc; + RegOptionType options; + RegTransTableType transtable; + ScanEnv* scan_env; +} OptEnv; + +typedef struct { + int left_anchor; + int right_anchor; +} OptAncInfo; + +typedef struct { + MinMaxLen mmd; /* info position */ + OptAncInfo anc; + + int reach_end; + int ignore_case; + int len; + UChar s[OPT_EXACT_MAXLEN]; +} OptExactInfo; + +typedef struct { + MinMaxLen mmd; /* info position */ + OptAncInfo anc; + + int value; /* weighted value */ + UChar map[REG_CHAR_TABLE_SIZE]; +} OptMapInfo; + +typedef struct { + MinMaxLen len; + + OptAncInfo anc; + OptExactInfo exb; /* boundary */ + OptExactInfo exm; /* middle */ + OptExactInfo expr; /* prec read (?=...) */ + + OptMapInfo map; /* boundary */ +} NodeOptInfo; + + +static int +map_position_value(int i) +{ + static int vals[] = { + 10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 1, 10, 10, 1, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 1, 6, 3, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, + 5, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 5, 5, 5, + 5, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 10, + }; + + if (i < sizeof(vals)/sizeof(vals[0])) return vals[i]; + + return 7; /* Take it easy. */ +} + +static int +distance_value(MinMaxLen* mm) +{ + /* 1000 / (min-max-dist + 1) */ + static int dist_vals[] = { + 1000, 500, 333, 250, 200, 167, 143, 125, 111, 100, + 91, 83, 77, 71, 67, 63, 59, 56, 53, 50, + 48, 45, 43, 42, 40, 38, 37, 36, 34, 33, + 32, 31, 30, 29, 29, 28, 27, 26, 26, 25, + 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, + 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, + 16, 16, 16, 16, 15, 15, 15, 15, 14, 14, + 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, + 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 10, 10, 10, 10, 10 + }; + + int d; + + if (mm->max == INFINITE_DISTANCE) return 0; + + d = mm->max - mm->min; + if (d < sizeof(dist_vals)/sizeof(dist_vals[0])) + /* return dist_vals[d] * 16 / (mm->min + 12); */ + return dist_vals[d]; + else + return 1; +} + +static int +comp_distance_value(MinMaxLen* d1, MinMaxLen* d2, int v1, int v2) +{ + if (v2 <= 0) return -1; + if (v1 <= 0) return 1; + + v1 *= distance_value(d1); + v2 *= distance_value(d2); + + if (v2 > v1) return 1; + if (v2 < v1) return -1; + + if (d2->min < d1->min) return 1; + if (d2->min > d1->min) return -1; + return 0; +} + +static int +is_equal_mml(MinMaxLen* a, MinMaxLen* b) +{ + return (a->min == b->min && a->max == b->max) ? 1 : 0; +} + + +static void +set_mml(MinMaxLen* mml, RegDistance min, RegDistance max) +{ + mml->min = min; + mml->max = max; +} + +static void +clear_mml(MinMaxLen* mml) +{ + mml->min = mml->max = 0; +} + +static void +copy_mml(MinMaxLen* to, MinMaxLen* from) +{ + to->min = from->min; + to->max = from->max; +} + +static void +add_mml(MinMaxLen* to, MinMaxLen* from) +{ + to->min = distance_add(to->min, from->min); + to->max = distance_add(to->max, from->max); +} + +static void +add_len_mml(MinMaxLen* to, RegDistance len) +{ + to->min = distance_add(to->min, len); + to->max = distance_add(to->max, len); +} + +static void +alt_merge_mml(MinMaxLen* to, MinMaxLen* from) +{ + if (to->min > from->min) to->min = from->min; + if (to->max < from->max) to->max = from->max; +} + +static void +copy_opt_env(OptEnv* to, OptEnv* from) +{ + *to = *from; +} + +static void +clear_opt_anc_info(OptAncInfo* anc) +{ + anc->left_anchor = 0; + anc->right_anchor = 0; +} + +static void +copy_opt_anc_info(OptAncInfo* to, OptAncInfo* from) +{ + *to = *from; +} + +static void +concat_opt_anc_info(OptAncInfo* to, OptAncInfo* left, OptAncInfo* right, + RegDistance left_len, RegDistance right_len) +{ + clear_opt_anc_info(to); + + to->left_anchor = left->left_anchor; + if (left_len == 0) { + to->left_anchor |= right->left_anchor; + } + + to->right_anchor = right->right_anchor; + if (right_len == 0) { + to->right_anchor |= left->right_anchor; + } +} + +static int +is_left_anchor(int anc) +{ + if (anc == ANCHOR_END_BUF || anc == ANCHOR_SEMI_END_BUF || + anc == ANCHOR_END_LINE || anc == ANCHOR_PREC_READ || + anc == ANCHOR_PREC_READ_NOT) + return 0; + + return 1; +} + +static int +is_set_opt_anc_info(OptAncInfo* to, int anc) +{ + if ((to->left_anchor & anc) != 0) return 1; + + return ((to->right_anchor & anc) != 0 ? 1 : 0); +} + +static void +add_opt_anc_info(OptAncInfo* to, int anc) +{ + if (is_left_anchor(anc)) + to->left_anchor |= anc; + else + to->right_anchor |= anc; +} + +static void +remove_opt_anc_info(OptAncInfo* to, int anc) +{ + if (is_left_anchor(anc)) + to->left_anchor &= ~anc; + else + to->right_anchor &= ~anc; +} + +static void +alt_merge_opt_anc_info(OptAncInfo* to, OptAncInfo* add) +{ + to->left_anchor &= add->left_anchor; + to->right_anchor &= add->right_anchor; +} + +static int +is_full_opt_exact_info(OptExactInfo* ex) +{ + return (ex->len >= OPT_EXACT_MAXLEN ? 1 : 0); +} + +static void +clear_opt_exact_info(OptExactInfo* ex) +{ + clear_mml(&ex->mmd); + clear_opt_anc_info(&ex->anc); + ex->reach_end = 0; + ex->ignore_case = 0; + ex->len = 0; + ex->s[0] = '\0'; +} + +static void +copy_opt_exact_info(OptExactInfo* to, OptExactInfo* from) +{ + *to = *from; +} + +static void +concat_opt_exact_info(OptExactInfo* to, OptExactInfo* add) +{ + int i, n; + OptAncInfo tanc; + + if (! to->ignore_case && add->ignore_case) { + if (to->len >= add->len) return ; /* avoid */ + + to->ignore_case = 1; + } + + for (i = to->len, n = 0; n < add->len && i < OPT_EXACT_MAXLEN; i++, n++) + to->s[i] = add->s[n]; + + to->len = i; + to->reach_end = (n == add->len ? add->reach_end : 0); + + concat_opt_anc_info(&tanc, &to->anc, &add->anc, 1, 1); + if (! to->reach_end) tanc.right_anchor = 0; + copy_opt_anc_info(&to->anc, &tanc); +} + +static void +concat_opt_exact_info_str(OptExactInfo* to, + UChar* s, UChar* end, int raw, RegCharEncoding code) +{ + int i, j, len; + UChar *p; + + for (i = to->len, p = s; p < end && i < OPT_EXACT_MAXLEN; ) { + if (raw) { + to->s[i++] = *p++; + } + else { + len = mblen(code, *p); + for (j = 0; j < len; j++) + to->s[i++] = *p++; + } + } + + to->len = i; +} + +static void +alt_merge_opt_exact_info(OptExactInfo* to, OptExactInfo* add, OptEnv* env) +{ + int i, j, len; + + if (add->len == 0 || to->len == 0) { + clear_opt_exact_info(to); + return ; + } + + if (! is_equal_mml(&to->mmd, &add->mmd)) { + clear_opt_exact_info(to); + return ; + } + + for (i = 0; i < to->len && i < add->len; ) { + if (to->s[i] != add->s[i]) break; + len = mblen(env->enc, to->s[i]); + + for (j = 1; j < len; j++) { + if (to->s[i+j] != add->s[i+j]) break; + } + if (j < len) break; + i += len; + } + + if (! add->reach_end || i < add->len || i < to->len) { + to->reach_end = 0; + } + to->len = i; + to->ignore_case |= add->ignore_case; + + alt_merge_opt_anc_info(&to->anc, &add->anc); + if (! to->reach_end) to->anc.right_anchor = 0; +} + +static void +select_opt_exact_info(OptExactInfo* now, OptExactInfo* alt) +{ + int vlen1, vlen2; + + vlen1 = now->len * (now->ignore_case ? 1 : 2); + vlen2 = alt->len * (alt->ignore_case ? 1 : 2); + + if (comp_distance_value(&now->mmd, &alt->mmd, vlen1, vlen2) > 0) + copy_opt_exact_info(now, alt); +} + +static void +clear_opt_map_info(OptMapInfo* map) +{ + int i; + + clear_mml(&map->mmd); + clear_opt_anc_info(&map->anc); + map->value = 0; + for (i = 0; i < REG_CHAR_TABLE_SIZE; i++) + map->map[i] = 0; +} + +static void +copy_opt_map_info(OptMapInfo* to, OptMapInfo* from) +{ + *to = *from; +} + +static void +add_char_opt_map_info(OptMapInfo* map, int c) +{ + if (map->map[c] == 0) { + map->map[c] = 1; + map->value += map_position_value(c); + } +} + +static void +add_char_amb_opt_map_info(OptMapInfo* map, int c, RegCharEncoding enc) +{ + int i, t; + + add_char_opt_map_info(map, c); + t = TOLOWER(enc, c); + if (t != c) { + add_char_opt_map_info(map, t); + } + else { + for (i = 0; i < REG_CHAR_TABLE_SIZE; i++) { + t = TOLOWER(enc, i); + if (t == c) add_char_opt_map_info(map, i); + } + } +} + +static void +select_opt_map_info(OptMapInfo* now, OptMapInfo* alt) +{ + static int z = 1<<15; /* 32768: something big value */ + + int v1, v2; + + if (alt->value == 0) return ; + if (now->value == 0) { + copy_opt_map_info(now, alt); + return ; + } + + v1 = z / now->value; + v2 = z / alt->value; + if (comp_distance_value(&now->mmd, &alt->mmd, v1, v2) > 0) + copy_opt_map_info(now, alt); +} + +static int +comp_opt_exact_or_map_info(OptExactInfo* e, OptMapInfo* m) +{ +#define COMP_EM_BASE 20 + int ve, vm; + + if (m->value <= 0) return -1; + + ve = COMP_EM_BASE * e->len * (e->ignore_case ? 1 : 2); + vm = COMP_EM_BASE * 5 * 2 / m->value; + return comp_distance_value(&e->mmd, &m->mmd, ve, vm); +} + +static void +alt_merge_opt_map_info(OptMapInfo* to, OptMapInfo* add) +{ + int i, val; + + /* if (! is_equal_mml(&to->mmd, &add->mmd)) return ; */ + if (to->value == 0) return ; + if (add->value == 0 || to->mmd.max < add->mmd.min) { + clear_opt_map_info(to); + return ; + } + + alt_merge_mml(&to->mmd, &add->mmd); + + val = 0; + for (i = 0; i < REG_CHAR_TABLE_SIZE; i++) { + if (add->map[i]) + to->map[i] = 1; + + if (to->map[i]) + val += map_position_value(i); + } + to->value = val; + + alt_merge_opt_anc_info(&to->anc, &add->anc); +} + +static void +set_bound_node_opt_info(NodeOptInfo* opt, MinMaxLen* mmd) +{ + copy_mml(&(opt->exb.mmd), mmd); + copy_mml(&(opt->expr.mmd), mmd); + copy_mml(&(opt->map.mmd), mmd); +} + +static void +clear_node_opt_info(NodeOptInfo* opt) +{ + clear_mml(&opt->len); + clear_opt_anc_info(&opt->anc); + clear_opt_exact_info(&opt->exb); + clear_opt_exact_info(&opt->exm); + clear_opt_exact_info(&opt->expr); + clear_opt_map_info(&opt->map); +} + +static void +copy_node_opt_info(NodeOptInfo* to, NodeOptInfo* from) +{ + *to = *from; +} + +static void +concat_left_node_opt_info(NodeOptInfo* to, NodeOptInfo* add) +{ + int exb_reach, exm_reach; + OptAncInfo tanc; + + concat_opt_anc_info(&tanc, &to->anc, &add->anc, to->len.max, add->len.max); + copy_opt_anc_info(&to->anc, &tanc); + + if (add->exb.len > 0 && to->len.max == 0) { + concat_opt_anc_info(&tanc, &to->anc, &add->exb.anc, + to->len.max, add->len.max); + copy_opt_anc_info(&add->exb.anc, &tanc); + } + + if (add->map.value > 0 && to->len.max == 0) { + concat_opt_anc_info(&tanc, &to->anc, &add->map.anc, + to->len.max, add->len.max); + copy_opt_anc_info(&add->map.anc, &tanc); + } + + exb_reach = to->exb.reach_end; + exm_reach = to->exm.reach_end; + + if (add->len.max != 0) + to->exb.reach_end = to->exm.reach_end = 0; + + if (add->exb.len > 0) { + if (exb_reach) { + concat_opt_exact_info(&to->exb, &add->exb); + clear_opt_exact_info(&add->exb); + } + else if (exm_reach) { + concat_opt_exact_info(&to->exm, &add->exb); + clear_opt_exact_info(&add->exb); + } + } + select_opt_exact_info(&to->exm, &add->exb); + select_opt_exact_info(&to->exm, &add->exm); + + if (to->expr.len > 0) { + if (add->len.max > 0) { + if (to->expr.len > add->len.max) + to->expr.len = add->len.max; + + if (to->expr.mmd.max == 0) + select_opt_exact_info(&to->exb, &to->expr); + else + select_opt_exact_info(&to->exm, &to->expr); + } + } + else if (add->expr.len > 0) { + copy_opt_exact_info(&to->expr, &add->expr); + } + + select_opt_map_info(&to->map, &add->map); + + add_mml(&to->len, &add->len); +} + +static void +alt_merge_node_opt_info(NodeOptInfo* to, NodeOptInfo* add, OptEnv* env) +{ + alt_merge_opt_anc_info (&to->anc, &add->anc); + alt_merge_opt_exact_info(&to->exb, &add->exb, env); + alt_merge_opt_exact_info(&to->exm, &add->exm, env); + alt_merge_opt_exact_info(&to->expr, &add->expr, env); + alt_merge_opt_map_info (&to->map, &add->map); + + alt_merge_mml(&to->len, &add->len); +} + + +#define MAX_NODE_OPT_INFO_REF_COUNT 5 + +static int +optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env) +{ + int type; + int r = 0; + + clear_node_opt_info(opt); + set_bound_node_opt_info(opt, &env->mmd); + + type = NTYPE(node); + switch (type) { + case N_LIST: + { + OptEnv nenv; + NodeOptInfo nopt; + Node* nd = node; + + copy_opt_env(&nenv, env); + do { + r = optimize_node_left(NCONS(nd).left, &nopt, &nenv); + if (r == 0) { + add_mml(&nenv.mmd, &nopt.len); + concat_left_node_opt_info(opt, &nopt); + } + } while (r == 0 && IS_NOT_NULL(nd = NCONS(nd).right)); + } + break; + + case N_ALT: + { + NodeOptInfo nopt; + Node* nd = node; + + do { + r = optimize_node_left(NCONS(nd).left, &nopt, env); + if (r == 0) { + if (nd == node) copy_node_opt_info(opt, &nopt); + else alt_merge_node_opt_info(opt, &nopt, env); + } + } while ((r == 0) && IS_NOT_NULL(nd = NCONS(nd).right)); + } + break; + + case N_STRING: + { + UChar *p; + int len, plen; + StrNode* sn = &(NSTRING(node)); + int slen = sn->end - sn->s; + int is_raw = NSTRING_IS_RAW(node); + + if ((! IS_IGNORECASE(env->options)) || is_raw) { + concat_opt_exact_info_str(&opt->exb, sn->s, sn->end, + NSTRING_IS_RAW(node), env->enc); + if (slen > 0) { + add_char_opt_map_info(&opt->map, *(sn->s)); + } + } + else { + for (p = sn->s; p < sn->end; ) { + len = mblen(env->enc, *p); + if (len == 1 && IS_AMBIGUITY_CHAR(env->enc, *p)) { + break; + } + p += len; + } + + plen = p - sn->s; + if (plen > slen / 5) { + concat_opt_exact_info_str(&opt->exb, sn->s, p, is_raw, env->enc); + concat_opt_exact_info_str(&opt->exm, p, sn->end, is_raw, env->enc); + opt->exm.ignore_case = 1; + if (opt->exm.len == sn->end - p) + opt->exm.reach_end = 1; + + copy_mml(&(opt->exm.mmd), &(opt->exb.mmd)); + add_len_mml(&(opt->exm.mmd), plen); + } + else { + concat_opt_exact_info_str(&opt->exb, sn->s, sn->end, + is_raw, env->enc); + opt->exb.ignore_case = 1; + } + + if (slen > 0) { + if (p == sn->s) + add_char_amb_opt_map_info(&opt->map, *(sn->s), env->transtable); + else + add_char_opt_map_info(&opt->map, *(sn->s)); + } + } + + if (opt->exb.len == slen) + opt->exb.reach_end = 1; + + set_mml(&opt->len, slen, slen); + } + break; + + case N_CCLASS: + { + int i, z, len, found; + CClassNode* cc = &(NCCLASS(node)); + + /* no need to check ignore case. (setted in setup_tree()) */ + found = 0; + for (i = 0; i < SINGLE_BYTE_SIZE; i++) { + z = BITSET_AT(cc->bs, i); + if ((z && !cc->not) || (!z && cc->not)) { + found = 1; + add_char_opt_map_info(&opt->map, i); + } + } + + if (IS_NOT_NULL(cc->mbuf)) { + for (i = 0; i < SINGLE_BYTE_SIZE; i++) { + if (BITSET_AT((BitSetRef )(cc->mbuf->p), i)) { + found = 1; + add_char_opt_map_info(&opt->map, i); + } + } + } + + if (found) { + if (IS_NULL(cc->mbuf)) + len = bitset_mbmaxlen(cc->bs, cc->not, env->enc); + else + len = mbmaxlen_dist(env->enc); + + set_mml(&opt->len, 1, len); + } + } + break; + + case N_CTYPE: + { + int c; + int len, min, max; + + min = mbmaxlen_dist(env->enc); + max = 0; + + switch (NCTYPE(node).type) { + case CTYPE_WORD: + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (IS_WORD_HEAD(env->enc, c)) { + add_char_opt_map_info(&opt->map, c); + len = mblen(env->enc, c); + if (len < min) min = len; + if (len > max) max = len; + } + } + break; + + case CTYPE_NOT_WORD: + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (! IS_WORD_HEAD(env->enc, c)) { + add_char_opt_map_info(&opt->map, c); + len = mblen(env->enc, c); + if (len < min) min = len; + if (len > max) max = len; + } + } + break; + +#ifdef USE_SBMB_CLASS + case CTYPE_WORD_SB: + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (IS_SB_WORD(env->enc, c)) { + add_char_opt_map_info(&opt->map, c); + } + } + min = max = 1; + break; + + case CTYPE_WORD_MB: + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (IS_MB_WORD(env->enc, c)) { + add_char_opt_map_info(&opt->map, c); + len = mblen(env->enc, c); + if (len < min) min = len; + if (len > max) max = len; + } + } + break; +#endif + } + + set_mml(&opt->len, min, max); + } + break; + + case N_ANYCHAR: + { + RegDistance len = mbmaxlen_dist(env->enc); + set_mml(&opt->len, 1, len); + } + break; + + case N_ANCHOR: + switch (NANCHOR(node).type) { + case ANCHOR_BEGIN_BUF: + case ANCHOR_BEGIN_POSITION: + case ANCHOR_BEGIN_LINE: + case ANCHOR_END_BUF: + case ANCHOR_SEMI_END_BUF: + case ANCHOR_END_LINE: + add_opt_anc_info(&opt->anc, NANCHOR(node).type); + break; + + case ANCHOR_PREC_READ: + { + NodeOptInfo nopt; + + r = optimize_node_left(NANCHOR(node).target, &nopt, env); + if (r == 0) { + if (nopt.exb.len > 0) + copy_opt_exact_info(&opt->expr, &nopt.exb); + else if (nopt.exm.len > 0) + copy_opt_exact_info(&opt->expr, &nopt.exm); + + opt->expr.reach_end = 0; + + if (nopt.map.value > 0) + copy_opt_map_info(&opt->map, &nopt.map); + } + } + break; + + case ANCHOR_PREC_READ_NOT: + case ANCHOR_LOOK_BEHIND: /* Sorry, I can't make use of it. */ + case ANCHOR_LOOK_BEHIND_NOT: + break; + } + break; + + case N_BACKREF: + { + int i; + int* backs; + RegDistance min, max, tmin, tmax; + Node** nodes = SCANENV_MEM_NODES(env->scan_env); + BackrefNode* br = &(NBACKREF(node)); + + if (br->state & NST_RECURSION) { + set_mml(&opt->len, 0, INFINITE_DISTANCE); + break; + } + backs = BACKREFS_P(br); + r = get_min_match_length(nodes[backs[0]], &min, env->scan_env); + if (r != 0) break; + r = get_max_match_length(nodes[backs[0]], &max, env->scan_env); + if (r != 0) break; + for (i = 1; i < br->back_num; i++) { + r = get_min_match_length(nodes[backs[i]], &tmin, env->scan_env); + if (r != 0) break; + r = get_max_match_length(nodes[backs[i]], &tmax, env->scan_env); + if (r != 0) break; + if (min > tmin) min = tmin; + if (max < tmax) max = tmax; + } + if (r == 0) set_mml(&opt->len, min, max); + } + break; + +#ifdef USE_SUBEXP_CALL + case N_CALL: + if (IS_CALL_RECURSION(&(NCALL(node)))) + set_mml(&opt->len, 0, INFINITE_DISTANCE); + else { + r = optimize_node_left(NCALL(node).target, opt, env); + } + break; +#endif + + case N_QUALIFIER: + { + int i; + RegDistance min, max; + NodeOptInfo nopt; + QualifierNode* qn = &(NQUALIFIER(node)); + + r = optimize_node_left(qn->target, &nopt, env); + if (r) break; + + if (qn->lower == 0 && IS_REPEAT_INFINITE(qn->upper)) { + if (env->mmd.max == 0 && + NTYPE(qn->target) == N_ANYCHAR && qn->greedy) { + if (IS_POSIXLINE(env->options)) + add_opt_anc_info(&opt->anc, ANCHOR_ANYCHAR_STAR_PL); + else + add_opt_anc_info(&opt->anc, ANCHOR_ANYCHAR_STAR); + } + } + else { + if (qn->lower > 0) { + copy_node_opt_info(opt, &nopt); + if (nopt.exb.len > 0) { + if (nopt.exb.reach_end) { + for (i = 2; i < qn->lower && + ! is_full_opt_exact_info(&opt->exb); i++) { + concat_opt_exact_info(&opt->exb, &nopt.exb); + } + if (i < qn->lower) { + opt->exb.reach_end = 0; + } + } + } + + if (qn->lower != qn->upper) { + opt->exb.reach_end = 0; + opt->exm.reach_end = 0; + } + if (qn->lower > 1) + opt->exm.reach_end = 0; + } + } + + min = distance_multiply(nopt.len.min, qn->lower); + if (IS_REPEAT_INFINITE(qn->upper)) + max = (nopt.len.max > 0 ? INFINITE_DISTANCE : 0); + else + max = distance_multiply(nopt.len.max, qn->upper); + + set_mml(&opt->len, min, max); + } + break; + + case N_EFFECT: + { + EffectNode* en = &(NEFFECT(node)); + + switch (en->type) { + case EFFECT_OPTION: + { + RegOptionType save = env->options; + + env->options = en->option; + r = optimize_node_left(en->target, opt, env); + env->options = save; + } + break; + + case EFFECT_MEMORY: +#ifdef USE_SUBEXP_CALL + en->opt_count++; + if (en->opt_count > MAX_NODE_OPT_INFO_REF_COUNT) { + RegDistance min, max; + + min = 0; + max = INFINITE_DISTANCE; + if (IS_EFFECT_MIN_FIXED(en)) min = en->min_len; + if (IS_EFFECT_MAX_FIXED(en)) max = en->max_len; + set_mml(&opt->len, min, max); + } + else +#endif + { + r = optimize_node_left(en->target, opt, env); + + if (is_set_opt_anc_info(&opt->anc, ANCHOR_ANYCHAR_STAR_MASK)) { + if (BIT_STATUS_AT(env->backrefed_status, en->regnum)) + remove_opt_anc_info(&opt->anc, ANCHOR_ANYCHAR_STAR_MASK); + } + } + break; + + case EFFECT_STOP_BACKTRACK: + r = optimize_node_left(en->target, opt, env); + break; + } + } + break; + + default: +#ifdef REG_DEBUG + fprintf(stderr, "optimize_node_left: undefined node type %d\n", + NTYPE(node)); +#endif + r = REGERR_TYPE_BUG; + break; + } + + return r; +} + +static int +set_optimize_exact_info(regex_t* reg, OptExactInfo* e) +{ + int r; + + if (e->len == 0) return 0; + + reg->exact = regex_strdup(e->s, e->s + e->len); + if (IS_NULL(reg->exact)) return REGERR_MEMORY; + + reg->exact_end = reg->exact + e->len; + + if (e->ignore_case) { + UChar *p; + int len; + for (p = reg->exact; p < reg->exact_end; ) { + len = mblen(reg->enc, *p); + if (len == 1) { + *p = TOLOWER(reg->enc, *p); + } + p += len; + } + reg->optimize = REG_OPTIMIZE_EXACT_IC; + } + else { + int allow_reverse; + + if (e->anc.left_anchor & ANCHOR_BEGIN_LINE) + allow_reverse = 1; + else + allow_reverse = + regex_is_allow_reverse_match(reg->enc, reg->exact, reg->exact_end); + + if (e->len >= 3 || (e->len >= 2 && allow_reverse)) { + r = set_bm_skip(reg->exact, reg->exact_end, reg->enc, 0, + reg->map, &(reg->int_map)); + if (r) return r; + + reg->optimize = (allow_reverse != 0 + ? REG_OPTIMIZE_EXACT_BM : REG_OPTIMIZE_EXACT_BM_NOT_REV); + } + else { + reg->optimize = REG_OPTIMIZE_EXACT; + } + } + + reg->dmin = e->mmd.min; + reg->dmax = e->mmd.max; + + if (reg->dmin != INFINITE_DISTANCE) { + reg->threshold_len = reg->dmin + (reg->exact_end - reg->exact); + } + + return 0; +} + +static void +set_optimize_map_info(regex_t* reg, OptMapInfo* m) +{ + int i; + + for (i = 0; i < REG_CHAR_TABLE_SIZE; i++) + reg->map[i] = m->map[i]; + + reg->optimize = REG_OPTIMIZE_MAP; + reg->dmin = m->mmd.min; + reg->dmax = m->mmd.max; + + if (reg->dmin != INFINITE_DISTANCE) { + reg->threshold_len = reg->dmin + 1; + } +} + +static void +set_sub_anchor(regex_t* reg, OptAncInfo* anc) +{ + reg->sub_anchor |= anc->left_anchor & ANCHOR_BEGIN_LINE; + reg->sub_anchor |= anc->right_anchor & ANCHOR_END_LINE; +} + +#ifdef REG_DEBUG +static void print_optimize_info(FILE* f, regex_t* reg); +#endif + +static int +set_optimize_info_from_tree(Node* node, regex_t* reg, ScanEnv* scan_env) +{ + + int r; + NodeOptInfo opt; + OptEnv env; + + env.enc = reg->enc; + env.options = reg->options; + env.scan_env = scan_env; + clear_mml(&env.mmd); + + r = optimize_node_left(node, &opt, &env); + if (r) return r; + + reg->anchor = opt.anc.left_anchor & (ANCHOR_BEGIN_BUF | + ANCHOR_BEGIN_POSITION | ANCHOR_ANYCHAR_STAR | ANCHOR_ANYCHAR_STAR_PL); + + reg->anchor |= opt.anc.right_anchor & (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF); + + if (reg->anchor & (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF)) { + reg->anchor_dmin = opt.len.min; + reg->anchor_dmax = opt.len.max; + } + + if (opt.exb.len > 0 || opt.exm.len > 0) { + select_opt_exact_info(&opt.exb, &opt.exm); + if (opt.map.value > 0 && + comp_opt_exact_or_map_info(&opt.exb, &opt.map) > 0) { + goto set_map; + } + else { + r = set_optimize_exact_info(reg, &opt.exb); + set_sub_anchor(reg, &opt.exb.anc); + } + } + else if (opt.map.value > 0) { + set_map: + set_optimize_map_info(reg, &opt.map); + set_sub_anchor(reg, &opt.map.anc); + } + else { + reg->sub_anchor |= opt.anc.left_anchor & ANCHOR_BEGIN_LINE; + if (opt.len.max == 0) + reg->sub_anchor |= opt.anc.right_anchor & ANCHOR_END_LINE; + } + +#if defined(REG_DEBUG_COMPILE) || defined(REG_DEBUG_MATCH) + print_optimize_info(stderr, reg); +#endif + return r; +} + +static void +clear_optimize_info(regex_t* reg) +{ + reg->optimize = REG_OPTIMIZE_NONE; + reg->anchor = 0; + reg->anchor_dmin = 0; + reg->anchor_dmax = 0; + reg->sub_anchor = 0; + reg->exact_end = (UChar* )NULL; + reg->threshold_len = 0; + if (IS_NOT_NULL(reg->exact)) { + xfree(reg->exact); + reg->exact = (UChar* )NULL; + } +} + +#ifdef REG_DEBUG + +static void +print_distance_range(FILE* f, RegDistance a, RegDistance b) +{ + if (a == INFINITE_DISTANCE) + fputs("inf", f); + else + fprintf(f, "(%u)", a); + + fputs("-", f); + + if (b == INFINITE_DISTANCE) + fputs("inf", f); + else + fprintf(f, "(%u)", b); +} + +static void +print_anchor(FILE* f, int anchor) +{ + int q = 0; + + fprintf(f, "["); + + if (anchor & ANCHOR_BEGIN_BUF) { + fprintf(f, "begin-buf"); + q = 1; + } + if (anchor & ANCHOR_BEGIN_LINE) { + if (q) fprintf(f, ", "); + q = 1; + fprintf(f, "begin-line"); + } + if (anchor & ANCHOR_BEGIN_POSITION) { + if (q) fprintf(f, ", "); + q = 1; + fprintf(f, "begin-pos"); + } + if (anchor & ANCHOR_END_BUF) { + if (q) fprintf(f, ", "); + q = 1; + fprintf(f, "end-buf"); + } + if (anchor & ANCHOR_SEMI_END_BUF) { + if (q) fprintf(f, ", "); + q = 1; + fprintf(f, "semi-end-buf"); + } + if (anchor & ANCHOR_END_LINE) { + if (q) fprintf(f, ", "); + q = 1; + fprintf(f, "end-line"); + } + if (anchor & ANCHOR_ANYCHAR_STAR) { + if (q) fprintf(f, ", "); + q = 1; + fprintf(f, "anychar-star"); + } + if (anchor & ANCHOR_ANYCHAR_STAR_PL) { + if (q) fprintf(f, ", "); + fprintf(f, "anychar-star-pl"); + } + + fprintf(f, "]"); +} + +static void +print_optimize_info(FILE* f, regex_t* reg) +{ + static char* on[] = { "NONE", "EXACT", "EXACT_BM", "EXACT_BM_NOT_REV", + "EXACT_IC", "MAP" }; + + fprintf(f, "optimize: %s\n", on[reg->optimize]); + fprintf(f, " anchor: "); print_anchor(f, reg->anchor); + if ((reg->anchor & ANCHOR_END_BUF_MASK) != 0) + print_distance_range(f, reg->anchor_dmin, reg->anchor_dmax); + fprintf(f, "\n"); + + if (reg->optimize) { + fprintf(f, " sub anchor: "); print_anchor(f, reg->sub_anchor); + fprintf(f, "\n"); + } + fprintf(f, "\n"); + + if (reg->exact) { + UChar *p; + fprintf(f, "exact: ["); + for (p = reg->exact; p < reg->exact_end; p++) { + fputc(*p, f); + } + fprintf(f, "]: length: %d\n", (reg->exact_end - reg->exact)); + } + else if (reg->optimize & REG_OPTIMIZE_MAP) { + int i, n = 0; + for (i = 0; i < REG_CHAR_TABLE_SIZE; i++) + if (reg->map[i]) n++; + + fprintf(f, "map: n=%d\n", n); + if (n > 0) { + fputc('[', f); + for (i = 0; i < REG_CHAR_TABLE_SIZE; i++) + if (reg->map[i] && mblen(reg->enc, i) == 1 && + IS_CODE_PRINT(reg->enc, i)) + fputc(i, f); + fprintf(f, "]\n"); + } + } +} +#endif /* REG_DEBUG */ + + +static void +regex_free_body(regex_t* reg) +{ + if (IS_NOT_NULL(reg->p)) xfree(reg->p); + if (IS_NOT_NULL(reg->exact)) xfree(reg->exact); + if (IS_NOT_NULL(reg->int_map)) xfree(reg->int_map); + if (IS_NOT_NULL(reg->int_map_backward)) xfree(reg->int_map_backward); + if (IS_NOT_NULL(reg->repeat_range)) xfree(reg->repeat_range); + if (IS_NOT_NULL(reg->chain)) regex_free(reg->chain); + +#ifdef USE_NAMED_SUBEXP + regex_names_free(reg); +#endif +} + +extern void +regex_free(regex_t* reg) +{ + if (IS_NOT_NULL(reg)) { + regex_free_body(reg); + xfree(reg); + } +} + +#define REGEX_TRANSFER(to,from) do {\ + (to)->state = REG_STATE_MODIFY;\ + regex_free_body(to);\ + xmemcpy(to, from, sizeof(regex_t));\ + xfree(from);\ +} while (0) + +static void +regex_transfer(regex_t* to, regex_t* from) +{ + THREAD_ATOMIC_START; + REGEX_TRANSFER(to, from); + THREAD_ATOMIC_END; +} + +#define REGEX_CHAIN_HEAD(reg) do {\ + while (IS_NOT_NULL((reg)->chain)) {\ + (reg) = (reg)->chain;\ + }\ +} while (0) + +static void +regex_chain_link_add(regex_t* to, regex_t* add) +{ + THREAD_ATOMIC_START; + REGEX_CHAIN_HEAD(to); + to->chain = add; + THREAD_ATOMIC_END; +} + +extern void +regex_chain_reduce(regex_t* reg) +{ + regex_t *head, *prev; + + THREAD_ATOMIC_START; + prev = reg; + head = prev->chain; + if (IS_NOT_NULL(head)) { + reg->state = REG_STATE_MODIFY; + while (IS_NOT_NULL(head->chain)) { + prev = head; + head = head->chain; + } + prev->chain = (regex_t* )NULL; + REGEX_TRANSFER(reg, head); + } + THREAD_ATOMIC_END; +} + +#if 0 +extern int +regex_clone(regex_t** to, regex_t* from) +{ + int r, size; + regex_t* reg; + + if (REG_STATE(from) == REG_STATE_NORMAL) { + from->state++; /* increment as search counter */ + if (IS_NOT_NULL(from->chain)) { + regex_chain_reduce(from); + from->state++; + } + } + else { + int n = 0; + while (REG_STATE(from) < REG_STATE_NORMAL) { + if (++n > THREAD_PASS_LIMIT_COUNT) + return REGERR_OVER_THREAD_PASS_LIMIT_COUNT; + THREAD_PASS; + } + from->state++; /* increment as search counter */ + } + + r = regex_alloc_init(®, REG_OPTION_NONE, RegDefaultCharEncoding, + REG_TRANSTABLE_USE_DEFAULT); + if (r != 0) { + from->state--; + return r; + } + + xmemcpy(reg, from, sizeof(regex_t)); + reg->state = REG_STATE_NORMAL; + reg->chain = (regex_t* )NULL; + + if (from->p) { + reg->p = (UChar* )xmalloc(reg->alloc); + if (IS_NULL(reg->p)) goto mem_error; + xmemcpy(reg->p, from->p, reg->alloc); + } + + if (from->exact) { + reg->exact = (UChar* )xmalloc(from->exact_end - from->exact); + if (IS_NULL(reg->exact)) goto mem_error; + reg->exact_end = reg->exact + (from->exact_end - from->exact); + xmemcpy(reg->exact, from->exact, reg->exact_end - reg->exact); + } + + if (from->int_map) { + size = sizeof(int) * REG_CHAR_TABLE_SIZE; + reg->int_map = (int* )xmalloc(size); + if (IS_NULL(reg->int_map)) goto mem_error; + xmemcpy(reg->int_map, from->int_map, size); + } + + if (from->int_map_backward) { + size = sizeof(int) * REG_CHAR_TABLE_SIZE; + reg->int_map_backward = (int* )xmalloc(size); + if (IS_NULL(reg->int_map_backward)) goto mem_error; + xmemcpy(reg->int_map_backward, from->int_map_backward, size); + } + +#ifdef USE_NAMED_SUBEXP + reg->name_table = names_clone(from); /* names_clone is not implemented */ +#endif + + from->state--; + *to = reg; + return 0; + + mem_error: + from->state--; + return REGERR_MEMORY; +} +#endif + +#ifdef REG_DEBUG +static void print_tree P_((FILE* f, Node* node)); +static void print_compiled_byte_code_list P_((FILE* f, regex_t* reg)); +#endif + +extern int +regex_compile(regex_t* reg, UChar* pattern, UChar* pattern_end, + RegErrorInfo* einfo) +{ +#define COMPILE_INIT_SIZE 20 + + int r, init_size; + Node* root; + ScanEnv scan_env; +#ifdef USE_SUBEXP_CALL + UnsetAddrList uslist; +#endif + + reg->state = REG_STATE_COMPILING; + + if (reg->alloc == 0) { + init_size = (pattern_end - pattern) * 2; + if (init_size <= 0) init_size = COMPILE_INIT_SIZE; + r = BBUF_INIT(reg, init_size); + if (r) goto end; + } + else + reg->used = 0; + + reg->num_mem = 0; + reg->num_repeat = 0; + reg->num_null_check = 0; + reg->repeat_range_alloc = 0; + reg->repeat_range = (RegRepeatRange* )NULL; + + r = regex_parse_make_tree(&root, pattern, pattern_end, reg, &scan_env); + if (r) goto err; + +#ifdef REG_DEBUG_PARSE_TREE + print_tree(stderr, root); +#endif + +#ifdef USE_SUBEXP_CALL + if (scan_env.num_call > 0) { + r = unset_addr_list_init(&uslist, scan_env.num_call); + if (r) goto err; + scan_env.unset_addr_list = &uslist; + r = setup_subexp_call(root, &scan_env); + if (r) goto err_unset; + r = subexp_recursive_check_trav(root, &scan_env); + if (r < 0) goto err_unset; + r = subexp_inf_recursive_check_trav(root, &scan_env); + if (r) goto err_unset; + + reg->num_call = scan_env.num_call; + } + else + reg->num_call = 0; +#endif + + r = setup_tree(root, reg, 0, &scan_env); + if (r) goto err_unset; + + reg->backtrack_mem = scan_env.backtrack_mem; + + clear_optimize_info(reg); +#ifndef REG_DONT_OPTIMIZE + r = set_optimize_info_from_tree(root, reg, &scan_env); + if (r) goto err_unset; +#endif + + if (IS_NOT_NULL(scan_env.mem_nodes_dynamic)) { + xfree(scan_env.mem_nodes_dynamic); + scan_env.mem_nodes_dynamic = (Node** )NULL; + } + + r = compile_tree(root, reg); + if (r == 0) { + r = add_opcode(reg, OP_END); +#ifdef USE_SUBEXP_CALL + if (scan_env.num_call > 0) { + r = unset_addr_list_fix(&uslist, reg); + unset_addr_list_end(&uslist); + if (r) goto err; + } +#endif + + if ((reg->num_repeat != 0) || IS_FIND_CONDITION(reg->options)) + reg->stack_pop_level = STACK_POP_LEVEL_ALL; + else { + if (reg->backtrack_mem != 0) + reg->stack_pop_level = STACK_POP_LEVEL_MEM_START; + else + reg->stack_pop_level = STACK_POP_LEVEL_FREE; + } + } +#ifdef USE_SUBEXP_CALL + else if (scan_env.num_call > 0) { + unset_addr_list_end(&uslist); + } +#endif + regex_node_free(root); + +#ifdef REG_DEBUG_COMPILE +#ifdef USE_NAMED_SUBEXP + regex_print_names(stderr, reg); +#endif + print_compiled_byte_code_list(stderr, reg); +#endif + + end: + reg->state = REG_STATE_NORMAL; + return r; + + err_unset: +#ifdef USE_SUBEXP_CALL + if (scan_env.num_call > 0) { + unset_addr_list_end(&uslist); + } +#endif + err: + if (IS_NOT_NULL(scan_env.error)) { + if (IS_NOT_NULL(einfo)) { + einfo->par = scan_env.error; + einfo->par_end = scan_env.error_end; + } + } + + if (IS_NOT_NULL(root)) regex_node_free(root); + if (IS_NOT_NULL(scan_env.mem_nodes_dynamic)) + xfree(scan_env.mem_nodes_dynamic); + return r; +} + +extern int +regex_recompile(regex_t* reg, UChar* pattern, UChar* pattern_end, + RegOptionType option, RegCharEncoding code, RegSyntaxType* syntax, + RegErrorInfo* einfo) +{ + int r; + regex_t *new_reg; + + r = regex_new(&new_reg, pattern, pattern_end, option, code, syntax, einfo); + if (r) return r; + if (REG_STATE(reg) == REG_STATE_NORMAL) { + regex_transfer(reg, new_reg); + } + else { + regex_chain_link_add(reg, new_reg); + } + return 0; +} + +static int regex_inited = 0; + +extern int +regex_alloc_init(regex_t** reg, RegOptionType option, RegCharEncoding enc, + RegSyntaxType* syntax) +{ + if (! regex_inited) + regex_init(); + + *reg = (regex_t* )xmalloc(sizeof(regex_t)); + if (IS_NULL(*reg)) return REGERR_MEMORY; + + if ((option & REG_OPTION_NEGATE_SINGLELINE) != 0) { + option |= syntax->options; + option &= ~REG_OPTION_SINGLELINE; + } + else + option |= syntax->options; + + (*reg)->state = REG_STATE_NORMAL; + (*reg)->enc = enc; + (*reg)->options = option; + (*reg)->syntax = syntax; + (*reg)->optimize = 0; + (*reg)->exact = (UChar* )NULL; + (*reg)->int_map = (int* )NULL; + (*reg)->int_map_backward = (int* )NULL; + (*reg)->chain = (regex_t* )NULL; + + (*reg)->p = (UChar* )NULL; + (*reg)->alloc = 0; + (*reg)->used = 0; + (*reg)->name_table = (void* )NULL; + + return 0; +} + +extern int +regex_new(regex_t** reg, UChar* pattern, UChar* pattern_end, + RegOptionType option, RegCharEncoding code, RegSyntaxType* syntax, + RegErrorInfo* einfo) +{ + int r; + + if (IS_NOT_NULL(einfo)) einfo->par = (UChar* )NULL; + + r = regex_alloc_init(reg, option, code, syntax); + if (r) return r; + + r = regex_compile(*reg, pattern, pattern_end, einfo); + if (r) { + regex_free(*reg); + *reg = NULL; + } + return r; +} + +extern void +regex_set_default_trans_table(UChar* table) +{ + int i; + + if (table && table != DefaultTransTable) { + DefaultTransTable = table; + + for (i = 0; i < REG_CHAR_TABLE_SIZE; i++) + AmbiguityTable[i] = 0; + + for (i = 0; i < REG_CHAR_TABLE_SIZE; i++) { + AmbiguityTable[table[i]]++; + if (table[i] != i) + AmbiguityTable[i] += 2; + } + } +} + +extern int +regex_init() +{ + regex_inited = 1; + + THREAD_ATOMIC_START; +#ifdef DEFAULT_TRANSTABLE_EXIST + if (! DefaultTransTable) /* check re_set_casetable() called already. */ + regex_set_default_trans_table(DTT); +#endif + +#ifdef REG_DEBUG_STATISTICS + regex_statistics_init(); +#endif + THREAD_ATOMIC_END; + + return 0; +} + +extern int +regex_end() +{ +#ifdef REG_DEBUG_STATISTICS + regex_print_statistics(stderr); +#endif + +#ifdef USE_RECYCLE_NODE + regex_free_node_list(); +#endif + + regex_inited = 0; + return 0; +} + + +#ifdef REG_DEBUG + +RegOpInfoType RegOpInfo[] = { + { OP_FINISH, "finish", ARG_NON }, + { OP_END, "end", ARG_NON }, + { OP_EXACT1, "exact1", ARG_SPECIAL }, + { OP_EXACT2, "exact2", ARG_SPECIAL }, + { OP_EXACT3, "exact3", ARG_SPECIAL }, + { OP_EXACT4, "exact4", ARG_SPECIAL }, + { OP_EXACT5, "exact5", ARG_SPECIAL }, + { OP_EXACTN, "exactn", ARG_SPECIAL }, + { OP_EXACTMB2N1, "exactmb2-n1", ARG_SPECIAL }, + { OP_EXACTMB2N2, "exactmb2-n2", ARG_SPECIAL }, + { OP_EXACTMB2N3, "exactmb2-n3", ARG_SPECIAL }, + { OP_EXACTMB2N, "exactmb2-n", ARG_SPECIAL }, + { OP_EXACTMB3N, "exactmb3n" , ARG_SPECIAL }, + { OP_EXACTMBN, "exactmbn", ARG_SPECIAL }, + { OP_EXACT1_IC, "exact1-ic", ARG_SPECIAL }, + { OP_EXACTN_IC, "exactn-ic", ARG_SPECIAL }, + { OP_CCLASS, "cclass", ARG_SPECIAL }, + { OP_CCLASS_MB, "cclass-mb", ARG_SPECIAL }, + { OP_CCLASS_MIX, "cclass-mix", ARG_SPECIAL }, + { OP_CCLASS_NOT, "cclass-not", ARG_SPECIAL }, + { OP_CCLASS_MB_NOT, "cclass-mb-not", ARG_SPECIAL }, + { OP_CCLASS_MIX_NOT, "cclass-mix-not", ARG_SPECIAL }, + { OP_ANYCHAR, "anychar", ARG_NON }, + { OP_ANYCHAR_STAR, "anychar*", ARG_NON }, + { OP_ANYCHAR_STAR_PEEK_NEXT, "anychar*-peek-next", ARG_SPECIAL }, + { OP_WORD, "word", ARG_NON }, + { OP_NOT_WORD, "not-word", ARG_NON }, + { OP_WORD_SB, "word-sb", ARG_NON }, + { OP_WORD_MB, "word-mb", ARG_NON }, + { OP_WORD_BOUND, "word-bound", ARG_NON }, + { OP_NOT_WORD_BOUND, "not-word-bound", ARG_NON }, + { OP_WORD_BEGIN, "word-begin", ARG_NON }, + { OP_WORD_END, "word-end", ARG_NON }, + { OP_BEGIN_BUF, "begin-buf", ARG_NON }, + { OP_END_BUF, "end-buf", ARG_NON }, + { OP_BEGIN_LINE, "begin-line", ARG_NON }, + { OP_END_LINE, "end-line", ARG_NON }, + { OP_SEMI_END_BUF, "semi-end-buf", ARG_NON }, + { OP_BEGIN_POSITION, "begin-position", ARG_NON }, + { OP_BACKREF1, "backref1", ARG_NON }, + { OP_BACKREF2, "backref2", ARG_NON }, + { OP_BACKREF3, "backref3", ARG_NON }, + { OP_BACKREFN, "backrefn", ARG_MEMNUM }, + { OP_BACKREF_MULTI, "backref_multi", ARG_SPECIAL }, + { OP_MEMORY_START_PUSH, "mem-start-push", ARG_MEMNUM }, + { OP_MEMORY_START, "mem-start", ARG_MEMNUM }, + { OP_MEMORY_END_PUSH, "mem-end-push", ARG_MEMNUM }, + { OP_MEMORY_END_PUSH_REC, "mem-end-push-rec", ARG_MEMNUM }, + { OP_MEMORY_END, "mem-end", ARG_MEMNUM }, + { OP_MEMORY_END_REC, "mem-end-rec", ARG_MEMNUM }, + { OP_SET_OPTION_PUSH, "set-option-push", ARG_OPTION }, + { OP_SET_OPTION, "set-option", ARG_OPTION }, + { OP_FAIL, "fail", ARG_NON }, + { OP_JUMP, "jump", ARG_RELADDR }, + { OP_PUSH, "push", ARG_RELADDR }, + { OP_POP, "pop", ARG_NON }, + { OP_PUSH_OR_JUMP_EXACT1, "push-or-jump-e1", ARG_SPECIAL }, + { OP_PUSH_IF_PEEK_NEXT, "push-if-peek-next", ARG_SPECIAL }, + { OP_REPEAT, "repeat", ARG_SPECIAL }, + { OP_REPEAT_NG, "repeat-ng", ARG_SPECIAL }, + { OP_REPEAT_INC, "repeat-inc", ARG_MEMNUM }, + { OP_REPEAT_INC_NG, "repeat-inc-ng", ARG_MEMNUM }, + { OP_NULL_CHECK_START, "null-check-start",ARG_MEMNUM }, + { OP_NULL_CHECK_END, "null-check-end", ARG_MEMNUM }, + { OP_PUSH_POS, "push-pos", ARG_NON }, + { OP_POP_POS, "pop-pos", ARG_NON }, + { OP_PUSH_POS_NOT, "push-pos-not", ARG_RELADDR }, + { OP_FAIL_POS, "fail-pos", ARG_NON }, + { OP_PUSH_STOP_BT, "push-stop-bt", ARG_NON }, + { OP_POP_STOP_BT, "pop-stop-bt", ARG_NON }, + { OP_LOOK_BEHIND, "look-behind", ARG_SPECIAL }, + { OP_PUSH_LOOK_BEHIND_NOT, "push-look-behind-not", ARG_SPECIAL }, + { OP_FAIL_LOOK_BEHIND_NOT, "fail-look-behind-not", ARG_NON }, + { OP_CALL, "call", ARG_ABSADDR }, + { OP_RETURN, "return", ARG_NON }, + { -1, "", ARG_NON } +}; + +static char* +op2name(int opcode) +{ + int i; + + for (i = 0; RegOpInfo[i].opcode >= 0; i++) { + if (opcode == RegOpInfo[i].opcode) + return RegOpInfo[i].name; + } + return ""; +} + +static int +op2arg_type(int opcode) +{ + int i; + + for (i = 0; RegOpInfo[i].opcode >= 0; i++) { + if (opcode == RegOpInfo[i].opcode) + return RegOpInfo[i].arg_type; + } + return ARG_SPECIAL; +} + +static void +Indent(FILE* f, int indent) +{ + int i; + for (i = 0; i < indent; i++) putc(' ', f); +} + +static void +p_string(FILE* f, int len, UChar* s) +{ + fputs(":", f); + while (len-- > 0) { fputc(*s++, f); } +} + +static void +p_len_string(FILE* f, LengthType len, int mb_len, UChar* s) +{ + int x = len * mb_len; + + fprintf(f, ":%d:", len); + while (x-- > 0) { fputc(*s++, f); } +} + +extern void +regex_print_compiled_byte_code(FILE* f, UChar* bp, UChar** nextp) +{ + int i, n, arg_type; + RelAddrType addr; + LengthType len; + MemNumType mem; + WCINT wc; + UChar *q; + + fprintf(f, "[%s", op2name(*bp)); + arg_type = op2arg_type(*bp); + if (arg_type != ARG_SPECIAL) { + bp++; + switch (arg_type) { + case ARG_NON: + break; + case ARG_RELADDR: + addr = *((RelAddrType* )bp); + bp += SIZE_RELADDR; + fprintf(f, ":(%d)", addr); + break; + case ARG_ABSADDR: + GET_ABSADDR_INC(addr, bp); + fprintf(f, ":(%d)", addr); + break; + case ARG_LENGTH: + GET_LENGTH_INC(len, bp); + fprintf(f, ":%d", len); + break; + case ARG_MEMNUM: + mem = *((MemNumType* )bp); + bp += SIZE_MEMNUM; + fprintf(f, ":%d", mem); + break; + case ARG_OPTION: + { + RegOptionType option = *((RegOptionType* )bp); + bp += SIZE_OPTION; + fprintf(f, ":%d", option); + } + break; + } + } + else { + switch (*bp++) { + case OP_EXACT1: + case OP_ANYCHAR_STAR_PEEK_NEXT: + p_string(f, 1, bp++); break; + case OP_EXACT2: + p_string(f, 2, bp); bp += 2; break; + case OP_EXACT3: + p_string(f, 3, bp); bp += 3; break; + case OP_EXACT4: + p_string(f, 4, bp); bp += 4; break; + case OP_EXACT5: + p_string(f, 5, bp); bp += 5; break; + case OP_EXACTN: + GET_LENGTH_INC(len, bp); + p_len_string(f, len, 1, bp); + bp += len; + break; + + case OP_EXACTMB2N1: + p_string(f, 2, bp); bp += 2; break; + case OP_EXACTMB2N2: + p_string(f, 4, bp); bp += 4; break; + case OP_EXACTMB2N3: + p_string(f, 6, bp); bp += 6; break; + case OP_EXACTMB2N: + GET_LENGTH_INC(len, bp); + p_len_string(f, len, 2, bp); + bp += len * 2; + break; + case OP_EXACTMB3N: + GET_LENGTH_INC(len, bp); + p_len_string(f, len, 3, bp); + bp += len * 3; + break; + case OP_EXACTMBN: + { + int mb_len; + + GET_LENGTH_INC(mb_len, bp); + GET_LENGTH_INC(len, bp); + fprintf(f, ":%d:%d:", mb_len, len); + n = len * mb_len; + while (n-- > 0) { fputc(*bp++, f); } + } + break; + + case OP_EXACT1_IC: + p_string(f, 1, bp++); + break; + case OP_EXACTN_IC: + GET_LENGTH_INC(len, bp); + p_len_string(f, len, 1, bp); + bp += len; + break; + + case OP_CCLASS: + n = bitset_on_num((BitSetRef )bp); + bp += SIZE_BITSET; + fprintf(f, ":%d", n); + break; + + case OP_CCLASS_NOT: + n = bitset_on_num((BitSetRef )bp); + bp += SIZE_BITSET; + fprintf(f, ":%d", n); + break; + + case OP_CCLASS_MB: + case OP_CCLASS_MB_NOT: + GET_LENGTH_INC(len, bp); + q = bp; +#ifndef UNALIGNED_WORD_ACCESS + ALIGNMENT_RIGHT(q); +#endif + GET_WCINT(wc, q); + bp += len; + fprintf(f, ":%d:%d", (int )wc, len); + break; + + case OP_CCLASS_MIX: + case OP_CCLASS_MIX_NOT: + n = bitset_on_num((BitSetRef )bp); + bp += SIZE_BITSET; + GET_LENGTH_INC(len, bp); + q = bp; +#ifndef UNALIGNED_WORD_ACCESS + ALIGNMENT_RIGHT(q); +#endif + GET_WCINT(wc, q); + bp += len; + fprintf(f, ":%d:%d:%d", n, (int )wc, len); + break; + + case OP_BACKREF_MULTI: + fputs(" ", f); + GET_LENGTH_INC(len, bp); + for (i = 0; i < len; i++) { + GET_MEMNUM_INC(mem, bp); + if (i > 0) fputs(", ", f); + fprintf(f, "%d", mem); + } + break; + + case OP_REPEAT: + case OP_REPEAT_NG: + { + mem = *((MemNumType* )bp); + bp += SIZE_MEMNUM; + addr = *((RelAddrType* )bp); + bp += SIZE_RELADDR; + fprintf(f, ":%d:%d", mem, addr); + } + break; + + case OP_PUSH_OR_JUMP_EXACT1: + case OP_PUSH_IF_PEEK_NEXT: + addr = *((RelAddrType* )bp); + bp += SIZE_RELADDR; + fprintf(f, ":(%d)", addr); + p_string(f, 1, bp); + bp += 1; + break; + + case OP_LOOK_BEHIND: + GET_LENGTH_INC(len, bp); + fprintf(f, ":%d", len); + break; + + case OP_PUSH_LOOK_BEHIND_NOT: + GET_RELADDR_INC(addr, bp); + GET_LENGTH_INC(len, bp); + fprintf(f, ":%d:(%d)", len, addr); + break; + + default: + fprintf(stderr, "regex_print_compiled_byte_code: undefined code %d\n", + *--bp); + } + } + fputs("]", f); + if (nextp) *nextp = bp; +} + +static void +print_compiled_byte_code_list(FILE* f, regex_t* reg) +{ + int ncode; + UChar* bp = reg->p; + UChar* end = reg->p + reg->used; + + fprintf(f, "code length: %d\n", reg->used); + + ncode = 0; + while (bp < end) { + ncode++; + if (bp > reg->p) { + if (ncode % 5 == 0) + fprintf(f, "\n"); + else + fputs(" ", f); + } + regex_print_compiled_byte_code(f, bp, &bp); + } + + fprintf(f, "\n"); +} + +static void +print_indent_tree(FILE* f, Node* node, int indent) +{ + int i, type; + int add = 3; + UChar* p; + + Indent(f, indent); + if (IS_NULL(node)) { + fprintf(f, "ERROR: null node!!!\n"); + exit (0); + } + + type = NTYPE(node); + switch (type) { + case N_LIST: + case N_ALT: + if (NTYPE(node) == N_LIST) + fprintf(f, "<list:%x>\n", (int )node); + else + fprintf(f, "<alt:%x>\n", (int )node); + + print_indent_tree(f, NCONS(node).left, indent + add); + while (IS_NOT_NULL(node = NCONS(node).right)) { + if (NTYPE(node) != type) { + fprintf(f, "ERROR: list/alt right is not a cons. %d\n", NTYPE(node)); + exit(0); + } + print_indent_tree(f, NCONS(node).left, indent + add); + } + break; + + case N_STRING: + fprintf(f, "<string%s:%x>", + (NSTRING_IS_RAW(node) ? "-raw" : ""), (int )node); + for (p = NSTRING(node).s; p < NSTRING(node).end; p++) fputc(*p, f); + break; + + case N_CCLASS: + fprintf(f, "<cclass:%x>", (int )node); + if (NCCLASS(node).not) fputs(" not", f); + if (NCCLASS(node).mbuf) { + BBuf* bbuf = NCCLASS(node).mbuf; + for (i = 0; i < bbuf->used; i++) { + if (i > 0) fprintf(f, ","); + fprintf(f, "%0x", bbuf->p[i]); + } + } +#if 0 + fprintf(f, "\n"); + Indent(f, indent); + for (i = 0; i < SINGLE_BYTE_SIZE; i++) + fputc((BITSET_AT(NCCLASS(node).bs, i) ? '1' : '0'), f); +#endif + break; + + case N_CTYPE: + fprintf(f, "<ctype:%x> ", (int )node); + switch (NCTYPE(node).type) { + case CTYPE_WORD: fputs("word", f); break; + case CTYPE_NOT_WORD: fputs("not word", f); break; +#ifdef USE_SBMB_CLASS + case CTYPE_WORD_SB: fputs("word-sb", f); break; + case CTYPE_WORD_MB: fputs("word-mb", f); break; +#endif + default: + fprintf(f, "ERROR: undefined ctype.\n"); + exit(0); + } + break; + + case N_ANYCHAR: + fprintf(f, "<anychar:%x>", (int )node); + break; + + case N_ANCHOR: + fprintf(f, "<anchor:%x> ", (int )node); + switch (NANCHOR(node).type) { + case ANCHOR_BEGIN_BUF: fputs("begin buf", f); break; + case ANCHOR_END_BUF: fputs("end buf", f); break; + case ANCHOR_BEGIN_LINE: fputs("begin line", f); break; + case ANCHOR_END_LINE: fputs("end line", f); break; + case ANCHOR_SEMI_END_BUF: fputs("semi end buf", f); break; + case ANCHOR_BEGIN_POSITION: fputs("begin position", f); break; + + case ANCHOR_WORD_BOUND: fputs("word bound", f); break; + case ANCHOR_NOT_WORD_BOUND: fputs("not word bound", f); break; +#ifdef USE_WORD_BEGIN_END + case ANCHOR_WORD_BEGIN: fputs("word begin", f); break; + case ANCHOR_WORD_END: fputs("word end", f); break; +#endif + case ANCHOR_PREC_READ: fputs("prec read", f); break; + case ANCHOR_PREC_READ_NOT: fputs("prec read not", f); break; + case ANCHOR_LOOK_BEHIND: fputs("look_behind", f); break; + case ANCHOR_LOOK_BEHIND_NOT: fputs("look_behind_not",f); break; + + default: + fprintf(f, "ERROR: undefined anchor type.\n"); + break; + } + break; + + case N_BACKREF: + { + int* p; + BackrefNode* br = &(NBACKREF(node)); + p = BACKREFS_P(br); + fprintf(f, "<backref:%x>", (int )node); + for (i = 0; i < br->back_num; i++) { + if (i > 0) fputs(", ", f); + fprintf(f, "%d", p[i]); + } + } + break; + +#ifdef USE_SUBEXP_CALL + case N_CALL: + { + CallNode* cn = &(NCALL(node)); + fprintf(f, "<call:%x>", (int )node); + p_string(f, cn->name_end - cn->name, cn->name); + } + break; +#endif + + case N_QUALIFIER: + fprintf(f, "<qualifier:%x>{%d,%d}%s\n", (int )node, + NQUALIFIER(node).lower, NQUALIFIER(node).upper, + (NQUALIFIER(node).greedy ? "" : "?")); + print_indent_tree(f, NQUALIFIER(node).target, indent + add); + break; + + case N_EFFECT: + fprintf(f, "<effect:%x> ", (int )node); + switch (NEFFECT(node).type) { + case EFFECT_OPTION: + fprintf(f, "option:%d\n", NEFFECT(node).option); + print_indent_tree(f, NEFFECT(node).target, indent + add); + break; + case EFFECT_MEMORY: + fprintf(f, "memory:%d", NEFFECT(node).regnum); + break; + case EFFECT_STOP_BACKTRACK: + fprintf(f, "stop-bt"); + break; + + default: + break; + } + fprintf(f, "\n"); + print_indent_tree(f, NEFFECT(node).target, indent + add); + break; + + default: + fprintf(f, "print_indent_tree: undefined node type %d\n", NTYPE(node)); + break; + } + + if (type != N_LIST && type != N_ALT && type != N_QUALIFIER && + type != N_EFFECT) + fprintf(f, "\n"); + fflush(f); +} + +static void +print_tree(FILE* f, Node* node) +{ + print_indent_tree(f, node, 0); +} +#endif /* REG_DEBUG */ diff --git a/ext/mbstring/oniguruma/regerror.c b/ext/mbstring/oniguruma/regerror.c new file mode 100644 index 0000000000..a1e86c34f1 --- /dev/null +++ b/ext/mbstring/oniguruma/regerror.c @@ -0,0 +1,267 @@ +/********************************************************************** + + regerror.c - Oniguruma (regular expression library) + + Copyright (C) 2002-2003 K.Kosako (kosako@sofnec.co.jp) + +**********************************************************************/ +#include "regint.h" +#include <stdio.h> /* for vsnprintf() */ + +#ifdef HAVE_STDARG_PROTOTYPES +#include <stdarg.h> +#define va_init_list(a,b) va_start(a,b) +#else +#include <varargs.h> +#define va_init_list(a,b) va_start(a) +#endif + +extern char* +regex_error_code_to_format(int code) +{ + char *p; + + if (code >= 0) return (char* )0; + + switch (code) { + case REG_MISMATCH: + p = "mismatch"; break; + case REG_NO_SUPPORT_CONFIG: + p = "no support in this configuration"; break; + case REGERR_MEMORY: + p = "fail to memory allocation"; break; + case REGERR_MATCH_STACK_LIMIT_OVER: + p = "match-stack limit over"; break; + case REGERR_TYPE_BUG: + p = "undefined type (bug)"; break; + case REGERR_PARSER_BUG: + p = "internal parser error (bug)"; break; + case REGERR_STACK_BUG: + p = "stack error (bug)"; break; + case REGERR_UNDEFINED_BYTECODE: + p = "undefined bytecode (bug)"; break; + case REGERR_UNEXPECTED_BYTECODE: + p = "unexpected bytecode (bug)"; break; + case REGERR_DEFAULT_ENCODING_IS_NOT_SETTED: + p = "default multibyte-encoding is not setted"; break; + case REGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR: + p = "can't convert to wide-char on specified multibyte-encoding"; break; + case REGERR_END_PATTERN_AT_LEFT_BRACE: + p = "end pattern at left brace"; break; + case REGERR_END_PATTERN_AT_LEFT_BRACKET: + p = "end pattern at left bracket"; break; + case REGERR_EMPTY_CHAR_CLASS: + p = "empty char-class"; break; + case REGERR_PREMATURE_END_OF_CHAR_CLASS: + p = "premature end of char-class"; break; + case REGERR_END_PATTERN_AT_BACKSLASH: + p = "end pattern at backslash"; break; + case REGERR_END_PATTERN_AT_META: + p = "end pattern at meta"; break; + case REGERR_END_PATTERN_AT_CONTROL: + p = "end pattern at control"; break; + case REGERR_META_CODE_SYNTAX: + p = "illegal meta-code syntax"; break; + case REGERR_CONTROL_CODE_SYNTAX: + p = "illegal control-code syntax"; break; + case REGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE: + p = "char-class value at end of range"; break; + case REGERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE: + p = "char-class value at start of range"; break; + case REGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS: + p = "unmatched range specifier in char-class"; break; + case REGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED: + p = "target of repeat operator is not specified"; break; + case REGERR_TARGET_OF_REPEAT_OPERATOR_INVALID: + p = "target of repeat operator is invalid"; break; + case REGERR_NESTED_REPEAT_OPERATOR: + p = "nested repeat operator"; break; + case REGERR_UNMATCHED_CLOSE_PARENTHESIS: + p = "unmatched close parenthesis"; break; + case REGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS: + p = "end pattern with unmatched parenthesis"; break; + case REGERR_END_PATTERN_IN_GROUP: + p = "end pattern in group"; break; + case REGERR_UNDEFINED_GROUP_OPTION: + p = "undefined group option"; break; + case REGERR_INVALID_POSIX_BRACKET_TYPE: + p = "invalid POSIX bracket type"; break; + case REGERR_INVALID_LOOK_BEHIND_PATTERN: + p = "invalid pattern in look-behind"; break; + case REGERR_INVALID_REPEAT_RANGE_PATTERN: + p = "invalid repeat range {lower,upper}"; break; + case REGERR_TOO_BIG_NUMBER: + p = "too big number"; break; + case REGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE: + p = "too big number for repeat range"; break; + case REGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE: + p = "upper is smaller than lower in repeat range"; break; + case REGERR_EMPTY_RANGE_IN_CHAR_CLASS: + p = "empty range in char class"; break; + case REGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE: + p = "mismatch multibyte code length in char-class range"; break; + case REGERR_TOO_MANY_MULTI_BYTE_RANGES: + p = "too many multibyte code ranges are specified"; break; + case REGERR_TOO_SHORT_MULTI_BYTE_STRING: + p = "too short multibyte code string"; break; + case REGERR_TOO_BIG_BACKREF_NUMBER: + p = "too big backref number"; break; + case REGERR_INVALID_BACKREF: +#ifdef USE_NAMED_SUBEXP + p = "invalid backref number/name"; break; +#else + p = "invalid backref number"; break; +#endif + case REGERR_TOO_BIG_WIDE_CHAR_VALUE: + p = "too big wide-char value"; break; + case REGERR_TOO_LONG_WIDE_CHAR_VALUE: + p = "too long wide-char value"; break; + case REGERR_INVALID_WIDE_CHAR_VALUE: + p = "invalid wide-char value"; break; + case REGERR_INVALID_SUBEXP_NAME: + p = "invalid subexp name"; break; + case REGERR_UNDEFINED_NAME_REFERENCE: + p = "undefined name <%n> reference"; break; + case REGERR_UNDEFINED_GROUP_REFERENCE: + p = "undefined group reference"; break; + case REGERR_MULTIPLEX_DEFINITION_NAME_CALL: + p = "multiplex definition name <%n> call"; break; + case REGERR_NEVER_ENDING_RECURSION: + p = "never ending recursion"; break; + case REGERR_OVER_THREAD_PASS_LIMIT_COUNT: + p = "over thread pass limit count"; break; + + default: + p = "undefined error code"; break; + } + + return p; +} + + +/* for REG_MAX_ERROR_MESSAGE_LEN */ +#define MAX_ERROR_PAR_LEN 30 + +extern int +#ifdef HAVE_STDARG_PROTOTYPES +regex_error_code_to_str(UChar* s, int code, ...) +#else +regex_error_code_to_str(UChar* s, code, va_alist) + int code; + va_dcl +#endif +{ + UChar *p, *q; + RegErrorInfo* einfo; + int len; + va_list vargs; + + va_init_list(vargs, code); + + switch (code) { + case REGERR_UNDEFINED_NAME_REFERENCE: + case REGERR_MULTIPLEX_DEFINITION_NAME_CALL: + einfo = va_arg(vargs, RegErrorInfo*); + len = einfo->par_end - einfo->par; + q = regex_error_code_to_format(code); + p = s; + while (*q != '\0') { + if (*q == '%') { + q++; + if (*q == 'n') { /* '%n': name */ + if (len > MAX_ERROR_PAR_LEN) { + xmemcpy(p, einfo->par, MAX_ERROR_PAR_LEN - 3); + p += (MAX_ERROR_PAR_LEN - 3); + xmemcpy(p, "...", 3); + p += 3; + } + else { + xmemcpy(p, einfo->par, len); + p += len; + } + q++; + } + else + goto normal_char; + } + else { + normal_char: + *p++ = *q++; + } + } + *p = '\0'; + len = p - s; + break; + + default: + q = regex_error_code_to_format(code); + len = strlen(q); + xmemcpy(s, q, len); + s[len] = '\0'; + break; + } + + va_end(vargs); + return len; +} + + +void +#ifdef HAVE_STDARG_PROTOTYPES +regex_snprintf_with_pattern(char buf[], int bufsize, RegCharEncoding enc, + char* pat, char* pat_end, char *fmt, ...) +#else +regex_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist) + char buf[]; + int bufsize; + RegCharEncoding enc; + char* pat; + char* pat_end; + const char *fmt; + va_dcl +#endif +{ + int n, need, len; + char *p, *s; + va_list args; + + va_init_list(args, fmt); + n = vsnprintf(buf, bufsize, fmt, args); + va_end(args); + + need = (pat_end - pat) * 4 + 4; + + if (n + need < bufsize) { + strcat(buf, ": /"); + s = buf + strlen(buf); + + p = pat; + while (p < pat_end) { + if (*p == '\\') { + *s++ = *p++; + len = mblen(enc, *p); + while (len-- > 0) *s++ = *p++; + } + else if (*p == '/') { + *s++ = '\\'; + *s++ = *p++; + } + else if (ismb(enc, *p)) { + len = mblen(enc, *p); + while (len-- > 0) *s++ = *p++; + } + else if (!IS_PRINT(*p) && !IS_SPACE(*p)) { + char b[5]; + sprintf(b, "\\%03o", *p & 0377); + len = strlen(b); + while (len-- > 0) *s++ = *p++; + } + else { + *s++ = *p++; + } + } + + *s++ = '/'; + *s = '\0'; + } +} diff --git a/ext/mbstring/oniguruma/regex.c b/ext/mbstring/oniguruma/regex.c new file mode 100644 index 0000000000..0c4a43be9e --- /dev/null +++ b/ext/mbstring/oniguruma/regex.c @@ -0,0 +1,16 @@ +/********************************************************************** + + regex.c - Oniguruma (regular expression library) + + Copyright (C) 2002-2003 K.Kosako (kosako@sofnec.co.jp) + +**********************************************************************/ +/* + * Source wrapper for Ruby. + */ + +#include "regparse.c" +#include "regcomp.c" +#include "regexec.c" +#include "reggnu.c" +#include "regerror.c" diff --git a/ext/mbstring/oniguruma/regexec.c b/ext/mbstring/oniguruma/regexec.c new file mode 100644 index 0000000000..b7319ac4fb --- /dev/null +++ b/ext/mbstring/oniguruma/regexec.c @@ -0,0 +1,2935 @@ +/********************************************************************** + + regexec.c - Oniguruma (regular expression library) + + Copyright (C) 2002-2003 K.Kosako (kosako@sofnec.co.jp) + +**********************************************************************/ +#include "regint.h" + +static UChar* +get_right_adjust_char_head_with_prev(RegCharEncoding code, + UChar* start, UChar* s, UChar** prev); +static UChar* +step_backward_char(RegCharEncoding code, UChar* start, UChar* s, int n); + + +extern void +regex_region_clear(RegRegion* region) +{ + int i; + + for (i = 0; i < region->num_regs; i++) { + region->beg[i] = region->end[i] = REG_REGION_NOTPOS; + } +} + +extern int +regex_region_resize(RegRegion* region, int n) +{ + int i; + + region->num_regs = n; + + if (n < REG_NREGION) + n = REG_NREGION; + + if (region->allocated == 0) { + region->beg = (int* )xmalloc(n * sizeof(int)); + region->end = (int* )xmalloc(n * sizeof(int)); + + if (region->beg == 0 || region->end == 0) + return REGERR_MEMORY; + + region->allocated = n; + } + else if (region->allocated < n) { + region->beg = (int* )xrealloc(region->beg, n * sizeof(int)); + region->end = (int* )xrealloc(region->end, n * sizeof(int)); + + if (region->beg == 0 || region->end == 0) + return REGERR_MEMORY; + + region->allocated = n; + } + + for (i = 0; i < region->num_regs; i++) { + region->beg[i] = region->end[i] = REG_REGION_NOTPOS; + } + return 0; +} + +static void +regex_region_init(RegRegion* region) +{ + region->num_regs = 0; + region->allocated = 0; + region->beg = (int* )0; + region->end = (int* )0; +} + +extern RegRegion* +regex_region_new() +{ + RegRegion* r; + + r = (RegRegion* )xmalloc(sizeof(RegRegion)); + regex_region_init(r); + return r; +} + +extern void +regex_region_free(RegRegion* r, int free_self) +{ + if (r) { + if (r->allocated > 0) { + if (r->beg) xfree(r->beg); + if (r->end) xfree(r->end); + r->allocated = 0; + } + if (free_self) xfree(r); + } +} + +extern void +regex_region_copy(RegRegion* to, RegRegion* from) +{ +#define RREGC_SIZE (sizeof(int) * from->num_regs) + int i; + + if (to == from) return; + + if (to->allocated == 0) { + if (from->num_regs > 0) { + to->beg = (int* )xmalloc(RREGC_SIZE); + to->end = (int* )xmalloc(RREGC_SIZE); + to->allocated = from->num_regs; + } + } + else if (to->allocated < from->num_regs) { + to->beg = (int* )xrealloc(to->beg, RREGC_SIZE); + to->end = (int* )xrealloc(to->end, RREGC_SIZE); + to->allocated = from->num_regs; + } + + for (i = 0; i < from->num_regs; i++) { + to->beg[i] = from->beg[i]; + to->end[i] = from->end[i]; + } + to->num_regs = from->num_regs; +} + + +/** stack **/ +#define INVALID_STACK_INDEX -1 +typedef int StackIndex; + +typedef struct _StackType { + unsigned int type; + union { + struct { + UChar *pcode; /* byte code position */ + UChar *pstr; /* string position */ + UChar *pstr_prev; /* previous char position of pstr */ + } state; + struct { + int count; /* for OP_REPEAT_INC, OP_REPEAT_INC_NG */ + UChar *pcode; /* byte code position (head of repeated target) */ + int num; /* repeat id */ + } repeat; + struct { + StackIndex si; /* index of stack */ + } repeat_inc; + struct { + int num; /* memory num */ + UChar *pstr; /* start/end position */ + /* Following information is setted, if this stack type is MEM-START */ + StackIndex start; /* prev. info (for backtrack "(...)*" ) */ + StackIndex end; /* prev. info (for backtrack "(...)*" ) */ + } mem; + struct { + int num; /* null check id */ + UChar *pstr; /* start position */ + } null_check; +#ifdef USE_SUBEXP_CALL + struct { + UChar *ret_addr; /* byte code position */ + int num; /* null check id */ + UChar *pstr; /* string position */ + } call_frame; +#endif + } u; +} StackType; + +/* stack type */ +/* used by normal-POP */ +#define STK_ALT 0x0001 +#define STK_LOOK_BEHIND_NOT 0x0003 +#define STK_POS_NOT 0x0005 +/* avoided by normal-POP, but value should be small */ +#define STK_NULL_CHECK_START 0x0100 +/* handled by normal-POP */ +#define STK_MEM_START 0x0200 +#define STK_MEM_END 0x0300 +#define STK_REPEAT_INC 0x0400 +/* avoided by normal-POP */ +#define STK_POS 0x0500 /* used when POP-POS */ +#define STK_STOP_BT 0x0600 /* mark for "(?>...)" */ +#define STK_REPEAT 0x0700 +#define STK_CALL_FRAME 0x0800 +#define STK_RETURN 0x0900 +#define STK_MEM_END_MARK 0x0a00 +#define STK_VOID 0x0b00 /* for fill a blank */ + +/* stack type check mask */ +#define STK_MASK_POP_USED 0x00ff +#define IS_TO_VOID_TARGET(stk) \ + (((stk)->type & STK_MASK_POP_USED) || (stk)->type == STK_NULL_CHECK_START) + +typedef struct { + void* stack_p; + int stack_n; + RegOptionType options; + RegRegion* region; + UChar* start; /* search start position (for \G: BEGIN_POSITION) */ +} MatchArg; + +#define MATCH_ARG_INIT(msa, arg_option, arg_region, arg_start) do {\ + (msa).stack_p = (void* )0;\ + (msa).options = (arg_option);\ + (msa).region = (arg_region);\ + (msa).start = (arg_start);\ +} while (0) + +#define MATCH_ARG_FREE(msa) if ((msa).stack_p) xfree((msa).stack_p) + + +#define STACK_INIT(alloc_addr, ptr_num, stack_num) do {\ + if (msa->stack_p) {\ + alloc_addr = (char* )xalloca(sizeof(char*) * (ptr_num));\ + stk_alloc = (StackType* )(msa->stack_p);\ + stk_base = stk_alloc;\ + stk = stk_base;\ + stk_end = stk_base + msa->stack_n;\ + }\ + else {\ + alloc_addr = (char* )xalloca(sizeof(char*) * (ptr_num)\ + + sizeof(StackType) * (stack_num));\ + stk_alloc = (StackType* )(alloc_addr + sizeof(char*) * (ptr_num));\ + stk_base = stk_alloc;\ + stk = stk_base;\ + stk_end = stk_base + (stack_num);\ + }\ +} while(0) + +#define STACK_SAVE do{\ + if (stk_base != stk_alloc) {\ + msa->stack_p = stk_base;\ + msa->stack_n = stk_end - stk_base;\ + };\ +} while(0) + +static int +stack_double(StackType** arg_stk_base, StackType** arg_stk_end, + StackType** arg_stk, StackType* stk_alloc, MatchArg* msa) +{ + int n; + StackType *x, *stk_base, *stk_end, *stk; + + stk_base = *arg_stk_base; + stk_end = *arg_stk_end; + stk = *arg_stk; + + n = stk_end - stk_base; + if (stk_base == stk_alloc && IS_NULL(msa->stack_p)) { + x = (StackType* )xmalloc(sizeof(StackType) * n * 2); + if (IS_NULL(x)) { + STACK_SAVE; + return REGERR_MEMORY; + } + xmemcpy(x, stk_base, n * sizeof(StackType)); + n *= 2; + } + else { + n *= 2; + if (n > MATCH_STACK_LIMIT_SIZE) return REGERR_MATCH_STACK_LIMIT_OVER; + x = (StackType* )xrealloc(stk_base, sizeof(StackType) * n); + if (IS_NULL(x)) { + STACK_SAVE; + return REGERR_MEMORY; + } + } + *arg_stk = x + (stk - stk_base); + *arg_stk_base = x; + *arg_stk_end = x + n; + return 0; +} + +#define STACK_ENSURE(n) do {\ + if (stk_end - stk < (n)) {\ + int r = stack_double(&stk_base, &stk_end, &stk, stk_alloc, msa);\ + if (r != 0) { STACK_SAVE; return r; } \ + }\ +} while(0) + +#define STACK_AT(index) (stk_base + (index)) +#define GET_STACK_INDEX(stk) ((stk) - stk_base) + +#define STACK_PUSH(stack_type,pat,s,sprev) do {\ + STACK_ENSURE(1);\ + stk->type = (stack_type);\ + stk->u.state.pcode = (pat);\ + stk->u.state.pstr = (s);\ + stk->u.state.pstr_prev = (sprev);\ + STACK_INC;\ +} while(0) + +#define STACK_PUSH_ENSURED(stack_type,pat) do {\ + stk->type = (stack_type);\ + stk->u.state.pcode = (pat);\ + STACK_INC;\ +} while(0) + +#define STACK_PUSH_TYPE(stack_type) do {\ + STACK_ENSURE(1);\ + stk->type = (stack_type);\ + STACK_INC;\ +} while(0) + +#define STACK_PUSH_ALT(pat,s,sprev) STACK_PUSH(STK_ALT,pat,s,sprev) +#define STACK_PUSH_POS(s,sprev) STACK_PUSH(STK_POS,NULL_UCHARP,s,sprev) +#define STACK_PUSH_POS_NOT(pat,s,sprev) STACK_PUSH(STK_POS_NOT,pat,s,sprev) +#define STACK_PUSH_STOP_BT STACK_PUSH_TYPE(STK_STOP_BT) +#define STACK_PUSH_LOOK_BEHIND_NOT(pat,s,sprev) \ + STACK_PUSH(STK_LOOK_BEHIND_NOT,pat,s,sprev) + +#define STACK_PUSH_REPEAT(id, pat) do {\ + STACK_ENSURE(1);\ + stk->type = STK_REPEAT;\ + stk->u.repeat.num = (id);\ + stk->u.repeat.pcode = (pat);\ + stk->u.repeat.count = 0;\ + STACK_INC;\ +} while(0) + +#define STACK_PUSH_REPEAT_INC(sindex) do {\ + STACK_ENSURE(1);\ + stk->type = STK_REPEAT_INC;\ + stk->u.repeat_inc.si = (sindex);\ + STACK_INC;\ +} while(0) + +#define STACK_PUSH_MEM_START(mnum, s) do {\ + STACK_ENSURE(1);\ + stk->type = STK_MEM_START;\ + stk->u.mem.num = (mnum);\ + stk->u.mem.pstr = (s);\ + stk->u.mem.start = mem_start_stk[mnum];\ + stk->u.mem.end = mem_end_stk[mnum];\ + mem_start_stk[mnum] = GET_STACK_INDEX(stk);\ + mem_end_stk[mnum] = INVALID_STACK_INDEX;\ + STACK_INC;\ +} while(0) + +#define STACK_PUSH_MEM_END(mnum, s) do {\ + STACK_ENSURE(1);\ + stk->type = STK_MEM_END;\ + stk->u.mem.num = (mnum);\ + stk->u.mem.pstr = (s);\ + stk->u.mem.start = mem_start_stk[mnum];\ + stk->u.mem.end = mem_end_stk[mnum];\ + mem_end_stk[mnum] = GET_STACK_INDEX(stk);\ + STACK_INC;\ +} while(0) + +#define STACK_PUSH_MEM_END_MARK(mnum) do {\ + STACK_ENSURE(1);\ + stk->type = STK_MEM_END_MARK;\ + stk->u.mem.num = (mnum);\ + STACK_INC;\ +} while(0) + +#define STACK_GET_MEM_START(mnum, k) do {\ + int level = 0;\ + k = stk;\ + while (k > stk_base) {\ + k--;\ + if ((k->type == STK_MEM_END_MARK || k->type == STK_MEM_END) \ + && k->u.mem.num == (mnum)) {\ + level++;\ + }\ + else if (k->type == STK_MEM_START && k->u.mem.num == (mnum)) {\ + if (level == 0) break;\ + level--;\ + }\ + }\ +} while (0) + +#define STACK_PUSH_NULL_CHECK_START(cnum, s) do {\ + STACK_ENSURE(1);\ + stk->type = STK_NULL_CHECK_START;\ + stk->u.null_check.num = (cnum);\ + stk->u.null_check.pstr = (s);\ + STACK_INC;\ +} while(0) + +#define STACK_PUSH_CALL_FRAME(pat) do {\ + STACK_ENSURE(1);\ + stk->type = STK_CALL_FRAME;\ + stk->u.call_frame.ret_addr = (pat);\ + STACK_INC;\ +} while(0) + +#define STACK_PUSH_RETURN do {\ + STACK_ENSURE(1);\ + stk->type = STK_RETURN;\ + STACK_INC;\ +} while(0) + + +#ifdef REG_DEBUG +#define STACK_BASE_CHECK(p) \ + if ((p) < stk_base) goto stack_error; +#else +#define STACK_BASE_CHECK(p) +#endif + +#define STACK_POP_ONE do {\ + stk--;\ + STACK_BASE_CHECK(stk); \ +} while(0) + +#define STACK_POP do {\ + switch (pop_level) {\ + case STACK_POP_LEVEL_FREE:\ + while (1) {\ + stk--;\ + STACK_BASE_CHECK(stk); \ + if ((stk->type & STK_MASK_POP_USED) != 0) break;\ + }\ + break;\ + case STACK_POP_LEVEL_MEM_START:\ + while (1) {\ + stk--;\ + STACK_BASE_CHECK(stk); \ + if ((stk->type & STK_MASK_POP_USED) != 0) break;\ + else if (stk->type == STK_MEM_START) {\ + mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ + mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ + }\ + }\ + break;\ + default:\ + while (1) {\ + stk--;\ + STACK_BASE_CHECK(stk); \ + if ((stk->type & STK_MASK_POP_USED) != 0) break;\ + else if (stk->type == STK_MEM_START) {\ + mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ + mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ + }\ + else if (stk->type == STK_REPEAT_INC) {\ + STACK_AT(stk->u.repeat_inc.si)->u.repeat.count--;\ + }\ + else if (stk->type == STK_MEM_END) {\ + mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ + mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ + }\ + }\ + break;\ + }\ +} while(0) + +#define STACK_POP_TIL_POS_NOT do {\ + while (1) {\ + stk--;\ + STACK_BASE_CHECK(stk); \ + if (stk->type == STK_POS_NOT) break;\ + else if (stk->type == STK_MEM_START) {\ + mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ + mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ + }\ + else if (stk->type == STK_REPEAT_INC) {\ + STACK_AT(stk->u.repeat_inc.si)->u.repeat.count--;\ + }\ + else if (stk->type == STK_MEM_END) {\ + mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ + mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ + }\ + }\ +} while(0) + +#define STACK_POP_TIL_LOOK_BEHIND_NOT do {\ + while (1) {\ + stk--;\ + STACK_BASE_CHECK(stk); \ + if (stk->type == STK_LOOK_BEHIND_NOT) break;\ + else if (stk->type == STK_MEM_START) {\ + mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ + mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ + }\ + else if (stk->type == STK_REPEAT_INC) {\ + STACK_AT(stk->u.repeat_inc.si)->u.repeat.count--;\ + }\ + else if (stk->type == STK_MEM_END) {\ + mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ + mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ + }\ + }\ +} while(0) + +#define STACK_POS_END(k) do {\ + k = stk;\ + while (1) {\ + k--;\ + STACK_BASE_CHECK(k); \ + if (IS_TO_VOID_TARGET(k)) {\ + k->type = STK_VOID;\ + }\ + else if (k->type == STK_POS) {\ + k->type = STK_VOID;\ + break;\ + }\ + }\ +} while(0) + +#define STACK_STOP_BT_END do {\ + StackType *k = stk;\ + while (1) {\ + k--;\ + STACK_BASE_CHECK(k); \ + if (IS_TO_VOID_TARGET(k)) {\ + k->type = STK_VOID;\ + }\ + else if (k->type == STK_STOP_BT) {\ + k->type = STK_VOID;\ + break;\ + }\ + }\ +} while(0) + +#define STACK_NULL_CHECK(isnull,id,s) do {\ + StackType* k = stk;\ + while (1) {\ + k--;\ + STACK_BASE_CHECK(k); \ + if (k->type == STK_NULL_CHECK_START) {\ + if (k->u.null_check.num == (id)) {\ + (isnull) = (k->u.null_check.pstr == (s));\ + break;\ + }\ + }\ + }\ +} while(0) + +#define STACK_GET_REPEAT(id, k) do {\ + int level = 0;\ + k = stk;\ + while (1) {\ + k--;\ + STACK_BASE_CHECK(k); \ + if (k->type == STK_REPEAT) {\ + if (level == 0) {\ + if (k->u.repeat.num == (id)) {\ + break;\ + }\ + }\ + }\ + else if (k->type == STK_CALL_FRAME) level--;\ + else if (k->type == STK_RETURN) level++;\ + }\ +} while (0) + +#define STACK_RETURN(addr) do {\ + int level = 0;\ + StackType* k = stk;\ + while (1) {\ + k--;\ + STACK_BASE_CHECK(k); \ + if (k->type == STK_CALL_FRAME) {\ + if (level == 0) {\ + (addr) = k->u.call_frame.ret_addr;\ + break;\ + }\ + else level--;\ + }\ + else if (k->type == STK_RETURN)\ + level++;\ + }\ +} while(0) + + +#define CASETABLE_TOLOWER(c) (casetable[c]) + +/* byte_code is already converted to lower-case at string compile time */ +#define SBTRANSCMP(byte_code,c) (byte_code == CASETABLE_TOLOWER(c)) + +#define STRING_CMP(s1,s2,len) do {\ + if (ignore_case) {\ + int slen; \ + while (len > 0) {\ + slen = mblen(encode, *s1); \ + if (slen == 1) {\ + if (CASETABLE_TOLOWER(*s1) != CASETABLE_TOLOWER(*s2)) \ + goto fail;\ + s1++; s2++; len--; \ + } \ + else {\ + len -= slen; \ + while (slen-- > 0) { \ + if (*s1++ != *s2++) goto fail;\ + } \ + }\ + }\ + }\ + else {\ + while (len-- > 0) {\ + if (*s1++ != *s2++) goto fail;\ + }\ + }\ +} while(0) + +#define STRING_CMP_VALUE(s1,s2,len,is_fail) do {\ + is_fail = 0;\ + if (ignore_case) {\ + int slen; \ + while (len > 0) {\ + slen = mblen(encode, *s1); \ + if (slen == 1) {\ + if (CASETABLE_TOLOWER(*s1) != CASETABLE_TOLOWER(*s2)) {\ + is_fail = 1; break;\ + }\ + s1++; s2++; len--; \ + } \ + else {\ + len -= slen; \ + while (slen-- > 0) { \ + if (*s1++ != *s2++) {\ + is_fail = 1; break;\ + }\ + } \ + if (is_fail != 0) break;\ + }\ + }\ + }\ + else {\ + while (len-- > 0) {\ + if (*s1++ != *s2++) {\ + is_fail = 1; break;\ + }\ + }\ + }\ +} while(0) + +#define ON_STR_BEGIN(s) ((s) == str) +#define ON_STR_END(s) ((s) == end) +#define IS_EMPTY_STR (str == end) + +#define DATA_ENSURE(n) \ + if (s + (n) > end) goto fail + +#define DATA_ENSURE_CHECK(n) (s + (n) <= end) + +#ifdef REG_DEBUG_STATISTICS + +#define USE_TIMEOFDAY + +#ifdef USE_TIMEOFDAY +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +static struct timeval ts, te; +#define GETTIME(t) gettimeofday(&(t), (struct timezone* )0) +#define TIMEDIFF(te,ts) (((te).tv_usec - (ts).tv_usec) + \ + (((te).tv_sec - (ts).tv_sec)*1000000)) +#else +#ifdef HAVE_SYS_TIMES_H +#include <sys/times.h> +#endif +static struct tms ts, te; +#define GETTIME(t) times(&(t)) +#define TIMEDIFF(te,ts) ((te).tms_utime - (ts).tms_utime) +#endif + +static int OpCounter[256]; +static int OpPrevCounter[256]; +static unsigned long OpTime[256]; +static int OpCurr = OP_FINISH; +static int OpPrevTarget = OP_FAIL; +static int MaxStackDepth = 0; + +#define STAT_OP_IN(opcode) do {\ + if (opcode == OpPrevTarget) OpPrevCounter[OpCurr]++;\ + OpCurr = opcode;\ + OpCounter[opcode]++;\ + GETTIME(ts);\ +} while (0) + +#define STAT_OP_OUT do {\ + GETTIME(te);\ + OpTime[OpCurr] += TIMEDIFF(te, ts);\ +} while (0) + +extern void regex_statistics_init() +{ + int i; + for (i = 0; i < 256; i++) { + OpCounter[i] = OpPrevCounter[i] = 0; OpTime[i] = 0; + } + MaxStackDepth = 0; + +#ifdef RUBY_PLATFORM + rb_define_global_function("regex_stat_print", regex_stat_print, 0); +#endif +} + +#ifdef RUBY_PLATFORM +static VALUE regex_stat_print() +{ + regex_print_statistics(stderr); + return Qnil; +} +#endif + +extern void +regex_print_statistics(FILE* f) +{ + int i; + fprintf(f, " count prev time\n"); + for (i = 0; RegOpInfo[i].opcode >= 0; i++) { + fprintf(f, "%8d: %8d: %10ld: %s\n", + OpCounter[i], OpPrevCounter[i], OpTime[i], RegOpInfo[i].name); + } + fprintf(f, "\nmax stack depth: %d\n", MaxStackDepth); +} + +#define STACK_INC do {\ + stk++;\ + if (stk - stk_base > MaxStackDepth) \ + MaxStackDepth = stk - stk_base;\ +} while (0) + +#else +#define STACK_INC stk++ + +#define STAT_OP_IN(opcode) +#define STAT_OP_OUT +#endif + +extern int +regex_is_in_wc_range(UChar* p, WCINT wc) +{ + WCINT n, *data; + int low, high, x; + + GET_WCINT(n, p); + data = (WCINT* )p; + data++; + + for (low = 0, high = n; low < high; ) { + x = (low + high) >> 1; + if (wc > data[x * 2 + 1]) + low = x + 1; + else + high = x; + } + + return ((low < n && wc >= data[low * 2]) ? 1 : 0); +} + + +/* matching region of POSIX API */ +typedef int regoff_t; + +typedef struct { + regoff_t rm_so; + regoff_t rm_eo; +} posix_regmatch_t; + +/* match data(str - end) from position (sstart). */ +/* if sstart == str then set sprev to NULL. */ +static int +match_at(regex_t* reg, UChar* str, UChar* end, UChar* sstart, + UChar* sprev, MatchArg* msa) +{ + static UChar FinishCode[] = { OP_FINISH }; + + int i, n, num_mem, best_len, pop_level, find_cond; + LengthType tlen, tlen2; + MemNumType mem; + RelAddrType addr; + RegOptionType option = reg->options; + RegCharEncoding encode = reg->enc; + unsigned char* casetable = DefaultTransTable; + int ignore_case; + UChar *s, *q, *sbegin; + UChar *p = reg->p; + char *alloca_base; + StackType *stk_alloc, *stk_base, *stk, *stk_end; + StackType *stkp; /* used as any purpose. */ + StackIndex *repeat_stk; + StackIndex *mem_start_stk, *mem_end_stk; + n = reg->num_repeat + reg->num_mem * 2; + + STACK_INIT(alloca_base, n, INIT_MATCH_STACK_SIZE); + ignore_case = IS_IGNORECASE(option); + find_cond = IS_FIND_CONDITION(option); + pop_level = reg->stack_pop_level; + num_mem = reg->num_mem; + repeat_stk = (StackIndex* )alloca_base; + + mem_start_stk = (StackIndex* )(repeat_stk + reg->num_repeat); + mem_end_stk = mem_start_stk + num_mem; + mem_start_stk--; /* for index start from 1, + mem_start_stk[1]..mem_start_stk[num_mem] */ + mem_end_stk--; /* for index start from 1, + mem_end_stk[1]..mem_end_stk[num_mem] */ + for (i = 1; i <= num_mem; i++) { + mem_start_stk[i] = mem_end_stk[i] = INVALID_STACK_INDEX; + } + +#ifdef REG_DEBUG_MATCH + fprintf(stderr, "match_at: str: %d, end: %d, start: %d, sprev: %d\n", + (int )str, (int )end, (int )sstart, (int )sprev); + fprintf(stderr, "size: %d, start offset: %d\n", + (int )(end - str), (int )(sstart - str)); +#endif + + STACK_PUSH_ENSURED(STK_ALT, FinishCode); /* bottom stack */ + best_len = REG_MISMATCH; + s = sstart; + while (1) { +#ifdef REG_DEBUG_MATCH + { + UChar *q, *bp, buf[50]; + int len; + fprintf(stderr, "%4d> \"", (int )(s - str)); + bp = buf; + for (i = 0, q = s; i < 7 && q < end; i++) { + len = mblen(encode, *q); + while (len-- > 0) *bp++ = *q++; + } + if (q < end) { xmemcpy(bp, "...\"", 4); bp += 4; } + else { xmemcpy(bp, "\"", 1); bp += 1; } + *bp = 0; + fputs(buf, stderr); + for (i = 0; i < 20 - (bp - buf); i++) fputc(' ', stderr); + regex_print_compiled_byte_code(stderr, p, NULL); + fprintf(stderr, "\n"); + } +#endif + + sbegin = s; + switch (*p++) { + case OP_END: STAT_OP_IN(OP_END); + n = s - sstart; + if (n > best_len) { + RegRegion* region = msa->region; + best_len = n; + if (region) { + if (IS_POSIX_REGION(msa->options)) { + posix_regmatch_t* rmt = (posix_regmatch_t* )region; + + rmt[0].rm_so = sstart - str; + rmt[0].rm_eo = s - str; + for (i = 1; i <= num_mem; i++) { + if (mem_end_stk[i] != INVALID_STACK_INDEX) { + if (BIT_STATUS_AT(reg->backtrack_mem, i)) + rmt[i].rm_so = STACK_AT(mem_start_stk[i])->u.mem.pstr - str; + else + rmt[i].rm_so = (UChar* )((void* )(mem_start_stk[i])) - str; + + rmt[i].rm_eo = (find_cond != 0 + ? STACK_AT(mem_end_stk[i])->u.mem.pstr + : (UChar* )((void* )mem_end_stk[i])) - str; + } + else { + rmt[i].rm_so = rmt[i].rm_eo = REG_REGION_NOTPOS; + } + } + } + else { + region->beg[0] = sstart - str; + region->end[0] = s - str; + for (i = 1; i <= num_mem; i++) { + if (mem_end_stk[i] != INVALID_STACK_INDEX) { + if (BIT_STATUS_AT(reg->backtrack_mem, i)) + region->beg[i] = STACK_AT(mem_start_stk[i])->u.mem.pstr - str; + else + region->beg[i] = (UChar* )((void* )mem_start_stk[i]) - str; + + region->end[i] = (find_cond != 0 + ? STACK_AT(mem_end_stk[i])->u.mem.pstr + : (UChar* )((void* )mem_end_stk[i])) - str; + } + else { + region->beg[i] = region->end[i] = REG_REGION_NOTPOS; + } + } + } + } + } + STAT_OP_OUT; + + if (find_cond) { + if (IS_FIND_NOT_EMPTY(option) && s == sstart) { + best_len = REG_MISMATCH; + goto fail; /* for retry */ + } + if (IS_FIND_LONGEST(option) && s < end) { + goto fail; /* for retry */ + } + } + else { + /* default behavior: return first-matching result. */ + goto finish; + } + break; + + case OP_EXACT1: STAT_OP_IN(OP_EXACT1); +#if 0 + DATA_ENSURE(1); + if (*p != *s) goto fail; + p++; s++; +#endif + if (*p != *s++) goto fail; + DATA_ENSURE(0); + p++; + STAT_OP_OUT; + break; + + case OP_EXACT1_IC: STAT_OP_IN(OP_EXACT1_IC); + if (! SBTRANSCMP(*p, *s)) goto fail; + DATA_ENSURE(1); + p++; s++; + STAT_OP_OUT; + break; + + case OP_EXACT2: STAT_OP_IN(OP_EXACT2); + DATA_ENSURE(2); + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + sprev = s; + p++; s++; + STAT_OP_OUT; + continue; + break; + + case OP_EXACT3: STAT_OP_IN(OP_EXACT3); + DATA_ENSURE(3); + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + sprev = s; + p++; s++; + STAT_OP_OUT; + continue; + break; + + case OP_EXACT4: STAT_OP_IN(OP_EXACT4); + DATA_ENSURE(4); + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + sprev = s; + p++; s++; + STAT_OP_OUT; + continue; + break; + + case OP_EXACT5: STAT_OP_IN(OP_EXACT5); + DATA_ENSURE(5); + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + sprev = s; + p++; s++; + STAT_OP_OUT; + continue; + break; + + case OP_EXACTN: STAT_OP_IN(OP_EXACTN); + GET_LENGTH_INC(tlen, p); + DATA_ENSURE(tlen); + while (tlen-- > 0) { + if (*p++ != *s++) goto fail; + } + sprev = s - 1; + STAT_OP_OUT; + continue; + break; + + case OP_EXACTN_IC: STAT_OP_IN(OP_EXACTN_IC); + GET_LENGTH_INC(tlen, p); + DATA_ENSURE(tlen); + while (tlen-- > 0) { + if (! SBTRANSCMP(*p, *s)) goto fail; + p++; s++; + } + sprev = s - 1; + STAT_OP_OUT; + continue; + break; + + case OP_EXACTMB2N1: STAT_OP_IN(OP_EXACTMB2N1); + DATA_ENSURE(2); + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + STAT_OP_OUT; + break; + + case OP_EXACTMB2N2: STAT_OP_IN(OP_EXACTMB2N2); + DATA_ENSURE(4); + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + sprev = s; + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + STAT_OP_OUT; + continue; + break; + + case OP_EXACTMB2N3: STAT_OP_IN(OP_EXACTMB2N3); + DATA_ENSURE(6); + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + sprev = s; + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + STAT_OP_OUT; + continue; + break; + + case OP_EXACTMB2N: STAT_OP_IN(OP_EXACTMB2N); + GET_LENGTH_INC(tlen, p); + DATA_ENSURE(tlen * 2); + while (tlen-- > 0) { + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + } + sprev = s - 2; + STAT_OP_OUT; + continue; + break; + + case OP_EXACTMB3N: STAT_OP_IN(OP_EXACTMB3N); + GET_LENGTH_INC(tlen, p); + DATA_ENSURE(tlen * 3); + while (tlen-- > 0) { + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + if (*p != *s) goto fail; + p++; s++; + } + sprev = s - 3; + STAT_OP_OUT; + continue; + break; + + case OP_EXACTMBN: STAT_OP_IN(OP_EXACTMBN); + GET_LENGTH_INC(tlen, p); /* mb-len */ + GET_LENGTH_INC(tlen2, p); /* string len */ + tlen2 *= tlen; + DATA_ENSURE(tlen2); + while (tlen2-- > 0) { + if (*p != *s) goto fail; + p++; s++; + } + sprev = s - tlen; + STAT_OP_OUT; + continue; + break; + + case OP_CCLASS: STAT_OP_IN(OP_CCLASS); + DATA_ENSURE(1); + if (BITSET_AT(((BitSetRef )p), *s) == 0) goto fail; + p += SIZE_BITSET; + s += mblen(encode, *s); /* OP_CCLASS can match mb-code. \D, \S */ + STAT_OP_OUT; + break; + + case OP_CCLASS_MB: STAT_OP_IN(OP_CCLASS_MB); + if (! ismb(encode, *s)) goto fail; + + cclass_mb: + GET_LENGTH_INC(tlen, p); + { + WCINT wc; + UChar *ss; + int mb_len = mblen(encode, *s); + + DATA_ENSURE(mb_len); + ss = s; + s += mb_len; + wc = MB2WC(ss, s, encode); + +#ifdef UNALIGNED_WORD_ACCESS + if (! regex_is_in_wc_range(p, wc)) goto fail; +#else + q = p; + ALIGNMENT_RIGHT(q); + if (! regex_is_in_wc_range(q, wc)) goto fail; +#endif + } + p += tlen; + STAT_OP_OUT; + break; + + case OP_CCLASS_MIX: STAT_OP_IN(OP_CCLASS_MIX); + DATA_ENSURE(1); + if (ismb(encode, *s)) { + p += SIZE_BITSET; + goto cclass_mb; + } + else { + if (BITSET_AT(((BitSetRef )p), *s) == 0) + goto fail; + + p += SIZE_BITSET; + GET_LENGTH_INC(tlen, p); + p += tlen; + s++; + } + STAT_OP_OUT; + break; + + case OP_CCLASS_NOT: STAT_OP_IN(OP_CCLASS_NOT); + DATA_ENSURE(1); + if (BITSET_AT(((BitSetRef )p), *s) != 0) goto fail; + p += SIZE_BITSET; + s += mblen(encode, *s); + STAT_OP_OUT; + break; + + case OP_CCLASS_MB_NOT: STAT_OP_IN(OP_CCLASS_MB_NOT); + if (! ismb(encode, *s)) { + DATA_ENSURE(1); + s++; + GET_LENGTH_INC(tlen, p); + p += tlen; + goto cc_mb_not_success; + } + + cclass_mb_not: + GET_LENGTH_INC(tlen, p); + { + WCINT wc; + UChar *ss; + int mb_len = mblen(encode, *s); + + if (s + mb_len > end) { + s = end; + p += tlen; + goto cc_mb_not_success; + } + + ss = s; + s += mb_len; + wc = MB2WC(ss, s, encode); + +#ifdef UNALIGNED_WORD_ACCESS + if (regex_is_in_wc_range(p, wc)) goto fail; +#else + q = p; + ALIGNMENT_RIGHT(q); + if (regex_is_in_wc_range(q, wc)) goto fail; +#endif + } + p += tlen; + + cc_mb_not_success: + STAT_OP_OUT; + break; + + case OP_CCLASS_MIX_NOT: STAT_OP_IN(OP_CCLASS_MIX_NOT); + DATA_ENSURE(1); + if (ismb(encode, *s)) { + p += SIZE_BITSET; + goto cclass_mb_not; + } + else { + if (BITSET_AT(((BitSetRef )p), *s) != 0) + goto fail; + + p += SIZE_BITSET; + GET_LENGTH_INC(tlen, p); + p += tlen; + s++; + } + STAT_OP_OUT; + break; + + case OP_ANYCHAR: STAT_OP_IN(OP_ANYCHAR); + DATA_ENSURE(1); + if (ismb(encode, *s)) { + n = mblen(encode, *s); + DATA_ENSURE(n); + s += n; + } + else { + if (! IS_MULTILINE(option)) { + if (IS_NEWLINE(*s)) goto fail; + } + s++; + } + STAT_OP_OUT; + break; + + case OP_ANYCHAR_STAR: STAT_OP_IN(OP_ANYCHAR_STAR); + if (! IS_MULTILINE(option)) { + while (s < end) { + STACK_PUSH_ALT(p, s, sprev); + if (ismb(encode, *s)) { + n = mblen(encode, *s); + DATA_ENSURE(n); + sprev = s; + s += n; + } + else { + if (IS_NEWLINE(*s)) goto fail; + sprev = s; + s++; + } + } + } + else { + while (s < end) { + STACK_PUSH_ALT(p, s, sprev); + if (ismb(encode, *s)) { + n = mblen(encode, *s); + DATA_ENSURE(n); + sprev = s; + s += n; + } + else { + sprev = s; + s++; + } + } + } + STAT_OP_OUT; + break; + + case OP_ANYCHAR_STAR_PEEK_NEXT: STAT_OP_IN(OP_ANYCHAR_STAR_PEEK_NEXT); + while (s < end) { + if (*p == *s) { + STACK_PUSH_ALT(p + 1, s, sprev); + } + if (ismb(encode, *s)) { + n = mblen(encode, *s); + DATA_ENSURE(n); + sprev = s; + s += n; + } + else { + if (! IS_MULTILINE(option)) { + if (IS_NEWLINE(*s)) goto fail; + } + sprev = s; + s++; + } + } + p++; + STAT_OP_OUT; + break; + + case OP_WORD: STAT_OP_IN(OP_WORD); + DATA_ENSURE(1); + if (! IS_WORD_STR_INC(encode, s, end)) + goto fail; + STAT_OP_OUT; + break; + + case OP_NOT_WORD: STAT_OP_IN(OP_NOT_WORD); + DATA_ENSURE(1); + if (IS_WORD_STR_INC(encode, s, end)) + goto fail; + STAT_OP_OUT; + break; + +#ifdef USE_SBMB_CLASS + case OP_WORD_SB: STAT_OP_IN(OP_WORD_SB); + DATA_ENSURE(1); + if (! IS_SB_WORD(encode, *s)) + goto fail; + s++; + STAT_OP_OUT; + break; + + case OP_WORD_MB: STAT_OP_IN(OP_WORD_MB); + DATA_ENSURE(1); + if (! IS_MB_WORD(encode, *s)) + goto fail; + + n = mblen(encode, *s); + DATA_ENSURE(n); + s += n; + STAT_OP_OUT; + break; +#endif + + case OP_WORD_BOUND: STAT_OP_IN(OP_WORD_BOUND); + if (ON_STR_BEGIN(s)) { + DATA_ENSURE(1); + if (! IS_WORD_STR(encode, s, end)) + goto fail; + } + else if (ON_STR_END(s)) { + if (! IS_WORD_STR(encode, sprev, end)) + goto fail; + } + else { + if (IS_WORD_STR(encode, s, end) == IS_WORD_STR(encode, sprev, end)) + goto fail; + } + STAT_OP_OUT; + continue; + break; + + case OP_NOT_WORD_BOUND: STAT_OP_IN(OP_NOT_WORD_BOUND); + if (ON_STR_BEGIN(s)) { + if (DATA_ENSURE_CHECK(1) && IS_WORD_STR(encode, s, end)) + goto fail; + } + else if (ON_STR_END(s)) { + if (IS_WORD_STR(encode, sprev, end)) + goto fail; + } + else { + if (IS_WORD_STR(encode, s, end) != IS_WORD_STR(encode, sprev, end)) + goto fail; + } + STAT_OP_OUT; + continue; + break; + +#ifdef USE_WORD_BEGIN_END + case OP_WORD_BEGIN: STAT_OP_IN(OP_WORD_BEGIN); + if (DATA_ENSURE_CHECK(1) && IS_WORD_STR(encode, s, end)) { + if (ON_STR_BEGIN(s) || !IS_WORD_STR(encode, sprev, end)) { + STAT_OP_OUT; + continue; + } + } + goto fail; + break; + + case OP_WORD_END: STAT_OP_IN(OP_WORD_END); + if (!ON_STR_BEGIN(s) && IS_WORD_STR(encode, sprev, end)) { + if (ON_STR_END(s) || !IS_WORD_STR(encode, s, end)) { + STAT_OP_OUT; + continue; + } + } + goto fail; + break; +#endif + + case OP_BEGIN_BUF: STAT_OP_IN(OP_BEGIN_BUF); + if (! ON_STR_BEGIN(s)) goto fail; + + STAT_OP_OUT; + continue; + break; + + case OP_END_BUF: STAT_OP_IN(OP_END_BUF); + if (! ON_STR_END(s)) goto fail; + + STAT_OP_OUT; + continue; + break; + + case OP_BEGIN_LINE: STAT_OP_IN(OP_BEGIN_LINE); + if (ON_STR_BEGIN(s)) { + if (IS_NOTBOL(msa->options)) goto fail; + STAT_OP_OUT; + continue; + } + else if (IS_NEWLINE(*sprev) && !ON_STR_END(s)) { + STAT_OP_OUT; + continue; + } + goto fail; + break; + + case OP_END_LINE: STAT_OP_IN(OP_END_LINE); + if (ON_STR_END(s)) { +#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE + if (IS_EMPTY_STR || !IS_NEWLINE(*sprev)) { +#endif + if (IS_NOTEOL(msa->options)) goto fail; + STAT_OP_OUT; + continue; +#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE + } +#endif + } + else if (IS_NEWLINE(*s)) { + STAT_OP_OUT; + continue; + } + goto fail; + break; + + case OP_SEMI_END_BUF: STAT_OP_IN(OP_SEMI_END_BUF); + if (ON_STR_END(s)) { +#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE + if (IS_EMPTY_STR || !IS_NEWLINE(*sprev)) { +#endif + if (IS_NOTEOL(msa->options)) goto fail; /* Is it needed? */ + STAT_OP_OUT; + continue; +#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE + } +#endif + } + if (IS_NEWLINE(*s) && ON_STR_END(s+1)) { + STAT_OP_OUT; + continue; + } + goto fail; + break; + + case OP_BEGIN_POSITION: STAT_OP_IN(OP_BEGIN_POSITION); + if (s != msa->start) + goto fail; + + STAT_OP_OUT; + continue; + break; + + case OP_MEMORY_START_PUSH: STAT_OP_IN(OP_MEMORY_START_PUSH); + GET_MEMNUM_INC(mem, p); + STACK_PUSH_MEM_START(mem, s); + STAT_OP_OUT; + continue; + break; + + case OP_MEMORY_START: STAT_OP_IN(OP_MEMORY_START); + GET_MEMNUM_INC(mem, p); + mem_start_stk[mem] = (StackIndex )((void* )s); + STAT_OP_OUT; + continue; + break; + + case OP_MEMORY_END_PUSH: STAT_OP_IN(OP_MEMORY_END_PUSH); + GET_MEMNUM_INC(mem, p); + STACK_PUSH_MEM_END(mem, s); + STAT_OP_OUT; + continue; + break; + + case OP_MEMORY_END: STAT_OP_IN(OP_MEMORY_END); + GET_MEMNUM_INC(mem, p); + mem_end_stk[mem] = (StackIndex )((void* )s); + STAT_OP_OUT; + continue; + break; + +#ifdef USE_SUBEXP_CALL + case OP_MEMORY_END_PUSH_REC: STAT_OP_IN(OP_MEMORY_END_PUSH_REC); + GET_MEMNUM_INC(mem, p); + STACK_GET_MEM_START(mem, stkp); + mem_start_stk[mem] = GET_STACK_INDEX(stkp); + STACK_PUSH_MEM_END(mem, s); + STAT_OP_OUT; + continue; + break; + + case OP_MEMORY_END_REC: STAT_OP_IN(OP_MEMORY_END_REC); + GET_MEMNUM_INC(mem, p); + mem_end_stk[mem] = (StackIndex )((void* )s); + STACK_GET_MEM_START(mem, stkp); + mem_start_stk[mem] = GET_STACK_INDEX(stkp); + STACK_PUSH_MEM_END_MARK(mem); + STAT_OP_OUT; + continue; + break; +#endif + + case OP_BACKREF1: STAT_OP_IN(OP_BACKREF1); + mem = 1; + goto backref; + break; + + case OP_BACKREF2: STAT_OP_IN(OP_BACKREF2); + mem = 2; + goto backref; + break; + + case OP_BACKREF3: STAT_OP_IN(OP_BACKREF3); + mem = 3; + goto backref; + break; + + case OP_BACKREFN: STAT_OP_IN(OP_BACKREFN); + GET_MEMNUM_INC(mem, p); + backref: + { + int len; + UChar *pstart, *pend; + + /* if you want to remove following line, + you should check in parse and compile time. */ + if (mem > num_mem) goto fail; + if (mem_end_stk[mem] == INVALID_STACK_INDEX) goto fail; + if (mem_start_stk[mem] == INVALID_STACK_INDEX) goto fail; + + if (BIT_STATUS_AT(reg->backtrack_mem, mem)) + pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr; + else + pstart = (UChar* )((void* )mem_start_stk[mem]); + + pend = (find_cond != 0 + ? STACK_AT(mem_end_stk[mem])->u.mem.pstr + : (UChar* )((void* )mem_end_stk[mem])); + n = pend - pstart; + DATA_ENSURE(n); + sprev = s; + STRING_CMP(pstart, s, n); + while (sprev + (len = mblen(encode, *sprev)) < s) + sprev += len; + + STAT_OP_OUT; + continue; + } + break; + + case OP_BACKREF_MULTI: STAT_OP_IN(OP_BACKREF_MULTI); + { + int len, is_fail; + UChar *pstart, *pend, *swork; + + GET_LENGTH_INC(tlen, p); + for (i = 0; i < tlen; i++) { + GET_MEMNUM_INC(mem, p); + + if (mem_end_stk[mem] == INVALID_STACK_INDEX) continue; + if (mem_start_stk[mem] == INVALID_STACK_INDEX) continue; + + if (BIT_STATUS_AT(reg->backtrack_mem, mem)) + pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr; + else + pstart = (UChar* )((void* )mem_start_stk[mem]); + + pend = (find_cond != 0 + ? STACK_AT(mem_end_stk[mem])->u.mem.pstr + : (UChar* )((void* )mem_end_stk[mem])); + n = pend - pstart; + DATA_ENSURE(n); + sprev = s; + swork = s; + STRING_CMP_VALUE(pstart, swork, n, is_fail); + if (is_fail) continue; + s = swork; + while (sprev + (len = mblen(encode, *sprev)) < s) + sprev += len; + + p += (SIZE_MEMNUM * (tlen - i - 1)); + break; /* success */ + } + if (i == tlen) goto fail; + STAT_OP_OUT; + continue; + } + break; + + case OP_SET_OPTION_PUSH: STAT_OP_IN(OP_SET_OPTION_PUSH); + GET_OPTION_INC(option, p); + ignore_case = IS_IGNORECASE(option); + STACK_PUSH_ALT(p, s, sprev); + p += SIZE_OP_SET_OPTION + SIZE_OP_FAIL; + STAT_OP_OUT; + continue; + break; + + case OP_SET_OPTION: STAT_OP_IN(OP_SET_OPTION); + GET_OPTION_INC(option, p); + ignore_case = IS_IGNORECASE(option); + STAT_OP_OUT; + continue; + break; + + case OP_NULL_CHECK_START: STAT_OP_IN(OP_NULL_CHECK_START); + GET_MEMNUM_INC(mem, p); /* mem: null check id */ + STACK_PUSH_NULL_CHECK_START(mem, s); + STAT_OP_OUT; + continue; + break; + + case OP_NULL_CHECK_END: STAT_OP_IN(OP_NULL_CHECK_END); + { + int isnull; + + GET_MEMNUM_INC(mem, p); /* mem: null check id */ + STACK_NULL_CHECK(isnull, mem, s); + if (isnull) { +#ifdef REG_DEBUG_MATCH + fprintf(stderr, "NULL_CHECK_END: skip id:%d, s:%d\n", + (int )mem, (int )s); +#endif + /* empty loop founded, skip next instruction */ + switch (*p++) { + case OP_JUMP: + case OP_PUSH: + p += SIZE_RELADDR; + break; + case OP_REPEAT_INC: + case OP_REPEAT_INC_NG: + p += SIZE_MEMNUM; + break; + default: + goto unexpected_bytecode_error; + break; + } + } + } + STAT_OP_OUT; + continue; + break; + + case OP_JUMP: STAT_OP_IN(OP_JUMP); + GET_RELADDR_INC(addr, p); + p += addr; + STAT_OP_OUT; + continue; + break; + + case OP_PUSH: STAT_OP_IN(OP_PUSH); + GET_RELADDR_INC(addr, p); + STACK_PUSH_ALT(p + addr, s, sprev); + STAT_OP_OUT; + continue; + break; + + case OP_POP: STAT_OP_IN(OP_POP); + STACK_POP_ONE; + STAT_OP_OUT; + continue; + break; + + case OP_PUSH_OR_JUMP_EXACT1: STAT_OP_IN(OP_PUSH_OR_JUMP_EXACT1); + GET_RELADDR_INC(addr, p); + if (*p == *s && DATA_ENSURE_CHECK(1)) { + p++; + STACK_PUSH_ALT(p + addr, s, sprev); + STAT_OP_OUT; + continue; + } + p += (addr + 1); + STAT_OP_OUT; + continue; + break; + + case OP_PUSH_IF_PEEK_NEXT: STAT_OP_IN(OP_PUSH_IF_PEEK_NEXT); + GET_RELADDR_INC(addr, p); + if (*p == *s) { + p++; + STACK_PUSH_ALT(p + addr, s, sprev); + STAT_OP_OUT; + continue; + } + p++; + STAT_OP_OUT; + continue; + break; + + case OP_REPEAT: STAT_OP_IN(OP_REPEAT); + { + GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */ + GET_RELADDR_INC(addr, p); + + STACK_ENSURE(1); + repeat_stk[mem] = GET_STACK_INDEX(stk); + STACK_PUSH_REPEAT(mem, p); + + if (reg->repeat_range[mem].lower == 0) { + STACK_PUSH_ALT(p + addr, s, sprev); + } + } + STAT_OP_OUT; + continue; + break; + + case OP_REPEAT_NG: STAT_OP_IN(OP_REPEAT_NG); + { + GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */ + GET_RELADDR_INC(addr, p); + + STACK_ENSURE(1); + repeat_stk[mem] = GET_STACK_INDEX(stk); + STACK_PUSH_REPEAT(mem, p); + + if (reg->repeat_range[mem].lower == 0) { + STACK_PUSH_ALT(p, s, sprev); + p += addr; + } + } + STAT_OP_OUT; + continue; + break; + + case OP_REPEAT_INC: STAT_OP_IN(OP_REPEAT_INC); + { + StackIndex si; + + GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */ +#ifdef USE_SUBEXP_CALL + if (reg->num_call > 0) { + STACK_GET_REPEAT(mem, stkp); + si = GET_STACK_INDEX(stkp); + } + else { + si = repeat_stk[mem]; + stkp = STACK_AT(si); + } +#else + si = repeat_stk[mem]; + stkp = STACK_AT(si); +#endif + stkp->u.repeat.count++; + if (stkp->u.repeat.count == reg->repeat_range[mem].upper) { + /* end of repeat. Nothing to do. */ + } + else if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) { + STACK_PUSH_ALT(p, s, sprev); + p = stkp->u.repeat.pcode; + } + else { + p = stkp->u.repeat.pcode; + } + STACK_PUSH_REPEAT_INC(si); + } + STAT_OP_OUT; + continue; + break; + + case OP_REPEAT_INC_NG: STAT_OP_IN(OP_REPEAT_INC_NG); + { + StackIndex si; + + GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */ +#ifdef USE_SUBEXP_CALL + if (reg->num_call > 0) { + STACK_GET_REPEAT(mem, stkp); + si = GET_STACK_INDEX(stkp); + } + else { + si = repeat_stk[mem]; + stkp = STACK_AT(si); + } +#else + si = repeat_stk[mem]; + stkp = STACK_AT(si); +#endif + stkp->u.repeat.count++; + if (stkp->u.repeat.count == reg->repeat_range[mem].upper) { + /* end of repeat. Nothing to do. */ + } + else if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) { + STACK_PUSH_ALT(stkp->u.repeat.pcode, s, sprev); + } + else { + p = stkp->u.repeat.pcode; + } + STACK_PUSH_REPEAT_INC(si); + } + STAT_OP_OUT; + continue; + break; + + case OP_PUSH_POS: STAT_OP_IN(OP_PUSH_POS); + STACK_PUSH_POS(s, sprev); + STAT_OP_OUT; + continue; + break; + + case OP_POP_POS: STAT_OP_IN(OP_POP_POS); + { + STACK_POS_END(stkp); + s = stkp->u.state.pstr; + sprev = stkp->u.state.pstr_prev; + } + STAT_OP_OUT; + continue; + break; + + case OP_PUSH_POS_NOT: STAT_OP_IN(OP_PUSH_POS_NOT); + GET_RELADDR_INC(addr, p); + STACK_PUSH_POS_NOT(p + addr, s, sprev); + STAT_OP_OUT; + continue; + break; + + case OP_FAIL_POS: STAT_OP_IN(OP_FAIL_POS); + STACK_POP_TIL_POS_NOT; + goto fail; + break; + + case OP_PUSH_STOP_BT: STAT_OP_IN(OP_PUSH_STOP_BT); + STACK_PUSH_STOP_BT; + STAT_OP_OUT; + continue; + break; + + case OP_POP_STOP_BT: STAT_OP_IN(OP_POP_STOP_BT); + STACK_STOP_BT_END; + STAT_OP_OUT; + continue; + break; + + case OP_LOOK_BEHIND: STAT_OP_IN(OP_LOOK_BEHIND); + GET_LENGTH_INC(tlen, p); + s = MBBACK(encode, str, s, (int )tlen); + if (IS_NULL(s)) goto fail; + sprev = regex_get_prev_char_head(encode, str, s); + STAT_OP_OUT; + continue; + break; + + case OP_PUSH_LOOK_BEHIND_NOT: STAT_OP_IN(OP_PUSH_LOOK_BEHIND_NOT); + GET_RELADDR_INC(addr, p); + GET_LENGTH_INC(tlen, p); + q = MBBACK(encode, str, s, (int )tlen); + if (IS_NULL(q)) { + /* too short case -> success. ex. /(?<!XXX)a/.match("a") + If you want to change to fail, replace following line. */ + p += addr; + /* goto fail; */ + } + else { + STACK_PUSH_LOOK_BEHIND_NOT(p + addr, s, sprev); + s = q; + sprev = regex_get_prev_char_head(encode, str, s); + } + STAT_OP_OUT; + continue; + break; + + case OP_FAIL_LOOK_BEHIND_NOT: STAT_OP_IN(OP_FAIL_LOOK_BEHIND_NOT); + STACK_POP_TIL_LOOK_BEHIND_NOT; + goto fail; + break; + +#ifdef USE_SUBEXP_CALL + case OP_CALL: STAT_OP_IN(OP_CALL); + GET_ABSADDR_INC(addr, p); + STACK_PUSH_CALL_FRAME(p); + p = reg->p + addr; + STAT_OP_OUT; + continue; + break; + + case OP_RETURN: STAT_OP_IN(OP_RETURN); + STACK_RETURN(p); + STACK_PUSH_RETURN; + STAT_OP_OUT; + continue; + break; +#endif + + case OP_FINISH: + goto finish; + break; + + fail: + STAT_OP_OUT; + /* fall */ + case OP_FAIL: STAT_OP_IN(OP_FAIL); + STACK_POP; + p = stk->u.state.pcode; + s = stk->u.state.pstr; + sprev = stk->u.state.pstr_prev; + STAT_OP_OUT; + continue; + break; + + default: + goto bytecode_error; + + } /* end of switch */ + sprev = sbegin; + } /* end of while(1) */ + + finish: + STACK_SAVE; + return best_len; + +#ifdef REG_DEBUG + stack_error: + STACK_SAVE; + return REGERR_STACK_BUG; +#endif + + bytecode_error: + STACK_SAVE; + return REGERR_UNDEFINED_BYTECODE; + + unexpected_bytecode_error: + STACK_SAVE; + return REGERR_UNEXPECTED_BYTECODE; +} + + +UChar* DefaultTransTable = (UChar* )0; + +#ifndef REG_RUBY_M17N +static const char SJIS_FOLLOW_TABLE[SINGLE_BYTE_SIZE] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 +}; + +#define eucjp_islead(c) ((UChar )((c) - 0xa1) > 0xfe - 0xa1) +#define utf8_islead(c) ((UChar )((c) & 0xc0) != 0x80) +#define sjis_ismbfirst(c) ismb(REGCODE_SJIS, (c)) +#define sjis_ismbtrail(c) SJIS_FOLLOW_TABLE[(c)] + +extern WCINT +regex_mb2wc(UChar* p, UChar* end, RegCharEncoding code) +{ + int c, i, len; + WCINT n; + + if (code == REGCODE_UTF8) { + c = *p++; + len = mblen(code,c); + if (len > 1) { + len--; + n = c & ((1 << (6 - len)) - 1); + while (len--) { + c = *p++; + n = (n << 6) | (c & ((1 << 6) - 1)); + } + } + else + n = c; + } + else { + c = *p++; + len = mblen(code,c); + n = c; + if (len == 1) return n; + + for (i = 1; i < len; i++) { + if (p >= end) break; + c = *p++; + n <<= 8; n += c; + } + } + return n; +} +#endif /* REG_RUBY_M17N */ + +extern UChar* +regex_get_left_adjust_char_head(RegCharEncoding code, UChar* start, UChar* s) +{ + UChar *p; + int len; + + if (s <= start) return s; + p = s; + +#ifdef REG_RUBY_M17N + while (!m17n_islead(code, *p) && p > start) p--; + while (p + (len = mblen(code, *p)) < s) { + p += len; + } + if (p + len == s) return s; + return p; +#else + + if (code == REGCODE_ASCII) { + return p; + } + else if (code == REGCODE_EUCJP) { + while (!eucjp_islead(*p) && p > start) p--; + len = mblen(code, *p); + if (p + len > s) return p; + p += len; + return p + ((s - p) & ~1); + } + else if (code == REGCODE_SJIS) { + if (sjis_ismbtrail(*p)) { + while (p > start) { + if (! sjis_ismbfirst(*--p)) { + p++; + break; + } + } + } + len = mblen(code, *p); + if (p + len > s) return p; + p += len; + return p + ((s - p) & ~1); + } + else { /* REGCODE_UTF8 */ + while (!utf8_islead(*p) && p > start) p--; + return p; + } +#endif /* REG_RUBY_M17N */ +} + +extern UChar* +regex_get_right_adjust_char_head(RegCharEncoding code, UChar* start, UChar* s) +{ + UChar* p = regex_get_left_adjust_char_head(code, start, s); + + if (p < s) { + p += mblen(code, *p); + } + return p; +} + +static UChar* +get_right_adjust_char_head_with_prev(RegCharEncoding code, + UChar* start, UChar* s, UChar** prev) +{ + UChar* p = regex_get_left_adjust_char_head(code, start, s); + + if (p < s) { + if (prev) *prev = p; + p += mblen(code, *p); + } + else { + if (prev) *prev = (UChar* )NULL; /* Sorry */ + } + return p; +} + +extern UChar* +regex_get_prev_char_head(RegCharEncoding code, UChar* start, UChar* s) +{ + if (s <= start) + return (UChar* )NULL; + + return regex_get_left_adjust_char_head(code, start, s - 1); +} + +static UChar* +step_backward_char(RegCharEncoding code, UChar* start, UChar* s, int n) +{ + while (IS_NOT_NULL(s) && n-- > 0) { + if (s <= start) + return (UChar* )NULL; + + s = regex_get_left_adjust_char_head(code, start, s - 1); + } + return s; +} + +static UChar* +slow_search(RegCharEncoding code, UChar* target, UChar* target_end, + UChar* text, UChar* text_end, UChar* text_range) +{ + UChar *t, *p, *s, *end; + + end = text_end - (target_end - target) + 1; + if (end > text_range) + end = text_range; + + s = text; + + while (s < end) { + if (*s == *target) { + p = s + 1; + t = target + 1; + while (t < target_end) { + if (*t != *p++) + break; + t++; + } + if (t == target_end) + return s; + } + s += mblen(code, *s); + } + + return (UChar* )NULL; +} + +static int +str_trans_match_after_head_byte(RegCharEncoding code, + int len, UChar* t, UChar* tend, UChar* p) +{ + while (--len > 0) { + if (*t != *p) break; + t++; p++; + } + + if (len == 0) { + while (t < tend) { + len = mblen(code, *p); + if (len == 1) { + if (*t != TOLOWER(code, *p)) + break; + p++; + t++; + } + else { + if (*t != *p++) break; + t++; + while (--len > 0) { + if (*t != *p) break; + t++; p++; + } + if (len > 0) break; + } + } + if (t == tend) + return 1; + } + + return 0; +} + +static UChar* +slow_search_ic(RegCharEncoding code, + UChar* target, UChar* target_end, + UChar* text, UChar* text_end, UChar* text_range) +{ + int len; + UChar *t, *p, *s, *end; + + end = text_end - (target_end - target) + 1; + if (end > text_range) + end = text_range; + + s = text; + + while (s < end) { + len = mblen(code, *s); + if (*s == *target || (len == 1 && TOLOWER(code, *s) == *target)) { + p = s + 1; + t = target + 1; + if (str_trans_match_after_head_byte(code, len, t, target_end, p)) + return s; + } + s += len; + } + + return (UChar* )NULL; +} + +static UChar* +slow_search_backward(RegCharEncoding code, UChar* target, UChar* target_end, + UChar* text, UChar* adjust_text, UChar* text_end, UChar* text_start) +{ + UChar *t, *p, *s; + + s = text_end - (target_end - target); + if (s > text_start) + s = text_start; + else + s = regex_get_left_adjust_char_head(code, adjust_text, s); + + while (s >= text) { + if (*s == *target) { + p = s + 1; + t = target + 1; + while (t < target_end) { + if (*t != *p++) + break; + t++; + } + if (t == target_end) + return s; + } + s = regex_get_prev_char_head(code, adjust_text, s); + } + + return (UChar* )NULL; +} + +static UChar* +slow_search_backward_ic(RegCharEncoding code, + UChar* target,UChar* target_end, + UChar* text, UChar* adjust_text, + UChar* text_end, UChar* text_start) +{ + int len; + UChar *t, *p, *s; + + s = text_end - (target_end - target); + if (s > text_start) + s = text_start; + else + s = regex_get_left_adjust_char_head(code, adjust_text, s); + + while (s >= text) { + len = mblen(code, *s); + if (*s == *target || (len == 1 && TOLOWER(code, *s) == *target)) { + p = s + 1; + t = target + 1; + if (str_trans_match_after_head_byte(code, len, t, target_end, p)) + return s; + } + s = regex_get_prev_char_head(code, adjust_text, s); + } + + return (UChar* )NULL; +} + +static UChar* +bm_search_notrev(regex_t* reg, UChar* target, UChar* target_end, + UChar* text, UChar* text_end, UChar* text_range) +{ + UChar *s, *t, *p, *end; + UChar *tail; + int skip; + + end = text_range + (target_end - target) - 1; + if (end > text_end) + end = text_end; + + tail = target_end - 1; + s = text; + while ((s - text) < target_end - target) { + s += mblen(reg->enc, *s); + } + s--; /* set to text check tail position. */ + + if (IS_NULL(reg->int_map)) { + while (s < end) { + p = s; + t = tail; + while (t >= target && *p == *t) { + p--; t--; + } + if (t < target) return p + 1; + + skip = reg->map[*s]; + p++; + t = p; + while ((p - t) < skip) { + p += mblen(reg->enc, *p); + } + s += (p - t); + } + } + else { + while (s < end) { + p = s; + t = tail; + while (t >= target && *p == *t) { + p--; t--; + } + if (t < target) return p + 1; + + skip = reg->int_map[*s]; + p++; + t = p; + while ((p - t) < skip) { + p += mblen(reg->enc, *p); + } + s += (p - t); + } + } + return (UChar* )NULL; +} + +static UChar* +bm_search(regex_t* reg, UChar* target, UChar* target_end, + UChar* text, UChar* text_end, UChar* text_range) +{ + UChar *s, *t, *p, *end; + UChar *tail; + + end = text_range + (target_end - target) - 1; + if (end > text_end) + end = text_end; + + tail = target_end - 1; + s = text + (target_end - target) - 1; + if (IS_NULL(reg->int_map)) { + while (s < end) { + p = s; + t = tail; + while (t >= target && *p == *t) { + p--; t--; + } + if (t < target) return p + 1; + s += reg->map[*s]; + } + } + else { /* see int_map[] */ + while (s < end) { + p = s; + t = tail; + while (t >= target && *p == *t) { + p--; t--; + } + if (t < target) return p + 1; + s += reg->int_map[*s]; + } + } + return (UChar* )NULL; +} + +static int +set_bm_backward_skip(UChar* s, UChar* end, RegCharEncoding enc, + int ignore_case, int** skip) +{ + int i, len; + + if (IS_NULL(*skip)) { + *skip = (int* )xmalloc(sizeof(int) * REG_CHAR_TABLE_SIZE); + if (IS_NULL(*skip)) return REGERR_MEMORY; + } + + len = end - s; + for (i = 0; i < REG_CHAR_TABLE_SIZE; i++) + (*skip)[i] = len; + + if (ignore_case) { + for (i = len - 1; i > 0; i--) + (*skip)[TOLOWER(enc, s[i])] = i; + } + else { + for (i = len - 1; i > 0; i--) + (*skip)[s[i]] = i; + } + return 0; +} + +static UChar* +bm_search_backward(regex_t* reg, UChar* target, UChar* target_end, UChar* text, + UChar* adjust_text, UChar* text_end, UChar* text_start) +{ + UChar *s, *t, *p; + + s = text_end - (target_end - target); + if (text_start < s) + s = text_start; + else + s = regex_get_left_adjust_char_head(reg->enc, adjust_text, s); + + while (s >= text) { + p = s; + t = target; + while (t < target_end && *p == *t) { + p++; t++; + } + if (t == target_end) + return s; + + s -= reg->int_map_backward[*s]; + s = regex_get_left_adjust_char_head(reg->enc, adjust_text, s); + } + + return (UChar* )NULL; +} + +static UChar* +map_search(RegCharEncoding code, UChar map[], UChar* text, UChar* text_range) +{ + UChar *s = text; + + while (s < text_range) { + if (map[*s]) return s; + + s += mblen(code, *s); + } + return (UChar* )NULL; +} + +static UChar* +map_search_backward(RegCharEncoding code, UChar map[], + UChar* text, UChar* adjust_text, UChar* text_start) +{ + UChar *s = text_start; + + while (s >= text) { + if (map[*s]) return s; + + s = regex_get_prev_char_head(code, adjust_text, s); + } + return (UChar* )NULL; +} + +extern int +regex_match(regex_t* reg, UChar* str, UChar* end, UChar* at, RegRegion* region, + RegOptionType option) +{ + int r; + UChar *prev; + MatchArg msa; + + MATCH_ARG_INIT(msa, option, region, at); + + if (region && !IS_POSIX_REGION(option)) + r = regex_region_resize(region, reg->num_mem + 1); + else + r = 0; + + if (r == 0) { + prev = regex_get_prev_char_head(reg->enc, str, at); + r = match_at(reg, str, end, at, prev, &msa); + } + MATCH_ARG_FREE(msa); + return r; +} + +static int +forward_search_range(regex_t* reg, UChar* str, UChar* end, UChar* s, + UChar* range, UChar** low, UChar** high, UChar** low_prev) +{ + UChar *p, *pprev = (UChar* )NULL; + +#ifdef REG_DEBUG_SEARCH + fprintf(stderr, "forward_search_range: str: %d, end: %d, s: %d, range: %d\n", + (int )str, (int )end, (int )s, (int )range); +#endif + + p = s; + if (reg->dmin > 0) { + if (IS_SINGLEBYTE_CODE(reg->enc)) { + p += reg->dmin; + } + else { + UChar *q = p + reg->dmin; + while (p < q) p += mblen(reg->enc, *p); + } + } + + retry: + switch (reg->optimize) { + case REG_OPTIMIZE_EXACT: + p = slow_search(reg->enc, reg->exact, reg->exact_end, p, end, range); + break; + case REG_OPTIMIZE_EXACT_IC: + p = slow_search_ic(reg->enc, reg->exact, reg->exact_end, p, end, range); + break; + + case REG_OPTIMIZE_EXACT_BM: + p = bm_search(reg, reg->exact, reg->exact_end, p, end, range); + break; + + case REG_OPTIMIZE_EXACT_BM_NOT_REV: + p = bm_search_notrev(reg, reg->exact, reg->exact_end, p, end, range); + break; + + case REG_OPTIMIZE_MAP: + p = map_search(reg->enc, reg->map, p, range); + break; + } + + if (p && p < range) { + if (p - reg->dmin < s) { + retry_gate: + pprev = p; + p += mblen(reg->enc, *p); + goto retry; + } + + if (reg->sub_anchor) { + UChar* prev; + + switch (reg->sub_anchor) { + case ANCHOR_BEGIN_LINE: + if (!ON_STR_BEGIN(p)) { + prev = regex_get_prev_char_head(reg->enc, (pprev ? pprev : str), p); + if (!IS_NEWLINE(*prev)) + goto retry_gate; + } + break; + + case ANCHOR_END_LINE: + if (ON_STR_END(p)) { + prev = regex_get_prev_char_head(reg->enc, (pprev ? pprev : str), p); + if (prev && IS_NEWLINE(*prev)) + goto retry_gate; + } + else if (!IS_NEWLINE(*p)) + goto retry_gate; + break; + } + } + + if (reg->dmax == 0) { + *low = p; + if (low_prev) { + if (*low > s) + *low_prev = regex_get_prev_char_head(reg->enc, s, p); + else + *low_prev = regex_get_prev_char_head(reg->enc, + (pprev ? pprev : str), p); + } + } + else { + if (reg->dmax != INFINITE_DISTANCE) { + *low = p - reg->dmax; + if (*low > s) { + *low = get_right_adjust_char_head_with_prev(reg->enc, s, + *low, low_prev); + if (low_prev && IS_NULL(*low_prev)) + *low_prev = regex_get_prev_char_head(reg->enc, + (pprev ? pprev : s), *low); + } + else { + if (low_prev) + *low_prev = regex_get_prev_char_head(reg->enc, + (pprev ? pprev : str), *low); + } + } + } + /* no needs to adjust *high, *high is used as range check only */ + *high = p - reg->dmin; + +#ifdef REG_DEBUG_SEARCH + fprintf(stderr, + "forward_search_range success: low: %d, high: %d, dmin: %d, dmax: %d\n", + (int )(*low - str), (int )(*high - str), reg->dmin, reg->dmax); +#endif + return 1; /* success */ + } + + return 0; /* fail */ +} + +static int set_bm_backward_skip P_((UChar* s, UChar* end, RegCharEncoding enc, + int ignore_case, int** skip)); + +#define BM_BACKWARD_SEARCH_LENGTH_THRESHOLD 100 + +static int +backward_search_range(regex_t* reg, UChar* str, UChar* end, UChar* s, + UChar* range, UChar* adjrange, UChar** low, UChar** high) +{ + int r; + UChar *p; + + range += reg->dmin; + p = s; + + retry: + switch (reg->optimize) { + case REG_OPTIMIZE_EXACT: + exact_method: + p = slow_search_backward(reg->enc, reg->exact, reg->exact_end, + range, adjrange, end, p); + break; + + case REG_OPTIMIZE_EXACT_IC: + p = slow_search_backward_ic(reg->enc, reg->exact, + reg->exact_end, range, adjrange, end, p); + break; + + case REG_OPTIMIZE_EXACT_BM: + case REG_OPTIMIZE_EXACT_BM_NOT_REV: + if (IS_NULL(reg->int_map_backward)) { + if (s - range < BM_BACKWARD_SEARCH_LENGTH_THRESHOLD) + goto exact_method; + + r = set_bm_backward_skip(reg->exact, reg->exact_end, reg->enc, 0, + &(reg->int_map_backward)); + if (r) return r; + } + p = bm_search_backward(reg, reg->exact, reg->exact_end, range, adjrange, + end, p); + break; + + case REG_OPTIMIZE_MAP: + p = map_search_backward(reg->enc, reg->map, range, adjrange, p); + break; + } + + if (p) { + if (reg->sub_anchor) { + UChar* prev; + + switch (reg->sub_anchor) { + case ANCHOR_BEGIN_LINE: + if (!ON_STR_BEGIN(p)) { + prev = regex_get_prev_char_head(reg->enc, adjrange, p); + if (!IS_NEWLINE(*prev)) { + p = prev; + goto retry; + } + } + break; + + case ANCHOR_END_LINE: + if (ON_STR_END(p)) { + prev = regex_get_prev_char_head(reg->enc, adjrange, p); + if (IS_NULL(prev)) goto fail; + if (IS_NEWLINE(*prev)) { + p = prev; + goto retry; + } + } + else if (!IS_NEWLINE(*p)) { + p = regex_get_prev_char_head(reg->enc, adjrange, p); + if (IS_NULL(p)) goto fail; + goto retry; + } + break; + } + } + + /* no needs to adjust *high, *high is used as range check only */ + if (reg->dmax != INFINITE_DISTANCE) { + *low = p - reg->dmax; + *high = p - reg->dmin; + *high = regex_get_right_adjust_char_head(reg->enc, adjrange, *high); + } + +#ifdef REG_DEBUG_SEARCH + fprintf(stderr, "backward_search_range: low: %d, high: %d\n", + (int )(*low - str), (int )(*high - str)); +#endif + return 1; /* success */ + } + + fail: +#ifdef REG_DEBUG_SEARCH + fprintf(stderr, "backward_search_range: fail.\n"); +#endif + return 0; /* fail */ +} + + +extern int +regex_search(regex_t* reg, UChar* str, UChar* end, + UChar* start, UChar* range, RegRegion* region, RegOptionType option) +{ + int r; + UChar *s, *prev; + MatchArg msa; + + if (REG_STATE(reg) == REG_STATE_NORMAL) { + reg->state++; /* increment as search counter */ + if (IS_NOT_NULL(reg->chain)) { + regex_chain_reduce(reg); + reg->state++; + } + } + else { + int n = 0; + while (REG_STATE(reg) < REG_STATE_NORMAL) { + if (++n > THREAD_PASS_LIMIT_COUNT) + return REGERR_OVER_THREAD_PASS_LIMIT_COUNT; + THREAD_PASS; + } + reg->state++; /* increment as search counter */ + } + +#ifdef REG_DEBUG_SEARCH + fprintf(stderr, "regex_search (entry point): str: %d, end: %d, start: %d, range: %d\n", + (int )str, (int )(end - str), (int )(start - str), (int )(range - str)); +#endif + + if (region && !IS_POSIX_REGION(option)) { + r = regex_region_resize(region, reg->num_mem + 1); + if (r) goto finish_no_msa; + } + + if (start > end || start < str) goto mismatch_no_msa; + +#define MATCH_AND_RETURN_CHECK \ + r = match_at(reg, str, end, s, prev, &msa);\ + if (r != REG_MISMATCH) {\ + if (r >= 0) goto match;\ + goto finish; /* error */ \ + } + + /* anchor optimize: resume search range */ + if (reg->anchor != 0 && str < end) { + UChar* semi_end; + + if (reg->anchor & ANCHOR_BEGIN_POSITION) { + /* search start-position only */ + begin_position: + if (range > start) + range = start + 1; + else + range = start; + } + else if (reg->anchor & ANCHOR_BEGIN_BUF) { + /* search str-position only */ + if (range > start) { + if (start != str) goto mismatch_no_msa; + range = str + 1; + } + else { + if (range <= str) { + start = str; + range = str; + } + else + goto mismatch_no_msa; + } + } + else if (reg->anchor & ANCHOR_END_BUF) { + semi_end = end; + + end_buf: + if (semi_end - str < reg->anchor_dmin) + goto mismatch_no_msa; + + if (range > start) { + if (semi_end - start > reg->anchor_dmax) { + start = semi_end - reg->anchor_dmax; + if (start < end) + start = regex_get_right_adjust_char_head(reg->enc, str, start); + else { /* match with empty at end */ + start = regex_get_prev_char_head(reg->enc, str, end); + } + } + if (semi_end - (range - 1) < reg->anchor_dmin) { + range = semi_end - reg->anchor_dmin + 1; + } + + if (start >= range) goto mismatch_no_msa; + } + else { + if (semi_end - range > reg->anchor_dmax) { + range = semi_end - reg->anchor_dmax; + } + if (semi_end - start < reg->anchor_dmin) { + start = semi_end - reg->anchor_dmin; + start = regex_get_left_adjust_char_head(reg->enc, str, start); + if (range > start) goto mismatch_no_msa; + } + } + } + else if (reg->anchor & ANCHOR_SEMI_END_BUF) { + if (IS_NEWLINE(end[-1])) { + semi_end = end - 1; + if (semi_end > str && start <= semi_end) { + goto end_buf; + } + } + else { + semi_end = end; + goto end_buf; + } + } + else if ((reg->anchor & ANCHOR_ANYCHAR_STAR_PL)) { + goto begin_position; + } + } + else if (str == end) { /* empty string */ + static UChar* address_for_empty_string = ""; + +#ifdef REG_DEBUG_SEARCH + fprintf(stderr, "regex_search: empty string.\n"); +#endif + + if (reg->threshold_len == 0) { + s = start = end = str = address_for_empty_string; + prev = (UChar* )NULL; + + MATCH_ARG_INIT(msa, option, region, start); + MATCH_AND_RETURN_CHECK; + goto mismatch; + } + goto mismatch_no_msa; + } + +#ifdef REG_DEBUG_SEARCH + fprintf(stderr, "regex_search(apply anchor): end: %d, start: %d, range: %d\n", + (int )(end - str), (int )(start - str), (int )(range - str)); +#endif + + MATCH_ARG_INIT(msa, option, region, start); + + s = start; + if (range > start) { /* forward search */ + if (s > str) + prev = regex_get_prev_char_head(reg->enc, str, s); + else + prev = (UChar* )NULL; + + if (reg->optimize != REG_OPTIMIZE_NONE) { + UChar *sch_range, *low, *high, *low_prev; + + sch_range = range; + if (reg->dmax != 0) { + if (reg->dmax == INFINITE_DISTANCE) + sch_range = end; + else { + sch_range += reg->dmax; + if (sch_range > end) sch_range = end; + } + } + if (reg->dmax != INFINITE_DISTANCE && + (end - start) >= reg->threshold_len) { + do { + if (! forward_search_range(reg, str, end, s, sch_range, + &low, &high, &low_prev)) goto mismatch; + if (s < low) { + s = low; + prev = low_prev; + } + while (s <= high) { + MATCH_AND_RETURN_CHECK; + prev = s; + s += mblen(reg->enc, *s); + } + if ((reg->anchor & ANCHOR_ANYCHAR_STAR) != 0) { + if (IS_NOT_NULL(prev)) { + while (!IS_NEWLINE(*prev) && s < range) { + prev = s; + s += mblen(reg->enc, *s); + } + } + } + } while (s < range); + goto mismatch; + } + else { /* check only. */ + if ((end - start) < reg->threshold_len || + ! forward_search_range(reg, str, end, s, sch_range, + &low, &high, (UChar** )NULL)) goto mismatch; + } + } + + do { + MATCH_AND_RETURN_CHECK; + prev = s; + s += mblen(reg->enc, *s); + } while (s <= range); /* exec s == range, because empty match with /$/. */ + } + else { /* backward search */ + if (reg->optimize != REG_OPTIMIZE_NONE) { + UChar *low, *high, *adjrange, *sch_start; + + adjrange = regex_get_left_adjust_char_head(reg->enc, str, range); + if (reg->dmax != INFINITE_DISTANCE && + (end - range) >= reg->threshold_len) { + do { + sch_start = s + reg->dmax; + if (sch_start > end) sch_start = end; + if (backward_search_range(reg, str, end, sch_start, range, adjrange, + &low, &high) <= 0) + goto mismatch; + + if (s > high) + s = high; + + while (s >= low) { + prev = regex_get_prev_char_head(reg->enc, str, s); + MATCH_AND_RETURN_CHECK; + s = prev; + } + } while (s >= range); + goto mismatch; + } + else { /* check only. */ + if ((end - range) < reg->threshold_len) goto mismatch; + + sch_start = s; + if (reg->dmax != 0) { + if (reg->dmax == INFINITE_DISTANCE) + sch_start = end; + else { + sch_start += reg->dmax; + if (sch_start > end) sch_start = end; + else + sch_start = regex_get_left_adjust_char_head(reg->enc, start, + sch_start); + } + } + if (backward_search_range(reg, str, end, sch_start, range, adjrange, + &low, &high) <= 0) goto mismatch; + } + } + + do { + prev = regex_get_prev_char_head(reg->enc, str, s); + MATCH_AND_RETURN_CHECK; + s = prev; + } while (s >= range); + } + + mismatch: + r = REG_MISMATCH; + + finish: + MATCH_ARG_FREE(msa); + reg->state--; /* decrement as search counter */ + + /* If result is mismatch and no FIND_NOT_EMPTY option, + then the region is not setted in match_at(). */ + if (IS_FIND_NOT_EMPTY(reg->options) && region && !IS_POSIX_REGION(option)) + regex_region_clear(region); + +#ifdef REG_DEBUG + if (r != REG_MISMATCH) + fprintf(stderr, "regex_search: error %d\n", r); +#endif + return r; + + mismatch_no_msa: + r = REG_MISMATCH; + finish_no_msa: + reg->state--; /* decrement as search counter */ +#ifdef REG_DEBUG + if (r != REG_MISMATCH) + fprintf(stderr, "regex_search: error %d\n", r); +#endif + return r; + + match: + reg->state--; /* decrement as search counter */ + MATCH_ARG_FREE(msa); + return s - str; +} + +extern const char* +regex_version(void) +{ +#define MSTR(a) # a + + return (MSTR(ONIGURUMA_VERSION_MAJOR) "." + MSTR(ONIGURUMA_VERSION_MINOR) "." + MSTR(ONIGURUMA_VERSION_TEENY)); +} diff --git a/ext/mbstring/oniguruma/reggnu.c b/ext/mbstring/oniguruma/reggnu.c new file mode 100644 index 0000000000..7b95e26f76 --- /dev/null +++ b/ext/mbstring/oniguruma/reggnu.c @@ -0,0 +1,231 @@ +/********************************************************************** + + reggnu.c - Oniguruma (regular expression library) + + Copyright (C) 2002-2003 K.Kosako (kosako@sofnec.co.jp) + +**********************************************************************/ +#include "regint.h" + +#if defined(RUBY_PLATFORM) || defined(RUBY) +#ifndef REG_RUBY_M17N +#define USE_COMPATIBILITY_FOR_RUBY_EXTENSION_LIBRARY +#endif +#endif + +#ifndef NULL +#define NULL ((void* )0) +#endif + +extern void +re_free_registers(RegRegion* r) +{ + /* 0: don't free self */ + regex_region_free(r, 0); +} + +extern int +re_adjust_startpos(regex_t* reg, const char* string, int size, + int startpos, int range) +{ + if (startpos > 0 && mbmaxlen(reg->enc) != 1 && startpos < size) { + UChar *p; + UChar *s = (UChar* )string + startpos; + + if (range > 0) { + p = regex_get_right_adjust_char_head(reg->enc, (UChar* )string, s); + } + else { + p = regex_get_left_adjust_char_head(reg->enc, (UChar* )string, s); + } + return p - (UChar* )string; + } + + return startpos; +} + +extern int +re_match(regex_t* reg, const char* str, int size, int pos, + struct re_registers* regs) +{ + return regex_match(reg, (UChar* )str, (UChar* )(str + size), + (UChar* )(str + pos), regs, REG_OPTION_NONE); +} + +extern int +re_search(regex_t* bufp, const char* string, int size, int startpos, int range, + struct re_registers* regs) +{ + return regex_search(bufp, (UChar* )string, (UChar* )(string + size), + (UChar* )(string + startpos), + (UChar* )(string + startpos + range), regs, REG_OPTION_NONE); +} + +extern int +re_compile_pattern(const char* pattern, int size, regex_t* reg, char* ebuf) +{ + int r; + RegErrorInfo einfo; + + r = regex_compile(reg, (UChar* )pattern, (UChar* )(pattern + size), &einfo); + if (r != 0) { + if (IS_NOT_NULL(ebuf)) + (void )regex_error_code_to_str((UChar* )ebuf, r, &einfo); + } + + return r; +} + +extern int +re_recompile_pattern(const char* pattern, int size, regex_t* reg, char* ebuf) +{ + int r; + RegErrorInfo einfo; + RegCharEncoding enc; + + /* I think encoding and options should be arguments of this function. + But this is adapted to present re.c. (2002/11/29) + */ + enc = RegDefaultCharEncoding; + + r = regex_recompile(reg, (UChar* )pattern, (UChar* )(pattern + size), + reg->options, enc, RegDefaultSyntax, &einfo); + if (r != 0) { + if (IS_NOT_NULL(ebuf)) + (void )regex_error_code_to_str((UChar* )ebuf, r, &einfo); + } + return r; +} + +extern void +re_free_pattern(regex_t* reg) +{ + regex_free(reg); +} + +extern int +re_alloc_pattern(regex_t** reg) +{ + if (RegDefaultCharEncoding == REGCODE_UNDEF) + return REGERR_DEFAULT_ENCODING_IS_NOT_SETTED; + + return regex_alloc_init(reg, REG_OPTION_DEFAULT, RegDefaultCharEncoding, + RegDefaultSyntax); +} + +extern void +re_set_casetable(const char* table) +{ + regex_set_default_trans_table((UChar* )table); +} + +#ifdef USE_COMPATIBILITY_FOR_RUBY_EXTENSION_LIBRARY +static const unsigned char mbctab_ascii[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const unsigned char mbctab_euc[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, +}; + +static const unsigned char mbctab_sjis[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 +}; + +static const unsigned char mbctab_utf8[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 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, + 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 0, 0, +}; + +const unsigned char *re_mbctab = mbctab_ascii; +#endif + +extern void +#ifdef REG_RUBY_M17N +re_mbcinit(RegCharEncoding enc) +#else +re_mbcinit(int mb_code) +#endif +{ +#ifdef REG_RUBY_M17N + RegDefaultCharEncoding = enc; +#else + RegDefaultCharEncoding = REG_MBLEN_TABLE[mb_code]; +#endif + +#ifdef USE_COMPATIBILITY_FOR_RUBY_EXTENSION_LIBRARY + switch (mb_code) { + case MBCTYPE_ASCII: + re_mbctab = mbctab_ascii; + break; + case MBCTYPE_EUC: + re_mbctab = mbctab_euc; + break; + case MBCTYPE_SJIS: + re_mbctab = mbctab_sjis; + break; + case MBCTYPE_UTF8: + re_mbctab = mbctab_utf8; + break; + } +#endif +} diff --git a/ext/mbstring/oniguruma/regint.h b/ext/mbstring/oniguruma/regint.h new file mode 100644 index 0000000000..d646dd11f0 --- /dev/null +++ b/ext/mbstring/oniguruma/regint.h @@ -0,0 +1,790 @@ +/********************************************************************** + + regint.h - Oniguruma (regular expression library) + + Copyright (C) 2002-2003 K.Kosako (kosako@sofnec.co.jp) + +**********************************************************************/ +#ifndef REGINT_H +#define REGINT_H + +/* for debug */ +/* #define REG_DEBUG_PARSE_TREE */ +/* #define REG_DEBUG_COMPILE */ +/* #define REG_DEBUG_SEARCH */ +/* #define REG_DEBUG_MATCH */ +/* #define REG_DONT_OPTIMIZE */ + +/* for byte-code statistical data. */ +/* #define REG_DEBUG_STATISTICS */ + +#if defined(REG_DEBUG_PARSE_TREE) || defined(REG_DEBUG_MATCH) || \ + defined(REG_DEBUG_COMPILE) || defined(REG_DEBUG_STATISTICS) +#ifndef REG_DEBUG +#define REG_DEBUG +#endif +#endif + +#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ + (defined(__ppc__) && defined(__APPLE__)) || \ + defined(__mc68020__) +#define UNALIGNED_WORD_ACCESS +#endif + +/* config */ +#define USE_NAMED_SUBEXP +#define USE_SUBEXP_CALL +#define USE_OP_PUSH_OR_JUMP_EXACT +#define USE_QUALIFIER_PEEK_NEXT +#define USE_RECYCLE_NODE +#define USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE /* /\n$/ =~ "\n" */ +/* #define USE_SBMB_CLASS */ + +#define INIT_MATCH_STACK_SIZE 160 +#define MATCH_STACK_LIMIT_SIZE 200000 + +/* interface to external system */ +#ifdef NOT_RUBY /* gived from Makefile */ +#include "config.h" +#define USE_VARIABLE_SYNTAX +#define USE_WORD_BEGIN_END /* "\<": word-begin, "\>": word-end */ +#define DEFAULT_TRANSTABLE_EXIST 1 +#define THREAD_ATOMIC_START /* depend on thread system */ +#define THREAD_ATOMIC_END /* depend on thread system */ +#define THREAD_PASS /* depend on thread system */ +#define xmalloc malloc +#define xrealloc realloc +#define xfree free +#else +#include "ruby.h" +#include "version.h" +#include "rubysig.h" /* for DEFER_INTS, ENABLE_INTS */ +#define USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR +#define THREAD_ATOMIC_START DEFER_INTS +#define THREAD_ATOMIC_END ENABLE_INTS +#define THREAD_PASS /* I want to use rb_thread_pass() */ +#define WARNING rb_warn +#define VERB_WARNING rb_warning + +#if defined(RUBY_VERSION_MAJOR) +#if RUBY_VERSION_MAJOR > 1 || \ +(RUBY_VERSION_MAJOR == 1 && \ + defined(RUBY_VERSION_MINOR) && RUBY_VERSION_MINOR >= 8) +#define USE_ST_HASH_TABLE +#endif +#endif + +#endif /* else NOT_RUBY */ + +#define THREAD_PASS_LIMIT_COUNT 10 +#define xmemset memset +#define xmemcpy memcpy +#define xmemmove memmove +#if defined(_WIN32) && !defined(__CYGWIN__) +#define xalloca _alloca +#define vsnprintf _vsnprintf +#else +#define xalloca alloca +#endif + +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + +#if defined(HAVE_ALLOCA_H) && !defined(__GNUC__) +#include <alloca.h> +#endif + +#ifdef HAVE_STRING_H +# include <string.h> +#else +# include <strings.h> +#endif + +#include <ctype.h> +#include <sys/types.h> + +#ifdef REG_DEBUG +# include <stdio.h> +#endif + +#ifdef NOT_RUBY +# include "oniguruma.h" +#else +# include "regex.h" +#endif + +#ifdef MIN +#undef MIN +#endif +#ifdef MAX +#undef MAX +#endif +#define MIN(a,b) (((a)>(b))?(b):(a)) +#define MAX(a,b) (((a)<(b))?(b):(a)) + +#ifndef UNALIGNED_WORD_ACCESS +#define WORD_ALIGNMENT_SIZE SIZEOF_INT + +#define GET_ALIGNMENT_PAD_SIZE(addr,pad_size) do {\ + (pad_size) = WORD_ALIGNMENT_SIZE - ((int )(addr) % WORD_ALIGNMENT_SIZE);\ + if ((pad_size) == WORD_ALIGNMENT_SIZE) (pad_size) = 0;\ +} while (0) + +#define ALIGNMENT_RIGHT(addr) do {\ + (addr) += (WORD_ALIGNMENT_SIZE - 1);\ + (addr) -= ((int )(addr) % WORD_ALIGNMENT_SIZE);\ +} while (0) + + +#define B_SHIFT 8 +#define B_MASK 0xff + +#define SERIALIZE_2BYTE_INT(i,p) do {\ + *(p) = ((i) >> B_SHIFT) & B_MASK;\ + *((p)+1) = (i) & B_MASK;\ +} while (0) + +#define SERIALIZE_4BYTE_INT(i,p) do {\ + *(p) = ((i) >> B_SHIFT*3) & B_MASK;\ + *((p)+1) = ((i) >> B_SHIFT*2) & B_MASK;\ + *((p)+2) = ((i) >> B_SHIFT ) & B_MASK;\ + *((p)+3) = (i) & B_MASK;\ +} while (0) + +#define SERIALIZE_8BYTE_INT(i,p) do {\ + *(p) = ((i) >> B_SHIFT*7) & B_MASK;\ + *((p)+1) = ((i) >> B_SHIFT*6) & B_MASK;\ + *((p)+2) = ((i) >> B_SHIFT*5) & B_MASK;\ + *((p)+3) = ((i) >> B_SHIFT*4) & B_MASK;\ + *((p)+4) = ((i) >> B_SHIFT*3) & B_MASK;\ + *((p)+5) = ((i) >> B_SHIFT*2) & B_MASK;\ + *((p)+6) = ((i) >> B_SHIFT ) & B_MASK;\ + *((p)+7) = (i) & B_MASK;\ +} while (0) + +#define GET_2BYTE_INT_INC(type,i,p) do {\ + (i) = (type )(((unsigned int )(*(p)) << B_SHIFT) | (unsigned int )((p)[1]));\ + (p) += 2;\ +} while (0) + +#define GET_4BYTE_INT_INC(type,i,p) do {\ + (i) = (type )(((unsigned int )((p)[0]) << B_SHIFT*3) | \ + ((unsigned int )((p)[1]) << B_SHIFT*2) | \ + ((unsigned int )((p)[2]) << B_SHIFT ) | \ + ((unsigned int )((p)[3]) )); \ + (p) += 4;\ +} while (0) + +#define GET_8BYTE_INT_INC(type,i,p) do {\ + (i) = (type )(((unsigned long )((p)[0]) << B_SHIFT*7) | \ + ((unsigned long )((p)[1]) << B_SHIFT*6) | \ + ((unsigned long )((p)[2]) << B_SHIFT*5) | \ + ((unsigned long )((p)[3]) << B_SHIFT*4) | \ + ((unsigned long )((p)[4]) << B_SHIFT*3) | \ + ((unsigned long )((p)[5]) << B_SHIFT*2) | \ + ((unsigned long )((p)[6]) << B_SHIFT ) | \ + ((unsigned long )((p)[7]) )); \ + (p) += 8;\ +} while (0) + +#if SIZEOF_SHORT == 2 +#define GET_SHORT_INC(i,p) GET_2BYTE_INT_INC(short,i,p) +#define SERIALIZE_SHORT(i,p) SERIALIZE_2BYTE_INT(i,p) +#elif SIZEOF_SHORT == 4 +#define GET_SHORT_INC(i,p) GET_4BYTE_INT_INC(short,i,p) +#define SERIALIZE_SHORT(i,p) SERIALIZE_4BYTE_INT(i,p) +#elif SIZEOF_SHORT == 8 +#define GET_SHORT_INC(i,p) GET_8BYTE_INT_INC(short,i,p) +#define SERIALIZE_SHORT(i,p) SERIALIZE_8BYTE_INT(i,p) +#endif + +#if SIZEOF_INT == 2 +#define GET_INT_INC(i,p) GET_2BYTE_INT_INC(int,i,p) +#define GET_UINT_INC(i,p) GET_2BYTE_INT_INC(unsigned,i,p) +#define SERIALIZE_INT(i,p) SERIALIZE_2BYTE_INT(i,p) +#define SERIALIZE_UINT(i,p) SERIALIZE_2BYTE_INT(i,p) +#elif SIZEOF_INT == 4 +#define GET_INT_INC(i,p) GET_4BYTE_INT_INC(int,i,p) +#define GET_UINT_INC(i,p) GET_4BYTE_INT_INC(unsigned,i,p) +#define SERIALIZE_INT(i,p) SERIALIZE_4BYTE_INT(i,p) +#define SERIALIZE_UINT(i,p) SERIALIZE_4BYTE_INT(i,p) +#elif SIZEOF_INT == 8 +#define GET_INT_INC(i,p) GET_8BYTE_INT_INC(int,i,p) +#define GET_UINT_INC(i,p) GET_8BYTE_INT_INC(unsigned,i,p) +#define SERIALIZE_INT(i,p) SERIALIZE_8BYTE_INT(i,p) +#define SERIALIZE_UINT(i,p) SERIALIZE_8BYTE_INT(i,p) +#endif + +#endif /* UNALIGNED_WORD_ACCESS */ + +/* stack pop level */ +#define STACK_POP_LEVEL_FREE 0 +#define STACK_POP_LEVEL_MEM_START 1 +#define STACK_POP_LEVEL_ALL 2 + +/* optimize flags */ +#define REG_OPTIMIZE_NONE 0 +#define REG_OPTIMIZE_EXACT 1 /* Slow Search */ +#define REG_OPTIMIZE_EXACT_BM 2 /* Boyer Moore Search */ +#define REG_OPTIMIZE_EXACT_BM_NOT_REV 3 /* BM (but not simple match) */ +#define REG_OPTIMIZE_EXACT_IC 4 /* Slow Search (ignore case) */ +#define REG_OPTIMIZE_MAP 5 /* char map */ + +/* bit status */ +typedef unsigned int BitStatusType; + +#define BIT_STATUS_BITS_NUM (sizeof(BitStatusType) * 8) +#define BIT_STATUS_CLEAR(stats) (stats) = 0 +#define BIT_STATUS_ON_ALL(stats) (stats) = ~((BitStatusType )0) +#define BIT_STATUS_AT(stats,n) \ + ((n) < BIT_STATUS_BITS_NUM ? ((stats) & (1 << n)) : ((stats) & 1)) + +#define BIT_STATUS_ON_AT(stats,n) do {\ + if ((n) < BIT_STATUS_BITS_NUM)\ + (stats) |= (1 << (n));\ + else\ + (stats) |= 1;\ +} while (0) + +#define BIT_STATUS_ON_AT_SIMPLE(stats,n) do {\ + if ((n) < BIT_STATUS_BITS_NUM)\ + (stats) |= (1 << (n));\ +} while (0) + + +#define INT_MAX_LIMIT ((1UL << (SIZEOF_INT * 8 - 1)) - 1) + +typedef unsigned int WCINT; + +#define SIZE_WCINT sizeof(WCINT) +#define GET_WCINT(wc,p) (wc) = *((WCINT* )(p)) + +#define INFINITE_DISTANCE ~((RegDistance )0) + +#if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII) +# define IS_ASCII(c) 1 +#else +# define IS_ASCII(c) isascii(c) +#endif + +#ifdef isblank +# define IS_BLANK(c) (IS_ASCII(c) && isblank(c)) +#else +# define IS_BLANK(c) ((c) == ' ' || (c) == '\t') +#endif +#ifdef isgraph +# define IS_GRAPH(c) (IS_ASCII(c) && isgraph(c)) +#else +# define IS_GRAPH(c) (IS_ASCII(c) && isprint(c) && !isspace(c)) +#endif + +#define IS_PRINT(c) (isprint(c) && IS_ASCII(c)) +#define IS_ALNUM(c) (isalnum(c) && IS_ASCII(c)) +#define IS_ALPHA(c) (isalpha(c) && IS_ASCII(c)) +#define IS_LOWER(c) (islower(c) && IS_ASCII(c)) +#define IS_UPPER(c) (isupper(c) && IS_ASCII(c)) +#define IS_CNTRL(c) (iscntrl(c) && IS_ASCII(c)) +#define IS_PUNCT(c) (ispunct(c) && IS_ASCII(c)) +#define IS_SPACE(c) (isspace(c) && IS_ASCII(c)) +#define IS_DIGIT(c) (isdigit(c) && IS_ASCII(c)) +#define IS_XDIGIT(c) (isxdigit(c) && IS_ASCII(c)) +#define IS_ODIGIT(c) (IS_DIGIT(c) && (c) < '8') + +#define DIGITVAL(c) ((c) - '0') +#define ODIGITVAL(c) DIGITVAL(c) +#define XDIGITVAL(c) \ + (IS_DIGIT(c) ? DIGITVAL(c) : (IS_UPPER(c) ? (c) - 'A' + 10 : (c) - 'a' + 10)) + +#define IS_SINGLELINE(option) ((option) & REG_OPTION_SINGLELINE) +#define IS_MULTILINE(option) ((option) & REG_OPTION_MULTILINE) +#define IS_IGNORECASE(option) ((option) & REG_OPTION_IGNORECASE) +#define IS_EXTEND(option) ((option) & REG_OPTION_EXTEND) +#define IS_FIND_LONGEST(option) ((option) & REG_OPTION_FIND_LONGEST) +#define IS_FIND_NOT_EMPTY(option) ((option) & REG_OPTION_FIND_NOT_EMPTY) +#define IS_POSIXLINE(option) (IS_SINGLELINE(option) && IS_MULTILINE(option)) +#define IS_FIND_CONDITION(option) ((option) & \ + (REG_OPTION_FIND_LONGEST | REG_OPTION_FIND_NOT_EMPTY)) +#define IS_NOTBOL(option) ((option) & REG_OPTION_NOTBOL) +#define IS_NOTEOL(option) ((option) & REG_OPTION_NOTEOL) +#define IS_POSIX_REGION(option) ((option) & REG_OPTION_POSIX_REGION) + +#ifdef NEWLINE +#undef NEWLINE +#endif +#define NEWLINE '\n' +#define IS_NULL(p) (((void*)(p)) == (void*)0) +#define IS_NOT_NULL(p) (((void*)(p)) != (void*)0) +#define IS_NEWLINE(c) ((c) == NEWLINE) +#define CHECK_NULL_RETURN(p) if (IS_NULL(p)) return NULL +#define CHECK_NULL_RETURN_VAL(p,val) if (IS_NULL(p)) return (val) + +#define NULL_UCHARP ((UChar* )0) + +/* bitset */ +#define BITS_PER_BYTE 8 +#define SINGLE_BYTE_SIZE (1 << BITS_PER_BYTE) +#define BITS_IN_ROOM (sizeof(Bits) * BITS_PER_BYTE) +#define BITSET_SIZE (SINGLE_BYTE_SIZE / BITS_IN_ROOM) + +#ifdef UNALIGNED_WORD_ACCESS +typedef unsigned int Bits; +#else +typedef unsigned char Bits; +#endif +typedef Bits BitSet[BITSET_SIZE]; +typedef Bits* BitSetRef; + +#define SIZE_BITSET sizeof(BitSet) + +#define BITSET_CLEAR(bs) do {\ + int i;\ + for (i = 0; i < BITSET_SIZE; i++) { (bs)[i] = 0; }\ +} while (0) + +#define BS_ROOM(bs,pos) (bs)[pos / BITS_IN_ROOM] +#define BS_BIT(pos) (1 << (pos % BITS_IN_ROOM)) + +#define BITSET_AT(bs, pos) (BS_ROOM(bs,pos) & BS_BIT(pos)) +#define BITSET_SET_BIT(bs, pos) BS_ROOM(bs,pos) |= BS_BIT(pos) +#define BITSET_CLEAR_BIT(bs, pos) BS_ROOM(bs,pos) &= ~(BS_BIT(pos)) +#define BITSET_INVERT_BIT(bs, pos) BS_ROOM(bs,pos) ^= BS_BIT(pos) + +/* bytes buffer */ +typedef struct _BBuf { + UChar* p; + unsigned int used; + unsigned int alloc; +} BBuf; + +#define BBUF_INIT(buf,size) regex_bbuf_init((BBuf* )(buf), (size)) + +#define BBUF_SIZE_INC(buf,inc) do{\ + (buf)->alloc += (inc);\ + (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\ + if (IS_NULL((buf)->p)) return(REGERR_MEMORY);\ +} while (0) + +#define BBUF_EXPAND(buf,low) do{\ + do { (buf)->alloc *= 2; } while ((buf)->alloc < low);\ + (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\ + if (IS_NULL((buf)->p)) return(REGERR_MEMORY);\ +} while (0) + +#define BBUF_ENSURE_SIZE(buf,size) do{\ + int new_alloc = (buf)->alloc;\ + while (new_alloc < (size)) { new_alloc *= 2; }\ + if ((buf)->alloc != new_alloc) {\ + (buf)->p = (UChar* )xrealloc((buf)->p, new_alloc);\ + if (IS_NULL((buf)->p)) return(REGERR_MEMORY);\ + (buf)->alloc = new_alloc;\ + }\ +} while (0) + +#define BBUF_WRITE(buf,pos,bytes,n) do{\ + int used = (pos) + (n);\ + if ((buf)->alloc < used) BBUF_EXPAND((buf),used);\ + xmemcpy((buf)->p + (pos), (bytes), (n));\ + if ((buf)->used < used) (buf)->used = used;\ +} while (0) + +#define BBUF_WRITE1(buf,pos,byte) do{\ + int used = (pos) + 1;\ + if ((buf)->alloc < used) BBUF_EXPAND((buf),used);\ + (buf)->p[(pos)] = (byte);\ + if ((buf)->used < used) (buf)->used = used;\ +} while (0) + +#define BBUF_ADD(buf,bytes,n) BBUF_WRITE((buf),(buf)->used,(bytes),(n)) +#define BBUF_ADD1(buf,byte) BBUF_WRITE1((buf),(buf)->used,(byte)) +#define BBUF_GET_ADD_ADDRESS(buf) ((buf)->p + (buf)->used) +#define BBUF_GET_OFFSET_POS(buf) ((buf)->used) + +/* from < to */ +#define BBUF_MOVE_RIGHT(buf,from,to,n) do {\ + if ((to) + (n) > (buf)->alloc) BBUF_EXPAND((buf),(to) + (n));\ + xmemmove((buf)->p + (to), (buf)->p + (from), (n));\ + if ((to) + (n) > (buf)->used) (buf)->used = (to) + (n);\ +} while (0) + +/* from > to */ +#define BBUF_MOVE_LEFT(buf,from,to,n) do {\ + xmemmove((buf)->p + (to), (buf)->p + (from), (n));\ +} while (0) + +/* from > to */ +#define BBUF_MOVE_LEFT_REDUCE(buf,from,to) do {\ + xmemmove((buf)->p + (to), (buf)->p + (from), (buf)->used - (from));\ + (buf)->used -= (from - to);\ +} while (0) + +#define BBUF_INSERT(buf,pos,bytes,n) do {\ + if (pos >= (buf)->used) {\ + BBUF_WRITE(buf,pos,bytes,n);\ + }\ + else {\ + BBUF_MOVE_RIGHT((buf),(pos),(pos) + (n),((buf)->used - (pos)));\ + xmemcpy((buf)->p + (pos), (bytes), (n));\ + }\ +} while (0) + +#define BBUF_GET_BYTE(buf, pos) (buf)->p[(pos)] + +extern UChar* DefaultTransTable; +#define TOLOWER(enc,c) (DefaultTransTable[c]) + +/* methods for support multi-byte code, */ +#define ismb(code,c) (mblen((code),(c)) != 1) +#define MB2WC(p,end,code) mb2wc((p),(end),(code)) +#define MBBACK(code,start,s,n) step_backward_char((code),(start),(s),(n)) + +#ifdef REG_RUBY_M17N + +#define MB2WC_AVAILABLE(enc) 1 +#define WC2MB_FIRST(enc, wc) m17n_firstbyte((enc),(wc)) + +#define mbmaxlen(enc) m17n_mbmaxlen(enc) +#define mblen(enc,c) m17n_mbclen(enc,c) +#define mbmaxlen_dist(enc) \ + (mbmaxlen(enc) > 0 ? mbmaxlen(enc) : INFINITE_DISTANCE) + +#define IS_SINGLEBYTE_CODE(enc) (m17n_mbmaxlen(enc) == 1) +/* #define IS_INDEPENDENT_TRAIL(enc) m17n_independent_trail(enc) */ +#define IS_INDEPENDENT_TRAIL(enc) IS_SINGLEBYTE_CODE(enc) + +#define IS_CODE_ASCII(enc,c) IS_ASCII(c) +#define IS_CODE_GRAPH(enc,c) IS_GRAPH(c) +#define IS_CODE_PRINT(enc,c) m17n_isprint(enc,c) +#define IS_CODE_ALNUM(enc,c) m17n_isalnum(enc,c) +#define IS_CODE_ALPHA(enc,c) m17n_isalpha(enc,c) +#define IS_CODE_LOWER(enc,c) m17n_islower(enc,c) +#define IS_CODE_UPPER(enc,c) m17n_isupper(enc,c) +#define IS_CODE_CNTRL(enc,c) m17n_iscntrl(enc,c) +#define IS_CODE_PUNCT(enc,c) m17n_ispunct(enc,c) +#define IS_CODE_SPACE(enc,c) m17n_isspace(enc,c) +#define IS_CODE_BLANK(enc,c) IS_BLANK(c) +#define IS_CODE_DIGIT(enc,c) m17n_isdigit(enc,c) +#define IS_CODE_XDIGIT(enc,c) m17n_isxdigit(enc,c) + +#define IS_CODE_WORD(enc,c) m17n_iswchar(enc,c) +#define ISNOT_CODE_WORD(enc,c) (!m17n_iswchar(enc,c)) + +#define IS_WORD_STR(code,s,end) \ + (ismb((code),*(s)) ? (s + mblen((code),*(s)) <= (end)) : \ + m17n_iswchar(code,*(s))) +#define IS_WORD_STR_INC(code,s,end) \ + (ismb((code),*(s)) ? ((s) += mblen((code),*(s)), (s) <= (end)) : \ + (s++, m17n_iswchar(code,s[-1]))) + +#define IS_WORD_HEAD(enc,c) (ismb(enc,c) ? 1 : IS_CODE_WORD(enc,c)) + +#define IS_SB_WORD(code,c) (mblen(code,c) == 1 && IS_CODE_WORD(code,c)) +#define IS_MB_WORD(code,c) ismb(code,c) + +#define mb2wc(p,e,enc) m17n_codepoint((enc),(p),(e)) + +#else /* REG_RUBY_M17N */ + +#define mb2wc(p,e,code) regex_mb2wc((p),(e),(code)) + +#define MB2WC_AVAILABLE(code) 1 +#define WC2MB_FIRST(code, wc) regex_wc2mb_first(code, wc) + +#define mbmaxlen_dist(code) mbmaxlen(code) +#define mbmaxlen(code) regex_mb_max_length(code) +#define mblen(code,c) (code)[(int )(c)] + +#define IS_SINGLEBYTE_CODE(code) ((code) == REGCODE_ASCII) +#define IS_INDEPENDENT_TRAIL(code) \ + ((code) == REGCODE_ASCII || (code) == REGCODE_UTF8) + +#define IS_CODE_ASCII(code,c) IS_ASCII(c) +#define IS_CODE_GRAPH(code,c) IS_GRAPH(c) +#define IS_CODE_PRINT(code,c) IS_PRINT(c) +#define IS_CODE_ALNUM(code,c) IS_ALNUM(c) +#define IS_CODE_ALPHA(code,c) IS_ALPHA(c) +#define IS_CODE_LOWER(code,c) IS_LOWER(c) +#define IS_CODE_UPPER(code,c) IS_UPPER(c) +#define IS_CODE_CNTRL(code,c) IS_CNTRL(c) +#define IS_CODE_PUNCT(code,c) IS_PUNCT(c) +#define IS_CODE_SPACE(code,c) IS_SPACE(c) +#define IS_CODE_BLANK(code,c) IS_BLANK(c) +#define IS_CODE_DIGIT(code,c) IS_DIGIT(c) +#define IS_CODE_ODIGIT(code,c) IS_ODIGIT(c) +#define IS_CODE_XDIGIT(code,c) IS_XDIGIT(c) + +#define IS_SB_WORD(code,c) (IS_CODE_ALNUM(code,c) || (c) == '_') +#define IS_MB_WORD(code,c) ismb(code,c) + +#define IS_CODE_WORD(code,c) \ + (IS_SB_WORD(code,c) && ((c) < 0x80 || (code) == REGCODE_ASCII)) +#define ISNOT_CODE_WORD(code,c) \ + ((!IS_SB_WORD(code,c)) && !ismb(code,c)) + +#define IS_WORD_STR(code,s,end) \ + (ismb((code),*(s)) ? (s + mblen((code),*(s)) <= (end)) : \ + IS_SB_WORD(code,*(s))) +#define IS_WORD_STR_INC(code,s,end) \ + (ismb((code),*(s)) ? ((s) += mblen((code),*(s)), (s) <= (end)) : \ + (s++, IS_SB_WORD(code,s[-1]))) + +#define IS_WORD_HEAD(code,c) (ismb(code,c) ? 1 : IS_SB_WORD(code,c)) + +extern int regex_mb_max_length P_((RegCharEncoding code)); +extern WCINT regex_mb2wc P_((UChar* p, UChar* end, RegCharEncoding code)); +extern int regex_wc2mb_first P_((RegCharEncoding code, WCINT wc)); + +#endif /* not REG_RUBY_M17N */ + + +#define ANCHOR_BEGIN_BUF (1<<0) +#define ANCHOR_BEGIN_LINE (1<<1) +#define ANCHOR_BEGIN_POSITION (1<<2) +#define ANCHOR_END_BUF (1<<3) +#define ANCHOR_SEMI_END_BUF (1<<4) +#define ANCHOR_END_LINE (1<<5) + +#define ANCHOR_WORD_BOUND (1<<6) +#define ANCHOR_NOT_WORD_BOUND (1<<7) +#define ANCHOR_WORD_BEGIN (1<<8) +#define ANCHOR_WORD_END (1<<9) +#define ANCHOR_PREC_READ (1<<10) +#define ANCHOR_PREC_READ_NOT (1<<11) +#define ANCHOR_LOOK_BEHIND (1<<12) +#define ANCHOR_LOOK_BEHIND_NOT (1<<13) + +#define ANCHOR_ANYCHAR_STAR (1<<14) /* ".*" optimize info */ +#define ANCHOR_ANYCHAR_STAR_PL (1<<15) /* ".*" optimize info (posix-line) */ + +/* operation code */ +enum OpCode { + OP_FINISH = 0, /* matching process terminator (no more alternative) */ + OP_END = 1, /* pattern code terminator (success end) */ + + OP_EXACT1 = 2, /* single byte, N = 1 */ + OP_EXACT2, /* single byte, N = 2 */ + OP_EXACT3, /* single byte, N = 3 */ + OP_EXACT4, /* single byte, N = 4 */ + OP_EXACT5, /* single byte, N = 5 */ + OP_EXACTN, /* single byte */ + OP_EXACTMB2N1, /* mb-length = 2 N = 1 */ + OP_EXACTMB2N2, /* mb-length = 2 N = 2 */ + OP_EXACTMB2N3, /* mb-length = 2 N = 3 */ + OP_EXACTMB2N, /* mb-length = 2 */ + OP_EXACTMB3N, /* mb length = 3 */ + OP_EXACTMBN, /* other length */ + + OP_EXACT1_IC, /* single byte, N = 1, ignore case */ + OP_EXACTN_IC, /* single byte, ignore case */ + + OP_CCLASS, + OP_CCLASS_MB, + OP_CCLASS_MIX, + OP_CCLASS_NOT, + OP_CCLASS_MB_NOT, + OP_CCLASS_MIX_NOT, + + OP_ANYCHAR, /* "." */ + OP_ANYCHAR_STAR, /* ".*" */ + OP_ANYCHAR_STAR_PEEK_NEXT, + + OP_WORD, + OP_NOT_WORD, + OP_WORD_SB, + OP_WORD_MB, + OP_WORD_BOUND, + OP_NOT_WORD_BOUND, + OP_WORD_BEGIN, + OP_WORD_END, + + OP_BEGIN_BUF, + OP_END_BUF, + OP_BEGIN_LINE, + OP_END_LINE, + OP_SEMI_END_BUF, + OP_BEGIN_POSITION, + + OP_BACKREF1, + OP_BACKREF2, + OP_BACKREF3, + OP_BACKREFN, + OP_BACKREF_MULTI, + + OP_MEMORY_START, + OP_MEMORY_START_PUSH, /* push back-tracker to stack */ + OP_MEMORY_END_PUSH, /* push back-tracker to stack */ + OP_MEMORY_END_PUSH_REC, /* push back-tracker to stack */ + OP_MEMORY_END, + OP_MEMORY_END_REC, /* push marker to stack */ + + OP_SET_OPTION_PUSH, /* set option and push recover option */ + OP_SET_OPTION, /* set option */ + + OP_FAIL, /* pop stack and move */ + OP_JUMP, + OP_PUSH, + OP_POP, + OP_PUSH_OR_JUMP_EXACT1, /* if match exact then push, else jump. */ + OP_PUSH_IF_PEEK_NEXT, /* if match exact then push, else none. */ + OP_REPEAT, /* {n,m} */ + OP_REPEAT_NG, /* {n,m}? (non greedy) */ + OP_REPEAT_INC, + OP_REPEAT_INC_NG, /* non greedy */ + OP_NULL_CHECK_START, /* null loop checker start */ + OP_NULL_CHECK_END, /* null loop checker end */ + + OP_PUSH_POS, /* (?=...) start */ + OP_POP_POS, /* (?=...) end */ + OP_PUSH_POS_NOT, /* (?!...) start */ + OP_FAIL_POS, /* (?!...) end */ + OP_PUSH_STOP_BT, /* (?>...) start */ + OP_POP_STOP_BT, /* (?>...) end */ + OP_LOOK_BEHIND, /* (?<=...) start (no needs end opcode) */ + OP_PUSH_LOOK_BEHIND_NOT, /* (?<!...) start */ + OP_FAIL_LOOK_BEHIND_NOT, /* (?<!...) end */ + + OP_CALL, /* \g<name> */ + OP_RETURN +}; + +/* arguments type */ +#define ARG_SPECIAL -1 +#define ARG_NON 0 +#define ARG_RELADDR 1 +#define ARG_ABSADDR 2 +#define ARG_LENGTH 3 +#define ARG_MEMNUM 4 +#define ARG_OPTION 5 + +typedef short int RelAddrType; +typedef short int AbsAddrType; +typedef short int LengthType; +typedef short int MemNumType; +typedef int RepeatNumType; + +#define SIZE_OPCODE 1 +#define SIZE_RELADDR sizeof(RelAddrType) +#define SIZE_ABSADDR sizeof(AbsAddrType) +#define SIZE_LENGTH sizeof(LengthType) +#define SIZE_MEMNUM sizeof(MemNumType) +#define SIZE_REPEATNUM sizeof(RepeatNumType) +#define SIZE_OPTION sizeof(RegOptionType) + +#ifdef UNALIGNED_WORD_ACCESS +#define GET_RELADDR_INC(addr,p) do{\ + addr = *((RelAddrType* )(p));\ + (p) += SIZE_RELADDR;\ +} while(0) + +#define GET_ABSADDR_INC(addr,p) do{\ + addr = *((AbsAddrType* )(p));\ + (p) += SIZE_ABSADDR;\ +} while(0) + +#define GET_LENGTH_INC(len,p) do{\ + len = *((LengthType* )(p));\ + (p) += SIZE_LENGTH;\ +} while(0) + +#define GET_MEMNUM_INC(num,p) do{\ + num = *((MemNumType* )(p));\ + (p) += SIZE_MEMNUM;\ +} while(0) + +#define GET_REPEATNUM_INC(num,p) do{\ + num = *((RepeatNumType* )(p));\ + (p) += SIZE_REPEATNUM;\ +} while(0) + +#define GET_OPTION_INC(option,p) do{\ + option = *((RegOptionType* )(p));\ + (p) += SIZE_OPTION;\ +} while(0) +#else + +#define GET_RELADDR_INC(addr,p) GET_SHORT_INC(addr,p) +#define GET_ABSADDR_INC(addr,p) GET_SHORT_INC(addr,p) +#define GET_LENGTH_INC(len,p) GET_SHORT_INC(len,p) +#define GET_MEMNUM_INC(num,p) GET_SHORT_INC(num,p) +#define GET_REPEATNUM_INC(num,p) GET_INT_INC(num,p) +#define GET_OPTION_INC(option,p) GET_UINT_INC(option,p) + +#define SERIALIZE_RELADDR(addr,p) SERIALIZE_SHORT(addr,p) +#define SERIALIZE_ABSADDR(addr,p) SERIALIZE_SHORT(addr,p) +#define SERIALIZE_LENGTH(len,p) SERIALIZE_SHORT(len,p) +#define SERIALIZE_MEMNUM(num,p) SERIALIZE_SHORT(num,p) +#define SERIALIZE_REPEATNUM(num,p) SERIALIZE_INT(num,p) +#define SERIALIZE_OPTION(option,p) SERIALIZE_UINT(option,p) + +#define SERIALIZE_BUFSIZE SIZEOF_INT + +#endif /* UNALIGNED_WORD_ACCESS */ + +#define GET_BYTE_INC(byte,p) do{\ + byte = *(p);\ + (p)++;\ +} while(0) + + +/* op-code + arg size */ +#define SIZE_OP_ANYCHAR_STAR SIZE_OPCODE +#define SIZE_OP_ANYCHAR_STAR_PEEK_NEXT (SIZE_OPCODE + 1) +#define SIZE_OP_JUMP (SIZE_OPCODE + SIZE_RELADDR) +#define SIZE_OP_PUSH (SIZE_OPCODE + SIZE_RELADDR) +#define SIZE_OP_POP SIZE_OPCODE +#define SIZE_OP_PUSH_OR_JUMP_EXACT1 (SIZE_OPCODE + SIZE_RELADDR + 1) +#define SIZE_OP_PUSH_IF_PEEK_NEXT (SIZE_OPCODE + SIZE_RELADDR + 1) +#define SIZE_OP_REPEAT_INC (SIZE_OPCODE + SIZE_MEMNUM) +#define SIZE_OP_REPEAT_INC_NG (SIZE_OPCODE + SIZE_MEMNUM) +#define SIZE_OP_PUSH_POS SIZE_OPCODE +#define SIZE_OP_PUSH_POS_NOT (SIZE_OPCODE + SIZE_RELADDR) +#define SIZE_OP_POP_POS SIZE_OPCODE +#define SIZE_OP_FAIL_POS SIZE_OPCODE +#define SIZE_OP_SET_OPTION (SIZE_OPCODE + SIZE_OPTION) +#define SIZE_OP_SET_OPTION_PUSH (SIZE_OPCODE + SIZE_OPTION) +#define SIZE_OP_FAIL SIZE_OPCODE +#define SIZE_OP_MEMORY_START (SIZE_OPCODE + SIZE_MEMNUM) +#define SIZE_OP_MEMORY_START_PUSH (SIZE_OPCODE + SIZE_MEMNUM) +#define SIZE_OP_MEMORY_END_PUSH (SIZE_OPCODE + SIZE_MEMNUM) +#define SIZE_OP_MEMORY_END_PUSH_REC (SIZE_OPCODE + SIZE_MEMNUM) +#define SIZE_OP_MEMORY_END (SIZE_OPCODE + SIZE_MEMNUM) +#define SIZE_OP_MEMORY_END_REC (SIZE_OPCODE + SIZE_MEMNUM) +#define SIZE_OP_PUSH_STOP_BT SIZE_OPCODE +#define SIZE_OP_POP_STOP_BT SIZE_OPCODE +#define SIZE_OP_NULL_CHECK_START (SIZE_OPCODE + SIZE_MEMNUM) +#define SIZE_OP_NULL_CHECK_END (SIZE_OPCODE + SIZE_MEMNUM) +#define SIZE_OP_LOOK_BEHIND (SIZE_OPCODE + SIZE_LENGTH) +#define SIZE_OP_PUSH_LOOK_BEHIND_NOT (SIZE_OPCODE + SIZE_RELADDR + SIZE_LENGTH) +#define SIZE_OP_FAIL_LOOK_BEHIND_NOT SIZE_OPCODE +#define SIZE_OP_CALL (SIZE_OPCODE + SIZE_ABSADDR) +#define SIZE_OP_RETURN SIZE_OPCODE + + +#ifdef REG_DEBUG + +typedef struct { + short int opcode; + char* name; + short int arg_type; +} RegOpInfoType; + +extern RegOpInfoType RegOpInfo[]; + +extern void regex_print_compiled_byte_code P_((FILE* f, UChar* bp, UChar** nextp)); + +#ifdef REG_DEBUG_STATISTICS +extern void regex_statistics_init P_((void)); +extern void regex_print_statistics P_((FILE* f)); +#endif +#endif + +extern char* regex_error_code_to_format P_((int code)); +extern void regex_snprintf_with_pattern PV_((char buf[], int bufsize, RegCharEncoding enc, char* pat, char* pat_end, char *fmt, ...)); +extern UChar* regex_strdup P_((UChar* s, UChar* end)); +extern int regex_bbuf_init P_((BBuf* buf, int size)); +extern int regex_alloc_init P_((regex_t** reg, RegOptionType option, RegCharEncoding code, RegSyntaxType* syntax)); +extern int regex_compile P_((regex_t* reg, UChar* pattern, UChar* pattern_end, RegErrorInfo* einfo)); +extern void regex_chain_reduce P_((regex_t* reg)); +extern int regex_is_in_wc_range P_((UChar* p, WCINT wc)); + +#endif /* REGINT_H */ diff --git a/ext/mbstring/oniguruma/regparse.c b/ext/mbstring/oniguruma/regparse.c new file mode 100644 index 0000000000..95a55b2a06 --- /dev/null +++ b/ext/mbstring/oniguruma/regparse.c @@ -0,0 +1,4215 @@ +/********************************************************************** + + regparse.c - Oniguruma (regular expression library) + + Copyright (C) 2003 K.Kosako (kosako@sofnec.co.jp) + +**********************************************************************/ +#include "regparse.h" + +#define WARN_BUFSIZE 256 + +#define SYN_POSIX_COMMON_OP \ + ( REG_SYN_OP_ANYCHAR | REG_SYN_OP_POSIX_BRACKET | REG_SYN_OP_BACK_REF | \ + REG_SYN_OP_CC | REG_SYN_OP_0INF | REG_SYN_OP_LINE_ANCHOR | \ + REG_SYN_OP_ESC_CONTROL_CHAR ) + +#define SYN_GNU_REGEX_OP \ + ( REG_SYN_OP_ANYCHAR | REG_SYN_OP_CC | \ + REG_SYN_OP_POSIX_BRACKET | REG_SYN_OP_BACK_REF | \ + REG_SYN_OP_INTERVAL | REG_SYN_OP_SUBEXP | REG_SYN_OP_ALT | \ + REG_SYN_OP_0INF | REG_SYN_OP_1INF | REG_SYN_OP_01 | \ + REG_SYN_OP_ESC_BUF_ANCHOR | REG_SYN_OP_ESC_WORD | \ + REG_SYN_OP_ESC_WORD_BOUND | REG_SYN_OP_ESC_WORD_BEGIN_END | \ + REG_SYN_OP_ESC_WHITE_SPACE | REG_SYN_OP_ESC_DIGIT | \ + REG_SYN_OP_LINE_ANCHOR ) + +#define SYN_GNU_REGEX_BV \ + ( REG_SYN_CONTEXT_INDEP_ANCHORS | REG_SYN_CONTEXT_INDEP_OPS | \ + REG_SYN_CONTEXT_INVALID_OPS | REG_SYN_ALLOW_INVALID_INTERVAL | \ + REG_SYN_ESCAPE_IN_CC | REG_SYN_ALLOW_RANGE_OP_IN_CC ) + +#ifdef USE_VARIABLE_SYNTAX +RegSyntaxType RegSyntaxPosixBasic = { + ( SYN_POSIX_COMMON_OP | REG_SYN_OP_ESC_SUBEXP | REG_SYN_OP_ESC_INTERVAL ) + , 0 + , 0 + , ( REG_OPTION_SINGLELINE | REG_OPTION_MULTILINE ) +}; + +RegSyntaxType RegSyntaxPosixExtended = { + ( SYN_POSIX_COMMON_OP | REG_SYN_OP_SUBEXP | REG_SYN_OP_INTERVAL | + REG_SYN_OP_1INF | REG_SYN_OP_01 | REG_SYN_OP_ALT ) + , 0 + , ( REG_SYN_CONTEXT_INDEP_ANCHORS | + REG_SYN_CONTEXT_INDEP_OPS | REG_SYN_CONTEXT_INVALID_OPS | + REG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP | REG_SYN_ALLOW_RANGE_OP_IN_CC ) + , ( REG_OPTION_SINGLELINE | REG_OPTION_MULTILINE ) +}; + +RegSyntaxType RegSyntaxEmacs = { + ( REG_SYN_OP_ANYCHAR | REG_SYN_OP_CC | REG_SYN_OP_ESC_INTERVAL | + REG_SYN_OP_ESC_SUBEXP | REG_SYN_OP_ESC_ALT | + REG_SYN_OP_0INF | REG_SYN_OP_1INF | REG_SYN_OP_01 | + REG_SYN_OP_BACK_REF | REG_SYN_OP_LINE_ANCHOR | + REG_SYN_OP_ESC_GNU_BUF_ANCHOR | REG_SYN_OP_ESC_CONTROL_CHAR ) + , 0 + , REG_SYN_ALLOW_EMPTY_RANGE_IN_CC + , REG_OPTION_NONE +}; + +RegSyntaxType RegSyntaxGrep = { + ( REG_SYN_OP_ANYCHAR | REG_SYN_OP_CC | REG_SYN_OP_POSIX_BRACKET | + REG_SYN_OP_INTERVAL | REG_SYN_OP_ESC_SUBEXP | REG_SYN_OP_ESC_ALT | + REG_SYN_OP_0INF | REG_SYN_OP_ESC_1INF | REG_SYN_OP_ESC_01 | + REG_SYN_OP_LINE_ANCHOR ) + , 0 + , ( REG_SYN_ALLOW_EMPTY_RANGE_IN_CC | REG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC ) + , REG_OPTION_NONE +}; + +RegSyntaxType RegSyntaxGnuRegex = { + SYN_GNU_REGEX_OP + , 0 + , SYN_GNU_REGEX_BV + , REG_OPTION_NONE +}; + +RegSyntaxType RegSyntaxJava = { + (( SYN_GNU_REGEX_OP | REG_SYN_OP_NON_GREEDY | REG_SYN_OP_SUBEXP_EFFECT | + REG_SYN_OP_ESC_CONTROL_CHAR | REG_SYN_OP_ESC_C_CONTROL | + REG_SYN_OP_QUOTE | REG_SYN_OP_ESC_OCTAL3 | REG_SYN_OP_ESC_X_HEX2 ) + & ~REG_SYN_OP_ESC_WORD_BEGIN_END ) + , ( REG_SYN_OP2_OPTION_PERL | + REG_SYN_OP2_POSSESSIVE_REPEAT | REG_SYN_OP2_POSSESSIVE_INTERVAL | + REG_SYN_OP2_CCLASS_SET | REG_SYN_OP2_ESC_V_VTAB | + REG_SYN_OP2_ESC_U_HEX4 ) + , ( SYN_GNU_REGEX_BV | REG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND ) + , REG_OPTION_SINGLELINE +}; + +RegSyntaxType RegSyntaxPerl = { + (( SYN_GNU_REGEX_OP | REG_SYN_OP_NON_GREEDY | REG_SYN_OP_SUBEXP_EFFECT | + REG_SYN_OP_ESC_OCTAL3 | REG_SYN_OP_ESC_X_HEX2 | + REG_SYN_OP_ESC_X_BRACE_HEX8 | REG_SYN_OP_ESC_CONTROL_CHAR | + REG_SYN_OP_ESC_C_CONTROL | REG_SYN_OP_QUOTE ) + & ~REG_SYN_OP_ESC_WORD_BEGIN_END ) + , REG_SYN_OP2_OPTION_PERL + , SYN_GNU_REGEX_BV + , REG_OPTION_SINGLELINE +}; +#endif /* USE_VARIABLE_SYNTAX */ + +RegSyntaxType RegSyntaxRuby = { + (( SYN_GNU_REGEX_OP | REG_SYN_OP_NON_GREEDY | REG_SYN_OP_SUBEXP_EFFECT | + REG_SYN_OP_ESC_OCTAL3 | REG_SYN_OP_ESC_X_HEX2 | + REG_SYN_OP_ESC_X_BRACE_HEX8 | REG_SYN_OP_ESC_CONTROL_CHAR | + REG_SYN_OP_ESC_C_CONTROL ) + & ~REG_SYN_OP_ESC_WORD_BEGIN_END ) + , ( REG_SYN_OP2_OPTION_RUBY | + REG_SYN_OP2_NAMED_SUBEXP | REG_SYN_OP2_SUBEXP_CALL | + REG_SYN_OP2_POSSESSIVE_REPEAT | REG_SYN_OP2_CCLASS_SET | + REG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL | + REG_SYN_OP2_ESC_M_BAR_META | REG_SYN_OP2_ESC_V_VTAB ) + , ( SYN_GNU_REGEX_BV | REG_SYN_WARN_FOR_CC_OP_NOT_ESCAPED | + REG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND ) + , REG_OPTION_NONE +}; + +RegSyntaxType* RegDefaultSyntax = REG_SYNTAX_RUBY; + +#ifdef USE_VARIABLE_SYNTAX +extern int +regex_set_default_syntax(RegSyntaxType* syntax) +{ + if (IS_NULL(syntax)) + syntax = REG_SYNTAX_RUBY; + + RegDefaultSyntax = syntax; + return 0; +} +#endif + +static void +bbuf_free(BBuf* bbuf) +{ + if (IS_NOT_NULL(bbuf)) { + if (IS_NOT_NULL(bbuf->p)) xfree(bbuf->p); + xfree(bbuf); + } +} + +static int +bbuf_clone(BBuf** rto, BBuf* from) +{ + int r; + BBuf *to; + + *rto = to = (BBuf* )xmalloc(sizeof(BBuf)); + CHECK_NULL_RETURN_VAL(to, REGERR_MEMORY); + r = BBUF_INIT(to, from->alloc); + if (r != 0) return r; + to->used = from->used; + xmemcpy(to->p, from->p, from->used); + return 0; +} + +#define WC2MB_MAX_BUFLEN 7 +#define ONOFF(v,f,negative) (negative) ? ((v) &= ~(f)) : ((v) |= (f)) + +#define SET_ALL_MULTI_BYTE_RANGE(pbuf) \ + add_wc_range_to_buf(pbuf, (WCINT )0x80, ~((WCINT )0),\ + (UChar )0x80, (UChar )0xff); + +#define ADD_ALL_MULTI_BYTE_RANGE(code, mbuf) do {\ + if (! IS_SINGLEBYTE_CODE(code)) {\ + r = SET_ALL_MULTI_BYTE_RANGE(&(mbuf));\ + if (r) return r;\ + }\ +} while (0) + + +#define BITSET_IS_EMPTY(bs,empty) do {\ + int i;\ + empty = 1;\ + for (i = 0; i < BITSET_SIZE; i++) {\ + if ((bs)[i] != 0) {\ + empty = 0; break;\ + }\ + }\ +} while (0) + +static void +bitset_set_range(BitSetRef bs, int from, int to) +{ + int i; + for (i = from; i <= to && i < SINGLE_BYTE_SIZE; i++) { + BITSET_SET_BIT(bs, i); + } +} + +static void +bitset_set_all(BitSetRef bs) +{ + int i; + for (i = 0; i < BITSET_SIZE; i++) { + bs[i] = ~((Bits )0); + } +} + +static void +bitset_invert(BitSetRef bs) +{ + int i; + for (i = 0; i < BITSET_SIZE; i++) { + bs[i] = ~(bs[i]); + } +} + +static void +bitset_invert_to(BitSetRef from, BitSetRef to) +{ + int i; + for (i = 0; i < BITSET_SIZE; i++) { + to[i] = ~(from[i]); + } +} + +static void +bitset_and(BitSetRef dest, BitSetRef bs) +{ + int i; + for (i = 0; i < BITSET_SIZE; i++) { + dest[i] &= bs[i]; + } +} + +static void +bitset_or(BitSetRef dest, BitSetRef bs) +{ + int i; + for (i = 0; i < BITSET_SIZE; i++) { + dest[i] |= bs[i]; + } +} + +static void +bitset_copy(BitSetRef dest, BitSetRef bs) +{ + int i; + for (i = 0; i < BITSET_SIZE; i++) { + dest[i] = bs[i]; + } +} + +static int +k_strncmp(UChar* s1, UChar* s2, int n) +{ + int x; + + while (n-- > 0) { + x = *s2++ - *s1++; + if (x) return x; + } + return 0; +} + +static void +k_strcpy(UChar* dest, UChar* src, UChar* end) +{ + int len = end - src; + if (len > 0) { + xmemcpy(dest, src, len); + dest[len] = (UChar )0; + } +} + +extern UChar* +regex_strdup(UChar* s, UChar* end) +{ + int len = end - s; + + if (len > 0) { + UChar* r = (UChar* )xmalloc(len + 1); + CHECK_NULL_RETURN(r); + xmemcpy(r, s, len); + r[len] = (UChar )0; + return r; + } + else return NULL; +} + +/* scan pattern methods */ +#define PEND_VALUE -1 + +#define PFETCH(c) do { (c) = *p++; } while (0) +#define PUNFETCH p-- +#define PINC p++ +#define PPEEK (p < end ? *p : PEND_VALUE) +#define PEND (p < end ? 0 : 1) + +#ifdef REG_RUBY_M17N + +static int +wc2mb_buf(WCINT wc, UChar **bufs, UChar **bufe, RegCharEncoding enc) +{ + int c, len; + + c = m17n_firstbyte(enc, wc); + len = mblen(enc, c); + if (len > (*bufe - *bufs)) { + *bufs = xmalloc(len); + CHECK_NULL_RETURN_VAL(*bufs, REGERR_MEMORY); + } + m17n_mbcput(enc, wc, *bufs); + *bufe = *bufs + len; + return 0; +} + +#else /* REG_RUBY_M17N */ + +extern int +regex_wc2mb_first(RegCharEncoding code, WCINT wc) +{ + if (code == REGCODE_ASCII) { + return (wc & 0xff); + } + else if (code == REGCODE_UTF8) { + if ((wc & 0xffffff80) == 0) + return wc; + else { + if ((wc & 0xfffff800) == 0) + return ((wc>>6)& 0x1f) | 0xc0; + else if ((wc & 0xffff0000) == 0) + return ((wc>>12) & 0x0f) | 0xe0; + else if ((wc & 0xffe00000) == 0) + return ((wc>>18) & 0x07) | 0xf0; + else if ((wc & 0xfc000000) == 0) + return ((wc>>24) & 0x03) | 0xf8; + else if ((wc & 0x80000000) == 0) + return ((wc>>30) & 0x01) | 0xfc; + else { + return REGERR_TOO_BIG_WIDE_CHAR_VALUE; + } + } + } + else { + int first; + + if ((wc & 0xff0000) != 0) { + first = (wc >> 16) & 0xff; + if (mblen(code, first) != 3) + return REGERR_INVALID_WIDE_CHAR_VALUE; + } + else if ((wc & 0xff00) != 0) { + first = (wc >> 8) & 0xff; + if (mblen(code, first) != 2) + return REGERR_INVALID_WIDE_CHAR_VALUE; + } + else { + if (mblen(code, wc) != 1) + return REGERR_INVALID_WIDE_CHAR_VALUE; + return wc; + } + return first; + } +} + +static int +wc2mb(WCINT wc, UChar buf[], RegCharEncoding code) +{ +#define UTF8_TRAILS(wc, shift) ((((wc) >> (shift)) & 0x3f) | 0x80) +#define UTF8_TRAIL0(wc) (((wc) & 0x3f) | 0x80) + + UChar *p = buf; + + if (code == REGCODE_UTF8) { + if ((wc & 0xffffff80) == 0) + *p++ = wc; + else { + if ((wc & 0xfffff800) == 0) { + *p++ = ((wc>>6)& 0x1f) | 0xc0; + } + else if ((wc & 0xffff0000) == 0) { + *p++ = ((wc>>12) & 0x0f) | 0xe0; + *p++ = UTF8_TRAILS(wc, 6); + } + else if ((wc & 0xffe00000) == 0) { + *p++ = ((wc>>18) & 0x07) | 0xf0; + *p++ = UTF8_TRAILS(wc, 12); + *p++ = UTF8_TRAILS(wc, 6); + } + else if ((wc & 0xfc000000) == 0) { + *p++ = ((wc>>24) & 0x03) | 0xf8; + *p++ = UTF8_TRAILS(wc, 18); + *p++ = UTF8_TRAILS(wc, 12); + *p++ = UTF8_TRAILS(wc, 6); + } + else if ((wc & 0x80000000) == 0) { + *p++ = ((wc>>30) & 0x01) | 0xfc; + *p++ = UTF8_TRAILS(wc, 24); + *p++ = UTF8_TRAILS(wc, 18); + *p++ = UTF8_TRAILS(wc, 12); + *p++ = UTF8_TRAILS(wc, 6); + } + else { + return REGERR_TOO_BIG_WIDE_CHAR_VALUE; + } + *p++ = UTF8_TRAIL0(wc); + } + } + else { + if ((wc & 0xff0000) != 0) *p++ = ((wc >> 16) & 0xff); + if ((wc & 0xff00) != 0) *p++ = ((wc >> 8) & 0xff); + *p++ = (wc & 0xff); + + if (mblen(code, buf[0]) != (p - buf)) + return REGERR_INVALID_WIDE_CHAR_VALUE; + } + + return p - buf; +} + +static int +wc2mb_buf(WCINT wc, UChar **bufs, UChar **bufe, RegCharEncoding code) +{ + int r; + r = wc2mb(wc, *bufs, code); + if (r < 0) return r; + + *bufe = (*bufs) + r; + return 0; +} +#endif /* not REG_RUBY_M17N */ + +/* used as function pointer value */ +static int +is_code_ascii(RegCharEncoding code, UChar c) +{ + return (c < 128 ? 1 : 0); +} + +static int +is_code_graph(RegCharEncoding code, UChar c) { return IS_CODE_GRAPH(code, c); } +static int +is_code_print(RegCharEncoding code, UChar c) { return IS_CODE_PRINT(code, c); } +static int +is_code_alnum(RegCharEncoding code, UChar c) { return IS_CODE_ALNUM(code, c); } +static int +is_code_alpha(RegCharEncoding code, UChar c) { return IS_CODE_ALPHA(code, c); } +static int +is_code_lower(RegCharEncoding code, UChar c) { return IS_CODE_LOWER(code, c); } +static int +is_code_upper(RegCharEncoding code, UChar c) { return IS_CODE_UPPER(code, c); } +static int +is_code_cntrl(RegCharEncoding code, UChar c) { return IS_CODE_CNTRL(code, c); } +static int +is_code_punct(RegCharEncoding code, UChar c) { return IS_CODE_PUNCT(code, c); } +static int +is_code_space(RegCharEncoding code, UChar c) { return IS_CODE_SPACE(code, c); } +static int +is_code_blank(RegCharEncoding code, UChar c) { return IS_CODE_BLANK(code, c); } +static int +is_code_digit(RegCharEncoding code, UChar c) { return IS_CODE_DIGIT(code, c); } +static int +is_code_xdigit(RegCharEncoding code, UChar c) { return IS_CODE_XDIGIT(code, c); } + +static UChar* +k_strcat_capa(UChar* dest, UChar* dest_end, UChar* src, UChar* src_end, int capa) +{ + UChar* r; + + if (dest) + r = (UChar* )xrealloc(dest, capa + 1); + else + r = (UChar* )xmalloc(capa + 1); + + CHECK_NULL_RETURN(r); + k_strcpy(r + (dest_end - dest), src, src_end); + return r; +} + +/* dest on static area */ +static UChar* +strcat_capa_from_static(UChar* dest, UChar* dest_end, + UChar* src, UChar* src_end, int capa) +{ + UChar* r; + + r = (UChar* )xmalloc(capa + 1); + CHECK_NULL_RETURN(r); + k_strcpy(r, dest, dest_end); + k_strcpy(r + (dest_end - dest), src, src_end); + return r; +} + +#ifdef USE_NAMED_SUBEXP + +#define INIT_NAME_BACKREFS_ALLOC_NUM 8 + +typedef struct { + UChar* name; + int name_len; /* byte length */ + int back_num; /* number of backrefs */ + int back_alloc; + int back_ref1; + int* back_refs; +} NameEntry; + +#ifdef USE_ST_HASH_TABLE + +#include <st.h> + +typedef st_table NameTable; +typedef st_data_t HashDataType; /* 1.6 st.h doesn't define st_data_t type */ + +#define NAMEBUF_SIZE 24 +#define NAMEBUF_SIZE_1 25 + +#ifdef REG_DEBUG +static int +i_print_name_entry(UChar* key, NameEntry* e, void* arg) +{ + int i; + FILE* fp = (FILE* )arg; + + fprintf(fp, "%s: ", e->name); + if (e->back_num == 0) + fputs("-", fp); + else if (e->back_num == 1) + fprintf(fp, "%d", e->back_ref1); + else { + for (i = 0; i < e->back_num; i++) { + if (i > 0) fprintf(fp, ", "); + fprintf(fp, "%d", e->back_refs[i]); + } + } + fputs("\n", fp); + return ST_CONTINUE; +} + +extern int +regex_print_names(FILE* fp, regex_t* reg) +{ + NameTable* t = (NameTable* )reg->name_table; + + if (IS_NOT_NULL(t)) { + fprintf(fp, "name table\n"); + st_foreach(t, i_print_name_entry, (HashDataType )fp); + fputs("\n", fp); + } + return 0; +} +#endif + +static int +i_free_name_entry(UChar* key, NameEntry* e, void* arg) +{ + xfree(e->name); /* == key */ + if (IS_NOT_NULL(e->back_refs)) xfree(e->back_refs); + return ST_DELETE; +} + +static int +names_clear(regex_t* reg) +{ + NameTable* t = (NameTable* )reg->name_table; + + if (IS_NOT_NULL(t)) { + st_foreach(t, i_free_name_entry, 0); + } + return 0; +} + +extern int +regex_names_free(regex_t* reg) +{ + int r; + NameTable* t; + + r = names_clear(reg); + if (r) return r; + + t = (NameTable* )reg->name_table; + if (IS_NOT_NULL(t)) st_free_table(t); + reg->name_table = (void* )NULL; + return 0; +} + +static NameEntry* +name_find(regex_t* reg, UChar* name, UChar* name_end) +{ + int len; + UChar namebuf[NAMEBUF_SIZE_1]; + UChar *key; + NameEntry* e; + NameTable* t = (NameTable* )reg->name_table; + + e = (NameEntry* )NULL; + if (IS_NOT_NULL(t)) { + if (*name_end == '\0') { + key = name; + } + else { + /* dirty, but st.c API claims NULL terminated key. */ + len = name_end - name; + if (len <= NAMEBUF_SIZE) { + xmemcpy(namebuf, name, len); + namebuf[len] = '\0'; + key = namebuf; + } + else { + key = regex_strdup(name, name_end); + if (IS_NULL(key)) return (NameEntry* )NULL; + } + } + + st_lookup(t, (HashDataType )key, (HashDataType * )&e); + if (key != name && key != namebuf) xfree(key); + } + return e; +} + +typedef struct { + int (*func)(UChar*,int,int*,void*); + void* arg; + int ret; +} INamesArg; + +static int +i_names(UChar* key, NameEntry* e, INamesArg* arg) +{ + int r = (*(arg->func))(e->name, e->back_num, + (e->back_num > 1 ? e->back_refs : &(e->back_ref1)), arg->arg); + if (r != 0) { + arg->ret = r; + return ST_STOP; + } + return ST_CONTINUE; +} + +extern int +regex_foreach_name(regex_t* reg, int (*func)(UChar*,int,int*,void*), void* arg) +{ + INamesArg narg; + NameTable* t = (NameTable* )reg->name_table; + + narg.ret = 0; + if (IS_NOT_NULL(t)) { + narg.func = func; + narg.arg = arg; + st_foreach(t, i_names, (HashDataType )&narg); + } + return narg.ret; +} + +#else /* USE_ST_HASH_TABLE */ + +#define INIT_NAMES_ALLOC_NUM 8 + +typedef struct { + NameEntry* e; + int num; + int alloc; +} NameTable; + + +#ifdef REG_DEBUG +extern int +regex_print_names(FILE* fp, regex_t* reg) +{ + int i, j; + NameEntry* e; + NameTable* t = (NameTable* )reg->name_table; + + if (IS_NOT_NULL(t) && t->num > 0) { + fprintf(fp, "name table\n"); + for (i = 0; i < t->num; i++) { + e = &(t->e[i]); + fprintf(fp, "%s: ", e->name); + if (e->back_num == 0) { + fputs("-", fp); + } + else if (e->back_num == 1) { + fprintf(fp, "%d", e->back_ref1); + } + else { + for (j = 0; j < e->back_num; j++) { + if (j > 0) fprintf(fp, ", "); + fprintf(fp, "%d", e->back_refs[j]); + } + } + fputs("\n", fp); + } + fputs("\n", fp); + } + return 0; +} +#endif + +static int +names_clear(regex_t* reg) +{ + int i; + NameEntry* e; + NameTable* t = (NameTable* )reg->name_table; + + if (IS_NOT_NULL(t)) { + for (i = 0; i < t->num; i++) { + e = &(t->e[i]); + if (IS_NOT_NULL(e->name)) { + xfree(e->name); + e->name = NULL; + e->name_len = 0; + e->back_num = 0; + e->back_alloc = 0; + if (IS_NOT_NULL(e->back_refs)) xfree(e->back_refs); + e->back_refs = (int* )NULL; + } + } + t->num = 0; + } + return 0; +} + +extern int +regex_names_free(regex_t* reg) +{ + int r; + NameTable* t; + + r = names_clear(reg); + if (r) return r; + + t = (NameTable* )reg->name_table; + if (IS_NOT_NULL(t)) xfree(t); + reg->name_table = NULL; + return 0; +} + +static NameEntry* +name_find(regex_t* reg, UChar* name, UChar* name_end) +{ + int i, len; + NameEntry* e; + NameTable* t = (NameTable* )reg->name_table; + + if (IS_NOT_NULL(t)) { + len = name_end - name; + for (i = 0; i < t->num; i++) { + e = &(t->e[i]); + if (len == e->name_len && k_strncmp(name, e->name, len) == 0) + return e; + } + } + return (NameEntry* )NULL; +} + +extern int +regex_foreach_name(regex_t* reg, int (*func)(UChar*,int,int*,void*), void* arg) +{ + int i, r; + NameEntry* e; + NameTable* t = (NameTable* )reg->name_table; + + if (IS_NOT_NULL(t)) { + for (i = 0; i < t->num; i++) { + e = &(t->e[i]); + r = (*func)(e->name, e->back_num, + (e->back_num > 1 ? e->back_refs : &(e->back_ref1)), arg); + if (r != 0) return r; + } + } + return 0; +} + +#endif /* else USE_ST_HASH_TABLE */ + +static int +name_add(regex_t* reg, UChar* name, UChar* name_end, int backref) +{ + int alloc; + NameEntry* e; + NameTable* t = (NameTable* )reg->name_table; + + if (name_end - name <= 0) + return REGERR_INVALID_SUBEXP_NAME; + + e = name_find(reg, name, name_end); + if (IS_NULL(e)) { +#ifdef USE_ST_HASH_TABLE + if (IS_NULL(t)) { + reg->name_table = t = st_init_strtable(); + } + e = (NameEntry* )xmalloc(sizeof(NameEntry)); + CHECK_NULL_RETURN_VAL(e, REGERR_MEMORY); + + e->name = regex_strdup(name, name_end); + if (IS_NULL(e->name)) return REGERR_MEMORY; + st_insert(t, (HashDataType )e->name, (HashDataType )e); + + e->name_len = name_end - name; + e->back_num = 0; + e->back_alloc = 0; + e->back_refs = (int* )NULL; + +#else + + if (IS_NULL(t)) { + alloc = INIT_NAMES_ALLOC_NUM; + t = (NameTable* )xmalloc(sizeof(NameTable)); + CHECK_NULL_RETURN_VAL(t, REGERR_MEMORY); + t->e = NULL; + t->alloc = 0; + t->num = 0; + + t->e = (NameEntry* )xmalloc(sizeof(NameEntry) * alloc); + if (IS_NULL(t->e)) { + xfree(t); + return REGERR_MEMORY; + } + t->alloc = alloc; + reg->name_table = t; + goto clear; + } + else if (t->num == t->alloc) { + int i; + + alloc = t->alloc * 2; + t->e = (NameEntry* )xrealloc(t->e, sizeof(NameEntry) * alloc); + CHECK_NULL_RETURN_VAL(t->e, REGERR_MEMORY); + t->alloc = alloc; + + clear: + for (i = t->num; i < t->alloc; i++) { + t->e[i].name = NULL; + t->e[i].name_len = 0; + t->e[i].back_num = 0; + t->e[i].back_alloc = 0; + t->e[i].back_refs = (int* )NULL; + } + } + e = &(t->e[t->num]); + t->num++; + e->name = regex_strdup(name, name_end); + e->name_len = name_end - name; +#endif + } + + e->back_num++; + if (e->back_num == 1) { + e->back_ref1 = backref; + } + else if (e->back_num == 2) { + alloc = INIT_NAME_BACKREFS_ALLOC_NUM; + e->back_refs = (int* )xmalloc(sizeof(int) * alloc); + CHECK_NULL_RETURN_VAL(e->back_refs, REGERR_MEMORY); + e->back_alloc = alloc; + e->back_refs[0] = e->back_ref1; + e->back_refs[1] = backref; + } + else { + if (e->back_num > e->back_alloc) { + alloc = e->back_alloc * 2; + e->back_refs = (int* )xrealloc(e->back_refs, sizeof(int) * alloc); + CHECK_NULL_RETURN_VAL(e->back_refs, REGERR_MEMORY); + e->back_alloc = alloc; + } + e->back_refs[e->back_num - 1] = backref; + } + + return 0; +} + +extern int +regex_name_to_group_numbers(regex_t* reg, UChar* name, UChar* name_end, + int** nums) +{ + NameEntry* e; + + e = name_find(reg, name, name_end); + if (IS_NULL(e)) return REGERR_UNDEFINED_NAME_REFERENCE; + + switch (e->back_num) { + case 0: + break; + case 1: + *nums = &(e->back_ref1); + break; + default: + *nums = e->back_refs; + break; + } + return e->back_num; +} + +#else + +extern int +regex_name_to_group_numbers(regex_t* reg, UChar* name, UChar* name_end, + int** nums) +{ + return REG_NO_SUPPORT_CONFIG; +} + +extern int +regex_foreach_name(regex_t* reg, int (*func)(UChar*,int,int*,void*), void* arg) +{ + return REG_NO_SUPPORT_CONFIG; +} +#endif + + +#define INIT_SCANENV_MEMNODES_ALLOC_SIZE 16 + +static void +scan_env_clear(ScanEnv* env) +{ + int i; + + BIT_STATUS_CLEAR(env->backtrack_mem); + BIT_STATUS_CLEAR(env->backrefed_mem); + env->error = (UChar* )NULL; + env->error_end = (UChar* )NULL; + env->num_call = 0; + env->num_mem = 0; + env->mem_alloc = 0; + env->mem_nodes_dynamic = (Node** )NULL; + + for (i = 0; i < SCANENV_MEMNODES_SIZE; i++) + env->mem_nodes_static[i] = NULL_NODE; +} + +static int +scan_env_add_mem_entry(ScanEnv* env) +{ + int i, need, alloc; + Node** p; + + need = env->num_mem + 1; + if (need >= SCANENV_MEMNODES_SIZE) { + if (env->mem_alloc <= need) { + if (IS_NULL(env->mem_nodes_dynamic)) { + alloc = INIT_SCANENV_MEMNODES_ALLOC_SIZE; + p = (Node** )xmalloc(sizeof(Node*) * alloc); + xmemcpy(p, env->mem_nodes_static, + sizeof(Node*) * SCANENV_MEMNODES_SIZE); + } + else { + alloc = env->mem_alloc * 2; + p = (Node** )xrealloc(env->mem_nodes_dynamic, sizeof(Node*) * alloc); + } + CHECK_NULL_RETURN_VAL(p, REGERR_MEMORY); + + for (i = env->num_mem + 1; i < alloc; i++) + p[i] = NULL_NODE; + + env->mem_nodes_dynamic = p; + env->mem_alloc = alloc; + } + } + + env->num_mem++; + return env->num_mem; +} + +static int +scan_env_set_mem_node(ScanEnv* env, int num, Node* node) +{ + if (env->num_mem >= num) + SCANENV_MEM_NODES(env)[num] = node; + else + return REGERR_INVALID_BACKREF; + return 0; +} + + +#ifdef USE_RECYCLE_NODE +typedef struct _FreeNode { + struct _FreeNode* next; +} FreeNode; + +static FreeNode* FreeNodeList = (FreeNode* )NULL; +#endif + +extern void +regex_node_free(Node* node) +{ + if (IS_NULL(node)) return ; + + switch (NTYPE(node)) { + case N_STRING: + if (IS_NOT_NULL(NSTRING(node).s) && NSTRING(node).s != NSTRING(node).buf) { + xfree(NSTRING(node).s); + } + break; + + case N_LIST: + case N_ALT: + regex_node_free(NCONS(node).left); + regex_node_free(NCONS(node).right); + break; + + case N_CCLASS: + if (NCCLASS(node).mbuf) + bbuf_free(NCCLASS(node).mbuf); + break; + + case N_QUALIFIER: + if (NQUALIFIER(node).target) + regex_node_free(NQUALIFIER(node).target); + break; + + case N_EFFECT: + if (NEFFECT(node).target) + regex_node_free(NEFFECT(node).target); + break; + + case N_BACKREF: + if (IS_NOT_NULL(NBACKREF(node).back_dynamic)) + xfree(NBACKREF(node).back_dynamic); + break; + + case N_ANCHOR: + if (NANCHOR(node).target) + regex_node_free(NANCHOR(node).target); + break; + } + +#ifdef USE_RECYCLE_NODE + { + FreeNode* n; + + n = (FreeNode* )node; + n->next = FreeNodeList; + FreeNodeList = n; + } +#else + xfree(node); +#endif +} + +#ifdef USE_RECYCLE_NODE +extern int +regex_free_node_list() +{ + FreeNode* n; + + THREAD_ATOMIC_START; + while (FreeNodeList) { + n = FreeNodeList; + FreeNodeList = FreeNodeList->next; + xfree(n); + } + THREAD_ATOMIC_END; + return 0; +} +#endif + +static Node* +node_new() +{ + Node* node; + +#ifdef USE_RECYCLE_NODE + if (IS_NOT_NULL(FreeNodeList)) { + node = (Node* )FreeNodeList; + FreeNodeList = FreeNodeList->next; + return node; + } +#endif + + node = (Node* )xmalloc(sizeof(Node)); + return node; +} + + +static void +initialize_cclass(CClassNode* cc) +{ + BITSET_CLEAR(cc->bs); + cc->not = 0; + cc->mbuf = NULL; +} + +static Node* +node_new_cclass() +{ + Node* node = node_new(); + CHECK_NULL_RETURN(node); + node->type = N_CCLASS; + + initialize_cclass(&(NCCLASS(node))); + return node; +} + +static Node* +node_new_ctype(int type) +{ + Node* node = node_new(); + CHECK_NULL_RETURN(node); + node->type = N_CTYPE; + NCTYPE(node).type = type; + return node; +} + +static Node* +node_new_anychar() +{ + Node* node = node_new(); + CHECK_NULL_RETURN(node); + node->type = N_ANYCHAR; + return node; +} + +static Node* +node_new_list(Node* left, Node* right) +{ + Node* node = node_new(); + CHECK_NULL_RETURN(node); + node->type = N_LIST; + NCONS(node).left = left; + NCONS(node).right = right; + return node; +} + +static Node* +node_new_alt(Node* left, Node* right) +{ + Node* node = node_new(); + CHECK_NULL_RETURN(node); + node->type = N_ALT; + NCONS(node).left = left; + NCONS(node).right = right; + return node; +} + +extern Node* +regex_node_new_anchor(int type) +{ + Node* node = node_new(); + CHECK_NULL_RETURN(node); + node->type = N_ANCHOR; + NANCHOR(node).type = type; + NANCHOR(node).target = NULL; + NANCHOR(node).char_len = -1; + return node; +} + +static Node* +node_new_backref(int back_num, int* backrefs, ScanEnv* env) +{ + int i; + Node* node = node_new(); + + CHECK_NULL_RETURN(node); + node->type = N_BACKREF; + NBACKREF(node).state = 0; + NBACKREF(node).back_num = back_num; + NBACKREF(node).back_dynamic = (int* )NULL; + + for (i = 0; i < back_num; i++) { + if (backrefs[i] <= env->num_mem && + IS_NULL(SCANENV_MEM_NODES(env)[backrefs[i]])) { + NBACKREF(node).state |= NST_RECURSION; /* /...(\1).../ */ + break; + } + } + + if (back_num <= NODE_BACKREFS_SIZE) { + for (i = 0; i < back_num; i++) + NBACKREF(node).back_static[i] = backrefs[i]; + } + else { + int* p = (int* )xmalloc(sizeof(int) * back_num); + if (IS_NULL(p)) { + regex_node_free(node); + return NULL; + } + NBACKREF(node).back_dynamic = p; + for (i = 0; i < back_num; i++) + p[i] = backrefs[i]; + } + return node; +} + +#ifdef USE_SUBEXP_CALL +static Node* +node_new_call(UChar* name, UChar* name_end) +{ + Node* node = node_new(); + CHECK_NULL_RETURN(node); + + node->type = N_CALL; + NCALL(node).state = 0; + NCALL(node).ref_num = CALLNODE_REFNUM_UNDEF; + NCALL(node).target = NULL_NODE; + NCALL(node).name = name; + NCALL(node).name_end = name_end; + return node; +} +#endif + +static Node* +node_new_qualifier(int lower, int upper, int by_number) +{ + Node* node = node_new(); + CHECK_NULL_RETURN(node); + node->type = N_QUALIFIER; + NQUALIFIER(node).target = NULL; + NQUALIFIER(node).lower = lower; + NQUALIFIER(node).upper = upper; + NQUALIFIER(node).greedy = 1; + NQUALIFIER(node).by_number = by_number; + NQUALIFIER(node).target_may_empty = 0; + NQUALIFIER(node).head_exact = NULL_NODE; + NQUALIFIER(node).next_head_exact = NULL_NODE; + NQUALIFIER(node).is_refered = 0; + return node; +} + +static Node* +node_new_effect(int type) +{ + Node* node = node_new(); + CHECK_NULL_RETURN(node); + node->type = N_EFFECT; + NEFFECT(node).type = type; + NEFFECT(node).state = 0; + NEFFECT(node).regnum = 0; + NEFFECT(node).option = 0; + NEFFECT(node).target = NULL; + NEFFECT(node).call_addr = -1; + NEFFECT(node).opt_count = 0; + return node; +} + +extern Node* +regex_node_new_effect(int type) +{ + return node_new_effect(type); +} + +static Node* +node_new_option(RegOptionType option) +{ + Node* node = node_new_effect(EFFECT_OPTION); + CHECK_NULL_RETURN(node); + NEFFECT(node).option = option; + return node; +} + +extern int +regex_node_str_cat(Node* node, UChar* s, UChar* end) +{ + int addlen = end - s; + + if (addlen > 0) { + int len = NSTRING(node).end - NSTRING(node).s; + + if (NSTRING(node).capa > 0 || (len + addlen > NODE_STR_BUF_SIZE - 1)) { + UChar* p; + int capa = len + addlen + NODE_STR_MARGIN; + + if (capa <= NSTRING(node).capa) { + k_strcpy(NSTRING(node).s + len, s, end); + } + else { + if (NSTRING(node).s == NSTRING(node).buf) + p = strcat_capa_from_static(NSTRING(node).s, NSTRING(node).end, + s, end, capa); + else + p = k_strcat_capa(NSTRING(node).s, NSTRING(node).end, s, end, capa); + + CHECK_NULL_RETURN_VAL(p, REGERR_MEMORY); + NSTRING(node).s = p; + NSTRING(node).capa = capa; + } + } + else { + k_strcpy(NSTRING(node).s + len, s, end); + } + NSTRING(node).end = NSTRING(node).s + len + addlen; + } + + return 0; +} + +static int +node_str_cat_char(Node* node, UChar c) +{ + UChar s[1]; + + s[0] = c; + return regex_node_str_cat(node, s, s + 1); +} + +extern void +regex_node_conv_to_str_node(Node* node, int flag) +{ + node->type = N_STRING; + + NSTRING(node).flag = flag; + NSTRING(node).capa = 0; + NSTRING(node).s = NSTRING(node).buf; + NSTRING(node).end = NSTRING(node).buf; +} + +static Node* +node_new_str(UChar* s, UChar* end) +{ + Node* node = node_new(); + CHECK_NULL_RETURN(node); + + node->type = N_STRING; + NSTRING(node).capa = 0; + NSTRING(node).flag = 0; + NSTRING(node).s = NSTRING(node).buf; + NSTRING(node).end = NSTRING(node).buf; + if (regex_node_str_cat(node, s, end)) { + regex_node_free(node); + return NULL; + } + return node; +} + +static Node* +node_new_str_raw(UChar* s, UChar* end) +{ + Node* node = node_new_str(s, end); + NSTRING_SET_RAW(node); + return node; +} + +static Node* +node_new_empty() +{ + return node_new_str(NULL, NULL); +} + +static Node* +node_new_str_char(UChar c) +{ + UChar p[1]; + + p[0] = c; + return node_new_str(p, p + 1); +} + +static Node* +node_new_str_raw_char(UChar c) +{ + UChar p[1]; + + p[0] = c; + return node_new_str_raw(p, p + 1); +} + +static Node* +str_node_split_last_char(StrNode* sn, RegCharEncoding enc) +{ + UChar *p; + Node* n = NULL_NODE; + + if (sn->end > sn->s) { + p = regex_get_prev_char_head(enc, sn->s, sn->end); + if (p && p > sn->s) { /* can be splitted. */ + n = node_new_str(p, sn->end); + if ((sn->flag & NSTR_RAW) != 0) + NSTRING_SET_RAW(n); + sn->end = p; + } + } + return n; +} + +static int +str_node_can_be_split(StrNode* sn, RegCharEncoding enc) +{ + if (sn->end > sn->s) { + return ((mblen(enc, *(sn->s)) < sn->end - sn->s) ? 1 : 0); + } + return 0; +} + +extern int +regex_scan_unsigned_number(UChar** src, UChar* end, RegCharEncoding enc) +{ + unsigned int num, val; + int c; + UChar* p = *src; + + num = 0; + while (!PEND) { + PFETCH(c); + if (IS_CODE_DIGIT(enc, c)) { + val = (unsigned int )DIGITVAL(c); + if ((INT_MAX_LIMIT - val) / 10UL < num) + return -1; /* overflow */ + + num = num * 10 + val; + } + else { + PUNFETCH; + break; + } + } + *src = p; + return num; +} + +static int +scan_unsigned_hexadecimal_number(UChar** src, UChar* end, int maxlen, + RegCharEncoding enc) +{ + int c; + unsigned int num, val; + UChar* p = *src; + + num = 0; + while (!PEND && maxlen-- != 0) { + PFETCH(c); + if (IS_CODE_XDIGIT(enc, c)) { + val = (unsigned int )XDIGITVAL(c); + if ((INT_MAX_LIMIT - val) / 16UL < num) + return -1; /* overflow */ + + num = (num << 4) + XDIGITVAL(c); + } + else { + PUNFETCH; + break; + } + } + *src = p; + return num; +} + +static int +scan_unsigned_octal_number(UChar** src, UChar* end, int maxlen, + RegCharEncoding enc) +{ + int c; + unsigned int num, val; + UChar* p = *src; + + num = 0; + while (!PEND && maxlen-- != 0) { + PFETCH(c); + if (IS_CODE_ODIGIT(enc, c)) { + val = ODIGITVAL(c); + if ((INT_MAX_LIMIT - val) / 8UL < num) + return -1; /* overflow */ + + num = (num << 3) + val; + } + else { + PUNFETCH; + break; + } + } + *src = p; + return num; +} + + +#define BBUF_WRITE_WCINT(bbuf,pos,wc) \ + BBUF_WRITE(bbuf, pos, &(wc), SIZE_WCINT) + +/* data format: + [multi-byte-head-BitSet][n][from-1][to-1][from-2][to-2] ... [from-n][to-n] + (all data size is WCINT) + */ +static int +new_wc_range(BBuf** pbuf) +{ +#define INIT_MULTI_BYTE_RANGE_SIZE (SIZE_WCINT * 5) + int r; + WCINT n; + BBuf* bbuf; + + bbuf = *pbuf = (BBuf* )xmalloc(sizeof(BBuf)); + CHECK_NULL_RETURN_VAL(*pbuf, REGERR_MEMORY); + r = BBUF_INIT(*pbuf, SIZE_BITSET + INIT_MULTI_BYTE_RANGE_SIZE); + if (r) return r; + + n = 0; + BBUF_WRITE_WCINT(bbuf, SIZE_BITSET, n); + BITSET_CLEAR((BitSetRef )bbuf->p); + return 0; +} + +static int +add_wc_range_to_buf(BBuf** pbuf, WCINT from, WCINT to, UChar cfrom, UChar cto) +{ + int r, inc_n, pos; + int low, high, bound, x; + WCINT n, *data; + BBuf* bbuf; + + if (from > to) { + n = from; from = to; to = n; + } + + if (IS_NULL(*pbuf)) { + r = new_wc_range(pbuf); + if (r) return r; + bbuf = *pbuf; + n = 0; + } + else { + bbuf = *pbuf; + GET_WCINT(n, bbuf->p + SIZE_BITSET); + } + data = (WCINT* )(bbuf->p + SIZE_BITSET); + data++; + + for (low = 0, bound = n; low < bound; ) { + x = (low + bound) >> 1; + if (from > data[x*2 + 1]) + low = x + 1; + else + bound = x; + } + + for (high = low, bound = n; high < bound; ) { + x = (high + bound) >> 1; + if (to >= data[x*2] - 1) + high = x + 1; + else + bound = x; + } + + inc_n = low + 1 - high; + if (n + inc_n > REG_MAX_MULTI_BYTE_RANGES_NUM) + return REGERR_TOO_MANY_MULTI_BYTE_RANGES; + + if (inc_n != 1) { + if (from > data[low*2]) + from = data[low*2]; + if (to < data[(high - 1)*2 + 1]) + to = data[(high - 1)*2 + 1]; + } + + if (inc_n != 0 && high < n) { + int from_pos = SIZE_BITSET + SIZE_WCINT * (1 + high * 2); + int to_pos = SIZE_BITSET + SIZE_WCINT * (1 + (low + 1) * 2); + int size = (n - high) * 2 * SIZE_WCINT; + + if (inc_n > 0) { + BBUF_MOVE_RIGHT(bbuf, from_pos, to_pos, size); + } + else { + BBUF_MOVE_LEFT_REDUCE(bbuf, from_pos, to_pos); + } + } + + pos = SIZE_BITSET + SIZE_WCINT * (1 + low * 2); + BBUF_ENSURE_SIZE(bbuf, pos + SIZE_WCINT * 2); + BBUF_WRITE_WCINT(bbuf, pos, from); + BBUF_WRITE_WCINT(bbuf, pos + SIZE_WCINT, to); + n += inc_n; + BBUF_WRITE_WCINT(bbuf, SIZE_BITSET, n); + + if (inc_n > 0) { + int i; + UChar tmp; + + if (cfrom > cto) { + tmp = cfrom; cfrom = cto; cto = tmp; + } + + for (i = cfrom; i <= cto; i++) { + BITSET_SET_BIT((BitSetRef)bbuf->p, i); + } + } + return 0; +} + +static int +add_wc_range(BBuf** pbuf, ScanEnv* env, WCINT from, WCINT to) +{ + int cfrom, cto; + + if (from > to) { + if (IS_SYNTAX_BV(env->syntax, REG_SYN_ALLOW_EMPTY_RANGE_IN_CC)) + return 0; + else + return REGERR_EMPTY_RANGE_IN_CHAR_CLASS; + } + + cfrom = WC2MB_FIRST(env->enc, from); + if (cfrom < 0) return cfrom; + cto = WC2MB_FIRST(env->enc, to); + if (cto < 0) return cto; + return add_wc_range_to_buf(pbuf, from, to, (UChar )cfrom, (UChar )cto); +} + +static int +not_wc_range_buf(BBuf* bbuf, BBuf** pbuf) +{ + int r, i, n; + WCINT pre, from, to, *data; + + *pbuf = (BBuf* )NULL; + if (IS_NULL(bbuf)) { + set_all: + return SET_ALL_MULTI_BYTE_RANGE(pbuf); + } + + data = (WCINT* )(bbuf->p + SIZE_BITSET); + GET_WCINT(n, data); + data++; + if (n <= 0) goto set_all; + + r = 0; + pre = 0x80; + for (i = 0; i < n; i++) { + from = data[i*2]; + to = data[i*2+1]; + if (pre <= from - 1) { + r = add_wc_range_to_buf(pbuf, pre, from - 1, (UChar )0, (UChar )0); + if (r != 0) return r; + } + if (to == ~((WCINT )0)) break; + pre = to + 1; + } + if (to < ~((WCINT )0)) { + r = add_wc_range_to_buf(pbuf, to + 1, ~((WCINT )0), (UChar )0, (UChar )0); + } + return r; +} + +#define SWAP_BBUF_NOT(bbuf1, not1, bbuf2, not2) do {\ + BBuf *tbuf; \ + int tnot; \ + tnot = not1; not1 = not2; not2 = tnot; \ + tbuf = bbuf1; bbuf1 = bbuf2; bbuf2 = tbuf; \ +} while (0) + +static int +or_wc_range_buf(BBuf* bbuf1, int not1, BBuf* bbuf2, int not2, BBuf** pbuf) +{ + int i, r; + WCINT n1, *data1; + WCINT from, to; + + *pbuf = (BBuf* )NULL; + if (IS_NULL(bbuf1) && IS_NULL(bbuf2)) { + if (not1 != 0 || not2 != 0) + return SET_ALL_MULTI_BYTE_RANGE(pbuf); + return 0; + } + + r = 0; + if (IS_NULL(bbuf2)) + SWAP_BBUF_NOT(bbuf1, not1, bbuf2, not2); + + if (IS_NULL(bbuf1)) { + if (not1 != 0) { + return SET_ALL_MULTI_BYTE_RANGE(pbuf); + } + else { + if (not2 == 0) { + return bbuf_clone(pbuf, bbuf2); + } + else { + return not_wc_range_buf(bbuf2, pbuf); + } + } + } + + if (not1 != 0) + SWAP_BBUF_NOT(bbuf1, not1, bbuf2, not2); + + data1 = (WCINT* )(bbuf1->p + SIZE_BITSET); + GET_WCINT(n1, data1); + data1++; + + if (not2 == 0 && not1 == 0) { /* 1 OR 2 */ + r = bbuf_clone(pbuf, bbuf2); + } + else if (not1 == 0) { /* 1 OR (not 2) */ + r = not_wc_range_buf(bbuf2, pbuf); + } + if (r != 0) return r; + + for (i = 0; i < n1; i++) { + from = data1[i*2]; + to = data1[i*2+1]; + r = add_wc_range_to_buf(pbuf, from, to, (UChar )0, (UChar )0); + if (r != 0) return r; + } + return 0; +} + +static int +and_wc_range1(BBuf** pbuf, WCINT from1, WCINT to1, WCINT* data, int n) +{ + int i, r; + WCINT from2, to2; + + for (i = 0; i < n; i++) { + from2 = data[i*2]; + to2 = data[i*2+1]; + if (from2 < from1) { + if (to2 < from1) continue; + else { + from1 = to2 + 1; + } + } + else if (from2 <= to1) { + if (to2 < to1) { + if (from1 <= from2 - 1) { + r = add_wc_range_to_buf(pbuf, from1, from2-1, (UChar )0, (UChar )0); + if (r != 0) return r; + } + from1 = to2 + 1; + } + else { + to1 = from2 - 1; + } + } + else { + from1 = from2; + } + if (from1 > to1) break; + } + if (from1 <= to1) { + r = add_wc_range_to_buf(pbuf, from1, to1, (UChar )0, (UChar )0); + if (r != 0) return r; + } + return 0; +} + +static int +and_wc_range_buf(BBuf* bbuf1, int not1, BBuf* bbuf2, int not2, BBuf** pbuf) +{ + int i, j, r; + WCINT n1, n2, *data1, *data2; + WCINT from, to, from1, to1, from2, to2; + + *pbuf = (BBuf* )NULL; + if (IS_NULL(bbuf1)) { + if (not1 != 0 && IS_NOT_NULL(bbuf2)) /* not1 != 0 -> not2 == 0 */ + return bbuf_clone(pbuf, bbuf2); + return 0; + } + else if (IS_NULL(bbuf2)) { + if (not2 != 0) + return bbuf_clone(pbuf, bbuf1); + return 0; + } + + if (not1 != 0) + SWAP_BBUF_NOT(bbuf1, not1, bbuf2, not2); + + data1 = (WCINT* )(bbuf1->p + SIZE_BITSET); + data2 = (WCINT* )(bbuf2->p + SIZE_BITSET); + GET_WCINT(n1, data1); + GET_WCINT(n2, data2); + data1++; + data2++; + + if (not2 == 0 && not1 == 0) { /* 1 AND 2 */ + for (i = 0; i < n1; i++) { + from1 = data1[i*2]; + to1 = data1[i*2+1]; + for (j = 0; j < n2; j++) { + from2 = data2[j*2]; + to2 = data2[j*2+1]; + if (from2 > to1) break; + if (to2 < from1) continue; + from = MAX(from1, from2); + to = MIN(to1, to2); + r = add_wc_range_to_buf(pbuf, from, to, (UChar )0, (UChar )0); + if (r != 0) return r; + } + } + } + else if (not1 == 0) { /* 1 AND (not 2) */ + for (i = 0; i < n1; i++) { + from1 = data1[i*2]; + to1 = data1[i*2+1]; + r = and_wc_range1(pbuf, from1, to1, data2, n2); + if (r != 0) return r; + } + } + + return 0; +} + +static int +and_cclass(CClassNode* dest, CClassNode* cc) +{ + int r, not1, not2; + BBuf *buf1, *buf2, *pbuf; + BitSetRef bsr1, bsr2; + BitSet bs1, bs2; + + not1 = dest->not; + bsr1 = dest->bs; + buf1 = dest->mbuf; + not2 = cc->not; + bsr2 = cc->bs; + buf2 = cc->mbuf; + + if (not1 != 0) { + bitset_invert_to(bsr1, bs1); + bsr1 = bs1; + } + if (not2 != 0) { + bitset_invert_to(bsr2, bs2); + bsr2 = bs2; + } + bitset_and(bsr1, bsr2); + if (bsr1 != dest->bs) { + bitset_copy(dest->bs, bsr1); + bsr1 = dest->bs; + } + if (not1 != 0) { + bitset_invert(dest->bs); + } + + if (not1 != 0 && not2 != 0) { + r = or_wc_range_buf(buf1, 0, buf2, 0, &pbuf); + } + else { + r = and_wc_range_buf(buf1, not1, buf2, not2, &pbuf); + if (r == 0 && not1 != 0) { + BBuf *tbuf; + r = not_wc_range_buf(pbuf, &tbuf); + if (r != 0) { + bbuf_free(pbuf); + return r; + } + bbuf_free(pbuf); + pbuf = tbuf; + } + } + if (r != 0) return r; + + dest->mbuf = pbuf; + bbuf_free(buf1); + if (IS_NOT_NULL(pbuf)) { + bitset_set_all((BitSetRef )pbuf->p); /* Sorry, but I'm tired. */ + } + return r; +} + +static int +or_cclass(CClassNode* dest, CClassNode* cc) +{ + int r, not1, not2; + BBuf *buf1, *buf2, *pbuf; + BitSetRef bsr1, bsr2; + BitSet bs1, bs2; + + not1 = dest->not; + bsr1 = dest->bs; + buf1 = dest->mbuf; + not2 = cc->not; + bsr2 = cc->bs; + buf2 = cc->mbuf; + + if (not1 != 0) { + bitset_invert_to(bsr1, bs1); + bsr1 = bs1; + } + if (not2 != 0) { + bitset_invert_to(bsr2, bs2); + bsr2 = bs2; + } + bitset_or(bsr1, bsr2); + if (bsr1 != dest->bs) { + bitset_copy(dest->bs, bsr1); + bsr1 = dest->bs; + } + if (not1 != 0) { + bitset_invert(dest->bs); + } + + if (not1 != 0 && not2 != 0) { + r = and_wc_range_buf(buf1, 0, buf2, 0, &pbuf); + } + else { + r = or_wc_range_buf(buf1, not1, buf2, not2, &pbuf); + if (r == 0 && not1 != 0) { + BBuf *tbuf; + r = not_wc_range_buf(pbuf, &tbuf); + if (r != 0) { + bbuf_free(pbuf); + return r; + } + bbuf_free(pbuf); + pbuf = tbuf; + } + } + if (r != 0) return r; + + dest->mbuf = pbuf; + bbuf_free(buf1); + if (IS_NOT_NULL(pbuf)) { + bitset_set_all((BitSetRef )pbuf->p); /* Sorry, but I'm tired. */ + } + return r; +} + +static int +conv_backslash_value(int c, ScanEnv* env) +{ + if (IS_SYNTAX_OP(env->syntax, REG_SYN_OP_ESC_CONTROL_CHAR)) { + switch (c) { + case 'n': return '\n'; + case 't': return '\t'; + case 'r': return '\r'; + case 'f': return '\f'; + case 'a': return '\007'; + case 'b': return '\010'; + case 'e': return '\033'; + case 'v': + if (IS_SYNTAX_OP2(env->syntax, REG_SYN_OP2_ESC_V_VTAB)) + return '\v'; + break; + + default: + break; + } + } + return c; +} + +static int +is_invalid_qualifier_target(Node* node) +{ + switch (NTYPE(node)) { + case N_ANCHOR: + return 1; + break; + + case N_EFFECT: + if (NEFFECT(node).type == EFFECT_OPTION) + return is_invalid_qualifier_target(NEFFECT(node).target); + break; + + case N_LIST: /* ex. (?:\G\A)* */ + do { + if (! is_invalid_qualifier_target(NCONS(node).left)) return 0; + } while (IS_NOT_NULL(node = NCONS(node).right)); + return 0; + break; + + case N_ALT: /* ex. (?:abc|\A)* */ + do { + if (is_invalid_qualifier_target(NCONS(node).left)) return 1; + } while (IS_NOT_NULL(node = NCONS(node).right)); + break; + + default: + break; + } + return 0; +} + +/* ?:0, *:1, +:2, ??:3, *?:4, +?:5 */ +static int +popular_qualifier_num(QualifierNode* qf) +{ + if (qf->greedy) { + if (qf->lower == 0) { + if (qf->upper == 1) return 0; + else if (IS_REPEAT_INFINITE(qf->upper)) return 1; + } + else if (qf->lower == 1) { + if (IS_REPEAT_INFINITE(qf->upper)) return 2; + } + } + else { + if (qf->lower == 0) { + if (qf->upper == 1) return 3; + else if (IS_REPEAT_INFINITE(qf->upper)) return 4; + } + else if (qf->lower == 1) { + if (IS_REPEAT_INFINITE(qf->upper)) return 5; + } + } + return -1; +} + +static void +reduce_nested_qualifier(Node* pnode, Node* cnode) +{ +#define NQ_ASIS 0 /* as is */ +#define NQ_DEL 1 /* delete parent */ +#define NQ_A 2 /* to '*' */ +#define NQ_AQ 3 /* to '*?' */ +#define NQ_QQ 4 /* to '??' */ +#define NQ_P_QQ 5 /* to '+)??' */ +#define NQ_PQ_Q 6 /* to '+?)?' */ + + static char reduces[][6] = { + {NQ_DEL, NQ_A, NQ_A, NQ_QQ, NQ_AQ, NQ_ASIS}, /* '?' */ + {NQ_DEL, NQ_DEL, NQ_DEL, NQ_P_QQ, NQ_P_QQ, NQ_DEL}, /* '*' */ + {NQ_A, NQ_A, NQ_DEL, NQ_ASIS, NQ_P_QQ, NQ_DEL}, /* '+' */ + {NQ_DEL, NQ_AQ, NQ_AQ, NQ_DEL, NQ_AQ, NQ_AQ}, /* '??' */ + {NQ_DEL, NQ_DEL, NQ_DEL, NQ_DEL, NQ_DEL, NQ_DEL}, /* '*?' */ + {NQ_ASIS, NQ_PQ_Q, NQ_DEL, NQ_AQ, NQ_AQ, NQ_DEL} /* '+?' */ + }; + + int pnum, cnum; + QualifierNode *p, *c; + + p = &(NQUALIFIER(pnode)); + c = &(NQUALIFIER(cnode)); + pnum = popular_qualifier_num(p); + cnum = popular_qualifier_num(c); + + switch(reduces[cnum][pnum]) { + case NQ_DEL: + *p = *c; + break; + case NQ_A: + p->target = c->target; + p->lower = 0; p->upper = REPEAT_INFINITE; p->greedy = 1; + break; + case NQ_AQ: + p->target = c->target; + p->lower = 0; p->upper = REPEAT_INFINITE; p->greedy = 0; + break; + case NQ_QQ: + p->target = c->target; + p->lower = 0; p->upper = 1; p->greedy = 0; + break; + case NQ_P_QQ: + p->target = cnode; + p->lower = 0; p->upper = 1; p->greedy = 0; + c->lower = 1; c->upper = REPEAT_INFINITE; c->greedy = 1; + return ; + break; + case NQ_PQ_Q: + p->target = cnode; + p->lower = 0; p->upper = 1; p->greedy = 1; + c->lower = 1; c->upper = REPEAT_INFINITE; c->greedy = 0; + return ; + break; + case NQ_ASIS: + p->target = cnode; + return ; + break; + } + + c->target = NULL_NODE; + regex_node_free(cnode); +} + + +enum TokenSyms { + TK_EOT = 0, /* end of token */ + TK_BYTE = 1, + TK_RAW_BYTE = 2, + TK_WC, + TK_ANYCHAR, + TK_CHAR_TYPE, + TK_BACKREF, + TK_CALL, + TK_ANCHOR, + TK_OP_REPEAT, + TK_INTERVAL, + TK_ALT, + TK_SUBEXP_OPEN, + TK_SUBEXP_CLOSE, + TK_CC_OPEN, + TK_QUOTE_OPEN, + /* in cc */ + TK_CC_CLOSE, + TK_CC_RANGE, + TK_POSIX_BRACKET_OPEN, + TK_CC_AND, /* && */ + TK_CC_CC_OPEN /* [ */ +}; + +typedef struct { + enum TokenSyms type; + int escaped; + int base; /* is number: 8, 16 (used in [....]) */ + UChar* backp; + union { + int c; + WCINT wc; + int anchor; + int subtype; + struct { + int lower; + int upper; + int greedy; + int possessive; + } repeat; + struct { + int num; + int ref1; + int* refs; + } backref; + struct { + UChar* name; + UChar* name_end; + } call; + } u; +} RegToken; + + +static int +fetch_range_qualifier(UChar** src, UChar* end, RegToken* tok, ScanEnv* env) +{ + int low, up, syn_allow; + int c; + UChar* p = *src; + + syn_allow = IS_SYNTAX_BV(env->syntax, REG_SYN_ALLOW_INVALID_INTERVAL); + + if (PEND) { + if (syn_allow) + return 1; /* "....{" : OK! */ + else + return REGERR_END_PATTERN_AT_LEFT_BRACE; /* "....{" syntax error */ + } + + if (! syn_allow) { + c = PPEEK; + if (c == ')' || c == '(' || c == '|') { + return REGERR_END_PATTERN_AT_LEFT_BRACE; + } + } + + low = regex_scan_unsigned_number(&p, end, env->enc); + if (low < 0) return REGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE; + if (low > REG_MAX_REPEAT_NUM) + return REGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE; + + if (p == *src) goto invalid; /* can't read low */ + + if (PEND) goto invalid; + PFETCH(c); + if (c == ',') { + UChar* prev = p; + up = regex_scan_unsigned_number(&p, end, env->enc); + if (up < 0) return REGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE; + if (up > REG_MAX_REPEAT_NUM) + return REGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE; + + if (p == prev) up = REPEAT_INFINITE; /* {n,} : {n,infinite} */ + } + else { + PUNFETCH; + up = low; /* {n} : exact n times */ + } + + if (PEND) goto invalid; + PFETCH(c); + if (IS_SYNTAX_OP(env->syntax, REG_SYN_OP_ESC_INTERVAL)) { + if (c != '\\') goto invalid; + PFETCH(c); + } + if (c != '}') goto invalid; + + if (!IS_REPEAT_INFINITE(up) && low > up) { + return REGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE; + } + + tok->type = TK_INTERVAL; + tok->u.repeat.lower = low; + tok->u.repeat.upper = up; + *src = p; + return 0; + + invalid: + if (syn_allow) + return 1; /* OK */ + else + return REGERR_INVALID_REPEAT_RANGE_PATTERN; +} + +/* \M-, \C-, \c, or \... */ +static int +fetch_escaped_value(UChar** src, UChar* end, ScanEnv* env) +{ + int c; + UChar* p = *src; + + if (PEND) return REGERR_END_PATTERN_AT_BACKSLASH; + + PFETCH(c); + switch (c) { + case 'M': + if (IS_SYNTAX_OP2(env->syntax, REG_SYN_OP2_ESC_M_BAR_META)) { + if (PEND) return REGERR_END_PATTERN_AT_META; + PFETCH(c); + if (c != '-') return REGERR_META_CODE_SYNTAX; + if (PEND) return REGERR_END_PATTERN_AT_META; + PFETCH(c); + if (c == '\\') { + c = fetch_escaped_value(&p, end, env); + if (c < 0) return c; + } + c = ((c & 0xff) | 0x80); + } + else + goto backslash; + break; + + case 'C': + if (IS_SYNTAX_OP2(env->syntax, REG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL)) { + if (PEND) return REGERR_END_PATTERN_AT_CONTROL; + PFETCH(c); + if (c != '-') return REGERR_CONTROL_CODE_SYNTAX; + goto control; + } + else + goto backslash; + + case 'c': + if (IS_SYNTAX_OP(env->syntax, REG_SYN_OP_ESC_C_CONTROL)) { + control: + if (PEND) return REGERR_END_PATTERN_AT_CONTROL; + PFETCH(c); + if (c == '\\') { + c = fetch_escaped_value(&p, end, env); + if (c < 0) return c; + } + else if (c == '?') + c = 0177; + else + c &= 0x9f; + break; + } + /* fall through */ + + default: + { + backslash: + c = conv_backslash_value(c, env); + } + break; + } + + *src = p; + return c; +} + +static int fetch_token(RegToken* tok, UChar** src, UChar* end, ScanEnv* env); + +#ifdef USE_NAMED_SUBEXP +static int +fetch_name(UChar** src, UChar* end, UChar** name_end, ScanEnv* env) +{ + int len; + int c = 0; + UChar *p = *src; + + while (!PEND) { + *name_end = p; + PFETCH(c); + if (c == '>') break; + else if (c == ')' || c == '\\' || c == '\0') + return REGERR_INVALID_SUBEXP_NAME; + + len = mblen(env->enc, c); + while (!PEND && len-- > 1) { + PFETCH(c); + } + } + if (c != '>') return REGERR_INVALID_SUBEXP_NAME; + *src = p; + return 0; +} +#endif + +static void +CC_ESC_WARN(ScanEnv* env, UChar *c) +{ +#ifdef WARNING + if (IS_SYNTAX_BV(env->syntax, REG_SYN_WARN_FOR_CC_OP_NOT_ESCAPED) && + IS_SYNTAX_BV(env->syntax, REG_SYN_ESCAPE_IN_CC)) { + char buf[WARN_BUFSIZE]; + regex_snprintf_with_pattern(buf, WARN_BUFSIZE, env->enc, + env->pattern, env->pattern_end, + "character class has '%s' without escape", c); + WARNING(buf); + } +#endif +} + +static void +CCEND_ESC_WARN(ScanEnv* env, UChar* c) +{ +#ifdef WARNING + if (IS_SYNTAX_BV((env)->syntax, REG_SYN_WARN_FOR_CC_OP_NOT_ESCAPED)) { + char buf[WARN_BUFSIZE]; + regex_snprintf_with_pattern(buf, WARN_BUFSIZE, (env)->enc, + (env)->pattern, (env)->pattern_end, + "regular expression has '%s' without escape", c); + WARNING(buf); + } +#endif +} + +static UChar* +find_str_position(WCINT s[], int n, UChar* from, UChar* to, UChar **next, + RegCharEncoding enc) +{ + int i; + WCINT x; + UChar *q; + UChar *p = from; + + while (p < to) { + x = mb2wc(p, to, enc); + q = p + mblen(enc, *p); + if (x == s[0]) { + for (i = 1; i < n && q < to; i++) { + x = mb2wc(q, to, enc); + if (x != s[i]) break; + q += mblen(enc, *q); + } + if (i >= n) { + if (IS_NOT_NULL(next)) + *next = q; + return p; + } + } + p = q; + } + return NULL_UCHARP; +} + +static int +str_exist_check_with_esc(WCINT s[], int n, UChar* from, UChar* to, + WCINT bad, RegCharEncoding enc) +{ + int i, in_esc; + WCINT x; + UChar *q; + UChar *p = from; + + in_esc = 0; + while (p < to) { + if (in_esc) { + in_esc = 0; + p += mblen(enc, *p); + } + else { + x = mb2wc(p, to, enc); + q = p + mblen(enc, *p); + if (x == s[0]) { + for (i = 1; i < n && q < to; i++) { + x = mb2wc(q, to, enc); + if (x != s[i]) break; + q += mblen(enc, *q); + } + if (i >= n) return 1; + p += mblen(enc, *p); + } + else { + x = mb2wc(p, to, enc); + if (x == bad) return 0; + else if (x == '\\') in_esc = 1; + p = q; + } + } + } + return 0; +} + +static int +fetch_token_in_cc(RegToken* tok, UChar** src, UChar* end, ScanEnv* env) +{ + int c, num; + RegSyntaxType* syn = env->syntax; + UChar* prev; + UChar* p = *src; + + if (PEND) { + tok->type = TK_EOT; + return tok->type; + } + + PFETCH(c); + tok->type = TK_BYTE; + tok->base = 0; + tok->u.c = c; + if (c == ']') { + tok->type = TK_CC_CLOSE; + } + else if (c == '-') { + tok->type = TK_CC_RANGE; + } + else if (c == '\\') { + if (! IS_SYNTAX_BV(syn, REG_SYN_ESCAPE_IN_CC)) + goto end; + + if (PEND) return REGERR_END_PATTERN_AT_BACKSLASH; + + PFETCH(c); + tok->escaped = 1; + tok->u.c = c; + switch (c) { + case 'w': + tok->type = TK_CHAR_TYPE; + tok->u.subtype = CTYPE_WORD; + break; + case 'W': + tok->type = TK_CHAR_TYPE; + tok->u.subtype = CTYPE_NOT_WORD; + break; + case 'd': + tok->type = TK_CHAR_TYPE; + tok->u.subtype = CTYPE_DIGIT; + break; + case 'D': + tok->type = TK_CHAR_TYPE; + tok->u.subtype = CTYPE_NOT_DIGIT; + break; + case 's': + tok->type = TK_CHAR_TYPE; + tok->u.subtype = CTYPE_WHITE_SPACE; + break; + case 'S': + tok->type = TK_CHAR_TYPE; + tok->u.subtype = CTYPE_NOT_WHITE_SPACE; + break; + + case 'x': + if (PEND) break; + + prev = p; + if (PPEEK == '{' && IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_X_BRACE_HEX8)) { + PINC; + num = scan_unsigned_hexadecimal_number(&p, end, 8, env->enc); + if (num < 0) return REGERR_TOO_BIG_WIDE_CHAR_VALUE; + if (!PEND && IS_XDIGIT(*p) && p - prev >= 9) + return REGERR_TOO_LONG_WIDE_CHAR_VALUE; + + if (p > prev + 1 && !PEND && PPEEK == '}') { + PINC; + tok->type = TK_WC; + tok->base = 16; + tok->u.wc = (WCINT )num; + } + else { + /* can't read nothing or invalid format */ + p = prev; + } + } + else if (IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_X_HEX2)) { + num = scan_unsigned_hexadecimal_number(&p, end, 2, env->enc); + if (num < 0) return REGERR_TOO_BIG_NUMBER; + if (p == prev) { /* can't read nothing. */ + num = 0; /* but, it's not error */ + } + tok->type = TK_RAW_BYTE; + tok->base = 16; + tok->u.c = num; + } + break; + + case 'u': + if (PEND) break; + + prev = p; + if (IS_SYNTAX_OP2(syn, REG_SYN_OP2_ESC_U_HEX4)) { + num = scan_unsigned_hexadecimal_number(&p, end, 4, env->enc); + if (num < 0) return REGERR_TOO_BIG_NUMBER; + if (p == prev) { /* can't read nothing. */ + num = 0; /* but, it's not error */ + } + tok->type = TK_RAW_BYTE; + tok->base = 16; + tok->u.c = num; + } + break; + + case '0': + case '1': case '2': case '3': case '4': case '5': case '6': case '7': + if (IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_OCTAL3)) { + PUNFETCH; + prev = p; + num = scan_unsigned_octal_number(&p, end, 3, env->enc); + if (num < 0) return REGERR_TOO_BIG_NUMBER; + if (p == prev) { /* can't read nothing. */ + num = 0; /* but, it's not error */ + } + tok->type = TK_RAW_BYTE; + tok->base = 8; + tok->u.c = num; + } + break; + + default: + PUNFETCH; + num = fetch_escaped_value(&p, end, env); + if (num < 0) return num; + if (tok->u.c != num) { + tok->u.c = num; + tok->type = TK_RAW_BYTE; + } + break; + } + } + else if (c == '[') { + if (IS_SYNTAX_OP(syn, REG_SYN_OP_POSIX_BRACKET) && PPEEK == ':') { + WCINT send[] = { (WCINT )':', (WCINT )']' }; + tok->backp = p; /* point at '[' is readed */ + PINC; + if (str_exist_check_with_esc(send, 2, p, end, (WCINT )']', env->enc)) { + tok->type = TK_POSIX_BRACKET_OPEN; + } + else { + PUNFETCH; + goto cc_in_cc; + } + } + else { + cc_in_cc: + if (IS_SYNTAX_OP2(syn, REG_SYN_OP2_CCLASS_SET)) { + tok->type = TK_CC_CC_OPEN; + } + else { + CC_ESC_WARN(env, "["); + } + } + } + else if (c == '&') { + if (IS_SYNTAX_OP2(syn, REG_SYN_OP2_CCLASS_SET) && !PEND && PPEEK == '&') { + PINC; + tok->type = TK_CC_AND; + } + } + + end: + *src = p; + return tok->type; +} + +static int +fetch_token(RegToken* tok, UChar** src, UChar* end, ScanEnv* env) +{ + int r, c, num; + RegSyntaxType* syn = env->syntax; + UChar* prev; + UChar* p = *src; + + start: + if (PEND) { + tok->type = TK_EOT; + return tok->type; + } + + tok->type = TK_BYTE; + tok->base = 0; + PFETCH(c); + if (c == '\\') { + if (PEND) return REGERR_END_PATTERN_AT_BACKSLASH; + + PFETCH(c); + tok->u.c = c; + tok->escaped = 1; + switch (c) { + case '*': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_0INF)) break; + tok->type = TK_OP_REPEAT; + tok->u.repeat.lower = 0; + tok->u.repeat.upper = REPEAT_INFINITE; + goto greedy_check; + break; + + case '+': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_1INF)) break; + tok->type = TK_OP_REPEAT; + tok->u.repeat.lower = 1; + tok->u.repeat.upper = REPEAT_INFINITE; + goto greedy_check; + break; + + case '?': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_01)) break; + tok->type = TK_OP_REPEAT; + tok->u.repeat.lower = 0; + tok->u.repeat.upper = 1; + greedy_check: + if (!PEND && PPEEK == '?' && IS_SYNTAX_OP(syn, REG_SYN_OP_NON_GREEDY)) { + PFETCH(c); + tok->u.repeat.greedy = 0; + tok->u.repeat.possessive = 0; + } + else if (!PEND && PPEEK == '+' && + ((IS_SYNTAX_OP2(syn, REG_SYN_OP2_POSSESSIVE_REPEAT) && + tok->type != TK_INTERVAL) || + (IS_SYNTAX_OP2(syn, REG_SYN_OP2_POSSESSIVE_INTERVAL) && + tok->type == TK_INTERVAL))) { + PFETCH(c); + tok->u.repeat.greedy = 1; + tok->u.repeat.possessive = 1; + } + else { + tok->u.repeat.greedy = 1; + tok->u.repeat.possessive = 0; + } + break; + + case '{': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_INTERVAL)) break; + tok->backp = p; + r = fetch_range_qualifier(&p, end, tok, env); + if (r < 0) return r; /* error */ + if (r > 0) { + /* normal char */ + } + else + goto greedy_check; + break; + + case '|': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_ALT)) break; + tok->type = TK_ALT; + break; + + case '(': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_SUBEXP)) break; + tok->type = TK_SUBEXP_OPEN; + break; + + case ')': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_SUBEXP)) break; + tok->type = TK_SUBEXP_CLOSE; + break; + + case 'w': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_WORD)) break; + tok->type = TK_CHAR_TYPE; + tok->u.subtype = CTYPE_WORD; + break; + + case 'W': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_WORD)) break; + tok->type = TK_CHAR_TYPE; + tok->u.subtype = CTYPE_NOT_WORD; + break; + + case 'b': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_WORD_BOUND)) break; + tok->type = TK_ANCHOR; + tok->u.anchor = ANCHOR_WORD_BOUND; + break; + + case 'B': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_WORD_BOUND)) break; + tok->type = TK_ANCHOR; + tok->u.anchor = ANCHOR_NOT_WORD_BOUND; + break; + +#ifdef USE_WORD_BEGIN_END + case '<': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_WORD_BEGIN_END)) break; + tok->type = TK_ANCHOR; + tok->u.anchor = ANCHOR_WORD_BEGIN; + break; + + case '>': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_WORD_BEGIN_END)) break; + tok->type = TK_ANCHOR; + tok->u.anchor = ANCHOR_WORD_END; + break; +#endif + + case 's': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_WHITE_SPACE)) break; + tok->type = TK_CHAR_TYPE; + tok->u.subtype = CTYPE_WHITE_SPACE; + break; + + case 'S': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_WHITE_SPACE)) break; + tok->type = TK_CHAR_TYPE; + tok->u.subtype = CTYPE_NOT_WHITE_SPACE; + break; + + case 'd': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_DIGIT)) break; + tok->type = TK_CHAR_TYPE; + tok->u.subtype = CTYPE_DIGIT; + break; + + case 'D': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_DIGIT)) break; + tok->type = TK_CHAR_TYPE; + tok->u.subtype = CTYPE_NOT_DIGIT; + break; + + case 'A': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_BUF_ANCHOR)) break; + begin_buf: + tok->type = TK_ANCHOR; + tok->u.subtype = ANCHOR_BEGIN_BUF; + break; + + case 'Z': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_BUF_ANCHOR)) break; + tok->type = TK_ANCHOR; + tok->u.subtype = ANCHOR_SEMI_END_BUF; + break; + + case 'z': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_BUF_ANCHOR)) break; + end_buf: + tok->type = TK_ANCHOR; + tok->u.subtype = ANCHOR_END_BUF; + break; + + case 'G': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_BUF_ANCHOR)) break; + tok->type = TK_ANCHOR; + tok->u.subtype = ANCHOR_BEGIN_POSITION; + break; + + case '`': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_GNU_BUF_ANCHOR)) break; + goto begin_buf; + break; + + case '\'': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_GNU_BUF_ANCHOR)) break; + goto end_buf; + break; + + case 'x': + if (PEND) break; + + prev = p; + if (PPEEK == '{' && IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_X_BRACE_HEX8)) { + PINC; + num = scan_unsigned_hexadecimal_number(&p, end, 8, env->enc); + if (num < 0) return REGERR_TOO_BIG_WIDE_CHAR_VALUE; + if (!PEND && IS_XDIGIT(*p) && p - prev >= 9) + return REGERR_TOO_LONG_WIDE_CHAR_VALUE; + + if (p > prev + 1 && !PEND && PPEEK == '}') { + PINC; + tok->type = TK_WC; + tok->u.wc = (WCINT )num; + } + else { + /* can't read nothing or invalid format */ + p = prev; + } + } + else if (IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_X_HEX2)) { + num = scan_unsigned_hexadecimal_number(&p, end, 2, env->enc); + if (num < 0) return REGERR_TOO_BIG_NUMBER; + if (p == prev) { /* can't read nothing. */ + num = 0; /* but, it's not error */ + } + tok->type = TK_RAW_BYTE; + tok->base = 16; + tok->u.c = num; + } + break; + + case 'u': + if (PEND) break; + + prev = p; + if (IS_SYNTAX_OP2(syn, REG_SYN_OP2_ESC_U_HEX4)) { + num = scan_unsigned_hexadecimal_number(&p, end, 4, env->enc); + if (num < 0) return REGERR_TOO_BIG_NUMBER; + if (p == prev) { /* can't read nothing. */ + num = 0; /* but, it's not error */ + } + tok->type = TK_RAW_BYTE; + tok->base = 16; + tok->u.c = num; + } + break; + + case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + PUNFETCH; + prev = p; + num = regex_scan_unsigned_number(&p, end, env->enc); + if (num < 0) return REGERR_TOO_BIG_NUMBER; + if (num > REG_MAX_BACKREF_NUM) return REGERR_TOO_BIG_BACKREF_NUMBER; + + if (IS_SYNTAX_OP(syn, REG_SYN_OP_BACK_REF) && + (num <= env->num_mem || num <= 9)) { /* This spec. from GNU regex */ + if (IS_SYNTAX_BV(syn, REG_SYN_STRICT_CHECK_BACKREF)) { + if (num > env->num_mem || IS_NULL(SCANENV_MEM_NODES(env)[num])) + return REGERR_INVALID_BACKREF; + } + + tok->type = TK_BACKREF; + tok->u.backref.num = 1; + tok->u.backref.ref1 = num; + break; + } + else if (c == '8' || c == '9') { + /* normal char */ + p = prev; PINC; + break; + } + + p = prev; + /* fall through */ + case '0': + if (IS_SYNTAX_OP(syn, REG_SYN_OP_ESC_OCTAL3)) { + prev = p; + num = scan_unsigned_octal_number(&p, end, (c == '0' ? 2:3), env->enc); + if (num < 0) return REGERR_TOO_BIG_NUMBER; + if (p == prev) { /* can't read nothing. */ + num = 0; /* but, it's not error */ + } + tok->type = TK_RAW_BYTE; + tok->base = 8; + tok->u.c = num; + } + else if (c != '0') { + PINC; + } + break; + +#ifdef USE_NAMED_SUBEXP + case 'k': + if (IS_SYNTAX_OP2(syn, REG_SYN_OP2_NAMED_SUBEXP)) { + PFETCH(c); + if (c == '<') { + UChar* name_end; + int* backs; + + prev = p; + r = fetch_name(&p, end, &name_end, env); + if (r < 0) return r; + num = regex_name_to_group_numbers(env->reg, prev, name_end, &backs); + if (num <= 0) { + regex_scan_env_set_error_string(env, + REGERR_UNDEFINED_NAME_REFERENCE, prev, name_end); + return REGERR_UNDEFINED_NAME_REFERENCE; + } + if (IS_SYNTAX_BV(syn, REG_SYN_STRICT_CHECK_BACKREF)) { + int i; + for (i = 0; i < num; i++) { + if (backs[i] > env->num_mem || + IS_NULL(SCANENV_MEM_NODES(env)[backs[i]])) + return REGERR_INVALID_BACKREF; + } + } + + tok->type = TK_BACKREF; + if (num == 1) { + tok->u.backref.num = 1; + tok->u.backref.ref1 = backs[0]; + } + else { + tok->u.backref.num = num; + tok->u.backref.refs = backs; + } + } + else + PUNFETCH; + } + break; +#endif + +#ifdef USE_SUBEXP_CALL + case 'g': + if (IS_SYNTAX_OP2(syn, REG_SYN_OP2_SUBEXP_CALL)) { + PFETCH(c); + if (c == '<') { + UChar* name_end; + + prev = p; + r = fetch_name(&p, end, &name_end, env); + if (r < 0) return r; + + tok->type = TK_CALL; + tok->u.call.name = prev; + tok->u.call.name_end = name_end; + } + else + PUNFETCH; + } + break; +#endif + + case 'Q': + if (IS_SYNTAX_OP(syn, REG_SYN_OP_QUOTE)) { + tok->type = TK_QUOTE_OPEN; + } + break; + + default: + PUNFETCH; + num = fetch_escaped_value(&p, end, env); + if (num < 0) return num; + /* set_raw: */ + if (tok->u.c != num) { + tok->type = TK_RAW_BYTE; + tok->u.c = num; + } + break; + } + } + else { + tok->u.c = c; + tok->escaped = 0; + + switch (c) { + case '.': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ANYCHAR)) break; + tok->type = TK_ANYCHAR; + break; + + case '*': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_0INF)) break; + tok->type = TK_OP_REPEAT; + tok->u.repeat.lower = 0; + tok->u.repeat.upper = REPEAT_INFINITE; + goto greedy_check; + break; + + case '+': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_1INF)) break; + tok->type = TK_OP_REPEAT; + tok->u.repeat.lower = 1; + tok->u.repeat.upper = REPEAT_INFINITE; + goto greedy_check; + break; + + case '?': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_01)) break; + tok->type = TK_OP_REPEAT; + tok->u.repeat.lower = 0; + tok->u.repeat.upper = 1; + goto greedy_check; + break; + + case '{': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_INTERVAL)) break; + tok->backp = p; + r = fetch_range_qualifier(&p, end, tok, env); + if (r < 0) return r; /* error */ + if (r > 0) { + /* normal char */ + } + else + goto greedy_check; + break; + + case '|': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_ALT)) break; + tok->type = TK_ALT; + break; + + case '(': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_SUBEXP)) break; + tok->type = TK_SUBEXP_OPEN; + break; + + case ')': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_SUBEXP)) break; + tok->type = TK_SUBEXP_CLOSE; + break; + + case '^': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_LINE_ANCHOR)) break; + tok->type = TK_ANCHOR; + tok->u.subtype = (IS_SINGLELINE(env->option) + ? ANCHOR_BEGIN_BUF : ANCHOR_BEGIN_LINE); + break; + + case '$': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_LINE_ANCHOR)) break; + tok->type = TK_ANCHOR; + tok->u.subtype = (IS_SINGLELINE(env->option) + ? ANCHOR_END_BUF : ANCHOR_END_LINE); + break; + + case '[': + if (! IS_SYNTAX_OP(syn, REG_SYN_OP_CC)) break; + tok->type = TK_CC_OPEN; + break; + + case ']': + if (*src > env->pattern) /* /].../ is allowed. */ + CCEND_ESC_WARN(env, "]"); + break; + + case '#': + if (IS_EXTEND(env->option)) { + while (!PEND) { + PFETCH(c); + if (IS_NEWLINE(c)) + break; + } + goto start; + break; + } + break; + + case ' ': case '\t': case '\n': case '\r': case '\f': + if (IS_EXTEND(env->option)) + goto start; + break; + + default: + break; + } + } + + *src = p; + return tok->type; +} + +static void +bitset_by_pred_func(BitSetRef bs, int (*pf)(RegCharEncoding, UChar), + RegCharEncoding code, int not) +{ + int c; + + if (not) { + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (! pf(code, (UChar )c)) BITSET_SET_BIT(bs, c); + } + } + else { + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (pf(code, (UChar )c)) BITSET_SET_BIT(bs, c); + } + } +} + +typedef struct { + UChar *name; + int (*pf)(RegCharEncoding, UChar); + short int len; +} PosixBracketEntryType; + +static int +parse_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ScanEnv* env) +{ +#define POSIX_BRACKET_CHECK_LIMIT_LENGTH 20 +#define POSIX_BRACKET_NAME_MAX_LEN 6 + + static PosixBracketEntryType PBS[] = { + { "alnum", is_code_alnum, 5 }, + { "alpha", is_code_alpha, 5 }, + { "blank", is_code_blank, 5 }, + { "cntrl", is_code_cntrl, 5 }, + { "digit", is_code_digit, 5 }, + { "graph", is_code_graph, 5 }, + { "lower", is_code_lower, 5 }, + { "print", is_code_print, 5 }, + { "punct", is_code_punct, 5 }, + { "space", is_code_space, 5 }, + { "upper", is_code_upper, 5 }, + { "xdigit", is_code_xdigit, 6 }, + { "ascii", is_code_ascii, 5 }, /* I don't know origin. Perl? */ + { (UChar* )NULL, is_code_alnum, 0 } + }; + + PosixBracketEntryType *pb; + int not, i, c; + UChar *p = *src; + + if (PPEEK == '^') { + PINC; + not = 1; + } + else + not = 0; + + if (end - p < POSIX_BRACKET_NAME_MAX_LEN + 1) + goto not_posix_bracket; + + for (pb = PBS; IS_NOT_NULL(pb->name); pb++) { + if (k_strncmp(p, pb->name, pb->len) == 0) { + p += pb->len; + if (end - p < 2 || *p != ':' || *(p+1) != ']') + return REGERR_INVALID_POSIX_BRACKET_TYPE; + + bitset_by_pred_func(cc->bs, pb->pf, env->enc, not); + PINC; PINC; + *src = p; + return 0; + } + } + + not_posix_bracket: + c = 0; + i = 0; + while (!PEND && ((c = PPEEK) != ':') && c != ']') { + PINC; + if (++i > POSIX_BRACKET_CHECK_LIMIT_LENGTH) break; + } + if (c == ':' && !PEND) { + PINC; + if (!PEND) { + PFETCH(c); + if (c == ']') + return REGERR_INVALID_POSIX_BRACKET_TYPE; + } + } + + return 1; /* 1: is not POSIX bracket, but no error. */ +} + + +enum CCSTATE { + CCS_VALUE, + CCS_RANGE, + CCS_COMPLETE, + CCS_START +}; + +enum CCVALTYPE { + CCV_SB, + CCV_WC, + CCV_CLASS +}; + +static int +next_state_class(CClassNode* cc, RegToken* tok, WCINT* vs, + enum CCVALTYPE* type, enum CCSTATE* state, ScanEnv* env) +{ + int r, c; + + if (*state == CCS_RANGE) + return REGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE; + + if (*state == CCS_VALUE && *type != CCV_CLASS) { + if (*type == CCV_SB) + BITSET_SET_BIT(cc->bs, (int )(*vs)); + else if (*type == CCV_WC) { + r = add_wc_range(&(cc->mbuf), env, *vs, *vs); + if (r < 0) return r; + } + } + + if (tok->type == TK_CHAR_TYPE) { + switch (tok->u.subtype) { + case CTYPE_WORD: + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (IS_CODE_WORD(env->enc, c)) BITSET_SET_BIT(cc->bs, c); + } + ADD_ALL_MULTI_BYTE_RANGE(env->enc, cc->mbuf); + break; + case CTYPE_NOT_WORD: + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (! IS_CODE_WORD(env->enc, c)) BITSET_SET_BIT(cc->bs, c); + } + break; + case CTYPE_WHITE_SPACE: + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (IS_CODE_SPACE(env->enc, c)) BITSET_SET_BIT(cc->bs, c); + } + break; + case CTYPE_NOT_WHITE_SPACE: + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (! IS_CODE_SPACE(env->enc, c)) BITSET_SET_BIT(cc->bs, c); + } + ADD_ALL_MULTI_BYTE_RANGE(env->enc, cc->mbuf); + break; + case CTYPE_DIGIT: + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (IS_CODE_DIGIT(env->enc, c)) BITSET_SET_BIT(cc->bs, c); + } + break; + case CTYPE_NOT_DIGIT: + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (! IS_CODE_DIGIT(env->enc, c)) BITSET_SET_BIT(cc->bs, c); + } + ADD_ALL_MULTI_BYTE_RANGE(env->enc, cc->mbuf); + break; + default: + return REGERR_PARSER_BUG; + break; + } + } + else { /* TK_POSIX_BRACKET_OPEN */ + /* nothing */ + } + + *state = CCS_VALUE; + *type = CCV_CLASS; + return 0; +} + +static int +next_state_val(CClassNode* cc, WCINT *vs, WCINT v, int* vs_israw, int v_israw, + enum CCVALTYPE intype, enum CCVALTYPE* type, + enum CCSTATE* state, ScanEnv* env) +{ + int r; + + switch (*state) { + case CCS_VALUE: + if (*type == CCV_SB) + BITSET_SET_BIT(cc->bs, (int )(*vs)); + else if (*type == CCV_WC) { + r = add_wc_range(&(cc->mbuf), env, *vs, *vs); + if (r < 0) return r; + } + break; + + case CCS_RANGE: + if (intype == *type) { + if (intype == CCV_SB) { + if (IS_IGNORECASE(env->option) && (*vs_israw == 0 && v_israw == 0)) { + int low, high; + + low = TOLOWER(env->enc, *vs); + high = TOLOWER(env->enc, v); + if (low > high) { + if (IS_SYNTAX_BV(env->syntax, REG_SYN_ALLOW_EMPTY_RANGE_IN_CC)) + goto ccs_range_end; + else + return REGERR_EMPTY_RANGE_IN_CHAR_CLASS; + } + + if (low < 'A' && high >= 'a' && high <= 'z') { + bitset_set_range(cc->bs, low, (int )'A' - 1); + bitset_set_range(cc->bs, (int )'a', high); + } + else if (high > 'z' && low >= 'a' && low <= 'z') { + bitset_set_range(cc->bs, low, (int )'z'); + bitset_set_range(cc->bs, (int )'z' + 1, high); + } + else { + bitset_set_range(cc->bs, low, high); + } + } + else { + if (*vs > v) { + if (IS_SYNTAX_BV(env->syntax, REG_SYN_ALLOW_EMPTY_RANGE_IN_CC)) + goto ccs_range_end; + else + return REGERR_EMPTY_RANGE_IN_CHAR_CLASS; + } + bitset_set_range(cc->bs, (int )*vs, (int )v); + } + } + else { + r = add_wc_range(&(cc->mbuf), env, *vs, v); + if (r < 0) return r; + } + } + else { +#ifndef REG_RUBY_M17N + if (env->enc == REGCODE_UTF8 && intype == CCV_WC && *type == CCV_SB) { + bitset_set_range(cc->bs, (int )*vs, 0x7f); + r = add_wc_range(&(cc->mbuf), env, (WCINT )0x80, v); + if (r < 0) return r; + } + else +#endif + return REGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE; + } + ccs_range_end: + *state = CCS_COMPLETE; + break; + + case CCS_COMPLETE: + case CCS_START: + *state = CCS_VALUE; + break; + + default: + break; + } + + *vs_israw = v_israw; + *vs = v; + *type = intype; + return 0; +} + +static int +char_exist_check(UChar c, UChar* from, UChar* to, int ignore_escaped, + RegCharEncoding enc) +{ + int in_esc; + UChar* p = from; + + in_esc = 0; + while (p < to) { + if (ignore_escaped && in_esc) { + in_esc = 0; + } + else { + if (*p == c) return 1; + if (*p == '\\') in_esc = 1; + } + p += mblen(enc, *p); + } + return 0; +} + +static int +parse_char_class(Node** np, RegToken* tok, UChar** src, UChar* end, + ScanEnv* env) +{ + int r, neg, len, fetched, and_start; + WCINT v, vs; + UChar *p; + Node* node; + CClassNode *cc, *prev_cc; + CClassNode work_cc; + + enum CCSTATE state; + enum CCVALTYPE val_type, in_type; + int val_israw, in_israw; + + *np = NULL_NODE; + r = fetch_token_in_cc(tok, src, end, env); + if (r == TK_BYTE && tok->u.c == '^') { + neg = 1; + r = fetch_token_in_cc(tok, src, end, env); + } + else { + neg = 0; + } + + if (r < 0) return r; + if (r == TK_CC_CLOSE) { + if (! char_exist_check(']', *src, env->pattern_end, 1, env->enc)) + return REGERR_EMPTY_CHAR_CLASS; + + CC_ESC_WARN(env, "]"); + r = tok->type = TK_BYTE; /* allow []...] */ + } + + *np = node = node_new_cclass(); + CHECK_NULL_RETURN_VAL(node, REGERR_MEMORY); + cc = &(NCCLASS(node)); + prev_cc = (CClassNode* )NULL; + + and_start = 0; + state = CCS_START; + p = *src; + while (r != TK_CC_CLOSE) { + fetched = 0; + switch (r) { + case TK_BYTE: + len = mblen(env->enc, tok->u.c); + if (len > 1) { + PUNFETCH; + v = MB2WC(p, end, env->enc); + p += len; + } + else { + sb_char: + v = (WCINT )tok->u.c; + } + in_israw = 0; + goto val_entry; + break; + + case TK_RAW_BYTE: + len = mblen(env->enc, tok->u.c); + if (len > 1 && tok->base != 0) { /* tok->base != 0 : octal or hexadec. */ + UChar buf[WC2MB_MAX_BUFLEN]; + UChar* bufp = buf; + UChar* bufe = buf + WC2MB_MAX_BUFLEN; + int i, base = tok->base; + + if (len > WC2MB_MAX_BUFLEN) { + bufp = (UChar* )xmalloc(len); + if (IS_NULL(bufp)) { + r = REGERR_MEMORY; + goto err; + } + bufe = bufp + len; + } + bufp[0] = tok->u.c; + for (i = 1; i < len; i++) { + r = fetch_token_in_cc(tok, &p, end, env); + if (r < 0) goto raw_byte_err; + if (r != TK_RAW_BYTE || tok->base != base) break; + bufp[i] = tok->u.c; + } + if (i < len) { + r = REGERR_TOO_SHORT_MULTI_BYTE_STRING; + raw_byte_err: + if (bufp != buf) xfree(bufp); + goto err; + } + v = MB2WC(bufp, bufe, env->enc); + fetched = 1; + if (bufp != buf) xfree(bufp); + } + else { + v = (WCINT )tok->u.c; + } + in_israw = 1; + goto val_entry; + break; + + case TK_WC: + v = tok->u.wc; + in_israw = 1; + val_entry: + in_type = (v < SINGLE_BYTE_SIZE ? CCV_SB : CCV_WC); + r = next_state_val(cc, &vs, v, &val_israw, in_israw, in_type, &val_type, + &state, env); + if (r != 0) goto err; + break; + + case TK_POSIX_BRACKET_OPEN: + r = parse_posix_bracket(cc, &p, end, env); + if (r < 0) goto err; + if (r == 1) { /* is not POSIX bracket */ + CC_ESC_WARN(env, "["); + p = tok->backp; + v = (WCINT )tok->u.c; + in_israw = 0; + goto val_entry; + } + /* POSIX bracket fall */ + case TK_CHAR_TYPE: + r = next_state_class(cc, tok, &vs, &val_type, &state, env); + if (r != 0) goto err; + break; + + case TK_CC_RANGE: + if (state == CCS_VALUE) { + r = fetch_token_in_cc(tok, &p, end, env); + if (r < 0) goto err; + fetched = 1; + if (r == TK_CC_CLOSE) { /* allow [x-] */ + range_end_val: + v = (WCINT )'-'; + in_israw = 0; + goto val_entry; + } + else if (r == TK_CC_AND) { + CC_ESC_WARN(env, "-"); + goto range_end_val; + } + state = CCS_RANGE; + } + else if (state == CCS_START) { + /* [-xa] is allowed */ + v = (WCINT )tok->u.c; + in_israw = 0; + + r = fetch_token_in_cc(tok, &p, end, env); + if (r < 0) goto err; + fetched = 1; + /* [--x] or [a&&-x] is warned. */ + if (r == TK_CC_RANGE || and_start != 0) + CC_ESC_WARN(env, "-"); + + goto val_entry; + } + else if (state == CCS_RANGE) { + CC_ESC_WARN(env, "-"); + goto sb_char; /* [!--x] is allowed */ + } + else { /* CCS_COMPLETE */ + r = fetch_token_in_cc(tok, &p, end, env); + if (r < 0) goto err; + fetched = 1; + if (r == TK_CC_CLOSE) goto range_end_val; /* allow [a-b-] */ + else if (r == TK_CC_AND) { + CC_ESC_WARN(env, "-"); + goto range_end_val; + } + + if (IS_SYNTAX_BV(env->syntax, REG_SYN_ALLOW_RANGE_OP_IN_CC)) { + CC_ESC_WARN(env, "-"); + goto sb_char; /* [0-9-a] is allowed as [0-9\-a] */ + } + r = REGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS; + goto err; + } + break; + + case TK_CC_CC_OPEN: /* [ */ + { + Node *anode; + CClassNode* acc; + + r = parse_char_class(&anode, tok, &p, end, env); + if (r != 0) goto cc_open_err; + acc = &(NCCLASS(anode)); + r = or_cclass(cc, acc); + + cc_open_err: + regex_node_free(anode); + if (r != 0) goto err; + } + break; + + case TK_CC_AND: /* && */ + { + if (state == CCS_VALUE) { + r = next_state_val(cc, &vs, 0, &val_israw, 0, CCV_SB, + &val_type, &state, env); + if (r != 0) goto err; + } + /* initialize local variables */ + and_start = 1; + state = CCS_START; + + if (IS_NOT_NULL(prev_cc)) { + r = and_cclass(prev_cc, cc); + if (r != 0) goto err; + } + else { + prev_cc = cc; + cc = &work_cc; + } + initialize_cclass(cc); + } + break; + + case TK_EOT: + r = REGERR_PREMATURE_END_OF_CHAR_CLASS; + goto err; + break; + default: + r = REGERR_PARSER_BUG; + goto err; + break; + } + + if (fetched) + r = tok->type; + else { + r = fetch_token_in_cc(tok, &p, end, env); + if (r < 0) goto err; + } + } + + if (state == CCS_VALUE) { + r = next_state_val(cc, &vs, 0, &val_israw, 0, CCV_SB, + &val_type, &state, env); + if (r != 0) goto err; + } + + if (IS_NOT_NULL(prev_cc)) { + r = and_cclass(prev_cc, cc); + if (r != 0) goto err; + cc = prev_cc; + } + + cc->not = neg; + if (cc->not != 0 && + IS_SYNTAX_BV(env->syntax, REG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC)) { + int is_empty; + + is_empty = (IS_NULL(cc->mbuf) ? 1 : 0); + if (is_empty != 0) + BITSET_IS_EMPTY(cc->bs, is_empty); + if (is_empty == 0) + BITSET_SET_BIT(cc->bs, NEWLINE); + } + *src = p; + return 0; + + err: + regex_node_free(*np); + return r; +} + +static int parse_subexp(Node** top, RegToken* tok, int term, + UChar** src, UChar* end, ScanEnv* env); + +static int +parse_effect(Node** np, RegToken* tok, int term, UChar** src, UChar* end, + ScanEnv* env) +{ + Node *target; + RegOptionType option; + int r, c, num; + UChar* p = *src; + + *np = NULL; + if (PEND) return REGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS; + + option = env->option; + if (PPEEK == '?' && IS_SYNTAX_OP(env->syntax, REG_SYN_OP_SUBEXP_EFFECT)) { + PINC; + if (PEND) return REGERR_END_PATTERN_IN_GROUP; + + PFETCH(c); + switch (c) { + case '#': /* (?#...) comment */ + while (1) { + if (PEND) return REGERR_END_PATTERN_IN_GROUP; + PFETCH(c); + if (c == ')') break; + } + *src = p; + return 3; /* 3: comment */ + break; + + case ':': /* (?:...) grouping only */ + goto group; + break; + + case '=': + *np = regex_node_new_anchor(ANCHOR_PREC_READ); + break; + case '!': /* preceding read */ + *np = regex_node_new_anchor(ANCHOR_PREC_READ_NOT); + break; + case '>': /* (?>...) stop backtrack */ + *np = node_new_effect(EFFECT_STOP_BACKTRACK); + break; + + case '<': /* look behind (?<=...), (?<!...) */ + PFETCH(c); + if (c == '=') + *np = regex_node_new_anchor(ANCHOR_LOOK_BEHIND); + else if (c == '!') + *np = regex_node_new_anchor(ANCHOR_LOOK_BEHIND_NOT); +#ifdef USE_NAMED_SUBEXP + else if (IS_SYNTAX_OP2(env->syntax, REG_SYN_OP2_NAMED_SUBEXP)) { + UChar *name; + UChar *name_end; + PUNFETCH; + name = p; + r = fetch_name(&p, end, &name_end, env); + if (r < 0) return r; + + *np = node_new_effect(EFFECT_MEMORY); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + num = scan_env_add_mem_entry(env); + if (num < 0) return num; + NEFFECT(*np).regnum = num; + r = name_add(env->reg, name, name_end, num); + if (r != 0) return r; + } +#endif + else + return REGERR_UNDEFINED_GROUP_OPTION; + break; + +#ifdef USE_POSIXLINE_OPTION + case 'p': +#endif + case '-': case 'i': case 'm': case 's': case 'x': + { + int neg = 0; + + while (1) { + switch (c) { + case ':': + case ')': + break; + + case '-': neg = 1; break; + case 'x': ONOFF(option, REG_OPTION_EXTEND, neg); break; + case 'i': ONOFF(option, REG_OPTION_IGNORECASE, neg); break; + case 's': + if (IS_SYNTAX_OP2(env->syntax, REG_SYN_OP2_OPTION_PERL)) { + ONOFF(option, REG_OPTION_MULTILINE, neg); + } + else + return REGERR_UNDEFINED_GROUP_OPTION; + break; + + case 'm': + if (IS_SYNTAX_OP2(env->syntax, REG_SYN_OP2_OPTION_PERL)) { + ONOFF(option, REG_OPTION_SINGLELINE, (neg == 0 ? 1 : 0)); + } + else if (IS_SYNTAX_OP2(env->syntax, REG_SYN_OP2_OPTION_RUBY)) { + ONOFF(option, REG_OPTION_MULTILINE, neg); + } + else + return REGERR_UNDEFINED_GROUP_OPTION; + break; +#ifdef USE_POSIXLINE_OPTION + case 'p': + ONOFF(option, REG_OPTION_MULTILINE|REG_OPTION_SINGLELINE, neg); + break; +#endif + default: + return REGERR_UNDEFINED_GROUP_OPTION; + } + + if (c == ')') { /* option only */ + if (option == env->option) { + *np = node_new_empty(); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + *src = p; + return 0; + } + else { + *np = node_new_option(option); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + *src = p; + return 2; /* option only */ + } + } + else if (c == ':') { + if (env->option == option) { + group: + r = fetch_token(tok, &p, end, env); + if (r < 0) return r; + r = parse_subexp(np, tok, term, &p, end, env); + if (r < 0) return r; + *src = p; + return 1; /* group */ + } + else { + RegOptionType prev = env->option; + + env->option = option; + r = fetch_token(tok, &p, end, env); + if (r < 0) return r; + r = parse_subexp(&target, tok, term, &p, end, env); + env->option = prev; + if (r < 0) return r; + *np = node_new_option(option); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + NEFFECT(*np).target = target; + *src = p; + return 0; + } + } + + if (PEND) return REGERR_END_PATTERN_IN_GROUP; + PFETCH(c); + } + } + break; + + default: + return REGERR_UNDEFINED_GROUP_OPTION; + } + } + else { +#ifdef USE_NAMED_SUBEXP + if (IS_REG_OPTION_ON(env->option, REG_OPTION_CAPTURE_ONLY_NAMED_GROUP)) { + goto group; + } +#endif + *np = node_new_effect(EFFECT_MEMORY); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + num = scan_env_add_mem_entry(env); + if (num < 0) return num; + NEFFECT(*np).regnum = num; + } + + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + r = fetch_token(tok, &p, end, env); + if (r < 0) return r; + r = parse_subexp(&target, tok, term, &p, end, env); + if (r < 0) return r; + + if (NTYPE(*np) == N_ANCHOR) + NANCHOR(*np).target = target; + else + NEFFECT(*np).target = target; + + *src = p; + return 0; +} + +static int +set_qualifier(Node* qnode, Node* target, int group, ScanEnv* env) +{ + QualifierNode* qn; + + qn = &(NQUALIFIER(qnode)); + if (qn->lower == 1 && qn->upper == 1) { + return 1; + } + + switch (NTYPE(target)) { + case N_STRING: + if (! group) { + StrNode* sn = &(NSTRING(target)); + if (str_node_can_be_split(sn, env->enc)) { + Node* n = str_node_split_last_char(sn, env->enc); + if (IS_NOT_NULL(n)) { + qn->target = n; + return 2; + } + } + } + break; + + case N_QUALIFIER: + { /* check redundant double repeat. */ + /* verbose warn (?:.?)? etc... but not warn (.?)? etc... */ + QualifierNode* qnt = &(NQUALIFIER(target)); + +#ifdef USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR + if (qn->by_number == 0 && qnt->by_number == 0) { + if (IS_REPEAT_INFINITE(qn->upper)) { + if (qn->lower == 0) { /* '*' */ + redundant: + { + char buf[WARN_BUFSIZE]; + regex_snprintf_with_pattern(buf, WARN_BUFSIZE, env->enc, + env->pattern, env->pattern_end, + "redundant nested repeat operator"); + VERB_WARNING(buf); + goto warn_exit; + } + } + else if (qn->lower == 1) { /* '+' */ + /* (?:a?)+? only allowed. */ + if (qn->greedy || !(qnt->upper == 1 && qnt->greedy)) + goto redundant; + } + } + else if (qn->upper == 1 && qn->lower == 0) { + if (qn->greedy) { /* '?' */ + if (!(qnt->lower == 1 && qnt->greedy == 0)) /* not '+?' */ + goto redundant; + } + else { /* '??' */ + /* '(?:a+)?? only allowd. (?:a*)?? can be replaced to (?:a+)?? */ + if (!(qnt->greedy && qnt->lower == 1 && + IS_REPEAT_INFINITE(qnt->upper))) + goto redundant; + } + } + } +#endif + +#ifdef USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR + warn_exit: +#endif + if (popular_qualifier_num(qnt) >= 0 && popular_qualifier_num(qn) >= 0) { + reduce_nested_qualifier(qnode, target); + goto q_exit; + } + } + break; + + default: + break; + } + + qn->target = target; + q_exit: + return 0; +} + +static int +parse_exp(Node** np, RegToken* tok, int term, + UChar** src, UChar* end, ScanEnv* env) +{ + int r, len, c, group = 0; + Node* qn; + + start: + *np = NULL; + if (tok->type == term) + goto end_of_token; + + switch (tok->type) { + case TK_ALT: + case TK_EOT: + end_of_token: + *np = node_new_empty(); + return tok->type; + break; + + case TK_SUBEXP_OPEN: + r = parse_effect(np, tok, TK_SUBEXP_CLOSE, src, end, env); + if (r < 0) return r; + if (r == 1) group = 1; + else if (r == 2) { /* option only */ + Node* target; + r = fetch_token(tok, src, end, env); + if (r < 0) return r; + r = parse_subexp(&target, tok, term, src, end, env); + if (r < 0) return r; + NEFFECT(*np).target = target; + return tok->type; + } + else if (r == 3) { /* comment */ + r = fetch_token(tok, src, end, env); + if (r < 0) return r; + goto start; + } + else { + if (NTYPE(*np) == N_EFFECT && NEFFECT(*np).type == EFFECT_MEMORY) { + r = scan_env_set_mem_node(env, NEFFECT(*np).regnum, *np); + if (r != 0) return r; + } + } + break; + + case TK_SUBEXP_CLOSE: + if (! IS_SYNTAX_BV(env->syntax, REG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP)) + return REGERR_UNMATCHED_CLOSE_PARENTHESIS; + + if (tok->escaped) goto tk_raw_byte; + else goto tk_byte; + break; + + case TK_BYTE: + tk_byte: + *np = node_new_str_char((UChar )tok->u.c); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + len = mblen(env->enc, tok->u.c); + if (len > 1) { + regex_node_str_cat(*np, *src, *src + len - 1); + *src += (len - 1); + } + while (1) { + r = fetch_token(tok, src, end, env); + if (r < 0) return r; + if (r != TK_BYTE) goto repeat; + + r = node_str_cat_char(*np, (UChar )tok->u.c); + if (r < 0) return r; + len = mblen(env->enc, tok->u.c); + if (len > 1) { + regex_node_str_cat(*np, *src, *src + len - 1); + *src += (len - 1); + } + } + break; + + case TK_RAW_BYTE: + tk_raw_byte: + *np = node_new_str_raw_char((UChar )tok->u.c); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + while (1) { + r = fetch_token(tok, src, end, env); + if (r < 0) return r; + if (r != TK_RAW_BYTE) goto repeat; + + r = node_str_cat_char(*np, (UChar )tok->u.c); + if (r < 0) return r; + } + break; + + case TK_WC: + { + UChar buf[WC2MB_MAX_BUFLEN]; + UChar* bufs = buf; + UChar* bufe = bufs + WC2MB_MAX_BUFLEN; + int num = wc2mb_buf(tok->u.wc, &bufs, &bufe, env->enc); + if (num < 0) return num; + *np = node_new_str_raw(bufs, bufe); + if (bufs != buf) xfree(bufs); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + } + break; + + case TK_QUOTE_OPEN: + { + WCINT end_op[] = { (WCINT )'\\', (WCINT )'E' }; + UChar *qstart, *qend, *nextp; + + qstart = *src; + qend = find_str_position(end_op, 2, qstart, end, &nextp, env->enc); + if (IS_NULL(qend)) { + nextp = qend = end; + } + *np = node_new_str(qstart, qend); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + *src = nextp; + } + break; + + case TK_CHAR_TYPE: + switch (tok->u.subtype) { + case CTYPE_WORD: + case CTYPE_NOT_WORD: + *np = node_new_ctype(tok->u.subtype); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + break; + + case CTYPE_WHITE_SPACE: + *np = node_new_cclass(); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (IS_CODE_SPACE(env->enc, c)) BITSET_SET_BIT(NCCLASS(*np).bs, c); + } + break; + + case CTYPE_NOT_WHITE_SPACE: + *np = node_new_cclass(); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (! IS_CODE_SPACE(env->enc, c)) BITSET_SET_BIT(NCCLASS(*np).bs, c); + } + break; + + case CTYPE_DIGIT: + *np = node_new_cclass(); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (IS_CODE_DIGIT(env->enc, c)) BITSET_SET_BIT(NCCLASS(*np).bs, c); + } + break; + + case CTYPE_NOT_DIGIT: + *np = node_new_cclass(); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + for (c = 0; c < SINGLE_BYTE_SIZE; c++) { + if (! IS_CODE_DIGIT(env->enc, c)) BITSET_SET_BIT(NCCLASS(*np).bs, c); + } + break; + + default: + return REGERR_PARSER_BUG; + break; + } + break; + + case TK_CC_OPEN: + r = parse_char_class(np, tok, src, end, env); + if (r != 0) return r; + break; + + case TK_ANYCHAR: + *np = node_new_anychar(); + break; + + case TK_BACKREF: + len = tok->u.backref.num; + *np = node_new_backref(len, + (len > 1 ? tok->u.backref.refs : &(tok->u.backref.ref1)), env); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + break; + +#ifdef USE_SUBEXP_CALL + case TK_CALL: + *np = node_new_call(tok->u.call.name, tok->u.call.name_end); + CHECK_NULL_RETURN_VAL(*np, REGERR_MEMORY); + env->num_call++; + break; +#endif + + case TK_ANCHOR: + *np = regex_node_new_anchor(tok->u.anchor); + break; + + case TK_OP_REPEAT: + case TK_INTERVAL: + if (IS_SYNTAX_BV(env->syntax, REG_SYN_CONTEXT_INDEP_OPS)) { + if (IS_SYNTAX_BV(env->syntax, REG_SYN_CONTEXT_INVALID_OPS)) + return REGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED; + else + *np = node_new_empty(); + } + else { + *src = tok->backp; + goto tk_byte; + } + break; + + default: + return REGERR_PARSER_BUG; + break; + } + + re_entry: + r = fetch_token(tok, src, end, env); + if (r < 0) return r; + + repeat: + if (r == TK_OP_REPEAT || r == TK_INTERVAL) { + if (is_invalid_qualifier_target(*np)) + return REGERR_TARGET_OF_REPEAT_OPERATOR_INVALID; + + qn = node_new_qualifier(tok->u.repeat.lower, tok->u.repeat.upper, + (r == TK_INTERVAL ? 1 : 0)); + CHECK_NULL_RETURN_VAL(qn, REGERR_MEMORY); + NQUALIFIER(qn).greedy = tok->u.repeat.greedy; + r = set_qualifier(qn, *np, group, env); + if (r < 0) return r; + + if (tok->u.repeat.possessive != 0) { + Node* en; + en = node_new_effect(EFFECT_STOP_BACKTRACK); + CHECK_NULL_RETURN_VAL(en, REGERR_MEMORY); + NEFFECT(en).target = qn; + qn = en; + } + + if (r == 0) { + *np = qn; + } + else if (r == 2) { /* split case: /abc+/ */ + Node* target = *np; + *np = node_new_list(target, NULL); + NCONS(*np).right = node_new_list(qn, NULL); + } + goto re_entry; + } + + return r; +} + +static int +parse_branch(Node** top, RegToken* tok, int term, + UChar** src, UChar* end, ScanEnv* env) +{ + int r; + Node *node, **headp; + + *top = NULL; + r = parse_exp(&node, tok, term, src, end, env); + if (r < 0) return r; + + if (r == TK_EOT || r == term || r == TK_ALT) { + *top = node; + } + else { + *top = node_new_list(node, NULL); + headp = &(NCONS(*top).right); + while (r != TK_EOT && r != term && r != TK_ALT) { + r = parse_exp(&node, tok, term, src, end, env); + if (r < 0) return r; + + if (NTYPE(node) == N_LIST) { + *headp = node; + while (IS_NOT_NULL(NCONS(node).right)) node = NCONS(node).right; + headp = &(NCONS(node).right); + } + else { + *headp = node_new_list(node, NULL); + headp = &(NCONS(*headp).right); + } + } + } + + return r; +} + +/* term_tok: TK_EOT or TK_SUBEXP_CLOSE */ +static int +parse_subexp(Node** top, RegToken* tok, int term, + UChar** src, UChar* end, ScanEnv* env) +{ + int r; + Node *node, **headp; + + *top = NULL; + r = parse_branch(&node, tok, term, src, end, env); + if (r < 0) return r; + + if (r == term) { + *top = node; + } + else if (r == TK_ALT) { + *top = node_new_alt(node, NULL); + headp = &(NCONS(*top).right); + while (r == TK_ALT) { + r = fetch_token(tok, src, end, env); + if (r < 0) return r; + r = parse_branch(&node, tok, term, src, end, env); + if (r < 0) return r; + + *headp = node_new_alt(node, NULL); + headp = &(NCONS(*headp).right); + } + + if (tok->type != term) + goto err; + } + else { + err: + if (term == TK_SUBEXP_CLOSE) + return REGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS; + else + return REGERR_PARSER_BUG; + } + + return r; +} + +static int +parse_regexp(Node** top, UChar** src, UChar* end, ScanEnv* env) +{ + int r; + RegToken tok; + + r = fetch_token(&tok, src, end, env); + if (r < 0) return r; + r = parse_subexp(top, &tok, TK_EOT, src, end, env); + if (r < 0) return r; + return 0; +} + +extern int +regex_parse_make_tree(Node** root, UChar* pattern, UChar* end, regex_t* reg, + ScanEnv* env) +{ + int r; + UChar* p; + +#ifdef USE_NAMED_SUBEXP + names_clear(reg); +#endif + + scan_env_clear(env); + env->option = reg->options; + env->enc = reg->enc; + env->syntax = reg->syntax; + env->pattern = pattern; + env->pattern_end = end; + env->reg = reg; + + *root = NULL; + p = pattern; + r = parse_regexp(root, &p, end, env); + reg->num_mem = env->num_mem; + return r; +} + +extern void +regex_scan_env_set_error_string(ScanEnv* env, int ecode, + UChar* arg, UChar* arg_end) +{ + env->error = arg; + env->error_end = arg_end; +} diff --git a/ext/mbstring/oniguruma/regparse.h b/ext/mbstring/oniguruma/regparse.h new file mode 100644 index 0000000000..5a073623c9 --- /dev/null +++ b/ext/mbstring/oniguruma/regparse.h @@ -0,0 +1,255 @@ +/********************************************************************** + + regparse.h - Oniguruma (regular expression library) + + Copyright (C) 2003 K.Kosako (kosako@sofnec.co.jp) + +**********************************************************************/ +#ifndef REGPARSE_H +#define REGPARSE_H + +#include "regint.h" + +/* node type */ +#define N_STRING (1<< 0) +#define N_CCLASS (1<< 1) +#define N_CTYPE (1<< 2) +#define N_ANYCHAR (1<< 3) +#define N_BACKREF (1<< 4) +#define N_QUALIFIER (1<< 5) +#define N_EFFECT (1<< 6) +#define N_ANCHOR (1<< 7) +#define N_LIST (1<< 8) +#define N_ALT (1<< 9) +#define N_CALL (1<<10) + +#define IS_NODE_TYPE_SIMPLE(type) \ + (((type) & (N_STRING | N_CCLASS | N_CTYPE | N_ANYCHAR | N_BACKREF)) != 0) + +#define NTYPE(node) ((node)->type) +#define NCONS(node) ((node)->u.cons) +#define NSTRING(node) ((node)->u.str) +#define NCCLASS(node) ((node)->u.cclass) +#define NCTYPE(node) ((node)->u.ctype) +#define NQUALIFIER(node) ((node)->u.qualifier) +#define NANCHOR(node) ((node)->u.anchor) +#define NBACKREF(node) ((node)->u.backref) +#define NEFFECT(node) ((node)->u.effect) +#define NCALL(node) ((node)->u.call) + +#define CTYPE_WORD (1<<0) +#define CTYPE_NOT_WORD (1<<1) +#define CTYPE_WHITE_SPACE (1<<2) +#define CTYPE_NOT_WHITE_SPACE (1<<3) +#define CTYPE_DIGIT (1<<4) +#define CTYPE_NOT_DIGIT (1<<5) + + +#define ANCHOR_ANYCHAR_STAR_MASK (ANCHOR_ANYCHAR_STAR | ANCHOR_ANYCHAR_STAR_PL) +#define ANCHOR_END_BUF_MASK (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF) + +#define EFFECT_MEMORY (1<<0) +#define EFFECT_OPTION (1<<1) +#define EFFECT_STOP_BACKTRACK (1<<2) + +#define REPEAT_INFINITE -1 +#define IS_REPEAT_INFINITE(n) ((n) == REPEAT_INFINITE) + +#define NODE_STR_MARGIN 16 +#define NODE_STR_BUF_SIZE 24 /* sizeof(CClassNode) - sizeof(int)*4 */ +#define NODE_BACKREFS_SIZE 7 + +#define NSTR_RAW (1<<0) /* by backslashed number */ +#define NSTR_CASE_AMBIG (1<<1) + +#define NSTRING_LEN(node) ((node)->u.str.end - (node)->u.str.s) +#define NSTRING_SET_RAW(node) (node)->u.str.flag |= NSTR_RAW +#define NSTRING_SET_CASE_AMBIG(node) (node)->u.str.flag |= NSTR_CASE_AMBIG +#define NSTRING_IS_RAW(node) (((node)->u.str.flag & NSTR_RAW) != 0) +#define NSTRING_IS_CASE_AMBIG(node) \ + (((node)->u.str.flag & NSTR_CASE_AMBIG) != 0) + +#define BACKREFS_P(br) \ + (IS_NOT_NULL((br)->back_dynamic) ? (br)->back_dynamic : (br)->back_static); + +typedef struct { + UChar* s; + UChar* end; + unsigned int flag; + int capa; /* (allocated size - 1) or 0: use buf[] */ + UChar buf[NODE_STR_BUF_SIZE]; +} StrNode; + +typedef struct { + int not; + BitSet bs; + BBuf* mbuf; /* multi-byte info or NULL */ +} CClassNode; + +typedef struct { + struct _Node* target; + int lower; + int upper; + int greedy; + int by_number; /* {n,m} */ + int target_may_empty; /* target can match with empty data */ + struct _Node* head_exact; + struct _Node* next_head_exact; + int is_refered; /* include called node. don't eliminate even if {0} */ +} QualifierNode; + +/* status bits */ +#define NST_RECURSION (1<<0) +#define NST_CALLED (1<<1) +#define NST_ADDR_FIXED (1<<2) +#define NST_MIN_FIXED (1<<3) +#define NST_MAX_FIXED (1<<4) +#define NST_CLEN_FIXED (1<<5) +#define NST_MARK1 (1<<6) +#define NST_MARK2 (1<<7) +#define NST_MEM_BACKREFED (1<<8) +#define NST_SIMPLE_REPEAT (1<<9) /* for stop backtrack optimization */ + +#define SET_EFFECT_STATUS(node,f) (node)->u.effect.state |= (f) +#define CLEAR_EFFECT_STATUS(node,f) (node)->u.effect.state &= ~(f) + +#define IS_EFFECT_CALLED(en) (((en)->state & NST_CALLED) != 0) +#define IS_EFFECT_ADDR_FIXED(en) (((en)->state & NST_ADDR_FIXED) != 0) +#define IS_EFFECT_RECURSION(en) (((en)->state & NST_RECURSION) != 0) +#define IS_EFFECT_MARK1(en) (((en)->state & NST_MARK1) != 0) +#define IS_EFFECT_MARK2(en) (((en)->state & NST_MARK2) != 0) +#define IS_EFFECT_MIN_FIXED(en) (((en)->state & NST_MIN_FIXED) != 0) +#define IS_EFFECT_MAX_FIXED(en) (((en)->state & NST_MAX_FIXED) != 0) +#define IS_EFFECT_CLEN_FIXED(en) (((en)->state & NST_CLEN_FIXED) != 0) +#define IS_EFFECT_SIMPLE_REPEAT(en) (((en)->state & NST_SIMPLE_REPEAT) != 0) + +#define SET_CALL_RECURSION(node) (node)->u.call.state |= NST_RECURSION +#define IS_CALL_RECURSION(cn) (((cn)->state & NST_RECURSION) != 0) + +typedef struct { + int state; + int type; + int regnum; + RegOptionType option; + struct _Node* target; + AbsAddrType call_addr; + /* for multiple call reference */ + RegDistance min_len; /* min length (byte) */ + RegDistance max_len; /* max length (byte) */ + int char_len; /* character length */ + int opt_count; /* referenced count in optimize_node_left() */ +} EffectNode; + +#define CALLNODE_REFNUM_UNDEF -1 + +#ifdef USE_SUBEXP_CALL + +typedef struct { + int offset; + struct _Node* target; +} UnsetAddr; + +typedef struct { + int num; + int alloc; + UnsetAddr* us; +} UnsetAddrList; + +typedef struct { + int state; + int ref_num; + UChar* name; + UChar* name_end; + struct _Node* target; /* EffectNode : EFFECT_MEMORY */ + UnsetAddrList* unset_addr_list; +} CallNode; + +#endif + +typedef struct { + int state; + int back_num; + int back_static[NODE_BACKREFS_SIZE]; + int* back_dynamic; +} BackrefNode; + +typedef struct { + int type; + struct _Node* target; + int char_len; +} AnchorNode; + +typedef struct _Node { + int type; + union { + StrNode str; + CClassNode cclass; + QualifierNode qualifier; + EffectNode effect; +#ifdef USE_SUBEXP_CALL + CallNode call; +#endif + BackrefNode backref; + AnchorNode anchor; + struct { + struct _Node* left; + struct _Node* right; + } cons; + struct { + int type; + } ctype; + } u; +} Node; + +#define NULL_NODE ((Node* )0) + +#define SCANENV_MEMNODES_SIZE 8 +#define SCANENV_MEM_NODES(senv) \ + (IS_NOT_NULL((senv)->mem_nodes_dynamic) ? \ + (senv)->mem_nodes_dynamic : (senv)->mem_nodes_static) + +typedef struct { + RegOptionType option; + RegCharEncoding enc; + RegSyntaxType* syntax; + BitStatusType backtrack_mem; + BitStatusType backrefed_mem; + UChar* pattern; + UChar* pattern_end; + UChar* error; + UChar* error_end; + regex_t* reg; /* for reg->names only */ + int num_call; +#ifdef USE_SUBEXP_CALL + UnsetAddrList* unset_addr_list; +#endif + int num_mem; + int mem_alloc; + Node* mem_nodes_static[SCANENV_MEMNODES_SIZE]; + Node** mem_nodes_dynamic; +} ScanEnv; + + +#define IS_SYNTAX_OP(syn, opm) (((syn)->op & (opm)) != 0) +#define IS_SYNTAX_OP2(syn, opm) (((syn)->op2 & (opm)) != 0) +#define IS_SYNTAX_BV(syn, bvm) (((syn)->behavior & (bvm)) != 0) + + +extern void regex_scan_env_set_error_string P_((ScanEnv* env, int ecode, UChar* arg, UChar* arg_end)); +extern int regex_scan_unsigned_number P_((UChar** src, UChar* end, RegCharEncoding enc)); +extern void regex_node_conv_to_str_node P_((Node* node, int raw)); +extern int regex_node_str_cat P_((Node* node, UChar* s, UChar* end)); +extern void regex_node_free P_((Node* node)); +extern Node* regex_node_new_effect P_((int type)); +extern Node* regex_node_new_anchor P_((int type)); +extern int regex_free_node_list(); +extern int regex_names_free P_((regex_t* reg)); +extern int regex_parse_make_tree P_((Node** root, UChar* pattern, UChar* end, regex_t* reg, ScanEnv* env)); + +#ifdef REG_DEBUG +#ifdef USE_NAMED_SUBEXP +extern int regex_print_names(FILE*, regex_t*); +#endif +#endif + +#endif /* REGPARSE_H */ diff --git a/ext/mbstring/oniguruma/regposerr.c b/ext/mbstring/oniguruma/regposerr.c new file mode 100644 index 0000000000..007e7b65c0 --- /dev/null +++ b/ext/mbstring/oniguruma/regposerr.c @@ -0,0 +1,68 @@ +/********************************************************************** + + regposerr.c - Oniguruma (regular expression library) + + Copyright (C) 2003 K.Kosako (kosako@sofnec.co.jp) + +**********************************************************************/ +#include "config.h" +#include "onigposix.h" + +#ifdef HAVE_STRING_H +# include <string.h> +#else +# include <strings.h> +#endif + +static char* ESTRING[] = { + NULL, + "failed to match", /* REG_NOMATCH */ + "Invalid regular expression", /* REG_BADPAT */ + "invalid collating element referenced", /* REG_ECOLLATE */ + "invalid character class type referenced", /* REG_ECTYPE */ + "bad backslash-escape sequence", /* REG_EESCAPE */ + "invalid back reference number", /* REG_ESUBREG */ + "imbalanced [ and ]", /* REG_EBRACK */ + "imbalanced ( and )", /* REG_EPAREN */ + "imbalanced { and }", /* REG_EBRACE */ + "invalid repeat range {n,m}", /* REG_BADBR */ + "invalid range", /* REG_ERANGE */ + "Out of memory", /* REG_ESPACE */ + "? * + not preceded by valid regular expression", /* REG_BADRPT */ + + /* Extended errors */ + "internal error", /* REG_EONIG_INTERNAL */ + "invalid wide char value", /* REG_EONIG_BADWC */ + "invalid argument", /* REG_EONIG_BADARG */ + "multi-thread error" /* REG_EONIG_THREAD */ +}; + +#include <stdio.h> + + +extern size_t +regerror(int posix_ecode, const regex_t* reg, char* buf, size_t size) +{ + char* s; + char tbuf[35]; + size_t len; + + if (posix_ecode > 0 && posix_ecode < sizeof(ESTRING) / sizeof(ESTRING[0])) { + s = ESTRING[posix_ecode]; + } + else if (posix_ecode == 0) { + s = ""; + } + else { + sprintf(tbuf, "undefined error code (%d)", posix_ecode); + s = tbuf; + } + + len = strlen(s) + 1; + + if (buf != NULL && size > 0) { + strncpy(buf, s, size - 1); + buf[size - 1] = '\0'; + } + return len; +} diff --git a/ext/mbstring/oniguruma/regposix.c b/ext/mbstring/oniguruma/regposix.c new file mode 100644 index 0000000000..ad22338132 --- /dev/null +++ b/ext/mbstring/oniguruma/regposix.c @@ -0,0 +1,195 @@ +/********************************************************************** + + regposix.c - Oniguruma (regular expression library) + + Copyright (C) 2003 K.Kosako (kosako@sofnec.co.jp) + +**********************************************************************/ + +#define regex_t onig_regex_t +#include "regint.h" +#undef regex_t +#include "onigposix.h" + +#define ONIG_C(reg) ((onig_regex_t* )((reg)->onig)) +#define PONIG_C(reg) ((onig_regex_t** )(&(reg)->onig)) + +#if 1 +#define ENC_STRING_LEN(enc,s,len) do { \ + UChar* tmps = (UChar* )(s); \ + /* while (*tmps != 0) tmps += mblen(enc,*tmps); */ \ + while (*tmps != 0) tmps++; /* OK for UTF-8, EUC-JP, Shift_JIS */ \ + len = tmps - (UChar* )(s); \ +} while(0) +#else +#define ENC_STRING_LEN(enc,s,len) len = strlen(s) +#endif + +typedef struct { + int onig_err; + int posix_err; +} O2PERR; + +static int +onig2posix_error_code(int code) +{ + static O2PERR o2p[] = { + { REG_MISMATCH, REG_NOMATCH }, + { REG_NO_SUPPORT_CONFIG, REG_EONIG_INTERNAL }, + { REGERR_MEMORY, REG_ESPACE }, + { REGERR_MATCH_STACK_LIMIT_OVER, REG_EONIG_INTERNAL }, + { REGERR_TYPE_BUG, REG_EONIG_INTERNAL }, + { REGERR_PARSER_BUG, REG_EONIG_INTERNAL }, + { REGERR_STACK_BUG, REG_EONIG_INTERNAL }, + { REGERR_UNDEFINED_BYTECODE, REG_EONIG_INTERNAL }, + { REGERR_UNEXPECTED_BYTECODE, REG_EONIG_INTERNAL }, + { REGERR_DEFAULT_ENCODING_IS_NOT_SETTED, REG_EONIG_BADARG }, + { REGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR, REG_EONIG_BADARG }, + { REGERR_END_PATTERN_AT_LEFT_BRACE, REG_EBRACE }, + { REGERR_END_PATTERN_AT_LEFT_BRACKET, REG_EBRACK }, + { REGERR_EMPTY_CHAR_CLASS, REG_ECTYPE }, + { REGERR_PREMATURE_END_OF_CHAR_CLASS, REG_ECTYPE }, + { REGERR_END_PATTERN_AT_BACKSLASH, REG_EESCAPE }, + { REGERR_END_PATTERN_AT_META, REG_EESCAPE }, + { REGERR_END_PATTERN_AT_CONTROL, REG_EESCAPE }, + { REGERR_META_CODE_SYNTAX, REG_BADPAT }, + { REGERR_CONTROL_CODE_SYNTAX, REG_BADPAT }, + { REGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE, REG_ECTYPE }, + { REGERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE, REG_ECTYPE }, + { REGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS, REG_ECTYPE }, + { REGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED, REG_BADRPT }, + { REGERR_TARGET_OF_REPEAT_OPERATOR_INVALID, REG_BADRPT }, + { REGERR_NESTED_REPEAT_OPERATOR, REG_BADRPT }, + { REGERR_UNMATCHED_CLOSE_PARENTHESIS, REG_EPAREN }, + { REGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS, REG_EPAREN }, + { REGERR_END_PATTERN_IN_GROUP, REG_BADPAT }, + { REGERR_UNDEFINED_GROUP_OPTION, REG_BADPAT }, + { REGERR_INVALID_POSIX_BRACKET_TYPE, REG_BADPAT }, + { REGERR_INVALID_LOOK_BEHIND_PATTERN, REG_BADPAT }, + { REGERR_INVALID_REPEAT_RANGE_PATTERN, REG_BADPAT }, + { REGERR_TOO_BIG_NUMBER, REG_BADPAT }, + { REGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE, REG_BADBR }, + { REGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE, REG_BADBR }, + { REGERR_EMPTY_RANGE_IN_CHAR_CLASS, REG_ECTYPE }, + { REGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE, REG_ECTYPE }, + { REGERR_TOO_MANY_MULTI_BYTE_RANGES, REG_ECTYPE }, + { REGERR_TOO_SHORT_MULTI_BYTE_STRING, REG_BADPAT }, + { REGERR_TOO_BIG_BACKREF_NUMBER, REG_ESUBREG }, + { REGERR_INVALID_BACKREF, REG_ESUBREG }, + { REGERR_TOO_BIG_WIDE_CHAR_VALUE, REG_EONIG_BADWC }, + { REGERR_TOO_LONG_WIDE_CHAR_VALUE, REG_EONIG_BADWC }, + { REGERR_INVALID_WIDE_CHAR_VALUE, REG_EONIG_BADWC }, + { REGERR_INVALID_SUBEXP_NAME, REG_BADPAT }, + { REGERR_UNDEFINED_NAME_REFERENCE, REG_BADPAT }, + { REGERR_UNDEFINED_GROUP_REFERENCE, REG_BADPAT }, + { REGERR_MULTIPLEX_DEFINITION_NAME_CALL, REG_BADPAT }, + { REGERR_NEVER_ENDING_RECURSION, REG_BADPAT }, + { REGERR_OVER_THREAD_PASS_LIMIT_COUNT, REG_EONIG_THREAD } + }; + + int i; + + if (code >= 0) return 0; + + for (i = 0; i < sizeof(o2p) / sizeof(o2p[0]); i++) { + if (code == o2p[i].onig_err) + return o2p[i].posix_err; + } + + return REG_EONIG_INTERNAL; /* but, unknown error code */ +} + +extern int +regcomp(regex_t* reg, const char* pattern, int posix_options) +{ + int r, len; + RegSyntaxType* syntax = RegDefaultSyntax; + RegOptionType options; + + if ((posix_options & REG_EXTENDED) == 0) + syntax = REG_SYNTAX_POSIX_BASIC; + + options = syntax->options; + if ((posix_options & REG_ICASE) != 0) + REG_OPTION_ON(options, REG_OPTION_IGNORECASE); + if ((posix_options & REG_NEWLINE) != 0) { + REG_OPTION_ON( options, REG_OPTION_NEGATE_SINGLELINE); + REG_OPTION_OFF(options, REG_OPTION_SINGLELINE); + } + + reg->comp_options = posix_options; + + ENC_STRING_LEN(RegDefaultCharEncoding, pattern, len); + r = regex_new(PONIG_C(reg), (UChar* )pattern, (UChar* )(pattern + len), + options, RegDefaultCharEncoding, syntax, (RegErrorInfo* )NULL); + if (r != REG_NORMAL) { + return onig2posix_error_code(r); + } + + reg->re_nsub = ONIG_C(reg)->num_mem; + return 0; +} + +extern int +regexec(regex_t* reg, const char* str, size_t nmatch, + regmatch_t pmatch[], int posix_options) +{ + int r, i, len; + UChar* end; + RegOptionType options; + + options = REG_OPTION_POSIX_REGION; + if ((posix_options & REG_NOTBOL) != 0) options |= REG_OPTION_NOTBOL; + if ((posix_options & REG_NOTEOL) != 0) options |= REG_OPTION_NOTEOL; + + if ((reg->comp_options & REG_NOSUB) != 0) { + pmatch = (regmatch_t* )NULL; + nmatch = 0; + } + + ENC_STRING_LEN(ONIG_C(reg)->code,str,len); + end = (UChar* )(str + len); + r = regex_search(ONIG_C(reg), (UChar* )str, end, (UChar* )str, end, + (RegRegion* )pmatch, options); + + if (r >= 0) { + r = 0; /* Match */ + } + else if (r == REG_MISMATCH) { + r = REG_NOMATCH; + for (i = 0; i < nmatch; i++) + pmatch[i].rm_so = pmatch[i].rm_eo = REG_REGION_NOTPOS; + } + else { + r = onig2posix_error_code(r); + } + + return r; +} + +extern void +regfree(regex_t* reg) +{ + regex_free(ONIG_C(reg)); +} + + +extern void +reg_set_encoding(int mb_code) +{ + RegDefaultCharEncoding = REG_MBLEN_TABLE[mb_code]; +} + +extern int +reg_name_to_group_numbers(regex_t* reg, + unsigned char* name, unsigned char* name_end, int** nums) +{ + return regex_name_to_group_numbers(ONIG_C(reg), name, name_end, nums); +} + +extern int +reg_foreach_name(regex_t* reg, int (*func)(unsigned char*,int,int*,void*), + void* arg) +{ + return regex_foreach_name(ONIG_C(reg), func, arg); +} diff --git a/ext/mbstring/oniguruma/sample/names.c b/ext/mbstring/oniguruma/sample/names.c new file mode 100644 index 0000000000..1ebc4e856c --- /dev/null +++ b/ext/mbstring/oniguruma/sample/names.c @@ -0,0 +1,64 @@ +/* + * names.c -- example of group name callback. + */ +#include<stdio.h> +#include "oniguruma.h" + +static int +name_callback(UChar* name, int ngroup_num, int* group_nums, void* arg) +{ + int i, gn; + RegRegion *region = (RegRegion* )arg; + + for (i = 0; i < ngroup_num; i++) { + gn = group_nums[i]; + fprintf(stderr, "%s (%d): ", name, gn); + fprintf(stderr, "(%d-%d)\n", region->beg[gn], region->end[gn]); + } + return 0; /* 0: continue */ +} + +extern int main(int argc, char* argv[]) +{ + int r; + unsigned char *start, *range, *end; + regex_t* reg; + RegErrorInfo einfo; + RegRegion *region; + + static unsigned char* pattern = "(?<foo>a*)(?<bar>b*)(?<foo>c*)"; + static unsigned char* str = "aaabbbbcc"; + + r = regex_new(®, pattern, pattern + strlen(pattern), + REG_OPTION_DEFAULT, REGCODE_ASCII, REG_SYNTAX_DEFAULT, &einfo); + if (r != REG_NORMAL) { + char s[REG_MAX_ERROR_MESSAGE_LEN]; + regex_error_code_to_str(s, r, &einfo); + fprintf(stderr, "ERROR: %s\n", s); + exit(-1); + } + + region = regex_region_new(); + + end = str + strlen(str); + start = str; + range = end; + r = regex_search(reg, str, end, start, range, region, REG_OPTION_NONE); + if (r >= 0) { + fprintf(stderr, "match at %d\n\n", r); + r = regex_foreach_name(reg, name_callback, (void* )region); + } + else if (r == REG_MISMATCH) { + fprintf(stderr, "search fail\n"); + } + else { /* error */ + char s[REG_MAX_ERROR_MESSAGE_LEN]; + regex_error_code_to_str(s, r); + exit(-1); + } + + regex_region_free(region, 1 /* 1:free self, 0:free contents only */); + regex_free(reg); + regex_end(); + return 0; +} diff --git a/ext/mbstring/oniguruma/sample/posix.c b/ext/mbstring/oniguruma/sample/posix.c new file mode 100644 index 0000000000..ff20292cb0 --- /dev/null +++ b/ext/mbstring/oniguruma/sample/posix.c @@ -0,0 +1,92 @@ +/* + * posix.c + */ +#include<stdio.h> +#include "onigposix.h" + +static int x(regex_t* reg, unsigned char* pattern, unsigned char* str) +{ + int r, i; + char buf[200]; + regmatch_t pmatch[20]; + + r = regexec(reg, str, reg->re_nsub + 1, pmatch, 0); + if (r != 0 && r != REG_NOMATCH) { + regerror(r, reg, buf, sizeof(buf)); + fprintf(stderr, "ERROR: %s\n", buf); + exit(-1); + } + + if (r == REG_NOMATCH) { + fprintf(stderr, "FAIL: /%s/ '%s'\n", pattern, str); + } + else { + fprintf(stderr, "OK: /%s/ '%s'\n", pattern, str); + for (i = 0; i <= reg->re_nsub; i++) { + fprintf(stderr, "%d: %d-%d\n", i, pmatch[i].rm_so, pmatch[i].rm_eo); + } + } + return 0; +} + +extern int main(int argc, char* argv[]) +{ + int r; + char buf[200]; + regex_t reg; + unsigned char* pattern; + + /* default syntax (REG_SYNTAX_RUBY) */ + pattern = "^a+b{2,7}[c-f]?$|uuu"; + r = regcomp(®, pattern, REG_EXTENDED); + if (r) { + regerror(r, ®, buf, sizeof(buf)); + fprintf(stderr, "ERROR: %s\n", buf); + exit(-1); + } + x(®, pattern, "aaabbbbd"); + + /* POSIX Basic RE (REG_EXTENDED is not specified.) */ + pattern = "^a+b{2,7}[c-f]?|uuu"; + r = regcomp(®, pattern, 0); + if (r) { + regerror(r, ®, buf, sizeof(buf)); + fprintf(stderr, "ERROR: %s\n", buf); + exit(-1); + } + x(®, pattern, "a+b{2,7}d?|uuu"); + + /* POSIX Basic RE (REG_EXTENDED is not specified.) */ + pattern = "^a*b\\{2,7\\}\\([c-f]\\)$"; + r = regcomp(®, pattern, 0); + if (r) { + regerror(r, ®, buf, sizeof(buf)); + fprintf(stderr, "ERROR: %s\n", buf); + exit(-1); + } + x(®, pattern, "aaaabbbbbbd"); + + /* POSIX Extended RE */ + regex_set_default_syntax(REG_SYNTAX_POSIX_EXTENDED); + pattern = "^a+b{2,7}[c-f]?)$|uuu"; + r = regcomp(®, pattern, REG_EXTENDED); + if (r) { + regerror(r, ®, buf, sizeof(buf)); + fprintf(stderr, "ERROR: %s\n", buf); + exit(-1); + } + x(®, pattern, "aaabbbbd)"); + + pattern = "^b."; + r = regcomp(®, pattern, REG_EXTENDED | REG_NEWLINE); + if (r) { + regerror(r, ®, buf, sizeof(buf)); + fprintf(stderr, "ERROR: %s\n", buf); + exit(-1); + } + x(®, pattern, "a\nb\n"); + + regfree(®); + regex_end(); + return 0; +} diff --git a/ext/mbstring/oniguruma/sample/simple.c b/ext/mbstring/oniguruma/sample/simple.c new file mode 100644 index 0000000000..89498bac11 --- /dev/null +++ b/ext/mbstring/oniguruma/sample/simple.c @@ -0,0 +1,54 @@ +/* + * simple.c + */ +#include<stdio.h> +#include "oniguruma.h" + +extern int main(int argc, char* argv[]) +{ + int r; + unsigned char *start, *range, *end; + regex_t* reg; + RegErrorInfo einfo; + RegRegion *region; + + static unsigned char* pattern = "a(.*)b|[e-f]+"; + static unsigned char* str = "zzzzaffffffffb"; + + r = regex_new(®, pattern, pattern + strlen(pattern), + REG_OPTION_DEFAULT, REGCODE_ASCII, REG_SYNTAX_DEFAULT, &einfo); + if (r != REG_NORMAL) { + char s[REG_MAX_ERROR_MESSAGE_LEN]; + regex_error_code_to_str(s, r, &einfo); + fprintf(stderr, "ERROR: %s\n", s); + exit(-1); + } + + region = regex_region_new(); + + end = str + strlen(str); + start = str; + range = end; + r = regex_search(reg, str, end, start, range, region, REG_OPTION_NONE); + if (r >= 0) { + int i; + + fprintf(stderr, "match at %d\n", r); + for (i = 0; i < region->num_regs; i++) { + fprintf(stderr, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]); + } + } + else if (r == REG_MISMATCH) { + fprintf(stderr, "search fail\n"); + } + else { /* error */ + char s[REG_MAX_ERROR_MESSAGE_LEN]; + regex_error_code_to_str(s, r); + exit(-1); + } + + regex_region_free(region, 1 /* 1:free self, 0:free contents only */); + regex_free(reg); + regex_end(); + return 0; +} diff --git a/ext/mbstring/oniguruma/test.rb b/ext/mbstring/oniguruma/test.rb new file mode 100644 index 0000000000..2c69344407 --- /dev/null +++ b/ext/mbstring/oniguruma/test.rb @@ -0,0 +1,971 @@ +# test.rb +# Copyright (C) 2003 K.Kosako (kosako@sofnec.co.jp) + +def pr(result, reg, str, n = 0, *range) + printf("%s /%s/:'%s'", result, reg.source, str) + if (n.class == Fixnum) + printf(":%d", n) if n != 0 + if (range.size > 0) + if (range[3].nil?) + printf(" (%d-%d : X-X)", range[0], range[1]) + else + printf(" (%d-%d : %d-%d)", range[0], range[1], range[2], range[3]) + end + end + else + printf(" %s", n) + end + printf("\n") +end + +def rok(result_opt, reg, str, n = 0, *range) + result = "OK" + result_opt + result += " " * (7 - result.length) + pr(result, reg, str, n, *range) + $rok += 1 +end + +def rfail(result_opt, reg, str, n = 0, *range) + result = "FAIL" + result_opt + result += " " * (7 - result.length) + pr(result, reg, str, n, *range) + $rfail += 1 +end + +def x(reg, str, s, e, n = 0) + m = reg.match(str) + if m + if (m.size() <= n) + rfail("(%d)" % (m.size()-1), reg, str, n) + else + if (m.begin(n) == s && m.end(n) == e) + rok("", reg, str, n) + else + rfail("", reg, str, n, s, e, m.begin(n), m.end(n)) + end + end + else + rfail("", reg, str, n) + end +end + +def n(reg, str) + m = reg.match(str) + if m + rfail("(N)", reg, str, 0) + else + rok("(N)", reg, str, 0) + end +end + +def r(reg, str, index, pos = nil) + if (pos) + res = str.rindex(reg, pos) + else + res = str.rindex(reg) + end + if res + if (res == index) + rok("(r)", reg, str) + else + rfail("(r)", reg, str, [res, '-', index]) + end + else + rfail("(r)", reg, str) + end +end + +def i(reg, str, s = 0, e = 0, n = 0) + # ignore +end + +### main ### +$rok = $rfail = 0 + + +def test_sb(enc) +$KCODE = enc + + +x(//, '', 0, 0) +x(/^/, '', 0, 0) +x(/$/, '', 0, 0) +x(/\G/, '', 0, 0) +x(/\A/, '', 0, 0) +x(/\Z/, '', 0, 0) +x(/\z/, '', 0, 0) +x(/^$/, '', 0, 0) +x(/\ca/, "\001", 0, 1) +x(/\C-b/, "\002", 0, 1) +x(/\M-Z/, "\xDA", 0, 1) +x(//, 'a', 0, 0) +x(/a/, 'a', 0, 1) +x(/aa/, 'aa', 0, 2) +x(/aaa/, 'aaa', 0, 3) +x(/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 0, 35) +x(/ab/, 'ab', 0, 2) +x(/b/, 'ab', 1, 2) +x(/bc/, 'abc', 1, 3) +x(/\17/, "\017", 0, 1) +x(/\x1f/, "\x1f", 0, 1) +x(/\xFE/, "\xfe", 0, 1) +x(/a(?#....\\JJJJ)b/, 'ab', 0, 2) +x(/./, 'a', 0, 1) +n(/./, '') +x(/../, 'ab', 0, 2) +x(/\w/, 'e', 0, 1) +n(/\W/, 'e') +x(/\s/, ' ', 0, 1) +x(/\S/, 'b', 0, 1) +x(/\d/, '4', 0, 1) +n(/\D/, '4') +x(/\b/, 'z ', 0, 0) +x(/\b/, ' z', 1, 1) +x(/\B/, 'zz ', 1, 1) +x(/\B/, 'z ', 2, 2) +x(/\B/, ' z', 0, 0) +x(/[ab]/, 'b', 0, 1) +n(/[ab]/, 'c') +x(/[a-z]/, 't', 0, 1) +n(/[^a]/, 'a') +x(/[^a]/, "\n", 0, 1) +x(/[]]/, ']', 0, 1) +n(/[^]]/, ']') +x(/[b-]/, 'b', 0, 1) +x(/[b-]/, '-', 0, 1) +x(/[\w]/, 'z', 0, 1) +n(/[\w]/, ' ') +x(/[\d]/, '5', 0, 1) +n(/[\d]/, 'e') +x(/[\D]/, 't', 0, 1) +n(/[\D]/, '3') +x(/[\s]/, ' ', 0, 1) +n(/[\s]/, 'a') +x(/[\S]/, 'b', 0, 1) +n(/[\S]/, ' ') +x(/[\w\d]/, '2', 0, 1) +n(/[\w\d]/, ' ') +x(/[[:upper:]]/, 'B', 0, 1) +x(/[*[:xdigit:]+]/, '+', 0, 1) +x(/[*[:xdigit:]+]/, 'GHIKK-9+*', 6, 7) +x(/[*[:xdigit:]+]/, '-@^+', 3, 4) +n(/[[:upper]]/, 'A') +x(/[[:upper]]/, ':', 0, 1) +x(/[\044-\047]/, "\046", 0, 1) +x(/[\x5a-\x5c]/, "\x5b", 0, 1) +x(/[\x6A-\x6D]/, "\x6c", 0, 1) +n(/[\x6A-\x6D]/, "\x6E") +n(/^[0-9A-F]+ 0+ UNDEF /, '75F 00000000 SECT14A notype () External | _rb_apply') +x(/[\[]/, '[', 0, 1) +x(/[\]]/, ']', 0, 1) +x(/[&]/, '&', 0, 1) +x(/[[ab]]/, 'b', 0, 1) +x(/[[ab]c]/, 'c', 0, 1) +n(/[[^a]]/, 'a') +n(/[^[a]]/, 'a') +x(/[[ab]&&bc]/, 'b', 0, 1) +n(/[[ab]&&bc]/, 'a') +n(/[[ab]&&bc]/, 'c') +x(/[a-z&&b-y&&c-x]/, 'w', 0, 1) +n(/[^a-z&&b-y&&c-x]/, 'w') +x(/[[^a&&a]&&a-z]/, 'b', 0, 1) +n(/[[^a&&a]&&a-z]/, 'a') +x(/[[^a-z&&bcdef]&&[^c-g]]/, 'h', 0, 1) +n(/[[^a-z&&bcdef]&&[^c-g]]/, 'c') +x(/[^[^abc]&&[^cde]]/, 'c', 0, 1) +x(/[^[^abc]&&[^cde]]/, 'e', 0, 1) +n(/[^[^abc]&&[^cde]]/, 'f') +x(/[a-&&-a]/, '-', 0, 1) +n(/[a-&&-a]/, '&') +n(/\wabc/, ' abc') +x(/a\Wbc/, 'a bc', 0, 4) +x(/a.b.c/, 'aabbc', 0, 5) +x(/.\wb\W..c/, 'abb bcc', 0, 7) +x(/\s\wzzz/, ' zzzz', 0, 5) +x(/aa.b/, 'aabb', 0, 4) +n(/.a/, 'ab') +x(/.a/, 'aa', 0, 2) +x(/^a/, 'a', 0, 1) +x(/^a$/, 'a', 0, 1) +x(/^\w$/, 'a', 0, 1) +n(/^\w$/, ' ') +x(/^\wab$/, 'zab', 0, 3) +x(/^\wabcdef$/, 'zabcdef', 0, 7) +x(/^\w...def$/, 'zabcdef', 0, 7) +x(/\w\w\s\Waaa\d/, 'aa aaa4', 0, 8) +x(/\A\Z/, '', 0, 0) +x(/\Axyz/, 'xyz', 0, 3) +x(/xyz\Z/, 'xyz', 0, 3) +x(/xyz\z/, 'xyz', 0, 3) +x(/\Gaz/, 'az', 0, 2) +n(/\Gz/, 'bza') +n(/az\G/, 'az') +n(/az\A/, 'az') +n(/a\Az/, 'az') +x(/\^\$/, '^$', 0, 2) +x(/\w/, '_', 0, 1) +n(/\W/, '_') +x(/(?=z)z/, 'z', 0, 1) +n(/(?=z)./, 'a') +x(/(?!z)a/, 'a', 0, 1) +n(/(?!z)a/, 'z') +x(/(?i:a)/, 'a', 0, 1) +x(/(?i:a)/, 'A', 0, 1) +x(/(?i:A)/, 'a', 0, 1) +n(/(?i:A)/, 'b') +x(/(?i:[A-Z])/, 'a', 0, 1) +x(/(?i:[f-m])/, 'H', 0, 1) +x(/(?i:[f-m])/, 'h', 0, 1) +n(/(?i:[f-m])/, 'e') +n(/(?i:[A-c])/, 'D') # changed spec. 2003/02/07 +n(/(?i:[a-C])/, 'D') # changed spec. 2003/02/07 +n(/(?i:[b-C])/, 'A') +x(/(?i:[a-C])/, 'B', 0, 1) +n(/(?i:[c-X])/, '[') +n(/(?i:[!-k])/, 'Z') +x(/(?i:[!-k])/, '7', 0, 1) +n(/(?i:[T-}])/, 'b') +x(/(?i:[T-}])/, '{', 0, 1) +x(/(?i:\?a)/, '?A', 0, 2) +x(/(?i:\*A)/, '*a', 0, 2) +n(/./, "\n") +x(/(?m:.)/, "\n", 0, 1) +x(/(?m:a.)/, "a\n", 0, 2) +x(/(?m:.b)/, "a\nb", 1, 3) +x(/a?/, '', 0, 0) +x(/a?/, 'b', 0, 0) +x(/a?/, 'a', 0, 1) +x(/a*/, '', 0, 0) +x(/a*/, 'a', 0, 1) +x(/a*/, 'aaa', 0, 3) +x(/a*/, 'baaaa', 0, 0) +n(/a+/, '') +x(/a+/, 'a', 0, 1) +x(/a+/, 'aaaa', 0, 4) +x(/a+/, 'aabbb', 0, 2) +x(/a+/, 'baaaa', 1, 5) +x(/.?/, '', 0, 0) +x(/.?/, 'f', 0, 1) +x(/.?/, "\n", 0, 0) +x(/.*/, '', 0, 0) +x(/.*/, 'abcde', 0, 5) +x(/.+/, 'z', 0, 1) +x(/.+/, "zdswer\n", 0, 6) +x(/a|b/, 'a', 0, 1) +x(/a|b/, 'b', 0, 1) +x(/|a/, 'a', 0, 0) +x(/(|a)/, 'a', 0, 0) +x(/ab|bc/, 'ab', 0, 2) +x(/ab|bc/, 'bc', 0, 2) +x(/z(?:ab|bc)/, 'zbc', 0, 3) +x(/a(?:ab|bc)c/, 'aabc', 0, 4) +x(/ab|(?:ac|az)/, 'az', 0, 2) +x(/a|b|c/, 'dc', 1, 2) +x(/a|b|cd|efg|h|ijk|lmn|o|pq|rstuvwx|yz/, 'pqr', 0, 2) +n(/a|b|cd|efg|h|ijk|lmn|o|pq|rstuvwx|yz/, 'mn') +x(/a|^z/, 'ba', 1, 2) +x(/a|^z/, 'za', 0, 1) +x(/a|\Gz/, 'bza', 2, 3) +x(/a|\Gz/, 'za', 0, 1) +x(/a|\Az/, 'bza', 2, 3) +x(/a|\Az/, 'za', 0, 1) +x(/a|b\Z/, 'ba', 1, 2) +x(/a|b\Z/, 'b', 0, 1) +x(/a|b\z/, 'ba', 1, 2) +x(/a|b\z/, 'b', 0, 1) +x(/\w|\s/, ' ', 0, 1) +n(/\w|\w/, ' ') +x(/\w|%/, '%', 0, 1) +x(/\w|[&$]/, '&', 0, 1) +x(/[b-d]|[^e-z]/, 'a', 0, 1) +x(/(?:a|[c-f])|bz/, 'dz', 0, 1) +x(/(?:a|[c-f])|bz/, 'bz', 0, 2) +x(/abc|(?=zz)..f/, 'zzf', 0, 3) +x(/abc|(?!zz)..f/, 'abf', 0, 3) +x(/(?=za)..a|(?=zz)..a/, 'zza', 0, 3) +n(/(?>a|abd)c/, 'abdc') +x(/(?>abd|a)c/, 'abdc', 0, 4) +x(/a?|b/, 'a', 0, 1) +x(/a?|b/, 'b', 0, 0) +x(/a?|b/, '', 0, 0) +x(/a*|b/, 'aa', 0, 2) +x(/a*|b*/, 'ba', 0, 0) +x(/a*|b*/, 'ab', 0, 1) +x(/a+|b*/, '', 0, 0) +x(/a+|b*/, 'bbb', 0, 3) +x(/a+|b*/, 'abbb', 0, 1) +n(/a+|b+/, '') +x(/(a|b)?/, 'b', 0, 1) +x(/(a|b)*/, 'ba', 0, 2) +x(/(a|b)+/, 'bab', 0, 3) +x(/(ab|ca)+/, 'caabbc', 0, 4) +x(/(ab|ca)+/, 'aabca', 1, 5) +x(/(ab|ca)+/, 'abzca', 0, 2) +x(/(a|bab)+/, 'ababa', 0, 5) +x(/(a|bab)+/, 'ba', 1, 2) +x(/(a|bab)+/, 'baaaba', 1, 4) +x(/(?:a|b)(?:a|b)/, 'ab', 0, 2) +x(/(?:a*|b*)(?:a*|b*)/, 'aaabbb', 0, 3) +x(/(?:a*|b*)(?:a+|b+)/, 'aaabbb', 0, 6) +x(/(?:a+|b+){2}/, 'aaabbb', 0, 6) +x(/h{0,}/, 'hhhh', 0, 4) +x(/(?:a+|b+){1,2}/, 'aaabbb', 0, 6) +x(/(?:a+|\Ab*)cc/, 'cc', 0, 2) +n(/(?:a+|\Ab*)cc/, 'abcc') +x(/(?:^a+|b+)*c/, 'aabbbabc', 6, 8) +x(/(?:^a+|b+)*c/, 'aabbbbc', 0, 7) +x(/a|(?i)c/, 'C', 0, 1) +x(/(?i)c|a/, 'C', 0, 1) +i(/(?i)c|a/, 'A', 0, 1) # different spec. +x(/(?i:c)|a/, 'C', 0, 1) +n(/(?i:c)|a/, 'A') +x(/[abc]?/, 'abc', 0, 1) +x(/[abc]*/, 'abc', 0, 3) +x(/[^abc]*/, 'abc', 0, 0) +n(/[^abc]+/, 'abc') +x(/a??/, 'aaa', 0, 0) +x(/ba??b/, 'bab', 0, 3) +x(/a*?/, 'aaa', 0, 0) +x(/ba*?/, 'baa', 0, 1) +x(/ba*?b/, 'baab', 0, 4) +x(/a+?/, 'aaa', 0, 1) +x(/ba+?/, 'baa', 0, 2) +x(/ba+?b/, 'baab', 0, 4) +x(/(?:a?)??/, 'a', 0, 0) +x(/(?:a??)?/, 'a', 0, 0) +x(/(?:a?)+?/, 'aaa', 0, 1) +x(/(?:a+)??/, 'aaa', 0, 0) +x(/(?:a+)??b/, 'aaab', 0, 4) +i(/(?:ab)?{2}/, '', 0, 0) # GNU regex bug +x(/(?:ab)?{2}/, 'ababa', 0, 4) +x(/(?:ab)*{0}/, 'ababa', 0, 0) +x(/(?:ab){3,}/, 'abababab', 0, 8) +n(/(?:ab){3,}/, 'abab') +x(/(?:ab){2,4}/, 'ababab', 0, 6) +x(/(?:ab){2,4}/, 'ababababab', 0, 8) +x(/(?:ab){2,4}?/, 'ababababab', 0, 4) +x(/(?:ab){,}/, 'ab{,}', 0, 5) +x(/(?:abc)+?{2}/, 'abcabcabc', 0, 6) +x(/(?:X*)(?i:xa)/, 'XXXa', 0, 4) +x(/(d+)([^abc]z)/, 'dddz', 0, 4) +x(/([^abc]*)([^abc]z)/, 'dddz', 0, 4) +x(/(\w+)(\wz)/, 'dddz', 0, 4) +x(/(a)/, 'a', 0, 1, 1) +x(/(ab)/, 'ab', 0, 2, 1) +x(/((ab))/, 'ab', 0, 2) +x(/((ab))/, 'ab', 0, 2, 1) +x(/((ab))/, 'ab', 0, 2, 2) +x(/((((((((((((((((((((ab))))))))))))))))))))/, 'ab', 0, 2, 20) +x(/(ab)(cd)/, 'abcd', 0, 2, 1) +x(/(ab)(cd)/, 'abcd', 2, 4, 2) +x(/()(a)bc(def)ghijk/, 'abcdefghijk', 3, 6, 3) +x(/(()(a)bc(def)ghijk)/, 'abcdefghijk', 3, 6, 4) +x(/(^a)/, 'a', 0, 1) +x(/(a)|(a)/, 'ba', 1, 2, 1) +x(/(^a)|(a)/, 'ba', 1, 2, 2) +x(/(a?)/, 'aaa', 0, 1, 1) +x(/(a*)/, 'aaa', 0, 3, 1) +x(/(a*)/, '', 0, 0, 1) +x(/(a+)/, 'aaaaaaa', 0, 7, 1) +x(/(a+|b*)/, 'bbbaa', 0, 3, 1) +x(/(a+|b?)/, 'bbbaa', 0, 1, 1) +x(/(abc)?/, 'abc', 0, 3, 1) +x(/(abc)*/, 'abc', 0, 3, 1) +x(/(abc)+/, 'abc', 0, 3, 1) +x(/(xyz|abc)+/, 'abc', 0, 3, 1) +x(/([xyz][abc]|abc)+/, 'abc', 0, 3, 1) +x(/((?i:abc))/, 'AbC', 0, 3, 1) +x(/(abc)(?i:\1)/, 'abcABC', 0, 6) +x(/((?m:a.c))/, "a\nc", 0, 3, 1) +x(/((?=az)a)/, 'azb', 0, 1, 1) +x(/abc|(.abd)/, 'zabd', 0, 4, 1) +x(/(?:abc)|(ABC)/, 'abc', 0, 3) +x(/(?i:(abc))|(zzz)/, 'ABC', 0, 3, 1) +x(/a*(.)/, 'aaaaz', 4, 5, 1) +x(/a*?(.)/, 'aaaaz', 0, 1, 1) +x(/a*?(c)/, 'aaaac', 4, 5, 1) +x(/[bcd]a*(.)/, 'caaaaz', 5, 6, 1) +x(/(\Abb)cc/, 'bbcc', 0, 2, 1) +n(/(\Abb)cc/, 'zbbcc') +x(/(^bb)cc/, 'bbcc', 0, 2, 1) +n(/(^bb)cc/, 'zbbcc') +x(/cc(bb$)/, 'ccbb', 2, 4, 1) +n(/cc(bb$)/, 'ccbbb') +#n(/\1/, 'a') # compile error on Oniguruma +n(/(\1)/, '') +n(/\1(a)/, 'aa') +n(/(a(b)\1)\2+/, 'ababb') +n(/(?:(?:\1|z)(a))+$/, 'zaa') +x(/(?:(?:\1|z)(a))+$/, 'zaaa', 0, 4) +x(/(a)(?=\1)/, 'aa', 0, 1) +n(/(a)$|\1/, 'az') +x(/(a)\1/, 'aa', 0, 2) +n(/(a)\1/, 'ab') +x(/(a?)\1/, 'aa', 0, 2) +x(/(a??)\1/, 'aa', 0, 0) +x(/(a*)\1/, 'aaaaa', 0, 4) +x(/(a*)\1/, 'aaaaa', 0, 2, 1) +x(/a(b*)\1/, 'abbbb', 0, 5) +x(/a(b*)\1/, 'ab', 0, 1) +x(/(a*)(b*)\1\2/, 'aaabbaaabb', 0, 10) +x(/(a*)(b*)\2/, 'aaabbbb', 0, 7) +x(/(((((((a*)b))))))c\7/, 'aaabcaaa', 0, 8) +x(/(((((((a*)b))))))c\7/, 'aaabcaaa', 0, 3, 7) +x(/(a)(b)(c)\2\1\3/, 'abcbac', 0, 6) +x(/([a-d])\1/, 'cc', 0, 2) +x(/(\w\d\s)\1/, 'f5 f5 ', 0, 6) +n(/(\w\d\s)\1/, 'f5 f5') +x(/(who|[a-c]{3})\1/, 'whowho', 0, 6) +x(/...(who|[a-c]{3})\1/, 'abcwhowho', 0, 9) +x(/(who|[a-c]{3})\1/, 'cbccbc', 0, 6) +x(/(^a)\1/, 'aa', 0, 2) +n(/(^a)\1/, 'baa') +n(/(a$)\1/, 'aa') +n(/(ab\Z)\1/, 'ab') +x(/(a*\Z)\1/, 'a', 1, 1) +x(/.(a*\Z)\1/, 'ba', 1, 2) +x(/(.(abc)\2)/, 'zabcabc', 0, 7, 1) +x(/(.(..\d.)\2)/, 'z12341234', 0, 9, 1) +x(/((?i:az))\1/, 'AzAz', 0, 4) +n(/((?i:az))\1/, 'Azaz') +x(/(?<=a)b/, 'ab', 1, 2) +n(/(?<=a)b/, 'bb') +x(/(?<=a|b)b/, 'bb', 1, 2) +x(/(?<=a|bc)b/, 'bcb', 2, 3) +x(/(?<=a|bc)b/, 'ab', 1, 2) +x(/(?<=a|bc||defghij|klmnopq|r)z/, 'rz', 1, 2) +x(/(?<!a)b/, 'cb', 1, 2) +n(/(?<!a)b/, 'ab') +x(/(?<!a|bc)b/, 'bbb', 0, 1) +n(/(?<!a|bc)z/, 'bcz') +x(/(?<name1>a)/, 'a', 0, 1) +x(/(?<name-2>ab)\1/, 'abab', 0, 4) +x(/(?<name-3>.zv.)\k<name-3>/, 'azvbazvb', 0, 8) +x(/(?<=\g<ab>)|-\zEND (?<ab>XyZ)/, 'XyZ', 3, 3) +x(/(?<n>|a\g<n>)+/, '', 0, 0) +x(/(?<n>|\(\g<n>\))+$/, '()(())', 0, 6) +x(/\g<n>(?<n>.){0}/, 'X', 0, 1, 1) +x(/\g<n>(abc|df(?<n>.YZ){2,8}){0}/, 'XYZ', 0, 3) +x(/\A(?<n>(a\g<n>)|)\z/, 'aaaa', 0, 4) +x(/(?<n>|\g<m>\g<n>)\z|\zEND (?<m>a|(b)\g<m>)/, 'bbbbabba', 0, 8) +x(/(?<@:name[1240]>\w+\sx)a+\k<@:name[1240]>/, ' fg xaaaaaaaafg x', 2, 18) +x(/(z)()()(?<9>a)\4/, 'zaa', 1, 2, 4) +x(/(.)(((?<*>a)))\k<*>/, 'zaa', 0, 3) +x(/((?<name1>\d)|(?<name2>\w))(\k<name1>|\k<name2>)/, 'ff', 0, 2) +x(/(?:(?<x>)|(?<x>efg))\k<x>/, '', 0, 0) +x(/(?:(?<@x>abc)|(?<@x>efg))\k<@x>/, 'abcefgefg', 3, 9) +n(/(?:(?<@x>abc)|(?<@x>efg))\k<@x>/, 'abcefg') +x(/(?:(?<n1>.)|(?<n1>..)|(?<n1>...)|(?<n1>....)|(?<n1>.....)|(?<n1>......)|(?<n1>.......)|(?<n1>........)|(?<n1>.........)|(?<n1>..........)|(?<n1>...........)|(?<n1>............)|(?<n1>.............)|(?<n1>..............))\k<n1>$/, 'a-pyumpyum', 2, 10) +x(/(?:(?<n1>.)|(?<n1>..)|(?<n1>...)|(?<n1>....)|(?<n1>.....)|(?<n1>......)|(?<n1>.......)|(?<n1>........)|(?<n1>.........)|(?<n1>..........)|(?<n1>...........)|(?<n1>............)|(?<n1>.............)|(?<n1>..............))\k<n1>$/, 'xxxxabcdefghijklmnabcdefghijklmn', 4, 18, 14) +x(/(?<name1>)(?<name2>)(?<name3>)(?<name4>)(?<name5>)(?<name6>)(?<name7>)(?<name8>)(?<name9>)(?<name10>)(?<name11>)(?<name12>)(?<name13>)(?<name14>)(?<name15>)(?<name16>aaa)(?<name17>)$/, 'aaa', 0, 3, 16) +x(/(?<foo>a|\(\g<foo>\))/, 'a', 0, 1) +x(/(?<foo>a|\(\g<foo>\))/, '((((((a))))))', 0, 13) +x(/(?<foo>a|\(\g<foo>\))/, '((((((((a))))))))', 0, 17, 1) +x(/\g<bar>|\zEND(?<bar>.*abc$)/, 'abcxxxabc', 0, 9) +x(/\g<1>|\zEND(.a.)/, 'bac', 0, 3) +x(/\g<2>\g<1>|\zEND(.a.)(?<?>.b.)/, 'xbxyay', 3, 6, 1) +x(/\A(?:\g<pon>|\g<pan>|\zEND (?<pan>a|c\g<pon>c)(?<pon>b|d\g<pan>d))$/, 'cdcbcdc', 0, 7) +x(/\A(?<n>|a\g<m>)\z|\zEND (?<m>\g<n>)/, 'aaaa', 0, 4) +x(/(?<n>(a|b\g<n>c){3,5})/, 'baaaaca', 1, 5) +x(/(?<n>(a|b\g<n>c){3,5})/, 'baaaacaaaaa', 0, 10) + +r(//, '', 0) +r(/a/, 'a', 0) +r(/a/, 'a', 0, 1) +r(/b/, 'abc', 1) +r(/b/, 'abc', 1, 2) +r(/./, 'a', 0) +r(/.*/, 'abcde fgh', 9) +r(/a*/, 'aaabbc', 6) +r(/a+/, 'aaabbc', 2) +r(/a?/, 'bac', 3) +r(/a??/, 'bac', 3) +r(/abcde/, 'abcdeavcd', 0) +r(/\w\d\s/, ' a2 aa $3 ', 2) +r(/[c-f]aa[x-z]/, '3caaycaaa', 1) +r(/(?i:fG)g/, 'fGgFggFgG', 3) +r(/a|b/, 'b', 0) +r(/ab|bc|cd/, 'bcc', 0) +r(/(ffy)\1/, 'ffyffyffy', 3) +r(/|z/, 'z', 1) +r(/^az/, 'azaz', 0) +r(/az$/, 'azaz', 2) +r(/(((.a)))\3/, 'zazaaa', 0) +r(/(ac*?z)\1/, 'aacczacczacz', 1) +r(/aaz{3,4}/, 'bbaabbaazzzaazz', 6) +r(/\000a/, "b\000a", 1) +r(/ff\xfe/, "fff\xfe", 1) +r(/...abcdefghijklmnopqrstuvwxyz/, 'zzzzzabcdefghijklmnopqrstuvwxyz', 2) +end + +def test_euc(enc) +$KCODE = enc + +x(//, '¤¢', 0, 0) +x(/¤¢/, '¤¢', 0, 2) +n(/¤¤/, '¤¢') +x(/¤¦¤¦/, '¤¦¤¦', 0, 4) +x(/¤¢¤¤¤¦/, '¤¢¤¤¤¦', 0, 6) +x(/¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³/, '¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³', 0, 70) +x(/¤¢/, '¤¤¤¢', 2, 4) +x(/¤¤¤¦/, '¤¢¤¤¤¦', 2, 6) +x(/\xca\xb8/, "\xca\xb8", 0, 2) +x(/./, '¤¢', 0, 2) +x(/../, '¤«¤', 0, 4) +x(/\w/, '¤ª', 0, 2) +n(/\W/, '¤¢') +x(/\S/, '¤½', 0, 2) +x(/\S/, '´Á', 0, 2) +x(/\b/, 'µ¤ ', 0, 0) +x(/\b/, ' ¤Û', 1, 1) +x(/\B/, '¤»¤½ ', 2, 2) +x(/\B/, '¤¦ ', 3, 3) +x(/\B/, ' ¤¤', 0, 0) +x(/[¤¿¤Á]/, '¤Á', 0, 2) +n(/[¤Ê¤Ë]/, '¤Ì') +x(/[¤¦-¤ª]/, '¤¨', 0, 2) +n(/[^¤±]/, '¤±') +x(/[\w]/, '¤Í', 0, 2) +n(/[\d]/, '¤Õ') +x(/[\D]/, '¤Ï', 0, 2) +n(/[\s]/, '¤¯') +x(/[\S]/, '¤Ø', 0, 2) +x(/[\w\d]/, '¤è', 0, 2) +x(/[\w\d]/, ' ¤è', 3, 5) +#x(/[\xa4\xcf-\xa4\xd3]/, "\xa4\xd0", 0, 2) # diff spec with GNU regex. +#n(/[\xb6\xe7-\xb6\xef]/, "\xb6\xe5") # diff spec with GNU regex. +n(/\wµ´¼Ö/, ' µ´¼Ö') +x(/µ´\W¼Ö/, 'µ´ ¼Ö', 0, 5) +x(/¤¢.¤¤.¤¦/, '¤¢¤¢¤¤¤¤¤¦', 0, 10) +x(/.\w¤¦\W..¤¾/, '¤¨¤¦¤¦ ¤¦¤¾¤¾', 0, 13) +x(/\s\w¤³¤³¤³/, ' ¤³¤³¤³¤³', 0, 9) +x(/¤¢¤¢.¤±/, '¤¢¤¢¤±¤±', 0, 8) +n(/.¤¤/, '¤¤¤¨') +x(/.¤ª/, '¤ª¤ª', 0, 4) +x(/^¤¢/, '¤¢', 0, 2) +x(/^¤à$/, '¤à', 0, 2) +x(/^\w$/, '¤Ë', 0, 2) +x(/^\w¤«¤¤¯¤±¤³$/, 'z¤«¤¤¯¤±¤³', 0, 11) +x(/^\w...¤¦¤¨¤ª$/, 'z¤¢¤¤¤¦¤¦¤¨¤ª', 0, 13) +x(/\w\w\s\W¤ª¤ª¤ª\d/, 'a¤ª ¤ª¤ª¤ª4', 0, 12) +x(/\A¤¿¤Á¤Ä/, '¤¿¤Á¤Ä', 0, 6) +x(/¤à¤á¤â\Z/, '¤à¤á¤â', 0, 6) +x(/¤«¤¤¯\z/, '¤«¤¤¯', 0, 6) +x(/¤«¤¤¯\Z/, "¤«¤¤¯\n", 0, 6) +x(/\G¤Ý¤Ô/, '¤Ý¤Ô', 0, 4) +n(/\G¤¨/, '¤¦¤¨¤ª') +n(/¤È¤Æ\G/, '¤È¤Æ') +n(/¤Þ¤ß\A/, '¤Þ¤ß') +n(/¤Þ\A¤ß/, '¤Þ¤ß') +x(/(?=¤»)¤»/, '¤»', 0, 2) +n(/(?=¤¦)./, '¤¤') +x(/(?!¤¦)¤«/, '¤«', 0, 2) +n(/(?!¤È)¤¢/, '¤È') +x(/(?i:¤¢)/, '¤¢', 0, 2) +x(/(?i:¤Ö¤Ù)/, '¤Ö¤Ù', 0, 4) +n(/(?i:¤¤)/, '¤¦') +x(/(?m:¤è.)/, "¤è\n", 0, 3) +x(/(?m:.¤á)/, "¤Þ\n¤á", 2, 5) +x(/¤¢?/, '', 0, 0) +x(/ÊÑ?/, '²½', 0, 0) +x(/ÊÑ?/, 'ÊÑ', 0, 2) +x(/ÎÌ*/, '', 0, 0) +x(/ÎÌ*/, 'ÎÌ', 0, 2) +x(/»Ò*/, '»Ò»Ò»Ò', 0, 6) +x(/ÇÏ*/, '¼¯ÇÏÇÏÇÏÇÏ', 0, 0) +n(/»³+/, '') +x(/²Ï+/, '²Ï', 0, 2) +x(/»þ+/, '»þ»þ»þ»þ', 0, 8) +x(/¤¨+/, '¤¨¤¨¤¦¤¦¤¦', 0, 4) +x(/¤¦+/, '¤ª¤¦¤¦¤¦¤¦', 2, 10) +x(/.?/, '¤¿', 0, 2) +x(/.*/, '¤Ñ¤Ô¤×¤Ú', 0, 8) +x(/.+/, '¤í', 0, 2) +x(/.+/, "¤¤¤¦¤¨¤«\n", 0, 8) +x(/¤¢|¤¤/, '¤¢', 0, 2) +x(/¤¢|¤¤/, '¤¤', 0, 2) +x(/¤¢¤¤|¤¤¤¦/, '¤¢¤¤', 0, 4) +x(/¤¢¤¤|¤¤¤¦/, '¤¤¤¦', 0, 4) +x(/¤ò(?:¤«¤|¤¤¯)/, '¤ò¤«¤', 0, 6) +x(/¤ò(?:¤«¤|¤¤¯)¤±/, '¤ò¤¤¯¤±', 0, 8) +x(/¤¢¤¤|(?:¤¢¤¦|¤¢¤ò)/, '¤¢¤ò', 0, 4) +x(/¤¢|¤¤|¤¦/, '¤¨¤¦', 2, 4) +x(/¤¢|¤¤|¤¦¤¨|¤ª¤«¤|¤¯|¤±¤³¤µ|¤·¤¹¤»|¤½|¤¿¤Á|¤Ä¤Æ¤È¤Ê¤Ë|¤Ì¤Í/, '¤·¤¹¤»', 0, 6) +n(/¤¢|¤¤|¤¦¤¨|¤ª¤«¤|¤¯|¤±¤³¤µ|¤·¤¹¤»|¤½|¤¿¤Á|¤Ä¤Æ¤È¤Ê¤Ë|¤Ì¤Í/, '¤¹¤»') +x(/¤¢|^¤ï/, '¤Ö¤¢', 2, 4) +x(/¤¢|^¤ò/, '¤ò¤¢', 0, 2) +x(/µ´|\G¼Ö/, '¤±¼Öµ´', 4, 6) +x(/µ´|\G¼Ö/, '¼Öµ´', 0, 2) +x(/µ´|\A¼Ö/, 'b¼Öµ´', 3, 5) +x(/µ´|\A¼Ö/, '¼Ö', 0, 2) +x(/µ´|¼Ö\Z/, '¼Öµ´', 2, 4) +x(/µ´|¼Ö\Z/, '¼Ö', 0, 2) +x(/µ´|¼Ö\Z/, "¼Ö\n", 0, 2) +x(/µ´|¼Ö\z/, '¼Öµ´', 2, 4) +x(/µ´|¼Ö\z/, '¼Ö', 0, 2) +x(/\w|\s/, '¤ª', 0, 2) +x(/\w|%/, '%¤ª', 0, 1) +x(/\w|[&$]/, '¤¦&', 0, 2) +x(/[¤¤-¤±]/, '¤¦', 0, 2) +x(/[¤¤-¤±]|[^¤«-¤³]/, '¤¢', 0, 2) +x(/[¤¤-¤±]|[^¤«-¤³]/, '¤«', 0, 2) +x(/(?:¤¢|[¤¦-¤])|¤¤¤ò/, '¤¦¤ò', 0, 2) +x(/(?:¤¢|[¤¦-¤])|¤¤¤ò/, '¤¤¤ò', 0, 4) +x(/¤¢¤¤¤¦|(?=¤±¤±)..¤Û/, '¤±¤±¤Û', 0, 6) +x(/¤¢¤¤¤¦|(?!¤±¤±)..¤Û/, '¤¢¤¤¤Û', 0, 6) +x(/(?=¤ò¤¢)..¤¢|(?=¤ò¤ò)..¤¢/, '¤ò¤ò¤¢', 0, 6) +x(/(?<=¤¢|¤¤¤¦)¤¤/, '¤¤¤¦¤¤', 4, 6) +n(/(?>¤¢|¤¢¤¤¤¨)¤¦/, '¤¢¤¤¤¨¤¦') +x(/(?>¤¢¤¤¤¨|¤¢)¤¦/, '¤¢¤¤¤¨¤¦', 0, 8) +x(/¤¢?|¤¤/, '¤¢', 0, 2) +x(/¤¢?|¤¤/, '¤¤', 0, 0) +x(/¤¢?|¤¤/, '', 0, 0) +x(/¤¢*|¤¤/, '¤¢¤¢', 0, 4) +x(/¤¢*|¤¤*/, '¤¤¤¢', 0, 0) +x(/¤¢*|¤¤*/, '¤¢¤¤', 0, 2) +x(/[a¤¢]*|¤¤*/, 'a¤¢¤¤¤¤¤¤', 0, 3) +x(/¤¢+|¤¤*/, '', 0, 0) +x(/¤¢+|¤¤*/, '¤¤¤¤¤¤', 0, 6) +x(/¤¢+|¤¤*/, '¤¢¤¤¤¤¤¤', 0, 2) +x(/¤¢+|¤¤*/, 'a¤¢¤¤¤¤¤¤', 0, 0) +n(/¤¢+|¤¤+/, '') +x(/(¤¢|¤¤)?/, '¤¤', 0, 2) +x(/(¤¢|¤¤)*/, '¤¤¤¢', 0, 4) +x(/(¤¢|¤¤)+/, '¤¤¤¢¤¤', 0, 6) +x(/(¤¢¤¤|¤¦¤¢)+/, '¤¦¤¢¤¢¤¤¤¦¤¨', 0, 8) +x(/(¤¢¤¤|¤¦¤¨)+/, '¤¦¤¢¤¢¤¤¤¦¤¨', 4, 12) +x(/(¤¢¤¤|¤¦¤¢)+/, '¤¢¤¢¤¤¤¦¤¢', 2, 10) +x(/(¤¢¤¤|¤¦¤¢)+/, '¤¢¤¤¤ò¤¦¤¢', 0, 4) +x(/(¤¢¤¤|¤¦¤¢)+/, '$$zzzz¤¢¤¤¤ò¤¦¤¢', 6, 10) +x(/(¤¢|¤¤¤¢¤¤)+/, '¤¢¤¤¤¢¤¤¤¢', 0, 10) +x(/(¤¢|¤¤¤¢¤¤)+/, '¤¤¤¢', 2, 4) +x(/(¤¢|¤¤¤¢¤¤)+/, '¤¤¤¢¤¢¤¢¤¤¤¢', 2, 8) +x(/(?:¤¢|¤¤)(?:¤¢|¤¤)/, '¤¢¤¤', 0, 4) +x(/(?:¤¢*|¤¤*)(?:¤¢*|¤¤*)/, '¤¢¤¢¤¢¤¤¤¤¤¤', 0, 6) +x(/(?:¤¢*|¤¤*)(?:¤¢+|¤¤+)/, '¤¢¤¢¤¢¤¤¤¤¤¤', 0, 12) +x(/(?:¤¢+|¤¤+){2}/, '¤¢¤¢¤¢¤¤¤¤¤¤', 0, 12) +x(/(?:¤¢+|¤¤+){1,2}/, '¤¢¤¢¤¢¤¤¤¤¤¤', 0, 12) +x(/(?:¤¢+|\A¤¤*)¤¦¤¦/, '¤¦¤¦', 0, 4) +n(/(?:¤¢+|\A¤¤*)¤¦¤¦/, '¤¢¤¤¤¦¤¦') +x(/(?:^¤¢+|¤¤+)*¤¦/, '¤¢¤¢¤¤¤¤¤¤¤¢¤¤¤¦', 12, 16) +x(/(?:^¤¢+|¤¤+)*¤¦/, '¤¢¤¢¤¤¤¤¤¤¤¤¤¦', 0, 14) +x(/¤¦{0,}/, '¤¦¤¦¤¦¤¦', 0, 8) +x(/¤¢|(?i)c/, 'C', 0, 1) +x(/(?i)c|¤¢/, 'C', 0, 1) +x(/(?i:¤¢)|a/, 'a', 0, 1) +n(/(?i:¤¢)|a/, 'A') +x(/[¤¢¤¤¤¦]?/, '¤¢¤¤¤¦', 0, 2) +x(/[¤¢¤¤¤¦]*/, '¤¢¤¤¤¦', 0, 6) +x(/[^¤¢¤¤¤¦]*/, '¤¢¤¤¤¦', 0, 0) +n(/[^¤¢¤¤¤¦]+/, '¤¢¤¤¤¦') +x(/¤¢??/, '¤¢¤¢¤¢', 0, 0) +x(/¤¤¤¢??¤¤/, '¤¤¤¢¤¤', 0, 6) +x(/¤¢*?/, '¤¢¤¢¤¢', 0, 0) +x(/¤¤¤¢*?/, '¤¤¤¢¤¢', 0, 2) +x(/¤¤¤¢*?¤¤/, '¤¤¤¢¤¢¤¤', 0, 8) +x(/¤¢+?/, '¤¢¤¢¤¢', 0, 2) +x(/¤¤¤¢+?/, '¤¤¤¢¤¢', 0, 4) +x(/¤¤¤¢+?¤¤/, '¤¤¤¢¤¢¤¤', 0, 8) +x(/(?:Å·?)??/, 'Å·', 0, 0) +x(/(?:Å·??)?/, 'Å·', 0, 0) +x(/(?:Ì´?)+?/, 'Ì´Ì´Ì´', 0, 2) +x(/(?:É÷+)??/, 'É÷É÷É÷', 0, 0) +x(/(?:Àã+)??Áú/, 'ÀãÀãÀãÁú', 0, 8) +i(/(?:¤¢¤¤)?{2}/, '', 0, 0) # GNU regex bug +x(/(?:µ´¼Ö)?{2}/, 'µ´¼Öµ´¼Öµ´', 0, 8) +x(/(?:µ´¼Ö)*{0}/, 'µ´¼Öµ´¼Öµ´', 0, 0) +x(/(?:µ´¼Ö){3,}/, 'µ´¼Öµ´¼Öµ´¼Öµ´¼Ö', 0, 16) +n(/(?:µ´¼Ö){3,}/, 'µ´¼Öµ´¼Ö') +x(/(?:µ´¼Ö){2,4}/, 'µ´¼Öµ´¼Öµ´¼Ö', 0, 12) +x(/(?:µ´¼Ö){2,4}/, 'µ´¼Öµ´¼Öµ´¼Öµ´¼Öµ´¼Ö', 0, 16) +x(/(?:µ´¼Ö){2,4}?/, 'µ´¼Öµ´¼Öµ´¼Öµ´¼Öµ´¼Ö', 0, 8) +x(/(?:µ´¼Ö){,}/, 'µ´¼Ö{,}', 0, 7) +x(/(?:¤«¤¤¯)+?{2}/, '¤«¤¤¯¤«¤¤¯¤«¤¤¯', 0, 12) +x(/(²Ð)/, '²Ð', 0, 2, 1) +x(/(²Ð¿å)/, '²Ð¿å', 0, 4, 1) +x(/((»þ´Ö))/, '»þ´Ö', 0, 4) +x(/((É÷¿å))/, 'É÷¿å', 0, 4, 1) +x(/((ºòÆü))/, 'ºòÆü', 0, 4, 2) +x(/((((((((((((((((((((ÎÌ»Ò))))))))))))))))))))/, 'ÎÌ»Ò', 0, 4, 20) +x(/(¤¢¤¤)(¤¦¤¨)/, '¤¢¤¤¤¦¤¨', 0, 4, 1) +x(/(¤¢¤¤)(¤¦¤¨)/, '¤¢¤¤¤¦¤¨', 4, 8, 2) +x(/()(¤¢)¤¤¤¦(¤¨¤ª¤«)¤¤¯¤±¤³/, '¤¢¤¤¤¦¤¨¤ª¤«¤¤¯¤±¤³', 6, 12, 3) +x(/(()(¤¢)¤¤¤¦(¤¨¤ª¤«)¤¤¯¤±¤³)/, '¤¢¤¤¤¦¤¨¤ª¤«¤¤¯¤±¤³', 6, 12, 4) +x(/.*(¥Õ¥©)¥ó¡¦¥Þ(¥ó()¥·¥å¥¿)¥¤¥ó/, '¥Õ¥©¥ó¡¦¥Þ¥ó¥·¥å¥¿¥¤¥ó', 10, 18, 2) +x(/(^¤¢)/, '¤¢', 0, 2) +x(/(¤¢)|(¤¢)/, '¤¤¤¢', 2, 4, 1) +x(/(^¤¢)|(¤¢)/, '¤¤¤¢', 2, 4, 2) +x(/(¤¢?)/, '¤¢¤¢¤¢', 0, 2, 1) +x(/(¤Þ*)/, '¤Þ¤Þ¤Þ', 0, 6, 1) +x(/(¤È*)/, '', 0, 0, 1) +x(/(¤ë+)/, '¤ë¤ë¤ë¤ë¤ë¤ë¤ë', 0, 14, 1) +x(/(¤Õ+|¤Ø*)/, '¤Õ¤Õ¤Õ¤Ø¤Ø', 0, 6, 1) +x(/(¤¢+|¤¤?)/, '¤¤¤¤¤¤¤¢¤¢', 0, 2, 1) +x(/(¤¢¤¤¤¦)?/, '¤¢¤¤¤¦', 0, 6, 1) +x(/(¤¢¤¤¤¦)*/, '¤¢¤¤¤¦', 0, 6, 1) +x(/(¤¢¤¤¤¦)+/, '¤¢¤¤¤¦', 0, 6, 1) +x(/(¤µ¤·¤¹|¤¢¤¤¤¦)+/, '¤¢¤¤¤¦', 0, 6, 1) +x(/([¤Ê¤Ë¤Ì][¤«¤¤¯]|¤«¤¤¯)+/, '¤«¤¤¯', 0, 6, 1) +x(/((?i:¤¢¤¤¤¦))/, '¤¢¤¤¤¦', 0, 6, 1) +x(/((?m:¤¢.¤¦))/, "¤¢\n¤¦", 0, 5, 1) +x(/((?=¤¢¤ó)¤¢)/, '¤¢¤ó¤¤', 0, 2, 1) +x(/¤¢¤¤¤¦|(.¤¢¤¤¤¨)/, '¤ó¤¢¤¤¤¨', 0, 8, 1) +x(/¤¢*(.)/, '¤¢¤¢¤¢¤¢¤ó', 8, 10, 1) +x(/¤¢*?(.)/, '¤¢¤¢¤¢¤¢¤ó', 0, 2, 1) +x(/¤¢*?(¤ó)/, '¤¢¤¢¤¢¤¢¤ó', 8, 10, 1) +x(/[¤¤¤¦¤¨]¤¢*(.)/, '¤¨¤¢¤¢¤¢¤¢¤ó', 10, 12, 1) +x(/(\A¤¤¤¤)¤¦¤¦/, '¤¤¤¤¤¦¤¦', 0, 4, 1) +n(/(\A¤¤¤¤)¤¦¤¦/, '¤ó¤¤¤¤¤¦¤¦') +x(/(^¤¤¤¤)¤¦¤¦/, '¤¤¤¤¤¦¤¦', 0, 4, 1) +n(/(^¤¤¤¤)¤¦¤¦/, '¤ó¤¤¤¤¤¦¤¦') +x(/¤í¤í(¤ë¤ë$)/, '¤í¤í¤ë¤ë', 4, 8, 1) +n(/¤í¤í(¤ë¤ë$)/, '¤í¤í¤ë¤ë¤ë') +x(/(̵)\1/, '̵̵', 0, 4) +n(/(̵)\1/, '̵Éð') +x(/(¶õ?)\1/, '¶õ¶õ', 0, 4) +x(/(¶õ??)\1/, '¶õ¶õ', 0, 0) +x(/(¶õ*)\1/, '¶õ¶õ¶õ¶õ¶õ', 0, 8) +x(/(¶õ*)\1/, '¶õ¶õ¶õ¶õ¶õ', 0, 4, 1) +x(/¤¢(¤¤*)\1/, '¤¢¤¤¤¤¤¤¤¤', 0, 10) +x(/¤¢(¤¤*)\1/, '¤¢¤¤', 0, 2) +x(/(¤¢*)(¤¤*)\1\2/, '¤¢¤¢¤¢¤¤¤¤¤¢¤¢¤¢¤¤¤¤', 0, 20) +x(/(¤¢*)(¤¤*)\2/, '¤¢¤¢¤¢¤¤¤¤¤¤¤¤', 0, 14) +x(/(¤¢*)(¤¤*)\2/, '¤¢¤¢¤¢¤¤¤¤¤¤¤¤', 6, 10, 2) +x(/(((((((¤Ý*)¤Ú))))))¤Ô\7/, '¤Ý¤Ý¤Ý¤Ú¤Ô¤Ý¤Ý¤Ý', 0, 16) +x(/(((((((¤Ý*)¤Ú))))))¤Ô\7/, '¤Ý¤Ý¤Ý¤Ú¤Ô¤Ý¤Ý¤Ý', 0, 6, 7) +x(/(¤Ï)(¤Ò)(¤Õ)\2\1\3/, '¤Ï¤Ò¤Õ¤Ò¤Ï¤Õ', 0, 12) +x(/([¤-¤±])\1/, '¤¯¤¯', 0, 4) +x(/(\w\d\s)\1/, '¤¢5 ¤¢5 ', 0, 8) +n(/(\w\d\s)\1/, '¤¢5 ¤¢5') +x(/(ï¡©|[¤¢-¤¦]{3})\1/, 'ï¡©', 0, 8) +x(/...(ï¡©|[¤¢-¤¦]{3})\1/, '¤¢a¤¢Ã¯¡©Ã¯¡©', 0, 13) +x(/(ï¡©|[¤¢-¤¦]{3})\1/, '¤¦¤¤¤¦¤¦¤¤¤¦', 0, 12) +x(/(^¤³)\1/, '¤³¤³', 0, 4) +n(/(^¤à)\1/, '¤á¤à¤à') +n(/(¤¢$)\1/, '¤¢¤¢') +n(/(¤¢¤¤\Z)\1/, '¤¢¤¤') +x(/(¤¢*\Z)\1/, '¤¢', 2, 2) +x(/.(¤¢*\Z)\1/, '¤¤¤¢', 2, 4) +x(/(.(¤ä¤¤¤æ)\2)/, 'z¤ä¤¤¤æ¤ä¤¤¤æ', 0, 13, 1) +x(/(.(..\d.)\2)/, '¤¢12341234', 0, 10, 1) +x(/((?i:¤¢v¤º))\1/, '¤¢v¤º¤¢v¤º', 0, 10) +x(/(?<¶ò¤«>ÊÑ|\(\g<¶ò¤«>\))/, '((((((ÊÑ))))))', 0, 14) +x(/\A(?:\g<°¤-1>|\g<±¾-2>|\z½ªÎ» (?<°¤-1>´Ñ|¼«\g<±¾-2>¼«)(?<±¾-2>ºß|Êî»§\g<°¤-1>Êî»§))$/, 'Êî»§¼«Êî»§¼«ºß¼«Êî»§¼«Êî»§', 0, 26) +x(/[[¤Ò¤Õ]]/, '¤Õ', 0, 2) +x(/[[¤¤¤ª¤¦]¤«]/, '¤«', 0, 2) +n(/[[^¤¢]]/, '¤¢') +n(/[^[¤¢]]/, '¤¢') +x(/[^[^¤¢]]/, '¤¢', 0, 2) +x(/[[¤«¤¤¯]&&¤¤¯]/, '¤¯', 0, 2) +n(/[[¤«¤¤¯]&&¤¤¯]/, '¤«') +n(/[[¤«¤¤¯]&&¤¤¯]/, '¤±') +x(/[¤¢-¤ó&&¤¤-¤ò&&¤¦-¤ñ]/, '¤ñ', 0, 2) +n(/[^¤¢-¤ó&&¤¤-¤ò&&¤¦-¤ñ]/, '¤ñ') +x(/[[^¤¢&&¤¢]&&¤¢-¤ó]/, '¤¤', 0, 2) +n(/[[^¤¢&&¤¢]&&¤¢-¤ó]/, '¤¢') +x(/[[^¤¢-¤ó&&¤¤¤¦¤¨¤ª]&&[^¤¦-¤«]]/, '¤', 0, 2) +n(/[[^¤¢-¤ó&&¤¤¤¦¤¨¤ª]&&[^¤¦-¤«]]/, '¤¤') +x(/[^[^¤¢¤¤¤¦]&&[^¤¦¤¨¤ª]]/, '¤¦', 0, 2) +x(/[^[^¤¢¤¤¤¦]&&[^¤¦¤¨¤ª]]/, '¤¨', 0, 2) +n(/[^[^¤¢¤¤¤¦]&&[^¤¦¤¨¤ª]]/, '¤«') +x(/[¤¢-&&-¤¢]/, '-', 0, 1) +x(/[^[^a-z¤¢¤¤¤¦]&&[^bcdefg¤¦¤¨¤ª]q-w]/, '¤¨', 0, 2) +x(/[^[^a-z¤¢¤¤¤¦]&&[^bcdefg¤¦¤¨¤ª]g-w]/, 'f', 0, 1) +x(/[^[^a-z¤¢¤¤¤¦]&&[^bcdefg¤¦¤¨¤ª]g-w]/, 'g', 0, 1) +n(/[^[^a-z¤¢¤¤¤¦]&&[^bcdefg¤¦¤¨¤ª]g-w]/, '2') +r(/¤¢/, '¤¢', 0) +r(/¤¢/, '¤¢', 0, 2) +r(/¤¤/, '¤¢¤¤¤¦', 2) +r(/¤¤/, '¤¢¤¤¤¦', 2, 4) +r(/./, '¤¢', 0) +r(/.*/, '¤¢¤¤¤¦¤¨¤ª ¤«¤¤¯', 17) +r(/.*¤¨¤ª/, '¤¢¤¤¤¦¤¨¤ª ¤«¤¤¯', 6) +r(/¤¢*/, '¤¢¤¢¤¢¤¤¤¤¤¦', 12) +r(/¤¢+/, '¤¢¤¢¤¢¤¤¤¤¤¦', 4) +r(/¤¢?/, '¤¤¤¢¤¦', 6) +r(/Á´??/, 'ÉéÁ´ÊÑ', 6) +r(/aÊÕc´Áe/, 'aÊÕc´Áeavcd', 0) +r(/\w\d\s/, ' ¤¢2 ¤¦¤¦ $3 ', 2) +r(/[¤¦-¤ª]¤¢¤¢[¤È-¤ó]/, '3¤¦¤¢¤¢¤Ê¤¦¤¢¤¢¤¢', 1) +r(/¤¢|¤¤/, '¤¤', 0) +r(/¤¢¤¤|¤¤¤¦|¤¦¤¨/, '¤¤¤¦¤¦', 0) +r(/(¤È¤È¤Á)\1/, '¤È¤È¤Á¤È¤È¤Á¤È¤È¤Á', 6) +r(/|¤¨/, '¤¨', 2) +r(/^¤¢¤º/, '¤¢¤º¤¢¤º', 0) +r(/¤¢¤º$/, '¤¢¤º¤¢¤º', 4) +r(/(((.¤¢)))\3/, 'z¤¢z¤¢¤¢¤¢', 0) +r(/(¤¢¤¦*?¤ó)\1/, '¤¢¤¢¤¦¤¦¤ó¤¢¤¦¤¦¤ó¤¢¤¦¤ó', 2) +r(/¤¢¤¢¤ó{3,4}/, '¤Æ¤Æ¤¢¤¢¤¤¤¤¤¢¤¢¤ó¤ó¤ó¤¢¤¢¤ó¤¢¤¢¤ó', 12) +r(/\000¤¢/, "¤¤\000¤¢", 2) +r(/¤È¤È\xfe\xfe/, "¤È¤È¤È\xfe\xfe", 2) +r(/...¤¢¤¤¤¦¤¨¤ª¤«¤¤¯¤±¤³¤µ¤·¤¹¤»¤½/, 'zzzzz¤¢¤¤¤¦¤¨¤ª¤«¤¤¯¤±¤³¤µ¤·¤¹¤»¤½', 2) +end + +test_sb('ASCII') +test_sb('EUC') +test_sb('SJIS') +test_sb('UTF8') +test_euc('EUC') + + +# UTF-8 (by UENO Katsuhiro) +$KCODE = 'UTF-8' + +s = "\xe3\x81\x82\xe3\x81\x81\xf0\x90\x80\x85\xe3\x81\x8a\xe3\x81\x85" +x(/[\xc2\x80-\xed\x9f\xbf]+/u, s, 0, 6) + +s = "\xf0\x90\x80\x85\xe3\x81\x82" +x(/[\xc2\x80-\xed\x9f\xbf]/u, s, 4, 7) + +s = "\xed\x9f\xbf" +n(/[\xc2\x80-\xed\x9f\xbe]/u, s) + +s = "\xed\x9f\xbf" +n(/[\xc2\x80-\xed\x9f\xbe]/u, s) + +s = "\xed\x9f\xbf" +n(/[\xc2\x80-\xed\x9f\xbe]/u, s) + +s = "\xed\x9f\xbf" +n(/[\xc3\xad\xed\x9f\xbe]/u, s) + +s = "\xed\x9f\xbf" +n(/[\xc4\x80-\xed\x9f\xbe]/u, s) + +s = "\xed\x9f\xbf\xf0\x90\x80\x85\xed\x9f\xbf" +x(/[^\xc2\x80-\xed\x9f\xbe]/u, s, 0, 3) + +s = "\xed\x9f\xbf" +x(/[^\xc3\xad\xed\x9f\xbe]/u, s, 0, 3) + +s = "\xed\x9f\xbf\xf0\x90\x80\x85\xed\x9f\xbf" +x(/[^\xc4\x80-\xed\x9f\xbe]/u, s, 0, 3) + +s = "\xc3\xbe\xc3\xbf" +n(/[\xfe\xff\xc3\x80]/u, s) + + +# Japanese long text. +$KCODE = 'EUC' + +s = <<EOS +Àï¸å¤ÎÆüËܤˤª¤¤¤Æ¤Ï¡¢µì·³¤Ë¤Ä¤¤¤Æ¤ÏÄ´ºº¤Ë´ð¤Å¤«¤ÌÈãȽ¤âµö¤µ¤ì¤ëÉ÷Ĭ¤âÀ¸¤¸¡¢ +¤¿¤È¤¨¤Ð»°½½È¬Ç¯¼°Êâʼ½Æ¤ÎÀ©Äêǯ¤¬ÆüϪÀïÁè¤Î½ª¤Ã¤¿Ç¯¤Ç¤¢¤ë¤³¤È¤ò¤â¤Ã¤Æ·Ú¹ú¤Ë +µì·³¤Îµì¼°¤Ö¤ê¤ò¸ØÄ¥¤¹¤ëÏÀɾ¤¬¤Þ¤«¤ê¤È¤ª¤Ã¤Æ¤¤¤ë¡£ +Í̾¤ÊÏÀ¼Ô¤È¤·¤Æ¤Ï¡¢¸Î¡¦»ÊÇÏÎËÂÀϺ¤òµó¤²¤ë¤³¤È¤¬¤Ç¤¤ë¤À¤í¤¦¡£ + +ʼƣÆó½½È¬ ¡ÖÍºä½Æ¡× »Íë¥é¥¦¥ó¥É (1998) +EOS + +x(/\((.+)\)/, s, 305, 309, 1) +x(/»ÊÇÏÎËÂÀϺ/, s, 229, 239) +x(/¡£$/, s, 202, 204) +x(/(^ʼƣ..Ȭ)/, s, 269, 279, 1) +x(/^$/, s, 268, 268) + + +s = <<EOS +¥«¥Ê¤ä¥í¡¼¥Þ»ú¤Ï°ìÂÎʸ»ú¤Ç¤¢¤í¤¦¤«¡£ +¤â¤·¤³¤È¤Ð¤ò¤·¤ë¤¹¤â¤Î¤¬Ê¸»ú¤Ç¤¢¤ë¤È¤¹¤ë¤È¡¢¤½¤ì¤Ï¤³¤È¤Ð¤ò¤·¤ë¤¹¤â¤Î¤Ç¤Ï¤Ê¤¤¡£ +Ëܤäbook¤Ï¤³¤È¤Ð¤Ç¤¢¤ë¤¬¡¢¥Û¥ó¤ähon¤Ï²»¤ò¤Ê¤é¤Ù¤¿¤À¤±¤Ç¡¢½½Ê¬¤Êñ¸ìÀ¤ò +¤â¤Ä¤â¤Î¤Ç¤Ï¤Ê¤¤¡£ +ñ¸ì¤È¤·¤Æ¤ÎÆÃÄê¤Î·ÁÂÖ¤ò¤â¤¿¤Ê¤¤¤«¤é¤Ç¤¢¤ë¡£ +¡Ö·Á¤Ë¤è¤ë¸ì¡×¤ò¥¢¥é¥ó¤Ï´Á»ú¤ËÂФ¹¤ë·ÚÊÎŪ¤Ê°ÕÌ£¤ËÍѤ¤¤¿¤¬¡¢ +·Á¤Î¤Ê¤¤¤â¤Î¤ÏËÜÅö¤Ï¸ì¤Ç¤Ï¤¢¤ê¤¨¤Ê¤¤¤Î¤Ç¤¢¤ë¡£ + +ÇòÀîÀÅ ¡Ö´Á»úÉ´ÏÃ¡× +EOS + +n(/\((.+)\)/, s) +x(/¡Ö(.*)¡×/, s, 254, 264, 1) +x(/¡£$/, s, 34, 36) +x(/(book)/, s, 120, 124, 1) +x(/^$/, s, 360, 360) + + +s = <<EOS +¼á²à¤¬±Ã»³¤Ë¤¯¤À¤Ã¤Æ¤¤¿¤È¤¹¤ì¤Ð¡¢¤½¤Î¤ª¤Ó¤¿¤À¤·¤¤Ì©¶µÈþ½Ñ¤ÎÎ̤ȡ¢ +¤½¤Î¼Á¤Î¹â¤µ¤Ë¤ª¤É¤í¤¯¤Ë¤Á¤¬¤¤¤Ê¤¤¡£ +¤³¤Î³Ð¼Ô¤¬¡¢°µÅÝŪ¤Ê¶Ã¤¤ò¤â¤Ä¤Î¤Ï¡¢¤ªÉÔÆ°¤µ¤ó¤ÎÁü¤ÎÁ°¤ËΩ¤Ã¤¿¤È¤¤À¤í¤¦¡£ +¡Ý¡Ý ¤³¤ì¤Ï¡¢¥É¥é¥ô¥£¥À¿Í¤Î¾¯Ç¯ÅÛÎì¤Ç¤Ï¤Ê¤¤¤«¡£ + +»ÊÇÏÎËÂÀϺ ¡Ö±Ã»³Èþ½Ñ¤ÎŸ³«¡ÝÉÔÆ°ÌÀ²¦¤Ë¤Õ¤ì¤Ä¤Ä¡× ¥¢¥µ¥Ò¥°¥é¥Õ(1986) +EOS + +x(/\((.+)\)/, s, 290, 296) +x(/¡Ö(.*)¡Ý(.+)¡×/, s, 257, 275, 2) +x(/^¡Ý¡Ý /, s, 179, 184) +x(/(¼á²à)/, s, 0, 4, 1) +x(/\w¡¢/, s, 30, 34) + + +s = <<EOS +¤«¤È¤¤¤Ã¤Æ¡¢½êÁ§¤Ï¡¢»ûÆâ·¯¤â¡¢¹õ´ä·¯¤â¡¢¤½¤·¤Æ¤â¤¦°ì¿Í¤Î¿Íʪ¤â¡¢¸ýÀå¤ÎÅ̤ˤ¹¤®¤Ê¤¤¤³¤È¤ò¡¢¤³¤ÎÂè¼·¹æ¤ÏÇ¡¼Â¤Ëʪ¸ì¤Ã¤Æ¤¤¤ë¡£ +¤«¤ì¤é»°¿Í¤Î¾®Àâ¤Ï°ì¹Ô¤â½Ð¤Æ¤¤¤Ê¤¤¤Î¤À¡£ +½ñ¤¯¤Ò¤Þ¤¬¤Ê¤«¤Ã¤¿¤Î¤Ç¤¢¤í¤¦¡£ +¤·¤«¤·¡¢»¨»ï¡Ö¶áÂåÀâÏáפ¬¡¢¤Ê¤ªÂèȬ¹æ¤âÂè¶å¹æ¤â½Ð¤Ä¤Å¤±¤Æ¤æ¤¯¤Ç¤¢¤í¤¦¤³¤È¤Ë¤Ä¤¤¤Æ¤Ï¡¢»ä¤Ï¤Ö¤¤ß¤Ê¤Û¤É¤Î³Î¿®¤ò¤â¤Ã¤Æ¤¤¤ë¡£¤³¤Î»¨»ï¤Ë¤Ï¡¢»ö̳ǽÎϤÎËâʪ¤Î¤è¤¦¤Ê¿Íʪ¤¬¡¢»°¿Í¤â¤¤¤ë¡£ +¤½¤ì¤ò»×¤¦¤È¡¢¤È¤¤É¤¤¿¤á©¤Î½Ð¤ë¤è¤¦¤Ê¤ª¤â¤¤¤¬¤¹¤ë¤Î¤Ç¤¢¤ë¡£ + +»ÊÇÏÎËÂÀϺ ¡Ö¤³¤ó¤Ê»¨»ï¤ä¤á¤Æ¤·¤Þ¤¤¤¿¤¤¡× ¶áÂåÀâÏà Âè¼·½¸ (1961) +EOS + +x(/\((\d+)\)/, s, 496, 502) +x(/(¡Ö.+»¨»ï.*¡×)/, s, 449, 479, 1) +x(/Âè(.)¹æ/, s, 96, 98, 1) +x(/¡£$/, s, 120, 122) +x(/¶áÂåÀâÏÃ/, s, 209, 217) + + +s = <<EOS +Æó½½¸ÞÇܤò±Û¤¨¤ëÇüÂç¤ÊÎ̤β¼¤ê±ö¤ËÂй³¤¹¤ë¼êΩ¤Æ¤Ë¿´¤Å¤â¤ê¤¬¤¢¤Ã¤¿¤Î¤Ï¡¢À¸¤»Ä¤Ã¤Æ¤¤¤¿»Í½½¸®¤ÎÃϲö¤ê±öÌä²°¤Î¤¦¤Á°ËÀª²°¤ÎÇò°°Ëʼ±Ò¤¿¤À°ì¿Í¤À¤Ã¤¿¡£ +°ì¸ý¤ËÃϲö¤ê±ö¤È¤¤¤Ã¤Æ¤â¡¢¹¾¸Í¾ë¸æ¿ô´ó²°¤ËǼÆþ¤¹¤ë¸æÍѱö¤È¡¢¹¾¸Í»ÔÃæ¤Ëή¤¹¤â¤Î¤È¤ÏÅöÁ³Æ±¤¸Êª¤Ç¤Ï¤Ê¤«¤Ã¤¿¡£ +¤½¤â¤½¤â¤¬Àïʪ»ñ¤òÁ°Äó¤È¤·¤Æ¹Í¤¨¤é¤ì¤¿¹ÔÆÁ±ö¤Ï¡¢Í¢Á÷¤¹¤ëÀޤ˶ì½Áʬ¤¬ÍϤ±¤À¤·Ìܸº¤ê¤·¤¿¤Î¤Ç¤ÏÏäˤʤé¤Ê¤¤¡£¤½¤³¤Ç¡¢¹¾¸Í¾ë¤ËǼ¤á¤ë¤â¤Î¤Ï¡¢¾Æ¤¤¢¤²¤¿±ö¤ò°ì²Æ°±Îü°Ï¤¤¤Ë¤·¤¿¾®²°¤ËÀѤ߾夲¡¢¶ì½Áʬ¤òÈ´¤¤¤Æ¿¿±ö¤Ë»ÅΩ¤Æ¾å¤²¤¿¤â¤Î¤À¤Ã¤¿¡£ + +ÈÓÅèÏÂ°ì ¡Ö»ÏÁÄÄ»µ¡× (2000) +EOS + +x(/\((\d+)\)/, s, 506, 512) +x(/(¡Ö.*¡×)/, s, 493, 505, 1) +x(/¹ÔÆÁ±ö/, s, 292, 298) + + +s = <<EOS +¤³¤¦¤·¤¿ÆüËܿͤÎÉð´ï¤ËÂФ¹¤ëÊѤï¤Ã¤¿ÂÖÅÙ¤Î΢¤Ë¤Ï¡¢¤¸¤Ä¤Ï¡¢ +°ì´Ó¤·¤¿ÁªÂò´ð½à¤¬Æ¯¤¤¤Æ¤¤¤¿¡£ +¤½¤ì¤Ï¡¢¤½¤ÎÉð´ï¤¬¡Ö¼çʼ¤ò¹âµé¤Ë¸«¤»¤ë¤«¤É¤¦¤«¡×¤Ç¤¢¤Ã¤¿¡£ + +ʼƣÆó½½È¬ ¡ÖÍºä½Æ¡× »Íë¥é¥¦¥ó¥É (1998) +EOS + +x(/\((\d+)\)/, s, 185, 191) +x(/(¡Ö.*¡×)/, s, 108, 138, 1) +x(/^¤½¤ì¤Ï/, s, 90, 96) +x(/^.*$/, s, 0, 58) + +s = <<EOS + É£¤Ï¿Í¤â¿©¤¤¡¢ÇϤλôÎÁ¤Ë¤â¤·¤Þ¤·¤¿¡£ÇϤˤÏÉ£°ì¾£¤ËƦÆó¹ç¤ò¤¿¤¤¤Æ¤Þ¤¼¤¿¤â¤Î¤ò°ìÆü¤Ë°ì²ó¤Ï¤¿¤Ù¤µ¤»¤¿¡£¿Í´Ö¤è¤ê¤Ï¾åÅù¤Î¤â¤Î¤ò¤¿¤Ù¤µ¤»¤¿¤â¤ó¤Ç¤¢¤ê¤Þ¤¹¡£ + ¿Í´Ö¤ÏÆüº¢¤Ï¥Ø¥º¥êÈÓ¤ò¤¿¤Ù¤¿¡£´¥ºÚ¤ò¤æ¤Ç¤Æ¡¢¤æ¤Ç¤¸¤ë¤òÇϤˤä¤ê¡¢ºÚ¤ò¤³¤Þ¤«¤ËÀڤꡢºÚ¤ÈÉ£¤ÈÊÆ¤ò¤Þ¤¼¤Æ¤¿¤¤¤Æ¤¿¤Ù¤¿¡£¤º¤Ã¤ÈÀΤÏÊÆ¤ÈÉ£¤¬È¾¡¹¤°¤é¤¤¤Ç¤¢¤Ã¤¿¤¬¡¢ÌÀ¼£¤âÆó½½Ç¯Âå¤Ë¤Ê¤ë¤È¡¢É£¤ò¤Ä¤¯¤ë¤Î¤¬¤Ø¤Ã¤ÆÍè¤Æ¡¢É£¤ÏÊÆ¤Î»°Ê¬¤Î°ì¤¯¤é¤¤¤Ë¤Ê¤Ã¤¿¡£¥Ø¥º¥êÈӤˤϱö¤ò¾¯¤·¤¤¤ì¤¿¤â¤ó¤Ç¤¹¡£ + +µÜËܾï°ì ¡Ö˺¤ì¤é¤ì¤¿ÆüËÜ¿Í¡× (1960) +EOS + +x(/(É£¤ÏÊÆ¤Î»°Ê¬¤Î°ì¤¯¤é¤¤¤Ë)/, s, 357, 381, 1) +x(/¤¢¤ê¤Þ¤¹¡£$/, s, 140, 150) +x(/ ¿Í´Ö(.*)¡£/, s, 157, 423, 1) +x(/¥Ø¥º¥êÈÓ[¤ò¤Ï¤Ç]/, s, 165, 175) + +s = <<EOS +¿È¤Ï¤¿¤È¤Ò Éð¢¤ÎÌîÊդ˵à¤Ì¤È¤â αÃÖ¤Þ¤·ÂçϺ² + +µÈÅľ¾°þ ¡Öαº²Ï¿¡× (1859) +EOS + +x(/\((.+)\)/, s, 68, 74) +x(/¡Ö(.*)¡×/, s, 59, 65, 1) +x(/^(µÈÅľ¾°þ)/, s, 48, 56, 1) + + +# result +printf("\n*** Result SUCCESS: %d, FAIL: %d ***\n", $rok, $rfail) + +# END. diff --git a/ext/mbstring/oniguruma/testconv.rb b/ext/mbstring/oniguruma/testconv.rb new file mode 100644 index 0000000000..afaa673d90 --- /dev/null +++ b/ext/mbstring/oniguruma/testconv.rb @@ -0,0 +1,223 @@ +#!/usr/local/bin/ruby -Ke +# testconv.rb +# Copyright (C) 2003 K.Kosako (kosako@sofnec.co.jp) + +WINDOWS = (ARGV.size > 0 && /^-win/i =~ ARGV[0]) +ARGV.shift if WINDOWS + +if WINDOWS + REGCODE = 'REGCODE_SJIS' + REGENC = 'REG_ENCODING_SJIS' +else + REGCODE = 'REGCODE_EUCJP' + REGENC = 'REG_ENCODING_EUC_JP' +end + +def conv_reg(s) + s = s.gsub(/\\/, '\\\\\\\\') #' + if (WINDOWS) + s = s.gsub(/\?\?/, '?\\\\?') # escape ANSI trigraph + end + s +end + +def conv_str(s) + if (s[0] == ?') + s = s[1..-2] + return s.gsub(/\\/, '\\\\\\\\') #' + else + return s[1..-2] + end +end + +print(<<"EOS") +/* + * This program was generated by testconv.rb. + */ +#include<stdio.h> + +#ifdef POSIX_TEST +#include "onigposix.h" +#else +#include "oniguruma.h" +#endif + +static int nsucc = 0; +static int nfail = 0; + +#ifndef POSIX_TEST +static RegRegion* region; +#endif + +static void xx(char* pattern, char* str, int from, int to, int mem, int not) +{ + int r; + +#ifdef POSIX_TEST + regex_t reg; + char buf[200]; + regmatch_t pmatch[20]; + + r = regcomp(®, pattern, REG_EXTENDED | REG_NEWLINE); + if (r) { + regerror(r, ®, buf, sizeof(buf)); + fprintf(stderr, "ERROR: %s\\n", buf); + exit(-1); + } + + r = regexec(®, str, reg.re_nsub + 1, pmatch, 0); + if (r != 0 && r != REG_NOMATCH) { + regerror(r, ®, buf, sizeof(buf)); + fprintf(stderr, "ERROR: %s\\n", buf); + exit(-1); + } + + if (r == REG_NOMATCH) { + if (not) { + fprintf(stdout, "OK(N): /%s/ '%s'\\n", pattern, str); + nsucc++; + } + else { + fprintf(stdout, "FAIL: /%s/ '%s'\\n", pattern, str); + nfail++; + } + } + else { + if (not) { + fprintf(stdout, "FAIL(N): /%s/ '%s'\\n", pattern, str); + nfail++; + } + else { + if (pmatch[mem].rm_so == from && pmatch[mem].rm_eo == to) { + fprintf(stdout, "OK: /%s/ '%s'\\n", pattern, str); + nsucc++; + } + else { + fprintf(stdout, "FAIL: /%s/ '%s' %d-%d : %d-%d\\n", pattern, str, + from, to, pmatch[mem].rm_so, pmatch[mem].rm_eo); + nfail++; + } + } + } + regfree(®); + +#else + regex_t* reg; + RegErrorInfo einfo; + + r = regex_new(®, (UChar* )pattern, (UChar* )(pattern + strlen(pattern)), + REG_OPTION_DEFAULT, #{REGCODE}, REG_SYNTAX_DEFAULT, &einfo); + if (r) { + char s[REG_MAX_ERROR_MESSAGE_LEN]; + regex_error_code_to_str(s, r, &einfo); + fprintf(stderr, "ERROR: %s\\n", s); + exit(-1); + } + + r = regex_search(reg, (UChar* )str, (UChar* )(str + strlen(str)), + (UChar* )str, (UChar* )(str + strlen(str)), + region, REG_OPTION_NONE); + if (r < REG_MISMATCH) { + char s[REG_MAX_ERROR_MESSAGE_LEN]; + regex_error_code_to_str(s, r); + fprintf(stderr, "ERROR: %s\\n", s); + exit(-1); + } + + if (r == REG_MISMATCH) { + if (not) { + fprintf(stdout, "OK(N): /%s/ '%s'\\n", pattern, str); + nsucc++; + } + else { + fprintf(stdout, "FAIL: /%s/ '%s'\\n", pattern, str); + nfail++; + } + } + else { + if (not) { + fprintf(stdout, "FAIL(N): /%s/ '%s'\\n", pattern, str); + nfail++; + } + else { + if (region->beg[mem] == from && region->end[mem] == to) { + fprintf(stdout, "OK: /%s/ '%s'\\n", pattern, str); + nsucc++; + } + else { + fprintf(stdout, "FAIL: /%s/ '%s' %d-%d : %d-%d\\n", pattern, str, + from, to, region->beg[mem], region->end[mem]); + nfail++; + } + } + } + regex_free(reg); +#endif +} + +static void x2(char* pattern, char* str, int from, int to) +{ + xx(pattern, str, from, to, 0, 0); +} + +static void x3(char* pattern, char* str, int from, int to, int mem) +{ + xx(pattern, str, from, to, mem, 0); +} + +static void n(char* pattern, char* str) +{ + xx(pattern, str, 0, 0, 0, 1); +} + +extern int main(int argc, char* argv[]) +{ +#ifdef POSIX_TEST + reg_set_encoding(#{REGENC}); +#else + region = regex_region_new(); +#endif + +EOS + +CM = '\s*,\s*' +RX2 = %r{^x\(/([^\/]*)/#{CM}('[^']*'|"[^"]*")#{CM}(\S+)#{CM}(\S+)\)$} +RI2 = %r{^i\(/([^\/]*)/#{CM}('[^']*'|"[^"]*")#{CM}(\S+)#{CM}(\S+)\)} +RX3 = %r{^x\(/([^\/]*)/#{CM}('[^']*'|"[^"]*")#{CM}(\S+)#{CM}(\S+)#{CM}(\S+)\)$} +RN = %r{^n\(/([^\/]*)/#{CM}('[^']*'|"[^"]*")\)$} #' + +while line = gets() + if (m = RX2.match(line)) + reg = conv_reg(m[1]) + str = conv_str(m[2]) + printf(" x2(\"%s\", \"%s\", %s, %s);\n", reg, str, m[3], m[4]) + elsif (m = RI2.match(line)) + reg = conv_reg(m[1]) + str = conv_str(m[2]) + printf(" x2(\"%s\", \"%s\", %s, %s);\n", reg, str, m[3], m[4]) + elsif (m = RX3.match(line)) + reg = conv_reg(m[1]) + str = conv_str(m[2]) + printf(" x3(\"%s\", \"%s\", %s, %s, %s);\n", reg, str, m[3], m[4], m[5]) + elsif (m = RN.match(line)) + reg = conv_reg(m[1]) + str = conv_str(m[2]) + printf(" n(\"%s\", \"%s\");\n", reg, str) + else + + end +end + +print(<<'EOS') + fprintf(stdout, "\nRESULT SUCC: %d, FAIL: %d\n", nsucc, nfail); + +#ifndef POSIX_TEST + regex_region_free(region, 1); + regex_end(); +#endif + + return 0; +} +EOS + +# END OF SCRIPT diff --git a/ext/mbstring/oniguruma/win32/Makefile b/ext/mbstring/oniguruma/win32/Makefile new file mode 100644 index 0000000000..bb20474e8f --- /dev/null +++ b/ext/mbstring/oniguruma/win32/Makefile @@ -0,0 +1,131 @@ +# Oniguruma Makefile for Win32 + +product_name = oniguruma + +CPPFLAGS = +CFLAGS = -O2 -nologo +LDFLAGS = +LOADLIBES = +ARLIB = lib +ARLIB_FLAGS = -nologo +ARDLL = cl +ARDLL_FLAGS = -nologo -LD $(LINKFLAGS) -dll +LINKFLAGS = -link -incremental:no -pdb:none + +INSTALL = install -c +CP = copy +CC = cl +DEFS = -DHAVE_CONFIG_H -DNOT_RUBY -DEXPORT +RUBYDIR = .. + +subdirs = + +libbase = onig +libname = $(libbase)_s.lib +dllname = $(libbase).dll +dlllib = $(libbase).lib + +onigheaders = oniguruma.h regint.h regparse.h +posixheaders = onigposix.h +headers = $(posixheaders) $(onigheaders) + +onigobjs = reggnu.obj regerror.obj regparse.obj regcomp.obj regexec.obj +posixobjs = regposix.obj regposerr.obj +libobjs = $(onigobjs) $(posixobjs) + +onigsources = regerror.c regparse.c regcomp.c regexec.c reggnu.c +posixsources = regposix.c regposerr.c +libsources = $(posixsources) $(onigsources) +rubysources = regex.c $(onigsources) + +patchfiles = re.c.168.patch re.c.180.patch +distfiles = README COPYING INSTALL-RUBY HISTORY \ + Makefile.in configure.in config.h.in configure \ + $(headers) $(libsources) regex.c $(patchfiles) \ + test.rb testconv.rb +testc = testc +testp = testp + +makeargs = $(MFLAGS) CPPFLAGS='$(CPPFLAGS)' CFLAGS='$(CFLAGS)' CC='$(CC)' + +.SUFFIXES: +.SUFFIXES: .obj .c .h .ps .dvi .info .texinfo + +.c.obj: + $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) /I. /c $< + +# targets +default: all + +all: $(libname) $(dllname) + +$(libname): $(libobjs) + $(ARLIB) $(ARLIB_FLAGS) -out:$@ $(libobjs) + +$(dllname): $(libobjs) + $(ARDLL) $(libobjs) -Fe$@ $(ARDLL_FLAGS) + +regparse.obj: regparse.c $(onigheaders) config.h +regcomp.obj: regcomp.c $(onigheaders) config.h +regexec.obj: regexec.c regint.h oniguruma.h config.h +reggnu.obj: reggnu.c regint.h oniguruma.h config.h +regerror.obj: regerror.c regint.h oniguruma.h config.h +regposix.obj: regposix.c $(posixheaders) oniguruma.h config.h +regposerr.obj: regposerr.c $(posixheaders) config.h + +# Ruby test +rtest: + $(RUBYDIR)\win32\ruby -w -Ke test.rb + +# C library test +ctest: $(testc) + .\$(testc) + +# POSIX C library test +ptest: $(testp) + .\$(testp) + +$(testc): $(testc).c $(libname) + $(CC) -nologo -o $(testc) $(testc).c $(libname) + +$(testp): $(testc).c $(dlllib) + $(CC) -nologo -DPOSIX_TEST -DIMPORT -o $(testp) $(testc).c $(dlllib) + +clean: + del *.obj *.lib *.exp *.dll $(testp).exe $(testc).exe $(testc).obj + + +16: cpruby + patch -d $(RUBYDIR) -p0 < re.c.168.patch + +18: cpruby + patch -d $(RUBYDIR) -p0 < re.c.180.patch + +# backup file suffix +SORIG = ruby_orig + +cpruby: + $(CP) $(RUBYDIR)\regex.c $(RUBYDIR)\regex.c.$(SORIG) + $(CP) $(RUBYDIR)\regex.h $(RUBYDIR)\regex.h.$(SORIG) + $(CP) $(RUBYDIR)\re.c $(RUBYDIR)\re.c.$(SORIG) +# $(rubysources) + $(CP) regex.c $(RUBYDIR) + $(CP) regerror.c $(RUBYDIR) + $(CP) regparse.c $(RUBYDIR) + $(CP) regcomp.c $(RUBYDIR) + $(CP) regexec.c $(RUBYDIR) + $(CP) reggnu.c $(RUBYDIR) +# $(onigheaders) + $(CP) oniguruma.h $(RUBYDIR)\regex.h + $(CP) regint.h $(RUBYDIR) + $(CP) regparse.h $(RUBYDIR) + +rback: + $(CP) $(RUBYDIR)\regex.c.$(SORIG) $(RUBYDIR)\regex.c + $(CP) $(RUBYDIR)\regex.h.$(SORIG) $(RUBYDIR)\regex.h + $(CP) $(RUBYDIR)\re.c.$(SORIG) $(RUBYDIR)\re.c + +samples: + $(CC) $(CFLAGS) -I. -DIMPORT -o simple sample\simple.c $(dlllib) + $(CC) $(CFLAGS) -I. -DIMPORT -o posix sample\posix.c $(dlllib) + $(CC) $(CFLAGS) -I. -DIMPORT -o names sample\names.c $(dlllib) diff --git a/ext/mbstring/oniguruma/win32/config.h b/ext/mbstring/oniguruma/win32/config.h new file mode 100644 index 0000000000..bdbdaf25c1 --- /dev/null +++ b/ext/mbstring/oniguruma/win32/config.h @@ -0,0 +1,84 @@ +#define STDC_HEADERS 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_OFF_T 1 +#define SIZEOF_INT 4 +#define SIZEOF_SHORT 2 +#define SIZEOF_LONG 4 +#define SIZEOF_LONG_LONG 0 +#define SIZEOF___INT64 8 +#define SIZEOF_OFF_T 4 +#define SIZEOF_VOIDP 4 +#define SIZEOF_FLOAT 4 +#define SIZEOF_DOUBLE 8 +#define HAVE_PROTOTYPES 1 +#define TOKEN_PASTE(x,y) x##y +#define HAVE_STDARG_PROTOTYPES 1 +#ifndef NORETURN +#if _MSC_VER > 1100 +#define NORETURN(x) __declspec(noreturn) x +#else +#define NORETURN(x) x +#endif +#endif +#define HAVE_DECL_SYS_NERR 1 +#define STDC_HEADERS 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_SYS_UTIME_H 1 +#define HAVE_MEMORY_H 1 +#define uid_t int +#define gid_t int +#define HAVE_STRUCT_STAT_ST_RDEV 1 +#define HAVE_ST_RDEV 1 +#define GETGROUPS_T int +#define RETSIGTYPE void +#define HAVE_ALLOCA 1 +#define HAVE_DUP2 1 +#define HAVE_MEMCMP 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MKDIR 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_STRERROR 1 +#define HAVE_STRFTIME 1 +#define HAVE_STRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOD 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_FLOCK 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_FINITE 1 +#define HAVE_FMOD 1 +#define HAVE_FREXP 1 +#define HAVE_HYPOT 1 +#define HAVE_MODF 1 +#define HAVE_WAITPID 1 +#define HAVE_CHSIZE 1 +#define HAVE_TIMES 1 +#define HAVE__SETJMP 1 +#define HAVE_TELLDIR 1 +#define HAVE_SEEKDIR 1 +#define HAVE_MKTIME 1 +#define HAVE_COSH 1 +#define HAVE_SINH 1 +#define HAVE_TANH 1 +#define HAVE_EXECVE 1 +#define HAVE_TZNAME 1 +#define HAVE_DAYLIGHT 1 +#define SETPGRP_VOID 1 +#define inline __inline +#define NEED_IO_SEEK_BETWEEN_RW 1 +#define RSHIFT(x,y) ((x)>>(int)y) +#define FILE_COUNT _cnt +#define FILE_READPTR _ptr +#define DEFAULT_KCODE KCODE_NONE +#define DLEXT ".so" +#define DLEXT2 ".dll" diff --git a/ext/mbstring/oniguruma/win32/testc.c b/ext/mbstring/oniguruma/win32/testc.c new file mode 100644 index 0000000000..8ec392cd8c --- /dev/null +++ b/ext/mbstring/oniguruma/win32/testc.c @@ -0,0 +1,804 @@ +/* + * This program was generated by testconv.rb. + */ +#include<stdio.h> + +#ifdef POSIX_TEST +#include "onigposix.h" +#else +#include "oniguruma.h" +#endif + +static int nsucc = 0; +static int nfail = 0; + +#ifndef POSIX_TEST +static RegRegion* region; +#endif + +static void xx(char* pattern, char* str, int from, int to, int mem, int not) +{ + int r; + +#ifdef POSIX_TEST + regex_t reg; + char buf[200]; + regmatch_t pmatch[20]; + + r = regcomp(®, pattern, REG_EXTENDED | REG_NEWLINE); + if (r) { + regerror(r, ®, buf, sizeof(buf)); + fprintf(stderr, "ERROR: %s\n", buf); + exit(-1); + } + + r = regexec(®, str, reg.re_nsub + 1, pmatch, 0); + if (r != 0 && r != REG_NOMATCH) { + regerror(r, ®, buf, sizeof(buf)); + fprintf(stderr, "ERROR: %s\n", buf); + exit(-1); + } + + if (r == REG_NOMATCH) { + if (not) { + fprintf(stdout, "OK(N): /%s/ '%s'\n", pattern, str); + nsucc++; + } + else { + fprintf(stdout, "FAIL: /%s/ '%s'\n", pattern, str); + nfail++; + } + } + else { + if (not) { + fprintf(stdout, "FAIL(N): /%s/ '%s'\n", pattern, str); + nfail++; + } + else { + if (pmatch[mem].rm_so == from && pmatch[mem].rm_eo == to) { + fprintf(stdout, "OK: /%s/ '%s'\n", pattern, str); + nsucc++; + } + else { + fprintf(stdout, "FAIL: /%s/ '%s' %d-%d : %d-%d\n", pattern, str, + from, to, pmatch[mem].rm_so, pmatch[mem].rm_eo); + nfail++; + } + } + } + regfree(®); + +#else + regex_t* reg; + RegErrorInfo einfo; + + r = regex_new(®, (UChar* )pattern, (UChar* )(pattern + strlen(pattern)), + REG_OPTION_DEFAULT, REGCODE_SJIS, REG_SYNTAX_DEFAULT, &einfo); + if (r) { + char s[REG_MAX_ERROR_MESSAGE_LEN]; + regex_error_code_to_str(s, r, &einfo); + fprintf(stderr, "ERROR: %s\n", s); + exit(-1); + } + + r = regex_search(reg, (UChar* )str, (UChar* )(str + strlen(str)), + (UChar* )str, (UChar* )(str + strlen(str)), + region, REG_OPTION_NONE); + if (r < REG_MISMATCH) { + char s[REG_MAX_ERROR_MESSAGE_LEN]; + regex_error_code_to_str(s, r); + fprintf(stderr, "ERROR: %s\n", s); + exit(-1); + } + + if (r == REG_MISMATCH) { + if (not) { + fprintf(stdout, "OK(N): /%s/ '%s'\n", pattern, str); + nsucc++; + } + else { + fprintf(stdout, "FAIL: /%s/ '%s'\n", pattern, str); + nfail++; + } + } + else { + if (not) { + fprintf(stdout, "FAIL(N): /%s/ '%s'\n", pattern, str); + nfail++; + } + else { + if (region->beg[mem] == from && region->end[mem] == to) { + fprintf(stdout, "OK: /%s/ '%s'\n", pattern, str); + nsucc++; + } + else { + fprintf(stdout, "FAIL: /%s/ '%s' %d-%d : %d-%d\n", pattern, str, + from, to, region->beg[mem], region->end[mem]); + nfail++; + } + } + } + regex_free(reg); +#endif +} + +static void x2(char* pattern, char* str, int from, int to) +{ + xx(pattern, str, from, to, 0, 0); +} + +static void x3(char* pattern, char* str, int from, int to, int mem) +{ + xx(pattern, str, from, to, mem, 0); +} + +static void n(char* pattern, char* str) +{ + xx(pattern, str, 0, 0, 0, 1); +} + +extern int main(int argc, char* argv[]) +{ +#ifdef POSIX_TEST + reg_set_encoding(REG_ENCODING_SJIS); +#else + region = regex_region_new(); +#endif + + x2("", "", 0, 0); + x2("^", "", 0, 0); + x2("$", "", 0, 0); + x2("\\G", "", 0, 0); + x2("\\A", "", 0, 0); + x2("\\Z", "", 0, 0); + x2("\\z", "", 0, 0); + x2("^$", "", 0, 0); + x2("\\ca", "\001", 0, 1); + x2("\\C-b", "\002", 0, 1); + x2("\\M-Z", "\xDA", 0, 1); + x2("", "a", 0, 0); + x2("a", "a", 0, 1); + x2("aa", "aa", 0, 2); + x2("aaa", "aaa", 0, 3); + x2("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 35); + x2("ab", "ab", 0, 2); + x2("b", "ab", 1, 2); + x2("bc", "abc", 1, 3); + x2("\\17", "\017", 0, 1); + x2("\\x1f", "\x1f", 0, 1); + x2("\\xFE", "\xfe", 0, 1); + x2("a(?#....\\\\JJJJ)b", "ab", 0, 2); + x2(".", "a", 0, 1); + n(".", ""); + x2("..", "ab", 0, 2); + x2("\\w", "e", 0, 1); + n("\\W", "e"); + x2("\\s", " ", 0, 1); + x2("\\S", "b", 0, 1); + x2("\\d", "4", 0, 1); + n("\\D", "4"); + x2("\\b", "z ", 0, 0); + x2("\\b", " z", 1, 1); + x2("\\B", "zz ", 1, 1); + x2("\\B", "z ", 2, 2); + x2("\\B", " z", 0, 0); + x2("[ab]", "b", 0, 1); + n("[ab]", "c"); + x2("[a-z]", "t", 0, 1); + n("[^a]", "a"); + x2("[^a]", "\n", 0, 1); + x2("[]]", "]", 0, 1); + n("[^]]", "]"); + x2("[b-]", "b", 0, 1); + x2("[b-]", "-", 0, 1); + x2("[\\w]", "z", 0, 1); + n("[\\w]", " "); + x2("[\\d]", "5", 0, 1); + n("[\\d]", "e"); + x2("[\\D]", "t", 0, 1); + n("[\\D]", "3"); + x2("[\\s]", " ", 0, 1); + n("[\\s]", "a"); + x2("[\\S]", "b", 0, 1); + n("[\\S]", " "); + x2("[\\w\\d]", "2", 0, 1); + n("[\\w\\d]", " "); + x2("[[:upper:]]", "B", 0, 1); + x2("[*[:xdigit:]+]", "+", 0, 1); + x2("[*[:xdigit:]+]", "GHIKK-9+*", 6, 7); + x2("[*[:xdigit:]+]", "-@^+", 3, 4); + n("[[:upper]]", "A"); + x2("[[:upper]]", ":", 0, 1); + x2("[\\044-\\047]", "\046", 0, 1); + x2("[\\x5a-\\x5c]", "\x5b", 0, 1); + x2("[\\x6A-\\x6D]", "\x6c", 0, 1); + n("[\\x6A-\\x6D]", "\x6E"); + n("^[0-9A-F]+ 0+ UNDEF ", "75F 00000000 SECT14A notype () External | _rb_apply"); + x2("[\\[]", "[", 0, 1); + x2("[\\]]", "]", 0, 1); + x2("[&]", "&", 0, 1); + x2("[[ab]]", "b", 0, 1); + x2("[[ab]c]", "c", 0, 1); + n("[[^a]]", "a"); + n("[^[a]]", "a"); + x2("[[ab]&&bc]", "b", 0, 1); + n("[[ab]&&bc]", "a"); + n("[[ab]&&bc]", "c"); + x2("[a-z&&b-y&&c-x]", "w", 0, 1); + n("[^a-z&&b-y&&c-x]", "w"); + x2("[[^a&&a]&&a-z]", "b", 0, 1); + n("[[^a&&a]&&a-z]", "a"); + x2("[[^a-z&&bcdef]&&[^c-g]]", "h", 0, 1); + n("[[^a-z&&bcdef]&&[^c-g]]", "c"); + x2("[^[^abc]&&[^cde]]", "c", 0, 1); + x2("[^[^abc]&&[^cde]]", "e", 0, 1); + n("[^[^abc]&&[^cde]]", "f"); + x2("[a-&&-a]", "-", 0, 1); + n("[a-&&-a]", "&"); + n("\\wabc", " abc"); + x2("a\\Wbc", "a bc", 0, 4); + x2("a.b.c", "aabbc", 0, 5); + x2(".\\wb\\W..c", "abb bcc", 0, 7); + x2("\\s\\wzzz", " zzzz", 0, 5); + x2("aa.b", "aabb", 0, 4); + n(".a", "ab"); + x2(".a", "aa", 0, 2); + x2("^a", "a", 0, 1); + x2("^a$", "a", 0, 1); + x2("^\\w$", "a", 0, 1); + n("^\\w$", " "); + x2("^\\wab$", "zab", 0, 3); + x2("^\\wabcdef$", "zabcdef", 0, 7); + x2("^\\w...def$", "zabcdef", 0, 7); + x2("\\w\\w\\s\\Waaa\\d", "aa aaa4", 0, 8); + x2("\\A\\Z", "", 0, 0); + x2("\\Axyz", "xyz", 0, 3); + x2("xyz\\Z", "xyz", 0, 3); + x2("xyz\\z", "xyz", 0, 3); + x2("\\Gaz", "az", 0, 2); + n("\\Gz", "bza"); + n("az\\G", "az"); + n("az\\A", "az"); + n("a\\Az", "az"); + x2("\\^\\$", "^$", 0, 2); + x2("\\w", "_", 0, 1); + n("\\W", "_"); + x2("(?=z)z", "z", 0, 1); + n("(?=z).", "a"); + x2("(?!z)a", "a", 0, 1); + n("(?!z)a", "z"); + x2("(?i:a)", "a", 0, 1); + x2("(?i:a)", "A", 0, 1); + x2("(?i:A)", "a", 0, 1); + n("(?i:A)", "b"); + x2("(?i:[A-Z])", "a", 0, 1); + x2("(?i:[f-m])", "H", 0, 1); + x2("(?i:[f-m])", "h", 0, 1); + n("(?i:[f-m])", "e"); + n("(?i:[b-C])", "A"); + x2("(?i:[a-C])", "B", 0, 1); + n("(?i:[c-X])", "["); + n("(?i:[!-k])", "Z"); + x2("(?i:[!-k])", "7", 0, 1); + n("(?i:[T-}])", "b"); + x2("(?i:[T-}])", "{", 0, 1); + x2("(?i:\\?a)", "?A", 0, 2); + x2("(?i:\\*A)", "*a", 0, 2); + n(".", "\n"); + x2("(?m:.)", "\n", 0, 1); + x2("(?m:a.)", "a\n", 0, 2); + x2("(?m:.b)", "a\nb", 1, 3); + x2("a?", "", 0, 0); + x2("a?", "b", 0, 0); + x2("a?", "a", 0, 1); + x2("a*", "", 0, 0); + x2("a*", "a", 0, 1); + x2("a*", "aaa", 0, 3); + x2("a*", "baaaa", 0, 0); + n("a+", ""); + x2("a+", "a", 0, 1); + x2("a+", "aaaa", 0, 4); + x2("a+", "aabbb", 0, 2); + x2("a+", "baaaa", 1, 5); + x2(".?", "", 0, 0); + x2(".?", "f", 0, 1); + x2(".?", "\n", 0, 0); + x2(".*", "", 0, 0); + x2(".*", "abcde", 0, 5); + x2(".+", "z", 0, 1); + x2(".+", "zdswer\n", 0, 6); + x2("a|b", "a", 0, 1); + x2("a|b", "b", 0, 1); + x2("|a", "a", 0, 0); + x2("(|a)", "a", 0, 0); + x2("ab|bc", "ab", 0, 2); + x2("ab|bc", "bc", 0, 2); + x2("z(?:ab|bc)", "zbc", 0, 3); + x2("a(?:ab|bc)c", "aabc", 0, 4); + x2("ab|(?:ac|az)", "az", 0, 2); + x2("a|b|c", "dc", 1, 2); + x2("a|b|cd|efg|h|ijk|lmn|o|pq|rstuvwx|yz", "pqr", 0, 2); + n("a|b|cd|efg|h|ijk|lmn|o|pq|rstuvwx|yz", "mn"); + x2("a|^z", "ba", 1, 2); + x2("a|^z", "za", 0, 1); + x2("a|\\Gz", "bza", 2, 3); + x2("a|\\Gz", "za", 0, 1); + x2("a|\\Az", "bza", 2, 3); + x2("a|\\Az", "za", 0, 1); + x2("a|b\\Z", "ba", 1, 2); + x2("a|b\\Z", "b", 0, 1); + x2("a|b\\z", "ba", 1, 2); + x2("a|b\\z", "b", 0, 1); + x2("\\w|\\s", " ", 0, 1); + n("\\w|\\w", " "); + x2("\\w|%", "%", 0, 1); + x2("\\w|[&$]", "&", 0, 1); + x2("[b-d]|[^e-z]", "a", 0, 1); + x2("(?:a|[c-f])|bz", "dz", 0, 1); + x2("(?:a|[c-f])|bz", "bz", 0, 2); + x2("abc|(?=zz)..f", "zzf", 0, 3); + x2("abc|(?!zz)..f", "abf", 0, 3); + x2("(?=za)..a|(?=zz)..a", "zza", 0, 3); + n("(?>a|abd)c", "abdc"); + x2("(?>abd|a)c", "abdc", 0, 4); + x2("a?|b", "a", 0, 1); + x2("a?|b", "b", 0, 0); + x2("a?|b", "", 0, 0); + x2("a*|b", "aa", 0, 2); + x2("a*|b*", "ba", 0, 0); + x2("a*|b*", "ab", 0, 1); + x2("a+|b*", "", 0, 0); + x2("a+|b*", "bbb", 0, 3); + x2("a+|b*", "abbb", 0, 1); + n("a+|b+", ""); + x2("(a|b)?", "b", 0, 1); + x2("(a|b)*", "ba", 0, 2); + x2("(a|b)+", "bab", 0, 3); + x2("(ab|ca)+", "caabbc", 0, 4); + x2("(ab|ca)+", "aabca", 1, 5); + x2("(ab|ca)+", "abzca", 0, 2); + x2("(a|bab)+", "ababa", 0, 5); + x2("(a|bab)+", "ba", 1, 2); + x2("(a|bab)+", "baaaba", 1, 4); + x2("(?:a|b)(?:a|b)", "ab", 0, 2); + x2("(?:a*|b*)(?:a*|b*)", "aaabbb", 0, 3); + x2("(?:a*|b*)(?:a+|b+)", "aaabbb", 0, 6); + x2("(?:a+|b+){2}", "aaabbb", 0, 6); + x2("h{0,}", "hhhh", 0, 4); + x2("(?:a+|b+){1,2}", "aaabbb", 0, 6); + x2("(?:a+|\\Ab*)cc", "cc", 0, 2); + n("(?:a+|\\Ab*)cc", "abcc"); + x2("(?:^a+|b+)*c", "aabbbabc", 6, 8); + x2("(?:^a+|b+)*c", "aabbbbc", 0, 7); + x2("a|(?i)c", "C", 0, 1); + x2("(?i)c|a", "C", 0, 1); + x2("(?i)c|a", "A", 0, 1); + x2("(?i:c)|a", "C", 0, 1); + n("(?i:c)|a", "A"); + x2("[abc]?", "abc", 0, 1); + x2("[abc]*", "abc", 0, 3); + x2("[^abc]*", "abc", 0, 0); + n("[^abc]+", "abc"); + x2("a?\?", "aaa", 0, 0); + x2("ba?\?b", "bab", 0, 3); + x2("a*?", "aaa", 0, 0); + x2("ba*?", "baa", 0, 1); + x2("ba*?b", "baab", 0, 4); + x2("a+?", "aaa", 0, 1); + x2("ba+?", "baa", 0, 2); + x2("ba+?b", "baab", 0, 4); + x2("(?:a?)?\?", "a", 0, 0); + x2("(?:a?\?)?", "a", 0, 0); + x2("(?:a?)+?", "aaa", 0, 1); + x2("(?:a+)?\?", "aaa", 0, 0); + x2("(?:a+)?\?b", "aaab", 0, 4); + x2("(?:ab)?{2}", "", 0, 0); + x2("(?:ab)?{2}", "ababa", 0, 4); + x2("(?:ab)*{0}", "ababa", 0, 0); + x2("(?:ab){3,}", "abababab", 0, 8); + n("(?:ab){3,}", "abab"); + x2("(?:ab){2,4}", "ababab", 0, 6); + x2("(?:ab){2,4}", "ababababab", 0, 8); + x2("(?:ab){2,4}?", "ababababab", 0, 4); + x2("(?:ab){,}", "ab{,}", 0, 5); + x2("(?:abc)+?{2}", "abcabcabc", 0, 6); + x2("(?:X*)(?i:xa)", "XXXa", 0, 4); + x2("(d+)([^abc]z)", "dddz", 0, 4); + x2("([^abc]*)([^abc]z)", "dddz", 0, 4); + x2("(\\w+)(\\wz)", "dddz", 0, 4); + x3("(a)", "a", 0, 1, 1); + x3("(ab)", "ab", 0, 2, 1); + x2("((ab))", "ab", 0, 2); + x3("((ab))", "ab", 0, 2, 1); + x3("((ab))", "ab", 0, 2, 2); + x3("((((((((((((((((((((ab))))))))))))))))))))", "ab", 0, 2, 20); + x3("(ab)(cd)", "abcd", 0, 2, 1); + x3("(ab)(cd)", "abcd", 2, 4, 2); + x3("()(a)bc(def)ghijk", "abcdefghijk", 3, 6, 3); + x3("(()(a)bc(def)ghijk)", "abcdefghijk", 3, 6, 4); + x2("(^a)", "a", 0, 1); + x3("(a)|(a)", "ba", 1, 2, 1); + x3("(^a)|(a)", "ba", 1, 2, 2); + x3("(a?)", "aaa", 0, 1, 1); + x3("(a*)", "aaa", 0, 3, 1); + x3("(a*)", "", 0, 0, 1); + x3("(a+)", "aaaaaaa", 0, 7, 1); + x3("(a+|b*)", "bbbaa", 0, 3, 1); + x3("(a+|b?)", "bbbaa", 0, 1, 1); + x3("(abc)?", "abc", 0, 3, 1); + x3("(abc)*", "abc", 0, 3, 1); + x3("(abc)+", "abc", 0, 3, 1); + x3("(xyz|abc)+", "abc", 0, 3, 1); + x3("([xyz][abc]|abc)+", "abc", 0, 3, 1); + x3("((?i:abc))", "AbC", 0, 3, 1); + x2("(abc)(?i:\\1)", "abcABC", 0, 6); + x3("((?m:a.c))", "a\nc", 0, 3, 1); + x3("((?=az)a)", "azb", 0, 1, 1); + x3("abc|(.abd)", "zabd", 0, 4, 1); + x2("(?:abc)|(ABC)", "abc", 0, 3); + x3("(?i:(abc))|(zzz)", "ABC", 0, 3, 1); + x3("a*(.)", "aaaaz", 4, 5, 1); + x3("a*?(.)", "aaaaz", 0, 1, 1); + x3("a*?(c)", "aaaac", 4, 5, 1); + x3("[bcd]a*(.)", "caaaaz", 5, 6, 1); + x3("(\\Abb)cc", "bbcc", 0, 2, 1); + n("(\\Abb)cc", "zbbcc"); + x3("(^bb)cc", "bbcc", 0, 2, 1); + n("(^bb)cc", "zbbcc"); + x3("cc(bb$)", "ccbb", 2, 4, 1); + n("cc(bb$)", "ccbbb"); + n("(\\1)", ""); + n("\\1(a)", "aa"); + n("(a(b)\\1)\\2+", "ababb"); + n("(?:(?:\\1|z)(a))+$", "zaa"); + x2("(?:(?:\\1|z)(a))+$", "zaaa", 0, 4); + x2("(a)(?=\\1)", "aa", 0, 1); + n("(a)$|\\1", "az"); + x2("(a)\\1", "aa", 0, 2); + n("(a)\\1", "ab"); + x2("(a?)\\1", "aa", 0, 2); + x2("(a?\?)\\1", "aa", 0, 0); + x2("(a*)\\1", "aaaaa", 0, 4); + x3("(a*)\\1", "aaaaa", 0, 2, 1); + x2("a(b*)\\1", "abbbb", 0, 5); + x2("a(b*)\\1", "ab", 0, 1); + x2("(a*)(b*)\\1\\2", "aaabbaaabb", 0, 10); + x2("(a*)(b*)\\2", "aaabbbb", 0, 7); + x2("(((((((a*)b))))))c\\7", "aaabcaaa", 0, 8); + x3("(((((((a*)b))))))c\\7", "aaabcaaa", 0, 3, 7); + x2("(a)(b)(c)\\2\\1\\3", "abcbac", 0, 6); + x2("([a-d])\\1", "cc", 0, 2); + x2("(\\w\\d\\s)\\1", "f5 f5 ", 0, 6); + n("(\\w\\d\\s)\\1", "f5 f5"); + x2("(who|[a-c]{3})\\1", "whowho", 0, 6); + x2("...(who|[a-c]{3})\\1", "abcwhowho", 0, 9); + x2("(who|[a-c]{3})\\1", "cbccbc", 0, 6); + x2("(^a)\\1", "aa", 0, 2); + n("(^a)\\1", "baa"); + n("(a$)\\1", "aa"); + n("(ab\\Z)\\1", "ab"); + x2("(a*\\Z)\\1", "a", 1, 1); + x2(".(a*\\Z)\\1", "ba", 1, 2); + x3("(.(abc)\\2)", "zabcabc", 0, 7, 1); + x3("(.(..\\d.)\\2)", "z12341234", 0, 9, 1); + x2("((?i:az))\\1", "AzAz", 0, 4); + n("((?i:az))\\1", "Azaz"); + x2("(?<=a)b", "ab", 1, 2); + n("(?<=a)b", "bb"); + x2("(?<=a|b)b", "bb", 1, 2); + x2("(?<=a|bc)b", "bcb", 2, 3); + x2("(?<=a|bc)b", "ab", 1, 2); + x2("(?<=a|bc||defghij|klmnopq|r)z", "rz", 1, 2); + x2("(?<!a)b", "cb", 1, 2); + n("(?<!a)b", "ab"); + x2("(?<!a|bc)b", "bbb", 0, 1); + n("(?<!a|bc)z", "bcz"); + x2("(?<name1>a)", "a", 0, 1); + x2("(?<name-2>ab)\\1", "abab", 0, 4); + x2("(?<name-3>.zv.)\\k<name-3>", "azvbazvb", 0, 8); + x2("(?<=\\g<ab>)|-\\zEND (?<ab>XyZ)", "XyZ", 3, 3); + x2("(?<n>|a\\g<n>)+", "", 0, 0); + x2("(?<n>|\\(\\g<n>\\))+$", "()(())", 0, 6); + x3("\\g<n>(?<n>.){0}", "X", 0, 1, 1); + x2("\\g<n>(abc|df(?<n>.YZ){2,8}){0}", "XYZ", 0, 3); + x2("\\A(?<n>(a\\g<n>)|)\\z", "aaaa", 0, 4); + x2("(?<n>|\\g<m>\\g<n>)\\z|\\zEND (?<m>a|(b)\\g<m>)", "bbbbabba", 0, 8); + x2("(?<@:name[1240]>\\w+\\sx)a+\\k<@:name[1240]>", " fg xaaaaaaaafg x", 2, 18); + x3("(z)()()(?<9>a)\\4", "zaa", 1, 2, 4); + x2("(.)(((?<*>a)))\\k<*>", "zaa", 0, 3); + x2("((?<name1>\\d)|(?<name2>\\w))(\\k<name1>|\\k<name2>)", "ff", 0, 2); + x2("(?:(?<x>)|(?<x>efg))\\k<x>", "", 0, 0); + x2("(?:(?<@x>abc)|(?<@x>efg))\\k<@x>", "abcefgefg", 3, 9); + n("(?:(?<@x>abc)|(?<@x>efg))\\k<@x>", "abcefg"); + x2("(?:(?<n1>.)|(?<n1>..)|(?<n1>...)|(?<n1>....)|(?<n1>.....)|(?<n1>......)|(?<n1>.......)|(?<n1>........)|(?<n1>.........)|(?<n1>..........)|(?<n1>...........)|(?<n1>............)|(?<n1>.............)|(?<n1>..............))\\k<n1>$", "a-pyumpyum", 2, 10); + x3("(?:(?<n1>.)|(?<n1>..)|(?<n1>...)|(?<n1>....)|(?<n1>.....)|(?<n1>......)|(?<n1>.......)|(?<n1>........)|(?<n1>.........)|(?<n1>..........)|(?<n1>...........)|(?<n1>............)|(?<n1>.............)|(?<n1>..............))\\k<n1>$", "xxxxabcdefghijklmnabcdefghijklmn", 4, 18, 14); + x3("(?<name1>)(?<name2>)(?<name3>)(?<name4>)(?<name5>)(?<name6>)(?<name7>)(?<name8>)(?<name9>)(?<name10>)(?<name11>)(?<name12>)(?<name13>)(?<name14>)(?<name15>)(?<name16>aaa)(?<name17>)$", "aaa", 0, 3, 16); + x2("(?<foo>a|\\(\\g<foo>\\))", "a", 0, 1); + x2("(?<foo>a|\\(\\g<foo>\\))", "((((((a))))))", 0, 13); + x3("(?<foo>a|\\(\\g<foo>\\))", "((((((((a))))))))", 0, 17, 1); + x2("\\g<bar>|\\zEND(?<bar>.*abc$)", "abcxxxabc", 0, 9); + x2("\\g<1>|\\zEND(.a.)", "bac", 0, 3); + x3("\\g<2>\\g<1>|\\zEND(.a.)(?<?>.b.)", "xbxyay", 3, 6, 1); + x2("\\A(?:\\g<pon>|\\g<pan>|\\zEND (?<pan>a|c\\g<pon>c)(?<pon>b|d\\g<pan>d))$", "cdcbcdc", 0, 7); + x2("\\A(?<n>|a\\g<m>)\\z|\\zEND (?<m>\\g<n>)", "aaaa", 0, 4); + x2("(?<n>(a|b\\g<n>c){3,5})", "baaaaca", 1, 5); + x2("(?<n>(a|b\\g<n>c){3,5})", "baaaacaaaaa", 0, 10); + x2("", "‚ ", 0, 0); + x2("‚ ", "‚ ", 0, 2); + n("‚¢", "‚ "); + x2("‚¤‚¤", "‚¤‚¤", 0, 4); + x2("‚ ‚¢‚¤", "‚ ‚¢‚¤", 0, 6); + x2("‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±", "‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±", 0, 70); + x2("‚ ", "‚¢‚ ", 2, 4); + x2("‚¢‚¤", "‚ ‚¢‚¤", 2, 6); + x2("\\xca\\xb8", "\xca\xb8", 0, 2); + x2(".", "‚ ", 0, 2); + x2("..", "‚©‚«", 0, 4); + x2("\\w", "‚¨", 0, 2); + n("\\W", "‚ "); + x2("\\S", "‚»", 0, 2); + x2("\\S", "Š¿", 0, 2); + x2("\\b", "‹C ", 0, 0); + x2("\\b", " ‚Ù", 1, 1); + x2("\\B", "‚¹‚» ", 2, 2); + x2("\\B", "‚¤ ", 3, 3); + x2("\\B", " ‚¢", 0, 0); + x2("[‚½‚¿]", "‚¿", 0, 2); + n("[‚È‚É]", "‚Ê"); + x2("[‚¤-‚¨]", "‚¦", 0, 2); + n("[^‚¯]", "‚¯"); + x2("[\\w]", "‚Ë", 0, 2); + n("[\\d]", "‚Ó"); + x2("[\\D]", "‚Í", 0, 2); + n("[\\s]", "‚"); + x2("[\\S]", "‚Ö", 0, 2); + x2("[\\w\\d]", "‚æ", 0, 2); + x2("[\\w\\d]", " ‚æ", 3, 5); + n("\\w‹SŽÔ", " ‹SŽÔ"); + x2("‹S\\WŽÔ", "‹S ŽÔ", 0, 5); + x2("‚ .‚¢.‚¤", "‚ ‚ ‚¢‚¢‚¤", 0, 10); + x2(".\\w‚¤\\W..‚¼", "‚¦‚¤‚¤ ‚¤‚¼‚¼", 0, 13); + x2("\\s\\w‚±‚±‚±", " ‚±‚±‚±‚±", 0, 9); + x2("‚ ‚ .‚¯", "‚ ‚ ‚¯‚¯", 0, 8); + n(".‚¢", "‚¢‚¦"); + x2(".‚¨", "‚¨‚¨", 0, 4); + x2("^‚ ", "‚ ", 0, 2); + x2("^‚Þ$", "‚Þ", 0, 2); + x2("^\\w$", "‚É", 0, 2); + x2("^\\w‚©‚«‚‚¯‚±$", "z‚©‚«‚‚¯‚±", 0, 11); + x2("^\\w...‚¤‚¦‚¨$", "z‚ ‚¢‚¤‚¤‚¦‚¨", 0, 13); + x2("\\w\\w\\s\\W‚¨‚¨‚¨\\d", "a‚¨ ‚¨‚¨‚¨4", 0, 12); + x2("\\A‚½‚¿‚Â", "‚½‚¿‚Â", 0, 6); + x2("‚Þ‚ß‚à\\Z", "‚Þ‚ß‚à", 0, 6); + x2("‚©‚«‚\\z", "‚©‚«‚", 0, 6); + x2("‚©‚«‚\\Z", "‚©‚«‚\n", 0, 6); + x2("\\G‚Û‚Ò", "‚Û‚Ò", 0, 4); + n("\\G‚¦", "‚¤‚¦‚¨"); + n("‚Æ‚Ä\\G", "‚Æ‚Ä"); + n("‚Ü‚Ý\\A", "‚Ü‚Ý"); + n("‚Ü\\A‚Ý", "‚Ü‚Ý"); + x2("(?=‚¹)‚¹", "‚¹", 0, 2); + n("(?=‚¤).", "‚¢"); + x2("(?!‚¤)‚©", "‚©", 0, 2); + n("(?!‚Æ)‚ ", "‚Æ"); + x2("(?i:‚ )", "‚ ", 0, 2); + x2("(?i:‚Ô‚×)", "‚Ô‚×", 0, 4); + n("(?i:‚¢)", "‚¤"); + x2("(?m:‚æ.)", "‚æ\n", 0, 3); + x2("(?m:.‚ß)", "‚Ü\n‚ß", 2, 5); + x2("‚ ?", "", 0, 0); + x2("•Ï?", "‰»", 0, 0); + x2("•Ï?", "•Ï", 0, 2); + x2("—Ê*", "", 0, 0); + x2("—Ê*", "—Ê", 0, 2); + x2("Žq*", "ŽqŽqŽq", 0, 6); + x2("”n*", "Ž”n”n”n”n", 0, 0); + n("ŽR+", ""); + x2("‰Í+", "‰Í", 0, 2); + x2("Žž+", "ŽžŽžŽžŽž", 0, 8); + x2("‚¦+", "‚¦‚¦‚¤‚¤‚¤", 0, 4); + x2("‚¤+", "‚¨‚¤‚¤‚¤‚¤", 2, 10); + x2(".?", "‚½", 0, 2); + x2(".*", "‚ς҂ՂØ", 0, 8); + x2(".+", "‚ë", 0, 2); + x2(".+", "‚¢‚¤‚¦‚©\n", 0, 8); + x2("‚ |‚¢", "‚ ", 0, 2); + x2("‚ |‚¢", "‚¢", 0, 2); + x2("‚ ‚¢|‚¢‚¤", "‚ ‚¢", 0, 4); + x2("‚ ‚¢|‚¢‚¤", "‚¢‚¤", 0, 4); + x2("‚ð(?:‚©‚«|‚«‚)", "‚ð‚©‚«", 0, 6); + x2("‚ð(?:‚©‚«|‚«‚)‚¯", "‚ð‚«‚‚¯", 0, 8); + x2("‚ ‚¢|(?:‚ ‚¤|‚ ‚ð)", "‚ ‚ð", 0, 4); + x2("‚ |‚¢|‚¤", "‚¦‚¤", 2, 4); + x2("‚ |‚¢|‚¤‚¦|‚¨‚©‚«|‚|‚¯‚±‚³|‚µ‚·‚¹|‚»|‚½‚¿|‚‚ĂƂȂÉ|‚Ê‚Ë", "‚µ‚·‚¹", 0, 6); + n("‚ |‚¢|‚¤‚¦|‚¨‚©‚«|‚|‚¯‚±‚³|‚µ‚·‚¹|‚»|‚½‚¿|‚‚ĂƂȂÉ|‚Ê‚Ë", "‚·‚¹"); + x2("‚ |^‚í", "‚Ô‚ ", 2, 4); + x2("‚ |^‚ð", "‚ð‚ ", 0, 2); + x2("‹S|\\GŽÔ", "‚¯ŽÔ‹S", 4, 6); + x2("‹S|\\GŽÔ", "ŽÔ‹S", 0, 2); + x2("‹S|\\AŽÔ", "bŽÔ‹S", 3, 5); + x2("‹S|\\AŽÔ", "ŽÔ", 0, 2); + x2("‹S|ŽÔ\\Z", "ŽÔ‹S", 2, 4); + x2("‹S|ŽÔ\\Z", "ŽÔ", 0, 2); + x2("‹S|ŽÔ\\Z", "ŽÔ\n", 0, 2); + x2("‹S|ŽÔ\\z", "ŽÔ‹S", 2, 4); + x2("‹S|ŽÔ\\z", "ŽÔ", 0, 2); + x2("\\w|\\s", "‚¨", 0, 2); + x2("\\w|%", "%‚¨", 0, 1); + x2("\\w|[&$]", "‚¤&", 0, 2); + x2("[‚¢-‚¯]", "‚¤", 0, 2); + x2("[‚¢-‚¯]|[^‚©-‚±]", "‚ ", 0, 2); + x2("[‚¢-‚¯]|[^‚©-‚±]", "‚©", 0, 2); + x2("(?:‚ |[‚¤-‚«])|‚¢‚ð", "‚¤‚ð", 0, 2); + x2("(?:‚ |[‚¤-‚«])|‚¢‚ð", "‚¢‚ð", 0, 4); + x2("‚ ‚¢‚¤|(?=‚¯‚¯)..‚Ù", "‚¯‚¯‚Ù", 0, 6); + x2("‚ ‚¢‚¤|(?!‚¯‚¯)..‚Ù", "‚ ‚¢‚Ù", 0, 6); + x2("(?=‚ð‚ )..‚ |(?=‚ð‚ð)..‚ ", "‚ð‚ð‚ ", 0, 6); + x2("(?<=‚ |‚¢‚¤)‚¢", "‚¢‚¤‚¢", 4, 6); + n("(?>‚ |‚ ‚¢‚¦)‚¤", "‚ ‚¢‚¦‚¤"); + x2("(?>‚ ‚¢‚¦|‚ )‚¤", "‚ ‚¢‚¦‚¤", 0, 8); + x2("‚ ?|‚¢", "‚ ", 0, 2); + x2("‚ ?|‚¢", "‚¢", 0, 0); + x2("‚ ?|‚¢", "", 0, 0); + x2("‚ *|‚¢", "‚ ‚ ", 0, 4); + x2("‚ *|‚¢*", "‚¢‚ ", 0, 0); + x2("‚ *|‚¢*", "‚ ‚¢", 0, 2); + x2("[a‚ ]*|‚¢*", "a‚ ‚¢‚¢‚¢", 0, 3); + x2("‚ +|‚¢*", "", 0, 0); + x2("‚ +|‚¢*", "‚¢‚¢‚¢", 0, 6); + x2("‚ +|‚¢*", "‚ ‚¢‚¢‚¢", 0, 2); + x2("‚ +|‚¢*", "a‚ ‚¢‚¢‚¢", 0, 0); + n("‚ +|‚¢+", ""); + x2("(‚ |‚¢)?", "‚¢", 0, 2); + x2("(‚ |‚¢)*", "‚¢‚ ", 0, 4); + x2("(‚ |‚¢)+", "‚¢‚ ‚¢", 0, 6); + x2("(‚ ‚¢|‚¤‚ )+", "‚¤‚ ‚ ‚¢‚¤‚¦", 0, 8); + x2("(‚ ‚¢|‚¤‚¦)+", "‚¤‚ ‚ ‚¢‚¤‚¦", 4, 12); + x2("(‚ ‚¢|‚¤‚ )+", "‚ ‚ ‚¢‚¤‚ ", 2, 10); + x2("(‚ ‚¢|‚¤‚ )+", "‚ ‚¢‚ð‚¤‚ ", 0, 4); + x2("(‚ ‚¢|‚¤‚ )+", "$$zzzz‚ ‚¢‚ð‚¤‚ ", 6, 10); + x2("(‚ |‚¢‚ ‚¢)+", "‚ ‚¢‚ ‚¢‚ ", 0, 10); + x2("(‚ |‚¢‚ ‚¢)+", "‚¢‚ ", 2, 4); + x2("(‚ |‚¢‚ ‚¢)+", "‚¢‚ ‚ ‚ ‚¢‚ ", 2, 8); + x2("(?:‚ |‚¢)(?:‚ |‚¢)", "‚ ‚¢", 0, 4); + x2("(?:‚ *|‚¢*)(?:‚ *|‚¢*)", "‚ ‚ ‚ ‚¢‚¢‚¢", 0, 6); + x2("(?:‚ *|‚¢*)(?:‚ +|‚¢+)", "‚ ‚ ‚ ‚¢‚¢‚¢", 0, 12); + x2("(?:‚ +|‚¢+){2}", "‚ ‚ ‚ ‚¢‚¢‚¢", 0, 12); + x2("(?:‚ +|‚¢+){1,2}", "‚ ‚ ‚ ‚¢‚¢‚¢", 0, 12); + x2("(?:‚ +|\\A‚¢*)‚¤‚¤", "‚¤‚¤", 0, 4); + n("(?:‚ +|\\A‚¢*)‚¤‚¤", "‚ ‚¢‚¤‚¤"); + x2("(?:^‚ +|‚¢+)*‚¤", "‚ ‚ ‚¢‚¢‚¢‚ ‚¢‚¤", 12, 16); + x2("(?:^‚ +|‚¢+)*‚¤", "‚ ‚ ‚¢‚¢‚¢‚¢‚¤", 0, 14); + x2("‚¤{0,}", "‚¤‚¤‚¤‚¤", 0, 8); + x2("‚ |(?i)c", "C", 0, 1); + x2("(?i)c|‚ ", "C", 0, 1); + x2("(?i:‚ )|a", "a", 0, 1); + n("(?i:‚ )|a", "A"); + x2("[‚ ‚¢‚¤]?", "‚ ‚¢‚¤", 0, 2); + x2("[‚ ‚¢‚¤]*", "‚ ‚¢‚¤", 0, 6); + x2("[^‚ ‚¢‚¤]*", "‚ ‚¢‚¤", 0, 0); + n("[^‚ ‚¢‚¤]+", "‚ ‚¢‚¤"); + x2("‚ ?\?", "‚ ‚ ‚ ", 0, 0); + x2("‚¢‚ ?\?‚¢", "‚¢‚ ‚¢", 0, 6); + x2("‚ *?", "‚ ‚ ‚ ", 0, 0); + x2("‚¢‚ *?", "‚¢‚ ‚ ", 0, 2); + x2("‚¢‚ *?‚¢", "‚¢‚ ‚ ‚¢", 0, 8); + x2("‚ +?", "‚ ‚ ‚ ", 0, 2); + x2("‚¢‚ +?", "‚¢‚ ‚ ", 0, 4); + x2("‚¢‚ +?‚¢", "‚¢‚ ‚ ‚¢", 0, 8); + x2("(?:“V?)?\?", "“V", 0, 0); + x2("(?:“V?\?)?", "“V", 0, 0); + x2("(?:–²?)+?", "–²–²–²", 0, 2); + x2("(?:•—+)?\?", "•—•—•—", 0, 0); + x2("(?:á+)?\?‘š", "ááᑚ", 0, 8); + x2("(?:‚ ‚¢)?{2}", "", 0, 0); + x2("(?:‹SŽÔ)?{2}", "‹SŽÔ‹SŽÔ‹S", 0, 8); + x2("(?:‹SŽÔ)*{0}", "‹SŽÔ‹SŽÔ‹S", 0, 0); + x2("(?:‹SŽÔ){3,}", "‹SŽÔ‹SŽÔ‹SŽÔ‹SŽÔ", 0, 16); + n("(?:‹SŽÔ){3,}", "‹SŽÔ‹SŽÔ"); + x2("(?:‹SŽÔ){2,4}", "‹SŽÔ‹SŽÔ‹SŽÔ", 0, 12); + x2("(?:‹SŽÔ){2,4}", "‹SŽÔ‹SŽÔ‹SŽÔ‹SŽÔ‹SŽÔ", 0, 16); + x2("(?:‹SŽÔ){2,4}?", "‹SŽÔ‹SŽÔ‹SŽÔ‹SŽÔ‹SŽÔ", 0, 8); + x2("(?:‹SŽÔ){,}", "‹SŽÔ{,}", 0, 7); + x2("(?:‚©‚«‚)+?{2}", "‚©‚«‚‚©‚«‚‚©‚«‚", 0, 12); + x3("(‰Î)", "‰Î", 0, 2, 1); + x3("(‰Î…)", "‰Î…", 0, 4, 1); + x2("((ŽžŠÔ))", "ŽžŠÔ", 0, 4); + x3("((•—…))", "•—…", 0, 4, 1); + x3("((ð“ú))", "ð“ú", 0, 4, 2); + x3("((((((((((((((((((((—ÊŽq))))))))))))))))))))", "—ÊŽq", 0, 4, 20); + x3("(‚ ‚¢)(‚¤‚¦)", "‚ ‚¢‚¤‚¦", 0, 4, 1); + x3("(‚ ‚¢)(‚¤‚¦)", "‚ ‚¢‚¤‚¦", 4, 8, 2); + x3("()(‚ )‚¢‚¤(‚¦‚¨‚©)‚«‚‚¯‚±", "‚ ‚¢‚¤‚¦‚¨‚©‚«‚‚¯‚±", 6, 12, 3); + x3("(()(‚ )‚¢‚¤(‚¦‚¨‚©)‚«‚‚¯‚±)", "‚ ‚¢‚¤‚¦‚¨‚©‚«‚‚¯‚±", 6, 12, 4); + x3(".*(ƒtƒH)ƒ“Eƒ}(ƒ“()ƒVƒ…ƒ^)ƒCƒ“", "ƒtƒHƒ“Eƒ}ƒ“ƒVƒ…ƒ^ƒCƒ“", 10, 18, 2); + x2("(^‚ )", "‚ ", 0, 2); + x3("(‚ )|(‚ )", "‚¢‚ ", 2, 4, 1); + x3("(^‚ )|(‚ )", "‚¢‚ ", 2, 4, 2); + x3("(‚ ?)", "‚ ‚ ‚ ", 0, 2, 1); + x3("(‚Ü*)", "‚܂܂Ü", 0, 6, 1); + x3("(‚Æ*)", "", 0, 0, 1); + x3("(‚é+)", "‚é‚é‚é‚é‚é‚é‚é", 0, 14, 1); + x3("(‚Ó+|‚Ö*)", "‚Ó‚Ó‚Ó‚Ö‚Ö", 0, 6, 1); + x3("(‚ +|‚¢?)", "‚¢‚¢‚¢‚ ‚ ", 0, 2, 1); + x3("(‚ ‚¢‚¤)?", "‚ ‚¢‚¤", 0, 6, 1); + x3("(‚ ‚¢‚¤)*", "‚ ‚¢‚¤", 0, 6, 1); + x3("(‚ ‚¢‚¤)+", "‚ ‚¢‚¤", 0, 6, 1); + x3("(‚³‚µ‚·|‚ ‚¢‚¤)+", "‚ ‚¢‚¤", 0, 6, 1); + x3("([‚ȂɂÊ][‚©‚«‚]|‚©‚«‚)+", "‚©‚«‚", 0, 6, 1); + x3("((?i:‚ ‚¢‚¤))", "‚ ‚¢‚¤", 0, 6, 1); + x3("((?m:‚ .‚¤))", "‚ \n‚¤", 0, 5, 1); + x3("((?=‚ ‚ñ)‚ )", "‚ ‚ñ‚¢", 0, 2, 1); + x3("‚ ‚¢‚¤|(.‚ ‚¢‚¦)", "‚ñ‚ ‚¢‚¦", 0, 8, 1); + x3("‚ *(.)", "‚ ‚ ‚ ‚ ‚ñ", 8, 10, 1); + x3("‚ *?(.)", "‚ ‚ ‚ ‚ ‚ñ", 0, 2, 1); + x3("‚ *?(‚ñ)", "‚ ‚ ‚ ‚ ‚ñ", 8, 10, 1); + x3("[‚¢‚¤‚¦]‚ *(.)", "‚¦‚ ‚ ‚ ‚ ‚ñ", 10, 12, 1); + x3("(\\A‚¢‚¢)‚¤‚¤", "‚¢‚¢‚¤‚¤", 0, 4, 1); + n("(\\A‚¢‚¢)‚¤‚¤", "‚ñ‚¢‚¢‚¤‚¤"); + x3("(^‚¢‚¢)‚¤‚¤", "‚¢‚¢‚¤‚¤", 0, 4, 1); + n("(^‚¢‚¢)‚¤‚¤", "‚ñ‚¢‚¢‚¤‚¤"); + x3("‚ë‚ë(‚é‚é$)", "‚ë‚ë‚é‚é", 4, 8, 1); + n("‚ë‚ë(‚é‚é$)", "‚ë‚ë‚é‚é‚é"); + x2("(–³)\\1", "–³–³", 0, 4); + n("(–³)\\1", "–³•"); + x2("(‹ó?)\\1", "‹ó‹ó", 0, 4); + x2("(‹ó?\?)\\1", "‹ó‹ó", 0, 0); + x2("(‹ó*)\\1", "‹ó‹ó‹ó‹ó‹ó", 0, 8); + x3("(‹ó*)\\1", "‹ó‹ó‹ó‹ó‹ó", 0, 4, 1); + x2("‚ (‚¢*)\\1", "‚ ‚¢‚¢‚¢‚¢", 0, 10); + x2("‚ (‚¢*)\\1", "‚ ‚¢", 0, 2); + x2("(‚ *)(‚¢*)\\1\\2", "‚ ‚ ‚ ‚¢‚¢‚ ‚ ‚ ‚¢‚¢", 0, 20); + x2("(‚ *)(‚¢*)\\2", "‚ ‚ ‚ ‚¢‚¢‚¢‚¢", 0, 14); + x3("(‚ *)(‚¢*)\\2", "‚ ‚ ‚ ‚¢‚¢‚¢‚¢", 6, 10, 2); + x2("(((((((‚Û*)‚Ø))))))‚Ò\\7", "‚ۂۂۂ؂҂ۂۂÛ", 0, 16); + x3("(((((((‚Û*)‚Ø))))))‚Ò\\7", "‚ۂۂۂ؂҂ۂۂÛ", 0, 6, 7); + x2("(‚Í)(‚Ð)(‚Ó)\\2\\1\\3", "‚͂ЂӂЂ͂Ó", 0, 12); + x2("([‚«-‚¯])\\1", "‚‚", 0, 4); + x2("(\\w\\d\\s)\\1", "‚ 5 ‚ 5 ", 0, 8); + n("(\\w\\d\\s)\\1", "‚ 5 ‚ 5"); + x2("(’NH|[‚ -‚¤]{3})\\1", "’NH’NH", 0, 8); + x2("...(’NH|[‚ -‚¤]{3})\\1", "‚ a‚ ’NH’NH", 0, 13); + x2("(’NH|[‚ -‚¤]{3})\\1", "‚¤‚¢‚¤‚¤‚¢‚¤", 0, 12); + x2("(^‚±)\\1", "‚±‚±", 0, 4); + n("(^‚Þ)\\1", "‚߂ނÞ"); + n("(‚ $)\\1", "‚ ‚ "); + n("(‚ ‚¢\\Z)\\1", "‚ ‚¢"); + x2("(‚ *\\Z)\\1", "‚ ", 2, 2); + x2(".(‚ *\\Z)\\1", "‚¢‚ ", 2, 4); + x3("(.(‚â‚¢‚ä)\\2)", "z‚â‚¢‚ä‚â‚¢‚ä", 0, 13, 1); + x3("(.(..\\d.)\\2)", "‚ 12341234", 0, 10, 1); + x2("((?i:‚ v‚¸))\\1", "‚ v‚¸‚ v‚¸", 0, 10); + x2("(?<‹ð‚©>•Ï|\\(\\g<‹ð‚©>\\))", "((((((•Ï))))))", 0, 14); + x2("\\A(?:\\g<ˆ¢-1>|\\g<‰]-2>|\\zI—¹ (?<ˆ¢-1>ŠÏ|Ž©\\g<‰]-2>Ž©)(?<‰]-2>Ý|•ìŽF\\g<ˆ¢-1>•ìŽF))$", "•ìŽFŽ©•ìŽFŽ©ÝŽ©•ìŽFŽ©•ìŽF", 0, 26); + x2("[[‚ЂÓ]]", "‚Ó", 0, 2); + x2("[[‚¢‚¨‚¤]‚©]", "‚©", 0, 2); + n("[[^‚ ]]", "‚ "); + n("[^[‚ ]]", "‚ "); + x2("[^[^‚ ]]", "‚ ", 0, 2); + x2("[[‚©‚«‚]&&‚«‚]", "‚", 0, 2); + n("[[‚©‚«‚]&&‚«‚]", "‚©"); + n("[[‚©‚«‚]&&‚«‚]", "‚¯"); + x2("[‚ -‚ñ&&‚¢-‚ð&&‚¤-‚ï]", "‚ï", 0, 2); + n("[^‚ -‚ñ&&‚¢-‚ð&&‚¤-‚ï]", "‚ï"); + x2("[[^‚ &&‚ ]&&‚ -‚ñ]", "‚¢", 0, 2); + n("[[^‚ &&‚ ]&&‚ -‚ñ]", "‚ "); + x2("[[^‚ -‚ñ&&‚¢‚¤‚¦‚¨]&&[^‚¤-‚©]]", "‚«", 0, 2); + n("[[^‚ -‚ñ&&‚¢‚¤‚¦‚¨]&&[^‚¤-‚©]]", "‚¢"); + x2("[^[^‚ ‚¢‚¤]&&[^‚¤‚¦‚¨]]", "‚¤", 0, 2); + x2("[^[^‚ ‚¢‚¤]&&[^‚¤‚¦‚¨]]", "‚¦", 0, 2); + n("[^[^‚ ‚¢‚¤]&&[^‚¤‚¦‚¨]]", "‚©"); + x2("[‚ -&&-‚ ]", "-", 0, 1); + x2("[^[^a-z‚ ‚¢‚¤]&&[^bcdefg‚¤‚¦‚¨]q-w]", "‚¦", 0, 2); + x2("[^[^a-z‚ ‚¢‚¤]&&[^bcdefg‚¤‚¦‚¨]g-w]", "f", 0, 1); + x2("[^[^a-z‚ ‚¢‚¤]&&[^bcdefg‚¤‚¦‚¨]g-w]", "g", 0, 1); + n("[^[^a-z‚ ‚¢‚¤]&&[^bcdefg‚¤‚¦‚¨]g-w]", "2"); + fprintf(stdout, "\nRESULT SUCC: %d, FAIL: %d\n", nsucc, nfail); + +#ifndef POSIX_TEST + regex_region_free(region, 1); + regex_end(); +#endif + + return 0; +} diff --git a/ext/mbstring/php_mbfl_allocators.c b/ext/mbstring/php_mbfl_allocators.c new file mode 100644 index 0000000000..a19143d04e --- /dev/null +++ b/ext/mbstring/php_mbfl_allocators.c @@ -0,0 +1,86 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 4 | + +----------------------------------------------------------------------+ + | Copyright (c) 2001 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.02 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available at through the world-wide-web at | + | http://www.php.net/license/2_02.txt. | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Moriyoshi Koizumi <moriyoshi@php.net> | + | Rui Hirokawa <hirokawa@php.net> | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "zend_API.h" + +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + +#ifdef HAVE_MEMORY_H +#include <memory.h> +#endif + +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif + +#ifdef HAVE_STDDEF_H +#include <stddef.h> +#endif + +#include "mbfl_allocators.h" + +static void *__php__malloc(unsigned int); +static void *__php__realloc(void *, unsigned int); +static void *__php__calloc(unsigned int, unsigned int); +static void __php__free(void *); + +static mbfl_allocators php_allocators = { + __php__malloc, + __php__realloc, + __php__calloc, + __php__free, + __php__malloc, + __php__realloc, + __php__free +}; + +mbfl_allocators *__mbfl_allocators = &php_allocators; + +static void *__php__malloc(unsigned int sz) +{ + return emalloc(sz); +} + +static void *__php__realloc(void *ptr, unsigned int sz) +{ + return erealloc(ptr, sz); +} + +static void *__php__calloc(unsigned int nelems, unsigned int szelem) +{ + return ecalloc(nelems, szelem); +} + +static void __php__free(void *ptr) +{ + efree(ptr); +} + diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 99db5094ad..81a07bc752 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -25,83 +25,38 @@ #include "php.h" #include "php_ini.h" -#include "php_mbregex.h" -#include "mbregex.h" -#include "mbstring.h" #if HAVE_MBREGEX +#include "ext/standard/php_smart_str.h" +#include "php_mbregex.h" +#include "mbstring.h" + ZEND_EXTERN_MODULE_GLOBALS(mbstring) #ifdef ZTS MUTEX_T mbregex_locale_mutex = NULL; #endif -/* - * string buffer - */ -struct strbuf { - unsigned char* buffer; - int length; - int pos; - int allocsz; -}; - -static void -_php_mb_regex_strbuf_init(struct strbuf *pd) -{ - if (pd) { - pd->buffer = (unsigned char*)0; - pd->length = 0; - pd->pos = 0; - pd->allocsz = 64; - } -} - -static int -_php_mb_regex_strbuf_ncat(struct strbuf *pd, const unsigned char *psrc, int len) -{ - if (pd == NULL || psrc == NULL) { - return -1; - } - - if ((pd->pos + len) >= pd->length) { - /* reallocate buffer */ - int newlen = pd->length + pd->allocsz + len; - unsigned char *tmp = (unsigned char*)erealloc((void*)pd->buffer, newlen); - if (tmp == NULL) { - return -1; - } - pd->length = newlen; - pd->buffer = tmp; - } - - while (len > 0) { - pd->buffer[pd->pos++] = *psrc++; - len--; - } - - return len; -} - /* {{{ static void php_mb_regex_free_cache() */ -static void php_mb_regex_free_cache(mb_regex_t *pre) +static void php_mb_regex_free_cache(php_mb_regex_t **pre) { - mbre_free_pattern(pre); + php_mb_regex_free(*pre); } /* }}} */ /* {{{ _php_mb_regex_globals_ctor */ void _php_mb_regex_globals_ctor(zend_mbstring_globals *pglobals TSRMLS_DC) { - MBSTRG(default_mbctype) = MBCTYPE_EUC; - MBSTRG(current_mbctype) = MBCTYPE_EUC; + MBSTRG(default_mbctype) = REGCODE_EUCJP; + MBSTRG(current_mbctype) = REGCODE_EUCJP; zend_hash_init(&(MBSTRG(ht_rc)), 0, NULL, (void (*)(void *)) php_mb_regex_free_cache, 1); - MBSTRG(search_str) = (zval**)0; - MBSTRG(search_str_val) = (zval*)0; - MBSTRG(search_re) = (mb_regex_t*)0; + MBSTRG(search_str) = (zval*) NULL; + MBSTRG(search_re) = (php_mb_regex_t*)NULL; MBSTRG(search_pos) = 0; - MBSTRG(search_regs) = (struct mbre_registers*)0; + MBSTRG(search_regs) = (php_mb_reg_region*)NULL; + MBSTRG(regex_default_options) = RE_OPTION_POSIXLINE; + MBSTRG(regex_default_syntax) = REG_SYNTAX_RUBY; } /* }}} */ @@ -137,8 +92,6 @@ PHP_MSHUTDOWN_FUNCTION(mb_regex) /* {{{ PHP_RINIT_FUNCTION(mb_regex) */ PHP_RINIT_FUNCTION(mb_regex) { - MBSTRG(regex_default_options) = MBRE_OPTION_POSIXLINE; - return SUCCESS; } /* }}} */ @@ -147,25 +100,16 @@ PHP_RINIT_FUNCTION(mb_regex) PHP_RSHUTDOWN_FUNCTION(mb_regex) { MBSTRG(current_mbctype) = MBSTRG(default_mbctype); - if (MBSTRG(search_str)) { - if (ZVAL_REFCOUNT(*MBSTRG(search_str)) > 1) { - ZVAL_DELREF(*MBSTRG(search_str)); - } else { - zval_dtor(*MBSTRG(search_str)); - FREE_ZVAL(*MBSTRG(search_str)); - } - MBSTRG(search_str) = (zval **)0; - MBSTRG(search_str_val) = (zval *)0; + + if (MBSTRG(search_str) != NULL) { + zval_ptr_dtor(&MBSTRG(search_str)); + MBSTRG(search_str) = (zval *)NULL; } MBSTRG(search_pos) = 0; - if (MBSTRG(search_re)) { - efree(MBSTRG(search_re)); - MBSTRG(search_re) = (mb_regex_t *)0; - } - if (MBSTRG(search_regs)) { - mbre_free_registers(MBSTRG(search_regs)); - efree(MBSTRG(search_regs)); - MBSTRG(search_regs) = (struct mbre_registers*)0; + + if (MBSTRG(search_regs) != NULL) { + php_mb_regex_region_free(MBSTRG(search_regs), 1); + MBSTRG(search_regs) = (php_mb_reg_region *)NULL; } zend_hash_clean(&MBSTRG(ht_rc)); @@ -176,95 +120,92 @@ PHP_RSHUTDOWN_FUNCTION(mb_regex) /* * encoding name resolver */ -static int _php_mb_regex_name2mbctype(const char *pname) +/* {{{ php_mb_regex_name2mbctype */ +php_mb_reg_char_encoding php_mb_regex_name2mbctype(const char *pname) { - int mbctype; + php_mb_reg_char_encoding mbctype; - mbctype = -1; + mbctype = REGCODE_UNDEF; if (pname != NULL) { if (strcasecmp("EUC-JP", pname) == 0 || strcasecmp("X-EUC-JP", pname) == 0 || strcasecmp("UJIS", pname) == 0 || strcasecmp("EUCJP", pname) == 0 || strcasecmp("EUC_JP", pname) == 0) { - mbctype = MBCTYPE_EUC; + mbctype = REGCODE_EUCJP; } else if (strcasecmp("UTF-8", pname) == 0 || strcasecmp("UTF8", pname) == 0) { - mbctype = MBCTYPE_UTF8; + mbctype = REGCODE_UTF8; } else if (strcasecmp("SJIS", pname) == 0 || strcasecmp("CP932", pname) == 0 || strcasecmp("MS932", pname) == 0 || strcasecmp("SHIFT_JIS", pname) == 0 ) { - mbctype = MBCTYPE_SJIS; + mbctype = REGCODE_SJIS; } else if (strcasecmp("ASCII", pname) == 0) { - mbctype = MBCTYPE_ASCII; - mbctype = MBCTYPE_EUC; + mbctype = REGCODE_ASCII; } } return mbctype; } +/* }}} */ -static const char* -php_mbregex_mbctype2name(int mbctype) +/* {{{ php_mbregex_mbctype2name */ +const char *php_mb_regex_mbctype2name(php_mb_reg_char_encoding mbctype) { const char *p = NULL; - if (mbctype == MBCTYPE_EUC) { + if (mbctype == REGCODE_EUCJP) { p = "EUC-JP"; - } else if(mbctype == MBCTYPE_UTF8) { + } else if(mbctype == REGCODE_UTF8) { p = "UTF-8"; - } else if(mbctype == MBCTYPE_SJIS) { + } else if(mbctype == REGCODE_SJIS) { p = "SJIS"; - } else if(mbctype == MBCTYPE_ASCII) { + } else if(mbctype == REGCODE_ASCII) { p = "ascii"; } - return p; } - +/* }}} */ /* * regex cache */ -static int -php_mbregex_compile_pattern(mb_regex_t *pre, const char *pattern, int patlen, int options, int mbctype TSRMLS_DC) +/* {{{ php_mbregex_compile_pattern */ +static php_mb_regex_t *php_mbregex_compile_pattern(const char *pattern, int patlen, php_mb_reg_option_type options, php_mb_reg_char_encoding enc, php_mb_reg_syntax_type *syntax TSRMLS_DC) { - int res = 0; - const char *err_str = NULL; - mb_regex_t *rc = NULL; - - if(zend_hash_find(&MBSTRG(ht_rc), (char *)pattern, patlen+1, (void **) &rc) == FAILURE || - rc->options != options || rc->mbctype != mbctype) { - memset(pre, 0, sizeof(*pre)); - pre->fastmap = (char*)safe_emalloc((1 << MBRE_BYTEWIDTH), sizeof(char), 0); - pre->options = options; - pre->mbctype = mbctype; - err_str = mbre_compile_pattern(pattern, patlen, pre); - if (!err_str) { - zend_hash_update(&MBSTRG(ht_rc), (char *) pattern, patlen+1, (void *) pre, sizeof(*pre), NULL); - } else { - efree(pre->fastmap); - pre->fastmap = (char*)0; + int err_code = 0; + int found = 0; + php_mb_regex_t *retval = NULL, **rc = NULL; + php_mb_reg_error_info err_info; + UChar err_str[REG_MAX_ERROR_MESSAGE_LEN]; + + found = zend_hash_find(&MBSTRG(ht_rc), (char *)pattern, patlen+1, (void **) &rc); + if (found == FAILURE || (*rc)->options != options || (*rc)->enc != enc || (*rc)->syntax != syntax) { + if ((err_code = php_mb_regex_new(&retval, (UChar *)pattern, (UChar *)(pattern + patlen), options, enc, syntax, &err_info)) != REG_NORMAL) { + php_mb_regex_error_code_to_str(err_str, err_code, err_info); php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex compile err: %s", err_str); - res = 1; + retval = NULL; + goto out; } - } else { - memcpy(pre, rc, sizeof(*pre)); + zend_hash_update(&MBSTRG(ht_rc), (char *) pattern, patlen + 1, (void *) &retval, sizeof(retval), NULL); + } else if (found == SUCCESS) { + retval = *rc; } - - return res; +out: + return retval; } +/* }}} */ -static size_t -_php_mb_regex_get_option_string(char *str, size_t len, int option) +/* {{{ _php_mb_regex_get_option_string */ +static size_t _php_mb_regex_get_option_string(char *str, size_t len, php_mb_reg_option_type option, php_mb_reg_syntax_type *syntax) { size_t len_left = len; size_t len_req = 0; char *p = str; + char c; - - if ((option & MBRE_OPTION_IGNORECASE) != 0) { + if ((option & RE_OPTION_IGNORECASE) != 0) { if (len_left > 0) { --len_left; *(p++) = 'i'; @@ -272,7 +213,7 @@ _php_mb_regex_get_option_string(char *str, size_t len, int option) ++len_req; } - if ((option & MBRE_OPTION_EXTENDED) != 0) { + if ((option & RE_OPTION_EXTENDED) != 0) { if (len_left > 0) { --len_left; *(p++) = 'x'; @@ -280,14 +221,14 @@ _php_mb_regex_get_option_string(char *str, size_t len, int option) ++len_req; } - if ((option & MBRE_OPTION_POSIXLINE) == MBRE_OPTION_POSIXLINE) { + if ((option & RE_OPTION_POSIXLINE) == RE_OPTION_POSIXLINE) { if (len_left > 0) { --len_left; *(p++) = 'p'; } ++len_req; } else { - if ((option & MBRE_OPTION_MULTILINE) != 0) { + if ((option & RE_OPTION_MULTILINE) != 0) { if (len_left > 0) { --len_left; *(p++) = 'm'; @@ -295,7 +236,7 @@ _php_mb_regex_get_option_string(char *str, size_t len, int option) ++len_req; } - if ((option & MBRE_OPTION_SINGLELINE) != 0) { + if ((option & RE_OPTION_SINGLELINE) != 0) { if (len_left > 0) { --len_left; *(p++) = 's'; @@ -303,18 +244,54 @@ _php_mb_regex_get_option_string(char *str, size_t len, int option) ++len_req; } } - if ((option & MBRE_OPTION_LONGEST) != 0) { + if ((option & RE_OPTION_LONGEST) != 0) { if (len_left > 0) { --len_left; *(p++) = 'l'; } ++len_req; } + if ((option & REG_OPTION_FIND_NOT_EMPTY) != 0) { + if (len_left > 0) { + --len_left; + *(p++) = 'n'; + } + ++len_req; + } + + c = 0; + + if (syntax == REG_SYNTAX_JAVA) { + c = 'j'; + } else if (syntax == REG_SYNTAX_GNU_REGEX) { + c = 'u'; + } else if (syntax == REG_SYNTAX_GREP) { + c = 'g'; + } else if (syntax == REG_SYNTAX_EMACS) { + c = 'c'; + } else if (syntax == REG_SYNTAX_RUBY) { + c = 'r'; + } else if (syntax == REG_SYNTAX_PERL) { + c = 'z'; + } else if (syntax == REG_SYNTAX_POSIX_BASIC) { + c = 'b'; + } else if (syntax == REG_SYNTAX_POSIX_EXTENDED) { + c = 'd'; + } + + if (c != 0) { + if (len_left > 0) { + --len_left; + *(p++) = c; + } + ++len_req; + } + + if (len_left > 0) { --len_left; *(p++) = '\0'; } - ++len_req; if (len < len_req) { return len_req; @@ -322,36 +299,67 @@ _php_mb_regex_get_option_string(char *str, size_t len, int option) return 0; } +/* }}} */ +/* {{{ _php_mb_regex_init_options */ static void -_php_mb_regex_init_options(const char *parg, int narg, int *option, int *eval) +_php_mb_regex_init_options(const char *parg, int narg, php_mb_reg_option_type *option, php_mb_reg_syntax_type **syntax, int *eval) { int n; char c; int optm = 0; + *syntax = REG_SYNTAX_RUBY; + if (parg != NULL) { n = 0; while(n < narg) { c = parg[n++]; switch (c) { case 'i': - optm |= MBRE_OPTION_IGNORECASE; + optm |= RE_OPTION_IGNORECASE; break; case 'x': - optm |= MBRE_OPTION_EXTENDED; + optm |= RE_OPTION_EXTENDED; break; case 'm': - optm |= MBRE_OPTION_MULTILINE; + optm |= RE_OPTION_MULTILINE; break; case 's': - optm |= MBRE_OPTION_SINGLELINE; + optm |= RE_OPTION_SINGLELINE; break; case 'p': - optm |= MBRE_OPTION_POSIXLINE; + optm |= RE_OPTION_POSIXLINE; break; case 'l': - optm |= MBRE_OPTION_LONGEST; + optm |= RE_OPTION_LONGEST; + break; + case 'n': + optm |= REG_OPTION_FIND_NOT_EMPTY; + break; + case 'j': + *syntax = REG_SYNTAX_JAVA; + break; + case 'u': + *syntax = REG_SYNTAX_GNU_REGEX; + break; + case 'g': + *syntax = REG_SYNTAX_GREP; + break; + case 'c': + *syntax = REG_SYNTAX_EMACS; + break; + case 'r': + *syntax = REG_SYNTAX_RUBY; + break; + case 'z': + *syntax = REG_SYNTAX_PERL; + break; + case 'b': + *syntax = REG_SYNTAX_POSIX_BASIC; + break; + case 'd': + *syntax = REG_SYNTAX_POSIX_EXTENDED; break; case 'e': if (eval != NULL) *eval = 1; @@ -363,7 +371,7 @@ _php_mb_regex_init_options(const char *parg, int narg, int *option, int *eval) if (option != NULL) *option|=optm; } } - +/* }}} */ /* * php funcions @@ -374,10 +382,10 @@ _php_mb_regex_init_options(const char *parg, int narg, int *option, int *eval) PHP_FUNCTION(mb_regex_encoding) { zval **arg1; - int mbctype; + php_mb_reg_char_encoding mbctype; if (ZEND_NUM_ARGS() == 0) { - const char *retval = php_mbregex_mbctype2name(MBSTRG(current_mbctype)); + const char *retval = php_mb_regex_mbctype2name(MBSTRG(current_mbctype)); if ( retval != NULL ) { RETVAL_STRING((char *)retval, 1); } else { @@ -386,7 +394,7 @@ PHP_FUNCTION(mb_regex_encoding) } else if (ZEND_NUM_ARGS() == 1 && zend_get_parameters_ex(1, &arg1) != FAILURE) { convert_to_string_ex(arg1); - mbctype = _php_mb_regex_name2mbctype(Z_STRVAL_PP(arg1)); + mbctype = php_mb_regex_name2mbctype(Z_STRVAL_PP(arg1)); if (mbctype < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", Z_STRVAL_PP(arg1)); RETVAL_FALSE; @@ -400,18 +408,16 @@ PHP_FUNCTION(mb_regex_encoding) } /* }}} */ - /* {{{ _php_mb_regex_ereg_exec */ -static void -_php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) +static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) { zval tmp; zval *arg_pattern, *array; char *string; int string_len; - mb_regex_t re; - struct mbre_registers regs = {0, 0, 0, 0}; - int i, err, match_len, option, beg, end; + php_mb_regex_t *re; + php_mb_reg_region *regs = NULL; + int i, match_len, option, beg, end; char *str; array = NULL; @@ -422,7 +428,7 @@ _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) option = MBSTRG(regex_default_options); if (icase) { - option |= MBRE_OPTION_IGNORECASE; + option |= RE_OPTION_IGNORECASE; } /* compile the regular expression from the supplied regex */ @@ -437,56 +443,51 @@ _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) arg_pattern = &tmp; /* don't bother doing an extended regex with just a number */ } - err = php_mbregex_compile_pattern( - &re, - Z_STRVAL_P(arg_pattern), - Z_STRLEN_P(arg_pattern), - option, MBSTRG(current_mbctype) TSRMLS_CC); - if (err) { + re = php_mbregex_compile_pattern(Z_STRVAL_P(arg_pattern), Z_STRLEN_P(arg_pattern), option, MBSTRG(current_mbctype), MBSTRG(regex_default_syntax) TSRMLS_CC); + if (re == NULL) { RETVAL_FALSE; goto out; } + regs = php_mb_regex_region_new(); + /* actually execute the regular expression */ - err = mbre_search( - &re, - string, - string_len, - 0, string_len, - ®s); - if (err < 0) { - mbre_free_registers(®s); + if (php_mb_regex_search(re, (UChar *)string, (UChar *)(string + string_len), string, (UChar *)(string + string_len), regs, 0) < 0) { RETVAL_FALSE; goto out; } match_len = 1; str = string; - if (array) { - match_len = regs.end[0] - regs.beg[0]; - zval_dtor(array); /* start with clean array */ - array_init(array); - for (i = 0; i < regs.num_regs; i++) { - beg = regs.beg[i]; - end = regs.end[i]; + if (array != NULL) { + zval ret_array; + match_len = regs->end[0] - regs->beg[0]; + array_init(&ret_array); + for (i = 0; i < regs->num_regs; i++) { + beg = regs->beg[i]; + end = regs->end[i]; if (beg >= 0 && beg < end && end <= string_len) { - add_index_stringl(array, i, (char *)&str[beg], end - beg, 1); + add_index_stringl(&ret_array, i, (char *)&str[beg], end - beg, 1); } else { - add_index_bool(array, i, 0); + add_index_bool(&ret_array, i, 0); } } + REPLACE_ZVAL_VALUE(&array, &ret_array, 0); } - mbre_free_registers(®s); if (match_len == 0) { match_len = 1; } RETVAL_LONG(match_len); out: + if (regs != NULL) { + php_mb_regex_region_free(regs, 1); + } if (arg_pattern == &tmp) { zval_dtor(&tmp); } } +/* }}} */ /* {{{ proto int mb_ereg(string pattern, string string [, array registers]) Regular expression match for multibyte string */ @@ -504,11 +505,8 @@ PHP_FUNCTION(mb_eregi) } /* }}} */ - - /* {{{ _php_mb_regex_ereg_replace_exec */ -static void -_php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option) +static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option) { zval *arg_pattern_zval; @@ -522,10 +520,14 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option) int string_len; char *p; - mb_regex_t re; - struct mbre_registers regs = {0, 0, 0, 0}; - struct strbuf outdev, evaldev, *pdevice; - int i, n, err, pos, eval; + php_mb_regex_t *re; + php_mb_reg_syntax_type *syntax; + php_mb_reg_region *regs = NULL; + smart_str out_buf = { 0 }; + smart_str eval_buf = { 0 }; + smart_str *pbuf; + int i, err, eval, n; + UChar *pos; char *description = NULL; char pat_buf[2]; @@ -533,10 +535,10 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option) { const char *current_enc_name; - current_enc_name = php_mbregex_mbctype2name(MBSTRG(current_mbctype)); + current_enc_name = php_mb_regex_mbctype2name(MBSTRG(current_mbctype)); if (current_enc_name == NULL || (enc = mbfl_name2encoding(current_enc_name)) == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error"); RETURN_FALSE; } } @@ -554,9 +556,10 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option) } if (option_str != NULL) { - _php_mb_regex_init_options(option_str, option_str_len, &option, &eval); + _php_mb_regex_init_options(option_str, option_str_len, &option, &syntax, &eval); } else { option |= MBSTRG(regex_default_options); + syntax = MBSTRG(regex_default_syntax); } } if (Z_TYPE_P(arg_pattern_zval) == IS_STRING) { @@ -572,46 +575,40 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option) arg_pattern_len = 1; } /* create regex pattern buffer */ - err = php_mbregex_compile_pattern( - &re, - arg_pattern, - arg_pattern_len, - option, MBSTRG(current_mbctype) TSRMLS_CC); - if (err) { + re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, option, MBSTRG(current_mbctype), syntax TSRMLS_CC); + if (re == NULL) { RETURN_FALSE; } - /* initialize string buffer (auto reallocate buffer) */ - _php_mb_regex_strbuf_init(&outdev); - _php_mb_regex_strbuf_init(&evaldev); - outdev.allocsz = (string_len >> 2) + 8; - if (eval) { - pdevice = &evaldev; + pbuf = &eval_buf; description = zend_make_compiled_string_description("mbregex replace" TSRMLS_CC); } else { - pdevice = &outdev; + pbuf = &out_buf; description = NULL; } /* do the actual work */ err = 0; - pos = 0; + pos = string; + regs = php_mb_regex_region_new(); while (err >= 0) { - err = mbre_search(&re, string, string_len, pos, string_len - pos, ®s); + err = php_mb_regex_search(re, (UChar *)string, (UChar *)(string + string_len), pos, (UChar *)(string + string_len), regs, 0); if (err <= -2) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex search failure in php_mbereg_replace_exec()"); + UChar err_str[REG_MAX_ERROR_MESSAGE_LEN]; + php_mb_regex_error_code_to_str(err_str, err); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex search failure in php_mbereg_replace_exec(): %s", err_str); break; } if (err >= 0) { #if moriyoshi_0 - if ( regs.beg[0] == regs.end[0] ) { + if (regs->beg[0] == regs->end[0]) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression"); break; } #endif /* copy the part of the string before the match */ - _php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], regs.beg[0] - pos); + smart_str_appendl(&out_buf, pos, (size_t)((UChar *)(string + regs->beg[0]) - pos)); /* copy replacement and backrefs */ i = 0; p = replace; @@ -622,14 +619,14 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option) p[0] == '\\' && p[1] >= '0' && p[1] <= '9') { n = p[1] - '0'; } - if (n >= 0 && n < regs.num_regs) { - if (regs.beg[n] >= 0 && regs.beg[n] < regs.end[n] && regs.end[n] <= string_len) { - _php_mb_regex_strbuf_ncat(pdevice, (const unsigned char *)&string[regs.beg[n]], regs.end[n] - regs.beg[n]); + if (n >= 0 && n < regs->num_regs) { + if (regs->beg[n] >= 0 && regs->beg[n] < regs->end[n] && regs->end[n] <= string_len) { + smart_str_appendl(pbuf, string + regs->beg[n], regs->end[n] - regs->beg[n]); } p += 2; i += 2; } else { - _php_mb_regex_strbuf_ncat(pdevice, (const unsigned char *)p, fwd); + smart_str_appendl(pbuf, p, fwd); p += fwd; i += fwd; } @@ -637,48 +634,48 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option) if (eval) { zval v; /* null terminate buffer */ - _php_mb_regex_strbuf_ncat(&evaldev, (const unsigned char *)"\0", 1); + smart_str_appendc(&eval_buf, '\0'); /* do eval */ - zend_eval_string((char *)evaldev.buffer, &v, description TSRMLS_CC); + zend_eval_string(eval_buf.c, &v, description TSRMLS_CC); /* result of eval */ convert_to_string(&v); - _php_mb_regex_strbuf_ncat(&outdev, Z_STRVAL(v), Z_STRLEN(v)); + smart_str_appendl(&out_buf, Z_STRVAL(v), Z_STRLEN(v)); /* Clean up */ - evaldev.pos = 0; + eval_buf.len = 0; zval_dtor(&v); } - n = regs.end[0]; - if (pos < n) { - pos = n; + n = regs->end[0]; + if ((size_t)(pos - (UChar *)string) < n) { + pos = string + n; } else { - _php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], 1 ); + smart_str_appendl(&out_buf, pos, 1); pos++; } } else { /* nomatch */ /* stick that last bit of string on our output */ - _php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], string_len - pos); + smart_str_appendl(&out_buf, pos, (size_t)((UChar *)(string + string_len) - pos)); } + php_mb_regex_region_free(regs, 0); } if (description) { efree(description); } - mbre_free_registers(®s); - if (evaldev.buffer) { - efree((void*)evaldev.buffer); + if (regs != NULL) { + php_mb_regex_region_free(regs, 1); } - n = outdev.pos; - _php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)"\0", 1); + smart_str_free(&eval_buf); + if (err <= -2) { - if (outdev.buffer) { - efree((void*)outdev.buffer); - } + smart_str_free(&out_buf); RETVAL_FALSE; } else { - RETVAL_STRINGL((char *)outdev.buffer, n, 0); + smart_str_appendc(&out_buf, '\0'); + RETVAL_STRINGL((char *)out_buf.c, out_buf.len - 1, 0); } } /* }}} */ + /* {{{ proto string mb_ereg_replace(string pattern, string replacement, string string [, string option]) Replace regular expression for multibyte string */ PHP_FUNCTION(mb_ereg_replace) @@ -691,23 +688,23 @@ PHP_FUNCTION(mb_ereg_replace) Case insensitive replace regular expression for multibyte string */ PHP_FUNCTION(mb_eregi_replace) { - _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, MBRE_OPTION_IGNORECASE); + _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, RE_OPTION_IGNORECASE); } /* }}} */ - /* {{{ proto array mb_split(string pattern, string string [, int limit]) split multibyte string into array by regular expression */ PHP_FUNCTION(mb_split) { char *arg_pattern; int arg_pattern_len; - mb_regex_t re; - struct mbre_registers regs = {0, 0, 0, 0}; + php_mb_regex_t *re; + php_mb_reg_region *regs = NULL; char *string; + UChar *pos; int string_len; - int n, err, pos; + int n, err; long count = -1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &arg_pattern, &arg_pattern_len, &string, &string_len, &count) == FAILURE) { @@ -719,65 +716,62 @@ PHP_FUNCTION(mb_split) } /* create regex pattern buffer */ - err = php_mbregex_compile_pattern( - &re, - arg_pattern, - arg_pattern_len, - MBSTRG(regex_default_options), MBSTRG(current_mbctype) TSRMLS_CC); - if (err) { + if ((re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, MBSTRG(regex_default_options), MBSTRG(current_mbctype), MBSTRG(regex_default_syntax) TSRMLS_CC)) == NULL) { RETURN_FALSE; } array_init(return_value); - pos = 0; + pos = (UChar *)string; err = 0; + regs = php_mb_regex_region_new(); /* churn through str, generating array entries as we go */ while ((--count != 0) && - (err = mbre_search(&re, string, string_len, pos, string_len - pos, ®s)) >= 0) { - if ( regs.beg[0] == regs.end[0] ) { + (err = php_mb_regex_search(re, (UChar *)string, (UChar *)(string + string_len), pos, (UChar *)(string + string_len), regs, 0)) >= 0) { + if (regs->beg[0] == regs->end[0]) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression"); break; } - /* add it to the array */ - if ( regs.beg[0] < string_len && regs.beg[0] >= pos) { - add_next_index_stringl(return_value, (char *)&string[pos], regs.beg[0]-pos, 1); + if (regs->beg[0] < string_len && regs->beg[0] >= (size_t)(pos - (UChar *)string)) { + add_next_index_stringl(return_value, pos, ((UChar *)(string + regs->beg[0]) - pos), 1); } else { err = -2; break; } /* point at our new starting point */ - n = regs.end[0]; - if (pos < n) { - pos = n; + n = regs->end[0]; + if ((pos - (UChar *)string) < n) { + pos = (UChar *)string + n; } if (count < 0) { count = 0; } + php_mb_regex_region_free(regs, 0); } - mbre_free_registers(®s); + php_mb_regex_region_free(regs, 1); /* see if we encountered an error */ if (err <= -2) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex search failure in mbsplit()"); + UChar err_str[REG_MAX_ERROR_MESSAGE_LEN]; + php_mb_regex_error_code_to_str(err_str, err); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex search failure in mbsplit(): %s", err_str); zval_dtor(return_value); RETURN_FALSE; } /* otherwise we just have one last element to add to the array */ - n = string_len - pos; + n = ((UChar *)(string + string_len) - pos); if (n > 0) { - add_next_index_stringl(return_value, (char *)&string[pos], n, 1); + add_next_index_stringl(return_value, pos, n, 1); } else { - add_next_index_stringl(return_value, (char *)empty_string, 0, 1); + add_next_index_stringl(return_value, empty_string, 0, 1); } } /* }}} */ - /* {{{ proto bool mb_ereg_match(string pattern, string string [,string option]) Regular expression match for multibyte string */ PHP_FUNCTION(mb_ereg_match) @@ -788,10 +782,10 @@ PHP_FUNCTION(mb_ereg_match) char *string; int string_len; - mb_regex_t re; - int option, err; + php_mb_regex_t *re; + php_mb_reg_syntax_type *syntax; + int option = 0, err; - option = 0; { char *option_str = NULL; int option_str_len = 0; @@ -803,24 +797,19 @@ PHP_FUNCTION(mb_ereg_match) } if (option_str != NULL) { - _php_mb_regex_init_options(option_str, option_str_len, &option, NULL); + _php_mb_regex_init_options(option_str, option_str_len, &option, &syntax, NULL); } else { option |= MBSTRG(regex_default_options); + syntax = MBSTRG(regex_default_syntax); } } - err = php_mbregex_compile_pattern( - &re, - arg_pattern, - arg_pattern_len, - option, MBSTRG(current_mbctype) TSRMLS_CC); - - if (err) { + if ((re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, option, MBSTRG(current_mbctype), syntax TSRMLS_CC)) == NULL) { RETURN_FALSE; } /* match */ - err = mbre_match(&re, string, string_len, 0, NULL); + err = php_mb_regex_match(re, (UChar *)string, (UChar *)(string + string_len), (UChar *)string, NULL, 0); if (err >= 0) { RETVAL_TRUE; } else { @@ -829,14 +818,15 @@ PHP_FUNCTION(mb_ereg_match) } /* }}} */ - /* regex search */ +/* {{{ _php_mb_regex_ereg_search_exec */ static void _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) { zval **arg_pattern, **arg_options; int n, i, err, pos, len, beg, end, option; - unsigned char *str; + UChar *str; + php_mb_reg_syntax_type *syntax; option = MBSTRG(regex_default_options); switch (ZEND_NUM_ARGS()) { @@ -853,7 +843,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) } convert_to_string_ex(arg_options); option = 0; - _php_mb_regex_init_options(Z_STRVAL_PP(arg_options), Z_STRLEN_PP(arg_options), &option, NULL); + _php_mb_regex_init_options(Z_STRVAL_PP(arg_options), Z_STRLEN_PP(arg_options), &option, &syntax, NULL); break; default: WRONG_PARAM_COUNT; @@ -862,17 +852,8 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) if (ZEND_NUM_ARGS() > 0) { /* create regex pattern buffer */ convert_to_string_ex(arg_pattern); - if (!MBSTRG(search_re)) { - MBSTRG(search_re) = (mb_regex_t*)ecalloc(1, sizeof(mb_regex_t)); - } - err = php_mbregex_compile_pattern( - MBSTRG(search_re), - Z_STRVAL_PP(arg_pattern), - Z_STRLEN_PP(arg_pattern), - option, MBSTRG(current_mbctype) TSRMLS_CC); - if (err) { - efree(MBSTRG(search_re)); - MBSTRG(search_re) = (mb_regex_t*)0; + + if ((MBSTRG(search_re) = php_mbregex_compile_pattern(Z_STRVAL_PP(arg_pattern), Z_STRLEN_PP(arg_pattern), option, MBSTRG(current_mbctype), MBSTRG(regex_default_syntax) TSRMLS_CC)) == NULL) { RETURN_FALSE; } } @@ -880,33 +861,35 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) pos = MBSTRG(search_pos); str = NULL; len = 0; - if (MBSTRG(search_str) != NULL && Z_TYPE_PP(MBSTRG(search_str)) == IS_STRING){ - str = (unsigned char *)Z_STRVAL_PP(MBSTRG(search_str)); - len = Z_STRLEN_PP(MBSTRG(search_str)); + if (MBSTRG(search_str) != NULL && Z_TYPE_P(MBSTRG(search_str)) == IS_STRING){ + str = (UChar *)Z_STRVAL_P(MBSTRG(search_str)); + len = Z_STRLEN_P(MBSTRG(search_str)); } - if (!MBSTRG(search_re)) { + if (MBSTRG(search_re) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "No regex given"); RETURN_FALSE; } - if (!str) { + + if (str == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "No string given"); RETURN_FALSE; } + if (MBSTRG(search_regs)) { - mbre_free_registers(MBSTRG(search_regs)); - memset(MBSTRG(search_regs), 0, sizeof(struct mbre_registers)); - } else { - MBSTRG(search_regs) = (struct mbre_registers*)ecalloc(1, sizeof(struct mbre_registers)); + php_mb_regex_region_free(MBSTRG(search_regs), 1); } + MBSTRG(search_regs) = php_mb_regex_region_new(); - err = mbre_search(MBSTRG(search_re), (const char *)str, len, pos, len - pos, MBSTRG(search_regs)); - if (err <= -2) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex search failure in mbregex_search()"); - RETVAL_FALSE; - } else if (err < 0) { + err = php_mb_regex_search(MBSTRG(search_re), str, str + len, str + pos, str + len, MBSTRG(search_regs), 0); + if (err == REG_MISMATCH) { MBSTRG(search_pos) = len; RETVAL_FALSE; + } else if (err <= -2) { + UChar err_str[REG_MAX_ERROR_MESSAGE_LEN]; + php_mb_regex_error_code_to_str(err_str, err); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex search failure in mbregex_search(): %s", err_str); + RETVAL_FALSE; } else { if (MBSTRG(search_regs)->beg[0] == MBSTRG(search_regs)->end[0]) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression"); @@ -945,14 +928,12 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) } if (err < 0) { - mbre_free_registers(MBSTRG(search_regs)); - efree(MBSTRG(search_regs)); - MBSTRG(search_regs) = (struct mbre_registers*)0; + php_mb_regex_region_free(MBSTRG(search_regs), 1); + MBSTRG(search_regs) = (php_mb_reg_region *)NULL; } } /* }}} */ - /* {{{ proto bool mb_ereg_search([string pattern[, string option]]) Regular expression search for multibyte string */ PHP_FUNCTION(mb_ereg_search) @@ -961,7 +942,6 @@ PHP_FUNCTION(mb_ereg_search) } /* }}} */ - /* {{{ proto array mb_ereg_search_pos([string pattern[, string option]]) Regular expression search for multibyte string */ PHP_FUNCTION(mb_ereg_search_pos) @@ -970,7 +950,6 @@ PHP_FUNCTION(mb_ereg_search_pos) } /* }}} */ - /* {{{ proto array mb_ereg_search_regs([string pattern[, string option]]) Regular expression search for multibyte string */ PHP_FUNCTION(mb_ereg_search_regs) @@ -979,15 +958,16 @@ PHP_FUNCTION(mb_ereg_search_regs) } /* }}} */ - /* {{{ proto bool mb_ereg_search_init(string string [, string pattern[, string option]]) Initialize string and regular expression for search. */ PHP_FUNCTION(mb_ereg_search_init) { zval **arg_str, **arg_pattern, **arg_options; - int err, option; + php_mb_reg_syntax_type *syntax = NULL; + int option; option = MBSTRG(regex_default_options); + syntax = MBSTRG(regex_default_syntax); switch (ZEND_NUM_ARGS()) { case 1: if (zend_get_parameters_ex(1, &arg_str) == FAILURE) { @@ -1005,7 +985,7 @@ PHP_FUNCTION(mb_ereg_search_init) } convert_to_string_ex(arg_options); option = 0; - _php_mb_regex_init_options(Z_STRVAL_PP(arg_options), Z_STRLEN_PP(arg_options), &option, NULL); + _php_mb_regex_init_options(Z_STRVAL_PP(arg_options), Z_STRLEN_PP(arg_options), &option, &syntax, NULL); break; default: WRONG_PARAM_COUNT; @@ -1014,70 +994,44 @@ PHP_FUNCTION(mb_ereg_search_init) if (ZEND_NUM_ARGS() > 1) { /* create regex pattern buffer */ convert_to_string_ex(arg_pattern); - if (!MBSTRG(search_re)) { - MBSTRG(search_re) = (mb_regex_t*)ecalloc(1, sizeof(mb_regex_t)); - } - err = php_mbregex_compile_pattern( - MBSTRG(search_re), - Z_STRVAL_PP(arg_pattern), - Z_STRLEN_PP(arg_pattern), - option, MBSTRG(current_mbctype) TSRMLS_CC); - if (err) { - efree(MBSTRG(search_re)); - MBSTRG(search_re) = (mb_regex_t*)0; + + if ((MBSTRG(search_re) = php_mbregex_compile_pattern(Z_STRVAL_PP(arg_pattern), Z_STRLEN_PP(arg_pattern), option, MBSTRG(current_mbctype), syntax TSRMLS_CC)) == NULL) { RETURN_FALSE; } } - if (MBSTRG(search_str)) { - if (ZVAL_REFCOUNT(*MBSTRG(search_str)) > 1) { - ZVAL_DELREF(*MBSTRG(search_str)); - } else { - zval_dtor(*MBSTRG(search_str)); - FREE_ZVAL(*MBSTRG(search_str)); - } - MBSTRG(search_str) = (zval **)0; - MBSTRG(search_str_val) = (zval *)0; + if (MBSTRG(search_str) != NULL) { + zval_ptr_dtor(&MBSTRG(search_str)); + MBSTRG(search_str) = (zval *)NULL; } - if (PZVAL_IS_REF(*arg_str)) { - ZVAL_ADDREF(*arg_str); - MBSTRG(search_str_val) = *arg_str; - MBSTRG(search_str) = &MBSTRG(search_str_val); - } else { - MAKE_STD_ZVAL(MBSTRG(search_str_val)); - *MBSTRG(search_str_val) = **arg_str; - zval_copy_ctor(MBSTRG(search_str_val)); - MBSTRG(search_str_val)->refcount = 1; - MBSTRG(search_str_val)->is_ref = 0; - MBSTRG(search_str) = &MBSTRG(search_str_val); - convert_to_string_ex(MBSTRG(search_str)); - } + MBSTRG(search_str) = *arg_str; + ZVAL_ADDREF(MBSTRG(search_str)); + SEPARATE_ZVAL_IF_NOT_REF(&MBSTRG(search_str)); MBSTRG(search_pos) = 0; - if (MBSTRG(search_regs)) { - mbre_free_registers(MBSTRG(search_regs)); - efree(MBSTRG(search_regs)); - MBSTRG(search_regs) = (struct mbre_registers*)0; + if (MBSTRG(search_regs) != NULL) { + php_mb_regex_region_free(MBSTRG(search_regs), 1); + MBSTRG(search_regs) = (php_mb_reg_region *) NULL; } RETURN_TRUE; } /* }}} */ - /* {{{ proto array mb_ereg_search_getregs(void) Get matched substring of the last time */ PHP_FUNCTION(mb_ereg_search_getregs) { int n, i, len, beg, end; - unsigned char *str; + UChar *str; - if (MBSTRG(search_regs) && Z_TYPE_PP(MBSTRG(search_str)) == IS_STRING && - Z_STRVAL_PP(MBSTRG(search_str)) && array_init(return_value) != FAILURE) { - str = (unsigned char *)Z_STRVAL_PP(MBSTRG(search_str)); - len = Z_STRLEN_PP(MBSTRG(search_str)); + if (MBSTRG(search_regs) != NULL && Z_TYPE_P(MBSTRG(search_str)) == IS_STRING && Z_STRVAL_P(MBSTRG(search_str)) != NULL) { + array_init(return_value); + + str = (UChar *)Z_STRVAL_P(MBSTRG(search_str)); + len = Z_STRLEN_P(MBSTRG(search_str)); n = MBSTRG(search_regs)->num_regs; for (i = 0; i < n; i++) { beg = MBSTRG(search_regs)->beg[i]; @@ -1094,7 +1048,6 @@ PHP_FUNCTION(mb_ereg_search_getregs) } /* }}} */ - /* {{{ proto int mb_ereg_search_getpos(void) Get search start position */ PHP_FUNCTION(mb_ereg_search_getpos) @@ -1103,7 +1056,6 @@ PHP_FUNCTION(mb_ereg_search_getpos) } /* }}} */ - /* {{{ proto bool mb_ereg_search_setpos(int position) Set search start position */ PHP_FUNCTION(mb_ereg_search_setpos) @@ -1116,10 +1068,7 @@ PHP_FUNCTION(mb_ereg_search_setpos) } convert_to_long_ex(arg_pos); n = Z_LVAL_PP(arg_pos); - if (n < 0 - || ( MBSTRG(search_str) != NULL && *MBSTRG(search_str) != NULL && - Z_TYPE_PP(MBSTRG(search_str)) == IS_STRING && - n >= Z_STRLEN_PP(MBSTRG(search_str)) ) ) { + if (n < 0 || (MBSTRG(search_str) != NULL && Z_TYPE_P(MBSTRG(search_str)) == IS_STRING && n >= Z_STRLEN_P(MBSTRG(search_str)))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Position is out of range"); MBSTRG(search_pos) = 0; RETVAL_FALSE; @@ -1131,20 +1080,16 @@ PHP_FUNCTION(mb_ereg_search_setpos) /* }}} */ /* {{{ php_mb_regex_set_options */ -int php_mb_regex_set_options( int options TSRMLS_DC) +void php_mb_regex_set_options(php_mb_reg_option_type options, php_mb_reg_syntax_type *syntax, php_mb_reg_option_type *prev_options, php_mb_reg_syntax_type **prev_syntax TSRMLS_DC) { - int prev_opt = MBSTRG(regex_default_options); + if (prev_options != NULL) { + *prev_options = MBSTRG(regex_default_options); + } + if (prev_syntax != NULL) { + *prev_syntax = MBSTRG(regex_default_syntax); + } MBSTRG(regex_default_options) = options; - return prev_opt; -} -/* }}} */ - -/* {{{ php_mb_regex_set_options_by_string */ -int php_mb_regex_set_options_by_string( const char *opt_str, int len TSRMLS_DC) -{ - int new_opt = 0; - _php_mb_regex_init_options( opt_str, len, &new_opt, NULL); - return php_mb_regex_set_options( new_opt TSRMLS_CC); + MBSTRG(regex_default_syntax) = syntax; } /* }}} */ @@ -1152,25 +1097,30 @@ int php_mb_regex_set_options_by_string( const char *opt_str, int len TSRMLS_DC) Set or get the default options for mbregex functions */ PHP_FUNCTION(mb_regex_set_options) { - int opt; + php_mb_reg_option_type opt; + php_mb_reg_syntax_type *syntax; char *string = NULL; int string_len; char buf[16]; - if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "|s", - &string, &string_len ) == FAILURE ) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", + &string, &string_len) == FAILURE) { RETURN_FALSE; } if (string != NULL) { - opt = php_mb_regex_set_options_by_string( (const char*)string, - string_len TSRMLS_CC ); + opt = 0; + syntax = NULL; + _php_mb_regex_init_options(string, string_len, &opt, &syntax, NULL); + php_mb_regex_set_options(opt, syntax, NULL, NULL TSRMLS_CC); } else { opt = MBSTRG(regex_default_options); + syntax = MBSTRG(regex_default_syntax); } - _php_mb_regex_get_option_string(buf, sizeof(buf), opt); + _php_mb_regex_get_option_string(buf, sizeof(buf), opt, syntax); RETVAL_STRING(buf, 1); } /* }}} */ #endif /* HAVE_MBREGEX */ + diff --git a/ext/mbstring/php_mbregex.h b/ext/mbstring/php_mbregex.h index 3726ee03c1..f51a431b4d 100644 --- a/ext/mbstring/php_mbregex.h +++ b/ext/mbstring/php_mbregex.h @@ -25,19 +25,20 @@ #include "php.h" #include "zend.h" -#include "mbregex.h" +#include "oniguruma/oniguruma.h" /* {{{ PHP_MBREGEX_GLOBALS */ #define PHP_MBREGEX_GLOBALS \ - int default_mbctype; \ - int current_mbctype; \ + php_mb_reg_char_encoding default_mbctype; \ + php_mb_reg_char_encoding current_mbctype; \ HashTable ht_rc; \ - zval **search_str; \ + zval *search_str; \ zval *search_str_val; \ unsigned int search_pos; \ - mb_regex_t *search_re; \ - struct mbre_registers *search_regs; \ - int regex_default_options; + php_mb_regex_t *search_re; \ + struct php_mb_re_registers *search_regs; \ + int regex_default_options; \ + php_mb_reg_syntax_type *regex_default_syntax; /* }}} */ /* {{{ PHP_MBREGEX_FUNCTION_ENTRIES */ @@ -77,16 +78,15 @@ typedef struct _zend_mbstring_globals * zend_mbstring_globals_ptr; #define PHP_MBREGEX_MAXCACHE 50 -int php_mb_regex_name2mbctype(const char *pname); -int php_mb_regex_set_options(int options TSRMLS_DC); -int php_mb_regex_set_options_by_string(const char *optstr, int len TSRMLS_DC); - PHP_MINIT_FUNCTION(mb_regex); PHP_MSHUTDOWN_FUNCTION(mb_regex); PHP_RINIT_FUNCTION(mb_regex); PHP_RSHUTDOWN_FUNCTION(mb_regex); void _php_mb_regex_globals_ctor(zend_mbstring_globals_ptr pglobals TSRMLS_DC); +void php_mb_regex_set_options(php_mb_reg_option_type options, php_mb_reg_syntax_type *syntax, php_mb_reg_option_type *prev_options, php_mb_reg_syntax_type **prev_syntax TSRMLS_DC); void _php_mb_regex_globals_dtor(zend_mbstring_globals_ptr pglobals TSRMLS_DC); +php_mb_reg_char_encoding php_mb_regex_name2mbctype(const char *pname); +const char *php_mb_regex_mbctype2name(php_mb_reg_char_encoding mbctype); PHP_FUNCTION(mb_regex_encoding); PHP_FUNCTION(mb_ereg); diff --git a/ext/mbstring/unicode_table.h b/ext/mbstring/unicode_table.h deleted file mode 100644 index 884e6e37ae..0000000000 --- a/ext/mbstring/unicode_table.h +++ /dev/null @@ -1,347 +0,0 @@ -/* charactor property table */ -#define MBFL_CHP_CTL 0x01 -#define MBFL_CHP_DIGIT 0x02 -#define MBFL_CHP_UALPHA 0x04 -#define MBFL_CHP_LALPHA 0x08 -#define MBFL_CHP_MMHQENC 0x10 /* must Q-encoding in MIME Header encoded-word */ -#define MBFL_CHP_MSPECIAL 0x20 /* RFC822 Special characters */ - -/* - * Unicode table - */ - - -/* Windows CodePage 1252 - it's the same as iso-8859-1 but - * defines extra symbols in the range 0x80-0x9f. - * This table differs from the rest of the unicode tables below - * as it only covers this range, while the rest cover 0xa0 onwards */ -static const unsigned short cp1252_ucs_table[] = { - 0x20ac,0xfffe,0x201a,0x0192,0x201e,0x2026,0x2020,0x2021, - 0x02c6,0x2030,0x0160,0x2039,0x0152,0xfffe,0x017d,0xfffe, - 0xfffe,0x2018,0x2019,0x201c,0x201d,0x2022,0x2013,0x2014, - 0x02dc,0x2122,0x0161,0x203a,0x0153,0xfffe,0x017e,0x0178 -}; - - -static const unsigned short iso8859_2_ucs_table[] = { - 0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7, - 0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B, - 0x00B0,0x0105,0x02DB,0x0142,0x00B4,0x013E,0x015B,0x02C7, - 0x00B8,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C, - 0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7, - 0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E, - 0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7, - 0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF, - 0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7, - 0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F, - 0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7, - 0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 -}; - - -static const unsigned short iso8859_3_ucs_table[] = { - 0x00A0,0x0126,0x02D8,0x00A3,0x00A4,0x0000,0x0124,0x00A7, - 0x00A8,0x0130,0x015E,0x011E,0x0134,0x00AD,0x0000,0x017B, - 0x00B0,0x0127,0x00B2,0x00B3,0x00B4,0x00B5,0x0125,0x00B7, - 0x00B8,0x0131,0x015F,0x011F,0x0135,0x00BD,0x0000,0x017C, - 0x00C0,0x00C1,0x00C2,0x0000,0x00C4,0x010A,0x0108,0x00C7, - 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, - 0x0000,0x00D1,0x00D2,0x00D3,0x00D4,0x0120,0x00D6,0x00D7, - 0x011C,0x00D9,0x00DA,0x00DB,0x00DC,0x016C,0x015C,0x00DF, - 0x00E0,0x00E1,0x00E2,0x0000,0x00E4,0x010B,0x0109,0x00E7, - 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, - 0x0000,0x00F1,0x00F2,0x00F3,0x00F4,0x0121,0x00F6,0x00F7, - 0x011D,0x00F9,0x00FA,0x00FB,0x00FC,0x016D,0x015D,0x02D9 -}; - - -static const unsigned short iso8859_4_ucs_table[] = { - 0x00A0,0x0104,0x0138,0x0156,0x00A4,0x0128,0x013B,0x00A7, - 0x00A8,0x0160,0x0112,0x0122,0x0166,0x00AD,0x017D,0x00AF, - 0x00B0,0x0105,0x02DB,0x0157,0x00B4,0x0129,0x013C,0x02C7, - 0x00B8,0x0161,0x0113,0x0123,0x0167,0x014A,0x017E,0x014B, - 0x0100,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x012E, - 0x010C,0x00C9,0x0118,0x00CB,0x0116,0x00CD,0x00CE,0x012A, - 0x0110,0x0145,0x014C,0x0136,0x00D4,0x00D5,0x00D6,0x00D7, - 0x00D8,0x0172,0x00DA,0x00DB,0x00DC,0x0168,0x016A,0x00DF, - 0x0101,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x012F, - 0x010D,0x00E9,0x0119,0x00EB,0x0117,0x00ED,0x00EE,0x012B, - 0x0111,0x0146,0x014D,0x0137,0x00F4,0x00F5,0x00F6,0x00F7, - 0x00F8,0x0173,0x00FA,0x00FB,0x00FC,0x0169,0x016B,0x02D9 -}; - - -static const unsigned short iso8859_5_ucs_table[] = { - 0x00A0,0x0401,0x0402,0x0403,0x0404,0x0405,0x0406,0x0407, - 0x0408,0x0409,0x040A,0x040B,0x040C,0x00AD,0x040E,0x040F, - 0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417, - 0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F, - 0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427, - 0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F, - 0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437, - 0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F, - 0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447, - 0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F, - 0x2116,0x0451,0x0452,0x0453,0x0454,0x0455,0x0456,0x0457, - 0x0458,0x0459,0x045A,0x045B,0x045C,0x00A7,0x045E,0x045F -}; - - -static const unsigned short iso8859_6_ucs_table[] = { - 0x00A0,0x0000,0x0000,0x0000,0x00A4,0x0000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x0000,0x060C,0x00AD,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x061B,0x0000,0x0000,0x0000,0x061F, - 0x0000,0x0621,0x0622,0x0623,0x0624,0x0625,0x0626,0x0627, - 0x0628,0x0629,0x062A,0x062B,0x062C,0x062D,0x062E,0x062F, - 0x0630,0x0631,0x0632,0x0633,0x0634,0x0635,0x0636,0x0637, - 0x0638,0x0639,0x063A,0x0000,0x0000,0x0000,0x0000,0x0000, - 0x0640,0x0641,0x0642,0x0643,0x0644,0x0645,0x0646,0x0647, - 0x0648,0x0649,0x064A,0x064B,0x064C,0x064D,0x064E,0x064F, - 0x0650,0x0651,0x0652,0x0000,0x0000,0x0000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x0000,0x060C,0x00AD,0x0000,0x0000 -}; - - -static const unsigned short iso8859_7_ucs_table[] = { - 0x00A0,0x2018,0x2019,0x00A3,0x0000,0x0000,0x00A6,0x00A7, - 0x00A8,0x00A9,0x0000,0x00AB,0x00AC,0x00AD,0x0000,0x2015, - 0x00B0,0x00B1,0x00B2,0x00B3,0x0384,0x0385,0x0386,0x00B7, - 0x0388,0x0389,0x038A,0x00BB,0x038C,0x00BD,0x038E,0x038F, - 0x0390,0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397, - 0x0398,0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F, - 0x03A0,0x03A1,0x0000,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7, - 0x03A8,0x03A9,0x03AA,0x03AB,0x03AC,0x03AD,0x03AE,0x03AF, - 0x03B0,0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7, - 0x03B8,0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF, - 0x03C0,0x03C1,0x03C2,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7, - 0x03C8,0x03C9,0x03CA,0x03CB,0x03CC,0x03CD,0x03CE,0x0000 -}; - - -static const unsigned short iso8859_8_ucs_table[] = { - 0x00A0,0x0000,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, - 0x00A8,0x00A9,0x00D7,0x00AB,0x00AC,0x00AD,0x00AE,0x203E, - 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, - 0x00B8,0x00B9,0x00F7,0x00BB,0x00BC,0x00BD,0x00BE,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,0x2017, - 0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7, - 0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF, - 0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7, - 0x05E8,0x05E9,0x05EA,0x0000,0x0000,0x0000,0x0000,0x0000 -}; - - -static const unsigned short iso8859_9_ucs_table[] = { - 0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, - 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, - 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, - 0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, - 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, - 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, - 0x011E,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, - 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x0130,0x015E,0x00DF, - 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, - 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, - 0x011F,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, - 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x0131,0x015F,0x00FF -}; - - -static const unsigned short iso8859_10_ucs_table[] = { - 0x00A0,0x0104,0x0112,0x0122,0x0124,0x0128,0x0136,0x00A7, - 0x013B,0x0110,0x0160,0x0166,0x017D,0x00AD,0x016A,0x014A, - 0x00B0,0x0105,0x0113,0x0123,0x012B,0x0129,0x0137,0x00B7, - 0x013C,0x0111,0x0161,0x0167,0x017E,0x2015,0x016B,0x014B, - 0x0100,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x012E, - 0x010C,0x00C9,0x0118,0x00CB,0x0116,0x00CD,0x00CE,0x00CF, - 0x00D0,0x0145,0x014C,0x00D3,0x00D4,0x00D5,0x00D6,0x0168, - 0x00D8,0x0172,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, - 0x0101,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x012F, - 0x010D,0x00E9,0x0119,0x00EB,0x0117,0x00ED,0x00EE,0x00EF, - 0x00F0,0x0146,0x014D,0x00F3,0x00F4,0x00F5,0x00F6,0x0169, - 0x00F8,0x0173,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x0138 -}; - - -static const unsigned short iso8859_13_ucs_table[] = { - 0x00A0,0x201D,0x00A2,0x00A3,0x00A4,0x201E,0x00A6,0x00A7, - 0x00D8,0x00A9,0x0156,0x00AB,0x00AC,0x00AD,0x00AE,0x00C6, - 0x00B0,0x00B1,0x00B2,0x00B3,0x201C,0x00B5,0x00B6,0x00B7, - 0x00F8,0x00B9,0x0157,0x00BB,0x00BC,0x00BD,0x00BE,0x00E6, - 0x0104,0x012E,0x0100,0x0106,0x00C4,0x00C5,0x0118,0x0112, - 0x010C,0x00C9,0x0179,0x0116,0x0122,0x0136,0x012A,0x013B, - 0x0160,0x0143,0x0145,0x00D3,0x014C,0x00D5,0x00D6,0x00D7, - 0x0172,0x0141,0x015A,0x016A,0x00DC,0x017B,0x017D,0x00DF, - 0x0105,0x012F,0x0101,0x0107,0x00E4,0x00E5,0x0119,0x0113, - 0x010D,0x00E9,0x017A,0x0117,0x0123,0x0137,0x012B,0x013C, - 0x0161,0x0144,0x0146,0x00F3,0x014D,0x00F5,0x00F6,0x00F7, - 0x0173,0x0142,0x015B,0x016B,0x00FC,0x017C,0x017E,0x2019 -}; - - -static const unsigned short iso8859_14_ucs_table[] = { - 0x00A0,0x1E02,0x1E03,0x00A3,0x010A,0x010B,0x1E0A,0x00A7, - 0x1E80,0x00A9,0x1E82,0x1E0B,0x1EF2,0x00AD,0x00AE,0x0178, - 0x1E1E,0x1E1F,0x0120,0x0121,0x1E40,0x1E41,0x00B6,0x1E56, - 0x1E81,0x1E57,0x1E83,0x1E60,0x1EF3,0x1E84,0x1E85,0x1E61, - 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, - 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, - 0x0174,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x1E6A, - 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x0176,0x00DF, - 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, - 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, - 0x0175,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x1E6B, - 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x0177,0x00FF -}; - - -static const unsigned short iso8859_15_ucs_table[] = { - 0x00A0,0x00A1,0x00A2,0x00A3,0x20AC,0x00A5,0x0160,0x00A7, - 0x0161,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, - 0x00B0,0x00B1,0x00B2,0x00B3,0x017D,0x00B5,0x00B6,0x00B7, - 0x017E,0x00B9,0x00BA,0x00BB,0x0152,0x0153,0x0178,0x00BF, - 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, - 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, - 0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, - 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, - 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, - 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, - 0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, - 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF -}; - - -static const unsigned char mbfl_charprop_table[] = { -/* NUL 0 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC, -/* SCH 1 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* SIX 2 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* EIX 3 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* EOT 4 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* ENQ 5 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* ACK 6 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* BEL 7 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* BS 8 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* HI 9 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* LF 10 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* VI 11 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* FF 12 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* CR 13 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* SO 14 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* SI 15 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* SLE 16 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* CSI 17 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* DC2 18 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* DC3 19 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* DC4 20 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* NAK 21 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* SYN 22 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* EIB 23 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* CAN 24 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* EM 25 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* SLB 26 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* ESC 27 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* FS 28 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* GS 29 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* RS 30 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* US 31 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC , -/* SP 32 */ MBFL_CHP_MMHQENC , -/* ! 33 */ 0 , -/* " 34 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , -/* # 35 */ MBFL_CHP_MMHQENC , -/* $ 36 */ MBFL_CHP_MMHQENC , -/* % 37 */ MBFL_CHP_MMHQENC , -/* & 38 */ MBFL_CHP_MMHQENC , -/* ' 39 */ MBFL_CHP_MMHQENC , -/* ( 40 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , -/* ) 41 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , -/* * 42 */ 0 , -/* + 43 */ 0 , -/* , 44 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , -/* - 45 */ 0 , -/* . 46 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , -/* / 47 */ 0 , -/* 0 48 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , -/* 1 49 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , -/* 2 50 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , -/* 3 51 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , -/* 4 52 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , -/* 5 53 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , -/* 6 54 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , -/* 7 55 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , -/* 8 56 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , -/* 9 57 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC , -/* : 58 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , -/* ; 59 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , -/* < 60 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , -/* = 61 */ 0 , -/* > 62 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , -/* ? 63 */ MBFL_CHP_MMHQENC , -/* @ 64 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , -/* A 65 */ MBFL_CHP_UALPHA , -/* B 66 */ MBFL_CHP_UALPHA , -/* C 67 */ MBFL_CHP_UALPHA , -/* D 68 */ MBFL_CHP_UALPHA , -/* E 69 */ MBFL_CHP_UALPHA , -/* F 70 */ MBFL_CHP_UALPHA , -/* G 71 */ MBFL_CHP_UALPHA , -/* H 72 */ MBFL_CHP_UALPHA , -/* I 73 */ MBFL_CHP_UALPHA , -/* J 74 */ MBFL_CHP_UALPHA , -/* K 75 */ MBFL_CHP_UALPHA , -/* L 76 */ MBFL_CHP_UALPHA , -/* M 77 */ MBFL_CHP_UALPHA , -/* N 78 */ MBFL_CHP_UALPHA , -/* O 79 */ MBFL_CHP_UALPHA , -/* P 80 */ MBFL_CHP_UALPHA , -/* Q 81 */ MBFL_CHP_UALPHA , -/* R 82 */ MBFL_CHP_UALPHA , -/* S 83 */ MBFL_CHP_UALPHA , -/* T 84 */ MBFL_CHP_UALPHA , -/* U 85 */ MBFL_CHP_UALPHA , -/* V 86 */ MBFL_CHP_UALPHA , -/* W 87 */ MBFL_CHP_UALPHA , -/* X 88 */ MBFL_CHP_UALPHA , -/* Y 89 */ MBFL_CHP_UALPHA , -/* Z 90 */ MBFL_CHP_UALPHA , -/* [ 91 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , -/* \ 92 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , -/* ] 93 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL , -/* ^ 94 */ MBFL_CHP_MMHQENC , -/* _ 95 */ MBFL_CHP_MMHQENC , -/* ` 96 */ MBFL_CHP_MMHQENC , -/* a 97 */ MBFL_CHP_LALPHA , -/* b 98 */ MBFL_CHP_LALPHA , -/* c 99 */ MBFL_CHP_LALPHA , -/* d 100 */ MBFL_CHP_LALPHA , -/* e 101 */ MBFL_CHP_LALPHA , -/* f 102 */ MBFL_CHP_LALPHA , -/* g 103 */ MBFL_CHP_LALPHA , -/* h 104 */ MBFL_CHP_LALPHA , -/* i 105 */ MBFL_CHP_LALPHA , -/* j 106 */ MBFL_CHP_LALPHA , -/* k 107 */ MBFL_CHP_LALPHA , -/* l 108 */ MBFL_CHP_LALPHA , -/* m 109 */ MBFL_CHP_LALPHA , -/* n 110 */ MBFL_CHP_LALPHA , -/* o 111 */ MBFL_CHP_LALPHA , -/* p 112 */ MBFL_CHP_LALPHA , -/* q 113 */ MBFL_CHP_LALPHA , -/* r 114 */ MBFL_CHP_LALPHA , -/* s 115 */ MBFL_CHP_LALPHA , -/* t 116 */ MBFL_CHP_LALPHA , -/* u 117 */ MBFL_CHP_LALPHA , -/* v 118 */ MBFL_CHP_LALPHA , -/* w 119 */ MBFL_CHP_LALPHA , -/* x 120 */ MBFL_CHP_LALPHA , -/* y 121 */ MBFL_CHP_LALPHA , -/* z 122 */ MBFL_CHP_LALPHA , -/* { 123 */ MBFL_CHP_MMHQENC , -/* | 124 */ MBFL_CHP_MMHQENC , -/* } 125 */ MBFL_CHP_MMHQENC , -/* ~ 126 */ MBFL_CHP_MMHQENC , -/* DEL 127 */ MBFL_CHP_MMHQENC -}; diff --git a/ext/mbstring/unicode_table_ru.h b/ext/mbstring/unicode_table_ru.h deleted file mode 100644 index c2f44e6f4b..0000000000 --- a/ext/mbstring/unicode_table_ru.h +++ /dev/null @@ -1,69 +0,0 @@ -/* cp1251 to Unicode table */ -static const unsigned short cp1251_ucs_table[] = { - 0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, - 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f, - 0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0x003f, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f, - 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, - 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, - 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, - 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f -}; -static const int cp1251_ucs_table_min = 0x80; -static const int cp1251_ucs_table_len = (sizeof (cp1251_ucs_table) / sizeof (unsigned short)); -static const int cp1251_ucs_table_max = 0x80 + (sizeof (cp1251_ucs_table) / sizeof (unsigned short)); - -/* cp866_DOSCyrillicRussian to Unicode table */ -static const unsigned short cp866_ucs_table[] = { - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, - 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510, - 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, - 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, - 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, - 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040e, 0x045e, - 0x00b0, 0x2219, 0x00b7, 0x221a, 0x2116, 0x00a4, 0x25a0, 0x00a0 -}; -static const int cp866_ucs_table_min = 0x80; -static const int cp866_ucs_table_len = (sizeof (cp866_ucs_table) / sizeof (unsigned short)); -static const int cp866_ucs_table_max = 0x80 + (sizeof (cp866_ucs_table) / sizeof (unsigned short)); - -/* KOI8-R (RFC1489) to Unicode */ -static const unsigned short koi8r_ucs_table[] = { - 0x2500, 0x2502, 0x250c, 0x2510, 0x2514, 0x2518, 0x251c, 0x2524, - 0x252c, 0x2534, 0x253c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590, - 0x2591, 0x2592, 0x2593, 0x2320, 0x25a0, 0x2219, 0x221a, 0x2248, - 0x2264, 0x2265, 0x00a0, 0x2321, 0x00b0, 0x00b2, 0x00b7, 0x00f7, - 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, - 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, 0x255e, - 0x255f, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565, - 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x00a9, - 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, - 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, - 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, - 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, - 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, - 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, - 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, - 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a -}; -static const int koi8r_ucs_table_min = 0x80; -static const int koi8r_ucs_table_len = (sizeof (koi8r_ucs_table) / sizeof (unsigned short)); -static const int koi8r_ucs_table_max = 0x80 + (sizeof (koi8r_ucs_table) / sizeof (unsigned short)); - |