Lines Matching refs:pBiDi
37 static void doTests(UBiDi *pBiDi, UBiDi *pLine, UBool countRunsFirst);
41 static void doTest(UBiDi *pBiDi, int testNumber, const BiDiTestData *test,
44 static void _testReordering(UBiDi *pBiDi, int testNumber);
48 static void _testManyInverseBidi(UBiDi *pBiDi, UBiDiLevel direction);
50 static void _testInverseBidi(UBiDi *pBiDi, const UChar *src, int32_t srcLength,
92 static const char* inverseBasic(UBiDi *pBiDi, const char *src, int32_t srcLen,
94 static UBool assertRoundTrip(UBiDi *pBiDi, int32_t tc, int32_t outIndex,
98 static UBool checkResultLength(UBiDi *pBiDi, const char *srcChars,
102 static UBool checkMaps(UBiDi *pBiDi, int32_t stringIndex, const char *src,
164 UBiDi *pBiDi, *pLine=NULL;
169 pBiDi=ubidi_openSized(MAXLEN, 0, &errorCode);
170 if(pBiDi!=NULL) {
173 doTests(pBiDi, pLine, FALSE);
174 doTests(pBiDi, pLine, TRUE);
186 if(pBiDi!=NULL) {
187 ubidi_close(pBiDi);
194 doTests(UBiDi *pBiDi, UBiDi *pLine, UBool countRunsFirst) {
205 ubidi_setPara(pBiDi, string, -1, paraLevel, NULL, &errorCode);
208 testNumber, paraLevel, ubidi_getDirection(pBiDi), paraLevel);
211 doTest(pBiDi, testNumber, tests+testNumber, 0, countRunsFirst);
213 ubidi_setLine(pBiDi, lineStart, tests[testNumber].lineLimit, pLine, &errorCode);
1026 doTest(UBiDi *pBiDi, int testNumber, const BiDiTestData *test, int32_t lineStart, UBool countRunsFirst) {
1030 int32_t i, len=ubidi_getLength(pBiDi), logicalIndex, runCount = 0;
1037 runCount = ubidi_countRuns(pBiDi, &errorCode);
1047 _testReordering(pBiDi, testNumber);
1051 i, ubidi_getLevelAt(pBiDi, i), ubidi_getLevelAt(pBiDi, i), levelString,
1053 ubidi_getVisualIndex(pBiDi, i, &errorCode));
1061 log_verbose(" %d", ubidi_getLevelAt(pBiDi, i));
1069 log_verbose(" %d", ubidi_getVisualIndex(pBiDi, i, &errorCode));
1073 if(test->direction!=ubidi_getDirection(pBiDi)) {
1074 log_err("ubidi_getDirection(tests[%d]): wrong direction %d\n", testNumber, ubidi_getDirection(pBiDi));
1077 if(test->resultLevel!=ubidi_getParaLevel(pBiDi)) {
1078 log_err("ubidi_getParaLevel(tests[%d]): wrong paragraph level %d\n", testNumber, ubidi_getParaLevel(pBiDi));
1082 if(levels[i]!=ubidi_getLevelAt(pBiDi, i)) {
1083 log_err("ubidi_getLevelAt(tests[%d], %d): wrong level %d, expected %d\n", testNumber, i, ubidi_getLevelAt(pBiDi, i), levels[i]);
1089 logicalIndex=ubidi_getVisualIndex(pBiDi, i, &errorCode);
1101 runCount=ubidi_countRuns(pBiDi, &errorCode);
1109 level=ubidi_getLevelAt(pBiDi, logicalIndex);
1110 ubidi_getLogicalRun(pBiDi, logicalIndex, &logicalIndex, &level2);
1119 testNumber, ubidi_countRuns(pBiDi, &errorCode));
1126 testNumber, ubidi_countRuns(pBiDi, &errorCode));
1134 _testReordering(UBiDi *pBiDi, int testNumber) {
1140 int32_t i, length=ubidi_getLength(pBiDi),
1141 destLength=ubidi_getResultLength(pBiDi);
1150 ubidi_getLogicalMap(pBiDi, logicalMap1, &errorCode);
1156 ubidi_getVisualMap(pBiDi, visualMap1, &errorCode);
1167 levels=ubidi_getLevels(pBiDi, &errorCode);
1178 runCount=ubidi_countRuns(pBiDi, &errorCode);
1186 odd=(UBool)ubidi_getVisualRun(pBiDi, i, &logicalStart, &runLength);
1257 if(logicalMap1[i]!=ubidi_getVisualIndex(pBiDi, i, &errorCode)) {
1265 if(visualMap1[i]!=ubidi_getLogicalIndex(pBiDi, i, &errorCode)) {
1837 UBiDi* pBidi=ubidi_open();
1846 ubidi_setPara(pBidi, src, srcSize, UBIDI_LTR, NULL, &errorCode);
1850 ubidi_close(pBidi);
1854 if (paraCount!=(count=ubidi_countParagraphs(pBidi))) {
1859 ubidi_getParagraphByIndex(pBidi, i, ¶Start, ¶Limit, NULL, &errorCode);
1868 ubidi_setPara(pBidi, src, srcSize, UBIDI_LTR, NULL, &errorCode);
1872 ubidi_close(pBidi);
1875 if (paraCount!=(count=ubidi_countParagraphs(pBidi))) {
1880 ubidi_getParagraphByIndex(pBidi, i, ¶Start, ¶Limit, NULL, &errorCode);
1888 ubidi_setPara(pBidi, src, srcSize, paraLevels[k], NULL, &errorCode);
1890 paraIndex=ubidi_getParagraph(pBidi, paraBounds[i], NULL, NULL, &gotLevel, &errorCode);
1900 gotLevel=ubidi_getParaLevel(pBidi);
1911 ubidi_setPara(pBidi, src, srcSize, UBIDI_DEFAULT_LTR, NULL, &errorCode);
1912 gotLevel=ubidi_getParaLevel(pBidi);
1922 ubidi_setLine(pBidi, i, k, pLine, &errorCode);
1930 ubidi_setLine(pBidi, i, k, pLine, &errorCode);
1937 ubidi_setPara(pBidi, src, srcSize, UBIDI_RTL, NULL, &errorCode);
1939 gotLevels=ubidi_getLevels(pBidi, &errorCode);
1943 ubidi_close(pBidi);
1955 ubidi_setLine(pBidi, i, k, pLine, &errorCode);
1960 ubidi_close(pBidi);
1968 ubidi_close(pBidi);
1977 orderParagraphsLTR=ubidi_isOrderParagraphsLTR(pBidi);
1981 ubidi_orderParagraphsLTR(pBidi, TRUE);
1982 orderParagraphsLTR=ubidi_isOrderParagraphsLTR(pBidi);
1987 ubidi_setPara(pBidi, src, srcSize, UBIDI_RTL, NULL, &errorCode);
1989 gotLevels=ubidi_getLevels(pBidi, &errorCode);
2000 ubidi_setLine(pBidi, paraStart, paraLimit, pLine, &errorCode);
2022 ubidi_orderParagraphsLTR(pBidi, FALSE);
2023 ubidi_setPara(pBidi, src, srcSize, UBIDI_DEFAULT_RTL, NULL, &errorCode);
2024 gotLevels=ubidi_getLevels(pBidi, &errorCode);
2044 ubidi_orderParagraphsLTR(pBidi, TRUE);
2045 ubidi_setPara(pBidi, src, srcSize, UBIDI_RTL, NULL, &errorCode);
2046 gotLevels=ubidi_getLevels(pBidi, &errorCode);
2063 ubidi_orderParagraphsLTR(pBidi, TRUE);
2070 ubidi_setPara(pBidi, src, srcSize, gotLevel, NULL, &errorCode);
2071 gotLevels=ubidi_getLevels(pBidi, &errorCode);
2087 ubidi_setReorderingMode(pBidi, UBIDI_REORDER_INVERSE_LIKE_DIRECT);
2089 ubidi_setPara(pBidi, src, srcLen, UBIDI_DEFAULT_LTR, NULL, &errorCode);
2090 destLen = ubidi_writeReordered(pBidi, dest, MAXLEN, 0, &errorCode);
2097 ubidi_setPara(pBidi, src, srcLen, UBIDI_DEFAULT_LTR, NULL, &errorCode);
2098 destLen = ubidi_writeReordered(pBidi, dest, MAXLEN, 0, &errorCode);
2107 ubidi_setReorderingMode(pBidi, UBIDI_REORDER_DEFAULT);
2109 ubidi_setPara(pBidi, src, srcLen, UBIDI_LTR, myLevels, &errorCode);
2110 destLen = ubidi_writeReordered(pBidi, dest, MAXLEN, 0, &errorCode);
2116 count = ubidi_countParagraphs(pBidi);
2122 ubidi_close(pBidi);
2127 pBidi = ubidi_open();
2129 ubidi_setPara(pBidi, multiparaTestString, LENGTHOF(multiparaTestString),
2133 ubidi_close(pBidi);
2136 gotLevels = ubidi_getLevels(pBidi, &errorCode);
2139 ubidi_close(pBidi);
2149 ubidi_close(pBidi);
2180 UBiDi *pBiDi;
2185 pBiDi=ubidi_open();
2186 if(pBiDi==NULL) {
2195 _testInverseBidi(pBiDi, testCases[i].s, testCases[i].length, 0, &errorCode);
2202 _testInverseBidi(pBiDi, testCases[i].s, testCases[i].length, 1, &errorCode);
2205 _testManyInverseBidi(pBiDi, 0);
2206 _testManyInverseBidi(pBiDi, 1);
2208 ubidi_close(pBiDi);
2233 _testManyInverseBidi(UBiDi *pBiDi, UBiDiLevel direction) {
2252 _testInverseBidi(pBiDi, text, 8, direction, &errorCode);
2259 _testInverseBidi(UBiDi *pBiDi, const UChar *src, int32_t srcLength,
2268 ubidi_setInverse(pBiDi, TRUE);
2269 if (!ubidi_isInverse(pBiDi)) {
2272 ubidi_setPara(pBiDi, src, srcLength, 0, NULL, pErrorCode);
2273 if (src != ubidi_getText(pBiDi)) {
2276 logicalLength=ubidi_writeReordered(pBiDi, logicalDest, LENGTHOF(logicalDest),
2279 printUnicode(src, srcLength, ubidi_getLevels(pBiDi, pErrorCode));
2283 ubidi_setInverse(pBiDi, FALSE);
2284 if (ubidi_isInverse(pBiDi)) {
2287 ubidi_setPara(pBiDi, logicalDest, logicalLength, 0, NULL, pErrorCode);
2288 visualLength=ubidi_writeReordered(pBiDi, visualDest, LENGTHOF(visualDest),
2300 ubidi_setInverse(pBiDi, TRUE);
2301 ubidi_setPara(pBiDi, visualLTR, ltrLength, 0, NULL, pErrorCode);
2302 logicalLength=ubidi_writeReordered(pBiDi, logicalDest, LENGTHOF(logicalDest),
2305 printUnicode(visualLTR, ltrLength, ubidi_getLevels(pBiDi, pErrorCode));
2309 ubidi_setInverse(pBiDi, FALSE);
2310 ubidi_setPara(pBiDi, logicalDest, logicalLength, 0, NULL, pErrorCode);
2311 visualLength=ubidi_writeReordered(pBiDi, visualDest, LENGTHOF(visualDest),
2315 printUnicode(logicalDest, logicalLength, ubidi_getLevels(pBiDi, pErrorCode));
3380 const char* mode, const char* option, UBiDi* pBiDi) {
3388 "Levels:", formatLevels(pBiDi, formatChars),
3389 "Reordering mode:", ubidi_getReorderingMode(pBiDi), mode,
3390 "Paragraph level:", ubidi_getParaLevel(pBiDi),
3391 "Reordering option:", ubidi_getReorderingOptions(pBiDi), option);
3399 UBiDi* pBiDi = ubidi_open();
3400 if (pBiDi == NULL) {
3403 return pBiDi;
3695 assertRoundTrip(UBiDi *pBiDi, int32_t tc, int32_t outIndex, const char *srcChars,
3795 ubidi_setReorderingMode(pBiDi, mode); \
3822 ubidi_setReorderingOptions(pBiDi, UBIDI_OPTION_REMOVE_CONTROLS);
3824 ubidi_setPara(pBiDi, dest, destLen, level, NULL, &rc);
3827 destLen2 = ubidi_writeReordered(pBiDi, dest2, MAXLEN, UBIDI_DO_MIRRORING,
3833 checkWhatYouCan(pBiDi, destChars3, destChars2);
3859 if (!checkResultLength(pBiDi, destChars, destChars2, destLen2,
3863 if (outIndex > -1 && !checkMaps(pBiDi, outIndex, srcChars, destChars,
3872 checkResultLength(UBiDi *pBiDi, const char *srcChars, const char *destChars,
3879 actualLen = ubidi_getResultLength(pBiDi);
3936 UBiDi *pBiDi = getBiDiObject();
3947 ubidi_close(pBiDi); /* in case this one was allocated */
3950 ubidi_setReorderingMode(pBiDi, UBIDI_REORDER_RUNS_ONLY);
3954 ubidi_setReorderingOptions(pBiDi, option==0 ? UBIDI_OPTION_REMOVE_CONTROLS
3963 ubidi_setPara(pBiDi, src, srcLen, level, NULL, &rc);
3966 destLen = ubidi_writeReordered(pBiDi, dest, MAXLEN, UBIDI_DO_MIRRORING, &rc);
3969 checkWhatYouCan(pBiDi, testCases[i].textIn, destChars);
3973 pBiDi);
3995 pBiDi);
4001 ubidi_setPara(pBiDi, src, 0, UBIDI_LTR, NULL, &rc);
4003 paras = ubidi_countParagraphs(pBiDi);
4008 ubidi_close(pBiDi);
4019 UBiDi *pBiDi = NULL, *pBiDi2 = NULL, *pBiDi3 = NULL;
4030 pBiDi = getBiDiObject();
4034 ubidi_close(pBiDi); /* in case this one was allocated */
4048 ubidi_setReorderingMode(pBiDi, modeValue);
4049 modeBack = ubidi_getReorderingMode(pBiDi);
4057 ubidi_setReorderingOptions(pBiDi, optionValue);
4058 optionBack = ubidi_getReorderingOptions(pBiDi);
4068 ubidi_setPara(pBiDi, src, srcLen, paraLevels[level], NULL, &rc);
4072 destLen = ubidi_writeReordered(pBiDi, dest, MAXLEN,
4078 checkWhatYouCan(pBiDi, srcChars, destChars);
4093 pBiDi)) {
4102 else if (!checkResultLength(pBiDi, srcChars, destChars,
4108 else if (idx > -1 && !checkMaps(pBiDi, idx, srcChars,
4123 ubidi_close(pBiDi);
4128 static const char* inverseBasic(UBiDi *pBiDi, const char *srcChars, int32_t srcLen,
4134 if (pBiDi == NULL || src == NULL) {
4137 ubidi_setReorderingOptions(pBiDi, option);
4139 ubidi_setPara(pBiDi, src, srcLen, level, NULL, &rc);
4143 destLen = ubidi_writeReordered(pBiDi, dest2, MAXLEN,
4148 checkWhatYouCan(pBiDi, srcChars, result);
4189 UBiDi *pBiDi = NULL;
4201 pBiDi = getBiDiObject();
4203 ubidi_orderParagraphsLTR(pBiDi, TRUE);
4216 ubidi_setReorderingOptions(pBiDi, UBIDI_OPTION_STREAMING);
4220 ubidi_setPara(pBiDi, pSrc, len, level, NULL, &rc);
4225 processedLen = ubidi_getProcessedLength(pBiDi);
4227 ubidi_setReorderingOptions(pBiDi, UBIDI_OPTION_DEFAULT);
4231 ubidi_setReorderingOptions(pBiDi, UBIDI_OPTION_STREAMING);
4252 ubidi_close(pBiDi);
4317 UBiDi *pBiDi = NULL;
4326 pBiDi = getBiDiObject();
4327 if(!pBiDi) {
4331 ubidi_getClassCallback(pBiDi, &oldFn, &oldContext);
4334 ubidi_setClassCallback(pBiDi, newFn, textSrc, &oldFn, &oldContext, &rc);
4336 ubidi_close(pBiDi);
4341 ubidi_getClassCallback(pBiDi, &oldFn, &oldContext);
4344 ubidi_setClassCallback(pBiDi, newFn, textSrc, &oldFn, &oldContext, &rc);
4346 ubidi_close(pBiDi);
4352 ubidi_setPara(pBiDi, src, srcLen, UBIDI_LTR, NULL, &rc);
4355 destLen = ubidi_writeReordered(pBiDi, dest, MAXLEN,
4369 ubidi_close(pBiDi);
4392 checkMaps(UBiDi *pBiDi, int32_t stringIndex, const char *src, const char *dest,
4411 ubidi_getLogicalMap(pBiDi, actualLogicalMap, &rc);
4415 srcLen = ubidi_getProcessedLength(pBiDi);
4433 level, ubidi_getParaLevel(pBiDi),
4434 mode, ubidi_getReorderingMode(pBiDi),
4435 option, ubidi_getReorderingOptions(pBiDi),
4440 resLen = ubidi_getResultLength(pBiDi);
4441 ubidi_getVisualMap(pBiDi, actualVisualMap, &rc);
4460 level, ubidi_getParaLevel(pBiDi),
4461 mode, ubidi_getReorderingMode(pBiDi),
4462 option, ubidi_getReorderingOptions(pBiDi),
4468 idx = ubidi_getVisualIndex(pBiDi, i, &rc);
4489 level, ubidi_getParaLevel(pBiDi),
4490 mode, ubidi_getReorderingMode(pBiDi),
4491 option, ubidi_getReorderingOptions(pBiDi),
4497 idx = ubidi_getLogicalIndex(pBiDi, i, &rc);
4518 level, ubidi_getParaLevel(pBiDi),
4519 mode, ubidi_getReorderingMode(pBiDi),
4520 option, ubidi_getReorderingOptions(pBiDi),
4580 UBiDi *pBiDi = NULL;
4590 ubidi_setContext(pBiDi, NULL, 0, NULL, 0, &rc);
4593 pBiDi = getBiDiObject();
4594 ubidi_orderParagraphsLTR(pBiDi, TRUE);
4598 ubidi_setContext(pBiDi, NULL, -2, NULL, 0, &rc);
4602 ubidi_setContext(pBiDi, NULL, 0, NULL, -2, &rc);
4606 ubidi_setContext(pBiDi, NULL, 3, NULL, 0, &rc);
4610 ubidi_setContext(pBiDi, NULL, 0, NULL, 4, &rc);
4622 ubidi_setContext(pBiDi, epilogue, epiLength, prologue, proLength, &rc);
4624 ubidi_setContext(pBiDi, prologue, -1, epilogue, -1, &rc);
4628 ubidi_setPara(pBiDi, src, srcLen, cc.paraLevel, NULL, &rc);
4630 destLen = ubidi_writeReordered(pBiDi, dest, MAXLEN, UBIDI_DO_MIRRORING, &rc);
4643 "Levels:", formatLevels(pBiDi, formatChars),
4644 "Reordering mode:", ubidi_getReorderingMode(pBiDi),
4645 "Paragraph level:", ubidi_getParaLevel(pBiDi),
4646 "Reordering option:", ubidi_getReorderingOptions(pBiDi));
4653 ubidi_close(pBiDi);