Diffstat (limited to 'noncore/apps/opie-console/TEmuVt102.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/TEmuVt102.h | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/TEmuVt102.h b/noncore/apps/opie-console/TEmuVt102.h new file mode 100644 index 0000000..a448a71 --- a/dev/null +++ b/noncore/apps/opie-console/TEmuVt102.h | |||
@@ -0,0 +1,135 @@ | |||
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 | |||
19 | #ifndef VT102EMU_H | ||
20 | #define VT102EMU_H | ||
21 | |||
22 | #include "TEWidget.h" | ||
23 | #include "TEScreen.h" | ||
24 | #include "TEmulation.h" | ||
25 | #include <qtimer.h> | ||
26 | #include <stdio.h> | ||
27 | |||
28 | // | ||
29 | |||
30 | #define MODE_AppScreen (MODES_SCREEN+0) | ||
31 | #define MODE_AppCuKeys (MODES_SCREEN+1) | ||
32 | #define MODE_AppKeyPad (MODES_SCREEN+2) | ||
33 | #define MODE_Mouse1000 (MODES_SCREEN+3) | ||
34 | #define MODE_Ansi (MODES_SCREEN+4) | ||
35 | #define MODE_total (MODES_SCREEN+5) | ||
36 | |||
37 | struct DECpar | ||
38 | { | ||
39 | BOOL mode[MODE_total]; | ||
40 | }; | ||
41 | |||
42 | struct CharCodes | ||
43 | { | ||
44 | // coding info | ||
45 | char charset[4]; // | ||
46 | int cu_cs; // actual charset. | ||
47 | bool graphic; // Some VT100 tricks | ||
48 | bool pound ; // Some VT100 tricks | ||
49 | bool sa_graphic; // saved graphic | ||
50 | bool sa_pound; // saved pound | ||
51 | }; | ||
52 | |||
53 | class TEmuVt102 : public TEmulation | ||
54 | { Q_OBJECT | ||
55 | |||
56 | public: | ||
57 | |||
58 | TEmuVt102(TEWidget* gui); | ||
59 | ~TEmuVt102(); | ||
60 | |||
61 | public slots: // signals incoming from TEWidget | ||
62 | |||
63 | void onKeyPress(QKeyEvent*); | ||
64 | void onMouse(int cb, int cx, int cy); | ||
65 | |||
66 | signals: | ||
67 | |||
68 | void changeTitle(int,const QString&); | ||
69 | void prevSession(); | ||
70 | void nextSession(); | ||
71 | |||
72 | public: | ||
73 | |||
74 | void reset(); | ||
75 | |||
76 | void onRcvChar(int cc); | ||
77 | void sendString(const char *); | ||
78 | |||
79 | public: | ||
80 | |||
81 | BOOL getMode (int m); | ||
82 | |||
83 | void setMode (int m); | ||
84 | void resetMode (int m); | ||
85 | void saveMode (int m); | ||
86 | void restoreMode(int m); | ||
87 | void resetModes(); | ||
88 | |||
89 | void setConnect(bool r); | ||
90 | |||
91 | private: | ||
92 | |||
93 | void resetToken(); | ||
94 | #define MAXPBUF 80 | ||
95 | void pushToToken(int cc); | ||
96 | int pbuf[MAXPBUF]; //FIXME: overflow? | ||
97 | int ppos; | ||
98 | #define MAXARGS 15 | ||
99 | void addDigit(int dig); | ||
100 | void addArgument(); | ||
101 | int argv[MAXARGS]; | ||
102 | int argc; | ||
103 | void initTokenizer(); | ||
104 | int tbl[256]; | ||
105 | |||
106 | void scan_buffer_report(); //FIXME: rename | ||
107 | void ReportErrorToken(); //FIXME: rename | ||
108 | |||
109 | void tau(int code, int p, int q); | ||
110 | void XtermHack(); | ||
111 | |||
112 | // | ||
113 | |||
114 | void reportTerminalType(); | ||
115 | void reportStatus(); | ||
116 | void reportAnswerBack(); | ||
117 | void reportCursorPosition(); | ||
118 | void reportTerminalParms(int p); | ||
119 | |||
120 | protected: | ||
121 | |||
122 | unsigned short applyCharset(unsigned short c); | ||
123 | void setCharset(int n, int cs); | ||
124 | void useCharset(int n); | ||
125 | void setAndUseCharset(int n, int cs); | ||
126 | void saveCursor(); | ||
127 | void restoreCursor(); | ||
128 | void resetCharset(int scrno); | ||
129 | CharCodes charset[2]; | ||
130 | |||
131 | DECpar currParm; | ||
132 | DECpar saveParm; | ||
133 | }; | ||
134 | |||
135 | #endif // ifndef ANSIEMU_H | ||