xref: /openbsd/lib/libcurses/curses.h (revision 09467b48)
1 /* $OpenBSD: curses.h,v 1.61 2010/09/06 17:26:17 nicm Exp $ */
2 
3 /****************************************************************************
4  * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
5  *                                                                          *
6  * Permission is hereby granted, free of charge, to any person obtaining a  *
7  * copy of this software and associated documentation files (the            *
8  * "Software"), to deal in the Software without restriction, including      *
9  * without limitation the rights to use, copy, modify, merge, publish,      *
10  * distribute, distribute with modifications, sublicense, and/or sell       *
11  * copies of the Software, and to permit persons to whom the Software is    *
12  * furnished to do so, subject to the following conditions:                 *
13  *                                                                          *
14  * The above copyright notice and this permission notice shall be included  *
15  * in all copies or substantial portions of the Software.                   *
16  *                                                                          *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24  *                                                                          *
25  * Except as contained in this notice, the name(s) of the above copyright   *
26  * holders shall not be used in advertising or otherwise to promote the     *
27  * sale, use or other dealings in this Software without prior written       *
28  * authorization.                                                           *
29  ****************************************************************************/
30 
31 /****************************************************************************
32  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
33  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
34  *     and: Thomas E. Dickey                        1996-on                 *
35  ****************************************************************************/
36 
37 /* $Id: curses.h,v 1.61 2010/09/06 17:26:17 nicm Exp $ */
38 
39 #ifndef __NCURSES_H
40 #define __NCURSES_H
41 
42 #define CURSES 1
43 #define CURSES_H 1
44 
45 /* This should be defined for the enhanced functionality to be visible.
46  * However, some of the wide-character (enhanced) functionality is missing.
47  * So we do not define it (yet).
48 #define _XOPEN_CURSES 1
49  */
50 
51 /* These are defined only in curses.h, and are used for conditional compiles */
52 #define NCURSES_VERSION_MAJOR 5
53 #define NCURSES_VERSION_MINOR 7
54 #define NCURSES_VERSION_PATCH 20081102
55 
56 /* This is defined in more than one ncurses header, for identification */
57 #undef  NCURSES_VERSION
58 #define NCURSES_VERSION "5.7"
59 
60 #if !defined(NCURSES_IMPEXP)
61 #  define NCURSES_IMPEXP /* nothing */
62 #endif
63 #if !defined(NCURSES_API)
64 #  define NCURSES_API /* nothing */
65 #endif
66 #if !defined(NCURSES_EXPORT)
67 #  define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
68 #endif
69 #if !defined(NCURSES_EXPORT_VAR)
70 #  define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
71 #endif
72 
73 /*
74  * Identify the mouse encoding version.
75  */
76 #define NCURSES_MOUSE_VERSION 1
77 
78 /*
79  * User-definable tweak to disable the include of <stdbool.h>.
80  */
81 #ifndef NCURSES_ENABLE_STDBOOL_H
82 #define NCURSES_ENABLE_STDBOOL_H 1
83 #endif
84 
85 /*
86  * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses
87  * configured using --disable-macros.
88  */
89 #ifdef NCURSES_NOMACROS
90 #ifndef NCURSES_ATTR_T
91 #define NCURSES_ATTR_T attr_t
92 #endif
93 #endif /* NCURSES_NOMACROS */
94 
95 #ifndef NCURSES_ATTR_T
96 #define NCURSES_ATTR_T int
97 #endif
98 
99 /*
100  * Expands to 'const' if ncurses is configured using --enable-const.  Note that
101  * doing so makes it incompatible with other implementations of X/Open Curses.
102  */
103 #undef  NCURSES_CONST
104 #define NCURSES_CONST /*nothing*/
105 
106 #undef NCURSES_INLINE
107 #define NCURSES_INLINE inline
108 
109 /*
110  * The internal type used for color values
111  */
112 #undef	NCURSES_COLOR_T
113 #define	NCURSES_COLOR_T short
114 
115 /*
116  * Definition used to make WINDOW and similar structs opaque.
117  */
118 #ifndef NCURSES_OPAQUE
119 #define NCURSES_OPAQUE 0
120 #endif
121 
122 /*
123  * The internal type used for window dimensions.
124  */
125 #undef	NCURSES_SIZE_T
126 #define	NCURSES_SIZE_T short
127 
128 /*
129  * Control whether tparm() supports varargs or fixed-parameter list.
130  */
131 #undef NCURSES_TPARM_VARARGS
132 #define NCURSES_TPARM_VARARGS 1
133 
134 /*
135  * NCURSES_CH_T is used in building the library, but not used otherwise in
136  * this header file, since that would make the normal/wide-character versions
137  * of the header incompatible.
138  */
139 #undef	NCURSES_CH_T
140 #define NCURSES_CH_T cchar_t
141 
142 #if 0 && defined(_LP64)
143 typedef unsigned chtype;
144 typedef unsigned mmask_t;
145 #else
146 typedef unsigned int chtype;
147 typedef unsigned long mmask_t;
148 #endif
149 
150 #include <stdio.h>
151 #include <unctrl.h>
152 #include <stdarg.h>	/* we need va_list */
153 #ifdef _XOPEN_SOURCE_EXTENDED
154 #include <stddef.h>	/* we want wchar_t */
155 #endif /* _XOPEN_SOURCE_EXTENDED */
156 
157 /* X/Open and SVr4 specify that curses implements 'bool'.  However, C++ may also
158  * implement it.  If so, we must use the C++ compiler's type to avoid conflict
159  * with other interfaces.
160  *
161  * A further complication is that <stdbool.h> may declare 'bool' to be a
162  * different type, such as an enum which is not necessarily compatible with
163  * C++.  If we have <stdbool.h>, make 'bool' a macro, so users may #undef it.
164  * Otherwise, let it remain a typedef to avoid conflicts with other #define's.
165  * In either case, make a typedef for NCURSES_BOOL which can be used if needed
166  * from either C or C++.
167  */
168 
169 #undef TRUE
170 #define TRUE    1
171 
172 #undef FALSE
173 #define FALSE   0
174 
175 typedef unsigned char NCURSES_BOOL;
176 
177 #if defined(__cplusplus)	/* __cplusplus, etc. */
178 
179 /* use the C++ compiler's bool type */
180 #define NCURSES_BOOL bool
181 
182 #else			/* c89, c99, etc. */
183 
184 #if NCURSES_ENABLE_STDBOOL_H
185 #include <stdbool.h>
186 /* use whatever the C compiler decides bool really is */
187 #define NCURSES_BOOL bool
188 #else
189 /* there is no predefined bool - use our own */
190 #undef bool
191 #define bool NCURSES_BOOL
192 #endif
193 
194 #endif /* !__cplusplus, etc. */
195 
196 #ifdef __cplusplus
197 extern "C" {
198 #define NCURSES_CAST(type,value) static_cast<type>(value)
199 #else
200 #define NCURSES_CAST(type,value) (type)(value)
201 #endif
202 
203 /*
204  * X/Open attributes.  In the ncurses implementation, they are identical to the
205  * A_ attributes.
206  */
207 #define WA_ATTRIBUTES	A_ATTRIBUTES
208 #define WA_NORMAL	A_NORMAL
209 #define WA_STANDOUT	A_STANDOUT
210 #define WA_UNDERLINE	A_UNDERLINE
211 #define WA_REVERSE	A_REVERSE
212 #define WA_BLINK	A_BLINK
213 #define WA_DIM		A_DIM
214 #define WA_BOLD		A_BOLD
215 #define WA_ALTCHARSET	A_ALTCHARSET
216 #define WA_INVIS	A_INVIS
217 #define WA_PROTECT	A_PROTECT
218 #define WA_HORIZONTAL	A_HORIZONTAL
219 #define WA_LEFT		A_LEFT
220 #define WA_LOW		A_LOW
221 #define WA_RIGHT	A_RIGHT
222 #define WA_TOP		A_TOP
223 #define WA_VERTICAL	A_VERTICAL
224 
225 /* colors */
226 #define COLOR_BLACK	0
227 #define COLOR_RED	1
228 #define COLOR_GREEN	2
229 #define COLOR_YELLOW	3
230 #define COLOR_BLUE	4
231 #define COLOR_MAGENTA	5
232 #define COLOR_CYAN	6
233 #define COLOR_WHITE	7
234 
235 /* line graphics */
236 
237 #if 0 || 0
238 NCURSES_WRAPPED_VAR(chtype*, acs_map);
239 #define acs_map (_nc_acs_map())
240 #else
241 extern NCURSES_EXPORT_VAR(chtype) acs_map[];
242 #endif
243 
244 #define NCURSES_ACS(c)	(acs_map[NCURSES_CAST(unsigned char,c)])
245 
246 /* VT100 symbols begin here */
247 #define ACS_ULCORNER	NCURSES_ACS('l') /* upper left corner */
248 #define ACS_LLCORNER	NCURSES_ACS('m') /* lower left corner */
249 #define ACS_URCORNER	NCURSES_ACS('k') /* upper right corner */
250 #define ACS_LRCORNER	NCURSES_ACS('j') /* lower right corner */
251 #define ACS_LTEE	NCURSES_ACS('t') /* tee pointing right */
252 #define ACS_RTEE	NCURSES_ACS('u') /* tee pointing left */
253 #define ACS_BTEE	NCURSES_ACS('v') /* tee pointing up */
254 #define ACS_TTEE	NCURSES_ACS('w') /* tee pointing down */
255 #define ACS_HLINE	NCURSES_ACS('q') /* horizontal line */
256 #define ACS_VLINE	NCURSES_ACS('x') /* vertical line */
257 #define ACS_PLUS	NCURSES_ACS('n') /* large plus or crossover */
258 #define ACS_S1		NCURSES_ACS('o') /* scan line 1 */
259 #define ACS_S9		NCURSES_ACS('s') /* scan line 9 */
260 #define ACS_DIAMOND	NCURSES_ACS('`') /* diamond */
261 #define ACS_CKBOARD	NCURSES_ACS('a') /* checker board (stipple) */
262 #define ACS_DEGREE	NCURSES_ACS('f') /* degree symbol */
263 #define ACS_PLMINUS	NCURSES_ACS('g') /* plus/minus */
264 #define ACS_BULLET	NCURSES_ACS('~') /* bullet */
265 /* Teletype 5410v1 symbols begin here */
266 #define ACS_LARROW	NCURSES_ACS(',') /* arrow pointing left */
267 #define ACS_RARROW	NCURSES_ACS('+') /* arrow pointing right */
268 #define ACS_DARROW	NCURSES_ACS('.') /* arrow pointing down */
269 #define ACS_UARROW	NCURSES_ACS('-') /* arrow pointing up */
270 #define ACS_BOARD	NCURSES_ACS('h') /* board of squares */
271 #define ACS_LANTERN	NCURSES_ACS('i') /* lantern symbol */
272 #define ACS_BLOCK	NCURSES_ACS('0') /* solid square block */
273 /*
274  * These aren't documented, but a lot of System Vs have them anyway
275  * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
276  * The ACS_names may not match AT&T's, our source didn't know them.
277  */
278 #define ACS_S3		NCURSES_ACS('p') /* scan line 3 */
279 #define ACS_S7		NCURSES_ACS('r') /* scan line 7 */
280 #define ACS_LEQUAL	NCURSES_ACS('y') /* less/equal */
281 #define ACS_GEQUAL	NCURSES_ACS('z') /* greater/equal */
282 #define ACS_PI		NCURSES_ACS('{') /* Pi */
283 #define ACS_NEQUAL	NCURSES_ACS('|') /* not equal */
284 #define ACS_STERLING	NCURSES_ACS('}') /* UK pound sign */
285 
286 /*
287  * Line drawing ACS names are of the form ACS_trbl, where t is the top, r
288  * is the right, b is the bottom, and l is the left.  t, r, b, and l might
289  * be B (blank), S (single), D (double), or T (thick).  The subset defined
290  * here only uses B and S.
291  */
292 #define ACS_BSSB	ACS_ULCORNER
293 #define ACS_SSBB	ACS_LLCORNER
294 #define ACS_BBSS	ACS_URCORNER
295 #define ACS_SBBS	ACS_LRCORNER
296 #define ACS_SBSS	ACS_RTEE
297 #define ACS_SSSB	ACS_LTEE
298 #define ACS_SSBS	ACS_BTEE
299 #define ACS_BSSS	ACS_TTEE
300 #define ACS_BSBS	ACS_HLINE
301 #define ACS_SBSB	ACS_VLINE
302 #define ACS_SSSS	ACS_PLUS
303 
304 #undef	ERR
305 #define ERR     (-1)
306 
307 #undef	OK
308 #define OK      (0)
309 
310 /* values for the _flags member */
311 #define _SUBWIN         0x01	/* is this a sub-window? */
312 #define _ENDLINE        0x02	/* is the window flush right? */
313 #define _FULLWIN        0x04	/* is the window full-screen? */
314 #define _SCROLLWIN      0x08	/* bottom edge is at screen bottom? */
315 #define _ISPAD	        0x10	/* is this window a pad? */
316 #define _HASMOVED       0x20	/* has cursor moved since last refresh? */
317 #define _WRAPPED        0x40	/* cursor was just wrappped */
318 
319 /*
320  * this value is used in the firstchar and lastchar fields to mark
321  * unchanged lines
322  */
323 #define _NOCHANGE       -1
324 
325 /*
326  * this value is used in the oldindex field to mark lines created by insertions
327  * and scrolls.
328  */
329 #define _NEWINDEX	-1
330 
331 typedef struct screen  SCREEN;
332 typedef struct _win_st WINDOW;
333 
334 typedef	chtype	attr_t;		/* ...must be at least as wide as chtype */
335 
336 #ifdef _XOPEN_SOURCE_EXTENDED
337 
338 #if 0
339 #ifdef mblen			/* libutf8.h defines it w/o undefining first */
340 #undef mblen
341 #endif
342 #include <libutf8.h>
343 #endif
344 
345 #if 1
346 #include <wchar.h>		/* ...to get mbstate_t, etc. */
347 #endif
348 
349 #if 0
350 typedef unsigned short wchar_t;
351 #endif
352 
353 #if 0
354 typedef unsigned int wint_t;
355 #endif
356 
357 #define CCHARW_MAX	5
358 typedef struct
359 {
360     attr_t	attr;
361     wchar_t	chars[CCHARW_MAX];
362 #if 0
363 #undef NCURSES_EXT_COLORS
364 #define NCURSES_EXT_COLORS 20081102
365     int		ext_color;	/* color pair, must be more than 16-bits */
366 #endif
367 }
368 cchar_t;
369 
370 #endif /* _XOPEN_SOURCE_EXTENDED */
371 
372 #if !NCURSES_OPAQUE
373 struct ldat;
374 
375 struct _win_st
376 {
377 	NCURSES_SIZE_T _cury, _curx; /* current cursor position */
378 
379 	/* window location and size */
380 	NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */
381 	NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */
382 
383 	short   _flags;		/* window state flags */
384 
385 	/* attribute tracking */
386 	attr_t  _attrs;		/* current attribute for non-space character */
387 	chtype  _bkgd;		/* current background char/attribute pair */
388 
389 	/* option values set by user */
390 	bool	_notimeout;	/* no time out on function-key entry? */
391 	bool	_clear;		/* consider all data in the window invalid? */
392 	bool	_leaveok;	/* OK to not reset cursor on exit? */
393 	bool	_scroll;	/* OK to scroll this window? */
394 	bool	_idlok;		/* OK to use insert/delete line? */
395 	bool	_idcok;		/* OK to use insert/delete char? */
396 	bool	_immed;		/* window in immed mode? (not yet used) */
397 	bool	_sync;		/* window in sync mode? */
398 	bool	_use_keypad;	/* process function keys into KEY_ symbols? */
399 	int	_delay;		/* 0 = nodelay, <0 = blocking, >0 = delay */
400 
401 	struct ldat *_line;	/* the actual line data */
402 
403 	/* global screen state */
404 	NCURSES_SIZE_T _regtop;	/* top line of scrolling region */
405 	NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */
406 
407 	/* these are used only if this is a sub-window */
408 	int	_parx;		/* x coordinate of this window in parent */
409 	int	_pary;		/* y coordinate of this window in parent */
410 	WINDOW	*_parent;	/* pointer to parent if a sub-window */
411 
412 	/* these are used only if this is a pad */
413 	struct pdat
414 	{
415 	    NCURSES_SIZE_T _pad_y,      _pad_x;
416 	    NCURSES_SIZE_T _pad_top,    _pad_left;
417 	    NCURSES_SIZE_T _pad_bottom, _pad_right;
418 	} _pad;
419 
420 	NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */
421 
422 #ifdef _XOPEN_SOURCE_EXTENDED
423 	cchar_t  _bkgrnd;	/* current background char/attribute pair */
424 #if 0
425 	int	_color;		/* current color-pair for non-space character */
426 #endif
427 #endif
428 };
429 #endif /* NCURSES_OPAQUE */
430 
431 /*
432  * This is an extension to support events...
433  */
434 #if 1
435 #ifdef NCURSES_WGETCH_EVENTS
436 #if !defined(__BEOS__) || defined(__HAIKU__)
437    /* Fix _nc_timed_wait() on BEOS... */
438 #  define NCURSES_EVENT_VERSION	1
439 #endif	/* !defined(__BEOS__) */
440 
441 /*
442  * Bits to set in _nc_event.data.flags
443  */
444 #  define _NC_EVENT_TIMEOUT_MSEC	1
445 #  define _NC_EVENT_FILE		2
446 #  define _NC_EVENT_FILE_READABLE	2
447 #  if 0					/* Not supported yet... */
448 #    define _NC_EVENT_FILE_WRITABLE	4
449 #    define _NC_EVENT_FILE_EXCEPTION	8
450 #  endif
451 
452 typedef struct
453 {
454     int type;
455     union
456     {
457 	long timeout_msec;	/* _NC_EVENT_TIMEOUT_MSEC */
458 	struct
459 	{
460 	    unsigned int flags;
461 	    int fd;
462 	    unsigned int result;
463 	} fev;				/* _NC_EVENT_FILE */
464     } data;
465 } _nc_event;
466 
467 typedef struct
468 {
469     int count;
470     int result_flags;	/* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */
471     _nc_event *events[1];
472 } _nc_eventlist;
473 
474 extern NCURSES_EXPORT(int) wgetch_events(WINDOW *, _nc_eventlist *);	/* experimental */
475 extern NCURSES_EXPORT(int) wgetnstr_events(WINDOW *,char *,int,_nc_eventlist *);/* experimental */
476 
477 #endif /* NCURSES_WGETCH_EVENTS */
478 #endif /* NCURSES_EXT_FUNCS */
479 
480 /*
481  * GCC (and some other compilers) define '__attribute__'; we're using this
482  * macro to alert the compiler to flag inconsistencies in printf/scanf-like
483  * function calls.  Just in case '__attribute__' isn't defined, make a dummy.
484  * Old versions of G++ do not accept it anyway, at least not consistently with
485  * GCC.
486  */
487 #if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__))
488 #define __attribute__(p) /* nothing */
489 #endif
490 
491 /*
492  * We cannot define these in ncurses_cfg.h, since they require parameters to be
493  * passed (that is non-portable).  If you happen to be using gcc with warnings
494  * enabled, define
495  *	GCC_PRINTF
496  *	GCC_SCANF
497  * to improve checking of calls to printw(), etc.
498  */
499 #ifndef GCC_PRINTFLIKE
500 #if defined(GCC_PRINTF) && !defined(printf)
501 #define GCC_PRINTFLIKE(fmt,var) __attribute__((__format__(printf,fmt,var)))
502 #else
503 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
504 #endif
505 #endif
506 
507 #ifndef GCC_SCANFLIKE
508 #if defined(GCC_SCANF) && !defined(scanf)
509 #define GCC_SCANFLIKE(fmt,var)  __attribute__((__format__(scanf,fmt,var)))
510 #else
511 #define GCC_SCANFLIKE(fmt,var)  /*nothing*/
512 #endif
513 #endif
514 
515 #ifndef	GCC_NORETURN
516 #define	GCC_NORETURN /* nothing */
517 #endif
518 
519 #ifndef	GCC_UNUSED
520 #define	GCC_UNUSED /* nothing */
521 #endif
522 
523 /*
524  * Function prototypes.  This is the complete X/Open Curses list of required
525  * functions.  Those marked `generated' will have sources generated from the
526  * macro definitions later in this file, in order to satisfy XPG4.2
527  * requirements.
528  */
529 
530 extern NCURSES_EXPORT(int) addch (const chtype);			/* generated */
531 extern NCURSES_EXPORT(int) addchnstr (const chtype *, int);		/* generated */
532 extern NCURSES_EXPORT(int) addchstr (const chtype *);			/* generated */
533 extern NCURSES_EXPORT(int) addnstr (const char *, int);			/* generated */
534 extern NCURSES_EXPORT(int) addstr (const char *);			/* generated */
535 extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T);			/* generated */
536 extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T);			/* generated */
537 extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T);			/* generated */
538 extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *);	/* generated */
539 extern NCURSES_EXPORT(int) attr_off (attr_t, void *);			/* generated */
540 extern NCURSES_EXPORT(int) attr_on (attr_t, void *);			/* generated */
541 extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *);		/* generated */
542 extern NCURSES_EXPORT(int) baudrate (void);				/* implemented */
543 extern NCURSES_EXPORT(int) beep  (void);				/* implemented */
544 extern NCURSES_EXPORT(int) bkgd (chtype);				/* generated */
545 extern NCURSES_EXPORT(void) bkgdset (chtype);				/* generated */
546 extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);	/* generated */
547 extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype);		/* generated */
548 extern NCURSES_EXPORT(bool) can_change_color (void);			/* implemented */
549 extern NCURSES_EXPORT(int) cbreak (void);				/* implemented */
550 extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *);	/* generated */
551 extern NCURSES_EXPORT(int) clear (void);				/* generated */
552 extern NCURSES_EXPORT(int) clearok (WINDOW *,bool);			/* implemented */
553 extern NCURSES_EXPORT(int) clrtobot (void);				/* generated */
554 extern NCURSES_EXPORT(int) clrtoeol (void);				/* generated */
555 extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*);	/* implemented */
556 extern NCURSES_EXPORT(int) color_set (short,void*);			/* generated */
557 extern NCURSES_EXPORT(int) COLOR_PAIR (int);				/* generated */
558 extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int);	/* implemented */
559 extern NCURSES_EXPORT(int) curs_set (int);				/* implemented */
560 extern NCURSES_EXPORT(int) def_prog_mode (void);			/* implemented */
561 extern NCURSES_EXPORT(int) def_shell_mode (void);			/* implemented */
562 extern NCURSES_EXPORT(int) delay_output (int);				/* implemented */
563 extern NCURSES_EXPORT(int) delch (void);				/* generated */
564 extern NCURSES_EXPORT(void) delscreen (SCREEN *);			/* implemented */
565 extern NCURSES_EXPORT(int) delwin (WINDOW *);				/* implemented */
566 extern NCURSES_EXPORT(int) deleteln (void);				/* generated */
567 extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int);	/* implemented */
568 extern NCURSES_EXPORT(int) doupdate (void);				/* implemented */
569 extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *);			/* implemented */
570 extern NCURSES_EXPORT(int) echo (void);					/* implemented */
571 extern NCURSES_EXPORT(int) echochar (const chtype);			/* generated */
572 extern NCURSES_EXPORT(int) erase (void);				/* generated */
573 extern NCURSES_EXPORT(int) endwin (void);				/* implemented */
574 extern NCURSES_EXPORT(char) erasechar (void);				/* implemented */
575 extern NCURSES_EXPORT(void) filter (void);				/* implemented */
576 extern NCURSES_EXPORT(int) flash (void);				/* implemented */
577 extern NCURSES_EXPORT(int) flushinp (void);				/* implemented */
578 extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *);			/* generated */
579 extern NCURSES_EXPORT(int) getch (void);				/* generated */
580 extern NCURSES_EXPORT(int) getnstr (char *, int);			/* generated */
581 extern NCURSES_EXPORT(int) getstr (char *);				/* generated */
582 extern NCURSES_EXPORT(WINDOW *) getwin (FILE *);			/* implemented */
583 extern NCURSES_EXPORT(int) halfdelay (int);				/* implemented */
584 extern NCURSES_EXPORT(bool) has_colors (void);				/* implemented */
585 extern NCURSES_EXPORT(bool) has_ic (void);				/* implemented */
586 extern NCURSES_EXPORT(bool) has_il (void);				/* implemented */
587 extern NCURSES_EXPORT(int) hline (chtype, int);				/* generated */
588 extern NCURSES_EXPORT(void) idcok (WINDOW *, bool);			/* implemented */
589 extern NCURSES_EXPORT(int) idlok (WINDOW *, bool);			/* implemented */
590 extern NCURSES_EXPORT(void) immedok (WINDOW *, bool);			/* implemented */
591 extern NCURSES_EXPORT(chtype) inch (void);				/* generated */
592 extern NCURSES_EXPORT(int) inchnstr (chtype *, int);			/* generated */
593 extern NCURSES_EXPORT(int) inchstr (chtype *);				/* generated */
594 extern NCURSES_EXPORT(WINDOW *) initscr (void);				/* implemented */
595 extern NCURSES_EXPORT(int) init_color (short,short,short,short);	/* implemented */
596 extern NCURSES_EXPORT(int) init_pair (short,short,short);		/* implemented */
597 extern NCURSES_EXPORT(int) innstr (char *, int);			/* generated */
598 extern NCURSES_EXPORT(int) insch (chtype);				/* generated */
599 extern NCURSES_EXPORT(int) insdelln (int);				/* generated */
600 extern NCURSES_EXPORT(int) insertln (void);				/* generated */
601 extern NCURSES_EXPORT(int) insnstr (const char *, int);			/* generated */
602 extern NCURSES_EXPORT(int) insstr (const char *);			/* generated */
603 extern NCURSES_EXPORT(int) instr (char *);				/* generated */
604 extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool);			/* implemented */
605 extern NCURSES_EXPORT(bool) isendwin (void);				/* implemented */
606 extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int);		/* implemented */
607 extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *);			/* implemented */
608 extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int);		/* implemented */
609 extern NCURSES_EXPORT(int) keypad (WINDOW *,bool);			/* implemented */
610 extern NCURSES_EXPORT(char) killchar (void);				/* implemented */
611 extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool);			/* implemented */
612 extern NCURSES_EXPORT(char *) longname (void);				/* implemented */
613 extern NCURSES_EXPORT(int) meta (WINDOW *,bool);			/* implemented */
614 extern NCURSES_EXPORT(int) move (int, int);				/* generated */
615 extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype);		/* generated */
616 extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int);	/* generated */
617 extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *);	/* generated */
618 extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int);	/* generated */
619 extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *);		/* generated */
620 extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *);	/* generated */
621 extern NCURSES_EXPORT(int) mvcur (int,int,int,int);			/* implemented */
622 extern NCURSES_EXPORT(int) mvdelch (int, int);				/* generated */
623 extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int);		/* implemented */
624 extern NCURSES_EXPORT(int) mvgetch (int, int);				/* generated */
625 extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int);		/* generated */
626 extern NCURSES_EXPORT(int) mvgetstr (int, int, char *);			/* generated */
627 extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int);		/* generated */
628 extern NCURSES_EXPORT(chtype) mvinch (int, int);			/* generated */
629 extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int);	/* generated */
630 extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *);		/* generated */
631 extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int);		/* generated */
632 extern NCURSES_EXPORT(int) mvinsch (int, int, chtype);			/* generated */
633 extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int);	/* generated */
634 extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *);		/* generated */
635 extern NCURSES_EXPORT(int) mvinstr (int, int, char *);			/* generated */
636 extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...)		/* implemented */
637 		GCC_PRINTFLIKE(3,4);
638 extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...)	/* implemented */
639 		GCC_SCANFLIKE(3,4);
640 extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int);		/* generated */
641 extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype);	/* generated */
642 extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */
643 extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *);	/* generated */
644 extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int);	/* generated */
645 extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *);	/* generated */
646 extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */
647 extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int);		/* generated */
648 extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int);		/* generated */
649 extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int);	/* generated */
650 extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *);	/* generated */
651 extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int);	/* generated */
652 extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int);			/* implemented */
653 extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int);			/* generated */
654 extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int);	/* generated */
655 extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *);		/* generated */
656 extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int);		/* generated */
657 extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype);		/* generated */
658 extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int);	/* generated */
659 extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *);		/* generated */
660 extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *);		/* generated */
661 extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...)	/* implemented */
662 		GCC_PRINTFLIKE(4,5);
663 extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...)	/* implemented */
664 		GCC_SCANFLIKE(4,5);
665 extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int);	/* generated */
666 extern NCURSES_EXPORT(int) napms (int);					/* implemented */
667 extern NCURSES_EXPORT(WINDOW *) newpad (int,int);				/* implemented */
668 extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *);	/* implemented */
669 extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int);			/* implemented */
670 extern NCURSES_EXPORT(int) nl (void);					/* implemented */
671 extern NCURSES_EXPORT(int) nocbreak (void);				/* implemented */
672 extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool);			/* implemented */
673 extern NCURSES_EXPORT(int) noecho (void);				/* implemented */
674 extern NCURSES_EXPORT(int) nonl (void);					/* implemented */
675 extern NCURSES_EXPORT(void) noqiflush (void);				/* implemented */
676 extern NCURSES_EXPORT(int) noraw (void);				/* implemented */
677 extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool);			/* implemented */
678 extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *);		/* implemented */
679 extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *);		/* implemented */
680 extern NCURSES_EXPORT(int) pair_content (short,short*,short*);		/* implemented */
681 extern NCURSES_EXPORT(int) PAIR_NUMBER (int);				/* generated */
682 extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype);		/* implemented */
683 extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */
684 extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int);	/* implemented */
685 extern NCURSES_EXPORT(int) printw (const char *,...)			/* implemented */
686 		GCC_PRINTFLIKE(1,2);
687 extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *);			/* implemented */
688 extern NCURSES_EXPORT(void) qiflush (void);				/* implemented */
689 extern NCURSES_EXPORT(int) raw (void);					/* implemented */
690 extern NCURSES_EXPORT(int) redrawwin (WINDOW *);			/* generated */
691 extern NCURSES_EXPORT(int) refresh (void);				/* generated */
692 extern NCURSES_EXPORT(int) resetty (void);				/* implemented */
693 extern NCURSES_EXPORT(int) reset_prog_mode (void);			/* implemented */
694 extern NCURSES_EXPORT(int) reset_shell_mode (void);			/* implemented */
695 extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int));	/* implemented */
696 extern NCURSES_EXPORT(int) savetty (void);				/* implemented */
697 extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...)		/* implemented */
698 		GCC_SCANFLIKE(1,2);
699 extern NCURSES_EXPORT(int) scr_dump (const char *);			/* implemented */
700 extern NCURSES_EXPORT(int) scr_init (const char *);			/* implemented */
701 extern NCURSES_EXPORT(int) scrl (int);					/* generated */
702 extern NCURSES_EXPORT(int) scroll (WINDOW *);				/* generated */
703 extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool);			/* implemented */
704 extern NCURSES_EXPORT(int) scr_restore (const char *);			/* implemented */
705 extern NCURSES_EXPORT(int) scr_set (const char *);			/* implemented */
706 extern NCURSES_EXPORT(int) setscrreg (int,int);				/* generated */
707 extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *);			/* implemented */
708 extern NCURSES_EXPORT(int) slk_attroff (const chtype);			/* implemented */
709 extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *);		/* generated:WIDEC */
710 extern NCURSES_EXPORT(int) slk_attron (const chtype);			/* implemented */
711 extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*);			/* generated:WIDEC */
712 extern NCURSES_EXPORT(int) slk_attrset (const chtype);			/* implemented */
713 extern NCURSES_EXPORT(attr_t) slk_attr (void);				/* implemented */
714 extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*);	/* implemented */
715 extern NCURSES_EXPORT(int) slk_clear (void);				/* implemented */
716 extern NCURSES_EXPORT(int) slk_color (short);				/* implemented */
717 extern NCURSES_EXPORT(int) slk_init (int);				/* implemented */
718 extern NCURSES_EXPORT(char *) slk_label (int);				/* implemented */
719 extern NCURSES_EXPORT(int) slk_noutrefresh (void);			/* implemented */
720 extern NCURSES_EXPORT(int) slk_refresh (void);				/* implemented */
721 extern NCURSES_EXPORT(int) slk_restore (void);				/* implemented */
722 extern NCURSES_EXPORT(int) slk_set (int,const char *,int);		/* implemented */
723 extern NCURSES_EXPORT(int) slk_touch (void);				/* implemented */
724 extern NCURSES_EXPORT(int) standout (void);				/* generated */
725 extern NCURSES_EXPORT(int) standend (void);				/* generated */
726 extern NCURSES_EXPORT(int) start_color (void);				/* implemented */
727 extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int);	/* implemented */
728 extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *, int, int, int, int);	/* implemented */
729 extern NCURSES_EXPORT(int) syncok (WINDOW *, bool);			/* implemented */
730 extern NCURSES_EXPORT(chtype) termattrs (void);				/* implemented */
731 extern NCURSES_EXPORT(char *) termname (void);				/* implemented */
732 extern NCURSES_EXPORT(void) timeout (int);				/* generated */
733 extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int);		/* generated */
734 extern NCURSES_EXPORT(int) touchwin (WINDOW *);				/* generated */
735 extern NCURSES_EXPORT(int) typeahead (int);				/* implemented */
736 extern NCURSES_EXPORT(int) ungetch (int);				/* implemented */
737 extern NCURSES_EXPORT(int) untouchwin (WINDOW *);			/* generated */
738 extern NCURSES_EXPORT(void) use_env (bool);				/* implemented */
739 extern NCURSES_EXPORT(int) vidattr (chtype);				/* implemented */
740 extern NCURSES_EXPORT(int) vidputs (chtype, int (*)(int));		/* implemented */
741 extern NCURSES_EXPORT(int) vline (chtype, int);				/* generated */
742 extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *,va_list);	/* implemented */
743 extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *,va_list);	/* generated */
744 extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list);	/* implemented */
745 extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list);	/* generated */
746 extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype);		/* implemented */
747 extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int);	/* implemented */
748 extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *);		/* generated */
749 extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *,int);	/* implemented */
750 extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *);		/* generated */
751 extern NCURSES_EXPORT(int) wattron (WINDOW *, int);			/* generated */
752 extern NCURSES_EXPORT(int) wattroff (WINDOW *, int);			/* generated */
753 extern NCURSES_EXPORT(int) wattrset (WINDOW *, int);			/* generated */
754 extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *);	/* generated */
755 extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *);		/* implemented */
756 extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *);	/* implemented */
757 extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *);	/* generated */
758 extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype);			/* implemented */
759 extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype);			/* implemented */
760 extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);	/* implemented */
761 extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */
762 extern NCURSES_EXPORT(int) wclear (WINDOW *);				/* implemented */
763 extern NCURSES_EXPORT(int) wclrtobot (WINDOW *);			/* implemented */
764 extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *);			/* implemented */
765 extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*);		/* implemented */
766 extern NCURSES_EXPORT(void) wcursyncup (WINDOW *);			/* implemented */
767 extern NCURSES_EXPORT(int) wdelch (WINDOW *);				/* implemented */
768 extern NCURSES_EXPORT(int) wdeleteln (WINDOW *);			/* generated */
769 extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype);		/* implemented */
770 extern NCURSES_EXPORT(int) werase (WINDOW *);				/* implemented */
771 extern NCURSES_EXPORT(int) wgetch (WINDOW *);				/* implemented */
772 extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int);		/* implemented */
773 extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *);			/* generated */
774 extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int);		/* implemented */
775 extern NCURSES_EXPORT(chtype) winch (WINDOW *);				/* implemented */
776 extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int);		/* implemented */
777 extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *);		/* generated */
778 extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int);		/* implemented */
779 extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype);			/* implemented */
780 extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int);			/* implemented */
781 extern NCURSES_EXPORT(int) winsertln (WINDOW *);			/* generated */
782 extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int);	/* implemented */
783 extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *);		/* generated */
784 extern NCURSES_EXPORT(int) winstr (WINDOW *, char *);			/* generated */
785 extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int);			/* implemented */
786 extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *);			/* implemented */
787 extern NCURSES_EXPORT(int) wprintw (WINDOW *, const char *,...)		/* implemented */
788 		GCC_PRINTFLIKE(2,3);
789 extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int);		/* implemented */
790 extern NCURSES_EXPORT(int) wrefresh (WINDOW *);				/* implemented */
791 extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...)	/* implemented */
792 		GCC_SCANFLIKE(2,3);
793 extern NCURSES_EXPORT(int) wscrl (WINDOW *,int);			/* implemented */
794 extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int);		/* implemented */
795 extern NCURSES_EXPORT(int) wstandout (WINDOW *);			/* generated */
796 extern NCURSES_EXPORT(int) wstandend (WINDOW *);			/* generated */
797 extern NCURSES_EXPORT(void) wsyncdown (WINDOW *);			/* implemented */
798 extern NCURSES_EXPORT(void) wsyncup (WINDOW *);				/* implemented */
799 extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int);			/* implemented */
800 extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int);		/* implemented */
801 extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int);		/* implemented */
802 
803 /*
804  * These are also declared in <term.h>:
805  */
806 extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);		/* implemented */
807 extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);		/* implemented */
808 extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);		/* implemented */
809 extern NCURSES_EXPORT(int) putp (const char *);				/* implemented */
810 
811 #if NCURSES_TPARM_VARARGS
812 extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);	/* special */
813 #else
814 extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long);	/* special */
815 extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...);	/* special */
816 #endif
817 
818 /*
819  * These functions are not in X/Open, but we use them in macro definitions:
820  */
821 extern NCURSES_EXPORT(int) getattrs (const WINDOW *);			/* generated */
822 extern NCURSES_EXPORT(int) getcurx (const WINDOW *);			/* generated */
823 extern NCURSES_EXPORT(int) getcury (const WINDOW *);			/* generated */
824 extern NCURSES_EXPORT(int) getbegx (const WINDOW *);			/* generated */
825 extern NCURSES_EXPORT(int) getbegy (const WINDOW *);			/* generated */
826 extern NCURSES_EXPORT(int) getmaxx (const WINDOW *);			/* generated */
827 extern NCURSES_EXPORT(int) getmaxy (const WINDOW *);			/* generated */
828 extern NCURSES_EXPORT(int) getparx (const WINDOW *);			/* generated */
829 extern NCURSES_EXPORT(int) getpary (const WINDOW *);			/* generated */
830 
831 /*
832  * vid_attr() was implemented originally based on a draft of X/Open curses.
833  */
834 #ifndef _XOPEN_SOURCE_EXTENDED
835 #define vid_attr(a,pair,opts) vidattr(a)
836 #endif
837 
838 /*
839  * These functions are extensions - not in X/Open Curses.
840  */
841 #if 1
842 #undef  NCURSES_EXT_FUNCS
843 #define NCURSES_EXT_FUNCS 20081102
844 typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *);
845 typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);
846 extern NCURSES_EXPORT(bool) is_term_resized (int, int);
847 extern NCURSES_EXPORT(char *) keybound (int, int);
848 extern NCURSES_EXPORT(const char *) curses_version (void);
849 extern NCURSES_EXPORT(int) assume_default_colors (int, int);
850 extern NCURSES_EXPORT(int) define_key (const char *, int);
851 extern NCURSES_EXPORT(int) key_defined (const char *);
852 extern NCURSES_EXPORT(int) keyok (int, bool);
853 extern NCURSES_EXPORT(int) resize_term (int, int);
854 extern NCURSES_EXPORT(int) resizeterm (int, int);
855 extern NCURSES_EXPORT(int) set_escdelay (int);
856 extern NCURSES_EXPORT(int) set_tabsize (int);
857 extern NCURSES_EXPORT(int) use_default_colors (void);
858 extern NCURSES_EXPORT(int) use_extended_names (bool);
859 extern NCURSES_EXPORT(int) use_legacy_coding (int);
860 extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *);
861 extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *);
862 extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);
863 extern NCURSES_EXPORT(void) nofilter(void);
864 
865 /*
866  * These extensions provide access to information stored in the WINDOW even
867  * when NCURSES_OPAQUE is set:
868  */
869 extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *);	/* generated */
870 extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *);	/* generated */
871 extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *);		/* generated */
872 extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *);		/* generated */
873 extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *);	/* generated */
874 extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *);		/* generated */
875 extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *);	/* generated */
876 extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *);	/* generated */
877 extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *);	/* generated */
878 extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *);	/* generated */
879 extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *);		/* generated */
880 extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */
881 
882 #else
883 #define curses_version() NCURSES_VERSION
884 #endif
885 
886 /* attributes */
887 
888 #define NCURSES_ATTR_SHIFT       8
889 #define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT))
890 
891 #define A_NORMAL	(1U - 1U)
892 #define A_ATTRIBUTES	NCURSES_BITS(~(1U - 1U),0)
893 #define A_CHARTEXT	(NCURSES_BITS(1U,0) - 1U)
894 #define A_COLOR		NCURSES_BITS(((1U) << 8) - 1U,0)
895 #define A_STANDOUT	NCURSES_BITS(1U,8)
896 #define A_UNDERLINE	NCURSES_BITS(1U,9)
897 #define A_REVERSE	NCURSES_BITS(1U,10)
898 #define A_BLINK		NCURSES_BITS(1U,11)
899 #define A_DIM		NCURSES_BITS(1U,12)
900 #define A_BOLD		NCURSES_BITS(1U,13)
901 #define A_ALTCHARSET	NCURSES_BITS(1U,14)
902 #define A_INVIS		NCURSES_BITS(1U,15)
903 #define A_PROTECT	NCURSES_BITS(1U,16)
904 #define A_HORIZONTAL	NCURSES_BITS(1U,17)
905 #define A_LEFT		NCURSES_BITS(1U,18)
906 #define A_LOW		NCURSES_BITS(1U,19)
907 #define A_RIGHT		NCURSES_BITS(1U,20)
908 #define A_TOP		NCURSES_BITS(1U,21)
909 #define A_VERTICAL	NCURSES_BITS(1U,22)
910 
911 /*
912  * Most of the pseudo functions are macros that either provide compatibility
913  * with older versions of curses, or provide inline functionality to improve
914  * performance.
915  */
916 
917 /*
918  * These pseudo functions are always implemented as macros:
919  */
920 
921 #define getyx(win,y,x)   	(y = getcury(win), x = getcurx(win))
922 #define getbegyx(win,y,x)	(y = getbegy(win), x = getbegx(win))
923 #define getmaxyx(win,y,x)	(y = getmaxy(win), x = getmaxx(win))
924 #define getparyx(win,y,x)	(y = getpary(win), x = getparx(win))
925 
926 #define getsyx(y,x) do { if (newscr) { \
927 			     if (is_leaveok(newscr)) \
928 				(y) = (x) = -1; \
929 			     else \
930 				 getyx(newscr,(y), (x)); \
931 			} \
932 		    } while(0)
933 
934 #define setsyx(y,x) do { if (newscr) { \
935 			    if ((y) == -1 && (x) == -1) \
936 				leaveok(newscr, TRUE); \
937 			    else { \
938 				leaveok(newscr, FALSE); \
939 				wmove(newscr, (y), (x)); \
940 			    } \
941 			} \
942 		    } while(0)
943 
944 #ifndef NCURSES_NOMACROS
945 
946 /*
947  * These miscellaneous pseudo functions are provided for compatibility:
948  */
949 
950 #define wgetstr(w, s)		wgetnstr(w, s, -1)
951 #define getnstr(s, n)		wgetnstr(stdscr, s, n)
952 
953 #define setterm(term)		setupterm(term, 1, (int *)0)
954 
955 #define fixterm()		reset_prog_mode()
956 #define resetterm()		reset_shell_mode()
957 #define saveterm()		def_prog_mode()
958 #define crmode()		cbreak()
959 #define nocrmode()		nocbreak()
960 #define gettmode()
961 
962 /* It seems older SYSV curses versions define these */
963 #if !NCURSES_OPAQUE
964 #define getattrs(win)		((win) ? (win)->_attrs : A_NORMAL)
965 #define getcurx(win)		((win) ? (win)->_curx : ERR)
966 #define getcury(win)		((win) ? (win)->_cury : ERR)
967 #define getbegx(win)		((win) ? (win)->_begx : ERR)
968 #define getbegy(win)		((win) ? (win)->_begy : ERR)
969 #define getmaxx(win)		((win) ? ((win)->_maxx + 1) : ERR)
970 #define getmaxy(win)		((win) ? ((win)->_maxy + 1) : ERR)
971 #define getparx(win)		((win) ? (win)->_parx : ERR)
972 #define getpary(win)		((win) ? (win)->_pary : ERR)
973 #endif /* NCURSES_OPAQUE */
974 
975 #define wstandout(win)      	(wattrset(win,A_STANDOUT))
976 #define wstandend(win)      	(wattrset(win,A_NORMAL))
977 
978 #define wattron(win,at)		wattr_on(win, NCURSES_CAST(attr_t, at), NULL)
979 #define wattroff(win,at)	wattr_off(win, NCURSES_CAST(attr_t, at), NULL)
980 
981 #if !NCURSES_OPAQUE
982 #if defined(_XOPEN_SOURCE_EXTENDED) && 0
983 #define wattrset(win,at)	((win)->_color = PAIR_NUMBER(at), \
984 				 (win)->_attrs = (at))
985 #else
986 #define wattrset(win,at)	((win)->_attrs = (at))
987 #endif
988 #endif /* NCURSES_OPAQUE */
989 
990 #define scroll(win)		wscrl(win,1)
991 
992 #define touchwin(win)		wtouchln((win), 0, getmaxy(win), 1)
993 #define touchline(win, s, c)	wtouchln((win), s, c, 1)
994 #define untouchwin(win)		wtouchln((win), 0, getmaxy(win), 0)
995 
996 #define box(win, v, h)		wborder(win, v, v, h, h, 0, 0, 0, 0)
997 #define border(ls, rs, ts, bs, tl, tr, bl, br)	wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
998 #define hline(ch, n)		whline(stdscr, ch, n)
999 #define vline(ch, n)		wvline(stdscr, ch, n)
1000 
1001 #define winstr(w, s)		winnstr(w, s, -1)
1002 #define winchstr(w, s)		winchnstr(w, s, -1)
1003 #define winsstr(w, s)		winsnstr(w, s, -1)
1004 
1005 #if !NCURSES_OPAQUE
1006 #define redrawwin(win)		wredrawln(win, 0, (win)->_maxy+1)
1007 #endif /* NCURSES_OPAQUE */
1008 
1009 #define waddstr(win,str)	waddnstr(win,str,-1)
1010 #define waddchstr(win,str)	waddchnstr(win,str,-1)
1011 
1012 /*
1013  * These apply to the first 256 color pairs.
1014  */
1015 #define COLOR_PAIR(n)	NCURSES_BITS(n, 0)
1016 #define PAIR_NUMBER(a)	(NCURSES_CAST(int,(((a) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
1017 
1018 /*
1019  * pseudo functions for standard screen
1020  */
1021 
1022 #define addch(ch)		waddch(stdscr,ch)
1023 #define addchnstr(str,n)	waddchnstr(stdscr,str,n)
1024 #define addchstr(str)		waddchstr(stdscr,str)
1025 #define addnstr(str,n)		waddnstr(stdscr,str,n)
1026 #define addstr(str)		waddnstr(stdscr,str,-1)
1027 #define attroff(at)		wattroff(stdscr,at)
1028 #define attron(at)		wattron(stdscr,at)
1029 #define attrset(at)		wattrset(stdscr,at)
1030 #define attr_get(ap,cp,o)	wattr_get(stdscr,ap,cp,o)
1031 #define attr_off(a,o)		wattr_off(stdscr,a,o)
1032 #define attr_on(a,o)		wattr_on(stdscr,a,o)
1033 #define attr_set(a,c,o)		wattr_set(stdscr,a,c,o)
1034 #define bkgd(ch)		wbkgd(stdscr,ch)
1035 #define bkgdset(ch)		wbkgdset(stdscr,ch)
1036 #define chgat(n,a,c,o)		wchgat(stdscr,n,a,c,o)
1037 #define clear()			wclear(stdscr)
1038 #define clrtobot()		wclrtobot(stdscr)
1039 #define clrtoeol()		wclrtoeol(stdscr)
1040 #define color_set(c,o)		wcolor_set(stdscr,c,o)
1041 #define delch()			wdelch(stdscr)
1042 #define deleteln()		winsdelln(stdscr,-1)
1043 #define echochar(c)		wechochar(stdscr,c)
1044 #define erase()			werase(stdscr)
1045 #define getch()			wgetch(stdscr)
1046 #define getstr(str)		wgetstr(stdscr,str)
1047 #define inch()			winch(stdscr)
1048 #define inchnstr(s,n)		winchnstr(stdscr,s,n)
1049 #define inchstr(s)		winchstr(stdscr,s)
1050 #define innstr(s,n)		winnstr(stdscr,s,n)
1051 #define insch(c)		winsch(stdscr,c)
1052 #define insdelln(n)		winsdelln(stdscr,n)
1053 #define insertln()		winsdelln(stdscr,1)
1054 #define insnstr(s,n)		winsnstr(stdscr,s,n)
1055 #define insstr(s)		winsstr(stdscr,s)
1056 #define instr(s)		winstr(stdscr,s)
1057 #define move(y,x)		wmove(stdscr,y,x)
1058 #define refresh()		wrefresh(stdscr)
1059 #define scrl(n)			wscrl(stdscr,n)
1060 #define setscrreg(t,b)		wsetscrreg(stdscr,t,b)
1061 #define standend()		wstandend(stdscr)
1062 #define standout()		wstandout(stdscr)
1063 #define timeout(delay)		wtimeout(stdscr,delay)
1064 #define wdeleteln(win)		winsdelln(win,-1)
1065 #define winsertln(win)		winsdelln(win,1)
1066 
1067 /*
1068  * mv functions
1069  */
1070 
1071 #define mvwaddch(win,y,x,ch)		(wmove(win,y,x) == ERR ? ERR : waddch(win,ch))
1072 #define mvwaddchnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n))
1073 #define mvwaddchstr(win,y,x,str)	(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1))
1074 #define mvwaddnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n))
1075 #define mvwaddstr(win,y,x,str)		(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1))
1076 #define mvwdelch(win,y,x)		(wmove(win,y,x) == ERR ? ERR : wdelch(win))
1077 #define mvwchgat(win,y,x,n,a,c,o)	(wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o))
1078 #define mvwgetch(win,y,x)		(wmove(win,y,x) == ERR ? ERR : wgetch(win))
1079 #define mvwgetnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n))
1080 #define mvwgetstr(win,y,x,str)		(wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))
1081 #define mvwhline(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : whline(win,c,n))
1082 #define mvwinch(win,y,x)		(wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
1083 #define mvwinchnstr(win,y,x,s,n)	(wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n))
1084 #define mvwinchstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winchstr(win,s))
1085 #define mvwinnstr(win,y,x,s,n)		(wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n))
1086 #define mvwinsch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : winsch(win,c))
1087 #define mvwinsnstr(win,y,x,s,n)		(wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n))
1088 #define mvwinsstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winsstr(win,s))
1089 #define mvwinstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winstr(win,s))
1090 #define mvwvline(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : wvline(win,c,n))
1091 
1092 #define mvaddch(y,x,ch)			mvwaddch(stdscr,y,x,ch)
1093 #define mvaddchnstr(y,x,str,n)		mvwaddchnstr(stdscr,y,x,str,n)
1094 #define mvaddchstr(y,x,str)		mvwaddchstr(stdscr,y,x,str)
1095 #define mvaddnstr(y,x,str,n)		mvwaddnstr(stdscr,y,x,str,n)
1096 #define mvaddstr(y,x,str)		mvwaddstr(stdscr,y,x,str)
1097 #define mvchgat(y,x,n,a,c,o)		mvwchgat(stdscr,y,x,n,a,c,o)
1098 #define mvdelch(y,x)			mvwdelch(stdscr,y,x)
1099 #define mvgetch(y,x)			mvwgetch(stdscr,y,x)
1100 #define mvgetnstr(y,x,str,n)		mvwgetnstr(stdscr,y,x,str,n)
1101 #define mvgetstr(y,x,str)		mvwgetstr(stdscr,y,x,str)
1102 #define mvhline(y,x,c,n)		mvwhline(stdscr,y,x,c,n)
1103 #define mvinch(y,x)			mvwinch(stdscr,y,x)
1104 #define mvinchnstr(y,x,s,n)		mvwinchnstr(stdscr,y,x,s,n)
1105 #define mvinchstr(y,x,s)		mvwinchstr(stdscr,y,x,s)
1106 #define mvinnstr(y,x,s,n)		mvwinnstr(stdscr,y,x,s,n)
1107 #define mvinsch(y,x,c)			mvwinsch(stdscr,y,x,c)
1108 #define mvinsnstr(y,x,s,n)		mvwinsnstr(stdscr,y,x,s,n)
1109 #define mvinsstr(y,x,s)			mvwinsstr(stdscr,y,x,s)
1110 #define mvinstr(y,x,s)			mvwinstr(stdscr,y,x,s)
1111 #define mvvline(y,x,c,n)		mvwvline(stdscr,y,x,c,n)
1112 
1113 /*
1114  * Some wide-character functions can be implemented without the extensions.
1115  */
1116 #if !NCURSES_OPAQUE
1117 #define getbkgd(win)                    ((win)->_bkgd)
1118 #endif /* NCURSES_OPAQUE */
1119 
1120 #define slk_attr_off(a,v)		((v) ? ERR : slk_attroff(a))
1121 #define slk_attr_on(a,v)		((v) ? ERR : slk_attron(a))
1122 
1123 #if !NCURSES_OPAQUE
1124 #if defined(_XOPEN_SOURCE_EXTENDED) && 0
1125 #define wattr_set(win,a,p,opts)		((win)->_attrs = ((a) & ~A_COLOR), \
1126 					 (win)->_color = (p), \
1127 					 OK)
1128 #define wattr_get(win,a,p,opts)		((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
1129 					 (void)((p) != (void *)0 && (*(p) = (win)->_color)), \
1130 					 OK)
1131 #else
1132 #define wattr_set(win,a,p,opts)		((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK)
1133 #define wattr_get(win,a,p,opts)		((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
1134 					 (void)((p) != (void *)0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \
1135 					 OK)
1136 #endif
1137 #endif /* NCURSES_OPAQUE */
1138 
1139 /*
1140  * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use
1141  * varargs.h.  It adds new calls vw_printw/vw_scanw, which are supposed to
1142  * use POSIX stdarg.h.  The ncurses versions of vwprintw/vwscanw already
1143  * use stdarg.h, so...
1144  */
1145 #define vw_printw		vwprintw
1146 #define vw_scanw		vwscanw
1147 
1148 /*
1149  * Export fallback function for use in C++ binding.
1150  */
1151 #if !1
1152 #define vsscanf(a,b,c) _nc_vsscanf(a,b,c)
1153 NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);
1154 #endif
1155 
1156 /*
1157  * These macros are extensions - not in X/Open Curses.
1158  */
1159 #if 1
1160 #if !NCURSES_OPAQUE
1161 #define is_cleared(win)		((win)->_clear)
1162 #define is_idcok(win)		((win)->_idcok)
1163 #define is_idlok(win)		((win)->_idlok)
1164 #define is_immedok(win)		((win)->_immed)
1165 #define is_keypad(win)		((win)->_use_keypad)
1166 #define is_leaveok(win)		((win)->_leaveok)
1167 #define is_nodelay(win)		((win)->_delay == 0)
1168 #define is_notimeout(win)	((win)->_notimeout)
1169 #define is_scrollok(win)	((win)->_scroll)
1170 #define is_syncok(win)		((win)->_sync)
1171 #define wgetparent(win)		((win) ? (win)->_parent : 0)
1172 #define wgetscrreg(win,t,b)	((win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR)
1173 #endif
1174 #endif
1175 
1176 #endif /* NCURSES_NOMACROS */
1177 
1178 /*
1179  * Public variables.
1180  *
1181  * Notes:
1182  *	a. ESCDELAY was an undocumented feature under AIX curses.
1183  *	   It gives the ESC expire time in milliseconds.
1184  *	b. ttytype is needed for backward compatibility
1185  */
1186 #if 0
1187 
1188 NCURSES_WRAPPED_VAR(WINDOW *, curscr);
1189 NCURSES_WRAPPED_VAR(WINDOW *, newscr);
1190 NCURSES_WRAPPED_VAR(WINDOW *, stdscr);
1191 NCURSES_WRAPPED_VAR(char *, ttytype);
1192 NCURSES_WRAPPED_VAR(int, COLORS);
1193 NCURSES_WRAPPED_VAR(int, COLOR_PAIRS);
1194 NCURSES_WRAPPED_VAR(int, COLS);
1195 NCURSES_WRAPPED_VAR(int, ESCDELAY);
1196 NCURSES_WRAPPED_VAR(int, LINES);
1197 NCURSES_WRAPPED_VAR(int, TABSIZE);
1198 
1199 #define curscr      NCURSES_PUBLIC_VAR(curscr())
1200 #define newscr      NCURSES_PUBLIC_VAR(newscr())
1201 #define stdscr      NCURSES_PUBLIC_VAR(stdscr())
1202 #define ttytype     NCURSES_PUBLIC_VAR(ttytype())
1203 #define COLORS      NCURSES_PUBLIC_VAR(COLORS())
1204 #define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS())
1205 #define COLS        NCURSES_PUBLIC_VAR(COLS())
1206 #define ESCDELAY    NCURSES_PUBLIC_VAR(ESCDELAY())
1207 #define LINES       NCURSES_PUBLIC_VAR(LINES())
1208 #define TABSIZE     NCURSES_PUBLIC_VAR(TABSIZE())
1209 
1210 #else
1211 
1212 extern NCURSES_EXPORT_VAR(WINDOW *) curscr;
1213 extern NCURSES_EXPORT_VAR(WINDOW *) newscr;
1214 extern NCURSES_EXPORT_VAR(WINDOW *) stdscr;
1215 extern NCURSES_EXPORT_VAR(char) ttytype[];
1216 extern NCURSES_EXPORT_VAR(int) COLORS;
1217 extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS;
1218 extern NCURSES_EXPORT_VAR(int) COLS;
1219 extern NCURSES_EXPORT_VAR(int) ESCDELAY;
1220 extern NCURSES_EXPORT_VAR(int) LINES;
1221 extern NCURSES_EXPORT_VAR(int) TABSIZE;
1222 
1223 #endif
1224 
1225 /*
1226  * Pseudo-character tokens outside ASCII range.  The curses wgetch() function
1227  * will return any given one of these only if the corresponding k- capability
1228  * is defined in your terminal's terminfo entry.
1229  *
1230  * Some keys (KEY_A1, etc) are arranged like this:
1231  *	a1     up    a3
1232  *	left   b2    right
1233  *	c1     down  c3
1234  *
1235  * A few key codes do not depend upon the terminfo entry.
1236  */
1237 #define KEY_CODE_YES	0400		/* A wchar_t contains a key code */
1238 #define KEY_MIN		0401		/* Minimum curses key */
1239 #define KEY_BREAK	0401		/* Break key (unreliable) */
1240 #define KEY_SRESET	0530		/* Soft (partial) reset (unreliable) */
1241 #define KEY_RESET	0531		/* Reset or hard reset (unreliable) */
1242 /*
1243  * These definitions were generated by ./MKkey_defs.sh ./Caps
1244  */
1245 #define KEY_DOWN	0402		/* down-arrow key */
1246 #define KEY_UP		0403		/* up-arrow key */
1247 #define KEY_LEFT	0404		/* left-arrow key */
1248 #define KEY_RIGHT	0405		/* right-arrow key */
1249 #define KEY_HOME	0406		/* home key */
1250 #define KEY_BACKSPACE	0407		/* backspace key */
1251 #define KEY_F0		0410		/* Function keys.  Space for 64 */
1252 #define KEY_F(n)	(KEY_F0+(n))	/* Value of function key n */
1253 #define KEY_DL		0510		/* delete-line key */
1254 #define KEY_IL		0511		/* insert-line key */
1255 #define KEY_DC		0512		/* delete-character key */
1256 #define KEY_IC		0513		/* insert-character key */
1257 #define KEY_EIC		0514		/* sent by rmir or smir in insert mode */
1258 #define KEY_CLEAR	0515		/* clear-screen or erase key */
1259 #define KEY_EOS		0516		/* clear-to-end-of-screen key */
1260 #define KEY_EOL		0517		/* clear-to-end-of-line key */
1261 #define KEY_SF		0520		/* scroll-forward key */
1262 #define KEY_SR		0521		/* scroll-backward key */
1263 #define KEY_NPAGE	0522		/* next-page key */
1264 #define KEY_PPAGE	0523		/* previous-page key */
1265 #define KEY_STAB	0524		/* set-tab key */
1266 #define KEY_CTAB	0525		/* clear-tab key */
1267 #define KEY_CATAB	0526		/* clear-all-tabs key */
1268 #define KEY_ENTER	0527		/* enter/send key */
1269 #define KEY_PRINT	0532		/* print key */
1270 #define KEY_LL		0533		/* lower-left key (home down) */
1271 #define KEY_A1		0534		/* upper left of keypad */
1272 #define KEY_A3		0535		/* upper right of keypad */
1273 #define KEY_B2		0536		/* center of keypad */
1274 #define KEY_C1		0537		/* lower left of keypad */
1275 #define KEY_C3		0540		/* lower right of keypad */
1276 #define KEY_BTAB	0541		/* back-tab key */
1277 #define KEY_BEG		0542		/* begin key */
1278 #define KEY_CANCEL	0543		/* cancel key */
1279 #define KEY_CLOSE	0544		/* close key */
1280 #define KEY_COMMAND	0545		/* command key */
1281 #define KEY_COPY	0546		/* copy key */
1282 #define KEY_CREATE	0547		/* create key */
1283 #define KEY_END		0550		/* end key */
1284 #define KEY_EXIT	0551		/* exit key */
1285 #define KEY_FIND	0552		/* find key */
1286 #define KEY_HELP	0553		/* help key */
1287 #define KEY_MARK	0554		/* mark key */
1288 #define KEY_MESSAGE	0555		/* message key */
1289 #define KEY_MOVE	0556		/* move key */
1290 #define KEY_NEXT	0557		/* next key */
1291 #define KEY_OPEN	0560		/* open key */
1292 #define KEY_OPTIONS	0561		/* options key */
1293 #define KEY_PREVIOUS	0562		/* previous key */
1294 #define KEY_REDO	0563		/* redo key */
1295 #define KEY_REFERENCE	0564		/* reference key */
1296 #define KEY_REFRESH	0565		/* refresh key */
1297 #define KEY_REPLACE	0566		/* replace key */
1298 #define KEY_RESTART	0567		/* restart key */
1299 #define KEY_RESUME	0570		/* resume key */
1300 #define KEY_SAVE	0571		/* save key */
1301 #define KEY_SBEG	0572		/* shifted begin key */
1302 #define KEY_SCANCEL	0573		/* shifted cancel key */
1303 #define KEY_SCOMMAND	0574		/* shifted command key */
1304 #define KEY_SCOPY	0575		/* shifted copy key */
1305 #define KEY_SCREATE	0576		/* shifted create key */
1306 #define KEY_SDC		0577		/* shifted delete-character key */
1307 #define KEY_SDL		0600		/* shifted delete-line key */
1308 #define KEY_SELECT	0601		/* select key */
1309 #define KEY_SEND	0602		/* shifted end key */
1310 #define KEY_SEOL	0603		/* shifted clear-to-end-of-line key */
1311 #define KEY_SEXIT	0604		/* shifted exit key */
1312 #define KEY_SFIND	0605		/* shifted find key */
1313 #define KEY_SHELP	0606		/* shifted help key */
1314 #define KEY_SHOME	0607		/* shifted home key */
1315 #define KEY_SIC		0610		/* shifted insert-character key */
1316 #define KEY_SLEFT	0611		/* shifted left-arrow key */
1317 #define KEY_SMESSAGE	0612		/* shifted message key */
1318 #define KEY_SMOVE	0613		/* shifted move key */
1319 #define KEY_SNEXT	0614		/* shifted next key */
1320 #define KEY_SOPTIONS	0615		/* shifted options key */
1321 #define KEY_SPREVIOUS	0616		/* shifted previous key */
1322 #define KEY_SPRINT	0617		/* shifted print key */
1323 #define KEY_SREDO	0620		/* shifted redo key */
1324 #define KEY_SREPLACE	0621		/* shifted replace key */
1325 #define KEY_SRIGHT	0622		/* shifted right-arrow key */
1326 #define KEY_SRSUME	0623		/* shifted resume key */
1327 #define KEY_SSAVE	0624		/* shifted save key */
1328 #define KEY_SSUSPEND	0625		/* shifted suspend key */
1329 #define KEY_SUNDO	0626		/* shifted undo key */
1330 #define KEY_SUSPEND	0627		/* suspend key */
1331 #define KEY_UNDO	0630		/* undo key */
1332 #define KEY_MOUSE	0631		/* Mouse event has occurred */
1333 #define KEY_RESIZE	0632		/* Terminal resize event */
1334 #define KEY_EVENT	0633		/* We were interrupted by an event */
1335 
1336 #define KEY_MAX		0777		/* Maximum key value is 0633 */
1337 /* $Id: curses.h,v 1.61 2010/09/06 17:26:17 nicm Exp $ */
1338 /*
1339  * vile:cmode:
1340  * This file is part of ncurses, designed to be appended after curses.h.in
1341  * (see that file for the relevant copyright).
1342  */
1343 #ifdef _XOPEN_SOURCE_EXTENDED
1344 
1345 extern NCURSES_EXPORT_VAR(cchar_t *) _nc_wacs;
1346 
1347 #define NCURSES_WACS(c)	(&_nc_wacs[(unsigned char)c])
1348 
1349 #define WACS_BSSB	NCURSES_WACS('l')
1350 #define WACS_SSBB	NCURSES_WACS('m')
1351 #define WACS_BBSS	NCURSES_WACS('k')
1352 #define WACS_SBBS	NCURSES_WACS('j')
1353 #define WACS_SBSS	NCURSES_WACS('u')
1354 #define WACS_SSSB	NCURSES_WACS('t')
1355 #define WACS_SSBS	NCURSES_WACS('v')
1356 #define WACS_BSSS	NCURSES_WACS('w')
1357 #define WACS_BSBS	NCURSES_WACS('q')
1358 #define WACS_SBSB	NCURSES_WACS('x')
1359 #define WACS_SSSS	NCURSES_WACS('n')
1360 
1361 #define WACS_ULCORNER	WACS_BSSB
1362 #define WACS_LLCORNER	WACS_SSBB
1363 #define WACS_URCORNER	WACS_BBSS
1364 #define WACS_LRCORNER	WACS_SBBS
1365 #define WACS_RTEE	WACS_SBSS
1366 #define WACS_LTEE	WACS_SSSB
1367 #define WACS_BTEE	WACS_SSBS
1368 #define WACS_TTEE	WACS_BSSS
1369 #define WACS_HLINE	WACS_BSBS
1370 #define WACS_VLINE	WACS_SBSB
1371 #define WACS_PLUS	WACS_SSSS
1372 
1373 #define WACS_S1		NCURSES_WACS('o') /* scan line 1 */
1374 #define WACS_S9 	NCURSES_WACS('s') /* scan line 9 */
1375 #define WACS_DIAMOND	NCURSES_WACS('`') /* diamond */
1376 #define WACS_CKBOARD	NCURSES_WACS('a') /* checker board */
1377 #define WACS_DEGREE	NCURSES_WACS('f') /* degree symbol */
1378 #define WACS_PLMINUS	NCURSES_WACS('g') /* plus/minus */
1379 #define WACS_BULLET	NCURSES_WACS('~') /* bullet */
1380 
1381 	/* Teletype 5410v1 symbols */
1382 #define WACS_LARROW	NCURSES_WACS(',') /* arrow left */
1383 #define WACS_RARROW	NCURSES_WACS('+') /* arrow right */
1384 #define WACS_DARROW	NCURSES_WACS('.') /* arrow down */
1385 #define WACS_UARROW	NCURSES_WACS('-') /* arrow up */
1386 #define WACS_BOARD	NCURSES_WACS('h') /* board of squares */
1387 #define WACS_LANTERN	NCURSES_WACS('i') /* lantern symbol */
1388 #define WACS_BLOCK	NCURSES_WACS('0') /* solid square block */
1389 
1390 	/* ncurses extensions */
1391 #define WACS_S3		NCURSES_WACS('p') /* scan line 3 */
1392 #define WACS_S7		NCURSES_WACS('r') /* scan line 7 */
1393 #define WACS_LEQUAL	NCURSES_WACS('y') /* less/equal */
1394 #define WACS_GEQUAL	NCURSES_WACS('z') /* greater/equal */
1395 #define WACS_PI		NCURSES_WACS('{') /* Pi */
1396 #define WACS_NEQUAL	NCURSES_WACS('|') /* not equal */
1397 #define WACS_STERLING	NCURSES_WACS('}') /* UK pound sign */
1398 
1399 /*
1400  * Function prototypes for wide-character operations.
1401  *
1402  * "generated" comments should include ":WIDEC" to make the corresponding
1403  * functions ifdef'd in lib_gen.c
1404  *
1405  * "implemented" comments do not need this marker.
1406  */
1407 
1408 extern NCURSES_EXPORT(int) add_wch (const cchar_t *);			/* generated:WIDEC */
1409 extern NCURSES_EXPORT(int) add_wchnstr (const cchar_t *, int);		/* generated:WIDEC */
1410 extern NCURSES_EXPORT(int) add_wchstr (const cchar_t *);		/* generated:WIDEC */
1411 extern NCURSES_EXPORT(int) addnwstr (const wchar_t *, int);		/* generated:WIDEC */
1412 extern NCURSES_EXPORT(int) addwstr (const wchar_t *);			/* generated:WIDEC */
1413 extern NCURSES_EXPORT(int) bkgrnd (const cchar_t *);			/* generated:WIDEC */
1414 extern NCURSES_EXPORT(void) bkgrndset (const cchar_t *);		/* generated:WIDEC */
1415 extern NCURSES_EXPORT(int) border_set (const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* generated:WIDEC */
1416 extern NCURSES_EXPORT(int) box_set (WINDOW *, const cchar_t *, const cchar_t *);	/* generated:WIDEC */
1417 extern NCURSES_EXPORT(int) echo_wchar (const cchar_t *);		/* generated:WIDEC */
1418 extern NCURSES_EXPORT(int) erasewchar (wchar_t*);			/* implemented */
1419 extern NCURSES_EXPORT(int) get_wch (wint_t *);				/* generated:WIDEC */
1420 extern NCURSES_EXPORT(int) get_wstr (wint_t *);				/* generated:WIDEC */
1421 extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *);			/* generated:WIDEC */
1422 extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, short*, void*);	/* implemented */
1423 extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int);			/* generated:WIDEC */
1424 extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int);		/* generated:WIDEC */
1425 extern NCURSES_EXPORT(int) in_wch (cchar_t *);				/* generated:WIDEC */
1426 extern NCURSES_EXPORT(int) in_wchnstr (cchar_t *, int);			/* generated:WIDEC */
1427 extern NCURSES_EXPORT(int) in_wchstr (cchar_t *);			/* generated:WIDEC */
1428 extern NCURSES_EXPORT(int) innwstr (wchar_t *, int);			/* generated:WIDEC */
1429 extern NCURSES_EXPORT(int) ins_nwstr (const wchar_t *, int);		/* generated:WIDEC */
1430 extern NCURSES_EXPORT(int) ins_wch (const cchar_t *);			/* generated:WIDEC */
1431 extern NCURSES_EXPORT(int) ins_wstr (const wchar_t *);			/* generated:WIDEC */
1432 extern NCURSES_EXPORT(int) inwstr (wchar_t *);				/* generated:WIDEC */
1433 extern NCURSES_EXPORT(NCURSES_CONST char*) key_name (wchar_t);		/* implemented */
1434 extern NCURSES_EXPORT(int) killwchar (wchar_t *);			/* implemented */
1435 extern NCURSES_EXPORT(int) mvadd_wch (int, int, const cchar_t *);	/* generated:WIDEC */
1436 extern NCURSES_EXPORT(int) mvadd_wchnstr (int, int, const cchar_t *, int);/* generated:WIDEC */
1437 extern NCURSES_EXPORT(int) mvadd_wchstr (int, int, const cchar_t *);	/* generated:WIDEC */
1438 extern NCURSES_EXPORT(int) mvaddnwstr (int, int, const wchar_t *, int);	/* generated:WIDEC */
1439 extern NCURSES_EXPORT(int) mvaddwstr (int, int, const wchar_t *);	/* generated:WIDEC */
1440 extern NCURSES_EXPORT(int) mvget_wch (int, int, wint_t *);		/* generated:WIDEC */
1441 extern NCURSES_EXPORT(int) mvget_wstr (int, int, wint_t *);		/* generated:WIDEC */
1442 extern NCURSES_EXPORT(int) mvgetn_wstr (int, int, wint_t *, int);	/* generated:WIDEC */
1443 extern NCURSES_EXPORT(int) mvhline_set (int, int, const cchar_t *, int);	/* generated:WIDEC */
1444 extern NCURSES_EXPORT(int) mvin_wch (int, int, cchar_t *);		/* generated:WIDEC */
1445 extern NCURSES_EXPORT(int) mvin_wchnstr (int, int, cchar_t *, int);	/* generated:WIDEC */
1446 extern NCURSES_EXPORT(int) mvin_wchstr (int, int, cchar_t *);		/* generated:WIDEC */
1447 extern NCURSES_EXPORT(int) mvinnwstr (int, int, wchar_t *, int);	/* generated:WIDEC */
1448 extern NCURSES_EXPORT(int) mvins_nwstr (int, int, const wchar_t *, int);	/* generated:WIDEC */
1449 extern NCURSES_EXPORT(int) mvins_wch (int, int, const cchar_t *);	/* generated:WIDEC */
1450 extern NCURSES_EXPORT(int) mvins_wstr (int, int, const wchar_t *);	/* generated:WIDEC */
1451 extern NCURSES_EXPORT(int) mvinwstr (int, int, wchar_t *);		/* generated:WIDEC */
1452 extern NCURSES_EXPORT(int) mvvline_set (int, int, const cchar_t *, int);	/* generated:WIDEC */
1453 extern NCURSES_EXPORT(int) mvwadd_wch (WINDOW *, int, int, const cchar_t *);	/* generated:WIDEC */
1454 extern NCURSES_EXPORT(int) mvwadd_wchnstr (WINDOW *, int, int, const cchar_t *, int); /* generated:WIDEC */
1455 extern NCURSES_EXPORT(int) mvwadd_wchstr (WINDOW *, int, int, const cchar_t *);	/* generated:WIDEC */
1456 extern NCURSES_EXPORT(int) mvwaddnwstr (WINDOW *, int, int, const wchar_t *, int);/* generated:WIDEC */
1457 extern NCURSES_EXPORT(int) mvwaddwstr (WINDOW *, int, int, const wchar_t *);	/* generated:WIDEC */
1458 extern NCURSES_EXPORT(int) mvwget_wch (WINDOW *, int, int, wint_t *);	/* generated:WIDEC */
1459 extern NCURSES_EXPORT(int) mvwget_wstr (WINDOW *, int, int, wint_t *);	/* generated:WIDEC */
1460 extern NCURSES_EXPORT(int) mvwgetn_wstr (WINDOW *, int, int, wint_t *, int);/* generated:WIDEC */
1461 extern NCURSES_EXPORT(int) mvwhline_set (WINDOW *, int, int, const cchar_t *, int);/* generated:WIDEC */
1462 extern NCURSES_EXPORT(int) mvwin_wch (WINDOW *, int, int, cchar_t *);	/* generated:WIDEC */
1463 extern NCURSES_EXPORT(int) mvwin_wchnstr (WINDOW *, int,int, cchar_t *,int);	/* generated:WIDEC */
1464 extern NCURSES_EXPORT(int) mvwin_wchstr (WINDOW *, int, int, cchar_t *);	/* generated:WIDEC */
1465 extern NCURSES_EXPORT(int) mvwinnwstr (WINDOW *, int, int, wchar_t *, int);	/* generated:WIDEC */
1466 extern NCURSES_EXPORT(int) mvwins_nwstr (WINDOW *, int,int, const wchar_t *,int); /* generated:WIDEC */
1467 extern NCURSES_EXPORT(int) mvwins_wch (WINDOW *, int, int, const cchar_t *);	/* generated:WIDEC */
1468 extern NCURSES_EXPORT(int) mvwins_wstr (WINDOW *, int, int, const wchar_t *);	/* generated:WIDEC */
1469 extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *);		/* generated:WIDEC */
1470 extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* generated:WIDEC */
1471 extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *);	/* implemented */
1472 extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, short, const void *);	/* implemented */
1473 extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int);	/* implemented */
1474 extern NCURSES_EXPORT(attr_t) term_attrs (void);			/* implemented */
1475 extern NCURSES_EXPORT(int) unget_wch (const wchar_t);			/* implemented */
1476 extern NCURSES_EXPORT(int) vid_attr (attr_t, short, void *);		/* implemented */
1477 extern NCURSES_EXPORT(int) vid_puts (attr_t, short, void *, int (*)(int)); /* implemented */
1478 extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int);		/* generated:WIDEC */
1479 extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *);		/* implemented */
1480 extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int);	/* implemented */
1481 extern NCURSES_EXPORT(int) wadd_wchstr (WINDOW *,const cchar_t *);	/* generated:WIDEC */
1482 extern NCURSES_EXPORT(int) waddnwstr (WINDOW *,const wchar_t *,int);	/* implemented */
1483 extern NCURSES_EXPORT(int) waddwstr (WINDOW *,const wchar_t *);		/* generated:WIDEC */
1484 extern NCURSES_EXPORT(int) wbkgrnd (WINDOW *,const cchar_t *);		/* implemented */
1485 extern NCURSES_EXPORT(void) wbkgrndset (WINDOW *,const cchar_t *);	/* implemented */
1486 extern NCURSES_EXPORT(int) wborder_set (WINDOW *,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*);	/* implemented */
1487 extern NCURSES_EXPORT(int) wecho_wchar (WINDOW *, const cchar_t *);	/* implemented */
1488 extern NCURSES_EXPORT(int) wget_wch (WINDOW *, wint_t *);		/* implemented */
1489 extern NCURSES_EXPORT(int) wget_wstr (WINDOW *, wint_t *);		/* generated:WIDEC */
1490 extern NCURSES_EXPORT(int) wgetbkgrnd (WINDOW *, cchar_t *);		/* generated:WIDEC */
1491 extern NCURSES_EXPORT(int) wgetn_wstr (WINDOW *,wint_t *, int);		/* implemented */
1492 extern NCURSES_EXPORT(int) whline_set (WINDOW *, const cchar_t *, int);	/* implemented */
1493 extern NCURSES_EXPORT(int) win_wch (WINDOW *, cchar_t *);		/* implemented */
1494 extern NCURSES_EXPORT(int) win_wchnstr (WINDOW *, cchar_t *, int);	/* implemented */
1495 extern NCURSES_EXPORT(int) win_wchstr (WINDOW *, cchar_t *);		/* generated:WIDEC */
1496 extern NCURSES_EXPORT(int) winnwstr (WINDOW *, wchar_t *, int);		/* implemented */
1497 extern NCURSES_EXPORT(int) wins_nwstr (WINDOW *, const wchar_t *, int);	/* implemented */
1498 extern NCURSES_EXPORT(int) wins_wch (WINDOW *, const cchar_t *);	/* implemented */
1499 extern NCURSES_EXPORT(int) wins_wstr (WINDOW *, const wchar_t *);	/* generated:WIDEC */
1500 extern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *);		/* implemented */
1501 extern NCURSES_EXPORT(wchar_t*) wunctrl (cchar_t *);			/* implemented */
1502 extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int);	/* implemented */
1503 
1504 #ifndef NCURSES_NOMACROS
1505 
1506 /*
1507  * XSI curses macros for XPG4 conformance.
1508  */
1509 #define add_wch(c)			wadd_wch(stdscr,c)
1510 #define add_wchnstr(str,n)		wadd_wchnstr(stdscr,str,n)
1511 #define add_wchstr(str)			wadd_wchstr(stdscr,str)
1512 #define addnwstr(wstr,n)		waddnwstr(stdscr,wstr,n)
1513 #define addwstr(wstr)			waddwstr(stdscr,wstr)
1514 #define bkgrnd(c)			wbkgrnd(stdscr,c)
1515 #define bkgrndset(c)			wbkgrndset(stdscr,c)
1516 #define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,l,r,t,b,tl,tr,bl,br)
1517 #define box_set(w,v,h)			wborder_set(w,v,v,h,h,0,0,0,0)
1518 #define echo_wchar(c)			wecho_wchar(stdscr,c)
1519 #define get_wch(c)			wget_wch(stdscr,c)
1520 #define get_wstr(t)			wget_wstr(stdscr,t)
1521 #define getbkgrnd(wch)			wgetbkgrnd(stdscr,wch)
1522 #define getn_wstr(t,n)			wgetn_wstr(stdscr,t,n)
1523 #define hline_set(c,n)			whline_set(stdscr,c,n)
1524 #define in_wch(c)			win_wch(stdscr,c)
1525 #define in_wchnstr(c,n)			win_wchnstr(stdscr,c,n)
1526 #define in_wchstr(c)			win_wchstr(stdscr,c)
1527 #define innwstr(c,n)			winnwstr(stdscr,c,n)
1528 #define ins_nwstr(t,n)			wins_nwstr(stdscr,t,n)
1529 #define ins_wch(c)			wins_wch(stdscr,c)
1530 #define ins_wstr(t)			wins_wstr(stdscr,t)
1531 #define inwstr(c)			winwstr(stdscr,c)
1532 #define vline_set(c,n)			wvline_set(stdscr,c,n)
1533 #define wadd_wchstr(win,str)		wadd_wchnstr(win,str,-1)
1534 #define waddwstr(win,wstr)		waddnwstr(win,wstr,-1)
1535 #define wget_wstr(w,t)			wgetn_wstr(w,t,-1)
1536 #define win_wchstr(w,c)			win_wchnstr(w,c,-1)
1537 #define wins_wstr(w,t)			wins_nwstr(w,t,-1)
1538 
1539 #if !NCURSES_OPAQUE
1540 #define wgetbkgrnd(win,wch)		(*wch = win->_bkgrnd, OK)
1541 #endif
1542 
1543 #define mvadd_wch(y,x,c)		mvwadd_wch(stdscr,y,x,c)
1544 #define mvadd_wchnstr(y,x,s,n)		mvwadd_wchnstr(stdscr,y,x,s,n)
1545 #define mvadd_wchstr(y,x,s)		mvwadd_wchstr(stdscr,y,x,s)
1546 #define mvaddnwstr(y,x,wstr,n)		mvwaddnwstr(stdscr,y,x,wstr,n)
1547 #define mvaddwstr(y,x,wstr)		mvwaddwstr(stdscr,y,x,wstr)
1548 #define mvget_wch(y,x,c)		mvwget_wch(stdscr,y,x,c)
1549 #define mvget_wstr(y,x,t)		mvwget_wstr(stdscr,y,x,t)
1550 #define mvgetn_wstr(y,x,t,n)		mvwgetn_wstr(stdscr,y,x,t,n)
1551 #define mvhline_set(y,x,c,n)		mvwhline_set(stdscr,y,x,c,n)
1552 #define mvin_wch(y,x,c)			mvwin_wch(stdscr,y,x,c)
1553 #define mvin_wchnstr(y,x,c,n)		mvwin_wchnstr(stdscr,y,x,c,n)
1554 #define mvin_wchstr(y,x,c)		mvwin_wchstr(stdscr,y,x,c)
1555 #define mvinnwstr(y,x,c,n)		mvwinnwstr(stdscr,y,x,c,n)
1556 #define mvins_nwstr(y,x,t,n)		mvwins_nwstr(stdscr,y,x,t,n)
1557 #define mvins_wch(y,x,c)		mvwins_wch(stdscr,y,x,c)
1558 #define mvins_wstr(y,x,t)		mvwins_wstr(stdscr,y,x,t)
1559 #define mvinwstr(y,x,c)			mvwinwstr(stdscr,y,x,c)
1560 #define mvvline_set(y,x,c,n)		mvwvline_set(stdscr,y,x,c,n)
1561 
1562 #define mvwadd_wch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : wadd_wch(win,c))
1563 #define mvwadd_wchnstr(win,y,x,s,n)	(wmove(win,y,x) == ERR ? ERR : wadd_wchnstr(win,s,n))
1564 #define mvwadd_wchstr(win,y,x,s)	(wmove(win,y,x) == ERR ? ERR : wadd_wchstr(win,s))
1565 #define mvwaddnwstr(win,y,x,wstr,n)	(wmove(win,y,x) == ERR ? ERR : waddnwstr(win,wstr,n))
1566 #define mvwaddwstr(win,y,x,wstr)	(wmove(win,y,x) == ERR ? ERR : waddwstr(win,wstr))
1567 #define mvwget_wch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : wget_wch(win,c))
1568 #define mvwget_wstr(win,y,x,t)		(wmove(win,y,x) == ERR ? ERR : wget_wstr(win,t))
1569 #define mvwgetn_wstr(win,y,x,t,n)	(wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,n))
1570 #define mvwhline_set(win,y,x,c,n)	(wmove(win,y,x) == ERR ? ERR : whline_set(win,c,n))
1571 #define mvwin_wch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : win_wch(win,c))
1572 #define mvwin_wchnstr(win,y,x,c,n)	(wmove(win,y,x) == ERR ? ERR : win_wchnstr(win,c,n))
1573 #define mvwin_wchstr(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : win_wchstr(win,c))
1574 #define mvwinnwstr(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : winnwstr(win,c,n))
1575 #define mvwins_nwstr(win,y,x,t,n)	(wmove(win,y,x) == ERR ? ERR : wins_nwstr(win,t,n))
1576 #define mvwins_wch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : wins_wch(win,c))
1577 #define mvwins_wstr(win,y,x,t)		(wmove(win,y,x) == ERR ? ERR : wins_wstr(win,t))
1578 #define mvwinwstr(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : winwstr(win,c))
1579 #define mvwvline_set(win,y,x,c,n)	(wmove(win,y,x) == ERR ? ERR : wvline_set(win,c,n))
1580 
1581 #endif /* NCURSES_NOMACROS */
1582 
1583 #if defined(TRACE) || defined(NCURSES_TEST)
1584 extern NCURSES_EXPORT(const char *) _nc_viswbuf(const wchar_t *);
1585 extern NCURSES_EXPORT(const char *) _nc_viswibuf(const wint_t *);
1586 #endif
1587 
1588 #endif /* _XOPEN_SOURCE_EXTENDED */
1589 /* $Id: curses.h,v 1.61 2010/09/06 17:26:17 nicm Exp $ */
1590 /*
1591  * vile:cmode:
1592  * This file is part of ncurses, designed to be appended after curses.h.in
1593  * (see that file for the relevant copyright).
1594  */
1595 
1596 /* mouse interface */
1597 
1598 #if NCURSES_MOUSE_VERSION > 1
1599 #define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5))
1600 #else
1601 #define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6))
1602 #endif
1603 
1604 #define	NCURSES_BUTTON_RELEASED	001L
1605 #define	NCURSES_BUTTON_PRESSED	002L
1606 #define	NCURSES_BUTTON_CLICKED	004L
1607 #define	NCURSES_DOUBLE_CLICKED	010L
1608 #define	NCURSES_TRIPLE_CLICKED	020L
1609 #define	NCURSES_RESERVED_EVENT	040L
1610 
1611 /* event masks */
1612 #define	BUTTON1_RELEASED	NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED)
1613 #define	BUTTON1_PRESSED		NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED)
1614 #define	BUTTON1_CLICKED		NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED)
1615 #define	BUTTON1_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED)
1616 #define	BUTTON1_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED)
1617 
1618 #define	BUTTON2_RELEASED	NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED)
1619 #define	BUTTON2_PRESSED		NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED)
1620 #define	BUTTON2_CLICKED		NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED)
1621 #define	BUTTON2_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED)
1622 #define	BUTTON2_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED)
1623 
1624 #define	BUTTON3_RELEASED	NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED)
1625 #define	BUTTON3_PRESSED		NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED)
1626 #define	BUTTON3_CLICKED		NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED)
1627 #define	BUTTON3_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED)
1628 #define	BUTTON3_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED)
1629 
1630 #define	BUTTON4_RELEASED	NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED)
1631 #define	BUTTON4_PRESSED		NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED)
1632 #define	BUTTON4_CLICKED		NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED)
1633 #define	BUTTON4_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED)
1634 #define	BUTTON4_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED)
1635 
1636 /*
1637  * In 32 bits the version-1 scheme does not provide enough space for a 5th
1638  * button, unless we choose to change the ABI by omitting the reserved-events.
1639  */
1640 #if NCURSES_MOUSE_VERSION > 1
1641 
1642 #define	BUTTON5_RELEASED	NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED)
1643 #define	BUTTON5_PRESSED		NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED)
1644 #define	BUTTON5_CLICKED		NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED)
1645 #define	BUTTON5_DOUBLE_CLICKED	NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED)
1646 #define	BUTTON5_TRIPLE_CLICKED	NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED)
1647 
1648 #define	BUTTON_CTRL		NCURSES_MOUSE_MASK(6, 0001L)
1649 #define	BUTTON_SHIFT		NCURSES_MOUSE_MASK(6, 0002L)
1650 #define	BUTTON_ALT		NCURSES_MOUSE_MASK(6, 0004L)
1651 #define	REPORT_MOUSE_POSITION	NCURSES_MOUSE_MASK(6, 0010L)
1652 
1653 #else
1654 
1655 #define	BUTTON1_RESERVED_EVENT	NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT)
1656 #define	BUTTON2_RESERVED_EVENT	NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT)
1657 #define	BUTTON3_RESERVED_EVENT	NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT)
1658 #define	BUTTON4_RESERVED_EVENT	NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT)
1659 
1660 #define	BUTTON_CTRL		NCURSES_MOUSE_MASK(5, 0001L)
1661 #define	BUTTON_SHIFT		NCURSES_MOUSE_MASK(5, 0002L)
1662 #define	BUTTON_ALT		NCURSES_MOUSE_MASK(5, 0004L)
1663 #define	REPORT_MOUSE_POSITION	NCURSES_MOUSE_MASK(5, 0010L)
1664 
1665 #endif
1666 
1667 #define	ALL_MOUSE_EVENTS	(REPORT_MOUSE_POSITION - 1)
1668 
1669 /* macros to extract single event-bits from masks */
1670 #define	BUTTON_RELEASE(e, x)		((e) & NCURSES_MOUSE_MASK(x, 001))
1671 #define	BUTTON_PRESS(e, x)		((e) & NCURSES_MOUSE_MASK(x, 002))
1672 #define	BUTTON_CLICK(e, x)		((e) & NCURSES_MOUSE_MASK(x, 004))
1673 #define	BUTTON_DOUBLE_CLICK(e, x)	((e) & NCURSES_MOUSE_MASK(x, 010))
1674 #define	BUTTON_TRIPLE_CLICK(e, x)	((e) & NCURSES_MOUSE_MASK(x, 020))
1675 #define	BUTTON_RESERVED_EVENT(e, x)	((e) & NCURSES_MOUSE_MASK(x, 040))
1676 
1677 typedef struct
1678 {
1679     short id;		/* ID to distinguish multiple devices */
1680     int x, y, z;	/* event coordinates (character-cell) */
1681     mmask_t bstate;	/* button state bits */
1682 }
1683 MEVENT;
1684 
1685 extern NCURSES_EXPORT(int) getmouse (MEVENT *);
1686 extern NCURSES_EXPORT(int) ungetmouse (MEVENT *);
1687 extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *);
1688 extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int);
1689 extern NCURSES_EXPORT(int) mouseinterval (int);
1690 extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool);
1691 extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool);              /* generated */
1692 
1693 #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
1694 
1695 /* other non-XSI functions */
1696 
1697 extern NCURSES_EXPORT(int) mcprint (char *, int);	/* direct data to printer */
1698 extern NCURSES_EXPORT(int) has_key (int);		/* do we have given key? */
1699 
1700 /* Debugging : use with libncurses_g.a */
1701 
1702 extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2);
1703 extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *);
1704 extern NCURSES_EXPORT(char *) _traceattr (attr_t);
1705 extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype);
1706 extern NCURSES_EXPORT(char *) _nc_tracebits (void);
1707 extern NCURSES_EXPORT(char *) _tracechar (int);
1708 extern NCURSES_EXPORT(char *) _tracechtype (chtype);
1709 extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype);
1710 #ifdef _XOPEN_SOURCE_EXTENDED
1711 #define _tracech_t		_tracecchar_t
1712 extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *);
1713 #define _tracech_t2		_tracecchar_t2
1714 extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *);
1715 #else
1716 #define _tracech_t		_tracechtype
1717 #define _tracech_t2		_tracechtype2
1718 #endif
1719 extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *);
1720 extern NCURSES_EXPORT(void) trace (const unsigned int);
1721 
1722 /* trace masks */
1723 #define TRACE_DISABLE	0x0000	/* turn off tracing */
1724 #define TRACE_TIMES	0x0001	/* trace user and system times of updates */
1725 #define TRACE_TPUTS	0x0002	/* trace tputs calls */
1726 #define TRACE_UPDATE	0x0004	/* trace update actions, old & new screens */
1727 #define TRACE_MOVE	0x0008	/* trace cursor moves and scrolls */
1728 #define TRACE_CHARPUT	0x0010	/* trace all character outputs */
1729 #define TRACE_ORDINARY	0x001F	/* trace all update actions */
1730 #define TRACE_CALLS	0x0020	/* trace all curses calls */
1731 #define TRACE_VIRTPUT	0x0040	/* trace virtual character puts */
1732 #define TRACE_IEVENT	0x0080	/* trace low-level input processing */
1733 #define TRACE_BITS	0x0100	/* trace state of TTY control bits */
1734 #define TRACE_ICALLS	0x0200	/* trace internal/nested calls */
1735 #define TRACE_CCALLS	0x0400	/* trace per-character calls */
1736 #define TRACE_DATABASE	0x0800	/* trace read/write of terminfo/termcap data */
1737 #define TRACE_ATTRS	0x1000	/* trace attribute updates */
1738 
1739 #define TRACE_SHIFT	13	/* number of bits in the trace masks */
1740 #define TRACE_MAXIMUM	((1 << TRACE_SHIFT) - 1) /* maximum trace level */
1741 
1742 #if defined(TRACE) || defined(NCURSES_TEST)
1743 extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable;		/* enable optimizations */
1744 extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *);
1745 #define OPTIMIZE_MVCUR		0x01	/* cursor movement optimization */
1746 #define OPTIMIZE_HASHMAP	0x02	/* diff hashing to detect scrolls */
1747 #define OPTIMIZE_SCROLL		0x04	/* scroll optimization */
1748 #define OPTIMIZE_ALL		0xff	/* enable all optimizations (dflt) */
1749 #endif
1750 
1751 #ifdef __cplusplus
1752 
1753 #ifndef NCURSES_NOMACROS
1754 
1755 /* these names conflict with STL */
1756 #undef box
1757 #undef clear
1758 #undef erase
1759 #undef move
1760 #undef refresh
1761 
1762 #endif /* NCURSES_NOMACROS */
1763 
1764 }
1765 #endif
1766 
1767 #endif /* __NCURSES_H */
1768