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