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