ICU-4092 Move debugging code

X-SVN-Rev: 17098
This commit is contained in:
George Rhoten 2005-01-07 19:06:24 +00:00
parent 6670e0cbb9
commit 7948649d33
3 changed files with 56 additions and 60 deletions

View File

@ -956,8 +956,6 @@ void ucol_updateInternalState(UCollator *coll, UErrorCode *status);
U_CAPI uint32_t U_EXPORT2 ucol_getFirstCE(const UCollator *coll, UChar u, UErrorCode *status);
U_CAPI UBool U_EXPORT2 ucol_isTailored(const UCollator *coll, const UChar u, UErrorCode *status);
/*U_CAPI char* U_EXPORT2 ucol_sortKeyToString(const UCollator *coll, const uint8_t *sortkey, char *buffer, uint32_t *len);*/
U_CAPI const InverseUCATableHeader* U_EXPORT2 ucol_initInverseUCA(UErrorCode *status);
U_CAPI void U_EXPORT2

View File

@ -757,62 +757,4 @@ ucol_safeClone(const UCollator *coll, void *stackBuffer, int32_t * pBufferSize,
return localCollator;
}
#if 0
static
inline void uprv_appendByteToHexString(char *dst, uint8_t val) {
uint32_t len = (uint32_t)uprv_strlen(dst);
*(dst+len) = T_CString_itosOffset((val >> 4));
*(dst+len+1) = T_CString_itosOffset((val & 0xF));
*(dst+len+2) = 0;
}
/* this function makes a string with representation of a sortkey */
U_CAPI char* U_EXPORT2 ucol_sortKeyToString(const UCollator *coll, const uint8_t *sortkey, char *buffer, uint32_t *len) {
int32_t strength = UCOL_PRIMARY;
uint32_t res_size = 0;
UBool doneCase = FALSE;
char *current = buffer;
const uint8_t *currentSk = sortkey;
uprv_strcpy(current, "[");
while(strength <= UCOL_QUATERNARY && strength <= coll->strength) {
if(strength > UCOL_PRIMARY) {
uprv_strcat(current, " . ");
}
while(*currentSk != 0x01 && *currentSk != 0x00) { /* print a level */
uprv_appendByteToHexString(current, *currentSk++);
uprv_strcat(current, " ");
}
if(coll->caseLevel == UCOL_ON && strength == UCOL_SECONDARY && doneCase == FALSE) {
doneCase = TRUE;
} else if(coll->caseLevel == UCOL_OFF || doneCase == TRUE || strength != UCOL_SECONDARY) {
strength ++;
}
uprv_appendByteToHexString(current, *currentSk++); /* This should print '01' */
if(strength == UCOL_QUATERNARY && coll->alternateHandling == UCOL_NON_IGNORABLE) {
break;
}
}
if(coll->strength == UCOL_IDENTICAL) {
uprv_strcat(current, " . ");
while(*currentSk != 0) {
uprv_appendByteToHexString(current, *currentSk++);
uprv_strcat(current, " ");
}
uprv_appendByteToHexString(current, *currentSk++);
}
uprv_strcat(current, "]");
if(res_size > *len) {
return NULL;
}
return buffer;
}
#endif /* #if 0 debugging code. */
#endif /* #if !UCONFIG_NO_COLLATION */

View File

@ -127,6 +127,62 @@ const UCollationResult results[] = {
};
static
inline void uprv_appendByteToHexString(char *dst, uint8_t val) {
uint32_t len = (uint32_t)uprv_strlen(dst);
*(dst+len) = T_CString_itosOffset((val >> 4));
*(dst+len+1) = T_CString_itosOffset((val & 0xF));
*(dst+len+2) = 0;
}
/* this function makes a string with representation of a sortkey */
U_CAPI char* U_EXPORT2 ucol_sortKeyToString(const UCollator *coll, const uint8_t *sortkey, char *buffer, uint32_t *len) {
int32_t strength = UCOL_PRIMARY;
uint32_t res_size = 0;
UBool doneCase = FALSE;
char *current = buffer;
const uint8_t *currentSk = sortkey;
uprv_strcpy(current, "[");
while(strength <= UCOL_QUATERNARY && strength <= coll->strength) {
if(strength > UCOL_PRIMARY) {
uprv_strcat(current, " . ");
}
while(*currentSk != 0x01 && *currentSk != 0x00) { /* print a level */
uprv_appendByteToHexString(current, *currentSk++);
uprv_strcat(current, " ");
}
if(coll->caseLevel == UCOL_ON && strength == UCOL_SECONDARY && doneCase == FALSE) {
doneCase = TRUE;
} else if(coll->caseLevel == UCOL_OFF || doneCase == TRUE || strength != UCOL_SECONDARY) {
strength ++;
}
uprv_appendByteToHexString(current, *currentSk++); /* This should print '01' */
if(strength == UCOL_QUATERNARY && coll->alternateHandling == UCOL_NON_IGNORABLE) {
break;
}
}
if(coll->strength == UCOL_IDENTICAL) {
uprv_strcat(current, " . ");
while(*currentSk != 0) {
uprv_appendByteToHexString(current, *currentSk++);
uprv_strcat(current, " ");
}
uprv_appendByteToHexString(current, *currentSk++);
}
uprv_strcat(current, "]");
if(res_size > *len) {
return NULL;
}
return buffer;
}
void addAllCollTest(TestNode** root)
{