Lines Matching refs:pBiDi
135 UBiDi *pBiDi; in ubidi_openSized() local
146 pBiDi=(UBiDi *)uprv_malloc(sizeof(UBiDi)); in ubidi_openSized()
147 if(pBiDi==NULL) { in ubidi_openSized()
153 uprv_memset(pBiDi, 0, sizeof(UBiDi)); in ubidi_openSized()
157 if( !getInitialDirPropsMemory(pBiDi, maxLength) || in ubidi_openSized()
158 !getInitialLevelsMemory(pBiDi, maxLength) in ubidi_openSized()
163 pBiDi->mayAllocateText=TRUE; in ubidi_openSized()
169 pBiDi->runsSize=sizeof(Run); in ubidi_openSized()
170 } else if(!getInitialRunsMemory(pBiDi, maxRunCount)) { in ubidi_openSized()
174 pBiDi->mayAllocateRuns=TRUE; in ubidi_openSized()
178 return pBiDi; in ubidi_openSized()
180 ubidi_close(pBiDi); in ubidi_openSized()
238 ubidi_close(UBiDi *pBiDi) { in ubidi_close() argument
239 if(pBiDi!=NULL) { in ubidi_close()
240 pBiDi->pParaBiDi=NULL; /* in case one tries to reuse this block */ in ubidi_close()
241 if(pBiDi->dirPropsMemory!=NULL) { in ubidi_close()
242 uprv_free(pBiDi->dirPropsMemory); in ubidi_close()
244 if(pBiDi->levelsMemory!=NULL) { in ubidi_close()
245 uprv_free(pBiDi->levelsMemory); in ubidi_close()
247 if(pBiDi->openingsMemory!=NULL) { in ubidi_close()
248 uprv_free(pBiDi->openingsMemory); in ubidi_close()
250 if(pBiDi->parasMemory!=NULL) { in ubidi_close()
251 uprv_free(pBiDi->parasMemory); in ubidi_close()
253 if(pBiDi->runsMemory!=NULL) { in ubidi_close()
254 uprv_free(pBiDi->runsMemory); in ubidi_close()
256 if(pBiDi->isolatesMemory!=NULL) { in ubidi_close()
257 uprv_free(pBiDi->isolatesMemory); in ubidi_close()
259 if(pBiDi->insertPoints.points!=NULL) { in ubidi_close()
260 uprv_free(pBiDi->insertPoints.points); in ubidi_close()
263 uprv_free(pBiDi); in ubidi_close()
270 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse) { in ubidi_setInverse() argument
271 if(pBiDi!=NULL) { in ubidi_setInverse()
272 pBiDi->isInverse=isInverse; in ubidi_setInverse()
273 pBiDi->reorderingMode = isInverse ? UBIDI_REORDER_INVERSE_NUMBERS_AS_L in ubidi_setInverse()
279 ubidi_isInverse(UBiDi *pBiDi) { in ubidi_isInverse() argument
280 if(pBiDi!=NULL) { in ubidi_isInverse()
281 return pBiDi->isInverse; in ubidi_isInverse()
303 ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode) { in ubidi_setReorderingMode() argument
304 if ((pBiDi!=NULL) && (reorderingMode >= UBIDI_REORDER_DEFAULT) in ubidi_setReorderingMode()
306 pBiDi->reorderingMode = reorderingMode; in ubidi_setReorderingMode()
307 pBiDi->isInverse = (UBool)(reorderingMode == UBIDI_REORDER_INVERSE_NUMBERS_AS_L); in ubidi_setReorderingMode()
312 ubidi_getReorderingMode(UBiDi *pBiDi) { in ubidi_getReorderingMode() argument
313 if (pBiDi!=NULL) { in ubidi_getReorderingMode()
314 return pBiDi->reorderingMode; in ubidi_getReorderingMode()
321 ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions) { in ubidi_setReorderingOptions() argument
325 if (pBiDi!=NULL) { in ubidi_setReorderingOptions()
326 pBiDi->reorderingOptions=reorderingOptions; in ubidi_setReorderingOptions()
331 ubidi_getReorderingOptions(UBiDi *pBiDi) { in ubidi_getReorderingOptions() argument
332 if (pBiDi!=NULL) { in ubidi_getReorderingOptions()
333 return pBiDi->reorderingOptions; in ubidi_getReorderingOptions()
375 firstL_R_AL(UBiDi *pBiDi) { in firstL_R_AL() argument
376 const UChar *text=pBiDi->prologue; in firstL_R_AL()
377 int32_t length=pBiDi->proLength; in firstL_R_AL()
384 dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar); in firstL_R_AL()
402 checkParaCount(UBiDi *pBiDi) { in checkParaCount() argument
403 int32_t count=pBiDi->paraCount; in checkParaCount()
404 if(pBiDi->paras==pBiDi->simpleParas) { in checkParaCount()
407 if(!getInitialParasMemory(pBiDi, SIMPLE_PARAS_COUNT * 2)) in checkParaCount()
409 pBiDi->paras=pBiDi->parasMemory; in checkParaCount()
410 uprv_memcpy(pBiDi->parasMemory, pBiDi->simpleParas, SIMPLE_PARAS_COUNT * sizeof(Para)); in checkParaCount()
413 if(!getInitialParasMemory(pBiDi, count * 2)) in checkParaCount()
415 pBiDi->paras=pBiDi->parasMemory; in checkParaCount()
428 getDirProps(UBiDi *pBiDi) { in getDirProps() argument
429 const UChar *text=pBiDi->text; in getDirProps()
430 DirProp *dirProps=pBiDi->dirPropsMemory; /* pBiDi->dirProps is const */ in getDirProps()
432 int32_t i=0, originalLength=pBiDi->originalLength; in getDirProps()
436 UBool isDefaultLevel=IS_DEFAULT_LEVEL(pBiDi->paraLevel); in getDirProps()
440 (pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_LIKE_DIRECT || in getDirProps()
441 pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL); in getDirProps()
444 UBool removeBiDiControls = (UBool)(pBiDi->reorderingOptions & in getDirProps()
469 if(pBiDi->reorderingOptions & UBIDI_OPTION_STREAMING) in getDirProps()
470 pBiDi->length=0; in getDirProps()
471 defaultParaLevel=pBiDi->paraLevel&1; in getDirProps()
473 pBiDi->paras[0].level=defaultParaLevel; in getDirProps()
475 if(pBiDi->proLength>0 && /* there is a prologue */ in getDirProps()
476 (dirProp=firstL_R_AL(pBiDi))!=ON) { /* with a strong character */ in getDirProps()
478 pBiDi->paras[0].level=0; /* set the default para level */ in getDirProps()
480 pBiDi->paras[0].level=1; /* set the default para level */ in getDirProps()
486 pBiDi->paras[0].level=pBiDi->paraLevel; in getDirProps()
498 flags|=DIRPROP_FLAG(dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar)); in getDirProps()
508 pBiDi->paras[pBiDi->paraCount-1].level=0; in getDirProps()
524 pBiDi->paras[pBiDi->paraCount-1].level=1; in getDirProps()
571 pBiDi->paras[pBiDi->paraCount-1].limit=i; in getDirProps()
573 pBiDi->paras[pBiDi->paraCount-1].level=1; in getDirProps()
574 if(pBiDi->reorderingOptions & UBIDI_OPTION_STREAMING) { in getDirProps()
577 pBiDi->length=i; /* i is index to next character */ in getDirProps()
578 pBiDi->controlCount=controlCount; in getDirProps()
581 pBiDi->paraCount++; in getDirProps()
582 if(checkParaCount(pBiDi)==FALSE) /* not enough memory for a new para entry */ in getDirProps()
585 pBiDi->paras[pBiDi->paraCount-1].level=defaultParaLevel; in getDirProps()
589 pBiDi->paras[pBiDi->paraCount-1].level=pBiDi->paraLevel; in getDirProps()
614 if(pBiDi->reorderingOptions & UBIDI_OPTION_STREAMING) { in getDirProps()
615 if(pBiDi->length<originalLength) in getDirProps()
616 pBiDi->paraCount--; in getDirProps()
618 pBiDi->paras[pBiDi->paraCount-1].limit=originalLength; in getDirProps()
619 pBiDi->controlCount=controlCount; in getDirProps()
624 pBiDi->paras[pBiDi->paraCount-1].level=1; in getDirProps()
627 pBiDi->paraLevel=static_cast<UBiDiLevel>(pBiDi->paras[0].level); in getDirProps()
631 for(i=0; i<pBiDi->paraCount; i++) in getDirProps()
632 flags|=DIRPROP_FLAG_LR(pBiDi->paras[i].level); in getDirProps()
634 if(pBiDi->orderParagraphsLTR && (flags&DIRPROP_FLAG(B))) { in getDirProps()
637 pBiDi->flags=flags; in getDirProps()
638 pBiDi->lastArabicPos=lastArabicPos; in getDirProps()
644 ubidi_getParaLevelAtIndex(const UBiDi *pBiDi, int32_t pindex) { in ubidi_getParaLevelAtIndex() argument
646 for(i=0; i<pBiDi->paraCount; i++) in ubidi_getParaLevelAtIndex()
647 if(pindex<pBiDi->paras[i].limit) in ubidi_getParaLevelAtIndex()
649 if(i>=pBiDi->paraCount) in ubidi_getParaLevelAtIndex()
650 i=pBiDi->paraCount-1; in ubidi_getParaLevelAtIndex()
651 return (UBiDiLevel)(pBiDi->paras[i].level); in ubidi_getParaLevelAtIndex()
671 bracketInit(UBiDi *pBiDi, BracketData *bd) { in bracketInit() argument
672 bd->pBiDi=pBiDi; in bracketInit()
676 bd->isoRuns[0].level=GET_PARALEVEL(pBiDi, 0); in bracketInit()
677 UBiDiLevel t = GET_PARALEVEL(pBiDi, 0) & 1; in bracketInit()
681 if(pBiDi->openingsMemory) { in bracketInit()
682 bd->openings=pBiDi->openingsMemory; in bracketInit()
683 bd->openingsCount=pBiDi->openingsSize / sizeof(Opening); in bracketInit()
688 bd->isNumbersSpecial=bd->pBiDi->reorderingMode==UBIDI_REORDER_NUMBERS_SPECIAL || in bracketInit()
689 bd->pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL; in bracketInit()
708 DirProp *dirProps=bd->pBiDi->dirProps; in bracketProcessBoundary()
751 UBiDi *pBiDi=bd->pBiDi; in bracketAddOpening() local
752 if(!getInitialOpeningsMemory(pBiDi, pLastIsoRun->limit * 2)) in bracketAddOpening()
755 uprv_memcpy(pBiDi->openingsMemory, bd->simpleOpenings, in bracketAddOpening()
757 bd->openings=pBiDi->openingsMemory; /* may have changed */ in bracketAddOpening()
758 bd->openingsCount=pBiDi->openingsSize / sizeof(Opening); in bracketAddOpening()
776 DirProp *dirProps=bd->pBiDi->dirProps; in fixN0c()
844 bd->pBiDi->dirProps[pOpening->position]=newProp; in bracketProcessClosing()
845 bd->pBiDi->dirProps[position]=newProp; in bracketProcessClosing()
881 dirProps=bd->pBiDi->dirProps; in bracketProcessChar()
888 c=bd->pBiDi->text[position]; in bracketProcessChar()
901 level=bd->pBiDi->levels[position]; in bracketProcessChar()
911 bd->pBiDi->levels[position]&=~UBIDI_LEVEL_OVERRIDE; in bracketProcessChar()
914 bd->pBiDi->levels[bd->openings[idx].position]&=~UBIDI_LEVEL_OVERRIDE; in bracketProcessChar()
940 level=bd->pBiDi->levels[position]; in bracketProcessChar()
1008 directionFromFlags(UBiDi *pBiDi) { in directionFromFlags() argument
1009 Flags flags=pBiDi->flags; in directionFromFlags()
1072 resolveExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) { in resolveExplicitLevels() argument
1073 DirProp *dirProps=pBiDi->dirProps; in resolveExplicitLevels()
1074 UBiDiLevel *levels=pBiDi->levels; in resolveExplicitLevels()
1075 const UChar *text=pBiDi->text; in resolveExplicitLevels()
1077 int32_t i=0, length=pBiDi->length; in resolveExplicitLevels()
1078 Flags flags=pBiDi->flags; /* collect all directionalities in the text */ in resolveExplicitLevels()
1080 UBiDiLevel level=GET_PARALEVEL(pBiDi, 0); in resolveExplicitLevels()
1082 pBiDi->isolateCount=0; in resolveExplicitLevels()
1087 direction=directionFromFlags(pBiDi); in resolveExplicitLevels()
1094 if(pBiDi->reorderingMode > UBIDI_REORDER_LAST_LOGICAL_TO_VISUAL) { in resolveExplicitLevels()
1098 for(paraIndex=0; paraIndex<pBiDi->paraCount; paraIndex++) { in resolveExplicitLevels()
1102 start=pBiDi->paras[paraIndex-1].limit; in resolveExplicitLevels()
1103 limit=pBiDi->paras[paraIndex].limit; in resolveExplicitLevels()
1104 level= static_cast<UBiDiLevel>(pBiDi->paras[paraIndex].level); in resolveExplicitLevels()
1115 bracketInit(pBiDi, &bracketData); in resolveExplicitLevels()
1116 for(paraIndex=0; paraIndex<pBiDi->paraCount; paraIndex++) { in resolveExplicitLevels()
1120 start=pBiDi->paras[paraIndex-1].limit; in resolveExplicitLevels()
1121 limit=pBiDi->paras[paraIndex].limit; in resolveExplicitLevels()
1122 level= static_cast<UBiDiLevel>(pBiDi->paras[paraIndex].level); in resolveExplicitLevels()
1162 bracketInit(pBiDi, &bracketData); in resolveExplicitLevels()
1241 if(validIsolateCount>pBiDi->isolateCount) in resolveExplicitLevels()
1242 pBiDi->isolateCount=validIsolateCount; in resolveExplicitLevels()
1286 levels[i]=GET_PARALEVEL(pBiDi, i); in resolveExplicitLevels()
1293 previousLevel=embeddingLevel=GET_PARALEVEL(pBiDi, i+1); in resolveExplicitLevels()
1325 flags|=DIRPROP_FLAG_LR(pBiDi->paraLevel); in resolveExplicitLevels()
1326 if(pBiDi->orderParagraphsLTR && (flags&DIRPROP_FLAG(B))) in resolveExplicitLevels()
1329 pBiDi->flags=flags; in resolveExplicitLevels()
1330 direction=directionFromFlags(pBiDi); in resolveExplicitLevels()
1346 checkExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) { in checkExplicitLevels() argument
1347 DirProp *dirProps=pBiDi->dirProps; in checkExplicitLevels()
1348 UBiDiLevel *levels=pBiDi->levels; in checkExplicitLevels()
1351 int32_t length=pBiDi->length; in checkExplicitLevels()
1353 pBiDi->isolateCount=0; in checkExplicitLevels()
1356 int32_t currentParaLimit = pBiDi->paras[0].limit; in checkExplicitLevels()
1357 int32_t currentParaLevel = pBiDi->paraLevel; in checkExplicitLevels()
1364 if(isolateCount>pBiDi->isolateCount) in checkExplicitLevels()
1365 pBiDi->isolateCount=isolateCount; in checkExplicitLevels()
1373 if (pBiDi->defaultParaLevel != 0 && in checkExplicitLevels()
1374 i == currentParaLimit && (currentParaIndex + 1) < pBiDi->paraCount) { in checkExplicitLevels()
1375 currentParaLevel = pBiDi->paras[++currentParaIndex].level; in checkExplicitLevels()
1376 currentParaLimit = pBiDi->paras[currentParaIndex].limit; in checkExplicitLevels()
1408 flags|=DIRPROP_FLAG_LR(pBiDi->paraLevel); in checkExplicitLevels()
1410 pBiDi->flags=flags; in checkExplicitLevels()
1411 return directionFromFlags(pBiDi); in checkExplicitLevels()
1788 addPoint(UBiDi *pBiDi, int32_t pos, int32_t flag) in addPoint() argument
1795 InsertPoints * pInsertPoints=&(pBiDi->insertPoints); in addPoint()
1828 setLevelsOutsideIsolates(UBiDi *pBiDi, int32_t start, int32_t limit, UBiDiLevel level) in setLevelsOutsideIsolates() argument
1830 DirProp *dirProps=pBiDi->dirProps, dirProp; in setLevelsOutsideIsolates()
1831 UBiDiLevel *levels=pBiDi->levels; in setLevelsOutsideIsolates()
1860 processPropertySeq(UBiDi *pBiDi, LevState *pLevState, uint8_t _prop, in processPropertySeq() argument
1865 UBiDiLevel * levels=pBiDi->levels; in processPropertySeq()
1889 setLevelsOutsideIsolates(pBiDi, pLevState->startON, start0, level); in processPropertySeq()
1894 setLevelsOutsideIsolates(pBiDi, pLevState->startON, start0, level); in processPropertySeq()
1900 addPoint(pBiDi, pLevState->startL2EN, LRM_BEFORE); in processPropertySeq()
1904 pInsertPoints=&(pBiDi->insertPoints); in processPropertySeq()
1917 addPoint(pBiDi, start0, LRM_BEFORE); in processPropertySeq()
1933 addPoint(pBiDi, start0, LRM_BEFORE); in processPropertySeq()
1940 pInsertPoints=&(pBiDi->insertPoints); in processPropertySeq()
1951 if ((_prop == DirProp_AN) && (pBiDi->dirProps[start0] == AN) && in processPropertySeq()
1952 (pBiDi->reorderingMode!=UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL)) in processPropertySeq()
1963 addPoint(pBiDi, pLevState->startL2EN, LRM_BEFORE); in processPropertySeq()
1967 addPoint(pBiDi, start0, LRM_BEFORE); in processPropertySeq()
1985 addPoint(pBiDi, k, RLM_BEFORE); /* add RLM before */ in processPropertySeq()
1986 pInsertPoints=&(pBiDi->insertPoints); in processPropertySeq()
1995 addPoint(pBiDi, start0, LRM_BEFORE); /* add LRM before */ in processPropertySeq()
1996 addPoint(pBiDi, start0, LRM_AFTER); /* add LRM after */ in processPropertySeq()
2001 pInsertPoints=&(pBiDi->insertPoints); in processPropertySeq()
2005 addPoint(pBiDi, start0, RLM_BEFORE); in processPropertySeq()
2016 pInsertPoints=&(pBiDi->insertPoints); in processPropertySeq()
2060 setLevelsOutsideIsolates(pBiDi, start, limit, level); in processPropertySeq()
2070 lastL_R_AL(UBiDi *pBiDi) { in lastL_R_AL() argument
2071 const UChar *text=pBiDi->prologue; in lastL_R_AL()
2072 int32_t length=pBiDi->proLength; in lastL_R_AL()
2079 dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar); in lastL_R_AL()
2098 firstL_R_AL_EN_AN(UBiDi *pBiDi) { in firstL_R_AL_EN_AN() argument
2099 const UChar *text=pBiDi->epilogue; in firstL_R_AL_EN_AN()
2100 int32_t length=pBiDi->epiLength; in firstL_R_AL_EN_AN()
2107 dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar); in firstL_R_AL_EN_AN()
2125 resolveImplicitLevels(UBiDi *pBiDi, in resolveImplicitLevels() argument
2128 const DirProp *dirProps=pBiDi->dirProps; in resolveImplicitLevels()
2146 ((start<pBiDi->lastArabicPos) && (GET_PARALEVEL(pBiDi, start) & 1) && in resolveImplicitLevels()
2147 (pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_LIKE_DIRECT || in resolveImplicitLevels()
2148 pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL)); in resolveImplicitLevels()
2154 levState.runLevel=pBiDi->levels[start]; in resolveImplicitLevels()
2155 levState.pImpTab=(const ImpTab*)((pBiDi->pImpTabPair)->pImpTab)[levState.runLevel&1]; in resolveImplicitLevels()
2156 levState.pImpAct=(const ImpAct*)((pBiDi->pImpTabPair)->pImpAct)[levState.runLevel&1]; in resolveImplicitLevels()
2157 if(start==0 && pBiDi->proLength>0) { in resolveImplicitLevels()
2158 DirProp lastStrong=lastL_R_AL(pBiDi); in resolveImplicitLevels()
2166 if(dirProps[start]==PDI && pBiDi->isolateCount >= 0) { in resolveImplicitLevels()
2167 levState.startON=pBiDi->isolates[pBiDi->isolateCount].startON; in resolveImplicitLevels()
2168 start1=pBiDi->isolates[pBiDi->isolateCount].start1; in resolveImplicitLevels()
2169 stateImp=pBiDi->isolates[pBiDi->isolateCount].stateImp; in resolveImplicitLevels()
2170 levState.state=pBiDi->isolates[pBiDi->isolateCount].state; in resolveImplicitLevels()
2171 pBiDi->isolateCount--; in resolveImplicitLevels()
2180 processPropertySeq(pBiDi, &levState, sor, start, start); in resolveImplicitLevels()
2196 pBiDi->isolateCount=-1; /* current isolates stack entry == none */ in resolveImplicitLevels()
2236 processPropertySeq(pBiDi, &levState, resProp, start1, i); in resolveImplicitLevels()
2243 processPropertySeq(pBiDi, &levState, resProp, start1, start2); in resolveImplicitLevels()
2244 processPropertySeq(pBiDi, &levState, DirProp_ON, start2, i); in resolveImplicitLevels()
2248 processPropertySeq(pBiDi, &levState, resProp, start1, start2); in resolveImplicitLevels()
2259 if(limit==pBiDi->length && pBiDi->epiLength>0) { in resolveImplicitLevels()
2260 DirProp firstStrong=firstL_R_AL_EN_AN(pBiDi); in resolveImplicitLevels()
2269 if((dirProp==LRI || dirProp==RLI) && limit<pBiDi->length) { in resolveImplicitLevels()
2270 pBiDi->isolateCount++; in resolveImplicitLevels()
2271 pBiDi->isolates[pBiDi->isolateCount].stateImp=stateImp; in resolveImplicitLevels()
2272 pBiDi->isolates[pBiDi->isolateCount].state=levState.state; in resolveImplicitLevels()
2273 pBiDi->isolates[pBiDi->isolateCount].start1=start1; in resolveImplicitLevels()
2274 pBiDi->isolates[pBiDi->isolateCount].startON=levState.startON; in resolveImplicitLevels()
2277 processPropertySeq(pBiDi, &levState, eor, limit, limit); in resolveImplicitLevels()
2289 adjustWSLevels(UBiDi *pBiDi) { in adjustWSLevels() argument
2290 const DirProp *dirProps=pBiDi->dirProps; in adjustWSLevels()
2291 UBiDiLevel *levels=pBiDi->levels; in adjustWSLevels()
2294 if(pBiDi->flags&MASK_WS) { in adjustWSLevels()
2295 UBool orderParagraphsLTR=pBiDi->orderParagraphsLTR; in adjustWSLevels()
2298 i=pBiDi->trailingWSStart; in adjustWSLevels()
2305 levels[i]=GET_PARALEVEL(pBiDi, i); in adjustWSLevels()
2319 levels[i]=GET_PARALEVEL(pBiDi, i); in adjustWSLevels()
2328 ubidi_setContext(UBiDi *pBiDi, in ubidi_setContext() argument
2334 if(pBiDi==NULL || proLength<-1 || epiLength<-1 || in ubidi_setContext()
2341 pBiDi->proLength=u_strlen(prologue); in ubidi_setContext()
2343 pBiDi->proLength=proLength; in ubidi_setContext()
2346 pBiDi->epiLength=u_strlen(epilogue); in ubidi_setContext()
2348 pBiDi->epiLength=epiLength; in ubidi_setContext()
2350 pBiDi->prologue=prologue; in ubidi_setContext()
2351 pBiDi->epilogue=epilogue; in ubidi_setContext()
2355 setParaSuccess(UBiDi *pBiDi) { in setParaSuccess() argument
2356 pBiDi->proLength=0; /* forget the last context */ in setParaSuccess()
2357 pBiDi->epiLength=0; in setParaSuccess()
2358 pBiDi->pParaBiDi=pBiDi; /* mark successful setPara */ in setParaSuccess()
2365 setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length, in setParaRunsOnly() argument
2382 pBiDi->reorderingMode=UBIDI_REORDER_DEFAULT; in setParaRunsOnly()
2384 ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode); in setParaRunsOnly()
2396 saveOptions=pBiDi->reorderingOptions; in setParaRunsOnly()
2398 pBiDi->reorderingOptions&=~UBIDI_OPTION_INSERT_MARKS; in setParaRunsOnly()
2399 pBiDi->reorderingOptions|=UBIDI_OPTION_REMOVE_CONTROLS; in setParaRunsOnly()
2402 ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode); in setParaRunsOnly()
2409 levels=ubidi_getLevels(pBiDi, pErrorCode); in setParaRunsOnly()
2410 uprv_memcpy(saveLevels, levels, (size_t)pBiDi->length*sizeof(UBiDiLevel)); in setParaRunsOnly()
2411 saveTrailingWSStart=pBiDi->trailingWSStart; in setParaRunsOnly()
2412 saveLength=pBiDi->length; in setParaRunsOnly()
2413 saveDirection=pBiDi->direction; in setParaRunsOnly()
2421 visualLength=ubidi_writeReordered(pBiDi, visualText, length, in setParaRunsOnly()
2423 ubidi_getVisualMap(pBiDi, visualMap, pErrorCode); in setParaRunsOnly()
2427 pBiDi->reorderingOptions=saveOptions; in setParaRunsOnly()
2429 pBiDi->reorderingMode=UBIDI_REORDER_INVERSE_LIKE_DIRECT; in setParaRunsOnly()
2438 saveMayAllocateText=pBiDi->mayAllocateText; in setParaRunsOnly()
2439 pBiDi->mayAllocateText=FALSE; in setParaRunsOnly()
2440 ubidi_setPara(pBiDi, visualText, visualLength, paraLevel, NULL, pErrorCode); in setParaRunsOnly()
2441 pBiDi->mayAllocateText=saveMayAllocateText; in setParaRunsOnly()
2442 ubidi_getRuns(pBiDi, pErrorCode); in setParaRunsOnly()
2448 runCount=pBiDi->runCount; in setParaRunsOnly()
2449 runs=pBiDi->runs; in setParaRunsOnly()
2466 if(getRunsMemory(pBiDi, runCount+addedRuns)) { in setParaRunsOnly()
2469 pBiDi->runsMemory[0]=runs[0]; in setParaRunsOnly()
2471 runs=pBiDi->runs=pBiDi->runsMemory; in setParaRunsOnly()
2472 pBiDi->runCount+=addedRuns; in setParaRunsOnly()
2528 pBiDi->paraLevel^=1; in setParaRunsOnly()
2531 pBiDi->text=text; in setParaRunsOnly()
2532 pBiDi->length=saveLength; in setParaRunsOnly()
2533 pBiDi->originalLength=length; in setParaRunsOnly()
2534 pBiDi->direction=saveDirection; in setParaRunsOnly()
2536 if(saveLength>pBiDi->levelsSize) { in setParaRunsOnly()
2537 saveLength=pBiDi->levelsSize; in setParaRunsOnly()
2539 uprv_memcpy(pBiDi->levels, saveLevels, (size_t)saveLength*sizeof(UBiDiLevel)); in setParaRunsOnly()
2540 pBiDi->trailingWSStart=saveTrailingWSStart; in setParaRunsOnly()
2541 if(pBiDi->runCount>1) { in setParaRunsOnly()
2542 pBiDi->direction=UBIDI_MIXED; in setParaRunsOnly()
2548 pBiDi->reorderingMode=UBIDI_REORDER_RUNS_ONLY; in setParaRunsOnly()
2554 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, in ubidi_setPara() argument
2562 if(pBiDi==NULL || text==NULL || length<-1 || in ubidi_setPara()
2573 if(pBiDi->reorderingMode==UBIDI_REORDER_RUNS_ONLY) { in ubidi_setPara()
2574 setParaRunsOnly(pBiDi, text, length, paraLevel, pErrorCode); in ubidi_setPara()
2579 pBiDi->pParaBiDi=NULL; /* mark unfinished setPara */ in ubidi_setPara()
2580 pBiDi->text=text; in ubidi_setPara()
2581 pBiDi->length=pBiDi->originalLength=pBiDi->resultLength=length; in ubidi_setPara()
2582 pBiDi->paraLevel=paraLevel; in ubidi_setPara()
2583 pBiDi->direction=(UBiDiDirection)(paraLevel&1); in ubidi_setPara()
2584 pBiDi->paraCount=1; in ubidi_setPara()
2586 pBiDi->dirProps=NULL; in ubidi_setPara()
2587 pBiDi->levels=NULL; in ubidi_setPara()
2588 pBiDi->runs=NULL; in ubidi_setPara()
2589 pBiDi->insertPoints.size=0; /* clean up from last call */ in ubidi_setPara()
2590 pBiDi->insertPoints.confirmed=0; /* clean up from last call */ in ubidi_setPara()
2595 pBiDi->defaultParaLevel=IS_DEFAULT_LEVEL(paraLevel); in ubidi_setPara()
2604 pBiDi->paraLevel&=1; in ubidi_setPara()
2605 pBiDi->defaultParaLevel=0; in ubidi_setPara()
2607 pBiDi->flags=DIRPROP_FLAG_LR(paraLevel); in ubidi_setPara()
2608 pBiDi->runCount=0; in ubidi_setPara()
2609 pBiDi->paraCount=0; in ubidi_setPara()
2610 setParaSuccess(pBiDi); /* mark successful setPara */ in ubidi_setPara()
2614 pBiDi->runCount=-1; in ubidi_setPara()
2617 if(pBiDi->parasMemory) in ubidi_setPara()
2618 pBiDi->paras=pBiDi->parasMemory; in ubidi_setPara()
2620 pBiDi->paras=pBiDi->simpleParas; in ubidi_setPara()
2627 if(getDirPropsMemory(pBiDi, length)) { in ubidi_setPara()
2628 pBiDi->dirProps=pBiDi->dirPropsMemory; in ubidi_setPara()
2629 if(!getDirProps(pBiDi)) { in ubidi_setPara()
2637 dirProps=pBiDi->dirProps; in ubidi_setPara()
2639 length= pBiDi->length; in ubidi_setPara()
2640 pBiDi->trailingWSStart=length; /* the levels[] will reflect the WS run */ in ubidi_setPara()
2645 if(getLevelsMemory(pBiDi, length)) { in ubidi_setPara()
2646 pBiDi->levels=pBiDi->levelsMemory; in ubidi_setPara()
2647 direction=resolveExplicitLevels(pBiDi, pErrorCode); in ubidi_setPara()
2657 pBiDi->levels=embeddingLevels; in ubidi_setPara()
2658 direction=checkExplicitLevels(pBiDi, pErrorCode); in ubidi_setPara()
2665 if(pBiDi->isolateCount<=SIMPLE_ISOLATES_COUNT) in ubidi_setPara()
2666 pBiDi->isolates=pBiDi->simpleIsolates; in ubidi_setPara()
2668 if((int32_t)(pBiDi->isolateCount*sizeof(Isolate))<=pBiDi->isolatesSize) in ubidi_setPara()
2669 pBiDi->isolates=pBiDi->isolatesMemory; in ubidi_setPara()
2671 if(getInitialIsolatesMemory(pBiDi, pBiDi->isolateCount)) { in ubidi_setPara()
2672 pBiDi->isolates=pBiDi->isolatesMemory; in ubidi_setPara()
2678 pBiDi->isolateCount=-1; /* current isolates stack entry == none */ in ubidi_setPara()
2684 pBiDi->direction=direction; in ubidi_setPara()
2688 pBiDi->trailingWSStart=0; in ubidi_setPara()
2692 pBiDi->trailingWSStart=0; in ubidi_setPara()
2698 switch(pBiDi->reorderingMode) { in ubidi_setPara()
2700 pBiDi->pImpTabPair=&impTab_DEFAULT; in ubidi_setPara()
2703 pBiDi->pImpTabPair=&impTab_NUMBERS_SPECIAL; in ubidi_setPara()
2706 pBiDi->pImpTabPair=&impTab_GROUP_NUMBERS_WITH_R; in ubidi_setPara()
2709 pBiDi->pImpTabPair=&impTab_INVERSE_NUMBERS_AS_L; in ubidi_setPara()
2712 if (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) { in ubidi_setPara()
2713 pBiDi->pImpTabPair=&impTab_INVERSE_LIKE_DIRECT_WITH_MARKS; in ubidi_setPara()
2715 pBiDi->pImpTabPair=&impTab_INVERSE_LIKE_DIRECT; in ubidi_setPara()
2719 if (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) { in ubidi_setPara()
2720 pBiDi->pImpTabPair=&impTab_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS; in ubidi_setPara()
2722 pBiDi->pImpTabPair=&impTab_INVERSE_FOR_NUMBERS_SPECIAL; in ubidi_setPara()
2740 if(embeddingLevels==NULL && pBiDi->paraCount<=1 && in ubidi_setPara()
2741 !(pBiDi->flags&DIRPROP_FLAG_MULTI_RUNS)) { in ubidi_setPara()
2742 resolveImplicitLevels(pBiDi, 0, length, in ubidi_setPara()
2743 GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, 0)), in ubidi_setPara()
2744 GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, length-1))); in ubidi_setPara()
2747 UBiDiLevel *levels=pBiDi->levels; in ubidi_setPara()
2753 level=GET_PARALEVEL(pBiDi, 0); in ubidi_setPara()
2769 sor=GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, start)); in ubidi_setPara()
2783 nextLevel=GET_PARALEVEL(pBiDi, length-1); in ubidi_setPara()
2796 resolveImplicitLevels(pBiDi, start, limit, sor, eor); in ubidi_setPara()
2806 if (U_FAILURE(pBiDi->insertPoints.errorCode)) in ubidi_setPara()
2808 *pErrorCode=pBiDi->insertPoints.errorCode; in ubidi_setPara()
2812 adjustWSLevels(pBiDi); in ubidi_setPara()
2818 if((pBiDi->defaultParaLevel>0) && in ubidi_setPara()
2819 (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) && in ubidi_setPara()
2820 ((pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_LIKE_DIRECT) || in ubidi_setPara()
2821 (pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL))) { in ubidi_setPara()
2825 for(i=0; i<pBiDi->paraCount; i++) { in ubidi_setPara()
2826 last=(pBiDi->paras[i].limit)-1; in ubidi_setPara()
2827 level= static_cast<UBiDiLevel>(pBiDi->paras[i].level); in ubidi_setPara()
2830 start= i==0 ? 0 : pBiDi->paras[i-1].limit; in ubidi_setPara()
2839 addPoint(pBiDi, last, RLM_BEFORE); in ubidi_setPara()
2849 if(pBiDi->reorderingOptions & UBIDI_OPTION_REMOVE_CONTROLS) { in ubidi_setPara()
2850 pBiDi->resultLength -= pBiDi->controlCount; in ubidi_setPara()
2852 pBiDi->resultLength += pBiDi->insertPoints.size; in ubidi_setPara()
2854 setParaSuccess(pBiDi); /* mark successful setPara */ in ubidi_setPara()
2858 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR) { in ubidi_orderParagraphsLTR() argument
2859 if(pBiDi!=NULL) { in ubidi_orderParagraphsLTR()
2860 pBiDi->orderParagraphsLTR=orderParagraphsLTR; in ubidi_orderParagraphsLTR()
2865 ubidi_isOrderParagraphsLTR(UBiDi *pBiDi) { in ubidi_isOrderParagraphsLTR() argument
2866 if(pBiDi!=NULL) { in ubidi_isOrderParagraphsLTR()
2867 return pBiDi->orderParagraphsLTR; in ubidi_isOrderParagraphsLTR()
2874 ubidi_getDirection(const UBiDi *pBiDi) { in ubidi_getDirection() argument
2875 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getDirection()
2876 return pBiDi->direction; in ubidi_getDirection()
2883 ubidi_getText(const UBiDi *pBiDi) { in ubidi_getText() argument
2884 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getText()
2885 return pBiDi->text; in ubidi_getText()
2892 ubidi_getLength(const UBiDi *pBiDi) { in ubidi_getLength() argument
2893 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getLength()
2894 return pBiDi->originalLength; in ubidi_getLength()
2901 ubidi_getProcessedLength(const UBiDi *pBiDi) { in ubidi_getProcessedLength() argument
2902 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getProcessedLength()
2903 return pBiDi->length; in ubidi_getProcessedLength()
2910 ubidi_getResultLength(const UBiDi *pBiDi) { in ubidi_getResultLength() argument
2911 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getResultLength()
2912 return pBiDi->resultLength; in ubidi_getResultLength()
2921 ubidi_getParaLevel(const UBiDi *pBiDi) { in ubidi_getParaLevel() argument
2922 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getParaLevel()
2923 return pBiDi->paraLevel; in ubidi_getParaLevel()
2930 ubidi_countParagraphs(UBiDi *pBiDi) { in ubidi_countParagraphs() argument
2931 if(!IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_countParagraphs()
2934 return pBiDi->paraCount; in ubidi_countParagraphs()
2939 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex, in ubidi_getParagraphByIndex() argument
2946 RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode); in ubidi_getParagraphByIndex()
2947 RETURN_VOID_IF_BAD_RANGE(paraIndex, 0, pBiDi->paraCount, *pErrorCode); in ubidi_getParagraphByIndex()
2949 pBiDi=pBiDi->pParaBiDi; /* get Para object if Line object */ in ubidi_getParagraphByIndex()
2951 paraStart=pBiDi->paras[paraIndex-1].limit; in ubidi_getParagraphByIndex()
2959 *pParaLimit=pBiDi->paras[paraIndex].limit; in ubidi_getParagraphByIndex()
2962 *pParaLevel=GET_PARALEVEL(pBiDi, paraStart); in ubidi_getParagraphByIndex()
2967 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, in ubidi_getParagraph() argument
2975 RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1); in ubidi_getParagraph()
2976 pBiDi=pBiDi->pParaBiDi; /* get Para object if Line object */ in ubidi_getParagraph()
2977 RETURN_IF_BAD_RANGE(charIndex, 0, pBiDi->length, *pErrorCode, -1); in ubidi_getParagraph()
2979 for(paraIndex=0; charIndex>=pBiDi->paras[paraIndex].limit; paraIndex++); in ubidi_getParagraph()
2980 ubidi_getParagraphByIndex(pBiDi, paraIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode); in ubidi_getParagraph()
2985 ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn, in ubidi_setClassCallback() argument
2990 if(pBiDi==NULL) { in ubidi_setClassCallback()
2996 *oldFn = pBiDi->fnClassCallback; in ubidi_setClassCallback()
3000 *oldContext = pBiDi->coClassCallback; in ubidi_setClassCallback()
3002 pBiDi->fnClassCallback = newFn; in ubidi_setClassCallback()
3003 pBiDi->coClassCallback = newContext; in ubidi_setClassCallback()
3007 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context) in ubidi_getClassCallback() argument
3009 if(pBiDi==NULL) { in ubidi_getClassCallback()
3014 *fn = pBiDi->fnClassCallback; in ubidi_getClassCallback()
3018 *context = pBiDi->coClassCallback; in ubidi_getClassCallback()
3023 ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c) in ubidi_getCustomizedClass() argument
3027 if( pBiDi->fnClassCallback == NULL || in ubidi_getCustomizedClass()
3028 (dir = (*pBiDi->fnClassCallback)(pBiDi->coClassCallback, c)) == U_BIDI_CLASS_DEFAULT ) in ubidi_getCustomizedClass()