xref: /netbsd-src/lib/libcurses/curses.h (revision d20841bb642898112fe68f0ad3f7b26dddf56f07)
1 /*	$NetBSD: curses.h,v 1.81 2003/12/23 23:12:44 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. Neither the name of the University nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  *
31  *	@(#)curses.h	8.5 (Berkeley) 4/29/95
32  */
33 
34 #ifndef _CURSES_H_
35 #define	_CURSES_H_
36 
37 #include <sys/types.h>
38 #include <sys/cdefs.h>
39 #include <wchar.h>
40 
41 #include <stdio.h>
42 #include <termcap.h>
43 
44 /*
45  * attr_t must be the same size as wchar_t (see <wchar.h>) to avoid padding
46  * in __LDATA.
47  */
48 typedef wchar_t	chtype;
49 typedef wchar_t	attr_t;
50 
51 /* C++ already defines bool. */
52 #ifndef __cplusplus
53 typedef	char	bool;
54 #endif
55 
56 #ifndef TRUE
57 #define	TRUE	(/*CONSTCOND*/1)
58 #endif
59 #ifndef FALSE
60 #define	FALSE	(/*CONSTCOND*/0)
61 #endif
62 
63 #ifndef _CURSES_PRIVATE
64 
65 #define _puts(s)        tputs(s, 0, __cputchar)
66 #define _putchar(c)     __cputchar(c)
67 
68 /* Old-style terminal modes access. */
69 #define crmode()        cbreak()
70 #define nocrmode()      nocbreak()
71 #define ospeed          baudrate()
72 #endif /* _CURSES_PRIVATE */
73 
74 
75 /* symbols for values returned by getch in keypad mode */
76 #define    KEY_MIN        0x101    /* minimum extended key value */
77 #define    KEY_BREAK      0x101    /* break key */
78 #define    KEY_DOWN       0x102    /* down arrow */
79 #define    KEY_UP         0x103    /* up arrow */
80 #define    KEY_LEFT       0x104    /* left arrow */
81 #define    KEY_RIGHT      0x105    /* right arrow*/
82 #define    KEY_HOME       0x106    /* home key */
83 #define    KEY_BACKSPACE  0x107    /* Backspace */
84 
85 /* First function key (block of 64 follow) */
86 #define    KEY_F0         0x108
87 /* Function defining other function key values*/
88 #define    KEY_F(n)       (KEY_F0+(n))
89 
90 #define    KEY_DL         0x148    /* Delete Line */
91 #define    KEY_IL         0x149    /* Insert Line*/
92 #define    KEY_DC         0x14A    /* Delete Character */
93 #define    KEY_IC         0x14B    /* Insert Character */
94 #define    KEY_EIC        0x14C    /* Exit Insert Char mode */
95 #define    KEY_CLEAR      0x14D    /* Clear screen */
96 #define    KEY_EOS        0x14E    /* Clear to end of screen */
97 #define    KEY_EOL        0x14F    /* Clear to end of line */
98 #define    KEY_SF         0x150    /* Scroll one line forward */
99 #define    KEY_SR         0x151    /* Scroll one line back */
100 #define    KEY_NPAGE      0x152    /* Next Page */
101 #define    KEY_PPAGE      0x153    /* Prev Page */
102 #define    KEY_STAB       0x154    /* Set Tab */
103 #define    KEY_CTAB       0x155    /* Clear Tab */
104 #define    KEY_CATAB      0x156    /* Clear All Tabs */
105 #define    KEY_ENTER      0x157    /* Enter or Send */
106 #define    KEY_SRESET     0x158    /* Soft Reset */
107 #define    KEY_RESET      0x159    /* Hard Reset */
108 #define    KEY_PRINT      0x15A    /* Print */
109 #define    KEY_LL         0x15B    /* Home Down */
110 
111 /*
112  * "Keypad" keys arranged like this:
113  *
114  *  A1   up  A3
115  * left  B2 right
116  *  C1  down C3
117  *
118  */
119 #define    KEY_A1         0x15C    /* Keypad upper left */
120 #define    KEY_A3         0x15D    /* Keypad upper right */
121 #define    KEY_B2         0x15E    /* Keypad centre key */
122 #define    KEY_C1         0x15F    /* Keypad lower left */
123 #define    KEY_C3         0x160    /* Keypad lower right */
124 
125 #define    KEY_BTAB       0x161    /* Back Tab */
126 #define    KEY_BEG        0x162    /* Begin key */
127 #define    KEY_CANCEL     0x163    /* Cancel key */
128 #define    KEY_CLOSE      0x164    /* Close Key */
129 #define    KEY_COMMAND    0x165    /* Command Key */
130 #define    KEY_COPY       0x166    /* Copy key */
131 #define    KEY_CREATE     0x167    /* Create key */
132 #define    KEY_END        0x168    /* End key */
133 #define    KEY_EXIT       0x169    /* Exit key */
134 #define    KEY_FIND       0x16A    /* Find key */
135 #define    KEY_HELP       0x16B    /* Help key */
136 #define    KEY_MARK       0x16C    /* Mark key */
137 #define    KEY_MESSAGE    0x16D    /* Message key */
138 #define    KEY_MOVE       0x16E    /* Move key */
139 #define    KEY_NEXT       0x16F    /* Next Object key */
140 #define    KEY_OPEN       0x170    /* Open key */
141 #define    KEY_OPTIONS    0x171    /* Options key */
142 #define    KEY_PREVIOUS   0x172    /* Previous Object key */
143 #define    KEY_REDO       0x173    /* Redo key */
144 #define    KEY_REFERENCE  0x174    /* Ref Key */
145 #define    KEY_REFRESH    0x175    /* Refresh key */
146 #define    KEY_REPLACE    0x176    /* Replace key */
147 #define    KEY_RESTART    0x177    /* Restart key */
148 #define    KEY_RESUME     0x178    /* Resume key */
149 #define    KEY_SAVE       0x179    /* Save key */
150 #define    KEY_SBEG       0x17A    /* Shift begin key */
151 #define    KEY_SCANCEL    0x17B    /* Shift Cancel key */
152 #define    KEY_SCOMMAND   0x17C    /* Shift Command key */
153 #define    KEY_SCOPY      0x17D    /* Shift Copy key */
154 #define    KEY_SCREATE    0x17E    /* Shift Create key */
155 #define    KEY_SDC        0x17F    /* Shift Delete Character */
156 #define    KEY_SDL        0x180    /* Shift Delete Line */
157 #define    KEY_SELECT     0x181    /* Select key */
158 #define    KEY_SEND       0x182    /* Send key */
159 #define    KEY_SEOL       0x183    /* Shift Clear Line key */
160 #define    KEY_SEXIT      0x184    /* Shift Exit key */
161 #define    KEY_SFIND      0x185    /* Shift Find key */
162 #define    KEY_SHELP      0x186    /* Shift Help key */
163 #define    KEY_SHOME      0x187    /* Shift Home key */
164 #define    KEY_SIC        0x188    /* Shift Input key */
165 #define    KEY_SLEFT      0x189    /* Shift Left Arrow key */
166 #define    KEY_SMESSAGE   0x18A    /* Shift Message key */
167 #define    KEY_SMOVE      0x18B    /* Shift Move key */
168 #define    KEY_SNEXT      0x18C    /* Shift Next key */
169 #define    KEY_SOPTIONS   0x18D    /* Shift Options key */
170 #define    KEY_SPREVIOUS  0x18E    /* Shift Previous key */
171 #define    KEY_SPRINT     0x18F    /* Shift Print key */
172 #define    KEY_SREDO      0x190    /* Shift Redo key */
173 #define    KEY_SREPLACE   0x191    /* Shift Replace key */
174 #define    KEY_SRIGHT     0x192    /* Shift Right Arrow key */
175 #define    KEY_SRSUME     0x193    /* Shift Resume key */
176 #define    KEY_SSAVE      0x194    /* Shift Save key */
177 #define    KEY_SSUSPEND   0x195    /* Shift Suspend key */
178 #define    KEY_SUNDO      0x196    /* Shift Undo key */
179 #define    KEY_SUSPEND    0x197    /* Suspend key */
180 #define    KEY_UNDO       0x198    /* Undo key */
181 #define    KEY_MOUSE      0x199    /* Mouse event has occurred */
182 #define    KEY_MAX        0x199    /* maximum extended key value */
183 
184 /* 8-bit ASCII characters. */
185 #define	unctrl(c)		__unctrl[((unsigned)c) & 0xff]
186 #define	unctrllen(ch)		__unctrllen[((unsigned)ch) & 0xff]
187 
188 extern char	 *__unctrl[256];	/* Control strings. */
189 extern char	 __unctrllen[256];	/* Control strings length. */
190 
191 /*
192  * A window an array of __LINE structures pointed to by the 'lines' pointer.
193  * A line is an array of __LDATA structures pointed to by the 'line' pointer.
194  */
195 
196 /*
197  * Definitions for characters and attributes in __LDATA
198  */
199 #define __CHARTEXT	0x000000ff	/* bits for 8-bit characters */
200 #define __NORMAL	0x00000000	/* Added characters are normal. */
201 #define __STANDOUT	0x00010000	/* Added characters are standout. */
202 #define __UNDERSCORE	0x00020000	/* Added characters are underscored. */
203 #define __REVERSE	0x00040000	/* Added characters are reverse
204 					   video. */
205 #define __BLINK		0x00080000	/* Added characters are blinking. */
206 #define __DIM		0x00100000	/* Added characters are dim. */
207 #define __BOLD		0x00200000	/* Added characters are bold. */
208 #define __BLANK		0x00400000	/* Added characters are blanked. */
209 #define __PROTECT	0x00800000	/* Added characters are protected. */
210 #define __ALTCHARSET	0x01000000	/* Added characters are ACS */
211 #define __COLOR		0x7e000000	/* Color bits */
212 #define __ATTRIBUTES	0x7fff0000	/* All 8-bit attribute bits */
213 
214 typedef struct __ldata __LDATA;
215 typedef struct __line  __LINE;
216 typedef struct __window  WINDOW;
217 typedef struct __screen SCREEN;
218 
219 /*
220  * Attribute definitions
221  */
222 #define	A_NORMAL	__NORMAL
223 #define	A_STANDOUT	__STANDOUT
224 #define	A_UNDERLINE	__UNDERSCORE
225 #define	A_REVERSE	__REVERSE
226 #define	A_BLINK		__BLINK
227 #define	A_DIM		__DIM
228 #define	A_BOLD		__BOLD
229 #define	A_BLANK		__BLANK
230 #define	A_PROTECT	__PROTECT
231 #define	A_ALTCHARSET	__ALTCHARSET
232 #define	A_ATTRIBUTES	__ATTRIBUTES
233 #define	A_CHARTEXT	__CHARTEXT
234 #define	A_COLOR		__COLOR
235 
236 /*
237  * Alternate character set definitions
238  */
239 
240 #define	NUM_ACS	128
241 
242 extern chtype _acs_char[NUM_ACS];
243 
244 #define	ACS_RARROW	_acs_char[(unsigned char)'+']
245 #define	ACS_LARROW	_acs_char[(unsigned char)',']
246 #define	ACS_UARROW	_acs_char[(unsigned char)'-']
247 #define	ACS_DARROW	_acs_char[(unsigned char)'.']
248 #define	ACS_BLOCK	_acs_char[(unsigned char)'0']
249 #define	ACS_DIAMOND	_acs_char[(unsigned char)'`']
250 #define	ACS_CKBOARD	_acs_char[(unsigned char)'a']
251 #define	ACS_DEGREE	_acs_char[(unsigned char)'f']
252 #define	ACS_PLMINUS	_acs_char[(unsigned char)'g']
253 #define	ACS_BOARD	_acs_char[(unsigned char)'h']
254 #define	ACS_LANTERN	_acs_char[(unsigned char)'i']
255 #define	ACS_LRCORNER	_acs_char[(unsigned char)'j']
256 #define	ACS_URCORNER	_acs_char[(unsigned char)'k']
257 #define	ACS_ULCORNER	_acs_char[(unsigned char)'l']
258 #define	ACS_LLCORNER	_acs_char[(unsigned char)'m']
259 #define	ACS_PLUS	_acs_char[(unsigned char)'n']
260 #define	ACS_HLINE	_acs_char[(unsigned char)'q']
261 #define	ACS_S1		_acs_char[(unsigned char)'o']
262 #define	ACS_S9		_acs_char[(unsigned char)'s']
263 #define	ACS_LTEE	_acs_char[(unsigned char)'t']
264 #define	ACS_RTEE	_acs_char[(unsigned char)'u']
265 #define	ACS_BTEE	_acs_char[(unsigned char)'v']
266 #define	ACS_TTEE	_acs_char[(unsigned char)'w']
267 #define	ACS_VLINE	_acs_char[(unsigned char)'x']
268 #define	ACS_BULLET	_acs_char[(unsigned char)'~']
269 
270 /* System V compatibility */
271 #define	ACS_SBBS	ACS_LRCORNER
272 #define	ACS_BBSS	ACS_URCORNER
273 #define	ACS_BSSB	ACS_ULCORNER
274 #define	ACS_SSBB	ACS_LLCORNER
275 #define	ACS_SSSS	ACS_PLUS
276 #define	ACS_BSBS	ACS_HLINE
277 #define	ACS_SSSB	ACS_LTEE
278 #define	ACS_SBSS	ACS_RTEE
279 #define	ACS_SSBS	ACS_BTEE
280 #define	ACS_BSSS	ACS_TTEE
281 #define	ACS_SBSB	ACS_VLINE
282 #define	_acs_map	_acs_char
283 
284 /*
285  * Colour definitions (ANSI colour numbers)
286  */
287 
288 #define	COLOR_BLACK	0x00
289 #define	COLOR_RED	0x01
290 #define	COLOR_GREEN	0x02
291 #define	COLOR_YELLOW	0x03
292 #define	COLOR_BLUE	0x04
293 #define	COLOR_MAGENTA	0x05
294 #define	COLOR_CYAN	0x06
295 #define	COLOR_WHITE	0x07
296 
297 #define	COLOR_PAIR(n)	((((u_int32_t)n) << 25) & A_COLOR)
298 #define	PAIR_NUMBER(n)	((((u_int32_t)n) & A_COLOR) >> 25)
299 
300 /* Curses external declarations. */
301 extern WINDOW	*curscr;		/* Current screen. */
302 extern WINDOW	*stdscr;		/* Standard screen. */
303 
304 extern int	__tcaction;		/* If terminal hardware set. */
305 
306 extern int	 COLS;			/* Columns on the screen. */
307 extern int	 LINES;			/* Lines on the screen. */
308 extern int	 COLORS;		/* Max colours on the screen. */
309 extern int	 COLOR_PAIRS;		/* Max colour pairs on the screen. */
310 
311 extern int	 ESCDELAY;		/* Delay between keys in esc seq's. */
312 
313 #define	ERR	(0)			/* Error return. */
314 #define	OK	(1)			/* Success return. */
315 
316 /*
317  * The following have, traditionally, been macros but X/Open say they
318  * need to be functions.  Keep the old macros for debugging.
319  */
320 #ifdef _CURSES_USE_MACROS
321 /* Standard screen pseudo functions. */
322 #define	addbytes(s, n)			__waddbytes(stdscr, s, n, 0)
323 #define	addch(ch)			waddch(stdscr, ch)
324 #define	addchnstr(s)			waddchnstr(stdscr, s, n)
325 #define	addchstr(s)			waddchnstr(stdscr, s, -1)
326 #define	addnstr(s, n)			waddnstr(stdscr, s, n)
327 #define	addstr(s)			waddnstr(stdscr, s, -1)
328 #define attr_get(a, p, o)		wattr_get(stdscr, a, p, o)
329 #define attr_off(a, o)			wattr_off(stdscr, a, o)
330 #define attr_on(a, o)			wattr_on(stdscr, a, o)
331 #define attr_set(a, p, o)		wattr_set(stdscr, a, p, o)
332 #define	attroff(attr)			wattroff(stdscr, attr)
333 #define	attron(attr)			wattron(stdscr, attr)
334 #define	attrset(attr)			wattrset(stdscr, attr)
335 #define bkgd(ch)			wbkgd(stdscr, ch)
336 #define bkgdset(ch)			wbkgdset(stdscr, ch)
337 #define	border(l, r, t, b, tl, tr, bl, br) \
338 	wborder(stdscr, l, r, t, b, tl, tr, bl, br)
339 #define	clear()				wclear(stdscr)
340 #define	clrtobot()			wclrtobot(stdscr)
341 #define	clrtoeol()			wclrtoeol(stdscr)
342 #define color_set(c, o)			wcolor_set(stdscr, c, o)
343 #define	delch()				wdelch(stdscr)
344 #define	deleteln()			wdeleteln(stdscr)
345 #define	erase()				werase(stdscr)
346 #define	getch()				wgetch(stdscr)
347 #define	getnstr(s, n)			wgetnstr(stdscr, s, n)
348 #define	getstr(s)			wgetstr(stdscr, s)
349 #define	inch()				winch(stdscr)
350 #define	inchnstr(c)			winchnstr(stdscr, c)
351 #define	inchstr(c)			winchstr(stdscr, c)
352 #define	innstr(s, n)			winnstr(stdscr, s, n)
353 #define	insch(ch)			winsch(stdscr, ch)
354 #define	insdelln(n)			winsdelln(stdscr, n)
355 #define	insertln()			winsertln(stdscr)
356 #define	instr(s)			winstr(stdscr, s)
357 #define	move(y, x)			wmove(stdscr, y, x)
358 #define	refresh()			wrefresh(stdscr)
359 #define	scrl(n)				wscrl(stdscr, n)
360 #define	setscrreg(t, b)			wsetscrreg(stdscr, t, b)
361 #define	standend()			wstandend(stdscr)
362 #define	standout()			wstandout(stdscr)
363 #define	timeout(delay)			wtimeout(stdscr, delay)
364 #define	underscore()			wunderscore(stdscr)
365 #define	underend()			wunderend(stdscr)
366 #define	waddbytes(w, s, n)		__waddbytes(w, s, n, 0)
367 #define	waddstr(w, s)			waddnstr(w, s, -1)
368 
369 /* Standard screen plus movement pseudo functions. */
370 #define	mvaddbytes(y, x, s, n)		mvwaddbytes(stdscr, y, x, s, n)
371 #define	mvaddch(y, x, ch)		mvwaddch(stdscr, y, x, ch)
372 #define	mvaddchnstr(y, x, s, n)		mvwaddchnstr(stdscr, y, x, s, n)
373 #define	mvaddchstr(y, x, s)		mvwaddchstr(stdscr, y, x, s)
374 #define	mvaddnstr(y, x, s, n)		mvwaddnstr(stdscr, y, x, s, n)
375 #define	mvaddstr(y, x, s)		mvwaddstr(stdscr, y, x, s)
376 #define	mvdelch(y, x)			mvwdelch(stdscr, y, x)
377 #define	mvgetch(y, x)			mvwgetch(stdscr, y, x)
378 #define	mvgetnstr(y, x, s)		mvwgetnstr(stdscr, y, x, s, n)
379 #define	mvgetstr(y, x, s)		mvwgetstr(stdscr, y, x, s)
380 #define	mvinch(y, x)			mvwinch(stdscr, y, x)
381 #define	mvinchnstr(y, x, c, n)		mvwinchnstr(stdscr, y, x, c, n)
382 #define	mvinchstr(y, x, c)		mvwinchstr(stdscr, y, x, c)
383 #define	mvinnstr(y, x, s, n)		mvwinnstr(stdscr, y, x, s, n)
384 #define	mvinsch(y, x, c)		mvwinsch(stdscr, y, x, c)
385 #define	mvinstr(y, x, s)		mvwinstr(stdscr, y, x, s)
386 #define	mvwaddbytes(w, y, x, s, n) \
387 	(wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, n, 0))
388 #define	mvwaddch(w, y, x, ch) \
389 	(wmove(w, y, x) == ERR ? ERR : waddch(w, ch))
390 #define	mvwaddchnstr(w, y, x, s, n) \
391 	(wmove(w, y, x) == ERR ? ERR : waddchnstr(w, s, n))
392 #define	mvwaddchstr(w, y, x, s) \
393 	(wmove(w, y, x) == ERR ? ERR : waddchnstr(w, s, -1))
394 #define	mvwaddnstr(w, y, x, s, n) \
395 	(wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, n))
396 #define	mvwaddstr(w, y, x, s) \
397 	(wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, -1))
398 #define	mvwdelch(w, y, x) \
399 	(wmove(w, y, x) == ERR ? ERR : wdelch(w))
400 #define	mvwgetch(w, y, x) \
401 	(wmove(w, y, x) == ERR ? ERR : wgetch(w))
402 #define	mvwgetnstr(w, y, x, s, n) \
403 	(wmove(w, y, x) == ERR ? ERR : wgetnstr(w, s, n))
404 #define	mvwgetstr(w, y, x, s) \
405 	(wmove(w, y, x) == ERR ? ERR : wgetstr(w, s))
406 #define	mvwinch(w, y, x) \
407 	(wmove(w, y, x) == ERR ? ERR : winch(w))
408 #define	mvwinchnstr(w, y, x, c, n) \
409 	(wmove(w, y, x) == ERR ? ERR : winchnstr(w, c, n))
410 #define	mvwinchstr(w, y, x, s) \
411 	(wmove(w, y, x) == ERR ? ERR : winchstr(w, c))
412 #define	mvwinnstr(w, y, x, s, n) \
413 	(wmove(w, y, x) == ERR ? ERR : winnstr(w, s, n))
414 #define	mvwinsch(w, y, x, c) \
415 	(wmove(w, y, x) == ERR ? ERR : winsch(w, c))
416 #define	mvwinstr(w, y, x, s) \
417 	(wmove(w, y, x) == ERR ? ERR : winstr(w, s))
418 
419 /* Miscellaneous. */
420 #define	noqiflush()		intrflush(stdscr, FALSE)
421 #define	qiflush()		intrflush(stdscr, TRUE)
422 
423 #else
424 /* Use functions not macros... */
425 __BEGIN_DECLS
426 int	 addbytes(const char *, int);
427 int	 addch(chtype);
428 int	 addchnstr(const chtype *, int);
429 int	 addchstr(const chtype *);
430 int	 addnstr(const char *, int);
431 int	 addstr(const char *);
432 int	 attr_get(attr_t *, short *, void *);
433 int	 attr_off(attr_t, void *);
434 int	 attr_on(attr_t, void *);
435 int	 attr_set(attr_t, short, void *);
436 int	 attroff(int);
437 int	 attron(int);
438 int	 attrset(int);
439 int	 bkgd(chtype);
440 void	 bkgdset(chtype);
441 int	 border(chtype, chtype, chtype, chtype,
442 	   chtype, chtype, chtype, chtype);
443 int	 clear(void);
444 int	 clrtobot(void);
445 int	 clrtoeol(void);
446 int	 color_set(short, void *);
447 int	 delch(void);
448 int	 deleteln(void);
449 int	 erase(void);
450 int	 getch(void);
451 int	 getnstr(char *, int);
452 int	 getstr(char *);
453 chtype	 inch(void);
454 int	 inchnstr(chtype *, int);
455 int	 inchstr(chtype *);
456 int	 innstr(char *, int);
457 int	 insch(chtype);
458 int	 insdelln(int);
459 int	 insertln(void);
460 int	 instr(char *);
461 int	 move(int, int);
462 int	 refresh(void);
463 int	 scrl(int);
464 int	 setscrreg(int, int);
465 int	 standend(void);
466 int	 standout(void);
467 void	 timeout(int);
468 int	 underscore(void);
469 int	 underend(void);
470 int	 waddbytes(WINDOW *, const char *, int);
471 int	 waddstr(WINDOW *, const char *);
472 
473 /* Standard screen plus movement functions. */
474 int	 mvaddbytes(int, int, const char *, int);
475 int	 mvaddch(int, int, chtype);
476 int	 mvaddchnstr(int, int, const chtype *, int);
477 int	 mvaddchstr(int, int, const chtype *);
478 int	 mvaddnstr(int, int, const char *, int);
479 int	 mvaddstr(int, int, const char *);
480 int	 mvdelch(int, int);
481 int	 mvgetch(int, int);
482 int	 mvgetnstr(int, int, char *, int);
483 int	 mvgetstr(int, int, char *);
484 chtype	 mvinch(int, int);
485 int	 mvinchnstr(int, int, chtype *, int);
486 int	 mvinchstr(int, int, chtype *);
487 int	 mvinnstr(int, int, char *, int);
488 int	 mvinsch(int, int, chtype);
489 int	 mvinstr(int, int, char *);
490 
491 int	 mvwaddbytes(WINDOW *, int, int, const char *, int);
492 int	 mvwaddch(WINDOW *, int, int, chtype);
493 int	 mvwaddchnstr(WINDOW *, int, int, const chtype *, int);
494 int	 mvwaddchstr(WINDOW *, int, int, const chtype *);
495 int	 mvwaddnstr(WINDOW *, int, int, const char *, int);
496 int	 mvwaddstr(WINDOW *, int, int, const char *);
497 int	 mvwdelch(WINDOW *, int, int);
498 int	 mvwgetch(WINDOW *, int, int);
499 int	 mvwgetnstr(WINDOW *, int, int, char *, int);
500 int	 mvwgetstr(WINDOW *, int, int, char *);
501 chtype	 mvwinch(WINDOW *, int, int);
502 int	 mvwinsch(WINDOW *, int, int, chtype);
503 __END_DECLS
504 #endif /* _CURSES_USE_MACROS */
505 
506 #define	getyx(w, y, x)		(y) = getcury(w), (x) = getcurx(w)
507 #define	getbegyx(w, y, x)	(y) = getbegy(w), (x) = getbegx(w)
508 #define	getmaxyx(w, y, x)	(y) = getmaxy(w), (x) = getmaxx(w)
509 #define	getparyx(w, y, x)	(y) = getpary(w), (x) = getparx(w)
510 
511 /* Public function prototypes. */
512 __BEGIN_DECLS
513 int	 assume_default_colors(short, short);
514 int	 baudrate(void);
515 int	 beep(void);
516 int	 box(WINDOW *, chtype, chtype);
517 bool	 can_change_color(void);
518 bool	 can_change_colors(void);
519 int	 cbreak(void);
520 int	 clearok(WINDOW *, bool);
521 int	 color_content(short, short *, short *, short *);
522 int	 copywin(const WINDOW *, WINDOW *, int, int, int, int, int, int, int);
523 int	 curs_set(int);
524 int	 def_prog_mode(void);
525 int	 def_shell_mode(void);
526 int      define_key(char *, int);
527 int	 delay_output(int);
528 void     delscreen(SCREEN *);
529 int	 delwin(WINDOW *);
530 WINDOW	*derwin(WINDOW *, int, int, int, int);
531 WINDOW	*dupwin(WINDOW *);
532 int	 doupdate(void);
533 int	 echo(void);
534 int	 endwin(void);
535 char     erasechar(void);
536 int	 flash(void);
537 int	 flushinp(void);
538 int	 flushok(WINDOW *, bool);
539 char	*fullname(const char *, char *);
540 chtype	 getattrs(WINDOW *);
541 chtype	 getbkgd(WINDOW *);
542 char	*getcap(char *);
543 int	 getcury(WINDOW *);
544 int	 getcurx(WINDOW *);
545 int	 getbegy(WINDOW *);
546 int	 getbegx(WINDOW *);
547 int	 getmaxy(WINDOW *);
548 int	 getmaxx(WINDOW *);
549 int	 getpary(WINDOW *);
550 int	 getparx(WINDOW *);
551 int	 gettmode(void);
552 int	 halfdelay(int);
553 bool	 has_colors(void);
554 bool	 has_ic(void);
555 bool	 has_il(void);
556 int	 hline(chtype, int);
557 int	 idcok(WINDOW *, bool);
558 int	 idlok(WINDOW *, bool);
559 int	 init_color(short, short, short, short);
560 int	 init_pair(short, short, short);
561 WINDOW	*initscr(void);
562 int	 intrflush(WINDOW *, bool);
563 bool	 isendwin(void);
564 bool	 is_linetouched(WINDOW *, int);
565 bool	 is_wintouched(WINDOW *);
566 int      keyok(int, bool);
567 void	 keypad(WINDOW *, bool);
568 char	*keyname(int);
569 char     killchar(void);
570 int	 leaveok(WINDOW *, bool);
571 char	*longname(void);
572 int	 meta(WINDOW *, bool);
573 int	 mvcur(int, int, int, int);
574 int      mvderwin(WINDOW *, int, int);
575 int	 mvhline(int, int, chtype, int);
576 int	 mvprintw(int, int, const char *, ...)
577 		__attribute__((__format__(__printf__, 3, 4)));
578 int	 mvscanw(int, int, const char *, ...)
579 		__attribute__((__format__(__scanf__, 3, 4)));
580 int	 mvvline(int, int, chtype, int);
581 int	 mvwhline(WINDOW *, int, int, chtype, int);
582 int	 mvwvline(WINDOW *, int, int, chtype, int);
583 int	 mvwin(WINDOW *, int, int);
584 int	 mvwinchnstr(WINDOW *, int, int, chtype *, int);
585 int	 mvwinchstr(WINDOW *, int, int, chtype *);
586 int	 mvwinnstr(WINDOW *, int, int, char *, int);
587 int	 mvwinstr(WINDOW *, int, int, char *);
588 int	 mvwprintw(WINDOW *, int, int, const char *, ...)
589 		__attribute__((__format__(__printf__, 4, 5)));
590 int	 mvwscanw(WINDOW *, int, int, const char *, ...)
591 		__attribute__((__format__(__scanf__, 4, 5)));
592 int	 napms(int);
593 WINDOW	*newpad(int, int);
594 SCREEN  *newterm(char *, FILE *, FILE *);
595 WINDOW	*newwin(int, int, int, int);
596 int	 nl(void);
597 attr_t	 no_color_video(void);
598 int	 nocbreak(void);
599 int	 nodelay(WINDOW *, bool);
600 int	 noecho(void);
601 int	 nonl(void);
602 void	 noqiflush(void);
603 int	 noraw(void);
604 int	 notimeout(WINDOW *, bool);
605 int	 overlay(const WINDOW *, WINDOW *);
606 int	 overwrite(const WINDOW *, WINDOW *);
607 int	 pair_content(short, short *, short *);
608 int	 pnoutrefresh(WINDOW *, int, int, int, int, int, int);
609 int	 prefresh(WINDOW *, int, int, int, int, int, int);
610 int	 printw(const char *, ...)
611 		__attribute__((__format__(__printf__, 1, 2)));
612 void	 qiflush(void);
613 int	 raw(void);
614 int	 redrawwin(WINDOW *);
615 int	 reset_prog_mode(void);
616 int	 reset_shell_mode(void);
617 int	 resetty(void);
618 int      resizeterm(int, int);
619 int	 savetty(void);
620 int	 scanw(const char *, ...)
621 		__attribute__((__format__(__scanf__, 1, 2)));
622 int	 scroll(WINDOW *);
623 int	 scrollok(WINDOW *, bool);
624 int	 setterm(char *);
625 SCREEN  *set_term(SCREEN *);
626 int	 start_color(void);
627 WINDOW	*subpad(WINDOW *, int, int, int, int);
628 WINDOW	*subwin(WINDOW *, int, int, int, int);
629 int	 touchline(WINDOW *, int, int);
630 int	 touchoverlap(WINDOW *, WINDOW *);
631 int	 touchwin(WINDOW *);
632 int	 ungetch(int);
633 int	 untouchwin(WINDOW *);
634 int	 use_default_colors(void);
635 int	 vline(chtype, int);
636 int	 vwprintw(WINDOW *, const char *, _BSD_VA_LIST_)
637 		__attribute__((__format__(__printf__, 2, 0)));
638 int	 vwscanw(WINDOW *, const char *, _BSD_VA_LIST_)
639 		__attribute__((__format__(__scanf__, 2, 0)));
640 int	 waddch(WINDOW *, chtype);
641 int	 waddchnstr(WINDOW *, const chtype *, int);
642 int	 waddchstr(WINDOW *, const chtype *);
643 int	 waddnstr(WINDOW *, const char *, int);
644 int	 wattr_get(WINDOW *, attr_t *, short *, void *);
645 int	 wattr_off(WINDOW *, attr_t, void *);
646 int	 wattr_on(WINDOW *, attr_t, void *);
647 int	 wattr_set(WINDOW *, attr_t, short, void *);
648 int	 wattroff(WINDOW *, int);
649 int	 wattron(WINDOW *, int);
650 int	 wattrset(WINDOW *, int);
651 int	 wbkgd(WINDOW *, chtype);
652 void	 wbkgdset(WINDOW *, chtype);
653 int	 wborder(WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype,
654 		chtype, chtype);
655 int	 wclear(WINDOW *);
656 int	 wclrtobot(WINDOW *);
657 int	 wclrtoeol(WINDOW *);
658 int	 wcolor_set(WINDOW *, short, void *);
659 int	 wdelch(WINDOW *);
660 int	 wdeleteln(WINDOW *);
661 int	 werase(WINDOW *);
662 int	 wgetch(WINDOW *);
663 int	 wgetnstr(WINDOW *, char *, int);
664 int	 wgetstr(WINDOW *, char *);
665 int	 whline(WINDOW *, chtype, int);
666 chtype	 winch(WINDOW *);
667 int	 winchnstr(WINDOW *, chtype *, int);
668 int	 winchstr(WINDOW *, chtype *);
669 int	 winnstr(WINDOW *, char *, int);
670 int	 winsch(WINDOW *, chtype);
671 int	 winsdelln(WINDOW *, int);
672 int	 winsertln(WINDOW *);
673 int	 winstr(WINDOW *, char *);
674 int	 wmove(WINDOW *, int, int);
675 int	 wnoutrefresh(WINDOW *);
676 int	 wprintw(WINDOW *, const char *, ...)
677 		__attribute__((__format__(__printf__, 2, 3)));
678 int	 wredrawln(WINDOW *, int, int);
679 int	 wrefresh(WINDOW *);
680 int      wresize(WINDOW *, int, int);
681 int	 wscanw(WINDOW *, const char *, ...)
682 		__attribute__((__format__(__scanf__, 2, 3)));
683 int	 wscrl(WINDOW *, int);
684 int	 wsetscrreg(WINDOW *, int, int);
685 int	 wstandend(WINDOW *);
686 int	 wstandout(WINDOW *);
687 void	 wtimeout(WINDOW *, int);
688 int	 wtouchln(WINDOW *, int, int, int);
689 int	 wunderend(WINDOW *);
690 int	 wunderscore(WINDOW *);
691 int	 wvline(WINDOW *, chtype, int);
692 
693 /* Private functions that are needed for user programs prototypes. */
694 int	 __cputchar(int);
695 int	 __waddbytes(WINDOW *, const char *, int, attr_t);
696 __END_DECLS
697 
698 #endif /* !_CURSES_H_ */
699