• Home
  • Raw
  • Download

Lines Matching refs:pBiDi

133     UBiDi *pBiDi;  in ubidi_openSized()  local
144 pBiDi=(UBiDi *)uprv_malloc(sizeof(UBiDi)); in ubidi_openSized()
145 if(pBiDi==NULL) { in ubidi_openSized()
151 uprv_memset(pBiDi, 0, sizeof(UBiDi)); in ubidi_openSized()
154 pBiDi->bdp=ubidi_getSingleton(); in ubidi_openSized()
158 if( !getInitialDirPropsMemory(pBiDi, maxLength) || in ubidi_openSized()
159 !getInitialLevelsMemory(pBiDi, maxLength) in ubidi_openSized()
164 pBiDi->mayAllocateText=TRUE; in ubidi_openSized()
170 pBiDi->runsSize=sizeof(Run); in ubidi_openSized()
171 } else if(!getInitialRunsMemory(pBiDi, maxRunCount)) { in ubidi_openSized()
175 pBiDi->mayAllocateRuns=TRUE; in ubidi_openSized()
179 return pBiDi; in ubidi_openSized()
181 ubidi_close(pBiDi); in ubidi_openSized()
239 ubidi_close(UBiDi *pBiDi) { in ubidi_close() argument
240 if(pBiDi!=NULL) { in ubidi_close()
241 pBiDi->pParaBiDi=NULL; /* in case one tries to reuse this block */ in ubidi_close()
242 if(pBiDi->dirPropsMemory!=NULL) { in ubidi_close()
243 uprv_free(pBiDi->dirPropsMemory); in ubidi_close()
245 if(pBiDi->levelsMemory!=NULL) { in ubidi_close()
246 uprv_free(pBiDi->levelsMemory); in ubidi_close()
248 if(pBiDi->openingsMemory!=NULL) { in ubidi_close()
249 uprv_free(pBiDi->openingsMemory); in ubidi_close()
251 if(pBiDi->parasMemory!=NULL) { in ubidi_close()
252 uprv_free(pBiDi->parasMemory); in ubidi_close()
254 if(pBiDi->runsMemory!=NULL) { in ubidi_close()
255 uprv_free(pBiDi->runsMemory); in ubidi_close()
257 if(pBiDi->isolatesMemory!=NULL) { in ubidi_close()
258 uprv_free(pBiDi->isolatesMemory); in ubidi_close()
260 if(pBiDi->insertPoints.points!=NULL) { in ubidi_close()
261 uprv_free(pBiDi->insertPoints.points); in ubidi_close()
264 uprv_free(pBiDi); in ubidi_close()
271 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse) { in ubidi_setInverse() argument
272 if(pBiDi!=NULL) { in ubidi_setInverse()
273 pBiDi->isInverse=isInverse; in ubidi_setInverse()
274 pBiDi->reorderingMode = isInverse ? UBIDI_REORDER_INVERSE_NUMBERS_AS_L in ubidi_setInverse()
280 ubidi_isInverse(UBiDi *pBiDi) { in ubidi_isInverse() argument
281 if(pBiDi!=NULL) { in ubidi_isInverse()
282 return pBiDi->isInverse; in ubidi_isInverse()
304 ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode) { in ubidi_setReorderingMode() argument
305 if ((pBiDi!=NULL) && (reorderingMode >= UBIDI_REORDER_DEFAULT) in ubidi_setReorderingMode()
307 pBiDi->reorderingMode = reorderingMode; in ubidi_setReorderingMode()
308 pBiDi->isInverse = (UBool)(reorderingMode == UBIDI_REORDER_INVERSE_NUMBERS_AS_L); in ubidi_setReorderingMode()
313 ubidi_getReorderingMode(UBiDi *pBiDi) { in ubidi_getReorderingMode() argument
314 if (pBiDi!=NULL) { in ubidi_getReorderingMode()
315 return pBiDi->reorderingMode; in ubidi_getReorderingMode()
322 ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions) { in ubidi_setReorderingOptions() argument
326 if (pBiDi!=NULL) { in ubidi_setReorderingOptions()
327 pBiDi->reorderingOptions=reorderingOptions; in ubidi_setReorderingOptions()
332 ubidi_getReorderingOptions(UBiDi *pBiDi) { in ubidi_getReorderingOptions() argument
333 if (pBiDi!=NULL) { in ubidi_getReorderingOptions()
334 return pBiDi->reorderingOptions; in ubidi_getReorderingOptions()
376 firstL_R_AL(UBiDi *pBiDi) { in firstL_R_AL() argument
377 const UChar *text=pBiDi->prologue; in firstL_R_AL()
378 int32_t length=pBiDi->proLength; in firstL_R_AL()
385 dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar); in firstL_R_AL()
403 checkParaCount(UBiDi *pBiDi) { in checkParaCount() argument
404 int32_t count=pBiDi->paraCount; in checkParaCount()
405 if(pBiDi->paras==pBiDi->simpleParas) { in checkParaCount()
408 if(!getInitialParasMemory(pBiDi, SIMPLE_PARAS_SIZE * 2)) in checkParaCount()
410 pBiDi->paras=pBiDi->parasMemory; in checkParaCount()
411 uprv_memcpy(pBiDi->parasMemory, pBiDi->simpleParas, SIMPLE_PARAS_SIZE * sizeof(Para)); in checkParaCount()
414 if(!getInitialParasMemory(pBiDi, count * 2)) in checkParaCount()
416 pBiDi->paras=pBiDi->parasMemory; in checkParaCount()
429 getDirProps(UBiDi *pBiDi) { in getDirProps() argument
430 const UChar *text=pBiDi->text; in getDirProps()
431 DirProp *dirProps=pBiDi->dirPropsMemory; /* pBiDi->dirProps is const */ in getDirProps()
433 int32_t i=0, originalLength=pBiDi->originalLength; in getDirProps()
437 UBool isDefaultLevel=IS_DEFAULT_LEVEL(pBiDi->paraLevel); in getDirProps()
441 (pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_LIKE_DIRECT || in getDirProps()
442 pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL); in getDirProps()
445 UBool removeBiDiControls = (UBool)(pBiDi->reorderingOptions & in getDirProps()
470 if(pBiDi->reorderingOptions & UBIDI_OPTION_STREAMING) in getDirProps()
471 pBiDi->length=0; in getDirProps()
472 defaultParaLevel=pBiDi->paraLevel&1; in getDirProps()
474 pBiDi->paras[0].level=defaultParaLevel; in getDirProps()
476 if(pBiDi->proLength>0 && /* there is a prologue */ in getDirProps()
477 (dirProp=firstL_R_AL(pBiDi))!=ON) { /* with a strong character */ in getDirProps()
479 pBiDi->paras[0].level=0; /* set the default para level */ in getDirProps()
481 pBiDi->paras[0].level=1; /* set the default para level */ in getDirProps()
487 pBiDi->paras[0].level=pBiDi->paraLevel; in getDirProps()
499 flags|=DIRPROP_FLAG(dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar)); in getDirProps()
509 pBiDi->paras[pBiDi->paraCount-1].level=0; in getDirProps()
525 pBiDi->paras[pBiDi->paraCount-1].level=1; in getDirProps()
572 pBiDi->paras[pBiDi->paraCount-1].limit=i; in getDirProps()
574 pBiDi->paras[pBiDi->paraCount-1].level=1; in getDirProps()
575 if(pBiDi->reorderingOptions & UBIDI_OPTION_STREAMING) { in getDirProps()
578 pBiDi->length=i; /* i is index to next character */ in getDirProps()
579 pBiDi->controlCount=controlCount; in getDirProps()
582 pBiDi->paraCount++; in getDirProps()
583 if(checkParaCount(pBiDi)==FALSE) /* not enough memory for a new para entry */ in getDirProps()
586 pBiDi->paras[pBiDi->paraCount-1].level=defaultParaLevel; in getDirProps()
590 pBiDi->paras[pBiDi->paraCount-1].level=pBiDi->paraLevel; in getDirProps()
615 if(pBiDi->reorderingOptions & UBIDI_OPTION_STREAMING) { in getDirProps()
616 if(pBiDi->length<originalLength) in getDirProps()
617 pBiDi->paraCount--; in getDirProps()
619 pBiDi->paras[pBiDi->paraCount-1].limit=originalLength; in getDirProps()
620 pBiDi->controlCount=controlCount; in getDirProps()
625 pBiDi->paras[pBiDi->paraCount-1].level=1; in getDirProps()
628 pBiDi->paraLevel=pBiDi->paras[0].level; in getDirProps()
632 for(i=0; i<pBiDi->paraCount; i++) in getDirProps()
633 flags|=DIRPROP_FLAG_LR(pBiDi->paras[i].level); in getDirProps()
635 if(pBiDi->orderParagraphsLTR && (flags&DIRPROP_FLAG(B))) { in getDirProps()
638 pBiDi->flags=flags; in getDirProps()
639 pBiDi->lastArabicPos=lastArabicPos; in getDirProps()
645 ubidi_getParaLevelAtIndex(const UBiDi *pBiDi, int32_t pindex) { in ubidi_getParaLevelAtIndex() argument
647 for(i=0; i<pBiDi->paraCount; i++) in ubidi_getParaLevelAtIndex()
648 if(pindex<pBiDi->paras[i].limit) in ubidi_getParaLevelAtIndex()
650 if(i>=pBiDi->paraCount) in ubidi_getParaLevelAtIndex()
651 i=pBiDi->paraCount-1; in ubidi_getParaLevelAtIndex()
652 return (UBiDiLevel)(pBiDi->paras[i].level); in ubidi_getParaLevelAtIndex()
672 bracketInit(UBiDi *pBiDi, BracketData *bd) { in bracketInit() argument
673 bd->pBiDi=pBiDi; in bracketInit()
677 bd->isoRuns[0].level=GET_PARALEVEL(pBiDi, 0); in bracketInit()
678 …bd->isoRuns[0].lastStrong=bd->isoRuns[0].lastBase=bd->isoRuns[0].contextDir=GET_PARALEVEL(pBiDi, 0… in bracketInit()
680 if(pBiDi->openingsMemory) { in bracketInit()
681 bd->openings=pBiDi->openingsMemory; in bracketInit()
682 bd->openingsCount=pBiDi->openingsSize / sizeof(Opening); in bracketInit()
687 bd->isNumbersSpecial=bd->pBiDi->reorderingMode==UBIDI_REORDER_NUMBERS_SPECIAL || in bracketInit()
688 bd->pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL; in bracketInit()
706 DirProp *dirProps=bd->pBiDi->dirProps; in bracketProcessBoundary()
747 UBiDi *pBiDi=bd->pBiDi; in bracketAddOpening() local
748 if(!getInitialOpeningsMemory(pBiDi, pLastIsoRun->limit * 2)) in bracketAddOpening()
751 uprv_memcpy(pBiDi->openingsMemory, bd->simpleOpenings, in bracketAddOpening()
753 bd->openings=pBiDi->openingsMemory; /* may have changed */ in bracketAddOpening()
754 bd->openingsCount=pBiDi->openingsSize / sizeof(Opening); in bracketAddOpening()
772 DirProp *dirProps=bd->pBiDi->dirProps; in fixN0c()
840 bd->pBiDi->dirProps[pOpening->position]=newProp; in bracketProcessClosing()
841 bd->pBiDi->dirProps[position]=newProp; in bracketProcessClosing()
877 dirProps=bd->pBiDi->dirProps; in bracketProcessChar()
884 c=bd->pBiDi->text[position]; in bracketProcessChar()
897 level=bd->pBiDi->levels[position]; in bracketProcessChar()
907 bd->pBiDi->levels[position]&=~UBIDI_LEVEL_OVERRIDE; in bracketProcessChar()
910 bd->pBiDi->levels[bd->openings[idx].position]&=~UBIDI_LEVEL_OVERRIDE; in bracketProcessChar()
921 ubidi_getPairedBracketType(bd->pBiDi->bdp, c)==U_BPT_OPEN) { /* opening bracket */ in bracketProcessChar()
936 level=bd->pBiDi->levels[position]; in bracketProcessChar()
1004 directionFromFlags(UBiDi *pBiDi) { in directionFromFlags() argument
1005 Flags flags=pBiDi->flags; in directionFromFlags()
1068 resolveExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) { in resolveExplicitLevels() argument
1069 DirProp *dirProps=pBiDi->dirProps; in resolveExplicitLevels()
1070 UBiDiLevel *levels=pBiDi->levels; in resolveExplicitLevels()
1071 const UChar *text=pBiDi->text; in resolveExplicitLevels()
1073 int32_t i=0, length=pBiDi->length; in resolveExplicitLevels()
1074 Flags flags=pBiDi->flags; /* collect all directionalities in the text */ in resolveExplicitLevels()
1076 UBiDiLevel level=GET_PARALEVEL(pBiDi, 0); in resolveExplicitLevels()
1078 pBiDi->isolateCount=0; in resolveExplicitLevels()
1083 direction=directionFromFlags(pBiDi); in resolveExplicitLevels()
1090 if(pBiDi->reorderingMode > UBIDI_REORDER_LAST_LOGICAL_TO_VISUAL) { in resolveExplicitLevels()
1094 for(paraIndex=0; paraIndex<pBiDi->paraCount; paraIndex++) { in resolveExplicitLevels()
1098 start=pBiDi->paras[paraIndex-1].limit; in resolveExplicitLevels()
1099 limit=pBiDi->paras[paraIndex].limit; in resolveExplicitLevels()
1100 level=pBiDi->paras[paraIndex].level; in resolveExplicitLevels()
1111 bracketInit(pBiDi, &bracketData); in resolveExplicitLevels()
1112 for(paraIndex=0; paraIndex<pBiDi->paraCount; paraIndex++) { in resolveExplicitLevels()
1116 start=pBiDi->paras[paraIndex-1].limit; in resolveExplicitLevels()
1117 limit=pBiDi->paras[paraIndex].limit; in resolveExplicitLevels()
1118 level=pBiDi->paras[paraIndex].level; in resolveExplicitLevels()
1158 bracketInit(pBiDi, &bracketData); in resolveExplicitLevels()
1237 if(validIsolateCount>pBiDi->isolateCount) in resolveExplicitLevels()
1238 pBiDi->isolateCount=validIsolateCount; in resolveExplicitLevels()
1282 levels[i]=GET_PARALEVEL(pBiDi, i); in resolveExplicitLevels()
1289 previousLevel=embeddingLevel=GET_PARALEVEL(pBiDi, i+1); in resolveExplicitLevels()
1321 flags|=DIRPROP_FLAG_LR(pBiDi->paraLevel); in resolveExplicitLevels()
1322 if(pBiDi->orderParagraphsLTR && (flags&DIRPROP_FLAG(B))) in resolveExplicitLevels()
1325 pBiDi->flags=flags; in resolveExplicitLevels()
1326 direction=directionFromFlags(pBiDi); in resolveExplicitLevels()
1342 checkExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) { in checkExplicitLevels() argument
1343 DirProp *dirProps=pBiDi->dirProps; in checkExplicitLevels()
1345 UBiDiLevel *levels=pBiDi->levels; in checkExplicitLevels()
1348 int32_t i, length=pBiDi->length; in checkExplicitLevels()
1351 pBiDi->isolateCount=0; in checkExplicitLevels()
1358 if(isolateCount>pBiDi->isolateCount) in checkExplicitLevels()
1359 pBiDi->isolateCount=isolateCount; in checkExplicitLevels()
1373 if((level<GET_PARALEVEL(pBiDi, i) && in checkExplicitLevels()
1382 flags|=DIRPROP_FLAG_LR(pBiDi->paraLevel); in checkExplicitLevels()
1384 pBiDi->flags=flags; in checkExplicitLevels()
1385 return directionFromFlags(pBiDi); in checkExplicitLevels()
1762 addPoint(UBiDi *pBiDi, int32_t pos, int32_t flag) in addPoint() argument
1769 InsertPoints * pInsertPoints=&(pBiDi->insertPoints); in addPoint()
1802 setLevelsOutsideIsolates(UBiDi *pBiDi, int32_t start, int32_t limit, UBiDiLevel level) in setLevelsOutsideIsolates() argument
1804 DirProp *dirProps=pBiDi->dirProps, dirProp; in setLevelsOutsideIsolates()
1805 UBiDiLevel *levels=pBiDi->levels; in setLevelsOutsideIsolates()
1834 processPropertySeq(UBiDi *pBiDi, LevState *pLevState, uint8_t _prop, in processPropertySeq() argument
1839 UBiDiLevel * levels=pBiDi->levels; in processPropertySeq()
1863 setLevelsOutsideIsolates(pBiDi, pLevState->startON, start0, level); in processPropertySeq()
1868 setLevelsOutsideIsolates(pBiDi, pLevState->startON, start0, level); in processPropertySeq()
1874 addPoint(pBiDi, pLevState->startL2EN, LRM_BEFORE); in processPropertySeq()
1878 pInsertPoints=&(pBiDi->insertPoints); in processPropertySeq()
1891 addPoint(pBiDi, start0, LRM_BEFORE); in processPropertySeq()
1907 addPoint(pBiDi, start0, LRM_BEFORE); in processPropertySeq()
1914 pInsertPoints=&(pBiDi->insertPoints); in processPropertySeq()
1925 if ((_prop == DirProp_AN) && (pBiDi->dirProps[start0] == AN) && in processPropertySeq()
1926 (pBiDi->reorderingMode!=UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL)) in processPropertySeq()
1937 addPoint(pBiDi, pLevState->startL2EN, LRM_BEFORE); in processPropertySeq()
1941 addPoint(pBiDi, start0, LRM_BEFORE); in processPropertySeq()
1959 addPoint(pBiDi, k, RLM_BEFORE); /* add RLM before */ in processPropertySeq()
1960 pInsertPoints=&(pBiDi->insertPoints); in processPropertySeq()
1969 addPoint(pBiDi, start0, LRM_BEFORE); /* add LRM before */ in processPropertySeq()
1970 addPoint(pBiDi, start0, LRM_AFTER); /* add LRM after */ in processPropertySeq()
1975 pInsertPoints=&(pBiDi->insertPoints); in processPropertySeq()
1979 addPoint(pBiDi, start0, RLM_BEFORE); in processPropertySeq()
1990 pInsertPoints=&(pBiDi->insertPoints); in processPropertySeq()
2035 setLevelsOutsideIsolates(pBiDi, start, limit, level); in processPropertySeq()
2045 lastL_R_AL(UBiDi *pBiDi) { in lastL_R_AL() argument
2046 const UChar *text=pBiDi->prologue; in lastL_R_AL()
2047 int32_t length=pBiDi->proLength; in lastL_R_AL()
2054 dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar); in lastL_R_AL()
2073 firstL_R_AL_EN_AN(UBiDi *pBiDi) { in firstL_R_AL_EN_AN() argument
2074 const UChar *text=pBiDi->epilogue; in firstL_R_AL_EN_AN()
2075 int32_t length=pBiDi->epiLength; in firstL_R_AL_EN_AN()
2082 dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar); in firstL_R_AL_EN_AN()
2100 resolveImplicitLevels(UBiDi *pBiDi, in resolveImplicitLevels() argument
2103 const DirProp *dirProps=pBiDi->dirProps; in resolveImplicitLevels()
2121 ((start<pBiDi->lastArabicPos) && (GET_PARALEVEL(pBiDi, start) & 1) && in resolveImplicitLevels()
2122 (pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_LIKE_DIRECT || in resolveImplicitLevels()
2123 pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL)); in resolveImplicitLevels()
2129 levState.runLevel=pBiDi->levels[start]; in resolveImplicitLevels()
2130 levState.pImpTab=(const ImpTab*)((pBiDi->pImpTabPair)->pImpTab)[levState.runLevel&1]; in resolveImplicitLevels()
2131 levState.pImpAct=(const ImpAct*)((pBiDi->pImpTabPair)->pImpAct)[levState.runLevel&1]; in resolveImplicitLevels()
2132 if(start==0 && pBiDi->proLength>0) { in resolveImplicitLevels()
2133 DirProp lastStrong=lastL_R_AL(pBiDi); in resolveImplicitLevels()
2142 levState.startON=pBiDi->isolates[pBiDi->isolateCount].startON; in resolveImplicitLevels()
2143 start1=pBiDi->isolates[pBiDi->isolateCount].start1; in resolveImplicitLevels()
2144 stateImp=pBiDi->isolates[pBiDi->isolateCount].stateImp; in resolveImplicitLevels()
2145 levState.state=pBiDi->isolates[pBiDi->isolateCount].state; in resolveImplicitLevels()
2146 pBiDi->isolateCount--; in resolveImplicitLevels()
2155 processPropertySeq(pBiDi, &levState, sor, start, start); in resolveImplicitLevels()
2208 processPropertySeq(pBiDi, &levState, resProp, start1, i); in resolveImplicitLevels()
2215 processPropertySeq(pBiDi, &levState, resProp, start1, start2); in resolveImplicitLevels()
2216 processPropertySeq(pBiDi, &levState, DirProp_ON, start2, i); in resolveImplicitLevels()
2220 processPropertySeq(pBiDi, &levState, resProp, start1, start2); in resolveImplicitLevels()
2232 if(limit==pBiDi->length && pBiDi->epiLength>0) { in resolveImplicitLevels()
2233 DirProp firstStrong=firstL_R_AL_EN_AN(pBiDi); in resolveImplicitLevels()
2242 if((dirProp==LRI || dirProp==RLI) && limit<pBiDi->length) { in resolveImplicitLevels()
2243 pBiDi->isolateCount++; in resolveImplicitLevels()
2244 pBiDi->isolates[pBiDi->isolateCount].stateImp=stateImp; in resolveImplicitLevels()
2245 pBiDi->isolates[pBiDi->isolateCount].state=levState.state; in resolveImplicitLevels()
2246 pBiDi->isolates[pBiDi->isolateCount].start1=start1; in resolveImplicitLevels()
2247 pBiDi->isolates[pBiDi->isolateCount].startON=levState.startON; in resolveImplicitLevels()
2250 processPropertySeq(pBiDi, &levState, eor, limit, limit); in resolveImplicitLevels()
2262 adjustWSLevels(UBiDi *pBiDi) { in adjustWSLevels() argument
2263 const DirProp *dirProps=pBiDi->dirProps; in adjustWSLevels()
2264 UBiDiLevel *levels=pBiDi->levels; in adjustWSLevels()
2267 if(pBiDi->flags&MASK_WS) { in adjustWSLevels()
2268 UBool orderParagraphsLTR=pBiDi->orderParagraphsLTR; in adjustWSLevels()
2271 i=pBiDi->trailingWSStart; in adjustWSLevels()
2278 levels[i]=GET_PARALEVEL(pBiDi, i); in adjustWSLevels()
2292 levels[i]=GET_PARALEVEL(pBiDi, i); in adjustWSLevels()
2301 ubidi_setContext(UBiDi *pBiDi, in ubidi_setContext() argument
2307 if(pBiDi==NULL || proLength<-1 || epiLength<-1 || in ubidi_setContext()
2314 pBiDi->proLength=u_strlen(prologue); in ubidi_setContext()
2316 pBiDi->proLength=proLength; in ubidi_setContext()
2319 pBiDi->epiLength=u_strlen(epilogue); in ubidi_setContext()
2321 pBiDi->epiLength=epiLength; in ubidi_setContext()
2323 pBiDi->prologue=prologue; in ubidi_setContext()
2324 pBiDi->epilogue=epilogue; in ubidi_setContext()
2328 setParaSuccess(UBiDi *pBiDi) { in setParaSuccess() argument
2329 pBiDi->proLength=0; /* forget the last context */ in setParaSuccess()
2330 pBiDi->epiLength=0; in setParaSuccess()
2331 pBiDi->pParaBiDi=pBiDi; /* mark successful setPara */ in setParaSuccess()
2338 setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length, in setParaRunsOnly() argument
2355 pBiDi->reorderingMode=UBIDI_REORDER_DEFAULT; in setParaRunsOnly()
2357 ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode); in setParaRunsOnly()
2369 saveOptions=pBiDi->reorderingOptions; in setParaRunsOnly()
2371 pBiDi->reorderingOptions&=~UBIDI_OPTION_INSERT_MARKS; in setParaRunsOnly()
2372 pBiDi->reorderingOptions|=UBIDI_OPTION_REMOVE_CONTROLS; in setParaRunsOnly()
2375 ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode); in setParaRunsOnly()
2382 levels=ubidi_getLevels(pBiDi, pErrorCode); in setParaRunsOnly()
2383 uprv_memcpy(saveLevels, levels, pBiDi->length*sizeof(UBiDiLevel)); in setParaRunsOnly()
2384 saveTrailingWSStart=pBiDi->trailingWSStart; in setParaRunsOnly()
2385 saveLength=pBiDi->length; in setParaRunsOnly()
2386 saveDirection=pBiDi->direction; in setParaRunsOnly()
2394 visualLength=ubidi_writeReordered(pBiDi, visualText, length, in setParaRunsOnly()
2396 ubidi_getVisualMap(pBiDi, visualMap, pErrorCode); in setParaRunsOnly()
2400 pBiDi->reorderingOptions=saveOptions; in setParaRunsOnly()
2402 pBiDi->reorderingMode=UBIDI_REORDER_INVERSE_LIKE_DIRECT; in setParaRunsOnly()
2411 saveMayAllocateText=pBiDi->mayAllocateText; in setParaRunsOnly()
2412 pBiDi->mayAllocateText=FALSE; in setParaRunsOnly()
2413 ubidi_setPara(pBiDi, visualText, visualLength, paraLevel, NULL, pErrorCode); in setParaRunsOnly()
2414 pBiDi->mayAllocateText=saveMayAllocateText; in setParaRunsOnly()
2415 ubidi_getRuns(pBiDi, pErrorCode); in setParaRunsOnly()
2421 runCount=pBiDi->runCount; in setParaRunsOnly()
2422 runs=pBiDi->runs; in setParaRunsOnly()
2439 if(getRunsMemory(pBiDi, runCount+addedRuns)) { in setParaRunsOnly()
2442 pBiDi->runsMemory[0]=runs[0]; in setParaRunsOnly()
2444 runs=pBiDi->runs=pBiDi->runsMemory; in setParaRunsOnly()
2445 pBiDi->runCount+=addedRuns; in setParaRunsOnly()
2501 pBiDi->paraLevel^=1; in setParaRunsOnly()
2504 pBiDi->text=text; in setParaRunsOnly()
2505 pBiDi->length=saveLength; in setParaRunsOnly()
2506 pBiDi->originalLength=length; in setParaRunsOnly()
2507 pBiDi->direction=saveDirection; in setParaRunsOnly()
2509 if(saveLength>pBiDi->levelsSize) { in setParaRunsOnly()
2510 saveLength=pBiDi->levelsSize; in setParaRunsOnly()
2512 uprv_memcpy(pBiDi->levels, saveLevels, saveLength*sizeof(UBiDiLevel)); in setParaRunsOnly()
2513 pBiDi->trailingWSStart=saveTrailingWSStart; in setParaRunsOnly()
2516 if(pBiDi->runCount>1) { in setParaRunsOnly()
2517 pBiDi->direction=UBIDI_MIXED; in setParaRunsOnly()
2520 pBiDi->reorderingMode=UBIDI_REORDER_RUNS_ONLY; in setParaRunsOnly()
2526 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, in ubidi_setPara() argument
2534 if(pBiDi==NULL || text==NULL || length<-1 || in ubidi_setPara()
2545 if(pBiDi->reorderingMode==UBIDI_REORDER_RUNS_ONLY) { in ubidi_setPara()
2546 setParaRunsOnly(pBiDi, text, length, paraLevel, pErrorCode); in ubidi_setPara()
2551 pBiDi->pParaBiDi=NULL; /* mark unfinished setPara */ in ubidi_setPara()
2552 pBiDi->text=text; in ubidi_setPara()
2553 pBiDi->length=pBiDi->originalLength=pBiDi->resultLength=length; in ubidi_setPara()
2554 pBiDi->paraLevel=paraLevel; in ubidi_setPara()
2555 pBiDi->direction=paraLevel&1; in ubidi_setPara()
2556 pBiDi->paraCount=1; in ubidi_setPara()
2558 pBiDi->dirProps=NULL; in ubidi_setPara()
2559 pBiDi->levels=NULL; in ubidi_setPara()
2560 pBiDi->runs=NULL; in ubidi_setPara()
2561 pBiDi->insertPoints.size=0; /* clean up from last call */ in ubidi_setPara()
2562 pBiDi->insertPoints.confirmed=0; /* clean up from last call */ in ubidi_setPara()
2567 pBiDi->defaultParaLevel=IS_DEFAULT_LEVEL(paraLevel); in ubidi_setPara()
2576 pBiDi->paraLevel&=1; in ubidi_setPara()
2577 pBiDi->defaultParaLevel=0; in ubidi_setPara()
2579 pBiDi->flags=DIRPROP_FLAG_LR(paraLevel); in ubidi_setPara()
2580 pBiDi->runCount=0; in ubidi_setPara()
2581 pBiDi->paraCount=0; in ubidi_setPara()
2582 setParaSuccess(pBiDi); /* mark successful setPara */ in ubidi_setPara()
2586 pBiDi->runCount=-1; in ubidi_setPara()
2589 if(pBiDi->parasMemory) in ubidi_setPara()
2590 pBiDi->paras=pBiDi->parasMemory; in ubidi_setPara()
2592 pBiDi->paras=pBiDi->simpleParas; in ubidi_setPara()
2599 if(getDirPropsMemory(pBiDi, length)) { in ubidi_setPara()
2600 pBiDi->dirProps=pBiDi->dirPropsMemory; in ubidi_setPara()
2601 if(!getDirProps(pBiDi)) { in ubidi_setPara()
2609 dirProps=pBiDi->dirProps; in ubidi_setPara()
2611 length= pBiDi->length; in ubidi_setPara()
2612 pBiDi->trailingWSStart=length; /* the levels[] will reflect the WS run */ in ubidi_setPara()
2617 if(getLevelsMemory(pBiDi, length)) { in ubidi_setPara()
2618 pBiDi->levels=pBiDi->levelsMemory; in ubidi_setPara()
2619 direction=resolveExplicitLevels(pBiDi, pErrorCode); in ubidi_setPara()
2629 pBiDi->levels=embeddingLevels; in ubidi_setPara()
2630 direction=checkExplicitLevels(pBiDi, pErrorCode); in ubidi_setPara()
2637 if(pBiDi->isolateCount<=SIMPLE_ISOLATES_SIZE) in ubidi_setPara()
2638 pBiDi->isolates=pBiDi->simpleIsolates; in ubidi_setPara()
2640 if((int32_t)(pBiDi->isolateCount*sizeof(Isolate))<=pBiDi->isolatesSize) in ubidi_setPara()
2641 pBiDi->isolates=pBiDi->isolatesMemory; in ubidi_setPara()
2643 if(getInitialIsolatesMemory(pBiDi, pBiDi->isolateCount)) { in ubidi_setPara()
2644 pBiDi->isolates=pBiDi->isolatesMemory; in ubidi_setPara()
2650 pBiDi->isolateCount=-1; /* current isolates stack entry == none */ in ubidi_setPara()
2656 pBiDi->direction=direction; in ubidi_setPara()
2660 pBiDi->paraLevel=(UBiDiLevel)((pBiDi->paraLevel+1)&~1); in ubidi_setPara()
2663 pBiDi->trailingWSStart=0; in ubidi_setPara()
2667 pBiDi->paraLevel|=1; in ubidi_setPara()
2670 pBiDi->trailingWSStart=0; in ubidi_setPara()
2676 switch(pBiDi->reorderingMode) { in ubidi_setPara()
2678 pBiDi->pImpTabPair=&impTab_DEFAULT; in ubidi_setPara()
2681 pBiDi->pImpTabPair=&impTab_NUMBERS_SPECIAL; in ubidi_setPara()
2684 pBiDi->pImpTabPair=&impTab_GROUP_NUMBERS_WITH_R; in ubidi_setPara()
2687 pBiDi->pImpTabPair=&impTab_INVERSE_NUMBERS_AS_L; in ubidi_setPara()
2690 if (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) { in ubidi_setPara()
2691 pBiDi->pImpTabPair=&impTab_INVERSE_LIKE_DIRECT_WITH_MARKS; in ubidi_setPara()
2693 pBiDi->pImpTabPair=&impTab_INVERSE_LIKE_DIRECT; in ubidi_setPara()
2697 if (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) { in ubidi_setPara()
2698 pBiDi->pImpTabPair=&impTab_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS; in ubidi_setPara()
2700 pBiDi->pImpTabPair=&impTab_INVERSE_FOR_NUMBERS_SPECIAL; in ubidi_setPara()
2719 if(embeddingLevels==NULL && pBiDi->paraCount<=1 && in ubidi_setPara()
2720 !(pBiDi->flags&DIRPROP_FLAG_MULTI_RUNS)) { in ubidi_setPara()
2721 resolveImplicitLevels(pBiDi, 0, length, in ubidi_setPara()
2722 GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, 0)), in ubidi_setPara()
2723 GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, length-1))); in ubidi_setPara()
2726 UBiDiLevel *levels=pBiDi->levels; in ubidi_setPara()
2732 level=GET_PARALEVEL(pBiDi, 0); in ubidi_setPara()
2748 sor=GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, start)); in ubidi_setPara()
2762 nextLevel=GET_PARALEVEL(pBiDi, length-1); in ubidi_setPara()
2775 resolveImplicitLevels(pBiDi, start, limit, sor, eor); in ubidi_setPara()
2785 if (U_FAILURE(pBiDi->insertPoints.errorCode)) in ubidi_setPara()
2787 *pErrorCode=pBiDi->insertPoints.errorCode; in ubidi_setPara()
2791 adjustWSLevels(pBiDi); in ubidi_setPara()
2797 if((pBiDi->defaultParaLevel>0) && in ubidi_setPara()
2798 (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) && in ubidi_setPara()
2799 ((pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_LIKE_DIRECT) || in ubidi_setPara()
2800 (pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL))) { in ubidi_setPara()
2804 for(i=0; i<pBiDi->paraCount; i++) { in ubidi_setPara()
2805 last=(pBiDi->paras[i].limit)-1; in ubidi_setPara()
2806 level=pBiDi->paras[i].level; in ubidi_setPara()
2809 start= i==0 ? 0 : pBiDi->paras[i-1].limit; in ubidi_setPara()
2818 addPoint(pBiDi, last, RLM_BEFORE); in ubidi_setPara()
2828 if(pBiDi->reorderingOptions & UBIDI_OPTION_REMOVE_CONTROLS) { in ubidi_setPara()
2829 pBiDi->resultLength -= pBiDi->controlCount; in ubidi_setPara()
2831 pBiDi->resultLength += pBiDi->insertPoints.size; in ubidi_setPara()
2833 setParaSuccess(pBiDi); /* mark successful setPara */ in ubidi_setPara()
2837 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR) { in ubidi_orderParagraphsLTR() argument
2838 if(pBiDi!=NULL) { in ubidi_orderParagraphsLTR()
2839 pBiDi->orderParagraphsLTR=orderParagraphsLTR; in ubidi_orderParagraphsLTR()
2844 ubidi_isOrderParagraphsLTR(UBiDi *pBiDi) { in ubidi_isOrderParagraphsLTR() argument
2845 if(pBiDi!=NULL) { in ubidi_isOrderParagraphsLTR()
2846 return pBiDi->orderParagraphsLTR; in ubidi_isOrderParagraphsLTR()
2853 ubidi_getDirection(const UBiDi *pBiDi) { in ubidi_getDirection() argument
2854 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getDirection()
2855 return pBiDi->direction; in ubidi_getDirection()
2862 ubidi_getText(const UBiDi *pBiDi) { in ubidi_getText() argument
2863 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getText()
2864 return pBiDi->text; in ubidi_getText()
2871 ubidi_getLength(const UBiDi *pBiDi) { in ubidi_getLength() argument
2872 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getLength()
2873 return pBiDi->originalLength; in ubidi_getLength()
2880 ubidi_getProcessedLength(const UBiDi *pBiDi) { in ubidi_getProcessedLength() argument
2881 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getProcessedLength()
2882 return pBiDi->length; in ubidi_getProcessedLength()
2889 ubidi_getResultLength(const UBiDi *pBiDi) { in ubidi_getResultLength() argument
2890 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getResultLength()
2891 return pBiDi->resultLength; in ubidi_getResultLength()
2900 ubidi_getParaLevel(const UBiDi *pBiDi) { in ubidi_getParaLevel() argument
2901 if(IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_getParaLevel()
2902 return pBiDi->paraLevel; in ubidi_getParaLevel()
2909 ubidi_countParagraphs(UBiDi *pBiDi) { in ubidi_countParagraphs() argument
2910 if(!IS_VALID_PARA_OR_LINE(pBiDi)) { in ubidi_countParagraphs()
2913 return pBiDi->paraCount; in ubidi_countParagraphs()
2918 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex, in ubidi_getParagraphByIndex() argument
2925 RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode); in ubidi_getParagraphByIndex()
2926 RETURN_VOID_IF_BAD_RANGE(paraIndex, 0, pBiDi->paraCount, *pErrorCode); in ubidi_getParagraphByIndex()
2928 pBiDi=pBiDi->pParaBiDi; /* get Para object if Line object */ in ubidi_getParagraphByIndex()
2930 paraStart=pBiDi->paras[paraIndex-1].limit; in ubidi_getParagraphByIndex()
2938 *pParaLimit=pBiDi->paras[paraIndex].limit; in ubidi_getParagraphByIndex()
2941 *pParaLevel=GET_PARALEVEL(pBiDi, paraStart); in ubidi_getParagraphByIndex()
2946 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, in ubidi_getParagraph() argument
2954 RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1); in ubidi_getParagraph()
2955 pBiDi=pBiDi->pParaBiDi; /* get Para object if Line object */ in ubidi_getParagraph()
2956 RETURN_IF_BAD_RANGE(charIndex, 0, pBiDi->length, *pErrorCode, -1); in ubidi_getParagraph()
2958 for(paraIndex=0; charIndex>=pBiDi->paras[paraIndex].limit; paraIndex++); in ubidi_getParagraph()
2959 ubidi_getParagraphByIndex(pBiDi, paraIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode); in ubidi_getParagraph()
2964 ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn, in ubidi_setClassCallback() argument
2969 if(pBiDi==NULL) { in ubidi_setClassCallback()
2975 *oldFn = pBiDi->fnClassCallback; in ubidi_setClassCallback()
2979 *oldContext = pBiDi->coClassCallback; in ubidi_setClassCallback()
2981 pBiDi->fnClassCallback = newFn; in ubidi_setClassCallback()
2982 pBiDi->coClassCallback = newContext; in ubidi_setClassCallback()
2986 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context) in ubidi_getClassCallback() argument
2988 if(pBiDi==NULL) { in ubidi_getClassCallback()
2993 *fn = pBiDi->fnClassCallback; in ubidi_getClassCallback()
2997 *context = pBiDi->coClassCallback; in ubidi_getClassCallback()
3002 ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c) in ubidi_getCustomizedClass() argument
3006 if( pBiDi->fnClassCallback == NULL || in ubidi_getCustomizedClass()
3007 (dir = (*pBiDi->fnClassCallback)(pBiDi->coClassCallback, c)) == U_BIDI_CLASS_DEFAULT ) in ubidi_getCustomizedClass()
3009 dir = ubidi_getClass(pBiDi->bdp, c); in ubidi_getCustomizedClass()