summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/vt102emulation.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/vt102emulation.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/vt102emulation.h153
1 files changed, 153 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/vt102emulation.h b/noncore/apps/opie-console/vt102emulation.h
new file mode 100644
index 0000000..018835e
--- a/dev/null
+++ b/noncore/apps/opie-console/vt102emulation.h
@@ -0,0 +1,153 @@
1/* -------------------------------------------------------------------------- */
2/* */
3/* [TEmuVt102.h] X Terminal Emulation */
4/* */
5/* -------------------------------------------------------------------------- */
6/* */
7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
8/* */
9/* This file is part of Konsole - an X terminal for KDE */
10/* */
11/* -------------------------------------------------------------------------- */
12 /* */
13/* Ported Konsole to Qt/Embedded */
14 /* */
15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
16 /* */
17/* -------------------------------------------------------------------------- */
18/* Ported embedded-konsole to opie-terminal */
19 /* */
20/* Copyright (C) 2002 by opie developers <opie@handhelds.org> */
21 /* */
22/* -------------------------------------------------------------------------- */
23
24#ifndef VT102EMU_H
25#define VT102EMU_H
26
27#include "widget.h"
28#include "screen.h"
29#include "emulation_layer.h"
30#include <qtimer.h>
31#include <stdio.h>
32
33//
34
35#define MODE_AppScreen (MODES_SCREEN+0)
36#define MODE_AppCuKeys (MODES_SCREEN+1)
37#define MODE_AppKeyPad (MODES_SCREEN+2)
38#define MODE_Mouse1000 (MODES_SCREEN+3)
39#define MODE_Ansi (MODES_SCREEN+4)
40#define MODE_total (MODES_SCREEN+5)
41
42struct DECpar
43{
44 BOOL mode[MODE_total];
45};
46
47struct CharCodes
48{
49 // coding info
50 char charset[4]; //
51 int cu_cs; // actual charset.
52 bool graphic; // Some VT100 tricks
53 bool pound ; // Some VT100 tricks
54 bool sa_graphic; // saved graphic
55 bool sa_pound; // saved pound
56};
57
58class Vt102Emulation: public EmulationLayer
59{ Q_OBJECT
60
61public:
62
63 Vt102Emulation(Widget* gui);
64 ~Vt102Emulation();
65
66public slots: // signals incoming from Widget
67
68 void onKeyPress(QKeyEvent*);
69 void onMouse(int cb, int cx, int cy);
70
71signals:
72
73 void changeTitle(int,const QString&);
74 void prevSession();
75 void nextSession();
76
77public:
78
79 void reset();
80
81 /**
82 * receive a char from IOLayer
83 */
84 void onRcvChar(int cc);
85
86 /**
87 * sends a list of bytes to the IOLayer
88 */
89 void sendString(const QByteArray);
90
91 /**
92 * @deprecated use QByteArray instead
93 * see sendString() above
94 */
95 void sendString(const char *);
96
97public:
98
99 BOOL getMode (int m);
100
101 void setMode (int m);
102 void resetMode (int m);
103 void saveMode (int m);
104 void restoreMode(int m);
105 void resetModes();
106
107 void setConnect(bool r);
108
109private:
110
111 void resetToken();
112#define MAXPBUF 80
113 void pushToToken(int cc);
114 int pbuf[MAXPBUF]; //FIXME: overflow?
115 int ppos;
116#define MAXARGS 15
117 void addDigit(int dig);
118 void addArgument();
119 int argv[MAXARGS];
120 int argc;
121 void initTokenizer();
122 int tbl[256];
123
124 void scan_buffer_report(); //FIXME: rename
125 void ReportErrorToken(); //FIXME: rename
126
127 void tau(int code, int p, int q);
128 void XtermHack();
129
130 //
131
132 void reportTerminalType();
133 void reportStatus();
134 void reportAnswerBack();
135 void reportCursorPosition();
136 void reportTerminalParms(int p);
137
138protected:
139
140 unsigned short applyCharset(unsigned short c);
141 void setCharset(int n, int cs);
142 void useCharset(int n);
143 void setAndUseCharset(int n, int cs);
144 void saveCursor();
145 void restoreCursor();
146 void resetCharset(int scrno);
147 CharCodes charset[2];
148
149 DECpar currParm;
150 DECpar saveParm;
151};
152
153#endif // ifndef ANSIEMU_H