Home | History | Annotate | Line # | Download | only in libcurses
curses.h revision 1.29.2.2
      1 /*	$NetBSD: curses.h,v 1.29.2.2 2000/03/05 23:22:16 jdc 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 type 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 typedef	char	bool;
     55 
     56 #ifndef TRUE
     57 #define	TRUE	(/*CONSTCOND*/1)
     58 #endif
     59 #ifndef FALSE
     60 #define	FALSE	(/*CONSTCOND*/0)
     61 #endif
     62 
     63 /*
     64  * The following #defines and #includes are present for backward
     65  * compatibility only.  They should not be used in future code.
     66  *
     67  * START BACKWARD COMPATIBILITY ONLY.
     68  */
     69 #ifndef _CURSES_PRIVATE
     70 
     71 #define	_puts(s)	tputs(s, 0, __cputchar)
     72 #define	_putchar(c)	__cputchar(c)
     73 
     74 /* Old-style terminal modes access. */
     75 #define	baudrate()	(cfgetospeed(&__baset))
     76 #define	crmode()	cbreak()
     77 #define	erasechar()	(__baset.c_cc[VERASE])
     78 #define	killchar()	(__baset.c_cc[VKILL])
     79 #define	nocrmode()	nocbreak()
     80 #define	ospeed		(cfgetospeed(&__baset))
     81 #endif /* _CURSES_PRIVATE */
     82 
     83 extern char	 GT;			/* Gtty indicates tabs. */
     84 extern char	 NONL;			/* Term can't hack LF doing a CR. */
     85 extern char	 UPPERCASE;		/* Terminal is uppercase only. */
     86 
     87 extern int	 My_term;		/* Use Def_term regardless. */
     88 extern char	*Def_term;		/* Default terminal type. */
     89 
     90 /* Termcap capabilities. */
     91 extern char	AM, BS, CA, DA, EO, HC, IN, MI, MS, NC, NS, OS,
     92 		PC, UL, XB, XN, XT, XS, XX;
     93 extern char	*AC, *AE, *AL, *AS, *BC, *BL, *BT, *CD, *CE, *CL, *CM,
     94 		*CR, *CS, *DC, *DL, *DM, *DO, *Ea, *ED, *EI, *K0, *K1,
     95 		*K2, *K3, *K4, *K5, *K6, *K7, *K8, *K9, *HO, *IC, *IM,
     96 		*IP, *KD, *KE, *KH, *KL, *KR, *KS, *KU, *LL, *MA, *MB,
     97 		*MD, *ME, *MH, *MK, *MP, *MR, *ND, *NL, *RC, *SC, *SE,
     98 		*SF, *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB,
     99 		*VS, *VE, *al, *dl, *sf, *sr, *AL_PARM, *DL_PARM, *UP_PARM,
    100 		*DOWN_PARM, *LEFT_PARM, *RIGHT_PARM;
    101 
    102 /* END BACKWARD COMPATIBILITY ONLY. */
    103 
    104 /* symbols for values returned by getch in keypad mode */
    105 #define    KEY_MIN        0x101    /* minimum extended key value */
    106 #define    KEY_BREAK      0x101    /* break key */
    107 #define    KEY_DOWN       0x102    /* down arrow */
    108 #define    KEY_UP         0x103    /* up arrow */
    109 #define    KEY_LEFT       0x104    /* left arrow */
    110 #define    KEY_RIGHT      0x105    /* right arrow*/
    111 #define    KEY_HOME       0x106    /* home key */
    112 #define    KEY_BACKSPACE  0x107    /* Backspace */
    113 
    114 /* First function key (block of 64 follow) */
    115 #define    KEY_F0         0x108
    116 /* Function defining other function key values*/
    117 #define    KEY_F(n)       (KEY_F0+(n))
    118 
    119 #define    KEY_DL         0x148    /* Delete Line */
    120 #define    KEY_IL         0x149    /* Insert Line*/
    121 #define    KEY_DC         0x14A    /* Delete Character */
    122 #define    KEY_IC         0x14B    /* Insert Character */
    123 #define    KEY_EIC        0x14C    /* Exit Insert Char mode */
    124 #define    KEY_CLEAR      0x14D    /* Clear screen */
    125 #define    KEY_EOS        0x14E    /* Clear to end of screen */
    126 #define    KEY_EOL        0x14F    /* Clear to end of line */
    127 #define    KEY_SF         0x150    /* Scroll one line forward */
    128 #define    KEY_SR         0x151    /* Scroll one line back */
    129 #define    KEY_NPAGE      0x152    /* Next Page */
    130 #define    KEY_PPAGE      0x153    /* Prev Page */
    131 #define    KEY_STAB       0x154    /* Set Tab */
    132 #define    KEY_CTAB       0x155    /* Clear Tab */
    133 #define    KEY_CATAB      0x156    /* Clear All Tabs */
    134 #define    KEY_ENTER      0x157    /* Enter or Send */
    135 #define    KEY_SRESET     0x158    /* Soft Reset */
    136 #define    KEY_RESET      0x159    /* Hard Reset */
    137 #define    KEY_PRINT      0x15A    /* Print */
    138 #define    KEY_LL         0x15B    /* Home Down */
    139 
    140 /*
    141  * "Keypad" keys arranged like this:
    142  *
    143  *  A1   up  A3
    144  * left  B2 right
    145  *  C1  down C3
    146  *
    147  */
    148 #define    KEY_A1         0x15C    /* Keypad upper left */
    149 #define    KEY_A3         0x15D    /* Keypad upper right */
    150 #define    KEY_B2         0x15E    /* Keypad centre key */
    151 #define    KEY_C1         0x15F    /* Keypad lower left */
    152 #define    KEY_C3         0x160    /* Keypad lower right */
    153 
    154 #define    KEY_BTAB       0x161    /* Back Tab */
    155 #define    KEY_BEG        0x162    /* Begin key */
    156 #define    KEY_CANCEL     0x163    /* Cancel key */
    157 #define    KEY_CLOSE      0x164    /* Close Key */
    158 #define    KEY_COMMAND    0x165    /* Command Key */
    159 #define    KEY_COPY       0x166    /* Copy key */
    160 #define    KEY_CREATE     0x167    /* Create key */
    161 #define    KEY_END        0x168    /* End key */
    162 #define    KEY_EXIT       0x169    /* Exit key */
    163 #define    KEY_FIND       0x16A    /* Find key */
    164 #define    KEY_HELP       0x16B    /* Help key */
    165 #define    KEY_MARK       0x16C    /* Mark key */
    166 #define    KEY_MESSAGE    0x16D    /* Message key */
    167 #define    KEY_MOVE       0x16E    /* Move key */
    168 #define    KEY_NEXT       0x16F    /* Next Object key */
    169 #define    KEY_OPEN       0x170    /* Open key */
    170 #define    KEY_OPTIONS    0x171    /* Options key */
    171 #define    KEY_PREVIOUS   0x172    /* Previous Object key */
    172 #define    KEY_REDO       0x173    /* Redo key */
    173 #define    KEY_REFERENCE  0x174    /* Ref Key */
    174 #define    KEY_REFRESH    0x175    /* Refresh key */
    175 #define    KEY_REPLACE    0x176    /* Replace key */
    176 #define    KEY_RESTART    0x177    /* Restart key */
    177 #define    KEY_RESUME     0x178    /* Resume key */
    178 #define    KEY_SAVE       0x179    /* Save key */
    179 #define    KEY_SBEG       0x17A    /* Shift begin key */
    180 #define    KEY_SCANCEL    0x17B    /* Shift Cancel key */
    181 #define    KEY_SCOMMAND   0x17C    /* Shift Command key */
    182 #define    KEY_SCOPY      0x17D    /* Shift Copy key */
    183 #define    KEY_SCREATE    0x17E    /* Shift Create key */
    184 #define    KEY_SDC        0x17F    /* Shift Delete Character */
    185 #define    KEY_SDL        0x180    /* Shift Delete Line */
    186 #define    KEY_SELECT     0x181    /* Select key */
    187 #define    KEY_SEND       0x182    /* Send key */
    188 #define    KEY_SEOL       0x183    /* Shift Clear Line key */
    189 #define    KEY_SEXIT      0x184    /* Shift Exit key */
    190 #define    KEY_SFIND      0x185    /* Shift Find key */
    191 #define    KEY_SHELP      0x186    /* Shift Help key */
    192 #define    KEY_SHOME      0x187    /* Shift Home key */
    193 #define    KEY_SIC        0x188    /* Shift Input key */
    194 #define    KEY_SLEFT      0x189    /* Shift Left Arrow key */
    195 #define    KEY_SMESSAGE   0x18A    /* Shift Message key */
    196 #define    KEY_SMOVE      0x18B    /* Shift Move key */
    197 #define    KEY_SNEXT      0x18C    /* Shift Next key */
    198 #define    KEY_SOPTIONS   0x18D    /* Shift Options key */
    199 #define    KEY_SPREVIOUS  0x18E    /* Shift Previous key */
    200 #define    KEY_SPRINT     0x18F    /* Shift Print key */
    201 #define    KEY_SREDO      0x190    /* Shift Redo key */
    202 #define    KEY_SREPLACE   0x191    /* Shift Replace key */
    203 #define    KEY_SRIGHT     0x192    /* Shift Right Arrow key */
    204 #define    KEY_SRESUME    0x193    /* Shift Resume key */
    205 #define    KEY_SSAVE      0x194    /* Shift Save key */
    206 #define    KEY_SSUSPEND   0x195    /* Shift Suspend key */
    207 #define    KEY_SUNDO      0x196    /* Shift Undo key */
    208 #define    KEY_SUSPEND    0x197    /* Suspend key */
    209 #define    KEY_UNDO       0x198    /* Undo key  */
    210 #define    KEY_MAX        0x198    /* maximum extended key value */
    211 
    212 /* 8-bit ASCII characters. */
    213 #define	unctrl(c)		__unctrl[((unsigned)c) & 0xff]
    214 #define	unctrllen(ch)		__unctrllen[((unsigned)ch) & 0xff]
    215 
    216 extern char	 *__unctrl[256];	/* Control strings. */
    217 extern char	 __unctrllen[256];	/* Control strings length. */
    218 
    219 /*
    220  * A window an array of __LINE structures pointed to by the 'lines' pointer.
    221  * A line is an array of __LDATA structures pointed to by the 'line' pointer.
    222  *
    223  * IMPORTANT: the __LDATA structure must NOT induce any padding, so if new
    224  * fields are added -- padding fields with *constant values* should ensure
    225  * that the compiler will not generate any padding when storing an array of
    226  *  __LDATA structures.  This is to enable consistent use of memcmp, and memcpy
    227  * for comparing and copying arrays.
    228  */
    229 
    230 typedef struct {
    231 #define __CHARTEXT	0x000000ff	/* bits for 8-bit characters */
    232 	wchar_t	ch;			/* Character */
    233 #define __NORMAL	0x00000000	/* Added characters are normal. */
    234 #define __STANDOUT	0x00010000	/* Added characters are standout. */
    235 #define __UNDERSCORE	0x00020000	/* Added characters are underscored. */
    236 #define __REVERSE	0x00040000	/* Added characters are reverse
    237 					   video. */
    238 #define __BLINK		0x00080000	/* Added characters are blinking. */
    239 #define __DIM		0x00100000	/* Added characters are dim. */
    240 #define __BOLD		0x00200000	/* Added characters are bold. */
    241 #define __BLANK		0x00400000	/* Added characters are blanked. */
    242 #define __PROTECT	0x00800000	/* Added characters are protected. */
    243 #define __ALTCHARSET	0x01000000	/* Added characters are ACS */
    244 #define __COLOR		0xee000000	/* Color bits */
    245 #define __ATTRIBUTES	0xefff0000	/* All 8-bit attribute bits */
    246 #define __TERMATTR	0x00fc0000	/* Termcap attribute modes
    247 					   (reverse, blinking, dim, bold,
    248 					   blanked & protected */
    249 	attr_t	attr;			/* Attributes */
    250 } __LDATA;
    251 
    252 #define __LDATASIZE	(sizeof(__LDATA))
    253 
    254 typedef struct {
    255 #define	__ISDIRTY	0x01		/* Line is dirty. */
    256 #define __ISPASTEOL	0x02		/* Cursor is past end of line */
    257 #define __FORCEPAINT	0x04		/* Force a repaint of the line */
    258 	unsigned int flags;
    259 	unsigned int hash;		/* Hash value for the line. */
    260 	int *firstchp, *lastchp;	/* First and last chngd columns ptrs */
    261 	int firstch, lastch;		/* First and last changed columns. */
    262 	__LDATA *line;			/* Pointer to the line text. */
    263 } __LINE;
    264 
    265 typedef struct __window {		/* Window structure. */
    266 	struct __window	*nextp, *orig;	/* Subwindows list and parent. */
    267 	int begy, begx;			/* Window home. */
    268 	int cury, curx;			/* Current x, y coordinates. */
    269 	int maxy, maxx;			/* Maximum values for curx, cury. */
    270 	short ch_off;			/* x offset for firstch/lastch. */
    271 	__LINE **lines;			/* Array of pointers to the lines */
    272 	__LINE  *lspace;		/* line space (for cleanup) */
    273 	__LDATA *wspace;		/* window space (for cleanup) */
    274 
    275 #define	__ENDLINE	0x00000001	/* End of screen. */
    276 #define	__FLUSH		0x00000002	/* Fflush(stdout) after refresh. */
    277 #define	__FULLWIN	0x00000004	/* Window is a screen. */
    278 #define	__IDLINE	0x00000008	/* Insert/delete sequences. */
    279 #define	__SCROLLWIN	0x00000010	/* Last char will scroll window. */
    280 #define	__SCROLLOK	0x00000020	/* Scrolling ok. */
    281 #define	__CLEAROK	0x00000040	/* Clear on next refresh. */
    282 #define	__LEAVEOK	0x00000100	/* If cursor left */
    283 #define	__KEYPAD	0x00010000	/* If interpreting keypad codes */
    284 #define	__NOTIMEOUT	0x00020000	/* Wait indefinitely for func keys */
    285 	unsigned int flags;
    286 	int	delay;			/* delay for getch() */
    287 	attr_t	wattr;			/* Character attributes */
    288 } WINDOW;
    289 
    290 /*
    291  * Attribute definitions
    292  */
    293 #define A_NORMAL	__NORMAL
    294 #define	A_STANDOUT	__STANDOUT
    295 #define	A_UNDERLINE	__UNDERSCORE
    296 #define	A_REVERSE	__REVERSE
    297 #define	A_BLINK		__BLINK
    298 #define	A_DIM		__DIM
    299 #define	A_BOLD		__BOLD
    300 #define	A_BLANK		__BLANK
    301 #define	A_PROTECT	__PROTECT
    302 #define A_ALTCHARSET	__ALTCHARSET
    303 #define A_ATTRIBUTES	__ATTRIBUTES
    304 #define A_CHARTEXT	__CHARTEXT
    305 #define A_COLOR		__COLOR
    306 
    307 /*
    308  * Alternate character set definitions
    309  */
    310 
    311 #define NUM_ACS	128
    312 
    313 extern chtype _acs_char[NUM_ACS];
    314 
    315 #define ACS_RARROW	_acs_char['+']
    316 #define ACS_LARROW	_acs_char[',']
    317 #define ACS_UARROW	_acs_char['-']
    318 #define ACS_DARROW	_acs_char['.']
    319 #define ACS_BLOCK	_acs_char['0']
    320 #define ACS_DIAMOND	_acs_char['`']
    321 #define ACS_CKBOARD	_acs_char['a']
    322 #define ACS_DEGREE	_acs_char['f']
    323 #define ACS_PLMINUS	_acs_char['g']
    324 #define ACS_BOARD	_acs_char['h']
    325 #define ACS_LANTERN	_acs_char['i']
    326 #define ACS_LRCORNER	_acs_char['j']
    327 #define ACS_URCORNER	_acs_char['k']
    328 #define ACS_ULCORNER	_acs_char['l']
    329 #define ACS_LLCORNER	_acs_char['m']
    330 #define ACS_PLUS	_acs_char['n']
    331 #define ACS_HLINE	_acs_char['q']
    332 #define ACS_S1		_acs_char['o']
    333 #define ACS_S9		_acs_char['s']
    334 #define ACS_LTEE	_acs_char['t']
    335 #define ACS_RTEE	_acs_char['u']
    336 #define ACS_BTEE	_acs_char['v']
    337 #define ACS_TTEE	_acs_char['w']
    338 #define ACS_VLINE	_acs_char['x']
    339 #define ACS_BULLET	_acs_char['~']
    340 
    341 /* System V compatability */
    342 #define ACS_SBBS	ACS_LRCORNER
    343 #define ACS_BBSS	ACS_URCORNER
    344 #define	ACS_BSSB	ACS_ULCORNER
    345 #define ACS_SSBB	ACS_LLCORNER
    346 #define ACS_SSSS	ACS_PLUS
    347 #define ACS_BSBS	ACS_HLINE
    348 #define ACS_SSSB	ACS_LTEE
    349 #define ACS_SBSS	ACS_RTEE
    350 #define	ACS_SSBS	ACS_BTEE
    351 #define	ACS_BSSS	ACS_TTEE
    352 #define	ACS_SBSB	ACS_VLINE
    353 #define _acs_map	_acs_char
    354 
    355 /*
    356  * Color definitions
    357  */
    358 
    359 #define COLOR_BLACK	0x00
    360 #define COLOR_WHITE	0x01
    361 #define COLOR_RED	0x02
    362 #define COLOR_GREEN	0x03
    363 #define COLOR_BLUE	0x04
    364 #define COLOR_CYAN	0x05
    365 #define COLOR_MAGENTA	0x06
    366 #define COLOR_YELLOW	0x07
    367 
    368 
    369 /* Curses external declarations. */
    370 extern WINDOW	*curscr;		/* Current screen. */
    371 extern WINDOW	*stdscr;		/* Standard screen. */
    372 
    373 extern struct termios __orig_termios;	/* Terminal state before curses */
    374 extern struct termios __baset;		/* Our base terminal state */
    375 extern int	__tcaction;		/* If terminal hardware set. */
    376 
    377 extern int	 COLS;			/* Columns on the screen. */
    378 extern int	 LINES;			/* Lines on the screen. */
    379 
    380 extern char	*ttytype;		/* Full name of current terminal. */
    381 
    382 #define	ERR	(0)			/* Error return. */
    383 #define	OK	(1)			/* Success return. */
    384 
    385 /* Standard screen pseudo functions. */
    386 #define	addbytes(s, n)			__waddbytes(stdscr, s, n, 0)
    387 #define	addch(ch)			waddch(stdscr, ch)
    388 #define	addnstr(s, n)			waddnstr(stdscr, s, n)
    389 #define	addstr(s)			waddnstr(stdscr, s, -1)
    390 #define	border(l, r, t, b, tl, tr, bl, br) \
    391 	wborder(stdscr, l, r, t, b, tl, tr, bl, br)
    392 #define	clear()				wclear(stdscr)
    393 #define	clrtobot()			wclrtobot(stdscr)
    394 #define	clrtoeol()			wclrtoeol(stdscr)
    395 #define	delch()				wdelch(stdscr)
    396 #define	deleteln()			wdeleteln(stdscr)
    397 #define	erase()				werase(stdscr)
    398 #define	getch()				wgetch(stdscr)
    399 #define	getstr(s)			wgetstr(stdscr, s)
    400 #define	inch()				winch(stdscr)
    401 #define	insch(ch)			winsch(stdscr, ch)
    402 #define	insdelln(n)			winsdelln(stdscr, n)
    403 #define	insertln()			winsertln(stdscr)
    404 #define	move(y, x)			wmove(stdscr, y, x)
    405 #define	refresh()			wrefresh(stdscr)
    406 #define scrl(n)				wscrl(stdscr, n)
    407 #define	standend()			wstandend(stdscr)
    408 #define	standout()			wstandout(stdscr)
    409 #define	timeout(delay)			wtimeout(stdscr, delay)
    410 #define	underscore()			wunderscore(stdscr)
    411 #define	underend()			wunderend(stdscr)
    412 #define	attron(attr)			wattron(stdscr, attr)
    413 #define	attroff(attr)			wattroff(stdscr, attr)
    414 #define	attrset(attr)			wattrset(stdscr, attr)
    415 #define	waddbytes(w, s, n)		__waddbytes(w, s, n, 0)
    416 #define	waddstr(w, s)			waddnstr(w, s, -1)
    417 
    418 /* Standard screen plus movement pseudo functions. */
    419 #define	mvaddbytes(y, x, s, n)		mvwaddbytes(stdscr, y, x, s, n)
    420 #define	mvaddch(y, x, ch)		mvwaddch(stdscr, y, x, ch)
    421 #define	mvaddnstr(y, x, s, n)		mvwaddnstr(stdscr, y, x, s, n)
    422 #define	mvaddstr(y, x, s)		mvwaddstr(stdscr, y, x, s)
    423 #define	mvdelch(y, x)			mvwdelch(stdscr, y, x)
    424 #define	mvgetch(y, x)			mvwgetch(stdscr, y, x)
    425 #define	mvgetstr(y, x, s)		mvwgetstr(stdscr, y, x, s)
    426 #define	mvinch(y, x)			mvwinch(stdscr, y, x)
    427 #define	mvinsch(y, x, c)		mvwinsch(stdscr, y, x, c)
    428 #define	mvwaddbytes(w, y, x, s, n) \
    429 	(wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, n, 0))
    430 #define	mvwaddch(w, y, x, ch) \
    431 	(wmove(w, y, x) == ERR ? ERR : waddch(w, ch))
    432 #define	mvwaddnstr(w, y, x, s, n) \
    433 	(wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, n))
    434 #define	mvwaddstr(w, y, x, s) \
    435 	(wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, -1))
    436 #define	mvwdelch(w, y, x) \
    437 	(wmove(w, y, x) == ERR ? ERR : wdelch(w))
    438 #define	mvwgetch(w, y, x) \
    439 	(wmove(w, y, x) == ERR ? ERR : wgetch(w))
    440 #define	mvwgetstr(w, y, x, s) \
    441 	(wmove(w, y, x) == ERR ? ERR : wgetstr(w, s))
    442 #define	mvwinch(w, y, x) \
    443 	(wmove(w, y, x) == ERR ? ERR : winch(w))
    444 #define	mvwinsch(w, y, x, c) \
    445 	(wmove(w, y, x) == ERR ? ERR : winsch(w, c))
    446 
    447 #define	getyx(w, y, x)		(y) = getcury(w), (x) = getcurx(w)
    448 #define getbegyx(w, y, x)	(y) = getbegy(w), (x) = getbegx(w)
    449 #define getmaxyx(w, y, x)	(y) = getmaxy(w), (x) = getmaxx(w)
    450 #define getcury(w)		((w)->cury)
    451 #define getcurx(w)		((w)->curx)
    452 #define getbegy(w)		((w)->begy)
    453 #define getbegx(w)		((w)->begx)
    454 #define getmaxy(w)		((w)->maxy)
    455 #define getmaxx(w)		((w)->maxx)
    456 
    457 /* Public function prototypes. */
    458 __BEGIN_DECLS
    459 int	 beep __P((void));
    460 int	 box __P((WINDOW *, chtype, chtype));
    461 int	 cbreak __P((void));
    462 int	 clearok __P((WINDOW *, bool));
    463 int	 delwin __P((WINDOW *));
    464 int	 echo __P((void));
    465 int	 endwin __P((void));
    466 int	 flash __P((void));
    467 int	 flushinp __P((void));
    468 int	 flushok __P((WINDOW *, bool));
    469 char	*fullname __P((char *, char *));
    470 char	*getcap __P((char *));
    471 int	 gettmode __P((void));
    472 int	 idlok __P((WINDOW *, bool));
    473 WINDOW	*initscr __P((void));
    474 bool	 isendwin __P((void));
    475 void	 keypad __P((WINDOW *, bool));
    476 int	 leaveok __P((WINDOW *, bool));
    477 char	*longname __P((void));
    478 int	 mvcur __P((int, int, int, int));
    479 int	 mvprintw __P((int, int, char *, ...));
    480 int	 mvscanw __P((int, int, char *, ...));
    481 int	 mvwin __P((WINDOW *, int, int));
    482 int	 mvwprintw __P((WINDOW *, int, int, char *, ...));
    483 int	 mvwscanw __P((WINDOW *, int, int, char *, ...));
    484 WINDOW	*newwin __P((int, int, int, int));
    485 int	 nl __P((void));
    486 int	 nocbreak __P((void));
    487 void	 nodelay __P((WINDOW *, bool));
    488 int	 noecho __P((void));
    489 int	 nonl __P((void));
    490 int	 noraw __P((void));
    491 int	 notimeout __P((WINDOW *, bool));
    492 int	 overlay __P((const WINDOW *, WINDOW *));
    493 int	 overwrite __P((WINDOW *, WINDOW *));
    494 int	 printw __P((char *, ...));
    495 int	 raw __P((void));
    496 int	 resetty __P((void));
    497 int	 savetty __P((void));
    498 int	 scanw __P((char *, ...));
    499 int	 scroll __P((WINDOW *));
    500 int	 scrollok __P((WINDOW *, bool));
    501 int	 setterm __P((char *));
    502 WINDOW	*subwin __P((WINDOW *, int, int, int, int));
    503 int	 touchline __P((WINDOW *, int, int));
    504 int	 touchoverlap __P((WINDOW *, WINDOW *));
    505 int	 touchwin __P((WINDOW *));
    506 int	 vwprintw __P((WINDOW *, char *, _BSD_VA_LIST_));
    507 int	 vwscanw __P((WINDOW *, char *, _BSD_VA_LIST_));
    508 int	 waddch __P((WINDOW *, const chtype));
    509 int	 waddnstr __P((WINDOW *, const char *, int));
    510 int	 wattron __P((WINDOW *, int));
    511 int	 wattroff __P((WINDOW *, int));
    512 int	 wattrset __P((WINDOW *, int));
    513 int	 wborder __P((WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype));
    514 int	 wclear __P((WINDOW *));
    515 int	 wclrtobot __P((WINDOW *));
    516 int	 wclrtoeol __P((WINDOW *));
    517 int	 wdelch __P((WINDOW *));
    518 int	 wdeleteln __P((WINDOW *));
    519 int	 werase __P((WINDOW *));
    520 int	 wgetch __P((WINDOW *));
    521 int	 wgetstr __P((WINDOW *, char *));
    522 chtype	 winch __P((WINDOW *));
    523 int	 winsch __P((WINDOW *, chtype));
    524 int	 winsdelln __P((WINDOW *, int));
    525 int	 winsertln __P((WINDOW *));
    526 int	 wmove __P((WINDOW *, int, int));
    527 int	 wprintw __P((WINDOW *, char *, ...));
    528 int	 wrefresh __P((WINDOW *));
    529 int	 wscanw __P((WINDOW *, char *, ...));
    530 int	 wscrl __P((WINDOW *, int));
    531 int	 wstandend __P((WINDOW *));
    532 int	 wstandout __P((WINDOW *));
    533 void	 wtimeout __P((WINDOW *, int));
    534 int	 wunderend __P((WINDOW *));
    535 int	 wunderscore __P((WINDOW *));
    536 
    537 /* Private functions that are needed for user programs prototypes. */
    538 int	 __cputchar __P((int));
    539 int	 __waddbytes __P((WINDOW *, const char *, int, attr_t));
    540 __END_DECLS
    541 
    542 /* Private functions. */
    543 #ifdef _CURSES_PRIVATE
    544 #ifdef DEBUG
    545 void	 __CTRACE __P((const char *, ...));
    546 #endif
    547 int	 __delay __P((void));
    548 unsigned int __hash __P((char *, int));
    549 void	 __id_subwins __P((WINDOW *));
    550 void	 __init_getch __P((char *));
    551 void	 __init_acs __P((void));
    552 char	*__longname __P((char *, char *));	/* Original BSD version */
    553 int	 __mvcur __P((int, int, int, int, int));
    554 int	 __nodelay __P((void));
    555 int	 __notimeout __P((void));
    556 void	 __restore_termios __P((void));
    557 void	 __restore_stophandler __P((void));
    558 void	 __save_termios __P((void));
    559 void	 __set_stophandler __P((void));
    560 void	 __set_subwin __P((WINDOW *, WINDOW *));
    561 void	 __startwin __P((void));
    562 void	 __stop_signal_handler __P((int));
    563 void	 __swflags __P((WINDOW *));
    564 int	 __timeout __P((int));
    565 int	 __touchline __P((WINDOW *, int, int, int, int));
    566 int	 __touchwin __P((WINDOW *));
    567 char	*__tscroll __P((const char *, int, int));
    568 int	 __waddch __P((WINDOW *, __LDATA *));
    569 int	 __stopwin __P((void));
    570 void	 __restartwin __P((void));
    571 
    572 /* Private #defines. */
    573 #define	min(a,b)	(a < b ? a : b)
    574 #define	max(a,b)	(a > b ? a : b)
    575 
    576 /* Private externs. */
    577 extern int	 __echoit;
    578 extern int	 __endwin;
    579 extern int	 __pfast;
    580 extern int	 __rawmode;
    581 extern int	 __noqch;
    582 #endif
    583 
    584 #endif /* !_CURSES_H_ */
    585