ruby-changes:41691
From: duerst <ko1@a...>
Date: Sun, 7 Feb 2016 14:12:38 +0900 (JST)
Subject: [ruby-changes:41691] duerst:r53765 (trunk): * enc/unicode/case-folding.rb: Fixing parameter passing.
duerst 2016-02-07 14:12:44 +0900 (Sun, 07 Feb 2016) New Revision: 53765 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53765 Log: * enc/unicode/case-folding.rb: Fixing parameter passing. (with Kimihito Matsui) Modified files: trunk/ChangeLog trunk/enc/unicode/case-folding.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 53764) +++ ChangeLog (revision 53765) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Feb 7 14:12:32 2016 Martin Duerst <duerst@i...> + + * enc/unicode/case-folding.rb: Fixing parameter passing. + (with Kimihito Matsui) + Sun Feb 7 11:44:03 2016 Martin Duerst <duerst@i...> * enc/unicode/case-folding.rb: New classes CaseMapping/CaseMappingDummy Index: enc/unicode/case-folding.rb =================================================================== --- enc/unicode/case-folding.rb (revision 53764) +++ enc/unicode/case-folding.rb (revision 53765) @@ -15,21 +15,21 @@ class CaseFolding https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L15 v.map {|i| "0x%04x" % i}.join(", ") end - def print_table_1(dest, data) + def print_table_1(dest, mapping_data, data) for k, v in data = data.sort sk = (Array === k and k.length > 1) ? "{#{hex_seq(k)}}" : ("0x%04x" % k) - dest.print(" {#{sk}, {#{v.length}, {#{hex_seq(v)}}}},\n") + dest.print(" {#{sk}, {#{v.length}#{mapping_data.flags(k)}, {#{hex_seq(v)}}}},\n") end data end - def print_table(dest, type, data) + def print_table(dest, type, mapping_data, data) dest.print("static const #{type}_Type #{type}_Table[] = {\n") i = 0 ret = data.inject([]) do |a, (n, d)| dest.print("#define #{n} (*(#{type}_Type (*)[#{d.size}])(#{type}_Table+#{i}))\n") i += d.size - a.concat(print_table_1(dest, d)) + a.concat(print_table_1(dest, mapping_data, d)) end dest.print("};\n\n") ret @@ -85,7 +85,7 @@ class CaseFolding https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L85 "#{code} <= MAX_CODE_VALUE && #{code} >= MIN_CODE_VALUE" end - def lookup_hash(key, type, data, mapping_data) + def lookup_hash(key, type, data) hash = "onigenc_unicode_#{key}_hash" lookup = "onigenc_unicode_#{key}_lookup" arity = Array(data[0][0]).size @@ -149,25 +149,25 @@ class CaseFolding https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L149 # CaseFold + CaseFold_Locale name = "CaseFold_11" - data = print_table(dest, name, "CaseFold"=>fold, "CaseFold_Locale"=>fold_locale) - dest.print lookup_hash(name, "CodePointList3", data, mapping_data) + data = print_table(dest, name, mapping_data, "CaseFold"=>fold, "CaseFold_Locale"=>fold_locale) + dest.print lookup_hash(name, "CodePointList3", data) # print unfolding data # CaseUnfold_11 + CaseUnfold_11_Locale name = "CaseUnfold_11" - data = print_table(dest, name, name=>unfold[0], "#{name}_Locale"=>unfold_locale[0]) - dest.print lookup_hash(name, "CodePointList3", data, mapping_data) + data = print_table(dest, name, mapping_data, name=>unfold[0], "#{name}_Locale"=>unfold_locale[0]) + dest.print lookup_hash(name, "CodePointList3", data) # CaseUnfold_12 + CaseUnfold_12_Locale name = "CaseUnfold_12" - data = print_table(dest, name, name=>unfold[1], "#{name}_Locale"=>unfold_locale[1]) - dest.print lookup_hash(name, "CodePointList2", data, mapping_data) + data = print_table(dest, name, mapping_data, name=>unfold[1], "#{name}_Locale"=>unfold_locale[1]) + dest.print lookup_hash(name, "CodePointList2", data) # CaseUnfold_13 name = "CaseUnfold_13" - data = print_table(dest, name, name=>unfold[2]) - dest.print lookup_hash(name, "CodePointList2", data, mapping_data) + data = print_table(dest, name, mapping_data, name=>unfold[2]) + dest.print lookup_hash(name, "CodePointList2", data) end def self.load(*args) @@ -179,7 +179,7 @@ class CaseMapping https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L179 def initialize (mapping_directory) end - def mapping_flags(from) + def flags(from) "" # preliminary implementation end @@ -189,7 +189,7 @@ class CaseMapping https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L189 end class CaseMappingDummy - def mapping_flags(from) + def flags(from) "" end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/