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
|
/* HCONSOLE.H (c) Copyright "Fish" (David B. Trout), 2009 */
/* Hercules console panel support functions header file */
//////////////////////////////////////////////////////////////////////////////////////////
// (c) Copyright "Fish" (David B. Trout), 2009. Released under the Q Public License
// (http://www.hercules-390.org/herclic.html) as modifications to Hercules.
//////////////////////////////////////////////////////////////////////////////////////////
#ifndef _HCONSOLE_H
#define _HCONSOLE_H
//-----------------------------------------------------------------------------
//
// VT100 User Guide
//
// Table 3-6 Cursor Control Key Codes
//
// Cursor Key VT52 ANSI and Cursor Key Mode ANSI and Cursor Key Mode
// (Arrow) Mode Reset (Normal mode) Set (Application mode)
//
// Up ESC A ESC [ A ESC O A
// Down ESC B ESC [ B ESC O B
// Right ESC C ESC [ C ESC O C
// Left ESC D ESC [ D ESC O D
//
//-----------------------------------------------------------------------------
#define ANSI_RESET_ALL_ATTRIBUTES "\x1B[0m"
#define KBD_HOME "\x1B[1~"
#define KBD_INSERT "\x1B[2~"
#define KBD_DELETE "\x1B[3~"
#define KBD_END "\x1B[4~"
#define KBD_PAGE_UP "\x1B[5~"
#define KBD_PAGE_DOWN "\x1B[6~"
#define KBD_UP_ARROW "\x1B[A"
#define KBD_DOWN_ARROW "\x1B[B"
#define KBD_RIGHT_ARROW "\x1B[C"
#define KBD_LEFT_ARROW "\x1B[D"
#define KBD_UP_ARROW2 "\x1BOA"
#define KBD_DOWN_ARROW2 "\x1BOB"
#define KBD_RIGHT_ARROW2 "\x1BOC"
#define KBD_LEFT_ARROW2 "\x1BOD"
// Does anyone know what the actual escape sequence that
// gets generated actually is on Linux for "Alt+UpArrow"
// and "Alt+DownArrow", etc?? Thanks! -- Fish
#define KBD_ALT_UP_ARROW KBD_UP_ARROW2
#define KBD_ALT_DOWN_ARROW KBD_DOWN_ARROW2
#define KBD_ALT_RIGHT_ARROW KBD_RIGHT_ARROW2
#define KBD_ALT_LEFT_ARROW KBD_LEFT_ARROW2
#define KBD_CTRL_HOME "\x1B""w" // (is this right??)
#define KBD_CTRL_END "\x1B""u" // (is this right??)
#define KBD_CTRL_UP_ARROW "\x1B""D" // (is this right??)
#define KBD_CTRL_DOWN_ARROW "\x1B""M" // (is this right??)
//efine KBD_CTRL_RIGHT_ARROW "???????" // (luckily we don't need it right now)
//efine KBD_CTRL_LEFT_ARROW "???????" // (luckily we don't need it right now)
#define KBD_ASK_CURSOR_POS "\x1B[6n" // Return value is the string "\x1B[n;mR"
// returned in the keyboard buffer where
// n = decimal row, m = decimal column.
// Hercules console color codes...
#define COLOR_BLACK 0
#define COLOR_RED 1
#define COLOR_GREEN 2
#define COLOR_BLUE 3
#define COLOR_CYAN 4
#define COLOR_MAGENTA 5
#define COLOR_YELLOW 6
#define COLOR_DARK_GREY 7
#define COLOR_LIGHT_GREY 8
#define COLOR_LIGHT_RED 9
#define COLOR_LIGHT_GREEN 10
#define COLOR_LIGHT_BLUE 11
#define COLOR_LIGHT_CYAN 12
#define COLOR_LIGHT_MAGENTA 13
#define COLOR_LIGHT_YELLOW 14
#define COLOR_WHITE 15
#define COLOR_DEFAULT_FG 16
#define COLOR_DEFAULT_BG 17
#define COLOR_DEFAULT_LIGHT 18
extern int set_screen_color ( FILE* confp, short herc_fore, short herc_back );
// screen positions are 1-based; row 1 == top line; col 1 == leftmost column
extern int set_screen_pos ( FILE* confp, short rowY1, short colX1 );
extern int clear_screen ( FILE* confp );
extern int erase_to_eol ( FILE* confp );
// 'save_and_set' = 1 --> just what it says; 0 --> restore from saved value.
extern int set_or_reset_console_mode ( int keybrd_fd, short save_and_set );
extern void translate_keystroke( char kbbuf[], int* pkblen );
extern int console_beep( FILE* confp );
extern int get_console_dim( FILE* confp, int* rows, int* cols );
#ifdef OPTION_EXTCURS
extern int get_cursor_pos( int keybrd_fd, FILE* confp, short* row, short* col );
#endif // OPTION_EXTCURS
extern int set_console_cursor_shape( FILE* confp, int ins );
#if defined( _MSVC_ )
extern int w32_set_console_title( char* pszTitle );
#endif
#endif // _HCONSOLE_H
|