Lines Matching refs:uni
67 initIndexes(UNormIterator *uni, UCharIterator *iter) { in initIndexes() argument
69 UCharIterator *api=&uni->api; in initIndexes()
74 uni->hasPrevious=FALSE; in initIndexes()
75 uni->hasNext=iter->hasNext(iter); in initIndexes()
78 api->start=api->index=api->limit=uni->capacity; in initIndexes()
79 uni->hasNext=FALSE; in initIndexes()
80 uni->hasPrevious=iter->hasPrevious(iter); in initIndexes()
83 api->start=api->index=api->limit=uni->capacity/2; in initIndexes()
84 uni->hasPrevious=uni->hasNext=TRUE; in initIndexes()
89 reallocArrays(UNormIterator *uni, int32_t capacity, UBool addAtStart) { in reallocArrays() argument
91 UCharIterator *api=&uni->api; in reallocArrays()
103 uni->capacity=capacity; in reallocArrays()
112 delta=capacity-uni->capacity; in reallocArrays()
113 uprv_memcpy(states+delta+start, uni->states+start, (limit-start+1)*4); in reallocArrays()
114 uprv_memcpy(chars+delta+start, uni->chars+start, (limit-start)*4); in reallocArrays()
121 uprv_memcpy(states+start, uni->states+start, (limit-start+1)*4); in reallocArrays()
122 uprv_memcpy(chars+start, uni->chars+start, (limit-start)*4); in reallocArrays()
125 uni->chars=chars; in reallocArrays()
126 uni->states=states; in reallocArrays()
189 readNext(UNormIterator *uni, UCharIterator *iter) { in readNext() argument
191 UCharIterator *api=&uni->api; in readNext()
198 capacity=uni->capacity; in readNext()
202 moveContentsTowardStart(api, uni->chars, uni->states, room); in readNext()
204 uni->hasPrevious=TRUE; in readNext()
209 if(uni->state!=uni->states[limit]) { in readNext()
210 uiter_setState(iter, uni->states[limit], &errorCode); in readNext()
212 uni->state=UITER_NO_STATE; in readNext()
213 uni->hasNext=FALSE; in readNext()
218 room=unorm_next(iter, uni->chars+limit, capacity-limit, uni->mode, 0, TRUE, NULL, &errorCode); in readNext()
222 uni->states[0]=uni->states[limit]; in readNext()
224 uni->hasPrevious=TRUE; in readNext()
227 if(!reallocArrays(uni, capacity, FALSE)) { in readNext()
228 uni->state=UITER_NO_STATE; in readNext()
229 uni->hasNext=FALSE; in readNext()
236 uiter_setState(iter, uni->states[limit], &errorCode); in readNext()
237 … room=unorm_next(iter, uni->chars+limit, capacity-limit, uni->mode, 0, TRUE, NULL, &errorCode); in readNext()
240 uni->state=UITER_NO_STATE; in readNext()
241 uni->hasNext=FALSE; in readNext()
249 uni->states[limit++]=UITER_NO_STATE; in readNext()
251 uni->states[limit]=uni->state=uiter_getState(iter); in readNext()
252 uni->hasNext=iter->hasNext(iter); in readNext()
259 readPrevious(UNormIterator *uni, UCharIterator *iter) { in readPrevious() argument
261 UCharIterator *api=&uni->api; in readPrevious()
268 capacity=uni->capacity; in readPrevious()
272 moveContentsTowardEnd(api, uni->chars, uni->states, room); in readPrevious()
274 uni->hasNext=TRUE; in readPrevious()
279 if(uni->state!=uni->states[start]) { in readPrevious()
280 uiter_setState(iter, uni->states[start], &errorCode); in readPrevious()
282 uni->state=UITER_NO_STATE; in readPrevious()
283 uni->hasPrevious=FALSE; in readPrevious()
288 room=unorm_previous(iter, uni->chars, start, uni->mode, 0, TRUE, NULL, &errorCode); in readPrevious()
292 uni->states[capacity]=uni->states[start]; in readPrevious()
294 uni->hasNext=TRUE; in readPrevious()
297 if(!reallocArrays(uni, capacity, TRUE)) { in readPrevious()
298 uni->state=UITER_NO_STATE; in readPrevious()
299 uni->hasPrevious=FALSE; in readPrevious()
306 uiter_setState(iter, uni->states[start], &errorCode); in readPrevious()
307 room=unorm_previous(iter, uni->chars, start, uni->mode, 0, TRUE, NULL, &errorCode); in readPrevious()
310 uni->state=UITER_NO_STATE; in readPrevious()
311 uni->hasPrevious=FALSE; in readPrevious()
318 uni->chars[--start]=uni->chars[--room]; in readPrevious()
320 uni->states[start]=UITER_NO_STATE; in readPrevious()
322 uni->states[start]=uni->state=uiter_getState(iter); in readPrevious()
323 uni->hasPrevious=iter->hasPrevious(iter); in readPrevious()
349 UNormIterator *uni=(UNormIterator *)api; in unormIteratorMove() local
350 UCharIterator *iter=uni->iter; in unormIteratorMove()
357 if(uni->hasPrevious) { in unormIteratorMove()
360 uni->states[api->limit]=uni->state=uiter_getState(iter); in unormIteratorMove()
361 uni->hasPrevious=FALSE; in unormIteratorMove()
362 uni->hasNext=iter->hasNext(iter); in unormIteratorMove()
373 if(uni->hasNext) { in unormIteratorMove()
375 api->start=api->index=api->limit=uni->capacity; in unormIteratorMove()
376 uni->states[api->limit]=uni->state=uiter_getState(iter); in unormIteratorMove()
377 uni->hasPrevious=iter->hasPrevious(iter); in unormIteratorMove()
378 uni->hasNext=FALSE; in unormIteratorMove()
403 if(!uni->hasNext || !readNext(uni, iter)) { in unormIteratorMove()
419 if(!uni->hasPrevious || !readPrevious(uni, iter)) { in unormIteratorMove()
425 if(api->index==api->start && !uni->hasPrevious) { in unormIteratorMove()
444 UNormIterator *uni=(UNormIterator *)api; in unormIteratorCurrent() local
447 (uni->hasNext && readNext(uni, uni->iter)) in unormIteratorCurrent()
449 return uni->chars[api->index]; in unormIteratorCurrent()
457 UNormIterator *uni=(UNormIterator *)api; in unormIteratorNext() local
460 (uni->hasNext && readNext(uni, uni->iter)) in unormIteratorNext()
462 return uni->chars[api->index++]; in unormIteratorNext()
470 UNormIterator *uni=(UNormIterator *)api; in unormIteratorPrevious() local
473 (uni->hasPrevious && readPrevious(uni, uni->iter)) in unormIteratorPrevious()
475 return uni->chars[--api->index]; in unormIteratorPrevious()
496 UNormIterator *uni=(UNormIterator *)api; in unormIteratorSetState() local
498 if(state!=uni->state) { in unormIteratorSetState()
499 uni->state=state; in unormIteratorSetState()
509 if(state==uni->states[api->index]) { in unormIteratorSetState()
511 } else if(state==uni->states[api->limit]) { in unormIteratorSetState()
519 if(state==uni->states[i]) { in unormIteratorSetState()
528 uni->states[api->limit]=state; in unormIteratorSetState()
550 UNormIterator *uni; in unorm_openIter() local
558 uni=NULL; in unorm_openIter()
562 uni=(UNormIterator *)stackMem; in unorm_openIter()
567 uni=(UNormIterator *)((char *)stackMem+align); in unorm_openIter()
573 if(uni!=NULL) { in unorm_openIter()
574 uni->isStackAllocated=TRUE; in unorm_openIter()
576 uni=(UNormIterator *)uprv_malloc(sizeof(UNormIterator)); in unorm_openIter()
577 if(uni==NULL) { in unorm_openIter()
581 uni->isStackAllocated=FALSE; in unorm_openIter()
588 uni->iter=NULL; in unorm_openIter()
589 uni->chars=uni->charsBuffer; in unorm_openIter()
590 uni->states=uni->statesBuffer; in unorm_openIter()
591 uni->capacity=INITIAL_CAPACITY; in unorm_openIter()
592 uni->state=UITER_NO_STATE; in unorm_openIter()
593 uni->hasPrevious=uni->hasNext=FALSE; in unorm_openIter()
594 uni->mode=UNORM_NONE; in unorm_openIter()
597 uiter_setString(&uni->api, NULL, 0); in unorm_openIter()
598 return uni; in unorm_openIter()
602 unorm_closeIter(UNormIterator *uni) { in unorm_closeIter() argument
603 if(uni!=NULL) { in unorm_closeIter()
604 if(uni->states!=uni->statesBuffer) { in unorm_closeIter()
606 uprv_free(uni->states); in unorm_closeIter()
608 if(!uni->isStackAllocated) { in unorm_closeIter()
609 uprv_free(uni); in unorm_closeIter()
615 unorm_setIter(UNormIterator *uni, UCharIterator *iter, UNormalizationMode mode, UErrorCode *pErrorC… in unorm_setIter() argument
620 if(uni==NULL) { in unorm_setIter()
628 uiter_setString(&uni->api, NULL, 0); in unorm_setIter()
634 uprv_memcpy(&uni->api, &unormIterator, sizeof(unormIterator)); in unorm_setIter()
636 uni->iter=iter; in unorm_setIter()
637 uni->mode=mode; in unorm_setIter()
639 initIndexes(uni, iter); in unorm_setIter()
640 uni->states[uni->api.limit]=uni->state=uiter_getState(iter); in unorm_setIter()
642 return &uni->api; in unorm_setIter()