Home | History | Annotate | Line # | Download | only in libcurses
curses.h revision 1.29.2.1
      1 /*	$NetBSD: curses.h,v 1.29.2.1 2000/01/09 20:43:18 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	*AL, *BC, *BL, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC,
     94 		*DL, *DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5,
     95 		*K6, *K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH,
     96 		*KL, *KR, *KS, *KU, *LL, *MA, *MB, *MD, *ME, *MH, *MK,
     97 		*MP, *MR, *ND, *NL, *RC, *SC, *SE, *SF, *SO, *SR, *TA,
     98 		*TE, *TI, *UC, *UE, *UP, *US, *VB, *VS, *VE, *al, *dl,
     99 		*sf, *sr, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM,
    100 		*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 #define ACS_RARROW	_acs_char['+']
    311 #define ACS_LARROW	_acs_char[',']
    312 #define ACS_UARROW	_acs_char['-']
    313 #define ACS_DARROW	_acs_char['.']
    314 #define ACS_BLOCK	_acs_char['0']
    315 #define ACS_DIAMOND	_acs_char['`']
    316 #define ACS_CKBOARD	_acs_char['a']
    317 #define ACS_DEGREE	_acs_char['f']
    318 #define ACS_PLMINUS	_acs_char['g']
    319 #define ACS_BOARD	_acs_char['h']
    320 #define ACS_LANTERN	_acs_char['i']
    321 #define ACS_LRCORNER	_acs_char['j']
    322 #define ACS_URCORNER	_acs_char['k']
    323 #define ACS_ULCORNER	_acs_char['l']
    324 #define ACS_LLCORNER	_acs_char['m']
    325 #define ACS_PLUS	_acs_char['n']
    326 #define ACS_HLINE	_acs_char['q']
    327 #define ACS_S1		_acs_char['o']
    328 #define ACS_S9		_acs_char['s']
    329 #define ACS_LTEE	_acs_char['t']
    330 #define ACS_RTEE	_acs_char['u']
    331 #define ACS_BTEE	_acs_char['v']
    332 #define ACS_TTEE	_acs_char['w']
    333 #define ACS_VLINE	_acs_char['x']
    334 #define ACS_BULLET	_acs_char['~']
    335 
    336 /*
    337  * Color definitions
    338  */
    339 
    340 #define COLOR_BLACK	0x00
    341 #define COLOR_WHITE	0x01
    342 #define COLOR_RED	0x02
    343 #define COLOR_GREEN	0x03
    344 #define COLOR_BLUE	0x04
    345 #define COLOR_CYAN	0x05
    346 #define COLOR_MAGENTA	0x06
    347 #define COLOR_YELLOW	0x07
    348 
    349 
    350 /* Curses external declarations. */
    351 extern WINDOW	*curscr;		/* Current screen. */
    352 extern WINDOW	*stdscr;		/* Standard screen. */
    353 
    354 extern struct termios __orig_termios;	/* Terminal state before curses */
    355 extern struct termios __baset;		/* Our base terminal state */
    356 extern int	__tcaction;		/* If terminal hardware set. */
    357 
    358 extern int	 COLS;			/* Columns on the screen. */
    359 extern int	 LINES;			/* Lines on the screen. */
    360 
    361 extern char	*ttytype;		/* Full name of current terminal. */
    362 
    363 #define	ERR	(0)			/* Error return. */
    364 #define	OK	(1)			/* Success return. */
    365 
    366 /* Standard screen pseudo functions. */
    367 #define	addbytes(s, n)			__waddbytes(stdscr, s, n, 0)
    368 #define	addch(ch)			waddch(stdscr, ch)
    369 #define	addnstr(s, n)			waddnstr(stdscr, s, n)
    370 #define	addstr(s)			waddnstr(stdscr, s, -1)
    371 #define	clear()				wclear(stdscr)
    372 #define	clrtobot()			wclrtobot(stdscr)
    373 #define	clrtoeol()			wclrtoeol(stdscr)
    374 #define	delch()				wdelch(stdscr)
    375 #define	deleteln()			wdeleteln(stdscr)
    376 #define	erase()				werase(stdscr)
    377 #define	getch()				wgetch(stdscr)
    378 #define	getstr(s)			wgetstr(stdscr, s)
    379 #define	inch()				winch(stdscr)
    380 #define	insch(ch)			winsch(stdscr, ch)
    381 #define	insertln()			winsertln(stdscr)
    382 #define	move(y, x)			wmove(stdscr, y, x)
    383 #define	refresh()			wrefresh(stdscr)
    384 #define	standend()			wstandend(stdscr)
    385 #define	standout()			wstandout(stdscr)
    386 #define	timeout(delay)			wtimeout(stdscr, delay)
    387 #define	underscore()			wunderscore(stdscr)
    388 #define	underend()			wunderend(stdscr)
    389 #define	attron(attr)			wattron(stdscr, attr)
    390 #define	attroff(attr)			wattroff(stdscr, attr)
    391 #define	attrset(attr)			wattrset(stdscr, attr)
    392 #define	waddbytes(w, s, n)		__waddbytes(w, s, n, 0)
    393 #define	waddstr(w, s)			waddnstr(w, s, -1)
    394 
    395 /* Standard screen plus movement pseudo functions. */
    396 #define	mvaddbytes(y, x, s, n)		mvwaddbytes(stdscr, y, x, s, n)
    397 #define	mvaddch(y, x, ch)		mvwaddch(stdscr, y, x, ch)
    398 #define	mvaddnstr(y, x, s, n)		mvwaddnstr(stdscr, y, x, s, n)
    399 #define	mvaddstr(y, x, s)		mvwaddstr(stdscr, y, x, s)
    400 #define	mvdelch(y, x)			mvwdelch(stdscr, y, x)
    401 #define	mvgetch(y, x)			mvwgetch(stdscr, y, x)
    402 #define	mvgetstr(y, x, s)		mvwgetstr(stdscr, y, x, s)
    403 #define	mvinch(y, x)			mvwinch(stdscr, y, x)
    404 #define	mvinsch(y, x, c)		mvwinsch(stdscr, y, x, c)
    405 #define	mvwaddbytes(w, y, x, s, n) \
    406 	(wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, n, 0))
    407 #define	mvwaddch(w, y, x, ch) \
    408 	(wmove(w, y, x) == ERR ? ERR : waddch(w, ch))
    409 #define	mvwaddnstr(w, y, x, s, n) \
    410 	(wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, n))
    411 #define	mvwaddstr(w, y, x, s) \
    412 	(wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, -1))
    413 #define	mvwdelch(w, y, x) \
    414 	(wmove(w, y, x) == ERR ? ERR : wdelch(w))
    415 #define	mvwgetch(w, y, x) \
    416 	(wmove(w, y, x) == ERR ? ERR : wgetch(w))
    417 #define	mvwgetstr(w, y, x, s) \
    418 	(wmove(w, y, x) == ERR ? ERR : wgetstr(w, s))
    419 #define	mvwinch(w, y, x) \
    420 	(wmove(w, y, x) == ERR ? ERR : winch(w))
    421 #define	mvwinsch(w, y, x, c) \
    422 	(wmove(w, y, x) == ERR ? ERR : winsch(w, c))
    423 
    424 #define	getyx(w, y, x)		(y) = getcury(w), (x) = getcurx(w)
    425 #define getbegyx(w, y, x)	(y) = getbegy(w), (x) = getbegx(w)
    426 #define getmaxyx(w, y, x)	(y) = getmaxy(w), (x) = getmaxx(w)
    427 #define getcury(w)		((w)->cury)
    428 #define getcurx(w)		((w)->curx)
    429 #define getbegy(w)		((w)->begy)
    430 #define getbegx(w)		((w)->begx)
    431 #define getmaxy(w)		((w)->maxy)
    432 #define getmaxx(w)		((w)->maxx)
    433 
    434 /* Public function prototypes. */
    435 __BEGIN_DECLS
    436 int	 beep __P((void));
    437 int	 box __P((WINDOW *, chtype, chtype));
    438 int	 cbreak __P((void));
    439 int	 clearok __P((WINDOW *, bool));
    440 int	 delwin __P((WINDOW *));
    441 int	 echo __P((void));
    442 int	 endwin __P((void));
    443 int	 flash __P((void));
    444 int	 flushinp __P((void));
    445 int	 flushok __P((WINDOW *, bool));
    446 char	*fullname __P((char *, char *));
    447 char	*getcap __P((char *));
    448 int	 gettmode __P((void));
    449 int	 idlok __P((WINDOW *, bool));
    450 WINDOW	*initscr __P((void));
    451 bool	 isendwin __P((void));
    452 void	 keypad __P((WINDOW *, bool));
    453 int	 leaveok __P((WINDOW *, bool));
    454 char	*longname __P((void));
    455 int	 mvcur __P((int, int, int, int));
    456 int	 mvprintw __P((int, int, char *, ...));
    457 int	 mvscanw __P((int, int, char *, ...));
    458 int	 mvwin __P((WINDOW *, int, int));
    459 int	 mvwprintw __P((WINDOW *, int, int, char *, ...));
    460 int	 mvwscanw __P((WINDOW *, int, int, char *, ...));
    461 WINDOW	*newwin __P((int, int, int, int));
    462 int	 nl __P((void));
    463 int	 nocbreak __P((void));
    464 void	 nodelay __P((WINDOW *, bool));
    465 int	 noecho __P((void));
    466 int	 nonl __P((void));
    467 int	 noraw __P((void));
    468 int	 notimeout __P((WINDOW *, bool));
    469 int	 overlay __P((const WINDOW *, WINDOW *));
    470 int	 overwrite __P((WINDOW *, WINDOW *));
    471 int	 printw __P((char *, ...));
    472 int	 raw __P((void));
    473 int	 resetty __P((void));
    474 int	 savetty __P((void));
    475 int	 scanw __P((char *, ...));
    476 int	 scroll __P((WINDOW *));
    477 int	 scrollok __P((WINDOW *, bool));
    478 int	 setterm __P((char *));
    479 WINDOW	*subwin __P((WINDOW *, int, int, int, int));
    480 int	 suspendwin __P((void));
    481 int	 touchline __P((WINDOW *, int, int));
    482 int	 touchoverlap __P((WINDOW *, WINDOW *));
    483 int	 touchwin __P((WINDOW *));
    484 int	 vwprintw __P((WINDOW *, char *, _BSD_VA_LIST_));
    485 int	 vwscanw __P((WINDOW *, char *, _BSD_VA_LIST_));
    486 int	 waddch __P((WINDOW *, const chtype));
    487 int	 waddnstr __P((WINDOW *, const char *, int));
    488 int	 wattron __P((WINDOW *, int));
    489 int	 wattroff __P((WINDOW *, int));
    490 int	 wattrset __P((WINDOW *, int));
    491 int	 wclear __P((WINDOW *));
    492 int	 wclrtobot __P((WINDOW *));
    493 int	 wclrtoeol __P((WINDOW *));
    494 int	 wdelch __P((WINDOW *));
    495 int	 wdeleteln __P((WINDOW *));
    496 int	 werase __P((WINDOW *));
    497 int	 wgetch __P((WINDOW *));
    498 int	 wgetstr __P((WINDOW *, char *));
    499 chtype	 winch __P((WINDOW *));
    500 int	 winsch __P((WINDOW *, chtype));
    501 int	 winsertln __P((WINDOW *));
    502 int	 wmove __P((WINDOW *, int, int));
    503 int	 wprintw __P((WINDOW *, char *, ...));
    504 int	 wrefresh __P((WINDOW *));
    505 int	 wscanw __P((WINDOW *, char *, ...));
    506 int	 wstandend __P((WINDOW *));
    507 int	 wstandout __P((WINDOW *));
    508 void	 wtimeout __P((WINDOW *, int));
    509 int	 wunderscore __P((WINDOW *));
    510 int	 wunderend __P((WINDOW *));
    511 
    512 /* Private functions that are needed for user programs prototypes. */
    513 int	 __cputchar __P((int));
    514 int	 __waddbytes __P((WINDOW *, const char *, int, attr_t));
    515 __END_DECLS
    516 
    517 /* Private functions. */
    518 #ifdef _CURSES_PRIVATE
    519 #ifdef DEBUG
    520 void	 __CTRACE __P((const char *, ...));
    521 #endif
    522 int	 __delay __P((void));
    523 unsigned int __hash __P((char *, int));
    524 void	 __id_subwins __P((WINDOW *));
    525 void	 __init_getch __P((char *));
    526 char	*__longname __P((char *, char *));	/* Original BSD version */
    527 int	 __mvcur __P((int, int, int, int, int));
    528 int	 __nodelay __P((void));
    529 int	 __notimeout __P((void));
    530 void	 __restore_termios __P((void));
    531 void	 __restore_stophandler __P((void));
    532 void	 __save_termios __P((void));
    533 void	 __set_stophandler __P((void));
    534 void	 __set_subwin __P((WINDOW *, WINDOW *));
    535 void	 __startwin __P((void));
    536 void	 __stop_signal_handler __P((int));
    537 void	 __swflags __P((WINDOW *));
    538 int	 __timeout __P((int));
    539 int	 __touchline __P((WINDOW *, int, int, int, int));
    540 int	 __touchwin __P((WINDOW *));
    541 char	*__tscroll __P((const char *, int, int));
    542 int	 __waddch __P((WINDOW *, __LDATA *));
    543 int	 __stopwin __P((void));
    544 void	 __restartwin __P((void));
    545 
    546 /* Private #defines. */
    547 #define	min(a,b)	(a < b ? a : b)
    548 #define	max(a,b)	(a > b ? a : b)
    549 
    550 /* Private externs. */
    551 extern int	 __echoit;
    552 extern int	 __endwin;
    553 extern int	 __pfast;
    554 extern int	 __rawmode;
    555 extern int	 __noqch;
    556 #endif
    557 
    558 #endif /* !_CURSES_H_ */
    559