1
2
3
4
5 #ifndef WINDOW
6
7 # include <stdio.h>
8
9 # include "unctrl.h"
10 # include "termio.h"
11 typedef struct termio SGTTY;
12
13 # define bool char
14 # define reg register
15
16
17
18
19
20 # ifdef CHTYPE
21 typedef CHTYPE chtype;
22 # else
23 typedef unsigned short chtype;
24 # endif CHTYPE
25
26 # define TRUE (1)
27 # define FALSE (0)
28 # define ERR (-1)
29 # define OK (0)
30
31 # define _SUBWIN 01
32 # define _ENDLINE 02
33 # define _FULLWIN 04
34 # define _SCROLLWIN 010
35 # define _FLUSH 020
36 # define _ISPAD 040
37 # define _STANDOUT 0200
38 # define _NOCHANGE -1
39
40 struct _win_st {
41 short _cury, _curx;
42 short _maxy, _maxx;
43 short _begy, _begx;
44 short _flags;
45 chtype _attrs;
46 bool _clear;
47 bool _leave;
48 bool _scroll;
49 bool _use_idl;
50 bool _use_keypad;
51 bool _use_meta;
52 bool _nodelay;
53 chtype **_y;
54 short *_firstch;
55 short *_lastch;
56 short _tmarg,_bmarg;
57 };
58
59 extern int LINES, COLS;
60
61 typedef struct _win_st WINDOW;
62 extern WINDOW *stdscr, *curscr;
63
64 extern char *Def_term, ttytype[];
65
66 typedef struct screen SCREEN;
67
68 # ifndef NOMACROS
69 # ifndef MINICURSES
70
71
72
73 # define addch(ch) waddch(stdscr, ch)
74 # define getch() wgetch(stdscr)
75 # define addstr(str) waddstr(stdscr, str)
76 # define getstr(str) wgetstr(stdscr, str)
77 # define move(y, x) wmove(stdscr, y, x)
78 # define clear() wclear(stdscr)
79 # define erase() werase(stdscr)
80 # define clrtobot() wclrtobot(stdscr)
81 # define clrtoeol() wclrtoeol(stdscr)
82 # define insertln() winsertln(stdscr)
83 # define deleteln() wdeleteln(stdscr)
84 # define refresh() wrefresh(stdscr)
85 # define inch() winch(stdscr)
86 # define insch(c) winsch(stdscr,c)
87 # define delch() wdelch(stdscr)
88 # define standout() wstandout(stdscr)
89 # define standend() wstandend(stdscr)
90 # define attron(at) wattron(stdscr,at)
91 # define attroff(at) wattroff(stdscr,at)
92 # define attrset(at) wattrset(stdscr,at)
93
94 # define setscrreg(t,b) wsetscrreg(stdscr, t, b)
95 # define wsetscrreg(win,t,b) (win->_tmarg=(t),win->_bmarg=(b))
96
97
98
99
100 #define mvwaddch(win,y,x,ch) (wmove(win,y,x)==ERR?ERR:waddch(win,ch))
101 #define mvwgetch(win,y,x) (wmove(win,y,x)==ERR?ERR:wgetch(win))
102 #define mvwaddstr(win,y,x,str) (wmove(win,y,x)==ERR?ERR:waddstr(win,str))
103 #define mvwgetstr(win,y,x,str) (wmove(win,y,x)==ERR?ERR:wgetstr(win,str))
104 #define mvwinch(win,y,x) (wmove(win,y,x)==ERR?ERR:winch(win))
105 #define mvwdelch(win,y,x) (wmove(win,y,x)==ERR?ERR:wdelch(win))
106 #define mvwinsch(win,y,x,c) (wmove(win,y,x)==ERR?ERR:winsch(win,c))
107 #define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)
108 #define mvgetch(y,x) mvwgetch(stdscr,y,x)
109 #define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str)
110 #define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str)
111 #define mvinch(y,x) mvwinch(stdscr,y,x)
112 #define mvdelch(y,x) mvwdelch(stdscr,y,x)
113 #define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c)
114
115 # else MINICURSES
116
117 # define addch(ch) m_addch(ch)
118 # define addstr(str) m_addstr(str)
119 # define move(y, x) m_move(y, x)
120 # define clear() m_clear()
121 # define erase() m_erase()
122 # define refresh() m_refresh()
123 # define standout() wstandout(stdscr)
124 # define standend() wstandend(stdscr)
125 # define attron(at) wattron(stdscr,at)
126 # define attroff(at) wattroff(stdscr,at)
127 # define attrset(at) wattrset(stdscr,at)
128 # define mvaddch(y,x,ch) move(y, x), addch(ch)
129 # define mvaddstr(y,x,str) move(y, x), addstr(str)
130 # define initscr m_initscr
131 # define newterm m_newterm
132
133
134
135
136
137 #define getch m_getch
138 #define getstr m_getstr
139 #define clrtobot m_clrtobot
140 #define clrtoeol m_clrtoeol
141 #define insertln m_insertln
142 #define deleteln m_deleteln
143 #define inch m_inch
144 #define insch m_insch
145 #define delch m_delch
146
147 #define mvwaddch m_mvwaddch
148 #define mvwgetch m_mvwgetch
149 #define mvwaddstr m_mvaddstr
150 #define mvwgetstr m_mvwgetstr
151 #define mvwinch m_mvwinch
152 #define mvwdelch m_mvwdelch
153 #define mvwinsch m_mvwinsch
154 #define mvgetch m_mvwgetch
155 #define mvgetstr m_mvwgetstr
156 #define mvinch m_mvwinch
157 #define mvdelch m_mvwdelch
158 #define mvinsch m_mvwinsch
159
160 #define box m_box
161 #define delwin m_delwin
162 #define longname m_longname
163 #define makenew m_makenew
164 #define mvprintw m_mvprintw
165 #define mvscanw m_mvscanw
166 #define mvwin m_mvwin
167 #define mvwprintw m_mvwprintw
168 #define mvwscanw m_mvwscanw
169 #define newwin m_newwin
170 #define _outchar m_outchar
171 #define overlay m_overlay
172 #define overwrite m_overwrite
173 #define printw m_printw
174 #define putp m_putp
175 #define scanw m_scanw
176 #define scroll m_scroll
177 #define subwin m_subwin
178 #define touchwin m_touchwin
179 #define _tscroll m_tscroll
180 #define _tstp m_tstp
181 #define vidattr m_vidattr
182 #define waddch m_waddch
183 #define waddstr m_waddstr
184 #define wclear m_wclear
185 #define wclrtobot m_wclrtobot
186 #define wclrtoeol m_wclrtoeol
187 #define wdelch m_wdelch
188 #define wdeleteln m_wdeleteln
189 #define werase m_werase
190 #define wgetch m_wgetch
191 #define wgetstr m_wgetstr
192 #define winsch m_winsch
193 #define winsertln m_winsertln
194 #define wmove m_wmove
195 #define wprintw m_wprintw
196 #define wrefresh m_wrefresh
197 #define wscanw m_wscanw
198 #define setscrreg m_setscrreg
199 #define wsetscrreg m_wsetscrreg
200
201 # endif MINICURSES
202
203
204
205
206
207 #define getyx(win,y,x) y = win->_cury, x = win->_curx
208 #define winch(win) (win->_y[win->_cury][win->_curx])
209
210 WINDOW *initscr(), *newwin(), *subwin(), *newpad();
211 char *longname();
212 char erasechar(), killchar();
213 int wgetch();
214 SCREEN *newterm();
215
216
217 #define A_STANDOUT 0000200
218 #define A_UNDERLINE 0000400
219 #define A_REVERSE 0001000
220 #define A_BLINK 0002000
221 #define A_DIM 0004000
222 #define A_BOLD 0010000
223
224
225 #define A_INVIS 0020000
226 #define A_PROTECT 0040000
227 #define A_ALTCHARSET 0100000
228
229 #define A_NORMAL 0000000
230 #define A_ATTRIBUTES 0377600
231 #define A_CHARTEXT 0000177
232
233
234 #define KEY_BREAK 0401
235 #define KEY_DOWN 0402
236 #define KEY_UP 0403
237 #define KEY_LEFT 0404
238 #define KEY_RIGHT 0405
239 #define KEY_HOME 0406
240 #define KEY_BACKSPACE 0407
241 #define KEY_F0 0410
242 #define KEY_F(n) (KEY_F0+(n))
243 #define KEY_DL 0510
244 #define KEY_IL 0511
245 #define KEY_DC 0512
246 #define KEY_IC 0513
247 #define KEY_EIC 0514
248 #define KEY_CLEAR 0515
249 #define KEY_EOS 0516
250 #define KEY_EOL 0517
251 #define KEY_SF 0520
252 #define KEY_SR 0521
253 #define KEY_NPAGE 0522
254 #define KEY_PPAGE 0523
255 #define KEY_STAB 0524
256 #define KEY_CTAB 0525
257 #define KEY_CATAB 0526
258 #define KEY_ENTER 0527
259 #define KEY_SRESET 0530
260 #define KEY_RESET 0531
261 #define KEY_PRINT 0532
262 #define KEY_LL 0533
263
264
265
266
267 #define KEY_A1 0534
268 #define KEY_A3 0535
269 #define KEY_B2 0536
270 #define KEY_C1 0537
271 #define KEY_C3 0540
272
273 # endif NOMACROS
274 #endif WINDOW
275
276
277