Home | History | Annotate | Line # | Download | only in libcurses
curses.h revision 1.54
      1 /*	$NetBSD: curses.h,v 1.54 2001/01/05 22:57:56 christos Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1981, 1993, 1994
      5  *	The Regents of the University of California.  All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. All advertising materials mentioning features or use of this software
     16  *    must display the following acknowledgement:
     17  *	This product includes software developed by the University of
     18  *	California, Berkeley and its contributors.
     19  * 4. Neither the name of the University nor the names of its contributors
     20  *    may be used to endorse or promote products derived from this software
     21  *    without specific prior written permission.
     22  *
     23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33  * SUCH DAMAGE.
     34  *
     35  *	@(#)curses.h	8.5 (Berkeley) 4/29/95
     36  */
     37 
     38 #ifndef _CURSES_H_
     39 #define	_CURSES_H_
     40 
     41 #include <sys/types.h>
     42 #include <sys/cdefs.h>
     43 #include <wchar.h>
     44 
     45 #include <stdio.h>
     46 #include <termcap.h>
     47 
     48 /*
     49  * attr_t must be the same size as wchar_t (see <wchar.h>) to avoid padding
     50  * in __LDATA.
     51  */
     52 typedef wchar_t	chtype;
     53 typedef wchar_t	attr_t;
     54 
     55 /* C++ already defines bool. */
     56 #ifndef __cplusplus
     57 typedef	char	bool;
     58 #endif
     59 
     60 #ifndef TRUE
     61 #define	TRUE	(/*CONSTCOND*/1)
     62 #endif
     63 #ifndef FALSE
     64 #define	FALSE	(/*CONSTCOND*/0)
     65 #endif
     66 
     67 /*
     68  * The following #defines and #includes are present for backward
     69  * compatibility only.  They should not be used in future code.
     70  *
     71  * START BACKWARD COMPATIBILITY ONLY.
     72  */
     73 #ifndef _CURSES_PRIVATE
     74 
     75 #define	_puts(s)	tputs(s, 0, __cputchar)
     76 #define	_putchar(c)	__cputchar(c)
     77 
     78 /* Old-style terminal modes access. */
     79 #define	baudrate()	(cfgetospeed(&__baset))
     80 #define	crmode()	cbreak()
     81 #define	nocrmode()	nocbreak()
     82 #define	ospeed		(cfgetospeed(&__baset))
     83 #endif /* _CURSES_PRIVATE */
     84 
     85 /* Termcap capabilities. */
     86 extern char	__tc_am, __tc_bs, __tc_cc, __tc_da, __tc_eo,
     87 		__tc_hc, __tc_hl, __tc_in, __tc_mi, __tc_ms,
     88 		__tc_nc, __tc_ns, __tc_os, __tc_ul, __tc_ut,
     89 		__tc_xb, __tc_xn, __tc_xt, __tc_xs, __tc_xx;
     90 extern char	__CA;
     91 extern int	__tc_pa, __tc_Co, __tc_NC;
     92 extern char	*__tc_ac, *__tc_AB, *__tc_ae, *__tc_AF, *__tc_AL,
     93 		*__tc_al, *__tc_as, *__tc_bc, *__tc_bl, *__tc_bt,
     94 		*__tc_cd, *__tc_ce, *__tc_cl, *__tc_cm, *__tc_cr,
     95 		*__tc_cs, *__tc_dc, *__tc_DL, *__tc_dl, *__tc_dm,
     96 		*__tc_DO, *__tc_do, *__tc_eA, *__tc_ed, *__tc_ei,
     97 		*__tc_ho, *__tc_Ic, *__tc_ic, *__tc_im, *__tc_Ip,
     98 		*__tc_ip, *__tc_k0, *__tc_k1, *__tc_k2, *__tc_k3,
     99 		*__tc_k4, *__tc_k5, *__tc_k6, *__tc_k7, *__tc_k8,
    100 		*__tc_k9, *__tc_kd, *__tc_ke, *__tc_kh, *__tc_kl,
    101 		*__tc_kr, *__tc_ks, *__tc_ku, *__tc_LE, *__tc_ll,
    102 		*__tc_ma, *__tc_mb, *__tc_md, *__tc_me, *__tc_mh,
    103 		*__tc_mk, *__tc_mm, *__tc_mo, *__tc_mp, *__tc_mr,
    104 		*__tc_nd, *__tc_nl, *__tc_oc, *__tc_op,
    105 		*__tc_rc, *__tc_RI, *__tc_Sb, *__tc_sc, *__tc_se,
    106 		*__tc_SF, *__tc_Sf, *__tc_sf, *__tc_so, *__tc_sp,
    107 		*__tc_SR, *__tc_sr, *__tc_ta, *__tc_te, *__tc_ti,
    108 		*__tc_uc, *__tc_ue, *__tc_UP, *__tc_up, *__tc_us,
    109 		*__tc_vb, *__tc_ve, *__tc_vi, *__tc_vs;
    110 
    111 #ifdef _CURSES_TERMCAP_COMPAT
    112 #define	AM		__tc_am
    113 #define	BS		__tc_bs
    114 #define	CA		__tc_cc
    115 #define	DA		__tc_da
    116 #define	EO		__tc_eo
    117 #define	HC		__tc_hc
    118 #define	IN		__tc_in
    119 #define	MI		__tc_mi
    120 #define	MS		__tc_ms
    121 #define	NC		__tc_nc
    122 #define	NS		__tc_ns
    123 #define	OS		__tc_os
    124 #define	UL		__tc_ul
    125 #define	XB		__tc_xb
    126 #define	XN		__tc_xn
    127 #define	XT		__tc_xt
    128 #define	XS		__tc_xs
    129 #define	XX		__tc_xx
    130 #define	AL		__tc_AL
    131 #define	BC		__tc_bc
    132 #define	BT		__tc_bt
    133 #define	CD		__tc_cd
    134 #define	CE		__tc_ce
    135 #define	CL		__tc_cl
    136 #define	CM		__tc_cm
    137 #define	CR		__tc_cr
    138 #define	CS		__tc_cs
    139 #define	DC		__tc_dc
    140 #define	DL		__tc_DL
    141 #define	DM		__tc_dm
    142 #define	DO		__tc_do
    143 #define	ED		__tc_ed
    144 #define	EI		__tc_ei
    145 #define	K0		__tc_k0
    146 #define	K1		__tc_k1
    147 #define	K2		__tc_k2
    148 #define	K3		__tc_k3
    149 #define	K4		__tc_k4
    150 #define	K5		__tc_k5
    151 #define	K6		__tc_k6
    152 #define	K7		__tc_k7
    153 #define	K8		__tc_k8
    154 #define	K9		__tc_k9
    155 #define	HO		__tc_ho
    156 #define	IC		__tc_ic
    157 #define	IM		__tc_im
    158 #define	IP		__tc_ip
    159 #define	KD		__tc_kd
    160 #define	KE		__tc_ke
    161 #define	KH		__tc_kh
    162 #define	KL		__tc_kl
    163 #define	KR		__tc_kr
    164 #define	KS		__tc_ks
    165 #define	KU		__tc_ku
    166 #define	LL		__tc_ll
    167 #define	MA		__tc_ma
    168 #define	ND		__tc_nd
    169 #define	NL		__tc_nl
    170 #define	RC		__tc_rc
    171 #define	SC		__tc_sc
    172 #define	SE		__tc_se
    173 #define	SF		__tc_SF
    174 #define	SO		__tc_so
    175 #define	SR		__tc_SR
    176 #define	TA		__tc_ta
    177 #define	TE		__tc_te
    178 #define	TI		__tc_ti
    179 #define	UC		__tc_uc
    180 #define	UE		__tc_ue
    181 #define	UP		__tc_up
    182 #define	US		__tc_us
    183 #define	VB		__tc_vb
    184 #define	VS		__tc_vs
    185 #define	VE		__tc_ve
    186 #define	al		__tc_al
    187 #define	dl		__tc_dl
    188 #define	sf		__tc_sf
    189 #define	sr		__tc_sr
    190 #define	AL_PARM		__tc_AL
    191 #define	DL_PARM		__tc_DL
    192 #define	UP_PARM		__tc_UP
    193 #define	DOWN_PARM	__tc_DO
    194 #define	LEFT_PARM	__tc_LE
    195 #define	RIGHT_PARM	__tc_RI
    196 #endif /* _CURSES_TERMCAP_COMPAT */
    197 
    198 /* END BACKWARD COMPATIBILITY ONLY. */
    199 
    200 /* symbols for values returned by getch in keypad mode */
    201 #define    KEY_MIN        0x101    /* minimum extended key value */
    202 #define    KEY_BREAK      0x101    /* break key */
    203 #define    KEY_DOWN       0x102    /* down arrow */
    204 #define    KEY_UP         0x103    /* up arrow */
    205 #define    KEY_LEFT       0x104    /* left arrow */
    206 #define    KEY_RIGHT      0x105    /* right arrow*/
    207 #define    KEY_HOME       0x106    /* home key */
    208 #define    KEY_BACKSPACE  0x107    /* Backspace */
    209 
    210 /* First function key (block of 64 follow) */
    211 #define    KEY_F0         0x108
    212 /* Function defining other function key values*/
    213 #define    KEY_F(n)       (KEY_F0+(n))
    214 
    215 #define    KEY_DL         0x148    /* Delete Line */
    216 #define    KEY_IL         0x149    /* Insert Line*/
    217 #define    KEY_DC         0x14A    /* Delete Character */
    218 #define    KEY_IC         0x14B    /* Insert Character */
    219 #define    KEY_EIC        0x14C    /* Exit Insert Char mode */
    220 #define    KEY_CLEAR      0x14D    /* Clear screen */
    221 #define    KEY_EOS        0x14E    /* Clear to end of screen */
    222 #define    KEY_EOL        0x14F    /* Clear to end of line */
    223 #define    KEY_SF         0x150    /* Scroll one line forward */
    224 #define    KEY_SR         0x151    /* Scroll one line back */
    225 #define    KEY_NPAGE      0x152    /* Next Page */
    226 #define    KEY_PPAGE      0x153    /* Prev Page */
    227 #define    KEY_STAB       0x154    /* Set Tab */
    228 #define    KEY_CTAB       0x155    /* Clear Tab */
    229 #define    KEY_CATAB      0x156    /* Clear All Tabs */
    230 #define    KEY_ENTER      0x157    /* Enter or Send */
    231 #define    KEY_SRESET     0x158    /* Soft Reset */
    232 #define    KEY_RESET      0x159    /* Hard Reset */
    233 #define    KEY_PRINT      0x15A    /* Print */
    234 #define    KEY_LL         0x15B    /* Home Down */
    235 
    236 /*
    237  * "Keypad" keys arranged like this:
    238  *
    239  *  A1   up  A3
    240  * left  B2 right
    241  *  C1  down C3
    242  *
    243  */
    244 #define    KEY_A1         0x15C    /* Keypad upper left */
    245 #define    KEY_A3         0x15D    /* Keypad upper right */
    246 #define    KEY_B2         0x15E    /* Keypad centre key */
    247 #define    KEY_C1         0x15F    /* Keypad lower left */
    248 #define    KEY_C3         0x160    /* Keypad lower right */
    249 
    250 #define    KEY_BTAB       0x161    /* Back Tab */
    251 #define    KEY_BEG        0x162    /* Begin key */
    252 #define    KEY_CANCEL     0x163    /* Cancel key */
    253 #define    KEY_CLOSE      0x164    /* Close Key */
    254 #define    KEY_COMMAND    0x165    /* Command Key */
    255 #define    KEY_COPY       0x166    /* Copy key */
    256 #define    KEY_CREATE     0x167    /* Create key */
    257 #define    KEY_END        0x168    /* End key */
    258 #define    KEY_EXIT       0x169    /* Exit key */
    259 #define    KEY_FIND       0x16A    /* Find key */
    260 #define    KEY_HELP       0x16B    /* Help key */
    261 #define    KEY_MARK       0x16C    /* Mark key */
    262 #define    KEY_MESSAGE    0x16D    /* Message key */
    263 #define    KEY_MOVE       0x16E    /* Move key */
    264 #define    KEY_NEXT       0x16F    /* Next Object key */
    265 #define    KEY_OPEN       0x170    /* Open key */
    266 #define    KEY_OPTIONS    0x171    /* Options key */
    267 #define    KEY_PREVIOUS   0x172    /* Previous Object key */
    268 #define    KEY_REDO       0x173    /* Redo key */
    269 #define    KEY_REFERENCE  0x174    /* Ref Key */
    270 #define    KEY_REFRESH    0x175    /* Refresh key */
    271 #define    KEY_REPLACE    0x176    /* Replace key */
    272 #define    KEY_RESTART    0x177    /* Restart key */
    273 #define    KEY_RESUME     0x178    /* Resume key */
    274 #define    KEY_SAVE       0x179    /* Save key */
    275 #define    KEY_SBEG       0x17A    /* Shift begin key */
    276 #define    KEY_SCANCEL    0x17B    /* Shift Cancel key */
    277 #define    KEY_SCOMMAND   0x17C    /* Shift Command key */
    278 #define    KEY_SCOPY      0x17D    /* Shift Copy key */
    279 #define    KEY_SCREATE    0x17E    /* Shift Create key */
    280 #define    KEY_SDC        0x17F    /* Shift Delete Character */
    281 #define    KEY_SDL        0x180    /* Shift Delete Line */
    282 #define    KEY_SELECT     0x181    /* Select key */
    283 #define    KEY_SEND       0x182    /* Send key */
    284 #define    KEY_SEOL       0x183    /* Shift Clear Line key */
    285 #define    KEY_SEXIT      0x184    /* Shift Exit key */
    286 #define    KEY_SFIND      0x185    /* Shift Find key */
    287 #define    KEY_SHELP      0x186    /* Shift Help key */
    288 #define    KEY_SHOME      0x187    /* Shift Home key */
    289 #define    KEY_SIC        0x188    /* Shift Input key */
    290 #define    KEY_SLEFT      0x189    /* Shift Left Arrow key */
    291 #define    KEY_SMESSAGE   0x18A    /* Shift Message key */
    292 #define    KEY_SMOVE      0x18B    /* Shift Move key */
    293 #define    KEY_SNEXT      0x18C    /* Shift Next key */
    294 #define    KEY_SOPTIONS   0x18D    /* Shift Options key */
    295 #define    KEY_SPREVIOUS  0x18E    /* Shift Previous key */
    296 #define    KEY_SPRINT     0x18F    /* Shift Print key */
    297 #define    KEY_SREDO      0x190    /* Shift Redo key */
    298 #define    KEY_SREPLACE   0x191    /* Shift Replace key */
    299 #define    KEY_SRIGHT     0x192    /* Shift Right Arrow key */
    300 #define    KEY_SRSUME     0x193    /* Shift Resume key */
    301 #define    KEY_SSAVE      0x194    /* Shift Save key */
    302 #define    KEY_SSUSPEND   0x195    /* Shift Suspend key */
    303 #define    KEY_SUNDO      0x196    /* Shift Undo key */
    304 #define    KEY_SUSPEND    0x197    /* Suspend key */
    305 #define    KEY_UNDO       0x198    /* Undo key */
    306 #define    KEY_MOUSE      0x199    /* Mouse event has occured */
    307 #define    KEY_MAX        0x199    /* maximum extended key value */
    308 
    309 /* 8-bit ASCII characters. */
    310 #define	unctrl(c)		__unctrl[((unsigned)c) & 0xff]
    311 #define	unctrllen(ch)		__unctrllen[((unsigned)ch) & 0xff]
    312 
    313 extern char	 *__unctrl[256];	/* Control strings. */
    314 extern char	 __unctrllen[256];	/* Control strings length. */
    315 
    316 /*
    317  * A window an array of __LINE structures pointed to by the 'lines' pointer.
    318  * A line is an array of __LDATA structures pointed to by the 'line' pointer.
    319  */
    320 
    321 /*
    322  * Definitions for characters and attributes in __LDATA
    323  */
    324 #define __CHARTEXT	0x000000ff	/* bits for 8-bit characters */
    325 #define __NORMAL	0x00000000	/* Added characters are normal. */
    326 #define __STANDOUT	0x00010000	/* Added characters are standout. */
    327 #define __UNDERSCORE	0x00020000	/* Added characters are underscored. */
    328 #define __REVERSE	0x00040000	/* Added characters are reverse
    329 					   video. */
    330 #define __BLINK		0x00080000	/* Added characters are blinking. */
    331 #define __DIM		0x00100000	/* Added characters are dim. */
    332 #define __BOLD		0x00200000	/* Added characters are bold. */
    333 #define __BLANK		0x00400000	/* Added characters are blanked. */
    334 #define __PROTECT	0x00800000	/* Added characters are protected. */
    335 #define __ALTCHARSET	0x01000000	/* Added characters are ACS */
    336 #define __COLOR		0x7e000000	/* Color bits */
    337 #define __ATTRIBUTES	0x7fff0000	/* All 8-bit attribute bits */
    338 
    339 typedef struct __ldata __LDATA;
    340 typedef struct __line  __LINE;
    341 typedef struct __window  WINDOW;
    342 
    343 /*
    344  * Attribute definitions
    345  */
    346 #define	A_NORMAL	__NORMAL
    347 #define	A_STANDOUT	__STANDOUT
    348 #define	A_UNDERLINE	__UNDERSCORE
    349 #define	A_REVERSE	__REVERSE
    350 #define	A_BLINK		__BLINK
    351 #define	A_DIM		__DIM
    352 #define	A_BOLD		__BOLD
    353 #define	A_BLANK		__BLANK
    354 #define	A_PROTECT	__PROTECT
    355 #define	A_ALTCHARSET	__ALTCHARSET
    356 #define	A_ATTRIBUTES	__ATTRIBUTES
    357 #define	A_CHARTEXT	__CHARTEXT
    358 #define	A_COLOR		__COLOR
    359 
    360 /*
    361  * Alternate character set definitions
    362  */
    363 
    364 #define	NUM_ACS	128
    365 
    366 extern chtype _acs_char[NUM_ACS];
    367 
    368 #define	ACS_RARROW	_acs_char['+']
    369 #define	ACS_LARROW	_acs_char[',']
    370 #define	ACS_UARROW	_acs_char['-']
    371 #define	ACS_DARROW	_acs_char['.']
    372 #define	ACS_BLOCK	_acs_char['0']
    373 #define	ACS_DIAMOND	_acs_char['`']
    374 #define	ACS_CKBOARD	_acs_char['a']
    375 #define	ACS_DEGREE	_acs_char['f']
    376 #define	ACS_PLMINUS	_acs_char['g']
    377 #define	ACS_BOARD	_acs_char['h']
    378 #define	ACS_LANTERN	_acs_char['i']
    379 #define	ACS_LRCORNER	_acs_char['j']
    380 #define	ACS_URCORNER	_acs_char['k']
    381 #define	ACS_ULCORNER	_acs_char['l']
    382 #define	ACS_LLCORNER	_acs_char['m']
    383 #define	ACS_PLUS	_acs_char['n']
    384 #define	ACS_HLINE	_acs_char['q']
    385 #define	ACS_S1		_acs_char['o']
    386 #define	ACS_S9		_acs_char['s']
    387 #define	ACS_LTEE	_acs_char['t']
    388 #define	ACS_RTEE	_acs_char['u']
    389 #define	ACS_BTEE	_acs_char['v']
    390 #define	ACS_TTEE	_acs_char['w']
    391 #define	ACS_VLINE	_acs_char['x']
    392 #define	ACS_BULLET	_acs_char['~']
    393 
    394 /* System V compatability */
    395 #define	ACS_SBBS	ACS_LRCORNER
    396 #define	ACS_BBSS	ACS_URCORNER
    397 #define	ACS_BSSB	ACS_ULCORNER
    398 #define	ACS_SSBB	ACS_LLCORNER
    399 #define	ACS_SSSS	ACS_PLUS
    400 #define	ACS_BSBS	ACS_HLINE
    401 #define	ACS_SSSB	ACS_LTEE
    402 #define	ACS_SBSS	ACS_RTEE
    403 #define	ACS_SSBS	ACS_BTEE
    404 #define	ACS_BSSS	ACS_TTEE
    405 #define	ACS_SBSB	ACS_VLINE
    406 #define	_acs_map	_acs_char
    407 
    408 /*
    409  * Colour definitions (ANSI colour numbers)
    410  */
    411 
    412 #define	COLOR_BLACK	0x00
    413 #define	COLOR_RED	0x01
    414 #define	COLOR_GREEN	0x02
    415 #define	COLOR_YELLOW	0x03
    416 #define	COLOR_BLUE	0x04
    417 #define	COLOR_MAGENTA	0x05
    418 #define	COLOR_CYAN	0x06
    419 #define	COLOR_WHITE	0x07
    420 
    421 #define	COLOR_PAIR(n)	((((u_int32_t)n) << 25) & A_COLOR)
    422 #define	PAIR_NUMBER(n)	((((u_int32_t)n) & A_COLOR) >> 25)
    423 
    424 /* Curses external declarations. */
    425 extern WINDOW	*curscr;		/* Current screen. */
    426 extern WINDOW	*stdscr;		/* Standard screen. */
    427 
    428 extern struct termios __orig_termios;	/* Terminal state before curses */
    429 extern struct termios __baset;		/* Our base terminal state */
    430 extern int	__tcaction;		/* If terminal hardware set. */
    431 
    432 extern int	 COLS;			/* Columns on the screen. */
    433 extern int	 LINES;			/* Lines on the screen. */
    434 extern int	 COLORS;		/* Max colours on the screen. */
    435 extern int	 COLOR_PAIRS;		/* Max colour pairs on the screen. */
    436 
    437 extern char	*ttytype;		/* Full name of current terminal. */
    438 
    439 #define	ERR	(0)			/* Error return. */
    440 #define	OK	(1)			/* Success return. */
    441 
    442 /*
    443  * The following have, traditionally, been macros but X/Open say they
    444  * need to be functions.  Keep the old macros for debugging.
    445  */
    446 #ifdef _CURSES_USE_MACROS
    447 /* Standard screen pseudo functions. */
    448 #define	addbytes(s, n)			__waddbytes(stdscr, s, n, 0)
    449 #define	addch(ch)			waddch(stdscr, ch)
    450 #define	addnstr(s, n)			waddnstr(stdscr, s, n)
    451 #define	addstr(s)			waddnstr(stdscr, s, -1)
    452 #define bkgd(ch)			wbkgd(stdscr, ch)
    453 #define bkgdset(ch)			wbkgdset(stdscr, ch)
    454 #define	border(l, r, t, b, tl, tr, bl, br) \
    455 	wborder(stdscr, l, r, t, b, tl, tr, bl, br)
    456 #define	clear()				wclear(stdscr)
    457 #define	clrtobot()			wclrtobot(stdscr)
    458 #define	clrtoeol()			wclrtoeol(stdscr)
    459 #define	delch()				wdelch(stdscr)
    460 #define	deleteln()			wdeleteln(stdscr)
    461 #define	erase()				werase(stdscr)
    462 #define	getch()				wgetch(stdscr)
    463 #define	getstr(s)			wgetstr(stdscr, s)
    464 #define	inch()				winch(stdscr)
    465 #define	inchnstr(c)			winchnstr(stdscr, c)
    466 #define	inchstr(c)			winchstr(stdscr, c)
    467 #define	innstr(s, n)			winnstr(stdscr, s, n)
    468 #define	insch(ch)			winsch(stdscr, ch)
    469 #define	insdelln(n)			winsdelln(stdscr, n)
    470 #define	insertln()			winsertln(stdscr)
    471 #define	instr(s)			winstr(stdscr, s)
    472 #define	move(y, x)			wmove(stdscr, y, x)
    473 #define	refresh()			wrefresh(stdscr)
    474 #define	scrl(n)				wscrl(stdscr, n)
    475 #define	standend()			wstandend(stdscr)
    476 #define	standout()			wstandout(stdscr)
    477 #define	timeout(delay)			wtimeout(stdscr, delay)
    478 #define	underscore()			wunderscore(stdscr)
    479 #define	underend()			wunderend(stdscr)
    480 #define	attron(attr)			wattron(stdscr, attr)
    481 #define	attroff(attr)			wattroff(stdscr, attr)
    482 #define	attrset(attr)			wattrset(stdscr, attr)
    483 #define	waddbytes(w, s, n)		__waddbytes(w, s, n, 0)
    484 #define	waddstr(w, s)			waddnstr(w, s, -1)
    485 
    486 /* Standard screen plus movement pseudo functions. */
    487 #define	mvaddbytes(y, x, s, n)		mvwaddbytes(stdscr, y, x, s, n)
    488 #define	mvaddch(y, x, ch)		mvwaddch(stdscr, y, x, ch)
    489 #define	mvaddnstr(y, x, s, n)		mvwaddnstr(stdscr, y, x, s, n)
    490 #define	mvaddstr(y, x, s)		mvwaddstr(stdscr, y, x, s)
    491 #define	mvdelch(y, x)			mvwdelch(stdscr, y, x)
    492 #define	mvgetch(y, x)			mvwgetch(stdscr, y, x)
    493 #define	mvgetstr(y, x, s)		mvwgetstr(stdscr, y, x, s)
    494 #define	mvinch(y, x)			mvwinch(stdscr, y, x)
    495 #define	mvinchnstr(y, x, c, n)		mvwinchnstr(stdscr, y, x, c, n)
    496 #define	mvinchstr(y, x, c)		mvwinchstr(stdscr, y, x, c)
    497 #define	mvinnstr(y, x, s, n)		mvwinnstr(stdscr, y, x, s, n)
    498 #define	mvinsch(y, x, c)		mvwinsch(stdscr, y, x, c)
    499 #define	mvinstr(y, x, s)		mvwinstr(stdscr, y, x, s)
    500 #define	mvwaddbytes(w, y, x, s, n) \
    501 	(wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, n, 0))
    502 #define	mvwaddch(w, y, x, ch) \
    503 	(wmove(w, y, x) == ERR ? ERR : waddch(w, ch))
    504 #define	mvwaddnstr(w, y, x, s, n) \
    505 	(wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, n))
    506 #define	mvwaddstr(w, y, x, s) \
    507 	(wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, -1))
    508 #define	mvwdelch(w, y, x) \
    509 	(wmove(w, y, x) == ERR ? ERR : wdelch(w))
    510 #define	mvwgetch(w, y, x) \
    511 	(wmove(w, y, x) == ERR ? ERR : wgetch(w))
    512 #define	mvwgetstr(w, y, x, s) \
    513 	(wmove(w, y, x) == ERR ? ERR : wgetstr(w, s))
    514 #define	mvwinch(w, y, x) \
    515 	(wmove(w, y, x) == ERR ? ERR : winch(w))
    516 #define	mvwinchnstr(w, y, x, c, n) \
    517 	(wmove(w, y, x) == ERR ? ERR : winchnstr(w, c, n))
    518 #define	mvwinchstr(w, y, x, s) \
    519 	(wmove(w, y, x) == ERR ? ERR : winchstr(w, c))
    520 #define	mvwinnstr(w, y, x, s, n) \
    521 	(wmove(w, y, x) == ERR ? ERR : winnstr(w, s, n))
    522 #define	mvwinsch(w, y, x, c) \
    523 	(wmove(w, y, x) == ERR ? ERR : winsch(w, c))
    524 #define	mvwinstr(w, y, x, s) \
    525 	(wmove(w, y, x) == ERR ? ERR : winstr(w, s))
    526 
    527 #define	getyx(w, y, x)		(y) = getcury(w), (x) = getcurx(w)
    528 #define	getbegyx(w, y, x)	(y) = getbegy(w), (x) = getbegx(w)
    529 #define	getmaxyx(w, y, x)	(y) = getmaxy(w), (x) = getmaxx(w)
    530 
    531 #else
    532 /* Use functions not macros... */
    533 __BEGIN_DECLS
    534 int	 addbytes(const char *, int);
    535 int	 addch(chtype);
    536 int	 addnstr(const char *, int);
    537 int	 addstr(const char *);
    538 int	 bkgd(chtype);
    539 void	 bkgdset(chtype);
    540 int	 border(chtype, chtype, chtype, chtype,
    541 	   chtype, chtype, chtype, chtype);
    542 int	 clear(void);
    543 int	 clrtobot(void);
    544 int	 clrtoeol(void);
    545 int	 delch(void);
    546 int	 deleteln(void);
    547 int	 erase(void);
    548 int	 getch(void);
    549 int	 getstr(char *);
    550 chtype	 inch(void);
    551 int	 inchnstr(chtype *, int);
    552 int	 inchstr(chtype *);
    553 int	 innstr(char *, int);
    554 int	 insch(chtype);
    555 int	 insdelln(int);
    556 int	 insertln(void);
    557 int	 instr(char *);
    558 int	 move(int, int);
    559 int	 refresh(void);
    560 int	 scrl(int);
    561 int	 standend(void);
    562 int	 standout(void);
    563 void	 timeout(int);
    564 int	 underscore(void);
    565 int	 underend(void);
    566 int	 attron(int);
    567 int	 attroff(int);
    568 int	 attrset(int);
    569 int	 waddbytes(WINDOW *, const char *, int);
    570 int	 waddstr(WINDOW *, const char *);
    571 
    572 /* Standard screen plus movement functions. */
    573 int	 mvaddbytes(int, int, const char *, int);
    574 int	 mvaddch(int, int, chtype);
    575 int	 mvaddnstr(int, int, const char *, int);
    576 int	 mvaddstr(int, int, const char *);
    577 int	 mvdelch(int, int);
    578 int	 mvgetch(int, int);
    579 int	 mvgetstr(int, int, char *);
    580 chtype	 mvinch(int, int);
    581 int	 mvinchnstr(int, int, chtype *, int);
    582 int	 mvinchstr(int, int, chtype *);
    583 int	 mvinnstr(int, int, char *, int);
    584 int	 mvinsch(int, int, chtype);
    585 int	 mvinstr(int, int, char *);
    586 
    587 int	 mvwaddbytes(WINDOW *, int, int, const char *, int);
    588 int	 mvwaddch(WINDOW *, int, int, chtype);
    589 int	 mvwaddnstr(WINDOW *, int, int, const char *, int);
    590 int	 mvwaddstr(WINDOW *, int, int, const char *);
    591 int	 mvwdelch(WINDOW *, int, int);
    592 int	 mvwgetch(WINDOW *, int, int);
    593 int	 mvwgetstr(WINDOW *, int, int, char *);
    594 chtype	 mvwinch(WINDOW *, int, int);
    595 int	 mvwinsch(WINDOW *, int, int, chtype);
    596 __END_DECLS
    597 #endif /* _CURSES_USE_MACROS */
    598 
    599 #define	getyx(w, y, x)		(y) = getcury(w), (x) = getcurx(w)
    600 #define	getbegyx(w, y, x)	(y) = getbegy(w), (x) = getbegx(w)
    601 #define	getmaxyx(w, y, x)	(y) = getmaxy(w), (x) = getmaxx(w)
    602 
    603 /* Public function prototypes. */
    604 __BEGIN_DECLS
    605 int	 beep(void);
    606 int	 box(WINDOW *, chtype, chtype);
    607 bool	 can_change_colors(void);
    608 int	 cbreak(void);
    609 int	 clearok(WINDOW *, bool);
    610 int	 color_content(short, short *, short *, short *);
    611 int	 copywin(const WINDOW *, WINDOW *, int, int, int, int, int, int, int);
    612 int	 curs_set(int);
    613 int	 delay_output(int);
    614 int	 def_prog_mode(void);
    615 int	 def_shell_mode(void);
    616 int	 delwin(WINDOW *);
    617 WINDOW	*derwin(WINDOW *, int, int, int, int);
    618 WINDOW	*dupwin(WINDOW *);
    619 int	 doupdate(void);
    620 int	 echo(void);
    621 int	 endwin(void);
    622 char     erasechar(void);
    623 int	 flash(void);
    624 int	 flushinp(void);
    625 int	 flushok(WINDOW *, bool);
    626 char	*fullname(const char *, char *);
    627 chtype	 getattrs(WINDOW *);
    628 chtype	 getbkgd(WINDOW *);
    629 char	*getcap(char *);
    630 int	 getcury(WINDOW *);
    631 int	 getcurx(WINDOW *);
    632 int	 getbegy(WINDOW *);
    633 int	 getbegx(WINDOW *);
    634 int	 getmaxy(WINDOW *);
    635 int	 getmaxx(WINDOW *);
    636 int	 gettmode(void);
    637 bool	 has_colors(void);
    638 int	 hline(chtype, int);
    639 int	 idlok(WINDOW *, bool);
    640 int	 init_color(short, short, short, short);
    641 int	 init_pair(short, short, short);
    642 WINDOW	*initscr(void);
    643 int	 intrflush(WINDOW *, bool);
    644 bool	 isendwin(void);
    645 bool	 is_linetouched(WINDOW *, int);
    646 bool	 is_wintouched(WINDOW *);
    647 void	 keypad(WINDOW *, bool);
    648 char     killchar(void);
    649 int	 leaveok(WINDOW *, bool);
    650 char	*longname(void);
    651 int	 meta(WINDOW *, bool);
    652 int	 mvcur(int, int, int, int);
    653 int	 mvhline(int, int, chtype, int);
    654 int	 mvprintw(int, int, const char *, ...)
    655 		__attribute__((__format__(__printf__, 3, 4)));
    656 int	 mvscanw(int, int, const char *, ...)
    657 		__attribute__((__format__(__scanf__, 3, 4)));
    658 int	 mvvline(int, int, chtype, int);
    659 int	 mvwhline(WINDOW *, int, int, chtype, int);
    660 int	 mvwvline(WINDOW *, int, int, chtype, int);
    661 int	 mvwin(WINDOW *, int, int);
    662 int	 mvwinchnstr(WINDOW *, int, int, chtype *, int);
    663 int	 mvwinchstr(WINDOW *, int, int, chtype *);
    664 int	 mvwinnstr(WINDOW *, int, int, char *, int);
    665 int	 mvwinstr(WINDOW *, int, int, char *);
    666 int	 mvwprintw(WINDOW *, int, int, const char *, ...)
    667 		__attribute__((__format__(__printf__, 4, 5)));
    668 int	 mvwscanw(WINDOW *, int, int, const char *, ...)
    669 		__attribute__((__format__(__scanf__, 4, 5)));
    670 int	 napms(int);
    671 WINDOW	*newwin(int, int, int, int);
    672 int	 nl(void);
    673 int	 nocbreak(void);
    674 void	 nodelay(WINDOW *, bool);
    675 int	 noecho(void);
    676 int	 nonl(void);
    677 int	 noraw(void);
    678 int	 notimeout(WINDOW *, bool);
    679 int	 overlay(const WINDOW *, WINDOW *);
    680 int	 overwrite(const WINDOW *, WINDOW *);
    681 int	 pair_content(short, short *, short *);
    682 int	 printw(const char *, ...)
    683 		__attribute__((__format__(__printf__, 1, 2)));
    684 int	 raw(void);
    685 int	 reset_prog_mode(void);
    686 int	 reset_shell_mode(void);
    687 int	 resetty(void);
    688 int	 savetty(void);
    689 int	 scanw(const char *, ...)
    690 		__attribute__((__format__(__scanf__, 1, 2)));
    691 int	 scroll(WINDOW *);
    692 int	 scrollok(WINDOW *, bool);
    693 int	 setterm(char *);
    694 int	 start_color(void);
    695 WINDOW	*subwin(WINDOW *, int, int, int, int);
    696 int	 touchline(WINDOW *, int, int);
    697 int	 touchoverlap(WINDOW *, WINDOW *);
    698 int	 touchwin(WINDOW *);
    699 int	 ungetch(int);
    700 int	 untouchwin(WINDOW *);
    701 int	 vline(chtype, int);
    702 int	 vwprintw(WINDOW *, const char *, _BSD_VA_LIST_)
    703 		__attribute__((__format__(__printf__, 2, 0)));
    704 int	 vwscanw(WINDOW *, const char *, _BSD_VA_LIST_)
    705 		__attribute__((__format__(__scanf__, 2, 0)));
    706 int	 waddch(WINDOW *, chtype);
    707 int	 waddnstr(WINDOW *, const char *, int);
    708 int	 wattron(WINDOW *, int);
    709 int	 wattroff(WINDOW *, int);
    710 int	 wattrset(WINDOW *, int);
    711 int	 wbkgd(WINDOW *, chtype);
    712 void	 wbkgdset(WINDOW *, chtype);
    713 int	 wborder(WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype,
    714 		chtype, chtype);
    715 int	 wclear(WINDOW *);
    716 int	 wclrtobot(WINDOW *);
    717 int	 wclrtoeol(WINDOW *);
    718 int	 wdelch(WINDOW *);
    719 int	 wdeleteln(WINDOW *);
    720 int	 werase(WINDOW *);
    721 int	 wgetch(WINDOW *);
    722 int	 wgetstr(WINDOW *, char *);
    723 int	 whline(WINDOW *, chtype, int);
    724 chtype	 winch(WINDOW *);
    725 int	 winchnstr(WINDOW *, chtype *, int);
    726 int	 winchstr(WINDOW *, chtype *);
    727 int	 winnstr(WINDOW *, char *, int);
    728 int	 winsch(WINDOW *, chtype);
    729 int	 winsdelln(WINDOW *, int);
    730 int	 winsertln(WINDOW *);
    731 int	 winstr(WINDOW *, char *);
    732 int	 wmove(WINDOW *, int, int);
    733 int	 wnoutrefresh(WINDOW *);
    734 int	 wprintw(WINDOW *, const char *, ...)
    735 		__attribute__((__format__(__printf__, 2, 3)));
    736 int	 wrefresh(WINDOW *);
    737 int	 wscanw(WINDOW *, const char *, ...)
    738 		__attribute__((__format__(__scanf__, 2, 3)));
    739 int	 wscrl(WINDOW *, int);
    740 int	 wstandend(WINDOW *);
    741 int	 wstandout(WINDOW *);
    742 void	 wtimeout(WINDOW *, int);
    743 int	 wtouchln(WINDOW *, int, int, int);
    744 int	 wunderend(WINDOW *);
    745 int	 wunderscore(WINDOW *);
    746 int	 wvline(WINDOW *, chtype, int);
    747 
    748 /* Private functions that are needed for user programs prototypes. */
    749 int	 __cputchar(int);
    750 int	 __waddbytes(WINDOW *, const char *, int, attr_t);
    751 __END_DECLS
    752 
    753 #endif /* !_CURSES_H_ */
    754