Lines Matching refs:pBiDi
94 setTrailingWSStart(UBiDi *pBiDi) { in setTrailingWSStart() argument
97 const DirProp *dirProps=pBiDi->dirProps; in setTrailingWSStart()
98 UBiDiLevel *levels=pBiDi->levels; in setTrailingWSStart()
99 int32_t start=pBiDi->length; in setTrailingWSStart()
100 UBiDiLevel paraLevel=pBiDi->paraLevel; in setTrailingWSStart()
109 pBiDi->trailingWSStart=start; /* currently == pBiDi->length */ in setTrailingWSStart()
122 pBiDi->trailingWSStart=start; in setTrailingWSStart()
253 ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex) { in ubidi_getLevelAt() argument
255 if(!IS_VALID_PARA_OR_LINE(pBiDi) || charIndex<0 || pBiDi->length<=charIndex) { in ubidi_getLevelAt()
257 } else if(pBiDi->direction!=UBIDI_MIXED || charIndex>=pBiDi->trailingWSStart) { in ubidi_getLevelAt()
258 return GET_PARALEVEL(pBiDi, charIndex); in ubidi_getLevelAt()
260 return pBiDi->levels[charIndex]; in ubidi_getLevelAt()
265 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) { in ubidi_getLevels() argument
269 RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, NULL); in ubidi_getLevels()
270 if((length=pBiDi->length)<=0) { in ubidi_getLevels()
274 if((start=pBiDi->trailingWSStart)==length) { in ubidi_getLevels()
276 return pBiDi->levels; in ubidi_getLevels()
286 if(getLevelsMemory(pBiDi, length)) { in ubidi_getLevels()
287 UBiDiLevel *levels=pBiDi->levelsMemory; in ubidi_getLevels()
289 if(start>0 && levels!=pBiDi->levels) { in ubidi_getLevels()
290 uprv_memcpy(levels, pBiDi->levels, start); in ubidi_getLevels()
294 uprv_memset(levels+start, pBiDi->paraLevel, length-start); in ubidi_getLevels()
297 pBiDi->trailingWSStart=length; in ubidi_getLevels()
298 return pBiDi->levels=levels; in ubidi_getLevels()
307 ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition, in ubidi_getLogicalRun() argument
314 RETURN_VOID_IF_BAD_RANGE(logicalPosition, 0, pBiDi->length, errorCode); in ubidi_getLogicalRun()
316 runCount=ubidi_countRuns((UBiDi *)pBiDi, &errorCode); in ubidi_getLogicalRun()
324 iRun=pBiDi->runs[0]; in ubidi_getLogicalRun()
327 iRun = pBiDi->runs[i]; in ubidi_getLogicalRun()
340 if(pBiDi->reorderingMode==UBIDI_REORDER_RUNS_ONLY) { in ubidi_getLogicalRun()
343 else if(pBiDi->direction!=UBIDI_MIXED || logicalPosition>=pBiDi->trailingWSStart) { in ubidi_getLogicalRun()
344 *pLevel=GET_PARALEVEL(pBiDi, logicalPosition); in ubidi_getLogicalRun()
346 *pLevel=pBiDi->levels[logicalPosition]; in ubidi_getLogicalRun()
354 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode) { in ubidi_countRuns() argument
356 RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1); in ubidi_countRuns()
357 ubidi_getRuns(pBiDi, pErrorCode); in ubidi_countRuns()
361 return pBiDi->runCount; in ubidi_countRuns()
365 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex, in ubidi_getVisualRun() argument
370 RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, errorCode, UBIDI_LTR); in ubidi_getVisualRun()
371 ubidi_getRuns(pBiDi, &errorCode); in ubidi_getVisualRun()
375 RETURN_IF_BAD_RANGE(runIndex, 0, pBiDi->runCount, errorCode, UBIDI_LTR); in ubidi_getVisualRun()
377 start=pBiDi->runs[runIndex].logicalStart; in ubidi_getVisualRun()
383 *pLength=pBiDi->runs[runIndex].visualLimit- in ubidi_getVisualRun()
384 pBiDi->runs[runIndex-1].visualLimit; in ubidi_getVisualRun()
386 *pLength=pBiDi->runs[0].visualLimit; in ubidi_getVisualRun()
394 getSingleRun(UBiDi *pBiDi, UBiDiLevel level) { in getSingleRun() argument
396 pBiDi->runs=pBiDi->simpleRuns; in getSingleRun()
397 pBiDi->runCount=1; in getSingleRun()
400 pBiDi->runs[0].logicalStart=MAKE_INDEX_ODD_PAIR(0, level); in getSingleRun()
401 pBiDi->runs[0].visualLimit=pBiDi->length; in getSingleRun()
402 pBiDi->runs[0].insertRemove=0; in getSingleRun()
439 reorderLine(UBiDi *pBiDi, UBiDiLevel minLevel, UBiDiLevel maxLevel) { in reorderLine() argument
456 runs=pBiDi->runs; in reorderLine()
457 levels=pBiDi->levels; in reorderLine()
458 runCount=pBiDi->runCount; in reorderLine()
461 if(pBiDi->trailingWSStart<pBiDi->length) { in reorderLine()
505 if(pBiDi->trailingWSStart==pBiDi->length) { in reorderLine()
522 static int32_t getRunFromLogicalIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode) { in getRunFromLogicalIndex() argument
523 Run *runs=pBiDi->runs; in getRunFromLogicalIndex()
524 int32_t runCount=pBiDi->runCount, visualStart=0, i, length, logicalStart; in getRunFromLogicalIndex()
552 ubidi_getRuns(UBiDi *pBiDi, UErrorCode *pErrorCode) { in ubidi_getRuns() argument
557 if (pBiDi->runCount>=0) { in ubidi_getRuns()
561 if(pBiDi->direction!=UBIDI_MIXED) { in ubidi_getRuns()
564 getSingleRun(pBiDi, pBiDi->paraLevel); in ubidi_getRuns()
567 int32_t length=pBiDi->length, limit; in ubidi_getRuns()
568 UBiDiLevel *levels=pBiDi->levels; in ubidi_getRuns()
582 limit=pBiDi->trailingWSStart; in ubidi_getRuns()
599 getSingleRun(pBiDi, levels[0]); in ubidi_getRuns()
612 if(getRunsMemory(pBiDi, runCount)) { in ubidi_getRuns()
613 runs=pBiDi->runsMemory; in ubidi_getRuns()
655 if(pBiDi->paraLevel<minLevel) { in ubidi_getRuns()
656 minLevel=pBiDi->paraLevel; in ubidi_getRuns()
661 pBiDi->runs=runs; in ubidi_getRuns()
662 pBiDi->runCount=runCount; in ubidi_getRuns()
664 reorderLine(pBiDi, minLevel, maxLevel); in ubidi_getRuns()
680 int32_t trailingRun = ((pBiDi->paraLevel & 1) != 0)? 0 : runIndex; in ubidi_getRuns()
682 ADD_ODD_BIT_FROM_LEVEL(runs[trailingRun].logicalStart, pBiDi->paraLevel); in ubidi_getRuns()
688 if(pBiDi->insertPoints.size>0) { in ubidi_getRuns()
689 Point *point, *start=pBiDi->insertPoints.points, in ubidi_getRuns()
690 *limit=start+pBiDi->insertPoints.size; in ubidi_getRuns()
693 runIndex=getRunFromLogicalIndex(pBiDi, point->pos, pErrorCode); in ubidi_getRuns()
694 pBiDi->runs[runIndex].insertRemove|=point->flag; in ubidi_getRuns()
699 if(pBiDi->controlCount>0) { in ubidi_getRuns()
701 const UChar *start=pBiDi->text, *limit=start+pBiDi->length, *pu; in ubidi_getRuns()
704 runIndex=getRunFromLogicalIndex(pBiDi, (int32_t)(pu-start), pErrorCode); in ubidi_getRuns()
705 pBiDi->runs[runIndex].insertRemove--; in ubidi_getRuns()
879 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode) { in ubidi_getVisualIndex() argument
882 RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1); in ubidi_getVisualIndex()
883 RETURN_IF_BAD_RANGE(logicalIndex, 0, pBiDi->length, *pErrorCode, -1); in ubidi_getVisualIndex()
886 switch(pBiDi->direction) { in ubidi_getVisualIndex()
891 visualIndex=pBiDi->length-logicalIndex-1; in ubidi_getVisualIndex()
894 if(!ubidi_getRuns(pBiDi, pErrorCode)) { in ubidi_getVisualIndex()
898 Run *runs=pBiDi->runs; in ubidi_getVisualIndex()
902 for(i=0; i<pBiDi->runCount; ++i) { in ubidi_getVisualIndex()
917 if(i>=pBiDi->runCount) { in ubidi_getVisualIndex()
923 if(pBiDi->insertPoints.size>0) { in ubidi_getVisualIndex()
925 Run *runs=pBiDi->runs; in ubidi_getVisualIndex()
943 else if(pBiDi->controlCount>0) { in ubidi_getVisualIndex()
945 Run *runs=pBiDi->runs; in ubidi_getVisualIndex()
948 UChar uchar=pBiDi->text[logicalIndex]; in ubidi_getVisualIndex()
976 uchar=pBiDi->text[j]; in ubidi_getVisualIndex()
989 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode) { in ubidi_getLogicalIndex() argument
993 RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1); in ubidi_getLogicalIndex()
994 RETURN_IF_BAD_RANGE(visualIndex, 0, pBiDi->resultLength, *pErrorCode, -1); in ubidi_getLogicalIndex()
996 if(pBiDi->insertPoints.size==0 && pBiDi->controlCount==0) { in ubidi_getLogicalIndex()
997 if(pBiDi->direction==UBIDI_LTR) { in ubidi_getLogicalIndex()
1000 else if(pBiDi->direction==UBIDI_RTL) { in ubidi_getLogicalIndex()
1001 return pBiDi->length-visualIndex-1; in ubidi_getLogicalIndex()
1004 if(!ubidi_getRuns(pBiDi, pErrorCode)) { in ubidi_getLogicalIndex()
1009 runs=pBiDi->runs; in ubidi_getLogicalIndex()
1010 runCount=pBiDi->runCount; in ubidi_getLogicalIndex()
1011 if(pBiDi->insertPoints.size>0) { in ubidi_getLogicalIndex()
1015 runs=pBiDi->runs; in ubidi_getLogicalIndex()
1039 else if(pBiDi->controlCount>0) { in ubidi_getLogicalIndex()
1066 uchar=pBiDi->text[k]; in ubidi_getLogicalIndex()
1114 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) { in ubidi_getLogicalMap() argument
1117 ubidi_countRuns(pBiDi, pErrorCode); in ubidi_getLogicalMap()
1126 Run *runs=pBiDi->runs; in ubidi_getLogicalMap()
1127 if (pBiDi->length<=0) { in ubidi_getLogicalMap()
1130 if (pBiDi->length>pBiDi->resultLength) { in ubidi_getLogicalMap()
1131 uprv_memset(indexMap, 0xFF, pBiDi->length*sizeof(int32_t)); in ubidi_getLogicalMap()
1135 for(j=0; j<pBiDi->runCount; ++j) { in ubidi_getLogicalMap()
1151 if(pBiDi->insertPoints.size>0) { in ubidi_getLogicalMap()
1152 int32_t markFound=0, runCount=pBiDi->runCount; in ubidi_getLogicalMap()
1174 else if(pBiDi->controlCount>0) { in ubidi_getLogicalMap()
1175 int32_t controlFound=0, runCount=pBiDi->runCount; in ubidi_getLogicalMap()
1201 uchar=pBiDi->text[k]; in ubidi_getLogicalMap()
1215 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) { in ubidi_getVisualMap() argument
1222 ubidi_countRuns(pBiDi, pErrorCode); in ubidi_getVisualMap()
1225 Run *runs=pBiDi->runs, *runsLimit=runs+pBiDi->runCount; in ubidi_getVisualMap()
1228 if (pBiDi->resultLength<=0) { in ubidi_getVisualMap()
1249 if(pBiDi->insertPoints.size>0) { in ubidi_getVisualMap()
1250 int32_t markFound=0, runCount=pBiDi->runCount; in ubidi_getVisualMap()
1252 runs=pBiDi->runs; in ubidi_getVisualMap()
1264 k=pBiDi->resultLength; in ubidi_getVisualMap()
1281 else if(pBiDi->controlCount>0) { in ubidi_getVisualMap()
1282 int32_t runCount=pBiDi->runCount, logicalEnd; in ubidi_getVisualMap()
1286 runs=pBiDi->runs; in ubidi_getVisualMap()
1312 uchar=pBiDi->text[m]; in ubidi_getVisualMap()