1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _CURSES_H
28 #define _CURSES_H
29
30 /*
31 * curses.h
32 *
33 * XCurses Library
34 *
35 * Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved.
36 *
37 */
38
39 #include <sys/isa_defs.h>
40 #include <stdio.h>
41 #include <term.h>
42 #include <wchar.h>
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 #define _XOPEN_CURSES
49
50 #ifndef EOF
51 #define EOF (-1)
52 #endif
53
54 #ifndef WEOF
55 #define WEOF ((wint_t)(-1))
56 #endif
57
58 #define ERR EOF
59 #define OK 0
60
61 #if !(defined(__cplusplus) && defined(bool))
62 #ifndef _BOOL_DEFINED
63 typedef short bool;
64 #define _BOOL_DEFINED
65 #endif
66 #endif
67
68 #define TRUE 1
69 #define FALSE 0
70
71 typedef unsigned short attr_t;
72
73 /*
74 * These attributes and masks can be applied to an attr_t.
75 * These are ordered according to the <no_color_video> mask,
76 * which has been extended to include additional attributes.
77 */
78 #define WA_NORMAL 0x0
79 #define WA_STANDOUT 0x0001
80 #define WA_UNDERLINE 0x0002
81 #define WA_REVERSE 0x0004
82 #define WA_BLINK 0x0008
83 #define WA_DIM 0x0010
84 #define WA_BOLD 0x0020
85 #define WA_INVIS 0x0040
86 #define WA_PROTECT 0x0080
87 #define WA_ALTCHARSET 0x0100
88 #define WA_HORIZONTAL 0x0200
89 #define WA_LEFT 0x0400
90 #define WA_LOW 0x0800
91 #define WA_RIGHT 0x1000
92 #define WA_TOP 0x2000
93 #define WA_VERTICAL 0x4000
94
95 #define WA_SGR_MASK 0x01ff /* Historical attribute set. */
96 #define WA_SGR1_MASK 0x7e00 /* Extended attribute set. */
97
98 /*
99 * Internal attribute used to support <ceol_standout_glitch>.
100 */
101 #define WA_COOKIE 0x8000
102
103 /*
104 * Color names.
105 */
106 #define COLOR_BLACK 0
107 #define COLOR_RED 1
108 #define COLOR_GREEN 2
109 #define COLOR_YELLOW 3
110 #define COLOR_BLUE 4
111 #define COLOR_MAGENTA 5
112 #define COLOR_CYAN 6
113 #define COLOR_WHITE 7
114
115 /*
116 * A cchar_t details the attributes, color, and a string of wide characters
117 * composing a complex character (p12). The wide character string consists
118 * of a spacing character (wcwidth() > 0) and zero or more non-spacing
119 * characters. Xcurses (p17) states that the minimum number of non-spacing
120 * characters associated with a spacing character must be at least 5, if a
121 * limit is imposed.
122 */
123 #define _M_CCHAR_MAX 6
124
125 /*
126 * Opaque data type.
127 */
128 typedef struct {
129 short _f; /* True if start of character. */
130 short _n; /* Number of elements in wc[]. */
131 short _co; /* Color pair number. */
132 attr_t _at; /* Attribute flags. */
133 wchar_t _wc[_M_CCHAR_MAX]; /* Complex spacing character. */
134 } cchar_t;
135
136 /*
137 * Opaque data type.
138 */
139 typedef struct window_t {
140 cchar_t _bg; /* Background. */
141 cchar_t _fg; /* Foreground, ignore character. */
142 short _cury, _curx; /* Curent cursor position in window. */
143 short _begy, _begx; /* Upper-left origin on screen. */
144 short _maxy, _maxx; /* Window dimensions. */
145 short _top, _bottom; /* Window's software scroll region. */
146 short _refy, _refx; /* Pad origin of last refresh. */
147 short _sminy, _sminx; /* T-L screen corner of last refresh. */
148 short _smaxy, _smaxx; /* B-R screen corner of last refresh. */
149 short _vmin, _vtime; /* wtimeout() control. */
150 short *_first, *_last; /* Dirty region for each screen line. */
151 unsigned short _flags; /* Internal flags for the window. */
152 unsigned short _scroll; /* Internal for scroll optimization. */
153 cchar_t **_line;
154 cchar_t *_base; /* Block of M*N screen cells. */
155 struct window_t *_parent; /* Parent of sub-window. */
156 } WINDOW;
157
158 /*
159 * Opaque data type.
160 */
161 typedef struct {
162 int _kfd; /* typeahead() file descriptor. */
163 FILE *_if, *_of; /* I/O file pointers. */
164 TERMINAL *_term; /* Associated terminfo entry. */
165 WINDOW *_newscr; /* New screen image built by wnoutrefresh(). */
166 WINDOW *_curscr; /* Current screen image after doupdate(). */
167 mbstate_t _state; /* Current multibyte state of _of. */
168 #if defined(_LP64)
169 unsigned int *_hash; /* Hash values for curscr's screen lines. */
170 #else
171 unsigned long *_hash; /* Hash values for curscr's screen lines. */
172 #endif /* defined(_LP64) */
173 unsigned short _flags; /* Assorted flags. */
174 void *_decode; /* Function key decode tree. */
175 void *_in; /* Wide I/O object. */
176 struct {
177 int _size; /* Allocated size of the input stack. */
178 int _count; /* Number of entries on the input stack. */
179 int *_stack; /* Buffer used for the input stack. */
180 } _unget;
181 struct {
182 WINDOW *_w; /* Exists on if emulating soft label keys. */
183 char *_labels[8]; /* Soft label key strings. */
184 short _justify[8]; /* Justification for label. */
185 char *_saved[8]; /* exact representation of label */
186 } _slk;
187 } SCREEN;
188
189
190 /*
191 * Backwards compatiblity with historical Curses applications.
192 */
193 #ifndef _CHTYPE
194 #define _CHTYPE
195 #if defined(_LP64)
196 typedef unsigned int chtype;
197 #else
198 typedef unsigned long chtype;
199 #endif
200 #endif
201
202 /*
203 * These attributes and masks can be applied to a chtype.
204 * They are order according to the <no_color_video> mask.
205 */
206 #if defined(_LP64)
207 #define A_NORMAL 0x00000000U
208 #define A_ATTRIBUTES 0xffff0000U /* Color/Attribute mask */
209 #define A_CHARTEXT 0x0000ffffU /* 16-bit character mask */
210 #define A_STANDOUT 0x00010000U
211 #define A_UNDERLINE 0x00020000U
212 #define A_REVERSE 0x00040000U
213 #define A_BLINK 0x00080000U
214 #define A_DIM 0x00100000U
215 #define A_BOLD 0x00200000U
216 #define A_INVIS 0x00400000U
217 #define A_PROTECT 0x00800000U
218 #define A_ALTCHARSET 0x01000000U
219 #define A_COLOR 0xfe000000U /* Color mask */
220 #else /* defined(_LP64) */
221 #define A_NORMAL 0x00000000UL
222 #define A_ATTRIBUTES 0xffff0000UL /* Color/Attribute mask */
223 #define A_CHARTEXT 0x0000ffffUL /* 16-bit character mask */
224 #define A_STANDOUT 0x00010000UL
225 #define A_UNDERLINE 0x00020000UL
226 #define A_REVERSE 0x00040000UL
227 #define A_BLINK 0x00080000UL
228 #define A_DIM 0x00100000UL
229 #define A_BOLD 0x00200000UL
230 #define A_INVIS 0x00400000UL
231 #define A_PROTECT 0x00800000UL
232 #define A_ALTCHARSET 0x01000000UL
233 #define A_COLOR 0xfe000000UL /* Color mask */
234 #endif /* defined(_LP64) */
235
236 /*
237 * Color atttribute support for chtype.
238 */
239 #define __COLOR_SHIFT 26
240
241 /*
242 * Characters constants used with a chtype.
243 * Mapping defined in Xcurses Section 6.2.12 (p260).
244 */
245 #define ACS_VLINE (A_ALTCHARSET | 'x')
246 #define ACS_HLINE (A_ALTCHARSET | 'q')
247 #define ACS_ULCORNER (A_ALTCHARSET | 'l')
248 #define ACS_URCORNER (A_ALTCHARSET | 'k')
249 #define ACS_LLCORNER (A_ALTCHARSET | 'm')
250 #define ACS_LRCORNER (A_ALTCHARSET | 'j')
251 #define ACS_RTEE (A_ALTCHARSET | 'u')
252 #define ACS_LTEE (A_ALTCHARSET | 't')
253 #define ACS_BTEE (A_ALTCHARSET | 'v')
254 #define ACS_TTEE (A_ALTCHARSET | 'w')
255 #define ACS_PLUS (A_ALTCHARSET | 'n')
256 #define ACS_S1 (A_ALTCHARSET | 'o')
257 #define ACS_S9 (A_ALTCHARSET | 's')
258 #define ACS_DIAMOND (A_ALTCHARSET | '`')
259 #define ACS_CKBOARD (A_ALTCHARSET | 'a')
260 #define ACS_DEGREE (A_ALTCHARSET | 'f')
261 #define ACS_PLMINUS (A_ALTCHARSET | 'g')
262 #define ACS_BULLET (A_ALTCHARSET | '~')
263 #define ACS_LARROW (A_ALTCHARSET | ',')
264 #define ACS_RARROW (A_ALTCHARSET | '+')
265 #define ACS_DARROW (A_ALTCHARSET | '.')
266 #define ACS_UARROW (A_ALTCHARSET | '-')
267 #define ACS_BOARD (A_ALTCHARSET | 'h')
268 #define ACS_LANTERN (A_ALTCHARSET | 'i')
269 #define ACS_BLOCK (A_ALTCHARSET | '0')
270
271 /*
272 * Wide characters constants for a cchar_t.
273 */
274 extern const cchar_t __WACS_VLINE;
275 extern const cchar_t __WACS_HLINE;
276 extern const cchar_t __WACS_ULCORNER;
277 extern const cchar_t __WACS_URCORNER;
278 extern const cchar_t __WACS_LLCORNER;
279 extern const cchar_t __WACS_LRCORNER;
280 extern const cchar_t __WACS_RTEE;
281 extern const cchar_t __WACS_LTEE;
282 extern const cchar_t __WACS_BTEE;
283 extern const cchar_t __WACS_TTEE;
284 extern const cchar_t __WACS_PLUS;
285 extern const cchar_t __WACS_S1;
286 extern const cchar_t __WACS_S9;
287 extern const cchar_t __WACS_DIAMOND;
288 extern const cchar_t __WACS_CKBOARD;
289 extern const cchar_t __WACS_DEGREE;
290 extern const cchar_t __WACS_PLMINUS;
291 extern const cchar_t __WACS_BULLET;
292 extern const cchar_t __WACS_LARROW;
293 extern const cchar_t __WACS_RARROW;
294 extern const cchar_t __WACS_DARROW;
295 extern const cchar_t __WACS_UARROW;
296 extern const cchar_t __WACS_BOARD;
297 extern const cchar_t __WACS_LANTERN;
298 extern const cchar_t __WACS_BLOCK;
299
300 #define WACS_VLINE &__WACS_VLINE
301 #define WACS_HLINE &__WACS_HLINE
302 #define WACS_ULCORNER &__WACS_ULCORNER
303 #define WACS_URCORNER &__WACS_URCORNER
304 #define WACS_LLCORNER &__WACS_LLCORNER
305 #define WACS_LRCORNER &__WACS_LRCORNER
306 #define WACS_RTEE &__WACS_RTEE
307 #define WACS_LTEE &__WACS_LTEE
308 #define WACS_BTEE &__WACS_BTEE
309 #define WACS_TTEE &__WACS_TTEE
310 #define WACS_PLUS &__WACS_PLUS
311 #define WACS_S1 &__WACS_S1
312 #define WACS_S9 &__WACS_S9
313 #define WACS_DIAMOND &__WACS_DIAMOND
314 #define WACS_CKBOARD &__WACS_CKBOARD
315 #define WACS_DEGREE &__WACS_DEGREE
316 #define WACS_PLMINUS &__WACS_PLMINUS
317 #define WACS_BULLET &__WACS_BULLET
318 #define WACS_LARROW &__WACS_LARROW
319 #define WACS_RARROW &__WACS_RARROW
320 #define WACS_DARROW &__WACS_DARROW
321 #define WACS_UARROW &__WACS_UARROW
322 #define WACS_BOARD &__WACS_BOARD
323 #define WACS_LANTERN &__WACS_LANTERN
324 #define WACS_BLOCK &__WACS_BLOCK
325
326
327 /*
328 * Internal macros.
329 */
330 #define __m_getpary(w) ((w)->_parent == (WINDOW *) 0 ? -1 \
331 : (w)->_begy - (w)->_parent->_begy)
332 #define __m_getparx(w) ((w)->_parent == (WINDOW *) 0 ? -1 \
333 : (w)->_begx - (w)->_parent->_begx)
334
335 /*
336 * Global Window Macros
337 */
338 #define getyx(w, y, x) (y = (w)->_cury, x = (w)->_curx)
339 #define getbegyx(w, y, x) (y = (w)->_begy, x = (w)->_begx)
340 #define getmaxyx(w, y, x) (y = (w)->_maxy, x = (w)->_maxx)
341 #define getparyx(w, y, x) (y = __m_getpary(w), x = __m_getparx(w))
342
343 /*
344 * Global variables
345 */
346 extern int LINES, COLS;
347 extern WINDOW *curscr, *stdscr;
348 extern int COLORS, COLOR_PAIRS;
349
350 extern int addch(chtype);
351 extern int addchnstr(const chtype *, int);
352 extern int addchstr(const chtype *);
353 extern int addnstr(const char *, int);
354 extern int addnwstr(const wchar_t *, int);
355 extern int addstr(const char *);
356 extern int add_wch(const cchar_t *);
357 extern int add_wchnstr(const cchar_t *, int);
358 extern int add_wchstr(const cchar_t *);
359 extern int addwstr(const wchar_t *);
360 extern int attroff(int);
361 extern int attron(int);
362 extern int attrset(int);
363 extern int attr_get(attr_t *, short *, void *);
364 extern int attr_off(attr_t, void *);
365 extern int attr_on(attr_t, void *);
366 extern int attr_set(attr_t, short, void *);
367 extern int baudrate(void);
368 extern int beep(void);
369 extern int bkgd(chtype);
370 extern void bkgdset(chtype);
371 extern int bkgrnd(const cchar_t *);
372 extern void bkgrndset(const cchar_t *);
373 extern int border(
374 chtype, chtype, chtype, chtype,
375 chtype, chtype, chtype, chtype);
376 extern int border_set(
377 const cchar_t *, const cchar_t *,
378 const cchar_t *, const cchar_t *,
379 const cchar_t *, const cchar_t *,
380 const cchar_t *, const cchar_t *);
381 extern int box(WINDOW *, chtype, chtype);
382 extern int box_set(WINDOW *, const cchar_t *, const cchar_t *);
383 extern bool can_change_color(void);
384 extern int cbreak(void);
385 extern int chgat(int, attr_t, short, const void *);
386 extern int clearok(WINDOW *, bool);
387 extern int clear(void);
388 extern int clrtobot(void);
389 extern int clrtoeol(void);
390 extern int color_content(short, short *, short *, short *);
391 extern int COLOR_PAIR(int);
392 extern int color_set(short, void *);
393 extern int copywin(const WINDOW *, WINDOW *,
394 int, int, int, int, int, int, int);
395 extern int curs_set(int);
396 extern int def_prog_mode(void);
397 extern int def_shell_mode(void);
398 extern int delay_output(int);
399 extern int delch(void);
400 extern int deleteln(void);
401 extern void delscreen(SCREEN *);
402 extern int delwin(WINDOW *);
403 extern WINDOW *derwin(WINDOW *, int, int, int, int);
404 extern int doupdate(void);
405 extern WINDOW *dupwin(WINDOW *);
406 extern int echo(void);
407 extern int echochar(const chtype);
408 extern int echo_wchar(const cchar_t *);
409 extern int endwin(void);
410 extern char erasechar(void);
411 extern int erase(void);
412 extern int erasewchar(wchar_t *);
413 extern void filter(void);
414 extern int flash(void);
415 extern int flushinp(void);
416 extern chtype getbkgd(WINDOW *);
417 extern int getbkgrnd(cchar_t *);
418 extern int getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *);
419 extern int getch(void);
420 extern int getnstr(char *, int);
421 extern int getn_wstr(wint_t *, int);
422 extern int getstr(char *);
423 extern int get_wch(wint_t *);
424 extern WINDOW *getwin(FILE *);
425 extern int get_wstr(wint_t *);
426 extern int halfdelay(int);
427 extern bool has_colors(void);
428 extern bool has_ic(void);
429 extern bool has_il(void);
430 extern int hline(chtype, int);
431 extern int hline_set(const cchar_t *, int);
432 extern void idcok(WINDOW *, bool);
433 extern int idlok(WINDOW *, bool);
434 extern void immedok(WINDOW *, bool);
435 extern chtype inch(void);
436 extern int inchnstr(chtype *, int);
437 extern int inchstr(chtype *);
438 extern WINDOW *initscr(void);
439 extern int init_color(short, short, short, short);
440 extern int init_pair(short, short, short);
441 extern int innstr(char *, int);
442 extern int innwstr(wchar_t *, int);
443 extern int insch(chtype);
444 extern int insdelln(int);
445 extern int insertln(void);
446 extern int insnstr(const char *, int);
447 extern int ins_nwstr(const wchar_t *, int);
448 extern int insstr(const char *);
449 extern int instr(char *);
450 extern int ins_wch(const cchar_t *);
451 extern int ins_wstr(const wchar_t *);
452 extern int intrflush(WINDOW *, bool);
453 extern int in_wch(cchar_t *);
454 extern int in_wchnstr(cchar_t *, int);
455 extern int in_wchstr(cchar_t *);
456 extern int inwstr(wchar_t *);
457 extern bool isendwin(void);
458 extern bool is_linetouched(WINDOW *, int);
459 extern bool is_wintouched(WINDOW *);
460 extern char *keyname(int);
461 extern char *key_name(wchar_t);
462 extern int keypad(WINDOW *, bool);
463 extern char killchar(void);
464 extern int killwchar(wchar_t *);
465 extern int leaveok(WINDOW *, bool);
466 extern char *longname(void);
467 extern int meta(WINDOW *, bool);
468 extern int move(int, int);
469 extern int mvaddch(int, int, chtype);
470 extern int mvaddchnstr(int, int, const chtype *, int);
471 extern int mvaddchstr(int, int, const chtype *);
472 extern int mvaddnstr(int, int, const char *, int);
473 extern int mvaddnwstr(int, int, const wchar_t *, int);
474 extern int mvaddstr(int, int, const char *);
475 extern int mvadd_wch(int, int, const cchar_t *);
476 extern int mvadd_wchnstr(int, int, const cchar_t *, int);
477 extern int mvadd_wchstr(int, int, const cchar_t *);
478 extern int mvaddwstr(int, int, const wchar_t *);
479 extern int mvchgat(int, int, int, attr_t, short, const void *);
480 extern int mvcur(int, int, int, int);
481 extern int mvdelch(int, int);
482 extern int mvderwin(WINDOW *, int, int);
483 extern int mvgetch(int, int);
484 extern int mvgetnstr(int, int, char *, int);
485 extern int mvgetn_wstr(int, int, wint_t *, int);
486 extern int mvgetstr(int, int, char *);
487 extern int mvget_wch(int, int, wint_t *);
488 extern int mvget_wstr(int, int, wint_t *);
489 extern int mvhline(int, int, chtype, int);
490 extern int mvhline_set(int, int, const cchar_t *, int);
491 extern chtype mvinch(int, int);
492 extern int mvinchnstr(int, int, chtype *, int);
493 extern int mvinchstr(int, int, chtype *);
494 extern int mvinnstr(int, int, char *, int);
495 extern int mvinnwstr(int, int, wchar_t *, int);
496 extern int mvinsch(int, int, chtype);
497 extern int mvinsnstr(int, int, const char *, int);
498 extern int mvins_nwstr(int, int, const wchar_t *, int);
499 extern int mvinsstr(int, int, const char *);
500 extern int mvinstr(int, int, char *);
501 extern int mvins_wch(int, int, const cchar_t *);
502 extern int mvins_wstr(int, int, const wchar_t *);
503 extern int mvin_wch(int, int, cchar_t *);
504 extern int mvin_wchnstr(int, int, cchar_t *, int);
505 extern int mvin_wchstr(int, int, cchar_t *);
506 extern int mvinwstr(int, int, wchar_t *);
507 extern int mvprintw(int, int, char *, ...);
508 extern int mvscanw(int, int, char *, ...);
509 extern int mvvline(int, int, chtype, int);
510 extern int mvvline_set(int, int, const cchar_t *, int);
511 extern int mvwaddch(WINDOW *, int, int, chtype);
512 extern int mvwaddchnstr(WINDOW *, int, int, const chtype *, int);
513 extern int mvwaddchstr(WINDOW *, int, int, const chtype *);
514 extern int mvwaddnstr(WINDOW *, int, int, const char *, int);
515 extern int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);
516 extern int mvwaddstr(WINDOW *, int, int, const char *);
517 extern int mvwadd_wch(WINDOW *, int, int, const cchar_t *);
518 extern int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int);
519 extern int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *);
520 extern int mvwaddwstr(WINDOW *, int, int, const wchar_t *);
521 extern int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);
522 extern int mvwdelch(WINDOW *, int, int);
523 extern int mvwgetch(WINDOW *, int, int);
524 extern int mvwgetnstr(WINDOW *, int, int, char *, int);
525 extern int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int);
526 extern int mvwgetstr(WINDOW *, int, int, char *);
527 extern int mvwget_wch(WINDOW *, int, int, wint_t *);
528 extern int mvwget_wstr(WINDOW *, int, int, wint_t *);
529 extern int mvwhline(WINDOW *, int, int, chtype, int);
530 extern int mvwhline_set(WINDOW *, int, int, const cchar_t *, int);
531 extern int mvwin(WINDOW *, int, int);
532 extern chtype mvwinch(WINDOW *, int, int);
533 extern int mvwinchnstr(WINDOW *, int, int, chtype *, int);
534 extern int mvwinchstr(WINDOW *, int, int, chtype *);
535 extern int mvwinnstr(WINDOW *, int, int, char *, int);
536 extern int mvwinnwstr(WINDOW *, int, int, wchar_t *, int);
537 extern int mvwinsch(WINDOW *, int, int, chtype);
538 extern int mvwinsnstr(WINDOW *, int, int, const char *, int);
539 extern int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int);
540 extern int mvwinsstr(WINDOW *, int, int, const char *);
541 extern int mvwinstr(WINDOW *, int, int, char *);
542 extern int mvwins_wch(WINDOW *, int, int, const cchar_t *);
543 extern int mvwins_wstr(WINDOW *, int, int, const wchar_t *);
544 extern int mvwin_wch(WINDOW *, int, int, cchar_t *);
545 extern int mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int);
546 extern int mvwin_wchstr(WINDOW *, int, int, cchar_t *);
547 extern int mvwinwstr(WINDOW *, int, int, wchar_t *);
548 extern int mvwprintw(WINDOW *, int, int, char *, ...);
549 extern int mvwscanw(WINDOW *, int, int, char *, ...);
550 extern int mvwvline(WINDOW *, int, int, chtype, int);
551 extern int mvwvline_set(WINDOW *, int, int, const cchar_t *, int);
552 extern int napms(int);
553 extern WINDOW *newpad(int, int);
554 extern SCREEN *newterm(char *, FILE *, FILE *);
555 extern WINDOW *newwin(int, int, int, int);
556 extern int nl(void);
557 extern int nocbreak(void);
558 extern int nodelay(WINDOW *, bool);
559 extern int noecho(void);
560 extern int nonl(void);
561 extern void noqiflush(void);
562 extern int noraw(void);
563 extern int notimeout(WINDOW *, bool);
564 extern int overlay(const WINDOW *, WINDOW *);
565 extern int overwrite(const WINDOW *, WINDOW *);
566 extern int pair_content(short, short *, short *);
567 extern int PAIR_NUMBER(int);
568 extern int pechochar(WINDOW *, chtype);
569 extern int pecho_wchar(WINDOW *, const cchar_t *);
570 extern int pnoutrefresh(WINDOW *, int, int, int, int, int, int);
571 extern int prefresh(WINDOW *, int, int, int, int, int, int);
572 extern int printw(char *, ...);
573 extern int putwin(WINDOW *, FILE *);
574 extern void qiflush(void);
575 extern int raw(void);
576 extern int redrawwin(WINDOW *);
577 extern int refresh(void);
578 extern int reset_prog_mode(void);
579 extern int reset_shell_mode(void);
580 extern int resetty(void);
581 extern int ripoffline(int, int (*)(WINDOW *, int));
582 extern int savetty(void);
583 extern int scanw(char *, ...);
584 extern int scr_dump(const char *);
585 extern int scr_init(const char *);
586 extern int scrl(int);
587 extern int scroll(WINDOW *);
588 extern int scrollok(WINDOW *, bool);
589 extern int scr_restore(const char *);
590 extern int scr_set(const char *);
591 extern int setcchar(cchar_t *, const wchar_t *, const attr_t,
592 short, const void *);
593 extern int setscrreg(int, int);
594 extern SCREEN *set_term(SCREEN *);
595 extern int slk_attr_off(const attr_t, void *);
596 extern int slk_attroff(const chtype);
597 extern int slk_attr_on(const attr_t, void *);
598 extern int slk_attron(const chtype);
599 extern int slk_attr_set(const attr_t, short, void *);
600 extern int slk_attrset(const chtype);
601 extern int slk_clear(void);
602 extern int slk_color(short);
603 extern int slk_init(int);
604 extern char *slk_label(int);
605 extern int slk_noutrefresh(void);
606 extern int slk_refresh(void);
607 extern int slk_restore(void);
608 extern int slk_set(int, const char *, int);
609 extern int slk_touch(void);
610 extern int slk_wset(int, const wchar_t *, int);
611 extern int standend(void);
612 extern int standout(void);
613 extern int start_color(void);
614 extern WINDOW *subpad(WINDOW *, int, int, int, int);
615 extern WINDOW *subwin(WINDOW *, int, int, int, int);
616 extern int syncok(WINDOW *, bool);
617 extern chtype termattrs(void);
618 extern attr_t term_attrs(void);
619 extern char *termname(void);
620 extern void timeout(int);
621 extern int touchline(WINDOW *, int, int);
622 extern int touchwin(WINDOW *);
623 extern int typeahead(int);
624 extern int ungetch(int);
625 extern int unget_wch(const wchar_t);
626 extern int untouchwin(WINDOW *);
627 extern void use_env(bool);
628 extern int vid_attr(attr_t, short, void *);
629 extern int vidattr(chtype);
630 extern int vid_puts(attr_t, short, void *, int (*)(int));
631 extern int vidputs(chtype, int (*)(int));
632 extern int vline(chtype, int);
633 extern int vline_set(const cchar_t *, int);
634 extern int vwprintw(WINDOW *, char *, __va_list);
635 extern int vw_printw(WINDOW *, char *, __va_list);
636 extern int vwscanw(WINDOW *, char *, __va_list);
637 extern int vw_scanw(WINDOW *, char *, __va_list);
638 extern int waddch(WINDOW *, const chtype);
639 extern int waddchnstr(WINDOW *, const chtype *, int);
640 extern int waddchstr(WINDOW *, const chtype *);
641 extern int waddnstr(WINDOW *, const char *, int);
642 extern int waddnwstr(WINDOW *, const wchar_t *, int);
643 extern int waddstr(WINDOW *, const char *);
644 extern int wadd_wch(WINDOW *, const cchar_t *);
645 extern int wadd_wchnstr(WINDOW *, const cchar_t *, int);
646 extern int wadd_wchstr(WINDOW *, const cchar_t *);
647 extern int waddwstr(WINDOW *, const wchar_t *);
648 extern int wattroff(WINDOW *, int);
649 extern int wattron(WINDOW *, int);
650 extern int wattrset(WINDOW *, int);
651 extern int wattr_get(WINDOW *, attr_t *, short *, void *);
652 extern int wattr_off(WINDOW *, attr_t, void *);
653 extern int wattr_on(WINDOW *, attr_t, void *);
654 extern int wattr_set(WINDOW *, attr_t, short, void *);
655 extern int wbkgd(WINDOW *, chtype);
656 extern void wbkgdset(WINDOW *, chtype);
657 extern int wbkgrnd(WINDOW *, const cchar_t *);
658 extern void wbkgrndset(WINDOW *, const cchar_t *);
659 extern int wborder(WINDOW *,
660 chtype, chtype, chtype, chtype,
661 chtype, chtype, chtype, chtype);
662 extern int wborder_set(WINDOW *,
663 const cchar_t *, const cchar_t *,
664 const cchar_t *, const cchar_t *,
665 const cchar_t *, const cchar_t *,
666 const cchar_t *, const cchar_t *);
667 extern int wchgat(WINDOW *, int, attr_t, short, const void *);
668 extern int wclear(WINDOW *);
669 extern int wclrtobot(WINDOW *);
670 extern int wclrtoeol(WINDOW *);
671 extern void wcursyncup(WINDOW *);
672 extern int wcolor_set(WINDOW *, short, void *);
673 extern int wdelch(WINDOW *);
674 extern int wdeleteln(WINDOW *);
675 extern int wechochar(WINDOW *, const chtype);
676 extern int wecho_wchar(WINDOW *, const cchar_t *);
677 extern int werase(WINDOW *);
678 extern int wgetbkgrnd(WINDOW *, cchar_t *);
679 extern int wgetch(WINDOW *);
680 extern int wgetnstr(WINDOW *, char *, int);
681 extern int wgetn_wstr(WINDOW *, wint_t *, int);
682 extern int wgetstr(WINDOW *, char *);
683 extern int wget_wch(WINDOW *, wint_t *);
684 extern int wget_wstr(WINDOW *, wint_t *);
685 extern int whline(WINDOW *, chtype, int);
686 extern int whline_set(WINDOW *, const cchar_t *, int);
687 extern chtype winch(WINDOW *);
688 extern int winchnstr(WINDOW *, chtype *, int);
689 extern int winchstr(WINDOW *, chtype *);
690 extern int winnstr(WINDOW *, char *, int);
691 extern int winnwstr(WINDOW *, wchar_t *, int);
692 extern int winsch(WINDOW *, chtype);
693 extern int winsdelln(WINDOW *, int);
694 extern int winsertln(WINDOW *);
695 extern int winsnstr(WINDOW *, const char *, int);
696 extern int wins_nwstr(WINDOW *, const wchar_t *, int);
697 extern int winsstr(WINDOW *, const char *);
698 extern int winstr(WINDOW *, char *);
699 extern int wins_wch(WINDOW *, const cchar_t *);
700 extern int wins_wstr(WINDOW *, const wchar_t *);
701 extern int win_wch(WINDOW *, cchar_t *);
702 extern int win_wchnstr(WINDOW *, cchar_t *, int);
703 extern int win_wchstr(WINDOW *, cchar_t *);
704 extern int winwstr(WINDOW *, wchar_t *);
705 extern int wmove(WINDOW *, int, int);
706 extern int wnoutrefresh(WINDOW *);
707 extern int wprintw(WINDOW *, char *, ...);
708 extern int wredrawln(WINDOW *, int, int);
709 extern int wrefresh(WINDOW *);
710 extern int wscanw(WINDOW *, char *, ...);
711 extern int wscrl(WINDOW *, int);
712 extern int wsetscrreg(WINDOW *, int, int);
713 extern int wstandend(WINDOW *);
714 extern int wstandout(WINDOW *);
715 extern void wsyncup(WINDOW *);
716 extern void wsyncdown(WINDOW *);
717 extern void wtimeout(WINDOW *, int);
718 extern int wtouchln(WINDOW *, int, int, int);
719 extern wchar_t *wunctrl(cchar_t *);
720 extern int wvline(WINDOW *, chtype, int);
721 extern int wvline_set(WINDOW *, const cchar_t *, int);
722
723 #if !defined(__lint)
724 /*
725 * These macros can improve speed and size of an application.
726 */
727 extern WINDOW *__w1;
728 extern chtype __cht1;
729 extern chtype __cht2;
730 extern cchar_t *__pcht1;
731 extern cchar_t *__pcht2;
732
733 #define addch(ch) waddch(stdscr, ch)
734 #define mvaddch(y, x, ch) (move(y, x) ? ((ch), ERR) : addch(ch))
735 #define mvwaddch(w, y, x, ch) \
736 (wmove(__w1 = (w), y, x) ? ((ch), ERR) : waddch(__w1, ch))
737
738 #define add_wch(cp) wadd_wch(stdscr, cp)
739 #define mvadd_wch(y, x, cp) (move(y, x) ? ((cp), ERR) : add_wch(cp))
740 #define mvwadd_wch(w, y, x, cp) \
741 (wmove(__w1 = (w), y, x) ? ((cp), ERR) : wadd_wch(__w1, cp))
742
743 #define addchnstr(chs, n) waddchnstr(stdscr, chs, n)
744 #define addchstr(chs) waddchstr(stdscr, chs)
745 #define mvaddchnstr(y, x, chs, n) \
746 (move(y, x) ? ((chs), (n), ERR) : addchnstr(chs, n))
747
748 #define mvaddchstr(y, x, chs) \
749 (move(y, x) ? ((chs), ERR) : addchstr(chs))
750
751 #define mvwaddchnstr(w, y, x, chs, n) \
752 (wmove(__w1 = (w), y, x) ? ((chs), (n), ERR) :\
753 waddchnstr(__w1, chs, n))
754
755 #define mvwaddchstr(w, y, x, chs) \
756 (wmove(__w1 = (w), y, x) ? ((chs), ERR) : waddchstr(__w1, chs))
757
758 #define waddchstr(w, chs) waddchnstr(w, chs, -1)
759
760 #define add_wchnstr(cp, n) wadd_wchnstr(stdscr, cp, n)
761 #define add_wchstr(cp) wadd_wchstr(stdscr, cp)
762 #define mvadd_wchnstr(y, x, cp, n) \
763 (move(y, x) ? ((cp), (n), ERR) : add_wchnstr(cp, n))
764
765 #define mvadd_wchstr(y, x, cp) \
766 (move(y, x) ? ((cp), ERR) : add_wchstr(cp))
767
768 #define mvwadd_wchnstr(w, y, x, cp, n) \
769 (wmove(__w1 = (w), y, x) ? ((cp), (n), ERR) :\
770 wadd_wchnstr(__w1, cp, n))
771
772 #define mvwadd_wchstr(w, y, x, cp) \
773 (wmove(__w1 = (w), y, x) ? ((cp), ERR) :\
774 wadd_wchstr(__w1, cp))
775
776 #define wadd_wchstr(w, cp) wadd_wchnstr(w, cp, -1)
777 #define addnstr(s, n) waddnstr(stdscr, s, n)
778 #define addstr(s) waddstr(stdscr, s)
779 #define mvaddnstr(y, x, s, n) \
780 (move(y, x) ? (s, n, ERR) : addnstr(s, n))
781
782 #define mvaddstr(y, x, s) \
783 (move(y, x) ? (s, ERR) : addstr(s))
784
785 #define mvwaddnstr(w, y, x, s, n) \
786 (wmove(__w1 = (w), y, x) ? (s, n, ERR) : waddnstr(__w1, s, n))
787
788 #define mvwaddstr(w, y, x, s) \
789 (wmove(__w1 = (w), y, x) ? (s, ERR) : waddstr(__w1, s))
790
791 #define waddstr(w, wcs) waddnstr(w, wcs, -1)
792 #define addnwstr(wcs, n) waddnwstr(stdscr, wcs, n)
793 #define addwstr(wcs) waddwstr(stdscr, wcs)
794 #define mvaddnwstr(y, x, wcs, n) \
795 (move(y, x) ? (wcs, n, ERR) : addnwstr(wcs, n))
796
797 #define mvaddwstr(y, x, wcs) \
798 (move(y, x) ? (wcs, ERR) : addwstr(wcs))
799
800 #define mvwaddnwstr(w, y, x, wcs, n) \
801 (wmove(__w1 = (w), y, x) ? (wcs, n, ERR) :\
802 waddnwstr(__w1, wcs, n))
803
804 #define mvwaddwstr(w, y, x, wcs) \
805 (wmove(__w1 = (w), y, x) ? (wcs, ERR) : waddwstr(__w1, wcs))
806
807 #define waddwstr(w, wcs) waddnwstr(w, wcs, -1)
808 #define attr_get(a, c, o) wattr_get(stdscr, a, c, o)
809 #define attr_off(a, o) wattr_off(stdscr, a, o)
810 #define attr_on(a, o) wattr_on(stdscr, a, o)
811 #define attr_set(a, c, o) wattr_set(stdscr, a, c, o)
812
813 #define COLOR_PAIR(n) ((chtype)(n) << __COLOR_SHIFT)
814 #define PAIR_NUMBER(a) (((chtype)(a) & A_COLOR) >> __COLOR_SHIFT)
815
816 #define bkgd(ch) wbkgd(stdscr, ch)
817 #define bkgdset(ch) wbkgdset(stdscr, ch)
818
819 #define bkgrnd(b) wbkgrnd(stdscr, b)
820 #define bkgrndset(b) wbkgrndset(stdscr, b)
821 #define getbkgrnd(b) wgetbkgrnd(stdscr, b)
822 #define wgetbkgrnd(w, b) (*(b) = (w)->_bg, OK)
823
824 #define border(ls, rs, ts, bs, tl, tr, bl, br) \
825 wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
826
827 #define border_set(ls, rs, ts, bs, tl, tr, bl, br) \
828 wborder_set(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
829
830 #define box(w, v, h) \
831 wborder(w, __cht1 = (v), __cht1, __cht2 = (h), __cht2, 0, 0, 0, 0)
832
833 #define box_set(w, v, h) \
834 wborder_set(w, __pcht1 = (v), __pcht1, __pcht2 = (h), __pcht2,\
835 0, 0, 0, 0)
836
837 #define can_change_color() \
838 (2 < max_colors && can_change && initialize_color != NULL)
839
840 #define has_colors() (0 < max_colors)
841
842 #define chgat(n, a, co, p) wchgat(stdscr, n, a, co, p)
843 #define mvchgat(y, x, n, a, co, p) \
844 (move(y, x) ? (n, a, co, p, ERR) : chgat(n, a, co, p))
845
846 #define mvwchgat(w, y, x, n, a, co, p) \
847 (wmove(__w1 = (w), y, x) ? (n, a, co, p, ERR) :\
848 wchgat(__w1, n, a, co, p))
849
850 #define clear() wclear(stdscr)
851 #define clrtobot() wclrtobot(stdscr)
852 #define clrtoeol() wclrtoeol(stdscr)
853 #define erase() werase(stdscr)
854 #define wclear(w) \
855 (clearok(__w1 = (w), 1) ? ERR : werase(__w1))
856
857 #define werase(w) \
858 (wmove(__w1 = (w), 0, 0) ? ERR : wclrtobot(__w1))
859
860 #define delch() wdelch(stdscr)
861 #define mvdelch(y, x) (move(y, x) ? ERR : delch())
862 #define mvwdelch(w, y, x) \
863 (wmove(__w1 = (w), y, x) ? ERR : wdelch(__w1))
864
865 #define deleteln() wdeleteln(stdscr)
866 #define insdelln(n) winsdelln(stdscr, n)
867 #define insertln() winsertln(stdscr)
868 #define wdeleteln(w) winsdelln(w, -1)
869 #define winsertln(w) winsdelln(w, 1)
870 #define refresh() wrefresh(stdscr)
871 #define echochar(ch) wechochar(stdscr, ch)
872 #define echo_wchar(cp) wecho_wchar(stdscr, cp)
873 #define wechochar(w, ch) \
874 (waddch(__w1 = (w), ch) ? (wrefresh(__w1), ERR) :\
875 wrefresh(__w1))
876
877 #define wecho_wchar(w, cp) \
878 (wadd_wch(__w1 = (w), cp) ? (wrefresh(__w1), ERR) :\
879 wrefresh(__w1))
880
881 #define getch() wgetch(stdscr)
882 #define mvgetch(y, x) (move(y, x) ? ERR : getch())
883 #define mvwgetch(w, y, x) \
884 (wmove(__w1 = (w), y, x) ? ERR : wgetch(__w1))
885
886 #define get_wch(wcp) wget_wch(stdscr, wcp)
887 #define mvget_wch(y, x, wcp) \
888 (move(y, x) ? (wcp, ERR) : get_wch(wcp))
889
890 #define mvwget_wch(w, y, x, wcp) \
891 (wmove(__w1 = (w), y, x) ? (wcp, ERR) : wget_wch(__w1, wcp))
892
893 #define getnstr(s, n) wgetnstr(stdscr, s, n)
894 #define getstr(s) wgetstr(stdscr, s)
895 #define mvgetnstr(y, x, s, n) \
896 (move(y, x) ? (s, n, ERR) : getnstr(s, n))
897
898 #define mvgetstr(y, x, s) \
899 (move(y, x) ? (s, ERR) : getstr(s))
900
901 #define mvwgetnstr(w, y, x, s, n) \
902 (wmove(__w1 = (w), y, x) ? (s, n, ERR) : wgetnstr(__w1, s, n))
903
904 #define mvwgetstr(w, y, x, s) \
905 (wmove(__w1 = (w), y, x) ? (s, ERR) : wgetstr(__w1, s))
906
907 #define wgetstr(w, s) wgetnstr(w, s, -1)
908 #define getn_wstr(wcs, n) wgetn_wstr(stdscr, wcs, n)
909 #define get_wstr(wcs) wget_wstr(stdscr, wcs)
910 #define mvgetn_wstr(y, x, wcs, n) \
911 (move(y, x) ? (wcs, n, ERR) : getn_wstr(wcs, n))
912
913 #define mvget_wstr(y, x, wcs) \
914 (move(y, x) ? (wcs, ERR) : get_wstr(wcs))
915
916 #define mvwgetn_wstr(w, y, x, wcs, n) \
917 (wmove(__w1 = (w), y, x) ? (wcs, n, ERR) :\
918 wgetn_wstr(__w1, wcs, n))
919
920 #define mvwget_wstr(w, y, x, wcs) \
921 (wmove(__w1 = (w), y, x) ? (wcs, ERR) : wget_wstr(__w1, wcs))
922
923 #define wget_wstr(w, wcs) wgetn_wstr(w, wcs, -1)
924
925 #define has_ic() \
926 (((insert_character != NULL || parm_ich != NULL) && \
927 (delete_character != NULL || parm_dch != NULL)) || \
928 (enter_insert_mode != NULL && exit_insert_mode))
929
930 #define has_il() \
931 (((insert_line != NULL || parm_insert_line != NULL) && \
932 (delete_line != NULL || parm_delete_line != NULL)) || \
933 change_scroll_region != NULL)
934
935 #define hline(ch, n) whline(stdscr, ch, n)
936 #define vline(ch, n) wvline(stdscr, ch, n)
937 #define mvhline(y, x, ch, n) \
938 (move(y, x) ? (ch, n, ERR) : hline(ch, n))
939
940 #define mvvline(y, x, ch, n) \
941 (move(y, x) ? (ch, n, ERR) : vline(ch, n))
942
943 #define mvwhline(w, y, x, ch, n) \
944 (wmove(__w1 = (w), y, x) ? (ch, n, ERR) : whline(__w1, ch, n))
945
946 #define mvwvline(w, y, x, ch, n) \
947 (wmove(__w1 = (w), y, x) ? (ch, n, ERR) : wvline(__w1, ch, n))
948
949 #define hline_set(cp, n) whline_set(stdscr, cp, n)
950 #define vline_set(cp, n) wvline_set(stdscr, cp, n)
951 #define mvhline_set(y, x, cp, n) \
952 (move(y, x) ? (cp, n, ERR) : hline_set(cp, n))
953
954 #define mvvline_set(y, x, cp, n) \
955 (move(y, x) ? (cp, n, ERR) : vline_set(cp, n))
956
957 #define mvwhline_set(w, y, x, cp, n) \
958 (wmove(__w1 = (w), y, x) ? (cp, n, ERR) : whline_set(__w1, cp, n))
959
960 #define mvwvline_set(w, y, x, cp, n) \
961 (wmove(__w1 = (w), y, x) ? (cp, n, ERR) : wvline_set(__w1, cp, n))
962
963 #define inch() winch(stdscr)
964 #define mvinch(y, x) (move(y, x) ? ERR : inch())
965 #define mvwinch(w, y, x) \
966 (wmove(__w1 = (w), y, x) ? ERR : winch(__w1))
967
968 #define in_wch(cp) win_wch(stdscr, cp)
969 #define mvin_wch(y, x, cp) \
970 (move(y, x) ? (cp, ERR) : in_wch(cp))
971
972 #define mvwin_wch(w, y, x, cp) \
973 (wmove(__w1 = (w), y, x) ? (cp, ERR) : win_wch(__w1, cp))
974
975 #define inchnstr(chs, n) winchnstr(stdscr, chs, n)
976 #define inchstr(chs) winchstr(stdscr, chs)
977 #define mvinchnstr(y, x, chs, n) \
978 (move(y, x) ? (chs, n, ERR) : inchnstr(chs, n))
979
980 #define mvinchstr(y, x, chs) \
981 (move(y, x) ? (chs, ERR) : inchstr(chs))
982
983 #define mvwinchnstr(w, y, x, chs, n) \
984 (wmove(__w1 = (w), y, x) ? (chs, n, ERR) : winchnstr(__w1, chs, n))
985
986 #define mvwinchstr(w, y, x, chs) \
987 (wmove(__w1 = (w), y, x) ? (chs, ERR) : winchstr(__w1, chs))
988
989 #define winchstr(w, chs) winchnstr(w, chs, -1)
990 #define in_wchnstr(cp, n) win_wchnstr(stdscr, cp, n)
991 #define in_wchstr(cp) win_wchstr(stdscr, cp)
992 #define mvin_wchnstr(y, x, cp, n) \
993 (move(y, x) ? (cp, n, ERR) : in_wchnstr(cp, n))
994
995 #define mvin_wchstr(y, x, cp) \
996 (move(y, x) ? (cp, ERR) : in_wchstr(cp))
997
998 #define mvwin_wchnstr(w, y, x, cp, n) \
999 (wmove(__w1 = (w), y, x) ? (cp, n, ERR) :\
1000 win_wchnstr(__w1, cp, n))
1001
1002 #define mvwin_wchstr(w, y, x, cp) \
1003 (wmove(__w1 = (w), y, x) ? (cp, ERR) : win_wchstr(__w1, cp))
1004
1005 #define win_wchstr(w, cp) win_wchnstr(w, cp, -1)
1006 #define innstr(s, n) winnstr(stdscr, s, n)
1007 #define instr(s) winstr(stdscr, s)
1008 #define mvinnstr(y, x, s, n) \
1009 (move(y, x) ? (s, n, ERR) : innstr(s, n))
1010
1011 #define mvinstr(y, x, s) \
1012 (move(y, x) ? (s, ERR) : instr(s))
1013
1014 #define mvwinnstr(w, y, x, s, n) \
1015 (wmove(__w1 = (w), y, x) ? (s, n, ERR) : winnstr(__w1, s, n))
1016
1017 #define mvwinstr(w, y, x, s) \
1018 (wmove(__w1 = (w), y, x) ? (s, ERR) : winstr(__w1, s))
1019
1020 #define winstr(w, s) (winnstr(w, s, -1), OK)
1021 #define innwstr(wcs, n) winnwstr(stdscr, wcs, n)
1022 #define inwstr(wcs) winwstr(stdscr, wcs)
1023 #define mvinnwstr(y, x, wcs, n) \
1024 (move(y, x) ? (wcs, n, ERR) : innwstr(wcs, n))
1025
1026 #define mvinwstr(y, x, wcs) \
1027 (move(y, x) ? (wcs, ERR) : inwstr(wcs))
1028
1029 #define mvwinnwstr(w, y, x, wcs, n) \
1030 (wmove(__w1 = (w), y, x) ? (wcs, n, ERR) :\
1031 winnwstr(__w1, wcs, n))
1032
1033 #define mvwinwstr(w, y, x, wcs) \
1034 (wmove(__w1 = (w), y, x) ? (wcs, ERR) : winwstr(__w1, wcs))
1035
1036 #define winwstr(w, wcs) (winnwstr(w, wcs, -1), OK)
1037 #define insch(ch) winsch(stdscr, ch)
1038 #define mvinsch(y, x, ch) (move(y, x) ? (ch, ERR) : insch(ch))
1039 #define mvwinsch(w, y, x, ch) \
1040 (wmove(__w1 = (w), y, x) ? (ch, ERR) : winsch(__w1, ch))
1041
1042 #define ins_wch(cp) wins_wch(stdscr, cp)
1043 #define mvins_wch(y, x, cp) (move(y, x) ? (cp, ERR) : ins_wch(cp))
1044 #define mvwins_wch(w, y, x, cp) \
1045 (wmove(__w1 = (w), y, x) ? (cp, ERR) : wins_wch(__w1, cp))
1046
1047 #define insnstr(s, n) winsnstr(stdscr, s, n)
1048 #define insstr(s) winsstr(stdscr, s)
1049 #define mvinsnstr(y, x, s, n) (move(y, x) ? (s, n, ERR) : insnstr(s, n))
1050 #define mvinsstr(y, x, s) (move(y, x) ? (s, ERR) : insstr(s))
1051 #define mvwinsnstr(w, y, x, s, n) \
1052 (wmove(__w1 = (w), y, x) ? (s, n, ERR) : winsnstr(__w1, s, n))
1053
1054 #define mvwinsstr(w, y, x, s) \
1055 (wmove(__w1 = (w), y, x) ? (s, ERR) : winsstr(__w1, s))
1056
1057 #define winsstr(w, s) winsnstr(w, s, -1)
1058 #define ins_nwstr(wcs, n) wins_nwstr(stdscr, wcs, n)
1059 #define ins_wstr(wcs) wins_wstr(stdscr, wcs)
1060 #define mvins_nwstr(y, x, wcs, n) \
1061 (move(y, x) ? (wcs, n, ERR) : ins_nwstr(wcs, n))
1062
1063 #define mvins_wstr(y, x, wcs) (move(y, x) ? (wcs, ERR) : ins_wstr(wcs))
1064 #define mvwins_nwstr(w, y, x, wcs, n) \
1065 (wmove(__w1 = (w), y, x) ? (wcs, n, ERR) : wins_nwstr(__w1, wcs, n))
1066
1067 #define mvwins_wstr(w, y, x, wcs) \
1068 (wmove(__w1 = (w), y, x) ? (wcs, ERR) : wins_wstr(__w1, wcs))
1069
1070 #define wins_wstr(w, wcs) wins_nwstr(w, wcs, -1)
1071 #define is_linetouched(w, y) (0 <= (w)->_last[y])
1072 #define move(y, x) wmove(stdscr, y, x)
1073 #define subpad(par, ny, nx, by, bx) subwin(par, ny, nx, by, bx)
1074 #define nodelay(w, bf) (wtimeout(w, (bf) ? 0: -1), OK)
1075 #define timeout(n) wtimeout(stdscr, n)
1076 #define qiflush() ((void) intrflush(NULL, 1))
1077 #define noqiflush() ((void) intrflush(NULL, 0))
1078 #define redrawwin(w) wredrawln(__w1 = (w), 0, (__w1)->_maxy)
1079 #define scrl(n) wscrl(stdscr, n)
1080 #define setscrreg(t, b) wsetscrreg(stdscr, t, b)
1081 #define standend() wstandend(stdscr)
1082 #define standout() wstandout(stdscr)
1083 #define touchline(w, y, n) wtouchln(w, y, n, 1)
1084 #define touchwin(w) wtouchln(__w1 = (w), 0, __w1->_maxy, 1)
1085 #define untouchwin(w) wtouchln(__w1 = (w), 0, __w1->_maxy, 0)
1086 #define termname() (cur_term->_term)
1087
1088 #endif /* !defined(__lint) */
1089
1090 /*
1091 * Special Keys
1092 *
1093 * Keypad layout
1094 * A1 up A3
1095 * left B2 right
1096 * C1 down C3
1097 *
1098 * Chossing negative values for KEY_ constants means that they can
1099 * be safely returned in either an int or long type.
1100 */
1101 #define __KEY_BASE (-2)
1102 #define __KEY_MAX __KEY_BASE
1103
1104 #define KEY_CODE_YES (__KEY_BASE-1) /* Special indicator. */
1105 #define KEY_BREAK (__KEY_BASE-2) /* Break key (unreliable) */
1106 #define KEY_DOWN (__KEY_BASE-3) /* The four arrow keys ... */
1107 #define KEY_UP (__KEY_BASE-4)
1108 #define KEY_LEFT (__KEY_BASE-5)
1109 #define KEY_RIGHT (__KEY_BASE-6)
1110 #define KEY_HOME (__KEY_BASE-7) /* Move to upper-left corner. */
1111 #define KEY_BACKSPACE (__KEY_BASE-8) /* Backspace */
1112 #define KEY_F0 (__KEY_BASE-9) /* Function keys. Space for */
1113 #define KEY_F(n) (KEY_F0-(n)) /* 64 keys is reserved. */
1114 #define KEY_DL (__KEY_BASE-73) /* Delete line */
1115 #define KEY_IL (__KEY_BASE-74) /* Insert line */
1116 #define KEY_DC (__KEY_BASE-75) /* Delete character */
1117 #define KEY_IC (__KEY_BASE-76) /* Ins char / enter ins mode */
1118 #define KEY_EIC (__KEY_BASE-77) /* Exit insert char mode */
1119 #define KEY_CLEAR (__KEY_BASE-78) /* Clear screen */
1120 #define KEY_EOS (__KEY_BASE-79) /* Clear to end of screen */
1121 #define KEY_EOL (__KEY_BASE-80) /* Clear to end of line */
1122 #define KEY_SF (__KEY_BASE-81) /* Scroll 1 line forward */
1123 #define KEY_SR (__KEY_BASE-82) /* Scroll 1 line backwards */
1124 #define KEY_NPAGE (__KEY_BASE-83) /* Next page */
1125 #define KEY_PPAGE (__KEY_BASE-84) /* Previous page */
1126 #define KEY_STAB (__KEY_BASE-85) /* Set tab */
1127 #define KEY_CTAB (__KEY_BASE-86) /* Clear tab */
1128 #define KEY_CATAB (__KEY_BASE-87) /* Clear all tabs */
1129 #define KEY_ENTER (__KEY_BASE-88) /* Enter or send */
1130 #define KEY_SRESET (__KEY_BASE-89) /* Soft (partial) reset */
1131 #define KEY_RESET (__KEY_BASE-90) /* Hard reset */
1132 #define KEY_PRINT (__KEY_BASE-91) /* Print or copy */
1133 #define KEY_LL (__KEY_BASE-92) /* Move to lower left corner. */
1134 #define KEY_A1 (__KEY_BASE-93) /* Upper left of keypad */
1135 #define KEY_A3 (__KEY_BASE-94) /* Upper rght of keypad */
1136 #define KEY_B2 (__KEY_BASE-95) /* Center of keypad */
1137 #define KEY_C1 (__KEY_BASE-96) /* Lower left of keypad */
1138 #define KEY_C3 (__KEY_BASE-97) /* Lower right of keypad */
1139 #define KEY_BTAB (__KEY_BASE-98) /* Back Tab */
1140 #define KEY_BEG (__KEY_BASE-99) /* Beginning */
1141 #define KEY_CANCEL (__KEY_BASE-100)
1142 #define KEY_CLOSE (__KEY_BASE-101)
1143 #define KEY_COMMAND (__KEY_BASE-102)
1144 #define KEY_COPY (__KEY_BASE-103)
1145 #define KEY_CREATE (__KEY_BASE-104)
1146 #define KEY_END (__KEY_BASE-105)
1147 #define KEY_EXIT (__KEY_BASE-106)
1148 #define KEY_FIND (__KEY_BASE-107)
1149 #define KEY_HELP (__KEY_BASE-108)
1150 #define KEY_MARK (__KEY_BASE-109)
1151 #define KEY_MESSAGE (__KEY_BASE-110)
1152 #define KEY_MOUSE (__KEY_BASE-111) /* Mouse event occured */
1153 #define KEY_MOVE (__KEY_BASE-112)
1154 #define KEY_NEXT (__KEY_BASE-113) /* Next object */
1155 #define KEY_OPEN (__KEY_BASE-114)
1156 #define KEY_OPTIONS (__KEY_BASE-115)
1157 #define KEY_PREVIOUS (__KEY_BASE-116) /* Previous object */
1158 #define KEY_REDO (__KEY_BASE-117)
1159 #define KEY_REFERENCE (__KEY_BASE-118)
1160 #define KEY_REFRESH (__KEY_BASE-119)
1161 #define KEY_REPLACE (__KEY_BASE-120)
1162 #define KEY_RESTART (__KEY_BASE-121)
1163 #define KEY_RESUME (__KEY_BASE-122)
1164 #define KEY_SAVE (__KEY_BASE-123)
1165 #define KEY_SBEG (__KEY_BASE-124) /* Shifted keys */
1166 #define KEY_SCANCEL (__KEY_BASE-125)
1167 #define KEY_SCOMMAND (__KEY_BASE-126)
1168 #define KEY_SCOPY (__KEY_BASE-127)
1169 #define KEY_SCREATE (__KEY_BASE-128)
1170 #define KEY_SDC (__KEY_BASE-129)
1171 #define KEY_SDL (__KEY_BASE-130)
1172 #define KEY_SELECT (__KEY_BASE-131) /* Select */
1173 #define KEY_SEND (__KEY_BASE-132) /* Shifted end key */
1174 #define KEY_SEOL (__KEY_BASE-133)
1175 #define KEY_SEXIT (__KEY_BASE-134)
1176 #define KEY_SFIND (__KEY_BASE-135)
1177 #define KEY_SHELP (__KEY_BASE-136)
1178 #define KEY_SHOME (__KEY_BASE-137)
1179 #define KEY_SIC (__KEY_BASE-138)
1180 #define KEY_SLEFT (__KEY_BASE-139)
1181 #define KEY_SMESSAGE (__KEY_BASE-140)
1182 #define KEY_SMOVE (__KEY_BASE-141)
1183 #define KEY_SNEXT (__KEY_BASE-142)
1184 #define KEY_SOPTIONS (__KEY_BASE-143)
1185 #define KEY_SPREVIOUS (__KEY_BASE-144)
1186 #define KEY_SPRINT (__KEY_BASE-145)
1187 #define KEY_SREDO (__KEY_BASE-146)
1188 #define KEY_SREPLACE (__KEY_BASE-147)
1189 #define KEY_SRIGHT (__KEY_BASE-148)
1190 #define KEY_SRSUME (__KEY_BASE-149)
1191 #define KEY_SSAVE (__KEY_BASE-150)
1192 #define KEY_SSUSPEND (__KEY_BASE-151)
1193 #define KEY_SUNDO (__KEY_BASE-152)
1194 #define KEY_SUSPEND (__KEY_BASE-153)
1195 #define KEY_UNDO (__KEY_BASE-154)
1196
1197 #define __KEY_MIN (__KEY_BASE-155)
1198
1199 #ifdef __cplusplus
1200 }
1201 #endif
1202
1203 #endif /* _CURSES_H */