|
@@ -41,6 +41,44 @@ static vt100_decode_t esc_map[] = {
|
|
|
};
|
|
|
|
|
|
|
|
|
+// Hotkeys
|
|
|
+const char *hotkey_map[] = {
|
|
|
+ "^@", /* 0 Null character */
|
|
|
+ "^A", /* 1 Start of heading, = console interrupt */
|
|
|
+ "^B", /* 2 Start of text, maintenance mode on HP console */
|
|
|
+ "^C", /* 3 End of text */
|
|
|
+ "^D", /* 4 End of transmission, not the same as ETB */
|
|
|
+ "^E", /* 5 Enquiry, goes with ACK; old HP flow control */
|
|
|
+ "^F", /* 6 Acknowledge, clears ENQ logon hand */
|
|
|
+ "^G", /* 7 Bell, rings the bell... */
|
|
|
+ "^H", /* 8 Backspace, works on HP terminals/computers */
|
|
|
+ "^I", /* 9 Horizontal tab, move to next tab stop */
|
|
|
+ "^J", /* 10 Line Feed */
|
|
|
+ "^K", /* 11 Vertical tab */
|
|
|
+ "^L", /* 12 Form Feed, page eject */
|
|
|
+ "^M", /* 13 Carriage Return*/
|
|
|
+ "^N", /* 14 Shift Out, alternate character set */
|
|
|
+ "^O", /* 15 Shift In, resume defaultn character set */
|
|
|
+ "^P", /* 16 Data link escape */
|
|
|
+ "^Q", /* 17 XON, with XOFF to pause listings; "okay to send". */
|
|
|
+ "^R", /* 18 Device control 2, block-mode flow control */
|
|
|
+ "^S", /* 19 XOFF, with XON is TERM=18 flow control */
|
|
|
+ "^T", /* 20 Device control 4 */
|
|
|
+ "^U", /* 21 Negative acknowledge */
|
|
|
+ "^V", /* 22 Synchronous idle */
|
|
|
+ "^W", /* 23 End transmission block, not the same as EOT */
|
|
|
+ "^X", /* 24 Cancel line, MPE echoes !!! */
|
|
|
+ "^Y", /* 25 End of medium, Control-Y interrupt */
|
|
|
+ "^Z", /* 26 Substitute */
|
|
|
+ "^[", /* 27 Escape, next character is not echoed */
|
|
|
+ "^\\", /* 28 File separator */
|
|
|
+ "^]", /* 29 Group separator */
|
|
|
+ "^^", /* 30 Record separator, block-mode terminator */
|
|
|
+ "^_", /* 31 Unit separator */
|
|
|
+ NULL
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
vt100_t *vt100_new(FILE *istream, FILE *ostream)
|
|
|
{
|
|
|
vt100_t *vt100 = NULL;
|
|
@@ -99,7 +137,7 @@ void vt100_set_ostream(vt100_t *vt100, FILE *ostream)
|
|
|
}
|
|
|
|
|
|
|
|
|
-vt100_esc_e vt100_esc_decode(const vt100_t *vt100, const char *esc_seq)
|
|
|
+vt100_esc_e vt100_esc_decode(const char *esc_seq)
|
|
|
{
|
|
|
vt100_esc_e result = VT100_UNKNOWN;
|
|
|
unsigned int i = 0;
|
|
@@ -111,12 +149,27 @@ vt100_esc_e vt100_esc_decode(const vt100_t *vt100, const char *esc_seq)
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- vt100 = vt100; // Happy compiler
|
|
|
-
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
+ssize_t vt100_hotkey_decode(const char *hotkey)
|
|
|
+{
|
|
|
+ unsigned int i = 0;
|
|
|
+
|
|
|
+ if (!hotkey)
|
|
|
+ return -1;
|
|
|
+
|
|
|
+ while (hotkey_map[i]) {
|
|
|
+ if (strcmp(hotkey_map[i], hotkey) == 0)
|
|
|
+ return i;
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ return -1;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
int vt100_printf(const vt100_t *vt100, const char *fmt, ...)
|
|
|
{
|
|
|
va_list args;
|