ICU-315 remove EBCDIC-incompatible char constants

X-SVN-Rev: 891
This commit is contained in:
Alan Liu 2000-03-04 01:51:51 +00:00
parent 5e1d719c5c
commit 1cf654db33
2 changed files with 11 additions and 9 deletions

View File

@ -282,10 +282,10 @@ Unicode::digit(UChar ch, int8_t radix) {
if (radix >= MIN_RADIX && radix <= MAX_RADIX) {
value = (int8_t) u_charDigitValue(ch);
if (value < 0) {
if (ch >= (UChar)'A' && ch <= (UChar)'Z') {
value = ch - ((UChar)'A' - 10);
} else if (ch >= (UChar)'a' && ch <= (UChar)'z') {
value = ch - ((UChar)'a' - 10);
if (ch >= 0x0041/*A*/ && ch <= 0x005A/*Z*/) {
value = ch - (0x0041/*A*/ - 10);
} else if (ch >= 0x0061/*a*/ && ch <= 0x007A/*z*/) {
value = ch - (0x0061/*a*/ - 10);
}
}
}
@ -298,7 +298,7 @@ Unicode::forDigit(int32_t digit, int8_t radix) {
(digit < 0) || (digit >= radix)) {
return (UChar)0;
}
return (UChar)(((digit < 10) ? (UChar)'0' : ((UChar)'a' - 10))
return (UChar)(((digit < 10) ? 0x0030/*0*/ : (0x0061/*a*/ - 10))
+ digit);
}

View File

@ -11,6 +11,8 @@
#include "unicode/unifilt.h"
#include "unicode/unifltlg.h"
#define ID_DELIM ((UChar)0x003B) /*;*/
/**
* Constructs a new compound transliterator given an array of
* transliterators. The array of transliterators may be of any
@ -44,7 +46,7 @@ CompoundTransliterator::CompoundTransliterator(const UnicodeString& ID,
UnicodeFilter* adoptedFilter) :
Transliterator(ID, 0), // set filter to 0 here!
filters(0) {
UnicodeString* list = split(ID, ';', count);
UnicodeString* list = split(ID, ID_DELIM, count);
trans = new Transliterator*[count];
for (int32_t i = 0; i < count; ++i) {
trans[i] = createInstance(list[direction==FORWARD ? i : (count-1-i)],
@ -57,15 +59,15 @@ CompoundTransliterator::CompoundTransliterator(const UnicodeString& ID,
/**
* Return the IDs of the given list of transliterators, concatenated
* with ';' delimiting them. Equivalent to the perlish expression
* join(';', map($_.getID(), transliterators).
* with ID_DELIM delimiting them. Equivalent to the perlish expression
* join(ID_DELIM, map($_.getID(), transliterators).
*/
UnicodeString CompoundTransliterator::joinIDs(Transliterator* const transliterators[],
int32_t count) {
UnicodeString id;
for (int32_t i=0; i<count; ++i) {
if (i > 0) {
id.append((UChar)';');
id.append(ID_DELIM);
}
id.append(transliterators[i]->getID());
}