ruby-changes:35971
From: duerst <ko1@a...>
Date: Mon, 20 Oct 2014 19:06:32 +0900 (JST)
Subject: [ruby-changes:35971] duerst:r48052 (trunk): lib/unicode_normalize.rb: revert r48046. The s in sIndex
duerst 2014-10-20 19:06:11 +0900 (Mon, 20 Oct 2014) New Revision: 48052 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48052 Log: lib/unicode_normalize.rb: revert r48046. The s in sIndex is not hungarian notation. The variable name sIndex is directly taken from the relevant part of the Unicode Standard, where it is written SIndex and stands for 'syllable index'. See pp. 144/145 of http://www.unicode.org/versions/Unicode7.0.0/ch03.pdf. Modified files: trunk/ChangeLog trunk/lib/unicode_normalize/normalize.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 48051) +++ ChangeLog (revision 48052) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Oct 20 19:06:06 2014 Martin Duerst <duerst@i...> + + * lib/unicode_normalize.rb: revert r48046. The s in sIndex + is not hungarian notation. The variable name sIndex is + directly taken from the relevant part of the Unicode + Standard, where it is written SIndex and stands for + 'syllable index'. See pp. 144/145 of + http://www.unicode.org/versions/Unicode7.0.0/ch03.pdf. + Mon Oct 20 12:46:46 2014 Martin Duerst <duerst@i...> * lib/unicode_normalize.rb: removing unnecessary 'self'. Index: lib/unicode_normalize/normalize.rb =================================================================== --- lib/unicode_normalize/normalize.rb (revision 48051) +++ lib/unicode_normalize/normalize.rb (revision 48052) @@ -43,11 +43,11 @@ module UnicodeNormalize https://github.com/ruby/ruby/blob/trunk/lib/unicode_normalize/normalize.rb#L43 ## Hangul Algorithm def self.hangul_decomp_one(target) - index = target.ord - SBASE - return target if index < 0 || index >= SCOUNT - l = LBASE + index / NCOUNT - v = VBASE + (index % NCOUNT) / TCOUNT - t = TBASE + index % TCOUNT + sIndex = target.ord - SBASE + return target if sIndex < 0 || sIndex >= SCOUNT + l = LBASE + sIndex / NCOUNT + v = VBASE + (sIndex % NCOUNT) / TCOUNT + t = TBASE + sIndex % TCOUNT (t==TBASE ? [l, v] : [l, v, t]).pack('U*') + target[1..-1] end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/