… | |
… | |
123 | #endif |
123 | #endif |
124 | |
124 | |
125 | /****************************************************************************/ |
125 | /****************************************************************************/ |
126 | |
126 | |
127 | // exception thrown on fatal (per-instance) errors |
127 | // exception thrown on fatal (per-instance) errors |
128 | class rxvt_failure_exception { }; |
128 | class rxvt_failure_exception : public std::exception |
|
|
129 | { |
|
|
130 | public: |
|
|
131 | const char * |
|
|
132 | what () const noexcept override |
|
|
133 | { |
|
|
134 | return ""; |
|
|
135 | } |
|
|
136 | }; |
129 | |
137 | |
130 | // exception thrown when the command parser runs out of input data |
138 | // exception thrown when the command parser runs out of input data |
131 | class out_of_input { }; |
139 | class out_of_input { }; |
132 | |
140 | |
133 | /* |
141 | /* |
… | |
… | |
769 | /****************************************************************************/ |
777 | /****************************************************************************/ |
770 | |
778 | |
771 | #define UNICODE_MASK 0x1fffffUL |
779 | #define UNICODE_MASK 0x1fffffUL |
772 | |
780 | |
773 | #if UNICODE_3 |
781 | #if UNICODE_3 |
774 | # define COMPOSE_LO 0x40000000UL |
782 | # define COMPOSE_LO 0x110000UL |
775 | # define COMPOSE_HI 0x400fffffUL |
783 | # define COMPOSE_HI 0x1fffffUL |
776 | # define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO) |
784 | # define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO) |
777 | #else |
785 | #else |
778 | # if ENABLE_PERL |
786 | # if ENABLE_PERL |
779 | # define COMPOSE_LO 0xe000UL // our _own_ functions don't like (illegal) surrogates |
787 | # define COMPOSE_LO 0xe000UL // our _own_ functions don't like (illegal) surrogates |
780 | # define COMPOSE_HI 0xf8ffUL // in utf-8, so use private use area only |
788 | # define COMPOSE_HI 0xf8ffUL // in utf-8, so use private use area only |
… | |
… | |
789 | // compose chars are used to represent composite characters |
797 | // compose chars are used to represent composite characters |
790 | // that are not representable in unicode, as well as characters |
798 | // that are not representable in unicode, as well as characters |
791 | // not fitting in the BMP. |
799 | // not fitting in the BMP. |
792 | struct compose_char |
800 | struct compose_char |
793 | { |
801 | { |
794 | unicode_t c1, c2; // any chars != NOCHAR are valid |
802 | // c1 can be any character != NOCHAR, including another compose character |
|
|
803 | // c2 must always be a zero-width character or NOCHAR, in case |
|
|
804 | // this just extends beyond the BMP. |
|
|
805 | unicode_t c1, c2; |
795 | |
806 | |
796 | compose_char (unicode_t c1, unicode_t c2) |
807 | compose_char (unicode_t c1, unicode_t c2) |
797 | : c1(c1), c2(c2) |
808 | : c1(c1), c2(c2) |
798 | { } |
809 | { } |
799 | }; |
810 | }; |
800 | |
811 | |
801 | class rxvt_composite_vec |
812 | struct rxvt_composite_vec |
802 | { |
813 | { |
803 | vector<compose_char> v; |
814 | vector<compose_char> v; |
804 | public: |
815 | |
805 | text_t compose (unicode_t c1, unicode_t c2 = NOCHAR); |
816 | text_t compose (unicode_t c1, unicode_t c2 = NOCHAR); |
806 | int expand (unicode_t c, wchar_t *r); |
817 | template<typename T> int expand (unicode_t c, T *r); |
|
|
818 | int expand (unicode_t c) { return expand (c, (text_t *)0); } |
807 | compose_char *operator [](text_t c) |
819 | compose_char *operator [](text_t c) |
808 | { |
820 | { |
809 | return c >= COMPOSE_LO && c < COMPOSE_LO + v.size () |
821 | return c >= COMPOSE_LO && c < COMPOSE_LO + v.size () |
810 | ? &v[c - COMPOSE_LO] |
822 | ? &v[c - COMPOSE_LO] |
811 | : 0; |
823 | : 0; |
812 | } |
824 | } |
813 | }; |
825 | }; |
814 | |
826 | |
815 | extern class rxvt_composite_vec rxvt_composite; |
827 | extern class rxvt_composite_vec rxvt_composite; |
|
|
828 | #endif |
|
|
829 | |
|
|
830 | #if 0 |
|
|
831 | // expand the sequence into a static array |
|
|
832 | // works even without ENABLE_COMBINING |
|
|
833 | template<typename T, int max_size_ = 48> |
|
|
834 | struct rxvt_compose_expand_static |
|
|
835 | { |
|
|
836 | #if ENABLE_COMBINING |
|
|
837 | enum { max_size = max_size_ }; |
|
|
838 | |
|
|
839 | T chrs[max_size]; |
|
|
840 | |
|
|
841 | // expand sequence and return start ptr |
|
|
842 | // guarantees at least one output |
|
|
843 | // get the length with length () on that ptr |
|
|
844 | T *operator ()(unicode_t c) |
|
|
845 | { |
|
|
846 | T *cur = chrs + max_size; |
|
|
847 | |
|
|
848 | while (ecb_expect_false (IS_COMPOSE (c))) |
|
|
849 | if (ecb_expect_true (c - COMPOSE_LO < rxvt_composite.v.size ())) |
|
|
850 | { |
|
|
851 | compose_char *cc = &rxvt_composite.v [c - COMPOSE_LO]; |
|
|
852 | |
|
|
853 | if (cc->c2 != NOCHAR) |
|
|
854 | { |
|
|
855 | cur -= cur > chrs; *cur = cc->c2; |
|
|
856 | } |
|
|
857 | |
|
|
858 | c = cc->c1; |
|
|
859 | } |
|
|
860 | else |
|
|
861 | c = NOCHAR; |
|
|
862 | |
|
|
863 | cur -= cur > chrs; *cur = c; |
|
|
864 | |
|
|
865 | return cur; |
|
|
866 | } |
|
|
867 | |
|
|
868 | int length (T *first) |
|
|
869 | { |
|
|
870 | return chrs + max_size - first; |
|
|
871 | } |
|
|
872 | #else |
|
|
873 | T chr; |
|
|
874 | |
|
|
875 | T *operator ()(text_t c); |
|
|
876 | { |
|
|
877 | chr = c; |
|
|
878 | return &chr; |
|
|
879 | } |
|
|
880 | |
|
|
881 | int length (T *first) |
|
|
882 | { |
|
|
883 | return 1; |
|
|
884 | } |
|
|
885 | #endif |
|
|
886 | }; |
816 | #endif |
887 | #endif |
817 | |
888 | |
818 | /****************************************************************************/ |
889 | /****************************************************************************/ |
819 | |
890 | |
820 | #ifdef KEYSYM_RESOURCE |
891 | #ifdef KEYSYM_RESOURCE |
… | |
… | |
1029 | current_screen:1, /* primary or secondary */ |
1100 | current_screen:1, /* primary or secondary */ |
1030 | num_scr_allow:1, |
1101 | num_scr_allow:1, |
1031 | bypass_keystate:1, |
1102 | bypass_keystate:1, |
1032 | #if ENABLE_FRILLS |
1103 | #if ENABLE_FRILLS |
1033 | urgency_hint:1, |
1104 | urgency_hint:1, |
|
|
1105 | rewrap_always:1, |
|
|
1106 | rewrap_never:1, |
1034 | #endif |
1107 | #endif |
1035 | #if CURSOR_BLINK |
1108 | #if CURSOR_BLINK |
1036 | hidden_cursor:1, |
1109 | hidden_cursor:1, |
1037 | #endif |
1110 | #endif |
1038 | #if TEXT_BLINK |
1111 | #if TEXT_BLINK |