Lines Matching refs:iter

110 lenient8IteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) {  in lenient8IteratorGetIndex()  argument
116 if(iter->index<0) { in lenient8IteratorGetIndex()
122 s=(const uint8_t *)iter->context; in lenient8IteratorGetIndex()
124 limit=iter->start; /* count up to the UTF-8 index */ in lenient8IteratorGetIndex()
134 iter->start=i; /* just in case setState() did not get us to a code point boundary */ in lenient8IteratorGetIndex()
135 if(i==iter->limit) { in lenient8IteratorGetIndex()
136 iter->length=index; /* in case it was <0 or wrong */ in lenient8IteratorGetIndex()
138 if(iter->reservedField!=0) { in lenient8IteratorGetIndex()
141 iter->index=index; in lenient8IteratorGetIndex()
143 return iter->index; in lenient8IteratorGetIndex()
146 if(iter->length<0) { in lenient8IteratorGetIndex()
151 s=(const uint8_t *)iter->context; in lenient8IteratorGetIndex()
152 if(iter->index<0) { in lenient8IteratorGetIndex()
158 limit=iter->start; in lenient8IteratorGetIndex()
171 iter->start=i; /* just in case setState() did not get us to a code point boundary */ in lenient8IteratorGetIndex()
172 iter->index= iter->reservedField!=0 ? length-1 : length; in lenient8IteratorGetIndex()
174 i=iter->start; in lenient8IteratorGetIndex()
175 length=iter->index; in lenient8IteratorGetIndex()
176 if(iter->reservedField!=0) { in lenient8IteratorGetIndex()
182 limit=iter->limit; in lenient8IteratorGetIndex()
191 iter->length=length; in lenient8IteratorGetIndex()
193 return iter->length; in lenient8IteratorGetIndex()
202 lenient8IteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) { in lenient8IteratorMove() argument
218 if(iter->index>=0) { in lenient8IteratorMove()
219 pos=iter->index+delta; in lenient8IteratorMove()
229 if(iter->length>=0) { in lenient8IteratorMove()
230 pos=iter->length+delta; in lenient8IteratorMove()
234 iter->index=-1; in lenient8IteratorMove()
235 iter->start=iter->limit; in lenient8IteratorMove()
236 iter->reservedField=0; in lenient8IteratorMove()
253 iter->index=iter->start=iter->reservedField=0; in lenient8IteratorMove()
255 } else if(iter->length>=0 && pos>=iter->length) { in lenient8IteratorMove()
256 iter->index=iter->length; in lenient8IteratorMove()
257 iter->start=iter->limit; in lenient8IteratorMove()
258 iter->reservedField=0; in lenient8IteratorMove()
259 return iter->index; in lenient8IteratorMove()
263 if(iter->index<0 || pos<iter->index/2) { in lenient8IteratorMove()
265 iter->index=iter->start=iter->reservedField=0; in lenient8IteratorMove()
266 } else if(iter->length>=0 && (iter->length-pos)<(pos-iter->index)) { in lenient8IteratorMove()
272 iter->index=iter->length; in lenient8IteratorMove()
273 iter->start=iter->limit; in lenient8IteratorMove()
274 iter->reservedField=0; in lenient8IteratorMove()
277 delta=pos-iter->index; in lenient8IteratorMove()
279 return iter->index; /* nothing to do */ in lenient8IteratorMove()
285 } else if(-delta>=iter->start) { in lenient8IteratorMove()
287 iter->index=iter->start=iter->reservedField=0; in lenient8IteratorMove()
289 } else if(delta>=(iter->limit-iter->start)) { in lenient8IteratorMove()
291 iter->index=iter->length; /* may or may not be <0 (unknown) */ in lenient8IteratorMove()
292 iter->start=iter->limit; in lenient8IteratorMove()
293 iter->reservedField=0; in lenient8IteratorMove()
294 return iter->index>=0 ? iter->index : UITER_UNKNOWN_INDEX; in lenient8IteratorMove()
301 s=(const uint8_t *)iter->context; in lenient8IteratorMove()
302 pos=iter->index; /* could be <0 (unknown) */ in lenient8IteratorMove()
303 i=iter->start; in lenient8IteratorMove()
306 int32_t limit=iter->limit; in lenient8IteratorMove()
307 if(iter->reservedField!=0) { in lenient8IteratorMove()
308 iter->reservedField=0; in lenient8IteratorMove()
322 iter->reservedField=c; in lenient8IteratorMove()
328 if(iter->length<0 && iter->index>=0) { in lenient8IteratorMove()
329 iter->length= iter->reservedField==0 ? pos : pos+1; in lenient8IteratorMove()
330 } else if(iter->index<0 && iter->length>=0) { in lenient8IteratorMove()
331 iter->index= iter->reservedField==0 ? iter->length : iter->length-1; in lenient8IteratorMove()
336 if(iter->reservedField!=0) { in lenient8IteratorMove()
337 iter->reservedField=0; in lenient8IteratorMove()
353 iter->reservedField=c; in lenient8IteratorMove()
360 iter->start=i; in lenient8IteratorMove()
361 if(iter->index>=0) { in lenient8IteratorMove()
362 return iter->index=pos; in lenient8IteratorMove()
366 return iter->index=i; /* reached the beginning */ in lenient8IteratorMove()
375 lenient8IteratorHasNext(UCharIterator *iter) { in lenient8IteratorHasNext() argument
376 return iter->reservedField!=0 || iter->start<iter->limit; in lenient8IteratorHasNext()
380 lenient8IteratorHasPrevious(UCharIterator *iter) { in lenient8IteratorHasPrevious() argument
381 return iter->start>0; in lenient8IteratorHasPrevious()
385 lenient8IteratorCurrent(UCharIterator *iter) { in lenient8IteratorCurrent() argument
386 if(iter->reservedField!=0) { in lenient8IteratorCurrent()
387 return U16_TRAIL(iter->reservedField); in lenient8IteratorCurrent()
388 } else if(iter->start<iter->limit) { in lenient8IteratorCurrent()
389 const uint8_t *s=(const uint8_t *)iter->context; in lenient8IteratorCurrent()
391 int32_t i=iter->start; in lenient8IteratorCurrent()
393 L8_NEXT(s, i, iter->limit, c); in lenient8IteratorCurrent()
407 lenient8IteratorNext(UCharIterator *iter) { in lenient8IteratorNext() argument
410 if(iter->reservedField!=0) { in lenient8IteratorNext()
411 UChar trail=U16_TRAIL(iter->reservedField); in lenient8IteratorNext()
412 iter->reservedField=0; in lenient8IteratorNext()
413 if((index=iter->index)>=0) { in lenient8IteratorNext()
414 iter->index=index+1; in lenient8IteratorNext()
417 } else if(iter->start<iter->limit) { in lenient8IteratorNext()
418 const uint8_t *s=(const uint8_t *)iter->context; in lenient8IteratorNext()
421 L8_NEXT(s, iter->start, iter->limit, c); in lenient8IteratorNext()
422 if((index=iter->index)>=0) { in lenient8IteratorNext()
423 iter->index=++index; in lenient8IteratorNext()
424 if(iter->length<0 && iter->start==iter->limit) { in lenient8IteratorNext()
425 iter->length= c<=0xffff ? index : index+1; in lenient8IteratorNext()
427 } else if(iter->start==iter->limit && iter->length>=0) { in lenient8IteratorNext()
428 iter->index= c<=0xffff ? iter->length : iter->length-1; in lenient8IteratorNext()
435 iter->reservedField=c; in lenient8IteratorNext()
444 lenient8IteratorPrevious(UCharIterator *iter) { in lenient8IteratorPrevious() argument
447 if(iter->reservedField!=0) { in lenient8IteratorPrevious()
448 UChar lead=U16_LEAD(iter->reservedField); in lenient8IteratorPrevious()
449 iter->reservedField=0; in lenient8IteratorPrevious()
450 iter->start-=4; /* we stayed behind the supplementary code point; go before it now */ in lenient8IteratorPrevious()
451 if((index=iter->index)>0) { in lenient8IteratorPrevious()
452 iter->index=index-1; in lenient8IteratorPrevious()
455 } else if(iter->start>0) { in lenient8IteratorPrevious()
456 const uint8_t *s=(const uint8_t *)iter->context; in lenient8IteratorPrevious()
459 L8_PREV(s, 0, iter->start, c); in lenient8IteratorPrevious()
460 if((index=iter->index)>0) { in lenient8IteratorPrevious()
461 iter->index=index-1; in lenient8IteratorPrevious()
462 } else if(iter->start<=1) { in lenient8IteratorPrevious()
463 iter->index= c<=0xffff ? iter->start : iter->start+1; in lenient8IteratorPrevious()
470 iter->start+=4; /* back to behind this supplementary code point for consistent state */ in lenient8IteratorPrevious()
471 iter->reservedField=c; in lenient8IteratorPrevious()
480 lenient8IteratorGetState(const UCharIterator *iter) { in lenient8IteratorGetState() argument
481 uint32_t state=(uint32_t)(iter->start<<1); in lenient8IteratorGetState()
482 if(iter->reservedField!=0) { in lenient8IteratorGetState()
489 lenient8IteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { in lenient8IteratorSetState() argument
492 } else if(iter==NULL) { in lenient8IteratorSetState()
494 } else if(state==lenient8IteratorGetState(iter)) { in lenient8IteratorSetState()
500 if((state==0 ? index<0 : index<4) || iter->limit<index) { in lenient8IteratorSetState()
503 iter->start=index; /* restore UTF-8 byte index */ in lenient8IteratorSetState()
505 iter->index=index; in lenient8IteratorSetState()
507 iter->index=-1; /* unknown UTF-16 index */ in lenient8IteratorSetState()
510 iter->reservedField=0; in lenient8IteratorSetState()
514 L8_PREV((const uint8_t *)iter->context, 0, index, c); in lenient8IteratorSetState()
518 iter->reservedField=c; in lenient8IteratorSetState()
540 uiter_setLenient8(UCharIterator *iter, const char *s, int32_t length) { in uiter_setLenient8() argument
541 if(iter!=0) { in uiter_setLenient8()
543 *iter=lenient8Iterator; in uiter_setLenient8()
544 iter->context=s; in uiter_setLenient8()
546 iter->limit=length; in uiter_setLenient8()
548 iter->limit=strlen(s); in uiter_setLenient8()
550 iter->length= iter->limit<=1 ? iter->limit : -1; in uiter_setLenient8()
553 uiter_setString(iter, NULL, 0); in uiter_setLenient8()