Lines Matching full:runs
46 * The implementation of the access to same-level-runs and of the reordering
52 * same-level-runs is created. Reordering then is done on this vector.
57 * This is inefficient if there are many very short runs. If the average run
153 pLineBiDi->runs=NULL; in ubidi_setLine()
316 /* this is done based on runs rather than on levels since levels have in ubidi_getLogicalRun()
320 iRun=pBiDi->runs[0]; in ubidi_getLogicalRun()
323 iRun = pBiDi->runs[i]; in ubidi_getLogicalRun()
347 /* runs API functions ------------------------------------------------------- */
373 start=pBiDi->runs[runIndex].logicalStart; in ubidi_getVisualRun()
379 *pLength=pBiDi->runs[runIndex].visualLimit- in ubidi_getVisualRun()
380 pBiDi->runs[runIndex-1].visualLimit; in ubidi_getVisualRun()
382 *pLength=pBiDi->runs[0].visualLimit; in ubidi_getVisualRun()
392 pBiDi->runs=pBiDi->simpleRuns; in getSingleRun()
396 pBiDi->runs[0].logicalStart=MAKE_INDEX_ODD_PAIR(0, level); in getSingleRun()
397 pBiDi->runs[0].visualLimit=pBiDi->length; in getSingleRun()
398 pBiDi->runs[0].insertRemove=0; in getSingleRun()
401 /* reorder the runs array (L2) ---------------------------------------------- */
404 * Reorder the same-level runs in the runs array.
412 * each sequence of same-level runs consists of only one run each, we
418 * in the last reordering the sequence of the runs at this level or higher
419 * will be all runs, and we don't need the elaborate loop to search for them.
431 * this run and can --runCount. If it is later part of the all-runs
436 Run *runs, tempRun; in reorderLine() local
452 runs=pBiDi->runs; in reorderLine()
464 /* loop for all sequences of runs */ in reorderLine()
466 /* look for a sequence of runs that are all at >=maxLevel */ in reorderLine()
468 while(firstRun<runCount && levels[runs[firstRun].logicalStart]<maxLevel) { in reorderLine()
472 break; /* no more such runs */ in reorderLine()
476 … for(limitRun=firstRun; ++limitRun<runCount && levels[runs[limitRun].logicalStart]>=maxLevel;) {} in reorderLine()
478 /* Swap the entire sequence of runs from firstRun to limitRun-1. */ in reorderLine()
481 tempRun = runs[firstRun]; in reorderLine()
482 runs[firstRun]=runs[endRun]; in reorderLine()
483 runs[endRun]=tempRun; in reorderLine()
489 break; /* no more such runs */ in reorderLine()
505 /* Swap the entire sequence of all runs. (endRun==runCount) */ in reorderLine()
507 tempRun=runs[firstRun]; in reorderLine()
508 runs[firstRun]=runs[runCount]; in reorderLine()
509 runs[runCount]=tempRun; in reorderLine()
516 /* compute the runs array --------------------------------------------------- */
519 Run *runs=pBiDi->runs; in getRunFromLogicalIndex() local
523 length=runs[i].visualLimit-visualStart; in getRunFromLogicalIndex()
524 logicalStart=GET_INDEX(runs[i].logicalStart); in getRunFromLogicalIndex()
537 * Compute the runs array from the levels array.
539 * and the runs are reordered.
540 * Odd-level runs have visualStart on their visual right edge and
550 * This method returns immediately if the runs are already set. This in ubidi_getRuns()
579 /* count the runs, there is at least one non-WS run, and limit>0 */ in ubidi_getRuns()
597 /* allocate and set the runs */ in ubidi_getRuns()
598 Run *runs; in ubidi_getRuns() local
609 runs=pBiDi->runsMemory; in ubidi_getRuns()
614 /* set the runs */ in ubidi_getRuns()
639 runs[runIndex].logicalStart=start; in ubidi_getRuns()
640 runs[runIndex].visualLimit=i-start; in ubidi_getRuns()
641 runs[runIndex].insertRemove=0; in ubidi_getRuns()
647 runs[runIndex].logicalStart=limit; in ubidi_getRuns()
648 runs[runIndex].visualLimit=length-limit; in ubidi_getRuns()
657 pBiDi->runs=runs; in ubidi_getRuns()
666 ADD_ODD_BIT_FROM_LEVEL(runs[i].logicalStart, levels[runs[i].logicalStart]); in ubidi_getRuns()
667 limit+=runs[i].visualLimit; in ubidi_getRuns()
668 runs[i].visualLimit=limit; in ubidi_getRuns()
678 ADD_ODD_BIT_FROM_LEVEL(runs[trailingRun].logicalStart, pBiDi->paraLevel); in ubidi_getRuns()
690 pBiDi->runs[runIndex].insertRemove|=point->flag; in ubidi_getRuns()
701 pBiDi->runs[runIndex].insertRemove--; in ubidi_getRuns()
841 break; /* no more such runs */ in ubidi_reorderVisual()
881 /* we can do the trivial cases without the runs array */ in ubidi_getVisualIndex()
894 Run *runs=pBiDi->runs; in ubidi_getVisualIndex() local
897 /* linear search for the run, search on the visual runs */ in ubidi_getVisualIndex()
899 length=runs[i].visualLimit-visualStart; in ubidi_getVisualIndex()
900 offset=logicalIndex-GET_INDEX(runs[i].logicalStart); in ubidi_getVisualIndex()
902 if(IS_EVEN_RUN(runs[i].logicalStart)) { in ubidi_getVisualIndex()
921 Run *runs=pBiDi->runs; in ubidi_getVisualIndex() local
925 length=runs[i].visualLimit-visualStart; in ubidi_getVisualIndex()
926 insertRemove=runs[i].insertRemove; in ubidi_getVisualIndex()
931 if(visualIndex<runs[i].visualLimit) { in ubidi_getVisualIndex()
941 Run *runs=pBiDi->runs; in ubidi_getVisualIndex() local
949 /* loop on runs */ in ubidi_getVisualIndex()
951 length=runs[i].visualLimit-visualStart; in ubidi_getVisualIndex()
952 insertRemove=runs[i].insertRemove; in ubidi_getVisualIndex()
954 if(visualIndex>=runs[i].visualLimit) { in ubidi_getVisualIndex()
962 if(IS_EVEN_RUN(runs[i].logicalStart)) { in ubidi_getVisualIndex()
964 start=runs[i].logicalStart; in ubidi_getVisualIndex()
969 limit=GET_INDEX(runs[i].logicalStart)+length; in ubidi_getVisualIndex()
986 Run *runs; in ubidi_getLogicalIndex() local
991 /* we can do the trivial cases without the runs array */ in ubidi_getLogicalIndex()
1005 runs=pBiDi->runs; in ubidi_getLogicalIndex()
1011 runs=pBiDi->runs; in ubidi_getLogicalIndex()
1014 length=runs[i].visualLimit-visualStart; in ubidi_getLogicalIndex()
1015 insertRemove=runs[i].insertRemove; in ubidi_getLogicalIndex()
1023 if(visualIndex<(runs[i].visualLimit+markFound)) { in ubidi_getLogicalIndex()
1043 length=runs[i].visualLimit-visualStart; in ubidi_getLogicalIndex()
1044 insertRemove=runs[i].insertRemove; in ubidi_getLogicalIndex()
1046 if(visualIndex>=(runs[i].visualLimit-controlFound+insertRemove)) { in ubidi_getLogicalIndex()
1056 logicalStart=runs[i].logicalStart; in ubidi_getLogicalIndex()
1077 for(i=0; visualIndex>=runs[i].visualLimit; ++i) {} in ubidi_getLogicalIndex()
1085 if(visualIndex>=runs[i].visualLimit) { in ubidi_getLogicalIndex()
1087 } else if(i==0 || visualIndex>=runs[i-1].visualLimit) { in ubidi_getLogicalIndex()
1095 start=runs[i].logicalStart; in ubidi_getLogicalIndex()
1098 /* the offset in runs[i] is visualIndex-runs[i-1].visualLimit */ in ubidi_getLogicalIndex()
1100 visualIndex-=runs[i-1].visualLimit; in ubidi_getLogicalIndex()
1105 return GET_INDEX(start)+runs[i].visualLimit-visualIndex-1; in ubidi_getLogicalIndex()
1119 /* fill a logical-to-visual index map using the runs[] */ in ubidi_getLogicalMap()
1122 Run *runs=pBiDi->runs; in ubidi_getLogicalMap() local
1132 logicalStart=GET_INDEX(runs[j].logicalStart); in ubidi_getLogicalMap()
1133 visualLimit=runs[j].visualLimit; in ubidi_getLogicalMap()
1134 if(IS_EVEN_RUN(runs[j].logicalStart)) { in ubidi_getLogicalMap()
1153 length=runs[i].visualLimit-visualStart; in ubidi_getLogicalMap()
1154 insertRemove=runs[i].insertRemove; in ubidi_getLogicalMap()
1159 logicalStart=GET_INDEX(runs[i].logicalStart); in ubidi_getLogicalMap()
1178 length=runs[i].visualLimit-visualStart; in ubidi_getLogicalMap()
1179 insertRemove=runs[i].insertRemove; in ubidi_getLogicalMap()
1180 /* no control found within previous runs nor within this run */ in ubidi_getLogicalMap()
1184 logicalStart=runs[i].logicalStart; in ubidi_getLogicalMap()
1220 /* fill a visual-to-logical index map using the runs[] */ in ubidi_getVisualMap()
1221 Run *runs=pBiDi->runs, *runsLimit=runs+pBiDi->runCount; in ubidi_getVisualMap() local
1228 for(; runs<runsLimit; ++runs) { in ubidi_getVisualMap()
1229 logicalStart=runs->logicalStart; in ubidi_getVisualMap()
1230 visualLimit=runs->visualLimit; in ubidi_getVisualMap()
1248 runs=pBiDi->runs; in ubidi_getVisualMap()
1251 insertRemove=runs[i].insertRemove; in ubidi_getVisualMap()
1262 insertRemove=runs[i].insertRemove; in ubidi_getVisualMap()
1267 visualStart= i>0 ? runs[i-1].visualLimit : 0; in ubidi_getVisualMap()
1268 for(j=runs[i].visualLimit-1; j>=visualStart && markFound>0; j--) { in ubidi_getVisualMap()
1282 runs=pBiDi->runs; in ubidi_getVisualMap()
1287 length=runs[i].visualLimit-visualStart; in ubidi_getVisualMap()
1288 insertRemove=runs[i].insertRemove; in ubidi_getVisualMap()
1296 visualLimit=runs[i].visualLimit; in ubidi_getVisualMap()
1302 logicalStart=runs[i].logicalStart; in ubidi_getVisualMap()