summaryrefslogtreecommitdiff
path: root/enc/unicode/case-folding.rb
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-25 10:04:59 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-25 10:04:59 +0000
commit7feb182a08fb3f2a3a9e693f20947818de9a38cc (patch)
treed0c0cad08f7a7d73c8031c70c4735ed045eb34bf /enc/unicode/case-folding.rb
parent92e0377ed4b6f2b890c1939bf7648a0dc3df790d (diff)
* enc/unicode/case-folding.rb: Adding possibility for debugging output
for TitleCase table in casefold.h. (with Kimihito Matsui) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc/unicode/case-folding.rb')
-rwxr-xr-xenc/unicode/case-folding.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/enc/unicode/case-folding.rb b/enc/unicode/case-folding.rb
index 174808afaa..dfb5f47314 100755
--- a/enc/unicode/case-folding.rb
+++ b/enc/unicode/case-folding.rb
@@ -245,11 +245,16 @@ class CaseMapping
flags
end
+ def debug!
+ @debug = true
+ end
+
def titlecase_output
"CodePointList3 TitleCase[] = {\n" +
@titlecase.map do |item|
chars = item.title.split(/ /)
- " {#{chars.length}, {" + chars.map {|c| "0x"+c }.join(', ') + "}},\n"
+ ct = ' /* ' + Array(chars).map{|c|[c.to_i(16)].pack("U*")}.join(", ") + ' */' if @debug
+ " {#{chars.length}, {#{chars.map {|c| "0x"+c }.join(', ')}#{ct}}},\n"
end.join + "};\n"
end
@@ -264,6 +269,7 @@ class CaseMappingDummy
end
def titlecase_output() '' end
+ def debug!() end
end
if $0 == __FILE__
@@ -299,7 +305,10 @@ if $0 == __FILE__
mapping_data ||= CaseMappingDummy.new
data = CaseFolding.load(filename)
- data.debug! if debug
+ if debug
+ data.debug!
+ mapping_data.debug!
+ end
if dest
open(dest, "wb") do |f|
data.display(f, mapping_data)