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()
2061 setLevelsOutsideIsolates(pBiDi, start, limit, level); in processPropertySeq()
2071 lastL_R_AL(UBiDi *pBiDi) { in lastL_R_AL() argument
2072 const UChar *text=pBiDi->prologue; in lastL_R_AL()
2073 int32_t length=pBiDi->proLength; in lastL_R_AL()
2080 dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar); in lastL_R_AL()
2099 firstL_R_AL_EN_AN(UBiDi *pBiDi) { in firstL_R_AL_EN_AN() argument
2100 const UChar *text=pBiDi->epilogue; in firstL_R_AL_EN_AN()
2101 int32_t length=pBiDi->epiLength; in firstL_R_AL_EN_AN()
2108 dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar); in firstL_R_AL_EN_AN()
2126 resolveImplicitLevels(UBiDi *pBiDi, in resolveImplicitLevels() argument
2129 const DirProp *dirProps=pBiDi->dirProps; in resolveImplicitLevels()
2147 ((start<pBiDi->lastArabicPos) && (GET_PARALEVEL(pBiDi, start) & 1) && in resolveImplicitLevels()
2148 (pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_LIKE_DIRECT || in resolveImplicitLevels()
2149 pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL)); in resolveImplicitLevels()
2155 levState.runLevel=pBiDi->levels[start]; in resolveImplicitLevels()
2156 levState.pImpTab=(const ImpTab*)((pBiDi->pImpTabPair)->pImpTab)[levState.runLevel&1]; in resolveImplicitLevels()
2157 levState.pImpAct=(const ImpAct*)((pBiDi->pImpTabPair)->pImpAct)[levState.runLevel&1]; in resolveImplicitLevels()
2158 if(start==0 && pBiDi->proLength>0) { in resolveImplicitLevels()
2159 DirProp lastStrong=lastL_R_AL(pBiDi); in resolveImplicitLevels()
2167 if(dirProps[start]==PDI && pBiDi->isolateCount >= 0) { in resolveImplicitLevels()
2168 levState.startON=pBiDi->isolates[pBiDi->isolateCount].startON; in resolveImplicitLevels()
2169 start1=pBiDi->isolates[pBiDi->isolateCount].start1; in resolveImplicitLevels()
2170 stateImp=pBiDi->isolates[pBiDi->isolateCount].stateImp; in resolveImplicitLevels()
2171 levState.state=pBiDi->isolates[pBiDi->isolateCount].state; in resolveImplicitLevels()
2172 pBiDi->isolateCount--; in resolveImplicitLevels()
2181 processPropertySeq(pBiDi, &levState, sor, start, start); in resolveImplicitLevels()
2197 pBiDi->isolateCount=-1; /* current isolates stack entry == none */ in resolveImplicitLevels()
2237 processPropertySeq(pBiDi, &levState, resProp, start1, i); in resolveImplicitLevels()
2244 processPropertySeq(pBiDi, &levState, resProp, start1, start2); in resolveImplicitLevels()
2245 processPropertySeq(pBiDi, &levState, DirProp_ON, start2, i); in resolveImplicitLevels()
2249 processPropertySeq(pBiDi, &levState, resProp, start1, start2); in resolveImplicitLevels()
2261 if(limit==pBiDi->length && pBiDi->epiLength>0) { in resolveImplicitLevels()
2262 DirProp firstStrong=firstL_R_AL_EN_AN(pBiDi); in resolveImplicitLevels()
2271 if((dirProp==LRI || dirProp==RLI) && limit<pBiDi->length) { in resolveImplicitLevels()
2272 pBiDi->isolateCount++; in resolveImplicitLevels()
2273 pBiDi->isolates[pBiDi->isolateCount].stateImp=stateImp; in resolveImplicitLevels()
2274 pBiDi->isolates[pBiDi->isolateCount].state=levState.state; in resolveImplicitLevels()
2275 pBiDi->isolates[pBiDi->isolateCount].start1=start1; in resolveImplicitLevels()
2276 pBiDi->isolates[pBiDi->isolateCount].startON=levState.startON; in resolveImplicitLevels()
2279 processPropertySeq(pBiDi, &levState, eor, limit, limit); in resolveImplicitLevels()
2291 adjustWSLevels(UBiDi *pBiDi) { in adjustWSLevels() argument
2292 const DirProp *dirProps=pBiDi->dirProps; in adjustWSLevels()
2293 UBiDiLevel *levels=pBiDi->levels; in adjustWSLevels()
2296 if(pBiDi->flags&MASK_WS) { in adjustWSLevels()
2297 UBool orderParagraphsLTR=pBiDi->orderParagraphsLTR; in adjustWSLevels()
2300 i=pBiDi->trailingWSStart; in adjustWSLevels()
2307 levels[i]=GET_PARALEVEL(pBiDi, i); in adjustWSLevels()
2321 levels[i]=GET_PARALEVEL(pBiDi, i); in adjustWSLevels()
2330 ubidi_setContext(UBiDi *pBiDi, in ubidi_setContext() argument
2336 if(pBiDi==NULL || proLength<-1 || epiLength<-1 || in ubidi_setContext()
2343 pBiDi->proLength=u_strlen(prologue); in ubidi_setContext()
2345 pBiDi->proLength=proLength; in ubidi_setContext()
2348 pBiDi->epiLength=u_strlen(epilogue); in ubidi_setContext()
2350 pBiDi->epiLength=epiLength; in ubidi_setContext()
2352 pBiDi->prologue=prologue; in ubidi_setContext()
2353 pBiDi->epilogue=epilogue; in ubidi_setContext()
2357 setParaSuccess(UBiDi *pBiDi) { in setParaSuccess() argument
2358 pBiDi->proLength=0; /* forget the last context */ in setParaSuccess()
2359 pBiDi->epiLength=0; in setParaSuccess()
2360 pBiDi->pParaBiDi=pBiDi; /* mark successful setPara */ in setParaSuccess()
2367 setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length, in setParaRunsOnly() argument
2384 pBiDi->reorderingMode=UBIDI_REORDER_DEFAULT; in setParaRunsOnly()
2386 ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode); in setParaRunsOnly()
2398 saveOptions=pBiDi->reorderingOptions; in setParaRunsOnly()
2400 pBiDi->reorderingOptions&=~UBIDI_OPTION_INSERT_MARKS; in setParaRunsOnly()
2401 pBiDi->reorderingOptions|=UBIDI_OPTION_REMOVE_CONTROLS; in setParaRunsOnly()
2404 ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode); in setParaRunsOnly()
2411 levels=ubidi_getLevels(pBiDi, pErrorCode); in setParaRunsOnly()
2412 uprv_memcpy(saveLevels, levels, (size_t)pBiDi->length*sizeof(UBiDiLevel)); in setParaRunsOnly()
2413 saveTrailingWSStart=pBiDi->trailingWSStart; in setParaRunsOnly()
2414 saveLength=pBiDi->length; in setParaRunsOnly()
2415 saveDirection=pBiDi->direction; in setParaRunsOnly()
2423 visualLength=ubidi_writeReordered(pBiDi, visualText, length, in setParaRunsOnly()
2425 ubidi_getVisualMap(pBiDi, visualMap, pErrorCode); in setParaRunsOnly()
2429 pBiDi->reorderingOptions=saveOptions; in setParaRunsOnly()
2431 pBiDi->reorderingMode=UBIDI_REORDER_INVERSE_LIKE_DIRECT; in setParaRunsOnly()
2440 saveMayAllocateText=pBiDi->mayAllocateText; in setParaRunsOnly()
2441 pBiDi->mayAllocateText=FALSE; in setParaRunsOnly()
2442 ubidi_setPara(pBiDi, visualText, visualLength, paraLevel, NULL, pErrorCode); in setParaRunsOnly()
2443 pBiDi->mayAllocateText=saveMayAllocateText; in setParaRunsOnly()
2444 ubidi_getRuns(pBiDi, pErrorCode); in setParaRunsOnly()
2450 runCount=pBiDi->runCount; in setParaRunsOnly()
2451 runs=pBiDi->runs; in setParaRunsOnly()
2468 if(getRunsMemory(pBiDi, runCount+addedRuns)) { in setParaRunsOnly()
2471 pBiDi->runsMemory[0]=runs[0]; in setParaRunsOnly()
2473 runs=pBiDi->runs=pBiDi->runsMemory; in setParaRunsOnly()
2474 pBiDi->runCount+=addedRuns; in setParaRunsOnly()
2530 pBiDi->paraLevel^=1; in setParaRunsOnly()
2533 pBiDi->text=text; in setParaRunsOnly()
2534 pBiDi->length=saveLength; in setParaRunsOnly()
2535 pBiDi->originalLength=length; in setParaRunsOnly()
2536 pBiDi->direction=saveDirection; in setParaRunsOnly()
2538 if(saveLength>pBiDi->levelsSize) { in setParaRunsOnly()
2539 saveLength=pBiDi->levelsSize; in setParaRunsOnly()
2541 uprv_memcpy(pBiDi->levels, saveLevels, (size_t)saveLength*sizeof(UBiDiLevel)); in setParaRunsOnly()
2542 pBiDi->trailingWSStart=saveTrailingWSStart; in setParaRunsOnly()
2543 if(pBiDi->runCount>1) { in setParaRunsOnly()
2544 pBiDi->direction=UBIDI_MIXED; in setParaRunsOnly()
2550 pBiDi->reorderingMode=UBIDI_REORDER_RUNS_ONLY; in setParaRunsOnly()
2556 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, in ubidi_setPara() argument
2564 if(pBiDi==NULL || text==NULL || length<-1 || in ubidi_setPara()
2575 if(pBiDi->reorderingMode==UBIDI_REORDER_RUNS_ONLY) { in ubidi_setPara()
2576 setParaRunsOnly(pBiDi, text, length, paraLevel, pErrorCode); in ubidi_setPara()
2581 pBiDi->pParaBiDi=NULL; /* mark unfinished setPara */ in ubidi_setPara()
2582 pBiDi->text=text; in ubidi_setPara()
2583 pBiDi->length=pBiDi->originalLength=pBiDi->resultLength=length; in ubidi_setPara()
2584 pBiDi->paraLevel=paraLevel; in ubidi_setPara()
2585 pBiDi->direction=(UBiDiDirection)(paraLevel&1); in ubidi_setPara()
2586 pBiDi->paraCount=1; in ubidi_setPara()
2588 pBiDi->dirProps=NULL; in ubidi_setPara()
2589 pBiDi->levels=NULL; in ubidi_setPara()
2590 pBiDi->runs=NULL; in ubidi_setPara()
2591 pBiDi->insertPoints.size=0; /* clean up from last call */ in ubidi_setPara()
2592 pBiDi->insertPoints.confirmed=0; /* clean up from last call */ in ubidi_setPara()
2597 pBiDi->defaultParaLevel=IS_DEFAULT_LEVEL(paraLevel); in ubidi_setPara()
2606 pBiDi->paraLevel&=1; in ubidi_setPara()
2607 pBiDi->defaultParaLevel=0; in ubidi_setPara()
2609 pBiDi->flags=DIRPROP_FLAG_LR(paraLevel); in ubidi_setPara()
2610 pBiDi->runCount=0; in ubidi_setPara()
2611 pBiDi->paraCount=0; in ubidi_setPara()
2612 setParaSuccess(pBiDi); /* mark successful setPara */ in ubidi_setPara()
2616 pBiDi->runCount=-1; in ubidi_setPara()
2619 if(pBiDi->parasMemory) in ubidi_setPara()
2620 pBiDi->paras=pBiDi->parasMemory; in ubidi_setPara()
2622 pBiDi->paras=pBiDi->simpleParas; in ubidi_setPara()
2629 if(getDirPropsMemory(pBiDi, length)) { in ubidi_setPara()
2630 pBiDi->dirProps=pBiDi->dirPropsMemory; in ubidi_setPara()
2631 if(!getDirProps(pBiDi)) { in ubidi_setPara()
2639 dirProps=pBiDi->dirProps; in ubidi_setPara()
2641 length= pBiDi->length; in ubidi_setPara()
2642 pBiDi->trailingWSStart=length; /* the levels[] will reflect the WS run */ in ubidi_setPara()
2647 if(getLevelsMemory(pBiDi, length)) { in ubidi_setPara()
2648 pBiDi->levels=pBiDi->levelsMemory; in ubidi_setPara()
2649 direction=resolveExplicitLevels(pBiDi, pErrorCode); in ubidi_setPara()
2659 pBiDi->levels=embeddingLevels; in ubidi_setPara()
2660 direction=checkExplicitLevels(pBiDi, pErrorCode); in ubidi_setPara()
2667 if(pBiDi->isolateCount<=SIMPLE_ISOLATES_COUNT) in ubidi_setPara()
2668 pBiDi->isolates=pBiDi->simpleIsolates; in ubidi_setPara()
2670 if((int32_t)(pBiDi->isolateCount*sizeof(Isolate))<=pBiDi->isolatesSize) in ubidi_setPara()
2671 pBiDi->isolates=pBiDi->isolatesMemory; in ubidi_setPara()
2673 if(getInitialIsolatesMemory(pBiDi, pBiDi->isolateCount)) { in ubidi_setPara()
2674 pBiDi->isolates=pBiDi->isolatesMemory; in ubidi_setPara()
2680 pBiDi->isolateCount=-1; /* current isolates stack entry == none */ in ubidi_setPara()
2686 pBiDi->direction=direction; in ubidi_setPara()
2690 pBiDi->trailingWSStart=0; in ubidi_setPara()
2694 pBiDi->trailingWSStart=0; in ubidi_setPara()
2700 switch(pBiDi->reorderingMode) { in ubidi_setPara()
2702 pBiDi->pImpTabPair=&impTab_DEFAULT; in ubidi_setPara()
2705 pBiDi->pImpTabPair=&impTab_NUMBERS_SPECIAL; in ubidi_setPara()
2708 pBiDi->pImpTabPair=&impTab_GROUP_NUMBERS_WITH_R; in ubidi_setPara()
2711 pBiDi->pImpTabPair=&impTab_INVERSE_NUMBERS_AS_L; in ubidi_setPara()
2714 if (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) { in ubidi_setPara()
2715 pBiDi->pImpTabPair=&impTab_INVERSE_LIKE_DIRECT_WITH_MARKS; in ubidi_setPara()
2717 pBiDi->pImpTabPair=&impTab_INVERSE_LIKE_DIRECT; in ubidi_setPara()
2721 if (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) { in ubidi_setPara()
2722 pBiDi->pImpTabPair=&impTab_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS; in ubidi_setPara()
2724 pBiDi->pImpTabPair=&impTab_INVERSE_FOR_NUMBERS_SPECIAL; in ubidi_setPara()
2743 if(embeddingLevels==NULL && pBiDi->paraCount<=1 && in ubidi_setPara()
2744 !(pBiDi->flags&DIRPROP_FLAG_MULTI_RUNS)) { in ubidi_setPara()
2745 resolveImplicitLevels(pBiDi, 0, length, in ubidi_setPara()
2746 GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, 0)), in ubidi_setPara()
2747 GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, length-1))); in ubidi_setPara()
2750 UBiDiLevel *levels=pBiDi->levels; in ubidi_setPara()
2756 level=GET_PARALEVEL(pBiDi, 0); in ubidi_setPara()
2772 sor=GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, start)); in ubidi_setPara()
2786 nextLevel=GET_PARALEVEL(pBiDi, length-1); in ubidi_setPara()
2799 resolveImplicitLevels(pBiDi, start, limit, sor, eor); in ubidi_setPara()
2809 if (U_FAILURE(pBiDi->insertPoints.errorCode)) in ubidi_setPara()
2811 *pErrorCode=pBiDi->insertPoints.errorCode; in ubidi_setPara()
2815 adjustWSLevels(pBiDi); in ubidi_setPara()
2821 if((pBiDi->defaultParaLevel>0) && in ubidi_setPara()
2822 (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) && in ubidi_setPara()
2823 ((pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_LIKE_DIRECT) || in ubidi_setPara()
2824 (pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL))) { in ubidi_setPara()
2828 for(i=0; i<pBiDi->paraCount; i++) { in ubidi_setPara()
2829 last=(pBiDi->paras[i].limit)-1; in ubidi_setPara()
2830 level= static_cast<UBiDiLevel>(pBiDi->paras[i].level); in ubidi_setPara()
2833 start= i==0 ? 0 : pBiDi->paras[i-1].limit; in ubidi_setPara()
2842 addPoint(pBiDi, last, RLM_BEFORE); in ubidi_setPara()
2852 if(pBiDi->reorderingOptions & UBIDI_OPTION_REMOVE_CONTROLS) { in ubidi_setPara()
2853 pBiDi->resultLength -= pBiDi->controlCount; in ubidi_setPara()
2855 pBiDi->resultLength += pBiDi->insertPoints.size; in ubidi_setPara()
2857 setParaSuccess(pBiDi); /* mark successful setPara */ in ubidi_setPara()
2861 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR) { in ubidi_orderParagraphsLTR() argument
2862 if(pBiDi!=NULL) { in ubidi_orderParagraphsLTR()
2863 pBiDi->orderParagraphsLTR=orderParagraphsLTR; in ubidi_orderParagraphsLTR()
2868 ubidi_isOrderParagraphsLTR(UBiDi *pBiDi) { in ubidi_isOrderParagraphsLTR() argument
2869 if(pBiDi!=NULL) { in ubidi_isOrderParagraphsLTR()
2870 return pBiDi->orderParagraphsLTR; in ubidi_isOrderParagraphsLTR()
2877 ubidi_getDirection(const UBiDi *pBiDi) { in ubidi_getDirection() argument
2878 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getDirection()
2879 return pBiDi->direction; in ubidi_getDirection()
2886 ubidi_getText(const UBiDi *pBiDi) { in ubidi_getText() argument
2887 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getText()
2888 return pBiDi->text; in ubidi_getText()
2895 ubidi_getLength(const UBiDi *pBiDi) { in ubidi_getLength() argument
2896 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getLength()
2897 return pBiDi->originalLength; in ubidi_getLength()
2904 ubidi_getProcessedLength(const UBiDi *pBiDi) { in ubidi_getProcessedLength() argument
2905 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getProcessedLength()
2906 return pBiDi->length; in ubidi_getProcessedLength()
2913 ubidi_getResultLength(const UBiDi *pBiDi) { in ubidi_getResultLength() argument
2914 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getResultLength()
2915 return pBiDi->resultLength; in ubidi_getResultLength()
2924 ubidi_getParaLevel(const UBiDi *pBiDi) { in ubidi_getParaLevel() argument
2925 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getParaLevel()
2926 return pBiDi->paraLevel; in ubidi_getParaLevel()
2933 ubidi_countParagraphs(UBiDi *pBiDi) { in ubidi_countParagraphs() argument
2934 if(!IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_countParagraphs()
2937 return pBiDi->paraCount; in ubidi_countParagraphs()
2942 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex, in ubidi_getParagraphByIndex() argument
2949 RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode); in ubidi_getParagraphByIndex()
2950 RETURN_VOID_IF_BAD_RANGE(paraIndex, 0, pBiDi->paraCount, *pErrorCode); in ubidi_getParagraphByIndex()
2952 pBiDi=pBiDi->pParaBiDi; /* get Para object if Line object */ in ubidi_getParagraphByIndex()
2954 paraStart=pBiDi->paras[paraIndex-1].limit; in ubidi_getParagraphByIndex()
2962 *pParaLimit=pBiDi->paras[paraIndex].limit; in ubidi_getParagraphByIndex()
2965 *pParaLevel=GET_PARALEVEL(pBiDi, paraStart); in ubidi_getParagraphByIndex()
2970 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, in ubidi_getParagraph() argument
2978 RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1); in ubidi_getParagraph()
2979 pBiDi=pBiDi->pParaBiDi; /* get Para object if Line object */ in ubidi_getParagraph()
2980 RETURN_IF_BAD_RANGE(charIndex, 0, pBiDi->length, *pErrorCode, -1); in ubidi_getParagraph()
2982 for(paraIndex=0; charIndex>=pBiDi->paras[paraIndex].limit; paraIndex++); in ubidi_getParagraph()
2983 ubidi_getParagraphByIndex(pBiDi, paraIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode); in ubidi_getParagraph()
2988 ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn, in ubidi_setClassCallback() argument
2993 if(pBiDi==NULL) { in ubidi_setClassCallback()
2999 *oldFn = pBiDi->fnClassCallback; in ubidi_setClassCallback()
3003 *oldContext = pBiDi->coClassCallback; in ubidi_setClassCallback()
3005 pBiDi->fnClassCallback = newFn; in ubidi_setClassCallback()
3006 pBiDi->coClassCallback = newContext; in ubidi_setClassCallback()
3010 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context) in ubidi_getClassCallback() argument
3012 if(pBiDi==NULL) { in ubidi_getClassCallback()
3017 *fn = pBiDi->fnClassCallback; in ubidi_getClassCallback()
3021 *context = pBiDi->coClassCallback; in ubidi_getClassCallback()
3026 ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c) in ubidi_getCustomizedClass() argument
3030 if( pBiDi->fnClassCallback == NULL || in ubidi_getCustomizedClass()
3031 (dir = (*pBiDi->fnClassCallback)(pBiDi->coClassCallback, c)) == U_BIDI_CLASS_DEFAULT ) in ubidi_getCustomizedClass()