Lines Matching refs:uni
68 initIndexes(UNormIterator *uni, UCharIterator *iter) { in initIndexes() argument
70 UCharIterator *api=&uni->api; in initIndexes()
75 uni->hasPrevious=FALSE; in initIndexes()
76 uni->hasNext=iter->hasNext(iter); in initIndexes()
79 api->start=api->index=api->limit=uni->capacity; in initIndexes()
80 uni->hasNext=FALSE; in initIndexes()
81 uni->hasPrevious=iter->hasPrevious(iter); in initIndexes()
84 api->start=api->index=api->limit=uni->capacity/2; in initIndexes()
85 uni->hasPrevious=uni->hasNext=TRUE; in initIndexes()
90 reallocArrays(UNormIterator *uni, int32_t capacity, UBool addAtStart) { in reallocArrays() argument
92 UCharIterator *api=&uni->api; in reallocArrays()
104 uni->capacity=capacity; in reallocArrays()
113 delta=capacity-uni->capacity; in reallocArrays()
114 uprv_memcpy(states+delta+start, uni->states+start, (limit-start+1)*4); in reallocArrays()
115 uprv_memcpy(chars+delta+start, uni->chars+start, (limit-start)*4); in reallocArrays()
122 uprv_memcpy(states+start, uni->states+start, (limit-start+1)*4); in reallocArrays()
123 uprv_memcpy(chars+start, uni->chars+start, (limit-start)*4); in reallocArrays()
126 uni->chars=chars; in reallocArrays()
127 uni->states=states; in reallocArrays()
190 readNext(UNormIterator *uni, UCharIterator *iter) { in readNext() argument
192 UCharIterator *api=&uni->api; in readNext()
199 capacity=uni->capacity; in readNext()
203 moveContentsTowardStart(api, uni->chars, uni->states, room); in readNext()
205 uni->hasPrevious=TRUE; in readNext()
210 if(uni->state!=uni->states[limit]) { in readNext()
211 uiter_setState(iter, uni->states[limit], &errorCode); in readNext()
213 uni->state=UITER_NO_STATE; in readNext()
214 uni->hasNext=FALSE; in readNext()
219 room=unorm_next(iter, uni->chars+limit, capacity-limit, uni->mode, 0, TRUE, NULL, &errorCode); in readNext()
223 uni->states[0]=uni->states[limit]; in readNext()
225 uni->hasPrevious=TRUE; in readNext()
228 if(!reallocArrays(uni, capacity, FALSE)) { in readNext()
229 uni->state=UITER_NO_STATE; in readNext()
230 uni->hasNext=FALSE; in readNext()
237 uiter_setState(iter, uni->states[limit], &errorCode); in readNext()
238 … room=unorm_next(iter, uni->chars+limit, capacity-limit, uni->mode, 0, TRUE, NULL, &errorCode); in readNext()
241 uni->state=UITER_NO_STATE; in readNext()
242 uni->hasNext=FALSE; in readNext()
250 uni->states[limit++]=UITER_NO_STATE; in readNext()
252 uni->states[limit]=uni->state=uiter_getState(iter); in readNext()
253 uni->hasNext=iter->hasNext(iter); in readNext()
260 readPrevious(UNormIterator *uni, UCharIterator *iter) { in readPrevious() argument
262 UCharIterator *api=&uni->api; in readPrevious()
269 capacity=uni->capacity; in readPrevious()
273 moveContentsTowardEnd(api, uni->chars, uni->states, room); in readPrevious()
275 uni->hasNext=TRUE; in readPrevious()
280 if(uni->state!=uni->states[start]) { in readPrevious()
281 uiter_setState(iter, uni->states[start], &errorCode); in readPrevious()
283 uni->state=UITER_NO_STATE; in readPrevious()
284 uni->hasPrevious=FALSE; in readPrevious()
289 room=unorm_previous(iter, uni->chars, start, uni->mode, 0, TRUE, NULL, &errorCode); in readPrevious()
293 uni->states[capacity]=uni->states[start]; in readPrevious()
295 uni->hasNext=TRUE; in readPrevious()
298 if(!reallocArrays(uni, capacity, TRUE)) { in readPrevious()
299 uni->state=UITER_NO_STATE; in readPrevious()
300 uni->hasPrevious=FALSE; in readPrevious()
307 uiter_setState(iter, uni->states[start], &errorCode); in readPrevious()
308 room=unorm_previous(iter, uni->chars, start, uni->mode, 0, TRUE, NULL, &errorCode); in readPrevious()
311 uni->state=UITER_NO_STATE; in readPrevious()
312 uni->hasPrevious=FALSE; in readPrevious()
319 uni->chars[--start]=uni->chars[--room]; in readPrevious()
321 uni->states[start]=UITER_NO_STATE; in readPrevious()
323 uni->states[start]=uni->state=uiter_getState(iter); in readPrevious()
324 uni->hasPrevious=iter->hasPrevious(iter); in readPrevious()
350 UNormIterator *uni=(UNormIterator *)api; in unormIteratorMove() local
351 UCharIterator *iter=uni->iter; in unormIteratorMove()
358 if(uni->hasPrevious) { in unormIteratorMove()
361 uni->states[api->limit]=uni->state=uiter_getState(iter); in unormIteratorMove()
362 uni->hasPrevious=FALSE; in unormIteratorMove()
363 uni->hasNext=iter->hasNext(iter); in unormIteratorMove()
374 if(uni->hasNext) { in unormIteratorMove()
376 api->start=api->index=api->limit=uni->capacity; in unormIteratorMove()
377 uni->states[api->limit]=uni->state=uiter_getState(iter); in unormIteratorMove()
378 uni->hasPrevious=iter->hasPrevious(iter); in unormIteratorMove()
379 uni->hasNext=FALSE; in unormIteratorMove()
404 if(!uni->hasNext || !readNext(uni, iter)) { in unormIteratorMove()
420 if(!uni->hasPrevious || !readPrevious(uni, iter)) { in unormIteratorMove()
426 if(api->index==api->start && !uni->hasPrevious) { in unormIteratorMove()
445 UNormIterator *uni=(UNormIterator *)api; in unormIteratorCurrent() local
448 (uni->hasNext && readNext(uni, uni->iter)) in unormIteratorCurrent()
450 return uni->chars[api->index]; in unormIteratorCurrent()
458 UNormIterator *uni=(UNormIterator *)api; in unormIteratorNext() local
461 (uni->hasNext && readNext(uni, uni->iter)) in unormIteratorNext()
463 return uni->chars[api->index++]; in unormIteratorNext()
471 UNormIterator *uni=(UNormIterator *)api; in unormIteratorPrevious() local
474 (uni->hasPrevious && readPrevious(uni, uni->iter)) in unormIteratorPrevious()
476 return uni->chars[--api->index]; in unormIteratorPrevious()
497 UNormIterator *uni=(UNormIterator *)api; in unormIteratorSetState() local
499 if(state!=uni->state) { in unormIteratorSetState()
500 uni->state=state; in unormIteratorSetState()
510 if(state==uni->states[api->index]) { in unormIteratorSetState()
512 } else if(state==uni->states[api->limit]) { in unormIteratorSetState()
520 if(state==uni->states[i]) { in unormIteratorSetState()
529 uni->states[api->limit]=state; in unormIteratorSetState()
551 UNormIterator *uni; in unorm_openIter() local
559 uni=NULL; in unorm_openIter()
563 uni=(UNormIterator *)stackMem; in unorm_openIter()
568 uni=(UNormIterator *)((char *)stackMem+align); in unorm_openIter()
574 if(uni!=NULL) { in unorm_openIter()
575 uni->isStackAllocated=TRUE; in unorm_openIter()
577 uni=(UNormIterator *)uprv_malloc(sizeof(UNormIterator)); in unorm_openIter()
578 if(uni==NULL) { in unorm_openIter()
582 uni->isStackAllocated=FALSE; in unorm_openIter()
589 uni->iter=NULL; in unorm_openIter()
590 uni->chars=uni->charsBuffer; in unorm_openIter()
591 uni->states=uni->statesBuffer; in unorm_openIter()
592 uni->capacity=INITIAL_CAPACITY; in unorm_openIter()
593 uni->state=UITER_NO_STATE; in unorm_openIter()
594 uni->hasPrevious=uni->hasNext=FALSE; in unorm_openIter()
595 uni->mode=UNORM_NONE; in unorm_openIter()
598 uiter_setString(&uni->api, NULL, 0); in unorm_openIter()
599 return uni; in unorm_openIter()
603 unorm_closeIter(UNormIterator *uni) { in unorm_closeIter() argument
604 if(uni!=NULL) { in unorm_closeIter()
605 if(uni->states!=uni->statesBuffer) { in unorm_closeIter()
607 uprv_free(uni->states); in unorm_closeIter()
609 if(!uni->isStackAllocated) { in unorm_closeIter()
610 uprv_free(uni); in unorm_closeIter()
616 unorm_setIter(UNormIterator *uni, UCharIterator *iter, UNormalizationMode mode, UErrorCode *pErrorC… in unorm_setIter() argument
621 if(uni==NULL) { in unorm_setIter()
629 uiter_setString(&uni->api, NULL, 0); in unorm_setIter()
635 uprv_memcpy(&uni->api, &unormIterator, sizeof(unormIterator)); in unorm_setIter()
637 uni->iter=iter; in unorm_setIter()
638 uni->mode=mode; in unorm_setIter()
640 initIndexes(uni, iter); in unorm_setIter()
641 uni->states[uni->api.limit]=uni->state=uiter_getState(iter); in unorm_setIter()
643 return &uni->api; in unorm_setIter()