ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvt.h
(Generate patch)

Comparing rxvt-unicode/src/rxvt.h (file contents):
Revision 1.556 by sf-exg, Thu May 13 19:40:19 2021 UTC vs.
Revision 1.568 by root, Sun Nov 21 23:34:23 2021 UTC

23#if HAVE_WCHAR_H 23#if HAVE_WCHAR_H
24# include <wchar.h> 24# include <wchar.h>
25#else 25#else
26// stdlib.h might provide it 26// stdlib.h might provide it
27#endif 27#endif
28
29#include <libptytty.h>
28 30
29// we assume that Xlib.h defines XPointer, and it does since at least 1994... 31// we assume that Xlib.h defines XPointer, and it does since at least 1994...
30 32
31extern "C" { 33extern "C" {
32#include <X11/Xlib.h> 34#include <X11/Xlib.h>
88#include "rxvtfont.h" 90#include "rxvtfont.h"
89#include "rxvttoolkit.h" 91#include "rxvttoolkit.h"
90#include "rxvtimg.h" 92#include "rxvtimg.h"
91#include "scrollbar.h" 93#include "scrollbar.h"
92#include "ev_cpp.h" 94#include "ev_cpp.h"
93#include "libptytty.h"
94 95
95#include "rxvtperl.h" 96#include "rxvtperl.h"
96 97
97// try to avoid some macros to decrease code size, on some systems 98// try to avoid some macros to decrease code size, on some systems
98#if ENABLE_MINIMAL 99#if ENABLE_MINIMAL
123#endif 124#endif
124 125
125/****************************************************************************/ 126/****************************************************************************/
126 127
127// exception thrown on fatal (per-instance) errors 128// exception thrown on fatal (per-instance) errors
128class rxvt_failure_exception { }; 129class rxvt_failure_exception : public std::exception
130{
131public:
132 const char *
133 what () const noexcept override
134 {
135 return "";
136 }
137};
129 138
130// exception thrown when the command parser runs out of input data 139// exception thrown when the command parser runs out of input data
131class out_of_input { }; 140class out_of_input { };
132 141
133/* 142/*
441 URxvt_boldItalicFont = 713, 450 URxvt_boldItalicFont = 713,
442 451
443 URxvt_view_up = 720, 452 URxvt_view_up = 720,
444 URxvt_view_down = 721, 453 URxvt_view_down = 721,
445 454
455 URxvt_cellinfo = 776, // returns font cell width, height etc.
446 URxvt_perl = 777, // for use by perl extensions, starts with "extension-name;" 456 URxvt_perl = 777, // for use by perl extensions, starts with "extension-name;"
447}; 457};
448 458
449/* Words starting with `Color_' are colours. Others are counts */ 459/* Words starting with `Color_' are colours. Others are counts */
450/* 460/*
769/****************************************************************************/ 779/****************************************************************************/
770 780
771#define UNICODE_MASK 0x1fffffUL 781#define UNICODE_MASK 0x1fffffUL
772 782
773#if UNICODE_3 783#if UNICODE_3
774# define COMPOSE_LO 0x40000000UL 784# define COMPOSE_LO 0x110000UL
775# define COMPOSE_HI 0x400fffffUL 785# define COMPOSE_HI 0x1fffffUL
776# define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO) 786# define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO)
777#else 787#else
778# if ENABLE_PERL 788# if ENABLE_PERL
779# define COMPOSE_LO 0xe000UL // our _own_ functions don't like (illegal) surrogates 789# 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 790# define COMPOSE_HI 0xf8ffUL // in utf-8, so use private use area only
789// compose chars are used to represent composite characters 799// compose chars are used to represent composite characters
790// that are not representable in unicode, as well as characters 800// that are not representable in unicode, as well as characters
791// not fitting in the BMP. 801// not fitting in the BMP.
792struct compose_char 802struct compose_char
793{ 803{
794 unicode_t c1, c2; // any chars != NOCHAR are valid 804 // c1 can be any character != NOCHAR, including another compose character
805 // c2 must always be a zero-width character or NOCHAR, in case
806 // this just extends beyond the BMP.
807 unicode_t c1, c2;
795 808
796 compose_char (unicode_t c1, unicode_t c2) 809 compose_char (unicode_t c1, unicode_t c2)
797 : c1(c1), c2(c2) 810 : c1(c1), c2(c2)
798 { } 811 { }
799}; 812};
800 813
801class rxvt_composite_vec 814struct rxvt_composite_vec
802{ 815{
803 vector<compose_char> v; 816 vector<compose_char> v;
804public: 817
805 text_t compose (unicode_t c1, unicode_t c2 = NOCHAR); 818 text_t compose (unicode_t c1, unicode_t c2 = NOCHAR);
806 int expand (unicode_t c, wchar_t *r); 819 template<typename T> int expand (unicode_t c, T *r);
820 int expand (unicode_t c) { return expand (c, (text_t *)0); }
807 compose_char *operator [](text_t c) 821 compose_char *operator [](text_t c)
808 { 822 {
809 return c >= COMPOSE_LO && c < COMPOSE_LO + v.size () 823 return c >= COMPOSE_LO && c < COMPOSE_LO + v.size ()
810 ? &v[c - COMPOSE_LO] 824 ? &v[c - COMPOSE_LO]
811 : 0; 825 : 0;
812 } 826 }
813}; 827};
814 828
815extern class rxvt_composite_vec rxvt_composite; 829extern class rxvt_composite_vec rxvt_composite;
830#endif
831
832#if 0
833// expand the sequence into a static array
834// works even without ENABLE_COMBINING
835template<typename T, int max_size_ = 48>
836struct rxvt_compose_expand_static
837{
838#if ENABLE_COMBINING
839 enum { max_size = max_size_ };
840
841 T chrs[max_size];
842
843 // expand sequence and return start ptr
844 // guarantees at least one output
845 // get the length with length () on that ptr
846 T *operator ()(unicode_t c)
847 {
848 T *cur = chrs + max_size;
849
850 while (ecb_expect_false (IS_COMPOSE (c)))
851 if (ecb_expect_true (c - COMPOSE_LO < rxvt_composite.v.size ()))
852 {
853 compose_char *cc = &rxvt_composite.v [c - COMPOSE_LO];
854
855 if (cc->c2 != NOCHAR)
856 {
857 cur -= cur > chrs; *cur = cc->c2;
858 }
859
860 c = cc->c1;
861 }
862 else
863 c = NOCHAR;
864
865 cur -= cur > chrs; *cur = c;
866
867 return cur;
868 }
869
870 int length (T *first)
871 {
872 return chrs + max_size - first;
873 }
874#else
875 T chr;
876
877 T *operator ()(text_t c);
878 {
879 chr = c;
880 return &chr;
881 }
882
883 int length (T *first)
884 {
885 return 1;
886 }
887#endif
888};
816#endif 889#endif
817 890
818/****************************************************************************/ 891/****************************************************************************/
819 892
820#ifdef KEYSYM_RESOURCE 893#ifdef KEYSYM_RESOURCE
1029 current_screen:1, /* primary or secondary */ 1102 current_screen:1, /* primary or secondary */
1030 num_scr_allow:1, 1103 num_scr_allow:1,
1031 bypass_keystate:1, 1104 bypass_keystate:1,
1032#if ENABLE_FRILLS 1105#if ENABLE_FRILLS
1033 urgency_hint:1, 1106 urgency_hint:1,
1107 rewrap_always:1,
1108 rewrap_never:1,
1034#endif 1109#endif
1035#if CURSOR_BLINK 1110#if CURSOR_BLINK
1036 hidden_cursor:1, 1111 hidden_cursor:1,
1037#endif 1112#endif
1038#if TEXT_BLINK 1113#if TEXT_BLINK

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines