chiark / gitweb /
*** empty log message ***
[sympathy.git] / src / vt102.h
1 /*
2  * vt102.h:
3  *
4  * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
5  * All rights reserved.
6  *
7  */
8
9 /*
10  * $Id$
11  */
12
13 /*
14  * $Log$
15  * Revision 1.19  2008/02/26 23:23:17  james
16  * *** empty log message ***
17  *
18  * Revision 1.18  2008/02/26 19:08:27  james
19  * *** empty log message ***
20  *
21  * Revision 1.17  2008/02/26 16:53:24  james
22  * *** empty log message ***
23  *
24  * Revision 1.16  2008/02/24 12:22:42  james
25  * *** empty log message ***
26  *
27  * Revision 1.15  2008/02/24 00:42:53  james
28  * *** empty log message ***
29  *
30  * Revision 1.14  2008/02/23 11:48:37  james
31  * *** empty log message ***
32  *
33  * Revision 1.13  2008/02/22 17:07:00  james
34  * *** empty log message ***
35  *
36  * Revision 1.12  2008/02/22 14:51:54  james
37  * *** empty log message ***
38  *
39  * Revision 1.11  2008/02/08 15:06:42  james
40  * *** empty log message ***
41  *
42  * Revision 1.10  2008/02/07 12:16:04  james
43  * *** empty log message ***
44  *
45  * Revision 1.9  2008/02/07 01:57:46  james
46  * *** empty log message ***
47  *
48  * Revision 1.8  2008/02/07 00:39:13  james
49  * *** empty log message ***
50  *
51  * Revision 1.7  2008/02/06 20:26:58  james
52  * *** empty log message ***
53  *
54  * Revision 1.6  2008/02/06 17:53:28  james
55  * *** empty log message ***
56  *
57  * Revision 1.5  2008/02/06 15:53:22  james
58  * *** empty log message ***
59  *
60  * Revision 1.4  2008/02/06 11:30:37  james
61  * *** empty log message ***
62  *
63  * Revision 1.3  2008/02/04 20:23:55  james
64  * *** empty log message ***
65  *
66  * Revision 1.2  2008/02/04 02:05:06  james
67  * *** empty log message ***
68  *
69  * Revision 1.1  2008/02/03 23:36:41  james
70  * *** empty log message ***
71  *
72  */
73
74 #ifndef __VT102_H__
75 #define __VT102_H__
76
77 #define VT102_CMD_LEN 128
78
79 #define VT102_ROWS              24
80 #define VT102_COLS_132          132
81 #define VT102_COLS_80           80
82 #define VT102_MAX_COLS          VT102_COLS_132
83 #define VT102_STATUS_ROW        24
84
85 #define VT102_NMODES            32
86
87
88 typedef struct
89 {
90   int in_escape;
91   int in_cmd;
92   
93   int cmd_ptr;
94   int cmd_more_bytes;
95   int cmd_termination;
96   char cmd_buf[VT102_CMD_LEN];
97 } VT102_parser;
98
99 typedef struct
100 {
101   CRT_Pos pos;
102   int attr;
103   int color;
104   int origin_mode;
105 } VT102_State;
106
107
108 typedef struct
109 {
110   CRT_Pos top_margin, bottom_margin;
111   CRT_Pos screen_start, screen_end;
112   VT102_parser parser;
113   int attr;
114   int color;
115   CRT crt;
116
117   int pending_wrap;
118   CRT_Pos pos, current_line;
119
120   VT102_State saved;
121
122   uint8_t modes[VT102_NMODES];
123   uint8_t private_modes[VT102_NMODES];
124
125   uint8_t tabs[VT102_COLS_132];
126
127   int application_keypad_mode;
128
129   int last_reg_char;
130   int xn_glitch;
131
132   int current_width;
133
134   int g[2];
135   int cs;
136
137 } VT102;
138
139 #define VT102_PRIVATE_MODE_CURSOR_MODE          1
140 #define VT102_PRIVATE_MODE_VT52                 2
141 #define VT102_PRIVATE_MODE_132COLS              3
142 #define VT102_PRIVATE_MODE_SMOOTH_SCROLL        4
143 #define VT102_PRIVATE_MODE_REVERSE_SCREEN       5
144 #define VT102_PRIVATE_MODE_ORIGIN_MODE          6
145 #define VT102_PRIVATE_MODE_AUTO_WRAP            7
146 #define VT102_PRIVATE_MODE_AUTO_REPEAT          8
147 #define VT102_PRIVATE_MODE_SHOW_CURSOR          25
148
149 #define VT102_MODE_KEYBOARD_DISABLE             2
150 #define VT102_MODE_INSERT                       4
151 #define VT102_MODE_LOCAL_ECHO_OFF               12
152 #define VT102_MODE_NEWLINE_MODE                 20
153
154 #endif /* __VT102_H__ */