Home | History | Annotate | Line # | Download | only in libcurses
curses.h revision 1.24
      1  1.24   simonb /*	$NetBSD: curses.h,v 1.24 1999/06/28 13:32:43 simonb Exp $	*/
      2  1.18    mikel 
      3   1.1      cgd /*
      4  1.13      cgd  * Copyright (c) 1981, 1993, 1994
      5   1.7      cgd  *	The Regents of the University of California.  All rights reserved.
      6   1.1      cgd  *
      7   1.1      cgd  * Redistribution and use in source and binary forms, with or without
      8   1.1      cgd  * modification, are permitted provided that the following conditions
      9   1.1      cgd  * are met:
     10   1.1      cgd  * 1. Redistributions of source code must retain the above copyright
     11   1.1      cgd  *    notice, this list of conditions and the following disclaimer.
     12   1.1      cgd  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1      cgd  *    notice, this list of conditions and the following disclaimer in the
     14   1.1      cgd  *    documentation and/or other materials provided with the distribution.
     15   1.1      cgd  * 3. All advertising materials mentioning features or use of this software
     16   1.1      cgd  *    must display the following acknowledgement:
     17   1.1      cgd  *	This product includes software developed by the University of
     18   1.1      cgd  *	California, Berkeley and its contributors.
     19   1.1      cgd  * 4. Neither the name of the University nor the names of its contributors
     20   1.1      cgd  *    may be used to endorse or promote products derived from this software
     21   1.1      cgd  *    without specific prior written permission.
     22   1.1      cgd  *
     23   1.1      cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24   1.1      cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25   1.1      cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26   1.1      cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27   1.1      cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28   1.1      cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29   1.1      cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30   1.1      cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31   1.1      cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32   1.1      cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33   1.1      cgd  * SUCH DAMAGE.
     34   1.1      cgd  *
     35  1.21    perry  *	@(#)curses.h	8.5 (Berkeley) 4/29/95
     36   1.1      cgd  */
     37   1.1      cgd 
     38   1.4  mycroft #ifndef _CURSES_H_
     39   1.4  mycroft #define	_CURSES_H_
     40   1.1      cgd 
     41  1.22      mrg #include <sys/types.h>
     42  1.22      mrg #include <sys/cdefs.h>
     43  1.22      mrg 
     44   1.4  mycroft #include <stdio.h>
     45  1.20    lukem #include <termcap.h>
     46   1.1      cgd 
     47   1.4  mycroft /*
     48   1.4  mycroft  * The following #defines and #includes are present for backward
     49   1.4  mycroft  * compatibility only.  They should not be used in future code.
     50   1.4  mycroft  *
     51   1.4  mycroft  * START BACKWARD COMPATIBILITY ONLY.
     52   1.4  mycroft  */
     53   1.4  mycroft #ifndef _CURSES_PRIVATE
     54  1.21    perry #ifndef __cplusplus
     55   1.1      cgd #define	bool	char
     56  1.22      mrg #define	reg	register
     57  1.21    perry #endif
     58   1.1      cgd 
     59   1.4  mycroft #ifndef TRUE
     60  1.22      mrg #define	TRUE	(/*CONSTCOND*/1)
     61   1.4  mycroft #endif
     62   1.4  mycroft #ifndef FALSE
     63  1.22      mrg #define	FALSE	(/*CONSTCOND*/0)
     64   1.4  mycroft #endif
     65   1.1      cgd 
     66   1.4  mycroft #define	_puts(s)	tputs(s, 0, __cputchar)
     67   1.4  mycroft #define	_putchar(c)	__cputchar(c)
     68   1.1      cgd 
     69   1.4  mycroft /* Old-style terminal modes access. */
     70   1.7      cgd #define	baudrate()	(cfgetospeed(&__baset))
     71   1.4  mycroft #define	crmode()	cbreak()
     72   1.7      cgd #define	erasechar()	(__baset.c_cc[VERASE])
     73   1.7      cgd #define	killchar()	(__baset.c_cc[VKILL])
     74   1.4  mycroft #define	nocrmode()	nocbreak()
     75   1.7      cgd #define	ospeed		(cfgetospeed(&__baset))
     76   1.4  mycroft #endif /* _CURSES_PRIVATE */
     77   1.4  mycroft 
     78   1.7      cgd extern char	 GT;			/* Gtty indicates tabs. */
     79   1.7      cgd extern char	 NONL;			/* Term can't hack LF doing a CR. */
     80   1.7      cgd extern char	 UPPERCASE;		/* Terminal is uppercase only. */
     81   1.7      cgd 
     82   1.4  mycroft extern int	 My_term;		/* Use Def_term regardless. */
     83   1.4  mycroft extern char	*Def_term;		/* Default terminal type. */
     84   1.4  mycroft 
     85   1.4  mycroft /* Termcap capabilities. */
     86  1.10      cgd extern char	AM, BS, CA, DA, EO, HC, IN, MI, MS, NC, NS, OS,
     87   1.4  mycroft 		PC, UL, XB, XN, XT, XS, XX;
     88  1.22      mrg extern char	*AL, *BC, *BL, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC,
     89  1.22      mrg 		*DL, *DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5,
     90  1.22      mrg 		*K6, *K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH,
     91  1.22      mrg 		*KL, *KR, *KS, *KU, *LL, *MA, *MB, *MD, *ME, *MH, *MK,
     92  1.22      mrg 		*MP, *MR, *ND, *NL, *RC, *SC, *SE, *SF, *SO, *SR, *TA,
     93  1.22      mrg 		*TE, *TI, *UC, *UE, *UP, *US, *VB, *VS, *VE, *al, *dl,
     94  1.22      mrg 		*sf, *sr, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM,
     95  1.22      mrg 		*LEFT_PARM, *RIGHT_PARM;
     96   1.4  mycroft 
     97   1.7      cgd /* END BACKWARD COMPATIBILITY ONLY. */
     98   1.7      cgd 
     99  1.22      mrg /* symbols for values returned by getch in keypad mode */
    100  1.22      mrg #define    KEY_MIN        0x101    /* minimum extended key value */
    101  1.22      mrg #define    KEY_BREAK      0x101    /* break key */
    102  1.22      mrg #define    KEY_DOWN       0x102    /* down arrow */
    103  1.22      mrg #define    KEY_UP         0x103    /* up arrow */
    104  1.22      mrg #define    KEY_LEFT       0x104    /* left arrow */
    105  1.22      mrg #define    KEY_RIGHT      0x105    /* right arrow*/
    106  1.22      mrg #define    KEY_HOME       0x106    /* home key */
    107  1.22      mrg #define    KEY_BACKSPACE  0x107    /* Backspace */
    108  1.22      mrg 
    109  1.22      mrg /* First function key (block of 64 follow) */
    110  1.24   simonb #define    KEY_F0         0x108
    111  1.22      mrg /* Function defining other function key values*/
    112  1.24   simonb #define    KEY_F(n)       (KEY_F0+(n))
    113  1.22      mrg 
    114  1.22      mrg #define    KEY_DL         0x148    /* Delete Line */
    115  1.22      mrg #define    KEY_IL         0x149    /* Insert Line*/
    116  1.22      mrg #define    KEY_DC         0x14A    /* Delete Character */
    117  1.22      mrg #define    KEY_IC         0x14B    /* Insert Character */
    118  1.22      mrg #define    KEY_EIC        0x14C    /* Exit Insert Char mode */
    119  1.22      mrg #define    KEY_CLEAR      0x14D    /* Clear screen */
    120  1.22      mrg #define    KEY_EOS        0x14E    /* Clear to end of screen */
    121  1.22      mrg #define    KEY_EOL        0x14F    /* Clear to end of line */
    122  1.22      mrg #define    KEY_SF         0x150    /* Scroll one line forward */
    123  1.22      mrg #define    KEY_SR         0x151    /* Scroll one line back */
    124  1.22      mrg #define    KEY_NPAGE      0x152    /* Next Page */
    125  1.22      mrg #define    KEY_PPAGE      0x153    /* Prev Page */
    126  1.22      mrg #define    KEY_STAB       0x154    /* Set Tab */
    127  1.22      mrg #define    KEY_CTAB       0x155    /* Clear Tab */
    128  1.22      mrg #define    KEY_CATAB      0x156    /* Clear All Tabs */
    129  1.22      mrg #define    KEY_ENTER      0x157    /* Enter or Send */
    130  1.22      mrg #define    KEY_SRESET     0x158    /* Soft Reset */
    131  1.22      mrg #define    KEY_RESET      0x159    /* Hard Reset */
    132  1.22      mrg #define    KEY_PRINT      0x15A    /* Print */
    133  1.22      mrg #define    KEY_LL         0x15B    /* Home Down */
    134  1.22      mrg 
    135  1.22      mrg /*
    136  1.22      mrg  * "Keypad" keys arranged like this:
    137  1.22      mrg  *
    138  1.22      mrg  *  A1   up  A3
    139  1.22      mrg  * left  B2 right
    140  1.22      mrg  *  C1  down C3
    141  1.22      mrg  *
    142  1.22      mrg  */
    143  1.22      mrg #define    KEY_A1         0x15C    /* Keypad upper left */
    144  1.22      mrg #define    KEY_A3         0x15D    /* Keypad upper right */
    145  1.22      mrg #define    KEY_B2         0x15E    /* Keypad centre key */
    146  1.22      mrg #define    KEY_C1         0x15F    /* Keypad lower left */
    147  1.22      mrg #define    KEY_C3         0x160    /* Keypad lower right */
    148  1.22      mrg 
    149  1.22      mrg #define    KEY_BTAB       0x161    /* Back Tab */
    150  1.22      mrg #define    KEY_BEG        0x162    /* Begin key */
    151  1.22      mrg #define    KEY_CANCEL     0x163    /* Cancel key */
    152  1.22      mrg #define    KEY_CLOSE      0x164    /* Close Key */
    153  1.22      mrg #define    KEY_COMMAND    0x165    /* Command Key */
    154  1.22      mrg #define    KEY_COPY       0x166    /* Copy key */
    155  1.22      mrg #define    KEY_CREATE     0x167    /* Create key */
    156  1.22      mrg #define    KEY_END        0x168    /* End key */
    157  1.22      mrg #define    KEY_EXIT       0x169    /* Exit key */
    158  1.22      mrg #define    KEY_FIND       0x16A    /* Find key */
    159  1.22      mrg #define    KEY_HELP       0x16B    /* Help key */
    160  1.22      mrg #define    KEY_MARK       0x16C    /* Mark key */
    161  1.22      mrg #define    KEY_MESSAGE    0x16D    /* Message key */
    162  1.22      mrg #define    KEY_MOVE       0x16E    /* Move key */
    163  1.22      mrg #define    KEY_NEXT       0x16F    /* Next Object key */
    164  1.22      mrg #define    KEY_OPEN       0x170    /* Open key */
    165  1.22      mrg #define    KEY_OPTIONS    0x171    /* Options key */
    166  1.22      mrg #define    KEY_PREVIOUS   0x172    /* Previous Object key */
    167  1.22      mrg #define    KEY_REDO       0x173    /* Redo key */
    168  1.22      mrg #define    KEY_REFERENCE  0x174    /* Ref Key */
    169  1.22      mrg #define    KEY_REFRESH    0x175    /* Refresh key */
    170  1.22      mrg #define    KEY_REPLACE    0x176    /* Replace key */
    171  1.22      mrg #define    KEY_RESTART    0x177    /* Restart key */
    172  1.22      mrg #define    KEY_RESUME     0x178    /* Resume key */
    173  1.22      mrg #define    KEY_SAVE       0x179    /* Save key */
    174  1.22      mrg #define    KEY_SBEG       0x17A    /* Shift begin key */
    175  1.22      mrg #define    KEY_SCANCEL    0x17B    /* Shift Cancel key */
    176  1.22      mrg #define    KEY_SCOMMAND   0x17C    /* Shift Command key */
    177  1.22      mrg #define    KEY_SCOPY      0x17D    /* Shift Copy key */
    178  1.22      mrg #define    KEY_SCREATE    0x17E    /* Shift Create key */
    179  1.22      mrg #define    KEY_SDC        0x17F    /* Shift Delete Character */
    180  1.22      mrg #define    KEY_SDL        0x180    /* Shift Delete Line */
    181  1.22      mrg #define    KEY_SELECT     0x181    /* Select key */
    182  1.22      mrg #define    KEY_SEND       0x182    /* Send key */
    183  1.22      mrg #define    KEY_SEOL       0x183    /* Shift Clear Line key */
    184  1.22      mrg #define    KEY_SEXIT      0x184    /* Shift Exit key */
    185  1.22      mrg #define    KEY_SFIND      0x185    /* Shift Find key */
    186  1.22      mrg #define    KEY_SHELP      0x186    /* Shift Help key */
    187  1.22      mrg #define    KEY_SHOME      0x187    /* Shift Home key */
    188  1.22      mrg #define    KEY_SIC        0x188    /* Shift Input key */
    189  1.22      mrg #define    KEY_SLEFT      0x189    /* Shift Left Arrow key */
    190  1.22      mrg #define    KEY_SMESSAGE   0x18A    /* Shift Message key */
    191  1.22      mrg #define    KEY_SMOVE      0x18B    /* Shift Move key */
    192  1.22      mrg #define    KEY_SNEXT      0x18C    /* Shift Next key */
    193  1.22      mrg #define    KEY_SOPTIONS   0x18D    /* Shift Options key */
    194  1.22      mrg #define    KEY_SPREVIOUS  0x18E    /* Shift Previous key */
    195  1.22      mrg #define    KEY_SPRINT     0x18F    /* Shift Print key */
    196  1.22      mrg #define    KEY_SREDO      0x190    /* Shift Redo key */
    197  1.22      mrg #define    KEY_SREPLACE   0x191    /* Shift Replace key */
    198  1.22      mrg #define    KEY_SRIGHT     0x192    /* Shift Right Arrow key */
    199  1.22      mrg #define    KEY_SRESUME    0x193    /* Shift Resume key */
    200  1.22      mrg #define    KEY_SSAVE      0x194    /* Shift Save key */
    201  1.22      mrg #define    KEY_SSUSPEND   0x195    /* Shift Suspend key */
    202  1.22      mrg #define    KEY_SUNDO      0x196    /* Shift Undo key */
    203  1.22      mrg #define    KEY_SUSPEND    0x197    /* Suspend key */
    204  1.22      mrg #define    KEY_UNDO       0x198    /* Undo key  */
    205  1.22      mrg #define    KEY_MAX        0x198    /* maximum extended key value */
    206  1.22      mrg 
    207   1.7      cgd /* 8-bit ASCII characters. */
    208   1.7      cgd #define	unctrl(c)		__unctrl[(c) & 0xff]
    209   1.7      cgd #define	unctrllen(ch)		__unctrllen[(ch) & 0xff]
    210   1.7      cgd 
    211  1.22      mrg extern char	 *__unctrl[256];	/* Control strings. */
    212   1.7      cgd extern char	 __unctrllen[256];	/* Control strings length. */
    213   1.7      cgd 
    214   1.7      cgd /*
    215   1.7      cgd  * A window an array of __LINE structures pointed to by the 'lines' pointer.
    216   1.7      cgd  * A line is an array of __LDATA structures pointed to by the 'line' pointer.
    217   1.7      cgd  *
    218   1.7      cgd  * IMPORTANT: the __LDATA structure must NOT induce any padding, so if new
    219  1.24   simonb  * fields are added -- padding fields with *constant values* should ensure
    220   1.7      cgd  * that the compiler will not generate any padding when storing an array of
    221   1.7      cgd  *  __LDATA structures.  This is to enable consistent use of memcmp, and memcpy
    222   1.7      cgd  * for comparing and copying arrays.
    223   1.7      cgd  */
    224   1.7      cgd typedef struct {
    225  1.22      mrg 	int	ch;			/* the actual character */
    226   1.7      cgd 
    227  1.22      mrg #define	__NORMAL	0x00  		/* Added characters are normal. */
    228   1.7      cgd #define	__STANDOUT	0x01  		/* Added characters are standout. */
    229  1.22      mrg #define	__UNDERSCORE	0x02  		/* Added characters are underscored. */
    230  1.22      mrg #define	__REVERSE	0x04  		/* Added characters are reverse \
    231  1.22      mrg 						video. */
    232  1.22      mrg #define	__BLINK		0x08  		/* Added characters are blinking. */
    233  1.22      mrg #define	__DIM		0x10  		/* Added characters are dim. */
    234  1.22      mrg #define	__BOLD		0x20  		/* Added characters are bold. */
    235  1.22      mrg #define	__BLANK		0x40  		/* Added characters are blanked. */
    236  1.22      mrg #define	__PROTECT	0x80  		/* Added characters are protected. */
    237  1.22      mrg #define	__ATTRIBUTES	0xfe  		/* All character attributes
    238  1.22      mrg 						(excluding standout). */
    239  1.22      mrg 	char	attr;			/* attributes of character */
    240   1.7      cgd } __LDATA;
    241   1.7      cgd 
    242   1.7      cgd #define __LDATASIZE	(sizeof(__LDATA))
    243   1.7      cgd 
    244   1.7      cgd typedef struct {
    245   1.7      cgd #define	__ISDIRTY	0x01		/* Line is dirty. */
    246   1.7      cgd #define __ISPASTEOL	0x02		/* Cursor is past end of line */
    247   1.7      cgd #define __FORCEPAINT	0x04		/* Force a repaint of the line */
    248  1.16      jtc 	unsigned int flags;
    249  1.16      jtc 	unsigned int hash;		/* Hash value for the line. */
    250   1.7      cgd 	size_t *firstchp, *lastchp;	/* First and last chngd columns ptrs */
    251   1.7      cgd 	size_t firstch, lastch;		/* First and last changed columns. */
    252   1.7      cgd 	__LDATA *line;			/* Pointer to the line text. */
    253   1.7      cgd } __LINE;
    254   1.7      cgd 
    255   1.7      cgd typedef struct __window {		/* Window structure. */
    256   1.7      cgd 	struct __window	*nextp, *orig;	/* Subwindows list and parent. */
    257   1.7      cgd 	size_t begy, begx;		/* Window home. */
    258   1.7      cgd 	size_t cury, curx;		/* Current x, y coordinates. */
    259   1.7      cgd 	size_t maxy, maxx;		/* Maximum values for curx, cury. */
    260   1.7      cgd 	short ch_off;			/* x offset for firstch/lastch. */
    261   1.7      cgd 	__LINE **lines;			/* Array of pointers to the lines */
    262   1.7      cgd 	__LINE  *lspace;		/* line space (for cleanup) */
    263   1.7      cgd 	__LDATA *wspace;		/* window space (for cleanup) */
    264  1.22      mrg 
    265  1.22      mrg #define	__ENDLINE	0x00001		/* End of screen. */
    266  1.22      mrg #define	__FLUSH		0x00002		/* Fflush(stdout) after refresh. */
    267  1.22      mrg #define	__FULLWIN	0x00004		/* Window is a screen. */
    268  1.22      mrg #define	__IDLINE	0x00008		/* Insert/delete sequences. */
    269  1.22      mrg #define	__SCROLLWIN	0x00010		/* Last char will scroll window. */
    270  1.22      mrg #define	__SCROLLOK	0x00020		/* Scrolling ok. */
    271  1.22      mrg #define	__CLEAROK	0x00040		/* Clear on next refresh. */
    272  1.22      mrg #define	__WSTANDOUT	0x00080		/* Standout window */
    273  1.24   simonb #define	__LEAVEOK	0x00100		/* If curser left */
    274  1.22      mrg #define	__WUNDERSCORE	0x00200 	/* Underscored window */
    275  1.22      mrg #define	__WREVERSE	0x00400		/* Reverse video window */
    276  1.22      mrg #define	__WBLINK	0x00800		/* Blinking window */
    277  1.22      mrg #define	__WDIM		0x01000		/* Dim window */
    278  1.22      mrg #define	__WBOLD		0x02000		/* Bold window */
    279  1.22      mrg #define	__WBLANK	0x04000		/* Blanked window */
    280  1.22      mrg #define	__WPROTECT	0x08000		/* Protected window */
    281  1.22      mrg #define	__WATTRIBUTES	0x0fc00		/* All character attributes
    282  1.22      mrg 						(excluding standout). */
    283  1.22      mrg #define	__KEYPAD	0x10000		/* If interpreting keypad codes */
    284  1.22      mrg #define	__NOTIMEOUT	0x20000		/* Wait indefinitely for func keys */
    285  1.23   simonb 	unsigned int flags;
    286   1.7      cgd 
    287  1.23   simonb 	int	delay;			/* delay for getch() */
    288   1.7      cgd } WINDOW;
    289   1.7      cgd 
    290   1.4  mycroft /* Curses external declarations. */
    291   1.4  mycroft extern WINDOW	*curscr;		/* Current screen. */
    292   1.4  mycroft extern WINDOW	*stdscr;		/* Standard screen. */
    293   1.4  mycroft 
    294   1.7      cgd extern struct termios __orig_termios;	/* Terminal state before curses */
    295   1.7      cgd extern struct termios __baset;		/* Our base terminal state */
    296  1.22      mrg extern int	__tcaction;		/* If terminal hardware set. */
    297   1.4  mycroft 
    298   1.4  mycroft extern int	 COLS;			/* Columns on the screen. */
    299   1.4  mycroft extern int	 LINES;			/* Lines on the screen. */
    300   1.4  mycroft 
    301   1.4  mycroft extern char	*ttytype;		/* Full name of current terminal. */
    302   1.4  mycroft 
    303   1.4  mycroft #define	ERR	(0)			/* Error return. */
    304   1.4  mycroft #define	OK	(1)			/* Success return. */
    305   1.4  mycroft 
    306   1.4  mycroft /* Standard screen pseudo functions. */
    307   1.7      cgd #define	addbytes(s, n)			__waddbytes(stdscr, s, n, 0)
    308   1.7      cgd #define	addch(ch)			waddch(stdscr, ch)
    309   1.7      cgd #define	addnstr(s, n)			waddnstr(stdscr, s, n)
    310   1.7      cgd #define	addstr(s)			__waddbytes(stdscr, s, strlen(s), 0)
    311   1.7      cgd #define	clear()				wclear(stdscr)
    312   1.7      cgd #define	clrtobot()			wclrtobot(stdscr)
    313   1.7      cgd #define	clrtoeol()			wclrtoeol(stdscr)
    314   1.7      cgd #define	delch()				wdelch(stdscr)
    315   1.7      cgd #define	deleteln()			wdeleteln(stdscr)
    316   1.7      cgd #define	erase()				werase(stdscr)
    317   1.7      cgd #define	getch()				wgetch(stdscr)
    318   1.7      cgd #define	getstr(s)			wgetstr(stdscr, s)
    319   1.7      cgd #define	inch()				winch(stdscr)
    320   1.7      cgd #define	insch(ch)			winsch(stdscr, ch)
    321   1.7      cgd #define	insertln()			winsertln(stdscr)
    322   1.7      cgd #define	move(y, x)			wmove(stdscr, y, x)
    323   1.7      cgd #define	refresh()			wrefresh(stdscr)
    324   1.7      cgd #define	standend()			wstandend(stdscr)
    325   1.7      cgd #define	standout()			wstandout(stdscr)
    326  1.22      mrg #define	timeout(delay)			wtimeout(stdscr, delay)
    327  1.22      mrg #define	underscore()			wunderscore(stdscr)
    328  1.22      mrg #define	underend()			wunderend(stdscr)
    329  1.22      mrg #define	attron(attr)			wattron(stdscr, attr)
    330  1.22      mrg #define	attroff(attr)			wattroff(stdscr, attr)
    331  1.22      mrg #define	attrset(attr)			wattrset(stdscr, attr)
    332   1.7      cgd #define	waddbytes(w, s, n)		__waddbytes(w, s, n, 0)
    333   1.7      cgd #define	waddstr(w, s)			__waddbytes(w, s, strlen(s), 0)
    334   1.4  mycroft 
    335  1.22      mrg /* Attributes */
    336  1.22      mrg #define A_NORMAL	__NORMAL
    337  1.22      mrg #define	A_STANDOUT	__UNDERSCORE
    338  1.22      mrg #define	A_UNDERLINE	__UNDERSCORE
    339  1.22      mrg #define	A_REVERSE	__REVERSE
    340  1.22      mrg #define	A_BLINK		__BLINK
    341  1.22      mrg #define	A_DIM		__DIM
    342  1.22      mrg #define	A_BOLD		__BOLD
    343  1.22      mrg #define	A_BLANK		__BLANK
    344  1.22      mrg #define	A_PROTECT	__PROTECT
    345  1.22      mrg #define A_ATTRIBUTES	__ATTRIBUTES
    346  1.22      mrg 
    347   1.4  mycroft /* Standard screen plus movement pseudo functions. */
    348   1.7      cgd #define	mvaddbytes(y, x, s, n)		mvwaddbytes(stdscr, y, x, s, n)
    349   1.7      cgd #define	mvaddch(y, x, ch)		mvwaddch(stdscr, y, x, ch)
    350   1.7      cgd #define	mvaddnstr(y, x, s, n)		mvwaddnstr(stdscr, y, x, s, n)
    351   1.7      cgd #define	mvaddstr(y, x, s)		mvwaddstr(stdscr, y, x, s)
    352   1.7      cgd #define	mvdelch(y, x)			mvwdelch(stdscr, y, x)
    353   1.7      cgd #define	mvgetch(y, x)			mvwgetch(stdscr, y, x)
    354   1.7      cgd #define	mvgetstr(y, x, s)		mvwgetstr(stdscr, y, x, s)
    355   1.7      cgd #define	mvinch(y, x)			mvwinch(stdscr, y, x)
    356   1.7      cgd #define	mvinsch(y, x, c)		mvwinsch(stdscr, y, x, c)
    357   1.7      cgd #define	mvwaddbytes(w, y, x, s, n) \
    358   1.7      cgd 	(wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, n, 0))
    359   1.7      cgd #define	mvwaddch(w, y, x, ch) \
    360   1.7      cgd 	(wmove(w, y, x) == ERR ? ERR : waddch(w, ch))
    361   1.7      cgd #define	mvwaddnstr(w, y, x, s, n) \
    362   1.7      cgd 	(wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, n))
    363   1.7      cgd #define	mvwaddstr(w, y, x, s) \
    364   1.7      cgd 	(wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, strlen(s), 0))
    365   1.7      cgd #define	mvwdelch(w, y, x) \
    366   1.7      cgd 	(wmove(w, y, x) == ERR ? ERR : wdelch(w))
    367   1.7      cgd #define	mvwgetch(w, y, x) \
    368   1.7      cgd 	(wmove(w, y, x) == ERR ? ERR : wgetch(w))
    369   1.7      cgd #define	mvwgetstr(w, y, x, s) \
    370   1.7      cgd 	(wmove(w, y, x) == ERR ? ERR : wgetstr(w, s))
    371   1.7      cgd #define	mvwinch(w, y, x) \
    372   1.7      cgd 	(wmove(w, y, x) == ERR ? ERR : winch(w))
    373   1.7      cgd #define	mvwinsch(w, y, x, c) \
    374   1.7      cgd 	(wmove(w, y, x) == ERR ? ERR : winsch(w, c))
    375   1.7      cgd 
    376  1.17      jtc 
    377   1.7      cgd /* Psuedo functions. */
    378   1.7      cgd #define	clearok(w, bf) \
    379  1.22      mrg ((/* CONSTCOND */ bf) ? ((w)->flags |= __CLEAROK) : ((w)->flags &= ~__CLEAROK))
    380   1.7      cgd #define	flushok(w, bf) \
    381   1.7      cgd 	((bf) ? ((w)->flags |= __FLUSH) : ((w)->flags &= ~__FLUSH))
    382   1.7      cgd #define	leaveok(w, bf) \
    383   1.7      cgd 	((bf) ? ((w)->flags |= __LEAVEOK) : ((w)->flags &= ~__LEAVEOK))
    384   1.7      cgd #define	scrollok(w, bf) \
    385   1.7      cgd 	((bf) ? ((w)->flags |= __SCROLLOK) : ((w)->flags &= ~__SCROLLOK))
    386   1.7      cgd #define	winch(w) \
    387   1.7      cgd 	((w)->lines[(w)->cury]->line[(w)->curx].ch & 0177)
    388  1.17      jtc 
    389  1.17      jtc #define	getyx(w, y, x)		(y) = getcury(w), (x) = getcurx(w)
    390  1.17      jtc #define getbegyx(w, y, x)	(y) = getbegy(w), (x) = getbegx(w)
    391  1.17      jtc #define getmaxyx(w, y, x)	(y) = getmaxy(w), (x) = getmaxx(w)
    392  1.17      jtc #define getcury(w)		((w)->cury)
    393  1.17      jtc #define getcurx(w)		((w)->curx)
    394  1.17      jtc #define getbegy(w)		((w)->begy)
    395  1.17      jtc #define getbegx(w)		((w)->begx)
    396  1.17      jtc #define getmaxy(w)		((w)->maxy)
    397  1.17      jtc #define getmaxx(w)		((w)->maxx)
    398   1.4  mycroft 
    399   1.4  mycroft /* Public function prototypes. */
    400  1.14      jtc __BEGIN_DECLS
    401  1.22      mrg int	 beep __P((void));
    402   1.4  mycroft int	 box __P((WINDOW *, int, int));
    403   1.4  mycroft int	 cbreak __P((void));
    404   1.4  mycroft int	 delwin __P((WINDOW *));
    405   1.4  mycroft int	 echo __P((void));
    406   1.4  mycroft int	 endwin __P((void));
    407  1.22      mrg int	 flash __P((void));
    408  1.22      mrg int	 flushinp __P((void));
    409   1.4  mycroft char	*fullname __P((char *, char *));
    410   1.4  mycroft char	*getcap __P((char *));
    411   1.4  mycroft int	 gettmode __P((void));
    412   1.4  mycroft void	 idlok __P((WINDOW *, int));
    413   1.4  mycroft WINDOW	*initscr __P((void));
    414  1.22      mrg int	 isendwin __P((void));
    415  1.22      mrg void	 keypad __P((WINDOW *, int));
    416   1.4  mycroft char	*longname __P((char *, char *));
    417   1.4  mycroft int	 mvcur __P((int, int, int, int));
    418   1.4  mycroft int	 mvprintw __P((int, int, const char *, ...));
    419   1.4  mycroft int	 mvscanw __P((int, int, const char *, ...));
    420   1.4  mycroft int	 mvwin __P((WINDOW *, int, int));
    421   1.4  mycroft int	 mvwprintw __P((WINDOW *, int, int, const char *, ...));
    422   1.4  mycroft int	 mvwscanw __P((WINDOW *, int, int, const char *, ...));
    423   1.4  mycroft WINDOW	*newwin __P((int, int, int, int));
    424   1.4  mycroft int	 nl __P((void));
    425   1.4  mycroft int	 nocbreak __P((void));
    426  1.22      mrg void     nodelay __P((WINDOW *, int));
    427   1.4  mycroft int	 noecho __P((void));
    428   1.4  mycroft int	 nonl __P((void));
    429   1.4  mycroft int	 noraw __P((void));
    430  1.22      mrg void     notimeout __P((WINDOW *, int));
    431   1.4  mycroft int	 overlay __P((WINDOW *, WINDOW *));
    432   1.4  mycroft int	 overwrite __P((WINDOW *, WINDOW *));
    433   1.4  mycroft int	 printw __P((const char *, ...));
    434   1.4  mycroft int	 raw __P((void));
    435   1.4  mycroft int	 resetty __P((void));
    436   1.4  mycroft int	 savetty __P((void));
    437   1.4  mycroft int	 scanw __P((const char *, ...));
    438   1.4  mycroft int	 scroll __P((WINDOW *));
    439   1.4  mycroft int	 setterm __P((char *));
    440   1.7      cgd int	 sscans __P((WINDOW *, const char *, ...));
    441   1.4  mycroft WINDOW	*subwin __P((WINDOW *, int, int, int, int));
    442   1.4  mycroft int	 suspendwin __P((void));
    443   1.4  mycroft int	 touchline __P((WINDOW *, int, int, int));
    444   1.4  mycroft int	 touchoverlap __P((WINDOW *, WINDOW *));
    445   1.4  mycroft int	 touchwin __P((WINDOW *));
    446  1.22      mrg int	 vwprintw __P((WINDOW *, const char *, _BSD_VA_LIST_));
    447  1.22      mrg int	 vwscanw __P((WINDOW *, const char *, _BSD_VA_LIST_));
    448   1.4  mycroft int	 waddch __P((WINDOW *, int));
    449   1.7      cgd int	 waddnstr __P((WINDOW *, const char *, int));
    450  1.22      mrg int	 wattron __P((WINDOW *, int));
    451  1.22      mrg int	 wattroff __P((WINDOW *, int));
    452  1.22      mrg int	 wattrset __P((WINDOW *, int));
    453   1.4  mycroft int	 wclear __P((WINDOW *));
    454   1.4  mycroft int	 wclrtobot __P((WINDOW *));
    455   1.4  mycroft int	 wclrtoeol __P((WINDOW *));
    456   1.4  mycroft int	 wdelch __P((WINDOW *));
    457   1.4  mycroft int	 wdeleteln __P((WINDOW *));
    458   1.4  mycroft int	 werase __P((WINDOW *));
    459   1.4  mycroft int	 wgetch __P((WINDOW *));
    460   1.4  mycroft int	 wgetstr __P((WINDOW *, char *));
    461   1.4  mycroft int	 winsch __P((WINDOW *, int));
    462   1.4  mycroft int	 winsertln __P((WINDOW *));
    463   1.4  mycroft int	 wmove __P((WINDOW *, int, int));
    464   1.4  mycroft int	 wprintw __P((WINDOW *, const char *, ...));
    465   1.4  mycroft int	 wrefresh __P((WINDOW *));
    466   1.4  mycroft int	 wscanw __P((WINDOW *, const char *, ...));
    467  1.13      cgd int	 wstandend __P((WINDOW *));
    468  1.13      cgd int	 wstandout __P((WINDOW *));
    469  1.22      mrg void	 wtimeout __P((WINDOW *, int));
    470  1.22      mrg int	 wunderscore __P((WINDOW *));
    471  1.22      mrg int	 wunderend __P((WINDOW *));
    472  1.12      cgd int	 vwprintw __P((WINDOW *, const char *, _BSD_VA_LIST_));
    473   1.4  mycroft 
    474   1.7      cgd /* Private functions that are needed for user programs prototypes. */
    475   1.7      cgd void	 __cputchar __P((int));
    476   1.7      cgd int	 __waddbytes __P((WINDOW *, const char *, int, int));
    477  1.14      jtc __END_DECLS
    478   1.7      cgd 
    479   1.7      cgd /* Private functions. */
    480   1.4  mycroft #ifdef _CURSES_PRIVATE
    481   1.7      cgd void	 __CTRACE __P((const char *, ...));
    482  1.22      mrg int	 __delay __P((void));
    483  1.16      jtc unsigned int __hash __P((char *, int));
    484   1.4  mycroft void	 __id_subwins __P((WINDOW *));
    485  1.22      mrg void     __init_getch __P((char *));
    486   1.7      cgd int	 __mvcur __P((int, int, int, int, int));
    487  1.22      mrg int	 __nodelay __P((void));
    488  1.22      mrg int	 __notimeout __P((void));
    489  1.22      mrg void	 __restore_termios __P((void));
    490   1.7      cgd void	 __restore_stophandler __P((void));
    491  1.22      mrg void	 __save_termios __P((void));
    492   1.7      cgd void	 __set_stophandler __P((void));
    493   1.4  mycroft void	 __set_subwin __P((WINDOW *, WINDOW *));
    494   1.7      cgd void	 __startwin __P((void));
    495   1.7      cgd void	 __stop_signal_handler __P((int));
    496   1.4  mycroft void	 __swflags __P((WINDOW *));
    497  1.22      mrg int	 __timeout __P((int));
    498   1.7      cgd int	 __touchline __P((WINDOW *, int, int, int, int));
    499   1.7      cgd int	 __touchwin __P((WINDOW *));
    500  1.13      cgd char	*__tscroll __P((const char *, int, int));
    501   1.7      cgd int	 __waddch __P((WINDOW *, __LDATA *));
    502  1.19     phil int	 __stopwin __P((void));
    503  1.19     phil void	 __restartwin __P((void));
    504   1.4  mycroft 
    505   1.4  mycroft /* Private #defines. */
    506   1.4  mycroft #define	min(a,b)	(a < b ? a : b)
    507   1.4  mycroft #define	max(a,b)	(a > b ? a : b)
    508   1.4  mycroft 
    509   1.4  mycroft /* Private externs. */
    510   1.4  mycroft extern int	 __echoit;
    511   1.4  mycroft extern int	 __endwin;
    512   1.4  mycroft extern int	 __pfast;
    513   1.4  mycroft extern int	 __rawmode;
    514   1.7      cgd extern int	 __noqch;
    515   1.1      cgd #endif
    516   1.1      cgd 
    517   1.4  mycroft #endif /* !_CURSES_H_ */
    518