mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-2146 define UChar32=int32_t
X-SVN-Rev: 9929
This commit is contained in:
parent
9db2f5d77a
commit
22e1a4fe61
2 changed files with 49 additions and 50 deletions
|
@ -39,9 +39,9 @@ noopHasNext(UCharIterator * /*iter*/) {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
static UChar32 U_CALLCONV
|
||||
noopCurrent(UCharIterator * /*iter*/) {
|
||||
return -1;
|
||||
return U_SENTINEL;
|
||||
}
|
||||
|
||||
static const UCharIterator noopIterator={
|
||||
|
@ -128,30 +128,30 @@ stringIteratorHasPrevious(UCharIterator *iter) {
|
|||
return iter->index>iter->start;
|
||||
}
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
static UChar32 U_CALLCONV
|
||||
stringIteratorCurrent(UCharIterator *iter) {
|
||||
if(iter->index<iter->limit) {
|
||||
return ((const UChar *)(iter->context))[iter->index];
|
||||
} else {
|
||||
return -1;
|
||||
return U_SENTINEL;
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
static UChar32 U_CALLCONV
|
||||
stringIteratorNext(UCharIterator *iter) {
|
||||
if(iter->index<iter->limit) {
|
||||
return ((const UChar *)(iter->context))[iter->index++];
|
||||
} else {
|
||||
return -1;
|
||||
return U_SENTINEL;
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
static UChar32 U_CALLCONV
|
||||
stringIteratorPrevious(UCharIterator *iter) {
|
||||
if(iter->index>iter->start) {
|
||||
return ((const UChar *)(iter->context))[--iter->index];
|
||||
} else {
|
||||
return -1;
|
||||
return U_SENTINEL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,33 +244,33 @@ characterIteratorHasPrevious(UCharIterator *iter) {
|
|||
return ((CharacterIterator *)(iter->context))->hasPrevious();
|
||||
}
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
static UChar32 U_CALLCONV
|
||||
characterIteratorCurrent(UCharIterator *iter) {
|
||||
int32_t c;
|
||||
UChar32 c;
|
||||
|
||||
c=((CharacterIterator *)(iter->context))->current();
|
||||
if(c!=0xffff || ((CharacterIterator *)(iter->context))->hasNext()) {
|
||||
return c;
|
||||
} else {
|
||||
return -1;
|
||||
return U_SENTINEL;
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
static UChar32 U_CALLCONV
|
||||
characterIteratorNext(UCharIterator *iter) {
|
||||
if(((CharacterIterator *)(iter->context))->hasNext()) {
|
||||
return ((CharacterIterator *)(iter->context))->nextPostInc();
|
||||
} else {
|
||||
return -1;
|
||||
return U_SENTINEL;
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
static UChar32 U_CALLCONV
|
||||
characterIteratorPrevious(UCharIterator *iter) {
|
||||
if(((CharacterIterator *)(iter->context))->hasPrevious()) {
|
||||
return ((CharacterIterator *)(iter->context))->previous();
|
||||
} else {
|
||||
return -1;
|
||||
return U_SENTINEL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,30 +309,30 @@ uiter_setCharacterIterator(UCharIterator *iter, CharacterIterator *charIter) {
|
|||
* and the iteration index.
|
||||
*/
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
static UChar32 U_CALLCONV
|
||||
replaceableIteratorCurrent(UCharIterator *iter) {
|
||||
if(iter->index<iter->limit) {
|
||||
return ((Replaceable *)(iter->context))->charAt(iter->index);
|
||||
} else {
|
||||
return -1;
|
||||
return U_SENTINEL;
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
static UChar32 U_CALLCONV
|
||||
replaceableIteratorNext(UCharIterator *iter) {
|
||||
if(iter->index<iter->limit) {
|
||||
return ((Replaceable *)(iter->context))->charAt(iter->index++);
|
||||
} else {
|
||||
return -1;
|
||||
return U_SENTINEL;
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
static UChar32 U_CALLCONV
|
||||
replaceableIteratorPrevious(UCharIterator *iter) {
|
||||
if(iter->index>iter->start) {
|
||||
return ((Replaceable *)(iter->context))->charAt(--iter->index);
|
||||
} else {
|
||||
return -1;
|
||||
return U_SENTINEL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -363,16 +363,16 @@ uiter_setReplaceable(UCharIterator *iter, const Replaceable *rep) {
|
|||
|
||||
/* Helper functions --------------------------------------------------------- */
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
uiter_current32(UCharIterator *iter) {
|
||||
int32_t c, c2;
|
||||
UChar32 c, c2;
|
||||
|
||||
c=iter->current(iter);
|
||||
if(UTF_IS_SURROGATE(c)) {
|
||||
if(UTF_IS_SURROGATE_FIRST(c)) {
|
||||
/*
|
||||
* go to the next code unit
|
||||
* we know that we are not at the limit because c!=-1
|
||||
* we know that we are not at the limit because c!=U_SENTINEL
|
||||
*/
|
||||
iter->move(iter, 1, UITER_CURRENT);
|
||||
if(UTF_IS_SECOND_SURROGATE(c2=iter->current(iter))) {
|
||||
|
@ -394,9 +394,9 @@ uiter_current32(UCharIterator *iter) {
|
|||
return c;
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
uiter_next32(UCharIterator *iter) {
|
||||
int32_t c, c2;
|
||||
UChar32 c, c2;
|
||||
|
||||
c=iter->next(iter);
|
||||
if(UTF_IS_FIRST_SURROGATE(c)) {
|
||||
|
@ -410,9 +410,9 @@ uiter_next32(UCharIterator *iter) {
|
|||
return c;
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
uiter_previous32(UCharIterator *iter) {
|
||||
int32_t c, c2;
|
||||
UChar32 c, c2;
|
||||
|
||||
c=iter->previous(iter);
|
||||
if(UTF_IS_SECOND_SURROGATE(c)) {
|
||||
|
|
|
@ -58,7 +58,7 @@ typedef enum UCharIteratorOrigin {
|
|||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @param origin get the 0, start, limit, length, or current index
|
||||
* @return the requested index, or -1 in an error condition
|
||||
* @return the requested index, or U_SENTINEL in an error condition
|
||||
*
|
||||
* @see UCharIteratorOrigin
|
||||
* @see UCharIterator
|
||||
|
@ -81,7 +81,7 @@ UCharIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin);
|
|||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @param delta can be positive, zero, or negative
|
||||
* @param origin move relative to the 0, start, limit, length, or current index
|
||||
* @return the new index, or -1 on an error condition.
|
||||
* @return the new index, or U_SENTINEL on an error condition.
|
||||
*
|
||||
* @see UCharIteratorOrigin
|
||||
* @see UCharIterator
|
||||
|
@ -123,7 +123,7 @@ UCharIteratorHasPrevious(UCharIterator *iter);
|
|||
* Function type declaration for UCharIterator.current().
|
||||
*
|
||||
* Return the code unit at the current position,
|
||||
* or -1 if there is none (index is at the limit).
|
||||
* or U_SENTINEL if there is none (index is at the limit).
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return the current code unit
|
||||
|
@ -131,7 +131,7 @@ UCharIteratorHasPrevious(UCharIterator *iter);
|
|||
* @see UCharIterator
|
||||
* @draft ICU 2.1
|
||||
*/
|
||||
typedef int32_t U_CALLCONV
|
||||
typedef UChar32 U_CALLCONV
|
||||
UCharIteratorCurrent(UCharIterator *iter);
|
||||
|
||||
/**
|
||||
|
@ -139,7 +139,7 @@ UCharIteratorCurrent(UCharIterator *iter);
|
|||
*
|
||||
* Return the code unit at the current index and increment
|
||||
* the index (post-increment, like s[i++]),
|
||||
* or return -1 if there is none (index is at the limit).
|
||||
* or return U_SENTINEL if there is none (index is at the limit).
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return the current code unit (and post-increment the current index)
|
||||
|
@ -147,7 +147,7 @@ UCharIteratorCurrent(UCharIterator *iter);
|
|||
* @see UCharIterator
|
||||
* @draft ICU 2.1
|
||||
*/
|
||||
typedef int32_t U_CALLCONV
|
||||
typedef UChar32 U_CALLCONV
|
||||
UCharIteratorNext(UCharIterator *iter);
|
||||
|
||||
/**
|
||||
|
@ -155,7 +155,7 @@ UCharIteratorNext(UCharIterator *iter);
|
|||
*
|
||||
* Decrement the index and return the code unit from there
|
||||
* (pre-decrement, like s[--i]),
|
||||
* or return -1 if there is none (index is at the start).
|
||||
* or return U_SENTINEL if there is none (index is at the start).
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return the previous code unit (after pre-decrementing the current index)
|
||||
|
@ -163,7 +163,7 @@ UCharIteratorNext(UCharIterator *iter);
|
|||
* @see UCharIterator
|
||||
* @draft ICU 2.1
|
||||
*/
|
||||
typedef int32_t U_CALLCONV
|
||||
typedef UChar32 U_CALLCONV
|
||||
UCharIteratorPrevious(UCharIterator *iter);
|
||||
|
||||
/**
|
||||
|
@ -197,8 +197,7 @@ UCharIteratorReserved(UCharIterator *iter, int32_t something);
|
|||
* fields directly.
|
||||
*
|
||||
* UCharIterator functions return code unit values 0..0xffff,
|
||||
* or -1 if the iteration bounds are reached.
|
||||
* Therefore, the return type is int32_t.
|
||||
* or U_SENTINEL if the iteration bounds are reached.
|
||||
*
|
||||
* @draft ICU 2.1
|
||||
*/
|
||||
|
@ -273,7 +272,7 @@ struct UCharIterator {
|
|||
|
||||
/**
|
||||
* (public) Return the code unit at the current position,
|
||||
* or -1 if there is none (index is at the limit).
|
||||
* or U_SENTINEL if there is none (index is at the limit).
|
||||
*
|
||||
* @see UCharIteratorCurrent
|
||||
*/
|
||||
|
@ -282,7 +281,7 @@ struct UCharIterator {
|
|||
/**
|
||||
* (public) Return the code unit at the current index and increment
|
||||
* the index (post-increment, like s[i++]),
|
||||
* or return -1 if there is none (index is at the limit).
|
||||
* or return U_SENTINEL if there is none (index is at the limit).
|
||||
*
|
||||
* @see UCharIteratorNext
|
||||
*/
|
||||
|
@ -291,7 +290,7 @@ struct UCharIterator {
|
|||
/**
|
||||
* (public) Decrement the index and return the code unit from there
|
||||
* (pre-decrement, like s[--i]),
|
||||
* or return -1 if there is none (index is at the start).
|
||||
* or return U_SENTINEL if there is none (index is at the start).
|
||||
*
|
||||
* @see UCharIteratorPrevious
|
||||
*/
|
||||
|
@ -310,7 +309,7 @@ struct UCharIterator {
|
|||
* at the current index.
|
||||
*
|
||||
* Return the code point that includes the code unit at the current position,
|
||||
* or -1 if there is none (index is at the limit).
|
||||
* or U_SENTINEL if there is none (index is at the limit).
|
||||
* If the current code unit is a lead or trail surrogate,
|
||||
* then the following or preceding surrogate is used to form
|
||||
* the code point value.
|
||||
|
@ -319,11 +318,11 @@ struct UCharIterator {
|
|||
* @return the current code point
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @see UTF_GET_CHAR
|
||||
* @see U16_GET
|
||||
* @see UnicodeString::char32At()
|
||||
* @draft ICU 2.1
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
uiter_current32(UCharIterator *iter);
|
||||
|
||||
/**
|
||||
|
@ -331,16 +330,16 @@ uiter_current32(UCharIterator *iter);
|
|||
*
|
||||
* Return the code point at the current index and increment
|
||||
* the index (post-increment, like s[i++]),
|
||||
* or return -1 if there is none (index is at the limit).
|
||||
* or return U_SENTINEL if there is none (index is at the limit).
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return the current code point (and post-increment the current index)
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @see UTF_NEXT_CHAR
|
||||
* @see U16_NEXT
|
||||
* @draft ICU 2.1
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
uiter_next32(UCharIterator *iter);
|
||||
|
||||
/**
|
||||
|
@ -348,16 +347,16 @@ uiter_next32(UCharIterator *iter);
|
|||
*
|
||||
* Decrement the index and return the code point from there
|
||||
* (pre-decrement, like s[--i]),
|
||||
* or return -1 if there is none (index is at the start).
|
||||
* or return U_SENTINEL if there is none (index is at the start).
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return the previous code point (after pre-decrementing the current index)
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @see UTF_PREV_CHAR
|
||||
* @see U16_PREV
|
||||
* @draft ICU 2.1
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
uiter_previous32(UCharIterator *iter);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue