/[pearpc]/src/system/vt100.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /src/system/vt100.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Wed Sep 5 17:11:21 2007 UTC (13 years, 3 months ago) by dpavlin
File MIME type: text/plain
File size: 2368 byte(s)
import upstream CVS
1 /*
2 * HT Editor
3 * vt100.h - VT100/102 emulator
4 *
5 * Copyright (C) 2003 Stefan Weyergraf
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 version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #ifndef __VT100_H__
22 #define __VT100_H__
23
24 #include "system/display.h"
25
26 typedef int vcp;
27
28 #define VCP(vc_fg, vc_bg) (vcp)((vc_bg) | ((vc_fg)<<8))
29 #define VCP_BACKGROUND(v) ((v) & 0xff)
30 #define VCP_FOREGROUND(v) ((v>>8) & 0xff)
31
32 enum VT100state { PLAIN, ESC, CSI, CSI_QM, OSC };
33
34 class VT100Display: public Object {
35 protected:
36 int x,y,w,h;
37 int cursorx, cursory;
38
39 VT100state mState;
40 vcp mColor;
41 vcp mDefaultColor;
42 bool mColorLight; // extra light info (just for setGraphicRendition)
43 int mG;
44 bool mDECCKM; // cursor keys send ^[Ox/^[[x
45 bool mDECAWM; // auto-wrap mode
46 bool mDECOM; // origion relative/absolute
47 bool mLNM; // automatic newline (enter = crlf/lf)
48 bool mIM;
49 int mTop;
50 int mBottom;
51 char mTermWriteBuf[32768];
52 int mTermWriteBufLen;
53 int mSaved_cursorx, mSaved_cursory;
54
55 SystemDisplay *mDisplay;
56
57 /* new */
58 void doLF();
59 void doCR();
60 void doBS();
61 void doRI();
62 void gotoXY(int ncx, int ncy);
63 void gotoAbsXY(int ncx, int ncy);
64 void saveCursor();
65 void restoreCursor();
66 void scrollDown(int mTop, int mBottom, int count);
67 void scrollUp(int mTop, int mBottom, int count);
68 void setGraphicRendition(int r);
69 void setMode(int p, bool newValue);
70 void setPrivateMode(int p, bool newValue);
71 void termifyColor(int &mColor);
72 void getCursor(int &x, int &y);
73 public:
74 VT100Display(int width, int height, SystemDisplay *aDisplay, vcp initColor = VCP(VC_WHITE, VC_BLACK));
75 /* extends BufferedRDisplay */
76 virtual void setBounds(int width, int height);
77 /* new */
78 void termWrite(const void *buf, int buflen);
79 void setAutoNewLine(bool b);
80 };
81
82 void vcpToAnsi(char *buf32, vcp color);
83
84 #endif /* __VT100_H__ */

  ViewVC Help
Powered by ViewVC 1.1.26