ICU-4161 remove tabs from source code

X-SVN-Rev: 16829
This commit is contained in:
Andy Heninger 2004-11-11 23:34:58 +00:00
parent 03ad2885e5
commit 665e553354
93 changed files with 1736 additions and 1736 deletions

View File

@ -405,9 +405,9 @@ BreakIterator*
BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
{
if (U_FAILURE(status)) {
return NULL;
}
if (U_FAILURE(status)) {
return NULL;
}
BreakIterator *result = NULL;
switch (kind) {
@ -430,9 +430,9 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
status = U_ILLEGAL_ARGUMENT_ERROR;
}
if (U_FAILURE(status)) {
return NULL;
}
if (U_FAILURE(status)) {
return NULL;
}
return result;
}

View File

@ -220,7 +220,7 @@ T_FileStream_stderr(void)
U_CAPI UBool U_EXPORT2
T_FileStream_remove(const char* fileName){
return (remove(fileName) == 0);
return (remove(fileName) == 0);
}

View File

@ -499,9 +499,9 @@ LocaleKeyFactory::getDisplayName(const UnicodeString& id, const Locale& locale,
UObject*
LocaleKeyFactory::handleCreate(const Locale& /* loc */,
int32_t /* kind */,
const ICUService* /* service */,
UErrorCode& /* status */) const {
int32_t /* kind */,
const ICUService* /* service */,
UErrorCode& /* status */) const {
return NULL;
}
@ -561,7 +561,7 @@ SimpleLocaleKeyFactory::SimpleLocaleKeyFactory(UObject* objToAdopt,
, _id()
, _kind(kind)
{
LocaleUtility::initNameFromLocale(locale, _id);
LocaleUtility::initNameFromLocale(locale, _id);
}
SimpleLocaleKeyFactory::~SimpleLocaleKeyFactory()
@ -763,12 +763,12 @@ ICULocaleService::get(const Locale& locale, int32_t kind, Locale* actualReturn,
URegistryKey
ICULocaleService::registerInstance(UObject* objToAdopt, const UnicodeString& locale,
UBool visible, UErrorCode& status)
UBool visible, UErrorCode& status)
{
Locale loc;
LocaleUtility::initLocaleFromName(locale, loc);
Locale loc;
LocaleUtility::initLocaleFromName(locale, loc);
return registerInstance(objToAdopt, loc, LocaleKey::KIND_ANY,
visible ? LocaleKeyFactory::VISIBLE : LocaleKeyFactory::INVISIBLE, status);
visible ? LocaleKeyFactory::VISIBLE : LocaleKeyFactory::INVISIBLE, status);
}
URegistryKey

View File

@ -261,7 +261,7 @@ protected:
* Return true if this id is one the factory supports (visible or
* otherwise).
*/
virtual UBool isSupportedID(const UnicodeString& id, UErrorCode& status) const;
virtual UBool isSupportedID(const UnicodeString& id, UErrorCode& status) const;
/**
* Return the set of ids that this factory supports (visible or
@ -328,10 +328,10 @@ class U_COMMON_API SimpleLocaleKeyFactory : public LocaleKeyFactory {
void updateVisibleIDs(Hashtable& result, UErrorCode& status) const;
protected:
/**
/**
* Return true if this id is equal to the locale name.
*/
virtual UBool isSupportedID(const UnicodeString& id, UErrorCode& status) const;
virtual UBool isSupportedID(const UnicodeString& id, UErrorCode& status) const;
public:

View File

@ -442,7 +442,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
// The cache has to stay in synch with the factory list.
// ICU doesn't have monitors so we can't use rw locks, so
// we single-thread everything using this service, for now.
// if factory is not null, we're calling from within the mutex,
// and since some unix machines don't have reentrant mutexes we
// need to make sure not to try to lock it again.
@ -573,14 +573,14 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
if (actualReturn->isBogus()) {
status = U_MEMORY_ALLOCATION_ERROR;
delete result;
delete result;
return NULL;
}
}
UObject* service = cloneInstance(result->service);
if (putInCache && !cacheResult) {
delete result;
delete result;
}
return service;
}
@ -695,7 +695,7 @@ ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const
ICUServiceFactory* f = (ICUServiceFactory*)map->get(id);
if (f != NULL) {
f->getDisplayName(id, locale, result);
return result;
return result;
}
// fallback

View File

@ -639,9 +639,9 @@ class U_COMMON_API ICUService : public ICUNotifier {
* the key, until either a factory returns a service object, or the key
* has no fallback. If no object is found, the result of handleDefault
* is returned.</p>
*
* <p>Subclasses can override this method to further customize the
* result before returning it.
*
* <p>Subclasses can override this method to further customize the
* result before returning it.
*
* @param key the key.
* @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL.
@ -654,7 +654,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
* <p>This version of getKey is only called by ICUServiceFactories within the scope
* of a previous getKey call, to determine what previously-registered factories would
* have returned. For details, see getKey(ICUServiceKey&, UErrorCode&). Subclasses
* should not call it directly, but call through one of the other get functions.</p>
* should not call it directly, but call through one of the other get functions.</p>
*
* @param key the key.
* @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL.

View File

@ -360,45 +360,45 @@ ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outD
tableStartOffset = ds->readUInt32(rbbiDH->fFTable);
tableLength = ds->readUInt32(rbbiDH->fFTableLen);
if (tableLength > 0) {
ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
outBytes+tableStartOffset, status);
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
outBytes+tableStartOffset+topSize, status);
}
if (tableLength > 0) {
ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
outBytes+tableStartOffset, status);
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
outBytes+tableStartOffset+topSize, status);
}
// Reverse state table. Same layout as forward table, above.
tableStartOffset = ds->readUInt32(rbbiDH->fRTable);
tableLength = ds->readUInt32(rbbiDH->fRTableLen);
if (tableLength > 0) {
ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
outBytes+tableStartOffset, status);
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
outBytes+tableStartOffset+topSize, status);
}
if (tableLength > 0) {
ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
outBytes+tableStartOffset, status);
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
outBytes+tableStartOffset+topSize, status);
}
// Safe Forward state table. Same layout as forward table, above.
tableStartOffset = ds->readUInt32(rbbiDH->fSFTable);
tableLength = ds->readUInt32(rbbiDH->fSFTableLen);
if (tableLength > 0) {
ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
outBytes+tableStartOffset, status);
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
outBytes+tableStartOffset+topSize, status);
}
if (tableLength > 0) {
ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
outBytes+tableStartOffset, status);
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
outBytes+tableStartOffset+topSize, status);
}
// Safe Reverse state table. Same layout as forward table, above.
tableStartOffset = ds->readUInt32(rbbiDH->fSRTable);
tableLength = ds->readUInt32(rbbiDH->fSRTableLen);
if (tableLength > 0) {
ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
outBytes+tableStartOffset, status);
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
outBytes+tableStartOffset+topSize, status);
}
if (tableLength > 0) {
ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
outBytes+tableStartOffset, status);
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
outBytes+tableStartOffset+topSize, status);
}
// Trie table for character categories
utrie_swap(ds, inBytes+ds->readUInt32(rbbiDH->fTrie), ds->readUInt32(rbbiDH->fTrieLen),

View File

@ -54,7 +54,7 @@ RBBINode::RBBINode(NodeType t) : UMemory() {
fNullable = FALSE;
fLookAheadEnd = FALSE;
fVal = 0;
fPrecedence = precZero;
fPrecedence = precZero;
UErrorCode status = U_ZERO_ERROR;
fFirstPosSet = new UVector(status); // TODO - get a real status from somewhere

View File

@ -608,16 +608,16 @@ ubidi_getRuns(UBiDi *pBiDi) {
ADD_ODD_BIT_FROM_LEVEL(runs[0].logicalStart, levels[runs[0].logicalStart]);
limit=runs[0].visualLimit;
/* this loop will also handle the trailing WS run */
/* this loop will also handle the trailing WS run */
for(i=1; i<runCount; ++i) {
ADD_ODD_BIT_FROM_LEVEL(runs[i].logicalStart, levels[runs[i].logicalStart]);
limit=runs[i].visualLimit+=limit;
}
/* Set the "odd" bit for the trailing WS run. */
/* For a RTL paragraph, it will be the *first* run in visual order. */
/* For a RTL paragraph, it will be the *first* run in visual order. */
if(runIndex<runCount) {
int32_t trailingRun = ((pBiDi->paraLevel & 1) != 0)? 0 : runIndex;
int32_t trailingRun = ((pBiDi->paraLevel & 1) != 0)? 0 : runIndex;
ADD_ODD_BIT_FROM_LEVEL(runs[trailingRun].logicalStart, pBiDi->paraLevel);
}

View File

@ -18,8 +18,8 @@
* Two formats for the table of contents are supported, which is
* why there is an abstract inteface involved.
*
*/
*/
#include "unicode/utypes.h"
#include "unicode/udata.h"
#include "cstring.h"
@ -91,7 +91,7 @@ static uint32_t offsetTOCEntryCount(const UDataMemory *pData) {
const UDataOffsetTOC *toc = (UDataOffsetTOC *)pData->toc;
if (toc != NULL) {
retVal = toc->count;
}
}
return retVal;
}
@ -125,8 +125,8 @@ offsetTOCLookupFn(const UDataMemory *pData,
}
for (;;) {
number = (start+limit)/2;
if (lastNumber == number) { /* Have we moved? */
break; /* We haven't moved, and it wasn't found. */
if (lastNumber == number) { /* Have we moved? */
break; /* We haven't moved, and it wasn't found. */
}
lastNumber = number;
strResult = uprv_strcmp(tocEntryName, base+entry[number].nameOffset);
@ -191,7 +191,7 @@ static const DataHeader *pointerTOCLookupFn(const UDataMemory *pData,
/* perform a binary search for the data in the common data's table of contents */
start=0;
limit=toc->count;
limit=toc->count;
lastNumber=limit;
if (limit == 0) { /* Stub common data library used during build is empty. */
@ -200,8 +200,8 @@ static const DataHeader *pointerTOCLookupFn(const UDataMemory *pData,
for (;;) {
number = (start+limit)/2;
if (lastNumber == number) { /* Have we moved? */
break; /* We haven't moved, and it wasn't found. */
if (lastNumber == number) { /* Have we moved? */
break; /* We haven't moved, and it wasn't found. */
}
lastNumber = number;
strResult = uprv_strcmp(name, toc->entry[number].entryName);

View File

@ -375,9 +375,9 @@ setInitialStateToUnicodeKR(UConverter* converter, UConverterDataISO2022 *myConve
if(myConverterData->version == 1) {
UConverter *cnv = myConverterData->currentConverter;
cnv->toUnicodeStatus=0; /* offset */
cnv->mode=0; /* state */
cnv->toULength=0; /* byteIndex */
cnv->toUnicodeStatus=0; /* offset */
cnv->mode=0; /* state */
cnv->toULength=0; /* byteIndex */
}
}
@ -397,8 +397,8 @@ setInitialStateFromUnicodeKR(UConverter* converter,UConverterDataISO2022 *myConv
if(myConverterData->version == 1) {
UConverter *cnv = myConverterData->currentConverter;
cnv->fromUChar32=0;
cnv->fromUnicodeStatus=1; /* prevLength */
cnv->fromUChar32=0;
cnv->fromUnicodeStatus=1; /* prevLength */
}
}
@ -462,21 +462,21 @@ _ISO2022Open(UConverter *cnv, const char *name, const char *locale,uint32_t opti
myConverterData->currentConverter=
ucnv_open("icu-internal-25546",errorCode);
if (U_FAILURE(*errorCode)) {
_ISO2022Close(cnv);
return;
}
if (U_FAILURE(*errorCode)) {
_ISO2022Close(cnv);
return;
}
uprv_strcpy(myConverterData->name,"ISO_2022,locale=ko,version=1");
uprv_memcpy(cnv->subChar, myConverterData->currentConverter->subChar, 4);
cnv->subCharLen = myConverterData->currentConverter->subCharLen;
uprv_memcpy(cnv->subChar, myConverterData->currentConverter->subChar, 4);
cnv->subCharLen = myConverterData->currentConverter->subCharLen;
}else{
myConverterData->currentConverter=ucnv_open("ibm-949",errorCode);
if (U_FAILURE(*errorCode)) {
_ISO2022Close(cnv);
return;
}
if (U_FAILURE(*errorCode)) {
_ISO2022Close(cnv);
return;
}
myConverterData->version = 0;
uprv_strcpy(myConverterData->name,"ISO_2022,locale=ko,version=0");

View File

@ -1,6 +1,6 @@
/*
********************************************************************
* COPYRIGHT:
* COPYRIGHT:
* Copyright (c) 1996-2004, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************
@ -12,9 +12,9 @@
* uses uconv_io.h routines to access disk information
* is used by ucnv.h to implement public API create/delete/flushCache routines
* Modification History:
*
*
* Date Name Description
*
*
* 06/20/2000 helena OS/400 port changes; mostly typecast.
* 06/29/2000 helena Major rewrite of the callback interface.
*/
@ -246,7 +246,7 @@ ucnv_data_unFlattenClone(UConverterLoadArgs *pArgs, UDataMemory *pData, UErrorCo
#endif
data->staticData = source;
data->sharedDataCached = FALSE;
/* fill in fields from the loaded data */
@ -307,7 +307,7 @@ static UConverterSharedData *createConverterFromFile(UConverterLoadArgs *pArgs,
return sharedData;
}
int32_t
int32_t
ucnv_copyPlatformString(char *platformString, UConverterPlatform pltfrm)
{
switch (pltfrm)
@ -330,7 +330,7 @@ static const UConverterSharedData *
getAlgorithmicTypeFromName(const char *realName)
{
uint32_t mid, start, limit;
uint32_t lastMid;
uint32_t lastMid;
int result;
char strippedName[UCNV_MAX_CONVERTER_NAME_LENGTH];
@ -341,14 +341,14 @@ getAlgorithmicTypeFromName(const char *realName)
start = 0;
limit = sizeof(cnvNameType)/sizeof(cnvNameType[0]);
mid = limit;
lastMid = UINT32_MAX;
lastMid = UINT32_MAX;
for (;;) {
mid = (uint32_t)((start + limit) / 2);
if (lastMid == mid) { /* Have we moved? */
break; /* We haven't moved, and it wasn't found. */
}
lastMid = mid;
if (lastMid == mid) { /* Have we moved? */
break; /* We haven't moved, and it wasn't found. */
}
lastMid = mid;
result = uprv_strcmp(strippedName, cnvNameType[mid].name);
if (result < 0) {
@ -383,7 +383,7 @@ ucnv_shareConverterData(UConverterSharedData * data)
&err);
ucln_common_registerCleanup(UCLN_COMMON_UCNV, ucnv_cleanup);
if (U_FAILURE(err))
if (U_FAILURE(err))
return;
}
@ -397,7 +397,7 @@ ucnv_shareConverterData(UConverterSharedData * data)
}
UCNV_DEBUG_LOG("put:chk",data->staticData->name,sanity);
*/
/* Mark it shared */
data->sharedDataCached = TRUE;
@ -459,7 +459,7 @@ ucnv_deleteSharedConverterData(UConverterSharedData * deadSharedData)
if (deadSharedData->impl->unload != NULL) {
deadSharedData->impl->unload(deadSharedData);
}
if(deadSharedData->dataMemory != NULL)
{
UDataMemory *data = (UDataMemory*)deadSharedData->dataMemory;
@ -544,7 +544,7 @@ ucnv_unload(UConverterSharedData *sharedData) {
if (sharedData->referenceCounter > 0) {
sharedData->referenceCounter--;
}
if((sharedData->referenceCounter <= 0)&&(sharedData->sharedDataCached == FALSE)) {
ucnv_deleteSharedConverterData(sharedData);
}
@ -706,7 +706,7 @@ ucnv_loadSharedData(const char *converterName, UConverterLookupData *lookup, UEr
parseConverterOptions(lookup->realName, lookup->cnvName, lookup->locale, &lookup->options, err);
lookup->realName = lookup->cnvName;
}
/* get the shared data for an algorithmic converter, if it is one */
mySharedConverterData = (UConverterSharedData *)getAlgorithmicTypeFromName(lookup->realName);
if (mySharedConverterData == NULL)
@ -818,7 +818,7 @@ ucnv_createConverterFromPackage(const char *packageName, const char *converterNa
if(U_FAILURE(*err)) {
UTRACE_EXIT_STATUS(*err);
return NULL;
return NULL;
}
UTRACE_DATA2(UTRACE_OPEN_CLOSE, "open converter %s from package %s", converterName, packageName);
@ -835,24 +835,24 @@ ucnv_createConverterFromPackage(const char *packageName, const char *converterNa
return NULL;
}
args.name=cnvName;
/* open the data, unflatten the shared structure */
mySharedConverterData = createConverterFromFile(&args, err);
if (U_FAILURE(*err)) {
UTRACE_EXIT_STATUS(*err);
return NULL;
return NULL;
}
/* create the actual converter */
myUConverter = ucnv_createConverterFromSharedData(NULL, mySharedConverterData, cnvName, locale, args.options, err);
if (U_FAILURE(*err)) {
ucnv_close(myUConverter);
UTRACE_EXIT_STATUS(*err);
return NULL;
return NULL;
}
UTRACE_EXIT_PTR_STATUS(myUConverter, *err);
return myUConverter;
}
@ -959,9 +959,9 @@ ucnv_flushCache ()
if (mySharedData->referenceCounter == 0)
{
tableDeletedNum++;
UCNV_DEBUG_LOG("del",mySharedData->staticData->name,mySharedData);
uhash_removeElement(SHARED_DATA_HASHTABLE, e);
mySharedData->sharedDataCached = FALSE;
ucnv_deleteSharedConverterData (mySharedData);

View File

@ -83,7 +83,7 @@
* an alias mapped to this converter is ambiguous. See UCNV_CONVERTER_INDEX_MASK
* and UCNV_AMBIGUOUS_ALIAS_MAP_BIT for more information. This section is
* the predigested form of the 5th section so that an alias lookup can be fast.
*
*
* 5) This section contains a 2D array with indexes to the 6th section. This
* section is the full form of all alias mappings. The column index is the
* index into the converter list (column header). The row index is the index
@ -139,18 +139,18 @@
* -------------------------------------------.
* T /##########################################/|
* a / # # /#
* g / # ## ## ### # ### ### ### #/
* s / # ##### #### ## ## #/#
* / ### # # ## # # # ### # # #/##
* g / # ## ## ### # ### ### ### #/
* s / # ##### #### ## ## #/#
* / ### # # ## # # # ### # # #/##
* ------------------------------------------/# #
* A |### # # ## # # # ### # # #|# #
* l |# # # # # ## # #|# #
* i |# # # # # # #|#
* a |# #|#
* s | #|#
* e
* s
*
* e
* s
*
*/
/**
@ -403,12 +403,12 @@ ucnv_io_stripEBCDICForCompare(char *dst, const char *name) {
* is case-insensitive. It also ignores the characters '-', '_', and
* ' ' (dash, underscore, and space). Thus the strings "UTF-8",
* "utf_8", and "Utf 8" are exactly equivalent.
*
*
* This is a symmetrical (commutative) operation; order of arguments
* is insignificant. This is an important property for sorting the
* list (when the list is preprocessed into binary form) and for
* performing binary searches on it at run time.
*
*
* @param name1 a converter name or alias, zero-terminated
* @param name2 a converter name or alias, zero-terminated
* @return 0 if the names match, or a negative value if the name1
@ -435,7 +435,7 @@ ucnv_compareNames(const char *name1, const char *name2) {
if ((c1|c2)==0) {
return 0;
}
/* Case-insensitive comparison */
rc = (int)(unsigned char)uprv_tolower(c1) -
(int)(unsigned char)uprv_tolower(c2);
@ -454,21 +454,21 @@ ucnv_compareNames(const char *name1, const char *name2) {
static U_INLINE uint32_t
findConverter(const char *alias, UErrorCode *pErrorCode) {
uint32_t mid, start, limit;
uint32_t lastMid;
uint32_t lastMid;
int result;
/* do a binary search for the alias */
start = 0;
limit = gUntaggedConvArraySize;
mid = limit;
lastMid = UINT32_MAX;
lastMid = UINT32_MAX;
for (;;) {
mid = (uint32_t)((start + limit) / 2);
if (lastMid == mid) { /* Have we moved? */
break; /* We haven't moved, and it wasn't found. */
}
lastMid = mid;
if (lastMid == mid) { /* Have we moved? */
break; /* We haven't moved, and it wasn't found. */
}
lastMid = mid;
result = ucnv_compareNames(alias, GET_STRING(gAliasList[mid]));
if (result < 0) {
@ -494,7 +494,7 @@ findConverter(const char *alias, UErrorCode *pErrorCode) {
* Is this alias in this list?
* alias and listOffset should be non-NULL.
*/
static U_INLINE UBool
static U_INLINE UBool
isAliasInList(const char *alias, uint32_t listOffset) {
if (listOffset) {
uint32_t currAlias;
@ -1027,7 +1027,7 @@ ucnv_io_getDefaultConverterName() {
|| length>=sizeof(gDefaultConverterNameBuffer))
{
/* Panic time, let's use a fallback. */
#if (U_CHARSET_FAMILY == U_ASCII_FAMILY)
#if (U_CHARSET_FAMILY == U_ASCII_FAMILY)
name = "US-ASCII";
/* there is no 'algorithmic' converter for EBCDIC */
#elif defined(OS390)

View File

@ -118,9 +118,9 @@ uenum_nextDefault(UEnumeration* en,
if (en->uNext != NULL) {
char *tempCharVal;
const UChar *tempUCharVal = en->uNext(en, resultLength, status);
if (tempUCharVal == NULL) {
return NULL;
}
if (tempUCharVal == NULL) {
return NULL;
}
tempCharVal = (char*)
_getBuffer(en, (*resultLength+1) * sizeof(char));
if (!tempCharVal) {

View File

@ -153,13 +153,13 @@ static pthread_mutex_t gMutexes[MAX_MUTEXES] = {
*
*-------------------------------------------------------------*/
static void *gMutexes[MAX_MUTEXES] = {
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL };
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL };
/* Unknown platform. OK so long as ICU_USE_THREAD is not set.
Note that user can still set mutex functions at run time,

View File

@ -93,7 +93,7 @@ public:
/**
* Get the next canonically equivalent string.
* <br><b>Warning: The strings are not guaranteed to be in any particular order.</b>
* <br><b>Warning: The strings are not guaranteed to be in any particular order.</b>
* @return the next string that is canonically equivalent. A bogus string is returned when
* the iteration is done.
* @stable ICU 2.4

View File

@ -156,9 +156,9 @@ typedef enum UProperty {
and "String property Age" are read by genpname. */
/* Note: Place UCHAR_ALPHABETIC before UCHAR_BINARY_START so that
debuggers display UCHAR_ALPHABETIC as the symbolic name for 0,
rather than UCHAR_BINARY_START. Likewise for other *_START
identifiers. */
debuggers display UCHAR_ALPHABETIC as the symbolic name for 0,
rather than UCHAR_BINARY_START. Likewise for other *_START
identifiers. */
/** Binary property Alphabetic. Same as u_isUAlphabetic, different from u_isalpha.
Lu+Ll+Lt+Lm+Lo+Nl+Other_Alphabetic @stable ICU 2.1 */

View File

@ -41,7 +41,7 @@ uset_close(USet* set) {
U_CAPI void U_EXPORT2
uset_set(USet* set,
UChar32 start, UChar32 end) {
UChar32 start, UChar32 end) {
((UnicodeSet*) set)->set(start, end);
}

View File

@ -96,7 +96,7 @@ uset_applyPattern(USet *set,
U_CAPI void U_EXPORT2
uset_applyIntPropertyValue(USet* set,
UProperty prop, int32_t value, UErrorCode* ec) {
UProperty prop, int32_t value, UErrorCode* ec) {
((UnicodeSet*) set)->applyIntPropertyValue(prop, value, *ec);
}
@ -104,7 +104,7 @@ U_CAPI void U_EXPORT2
uset_applyPropertyAlias(USet* set,
const UChar *prop, int32_t propLength,
const UChar *value, int32_t valueLength,
UErrorCode* ec) {
UErrorCode* ec) {
UnicodeString p(prop, propLength);
UnicodeString v(value, valueLength);

View File

@ -77,7 +77,7 @@ U_NAMESPACE_BEGIN
* @deprecated ICU 2.4. This class may be removed or modified.
*/
#define SIDEREAL_DAY (23.93446960027)
/**
* The number of sidereal hours in one mean solar day.
* Approximately 24.07.
@ -85,7 +85,7 @@ U_NAMESPACE_BEGIN
* @deprecated ICU 2.4. This class may be removed or modified.
*/
#define SOLAR_DAY (24.065709816)
/**
* The average number of solar days from one new moon to the next. This is the time
* it takes for the moon to return the same ecliptic longitude as the sun.
@ -98,7 +98,7 @@ U_NAMESPACE_BEGIN
* @deprecated ICU 2.4. This class may be removed or modified.
*/
const double CalendarAstronomer::SYNODIC_MONTH = 29.530588853;
/**
* The average number of days it takes
* for the moon to return to the same ecliptic longitude relative to the
@ -112,7 +112,7 @@ const double CalendarAstronomer::SYNODIC_MONTH = 29.530588853;
* @deprecated ICU 2.4. This class may be removed or modified.
*/
#define SIDEREAL_MONTH 27.32166
/**
* The average number number of days between successive vernal equinoxes.
* Due to the precession of the earth's
@ -144,29 +144,29 @@ const double CalendarAstronomer::SYNODIC_MONTH = 29.530588853;
// Time-related constants
//-------------------------------------------------------------------------
/**
* The number of milliseconds in one second.
/**
* The number of milliseconds in one second.
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
#define SECOND_MS U_MILLIS_PER_SECOND
/**
* The number of milliseconds in one minute.
/**
* The number of milliseconds in one minute.
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
#define MINUTE_MS U_MILLIS_PER_MINUTE
/**
* The number of milliseconds in one hour.
/**
* The number of milliseconds in one hour.
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
#define HOUR_MS U_MILLIS_PER_HOUR
/**
* The number of milliseconds in one day.
/**
* The number of milliseconds in one day.
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
@ -183,8 +183,8 @@ const double CalendarAstronomer::SYNODIC_MONTH = 29.530588853;
* @deprecated ICU 2.4. This class may be removed or modified.
*/
#define JULIAN_EPOCH_MS -210866760000000.0
/**
* Milliseconds value for 0.0 January 2000 AD.
*/
@ -201,7 +201,7 @@ const double CalendarAstronomer::PI = 3.14159265358979323846;
#define RAD_HOUR ( 12 / CalendarAstronomer::PI ) // radians -> hours
#define DEG_RAD ( CalendarAstronomer::PI / 180 ) // degrees -> radians
#define RAD_DEG ( 180 / CalendarAstronomer::PI ) // radians -> degrees
//-------------------------------------------------------------------------
// Constructors
//-------------------------------------------------------------------------
@ -216,7 +216,7 @@ CalendarAstronomer::CalendarAstronomer():
fTime(Calendar::getNow()), fLongitude(0.0), fLatitude(0.0), fGmtOffset(0.0), moonPosition(0,0), moonPositionSet(FALSE) {
clearCache();
}
/**
* Construct a new <code>CalendarAstronomer</code> object that is initialized to
* the specified date and time.
@ -249,15 +249,15 @@ CalendarAstronomer::CalendarAstronomer(double longitude, double latitude) :
fGmtOffset = (double)(fLongitude * 24. * (double)HOUR_MS / (double)CalendarAstronomer_PI2);
clearCache();
}
CalendarAstronomer::~CalendarAstronomer()
{
}
//-------------------------------------------------------------------------
// Time and date getters and setters
//-------------------------------------------------------------------------
/**
* Set the current date and time of this <code>CalendarAstronomer</code> object. All
* astronomical calculations are performed based on this time setting.
@ -281,7 +281,7 @@ void CalendarAstronomer::setTime(UDate aTime) {
* astronomical calculations are performed based on this time setting.
*
* @param jdn the desired time, expressed as a "julian day number",
* which is the number of elapsed days since
* which is the number of elapsed days since
* 1/1/4713 BC (Julian), 12:00 GMT. Note that julian day
* numbers start at <em>noon</em>. To get the jdn for
* the corresponding midnight, subtract 0.5.
@ -310,7 +310,7 @@ void CalendarAstronomer::setJulianDay(double jdn) {
UDate CalendarAstronomer::getTime() {
return fTime;
}
/**
* Get the current time of this <code>CalendarAstronomer</code> object,
* expressed as a "julian day number", which is the number of elapsed
@ -327,7 +327,7 @@ double CalendarAstronomer::getJulianDay() {
}
return julianDay;
}
/**
* Return this object's time expressed in julian centuries:
* the number of centuries after 1/1/1900 AD, 12:00 GMT
@ -352,14 +352,14 @@ double CalendarAstronomer::getGreenwichSidereal() {
if (isINVALID(siderealTime)) {
// See page 86 of "Practial Astronomy with your Calculator",
// by Peter Duffet-Smith, for details on the algorithm.
double UT = normalize(fTime/(double)HOUR_MS, 24.);
siderealTime = normalize(getSiderealOffset() + UT*1.002737909, 24.);
}
return siderealTime;
}
double CalendarAstronomer::getSiderealOffset() {
if (isINVALID(siderealT0)) {
double JD = uprv_floor(getJulianDay() - 0.5) + 0.5;
@ -369,7 +369,7 @@ double CalendarAstronomer::getSiderealOffset() {
}
return siderealT0;
}
/**
* Returns the current local sidereal time, measured in hours
* @internal
@ -378,7 +378,7 @@ double CalendarAstronomer::getSiderealOffset() {
double CalendarAstronomer::getLocalSidereal() {
return normalize(getGreenwichSidereal() + (fGmtOffset/(double)HOUR_MS), 24.);
}
/**
* Converts local sidereal time to Universal Time.
*
@ -386,22 +386,22 @@ double CalendarAstronomer::getLocalSidereal() {
* on this object's current date.
*
* @return The corresponding Universal Time, in milliseconds since
* 1 Jan 1970, GMT.
* 1 Jan 1970, GMT.
*/
double CalendarAstronomer::lstToUT(double lst) {
// Convert to local mean time
double lt = normalize((lst - getSiderealOffset()) * 0.9972695663, 24);
// Then find local midnight on this day
double base = (DAY_MS * Math::floorDivide(fTime + fGmtOffset,(double)DAY_MS)) - fGmtOffset;
//out(" lt =" + lt + " hours");
//out(" base=" + new Date(base));
return base + (long)(lt * HOUR_MS);
}
//-------------------------------------------------------------------------
// Coordinate transformations, all based on the current time of this object
//-------------------------------------------------------------------------
@ -414,7 +414,7 @@ double CalendarAstronomer::lstToUT(double lst) {
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
CalendarAstronomer::Equatorial& CalendarAstronomer::eclipticToEquatorial(CalendarAstronomer::Equatorial& result, const CalendarAstronomer::Ecliptic& ecliptic)
CalendarAstronomer::Equatorial& CalendarAstronomer::eclipticToEquatorial(CalendarAstronomer::Equatorial& result, const CalendarAstronomer::Ecliptic& ecliptic)
{
return eclipticToEquatorial(result, ecliptic.longitude, ecliptic.latitude);
}
@ -429,7 +429,7 @@ CalendarAstronomer::Equatorial& CalendarAstronomer::eclipticToEquatorial(Calenda
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
CalendarAstronomer::Equatorial& CalendarAstronomer::eclipticToEquatorial(CalendarAstronomer::Equatorial& result, double eclipLong, double eclipLat)
CalendarAstronomer::Equatorial& CalendarAstronomer::eclipticToEquatorial(CalendarAstronomer::Equatorial& result, double eclipLong, double eclipLat)
{
// See page 42 of "Practial Astronomy with your Calculator",
// by Peter Duffet-Smith, for details on the algorithm.
@ -437,14 +437,14 @@ CalendarAstronomer::Equatorial& CalendarAstronomer::eclipticToEquatorial(Calenda
double obliq = eclipticObliquity();
double sinE = ::sin(obliq);
double cosE = cos(obliq);
double sinL = ::sin(eclipLong);
double cosL = cos(eclipLong);
double sinB = ::sin(eclipLat);
double cosB = cos(eclipLat);
double tanB = tan(eclipLat);
result.set(atan2(sinL*cosE - tanB*sinE, cosL),
asin(sinB*cosE + cosB*sinE*sinL) );
return result;
@ -459,7 +459,7 @@ CalendarAstronomer::Equatorial& CalendarAstronomer::eclipticToEquatorial(Calenda
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
CalendarAstronomer::Equatorial& CalendarAstronomer::eclipticToEquatorial(CalendarAstronomer::Equatorial& result, double eclipLong)
CalendarAstronomer::Equatorial& CalendarAstronomer::eclipticToEquatorial(CalendarAstronomer::Equatorial& result, double eclipLong)
{
return eclipticToEquatorial(result, eclipLong, 0); // TODO: optimize
}
@ -472,16 +472,16 @@ CalendarAstronomer::Horizon& CalendarAstronomer::eclipticToHorizon(CalendarAstro
{
Equatorial equatorial;
eclipticToEquatorial(equatorial, eclipLong);
double H = getLocalSidereal()*CalendarAstronomer::PI/12 - equatorial.ascension; // Hour-angle
double sinH = ::sin(H);
double cosH = cos(H);
double sinD = ::sin(equatorial.declination);
double cosD = cos(equatorial.declination);
double sinL = ::sin(fLatitude);
double cosL = cos(fLatitude);
double altitude = asin(sinD*sinL + cosD*cosL*cosH);
double azimuth = atan2(-cosD*cosL*sinH, sinD - sinL * ::sin(altitude));
@ -489,7 +489,7 @@ CalendarAstronomer::Horizon& CalendarAstronomer::eclipticToHorizon(CalendarAstro
return result;
}
//-------------------------------------------------------------------------
// The Sun
//-------------------------------------------------------------------------
@ -567,13 +567,13 @@ double CalendarAstronomer::getSunLongitude()
{
// See page 86 of "Practial Astronomy with your Calculator",
// by Peter Duffet-Smith, for details on the algorithm.
if (isINVALID(sunLongitude)) {
getSunLongitude(getJulianDay(), sunLongitude, meanAnomalySun);
}
return sunLongitude;
}
/**
* TODO Make this public when the entire class is package-private.
*/
@ -581,17 +581,17 @@ double CalendarAstronomer::getSunLongitude()
{
// See page 86 of "Practial Astronomy with your Calculator",
// by Peter Duffet-Smith, for details on the algorithm.
double day = jDay - JD_EPOCH; // Days since epoch
// Find the angular distance the sun in a fictitious
// circular orbit has travelled since the epoch.
double epochAngle = norm2PI(CalendarAstronomer_PI2/TROPICAL_YEAR*day);
// The epoch wasn't at the sun's perigee; find the angular distance
// since perigee, which is called the "mean anomaly"
meanAnomaly = norm2PI(epochAngle + SUN_ETA_G - SUN_OMEGA_G);
// Now find the "true anomaly", e.g. the real solar longitude
// by solving Kepler's equation for an elliptical orbit
// NOTE: The 3rd ed. of the book lists omega_g and eta_g in different
@ -609,10 +609,10 @@ CalendarAstronomer::Equatorial& CalendarAstronomer::getSunPosition(CalendarAstro
return eclipticToEquatorial(result, getSunLongitude(), 0);
}
/**
* Constant representing the vernal equinox.
* For use with {@link #getSunTime getSunTime}.
* For use with {@link #getSunTime getSunTime}.
* Note: In this case, "vernal" refers to the northern hemisphere's seasons.
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
@ -620,7 +620,7 @@ CalendarAstronomer::Equatorial& CalendarAstronomer::getSunPosition(CalendarAstro
double CalendarAstronomer::VERNAL_EQUINOX() {
return 0;
}
/**
* Constant representing the summer solstice.
* For use with {@link #getSunTime getSunTime}.
@ -631,7 +631,7 @@ double CalendarAstronomer::VERNAL_EQUINOX() {
double CalendarAstronomer::SUMMER_SOLSTICE() {
return (CalendarAstronomer::PI/2);
}
/**
* Constant representing the autumnal equinox.
* For use with {@link #getSunTime getSunTime}.
@ -642,7 +642,7 @@ double CalendarAstronomer::SUMMER_SOLSTICE() {
double CalendarAstronomer::AUTUMN_EQUINOX() {
return (CalendarAstronomer::PI);
}
/**
* Constant representing the winter solstice.
* For use with {@link #getSunTime getSunTime}.
@ -653,10 +653,10 @@ double CalendarAstronomer::AUTUMN_EQUINOX() {
double CalendarAstronomer::WINTER_SOLSTICE() {
return ((CalendarAstronomer::PI*3)/2);
}
/**
* Find the next time at which the sun's ecliptic longitude will have
* the desired value.
* the desired value.
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
@ -674,7 +674,7 @@ UDate CalendarAstronomer::getSunTime(double desired, UBool next)
MINUTE_MS,
next);
}
class RiseSetCoordFunc : public CalendarAstronomer::CoordFunc {
public:
virtual void eval(CalendarAstronomer::Equatorial& result, CalendarAstronomer&a) { a.getSunPosition(result); }
@ -686,7 +686,7 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
// Make a rough guess: 6am or 6pm local time on the current day
double noon = Math::floorDivide(fTime + fGmtOffset, (double)DAY_MS)*DAY_MS - fGmtOffset + (12*HOUR_MS);
U_DEBUG_ASTRO_MSG(("Noon=%.2lf, %sL, gmtoff %.2lf\n", noon, debug_astro_date(noon+fGmtOffset), fGmtOffset));
setTime(noon + ((rise ? -6 : 6) * HOUR_MS));
U_DEBUG_ASTRO_MSG(("added %.2lf ms as a guess,\n", ((rise ? -6. : 6.) * HOUR_MS)));
@ -734,7 +734,7 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
// if (lst1s > 24) lst1s -= 24;
// if (lst2r > 24) lst2r -= 24;
// if (lst2s > 24) lst2s -= 24;
//
//
// // 4. Convert LSTs to GSTs. If GST1 > GST2, add 24 to GST2.
// double gst1r = lstToGst(lst1r);
// double gst1s = lstToGst(lst1s);
@ -745,12 +745,12 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
//
// // 5. Calculate GST at 0h UT of this date
// double t00 = utToGst(0);
//
//
// // 6. Calculate GST at 0h on the observer's longitude
// double offset = ::round(fLongitude*12/PI); // p.95 step 6; he _rounds_ to nearest 15 deg.
// double t00p = t00 - offset*1.002737909;
// if (t00p < 0) t00p += 24; // do NOT normalize
//
//
// // 7. Adjust
// if (gst1r < t00p) {
// gst1r += 24;
@ -794,7 +794,7 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
// double delta = fLongitude * 24 / CalendarAstronomer_PI2;
// return normalize(lst - delta, 24);
// }
// Commented out - currently unused. ICU 2.6, Alan
// /**
// * Convert UT to GST on this date.
@ -838,7 +838,7 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
// //-------------------------------------------------------------------------
//
// // Note: This method appears to produce inferior accuracy as
// // compared to getSunRiseSet().
// // compared to getSunRiseSet().
//
// /**
// * TODO Make this when the entire class is package-private.
@ -849,62 +849,62 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
// double d = (double)(time - EPOCH_2000_MS) / DAY_MS;
//
// // Now compute the Local Sidereal Time, LST:
// //
// //
// double LST = 98.9818 + 0.985647352 * d + /*UT*15 + long*/
// fLongitude*RAD_DEG;
// //
// //
// // (east long. positive). Note that LST is here expressed in degrees,
// // where 15 degrees corresponds to one hour. Since LST really is an angle,
// // it's convenient to use one unit---degrees---throughout.
//
// // COMPUTING THE SUN'S POSITION
// // ----------------------------
// //
// // COMPUTING THE SUN'S POSITION
// // ----------------------------
// //
// // To be able to compute the Sun's rise/set times, you need to be able to
// // compute the Sun's position at any time. First compute the "day
// // number" d as outlined above, for the desired moment. Next compute:
// //
// //
// double oblecl = 23.4393 - 3.563E-7 * d;
// //
// //
// double w = 282.9404 + 4.70935E-5 * d;
// double M = 356.0470 + 0.9856002585 * d;
// double e = 0.016709 - 1.151E-9 * d;
// //
// //
// // This is the obliquity of the ecliptic, plus some of the elements of
// // the Sun's apparent orbit (i.e., really the Earth's orbit): w =
// // argument of perihelion, M = mean anomaly, e = eccentricity.
// // Semi-major axis is here assumed to be exactly 1.0 (while not strictly
// // true, this is still an accurate approximation). Next compute E, the
// // eccentric anomaly:
// //
// //
// double E = M + e*(180/PI) * ::sin(M*DEG_RAD) * ( 1.0 + e*cos(M*DEG_RAD) );
// //
// //
// // where E and M are in degrees. This is it---no further iterations are
// // needed because we know e has a sufficiently small value. Next compute
// // the true anomaly, v, and the distance, r:
// //
// //
// /* r * cos(v) = */ double A = cos(E*DEG_RAD) - e;
// /* r * ::sin(v) = */ double B = ::sqrt(1 - e*e) * ::sin(E*DEG_RAD);
// //
// //
// // and
// //
// //
// // r = sqrt( A*A + B*B )
// double v = ::atan2( B, A )*RAD_DEG;
// //
// //
// // The Sun's true longitude, slon, can now be computed:
// //
// //
// double slon = v + w;
// //
// //
// // Since the Sun is always at the ecliptic (or at least very very close to
// // it), we can use simplified formulae to convert slon (the Sun's ecliptic
// // longitude) to sRA and sDec (the Sun's RA and Dec):
// //
// //
// // ::sin(slon) * cos(oblecl)
// // tan(sRA) = -------------------------
// // cos(slon)
// //
// // cos(slon)
// //
// // ::sin(sDec) = ::sin(oblecl) * ::sin(slon)
// //
// //
// // As was the case when computing az, the Azimuth, if possible use an
// // atan2() function to compute sRA.
//
@ -913,40 +913,40 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
// double sin_sDec = ::sin(oblecl*DEG_RAD) * ::sin(slon*DEG_RAD);
// double sDec = ::asin(sin_sDec)*RAD_DEG;
//
// // COMPUTING RISE AND SET TIMES
// // ----------------------------
// //
// // COMPUTING RISE AND SET TIMES
// // ----------------------------
// //
// // To compute when an object rises or sets, you must compute when it
// // passes the meridian and the HA of rise/set. Then the rise time is
// // the meridian time minus HA for rise/set, and the set time is the
// // meridian time plus the HA for rise/set.
// //
// //
// // To find the meridian time, compute the Local Sidereal Time at 0h local
// // time (or 0h UT if you prefer to work in UT) as outlined above---name
// // that quantity LST0. The Meridian Time, MT, will now be:
// //
// //
// // MT = RA - LST0
// double MT = normalize(sRA - LST, 360);
// //
// //
// // where "RA" is the object's Right Ascension (in degrees!). If negative,
// // add 360 deg to MT. If the object is the Sun, leave the time as it is,
// // but if it's stellar, multiply MT by 365.2422/366.2422, to convert from
// // sidereal to solar time. Now, compute HA for rise/set, name that
// // quantity HA0:
// //
// //
// // ::sin(h0) - ::sin(lat) * ::sin(Dec)
// // cos(HA0) = ---------------------------------
// // cos(lat) * cos(Dec)
// //
// //
// // where h0 is the altitude selected to represent rise/set. For a purely
// // mathematical horizon, set h0 = 0 and simplify to:
// //
// // cos(HA0) = - tan(lat) * tan(Dec)
// //
// //
// // cos(HA0) = - tan(lat) * tan(Dec)
// //
// // If you want to account for refraction on the atmosphere, set h0 = -35/60
// // degrees (-35 arc minutes), and if you want to compute the rise/set times
// // for the Sun's upper limb, set h0 = -50/60 (-50 arc minutes).
// //
// //
// double h0 = -50/60 * DEG_RAD;
//
// double HA0 = ::acos(
@ -956,12 +956,12 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
// // When HA0 has been computed, leave it as it is for the Sun but multiply
// // by 365.2422/366.2422 for stellar objects, to convert from sidereal to
// // solar time. Finally compute:
// //
// //
// // Rise time = MT - HA0
// // Set time = MT + HA0
// //
// //
// // convert the times from degrees to hours by dividing by 15.
// //
// //
// // If you'd like to check that your calculations are accurate or just
// // need a quick result, check the USNO's Sun or Moon Rise/Set Table,
// // <URL:http://aa.usno.navy.mil/AA/data/docs/RS_OneYear.html>.
@ -977,18 +977,18 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
//-------------------------------------------------------------------------
// The Moon
//-------------------------------------------------------------------------
#define moonL0 (318.351648 * CalendarAstronomer::PI/180 ) // Mean long. at epoch
#define moonP0 ( 36.340410 * CalendarAstronomer::PI/180 ) // Mean long. of perigee
#define moonN0 ( 318.510107 * CalendarAstronomer::PI/180 ) // Mean long. of node
#define moonI ( 5.145366 * CalendarAstronomer::PI/180 ) // Inclination of orbit
#define moonE ( 0.054900 ) // Eccentricity of orbit
// These aren't used right now
#define moonA ( 3.84401e5 ) // semi-major axis (km)
#define moonT0 ( 0.5181 * CalendarAstronomer::PI/180 ) // Angular size at distance A
#define moonPi ( 0.9507 * CalendarAstronomer::PI/180 ) // Parallax at distance A
/**
* The position of the moon at the time set on this
* object, in equatorial coordinates.
@ -1005,18 +1005,18 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition()
// Calculate the solar longitude. Has the side effect of
// filling in "meanAnomalySun" as well.
getSunLongitude();
//
// Find the # of days since the epoch of our orbital parameters.
// TODO: Convert the time of day portion into ephemeris time
//
double day = getJulianDay() - JD_EPOCH; // Days since epoch
// Calculate the mean longitude and anomaly of the moon, based on
// a circular orbit. Similar to the corresponding solar calculation.
double meanLongitude = norm2PI(13.1763966*PI/180*day + moonL0);
meanAnomalyMoon = norm2PI(meanLongitude - 0.1114041*PI/180 * day - moonP0);
//
// Calculate the following corrections:
// Evection: the sun's gravity affects the moon's eccentricity
@ -1029,7 +1029,7 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition()
double a3 = 0.3700*PI/180 * ::sin(meanAnomalySun);
meanAnomalyMoon += evection - annual - a3;
//
// More correction factors:
// center equation of the center correction
@ -1039,7 +1039,7 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition()
//
double center = 6.2886*PI/180 * ::sin(meanAnomalyMoon);
double a4 = 0.2140*PI/180 * ::sin(2 * meanAnomalyMoon);
// Now find the moon's corrected longitude
moonLongitude = meanLongitude + evection + center - annual + a4;
@ -1049,9 +1049,9 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition()
// the earth the moon is on
//
double variation = 0.6583*CalendarAstronomer::PI/180 * ::sin(2*(moonLongitude - sunLongitude));
moonLongitude += variation;
//
// What we've calculated so far is the moon's longitude in the plane
// of its own orbit. Now map to the ecliptic to get the latitude
@ -1065,7 +1065,7 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition()
double y = ::sin(moonLongitude - nodeLongitude);
double x = cos(moonLongitude - nodeLongitude);
moonEclipLong = ::atan2(y*cos(moonI), x) + nodeLongitude;
double moonEclipLat = ::asin(y * ::sin(moonI));
@ -1074,7 +1074,7 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition()
}
return moonPosition;
}
/**
* The "age" of the moon at the time specified in this object.
* This is really the angle between the
@ -1093,10 +1093,10 @@ double CalendarAstronomer::getMoonAge() {
// some the intermediate results cached during that calculation.
//
getMoonPosition();
return norm2PI(moonEclipLong - sunLongitude);
}
/**
* Calculate the phase of the moon at the time set in this object.
* The returned phase is a <code>double</code> in the range
@ -1117,7 +1117,7 @@ double CalendarAstronomer::getMoonPhase() {
// by Peter Duffet-Smith, for details on the algorithm.
return 0.5 * (1 - cos(getMoonAge()));
}
/**
* Constant representing a new moon.
* For use with {@link #getMoonTime getMoonTime}
@ -1137,7 +1137,7 @@ const CalendarAstronomer::MoonAge CalendarAstronomer::NEW_MOON() {
const CalendarAstronomer::MoonAge CalendarAstronomer::FIRST_QUARTER() {
return CalendarAstronomer::MoonAge(CalendarAstronomer::PI/2);
}
/**
* Constant representing a full moon.
* For use with {@link #getMoonTime getMoonTime}
@ -1165,11 +1165,11 @@ const CalendarAstronomer::MoonAge CalendarAstronomer::LAST_QUARTER() {
/**
* Find the next or previous time at which the Moon's ecliptic
* longitude will have the desired value.
* longitude will have the desired value.
* <p>
* @param desired The desired longitude.
* @param next <tt>true</tt> if the next occurrance of the phase
* is desired, <tt>false</tt> for the previous occurrance.
* is desired, <tt>false</tt> for the previous occurrance.
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
@ -1182,26 +1182,26 @@ UDate CalendarAstronomer::getMoonTime(double desired, UBool next)
MINUTE_MS,
next);
}
/**
* Find the next or previous time at which the moon will be in the
* desired phase.
* <p>
* @param desired The desired phase of the moon.
* @param next <tt>true</tt> if the next occurrance of the phase
* is desired, <tt>false</tt> for the previous occurrance.
* is desired, <tt>false</tt> for the previous occurrance.
* @internal
* @deprecated ICU 2.4. This class may be removed or modified.
*/
UDate CalendarAstronomer::getMoonTime(const CalendarAstronomer::MoonAge& desired, UBool next) {
return getMoonTime(desired.value, next);
}
class MoonRiseSetCoordFunc : public CalendarAstronomer::CoordFunc {
public:
virtual void eval(CalendarAstronomer::Equatorial& result, CalendarAstronomer&a) { result = a.getMoonPosition(); }
};
/**
* Returns the time (GMT) of sunrise or sunset on the local date to which
* this calendar is currently set.
@ -1221,23 +1221,23 @@ UDate CalendarAstronomer::getMoonRiseSet(UBool rise)
//-------------------------------------------------------------------------
// Interpolation methods for finding the time at which a given event occurs
//-------------------------------------------------------------------------
UDate CalendarAstronomer::timeOfAngle(AngleFunc& func, double desired,
double periodDays, double epsilon, UBool next)
{
// Find the value of the function at the current time
double lastAngle = func.eval(*this);
// Find out how far we are from the desired angle
double deltaAngle = norm2PI(desired - lastAngle) ;
// Using the average period, estimate the next (or previous) time at
// which the desired angle occurs.
double deltaT = (deltaAngle + (next ? 0.0 : - CalendarAstronomer_PI2 )) * (periodDays*DAY_MS) / CalendarAstronomer_PI2;
double lastDeltaT = deltaT; // Liu
UDate startTime = fTime; // Liu
setTime(fTime + uprv_ceil(deltaT));
// Now iterate until we get the error below epsilon. Throughout
@ -1252,17 +1252,17 @@ UDate CalendarAstronomer::timeOfAngle(AngleFunc& func, double desired,
// Correct the time estimate based on how far off the angle is
deltaT = normPI(desired - angle) * factor;
// HACK:
//
//
// If abs(deltaT) begins to diverge we need to quit this loop.
// This only appears to happen when attempting to locate, for
// example, a new moon on the day of the new moon. E.g.:
//
//
// This result is correct:
// newMoon(7508(Mon Jul 23 00:00:00 CST 1990,false))=
// Sun Jul 22 10:57:41 CST 1990
//
//
// But attempting to make the same call a day earlier causes deltaT
// to diverge:
// CalendarAstronomer.timeOfAngle() diverging: 1.348508727575625E9 ->
@ -1286,19 +1286,19 @@ UDate CalendarAstronomer::timeOfAngle(AngleFunc& func, double desired,
setTime(fTime + uprv_ceil(deltaT));
}
while (uprv_fabs(deltaT) > epsilon);
return fTime;
}
UDate CalendarAstronomer::riseOrSet(CoordFunc& func, UBool rise,
double diameter, double refraction,
double diameter, double refraction,
double epsilon)
{
{
Equatorial pos;
double tanL = ::tan(fLatitude);
double deltaT = 0;
int32_t count = 0;
//
// Calculate the object's position at the current time, then use that
// position to calculate the time of rising or setting. The position
@ -1311,10 +1311,10 @@ UDate CalendarAstronomer::riseOrSet(CoordFunc& func, UBool rise,
func.eval(pos, *this);
double angle = ::acos(-tanL * ::tan(pos.declination));
double lst = ((rise ? CalendarAstronomer_PI2-angle : angle) + pos.ascension ) * 24 / CalendarAstronomer_PI2;
// Convert from LST to Universal Time.
UDate newTime = lstToUT( lst );
deltaT = newTime - fTime;
setTime(newTime);
U_DEBUG_ASTRO_MSG(("%d] dT=%.3lf, angle=%.3lf, lst=%.3lf, A=%.3lf/D=%.3lf\n",
@ -1328,10 +1328,10 @@ UDate CalendarAstronomer::riseOrSet(CoordFunc& func, UBool rise,
double x = diameter / 2 + refraction;
double y = ::asin(sin(x) / ::sin(psi));
long delta = (long)((240 * y * RAD_DEG / cosD)*SECOND_MS);
return fTime + (rise ? -delta : delta);
}
/**
* Find the "true anomaly" (longitude) of an object from
* its mean anomaly and the eccentricity of its orbit. This uses
@ -1339,7 +1339,7 @@ UDate CalendarAstronomer::riseOrSet(CoordFunc& func, UBool rise,
*
* @param meanAnomaly The object's longitude calculated as if it were in
* a regular, circular orbit, measured in radians
* from the point of perigee.
* from the point of perigee.
*
* @param eccentricity The eccentricity of the orbit
*
@ -1354,13 +1354,13 @@ double CalendarAstronomer::trueAnomaly(double meanAnomaly, double eccentricity)
do {
delta = E - eccentricity * ::sin(E) - meanAnomaly;
E = E - delta / (1 - eccentricity * ::cos(E));
}
}
while (uprv_fabs(delta) > 1e-5); // epsilon = 1e-5 rad
return 2.0 * ::atan( ::tan(E/2) * ::sqrt( (1+eccentricity)
/(1-eccentricity) ) );
}
/**
* Return the obliquity of the ecliptic (the angle between the ecliptic
* and the earth's equator) at the current time. This varies due to
@ -1374,18 +1374,18 @@ double CalendarAstronomer::eclipticObliquity() {
const double epoch = 2451545.0; // 2000 AD, January 1.5
double T = (getJulianDay() - epoch) / 36525;
eclipObliquity = 23.439292
- 46.815/3600 * T
- 0.0006/3600 * T*T
+ 0.00181/3600 * T*T*T;
eclipObliquity *= DEG_RAD;
}
return eclipObliquity;
}
//-------------------------------------------------------------------------
// Private data
//-------------------------------------------------------------------------
@ -1404,15 +1404,15 @@ void CalendarAstronomer::clearCache() {
siderealT0 = INVALID;
moonPositionSet = FALSE;
}
//private static void out(String s) {
// System.out.println(s);
//}
//private static String deg(double rad) {
// return Double.toString(rad * RAD_DEG);
//}
//private static String hours(long ms) {
// return Double.toString((double)ms / HOUR_MS) + " hours";
//}
@ -1433,7 +1433,7 @@ UDate CalendarAstronomer::local(UDate localMillis) {
}
// Debugging functions
UnicodeString CalendarAstronomer::Ecliptic::toString() const
UnicodeString CalendarAstronomer::Ecliptic::toString() const
{
#ifdef U_DEBUG_ASTRO
char tmp[800];
@ -1444,11 +1444,11 @@ UnicodeString CalendarAstronomer::Ecliptic::toString() const
#endif
}
UnicodeString CalendarAstronomer::Equatorial::toString() const
UnicodeString CalendarAstronomer::Equatorial::toString() const
{
#ifdef U_DEBUG_ASTRO
char tmp[400];
sprintf(tmp, "%f,%f",
sprintf(tmp, "%f,%f",
(ascension*RAD_DEG), (declination*RAD_DEG));
return UnicodeString(tmp, "");
#else
@ -1456,7 +1456,7 @@ UnicodeString CalendarAstronomer::Equatorial::toString() const
#endif
}
UnicodeString CalendarAstronomer::Horizon::toString() const
UnicodeString CalendarAstronomer::Horizon::toString() const
{
#ifdef U_DEBUG_ASTRO
char tmp[800];
@ -1472,15 +1472,15 @@ UnicodeString CalendarAstronomer::Horizon::toString() const
// int hrs = (int) (angle*RAD_HOUR);
// int min = (int)((angle*RAD_HOUR - hrs) * 60);
// int sec = (int)((angle*RAD_HOUR - hrs - min/60.0) * 3600);
// return Integer.toString(hrs) + "h" + min + "m" + sec + "s";
// }
// static private String radToDms(double angle) {
// int deg = (int) (angle*RAD_DEG);
// int min = (int)((angle*RAD_DEG - deg) * 60);
// int sec = (int)((angle*RAD_DEG - deg - min/60.0) * 3600);
// return Integer.toString(deg) + "\u00b0" + min + "'" + sec + "\"";
// }

View File

@ -315,18 +315,18 @@ public:
}
virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* /*actualID*/, UErrorCode& status) const {
LocaleKey& lkey = (LocaleKey&)key;
//int32_t kind = lkey.kind();
LocaleKey& lkey = (LocaleKey&)key;
//int32_t kind = lkey.kind();
Locale loc;
lkey.canonicalLocale(loc);
Locale loc;
lkey.canonicalLocale(loc);
#ifdef U_DEBUG_CALSVC
Locale loc2;
lkey.currentLocale(loc2);
fprintf(stderr, "CalSvc:handleDefault for currentLoc %s, canloc %s\n", (const char*)loc.getName(), (const char*)loc2.getName());
#endif
Calendar *nc = new GregorianCalendar(loc, status);
Calendar *nc = new GregorianCalendar(loc, status);
#ifdef U_DEBUG_CALSVC
UErrorCode status2 = U_ZERO_ERROR;
@ -2895,7 +2895,7 @@ void Calendar::prepareGetActual(UCalendarDateFields field, UBool isMinimum, UErr
}
break;
default:
;
;
}
// Do this last to give it the newest time stamp

View File

@ -626,7 +626,7 @@ DecimalFormat::format(int32_t number,
UnicodeString& appendTo,
FieldPosition& fieldPosition) const
{
return format((int64_t)number, appendTo, fieldPosition);
return format((int64_t)number, appendTo, fieldPosition);
}
//------------------------------------------------------------------------------
@ -983,14 +983,14 @@ DecimalFormat::subformat(UnicodeString& appendTo,
DigitList expDigits;
expDigits.set(exponent);
{
{
int expDig = fMinExponentDigits;
if (fUseExponentialNotation && expDig < 1) {
expDig = 1;
}
for (i=expDigits.fDecimalAt; i<expDig; ++i)
appendTo += (zero);
}
}
for (i=0; i<expDigits.fDecimalAt; ++i)
{
UChar32 c = (UChar32)((i < expDigits.fCount) ?

View File

@ -255,25 +255,25 @@ int64_t DigitList::getInt64() /*const*/
// be able to return a 64-bit number [grhoten]
*fDecimalDigits = fIsPositive ? '+' : '-';
if (fCount < LONG_MIN_REP_LENGTH) {
return (int64_t)atol(fDecimalDigits);
}
if (fCount < LONG_MIN_REP_LENGTH) {
return (int64_t)atol(fDecimalDigits);
}
// too big for atol, hand-roll atoi64
value = 0;
for (int i = 0; i < fCount; ++i) {
int v = fDigits[i] - kZero;
value = value * (uint64_t)10 + (uint64_t)v;
}
if (!fIsPositive) {
value = ~value;
value += 1;
}
int64_t svalue = (int64_t)value;
// too big for atol, hand-roll atoi64
value = 0;
for (int i = 0; i < fCount; ++i) {
int v = fDigits[i] - kZero;
value = value * (uint64_t)10 + (uint64_t)v;
}
if (!fIsPositive) {
value = ~value;
value += 1;
}
int64_t svalue = (int64_t)value;
return svalue;
}
else {
// todo: figure out best approach
// todo: figure out best approach
// This is 100% accurate in c++ because if we are representing
// an integral value, we suffer nothing in the conversion to
@ -399,7 +399,7 @@ DigitList::fitsIntoInt64(UBool ignoreNegativeZero) /*const*/
void
DigitList::set(int32_t source, int32_t maximumDigits)
{
set((int64_t)source, maximumDigits);
set((int64_t)source, maximumDigits);
}
// -------------------------------------

View File

@ -34,8 +34,8 @@
typedef enum EDigitListValues {
MAX_DBL_DIGITS = DBL_DIG,
MAX_I64_DIGITS = INT64_DIGITS,
MAX_DIGITS = MAX_I64_DIGITS,
MAX_I64_DIGITS = INT64_DIGITS,
MAX_DIGITS = MAX_I64_DIGITS,
MAX_EXPONENT = DBL_DIG,
DIGIT_PADDING = 3,

View File

@ -151,7 +151,7 @@ static const UDate kPapalCutoverJulian = (2299161.0 - kEpochStartAsJulianDay);
GregorianCalendar::GregorianCalendar(UErrorCode& status)
: Calendar(TimeZone::createDefault(), Locale::getDefault(), status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fIsGregorian(TRUE), fInvertGregorian(FALSE)
{
setTimeInMillis(getNow(), status);
@ -162,7 +162,7 @@ GregorianCalendar::GregorianCalendar(UErrorCode& status)
GregorianCalendar::GregorianCalendar(TimeZone* zone, UErrorCode& status)
: Calendar(zone, Locale::getDefault(), status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fIsGregorian(TRUE), fInvertGregorian(FALSE)
{
setTimeInMillis(getNow(), status);
@ -173,7 +173,7 @@ GregorianCalendar::GregorianCalendar(TimeZone* zone, UErrorCode& status)
GregorianCalendar::GregorianCalendar(const TimeZone& zone, UErrorCode& status)
: Calendar(zone, Locale::getDefault(), status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fIsGregorian(TRUE), fInvertGregorian(FALSE)
{
setTimeInMillis(getNow(), status);
@ -184,7 +184,7 @@ GregorianCalendar::GregorianCalendar(const TimeZone& zone, UErrorCode& status)
GregorianCalendar::GregorianCalendar(const Locale& aLocale, UErrorCode& status)
: Calendar(TimeZone::createDefault(), aLocale, status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fIsGregorian(TRUE), fInvertGregorian(FALSE)
{
setTimeInMillis(getNow(), status);
@ -196,7 +196,7 @@ GregorianCalendar::GregorianCalendar(TimeZone* zone, const Locale& aLocale,
UErrorCode& status)
: Calendar(zone, aLocale, status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fIsGregorian(TRUE), fInvertGregorian(FALSE)
{
setTimeInMillis(getNow(), status);
@ -208,7 +208,7 @@ GregorianCalendar::GregorianCalendar(const TimeZone& zone, const Locale& aLocale
UErrorCode& status)
: Calendar(zone, aLocale, status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fIsGregorian(TRUE), fInvertGregorian(FALSE)
{
setTimeInMillis(getNow(), status);
@ -220,7 +220,7 @@ GregorianCalendar::GregorianCalendar(int32_t year, int32_t month, int32_t date,
UErrorCode& status)
: Calendar(TimeZone::createDefault(), Locale::getDefault(), status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fIsGregorian(TRUE), fInvertGregorian(FALSE)
{
set(UCAL_ERA, AD);
@ -235,7 +235,7 @@ GregorianCalendar::GregorianCalendar(int32_t year, int32_t month, int32_t date,
int32_t hour, int32_t minute, UErrorCode& status)
: Calendar(TimeZone::createDefault(), Locale::getDefault(), status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fIsGregorian(TRUE), fInvertGregorian(FALSE)
{
set(UCAL_ERA, AD);
@ -253,7 +253,7 @@ GregorianCalendar::GregorianCalendar(int32_t year, int32_t month, int32_t date,
UErrorCode& status)
: Calendar(TimeZone::createDefault(), Locale::getDefault(), status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fIsGregorian(TRUE), fInvertGregorian(FALSE)
{
set(UCAL_ERA, AD);
@ -412,8 +412,8 @@ void GregorianCalendar::handleComputeFields(int32_t julianDay, UErrorCode& statu
// fprintf(stderr, "%d - %d[%d] + 1\n", dayOfYear, isLeap?kLeapNumDays[month]:kNumDays[month], month );
// fprintf(stderr, "%s:%d: greg's HCF %d -> %d/%d/%d not %d/%d/%d\n",
// __FILE__, __LINE__,julianDay,
// eyear,month,dayOfMonth,
// getGregorianYear(), getGregorianMonth(), getGregorianDayOfMonth() );
// eyear,month,dayOfMonth,
// getGregorianYear(), getGregorianMonth(), getGregorianDayOfMonth() );
fprintf(stderr, "%s:%d: doy %d (greg's %d)- [cut=%d]\n",
__FILE__, __LINE__, dayOfYear, getGregorianDayOfYear(), fCutoverJulianDay);
#endif
@ -1194,8 +1194,8 @@ int32_t GregorianCalendar::handleGetExtendedYear() {
#endif
break;
default:
year = kEpochYear;
default:
year = kEpochYear;
}
return year;
}

View File

@ -1175,9 +1175,9 @@ static Format* makeRBNF(URBNFRuleSetTag tag, const Locale& locale, const Unicode
RuleBasedNumberFormat* fmt = new RuleBasedNumberFormat(tag, locale, ec);
if (U_SUCCESS(ec) && defaultRuleSet.length() > 0) {
fmt->setDefaultRuleSet(defaultRuleSet, ec);
if (U_FAILURE(ec)) { // ignore unrecognized default rule set
ec = U_ZERO_ERROR;
}
if (U_FAILURE(ec)) { // ignore unrecognized default rule set
ec = U_ZERO_ERROR;
}
}
return fmt;
}

View File

@ -135,7 +135,7 @@ NFRuleSet::NFRuleSet(UnicodeString* descriptions, int32_t index, UErrorCode& sta
if (description.length() == 0) {
// throw new IllegalArgumentException("Empty rule set description");
status = U_PARSE_ERROR;
return;
return;
}
// if the description begins with a rule set name (the rule set

View File

@ -281,8 +281,8 @@ NumberFormat::format(int64_t number,
UnicodeString& appendTo,
FieldPosition& pos) const
{
// default so we don't introduce a new abstract method
return format((int32_t)number, appendTo, pos);
// default so we don't introduce a new abstract method
return format((int32_t)number, appendTo, pos);
}
// -------------------------------------

View File

@ -126,7 +126,7 @@ UBool Quantifier::matchesIndexValue(uint8_t v) const {
*/
void Quantifier::addMatchSetTo(UnicodeSet& toUnionTo) const {
if (maxCount > 0) {
matcher->toMatcher()->addMatchSetTo(toUnionTo);
matcher->toMatcher()->addMatchSetTo(toUnionTo);
}
}

View File

@ -677,8 +677,8 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
}
RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
UParseError& perror,
UErrorCode& status)
UParseError& perror,
UErrorCode& status)
: ruleSets(NULL)
, defaultRuleSet(NULL)
, locale(Locale::getDefault())
@ -692,9 +692,9 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
}
RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
const Locale& aLocale,
UParseError& perror,
UErrorCode& status)
const Locale& aLocale,
UParseError& perror,
UErrorCode& status)
: ruleSets(NULL)
, defaultRuleSet(NULL)
, locale(aLocale)

View File

@ -529,14 +529,14 @@ void TransliterationRule::setData(const TransliterationRuleData* d) {
void TransliterationRule::addSourceSetTo(UnicodeSet& toUnionTo) const {
int32_t limit = anteContextLength + keyLength;
for (int32_t i=anteContextLength; i<limit; ) {
UChar32 ch = pattern.char32At(i);
i += UTF_CHAR_LENGTH(ch);
const UnicodeMatcher* matcher = data->lookupMatcher(ch);
if (matcher == NULL) {
toUnionTo.add(ch);
} else {
matcher->addMatchSetTo(toUnionTo);
}
UChar32 ch = pattern.char32At(i);
i += UTF_CHAR_LENGTH(ch);
const UnicodeMatcher* matcher = data->lookupMatcher(ch);
if (matcher == NULL) {
toUnionTo.add(ch);
} else {
matcher->addMatchSetTo(toUnionTo);
}
}
}

View File

@ -434,17 +434,17 @@ UnicodeString& TransliterationRuleSet::toRules(UnicodeString& ruleSource,
* (getTarget=false) or emitted (getTarget=true) by this set.
*/
UnicodeSet& TransliterationRuleSet::getSourceTargetSet(UnicodeSet& result,
UBool getTarget) const {
UBool getTarget) const {
result.clear();
int32_t count = ruleVector->size();
for (int32_t i=0; i<count; ++i) {
TransliterationRule* r =
(TransliterationRule*) ruleVector->elementAt(i);
if (getTarget) {
r->addTargetSetTo(result);
} else {
r->addSourceSetTo(result);
}
TransliterationRule* r =
(TransliterationRule*) ruleVector->elementAt(i);
if (getTarget) {
r->addTargetSetTo(result);
} else {
r->addSourceSetTo(result);
}
}
return result;
}

View File

@ -149,7 +149,7 @@ public:
* (getTarget=false) or emitted (getTarget=true) by this set.
*/
UnicodeSet& getSourceTargetSet(UnicodeSet& result,
UBool getTarget) const;
UBool getTarget) const;
private:

View File

@ -114,8 +114,8 @@ static const UChar gIsWordPattern[] = {
0x5b, 0x3a, 0x43, 0x63, 0x3a, 0x5d, 0x5b, 0x3a, 0x43, 0x66, 0x3a, 0x5d, 0x2d,
// [ : G r a p h e m e _
0x5b, 0x3a, 0x47, 0x72, 0x61, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x5f,
// E x t e n d : ] ]
0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x3a, 0x5d, 0x5d, 0};
// E x t e n d : ] ]
0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x3a, 0x5d, 0x5d, 0};
static const UChar gGC_ExtendPattern[] = {
// [ \ p { G r a p h e m e _

View File

@ -235,14 +235,14 @@ int32_t SearchIterator::next(UErrorCode &status)
}
if (matchlength > 0) {
// if matchlength is 0 we are at the start of the iteration
if (m_search_->isOverlap) {
offset ++;
}
else {
offset += matchlength;
}
}
// if matchlength is 0 we are at the start of the iteration
if (m_search_->isOverlap) {
offset ++;
}
else {
offset += matchlength;
}
}
return handleNext(offset, status);
}
return USEARCH_DONE;

View File

@ -295,13 +295,13 @@ UnicodeString& StringReplacer::toReplacerPattern(UnicodeString& rule,
void StringReplacer::addReplacementSetTo(UnicodeSet& toUnionTo) const {
UChar32 ch;
for (int32_t i=0; i<output.length(); i+=UTF_CHAR_LENGTH(ch)) {
ch = output.char32At(i);
UnicodeReplacer* r = data->lookupReplacer(ch);
if (r == NULL) {
toUnionTo.add(ch);
} else {
r->addReplacementSetTo(toUnionTo);
}
ch = output.char32At(i);
UnicodeReplacer* r = data->lookupReplacer(ch);
if (r == NULL) {
toUnionTo.add(ch);
} else {
r->addReplacementSetTo(toUnionTo);
}
}
}

View File

@ -42,15 +42,15 @@ StringSearch::StringSearch(const UnicodeString &pattern,
uprv_free(m_search_);
m_search_ = NULL;
// !!! dlf m_collator_ is an odd beast. basically it is an aliasing
// wrapper around the internal collator and rules, which (here) are
// owned by this stringsearch object. this means 1) it's destructor
// _should not_ delete the ucollator or rules, and 2) changes made
// to the exposed collator (setStrength etc) _should_ modify the
// ucollator. thus the collator is not a copy-on-write alias, and it
// needs to distinguish itself not merely from 'stand alone' colators
// but also from copy-on-write ones. it needs additional state, which
// setUCollator should set.
// !!! dlf m_collator_ is an odd beast. basically it is an aliasing
// wrapper around the internal collator and rules, which (here) are
// owned by this stringsearch object. this means 1) it's destructor
// _should not_ delete the ucollator or rules, and 2) changes made
// to the exposed collator (setStrength etc) _should_ modify the
// ucollator. thus the collator is not a copy-on-write alias, and it
// needs to distinguish itself not merely from 'stand alone' colators
// but also from copy-on-write ones. it needs additional state, which
// setUCollator should set.
if (U_SUCCESS(status)) {
int32_t length;
@ -365,7 +365,7 @@ int32_t StringSearch::handleNext(int32_t position, UErrorCode &status)
// StringSearch instead of SearchIterator because m_strsrch_ is
// not accessible in SearchIterator
if (position + m_strsrch_->pattern.defaultShiftSize
> m_search_->textLength) {
> m_search_->textLength) {
setMatchNotFound();
return USEARCH_DONE;
}
@ -379,7 +379,7 @@ int32_t StringSearch::handleNext(int32_t position, UErrorCode &status)
m_search_->matchedIndex = position - 1;
}
ucol_setOffset(m_strsrch_->textIter, position, &status);
ucol_setOffset(m_strsrch_->textIter, position, &status);
while (TRUE) {
if (m_search_->isCanonicalMatch) {
// can't use exact here since extra accents are allowed.

File diff suppressed because it is too large Load Diff

View File

@ -1017,7 +1017,7 @@ uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status)
if(element->noOfCEs == 1) {
if(element->isThai == FALSE) {
element->mapCE = element->CEs[0];
element->mapCE = element->CEs[0];
} else { /* add thai - totally bad here */
expansion = (uint32_t)(UCOL_SPECIAL_FLAG | (THAI_TAG<<UCOL_TAG_SHIFT)
| ((uprv_uca_addExpansion(expansions, element->CEs[0], status)+(headersize>>2))<<4)
@ -1051,10 +1051,10 @@ uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status)
| ((element->CEs[0]>>8) & 0xFFFF00) // first and second byte of primary
| ((element->CEs[1]>>24) & 0xFF); // third byte of primary
} else {
expansion = (uint32_t)(UCOL_SPECIAL_FLAG | (EXPANSION_TAG<<UCOL_TAG_SHIFT)
| ((uprv_uca_addExpansion(expansions, element->CEs[0], status)+(headersize>>2))<<4)
& 0xFFFFF0);
expansion = (uint32_t)(UCOL_SPECIAL_FLAG | (EXPANSION_TAG<<UCOL_TAG_SHIFT)
| ((uprv_uca_addExpansion(expansions, element->CEs[0], status)+(headersize>>2))<<4)
& 0xFFFFF0);
for(i = 1; i<element->noOfCEs; i++) {
uprv_uca_addExpansion(expansions, element->CEs[i], status);
}
@ -1084,9 +1084,9 @@ uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status)
UChar32 uniChar = 0;
//printElement(element);
if ((element->cSize == 2) && U16_IS_LEAD(element->uchars[0])){
uniChar = U16_GET_SUPPLEMENTARY(element->uchars[0], element->uchars[1]);
uniChar = U16_GET_SUPPLEMENTARY(element->uchars[0], element->uchars[1]);
} else if (element->cSize == 1){
uniChar = element->uchars[0];
uniChar = element->uchars[0];
}
// Here, we either have one normal CE OR mapCE is set. Therefore, we stuff only
@ -1096,17 +1096,17 @@ uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status)
// a special, further processing will occur. If it's a simple CE, we'll return due
// to how the loop is constructed.
if (uniChar != 0 && u_isdigit(uniChar)){
expansion = (uint32_t)(UCOL_SPECIAL_FLAG | (DIGIT_TAG<<UCOL_TAG_SHIFT) | 1); // prepare the element
expansion = (uint32_t)(UCOL_SPECIAL_FLAG | (DIGIT_TAG<<UCOL_TAG_SHIFT) | 1); // prepare the element
if(element->mapCE) { // if there is an expansion, we'll pick it here
expansion |= ((uprv_uca_addExpansion(expansions, element->mapCE, status)+(headersize>>2))<<4);
} else {
expansion |= ((uprv_uca_addExpansion(expansions, element->CEs[0], status)+(headersize>>2))<<4);
expansion |= ((uprv_uca_addExpansion(expansions, element->CEs[0], status)+(headersize>>2))<<4);
}
element->mapCE = expansion;
// Need to go back to the beginning of the digit string if in the middle!
element->mapCE = expansion;
// Need to go back to the beginning of the digit string if in the middle!
if(uniChar <= 0xFFFF) { // supplementaries are always unsafe. API takes UChars
unsafeCPSet(t->unsafeCP, (UChar)uniChar);
unsafeCPSet(t->unsafeCP, (UChar)uniChar);
}
}

View File

@ -658,8 +658,8 @@ typedef enum {
/* It fits in a single 32 bit CE and is used instead of expansion to save */
/* space without affecting the performance (hopefully) */
DIGIT_TAG = 13, /* COllate Digits As Numbers (CODAN) implementation */
DIGIT_TAG = 13, /* COllate Digits As Numbers (CODAN) implementation */
CE_TAGS_COUNT
} UColCETags;

View File

@ -13,9 +13,9 @@
* created 02/22/2001
* created by: Vladimir Weinstein
*
* This module reads a tailoring rule string and produces a list of
* This module reads a tailoring rule string and produces a list of
* tokens that will be turned into collation elements
*
*
*/
#include "unicode/utypes.h"
@ -25,7 +25,7 @@
#include "unicode/ustring.h"
#include "unicode/uchar.h"
#include "unicode/uniset.h"
#include "ucol_tok.h"
#include "cmemory.h"
#include "util.h"
@ -41,10 +41,10 @@ uhash_hashTokens(const UHashTok k)
//int32_t len = (key & 0xFF000000)>>24;
int32_t len = (key->source & 0xFF000000)>>24;
int32_t inc = ((len - 32) / 32) + 1;
//const UChar *p = (key & 0x00FFFFFF) + rulesToParse;
const UChar *p = (key->source & 0x00FFFFFF) + key->rulesToParse;
const UChar *limit = p + len;
const UChar *limit = p + len;
while (p<limit) {
hash = (hash * 37) + *p;
@ -121,33 +121,33 @@ typedef struct {
static indirectBoundaries ucolIndirectBoundaries[15];
/*
static indirectBoundaries ucolIndirectBoundaries[11] = {
{ UCOL_RESET_TOP_VALUE, 0,
{ UCOL_RESET_TOP_VALUE, 0,
UCOL_NEXT_TOP_VALUE, 0 },
{ UCOL_FIRST_PRIMARY_IGNORABLE, 0,
{ UCOL_FIRST_PRIMARY_IGNORABLE, 0,
0, 0 },
{ UCOL_LAST_PRIMARY_IGNORABLE, UCOL_LAST_PRIMARY_IGNORABLE_CONT,
{ UCOL_LAST_PRIMARY_IGNORABLE, UCOL_LAST_PRIMARY_IGNORABLE_CONT,
0, 0 },
{ UCOL_FIRST_SECONDARY_IGNORABLE, 0,
{ UCOL_FIRST_SECONDARY_IGNORABLE, 0,
0, 0 },
{ UCOL_LAST_SECONDARY_IGNORABLE, 0,
{ UCOL_LAST_SECONDARY_IGNORABLE, 0,
0, 0 },
{ UCOL_FIRST_TERTIARY_IGNORABLE, 0,
{ UCOL_FIRST_TERTIARY_IGNORABLE, 0,
0, 0 },
{ UCOL_LAST_TERTIARY_IGNORABLE, 0,
{ UCOL_LAST_TERTIARY_IGNORABLE, 0,
0, 0 },
{ UCOL_FIRST_VARIABLE, 0,
{ UCOL_FIRST_VARIABLE, 0,
0, 0 },
{ UCOL_LAST_VARIABLE, 0,
{ UCOL_LAST_VARIABLE, 0,
0, 0 },
{ UCOL_FIRST_NON_VARIABLE, 0,
{ UCOL_FIRST_NON_VARIABLE, 0,
0, 0 },
{ UCOL_LAST_NON_VARIABLE, 0,
{ UCOL_LAST_NON_VARIABLE, 0,
0, 0 },
};
*/
static void setIndirectBoundaries(uint32_t indexR, uint32_t *start, uint32_t *end) {
static void setIndirectBoundaries(uint32_t indexR, uint32_t *start, uint32_t *end) {
// Set values for the top - TODO: once we have values for all the indirects, we are going
// to initalize here.
ucolIndirectBoundaries[indexR].startCE = start[0];
@ -162,25 +162,25 @@ static void setIndirectBoundaries(uint32_t indexR, uint32_t *start, uint32_t *en
}
static inline
void syntaxError(const UChar* rules,
static inline
void syntaxError(const UChar* rules,
int32_t pos,
int32_t rulesLen,
UParseError* parseError) {
parseError->offset = pos;
parseError->line = 0 ; /* we are not using line numbers */
// for pre-context
int32_t start = (pos <=U_PARSE_CONTEXT_LEN)? 0 : (pos - (U_PARSE_CONTEXT_LEN-1));
int32_t stop = pos;
u_memcpy(parseError->preContext,rules+start,stop-start);
//null terminate the buffer
parseError->preContext[stop-start] = 0;
//for post-context
start = pos+1;
stop = ((pos+U_PARSE_CONTEXT_LEN)<= rulesLen )? (pos+(U_PARSE_CONTEXT_LEN-1)) :
stop = ((pos+U_PARSE_CONTEXT_LEN)<= rulesLen )? (pos+(U_PARSE_CONTEXT_LEN-1)) :
rulesLen;
if(start < stop) {
@ -217,8 +217,8 @@ void ucol_uprv_tok_setOptionInImage(UColOptionSet *opts, UColAttribute attrib, U
opts->strength = value;
break;
case UCOL_NUMERIC_COLLATION:
opts->numericCollation = value;
break;
opts->numericCollation = value;
break;
case UCOL_ATTRIBUTE_COUNT:
default:
break;
@ -254,33 +254,33 @@ U_STRING_DECL(suboption_17, "trailing", 8);
U_STRING_DECL(option_00, "undefined", 9);
U_STRING_DECL(option_01, "rearrange", 9);
U_STRING_DECL(option_01, "rearrange", 9);
U_STRING_DECL(option_02, "alternate", 9);
U_STRING_DECL(option_03, "backwards", 9);
U_STRING_DECL(option_04, "variable top", 12);
U_STRING_DECL(option_05, "top", 3);
U_STRING_DECL(option_06, "normalization", 13);
U_STRING_DECL(option_07, "caseLevel", 9);
U_STRING_DECL(option_08, "caseFirst", 9);
U_STRING_DECL(option_09, "scriptOrder", 11);
U_STRING_DECL(option_10, "charsetname", 11);
U_STRING_DECL(option_11, "charset", 7);
U_STRING_DECL(option_12, "before", 6);
U_STRING_DECL(option_03, "backwards", 9);
U_STRING_DECL(option_04, "variable top", 12);
U_STRING_DECL(option_05, "top", 3);
U_STRING_DECL(option_06, "normalization", 13);
U_STRING_DECL(option_07, "caseLevel", 9);
U_STRING_DECL(option_08, "caseFirst", 9);
U_STRING_DECL(option_09, "scriptOrder", 11);
U_STRING_DECL(option_10, "charsetname", 11);
U_STRING_DECL(option_11, "charset", 7);
U_STRING_DECL(option_12, "before", 6);
U_STRING_DECL(option_13, "hiraganaQ", 9);
U_STRING_DECL(option_14, "strength", 8);
U_STRING_DECL(option_15, "first", 5);
U_STRING_DECL(option_16, "last", 4);
U_STRING_DECL(option_17, "optimize", 8);
U_STRING_DECL(option_18, "suppressContractions", 20);
U_STRING_DECL(option_19, "numericOrdering", 15);
U_STRING_DECL(option_19, "numericOrdering", 15);
/*
[last variable] last variable value
[last primary ignorable] largest CE for primary ignorable
[last secondary ignorable] largest CE for secondary ignorable
[last tertiary ignorable] largest CE for tertiary ignorable
[top] guaranteed to be above all implicit CEs, for now and in the future (in 1.8)
[last variable] last variable value
[last primary ignorable] largest CE for primary ignorable
[last secondary ignorable] largest CE for secondary ignorable
[last tertiary ignorable] largest CE for tertiary ignorable
[top] guaranteed to be above all implicit CEs, for now and in the future (in 1.8)
*/
@ -360,7 +360,7 @@ static const ucolTokOption rulesOptions[UTOK_OPTION_COUNT] = {
/*04*/ {option_06, 13, onOffSub, 2, UCOL_NORMALIZATION_MODE}, /*"normalization" */
/*05*/ {option_13, 9, onOffSub, 2, UCOL_HIRAGANA_QUATERNARY_MODE}, /*"hiraganaQ" */
/*06*/ {option_14, 8, strengthSub, 5, UCOL_STRENGTH}, /*"strength" */
/*07*/ {option_19, 15, onOffSub, 2, UCOL_NUMERIC_COLLATION}, /*"numericOrdering"*/
/*07*/ {option_19, 15, onOffSub, 2, UCOL_NUMERIC_COLLATION}, /*"numericOrdering"*/
/*08*/ {option_04, 12, NULL, 0, UCOL_ATTRIBUTE_COUNT}, /*"variable top" */
/*09*/ {option_01, 9, NULL, 0, UCOL_ATTRIBUTE_COUNT}, /*"rearrange" */
/*10*/ {option_12, 6, beforeSub, 3, UCOL_ATTRIBUTE_COUNT}, /*"before" */
@ -376,9 +376,9 @@ static const ucolTokOption rulesOptions[UTOK_OPTION_COUNT] = {
};
static
int32_t u_strncmpNoCase(const UChar *s1,
const UChar *s2,
int32_t n)
int32_t u_strncmpNoCase(const UChar *s1,
const UChar *s2,
int32_t n)
{
if(n > 0) {
int32_t rc;
@ -421,25 +421,25 @@ void ucol_uprv_tok_initData() {
U_STRING_INIT(option_00, "undefined", 9);
U_STRING_INIT(option_01, "rearrange", 9);
U_STRING_INIT(option_01, "rearrange", 9);
U_STRING_INIT(option_02, "alternate", 9);
U_STRING_INIT(option_03, "backwards", 9);
U_STRING_INIT(option_04, "variable top", 12);
U_STRING_INIT(option_05, "top", 3);
U_STRING_INIT(option_06, "normalization", 13);
U_STRING_INIT(option_07, "caseLevel", 9);
U_STRING_INIT(option_08, "caseFirst", 9);
U_STRING_INIT(option_09, "scriptOrder", 11);
U_STRING_INIT(option_10, "charsetname", 11);
U_STRING_INIT(option_11, "charset", 7);
U_STRING_INIT(option_12, "before", 6);
U_STRING_INIT(option_03, "backwards", 9);
U_STRING_INIT(option_04, "variable top", 12);
U_STRING_INIT(option_05, "top", 3);
U_STRING_INIT(option_06, "normalization", 13);
U_STRING_INIT(option_07, "caseLevel", 9);
U_STRING_INIT(option_08, "caseFirst", 9);
U_STRING_INIT(option_09, "scriptOrder", 11);
U_STRING_INIT(option_10, "charsetname", 11);
U_STRING_INIT(option_11, "charset", 7);
U_STRING_INIT(option_12, "before", 6);
U_STRING_INIT(option_13, "hiraganaQ", 9);
U_STRING_INIT(option_14, "strength", 8);
U_STRING_INIT(option_15, "first", 5);
U_STRING_INIT(option_16, "last", 4);
U_STRING_INIT(option_17, "optimize", 8);
U_STRING_INIT(option_18, "suppressContractions", 20);
U_STRING_INIT(option_19, "numericOrdering", 15);
U_STRING_INIT(option_19, "numericOrdering", 15);
didInit = TRUE;
}
}
@ -448,8 +448,8 @@ void ucol_uprv_tok_initData() {
// This function reads basic options to set in the runtime collator
// used by data driven tests. Should not support build time options
U_CAPI const UChar * U_EXPORT2
ucol_tok_getNextArgument(const UChar *start, const UChar *end,
UColAttribute *attrib, UColAttributeValue *value,
ucol_tok_getNextArgument(const UChar *start, const UChar *end,
UColAttribute *attrib, UColAttributeValue *value,
UErrorCode *status) {
uint32_t i = 0;
int32_t j=0;
@ -480,7 +480,7 @@ ucol_tok_getNextArgument(const UChar *start, const UChar *end,
while(u_isWhitespace(*optionArg)) { /* eat whitespace */
optionArg++;
}
}
}
break;
}
i++;
@ -515,12 +515,12 @@ ucol_tok_getNextArgument(const UChar *start, const UChar *end,
return NULL;
}
static
static
USet *ucol_uprv_tok_readAndSetUnicodeSet(const UChar *start, const UChar *end, UErrorCode *status) {
while(*start != 0x005b) { /* advance while we find the first '[' */
start++;
}
// now we need to get a balanced set of '[]'. The problem is that a set can have
// now we need to get a balanced set of '[]'. The problem is that a set can have
// many, and *end point to the first closing '['
int32_t noOpenBraces = 1;
int32_t current = 1; // skip the opening brace
@ -556,14 +556,14 @@ int32_t ucol_uprv_tok_readOption(const UChar *start, const UChar *end, const UCh
while(u_isWhitespace(**optionArg)) { /* eat whitespace */
(*optionArg)++;
}
}
}
break;
}
i++;
}
if(i == UTOK_OPTION_COUNT) {
i = -1; // didn't find an option
}
}
return i;
}
@ -573,7 +573,7 @@ int32_t ucol_uprv_tok_readOption(const UChar *start, const UChar *end, const UCh
// However, some of the options take an UnicodeSet definition
// which needs to duplicate the closing ']'
// for example: '[copy [\uAC00-\uD7FF]]'
// These options will move end to the second ']' and the
// These options will move end to the second ']' and the
// caller will set the current to it.
static
uint8_t ucol_uprv_tok_readAndSetOption(UColTokenParser *src, UErrorCode *status) {
@ -610,7 +610,7 @@ uint8_t ucol_uprv_tok_readAndSetOption(UColTokenParser *src, UErrorCode *status)
result = UCOL_TOK_SUCCESS;
}
}
}
}
if(result == 0) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
}
@ -698,7 +698,7 @@ inline void ucol_tok_addToExtraCurrent(UColTokenParser *src, const UChar *stuff,
src->extraCurrent += len;
}
}
inline UBool ucol_tok_doSetTop(UColTokenParser *src, UErrorCode *status) {
@ -718,7 +718,7 @@ inline UBool ucol_tok_doSetTop(UColTokenParser *src, UErrorCode *status) {
buff[4] = (UChar)(ucolIndirectBoundaries[src->parsedToken.indirectIndex].startContCE & 0xFFFF);
src->parsedToken.charsLen = 5;
ucol_tok_addToExtraCurrent(src, buff, 5, status);
}
}
return TRUE;
}
@ -737,10 +737,10 @@ static UBool isCharNewLine(UChar c){
}
U_CAPI const UChar* U_EXPORT2
ucol_tok_parseNextToken(UColTokenParser *src,
ucol_tok_parseNextToken(UColTokenParser *src,
UBool startOfRules,
UParseError *parseError,
UErrorCode *status) {
UErrorCode *status) {
/* parsing part */
UBool variableTop = FALSE;
UBool top = FALSE;
@ -756,7 +756,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
// more time (around 2020 probably).
uint32_t newExtensionLen = 0;
uint32_t extensionOffset = 0;
uint32_t newStrength = UCOL_TOK_UNSET;
uint32_t newStrength = UCOL_TOK_UNSET;
UChar buff[10];
src->parsedToken.charsOffset = 0; src->parsedToken.charsLen = 0;
@ -785,11 +785,11 @@ ucol_tok_parseNextToken(UColTokenParser *src,
}else if(isEscaped){
isEscaped =FALSE;
if (newStrength == UCOL_TOK_UNSET) {
*status = U_INVALID_FORMAT_ERROR;
*status = U_INVALID_FORMAT_ERROR;
syntaxError(src->source,(int32_t)(src->current-src->source),(int32_t)(src->end-src->source),parseError);
return NULL;
// enabling rules to start with non-tokens a < b
// newStrength = UCOL_TOK_RESET;
// newStrength = UCOL_TOK_RESET;
}
if(ch != 0x0000 && src->current != src->end) {
if (inChars) {
@ -808,7 +808,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
if(!uprv_isRuleWhiteSpace(ch)) {
/* Sets the strength for this entry */
switch (ch) {
case 0x003D/*'='*/ :
case 0x003D/*'='*/ :
if (newStrength != UCOL_TOK_UNSET) {
goto EndOfLoop;
}
@ -823,7 +823,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
newStrength = UCOL_IDENTICAL;
break;
case 0x002C/*','*/:
case 0x002C/*','*/:
if (newStrength != UCOL_TOK_UNSET) {
goto EndOfLoop;
}
@ -853,7 +853,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
newStrength = UCOL_SECONDARY;
break;
case 0x003C/*'<'*/:
case 0x003C/*'<'*/:
if (newStrength != UCOL_TOK_UNSET) {
goto EndOfLoop;
}
@ -880,7 +880,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
}
break;
case 0x0026/*'&'*/:
case 0x0026/*'&'*/:
if (newStrength != UCOL_TOK_UNSET) {
/**/
goto EndOfLoop;
@ -896,7 +896,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
//src->current = optionEnd;
if(U_SUCCESS(*status)) {
if(result & UCOL_TOK_TOP) {
if(newStrength == UCOL_TOK_RESET) {
if(newStrength == UCOL_TOK_RESET) {
top = ucol_tok_doSetTop(src, status);
if(before) { // This is a combination of before and indirection like '&[before 2][first regular]<b'
src->parsedToken.charsLen+=2;
@ -932,7 +932,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
syntaxError(src->source,(int32_t)(src->current-src->source),(int32_t)(src->end-src->source),parseError);
}
}
}
} else {
*status = U_INVALID_FORMAT_ERROR;
syntaxError(src->source,(int32_t)(src->current-src->source),(int32_t)(src->end-src->source),parseError);
@ -940,8 +940,8 @@ ucol_tok_parseNextToken(UColTokenParser *src,
}
}
break;
case 0x0021/*! skip java thai modifier reordering*/:
break;
case 0x0021/*! skip java thai modifier reordering*/:
break;
case 0x002F/*'/'*/:
wasInQuote = FALSE; /* if we were copying source characters, we want to stop now */
inChars = FALSE; /* we're now processing expansion */
@ -952,10 +952,10 @@ ucol_tok_parseNextToken(UColTokenParser *src,
/* found a quote, we're gonna start copying */
case 0x0027/*'\''*/:
if (newStrength == UCOL_TOK_UNSET) { /* quote is illegal until we have a strength */
*status = U_INVALID_FORMAT_ERROR;
*status = U_INVALID_FORMAT_ERROR;
syntaxError(src->source,(int32_t)(src->current-src->source),(int32_t)(src->end-src->source),parseError);
return NULL;
// enabling rules to start with a non-token character a < b
// enabling rules to start with a non-token character a < b
// newStrength = UCOL_TOK_RESET;
}
@ -981,7 +981,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
wasInQuote = TRUE;
ch = *(++(src->current));
ch = *(++(src->current));
if(ch == 0x0027) { /* copy the double quote */
ucol_tok_addToExtraCurrent(src, &ch, 1, status);
inQuote = FALSE;
@ -999,7 +999,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
case 0x007C /*|*/: /* this means we have actually been reading prefix part */
// we want to store read characters to the prefix part and continue reading
// the characters (proper way would be to restart reading the chars, but in
// that case we would have to complicate the token hasher, which I do not
// that case we would have to complicate the token hasher, which I do not
// intend to play with. Instead, we will do prefixes when prefixes are due
// (before adding the elements).
src->parsedToken.prefixOffset = src->parsedToken.charsOffset;
@ -1018,11 +1018,11 @@ ucol_tok_parseNextToken(UColTokenParser *src,
wasInQuote = TRUE;
do {
ch = *(++(src->current));
ch = *(++(src->current));
// skip whitespace between '|' and the character
} while (uprv_isRuleWhiteSpace(ch));
break;
//charsOffset = 0;
//newCharsLen = 0;
//break; // We want to store the whole prefix/character sequence. If we break
@ -1035,7 +1035,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
break;
default:
if (newStrength == UCOL_TOK_UNSET) {
*status = U_INVALID_FORMAT_ERROR;
*status = U_INVALID_FORMAT_ERROR;
syntaxError(src->source,(int32_t)(src->current-src->source),(int32_t)(src->end-src->source),parseError);
return NULL;
}
@ -1063,7 +1063,7 @@ ucol_tok_parseNextToken(UColTokenParser *src,
}
break;
}
}
}
}
@ -1085,12 +1085,12 @@ ucol_tok_parseNextToken(UColTokenParser *src,
}
if (src->parsedToken.charsLen == 0 && top == FALSE) {
syntaxError(src->source,(int32_t)(src->current-src->source),(int32_t)(src->end-src->source),parseError);
syntaxError(src->source,(int32_t)(src->current-src->source),(int32_t)(src->end-src->source),parseError);
*status = U_INVALID_FORMAT_ERROR;
return NULL;
}
src->parsedToken.strength = newStrength;
src->parsedToken.strength = newStrength;
src->parsedToken.extensionOffset = extensionOffset;
src->parsedToken.extensionLen = newExtensionLen;
src->parsedToken.flags = (UCOL_TOK_VARIABLE_TOP * (variableTop?1:0)) | (UCOL_TOK_TOP * (top?1:0)) | before;
@ -1100,11 +1100,11 @@ ucol_tok_parseNextToken(UColTokenParser *src,
/*
Processing Description
1 Build a ListList. Each list has a header, which contains two lists (positive
and negative), a reset token, a baseCE, nextCE, and previousCE. The lists and
reset may be null.
2 As you process, you keep a LAST pointer that points to the last token you
handled.
1 Build a ListList. Each list has a header, which contains two lists (positive
and negative), a reset token, a baseCE, nextCE, and previousCE. The lists and
reset may be null.
2 As you process, you keep a LAST pointer that points to the last token you
handled.
*/
static UColToken *ucol_tok_initAReset(UColTokenParser *src, UChar *expand, uint32_t *expandNext,
@ -1136,7 +1136,7 @@ static UColToken *ucol_tok_initAReset(UColTokenParser *src, UChar *expand, uint3
sourceToken->flags = src->parsedToken.flags;
if(src->parsedToken.prefixOffset != 0) {
// this is a syntax error
// this is a syntax error
*status = U_INVALID_FORMAT_ERROR;
syntaxError(src->source,src->parsedToken.charsOffset-1,src->parsedToken.charsOffset+src->parsedToken.charsLen,parseError);
return 0;
@ -1160,13 +1160,13 @@ static UColToken *ucol_tok_initAReset(UColTokenParser *src, UChar *expand, uint3
src->lh[src->resultLen].reset = sourceToken;
/*
3 Consider each item: relation, source, and expansion: e.g. ...< x / y ...
First convert all expansions into normal form. Examples:
If "xy" doesn't occur earlier in the list or in the UCA, convert &xy * c *
d * ... into &x * c/y * d * ...
Note: reset values can never have expansions, although they can cause the
very next item to have one. They may be contractions, if they are found
earlier in the list.
3 Consider each item: relation, source, and expansion: e.g. ...< x / y ...
First convert all expansions into normal form. Examples:
If "xy" doesn't occur earlier in the list or in the UCA, convert &xy * c *
d * ... into &x * c/y * d * ...
Note: reset values can never have expansions, although they can cause the
very next item to have one. They may be contractions, if they are found
earlier in the list.
*/
if(expand != NULL) {
/* check to see if there is an expansion */
@ -1198,9 +1198,9 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
uint32_t CE, SecondCE;
uint32_t invPos;
if(sourceToken != NULL) {
uprv_init_collIterate(src->UCA, src->source+((sourceToken->source)&0xFFFFFF), 1, &s);
uprv_init_collIterate(src->UCA, src->source+((sourceToken->source)&0xFFFFFF), 1, &s);
} else {
uprv_init_collIterate(src->UCA, src->source+src->parsedToken.charsOffset /**charsOffset*/, 1, &s);
uprv_init_collIterate(src->UCA, src->source+src->parsedToken.charsOffset /**charsOffset*/, 1, &s);
}
baseCE = ucol_getNextCE(src->UCA, &s, status) & 0xFFFFFF3F;
@ -1215,7 +1215,7 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
uint32_t expandNext = 0;
UColToken key;
if((baseCE & 0xFF000000) >= (consts->UCA_PRIMARY_IMPLICIT_MIN<<24) && (baseCE & 0xFF000000) <= (consts->UCA_PRIMARY_IMPLICIT_MAX<<24) ) { /* implicits - */
if((baseCE & 0xFF000000) >= (consts->UCA_PRIMARY_IMPLICIT_MIN<<24) && (baseCE & 0xFF000000) <= (consts->UCA_PRIMARY_IMPLICIT_MAX<<24) ) { /* implicits - */
uint32_t primary = baseCE & UCOL_PRIMARYMASK | (baseContCE & UCOL_PRIMARYMASK) >> 16;
uint32_t raw = uprv_uca_getRawFromImplicit(primary);
ch = uprv_uca_getCodePointFromRaw(raw-1);
@ -1248,7 +1248,7 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
src->lh[src->resultLen].indirect = FALSE;
sourceToken = ucol_tok_initAReset(src, 0, &expandNext, parseError, status);
sourceToken = ucol_tok_initAReset(src, 0, &expandNext, parseError, status);
}
} else {
@ -1256,11 +1256,11 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
// we got the previous CE. Now we need to see if the difference between
// the two CEs is really of the requested strength.
// if it's a bigger difference (we asked for secondary and got primary), we
// if it's a bigger difference (we asked for secondary and got primary), we
// need to modify the CE.
if(ucol_getCEStrengthDifference(baseCE, baseContCE, CE, SecondCE) < strength) {
// adjust the strength
// now we are in the situation where our baseCE should actually be modified in
// now we are in the situation where our baseCE should actually be modified in
// order to get the CE in the right position.
if(strength == UCOL_SECONDARY) {
CE = baseCE - 0x0200;
@ -1282,8 +1282,8 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
// 1. There are many code points that have the same CE
// 2. The CE to codepoint table (things pointed to by CETable[3*invPos+2] are broken.
// Also, in case when there is no equivalent strength before an element, we have to actually
// construct one. For example, &[before 2]a << x won't result in x << a, because the element
// before a is a primary difference.
// construct one. For example, &[before 2]a << x won't result in x << a, because the element
// before a is a primary difference.
//uint32_t *CETable = (uint32_t *)((uint8_t *)src->invUCA+src->invUCA->table);
@ -1294,7 +1294,7 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
uint16_t *conts = (uint16_t *)((uint8_t *)src->invUCA+src->invUCA->conts);
uint32_t offset = (ch & UCOL_INV_OFFSETMASK);
ch = conts[offset];
}
}
*src->extraCurrent++ = (UChar)ch;
src->parsedToken.charsOffset = (uint32_t)(src->extraCurrent - src->source - 1);
@ -1304,8 +1304,8 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
// example:
// &\u30ca = \u306a
// &[before 3]\u306a<<<\u306a|\u309d
// uint32_t key = (*newCharsLen << 24) | *charsOffset;
key.source = (src->parsedToken.charsLen/**newCharsLen*/ << 24) | src->parsedToken.charsOffset/**charsOffset*/;
key.rulesToParse = src->source;
@ -1314,19 +1314,19 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
sourceToken = (UColToken *)uhash_get(src->tailored, &key);
#endif
// here is how it should be. The situation such as &[before 1]a < x, should be
// resolved exactly as if we wrote &a > x.
// here is how it should be. The situation such as &[before 1]a < x, should be
// resolved exactly as if we wrote &a > x.
// therefore, I don't really care if the UCA value before a has been changed.
// However, I do care if the strength between my element and the previous element
// is bigger then I wanted. So, if CE < baseCE and I wanted &[before 2], then i'll
// is bigger then I wanted. So, if CE < baseCE and I wanted &[before 2], then i'll
// have to construct the base CE.
// if we found a tailored thing, we have to use the UCA value and construct
// if we found a tailored thing, we have to use the UCA value and construct
// a new reset token with constructed name
//if(sourceToken != NULL && sourceToken->strength != UCOL_TOK_RESET) {
// character to which we want to anchor is already tailored.
// character to which we want to anchor is already tailored.
// We need to construct a new token which will be the anchor
// point
//*(src->extraCurrent-1) = 0xFFFE;
@ -1347,7 +1347,7 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
src->lh[src->resultLen].indirect = FALSE;
sourceToken = ucol_tok_initAReset(src, 0, &expandNext, parseError, status);
sourceToken = ucol_tok_initAReset(src, 0, &expandNext, parseError, status);
//}
}
@ -1364,7 +1364,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
uint16_t specs = 0;
UColTokListHeader *ListList = NULL;
src->parsedToken.strength = UCOL_TOK_UNSET;
src->parsedToken.strength = UCOL_TOK_UNSET;
ListList = src->lh;
@ -1374,8 +1374,8 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
while(src->current < src->end) {
src->parsedToken.prefixOffset = 0;
parseEnd = ucol_tok_parseNextToken(src,
parseEnd = ucol_tok_parseNextToken(src,
(UBool)(lastToken == NULL),
parseError,
status);
@ -1390,7 +1390,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
UColToken *sourceToken = NULL;
//uint32_t key = 0;
uint32_t lastStrength = UCOL_TOK_UNSET;
if(lastToken != NULL ) {
lastStrength = lastToken->strength;
}
@ -1461,12 +1461,12 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
sourceToken->listHeader = lastToken->listHeader;
/*
1. Find the strongest strength in each list, and set strongestP and strongestN
accordingly in the headers.
1. Find the strongest strength in each list, and set strongestP and strongestN
accordingly in the headers.
*/
if(lastStrength == UCOL_TOK_RESET
if(lastStrength == UCOL_TOK_RESET
|| sourceToken->listHeader->first == 0) {
/* If LAST is a reset
/* If LAST is a reset
insert sourceToken in the list. */
if(sourceToken->listHeader->first == 0) {
sourceToken->listHeader->first = sourceToken;
@ -1494,12 +1494,12 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
}
}
} else {
/* Otherwise (when LAST is not a reset)
if polarity (LAST) == polarity(relation), insert sourceToken after LAST,
otherwise insert before.
when inserting after or before, search to the next position with the same
/* Otherwise (when LAST is not a reset)
if polarity (LAST) == polarity(relation), insert sourceToken after LAST,
otherwise insert before.
when inserting after or before, search to the next position with the same
strength in that direction. (This is called postpone insertion). */
if(sourceToken != lastToken) {
if(sourceToken != lastToken) {
if(lastToken->polarity == sourceToken->polarity) {
while(lastToken->next != NULL && lastToken->next->strength > sourceToken->strength) {
lastToken = lastToken->next;
@ -1540,8 +1540,8 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
}
// Treat the expansions.
// There are two types of expansions: explicit (x / y) and reset based propagating expansions
// (&abc * d * e <=> &ab * d / c * e / c)
// There are two types of expansions: explicit (x / y) and reset based propagating expansions
// (&abc * d * e <=> &ab * d / c * e / c)
// if both of them are in effect for a token, they are combined.
sourceToken->expansion = src->parsedToken.extensionLen << 24 | src->parsedToken.extensionOffset;
@ -1568,7 +1568,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
// if the previous token was a reset before, the strength of this
// token must match the strength of before. Otherwise we have an
// undefined situation.
// In other words, we currently have a cludge which we use to
// In other words, we currently have a cludge which we use to
// represent &a >> x. This is written as &[before 2]a << x.
if((lastToken->flags & UCOL_TOK_BEFORE) != 0) {
uint8_t beforeStrength = (lastToken->flags & UCOL_TOK_BEFORE) - 1;
@ -1606,7 +1606,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
if((specs & UCOL_TOK_BEFORE) != 0) { /* we're doing before */
if(top == FALSE) { /* there is no indirection */
uint8_t strength = (specs & UCOL_TOK_BEFORE) - 1;
if(sourceToken != NULL && sourceToken->strength != UCOL_TOK_RESET) {
if(sourceToken != NULL && sourceToken->strength != UCOL_TOK_RESET) {
/* this is a before that is already ordered in the UCA - so we need to get the previous with good strength */
while(sourceToken->strength > strength && sourceToken->previous != NULL) {
sourceToken = sourceToken->previous;
@ -1617,7 +1617,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
sourceToken = sourceToken->previous;
} else { /* start of list */
sourceToken = sourceToken->listHeader->reset;
}
}
} else { /* we hit NULL */
/* we should be doing the else part */
sourceToken = sourceToken->listHeader->reset;
@ -1640,7 +1640,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
uint32_t CE = UCOL_NOT_FOUND, SecondCE = UCOL_NOT_FOUND;
UCAConstants *consts = (UCAConstants *)((uint8_t *)src->UCA->image + src->UCA->image->UCAConsts);
if((baseCE & 0xFF000000) >= (consts->UCA_PRIMARY_IMPLICIT_MIN<<24) && (baseCE & 0xFF000000) <= (consts->UCA_PRIMARY_IMPLICIT_MAX<<24) ) { /* implicits - */
if((baseCE & 0xFF000000) >= (consts->UCA_PRIMARY_IMPLICIT_MIN<<24) && (baseCE & 0xFF000000) <= (consts->UCA_PRIMARY_IMPLICIT_MAX<<24) ) { /* implicits - */
uint32_t primary = baseCE & UCOL_PRIMARYMASK | (baseContCE & UCOL_PRIMARYMASK) >> 16;
uint32_t raw = uprv_uca_getRawFromImplicit(primary);
uint32_t primaryCE = uprv_uca_getImplicitFromRaw(raw-1);
@ -1661,19 +1661,19 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
}
/* 5 If the relation is a reset:
If sourceToken is null
Create new list, create new sourceToken, make the baseCE from source, put
/* 5 If the relation is a reset:
If sourceToken is null
Create new list, create new sourceToken, make the baseCE from source, put
the sourceToken in ListHeader of the new list */
if(sourceToken == NULL) {
/*
3 Consider each item: relation, source, and expansion: e.g. ...< x / y ...
First convert all expansions into normal form. Examples:
If "xy" doesn't occur earlier in the list or in the UCA, convert &xy * c *
d * ... into &x * c/y * d * ...
Note: reset values can never have expansions, although they can cause the
very next item to have one. They may be contractions, if they are found
earlier in the list.
3 Consider each item: relation, source, and expansion: e.g. ...< x / y ...
First convert all expansions into normal form. Examples:
If "xy" doesn't occur earlier in the list or in the UCA, convert &xy * c *
d * ... into &x * c/y * d * ...
Note: reset values can never have expansions, although they can cause the
very next item to have one. They may be contractions, if they are found
earlier in the list.
*/
if(top == FALSE) {
collIterate s;
@ -1715,7 +1715,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
top = FALSE;
}
}
/* 7 After all this, set LAST to point to sourceToken, and goto step 3. */
/* 7 After all this, set LAST to point to sourceToken, and goto step 3. */
lastToken = sourceToken;
} else {
if(U_FAILURE(*status)) {
@ -1736,10 +1736,10 @@ void ucol_tok_initTokenList(UColTokenParser *src, const UChar *rules, const uint
if(U_FAILURE(*status)) {
return;
}
// set everything to zero, so that we can clean up gracefully
uprv_memset(src, 0, sizeof(UColTokenParser));
// first we need to find options that don't like to be normalized,
// like copy and remove...
//const UChar *openBrace = rules;
@ -1850,7 +1850,7 @@ void ucol_tok_initTokenList(UColTokenParser *src, const UChar *rules, const uint
UCAConstants *consts = (UCAConstants *)((uint8_t *)src->UCA->image + src->UCA->image->UCAConsts);
// UCOL_RESET_TOP_VALUE
setIndirectBoundaries(0, consts->UCA_LAST_NON_VARIABLE, consts->UCA_FIRST_IMPLICIT);
setIndirectBoundaries(0, consts->UCA_LAST_NON_VARIABLE, consts->UCA_FIRST_IMPLICIT);
// UCOL_FIRST_PRIMARY_IGNORABLE
setIndirectBoundaries(1, consts->UCA_FIRST_PRIMARY_IGNORABLE, 0);
// UCOL_LAST_PRIMARY_IGNORABLE

View File

@ -809,7 +809,7 @@ public:
UnicodeString& appendTo,
FieldPosition& pos) const;
/**
/**
* Format a Formattable using base-10 representation.
*
* @param obj The value to be formatted.
@ -1649,7 +1649,7 @@ public:
private:
DecimalFormat(); // default constructor not implemented
int32_t precision(UBool isIntegral) const;
int32_t precision(UBool isIntegral) const;
/**
* Do real work of constructing a new DecimalFormat.
@ -1861,7 +1861,7 @@ protected:
* end up with lots of zeroes.
* @draft ICU 2.8
*/
static const int32_t kMaxScientificIntegerDigits;
static const int32_t kMaxScientificIntegerDigits;
};
inline UnicodeString&

View File

@ -303,8 +303,8 @@ public:
/**
* Format an int64 number. (Not abstract to retain compatibility
* with earlier releases, however subclasses should override this
* method as it just delegates to format(int32_t number...);
* with earlier releases, however subclasses should override this
* method as it just delegates to format(int32_t number...);
*
* @param number The value to be formatted.
* @param appendTo Output parameter to receive result.

View File

@ -704,7 +704,7 @@ public:
* @draft ICU 3.2
*/
virtual UnicodeString getRuleSetDisplayName(int32_t index,
const Locale& locale = Locale::getDefault());
const Locale& locale = Locale::getDefault());
/**
* Return the rule set display name for the provided rule set and locale.
@ -715,7 +715,7 @@ public:
* @see #getRuleSetDisplayNames
*/
virtual UnicodeString getRuleSetDisplayName(const UnicodeString& ruleSetName,
const Locale& locale = Locale::getDefault());
const Locale& locale = Locale::getDefault());
/**
* Formats the specified 32-bit number using the default ruleset.
@ -963,7 +963,7 @@ private:
// this will ref the localizations if they are not NULL
// caller must deref to get adoption
RuleBasedNumberFormat(const UnicodeString& description, LocalizationInfo* localizations,
const Locale& locale, UParseError& perror, UErrorCode& status);
const Locale& locale, UParseError& perror, UErrorCode& status);
void init(const UnicodeString& rules, LocalizationInfo* localizations, UParseError& perror, UErrorCode& status);
void dispose();

View File

@ -258,7 +258,7 @@ U_STABLE void U_EXPORT2 usearch_close(UStringSearch *searchiter);
* header comments
* @param strsrch search iterator data struct
* @param position position to start next search from. If position is less
* than or greater than the text range for searching,
* than or greater than the text range for searching,
* an U_INDEX_OUTOFBOUNDS_ERROR will be returned
* @param status error status if any.
* @stable ICU 2.4

View File

@ -565,7 +565,7 @@ unum_getDoubleAttribute(const UNumberFormat* fmt,
UNumberFormatAttribute attr)
{
if (((const NumberFormat*)fmt)->getDynamicClassID() == DecimalFormat::getStaticClassID() &&
attr == UNUM_ROUNDING_INCREMENT) {
attr == UNUM_ROUNDING_INCREMENT) {
return ((const DecimalFormat*)fmt)->getRoundingIncrement();
} else {
return -1.0;
@ -578,7 +578,7 @@ unum_setDoubleAttribute( UNumberFormat* fmt,
double newValue)
{
if (((NumberFormat*)fmt)->getDynamicClassID() == DecimalFormat::getStaticClassID() &&
attr == UNUM_ROUNDING_INCREMENT) {
attr == UNUM_ROUNDING_INCREMENT) {
((DecimalFormat*)fmt)->setRoundingIncrement(newValue);
}
}
@ -635,16 +635,16 @@ unum_getTextAttribute(const UNumberFormat* fmt,
U_ASSERT(((const NumberFormat*)fmt)->getDynamicClassID() == RuleBasedNumberFormat::getStaticClassID());
const RuleBasedNumberFormat* rbnf = (const RuleBasedNumberFormat*)fmt;
if (tag == UNUM_DEFAULT_RULESET) {
res = rbnf->getDefaultRuleSetName();
res = rbnf->getDefaultRuleSetName();
} else if (tag == UNUM_PUBLIC_RULESETS) {
int32_t count = rbnf->getNumberOfRuleSetNames();
for (int i = 0; i < count; ++i) {
res += rbnf->getRuleSetName(i);
res += (UChar)0x003b; // semicolon
}
int32_t count = rbnf->getNumberOfRuleSetNames();
for (int i = 0; i < count; ++i) {
res += rbnf->getRuleSetName(i);
res += (UChar)0x003b; // semicolon
}
} else {
*status = U_UNSUPPORTED_ERROR;
return -1;
*status = U_UNSUPPORTED_ERROR;
return -1;
}
}
@ -698,9 +698,9 @@ unum_setTextAttribute( UNumberFormat* fmt,
} else {
U_ASSERT(((NumberFormat*)fmt)->getDynamicClassID() == RuleBasedNumberFormat::getStaticClassID());
if (tag == UNUM_DEFAULT_RULESET) {
((RuleBasedNumberFormat*)fmt)->setDefaultRuleSet(newValue, *status);
((RuleBasedNumberFormat*)fmt)->setDefaultRuleSet(newValue, *status);
} else {
*status = U_UNSUPPORTED_ERROR;
*status = U_UNSUPPORTED_ERROR;
}
}
}

View File

@ -1133,13 +1133,13 @@ TestJitterbug1098(){
u_uastrcpy(rule, rules[i]);
c1 = ucol_openRules(rule, u_strlen(rule), UCOL_OFF, UCOL_DEFAULT_STRENGTH, &parseError, &status);
if(U_FAILURE(status)){
log_err("Could not parse the rules syntax. Error: %s ", u_errorName(status));
log_err("Could not parse the rules syntax. Error: %s ", u_errorName(status));
if (status == U_PARSE_ERROR) {
u_UCharsToChars(parseError.preContext,preContext,20);
u_UCharsToChars(parseError.postContext,postContext,20);
log_verbose("\n\tPre-Context: %s \n\tPost-Context:%s \n",preContext,postContext);
}
if (status == U_PARSE_ERROR) {
u_UCharsToChars(parseError.preContext,preContext,20);
u_UCharsToChars(parseError.postContext,postContext,20);
log_verbose("\n\tPre-Context: %s \n\tPost-Context:%s \n",preContext,postContext);
}
return;
}

View File

@ -30,7 +30,7 @@
#include "putilimp.h"
static void TestAttribute(void);
int TestBufferSize(); /* defined in "colutil.c" */
int TestBufferSize(); /* defined in "colutil.c" */
@ -517,10 +517,10 @@ void TestRuleBasedColl()
/* testing with en since thai has its own tailoring */
uint32_t ce = ucol_next(iter1, &status);
uint32_t ce2 = ucol_next(iter2, &status);
if(U_FAILURE(status)) {
if(U_FAILURE(status)) {
log_err("ERROR: CollationElement iterator creation failed.: %s\n", myErrorName(status));
return;
}
}
if (ce2 != ce) {
log_err("! modifier test failed");
}

View File

@ -81,7 +81,7 @@ static UChar* toUChar(const char *src, void **freeHook) {
return NULL;
};
cnv = ucnv_open(NULL, &status);
cnv = ucnv_open(NULL, &status);
if(U_FAILURE(status) || cnv == NULL) {
return NULL;
}

View File

@ -315,47 +315,47 @@ testLevels20[]={
static const uint8_t
testText16[]={
L, L, L, WS, L, L, L, WS, L, L, L
L, L, L, WS, L, L, L, WS, L, L, L
};
static const UBiDiLevel
testLevels21[]={
2, 2, 2, 2, 2, 2, 2, 1
2, 2, 2, 2, 2, 2, 2, 1
};
static const uint8_t
testVisualMap20[]={
1, 2, 3, 4, 5, 6, 7, 0
1, 2, 3, 4, 5, 6, 7, 0
};
static const uint8_t
testText17[]={
R, R, R, WS, R, R, R, WS, R, R, R
R, R, R, WS, R, R, R, WS, R, R, R
};
static const UBiDiLevel
testLevels22[]={
1, 1, 1, 1, 1, 1, 1, 0
1, 1, 1, 1, 1, 1, 1, 0
};
static const uint8_t
testVisualMap21[]={
6, 5, 4, 3, 2, 1, 0, 7
6, 5, 4, 3, 2, 1, 0, 7
};
static const uint8_t
testTextXX[]={
L
L
};
static const UBiDiLevel
testLevelsXX[]={
2
2
};
static const uint8_t
testVisualMapXX[]={
0
0
};
BiDiTestData
@ -420,12 +420,12 @@ tests[]={
{testText15, ARRAY_LENGTH(testText15), UBIDI_DEFAULT_LTR, 2, 3,
UBIDI_LTR, 2,
testLevels20, testVisualMap19},
{testText16, ARRAY_LENGTH(testText16), UBIDI_RTL, 0, 8,
UBIDI_MIXED, 1,
testLevels21, testVisualMap20},
{testText17, ARRAY_LENGTH(testText17), UBIDI_LTR, 0, 8,
UBIDI_MIXED, 0,
testLevels22, testVisualMap21},
{testText16, ARRAY_LENGTH(testText16), UBIDI_RTL, 0, 8,
UBIDI_MIXED, 1,
testLevels21, testVisualMap20},
{testText17, ARRAY_LENGTH(testText17), UBIDI_LTR, 0, 8,
UBIDI_MIXED, 0,
testLevels22, testVisualMap21},
{testTextXX, ARRAY_LENGTH(testTextXX), UBIDI_RTL, -1, -1,
UBIDI_MIXED, 1, testLevelsXX, testVisualMapXX}
};

View File

@ -123,7 +123,7 @@ doBiDiTest() {
pLine=ubidi_open();
if(pLine!=NULL) {
doTests(pBiDi, pLine, FALSE);
doTests(pBiDi, pLine, TRUE);
doTests(pBiDi, pLine, TRUE);
} else {
log_err("ubidi_open() returned NULL, out of memory\n");
}
@ -463,18 +463,18 @@ doTest(UBiDi *pBiDi, int testNumber, BiDiTestData *test, int32_t lineStart, UBoo
UErrorCode errorCode=U_ZERO_ERROR;
UBiDiLevel level, level2;
if (countRunsFirst) {
log_verbose("Calling ubidi_countRuns() first.\n");
if (countRunsFirst) {
log_verbose("Calling ubidi_countRuns() first.\n");
runCount = ubidi_countRuns(pBiDi, &errorCode);
runCount = ubidi_countRuns(pBiDi, &errorCode);
if(U_FAILURE(errorCode)) {
log_err("ubidi_countRuns(tests[%d]): error %s\n", testNumber, myErrorName(errorCode));
return;
}
} else {
log_verbose("Calling ubidi_getLogicalMap() first.\n");
}
if(U_FAILURE(errorCode)) {
log_err("ubidi_countRuns(tests[%d]): error %s\n", testNumber, myErrorName(errorCode));
return;
}
} else {
log_verbose("Calling ubidi_getLogicalMap() first.\n");
}
testReordering(pBiDi, testNumber);
@ -529,13 +529,13 @@ doTest(UBiDi *pBiDi, int testNumber, BiDiTestData *test, int32_t lineStart, UBoo
}
}
if (! countRunsFirst) {
runCount=ubidi_countRuns(pBiDi, &errorCode);
if(U_FAILURE(errorCode)) {
log_err("ubidi_countRuns(tests[%d]): error %s\n", testNumber, myErrorName(errorCode));
return;
}
}
if (! countRunsFirst) {
runCount=ubidi_countRuns(pBiDi, &errorCode);
if(U_FAILURE(errorCode)) {
log_err("ubidi_countRuns(tests[%d]): error %s\n", testNumber, myErrorName(errorCode));
return;
}
}
for(logicalIndex=0; logicalIndex<len;) {
level=ubidi_getLevelAt(pBiDi, logicalIndex);

View File

@ -1883,7 +1883,7 @@ static void TestCCSID() {
errorCode=U_ZERO_ERROR;
cnv=ucnv_openCCSID(ccsid, UCNV_IBM, &errorCode);
if(U_FAILURE(errorCode)) {
log_data_err("error: ucnv_openCCSID(%ld) failed (%s)\n", ccsid, u_errorName(errorCode));
log_data_err("error: ucnv_openCCSID(%ld) failed (%s)\n", ccsid, u_errorName(errorCode));
continue;
}

View File

@ -126,7 +126,7 @@ static void TestDateFormat()
log_verbose("Testing open of %s\n", udat_getAvailable(i));
any = udat_open(UDAT_SHORT, UDAT_SHORT, udat_getAvailable(i), NULL ,0, NULL, 0, &status);
if(U_FAILURE(subStatus)) {
log_data_err("FAIL: date format %s (getAvailable(%d)) is not instantiable: %s\n", udat_getAvailable(i), i, u_errorName(subStatus));
log_data_err("FAIL: date format %s (getAvailable(%d)) is not instantiable: %s\n", udat_getAvailable(i), i, u_errorName(subStatus));
}
udat_close(any);
}

View File

@ -2002,7 +2002,7 @@ static void TestDisplayKeywordValues(void){
}
}
}
static void TestGetBaseName(void) {
struct {
@ -2289,17 +2289,17 @@ static void TestAcceptLanguage(void) {
/*1*/ "ja;q=0.5, en;q=0.8, tlh",
/*2*/ "en-wf, de-lx;q=0.8",
/*3*/ "mga-ie;q=0.9, tlh",
/*4*/ "xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"es"
/*4*/ "xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, "
"es"
};
for(i=0;i<numTests;i++) {

View File

@ -585,7 +585,7 @@ static void testCollator(UCollator *coll, UErrorCode *status) {
if(lastReset == TRUE && prefixLen != 0) {
u_strncpy(first+prefixLen, first, firstLen);
u_strncpy(first, rulesCopy+prefixOffset, prefixLen);
u_strncpy(first, rulesCopy+prefixOffset, prefixLen);
first[firstLen+prefixLen] = 0;
firstLen = firstLen+prefixLen;
}
@ -634,7 +634,7 @@ static void testCollator(UCollator *coll, UErrorCode *status) {
}
if(before == TRUE && strength != UCOL_TOK_RESET) { /* first and second were swapped */
before = FALSE;
before = FALSE;
} else {
firstLen = chLen;
firstEx = exLen;
@ -989,8 +989,8 @@ static void testAgainstUCA(UCollator *coll, UCollator *UCA, const char *refName,
}
}
/*
* Takes two CEs (lead and continuation) and
/*
* Takes two CEs (lead and continuation) and
* compares them as CEs should be compared:
* primary vs. primary, secondary vs. secondary
* tertiary vs. tertiary
@ -1001,8 +1001,8 @@ static int32_t compareCEs(uint32_t s1, uint32_t s2,
if(s1 == t1 && s2 == t2) {
return 0;
}
s = (s1 & 0xFFFF0000)|((s2 & 0xFFFF0000)>>16);
t = (t1 & 0xFFFF0000)|((t2 & 0xFFFF0000)>>16);
s = (s1 & 0xFFFF0000)|((s2 & 0xFFFF0000)>>16);
t = (t1 & 0xFFFF0000)|((t2 & 0xFFFF0000)>>16);
if(s < t) {
return -1;
} else if(s > t) {
@ -1049,8 +1049,8 @@ typedef struct {
/* primary ignorable). */
static indirectBoundaries ucolIndirectBoundaries[15];
static UBool indirectBoundariesSet = FALSE;
static void setIndirectBoundaries(uint32_t indexR, uint32_t *start, uint32_t *end) {
static void setIndirectBoundaries(uint32_t indexR, uint32_t *start, uint32_t *end) {
/* Set values for the top - TODO: once we have values for all the indirects, we are going */
/* to initalize here. */
ucolIndirectBoundaries[indexR].startCE = start[0];
@ -1096,7 +1096,7 @@ static void testCEs(UCollator *coll, UErrorCode *status) {
UCAConstants *consts = (UCAConstants *)((uint8_t *)UCA->image + UCA->image->UCAConsts);
uint32_t UCOL_RESET_TOP_VALUE = consts->UCA_LAST_NON_VARIABLE[0], /*UCOL_RESET_TOP_CONT = consts->UCA_LAST_NON_VARIABLE[1], */
UCOL_NEXT_TOP_VALUE = consts->UCA_FIRST_IMPLICIT[0], UCOL_NEXT_TOP_CONT = consts->UCA_FIRST_IMPLICIT[1];
baseCE=baseContCE=nextCE=nextContCE=currCE=currContCE=lastCE=lastContCE = UCOL_NOT_FOUND;
src.opts = &opts;
@ -1107,7 +1107,7 @@ static void testCEs(UCollator *coll, UErrorCode *status) {
if(indirectBoundariesSet == FALSE) {
/* UCOL_RESET_TOP_VALUE */
setIndirectBoundaries(0, consts->UCA_LAST_NON_VARIABLE, consts->UCA_FIRST_IMPLICIT);
setIndirectBoundaries(0, consts->UCA_LAST_NON_VARIABLE, consts->UCA_FIRST_IMPLICIT);
/* UCOL_FIRST_PRIMARY_IGNORABLE */
setIndirectBoundaries(1, consts->UCA_FIRST_PRIMARY_IGNORABLE, 0);
/* UCOL_LAST_PRIMARY_IGNORABLE */
@ -1182,7 +1182,7 @@ static void testCEs(UCollator *coll, UErrorCode *status) {
before = (UBool)((specs & UCOL_TOK_BEFORE) != 0);
if(top_ == TRUE) {
int32_t index = src.parsedToken.indirectIndex;
nextCE = baseCE = currCE = ucolIndirectBoundaries[index].startCE;
nextContCE = baseContCE = currContCE = ucolIndirectBoundaries[index].startContCE;
} else {
@ -1479,7 +1479,7 @@ static void TestImplicitTailoring(void) {
const char *rules;
const char *data[50];
const uint32_t len;
} tests[] = {
} tests[] = {
{ "&[before 1]\\u4e00 < b < c &[before 1]\\u4e00 < d < e", { "d", "e", "b", "c", "\\u4e00"}, 5 },
{ "&\\u4e00 < a <<< A < b <<< B", { "\\u4e00", "a", "A", "b", "B", "\\u4e01"}, 6 },
{ "&[before 1]\\u4e00 < \\u4e01 < \\u4e02", { "\\u4e01", "\\u4e02", "\\u4e00"}, 3},
@ -1591,7 +1591,7 @@ static void TestComposeDecompose(void) {
nfcSize = unorm_normalize(comp, len, UNORM_NFC, 0, t[noCases]->NFC, NORM_BUFFER_TEST_LEN, &status);
nfdSize = unorm_normalize(comp, len, UNORM_NFD, 0, t[noCases]->NFD, NORM_BUFFER_TEST_LEN, &status);
if(nfcSize != nfdSize || (uprv_memcmp(t[noCases]->NFC, t[noCases]->NFD, nfcSize * sizeof(UChar)) != 0)
if(nfcSize != nfdSize || (uprv_memcmp(t[noCases]->NFC, t[noCases]->NFD, nfcSize * sizeof(UChar)) != 0)
|| (len != nfdSize || (uprv_memcmp(comp, t[noCases]->NFD, nfdSize * sizeof(UChar)) != 0))) {
t[noCases]->u = u;
if(len != nfdSize || (uprv_memcmp(comp, t[noCases]->NFD, nfdSize * sizeof(UChar)) != 0)) {
@ -1601,7 +1601,7 @@ static void TestComposeDecompose(void) {
noCases++;
t[noCases] = (tester *)malloc(sizeof(tester));
uprv_memset(t[noCases], 0, sizeof(tester));
}
}
}
for(u=0; u<(UChar32)noCases; u++) {
@ -1831,8 +1831,8 @@ static void TestRedundantRules(void) {
uint32_t testdatalen;
} tests[] = {
/* this test conflicts with positioning of CODAN placeholder */
/*{
"& a <<< b <<< c << d <<< e& [before 1] e <<< x",
/*{
"& a <<< b <<< c << d <<< e& [before 1] e <<< x",
"&\\u2089<<<x",
{"\\u2089", "x"}, 2
}, */
@ -2072,7 +2072,7 @@ static void TestCase(void)
}
log_verbose("Testing different case settings with custom rules\n");
ucol_setStrength(myCollation, UCOL_TERTIARY);
for(k = 0; k<4; k++) {
ucol_setAttribute(myCollation, UCOL_CASE_FIRST, caseTestAttributes[k][0], &status);
ucol_setAttribute(myCollation, UCOL_CASE_LEVEL, caseTestAttributes[k][1], &status);
@ -2221,8 +2221,8 @@ static void TestIncrementalNormalize(void) {
/* Test 3: Non-normal sequence is terminated by a surrogate pair.*/
{
/* New UCA 3.1.1.
* test below used a code point from Desseret, which sorts differently
/* New UCA 3.1.1.
* test below used a code point from Desseret, which sorts differently
* than d800 dc00
*/
/*UChar strA[] = {0x41, 0x41, 0x300, 0x316, 0xD801, 0xDC00, 0};*/
@ -2545,7 +2545,7 @@ static void TestCyrillicTailoring(void) {
};
/* Russian overrides contractions, so this test is not valid anymore */
/*genericLocaleStarter("ru", test, 3);*/
/*genericLocaleStarter("ru", test, 3);*/
genericLocaleStarter("root", test, 3);
genericRulesStarter("&\\u0410 = \\u0410", test, 3);
@ -2561,14 +2561,14 @@ static void TestSuppressContractions(void) {
static const char *testNoCont2[] = {
"\\u0410\\u0302a",
"\\u0410\\u0306b",
"\\u0410c"
"\\u0410c"
};
static const char *testNoCont[] = {
"a\\u0410",
"a\\u0410",
"A\\u0410\\u0306",
"\\uFF21\\u0410\\u0302"
};
genericRulesStarter("[suppressContractions [\\u0400-\\u047f]]", testNoCont, 3);
genericRulesStarter("[suppressContractions [\\u0400-\\u047f]]", testNoCont2, 3);
}
@ -2904,7 +2904,7 @@ static void TestVariableTopSetting(void) {
/* this test will fail when normalization is turned on */
/* therefore we always turn off exhaustive mode for it */
if(1) { /* QUICK > 0*/
if(1) { /* QUICK > 0*/
log_verbose("Slide variable top over UCARules\n");
rulesLen = ucol_getRulesEx(coll, UCOL_FULL_RULES, rulesCopy, 0);
rulesCopy = (UChar *)malloc((rulesLen+UCOL_TOK_EXTRA_RULE_SPACE_SIZE)*sizeof(UChar));
@ -2915,7 +2915,7 @@ static void TestVariableTopSetting(void) {
src.current = src.source = rulesCopy;
src.end = rulesCopy+rulesLen;
src.extraCurrent = src.end;
src.extraEnd = src.end+UCOL_TOK_EXTRA_RULE_SPACE_SIZE;
src.extraEnd = src.end+UCOL_TOK_EXTRA_RULE_SPACE_SIZE;
while ((current = ucol_tok_parseNextToken(&src, startOfRules, &parseError,&status)) != NULL) {
strength = src.parsedToken.strength;
@ -2955,10 +2955,10 @@ static void TestVariableTopSetting(void) {
log_verbose("= Expected failure for %s =", buffer);
} else {
if(s.pos == s.endp) {
log_err("Unexpected failure setting variable top at offset %d. Error %s. Codepoints: %s\n",
log_err("Unexpected failure setting variable top at offset %d. Error %s. Codepoints: %s\n",
oldChOffset, u_errorName(status), buffer);
} else {
log_verbose("There is a goofy contraction in UCA rules that does not appear in the fractional UCA. Codepoints: %s\n",
log_verbose("There is a goofy contraction in UCA rules that does not appear in the fractional UCA. Codepoints: %s\n",
buffer);
}
}
@ -3193,15 +3193,15 @@ static void TestPrefix(void) {
const char *rules;
const char *data[50];
const uint32_t len;
} tests[] = {
{ "&z <<< z|a",
} tests[] = {
{ "&z <<< z|a",
{"zz", "za"}, 2 },
{ "&z <<< z| a",
{ "&z <<< z| a",
{"zz", "za"}, 2 },
{ "[strength I]"
"&a=\\ud900\\udc25"
"&z<<<\\ud900\\udc25|a",
"&z<<<\\ud900\\udc25|a",
{"aa", "az", "\\ud900\\udc25z", "\\ud900\\udc25a", "zz"}, 4 },
};
@ -3227,7 +3227,7 @@ static void TestNewJapanese(void) {
"\\u30c6\\u30fc\\u30bf",
"\\u30c6\\u30a7\\u30bf",
"\\u3066\\u3048\\u305f",
"\\u3067\\u30fc\\u305f",
"\\u3067\\u30fc\\u305f",
"\\u30c7\\u30fc\\u30bf",
"\\u30c7\\u30a7\\u30bf",
"\\u3067\\u3048\\u305f",
@ -3251,7 +3251,7 @@ static void TestNewJapanese(void) {
"\\u30d2\\u30e5\\u30a6",
"\\u30d2\\u30e6\\u30a6",
"\\u30d4\\u30e5\\u30a6\\u30a2",
"\\u3073\\u3085\\u30fc\\u3042\\u30fc",
"\\u3073\\u3085\\u30fc\\u3042\\u30fc",
"\\u30d3\\u30e5\\u30fc\\u30a2\\u30fc",
"\\u30d3\\u30e5\\u30a6\\u30a2\\u30fc",
"\\u3072\\u3085\\u3093",
@ -3388,7 +3388,7 @@ static void TestContractionClosure(void) {
const char *rules;
const char *data[50];
const uint32_t len;
} tests[] = {
} tests[] = {
{ "&b=\\u00e4\\u00e4",
{ "b", "\\u00e4\\u00e4", "a\\u0308a\\u0308", "\\u00e4a\\u0308", "a\\u0308\\u00e4" }, 5},
{ "&b=\\u00C5",
@ -3408,13 +3408,13 @@ static void TestBeforePrefixFailure(void) {
const char *rules;
const char *data[50];
const uint32_t len;
} tests[] = {
} tests[] = {
{ "&g <<< a"
"&[before 3]\\uff41 <<< x",
{"x", "\\uff41"}, 2 },
{ "&\\u30A7=\\u30A7=\\u3047=\\uff6a"
"&\\u30A8=\\u30A8=\\u3048=\\uff74"
"&[before 3]\\u30a7<<<\\u30a9",
"&[before 3]\\u30a7<<<\\u30a9",
{"\\u30a9", "\\u30a7"}, 2 },
{ "&[before 3]\\u30a7<<<\\u30a9"
"&\\u30A7=\\u30A7=\\u3047=\\uff6a"
@ -3429,16 +3429,16 @@ static void TestBeforePrefixFailure(void) {
}
#if 0
const char* rule1 =
const char* rule1 =
"&\\u30A7=\\u30A7=\\u3047=\\uff6a"
"&\\u30A8=\\u30A8=\\u3048=\\uff74"
"&[before 3]\\u30a7<<<\\u30c6|\\u30fc";
const char* rule2 =
const char* rule2 =
"&[before 3]\\u30a7<<<\\u30c6|\\u30fc"
"&\\u30A7=\\u30A7=\\u3047=\\uff6a"
"&\\u30A8=\\u30A8=\\u3048=\\uff74";
const char* test[] = {
"\\u30c6\\u30fc\\u30bf",
"\\u30c6\\u30fc\\u30bf",
"\\u30c6\\u30a7\\u30bf",
};
genericRulesStarter(rule1, test, sizeof(test)/sizeof(test[0]));
@ -3446,7 +3446,7 @@ static void TestBeforePrefixFailure(void) {
/* this piece of code should be in some sort of verbose mode */
/* it gets the collation elements for elements and prints them */
/* This is useful when trying to see whether the problem is */
{
{
UErrorCode status = U_ZERO_ERROR;
uint32_t i = 0;
UCollationElements *it = NULL;
@ -3481,15 +3481,15 @@ static void TestBeforePrefixFailure(void) {
}
static void TestPrefixCompose(void) {
const char* rule1 =
const char* rule1 =
"&\\u30a7<<<\\u30ab|\\u30fc=\\u30ac|\\u30fc";
/*
const char* test[] = {
"\\u30c6\\u30fc\\u30bf",
"\\u30c6\\u30fc\\u30bf",
"\\u30c6\\u30a7\\u30bf",
};
*/
{
{
UErrorCode status = U_ZERO_ERROR;
/*uint32_t i = 0;*/
/*UCollationElements *it = NULL;*/
@ -3508,60 +3508,60 @@ static void TestPrefixCompose(void) {
}
/*
[last variable] last variable value
[last primary ignorable] largest CE for primary ignorable
[last secondary ignorable] largest CE for secondary ignorable
[last tertiary ignorable] largest CE for tertiary ignorable
[top] guaranteed to be above all implicit CEs, for now and in the future (in 1.8)
[last variable] last variable value
[last primary ignorable] largest CE for primary ignorable
[last secondary ignorable] largest CE for secondary ignorable
[last tertiary ignorable] largest CE for tertiary ignorable
[top] guaranteed to be above all implicit CEs, for now and in the future (in 1.8)
*/
static void TestRuleOptions(void) {
/* values here are hardcoded and are correct for the current UCA
* when the UCA changes, one might be forced to change these
/* values here are hardcoded and are correct for the current UCA
* when the UCA changes, one might be forced to change these
* values. (\\u02d0, \\U00010FFFC etc...)
*/
static struct {
const char *rules;
const char *data[50];
const uint32_t len;
} tests[] = {
} tests[] = {
/* - all befores here amount to zero */
{ "&[before 3][first tertiary ignorable]<<<a",
{ "&[before 3][first tertiary ignorable]<<<a",
{ "\\u0000", "a"}, 2
}, /* you cannot go before first tertiary ignorable */
{ "&[before 3][last tertiary ignorable]<<<a",
{ "&[before 3][last tertiary ignorable]<<<a",
{ "\\u0000", "a"}, 2
}, /* you cannot go before last tertiary ignorable */
{ "&[before 3][first secondary ignorable]<<<a",
{ "&[before 3][first secondary ignorable]<<<a",
{ "\\u0000", "a"}, 2
}, /* you cannot go before first secondary ignorable */
{ "&[before 3][last secondary ignorable]<<<a",
{ "&[before 3][last secondary ignorable]<<<a",
{ "\\u0000", "a"}, 2
}, /* you cannot go before first secondary ignorable */
/* 'normal' befores */
{ "&[before 3][first primary ignorable]<<<c<<<b &[first primary ignorable]<a",
{ "&[before 3][first primary ignorable]<<<c<<<b &[first primary ignorable]<a",
{ "c", "b", "\\u0332", "a" }, 4
},
/* we don't have a code point that corresponds to
/* we don't have a code point that corresponds to
* the last primary ignorable
*/
{ "&[before 3][last primary ignorable]<<<c<<<b &[last primary ignorable]<a",
{ "&[before 3][last primary ignorable]<<<c<<<b &[last primary ignorable]<a",
{ "\\u0332", "\\u20e3", "c", "b", "a" }, 5
},
},
{ "&[before 3][first variable]<<<c<<<b &[first variable]<a",
{ "&[before 3][first variable]<<<c<<<b &[first variable]<a",
{ "c", "b", "\\u0009", "a", "\\u000a" }, 5
},
},
{ "&[last variable]<a &[before 3][last variable]<<<c<<<b ",
{ "&[last variable]<a &[before 3][last variable]<<<c<<<b ",
{ "c", "b", "\\uD800\\uDD33", "a", "\\u02d0" }, 5
},
},
{ "&[first regular]<a"
"&[before 1][first regular]<b",
@ -3571,7 +3571,7 @@ static void TestRuleOptions(void) {
{ "&[before 1][last regular]<b"
"&[last regular]<a",
{ "b", "\\uD800\\uDF9D", "a", "\\u4e00" }, 4
},
},
{ "&[before 1][first implicit]<b"
"&[first implicit]<a",
@ -3581,14 +3581,14 @@ static void TestRuleOptions(void) {
{ "&[before 1][last implicit]<b"
"&[last implicit]<a",
{ "b", "\\U0010FFFD", "a" }, 3
},
},
{ "&[last variable]<z"
"&[last primary ignorable]<x"
"&[last secondary ignorable]<<y"
"&[last tertiary ignorable]<<<w"
"&[top]<u",
{"\\ufffb", "w", "y", "\\u20e3", "x", "\\u137c", "z", "u"}, 7
{"\\ufffb", "w", "y", "\\u20e3", "x", "\\u137c", "z", "u"}, 7
}
};
@ -3602,19 +3602,19 @@ static void TestRuleOptions(void) {
static void TestOptimize(void) {
/* this is not really a test - just trying out
* whether copying of UCA contents will fail
* Cannot really test, since the functionality
/* this is not really a test - just trying out
* whether copying of UCA contents will fail
* Cannot really test, since the functionality
* remains the same.
*/
static struct {
const char *rules;
const char *data[50];
const uint32_t len;
} tests[] = {
} tests[] = {
/* - all befores here amount to zero */
{ "[optimize [\\uAC00-\\uD7FF]]",
{ "a", "b"}, 2}
{ "[optimize [\\uAC00-\\uD7FF]]",
{ "a", "b"}, 2}
};
uint32_t i;
@ -3624,38 +3624,38 @@ static void TestOptimize(void) {
}
/*
cycheng@ca.ibm.c... we got inconsistent results when using the UTF-16BE iterator and the UTF-8 iterator.
weiv ucol_strcollIter?
cycheng@ca.ibm.c... e.g. s1 = 0xfffc0062, and s2 = d8000021
weiv these are the input strings?
cycheng@ca.ibm.c... yes, using the utf-16 iterator and UCA with normalization on, we have s1 > s2
weiv will check - could be a problem with utf-8 iterator
cycheng@ca.ibm.c... but if we use the utf-8 iterator, i.e. s1 = efbfbc62 and s2 = eda08021, we have s1 < s2
weiv hmmm
cycheng@ca.ibm.c... note that we have a standalone high surrogate
weiv that doesn't sound right
cycheng@ca.ibm.c... we got the same inconsistent results on AIX and Win2000
weiv so you have two strings, you convert them to utf-8 and to utf-16BE
cycheng@ca.ibm.c... yes
weiv and then do the comparison
cycheng@ca.ibm.c... in one case, the input strings are in utf8, and in the other case the input strings are in utf-16be
weiv utf-16 strings look like a little endian ones in the example you sent me
weiv It could be a bug - let me try to test it out
cycheng@ca.ibm.c... ok
cycheng@ca.ibm.c... we can wait till the conf. call
cycheng@ca.ibm.c... next weke
weiv that would be great
weiv hmmm
weiv I might be wrong
weiv let me play with it some more
cycheng@ca.ibm.c... ok
cycheng@ca.ibm.c... also please check s3 = 0x0e3a0062 and s4 = 0x0e400021. both are in utf-16be
cycheng@ca.ibm.c... seems with icu 2.2 we have s3 > s4, but not in icu 2.4 that's built for db2
cycheng@ca.ibm.c... also s1 & s2 that I sent you earlier are also in utf-16be
weiv ok
cycheng@ca.ibm.c... i ask sherman to send you more inconsistent data
weiv thanks
cycheng@ca.ibm.c... the 4 strings we sent are just samples
cycheng@ca.ibm.c... we got inconsistent results when using the UTF-16BE iterator and the UTF-8 iterator.
weiv ucol_strcollIter?
cycheng@ca.ibm.c... e.g. s1 = 0xfffc0062, and s2 = d8000021
weiv these are the input strings?
cycheng@ca.ibm.c... yes, using the utf-16 iterator and UCA with normalization on, we have s1 > s2
weiv will check - could be a problem with utf-8 iterator
cycheng@ca.ibm.c... but if we use the utf-8 iterator, i.e. s1 = efbfbc62 and s2 = eda08021, we have s1 < s2
weiv hmmm
cycheng@ca.ibm.c... note that we have a standalone high surrogate
weiv that doesn't sound right
cycheng@ca.ibm.c... we got the same inconsistent results on AIX and Win2000
weiv so you have two strings, you convert them to utf-8 and to utf-16BE
cycheng@ca.ibm.c... yes
weiv and then do the comparison
cycheng@ca.ibm.c... in one case, the input strings are in utf8, and in the other case the input strings are in utf-16be
weiv utf-16 strings look like a little endian ones in the example you sent me
weiv It could be a bug - let me try to test it out
cycheng@ca.ibm.c... ok
cycheng@ca.ibm.c... we can wait till the conf. call
cycheng@ca.ibm.c... next weke
weiv that would be great
weiv hmmm
weiv I might be wrong
weiv let me play with it some more
cycheng@ca.ibm.c... ok
cycheng@ca.ibm.c... also please check s3 = 0x0e3a0062 and s4 = 0x0e400021. both are in utf-16be
cycheng@ca.ibm.c... seems with icu 2.2 we have s3 > s4, but not in icu 2.4 that's built for db2
cycheng@ca.ibm.c... also s1 & s2 that I sent you earlier are also in utf-16be
weiv ok
cycheng@ca.ibm.c... i ask sherman to send you more inconsistent data
weiv thanks
cycheng@ca.ibm.c... the 4 strings we sent are just samples
*/
#if 0
static void Alexis(void) {
@ -3703,7 +3703,7 @@ static void Alexis2(void) {
UErrorCode status = U_ZERO_ERROR;
UChar U16Source[CMSCOLL_ALEXIS2_BUFFER_SIZE], U16Target[CMSCOLL_ALEXIS2_BUFFER_SIZE];
char U16BESource[CMSCOLL_ALEXIS2_BUFFER_SIZE], U16BETarget[CMSCOLL_ALEXIS2_BUFFER_SIZE];
char U8Source[CMSCOLL_ALEXIS2_BUFFER_SIZE], U8Target[CMSCOLL_ALEXIS2_BUFFER_SIZE];
char U8Source[CMSCOLL_ALEXIS2_BUFFER_SIZE], U8Target[CMSCOLL_ALEXIS2_BUFFER_SIZE];
int32_t U16LenS = 0, U16LenT = 0, U16BELenS = 0, U16BELenT = 0, U8LenS = 0, U8LenT = 0;
UConverter *conv = NULL;
@ -3822,7 +3822,7 @@ static void TestHebrewUCA(void) {
static void TestPartialSortKeyTermination(void) {
const char* cases[] = {
"\\u1234\\u1234\\udc00",
"\\udc00\\ud800\\ud800"
"\\udc00\\ud800\\ud800"
};
int32_t i = sizeof(UCollator);
@ -4069,36 +4069,36 @@ static void TestNumericCollation(void)
{
UErrorCode status = U_ZERO_ERROR;
const static char *basicTestStrings[]={
"hello1",
"hello2",
"hello2002",
"hello2003",
"hello123456",
"hello1234567",
"hello10000000",
"hello100000000",
"hello1000000000",
"hello10000000000",
};
const static char *preZeroTestStrings[]={
"avery10000",
"avery010000",
"avery0010000",
"avery00010000",
"avery000010000",
"avery0000010000",
"avery00000010000",
"avery000000010000",
};
const static char *thirtyTwoBitNumericStrings[]={
"avery42949672960",
"avery42949672961",
"avery42949672962",
"avery429496729610"
};
const static char *basicTestStrings[]={
"hello1",
"hello2",
"hello2002",
"hello2003",
"hello123456",
"hello1234567",
"hello10000000",
"hello100000000",
"hello1000000000",
"hello10000000000",
};
const static char *preZeroTestStrings[]={
"avery10000",
"avery010000",
"avery0010000",
"avery00010000",
"avery000010000",
"avery0000010000",
"avery00000010000",
"avery000000010000",
};
const static char *thirtyTwoBitNumericStrings[]={
"avery42949672960",
"avery42949672961",
"avery42949672962",
"avery429496729610"
};
const static char *supplementaryDigits[] = {
"\\uD835\\uDFCE", /* 0 */
@ -4138,7 +4138,7 @@ static void TestNumericCollation(void)
UColAttribute att = UCOL_NUMERIC_COLLATION;
UColAttributeValue val = UCOL_ON;
/* Open our collator. */
/* Open our collator. */
UCollator* coll = ucol_open("root", &status);
if (U_FAILURE(status)){
log_err("ERROR: in using ucol_open()\n %s\n",
@ -4148,33 +4148,33 @@ static void TestNumericCollation(void)
genericLocaleStarterWithOptions("root", basicTestStrings, sizeof(basicTestStrings)/sizeof(basicTestStrings[0]), &att, &val, 1);
genericLocaleStarterWithOptions("root", thirtyTwoBitNumericStrings, sizeof(thirtyTwoBitNumericStrings)/sizeof(thirtyTwoBitNumericStrings[0]), &att, &val, 1);
genericLocaleStarterWithOptions("en_US", foreignDigits, sizeof(foreignDigits)/sizeof(foreignDigits[0]), &att, &val, 1);
genericLocaleStarterWithOptions("root", supplementaryDigits, sizeof(supplementaryDigits)/sizeof(supplementaryDigits[0]), &att, &val, 1);
genericLocaleStarterWithOptions("root", evenZeroes, sizeof(evenZeroes)/sizeof(evenZeroes[0]), &att, &val, 1);
genericLocaleStarterWithOptions("root", supplementaryDigits, sizeof(supplementaryDigits)/sizeof(supplementaryDigits[0]), &att, &val, 1);
genericLocaleStarterWithOptions("root", evenZeroes, sizeof(evenZeroes)/sizeof(evenZeroes[0]), &att, &val, 1);
/* Setting up our collator to do digits. */
ucol_setAttribute(coll, UCOL_NUMERIC_COLLATION, UCOL_ON, &status);
/* Setting up our collator to do digits. */
ucol_setAttribute(coll, UCOL_NUMERIC_COLLATION, UCOL_ON, &status);
if (U_FAILURE(status)){
log_err("ERROR: in setting UCOL_NUMERIC_COLLATION as an attribute\n %s\n",
myErrorName(status));
return;
}
/*
Testing that prepended zeroes still yield the correct collation behavior.
/*
Testing that prepended zeroes still yield the correct collation behavior.
We expect that every element in our strings array will be equal.
*/
genericOrderingTestWithResult(coll, preZeroTestStrings, sizeof(preZeroTestStrings)/sizeof(preZeroTestStrings[0]), UCOL_EQUAL);
ucol_close(coll);
}
static void TestTibetanConformance(void)
{
const char* test[] = {
"\\u0FB2\\u0591\\u0F71\\u0061",
static void TestTibetanConformance(void)
{
const char* test[] = {
"\\u0FB2\\u0591\\u0F71\\u0061",
"\\u0FB2\\u0F71\\u0061"
};
UErrorCode status = U_ZERO_ERROR;
UCollator *coll = ucol_open("", &status);
UChar source[100];
@ -4188,7 +4188,7 @@ static void TestTibetanConformance(void)
result = ucol_strcoll(coll, source, -1, target, -1);
log_verbose("result %d\n", result);
if (UCOL_EQUAL != result) {
log_err("Tibetan comparison error\n");
log_err("Tibetan comparison error\n");
}
}
ucol_close(coll);
@ -4210,7 +4210,7 @@ static void TestPinyinProblem(void) {
static void showImplicit(UChar32 i) {
if (i >= 0 && i <= TST_UCOL_MAX_INPUT) {
log_verbose("%08X\t%08X\n", i, uprv_uca_getImplicitFromRaw(i));
}
}
}
static void TestImplicitGeneration(void) {
@ -4229,16 +4229,16 @@ static void TestImplicitGeneration(void) {
log_err("Couldn't open UCA\n");
return;
}
uprv_uca_getRawFromImplicit(0xE20303E7);
for (i = 0; i <= TST_UCOL_MAX_INPUT; ++i) {
current = uprv_uca_getImplicitFromRaw(i) & fourBytes;
/* check that it round-trips AND that all intervening ones are illegal*/
roundtrip = uprv_uca_getRawFromImplicit(current);
if (roundtrip != i) {
log_err("No roundtrip %08X\n", i);
log_err("No roundtrip %08X\n", i);
}
if (last != 0) {
for (j = last + 1; j < current; ++j) {
@ -4272,7 +4272,7 @@ static void TestImplicitGeneration(void) {
}
showImplicit(TST_UCOL_MAX_INPUT-2);
showImplicit(TST_UCOL_MAX_INPUT-1);
showImplicit(TST_UCOL_MAX_INPUT);
showImplicit(TST_UCOL_MAX_INPUT);
ucol_close(coll);
}
@ -4382,7 +4382,7 @@ ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
assertEquals("getFunctionalEquivalent(fr)", "fr", loc);
assertTrue("getFunctionalEquivalent(fr).isAvailable==TRUE",
isAvailable == TRUE);
n = ucol_getFunctionalEquivalent(loc, sizeof(loc), "collation", "fr_FR",
&isAvailable, &ec);
assertSuccess("getFunctionalEquivalent", &ec);
@ -4393,7 +4393,7 @@ ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
/* supercedes TestJ784 */
static void TestBeforePinyin(void) {
const static char rules[] = {
const static char rules[] = {
"&[before 2]A<<\\u0101<<<\\u0100<<\\u00E1<<<\\u00C1<<\\u01CE<<<\\u01CD<<\\u00E0<<<\\u00C0"
"&[before 2]e<<\\u0113<<<\\u0112<<\\u00E9<<<\\u00C9<<\\u011B<<<\\u011A<<\\u00E8<<<\\u00C8"
"&[before 2]i<<\\u012B<<<\\u012A<<\\u00ED<<<\\u00CD<<\\u01D0<<<\\u01CF<<\\u00EC<<<\\u00CC"
@ -4575,9 +4575,9 @@ static void TestMoreBefore(void) {
{ "m","M","x","X","q","Q","a","z","n" }, 9},
{ "&m << a &[before 3] a <<< x <<< X << q <<< Q < z",
{ "m","M","x","X","a","q","Q","z","n" }, 9},
{ "&m <<< a &[before 1] a < x <<< X << q <<< Q < z",
{ "&m <<< a &[before 1] a < x <<< X << q <<< Q < z",
{ "x","X","q","Q","z","n","m","a","M" }, 9},
{ "&m <<< a &[before 2] a << x <<< X << q <<< Q < z",
{ "&m <<< a &[before 2] a << x <<< X << q <<< Q < z",
{ "x","X","q","Q","m","a","M","z","n" }, 9},
{ "&m <<< a &[before 3] a <<< x <<< X << q <<< Q < z",
{ "m","x","X","a","M","q","Q","z","n" }, 9},
@ -4585,7 +4585,7 @@ static void TestMoreBefore(void) {
{ "r","R","x","X","q","Q","z","s","n" }, 9},
{ "&[before 2] s << x <<< X << q <<< Q < z",
{ "r","R","x","X","q","Q","s","z","n" }, 9},
{ "&[before 3] s <<< x <<< X << q <<< Q < z",
{ "&[before 3] s <<< x <<< X << q <<< Q < z",
{ "r","R","x","X","s","q","Q","z","n" }, 9},
{ "&[before 1] \\u24DC < x <<< X << q <<< Q < z",
{ "x","X","q","Q","z","n","m","\\u24DC","M" }, 9},
@ -4633,7 +4633,7 @@ void addMiscCollTest(TestNode** root)
TEST(TestPrefixCompose);
TEST(TestStrCollIdenticalPrefix);
TEST(TestPrefix);
TEST(TestNewJapanese);
TEST(TestNewJapanese);
/*TEST(TestLimitations);*/
TEST(TestNonChars);
TEST(TestExtremeCompression);

View File

@ -517,7 +517,7 @@ isAcceptable3(void *context,
static void TestUDataOpenChoiceDemo1() {
UDataMemory *result;
UErrorCode status=U_ZERO_ERROR;
const char* name[]={
"cnvalias",
"unames",

View File

@ -149,12 +149,12 @@ public:
*/
void TestGetTailoredSet();
/**
/**
* Tests the subclassability
*/
void TestSubclass();
/**
/**
* Tests the dynamic and static ids of collation classes
*/
void TestUClassID();

View File

@ -1,5 +1,5 @@
/********************************************************************
* COPYRIGHT:
* COPYRIGHT:
* Copyright (c) 1996-2004, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@ -84,14 +84,14 @@ void AstroTest::TestSolarLongitude(void) {
{ { 1980, 7, 27, 0, 00 }, 124.114347 },
{ { 1988, 7, 27, 00, 00 }, 124.187732 }
};
logln("");
for (uint32_t i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) {
gc->clear();
gc->set(tests[i].d[0], tests[i].d[1]-1, tests[i].d[2], tests[i].d[3], tests[i].d[4]);
astro->setDate(gc->getTime(status));
double longitude = astro->getSunLongitude();
//longitude = 0;
CalendarAstronomer::Equatorial result;
@ -113,16 +113,16 @@ void AstroTest::TestLunarPosition(void) {
{ 1979, 2, 26, 16, 00, 0, 0 }
};
logln("");
for (int32_t i = 0; i < (int32_t)(sizeof(tests)/sizeof(tests[0])); i++) {
gc->clear();
gc->set((int32_t)tests[i][0], (int32_t)tests[i][1]-1, (int32_t)tests[i][2], (int32_t)tests[i][3], (int32_t)tests[i][4]);
astro->setDate(gc->getTime(status));
const CalendarAstronomer::Equatorial& result = astro->getMoonPosition();
logln((UnicodeString)"Moon position is " + result.toString() + (UnicodeString)"; " /* + result->toHmsString()*/);
}
closeAstro(status);
ASSERT_OK(status);
}
@ -133,7 +133,7 @@ void AstroTest::TestCoordinates(void) {
UErrorCode status = U_ZERO_ERROR;
initAstro(status);
ASSERT_OK(status);
CalendarAstronomer::Equatorial result;
astro->eclipticToEquatorial(result, 139.686111 * CalendarAstronomer::PI / 180.0, 4.875278* CalendarAstronomer::PI / 180.0);
logln((UnicodeString)"result is " + result.toString() + (UnicodeString)"; " /* + result.toHmsString()*/ );
@ -152,8 +152,8 @@ void AstroTest::TestCoverage(void) {
CalendarAstronomer *myastro = new CalendarAstronomer(then);
ASSERT_OK(status);
//Latitude: 34 degrees 05' North
//Longitude: 118 degrees 22' West
//Latitude: 34 degrees 05' North
//Longitude: 118 degrees 22' West
double laLat = 34 + 5./60, laLong = 360 - (118 + 22./60);
CalendarAstronomer *myastro2 = new CalendarAstronomer(laLong, laLat);
@ -171,7 +171,7 @@ void AstroTest::TestCoverage(void) {
CalendarAstronomer *astronomers[] = {
myastro, myastro2, myastro3, myastro2 // check cache
};
for (uint32_t i = 0; i < sizeof(astronomers)/sizeof(astronomers[0]); ++i) {
CalendarAstronomer *anAstro = astronomers[i];
@ -213,7 +213,7 @@ void AstroTest::TestSunriseTimes(void) {
// logln("Sunrise/Sunset times for San Jose, California, USA");
// CalendarAstronomer *astro2 = new CalendarAstronomer(-121.55, 37.20);
// TimeZone *tz = TimeZone::createTimeZone("America/Los_Angeles");
// We'll use a table generated by the UNSO website as our reference
// From: http://aa.usno.navy.mil/
//-Location: W079 25, N43 40
@ -251,21 +251,21 @@ void AstroTest::TestSunriseTimes(void) {
6,13, 20,18,
6,11, 20,19,
};
logln("Sunrise/Sunset times for Toronto, Canada");
// long = 79 25", lat = 43 40"
CalendarAstronomer *astro3 = new CalendarAstronomer(-(79+25/60), 43+40/60);
// As of ICU4J 2.8 the ICU4J time zones implement pass-through
// to the underlying JDK. Because of variation in the
// underlying JDKs, we have to use a fixed-offset
// SimpleTimeZone to get consistent behavior between JDKs.
// The offset we want is [-18000000, 3600000] (raw, dst).
// [aliu 10/15/03]
// TimeZone tz = TimeZone.getTimeZone("America/Montreal");
TimeZone *tz = new SimpleTimeZone(-18000000 + 3600000, "Montreal(FIXED)");
GregorianCalendar *cal = new GregorianCalendar(tz->clone(), Locale::getUS(), status);
GregorianCalendar *cal2 = new GregorianCalendar(tz->clone(), Locale::getUS(), status);
cal->clear();
@ -273,14 +273,14 @@ void AstroTest::TestSunriseTimes(void) {
cal->set(UCAL_MONTH, UCAL_APRIL);
cal->set(UCAL_DAY_OF_MONTH, 1);
cal->set(UCAL_HOUR_OF_DAY, 12); // must be near local noon for getSunRiseSet to work
DateFormat *df_t = DateFormat::createTimeInstance(DateFormat::MEDIUM,Locale::getUS());
DateFormat *df_d = DateFormat::createDateInstance(DateFormat::MEDIUM,Locale::getUS());
DateFormat *df_dt = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::MEDIUM, Locale::getUS());
df_t->adoptTimeZone(tz->clone());
df_d->adoptTimeZone(tz->clone());
df_dt->adoptTimeZone(tz->clone());
for (int32_t i=0; i < 30; i++) {
logln("setDate\n");
astro3->setDate(cal->getTime(status));
@ -293,7 +293,7 @@ void AstroTest::TestSunriseTimes(void) {
cal2->setTime(cal->getTime(status), status);
cal2->set(UCAL_SECOND, 0);
cal2->set(UCAL_MILLISECOND, 0);
cal2->set(UCAL_HOUR_OF_DAY, USNO[4*i+0]);
cal2->set(UCAL_MINUTE, USNO[4*i+1]);
UDate exprise = cal2->getTime(status);
@ -303,7 +303,7 @@ void AstroTest::TestSunriseTimes(void) {
// Compute delta of what we got to the USNO data, in seconds
int32_t deltarise = (int32_t)uprv_fabs((sunrise - exprise) / 1000);
int32_t deltaset = (int32_t)uprv_fabs((sunset - expset) / 1000);
// Allow a deviation of 0..MAX_DEV seconds
// It would be nice to get down to 60 seconds, but at this
// point that appears to be impossible without a redo of the
@ -340,18 +340,18 @@ void AstroTest::TestSunriseTimes(void) {
" (USNO " + df_t->format(expset,s5) + ")");
}
cal->add(UCAL_DATE, 1, status);
}
// CalendarAstronomer a = new CalendarAstronomer(-(71+5/60), 42+37/60);
// cal.clear();
// cal.set(cal.YEAR, 1986);
// cal.set(cal.MONTH, cal.MARCH);
// cal.set(cal.DATE, 10);
// cal.set(cal.YEAR, 1988);
// cal.set(cal.MONTH, cal.JULY);
// cal.set(cal.DATE, 27);
// a.setDate(cal.getTime());
// long r = a.getSunRiseSet2(true);
}
// CalendarAstronomer a = new CalendarAstronomer(-(71+5/60), 42+37/60);
// cal.clear();
// cal.set(cal.YEAR, 1986);
// cal.set(cal.MONTH, cal.MARCH);
// cal.set(cal.DATE, 10);
// cal.set(cal.YEAR, 1988);
// cal.set(cal.MONTH, cal.JULY);
// cal.set(cal.DATE, 27);
// a.setDate(cal.getTime());
// long r = a.getSunRiseSet2(true);
delete astro3;
delete tz;
delete cal;
@ -413,7 +413,7 @@ void AstroTest::TestBasics(void) {
// cal3.add(cal3.DATE, -1);
// astro.setDate(cal3.getTime());
// astro.foo();
delete cal3;
delete d3;
ASSERT_OK(status);
@ -424,7 +424,7 @@ void AstroTest::TestBasics(void) {
// TODO: try finding next new moon after 07/28/1984 16:00 GMT
#endif

View File

@ -73,10 +73,10 @@ void CanonicalIteratorTest::TestExhaustive() {
CanonicalIterator it("", status);
UChar32 i = 0;
UnicodeString s, decomp, comp;
// Test static and dynamic class IDs
// Test static and dynamic class IDs
if(it.getDynamicClassID() != CanonicalIterator::getStaticClassID()){
errln("CanonicalIterator::getStaticClassId ! = CanonicalIterator.getDynamicClassID");
}
errln("CanonicalIterator::getStaticClassId ! = CanonicalIterator.getDynamicClassID");
}
for (i = 0; i < 0x10FFFF; quick?i+=0x10:++i) {
//for (i = 0xae00; i < 0xaf00; ++i) {

View File

@ -223,9 +223,9 @@ void CharIterTest::TestConstructionAndEquality() {
if (test1->hashCode() != test5->hashCode())
errln("hashCode() failed: identical objects have different hash codes");
if(test1->getLength() != testText.length()){
errln("getLength of CharacterIterator failed");
}
if(test1->getLength() != testText.length()){
errln("getLength of CharacterIterator failed");
}
test1->getText(result1);
test1b->getText(result2);
test1c->getText(result3);

View File

@ -345,8 +345,8 @@ void CompoundTransliteratorTest::TestTransliterate(){
errln("CompoundTransliterator construction failed");
}else {
#if 0
// handleTransliterate is a protected method that was erroneously made
// public. It is not public API that needs to be tested.
// handleTransliterate is a protected method that was erroneously made
// public. It is not public API that needs to be tested.
UnicodeString s("abcabc");
expect(*ct1, s, s);
UTransPosition index = { 0, 0, 0, 0 };

View File

@ -34,20 +34,20 @@ class ICUNSubclass : public ICUNotifier {
};
class LKFSubclass : public LocaleKeyFactory {
Hashtable table;
Hashtable table;
public:
LKFSubclass(UBool visible)
: LocaleKeyFactory(visible ? VISIBLE : INVISIBLE, "LKFSubclass")
{
UErrorCode status = U_ZERO_ERROR;
table.put("en_US", this, status);
UErrorCode status = U_ZERO_ERROR;
table.put("en_US", this, status);
}
protected:
virtual const Hashtable* getSupportedIDs(UErrorCode &/*status*/) const {
return &table;
}
virtual const Hashtable* getSupportedIDs(UErrorCode &/*status*/) const {
return &table;
}
};
class Integer : public UObject {
@ -300,7 +300,7 @@ void
ICUServiceTest::msgstr(const UnicodeString& message, UObject* obj, UBool err)
{
if (obj) {
UnicodeString* str = (UnicodeString*)obj;
UnicodeString* str = (UnicodeString*)obj;
logln(message + *str);
delete str;
} else if (err) {
@ -317,7 +317,7 @@ ICUServiceTest::testAPI_One()
// register an object with one locale,
// search for an object with a more specific locale
// should return the original object
UErrorCode status = U_ZERO_ERROR;
UErrorCode status = U_ZERO_ERROR;
Integer* singleton0 = new Integer(0);
service.registerInstance(singleton0, "en_US", status);
{
@ -442,7 +442,7 @@ ICUServiceTest::testAPI_One()
confirmEqual("17) get invisible", result, singleton5);
delete result;
}
// should not be able to locate invisible services
{
UErrorCode status = U_ZERO_ERROR;
@ -532,17 +532,17 @@ class TestMultipleKeyStringFactory : public ICUServiceFactory {
UObject* create(const ICUServiceKey& key, const ICUService* /* service */, UErrorCode& status) const {
if (U_FAILURE(status)) {
return NULL;
return NULL;
}
UnicodeString temp;
key.currentID(temp);
if (U_SUCCESS(_status)) {
if (_ids.contains(&temp)) {
if (_ids.contains(&temp)) {
return new UnicodeString(_factoryID + temp);
}
}
} else {
status = _status;
}
status = _status;
}
return NULL;
}
@ -590,7 +590,7 @@ const char TestMultipleKeyStringFactory::fgClassID = '\0';
void
ICUServiceTest::testAPI_Two()
{
UErrorCode status = U_ZERO_ERROR;
UErrorCode status = U_ZERO_ERROR;
TestStringService service;
service.registerFactory(new AnonymousStringFactory(), status);
@ -858,7 +858,7 @@ void
ICUServiceTest::testRBF()
{
// resource bundle factory.
UErrorCode status = U_ZERO_ERROR;
UErrorCode status = U_ZERO_ERROR;
TestStringService service;
service.registerFactory(new ICUResourceBundleFactory(), status);
@ -1002,7 +1002,7 @@ class TestStringLocaleService : public ICULocaleService {
};
void ICUServiceTest::testLocale() {
UErrorCode status = U_ZERO_ERROR;
UErrorCode status = U_ZERO_ERROR;
TestStringLocaleService service;
UnicodeString* root = new UnicodeString("root");
@ -1092,7 +1092,7 @@ void ICUServiceTest::testLocale() {
}
{
UErrorCode status = U_ZERO_ERROR;
UErrorCode status = U_ZERO_ERROR;
UnicodeString english = "en";
Locale localeResult;
UnicodeString result;
@ -1184,7 +1184,7 @@ class WrapFactory : public ICUServiceFactory {
public:
static const UnicodeString& getGreetingID() {
if (greetingID == NULL) {
greetingID = new UnicodeString("greeting");
greetingID = new UnicodeString("greeting");
}
return *greetingID;
}
@ -1246,7 +1246,7 @@ ICUServiceTest::testWrapFactory()
{
UnicodeString* greeting = new UnicodeString("Hello There");
UnicodeString greetingID = "greeting";
UErrorCode status = U_ZERO_ERROR;
UErrorCode status = U_ZERO_ERROR;
TestStringService service;
service.registerInstance(greeting, greetingID, status);
@ -1309,10 +1309,10 @@ void ICUServiceTest::testCoverage()
{
UnicodeString* result = (UnicodeString*)service.get("object", status);
if (result) {
logln("object is: " + *result);
delete result;
logln("object is: " + *result);
delete result;
} else {
errln("could not get object");
errln("could not get object");
}
}
}

View File

@ -50,7 +50,7 @@ class ICUServiceTest : public IntlTest
void msgstr(const UnicodeString& message, UObject* obj, UBool err = TRUE);
void logstr(const UnicodeString& message, UObject* obj) {
msgstr(message, obj, FALSE);
msgstr(message, obj, FALSE);
}
};

View File

@ -127,7 +127,7 @@ static inline int32_t convertUCharsToASCII(const UChar* src,char* dest, int32_t
}
// wrapper around the reference Punycode implementation
static int32_t convertToPuny(const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
UChar* dest, int32_t destCapacity,
UErrorCode& status){
uint32_t b1Stack[MAX_LABEL_BUFFER_SIZE];
int32_t b1Len = 0, b1Capacity = MAX_LABEL_BUFFER_SIZE;
@ -197,7 +197,7 @@ CLEANUP:
}
static int32_t convertFromPuny( const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
UChar* dest, int32_t destCapacity,
UErrorCode& status){
char b1Stack[MAX_LABEL_BUFFER_SIZE];
char* b1 = b1Stack;
@ -243,9 +243,9 @@ CLEANUP:
U_CFUNC int32_t U_EXPORT2
idnaref_toASCII(const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
UChar* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UParseError* parseError,
UErrorCode* status){
if(status == NULL || U_FAILURE(*status)){
@ -263,7 +263,7 @@ idnaref_toASCII(const UChar* src, int32_t srcLength,
b2Capacity = MAX_LABEL_BUFFER_SIZE ,
reqLength=0;
//get the options
//get the options
UBool allowUnassigned = (UBool)((options & IDNAREF_ALLOW_UNASSIGNED) != 0);
UBool useSTD3ASCIIRules = (UBool)((options & IDNAREF_USE_STD3_RULES) != 0);
@ -324,7 +324,7 @@ idnaref_toASCII(const UChar* src, int32_t srcLength,
uprv_memmove(dest, b1, b1Len * U_SIZEOF_UCHAR);
reqLength = b1Len;
}else{
reqLength = b1Len;
reqLength = b1Len;
goto CLEANUP;
}
}else{
@ -393,9 +393,9 @@ CLEANUP:
U_CFUNC int32_t U_EXPORT2
idnaref_toUnicode(const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
UChar* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UParseError* parseError,
UErrorCode* status){
if(status == NULL || U_FAILURE(*status)){
@ -423,7 +423,7 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength,
b1Len = 0;
UBool* caseFlags = NULL;
//get the options
//get the options
UBool allowUnassigned = (UBool)((options & IDNAREF_ALLOW_UNASSIGNED) != 0);
UBool useSTD3ASCIIRules = (UBool)((options & IDNAREF_USE_STD3_RULES) != 0);
@ -642,9 +642,9 @@ getNextSeparator(UChar *src,int32_t srcLength,NamePrepTransform* prep,
U_CFUNC int32_t U_EXPORT2
idnaref_IDNToASCII( const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UChar* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UErrorCode* status){
if(status == NULL || U_FAILURE(*status)){
@ -669,7 +669,7 @@ idnaref_IDNToASCII( const UChar* src, int32_t srcLength,
int32_t remainingLen = srcLength;
int32_t b1Capacity = MAX_LABEL_BUFFER_SIZE;
//get the options
//get the options
// UBool allowUnassigned = (UBool)((options & IDNAREF_ALLOW_UNASSIGNED) != 0);
// UBool useSTD3ASCIIRules = (UBool)((options & IDNAREF_USE_STD3_RULES) != 0);
UBool done = FALSE;
@ -794,9 +794,9 @@ CLEANUP:
U_CFUNC int32_t U_EXPORT2
idnaref_IDNToUnicode( const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UChar* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UErrorCode* status){
if(status == NULL || U_FAILURE(*status)){
@ -822,11 +822,11 @@ idnaref_IDNToUnicode( const UChar* src, int32_t srcLength,
int32_t remainingLen = srcLength;
int32_t b1Capacity = MAX_LABEL_BUFFER_SIZE;
//get the options
//get the options
// UBool allowUnassigned = (UBool)((options & IDNAREF_ALLOW_UNASSIGNED) != 0);
// UBool useSTD3ASCIIRules = (UBool)((options & IDNAREF_USE_STD3_RULES) != 0);
if(U_FAILURE(*status)){
if(U_FAILURE(*status)){
goto CLEANUP;
}
@ -944,7 +944,7 @@ CLEANUP:
U_CFUNC int32_t U_EXPORT2
idnaref_compare( const UChar *s1, int32_t length1,
const UChar *s2, int32_t length2,
int32_t options,
int32_t options,
UErrorCode* status){
if(status == NULL || U_FAILURE(*status)){
@ -956,7 +956,7 @@ idnaref_compare( const UChar *s1, int32_t length1,
int32_t b1Len, b2Len, b1Capacity = MAX_IDN_BUFFER_SIZE, b2Capacity = MAX_IDN_BUFFER_SIZE;
int32_t result = -1;
UParseError parseError;
UParseError parseError;
b1Len = idnaref_IDNToASCII(s1, length1, b1, b1Capacity, options, &parseError, status);
if(*status == U_BUFFER_OVERFLOW_ERROR){

View File

@ -977,16 +977,16 @@ main(int argc, char* argv[])
#endif
/* Initialize ICU */
IntlTest::setICU_DATA(); // Must set data directory before u_init() is called.
IntlTest::setICU_DATA(); // Must set data directory before u_init() is called.
u_init(&errorCode);
if (U_FAILURE(errorCode)) {
fprintf(stderr,
"#### %s: u_init() failed, error is \"%s\".\n"
"#### Most commonly indicates that the ICU data is not accesible.\n"
"#### Most commonly indicates that the ICU data is not accesible.\n"
"#### Check setting of ICU_DATA, or check that ICU data library is available\n"
"#### ICU_DATA is currently set to \"%s\"\n", argv[0], u_errorName(errorCode), u_getDataDirectory());
u_cleanup();
return 1;
"#### ICU_DATA is currently set to \"%s\"\n", argv[0], u_errorName(errorCode), u_getDataDirectory());
u_cleanup();
return 1;
}
@ -1209,7 +1209,7 @@ const char* IntlTest::loadTestData(UErrorCode& err){
/* u_getDataDirectory shoul return \source\data ... set the
* directory to ..\source\data\..\test\testdata\out\testdata
*/
strcpy(tdpath, directory);
strcpy(tdpath, directory);
strcat(tdpath, tdrelativepath);
strcat(tdpath,"testdata");
@ -1303,14 +1303,14 @@ const char * IntlTest::pathToDataDirectory()
}
else {
/* __FILE__ on MSVC7 does not contain the directory */
FILE *file = fopen(".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING "data" U_FILE_SEP_STRING "Makefile.in", "r");
if (file) {
fclose(file);
fgDataDir = ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING "data" U_FILE_SEP_STRING;
}
else {
fgDataDir = ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING "data" U_FILE_SEP_STRING;
}
FILE *file = fopen(".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING "data" U_FILE_SEP_STRING "Makefile.in", "r");
if (file) {
fclose(file);
fgDataDir = ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING "data" U_FILE_SEP_STRING;
}
else {
fgDataDir = ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING "data" U_FILE_SEP_STRING;
}
}
}
#endif

View File

@ -1437,43 +1437,43 @@ IntlTestRBNF::TestSmallValues()
errln("FAIL: could not construct formatter");
} else {
static const char* testDataDefault[][2] = {
{ "0.001", "zero point zero zero one" },
{ "0.0001", "zero point zero zero zero one" },
{ "0.00001", "zero point zero zero zero zero one" },
{ "0.000001", "zero point zero zero zero zero zero one" },
{ "0.0000001", "zero point zero zero zero zero zero zero one" },
{ "0.00000001", "zero point zero zero zero zero zero zero zero one" },
{ "0.000000001", "zero point zero zero zero zero zero zero zero zero one" },
{ "0.0000000001", "zero point zero zero zero zero zero zero zero zero zero one" },
{ "0.00000000001", "zero point zero zero zero zero zero zero zero zero zero zero one" },
{ "0.000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero one" },
{ "0.0000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero zero one" },
{ "0.00000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero zero zero one" },
{ "0.000000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero zero zero zero one" },
{ "10,000,000.001", "ten million point zero zero one" },
{ "10,000,000.0001", "ten million point zero zero zero one" },
{ "10,000,000.00001", "ten million point zero zero zero zero one" },
{ "10,000,000.000001", "ten million point zero zero zero zero zero one" },
{ "10,000,000.0000001", "ten million point zero zero zero zero zero zero one" },
{ "0.001", "zero point zero zero one" },
{ "0.0001", "zero point zero zero zero one" },
{ "0.00001", "zero point zero zero zero zero one" },
{ "0.000001", "zero point zero zero zero zero zero one" },
{ "0.0000001", "zero point zero zero zero zero zero zero one" },
{ "0.00000001", "zero point zero zero zero zero zero zero zero one" },
{ "0.000000001", "zero point zero zero zero zero zero zero zero zero one" },
{ "0.0000000001", "zero point zero zero zero zero zero zero zero zero zero one" },
{ "0.00000000001", "zero point zero zero zero zero zero zero zero zero zero zero one" },
{ "0.000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero one" },
{ "0.0000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero zero one" },
{ "0.00000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero zero zero one" },
{ "0.000000000000001", "zero point zero zero zero zero zero zero zero zero zero zero zero zero zero zero one" },
{ "10,000,000.001", "ten million point zero zero one" },
{ "10,000,000.0001", "ten million point zero zero zero one" },
{ "10,000,000.00001", "ten million point zero zero zero zero one" },
{ "10,000,000.000001", "ten million point zero zero zero zero zero one" },
{ "10,000,000.0000001", "ten million point zero zero zero zero zero zero one" },
// { "10,000,000.00000001", "ten million point zero zero zero zero zero zero zero one" },
// { "10,000,000.000000002", "ten million point zero zero zero zero zero zero zero zero two" },
{ "10,000,000", "ten million" },
{ "10,000,000", "ten million" },
// { "1,234,567,890.0987654", "one billion, two hundred and thirty-four million, five hundred and sixty-seven thousand, eight hundred and ninety point zero nine eight seven six five four" },
// { "123,456,789.9876543", "one hundred and twenty-three million, four hundred and fifty-six thousand, seven hundred and eighty-nine point nine eight seven six five four three" },
// { "12,345,678.87654321", "twelve million, three hundred and forty-five thousand, six hundred and seventy-eight point eight seven six five four three two one" },
{ "1,234,567.7654321", "one million, two hundred and thirty-four thousand, five hundred and sixty-seven point seven six five four three two one" },
{ "123,456.654321", "one hundred and twenty-three thousand, four hundred and fifty-six point six five four three two one" },
{ "12,345.54321", "twelve thousand three hundred and forty-five point five four three two one" },
{ "1,234.4321", "one thousand two hundred and thirty-four point four three two one" },
{ "123.321", "one hundred and twenty-three point three two one" },
{ "0.0000000011754944", "zero point zero zero zero zero zero zero zero zero one one seven five four nine four four" },
{ "0.000001175494351", "zero point zero zero zero zero zero one one seven five four nine four three five one" },
{ "1,234,567.7654321", "one million, two hundred and thirty-four thousand, five hundred and sixty-seven point seven six five four three two one" },
{ "123,456.654321", "one hundred and twenty-three thousand, four hundred and fifty-six point six five four three two one" },
{ "12,345.54321", "twelve thousand three hundred and forty-five point five four three two one" },
{ "1,234.4321", "one thousand two hundred and thirty-four point four three two one" },
{ "123.321", "one hundred and twenty-three point three two one" },
{ "0.0000000011754944", "zero point zero zero zero zero zero zero zero zero one one seven five four nine four four" },
{ "0.000001175494351", "zero point zero zero zero zero zero one one seven five four nine four three five one" },
{ NULL, NULL }
};
};
doTest(formatter, testDataDefault, TRUE);
delete formatter;
delete formatter;
}
}

View File

@ -242,37 +242,37 @@ void IntlTestNumberFormatAPI::testAPI(/* char* par */)
#define SWAP_LOC Locale::getUS()
class NFTestFactory : public SimpleNumberFormatFactory {
NumberFormat* currencyStyle;
NumberFormat* currencyStyle;
public:
NFTestFactory()
: SimpleNumberFormatFactory(SRC_LOC, TRUE)
{
UErrorCode status = U_ZERO_ERROR;
currencyStyle = NumberFormat::createInstance(SWAP_LOC, status);
}
NFTestFactory()
: SimpleNumberFormatFactory(SRC_LOC, TRUE)
{
UErrorCode status = U_ZERO_ERROR;
currencyStyle = NumberFormat::createInstance(SWAP_LOC, status);
}
virtual ~NFTestFactory()
{
delete currencyStyle;
}
virtual ~NFTestFactory()
{
delete currencyStyle;
}
virtual NumberFormat* createFormat(const Locale& /* loc */, UNumberFormatStyle formatType)
{
if (formatType == UNUM_CURRENCY) {
return (NumberFormat*)currencyStyle->clone();
}
return NULL;
}
{
if (formatType == UNUM_CURRENCY) {
return (NumberFormat*)currencyStyle->clone();
}
return NULL;
}
virtual inline UClassID getDynamicClassID() const
{
return (UClassID)&gID;
return (UClassID)&gID;
}
static inline UClassID getStaticClassID()
{
return (UClassID)&gID;
return (UClassID)&gID;
}
private:
@ -285,35 +285,35 @@ void
IntlTestNumberFormatAPI::testRegistration()
{
#if !UCONFIG_NO_SERVICE
UErrorCode status = U_ZERO_ERROR;
NumberFormat* f0 = NumberFormat::createInstance(SWAP_LOC, status);
NumberFormat* f1 = NumberFormat::createInstance(SRC_LOC, status);
NumberFormat* f2 = NumberFormat::createCurrencyInstance(SRC_LOC, status);
URegistryKey key = NumberFormat::registerFactory(new NFTestFactory(), status);
NumberFormat* f3 = NumberFormat::createCurrencyInstance(SRC_LOC, status);
NumberFormat* f3a = NumberFormat::createCurrencyInstance(SRC_LOC, status);
NumberFormat* f4 = NumberFormat::createInstance(SRC_LOC, status);
UErrorCode status = U_ZERO_ERROR;
NumberFormat* f0 = NumberFormat::createInstance(SWAP_LOC, status);
NumberFormat* f1 = NumberFormat::createInstance(SRC_LOC, status);
NumberFormat* f2 = NumberFormat::createCurrencyInstance(SRC_LOC, status);
URegistryKey key = NumberFormat::registerFactory(new NFTestFactory(), status);
NumberFormat* f3 = NumberFormat::createCurrencyInstance(SRC_LOC, status);
NumberFormat* f3a = NumberFormat::createCurrencyInstance(SRC_LOC, status);
NumberFormat* f4 = NumberFormat::createInstance(SRC_LOC, status);
StringEnumeration* locs = NumberFormat::getAvailableLocales();
StringEnumeration* locs = NumberFormat::getAvailableLocales();
UNumberFormat* uf3 = unum_open(UNUM_CURRENCY, NULL, 0, SRC_LOC.getName(),NULL, &status);
UNumberFormat* uf4 = unum_open(UNUM_DEFAULT, NULL, 0, SRC_LOC.getName(), NULL, &status);
UNumberFormat* uf3 = unum_open(UNUM_CURRENCY, NULL, 0, SRC_LOC.getName(),NULL, &status);
UNumberFormat* uf4 = unum_open(UNUM_DEFAULT, NULL, 0, SRC_LOC.getName(), NULL, &status);
const UnicodeString* res;
for (res = locs->snext(status); res; res = locs->snext(status)) {
logln(*res); // service is still in synch
}
for (res = locs->snext(status); res; res = locs->snext(status)) {
logln(*res); // service is still in synch
}
NumberFormat::unregister(key, status); // restore for other tests
NumberFormat* f5 = NumberFormat::createCurrencyInstance(SRC_LOC, status);
UNumberFormat* uf5 = unum_open(UNUM_CURRENCY, NULL, 0, SRC_LOC.getName(),NULL, &status);
float n = 1234.567f;
UnicodeString res0, res1, res2, res3, res4, res5;
UChar ures3[50];
UChar ures4[50];
UChar ures5[50];
NumberFormat::unregister(key, status); // restore for other tests
NumberFormat* f5 = NumberFormat::createCurrencyInstance(SRC_LOC, status);
UNumberFormat* uf5 = unum_open(UNUM_CURRENCY, NULL, 0, SRC_LOC.getName(),NULL, &status);
float n = 1234.567f;
UnicodeString res0, res1, res2, res3, res4, res5;
UChar ures3[50];
UChar ures4[50];
UChar ures5[50];
f0->format(n, res0);
f1->format(n, res1);
@ -322,68 +322,68 @@ IntlTestNumberFormatAPI::testRegistration()
f4->format(n, res4);
f5->format(n, res5);
unum_formatDouble(uf3, n, ures3, 50, NULL, &status);
unum_formatDouble(uf4, n, ures4, 50, NULL, &status);
unum_formatDouble(uf5, n, ures5, 50, NULL, &status);
unum_formatDouble(uf3, n, ures3, 50, NULL, &status);
unum_formatDouble(uf4, n, ures4, 50, NULL, &status);
unum_formatDouble(uf5, n, ures5, 50, NULL, &status);
logln((UnicodeString)"f0 swap int: " + res0);
logln((UnicodeString)"f1 src int: " + res1);
logln((UnicodeString)"f2 src cur: " + res2);
logln((UnicodeString)"f3 reg cur: " + res3);
logln((UnicodeString)"f4 reg int: " + res4);
logln((UnicodeString)"f5 unreg cur: " + res5);
log("uf3 reg cur: ");
logln(ures3);
log("uf4 reg int: ");
logln(ures4);
log("uf5 ureg cur: ");
logln(ures5);
if (f3 == f3a) {
errln("did not get new instance from service");
} else {
delete f3a;
}
if (res3 != res0) {
errln("registered service did not match");
}
if (res4 != res1) {
errln("registered service did not inherit");
}
if (res5 != res2) {
errln("unregistered service did not match original");
}
logln((UnicodeString)"f0 swap int: " + res0);
logln((UnicodeString)"f1 src int: " + res1);
logln((UnicodeString)"f2 src cur: " + res2);
logln((UnicodeString)"f3 reg cur: " + res3);
logln((UnicodeString)"f4 reg int: " + res4);
logln((UnicodeString)"f5 unreg cur: " + res5);
log("uf3 reg cur: ");
logln(ures3);
log("uf4 reg int: ");
logln(ures4);
log("uf5 ureg cur: ");
logln(ures5);
if (f3 == f3a) {
errln("did not get new instance from service");
} else {
delete f3a;
}
if (res3 != res0) {
errln("registered service did not match");
}
if (res4 != res1) {
errln("registered service did not inherit");
}
if (res5 != res2) {
errln("unregistered service did not match original");
}
if (res0 != ures3) {
errln("registered service did not match / unum");
}
if (res1 != ures4) {
errln("registered service did not inherit / unum");
}
if (res2 != ures5) {
errln("unregistered service did not match original / unum");
}
if (res0 != ures3) {
errln("registered service did not match / unum");
}
if (res1 != ures4) {
errln("registered service did not inherit / unum");
}
if (res2 != ures5) {
errln("unregistered service did not match original / unum");
}
unum_close(uf5);
delete f5;
unum_close(uf4);
unum_close(uf3);
delete f4;
delete f3;
delete f2;
delete f1;
delete f0;
unum_close(uf5);
delete f5;
unum_close(uf4);
unum_close(uf3);
delete f4;
delete f3;
delete f2;
delete f1;
delete f0;
for (res = locs->snext(status); res; res = locs->snext(status)) {
errln(*res); // service should be out of synch
}
for (res = locs->snext(status); res; res = locs->snext(status)) {
errln(*res); // service should be out of synch
}
locs->reset(status); // now in synch again, we hope
for (res = locs->snext(status); res; res = locs->snext(status)) {
logln(*res);
}
locs->reset(status); // now in synch again, we hope
for (res = locs->snext(status); res; res = locs->snext(status)) {
logln(*res);
}
delete locs;
delete locs;
#endif
}

View File

@ -25,7 +25,7 @@ private:
* executes tests of API functions, see detailed comments in source code
**/
void testAPI(/* char* par */);
void testRegistration();
void testRegistration();
};
#endif /* #if !UCONFIG_NO_FORMATTING */

View File

@ -67,9 +67,9 @@ void NumberFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &n
CASE(20,TestSymbolsWithBadLocale);
CASE(21,TestAdoptDecimalFormatSymbols);
CASE(22,TestScientific2);
CASE(23,TestScientificGrouping);
CASE(24,TestInt64);
CASE(22,TestScientific2);
CASE(23,TestScientificGrouping);
CASE(24,TestInt64);
CASE(25,TestPerMill);
CASE(26,TestIllegalPatterns);
@ -351,134 +351,134 @@ NumberFormatTest::TestExponential(void)
void
NumberFormatTest::TestScientific2() {
// jb 2552
// jb 2552
UErrorCode status = U_ZERO_ERROR;
DecimalFormat* fmt = (DecimalFormat*)NumberFormat::createCurrencyInstance("en_US", status);
if (U_SUCCESS(status)) {
double num = 12.34;
expect(*fmt, num, "$12.34");
fmt->setScientificNotation(TRUE);
expect(*fmt, num, "$1.23E1");
fmt->setScientificNotation(FALSE);
expect(*fmt, num, "$12.34");
}
delete fmt;
if (U_SUCCESS(status)) {
double num = 12.34;
expect(*fmt, num, "$12.34");
fmt->setScientificNotation(TRUE);
expect(*fmt, num, "$1.23E1");
fmt->setScientificNotation(FALSE);
expect(*fmt, num, "$12.34");
}
delete fmt;
}
void
NumberFormatTest::TestScientificGrouping() {
// jb 2552
// jb 2552
UErrorCode status = U_ZERO_ERROR;
DecimalFormat fmt("##0.00E0",status);
if (U_SUCCESS(status)) {
expect(fmt, .01234, "12.3E-3");
expect(fmt, .1234, "123E-3");
expect(fmt, 1.234, "1.23E0");
expect(fmt, 12.34, "12.3E0");
expect(fmt, 123.4, "123E0");
expect(fmt, 1234., "1.23E3");
}
DecimalFormat fmt("##0.00E0",status);
if (U_SUCCESS(status)) {
expect(fmt, .01234, "12.3E-3");
expect(fmt, .1234, "123E-3");
expect(fmt, 1.234, "1.23E0");
expect(fmt, 12.34, "12.3E0");
expect(fmt, 123.4, "123E0");
expect(fmt, 1234., "1.23E3");
}
}
static void setFromString(DigitList& dl, const char* str) {
char c;
UBool decimalSet = FALSE;
dl.clear();
while ((c = *str++)) {
if (c == '-') {
dl.fIsPositive = FALSE;
} else if (c == '+') {
dl.fIsPositive = TRUE;
} else if (c == '.') {
dl.fDecimalAt = dl.fCount;
decimalSet = TRUE;
} else {
dl.append(c);
}
}
if (!decimalSet) {
dl.fDecimalAt = dl.fCount;
}
char c;
UBool decimalSet = FALSE;
dl.clear();
while ((c = *str++)) {
if (c == '-') {
dl.fIsPositive = FALSE;
} else if (c == '+') {
dl.fIsPositive = TRUE;
} else if (c == '.') {
dl.fDecimalAt = dl.fCount;
decimalSet = TRUE;
} else {
dl.append(c);
}
}
if (!decimalSet) {
dl.fDecimalAt = dl.fCount;
}
}
void
NumberFormatTest::TestInt64() {
UErrorCode status = U_ZERO_ERROR;
DecimalFormat fmt("#.#E0",status);
fmt.setMaximumFractionDigits(20);
if (U_SUCCESS(status)) {
expect(fmt, (Formattable)(int64_t)0, "0E0");
expect(fmt, (Formattable)(int64_t)-1, "-1E0");
expect(fmt, (Formattable)(int64_t)1, "1E0");
expect(fmt, (Formattable)(int64_t)2147483647, "2.147483647E9");
expect(fmt, (Formattable)((int64_t)-2147483647-1), "-2.147483648E9");
expect(fmt, (Formattable)(int64_t)U_INT64_MAX, "9.223372036854775807E18");
expect(fmt, (Formattable)(int64_t)U_INT64_MIN, "-9.223372036854775808E18");
}
DecimalFormat fmt("#.#E0",status);
fmt.setMaximumFractionDigits(20);
if (U_SUCCESS(status)) {
expect(fmt, (Formattable)(int64_t)0, "0E0");
expect(fmt, (Formattable)(int64_t)-1, "-1E0");
expect(fmt, (Formattable)(int64_t)1, "1E0");
expect(fmt, (Formattable)(int64_t)2147483647, "2.147483647E9");
expect(fmt, (Formattable)((int64_t)-2147483647-1), "-2.147483648E9");
expect(fmt, (Formattable)(int64_t)U_INT64_MAX, "9.223372036854775807E18");
expect(fmt, (Formattable)(int64_t)U_INT64_MIN, "-9.223372036854775808E18");
}
// also test digitlist
int64_t int64max = U_INT64_MAX;
int64_t int64min = U_INT64_MIN;
const char* int64maxstr = "9223372036854775807";
const char* int64minstr = "-9223372036854775808";
UnicodeString fail("fail: ");
// also test digitlist
int64_t int64max = U_INT64_MAX;
int64_t int64min = U_INT64_MIN;
const char* int64maxstr = "9223372036854775807";
const char* int64minstr = "-9223372036854775808";
UnicodeString fail("fail: ");
// test max int64 value
DigitList dl;
setFromString(dl, int64maxstr);
{
if (!dl.fitsIntoInt64(FALSE)) {
errln(fail + int64maxstr + " didn't fit");
}
int64_t int64Value = dl.getInt64();
if (int64Value != int64max) {
errln(fail + int64maxstr);
}
dl.set(int64Value);
int64Value = dl.getInt64();
if (int64Value != int64max) {
errln(fail + int64maxstr);
}
}
// test negative of max int64 value (1 shy of min int64 value)
dl.fIsPositive = FALSE;
{
if (!dl.fitsIntoInt64(FALSE)) {
errln(fail + "-" + int64maxstr + " didn't fit");
}
int64_t int64Value = dl.getInt64();
if (int64Value != -int64max) {
errln(fail + "-" + int64maxstr);
}
dl.set(int64Value);
int64Value = dl.getInt64();
if (int64Value != -int64max) {
errln(fail + "-" + int64maxstr);
}
}
// test min int64 value
setFromString(dl, int64minstr);
{
if (!dl.fitsIntoInt64(FALSE)) {
errln(fail + "-" + int64minstr + " didn't fit");
}
int64_t int64Value = dl.getInt64();
if (int64Value != int64min) {
errln(fail + int64minstr);
}
dl.set(int64Value);
int64Value = dl.getInt64();
if (int64Value != int64min) {
errln(fail + int64minstr);
}
}
// test negative of min int 64 value (1 more than max int64 value)
dl.fIsPositive = TRUE; // won't fit
{
if (dl.fitsIntoInt64(FALSE)) {
errln(fail + "-(" + int64minstr + ") didn't fit");
}
}
// test max int64 value
DigitList dl;
setFromString(dl, int64maxstr);
{
if (!dl.fitsIntoInt64(FALSE)) {
errln(fail + int64maxstr + " didn't fit");
}
int64_t int64Value = dl.getInt64();
if (int64Value != int64max) {
errln(fail + int64maxstr);
}
dl.set(int64Value);
int64Value = dl.getInt64();
if (int64Value != int64max) {
errln(fail + int64maxstr);
}
}
// test negative of max int64 value (1 shy of min int64 value)
dl.fIsPositive = FALSE;
{
if (!dl.fitsIntoInt64(FALSE)) {
errln(fail + "-" + int64maxstr + " didn't fit");
}
int64_t int64Value = dl.getInt64();
if (int64Value != -int64max) {
errln(fail + "-" + int64maxstr);
}
dl.set(int64Value);
int64Value = dl.getInt64();
if (int64Value != -int64max) {
errln(fail + "-" + int64maxstr);
}
}
// test min int64 value
setFromString(dl, int64minstr);
{
if (!dl.fitsIntoInt64(FALSE)) {
errln(fail + "-" + int64minstr + " didn't fit");
}
int64_t int64Value = dl.getInt64();
if (int64Value != int64min) {
errln(fail + int64minstr);
}
dl.set(int64Value);
int64Value = dl.getInt64();
if (int64Value != int64min) {
errln(fail + int64minstr);
}
}
// test negative of min int 64 value (1 more than max int64 value)
dl.fIsPositive = TRUE; // won't fit
{
if (dl.fitsIntoInt64(FALSE)) {
errln(fail + "-(" + int64minstr + ") didn't fit");
}
}
}
// -------------------------------------

View File

@ -24,7 +24,7 @@
int32_t gMyNumberFormatTestClassID;
UClassID MyNumberFormatTest::getDynamicClassID() const
{
return (UClassID)&gMyNumberFormatTestClassID;
return (UClassID)&gMyNumberFormatTestClassID;
}
@ -1957,9 +1957,9 @@ NumberFormatRegressionTest::Test4162198(void)
//if(n.getDouble() != dbl) {
// errln("Round trip failure");
//}
if (n.getInt64() != dbl) {
errln("Round trip failure");
}
if (n.getInt64() != dbl) {
errln("Round trip failure");
}
delete f;
}

View File

@ -934,8 +934,8 @@ void RBBIAPITest::TestRegistration() {
void RBBIAPITest::RoundtripRule(const char *dataFile) {
UErrorCode status = U_ZERO_ERROR;
UParseError parseError;
parseError.line = 0;
parseError.offset = 0;
parseError.line = 0;
parseError.offset = 0;
UDataMemory *data = udata_open(NULL, "brk", dataFile, &status);
uint32_t length;
const UChar *builtSource;

View File

@ -29,7 +29,7 @@
// Test class boilerplate
//
//---------------------------------------------------------------------------
RegexTest::RegexTest()
RegexTest::RegexTest()
{
};
@ -46,29 +46,29 @@ void RegexTest::runIndexedTest( int32_t index, UBool exec, const char* &name, ch
switch (index) {
case 0: name = "Basic";
if (exec) Basic();
if (exec) Basic();
break;
case 1: name = "API_Match";
if (exec) API_Match();
if (exec) API_Match();
break;
case 2: name = "API_Replace";
if (exec) API_Replace();
if (exec) API_Replace();
break;
case 3: name = "API_Pattern";
if (exec) API_Pattern();
if (exec) API_Pattern();
break;
case 4: name = "Extended";
if (exec) Extended();
if (exec) Extended();
break;
case 5: name = "Errors";
if (exec) Errors();
if (exec) Errors();
break;
case 6: name = "PerlTests";
if (exec) PerlTests();
break;
default: name = "";
default: name = "";
break; //needed to end loop
}
}
@ -106,7 +106,7 @@ if (status!=errcode) {errln("RegexTest failure at line %d. Expected status=%s,
//
// The expected results are UBool - TRUE or FALSE.
// The input text is unescaped. The pattern is not.
//
//
//
//---------------------------------------------------------------------------
@ -138,7 +138,7 @@ UBool RegexTest::doRegexLMTest(const char *pat, const char *text, UBool looking,
line, u_errorName(status));
return FALSE;
}
UBool actualmatch;
actualmatch = REMatcher->lookingAt(status);
if (U_FAILURE(status)) {
@ -171,7 +171,7 @@ UBool RegexTest::doRegexLMTest(const char *pat, const char *text, UBool looking,
delete REMatcher;
return retVal;
}
@ -185,8 +185,8 @@ UBool RegexTest::doRegexLMTest(const char *pat, const char *text, UBool looking,
// The input text is marked with the expected match positions
// <0>text <1> more text </1> </0>
// The <n> </n> tags are removed before trying the match.
// The tags mark the start and end of the match and of any capture groups.
//
// The tags mark the start and end of the match and of any capture groups.
//
//
//---------------------------------------------------------------------------
@ -205,8 +205,8 @@ static void set(UVector &vec, int val, UnicodeString index) {
while (vec.size()<idx+1) {vec.addElement(-1, status);}
vec.setElementAt(val, idx);
}
void RegexTest::regex_find(const UnicodeString &pattern,
void RegexTest::regex_find(const UnicodeString &pattern,
const UnicodeString &flags,
const UnicodeString &inputString,
int line) {
@ -230,16 +230,16 @@ void RegexTest::regex_find(const UnicodeString &pattern,
// Compile the caller's pattern
//
uint32_t bflags = 0;
if (flags.indexOf((UChar)0x69) >= 0) { // 'i' flag
if (flags.indexOf((UChar)0x69) >= 0) { // 'i' flag
bflags |= UREGEX_CASE_INSENSITIVE;
}
if (flags.indexOf((UChar)0x78) >= 0) { // 'x' flag
if (flags.indexOf((UChar)0x78) >= 0) { // 'x' flag
bflags |= UREGEX_COMMENTS;
}
if (flags.indexOf((UChar)0x73) >= 0) { // 's' flag
if (flags.indexOf((UChar)0x73) >= 0) { // 's' flag
bflags |= UREGEX_DOTALL;
}
if (flags.indexOf((UChar)0x6d) >= 0) { // 'm' flag
if (flags.indexOf((UChar)0x6d) >= 0) { // 'm' flag
bflags |= UREGEX_MULTILINE;
}
@ -281,7 +281,7 @@ void RegexTest::regex_find(const UnicodeString &pattern,
//
parsePat = RegexPattern::compile("<(/?)([0-9]+)>", 0, pe, status);
REGEX_CHECK_STATUS_L(line);
unEscapedInput = inputString.unescape();
parseMatcher = parsePat->matcher(unEscapedInput, status);
REGEX_CHECK_STATUS_L(line);
@ -334,9 +334,9 @@ void RegexTest::regex_find(const UnicodeString &pattern,
errln("Error at line %d: No match expected, but one found.\n", line);
failed = TRUE;
}
goto cleanupAndReturn;
goto cleanupAndReturn;
}
for (i=0; i<=matcher->groupCount(); i++) {
int32_t expectedStart = (i >= groupStarts.size()? -1 : groupStarts.elementAti(i));
if (matcher->start(i, status) != expectedStart) {
@ -355,11 +355,11 @@ void RegexTest::regex_find(const UnicodeString &pattern,
}
}
if ( matcher->groupCount()+1 < groupStarts.size()) {
errln("Error at line %d: Expected %d capture groups, found %d.",
errln("Error at line %d: Expected %d capture groups, found %d.",
line, groupStarts.size()-1, matcher->groupCount());
failed = TRUE;
}
cleanupAndReturn:
if (failed) {
errln("\"%s\" %s \"%s\"", (const char *)CharString(pattern, 0),
@ -372,7 +372,7 @@ cleanupAndReturn:
delete matcher;
delete callerPattern;
}
@ -550,23 +550,23 @@ void RegexTest::Basic() {
// Escape sequences that become single literal chars, handled internally
// by ICU's Unescape.
//
// REGEX_TESTLM("\101\142", "Ab", TRUE, TRUE); // Octal TODO: not implemented yet.
REGEX_TESTLM("\\a", "\\u0007", TRUE, TRUE); // BEL
REGEX_TESTLM("\\cL", "\\u000c", TRUE, TRUE); // Control-L
REGEX_TESTLM("\\e", "\\u001b", TRUE, TRUE); // Escape
REGEX_TESTLM("\\cL", "\\u000c", TRUE, TRUE); // Control-L
REGEX_TESTLM("\\e", "\\u001b", TRUE, TRUE); // Escape
REGEX_TESTLM("\\f", "\\u000c", TRUE, TRUE); // Form Feed
REGEX_TESTLM("\\n", "\\u000a", TRUE, TRUE); // new line
REGEX_TESTLM("\\r", "\\u000d", TRUE, TRUE); // CR
REGEX_TESTLM("\\t", "\\u0009", TRUE, TRUE); // Tab
REGEX_TESTLM("\\u1234", "\\u1234", TRUE, TRUE);
REGEX_TESTLM("\\U00001234", "\\u1234", TRUE, TRUE);
REGEX_TESTLM("\\u1234", "\\u1234", TRUE, TRUE);
REGEX_TESTLM("\\U00001234", "\\u1234", TRUE, TRUE);
REGEX_TESTLM(".*\\Ax", "xyz", TRUE, FALSE); // \A matches only at the beginning of input
REGEX_TESTLM(".*\\Ax", " xyz", FALSE, FALSE); // \A matches only at the beginning of input
// Escape of special chars in patterns
REGEX_TESTLM("\\\\\\|\\(\\)\\[\\{\\~\\$\\*\\+\\?\\.", "\\\\|()[{~$*+?.", TRUE, TRUE);
REGEX_TESTLM("\\\\\\|\\(\\)\\[\\{\\~\\$\\*\\+\\?\\.", "\\\\|()[{~$*+?.", TRUE, TRUE);
};
@ -574,7 +574,7 @@ void RegexTest::Basic() {
//---------------------------------------------------------------------------
//
// API_Match Test that the API for class RegexMatcher
// API_Match Test that the API for class RegexMatcher
// is present and nominally working, but excluding functions
// implementing replace operations.
//
@ -601,18 +601,18 @@ void RegexTest::API_Match() {
RegexPattern *pat2;
pat2 = RegexPattern::compile(re, flags, pe, status);
REGEX_CHECK_STATUS;
UnicodeString inStr1 = "abcdef this is a test";
UnicodeString instr2 = "not abc";
UnicodeString empty = "";
//
// Matcher creation and reset.
//
RegexMatcher *m1 = pat2->matcher(inStr1, status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(m1->lookingAt(status) == TRUE);
REGEX_ASSERT(m1->lookingAt(status) == TRUE);
REGEX_ASSERT(m1->input() == inStr1);
m1->reset(instr2);
REGEX_ASSERT(m1->lookingAt(status) == FALSE);
@ -626,7 +626,7 @@ void RegexTest::API_Match() {
REGEX_ASSERT(&m1->pattern() == pat2);
//
// reset(pos, status)
// reset(pos, status)
//
m1->reset(inStr1);
m1->reset(4, status);
@ -708,14 +708,14 @@ void RegexTest::API_Match() {
REGEX_CHECK_STATUS;
REGEX_ASSERT(m1->lookingAt(len+1, status) == FALSE);
REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR);
delete m1;
delete pat2;
}
//
// Capture Group.
// Capture Group.
// RegexMatcher::start();
// RegexMatcher::end();
// RegexMatcher::groupCount();
@ -729,10 +729,10 @@ void RegexTest::API_Match() {
RegexPattern *pat = RegexPattern::compile(re, flags, pe, status);
REGEX_CHECK_STATUS;
UnicodeString data = "0123456789";
RegexMatcher *matcher = pat->matcher(data, status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(matcher->lookingAt(status) == TRUE);
REGEX_ASSERT(matcher->lookingAt(status) == TRUE);
int matchStarts[] = {0, 2, 4, 8};
int matchEnds[] = {10, 8, 6, 10};
int i;
@ -789,7 +789,7 @@ void RegexTest::API_Match() {
REGEX_CHECK_STATUS;
UnicodeString data = ".abc..abc...abc..";
// 012345678901234567
RegexMatcher *matcher = pat->matcher(data, status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(matcher->find());
@ -843,17 +843,17 @@ void RegexTest::API_Match() {
REGEX_CHECK_STATUS;
UnicodeString data = ".abcabc.abc..";
// 012345678901234567
RegexMatcher *matcher = pat->matcher(data, status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(matcher->find());
REGEX_ASSERT(matcher->start(status) == 0);
REGEX_ASSERT(matcher->start(1, status) == -1);
REGEX_ASSERT(matcher->start(1, status) == -1);
REGEX_ASSERT(matcher->start(2, status) == 1);
REGEX_ASSERT(matcher->find());
REGEX_ASSERT(matcher->start(status) == 4);
REGEX_ASSERT(matcher->start(1, status) == 4);
REGEX_ASSERT(matcher->start(1, status) == 4);
REGEX_ASSERT(matcher->start(2, status) == -1);
REGEX_CHECK_STATUS;
@ -901,7 +901,7 @@ void RegexTest::API_Match() {
// match of zero length at the end of the input string.
int i;
UErrorCode status=U_ZERO_ERROR;
RegexMatcher m(".?", 0, status);
RegexMatcher m(".?", 0, status);
REGEX_CHECK_STATUS;
UnicodeString s(" ");
m.reset(s);
@ -933,7 +933,7 @@ void RegexTest::API_Match() {
RegexPattern *p = RegexPattern::compile(".", 0, status);
RegexMatcher *m = p->matcher(status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(m->find() == FALSE);
REGEX_ASSERT(m->input() == "");
delete m;
@ -969,7 +969,7 @@ void RegexTest::API_Match() {
//---------------------------------------------------------------------------
//
// API_Replace API test for class RegexMatcher, testing the
// API_Replace API test for class RegexMatcher, testing the
// Replace family of functions.
//
//---------------------------------------------------------------------------
@ -980,14 +980,14 @@ void RegexTest::API_Replace() {
int32_t flags=0;
UParseError pe;
UErrorCode status=U_ZERO_ERROR;
UnicodeString re("abc");
RegexPattern *pat = RegexPattern::compile(re, flags, pe, status);
REGEX_CHECK_STATUS;
UnicodeString data = ".abc..abc...abc..";
// 012345678901234567
RegexMatcher *matcher = pat->matcher(data, status);
//
// Plain vanilla matches.
//
@ -995,11 +995,11 @@ void RegexTest::API_Replace() {
dest = matcher->replaceFirst("yz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == ".yz..abc...abc..");
dest = matcher->replaceAll("yz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == ".yz..yz...yz..");
//
// Plain vanilla non-matches.
//
@ -1008,11 +1008,11 @@ void RegexTest::API_Replace() {
dest = matcher->replaceFirst("yz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == ".abx..abx...abx..");
dest = matcher->replaceAll("yz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == ".abx..abx...abx..");
//
// Empty source string
//
@ -1021,11 +1021,11 @@ void RegexTest::API_Replace() {
dest = matcher->replaceFirst("yz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == "");
dest = matcher->replaceAll("yz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == "");
//
// Empty substitution string
//
@ -1033,24 +1033,24 @@ void RegexTest::API_Replace() {
dest = matcher->replaceFirst("", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == "...abc...abc..");
dest = matcher->replaceAll("", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == "........");
//
// match whole string
//
UnicodeString d4 = "abc";
matcher->reset(d4);
matcher->reset(d4);
dest = matcher->replaceFirst("xyz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == "xyz");
dest = matcher->replaceAll("xyz", status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == "xyz");
//
// Capture Group, simple case
//
@ -1077,10 +1077,10 @@ void RegexTest::API_Replace() {
dest = matcher2->replaceFirst(replacement, status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(dest == "Supplemental Digit 1 bc.defg");
REGEX_ASSERT_FAIL(matcher2->replaceFirst("bad capture group number $5...",status), U_INDEX_OUTOFBOUNDS_ERROR);
//
// Replacement String with \u hex escapes
//
@ -1090,7 +1090,7 @@ void RegexTest::API_Replace() {
matcher->reset(src);
UnicodeString result = matcher->replaceAll(substitute, status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(result == "--C-- 1 --C-- 2 --C-- 3");
REGEX_ASSERT(result == "--C-- 1 --C-- 2 --C-- 3");
}
{
UnicodeString src = "abc !";
@ -1101,10 +1101,10 @@ void RegexTest::API_Replace() {
UnicodeString expected = UnicodeString("--");
expected.append((UChar32)0x10000);
expected.append("-- !");
REGEX_ASSERT(result == expected);
REGEX_ASSERT(result == expected);
}
// TODO: need more through testing of capture substitutions.
// Bug 4057
//
{
@ -1448,7 +1448,7 @@ RegexTest::getPath(char buffer[2048], const char *filename) {
const char *testDataDirectory = IntlTest::getSourceTestData(status);
if (U_FAILURE(status)) {
errln("ERROR: loadTestData() failed - %s", u_errorName(status));
return NULL;
return NULL;
}
strcpy(buffer, testDataDirectory);
@ -1482,7 +1482,7 @@ void RegexTest::Extended() {
UnicodeString testString(FALSE, testData, len);
RegexMatcher quotedStuffMat("\\s*([\\'\\\"/])(.*?)\\1", 0, status);
RegexMatcher commentMat ("\\s*(#.*)?$", 0, status);
RegexMatcher commentMat ("\\s*(#.*)?$", 0, status);
RegexMatcher flagsMat ("\\s*([ixsmdtGv2-9]*)([:letter:]*)", 0, status);
RegexMatcher lineMat("(.*?)\\r?\\n", testString, 0, status);
@ -1601,7 +1601,7 @@ void RegexTest::Errors() {
// TODO: add tests for unbounded length look-behinds.
REGEX_ERR("abc(?<@xyz).*", 1, 7, U_REGEX_RULE_SYNTAX); // illegal construct
// Attempt to use non-default flags
// Attempt to use non-default flags
{
UParseError pe;
UErrorCode status = U_ZERO_ERROR;
@ -1628,7 +1628,7 @@ void RegexTest::Errors() {
REGEX_ERR("abc{222222222222222222222}",1,14, U_REGEX_NUMBER_TOO_BIG);
REGEX_ERR("abc{5,50000000000}", 1, 17, U_REGEX_NUMBER_TOO_BIG); // Overflows int during scan
REGEX_ERR("abc{5,687865858}", 1, 16, U_REGEX_NUMBER_TOO_BIG); // Overflows regex binary format
REGEX_ERR("abc{687865858,687865859}", 1, 24, U_REGEX_NUMBER_TOO_BIG);
REGEX_ERR("abc{687865858,687865859}", 1, 24, U_REGEX_NUMBER_TOO_BIG);
// UnicodeSet containing a string
@ -1648,12 +1648,12 @@ UChar *RegexTest::ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode
char *fileBuf = NULL;
UConverter* conv = NULL;
FILE *f = NULL;
ulen = 0;
if (U_FAILURE(status)) {
return retPtr;
}
//
// Open the file.
//
@ -1668,7 +1668,7 @@ UChar *RegexTest::ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode
//
int fileSize;
int amt_read;
fseek( f, 0, SEEK_END);
fileSize = ftell(f);
fileBuf = new char[fileSize];
@ -1678,14 +1678,14 @@ UChar *RegexTest::ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode
errln("Error reading test data file.");
goto cleanUpAndReturn;
}
//
// Look for a Unicode Signature (BOM) on the data just read
//
int32_t signatureLength;
const char * fileBufC;
const char* encoding;
fileBufC = fileBuf;
encoding = ucnv_detectUnicodeSignature(
fileBuf, fileSize, &signatureLength, &status);
@ -1693,7 +1693,7 @@ UChar *RegexTest::ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode
fileBufC += signatureLength;
fileSize -= signatureLength;
}
//
// Open a converter to take the rule file to UTF-16
//
@ -1701,7 +1701,7 @@ UChar *RegexTest::ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode
if (U_FAILURE(status)) {
goto cleanUpAndReturn;
}
//
// Convert the rules to UChar.
// Preflight first to determine required buffer size.
@ -1715,7 +1715,7 @@ UChar *RegexTest::ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode
if (status == U_BUFFER_OVERFLOW_ERROR) {
// Buffer Overflow is expected from the preflight operation.
status = U_ZERO_ERROR;
retPtr = new UChar[ulen+1];
ucnv_toUChars(conv,
retPtr, // dest,
@ -1757,11 +1757,11 @@ cleanUpAndReturn:
// # Column 2 contains the string to be matched.
// #
// # Column 3 contains the expected result:
// # y expect a match
// # n expect no match
// # c expect an error
// # B test exposes a known bug in Perl, should be skipped
// # b test exposes a known bug in Perl, should be skipped if noamp
// # y expect a match
// # n expect no match
// # c expect an error
// # B test exposes a known bug in Perl, should be skipped
// # b test exposes a known bug in Perl, should be skipped if noamp
// #
// # Columns 4 and 5 are used only if column 3 contains C<y> or C<c>.
// #
@ -1846,7 +1846,7 @@ void RegexTest::PerlTests() {
// regexp for $-[0], $+[2], etc.
RegexPattern *groupsPat = RegexPattern::compile("\\$([+\\-])\\[(\\d+)\\]", 0, pe, status);
RegexMatcher *groupsMat = groupsPat->matcher(status);
// regexp for $0, $1, $2, etc.
RegexPattern *cgPat = RegexPattern::compile("\\$(\\d+)", 0, pe, status);
RegexMatcher *cgMat = cgPat->matcher(status);
@ -1944,7 +1944,7 @@ void RegexTest::PerlTests() {
//
// replace the Perl variables that appear in some of the
// match data strings.
// match data strings.
//
UnicodeString matchString = fields[1];
matchString.findAndReplace(nulnulSrc, nulnul);
@ -1954,7 +1954,7 @@ void RegexTest::PerlTests() {
// Don't do full unescape, as this unescapes more than Perl does, which
// causes other spurious failures in the tests.
matchString.findAndReplace("\\n", "\n");
//
@ -1967,7 +1967,7 @@ void RegexTest::PerlTests() {
expected = TRUE;
}
if (expected != found) {
errln("line %d: Expected %smatch, got %smatch",
errln("line %d: Expected %smatch, got %smatch",
lineNum, expected?"":"no ", found?"":"no " );
continue;
}
@ -1975,7 +1975,7 @@ void RegexTest::PerlTests() {
//
// Interpret the Perl expression from the fourth field of the data file,
// building up an ICU string from the results of the ICU match.
// The Perl expression will contain references to the results of
// The Perl expression will contain references to the results of
// a regex match, including the matched string, capture group strings,
// group starting and ending indicies, etc.
//
@ -2052,7 +2052,7 @@ void RegexTest::PerlTests() {
case 'n': c = '\n'; break;
// add any other escape sequences that show up in the test expected results.
}
resultString.append(c);
resultString.append(c);
perlExpr.remove(0, 1);
}
@ -2069,7 +2069,7 @@ void RegexTest::PerlTests() {
break;
}
}
//
// Expected Results Compare
//
@ -2094,19 +2094,19 @@ void RegexTest::PerlTests() {
//
delete cgMat;
delete cgPat;
delete groupsMat;
delete groupsPat;
delete flagMat;
delete flagPat;
delete lineMat;
delete linePat;
delete fieldPat;
delete [] testData;
logln("%d tests skipped because of unimplemented regexp features.", skippedUnimplementedCount);

View File

@ -992,7 +992,7 @@ NewResourceBundleTest::TestNewTypes() {
}
ResourceBundle theBundle(testdatapath, "testtypes", status);
ResourceBundle bundle(testdatapath, Locale("te_IN"),status);
ResourceBundle bundle(testdatapath, Locale("te_IN"),status);
UnicodeString emptyStr = theBundle.getStringEx("emptystring", status);
if(!emptyStr.length()==0) {
@ -1010,7 +1010,7 @@ NewResourceBundleTest::TestNewTypes() {
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
CONFIRM_EQ(res.getType(), URES_STRING);
UnicodeString zeroString=res.getString(status);
len = zeroString.length();
len = zeroString.length();
if(U_SUCCESS(status)){
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
CONFIRM_EQ(len, 7);
@ -1099,10 +1099,10 @@ NewResourceBundleTest::TestNewTypes() {
UnicodeString str = theBundle.getStringEx("testescape",status);
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
if(U_SUCCESS(status)){
u_charsToUChars(expect,uExpect,(int32_t)uprv_strlen(expect)+1);
u_charsToUChars(expect,uExpect,(int32_t)uprv_strlen(expect)+1);
if(str.compare(uExpect)!=0){
errln("Did not get the expected string for testescape expected. Expected : "
+UnicodeString(uExpect )+ " Got: " + str);
+UnicodeString(uExpect )+ " Got: " + str);
}
}
}
@ -1111,7 +1111,7 @@ NewResourceBundleTest::TestNewTypes() {
UnicodeString str = theBundle.getStringEx("test_underscores",status);
expect ="test message ....";
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
u_charsToUChars(expect,uExpect,(int32_t)uprv_strlen(expect)+1);
u_charsToUChars(expect,uExpect,(int32_t)uprv_strlen(expect)+1);
if(str.compare(uExpect)!=0){
errln("Did not get the expected string for test_underscores.\n");
}

View File

@ -32,7 +32,7 @@ public:
void TestOtherAPI(void);
void TestNewTypes(void);
void TestNewTypes(void);
private:
/**

View File

@ -2235,7 +2235,7 @@ void StringSearchTest::TestSubclass()
int i;
StringCharacterIterator chariter(text);
search.setText(text, status);
search.setText(text, status);
if (search.getText() != search2.getText()) {
errln("Error setting text");
}

View File

@ -86,7 +86,7 @@ private:
void TestSupplementaryCanonical();
void TestContractionCanonical();
void TestUClassID();
void TestSubclass();
void TestSubclass();
};
#endif /* #if !UCONFIG_NO_COLLATION */

View File

@ -500,7 +500,7 @@ int32_t CollationServiceTest::checkStringEnumeration(const char* msg,
logln(UnicodeString() + msg + " = [" + buf + "] (" + toString(i) + ")");
#else
logln(UnicodeString() + msg + " = [" + buf + "] (??? NO_FORMATTING)");
#endif
#endif
assertTrue("count verified", i==n);
// did we see all expected strings?
if (((1<<expectedCount)-1) != seenMask) {

View File

@ -387,13 +387,13 @@ void CollationThaiTest::TestInvalidThai(void) {
for (i=0; i < LINES; i++)
{
logln("%i", i);
for (j=i+1; j < LINES; j++) {
if (ucol_strcoll (thaiColl, toSort[i], -1, toSort[j], -1) == UCOL_GREATER)
{
// inconsistency ordering found!
for (j=i+1; j < LINES; j++) {
if (ucol_strcoll (thaiColl, toSort[i], -1, toSort[j], -1) == UCOL_GREATER)
{
// inconsistency ordering found!
errln("Inconsistent ordering between strings %i and %i", i, j);
}
}
}
}
iteratorText.setTo(toSort[i]);
c->setText(iteratorText, coll_status);
backAndForth(*c);

View File

@ -51,7 +51,7 @@ TestMessageFormat::runIndexedTest(int32_t index, UBool exec,
TESTCASE(15,testAdopt);
TESTCASE(16,testCopyConstructor2);
TESTCASE(17,TestUnlimitedArgsAndSubformats);
TESTCASE(18,TestRBNF);
TESTCASE(18,TestRBNF);
default: name = ""; break;
}
}

View File

@ -984,7 +984,7 @@ void TransliteratorRoundTripTest::TestKana() {
strcat(temp, HALFWIDTH_KATAKANA);
strcat(temp, LENGTH);
strcat(temp, "]");
test.test(KATAKANA, UnicodeString("[") + HIRAGANA + LENGTH + UnicodeString("]"),
test.test(KATAKANA, UnicodeString("[") + HIRAGANA + LENGTH + UnicodeString("]"),
temp,
this, quick, legal);
delete legal;

View File

@ -297,8 +297,8 @@ IntlTestNumberFormat::tryIt(double aNumber)
// Convert from long to double
if (number[i].getType() == Formattable::kLong)
number[i].setDouble(number[i].getLong());
else if (number[i].getType() == Formattable::kInt64)
number[i].setDouble((double)number[i].getInt64());
else if (number[i].getType() == Formattable::kInt64)
number[i].setDouble((double)number[i].getInt64());
else if (number[i].getType() != Formattable::kDouble)
{
errMsg = ("**** FAIL: Parse of " + prettify(string[i-1])

View File

@ -905,8 +905,8 @@ TimeZoneTest::TestDisplayName()
errln("Fail: Expected " + UnicodeString(kData[i].expect) + "; got " + name);
logln("PST [with options]->" + name);
}
for (i=0; kData[i].expect[0] != '\0'; i++)
{
for (i=0; kData[i].expect[0] != '\0'; i++)
{
name.remove();
name = zone->getDisplayName(kData[i].useDst,
kData[i].style, name);
@ -995,7 +995,7 @@ TimeZoneTest::TestDisplayName()
name.compare("GMT+0130") &&
name.compare("GMT+130"))
errln("Fail: Expected GMT+01:30 or something similar");
name.truncate(0);
name.truncate(0);
zone2->getDisplayName(name);
logln("GMT+90min->" + name);
if (name.compare("GMT+01:30") &&
@ -1189,29 +1189,29 @@ void TimeZoneTest::TestCountries() {
errln("FAIL: " + laZone + " in JP = " + la);
errln("FAIL: " + tokyoZone + " in JP = " + tokyo);
}
StringEnumeration* s1 = TimeZone::createEnumeration("US");
StringEnumeration* s2 = TimeZone::createEnumeration("US");
for(i=0;i<n;++i){
const UnicodeString* id1 = s1->snext(ec);
if(id1==NULL || U_FAILURE(ec)){
errln("Failed to fetch next from TimeZone enumeration. Length returned : %i Current Index: %i", n,i);
}
TimeZone* tz1 = TimeZone::createTimeZone(*id1);
for(int j=0; j<n;++j){
const UnicodeString* id2 = s2->snext(ec);
if(id2==NULL || U_FAILURE(ec)){
errln("Failed to fetch next from TimeZone enumeration. Length returned : %i Current Index: %i", n,i);
}
TimeZone* tz2 = TimeZone::createTimeZone(*id2);
if(tz1->hasSameRules(*tz2)){
logln("ID1 : " + *id1+" == ID2 : " +*id2);
}
delete tz2;
}
delete tz1;
}
delete s1;
delete s2;
StringEnumeration* s1 = TimeZone::createEnumeration("US");
StringEnumeration* s2 = TimeZone::createEnumeration("US");
for(i=0;i<n;++i){
const UnicodeString* id1 = s1->snext(ec);
if(id1==NULL || U_FAILURE(ec)){
errln("Failed to fetch next from TimeZone enumeration. Length returned : %i Current Index: %i", n,i);
}
TimeZone* tz1 = TimeZone::createTimeZone(*id1);
for(int j=0; j<n;++j){
const UnicodeString* id2 = s2->snext(ec);
if(id2==NULL || U_FAILURE(ec)){
errln("Failed to fetch next from TimeZone enumeration. Length returned : %i Current Index: %i", n,i);
}
TimeZone* tz2 = TimeZone::createTimeZone(*id2);
if(tz1->hasSameRules(*tz2)){
logln("ID1 : " + *id1+" == ID2 : " +*id2);
}
delete tz2;
}
delete tz1;
}
delete s1;
delete s2;
delete s;
}

View File

@ -43,8 +43,8 @@ const char *ids_class[MAX_CLASS_ID];
uint32_t ids_count = 0;
UObject *UObjectTest::testClass(UObject *obj,
const char *className, const char *factory,
UClassID staticID)
const char *className, const char *factory,
UClassID staticID)
{
uint32_t i;
UnicodeString what = UnicodeString(className) + " * x= " + UnicodeString(factory?factory:" ABSTRACT ") + "; ";
@ -94,11 +94,11 @@ UObject *UObjectTest::testClass(UObject *obj,
for(i=0;i<ids_count;i++) {
if(staticID == ids[i]) {
if(!strcmp(ids_class[i], className)) {
logln("OK: ID found is the same as " + UnicodeString(ids_class[i]) + UnicodeString(" *y= ") + ids_factory[i] + what);
return obj;
logln("OK: ID found is the same as " + UnicodeString(ids_class[i]) + UnicodeString(" *y= ") + ids_factory[i] + what);
return obj;
} else {
errln("FAIL: ID is the same as " + UnicodeString(ids_class[i]) + UnicodeString(" *y= ") + ids_factory[i] + what);
return obj;
errln("FAIL: ID is the same as " + UnicodeString(ids_class[i]) + UnicodeString(" *y= ") + ids_factory[i] + what);
return obj;
}
}
}

View File

@ -31,10 +31,10 @@ class UObjectTest : public IntlTest {
* @return Returns obj, suitable for deletion
*/
UObject *testClass(UObject *obj,
const char *className, const char *factory,
UClassID staticID);
const char *className, const char *factory,
UClassID staticID);
};
#endif

View File

@ -157,21 +157,21 @@ UnicodeStringTest::TestBasicManipulation()
}
}
{
// test new 2.2 constructors and setTo function that parallel Java's substring function.
UnicodeString src("Hello folks how are you?");
UnicodeString target1("how are you?");
if (target1 != UnicodeString(src, 12)) {
errln("UnicodeString(const UnicodeString&, int32_t) failed");
}
UnicodeString target2("folks");
if (target2 != UnicodeString(src, 6, 5)) {
errln("UnicodeString(const UnicodeString&, int32_t, int32_t) failed");
}
if (target1 != target2.setTo(src, 12)) {
errln("UnicodeString::setTo(const UnicodeString&, int32_t) failed");
}
}
{
// test new 2.2 constructors and setTo function that parallel Java's substring function.
UnicodeString src("Hello folks how are you?");
UnicodeString target1("how are you?");
if (target1 != UnicodeString(src, 12)) {
errln("UnicodeString(const UnicodeString&, int32_t) failed");
}
UnicodeString target2("folks");
if (target2 != UnicodeString(src, 6, 5)) {
errln("UnicodeString(const UnicodeString&, int32_t, int32_t) failed");
}
if (target1 != target2.setTo(src, 12)) {
errln("UnicodeString::setTo(const UnicodeString&, int32_t) failed");
}
}
{
// op+ is new in ICU 2.8

View File

@ -302,8 +302,8 @@ int main(int argc, char **argv) {
// This will compile the rules.
//
UParseError parseError;
parseError.line = 0;
parseError.offset = 0;
parseError.line = 0;
parseError.offset = 0;
RuleBasedBreakIterator *bi = new RuleBasedBreakIterator(ruleSourceS, parseError, status);
if (U_FAILURE(status)) {
fprintf(stderr, "createRuleBasedBreakIterator: ICU Error \"%s\" at line %d, column %d\n",

View File

@ -806,7 +806,7 @@ void Builder::fixupMiscellaneousOffsets() {
header.nameToEnum_offset = nameToEnum_offset;
header.enumToValue_offset = enumToValue_offset;
// header meta-info used by Java:
U_ASSERT(total_size > 0 && total_size < 0x7FFF);
U_ASSERT(total_size > 0 && total_size < 0x7FFF);
header.total_size = (int16_t) total_size;
header.valueMap_offset = valueMap_offset;
header.valueMap_count = (int16_t) valueMap_count;
@ -815,9 +815,9 @@ void Builder::fixupMiscellaneousOffsets() {
header.stringPool_offset = stringPool_offset;
header.stringPool_count = (int16_t) stringPool_count - 1; // don't include "" entry
U_ASSERT(valueMap_count <= 0x7FFF);
U_ASSERT(nameGroupPool_count <= 0x7FFF);
U_ASSERT(stringPool_count <= 0x7FFF);
U_ASSERT(valueMap_count <= 0x7FFF);
U_ASSERT(nameGroupPool_count <= 0x7FFF);
U_ASSERT(stringPool_count <= 0x7FFF);
// 3:
Offset* p = enumToValue->getOffsetArray();

View File

@ -499,7 +499,7 @@ parseUCARules(char *tag, uint32_t startline, UErrorCode *status)
}
}
/* terminate the string */
/* terminate the string */
if(target < targetLimit){
*target = 0x0000;
}

View File

@ -90,12 +90,12 @@ encodeRunByte(uint16_t* buffer,uint16_t* bufLimit, uint8_t value, int32_t length
}
#define APPEND( buffer, bufLimit, value, num, status){ \
if(buffer<bufLimit){ \
*buffer++=(value); \
}else{ \
*status = U_BUFFER_OVERFLOW_ERROR; \
} \
num++; \
if(buffer<bufLimit){ \
*buffer++=(value); \
}else{ \
*status = U_BUFFER_OVERFLOW_ERROR; \
} \
num++; \
}
/**

View File

@ -28,10 +28,10 @@
} \
else \
{ \
target[0] = U16_LEAD(c); \
target[1] = U16_TRAIL(c); \
target[0] = U16_LEAD(c); \
target[1] = U16_TRAIL(c); \
len=2; \
target +=2; \
target +=2; \
} \
}

View File

@ -782,20 +782,20 @@ write_uca_table(const char *filename,
UChar variableTopValue = 0;
UCATableHeader *myD = (UCATableHeader *)uprv_malloc(sizeof(UCATableHeader));
/* test for NULL */
if(myD == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
fclose(data);
return 0;
}
if(myD == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
fclose(data);
return 0;
}
uprv_memset(myD, 0, sizeof(UCATableHeader));
UColOptionSet *opts = (UColOptionSet *)uprv_malloc(sizeof(UColOptionSet));
/* test for NULL */
if(opts == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
uprv_free(myD);
fclose(data);
return 0;
}
if(opts == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
uprv_free(myD);
fclose(data);
return 0;
}
uprv_memset(opts, 0, sizeof(UColOptionSet));
UChar contractionCEs[256][3];
uprv_memset(contractionCEs, 0, 256*3*sizeof(UChar));

View File

@ -173,7 +173,7 @@ static UOption options[]={
UOPTION_DESTDIR, /* 4 */
UOPTION_VERBOSE, /* 5 */
UOPTION_PACKAGE_NAME, /* 6 */
UOPTION_DEF( "touchfile", 't', UOPT_NO_ARG) /* 7 */
UOPTION_DEF( "touchfile", 't', UOPT_NO_ARG) /* 7 */
};
int main(int argc, char* argv[])

View File

@ -28,7 +28,7 @@ const char *pkg_writeCharListWrap(FileStream *s, CharList *l, const char *delim,
{
int32_t ln = 0;
char buffer[1024];
const CharList *ol = NULL;
const CharList *ol = NULL;
while(l != NULL)
{
if(l->str)
@ -57,7 +57,7 @@ const char *pkg_writeCharListWrap(FileStream *s, CharList *l, const char *delim,
ln += (int32_t)uprv_strlen(l->str);
ol = l;
ol = l;
if(l->next && delim)
{