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