FabGL
ESP32 Display Controller and Graphics Library
terminfo.h
Go to the documentation of this file.
1/*
2 Created by Fabrizio Di Vittorio (fdivitto2013@gmail.com) - <http://www.fabgl.com>
3 Copyright (c) 2019-2022 Fabrizio Di Vittorio.
4 All rights reserved.
5
6
7* Please contact fdivitto2013@gmail.com if you need a commercial license.
8
9
10* This library and related software is available under GPL v3.
11
12 FabGL is free software: you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation, either version 3 of the License, or
15 (at your option) any later version.
16
17 FabGL is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with FabGL. If not, see <http://www.gnu.org/licenses/>.
24 */
25
26
27#pragma once
28
29
37#include "devdrivers/keyboard.h"
38
39
40namespace fabgl {
41
42
43
44
45constexpr int EmuTerminalMaxChars = 8;
46
47
51enum class ConvCtrl {
52 END,
53 CarriageReturn,
54 LineFeed,
55 CursorLeft,
56 CursorUp,
57 CursorRight,
58 EraseToEndOfScreen,
59 EraseToEndOfLine,
60 CursorHome,
61 AttrNormal,
62 AttrBlank,
63 AttrBlink,
64 AttrBlinkOff,
65 AttrReverse,
66 AttrReverseOff,
67 AttrUnderline,
68 AttrUnderlineOff,
69 AttrReduce,
70 AttrReduceOff,
71 CursorPos,
72 CursorPos2,
73 InsertLine,
74 InsertChar,
75 DeleteLine,
76 DeleteCharacter,
77 CursorOn,
78 CursorOff,
79 SaveCursor,
80 RestoreCursor,
81};
82
83
84// converts from emulated terminal video control code to ANSI/VT control codes
85struct TermInfoVideoConv {
86 const char * termSeq; // input terminal control code to match. 0xFF matches any char
87 int termSeqLen; // length of termSeq string
88 ConvCtrl convCtrl[5]; // output video action (will be converted to ANSI control code). Last ctrl must be ConvCtrl::End
89};
90
91
92// converts from emulated terminal keyboard virtual key to ANSI/VT control codes
93struct TermInfoKbdConv {
94 VirtualKey vk; // input virtual key
95 const char * ANSICtrlCode; // output ANSI control code
96};
97
98
99struct TermInfo {
100 char const * initString;
101 TermInfoVideoConv const * videoCtrlSet;
102 TermInfoKbdConv const * kbdCtrlSet;
103};
104
105
106
120
121
122struct SupportedTerminals {
123 static int count() { return (int)ANSILegacy - (int)ANSI_VT + 1; }
124 static char const * * names() {
125 static char const * TERMS[] = { "ANSI", "ADM 3A", "ADM 31", "Hazeltine 1500", "Osborne", "Kaypro", "VT52", "ANSI Legacy" };
126 return TERMS;
127 }
128 static TermType * types() {
130 return TYPES;
131 }
132};
133
134
135
136// Lear Siegler ADM-3A
137extern const TermInfo term_ADM3A;
138
139// Lear Siegler ADM-31
140extern const TermInfo term_ADM31;
141
142// Hazeltine 1500
143extern const TermInfo term_Hazeltine1500;
144
145// Osborne I
146extern const TermInfo term_Osborne;
147
148// Kaypro
149extern const TermInfo term_Kaypro;
150
151// VT52
152extern const TermInfo term_VT52;
153
154// ANSI Legacy
155extern const TermInfo term_ANSILegacy;
156
157
158
159
160}
TermType
This enum defines supported terminals.
Definition: terminfo.h:110
@ Osborne
Definition: terminfo.h:115
@ ADM3A
Definition: terminfo.h:112
@ VT52
Definition: terminfo.h:117
@ Hazeltine1500
Definition: terminfo.h:114
@ Kaypro
Definition: terminfo.h:116
@ ANSILegacy
Definition: terminfo.h:118
@ ANSI_VT
Definition: terminfo.h:111
@ ADM31
Definition: terminfo.h:113
VirtualKey
Represents each possible real or derived (SHIFT + real) key.
Definition: fabutils.h:1097
This file contains fabgl::Keyboard definition.