• Home
  • Raw
  • Download

Lines Matching refs:ut

39 utext_access(UText *ut, int64_t index, UBool forward) {  in utext_access()  argument
40 return ut->pFuncs->access(ut, index, forward); in utext_access()
46 utext_moveIndex32(UText *ut, int32_t delta) { in utext_moveIndex32() argument
50 if(ut->chunkOffset>=ut->chunkLength && !utext_access(ut, ut->chunkNativeLimit, TRUE)) { in utext_moveIndex32()
53 c = ut->chunkContents[ut->chunkOffset]; in utext_moveIndex32()
55 c = utext_next32(ut); in utext_moveIndex32()
60 ut->chunkOffset++; in utext_moveIndex32()
66 if(ut->chunkOffset<=0 && !utext_access(ut, ut->chunkNativeStart, FALSE)) { in utext_moveIndex32()
69 c = ut->chunkContents[ut->chunkOffset-1]; in utext_moveIndex32()
71 c = utext_previous32(ut); in utext_moveIndex32()
76 ut->chunkOffset--; in utext_moveIndex32()
86 utext_nativeLength(UText *ut) { in utext_nativeLength() argument
87 return ut->pFuncs->nativeLength(ut); in utext_nativeLength()
92 utext_isLengthExpensive(const UText *ut) { in utext_isLengthExpensive() argument
93 UBool r = (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE)) != 0; in utext_isLengthExpensive()
99 utext_getNativeIndex(const UText *ut) { in utext_getNativeIndex() argument
100 if(ut->chunkOffset <= ut->nativeIndexingLimit) { in utext_getNativeIndex()
101 return ut->chunkNativeStart+ut->chunkOffset; in utext_getNativeIndex()
103 return ut->pFuncs->mapOffsetToNative(ut); in utext_getNativeIndex()
109 utext_setNativeIndex(UText *ut, int64_t index) { in utext_setNativeIndex() argument
110 if(index<ut->chunkNativeStart || index>=ut->chunkNativeLimit) { in utext_setNativeIndex()
115 ut->pFuncs->access(ut, index, TRUE); in utext_setNativeIndex()
116 } else if((int32_t)(index - ut->chunkNativeStart) <= ut->nativeIndexingLimit) { in utext_setNativeIndex()
118 ut->chunkOffset=(int32_t)(index-ut->chunkNativeStart); in utext_setNativeIndex()
120 ut->chunkOffset=ut->pFuncs->mapNativeIndexToUTF16(ut, index); in utext_setNativeIndex()
124 if (ut->chunkOffset<ut->chunkLength) { in utext_setNativeIndex()
125 UChar c= ut->chunkContents[ut->chunkOffset]; in utext_setNativeIndex()
127 if (ut->chunkOffset==0) { in utext_setNativeIndex()
128 ut->pFuncs->access(ut, ut->chunkNativeStart, FALSE); in utext_setNativeIndex()
130 if (ut->chunkOffset>0) { in utext_setNativeIndex()
131 UChar lead = ut->chunkContents[ut->chunkOffset-1]; in utext_setNativeIndex()
133 ut->chunkOffset--; in utext_setNativeIndex()
143 utext_getPreviousNativeIndex(UText *ut) { in utext_getPreviousNativeIndex() argument
149 int32_t i = ut->chunkOffset - 1; in utext_getPreviousNativeIndex()
152 UChar c = ut->chunkContents[i]; in utext_getPreviousNativeIndex()
154 if (i <= ut->nativeIndexingLimit) { in utext_getPreviousNativeIndex()
155 result = ut->chunkNativeStart + i; in utext_getPreviousNativeIndex()
157 ut->chunkOffset = i; in utext_getPreviousNativeIndex()
158 result = ut->pFuncs->mapOffsetToNative(ut); in utext_getPreviousNativeIndex()
159 ut->chunkOffset++; in utext_getPreviousNativeIndex()
166 if (ut->chunkOffset==0 && ut->chunkNativeStart==0) { in utext_getPreviousNativeIndex()
173 utext_previous32(ut); in utext_getPreviousNativeIndex()
174 result = UTEXT_GETNATIVEINDEX(ut); in utext_getPreviousNativeIndex()
175 utext_next32(ut); in utext_getPreviousNativeIndex()
186 utext_current32(UText *ut) { in utext_current32() argument
188 if (ut->chunkOffset==ut->chunkLength) { in utext_current32()
190 if (ut->pFuncs->access(ut, ut->chunkNativeLimit, TRUE) == FALSE) { in utext_current32()
196 c = ut->chunkContents[ut->chunkOffset]; in utext_current32()
207 if ((ut->chunkOffset+1) < ut->chunkLength) { in utext_current32()
209 trail = ut->chunkContents[ut->chunkOffset+1]; in utext_current32()
218 int64_t nativePosition = ut->chunkNativeLimit; in utext_current32()
219 int32_t originalOffset = ut->chunkOffset; in utext_current32()
220 if (ut->pFuncs->access(ut, nativePosition, TRUE)) { in utext_current32()
221 trail = ut->chunkContents[ut->chunkOffset]; in utext_current32()
223 …UBool r = ut->pFuncs->access(ut, nativePosition, FALSE); // reverse iteration flag loads precedin… in utext_current32()
225 ut->chunkOffset = originalOffset; in utext_current32()
240 utext_char32At(UText *ut, int64_t nativeIndex) { in utext_char32At() argument
244 …if (nativeIndex>=ut->chunkNativeStart && nativeIndex < ut->chunkNativeStart + ut->nativeIndexingLi… in utext_char32At()
245 ut->chunkOffset = (int32_t)(nativeIndex - ut->chunkNativeStart); in utext_char32At()
246 c = ut->chunkContents[ut->chunkOffset]; in utext_char32At()
253 utext_setNativeIndex(ut, nativeIndex); in utext_char32At()
254 if (nativeIndex>=ut->chunkNativeStart && ut->chunkOffset<ut->chunkLength) { in utext_char32At()
255 c = ut->chunkContents[ut->chunkOffset]; in utext_char32At()
259 c = utext_current32(ut); in utext_char32At()
267 utext_next32(UText *ut) { in utext_next32() argument
270 if (ut->chunkOffset >= ut->chunkLength) { in utext_next32()
271 if (ut->pFuncs->access(ut, ut->chunkNativeLimit, TRUE) == FALSE) { in utext_next32()
276 c = ut->chunkContents[ut->chunkOffset++]; in utext_next32()
284 if (ut->chunkOffset >= ut->chunkLength) { in utext_next32()
285 if (ut->pFuncs->access(ut, ut->chunkNativeLimit, TRUE) == FALSE) { in utext_next32()
291 UChar32 trail = ut->chunkContents[ut->chunkOffset]; in utext_next32()
301 ut->chunkOffset++; // move iteration position over the trail surrogate. in utext_next32()
307 utext_previous32(UText *ut) { in utext_previous32() argument
310 if (ut->chunkOffset <= 0) { in utext_previous32()
311 if (ut->pFuncs->access(ut, ut->chunkNativeStart, FALSE) == FALSE) { in utext_previous32()
315 ut->chunkOffset--; in utext_previous32()
316 c = ut->chunkContents[ut->chunkOffset]; in utext_previous32()
324 if (ut->chunkOffset <= 0) { in utext_previous32()
325 if (ut->pFuncs->access(ut, ut->chunkNativeStart, FALSE) == FALSE) { in utext_previous32()
332 UChar32 lead = ut->chunkContents[ut->chunkOffset-1]; in utext_previous32()
340 ut->chunkOffset--; // move iteration position over the lead surrogate. in utext_previous32()
347 utext_next32From(UText *ut, int64_t index) { in utext_next32From() argument
350 if(index<ut->chunkNativeStart || index>=ut->chunkNativeLimit) { in utext_next32From()
352 if(!ut->pFuncs->access(ut, index, TRUE)) { in utext_next32From()
356 } else if (index - ut->chunkNativeStart <= (int64_t)ut->nativeIndexingLimit) { in utext_next32From()
358 ut->chunkOffset = (int32_t)(index - ut->chunkNativeStart); in utext_next32From()
361 ut->chunkOffset = ut->pFuncs->mapNativeIndexToUTF16(ut, index); in utext_next32From()
364 c = ut->chunkContents[ut->chunkOffset++]; in utext_next32From()
368 utext_setNativeIndex(ut, index); in utext_next32From()
369 c = utext_next32(ut); in utext_next32From()
376 utext_previous32From(UText *ut, int64_t index) { in utext_previous32From() argument
390 if(index<=ut->chunkNativeStart || index>ut->chunkNativeLimit) { in utext_previous32From()
392 if(!ut->pFuncs->access(ut, index, FALSE)) { in utext_previous32From()
396 } else if(index - ut->chunkNativeStart <= (int64_t)ut->nativeIndexingLimit) { in utext_previous32From()
398 ut->chunkOffset = (int32_t)(index - ut->chunkNativeStart); in utext_previous32From()
400 ut->chunkOffset=ut->pFuncs->mapNativeIndexToUTF16(ut, index); in utext_previous32From()
401 if (ut->chunkOffset==0 && !ut->pFuncs->access(ut, index, FALSE)) { in utext_previous32From()
410 ut->chunkOffset--; in utext_previous32From()
411 cPrev = ut->chunkContents[ut->chunkOffset]; in utext_previous32From()
416 utext_setNativeIndex(ut, index); in utext_previous32From()
417 cPrev = utext_previous32(ut); in utext_previous32From()
424 utext_extract(UText *ut, in utext_extract() argument
428 return ut->pFuncs->extract(ut, start, limit, dest, destCapacity, status); in utext_extract()
460 utext_isWritable(const UText *ut) in utext_isWritable() argument
462 UBool b = (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_WRITABLE)) != 0; in utext_isWritable()
468 utext_freeze(UText *ut) { in utext_freeze() argument
470 ut->providerProperties &= ~(I32_FLAG(UTEXT_PROVIDER_WRITABLE)); in utext_freeze()
475 utext_hasMetaData(const UText *ut) in utext_hasMetaData() argument
477 UBool b = (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_HAS_META_DATA)) != 0; in utext_hasMetaData()
484 utext_replace(UText *ut, in utext_replace() argument
492 if ((ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_WRITABLE)) == 0) { in utext_replace()
496 …int32_t i = ut->pFuncs->replace(ut, nativeStart, nativeLimit, replacementText, replacementLength, … in utext_replace()
501 utext_copy(UText *ut, in utext_copy() argument
510 if ((ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_WRITABLE)) == 0) { in utext_copy()
514 ut->pFuncs->copy(ut, nativeStart, nativeLimit, destIndex, move, status); in utext_copy()
569 UText ut; member
576 utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) { in utext_setup() argument
578 return ut; in utext_setup()
581 if (ut == NULL) { in utext_setup()
587 ut = (UText *)uprv_malloc(spaceRequired); in utext_setup()
588 if (ut == NULL) { in utext_setup()
592 *ut = emptyText; in utext_setup()
593 ut->flags |= UTEXT_HEAP_ALLOCATED; in utext_setup()
595 ut->extraSize = extraSpace; in utext_setup()
596 ut->pExtra = &((ExtendedUText *)ut)->extension; in utext_setup()
602 if (ut->magic != UTEXT_MAGIC) { in utext_setup()
604 return ut; in utext_setup()
608 if ((ut->flags & UTEXT_OPEN) && ut->pFuncs->close != NULL) { in utext_setup()
609 ut->pFuncs->close(ut); in utext_setup()
611 ut->flags &= ~UTEXT_OPEN; in utext_setup()
615 if (extraSpace > ut->extraSize) { in utext_setup()
618 if (ut->flags & UTEXT_EXTRA_HEAP_ALLOCATED) { in utext_setup()
619 uprv_free(ut->pExtra); in utext_setup()
620 ut->extraSize = 0; in utext_setup()
622 ut->pExtra = uprv_malloc(extraSpace); in utext_setup()
623 if (ut->pExtra == NULL) { in utext_setup()
626 ut->extraSize = extraSpace; in utext_setup()
627 ut->flags |= UTEXT_EXTRA_HEAP_ALLOCATED; in utext_setup()
632 ut->flags |= UTEXT_OPEN; in utext_setup()
636 ut->context = NULL; in utext_setup()
637 ut->chunkContents = NULL; in utext_setup()
638 ut->p = NULL; in utext_setup()
639 ut->q = NULL; in utext_setup()
640 ut->r = NULL; in utext_setup()
641 ut->a = 0; in utext_setup()
642 ut->b = 0; in utext_setup()
643 ut->c = 0; in utext_setup()
644 ut->chunkOffset = 0; in utext_setup()
645 ut->chunkLength = 0; in utext_setup()
646 ut->chunkNativeStart = 0; in utext_setup()
647 ut->chunkNativeLimit = 0; in utext_setup()
648 ut->nativeIndexingLimit = 0; in utext_setup()
649 ut->providerProperties = 0; in utext_setup()
650 ut->privA = 0; in utext_setup()
651 ut->privB = 0; in utext_setup()
652 ut->privC = 0; in utext_setup()
653 ut->privP = NULL; in utext_setup()
654 if (ut->pExtra!=NULL && ut->extraSize>0) in utext_setup()
655 uprv_memset(ut->pExtra, 0, ut->extraSize); in utext_setup()
658 return ut; in utext_setup()
663 utext_close(UText *ut) { in utext_close() argument
664 if (ut==NULL || in utext_close()
665 ut->magic != UTEXT_MAGIC || in utext_close()
666 (ut->flags & UTEXT_OPEN) == 0) in utext_close()
670 return ut; in utext_close()
675 if (ut->pFuncs->close != NULL) { in utext_close()
676 ut->pFuncs->close(ut); in utext_close()
678 ut->flags &= ~UTEXT_OPEN; in utext_close()
682 if (ut->flags & UTEXT_EXTRA_HEAP_ALLOCATED) { in utext_close()
683 uprv_free(ut->pExtra); in utext_close()
684 ut->pExtra = NULL; in utext_close()
685 ut->flags &= ~UTEXT_EXTRA_HEAP_ALLOCATED; in utext_close()
686 ut->extraSize = 0; in utext_close()
692 ut->pFuncs = NULL; in utext_close()
694 if (ut->flags & UTEXT_HEAP_ALLOCATED) { in utext_close()
698 ut->magic = 0; in utext_close()
699 uprv_free(ut); in utext_close()
700 ut = NULL; in utext_close()
702 return ut; in utext_close()
716 invalidateChunk(UText *ut) { in invalidateChunk() argument
717 ut->chunkLength = 0; in invalidateChunk()
718 ut->chunkNativeLimit = 0; in invalidateChunk()
719 ut->chunkNativeStart = 0; in invalidateChunk()
720 ut->chunkOffset = 0; in invalidateChunk()
721 ut->nativeIndexingLimit = 0; in invalidateChunk()
906 utf8TextLength(UText *ut) { in utf8TextLength() argument
907 if (ut->b < 0) { in utf8TextLength()
910 const char *r = (const char *)ut->context + ut->c; in utf8TextLength()
914 if ((r - (const char *)ut->context) < 0x7fffffff) { in utf8TextLength()
915 ut->b = (int32_t)(r - (const char *)ut->context); in utf8TextLength()
919 ut->b = 0x7fffffff; in utf8TextLength()
921 ut->providerProperties &= ~I32_FLAG(UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE); in utf8TextLength()
923 return ut->b; in utf8TextLength()
932 utf8TextAccess(UText *ut, int64_t index, UBool forward) { in utf8TextAccess() argument
939 const uint8_t *s8=(const uint8_t *)ut->context; in utf8TextAccess()
941 int32_t length = ut->b; // Length of original utf-8 in utf8TextAccess()
955 } else if (ix>=ut->c) { in utf8TextAccess()
960 while (ut->c<ix && s8[ut->c]!=0) { in utf8TextAccess()
961 ut->c++; in utf8TextAccess()
964 if (s8[ut->c] == 0) { in utf8TextAccess()
967 ix = ut->c; in utf8TextAccess()
968 ut->b = ut->c; in utf8TextAccess()
969 length = ut->c; in utf8TextAccess()
970 ut->providerProperties &= ~I32_FLAG(UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE); in utf8TextAccess()
979 if (ix==ut->chunkNativeLimit) { in utf8TextAccess()
985 ut->chunkOffset = ut->chunkLength; in utf8TextAccess()
990 UTF8Buf *altB = (UTF8Buf *)ut->q; in utf8TextAccess()
1002 u8b = (UTF8Buf *)ut->q; // the alternate buffer in utf8TextAccess()
1011 if (ix == ut->chunkNativeLimit) { in utf8TextAccess()
1014 ut->chunkOffset = ut->chunkLength; in utf8TextAccess()
1027 if (ix<ut->chunkNativeStart || ix>=ut->chunkNativeLimit) { in utf8TextAccess()
1033 u8b = (UTF8Buf *)ut->p; // the current buffer in utf8TextAccess()
1035 ut->chunkOffset = u8b->mapToUChars[mapIndex] - u8b->bufStartIdx; in utf8TextAccess()
1046 if (ix==ut->chunkNativeStart) { in utf8TextAccess()
1052 ut->chunkOffset = 0; in utf8TextAccess()
1057 UTF8Buf *altB = (UTF8Buf *)ut->q; in utf8TextAccess()
1069 u8b = (UTF8Buf *)ut->q; // the alternate buffer in utf8TextAccess()
1090 if (ix<=ut->chunkNativeStart || ix>ut->chunkNativeLimit) { in utf8TextAccess()
1097 u8b = (UTF8Buf *)ut->p; in utf8TextAccess()
1099 ut->chunkOffset = u8b->mapToUChars[mapIndex] - u8b->bufStartIdx; in utf8TextAccess()
1100 if (ut->chunkOffset==0) { in utf8TextAccess()
1118 u8b = (UTF8Buf *)ut->q; in utf8TextAccess()
1119 ut->q = ut->p; in utf8TextAccess()
1120 ut->p = u8b; in utf8TextAccess()
1121 ut->chunkContents = &u8b->buf[u8b->bufStartIdx]; in utf8TextAccess()
1122 ut->chunkLength = u8b->bufLimitIdx - u8b->bufStartIdx; in utf8TextAccess()
1123 ut->chunkNativeStart = u8b->bufNativeStart; in utf8TextAccess()
1124 ut->chunkNativeLimit = u8b->bufNativeLimit; in utf8TextAccess()
1125 ut->nativeIndexingLimit = u8b->bufNILimit; in utf8TextAccess()
1135 ut->chunkOffset = u8b->mapToUChars[mapIndex] - u8b->bufStartIdx; in utf8TextAccess()
1150 u8b = (UTF8Buf *)ut->q; in utf8TextAccess()
1151 ut->q = ut->p; in utf8TextAccess()
1152 ut->p = u8b; in utf8TextAccess()
1153 ut->chunkContents = &u8b->buf[u8b->bufStartIdx]; in utf8TextAccess()
1154 ut->chunkLength = u8b->bufLimitIdx - u8b->bufStartIdx; in utf8TextAccess()
1155 ut->chunkNativeStart = u8b->bufNativeStart; in utf8TextAccess()
1156 ut->chunkNativeLimit = u8b->bufNativeLimit; in utf8TextAccess()
1157 ut->nativeIndexingLimit = u8b->bufNILimit; in utf8TextAccess()
1163 ut->chunkOffset = ut->chunkLength; in utf8TextAccess()
1165 ut->chunkOffset = 0; in utf8TextAccess()
1175 u8b = (UTF8Buf *)ut->q; in utf8TextAccess()
1196 UTF8Buf *u8b = (UTF8Buf *)ut->q; in utf8TextAccess()
1197 ut->q = ut->p; in utf8TextAccess()
1198 ut->p = u8b; in utf8TextAccess()
1200 int32_t strLen = ut->b; in utf8TextAccess()
1273 ut->chunkContents = buf; in utf8TextAccess()
1274 ut->chunkOffset = 0; in utf8TextAccess()
1275 ut->chunkLength = u8b->bufLimitIdx; in utf8TextAccess()
1276 ut->chunkNativeStart = u8b->bufNativeStart; in utf8TextAccess()
1277 ut->chunkNativeLimit = u8b->bufNativeLimit; in utf8TextAccess()
1278 ut->nativeIndexingLimit = u8b->bufNILimit; in utf8TextAccess()
1282 if (nulTerminated && srcIx>ut->c) { in utf8TextAccess()
1283 ut->c = srcIx; in utf8TextAccess()
1287 ut->b = srcIx; in utf8TextAccess()
1288 ut->providerProperties &= ~I32_FLAG(UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE); in utf8TextAccess()
1300 if (ix != ut->b) { in utf8TextAccess()
1307 UTF8Buf *u8b = (UTF8Buf *)ut->q; in utf8TextAccess()
1308 ut->q = ut->p; in utf8TextAccess()
1309 ut->p = u8b; in utf8TextAccess()
1385 ut->chunkContents = &buf[u8b->bufStartIdx]; in utf8TextAccess()
1386 ut->chunkLength = u8b->bufLimitIdx - u8b->bufStartIdx; in utf8TextAccess()
1387 ut->chunkOffset = ut->chunkLength; in utf8TextAccess()
1388 ut->chunkNativeStart = u8b->bufNativeStart; in utf8TextAccess()
1389 ut->chunkNativeLimit = u8b->bufNativeLimit; in utf8TextAccess()
1390 ut->nativeIndexingLimit = u8b->bufNILimit; in utf8TextAccess()
1466 utf8TextExtract(UText *ut, in utf8TextExtract() argument
1477 int32_t length = ut->b; in utf8TextExtract()
1490 const uint8_t *buf = (const uint8_t *)ut->context; in utf8TextExtract()
1492 if (start32 < ut->chunkNativeLimit) { in utf8TextExtract()
1501 if (limit32 < ut->chunkNativeLimit) { in utf8TextExtract()
1513 (const char *)ut->context+start32, limit32-start32, in utf8TextExtract()
1515 utf8TextAccess(ut, limit32, TRUE); in utf8TextExtract()
1524 utf8TextMapOffsetToNative(const UText *ut) { in utf8TextMapOffsetToNative() argument
1526 UTF8Buf *u8b = (UTF8Buf *)ut->p; in utf8TextMapOffsetToNative()
1527 U_ASSERT(ut->chunkOffset>ut->nativeIndexingLimit && ut->chunkOffset<=ut->chunkLength); in utf8TextMapOffsetToNative()
1528 …int32_t nativeOffset = u8b->mapToNative[ut->chunkOffset + u8b->bufStartIdx] + u8b->toUCharsMapStar… in utf8TextMapOffsetToNative()
1529 U_ASSERT(nativeOffset >= ut->chunkNativeStart && nativeOffset <= ut->chunkNativeLimit); in utf8TextMapOffsetToNative()
1537 utf8TextMapIndexToUTF16(const UText *ut, int64_t index64) { in utf8TextMapIndexToUTF16() argument
1540 UTF8Buf *u8b = (UTF8Buf *)ut->p; in utf8TextMapIndexToUTF16()
1541 U_ASSERT(index>=ut->chunkNativeStart+ut->nativeIndexingLimit); in utf8TextMapIndexToUTF16()
1542 U_ASSERT(index<=ut->chunkNativeLimit); in utf8TextMapIndexToUTF16()
1545 U_ASSERT(offset>=0 && offset<=ut->chunkLength); in utf8TextMapIndexToUTF16()
1580 utf8TextClose(UText *ut) { in utf8TextClose() argument
1584 if (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_OWNS_TEXT)) { in utf8TextClose()
1585 char *s = (char *)ut->context; in utf8TextClose()
1587 ut->context = NULL; in utf8TextClose()
1616 utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status) { in utext_openUTF8() argument
1629 ut = utext_setup(ut, sizeof(UTF8Buf) * 2, status); in utext_openUTF8()
1631 return ut; in utext_openUTF8()
1634 ut->pFuncs = &utf8Funcs; in utext_openUTF8()
1635 ut->context = s; in utext_openUTF8()
1636 ut->b = (int32_t)length; in utext_openUTF8()
1637 ut->c = (int32_t)length; in utext_openUTF8()
1638 if (ut->c < 0) { in utext_openUTF8()
1639 ut->c = 0; in utext_openUTF8()
1640 ut->providerProperties |= I32_FLAG(UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE); in utext_openUTF8()
1642 ut->p = ut->pExtra; in utext_openUTF8()
1643 ut->q = (char *)ut->pExtra + sizeof(UTF8Buf); in utext_openUTF8()
1644 return ut; in utext_openUTF8()
1705 repTextClose(UText *ut) { in repTextClose() argument
1709 if (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_OWNS_TEXT)) { in repTextClose()
1710 Replaceable *rep = (Replaceable *)ut->context; in repTextClose()
1712 ut->context = NULL; in repTextClose()
1718 repTextLength(UText *ut) { in repTextLength() argument
1719 const Replaceable *replSrc = (const Replaceable *)ut->context; in repTextLength()
1726 repTextAccess(UText *ut, int64_t index, UBool forward) { in repTextAccess() argument
1727 const Replaceable *rep=(const Replaceable *)ut->context; in repTextAccess()
1745 if (index32>=ut->chunkNativeStart && index32<ut->chunkNativeLimit) { in repTextAccess()
1747 ut->chunkOffset = (int32_t)(index - ut->chunkNativeStart); in repTextAccess()
1750 if (index32>=length && ut->chunkNativeLimit==length) { in repTextAccess()
1753 ut->chunkOffset = length - (int32_t)ut->chunkNativeStart; in repTextAccess()
1757 ut->chunkNativeLimit = index + REP_TEXT_CHUNK_SIZE - 1; in repTextAccess()
1762 if(ut->chunkNativeLimit > length) { in repTextAccess()
1763 ut->chunkNativeLimit = length; in repTextAccess()
1766 ut->chunkNativeStart = ut->chunkNativeLimit - REP_TEXT_CHUNK_SIZE; in repTextAccess()
1767 if(ut->chunkNativeStart < 0) { in repTextAccess()
1768 ut->chunkNativeStart = 0; in repTextAccess()
1772 if (index32>ut->chunkNativeStart && index32<=ut->chunkNativeLimit) { in repTextAccess()
1774 ut->chunkOffset = index32 - (int32_t)ut->chunkNativeStart; in repTextAccess()
1777 if (index32==0 && ut->chunkNativeStart==0) { in repTextAccess()
1780 ut->chunkOffset = 0; in repTextAccess()
1790 ut->chunkNativeStart = index32 + 1 - REP_TEXT_CHUNK_SIZE; in repTextAccess()
1791 if (ut->chunkNativeStart < 0) { in repTextAccess()
1792 ut->chunkNativeStart = 0; in repTextAccess()
1795 ut->chunkNativeLimit = index32 + 1; in repTextAccess()
1796 if (ut->chunkNativeLimit > length) { in repTextAccess()
1797 ut->chunkNativeLimit = length; in repTextAccess()
1802 ReplExtra *ex = (ReplExtra *)ut->pExtra; in repTextAccess()
1805 rep->extractBetween((int32_t)ut->chunkNativeStart, (int32_t)ut->chunkNativeLimit, buffer); in repTextAccess()
1807 ut->chunkContents = ex->s; in repTextAccess()
1808 ut->chunkLength = (int32_t)(ut->chunkNativeLimit - ut->chunkNativeStart); in repTextAccess()
1809 ut->chunkOffset = (int32_t)(index32 - ut->chunkNativeStart); in repTextAccess()
1813 if (ut->chunkNativeLimit < length && in repTextAccess()
1814 U16_IS_LEAD(ex->s[ut->chunkLength-1])) { in repTextAccess()
1815 ut->chunkLength--; in repTextAccess()
1816 ut->chunkNativeLimit--; in repTextAccess()
1817 if (ut->chunkOffset > ut->chunkLength) { in repTextAccess()
1818 ut->chunkOffset = ut->chunkLength; in repTextAccess()
1824 if(ut->chunkNativeStart>0 && U16_IS_TRAIL(ex->s[0])) { in repTextAccess()
1825 ++(ut->chunkContents); in repTextAccess()
1826 ++(ut->chunkNativeStart); in repTextAccess()
1827 --(ut->chunkLength); in repTextAccess()
1828 --(ut->chunkOffset); in repTextAccess()
1832 U16_SET_CP_START(ut->chunkContents, 0, ut->chunkOffset); in repTextAccess()
1835 ut->nativeIndexingLimit = ut->chunkLength; in repTextAccess()
1843 repTextExtract(UText *ut, in repTextExtract() argument
1847 const Replaceable *rep=(const Replaceable *)ut->context; in repTextExtract()
1880 repTextAccess(ut, limit32, TRUE); in repTextExtract()
1886 repTextReplace(UText *ut, in repTextReplace() argument
1890 Replaceable *rep=(Replaceable *)ut->context; in repTextReplace()
1928 if (ut->chunkNativeLimit > start32) { in repTextReplace()
1931 invalidateChunk(ut); in repTextReplace()
1936 repTextAccess(ut, newIndexPos, TRUE); in repTextReplace()
1943 repTextCopy(UText *ut, in repTextCopy() argument
1949 Replaceable *rep=(Replaceable *)ut->context; in repTextCopy()
1987 if (firstAffectedIndex < ut->chunkNativeLimit) { in repTextCopy()
1989 invalidateChunk(ut); in repTextCopy()
2000 repTextAccess(ut, nativeIterIndex, TRUE); in repTextCopy()
2023 utext_openReplaceable(UText *ut, Replaceable *rep, UErrorCode *status) in utext_openReplaceable() argument
2032 ut = utext_setup(ut, sizeof(ReplExtra), status); in utext_openReplaceable()
2034 return ut; in utext_openReplaceable()
2037 ut->providerProperties = I32_FLAG(UTEXT_PROVIDER_WRITABLE); in utext_openReplaceable()
2039 ut->providerProperties |=I32_FLAG(UTEXT_PROVIDER_HAS_META_DATA); in utext_openReplaceable()
2042 ut->pFuncs = &repFuncs; in utext_openReplaceable()
2043 ut->context = rep; in utext_openReplaceable()
2044 return ut; in utext_openReplaceable()
2094 unistrTextClose(UText *ut) { in unistrTextClose() argument
2098 if (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_OWNS_TEXT)) { in unistrTextClose()
2099 UnicodeString *str = (UnicodeString *)ut->context; in unistrTextClose()
2101 ut->context = NULL; in unistrTextClose()
2113 unistrTextAccess(UText *ut, int64_t index, UBool forward) { in unistrTextAccess() argument
2114 int32_t length = ut->chunkLength; in unistrTextAccess()
2115 ut->chunkOffset = pinIndex(index, length); in unistrTextAccess()
2162 unistrTextReplace(UText *ut, in unistrTextReplace() argument
2166 UnicodeString *us=(UnicodeString *)ut->context; in unistrTextReplace()
2194 ut->chunkContents = us->getBuffer(); in unistrTextReplace()
2195 ut->chunkLength = newLength; in unistrTextReplace()
2196 ut->chunkNativeLimit = newLength; in unistrTextReplace()
2197 ut->nativeIndexingLimit = newLength; in unistrTextReplace()
2201 ut->chunkOffset = limit32 + lengthDelta; in unistrTextReplace()
2207 unistrTextCopy(UText *ut, in unistrTextCopy() argument
2212 UnicodeString *us=(UnicodeString *)ut->context; in unistrTextCopy()
2241 ut->chunkContents = us->getBuffer(); in unistrTextCopy()
2244 ut->chunkLength += limit32-start32; in unistrTextCopy()
2245 ut->chunkNativeLimit = ut->chunkLength; in unistrTextCopy()
2246 ut->nativeIndexingLimit = ut->chunkLength; in unistrTextCopy()
2250 ut->chunkOffset = destIndex32+limit32-start32; in unistrTextCopy()
2252 ut->chunkOffset = destIndex32; in unistrTextCopy()
2281 utext_openUnicodeString(UText *ut, UnicodeString *s, UErrorCode *status) { in utext_openUnicodeString() argument
2282 ut = utext_openConstUnicodeString(ut, s, status); in utext_openUnicodeString()
2284 ut->providerProperties |= I32_FLAG(UTEXT_PROVIDER_WRITABLE); in utext_openUnicodeString()
2286 return ut; in utext_openUnicodeString()
2292 utext_openConstUnicodeString(UText *ut, const UnicodeString *s, UErrorCode *status) { in utext_openConstUnicodeString() argument
2296 utext_openUChars(ut, NULL, 0, status); in utext_openConstUnicodeString()
2298 return ut; in utext_openConstUnicodeString()
2300 ut = utext_setup(ut, 0, status); in utext_openConstUnicodeString()
2305 ut->pFuncs = &unistrFuncs; in utext_openConstUnicodeString()
2306 ut->context = s; in utext_openConstUnicodeString()
2307 ut->providerProperties = I32_FLAG(UTEXT_PROVIDER_STABLE_CHUNKS); in utext_openConstUnicodeString()
2308 ut->chunkContents = s->getBuffer(); in utext_openConstUnicodeString()
2309 ut->chunkLength = s->length(); in utext_openConstUnicodeString()
2310 ut->chunkNativeStart = 0; in utext_openConstUnicodeString()
2311 ut->chunkNativeLimit = ut->chunkLength; in utext_openConstUnicodeString()
2312 ut->nativeIndexingLimit = ut->chunkLength; in utext_openConstUnicodeString()
2314 return ut; in utext_openConstUnicodeString()
2366 ucstrTextClose(UText *ut) { in ucstrTextClose() argument
2370 if (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_OWNS_TEXT)) { in ucstrTextClose()
2371 UChar *s = (UChar *)ut->context; in ucstrTextClose()
2373 ut->context = NULL; in ucstrTextClose()
2380 ucstrTextLength(UText *ut) { in ucstrTextLength() argument
2381 if (ut->a < 0) { in ucstrTextLength()
2385 const UChar *str = (const UChar *)ut->context; in ucstrTextLength()
2387 if (str[ut->chunkNativeLimit] == 0) { in ucstrTextLength()
2390 ut->chunkNativeLimit++; in ucstrTextLength()
2392 ut->a = ut->chunkNativeLimit; in ucstrTextLength()
2393 ut->chunkLength = (int32_t)ut->chunkNativeLimit; in ucstrTextLength()
2394 ut->nativeIndexingLimit = ut->chunkLength; in ucstrTextLength()
2395 ut->providerProperties &= ~I32_FLAG(UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE); in ucstrTextLength()
2397 return ut->a; in ucstrTextLength()
2402 ucstrTextAccess(UText *ut, int64_t index, UBool forward) { in ucstrTextAccess() argument
2403 const UChar *str = (const UChar *)ut->context; in ucstrTextAccess()
2409 } else if (index < ut->chunkNativeLimit) { in ucstrTextAccess()
2413 } else if (ut->a >= 0) { in ucstrTextAccess()
2416 index = ut->a; in ucstrTextAccess()
2428 int32_t chunkLimit = (int32_t)ut->chunkNativeLimit; in ucstrTextAccess()
2433 ut->a = chunkLimit; in ucstrTextAccess()
2434 ut->chunkLength = chunkLimit; in ucstrTextAccess()
2435 ut->nativeIndexingLimit = chunkLimit; in ucstrTextAccess()
2442 ut->chunkNativeLimit = chunkLimit; in ucstrTextAccess()
2443 ut->providerProperties &= ~I32_FLAG(UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE); in ucstrTextAccess()
2453 ut->a = chunkLimit; in ucstrTextAccess()
2454 ut->chunkLength = chunkLimit; in ucstrTextAccess()
2455 ut->nativeIndexingLimit = chunkLimit; in ucstrTextAccess()
2459 ut->chunkNativeLimit = chunkLimit; in ucstrTextAccess()
2460 ut->providerProperties &= ~I32_FLAG(UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE); in ucstrTextAccess()
2473 ut->chunkNativeLimit = chunkLimit; in ucstrTextAccess()
2474 ut->nativeIndexingLimit = chunkLimit; in ucstrTextAccess()
2475 ut->chunkLength = chunkLimit; in ucstrTextAccess()
2481 ut->chunkOffset = (int32_t)index; in ucstrTextAccess()
2484 UBool retVal = (forward && index<ut->chunkNativeLimit) || (!forward && index>0); in ucstrTextAccess()
2491 ucstrTextExtract(UText *ut, in ucstrTextExtract() argument
2513 ucstrTextAccess(ut, start, TRUE); in ucstrTextExtract()
2514 const UChar *s=ut->chunkContents; in ucstrTextExtract()
2515 start32 = ut->chunkOffset; in ucstrTextExtract()
2517 int32_t strLength=(int32_t)ut->a; in ucstrTextExtract()
2527 ut->a = si; // set string length for this UText in ucstrTextExtract()
2528 ut->chunkNativeLimit = si; in ucstrTextExtract()
2529 ut->chunkLength = si; in ucstrTextExtract()
2530 ut->nativeIndexingLimit = si; in ucstrTextExtract()
2564 if (si <= ut->chunkNativeLimit) { in ucstrTextExtract()
2565 ut->chunkOffset = si; in ucstrTextExtract()
2567 ucstrTextAccess(ut, si, TRUE); in ucstrTextExtract()
2599 utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status) { in utext_openUChars() argument
2610 ut = utext_setup(ut, 0, status); in utext_openUChars()
2612 ut->pFuncs = &ucstrFuncs; in utext_openUChars()
2613 ut->context = s; in utext_openUChars()
2614 ut->providerProperties = I32_FLAG(UTEXT_PROVIDER_STABLE_CHUNKS); in utext_openUChars()
2616 ut->providerProperties |= I32_FLAG(UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE); in utext_openUChars()
2618 ut->a = length; in utext_openUChars()
2619 ut->chunkContents = s; in utext_openUChars()
2620 ut->chunkNativeStart = 0; in utext_openUChars()
2621 ut->chunkNativeLimit = length>=0? length : 0; in utext_openUChars()
2622 ut->chunkLength = (int32_t)ut->chunkNativeLimit; in utext_openUChars()
2623 ut->chunkOffset = 0; in utext_openUChars()
2624 ut->nativeIndexingLimit = ut->chunkLength; in utext_openUChars()
2626 return ut; in utext_openUChars()
2649 charIterTextClose(UText *ut) { in charIterTextClose() argument
2653 CharacterIterator *ci = (CharacterIterator *)ut->r; in charIterTextClose()
2655 ut->r = NULL; in charIterTextClose()
2659 charIterTextLength(UText *ut) { in charIterTextLength() argument
2660 return (int32_t)ut->a; in charIterTextLength()
2664 charIterTextAccess(UText *ut, int64_t index, UBool forward) { in charIterTextAccess() argument
2665 CharacterIterator *ci = (CharacterIterator *)ut->context; in charIterTextAccess()
2670 } else if (clippedIndex>=ut->a) { in charIterTextAccess()
2671 clippedIndex=(int32_t)ut->a; in charIterTextAccess()
2677 } else if (forward && neededIndex==ut->a && neededIndex>0) { in charIterTextAccess()
2688 if (ut->chunkNativeStart == neededIndex) { in charIterTextAccess()
2691 } else if (ut->b == neededIndex) { in charIterTextAccess()
2693 buf = (UChar *)ut->p; in charIterTextAccess()
2694 } else if (ut->c == neededIndex) { in charIterTextAccess()
2696 buf = (UChar *)ut->q; in charIterTextAccess()
2701 buf = (UChar *)ut->p; in charIterTextAccess()
2702 if (ut->p == ut->chunkContents) { in charIterTextAccess()
2703 buf = (UChar *)ut->q; in charIterTextAccess()
2708 if (i+neededIndex > ut->a) { in charIterTextAccess()
2717 ut->chunkContents = buf; in charIterTextAccess()
2718 ut->chunkLength = CIBufSize; in charIterTextAccess()
2719 ut->chunkNativeStart = neededIndex; in charIterTextAccess()
2720 ut->chunkNativeLimit = neededIndex + CIBufSize; in charIterTextAccess()
2721 if (ut->chunkNativeLimit > ut->a) { in charIterTextAccess()
2722 ut->chunkNativeLimit = ut->a; in charIterTextAccess()
2723 ut->chunkLength = (int32_t)(ut->chunkNativeLimit)-(int32_t)(ut->chunkNativeStart); in charIterTextAccess()
2725 ut->nativeIndexingLimit = ut->chunkLength; in charIterTextAccess()
2726 U_ASSERT(ut->chunkOffset>=0 && ut->chunkOffset<=CIBufSize); in charIterTextAccess()
2728 ut->chunkOffset = clippedIndex - (int32_t)ut->chunkNativeStart; in charIterTextAccess()
2729 UBool success = (forward? ut->chunkOffset<ut->chunkLength : ut->chunkOffset>0); in charIterTextAccess()
2760 charIterTextExtract(UText *ut, in charIterTextExtract() argument
2772 int32_t length = (int32_t)ut->a; in charIterTextExtract()
2779 CharacterIterator *ci = (CharacterIterator *)ut->context; in charIterTextExtract()
2797 charIterTextAccess(ut, copyLimit, TRUE); in charIterTextExtract()
2824 utext_openCharacterIterator(UText *ut, CharacterIterator *ci, UErrorCode *status) { in utext_openCharacterIterator() argument
2837 ut = utext_setup(ut, extraSpace, status); in utext_openCharacterIterator()
2839 ut->pFuncs = &charIterFuncs; in utext_openCharacterIterator()
2840 ut->context = ci; in utext_openCharacterIterator()
2841 ut->providerProperties = 0; in utext_openCharacterIterator()
2842 ut->a = ci->endIndex(); // Length of text in utext_openCharacterIterator()
2843 ut->p = ut->pExtra; // First buffer in utext_openCharacterIterator()
2844 ut->b = -1; // Native index of first buffer contents in utext_openCharacterIterator()
2845 ut->q = (UChar*)ut->pExtra+CIBufSize; // Second buffer in utext_openCharacterIterator()
2846 ut->c = -1; // Native index of second buffer contents in utext_openCharacterIterator()
2854 ut->chunkContents = (UChar *)ut->p; in utext_openCharacterIterator()
2855 ut->chunkNativeStart = -1; in utext_openCharacterIterator()
2856 ut->chunkOffset = 1; in utext_openCharacterIterator()
2857 ut->chunkNativeLimit = 0; in utext_openCharacterIterator()
2858 ut->chunkLength = 0; in utext_openCharacterIterator()
2859 ut->nativeIndexingLimit = ut->chunkOffset; // enables native indexing in utext_openCharacterIterator()
2861 return ut; in utext_openCharacterIterator()