home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / ncurses-1.9.9e-bin.lha / include / curses.h next >
C/C++ Source or Header  |  1996-10-12  |  55KB  |  1,203 lines

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