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