summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/vt102emulation.cpp2
-rw-r--r--noncore/apps/opie-console/vt102emulation.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/vt102emulation.cpp b/noncore/apps/opie-console/vt102emulation.cpp
index 7eecef3..0ebefa0 100644
--- a/noncore/apps/opie-console/vt102emulation.cpp
+++ b/noncore/apps/opie-console/vt102emulation.cpp
@@ -1,283 +1,283 @@
1/* ------------------------------------------------------------------------- */ 1/* ------------------------------------------------------------------------- */
2/* */ 2/* */
3/* [vt102emulation.cpp] VT102 Terminal Emulation */ 3/* [vt102emulation.cpp] VT102 Terminal Emulation */
4/* */ 4/* */
5/* ------------------------------------------------------------------------- */ 5/* ------------------------------------------------------------------------- */
6/* */ 6/* */
7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
8/* */ 8/* */
9/* This file is part of Konsole - an X terminal for KDE */ 9/* This file is part of Konsole - an X terminal for KDE */
10/* */ 10/* */
11/* ------------------------------------------------------------------------- */ 11/* ------------------------------------------------------------------------- */
12/* */ 12/* */
13/* Ported Konsole to Qt/Embedded */ 13/* Ported Konsole to Qt/Embedded */
14/* */ 14/* */
15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
16/* */ 16/* */
17/* -------------------------------------------------------------------------- */ 17/* -------------------------------------------------------------------------- */
18 18
19/*! \class Vt102Emulation 19/*! \class Vt102Emulation
20 20
21 \brief Actual Emulation for Konsole 21 \brief Actual Emulation for Konsole
22 22
23 \sa Widget \sa Screen \sa EmulationLayer 23 \sa Widget \sa Screen \sa EmulationLayer
24*/ 24*/
25 25
26#include "vt102emulation.h" 26#include "vt102emulation.h"
27#include "widget.h" 27#include "widget_layer.h"
28#include "screen.h" 28#include "screen.h"
29#include "keytrans.h" 29#include "keytrans.h"
30 30
31#include <stdio.h> 31#include <stdio.h>
32#include <unistd.h> 32#include <unistd.h>
33#include <qkeycode.h> 33#include <qkeycode.h>
34#include <qtextcodec.h> 34#include <qtextcodec.h>
35 35
36 36
37/* VT102 Terminal Emulation 37/* VT102 Terminal Emulation
38 38
39 This class puts together the screens, the pty and the widget to a 39 This class puts together the screens, the pty and the widget to a
40 complete terminal emulation. Beside combining it's componentes, it 40 complete terminal emulation. Beside combining it's componentes, it
41 handles the emulations's protocol. 41 handles the emulations's protocol.
42 42
43 This module consists of the following sections: 43 This module consists of the following sections:
44 44
45 - Constructor/Destructor 45 - Constructor/Destructor
46 - Incoming Bytes Event pipeline 46 - Incoming Bytes Event pipeline
47 - Outgoing Bytes 47 - Outgoing Bytes
48 - Mouse Events 48 - Mouse Events
49 - Keyboard Events 49 - Keyboard Events
50 - Modes and Charset State 50 - Modes and Charset State
51 - Diagnostics 51 - Diagnostics
52*/ 52*/
53 53
54 54
55/* ------------------------------------------------------------------------- */ 55/* ------------------------------------------------------------------------- */
56/* */ 56/* */
57/* Constructor / Destructor */ 57/* Constructor / Destructor */
58/* */ 58/* */
59/* ------------------------------------------------------------------------- */ 59/* ------------------------------------------------------------------------- */
60 60
61/* 61/*
62 Nothing really intesting happens here. 62 Nothing really intesting happens here.
63*/ 63*/
64 64
65/*! 65/*!
66*/ 66*/
67 67
68Vt102Emulation::Vt102Emulation(WidgetLayer* gui) : EmulationLayer(gui) 68Vt102Emulation::Vt102Emulation(WidgetLayer* gui) : EmulationLayer(gui)
69{ 69{
70 QObject::connect(gui,SIGNAL(mouseSignal(int,int,int)), 70 QObject::connect(gui,SIGNAL(mouseSignal(int,int,int)),
71 this,SLOT(onMouse(int,int,int))); 71 this,SLOT(onMouse(int,int,int)));
72 initTokenizer(); 72 initTokenizer();
73 reset(); 73 reset();
74} 74}
75 75
76/*! 76/*!
77*/ 77*/
78 78
79Vt102Emulation::~Vt102Emulation() 79Vt102Emulation::~Vt102Emulation()
80{ 80{
81} 81}
82 82
83/*! 83/*!
84*/ 84*/
85 85
86void Vt102Emulation::reset() 86void Vt102Emulation::reset()
87{ 87{
88 resetToken(); 88 resetToken();
89 resetModes(); 89 resetModes();
90 resetCharset(0); screen[0]->reset(); 90 resetCharset(0); screen[0]->reset();
91 resetCharset(1); screen[0]->reset(); 91 resetCharset(1); screen[0]->reset();
92 setCodec(0); 92 setCodec(0);
93 setKeytrans("linux.keytab"); 93 setKeytrans("linux.keytab");
94} 94}
95 95
96/* ------------------------------------------------------------------------- */ 96/* ------------------------------------------------------------------------- */
97/* */ 97/* */
98/* Processing the incoming byte stream */ 98/* Processing the incoming byte stream */
99/* */ 99/* */
100/* ------------------------------------------------------------------------- */ 100/* ------------------------------------------------------------------------- */
101 101
102/* Incoming Bytes Event pipeline 102/* Incoming Bytes Event pipeline
103 103
104 This section deals with decoding the incoming character stream. 104 This section deals with decoding the incoming character stream.
105 Decoding means here, that the stream is first seperated into `tokens' 105 Decoding means here, that the stream is first seperated into `tokens'
106 which are then mapped to a `meaning' provided as operations by the 106 which are then mapped to a `meaning' provided as operations by the
107 `TEScreen' class or by the emulation class itself. 107 `TEScreen' class or by the emulation class itself.
108 108
109 The pipeline proceeds as follows: 109 The pipeline proceeds as follows:
110 110
111 - Tokenizing the ESC codes (onRcvChar) 111 - Tokenizing the ESC codes (onRcvChar)
112 - VT100 code page translation of plain characters (applyCharset) 112 - VT100 code page translation of plain characters (applyCharset)
113 - Interpretation of ESC codes (tau) 113 - Interpretation of ESC codes (tau)
114 114
115 The escape codes and their meaning are described in the 115 The escape codes and their meaning are described in the
116 technical reference of this program. 116 technical reference of this program.
117*/ 117*/
118 118
119// Tokens ------------------------------------------------------------------ -- 119// Tokens ------------------------------------------------------------------ --
120 120
121/* 121/*
122 Since the tokens are the central notion if this section, we've put them 122 Since the tokens are the central notion if this section, we've put them
123 in front. They provide the syntactical elements used to represent the 123 in front. They provide the syntactical elements used to represent the
124 terminals operations as byte sequences. 124 terminals operations as byte sequences.
125 125
126 They are encodes here into a single machine word, so that we can later 126 They are encodes here into a single machine word, so that we can later
127 switch over them easily. Depending on the token itself, additional 127 switch over them easily. Depending on the token itself, additional
128 argument variables are filled with parameter values. 128 argument variables are filled with parameter values.
129 129
130 The tokens are defined below: 130 The tokens are defined below:
131 131
132 - CHR - Printable characters (32..255 but DEL (=127)) 132 - CHR - Printable characters (32..255 but DEL (=127))
133 - CTL - Control characters (0..31 but ESC (= 27), DEL) 133 - CTL - Control characters (0..31 but ESC (= 27), DEL)
134 - ESC - Escape codes of the form <ESC><CHR but `[]()+*#'> 134 - ESC - Escape codes of the form <ESC><CHR but `[]()+*#'>
135 - ESC_DE - Escape codes of the form <ESC><any of `()+*#%'> C 135 - ESC_DE - Escape codes of the form <ESC><any of `()+*#%'> C
136 - CSI_PN - Escape codes of the form <ESC>'[' {Pn} ';' {Pn} C 136 - CSI_PN - Escape codes of the form <ESC>'[' {Pn} ';' {Pn} C
137 - CSI_PS - Escape codes of the form <ESC>'[' {Pn} ';' ... C 137 - CSI_PS - Escape codes of the form <ESC>'[' {Pn} ';' ... C
138 - CSI_PR - Escape codes of the form <ESC>'[' '?' {Pn} ';' ... C 138 - CSI_PR - Escape codes of the form <ESC>'[' '?' {Pn} ';' ... C
139 - VT52 - VT52 escape codes 139 - VT52 - VT52 escape codes
140 - <ESC><Chr> 140 - <ESC><Chr>
141 - <ESC>'Y'{Pc}{Pc} 141 - <ESC>'Y'{Pc}{Pc}
142 - XTE_HA - Xterm hacks <ESC>`]' {Pn} `;' {Text} <BEL> 142 - XTE_HA - Xterm hacks <ESC>`]' {Pn} `;' {Text} <BEL>
143 note that this is handled differently 143 note that this is handled differently
144 144
145 The last two forms allow list of arguments. Since the elements of 145 The last two forms allow list of arguments. Since the elements of
146 the lists are treated individually the same way, they are passed 146 the lists are treated individually the same way, they are passed
147 as individual tokens to the interpretation. Further, because the 147 as individual tokens to the interpretation. Further, because the
148 meaning of the parameters are names (althought represented as numbers), 148 meaning of the parameters are names (althought represented as numbers),
149 they are includes within the token ('N'). 149 they are includes within the token ('N').
150 150
151*/ 151*/
152 152
153#define TY_CONSTR(T,A,N) ( ((((int)N) & 0xffff) << 16) | ((((int)A) & 0xff) << 8) | (((int)T) & 0xff) ) 153#define TY_CONSTR(T,A,N) ( ((((int)N) & 0xffff) << 16) | ((((int)A) & 0xff) << 8) | (((int)T) & 0xff) )
154 154
155#define TY_CHR___( ) TY_CONSTR(0,0,0) 155#define TY_CHR___( ) TY_CONSTR(0,0,0)
156#define TY_CTL___(A ) TY_CONSTR(1,A,0) 156#define TY_CTL___(A ) TY_CONSTR(1,A,0)
157#define TY_ESC___(A ) TY_CONSTR(2,A,0) 157#define TY_ESC___(A ) TY_CONSTR(2,A,0)
158#define TY_ESC_CS(A,B) TY_CONSTR(3,A,B) 158#define TY_ESC_CS(A,B) TY_CONSTR(3,A,B)
159#define TY_ESC_DE(A ) TY_CONSTR(4,A,0) 159#define TY_ESC_DE(A ) TY_CONSTR(4,A,0)
160#define TY_CSI_PS(A,N) TY_CONSTR(5,A,N) 160#define TY_CSI_PS(A,N) TY_CONSTR(5,A,N)
161#define TY_CSI_PN(A ) TY_CONSTR(6,A,0) 161#define TY_CSI_PN(A ) TY_CONSTR(6,A,0)
162#define TY_CSI_PR(A,N) TY_CONSTR(7,A,N) 162#define TY_CSI_PR(A,N) TY_CONSTR(7,A,N)
163 163
164#define TY_VT52__(A ) TY_CONSTR(8,A,0) 164#define TY_VT52__(A ) TY_CONSTR(8,A,0)
165 165
166// Tokenizer --------------------------------------------------------------- -- 166// Tokenizer --------------------------------------------------------------- --
167 167
168/* The tokenizers state 168/* The tokenizers state
169 169
170 The state is represented by the buffer (pbuf, ppos), 170 The state is represented by the buffer (pbuf, ppos),
171 and accompanied by decoded arguments kept in (argv,argc). 171 and accompanied by decoded arguments kept in (argv,argc).
172 Note that they are kept internal in the tokenizer. 172 Note that they are kept internal in the tokenizer.
173*/ 173*/
174 174
175void Vt102Emulation::resetToken() 175void Vt102Emulation::resetToken()
176{ 176{
177 ppos = 0; argc = 0; argv[0] = 0; argv[1] = 0; 177 ppos = 0; argc = 0; argv[0] = 0; argv[1] = 0;
178} 178}
179 179
180void Vt102Emulation::addDigit(int dig) 180void Vt102Emulation::addDigit(int dig)
181{ 181{
182 argv[argc] = 10*argv[argc] + dig; 182 argv[argc] = 10*argv[argc] + dig;
183} 183}
184 184
185void Vt102Emulation::addArgument() 185void Vt102Emulation::addArgument()
186{ 186{
187 argc = QMIN(argc+1,MAXARGS-1); 187 argc = QMIN(argc+1,MAXARGS-1);
188 argv[argc] = 0; 188 argv[argc] = 0;
189} 189}
190 190
191void Vt102Emulation::pushToToken(int cc) 191void Vt102Emulation::pushToToken(int cc)
192{ 192{
193 pbuf[ppos] = cc; 193 pbuf[ppos] = cc;
194 ppos = QMIN(ppos+1,MAXPBUF-1); 194 ppos = QMIN(ppos+1,MAXPBUF-1);
195} 195}
196 196
197// Character Classes used while decoding 197// Character Classes used while decoding
198 198
199#define CTL 1 199#define CTL 1
200#define CHR 2 200#define CHR 2
201#define CPN 4 201#define CPN 4
202#define DIG 8 202#define DIG 8
203#define SCS 16 203#define SCS 16
204#define GRP 32 204#define GRP 32
205 205
206void Vt102Emulation::initTokenizer() 206void Vt102Emulation::initTokenizer()
207{ int i; UINT8* s; 207{ int i; UINT8* s;
208 for(i = 0; i < 256; i++) tbl[ i] = 0; 208 for(i = 0; i < 256; i++) tbl[ i] = 0;
209 for(i = 0; i < 32; i++) tbl[ i] |= CTL; 209 for(i = 0; i < 32; i++) tbl[ i] |= CTL;
210 for(i = 32; i < 256; i++) tbl[ i] |= CHR; 210 for(i = 32; i < 256; i++) tbl[ i] |= CHR;
211 for(s = (UINT8*)"@ABCDGHLMPXcdfry"; *s; s++) tbl[*s] |= CPN; 211 for(s = (UINT8*)"@ABCDGHLMPXcdfry"; *s; s++) tbl[*s] |= CPN;
212 for(s = (UINT8*)"0123456789" ; *s; s++) tbl[*s] |= DIG; 212 for(s = (UINT8*)"0123456789" ; *s; s++) tbl[*s] |= DIG;
213 for(s = (UINT8*)"()+*%" ; *s; s++) tbl[*s] |= SCS; 213 for(s = (UINT8*)"()+*%" ; *s; s++) tbl[*s] |= SCS;
214 for(s = (UINT8*)"()+*#[]%" ; *s; s++) tbl[*s] |= GRP; 214 for(s = (UINT8*)"()+*#[]%" ; *s; s++) tbl[*s] |= GRP;
215 resetToken(); 215 resetToken();
216} 216}
217 217
218/* Ok, here comes the nasty part of the decoder. 218/* Ok, here comes the nasty part of the decoder.
219 219
220 Instead of keeping an explicit state, we deduce it from the 220 Instead of keeping an explicit state, we deduce it from the
221 token scanned so far. It is then immediately combined with 221 token scanned so far. It is then immediately combined with
222 the current character to form a scanning decision. 222 the current character to form a scanning decision.
223 223
224 This is done by the following defines. 224 This is done by the following defines.
225 225
226 - P is the length of the token scanned so far. 226 - P is the length of the token scanned so far.
227 - L (often P-1) is the position on which contents we base a decision. 227 - L (often P-1) is the position on which contents we base a decision.
228 - C is a character or a group of characters (taken from 'tbl'). 228 - C is a character or a group of characters (taken from 'tbl').
229 229
230 Note that they need to applied in proper order. 230 Note that they need to applied in proper order.
231*/ 231*/
232 232
233#define lec(P,L,C) (p == (P) && s[(L)] == (C)) 233#define lec(P,L,C) (p == (P) && s[(L)] == (C))
234#define lun( ) (p == 1 && cc >= 32 ) 234#define lun( ) (p == 1 && cc >= 32 )
235#define les(P,L,C) (p == (P) && s[L] < 256 && (tbl[s[(L)]] & (C)) == (C)) 235#define les(P,L,C) (p == (P) && s[L] < 256 && (tbl[s[(L)]] & (C)) == (C))
236#define eec(C) (p >= 3 && cc == (C)) 236#define eec(C) (p >= 3 && cc == (C))
237#define ees(C) (p >= 3 && cc < 256 && (tbl[ cc ] & (C)) == (C)) 237#define ees(C) (p >= 3 && cc < 256 && (tbl[ cc ] & (C)) == (C))
238#define eps(C) (p >= 3 && s[2] != '?' && cc < 256 && (tbl[ cc ] & (C)) == (C)) 238#define eps(C) (p >= 3 && s[2] != '?' && cc < 256 && (tbl[ cc ] & (C)) == (C))
239#define epp( ) (p >= 3 && s[2] == '?' ) 239#define epp( ) (p >= 3 && s[2] == '?' )
240#define egt( ) (p == 3 && s[2] == '>' ) 240#define egt( ) (p == 3 && s[2] == '>' )
241#define Xpe (ppos>=2 && pbuf[1] == ']' ) 241#define Xpe (ppos>=2 && pbuf[1] == ']' )
242#define Xte (Xpe && cc == 7 ) 242#define Xte (Xpe && cc == 7 )
243#define ces(C) ( cc < 256 && (tbl[ cc ] & (C)) == (C) && !Xte) 243#define ces(C) ( cc < 256 && (tbl[ cc ] & (C)) == (C) && !Xte)
244 244
245#define ESC 27 245#define ESC 27
246#define CNTL(c) ((c)-'@') 246#define CNTL(c) ((c)-'@')
247 247
248// process an incoming unicode character 248// process an incoming unicode character
249 249
250void Vt102Emulation::onRcvChar(int cc) 250void Vt102Emulation::onRcvChar(int cc)
251{ int i; 251{ int i;
252 252
253 if (cc == 127) return; //VT100: ignore. 253 if (cc == 127) return; //VT100: ignore.
254 254
255 if (ces( CTL)) 255 if (ces( CTL))
256 { // DEC HACK ALERT! Control Characters are allowed *within* esc sequences in VT100 256 { // DEC HACK ALERT! Control Characters are allowed *within* esc sequences in VT100
257 // This means, they do neither a resetToken nor a pushToToken. Some of them, do 257 // This means, they do neither a resetToken nor a pushToToken. Some of them, do
258 // of course. Guess this originates from a weakly layered handling of the X-on 258 // of course. Guess this originates from a weakly layered handling of the X-on
259 // X-off protocol, which comes really below this level. 259 // X-off protocol, which comes really below this level.
260 if (cc == CNTL('X') || cc == CNTL('Z') || cc == ESC) resetToken(); //VT100: CAN or SUB 260 if (cc == CNTL('X') || cc == CNTL('Z') || cc == ESC) resetToken(); //VT100: CAN or SUB
261 if (cc != ESC) { tau( TY_CTL___(cc+'@' ), 0, 0); return; } 261 if (cc != ESC) { tau( TY_CTL___(cc+'@' ), 0, 0); return; }
262 } 262 }
263 263
264 pushToToken(cc); // advance the state 264 pushToToken(cc); // advance the state
265 265
266 int* s = pbuf; 266 int* s = pbuf;
267 int p = ppos; 267 int p = ppos;
268 268
269 if (getMode(MODE_Ansi)) // decide on proper action 269 if (getMode(MODE_Ansi)) // decide on proper action
270 { 270 {
271 if (lec(1,0,ESC)) { return; } 271 if (lec(1,0,ESC)) { return; }
272 if (les(2,1,GRP)) { return; } 272 if (les(2,1,GRP)) { return; }
273 if (Xte ) { XtermHack(); resetToken(); return; } 273 if (Xte ) { XtermHack(); resetToken(); return; }
274 if (Xpe ) { return; } 274 if (Xpe ) { return; }
275 if (lec(3,2,'?')) { return; } 275 if (lec(3,2,'?')) { return; }
276 if (lec(3,2,'>')) { return; } 276 if (lec(3,2,'>')) { return; }
277 if (lun( )) { tau( TY_CHR___(), applyCharset(cc), 0); resetToken(); return; } 277 if (lun( )) { tau( TY_CHR___(), applyCharset(cc), 0); resetToken(); return; }
278 if (lec(2,0,ESC)) { tau( TY_ESC___(s[1]), 0, 0); resetToken(); return; } 278 if (lec(2,0,ESC)) { tau( TY_ESC___(s[1]), 0, 0); resetToken(); return; }
279 if (les(3,1,SCS)) { tau( TY_ESC_CS(s[1],s[2]), 0, 0); resetToken(); return; } 279 if (les(3,1,SCS)) { tau( TY_ESC_CS(s[1],s[2]), 0, 0); resetToken(); return; }
280 if (lec(3,1,'#')) { tau( TY_ESC_DE(s[2]), 0, 0); resetToken(); return; } 280 if (lec(3,1,'#')) { tau( TY_ESC_DE(s[2]), 0, 0); resetToken(); return; }
281// if (egt( )) { tau( TY_CSI_PG(cc ), '>', 0); resetToken(); return; } 281// if (egt( )) { tau( TY_CSI_PG(cc ), '>', 0); resetToken(); return; }
282 if (eps( CPN)) { tau( TY_CSI_PN(cc), argv[0],argv[1]); resetToken(); return; } 282 if (eps( CPN)) { tau( TY_CSI_PN(cc), argv[0],argv[1]); resetToken(); return; }
283 if (ees( DIG)) { addDigit(cc-'0'); return; } 283 if (ees( DIG)) { addDigit(cc-'0'); return; }
diff --git a/noncore/apps/opie-console/vt102emulation.h b/noncore/apps/opie-console/vt102emulation.h
index de4a62f..17ab449 100644
--- a/noncore/apps/opie-console/vt102emulation.h
+++ b/noncore/apps/opie-console/vt102emulation.h
@@ -1,153 +1,153 @@
1/* -------------------------------------------------------------------------- */ 1/* -------------------------------------------------------------------------- */
2/* */ 2/* */
3/* [TEmuVt102.h] X Terminal Emulation */ 3/* [TEmuVt102.h] X Terminal Emulation */
4/* */ 4/* */
5/* -------------------------------------------------------------------------- */ 5/* -------------------------------------------------------------------------- */
6/* */ 6/* */
7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
8/* */ 8/* */
9/* This file is part of Konsole - an X terminal for KDE */ 9/* This file is part of Konsole - an X terminal for KDE */
10/* */ 10/* */
11/* -------------------------------------------------------------------------- */ 11/* -------------------------------------------------------------------------- */
12 /* */ 12 /* */
13/* Ported Konsole to Qt/Embedded */ 13/* Ported Konsole to Qt/Embedded */
14 /* */ 14 /* */
15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
16 /* */ 16 /* */
17/* -------------------------------------------------------------------------- */ 17/* -------------------------------------------------------------------------- */
18/* Ported embedded-konsole to opie-terminal */ 18/* Ported embedded-konsole to opie-terminal */
19 /* */ 19 /* */
20/* Copyright (C) 2002 by opie developers <opie@handhelds.org> */ 20/* Copyright (C) 2002 by opie developers <opie@handhelds.org> */
21 /* */ 21 /* */
22/* -------------------------------------------------------------------------- */ 22/* -------------------------------------------------------------------------- */
23 23
24#ifndef VT102EMU_H 24#ifndef VT102EMU_H
25#define VT102EMU_H 25#define VT102EMU_H
26 26
27#include "widget.h" 27#include "widget_layer.h"
28#include "screen.h" 28#include "screen.h"
29#include "emulation_layer.h" 29#include "emulation_layer.h"
30#include <qtimer.h> 30#include <qtimer.h>
31#include <stdio.h> 31#include <stdio.h>
32 32
33// 33//
34 34
35#define MODE_AppScreen (MODES_SCREEN+0) 35#define MODE_AppScreen (MODES_SCREEN+0)
36#define MODE_AppCuKeys (MODES_SCREEN+1) 36#define MODE_AppCuKeys (MODES_SCREEN+1)
37#define MODE_AppKeyPad (MODES_SCREEN+2) 37#define MODE_AppKeyPad (MODES_SCREEN+2)
38#define MODE_Mouse1000 (MODES_SCREEN+3) 38#define MODE_Mouse1000 (MODES_SCREEN+3)
39#define MODE_Ansi (MODES_SCREEN+4) 39#define MODE_Ansi (MODES_SCREEN+4)
40#define MODE_total (MODES_SCREEN+5) 40#define MODE_total (MODES_SCREEN+5)
41 41
42struct DECpar 42struct DECpar
43{ 43{
44 BOOL mode[MODE_total]; 44 BOOL mode[MODE_total];
45}; 45};
46 46
47struct CharCodes 47struct CharCodes
48{ 48{
49 // coding info 49 // coding info
50 char charset[4]; // 50 char charset[4]; //
51 int cu_cs; // actual charset. 51 int cu_cs; // actual charset.
52 bool graphic; // Some VT100 tricks 52 bool graphic; // Some VT100 tricks
53 bool pound ; // Some VT100 tricks 53 bool pound ; // Some VT100 tricks
54 bool sa_graphic; // saved graphic 54 bool sa_graphic; // saved graphic
55 bool sa_pound; // saved pound 55 bool sa_pound; // saved pound
56}; 56};
57 57
58class Vt102Emulation: public EmulationLayer 58class Vt102Emulation: public EmulationLayer
59{ Q_OBJECT 59{ Q_OBJECT
60 60
61public: 61public:
62 62
63 Vt102Emulation(WidgetLayer* gui); 63 Vt102Emulation(WidgetLayer* gui);
64 ~Vt102Emulation(); 64 ~Vt102Emulation();
65 65
66public slots: // signals incoming from Widget 66public slots: // signals incoming from Widget
67 67
68 void onKeyPress(QKeyEvent*); 68 void onKeyPress(QKeyEvent*);
69 void onMouse(int cb, int cx, int cy); 69 void onMouse(int cb, int cx, int cy);
70 70
71signals: 71signals:
72 72
73 void changeTitle(int,const QString&); 73 void changeTitle(int,const QString&);
74 void prevSession(); 74 void prevSession();
75 void nextSession(); 75 void nextSession();
76 76
77public: 77public:
78 78
79 void reset(); 79 void reset();
80 80
81 /** 81 /**
82 * receive a char from IOLayer 82 * receive a char from IOLayer
83 */ 83 */
84 void onRcvChar(int cc); 84 void onRcvChar(int cc);
85 85
86 /** 86 /**
87 * sends a list of bytes to the IOLayer 87 * sends a list of bytes to the IOLayer
88 */ 88 */
89 void sendString(const QByteArray&); 89 void sendString(const QByteArray&);
90 90
91 /** 91 /**
92 * @deprecated use QByteArray instead 92 * @deprecated use QByteArray instead
93 * see sendString() above 93 * see sendString() above
94 */ 94 */
95 void sendString(const char *); 95 void sendString(const char *);
96 96
97public: 97public:
98 98
99 BOOL getMode (int m); 99 BOOL getMode (int m);
100 100
101 void setMode (int m); 101 void setMode (int m);
102 void resetMode (int m); 102 void resetMode (int m);
103 void saveMode (int m); 103 void saveMode (int m);
104 void restoreMode(int m); 104 void restoreMode(int m);
105 void resetModes(); 105 void resetModes();
106 106
107 void setConnect(bool r); 107 void setConnect(bool r);
108 108
109private: 109private:
110 110
111 void resetToken(); 111 void resetToken();
112#define MAXPBUF 80 112#define MAXPBUF 80
113 void pushToToken(int cc); 113 void pushToToken(int cc);
114 int pbuf[MAXPBUF]; //FIXME: overflow? 114 int pbuf[MAXPBUF]; //FIXME: overflow?
115 int ppos; 115 int ppos;
116#define MAXARGS 15 116#define MAXARGS 15
117 void addDigit(int dig); 117 void addDigit(int dig);
118 void addArgument(); 118 void addArgument();
119 int argv[MAXARGS]; 119 int argv[MAXARGS];
120 int argc; 120 int argc;
121 void initTokenizer(); 121 void initTokenizer();
122 int tbl[256]; 122 int tbl[256];
123 123
124 void scan_buffer_report(); //FIXME: rename 124 void scan_buffer_report(); //FIXME: rename
125 void ReportErrorToken(); //FIXME: rename 125 void ReportErrorToken(); //FIXME: rename
126 126
127 void tau(int code, int p, int q); 127 void tau(int code, int p, int q);
128 void XtermHack(); 128 void XtermHack();
129 129
130 // 130 //
131 131
132 void reportTerminalType(); 132 void reportTerminalType();
133 void reportStatus(); 133 void reportStatus();
134 void reportAnswerBack(); 134 void reportAnswerBack();
135 void reportCursorPosition(); 135 void reportCursorPosition();
136 void reportTerminalParms(int p); 136 void reportTerminalParms(int p);
137 137
138protected: 138protected:
139 139
140 unsigned short applyCharset(unsigned short c); 140 unsigned short applyCharset(unsigned short c);
141 void setCharset(int n, int cs); 141 void setCharset(int n, int cs);
142 void useCharset(int n); 142 void useCharset(int n);
143 void setAndUseCharset(int n, int cs); 143 void setAndUseCharset(int n, int cs);
144 void saveCursor(); 144 void saveCursor();
145 void restoreCursor(); 145 void restoreCursor();
146 void resetCharset(int scrno); 146 void resetCharset(int scrno);
147 CharCodes charset[2]; 147 CharCodes charset[2];
148 148
149 DECpar currParm; 149 DECpar currParm;
150 DECpar saveParm; 150 DECpar saveParm;
151}; 151};
152 152
153#endif // ifndef ANSIEMU_H 153#endif // ifndef ANSIEMU_H