Home | History | Annotate | Download | only in i18n

Lines Matching refs:source

288 *     its source string.
331 * its source string.
335 inline UBool collIter_bos(collIterate *source) {
338 if(source->flags & UCOL_USE_ITERATOR || source->origFlags & UCOL_USE_ITERATOR) {
339 return !source->iterator->hasPrevious(source->iterator);
341 if (source->pos <= source->string ||
342 ((source->flags & UCOL_ITER_INNORMBUF) &&
343 *(source->pos - 1) == 0 && source->fcdPosition == NULL)) {
350 inline UBool collIter_SimpleBos(collIterate *source) {
353 if(source->flags & UCOL_USE_ITERATOR || source->origFlags & UCOL_USE_ITERATOR) {
354 return !source->iterator->hasPrevious(source->iterator);
356 if (source->pos == source->string) {
1405 // The source string is null terminated and we're not working from the side buffer,
1421 // Ran off of the end of the main source string. We're done.
1496 // We are at the last char of source string.
1501 // Not at last char of source string (or we'll check against terminating null). Do the FCD fast test
1768 UChar peekCharacter(collIterate *source, int32_t offset) {
1769 if(source->pos != NULL) {
1770 return *(source->pos + offset);
1771 } else if(source->iterator != NULL) {
1773 source->iterator->move(source->iterator, offset, UITER_CURRENT);
1774 UChar toReturn = (UChar)source->iterator->next(source->iterator);
1775 source->iterator->move(source->iterator, -offset-1, UITER_CURRENT);
1778 return (UChar)source->iterator->current(source->iterator);
1876 /* End of the main source string */
2079 * This normalization sequence will place the current character at source->pos
2266 * @param source data string source
2270 inline void setDiscontiguosAttribute(collIterate *source, const UnicodeString &buffer)
2281 if (source->flags & UCOL_ITER_INNORMBUF) {
2282 int32_t replaceLength = source->pos - source->writableBuffer.getBuffer();
2283 source->writableBuffer.replace(0, replaceLength, buffer);
2286 source->fcdPosition = source->pos;
2287 source->origFlags = source->flags;
2288 source->flags |= UCOL_ITER_INNORMBUF;
2289 source->flags &= ~(UCOL_ITER_NORM | UCOL_ITER_HASLEN | UCOL_USE_ITERATOR);
2290 source->writableBuffer = buffer;
2293 source->pos = source->writableBuffer.getTerminatedBuffer();
2297 * Function to get the discontiguos collation element within the source.
2300 * @param source data string source
2305 uint32_t getDiscontiguous(const UCollator *coll, collIterate *source,
2308 /* source->pos currently points to the second combining character after
2310 const UChar *temppos = source->pos;
2313 uint8_t tempflags = source->flags;
2317 backupState(source, &discState);
2319 buffer.setTo(peekCharacter(source, -1));
2326 if (((source->flags & UCOL_ITER_HASLEN) && source->pos >= source->endp)
2327 || (peekCharacter(source, 0) == 0 &&
2328 //|| (*source->pos == 0 &&
2329 ((source->flags & UCOL_ITER_INNORMBUF) == 0 ||
2330 source->fcdPosition == NULL ||
2331 source->fcdPosition == source->endp ||
2332 *(source->fcdPosition) == 0 ||
2333 u_getCombiningClass(*(source->fcdPosition)) == 0)) ||
2337 u_getCombiningClass(peekCharacter(source, 0)) == 0) {
2338 //u_getCombiningClass(*(source->pos)) == 0) {
2341 source->pos = temppos - 1;
2342 setDiscontiguosAttribute(source, buffer);
2351 schar = getNextNormalizedChar(source);
2365 u_getCombiningClass(peekCharacter(source, -2))) {
2366 //u_getCombiningClass(*(source->pos - 2))) {
2382 temppos = source->pos + 1;
2385 setDiscontiguosAttribute(source, buffer);
2397 loadState(source, &discState, TRUE);
2398 goBackOne(source);
2400 //source->pos = temppos - 1;
2401 source->flags = tempflags;
2436 * This normalization sequence will place the current character at source->pos
2586 uint32_t ucol_prv_getSpecialCE(const UCollator *coll, UChar ch, uint32_t CE, collIterate *source, UErrorCode *status) {
2588 backupState(source, &entryState);
2613 backupState(source, &prefixState);
2614 loadState(source, &entryState, TRUE);
2615 goBackOne(source); // We want to look at the point where we entered - actually one
2619 // This loop will run once per source string character, for as long as we
2624 if (collIter_bos(source)) {
2628 schar = getPrevNormalizedChar(source, status);
2629 goBackOne(source);
2636 // Found the source string char in the table.
2643 // Source string char was not in the table.
2650 // The source string char was in the contraction table, and the corresponding
2653 // way out of prefix handling when the source actually contained
2659 loadState(source, &prefixState, TRUE);
2660 if(source->origFlags & UCOL_USE_ITERATOR) {
2661 source->flags = source->origFlags;
2664 loadState(source, &entryState, TRUE);
2672 backupState(source, &state);
2678 /* This loop will run once per source string character, for as long as we */
2684 if (collIter_eos(source)) {
2685 // Ran off the end of the source string.
2689 // back up the source over all the chars we scanned going into this contraction.
2691 loadState(source, &state, TRUE);
2692 if(source->origFlags & UCOL_USE_ITERATOR) {
2693 source->flags = source->origFlags;
2702 schar = getNextNormalizedChar(source);
2708 // Found the source string char in the contraction table.
2715 // Source string char was not in contraction table.
2725 if (source->iterator) {
2727 int32_t prevPos; /* holds the previous position before move forward of the source iterator */
2728 if(U16_IS_LEAD(schar) && source->iterator->hasNext(source->iterator)) {
2729 prevPos = source->iterator->index;
2730 surrNextChar = getNextNormalizedChar(source);
2733 } else if (prevPos < source->iterator->index){
2734 goBackOne(source);
2738 miss = U16_GET_SUPPLEMENTARY(schar, getNextNormalizedChar(source));
2747 collIter_eos(source))
2750 goBackOne(source); // back up the source string by one,
2754 goBackOne(source);
2761 // Scan more of source string looking for a match
2766 tempchar = getNextNormalizedChar(source);
2768 goBackOne(source);
2770 goBackOne(source);
2772 goBackOne(source);
2778 CE = getDiscontiguous(coll, source, ContractionStart);
2784 /* The Source string did not match the contraction that we were checking. */
2785 /* Back up the source position to undo the effects of having partially */
2787 loadState(source, &state, TRUE);
2793 // The source string char was in the contraction table, and the corresponding
2796 // way out of contraction handling when the source actually contained
2802 // The source string char was in the contraction table, and the corresponding
2803 // CE is IS a contraction CE. We will continue looping to check the source
2807 // We have scanned a a section of source string for which there is a
2813 goBackOne(source);
2814 backupState(source, &state);
2815 getNextNormalizedChar(source);
2819 //backupState(source, &tempState);
2820 //goBackOne(source);
2821 //backupState(source, &state);
2822 //loadState(source, &tempState, TRUE);
2835 *(source->CEpos++) = ((CE & 0xFF)<<24)|UCOL_CONTINUATION_MARKER;
2837 source->offsetRepeatCount += 1;
2851 //source->offsetRepeatCount = -1;
2855 *(source->CEpos++) = *CEOffset++;
2856 source->offsetRepeatCount += 1;
2860 *(source->CEpos++) = *CEOffset++;
2861 source->offsetRepeatCount += 1;
2876 if (source->coll->numericCollation == UCOL_ON){
2891 We parse the source string until we hit a char that's NOT a digit.
2897 if (!collIter_eos(source)) {
2898 backupState(source, &digitState);
2899 UChar trail = getNextNormalizedChar(source);
2903 loadState(source, &digitState, TRUE);
2976 if (!collIter_eos(source)){
2977 ch = getNextNormalizedChar(source);
2979 if (!collIter_eos(source)) {
2980 backupState(source, &digitState);
2981 UChar trail = getNextNormalizedChar(source);
2985 loadState(source, &digitState, TRUE);
2997 loadState(source, &digitState, TRUE);
2998 //goBackOne(source);
3000 goBackOne(source);
3052 *(source->CEpos++) = (primWeight << UCOL_PRIMARYORDERSHIFT) | UCOL_CONTINUATION_MARKER;
3066 return getImplicit(cp, source);
3069 return getImplicit(cp, source);
3095 if (!source->coll->image->jamoSpecial) { // FAST PATH
3097 *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(&coll->mapping, V);
3099 *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(&coll->mapping, T);
3112 if(source->iterator != NULL && source->flags & UCOL_ITER_INNORMBUF) {
3113 source->flags = source->origFlags; // restore the iterator
3114 source->pos = NULL;
3117 UChar *buffer = source->writableBuffer.getBuffer(4);
3127 source->writableBuffer.releaseBuffer(bufferLength);
3129 source->fcdPosition = source->pos; // Indicate where to continue in main input string
3131 source->pos = source->writableBuffer.getTerminatedBuffer();
3132 source->origFlags = source->flags;
3133 source->flags |= UCOL_ITER_INNORMBUF;
3134 source->flags &= ~(UCOL_ITER_NORM | UCOL_ITER_HASLEN);
3147 backupState(source, &state);
3148 if (collIter_eos(source) || !(U16_IS_TRAIL((trail = getNextNormalizedChar(source))))) {
3151 loadState(source, &state, TRUE);
3158 loadState(source, &state, TRUE);
3168 if( source->flags & UCOL_USE_ITERATOR) {
3169 if(U_IS_TRAIL(nextChar = (UChar)source->iterator->current(source->iterator))) {
3171 source->iterator->next(source->iterator);
3172 return getImplicit(cp, source);
3176 } else if((((source->flags & UCOL_ITER_HASLEN) == 0 ) || (source->pos<source->endp)) &&
3177 U_IS_TRAIL((nextChar=*source->pos))) {
3179 source->pos++;
3180 return getImplicit(cp, source);
3244 collIterate *source,
3277 backupState(source, &prefixState);
3279 // This loop will run once per source string character, for as long as we
3285 if (collIter_bos(source)) {
3289 schar = getPrevNormalizedChar(source, status);
3290 goBackOne(source);
3297 // Found the source string char in the table.
3319 if (!collIter_bos(source)) {
3321 if(U16_IS_LEAD(lead = getPrevNormalizedChar(source, status))) {
3327 goBackOne(source);
3340 // Source string char was not in the table.
3347 // The source string char was in the contraction table, and the corresponding
3350 // way out of prefix handling when the source actually contained
3355 loadState(source, &prefixState, TRUE);
3365 schar = peekCharacter(source, 0);
3367 if (isAtStartPrevIterate(source)
3384 schar = getPrevNormalizedChar(source, status);
3385 goBackOne(source);
3395 if(source->pos) { // actually dealing with a position
3396 newsize = (int32_t)(source->pos - source->string + 1);
3412 if ((source->pos && (source->pos == source->string ||
3413 ((source->flags & UCOL_ITER_INNORMBUF) &&
3414 *(source->pos - 1) == 0 && source->fcdPosition == NULL)))
3415 || (source->iterator && !source->iterator->hasPrevious(source->iterator))) {
3426 if (source->flags & UCOL_ITER_INNORMBUF) {
3429 offsetBias = (int32_t)(source->pos - source->string);
3443 temp.flags |= source->flags & UCOL_FORCE_HAN_IMPLICIT;
3448 if (source->extendCEs) {
3449 endCEBuffer = source->extendCEs + source->extendCEsSize;
3450 CECount = (int32_t)((source->CEpos - source->extendCEs)/sizeof(uint32_t));
3452 endCEBuffer = source->CEs + UCOL_EXPAND_CE_BUFFER_SIZE;
3453 CECount = (int32_t)((source->CEpos - source->CEs)/sizeof(uint32_t));
3456 if (source->offsetBuffer == NULL) {
3457 source->offsetBufferSize = UCOL_EXPAND_CE_BUFFER_SIZE;
3458 source->offsetBuffer = (int32_t *) uprv_malloc(sizeof(int32_t) * UCOL_EXPAND_CE_BUFFER_SIZE);
3459 source->offsetStore = source->offsetBuffer;
3463 *(source->CEpos ++) = CE;
3466 *(source->offsetStore ++) = rawOffset + offsetBias;
3470 if (source->CEpos == endCEBuffer) {
3475 if (!increaseCEsCapacity(source)) {
3484 endCEBuffer = source->extendCEs + source->extendCEsSize;
3487 if (offsetBias >= 0 && source->offsetStore >= &source->offsetBuffer[source->offsetBufferSize]) {
3488 int32_t storeIX = (int32_t)(source->offsetStore - source->offsetBuffer);
3489 int32_t *tob = (int32_t *) uprv_realloc(source->offsetBuffer,
3490 sizeof(int32_t) * (source->offsetBufferSize + UCOL_EXPAND_CE_BUFFER_EXTEND_SIZE));
3493 source->offsetBuffer = tob;
3494 source->offsetStore = &source->offsetBuffer[storeIX];
3495 source->offsetBufferSize += UCOL_EXPAND_CE_BUFFER_EXTEND_SIZE;
3499 source->CEpos = source->CEs;
3518 if (source->offsetRepeatValue != 0) {
3520 source->offsetRepeatCount += temp.offsetRepeatCount;
3523 source->offsetReturn -= (noChars - CECount);
3532 source->offsetReturn = source->offsetStore - 1;
3533 if (source->offsetReturn == source->offsetBuffer) {
3534 source->offsetStore = source->offsetBuffer;
3538 source->toReturn = source->CEpos - 1;
3539 if (source->toReturn == source->CEs) {
3540 source->CEpos = source->CEs;
3543 return *(source->toReturn);
3547 *(source->CEpos++) = ((CE & 0xFFFF00) << 8) | (UCOL_BYTE_COMMON << 8) | UCOL_BYTE_COMMON;
3548 *(source->CEpos++) = ((CE & 0xFF)<<24)|UCOL_CONTINUATION_MARKER;
3549 source->toReturn = source->CEpos - 1;
3551 if (source->offsetBuffer == NULL) {
3552 source->offsetBufferSize = UCOL_EXPAND_CE_BUFFER_SIZE;
3553 source->offsetBuffer = (int32_t *) uprv_malloc(sizeof(int32_t) * UCOL_EXPAND_CE_BUFFER_SIZE);
3554 source->offsetStore = source->offsetBuffer;
3557 if (source->flags & UCOL_ITER_INNORMBUF) {
3558 source->offsetRepeatCount = 1;
3560 int32_t firstOffset = (int32_t)(source->pos - source->string);
3562 *(source->offsetStore++) = firstOffset;
3563 *(source->offsetStore++) = firstOffset + 1;
3565 source->offsetReturn = source->offsetStore - 1;
3566 *(source->offsetBuffer) = firstOffset;
3567 if (source->offsetReturn == source->offsetBuffer) {
3568 source->offsetStore = source->offsetBuffer;
3573 return *(source->toReturn);
3583 int32_t firstOffset = (int32_t)(source->pos - source->string);
3586 if (source->offsetReturn != NULL) {
3587 if (! (source->flags & UCOL_ITER_INNORMBUF) && source->offsetReturn == source->offsetBuffer) {
3588 source->offsetStore = source->offsetBuffer;
3594 if (source->offsetBuffer == NULL) {
3595 source->offsetBufferSize = UCOL_EXPAND_CE_BUFFER_SIZE;
3596 source->offsetBuffer = (int32_t *) uprv_malloc(sizeof(int32_t) * UCOL_EXPAND_CE_BUFFER_SIZE);
3597 source->offsetStore = source->offsetBuffer;
3610 *(source->CEpos ++) = *CEOffset++;
3613 *(source->offsetStore ++) = firstOffset + 1;
3619 *(source->CEpos ++) = *CEOffset ++;
3622 *(source->offsetStore ++) = firstOffset + 1;
3628 source->offsetReturn = source->offsetStore - 1;
3629 *(source->offsetBuffer) = firstOffset;
3630 if (source->offsetReturn == source->offsetBuffer) {
3631 source->offsetStore = source->offsetBuffer;
3634 source->offsetRepeatCount += size - 1;
3637 source->toReturn = source->CEpos - 1;
3640 if(source->toReturn == source->CEs) {
3641 source->CEpos = source->CEs;
3644 return *(source->toReturn);
3655 if (source->coll->numericCollation == UCOL_ON){
3667 We parse the source string until we hit a char that's NOT a digit.
3683 backupState(source, &initialState);
3691 if (!collIter_bos(source)){
3692 UChar lead = getPrevNormalizedChar(source, status);
3695 source);
3767 if (!collIter_bos(source)) {
3768 ch = getPrevNormalizedChar(source, status);
3769 //goBackOne(source);
3771 backupState(source, &state);
3772 if (!collIter_bos(source)) {
3773 goBackOne(source);
3774 UChar lead = getPrevNormalizedChar(source, status);
3779 loadState(source, &state, FALSE);
3788 loadState(source, &state, FALSE);
3793 //getNextNormalizedChar(source);
3797 goBackOne(source);
3813 loadState(source, &initialState, FALSE);
3857 if(!ensureCEsCapacity(source, size)) {
3860 *(source->CEpos++) = (((numTempBuf[0] << 8) | numTempBuf[1]) << UCOL_PRIMARYORDERSHIFT) | //Primary weight
3868 *(source->CEpos++) = (primWeight << UCOL_PRIMARYORDERSHIFT) | UCOL_CONTINUATION_MARKER;
3871 source->toReturn = source->CEpos -1;
3872 return *(source->toReturn);
3906 if (source->offsetBuffer == NULL) {
3907 source->offsetBufferSize = UCOL_EXPAND_CE_BUFFER_SIZE;
3908 source->offsetBuffer = (int32_t *) uprv_malloc(sizeof(int32_t) * UCOL_EXPAND_CE_BUFFER_SIZE);
3909 source->offsetStore = source->offsetBuffer;
3912 int32_t firstOffset = (int32_t)(source->pos - source->string);
3914 *(source->offsetStore++) = firstOffset;
3919 if (!source->coll->image->jamoSpecial) {
3920 *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(&coll->mapping, L);
3921 *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(&coll->mapping, V);
3922 *(source->offsetStore++) = firstOffset + 1;
3925 *(source->CEpos++) = UTRIE_GET32_FROM_LEAD(&coll->mapping, T);
3926 *(source->offsetStore++) = firstOffset + 1;
3929 source->toReturn = source->CEpos - 1;
3931 source->offsetReturn = source->offsetStore - 1;
3932 if (source->offsetReturn == source->offsetBuffer) {
3933 source->offsetStore = source->offsetBuffer;
3936 return *(source->toReturn);
3946 UChar *tempbuffer = source->writableBuffer.getBuffer(5);
3957 source->writableBuffer.releaseBuffer(tempbufferLength);
3963 if (source->pos == source->string) {
3964 source->fcdPosition = NULL;
3966 source->fcdPosition = source->pos-1;
3969 source->pos = source->writableBuffer.getTerminatedBuffer() + tempbufferLength;
3970 source->origFlags = source->flags;
3971 source->flags |= UCOL_ITER_INNORMBUF;
3972 source->flags &= ~(UCOL_ITER_NORM | UCOL_ITER_HASLEN);
3979 return getPrevImplicit(ch, source);
3983 return getPrevImplicit(ch, source);
3999 if (isAtStartPrevIterate(source)) {
4003 if (source->pos != source->writableBuffer.getBuffer()) {
4004 prev = source->pos - 1;
4006 prev = source->fcdPosition;
4013 source->pos = prev;
4018 return getPrevImplicit(cp, source);
4205 const UChar *source,
4212 UTRACE_DATA3(UTRACE_VERBOSE, "coll=%p, source string = %vh ", coll, source,
4213 ((sourceLength==-1 && source!=NULL) ? u_strlen(source) : sourceLength));
4219 if(source != NULL) {
4220 // source == NULL is actually an error situation, but we would need to
4229 keySize = coll->sortKeyGen(coll, source, sourceLength, &result, resultLength, FALSE, &status);
4247 const UChar *source, int32_t sourceLength,
4251 return coll->sortKeyGen(coll, source, sourceLength, pResult, 0, TRUE, pErrorCode);
4603 const UChar *source,
4635 int32_t len = (sourceLength == -1 ? u_strlen(source) : sourceLength);
4678 normSource.setTo(FALSE, source, len);
4684 source = normSource.getBuffer();
4689 IInit_collIterate(coll, source, len, &s, status);
4693 if(source == normSource.getBuffer()) {
4966 IInit_collIterate(coll, (UChar *)source, len, &s, status);
4972 if(source == normSource.getBuffer()) {
5246 const UChar *source,
5282 normSource.setTo(len < 0, source, len);
5289 source = normSource.getBuffer();
5294 IInit_collIterate(coll, (UChar *)source, len, &s, status);
5298 if(source == normSource.getBuffer()) {
5459 IInit_collIterate(coll, (UChar *)source, len, &s, status);
5465 if(source == normSource.getBuffer()) {
6484 ucol_getBound(const uint8_t *source,
6496 if(source == NULL) {
6505 if(source[sourceIndex] == UCOL_LEVELTERMINATOR) {
6509 && (source[sourceIndex] != 0 || sourceIndex < sourceLength));
6511 if((source[sourceIndex] == 0 || sourceIndex == sourceLength)
6522 uprv_memcpy(result, source, sourceIndex);
7281 const UChar *source = NULL;
7298 source = sourceString.getBuffer();
7305 source = sColl->string;
7311 sourceKeyLen = ucol_getSortKey(coll, source, sourceLength, sourceKeyP, sourceKeyLen);
7318 sourceKeyLen = ucol_getSortKey(coll, source, sourceLength, sourceKeyP, sourceKeyLen);
7439 // Source loop. Sam as the target loop.
7829 const UChar *source, int32_t sourceLength,
7834 IInit_collIterate(coll, source, sourceLength, &sColl, status);
7903 const UChar *source,
7926 // sOrder=getNextlatinOneCE(source);
7928 sChar=source[sIndex++];
7938 sChar=source[sIndex++];
7942 return ucol_strcollRegular(coll, source, sLen, target, tLen, status);
7949 sOrder = ucol_getLatinOneContraction(coll, UCOL_PRIMARY, sOrder, source, &sIndex, sLen);
7956 return ucol_strcollRegular(coll, source, sLen, target, tLen, status);
7966 if(endOfSource) { // this is different than source loop,
7967 // as we already know that source
7988 return ucol_strcollRegular(coll, source, sLen, target, tLen, status);
7992 // Handling specials, see the comments for source
7999 return ucol_strcollRegular(coll, source, sLen, target, tLen, status);
8003 if(endOfSource) { // source is finished, but target is not, say the result.
8050 sChar=source[sIndex++];
8053 sOrder = ucol_getLatinOneContraction(coll, UCOL_SECONDARY, sOrder, source, &sIndex, sLen);
8094 return ucol_strcollRegular(coll, source, sLen, target, tLen, status);
8104 sChar=source[--sIndex];
8156 sChar=source[sIndex++];
8159 sOrder = ucol_getLatinOneContraction(coll, UCOL_TERTIARY, sOrder, source, &sIndex, sLen);
8309 const UChar *source,
8318 UTRACE_DATA3(UTRACE_VERBOSE, "coll=%p, source=%p, target=%p", coll, source, target);
8319 UTRACE_DATA2(UTRACE_VERBOSE, "source string = %vh ", source, sourceLength);
8323 if(source == NULL || target == NULL) {
8330 /* Quick check if source and target are same strings. */
8332 if (source==target && sourceLength==targetLength) {
8340 const UChar *pSrc = source;
8355 equalLength = (int32_t)(pSrc - source);
8360 const UChar *pSrcEnd = source + sourceLength;
8377 equalLength = (int32_t)(pSrc - source);
8393 //pSrc = source + equalLength; /* point to the first differing chars */
8395 if (pSrc != source+sourceLength && ucol_unsafeCP(*pSrc, coll) ||
8409 source += equalLength;
8421 if(!coll->latinOneUse || (sourceLength > 0 && *source&0xff00) || (targetLength > 0 && *target&0xff00)) {
8422 returnVal = ucol_strcollRegular(coll, source, sourceLength, target, targetLength, &status);
8424 returnVal = ucol_strcollUseLatin1(coll, source, sourceLength, target, targetLength, &status);
8433 const UChar *source,
8438 return (ucol_strcoll(coll, source, sourceLength, target, targetLength)
8445 const UChar *source,
8450 return (ucol_strcoll(coll, source, sourceLength, target, targetLength)
8457 const UChar *source,
8462 return (ucol_strcoll(coll, source, sourceLength, target, targetLength)