mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-6902 merge of r26358 into trunk (z changes)
X-SVN-Rev: 26381
This commit is contained in:
parent
95d74a66dc
commit
9f373b4b5a
11 changed files with 146 additions and 55 deletions
|
@ -248,7 +248,7 @@
|
|||
* you must use the U_CAPI and U_EXPORT2 qualifiers.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#if defined(OS390) && (__COMPILER_VER__ < 0x41020000) && defined(XP_CPLUSPLUS)
|
||||
#if defined(OS390) && defined(XP_CPLUSPLUS)
|
||||
# define U_CALLCONV __cdecl
|
||||
#else
|
||||
# define U_CALLCONV U_EXPORT2
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
# Make sure we have the right version of Make.
|
||||
|
||||
at_least=3.80
|
||||
ifeq ($(MACHTYPE),i370-ibm-mvs)
|
||||
at_least=3.76.1
|
||||
endif
|
||||
|
||||
latest_a=$(firstword $(sort $(MAKE_VERSION) $(at_least)))
|
||||
|
||||
ifneq ($(at_least),$(latest_a))
|
||||
|
|
|
@ -66,7 +66,10 @@ struct UResourceBundleAIterator {
|
|||
|
||||
/* Must be C linkage to pass function pointer to the sort function */
|
||||
|
||||
extern "C" static int32_t U_CALLCONV
|
||||
#if !defined (OS390)
|
||||
extern "C"
|
||||
#endif
|
||||
static int32_t U_CALLCONV
|
||||
ures_a_codepointSort(const void *context, const void *left, const void *right) {
|
||||
//CompareContext *cmp=(CompareContext *)context;
|
||||
return u_strcmp(((const UResAEntry *)left)->key,
|
||||
|
|
|
@ -661,7 +661,7 @@ typedef struct {
|
|||
|
||||
|
||||
// Comparason function used in quick sort.
|
||||
static int currencyNameComparator(const void* a, const void* b) {
|
||||
static int U_CALLCONV currencyNameComparator(const void* a, const void* b) {
|
||||
const CurrencyNameStruct* currName_1 = (const CurrencyNameStruct*)a;
|
||||
const CurrencyNameStruct* currName_2 = (const CurrencyNameStruct*)b;
|
||||
for (int32_t i = 0;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2007-2008, International Business Machines Corporation and *
|
||||
* Copyright (C) 2007-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -368,25 +368,25 @@ private:
|
|||
void writeHeaders(VTZWriter& w, UErrorCode& status) const;
|
||||
void writeFooter(VTZWriter& writer, UErrorCode& status) const;
|
||||
|
||||
void writeZonePropsByTime(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
|
||||
void writeZonePropsByTime(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
||||
int32_t fromOffset, int32_t toOffset, UDate time, UBool withRDATE,
|
||||
UErrorCode& status) const;
|
||||
void writeZonePropsByDOM(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
|
||||
void writeZonePropsByDOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
||||
int32_t fromOffset, int32_t toOffset,
|
||||
int32_t month, int32_t dayOfMonth, UDate startTime, UDate untilTime,
|
||||
UErrorCode& status) const;
|
||||
void writeZonePropsByDOW(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
|
||||
void writeZonePropsByDOW(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
||||
int32_t fromOffset, int32_t toOffset,
|
||||
int32_t month, int32_t weekInMonth, int32_t dayOfWeek,
|
||||
UDate startTime, UDate untilTime, UErrorCode& status) const;
|
||||
void writeZonePropsByDOW_GEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
|
||||
void writeZonePropsByDOW_GEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
||||
int32_t fromOffset, int32_t toOffset,
|
||||
int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
|
||||
UDate startTime, UDate untilTime, UErrorCode& status) const;
|
||||
void writeZonePropsByDOW_GEQ_DOM_sub(VTZWriter& writer, int32_t month, int32_t dayOfMonth,
|
||||
int32_t dayOfWeek, int32_t numDays,
|
||||
UDate untilTime, int32_t fromOffset, UErrorCode& status) const;
|
||||
void writeZonePropsByDOW_LEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
|
||||
void writeZonePropsByDOW_LEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
||||
int32_t fromOffset, int32_t toOffset,
|
||||
int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
|
||||
UDate startTime, UDate untilTime, UErrorCode& status) const;
|
||||
|
@ -394,7 +394,7 @@ private:
|
|||
int32_t fromRawOffset, int32_t fromDSTSavings,
|
||||
UDate startTime, UErrorCode& status) const;
|
||||
|
||||
void beginZoneProps(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
|
||||
void beginZoneProps(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
||||
int32_t fromOffset, int32_t toOffset, UDate startTime, UErrorCode& status) const;
|
||||
void endZoneProps(VTZWriter& writer, UBool isDst, UErrorCode& status) const;
|
||||
void beginRRULE(VTZWriter& writer, int32_t month, UErrorCode& status) const;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2007-2008, International Business Machines Corporation and *
|
||||
* Copyright (C) 2007-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -354,12 +354,12 @@ static void millisToOffset(int32_t millis, UnicodeString& str) {
|
|||
/*
|
||||
* Create a default TZNAME from TZID
|
||||
*/
|
||||
static void getDefaultTZName(const UnicodeString tzid, UBool isDST, UnicodeString& tzname) {
|
||||
tzname = tzid;
|
||||
static void getDefaultTZName(const UnicodeString tzid, UBool isDST, UnicodeString& zonename) {
|
||||
zonename = tzid;
|
||||
if (isDST) {
|
||||
tzname += UNICODE_STRING_SIMPLE("(DST)");
|
||||
zonename += UNICODE_STRING_SIMPLE("(DST)");
|
||||
} else {
|
||||
tzname += UNICODE_STRING_SIMPLE("(STD)");
|
||||
zonename += UNICODE_STRING_SIMPLE("(STD)");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -519,7 +519,7 @@ rruleParseError:
|
|||
}
|
||||
}
|
||||
|
||||
static TimeZoneRule* createRuleByRRULE(const UnicodeString& tzname, int rawOffset, int dstSavings, UDate start,
|
||||
static TimeZoneRule* createRuleByRRULE(const UnicodeString& zonename, int rawOffset, int dstSavings, UDate start,
|
||||
UVector* dates, int fromOffset, UErrorCode& status) {
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
|
@ -712,7 +712,7 @@ static TimeZoneRule* createRuleByRRULE(const UnicodeString& tzname, int rawOffse
|
|||
if (adtr == NULL) {
|
||||
goto unsupportedRRule;
|
||||
}
|
||||
return new AnnualTimeZoneRule(tzname, rawOffset, dstSavings, adtr, startYear, endYear);
|
||||
return new AnnualTimeZoneRule(zonename, rawOffset, dstSavings, adtr, startYear, endYear);
|
||||
|
||||
unsupportedRRule:
|
||||
status = U_INVALID_STATE_ERROR;
|
||||
|
@ -722,7 +722,7 @@ unsupportedRRule:
|
|||
/*
|
||||
* Create a TimeZoneRule by the RDATE definition
|
||||
*/
|
||||
static TimeZoneRule* createRuleByRDATE(const UnicodeString& tzname, int32_t rawOffset, int32_t dstSavings,
|
||||
static TimeZoneRule* createRuleByRDATE(const UnicodeString& zonename, int32_t rawOffset, int32_t dstSavings,
|
||||
UDate start, UVector* dates, int32_t fromOffset, UErrorCode& status) {
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
|
@ -731,7 +731,7 @@ static TimeZoneRule* createRuleByRDATE(const UnicodeString& tzname, int32_t rawO
|
|||
if (dates == NULL || dates->size() == 0) {
|
||||
// When no RDATE line is provided, use start (DTSTART)
|
||||
// as the transition time
|
||||
retVal = new TimeArrayTimeZoneRule(tzname, rawOffset, dstSavings,
|
||||
retVal = new TimeArrayTimeZoneRule(zonename, rawOffset, dstSavings,
|
||||
&start, 1, DateTimeRule::UTC_TIME);
|
||||
} else {
|
||||
// Create an array of transition times
|
||||
|
@ -749,7 +749,7 @@ static TimeZoneRule* createRuleByRDATE(const UnicodeString& tzname, int32_t rawO
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
retVal = new TimeArrayTimeZoneRule(tzname, rawOffset, dstSavings,
|
||||
retVal = new TimeArrayTimeZoneRule(zonename, rawOffset, dstSavings,
|
||||
times, size, DateTimeRule::UTC_TIME);
|
||||
uprv_free(times);
|
||||
}
|
||||
|
@ -1324,7 +1324,7 @@ VTimeZone::parse(UErrorCode& status) {
|
|||
UBool dst = FALSE; // current zone type
|
||||
UnicodeString from; // current zone from offset
|
||||
UnicodeString to; // current zone offset
|
||||
UnicodeString tzname; // current zone name
|
||||
UnicodeString zonename; // current zone name
|
||||
UnicodeString dtstart; // current zone starts
|
||||
UBool isRRULE = FALSE; // true if the rule is described by RRULE
|
||||
int32_t initialRawOffset = 0; // initial offset
|
||||
|
@ -1398,7 +1398,7 @@ VTimeZone::parse(UErrorCode& status) {
|
|||
isRRULE = FALSE;
|
||||
from.remove();
|
||||
to.remove();
|
||||
tzname.remove();
|
||||
zonename.remove();
|
||||
dst = isDST;
|
||||
state = TZI;
|
||||
} else {
|
||||
|
@ -1414,7 +1414,7 @@ VTimeZone::parse(UErrorCode& status) {
|
|||
if (name.compare(ICAL_DTSTART) == 0) {
|
||||
dtstart = value;
|
||||
} else if (name.compare(ICAL_TZNAME) == 0) {
|
||||
tzname = value;
|
||||
zonename = value;
|
||||
} else if (name.compare(ICAL_TZOFFSETFROM) == 0) {
|
||||
from = value;
|
||||
} else if (name.compare(ICAL_TZOFFSETTO) == 0) {
|
||||
|
@ -1458,9 +1458,9 @@ VTimeZone::parse(UErrorCode& status) {
|
|||
if (dtstart.length() == 0 || from.length() == 0 || to.length() == 0) {
|
||||
goto cleanupParse;
|
||||
}
|
||||
// if tzname is not available, create one from tzid
|
||||
if (tzname.length() == 0) {
|
||||
getDefaultTZName(tzid, dst, tzname);
|
||||
// if zonename is not available, create one from tzid
|
||||
if (zonename.length() == 0) {
|
||||
getDefaultTZName(tzid, dst, zonename);
|
||||
}
|
||||
|
||||
// create a time zone rule
|
||||
|
@ -1502,9 +1502,9 @@ VTimeZone::parse(UErrorCode& status) {
|
|||
// Create the rule
|
||||
UDate actualStart = MAX_MILLIS;
|
||||
if (isRRULE) {
|
||||
rule = createRuleByRRULE(tzname, rawOffset, dstSavings, start, dates, fromOffset, status);
|
||||
rule = createRuleByRRULE(zonename, rawOffset, dstSavings, start, dates, fromOffset, status);
|
||||
} else {
|
||||
rule = createRuleByRDATE(tzname, rawOffset, dstSavings, start, dates, fromOffset, status);
|
||||
rule = createRuleByRDATE(zonename, rawOffset, dstSavings, start, dates, fromOffset, status);
|
||||
}
|
||||
if (U_FAILURE(status) || rule == NULL) {
|
||||
goto cleanupParse;
|
||||
|
@ -1545,8 +1545,8 @@ VTimeZone::parse(UErrorCode& status) {
|
|||
}
|
||||
|
||||
// Create a initial rule
|
||||
getDefaultTZName(tzid, FALSE, tzname);
|
||||
initialRule = new InitialTimeZoneRule(tzname,
|
||||
getDefaultTZName(tzid, FALSE, zonename);
|
||||
initialRule = new InitialTimeZoneRule(zonename,
|
||||
initialRawOffset, initialDSTSavings);
|
||||
if (initialRule == NULL) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
|
@ -2178,13 +2178,13 @@ VTimeZone::writeFooter(VTZWriter& writer, UErrorCode& status) const {
|
|||
* Write a single start time
|
||||
*/
|
||||
void
|
||||
VTimeZone::writeZonePropsByTime(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
|
||||
VTimeZone::writeZonePropsByTime(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
||||
int32_t fromOffset, int32_t toOffset, UDate time, UBool withRDATE,
|
||||
UErrorCode& status) const {
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
beginZoneProps(writer, isDst, tzname, fromOffset, toOffset, time, status);
|
||||
beginZoneProps(writer, isDst, zonename, fromOffset, toOffset, time, status);
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
@ -2205,14 +2205,14 @@ VTimeZone::writeZonePropsByTime(VTZWriter& writer, UBool isDst, const UnicodeStr
|
|||
* Write start times defined by a DOM rule using VTIMEZONE RRULE
|
||||
*/
|
||||
void
|
||||
VTimeZone::writeZonePropsByDOM(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
|
||||
VTimeZone::writeZonePropsByDOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
||||
int32_t fromOffset, int32_t toOffset,
|
||||
int32_t month, int32_t dayOfMonth, UDate startTime, UDate untilTime,
|
||||
UErrorCode& status) const {
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
beginZoneProps(writer, isDst, tzname, fromOffset, toOffset, startTime, status);
|
||||
beginZoneProps(writer, isDst, zonename, fromOffset, toOffset, startTime, status);
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
@ -2239,14 +2239,14 @@ VTimeZone::writeZonePropsByDOM(VTZWriter& writer, UBool isDst, const UnicodeStri
|
|||
* Write start times defined by a DOW rule using VTIMEZONE RRULE
|
||||
*/
|
||||
void
|
||||
VTimeZone::writeZonePropsByDOW(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
|
||||
VTimeZone::writeZonePropsByDOW(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
||||
int32_t fromOffset, int32_t toOffset,
|
||||
int32_t month, int32_t weekInMonth, int32_t dayOfWeek,
|
||||
UDate startTime, UDate untilTime, UErrorCode& status) const {
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
beginZoneProps(writer, isDst, tzname, fromOffset, toOffset, startTime, status);
|
||||
beginZoneProps(writer, isDst, zonename, fromOffset, toOffset, startTime, status);
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
@ -2275,7 +2275,7 @@ VTimeZone::writeZonePropsByDOW(VTZWriter& writer, UBool isDst, const UnicodeStri
|
|||
* Write start times defined by a DOW_GEQ_DOM rule using VTIMEZONE RRULE
|
||||
*/
|
||||
void
|
||||
VTimeZone::writeZonePropsByDOW_GEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
|
||||
VTimeZone::writeZonePropsByDOW_GEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
||||
int32_t fromOffset, int32_t toOffset,
|
||||
int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
|
||||
UDate startTime, UDate untilTime, UErrorCode& status) const {
|
||||
|
@ -2285,21 +2285,21 @@ VTimeZone::writeZonePropsByDOW_GEQ_DOM(VTZWriter& writer, UBool isDst, const Uni
|
|||
// Check if this rule can be converted to DOW rule
|
||||
if (dayOfMonth%7 == 1) {
|
||||
// Can be represented by DOW rule
|
||||
writeZonePropsByDOW(writer, isDst, tzname, fromOffset, toOffset,
|
||||
writeZonePropsByDOW(writer, isDst, zonename, fromOffset, toOffset,
|
||||
month, (dayOfMonth + 6)/7, dayOfWeek, startTime, untilTime, status);
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
} else if (month != UCAL_FEBRUARY && (MONTHLENGTH[month] - dayOfMonth)%7 == 6) {
|
||||
// Can be represented by DOW rule with negative week number
|
||||
writeZonePropsByDOW(writer, isDst, tzname, fromOffset, toOffset,
|
||||
writeZonePropsByDOW(writer, isDst, zonename, fromOffset, toOffset,
|
||||
month, -1*((MONTHLENGTH[month] - dayOfMonth + 1)/7), dayOfWeek, startTime, untilTime, status);
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Otherwise, use BYMONTHDAY to include all possible dates
|
||||
beginZoneProps(writer, isDst, tzname, fromOffset, toOffset, startTime, status);
|
||||
beginZoneProps(writer, isDst, zonename, fromOffset, toOffset, startTime, status);
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
@ -2399,7 +2399,7 @@ VTimeZone::writeZonePropsByDOW_GEQ_DOM_sub(VTZWriter& writer, int32_t month, int
|
|||
* Write start times defined by a DOW_LEQ_DOM rule using VTIMEZONE RRULE
|
||||
*/
|
||||
void
|
||||
VTimeZone::writeZonePropsByDOW_LEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
|
||||
VTimeZone::writeZonePropsByDOW_LEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
||||
int32_t fromOffset, int32_t toOffset,
|
||||
int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
|
||||
UDate startTime, UDate untilTime, UErrorCode& status) const {
|
||||
|
@ -2409,19 +2409,19 @@ VTimeZone::writeZonePropsByDOW_LEQ_DOM(VTZWriter& writer, UBool isDst, const Uni
|
|||
// Check if this rule can be converted to DOW rule
|
||||
if (dayOfMonth%7 == 0) {
|
||||
// Can be represented by DOW rule
|
||||
writeZonePropsByDOW(writer, isDst, tzname, fromOffset, toOffset,
|
||||
writeZonePropsByDOW(writer, isDst, zonename, fromOffset, toOffset,
|
||||
month, dayOfMonth/7, dayOfWeek, startTime, untilTime, status);
|
||||
} else if (month != UCAL_FEBRUARY && (MONTHLENGTH[month] - dayOfMonth)%7 == 0){
|
||||
// Can be represented by DOW rule with negative week number
|
||||
writeZonePropsByDOW(writer, isDst, tzname, fromOffset, toOffset,
|
||||
writeZonePropsByDOW(writer, isDst, zonename, fromOffset, toOffset,
|
||||
month, -1*((MONTHLENGTH[month] - dayOfMonth)/7 + 1), dayOfWeek, startTime, untilTime, status);
|
||||
} else if (month == UCAL_FEBRUARY && dayOfMonth == 29) {
|
||||
// Specical case for February
|
||||
writeZonePropsByDOW(writer, isDst, tzname, fromOffset, toOffset,
|
||||
writeZonePropsByDOW(writer, isDst, zonename, fromOffset, toOffset,
|
||||
UCAL_FEBRUARY, -1, dayOfWeek, startTime, untilTime, status);
|
||||
} else {
|
||||
// Otherwise, convert this to DOW_GEQ_DOM rule
|
||||
writeZonePropsByDOW_GEQ_DOM(writer, isDst, tzname, fromOffset, toOffset,
|
||||
writeZonePropsByDOW_GEQ_DOM(writer, isDst, zonename, fromOffset, toOffset,
|
||||
month, dayOfMonth - 6, dayOfWeek, startTime, untilTime, status);
|
||||
}
|
||||
}
|
||||
|
@ -2472,7 +2472,7 @@ VTimeZone::writeFinalRule(VTZWriter& writer, UBool isDst, const AnnualTimeZoneRu
|
|||
* Write the opening section of zone properties
|
||||
*/
|
||||
void
|
||||
VTimeZone::beginZoneProps(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
|
||||
VTimeZone::beginZoneProps(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
||||
int32_t fromOffset, int32_t toOffset, UDate startTime, UErrorCode& status) const {
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
|
@ -2505,7 +2505,7 @@ VTimeZone::beginZoneProps(VTZWriter& writer, UBool isDst, const UnicodeString& t
|
|||
// TZNAME
|
||||
writer.write(ICAL_TZNAME);
|
||||
writer.write(COLON);
|
||||
writer.write(tzname);
|
||||
writer.write(zonename);
|
||||
writer.write(ICAL_NEWLINE);
|
||||
|
||||
// DTSTART
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/* Needed by z/OS to get usleep */
|
||||
#include "platform_xopen_source_extended.h"
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/ustring.h"
|
||||
|
@ -28,6 +26,17 @@
|
|||
#define POSIX 1
|
||||
#endif
|
||||
|
||||
/* Needed by z/OS to get usleep */
|
||||
#if defined(OS390)
|
||||
#define __DOT1 1
|
||||
#define __UU
|
||||
#define _XOPEN_SOURCE_EXTENDED 1
|
||||
#ifndef _XPG4_2
|
||||
#define _XPG4_2
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
/*#include "platform_xopen_source_extended.h"*/
|
||||
#endif
|
||||
#if defined(POSIX) || defined(U_SOLARIS) || defined(U_AIX) || defined(U_HPUX)
|
||||
|
||||
#define HAVE_IMP
|
||||
|
@ -47,7 +56,13 @@
|
|||
#define __EXTENSIONS__
|
||||
#endif
|
||||
|
||||
#if defined(OS390)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if !defined(OS390)
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
/* Define _XPG4_2 for Solaris and friends. */
|
||||
#ifndef _XPG4_2
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 2004-2006, International Business Machines Corporation and
|
||||
* Copyright (c) 2004-2009, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
|
||||
|
@ -66,7 +66,7 @@ void UVectorTest::runIndexedTest( int32_t index, UBool exec, const char* &name,
|
|||
errln("UVectorTest failure at line %d.\n", __LINE__);\
|
||||
}
|
||||
|
||||
static int8_t
|
||||
static int8_t U_CALLCONV
|
||||
UVectorTest_compareInt32(UHashTok key1, UHashTok key2) {
|
||||
if (key1.integer > key2.integer) {
|
||||
return 1;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
************************************************************************
|
||||
* Copyright (c) 1997-2006, International Business Machines
|
||||
* Copyright (c) 1997-2009, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
************************************************************************
|
||||
*/
|
||||
|
@ -15,6 +15,9 @@
|
|||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#else
|
||||
# if defined(OS390)
|
||||
# define __UU /* Universal Unix - for struct timeval */
|
||||
# endif
|
||||
# include <time.h>
|
||||
# include <sys/time.h>
|
||||
# include <unistd.h>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2008, International Business Machines
|
||||
* Copyright (C) 1999-2009, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -111,7 +111,7 @@ createData(const char* outputDirectory, UErrorCode *errorCode) {
|
|||
pData=udata_create(outputDirectory, DATA_TYPE, DATA_NAME, &dataInfo,
|
||||
U_COPYRIGHT_STRING, errorCode);
|
||||
if(U_FAILURE(*errorCode)) {
|
||||
fprintf(stderr, "gentest: unable to create data memory, error %d\n", *errorCode);
|
||||
fprintf(stderr, "gentest: unable to create data memory, %s\n", u_errorName(*errorCode));
|
||||
exit(*errorCode);
|
||||
}
|
||||
|
||||
|
|
|
@ -530,6 +530,70 @@ unorm_swap(const UDataSwapper *ds,
|
|||
|
||||
#endif
|
||||
|
||||
/* Swap 'Test' data from gentest */
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
test_swap(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode) {
|
||||
const UDataInfo *pInfo;
|
||||
int32_t headerSize;
|
||||
|
||||
const uint8_t *inBytes;
|
||||
uint8_t *outBytes;
|
||||
|
||||
const int32_t *inIndexes;
|
||||
int32_t indexes[32];
|
||||
|
||||
int32_t i, offset, count;
|
||||
|
||||
/* udata_swapDataHeader checks the arguments */
|
||||
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
udata_printError(ds, "test_swap(): data header swap failed %s\n", u_errorName(*pErrorCode));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* check data format and format version */
|
||||
pInfo=(const UDataInfo *)((const char *)inData+4);
|
||||
if(!(
|
||||
pInfo->dataFormat[0]==0x54 && /* dataFormat="Norm" */
|
||||
pInfo->dataFormat[1]==0x65 &&
|
||||
pInfo->dataFormat[2]==0x73 &&
|
||||
pInfo->dataFormat[3]==0x74 &&
|
||||
pInfo->formatVersion[0]==1
|
||||
)) {
|
||||
udata_printError(ds, "test_swap(): data format %02x.%02x.%02x.%02x (format version %02x) is not recognized as testdata\n",
|
||||
pInfo->dataFormat[0], pInfo->dataFormat[1],
|
||||
pInfo->dataFormat[2], pInfo->dataFormat[3],
|
||||
pInfo->formatVersion[0]);
|
||||
*pErrorCode=U_UNSUPPORTED_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
inBytes=(const uint8_t *)inData+headerSize;
|
||||
outBytes=(uint8_t *)outData+headerSize;
|
||||
|
||||
int32_t size16 = 2; // 16bit plus padding
|
||||
int32_t sizeStr = 5; // 4 char inv-str plus null
|
||||
int32_t size = size16 + sizeStr;
|
||||
|
||||
if(length>=0) {
|
||||
if(length<size) {
|
||||
udata_printError(ds, "test_swap(): too few bytes (%d after header, wanted %d) for all of testdata\n",
|
||||
length, size);
|
||||
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
offset =0;
|
||||
/* swap a 1 entry array */
|
||||
ds->swapArray16(ds, inBytes+offset, size16, outBytes+offset, pErrorCode);
|
||||
offset+=size16;
|
||||
ds->swapInvChars(ds, inBytes+offset, sizeStr, outBytes+offset, pErrorCode);
|
||||
}
|
||||
|
||||
return headerSize+size;
|
||||
}
|
||||
/* swap any data (except a .dat package) ------------------------------------ */
|
||||
|
||||
static const struct {
|
||||
|
@ -569,7 +633,9 @@ static const struct {
|
|||
{ { 0x70, 0x6e, 0x61, 0x6d }, upname_swap }, /* dataFormat="pnam" */
|
||||
{ { 0x75, 0x6e, 0x61, 0x6d }, uchar_swapNames }, /* dataFormat="unam" */
|
||||
|
||||
{ { 0x43, 0x66, 0x75, 0x20 }, uspoof_swap } /* dataFormat="Cfu " */
|
||||
{ { 0x43, 0x66, 0x75, 0x20 }, uspoof_swap }, /* dataFormat="Cfu " */
|
||||
|
||||
{ { 0x54, 0x65, 0x73, 0x74 }, test_swap } /* dataFormat="Test" */
|
||||
};
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
|
|
Loading…
Add table
Reference in a new issue