xref: /freebsd/contrib/ncurses/include/curses.h.in (revision 3ff369fed2a08f32dda232c10470b949bef9489f)
1/****************************************************************************
2 * Copyright (c) 1998,1999,2000,2001,2002 Free Software Foundation, Inc.    *
3 *                                                                          *
4 * Permission is hereby granted, free of charge, to any person obtaining a  *
5 * copy of this software and associated documentation files (the            *
6 * "Software"), to deal in the Software without restriction, including      *
7 * without limitation the rights to use, copy, modify, merge, publish,      *
8 * distribute, distribute with modifications, sublicense, and/or sell       *
9 * copies of the Software, and to permit persons to whom the Software is    *
10 * furnished to do so, subject to the following conditions:                 *
11 *                                                                          *
12 * The above copyright notice and this permission notice shall be included  *
13 * in all copies or substantial portions of the Software.                   *
14 *                                                                          *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22 *                                                                          *
23 * Except as contained in this notice, the name(s) of the above copyright   *
24 * holders shall not be used in advertising or otherwise to promote the     *
25 * sale, use or other dealings in this Software without prior written       *
26 * authorization.                                                           *
27 ****************************************************************************/
28
29/****************************************************************************
30 *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
31 *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
32 ****************************************************************************/
33
34/* $Id: curses.h.in,v 1.128 2002/05/11 21:38:02 tom Exp $ */
35
36#ifndef __NCURSES_H
37#define __NCURSES_H
38
39#define CURSES 1
40#define CURSES_H 1
41
42/* This should be defined for the enhanced functionality to be visible.
43 * However, none of the wide-character (enhanced) functionality is implemented.
44 * So we do not define it (yet).
45#define _XOPEN_CURSES 1
46 */
47
48/* These are defined only in curses.h, and are used for conditional compiles */
49#define NCURSES_VERSION_MAJOR @NCURSES_MAJOR@
50#define NCURSES_VERSION_MINOR @NCURSES_MINOR@
51#define NCURSES_VERSION_PATCH @NCURSES_PATCH@
52
53/* This is defined in more than one ncurses header, for identification */
54#undef  NCURSES_VERSION
55#define NCURSES_VERSION "@NCURSES_MAJOR@.@NCURSES_MINOR@"
56
57#include <ncurses_dll.h>
58
59#ifdef NCURSES_NOMACROS
60#define NCURSES_ATTR_T attr_t
61#endif
62
63#ifndef NCURSES_ATTR_T
64#define NCURSES_ATTR_T int
65#endif
66
67#undef  NCURSES_CONST
68#define NCURSES_CONST @NCURSES_CONST@
69
70#undef	NCURSES_COLOR_T
71#define	NCURSES_COLOR_T short
72
73#undef	NCURSES_SIZE_T
74#define	NCURSES_SIZE_T short
75
76#undef	NCURSES_CH_T
77#define NCURSES_CH_T @NCURSES_CH_T@
78
79typedef unsigned @cf_cv_typeof_chtype@ chtype;
80
81#include <stdio.h>
82#include <unctrl.h>
83#include <stdarg.h>	/* we need va_list */
84#ifdef _XOPEN_SOURCE_EXTENDED
85#include <stddef.h>	/* we want wchar_t */
86#endif /* _XOPEN_SOURCE_EXTENDED */
87
88/* XSI and SVr4 specify that curses implements 'bool'.  However, C++ may also
89 * implement it.  If so, we must use the C++ compiler's type to avoid conflict
90 * with other interfaces.
91 *
92 * A further complication is that <stdbool.h> may declare 'bool' to be a
93 * different type, such as an enum which is not necessarily compatible with
94 * C++.  If we have <stdbool.h>, make 'bool' a macro, so users may #undef it.
95 * Otherwise, let it remain a typedef to avoid conflicts with other #define's.
96 * In either case, make a typedef for NCURSES_BOOL which can be used if needed
97 * from either C or C++.
98 */
99
100#undef TRUE
101#define TRUE    1
102
103#undef FALSE
104#define FALSE   0
105
106typedef @cf_cv_type_of_bool@ NCURSES_BOOL;
107
108#if (!defined(__cplusplus) || !@cf_cv_builtin_bool@) && (!@cf_cv_cc_bool_type@)
109
110#if @cf_cv_header_stdbool_h@
111#include <stdbool.h>
112#endif
113
114#undef bool
115
116#if @cf_cv_header_stdbool_h@
117#define bool NCURSES_BOOL
118#else
119typedef @cf_cv_type_of_bool@ bool;
120#endif
121
122#endif /* !__cplusplus, etc. */
123
124#ifdef __cplusplus
125extern "C" {
126#endif
127
128/*
129 * XSI attributes.  In the ncurses implementation, they are identical to the
130 * A_ attributes.
131 */
132#define WA_ATTRIBUTES	A_ATTRIBUTES
133#define WA_NORMAL	A_NORMAL
134#define WA_STANDOUT	A_STANDOUT
135#define WA_UNDERLINE	A_UNDERLINE
136#define WA_REVERSE	A_REVERSE
137#define WA_BLINK	A_BLINK
138#define WA_DIM		A_DIM
139#define WA_BOLD		A_BOLD
140#define WA_ALTCHARSET	A_ALTCHARSET
141#define WA_INVIS	A_INVIS
142#define WA_PROTECT	A_PROTECT
143#define WA_HORIZONTAL	A_HORIZONTAL
144#define WA_LEFT		A_LEFT
145#define WA_LOW		A_LOW
146#define WA_RIGHT	A_RIGHT
147#define WA_TOP		A_TOP
148#define WA_VERTICAL	A_VERTICAL
149
150/* colors */
151extern NCURSES_EXPORT_VAR(int) COLORS;
152extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS;
153
154#define COLOR_BLACK	0
155#define COLOR_RED	1
156#define COLOR_GREEN	2
157#define COLOR_YELLOW	3
158#define COLOR_BLUE	4
159#define COLOR_MAGENTA	5
160#define COLOR_CYAN	6
161#define COLOR_WHITE	7
162
163/* line graphics */
164
165#if @BROKEN_LINKER@
166extern NCURSES_EXPORT_VAR(chtype*) _nc_acs_map(void);
167#define acs_map (_nc_acs_map())
168#else
169extern NCURSES_EXPORT_VAR(chtype) acs_map[];
170#endif
171
172/* VT100 symbols begin here */
173#define ACS_ULCORNER	(acs_map['l'])	/* upper left corner */
174#define ACS_LLCORNER	(acs_map['m'])	/* lower left corner */
175#define ACS_URCORNER	(acs_map['k'])	/* upper right corner */
176#define ACS_LRCORNER	(acs_map['j'])	/* lower right corner */
177#define ACS_LTEE	(acs_map['t'])	/* tee pointing right */
178#define ACS_RTEE	(acs_map['u'])	/* tee pointing left */
179#define ACS_BTEE	(acs_map['v'])	/* tee pointing up */
180#define ACS_TTEE	(acs_map['w'])	/* tee pointing down */
181#define ACS_HLINE	(acs_map['q'])	/* horizontal line */
182#define ACS_VLINE	(acs_map['x'])	/* vertical line */
183#define ACS_PLUS	(acs_map['n'])	/* large plus or crossover */
184#define ACS_S1		(acs_map['o'])	/* scan line 1 */
185#define ACS_S9		(acs_map['s'])	/* scan line 9 */
186#define ACS_DIAMOND	(acs_map['`'])	/* diamond */
187#define ACS_CKBOARD	(acs_map['a'])	/* checker board (stipple) */
188#define ACS_DEGREE	(acs_map['f'])	/* degree symbol */
189#define ACS_PLMINUS	(acs_map['g'])	/* plus/minus */
190#define ACS_BULLET	(acs_map['~'])	/* bullet */
191/* Teletype 5410v1 symbols begin here */
192#define ACS_LARROW	(acs_map[','])	/* arrow pointing left */
193#define ACS_RARROW	(acs_map['+'])	/* arrow pointing right */
194#define ACS_DARROW	(acs_map['.'])	/* arrow pointing down */
195#define ACS_UARROW	(acs_map['-'])	/* arrow pointing up */
196#define ACS_BOARD	(acs_map['h'])	/* board of squares */
197#define ACS_LANTERN	(acs_map['i'])	/* lantern symbol */
198#define ACS_BLOCK	(acs_map['0'])	/* solid square block */
199/*
200 * These aren't documented, but a lot of System Vs have them anyway
201 * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
202 * The ACS_names may not match AT&T's, our source didn't know them.
203 */
204#define ACS_S3		(acs_map['p'])	/* scan line 3 */
205#define ACS_S7		(acs_map['r'])	/* scan line 7 */
206#define ACS_LEQUAL	(acs_map['y'])	/* less/equal */
207#define ACS_GEQUAL	(acs_map['z'])	/* greater/equal */
208#define ACS_PI		(acs_map['{'])	/* Pi */
209#define ACS_NEQUAL	(acs_map['|'])	/* not equal */
210#define ACS_STERLING	(acs_map['}'])	/* UK pound sign */
211
212/*
213 * Line drawing ACS names are of the form ACS_trbl, where t is the top, r
214 * is the right, b is the bottom, and l is the left.  t, r, b, and l might
215 * be B (blank), S (single), D (double), or T (thick).  The subset defined
216 * here only uses B and S.
217 */
218#define ACS_BSSB	ACS_ULCORNER
219#define ACS_SSBB	ACS_LLCORNER
220#define ACS_BBSS	ACS_URCORNER
221#define ACS_SBBS	ACS_LRCORNER
222#define ACS_SBSS	ACS_RTEE
223#define ACS_SSSB	ACS_LTEE
224#define ACS_SSBS	ACS_BTEE
225#define ACS_BSSS	ACS_TTEE
226#define ACS_BSBS	ACS_HLINE
227#define ACS_SBSB	ACS_VLINE
228#define ACS_SSSS	ACS_PLUS
229
230#if	defined(ERR) && ((ERR) != -1)
231#undef	ERR
232#endif
233
234#if	!defined(ERR)
235#define ERR     (-1)
236#endif
237
238#if	defined(OK) && ((OK) != 0)
239#undef	OK
240#endif
241
242#if	!defined(OK)
243#define OK      (0)
244#endif
245
246/* values for the _flags member */
247#define _SUBWIN         0x01	/* is this a sub-window? */
248#define _ENDLINE        0x02	/* is the window flush right? */
249#define _FULLWIN        0x04	/* is the window full-screen? */
250#define _SCROLLWIN      0x08	/* bottom edge is at screen bottom? */
251#define _ISPAD	        0x10	/* is this window a pad? */
252#define _HASMOVED       0x20	/* has cursor moved since last refresh? */
253#define _WRAPPED        0x40	/* cursor was just wrappped */
254
255/*
256 * this value is used in the firstchar and lastchar fields to mark
257 * unchanged lines
258 */
259#define _NOCHANGE       -1
260
261/*
262 * this value is used in the oldindex field to mark lines created by insertions
263 * and scrolls.
264 */
265#define _NEWINDEX	-1
266
267typedef struct screen  SCREEN;
268typedef struct _win_st WINDOW;
269
270typedef	chtype	attr_t;		/* ...must be at least as wide as chtype */
271
272#ifdef _XOPEN_SOURCE_EXTENDED
273
274#if @NCURSES_LIBUTF8@
275#ifdef mblen			/* libutf8.h defines it w/o undefining first */
276#undef mblen
277#endif
278#include <libutf8.h>
279#define _WCHAR_T
280#define _WINT_T
281#endif
282
283#if @NCURSES_MBSTATE_T@
284#include <wchar.h>		/* ...to get mbstate_t, etc. */
285#endif
286
287#ifndef _WCHAR_T
288typedef unsigned long wchar_t;
289#endif /* _WCHAR_T */
290#ifndef _WINT_T
291typedef long int wint_t;
292#endif /* _WINT_T */
293
294#define CCHARW_MAX	5
295typedef struct
296{
297    attr_t	attr;
298    wchar_t	chars[CCHARW_MAX];
299}
300cchar_t;
301
302#endif /* _XOPEN_SOURCE_EXTENDED */
303
304struct ldat;
305
306struct _win_st
307{
308	NCURSES_SIZE_T _cury, _curx; /* current cursor position */
309
310	/* window location and size */
311	NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */
312	NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */
313
314	short   _flags;		/* window state flags */
315
316	/* attribute tracking */
317	attr_t  _attrs;		/* current attribute for non-space character */
318	chtype  _bkgd;		/* current background char/attribute pair */
319
320	/* option values set by user */
321	bool	_notimeout;	/* no time out on function-key entry? */
322	bool	_clear;		/* consider all data in the window invalid? */
323	bool	_leaveok;	/* OK to not reset cursor on exit? */
324	bool	_scroll;	/* OK to scroll this window? */
325	bool	_idlok;		/* OK to use insert/delete line? */
326	bool	_idcok;		/* OK to use insert/delete char? */
327	bool	_immed;		/* window in immed mode? (not yet used) */
328	bool	_sync;		/* window in sync mode? */
329	bool	_use_keypad;	/* process function keys into KEY_ symbols? */
330	int	_delay;		/* 0 = nodelay, <0 = blocking, >0 = delay */
331
332	struct ldat *_line;	/* the actual line data */
333
334	/* global screen state */
335	NCURSES_SIZE_T _regtop;	/* top line of scrolling region */
336	NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */
337
338	/* these are used only if this is a sub-window */
339	int	_parx;		/* x coordinate of this window in parent */
340	int	_pary;		/* y coordinate of this window in parent */
341	WINDOW	*_parent;	/* pointer to parent if a sub-window */
342
343	/* these are used only if this is a pad */
344	struct pdat
345	{
346	    NCURSES_SIZE_T _pad_y,      _pad_x;
347	    NCURSES_SIZE_T _pad_top,    _pad_left;
348	    NCURSES_SIZE_T _pad_bottom, _pad_right;
349	} _pad;
350
351	NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */
352
353#ifdef _XOPEN_SOURCE_EXTENDED
354	cchar_t  _bkgrnd;	/* current background char/attribute pair */
355#endif
356};
357
358extern NCURSES_EXPORT_VAR(WINDOW *)   stdscr;
359extern NCURSES_EXPORT_VAR(WINDOW *)   curscr;
360extern NCURSES_EXPORT_VAR(WINDOW *)   newscr;
361
362extern NCURSES_EXPORT_VAR(int)	LINES;
363extern NCURSES_EXPORT_VAR(int)	COLS;
364extern NCURSES_EXPORT_VAR(int)	TABSIZE;
365
366/*
367 * This global was an undocumented feature under AIX curses.
368 */
369extern NCURSES_EXPORT_VAR(int) ESCDELAY;	/* ESC expire time in milliseconds */
370
371extern NCURSES_EXPORT_VAR(char) ttytype[];	/* needed for backward compatibility */
372
373/*
374 * These functions are extensions - not in XSI Curses.
375 */
376#if @NCURSES_EXT_FUNCS@
377extern NCURSES_EXPORT(bool) is_term_resized (int, int);
378extern NCURSES_EXPORT(char *) keybound (int, int);
379extern NCURSES_EXPORT(const char *) curses_version (void);
380extern NCURSES_EXPORT(int) assume_default_colors (int, int);
381extern NCURSES_EXPORT(int) define_key (char *, int);
382extern NCURSES_EXPORT(int) keyok (int, bool);
383extern NCURSES_EXPORT(int) resize_term (int, int);
384extern NCURSES_EXPORT(int) resizeterm (int, int);
385extern NCURSES_EXPORT(int) use_default_colors (void);
386extern NCURSES_EXPORT(int) use_extended_names (bool);
387extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);
388#else
389#define curses_version() NCURSES_VERSION
390#endif
391
392/*
393 * GCC (and some other compilers) define '__attribute__'; we're using this
394 * macro to alert the compiler to flag inconsistencies in printf/scanf-like
395 * function calls.  Just in case '__attribute__' isn't defined, make a dummy.
396 * G++ doesn't accept it anyway.
397 */
398#if !defined(__GNUC__) && !defined(__attribute__)
399#define __attribute__(p) /* nothing */
400#endif
401
402/*
403 * For g++, turn off our macros that use __attribute__ (g++ recognizes some
404 * of them, but not at the same version levels as gcc).
405 */
406#ifdef __cplusplus
407#undef GCC_NORETURN
408#undef GCC_PRINTF
409#undef GCC_SCANF
410#undef GCC_UNUSED
411#endif
412
413/*
414 * We cannot define these in ncurses_cfg.h, since they require parameters to be
415 * passed (that's non-portable).
416 */
417#ifndef GCC_PRINTFLIKE
418#if defined(GCC_PRINTF) && !defined(printf)
419#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
420#else
421#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
422#endif
423#endif
424
425#ifndef GCC_SCANFLIKE
426#if defined(GCC_SCANF) && !defined(scanf)
427#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
428#else
429#define GCC_SCANFLIKE(fmt,var)  /*nothing*/
430#endif
431#endif
432
433#ifndef	GCC_NORETURN
434#define	GCC_NORETURN /* nothing */
435#endif
436
437#ifndef	GCC_UNUSED
438#define	GCC_UNUSED /* nothing */
439#endif
440
441/*
442 * Function prototypes.  This is the complete XSI Curses list of required
443 * functions.  Those marked `generated' will have sources generated from the
444 * macro definitions later in this file, in order to satisfy XPG4.2
445 * requirements.
446 */
447
448extern NCURSES_EXPORT(int) addch (const chtype);			/* generated */
449extern NCURSES_EXPORT(int) addchnstr (const chtype *, int);		/* generated */
450extern NCURSES_EXPORT(int) addchstr (const chtype *);			/* generated */
451extern NCURSES_EXPORT(int) addnstr (const char *, int);			/* generated */
452extern NCURSES_EXPORT(int) addstr (const char *);			/* generated */
453extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T);			/* generated */
454extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T);			/* generated */
455extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T);			/* generated */
456extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *);	/* generated */
457extern NCURSES_EXPORT(int) attr_off (attr_t, void *);			/* generated */
458extern NCURSES_EXPORT(int) attr_on (attr_t, void *);			/* generated */
459extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *);		/* generated */
460extern NCURSES_EXPORT(int) baudrate (void);				/* implemented */
461extern NCURSES_EXPORT(int) beep  (void);				/* implemented */
462extern NCURSES_EXPORT(int) bkgd (chtype);				/* generated */
463extern NCURSES_EXPORT(void) bkgdset (chtype);				/* generated */
464extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);	/* generated */
465extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype);		/* generated */
466extern NCURSES_EXPORT(bool) can_change_color (void);			/* implemented */
467extern NCURSES_EXPORT(int) cbreak (void);				/* implemented */
468extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *);	/* generated */
469extern NCURSES_EXPORT(int) clear (void);				/* generated */
470extern NCURSES_EXPORT(int) clearok (WINDOW *,bool);			/* implemented */
471extern NCURSES_EXPORT(int) clrtobot (void);				/* generated */
472extern NCURSES_EXPORT(int) clrtoeol (void);				/* generated */
473extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*);	/* implemented */
474extern NCURSES_EXPORT(int) color_set (short,void*);			/* generated */
475extern NCURSES_EXPORT(int) COLOR_PAIR (int);				/* generated */
476extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int);	/* implemented */
477extern NCURSES_EXPORT(int) curs_set (int);				/* implemented */
478extern NCURSES_EXPORT(int) def_prog_mode (void);			/* implemented */
479extern NCURSES_EXPORT(int) def_shell_mode (void);			/* implemented */
480extern NCURSES_EXPORT(int) delay_output (int);				/* implemented */
481extern NCURSES_EXPORT(int) delch (void);				/* generated */
482extern NCURSES_EXPORT(void) delscreen (SCREEN *);			/* implemented */
483extern NCURSES_EXPORT(int) delwin (WINDOW *);				/* implemented */
484extern NCURSES_EXPORT(int) deleteln (void);				/* generated */
485extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int);	/* implemented */
486extern NCURSES_EXPORT(int) doupdate (void);				/* implemented */
487extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *);			/* implemented */
488extern NCURSES_EXPORT(int) echo (void);					/* implemented */
489extern NCURSES_EXPORT(int) echochar (const chtype);			/* generated */
490extern NCURSES_EXPORT(int) erase (void);				/* generated */
491extern NCURSES_EXPORT(int) endwin (void);				/* implemented */
492extern NCURSES_EXPORT(char) erasechar (void);				/* implemented */
493extern NCURSES_EXPORT(void) filter (void);				/* implemented */
494extern NCURSES_EXPORT(int) flash (void);				/* implemented */
495extern NCURSES_EXPORT(int) flushinp (void);				/* implemented */
496extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *);			/* generated */
497extern NCURSES_EXPORT(int) getch (void);				/* generated */
498extern NCURSES_EXPORT(int) getnstr (char *, int);			/* generated */
499extern NCURSES_EXPORT(int) getstr (char *);				/* generated */
500extern NCURSES_EXPORT(WINDOW *) getwin (FILE *);			/* implemented */
501extern NCURSES_EXPORT(int) halfdelay (int);				/* implemented */
502extern NCURSES_EXPORT(bool) has_colors (void);				/* implemented */
503extern NCURSES_EXPORT(bool) has_ic (void);				/* implemented */
504extern NCURSES_EXPORT(bool) has_il (void);				/* implemented */
505extern NCURSES_EXPORT(int) hline (chtype, int);				/* generated */
506extern NCURSES_EXPORT(void) idcok (WINDOW *, bool);			/* implemented */
507extern NCURSES_EXPORT(int) idlok (WINDOW *, bool);			/* implemented */
508extern NCURSES_EXPORT(void) immedok (WINDOW *, bool);			/* implemented */
509extern NCURSES_EXPORT(chtype) inch (void);				/* generated */
510extern NCURSES_EXPORT(int) inchnstr (chtype *, int);			/* generated */
511extern NCURSES_EXPORT(int) inchstr (chtype *);				/* generated */
512extern NCURSES_EXPORT(WINDOW *) initscr (void);				/* implemented */
513extern NCURSES_EXPORT(int) init_color (short,short,short,short);	/* implemented */
514extern NCURSES_EXPORT(int) init_pair (short,short,short);		/* implemented */
515extern NCURSES_EXPORT(int) innstr (char *, int);			/* generated */
516extern NCURSES_EXPORT(int) insch (chtype);				/* generated */
517extern NCURSES_EXPORT(int) insdelln (int);				/* generated */
518extern NCURSES_EXPORT(int) insertln (void);				/* generated */
519extern NCURSES_EXPORT(int) insnstr (const char *, int);			/* generated */
520extern NCURSES_EXPORT(int) insstr (const char *);			/* generated */
521extern NCURSES_EXPORT(int) instr (char *);				/* generated */
522extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool);			/* implemented */
523extern NCURSES_EXPORT(bool) isendwin (void);				/* implemented */
524extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int);		/* implemented */
525extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *);			/* implemented */
526extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int);		/* implemented */
527extern NCURSES_EXPORT(int) keypad (WINDOW *,bool);			/* implemented */
528extern NCURSES_EXPORT(char) killchar (void);				/* implemented */
529extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool);			/* implemented */
530extern NCURSES_EXPORT(char *) longname (void);				/* implemented */
531extern NCURSES_EXPORT(int) meta (WINDOW *,bool);			/* implemented */
532extern NCURSES_EXPORT(int) move (int, int);				/* generated */
533extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype);		/* generated */
534extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int);	/* generated */
535extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *);	/* generated */
536extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int);	/* generated */
537extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *);		/* generated */
538extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *);	/* generated */
539extern NCURSES_EXPORT(int) mvcur (int,int,int,int);			/* implemented */
540extern NCURSES_EXPORT(int) mvdelch (int, int);				/* generated */
541extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int);		/* implemented */
542extern NCURSES_EXPORT(int) mvgetch (int, int);				/* generated */
543extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int);		/* generated */
544extern NCURSES_EXPORT(int) mvgetstr (int, int, char *);			/* generated */
545extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int);		/* generated */
546extern NCURSES_EXPORT(chtype) mvinch (int, int);			/* generated */
547extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int);	/* generated */
548extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *);		/* generated */
549extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int);		/* generated */
550extern NCURSES_EXPORT(int) mvinsch (int, int, chtype);			/* generated */
551extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int);	/* generated */
552extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *);		/* generated */
553extern NCURSES_EXPORT(int) mvinstr (int, int, char *);			/* generated */
554extern NCURSES_EXPORT(int) mvprintw (int,int, NCURSES_CONST char *,...)	/* implemented */
555		GCC_PRINTFLIKE(3,4);
556extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...)	/* implemented */
557		GCC_SCANFLIKE(3,4);
558extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int);		/* generated */
559extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype);	/* generated */
560extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */
561extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *);	/* generated */
562extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int);	/* generated */
563extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *);	/* generated */
564extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */
565extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int);		/* generated */
566extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int);		/* generated */
567extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int);	/* generated */
568extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *);	/* generated */
569extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int);	/* generated */
570extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int);			/* implemented */
571extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int);			/* generated */
572extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int);	/* generated */
573extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *);		/* generated */
574extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int);		/* generated */
575extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype);		/* generated */
576extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int);	/* generated */
577extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *);		/* generated */
578extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *);		/* generated */
579extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, NCURSES_CONST char *,...)	/* implemented */
580		GCC_PRINTFLIKE(4,5);
581extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...)	/* implemented */
582		GCC_SCANFLIKE(4,5);
583extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int);	/* generated */
584extern NCURSES_EXPORT(int) napms (int);					/* implemented */
585extern NCURSES_EXPORT(WINDOW *) newpad (int,int);				/* implemented */
586extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *);	/* implemented */
587extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int);			/* implemented */
588extern NCURSES_EXPORT(int) nl (void);					/* implemented */
589extern NCURSES_EXPORT(int) nocbreak (void);				/* implemented */
590extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool);			/* implemented */
591extern NCURSES_EXPORT(int) noecho (void);				/* implemented */
592extern NCURSES_EXPORT(int) nonl (void);					/* implemented */
593extern NCURSES_EXPORT(void) noqiflush (void);				/* implemented */
594extern NCURSES_EXPORT(int) noraw (void);				/* implemented */
595extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool);			/* implemented */
596extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *);		/* implemented */
597extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *);		/* implemented */
598extern NCURSES_EXPORT(int) pair_content (short,short*,short*);		/* implemented */
599extern NCURSES_EXPORT(int) PAIR_NUMBER (int);				/* generated */
600extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype);		/* implemented */
601extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */
602extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int);	/* implemented */
603extern NCURSES_EXPORT(int) printw (NCURSES_CONST char *,...)		/* implemented */
604		GCC_PRINTFLIKE(1,2);
605extern NCURSES_EXPORT(int) putp (const char *);				/* implemented */
606extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *);			/* implemented */
607extern NCURSES_EXPORT(void) qiflush (void);				/* implemented */
608extern NCURSES_EXPORT(int) raw (void);					/* implemented */
609extern NCURSES_EXPORT(int) redrawwin (WINDOW *);			/* generated */
610extern NCURSES_EXPORT(int) refresh (void);				/* generated */
611extern NCURSES_EXPORT(int) resetty (void);				/* implemented */
612extern NCURSES_EXPORT(int) reset_prog_mode (void);			/* implemented */
613extern NCURSES_EXPORT(int) reset_shell_mode (void);			/* implemented */
614extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int));	/* implemented */
615extern NCURSES_EXPORT(int) savetty (void);				/* implemented */
616extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...)		/* implemented */
617		GCC_SCANFLIKE(1,2);
618extern NCURSES_EXPORT(int) scr_dump (const char *);			/* implemented */
619extern NCURSES_EXPORT(int) scr_init (const char *);			/* implemented */
620extern NCURSES_EXPORT(int) scrl (int);					/* generated */
621extern NCURSES_EXPORT(int) scroll (WINDOW *);				/* generated */
622extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool);			/* implemented */
623extern NCURSES_EXPORT(int) scr_restore (const char *);			/* implemented */
624extern NCURSES_EXPORT(int) scr_set (const char *);			/* implemented */
625extern NCURSES_EXPORT(int) setscrreg (int,int);				/* generated */
626extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *);			/* implemented */
627extern NCURSES_EXPORT(int) slk_attroff (const chtype);			/* implemented */
628extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *);		/* generated:WIDEC */
629extern NCURSES_EXPORT(int) slk_attron (const chtype);			/* implemented */
630extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*);			/* generated:WIDEC */
631extern NCURSES_EXPORT(int) slk_attrset (const chtype);			/* implemented */
632extern NCURSES_EXPORT(attr_t) slk_attr (void);				/* implemented */
633extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*);	/* implemented */
634extern NCURSES_EXPORT(int) slk_clear (void);				/* implemented */
635extern NCURSES_EXPORT(int) slk_color (short);				/* implemented */
636extern NCURSES_EXPORT(int) slk_init (int);				/* implemented */
637extern NCURSES_EXPORT(char *) slk_label (int);				/* implemented */
638extern NCURSES_EXPORT(int) slk_noutrefresh (void);			/* implemented */
639extern NCURSES_EXPORT(int) slk_refresh (void);				/* implemented */
640extern NCURSES_EXPORT(int) slk_restore (void);				/* implemented */
641extern NCURSES_EXPORT(int) slk_set (int,const char *,int);		/* implemented */
642extern NCURSES_EXPORT(int) slk_touch (void);				/* implemented */
643extern NCURSES_EXPORT(int) standout (void);				/* generated */
644extern NCURSES_EXPORT(int) standend (void);				/* generated */
645extern NCURSES_EXPORT(int) start_color (void);				/* implemented */
646extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int);	/* implemented */
647extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *,int,int,int,int);	/* implemented */
648extern NCURSES_EXPORT(int) syncok (WINDOW *, bool);			/* implemented */
649extern NCURSES_EXPORT(chtype) termattrs (void);				/* implemented */
650extern NCURSES_EXPORT(char *) termname (void);				/* implemented */
651extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);		/* implemented */
652extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);		/* implemented */
653extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);		/* implemented */
654extern NCURSES_EXPORT(void) timeout (int);				/* generated */
655extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int);		/* generated */
656extern NCURSES_EXPORT(int) touchwin (WINDOW *);				/* generated */
657extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);	/* implemented */
658extern NCURSES_EXPORT(int) typeahead (int);				/* implemented */
659extern NCURSES_EXPORT(int) ungetch (int);				/* implemented */
660extern NCURSES_EXPORT(int) untouchwin (WINDOW *);			/* generated */
661extern NCURSES_EXPORT(void) use_env (bool);				/* implemented */
662extern NCURSES_EXPORT(int) vidattr (chtype);				/* implemented */
663extern NCURSES_EXPORT(int) vidputs (chtype, int (*)(int));		/* implemented */
664extern NCURSES_EXPORT(int) vline (chtype, int);				/* generated */
665extern NCURSES_EXPORT(int) vwprintw (WINDOW *, NCURSES_CONST char *,va_list);	/* implemented */
666extern NCURSES_EXPORT(int) vw_printw (WINDOW *, NCURSES_CONST char *,va_list);	/* generated */
667extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list);	/* implemented */
668extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list);	/* generated */
669extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype);		/* implemented */
670extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *const,int); /* implemented */
671extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *);		/* generated */
672extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *const,int);	/* implemented */
673extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *);		/* generated */
674extern NCURSES_EXPORT(int) wattron (WINDOW *, int);			/* generated */
675extern NCURSES_EXPORT(int) wattroff (WINDOW *, int);			/* generated */
676extern NCURSES_EXPORT(int) wattrset (WINDOW *, int);			/* generated */
677extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *);	/* generated */
678extern NCURSES_EXPORT(int) wattr_on (WINDOW *, NCURSES_CONST attr_t, void *);	/* implemented */
679extern NCURSES_EXPORT(int) wattr_off (WINDOW *, NCURSES_CONST attr_t, void *);	/* implemented */
680extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *);		/* generated */
681extern NCURSES_EXPORT(int) wbkgd (WINDOW *,const chtype);		/* implemented */
682extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype);			/* implemented */
683extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);	/* implemented */
684extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */
685extern NCURSES_EXPORT(int) wclear (WINDOW *);				/* implemented */
686extern NCURSES_EXPORT(int) wclrtobot (WINDOW *);			/* implemented */
687extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *);			/* implemented */
688extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*);		/* implemented */
689extern NCURSES_EXPORT(void) wcursyncup (WINDOW *);			/* implemented */
690extern NCURSES_EXPORT(int) wdelch (WINDOW *);				/* implemented */
691extern NCURSES_EXPORT(int) wdeleteln (WINDOW *);			/* generated */
692extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype);		/* implemented */
693extern NCURSES_EXPORT(int) werase (WINDOW *);				/* implemented */
694extern NCURSES_EXPORT(int) wgetch (WINDOW *);				/* implemented */
695extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int);		/* implemented */
696extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *);			/* generated */
697extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int);		/* implemented */
698extern NCURSES_EXPORT(chtype) winch (WINDOW *);				/* implemented */
699extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int);		/* implemented */
700extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *);		/* generated */
701extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int);		/* implemented */
702extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype);			/* implemented */
703extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int);			/* implemented */
704extern NCURSES_EXPORT(int) winsertln (WINDOW *);			/* generated */
705extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int);	/* implemented */
706extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *);		/* generated */
707extern NCURSES_EXPORT(int) winstr (WINDOW *, char *);			/* generated */
708extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int);			/* implemented */
709extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *);			/* implemented */
710extern NCURSES_EXPORT(int) wprintw (WINDOW *, NCURSES_CONST char *,...)	/* implemented */
711		GCC_PRINTFLIKE(2,3);
712extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int);		/* implemented */
713extern NCURSES_EXPORT(int) wrefresh (WINDOW *);				/* implemented */
714extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...)	/* implemented */
715		GCC_SCANFLIKE(2,3);
716extern NCURSES_EXPORT(int) wscrl (WINDOW *,int);			/* implemented */
717extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int);		/* implemented */
718extern NCURSES_EXPORT(int) wstandout (WINDOW *);			/* generated */
719extern NCURSES_EXPORT(int) wstandend (WINDOW *);			/* generated */
720extern NCURSES_EXPORT(void) wsyncdown (WINDOW *);			/* implemented */
721extern NCURSES_EXPORT(void) wsyncup (WINDOW *);				/* implemented */
722extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int);			/* implemented */
723extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int);		/* implemented */
724extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int);		/* implemented */
725
726/*
727 * vid_attr() was implemented originally based on the draft of XSI curses.
728 */
729#ifndef _XOPEN_SOURCE_EXTENDED
730#define vid_attr(a,pair,opts) vidattr(a)
731#endif
732
733/* attributes */
734
735#define NCURSES_ATTR_SHIFT       8
736#define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT))
737
738#define A_NORMAL	0L
739#define A_ATTRIBUTES	NCURSES_BITS(~(@cf_cv_1UL@ - @cf_cv_1UL@),0)
740#define A_CHARTEXT	(NCURSES_BITS(@cf_cv_1UL@,0) - @cf_cv_1UL@)
741#define A_COLOR		NCURSES_BITS(((@cf_cv_1UL@) << 8) - @cf_cv_1UL@,0)
742#define A_STANDOUT	NCURSES_BITS(@cf_cv_1UL@,8)
743#define A_UNDERLINE	NCURSES_BITS(@cf_cv_1UL@,9)
744#define A_REVERSE	NCURSES_BITS(@cf_cv_1UL@,10)
745#define A_BLINK		NCURSES_BITS(@cf_cv_1UL@,11)
746#define A_DIM		NCURSES_BITS(@cf_cv_1UL@,12)
747#define A_BOLD		NCURSES_BITS(@cf_cv_1UL@,13)
748#define A_ALTCHARSET	NCURSES_BITS(@cf_cv_1UL@,14)
749#define A_INVIS		NCURSES_BITS(@cf_cv_1UL@,15)
750#define A_PROTECT	NCURSES_BITS(@cf_cv_1UL@,16)
751#define A_HORIZONTAL	NCURSES_BITS(@cf_cv_1UL@,17)
752#define A_LEFT		NCURSES_BITS(@cf_cv_1UL@,18)
753#define A_LOW		NCURSES_BITS(@cf_cv_1UL@,19)
754#define A_RIGHT		NCURSES_BITS(@cf_cv_1UL@,20)
755#define A_TOP		NCURSES_BITS(@cf_cv_1UL@,21)
756#define A_VERTICAL	NCURSES_BITS(@cf_cv_1UL@,22)
757
758#define COLOR_PAIR(n)	NCURSES_BITS(n, 0)
759#define PAIR_NUMBER(a)	(((a) & A_COLOR) >> NCURSES_ATTR_SHIFT)
760
761/*
762 * pseudo functions
763 */
764#define wgetstr(w, s)		wgetnstr(w, s, -1)
765#define getnstr(s, n)		wgetnstr(stdscr, s, n)
766
767#define setterm(term)		setupterm(term, 1, (int *)0)
768
769#define fixterm()		reset_prog_mode()
770#define resetterm()		reset_shell_mode()
771#define saveterm()		def_prog_mode()
772#define crmode()		cbreak()
773#define nocrmode()		nocbreak()
774#define gettmode()
775
776#define getyx(win,y,x)   	(y = (win)?(win)->_cury:ERR, x = (win)?(win)->_curx:ERR)
777#define getbegyx(win,y,x)	(y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR)
778#define getmaxyx(win,y,x)	(y = (win)?((win)->_maxy + 1):ERR, x = (win)?((win)->_maxx + 1):ERR)
779#define getparyx(win,y,x)	(y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR)
780#define getsyx(y,x) do { if(newscr->_leaveok) (y)=(x)=-1; \
781			 else getyx(newscr,(y),(x)); \
782		    } while(0)
783#define setsyx(y,x) do { if((y)==-1 && (x)==-1) newscr->_leaveok=TRUE; \
784			 else {newscr->_leaveok=FALSE;wmove(newscr,(y),(x));} \
785		    } while(0)
786
787/* It seems older SYSV curses versions define these */
788#define getattrs(win)		((win)?(win)->_attrs:A_NORMAL)
789#define getcurx(win)		((win)?(win)->_curx:ERR)
790#define getcury(win)		((win)?(win)->_cury:ERR)
791#define getbegx(win)		((win)?(win)->_begx:ERR)
792#define getbegy(win)		((win)?(win)->_begy:ERR)
793#define getmaxx(win)		((win)?((win)->_maxx + 1):ERR)
794#define getmaxy(win)		((win)?((win)->_maxy + 1):ERR)
795#define getparx(win)		((win)?(win)->_parx:ERR)
796#define getpary(win)		((win)?(win)->_pary:ERR)
797
798#define wstandout(win)      	(wattrset(win,A_STANDOUT))
799#define wstandend(win)      	(wattrset(win,A_NORMAL))
800#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK)
801
802#define wattron(win,at)		wattr_on(win, at, (void *)0)
803#define wattroff(win,at)	wattr_off(win, at, (void *)0)
804#define wattrset(win,at)	((win)->_attrs = (at))
805
806#define scroll(win)		wscrl(win,1)
807
808#define touchwin(win)		wtouchln((win), 0, getmaxy(win), 1)
809#define touchline(win, s, c)	wtouchln((win), s, c, 1)
810#define untouchwin(win)		wtouchln((win), 0, getmaxy(win), 0)
811
812#define box(win, v, h)		wborder(win, v, v, h, h, 0, 0, 0, 0)
813#define border(ls, rs, ts, bs, tl, tr, bl, br)	wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
814#define hline(ch, n)		whline(stdscr, ch, n)
815#define vline(ch, n)		wvline(stdscr, ch, n)
816
817#define winstr(w, s)		winnstr(w, s, -1)
818#define winchstr(w, s)		winchnstr(w, s, -1)
819#define winsstr(w, s)		winsnstr(w, s, -1)
820
821#define redrawwin(win)		wredrawln(win, 0, (win)->_maxy+1)
822#define waddstr(win,str)	waddnstr(win,str,-1)
823#define waddchstr(win,str)	waddchnstr(win,str,-1)
824
825/*
826 * pseudo functions for standard screen
827 */
828
829#define addch(ch)		waddch(stdscr,ch)
830#define addchnstr(str,n)	waddchnstr(stdscr,str,n)
831#define addchstr(str)		waddchstr(stdscr,str)
832#define addnstr(str,n)		waddnstr(stdscr,str,n)
833#define addstr(str)		waddnstr(stdscr,str,-1)
834#define attroff(at)		wattroff(stdscr,at)
835#define attron(at)		wattron(stdscr,at)
836#define attrset(at)		wattrset(stdscr,at)
837#define attr_get(ap,cp,o)	wattr_get(stdscr,ap,cp,o)
838#define attr_off(a,o)		wattr_off(stdscr,a,o)
839#define attr_on(a,o)		wattr_on(stdscr,a,o)
840#define attr_set(a,c,o)		wattr_set(stdscr,a,c,o)
841#define bkgd(ch)		wbkgd(stdscr,ch)
842#define bkgdset(ch)		wbkgdset(stdscr,ch)
843#define chgat(n,a,c,o)		wchgat(stdscr,n,a,c,o)
844#define clear()			wclear(stdscr)
845#define clrtobot()		wclrtobot(stdscr)
846#define clrtoeol()		wclrtoeol(stdscr)
847#define color_set(c,o)		wcolor_set(stdscr,c,o)
848#define delch()			wdelch(stdscr)
849#define deleteln()		winsdelln(stdscr,-1)
850#define echochar(c)		wechochar(stdscr,c)
851#define erase()			werase(stdscr)
852#define getch()			wgetch(stdscr)
853#define getstr(str)		wgetstr(stdscr,str)
854#define inch()			winch(stdscr)
855#define inchnstr(s,n)		winchnstr(stdscr,s,n)
856#define inchstr(s)		winchstr(stdscr,s)
857#define innstr(s,n)		winnstr(stdscr,s,n)
858#define insch(c)		winsch(stdscr,c)
859#define insdelln(n)		winsdelln(stdscr,n)
860#define insertln()		winsdelln(stdscr,1)
861#define insnstr(s,n)		winsnstr(stdscr,s,n)
862#define insstr(s)		winsstr(stdscr,s)
863#define instr(s)		winstr(stdscr,s)
864#define move(y,x)		wmove(stdscr,y,x)
865#define refresh()		wrefresh(stdscr)
866#define scrl(n)			wscrl(stdscr,n)
867#define setscrreg(t,b)		wsetscrreg(stdscr,t,b)
868#define standend()		wstandend(stdscr)
869#define standout()		wstandout(stdscr)
870#define timeout(delay)		wtimeout(stdscr,delay)
871#define wdeleteln(win)		winsdelln(win,-1)
872#define winsertln(win)		winsdelln(win,1)
873
874/*
875 * mv functions
876 */
877
878#define mvwaddch(win,y,x,ch)		(wmove(win,y,x) == ERR ? ERR : waddch(win,ch))
879#define mvwaddchnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n))
880#define mvwaddchstr(win,y,x,str)	(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1))
881#define mvwaddnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n))
882#define mvwaddstr(win,y,x,str)		(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1))
883#define mvwdelch(win,y,x)		(wmove(win,y,x) == ERR ? ERR : wdelch(win))
884#define mvwchgat(win,y,x,n,a,c,o)	(wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o))
885#define mvwgetch(win,y,x)		(wmove(win,y,x) == ERR ? ERR : wgetch(win))
886#define mvwgetnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n))
887#define mvwgetstr(win,y,x,str)		(wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))
888#define mvwhline(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : whline(win,c,n))
889#define mvwinch(win,y,x)		(wmove(win,y,x) == ERR ? (chtype)ERR : winch(win))
890#define mvwinchnstr(win,y,x,s,n)	(wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n))
891#define mvwinchstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winchstr(win,s))
892#define mvwinnstr(win,y,x,s,n)		(wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n))
893#define mvwinsch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : winsch(win,c))
894#define mvwinsnstr(win,y,x,s,n)		(wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n))
895#define mvwinsstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winsstr(win,s))
896#define mvwinstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winstr(win,s))
897#define mvwvline(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : wvline(win,c,n))
898
899#define mvaddch(y,x,ch)			mvwaddch(stdscr,y,x,ch)
900#define mvaddchnstr(y,x,str,n)		mvwaddchnstr(stdscr,y,x,str,n)
901#define mvaddchstr(y,x,str)		mvwaddchstr(stdscr,y,x,str)
902#define mvaddnstr(y,x,str,n)		mvwaddnstr(stdscr,y,x,str,n)
903#define mvaddstr(y,x,str)		mvwaddstr(stdscr,y,x,str)
904#define mvchgat(y,x,n,a,c,o)		mvwchgat(stdscr,y,x,n,a,c,o)
905#define mvdelch(y,x)			mvwdelch(stdscr,y,x)
906#define mvgetch(y,x)			mvwgetch(stdscr,y,x)
907#define mvgetnstr(y,x,str,n)		mvwgetnstr(stdscr,y,x,str,n)
908#define mvgetstr(y,x,str)		mvwgetstr(stdscr,y,x,str)
909#define mvhline(y,x,c,n)		mvwhline(stdscr,y,x,c,n)
910#define mvinch(y,x)			mvwinch(stdscr,y,x)
911#define mvinchnstr(y,x,s,n)		mvwinchnstr(stdscr,y,x,s,n)
912#define mvinchstr(y,x,s)		mvwinchstr(stdscr,y,x,s)
913#define mvinnstr(y,x,s,n)		mvwinnstr(stdscr,y,x,s,n)
914#define mvinsch(y,x,c)			mvwinsch(stdscr,y,x,c)
915#define mvinsnstr(y,x,s,n)		mvwinsnstr(stdscr,y,x,s,n)
916#define mvinsstr(y,x,s)			mvwinsstr(stdscr,y,x,s)
917#define mvinstr(y,x,s)			mvwinstr(stdscr,y,x,s)
918#define mvvline(y,x,c,n)		mvwvline(stdscr,y,x,c,n)
919
920/*
921 * Some wide-character functions do not depend on the extensions.
922 */
923#define getbkgd(win)                    ((win)->_bkgd)
924
925#define slk_attr_off(a,v)		((v) ? ERR : slk_attroff(a))
926#define slk_attr_on(a,v)		((v) ? ERR : slk_attron(a))
927
928#define wattr_get(win,a,p,opts)		((void)((a) != 0 && (*(a) = (win)->_attrs)), \
929					 (void)((p) != 0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \
930					 OK)
931
932/*
933 * XSI curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use
934 * varargs.h.  It adds new calls vw_printw/vw_scanw, which are supposed to
935 * use POSIX stdarg.h.  The ncurses versions of vwprintw/vwscanw already
936 * use stdarg.h, so...
937 */
938#define vw_printw		vwprintw
939#define vw_scanw		vwscanw
940
941/*
942 * Export fallback function for use in C++ binding.
943 */
944#if !@HAVE_VSSCANF@
945#define vsscanf(a,b,c) _nc_vsscanf(a,b,c)
946NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);
947#endif
948
949/*
950 * Pseudo-character tokens outside ASCII range.  The curses wgetch() function
951 * will return any given one of these only if the corresponding k- capability
952 * is defined in your terminal's terminfo entry.
953 *
954 * Some keys (KEY_A1, etc) are arranged like this:
955 *	a1     up    a3
956 *	left   b2    right
957 *	c1     down  c3
958 *
959 * A few key codes do not depend upon the terminfo entry.
960 */
961#define KEY_CODE_YES	0400		/* A wchar_t contains a key code */
962#define KEY_MIN		0401		/* Minimum curses key */
963#define KEY_BREAK	0401		/* Break key (unreliable) */
964#define KEY_SRESET	0530		/* Soft (partial) reset (unreliable) */
965#define KEY_RESET	0531		/* Reset or hard reset (unreliable) */
966#define KEY_RESIZE	0632		/* Terminal resize event */
967