| 3455 | } |
| 3456 | |
| 3457 | txInteger fxGetDecompositionBuffer(txInteger character, txInteger* buffer, txFlag compatible) |
| 3458 | { |
| 3459 | txInteger count; |
| 3460 | txU2 *index, code, *it; |
| 3461 | txString data; |
| 3462 | if (character < 0x10000) { |
| 3463 | count = mxDecompositionCount0; |
| 3464 | index = (txU2*)gxDecompositionIndex0; |
| 3465 | data = (txString)gxDecompositionData0; |
| 3466 | code = (txU2)character; |
| 3467 | } |
| 3468 | else if (character < 0x20000) { |
| 3469 | count = mxDecompositionCount1; |
| 3470 | index = (txU2*)gxDecompositionIndex1; |
| 3471 | data = (txString)gxDecompositionData1; |
| 3472 | code = (txU2)(character & 0xFFFF); |
| 3473 | } |
| 3474 | else { |
| 3475 | count = mxDecompositionCount2; |
| 3476 | index = (txU2*)gxDecompositionIndex2; |
| 3477 | data = (txString)gxDecompositionData2; |
| 3478 | code = (txU2)(character & 0xFFFF); |
| 3479 | } |
| 3480 | it = (txU2*)c_bsearch(&code, index, (count - 1) >> 1, sizeof(txU2) << 1, fxCompareComposition); |
| 3481 | if (it) { |
| 3482 | txInteger offset = it[1]; |
| 3483 | txString p, q; |
| 3484 | txInteger* r; |
| 3485 | if (offset & 0x8000) { |
| 3486 | if (!compatible) |
| 3487 | return 0; |
| 3488 | offset &= 0x7FFF; |
| 3489 | } |
| 3490 | p = data + offset; |
| 3491 | q = p + ((it[3] & 0x7FFF) - offset); |
| 3492 | r = buffer; |
| 3493 | while (p < q) |
| 3494 | p = fxUTF8Decode(p, r++); |
| 3495 | return mxPtrDiff(r - buffer); |
| 3496 | } |
| 3497 | return 0; |
| 3498 | } |
| 3499 | |
| 3500 | void fxInsertDecomposition(txMachine* the, txNormalizeBuffer* buffer, txInteger at, txInteger code) |
| 3501 | { |
no test coverage detected