606 * Step forward or backward one character in a string. 607 */ 608 public LWCHAR 609step_char(pp, dir, limit) 610 char **pp; 611 signed int dir; 612 char *limit; 613{ 614 LWCHAR ch; 615 char *p = *pp; 616 617 if (!utf_mode) 618 { 619 /* It's easy if chars are one byte. */ 620 if (dir > 0) 621 ch = (LWCHAR) ((p < limit) ? *p++ : 0); 622 else 623 ch = (LWCHAR) ((p > limit) ? *--p : 0); 624 } else if (dir > 0) 625 { 626 if (p + utf_len(*p) > limit) 627 ch = 0; 628 else 629 { 630 ch = get_wchar(p); 631 p++; 632 while (IS_UTF8_TRAIL(*p)) 633 p++; 634 } 635 } else 636 { 637 while (p > limit && IS_UTF8_TRAIL(p[-1])) 638 p--; 639 if (p > limit) 640 ch = get_wchar(--p); 641 else 642 ch = 0; 643 } 644 *pp = p; 645 return ch; 646} 647 648/* 649 * Unicode characters data 650 */ 651struct wchar_range { LWCHAR first, last; }; 652 653/* 654 * Characters with general category values 655 * Mn: Mark, Nonspacing 656 * Me: Mark, Enclosing 657 * Last synched with 658 * <http://www.unicode.org/Public/5.0.0/ucd/UnicodeData-5.0.0d7.txt> 659 * dated 2005-11-30T00:58:48Z 660 */ 661static struct wchar_range comp_table[] = { 662 { 0x0300, 0x036F} /* Mn */, { 0x0483, 0x0486} /* Mn */, 663 { 0x0488, 0x0489} /* Me */, 664 { 0x0591, 0x05BD} /* Mn */, { 0x05BF, 0x05BF} /* Mn */, 665 { 0x05C1, 0x05C2} /* Mn */, { 0x05C4, 0x05C5} /* Mn */, 666 { 0x05C7, 0x05C7} /* Mn */, { 0x0610, 0x0615} /* Mn */, 667 { 0x064B, 0x065E} /* Mn */, { 0x0670, 0x0670} /* Mn */, 668 { 0x06D6, 0x06DC} /* Mn */, 669 { 0x06DE, 0x06DE} /* Me */, 670 { 0x06DF, 0x06E4} /* Mn */, { 0x06E7, 0x06E8} /* Mn */, 671 { 0x06EA, 0x06ED} /* Mn */, { 0x0711, 0x0711} /* Mn */, 672 { 0x0730, 0x074A} /* Mn */, { 0x07A6, 0x07B0} /* Mn */, 673 { 0x07EB, 0x07F3} /* Mn */, { 0x0901, 0x0902} /* Mn */, 674 { 0x093C, 0x093C} /* Mn */, { 0x0941, 0x0948} /* Mn */, 675 { 0x094D, 0x094D} /* Mn */, { 0x0951, 0x0954} /* Mn */, 676 { 0x0962, 0x0963} /* Mn */, { 0x0981, 0x0981} /* Mn */, 677 { 0x09BC, 0x09BC} /* Mn */, { 0x09C1, 0x09C4} /* Mn */, 678 { 0x09CD, 0x09CD} /* Mn */, { 0x09E2, 0x09E3} /* Mn */, 679 { 0x0A01, 0x0A02} /* Mn */, { 0x0A3C, 0x0A3C} /* Mn */, 680 { 0x0A41, 0x0A42} /* Mn */, { 0x0A47, 0x0A48} /* Mn */, 681 { 0x0A4B, 0x0A4D} /* Mn */, { 0x0A70, 0x0A71} /* Mn */, 682 { 0x0A81, 0x0A82} /* Mn */, { 0x0ABC, 0x0ABC} /* Mn */, 683 { 0x0AC1, 0x0AC5} /* Mn */, { 0x0AC7, 0x0AC8} /* Mn */, 684 { 0x0ACD, 0x0ACD} /* Mn */, { 0x0AE2, 0x0AE3} /* Mn */, 685 { 0x0B01, 0x0B01} /* Mn */, { 0x0B3C, 0x0B3C} /* Mn */, 686 { 0x0B3F, 0x0B3F} /* Mn */, { 0x0B41, 0x0B43} /* Mn */, 687 { 0x0B4D, 0x0B4D} /* Mn */, { 0x0B56, 0x0B56} /* Mn */, 688 { 0x0B82, 0x0B82} /* Mn */, { 0x0BC0, 0x0BC0} /* Mn */, 689 { 0x0BCD, 0x0BCD} /* Mn */, { 0x0C3E, 0x0C40} /* Mn */, 690 { 0x0C46, 0x0C48} /* Mn */, { 0x0C4A, 0x0C4D} /* Mn */, 691 { 0x0C55, 0x0C56} /* Mn */, { 0x0CBC, 0x0CBC} /* Mn */, 692 { 0x0CBF, 0x0CBF} /* Mn */, { 0x0CC6, 0x0CC6} /* Mn */, 693 { 0x0CCC, 0x0CCD} /* Mn */, { 0x0CE2, 0x0CE3} /* Mn */, 694 { 0x0D41, 0x0D43} /* Mn */, { 0x0D4D, 0x0D4D} /* Mn */, 695 { 0x0DCA, 0x0DCA} /* Mn */, { 0x0DD2, 0x0DD4} /* Mn */, 696 { 0x0DD6, 0x0DD6} /* Mn */, { 0x0E31, 0x0E31} /* Mn */, 697 { 0x0E34, 0x0E3A} /* Mn */, { 0x0E47, 0x0E4E} /* Mn */, 698 { 0x0EB1, 0x0EB1} /* Mn */, { 0x0EB4, 0x0EB9} /* Mn */, 699 { 0x0EBB, 0x0EBC} /* Mn */, { 0x0EC8, 0x0ECD} /* Mn */, 700 { 0x0F18, 0x0F19} /* Mn */, { 0x0F35, 0x0F35} /* Mn */, 701 { 0x0F37, 0x0F37} /* Mn */, { 0x0F39, 0x0F39} /* Mn */, 702 { 0x0F71, 0x0F7E} /* Mn */, { 0x0F80, 0x0F84} /* Mn */, 703 { 0x0F86, 0x0F87} /* Mn */, { 0x0F90, 0x0F97} /* Mn */, 704 { 0x0F99, 0x0FBC} /* Mn */, { 0x0FC6, 0x0FC6} /* Mn */, 705 { 0x102D, 0x1030} /* Mn */, { 0x1032, 0x1032} /* Mn */, 706 { 0x1036, 0x1037} /* Mn */, { 0x1039, 0x1039} /* Mn */, 707 { 0x1058, 0x1059} /* Mn */, { 0x135F, 0x135F} /* Mn */, 708 { 0x1712, 0x1714} /* Mn */, { 0x1732, 0x1734} /* Mn */, 709 { 0x1752, 0x1753} /* Mn */, { 0x1772, 0x1773} /* Mn */, 710 { 0x17B7, 0x17BD} /* Mn */, { 0x17C6, 0x17C6} /* Mn */, 711 { 0x17C9, 0x17D3} /* Mn */, { 0x17DD, 0x17DD} /* Mn */, 712 { 0x180B, 0x180D} /* Mn */, { 0x18A9, 0x18A9} /* Mn */, 713 { 0x1920, 0x1922} /* Mn */, { 0x1927, 0x1928} /* Mn */, 714 { 0x1932, 0x1932} /* Mn */, { 0x1939, 0x193B} /* Mn */, 715 { 0x1A17, 0x1A18} /* Mn */, { 0x1B00, 0x1B03} /* Mn */, 716 { 0x1B34, 0x1B34} /* Mn */, { 0x1B36, 0x1B3A} /* Mn */, 717 { 0x1B3C, 0x1B3C} /* Mn */, { 0x1B42, 0x1B42} /* Mn */, 718 { 0x1B6B, 0x1B73} /* Mn */, { 0x1DC0, 0x1DCA} /* Mn */, 719 { 0x1DFE, 0x1DFF} /* Mn */, { 0x20D0, 0x20DC} /* Mn */, 720 { 0x20DD, 0x20E0} /* Me */, 721 { 0x20E1, 0x20E1} /* Mn */, 722 { 0x20E2, 0x20E4} /* Me */, 723 { 0x20E5, 0x20EF} /* Mn */, { 0x302A, 0x302F} /* Mn */, 724 { 0x3099, 0x309A} /* Mn */, { 0xA806, 0xA806} /* Mn */, 725 { 0xA80B, 0xA80B} /* Mn */, { 0xA825, 0xA826} /* Mn */, 726 { 0xFB1E, 0xFB1E} /* Mn */, { 0xFE00, 0xFE0F} /* Mn */, 727 { 0xFE20, 0xFE23} /* Mn */, { 0x10A01, 0x10A03} /* Mn */, 728 { 0x10A05, 0x10A06} /* Mn */, { 0x10A0C, 0x10A0F} /* Mn */, 729 { 0x10A38, 0x10A3A} /* Mn */, { 0x10A3F, 0x10A3F} /* Mn */, 730 { 0x1D167, 0x1D169} /* Mn */, { 0x1D17B, 0x1D182} /* Mn */, 731 { 0x1D185, 0x1D18B} /* Mn */, { 0x1D1AA, 0x1D1AD} /* Mn */, 732 { 0x1D242, 0x1D244} /* Mn */, { 0xE0100, 0xE01EF} /* Mn */, 733}; 734 735/* 736 * Special pairs, not ranges. 737 */ 738static struct wchar_range comb_table[] = { 739 {0x0644,0x0622}, {0x0644,0x0623}, {0x0644,0x0625}, {0x0644,0x0627}, 740}; 741 742/* 743 * Characters with general category values 744 * Cc: Other, Control 745 * Cf: Other, Format 746 * Cs: Other, Surrogate 747 * Co: Other, Private Use 748 * Cn: Other, Not Assigned 749 * Zl: Separator, Line 750 * Zp: Separator, Paragraph 751 * Last synched with 752 * <http://www.unicode.org/Public/5.0.0/ucd/UnicodeData-5.0.0d7.txt> 753 * dated 2005-11-30T00:58:48Z 754 */ 755static struct wchar_range ubin_table[] = { 756 { 0x0000, 0x001F} /* Cc */, { 0x007F, 0x009F} /* Cc */, 757#if 0 758 { 0x00AD, 0x00AD} /* Cf */, 759#endif 760 { 0x0370, 0x0373} /* Cn */, { 0x0376, 0x0379} /* Cn */, 761 { 0x037F, 0x0383} /* Cn */, { 0x038B, 0x038B} /* Cn */, 762 { 0x038D, 0x038D} /* Cn */, { 0x03A2, 0x03A2} /* Cn */, 763 { 0x03CF, 0x03CF} /* Cn */, { 0x0487, 0x0487} /* Cn */, 764 { 0x0514, 0x0530} /* Cn */, { 0x0557, 0x0558} /* Cn */, 765 { 0x0560, 0x0560} /* Cn */, { 0x0588, 0x0588} /* Cn */, 766 { 0x058B, 0x0590} /* Cn */, { 0x05C8, 0x05CF} /* Cn */, 767 { 0x05EB, 0x05EF} /* Cn */, { 0x05F5, 0x05FF} /* Cn */, 768#if 0 769 { 0x0600, 0x0603} /* Cf */, 770#endif 771 { 0x0604, 0x060A} /* Cn */, { 0x0616, 0x061A} /* Cn */, 772 { 0x061C, 0x061D} /* Cn */, { 0x0620, 0x0620} /* Cn */, 773 { 0x063B, 0x063F} /* Cn */, { 0x065F, 0x065F} /* Cn */, 774#if 0 775 { 0x06DD, 0x06DD} /* Cf */, 776#endif 777 { 0x070E, 0x070E} /* Cn */, 778#if 0 779 { 0x070F, 0x070F} /* Cf */, 780#endif 781 { 0x074B, 0x074C} /* Cn */, { 0x076E, 0x077F} /* Cn */, 782 { 0x07B2, 0x07BF} /* Cn */, { 0x07FB, 0x0900} /* Cn */, 783 { 0x093A, 0x093B} /* Cn */, { 0x094E, 0x094F} /* Cn */, 784 { 0x0955, 0x0957} /* Cn */, { 0x0971, 0x097A} /* Cn */, 785 { 0x0980, 0x0980} /* Cn */, { 0x0984, 0x0984} /* Cn */, 786 { 0x098D, 0x098E} /* Cn */, { 0x0991, 0x0992} /* Cn */, 787 { 0x09A9, 0x09A9} /* Cn */, { 0x09B1, 0x09B1} /* Cn */, 788 { 0x09B3, 0x09B5} /* Cn */, { 0x09BA, 0x09BB} /* Cn */, 789 { 0x09C5, 0x09C6} /* Cn */, { 0x09C9, 0x09CA} /* Cn */, 790 { 0x09CF, 0x09D6} /* Cn */, { 0x09D8, 0x09DB} /* Cn */, 791 { 0x09DE, 0x09DE} /* Cn */, { 0x09E4, 0x09E5} /* Cn */, 792 { 0x09FB, 0x0A00} /* Cn */, { 0x0A04, 0x0A04} /* Cn */, 793 { 0x0A0B, 0x0A0E} /* Cn */, { 0x0A11, 0x0A12} /* Cn */, 794 { 0x0A29, 0x0A29} /* Cn */, { 0x0A31, 0x0A31} /* Cn */, 795 { 0x0A34, 0x0A34} /* Cn */, { 0x0A37, 0x0A37} /* Cn */, 796 { 0x0A3A, 0x0A3B} /* Cn */, { 0x0A3D, 0x0A3D} /* Cn */, 797 { 0x0A43, 0x0A46} /* Cn */, { 0x0A49, 0x0A4A} /* Cn */, 798 { 0x0A4E, 0x0A58} /* Cn */, { 0x0A5D, 0x0A5D} /* Cn */, 799 { 0x0A5F, 0x0A65} /* Cn */, { 0x0A75, 0x0A80} /* Cn */, 800 { 0x0A84, 0x0A84} /* Cn */, { 0x0A8E, 0x0A8E} /* Cn */, 801 { 0x0A92, 0x0A92} /* Cn */, { 0x0AA9, 0x0AA9} /* Cn */, 802 { 0x0AB1, 0x0AB1} /* Cn */, { 0x0AB4, 0x0AB4} /* Cn */, 803 { 0x0ABA, 0x0ABB} /* Cn */, { 0x0AC6, 0x0AC6} /* Cn */, 804 { 0x0ACA, 0x0ACA} /* Cn */, { 0x0ACE, 0x0ACF} /* Cn */, 805 { 0x0AD1, 0x0ADF} /* Cn */, { 0x0AE4, 0x0AE5} /* Cn */, 806 { 0x0AF0, 0x0AF0} /* Cn */, { 0x0AF2, 0x0B00} /* Cn */, 807 { 0x0B04, 0x0B04} /* Cn */, { 0x0B0D, 0x0B0E} /* Cn */, 808 { 0x0B11, 0x0B12} /* Cn */, { 0x0B29, 0x0B29} /* Cn */, 809 { 0x0B31, 0x0B31} /* Cn */, { 0x0B34, 0x0B34} /* Cn */, 810 { 0x0B3A, 0x0B3B} /* Cn */, { 0x0B44, 0x0B46} /* Cn */, 811 { 0x0B49, 0x0B4A} /* Cn */, { 0x0B4E, 0x0B55} /* Cn */, 812 { 0x0B58, 0x0B5B} /* Cn */, { 0x0B5E, 0x0B5E} /* Cn */, 813 { 0x0B62, 0x0B65} /* Cn */, { 0x0B72, 0x0B81} /* Cn */, 814 { 0x0B84, 0x0B84} /* Cn */, { 0x0B8B, 0x0B8D} /* Cn */, 815 { 0x0B91, 0x0B91} /* Cn */, { 0x0B96, 0x0B98} /* Cn */, 816 { 0x0B9B, 0x0B9B} /* Cn */, { 0x0B9D, 0x0B9D} /* Cn */, 817 { 0x0BA0, 0x0BA2} /* Cn */, { 0x0BA5, 0x0BA7} /* Cn */, 818 { 0x0BAB, 0x0BAD} /* Cn */, { 0x0BBA, 0x0BBD} /* Cn */, 819 { 0x0BC3, 0x0BC5} /* Cn */, { 0x0BC9, 0x0BC9} /* Cn */, 820 { 0x0BCE, 0x0BD6} /* Cn */, { 0x0BD8, 0x0BE5} /* Cn */, 821 { 0x0BFB, 0x0C00} /* Cn */, { 0x0C04, 0x0C04} /* Cn */, 822 { 0x0C0D, 0x0C0D} /* Cn */, { 0x0C11, 0x0C11} /* Cn */, 823 { 0x0C29, 0x0C29} /* Cn */, { 0x0C34, 0x0C34} /* Cn */, 824 { 0x0C3A, 0x0C3D} /* Cn */, { 0x0C45, 0x0C45} /* Cn */, 825 { 0x0C49, 0x0C49} /* Cn */, { 0x0C4E, 0x0C54} /* Cn */, 826 { 0x0C57, 0x0C5F} /* Cn */, { 0x0C62, 0x0C65} /* Cn */, 827 { 0x0C70, 0x0C81} /* Cn */, { 0x0C84, 0x0C84} /* Cn */, 828 { 0x0C8D, 0x0C8D} /* Cn */, { 0x0C91, 0x0C91} /* Cn */, 829 { 0x0CA9, 0x0CA9} /* Cn */, { 0x0CB4, 0x0CB4} /* Cn */, 830 { 0x0CBA, 0x0CBB} /* Cn */, { 0x0CC5, 0x0CC5} /* Cn */, 831 { 0x0CC9, 0x0CC9} /* Cn */, { 0x0CCE, 0x0CD4} /* Cn */, 832 { 0x0CD7, 0x0CDD} /* Cn */, { 0x0CDF, 0x0CDF} /* Cn */, 833 { 0x0CE4, 0x0CE5} /* Cn */, { 0x0CF0, 0x0CF0} /* Cn */, 834 { 0x0CF3, 0x0D01} /* Cn */, { 0x0D04, 0x0D04} /* Cn */, 835 { 0x0D0D, 0x0D0D} /* Cn */, { 0x0D11, 0x0D11} /* Cn */, 836 { 0x0D29, 0x0D29} /* Cn */, { 0x0D3A, 0x0D3D} /* Cn */, 837 { 0x0D44, 0x0D45} /* Cn */, { 0x0D49, 0x0D49} /* Cn */, 838 { 0x0D4E, 0x0D56} /* Cn */, { 0x0D58, 0x0D5F} /* Cn */, 839 { 0x0D62, 0x0D65} /* Cn */, { 0x0D70, 0x0D81} /* Cn */, 840 { 0x0D84, 0x0D84} /* Cn */, { 0x0D97, 0x0D99} /* Cn */, 841 { 0x0DB2, 0x0DB2} /* Cn */, { 0x0DBC, 0x0DBC} /* Cn */, 842 { 0x0DBE, 0x0DBF} /* Cn */, { 0x0DC7, 0x0DC9} /* Cn */, 843 { 0x0DCB, 0x0DCE} /* Cn */, { 0x0DD5, 0x0DD5} /* Cn */, 844 { 0x0DD7, 0x0DD7} /* Cn */, { 0x0DE0, 0x0DF1} /* Cn */, 845 { 0x0DF5, 0x0E00} /* Cn */, { 0x0E3B, 0x0E3E} /* Cn */, 846 { 0x0E5C, 0x0E80} /* Cn */, { 0x0E83, 0x0E83} /* Cn */, 847 { 0x0E85, 0x0E86} /* Cn */, { 0x0E89, 0x0E89} /* Cn */, 848 { 0x0E8B, 0x0E8C} /* Cn */, { 0x0E8E, 0x0E93} /* Cn */, 849 { 0x0E98, 0x0E98} /* Cn */, { 0x0EA0, 0x0EA0} /* Cn */, 850 { 0x0EA4, 0x0EA4} /* Cn */, { 0x0EA6, 0x0EA6} /* Cn */, 851 { 0x0EA8, 0x0EA9} /* Cn */, { 0x0EAC, 0x0EAC} /* Cn */, 852 { 0x0EBA, 0x0EBA} /* Cn */, { 0x0EBE, 0x0EBF} /* Cn */, 853 { 0x0EC5, 0x0EC5} /* Cn */, { 0x0EC7, 0x0EC7} /* Cn */, 854 { 0x0ECE, 0x0ECF} /* Cn */, { 0x0EDA, 0x0EDB} /* Cn */, 855 { 0x0EDE, 0x0EFF} /* Cn */, { 0x0F48, 0x0F48} /* Cn */, 856 { 0x0F6B, 0x0F70} /* Cn */, { 0x0F8C, 0x0F8F} /* Cn */, 857 { 0x0F98, 0x0F98} /* Cn */, { 0x0FBD, 0x0FBD} /* Cn */, 858 { 0x0FCD, 0x0FCE} /* Cn */, { 0x0FD2, 0x0FFF} /* Cn */, 859 { 0x1022, 0x1022} /* Cn */, { 0x1028, 0x1028} /* Cn */, 860 { 0x102B, 0x102B} /* Cn */, { 0x1033, 0x1035} /* Cn */, 861 { 0x103A, 0x103F} /* Cn */, { 0x105A, 0x109F} /* Cn */, 862 { 0x10C6, 0x10CF} /* Cn */, { 0x10FD, 0x10FF} /* Cn */, 863 { 0x115A, 0x115E} /* Cn */, { 0x11A3, 0x11A7} /* Cn */, 864 { 0x11FA, 0x11FF} /* Cn */, { 0x1249, 0x1249} /* Cn */, 865 { 0x124E, 0x124F} /* Cn */, { 0x1257, 0x1257} /* Cn */, 866 { 0x1259, 0x1259} /* Cn */, { 0x125E, 0x125F} /* Cn */, 867 { 0x1289, 0x1289} /* Cn */, { 0x128E, 0x128F} /* Cn */, 868 { 0x12B1, 0x12B1} /* Cn */, { 0x12B6, 0x12B7} /* Cn */, 869 { 0x12BF, 0x12BF} /* Cn */, { 0x12C1, 0x12C1} /* Cn */, 870 { 0x12C6, 0x12C7} /* Cn */, { 0x12D7, 0x12D7} /* Cn */, 871 { 0x1311, 0x1311} /* Cn */, { 0x1316, 0x1317} /* Cn */, 872 { 0x135B, 0x135E} /* Cn */, { 0x137D, 0x137F} /* Cn */, 873 { 0x139A, 0x139F} /* Cn */, { 0x13F5, 0x1400} /* Cn */, 874 { 0x1677, 0x167F} /* Cn */, { 0x169D, 0x169F} /* Cn */, 875 { 0x16F1, 0x16FF} /* Cn */, { 0x170D, 0x170D} /* Cn */, 876 { 0x1715, 0x171F} /* Cn */, { 0x1737, 0x173F} /* Cn */, 877 { 0x1754, 0x175F} /* Cn */, { 0x176D, 0x176D} /* Cn */, 878 { 0x1771, 0x1771} /* Cn */, { 0x1774, 0x177F} /* Cn */, 879#if 0 880 { 0x17B4, 0x17B5} /* Cf */, 881#endif 882 { 0x17DE, 0x17DF} /* Cn */, { 0x17EA, 0x17EF} /* Cn */, 883 { 0x17FA, 0x17FF} /* Cn */, { 0x180F, 0x180F} /* Cn */, 884 { 0x181A, 0x181F} /* Cn */, { 0x1878, 0x187F} /* Cn */, 885 { 0x18AA, 0x18FF} /* Cn */, { 0x191D, 0x191F} /* Cn */, 886 { 0x192C, 0x192F} /* Cn */, { 0x193C, 0x193F} /* Cn */, 887 { 0x1941, 0x1943} /* Cn */, { 0x196E, 0x196F} /* Cn */, 888 { 0x1975, 0x197F} /* Cn */, { 0x19AA, 0x19AF} /* Cn */, 889 { 0x19CA, 0x19CF} /* Cn */, { 0x19DA, 0x19DD} /* Cn */, 890 { 0x1A1C, 0x1A1D} /* Cn */, { 0x1A20, 0x1AFF} /* Cn */, 891 { 0x1B4C, 0x1B4F} /* Cn */, { 0x1B7D, 0x1CFF} /* Cn */, 892 { 0x1DCB, 0x1DFD} /* Cn */, { 0x1E9C, 0x1E9F} /* Cn */, 893 { 0x1EFA, 0x1EFF} /* Cn */, { 0x1F16, 0x1F17} /* Cn */, 894 { 0x1F1E, 0x1F1F} /* Cn */, { 0x1F46, 0x1F47} /* Cn */, 895 { 0x1F4E, 0x1F4F} /* Cn */, { 0x1F58, 0x1F58} /* Cn */, 896 { 0x1F5A, 0x1F5A} /* Cn */, { 0x1F5C, 0x1F5C} /* Cn */, 897 { 0x1F5E, 0x1F5E} /* Cn */, { 0x1F7E, 0x1F7F} /* Cn */, 898 { 0x1FB5, 0x1FB5} /* Cn */, { 0x1FC5, 0x1FC5} /* Cn */, 899 { 0x1FD4, 0x1FD5} /* Cn */, { 0x1FDC, 0x1FDC} /* Cn */, 900 { 0x1FF0, 0x1FF1} /* Cn */, { 0x1FF5, 0x1FF5} /* Cn */, 901 { 0x1FFF, 0x1FFF} /* Cn */, 902 { 0x200B, 0x200F} /* Cf */, 903 { 0x2028, 0x2028} /* Zl */, 904 { 0x2029, 0x2029} /* Zp */, 905 { 0x202A, 0x202E} /* Cf */, 906 { 0x2060, 0x2063} /* Cf */, 907 { 0x2064, 0x2069} /* Cn */, 908 { 0x206A, 0x206F} /* Cf */, 909 { 0x2072, 0x2073} /* Cn */, { 0x208F, 0x208F} /* Cn */, 910 { 0x2095, 0x209F} /* Cn */, { 0x20B6, 0x20CF} /* Cn */, 911 { 0x20F0, 0x20FF} /* Cn */, { 0x214F, 0x2152} /* Cn */, 912 { 0x2185, 0x218F} /* Cn */, { 0x23E8, 0x23FF} /* Cn */, 913 { 0x2427, 0x243F} /* Cn */, { 0x244B, 0x245F} /* Cn */, 914 { 0x269D, 0x269F} /* Cn */, { 0x26B3, 0x2700} /* Cn */, 915 { 0x2705, 0x2705} /* Cn */, { 0x270A, 0x270B} /* Cn */, 916 { 0x2728, 0x2728} /* Cn */, { 0x274C, 0x274C} /* Cn */, 917 { 0x274E, 0x274E} /* Cn */, { 0x2753, 0x2755} /* Cn */, 918 { 0x2757, 0x2757} /* Cn */, { 0x275F, 0x2760} /* Cn */, 919 { 0x2795, 0x2797} /* Cn */, { 0x27B0, 0x27B0} /* Cn */, 920 { 0x27BF, 0x27BF} /* Cn */, { 0x27CB, 0x27CF} /* Cn */, 921 { 0x27EC, 0x27EF} /* Cn */, { 0x2B1B, 0x2B1F} /* Cn */, 922 { 0x2B24, 0x2BFF} /* Cn */, { 0x2C2F, 0x2C2F} /* Cn */, 923 { 0x2C5F, 0x2C5F} /* Cn */, { 0x2C6D, 0x2C73} /* Cn */, 924 { 0x2C78, 0x2C7F} /* Cn */, { 0x2CEB, 0x2CF8} /* Cn */, 925 { 0x2D26, 0x2D2F} /* Cn */, { 0x2D66, 0x2D6E} /* Cn */, 926 { 0x2D70, 0x2D7F} /* Cn */, { 0x2D97, 0x2D9F} /* Cn */, 927 { 0x2DA7, 0x2DA7} /* Cn */, { 0x2DAF, 0x2DAF} /* Cn */, 928 { 0x2DB7, 0x2DB7} /* Cn */, { 0x2DBF, 0x2DBF} /* Cn */, 929 { 0x2DC7, 0x2DC7} /* Cn */, { 0x2DCF, 0x2DCF} /* Cn */, 930 { 0x2DD7, 0x2DD7} /* Cn */, { 0x2DDF, 0x2DFF} /* Cn */, 931 { 0x2E18, 0x2E1B} /* Cn */, { 0x2E1E, 0x2E7F} /* Cn */, 932 { 0x2E9A, 0x2E9A} /* Cn */, { 0x2EF4, 0x2EFF} /* Cn */, 933 { 0x2FD6, 0x2FEF} /* Cn */, { 0x2FFC, 0x2FFF} /* Cn */, 934 { 0x3040, 0x3040} /* Cn */, { 0x3097, 0x3098} /* Cn */, 935 { 0x3100, 0x3104} /* Cn */, { 0x312D, 0x3130} /* Cn */, 936 { 0x318F, 0x318F} /* Cn */, { 0x31B8, 0x31BF} /* Cn */, 937 { 0x31D0, 0x31EF} /* Cn */, { 0x321F, 0x321F} /* Cn */, 938 { 0x3244, 0x324F} /* Cn */, { 0x32FF, 0x32FF} /* Cn */, 939 { 0x4DB6, 0x4DBF} /* Cn */, { 0x9FBC, 0x9FFF} /* Cn */, 940 { 0xA48D, 0xA48F} /* Cn */, { 0xA4C7, 0xA6FF} /* Cn */, 941 { 0xA71B, 0xA71F} /* Cn */, { 0xA722, 0xA7FF} /* Cn */, 942 { 0xA82C, 0xA83F} /* Cn */, { 0xA878, 0xABFF} /* Cn */, 943 { 0xD7A4, 0xD7FF} /* Cn */, 944 { 0xD800, 0xDFFF} /* Cs */, 945 { 0xE000, 0xF8FF} /* Co */, 946 { 0xFA2E, 0xFA2F} /* Cn */, { 0xFA6B, 0xFA6F} /* Cn */, 947 { 0xFADA, 0xFAFF} /* Cn */, { 0xFB07, 0xFB12} /* Cn */, 948 { 0xFB18, 0xFB1C} /* Cn */, { 0xFB37, 0xFB37} /* Cn */, 949 { 0xFB3D, 0xFB3D} /* Cn */, { 0xFB3F, 0xFB3F} /* Cn */, 950 { 0xFB42, 0xFB42} /* Cn */, { 0xFB45, 0xFB45} /* Cn */, 951 { 0xFBB2, 0xFBD2} /* Cn */, { 0xFD40, 0xFD4F} /* Cn */, 952 { 0xFD90, 0xFD91} /* Cn */, { 0xFDC8, 0xFDEF} /* Cn */, 953 { 0xFDFE, 0xFDFF} /* Cn */, { 0xFE1A, 0xFE1F} /* Cn */, 954 { 0xFE24, 0xFE2F} /* Cn */, { 0xFE53, 0xFE53} /* Cn */, 955 { 0xFE67, 0xFE67} /* Cn */, { 0xFE6C, 0xFE6F} /* Cn */, 956 { 0xFE75, 0xFE75} /* Cn */, { 0xFEFD, 0xFEFE} /* Cn */, 957 { 0xFEFF, 0xFEFF} /* Cf */, 958 { 0xFF00, 0xFF00} /* Cn */, { 0xFFBF, 0xFFC1} /* Cn */, 959 { 0xFFC8, 0xFFC9} /* Cn */, { 0xFFD0, 0xFFD1} /* Cn */, 960 { 0xFFD8, 0xFFD9} /* Cn */, { 0xFFDD, 0xFFDF} /* Cn */, 961 { 0xFFE7, 0xFFE7} /* Cn */, { 0xFFEF, 0xFFF8} /* Cn */, 962 { 0xFFF9, 0xFFFB} /* Cf */, 963 { 0xFFFE, 0xFFFF} /* Cn */, { 0x1000C, 0x1000C} /* Cn */, 964 { 0x10027, 0x10027} /* Cn */, { 0x1003B, 0x1003B} /* Cn */, 965 { 0x1003E, 0x1003E} /* Cn */, { 0x1004E, 0x1004F} /* Cn */, 966 { 0x1005E, 0x1007F} /* Cn */, { 0x100FB, 0x100FF} /* Cn */, 967 { 0x10103, 0x10106} /* Cn */, { 0x10134, 0x10136} /* Cn */, 968 { 0x1018B, 0x102FF} /* Cn */, { 0x1031F, 0x1031F} /* Cn */, 969 { 0x10324, 0x1032F} /* Cn */, { 0x1034B, 0x1037F} /* Cn */, 970 { 0x1039E, 0x1039E} /* Cn */, { 0x103C4, 0x103C7} /* Cn */, 971 { 0x103D6, 0x103FF} /* Cn */, 972 { 0x1049E, 0x1049F} /* Cn */, { 0x104AA, 0x107FF} /* Cn */, 973 { 0x10806, 0x10807} /* Cn */, { 0x10809, 0x10809} /* Cn */, 974 { 0x10836, 0x10836} /* Cn */, { 0x10839, 0x1083B} /* Cn */, 975 { 0x1083D, 0x1083E} /* Cn */, { 0x10840, 0x108FF} /* Cn */, 976 { 0x1091A, 0x1091E} /* Cn */, { 0x10920, 0x109FF} /* Cn */, 977 { 0x10A04, 0x10A04} /* Cn */, { 0x10A07, 0x10A0B} /* Cn */, 978 { 0x10A14, 0x10A14} /* Cn */, { 0x10A18, 0x10A18} /* Cn */, 979 { 0x10A34, 0x10A37} /* Cn */, { 0x10A3B, 0x10A3E} /* Cn */, 980 { 0x10A48, 0x10A4F} /* Cn */, { 0x10A59, 0x11FFF} /* Cn */, 981 { 0x1236F, 0x123FF} /* Cn */, { 0x12463, 0x1246F} /* Cn */, 982 { 0x12474, 0x1CFFF} /* Cn */, { 0x1D0F6, 0x1D0FF} /* Cn */, 983 { 0x1D127, 0x1D129} /* Cn */, 984 { 0x1D173, 0x1D17A} /* Cf */, 985 { 0x1D1DE, 0x1D1FF} /* Cn */, { 0x1D246, 0x1D2FF} /* Cn */, 986 { 0x1D357, 0x1D35F} /* Cn */, { 0x1D372, 0x1D3FF} /* Cn */, 987 { 0x1D455, 0x1D455} /* Cn */, { 0x1D49D, 0x1D49D} /* Cn */, 988 { 0x1D4A0, 0x1D4A1} /* Cn */, { 0x1D4A3, 0x1D4A4} /* Cn */, 989 { 0x1D4A7, 0x1D4A8} /* Cn */, { 0x1D4AD, 0x1D4AD} /* Cn */, 990 { 0x1D4BA, 0x1D4BA} /* Cn */, { 0x1D4BC, 0x1D4BC} /* Cn */, 991 { 0x1D4C4, 0x1D4C4} /* Cn */, { 0x1D506, 0x1D506} /* Cn */, 992 { 0x1D50B, 0x1D50C} /* Cn */, { 0x1D515, 0x1D515} /* Cn */, 993 { 0x1D51D, 0x1D51D} /* Cn */, { 0x1D53A, 0x1D53A} /* Cn */, 994 { 0x1D53F, 0x1D53F} /* Cn */, { 0x1D545, 0x1D545} /* Cn */, 995 { 0x1D547, 0x1D549} /* Cn */, { 0x1D551, 0x1D551} /* Cn */, 996 { 0x1D6A6, 0x1D6A7} /* Cn */, { 0x1D7CC, 0x1D7CD} /* Cn */, 997 { 0x1D800, 0x1FFFF} /* Cn */, { 0x2A6D7, 0x2F7FF} /* Cn */, 998 { 0x2FA1E, 0xE0000} /* Cn */, 999 { 0xE0001, 0xE0001} /* Cf */, 1000 { 0xE0002, 0xE001F} /* Cn */, 1001 { 0xE0020, 0xE007F} /* Cf */, 1002 { 0xE0080, 0xE00FF} /* Cn */, { 0xE01F0, 0xEFFFF} /* Cn */, 1003 { 0xF0000, 0xFFFFD} /* Co */, 1004 { 0xFFFFE, 0xFFFFF} /* Cn */, 1005 {0x100000,0x10FFFD} /* Co */, 1006 {0x10FFFE,0x10FFFF} /* Cn */, 1007 {0x110000,0x7FFFFFFF} /* ISO 10646?? */ 1008}; 1009 1010/* 1011 * Double width characters 1012 * W: East Asian Wide 1013 * F: East Asian Full-width 1014 * Unassigned code points may be included when they allow ranges to be merged. 1015 * Last synched with 1016 * <http://www.unicode.org/Public/5.0.0/ucd/EastAsianWidth-5.0.0d2.txt> 1017 * dated 2005-11-08T01:32:56Z 1018 */ 1019static struct wchar_range wide_table[] = { 1020 { 0x1100, 0x115F} /* W */, { 0x2329, 0x232A} /* W */, 1021 { 0x2E80, 0x2FFB} /* W */, 1022 { 0x3000, 0x3000} /* F */, 1023 { 0x3001, 0x303E} /* W */, { 0x3041, 0x4DB5} /* W */, 1024 { 0x4E00, 0x9FBB} /* W */, { 0xA000, 0xA4C6} /* W */, 1025 { 0xAC00, 0xD7A3} /* W */, { 0xF900, 0xFAD9} /* W */, 1026 { 0xFE10, 0xFE19} /* W */, { 0xFE30, 0xFE6B} /* W */, 1027 { 0xFF01, 0xFF60} /* F */, { 0xFFE0, 0xFFE6} /* F */, 1028 { 0x20000, 0x2FFFD} /* W */, { 0x30000, 0x3FFFD} /* W */, 1029}; 1030 1031 static int 1032is_in_table(ch, table, tsize) 1033 LWCHAR ch; 1034 struct wchar_range table[]; 1035 int tsize; 1036{ 1037 int hi; 1038 int lo; 1039 1040 /* Binary search in the table. */ 1041 if (ch < table[0].first) 1042 return 0; 1043 lo = 0; 1044 hi = tsize - 1; 1045 while (lo <= hi) 1046 { 1047 int mid = (lo + hi) / 2; 1048 if (ch > table[mid].last) 1049 lo = mid + 1; 1050 else if (ch < table[mid].first) 1051 hi = mid - 1; 1052 else 1053 return 1; 1054 } 1055 return 0; 1056} 1057 1058/* 1059 * Is a character a UTF-8 composing character? 1060 * If a composing character follows any char, the two combine into one glyph. 1061 */ 1062 public int 1063is_composing_char(ch) 1064 LWCHAR ch; 1065{ 1066 return is_in_table(ch, comp_table, (sizeof(comp_table) / sizeof(*comp_table))); 1067} 1068 1069/* 1070 * Should this UTF-8 character be treated as binary? 1071 */ 1072 public int 1073is_ubin_char(ch) 1074 LWCHAR ch; 1075{ 1076 return is_in_table(ch, ubin_table, (sizeof(ubin_table) / sizeof(*ubin_table))); 1077} 1078 1079/* 1080 * Is this a double width UTF-8 character? 1081 */ 1082 public int 1083is_wide_char(ch) 1084 LWCHAR ch; 1085{ 1086 return is_in_table(ch, wide_table, (sizeof(wide_table) / sizeof(*wide_table))); 1087} 1088 1089/* 1090 * Is a character a UTF-8 combining character? 1091 * A combining char acts like an ordinary char, but if it follows 1092 * a specific char (not any char), the two combine into one glyph. 1093 */ 1094 public int 1095is_combining_char(ch1, ch2) 1096 LWCHAR ch1; 1097 LWCHAR ch2; 1098{ 1099 /* The table is small; use linear search. */ 1100 int i; 1101 for (i = 0; i < sizeof(comb_table)/sizeof(*comb_table); i++) 1102 { 1103 if (ch1 == comb_table[i].first && 1104 ch2 == comb_table[i].last) 1105 return 1; 1106 } 1107 return 0; 1108} 1109
| 662 * Step forward or backward one character in a string. 663 */ 664 public LWCHAR 665step_char(pp, dir, limit) 666 char **pp; 667 signed int dir; 668 char *limit; 669{ 670 LWCHAR ch; 671 char *p = *pp; 672 673 if (!utf_mode) 674 { 675 /* It's easy if chars are one byte. */ 676 if (dir > 0) 677 ch = (LWCHAR) ((p < limit) ? *p++ : 0); 678 else 679 ch = (LWCHAR) ((p > limit) ? *--p : 0); 680 } else if (dir > 0) 681 { 682 if (p + utf_len(*p) > limit) 683 ch = 0; 684 else 685 { 686 ch = get_wchar(p); 687 p++; 688 while (IS_UTF8_TRAIL(*p)) 689 p++; 690 } 691 } else 692 { 693 while (p > limit && IS_UTF8_TRAIL(p[-1])) 694 p--; 695 if (p > limit) 696 ch = get_wchar(--p); 697 else 698 ch = 0; 699 } 700 *pp = p; 701 return ch; 702} 703 704/* 705 * Unicode characters data 706 */ 707struct wchar_range { LWCHAR first, last; }; 708 709/* 710 * Characters with general category values 711 * Mn: Mark, Nonspacing 712 * Me: Mark, Enclosing 713 * Last synched with 714 * <http://www.unicode.org/Public/5.0.0/ucd/UnicodeData-5.0.0d7.txt> 715 * dated 2005-11-30T00:58:48Z 716 */ 717static struct wchar_range comp_table[] = { 718 { 0x0300, 0x036F} /* Mn */, { 0x0483, 0x0486} /* Mn */, 719 { 0x0488, 0x0489} /* Me */, 720 { 0x0591, 0x05BD} /* Mn */, { 0x05BF, 0x05BF} /* Mn */, 721 { 0x05C1, 0x05C2} /* Mn */, { 0x05C4, 0x05C5} /* Mn */, 722 { 0x05C7, 0x05C7} /* Mn */, { 0x0610, 0x0615} /* Mn */, 723 { 0x064B, 0x065E} /* Mn */, { 0x0670, 0x0670} /* Mn */, 724 { 0x06D6, 0x06DC} /* Mn */, 725 { 0x06DE, 0x06DE} /* Me */, 726 { 0x06DF, 0x06E4} /* Mn */, { 0x06E7, 0x06E8} /* Mn */, 727 { 0x06EA, 0x06ED} /* Mn */, { 0x0711, 0x0711} /* Mn */, 728 { 0x0730, 0x074A} /* Mn */, { 0x07A6, 0x07B0} /* Mn */, 729 { 0x07EB, 0x07F3} /* Mn */, { 0x0901, 0x0902} /* Mn */, 730 { 0x093C, 0x093C} /* Mn */, { 0x0941, 0x0948} /* Mn */, 731 { 0x094D, 0x094D} /* Mn */, { 0x0951, 0x0954} /* Mn */, 732 { 0x0962, 0x0963} /* Mn */, { 0x0981, 0x0981} /* Mn */, 733 { 0x09BC, 0x09BC} /* Mn */, { 0x09C1, 0x09C4} /* Mn */, 734 { 0x09CD, 0x09CD} /* Mn */, { 0x09E2, 0x09E3} /* Mn */, 735 { 0x0A01, 0x0A02} /* Mn */, { 0x0A3C, 0x0A3C} /* Mn */, 736 { 0x0A41, 0x0A42} /* Mn */, { 0x0A47, 0x0A48} /* Mn */, 737 { 0x0A4B, 0x0A4D} /* Mn */, { 0x0A70, 0x0A71} /* Mn */, 738 { 0x0A81, 0x0A82} /* Mn */, { 0x0ABC, 0x0ABC} /* Mn */, 739 { 0x0AC1, 0x0AC5} /* Mn */, { 0x0AC7, 0x0AC8} /* Mn */, 740 { 0x0ACD, 0x0ACD} /* Mn */, { 0x0AE2, 0x0AE3} /* Mn */, 741 { 0x0B01, 0x0B01} /* Mn */, { 0x0B3C, 0x0B3C} /* Mn */, 742 { 0x0B3F, 0x0B3F} /* Mn */, { 0x0B41, 0x0B43} /* Mn */, 743 { 0x0B4D, 0x0B4D} /* Mn */, { 0x0B56, 0x0B56} /* Mn */, 744 { 0x0B82, 0x0B82} /* Mn */, { 0x0BC0, 0x0BC0} /* Mn */, 745 { 0x0BCD, 0x0BCD} /* Mn */, { 0x0C3E, 0x0C40} /* Mn */, 746 { 0x0C46, 0x0C48} /* Mn */, { 0x0C4A, 0x0C4D} /* Mn */, 747 { 0x0C55, 0x0C56} /* Mn */, { 0x0CBC, 0x0CBC} /* Mn */, 748 { 0x0CBF, 0x0CBF} /* Mn */, { 0x0CC6, 0x0CC6} /* Mn */, 749 { 0x0CCC, 0x0CCD} /* Mn */, { 0x0CE2, 0x0CE3} /* Mn */, 750 { 0x0D41, 0x0D43} /* Mn */, { 0x0D4D, 0x0D4D} /* Mn */, 751 { 0x0DCA, 0x0DCA} /* Mn */, { 0x0DD2, 0x0DD4} /* Mn */, 752 { 0x0DD6, 0x0DD6} /* Mn */, { 0x0E31, 0x0E31} /* Mn */, 753 { 0x0E34, 0x0E3A} /* Mn */, { 0x0E47, 0x0E4E} /* Mn */, 754 { 0x0EB1, 0x0EB1} /* Mn */, { 0x0EB4, 0x0EB9} /* Mn */, 755 { 0x0EBB, 0x0EBC} /* Mn */, { 0x0EC8, 0x0ECD} /* Mn */, 756 { 0x0F18, 0x0F19} /* Mn */, { 0x0F35, 0x0F35} /* Mn */, 757 { 0x0F37, 0x0F37} /* Mn */, { 0x0F39, 0x0F39} /* Mn */, 758 { 0x0F71, 0x0F7E} /* Mn */, { 0x0F80, 0x0F84} /* Mn */, 759 { 0x0F86, 0x0F87} /* Mn */, { 0x0F90, 0x0F97} /* Mn */, 760 { 0x0F99, 0x0FBC} /* Mn */, { 0x0FC6, 0x0FC6} /* Mn */, 761 { 0x102D, 0x1030} /* Mn */, { 0x1032, 0x1032} /* Mn */, 762 { 0x1036, 0x1037} /* Mn */, { 0x1039, 0x1039} /* Mn */, 763 { 0x1058, 0x1059} /* Mn */, { 0x135F, 0x135F} /* Mn */, 764 { 0x1712, 0x1714} /* Mn */, { 0x1732, 0x1734} /* Mn */, 765 { 0x1752, 0x1753} /* Mn */, { 0x1772, 0x1773} /* Mn */, 766 { 0x17B7, 0x17BD} /* Mn */, { 0x17C6, 0x17C6} /* Mn */, 767 { 0x17C9, 0x17D3} /* Mn */, { 0x17DD, 0x17DD} /* Mn */, 768 { 0x180B, 0x180D} /* Mn */, { 0x18A9, 0x18A9} /* Mn */, 769 { 0x1920, 0x1922} /* Mn */, { 0x1927, 0x1928} /* Mn */, 770 { 0x1932, 0x1932} /* Mn */, { 0x1939, 0x193B} /* Mn */, 771 { 0x1A17, 0x1A18} /* Mn */, { 0x1B00, 0x1B03} /* Mn */, 772 { 0x1B34, 0x1B34} /* Mn */, { 0x1B36, 0x1B3A} /* Mn */, 773 { 0x1B3C, 0x1B3C} /* Mn */, { 0x1B42, 0x1B42} /* Mn */, 774 { 0x1B6B, 0x1B73} /* Mn */, { 0x1DC0, 0x1DCA} /* Mn */, 775 { 0x1DFE, 0x1DFF} /* Mn */, { 0x20D0, 0x20DC} /* Mn */, 776 { 0x20DD, 0x20E0} /* Me */, 777 { 0x20E1, 0x20E1} /* Mn */, 778 { 0x20E2, 0x20E4} /* Me */, 779 { 0x20E5, 0x20EF} /* Mn */, { 0x302A, 0x302F} /* Mn */, 780 { 0x3099, 0x309A} /* Mn */, { 0xA806, 0xA806} /* Mn */, 781 { 0xA80B, 0xA80B} /* Mn */, { 0xA825, 0xA826} /* Mn */, 782 { 0xFB1E, 0xFB1E} /* Mn */, { 0xFE00, 0xFE0F} /* Mn */, 783 { 0xFE20, 0xFE23} /* Mn */, { 0x10A01, 0x10A03} /* Mn */, 784 { 0x10A05, 0x10A06} /* Mn */, { 0x10A0C, 0x10A0F} /* Mn */, 785 { 0x10A38, 0x10A3A} /* Mn */, { 0x10A3F, 0x10A3F} /* Mn */, 786 { 0x1D167, 0x1D169} /* Mn */, { 0x1D17B, 0x1D182} /* Mn */, 787 { 0x1D185, 0x1D18B} /* Mn */, { 0x1D1AA, 0x1D1AD} /* Mn */, 788 { 0x1D242, 0x1D244} /* Mn */, { 0xE0100, 0xE01EF} /* Mn */, 789}; 790 791/* 792 * Special pairs, not ranges. 793 */ 794static struct wchar_range comb_table[] = { 795 {0x0644,0x0622}, {0x0644,0x0623}, {0x0644,0x0625}, {0x0644,0x0627}, 796}; 797 798/* 799 * Characters with general category values 800 * Cc: Other, Control 801 * Cf: Other, Format 802 * Cs: Other, Surrogate 803 * Co: Other, Private Use 804 * Cn: Other, Not Assigned 805 * Zl: Separator, Line 806 * Zp: Separator, Paragraph 807 * Last synched with 808 * <http://www.unicode.org/Public/5.0.0/ucd/UnicodeData-5.0.0d7.txt> 809 * dated 2005-11-30T00:58:48Z 810 */ 811static struct wchar_range ubin_table[] = { 812 { 0x0000, 0x001F} /* Cc */, { 0x007F, 0x009F} /* Cc */, 813#if 0 814 { 0x00AD, 0x00AD} /* Cf */, 815#endif 816 { 0x0370, 0x0373} /* Cn */, { 0x0376, 0x0379} /* Cn */, 817 { 0x037F, 0x0383} /* Cn */, { 0x038B, 0x038B} /* Cn */, 818 { 0x038D, 0x038D} /* Cn */, { 0x03A2, 0x03A2} /* Cn */, 819 { 0x03CF, 0x03CF} /* Cn */, { 0x0487, 0x0487} /* Cn */, 820 { 0x0514, 0x0530} /* Cn */, { 0x0557, 0x0558} /* Cn */, 821 { 0x0560, 0x0560} /* Cn */, { 0x0588, 0x0588} /* Cn */, 822 { 0x058B, 0x0590} /* Cn */, { 0x05C8, 0x05CF} /* Cn */, 823 { 0x05EB, 0x05EF} /* Cn */, { 0x05F5, 0x05FF} /* Cn */, 824#if 0 825 { 0x0600, 0x0603} /* Cf */, 826#endif 827 { 0x0604, 0x060A} /* Cn */, { 0x0616, 0x061A} /* Cn */, 828 { 0x061C, 0x061D} /* Cn */, { 0x0620, 0x0620} /* Cn */, 829 { 0x063B, 0x063F} /* Cn */, { 0x065F, 0x065F} /* Cn */, 830#if 0 831 { 0x06DD, 0x06DD} /* Cf */, 832#endif 833 { 0x070E, 0x070E} /* Cn */, 834#if 0 835 { 0x070F, 0x070F} /* Cf */, 836#endif 837 { 0x074B, 0x074C} /* Cn */, { 0x076E, 0x077F} /* Cn */, 838 { 0x07B2, 0x07BF} /* Cn */, { 0x07FB, 0x0900} /* Cn */, 839 { 0x093A, 0x093B} /* Cn */, { 0x094E, 0x094F} /* Cn */, 840 { 0x0955, 0x0957} /* Cn */, { 0x0971, 0x097A} /* Cn */, 841 { 0x0980, 0x0980} /* Cn */, { 0x0984, 0x0984} /* Cn */, 842 { 0x098D, 0x098E} /* Cn */, { 0x0991, 0x0992} /* Cn */, 843 { 0x09A9, 0x09A9} /* Cn */, { 0x09B1, 0x09B1} /* Cn */, 844 { 0x09B3, 0x09B5} /* Cn */, { 0x09BA, 0x09BB} /* Cn */, 845 { 0x09C5, 0x09C6} /* Cn */, { 0x09C9, 0x09CA} /* Cn */, 846 { 0x09CF, 0x09D6} /* Cn */, { 0x09D8, 0x09DB} /* Cn */, 847 { 0x09DE, 0x09DE} /* Cn */, { 0x09E4, 0x09E5} /* Cn */, 848 { 0x09FB, 0x0A00} /* Cn */, { 0x0A04, 0x0A04} /* Cn */, 849 { 0x0A0B, 0x0A0E} /* Cn */, { 0x0A11, 0x0A12} /* Cn */, 850 { 0x0A29, 0x0A29} /* Cn */, { 0x0A31, 0x0A31} /* Cn */, 851 { 0x0A34, 0x0A34} /* Cn */, { 0x0A37, 0x0A37} /* Cn */, 852 { 0x0A3A, 0x0A3B} /* Cn */, { 0x0A3D, 0x0A3D} /* Cn */, 853 { 0x0A43, 0x0A46} /* Cn */, { 0x0A49, 0x0A4A} /* Cn */, 854 { 0x0A4E, 0x0A58} /* Cn */, { 0x0A5D, 0x0A5D} /* Cn */, 855 { 0x0A5F, 0x0A65} /* Cn */, { 0x0A75, 0x0A80} /* Cn */, 856 { 0x0A84, 0x0A84} /* Cn */, { 0x0A8E, 0x0A8E} /* Cn */, 857 { 0x0A92, 0x0A92} /* Cn */, { 0x0AA9, 0x0AA9} /* Cn */, 858 { 0x0AB1, 0x0AB1} /* Cn */, { 0x0AB4, 0x0AB4} /* Cn */, 859 { 0x0ABA, 0x0ABB} /* Cn */, { 0x0AC6, 0x0AC6} /* Cn */, 860 { 0x0ACA, 0x0ACA} /* Cn */, { 0x0ACE, 0x0ACF} /* Cn */, 861 { 0x0AD1, 0x0ADF} /* Cn */, { 0x0AE4, 0x0AE5} /* Cn */, 862 { 0x0AF0, 0x0AF0} /* Cn */, { 0x0AF2, 0x0B00} /* Cn */, 863 { 0x0B04, 0x0B04} /* Cn */, { 0x0B0D, 0x0B0E} /* Cn */, 864 { 0x0B11, 0x0B12} /* Cn */, { 0x0B29, 0x0B29} /* Cn */, 865 { 0x0B31, 0x0B31} /* Cn */, { 0x0B34, 0x0B34} /* Cn */, 866 { 0x0B3A, 0x0B3B} /* Cn */, { 0x0B44, 0x0B46} /* Cn */, 867 { 0x0B49, 0x0B4A} /* Cn */, { 0x0B4E, 0x0B55} /* Cn */, 868 { 0x0B58, 0x0B5B} /* Cn */, { 0x0B5E, 0x0B5E} /* Cn */, 869 { 0x0B62, 0x0B65} /* Cn */, { 0x0B72, 0x0B81} /* Cn */, 870 { 0x0B84, 0x0B84} /* Cn */, { 0x0B8B, 0x0B8D} /* Cn */, 871 { 0x0B91, 0x0B91} /* Cn */, { 0x0B96, 0x0B98} /* Cn */, 872 { 0x0B9B, 0x0B9B} /* Cn */, { 0x0B9D, 0x0B9D} /* Cn */, 873 { 0x0BA0, 0x0BA2} /* Cn */, { 0x0BA5, 0x0BA7} /* Cn */, 874 { 0x0BAB, 0x0BAD} /* Cn */, { 0x0BBA, 0x0BBD} /* Cn */, 875 { 0x0BC3, 0x0BC5} /* Cn */, { 0x0BC9, 0x0BC9} /* Cn */, 876 { 0x0BCE, 0x0BD6} /* Cn */, { 0x0BD8, 0x0BE5} /* Cn */, 877 { 0x0BFB, 0x0C00} /* Cn */, { 0x0C04, 0x0C04} /* Cn */, 878 { 0x0C0D, 0x0C0D} /* Cn */, { 0x0C11, 0x0C11} /* Cn */, 879 { 0x0C29, 0x0C29} /* Cn */, { 0x0C34, 0x0C34} /* Cn */, 880 { 0x0C3A, 0x0C3D} /* Cn */, { 0x0C45, 0x0C45} /* Cn */, 881 { 0x0C49, 0x0C49} /* Cn */, { 0x0C4E, 0x0C54} /* Cn */, 882 { 0x0C57, 0x0C5F} /* Cn */, { 0x0C62, 0x0C65} /* Cn */, 883 { 0x0C70, 0x0C81} /* Cn */, { 0x0C84, 0x0C84} /* Cn */, 884 { 0x0C8D, 0x0C8D} /* Cn */, { 0x0C91, 0x0C91} /* Cn */, 885 { 0x0CA9, 0x0CA9} /* Cn */, { 0x0CB4, 0x0CB4} /* Cn */, 886 { 0x0CBA, 0x0CBB} /* Cn */, { 0x0CC5, 0x0CC5} /* Cn */, 887 { 0x0CC9, 0x0CC9} /* Cn */, { 0x0CCE, 0x0CD4} /* Cn */, 888 { 0x0CD7, 0x0CDD} /* Cn */, { 0x0CDF, 0x0CDF} /* Cn */, 889 { 0x0CE4, 0x0CE5} /* Cn */, { 0x0CF0, 0x0CF0} /* Cn */, 890 { 0x0CF3, 0x0D01} /* Cn */, { 0x0D04, 0x0D04} /* Cn */, 891 { 0x0D0D, 0x0D0D} /* Cn */, { 0x0D11, 0x0D11} /* Cn */, 892 { 0x0D29, 0x0D29} /* Cn */, { 0x0D3A, 0x0D3D} /* Cn */, 893 { 0x0D44, 0x0D45} /* Cn */, { 0x0D49, 0x0D49} /* Cn */, 894 { 0x0D4E, 0x0D56} /* Cn */, { 0x0D58, 0x0D5F} /* Cn */, 895 { 0x0D62, 0x0D65} /* Cn */, { 0x0D70, 0x0D81} /* Cn */, 896 { 0x0D84, 0x0D84} /* Cn */, { 0x0D97, 0x0D99} /* Cn */, 897 { 0x0DB2, 0x0DB2} /* Cn */, { 0x0DBC, 0x0DBC} /* Cn */, 898 { 0x0DBE, 0x0DBF} /* Cn */, { 0x0DC7, 0x0DC9} /* Cn */, 899 { 0x0DCB, 0x0DCE} /* Cn */, { 0x0DD5, 0x0DD5} /* Cn */, 900 { 0x0DD7, 0x0DD7} /* Cn */, { 0x0DE0, 0x0DF1} /* Cn */, 901 { 0x0DF5, 0x0E00} /* Cn */, { 0x0E3B, 0x0E3E} /* Cn */, 902 { 0x0E5C, 0x0E80} /* Cn */, { 0x0E83, 0x0E83} /* Cn */, 903 { 0x0E85, 0x0E86} /* Cn */, { 0x0E89, 0x0E89} /* Cn */, 904 { 0x0E8B, 0x0E8C} /* Cn */, { 0x0E8E, 0x0E93} /* Cn */, 905 { 0x0E98, 0x0E98} /* Cn */, { 0x0EA0, 0x0EA0} /* Cn */, 906 { 0x0EA4, 0x0EA4} /* Cn */, { 0x0EA6, 0x0EA6} /* Cn */, 907 { 0x0EA8, 0x0EA9} /* Cn */, { 0x0EAC, 0x0EAC} /* Cn */, 908 { 0x0EBA, 0x0EBA} /* Cn */, { 0x0EBE, 0x0EBF} /* Cn */, 909 { 0x0EC5, 0x0EC5} /* Cn */, { 0x0EC7, 0x0EC7} /* Cn */, 910 { 0x0ECE, 0x0ECF} /* Cn */, { 0x0EDA, 0x0EDB} /* Cn */, 911 { 0x0EDE, 0x0EFF} /* Cn */, { 0x0F48, 0x0F48} /* Cn */, 912 { 0x0F6B, 0x0F70} /* Cn */, { 0x0F8C, 0x0F8F} /* Cn */, 913 { 0x0F98, 0x0F98} /* Cn */, { 0x0FBD, 0x0FBD} /* Cn */, 914 { 0x0FCD, 0x0FCE} /* Cn */, { 0x0FD2, 0x0FFF} /* Cn */, 915 { 0x1022, 0x1022} /* Cn */, { 0x1028, 0x1028} /* Cn */, 916 { 0x102B, 0x102B} /* Cn */, { 0x1033, 0x1035} /* Cn */, 917 { 0x103A, 0x103F} /* Cn */, { 0x105A, 0x109F} /* Cn */, 918 { 0x10C6, 0x10CF} /* Cn */, { 0x10FD, 0x10FF} /* Cn */, 919 { 0x115A, 0x115E} /* Cn */, { 0x11A3, 0x11A7} /* Cn */, 920 { 0x11FA, 0x11FF} /* Cn */, { 0x1249, 0x1249} /* Cn */, 921 { 0x124E, 0x124F} /* Cn */, { 0x1257, 0x1257} /* Cn */, 922 { 0x1259, 0x1259} /* Cn */, { 0x125E, 0x125F} /* Cn */, 923 { 0x1289, 0x1289} /* Cn */, { 0x128E, 0x128F} /* Cn */, 924 { 0x12B1, 0x12B1} /* Cn */, { 0x12B6, 0x12B7} /* Cn */, 925 { 0x12BF, 0x12BF} /* Cn */, { 0x12C1, 0x12C1} /* Cn */, 926 { 0x12C6, 0x12C7} /* Cn */, { 0x12D7, 0x12D7} /* Cn */, 927 { 0x1311, 0x1311} /* Cn */, { 0x1316, 0x1317} /* Cn */, 928 { 0x135B, 0x135E} /* Cn */, { 0x137D, 0x137F} /* Cn */, 929 { 0x139A, 0x139F} /* Cn */, { 0x13F5, 0x1400} /* Cn */, 930 { 0x1677, 0x167F} /* Cn */, { 0x169D, 0x169F} /* Cn */, 931 { 0x16F1, 0x16FF} /* Cn */, { 0x170D, 0x170D} /* Cn */, 932 { 0x1715, 0x171F} /* Cn */, { 0x1737, 0x173F} /* Cn */, 933 { 0x1754, 0x175F} /* Cn */, { 0x176D, 0x176D} /* Cn */, 934 { 0x1771, 0x1771} /* Cn */, { 0x1774, 0x177F} /* Cn */, 935#if 0 936 { 0x17B4, 0x17B5} /* Cf */, 937#endif 938 { 0x17DE, 0x17DF} /* Cn */, { 0x17EA, 0x17EF} /* Cn */, 939 { 0x17FA, 0x17FF} /* Cn */, { 0x180F, 0x180F} /* Cn */, 940 { 0x181A, 0x181F} /* Cn */, { 0x1878, 0x187F} /* Cn */, 941 { 0x18AA, 0x18FF} /* Cn */, { 0x191D, 0x191F} /* Cn */, 942 { 0x192C, 0x192F} /* Cn */, { 0x193C, 0x193F} /* Cn */, 943 { 0x1941, 0x1943} /* Cn */, { 0x196E, 0x196F} /* Cn */, 944 { 0x1975, 0x197F} /* Cn */, { 0x19AA, 0x19AF} /* Cn */, 945 { 0x19CA, 0x19CF} /* Cn */, { 0x19DA, 0x19DD} /* Cn */, 946 { 0x1A1C, 0x1A1D} /* Cn */, { 0x1A20, 0x1AFF} /* Cn */, 947 { 0x1B4C, 0x1B4F} /* Cn */, { 0x1B7D, 0x1CFF} /* Cn */, 948 { 0x1DCB, 0x1DFD} /* Cn */, { 0x1E9C, 0x1E9F} /* Cn */, 949 { 0x1EFA, 0x1EFF} /* Cn */, { 0x1F16, 0x1F17} /* Cn */, 950 { 0x1F1E, 0x1F1F} /* Cn */, { 0x1F46, 0x1F47} /* Cn */, 951 { 0x1F4E, 0x1F4F} /* Cn */, { 0x1F58, 0x1F58} /* Cn */, 952 { 0x1F5A, 0x1F5A} /* Cn */, { 0x1F5C, 0x1F5C} /* Cn */, 953 { 0x1F5E, 0x1F5E} /* Cn */, { 0x1F7E, 0x1F7F} /* Cn */, 954 { 0x1FB5, 0x1FB5} /* Cn */, { 0x1FC5, 0x1FC5} /* Cn */, 955 { 0x1FD4, 0x1FD5} /* Cn */, { 0x1FDC, 0x1FDC} /* Cn */, 956 { 0x1FF0, 0x1FF1} /* Cn */, { 0x1FF5, 0x1FF5} /* Cn */, 957 { 0x1FFF, 0x1FFF} /* Cn */, 958 { 0x200B, 0x200F} /* Cf */, 959 { 0x2028, 0x2028} /* Zl */, 960 { 0x2029, 0x2029} /* Zp */, 961 { 0x202A, 0x202E} /* Cf */, 962 { 0x2060, 0x2063} /* Cf */, 963 { 0x2064, 0x2069} /* Cn */, 964 { 0x206A, 0x206F} /* Cf */, 965 { 0x2072, 0x2073} /* Cn */, { 0x208F, 0x208F} /* Cn */, 966 { 0x2095, 0x209F} /* Cn */, { 0x20B6, 0x20CF} /* Cn */, 967 { 0x20F0, 0x20FF} /* Cn */, { 0x214F, 0x2152} /* Cn */, 968 { 0x2185, 0x218F} /* Cn */, { 0x23E8, 0x23FF} /* Cn */, 969 { 0x2427, 0x243F} /* Cn */, { 0x244B, 0x245F} /* Cn */, 970 { 0x269D, 0x269F} /* Cn */, { 0x26B3, 0x2700} /* Cn */, 971 { 0x2705, 0x2705} /* Cn */, { 0x270A, 0x270B} /* Cn */, 972 { 0x2728, 0x2728} /* Cn */, { 0x274C, 0x274C} /* Cn */, 973 { 0x274E, 0x274E} /* Cn */, { 0x2753, 0x2755} /* Cn */, 974 { 0x2757, 0x2757} /* Cn */, { 0x275F, 0x2760} /* Cn */, 975 { 0x2795, 0x2797} /* Cn */, { 0x27B0, 0x27B0} /* Cn */, 976 { 0x27BF, 0x27BF} /* Cn */, { 0x27CB, 0x27CF} /* Cn */, 977 { 0x27EC, 0x27EF} /* Cn */, { 0x2B1B, 0x2B1F} /* Cn */, 978 { 0x2B24, 0x2BFF} /* Cn */, { 0x2C2F, 0x2C2F} /* Cn */, 979 { 0x2C5F, 0x2C5F} /* Cn */, { 0x2C6D, 0x2C73} /* Cn */, 980 { 0x2C78, 0x2C7F} /* Cn */, { 0x2CEB, 0x2CF8} /* Cn */, 981 { 0x2D26, 0x2D2F} /* Cn */, { 0x2D66, 0x2D6E} /* Cn */, 982 { 0x2D70, 0x2D7F} /* Cn */, { 0x2D97, 0x2D9F} /* Cn */, 983 { 0x2DA7, 0x2DA7} /* Cn */, { 0x2DAF, 0x2DAF} /* Cn */, 984 { 0x2DB7, 0x2DB7} /* Cn */, { 0x2DBF, 0x2DBF} /* Cn */, 985 { 0x2DC7, 0x2DC7} /* Cn */, { 0x2DCF, 0x2DCF} /* Cn */, 986 { 0x2DD7, 0x2DD7} /* Cn */, { 0x2DDF, 0x2DFF} /* Cn */, 987 { 0x2E18, 0x2E1B} /* Cn */, { 0x2E1E, 0x2E7F} /* Cn */, 988 { 0x2E9A, 0x2E9A} /* Cn */, { 0x2EF4, 0x2EFF} /* Cn */, 989 { 0x2FD6, 0x2FEF} /* Cn */, { 0x2FFC, 0x2FFF} /* Cn */, 990 { 0x3040, 0x3040} /* Cn */, { 0x3097, 0x3098} /* Cn */, 991 { 0x3100, 0x3104} /* Cn */, { 0x312D, 0x3130} /* Cn */, 992 { 0x318F, 0x318F} /* Cn */, { 0x31B8, 0x31BF} /* Cn */, 993 { 0x31D0, 0x31EF} /* Cn */, { 0x321F, 0x321F} /* Cn */, 994 { 0x3244, 0x324F} /* Cn */, { 0x32FF, 0x32FF} /* Cn */, 995 { 0x4DB6, 0x4DBF} /* Cn */, { 0x9FBC, 0x9FFF} /* Cn */, 996 { 0xA48D, 0xA48F} /* Cn */, { 0xA4C7, 0xA6FF} /* Cn */, 997 { 0xA71B, 0xA71F} /* Cn */, { 0xA722, 0xA7FF} /* Cn */, 998 { 0xA82C, 0xA83F} /* Cn */, { 0xA878, 0xABFF} /* Cn */, 999 { 0xD7A4, 0xD7FF} /* Cn */, 1000 { 0xD800, 0xDFFF} /* Cs */, 1001 { 0xE000, 0xF8FF} /* Co */, 1002 { 0xFA2E, 0xFA2F} /* Cn */, { 0xFA6B, 0xFA6F} /* Cn */, 1003 { 0xFADA, 0xFAFF} /* Cn */, { 0xFB07, 0xFB12} /* Cn */, 1004 { 0xFB18, 0xFB1C} /* Cn */, { 0xFB37, 0xFB37} /* Cn */, 1005 { 0xFB3D, 0xFB3D} /* Cn */, { 0xFB3F, 0xFB3F} /* Cn */, 1006 { 0xFB42, 0xFB42} /* Cn */, { 0xFB45, 0xFB45} /* Cn */, 1007 { 0xFBB2, 0xFBD2} /* Cn */, { 0xFD40, 0xFD4F} /* Cn */, 1008 { 0xFD90, 0xFD91} /* Cn */, { 0xFDC8, 0xFDEF} /* Cn */, 1009 { 0xFDFE, 0xFDFF} /* Cn */, { 0xFE1A, 0xFE1F} /* Cn */, 1010 { 0xFE24, 0xFE2F} /* Cn */, { 0xFE53, 0xFE53} /* Cn */, 1011 { 0xFE67, 0xFE67} /* Cn */, { 0xFE6C, 0xFE6F} /* Cn */, 1012 { 0xFE75, 0xFE75} /* Cn */, { 0xFEFD, 0xFEFE} /* Cn */, 1013 { 0xFEFF, 0xFEFF} /* Cf */, 1014 { 0xFF00, 0xFF00} /* Cn */, { 0xFFBF, 0xFFC1} /* Cn */, 1015 { 0xFFC8, 0xFFC9} /* Cn */, { 0xFFD0, 0xFFD1} /* Cn */, 1016 { 0xFFD8, 0xFFD9} /* Cn */, { 0xFFDD, 0xFFDF} /* Cn */, 1017 { 0xFFE7, 0xFFE7} /* Cn */, { 0xFFEF, 0xFFF8} /* Cn */, 1018 { 0xFFF9, 0xFFFB} /* Cf */, 1019 { 0xFFFE, 0xFFFF} /* Cn */, { 0x1000C, 0x1000C} /* Cn */, 1020 { 0x10027, 0x10027} /* Cn */, { 0x1003B, 0x1003B} /* Cn */, 1021 { 0x1003E, 0x1003E} /* Cn */, { 0x1004E, 0x1004F} /* Cn */, 1022 { 0x1005E, 0x1007F} /* Cn */, { 0x100FB, 0x100FF} /* Cn */, 1023 { 0x10103, 0x10106} /* Cn */, { 0x10134, 0x10136} /* Cn */, 1024 { 0x1018B, 0x102FF} /* Cn */, { 0x1031F, 0x1031F} /* Cn */, 1025 { 0x10324, 0x1032F} /* Cn */, { 0x1034B, 0x1037F} /* Cn */, 1026 { 0x1039E, 0x1039E} /* Cn */, { 0x103C4, 0x103C7} /* Cn */, 1027 { 0x103D6, 0x103FF} /* Cn */, 1028 { 0x1049E, 0x1049F} /* Cn */, { 0x104AA, 0x107FF} /* Cn */, 1029 { 0x10806, 0x10807} /* Cn */, { 0x10809, 0x10809} /* Cn */, 1030 { 0x10836, 0x10836} /* Cn */, { 0x10839, 0x1083B} /* Cn */, 1031 { 0x1083D, 0x1083E} /* Cn */, { 0x10840, 0x108FF} /* Cn */, 1032 { 0x1091A, 0x1091E} /* Cn */, { 0x10920, 0x109FF} /* Cn */, 1033 { 0x10A04, 0x10A04} /* Cn */, { 0x10A07, 0x10A0B} /* Cn */, 1034 { 0x10A14, 0x10A14} /* Cn */, { 0x10A18, 0x10A18} /* Cn */, 1035 { 0x10A34, 0x10A37} /* Cn */, { 0x10A3B, 0x10A3E} /* Cn */, 1036 { 0x10A48, 0x10A4F} /* Cn */, { 0x10A59, 0x11FFF} /* Cn */, 1037 { 0x1236F, 0x123FF} /* Cn */, { 0x12463, 0x1246F} /* Cn */, 1038 { 0x12474, 0x1CFFF} /* Cn */, { 0x1D0F6, 0x1D0FF} /* Cn */, 1039 { 0x1D127, 0x1D129} /* Cn */, 1040 { 0x1D173, 0x1D17A} /* Cf */, 1041 { 0x1D1DE, 0x1D1FF} /* Cn */, { 0x1D246, 0x1D2FF} /* Cn */, 1042 { 0x1D357, 0x1D35F} /* Cn */, { 0x1D372, 0x1D3FF} /* Cn */, 1043 { 0x1D455, 0x1D455} /* Cn */, { 0x1D49D, 0x1D49D} /* Cn */, 1044 { 0x1D4A0, 0x1D4A1} /* Cn */, { 0x1D4A3, 0x1D4A4} /* Cn */, 1045 { 0x1D4A7, 0x1D4A8} /* Cn */, { 0x1D4AD, 0x1D4AD} /* Cn */, 1046 { 0x1D4BA, 0x1D4BA} /* Cn */, { 0x1D4BC, 0x1D4BC} /* Cn */, 1047 { 0x1D4C4, 0x1D4C4} /* Cn */, { 0x1D506, 0x1D506} /* Cn */, 1048 { 0x1D50B, 0x1D50C} /* Cn */, { 0x1D515, 0x1D515} /* Cn */, 1049 { 0x1D51D, 0x1D51D} /* Cn */, { 0x1D53A, 0x1D53A} /* Cn */, 1050 { 0x1D53F, 0x1D53F} /* Cn */, { 0x1D545, 0x1D545} /* Cn */, 1051 { 0x1D547, 0x1D549} /* Cn */, { 0x1D551, 0x1D551} /* Cn */, 1052 { 0x1D6A6, 0x1D6A7} /* Cn */, { 0x1D7CC, 0x1D7CD} /* Cn */, 1053 { 0x1D800, 0x1FFFF} /* Cn */, { 0x2A6D7, 0x2F7FF} /* Cn */, 1054 { 0x2FA1E, 0xE0000} /* Cn */, 1055 { 0xE0001, 0xE0001} /* Cf */, 1056 { 0xE0002, 0xE001F} /* Cn */, 1057 { 0xE0020, 0xE007F} /* Cf */, 1058 { 0xE0080, 0xE00FF} /* Cn */, { 0xE01F0, 0xEFFFF} /* Cn */, 1059 { 0xF0000, 0xFFFFD} /* Co */, 1060 { 0xFFFFE, 0xFFFFF} /* Cn */, 1061 {0x100000,0x10FFFD} /* Co */, 1062 {0x10FFFE,0x10FFFF} /* Cn */, 1063 {0x110000,0x7FFFFFFF} /* ISO 10646?? */ 1064}; 1065 1066/* 1067 * Double width characters 1068 * W: East Asian Wide 1069 * F: East Asian Full-width 1070 * Unassigned code points may be included when they allow ranges to be merged. 1071 * Last synched with 1072 * <http://www.unicode.org/Public/5.0.0/ucd/EastAsianWidth-5.0.0d2.txt> 1073 * dated 2005-11-08T01:32:56Z 1074 */ 1075static struct wchar_range wide_table[] = { 1076 { 0x1100, 0x115F} /* W */, { 0x2329, 0x232A} /* W */, 1077 { 0x2E80, 0x2FFB} /* W */, 1078 { 0x3000, 0x3000} /* F */, 1079 { 0x3001, 0x303E} /* W */, { 0x3041, 0x4DB5} /* W */, 1080 { 0x4E00, 0x9FBB} /* W */, { 0xA000, 0xA4C6} /* W */, 1081 { 0xAC00, 0xD7A3} /* W */, { 0xF900, 0xFAD9} /* W */, 1082 { 0xFE10, 0xFE19} /* W */, { 0xFE30, 0xFE6B} /* W */, 1083 { 0xFF01, 0xFF60} /* F */, { 0xFFE0, 0xFFE6} /* F */, 1084 { 0x20000, 0x2FFFD} /* W */, { 0x30000, 0x3FFFD} /* W */, 1085}; 1086 1087 static int 1088is_in_table(ch, table, tsize) 1089 LWCHAR ch; 1090 struct wchar_range table[]; 1091 int tsize; 1092{ 1093 int hi; 1094 int lo; 1095 1096 /* Binary search in the table. */ 1097 if (ch < table[0].first) 1098 return 0; 1099 lo = 0; 1100 hi = tsize - 1; 1101 while (lo <= hi) 1102 { 1103 int mid = (lo + hi) / 2; 1104 if (ch > table[mid].last) 1105 lo = mid + 1; 1106 else if (ch < table[mid].first) 1107 hi = mid - 1; 1108 else 1109 return 1; 1110 } 1111 return 0; 1112} 1113 1114/* 1115 * Is a character a UTF-8 composing character? 1116 * If a composing character follows any char, the two combine into one glyph. 1117 */ 1118 public int 1119is_composing_char(ch) 1120 LWCHAR ch; 1121{ 1122 return is_in_table(ch, comp_table, (sizeof(comp_table) / sizeof(*comp_table))); 1123} 1124 1125/* 1126 * Should this UTF-8 character be treated as binary? 1127 */ 1128 public int 1129is_ubin_char(ch) 1130 LWCHAR ch; 1131{ 1132 return is_in_table(ch, ubin_table, (sizeof(ubin_table) / sizeof(*ubin_table))); 1133} 1134 1135/* 1136 * Is this a double width UTF-8 character? 1137 */ 1138 public int 1139is_wide_char(ch) 1140 LWCHAR ch; 1141{ 1142 return is_in_table(ch, wide_table, (sizeof(wide_table) / sizeof(*wide_table))); 1143} 1144 1145/* 1146 * Is a character a UTF-8 combining character? 1147 * A combining char acts like an ordinary char, but if it follows 1148 * a specific char (not any char), the two combine into one glyph. 1149 */ 1150 public int 1151is_combining_char(ch1, ch2) 1152 LWCHAR ch1; 1153 LWCHAR ch2; 1154{ 1155 /* The table is small; use linear search. */ 1156 int i; 1157 for (i = 0; i < sizeof(comb_table)/sizeof(*comb_table); i++) 1158 { 1159 if (ch1 == comb_table[i].first && 1160 ch2 == comb_table[i].last) 1161 return 1; 1162 } 1163 return 0; 1164} 1165
|