ICU-2744 Fix some IRIX problems

X-SVN-Rev: 11329
This commit is contained in:
George Rhoten 2003-03-15 01:57:10 +00:00
parent ea20db569b
commit c9ed03fc4b
4 changed files with 62 additions and 65 deletions

View File

@ -21,6 +21,23 @@
#include "uassert.h"
//-----------------------------------------------------------------------------------
//
// Trie access folding function. Copied as-is from properties code in uchar.c
//
//-----------------------------------------------------------------------------------
U_CDECL_BEGIN
static int32_t U_CALLCONV
getFoldingOffset(uint32_t data) {
/* if bit 15 is set, then the folding offset is in bits 14..0 of the 16-bit trie result */
if(data&0x8000) {
return (int32_t)(data&0x7fff);
} else {
return 0;
}
}
U_CDECL_END
U_NAMESPACE_BEGIN
//-----------------------------------------------------------------------------
@ -39,25 +56,6 @@ RBBIDataWrapper::RBBIDataWrapper(UDataMemory* udm, UErrorCode &status) {
fUDataMem = udm;
}
//-----------------------------------------------------------------------------------
//
// Trie access folding function. Copied as-is from properties code in uchar.c
//
//-----------------------------------------------------------------------------------
U_CDECL_BEGIN
static int32_t U_CALLCONV
getFoldingOffset(uint32_t data) {
/* if bit 15 is set, then the folding offset is in bits 14..0 of the 16-bit trie result */
if(data&0x8000) {
return (int32_t)(data&0x7fff);
} else {
return 0;
}
}
U_CDECL_END
//-----------------------------------------------------------------------------
//
// init(). Does most of the work of construction, shared between the

View File

@ -36,8 +36,6 @@
#include "uassert.h"
U_NAMESPACE_BEGIN
//----------------------------------------------------------------------------------------
//
// Unicode Set init strings for each of the character classes needed for parsing a rule file.
@ -81,6 +79,7 @@ static void U_EXPORT2 U_CALLCONV RBBISetTable_deleter(void *p) {
}
U_CDECL_END
U_NAMESPACE_BEGIN
//----------------------------------------------------------------------------------------
//

View File

@ -43,6 +43,42 @@
#include "rbbinode.h"
//------------------------------------------------------------------------
//
// getFoldedRBBIValue Call-back function used during building of Trie table.
// Folding value: just store the offset (16 bits)
// if there is any non-0 entry.
// (It'd really be nice if the Trie builder would provide a
// simple default, so this function could go away from here.)
//
//------------------------------------------------------------------------
/* folding value: just store the offset (16 bits) if there is any non-0 entry */
U_CDECL_BEGIN
static uint32_t U_CALLCONV
getFoldedRBBIValue(UNewTrie *trie, UChar32 start, int32_t offset) {
uint32_t value;
UChar32 limit;
UBool inBlockZero;
limit=start+0x400;
while(start<limit) {
value=utrie_get32(trie, start, &inBlockZero);
if(inBlockZero) {
start+=UTRIE_DATA_BLOCK_LENGTH;
} else if(value!=0) {
return (uint32_t)(offset|0x8000);
} else {
++start;
}
}
return 0;
}
U_CDECL_END
U_NAMESPACE_BEGIN
//------------------------------------------------------------------------
@ -83,42 +119,6 @@ RBBISetBuilder::~RBBISetBuilder()
//------------------------------------------------------------------------
//
// getFoldedRBBIValue Call-back function used during building of Trie table.
// Folding value: just store the offset (16 bits)
// if there is any non-0 entry.
// (It'd really be nice if the Trie builder would provide a
// simple default, so this function could go away from here.)
//
//------------------------------------------------------------------------
/* folding value: just store the offset (16 bits) if there is any non-0 entry */
U_CDECL_BEGIN
static uint32_t U_CALLCONV
getFoldedRBBIValue(UNewTrie *trie, UChar32 start, int32_t offset) {
uint32_t value;
UChar32 limit;
UBool inBlockZero;
limit=start+0x400;
while(start<limit) {
value=utrie_get32(trie, start, &inBlockZero);
if(inBlockZero) {
start+=UTRIE_DATA_BLOCK_LENGTH;
} else if(value!=0) {
return (uint32_t)(offset|0x8000);
} else {
++start;
}
}
return 0;
}
U_CDECL_END
//------------------------------------------------------------------------
//
// build Build the list of non-overlapping character ranges

View File

@ -91,6 +91,14 @@ us_arrayCopy(const UChar *src, int32_t srcStart,
}
}
// u_unescapeAt() callback to get a UChar from a UnicodeString
U_CDECL_BEGIN
static UChar U_CALLCONV
UnicodeString_charAt(int32_t offset, void *context) {
return ((UnicodeString*) context)->charAt(offset);
}
U_CDECL_END
U_NAMESPACE_BEGIN
const char UnicodeString::fgClassID=0;
@ -556,14 +564,6 @@ UnicodeString UnicodeString::unescape() const {
return result;
}
// u_unescapeAt() callback to get a UChar from a UnicodeString
U_CDECL_BEGIN
static UChar U_CALLCONV
UnicodeString_charAt(int32_t offset, void *context) {
return ((UnicodeString*) context)->charAt(offset);
}
U_CDECL_END
UChar32 UnicodeString::unescapeAt(int32_t &offset) const {
return u_unescapeAt(UnicodeString_charAt, &offset, length(), (void*)this);
}