… | |
… | |
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 | /* |
… | |
… | |
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 | // c1 can be any chaarcter != NOCHAR, including another compose character |
802 | // c1 can be any character != NOCHAR, including another compose character |
795 | // c2 must always be a zero-width character or NOCHAR, in case |
803 | // c2 must always be a zero-width character or NOCHAR, in case |
796 | // this just extends beyondthe BMP. |
804 | // this just extends beyond the BMP. |
797 | unicode_t c1, c2; |
805 | unicode_t c1, c2; |
798 | |
806 | |
799 | compose_char (unicode_t c1, unicode_t c2) |
807 | compose_char (unicode_t c1, unicode_t c2) |
800 | : c1(c1), c2(c2) |
808 | : c1(c1), c2(c2) |
801 | { } |
809 | { } |
802 | }; |
810 | }; |
803 | |
811 | |
804 | class rxvt_composite_vec |
812 | struct rxvt_composite_vec |
805 | { |
813 | { |
806 | vector<compose_char> v; |
814 | vector<compose_char> v; |
807 | public: |
815 | |
808 | text_t compose (unicode_t c1, unicode_t c2 = NOCHAR); |
816 | text_t compose (unicode_t c1, unicode_t c2 = NOCHAR); |
809 | template<typename T> int expand (unicode_t c, T *r); |
817 | template<typename T> int expand (unicode_t c, T *r); |
810 | int expand (unicode_t c) { return expand (c, (text_t *)0); } |
818 | int expand (unicode_t c) { return expand (c, (text_t *)0); } |
811 | compose_char *operator [](text_t c) |
819 | compose_char *operator [](text_t c) |
812 | { |
820 | { |
… | |
… | |
815 | : 0; |
823 | : 0; |
816 | } |
824 | } |
817 | }; |
825 | }; |
818 | |
826 | |
819 | 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 | }; |
820 | #endif |
887 | #endif |
821 | |
888 | |
822 | /****************************************************************************/ |
889 | /****************************************************************************/ |
823 | |
890 | |
824 | #ifdef KEYSYM_RESOURCE |
891 | #ifdef KEYSYM_RESOURCE |
… | |
… | |
1033 | current_screen:1, /* primary or secondary */ |
1100 | current_screen:1, /* primary or secondary */ |
1034 | num_scr_allow:1, |
1101 | num_scr_allow:1, |
1035 | bypass_keystate:1, |
1102 | bypass_keystate:1, |
1036 | #if ENABLE_FRILLS |
1103 | #if ENABLE_FRILLS |
1037 | urgency_hint:1, |
1104 | urgency_hint:1, |
|
|
1105 | rewrap_always:1, |
|
|
1106 | rewrap_never:1, |
1038 | #endif |
1107 | #endif |
1039 | #if CURSOR_BLINK |
1108 | #if CURSOR_BLINK |
1040 | hidden_cursor:1, |
1109 | hidden_cursor:1, |
1041 | #endif |
1110 | #endif |
1042 | #if TEXT_BLINK |
1111 | #if TEXT_BLINK |