Moriyoshi Koizumi
moriy****@users*****
2005年 2月 21日 (月) 08:08:48 JST
moriyoshi 05/02/21 08:08:47 Modified: filters Tag: LIBMBFL_1_0 mk_sb_tbl.awk mbfl Tag: LIBMBFL_1_0 mk_eaw_tbl.awk Log: - Make awk scripts compatible with GNU awk. Revision Changes Path No revision No revision 1.1.2.2 +26 -3 libmbfl/filters/Attic/mk_sb_tbl.awk Index: mk_sb_tbl.awk =================================================================== RCS file: /cvsroot/php-i18n/libmbfl/filters/Attic/mk_sb_tbl.awk,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- mk_sb_tbl.awk 20 Feb 2005 17:48:42 -0000 1.1.2.1 +++ mk_sb_tbl.awk 20 Feb 2005 23:08:47 -0000 1.1.2.2 @@ -1,10 +1,33 @@ #!/usr/bin/awk -f # -# $Id: mk_sb_tbl.awk,v 1.1.2.1 2005/02/20 17:48:42 moriyoshi Exp $ +# $Id: mk_sb_tbl.awk,v 1.1.2.2 2005/02/20 23:08:47 moriyoshi Exp $ # # Description: a script that generates a single byte code set to Unicode # mapping table. # + +function conv(str) { + if (!match(str, "^0[xX]")) { + return 0 + str + } + + retval = 0 + + for (i = 3; i <= length(str); i++) { + n = index("0123456789abcdefABCDEF", substr(str, i, 1)) - 1 + + if (n < 0) { + return 0 + str; + } else if (n >= 16) { + n -= 6; + } + + retval = retval * 16 + n + } + + return retval +} + BEGIN { FS="[ \t#]" } @@ -14,7 +37,7 @@ } { - tbl[$1 + 0] = $2 + tbl[conv($1)] = conv($2) } END { @@ -30,7 +53,7 @@ if (i != 256) { printf(",\n"); } else { - print + print "" break; } } No revision No revision 1.1.2.2 +26 -4 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.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- mk_eaw_tbl.awk 29 Jun 2004 12:13:37 -0000 1.1.2.1 +++ mk_eaw_tbl.awk 20 Feb 2005 23:08:47 -0000 1.1.2.2 @@ -1,10 +1,32 @@ #!/usr/bin/awk -f # -# $Id: mk_eaw_tbl.awk,v 1.1.2.1 2004/06/29 12:13:37 moriyoshi Exp $ +# $Id: mk_eaw_tbl.awk,v 1.1.2.2 2005/02/20 23:08:47 moriyoshi Exp $ # # Description: a script to generate east asian width table. # +function conv(str) { + if (!match(str, "^0[xX]")) { + return 0 + str + } + + retval = 0 + + for (i = 3; i <= length(str); i++) { + n = index("0123456789abcdefABCDEF", substr(str, i, 1)) - 1 + + if (n < 0) { + return 0 + str; + } else if (n >= 16) { + n -= 6; + } + + retval = retval * 16 + n + } + + return retval +} + BEGIN { prev = -1 comma = 0 @@ -18,7 +40,7 @@ /^[0-9a-fA-F]+;/ { if ($2 == "W" || $2 == "F") { - v = ( "0x" $1 ) + 0 + v = conv("0x" $1) if (prev < 0) { first = v } else if (v - prev > 1) { @@ -44,8 +66,8 @@ /^[0-9a-fA-F]+\.\./ { if ($4 == "W" || $4 == "F") { - vs = ( "0x" $1 ) + 0 - ve = ( "0x" $3 ) + 0 + vs = conv("0x" $1) + ve = conv("0x" $3) if (prev < 0) { first = vs } else if (vs - prev > 1) {