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