mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-12911 remove UBiDiProps except inside its .cpp file, and uprv_haveProperties()
X-SVN-Rev: 40923
This commit is contained in:
parent
7cf0adb29a
commit
8ccca58d0c
15 changed files with 105 additions and 231 deletions
|
@ -90,7 +90,6 @@ struct UStringPrepProfile{
|
|||
UTrie sprepTrie;
|
||||
const uint16_t* mappingData;
|
||||
UDataMemory* sprepData;
|
||||
const UBiDiProps *bdp; /* used only if checkBiDi is set */
|
||||
int32_t refCount;
|
||||
UBool isDataLoaded;
|
||||
UBool doNFKC;
|
||||
|
|
|
@ -152,9 +152,6 @@ ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode)
|
|||
/* reset the object, all pointers NULL, all flags FALSE, all sizes 0 */
|
||||
uprv_memset(pBiDi, 0, sizeof(UBiDi));
|
||||
|
||||
/* get BiDi properties */
|
||||
pBiDi->bdp=ubidi_getSingleton();
|
||||
|
||||
/* allocate memory for arrays as requested */
|
||||
if(maxLength>0) {
|
||||
if( !getInitialDirPropsMemory(pBiDi, maxLength) ||
|
||||
|
@ -925,7 +922,7 @@ bracketProcessChar(BracketData *bd, int32_t position) {
|
|||
else
|
||||
match=0;
|
||||
if(match!=c && /* has a matching char */
|
||||
ubidi_getPairedBracketType(bd->pBiDi->bdp, c)==U_BPT_OPEN) { /* opening bracket */
|
||||
ubidi_getPairedBracketType(c)==U_BPT_OPEN) { /* opening bracket */
|
||||
/* special case: process synonyms
|
||||
create an opening entry for each synonym */
|
||||
if(match==0x232A) { /* RIGHT-POINTING ANGLE BRACKET */
|
||||
|
@ -3033,7 +3030,7 @@ ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c)
|
|||
if( pBiDi->fnClassCallback == NULL ||
|
||||
(dir = (*pBiDi->fnClassCallback)(pBiDi->coClassCallback, c)) == U_BIDI_CLASS_DEFAULT )
|
||||
{
|
||||
dir = ubidi_getClass(pBiDi->bdp, c);
|
||||
dir = ubidi_getClass(c);
|
||||
}
|
||||
if(dir >= U_CHAR_DIRECTION_COUNT) {
|
||||
dir = (UCharDirection)ON;
|
||||
|
|
|
@ -44,13 +44,6 @@ struct UBiDiProps {
|
|||
#define INCLUDED_FROM_UBIDI_PROPS_C
|
||||
#include "ubidi_props_data.h"
|
||||
|
||||
/* UBiDiProps singleton ----------------------------------------------------- */
|
||||
|
||||
U_CFUNC const UBiDiProps *
|
||||
ubidi_getSingleton() {
|
||||
return &ubidi_props_singleton;
|
||||
}
|
||||
|
||||
/* set of property starts for UnicodeSet ------------------------------------ */
|
||||
|
||||
static UBool U_CALLCONV
|
||||
|
@ -64,7 +57,7 @@ _enumPropertyStartsRange(const void *context, UChar32 start, UChar32 end, uint32
|
|||
}
|
||||
|
||||
U_CFUNC void
|
||||
ubidi_addPropertyStarts(const UBiDiProps *bdp, const USetAdder *sa, UErrorCode *pErrorCode) {
|
||||
ubidi_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
|
||||
int32_t i, length;
|
||||
UChar32 c, start, limit;
|
||||
|
||||
|
@ -76,19 +69,19 @@ ubidi_addPropertyStarts(const UBiDiProps *bdp, const USetAdder *sa, UErrorCode *
|
|||
}
|
||||
|
||||
/* add the start code point of each same-value range of the trie */
|
||||
utrie2_enum(&bdp->trie, NULL, _enumPropertyStartsRange, sa);
|
||||
utrie2_enum(&ubidi_props_singleton.trie, NULL, _enumPropertyStartsRange, sa);
|
||||
|
||||
/* add the code points from the bidi mirroring table */
|
||||
length=bdp->indexes[UBIDI_IX_MIRROR_LENGTH];
|
||||
length=ubidi_props_singleton.indexes[UBIDI_IX_MIRROR_LENGTH];
|
||||
for(i=0; i<length; ++i) {
|
||||
c=UBIDI_GET_MIRROR_CODE_POINT(bdp->mirrors[i]);
|
||||
c=UBIDI_GET_MIRROR_CODE_POINT(ubidi_props_singleton.mirrors[i]);
|
||||
sa->addRange(sa->set, c, c+1);
|
||||
}
|
||||
|
||||
/* add the code points from the Joining_Group array where the value changes */
|
||||
start=bdp->indexes[UBIDI_IX_JG_START];
|
||||
limit=bdp->indexes[UBIDI_IX_JG_LIMIT];
|
||||
jgArray=bdp->jgArray;
|
||||
start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START];
|
||||
limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT];
|
||||
jgArray=ubidi_props_singleton.jgArray;
|
||||
for(;;) {
|
||||
prev=0;
|
||||
while(start<limit) {
|
||||
|
@ -103,11 +96,11 @@ ubidi_addPropertyStarts(const UBiDiProps *bdp, const USetAdder *sa, UErrorCode *
|
|||
/* add the limit code point if the last value was not 0 (it is now start==limit) */
|
||||
sa->add(sa->set, limit);
|
||||
}
|
||||
if(limit==bdp->indexes[UBIDI_IX_JG_LIMIT]) {
|
||||
if(limit==ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT]) {
|
||||
/* switch to the second Joining_Group range */
|
||||
start=bdp->indexes[UBIDI_IX_JG_START2];
|
||||
limit=bdp->indexes[UBIDI_IX_JG_LIMIT2];
|
||||
jgArray=bdp->jgArray2;
|
||||
start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START2];
|
||||
limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT2];
|
||||
jgArray=ubidi_props_singleton.jgArray2;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@ -121,14 +114,8 @@ ubidi_addPropertyStarts(const UBiDiProps *bdp, const USetAdder *sa, UErrorCode *
|
|||
/* property access functions ------------------------------------------------ */
|
||||
|
||||
U_CFUNC int32_t
|
||||
ubidi_getMaxValue(const UBiDiProps *bdp, UProperty which) {
|
||||
int32_t max;
|
||||
|
||||
if(bdp==NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
max=bdp->indexes[UBIDI_MAX_VALUES_INDEX];
|
||||
ubidi_getMaxValue(UProperty which) {
|
||||
int32_t max=ubidi_props_singleton.indexes[UBIDI_MAX_VALUES_INDEX];
|
||||
switch(which) {
|
||||
case UCHAR_BIDI_CLASS:
|
||||
return (max&UBIDI_CLASS_MASK);
|
||||
|
@ -144,19 +131,19 @@ ubidi_getMaxValue(const UBiDiProps *bdp, UProperty which) {
|
|||
}
|
||||
|
||||
U_CAPI UCharDirection
|
||||
ubidi_getClass(const UBiDiProps *bdp, UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&bdp->trie, c);
|
||||
ubidi_getClass(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
return (UCharDirection)UBIDI_GET_CLASS(props);
|
||||
}
|
||||
|
||||
U_CFUNC UBool
|
||||
ubidi_isMirrored(const UBiDiProps *bdp, UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&bdp->trie, c);
|
||||
ubidi_isMirrored(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
return (UBool)UBIDI_GET_FLAG(props, UBIDI_IS_MIRRORED_SHIFT);
|
||||
}
|
||||
|
||||
static UChar32
|
||||
getMirror(const UBiDiProps *bdp, UChar32 c, uint16_t props) {
|
||||
getMirror(UChar32 c, uint16_t props) {
|
||||
int32_t delta=UBIDI_GET_MIRROR_DELTA(props);
|
||||
if(delta!=UBIDI_ESC_MIRROR_DELTA) {
|
||||
return c+delta;
|
||||
|
@ -167,8 +154,8 @@ getMirror(const UBiDiProps *bdp, UChar32 c, uint16_t props) {
|
|||
int32_t i, length;
|
||||
UChar32 c2;
|
||||
|
||||
mirrors=bdp->mirrors;
|
||||
length=bdp->indexes[UBIDI_IX_MIRROR_LENGTH];
|
||||
mirrors=ubidi_props_singleton.mirrors;
|
||||
length=ubidi_props_singleton.indexes[UBIDI_IX_MIRROR_LENGTH];
|
||||
|
||||
/* linear search */
|
||||
for(i=0; i<length; ++i) {
|
||||
|
@ -188,80 +175,80 @@ getMirror(const UBiDiProps *bdp, UChar32 c, uint16_t props) {
|
|||
}
|
||||
|
||||
U_CFUNC UChar32
|
||||
ubidi_getMirror(const UBiDiProps *bdp, UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&bdp->trie, c);
|
||||
return getMirror(bdp, c, props);
|
||||
ubidi_getMirror(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
return getMirror(c, props);
|
||||
}
|
||||
|
||||
U_CFUNC UBool
|
||||
ubidi_isBidiControl(const UBiDiProps *bdp, UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&bdp->trie, c);
|
||||
ubidi_isBidiControl(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
return (UBool)UBIDI_GET_FLAG(props, UBIDI_BIDI_CONTROL_SHIFT);
|
||||
}
|
||||
|
||||
U_CFUNC UBool
|
||||
ubidi_isJoinControl(const UBiDiProps *bdp, UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&bdp->trie, c);
|
||||
ubidi_isJoinControl(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
return (UBool)UBIDI_GET_FLAG(props, UBIDI_JOIN_CONTROL_SHIFT);
|
||||
}
|
||||
|
||||
U_CFUNC UJoiningType
|
||||
ubidi_getJoiningType(const UBiDiProps *bdp, UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&bdp->trie, c);
|
||||
ubidi_getJoiningType(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
return (UJoiningType)((props&UBIDI_JT_MASK)>>UBIDI_JT_SHIFT);
|
||||
}
|
||||
|
||||
U_CFUNC UJoiningGroup
|
||||
ubidi_getJoiningGroup(const UBiDiProps *bdp, UChar32 c) {
|
||||
ubidi_getJoiningGroup(UChar32 c) {
|
||||
UChar32 start, limit;
|
||||
|
||||
start=bdp->indexes[UBIDI_IX_JG_START];
|
||||
limit=bdp->indexes[UBIDI_IX_JG_LIMIT];
|
||||
start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START];
|
||||
limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT];
|
||||
if(start<=c && c<limit) {
|
||||
return (UJoiningGroup)bdp->jgArray[c-start];
|
||||
return (UJoiningGroup)ubidi_props_singleton.jgArray[c-start];
|
||||
}
|
||||
start=bdp->indexes[UBIDI_IX_JG_START2];
|
||||
limit=bdp->indexes[UBIDI_IX_JG_LIMIT2];
|
||||
start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START2];
|
||||
limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT2];
|
||||
if(start<=c && c<limit) {
|
||||
return (UJoiningGroup)bdp->jgArray2[c-start];
|
||||
return (UJoiningGroup)ubidi_props_singleton.jgArray2[c-start];
|
||||
}
|
||||
return U_JG_NO_JOINING_GROUP;
|
||||
}
|
||||
|
||||
U_CFUNC UBidiPairedBracketType
|
||||
ubidi_getPairedBracketType(const UBiDiProps *bdp, UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&bdp->trie, c);
|
||||
ubidi_getPairedBracketType(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
return (UBidiPairedBracketType)((props&UBIDI_BPT_MASK)>>UBIDI_BPT_SHIFT);
|
||||
}
|
||||
|
||||
U_CFUNC UChar32
|
||||
ubidi_getPairedBracket(const UBiDiProps *bdp, UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&bdp->trie, c);
|
||||
ubidi_getPairedBracket(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
if((props&UBIDI_BPT_MASK)==0) {
|
||||
return c;
|
||||
} else {
|
||||
return getMirror(bdp, c, props);
|
||||
return getMirror(c, props);
|
||||
}
|
||||
}
|
||||
|
||||
/* public API (see uchar.h) ------------------------------------------------- */
|
||||
|
||||
U_CFUNC UCharDirection
|
||||
u_charDirection(UChar32 c) {
|
||||
return ubidi_getClass(&ubidi_props_singleton, c);
|
||||
u_charDirection(UChar32 c) {
|
||||
return ubidi_getClass(c);
|
||||
}
|
||||
|
||||
U_CFUNC UBool
|
||||
u_isMirrored(UChar32 c) {
|
||||
return ubidi_isMirrored(&ubidi_props_singleton, c);
|
||||
return ubidi_isMirrored(c);
|
||||
}
|
||||
|
||||
U_CFUNC UChar32
|
||||
u_charMirror(UChar32 c) {
|
||||
return ubidi_getMirror(&ubidi_props_singleton, c);
|
||||
return ubidi_getMirror(c);
|
||||
}
|
||||
|
||||
U_STABLE UChar32 U_EXPORT2
|
||||
u_getBidiPairedBracket(UChar32 c) {
|
||||
return ubidi_getPairedBracket(&ubidi_props_singleton, c);
|
||||
return ubidi_getPairedBracket(c);
|
||||
}
|
||||
|
|
|
@ -31,46 +31,40 @@ U_CDECL_BEGIN
|
|||
|
||||
/* library API -------------------------------------------------------------- */
|
||||
|
||||
struct UBiDiProps;
|
||||
typedef struct UBiDiProps UBiDiProps;
|
||||
|
||||
U_CFUNC const UBiDiProps *
|
||||
ubidi_getSingleton(void);
|
||||
|
||||
U_CFUNC void
|
||||
ubidi_addPropertyStarts(const UBiDiProps *bdp, const USetAdder *sa, UErrorCode *pErrorCode);
|
||||
ubidi_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode);
|
||||
|
||||
/* property access functions */
|
||||
|
||||
U_CFUNC int32_t
|
||||
ubidi_getMaxValue(const UBiDiProps *bdp, UProperty which);
|
||||
ubidi_getMaxValue(UProperty which);
|
||||
|
||||
U_CAPI UCharDirection
|
||||
ubidi_getClass(const UBiDiProps *bdp, UChar32 c);
|
||||
ubidi_getClass(UChar32 c);
|
||||
|
||||
U_CFUNC UBool
|
||||
ubidi_isMirrored(const UBiDiProps *bdp, UChar32 c);
|
||||
ubidi_isMirrored(UChar32 c);
|
||||
|
||||
U_CFUNC UChar32
|
||||
ubidi_getMirror(const UBiDiProps *bdp, UChar32 c);
|
||||
ubidi_getMirror(UChar32 c);
|
||||
|
||||
U_CFUNC UBool
|
||||
ubidi_isBidiControl(const UBiDiProps *bdp, UChar32 c);
|
||||
ubidi_isBidiControl(UChar32 c);
|
||||
|
||||
U_CFUNC UBool
|
||||
ubidi_isJoinControl(const UBiDiProps *bdp, UChar32 c);
|
||||
ubidi_isJoinControl(UChar32 c);
|
||||
|
||||
U_CFUNC UJoiningType
|
||||
ubidi_getJoiningType(const UBiDiProps *bdp, UChar32 c);
|
||||
ubidi_getJoiningType(UChar32 c);
|
||||
|
||||
U_CFUNC UJoiningGroup
|
||||
ubidi_getJoiningGroup(const UBiDiProps *bdp, UChar32 c);
|
||||
ubidi_getJoiningGroup(UChar32 c);
|
||||
|
||||
U_CFUNC UBidiPairedBracketType
|
||||
ubidi_getPairedBracketType(const UBiDiProps *bdp, UChar32 c);
|
||||
ubidi_getPairedBracketType(UChar32 c);
|
||||
|
||||
U_CFUNC UChar32
|
||||
ubidi_getPairedBracket(const UBiDiProps *bdp, UChar32 c);
|
||||
ubidi_getPairedBracket(UChar32 c);
|
||||
|
||||
/* file definitions --------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -254,8 +254,6 @@ struct UBiDi {
|
|||
*/
|
||||
const UBiDi * pParaBiDi;
|
||||
|
||||
const UBiDiProps *bdp;
|
||||
|
||||
/* alias pointer to the current text */
|
||||
const UChar *text;
|
||||
|
||||
|
|
|
@ -60,15 +60,6 @@ u_caseInsensitivePrefixMatch(const UChar *s1, int32_t length1,
|
|||
int32_t *matchLen1, int32_t *matchLen2,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Are the Unicode properties loaded?
|
||||
* This must be used before internal functions are called that do
|
||||
* not perform this check.
|
||||
* Generate a debug assertion failure if data is not loaded.
|
||||
*/
|
||||
U_CFUNC UBool
|
||||
uprv_haveProperties(UErrorCode *pErrorCode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
|
|
@ -42,14 +42,6 @@
|
|||
/* getting a uint32_t properties word from the data */
|
||||
#define GET_PROPS(c, result) ((result)=UTRIE2_GET16(&propsTrie, c));
|
||||
|
||||
U_CFUNC UBool
|
||||
uprv_haveProperties(UErrorCode *pErrorCode) {
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* API functions ------------------------------------------------------------ */
|
||||
|
||||
/* Gets the Unicode character's general category.*/
|
||||
|
|
|
@ -60,11 +60,12 @@
|
|||
* To avoid dependency on other code, this list is hard coded here.
|
||||
* When an ignorable code point is found and is unmappable, the default callbacks
|
||||
* will ignore them.
|
||||
* For a list of the default ignorable code points, use this link: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=[%3ADI%3A]&g=
|
||||
* For a list of the default ignorable code points, use this link:
|
||||
* https://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3ADI%3A%5D&abb=on&g=&i=
|
||||
*
|
||||
* This list should be sync with the one in CharsetCallback.java
|
||||
*/
|
||||
#define IS_DEFAULT_IGNORABLE_CODE_POINT(c) (\
|
||||
#define IS_DEFAULT_IGNORABLE_CODE_POINT(c) ( \
|
||||
(c == 0x00AD) || \
|
||||
(c == 0x034F) || \
|
||||
(c == 0x061C) || \
|
||||
|
@ -74,26 +75,15 @@
|
|||
(0x180B <= c && c <= 0x180E) || \
|
||||
(0x200B <= c && c <= 0x200F) || \
|
||||
(0x202A <= c && c <= 0x202E) || \
|
||||
(c == 0x2060) || \
|
||||
(0x2066 <= c && c <= 0x2069) || \
|
||||
(0x2061 <= c && c <= 0x2064) || \
|
||||
(0x206A <= c && c <= 0x206F) || \
|
||||
(0x2060 <= c && c <= 0x206F) || \
|
||||
(c == 0x3164) || \
|
||||
(0x0FE00 <= c && c <= 0x0FE0F) || \
|
||||
(c == 0x0FEFF) || \
|
||||
(c == 0x0FFA0) || \
|
||||
(0x01BCA0 <= c && c <= 0x01BCA3) || \
|
||||
(0x01D173 <= c && c <= 0x01D17A) || \
|
||||
(c == 0x0E0001) || \
|
||||
(0x0E0020 <= c && c <= 0x0E007F) || \
|
||||
(0x0E0100 <= c && c <= 0x0E01EF) || \
|
||||
(c == 0x2065) || \
|
||||
(0x0FFF0 <= c && c <= 0x0FFF8) || \
|
||||
(c == 0x0E0000) || \
|
||||
(0x0E0002 <= c && c <= 0x0E001F) || \
|
||||
(0x0E0080 <= c && c <= 0x0E00FF) || \
|
||||
(0x0E01F0 <= c && c <= 0x0E0FFF) \
|
||||
)
|
||||
(0xFE00 <= c && c <= 0xFE0F) || \
|
||||
(c == 0xFEFF) || \
|
||||
(c == 0xFFA0) || \
|
||||
(0xFFF0 <= c && c <= 0xFFF8) || \
|
||||
(0x1BCA0 <= c && c <= 0x1BCA3) || \
|
||||
(0x1D173 <= c && c <= 0x1D17A) || \
|
||||
(0xE0000 <= c && c <= 0xE0FFF))
|
||||
|
||||
|
||||
/*Function Pointer STOPS at the ILLEGAL_SEQUENCE */
|
||||
|
|
|
@ -231,7 +231,7 @@ void U_CALLCONV UnicodeSet_initInclusion(int32_t src, UErrorCode &status) {
|
|||
ucase_addPropertyStarts(&sa, &status);
|
||||
break;
|
||||
case UPROPS_SRC_BIDI:
|
||||
ubidi_addPropertyStarts(ubidi_getSingleton(), &sa, &status);
|
||||
ubidi_addPropertyStarts(&sa, &status);
|
||||
break;
|
||||
default:
|
||||
status = U_INTERNAL_PROGRAM_ERROR;
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
|
||||
U_NAMESPACE_USE
|
||||
|
||||
#define GET_BIDI_PROPS() ubidi_getSingleton()
|
||||
|
||||
/* general properties API functions ----------------------------------------- */
|
||||
|
||||
struct BinaryProperty;
|
||||
|
@ -62,15 +60,15 @@ static UBool caseBinaryPropertyContains(const BinaryProperty &/*prop*/, UChar32
|
|||
}
|
||||
|
||||
static UBool isBidiControl(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
|
||||
return ubidi_isBidiControl(GET_BIDI_PROPS(), c);
|
||||
return ubidi_isBidiControl(c);
|
||||
}
|
||||
|
||||
static UBool isMirrored(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
|
||||
return ubidi_isMirrored(GET_BIDI_PROPS(), c);
|
||||
return ubidi_isMirrored(c);
|
||||
}
|
||||
|
||||
static UBool isJoinControl(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
|
||||
return ubidi_isJoinControl(GET_BIDI_PROPS(), c);
|
||||
return ubidi_isJoinControl(c);
|
||||
}
|
||||
|
||||
#if UCONFIG_NO_NORMALIZATION
|
||||
|
@ -329,11 +327,11 @@ static int32_t getBiDiClass(const IntProperty &/*prop*/, UChar32 c, UProperty /*
|
|||
}
|
||||
|
||||
static int32_t getBiDiPairedBracketType(const IntProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
|
||||
return (int32_t)ubidi_getPairedBracketType(GET_BIDI_PROPS(), c);
|
||||
return (int32_t)ubidi_getPairedBracketType(c);
|
||||
}
|
||||
|
||||
static int32_t biDiGetMaxValue(const IntProperty &/*prop*/, UProperty which) {
|
||||
return ubidi_getMaxValue(GET_BIDI_PROPS(), which);
|
||||
return ubidi_getMaxValue(which);
|
||||
}
|
||||
|
||||
#if UCONFIG_NO_NORMALIZATION
|
||||
|
@ -351,11 +349,11 @@ static int32_t getGeneralCategory(const IntProperty &/*prop*/, UChar32 c, UPrope
|
|||
}
|
||||
|
||||
static int32_t getJoiningGroup(const IntProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
|
||||
return ubidi_getJoiningGroup(GET_BIDI_PROPS(), c);
|
||||
return ubidi_getJoiningGroup(c);
|
||||
}
|
||||
|
||||
static int32_t getJoiningType(const IntProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
|
||||
return ubidi_getJoiningType(GET_BIDI_PROPS(), c);
|
||||
return ubidi_getJoiningType(c);
|
||||
}
|
||||
|
||||
static int32_t getNumericType(const IntProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
|
||||
|
|
|
@ -342,18 +342,16 @@ static void
|
|||
_shapeToArabicDigitsWithContext(UChar *s, int32_t length,
|
||||
UChar digitBase,
|
||||
UBool isLogical, UBool lastStrongWasAL) {
|
||||
const UBiDiProps *bdp;
|
||||
int32_t i;
|
||||
UChar c;
|
||||
|
||||
bdp=ubidi_getSingleton();
|
||||
digitBase-=0x30;
|
||||
|
||||
/* the iteration direction depends on the type of input */
|
||||
if(isLogical) {
|
||||
for(i=0; i<length; ++i) {
|
||||
c=s[i];
|
||||
switch(ubidi_getClass(bdp, c)) {
|
||||
switch(ubidi_getClass(c)) {
|
||||
case U_LEFT_TO_RIGHT: /* L */
|
||||
case U_RIGHT_TO_LEFT: /* R */
|
||||
lastStrongWasAL=FALSE;
|
||||
|
@ -373,7 +371,7 @@ _shapeToArabicDigitsWithContext(UChar *s, int32_t length,
|
|||
} else {
|
||||
for(i=length; i>0; /* pre-decrement in the body */) {
|
||||
c=s[--i];
|
||||
switch(ubidi_getClass(bdp, c)) {
|
||||
switch(ubidi_getClass(c)) {
|
||||
case U_LEFT_TO_RIGHT: /* L */
|
||||
case U_RIGHT_TO_LEFT: /* R */
|
||||
lastStrongWasAL=FALSE;
|
||||
|
|
|
@ -347,10 +347,6 @@ usprep_getProfile(const char* path,
|
|||
newProfile->doNFKC = (UBool)((newProfile->indexes[_SPREP_OPTIONS] & _SPREP_NORMALIZATION_ON) > 0);
|
||||
newProfile->checkBiDi = (UBool)((newProfile->indexes[_SPREP_OPTIONS] & _SPREP_CHECK_BIDI_ON) > 0);
|
||||
|
||||
if(newProfile->checkBiDi) {
|
||||
newProfile->bdp = ubidi_getSingleton();
|
||||
}
|
||||
|
||||
LocalMemory<UStringPrepKey> key;
|
||||
LocalMemory<char> keyName;
|
||||
LocalMemory<char> keyPath;
|
||||
|
@ -735,7 +731,7 @@ usprep_prepare( const UStringPrepProfile* profile,
|
|||
}
|
||||
|
||||
if(profile->checkBiDi) {
|
||||
direction = ubidi_getClass(profile->bdp, ch);
|
||||
direction = ubidi_getClass(ch);
|
||||
if(firstCharDir == U_CHAR_DIRECTION_COUNT){
|
||||
firstCharDir = direction;
|
||||
}
|
||||
|
|
|
@ -1126,7 +1126,6 @@ isASCIIOkBiDi(const char *s, int32_t length) {
|
|||
|
||||
UBool
|
||||
UTS46::isLabelOkContextJ(const UChar *label, int32_t labelLength) const {
|
||||
const UBiDiProps *bdp=ubidi_getSingleton();
|
||||
// [IDNA2008-Tables]
|
||||
// 200C..200D ; CONTEXTJ # ZERO WIDTH NON-JOINER..ZERO WIDTH JOINER
|
||||
for(int32_t i=0; i<labelLength; ++i) {
|
||||
|
@ -1148,7 +1147,7 @@ UTS46::isLabelOkContextJ(const UChar *label, int32_t labelLength) const {
|
|||
}
|
||||
// check precontext (Joining_Type:{L,D})(Joining_Type:T)*
|
||||
for(;;) {
|
||||
UJoiningType type=ubidi_getJoiningType(bdp, c);
|
||||
UJoiningType type=ubidi_getJoiningType(c);
|
||||
if(type==U_JT_TRANSPARENT) {
|
||||
if(j==0) {
|
||||
return FALSE;
|
||||
|
@ -1166,7 +1165,7 @@ UTS46::isLabelOkContextJ(const UChar *label, int32_t labelLength) const {
|
|||
return FALSE;
|
||||
}
|
||||
U16_NEXT_UNSAFE(label, j, c);
|
||||
UJoiningType type=ubidi_getJoiningType(bdp, c);
|
||||
UJoiningType type=ubidi_getJoiningType(c);
|
||||
if(type==U_JT_TRANSPARENT) {
|
||||
// just skip this character
|
||||
} else if(type==U_JT_RIGHT_JOINING || type==U_JT_DUAL_JOINING) {
|
||||
|
|
|
@ -60,7 +60,6 @@ static void TestNumericProperties(void);
|
|||
static void TestPropertyNames(void);
|
||||
static void TestPropertyValues(void);
|
||||
static void TestConsistency(void);
|
||||
static void TestUBiDiProps(void);
|
||||
static void TestCaseFolding(void);
|
||||
|
||||
/* internal methods used */
|
||||
|
@ -196,7 +195,6 @@ void addUnicodeTest(TestNode** root)
|
|||
addTest(root, &TestPropertyNames, "tsutil/cucdtst/TestPropertyNames");
|
||||
addTest(root, &TestPropertyValues, "tsutil/cucdtst/TestPropertyValues");
|
||||
addTest(root, &TestConsistency, "tsutil/cucdtst/TestConsistency");
|
||||
addTest(root, &TestUBiDiProps, "tsutil/cucdtst/TestUBiDiProps");
|
||||
addTest(root, &TestCaseFolding, "tsutil/cucdtst/TestCaseFolding");
|
||||
}
|
||||
|
||||
|
@ -3302,59 +3300,6 @@ TestConsistency() {
|
|||
uset_close(set2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Starting with ICU4C 3.4, the core Unicode properties files
|
||||
* (uprops.icu, ucase.icu, ubidi.icu, unorm.icu)
|
||||
* are hardcoded in the common DLL and therefore not included
|
||||
* in the data package any more.
|
||||
* Test requiring these files are disabled so that
|
||||
* we need not jump through hoops (like adding snapshots of these files
|
||||
* to testdata).
|
||||
* See Jitterbug 4497.
|
||||
*/
|
||||
#define HARDCODED_DATA_4497 1
|
||||
|
||||
/* API coverage for ubidi_props.c */
|
||||
static void TestUBiDiProps() {
|
||||
#if !HARDCODED_DATA_4497
|
||||
UDataMemory *pData;
|
||||
UBiDiProps *bdp;
|
||||
const UBiDiProps *cbdp;
|
||||
UErrorCode errorCode;
|
||||
|
||||
/* coverage for ubidi_openBinary() */
|
||||
errorCode=U_ZERO_ERROR;
|
||||
pData=udata_open(NULL, UBIDI_DATA_TYPE, UBIDI_DATA_NAME, &errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
log_data_err("unable to open " UBIDI_DATA_NAME "." UBIDI_DATA_TYPE ": %s\n",
|
||||
u_errorName(errorCode));
|
||||
return;
|
||||
}
|
||||
|
||||
bdp=ubidi_openBinary((const uint8_t *)pData->pHeader, -1, &errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
log_err("ubidi_openBinary() fails for the contents of " UBIDI_DATA_NAME "." UBIDI_DATA_TYPE ": %s\n",
|
||||
u_errorName(errorCode));
|
||||
udata_close(pData);
|
||||
return;
|
||||
}
|
||||
|
||||
if(0x2215!=ubidi_getMirror(bdp, 0x29F5)) { /* verify some data */
|
||||
log_err("ubidi_openBinary() does not seem to return working UBiDiProps\n");
|
||||
}
|
||||
|
||||
ubidi_closeProps(bdp);
|
||||
udata_close(pData);
|
||||
|
||||
/* coverage for ubidi_getDummy() */
|
||||
errorCode=U_ZERO_ERROR;
|
||||
cbdp=ubidi_getDummy(&errorCode);
|
||||
if(ubidi_getClass(cbdp, 0x20)!=0) {
|
||||
log_err("ubidi_getClass(dummy, space)!=0\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* test case folding, compare return values with CaseFolding.txt ------------ */
|
||||
|
||||
/* bit set for which case foldings for a character have been tested already */
|
||||
|
|
|
@ -89,41 +89,31 @@ public class CharsetCallback {
|
|||
* To avoid dependency on other code, this list is hard coded here.
|
||||
* When an ignorable code point is found and is unmappable, the default callbacks
|
||||
* will ignore them.
|
||||
* For a list of the default ignorable code points, use this link: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=[%3ADI%3A]&g=
|
||||
*
|
||||
* This list should be sync with the one in ucnv_err.c
|
||||
* For a list of the default ignorable code points, use this link:
|
||||
* https://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3ADI%3A%5D&abb=on&g=&i=
|
||||
*
|
||||
* This list should be sync with the one in ucnv_err.cpp.
|
||||
*/
|
||||
private static boolean IS_DEFAULT_IGNORABLE_CODE_POINT(int c) {
|
||||
return ((c == 0x00AD) ||
|
||||
(c == 0x034F) ||
|
||||
(c == 0x061C) ||
|
||||
(c == 0x115F) ||
|
||||
(c == 0x1160) ||
|
||||
(0x17B4 <= c && c <= 0x17B5) ||
|
||||
(0x180B <= c && c <= 0x180E) ||
|
||||
(0x200B <= c && c <= 0x200F) ||
|
||||
(0x202A <= c && c <= 0x202E) ||
|
||||
(c == 0x2060) ||
|
||||
(0x2066 <= c && c <= 0x2069) ||
|
||||
(0x2061 <= c && c <= 0x2064) ||
|
||||
(0x206A <= c && c <= 0x206F) ||
|
||||
(c == 0x3164) ||
|
||||
(0x0FE00 <= c && c <= 0x0FE0F) ||
|
||||
(c == 0x0FEFF) ||
|
||||
(c == 0x0FFA0) ||
|
||||
(0x01BCA0 <= c && c <= 0x01BCA3) ||
|
||||
(0x01D173 <= c && c <= 0x01D17A) ||
|
||||
(c == 0x0E0001) ||
|
||||
(0x0E0020 <= c && c <= 0x0E007F) ||
|
||||
(0x0E0100 <= c && c <= 0x0E01EF) ||
|
||||
(c == 0x2065) ||
|
||||
(0x0FFF0 <= c && c <= 0x0FFF8) ||
|
||||
(c == 0x0E0000) ||
|
||||
(0x0E0002 <= c && c <= 0x0E001F) ||
|
||||
(0x0E0080 <= c && c <= 0x0E00FF) ||
|
||||
(0x0E01F0 <= c && c <= 0x0E0FFF)
|
||||
);
|
||||
return
|
||||
(c == 0x00AD) ||
|
||||
(c == 0x034F) ||
|
||||
(c == 0x061C) ||
|
||||
(c == 0x115F) ||
|
||||
(c == 0x1160) ||
|
||||
(0x17B4 <= c && c <= 0x17B5) ||
|
||||
(0x180B <= c && c <= 0x180E) ||
|
||||
(0x200B <= c && c <= 0x200F) ||
|
||||
(0x202A <= c && c <= 0x202E) ||
|
||||
(0x2060 <= c && c <= 0x206F) ||
|
||||
(c == 0x3164) ||
|
||||
(0xFE00 <= c && c <= 0xFE0F) ||
|
||||
(c == 0xFEFF) ||
|
||||
(c == 0xFFA0) ||
|
||||
(0xFFF0 <= c && c <= 0xFFF8) ||
|
||||
(0x1BCA0 <= c && c <= 0x1BCA3) ||
|
||||
(0x1D173 <= c && c <= 0x1D17A) ||
|
||||
(0xE0000 <= c && c <= 0xE0FFF);
|
||||
}
|
||||
/**
|
||||
* Decoder Callback interface
|
||||
|
|
Loading…
Add table
Reference in a new issue