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.569 by sf-exg, Sun Feb 19 08:48:42 2023 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/*
388 C0_SOH, C0_STX, C0_ETX, C0_EOT, C0_ENQ, C0_ACK, C0_BEL, 397 C0_SOH, C0_STX, C0_ETX, C0_EOT, C0_ENQ, C0_ACK, C0_BEL,
389 C0_BS , C0_HT , C0_LF , C0_VT , C0_FF , C0_CR , C0_SO , C0_SI , 398 C0_BS , C0_HT , C0_LF , C0_VT , C0_FF , C0_CR , C0_SO , C0_SI ,
390 C0_DLE, C0_DC1, C0_DC2, D0_DC3, C0_DC4, C0_NAK, C0_SYN, C0_ETB, 399 C0_DLE, C0_DC1, C0_DC2, D0_DC3, C0_DC4, C0_NAK, C0_SYN, C0_ETB,
391 C0_CAN, C0_EM , C0_SUB, C0_ESC, C0_IS4, C0_IS3, C0_IS2, C0_IS1, 400 C0_CAN, C0_EM , C0_SUB, C0_ESC, C0_IS4, C0_IS3, C0_IS2, C0_IS1,
392}; 401};
402
403struct string_term
404{
405 unsigned char v[3];
406};
407
393#define CHAR_ST 0x9c /* 0234 */ 408#define CHAR_ST 0x9c /* 0234 */
394 409
395/* 410/*
396 * XTerm Operating System Commands: ESC ] Ps;Pt (ST|BEL) 411 * XTerm Operating System Commands: ESC ] Ps;Pt (ST|BEL)
397 * colour extensions by Christian W. Zuckschwerdt <zany@triq.net> 412 * colour extensions by Christian W. Zuckschwerdt <zany@triq.net>
441 URxvt_boldItalicFont = 713, 456 URxvt_boldItalicFont = 713,
442 457
443 URxvt_view_up = 720, 458 URxvt_view_up = 720,
444 URxvt_view_down = 721, 459 URxvt_view_down = 721,
445 460
461 URxvt_cellinfo = 776, // returns font cell width, height etc.
446 URxvt_perl = 777, // for use by perl extensions, starts with "extension-name;" 462 URxvt_perl = 777, // for use by perl extensions, starts with "extension-name;"
447}; 463};
448 464
449/* Words starting with `Color_' are colours. Others are counts */ 465/* Words starting with `Color_' are colours. Others are counts */
450/* 466/*
769/****************************************************************************/ 785/****************************************************************************/
770 786
771#define UNICODE_MASK 0x1fffffUL 787#define UNICODE_MASK 0x1fffffUL
772 788
773#if UNICODE_3 789#if UNICODE_3
774# define COMPOSE_LO 0x40000000UL 790# define COMPOSE_LO 0x110000UL
775# define COMPOSE_HI 0x400fffffUL 791# define COMPOSE_HI 0x1fffffUL
776# define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO) 792# define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO)
777#else 793#else
778# if ENABLE_PERL 794# if ENABLE_PERL
779# define COMPOSE_LO 0xe000UL // our _own_ functions don't like (illegal) surrogates 795# 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 796# define COMPOSE_HI 0xf8ffUL // in utf-8, so use private use area only
789// compose chars are used to represent composite characters 805// compose chars are used to represent composite characters
790// that are not representable in unicode, as well as characters 806// that are not representable in unicode, as well as characters
791// not fitting in the BMP. 807// not fitting in the BMP.
792struct compose_char 808struct compose_char
793{ 809{
794 unicode_t c1, c2; // any chars != NOCHAR are valid 810 // c1 can be any character != NOCHAR, including another compose character
811 // c2 must always be a zero-width character or NOCHAR, in case
812 // this just extends beyond the BMP.
813 unicode_t c1, c2;
795 814
796 compose_char (unicode_t c1, unicode_t c2) 815 compose_char (unicode_t c1, unicode_t c2)
797 : c1(c1), c2(c2) 816 : c1(c1), c2(c2)
798 { } 817 { }
799}; 818};
800 819
801class rxvt_composite_vec 820struct rxvt_composite_vec
802{ 821{
803 vector<compose_char> v; 822 vector<compose_char> v;
804public: 823
805 text_t compose (unicode_t c1, unicode_t c2 = NOCHAR); 824 text_t compose (unicode_t c1, unicode_t c2 = NOCHAR);
806 int expand (unicode_t c, wchar_t *r); 825 template<typename T> int expand (unicode_t c, T *r);
826 int expand (unicode_t c) { return expand (c, (text_t *)0); }
807 compose_char *operator [](text_t c) 827 compose_char *operator [](text_t c)
808 { 828 {
809 return c >= COMPOSE_LO && c < COMPOSE_LO + v.size () 829 return c >= COMPOSE_LO && c < COMPOSE_LO + v.size ()
810 ? &v[c - COMPOSE_LO] 830 ? &v[c - COMPOSE_LO]
811 : 0; 831 : 0;
812 } 832 }
813}; 833};
814 834
815extern class rxvt_composite_vec rxvt_composite; 835extern class rxvt_composite_vec rxvt_composite;
836#endif
837
838#if 0
839// expand the sequence into a static array
840// works even without ENABLE_COMBINING
841template<typename T, int max_size_ = 48>
842struct rxvt_compose_expand_static
843{
844#if ENABLE_COMBINING
845 enum { max_size = max_size_ };
846
847 T chrs[max_size];
848
849 // expand sequence and return start ptr
850 // guarantees at least one output
851 // get the length with length () on that ptr
852 T *operator ()(unicode_t c)
853 {
854 T *cur = chrs + max_size;
855
856 while (ecb_expect_false (IS_COMPOSE (c)))
857 if (ecb_expect_true (c - COMPOSE_LO < rxvt_composite.v.size ()))
858 {
859 compose_char *cc = &rxvt_composite.v [c - COMPOSE_LO];
860
861 if (cc->c2 != NOCHAR)
862 {
863 cur -= cur > chrs; *cur = cc->c2;
864 }
865
866 c = cc->c1;
867 }
868 else
869 c = NOCHAR;
870
871 cur -= cur > chrs; *cur = c;
872
873 return cur;
874 }
875
876 int length (T *first)
877 {
878 return chrs + max_size - first;
879 }
880#else
881 T chr;
882
883 T *operator ()(text_t c);
884 {
885 chr = c;
886 return &chr;
887 }
888
889 int length (T *first)
890 {
891 return 1;
892 }
893#endif
894};
816#endif 895#endif
817 896
818/****************************************************************************/ 897/****************************************************************************/
819 898
820#ifdef KEYSYM_RESOURCE 899#ifdef KEYSYM_RESOURCE
1029 current_screen:1, /* primary or secondary */ 1108 current_screen:1, /* primary or secondary */
1030 num_scr_allow:1, 1109 num_scr_allow:1,
1031 bypass_keystate:1, 1110 bypass_keystate:1,
1032#if ENABLE_FRILLS 1111#if ENABLE_FRILLS
1033 urgency_hint:1, 1112 urgency_hint:1,
1113 rewrap_always:1,
1114 rewrap_never:1,
1034#endif 1115#endif
1035#if CURSOR_BLINK 1116#if CURSOR_BLINK
1036 hidden_cursor:1, 1117 hidden_cursor:1,
1037#endif 1118#endif
1038#if TEXT_BLINK 1119#if TEXT_BLINK
1289 void process_nonprinting (unicode_t ch); 1370 void process_nonprinting (unicode_t ch);
1290 void process_escape_vt52 (unicode_t ch); 1371 void process_escape_vt52 (unicode_t ch);
1291 void process_escape_seq (); 1372 void process_escape_seq ();
1292 void process_csi_seq (); 1373 void process_csi_seq ();
1293 void process_window_ops (const int *args, unsigned int nargs); 1374 void process_window_ops (const int *args, unsigned int nargs);
1294 char *get_to_st (unicode_t &ends_how); 1375 char *get_to_st (string_term &st);
1295 void process_dcs_seq (); 1376 void process_dcs_seq ();
1296 void process_osc_seq (); 1377 void process_osc_seq ();
1297 void process_color_seq (int report, int color, const char *str, char resp); 1378 void process_color_seq (int report, int color, const char *str, string_term &st);
1298 void process_xterm_seq (int op, char *str, char resp); 1379 void process_xterm_seq (int op, char *str, string_term &st);
1299 unsigned int map_rgb24_color (unsigned int r, unsigned int g, unsigned int b, unsigned int a); 1380 unsigned int map_rgb24_color (unsigned int r, unsigned int g, unsigned int b, unsigned int a);
1300 int privcases (int mode, unsigned long bit); 1381 int privcases (int mode, unsigned long bit);
1301 void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg); 1382 void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg);
1302 void process_sgr_mode (unsigned int nargs, const int *arg); 1383 void process_sgr_mode (unsigned int nargs, const int *arg);
1303 void set_cursor_style (int style); 1384 void set_cursor_style (int style);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines