[php-i18n-commits] cvs commit: libmbfl/mbfl .cvsignore mbfl_convert.c mbfl_encoding.c mbfl_ident.c

アーカイブの一覧に戻る

Rui Hirokawa hirok****@users*****
2007年 8月 11日 (土) 14:38:28 JST


hirokawa    07/08/11 14:38:28

  Modified:    .        Makefile.bcc32 configure.in
               filters  Makefile.am mbfilter_cp51932.c
                        mbfilter_euc_jp_win.c mbfilter_jis.c mbfilter_jis.h
                        unicode_table_jis.h
               mbfl     .cvsignore mbfl_convert.c mbfl_encoding.c
                        mbfl_ident.c
  Added:       filters  mbfilter_iso2022_jp_ms.c mbfilter_iso2022_jp_ms.h
  Log:
  sync with PHP 5.2.4
  
  Revision  Changes    Path
  1.6       +2 -0      libmbfl/Makefile.bcc32
  
  Index: Makefile.bcc32
  ===================================================================
  RCS file: /cvsroot/php-i18n/libmbfl/Makefile.bcc32,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Makefile.bcc32	25 Aug 2003 01:21:19 -0000	1.5
  +++ Makefile.bcc32	11 Aug 2007 05:38:28 -0000	1.6
  @@ -22,6 +22,8 @@
   
   clean:
   	@for %i in ($(SUBDIRS)) do $(COMSPEC) /C mksbcc32.bat $(MAKE) %i clean
  +	@if exist linker.rsp del linker.rsp
  +	@if exist mbfl.RES del mbfl.RES
   	@if exist mbfl.dll del mbfl.dll
   	@if exist mbfl.lib del mbfl.lib
   	@if exist config.h del config.h
  
  
  
  1.15      +0 -6      libmbfl/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /cvsroot/php-i18n/libmbfl/configure.in,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- configure.in	2 Nov 2006 23:58:28 -0000	1.14
  +++ configure.in	11 Aug 2007 05:38:28 -0000	1.15
  @@ -3,7 +3,6 @@
   AM_INIT_AUTOMAKE(libmbfl, 1.0.0)
   AC_CONFIG_SRCDIR(mbfl/mbfilter.c)
   AM_CONFIG_HEADER(config.h)
  -AM_MAINTAINER_MODE
   
   SHLIB_VERSION="1:0:0"
   AC_SUBST(SHLIB_VERSION)
  @@ -20,11 +19,6 @@
   AC_HEADER_STDC
   AC_CHECK_HEADERS([stdlib.h stddef.h assert.h])
   
  -AC_ARG_ENABLE([threads],
  -  [  --enable-threads        enable threading support],
  -  [enable_threads="$enableval"],
  -  [enable_threads="autodetect"])
  -
   # Checks for typedefs, structures, and compiler characteristics.
   AC_C_CONST
   AC_TYPE_SIZE_T
  
  
  
  1.11      +1 -1      libmbfl/filters/Makefile.am
  
  Index: Makefile.am
  ===================================================================
  RCS file: /cvsroot/php-i18n/libmbfl/filters/Makefile.am,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Makefile.am	2 Nov 2006 23:58:28 -0000	1.10
  +++ Makefile.am	11 Aug 2007 05:38:28 -0000	1.11
  @@ -2,7 +2,7 @@
   noinst_LTLIBRARIES=libmbfl_filters.la
   INCLUDES=-I../mbfl
   libmbfl_filters_la_LDFLAGS=-version-info $(SHLIB_VERSION)
  -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_iso8859_16.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_cp51932.c mbfilter_euc_cn.c mbfilter_euc_kr.c mbfilter_uhc.c mbfilter_iso2022_kr.c mbfilter_cp866.c mbfilter_koi8r.c mbfilter_armscii8.c html_entities.c cp932_table.h html_entities.h mbfilter_7bit.h mbfilter_ascii.h mbfilter_base64.h mbfilter_big5.h mbfilter_byte2.h mbfilter_byte4.h mbfilter_cp1251.h mbfilter_cp1252.h mbfilter_cp866.h mbfilter_cp932.h mbfilter_cp51932.h mbfilter_cp936.h mbfilter_euc_cn.h mbfilter_euc_jp.h mbfilter_euc_jp_win.h mbfilter_euc_kr.h mbfilter_euc_tw.h mbfilter_htmlent.h mbfilter_hz.h mbfilter_iso2022_kr.h mbfilter_iso8859_1.h mbfilter_iso8859_10.h mbfilter_iso8859_13.h mbfilter_iso8859_14.h mbfilter_iso8859_15.h mbfilter_iso8859_16.h mbfilter_iso8859_2.h mbfilter_iso8859_3.h mbfilter_iso8859_4.h mbfilter_iso8859_5.h mbfilter_iso8859_6.h mbfilter_iso8859_7.h mbfilter_iso8859_8.h mbfilter_iso8859_9.h mbfilter_jis.h mbfilter_koi8r.h mbfilter_armscii8.h mbfilter_qprint.h mbfilter_sjis.h mbfilter_ucs2.h mbfilter_ucs4.h mbfilter_uhc.h mbfilter_utf16.h mbfilter_utf32.h mbfilter_utf7.h mbfilter_utf7imap.h mbfilter_utf8.h mbfilter_uuencode.h unicode_prop.h unicode_table_big5.h unicode_table_cns11643.h unicode_table_cp1251.h unicode_table_cp1252.h unicode_table_cp866.h unicode_table_cp932_ext.h unicode_table_cp936.h unic
_table_iso8859_10.h unicode_table_iso8859_13.h unicode_table_iso8859_14.h unicode_table_iso8859_15.h unicode_table_iso8859_16.h unicode_table_iso8859_2.h unicode_table_iso8859_3.h unicode_table_iso8859_4.h unicode_table_iso8859_5.h unicode_table_iso8859_6.h unicode_table_iso8859_7.h unicode_table_iso8859_8.h unicode_table_iso8859_9.h unicode_table_jis.h unicode_table_koi8r.h unicode_table_armscii8.h unicode_table_uhc.h
  +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_iso8859_16.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_cp51932.c mbfilter_iso2022_jp_ms.c mbfilter_euc_cn.c mbfilter_euc_kr.c mbfilter_uhc.c mbfilter_iso2022_kr.c mbfilter_cp866.c mbfilter_koi8r.c mbfilter_armscii8.c html_entities.c cp932_table.h html_entities.h mbfilter_7bit.h mbfilter_ascii.h mbfilter_base64.h mbfilter_big5.h mbfilter_byte2.h mbfilter_byte4.h mbfilter_cp1251.h mbfilter_cp1252.h mbfilter_cp866.h mbfilter_cp932.h mbfilter_cp51932.h mbfilter_iso2022_jp_ms.h mbfilter_cp936.h mbfilter_euc_cn.h mbfilter_euc_jp.h mbfilter_euc_jp_win.h mbfilter_euc_kr.h mbfilter_euc_tw.h mbfilter_htmlent.h mbfilter_hz.h mbfilter_iso2022_kr.h mbfilter_iso8859_1.h mbfilter_iso8859_10.h mbfilter_iso8859_13.h mbfilter_iso8859_14.h mbfilter_iso8859_15.h mbfilter_iso8859_16.h mbfilter_iso8859_2.h mbfilter_iso8859_3.h mbfilter_iso8859_4.h mbfilter_iso8859_5.h mbfilter_iso8859_6.h mbfilter_iso8859_7.h mbfilter_iso8859_8.h mbfilter_iso8859_9.h mbfilter_jis.h mbfilter_koi8r.h mbfilter_armscii8.h mbfilter_qprint.h mbfilter_sjis.h mbfilter_ucs2.h mbfilter_ucs4.h mbfilter_uhc.h mbfilter_utf16.h mbfilter_utf32.h mbfilter_utf7.h mbfilter_utf7imap.h mbfilter_utf8.h mbfilter_uuencode.h unicode_prop.h unicode_table_big5.h unicode_table_cns11643.h unicode_table_cp1251.h unicode_table_cp1252.h unicode_table_cp866.h un
de_table_cp932_ext.h unicode_table_cp936.h unicode_table_iso8859_10.h unicode_table_iso8859_13.h unicode_table_iso8859_14.h unicode_table_iso8859_15.h unicode_table_iso8859_16.h unicode_table_iso8859_2.h unicode_table_iso8859_3.h unicode_table_iso8859_4.h unicode_table_iso8859_5.h unicode_table_iso8859_6.h unicode_table_iso8859_7.h unicode_table_iso8859_8.h unicode_table_iso8859_9.h unicode_table_jis.h unicode_table_koi8r.h unicode_table_armscii8.h unicode_table_uhc.h
   
   mbfilter_iso8859_2.c: unicode_table_iso8859_2.h
   
  
  
  
  1.2       +1 -1      libmbfl/filters/mbfilter_cp51932.c
  
  Index: mbfilter_cp51932.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/libmbfl/filters/mbfilter_cp51932.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mbfilter_cp51932.c	2 Nov 2006 23:58:28 -0000	1.1
  +++ mbfilter_cp51932.c	11 Aug 2007 05:38:28 -0000	1.2
  @@ -111,7 +111,7 @@
   int
   mbfl_filt_conv_cp51932_wchar(int c, mbfl_convert_filter *filter)
   {
  -	int c1, s, w, n;
  +	int c1, s, w;
   
   	switch (filter->status) {
   	case 0:
  
  
  
  1.10      +11 -0     libmbfl/filters/mbfilter_euc_jp_win.c
  
  Index: mbfilter_euc_jp_win.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/libmbfl/filters/mbfilter_euc_jp_win.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- mbfilter_euc_jp_win.c	2 Nov 2006 23:58:28 -0000	1.9
  +++ mbfilter_euc_jp_win.c	11 Aug 2007 05:38:28 -0000	1.10
  @@ -204,6 +204,9 @@
   			s = (c1 - 0xa1)*94 + c - 0xa1;
   			if (s >= 0 && s < jisx0212_ucs_table_size) {
   				w = jisx0212_ucs_table[s];
  +				if (w == 0x007e) {
  +					w = 0xff5e;		/* FULLWIDTH TILDE */
  +				}
   			} else if (s >= (82*94) && s < (84*94)) {	/* vender ext3 (83ku - 84ku) <-> CP932 (115ku -120ku) */
   				s = (c1<< 8) | c;
   				w = 0;
  @@ -222,6 +225,9 @@
   			} else {
   				w = 0;
   			}
  +			if (w == 0x00A6) {
  +				w = 0xFFE4;		/* FULLWIDTH BROKEN BAR */
  +			}
   			if (w <= 0) {
   				w = ((c1 & 0x7f) << 8) | (c & 0x7f);
   				w &= MBFL_WCSPLANE_MASK;
  @@ -274,6 +280,9 @@
   		c2 = s1%94 + 0xa1;
   		s1 = (c1 << 8) | c2;
   	}
  +	if (s1 == 0xa2f1) {
  +		s1 = 0x2d62;		/* NUMERO SIGN */
  +	}
   	if (s1 <= 0) {
   		c1 = c & ~MBFL_WCSPLANE_MASK;
   		if (c1 == MBFL_WCSPLANE_WINCP932) {
  @@ -311,6 +320,8 @@
   			s1 = 0x2172;
   		} else if (c == 0xffe2) {	/* FULLWIDTH NOT SIGN */
   			s1 = 0x224c;
  +		} else if (c == 0xff5e) {	/* FULLWIDTH TILDE */
  +			s1 = 0x2141;
   		} else {
   			s1 = -1;
   			c1 = 0;
  
  
  
  1.11      +8 -146    libmbfl/filters/mbfilter_jis.c
  
  Index: mbfilter_jis.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/libmbfl/filters/mbfilter_jis.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- mbfilter_jis.c	2 Nov 2006 23:58:28 -0000	1.10
  +++ mbfilter_jis.c	11 Aug 2007 05:38:28 -0000	1.11
  @@ -58,15 +58,6 @@
   	MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
   };
   
  -const mbfl_encoding mbfl_encoding_2022jpms = {
  -	mbfl_no_encoding_2022jpms,
  -	"ISO-2022-JP-MS",
  -	"ISO-2022-JP-MS",
  -	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,
  @@ -81,13 +72,6 @@
   	mbfl_filt_ident_2022jp
   };
   
  -const struct mbfl_identify_vtbl vtbl_identify_2022jpms = {
  -	mbfl_no_encoding_2022jpms,
  -	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,
  @@ -124,24 +108,6 @@
   	mbfl_filt_conv_any_jis_flush
   };
   
  -const struct mbfl_convert_vtbl vtbl_2022jpms_wchar = {
  -	mbfl_no_encoding_2022jpms,
  -	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_2022jpms = {
  -	mbfl_no_encoding_wchar,
  -	mbfl_no_encoding_2022jpms,
  -	mbfl_filt_conv_common_ctor,
  -	mbfl_filt_conv_common_dtor,
  -	mbfl_filt_conv_wchar_jis,
  -	mbfl_filt_conv_any_jis_flush
  -};
  -
   #define CK(statement)	do { if ((statement) < 0) return (-1); } while (0)
   
   /*
  @@ -164,10 +130,12 @@
   			filter->status += 2;
   		} else if (c == 0x0e) {		/* "kana in" */
   			filter->status = 0x20;
  -			CK((*filter->output_function)(c, filter->data));
   		} else if (c == 0x0f) {		/* "kana out" */
   			filter->status = 0;
  -			CK((*filter->output_function)(c, filter->data));
  +		} 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 */
  @@ -193,35 +161,10 @@
   			s = (c1 - 0x21)*94 + c - 0x21;
   			if (filter->status == 0x80) {
   				if (s >= 0 && s < jisx0208_ucs_table_size) {
  -				  if ((filter->from)->no_encoding != 
  -				      mbfl_no_encoding_2022jpms) {
   					w = jisx0208_ucs_table[s];
  -				  }
  -				  else {
  -				    if ((c1 - 0x21) == 12) {
  -				      w = cp932ext1_ucs_table[s-12*94];
  -				    }
  -				    else {
  -				      if (c1 >= 0x79 && c1 <= 0x7c) {
  -					w = cp932ext2_ucs_table[s-(0x79-0x21)*94];
  -				      }
  -				      else {
  -					w = jisx0208_ucs_table[s];
  -				      }
  -				    }
  -				  }
  -				} else {
  -				  if ((filter->from)->no_encoding != 
  -				      mbfl_no_encoding_2022jpms) {
  -					w = 0;
  -				  } else {
  -				      if (c1 >= 0x79 && c1 <= 0x7c) {
  -					w = cp932ext2_ucs_table[s-(0x79-0x21)*94];
   				      } else {
   					w = 0;
   				      }
  -				  }
  -				}
   				if (w <= 0) {
   					w = (c1 << 8) | c;
   					w &= MBFL_WCSPLANE_MASK;
  @@ -344,7 +287,7 @@
   int
   mbfl_filt_conv_wchar_jis(int c, mbfl_convert_filter *filter)
   {
  -        int c1, c2, s;
  +	int c1, s;
   
   	s = 0;
   	if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
  @@ -356,18 +299,6 @@
   	} 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 > 0x8080 && s < 0x10000 && 
  -	    ((filter->to)->no_encoding == mbfl_no_encoding_2022jpms)) {
  -	  c1 = 0;
  -	  c2 = cp932ext2_ucs_table_max - cp932ext2_ucs_table_min;
  -	  while (c1 < c2) {		/* CP932 vendor ext3 (115ku - 119ku) */
  -	    if (c == cp932ext2_ucs_table[c1]) {
  -	      s = ((c1/94 + 0x79) << 8) +(c1%94 + 0x21);
  -	      break;
  -	    }
  -	    c1++;
  -	  }
  -	}
   	if (s <= 0) {
   		c1 = c & ~MBFL_WCSPLANE_MASK;
   		if (c1 == MBFL_WCSPLANE_JIS0208) {
  @@ -396,30 +327,8 @@
   		}
   		if (c == 0) {
   			s = 0;
  -		} else if (s <= 0 && ((filter->to)->no_encoding ==
  -				      mbfl_no_encoding_2022jpms)) {
  +		} else if (s <= 0) {
   			s = -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]) {
  -					s = ((c1/94 + 0x2d) << 8) + (c1%94 + 0x21);
  -					break;
  -				}
  -				c1++;
  -			}
  -			if (s < 0 && ((filter->to)->no_encoding ==
  -				      mbfl_no_encoding_2022jpms)) {
  -				c1 = 0;
  -				c2 = cp932ext2_ucs_table_max - cp932ext2_ucs_table_min;
  -				while (c1 < c2) {		/* CP932 vendor ext3 (115ku - 119ku) */
  -					if (c == cp932ext2_ucs_table[c1]) {
  -					  s = ((c1/94 + 0x79) << 8) +(c1%94 + 0x21);
  -					  break;
  -					}
  -					c1++;
  -				}
  -			}
   		}
   	}
   	if (s >= 0) {
  @@ -483,7 +392,7 @@
   int
   mbfl_filt_conv_wchar_2022jp(int c, mbfl_convert_filter *filter)
   {
  -        int c1, c2, s;
  +	int s;
   
   	s = 0;
   	if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
  @@ -519,47 +428,9 @@
   			s = 0;
   		} else if (s <= 0) {
   			s = -1;
  -			if ( (filter->to)->no_encoding ==
  -			     mbfl_no_encoding_2022jpms) {
  -			  c1 = 0;
  -			  c2 = cp932ext1_ucs_table_max - cp932ext1_ucs_table_min;
  -			  while (c1 < c2) {		/* CP932 vendor ext1 (13ku) */
  -			    if (c == cp932ext1_ucs_table[c1]) {
  -			      s = ((c1/94 + 0x2d) << 8) + (c1%94 + 0x21);
  -			      break;
  -			    }
  -			    c1++;
   			  }
  -			  if ((filter->to)->no_encoding ==
  -			      mbfl_no_encoding_2022jpms) {
  -			    c1 = 0;
  -			    c2 = cp932ext2_ucs_table_max - cp932ext2_ucs_table_min;
  -			    while (c1 < c2) {		/* CP932 vendor ext3 (115ku - 119ku) */
  -			      if (c == cp932ext2_ucs_table[c1]) {
  -				s = ((c1/94 + 0x79) << 8) +(c1%94 + 0x21);
  -				break;
  -			      }
  -			      c1++;
  -			    }
  -			  }
  -			}
  -		}
  -	} else if (((s >= 0x80 && s < 0x2121) &&
  -		    (filter->to)->no_encoding != mbfl_no_encoding_2022jpms) || 
  -		   (s > 0x8080)) {
  +	} else if ((s >= 0x80 && s < 0x2121) || (s > 0x8080)) {
   		s = -1;
  -		if ((filter->to)->no_encoding ==
  -		    mbfl_no_encoding_2022jpms) {
  -		  c1 = 0;
  -		  c2 = cp932ext2_ucs_table_max - cp932ext2_ucs_table_min;
  -		  while (c1 < c2) { /* CP932 vendor ext3 (115ku - 119ku) */
  -		    if (c == cp932ext2_ucs_table[c1]) {
  -		      s = ((c1/94 + 0x79) << 8) +(c1%94 + 0x21);
  -		      break;
  -		    }
  -		    c1++;
  -		  }
  -		}
   	}
   	if (s >= 0) {
   		if (s < 0x80) { /* ASCII */
  @@ -570,15 +441,6 @@
   			}
   			filter->status = 0;
   			CK((*filter->output_function)(s, filter->data));
  -		} else if (s < 0x100 && ((filter->to)->no_encoding ==
  -				      mbfl_no_encoding_2022jpms)) { /* 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 < 0x10000) { /* X 0208 */
   			if ((filter->status & 0xff00) != 0x200) {
   				CK((*filter->output_function)(0x1b, filter->data));		/* ESC */
  
  
  
  1.7       +0 -4      libmbfl/filters/mbfilter_jis.h
  
  Index: mbfilter_jis.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/libmbfl/filters/mbfilter_jis.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- mbfilter_jis.h	2 Nov 2006 23:58:28 -0000	1.6
  +++ mbfilter_jis.h	11 Aug 2007 05:38:28 -0000	1.7
  @@ -34,16 +34,12 @@
   
   extern const mbfl_encoding mbfl_encoding_jis;
   extern const mbfl_encoding mbfl_encoding_2022jp;
  -extern const mbfl_encoding mbfl_encoding_2022jpms;
   extern const struct mbfl_identify_vtbl vtbl_identify_2022jp;
  -extern const struct mbfl_identify_vtbl vtbl_identify_2022jpms;
   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;
  -extern const struct mbfl_convert_vtbl vtbl_2022jpms_wchar;
  -extern const struct mbfl_convert_vtbl vtbl_wchar_2022jpms;
    
   int mbfl_filt_conv_jis_wchar(int c, mbfl_convert_filter *filter);
   int mbfl_filt_conv_wchar_jis(int c, mbfl_convert_filter *filter);
  
  
  
  1.3       +7 -7      libmbfl/filters/unicode_table_jis.h
  
  Index: unicode_table_jis.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/libmbfl/filters/unicode_table_jis.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- unicode_table_jis.h	2 Nov 2006 23:58:29 -0000	1.2
  +++ unicode_table_jis.h	11 Aug 2007 05:38:28 -0000	1.3
  @@ -36,13 +36,13 @@
    0xFF1F,0xFF01,0x309B,0x309C,0x00B4,0xFF40,0x00A8,0xFF3E,
    0xFFE3,0xFF3F,0x30FD,0x30FE,0x309D,0x309E,0x3003,0x4EDD,
    0x3005,0x3006,0x3007,0x30FC,0x2015,0x2010,0xFF0F,0xFF3C,
  - 0xFF5E,0x2225,0xFF5C,0x2026,0x2025,0x2018,0x2019,0x201C,
  + 0x301C,0x2016,0xFF5C,0x2026,0x2025,0x2018,0x2019,0x201C,
    0x201D,0xFF08,0xFF09,0x3014,0x3015,0xFF3B,0xFF3D,0xFF5B,
    0xFF5D,0x3008,0x3009,0x300A,0x300B,0x300C,0x300D,0x300E,
  - 0x300F,0x3010,0x3011,0xFF0B,0xFF0D,0x00B1,0x00D7,0x00F7,
  + 0x300F,0x3010,0x3011,0xFF0B,0x2212,0x00B1,0x00D7,0x00F7,
    0xFF1D,0x2260,0xFF1C,0xFF1E,0x2266,0x2267,0x221E,0x2234,
    0x2642,0x2640,0x00B0,0x2032,0x2033,0x2103,0xFFE5,0xFF04,
  - 0xFFE0,0xFFE1,0xFF05,0xFF03,0xFF06,0xFF0A,0xFF20,0x00A7,
  + 0x00A2,0x00A3,0xFF05,0xFF03,0xFF06,0xFF0A,0xFF20,0x00A7,
    0x2606,0x2605,0x25CB,0x25CF,0x25CE,0x25C7,
   
    /* ku 2 */
  @@ -51,7 +51,7 @@
    0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
    0x0000,0x2208,0x220B,0x2286,0x2287,0x2282,0x2283,0x222A,
    0x2229,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  - 0x0000,0x2227,0x2228,0xFFE2,0x21D2,0x21D4,0x2200,0x2203,
  + 0x0000,0x2227,0x2228,0x00AC,0x21D2,0x21D4,0x2200,0x2203,
    0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
    0x0000,0x0000,0x0000,0x2220,0x22A5,0x2312,0x2202,0x2207,
    0x2261,0x2252,0x226A,0x226B,0x221A,0x223D,0x221D,0x2235,
  @@ -1217,9 +1217,9 @@
    /* ku 2 */
    0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
    0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x02D8,0x02C7,
  - 0x00B8,0x02D9,0x02DD,0x00AF,0x02DB,0x02DA,0xFF5E,0x0384,
  + 0x00B8,0x02D9,0x02DD,0x00AF,0x02DB,0x02DA,0x007E,0x0384,
    0x0385,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  - 0x0000,0x00A1,0xFFE4,0x00BF,0x0000,0x0000,0x0000,0x0000,
  + 0x0000,0x00A1,0x00A6,0x00BF,0x0000,0x0000,0x0000,0x0000,
    0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
    0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
    0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  @@ -2471,7 +2471,7 @@
    /* 2100h */
    0x0000,0x0000,0x0000,0x216E,0x0000,0x0000,0x0000,0x0000,
    0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  - 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2d62,0x0000,
  + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xA2F1,0x0000,
    0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
    0x0000,0x0000,0xA2EF,0x0000,0x0000,0x0000,0x0000,0x0000,
    0x0000,0x0000,0x0000,0x2272,0x0000,0x0000,0x0000,0x0000,
  
  
  
  1.1                  libmbfl/filters/mbfilter_iso2022_jp_ms.c
  
  Index: mbfilter_iso2022_jp_ms.c
  ===================================================================
  /*
   * "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 <moriy****@php*****> on 4 dec 2002.
   * 
   */
  
  #ifdef HAVE_CONFIG_H
  #include "config.h"
  #endif
  
  #include "mbfilter.h"
  #include "mbfilter_iso2022_jp_ms.h"
  
  #include "unicode_table_cp932_ext.h"
  #include "unicode_table_jis.h"
  #include "cp932_table.h"
  
  static int mbfl_filt_ident_2022jpms(int c, mbfl_identify_filter *filter);
  
  static const char *mbfl_encoding_2022jpms_aliases[] = {"ISO2022JPMS", NULL};
  
  const mbfl_encoding mbfl_encoding_2022jpms = {
  	mbfl_no_encoding_2022jpms,
  	"ISO-2022-JP-MS",
  	"ISO-2022-JP",
  	(const char *(*)[])&mbfl_encoding_2022jpms_aliases,
  	NULL,
  	MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
  };
  
  const struct mbfl_identify_vtbl vtbl_identify_2022jpms = {
  	mbfl_no_encoding_2022jpms,
  	mbfl_filt_ident_common_ctor,
  	mbfl_filt_ident_common_dtor,
  	mbfl_filt_ident_2022jpms
  };
  
  const struct mbfl_convert_vtbl vtbl_2022jpms_wchar = {
  	mbfl_no_encoding_2022jpms,
  	mbfl_no_encoding_wchar,
  	mbfl_filt_conv_common_ctor,
  	mbfl_filt_conv_common_dtor,
  	mbfl_filt_conv_2022jpms_wchar,
  	mbfl_filt_conv_common_flush
  };
  
  const struct mbfl_convert_vtbl vtbl_wchar_2022jpms = {
  	mbfl_no_encoding_wchar,
  	mbfl_no_encoding_2022jpms,
  	mbfl_filt_conv_common_ctor,
  	mbfl_filt_conv_common_dtor,
  	mbfl_filt_conv_wchar_2022jpms,
  	mbfl_filt_conv_any_2022jpms_flush
  };
  
  #define CK(statement)	do { if ((statement) < 0) return (-1); } while (0)
  
  #define sjistoidx(c1, c2) \
          (((c1) > 0x9f) \
          ? (((c1) - 0xc1) * 188 + (c2) - (((c2) > 0x7e) ? 0x41 : 0x40)) \
          : (((c1) - 0x81) * 188 + (c2) - (((c2) > 0x7e) ? 0x41 : 0x40)))
  #define idxtojis1(c) (((c) / 94) + 0x21)
  #define idxtojis2(c) (((c) % 94) + 0x21)
  
  /*
   * ISO-2022-JP-MS => wchar
   */
  int
  mbfl_filt_conv_2022jpms_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 0xa0:	 UDC */
  	case 0:
  		if (c == 0x1b) {
  			filter->status += 2;
  		} 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 == 0xa0) && c > 0x20 && c < 0x80) {		/* 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 0xa1:	 UDC second char */
  	case 1:
  		w = 0;
  		filter->status &= ~0xf;
  		c1 = filter->cache;
  		if (c > 0x20 && c < 0x7f) {
  			s = (c1 - 0x21)*94 + c - 0x21;
  			if (filter->status == 0x80) {
  				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) {
  						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 {
  						w = 0;
  					}
  				}
  				if (w <= 0) {
  					w = (c1 << 8) | c;
  					w &= MBFL_WCSPLANE_MASK;
  					w |= MBFL_WCSPLANE_JIS0208;
  				}
  				CK((*filter->output_function)(w, filter->data));
  			} else {
  				if (c1 > 0x20 && c1 < 0x35) {
  					w = 0xe000 + (c1 - 0x21)*94 + c - 0x21;
  				}
  				if (w <= 0) {
  					w = (((c1 - 0x21) + 0x7f) << 8) | c;
  					w &= MBFL_WCSPLANE_MASK;
  					w |= MBFL_WCSPLANE_JIS0208;
  				}
  				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 0xa2:	*/
  	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 0xa3:	*/
  	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 0xa4:	*/
  	case 4:
  		if (c == 0x40 || c == 0x42) {	/* '@' or 'B' */
  			filter->status = 0x80;
  		} else if (c == 0x3f) {			/* '?' */
  			filter->status = 0xa0;
  		} 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 0xa5:	*/
  	case 5:
  		if (c == 0x42) {		/* 'B' */
  			filter->status = 0;
  		} else if (c == 0x4a) {		/* 'J' */
  			filter->status = 0;
  		} 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;
  }
  
  static int
  cp932ext3_cp932ext2_jis(int c)
  {
  	int idx;
  
  	idx = sjistoidx(0xfa, 0x40) + c;
  	if (idx >= sjistoidx(0xfa, 0x5c))
  		idx -=  sjistoidx(0xfa, 0x5c) - sjistoidx(0xed, 0x40);
  	else if (idx >= sjistoidx(0xfa, 0x55))
  		idx -=  sjistoidx(0xfa, 0x55) - sjistoidx(0xee, 0xfa);
  	else if (idx >= sjistoidx(0xfa, 0x40))
  		idx -=  sjistoidx(0xfa, 0x40) - sjistoidx(0xee, 0xef);
  	return idxtojis1(idx) << 8 | idxtojis2(idx);
  }
  
  /*
   * wchar => ISO-2022-JP-MS
   */
  int
  mbfl_filt_conv_wchar_2022jpms(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;
  	}
  	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 >= 0xa1a1 && 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 = cp932ext3_cp932ext2_jis(c1);
  					break;
  				}
  				c1++;
  			}
  		}
  		if (c == 0) {
  			s1 = 0;
  		} else if (s1 <= 0) {
  			s1 = -1;
  		}
  	}
  	if (s1 >= 0) {
  		if (s1 < 0x80) { /* 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' */
  			}
  			CK((*filter->output_function)(s1, filter->data));
  			filter->status = 0;
  		} else if (s1 > 0xa0 && s1 < 0xe0) { /* 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)(s1 & 0x7f, filter->data));
  		} else if (s1 < 0x7e7f) { /* 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)((s1 >> 8) & 0xff, filter->data));
  			CK((*filter->output_function)(s1 & 0x7f, filter->data));
  		} else if (s1 < 0x927f) { /* UDC */
  			if ((filter->status & 0xff00) != 0x800) {
  				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)(0x3f, filter->data));		/* '?' */
  			}
  			filter->status = 0x800;
  			CK((*filter->output_function)(((s1 >> 8) - 0x5e) & 0x7f, filter->data));
  			CK((*filter->output_function)(s1 & 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_2022jpms_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_2022jpms(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 0xa0:	 X UDC */
  	case 0:
  		if (c == 0x1b) {
  			filter->status += 2;
  		} else if ((filter->status == 0x80 || filter->status == 0xa0) && c > 0x20 && c < 0x80) {		/* 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 0xa1:	 UDC 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 == 0x3f) {		/* '?' */
  			filter->status = 0xa0;
  		} 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 = 0;
  		} 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;
  }
  
  
  
  1.1                  libmbfl/filters/mbfilter_iso2022_jp_ms.h
  
  Index: mbfilter_iso2022_jp_ms.h
  ===================================================================
  /*
   * "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 <moriy****@php*****> on 4 dec 2002.
   * 
   */
  
  #ifndef MBFL_MBFILTER_ISO2022_JP_MS_H
  #define MBFL_MBFILTER_ISO2022_JP_MS_H
  
  #include "mbfilter.h"
  
  extern const mbfl_encoding mbfl_encoding_2022jpms;
  extern const struct mbfl_identify_vtbl vtbl_identify_2022jpms;
  extern const struct mbfl_convert_vtbl vtbl_2022jpms_wchar;
  extern const struct mbfl_convert_vtbl vtbl_wchar_2022jpms;
   
  int mbfl_filt_conv_2022jpms_wchar(int c, mbfl_convert_filter *filter);
  int mbfl_filt_conv_wchar_2022jpms(int c, mbfl_convert_filter *filter);
  int mbfl_filt_conv_any_2022jpms_flush(mbfl_convert_filter *filter);
  
  #endif /* MBFL_MBFILTER_ISO2022_JP_MS_H */
  
  
  
  1.4       +2 -1      libmbfl/mbfl/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /cvsroot/php-i18n/libmbfl/mbfl/.cvsignore,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- .cvsignore	29 Jun 2004 12:10:56 -0000	1.3
  +++ .cvsignore	11 Aug 2007 05:38:28 -0000	1.4
  @@ -3,8 +3,9 @@
   EastAsianWidth.txt
   .deps
   .libs
  -*.obj
   *.la
   *.a
   *.o
   *.lo
  +*.gcda
  +*.gcno
  
  
  
  1.13      +1 -0      libmbfl/mbfl/mbfl_convert.c
  
  Index: mbfl_convert.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/libmbfl/mbfl/mbfl_convert.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- mbfl_convert.c	2 Nov 2006 23:58:30 -0000	1.12
  +++ mbfl_convert.c	11 Aug 2007 05:38:28 -0000	1.13
  @@ -53,6 +53,7 @@
   #include "filters/mbfilter_sjis.h"
   #include "filters/mbfilter_cp51932.h"
   #include "filters/mbfilter_jis.h"
  +#include "filters/mbfilter_iso2022_jp_ms.h"
   #include "filters/mbfilter_euc_jp.h"
   #include "filters/mbfilter_euc_jp_win.h"
   #include "filters/mbfilter_ascii.h"
  
  
  
  1.11      +1 -0      libmbfl/mbfl/mbfl_encoding.c
  
  Index: mbfl_encoding.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/libmbfl/mbfl/mbfl_encoding.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- mbfl_encoding.c	2 Nov 2006 23:58:30 -0000	1.10
  +++ mbfl_encoding.c	11 Aug 2007 05:38:28 -0000	1.11
  @@ -59,6 +59,7 @@
   #include "filters/mbfilter_sjis.h"
   #include "filters/mbfilter_cp51932.h"
   #include "filters/mbfilter_jis.h"
  +#include "filters/mbfilter_iso2022_jp_ms.h"
   #include "filters/mbfilter_euc_jp.h"
   #include "filters/mbfilter_euc_jp_win.h"
   #include "filters/mbfilter_ascii.h"
  
  
  
  1.13      +3 -0      libmbfl/mbfl/mbfl_ident.c
  
  Index: mbfl_ident.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/libmbfl/mbfl/mbfl_ident.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- mbfl_ident.c	2 Nov 2006 23:58:30 -0000	1.12
  +++ mbfl_ident.c	11 Aug 2007 05:38:28 -0000	1.13
  @@ -51,6 +51,7 @@
   #include "filters/mbfilter_iso2022_kr.h"
   #include "filters/mbfilter_sjis.h"
   #include "filters/mbfilter_jis.h"
  +#include "filters/mbfilter_iso2022_jp_ms.h"
   #include "filters/mbfilter_euc_jp.h"
   #include "filters/mbfilter_euc_jp_win.h"
   #include "filters/mbfilter_ascii.h"
  @@ -60,6 +61,7 @@
   #include "filters/mbfilter_cp936.h"
   #include "filters/mbfilter_cp1251.h"
   #include "filters/mbfilter_cp1252.h"
  +#include "filters/mbfilter_cp51932.h"
   #include "filters/mbfilter_iso8859_1.h"
   #include "filters/mbfilter_iso8859_2.h"
   #include "filters/mbfilter_iso8859_3.h"
  @@ -107,6 +109,7 @@
   	&vtbl_identify_jis,
   	&vtbl_identify_2022jp,
   	&vtbl_identify_2022jpms,
  +	&vtbl_identify_cp51932,
   	&vtbl_identify_euccn,
   	&vtbl_identify_cp936,
   	&vtbl_identify_hz,
  
  
  




php-i18n-commits メーリングリストの案内
アーカイブの一覧に戻る