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