From 756ffef448f1d56a805dad4bda9b11aaf047f6db Mon Sep 17 00:00:00 2001 From: usa Date: Tue, 24 Apr 2012 11:14:18 +0000 Subject: * enc/euc_jp.c: added EUC-JP-2004 and its alias EUC-JISX0213. [ruby-dev:45571] [Feature #6349] Requested by Kyouhei Yanagita . * enc/trans/japanese_euc.trans: ditto. * enc/trans/JIS/JISX0213-[12]%UCS@{BMP,SIP}.src: JIS X 0213:2004 -> Unicode mapping table from NetBSD. * enc/trans/JIS/UCS@{BMP,SIP}%JISX0213-[12].src: Unicode -> JIX X 0213:2004 mapping table from NetBSD. * tool/transcode-tblgen.rb: added SIP support. * test/ruby/test_transcode.rb: tests of above changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/transcode-tblgen.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'tool') diff --git a/tool/transcode-tblgen.rb b/tool/transcode-tblgen.rb index b25901d375..0c5dbd6cea 100755 --- a/tool/transcode-tblgen.rb +++ b/tool/transcode-tblgen.rb @@ -704,14 +704,20 @@ def citrus_decode_mapsrc(ces, csid, mapsrcs) mapsrcs.split(',').each do |mapsrc| path = [$srcdir] mode = nil - if mapsrc.rindex('UCS', 0) + if mapsrc.rindex(/UCS(?:@[A-Z]+)?/, 0) mode = :from_ucs - from = mapsrc[4..-1] + from = mapsrc[$&.size+1..-1] path << SUBDIR.find{|x| from.rindex(x, 0) } else mode = :to_ucs path << SUBDIR.find{|x| mapsrc.rindex(x, 0) } end + if /\bUCS@(BMP|SMP|SIP|TIP|SSP)\b/ =~ mapsrc + plane = {"BMP"=>0, "SMP"=>1, "SIP"=>2, "TIP"=>3, "SSP"=>14}[$1] + else + plane = 0 + end + plane <<= 16 path << mapsrc.gsub(':', '@') path = File.join(*path) path << ".src" @@ -730,14 +736,14 @@ def citrus_decode_mapsrc(ces, csid, mapsrcs) when /0x(\w+)\s*-\s*0x(\w+)\s*=\s*INVALID/ # Citrus OOB_MODE when /(0x\w+)\s*=\s*(0x\w+)/ - table.push << [$1.hex, citrus_cstomb(ces, csid, $2.hex)] + table.push << [plane | $1.hex, citrus_cstomb(ces, csid, $2.hex)] else raise "unknown notation '%s'"% l end when :to_ucs case l when /(0x\w+)\s*=\s*(0x\w+)/ - table.push << [citrus_cstomb(ces, csid, $1.hex), $2.hex] + table.push << [citrus_cstomb(ces, csid, $1.hex), plane | $2.hex] else raise "unknown notation '%s'"% l end @@ -919,6 +925,10 @@ ValidEncoding = { 'CP51932' => '{00-7f} {a1-fe}{a1-fe} 8e{a1-fe}', + 'EUC-JP-2004' => '{00-7f} + {a1-fe}{a1-fe} + 8e{a1-fe} + 8f{a1-fe}{a1-fe}', 'Shift_JIS' => '{00-7f} {81-9f,e0-fc}{40-7e,80-fc} {a1-df}', -- cgit v1.2.3