| 557 | // COMMON |
| 558 | |
| 559 | txInteger fxCharCaseCanonicalize(txInteger character, txBoolean flag) |
| 560 | { |
| 561 | txCharCase charCase; |
| 562 | txCharCase* it; |
| 563 | if (character < 0x80) { |
| 564 | if (flag) |
| 565 | it = (txCharCase*)gxCharCaseFold0; |
| 566 | else |
| 567 | it = (txCharCase*)gxCharCaseIgnore0; |
| 568 | if (character < it->code) |
| 569 | it = C_NULL; |
| 570 | else if ((it->code + it->count) <= character) |
| 571 | it = C_NULL; |
| 572 | } |
| 573 | else if (character < 0x10000) { |
| 574 | charCase.code = (txU2)character; |
| 575 | charCase.count = 1; |
| 576 | if (flag) |
| 577 | it = (txCharCase*)c_bsearch(&charCase, gxCharCaseFold0, mxCharCaseFold0Count, sizeof(txCharCase), fxCharCaseCompare); |
| 578 | else |
| 579 | it = (txCharCase*)c_bsearch(&charCase, gxCharCaseIgnore0, mxCharCaseIgnore0Count, sizeof(txCharCase), fxCharCaseCompare); |
| 580 | |
| 581 | } |
| 582 | else { |
| 583 | charCase.code = (txU2)(character & 0xFFFF); |
| 584 | charCase.count = 1; |
| 585 | if (flag) |
| 586 | it = (txCharCase*)c_bsearch(&charCase, gxCharCaseFold1, mxCharCaseFold1Count, sizeof(txCharCase), fxCharCaseCompare); |
| 587 | else |
| 588 | it = C_NULL; |
| 589 | } |
| 590 | if (it) { |
| 591 | txU1 operand = it->operand; |
| 592 | if ((operand & 0x10) && ((character & 1) == 0)) |
| 593 | return character; |
| 594 | if ((operand & 0x20) && (character & 1)) |
| 595 | return character; |
| 596 | if (operand & 0x40) |
| 597 | character += it->delta; |
| 598 | else if (operand & 0x80) |
| 599 | character -= it->delta; |
| 600 | } |
| 601 | return character; |
| 602 | } |
| 603 | |
| 604 | int fxCharCaseCompare(const void *p1, const void *p2) |
| 605 | { |
no outgoing calls
no test coverage detected