ICU-11773 Withdraw COLON as pattern char, leave support for UDAT_TIME_SEPARATOR_FIELD (C)

X-SVN-Rev: 37898
This commit is contained in:
Peter Edberg 2015-09-07 22:39:49 +00:00
parent 8fb97395f8
commit 49d4ab5ee6
6 changed files with 111 additions and 18 deletions

View File

@ -21,9 +21,9 @@
milestone - if the release note is a milestone release
-->
<body>
<!-- <body class="rc"> -->
<body class="milestone">
<!-- <body class="milestone"> -->
<body class="rc">
<!-- <body> -->
<p class="only-draft"><b>Note:</b> This is a draft readme.</p>
<h1>
@ -31,7 +31,7 @@
International Components for Unicode<br/>
<span class="only-rc">Release Candidate</span>
<span class="only-milestone">(Milestone Release)</span>
<abbr title="International Components for Unicode">ICU</abbr> 56m1 ReadMe
<abbr title="International Components for Unicode">ICU</abbr> 56 ReadMe
</h1>
<!-- Shouldn't need to comment/uncomment this paragraph, just change the body class -->
@ -43,7 +43,7 @@
<p class="note only-rc">This is a release candidate version of ICU4C.
It is not recommended for production use.</p>
<p>Last updated: 2015-Jul-16<br />
<p>Last updated: 2015-Sep-07<br />
Copyright &copy; 1997-2015 International Business Machines Corporation and
others. All Rights Reserved.</p>
<!-- Remember that there is a copyright at the end too -->
@ -237,14 +237,26 @@
list of APIs added, removed, or changed in this release.</p>
<!-- ICU 56 items -->
<h3>COLON withdrawn as date/time pattern character</h3>
<p>In ICU 55, COLON was introduced as a date/time pattern character
to be replaced by the value of the timeSeparator for the number
system being used; a corresponding new UDateFormatField
UDAT_TIME_SEPARATOR_FIELD was added. Use of COLON caused some
backwards compatibility problems, so it is being withdrawn as a
pattern character. However, UDAT_TIME_SEPARATOR_FIELD remains
as does the mechanism for replacing a pattern character with the
value of the timeSeparator; a new pattern character may be
assigned in the future.</p>
<h3>ICU Plugins: disabled by default</h3>
<p>ICU Plugins are now disabled by default. They may be enabled
with the configure option
<tt>--enable-plugins</tt> or by means of
<tt>#define UCONFIG_ENABLE_PLUGINS</tt>.
</p>
<!-- ICU 55 items -->
<h3>Layout Engine: breaking API change</h3>
<h3>ICU 55: Layout Engine breaking API change</h3>
<p>The LayoutEngine (already deprecated) has had the function
<tt>LEFontInstance::getFontTable(LETag, size_t &amp;length)</tt>
since ICU 52. Its implementation was optional. In ICU 55, this
@ -258,7 +270,7 @@
made secure. See <tt>LEFontInstance</tt> api docs for more detail.
</p>
<h3>Deprecations in PluralRules (plurrule.h)</h3>
<h3>ICU 55: Deprecations in PluralRules (plurrule.h)</h3>
<p>The following PluralRules methods never had an implementation
but were inadvertently marked @stable; they have now been
deprecated. [#<a href="http://bugs.icu-project.org/trac/ticket/10759">10759</a>]</p>
@ -267,9 +279,9 @@
<li><tt>int32_t icu::PluralRules::getAllKeywordValues(const UnicodeString&amp;, double*, int32_t, UErrorCode&amp;)</tt></li>
</ul>
<h3>Deprecate uidna.h functions for IDNA2003 support</h3>
<h3>ICU 55: Deprecate uidna.h functions for IDNA2003 support</h3>
<p>The IDNA2003 API has been deprecated; use the API for IDNA2008 / UTS #46 instead via
uidna_openUTS46() or class IDNA [#<a href="http://bugs.icu-project.org/trac/ticket/v">8477</a>].
uidna_openUTS46() or class IDNA [#<a href="http://bugs.icu-project.org/trac/ticket/8477">8477</a>].
This applies to the following:</p>
<ul>
<li><tt>enum value UIDNA_ALLOW_UNASSIGNED</tt></li>
@ -281,7 +293,7 @@
</ul>
<!-- ICU 54 items -->
<h3>Deprecation (in ICU 54): Layout Engine</h3>
<h3>ICU 54: Deprecation of Layout Engine</h3>
<p>The LayoutEngine is now deprecated. Please
see <a href='http://userguide.icu-project.org/layoutengine'>the
User's Guide</a> for more details and migration recommendations.
@ -295,17 +307,18 @@
instead of ICU as the layout engine. See <a href="http://userguide.icu-project.org/layoutengine">
the users' guide</a> for more information about how to build.
</p>
<h3>Deprecation (in ICU 54): Collation Short Strings</h3>
<h3>ICU 54: Deprecation of Collation Short Strings</h3>
<p>The collation short naming scheme and its API functions are deprecated.
Use ucol_open() with language tag collation keywords instead (see <a href="http://userguide.icu-project.org/collation/api">Collation API Details</a>). For example, <code>ucol_open("de-u-co-phonebk-ka-shifted", &amp;errorCode)</code>
for German Phonebook order with "ignore punctuation" mode.</p>
<h3>Deprecation (in ICU 54): UCOL_TAILORINGS_VERSION</h3>
<h3>ICU 54: Deprecation of UCOL_TAILORINGS_VERSION</h3>
<p>This was originally intended to be the version of collation tailorings,
but that information is actually in the tailorings data and this
constant has always been (and now will continue to be) 1.</p>
<h3>Deprecation (in ICU 53): TimeUnitFormat</h3>
<!-- ICU 53 items -->
<h3>ICU 53: Deprecation of TimeUnitFormat</h3>
<p>The TimeUnitFormat and its methods were actually deprecated in ICU 53 and the
class as a whole was tagged as deprecated in that release, but the status tags for
the individual methods did not correctly indicate the deprecated status; they
@ -318,7 +331,7 @@
For more news about this release, as well as late-breaking news, see the
<a href="http://site.icu-project.org/download/54">ICU download page</a>.</p>
<!-- end ICU 54 items -->
<!-- end of What's New items -->
<h2><a name="Download" href="#Download" id="Download">How To Download the
Source Code</a></h2>

View File

@ -51,18 +51,30 @@
* resource data.
*/
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
#define PATTERN_CHARS_LEN 36
#else
#define PATTERN_CHARS_LEN 35
#endif
/**
* Unlocalized date-time pattern characters. For example: 'y', 'd', etc. All
* locales use the same these unlocalized pattern characters.
*/
static const UChar gPatternChars[] = {
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
// GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxr:
#else
// GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxr
#endif
0x47, 0x79, 0x4D, 0x64, 0x6B, 0x48, 0x6D, 0x73, 0x53, 0x45,
0x44, 0x46, 0x77, 0x57, 0x61, 0x68, 0x4B, 0x7A, 0x59, 0x65,
0x75, 0x67, 0x41, 0x5A, 0x76, 0x63, 0x4c, 0x51, 0x71, 0x56,
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
0x55, 0x4F, 0x58, 0x78, 0x72, 0x3a, 0
#else
0x55, 0x4F, 0x58, 0x78, 0x72, 0
#endif
};
/* length of an array */

View File

@ -209,7 +209,11 @@ static const int32_t gFieldRangeBias[] = {
-1, // 'X' - UDAT_TIMEZONE_ISO_FIELD
-1, // 'x' - UDAT_TIMEZONE_ISO_LOCAL_FIELD
-1, // 'r' - UDAT_RELATED_YEAR_FIELD
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
-1, // ':' - UDAT_TIME_SEPARATOR_FIELD
#else
-1, // (no pattern character currently) - UDAT_TIME_SEPARATOR_FIELD
#endif
};
// When calendar uses hebr numbering (i.e. he@calendar=hebrew),
@ -1088,8 +1092,13 @@ int32_t SimpleDateFormat::getLevelFromChar(UChar ch) {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
// ! " # $ % & ' ( ) * + , - . /
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
// 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1,
#else
// 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
#endif
// @ A B C D E F G H I J K L M N O
-1, 40, -1, -1, 20, 30, 30, 0, 50, -1, -1, 50, 20, 20, -1, 0,
// P Q R S T U V W X Y Z [ \ ] ^ _
@ -1119,8 +1128,13 @@ UBool SimpleDateFormat::isSyntaxChar(UChar ch) {
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
// 0 1 2 3 4 5 6 7
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
// 8 9 : ; < = > ?
FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE,
#else
// 8 9 : ; < = > ?
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
#endif
// @ A B C D E F G
FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
// H I J K L M N O
@ -1164,7 +1178,11 @@ SimpleDateFormat::fgPatternIndexToCalendarField[] =
/*O*/ UCAL_ZONE_OFFSET,
/*Xx*/ UCAL_ZONE_OFFSET, UCAL_ZONE_OFFSET,
/*r*/ UCAL_EXTENDED_YEAR,
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
/*:*/ UCAL_FIELD_COUNT, /* => no useful mapping to any calendar field */
#else
/*no pattern char for UDAT_TIME_SEPARATOR_FIELD*/ UCAL_FIELD_COUNT, /* => no useful mapping to any calendar field */
#endif
};
// Map index into pattern character string to DateFormat field number
@ -1188,7 +1206,11 @@ SimpleDateFormat::fgPatternIndexToDateFormatField[] = {
/*O*/ UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD,
/*Xx*/ UDAT_TIMEZONE_ISO_FIELD, UDAT_TIMEZONE_ISO_LOCAL_FIELD,
/*r*/ UDAT_RELATED_YEAR_FIELD,
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
/*:*/ UDAT_TIME_SEPARATOR_FIELD,
#else
/*no pattern char for UDAT_TIME_SEPARATOR_FIELD*/ UDAT_TIME_SEPARATOR_FIELD,
#endif
};
//----------------------------------------------------------------------
@ -1628,7 +1650,8 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
}
break;
// for ":", write out the time separator string
// if we see pattern character for UDAT_TIME_SEPARATOR_FIELD (none currently defined),
// write out the time separator string. Leave support in for future definition.
case UDAT_TIME_SEPARATOR_FIELD:
{
UnicodeString separator;
@ -3240,7 +3263,9 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
}
return -start;
}
case UDAT_TIME_SEPARATOR_FIELD: // ':'
// currently no pattern character is defined for UDAT_TIME_SEPARATOR_FIELD
// so we shoul dnot get here. Leave support in for future definition.
case UDAT_TIME_SEPARATOR_FIELD: //
{
static const UChar def_sep = DateFormatSymbols::DEFAULT_TIME_SEPARATOR;
static const UChar alt_sep = DateFormatSymbols::ALTERNATE_TIME_SEPARATOR;

View File

@ -763,8 +763,9 @@ typedef enum UDateFormatField {
#ifndef U_HIDE_DRAFT_API
/**
* FieldPosition and UFieldPosition selector for ':' time separator,
* no corresponding UCAL_ field.
* FieldPosition and UFieldPosition selector for time separator,
* no corresponding UCAL_ field. No pattern character is currently
* defined for this.
* @draft ICU 55
*/
UDAT_TIME_SEPARATOR_FIELD = 35,
@ -783,6 +784,16 @@ typedef enum UDateFormatField {
} UDateFormatField;
#ifndef U_HIDE_INTERNAL_API
/**
* Is a pattern character defined for UDAT_TIME_SEPARATOR_FIELD?
* In ICU 55 it was COLON, but that was withdrawn in ICU 56.
* @internal ICU 56
*/
#define UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR 0
#endif /* U_HIDE_INTERNAL_API */
/**
* Maps from a UDateFormatField to the corresponding UCalendarDateFields.
* Note: since the mapping is many-to-one, there is no inverse mapping.

View File

@ -678,7 +678,11 @@ static void TestSymbols()
VerifygetSymbols(zhChiCal, UDAT_CYCLIC_YEARS_NARROW, 59, "\\u7678\\u4EA5");
VerifygetSymbols(zhChiCal, UDAT_ZODIAC_NAMES_ABBREVIATED, 0, "\\u9F20");
VerifygetSymbols(zhChiCal, UDAT_ZODIAC_NAMES_WIDE, 11, "\\u732A");
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
VerifygetSymbols(def,UDAT_LOCALIZED_CHARS, 0, "GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxr:");
#else
VerifygetSymbols(def,UDAT_LOCALIZED_CHARS, 0, "GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxr");
#endif
if(result != NULL) {
@ -1756,9 +1760,13 @@ static const FieldsData expectedFields[] = {
{ UDAT_DATE_FIELD /* 3*/, 20, 22 },
{ UDAT_YEAR_FIELD /* 1*/, 24, 28 },
{ UDAT_HOUR1_FIELD /*15*/, 32, 33 },
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
{ UDAT_TIME_SEPARATOR_FIELD /*35*/, 33, 34 },
#endif
{ UDAT_MINUTE_FIELD /* 6*/, 34, 36 },
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
{ UDAT_TIME_SEPARATOR_FIELD /*35*/, 36, 37 },
#endif
{ UDAT_SECOND_FIELD /* 7*/, 37, 39 },
{ UDAT_AM_PM_FIELD /*14*/, 40, 42 },
{ UDAT_TIMEZONE_FIELD /*17*/, 43, 46 },

View File

@ -433,7 +433,11 @@ DateFormatTest::escape(UnicodeString& s)
/**
* This MUST be kept in sync with DateFormatSymbols.gPatternChars.
*/
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
static const char* PATTERN_CHARS = "GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxr:";
#else
static const char* PATTERN_CHARS = "GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxr";
#endif
/**
* A list of the names of all the fields in DateFormat.
@ -501,7 +505,11 @@ void DateFormatTest::TestFieldPosition() {
assertEquals("patternChars", PATTERN_CHARS, rootSyms.getLocalPatternChars(buf));
assertEquals("patternChars", PATTERN_CHARS, DateFormatSymbols::getPatternUChars());
assertTrue("DATEFORMAT_FIELD_NAMES", DATEFORMAT_FIELD_NAMES_LENGTH == UDAT_FIELD_COUNT);
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
assertTrue("Data", UDAT_FIELD_COUNT == uprv_strlen(PATTERN_CHARS));
#else
// assertTrue("Data", UDAT_FIELD_COUNT == uprv_strlen(PATTERN_CHARS)); // test invalid if no pattern char for UDAT_TIME_SEPARATOR_FIELD
#endif
// Create test formatters
const int32_t COUNT = 4;
@ -531,22 +539,38 @@ void DateFormatTest::TestFieldPosition() {
"", "1997", "August", "13", "", "", "34", "12", "", "Wednesday",
"", "", "", "", "PM", "2", "", "Pacific Daylight Time", "", "",
"", "", "", "", "", "", "", "", "", "",
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
"", "", "", "", "", ":",
#else
"", "", "", "", "", "",
#endif
"", "1997", "ao\\u00FBt", "13", "", "14", "34", "12", "", "mercredi",
"", "", "", "", "", "", "", "heure d\\u2019\\u00E9t\\u00E9 du Pacifique", "", "",
"", "", "", "", "", "", "", "", "", "",
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
"", "", "", "", "", ":",
#else
"", "", "", "", "", "",
#endif
"AD", "1997", "8", "13", "14", "14", "34", "12", "5", "Wed",
"225", "2", "33", "3", "PM", "2", "2", "PDT", "1997", "4",
"1997", "2450674", "52452513", "-0700", "PT", "4", "8", "3", "3", "uslax",
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
"1997", "GMT-7", "-07", "-07", "1997", ":",
#else
"1997", "GMT-7", "-07", "-07", "1997", "",
#endif
"Anno Domini", "1997", "August", "0013", "0014", "0014", "0034", "0012", "5130", "Wednesday",
"0225", "0002", "0033", "0003", "PM", "0002", "0002", "Pacific Daylight Time", "1997", "Wednesday",
"1997", "2450674", "52452513", "GMT-07:00", "Pacific Time", "Wednesday", "August", "3rd quarter", "3rd quarter", "Los Angeles Time",
#if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
"1997", "GMT-07:00", "-0700", "-0700", "1997", ":",
#else
"1997", "GMT-07:00", "-0700", "-0700", "1997", "",
#endif
};
const int32_t EXPECTED_LENGTH = sizeof(EXPECTED)/sizeof(EXPECTED[0]);