forked from Bill-Gray/PDCursesMod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
curses.h
1872 lines (1675 loc) · 76.3 KB
/
curses.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*----------------------------------------------------------------------*
* PDCursesMod *
*----------------------------------------------------------------------*/
#ifndef __PDCURSES__
#define __PDCURSES__ 1
#define __PDCURSESMOD__ 1
/*man-start**************************************************************
Define before inclusion (only those needed):
XCURSES if building / built for X11
PDC_RGB if you want to use RGB color definitions
(Red = 1, Green = 2, Blue = 4) instead of BGR
PDC_WIDE if building / built with wide-character support
PDC_FORCE_UTF8 if forcing use of UTF8
PDC_DLL_BUILD if building / built as a Windows DLL
PDC_NCMOUSE to use the ncurses mouse API instead
of PDCurses' traditional mouse API
Defined by this header:
PDCURSES PDCurses-only features are available
PDC_BUILD API build version
PDC_VER_MAJOR major version number
PDC_VER_MINOR minor version number
PDC_VER_CHANGE version change number
PDC_VER_YEAR year of version
PDC_VER_MONTH month of version
PDC_VER_DAY day of month of version
PDC_VERDOT version string
**man-end****************************************************************/
#define PDCURSES 1
#define PDC_BUILD (PDC_VER_MAJOR*1000 + PDC_VER_MINOR *100 + PDC_VER_CHANGE)
#define PDC_VER_MAJOR 4
#define PDC_VER_MINOR 3
#define PDC_VER_CHANGE 3
#define PDC_VER_YEAR 2022
#define PDC_VER_MONTH 05
#define PDC_VER_DAY 25
#define PDC_STRINGIZE( x) #x
#define PDC_stringize( x) PDC_STRINGIZE( x)
#define PDC_VERDOT PDC_stringize( PDC_VER_MAJOR) "." \
PDC_stringize( PDC_VER_MINOR) "." \
PDC_stringize( PDC_VER_CHANGE)
#define PDC_VER_YMD PDC_stringize( PDC_VER_YEAR) "-" \
PDC_stringize( PDC_VER_MONTH) "-" \
PDC_stringize( PDC_VER_DAY)
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
# define PDC_99 1
#endif
#if defined(__cplusplus) && __cplusplus >= 199711L
# define PDC_PP98 1
#endif
/*----------------------------------------------------------------------*/
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#ifdef PDC_WIDE
# include <wchar.h>
#endif
#if defined(PDC_99) && !defined(__bool_true_false_are_defined)
# include <stdbool.h>
#endif
#ifdef __cplusplus
extern "C"
{
# ifndef PDC_PP98
# define bool _bool
# endif
#endif
#ifdef NO_STDINT_H
#define uint64_t unsigned __int64
#define uint32_t unsigned long
#define uint16_t unsigned short
#define int32_t long
#define int16_t short
#else
#include <stdint.h>
#endif
/*----------------------------------------------------------------------
*
* Constants and Types
*
*/
#undef FALSE
#define FALSE 0
#undef TRUE
#define TRUE 1
#undef ERR
#define ERR (-1)
#undef OK
#define OK 0
#if !defined(PDC_PP98) && !defined(__bool_true_false_are_defined)
typedef unsigned char bool;
#endif
#if defined( CHTYPE_32)
typedef uint32_t chtype; /* chtypes will be 32 bits */
typedef uint32_t mmask_t;
#else
typedef uint64_t chtype; /* chtypes will be 64 bits */
typedef uint64_t mmask_t;
#define PDC_LONG_MMASK
#ifdef PDC_WIDE
#define USING_COMBINING_CHARACTER_SCHEME
#endif
#endif
#ifdef PDC_WIDE
typedef chtype cchar_t;
#endif
typedef chtype attr_t;
/*----------------------------------------------------------------------
*
* Version Info
*
*/
enum PDC_port
{
PDC_PORT_X11 = 0,
PDC_PORT_WINCON = 1,
PDC_PORT_WINGUI = 2,
PDC_PORT_DOS = 3,
PDC_PORT_OS2 = 4,
PDC_PORT_SDL1 = 5,
PDC_PORT_SDL2 = 6,
PDC_PORT_VT = 7,
PDC_PORT_DOSVGA = 8,
PDC_PORT_PLAN9 = 9,
PDC_PORT_LINUX_FB = 10
};
/* Use this structure with PDC_get_version() for run-time info about the
way the library was built, in case it doesn't match the header. */
typedef struct
{
short flags; /* flags OR'd together (see below) */
short build; /* PDC_BUILD at compile time */
unsigned char major; /* PDC_VER_MAJOR */
unsigned char minor; /* PDC_VER_MINOR */
unsigned char change; /* PDC_VER_CHANGE */
unsigned char csize; /* sizeof chtype */
unsigned char bsize; /* sizeof bool */
enum PDC_port port;
} PDC_VERSION;
enum
{
PDC_VFLAG_DEBUG = 1, /* set if built with -DPDCDEBUG */
PDC_VFLAG_WIDE = 2, /* -DPDC_WIDE */
PDC_VFLAG_UTF8 = 4, /* -DPDC_FORCE_UTF8 */
PDC_VFLAG_DLL = 8, /* -DPDC_DLL_BUILD */
PDC_VFLAG_RGB = 16 /* -DPDC_RGB */
};
/*----------------------------------------------------------------------
*
* Mouse Interface -- SYSVR4, with extensions
*
*/
#define PDC_MAX_MOUSE_BUTTONS 9
typedef struct
{
int x; /* absolute column, 0 based, measured in characters */
int y; /* absolute row, 0 based, measured in characters */
short button[PDC_MAX_MOUSE_BUTTONS]; /* state of each button */
int changes; /* flags indicating what has changed with the mouse */
} MOUSE_STATUS;
#define BUTTON_RELEASED 0x0000
#define BUTTON_PRESSED 0x0001
#define BUTTON_CLICKED 0x0002
#define BUTTON_DOUBLE_CLICKED 0x0003
#define BUTTON_TRIPLE_CLICKED 0x0004
#define BUTTON_MOVED 0x0005 /* PDCurses */
#define WHEEL_SCROLLED 0x0006 /* PDCurses */
#define BUTTON_ACTION_MASK 0x0007 /* PDCurses */
#define PDC_BUTTON_SHIFT 0x0008 /* PDCurses */
#define PDC_BUTTON_CONTROL 0x0010 /* PDCurses */
#define PDC_BUTTON_ALT 0x0020 /* PDCurses */
#define BUTTON_MODIFIER_MASK 0x0038 /* PDCurses */
#define MOUSE_X_POS (Mouse_status.x)
#define MOUSE_Y_POS (Mouse_status.y)
/*
* Bits associated with the .changes field:
* 3 2 1 0
* 210987654321098765432109876543210
* 1 <- button 1 has changed 0
* 10 <- button 2 has changed 1
* 100 <- button 3 has changed 2
* 1000 <- mouse has moved 3
* (Not actually used!) 10000 <- mouse position report 4
* 100000 <- mouse wheel up 5
* 1000000 <- mouse wheel down 6
* 10000000 <- mouse wheel left 7
* 100000000 <- mouse wheel right 8
* (Buttons 4 and up are 1000000000 <- button 4 has changed 9
* PDCursesMod-only, 10000000000 <- button 5 has changed 10
* and only 4 & 5 are 100000000000 <- button 6 has changed 11
* currently used) 1000000000000 <- button 7 has changed 12
* 10000000000000 <- button 8 has changed 13
* 100000000000000 <- button 9 has changed 14
*/
#define PDC_MOUSE_MOVED 0x0008
#define PDC_MOUSE_UNUSED_BIT 0x0010
#define PDC_MOUSE_WHEEL_UP 0x0020
#define PDC_MOUSE_WHEEL_DOWN 0x0040
#define PDC_MOUSE_WHEEL_LEFT 0x0080
#define PDC_MOUSE_WHEEL_RIGHT 0x0100
#define A_BUTTON_CHANGED (Mouse_status.changes & 7)
#define MOUSE_MOVED (Mouse_status.changes & PDC_MOUSE_MOVED)
#define BUTTON_CHANGED(x) (Mouse_status.changes & (1 << ((x) - ((x)<4 ? 1 : -5))))
#define BUTTON_STATUS(x) (Mouse_status.button[(x) - 1])
#define MOUSE_WHEEL_UP (Mouse_status.changes & PDC_MOUSE_WHEEL_UP)
#define MOUSE_WHEEL_DOWN (Mouse_status.changes & PDC_MOUSE_WHEEL_DOWN)
#define MOUSE_WHEEL_LEFT (Mouse_status.changes & PDC_MOUSE_WHEEL_LEFT)
#define MOUSE_WHEEL_RIGHT (Mouse_status.changes & PDC_MOUSE_WHEEL_RIGHT)
/* mouse bit-masks */
#define BUTTON1_RELEASED (mmask_t)0x01
#define BUTTON1_PRESSED (mmask_t)0x02
#define BUTTON1_CLICKED (mmask_t)0x04
#define BUTTON1_DOUBLE_CLICKED (mmask_t)0x08
#define BUTTON1_TRIPLE_CLICKED (mmask_t)0x10
/* With the "traditional" 32-bit mmask_t, mouse move and triple-clicks
share the same bit and can't be distinguished. 64-bit mmask_ts allow us
to make the distinction, and will allow other events to be added later. */
#ifdef PDC_LONG_MMASK
#define BUTTON1_MOVED (mmask_t)0x20 /* PDCurses */
#define PDC_BITS_PER_BUTTON 6
#else
#define BUTTON1_MOVED (mmask_t)0x10 /* PDCurses */
#define PDC_BITS_PER_BUTTON 5
#endif
#define PDC_SHIFTED_BUTTON( button, n) ((mmask_t)(button) << (((n) - 1) * PDC_BITS_PER_BUTTON))
#define BUTTON2_RELEASED PDC_SHIFTED_BUTTON( BUTTON1_RELEASED, 2)
#define BUTTON2_PRESSED PDC_SHIFTED_BUTTON( BUTTON1_PRESSED, 2)
#define BUTTON2_CLICKED PDC_SHIFTED_BUTTON( BUTTON1_CLICKED, 2)
#define BUTTON2_DOUBLE_CLICKED PDC_SHIFTED_BUTTON( BUTTON1_DOUBLE_CLICKED, 2)
#define BUTTON2_TRIPLE_CLICKED PDC_SHIFTED_BUTTON( BUTTON1_TRIPLE_CLICKED, 2)
#define BUTTON2_MOVED PDC_SHIFTED_BUTTON( BUTTON1_MOVED, 2)
#define BUTTON3_RELEASED PDC_SHIFTED_BUTTON( BUTTON1_RELEASED, 3)
#define BUTTON3_PRESSED PDC_SHIFTED_BUTTON( BUTTON1_PRESSED, 3)
#define BUTTON3_CLICKED PDC_SHIFTED_BUTTON( BUTTON1_CLICKED, 3)
#define BUTTON3_DOUBLE_CLICKED PDC_SHIFTED_BUTTON( BUTTON1_DOUBLE_CLICKED, 3)
#define BUTTON3_TRIPLE_CLICKED PDC_SHIFTED_BUTTON( BUTTON1_TRIPLE_CLICKED, 3)
#define BUTTON3_MOVED PDC_SHIFTED_BUTTON( BUTTON1_MOVED, 3)
/* For the ncurses-compatible functions only, BUTTON4_PRESSED and
BUTTON5_PRESSED are returned for mouse scroll wheel up and down;
otherwise PDCurses doesn't support buttons 4 and 5... except
as described above for WinGUI, and perhaps to be extended to
other PDCurses flavors */
#define BUTTON4_RELEASED PDC_SHIFTED_BUTTON( BUTTON1_RELEASED, 4)
#define BUTTON4_PRESSED PDC_SHIFTED_BUTTON( BUTTON1_PRESSED, 4)
#define BUTTON4_CLICKED PDC_SHIFTED_BUTTON( BUTTON1_CLICKED, 4)
#define BUTTON4_DOUBLE_CLICKED PDC_SHIFTED_BUTTON( BUTTON1_DOUBLE_CLICKED, 4)
#define BUTTON4_TRIPLE_CLICKED PDC_SHIFTED_BUTTON( BUTTON1_TRIPLE_CLICKED, 4)
#define BUTTON4_MOVED PDC_SHIFTED_BUTTON( BUTTON1_MOVED, 4)
#define BUTTON5_RELEASED PDC_SHIFTED_BUTTON( BUTTON1_RELEASED, 5)
#define BUTTON5_PRESSED PDC_SHIFTED_BUTTON( BUTTON1_PRESSED, 5)
#define BUTTON5_CLICKED PDC_SHIFTED_BUTTON( BUTTON1_CLICKED, 5)
#define BUTTON5_DOUBLE_CLICKED PDC_SHIFTED_BUTTON( BUTTON1_DOUBLE_CLICKED, 5)
#define BUTTON5_TRIPLE_CLICKED PDC_SHIFTED_BUTTON( BUTTON1_TRIPLE_CLICKED, 5)
#define BUTTON5_MOVED PDC_SHIFTED_BUTTON( BUTTON1_MOVED, 5)
#define MOUSE_WHEEL_SCROLL PDC_SHIFTED_BUTTON( BUTTON1_RELEASED, 6)
#define BUTTON_MODIFIER_SHIFT (MOUSE_WHEEL_SCROLL << 1)
#define BUTTON_MODIFIER_CONTROL (MOUSE_WHEEL_SCROLL << 2)
#define BUTTON_MODIFIER_ALT (MOUSE_WHEEL_SCROLL << 3)
#define REPORT_MOUSE_POSITION (MOUSE_WHEEL_SCROLL << 4)
#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1)
/* ncurses mouse interface */
typedef struct
{
short id; /* unused, always 0 */
int x, y, z; /* x, y same as MOUSE_STATUS; z unused */
mmask_t bstate; /* equivalent to changes + button[], but
in the same format as used for mousemask() */
} MEVENT;
#if defined(PDC_NCMOUSE) && !defined(NCURSES_MOUSE_VERSION)
# define NCURSES_MOUSE_VERSION 2
#endif
#ifdef NCURSES_MOUSE_VERSION
# define BUTTON_SHIFT BUTTON_MODIFIER_SHIFT
# define BUTTON_CONTROL BUTTON_MODIFIER_CONTROL
# define BUTTON_CTRL BUTTON_MODIFIER_CONTROL
# define BUTTON_ALT BUTTON_MODIFIER_ALT
#else
# define BUTTON_SHIFT PDC_BUTTON_SHIFT
# define BUTTON_CONTROL PDC_BUTTON_CONTROL
# define BUTTON_ALT PDC_BUTTON_ALT
#endif
/*----------------------------------------------------------------------
*
* Window and Screen Structures
*
*/
typedef struct _win /* definition of a window */
{
int _cury; /* current pseudo-cursor */
int _curx;
int _maxy; /* max window coordinates */
int _maxx;
int _begy; /* origin on screen */
int _begx;
int _flags; /* window properties */
chtype _attrs; /* standard attributes and colors */
chtype _bkgd; /* background, normally blank */
bool _clear; /* causes clear at next refresh */
bool _leaveit; /* leaves cursor where it is */
bool _scroll; /* allows window scrolling */
bool _nodelay; /* input character wait flag */
bool _immed; /* immediate update flag */
bool _sync; /* synchronise window ancestors */
bool _use_keypad; /* flags keypad key mode active */
chtype **_y; /* pointer to line pointer array */
int *_firstch; /* first changed character in line */
int *_lastch; /* last changed character in line */
int _tmarg; /* top of scrolling region */
int _bmarg; /* bottom of scrolling region */
int _delayms; /* milliseconds of delay for getch() */
int _parx, _pary; /* coords relative to parent (0,0) */
struct _win *_parent; /* subwin's pointer to parent win */
int _pminrow, _pmincol; /* saved position used only for pads */
int _sminrow, _smaxrow; /* saved position used only for pads */
int _smincol, _smaxcol; /* saved position used only for pads */
} WINDOW;
/* Avoid using the SCREEN struct directly -- use the corresponding
functions if possible. This struct may eventually be made private. */
typedef struct
{
bool alive; /* if initscr() called, and not endwin() */
bool autocr; /* if cr -> lf */
bool cbreak; /* if terminal unbuffered */
bool echo; /* if terminal echo */
bool raw_inp; /* raw input mode (v. cooked input) */
bool raw_out; /* raw output mode (7 v. 8 bits) */
bool audible; /* FALSE if the bell is visual */
bool mono; /* TRUE if current screen is mono */
bool resized; /* TRUE if TERM has been resized */
bool orig_attr; /* TRUE if we have the original colors */
short orig_fore; /* original screen foreground color */
short orig_back; /* original screen foreground color */
int cursrow; /* position of physical cursor */
int curscol; /* position of physical cursor */
int visibility; /* visibility of cursor */
int orig_cursor; /* original cursor size */
int lines; /* new value for LINES */
int cols; /* new value for COLS */
mmask_t _trap_mbe; /* trap these mouse button events */
int mouse_wait; /* time to wait (in ms) for a
button release after a press, in
order to count it as a click */
int slklines; /* lines in use by slk_init() */
WINDOW *slk_winptr; /* window for slk */
int linesrippedoff; /* lines ripped off via ripoffline() */
int linesrippedoffontop; /* lines ripped off on
top via ripoffline() */
int delaytenths; /* 1/10ths second to wait block
getch() for */
bool _preserve; /* TRUE if screen background
to be preserved */
int _restore; /* specifies if screen background
to be restored, and how */
unsigned long key_modifiers; /* key modifiers (SHIFT, CONTROL, etc.)
on last key press */
bool return_key_modifiers; /* TRUE if modifier keys are
returned as "real" keys */
bool unused_key_code; /* (was) TRUE if last key is a special key;
used internally by get_wch() */
MOUSE_STATUS mouse_status; /* last returned mouse status */
short line_color; /* color of line attributes - default -1 */
attr_t termattrs; /* attribute capabilities */
WINDOW *lastscr; /* the last screen image */
FILE *dbfp; /* debug trace file pointer */
bool color_started; /* TRUE after start_color() */
bool dirty; /* redraw on napms() after init_color() */
int sel_start; /* start of selection (y * COLS + x) */
int sel_end; /* end of selection */
int *c_buffer; /* character buffer */
int c_pindex; /* putter index */
int c_gindex; /* getter index */
int *c_ungch; /* array of ungotten chars */
int c_ungind; /* ungetch() push index */
int c_ungmax; /* allocated size of ungetch() buffer */
void *atrtab; /* table of color pairs */
} SCREEN;
/*----------------------------------------------------------------------
*
* External Variables
*
*/
#ifdef PDC_DLL_BUILD
# ifdef CURSES_LIBRARY
# define PDCEX __declspec(dllexport) extern
# else
# define PDCEX __declspec(dllimport)
# endif
#else
# define PDCEX extern
#endif
PDCEX int LINES; /* terminal height */
PDCEX int COLS; /* terminal width */
PDCEX WINDOW *stdscr; /* the default screen window */
PDCEX WINDOW *curscr; /* the current screen image */
PDCEX SCREEN *SP; /* curses variables */
PDCEX MOUSE_STATUS Mouse_status;
PDCEX int COLORS;
PDCEX int COLOR_PAIRS;
PDCEX int TABSIZE;
PDCEX chtype acs_map[]; /* alternate character set map */
PDCEX char ttytype[]; /* terminal name/description */
/*man-start**************************************************************
Text Attributes
===============
By default, PDCurses uses 64-bit integers for its chtype. All chtypes
have bits devoted to character data, attribute data, and color pair data.
There are three configurations supported :
Default, 64-bit chtype, both wide- and 8-bit character builds:
-------------------------------------------------------------------------------
|63|62|..|53|52|..|34|33|32|31|30|29|28|..|22|21|20|19|18|17|16|..| 3| 2| 1| 0|
-------------------------------------------------------------------------------
unused |color pair | modifiers | character eg 'a'
21 character bits (0-20), enough for full Unicode coverage
12 attribute bits (21-32)
20 color pair bits (33-52), enough for 1048576 color pairs
11 currently unused bits (53-63)
32-bit chtypes with wide characters (CHTYPE_32 and PDC_WIDE are #defined):
+--------------------------------------------------------------------+
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|..| 2| 1| 0|
+--------------------------------------------------------------------+
color pair | modifiers | character eg 'a'
16 character bits (0-16), enough for BMP (Unicode below 64K)
8 attribute bits (16-23)
8 color pair bits (24-31), for 256 color pairs
32-bit chtypes with narrow characters (CHTYPE_32 #defined, PDC_WIDE is not):
+--------------------------------------------------------------------+
|31|30|29|28|..|22|21|20|19|18|17|16|..|12|11|10| 9| 8| 7| 6|..| 1| 0|
+--------------------------------------------------------------------+
color pair | modifiers |character
8 character bits (0-7); only 8-bit charsets will work
12 attribute bits (8-19)
12 color pair bits (20-31), for 4096 pairs
All attribute modifier schemes include eight "basic" bits: bold, underline,
right-line, left-line, italic, reverse and blink attributes, plus the
alternate character set indicator. For default and 32-bit narrow builds,
three more bits are used for underlined, dimmed, and strikeout attributes;
a fourth bit is reserved.
Default chtypes have enough character bits to support the full range of
Unicode, all attributes, and 2^20 = 1048576 color pairs. Note, though,
that as of 2021 Dec 21, only WinGUI, VT, X11, and SDLn have COLOR_PAIRS
= 1048576. Other platforms (DOSVGA, Plan9, WinCon) may join them. Some
(DOS, OS/2) simply do not have full-color capability.
**man-end****************************************************************/
/*** Video attribute macros ***/
#define A_NORMAL (chtype)0
#ifndef CHTYPE_32
/* 64-bit chtypes, both wide- and narrow */
# define PDC_CHARTEXT_BITS 21
# define PDC_ATTRIBUTE_BITS 12
# define PDC_COLOR_BITS 20
# else
#ifdef PDC_WIDE
/* 32-bit chtypes, wide character */
# define PDC_CHARTEXT_BITS 16
# define PDC_ATTRIBUTE_BITS 8
# define PDC_COLOR_BITS 8
#else
/* 32-bit chtypes, narrow (8-bit) characters */
# define PDC_CHARTEXT_BITS 8
# define PDC_ATTRIBUTE_BITS 12
# define PDC_COLOR_BITS 12
#endif
#endif
# define PDC_COLOR_SHIFT (PDC_CHARTEXT_BITS + PDC_ATTRIBUTE_BITS)
# define A_COLOR ((((chtype)1 << PDC_COLOR_BITS) - 1) << PDC_COLOR_SHIFT)
# define A_ATTRIBUTES (((((chtype)1 << PDC_ATTRIBUTE_BITS) - 1) << PDC_CHARTEXT_BITS) | A_COLOR)
# define A_CHARTEXT (((chtype)1 << PDC_CHARTEXT_BITS) - 1)
#define PDC_ATTRIBUTE_BIT( N) ((chtype)1 << (N))
# define A_ALTCHARSET PDC_ATTRIBUTE_BIT( PDC_CHARTEXT_BITS)
# define A_RIGHT PDC_ATTRIBUTE_BIT( PDC_CHARTEXT_BITS + 1)
# define A_LEFT PDC_ATTRIBUTE_BIT( PDC_CHARTEXT_BITS + 2)
# define A_INVIS PDC_ATTRIBUTE_BIT( PDC_CHARTEXT_BITS + 3)
# define A_UNDERLINE PDC_ATTRIBUTE_BIT( PDC_CHARTEXT_BITS + 4)
# define A_REVERSE PDC_ATTRIBUTE_BIT( PDC_CHARTEXT_BITS + 5)
# define A_BLINK PDC_ATTRIBUTE_BIT( PDC_CHARTEXT_BITS + 6)
# define A_BOLD PDC_ATTRIBUTE_BIT( PDC_CHARTEXT_BITS + 7)
#if PDC_COLOR_BITS >= 11
# define A_OVERLINE PDC_ATTRIBUTE_BIT( PDC_CHARTEXT_BITS + 8)
# define A_STRIKEOUT PDC_ATTRIBUTE_BIT( PDC_CHARTEXT_BITS + 9)
# define A_DIM PDC_ATTRIBUTE_BIT( PDC_CHARTEXT_BITS + 10)
/* Reserved bit : PDC_ATTRIBUTE_BIT( PDC_CHARTEXT_BITS + 11) */
#else
# define A_DIM A_NORMAL
# define A_OVERLINE A_NORMAL
# define A_STRIKEOUT A_NORMAL
#endif
#define A_ITALIC A_INVIS
#define A_PROTECT (A_UNDERLINE | A_LEFT | A_RIGHT)
#define A_STANDOUT (A_REVERSE | A_BOLD) /* X/Open */
#define A_HORIZONTAL A_NORMAL
#define A_LOW A_NORMAL
#define A_TOP A_NORMAL
#define A_VERTICAL A_NORMAL
#define CHR_MSK A_CHARTEXT /* Obsolete */
#define ATR_MSK A_ATTRIBUTES /* Obsolete */
#define ATR_NRM A_NORMAL /* Obsolete */
#define A_LEFTLINE A_LEFT
#define A_RIGHTLINE A_RIGHT
/* For use with attr_t -- X/Open says, "these shall be distinct", so
this is a non-conforming implementation. */
#define WA_NORMAL A_NORMAL
#define WA_ALTCHARSET A_ALTCHARSET
#define WA_BLINK A_BLINK
#define WA_BOLD A_BOLD
#define WA_DIM A_DIM
#define WA_INVIS A_INVIS
#define WA_ITALIC A_ITALIC
#define WA_LEFT A_LEFT
#define WA_PROTECT A_PROTECT
#define WA_REVERSE A_REVERSE
#define WA_RIGHT A_RIGHT
#define WA_STANDOUT A_STANDOUT
#define WA_UNDERLINE A_UNDERLINE
#define WA_HORIZONTAL A_HORIZONTAL
#define WA_LOW A_LOW
#define WA_TOP A_TOP
#define WA_VERTICAL A_VERTICAL
#define WA_ATTRIBUTES A_ATTRIBUTES
/*** Alternate character set macros ***/
#define PDC_ACS(w) ((chtype)w | A_ALTCHARSET)
/* VT100-compatible symbols -- box chars */
#define ACS_LRCORNER PDC_ACS('V')
#define ACS_URCORNER PDC_ACS('W')
#define ACS_ULCORNER PDC_ACS('X')
#define ACS_LLCORNER PDC_ACS('Y')
#define ACS_PLUS PDC_ACS('Z')
#define ACS_LTEE PDC_ACS('[')
#define ACS_RTEE PDC_ACS('\\')
#define ACS_BTEE PDC_ACS(']')
#define ACS_TTEE PDC_ACS('^')
#define ACS_HLINE PDC_ACS('_')
#define ACS_VLINE PDC_ACS('`')
/* PDCurses-only ACS chars. Don't use if ncurses compatibility matters.
Some won't work in non-wide X11 builds (see 'acs_defs.h' for details). */
#define ACS_CENT PDC_ACS('{')
#define ACS_YEN PDC_ACS('|')
#define ACS_PESETA PDC_ACS('}')
#define ACS_HALF PDC_ACS('&')
#define ACS_QUARTER PDC_ACS('\'')
#define ACS_LEFT_ANG_QU PDC_ACS(')')
#define ACS_RIGHT_ANG_QU PDC_ACS('*')
#define ACS_D_HLINE PDC_ACS('a')
#define ACS_D_VLINE PDC_ACS('b')
#define ACS_CLUB PDC_ACS( 11)
#define ACS_HEART PDC_ACS( 12)
#define ACS_SPADE PDC_ACS( 13)
#define ACS_SMILE PDC_ACS( 14)
#define ACS_REV_SMILE PDC_ACS( 15)
#define ACS_MED_BULLET PDC_ACS( 16)
#define ACS_WHITE_BULLET PDC_ACS( 17)
#define ACS_PILCROW PDC_ACS( 18)
#define ACS_SECTION PDC_ACS( 19)
#define ACS_SUP2 PDC_ACS(',')
#define ACS_ALPHA PDC_ACS('.')
#define ACS_BETA PDC_ACS('/')
#define ACS_GAMMA PDC_ACS('0')
#define ACS_UP_SIGMA PDC_ACS('1')
#define ACS_LO_SIGMA PDC_ACS('2')
#define ACS_MU PDC_ACS('4')
#define ACS_TAU PDC_ACS('5')
#define ACS_UP_PHI PDC_ACS('6')
#define ACS_THETA PDC_ACS('7')
#define ACS_OMEGA PDC_ACS('8')
#define ACS_DELTA PDC_ACS('9')
#define ACS_INFINITY PDC_ACS('-')
#define ACS_LO_PHI PDC_ACS( 22)
#define ACS_EPSILON PDC_ACS(':')
#define ACS_INTERSECT PDC_ACS('e')
#define ACS_TRIPLE_BAR PDC_ACS('f')
#define ACS_DIVISION PDC_ACS('c')
#define ACS_APPROX_EQ PDC_ACS('d')
#define ACS_SM_BULLET PDC_ACS('g')
#define ACS_SQUARE_ROOT PDC_ACS('i')
#define ACS_UBLOCK PDC_ACS('p')
#define ACS_BBLOCK PDC_ACS('q')
#define ACS_LBLOCK PDC_ACS('r')
#define ACS_RBLOCK PDC_ACS('s')
#define ACS_A_ORDINAL PDC_ACS(20)
#define ACS_O_ORDINAL PDC_ACS(21)
#define ACS_INV_QUERY PDC_ACS(24)
#define ACS_REV_NOT PDC_ACS(25)
#define ACS_NOT PDC_ACS(26)
#define ACS_INV_BANG PDC_ACS(23)
#define ACS_UP_INTEGRAL PDC_ACS(27)
#define ACS_LO_INTEGRAL PDC_ACS(28)
#define ACS_SUP_N PDC_ACS(29)
#define ACS_CENTER_SQU PDC_ACS(30)
#define ACS_F_WITH_HOOK PDC_ACS(31)
#define ACS_SD_LRCORNER PDC_ACS(';')
#define ACS_SD_URCORNER PDC_ACS('<')
#define ACS_SD_ULCORNER PDC_ACS('=')
#define ACS_SD_LLCORNER PDC_ACS('>')
#define ACS_SD_PLUS PDC_ACS('?')
#define ACS_SD_LTEE PDC_ACS('@')
#define ACS_SD_RTEE PDC_ACS('A')
#define ACS_SD_BTEE PDC_ACS('B')
#define ACS_SD_TTEE PDC_ACS('C')
#define ACS_D_LRCORNER PDC_ACS('D')
#define ACS_D_URCORNER PDC_ACS('E')
#define ACS_D_ULCORNER PDC_ACS('F')
#define ACS_D_LLCORNER PDC_ACS('G')
#define ACS_D_PLUS PDC_ACS('H')
#define ACS_D_LTEE PDC_ACS('I')
#define ACS_D_RTEE PDC_ACS('J')
#define ACS_D_BTEE PDC_ACS('K')
#define ACS_D_TTEE PDC_ACS('L')
#define ACS_DS_LRCORNER PDC_ACS('M')
#define ACS_DS_URCORNER PDC_ACS('N')
#define ACS_DS_ULCORNER PDC_ACS('O')
#define ACS_DS_LLCORNER PDC_ACS('P')
#define ACS_DS_PLUS PDC_ACS('Q')
#define ACS_DS_LTEE PDC_ACS('R')
#define ACS_DS_RTEE PDC_ACS('S')
#define ACS_DS_BTEE PDC_ACS('T')
#define ACS_DS_TTEE PDC_ACS('U')
/* VT100-compatible symbols -- other */
#define ACS_S1 PDC_ACS('l')
#define ACS_S9 PDC_ACS('o')
#define ACS_DIAMOND PDC_ACS('j')
#define ACS_CKBOARD PDC_ACS('k')
#define ACS_DEGREE PDC_ACS('w')
#define ACS_PLMINUS PDC_ACS('x')
#define ACS_BULLET PDC_ACS('h')
/* Teletype 5410v1 symbols -- these are defined in SysV curses, but
are not well-supported by most terminals. Stick to VT100 characters
for optimum portability. */
#define ACS_LARROW PDC_ACS('!')
#define ACS_RARROW PDC_ACS(' ')
#define ACS_DARROW PDC_ACS('#')
#define ACS_UARROW PDC_ACS('"')
#define ACS_BOARD PDC_ACS('+')
#define ACS_LTBOARD PDC_ACS('y')
#define ACS_LANTERN PDC_ACS('z')
#define ACS_BLOCK PDC_ACS('t')
/* That goes double for these -- undocumented SysV symbols. Don't use
them. */
#define ACS_S3 PDC_ACS('m')
#define ACS_S7 PDC_ACS('n')
#define ACS_LEQUAL PDC_ACS('u')
#define ACS_GEQUAL PDC_ACS('v')
#define ACS_PI PDC_ACS('$')
#define ACS_NEQUAL PDC_ACS('%')
#define ACS_STERLING PDC_ACS('~')
/* Box char aliases. The four characters tell you if a Single
line points up, right, down, and/or left from the center;
or if it's Blank; or if it's Thick or Double. The Thick
ones are an ncurses extension; the Double and Single/Double
ones are a PDCursesMod extension. */
#define ACS_BSSB ACS_ULCORNER
#define ACS_SSBB ACS_LLCORNER
#define ACS_BBSS ACS_URCORNER
#define ACS_SBBS ACS_LRCORNER
#define ACS_SBSS ACS_RTEE
#define ACS_SSSB ACS_LTEE
#define ACS_SSBS ACS_BTEE
#define ACS_BSSS ACS_TTEE
#define ACS_BSBS ACS_HLINE
#define ACS_SBSB ACS_VLINE
#define ACS_SSSS ACS_PLUS
/* cchar_t aliases */
#ifdef PDC_WIDE
# define WACS_LRCORNER (&(acs_map['V']))
# define WACS_URCORNER (&(acs_map['W']))
# define WACS_ULCORNER (&(acs_map['X']))
# define WACS_LLCORNER (&(acs_map['Y']))
# define WACS_PLUS (&(acs_map['Z']))
# define WACS_LTEE (&(acs_map['[']))
# define WACS_RTEE (&(acs_map['\\']))
# define WACS_BTEE (&(acs_map[']']))
# define WACS_TTEE (&(acs_map['^']))
# define WACS_HLINE (&(acs_map['_']))
# define WACS_VLINE (&(acs_map['`']))
# define WACS_CENT (&(acs_map['{']))
# define WACS_YEN (&(acs_map['|']))
# define WACS_PESETA (&(acs_map['}']))
# define WACS_HALF (&(acs_map['&']))
# define WACS_QUARTER (&(acs_map['\'']))
# define WACS_LEFT_ANG_QU (&(acs_map[')']))
# define WACS_RIGHT_ANG_QU (&(acs_map['*']))
# define WACS_D_HLINE (&(acs_map['a']))
# define WACS_D_VLINE (&(acs_map['b']))
# define WACS_CLUB (&(acs_map[ 11]))
# define WACS_HEART (&(acs_map[ 12]))
# define WACS_SPADE (&(acs_map[ 13]))
# define WACS_SMILE (&(acs_map[ 14]))
# define WACS_REV_SMILE (&(acs_map[ 15]))
# define WACS_MED_BULLET (&(acs_map[ 16]))
# define WACS_WHITE_BULLET (&(acs_map[ 17]))
# define WACS_PILCROW (&(acs_map[ 18]))
# define WACS_SECTION (&(acs_map[ 19]))
# define WACS_SUP2 (&(acs_map[',']))
# define WACS_ALPHA (&(acs_map['.']))
# define WACS_BETA (&(acs_map['/']))
# define WACS_GAMMA (&(acs_map['0']))
# define WACS_UP_SIGMA (&(acs_map['1']))
# define WACS_LO_SIGMA (&(acs_map['2']))
# define WACS_MU (&(acs_map['4']))
# define WACS_TAU (&(acs_map['5']))
# define WACS_UP_PHI (&(acs_map['6']))
# define WACS_THETA (&(acs_map['7']))
# define WACS_OMEGA (&(acs_map['8']))
# define WACS_DELTA (&(acs_map['9']))
# define WACS_INFINITY (&(acs_map['-']))
# define WACS_LO_PHI (&(acs_map[ 22]))
# define WACS_EPSILON (&(acs_map[':']))
# define WACS_INTERSECT (&(acs_map['e']))
# define WACS_TRIPLE_BAR (&(acs_map['f']))
# define WACS_DIVISION (&(acs_map['c']))
# define WACS_APPROX_EQ (&(acs_map['d']))
# define WACS_SM_BULLET (&(acs_map['g']))
# define WACS_SQUARE_ROOT (&(acs_map['i']))
# define WACS_UBLOCK (&(acs_map['p']))
# define WACS_BBLOCK (&(acs_map['q']))
# define WACS_LBLOCK (&(acs_map['r']))
# define WACS_RBLOCK (&(acs_map['s']))
# define WACS_A_ORDINAL (&(acs_map[20]))
# define WACS_O_ORDINAL (&(acs_map[21]))
# define WACS_INV_QUERY (&(acs_map[24]))
# define WACS_REV_NOT (&(acs_map[25]))
# define WACS_NOT (&(acs_map[26]))
# define WACS_INV_BANG (&(acs_map[23]))
# define WACS_UP_INTEGRAL (&(acs_map[27]))
# define WACS_LO_INTEGRAL (&(acs_map[28]))
# define WACS_SUP_N (&(acs_map[29]))
# define WACS_CENTER_SQU (&(acs_map[30]))
# define WACS_F_WITH_HOOK (&(acs_map[31]))
# define WACS_SD_LRCORNER (&(acs_map[';']))
# define WACS_SD_URCORNER (&(acs_map['<']))
# define WACS_SD_ULCORNER (&(acs_map['=']))
# define WACS_SD_LLCORNER (&(acs_map['>']))
# define WACS_SD_PLUS (&(acs_map['?']))
# define WACS_SD_LTEE (&(acs_map['@']))
# define WACS_SD_RTEE (&(acs_map['A']))
# define WACS_SD_BTEE (&(acs_map['B']))
# define WACS_SD_TTEE (&(acs_map['C']))
# define WACS_D_LRCORNER (&(acs_map['D']))
# define WACS_D_URCORNER (&(acs_map['E']))
# define WACS_D_ULCORNER (&(acs_map['F']))
# define WACS_D_LLCORNER (&(acs_map['G']))
# define WACS_D_PLUS (&(acs_map['H']))
# define WACS_D_LTEE (&(acs_map['I']))
# define WACS_D_RTEE (&(acs_map['J']))
# define WACS_D_BTEE (&(acs_map['K']))
# define WACS_D_TTEE (&(acs_map['L']))
# define WACS_T_LRCORNER (&(acs_map[0]))
# define WACS_T_URCORNER (&(acs_map[1]))
# define WACS_T_ULCORNER (&(acs_map[2]))
# define WACS_T_LLCORNER (&(acs_map[3]))
# define WACS_T_PLUS (&(acs_map[4]))
# define WACS_T_LTEE (&(acs_map[5]))
# define WACS_T_RTEE (&(acs_map[6]))
# define WACS_T_BTEE (&(acs_map[7]))
# define WACS_T_TTEE (&(acs_map[8]))
# define WACS_T_HLINE (&(acs_map[9]))
# define WACS_T_VLINE (&(acs_map[10]))
# define WACS_DS_LRCORNER (&(acs_map['M']))
# define WACS_DS_URCORNER (&(acs_map['N']))
# define WACS_DS_ULCORNER (&(acs_map['O']))
# define WACS_DS_LLCORNER (&(acs_map['P']))
# define WACS_DS_PLUS (&(acs_map['Q']))
# define WACS_DS_LTEE (&(acs_map['R']))
# define WACS_DS_RTEE (&(acs_map['S']))
# define WACS_DS_BTEE (&(acs_map['T']))
# define WACS_DS_TTEE (&(acs_map['U']))
# define WACS_S1 (&(acs_map['l']))
# define WACS_S9 (&(acs_map['o']))
# define WACS_DIAMOND (&(acs_map['j']))
# define WACS_CKBOARD (&(acs_map['k']))
# define WACS_DEGREE (&(acs_map['w']))
# define WACS_PLMINUS (&(acs_map['x']))
# define WACS_BULLET (&(acs_map['h']))
# define WACS_LARROW (&(acs_map['!']))
# define WACS_RARROW (&(acs_map[' ']))
# define WACS_DARROW (&(acs_map['#']))
# define WACS_UARROW (&(acs_map['"']))
# define WACS_BOARD (&(acs_map['+']))
# define WACS_LTBOARD (&(acs_map['y']))
# define WACS_LANTERN (&(acs_map['z']))
# define WACS_BLOCK (&(acs_map['t']))
# define WACS_S3 (&(acs_map['m']))
# define WACS_S7 (&(acs_map['n']))
# define WACS_LEQUAL (&(acs_map['u']))
# define WACS_GEQUAL (&(acs_map['v']))
# define WACS_PI (&(acs_map['$']))
# define WACS_NEQUAL (&(acs_map['%']))
# define WACS_STERLING (&(acs_map['~']))
# define WACS_BSSB WACS_ULCORNER
# define WACS_SSBB WACS_LLCORNER
# define WACS_BBSS WACS_URCORNER
# define WACS_SBBS WACS_LRCORNER
# define WACS_SBSS WACS_RTEE
# define WACS_SSSB WACS_LTEE
# define WACS_SSBS WACS_BTEE
# define WACS_BSSS WACS_TTEE
# define WACS_BSBS WACS_HLINE
# define WACS_SBSB WACS_VLINE
# define WACS_SSSS WACS_PLUS
# define WACS_BTTB WACS_T_ULCORNER
# define WACS_TTBB WACS_T_LLCORNER
# define WACS_BBTT WACS_T_URCORNER
# define WACS_TBBT WACS_T_LRCORNER
# define WACS_TBTT WACS_T_RTEE
# define WACS_TTTB WACS_T_LTEE
# define WACS_TTBT WACS_T_BTEE
# define WACS_BTTS WACS_T_TTEE
# define WACS_BTBT WACS_T_HLINE
# define WACS_TBTB WACS_T_VLINE
# define WACS_TTTT WACS_T_PLUS
#endif
/*** Color macros ***/
#define COLOR_BLACK 0
#ifdef PDC_RGB /* RGB */
# define COLOR_RED 1
# define COLOR_GREEN 2
# define COLOR_BLUE 4
#else /* BGR */
# define COLOR_BLUE 1
# define COLOR_GREEN 2
# define COLOR_RED 4
#endif
#define COLOR_CYAN (COLOR_BLUE | COLOR_GREEN)
#define COLOR_MAGENTA (COLOR_RED | COLOR_BLUE)
#define COLOR_YELLOW (COLOR_RED | COLOR_GREEN)
#define COLOR_WHITE 7
/*----------------------------------------------------------------------
*
* Function and Keypad Key Definitions
* Many are just for compatibility
*
*/
#ifdef PDC_WIDE
#define KEY_OFFSET 0xec00
#else
#define KEY_OFFSET 0x100
#endif
#define KEY_CODE_YES (KEY_OFFSET + 0x00) /* If get_wch() gives a key code */
#define KEY_BREAK (KEY_OFFSET + 0x01) /* Not on PC KBD */
#define KEY_DOWN (KEY_OFFSET + 0x02) /* Down arrow key */
#define KEY_UP (KEY_OFFSET + 0x03) /* Up arrow key */
#define KEY_LEFT (KEY_OFFSET + 0x04) /* Left arrow key */
#define KEY_RIGHT (KEY_OFFSET + 0x05) /* Right arrow key */
#define KEY_HOME (KEY_OFFSET + 0x06) /* home key */
#define KEY_BACKSPACE (KEY_OFFSET + 0x07) /* not on pc */
#define KEY_F0 (KEY_OFFSET + 0x08) /* function keys; 64 reserved */
#define KEY_DL (KEY_OFFSET + 0x48) /* delete line */
#define KEY_IL (KEY_OFFSET + 0x49) /* insert line */
#define KEY_DC (KEY_OFFSET + 0x4a) /* delete character */
#define KEY_IC (KEY_OFFSET + 0x4b) /* insert char or enter ins mode */
#define KEY_EIC (KEY_OFFSET + 0x4c) /* exit insert char mode */
#define KEY_CLEAR (KEY_OFFSET + 0x4d) /* clear screen */
#define KEY_EOS (KEY_OFFSET + 0x4e) /* clear to end of screen */
#define KEY_EOL (KEY_OFFSET + 0x4f) /* clear to end of line */
#define KEY_SF (KEY_OFFSET + 0x50) /* scroll 1 line forward */
#define KEY_SR (KEY_OFFSET + 0x51) /* scroll 1 line back (reverse) */
#define KEY_NPAGE (KEY_OFFSET + 0x52) /* next page */
#define KEY_PPAGE (KEY_OFFSET + 0x53) /* previous page */
#define KEY_STAB (KEY_OFFSET + 0x54) /* set tab */
#define KEY_CTAB (KEY_OFFSET + 0x55) /* clear tab */
#define KEY_CATAB (KEY_OFFSET + 0x56) /* clear all tabs */
#define KEY_ENTER (KEY_OFFSET + 0x57) /* enter or send (unreliable) */
#define KEY_SRESET (KEY_OFFSET + 0x58) /* soft/reset (partial/unreliable) */
#define KEY_RESET (KEY_OFFSET + 0x59) /* reset/hard reset (unreliable) */
#define KEY_PRINT (KEY_OFFSET + 0x5a) /* print/copy */
#define KEY_LL (KEY_OFFSET + 0x5b) /* home down/bottom (lower left) */
#define KEY_ABORT (KEY_OFFSET + 0x5c) /* abort/terminate key (any) */
#define KEY_SHELP (KEY_OFFSET + 0x5d) /* short help */
#define KEY_LHELP (KEY_OFFSET + 0x5e) /* long help */
#define KEY_BTAB (KEY_OFFSET + 0x5f) /* Back tab key */