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