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-2021 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. Feel free to use FabGL in free software and hardware:
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 
40 namespace fabgl {
41 
42 
43 
44 
45 constexpr int EmuTerminalMaxChars = 8;
46 
47 
51 enum 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
85 struct 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
93 struct TermInfoKbdConv {
94  VirtualKey vk; // input virtual key
95  const char * ANSICtrlCode; // output ANSI control code
96 };
97 
98 
99 struct TermInfo {
100  char const * initString;
101  TermInfoVideoConv const * videoCtrlSet;
102  TermInfoKbdConv const * kbdCtrlSet;
103 };
104 
105 
106 
110 enum TermType {
119 };
120 
121 
122 struct 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() {
129  static TermType TYPES[] = { ANSI_VT, ADM3A, ADM31, Hazeltine1500, Osborne, Kaypro, VT52, ANSILegacy };
130  return TYPES;
131  }
132 };
133 
134 
135 
136 // Lear Siegler ADM-3A
137 extern const TermInfo term_ADM3A;
138 
139 // Lear Siegler ADM-31
140 extern const TermInfo term_ADM31;
141 
142 // Hazeltine 1500
143 extern const TermInfo term_Hazeltine1500;
144 
145 // Osborne I
146 extern const TermInfo term_Osborne;
147 
148 // Kaypro
149 extern const TermInfo term_Kaypro;
150 
151 // VT52
152 extern const TermInfo term_VT52;
153 
154 // ANSI Legacy
155 extern const TermInfo term_ANSILegacy;
156 
157 
158 
159 
160 }
This file contains fabgl::Keyboard definition.
VirtualKey
Represents each possible real or derived (SHIFT + real) key.
Definition: fabutils.h:1016
Definition: canvas.cpp:36
TermType
This enum defines supported terminals.
Definition: terminfo.h:110