ICU-6098 4.0 pre-d04 merges: r24317 r24318 r24319
X-SVN-Rev: 24320
diff --git a/readme.html b/readme.html
index b8e3099..ad07731 100644
--- a/readme.html
+++ b/readme.html
@@ -30,9 +30,9 @@
<body>
<h1>International Components for Unicode<br />
- <abbr title="International Components for Unicode">ICU</abbr> 4.0 (draft d04) ReadMe</h1>
+ <abbr title="International Components for Unicode">ICU</abbr> 4.0 ReadMe</h1>
- <p>Version: 2008 June 25th<br />
+ <p>Version: 2008 June 30th<br />
Copyright © 1997-2008 International Business Machines Corporation and
others. All Rights Reserved.</p>
<!-- Remember that there is a copyright at the end too -->
diff --git a/source/Doxyfile.in b/source/Doxyfile.in
index 4bb29f4..b4c72c5 100644
--- a/source/Doxyfile.in
+++ b/source/Doxyfile.in
@@ -67,6 +67,12 @@
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
+
+# docset
+GENERATE_DOCSET = NO
+DOCSET_FEEDNAME = "ICU @VERSION@"
+DOCSET_BUNDLE_ID = org.icu-project.icu4c
+
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
diff --git a/source/common/unicode/ustring.h b/source/common/unicode/ustring.h
index 0636b38..12411ef 100644
--- a/source/common/unicode/ustring.h
+++ b/source/common/unicode/ustring.h
@@ -71,6 +71,11 @@
*/
/**
+ * \defgroup ustring_ustrlen String Length
+ * \ingroup ustring_strlen
+ */
+/*@{*/
+/**
* Determine the length of an array of UChar.
*
* @param s The array of UChars, NULL (U+0000) terminated.
@@ -79,6 +84,7 @@
*/
U_STABLE int32_t U_EXPORT2
u_strlen(const UChar *s);
+/*@}*/
/**
* Count Unicode code points in the length UChar code units of the string.
diff --git a/source/i18n/dtptngen.cpp b/source/i18n/dtptngen.cpp
index 21a1c2b..dce7762 100644
--- a/source/i18n/dtptngen.cpp
+++ b/source/i18n/dtptngen.cpp
@@ -36,8 +36,91 @@
#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
+#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+/**
+ * If we are on EBCDIC, use an iterator which will
+ * traverse the bundles in ASCII order.
+ */
+#define U_USE_ASCII_BUNDLE_ITERATOR
+#define U_SORT_ASCII_BUNDLE_ITERATOR
+#endif
+
+#if defined(U_USE_ASCII_BUNDLE_ITERATOR)
+
+#include "unicode/ustring.h"
+#include "uarrsort.h"
+
+struct UResAEntry {
+ UChar *key;
+ UResourceBundle *item;
+};
+
+struct UResourceBundleAIterator {
+ UResourceBundle *bund;
+ UResAEntry *entries;
+ int32_t num;
+ int32_t cursor;
+};
+
+static int32_t U_CALLCONV
+ures_a_codepointSort(const void *context, const void *left, const void *right) {
+ //CompareContext *cmp=(CompareContext *)context;
+ return u_strcmp(((const UResAEntry *)left)->key,
+ ((const UResAEntry *)right)->key);
+}
+
+
+static void ures_a_open(UResourceBundleAIterator *aiter, UResourceBundle *bund, UErrorCode *status) {
+ if(U_FAILURE(*status)) {
+ return;
+ }
+ aiter->bund = bund;
+ aiter->num = ures_getSize(aiter->bund);
+ aiter->cursor = 0;
+#if !defined(U_SORT_ASCII_BUNDLE_ITERATOR)
+ aiter->entries = NULL;
+#else
+ aiter->entries = (UResAEntry*)uprv_malloc(sizeof(UResAEntry)*aiter->num);
+ for(int i=0;i<aiter->num;i++) {
+ aiter->entries[i].item = ures_getByIndex(aiter->bund, i, NULL, status);
+ const char *akey = ures_getKey(aiter->entries[i].item);
+ int32_t len = uprv_strlen(akey)+1;
+ aiter->entries[i].key = (UChar*)uprv_malloc(len*sizeof(UChar));
+ u_charsToUChars(akey, aiter->entries[i].key, len);
+ }
+ uprv_sortArray(aiter->entries, aiter->num, sizeof(UResAEntry), ures_a_codepointSort, NULL, TRUE, status);
+#endif
+}
+
+static void ures_a_close(UResourceBundleAIterator *aiter) {
+#if defined(U_SORT_ASCII_BUNDLE_ITERATOR)
+ for(int i=0;i<aiter->num;i++) {
+ uprv_free(aiter->entries[i].key);
+ ures_close(aiter->entries[i].item);
+ }
+#endif
+}
+
+static const UChar *ures_a_getNextString(UResourceBundleAIterator *aiter, int32_t *len, const char **key, UErrorCode *err) {
+#if !defined(U_SORT_ASCII_BUNDLE_ITERATOR)
+ return ures_getNextString(aiter->bund, len, key, err);
+#else
+ if(U_FAILURE(*err)) return NULL;
+ UResourceBundle *item = aiter->entries[aiter->cursor].item;
+ const UChar* ret = ures_getString(item, len, err);
+ *key = ures_getKey(item);
+ aiter->cursor++;
+ return ret;
+#endif
+}
+
+
+#endif
+
+
U_NAMESPACE_BEGIN
+
// *****************************************************************************
// class DateTimePatternGenerator
// *****************************************************************************
@@ -108,7 +191,7 @@
static const char* const CLDR_FIELD_NAME[] = {
"era", "year", "quarter", "month", "week", "*", "weekday", "day", "*", "*", "dayperiod",
"hour", "minute", "second", "*", "zone"
-};
+};
static const char* const Resource_Fields[] = {
"day", "dayperiod", "era", "hour", "minute", "month", "second", "week",
@@ -472,7 +555,7 @@
patBundle = ures_getByKeyWithFallback(fBundle, Resource_Fields[i], NULL, &err);
fieldBundle = ures_getByKeyWithFallback(patBundle, "dn", NULL, &err);
rbPattern = ures_getNextUnicodeString(fieldBundle, &key, &err);
- ures_close(fieldBundle);
+ ures_close(fieldBundle);
ures_close(patBundle);
if (rbPattern.length()==0 ) {
continue;
@@ -492,13 +575,24 @@
int32_t len;
const UChar *retPattern;
key=NULL;
+#if defined(U_USE_ASCII_BUNDLE_ITERATOR)
+ UResourceBundleAIterator aiter;
+ ures_a_open(&aiter, patBundle, &err);
+#endif
for(i=0; i<numberKeys; ++i) {
+#if defined(U_USE_ASCII_BUNDLE_ITERATOR)
+ retPattern=ures_a_getNextString(&aiter, &len, &key, &err);
+#else
retPattern=ures_getNextString(patBundle, &len, &key, &err);
+#endif
UnicodeString format=UnicodeString(retPattern);
UnicodeString retKey=UnicodeString(key, -1, US_INV);
setAvailableFormat(retKey, err);
conflictingStatus = addPattern(format, FALSE, conflictingPattern, err);
}
+#if defined(U_USE_ASCII_BUNDLE_ITERATOR)
+ ures_a_close(&aiter);
+#endif
}
ures_close(patBundle);
ures_close(gregorianBundle);
@@ -520,9 +614,16 @@
int32_t len;
const UChar *retPattern;
key=NULL;
-
+#if defined(U_USE_ASCII_BUNDLE_ITERATOR)
+ UResourceBundleAIterator aiter;
+ ures_a_open(&aiter, patBundle, &err);
+#endif
for(i=0; i<numberKeys; ++i) {
+#if defined(U_USE_ASCII_BUNDLE_ITERATOR)
+ retPattern=ures_a_getNextString(&aiter, &len, &key, &err);
+#else
retPattern=ures_getNextString(patBundle, &len, &key, &err);
+#endif
UnicodeString format=UnicodeString(retPattern);
UnicodeString retKey=UnicodeString(key, -1, US_INV);
if ( !isAvailableFormatSet(retKey) ) {
@@ -530,6 +631,9 @@
conflictingStatus = addPattern(format, FALSE, conflictingPattern, err);
}
}
+#if defined(U_USE_ASCII_BUNDLE_ITERATOR)
+ ures_a_close(&aiter);
+#endif
}
ures_close(patBundle);
ures_close(gregorianBundle);
diff --git a/source/i18n/unicode/decimfmt.h b/source/i18n/unicode/decimfmt.h
index 296906f..1671432 100644
--- a/source/i18n/unicode/decimfmt.h
+++ b/source/i18n/unicode/decimfmt.h
@@ -1,6 +1,6 @@
/*
********************************************************************************
-* Copyright (C) 1997-2006, International Business Machines
+* Copyright (C) 1997-2008, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -1185,10 +1185,7 @@
* @see #setPadCharacter
* @see #getPadCharacterString
* @see #setPadPosition
- * @see #kPadBeforePrefix
- * @see #kPadAfterPrefix
- * @see #kPadBeforeSuffix
- * @see #kPadAfterSuffix
+ * @see #EPadPosition
* @stable ICU 2.0
*/
virtual EPadPosition getPadPosition(void) const;
@@ -1206,10 +1203,7 @@
* @see #setPadCharacter
* @see #getPadCharacterString
* @see #getPadPosition
- * @see #kPadBeforePrefix
- * @see #kPadAfterPrefix
- * @see #kPadBeforeSuffix
- * @see #kPadAfterSuffix
+ * @see #EPadPosition
* @stable ICU 2.0
*/
virtual void setPadPosition(EPadPosition padPos);
diff --git a/source/i18n/unicode/dtitvfmt.h b/source/i18n/unicode/dtitvfmt.h
index 78512c2..2384437 100644
--- a/source/i18n/unicode/dtitvfmt.h
+++ b/source/i18n/unicode/dtitvfmt.h
@@ -89,7 +89,6 @@
* the field pattern length is ignored and the best match, which is defined
* in date time patterns, will be returned without honor the field pattern
* letter length in skeleton.
- * </ol>
*
* <P>
* The calendar fields we support for interval formatting are:
diff --git a/source/i18n/unicode/msgfmt.h b/source/i18n/unicode/msgfmt.h
index cbc6c03..67e17cf 100644
--- a/source/i18n/unicode/msgfmt.h
+++ b/source/i18n/unicode/msgfmt.h
@@ -511,6 +511,7 @@
* nor should the ponter of other object . The pointer and its
* contents remain valid only until the next call to any method
* of this class is made with this object.
+ * @param formatName the name or number specifying a format
* @param status output param set to success/failure code.
* @draft ICU 4.0
*/
diff --git a/source/i18n/unicode/tblcoll.h b/source/i18n/unicode/tblcoll.h
index cf5a81a..2fdd63b 100644
--- a/source/i18n/unicode/tblcoll.h
+++ b/source/i18n/unicode/tblcoll.h
@@ -804,6 +804,7 @@
* Used internally by registraton to define the requested and valid locales.
* @param requestedLocale the requsted locale
* @param validLocale the valid locale
+ * @param actualLocale the actual locale
* @internal
*/
virtual void setLocales(const Locale& requestedLocale, const Locale& validLocale, const Locale& actualLocale);
diff --git a/source/test/intltest/dtptngts.cpp b/source/test/intltest/dtptngts.cpp
index 66733f2..61555b1 100644
--- a/source/test/intltest/dtptngts.cpp
+++ b/source/test/intltest/dtptngts.cpp
@@ -71,8 +71,8 @@
UnicodeString("11:58 PM"),
UnicodeString("23:58"),
UnicodeString("58:59"),
- UnicodeString("1999-1"), // zh_Hans_CN
- UnicodeString("1999-01"),
+ UnicodeString("1999-1", -1, US_INV), // zh_Hans_CN
+ UnicodeString("1999-01", -1, US_INV),
CharsToUnicodeString("1999\\u5E741\\u670813\\u65E5"),
CharsToUnicodeString("1999\\u5E7401\\u670813\\u65E5"),
UnicodeString("1-13"),
@@ -240,13 +240,13 @@
UnicodeString dateReturned, expectedResult;
dateReturned.remove();
dateReturned = format->format(sampleDate, dateReturned, status);
- expectedResult=UnicodeString("14. Okt 8:58");
+ expectedResult=UnicodeString("14. Okt 8:58", -1, US_INV);
if ( dateReturned != expectedResult ) {
errln("ERROR: Simple test in getBestPattern with Locale::getGermany()).");
}
// add new pattern
status = U_ZERO_ERROR;
- conflictingStatus = gen->addPattern(UnicodeString("d'. von' MMMM"), true, conflictingPattern, status);
+ conflictingStatus = gen->addPattern(UnicodeString("d'. von' MMMM", -1, US_INV), true, conflictingPattern, status);
if (U_FAILURE(status)) {
errln("ERROR: Could not addPattern - d\'. von\' MMMM");
}
@@ -256,7 +256,7 @@
format->applyPattern(gen->getBestPattern(UnicodeString("MMMMddHmm"), status));
dateReturned.remove();
dateReturned = format->format(sampleDate, dateReturned, status);
- expectedResult=UnicodeString("14. von Oktober 8:58");
+ expectedResult=UnicodeString("14. von Oktober 8:58", -1, US_INV);
if ( dateReturned != expectedResult ) {
errln("ERROR: Simple test addPattern failed!: d\'. von\' MMMM ");
}
@@ -374,7 +374,7 @@
}
{ // Trac# 6104
Locale loc("zh");
- UnicodeString expR = UnicodeString("1999-01");
+ UnicodeString expR = UnicodeString("1999-01", -1, US_INV);
UDate testDate1= LocaleTest::date(99, 0, 13, 23, 58, 59);
DateTimePatternGenerator *patGen=DateTimePatternGenerator::createInstance(loc, status);
if(U_FAILURE(status)) {
diff --git a/source/test/intltest/plurfmts.cpp b/source/test/intltest/plurfmts.cpp
index 92514d2..1998403 100644
--- a/source/test/intltest/plurfmts.cpp
+++ b/source/test/intltest/plurfmts.cpp
@@ -448,11 +448,11 @@
}
else {
status = U_ZERO_ERROR;
- UnicodeString plResult = plFmt.format(0, status); // retrun ONE
+ UnicodeString plResult = plFmt.format(0.0, status); // retrun ONE
plResult = plFmt.format(0.5, status); // retrun ONE
- plResult = plFmt.format(1, status); // retrun ONE
+ plResult = plFmt.format(1.0, status); // retrun ONE
plResult = plFmt.format(1.9, status); // retrun ONE
- plResult = plFmt.format(2, status); // retrun OTHER
+ plResult = plFmt.format(2.0, status); // retrun OTHER
}
}
diff --git a/source/test/intltest/rbbitst.cpp b/source/test/intltest/rbbitst.cpp
index c5f751b..4d27b75 100644
--- a/source/test/intltest/rbbitst.cpp
+++ b/source/test/intltest/rbbitst.cpp
@@ -1996,6 +1996,8 @@
}
strcpy(testFileName, testDataDirectory);
strcat(testFileName, fileName);
+
+ logln("Opening data file %s\n", fileName);
int len;
UChar *testFile = ReadAndConvertFile(testFileName, len, "UTF-8", status);
diff --git a/source/test/intltest/regextst.cpp b/source/test/intltest/regextst.cpp
index ba38906..cdc9e78 100644
--- a/source/test/intltest/regextst.cpp
+++ b/source/test/intltest/regextst.cpp
@@ -874,7 +874,7 @@
//
{
UErrorCode status = U_ZERO_ERROR;
- UnicodeString testString(1000000, 0x41, 1000000); // Length 1,000,000, filled with 'A'
+ UnicodeString testString(600000, 0x41, 600000); // Length 600,000, filled with 'A'
// Adding the capturing parentheses to the pattern "(A)+A$" inhibits optimizations
// of the '+', and makes the stack frames larger.
diff --git a/source/test/testdata/GraphemeBreakTest.txt b/source/test/testdata/GraphemeBreakTest.txt
index e0b5a25..ab30253 100644
--- a/source/test/testdata/GraphemeBreakTest.txt
+++ b/source/test/testdata/GraphemeBreakTest.txt
@@ -1,4 +1,4 @@
-# GraphemeBreakTest-5.1.0.txt
+# GraphemeBreakTest-5.1.0.txt
# Date: 2008-03-11, 02:19:22 GMT [MD]
#
# Unicode Character Database
diff --git a/source/test/testdata/LineBreakTest.txt b/source/test/testdata/LineBreakTest.txt
index 1c939ce..fb8cb5b 100644
--- a/source/test/testdata/LineBreakTest.txt
+++ b/source/test/testdata/LineBreakTest.txt
@@ -1,4 +1,4 @@
-# LineBreakTest-5.1.0.txt
+# LineBreakTest-5.1.0.txt
# Date: 2008-03-11, 02:19:24 GMT [MD]
#
# Unicode Character Database
diff --git a/source/test/testdata/SentenceBreakTest.txt b/source/test/testdata/SentenceBreakTest.txt
index 676303a..df8fcad 100644
--- a/source/test/testdata/SentenceBreakTest.txt
+++ b/source/test/testdata/SentenceBreakTest.txt
@@ -1,4 +1,4 @@
-# SentenceBreakTest-5.1.0.txt
+# SentenceBreakTest-5.1.0.txt
# Date: 2008-03-11, 02:19:26 GMT [MD]
#
# Unicode Character Database
diff --git a/source/test/testdata/WordBreakTest.txt b/source/test/testdata/WordBreakTest.txt
index 39c595c..5acb540 100644
--- a/source/test/testdata/WordBreakTest.txt
+++ b/source/test/testdata/WordBreakTest.txt
@@ -1,4 +1,4 @@
-# WordBreakTest-5.1.0.txt
+# WordBreakTest-5.1.0.txt
# Date: 2008-03-11, 02:19:28 GMT [MD]
#
# Unicode Character Database
diff --git a/source/test/testdata/rbbitst.txt b/source/test/testdata/rbbitst.txt
index a06ee84..af947df 100644
--- a/source/test/testdata/rbbitst.txt
+++ b/source/test/testdata/rbbitst.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2001-2008 International Business Machines
+# Copyright (c) 2001-2008 International Business Machines
# Corporation and others. All Rights Reserved.
#
# RBBI Test Data