[前][次][番号順一覧][スレッド一覧]

ruby-changes:43204

From: duerst <ko1@a...>
Date: Sun, 5 Jun 2016 14:47:03 +0900 (JST)
Subject: [ruby-changes:43204] duerst:r55277 (trunk): * string.c: Remove :lithuanian guard for Unicode case mapping.

duerst	2016-06-05 14:46:37 +0900 (Sun, 05 Jun 2016)

  New Revision: 55277

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55277

  Log:
    * string.c: Remove :lithuanian guard for Unicode case mapping.

  Modified files:
    trunk/ChangeLog
    trunk/string.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55276)
+++ ChangeLog	(revision 55277)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Jun  5 14:46:34 2016  Martin Duerst  <duerst@i...>
+
+	* string.c: Remove :lithuanian guard for Unicode case mapping.
+
 Sat Jun  4 10:54:52 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* missing/crypt.h (struct crypt_data): remove unnecessary member
Index: string.c
===================================================================
--- string.c	(revision 55276)
+++ string.c	(revision 55277)
@@ -5869,7 +5869,7 @@ rb_str_upcase_bang(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/string.c#L5869
     enc = STR_ENC_GET(str);
     rb_str_check_dummy_enc(enc);
     s = RSTRING_PTR(str); send = RSTRING_END(str);
-    if (enc==rb_utf8_encoding() && argc>0) { /* :lithuanian can temporarily be used for new functionality without options */
+    if (enc==rb_utf8_encoding()) {
 	str_shared_replace(str, rb_str_casemap(str, &flags, enc));
 	modify = ONIGENC_CASE_MODIFIED & flags;
     }
@@ -5959,7 +5959,7 @@ rb_str_downcase_bang(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/string.c#L5959
     enc = STR_ENC_GET(str);
     rb_str_check_dummy_enc(enc);
     s = RSTRING_PTR(str); send = RSTRING_END(str);
-    if (enc==rb_utf8_encoding() && argc>0) { /* :lithuanian can temporarily be used for new functionality without options */
+    if (enc==rb_utf8_encoding()) {
 	str_shared_replace(str, rb_str_casemap(str, &flags, enc));
 	modify = ONIGENC_CASE_MODIFIED & flags;
     }
@@ -6018,11 +6018,13 @@ rb_str_downcase_bang(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/string.c#L6018
  *  The meaning of the +options+ is as follows:
  *
  *  No option ::
- *    Currently, old behavior (only the ASCII region, i.e. characters
- *    ``A'' to ``Z'', and/or ``a'' to ``z'', are affected).
- *    This will change very soon to full Unicode case mapping.
+ *    Full Unicode case mapping, suitable for most languages
+ *    (see :turkic and :lithuanian options below for exceptions).
+ *    Context-dependent case mapping as described in Table 3-14 of the
+ *    Unicode standard is currently not supported.
  *  :ascii ::
- *    Only the ASCII region, i.e. the characters ``A'' to ``Z'', are affected.
+ *    Only the ASCII region, i.e. the characters ``A'' to ``Z'' and
+ *    ``a'' to ``z'', are affected.
  *    This option cannot be combined with any other option.
  *  :turkic ::
  *    Full Unicode case mapping, adapted for Turkic languages
@@ -6031,21 +6033,23 @@ rb_str_downcase_bang(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/string.c#L6033
  *  :lithuanian ::
  *    Currently, just full Unicode case mapping. In the future, full Unicode
  *    case mapping adapted for Lithuanian (keeping the dot on the lower case
- *    i even if there's an accent on top).
+ *    i even if there is an accent on top).
  *  :fold ::
- *    Only available on +downcase+ and +downcase!+. Unicode case folding, which
- *    is more far-reaching than Unicode case mapping. This option currently
- *    cannot be combined with any other option (i.e. we do not currenty
- *    implement a variant for turkic languages).
+ *    Only available on +downcase+ and +downcase!+. Unicode case <b>folding</b>,
+ *    which is more far-reaching than Unicode case mapping.
+ *    This option currently cannot be combined with any other option
+ *    (i.e. there is currenty no variant for turkic languages).
  *
  *  Please note that several assumptions that are valid for ASCII-only case
  *  conversions do not hold for more general case conversions. For example,
  *  the length of the result may not be the same as the length of the input
- *  (neither in characters nor in bytes), and some roundtrip assumptions
- *  (e.g. str.downcase == str.downcase.upcase.downcase) may not apply.
+ *  (neither in characters nor in bytes), some roundtrip assumptions
+ *  (e.g. str.downcase == str.upcase.downcase) may not apply, and Unicode
+ *  normalization (i.e. String#unicode_normalize) is not necessarily maintained
+ *  by case mapping operations.
  *
- *  Non-ASCII case mapping/folding is currently only supported for UTF-8 Strings,
- *  but this support will be extended to other encodings in the future.
+ *  Non-ASCII case mapping/folding is currently only supported for UTF-8
+ *  Strings/Symbols, but this support will be extended to other encodings.
  *
  *     "hEllO".downcase   #=> "hello"
  */
@@ -6090,7 +6094,7 @@ rb_str_capitalize_bang(int argc, VALUE * https://github.com/ruby/ruby/blob/trunk/string.c#L6094
     enc = STR_ENC_GET(str);
     rb_str_check_dummy_enc(enc);
     if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return Qnil;
-    if (enc==rb_utf8_encoding() && argc>0) { /* :lithuanian can temporarily be used for new functionality without options */
+    if (enc==rb_utf8_encoding()) {
 	str_shared_replace(str, rb_str_casemap(str, &flags, enc));
 	modify = ONIGENC_CASE_MODIFIED & flags;
     }
@@ -6166,7 +6170,7 @@ rb_str_swapcase_bang(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/string.c#L6170
     enc = STR_ENC_GET(str);
     rb_str_check_dummy_enc(enc);
     s = RSTRING_PTR(str); send = RSTRING_END(str);
-    if (enc==rb_utf8_encoding() && argc>0) { /* :lithuanian can temporarily be used for new functionality without options */
+    if (enc==rb_utf8_encoding()) {
 	str_shared_replace(str, rb_str_casemap(str, &flags, enc));
 	modify = ONIGENC_CASE_MODIFIED & flags;
     }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]