]> ncurses.scripts.mit.edu Git - ncurses.git/blob - include/curses.h.in
43e474ba449b8af36170d1dfec37f838d4444791
[ncurses.git] / include / curses.h.in
1 /***************************************************************************
2 *                            COPYRIGHT NOTICE                              *
3 ****************************************************************************
4 *                ncurses is copyright (C) 1992-1995                        *
5 *                          Zeyd M. Ben-Halim                               *
6 *                          zmbenhal@netcom.com                             *
7 *                          Eric S. Raymond                                 *
8 *                          esr@snark.thyrsus.com                           *
9 *                                                                          *
10 *        Permission is hereby granted to reproduce and distribute ncurses  *
11 *        by any means and for any fee, whether alone or as part of a       *
12 *        larger distribution, in source or in binary form, PROVIDED        *
13 *        this notice is included with any such distribution, and is not    *
14 *        removed from any of its header files. Mention of ncurses in any   *
15 *        applications linked with it is highly appreciated.                *
16 *                                                                          *
17 *        ncurses comes AS IS with no warranty, implied or expressed.       *
18 *                                                                          *
19 ***************************************************************************/
20
21 /* $Id: curses.h.in,v 1.44 1997/04/20 01:32:08 tom Exp $ */
22
23 #ifndef __NCURSES_H
24 #define __NCURSES_H
25 #define CURSES 1
26 #define CURSES_H 1
27
28 /* These are defined only in curses.h, and are used for conditional compiles */
29 #define NCURSES_VERSION_MAJOR @NCURSES_MAJOR@
30 #define NCURSES_VERSION_MINOR @NCURSES_MINOR@
31 #define NCURSES_VERSION_PATCH @NCURSES_PATCH@
32
33 /* This is defined in more than one ncurses header, for identification */
34 #undef  NCURSES_VERSION
35 #define NCURSES_VERSION "@NCURSES_MAJOR@.@NCURSES_MINOR@"
36
37 #ifdef NCURSES_NOMACROS
38 #define NCURSES_ATTR_T attr_t
39 #endif
40
41 #ifndef NCURSES_ATTR_T
42 #define NCURSES_ATTR_T int
43 #endif
44
45 #ifndef NCURSES_CONST
46 #define NCURSES_CONST /* nothing */
47 #endif
48
49 #ifndef _UNCTRL_H
50 typedef unsigned long  chtype;
51 #endif
52
53 #include <stdio.h>
54 #include <unctrl.h>
55 #include <stdarg.h>     /* we need va_list */
56 #ifdef _XOPEN_SOURCE_EXTENDED
57 #include <stddef.h>     /* we want wchar_t */
58 #endif /* _XOPEN_SOURCE_EXTENDED */
59
60 /* XSI and SVr4 specify that curses implements 'bool'.  However, C++ may also
61  * implement it.  If so, we must use the C++ compiler's type to avoid conflict
62  * with other interfaces.
63  *
64  * To simplify use with/without the configuration script, we define the symbols
65  * CXX_BUILTIN_BOOL and CXX_TYPE_OF_BOOL; they're edited by the configure
66  * script.
67  */
68
69 #undef TRUE
70 #undef FALSE
71 #define CXX_BUILTIN_BOOL @nc_cv_builtin_bool@
72 #define CXX_TYPE_OF_BOOL @nc_cv_type_of_bool@
73
74 #if defined(__cplusplus) && CXX_BUILTIN_BOOL
75 #define TRUE    ((CXX_TYPE_OF_BOOL)true)
76 #define FALSE   ((CXX_TYPE_OF_BOOL)false)
77 #else
78 typedef CXX_TYPE_OF_BOOL bool;
79 #define TRUE    ((bool)1)
80 #define FALSE   ((bool)0)
81 #endif
82
83 #ifdef __cplusplus
84 extern "C" {
85 #endif
86
87 /*
88  * XSI attributes.  In the ncurses implementation, they are identical to the
89  * A_ attributes because attr_t is just an int.  The XSI Curses attr_* and
90  * wattr_* entry points are all mapped to attr* and wattr* entry points.
91  */
92 #define WA_ATTRIBUTES   0xffffff00
93 #define WA_NORMAL       0x00000000
94 #define WA_STANDOUT     0x00010000
95 #define WA_UNDERLINE    0x00020000
96 #define WA_REVERSE      0x00040000
97 #define WA_BLINK        0x00080000
98 #define WA_DIM          0x00100000
99 #define WA_BOLD         0x00200000
100 #define WA_ALTCHARSET   0x00400000
101 #define WA_INVIS        0x00800000
102 #define WA_PROTECT      0x01000000
103 #define WA_HORIZONTAL   0x02000000      /* XSI Curses attr -- not yet used */
104 #define WA_LEFT         0x04000000      /* XSI Curses attr -- not yet used */
105 #define WA_LOW          0x08000000      /* XSI Curses attr -- not yet used */
106 #define WA_RIGHT        0x10000000      /* XSI Curses attr -- not yet used */
107 #define WA_TOP          0x20000000      /* XSI Curses attr -- not yet used */
108 #define WA_VERTICAL     0x40000000      /* XSI Curses attr -- not yet used */
109
110 /* colors */
111 extern int COLORS;
112 extern int COLOR_PAIRS;
113
114 #define COLOR_BLACK     0
115 #define COLOR_RED       1
116 #define COLOR_GREEN     2
117 #define COLOR_YELLOW    3
118 #define COLOR_BLUE      4
119 #define COLOR_MAGENTA   5
120 #define COLOR_CYAN      6
121 #define COLOR_WHITE     7
122
123 /* line graphics */
124
125 extern  chtype acs_map[];
126
127 /* VT100 symbols begin here */
128 #define ACS_ULCORNER    (acs_map['l'])  /* upper left corner */
129 #define ACS_LLCORNER    (acs_map['m'])  /* lower left corner */
130 #define ACS_URCORNER    (acs_map['k'])  /* upper right corner */
131 #define ACS_LRCORNER    (acs_map['j'])  /* lower right corner */
132 #define ACS_LTEE        (acs_map['t'])  /* tee pointing right */
133 #define ACS_RTEE        (acs_map['u'])  /* tee pointing left */
134 #define ACS_BTEE        (acs_map['v'])  /* tee pointing up */
135 #define ACS_TTEE        (acs_map['w'])  /* tee pointing down */
136 #define ACS_HLINE       (acs_map['q'])  /* horizontal line */
137 #define ACS_VLINE       (acs_map['x'])  /* vertical line */
138 #define ACS_PLUS        (acs_map['n'])  /* large plus or crossover */
139 #define ACS_S1          (acs_map['o'])  /* scan line 1 */
140 #define ACS_S9          (acs_map['s'])  /* scan line 9 */
141 #define ACS_DIAMOND     (acs_map['`'])  /* diamond */
142 #define ACS_CKBOARD     (acs_map['a'])  /* checker board (stipple) */
143 #define ACS_DEGREE      (acs_map['f'])  /* degree symbol */
144 #define ACS_PLMINUS     (acs_map['g'])  /* plus/minus */
145 #define ACS_BULLET      (acs_map['~'])  /* bullet */
146 /* Teletype 5410v1 symbols begin here */
147 #define ACS_LARROW      (acs_map[','])  /* arrow pointing left */
148 #define ACS_RARROW      (acs_map['+'])  /* arrow pointing right */
149 #define ACS_DARROW      (acs_map['.'])  /* arrow pointing down */
150 #define ACS_UARROW      (acs_map['-'])  /* arrow pointing up */
151 #define ACS_BOARD       (acs_map['h'])  /* board of squares */
152 #define ACS_LANTERN     (acs_map['I'])  /* lantern symbol */
153 #define ACS_BLOCK       (acs_map['0'])  /* solid square block */
154 /*
155  * These aren't documented, but a lot of System Vs have them anyway
156  * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
157  * The ACS_names may not match AT&T's, our source didn't know them.
158  */
159 #define ACS_S3          (acs_map['p'])  /* scan line 3 */
160 #define ACS_S7          (acs_map['r'])  /* scan line 7 */
161 #define ACS_LEQUAL      (acs_map['y'])  /* less/equal */
162 #define ACS_GEQUAL      (acs_map['z'])  /* greater/equal */
163 #define ACS_PI          (acs_map['{'])  /* Pi */
164 #define ACS_NEQUAL      (acs_map['|'])  /* not equal */
165 #define ACS_STERLING    (acs_map['}'])  /* UK pound sign */
166
167 /*
168  * Line drawing ACS names are of the form ACS_trbl, where t is the top, r
169  * is the right, b is the bottom, and l is the left.  t, r, b, and l might
170  * be B (blank), S (single), D (double), or T (thick).  The subset defined
171  * here only uses B and S.
172  */
173 #define ACS_BSSB        ACS_ULCORNER
174 #define ACS_SSBB        ACS_LLCORNER
175 #define ACS_BBSS        ACS_URCORNER
176 #define ACS_SBBS        ACS_LRCORNER
177 #define ACS_SBSS        ACS_RTEE
178 #define ACS_SSSB        ACS_LTEE
179 #define ACS_SSBS        ACS_BTEE
180 #define ACS_BSSS        ACS_TTEE
181 #define ACS_BSBS        ACS_HLINE
182 #define ACS_SBSB        ACS_VLINE
183 #define ACS_SSSS        ACS_PLUS
184
185 #if     !defined(ERR) || ((ERR) != -1)
186 #define ERR     (-1)
187 #endif
188
189 #if     !defined(OK) || ((OK) != 0)
190 #define OK      (0)
191 #endif
192
193 /* values for the _flags member */
194 #define _SUBWIN         0x01    /* is this a sub-window? */
195 #define _ENDLINE        0x02    /* is the window flush right? */
196 #define _FULLWIN        0x04    /* is the window full-screen? */
197 #define _SCROLLWIN      0x08    /* bottom edge is at screen bottom? */
198 #define _ISPAD          0x10    /* is this window a pad? */
199 #define _HASMOVED       0x20    /* has cursor moved since last refresh? */
200 #define _WRAPPED        0x40    /* cursor was just wrappped */
201
202 /*
203  * this value is used in the firstchar and lastchar fields to mark
204  * unchanged lines
205  */
206 #define _NOCHANGE       -1
207
208 /*
209  * this value is used in the oldindex field to mark lines created by insertions
210  * and scrolls.
211  */
212 #define _NEWINDEX       -1
213
214 typedef struct screen  SCREEN;
215 typedef struct _win_st WINDOW;
216
217 typedef chtype  attr_t;         /* ...must be at least as wide as chtype */
218
219 #ifdef _XOPEN_SOURCE_EXTENDED
220 #ifndef _WCHAR_T
221 typedef unsigned long wchar_t;
222 #endif /* _WCHAR_T */
223 #ifndef _WINT_T
224 typedef long int wint_t;
225 #endif /* _WINT_T */
226
227 #define CCHARW_MAX      5
228 typedef struct
229 {
230     attr_t      attr;
231     wchar_t     chars[CCHARW_MAX];
232 }
233 cchar_t;
234 #endif /* _XOPEN_SOURCE_EXTENDED */
235
236 struct _win_st {
237         short   _cury, _curx;   /* current cursor position */
238
239         /* window location and size */
240         short   _maxy, _maxx;   /* maximums of x and y, NOT window size */
241         short   _begy, _begx;   /* screen coords of upper-left-hand corner */
242
243         short   _flags;         /* window state flags */
244
245         /* attribute tracking */
246         attr_t  _attrs;         /* current attribute for non-space character */
247         chtype  _bkgd;          /* current background char/attribute pair */
248
249         /* option values set by user */
250         bool    _notimeout;     /* no time out on function-key entry? */
251         bool    _clear;         /* consider all data in the window invalid? */
252         bool    _leaveok;       /* OK to not reset cursor on exit? */
253         bool    _scroll;        /* OK to scroll this window? */
254         bool    _idlok;         /* OK to use insert/delete line? */
255         bool    _idcok;         /* OK to use insert/delete char? */
256         bool    _immed;         /* window in immed mode? (not yet used) */
257         bool    _sync;          /* window in sync mode? */
258         bool    _use_keypad;    /* process function keys into KEY_ symbols? */
259         int     _delay;         /* 0 = nodelay, <0 = blocking, >0 = delay */
260
261         /* the actual line data */
262         struct ldat
263         {
264             chtype  *text;      /* text of the line */
265             short   firstchar;  /* first changed character in the line */
266             short   lastchar;   /* last changed character in the line */
267             short   oldindex;   /* index of the line at last update */
268         }
269         *_line;
270
271         /* global screen state */
272         short   _regtop;        /* top line of scrolling region */
273         short   _regbottom;     /* bottom line of scrolling region */
274
275         /* these are used only if this is a sub-window */
276         int     _parx;          /* x coordinate of this window in parent */
277         int     _pary;          /* y coordinate of this window in parent */
278         WINDOW  *_parent;       /* pointer to parent if a sub-window */
279
280         /* these are used only if this is a pad */
281         struct pdat
282         {
283             short _pad_y,      _pad_x;
284             short _pad_top,    _pad_left;
285             short _pad_bottom, _pad_right;
286         } _pad;
287
288         short   _yoffset;       /* real begy is _begy + _yoffset */
289 };
290
291 extern WINDOW   *stdscr, *curscr, *newscr;
292
293 extern int      LINES, COLS, TABSIZE;
294
295 /*
296  * This global was an undocumented feature under AIX curses.
297  */
298 extern int ESCDELAY;    /* ESC expire time in milliseconds */
299
300 /* non-XSI extensions (dickey@clark.net) */
301 extern int resizeterm (int, int);
302 extern int wresize (WINDOW *, int, int);
303 extern int use_default_colors (void);
304
305 extern char ttytype[];          /* needed for backward compatibility */
306
307 /*
308  * GCC (and some other compilers) define '__attribute__'; we're using this
309  * macro to alert the compiler to flag inconsistencies in printf/scanf-like
310  * function calls.  Just in case '__attribute__' isn't defined, make a dummy.
311  */
312 #if !defined(__GNUC__) && !defined(__attribute__)
313 #define __attribute__(p) /* nothing */
314 #endif
315
316 /*
317  * We cannot define these in ncurses_cfg.h, since they require parameters to be
318  * passed (that's non-portable).
319  */
320 #if     GCC_PRINTF
321 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
322 #else
323 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
324 #endif
325
326 #if     GCC_SCANF
327 #define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
328 #else
329 #define GCC_SCANFLIKE(fmt,var)  /*nothing*/
330 #endif
331
332 #ifndef GCC_NORETURN
333 #define GCC_NORETURN /* nothing */
334 #endif
335
336 #ifndef GCC_UNUSED
337 #define GCC_UNUSED /* nothing */
338 #endif
339
340 /*
341  * Function prototypes.  This is the complete XSI Curses list of required
342  * functions.  Those marked `generated' will have sources generated from the
343  * macro definitions later in this file, in order to satisfy XPG4.2
344  * requirements.
345  */
346
347 extern int addch(const chtype);                         /* generated */
348 extern int addchnstr(const chtype *, int);              /* generated */
349 extern int addchstr(const chtype *);                    /* generated */
350 extern int addnstr(const char *, int);                  /* generated */
351 extern int addstr(const char *);                        /* generated */
352 #ifdef _XOPEN_SOURCE_EXTENDED
353 extern int addnwstr(const wchar_t *, int);              /* missing */
354 extern int addwstr(const wchar_t *);                    /* missing */
355 extern int add_wch(const cchar_t *);                    /* missing */
356 extern int add_wchnstr(const cchar_t *, int);           /* missing */
357 extern int add_wchstr(const cchar_t *);                 /* missing */
358 #endif /* _XOPEN_SOURCE_EXTENDED */
359 extern int attroff(NCURSES_ATTR_T);                     /* generated */
360 extern int attron(NCURSES_ATTR_T);                      /* generated */
361 extern int attrset(NCURSES_ATTR_T);                     /* generated */
362 extern int attr_get(void);                              /* generated */
363 extern int attr_off(NCURSES_ATTR_T);                    /* generated */
364 extern int attr_on(NCURSES_ATTR_T);                     /* generated */
365 extern int attr_set(NCURSES_ATTR_T);                    /* generated */
366 extern int baudrate(void);                              /* implemented */
367 extern int beep(void);                                  /* implemented */
368 extern int bkgd(chtype);                                /* generated */
369 extern void bkgdset(chtype);                            /* generated */
370 #ifdef _XOPEN_SOURCE_EXTENDED
371 extern int bkgrndset(const cchar_t *);                  /* missing */
372 extern int bkgrnd(const cchar_t *);                     /* missing */
373 #endif /* _XOPEN_SOURCE_EXTENDED */
374 extern int border(chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);     /* generated */
375 #ifdef _XOPEN_SOURCE_EXTENDED
376 extern int border_set(cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t); /* missing */
377 #endif /* _XOPEN_SOURCE_EXTENDED */
378 extern int box(WINDOW *, chtype, chtype);               /* generated */
379 #ifdef _XOPEN_SOURCE_EXTENDED
380 extern int box_set(WINDOW *, cchar_t, cchar_t);         /* missing */
381 #endif /* _XOPEN_SOURCE_EXTENDED */
382 extern bool can_change_color(void);                     /* implemented */
383 extern int cbreak(void);                                /* implemented */
384 extern int chgat(int, attr_t, short, const void *);     /* generated */
385 extern int clear(void);                                 /* generated */
386 extern int clearok(WINDOW *,bool);                      /* implemented */
387 extern int clrtobot(void);                              /* generated */
388 extern int clrtoeol(void);                              /* generated */
389 extern int color_content(short,short*,short*,short*);   /* implemented */
390 extern int COLOR_PAIR(int);                             /* generated */
391 extern int copywin(const WINDOW*,WINDOW*,int,int,int,int,int,int,int);  /* implemented */
392 extern int curs_set(int);                               /* implemented */
393 extern int def_prog_mode(void);                         /* implemented */
394 extern int def_shell_mode(void);                        /* implemented */
395 extern int delay_output(int);                           /* implemented */
396 extern int delch(void);                                 /* generated */
397 extern void delscreen(SCREEN *);                        /* implemented */
398 extern int delwin(WINDOW *);                            /* implemented */
399 extern int deleteln(void);                              /* generated */
400 extern WINDOW *derwin(WINDOW *,int,int,int,int);        /* implemented */
401 extern int doupdate(void);                              /* implemented */
402 extern WINDOW *dupwin(WINDOW *);                        /* implemented */
403 extern int echo(void);                                  /* implemented */
404 extern int echochar(const chtype);                      /* generated */
405 #ifdef _XOPEN_SOURCE_EXTENDED
406 extern int echo_wchar(const cchar_t *);                 /* missing */
407 #endif /* _XOPEN_SOURCE_EXTENDED */
408 extern int endwin(void);                                /* implemented */
409 extern char erasechar(void);                            /* implemented */
410 #ifdef _XOPEN_SOURCE_EXTENDED
411 extern int erase_wchar(wchar_t *);                      /* missing */
412 #endif /* _XOPEN_SOURCE_EXTENDED */
413 extern void filter(void);                               /* implemented */
414 extern int flash(void);                                 /* implemented */
415 extern int flushinp(void);                              /* implemented */
416 extern chtype getbkgd(WINDOW *);                        /* generated */
417 #ifdef _XOPEN_SOURCE_EXTENDED
418 extern int getbkgrnd(cchar_t *);                        /* missing */
419 extern int getcchar(const cchar_t *, wchar_t*, attr_t*, short*, void*); /* missing */
420 #endif /* _XOPEN_SOURCE_EXTENDED */
421 extern int getch(void);                                 /* generated */
422 extern int getnstr(char *, int);                        /* generated */
423 #ifdef _XOPEN_SOURCE_EXTENDED
424 extern int getn_wstr(wint_t *, int);                    /* missing */
425 #endif /* _XOPEN_SOURCE_EXTENDED */
426 extern int getstr(char *);                              /* generated */
427 #ifdef _XOPEN_SOURCE_EXTENDED
428 extern int get_wch(wint_t *);                           /* missing */
429 #endif /* _XOPEN_SOURCE_EXTENDED */
430 extern WINDOW *getwin(FILE *);                          /* not in XPG4 */
431 #ifdef _XOPEN_SOURCE_EXTENDED
432 extern int get_wstr(wint_t *);                          /* missing */
433 #endif /* _XOPEN_SOURCE_EXTENDED */
434 extern int halfdelay(int);                              /* implemented */
435 extern bool has_colors(void);                           /* implemented */
436 extern int has_ic(void);                                /* implemented */
437 extern int has_il(void);                                /* implemented */
438 extern int hline(chtype, int);                          /* generated */
439 #ifdef _XOPEN_SOURCE_EXTENDED
440 extern int hline_set(const cchar_t *, int);             /* missing */
441 #endif /* _XOPEN_SOURCE_EXTENDED */
442 extern void idcok(WINDOW *, bool);                      /* implemented */
443 extern int idlok(WINDOW *, bool);                       /* implemented */
444 extern void immedok(WINDOW *, bool);                    /* implemented */
445 extern chtype inch(void);                               /* generated */
446 extern int inchnstr(chtype *, int);                     /* generated */
447 extern int inchstr(chtype *);                           /* generated */
448 extern WINDOW *initscr(void);                           /* implemented */
449 extern int init_color(short,short,short,short);         /* implemented */
450 extern int init_pair(short,short,short);                /* implemented */
451 extern int innstr(char *, int);                         /* generated */
452 #ifdef _XOPEN_SOURCE_EXTENDED
453 extern int innwstr(wchar_t *, int);                     /* missing */
454 #endif /* _XOPEN_SOURCE_EXTENDED */
455 extern int insch(chtype);                               /* generated */
456 extern int insdelln(int);                               /* generated */
457 extern int insertln(void);                              /* generated */
458 extern int insnstr(const char *, int);                  /* generated */
459 extern int insstr(const char *);                        /* generated */
460 extern int instr(char *);                               /* generated */
461 #ifdef _XOPEN_SOURCE_EXTENDED
462 extern int ins_nwstr(const wchar_t *, int);             /* missing */
463 extern int ins_wch(const cchar_t *);                    /* missing */
464 extern int ins_wstr(const wchar_t *);                   /* missing */
465 #endif /* _XOPEN_SOURCE_EXTENDED */
466 extern int intrflush(WINDOW *,bool);                    /* implemented */
467 #ifdef _XOPEN_SOURCE_EXTENDED
468 extern int inwstr(wchar_t *);                           /* missing */
469 extern int in_wch(const cchar_t *);                     /* missing */
470 extern int in_wchstr(const cchar_t *);                  /* missing */
471 extern int in_wchntr(const cchar_t *, int);             /* missing */
472 #endif /* _XOPEN_SOURCE_EXTENDED */
473 extern int isendwin(void);                              /* implemented */
474 extern int is_linetouched(WINDOW *,int);                /* implemented */
475 extern int is_wintouched(WINDOW *);                     /* implemented */
476 extern const char *keyname(int);                        /* implemented */
477 #ifdef _XOPEN_SOURCE_EXTENDED
478 extern int key_name(wchar_t *);                         /* missing */
479 #endif /* _XOPEN_SOURCE_EXTENDED */
480 extern int keypad(WINDOW *,bool);                       /* implemented */
481 extern char killchar(void);                             /* implemented */
482 #ifdef _XOPEN_SOURCE_EXTENDED
483 extern int killwchar(wchar_t *);                        /* missing */
484 #endif /* _XOPEN_SOURCE_EXTENDED */
485 extern int leaveok(WINDOW *,bool);                      /* implemented */
486 extern char *longname(void);                            /* implemented */
487 extern int meta(WINDOW *,bool);                         /* implemented */
488 extern int move(int, int);                              /* generated */
489 extern int mvaddch(int, int, const chtype);             /* generated */
490 extern int mvaddchnstr(int, int, const chtype *, int);  /* generated */
491 extern int mvaddchstr(int, int, const chtype *);        /* generated */
492 extern int mvaddnstr(int, int, const char *, int);      /* generated */
493 extern int mvaddstr(int, int, const char *);            /* generated */
494 #ifdef _XOPEN_SOURCE_EXTENDED
495 extern int mvaddnwstr(int, int, const wchar_t *, int);  /* missing */
496 extern int mvaddwstr(int, int, const wchar_t *);        /* missing */
497 extern int mvadd_wch(int, int, const cchar_t *);        /* missing */
498 extern int mvadd_wchnstr(int, int, const cchar_t *, int);/* missing */
499 extern int mvadd_wchstr(int, int, const cchar_t *);     /* missing */
500 #endif /* _XOPEN_SOURCE_EXTENDED */
501 extern int mvchgat(int, int, int, attr_t, short, const void *); /* generated */
502 extern int mvcur(int,int,int,int);                      /* implemented */
503 extern int mvdelch(int, int);                           /* generated */
504 extern int mvderwin(WINDOW *, int, int);                /* implemented */
505 extern int mvgetch(int, int);                           /* generated */
506 extern int mvgetnstr(int, int, char *, int);            /* generated */
507 #ifdef _XOPEN_SOURCE_EXTENDED
508 extern int mvgetn_wstr(int, int, wint_t *, int);        /* missing */
509 #endif /* _XOPEN_SOURCE_EXTENDED */
510 extern int mvgetstr(int, int, char *);                  /* generated */
511 #ifdef _XOPEN_SOURCE_EXTENDED
512 extern int mvget_wch(int, int, wint_t *);               /* missing */
513 #endif /* _XOPEN_SOURCE_EXTENDED */
514 #ifdef _XOPEN_SOURCE_EXTENDED
515 extern int mvget_wstr(int, int, wint_t *);              /* missing */
516 #endif /* _XOPEN_SOURCE_EXTENDED */
517 extern int mvhline(int, int, chtype, int);              /* generated */
518 #ifdef _XOPEN_SOURCE_EXTENDED
519 extern int mvhline_set(int, int, const cchar_t *, int); /* missing */
520 #endif /* _XOPEN_SOURCE_EXTENDED */
521 extern chtype mvinch(int, int);                         /* generated */
522 extern int mvinchnstr(int, int, chtype *, int);         /* generated */
523 extern int mvinchstr(int, int, chtype *);               /* generated */
524 extern int mvinnstr(int, int, char *, int);             /* generated */
525 #ifdef _XOPEN_SOURCE_EXTENDED
526 extern int mvinnwstr(int, int, wchar_t *, int);         /* missing */
527 #endif /* _XOPEN_SOURCE_EXTENDED */
528 extern int mvinsch(int, int, chtype);                   /* generated */
529 extern int mvinsnstr(int, int, const char *, int);      /* generated */
530 extern int mvinsstr(int, int, const char *);            /* generated */
531 extern int mvinstr(int, int, char *);                   /* generated */
532 #ifdef _XOPEN_SOURCE_EXTENDED
533 extern int mvins_nwstr(int, int, const wchar_t *, int); /* missing */
534 extern int mvins_wch(int, int, const cchar_t *);        /* missing */
535 extern int mvins_wstr(int, int, const wchar_t *);       /* missing */
536 extern int mvinwstr(int, int, wchar_t *);               /* missing */
537 extern int mvin_wch(int, int, const cchar_t *);         /* missing */
538 extern int mvin_wchstr(int, int, const cchar_t *);      /* missing */
539 extern int mvin_wchntr(int, int, const cchar_t *, int); /* missing */
540 #endif /* _XOPEN_SOURCE_EXTENDED */
541 extern int mvprintw(int,int,const char *,...)           /* implemented */
542                 GCC_PRINTFLIKE(3,4);
543 extern int mvscanw(int,int,const char *,...)            /* implemented */
544                 GCC_SCANFLIKE(3,4);
545 extern int mvvline(int, int, chtype, int);              /* generated */
546 #ifdef _XOPEN_SOURCE_EXTENDED
547 extern int mvvline_set(int, int, const cchar_t *, int); /* missing */
548 #endif /* _XOPEN_SOURCE_EXTENDED */
549 extern int mvwaddch(WINDOW *, int, int, const chtype);  /* generated */
550 extern int mvwaddchnstr(WINDOW *, int, int, const chtype *, int);/* generated */
551 extern int mvwaddchstr(WINDOW *, int, int, const chtype *);     /* generated */
552 extern int mvwaddnstr(WINDOW *, int, int, const char *, int);   /* generated */
553 extern int mvwaddstr(WINDOW *, int, int, const char *); /* generated */
554 #ifdef _XOPEN_SOURCE_EXTENDED
555 extern int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);/* missing */
556 extern int mvwaddwstr(WINDOW *, int, int, const wchar_t *);     /* missing */
557 extern int mvwadd_wch(WINDOW *, int, int, const cchar_t *);     /* missing */
558 extern int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int); /* missing */
559 extern int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *);  /* missing */
560 #endif /* _XOPEN_SOURCE_EXTENDED */
561 extern int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);/* generated */
562 extern int mvwdelch(WINDOW *, int, int);                /* generated */
563 extern int mvwgetch(WINDOW *, int, int);                /* generated */
564 extern int mvwgetnstr(WINDOW *, int, int, char *, int); /* generated */
565 #ifdef _XOPEN_SOURCE_EXTENDED
566 extern int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int);/* missing */
567 #endif /* _XOPEN_SOURCE_EXTENDED */
568 extern int mvwgetstr(WINDOW *, int, int, char *);       /* generated */
569 #ifdef _XOPEN_SOURCE_EXTENDED
570 extern int mvwget_wch(WINDOW *, int, int, wint_t *);    /* missing */
571 #endif /* _XOPEN_SOURCE_EXTENDED */
572 #ifdef _XOPEN_SOURCE_EXTENDED
573 extern int mvwget_wstr(WINDOW *, int, int, wint_t *);   /* missing */
574 #endif /* _XOPEN_SOURCE_EXTENDED */
575 extern int mvwhline(WINDOW *, int, int, chtype, int);   /* generated */
576 #ifdef _XOPEN_SOURCE_EXTENDED
577 extern int mvwhline_set(WINDOW *, int, int, const cchar_t *, int);/* missing */
578 #endif /* _XOPEN_SOURCE_EXTENDED */
579 extern int mvwin(WINDOW *,int,int);                     /* implemented */
580 extern chtype mvwinch(WINDOW *, int, int);                      /* generated */
581 extern int mvwinchnstr(WINDOW *, int, int, chtype *, int);      /* generated */
582 extern int mvwinchstr(WINDOW *, int, int, chtype *);            /* generated */
583 extern int mvwinnstr(WINDOW *, int, int, char *, int);          /* generated */
584 #ifdef _XOPEN_SOURCE_EXTENDED
585 extern int mvwinnwstr(WINDOW *, int, int, wchar_t *, int);      /* missing */
586 #endif /* _XOPEN_SOURCE_EXTENDED */
587 extern int mvwinsch(WINDOW *, int, int, chtype);                /* generated */
588 extern int mvwinsnstr(WINDOW *, int, int, const char *, int);   /* generated */
589 extern int mvwinsstr(WINDOW *, int, int, const char *);         /* generated */
590 extern int mvwinstr(WINDOW *, int, int, char *);                /* generated */
591 #ifdef _XOPEN_SOURCE_EXTENDED
592 extern int mvwins_nwstr(WINDOW *, int,int, const wchar_t *,int); /* missing */
593 extern int mvwins_wch(WINDOW *, int, int, const cchar_t *);     /* missing */
594 extern int mvwins_wstr(WINDOW *, int, int, const wchar_t *);    /* missing */
595 extern int mvwinwstr(WINDOW *, int, int, wchar_t *);            /* missing */
596 extern int mvwin_wch(WINDOW *, int, int, const cchar_t *);      /* missing */
597 extern int mvwin_wchnstr(WINDOW *, int,int,const cchar_t *,int); /* missing */
598 extern int mvwin_wchstr(WINDOW *, int, int, const cchar_t *);   /* missing */
599 #endif /* _XOPEN_SOURCE_EXTENDED */
600 extern int mvwprintw(WINDOW*,int,int,const char *,...)  /* implemented */
601                 GCC_PRINTFLIKE(4,5);
602 extern int mvwscanw(WINDOW *,int,int,const char *,...)  /* implemented */
603                 GCC_SCANFLIKE(4,5);
604 extern int mvwvline(WINDOW *,int, int, chtype, int);    /* generated */
605 #ifdef _XOPEN_SOURCE_EXTENDED
606 extern int mvwvline_set(WINDOW *, int,int, const cchar_t *,int); /* missing */
607 #endif /* _XOPEN_SOURCE_EXTENDED */
608 extern int napms(int);                                  /* implemented */
609 extern WINDOW *newpad(int,int);                         /* implemented */
610 extern SCREEN *newterm(const char *,FILE *,FILE *);     /* implemented */
611 extern WINDOW *newwin(int,int,int,int);                 /* implemented */
612 extern int nl(void);                                    /* implemented */
613 extern int nocbreak(void);                              /* implemented */
614 extern int nodelay(WINDOW *,bool);                      /* implemented */
615 extern int noecho(void);                                /* implemented */
616 extern int nonl(void);                                  /* implemented */
617 extern int noqiflush(void);                             /* implemented */
618 extern int noraw(void);                                 /* implemented */
619 extern int notimeout(WINDOW *,bool);                    /* implemented */
620 extern int overlay(const WINDOW*,WINDOW *);             /* implemented */
621 extern int overwrite(const WINDOW*,WINDOW *);           /* implemented */
622 extern int pair_content(short,short*,short*);           /* implemented */
623 extern int PAIR_NUMBER(int);                            /* generated */
624 extern int pechochar(WINDOW *, chtype);                 /* implemented */
625 #ifdef _XOPEN_SOURCE_EXTENDED
626 extern int pecho_wchar(WINDOW *, const cchar_t *);      /* missing */
627 #endif /* _XOPEN_SOURCE_EXTENDED */
628 extern int pnoutrefresh(WINDOW*,int,int,int,int,int,int);/* implemented */
629 extern int prefresh(WINDOW *,int,int,int,int,int,int);  /* implemented */
630 extern int printw(const char *,...)                     /* implemented */
631                 GCC_PRINTFLIKE(1,2);
632 extern int putp(const char *);                          /* implemented */
633 extern int putwin(WINDOW *, FILE *);                    /* implemented */
634 extern int qiflush(void);                               /* implemented */
635 extern int raw(void);                                   /* implemented */
636 extern int redrawwin(WINDOW *);                         /* generated */
637 extern int refresh(void);                               /* generated */
638 extern int resetty(void);                               /* implemented */
639 extern int reset_prog_mode(void);                       /* implemented */
640 extern int reset_shell_mode(void);                      /* implemented */
641 extern int ripoffline(int, int (*init)(WINDOW *, int)); /* implemented */
642 extern int savetty(void);                               /* implemented */
643 extern int scanw(const char *,...)                      /* implemented */
644                 GCC_SCANFLIKE(1,2);
645 extern int scr_dump(const char *);                      /* implemented */
646 extern int scr_init(const char *);                      /* implemented */
647 extern int scrl(int);                                   /* generated */
648 extern int scroll(WINDOW *);                            /* generated */
649 extern int scrollok(WINDOW *,bool);                     /* implemented */
650 extern int scr_restore(const char *);                   /* implemented */
651 extern int scr_set(const char *);                       /* implemented */
652 #ifdef _XOPEN_SOURCE_EXTENDED
653 extern int setcchar(cchar_t *, wchar_t *, attr_t, short, const void *); /* missing */
654 #endif /* _XOPEN_SOURCE_EXTENDED */
655 extern int setscrreg(int,int);                          /* generated */
656 extern SCREEN *set_term(SCREEN *);                      /* implemented */
657 extern int slk_attroff(const attr_t);                   /* implemented */
658 #ifdef _XOPEN_SOURCE_EXTENDED
659 extern int slk_attr_off(attr_t);                        /* missing */
660 #endif /* _XOPEN_SOURCE_EXTENDED */
661 extern int slk_attron(const attr_t);                    /* implemented */
662 #ifdef _XOPEN_SOURCE_EXTENDED
663 extern int slk_attr_on(attr_t);                         /* missing */
664 #endif /* _XOPEN_SOURCE_EXTENDED */
665 extern int slk_attrset(const attr_t);                   /* implemented */
666 extern attr_t slk_attr(void);                           /* implemented */
667 #ifdef _XOPEN_SOURCE_EXTENDED
668 extern int slk_attr_set(attr_t);                        /* missing */
669 #endif /* _XOPEN_SOURCE_EXTENDED */
670 extern int slk_clear(void);                             /* implemented */
671 extern int slk_init(int);                               /* implemented */
672 extern char *slk_label(int);                            /* implemented */
673 extern int slk_noutrefresh(void);                       /* implemented */
674 extern int slk_refresh(void);                           /* implemented */
675 extern int slk_restore(void);                           /* implemented */
676 extern int slk_set(int,const char *,int);               /* implemented */
677 extern int slk_touch(void);                             /* implemented */
678 #ifdef _XOPEN_SOURCE_EXTENDED
679 extern int slk_wset(int, wchar_t *, int);               /* missing */
680 #endif /* _XOPEN_SOURCE_EXTENDED */
681 extern int standout(void);                              /* generated */
682 extern int standend(void);                              /* generated */
683 extern int start_color(void);                           /* implemented */
684 extern WINDOW *subpad(WINDOW *, int, int, int, int);    /* implemented */
685 extern WINDOW *subwin(WINDOW *,int,int,int,int);        /* implemented */
686 extern int syncok(WINDOW *, bool);                      /* implemented */
687 extern attr_t termattrs(void);                          /* implemented */
688 extern char *termname(void);                            /* implemented */
689 extern int tigetflag(const char *);                     /* implemented */
690 extern int tigetnum(const char *);                      /* implemented */
691 extern char *tigetstr(const char *);                    /* implemented */
692 extern int timeout(int);                                /* generated */
693 extern int typeahead(int);                              /* implemented */
694 extern int ungetch(int);                                /* implemented */
695 #ifdef _XOPEN_SOURCE_EXTENDED
696 extern int unget_wch(const wchar_t *);                  /* missing */
697 #endif /* _XOPEN_SOURCE_EXTENDED */
698 extern int untouchwin(WINDOW *);                        /* generated */
699 extern void use_env(bool);                              /* implemented */
700 extern int vidattr(chtype);                             /* implemented */
701 #ifdef _XOPEN_SOURCE_EXTENDED
702 extern int vid_attr(attr_t);                            /* missing */
703 #endif /* _XOPEN_SOURCE_EXTENDED */
704 extern int vidputs(chtype, int (*)(int));               /* implemented */
705 #ifdef _XOPEN_SOURCE_EXTENDED
706 extern int vid_puts(attr_t, int (*)(int));              /* missing */
707 #endif /* _XOPEN_SOURCE_EXTENDED */
708 extern int vline(chtype, int);                          /* generated */
709 #ifdef _XOPEN_SOURCE_EXTENDED
710 extern int vline_set(const cchar_t *, int);             /* missing */
711 #endif /* _XOPEN_SOURCE_EXTENDED */
712 extern int vwprintw(WINDOW *,const char *,va_list);     /* implemented */
713 extern int vw_printw(WINDOW *,const char *,va_list);    /* generated */
714 extern int vwscanw(WINDOW *,const char *,va_list);      /* implemented */
715 extern int vw_scanw(WINDOW *,const char *,va_list);     /* generated */
716 extern int waddch(WINDOW *, const chtype);              /* implemented */
717 extern int waddchnstr(WINDOW *,const chtype *const,int); /* implemented */
718 extern int waddchstr(WINDOW *,const chtype *);          /* generated */
719 extern int waddnstr(WINDOW *,const char *const,int);    /* implemented */
720 extern int waddstr(WINDOW *,const char *);              /* generated */
721 #ifdef _XOPEN_SOURCE_EXTENDED
722 extern int waddwstr(WINDOW *,const wchar_t *);          /* missing */
723 extern int wadd_wch(WINDOW *,const cchar_t *);          /* missing */
724 extern int wadd_wchnstr(WINDOW *,const cchar_t *,int);  /* missing */
725 extern int wadd_wchstr(WINDOW *,const cchar_t *);       /* missing */
726 #endif /* _XOPEN_SOURCE_EXTENDED */
727 extern int wattron(WINDOW *, int);                      /* generated */
728 extern int wattroff(WINDOW *, int);                     /* generated */
729 extern int wattrset(WINDOW *, int);                     /* generated */
730 extern attr_t wattr_get(WINDOW *);                      /* generated */
731 extern int wattr_on(WINDOW *, const attr_t);            /* implemented */
732 extern int wattr_off(WINDOW *, const attr_t);           /* implemented */
733 extern int wattr_set(WINDOW *, attr_t);                 /* generated */
734 extern int wbkgd(WINDOW *,const chtype);                /* implemented */
735 extern void wbkgdset(WINDOW *,chtype);                  /* generated */
736 #ifdef _XOPEN_SOURCE_EXTENDED
737 extern int wbkgrndset(WINDOW *,const cchar_t *);        /* missing */
738 extern int wbkgrnd(WINDOW *,const cchar_t *);           /* missing */
739 #endif /* _XOPEN_SOURCE_EXTENDED */
740 extern int wborder(WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);   /* implemented */
741 #ifdef _XOPEN_SOURCE_EXTENDED
742 extern int wborder_set(WINDOW *,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t);       /* missing */
743 #endif /* _XOPEN_SOURCE_EXTENDED */
744 extern int wchgat(WINDOW *, int, attr_t, short, const void *);/* implemented */
745 extern int wclear(WINDOW *);                            /* implemented */
746 extern int wclrtobot(WINDOW *);                         /* implemented */
747 extern int wclrtoeol(WINDOW *);                         /* implemented */
748 extern void wcursyncup(WINDOW *);                       /* implemented */
749 extern int wdelch(WINDOW *);                            /* implemented */
750 extern int wdeleteln(WINDOW *);                         /* generated */
751 extern int wechochar(WINDOW *, const chtype);           /* implemented */
752 #ifdef _XOPEN_SOURCE_EXTENDED
753 extern int wecho_wchar(WINDOW *, const cchar_t *);      /* missing */
754 #endif /* _XOPEN_SOURCE_EXTENDED */
755 extern int werase(WINDOW *);                            /* implemented */
756 #ifdef _XOPEN_SOURCE_EXTENDED
757 extern int wgetbkgrnd(WINDOW *, cchar_t *);             /* missing */
758 #endif /* _XOPEN_SOURCE_EXTENDED */
759 extern int wgetch(WINDOW *);                            /* implemented */
760 extern int wgetnstr(WINDOW *,char *,int);               /* implemented */
761 #ifdef _XOPEN_SOURCE_EXTENDED
762 extern int wgetn_wstr(WINDOW *,wint_t *, int);          /* missing */
763 #endif /* _XOPEN_SOURCE_EXTENDED */
764 extern int wgetstr(WINDOW *, char *);                   /* generated */
765 #ifdef _XOPEN_SOURCE_EXTENDED
766 extern int wget_wch(WINDOW *, wint_t *);                /* missing */
767 extern int wget_wstr(WINDOW *, wint_t *);               /* missing */
768 #endif /* _XOPEN_SOURCE_EXTENDED */
769 extern int whline(WINDOW *, chtype, int);               /* implemented */
770 #ifdef _XOPEN_SOURCE_EXTENDED
771 extern int whline_set(WINDOW *, const cchar_t *, int);  /* missing */
772 #endif /* _XOPEN_SOURCE_EXTENDED */
773 extern chtype winch(WINDOW *);                          /* generated */
774 extern int winchnstr(WINDOW *, chtype *, int);          /* implemented */
775 extern int winchstr(WINDOW *, chtype *);                /* generated */
776 extern int winnstr(WINDOW *, char *, int);              /* implemented */
777 #ifdef _XOPEN_SOURCE_EXTENDED
778 extern int winnwstr(WINDOW *, wchar_t *, int);          /* missing */
779 #endif /* _XOPEN_SOURCE_EXTENDED */
780 extern int winsch(WINDOW *, chtype);                    /* implemented */
781 extern int winsdelln(WINDOW *,int);                     /* implemented */
782 extern int winsertln(WINDOW *);                         /* generated */
783 extern int winsnstr(WINDOW *, const char *,int);        /* implemented */
784 extern int winsstr(WINDOW *, const char *);             /* generated */
785 extern int winstr(WINDOW *, char *);                    /* generated */
786 #ifdef _XOPEN_SOURCE_EXTENDED
787 extern int wins_nwstr(WINDOW *, const wchar_t *, int);  /* missing */
788 extern int wins_wch(WINDOW *, const cchar_t *);         /* missing */
789 extern int wins_wstr(WINDOW *, const wchar_t *);        /* missing */
790 extern int winwstr(WINDOW *, wchar_t *);                /* missing */
791 extern int win_wch(WINDOW *, const cchar_t *);          /* missing */
792 extern int win_wchnstr(WINDOW *, const cchar_t *, int); /* missing */
793 extern int win_wchstr(WINDOW *, const cchar_t *);       /* missing */
794 #endif /* _XOPEN_SOURCE_EXTENDED */
795 extern int wmove(WINDOW *,int,int);                     /* implemented */
796 extern int wnoutrefresh(WINDOW *);                      /* implemented */
797 extern int wprintw(WINDOW *,const char *,...)           /* implemented */
798                 GCC_PRINTFLIKE(2,3);
799 extern int wredrawln(WINDOW *,int,int);                 /* implemented */
800 extern int wrefresh(WINDOW *);                          /* implemented */
801 extern int wscanw(WINDOW *,const char *,...)            /* implemented */
802                 GCC_SCANFLIKE(2,3);
803 extern int wscrl(WINDOW *,int);                         /* implemented */
804 extern int wsetscrreg(WINDOW *,int,int);                /* implemented */
805 extern int wstandout(WINDOW *);                         /* generated */
806 extern int wstandend(WINDOW *);                         /* generated */
807 extern void wsyncdown(WINDOW *);                        /* implemented */
808 extern void wsyncup(WINDOW *);                          /* implemented */
809 extern int wtimeout(WINDOW *,int);                      /* implemented */
810 extern int wtouchln(WINDOW *,int,int,int);              /* implemented */
811 #ifdef _XOPEN_SOURCE_EXTENDED
812 extern wchar_t wunctrl(cchar_t *);                      /* missing */
813 #endif /* _XOPEN_SOURCE_EXTENDED */
814 extern int wvline(WINDOW *,chtype,int);                 /* implemented */
815 #ifdef _XOPEN_SOURCE_EXTENDED
816 extern int wvline_set(WINDOW *, const cchar_t *, int);  /* missing */
817 #endif /* _XOPEN_SOURCE_EXTENDED */
818
819 /* attributes */
820 #define A_ATTRIBUTES    0xffffff00
821 #define A_NORMAL        0x00000000
822 #define A_STANDOUT      0x00010000
823 #define A_UNDERLINE     0x00020000
824 #define A_REVERSE       0x00040000
825 #define A_BLINK         0x00080000
826 #define A_DIM           0x00100000
827 #define A_BOLD          0x00200000
828 #define A_ALTCHARSET    0x00400000
829 #define A_INVIS         0x00800000
830 #define A_PROTECT       0x01000000
831 #define A_HORIZONTAL    0x02000000      /* XSI Curses attr -- not yet used */
832 #define A_LEFT          0x04000000      /* XSI Curses attr -- not yet used */
833 #define A_LOW           0x08000000      /* XSI Curses attr -- not yet used */
834 #define A_RIGHT         0x10000000      /* XSI Curses attr -- not yet used */
835 #define A_TOP           0x20000000      /* XSI Curses attr -- not yet used */
836 #define A_VERTICAL      0x40000000      /* XSI Curses attr -- not yet used */
837 #define A_CHARTEXT      0x000000ff
838 #define A_COLOR         0x0000ff00
839 #define COLOR_PAIR(n)   ((n) << 8)
840 #define PAIR_NUMBER(a)  (((a) & A_COLOR) >> 8)
841
842 /*
843  * pseudo functions
844  */
845 #define wgetstr(w, s)           wgetnstr(w, s, -1)
846 #define getnstr(s, n)           wgetnstr(stdscr, s, n)
847
848 #define setterm(term)           setupterm(term, 1, (int *)0)
849
850 #define fixterm()               reset_prog_mode()
851 #define resetterm()             reset_shell_mode()
852 #define saveterm()              def_prog_mode()
853 #define crmode()                cbreak()
854 #define nocrmode()              nocbreak()
855 #define gettmode()
856
857 #define getyx(win,y,x)          (y = (win)->_cury, x = (win)->_curx)
858 #define getbegyx(win,y,x)       (y = (win)->_begy, x = (win)->_begx)
859 #define getmaxyx(win,y,x)       (y = (win)->_maxy + 1, x = (win)->_maxx + 1)
860 #define getparyx(win,y,x)       (y = (win)->_pary, x = (win)->_parx)
861 #define getsyx(y,x)             getyx(stdscr, y, x)
862 #define setsyx(y,x)             (stdscr->_cury = y, stdscr->_curx = x)
863
864 #define wbkgdset(win, ch) \
865         (((win)->_attrs = (((win)->_attrs & ~((win)->_bkgd & A_ATTRIBUTES)) | \
866             ((ch) & A_ATTRIBUTES))), \
867             ((win)->_bkgd = (ch)))
868
869 /* It seems older SYSV curses versions define these */
870 #define getattrs(win)           ((win)->_attrs)
871 #define getmaxx(win)            ((win)->_maxx + 1)
872 #define getmaxy(win)            ((win)->_maxy + 1)
873
874 #define winch(win)              ((win)->_line[(win)->_cury].text[(win)->_curx])
875 #define wstandout(win)          (wattr_set(win,A_STANDOUT))
876 #define wstandend(win)          (wattr_set(win,A_NORMAL))
877 #define wattr_set(win,at)       ((win)->_attrs = (at))
878
879 #define wattron(win,at)         wattr_on(win, at)
880 #define wattroff(win,at)        wattr_off(win, at)
881 #define wattrset(win,at)        wattr_set(win, at)
882
883 #define scroll(win)             wscrl(win,1)
884
885 #define touchwin(win)           wtouchln((win), 0, (win)->_maxy + 1, 1)
886 #define touchline(win, s, c)    wtouchln((win), s, c, 1)
887 #define untouchwin(win)         wtouchln((win), 0, (win)->_maxy + 1, 0)
888
889 #define box(win, v, h)          wborder(win, v, v, h, h, 0, 0, 0, 0)
890 #define border(ls, rs, ts, bs, tl, tr, bl, br)  wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
891 #define hline(ch, n)            whline(stdscr, ch, n)
892 #define vline(ch, n)            wvline(stdscr, ch, n)
893
894 #define winstr(w, s)            winnstr(w, s, -1)
895 #define winchstr(w, s)          winchnstr(w, s, -1)
896 #define winsstr(w, s)           winsnstr(w, s, -1)
897
898 #define redrawwin(w)            wredrawln(w, 0, w->_maxy+1)
899 #define waddstr(win,str)        waddnstr(win,str,-1)
900 #define waddchstr(win,str)      waddchnstr(win,str,-1)
901
902 /*
903  * pseudo functions for standard screen
904  */
905
906 #define addch(ch)               waddch(stdscr,ch)
907 #define addchnstr(str,n)        waddchnstr(stdscr,str,n)
908 #define addchstr(str)           waddchstr(stdscr,str)
909 #define addnstr(str,n)          waddnstr(stdscr,str,n)
910 #define addstr(str)             waddnstr(stdscr,str,-1)
911 #define attroff(at)             wattroff(stdscr,at)
912 #define attron(at)              wattron(stdscr,at)
913 #define attrset(at)             wattrset(stdscr,at)
914 #define bkgd(ch)                wbkgd(stdscr,ch)
915 #define bkgdset(ch)             wbkgdset(stdscr,ch)
916 #define clear()                 wclear(stdscr)
917 #define clrtobot()              wclrtobot(stdscr)
918 #define clrtoeol()              wclrtoeol(stdscr)
919 #define delch()                 wdelch(stdscr)
920 #define deleteln()              winsdelln(stdscr,-1)
921 #define echochar(c)             wechochar(stdscr,c)
922 #define erase()                 werase(stdscr)
923 #define getch()                 wgetch(stdscr)
924 #define getstr(str)             wgetstr(stdscr,str)
925 #define inch()                  winch(stdscr)
926 #define inchnstr(s,n)           winchnstr(stdscr,s,n)
927 #define inchstr(s)              winchstr(stdscr,s)
928 #define innstr(s,n)             winnstr(stdscr,s,n)
929 #define insch(c)                winsch(stdscr,c)
930 #define insdelln(n)             winsdelln(stdscr,n)
931 #define insertln()              winsdelln(stdscr,1)
932 #define insnstr(s,n)            winsnstr(stdscr,s,n)
933 #define insstr(s)               winsstr(stdscr,s)
934 #define instr(s)                winstr(stdscr,s)
935 #define move(y,x)               wmove(stdscr,y,x)
936 #define refresh()               wrefresh(stdscr)
937 #define scrl(n)                 wscrl(stdscr,n)
938 #define setscrreg(t,b)          wsetscrreg(stdscr,t,b)
939 #define standend()              wstandend(stdscr)
940 #define standout()              wstandout(stdscr)
941 #define timeout(delay)          wtimeout(stdscr,delay)
942 #define wdeleteln(win)          winsdelln(win,-1)
943 #define winsertln(win)          winsdelln(win,1)
944
945 /*
946  * mv functions
947  */
948
949 #define mvwaddch(win,y,x,ch)            (wmove(win,y,x) == ERR ? ERR : waddch(win,ch))
950 #define mvwaddchnstr(win,y,x,str,n)     (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n))
951 #define mvwaddchstr(win,y,x,str)        (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1))
952 #define mvwaddnstr(win,y,x,str,n)       (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n))
953 #define mvwaddstr(win,y,x,str)          (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1))
954 #define mvwdelch(win,y,x)               (wmove(win,y,x) == ERR ? ERR : wdelch(win))
955 #define mvwgetch(win,y,x)               (wmove(win,y,x) == ERR ? ERR : wgetch(win))
956 #define mvwgetnstr(win,y,x,str,n)       (wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n))
957 #define mvwgetstr(win,y,x,str)          (wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))
958 #define mvwhline(win,y,x,c,n)           (wmove(win,y,x) == ERR ? ERR : whline(win,c,n))
959 #define mvwinch(win,y,x)                (wmove(win,y,x) == ERR ? (chtype)ERR : winch(win))
960 #define mvwinchnstr(win,y,x,s,n)        (wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n))
961 #define mvwinchstr(win,y,x,s)           (wmove(win,y,x) == ERR ? ERR : winchstr(win,s))
962 #define mvwinnstr(win,y,x,s,n)          (wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n))
963 #define mvwinsch(win,y,x,c)             (wmove(win,y,x) == ERR ? ERR : winsch(win,c))
964 #define mvwinsnstr(win,y,x,s,n)         (wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n))
965 #define mvwinsstr(win,y,x,s)            (wmove(win,y,x) == ERR ? ERR : winsstr(win,s))
966 #define mvwinstr(win,y,x,s)             (wmove(win,y,x) == ERR ? ERR : winstr(win,s))
967 #define mvwvline(win,y,x,c,n)           (wmove(win,y,x) == ERR ? ERR : wvline(win,c,n))
968
969 #define mvaddch(y,x,ch)                 mvwaddch(stdscr,y,x,ch)
970 #define mvaddchnstr(y,x,str,n)          mvwaddchnstr(stdscr,y,x,str,n)
971 #define mvaddchstr(y,x,str)             mvwaddchstr(stdscr,y,x,str)
972 #define mvaddnstr(y,x,str,n)            mvwaddnstr(stdscr,y,x,str,n)
973 #define mvaddstr(y,x,str)               mvwaddstr(stdscr,y,x,str)
974 #define mvdelch(y,x)                    mvwdelch(stdscr,y,x)
975 #define mvgetch(y,x)                    mvwgetch(stdscr,y,x)
976 #define mvgetnstr(y,x,str,n)            mvwgetnstr(stdscr,y,x,str,n)
977 #define mvgetstr(y,x,str)               mvwgetstr(stdscr,y,x,str)
978 #define mvhline(y,x,c,n)                mvwhline(stdscr,y,x,c,n)
979 #define mvinch(y,x)                     mvwinch(stdscr,y,x)
980 #define mvinchnstr(y,x,s,n)             mvwinchnstr(stdscr,y,x,s,n)
981 #define mvinchstr(y,x,s)                mvwinchstr(stdscr,y,x,s)
982 #define mvinnstr(y,x,s,n)               mvwinnstr(stdscr,y,x,s,n)
983 #define mvinsch(y,x,c)                  mvwinsch(stdscr,y,x,c)
984 #define mvinsnstr(y,x,s,n)              mvwinsnstr(stdscr,y,x,s,n)
985 #define mvinsstr(y,x,s)                 mvwinsstr(stdscr,y,x,s)
986 #define mvinstr(y,x,s)                  mvwinstr(stdscr,y,x,s)
987 #define mvvline(y,x,c,n)                mvwvline(stdscr,y,x,c,n)
988
989 /*
990  * XSI curses macros for XPG4 conformance.
991  * The underlying functions needed to make these work are:
992  * waddnwstr(), waddchnwstr(), wadd_wch(), wborder_set(), wchgat(),
993  * wecho_wchar(), wgetn_wstr(), wget_wch(), whline_set(), vhline_set(),
994  * winnwstr(), wins_nwstr(), wins_wch(), win_wch(), win_wchnstr().
995  * Except for wchgat(), these are not yet implemented.  They will be someday.
996  */
997 #define add_wch(c)                      wadd_wch(stsdscr,c)
998 #define addnwstr(wstr,n)                waddnwstr(stdscr,wstr,n)
999 #define addwstr(wstr,n)                 waddnwstr(stdscr,wstr,-1)
1000 #define attr_get()                      wattr_get(stdscr)
1001 #define attr_off(a)                     wattr_off(stdscr,a)
1002 #define attr_on(a)                      wattr_on(stdscr,a)
1003 #define attr_set(a)                     wattr_set(stdscr,a)
1004 #define box_set(w,v,h)                  wborder_set(w,v,v,h,h,0,0,0,9)
1005 #define chgat(n,a,c,o)                  wchgat(stdscr,n,a,c,o)
1006 #define echo_wchar(c)                   wecho_wchar(stdscr,c)
1007 #define getbkgd(win)                    ((win)->_bkgd)
1008 #define get_wch(c)                      wget_wch(stdscr,c)
1009 #define get_wstr(t)                     wgetn_wstr(stdscr,t,-1)
1010 #define getn_wstr(t,n)                  wgetn_wstr(stdscr,t,n)
1011 #define hline_set(c,n)                  whline_set(stdscr,c,n)
1012 #define in_wch(c)                       win_wch(stdscr,c)
1013 #define in_wchnstr(c,n)                 win_wchnstr(stdscr,c,n)
1014 #define in_wchstr(c)                    win_wchnstr(stdscr,c,-1)
1015 #define innwstr(c,n)                    winnwstr(stdscr,c,n)
1016 #define ins_nwstr(t,n)                  wins_nwstr(stdscr,t,n)
1017 #define ins_wch(c)                      wins_wch(stdscr,c)
1018 #define ins_wstr(t)                     wins_nwstr(stdscr,t,-1)
1019 #define inwstr(c)                       winnwstr(stdscr,c,-1)
1020
1021 #define mvadd_wch(y,x,c)                mvwadd_wch(stdscr,y,x,c)
1022 #define mvaddnwstr(y,x,wstr,n)          mvwaddnwstr(stdscr,y,x,wstr,n)
1023 #define mvaddwstr(y,x,wstr,n)           mvwaddnwstr(stdscr,y,x,wstr,-1)
1024 #define mvchgat(y,x,n,a,c,o)            mvwchgat(stdscr,y,x,n,a,c,o)
1025 #define mvget_wch(y,x,c)                mvwget_wch(stdscr,y,x,c)
1026 #define mvget_wstr(y,x,t)               mvwgetn_wstr(stdscr,y,x,t,-1)
1027 #define mvgetn_wstr(y,x,t,n)            mvwgetn_wstr(stdscr,y,x,t,n)
1028 #define mvhline_set(y,x,c,n)            mvwhline_set(stdscr,y,x,c,n)
1029 #define mvin_wch(y,x,c)                 mvwin_wch(stdscr,y,x,c)
1030 #define mvin_wchnstr(y,x,c,n)           mvwin_wchnstr(stdscr,y,x,c,n)
1031 #define mvin_wchstr(y,x,c)              mvwin_wchnstr(stdscr,y,x,c,-1)
1032 #define mvinnwstr(y,x,c,n)              mvwinnwstr(stdscr,y,x,c,n)
1033 #define mvins_nwstr(y,x,t,n)            mvwins_nwstr(stdscr,y,x,t,n)
1034 #define mvins_wch(y,x,c)                mvwins_wch(stdscr,y,x,c)
1035 #define mvins_wstr(y,x,t)               mvwins_nwstr(stdscr,y,x,t,-1)
1036 #define mvinwstr(y,x,c)                 mvwinnwstr(stdscr,y,x,c,-1)
1037 #define mvvline_set(y,x,c,n)            mvwvline_set(stdscr,y,x,c,n)
1038
1039 #define mvwadd_wch(y,x,win,c)           (wmove(win,y,x) == ERR ? ERR : wadd_wch(stsdscr,c))
1040 #define mvwaddnwstr(y,x,win,wstr,n)     (wmove(win,y,x) == ERR ? ERR : waddnwstr(stdscr,wstr,n))
1041 #define mvwaddwstr(y,x,win,wstr,n)      (wmove(win,y,x) == ERR ? ERR : waddnwstr(stdscr,wstr,-1))
1042 #define mvwchgat(win,y,x,n,a,c,o)       (wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o))
1043 #define mvwget_wch(win,y,x,c)           (wmove(win,y,x) == ERR ? ERR : wget_wch(win,n))
1044 #define mvwget_wstr(win,y,x,t)          (wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,-1))
1045 #define mvwgetn_wstr(win,y,x,t,n)       (wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,n))
1046 #define mvwhline_set(win,y,x,c,n)       (wmove(win,y,x) == ERR ? ERR : whline_set(win,c,n))
1047 #define mvwin_wch(win,y,x,c)            (wmove(win,y,x) == ERR ? ERR : win_wch(win,c))
1048 #define mvwin_wchnstr(win,y,x,c,n)      (wmove(win,y,x) == ERR ? ERR : win_wchnstr(stdscr,c,n))
1049 #define mvwin_wchstr(win,y,x,c)         (wmove(win,y,x) == ERR ? ERR : win_wchnstr(stdscr,c,-1))
1050 #define mvwinnwstr(win,y,x,c,n)         (wmove(win,y,x) == ERR ? ERR : winnwstr(stdscr,c,n))
1051 #define mvwins_nwstr(win,y,x,t,n)       (wmove(win,y,x) == ERR ? ERR : wins_nwstr(stdscr,t,n))
1052 #define mvwins_wch(win,y,x,c)           (wmove(win,y,x) == ERR ? ERR : wins_wch(c))
1053 #define mvwins_wstr(win,y,x,t)          (wmove(win,y,x) == ERR ? ERR : wins_nwstr(stdscr,t,-1))
1054 #define mvwinwstr(win,y,x,c)            (wmove(win,y,x) == ERR ? ERR : winnwstr(stdscr,c,-1))
1055 #define mvwvline_set(win,y,x,c,n)       (wmove(win,y,x) == ERR ? ERR : wvline_set(win,c,n))
1056
1057 #define vline_set(c,n)                  vhline_set(stdscr,c,n)
1058 #define waddwstr(win,wstr,n)            waddnwstr(win,wstr,-1)
1059 #define wattr_get(win)                  ((win)->_attrs)
1060 #define wget_wstr(w,t)                  wgetn_wstr(w,t,-1)
1061 #define win_wchstr(w,c)                 win_wchnstr(w,c,-1)
1062 #define wins_wstr(w,t)                  wins_nwstr(w,t,-1)
1063 #define winwstr(w,c)                    winnwstr(w,c,-1)
1064
1065
1066 /*
1067  * XSI curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use
1068  * varargs.h.  It adds new calls vw_printw/vw_scanw, which are supposed to
1069  * use POSIX stdarg.h.  The ncurses versions of vwprintw/vwscanw already
1070  * use stdarg.h, so...
1071  */
1072 #define vw_printw               vwprintw
1073 #define vw_scanw                vwscanw
1074
1075 /*
1076  * Pseudo-character tokens outside ASCII range.  The curses wgetch() function
1077  * will return any given one of these only if the corresponding k- capability
1078  * is defined in your terminal's terminfo entry.
1079  */
1080 #define KEY_CODE_YES    0400            /* A wchar_t contains a key code */
1081 #define KEY_MIN         0401            /* Minimum curses key */
1082 #define KEY_BREAK       0401            /* Break key (unreliable) */
1083 #define KEY_DOWN        0402            /* Down-arrow */
1084 #define KEY_UP          0403            /* Up-arrow */
1085 #define KEY_LEFT        0404            /* Left-arrow */
1086 #define KEY_RIGHT       0405            /* Right-arrow */
1087 #define KEY_HOME        0406            /* Home key (upward+left arrow) */
1088 #define KEY_BACKSPACE   0407            /* Backspace (unreliable) */
1089 #define KEY_F0          0410            /* Function keys.  Space for 64 */
1090 #define KEY_F(n)        (KEY_F0+(n))    /* Value of function key n */
1091 #define KEY_DL          0510            /* Delete line */
1092 #define KEY_IL          0511            /* Insert line */
1093 #define KEY_DC          0512            /* Delete character */
1094 #define KEY_IC          0513            /* Insert char or enter insert mode */
1095 #define KEY_EIC         0514            /* Exit insert char mode */
1096 #define KEY_CLEAR       0515            /* Clear screen */
1097 #define KEY_EOS         0516            /* Clear to end of screen */
1098 #define KEY_EOL         0517            /* Clear to end of line */
1099 #define KEY_SF          0520            /* Scroll 1 line forward */
1100 #define KEY_SR          0521            /* Scroll 1 line backward (reverse) */
1101 #define KEY_NPAGE       0522            /* Next page */
1102 #define KEY_PPAGE       0523            /* Previous page */
1103 #define KEY_STAB        0524            /* Set tab */
1104 #define KEY_CTAB        0525            /* Clear tab */
1105 #define KEY_CATAB       0526            /* Clear all tabs */
1106 #define KEY_ENTER       0527            /* Enter or send (unreliable) */
1107 #define KEY_SRESET      0530            /* Soft (partial) reset (unreliable) */
1108 #define KEY_RESET       0531            /* Reset or hard reset (unreliable) */
1109 #define KEY_PRINT       0532            /* Print */
1110 #define KEY_LL          0533            /* Home down or bottom (lower left) */
1111
1112 /* The keypad is arranged like this: */
1113 /* a1    up    a3   */
1114 /* left   b2  right  */
1115 /* c1   down   c3   */
1116
1117 #define KEY_A1          0534            /* Upper left of keypad */
1118 #define KEY_A3          0535            /* Upper right of keypad */
1119 #define KEY_B2          0536            /* Center of keypad */
1120 #define KEY_C1          0537            /* Lower left of keypad */
1121 #define KEY_C3          0540            /* Lower right of keypad */
1122 #define KEY_BTAB        0541            /* Back tab */
1123 #define KEY_BEG         0542            /* Beg (beginning) */
1124 #define KEY_CANCEL      0543            /* Cancel */
1125 #define KEY_CLOSE       0544            /* Close */
1126 #define KEY_COMMAND     0545            /* Cmd (command) */
1127 #define KEY_COPY        0546            /* Copy */
1128 #define KEY_CREATE      0547            /* Create */
1129 #define KEY_END         0550            /* End */
1130 #define KEY_EXIT        0551            /* Exit */
1131 #define KEY_FIND        0552            /* Find */
1132 #define KEY_HELP        0553            /* Help */
1133 #define KEY_MARK        0554            /* Mark */
1134 #define KEY_MESSAGE     0555            /* Message */
1135 #define KEY_MOVE        0556            /* Move */
1136 #define KEY_NEXT        0557            /* Next */
1137 #define KEY_OPEN        0560            /* Open */
1138 #define KEY_OPTIONS     0561            /* Options */
1139 #define KEY_PREVIOUS    0562            /* Prev (previous) */
1140 #define KEY_REDO        0563            /* Redo */
1141 #define KEY_REFERENCE   0564            /* Ref (reference) */
1142 #define KEY_REFRESH     0565            /* Refresh */
1143 #define KEY_REPLACE     0566            /* Replace */
1144 #define KEY_RESTART     0567            /* Restart */
1145 #define KEY_RESUME      0570            /* Resume */
1146 #define KEY_SAVE        0571            /* Save */
1147 #define KEY_SBEG        0572            /* Shifted Beg (beginning) */
1148 #define KEY_SCANCEL     0573            /* Shifted Cancel */
1149 #define KEY_SCOMMAND    0574            /* Shifted Command */
1150 #define KEY_SCOPY       0575            /* Shifted Copy */
1151 #define KEY_SCREATE     0576            /* Shifted Create */
1152 #define KEY_SDC         0577            /* Shifted Delete char */
1153 #define KEY_SDL         0600            /* Shifted Delete line */
1154 #define KEY_SELECT      0601            /* Select */
1155 #define KEY_SEND        0602            /* Shifted End */
1156 #define KEY_SEOL        0603            /* Shifted Clear line */
1157 #define KEY_SEXIT       0604            /* Shifted Dxit */
1158 #define KEY_SFIND       0605            /* Shifted Find */
1159 #define KEY_SHELP       0606            /* Shifted Help */
1160 #define KEY_SHOME       0607            /* Shifted Home */
1161 #define KEY_SIC         0610            /* Shifted Input */
1162 #define KEY_SLEFT       0611            /* Shifted Left arrow */
1163 #define KEY_SMESSAGE    0612            /* Shifted Message */
1164 #define KEY_SMOVE       0613            /* Shifted Move */
1165 #define KEY_SNEXT       0614            /* Shifted Next */
1166 #define KEY_SOPTIONS    0615            /* Shifted Options */
1167 #define KEY_SPREVIOUS   0616            /* Shifted Prev */
1168 #define KEY_SPRINT      0617            /* Shifted Print */
1169 #define KEY_SREDO       0620            /* Shifted Redo */
1170 #define KEY_SREPLACE    0621            /* Shifted Replace */
1171 #define KEY_SRIGHT      0622            /* Shifted Right arrow */
1172 #define KEY_SRSUME      0623            /* Shifted Resume */
1173 #define KEY_SSAVE       0624            /* Shifted Save */
1174 #define KEY_SSUSPEND    0625            /* Shifted Suspend */
1175 #define KEY_SUNDO       0626            /* Shifted Undo */
1176 #define KEY_SUSPEND     0627            /* Suspend */
1177 #define KEY_UNDO        0630            /* Undo */
1178 #define KEY_MOUSE       0631            /* Mouse event has occurred */
1179 #define KEY_MAX         0777            /* Maximum key value */
1180
1181 /* mouse interface */
1182 #define NCURSES_MOUSE_VERSION   1
1183
1184 /* event masks */
1185 #define BUTTON1_RELEASED        000000000001L
1186 #define BUTTON1_PRESSED         000000000002L
1187 #define BUTTON1_CLICKED         000000000004L
1188 #define BUTTON1_DOUBLE_CLICKED  000000000010L
1189 #define BUTTON1_TRIPLE_CLICKED  000000000020L
1190 #define BUTTON1_RESERVED_EVENT  000000000040L
1191 #define BUTTON2_RELEASED        000000000100L
1192 #define BUTTON2_PRESSED         000000000200L
1193 #define BUTTON2_CLICKED         000000000400L
1194 #define BUTTON2_DOUBLE_CLICKED  000000001000L
1195 #define BUTTON2_TRIPLE_CLICKED  000000002000L
1196 #define BUTTON2_RESERVED_EVENT  000000004000L
1197 #define BUTTON3_RELEASED        000000010000L
1198 #define BUTTON3_PRESSED         000000020000L
1199 #define BUTTON3_CLICKED         000000040000L
1200 #define BUTTON3_DOUBLE_CLICKED  000000100000L
1201 #define BUTTON3_TRIPLE_CLICKED  000000200000L
1202 #define BUTTON3_RESERVED_EVENT  000000400000L
1203 #define BUTTON4_RELEASED        000001000000L
1204 #define BUTTON4_PRESSED         000002000000L
1205 #define BUTTON4_CLICKED         000004000000L
1206 #define BUTTON4_DOUBLE_CLICKED  000010000000L
1207 #define BUTTON4_TRIPLE_CLICKED  000020000000L
1208 #define BUTTON4_RESERVED_EVENT  000040000000L
1209 #define BUTTON_CTRL             000100000000L
1210 #define BUTTON_SHIFT            000200000000L
1211 #define BUTTON_ALT              000400000000L
1212 #define ALL_MOUSE_EVENTS        000777777777L
1213 #define REPORT_MOUSE_POSITION   001000000000L
1214
1215 /* macros to extract single event-bits from masks */
1216 #define BUTTON_RELEASE(e, x)            ((e) & (001 << (6 * ((x) - 1))))
1217 #define BUTTON_PRESS(e, x)              ((e) & (002 << (6 * ((x) - 1))))
1218 #define BUTTON_CLICK(e, x)              ((e) & (004 << (6 * ((x) - 1))))
1219 #define BUTTON_DOUBLE_CLICK(e, x)       ((e) & (010 << (6 * ((x) - 1))))
1220 #define BUTTON_TRIPLE_CLICK(e, x)       ((e) & (020 << (6 * ((x) - 1))))
1221 #define BUTTON_RESERVED_EVENT(e, x)     ((e) & (040 << (6 * ((x) - 1))))
1222
1223 typedef unsigned long mmask_t;
1224
1225 typedef struct
1226 {
1227     short id;           /* ID to distinguish multiple devices */
1228     int x, y, z;        /* event coordinates (character-cell) */
1229     mmask_t bstate;     /* button state bits */
1230 }
1231 MEVENT;
1232
1233 extern int getmouse(MEVENT *);
1234 extern int ungetmouse(MEVENT *);
1235 extern mmask_t mousemask(mmask_t, mmask_t *);
1236 extern bool wenclose(WINDOW *, int, int);
1237 extern int mouseinterval(int);
1238
1239 /* other non-XSI functions */
1240
1241 extern int mcprint(char *, int);        /* direct data to printer */
1242 extern int has_key(int);                /* do we have given key? */
1243
1244 /* Debugging : use with libncurses_g.a */
1245
1246 extern void _tracef(const char *, ...) GCC_PRINTFLIKE(1,2);
1247 extern void _tracedump(const char *, WINDOW *);
1248 extern char *_traceattr(attr_t);
1249 extern char *_traceattr2(int, chtype);
1250 extern char *_tracebits(void);
1251 extern char *_tracechar(const unsigned char);
1252 extern char *_tracechtype(chtype);
1253 extern char *_tracechtype2(int, chtype);
1254 extern char *_tracemouse(const MEVENT *);
1255 extern void trace(const unsigned int);
1256
1257 /* trace masks */
1258 #define TRACE_DISABLE   0x0000  /* turn off tracing */
1259 #define TRACE_TIMES     0x0001  /* trace user and system times of updates */
1260 #define TRACE_TPUTS     0x0002  /* trace tputs calls */
1261 #define TRACE_UPDATE    0x0004  /* trace update actions, old & new screens */
1262 #define TRACE_MOVE      0x0008  /* trace cursor moves and scrolls */
1263 #define TRACE_CHARPUT   0x0010  /* trace all character outputs */
1264 #define TRACE_ORDINARY  0x001F  /* trace all update actions */
1265 #define TRACE_CALLS     0x0020  /* trace all curses calls */
1266 #define TRACE_VIRTPUT   0x0040  /* trace virtual character puts */
1267 #define TRACE_IEVENT    0x0080  /* trace low-level input processing */
1268 #define TRACE_BITS      0x0100  /* trace state of TTY control bits */
1269 #define TRACE_ICALLS    0x0200  /* trace internal/nested calls */
1270 #define TRACE_CCALLS    0x0400  /* trace per-character calls */
1271 #define TRACE_MAXIMUM   0xffff  /* maximum trace level */
1272
1273 #if defined(TRACE) || defined(NCURSES_TEST)
1274 extern int _nc_optimize_enable;         /* enable optimizations */
1275 #define OPTIMIZE_MVCUR          0x01    /* cursor movement optimization */
1276 #define OPTIMIZE_HASHMAP        0x02    /* diff hashing to detect scrolls */
1277 #define OPTIMIZE_SCROLL         0x04    /* scroll optimization */
1278 #define OPTIMIZE_ALL            0xff    /* enable all optimizations (dflt) */
1279 #endif
1280
1281 #ifdef __cplusplus
1282 }
1283 #endif
1284
1285 #endif /* __NCURSES_H */