iPXE
keys.h
Go to the documentation of this file.
00001 #ifndef _IPXE_KEYS_H
00002 #define _IPXE_KEYS_H
00003 
00004 /** @file
00005  *
00006  * Key definitions
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 /*
00013  * Symbolic names for some standard ASCII characters
00014  *
00015  */
00016 
00017 #define NUL             0x00
00018 #define CTRL_A          0x01
00019 #define CTRL_B          0x02
00020 #define CTRL_C          0x03
00021 #define CTRL_D          0x04
00022 #define CTRL_E          0x05
00023 #define CTRL_F          0x06
00024 #define CTRL_G          0x07
00025 #define CTRL_H          0x08
00026 #define CTRL_I          0x09
00027 #define CTRL_J          0x0a
00028 #define CTRL_K          0x0b
00029 #define CTRL_L          0x0c
00030 #define CTRL_M          0x0d
00031 #define CTRL_N          0x0e
00032 #define CTRL_O          0x0f
00033 #define CTRL_P          0x10
00034 #define CTRL_Q          0x11
00035 #define CTRL_R          0x12
00036 #define CTRL_S          0x13
00037 #define CTRL_T          0x14
00038 #define CTRL_U          0x15
00039 #define CTRL_V          0x16
00040 #define CTRL_W          0x17
00041 #define CTRL_X          0x18
00042 #define CTRL_Y          0x19
00043 #define CTRL_Z          0x1a
00044 
00045 #define BACKSPACE       CTRL_H
00046 #define TAB             CTRL_I
00047 #define LF              CTRL_J
00048 #define CR              CTRL_M
00049 #define ESC             0x1b
00050 
00051 /*
00052  * Special keys outside the normal ASCII range 
00053  *
00054  *
00055  * The names are chosen to match those used by curses.  The values are
00056  * chosen to facilitate easy conversion from a received ANSI escape
00057  * sequence to a KEY_XXX constant.
00058  */
00059 
00060 #define KEY_ANSI( n, terminator ) ( 0x100 * ( (n) + 1 ) + (terminator) )
00061 #define KEY_ANSI_N( key ) ( ( (key) / 0x100 ) - 1 )
00062 #define KEY_ANSI_TERMINATOR( key ) ( (key) & 0xff )
00063 
00064 #define KEY_MIN         0x101
00065 #define KEY_UP          KEY_ANSI ( 0, 'A' )     /**< Up arrow */
00066 #define KEY_DOWN        KEY_ANSI ( 0, 'B' )     /**< Down arrow */
00067 #define KEY_RIGHT       KEY_ANSI ( 0, 'C' )     /**< Right arrow */
00068 #define KEY_LEFT        KEY_ANSI ( 0, 'D' )     /**< Left arrow */
00069 #define KEY_END         KEY_ANSI ( 0, 'F' )     /**< End */
00070 #define KEY_HOME        KEY_ANSI ( 0, 'H' )     /**< Home */
00071 #define KEY_IC          KEY_ANSI ( 2, '~' )     /**< Insert */
00072 #define KEY_DC          KEY_ANSI ( 3, '~' )     /**< Delete */
00073 #define KEY_PPAGE       KEY_ANSI ( 5, '~' )     /**< Page up */
00074 #define KEY_NPAGE       KEY_ANSI ( 6, '~' )     /**< Page down */
00075 #define KEY_F5          KEY_ANSI ( 15, '~' )    /**< F5 */
00076 #define KEY_F6          KEY_ANSI ( 17, '~' )    /**< F6 */
00077 #define KEY_F7          KEY_ANSI ( 18, '~' )    /**< F7 */
00078 #define KEY_F8          KEY_ANSI ( 19, '~' )    /**< F8 (for PXE) */
00079 #define KEY_F9          KEY_ANSI ( 20, '~' )    /**< F9 */
00080 #define KEY_F10         KEY_ANSI ( 21, '~' )    /**< F10 */
00081 #define KEY_F11         KEY_ANSI ( 23, '~' )    /**< F11 */
00082 #define KEY_F12         KEY_ANSI ( 24, '~' )    /**< F12 */
00083 
00084 /* Not in the [KEY_MIN,KEY_MAX] range; terminals seem to send these as
00085  * normal ASCII values.
00086  */
00087 #define KEY_BACKSPACE   BACKSPACE
00088 #define KEY_ENTER       LF
00089 
00090 #endif /* _IPXE_KEYS_H */