# Install bcftools, its manpage, bcf-fix.pl, vcfutils.pl, and new examples.
[samtools.git] / win32 / xcurses.h
1 /* Public Domain Curses */
2
3 /* $Id: curses.h,v 1.295 2008/07/15 17:13:25 wmcbrine Exp $ */
4
5 /*----------------------------------------------------------------------*
6  *                              PDCurses                                *
7  *----------------------------------------------------------------------*/
8
9 #ifndef __PDCURSES__
10 #define __PDCURSES__ 1
11
12 /*man-start**************************************************************
13
14 PDCurses definitions list:  (Only define those needed)
15
16     XCURSES         True if compiling for X11.
17     PDC_RGB         True if you want to use RGB color definitions
18                     (Red = 1, Green = 2, Blue = 4) instead of BGR.
19     PDC_WIDE        True if building wide-character support.
20     PDC_DLL_BUILD   True if building a Win32 DLL.
21     NCURSES_MOUSE_VERSION   Use the ncurses mouse API instead
22                             of PDCurses' traditional mouse API.
23
24 PDCurses portable platform definitions list:
25
26     PDC_BUILD       Defines API build version.
27     PDCURSES        Enables access to PDCurses-only routines.
28     XOPEN           Always true.
29     SYSVcurses      True if you are compiling for SYSV portability.
30     BSDcurses       True if you are compiling for BSD portability.
31
32 **man-end****************************************************************/
33
34 #define PDC_BUILD 3401
35 #define PDCURSES        1      /* PDCurses-only routines */
36 #define XOPEN           1      /* X/Open Curses routines */
37 #define SYSVcurses      1      /* System V Curses routines */
38 #define BSDcurses       1      /* BSD Curses routines */
39 #define CHTYPE_LONG     1      /* size of chtype; long */
40
41 /*----------------------------------------------------------------------*/
42
43 #include <stdarg.h>
44 #include <stddef.h>
45 #include <stdio.h>             /* Required by X/Open usage below */
46
47 #ifdef PDC_WIDE
48 # include <wchar.h>
49 #endif
50
51 #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS)
52 extern "C"
53 {
54 # define bool _bool
55 #endif
56
57 /*----------------------------------------------------------------------
58  *
59  *  PDCurses Manifest Constants
60  *
61  */
62
63 #ifndef FALSE
64 # define FALSE 0
65 #endif
66 #ifndef TRUE
67 # define TRUE 1
68 #endif
69 #ifndef NULL
70 # define NULL (void *)0
71 #endif
72 #ifndef ERR
73 # define ERR (-1)
74 #endif
75 #ifndef OK
76 # define OK 0
77 #endif
78
79 /*----------------------------------------------------------------------
80  *
81  *  PDCurses Type Declarations
82  *
83  */
84
85 typedef unsigned char bool;    /* PDCurses Boolean type */
86
87 #ifdef CHTYPE_LONG
88 # if _LP64
89 typedef unsigned int chtype;
90 # else
91 typedef unsigned long chtype;  /* 16-bit attr + 16-bit char */
92 # endif
93 #else
94 typedef unsigned short chtype; /* 8-bit attr + 8-bit char */
95 #endif
96
97 #ifdef PDC_WIDE
98 typedef chtype cchar_t;
99 #endif
100
101 typedef chtype attr_t;
102
103 /*----------------------------------------------------------------------
104  *
105  *  PDCurses Mouse Interface -- SYSVR4, with extensions
106  *
107  */
108
109 typedef struct
110 {
111     int x;           /* absolute column, 0 based, measured in characters */
112     int y;           /* absolute row, 0 based, measured in characters */
113     short button[3]; /* state of each button */
114     int changes;     /* flags indicating what has changed with the mouse */
115 } MOUSE_STATUS;
116
117 #define BUTTON_RELEASED         0x0000
118 #define BUTTON_PRESSED          0x0001
119 #define BUTTON_CLICKED          0x0002
120 #define BUTTON_DOUBLE_CLICKED   0x0003
121 #define BUTTON_TRIPLE_CLICKED   0x0004
122 #define BUTTON_MOVED            0x0005  /* PDCurses */
123 #define WHEEL_SCROLLED          0x0006  /* PDCurses */
124 #define BUTTON_ACTION_MASK      0x0007  /* PDCurses */
125
126 #define PDC_BUTTON_SHIFT        0x0008  /* PDCurses */
127 #define PDC_BUTTON_CONTROL      0x0010  /* PDCurses */
128 #define PDC_BUTTON_ALT          0x0020  /* PDCurses */
129 #define BUTTON_MODIFIER_MASK    0x0038  /* PDCurses */
130
131 #define MOUSE_X_POS             (Mouse_status.x)
132 #define MOUSE_Y_POS             (Mouse_status.y)
133
134 /*
135  * Bits associated with the .changes field:
136  *   3         2         1         0
137  * 210987654321098765432109876543210
138  *                                 1 <- button 1 has changed
139  *                                10 <- button 2 has changed
140  *                               100 <- button 3 has changed
141  *                              1000 <- mouse has moved
142  *                             10000 <- mouse position report
143  *                            100000 <- mouse wheel up
144  *                           1000000 <- mouse wheel down
145  */
146
147 #define PDC_MOUSE_MOVED         0x0008
148 #define PDC_MOUSE_POSITION      0x0010
149 #define PDC_MOUSE_WHEEL_UP      0x0020
150 #define PDC_MOUSE_WHEEL_DOWN    0x0040
151
152 #define A_BUTTON_CHANGED        (Mouse_status.changes & 7)
153 #define MOUSE_MOVED             (Mouse_status.changes & PDC_MOUSE_MOVED)
154 #define MOUSE_POS_REPORT        (Mouse_status.changes & PDC_MOUSE_POSITION)
155 #define BUTTON_CHANGED(x)       (Mouse_status.changes & (1 << ((x) - 1)))
156 #define BUTTON_STATUS(x)        (Mouse_status.button[(x) - 1])
157 #define MOUSE_WHEEL_UP          (Mouse_status.changes & PDC_MOUSE_WHEEL_UP)
158 #define MOUSE_WHEEL_DOWN        (Mouse_status.changes & PDC_MOUSE_WHEEL_DOWN)
159
160 /* mouse bit-masks */
161
162 #define BUTTON1_RELEASED        0x00000001L
163 #define BUTTON1_PRESSED         0x00000002L
164 #define BUTTON1_CLICKED         0x00000004L
165 #define BUTTON1_DOUBLE_CLICKED  0x00000008L
166 #define BUTTON1_TRIPLE_CLICKED  0x00000010L
167 #define BUTTON1_MOVED           0x00000010L /* PDCurses */
168
169 #define BUTTON2_RELEASED        0x00000020L
170 #define BUTTON2_PRESSED         0x00000040L
171 #define BUTTON2_CLICKED         0x00000080L
172 #define BUTTON2_DOUBLE_CLICKED  0x00000100L
173 #define BUTTON2_TRIPLE_CLICKED  0x00000200L
174 #define BUTTON2_MOVED           0x00000200L /* PDCurses */
175
176 #define BUTTON3_RELEASED        0x00000400L
177 #define BUTTON3_PRESSED         0x00000800L
178 #define BUTTON3_CLICKED         0x00001000L
179 #define BUTTON3_DOUBLE_CLICKED  0x00002000L
180 #define BUTTON3_TRIPLE_CLICKED  0x00004000L
181 #define BUTTON3_MOVED           0x00004000L /* PDCurses */
182
183 /* For the ncurses-compatible functions only, BUTTON4_PRESSED and 
184    BUTTON5_PRESSED are returned for mouse scroll wheel up and down; 
185    otherwise PDCurses doesn't support buttons 4 and 5 */
186
187 #define BUTTON4_RELEASED        0x00008000L
188 #define BUTTON4_PRESSED         0x00010000L
189 #define BUTTON4_CLICKED         0x00020000L
190 #define BUTTON4_DOUBLE_CLICKED  0x00040000L
191 #define BUTTON4_TRIPLE_CLICKED  0x00080000L
192
193 #define BUTTON5_RELEASED        0x00100000L
194 #define BUTTON5_PRESSED         0x00200000L
195 #define BUTTON5_CLICKED         0x00400000L
196 #define BUTTON5_DOUBLE_CLICKED  0x00800000L
197 #define BUTTON5_TRIPLE_CLICKED  0x01000000L
198
199 #define MOUSE_WHEEL_SCROLL      0x02000000L /* PDCurses */
200 #define BUTTON_MODIFIER_SHIFT   0x04000000L /* PDCurses */
201 #define BUTTON_MODIFIER_CONTROL 0x08000000L /* PDCurses */
202 #define BUTTON_MODIFIER_ALT     0x10000000L /* PDCurses */
203
204 #define ALL_MOUSE_EVENTS        0x1fffffffL
205 #define REPORT_MOUSE_POSITION   0x20000000L
206
207 /* ncurses mouse interface */
208
209 typedef unsigned long mmask_t;
210
211 typedef struct
212 {
213         short id;       /* unused, always 0 */
214         int x, y, z;    /* x, y same as MOUSE_STATUS; z unused */
215         mmask_t bstate; /* equivalent to changes + button[], but
216                            in the same format as used for mousemask() */
217 } MEVENT;
218
219 #ifdef NCURSES_MOUSE_VERSION
220 # define BUTTON_SHIFT   BUTTON_MODIFIER_SHIFT
221 # define BUTTON_CONTROL BUTTON_MODIFIER_CONTROL
222 # define BUTTON_CTRL    BUTTON_MODIFIER_CONTROL
223 # define BUTTON_ALT     BUTTON_MODIFIER_ALT
224 #else
225 # define BUTTON_SHIFT   PDC_BUTTON_SHIFT
226 # define BUTTON_CONTROL PDC_BUTTON_CONTROL
227 # define BUTTON_ALT     PDC_BUTTON_ALT
228 #endif
229
230 /*----------------------------------------------------------------------
231  *
232  *  PDCurses Structure Definitions
233  *
234  */
235
236 typedef struct _win       /* definition of a window */
237 {
238     int   _cury;          /* current pseudo-cursor */
239     int   _curx;
240     int   _maxy;          /* max window coordinates */
241     int   _maxx;
242     int   _begy;          /* origin on screen */
243     int   _begx;
244     int   _flags;         /* window properties */
245     chtype _attrs;        /* standard attributes and colors */
246     chtype _bkgd;         /* background, normally blank */
247     bool  _clear;         /* causes clear at next refresh */
248     bool  _leaveit;       /* leaves cursor where it is */
249     bool  _scroll;        /* allows window scrolling */
250     bool  _nodelay;       /* input character wait flag */
251     bool  _immed;         /* immediate update flag */
252     bool  _sync;          /* synchronise window ancestors */
253     bool  _use_keypad;    /* flags keypad key mode active */
254     chtype **_y;          /* pointer to line pointer array */
255     int   *_firstch;      /* first changed character in line */
256     int   *_lastch;       /* last changed character in line */
257     int   _tmarg;         /* top of scrolling region */
258     int   _bmarg;         /* bottom of scrolling region */
259     int   _delayms;       /* milliseconds of delay for getch() */
260     int   _parx, _pary;   /* coords relative to parent (0,0) */
261     struct _win *_parent; /* subwin's pointer to parent win */
262 } WINDOW;
263
264 /* Avoid using the SCREEN struct directly -- use the corresponding 
265    functions if possible. This struct may eventually be made private. */
266
267 typedef struct
268 {
269     bool  alive;          /* if initscr() called, and not endwin() */
270     bool  autocr;         /* if cr -> lf */
271     bool  cbreak;         /* if terminal unbuffered */
272     bool  echo;           /* if terminal echo */
273     bool  raw_inp;        /* raw input mode (v. cooked input) */
274     bool  raw_out;        /* raw output mode (7 v. 8 bits) */
275     bool  audible;        /* FALSE if the bell is visual */
276     bool  mono;           /* TRUE if current screen is mono */
277     bool  resized;        /* TRUE if TERM has been resized */
278     bool  orig_attr;      /* TRUE if we have the original colors */
279     short orig_fore;      /* original screen foreground color */
280     short orig_back;      /* original screen foreground color */
281     int   cursrow;        /* position of physical cursor */
282     int   curscol;        /* position of physical cursor */
283     int   visibility;     /* visibility of cursor */
284     int   orig_cursor;    /* original cursor size */
285     int   lines;          /* new value for LINES */
286     int   cols;           /* new value for COLS */
287     unsigned long _trap_mbe;       /* trap these mouse button events */
288     unsigned long _map_mbe_to_key; /* map mouse buttons to slk */
289     int   mouse_wait;              /* time to wait (in ms) for a
290                                       button release after a press, in 
291                                       order to count it as a click */
292     int   slklines;                /* lines in use by slk_init() */
293     WINDOW *slk_winptr;            /* window for slk */
294     int   linesrippedoff;          /* lines ripped off via ripoffline() */
295     int   linesrippedoffontop;     /* lines ripped off on 
296                                       top via ripoffline() */
297     int   delaytenths;             /* 1/10ths second to wait block
298                                       getch() for */
299     bool  _preserve;               /* TRUE if screen background
300                                       to be preserved */
301     int   _restore;                /* specifies if screen background
302                                       to be restored, and how */
303     bool  save_key_modifiers;      /* TRUE if each key modifiers saved
304                                       with each key press */
305     bool  return_key_modifiers;    /* TRUE if modifier keys are
306                                       returned as "real" keys */
307     bool  key_code;                /* TRUE if last key is a special key;
308                                       used internally by get_wch() */
309 #ifdef XCURSES
310     int   XcurscrSize;    /* size of Xcurscr shared memory block */
311     bool  sb_on;
312     int   sb_viewport_y;
313     int   sb_viewport_x;
314     int   sb_total_y;
315     int   sb_total_x;
316     int   sb_cur_y;
317     int   sb_cur_x;
318 #endif
319     short line_color;     /* color of line attributes - default -1 */
320 } SCREEN;
321
322 /*----------------------------------------------------------------------
323  *
324  *  PDCurses External Variables
325  *
326  */
327
328 #ifdef PDC_DLL_BUILD
329 # ifdef CURSES_LIBRARY
330 #  define PDCEX __declspec(dllexport) extern
331 # else
332 #  define PDCEX __declspec(dllimport)
333 # endif
334 #else
335 # define PDCEX extern
336 #endif
337
338 PDCEX  int          LINES;        /* terminal height */
339 PDCEX  int          COLS;         /* terminal width */
340 PDCEX  WINDOW       *stdscr;      /* the default screen window */
341 PDCEX  WINDOW       *curscr;      /* the current screen image */
342 PDCEX  SCREEN       *SP;          /* curses variables */
343 PDCEX  MOUSE_STATUS Mouse_status;
344 PDCEX  int          COLORS;
345 PDCEX  int          COLOR_PAIRS;
346 PDCEX  int          TABSIZE;
347 PDCEX  chtype       acs_map[];    /* alternate character set map */
348 PDCEX  char         ttytype[];    /* terminal name/description */
349
350 /*man-start**************************************************************
351
352 PDCurses Text Attributes
353 ========================
354
355 Originally, PDCurses used a short (16 bits) for its chtype. To include 
356 color, a number of things had to be sacrificed from the strict Unix and 
357 System V support. The main problem was fitting all character attributes 
358 and color into an unsigned char (all 8 bits!).
359
360 Today, PDCurses by default uses a long (32 bits) for its chtype, as in 
361 System V. The short chtype is still available, by undefining CHTYPE_LONG 
362 and rebuilding the library.
363
364 The following is the structure of a win->_attrs chtype:
365
366 short form:
367
368 -------------------------------------------------
369 |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
370 -------------------------------------------------
371   color number |  attrs |   character eg 'a'
372
373 The available non-color attributes are bold, reverse and blink. Others 
374 have no effect. The high order char is an index into an array of 
375 physical colors (defined in color.c) -- 32 foreground/background color 
376 pairs (5 bits) plus 3 bits for other attributes.
377
378 long form:
379
380 ----------------------------------------------------------------------------
381 |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|..| 3| 2| 1| 0|
382 ----------------------------------------------------------------------------
383       color number      |     modifiers         |      character eg 'a'
384
385 The available non-color attributes are bold, underline, invisible, 
386 right-line, left-line, protect, reverse and blink. 256 color pairs (8 
387 bits), 8 bits for other attributes, and 16 bits for character data.
388
389 **man-end****************************************************************/
390
391 /*** Video attribute macros ***/
392
393 #define A_NORMAL      (chtype)0
394
395 #ifdef CHTYPE_LONG
396 # define A_ALTCHARSET (chtype)0x00010000
397 # define A_RIGHTLINE  (chtype)0x00020000
398 # define A_LEFTLINE   (chtype)0x00040000
399 # define A_INVIS      (chtype)0x00080000
400 # define A_UNDERLINE  (chtype)0x00100000
401 # define A_REVERSE    (chtype)0x00200000
402 # define A_BLINK      (chtype)0x00400000
403 # define A_BOLD       (chtype)0x00800000
404
405 # define A_ATTRIBUTES (chtype)0xffff0000
406 # define A_CHARTEXT   (chtype)0x0000ffff
407 # define A_COLOR      (chtype)0xff000000
408
409 # define A_ITALIC     A_INVIS
410 # define A_PROTECT    (A_UNDERLINE | A_LEFTLINE | A_RIGHTLINE)
411
412 # define PDC_ATTR_SHIFT  19
413 # define PDC_COLOR_SHIFT 24
414 #else
415 # define A_BOLD       (chtype)0x0100  /* X/Open */
416 # define A_REVERSE    (chtype)0x0200  /* X/Open */
417 # define A_BLINK      (chtype)0x0400  /* X/Open */
418
419 # define A_ATTRIBUTES (chtype)0xff00  /* X/Open */
420 # define A_CHARTEXT   (chtype)0x00ff  /* X/Open */
421 # define A_COLOR      (chtype)0xf800  /* System V */
422
423 # define A_ALTCHARSET A_NORMAL        /* X/Open */
424 # define A_PROTECT    A_NORMAL        /* X/Open */
425 # define A_UNDERLINE  A_NORMAL        /* X/Open */
426
427 # define A_LEFTLINE   A_NORMAL
428 # define A_RIGHTLINE  A_NORMAL
429 # define A_ITALIC     A_NORMAL
430 # define A_INVIS      A_NORMAL
431
432 # define PDC_ATTR_SHIFT   8
433 # define PDC_COLOR_SHIFT 11
434 #endif
435
436 #define A_STANDOUT    (A_REVERSE | A_BOLD) /* X/Open */
437 #define A_DIM         A_NORMAL
438
439 #define CHR_MSK       A_CHARTEXT           /* Obsolete */
440 #define ATR_MSK       A_ATTRIBUTES         /* Obsolete */
441 #define ATR_NRM       A_NORMAL             /* Obsolete */
442
443 /* For use with attr_t -- X/Open says, "these shall be distinct", so 
444    this is a non-conforming implementation. */
445
446 #define WA_ALTCHARSET A_ALTCHARSET
447 #define WA_BLINK      A_BLINK
448 #define WA_BOLD       A_BOLD
449 #define WA_DIM        A_DIM
450 #define WA_INVIS      A_INVIS
451 #define WA_LEFT       A_LEFTLINE
452 #define WA_PROTECT    A_PROTECT
453 #define WA_REVERSE    A_REVERSE
454 #define WA_RIGHT      A_RIGHTLINE
455 #define WA_STANDOUT   A_STANDOUT
456 #define WA_UNDERLINE  A_UNDERLINE
457
458 #define WA_HORIZONTAL A_NORMAL
459 #define WA_LOW        A_NORMAL
460 #define WA_TOP        A_NORMAL
461 #define WA_VERTICAL   A_NORMAL
462
463 /*** Alternate character set macros ***/
464
465 /* 'w' = 32-bit chtype; acs_map[] index | A_ALTCHARSET
466    'n' = 16-bit chtype; it gets the fallback set because no bit is 
467          available for A_ALTCHARSET */
468
469 #ifdef CHTYPE_LONG
470 # define ACS_PICK(w, n) ((chtype)w | A_ALTCHARSET)
471 #else
472 # define ACS_PICK(w, n) ((chtype)n)
473 #endif
474
475 /* VT100-compatible symbols -- box chars */
476
477 #define ACS_ULCORNER  ACS_PICK('l', '+')
478 #define ACS_LLCORNER  ACS_PICK('m', '+')
479 #define ACS_URCORNER  ACS_PICK('k', '+')
480 #define ACS_LRCORNER  ACS_PICK('j', '+')
481 #define ACS_RTEE      ACS_PICK('u', '+')
482 #define ACS_LTEE      ACS_PICK('t', '+')
483 #define ACS_BTEE      ACS_PICK('v', '+')
484 #define ACS_TTEE      ACS_PICK('w', '+')
485 #define ACS_HLINE     ACS_PICK('q', '-')
486 #define ACS_VLINE     ACS_PICK('x', '|')
487 #define ACS_PLUS      ACS_PICK('n', '+')
488
489 /* VT100-compatible symbols -- other */
490
491 #define ACS_S1        ACS_PICK('o', '-')
492 #define ACS_S9        ACS_PICK('s', '_')
493 #define ACS_DIAMOND   ACS_PICK('`', '+')
494 #define ACS_CKBOARD   ACS_PICK('a', ':')
495 #define ACS_DEGREE    ACS_PICK('f', '\'')
496 #define ACS_PLMINUS   ACS_PICK('g', '#')
497 #define ACS_BULLET    ACS_PICK('~', 'o')
498
499 /* Teletype 5410v1 symbols -- these are defined in SysV curses, but
500    are not well-supported by most terminals. Stick to VT100 characters
501    for optimum portability. */
502
503 #define ACS_LARROW    ACS_PICK(',', '<')
504 #define ACS_RARROW    ACS_PICK('+', '>')
505 #define ACS_DARROW    ACS_PICK('.', 'v')
506 #define ACS_UARROW    ACS_PICK('-', '^')
507 #define ACS_BOARD     ACS_PICK('h', '#')
508 #define ACS_LANTERN   ACS_PICK('i', '*')
509 #define ACS_BLOCK     ACS_PICK('0', '#')
510
511 /* That goes double for these -- undocumented SysV symbols. Don't use
512    them. */
513
514 #define ACS_S3        ACS_PICK('p', '-')
515 #define ACS_S7        ACS_PICK('r', '-')
516 #define ACS_LEQUAL    ACS_PICK('y', '<')
517 #define ACS_GEQUAL    ACS_PICK('z', '>')
518 #define ACS_PI        ACS_PICK('{', 'n')
519 #define ACS_NEQUAL    ACS_PICK('|', '+')
520 #define ACS_STERLING  ACS_PICK('}', 'L')
521
522 /* Box char aliases */
523
524 #define ACS_BSSB      ACS_ULCORNER
525 #define ACS_SSBB      ACS_LLCORNER
526 #define ACS_BBSS      ACS_URCORNER
527 #define ACS_SBBS      ACS_LRCORNER
528 #define ACS_SBSS      ACS_RTEE
529 #define ACS_SSSB      ACS_LTEE
530 #define ACS_SSBS      ACS_BTEE
531 #define ACS_BSSS      ACS_TTEE
532 #define ACS_BSBS      ACS_HLINE
533 #define ACS_SBSB      ACS_VLINE
534 #define ACS_SSSS      ACS_PLUS
535
536 /* cchar_t aliases */
537
538 #ifdef PDC_WIDE
539 # define WACS_ULCORNER (&(acs_map['l']))
540 # define WACS_LLCORNER (&(acs_map['m']))
541 # define WACS_URCORNER (&(acs_map['k']))
542 # define WACS_LRCORNER (&(acs_map['j']))
543 # define WACS_RTEE     (&(acs_map['u']))
544 # define WACS_LTEE     (&(acs_map['t']))
545 # define WACS_BTEE     (&(acs_map['v']))
546 # define WACS_TTEE     (&(acs_map['w']))
547 # define WACS_HLINE    (&(acs_map['q']))
548 # define WACS_VLINE    (&(acs_map['x']))
549 # define WACS_PLUS     (&(acs_map['n']))
550
551 # define WACS_S1       (&(acs_map['o']))
552 # define WACS_S9       (&(acs_map['s']))
553 # define WACS_DIAMOND  (&(acs_map['`']))
554 # define WACS_CKBOARD  (&(acs_map['a']))
555 # define WACS_DEGREE   (&(acs_map['f']))
556 # define WACS_PLMINUS  (&(acs_map['g']))
557 # define WACS_BULLET   (&(acs_map['~']))
558
559 # define WACS_LARROW   (&(acs_map[',']))
560 # define WACS_RARROW   (&(acs_map['+']))
561 # define WACS_DARROW   (&(acs_map['.']))
562 # define WACS_UARROW   (&(acs_map['-']))
563 # define WACS_BOARD    (&(acs_map['h']))
564 # define WACS_LANTERN  (&(acs_map['i']))
565 # define WACS_BLOCK    (&(acs_map['0']))
566
567 # define WACS_S3       (&(acs_map['p']))
568 # define WACS_S7       (&(acs_map['r']))
569 # define WACS_LEQUAL   (&(acs_map['y']))
570 # define WACS_GEQUAL   (&(acs_map['z']))
571 # define WACS_PI       (&(acs_map['{']))
572 # define WACS_NEQUAL   (&(acs_map['|']))
573 # define WACS_STERLING (&(acs_map['}']))
574
575 # define WACS_BSSB     WACS_ULCORNER
576 # define WACS_SSBB     WACS_LLCORNER
577 # define WACS_BBSS     WACS_URCORNER
578 # define WACS_SBBS     WACS_LRCORNER
579 # define WACS_SBSS     WACS_RTEE
580 # define WACS_SSSB     WACS_LTEE
581 # define WACS_SSBS     WACS_BTEE
582 # define WACS_BSSS     WACS_TTEE
583 # define WACS_BSBS     WACS_HLINE
584 # define WACS_SBSB     WACS_VLINE
585 # define WACS_SSSS     WACS_PLUS
586 #endif
587
588 /*** Color macros ***/
589
590 #define COLOR_BLACK   0
591
592 #ifdef PDC_RGB        /* RGB */
593 # define COLOR_RED    1
594 # define COLOR_GREEN  2
595 # define COLOR_BLUE   4
596 #else                 /* BGR */
597 # define COLOR_BLUE   1
598 # define COLOR_GREEN  2
599 # define COLOR_RED    4
600 #endif
601
602 #define COLOR_CYAN    (COLOR_BLUE | COLOR_GREEN)
603 #define COLOR_MAGENTA (COLOR_RED | COLOR_BLUE)
604 #define COLOR_YELLOW  (COLOR_RED | COLOR_GREEN)
605
606 #define COLOR_WHITE   7
607
608 /*----------------------------------------------------------------------
609  *
610  *  Function and Keypad Key Definitions.
611  *  Many are just for compatibility.
612  *
613  */
614
615 #define KEY_CODE_YES  0x100  /* If get_wch() gives a key code */
616
617 #define KEY_BREAK     0x101  /* Not on PC KBD */
618 #define KEY_DOWN      0x102  /* Down arrow key */
619 #define KEY_UP        0x103  /* Up arrow key */
620 #define KEY_LEFT      0x104  /* Left arrow key */
621 #define KEY_RIGHT     0x105  /* Right arrow key */
622 #define KEY_HOME      0x106  /* home key */
623 #define KEY_BACKSPACE 0x107  /* not on pc */
624 #define KEY_F0        0x108  /* function keys; 64 reserved */
625
626 #define KEY_DL        0x148  /* delete line */
627 #define KEY_IL        0x149  /* insert line */
628 #define KEY_DC        0x14a  /* delete character */
629 #define KEY_IC        0x14b  /* insert char or enter ins mode */
630 #define KEY_EIC       0x14c  /* exit insert char mode */
631 #define KEY_CLEAR     0x14d  /* clear screen */
632 #define KEY_EOS       0x14e  /* clear to end of screen */
633 #define KEY_EOL       0x14f  /* clear to end of line */
634 #define KEY_SF        0x150  /* scroll 1 line forward */
635 #define KEY_SR        0x151  /* scroll 1 line back (reverse) */
636 #define KEY_NPAGE     0x152  /* next page */
637 #define KEY_PPAGE     0x153  /* previous page */
638 #define KEY_STAB      0x154  /* set tab */
639 #define KEY_CTAB      0x155  /* clear tab */
640 #define KEY_CATAB     0x156  /* clear all tabs */
641 #define KEY_ENTER     0x157  /* enter or send (unreliable) */
642 #define KEY_SRESET    0x158  /* soft/reset (partial/unreliable) */
643 #define KEY_RESET     0x159  /* reset/hard reset (unreliable) */
644 #define KEY_PRINT     0x15a  /* print/copy */
645 #define KEY_LL        0x15b  /* home down/bottom (lower left) */
646 #define KEY_ABORT     0x15c  /* abort/terminate key (any) */
647 #define KEY_SHELP     0x15d  /* short help */
648 #define KEY_LHELP     0x15e  /* long help */
649 #define KEY_BTAB      0x15f  /* Back tab key */
650 #define KEY_BEG       0x160  /* beg(inning) key */
651 #define KEY_CANCEL    0x161  /* cancel key */
652 #define KEY_CLOSE     0x162  /* close key */
653 #define KEY_COMMAND   0x163  /* cmd (command) key */
654 #define KEY_COPY      0x164  /* copy key */
655 #define KEY_CREATE    0x165  /* create key */
656 #define KEY_END       0x166  /* end key */
657 #define KEY_EXIT      0x167  /* exit key */
658 #define KEY_FIND      0x168  /* find key */
659 #define KEY_HELP      0x169  /* help key */
660 #define KEY_MARK      0x16a  /* mark key */
661 #define KEY_MESSAGE   0x16b  /* message key */
662 #define KEY_MOVE      0x16c  /* move key */
663 #define KEY_NEXT      0x16d  /* next object key */
664 #define KEY_OPEN      0x16e  /* open key */
665 #define KEY_OPTIONS   0x16f  /* options key */
666 #define KEY_PREVIOUS  0x170  /* previous object key */
667 #define KEY_REDO      0x171  /* redo key */
668 #define KEY_REFERENCE 0x172  /* ref(erence) key */
669 #define KEY_REFRESH   0x173  /* refresh key */
670 #define KEY_REPLACE   0x174  /* replace key */
671 #define KEY_RESTART   0x175  /* restart key */
672 #define KEY_RESUME    0x176  /* resume key */
673 #define KEY_SAVE      0x177  /* save key */
674 #define KEY_SBEG      0x178  /* shifted beginning key */
675 #define KEY_SCANCEL   0x179  /* shifted cancel key */
676 #define KEY_SCOMMAND  0x17a  /* shifted command key */
677 #define KEY_SCOPY     0x17b  /* shifted copy key */
678 #define KEY_SCREATE   0x17c  /* shifted create key */
679 #define KEY_SDC       0x17d  /* shifted delete char key */
680 #define KEY_SDL       0x17e  /* shifted delete line key */
681 #define KEY_SELECT    0x17f  /* select key */
682 #define KEY_SEND      0x180  /* shifted end key */
683 #define KEY_SEOL      0x181  /* shifted clear line key */
684 #define KEY_SEXIT     0x182  /* shifted exit key */
685 #define KEY_SFIND     0x183  /* shifted find key */
686 #define KEY_SHOME     0x184  /* shifted home key */
687 #define KEY_SIC       0x185  /* shifted input key */
688
689 #define KEY_SLEFT     0x187  /* shifted left arrow key */
690 #define KEY_SMESSAGE  0x188  /* shifted message key */
691 #define KEY_SMOVE     0x189  /* shifted move key */
692 #define KEY_SNEXT     0x18a  /* shifted next key */
693 #define KEY_SOPTIONS  0x18b  /* shifted options key */
694 #define KEY_SPREVIOUS 0x18c  /* shifted prev key */
695 #define KEY_SPRINT    0x18d  /* shifted print key */
696 #define KEY_SREDO     0x18e  /* shifted redo key */
697 #define KEY_SREPLACE  0x18f  /* shifted replace key */
698 #define KEY_SRIGHT    0x190  /* shifted right arrow */
699 #define KEY_SRSUME    0x191  /* shifted resume key */
700 #define KEY_SSAVE     0x192  /* shifted save key */
701 #define KEY_SSUSPEND  0x193  /* shifted suspend key */
702 #define KEY_SUNDO     0x194  /* shifted undo key */
703 #define KEY_SUSPEND   0x195  /* suspend key */
704 #define KEY_UNDO      0x196  /* undo key */
705
706 /* PDCurses-specific key definitions -- PC only */
707
708 #define ALT_0         0x197
709 #define ALT_1         0x198
710 #define ALT_2         0x199
711 #define ALT_3         0x19a
712 #define ALT_4         0x19b
713 #define ALT_5         0x19c
714 #define ALT_6         0x19d
715 #define ALT_7         0x19e
716 #define ALT_8         0x19f
717 #define ALT_9         0x1a0
718 #define ALT_A         0x1a1
719 #define ALT_B         0x1a2
720 #define ALT_C         0x1a3
721 #define ALT_D         0x1a4
722 #define ALT_E         0x1a5
723 #define ALT_F         0x1a6
724 #define ALT_G         0x1a7
725 #define ALT_H         0x1a8
726 #define ALT_I         0x1a9
727 #define ALT_J         0x1aa
728 #define ALT_K         0x1ab
729 #define ALT_L         0x1ac
730 #define ALT_M         0x1ad
731 #define ALT_N         0x1ae
732 #define ALT_O         0x1af
733 #define ALT_P         0x1b0
734 #define ALT_Q         0x1b1
735 #define ALT_R         0x1b2
736 #define ALT_S         0x1b3
737 #define ALT_T         0x1b4
738 #define ALT_U         0x1b5
739 #define ALT_V         0x1b6
740 #define ALT_W         0x1b7
741 #define ALT_X         0x1b8
742 #define ALT_Y         0x1b9
743 #define ALT_Z         0x1ba
744
745 #define CTL_LEFT      0x1bb  /* Control-Left-Arrow */
746 #define CTL_RIGHT     0x1bc
747 #define CTL_PGUP      0x1bd
748 #define CTL_PGDN      0x1be
749 #define CTL_HOME      0x1bf
750 #define CTL_END       0x1c0
751
752 #define KEY_A1        0x1c1  /* upper left on Virtual keypad */
753 #define KEY_A2        0x1c2  /* upper middle on Virt. keypad */
754 #define KEY_A3        0x1c3  /* upper right on Vir. keypad */
755 #define KEY_B1        0x1c4  /* middle left on Virt. keypad */
756 #define KEY_B2        0x1c5  /* center on Virt. keypad */
757 #define KEY_B3        0x1c6  /* middle right on Vir. keypad */
758 #define KEY_C1        0x1c7  /* lower left on Virt. keypad */
759 #define KEY_C2        0x1c8  /* lower middle on Virt. keypad */
760 #define KEY_C3        0x1c9  /* lower right on Vir. keypad */
761
762 #define PADSLASH      0x1ca  /* slash on keypad */
763 #define PADENTER      0x1cb  /* enter on keypad */
764 #define CTL_PADENTER  0x1cc  /* ctl-enter on keypad */
765 #define ALT_PADENTER  0x1cd  /* alt-enter on keypad */
766 #define PADSTOP       0x1ce  /* stop on keypad */
767 #define PADSTAR       0x1cf  /* star on keypad */
768 #define PADMINUS      0x1d0  /* minus on keypad */
769 #define PADPLUS       0x1d1  /* plus on keypad */
770 #define CTL_PADSTOP   0x1d2  /* ctl-stop on keypad */
771 #define CTL_PADCENTER 0x1d3  /* ctl-enter on keypad */
772 #define CTL_PADPLUS   0x1d4  /* ctl-plus on keypad */
773 #define CTL_PADMINUS  0x1d5  /* ctl-minus on keypad */
774 #define CTL_PADSLASH  0x1d6  /* ctl-slash on keypad */
775 #define CTL_PADSTAR   0x1d7  /* ctl-star on keypad */
776 #define ALT_PADPLUS   0x1d8  /* alt-plus on keypad */
777 #define ALT_PADMINUS  0x1d9  /* alt-minus on keypad */
778 #define ALT_PADSLASH  0x1da  /* alt-slash on keypad */
779 #define ALT_PADSTAR   0x1db  /* alt-star on keypad */
780 #define ALT_PADSTOP   0x1dc  /* alt-stop on keypad */
781 #define CTL_INS       0x1dd  /* ctl-insert */
782 #define ALT_DEL       0x1de  /* alt-delete */
783 #define ALT_INS       0x1df  /* alt-insert */
784 #define CTL_UP        0x1e0  /* ctl-up arrow */
785 #define CTL_DOWN      0x1e1  /* ctl-down arrow */
786 #define CTL_TAB       0x1e2  /* ctl-tab */
787 #define ALT_TAB       0x1e3
788 #define ALT_MINUS     0x1e4
789 #define ALT_EQUAL     0x1e5
790 #define ALT_HOME      0x1e6
791 #define ALT_PGUP      0x1e7
792 #define ALT_PGDN      0x1e8
793 #define ALT_END       0x1e9
794 #define ALT_UP        0x1ea  /* alt-up arrow */
795 #define ALT_DOWN      0x1eb  /* alt-down arrow */
796 #define ALT_RIGHT     0x1ec  /* alt-right arrow */
797 #define ALT_LEFT      0x1ed  /* alt-left arrow */
798 #define ALT_ENTER     0x1ee  /* alt-enter */
799 #define ALT_ESC       0x1ef  /* alt-escape */
800 #define ALT_BQUOTE    0x1f0  /* alt-back quote */
801 #define ALT_LBRACKET  0x1f1  /* alt-left bracket */
802 #define ALT_RBRACKET  0x1f2  /* alt-right bracket */
803 #define ALT_SEMICOLON 0x1f3  /* alt-semi-colon */
804 #define ALT_FQUOTE    0x1f4  /* alt-forward quote */
805 #define ALT_COMMA     0x1f5  /* alt-comma */
806 #define ALT_STOP      0x1f6  /* alt-stop */
807 #define ALT_FSLASH    0x1f7  /* alt-forward slash */
808 #define ALT_BKSP      0x1f8  /* alt-backspace */
809 #define CTL_BKSP      0x1f9  /* ctl-backspace */
810 #define PAD0          0x1fa  /* keypad 0 */
811
812 #define CTL_PAD0      0x1fb  /* ctl-keypad 0 */
813 #define CTL_PAD1      0x1fc
814 #define CTL_PAD2      0x1fd
815 #define CTL_PAD3      0x1fe
816 #define CTL_PAD4      0x1ff
817 #define CTL_PAD5      0x200
818 #define CTL_PAD6      0x201
819 #define CTL_PAD7      0x202
820 #define CTL_PAD8      0x203
821 #define CTL_PAD9      0x204
822
823 #define ALT_PAD0      0x205  /* alt-keypad 0 */
824 #define ALT_PAD1      0x206
825 #define ALT_PAD2      0x207
826 #define ALT_PAD3      0x208
827 #define ALT_PAD4      0x209
828 #define ALT_PAD5      0x20a
829 #define ALT_PAD6      0x20b
830 #define ALT_PAD7      0x20c
831 #define ALT_PAD8      0x20d
832 #define ALT_PAD9      0x20e
833
834 #define CTL_DEL       0x20f  /* clt-delete */
835 #define ALT_BSLASH    0x210  /* alt-back slash */
836 #define CTL_ENTER     0x211  /* ctl-enter */
837
838 #define SHF_PADENTER  0x212  /* shift-enter on keypad */
839 #define SHF_PADSLASH  0x213  /* shift-slash on keypad */
840 #define SHF_PADSTAR   0x214  /* shift-star  on keypad */
841 #define SHF_PADPLUS   0x215  /* shift-plus  on keypad */
842 #define SHF_PADMINUS  0x216  /* shift-minus on keypad */
843 #define SHF_UP        0x217  /* shift-up on keypad */
844 #define SHF_DOWN      0x218  /* shift-down on keypad */
845 #define SHF_IC        0x219  /* shift-insert on keypad */
846 #define SHF_DC        0x21a  /* shift-delete on keypad */
847
848 #define KEY_MOUSE     0x21b  /* "mouse" key */
849 #define KEY_SHIFT_L   0x21c  /* Left-shift */
850 #define KEY_SHIFT_R   0x21d  /* Right-shift */
851 #define KEY_CONTROL_L 0x21e  /* Left-control */
852 #define KEY_CONTROL_R 0x21f  /* Right-control */
853 #define KEY_ALT_L     0x220  /* Left-alt */
854 #define KEY_ALT_R     0x221  /* Right-alt */
855 #define KEY_RESIZE    0x222  /* Window resize */
856 #define KEY_SUP       0x223  /* Shifted up arrow */
857 #define KEY_SDOWN     0x224  /* Shifted down arrow */
858
859 #define KEY_MIN       KEY_BREAK      /* Minimum curses key value */
860 #define KEY_MAX       KEY_SDOWN      /* Maximum curses key */
861
862 #define KEY_F(n)      (KEY_F0 + (n))
863
864 /*----------------------------------------------------------------------
865  *
866  *  PDCurses Function Declarations
867  *
868  */
869
870 /* Standard */
871
872 int     addch(const chtype);
873 int     addchnstr(const chtype *, int);
874 int     addchstr(const chtype *);
875 int     addnstr(const char *, int);
876 int     addstr(const char *);
877 int     attroff(chtype);
878 int     attron(chtype);
879 int     attrset(chtype);
880 int     attr_get(attr_t *, short *, void *);
881 int     attr_off(attr_t, void *);
882 int     attr_on(attr_t, void *);
883 int     attr_set(attr_t, short, void *);
884 int     baudrate(void);
885 int     beep(void);
886 int     bkgd(chtype);
887 void    bkgdset(chtype);
888 int     border(chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype);
889 int     box(WINDOW *, chtype, chtype);
890 bool    can_change_color(void);
891 int     cbreak(void); 
892 int     chgat(int, attr_t, short, const void *);
893 int     clearok(WINDOW *, bool);
894 int     clear(void);
895 int     clrtobot(void);
896 int     clrtoeol(void);
897 int     color_content(short, short *, short *, short *);
898 int     color_set(short, void *);
899 int     copywin(const WINDOW *, WINDOW *, int, int, int, int, int, int, int);
900 int     curs_set(int);
901 int     def_prog_mode(void);
902 int     def_shell_mode(void);
903 int     delay_output(int);
904 int     delch(void);
905 int     deleteln(void);
906 void    delscreen(SCREEN *); 
907 int     delwin(WINDOW *);
908 WINDOW *derwin(WINDOW *, int, int, int, int);
909 int     doupdate(void);
910 WINDOW *dupwin(WINDOW *);
911 int     echochar(const chtype);
912 int     echo(void);
913 int     endwin(void);
914 char    erasechar(void);
915 int     erase(void);
916 void    filter(void);
917 int     flash(void);
918 int     flushinp(void);
919 chtype  getbkgd(WINDOW *);
920 int     getnstr(char *, int);
921 int     getstr(char *);
922 WINDOW *getwin(FILE *);
923 int     halfdelay(int);
924 bool    has_colors(void);
925 bool    has_ic(void);
926 bool    has_il(void);
927 int     hline(chtype, int);
928 void    idcok(WINDOW *, bool);
929 int     idlok(WINDOW *, bool);
930 void    immedok(WINDOW *, bool);
931 int     inchnstr(chtype *, int);
932 int     inchstr(chtype *);
933 chtype  inch(void);
934 int     init_color(short, short, short, short);
935 int     init_pair(short, short, short);
936 WINDOW *initscr(void);
937 int     innstr(char *, int);
938 int     insch(chtype);
939 int     insdelln(int);
940 int     insertln(void);
941 int     insnstr(const char *, int);
942 int     insstr(const char *);
943 int     instr(char *);
944 int     intrflush(WINDOW *, bool);
945 bool    isendwin(void);
946 bool    is_linetouched(WINDOW *, int);
947 bool    is_wintouched(WINDOW *);
948 char   *keyname(int);
949 int     keypad(WINDOW *, bool);
950 char    killchar(void);
951 int     leaveok(WINDOW *, bool);
952 char   *longname(void);
953 int     meta(WINDOW *, bool);
954 int     move(int, int);
955 int     mvaddch(int, int, const chtype);
956 int     mvaddchnstr(int, int, const chtype *, int);
957 int     mvaddchstr(int, int, const chtype *);
958 int     mvaddnstr(int, int, const char *, int);
959 int     mvaddstr(int, int, const char *);
960 int     mvchgat(int, int, int, attr_t, short, const void *);
961 int     mvcur(int, int, int, int);
962 int     mvdelch(int, int);
963 int     mvderwin(WINDOW *, int, int);
964 int     mvgetch(int, int);
965 int     mvgetnstr(int, int, char *, int);
966 int     mvgetstr(int, int, char *);
967 int     mvhline(int, int, chtype, int);
968 chtype  mvinch(int, int);
969 int     mvinchnstr(int, int, chtype *, int);
970 int     mvinchstr(int, int, chtype *);
971 int     mvinnstr(int, int, char *, int);
972 int     mvinsch(int, int, chtype);
973 int     mvinsnstr(int, int, const char *, int);
974 int     mvinsstr(int, int, const char *);
975 int     mvinstr(int, int, char *);
976 int     mvprintw(int, int, const char *, ...);
977 int     mvscanw(int, int, const char *, ...);
978 int     mvvline(int, int, chtype, int);
979 int     mvwaddchnstr(WINDOW *, int, int, const chtype *, int);
980 int     mvwaddchstr(WINDOW *, int, int, const chtype *);
981 int     mvwaddch(WINDOW *, int, int, const chtype);
982 int     mvwaddnstr(WINDOW *, int, int, const char *, int);
983 int     mvwaddstr(WINDOW *, int, int, const char *);
984 int     mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);
985 int     mvwdelch(WINDOW *, int, int);
986 int     mvwgetch(WINDOW *, int, int);
987 int     mvwgetnstr(WINDOW *, int, int, char *, int);
988 int     mvwgetstr(WINDOW *, int, int, char *);
989 int     mvwhline(WINDOW *, int, int, chtype, int);
990 int     mvwinchnstr(WINDOW *, int, int, chtype *, int);
991 int     mvwinchstr(WINDOW *, int, int, chtype *);
992 chtype  mvwinch(WINDOW *, int, int);
993 int     mvwinnstr(WINDOW *, int, int, char *, int);
994 int     mvwinsch(WINDOW *, int, int, chtype);
995 int     mvwinsnstr(WINDOW *, int, int, const char *, int);
996 int     mvwinsstr(WINDOW *, int, int, const char *);
997 int     mvwinstr(WINDOW *, int, int, char *);
998 int     mvwin(WINDOW *, int, int);
999 int     mvwprintw(WINDOW *, int, int, const char *, ...);
1000 int     mvwscanw(WINDOW *, int, int, const char *, ...);
1001 int     mvwvline(WINDOW *, int, int, chtype, int);
1002 int     napms(int);
1003 WINDOW *newpad(int, int);
1004 SCREEN *newterm(const char *, FILE *, FILE *);
1005 WINDOW *newwin(int, int, int, int);
1006 int     nl(void);
1007 int     nocbreak(void);
1008 int     nodelay(WINDOW *, bool);
1009 int     noecho(void);
1010 int     nonl(void);
1011 void    noqiflush(void);
1012 int     noraw(void);
1013 int     notimeout(WINDOW *, bool);
1014 int     overlay(const WINDOW *, WINDOW *);
1015 int     overwrite(const WINDOW *, WINDOW *);
1016 int     pair_content(short, short *, short *);
1017 int     pechochar(WINDOW *, chtype);
1018 int     pnoutrefresh(WINDOW *, int, int, int, int, int, int);
1019 int     prefresh(WINDOW *, int, int, int, int, int, int);
1020 int     printw(const char *, ...);
1021 int     putwin(WINDOW *, FILE *);
1022 void    qiflush(void);
1023 int     raw(void);
1024 int     redrawwin(WINDOW *);
1025 int     refresh(void);
1026 int     reset_prog_mode(void);
1027 int     reset_shell_mode(void);
1028 int     resetty(void);
1029 int     ripoffline(int, int (*)(WINDOW *, int));
1030 int     savetty(void);
1031 int     scanw(const char *, ...);
1032 int     scr_dump(const char *);
1033 int     scr_init(const char *);
1034 int     scr_restore(const char *);
1035 int     scr_set(const char *);
1036 int     scrl(int);
1037 int     scroll(WINDOW *);
1038 int     scrollok(WINDOW *, bool);
1039 SCREEN *set_term(SCREEN *);
1040 int     setscrreg(int, int);
1041 int     slk_attroff(const chtype);
1042 int     slk_attr_off(const attr_t, void *);
1043 int     slk_attron(const chtype);
1044 int     slk_attr_on(const attr_t, void *);
1045 int     slk_attrset(const chtype);
1046 int     slk_attr_set(const attr_t, short, void *);
1047 int     slk_clear(void);
1048 int     slk_color(short);
1049 int     slk_init(int);
1050 char   *slk_label(int);
1051 int     slk_noutrefresh(void);
1052 int     slk_refresh(void);
1053 int     slk_restore(void);
1054 int     slk_set(int, const char *, int);
1055 int     slk_touch(void);
1056 int     standend(void);
1057 int     standout(void);
1058 int     start_color(void);
1059 WINDOW *subpad(WINDOW *, int, int, int, int);
1060 WINDOW *subwin(WINDOW *, int, int, int, int);
1061 int     syncok(WINDOW *, bool);
1062 chtype  termattrs(void);
1063 attr_t  term_attrs(void);
1064 char   *termname(void);
1065 void    timeout(int);
1066 int     touchline(WINDOW *, int, int);
1067 int     touchwin(WINDOW *);
1068 int     typeahead(int);
1069 int     untouchwin(WINDOW *);
1070 void    use_env(bool);
1071 int     vidattr(chtype);
1072 int     vid_attr(attr_t, short, void *);
1073 int     vidputs(chtype, int (*)(int));
1074 int     vid_puts(attr_t, short, void *, int (*)(int));
1075 int     vline(chtype, int);
1076 int     vw_printw(WINDOW *, const char *, va_list);
1077 int     vwprintw(WINDOW *, const char *, va_list);
1078 int     vw_scanw(WINDOW *, const char *, va_list);
1079 int     vwscanw(WINDOW *, const char *, va_list);
1080 int     waddchnstr(WINDOW *, const chtype *, int);
1081 int     waddchstr(WINDOW *, const chtype *);
1082 int     waddch(WINDOW *, const chtype);
1083 int     waddnstr(WINDOW *, const char *, int);
1084 int     waddstr(WINDOW *, const char *);
1085 int     wattroff(WINDOW *, chtype);
1086 int     wattron(WINDOW *, chtype);
1087 int     wattrset(WINDOW *, chtype);
1088 int     wattr_get(WINDOW *, attr_t *, short *, void *);
1089 int     wattr_off(WINDOW *, attr_t, void *);
1090 int     wattr_on(WINDOW *, attr_t, void *);
1091 int     wattr_set(WINDOW *, attr_t, short, void *);
1092 void    wbkgdset(WINDOW *, chtype);
1093 int     wbkgd(WINDOW *, chtype);
1094 int     wborder(WINDOW *, chtype, chtype, chtype, chtype,
1095                 chtype, chtype, chtype, chtype);
1096 int     wchgat(WINDOW *, int, attr_t, short, const void *);
1097 int     wclear(WINDOW *);
1098 int     wclrtobot(WINDOW *);
1099 int     wclrtoeol(WINDOW *);
1100 int     wcolor_set(WINDOW *, short, void *);
1101 void    wcursyncup(WINDOW *);
1102 int     wdelch(WINDOW *);
1103 int     wdeleteln(WINDOW *);
1104 int     wechochar(WINDOW *, const chtype);
1105 int     werase(WINDOW *);
1106 int     wgetch(WINDOW *);
1107 int     wgetnstr(WINDOW *, char *, int);
1108 int     wgetstr(WINDOW *, char *);
1109 int     whline(WINDOW *, chtype, int);
1110 int     winchnstr(WINDOW *, chtype *, int);
1111 int     winchstr(WINDOW *, chtype *);
1112 chtype  winch(WINDOW *);
1113 int     winnstr(WINDOW *, char *, int);
1114 int     winsch(WINDOW *, chtype);
1115 int     winsdelln(WINDOW *, int);
1116 int     winsertln(WINDOW *);
1117 int     winsnstr(WINDOW *, const char *, int);
1118 int     winsstr(WINDOW *, const char *);
1119 int     winstr(WINDOW *, char *);
1120 int     wmove(WINDOW *, int, int);
1121 int     wnoutrefresh(WINDOW *);
1122 int     wprintw(WINDOW *, const char *, ...);
1123 int     wredrawln(WINDOW *, int, int);
1124 int     wrefresh(WINDOW *);
1125 int     wscanw(WINDOW *, const char *, ...);
1126 int     wscrl(WINDOW *, int);
1127 int     wsetscrreg(WINDOW *, int, int);
1128 int     wstandend(WINDOW *);
1129 int     wstandout(WINDOW *);
1130 void    wsyncdown(WINDOW *);
1131 void    wsyncup(WINDOW *);
1132 void    wtimeout(WINDOW *, int);
1133 int     wtouchln(WINDOW *, int, int, int);
1134 int     wvline(WINDOW *, chtype, int);
1135
1136 /* Wide-character functions */
1137
1138 #ifdef PDC_WIDE
1139 int     addnwstr(const wchar_t *, int);
1140 int     addwstr(const wchar_t *);
1141 int     add_wch(const cchar_t *);
1142 int     add_wchnstr(const cchar_t *, int);
1143 int     add_wchstr(const cchar_t *);
1144 int     border_set(const cchar_t *, const cchar_t *, const cchar_t *, 
1145                    const cchar_t *, const cchar_t *, const cchar_t *, 
1146                    const cchar_t *, const cchar_t *);
1147 int     box_set(WINDOW *, const cchar_t *, const cchar_t *);
1148 int     echo_wchar(const cchar_t *);
1149 int     erasewchar(wchar_t *);
1150 int     getbkgrnd(cchar_t *);
1151 int     getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *);
1152 int     getn_wstr(wint_t *, int);
1153 int     get_wch(wint_t *);
1154 int     get_wstr(wint_t *);
1155 int     hline_set(const cchar_t *, int);
1156 int     innwstr(wchar_t *, int);
1157 int     ins_nwstr(const wchar_t *, int);
1158 int     ins_wch(const cchar_t *);
1159 int     ins_wstr(const wchar_t *);
1160 int     inwstr(wchar_t *);
1161 int     in_wch(cchar_t *);
1162 int     in_wchnstr(cchar_t *, int);
1163 int     in_wchstr(cchar_t *);
1164 char   *key_name(wchar_t);
1165 int     killwchar(wchar_t *);
1166 int     mvaddnwstr(int, int, const wchar_t *, int);
1167 int     mvaddwstr(int, int, const wchar_t *);
1168 int     mvadd_wch(int, int, const cchar_t *);
1169 int     mvadd_wchnstr(int, int, const cchar_t *, int);
1170 int     mvadd_wchstr(int, int, const cchar_t *);
1171 int     mvgetn_wstr(int, int, wint_t *, int);
1172 int     mvget_wch(int, int, wint_t *);
1173 int     mvget_wstr(int, int, wint_t *);
1174 int     mvhline_set(int, int, const cchar_t *, int);
1175 int     mvinnwstr(int, int, wchar_t *, int);
1176 int     mvins_nwstr(int, int, const wchar_t *, int);
1177 int     mvins_wch(int, int, const cchar_t *);
1178 int     mvins_wstr(int, int, const wchar_t *);
1179 int     mvinwstr(int, int, wchar_t *);
1180 int     mvin_wch(int, int, cchar_t *);
1181 int     mvin_wchnstr(int, int, cchar_t *, int);
1182 int     mvin_wchstr(int, int, cchar_t *);
1183 int     mvvline_set(int, int, const cchar_t *, int);
1184 int     mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);
1185 int     mvwaddwstr(WINDOW *, int, int, const wchar_t *);
1186 int     mvwadd_wch(WINDOW *, int, int, const cchar_t *);
1187 int     mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int);
1188 int     mvwadd_wchstr(WINDOW *, int, int, const cchar_t *);
1189 int     mvwgetn_wstr(WINDOW *, int, int, wint_t *, int);
1190 int     mvwget_wch(WINDOW *, int, int, wint_t *);
1191 int     mvwget_wstr(WINDOW *, int, int, wint_t *);
1192 int     mvwhline_set(WINDOW *, int, int, const cchar_t *, int);
1193 int     mvwinnwstr(WINDOW *, int, int, wchar_t *, int);
1194 int     mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int);
1195 int     mvwins_wch(WINDOW *, int, int, const cchar_t *);
1196 int     mvwins_wstr(WINDOW *, int, int, const wchar_t *);
1197 int     mvwin_wch(WINDOW *, int, int, cchar_t *);
1198 int     mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int);
1199 int     mvwin_wchstr(WINDOW *, int, int, cchar_t *);
1200 int     mvwinwstr(WINDOW *, int, int, wchar_t *);
1201 int     mvwvline_set(WINDOW *, int, int, const cchar_t *, int);
1202 int     pecho_wchar(WINDOW *, const cchar_t*);
1203 int     setcchar(cchar_t*, const wchar_t*, const attr_t, short, const void*);
1204 int     slk_wset(int, const wchar_t *, int);
1205 int     unget_wch(const wchar_t);
1206 int     vline_set(const cchar_t *, int);
1207 int     waddnwstr(WINDOW *, const wchar_t *, int);
1208 int     waddwstr(WINDOW *, const wchar_t *);
1209 int     wadd_wch(WINDOW *, const cchar_t *);
1210 int     wadd_wchnstr(WINDOW *, const cchar_t *, int);
1211 int     wadd_wchstr(WINDOW *, const cchar_t *);
1212 int     wbkgrnd(WINDOW *, const cchar_t *);
1213 void    wbkgrndset(WINDOW *, const cchar_t *);
1214 int     wborder_set(WINDOW *, const cchar_t *, const cchar_t *,
1215                     const cchar_t *, const cchar_t *, const cchar_t *, 
1216                     const cchar_t *, const cchar_t *, const cchar_t *);
1217 int     wecho_wchar(WINDOW *, const cchar_t *);
1218 int     wgetbkgrnd(WINDOW *, cchar_t *);
1219 int     wgetn_wstr(WINDOW *, wint_t *, int);
1220 int     wget_wch(WINDOW *, wint_t *);
1221 int     wget_wstr(WINDOW *, wint_t *);
1222 int     whline_set(WINDOW *, const cchar_t *, int);
1223 int     winnwstr(WINDOW *, wchar_t *, int);
1224 int     wins_nwstr(WINDOW *, const wchar_t *, int);
1225 int     wins_wch(WINDOW *, const cchar_t *);
1226 int     wins_wstr(WINDOW *, const wchar_t *);
1227 int     winwstr(WINDOW *, wchar_t *);
1228 int     win_wch(WINDOW *, cchar_t *);
1229 int     win_wchnstr(WINDOW *, cchar_t *, int);
1230 int     win_wchstr(WINDOW *, cchar_t *);
1231 wchar_t *wunctrl(cchar_t *);
1232 int     wvline_set(WINDOW *, const cchar_t *, int);
1233 #endif
1234
1235 /* Quasi-standard */
1236
1237 chtype  getattrs(WINDOW *);
1238 int     getbegx(WINDOW *);
1239 int     getbegy(WINDOW *);
1240 int     getmaxx(WINDOW *);
1241 int     getmaxy(WINDOW *);
1242 int     getparx(WINDOW *);
1243 int     getpary(WINDOW *);
1244 int     getcurx(WINDOW *);
1245 int     getcury(WINDOW *);
1246 void    traceoff(void);
1247 void    traceon(void);
1248 char   *unctrl(chtype);
1249
1250 int     crmode(void);
1251 int     nocrmode(void);
1252 int     draino(int);
1253 int     resetterm(void);
1254 int     fixterm(void);
1255 int     saveterm(void);
1256 int     setsyx(int, int);
1257
1258 int     mouse_set(unsigned long);
1259 int     mouse_on(unsigned long);
1260 int     mouse_off(unsigned long);
1261 int     request_mouse_pos(void);
1262 int     map_button(unsigned long);
1263 void    wmouse_position(WINDOW *, int *, int *);
1264 unsigned long getmouse(void);
1265 unsigned long getbmap(void);
1266
1267 /* ncurses */
1268
1269 int     assume_default_colors(int, int);
1270 const char *curses_version(void);
1271 bool    has_key(int);
1272 int     use_default_colors(void);
1273 int     wresize(WINDOW *, int, int);
1274
1275 int     mouseinterval(int);
1276 mmask_t mousemask(mmask_t, mmask_t *);
1277 bool    mouse_trafo(int *, int *, bool);
1278 int     nc_getmouse(MEVENT *);
1279 int     ungetmouse(MEVENT *);
1280 bool    wenclose(const WINDOW *, int, int);
1281 bool    wmouse_trafo(const WINDOW *, int *, int *, bool);
1282
1283 /* PDCurses */
1284
1285 int     addrawch(chtype);
1286 int     insrawch(chtype);
1287 bool    is_termresized(void);
1288 int     mvaddrawch(int, int, chtype);
1289 int     mvdeleteln(int, int);
1290 int     mvinsertln(int, int);
1291 int     mvinsrawch(int, int, chtype);
1292 int     mvwaddrawch(WINDOW *, int, int, chtype);
1293 int     mvwdeleteln(WINDOW *, int, int);
1294 int     mvwinsertln(WINDOW *, int, int);
1295 int     mvwinsrawch(WINDOW *, int, int, chtype);
1296 int     raw_output(bool);
1297 int     resize_term(int, int);
1298 WINDOW *resize_window(WINDOW *, int, int);
1299 int     waddrawch(WINDOW *, chtype);
1300 int     winsrawch(WINDOW *, chtype);
1301 char    wordchar(void);
1302
1303 #ifdef PDC_WIDE
1304 wchar_t *slk_wlabel(int);
1305 #endif
1306
1307 void    PDC_debug(const char *, ...);
1308 int     PDC_ungetch(int);
1309 int     PDC_set_blink(bool);
1310 int     PDC_set_line_color(short);
1311 void    PDC_set_title(const char *);
1312
1313 int     PDC_clearclipboard(void);
1314 int     PDC_freeclipboard(char *);
1315 int     PDC_getclipboard(char **, long *);
1316 int     PDC_setclipboard(const char *, long);
1317
1318 unsigned long PDC_get_input_fd(void);
1319 unsigned long PDC_get_key_modifiers(void);
1320 int     PDC_return_key_modifiers(bool);
1321 int     PDC_save_key_modifiers(bool);
1322
1323 #ifdef XCURSES
1324 WINDOW *Xinitscr(int, char **);
1325 void    XCursesExit(void);
1326 int     sb_init(void);
1327 int     sb_set_horz(int, int, int);
1328 int     sb_set_vert(int, int, int);
1329 int     sb_get_horz(int *, int *, int *);
1330 int     sb_get_vert(int *, int *, int *);
1331 int     sb_refresh(void);
1332 #endif
1333
1334 /*** Functions defined as macros ***/
1335
1336 /* getch() and ungetch() conflict with some DOS libraries */
1337
1338 #define getch()            wgetch(stdscr)
1339 #define ungetch(ch)        PDC_ungetch(ch)
1340
1341 #define COLOR_PAIR(n)      (((chtype)(n) << PDC_COLOR_SHIFT) & A_COLOR)
1342 #define PAIR_NUMBER(n)     (((n) & A_COLOR) >> PDC_COLOR_SHIFT)
1343
1344 /* These will _only_ work as macros */
1345
1346 #define getbegyx(w, y, x)  (y = getbegy(w), x = getbegx(w))
1347 #define getmaxyx(w, y, x)  (y = getmaxy(w), x = getmaxx(w))
1348 #define getparyx(w, y, x)  (y = getpary(w), x = getparx(w))
1349 #define getyx(w, y, x)     (y = getcury(w), x = getcurx(w))
1350
1351 #define getsyx(y, x)       { if (curscr->_leaveit) (y)=(x)=-1; \
1352                              else getyx(curscr,(y),(x)); }
1353
1354 #ifdef NCURSES_MOUSE_VERSION
1355 # define getmouse(x) nc_getmouse(x)
1356 #endif
1357
1358 /* return codes from PDC_getclipboard() and PDC_setclipboard() calls */
1359
1360 #define PDC_CLIP_SUCCESS         0
1361 #define PDC_CLIP_ACCESS_ERROR    1
1362 #define PDC_CLIP_EMPTY           2
1363 #define PDC_CLIP_MEMORY_ERROR    3
1364
1365 /* PDCurses key modifier masks */
1366
1367 #define PDC_KEY_MODIFIER_SHIFT   1
1368 #define PDC_KEY_MODIFIER_CONTROL 2
1369 #define PDC_KEY_MODIFIER_ALT     4
1370 #define PDC_KEY_MODIFIER_NUMLOCK 8
1371
1372 #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS)
1373 # undef bool
1374 }
1375 #endif
1376
1377 #endif  /* __PDCURSES__ */