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
|
/*
* TSM - VT Emulator
*
* Copyright (c) 2011 David Herrmann <dh.herrmann@googlemail.com>
* Copyright (c) 2011 University of Tuebingen
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Virtual Terminal Emulator
* This is a vt100 implementation. It is written from scratch. It uses the
* screen state-machine as output and is tightly bound to it.
*/
#ifndef TSM_VTE_H
#define TSM_VTE_H
#include <stdlib.h>
#include "tsm_screen.h"
#include "tsm_unicode.h"
/* available character sets */
typedef tsm_symbol_t tsm_vte_charset[96];
extern tsm_vte_charset tsm_vte_unicode_lower;
extern tsm_vte_charset tsm_vte_unicode_upper;
extern tsm_vte_charset tsm_vte_dec_supplemental_graphics;
extern tsm_vte_charset tsm_vte_dec_special_graphics;
/* virtual terminal emulator */
struct tsm_vte;
/* keep in sync with shl_xkb_mods */
enum tsm_vte_modifier {
TSM_SHIFT_MASK = (1 << 0),
TSM_LOCK_MASK = (1 << 1),
TSM_CONTROL_MASK = (1 << 2),
TSM_ALT_MASK = (1 << 3),
TSM_LOGO_MASK = (1 << 4),
};
/* keep in sync with TSM_INPUT_INVALID */
#define TSM_VTE_INVALID 0xffffffff
typedef void (*tsm_vte_write_cb) (struct tsm_vte *vte,
const char *u8,
size_t len,
void *data);
int tsm_vte_new(struct tsm_vte **out, struct tsm_screen *con,
tsm_vte_write_cb write_cb, void *data,
tsm_log_t log, void *log_data);
void tsm_vte_ref(struct tsm_vte *vte);
void tsm_vte_unref(struct tsm_vte *vte);
int tsm_vte_set_palette(struct tsm_vte *vte, const char *palette);
void tsm_vte_reset(struct tsm_vte *vte);
void tsm_vte_hard_reset(struct tsm_vte *vte);
void tsm_vte_input(struct tsm_vte *vte, const char *u8, size_t len);
bool tsm_vte_handle_keyboard(struct tsm_vte *vte, uint32_t keysym,
uint32_t ascii, unsigned int mods,
uint32_t unicode);
#endif /* TSM_VTE_H */
|