iPXE
keys.h
Go to the documentation of this file.
1 #ifndef _IPXE_KEYS_H
2 #define _IPXE_KEYS_H
3 
4 /** @file
5  *
6  * Key definitions
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 /*
13  * Symbolic names for some standard ASCII characters
14  *
15  */
16 
17 #define NUL 0x00
18 #define CTRL_A 0x01
19 #define CTRL_B 0x02
20 #define CTRL_C 0x03
21 #define CTRL_D 0x04
22 #define CTRL_E 0x05
23 #define CTRL_F 0x06
24 #define CTRL_G 0x07
25 #define CTRL_H 0x08
26 #define CTRL_I 0x09
27 #define CTRL_J 0x0a
28 #define CTRL_K 0x0b
29 #define CTRL_L 0x0c
30 #define CTRL_M 0x0d
31 #define CTRL_N 0x0e
32 #define CTRL_O 0x0f
33 #define CTRL_P 0x10
34 #define CTRL_Q 0x11
35 #define CTRL_R 0x12
36 #define CTRL_S 0x13
37 #define CTRL_T 0x14
38 #define CTRL_U 0x15
39 #define CTRL_V 0x16
40 #define CTRL_W 0x17
41 #define CTRL_X 0x18
42 #define CTRL_Y 0x19
43 #define CTRL_Z 0x1a
44 
45 #define BACKSPACE CTRL_H
46 #define TAB CTRL_I
47 #define LF CTRL_J
48 #define CR CTRL_M
49 #define ESC 0x1b
50 
51 /*
52  * Special keys outside the normal ASCII range
53  *
54  *
55  * The names are chosen to match those used by curses. The values are
56  * chosen to facilitate easy conversion from a received ANSI escape
57  * sequence to a KEY_XXX constant.
58  */
59 
60 #define KEY_ANSI( n, terminator ) ( 0x100 * ( (n) + 1 ) + (terminator) )
61 #define KEY_ANSI_N( key ) ( ( (key) / 0x100 ) - 1 )
62 #define KEY_ANSI_TERMINATOR( key ) ( (key) & 0xff )
63 
64 #define KEY_MIN 0x101
65 #define KEY_UP KEY_ANSI ( 0, 'A' ) /**< Up arrow */
66 #define KEY_DOWN KEY_ANSI ( 0, 'B' ) /**< Down arrow */
67 #define KEY_RIGHT KEY_ANSI ( 0, 'C' ) /**< Right arrow */
68 #define KEY_LEFT KEY_ANSI ( 0, 'D' ) /**< Left arrow */
69 #define KEY_END KEY_ANSI ( 0, 'F' ) /**< End */
70 #define KEY_HOME KEY_ANSI ( 0, 'H' ) /**< Home */
71 #define KEY_IC KEY_ANSI ( 2, '~' ) /**< Insert */
72 #define KEY_DC KEY_ANSI ( 3, '~' ) /**< Delete */
73 #define KEY_PPAGE KEY_ANSI ( 5, '~' ) /**< Page up */
74 #define KEY_NPAGE KEY_ANSI ( 6, '~' ) /**< Page down */
75 #define KEY_F5 KEY_ANSI ( 15, '~' ) /**< F5 */
76 #define KEY_F6 KEY_ANSI ( 17, '~' ) /**< F6 */
77 #define KEY_F7 KEY_ANSI ( 18, '~' ) /**< F7 */
78 #define KEY_F8 KEY_ANSI ( 19, '~' ) /**< F8 (for PXE) */
79 #define KEY_F9 KEY_ANSI ( 20, '~' ) /**< F9 */
80 #define KEY_F10 KEY_ANSI ( 21, '~' ) /**< F10 */
81 #define KEY_F11 KEY_ANSI ( 23, '~' ) /**< F11 */
82 #define KEY_F12 KEY_ANSI ( 24, '~' ) /**< F12 */
83 
84 /* Not in the [KEY_MIN,KEY_MAX] range; terminals seem to send these as
85  * normal ASCII values.
86  */
87 #define KEY_BACKSPACE BACKSPACE
88 #define KEY_ENTER LF
89 
90 #endif /* _IPXE_KEYS_H */
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)