Moriyoshi Koizumi
moriy****@sourc*****
2004年 6月 29日 (火) 21:13:37 JST
moriyoshi 04/06/29 21:13:37 Modified: . Tag: LIBMBFL_1_0 configure.in mbfl Tag: LIBMBFL_1_0 .cvsignore Makefile.am mbfilter.c Added: mbfl Tag: LIBMBFL_1_0 eaw_table.h mk_eaw_tbl.awk Log: - MFH (configure.in: 1.13, .cvsignore: 1.3, Makefile.am: 1.15, mbfilter.c: 1.28, eaw_table.h: 1.1, mk_eaw_tbl.awk: 1.1) Revision Changes Path No revision No revision 1.2.2.8 +6 -0 libmbfl/configure.in Index: configure.in =================================================================== RCS file: /cvsroot/php-i18n/libmbfl/configure.in,v retrieving revision 1.2.2.7 retrieving revision 1.2.2.8 diff -u -r1.2.2.7 -r1.2.2.8 --- configure.in 4 Feb 2004 07:59:58 -0000 1.2.2.7 +++ configure.in 29 Jun 2004 12:13:37 -0000 1.2.2.8 @@ -28,5 +28,11 @@ AC_FUNC_REALLOC AC_CHECK_FUNCS([strcasecmp strchr]) +AC_CHECK_PROGS([FETCH_VIA_FTP], [wget curl ncftpget]) + +if test "$FETCH_VIA_FTP" = "curl"; then + FETCH_VIA_FTP="curl -O" +fi + AC_CONFIG_FILES([Makefile mbfl/Makefile filters/Makefile nls/Makefile]) AC_OUTPUT No revision No revision 1.1.1.1.2.1 +1 -0 libmbfl/mbfl/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/libmbfl/mbfl/.cvsignore,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -r1.1.1.1 -r1.1.1.1.2.1 --- .cvsignore 7 Dec 2002 19:20:44 -0000 1.1.1.1 +++ .cvsignore 29 Jun 2004 12:13:37 -0000 1.1.1.1.2.1 @@ -1,5 +1,6 @@ Makefile Makefile.in +EastAsianWidth.txt .deps .libs *.la 1.8.2.4 +10 -2 libmbfl/mbfl/Makefile.am Index: Makefile.am =================================================================== RCS file: /cvsroot/php-i18n/libmbfl/mbfl/Makefile.am,v retrieving revision 1.8.2.3 retrieving revision 1.8.2.4 diff -u -r1.8.2.3 -r1.8.2.4 --- Makefile.am 4 Feb 2004 04:55:20 -0000 1.8.2.3 +++ Makefile.am 29 Jun 2004 12:13:37 -0000 1.8.2.4 @@ -1,6 +1,6 @@ -EXTRA_DIST=Makefile.bcc32 +EXTRA_DIST=Makefile.bcc32 mk_eaw_tbl.awk lib_LTLIBRARIES=libmbfl.la -libmbfl_la_SOURCES=mbfilter.c mbfl_string.c mbfl_language.c mbfl_encoding.c mbfl_convert.c mbfl_ident.c mbfl_memory_device.c mbfl_allocators.c mbfl_filter_output.c mbfilter_pass.c mbfilter_wchar.c mbfilter_8bit.c +libmbfl_la_SOURCES=mbfilter.c mbfl_string.c mbfl_language.c mbfl_encoding.c mbfl_convert.c mbfl_ident.c mbfl_memory_device.c mbfl_allocators.c mbfl_filter_output.c mbfilter_pass.c mbfilter_wchar.c mbfilter_8bit.c eaw_table.h libmbfl_filters_la=../filters/libmbfl_filters.la libmbfl_nls_la=../nls/libmbfl_nls.la libmbfl_la_LIBADD=$(libmbfl_filters_la) $(libmbfl_nls_la) @@ -8,6 +8,14 @@ libmbfl_includedir=$(includedir)/mbfl libmbfl_include_HEADERS=mbfilter.h mbfl_consts.h mbfl_encoding.h mbfl_language.h mbfl_string.h mbfl_convert.h mbfl_ident.h mbfl_memory_device.h mbfl_allocators.h mbfl_defs.h mbfl_filter_output.h mbfilter_pass.h mbfilter_wchar.h mbfilter_8bit.h +mbfilter.c: eaw_table.h + +eaw_table.h: mk_eaw_tbl.awk + $(AWK) -v TABLE_NAME=mbfl_eaw_table -f mk_eaw_tbl.awk EastAsianWidth.txt > $@ + +EastAsianWidth.txt: + $(FETCH_VIA_FTP) ftp://ftp.unicode.org/Public/UNIDATA/EastAsianWidth.txt + $(libmbfl_filters_la): $(MAKE) -C `dirname $(libmbfl_filters_la)` 1.8.2.10 +19 -7 libmbfl/mbfl/mbfilter.c Index: mbfilter.c =================================================================== RCS file: /cvsroot/php-i18n/libmbfl/mbfl/mbfilter.c,v retrieving revision 1.8.2.9 retrieving revision 1.8.2.10 diff -u -r1.8.2.9 -r1.8.2.10 --- mbfilter.c 4 Feb 2004 07:18:45 -0000 1.8.2.9 +++ mbfilter.c 29 Jun 2004 12:13:37 -0000 1.8.2.10 @@ -103,6 +103,8 @@ #include "mbfl_filter_output.h" #include "mbfilter_pass.h" +#include "eaw_table.h" + /* hex character table "0123456789ABCDEF" */ static char mbfl_hexchar_table[] = { 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46 @@ -1346,17 +1348,27 @@ /* * strwidth */ -static int -filter_count_width(int c, void* data) +static int is_fullwidth(int c) { - if (c >= 0x20) { - if (c < 0x2000 || (c > 0xff60 && c < 0xffa0)) { - (*(int *)data)++; - } else { - (*(int *)data) += 2; + int i; + + if (c < mbfl_eaw_table[0].begin) { + return 0; + } + + for (i = 0; i < sizeof(mbfl_eaw_table) / sizeof(mbfl_eaw_table[0]); i++) { + if (mbfl_eaw_table[i].begin <= c && c <= mbfl_eaw_table[i].end) { + return 1; } } + return 0; +} + +static int +filter_count_width(int c, void* data) +{ + (*(int *)data) += (is_fullwidth(c) ? 2: 1); return c; } No revision No revision 1.1.2.1 +31 -1 libmbfl/mbfl/eaw_table.h Index: eaw_table.h =================================================================== RCS file: /cvsroot/php-i18n/libmbfl/mbfl/eaw_table.h,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 --- eaw_table.h 29 Jun 2004 12:10:56 -0000 1.1 +++ eaw_table.h 29 Jun 2004 12:13:37 -0000 1.1.2.1 @@ -2,5 +2,35 @@ int begin; int end; } mbfl_eaw_table[] = { - + { 0x1100, 0x1159 }, + { 0x115f, 0x115f }, + { 0x2329, 0x232a }, + { 0x2e80, 0x2e99 }, + { 0x2e9b, 0x2ef3 }, + { 0x2f00, 0x2fd5 }, + { 0x2ff0, 0x2ffb }, + { 0x3000, 0x303e }, + { 0x3041, 0x3096 }, + { 0x3099, 0x30ff }, + { 0x3105, 0x312c }, + { 0x3131, 0x318e }, + { 0x3190, 0x31b7 }, + { 0x31f0, 0x321e }, + { 0x3220, 0x3243 }, + { 0x3250, 0x327d }, + { 0x327f, 0x32fe }, + { 0x3300, 0x4db5 }, + { 0x4e00, 0x9fa5 }, + { 0xa000, 0xa48c }, + { 0xa490, 0xa4c6 }, + { 0xac00, 0xd7a3 }, + { 0xf900, 0xfa2d }, + { 0xfa30, 0xfa6a }, + { 0xfe30, 0xfe52 }, + { 0xfe54, 0xfe66 }, + { 0xfe68, 0xfe6b }, + { 0xff01, 0xff60 }, + { 0xffe0, 0xffe6 }, + { 0x20000, 0x2fffd }, + { 0x30000, 0x3fffd } }; 1.1.2.1 +0 -0 libmbfl/mbfl/mk_eaw_tbl.awk Index: mk_eaw_tbl.awk =================================================================== RCS file: /cvsroot/php-i18n/libmbfl/mbfl/mk_eaw_tbl.awk,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 --- mk_eaw_tbl.awk 29 Jun 2004 12:10:56 -0000 1.1 +++ mk_eaw_tbl.awk 29 Jun 2004 12:13:37 -0000 1.1.2.1 @@ -1,6 +1,6 @@ #!/usr/bin/awk -f # -# $Id: mk_eaw_tbl.awk,v 1.1 2004/06/29 12:10:56 moriyoshi Exp $ +# $Id: mk_eaw_tbl.awk,v 1.1.2.1 2004/06/29 12:13:37 moriyoshi Exp $ # # Description: a script to generate east asian width table. #