xref: /illumos-gate/usr/src/lib/libxcurses/h/curses.h (revision 1da57d55)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*
287c478bd9Sstevel@tonic-gate  * curses.h
297c478bd9Sstevel@tonic-gate  *
307c478bd9Sstevel@tonic-gate  * XCurses Library
317c478bd9Sstevel@tonic-gate  *
327c478bd9Sstevel@tonic-gate  * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved.
337c478bd9Sstevel@tonic-gate  *
347c478bd9Sstevel@tonic-gate  */
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifndef __M_CURSES_H__
377c478bd9Sstevel@tonic-gate #define __M_CURSES_H__
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #define _XOPEN_CURSES
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #include <stdio.h>
427c478bd9Sstevel@tonic-gate #include <term.h>
437c478bd9Sstevel@tonic-gate #include <unctrl.h>
447c478bd9Sstevel@tonic-gate #include <wchar.h>
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #ifndef EOF
477c478bd9Sstevel@tonic-gate #define EOF			(-1)
487c478bd9Sstevel@tonic-gate #endif
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate #ifndef WEOF
517c478bd9Sstevel@tonic-gate #define WEOF			(-1)
527c478bd9Sstevel@tonic-gate #endif
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate /*
557c478bd9Sstevel@tonic-gate  * Not all <wchar.h> are created equal.
567c478bd9Sstevel@tonic-gate  */
577c478bd9Sstevel@tonic-gate #ifndef _MBSTATE_T
587c478bd9Sstevel@tonic-gate #define _MBSTATE_T
597c478bd9Sstevel@tonic-gate typedef int mbstate_t;
607c478bd9Sstevel@tonic-gate #endif
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate #define ERR			EOF
637c478bd9Sstevel@tonic-gate #define OK			0
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate #if !(defined(__cplusplus) && defined(_BOOL))
667c478bd9Sstevel@tonic-gate typedef	short bool;
677c478bd9Sstevel@tonic-gate #endif
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #define TRUE    		1
707c478bd9Sstevel@tonic-gate #define FALSE   		0
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate typedef unsigned short attr_t;
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate /*
75*1da57d55SToomas Soome  * These attributes and masks can be applied to an attr_t.
767c478bd9Sstevel@tonic-gate  * These are ordered according to the <no_color_video> mask,
777c478bd9Sstevel@tonic-gate  * which has been extended to include additional attributes.
787c478bd9Sstevel@tonic-gate  */
797c478bd9Sstevel@tonic-gate #define WA_NORMAL	0x0
807c478bd9Sstevel@tonic-gate #define WA_STANDOUT	0x0001
817c478bd9Sstevel@tonic-gate #define WA_UNDERLINE	0x0002
827c478bd9Sstevel@tonic-gate #define WA_REVERSE	0x0004
837c478bd9Sstevel@tonic-gate #define WA_BLINK	0x0008
847c478bd9Sstevel@tonic-gate #define WA_DIM		0x0010
857c478bd9Sstevel@tonic-gate #define WA_BOLD		0x0020
867c478bd9Sstevel@tonic-gate #define WA_INVIS	0x0040
877c478bd9Sstevel@tonic-gate #define WA_PROTECT	0x0080
887c478bd9Sstevel@tonic-gate #define WA_ALTCHARSET	0x0100
897c478bd9Sstevel@tonic-gate #define WA_HORIZONTAL	0x0200
907c478bd9Sstevel@tonic-gate #define WA_LEFT		0x0400
917c478bd9Sstevel@tonic-gate #define WA_LOW		0x0800
927c478bd9Sstevel@tonic-gate #define WA_RIGHT	0x1000
937c478bd9Sstevel@tonic-gate #define WA_TOP		0x2000
947c478bd9Sstevel@tonic-gate #define WA_VERTICAL	0x4000
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate #define WA_SGR_MASK	0x01ff		/* Historical attribute set. */
977c478bd9Sstevel@tonic-gate #define WA_SGR1_MASK	0x7e00		/* Extended attribute set. */
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate /*
1007c478bd9Sstevel@tonic-gate  * Internal attribute used to support <ceol_standout_glitch>.
1017c478bd9Sstevel@tonic-gate  */
1027c478bd9Sstevel@tonic-gate #define WA_COOKIE	0x8000
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate /*
1057c478bd9Sstevel@tonic-gate  * Color names.
1067c478bd9Sstevel@tonic-gate  */
1077c478bd9Sstevel@tonic-gate #define COLOR_BLACK     0
1087c478bd9Sstevel@tonic-gate #define COLOR_BLUE      1
1097c478bd9Sstevel@tonic-gate #define COLOR_GREEN     2
1107c478bd9Sstevel@tonic-gate #define COLOR_CYAN      3
1117c478bd9Sstevel@tonic-gate #define COLOR_RED       4
1127c478bd9Sstevel@tonic-gate #define COLOR_MAGENTA   5
1137c478bd9Sstevel@tonic-gate #define COLOR_YELLOW    6
1147c478bd9Sstevel@tonic-gate #define COLOR_WHITE     7
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate /*
117*1da57d55SToomas Soome  * A cchar_t details the attributes, color, and a string of wide characters
1187c478bd9Sstevel@tonic-gate  * composing a complex character (p12).  The wide character string consists
119*1da57d55SToomas Soome  * of a spacing character (wcwidth() > 0) and zero or more non-spacing
120*1da57d55SToomas Soome  * characters.  Xcurses (p17) states that the minimum number of non-spacing
121*1da57d55SToomas Soome  * characters associated with a spacing character must be at least 5, if a
1227c478bd9Sstevel@tonic-gate  * limit is imposed.
1237c478bd9Sstevel@tonic-gate  */
1247c478bd9Sstevel@tonic-gate #define M_CCHAR_MAX	6
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate /***
1277c478bd9Sstevel@tonic-gate  *** Opaque data type.  Keep your grubby mits off.
1287c478bd9Sstevel@tonic-gate  ***/
1297c478bd9Sstevel@tonic-gate typedef struct {
130*1da57d55SToomas Soome 	short _f;			/* True if start of character. */
1317c478bd9Sstevel@tonic-gate 	short _n;			/* Number of elements in wc[]. */
1327c478bd9Sstevel@tonic-gate         short _co;			/* Color pair number. */
1337c478bd9Sstevel@tonic-gate         attr_t _at;			/* Attribute flags. */
1347c478bd9Sstevel@tonic-gate         wchar_t _wc[M_CCHAR_MAX];	/* Complex spacing character. */
1357c478bd9Sstevel@tonic-gate } cchar_t;
1367c478bd9Sstevel@tonic-gate 
1377c478bd9Sstevel@tonic-gate /***
1387c478bd9Sstevel@tonic-gate  *** Opaque data type.  Keep your grubby mits off.
1397c478bd9Sstevel@tonic-gate  ***/
1407c478bd9Sstevel@tonic-gate typedef struct window_t {
141*1da57d55SToomas Soome 	cchar_t _bg;			/* Background. */
1427c478bd9Sstevel@tonic-gate 	cchar_t _fg;			/* Foreground, ignore character. */
1437c478bd9Sstevel@tonic-gate 	short _cury, _curx;		/* Curent cursor position in window. */
1447c478bd9Sstevel@tonic-gate 	short _begy, _begx;		/* Upper-left origin on screen. */
1457c478bd9Sstevel@tonic-gate 	short _maxy, _maxx;		/* Window dimensions. */
1467c478bd9Sstevel@tonic-gate 	short _top, _bottom;		/* Window's software scroll region. */
147*1da57d55SToomas Soome 	short _refy, _refx;		/* Pad origin of last refresh. */
1487c478bd9Sstevel@tonic-gate 	short _sminy, _sminx;		/* T-L screen corner of last refresh. */
1497c478bd9Sstevel@tonic-gate 	short _smaxy, _smaxx;		/* B-R screen corner of last refresh. */
1507c478bd9Sstevel@tonic-gate 	short _vmin, _vtime;		/* wtimeout() control. */
1517c478bd9Sstevel@tonic-gate 	short *_first, *_last;		/* Dirty region for each screen line. */
1527c478bd9Sstevel@tonic-gate 	unsigned short _flags;		/* Internal flags for the window. */
1537c478bd9Sstevel@tonic-gate 	unsigned short _scroll;		/* Internal for scroll optimization. */
1547c478bd9Sstevel@tonic-gate 	cchar_t **_line;
1557c478bd9Sstevel@tonic-gate 	cchar_t *_base;			/* Block of M*N screen cells. */
1567c478bd9Sstevel@tonic-gate 	struct window_t *_parent;	/* Parent of sub-window. */
1577c478bd9Sstevel@tonic-gate } WINDOW;
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate /***
1607c478bd9Sstevel@tonic-gate  *** Opaque data type.  Keep your grubby mits off.
1617c478bd9Sstevel@tonic-gate  ***/
1627c478bd9Sstevel@tonic-gate typedef struct {
1637c478bd9Sstevel@tonic-gate 	int _kfd;		/* typeahead() file descriptor. */
1647c478bd9Sstevel@tonic-gate 	FILE *_if, *_of;	/* I/O file pointers. */
1657c478bd9Sstevel@tonic-gate 	TERMINAL *_term;	/* Associated terminfo entry. */
1667c478bd9Sstevel@tonic-gate 	WINDOW *_newscr;	/* New screen image built by wnoutrefresh(). */
1677c478bd9Sstevel@tonic-gate 	WINDOW *_curscr;	/* Current screen image after doupdate(). */
1687c478bd9Sstevel@tonic-gate 	mbstate_t _state;	/* Current multibyte state of _of. */
1697c478bd9Sstevel@tonic-gate 	unsigned long *_hash;	/* Hash values for curscr's screen lines. */
1707c478bd9Sstevel@tonic-gate 	unsigned short _flags;	/* Assorted flags. */
1717c478bd9Sstevel@tonic-gate 	void *_decode;		/* Function key decode tree. */
1727c478bd9Sstevel@tonic-gate 	void *_in;		/* Wide I/O object. */
1737c478bd9Sstevel@tonic-gate 	struct {
1747c478bd9Sstevel@tonic-gate 		int _size;	/* Allocated size of the input stack. */
1757c478bd9Sstevel@tonic-gate 		int _count;	/* Number of entries on the input stack. */
1767c478bd9Sstevel@tonic-gate 		int *_stack;	/* Buffer used for the input stack. */
1777c478bd9Sstevel@tonic-gate 	} _unget;
1787c478bd9Sstevel@tonic-gate 	struct {
1797c478bd9Sstevel@tonic-gate 		WINDOW *_w;	/* Exists on if emulating soft label keys. */
1807c478bd9Sstevel@tonic-gate 		char *_labels[8];	/* Soft label key strings. */
1817c478bd9Sstevel@tonic-gate 		short _justify[8];	/* Justification for label. */
1827c478bd9Sstevel@tonic-gate 	} _slk;
1837c478bd9Sstevel@tonic-gate } SCREEN;
1847c478bd9Sstevel@tonic-gate 
1857c478bd9Sstevel@tonic-gate #ifndef __M_UNCTRL_H__
1867c478bd9Sstevel@tonic-gate /*
1877c478bd9Sstevel@tonic-gate  * Backwards compatiblity with historical Curses applications.
1887c478bd9Sstevel@tonic-gate  */
1897c478bd9Sstevel@tonic-gate typedef unsigned long chtype;
1907c478bd9Sstevel@tonic-gate #endif
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate /*
193*1da57d55SToomas Soome  * These attributes and masks can be applied to a chtype.
1947c478bd9Sstevel@tonic-gate  * They are order according to the <no_color_video> mask.
1957c478bd9Sstevel@tonic-gate  */
1967c478bd9Sstevel@tonic-gate #define A_NORMAL        0x00000000L
1977c478bd9Sstevel@tonic-gate #define A_ATTRIBUTES    0xffff0000L	/* Color/Attribute mask */
1987c478bd9Sstevel@tonic-gate #define A_CHARTEXT      0x0000ffffL     /* 16-bit character mask */
1997c478bd9Sstevel@tonic-gate #define A_COLOR         0xfe000000L     /* Colour mask, see __COLOR_SHIFT */
2007c478bd9Sstevel@tonic-gate #define A_STANDOUT      0x00010000L
2017c478bd9Sstevel@tonic-gate #define A_UNDERLINE     0x00020000L
2027c478bd9Sstevel@tonic-gate #define A_REVERSE       0x00040000L
2037c478bd9Sstevel@tonic-gate #define A_BLINK         0x00080000L
2047c478bd9Sstevel@tonic-gate #define A_DIM           0x00100000L
2057c478bd9Sstevel@tonic-gate #define A_BOLD          0x00200000L
2067c478bd9Sstevel@tonic-gate #define A_INVIS         0x00400000L
2077c478bd9Sstevel@tonic-gate #define A_PROTECT       0x00800000L
2087c478bd9Sstevel@tonic-gate #define A_ALTCHARSET    0x01000000L
2097c478bd9Sstevel@tonic-gate 
2107c478bd9Sstevel@tonic-gate /*
211*1da57d55SToomas Soome  * Colour atttribute support for chtype.
2127c478bd9Sstevel@tonic-gate  */
2137c478bd9Sstevel@tonic-gate #define __COLOR_SHIFT	26
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate /*
2167c478bd9Sstevel@tonic-gate  * Characters constants used with a chtype.
2177c478bd9Sstevel@tonic-gate  * Mapping defined in Xcurses Section 6.2.12 (p260).
2187c478bd9Sstevel@tonic-gate  */
2197c478bd9Sstevel@tonic-gate #define ACS_VLINE       (A_ALTCHARSET | 'x')
2207c478bd9Sstevel@tonic-gate #define ACS_HLINE       (A_ALTCHARSET | 'q')
2217c478bd9Sstevel@tonic-gate #define ACS_ULCORNER    (A_ALTCHARSET | 'l')
2227c478bd9Sstevel@tonic-gate #define ACS_URCORNER    (A_ALTCHARSET | 'k')
2237c478bd9Sstevel@tonic-gate #define ACS_LLCORNER    (A_ALTCHARSET | 'm')
2247c478bd9Sstevel@tonic-gate #define ACS_LRCORNER    (A_ALTCHARSET | 'j')
2257c478bd9Sstevel@tonic-gate #define ACS_RTEE        (A_ALTCHARSET | 'u')
2267c478bd9Sstevel@tonic-gate #define ACS_LTEE        (A_ALTCHARSET | 't')
2277c478bd9Sstevel@tonic-gate #define ACS_BTEE        (A_ALTCHARSET | 'v')
2287c478bd9Sstevel@tonic-gate #define ACS_TTEE        (A_ALTCHARSET | 'w')
2297c478bd9Sstevel@tonic-gate #define ACS_PLUS        (A_ALTCHARSET | 'n')
2307c478bd9Sstevel@tonic-gate #define ACS_S1          (A_ALTCHARSET | 'o')
2317c478bd9Sstevel@tonic-gate #define ACS_S9          (A_ALTCHARSET | 's')
2327c478bd9Sstevel@tonic-gate #define ACS_DIAMOND     (A_ALTCHARSET | '`')
2337c478bd9Sstevel@tonic-gate #define ACS_CKBOARD     (A_ALTCHARSET | 'a')
2347c478bd9Sstevel@tonic-gate #define ACS_DEGREE      (A_ALTCHARSET | 'f')
2357c478bd9Sstevel@tonic-gate #define ACS_PLMINUS     (A_ALTCHARSET | 'g')
2367c478bd9Sstevel@tonic-gate #define ACS_BULLET      (A_ALTCHARSET | '~')
2377c478bd9Sstevel@tonic-gate #define ACS_LARROW      (A_ALTCHARSET | ',')
2387c478bd9Sstevel@tonic-gate #define ACS_RARROW      (A_ALTCHARSET | '+')
2397c478bd9Sstevel@tonic-gate #define ACS_DARROW      (A_ALTCHARSET | '.')
2407c478bd9Sstevel@tonic-gate #define ACS_UARROW      (A_ALTCHARSET | '-')
2417c478bd9Sstevel@tonic-gate #define ACS_BOARD       (A_ALTCHARSET | 'h')
2427c478bd9Sstevel@tonic-gate #define ACS_LANTERN     (A_ALTCHARSET | 'I')
2437c478bd9Sstevel@tonic-gate #define ACS_BLOCK       (A_ALTCHARSET | '0')
244*1da57d55SToomas Soome 
2457c478bd9Sstevel@tonic-gate #ifndef _XOPEN_SOURCE
2467c478bd9Sstevel@tonic-gate /*
2477c478bd9Sstevel@tonic-gate  * MKS Extensions for double width box characters.
2487c478bd9Sstevel@tonic-gate  */
2497c478bd9Sstevel@tonic-gate #define ACS_DVLINE      ACS_VLINE
2507c478bd9Sstevel@tonic-gate #define ACS_DHLINE      ACS_HLINE
2517c478bd9Sstevel@tonic-gate #define ACS_DULCORNER   ACS_ULCORNER
2527c478bd9Sstevel@tonic-gate #define ACS_DURCORNER   ACS_URCORNER
2537c478bd9Sstevel@tonic-gate #define ACS_DLLCORNER   ACS_LLCORNER
2547c478bd9Sstevel@tonic-gate #define ACS_DLRCORNER   ACS_LRCORNER
2557c478bd9Sstevel@tonic-gate #define ACS_DRTEE       ACS_RTEE
2567c478bd9Sstevel@tonic-gate #define ACS_DLTEE       ACS_LTEE
2577c478bd9Sstevel@tonic-gate #define ACS_DBTEE       ACS_BTEE
2587c478bd9Sstevel@tonic-gate #define ACS_DTTEE       ACS_TTEE
2597c478bd9Sstevel@tonic-gate #endif /* _XOPEN_SOURCE */
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate /*
262*1da57d55SToomas Soome  * Wide characters constants for a cchar_t.
2637c478bd9Sstevel@tonic-gate  */
2647c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_VLINE;
2657c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_HLINE;
2667c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_ULCORNER;
2677c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_URCORNER;
2687c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_LLCORNER;
2697c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_LRCORNER;
2707c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_RTEE;
2717c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_LTEE;
2727c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_BTEE;
2737c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_TTEE;
2747c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_PLUS;
2757c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_S1;
2767c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_S9;
2777c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_DIAMOND;
2787c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_CKBOARD;
2797c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_DEGREE;
2807c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_PLMINUS;
2817c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_BULLET;
2827c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_LARROW;
2837c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_RARROW;
2847c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_DARROW;
2857c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_UARROW;
2867c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_BOARD;
2877c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_LANTERN;
2887c478bd9Sstevel@tonic-gate extern const cchar_t __WACS_BLOCK;
2897c478bd9Sstevel@tonic-gate 
2907c478bd9Sstevel@tonic-gate #define WACS_VLINE	&__WACS_VLINE
2917c478bd9Sstevel@tonic-gate #define WACS_HLINE	&__WACS_HLINE
2927c478bd9Sstevel@tonic-gate #define WACS_ULCORNER	&__WACS_ULCORNER
2937c478bd9Sstevel@tonic-gate #define WACS_URCORNER	&__WACS_URCORNER
2947c478bd9Sstevel@tonic-gate #define WACS_LLCORNER	&__WACS_LLCORNER
2957c478bd9Sstevel@tonic-gate #define WACS_LRCORNER	&__WACS_LRCORNER
2967c478bd9Sstevel@tonic-gate #define WACS_RTEE	&__WACS_RTEE
2977c478bd9Sstevel@tonic-gate #define WACS_LTEE	&__WACS_LTEE
2987c478bd9Sstevel@tonic-gate #define WACS_BTEE	&__WACS_BTEE
2997c478bd9Sstevel@tonic-gate #define WACS_TTEE	&__WACS_TTEE
3007c478bd9Sstevel@tonic-gate #define WACS_PLUS	&__WACS_PLUS
3017c478bd9Sstevel@tonic-gate #define WACS_S1		&__WACS_S1
3027c478bd9Sstevel@tonic-gate #define WACS_S9		&__WACS_S9
3037c478bd9Sstevel@tonic-gate #define WACS_DIAMOND	&__WACS_DIAMOND
3047c478bd9Sstevel@tonic-gate #define WACS_CKBOARD	&__WACS_CKBOARD
3057c478bd9Sstevel@tonic-gate #define WACS_DEGREE	&__WACS_DEGREE
3067c478bd9Sstevel@tonic-gate #define WACS_PLMINUS	&__WACS_PLMINUS
3077c478bd9Sstevel@tonic-gate #define WACS_BULLET	&__WACS_BULLET
3087c478bd9Sstevel@tonic-gate #define WACS_LARROW	&__WACS_LARROW
3097c478bd9Sstevel@tonic-gate #define WACS_RARROW	&__WACS_RARROW
3107c478bd9Sstevel@tonic-gate #define WACS_DARROW	&__WACS_DARROW
3117c478bd9Sstevel@tonic-gate #define WACS_UARROW	&__WACS_UARROW
3127c478bd9Sstevel@tonic-gate #define WACS_BOARD	&__WACS_BOARD
3137c478bd9Sstevel@tonic-gate #define WACS_LANTERN	&__WACS_LANTERN
3147c478bd9Sstevel@tonic-gate #define WACS_BLOCK	&__WACS_BLOCK
315*1da57d55SToomas Soome 
3167c478bd9Sstevel@tonic-gate #ifndef _XOPEN_SOURCE
3177c478bd9Sstevel@tonic-gate /*
3187c478bd9Sstevel@tonic-gate  * MKS Extensions for double width box characters.
3197c478bd9Sstevel@tonic-gate  */
3207c478bd9Sstevel@tonic-gate #define WACS_DVLINE      WACS_VLINE
3217c478bd9Sstevel@tonic-gate #define WACS_DHLINE      WACS_HLINE
3227c478bd9Sstevel@tonic-gate #define WACS_DULCORNER   WACS_ULCORNER
3237c478bd9Sstevel@tonic-gate #define WACS_DURCORNER   WACS_URCORNER
3247c478bd9Sstevel@tonic-gate #define WACS_DLLCORNER   WACS_LLCORNER
3257c478bd9Sstevel@tonic-gate #define WACS_DLRCORNER   WACS_LRCORNER
3267c478bd9Sstevel@tonic-gate #define WACS_DRTEE       WACS_RTEE
3277c478bd9Sstevel@tonic-gate #define WACS_DLTEE       WACS_LTEE
3287c478bd9Sstevel@tonic-gate #define WACS_DBTEE       WACS_BTEE
3297c478bd9Sstevel@tonic-gate #define WACS_DTTEE       WACS_TTEE
3307c478bd9Sstevel@tonic-gate #endif /* _XOPEN_SOURCE */
3317c478bd9Sstevel@tonic-gate 
3327c478bd9Sstevel@tonic-gate /*
3337c478bd9Sstevel@tonic-gate  * Internal functions.
3347c478bd9Sstevel@tonic-gate  */
3357c478bd9Sstevel@tonic-gate extern int __m_outc(int);
3367c478bd9Sstevel@tonic-gate extern int __m_tty_wc(int, wchar_t *);
3377c478bd9Sstevel@tonic-gate extern int __m_chtype_cc(chtype, cchar_t *);
3387c478bd9Sstevel@tonic-gate extern chtype __m_cc_chtype(const cchar_t *);
3397c478bd9Sstevel@tonic-gate extern int __m_copywin(const WINDOW *, WINDOW *, int);
3407c478bd9Sstevel@tonic-gate extern WINDOW *__m_newwin(WINDOW *, int, int, int, int);
341*1da57d55SToomas Soome 
3427c478bd9Sstevel@tonic-gate /*
3437c478bd9Sstevel@tonic-gate  * Internal macros.
3447c478bd9Sstevel@tonic-gate  */
3457c478bd9Sstevel@tonic-gate #define __m_getpary(w)		((w)->_parent == (WINDOW *) 0 ? -1 \
3467c478bd9Sstevel@tonic-gate 				: (w)->_begy - (w)->_parent->_begy)
3477c478bd9Sstevel@tonic-gate #define __m_getparx(w)		((w)->_parent == (WINDOW *) 0 ? -1 \
3487c478bd9Sstevel@tonic-gate 				: (w)->_begx - (w)->_parent->_begx)
3497c478bd9Sstevel@tonic-gate 
3507c478bd9Sstevel@tonic-gate /*
3517c478bd9Sstevel@tonic-gate  * Global Window Macros
3527c478bd9Sstevel@tonic-gate  */
3537c478bd9Sstevel@tonic-gate #define getyx(w,y,x)            (y = (w)->_cury, x = (w)->_curx)
3547c478bd9Sstevel@tonic-gate #define getbegyx(w,y,x)         (y = (w)->_begy, x = (w)->_begx)
3557c478bd9Sstevel@tonic-gate #define getmaxyx(w,y,x)         (y = (w)->_maxy, x = (w)->_maxx)
3567c478bd9Sstevel@tonic-gate #define getparyx(w,y,x)         (y = __m_getpary(w), x = __m_getparx(w))
3577c478bd9Sstevel@tonic-gate 
3587c478bd9Sstevel@tonic-gate /*
3597c478bd9Sstevel@tonic-gate  * Global variables
3607c478bd9Sstevel@tonic-gate  */
3617c478bd9Sstevel@tonic-gate extern int LINES, COLS;
3627c478bd9Sstevel@tonic-gate extern int COLORS, COLOR_PAIRS;
3637c478bd9Sstevel@tonic-gate extern WINDOW *curscr, *stdscr;
3647c478bd9Sstevel@tonic-gate 
3657c478bd9Sstevel@tonic-gate #ifndef _XOPEN_SOURCE
3667c478bd9Sstevel@tonic-gate /*
3677c478bd9Sstevel@tonic-gate  * Non-portable extension functions.
3687c478bd9Sstevel@tonic-gate  */
3697c478bd9Sstevel@tonic-gate extern int wistombs(char *, const wint_t *, int);
3707c478bd9Sstevel@tonic-gate extern int wistowcs(wchar_t *, const wint_t *, int);
3717c478bd9Sstevel@tonic-gate #endif /* _XOPEN_SOURCE */
3727c478bd9Sstevel@tonic-gate 
3737c478bd9Sstevel@tonic-gate #ifdef M_CURSES_TRACE
3747c478bd9Sstevel@tonic-gate /*
375*1da57d55SToomas Soome  * Curses trace facility is only available with a version of
376*1da57d55SToomas Soome  * the library that was compiled with -DM_CURSES_TRACE.
3777c478bd9Sstevel@tonic-gate  */
3787c478bd9Sstevel@tonic-gate extern void traceoff(void);
3797c478bd9Sstevel@tonic-gate extern void traceon(void);
3807c478bd9Sstevel@tonic-gate #endif /* M_CURSES_TRACE */
3817c478bd9Sstevel@tonic-gate 
3827c478bd9Sstevel@tonic-gate extern int addch(chtype);
3837c478bd9Sstevel@tonic-gate extern int addchnstr(const chtype *, int);
3847c478bd9Sstevel@tonic-gate extern int addchstr(const chtype *);
3857c478bd9Sstevel@tonic-gate extern int add_wch(const cchar_t *);
3867c478bd9Sstevel@tonic-gate extern int add_wchnstr(const cchar_t *, int);
3877c478bd9Sstevel@tonic-gate extern int add_wchstr(const cchar_t *);
3887c478bd9Sstevel@tonic-gate extern int mvaddch(int, int, chtype);
3897c478bd9Sstevel@tonic-gate extern int mvaddchnstr(int, int, const chtype *, int);
3907c478bd9Sstevel@tonic-gate extern int mvaddchstr(int, int, const chtype *);
3917c478bd9Sstevel@tonic-gate extern int mvadd_wch(int, int, const cchar_t *);
3927c478bd9Sstevel@tonic-gate extern int mvadd_wchnstr(int, int, const cchar_t *, int);
3937c478bd9Sstevel@tonic-gate extern int mvadd_wchstr(int, int, const cchar_t *);
3947c478bd9Sstevel@tonic-gate extern int mvwaddch(WINDOW *, int, int, chtype);
3957c478bd9Sstevel@tonic-gate extern int mvwaddchnstr(WINDOW *, int, int, const chtype *, int);
3967c478bd9Sstevel@tonic-gate extern int mvwaddchstr(WINDOW *, int, int, const chtype *);
3977c478bd9Sstevel@tonic-gate extern int mvwadd_wch(WINDOW *, int, int, const cchar_t *);
3987c478bd9Sstevel@tonic-gate extern int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int);
3997c478bd9Sstevel@tonic-gate extern int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *);
4007c478bd9Sstevel@tonic-gate extern int waddch(WINDOW *, chtype);
4017c478bd9Sstevel@tonic-gate extern int waddchnstr(WINDOW *, const chtype *, int);
4027c478bd9Sstevel@tonic-gate extern int waddchstr(WINDOW *, const chtype *);
4037c478bd9Sstevel@tonic-gate extern int wadd_wch(WINDOW *, const cchar_t *);
4047c478bd9Sstevel@tonic-gate extern int wadd_wchnstr(WINDOW *, const cchar_t *, int);
4057c478bd9Sstevel@tonic-gate extern int wadd_wchstr(WINDOW *, const cchar_t *);
4067c478bd9Sstevel@tonic-gate 
4077c478bd9Sstevel@tonic-gate extern int addnstr(const char *, int);
4087c478bd9Sstevel@tonic-gate extern int addstr(const char *);
4097c478bd9Sstevel@tonic-gate extern int addnwstr(const wchar_t *, int);
4107c478bd9Sstevel@tonic-gate extern int addwstr(const wchar_t *);
4117c478bd9Sstevel@tonic-gate extern int mvaddnstr(int, int, const char *, int);
4127c478bd9Sstevel@tonic-gate extern int mvaddstr(int, int, const char *);
4137c478bd9Sstevel@tonic-gate extern int mvaddnwstr(int, int, const wchar_t *, int);
4147c478bd9Sstevel@tonic-gate extern int mvaddwstr(int, int, const wchar_t *);
4157c478bd9Sstevel@tonic-gate extern int mvwaddnstr(WINDOW *, int, int, const char *, int);
4167c478bd9Sstevel@tonic-gate extern int mvwaddstr(WINDOW *, int, int, const char *);
4177c478bd9Sstevel@tonic-gate extern int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);
4187c478bd9Sstevel@tonic-gate extern int mvwaddwstr(WINDOW *, int, int, const wchar_t *);
4197c478bd9Sstevel@tonic-gate extern int waddnstr(WINDOW *, const char *, int);
4207c478bd9Sstevel@tonic-gate extern int waddstr(WINDOW *, const char *);
4217c478bd9Sstevel@tonic-gate extern int waddnwstr(WINDOW *, const wchar_t *, int);
4227c478bd9Sstevel@tonic-gate extern int waddwstr(WINDOW *, const wchar_t *);
4237c478bd9Sstevel@tonic-gate 
4247c478bd9Sstevel@tonic-gate extern int attroff(int);
4257c478bd9Sstevel@tonic-gate extern int attron(int);
4267c478bd9Sstevel@tonic-gate extern int attrset(int);
4277c478bd9Sstevel@tonic-gate extern int wattroff(WINDOW *, int);
4287c478bd9Sstevel@tonic-gate extern int wattron(WINDOW *, int);
4297c478bd9Sstevel@tonic-gate extern int wattrset(WINDOW *, int);
4307c478bd9Sstevel@tonic-gate 
4317c478bd9Sstevel@tonic-gate extern int attr_get(attr_t *, short *, void *);
4327c478bd9Sstevel@tonic-gate extern int attr_off(attr_t, void *);
4337c478bd9Sstevel@tonic-gate extern int attr_on(attr_t, void *);
4347c478bd9Sstevel@tonic-gate extern int attr_set(attr_t, short, void *);
4357c478bd9Sstevel@tonic-gate extern int color_set(short, void *);
4367c478bd9Sstevel@tonic-gate extern int wattr_get(WINDOW *, attr_t *, short *, void *);
4377c478bd9Sstevel@tonic-gate extern int wattr_off(WINDOW *, attr_t, void *);
4387c478bd9Sstevel@tonic-gate extern int wattr_on(WINDOW *, attr_t, void *);
4397c478bd9Sstevel@tonic-gate extern int wattr_set(WINDOW *, attr_t, short, void *);
4407c478bd9Sstevel@tonic-gate extern int wcolor_set(WINDOW *, short, void *);
4417c478bd9Sstevel@tonic-gate 
4427c478bd9Sstevel@tonic-gate extern chtype COLOR_PAIR(short);
4437c478bd9Sstevel@tonic-gate extern short PAIR_NUMBER(chtype);
4447c478bd9Sstevel@tonic-gate 
4457c478bd9Sstevel@tonic-gate extern int baudrate(void);
4467c478bd9Sstevel@tonic-gate 
4477c478bd9Sstevel@tonic-gate extern int delay_output(int);
4487c478bd9Sstevel@tonic-gate extern int napms(int);
4497c478bd9Sstevel@tonic-gate 
4507c478bd9Sstevel@tonic-gate extern int beep(void);
4517c478bd9Sstevel@tonic-gate extern int flash(void);
4527c478bd9Sstevel@tonic-gate 
4537c478bd9Sstevel@tonic-gate extern int bkgd(chtype);
4547c478bd9Sstevel@tonic-gate extern int bkgdset(chtype);
4557c478bd9Sstevel@tonic-gate extern chtype getbkgd(WINDOW *);
4567c478bd9Sstevel@tonic-gate extern int wbkgd(WINDOW *, chtype);
4577c478bd9Sstevel@tonic-gate extern int wbkgdset(WINDOW *, chtype);
4587c478bd9Sstevel@tonic-gate 
4597c478bd9Sstevel@tonic-gate extern int bkgrnd(const cchar_t *);
4607c478bd9Sstevel@tonic-gate extern void bkgrndset(const cchar_t *);
4617c478bd9Sstevel@tonic-gate extern int getbkgrnd(cchar_t *);
4627c478bd9Sstevel@tonic-gate extern int wbkgrnd(WINDOW *, const cchar_t *);
4637c478bd9Sstevel@tonic-gate extern void wbkgrndset(WINDOW *, const cchar_t *);
4647c478bd9Sstevel@tonic-gate extern int wgetbkgrnd(WINDOW *, cchar_t *);
4657c478bd9Sstevel@tonic-gate 
4667c478bd9Sstevel@tonic-gate extern int border(
467*1da57d55SToomas Soome 	chtype, chtype, chtype, chtype,
4687c478bd9Sstevel@tonic-gate 	chtype, chtype, chtype, chtype);
4697c478bd9Sstevel@tonic-gate extern int border_set(
470*1da57d55SToomas Soome 	const cchar_t *, const cchar_t *,
471*1da57d55SToomas Soome 	const cchar_t *, const cchar_t *,
472*1da57d55SToomas Soome 	const cchar_t *, const cchar_t *,
4737c478bd9Sstevel@tonic-gate 	const cchar_t *, const cchar_t *);
4747c478bd9Sstevel@tonic-gate extern int box(WINDOW *, chtype, chtype);
4757c478bd9Sstevel@tonic-gate extern int box_set(WINDOW *, const cchar_t *, const cchar_t *);
4767c478bd9Sstevel@tonic-gate extern int wborder(
4777c478bd9Sstevel@tonic-gate 	WINDOW *,
478*1da57d55SToomas Soome 	chtype, chtype, chtype, chtype,
4797c478bd9Sstevel@tonic-gate 	chtype, chtype, chtype, chtype);
4807c478bd9Sstevel@tonic-gate extern int wborder_set(
4817c478bd9Sstevel@tonic-gate 	WINDOW *,
482*1da57d55SToomas Soome 	const cchar_t *, const cchar_t *,
483*1da57d55SToomas Soome 	const cchar_t *, const cchar_t *,
484*1da57d55SToomas Soome 	const cchar_t *, const cchar_t *,
4857c478bd9Sstevel@tonic-gate 	const cchar_t *, const cchar_t *);
4867c478bd9Sstevel@tonic-gate 
4877c478bd9Sstevel@tonic-gate extern bool can_change_color(void);
4887c478bd9Sstevel@tonic-gate extern int color_content(short, short *, short *, short *);
4897c478bd9Sstevel@tonic-gate extern bool has_colors(void);
4907c478bd9Sstevel@tonic-gate extern int init_color(short, short, short, short);
4917c478bd9Sstevel@tonic-gate extern int init_pair(short, short, short);
4927c478bd9Sstevel@tonic-gate extern int pair_content(short, short *, short *);
4937c478bd9Sstevel@tonic-gate extern int start_color(void);
4947c478bd9Sstevel@tonic-gate 
4957c478bd9Sstevel@tonic-gate extern int cbreak(void);
4967c478bd9Sstevel@tonic-gate extern int halfdelay(int);
4977c478bd9Sstevel@tonic-gate extern int nocbreak(void);
4987c478bd9Sstevel@tonic-gate extern int raw(void);
4997c478bd9Sstevel@tonic-gate extern int noraw(void);
5007c478bd9Sstevel@tonic-gate 
5017c478bd9Sstevel@tonic-gate extern int chgat(int, attr_t, short, const void *);
5027c478bd9Sstevel@tonic-gate extern int mvchgat(int, int, int, attr_t, short, const void *);
5037c478bd9Sstevel@tonic-gate extern int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);
5047c478bd9Sstevel@tonic-gate extern int wchgat(WINDOW *, int, attr_t, short, const void *);
5057c478bd9Sstevel@tonic-gate 
5067c478bd9Sstevel@tonic-gate extern int clear(void);
5077c478bd9Sstevel@tonic-gate extern int clrtobot(void);
5087c478bd9Sstevel@tonic-gate extern int clrtoeol(void);
5097c478bd9Sstevel@tonic-gate extern int erase(void);
5107c478bd9Sstevel@tonic-gate extern int wclear(WINDOW *);
5117c478bd9Sstevel@tonic-gate extern int wclrtobot(WINDOW *);
5127c478bd9Sstevel@tonic-gate extern int wclrtoeol(WINDOW *);
5137c478bd9Sstevel@tonic-gate extern int werase(WINDOW *);
5147c478bd9Sstevel@tonic-gate 
5157c478bd9Sstevel@tonic-gate extern int clearok(WINDOW *, bool);
5167c478bd9Sstevel@tonic-gate extern void idcok(WINDOW *, bool);
5177c478bd9Sstevel@tonic-gate extern int idlok(WINDOW *, bool);
5187c478bd9Sstevel@tonic-gate extern void immedok(WINDOW *, bool);
5197c478bd9Sstevel@tonic-gate extern int intrflush(WINDOW *, bool);
5207c478bd9Sstevel@tonic-gate extern int keypad(WINDOW *, bool);
5217c478bd9Sstevel@tonic-gate extern int leaveok(WINDOW *, bool);
5227c478bd9Sstevel@tonic-gate extern int meta(WINDOW *, bool);
5237c478bd9Sstevel@tonic-gate extern int nodelay(WINDOW *, bool);
5247c478bd9Sstevel@tonic-gate extern int notimeout(WINDOW *, bool);
5257c478bd9Sstevel@tonic-gate extern int scrollok(WINDOW *, bool);
5267c478bd9Sstevel@tonic-gate extern int syncok(WINDOW *, bool);
5277c478bd9Sstevel@tonic-gate 
5287c478bd9Sstevel@tonic-gate extern int copywin(const WINDOW *, WINDOW *, int, int, int, int, int, int, int);
5297c478bd9Sstevel@tonic-gate extern int overlay(const WINDOW *, WINDOW *);
5307c478bd9Sstevel@tonic-gate extern int overwrite(const WINDOW *, WINDOW *);
5317c478bd9Sstevel@tonic-gate 
5327c478bd9Sstevel@tonic-gate extern int curs_set(int);
5337c478bd9Sstevel@tonic-gate 
5347c478bd9Sstevel@tonic-gate extern int def_prog_mode(void);
5357c478bd9Sstevel@tonic-gate extern int def_shell_mode(void);
5367c478bd9Sstevel@tonic-gate extern int reset_prog_mode(void);
5377c478bd9Sstevel@tonic-gate extern int reset_shell_mode(void);
5387c478bd9Sstevel@tonic-gate 
5397c478bd9Sstevel@tonic-gate extern int delch(void);
5407c478bd9Sstevel@tonic-gate extern int mvdelch(int, int);
5417c478bd9Sstevel@tonic-gate extern int mvwdelch(WINDOW *, int, int);
5427c478bd9Sstevel@tonic-gate extern int wdelch(WINDOW *);
5437c478bd9Sstevel@tonic-gate 
5447c478bd9Sstevel@tonic-gate extern int deleteln(void);
5457c478bd9Sstevel@tonic-gate extern int insdelln(int);
5467c478bd9Sstevel@tonic-gate extern int insertln(void);
5477c478bd9Sstevel@tonic-gate extern int wdeleteln(WINDOW *);
5487c478bd9Sstevel@tonic-gate extern int winsdelln(WINDOW *, int);
5497c478bd9Sstevel@tonic-gate extern int winsertln(WINDOW *);
5507c478bd9Sstevel@tonic-gate 
5517c478bd9Sstevel@tonic-gate extern void delscreen(SCREEN *);
5527c478bd9Sstevel@tonic-gate extern SCREEN *newterm(char *, FILE *, FILE *);
5537c478bd9Sstevel@tonic-gate extern SCREEN *set_term(SCREEN *);
5547c478bd9Sstevel@tonic-gate 
5557c478bd9Sstevel@tonic-gate extern int delwin(WINDOW *);
5567c478bd9Sstevel@tonic-gate extern WINDOW *derwin(WINDOW *, int, int, int, int);
5577c478bd9Sstevel@tonic-gate extern WINDOW *dupwin(WINDOW *);
5587c478bd9Sstevel@tonic-gate extern WINDOW *getwin(FILE *);
5597c478bd9Sstevel@tonic-gate extern int mvwin(WINDOW *, int, int);
5607c478bd9Sstevel@tonic-gate extern int mvderwin(WINDOW *, int, int);
5617c478bd9Sstevel@tonic-gate extern WINDOW *newwin(int, int, int, int);
5627c478bd9Sstevel@tonic-gate extern int putwin(WINDOW *,  FILE *);
5637c478bd9Sstevel@tonic-gate extern int redrawwin(WINDOW *);
5647c478bd9Sstevel@tonic-gate extern WINDOW *subwin(WINDOW *, int, int, int, int);
5657c478bd9Sstevel@tonic-gate extern int wredrawln(WINDOW *, int, int);
5667c478bd9Sstevel@tonic-gate 
5677c478bd9Sstevel@tonic-gate extern int doupdate(void);
5687c478bd9Sstevel@tonic-gate extern int refresh(void);
5697c478bd9Sstevel@tonic-gate extern int wnoutrefresh(WINDOW *);
5707c478bd9Sstevel@tonic-gate extern int wrefresh(WINDOW *);
5717c478bd9Sstevel@tonic-gate 
5727c478bd9Sstevel@tonic-gate extern int echo(void);
5737c478bd9Sstevel@tonic-gate extern int noecho(void);
5747c478bd9Sstevel@tonic-gate extern int echochar(chtype);
5757c478bd9Sstevel@tonic-gate extern int echo_wchar(const cchar_t *);
5767c478bd9Sstevel@tonic-gate extern int wechochar(WINDOW *, chtype);
5777c478bd9Sstevel@tonic-gate extern int wecho_wchar(WINDOW *, const cchar_t *);
5787c478bd9Sstevel@tonic-gate 
5797c478bd9Sstevel@tonic-gate extern int endwin(void);
5807c478bd9Sstevel@tonic-gate extern void filter(void);
5817c478bd9Sstevel@tonic-gate extern WINDOW *initscr(void);
5827c478bd9Sstevel@tonic-gate extern bool isendwin(void);
5837c478bd9Sstevel@tonic-gate extern int ripoffline(int, int (*)(WINDOW *, int));
5847c478bd9Sstevel@tonic-gate extern int typeahead(int);
5857c478bd9Sstevel@tonic-gate extern void use_env(bool);
5867c478bd9Sstevel@tonic-gate 
5877c478bd9Sstevel@tonic-gate extern int erasechar(void);
5887c478bd9Sstevel@tonic-gate extern int erasewchar(wchar_t *);
5897c478bd9Sstevel@tonic-gate extern int killchar(void);
5907c478bd9Sstevel@tonic-gate extern int killwchar(wchar_t *);
5917c478bd9Sstevel@tonic-gate 
5927c478bd9Sstevel@tonic-gate extern int flushinp(void);
5937c478bd9Sstevel@tonic-gate 
5947c478bd9Sstevel@tonic-gate extern int getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *);
5957c478bd9Sstevel@tonic-gate extern int setcchar(cchar_t *, const wchar_t *, attr_t, short, const void *);
5967c478bd9Sstevel@tonic-gate 
5977c478bd9Sstevel@tonic-gate extern int getch(void);
5987c478bd9Sstevel@tonic-gate extern int get_wch(wint_t *);
5997c478bd9Sstevel@tonic-gate extern int mvgetch(int, int);
6007c478bd9Sstevel@tonic-gate extern int mvget_wch(int, int, wint_t *);
6017c478bd9Sstevel@tonic-gate extern int mvwgetch(WINDOW *, int, int);
6027c478bd9Sstevel@tonic-gate extern int mvwget_wch(WINDOW *, int, int, wint_t *);
6037c478bd9Sstevel@tonic-gate extern int wgetch(WINDOW *);
6047c478bd9Sstevel@tonic-gate extern int wget_wch(WINDOW *, wint_t *);
6057c478bd9Sstevel@tonic-gate 
6067c478bd9Sstevel@tonic-gate extern int getnstr(char *, int);
6077c478bd9Sstevel@tonic-gate extern int getstr(char *);
6087c478bd9Sstevel@tonic-gate extern int mvgetnstr(int, int, char *, int);
6097c478bd9Sstevel@tonic-gate extern int mvgetstr(int, int, char *);
6107c478bd9Sstevel@tonic-gate extern int mvwgetnstr(WINDOW *, int, int, char *, int);
6117c478bd9Sstevel@tonic-gate extern int mvwgetstr(WINDOW *, int, int, char *);
6127c478bd9Sstevel@tonic-gate extern int wgetnstr(WINDOW *, char *, int);
6137c478bd9Sstevel@tonic-gate extern int wgetstr(WINDOW *, char *);
6147c478bd9Sstevel@tonic-gate 
6157c478bd9Sstevel@tonic-gate extern int getn_wstr(wint_t *, int);
6167c478bd9Sstevel@tonic-gate extern int get_wstr(wint_t *);
6177c478bd9Sstevel@tonic-gate extern int mvgetn_wstr(int, int, wint_t *, int);
6187c478bd9Sstevel@tonic-gate extern int mvget_wstr(int, int, wint_t *);
6197c478bd9Sstevel@tonic-gate extern int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int);
6207c478bd9Sstevel@tonic-gate extern int mvwget_wstr(WINDOW *, int, int, wint_t *);
6217c478bd9Sstevel@tonic-gate extern int wgetn_wstr(WINDOW *, wint_t *, int);
6227c478bd9Sstevel@tonic-gate extern int wget_wstr(WINDOW *, wint_t *);
6237c478bd9Sstevel@tonic-gate 
6247c478bd9Sstevel@tonic-gate extern bool has_ic(void);
6257c478bd9Sstevel@tonic-gate extern bool has_il(void);
6267c478bd9Sstevel@tonic-gate 
6277c478bd9Sstevel@tonic-gate extern int hline(chtype, int);
6287c478bd9Sstevel@tonic-gate extern int hline_set(const cchar_t *, int);
6297c478bd9Sstevel@tonic-gate extern int vline(chtype, int);
6307c478bd9Sstevel@tonic-gate extern int vline_set(const cchar_t *, int);
6317c478bd9Sstevel@tonic-gate extern int mvhline(int, int, chtype, int);
6327c478bd9Sstevel@tonic-gate extern int mvhline_set(int, int, const cchar_t *, int);
6337c478bd9Sstevel@tonic-gate extern int mvvline(int, int, chtype, int);
6347c478bd9Sstevel@tonic-gate extern int mvvline_set(int, int, const cchar_t *, int);
6357c478bd9Sstevel@tonic-gate extern int mvwhline(WINDOW *, int, int, chtype, int);
6367c478bd9Sstevel@tonic-gate extern int mvwhline_set(WINDOW *, int, int, const cchar_t *, int);
6377c478bd9Sstevel@tonic-gate extern int mvwvline(WINDOW *, int, int, chtype, int);
6387c478bd9Sstevel@tonic-gate extern int mvwvline_set(WINDOW *, int, int, const cchar_t *, int);
6397c478bd9Sstevel@tonic-gate extern int whline(WINDOW *, chtype, int);
6407c478bd9Sstevel@tonic-gate extern int whline_set(WINDOW *, const cchar_t *, int);
6417c478bd9Sstevel@tonic-gate extern int wvline(WINDOW *, chtype, int);
6427c478bd9Sstevel@tonic-gate extern int wvline_set(WINDOW *, const cchar_t *, int);
6437c478bd9Sstevel@tonic-gate 
6447c478bd9Sstevel@tonic-gate extern chtype inch(void);
6457c478bd9Sstevel@tonic-gate extern int inchnstr(chtype *, int);
6467c478bd9Sstevel@tonic-gate extern int inchstr(chtype *);
6477c478bd9Sstevel@tonic-gate extern int in_wch(cchar_t *);
6487c478bd9Sstevel@tonic-gate extern int in_wchnstr(cchar_t *, int);
6497c478bd9Sstevel@tonic-gate extern int in_wchstr(cchar_t *);
6507c478bd9Sstevel@tonic-gate extern chtype mvinch(int, int);
6517c478bd9Sstevel@tonic-gate extern int mvinchnstr(int, int, chtype *, int);
6527c478bd9Sstevel@tonic-gate extern int mvinchstr(int, int, chtype *);
6537c478bd9Sstevel@tonic-gate extern int mvin_wch(int, int, cchar_t *);
6547c478bd9Sstevel@tonic-gate extern int mvin_wchnstr(int, int, cchar_t *, int);
6557c478bd9Sstevel@tonic-gate extern int mvin_wchstr(int, int, cchar_t *);
6567c478bd9Sstevel@tonic-gate extern chtype mvwinch(WINDOW *, int, int);
6577c478bd9Sstevel@tonic-gate extern int mvwinchnstr(WINDOW *, int, int, chtype *, int);
6587c478bd9Sstevel@tonic-gate extern int mvwinchstr(WINDOW *, int, int, chtype *);
6597c478bd9Sstevel@tonic-gate extern int mvwin_wch(WINDOW *, int, int, cchar_t *);
6607c478bd9Sstevel@tonic-gate extern int mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int);
6617c478bd9Sstevel@tonic-gate extern int mvwin_wchstr(WINDOW *, int, int, cchar_t *);
6627c478bd9Sstevel@tonic-gate extern chtype winch(WINDOW *);
6637c478bd9Sstevel@tonic-gate extern int winchnstr(WINDOW *, chtype *, int);
6647c478bd9Sstevel@tonic-gate extern int winchstr(WINDOW *, chtype *);
6657c478bd9Sstevel@tonic-gate extern int win_wch(WINDOW *, cchar_t *);
6667c478bd9Sstevel@tonic-gate extern int win_wchnstr(WINDOW *, cchar_t *, int);
6677c478bd9Sstevel@tonic-gate extern int win_wchstr(WINDOW *, cchar_t *);
6687c478bd9Sstevel@tonic-gate 
6697c478bd9Sstevel@tonic-gate extern int innstr(char *, int);
6707c478bd9Sstevel@tonic-gate extern int instr(char *);
6717c478bd9Sstevel@tonic-gate extern int innwstr(wchar_t *, int);
6727c478bd9Sstevel@tonic-gate extern int inwstr(wchar_t *);
6737c478bd9Sstevel@tonic-gate extern int mvinnstr(int, int, char *, int);
6747c478bd9Sstevel@tonic-gate extern int mvinstr(int, int, char *);
6757c478bd9Sstevel@tonic-gate extern int mvinnwstr(int, int, wchar_t *, int);
6767c478bd9Sstevel@tonic-gate extern int mvinwstr(int, int, wchar_t *);
6777c478bd9Sstevel@tonic-gate extern int mvwinnstr(WINDOW *, int, int, char *, int);
6787c478bd9Sstevel@tonic-gate extern int mvwinstr(WINDOW *, int, int, char *);
6797c478bd9Sstevel@tonic-gate extern int mvwinnwstr(WINDOW *, int, int, wchar_t *, int);
6807c478bd9Sstevel@tonic-gate extern int mvwinwstr(WINDOW *, int, int, wchar_t *);
6817c478bd9Sstevel@tonic-gate extern int winnstr(WINDOW *, char *, int);
6827c478bd9Sstevel@tonic-gate extern int winstr(WINDOW *, char *);
6837c478bd9Sstevel@tonic-gate extern int winnwstr(WINDOW *, wchar_t *, int);
6847c478bd9Sstevel@tonic-gate extern int winwstr(WINDOW *, wchar_t *);
6857c478bd9Sstevel@tonic-gate 
6867c478bd9Sstevel@tonic-gate extern int insch(chtype);
6877c478bd9Sstevel@tonic-gate extern int ins_wch(const cchar_t *);
6887c478bd9Sstevel@tonic-gate extern int mvinsch(int, int, chtype);
6897c478bd9Sstevel@tonic-gate extern int mvins_wch(int, int, const cchar_t *);
6907c478bd9Sstevel@tonic-gate extern int mvwinsch(WINDOW *, int, int, chtype);
6917c478bd9Sstevel@tonic-gate extern int mvwins_wch(WINDOW *, int, int, const cchar_t *);
6927c478bd9Sstevel@tonic-gate extern int winsch(WINDOW *, chtype);
6937c478bd9Sstevel@tonic-gate extern int wins_wch(WINDOW *, const cchar_t *);
6947c478bd9Sstevel@tonic-gate 
6957c478bd9Sstevel@tonic-gate extern int insnstr(const char *, int);
6967c478bd9Sstevel@tonic-gate extern int insstr(const char *);
6977c478bd9Sstevel@tonic-gate extern int ins_nwstr(const wchar_t *, int);
6987c478bd9Sstevel@tonic-gate extern int ins_wstr(const wchar_t *);
6997c478bd9Sstevel@tonic-gate extern int mvinsnstr(int, int, const char *, int);
7007c478bd9Sstevel@tonic-gate extern int mvinsstr(int, int, const char *);
7017c478bd9Sstevel@tonic-gate extern int mvins_nwstr(int, int, const wchar_t *, int);
7027c478bd9Sstevel@tonic-gate extern int mvins_wstr(int, int, const wchar_t *);
7037c478bd9Sstevel@tonic-gate extern int mvwinsnstr(WINDOW *, int, int, const char *, int);
7047c478bd9Sstevel@tonic-gate extern int mvwinsstr(WINDOW *, int, int, const char *);
7057c478bd9Sstevel@tonic-gate extern int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int);
7067c478bd9Sstevel@tonic-gate extern int mvwins_wstr(WINDOW *, int, int, const wchar_t *);
7077c478bd9Sstevel@tonic-gate extern int winsnstr(WINDOW *, const char *, int);
7087c478bd9Sstevel@tonic-gate extern int winsstr(WINDOW *, const char *);
7097c478bd9Sstevel@tonic-gate extern int wins_nwstr(WINDOW *, const wchar_t *, int);
7107c478bd9Sstevel@tonic-gate extern int wins_wstr(WINDOW *, const wchar_t *);
7117c478bd9Sstevel@tonic-gate 
7127c478bd9Sstevel@tonic-gate extern bool is_linetouched(WINDOW *, int);
7137c478bd9Sstevel@tonic-gate extern bool is_wintouched(WINDOW *);
7147c478bd9Sstevel@tonic-gate extern int touchline(WINDOW *, int, int);
7157c478bd9Sstevel@tonic-gate extern int touchwin(WINDOW *);
7167c478bd9Sstevel@tonic-gate extern int wtouchln(WINDOW *, int, int, int);
7177c478bd9Sstevel@tonic-gate extern int untouchwin(WINDOW *);
7187c478bd9Sstevel@tonic-gate 
7197c478bd9Sstevel@tonic-gate extern const char *keyname(int);
7207c478bd9Sstevel@tonic-gate extern const char *key_name(wchar_t);
7217c478bd9Sstevel@tonic-gate 
7227c478bd9Sstevel@tonic-gate extern char *longname(void);
7237c478bd9Sstevel@tonic-gate extern char *termname(void);
7247c478bd9Sstevel@tonic-gate 
7257c478bd9Sstevel@tonic-gate extern int move(int, int);
7267c478bd9Sstevel@tonic-gate extern int wmove(WINDOW *, int, int);
7277c478bd9Sstevel@tonic-gate 
7287c478bd9Sstevel@tonic-gate extern int mvcur(int, int, int, int);
7297c478bd9Sstevel@tonic-gate 
7307c478bd9Sstevel@tonic-gate extern WINDOW *newpad(int, int);
7317c478bd9Sstevel@tonic-gate extern int pechochar(WINDOW *, chtype);
7327c478bd9Sstevel@tonic-gate extern int pecho_wchar(WINDOW *, const cchar_t *);
7337c478bd9Sstevel@tonic-gate extern int pnoutrefresh(WINDOW *, int, int, int, int, int, int);
7347c478bd9Sstevel@tonic-gate extern int prefresh(WINDOW *, int, int, int, int, int, int);
7357c478bd9Sstevel@tonic-gate extern WINDOW *subpad(WINDOW *, int, int, int, int);
7367c478bd9Sstevel@tonic-gate 
7377c478bd9Sstevel@tonic-gate extern int nl(void);
7387c478bd9Sstevel@tonic-gate extern int nonl(void);
7397c478bd9Sstevel@tonic-gate 
7407c478bd9Sstevel@tonic-gate extern int printw(const char *, ...);
7417c478bd9Sstevel@tonic-gate extern int mvprintw(int, int, const char *, ...);
7427c478bd9Sstevel@tonic-gate extern int mvwprintw(WINDOW *, int, int, const char *, ...);
7437c478bd9Sstevel@tonic-gate #if defined(sun)
7447c478bd9Sstevel@tonic-gate extern int vwprintw(WINDOW *, const char *, __va_list);
7457c478bd9Sstevel@tonic-gate extern int vw_printw(WINDOW *, const char *, __va_list);
7467c478bd9Sstevel@tonic-gate #else
7477c478bd9Sstevel@tonic-gate extern int vwprintw(WINDOW *, const char *, void *);
7487c478bd9Sstevel@tonic-gate extern int vw_printw(WINDOW *, const char *, void *);
7497c478bd9Sstevel@tonic-gate #endif
7507c478bd9Sstevel@tonic-gate extern int wprintw(WINDOW *, const char *, ...);
7517c478bd9Sstevel@tonic-gate 
7527c478bd9Sstevel@tonic-gate extern void qiflush(void);
7537c478bd9Sstevel@tonic-gate extern void noqiflush(void);
7547c478bd9Sstevel@tonic-gate 
7557c478bd9Sstevel@tonic-gate extern int resetty(void);
7567c478bd9Sstevel@tonic-gate extern int savetty(void);
7577c478bd9Sstevel@tonic-gate 
7587c478bd9Sstevel@tonic-gate extern int scanw(const char *, ...);
7597c478bd9Sstevel@tonic-gate extern int mvscanw(int, int, const char *, ...);
7607c478bd9Sstevel@tonic-gate extern int mvwscanw(WINDOW *, int, int, const char *, ...);
7617c478bd9Sstevel@tonic-gate #if defined(sun)
7627c478bd9Sstevel@tonic-gate extern int vwscanw(WINDOW *, const char *, __va_list);
7637c478bd9Sstevel@tonic-gate extern int vw_scanw(WINDOW *, const char *, __va_list);
7647c478bd9Sstevel@tonic-gate #else
7657c478bd9Sstevel@tonic-gate extern int vwscanw(WINDOW *, const char *, void *);
7667c478bd9Sstevel@tonic-gate extern int vw_scanw(WINDOW *, const char *, void *);
7677c478bd9Sstevel@tonic-gate #endif
7687c478bd9Sstevel@tonic-gate extern int wscanw(WINDOW *, const char *, ...);
7697c478bd9Sstevel@tonic-gate 
7707c478bd9Sstevel@tonic-gate extern int scr_dump(const char *);
7717c478bd9Sstevel@tonic-gate extern int scr_init(const char *);
7727c478bd9Sstevel@tonic-gate extern int scr_restore(const char *);
7737c478bd9Sstevel@tonic-gate extern int scr_set(const char *);
7747c478bd9Sstevel@tonic-gate 
7757c478bd9Sstevel@tonic-gate extern int scrl(int);
7767c478bd9Sstevel@tonic-gate extern int scroll(WINDOW *);
7777c478bd9Sstevel@tonic-gate extern int setscrreg(int, int);
7787c478bd9Sstevel@tonic-gate extern int wscrl(WINDOW *, int);
7797c478bd9Sstevel@tonic-gate extern int wsetscrreg(WINDOW *, int, int);
7807c478bd9Sstevel@tonic-gate 
7817c478bd9Sstevel@tonic-gate extern int slk_attroff(const chtype);
7827c478bd9Sstevel@tonic-gate extern int slk_attron(const chtype);
7837c478bd9Sstevel@tonic-gate extern int slk_attrset(const chtype);
7847c478bd9Sstevel@tonic-gate extern int slk_attr_off(const attr_t, void *);
7857c478bd9Sstevel@tonic-gate extern int slk_attr_on(const attr_t, void *);
7867c478bd9Sstevel@tonic-gate extern int slk_attr_set(const attr_t, short, void *);
7877c478bd9Sstevel@tonic-gate extern int slk_color_set(short);
7887c478bd9Sstevel@tonic-gate extern int slk_clear(void);
7897c478bd9Sstevel@tonic-gate extern int slk_init(int);
7907c478bd9Sstevel@tonic-gate extern char *slk_label(int);
7917c478bd9Sstevel@tonic-gate extern int slk_noutrefresh(void);
7927c478bd9Sstevel@tonic-gate extern int slk_refresh(void);
7937c478bd9Sstevel@tonic-gate extern int slk_restore(void);
7947c478bd9Sstevel@tonic-gate extern int slk_set(int, const char *, int);
7957c478bd9Sstevel@tonic-gate extern int slk_touch(void);
7967c478bd9Sstevel@tonic-gate extern int slk_wset(int, const wchar_t *, int);
7977c478bd9Sstevel@tonic-gate 
7987c478bd9Sstevel@tonic-gate extern int standend(void);
7997c478bd9Sstevel@tonic-gate extern int wstandend(WINDOW *);
8007c478bd9Sstevel@tonic-gate extern int standout(void);
8017c478bd9Sstevel@tonic-gate extern int wstandout(WINDOW *);
8027c478bd9Sstevel@tonic-gate 
8037c478bd9Sstevel@tonic-gate extern chtype termattrs(void);
8047c478bd9Sstevel@tonic-gate extern attr_t term_attrs(void);
8057c478bd9Sstevel@tonic-gate 
8067c478bd9Sstevel@tonic-gate extern void timeout(int);
8077c478bd9Sstevel@tonic-gate extern void wtimeout(WINDOW *, int);
8087c478bd9Sstevel@tonic-gate 
8097c478bd9Sstevel@tonic-gate extern int ungetch(int);
8107c478bd9Sstevel@tonic-gate extern int unget_wch(const wchar_t);
8117c478bd9Sstevel@tonic-gate 
8127c478bd9Sstevel@tonic-gate extern int vidattr(chtype);
8137c478bd9Sstevel@tonic-gate extern int vid_attr(attr_t, short, void *);
8147c478bd9Sstevel@tonic-gate extern int vidputs(chtype, int (*)(int));
8157c478bd9Sstevel@tonic-gate extern int vid_puts(attr_t, short, void *, int (*)(int));
8167c478bd9Sstevel@tonic-gate 
8177c478bd9Sstevel@tonic-gate extern void wcursyncup(WINDOW *);
8187c478bd9Sstevel@tonic-gate extern void wsyncdown(WINDOW *);
8197c478bd9Sstevel@tonic-gate extern void wsyncup(WINDOW *);
8207c478bd9Sstevel@tonic-gate 
8217c478bd9Sstevel@tonic-gate extern const wchar_t *wunctrl(const cchar_t *);
8227c478bd9Sstevel@tonic-gate 
8237c478bd9Sstevel@tonic-gate /*
824*1da57d55SToomas Soome  * These macros are not suitable for strict XPG4 conformance,
8257c478bd9Sstevel@tonic-gate  * because some of them evaluate their arguments more than once.
8267c478bd9Sstevel@tonic-gate  * However, they can improve speed and size of an application,
8277c478bd9Sstevel@tonic-gate  * provided an application is careful about not using side effects
8287c478bd9Sstevel@tonic-gate  * with function/macro parameters.
8297c478bd9Sstevel@tonic-gate  */
8307c478bd9Sstevel@tonic-gate #ifndef _XOPEN_SOURCE_EXTENDED
8317c478bd9Sstevel@tonic-gate 
8327c478bd9Sstevel@tonic-gate #define addch(ch)			waddch(stdscr,ch)
8337c478bd9Sstevel@tonic-gate #define mvaddch(y,x,ch)			(move(y,x)?ERR:addch(ch))
8347c478bd9Sstevel@tonic-gate #define mvwaddch(w,y,x,ch)		(wmove(w,y,x)?ERR:waddch(w,ch))
8357c478bd9Sstevel@tonic-gate 
8367c478bd9Sstevel@tonic-gate #define add_wch(cp)			wadd_wch(stdscr,cp)
8377c478bd9Sstevel@tonic-gate #define mvadd_wch(y,x,cp)		(move(y,x)?ERR:add_wch(cp))
8387c478bd9Sstevel@tonic-gate #define mvwadd_wch(w,y,x,cp)		(wmove(w,y,x)?ERR:wadd_wch(w,cp))
8397c478bd9Sstevel@tonic-gate 
8407c478bd9Sstevel@tonic-gate #define addchnstr(chs,n)		waddchnstr(stdscr,chs,n)
8417c478bd9Sstevel@tonic-gate #define addchstr(chs)			waddchstr(stdscr,chs)
8427c478bd9Sstevel@tonic-gate #define mvaddchnstr(y,x,chs,n)		(move(y,x)?ERR:addchnstr(chs,n))
8437c478bd9Sstevel@tonic-gate #define mvaddchstr(y,x,chs)		(move(y,x)?ERR:addchstr(chs))
8447c478bd9Sstevel@tonic-gate #define mvwaddchnstr(w,y,x,chs,n)	(wmove(w,y,x)?ERR:waddchnstr(w,chs,n))
8457c478bd9Sstevel@tonic-gate #define mvwaddchstr(w,y,x,chs)		(wmove(w,y,x)?ERR:waddchstr(w,chs))
8467c478bd9Sstevel@tonic-gate #define waddchstr(w,chs)		waddchnstr(w,chs,-1)
8477c478bd9Sstevel@tonic-gate 
8487c478bd9Sstevel@tonic-gate #define add_wchnstr(cp,n)		wadd_wchnstr(stdscr,cp,n)
8497c478bd9Sstevel@tonic-gate #define add_wchstr(cp)			wadd_wchstr(stdscr,cp)
8507c478bd9Sstevel@tonic-gate #define mvadd_wchnstr(y,x,cp,n)		(move(y,x)?ERR:add_wchnstr(cp,n))
8517c478bd9Sstevel@tonic-gate #define mvadd_wchstr(y,x,cp)		(move(y,x)?ERR:add_wchstr(cp))
8527c478bd9Sstevel@tonic-gate #define mvwadd_wchnstr(w,y,x,cp,n)	(wmove(w,y,x)?ERR:wadd_wchnstr(w,cp,n))
8537c478bd9Sstevel@tonic-gate #define mvwadd_wchstr(w,y,x,cp)		(wmove(w,y,x)?ERR:wadd_wchstr(w,cp))
8547c478bd9Sstevel@tonic-gate #define wadd_wchstr(w,cp)		wadd_wchnstr(w,cp,-1)
8557c478bd9Sstevel@tonic-gate 
8567c478bd9Sstevel@tonic-gate #define addnstr(s,n)			waddnstr(stdscr,s,n)
8577c478bd9Sstevel@tonic-gate #define addstr(s)			waddstr(stdscr,s)
8587c478bd9Sstevel@tonic-gate #define mvaddnstr(y,x,s,n)		(move(y,x)?ERR:addnstr(s,n))
8597c478bd9Sstevel@tonic-gate #define mvaddstr(y,x,s)			(move(y,x)?ERR:addstr(s))
8607c478bd9Sstevel@tonic-gate #define mvwaddnstr(w,y,x,s,n)		(wmove(w,y,x)?ERR:waddnstr(w,s,n))
8617c478bd9Sstevel@tonic-gate #define mvwaddstr(w,y,x,s)		(wmove(w,y,x)?ERR:waddstr(w,s))
8627c478bd9Sstevel@tonic-gate #define waddstr(w,wcs)			waddnstr(w,wcs,-1)
8637c478bd9Sstevel@tonic-gate 
8647c478bd9Sstevel@tonic-gate #define addnwstr(wcs,n)			waddnwstr(stdscr,wcs,n)
8657c478bd9Sstevel@tonic-gate #define addwstr(wcs)			waddwstr(stdscr,wcs)
8667c478bd9Sstevel@tonic-gate #define mvaddnwstr(y,x,wcs,n)		(move(y,x)?ERR:addnwstr(wcs,n))
8677c478bd9Sstevel@tonic-gate #define mvaddwstr(y,x,wcs)		(move(y,x)?ERR:addwstr(wcs))
8687c478bd9Sstevel@tonic-gate #define mvwaddnwstr(w,y,x,wcs,n)	(wmove(w,y,x)?ERR:waddnwstr(w,wcs,n))
8697c478bd9Sstevel@tonic-gate #define mvwaddwstr(w,y,x,wcs)		(wmove(w,y,x)?ERR:waddwstr(w,wcs))
8707c478bd9Sstevel@tonic-gate #define waddwstr(w,wcs)			waddnwstr(w,wcs,-1)
8717c478bd9Sstevel@tonic-gate 
8727c478bd9Sstevel@tonic-gate #define attr_get(a,c,o)			wattr_get(stdscr,a,c,o)
8737c478bd9Sstevel@tonic-gate #define attr_off(a,o)			wattr_off(stdscr,a,o)
8747c478bd9Sstevel@tonic-gate #define attr_on(a,o)			wattr_on(stdscr,a,o)
8757c478bd9Sstevel@tonic-gate #define attr_set(a,c,o)			wattr_set(stdscr,a,c,o)
8767c478bd9Sstevel@tonic-gate 
8777c478bd9Sstevel@tonic-gate #define COLOR_PAIR(n)   		((chtype)(n)<<__COLOR_SHIFT)
8787c478bd9Sstevel@tonic-gate #define PAIR_NUMBER(a)  		(((chtype)(a)&A_COLOR)>>__COLOR_SHIFT)
8797c478bd9Sstevel@tonic-gate 
8807c478bd9Sstevel@tonic-gate #define bkgd(ch)			wbkgd(stdscr, ch)
8817c478bd9Sstevel@tonic-gate #define bkgdset(ch)			__m_chtype_cc(ch, &stdscr->_bg)
8827c478bd9Sstevel@tonic-gate #define getbkgd(w)			__m_cc_chtype(&(w)->_bg)
8837c478bd9Sstevel@tonic-gate #define wbkgdset(w,ch)			__m_chtype_cc(ch, &(w)->_bg)
8847c478bd9Sstevel@tonic-gate 
8857c478bd9Sstevel@tonic-gate #define bkgrnd(b)			wbkgrnd(stdscr,b)
8867c478bd9Sstevel@tonic-gate #define bkgrndset(b)			wbkgrndset(stdscr,b)
8877c478bd9Sstevel@tonic-gate #define getbkgrnd(b)			wgetbkgrnd(stdscr,b)
8887c478bd9Sstevel@tonic-gate #define wbkgrndset(w,b)			((w)->_bg = *(b))
8897c478bd9Sstevel@tonic-gate #define wgetbkgrnd(w,b)			(*(b) = (w)->_bg, OK)
8907c478bd9Sstevel@tonic-gate 
8917c478bd9Sstevel@tonic-gate #define border(ls, rs, ts, bs, tl, tr, bl, br) \
8927c478bd9Sstevel@tonic-gate 	wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
8937c478bd9Sstevel@tonic-gate #define border_set(ls, rs, ts, bs, tl, tr, bl, br) \
8947c478bd9Sstevel@tonic-gate 	wborder_set(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
8957c478bd9Sstevel@tonic-gate #define box(w,v,h)			wborder(w,v,v,h,h,0,0,0,0)
8967c478bd9Sstevel@tonic-gate #define box_set(w,v,h)			wborder_set(w,v,v,h,h,0,0,0,0)
8977c478bd9Sstevel@tonic-gate 
8987c478bd9Sstevel@tonic-gate #define can_change_color()		(2 < max_colors && can_change \
8997c478bd9Sstevel@tonic-gate 					&& initialize_color != (char *) 0)
9007c478bd9Sstevel@tonic-gate #define has_colors()			(0 < max_colors)
9017c478bd9Sstevel@tonic-gate 
9027c478bd9Sstevel@tonic-gate #define chgat(n,a,co,p)			wchgat(stdscr,n,a,co,p)
9037c478bd9Sstevel@tonic-gate #define mvchgat(y,x,n,a,co,p)		(move(y,x)?ERR:chgat(n,a,co,p))
9047c478bd9Sstevel@tonic-gate #define mvwchgat(w,y,x,n,a,co,p)	(wmove(w,y,x)?ERR:wchgat(w,n,a,co,p))
9057c478bd9Sstevel@tonic-gate 
9067c478bd9Sstevel@tonic-gate #define clear()				wclear(stdscr)
9077c478bd9Sstevel@tonic-gate #define clrtobot()			wclrtobot(stdscr)
9087c478bd9Sstevel@tonic-gate #define clrtoeol()			wclrtoeol(stdscr)
9097c478bd9Sstevel@tonic-gate #define erase()				werase(stdscr)
9107c478bd9Sstevel@tonic-gate #define wclear(w)			(clearok(w,1)?ERR:werase(w))
9117c478bd9Sstevel@tonic-gate #define werase(w)			(wmove(w,0,0)?ERR:wclrtobot(w))
9127c478bd9Sstevel@tonic-gate 
9137c478bd9Sstevel@tonic-gate #define delch()				wdelch(stdscr)
9147c478bd9Sstevel@tonic-gate #define mvdelch(y,x)			(move(y,x)?ERR:delch())
9157c478bd9Sstevel@tonic-gate #define mvwdelch(w,y,x)			(wmove(w,y,x)?ERR:wdelch(w))
9167c478bd9Sstevel@tonic-gate 
9177c478bd9Sstevel@tonic-gate #define deleteln()			wdeleteln(stdscr)
9187c478bd9Sstevel@tonic-gate #define insdelln(n)			winsdelln(stdscr,n)
9197c478bd9Sstevel@tonic-gate #define insertln()			winsertln(stdscr)
9207c478bd9Sstevel@tonic-gate #define wdeleteln(w)			winsdelln(w, -1)
9217c478bd9Sstevel@tonic-gate #define winsertln(w)			winsdelln(w, 1)
9227c478bd9Sstevel@tonic-gate 
9237c478bd9Sstevel@tonic-gate #define refresh()			wrefresh(stdscr)
9247c478bd9Sstevel@tonic-gate 
9257c478bd9Sstevel@tonic-gate #define echochar(ch)			wechochar(stdscr,ch)
9267c478bd9Sstevel@tonic-gate #define echo_wchar(cp)			wecho_wchar(stdscr,cp)
9277c478bd9Sstevel@tonic-gate #define wechochar(w,ch)			(waddch(w,ch)?ERR:wrefresh(w))
9287c478bd9Sstevel@tonic-gate #define wecho_wchar(w,cp)		(wadd_wch(w,cp)?ERR:wrefresh(w))
9297c478bd9Sstevel@tonic-gate 
9307c478bd9Sstevel@tonic-gate #define erasewchar(wp)			__m_tty_wc(VERASE, wp)
9317c478bd9Sstevel@tonic-gate #define killwchar(wp)			__m_tty_wc(VKILL, wp)
9327c478bd9Sstevel@tonic-gate 
9337c478bd9Sstevel@tonic-gate #define getch()				wgetch(stdscr)
9347c478bd9Sstevel@tonic-gate #define mvgetch(y,x)			(move(y,x)?ERR:getch())
9357c478bd9Sstevel@tonic-gate #define mvwgetch(w,y,x)			(wmove(w,y,x)?ERR:wgetch(w))
9367c478bd9Sstevel@tonic-gate 
9377c478bd9Sstevel@tonic-gate #define get_wch(wcp)			wget_wch(stdscr,wcp)
9387c478bd9Sstevel@tonic-gate #define mvget_wch(y,x,wcp)		(move(y,x)?ERR:get_wch(wcp))
9397c478bd9Sstevel@tonic-gate #define mvwget_wch(w,y,x,wcp)		(wmove(w,y,x)?ERR:wget_wch(w,wcp))
9407c478bd9Sstevel@tonic-gate 
9417c478bd9Sstevel@tonic-gate #define getnstr(s,n)			wgetnstr(stdscr,s,n)
9427c478bd9Sstevel@tonic-gate #define getstr(s)			wgetstr(stdscr,s)
9437c478bd9Sstevel@tonic-gate #define mvgetnstr(y,x,s,n)		(move(y,x)?ERR:getnstr(s,n))
9447c478bd9Sstevel@tonic-gate #define mvgetstr(y,x,s)			(move(y,x)?ERR:getstr(s))
9457c478bd9Sstevel@tonic-gate #define mvwgetnstr(w,y,x,s,n)		(wmove(w,y,x)?ERR:wgetnstr(w,s,n))
9467c478bd9Sstevel@tonic-gate #define mvwgetstr(w,y,x,s)		(wmove(w,y,x)?ERR:wgetstr(w,s))
9477c478bd9Sstevel@tonic-gate #define wgetstr(w,s)			wgetnstr(w,s,-1)
9487c478bd9Sstevel@tonic-gate 
9497c478bd9Sstevel@tonic-gate #define getn_wstr(wcs,n)		wgetn_wstr(stdscr,wcs,n)
9507c478bd9Sstevel@tonic-gate #define get_wstr(wcs)			wget_wstr(stdscr,wcs)
9517c478bd9Sstevel@tonic-gate #define mvgetn_wstr(y,x,wcs,n)		(move(y,x)?ERR:getn_wstr(wcs,n))
9527c478bd9Sstevel@tonic-gate #define mvget_wstr(y,x,wcs)		(move(y,x)?ERR:get_wstr(wcs))
9537c478bd9Sstevel@tonic-gate #define mvwgetn_wstr(w,y,x,wcs,n)	(wmove(w,y,x)?ERR:wgetn_wstr(w,wcs,n))
9547c478bd9Sstevel@tonic-gate #define mvwget_wstr(w,y,x,wcs)		(wmove(w,y,x)?ERR:wget_wstr(w,wcs))
9557c478bd9Sstevel@tonic-gate #define wget_wstr(w,wcs)		wgetn_wstr(w,wcs,-1)
9567c478bd9Sstevel@tonic-gate 
9577c478bd9Sstevel@tonic-gate #define has_ic()			(((insert_character != (char *) 0 \
9587c478bd9Sstevel@tonic-gate 					   || parm_ich != (char *) 0) \
9597c478bd9Sstevel@tonic-gate 					  && (delete_character != (char *) 0 \
9607c478bd9Sstevel@tonic-gate 					      || parm_dch != (char *) 0)) \
9617c478bd9Sstevel@tonic-gate 					 || (enter_insert_mode != (char *) 0 \
9627c478bd9Sstevel@tonic-gate 					     && exit_insert_mode))
9637c478bd9Sstevel@tonic-gate 
9647c478bd9Sstevel@tonic-gate #define has_il()			(((insert_line != (char *) 0 \
9657c478bd9Sstevel@tonic-gate 					   || parm_insert_line != (char *) 0) \
9667c478bd9Sstevel@tonic-gate 					  && (delete_line != (char *) 0 \
9677c478bd9Sstevel@tonic-gate 					      || parm_delete_line !=(char*)0)) \
9687c478bd9Sstevel@tonic-gate 					 || change_scroll_region != (char *) 0)
9697c478bd9Sstevel@tonic-gate 
9707c478bd9Sstevel@tonic-gate 
9717c478bd9Sstevel@tonic-gate #define hline(ch,n)			whline(stdscr,ch,n)
9727c478bd9Sstevel@tonic-gate #define vline(ch,n)			wvline(stdscr,ch,n)
9737c478bd9Sstevel@tonic-gate #define mvhline(y,x,ch,n)		(move(y,x)?ERR:hline(ch,n))
9747c478bd9Sstevel@tonic-gate #define mvvline(y,x,ch,n)		(move(y,x)?ERR:vline(ch,n))
9757c478bd9Sstevel@tonic-gate #define mvwhline(w,y,x,ch,n)		(wmove(w,y,x)?ERR:whline(w,ch,n))
9767c478bd9Sstevel@tonic-gate #define mvwvline(w,y,x,ch,n)		(wmove(w,y,x)?ERR:wvline(w,ch,n))
9777c478bd9Sstevel@tonic-gate 
9787c478bd9Sstevel@tonic-gate #define hline_set(cp,n)			whline_set(stdscr,cp,n)
9797c478bd9Sstevel@tonic-gate #define vline_set(cp,n)			wvline_set(stdscr,cp,n)
9807c478bd9Sstevel@tonic-gate #define mvhline_set(y,x,cp,n)		(move(y,x)?ERR:hline_set(cp,n))
9817c478bd9Sstevel@tonic-gate #define mvvline_set(y,x,cp,n)		(move(y,x)?ERR:vline_set(cp,n))
9827c478bd9Sstevel@tonic-gate #define mvwhline_set(w,y,x,cp,n)	(wmove(w,y,x)?ERR:whline_set(w,cp,n))
9837c478bd9Sstevel@tonic-gate #define mvwvline_set(w,y,x,cp,n)	(wmove(w,y,x)?ERR:wvline_set(w,cp,n))
9847c478bd9Sstevel@tonic-gate 
9857c478bd9Sstevel@tonic-gate #define inch()				winch(stdscr)
9867c478bd9Sstevel@tonic-gate #define mvinch(y,x)			(move(y,x)?ERR:inch())
9877c478bd9Sstevel@tonic-gate #define mvwinch(w,y,x)			(wmove(w,y,x)?ERR:winch(w))
9887c478bd9Sstevel@tonic-gate 
9897c478bd9Sstevel@tonic-gate #define in_wch(cp)			win_wch(stdscr,cp)
9907c478bd9Sstevel@tonic-gate #define mvin_wch(y,x,cp)		(move(y,x)?ERR:in_wch(cp))
9917c478bd9Sstevel@tonic-gate #define mvwin_wch(w,y,x,cp)		(wmove(w,y,x)?ERR:win_wch(w,cp))
9927c478bd9Sstevel@tonic-gate 
9937c478bd9Sstevel@tonic-gate #define inchnstr(chs,n)			winchnstr(stdscr,chs,n)
9947c478bd9Sstevel@tonic-gate #define inchstr(chs)			winchstr(stdscr,chs)
9957c478bd9Sstevel@tonic-gate #define mvinchnstr(y,x,chs,n)		(move(y,x)?ERR:inchnstr(chs,n))
9967c478bd9Sstevel@tonic-gate #define mvinchstr(y,x,chs)		(move(y,x)?ERR:inchstr(chs))
9977c478bd9Sstevel@tonic-gate #define mvwinchnstr(w,y,x,chs,n)	(wmove(w,y,x)?ERR:winchnstr(w,chs,n))
9987c478bd9Sstevel@tonic-gate #define mvwinchstr(w,y,x,chs)		(wmove(w,y,x)?ERR:winchstr(w,chs))
9997c478bd9Sstevel@tonic-gate #define winchstr(w,chs)			winchnstr(w,chs,-1)
10007c478bd9Sstevel@tonic-gate 
10017c478bd9Sstevel@tonic-gate #define in_wchnstr(cp,n)		win_wchnstr(stdscr,cp,n)
10027c478bd9Sstevel@tonic-gate #define in_wchstr(cp)			win_wchstr(stdscr,cp)
10037c478bd9Sstevel@tonic-gate #define mvin_wchnstr(y,x,cp,n)		(move(y,x)?ERR:in_wchnstr(cp,n))
10047c478bd9Sstevel@tonic-gate #define mvin_wchstr(y,x,cp)		(move(y,x)?ERR:in_wchstr(cp))
10057c478bd9Sstevel@tonic-gate #define mvwin_wchnstr(w,y,x,cp,n)	(wmove(w,y,x)?ERR:win_wchnstr(w,cp,n))
10067c478bd9Sstevel@tonic-gate #define mvwin_wchstr(w,y,x,cp)		(wmove(w,y,x)?ERR:win_wchstr(w,cp))
10077c478bd9Sstevel@tonic-gate #define win_wchstr(w,cp)		win_wchnstr(w,cp,-1)
10087c478bd9Sstevel@tonic-gate 
10097c478bd9Sstevel@tonic-gate #define innstr(s,n)			winnstr(stdscr,s,n)
10107c478bd9Sstevel@tonic-gate #define instr(s)			winstr(stdscr,s)
10117c478bd9Sstevel@tonic-gate #define mvinnstr(y,x,s,n)		(move(y,x)?ERR:innstr(s,n))
10127c478bd9Sstevel@tonic-gate #define mvinstr(y,x,s)			(move(y,x)?ERR:instr(s))
10137c478bd9Sstevel@tonic-gate #define mvwinnstr(w,y,x,s,n)		(wmove(w,y,x)?ERR:winnstr(w,s,n))
10147c478bd9Sstevel@tonic-gate #define mvwinstr(w,y,x,s)		(wmove(w,y,x)?ERR:winstr(w,s))
10157c478bd9Sstevel@tonic-gate #define winstr(w,s)			winnstr(w,s,-1)
10167c478bd9Sstevel@tonic-gate 
10177c478bd9Sstevel@tonic-gate #define innwstr(wcs,n)			winnwstr(stdscr,wcs,n)
10187c478bd9Sstevel@tonic-gate #define inwstr(wcs)			winwstr(stdscr,wcs)
10197c478bd9Sstevel@tonic-gate #define mvinnwstr(y,x,wcs,n)		(move(y,x)?ERR:innwstr(wcs,n))
10207c478bd9Sstevel@tonic-gate #define mvinwstr(y,x,wcs)		(move(y,x)?ERR:inwstr(wcs))
10217c478bd9Sstevel@tonic-gate #define mvwinnwstr(w,y,x,wcs,n)		(wmove(w,y,x)?ERR:winnwstr(w,wcs,n))
10227c478bd9Sstevel@tonic-gate #define mvwinwstr(w,y,x,wcs)		(wmove(w,y,x)?ERR:winwstr(w,wcs))
10237c478bd9Sstevel@tonic-gate #define winwstr(w,wcs)			winnwstr(w,wcs,-1)
10247c478bd9Sstevel@tonic-gate 
10257c478bd9Sstevel@tonic-gate #define insch(ch)			winsch(stdscr,ch)
10267c478bd9Sstevel@tonic-gate #define mvinsch(y,x,ch)			(move(y,x)?ERR:insch(ch))
10277c478bd9Sstevel@tonic-gate #define mvwinsch(w,y,x,ch)		(wmove(w,y,x)?ERR:winsch(w,ch))
10287c478bd9Sstevel@tonic-gate 
10297c478bd9Sstevel@tonic-gate #define ins_wch(cp)			wins_wch(stdscr,cp)
10307c478bd9Sstevel@tonic-gate #define mvins_wch(y,x,cp)		(move(y,x)?ERR:ins_wch(cp))
10317c478bd9Sstevel@tonic-gate #define mvwins_wch(w,y,x,cp)		(wmove(w,y,x)?ERR:wins_wch(w,cp))
10327c478bd9Sstevel@tonic-gate 
10337c478bd9Sstevel@tonic-gate #define insnstr(s,n)			winsnstr(stdscr,s,n)
10347c478bd9Sstevel@tonic-gate #define insstr(s)			winsstr(stdscr,s)
10357c478bd9Sstevel@tonic-gate #define mvinsnstr(y,x,s,n)		(move(y,x)?ERR:insnstr(s,n))
10367c478bd9Sstevel@tonic-gate #define mvinsstr(y,x,s)			(move(y,x)?ERR:insstr(s))
10377c478bd9Sstevel@tonic-gate #define	mvwinsnstr(w, y, x, s, n)	(wmove(w, y, x)?ERR:winsnstr(w, s, n))
10387c478bd9Sstevel@tonic-gate #define	mvwinsstr(w, y, x, s)		(wmove(w, y, x)?ERR:winsstr(w, s))
10397c478bd9Sstevel@tonic-gate #define	winsstr(w, s)			winsnstr(w, s, -1)
10407c478bd9Sstevel@tonic-gate 
10417c478bd9Sstevel@tonic-gate #define	ins_nwstr(wcs, n)		wins_nwstr(stdscr, wcs, n)
10427c478bd9Sstevel@tonic-gate #define	ins_wstr(wcs)			wins_wstr(stdscr, wcs)
10437c478bd9Sstevel@tonic-gate #define	mvins_nwstr(y, x, wcs, n)	(move(y, x)?ERR:ins_nwstr(wcs, n))
10447c478bd9Sstevel@tonic-gate #define	mvins_wstr(y, x, wcs)		(move(y, x)?ERR:ins_wstr(wcs))
10457c478bd9Sstevel@tonic-gate #define	mvwins_nwstr(w, y, x, wcs, n)	(wmove(w, y, x)?ERR:wins_nwstr(w,wcs,n))
10467c478bd9Sstevel@tonic-gate #define	mvwins_wstr(w, y, x, wcs)	(wmove(w, y, x)?ERR:wins_wstr(w,wcs))
10477c478bd9Sstevel@tonic-gate #define	wins_wstr(w, wcs)		wins_nwstr(w, wcs, -1)
10487c478bd9Sstevel@tonic-gate 
10497c478bd9Sstevel@tonic-gate #define	is_linetouched(w, y)		(0 <= (w)->_last[y])
10507c478bd9Sstevel@tonic-gate 
10517c478bd9Sstevel@tonic-gate #define	mvcur(or, oc, nr, nc)		__m_mvcur(or, oc, nr, nc, __m_outc)
10527c478bd9Sstevel@tonic-gate 
10537c478bd9Sstevel@tonic-gate #define	move(y, x)			wmove(stdscr, y, x)
10547c478bd9Sstevel@tonic-gate 
10557c478bd9Sstevel@tonic-gate #define	overlay(s, t)			__m_copywin(s, t, 1)
10567c478bd9Sstevel@tonic-gate #define	overwrite(s, t)			__m_copywin(s, t, 0)
10577c478bd9Sstevel@tonic-gate 
10587c478bd9Sstevel@tonic-gate #define	newpad(ny, nx)			__m_newwin((WINDOW *) 0, ny, nx, -1, -1)
10597c478bd9Sstevel@tonic-gate #define	subpad(par, ny, nx, by, bx)	subwin(par, ny, nx, by, bx)
10607c478bd9Sstevel@tonic-gate 
10617c478bd9Sstevel@tonic-gate #define	nodelay(w, bf)			(wtimeout(w, (bf)?0:-1), OK)
10627c478bd9Sstevel@tonic-gate #define	timeout(n)			wtimeout(stdscr, n)
10637c478bd9Sstevel@tonic-gate 
10647c478bd9Sstevel@tonic-gate #define	qiflush()			((void) intrflush((WINDOW *) 0, 1))
10657c478bd9Sstevel@tonic-gate #define	noqiflush()			((void) intrflush((WINDOW *) 0, 0))
10667c478bd9Sstevel@tonic-gate 
10677c478bd9Sstevel@tonic-gate #define	redrawwin(w)			wredrawln(w, 0, (w)->_maxy)
10687c478bd9Sstevel@tonic-gate 
10697c478bd9Sstevel@tonic-gate #define	scrl(n)				wscrl(stdscr, n)
10707c478bd9Sstevel@tonic-gate #define	setscrreg(t, b)			wsetscrreg(stdscr, t, b)
10717c478bd9Sstevel@tonic-gate 
10727c478bd9Sstevel@tonic-gate #define	standend()			wstandend(stdscr)
10737c478bd9Sstevel@tonic-gate #define	standout()			wstandout(stdscr)
10747c478bd9Sstevel@tonic-gate #define	wstandend(w)			(wattr_set(w, WA_NORMAL, COLOR_BLACK, \
10757c478bd9Sstevel@tonic-gate 					(void *)0), 1)
10767c478bd9Sstevel@tonic-gate #define	wstandout(w)			(wattr_on(w, WA_STANDOUT, (void *)0), 1)
10777c478bd9Sstevel@tonic-gate 
10787c478bd9Sstevel@tonic-gate #define	touchline(w, y, n)		wtouchln(w, y, n, 1)
10797c478bd9Sstevel@tonic-gate #define	touchwin(w)			wtouchln(w, 0, (w)->_maxy, 1)
10807c478bd9Sstevel@tonic-gate #define	untouchwin(w)			wtouchln(w, 0, (w)->_maxy, 0)
10817c478bd9Sstevel@tonic-gate 
10827c478bd9Sstevel@tonic-gate #define	termname()			(cur_term->_term)
10837c478bd9Sstevel@tonic-gate 
10847c478bd9Sstevel@tonic-gate #ifndef _XOPEN_SOURCE
10857c478bd9Sstevel@tonic-gate /*
10867c478bd9Sstevel@tonic-gate  * Obsolete functions names.
10877c478bd9Sstevel@tonic-gate  */
10887c478bd9Sstevel@tonic-gate #define	crmode				cbreak
10897c478bd9Sstevel@tonic-gate #define	nocrmode			nocbreak
10907c478bd9Sstevel@tonic-gate #define	saveterm			def_prog_mode
10917c478bd9Sstevel@tonic-gate #define	fixterm				reset_prog_mode
10927c478bd9Sstevel@tonic-gate #define	resetterm			reset_shell_mode
10937c478bd9Sstevel@tonic-gate #endif /* _XOPEN_SOURCE */
10947c478bd9Sstevel@tonic-gate #endif /* _XOPEN_SOURCE_EXTENDED */
10957c478bd9Sstevel@tonic-gate 
10967c478bd9Sstevel@tonic-gate /*
10977c478bd9Sstevel@tonic-gate  * Special Keys
10987c478bd9Sstevel@tonic-gate  *
10997c478bd9Sstevel@tonic-gate  * Keypad layout
11007c478bd9Sstevel@tonic-gate  *	A1	up	A3
11017c478bd9Sstevel@tonic-gate  *     left	B2     right
11027c478bd9Sstevel@tonic-gate  *	C1     down	C3
11037c478bd9Sstevel@tonic-gate  *
11047c478bd9Sstevel@tonic-gate  * Chossing negative values for KEY_ constants means that they can
11057c478bd9Sstevel@tonic-gate  * be safely returned in either an int or long type.
11067c478bd9Sstevel@tonic-gate  */
11077c478bd9Sstevel@tonic-gate #define	__KEY_BASE	(-2)
11087c478bd9Sstevel@tonic-gate #define	__KEY_MAX	__KEY_BASE
11097c478bd9Sstevel@tonic-gate 
11107c478bd9Sstevel@tonic-gate #define	KEY_CODE_YES	(__KEY_BASE-1)		/* Special indicator. */
11117c478bd9Sstevel@tonic-gate 
11127c478bd9Sstevel@tonic-gate #define	KEY_BREAK	(__KEY_BASE-2)		/* Break key (unreliable) */
11137c478bd9Sstevel@tonic-gate #define	KEY_DOWN	(__KEY_BASE-3)		/* The four arrow keys ... */
11147c478bd9Sstevel@tonic-gate #define	KEY_UP		(__KEY_BASE-4)
11157c478bd9Sstevel@tonic-gate #define	KEY_LEFT	(__KEY_BASE-5)
11167c478bd9Sstevel@tonic-gate #define	KEY_RIGHT	(__KEY_BASE-6)
11177c478bd9Sstevel@tonic-gate #define	KEY_HOME	(__KEY_BASE-7)		/* Move to upper-left corner. */
11187c478bd9Sstevel@tonic-gate #define	KEY_BACKSPACE	(__KEY_BASE-8)		/* Backspace */
11197c478bd9Sstevel@tonic-gate #define	KEY_F0		(__KEY_BASE-9)		/* Function keys.  Space for */
11207c478bd9Sstevel@tonic-gate #define	KEY_F(n)	(KEY_F0-(n))    	/* 64 keys is reserved. */
11217c478bd9Sstevel@tonic-gate #define	KEY_DL		(__KEY_BASE-73)		/* Delete line */
11227c478bd9Sstevel@tonic-gate #define	KEY_IL		(__KEY_BASE-74)		/* Insert line */
11237c478bd9Sstevel@tonic-gate #define	KEY_DC		(__KEY_BASE-75)		/* Delete character */
11247c478bd9Sstevel@tonic-gate #define	KEY_IC		(__KEY_BASE-76)		/* Ins char / enter ins mode */
11257c478bd9Sstevel@tonic-gate #define	KEY_EIC		(__KEY_BASE-77)		/* Exit insert char mode */
11267c478bd9Sstevel@tonic-gate #define	KEY_CLEAR	(__KEY_BASE-78)		/* Clear screen */
11277c478bd9Sstevel@tonic-gate #define	KEY_EOS		(__KEY_BASE-79)		/* Clear to end of screen */
11287c478bd9Sstevel@tonic-gate #define	KEY_EOL		(__KEY_BASE-80)		/* Clear to end of line */
11297c478bd9Sstevel@tonic-gate #define	KEY_SF		(__KEY_BASE-81)		/* Scroll 1 line forward */
11307c478bd9Sstevel@tonic-gate #define	KEY_SR		(__KEY_BASE-82)		/* Scroll 1 line backwards */
11317c478bd9Sstevel@tonic-gate #define	KEY_NPAGE	(__KEY_BASE-83)		/* Next page */
11327c478bd9Sstevel@tonic-gate #define	KEY_PPAGE	(__KEY_BASE-84)		/* Previous page */
11337c478bd9Sstevel@tonic-gate #define	KEY_STAB	(__KEY_BASE-85)		/* Set tab */
11347c478bd9Sstevel@tonic-gate #define	KEY_CTAB	(__KEY_BASE-86)		/* Clear tab */
11357c478bd9Sstevel@tonic-gate #define	KEY_CATAB	(__KEY_BASE-87)		/* Clear all tabs */
11367c478bd9Sstevel@tonic-gate #define	KEY_ENTER	(__KEY_BASE-88)		/* Enter or send */
11377c478bd9Sstevel@tonic-gate #define	KEY_SRESET	(__KEY_BASE-89)		/* Soft (partial) reset */
11387c478bd9Sstevel@tonic-gate #define	KEY_RESET	(__KEY_BASE-90)		/* Hard reset */
11397c478bd9Sstevel@tonic-gate #define	KEY_PRINT	(__KEY_BASE-91)		/* Print or copy */
11407c478bd9Sstevel@tonic-gate #define	KEY_LL		(__KEY_BASE-92)		/* Move to lower left corner. */
11417c478bd9Sstevel@tonic-gate #define	KEY_A1		(__KEY_BASE-93)		/* Upper left of keypad */
11427c478bd9Sstevel@tonic-gate #define	KEY_A3		(__KEY_BASE-94) 	/* Upper rght of keypad */
11437c478bd9Sstevel@tonic-gate #define	KEY_B2		(__KEY_BASE-95) 	/* Center of keypad */
11447c478bd9Sstevel@tonic-gate #define	KEY_C1		(__KEY_BASE-96) 	/* Lower left of keypad */
11457c478bd9Sstevel@tonic-gate #define	KEY_C3		(__KEY_BASE-97) 	/* Lower right of keypad */
11467c478bd9Sstevel@tonic-gate #define	KEY_BTAB	(__KEY_BASE-98) 	/* Back Tab */
11477c478bd9Sstevel@tonic-gate #define	KEY_BEG		(__KEY_BASE-99) 	/* Beginning */
11487c478bd9Sstevel@tonic-gate #define	KEY_CANCEL	(__KEY_BASE-100)
11497c478bd9Sstevel@tonic-gate #define	KEY_CLOSE	(__KEY_BASE-101)
11507c478bd9Sstevel@tonic-gate #define	KEY_COMMAND	(__KEY_BASE-102)
11517c478bd9Sstevel@tonic-gate #define	KEY_COPY	(__KEY_BASE-103)
11527c478bd9Sstevel@tonic-gate #define	KEY_CREATE	(__KEY_BASE-104)
11537c478bd9Sstevel@tonic-gate #define	KEY_END		(__KEY_BASE-105)
11547c478bd9Sstevel@tonic-gate #define	KEY_EXIT	(__KEY_BASE-106)
11557c478bd9Sstevel@tonic-gate #define	KEY_FIND	(__KEY_BASE-107)
11567c478bd9Sstevel@tonic-gate #define	KEY_HELP	(__KEY_BASE-108)
11577c478bd9Sstevel@tonic-gate #define	KEY_MARK	(__KEY_BASE-109)
11587c478bd9Sstevel@tonic-gate #define	KEY_MESSAGE	(__KEY_BASE-110)
11597c478bd9Sstevel@tonic-gate #define	KEY_MOUSE	(__KEY_BASE-111)	/* Mouse event occured */
11607c478bd9Sstevel@tonic-gate #define	KEY_MOVE	(__KEY_BASE-112)
11617c478bd9Sstevel@tonic-gate #define	KEY_NEXT	(__KEY_BASE-113)	/* Next object */
11627c478bd9Sstevel@tonic-gate #define	KEY_OPEN	(__KEY_BASE-114)
11637c478bd9Sstevel@tonic-gate #define	KEY_OPTIONS	(__KEY_BASE-115)
11647c478bd9Sstevel@tonic-gate #define	KEY_PREVIOUS	(__KEY_BASE-116)	/* Previous object */
11657c478bd9Sstevel@tonic-gate #define	KEY_REDO	(__KEY_BASE-117)
11667c478bd9Sstevel@tonic-gate #define	KEY_REFERENCE	(__KEY_BASE-118)
11677c478bd9Sstevel@tonic-gate #define	KEY_REFRESH	(__KEY_BASE-119)
11687c478bd9Sstevel@tonic-gate #define	KEY_REPLACE	(__KEY_BASE-120)
11697c478bd9Sstevel@tonic-gate #define	KEY_RESTART	(__KEY_BASE-121)
11707c478bd9Sstevel@tonic-gate #define	KEY_RESUME	(__KEY_BASE-122)
11717c478bd9Sstevel@tonic-gate #define	KEY_SAVE	(__KEY_BASE-123)
11727c478bd9Sstevel@tonic-gate #define	KEY_SBEG	(__KEY_BASE-124)	/* Shifted keys */
11737c478bd9Sstevel@tonic-gate #define	KEY_SCANCEL	(__KEY_BASE-125)
11747c478bd9Sstevel@tonic-gate #define	KEY_SCOMMAND	(__KEY_BASE-126)
11757c478bd9Sstevel@tonic-gate #define	KEY_SCOPY	(__KEY_BASE-127)
11767c478bd9Sstevel@tonic-gate #define	KEY_SCREATE	(__KEY_BASE-128)
11777c478bd9Sstevel@tonic-gate #define	KEY_SDC		(__KEY_BASE-129)
11787c478bd9Sstevel@tonic-gate #define	KEY_SDL		(__KEY_BASE-130)
11797c478bd9Sstevel@tonic-gate #define	KEY_SELECT	(__KEY_BASE-131)	/* Select */
11807c478bd9Sstevel@tonic-gate #define	KEY_SEND	(__KEY_BASE-132)	/* Shifted end key */
11817c478bd9Sstevel@tonic-gate #define	KEY_SEOL	(__KEY_BASE-133)
11827c478bd9Sstevel@tonic-gate #define	KEY_SEXIT	(__KEY_BASE-134)
11837c478bd9Sstevel@tonic-gate #define	KEY_SFIND	(__KEY_BASE-135)
11847c478bd9Sstevel@tonic-gate #define	KEY_SHELP	(__KEY_BASE-136)
11857c478bd9Sstevel@tonic-gate #define	KEY_SHOME	(__KEY_BASE-137)
11867c478bd9Sstevel@tonic-gate #define	KEY_SIC		(__KEY_BASE-138)
11877c478bd9Sstevel@tonic-gate #define	KEY_SLEFT	(__KEY_BASE-139)
11887c478bd9Sstevel@tonic-gate #define	KEY_SMESSAGE	(__KEY_BASE-140)
11897c478bd9Sstevel@tonic-gate #define	KEY_SMOVE	(__KEY_BASE-141)
11907c478bd9Sstevel@tonic-gate #define	KEY_SNEXT	(__KEY_BASE-142)
11917c478bd9Sstevel@tonic-gate #define	KEY_SOPTIONS	(__KEY_BASE-143)
11927c478bd9Sstevel@tonic-gate #define	KEY_SPREVIOUS	(__KEY_BASE-144)
11937c478bd9Sstevel@tonic-gate #define	KEY_SPRINT	(__KEY_BASE-145)
11947c478bd9Sstevel@tonic-gate #define	KEY_SREDO	(__KEY_BASE-146)
11957c478bd9Sstevel@tonic-gate #define	KEY_SREPLACE	(__KEY_BASE-147)
11967c478bd9Sstevel@tonic-gate #define	KEY_SRIGHT	(__KEY_BASE-148)
11977c478bd9Sstevel@tonic-gate #define	KEY_SRSUME	(__KEY_BASE-149)
11987c478bd9Sstevel@tonic-gate #define	KEY_SSAVE	(__KEY_BASE-150)
11997c478bd9Sstevel@tonic-gate #define	KEY_SSUSPEND	(__KEY_BASE-151)
12007c478bd9Sstevel@tonic-gate #define	KEY_SUNDO	(__KEY_BASE-152)
12017c478bd9Sstevel@tonic-gate #define	KEY_SUSPEND	(__KEY_BASE-153)
12027c478bd9Sstevel@tonic-gate #define	KEY_UNDO	(__KEY_BASE-154)
12037c478bd9Sstevel@tonic-gate 
12047c478bd9Sstevel@tonic-gate #define	__KEY_MIN	(__KEY_BASE-155)
12057c478bd9Sstevel@tonic-gate 
12067c478bd9Sstevel@tonic-gate #endif /* __M_CURSES_H__ */
1207