Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

@mbfilter is changed to bundled version of libmbfl to prevent LGPL li…

…cence problem. mbregex is changed to oniguruma.
  • Loading branch information...
commit 5a80df26f3a66f08c376bf959e608ea80071204a 1 parent d696f12
Rui Hirokawa authored
Showing with 42,285 additions and 23,283 deletions.
  1. +16 −0 ext/mbstring/README.libmbfl
  2. +183 −30 ext/mbstring/config.m4
  3. +8 −0 ext/mbstring/libmbfl/AUTHORS
  4. +68 −0 ext/mbstring/libmbfl/DISCLAIMER
  5. +12 −0 ext/mbstring/libmbfl/INSTALL
  6. +2 −0  ext/mbstring/libmbfl/Makefile.am
  7. +8 −0 ext/mbstring/libmbfl/README
  8. +6 −0 ext/mbstring/libmbfl/buildconf
  9. +79 −0 ext/mbstring/libmbfl/config.h
  10. +12 −0 ext/mbstring/libmbfl/config.h.bcc32
  11. +78 −0 ext/mbstring/libmbfl/config.h.in
  12. +14 −0 ext/mbstring/libmbfl/config.h.vc6
  13. +29 −0 ext/mbstring/libmbfl/configure.in
  14. +14 −0 ext/mbstring/libmbfl/cvsclean
  15. +3 −0  ext/mbstring/libmbfl/filters/Makefile.am
  16. +29 −0 ext/mbstring/{ → libmbfl/filters}/cp932_table.h
  17. +26 −21 ext/mbstring/{ → libmbfl/filters}/html_entities.c
  18. +38 −0 ext/mbstring/libmbfl/filters/html_entities.h
  19. +82 −0 ext/mbstring/libmbfl/filters/mbfilter_7bit.c
  20. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_7bit.h
  21. +114 −0 ext/mbstring/libmbfl/filters/mbfilter_ascii.c
  22. +46 −0 ext/mbstring/libmbfl/filters/mbfilter_ascii.h
  23. +214 −0 ext/mbstring/libmbfl/filters/mbfilter_base64.c
  24. +45 −0 ext/mbstring/libmbfl/filters/mbfilter_base64.h
  25. +227 −0 ext/mbstring/libmbfl/filters/mbfilter_big5.c
  26. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_big5.h
  27. +137 −0 ext/mbstring/libmbfl/filters/mbfilter_byte2.c
  28. +48 −0 ext/mbstring/libmbfl/filters/mbfilter_byte2.h
  29. +159 −0 ext/mbstring/libmbfl/filters/mbfilter_byte4.c
  30. +46 −0 ext/mbstring/libmbfl/filters/mbfilter_byte4.h
  31. +152 −0 ext/mbstring/libmbfl/filters/mbfilter_cp1251.c
  32. +44 −0 ext/mbstring/libmbfl/filters/mbfilter_cp1251.h
  33. +147 −0 ext/mbstring/libmbfl/filters/mbfilter_cp1252.c
  34. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_cp1252.h
  35. +151 −0 ext/mbstring/libmbfl/filters/mbfilter_cp866.c
  36. +41 −0 ext/mbstring/libmbfl/filters/mbfilter_cp866.h
  37. +350 −0 ext/mbstring/libmbfl/filters/mbfilter_cp932.c
  38. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_cp932.h
  39. +228 −0 ext/mbstring/libmbfl/filters/mbfilter_cp936.c
  40. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_cp936.h
  41. +236 −0 ext/mbstring/libmbfl/filters/mbfilter_euc_cn.c
  42. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_euc_cn.h
  43. +331 −0 ext/mbstring/libmbfl/filters/mbfilter_euc_jp.c
  44. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_euc_jp.h
  45. +420 −0 ext/mbstring/libmbfl/filters/mbfilter_euc_jp_win.c
  46. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_euc_jp_win.h
  47. +256 −0 ext/mbstring/libmbfl/filters/mbfilter_euc_kr.c
  48. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_euc_kr.h
  49. +329 −0 ext/mbstring/libmbfl/filters/mbfilter_euc_tw.c
  50. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_euc_tw.h
  51. +255 −0 ext/mbstring/libmbfl/filters/mbfilter_htmlent.c
  52. +48 −0 ext/mbstring/libmbfl/filters/mbfilter_htmlent.h
  53. +276 −0 ext/mbstring/libmbfl/filters/mbfilter_hz.c
  54. +44 −0 ext/mbstring/libmbfl/filters/mbfilter_hz.h
  55. +353 −0 ext/mbstring/libmbfl/filters/mbfilter_iso2022_kr.c
  56. +44 −0 ext/mbstring/libmbfl/filters/mbfilter_iso2022_kr.h
  57. +100 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_1.c
  58. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_1.h
  59. +138 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_10.c
  60. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_10.h
  61. +138 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_13.c
  62. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_13.h
  63. +138 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_14.c
  64. +26 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_14.h
  65. +136 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_15.c
  66. +26 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_15.h
  67. +139 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_2.c
  68. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_2.h
  69. +139 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_3.c
  70. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_3.h
  71. +137 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_4.c
  72. +41 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_4.h
  73. +139 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_5.c
  74. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_5.h
  75. +139 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_6.c
  76. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_6.h
  77. +139 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_7.c
  78. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_7.h
  79. +137 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_8.c
  80. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_8.h
  81. +138 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_9.c
  82. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_iso8859_9.h
  83. +658 −0 ext/mbstring/libmbfl/filters/mbfilter_jis.c
  84. +49 −0 ext/mbstring/libmbfl/filters/mbfilter_jis.h
  85. +149 −0 ext/mbstring/libmbfl/filters/mbfilter_koi8r.c
  86. +50 −0 ext/mbstring/libmbfl/filters/mbfilter_koi8r.h
  87. +233 −0 ext/mbstring/libmbfl/filters/mbfilter_qprint.c
  88. +44 −0 ext/mbstring/libmbfl/filters/mbfilter_qprint.h
  89. +3 −3 ext/mbstring/{mbfilter_ru.c → libmbfl/filters/mbfilter_ru.c~}
  90. +3 −3 ext/mbstring/{mbfilter_ru.h → libmbfl/filters/mbfilter_ru.h~}
  91. +295 −0 ext/mbstring/libmbfl/filters/mbfilter_sjis.c
  92. +47 −0 ext/mbstring/libmbfl/filters/mbfilter_sjis.h
  93. +238 −0 ext/mbstring/libmbfl/filters/mbfilter_ucs2.c
  94. +51 −0 ext/mbstring/libmbfl/filters/mbfilter_ucs2.h
  95. +275 −0 ext/mbstring/libmbfl/filters/mbfilter_ucs4.c
  96. +49 −0 ext/mbstring/libmbfl/filters/mbfilter_ucs4.h
  97. +266 −0 ext/mbstring/libmbfl/filters/mbfilter_uhc.c
  98. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_uhc.h
  99. +309 −0 ext/mbstring/libmbfl/filters/mbfilter_utf16.c
  100. +49 −0 ext/mbstring/libmbfl/filters/mbfilter_utf16.h
  101. +272 −0 ext/mbstring/libmbfl/filters/mbfilter_utf32.c
  102. +50 −0 ext/mbstring/libmbfl/filters/mbfilter_utf32.h
  103. +460 −0 ext/mbstring/libmbfl/filters/mbfilter_utf7.c
  104. +44 −0 ext/mbstring/libmbfl/filters/mbfilter_utf7.h
  105. +372 −0 ext/mbstring/libmbfl/filters/mbfilter_utf7imap.c
  106. +43 −0 ext/mbstring/libmbfl/filters/mbfilter_utf7imap.h
  107. +269 −0 ext/mbstring/libmbfl/filters/mbfilter_utf8.c
  108. +41 −0 ext/mbstring/libmbfl/filters/mbfilter_utf8.h
  109. +152 −0 ext/mbstring/libmbfl/filters/mbfilter_uuencode.c
  110. +39 −0 ext/mbstring/libmbfl/filters/mbfilter_uuencode.h
  111. +167 −0 ext/mbstring/libmbfl/filters/unicode_prop.h
  112. +5,123 −0 ext/mbstring/libmbfl/filters/unicode_table_big5.h
  113. +28 −5,094 ext/mbstring/{unicode_table_tw.h → libmbfl/filters/unicode_table_cns11643.h}
  114. +51 −0 ext/mbstring/libmbfl/filters/unicode_table_cp1251.h
  115. +40 −0 ext/mbstring/libmbfl/filters/unicode_table_cp1252.h
  116. +51 −0 ext/mbstring/libmbfl/filters/unicode_table_cp866.h
  117. +170 −0 ext/mbstring/libmbfl/filters/unicode_table_cp932_ext.h
  118. +28 −2 ext/mbstring/{unicode_table_cn.h → libmbfl/filters/unicode_table_cp936.h}
  119. +44 −0 ext/mbstring/libmbfl/filters/unicode_table_iso8859_10.h
  120. +44 −0 ext/mbstring/libmbfl/filters/unicode_table_iso8859_13.h
  121. +44 −0 ext/mbstring/libmbfl/filters/unicode_table_iso8859_14.h
  122. +44 −0 ext/mbstring/libmbfl/filters/unicode_table_iso8859_15.h
  123. +45 −0 ext/mbstring/libmbfl/filters/unicode_table_iso8859_2.h
  124. +43 −0 ext/mbstring/libmbfl/filters/unicode_table_iso8859_3.h
  125. +44 −0 ext/mbstring/libmbfl/filters/unicode_table_iso8859_4.h
  126. +44 −0 ext/mbstring/libmbfl/filters/unicode_table_iso8859_5.h
  127. +44 −0 ext/mbstring/libmbfl/filters/unicode_table_iso8859_6.h
  128. +44 −0 ext/mbstring/libmbfl/filters/unicode_table_iso8859_7.h
  129. +44 −0 ext/mbstring/libmbfl/filters/unicode_table_iso8859_8.h
  130. +44 −0 ext/mbstring/libmbfl/filters/unicode_table_iso8859_9.h
  131. +30 −144 ext/mbstring/{unicode_table_ja.h → libmbfl/filters/unicode_table_jis.h}
  132. +53 −0 ext/mbstring/libmbfl/filters/unicode_table_koi8r.h
  133. +29 −0 ext/mbstring/{unicode_table_kr.h → libmbfl/filters/unicode_table_uhc.h}
  134. +763 −0 ext/mbstring/libmbfl/libmbfl.dsp
  135. +29 −0 ext/mbstring/libmbfl/libmbfl.dsw
  136. +95 −0 ext/mbstring/libmbfl/mbfl.def
  137. +24 −0 ext/mbstring/libmbfl/mbfl.rc
  138. +13 −0 ext/mbstring/libmbfl/mbfl/Makefile.am
  139. +2,719 −0 ext/mbstring/libmbfl/mbfl/mbfilter.c
  140. +297 −0 ext/mbstring/libmbfl/mbfl/mbfilter.h
  141. +48 −0 ext/mbstring/libmbfl/mbfl/mbfilter_8bit.c
  142. +38 −0 ext/mbstring/libmbfl/mbfl/mbfilter_8bit.h
  143. +65 −0 ext/mbstring/libmbfl/mbfl/mbfilter_pass.c
  144. +40 −0 ext/mbstring/libmbfl/mbfl/mbfilter_pass.h
  145. +48 −0 ext/mbstring/libmbfl/mbfl/mbfilter_wchar.c
  146. +38 −0 ext/mbstring/libmbfl/mbfl/mbfilter_wchar.h
  147. +93 −0 ext/mbstring/libmbfl/mbfl/mbfl_allocators.c
  148. +54 −0 ext/mbstring/libmbfl/mbfl/mbfl_allocators.h
  149. +85 −0 ext/mbstring/libmbfl/mbfl/mbfl_consts.h
  150. +507 −0 ext/mbstring/libmbfl/mbfl/mbfl_convert.c
  151. +88 −0 ext/mbstring/libmbfl/mbfl/mbfl_convert.h
  152. +288 −0 ext/mbstring/libmbfl/mbfl/mbfl_encoding.c
  153. +123 −0 ext/mbstring/libmbfl/mbfl/mbfl_encoding.h
  154. +49 −0 ext/mbstring/libmbfl/mbfl/mbfl_filter_output.c
  155. +37 −0 ext/mbstring/libmbfl/mbfl/mbfl_filter_output.h
  156. +241 −0 ext/mbstring/libmbfl/mbfl/mbfl_ident.c
  157. +71 −0 ext/mbstring/libmbfl/mbfl/mbfl_ident.h
  158. +159 −0 ext/mbstring/libmbfl/mbfl/mbfl_language.c
  159. +83 −0 ext/mbstring/libmbfl/mbfl/mbfl_language.h
  160. +350 −0 ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c
  161. +70 −0 ext/mbstring/libmbfl/mbfl/mbfl_memory_device.h
  162. +79 −0 ext/mbstring/libmbfl/mbfl/mbfl_string.c
  163. +55 −0 ext/mbstring/libmbfl/mbfl/mbfl_string.h
  164. +336 −0 ext/mbstring/libmbfl/missing
  165. +5 −0 ext/mbstring/libmbfl/mksbcc32.bat
  166. +3 −0  ext/mbstring/libmbfl/nls/Makefile.am
  167. +23 −0 ext/mbstring/libmbfl/nls/nls_de.c
  168. +8 −0 ext/mbstring/libmbfl/nls/nls_de.h
  169. +21 −0 ext/mbstring/libmbfl/nls/nls_en.c
  170. +8 −0 ext/mbstring/libmbfl/nls/nls_en.h
  171. +20 −0 ext/mbstring/libmbfl/nls/nls_ja.c
  172. +8 −0 ext/mbstring/libmbfl/nls/nls_ja.h
  173. +21 −0 ext/mbstring/libmbfl/nls/nls_kr.c
  174. +8 −0 ext/mbstring/libmbfl/nls/nls_kr.h
  175. +21 −0 ext/mbstring/libmbfl/nls/nls_neutral.c
  176. +8 −0 ext/mbstring/libmbfl/nls/nls_neutral.h
  177. +20 −0 ext/mbstring/libmbfl/nls/nls_ru.c
  178. +9 −0 ext/mbstring/libmbfl/nls/nls_ru.h
  179. +23 −0 ext/mbstring/libmbfl/nls/nls_uni.c
  180. +8 −0 ext/mbstring/libmbfl/nls/nls_uni.h
  181. +31 −0 ext/mbstring/libmbfl/nls/nls_zh.c
  182. +9 −0 ext/mbstring/libmbfl/nls/nls_zh.h
  183. +7 −0 ext/mbstring/libmbfl/rules.mak.bcc32
  184. +38 −0 ext/mbstring/libmbfl/tests/sample.c
  185. +0 −9,677 ext/mbstring/mbfilter.c
  186. +0 −597 ext/mbstring/mbfilter.h
  187. +0 −417 ext/mbstring/mbfilter_cn.c
  188. +0 −33 ext/mbstring/mbfilter_cn.h
  189. +0 −1,291 ext/mbstring/mbfilter_ja.c
  190. +0 −98 ext/mbstring/mbfilter_ja.h
  191. +0 −516 ext/mbstring/mbfilter_kr.c
  192. +0 −33 ext/mbstring/mbfilter_kr.h
  193. +0 −337 ext/mbstring/mbfilter_tw.c
  194. +0 −30 ext/mbstring/mbfilter_tw.h
  195. +0 −4,712 ext/mbstring/mbregex.c
  196. +0 −213 ext/mbstring/mbregex.h
  197. +14 −31 ext/mbstring/mbstring.c
  198. +1 −1  ext/mbstring/mbstring.h
  199. +32 −0 ext/mbstring/oniguruma/COPYING
  200. +517 −0 ext/mbstring/oniguruma/HISTORY
  201. +48 −0 ext/mbstring/oniguruma/INSTALL-RUBY
  202. +188 −0 ext/mbstring/oniguruma/Makefile.in
  203. +67 −0 ext/mbstring/oniguruma/config.h
  204. +66 −0 ext/mbstring/oniguruma/config.h.in
  205. +70 −0 ext/mbstring/oniguruma/configure.in
  206. +279 −0 ext/mbstring/oniguruma/doc/API
  207. +224 −0 ext/mbstring/oniguruma/doc/RE
  208. +135 −0 ext/mbstring/oniguruma/onigposix.h
  209. +447 −0 ext/mbstring/oniguruma/oniguruma.h
  210. +46 −0 ext/mbstring/oniguruma/php_compat.h
  211. +56 −0 ext/mbstring/oniguruma/re.c.168.patch
  212. +66 −0 ext/mbstring/oniguruma/re.c.180.patch
  213. +5,282 −0 ext/mbstring/oniguruma/regcomp.c
  214. +267 −0 ext/mbstring/oniguruma/regerror.c
  215. +16 −0 ext/mbstring/oniguruma/regex.c
  216. +2,935 −0 ext/mbstring/oniguruma/regexec.c
  217. +231 −0 ext/mbstring/oniguruma/reggnu.c
  218. +790 −0 ext/mbstring/oniguruma/regint.h
  219. +4,215 −0 ext/mbstring/oniguruma/regparse.c
Sorry, we could not display the entire diff because it was too big.
16 ext/mbstring/README.libmbfl
View
@@ -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.
+
213 ext/mbstring/config.m4
View
@@ -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
8 ext/mbstring/libmbfl/AUTHORS
View
@@ -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
68 ext/mbstring/libmbfl/DISCLAIMER
View
@@ -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に変更。
+
12 ext/mbstring/libmbfl/INSTALL
View
@@ -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.
+
2  ext/mbstring/libmbfl/Makefile.am
View
@@ -0,0 +1,2 @@
+EXTRA_DIST=AUTHORS DISCLAIMER
+SUBDIRS = nls filters mbfl
8 ext/mbstring/libmbfl/README
View
@@ -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.
+
6 ext/mbstring/libmbfl/buildconf
View
@@ -0,0 +1,6 @@
+#!/bin/sh
+libtoolize -c -f --automake
+aclocal
+autoheader
+automake -a -c --foreign
+autoconf
79 ext/mbstring/libmbfl/config.h
View
@@ -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 */
12 ext/mbstring/libmbfl/config.h.bcc32
View
@@ -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
78 ext/mbstring/libmbfl/config.h.in
View
@@ -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
14 ext/mbstring/libmbfl/config.h.vc6
View
@@ -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)
29 ext/mbstring/libmbfl/configure.in
View
@@ -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
14 ext/mbstring/libmbfl/cvsclean
View
@@ -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
3  ext/mbstring/libmbfl/filters/Makefile.am
View
@@ -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
29 ext/mbstring/cp932_table.h → ext/mbstring/libmbfl/filters/cp932_table.h
View
@@ -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 */
47 ext/mbstring/html_entities.c → ext/mbstring/libmbfl/filters/html_entities.c
View
@@ -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[] = { /*
38 ext/mbstring/libmbfl/filters/html_entities.h
View
@@ -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 */
+
82 ext/mbstring/libmbfl/filters/mbfilter_7bit.c
View
@@ -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;
+}
+
+
43 ext/mbstring/libmbfl/filters/mbfilter_7bit.h
View
@@ -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 */
114 ext/mbstring/libmbfl/filters/mbfilter_ascii.c
View
@@ -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;
+}
46 ext/mbstring/libmbfl/filters/mbfilter_ascii.h
View
@@ -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 */
+
+
214 ext/mbstring/libmbfl/filters/mbfilter_base64.c
View
@@ -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;
+}
+
+
45 ext/mbstring/libmbfl/filters/mbfilter_base64.h
View
@@ -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 */
227 ext/mbstring/libmbfl/filters/mbfilter_big5.c
View
@@ -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;
+}
+
+
43 ext/mbstring/libmbfl/filters/mbfilter_big5.h
View
@@ -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 */
137 ext/mbstring/libmbfl/filters/mbfilter_byte2.c
View
@@ -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;
+}
+
+
48 ext/mbstring/libmbfl/filters/mbfilter_byte2.h
View
@@ -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 */
159 ext/mbstring/libmbfl/filters/mbfilter_byte4.c
View
@@ -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;
+}
+
+
46 ext/mbstring/libmbfl/filters/mbfilter_byte4.h
View
@@ -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 */
152 ext/mbstring/libmbfl/filters/mbfilter_cp1251.c
View
@@ -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;
+}
+
+
44 ext/mbstring/libmbfl/filters/mbfilter_cp1251.h
View
@@ -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 */
+
147 ext/mbstring/libmbfl/filters/mbfilter_cp1252.c
View
@@ -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;
+ }