Debian Codegraph @

lib/Vt102Emulation.h

raw symbols SCIP
1 /*
2 This file is part of Konsole, an X terminal.
3
4 Copyright 2007-2008 by Robert Knight <[email protected]>
5 Copyright 1997,1998 by Lars Doelle <[email protected]>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 02110-1301 USA.
21 */
22
23 #ifndef VT102EMULATION_H
24 #define VT102EMULATION_Hcxx . . $ `lib/Vt102Emulation.h:24:9`!
25
26 // Standard Library
27 #include <cstdio>
28
29 // Qt
30 #include <QKeyEvent>
31 #include <QHash>
32 #include <QTimer>
33
34 // Konsole
35 #include "Emulation.h"cxx . . $ `<file>/lib/Emulation.h`/
36 #include "Screen.h"cxx . . $ `<file>/lib/Screen.h`/
37
38 #define MODE_AppScreencxx . . $ `lib/Vt102Emulation.h:38:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+0) // Mode #1
39 #define MODE_AppCuKeyscxx . . $ `lib/Vt102Emulation.h:39:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+1) // Application cursor keys (DECCKM)
40 #define MODE_AppKeyPadcxx . . $ `lib/Vt102Emulation.h:40:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+2) //
41 #define MODE_Mouse1000cxx . . $ `lib/Vt102Emulation.h:41:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+3) // Send mouse X,Y position on press and release
42 #define MODE_Mouse1001cxx . . $ `lib/Vt102Emulation.h:42:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+4) // Use Hilight mouse tracking
43 #define MODE_Mouse1002cxx . . $ `lib/Vt102Emulation.h:43:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+5) // Use cell motion mouse tracking
44 #define MODE_Mouse1003cxx . . $ `lib/Vt102Emulation.h:44:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+6) // Use all motion mouse tracking
45 #define MODE_Mouse1005cxx . . $ `lib/Vt102Emulation.h:45:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+7) // Xterm-style extended coordinates
46 #define MODE_Mouse1006cxx . . $ `lib/Vt102Emulation.h:46:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+8) // 2nd Xterm-style extended coordinates
47 #define MODE_Mouse1015cxx . . $ `lib/Vt102Emulation.h:47:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+9) // Urxvt-style extended coordinates
48 #define MODE_Ansicxx . . $ `lib/Vt102Emulation.h:48:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+10) // Use US Ascii for character sets G0-G3 (DECANM)
49 #define MODE_132Columnscxx . . $ `lib/Vt102Emulation.h:49:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+11) // 80 <-> 132 column mode switch (DECCOLM)
50 #define MODE_Allow132Columnscxx . . $ `lib/Vt102Emulation.h:50:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+12) // Allow DECCOLM mode
51 #define MODE_BracketedPastecxx . . $ `lib/Vt102Emulation.h:51:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+13) // Xterm-style bracketed paste mode
52 #define MODE_totalcxx . . $ `lib/Vt102Emulation.h:52:9`! (MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!+14)
53
54 namespace Konsolecxx . . $ Konsole/
55 {
56
57 struct CharCodescxx . . $ Konsole/CharCodes#
58 {
59 // coding info
60 char charsetcxx . . $ Konsole/CharCodes#charset.[4]; //
61 int cu_cscxx . . $ Konsole/CharCodes#cu_cs.; // actual charset.
62 bool graphiccxx . . $ Konsole/CharCodes#graphic.; // Some VT100 tricks
63 bool poundcxx . . $ Konsole/CharCodes#pound. ; // Some VT100 tricks
64 bool sa_graphiccxx . . $ Konsole/CharCodes#sa_graphic.; // saved graphic
65 bool sa_poundcxx . . $ Konsole/CharCodes#sa_pound.; // saved pound
66 };
67
68 /**
69 * Provides an xterm compatible terminal emulation based on the DEC VT102 terminal.
70 * A full description of this terminal can be found at http://vt100.net/docs/vt102-ug/
71 *
72 * In addition, various additional xterm escape sequences are supported to provide
73 * features such as mouse input handling.
74 * See http://rtfm.etla.org/xterm/ctlseq.html for a description of xterm's escape
75 * sequences.
76 *
77 */
78 class Vt102Emulationcxx . . $ Konsole/Vt102Emulation# : public Emulationcxx . . $ Konsole/Emulation#
79 {
80 Q_OBJECTcxx . . $ Konsole/Vt102Emulation#QPrivateSignal#
81
82 public:
83 /** Constructs a new emulation */
84 Vt102Emulationcxx . . $ Konsole/Vt102Emulation#Vt102Emulation(49f6e7a06ebc5aa8).();
85 ~cxx . . $ Konsole/Vt102Emulation#`~Vt102Emulation`(ced63f7c635d850d).Vt102Emulationcxx . . $ Konsole/Vt102Emulation#() override;
86
87 // reimplemented from Emulation
88 void clearEntireScreencxx . . $ Konsole/Vt102Emulation#clearEntireScreen(49f6e7a06ebc5aa8).() override;
89 void resetcxx . . $ Konsole/Vt102Emulation#reset(49f6e7a06ebc5aa8).() override;
90 char eraseCharcxx . . $ Konsole/Vt102Emulation#eraseChar(1b8b762cbef9c2c9).() const override;
91
92 public slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!:
93 // reimplemented from Emulation
94 void sendStringcxx . . $ Konsole/Vt102Emulation#sendString(34d26762b42c433a).(const char*,int length = -1) override;
95 void sendTextcxx . . $ Konsole/Vt102Emulation#sendText(3520e46b33348bf6).(const QStringcxx . . $ QString#& text) override;
96 void sendKeyEventcxx . . $ Konsole/Vt102Emulation#sendKeyEvent(4ced653b20f45578).(QKeyEventcxx . . $ QKeyEvent#*, bool fromPaste) override;
97 void sendMouseEventcxx . . $ Konsole/Vt102Emulation#sendMouseEvent(748afa4755bc9595).(int buttons, int column, int line, int eventType) override;
98 virtual void focusLostcxx . . $ Konsole/Vt102Emulation#focusLost(49f6e7a06ebc5aa8).();
99 virtual void focusGainedcxx . . $ Konsole/Vt102Emulation#focusGained(49f6e7a06ebc5aa8).();
100
101 protected:
102 // reimplemented from Emulation
103 void setModecxx . . $ Konsole/Vt102Emulation#setMode(d4f767463ce0a6b3).(int mode) override;
104 void resetModecxx . . $ Konsole/Vt102Emulation#resetMode(d4f767463ce0a6b3).(int mode) override;
105 void receiveCharcxx . . $ Konsole/Vt102Emulation#receiveChar(d461ae26ddb24b42).(wchar_t cc) override;
106
107 private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!:
108 //causes changeTitle() to be emitted for each (int,QString) pair in pendingTitleUpdates
109 //used to buffer multiple title updates
110 void updateTitlecxx . . $ Konsole/Vt102Emulation#updateTitle(49f6e7a06ebc5aa8).();
111
112 private:
113 wchar_t applyCharsetcxx . . $ Konsole/Vt102Emulation#applyCharset(81a7c28504ec2a5f).(wchar_t c);
114 void setCharsetcxx . . $ Konsole/Vt102Emulation#setCharset(3e454b8ccf442868).(int n, int cs);
115 void useCharsetcxx . . $ Konsole/Vt102Emulation#useCharset(d4f767463ce0a6b3).(int n);
116 void setAndUseCharsetcxx . . $ Konsole/Vt102Emulation#setAndUseCharset(3e454b8ccf442868).(int n, int cs);
117 void saveCursorcxx . . $ Konsole/Vt102Emulation#saveCursor(49f6e7a06ebc5aa8).();
118 void restoreCursorcxx . . $ Konsole/Vt102Emulation#restoreCursor(49f6e7a06ebc5aa8).();
119 void resetCharsetcxx . . $ Konsole/Vt102Emulation#resetCharset(d4f767463ce0a6b3).(int scrno);
120 QKeyEventcxx . . $ QKeyEvent# * remapKeyModifiersForMaccxx . . $ Konsole/Vt102Emulation#remapKeyModifiersForMac(1ece640c90cec9c).(QKeyEventcxx . . $ QKeyEvent# *event);
121
122
123 void setMarginscxx . . $ Konsole/Vt102Emulation#setMargins(3e454b8ccf442868).(int top, int bottom);
124 //set margins for all screens back to their defaults
125 void setDefaultMarginscxx . . $ Konsole/Vt102Emulation#setDefaultMargins(49f6e7a06ebc5aa8).();
126
127 // returns true if 'mode' is set or false otherwise
128 bool getModecxx . . $ Konsole/Vt102Emulation#getMode(83c267b20bac841a). (int mode);
129 // saves the current boolean value of 'mode'
130 void saveModecxx . . $ Konsole/Vt102Emulation#saveMode(d4f767463ce0a6b3). (int mode);
131 // restores the boolean value of 'mode'
132 void restoreModecxx . . $ Konsole/Vt102Emulation#restoreMode(d4f767463ce0a6b3).(int mode);
133 // resets all modes
134 // (except MODE_Allow132Columns)
135 void resetModescxx . . $ Konsole/Vt102Emulation#resetModes(49f6e7a06ebc5aa8).();
136
137 void resetTokenizercxx . . $ Konsole/Vt102Emulation#resetTokenizer(49f6e7a06ebc5aa8).();
138 #define MAX_TOKEN_LENGTHcxx . . $ `lib/Vt102Emulation.h:138:11`! 256 // Max length of tokens (e.g. window title)
139 void addToCurrentTokencxx . . $ Konsole/Vt102Emulation#addToCurrentToken(d461ae26ddb24b42).(wchar_t cc);
140 wchar_t tokenBuffercxx . . $ Konsole/Vt102Emulation#tokenBuffer.[MAX_TOKEN_LENGTHcxx . . $ `lib/Vt102Emulation.h:138:11`!]; //FIXME: overflow?
141 int tokenBufferPoscxx . . $ Konsole/Vt102Emulation#tokenBufferPos.;
142 #define MAXARGScxx . . $ `lib/Vt102Emulation.h:142:9`! 15
143 void addDigitcxx . . $ Konsole/Vt102Emulation#addDigit(d4f767463ce0a6b3).(int dig);
144 void addArgumentcxx . . $ Konsole/Vt102Emulation#addArgument(49f6e7a06ebc5aa8).();
145 int argvcxx . . $ Konsole/Vt102Emulation#argv.[MAXARGScxx . . $ `lib/Vt102Emulation.h:142:9`!];
146 int argccxx . . $ Konsole/Vt102Emulation#argc.;
147 void initTokenizercxx . . $ Konsole/Vt102Emulation#initTokenizer(49f6e7a06ebc5aa8).();
148 int prevCCcxx . . $ Konsole/Vt102Emulation#prevCC.;
149
150 // Set of flags for each of the ASCII characters which indicates
151 // what category they fall into (printable character, control, digit etc.)
152 // for the purposes of decoding terminal output
153 int charClasscxx . . $ Konsole/Vt102Emulation#charClass.[256];
154
155 void reportDecodingErrorcxx . . $ Konsole/Vt102Emulation#reportDecodingError(49f6e7a06ebc5aa8).();
156
157 void processTokencxx . . $ Konsole/Vt102Emulation#processToken(7a2677df7d908e0d).(int code, wchar_t p, int q);
158 void processWindowAttributeChangecxx . . $ Konsole/Vt102Emulation#processWindowAttributeChange(49f6e7a06ebc5aa8).();
159 void requestWindowAttributecxx . . $ Konsole/Vt102Emulation#requestWindowAttribute(d4f767463ce0a6b3).(int);
160
161 void reportTerminalTypecxx . . $ Konsole/Vt102Emulation#reportTerminalType(49f6e7a06ebc5aa8).();
162 void reportSecondaryAttributescxx . . $ Konsole/Vt102Emulation#reportSecondaryAttributes(49f6e7a06ebc5aa8).();
163 void reportStatuscxx . . $ Konsole/Vt102Emulation#reportStatus(49f6e7a06ebc5aa8).();
164 void reportAnswerBackcxx . . $ Konsole/Vt102Emulation#reportAnswerBack(49f6e7a06ebc5aa8).();
165 void reportCursorPositioncxx . . $ Konsole/Vt102Emulation#reportCursorPosition(49f6e7a06ebc5aa8).();
166 void reportTerminalParmscxx . . $ Konsole/Vt102Emulation#reportTerminalParms(d4f767463ce0a6b3).(int p);
167
168 void onScrollLockcxx . . $ Konsole/Vt102Emulation#onScrollLock(49f6e7a06ebc5aa8).();
169 void scrollLockcxx . . $ Konsole/Vt102Emulation#scrollLock(b45ddcbc8423892c).(const bool lock);
170
171 // clears the screen and resizes it to the specified
172 // number of columns
173 void clearScreenAndSetColumnscxx . . $ Konsole/Vt102Emulation#clearScreenAndSetColumns(d4f767463ce0a6b3).(int columnCount);
174
175 CharCodescxx . . $ Konsole/CharCodes# _charsetcxx . . $ Konsole/Vt102Emulation#_charset.[2];
176
177 class TerminalStatecxx . . $ Konsole/Vt102Emulation#TerminalState#
178 {
179 public:
180 // Initializes all modes to false
181 TerminalStatecxx . . $ Konsole/Vt102Emulation#TerminalState#TerminalState(49f6e7a06ebc5aa8).()
182 { memset(&modecxx . . $ Konsole/Vt102Emulation#TerminalState#mode.,false,MODE_totalcxx . . $ `lib/Vt102Emulation.h:52:9`! * sizeof(bool)); }
183
184 bool modecxx . . $ Konsole/Vt102Emulation#TerminalState#mode.[MODE_totalcxx . . $ `lib/Vt102Emulation.h:52:9`!];
185 };
186
187 TerminalStatecxx . . $ Konsole/Vt102Emulation#TerminalState# _currentModescxx . . $ Konsole/Vt102Emulation#_currentModes.;
188 TerminalStatecxx . . $ Konsole/Vt102Emulation#TerminalState# _savedModescxx . . $ Konsole/Vt102Emulation#_savedModes.;
189
190 //hash table and timer for buffering calls to the session instance
191 //to update the name of the session
192 //or window title.
193 //these calls occur when certain escape sequences are seen in the
194 //output from the terminal
195 QHashcxx . . $ QHash#<int,QStringcxx . . $ QString#> _pendingTitleUpdatescxx . . $ Konsole/Vt102Emulation#_pendingTitleUpdates.;
196 QTimercxx . . $ QTimer#* _titleUpdateTimercxx . . $ Konsole/Vt102Emulation#_titleUpdateTimer.;
197
198 bool _reportFocusEventscxx . . $ Konsole/Vt102Emulation#_reportFocusEvents.;
199 };
200
201 }
202
203 #endif // VT102EMULATION_H