00001 /* -------------------------------------------------------------------------- */ 00002 /* */ 00003 /* [TEmuVt102.h] X Terminal Emulation */ 00004 /* */ 00005 /* -------------------------------------------------------------------------- */ 00006 /* */ 00007 /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 00008 /* */ 00009 /* This file is part of Konsole - an X terminal for KDE */ 00010 /* */ 00011 /* -------------------------------------------------------------------------- */ 00012 /* */ 00013 /* Ported Konsole to Qt/Embedded */ 00014 /* */ 00015 /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 00016 /* */ 00017 /* -------------------------------------------------------------------------- */ 00018 00019 #ifndef VT102EMU_H 00020 #define VT102EMU_H 00021 00022 #include "TEWidget.h" 00023 #include "TEScreen.h" 00024 #include "TEmulation.h" 00025 #include <qtimer.h> 00026 #include <stdio.h> 00027 00028 // 00029 00030 #define MODE_AppScreen (MODES_SCREEN+0) 00031 #define MODE_AppCuKeys (MODES_SCREEN+1) 00032 #define MODE_AppKeyPad (MODES_SCREEN+2) 00033 #define MODE_Mouse1000 (MODES_SCREEN+3) 00034 #define MODE_Ansi (MODES_SCREEN+4) 00035 #define MODE_total (MODES_SCREEN+5) 00036 00037 struct DECpar 00038 { 00039 BOOL mode[MODE_total]; 00040 }; 00041 00042 struct CharCodes 00043 { 00044 // coding info 00045 char charset[4]; // 00046 int cu_cs; // actual charset. 00047 bool graphic; // Some VT100 tricks 00048 bool pound ; // Some VT100 tricks 00049 bool sa_graphic; // saved graphic 00050 bool sa_pound; // saved pound 00051 }; 00052 00053 class TEmuVt102 : public TEmulation 00054 { Q_OBJECT 00055 00056 public: 00057 00058 TEmuVt102(TEWidget* gui); 00059 ~TEmuVt102(); 00060 00061 public slots: // signals incoming from TEWidget 00062 00063 void onKeyPress(QKeyEvent*); 00064 void onMouse(int cb, int cx, int cy); 00065 00066 signals: 00067 00068 void changeTitle(int,const QString&); 00069 void prevSession(); 00070 void nextSession(); 00071 00072 public: 00073 00074 void reset(); 00075 00076 void onRcvChar(int cc); 00077 void sendString(const char *); 00078 00079 public: 00080 00081 BOOL getMode (int m); 00082 00083 void setMode (int m); 00084 void resetMode (int m); 00085 void saveMode (int m); 00086 void restoreMode(int m); 00087 void resetModes(); 00088 00089 void setConnect(bool r); 00090 00091 private: 00092 00093 void resetToken(); 00094 #define MAXPBUF 80 00095 void pushToToken(int cc); 00096 int pbuf[MAXPBUF]; //FIXME: overflow? 00097 int ppos; 00098 #define MAXARGS 15 00099 void addDigit(int dig); 00100 void addArgument(); 00101 int argv[MAXARGS]; 00102 int argc; 00103 void initTokenizer(); 00104 int tbl[256]; 00105 00106 void scan_buffer_report(); //FIXME: rename 00107 void ReportErrorToken(); //FIXME: rename 00108 00109 void tau(int code, int p, int q); 00110 void XtermHack(); 00111 00112 // 00113 00114 void reportTerminalType(); 00115 void reportStatus(); 00116 void reportAnswerBack(); 00117 void reportCursorPosition(); 00118 void reportTerminalParms(int p); 00119 00120 protected: 00121 00122 unsigned short applyCharset(unsigned short c); 00123 void setCharset(int n, int cs); 00124 void useCharset(int n); 00125 void setAndUseCharset(int n, int cs); 00126 void saveCursor(); 00127 void restoreCursor(); 00128 void resetCharset(int scrno); 00129 CharCodes charset[2]; 00130 00131 DECpar currParm; 00132 DECpar saveParm; 00133 }; 00134 00135 #endif // ifndef ANSIEMU_H
1.4.2