ncurses.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. /* These are defined only in curses.h, and are used for conditional compiles */
  2. #define NCURSES_VERSION_MAJOR 3
  3. #define NCURSES_VERSION_MINOR 0
  4. #define NCURSES_VERSION_PATCH 980228
  5. /* This is defined in more than one ncurses header, for identification */
  6. #undef NCURSES_VERSION
  7. #define NCURSES_VERSION "3.0"
  8. /*
  9. #ifdef NCURSES_NOMACROS
  10. #define NCURSES_ATTR_T attr_t
  11. #endif
  12. #ifndef NCURSES_ATTR_T
  13. #define NCURSES_ATTR_T int
  14. #endif
  15. #ifndef NCURSES_CONST
  16. #define NCURSES_CONST
  17. #endif
  18. */
  19. typedef unsigned long chtype;
  20. #define CXX_BUILTIN_BOOL 1
  21. /*
  22. #define CXX_TYPE_OF_BOOL char
  23. */
  24. /* colors */
  25. extern int COLORS;
  26. extern int COLOR_PAIRS;
  27. #define COLOR_BLACK 0
  28. #define COLOR_RED 1
  29. #define COLOR_GREEN 2
  30. #define COLOR_YELLOW 3
  31. #define COLOR_BLUE 4
  32. #define COLOR_MAGENTA 5
  33. #define COLOR_CYAN 6
  34. #define COLOR_WHITE 7
  35. /* line graphics */
  36. /*
  37. extern chtype acs_map[];
  38. */
  39. /* VT100 symbols begin here */
  40. /*
  41. #define ACS_ULCORNER (acs_map['l'])
  42. #define ACS_LLCORNER (acs_map['m'])
  43. #define ACS_URCORNER (acs_map['k'])
  44. #define ACS_LRCORNER (acs_map['j'])
  45. #define ACS_LTEE (acs_map['t'])
  46. #define ACS_RTEE (acs_map['u'])
  47. #define ACS_BTEE (acs_map['v'])
  48. #define ACS_TTEE (acs_map['w'])
  49. #define ACS_HLINE (acs_map['q'])
  50. #define ACS_VLINE (acs_map['x'])
  51. #define ACS_PLUS (acs_map['n'])
  52. #define ACS_S1 (acs_map['o'])
  53. #define ACS_S9 (acs_map['s'])
  54. #define ACS_DIAMOND (acs_map['`'])
  55. #define ACS_CKBOARD (acs_map['a'])
  56. #define ACS_DEGREE (acs_map['f'])
  57. #define ACS_PLMINUS (acs_map['g'])
  58. #define ACS_BULLET (acs_map['~'])
  59. #define ACS_LARROW (acs_map[','])
  60. #define ACS_RARROW (acs_map['+'])
  61. #define ACS_DARROW (acs_map['.'])
  62. #define ACS_UARROW (acs_map['-'])
  63. #define ACS_BOARD (acs_map['h'])
  64. #define ACS_LANTERN (acs_map['i'])
  65. #define ACS_BLOCK (acs_map['0'])
  66. #define ACS_S3 (acs_map['p'])
  67. #define ACS_S7 (acs_map['r'])
  68. #define ACS_LEQUAL (acs_map['y'])
  69. #define ACS_GEQUAL (acs_map['z'])
  70. #define ACS_PI (acs_map['{'])
  71. #define ACS_NEQUAL (acs_map['|'])
  72. #define ACS_STERLING (acs_map['}'])
  73. */
  74. /*
  75. * Line drawing ACS names are of the form ACS_trbl, where t is the top, r
  76. * is the right, b is the bottom, and l is the left. t, r, b, and l might
  77. * be B (blank), S (single), D (double), or T (thick). The subset defined
  78. * here only uses B and S.
  79. */
  80. /*
  81. #define ACS_BSSB ACS_ULCORNER
  82. #define ACS_SSBB ACS_LLCORNER
  83. #define ACS_BBSS ACS_URCORNER
  84. #define ACS_SBBS ACS_LRCORNER
  85. #define ACS_SBSS ACS_RTEE
  86. #define ACS_SSSB ACS_LTEE
  87. #define ACS_SSBS ACS_BTEE
  88. #define ACS_BSSS ACS_TTEE
  89. #define ACS_BSBS ACS_HLINE
  90. #define ACS_SBSB ACS_VLINE
  91. #define ACS_SSSS ACS_PLUS
  92. */
  93. #define ERR (-1)
  94. #define OK (0)
  95. #define _SUBWIN 0x01
  96. #define _ENDLINE 0x02
  97. #define _FULLWIN 0x04
  98. #define _SCROLLWIN 0x08
  99. #define _ISPAD 0x10
  100. #define _HASMOVED 0x20
  101. #define _WRAPPED 0x40
  102. /*
  103. * this value is used in the firstchar and lastchar fields to mark
  104. * unchanged lines
  105. */
  106. #define _NOCHANGE -1
  107. /*
  108. * this value is used in the oldindex field to mark lines created by insertions
  109. * and scrolls.
  110. */
  111. #define _NEWINDEX -1
  112. /*
  113. typedef struct screen SCREEN;
  114. typedef struct _win_st WINDOW;
  115. */
  116. typedef chtype attr_t;
  117. struct ldat
  118. {
  119. chtype *text;
  120. short firstchar;
  121. short lastchar;
  122. short oldindex;
  123. };
  124. struct _win_st
  125. {
  126. short _cury, _curx;
  127. short _maxy, _maxx;
  128. short _begy, _begx;
  129. short _flags;
  130. attr_t _attrs;
  131. chtype _bkgd;
  132. bool _notimeout;
  133. bool _clear;
  134. bool _leaveok;
  135. bool _scroll;
  136. bool _idlok;
  137. bool _idcok;
  138. bool _immed;
  139. bool _sync;
  140. bool _use_keypad;
  141. int _delay;
  142. struct ldat *_line;
  143. short _regtop;
  144. short _regbottom;
  145. int _parx;
  146. int _pary;
  147. WINDOW *_parent;
  148. struct pdat
  149. {
  150. short _pad_y, _pad_x;
  151. short _pad_top, _pad_left;
  152. short _pad_bottom, _pad_right;
  153. } _pad;
  154. short _yoffset;
  155. };
  156. extern WINDOW *stdscr;
  157. extern WINDOW *curscr;
  158. extern WINDOW *newscr;
  159. extern int LINES;
  160. extern int COLS;
  161. extern int TABSIZE;
  162. /*
  163. * This global was an undocumented feature under AIX curses.
  164. */
  165. extern int ESCDELAY;
  166. extern int define_key (char *, int);
  167. extern int keyok (int, bool);
  168. extern int resizeterm (int, int);
  169. extern int use_default_colors (void);
  170. extern int wresize (WINDOW *, int, int);
  171. /*
  172. extern char ttytype[];
  173. */
  174. extern int baudrate(void);
  175. extern int beep(void);
  176. extern bool can_change_color(void);
  177. extern int cbreak(void);
  178. extern int clearok(WINDOW *,bool);
  179. extern int color_content(short,short*,short*,short*);
  180. extern int copywin(const WINDOW*,WINDOW*,int,int,int,int,int,int,int);
  181. extern int curs_set(int);
  182. extern int def_prog_mode(void);
  183. extern int def_shell_mode(void);
  184. extern int delay_output(int);
  185. extern void delscreen(SCREEN *);
  186. extern int delwin(WINDOW *);
  187. extern WINDOW *derwin(WINDOW *,int,int,int,int);
  188. extern int doupdate(void);
  189. extern WINDOW *dupwin(WINDOW *);
  190. extern int echo(void);
  191. extern int endwin(void);
  192. extern char erasechar(void);
  193. extern void filter(void);
  194. extern int flash(void);
  195. extern int flushinp(void);
  196. extern WINDOW *getwin(FILE *);
  197. extern int halfdelay(int);
  198. extern bool has_colors(void);
  199. extern int has_ic(void);
  200. extern int has_il(void);
  201. extern void idcok(WINDOW *, bool);
  202. extern int idlok(WINDOW *, bool);
  203. extern void immedok(WINDOW *, bool);
  204. extern WINDOW *initscr(void);
  205. extern int init_color(short,short,short,short);
  206. extern int init_pair(short,short,short);
  207. extern int intrflush(WINDOW *,bool);
  208. extern int isendwin(void);
  209. extern int is_linetouched(WINDOW *,int);
  210. extern int is_wintouched(WINDOW *);
  211. extern const char *keyname(int);
  212. extern int keypad(WINDOW *,bool);
  213. extern char killchar(void);
  214. extern int leaveok(WINDOW *,bool);
  215. extern char *longname(void);
  216. extern int meta(WINDOW *,bool);
  217. extern int mvcur(int,int,int,int);
  218. extern int mvderwin(WINDOW *, int, int);
  219. /*
  220. extern int mvprintw(int,int,const char *,...)
  221. GCC_PRINTFLIKE(3,4);
  222. extern int mvscanw(int,int,const char *,...)
  223. GCC_SCANFLIKE(3,4);
  224. */
  225. extern int mvwin(WINDOW *,int,int);
  226. /*
  227. extern int mvwprintw(WINDOW*,int,int,const char *,...)
  228. GCC_PRINTFLIKE(4,5);
  229. extern int mvwscanw(WINDOW *,int,int,const char *,...)
  230. GCC_SCANFLIKE(4,5);
  231. */
  232. extern int napms(int);
  233. extern WINDOW *newpad(int,int);
  234. extern SCREEN *newterm(const char *,FILE *,FILE *);
  235. extern WINDOW *newwin(int,int,int,int);
  236. extern int nl(void);
  237. extern int nocbreak(void);
  238. extern int nodelay(WINDOW *,bool);
  239. extern int noecho(void);
  240. extern int nonl(void);
  241. extern int noqiflush(void);
  242. extern int noraw(void);
  243. extern int notimeout(WINDOW *,bool);
  244. extern int overlay(const WINDOW*,WINDOW *);
  245. extern int overwrite(const WINDOW*,WINDOW *);
  246. extern int pair_content(short,short*,short*);
  247. extern int pechochar(WINDOW *, const chtype);
  248. extern int pnoutrefresh(WINDOW*,int,int,int,int,int,int);
  249. extern int prefresh(WINDOW *,int,int,int,int,int,int);
  250. /*
  251. extern int printw(const char *,...)
  252. GCC_PRINTFLIKE(1,2);
  253. */
  254. extern int putp(const char *);
  255. extern int putwin(WINDOW *, FILE *);
  256. extern int qiflush(void);
  257. extern int raw(void);
  258. extern int resetty(void);
  259. extern int reset_prog_mode(void);
  260. extern int reset_shell_mode(void);
  261. extern int ripoffline(int, int (*init)(WINDOW *, int));
  262. extern int savetty(void);
  263. /*
  264. extern int scanw(const char *,...)
  265. GCC_SCANFLIKE(1,2);
  266. */
  267. extern int scr_dump(const char *);
  268. extern int scr_init(const char *);
  269. extern int scrollok(WINDOW *,bool);
  270. extern int scr_restore(const char *);
  271. extern int scr_set(const char *);
  272. extern SCREEN *set_term(SCREEN *);
  273. extern int slk_attroff(const attr_t);
  274. extern int slk_attron(const attr_t);
  275. extern int slk_attrset(const attr_t);
  276. extern attr_t slk_attr(void);
  277. extern int slk_clear(void);
  278. extern int slk_init(int);
  279. extern char *slk_label(int);
  280. extern int slk_noutrefresh(void);
  281. extern int slk_refresh(void);
  282. extern int slk_restore(void);
  283. extern int slk_set(int,const char *,int);
  284. extern int slk_touch(void);
  285. extern int start_color(void);
  286. extern WINDOW *subpad(WINDOW *, int, int, int, int);
  287. extern WINDOW *subwin(WINDOW *,int,int,int,int);
  288. extern int syncok(WINDOW *, bool);
  289. extern chtype termattrs(void);
  290. extern char *termname(void);
  291. extern int tigetflag(const char *);
  292. extern int tigetnum(const char *);
  293. extern char *tigetstr(const char *);
  294. extern int typeahead(int);
  295. extern int ungetch(int);
  296. extern void use_env(bool);
  297. extern int vidattr(chtype);
  298. extern int vidputs(chtype, int (*)(int));
  299. extern int vwprintw(WINDOW *,const char *,va_list);
  300. extern int vwscanw(WINDOW *,const char *,va_list);
  301. extern int waddch(WINDOW *, const chtype);
  302. extern int waddchnstr(WINDOW *,const chtype *const,int);
  303. extern int waddnstr(WINDOW *,const char *const,int);
  304. extern int wattr_on(WINDOW *, const attr_t);
  305. extern int wattr_off(WINDOW *, const attr_t);
  306. extern int wbkgd(WINDOW *,const chtype);
  307. extern void wbkgdset(WINDOW *,chtype);
  308. extern int wborder(WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);
  309. extern int wchgat(WINDOW *, int, attr_t, short, const void *);
  310. extern int wclear(WINDOW *);
  311. extern int wclrtobot(WINDOW *);
  312. extern int wclrtoeol(WINDOW *);
  313. extern void wcursyncup(WINDOW *);
  314. extern int wdelch(WINDOW *);
  315. extern int wechochar(WINDOW *, const chtype);
  316. extern int werase(WINDOW *);
  317. extern int wgetch(WINDOW *);
  318. extern int wgetnstr(WINDOW *,char *,int);
  319. extern int whline(WINDOW *, chtype, int);
  320. extern int winchnstr(WINDOW *, chtype *, int);
  321. extern int winnstr(WINDOW *, char *, int);
  322. extern int winsch(WINDOW *, chtype);
  323. extern int winsdelln(WINDOW *,int);
  324. extern int winsnstr(WINDOW *, const char *,int);
  325. extern int wmove(WINDOW *,int,int);
  326. extern int wnoutrefresh(WINDOW *);
  327. /*
  328. extern int wprintw(WINDOW *,const char *,...)
  329. GCC_PRINTFLIKE(2,3);
  330. */
  331. extern int wredrawln(WINDOW *,int,int);
  332. extern int wrefresh(WINDOW *);
  333. /*
  334. extern int wscanw(WINDOW *,const char *,...)
  335. GCC_SCANFLIKE(2,3);
  336. */
  337. extern int wscrl(WINDOW *,int);
  338. extern int wsetscrreg(WINDOW *,int,int);
  339. extern void wsyncdown(WINDOW *);
  340. extern void wsyncup(WINDOW *);
  341. extern int wtimeout(WINDOW *,int);
  342. extern int wtouchln(WINDOW *,int,int,int);
  343. extern int wvline(WINDOW *,chtype,int);
  344. #define NCURSES_BITS(mask,shift) ((mask) << ((shift) + 8))
  345. #define A_NORMAL 0L
  346. /*
  347. #define A_ATTRIBUTES NCURSES_BITS(~(1UL - 1UL),0)
  348. */
  349. #define A_CHARTEXT (NCURSES_BITS(1UL,0) - 1UL)
  350. #define A_COLOR NCURSES_BITS(((1UL) << 8) - 1UL,0)
  351. #define A_STANDOUT NCURSES_BITS(1UL,8)
  352. #define A_UNDERLINE NCURSES_BITS(1UL,9)
  353. #define A_REVERSE NCURSES_BITS(1UL,10)
  354. #define A_BLINK NCURSES_BITS(1UL,11)
  355. #define A_DIM NCURSES_BITS(1UL,12)
  356. #define A_BOLD NCURSES_BITS(1UL,13)
  357. #define A_ALTCHARSET NCURSES_BITS(1UL,14)
  358. #define A_INVIS NCURSES_BITS(1UL,15)
  359. #define A_PROTECT NCURSES_BITS(1UL,16)
  360. #define A_HORIZONTAL NCURSES_BITS(1UL,17)
  361. #define A_LEFT NCURSES_BITS(1UL,18)
  362. #define A_LOW NCURSES_BITS(1UL,19)
  363. #define A_RIGHT NCURSES_BITS(1UL,20)
  364. #define A_TOP NCURSES_BITS(1UL,21)
  365. #define A_VERTICAL NCURSES_BITS(1UL,22)
  366. #define COLOR_PAIR(n) NCURSES_BITS(n, 0)
  367. #define PAIR_NUMBER(a) (((a) & A_COLOR) >> 8)
  368. /*
  369. * pseudo functions
  370. */
  371. #define wgetstr(w, s) wgetnstr(w, s, -1)
  372. #define getnstr(s, n) wgetnstr(stdscr, s, n)
  373. #define setterm(term) setupterm(term, 1, (int *)0)
  374. #define fixterm() reset_prog_mode()
  375. #define resetterm() reset_shell_mode()
  376. #define saveterm() def_prog_mode()
  377. #define crmode() cbreak()
  378. #define nocrmode() nocbreak()
  379. /*
  380. #define getyx(win,y,x) (y = (win)?(win)->_cury:ERR, x = (win)?(win)->_curx:ERR)
  381. #define getbegyx(win,y,x) (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR)
  382. #define getmaxyx(win,y,x) (y = (win)?((win)->_maxy + 1):ERR, x = (win)?((win)->_maxx + 1):ERR)
  383. #define getparyx(win,y,x) (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR)
  384. */
  385. #define getsyx(y,x) getyx(stdscr, y, x)
  386. /*
  387. #define setsyx(y,x) (stdscr->_cury = y, stdscr->_curx = x)
  388. */
  389. #define getattrs(win) ((win)?(win)->_attrs:A_NORMAL)
  390. #define getcurx(win) ((win)?(win)->_curx:ERR)
  391. #define getcury(win) ((win)?(win)->_cury:ERR)
  392. #define getbegx(win) ((win)?(win)->_begx:ERR)
  393. #define getbegy(win) ((win)?(win)->_begy:ERR)
  394. #define getmaxx(win) ((win)?((win)->_maxx + 1):ERR)
  395. #define getmaxy(win) ((win)?((win)->_maxy + 1):ERR)
  396. #define getparx(win) ((win)?(win)->_parx:ERR)
  397. #define getpary(win) ((win)?(win)->_pary:ERR)
  398. /*
  399. #define winch(win) ((win)?(win)->_line[(win)->_cury].text[(win)->_curx]:0)
  400. */
  401. #define wstandout(win) (wattr_set(win,A_STANDOUT))
  402. #define wstandend(win) (wattr_set(win,A_NORMAL))
  403. /*
  404. #define wattr_set(win,at) ((win)?((win)->_attrs = (at)):0)
  405. */
  406. #define wattron(win,at) wattr_on(win, at)
  407. #define wattroff(win,at) wattr_off(win, at)
  408. #define wattrset(win,at) wattr_set(win, at)
  409. #define scroll(win) wscrl(win,1)
  410. #define touchwin(win) wtouchln((win), 0, getmaxy(win), 1)
  411. #define touchline(win, s, c) wtouchln((win), s, c, 1)
  412. #define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0)
  413. #define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0)
  414. #define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
  415. #define hline(ch, n) whline(stdscr, ch, n)
  416. #define vline(ch, n) wvline(stdscr, ch, n)
  417. #define winstr(w, s) winnstr(w, s, -1)
  418. #define winchstr(w, s) winchnstr(w, s, -1)
  419. #define winsstr(w, s) winsnstr(w, s, -1)
  420. #define redrawwin(w) wredrawln(w, 0, w->_maxy+1)
  421. #define waddstr(win,str) waddnstr(win,st,-1)
  422. #define waddchstr(win,st) waddchnstr(win,st,-1)
  423. /*
  424. * pseudo functions for standard screen
  425. */
  426. #define addch(ch) waddch(stdscr,ch)
  427. #define addchnstr(st,n) waddchnstr(stdscr,st,n)
  428. #define addchstr(st) waddchstr(stdscr,st)
  429. #define addnstr(st,n) waddnstr(stdscr,st,n)
  430. #define addstr(st) waddnstr(stdscr,st,-1)
  431. #define attroff(at) wattroff(stdscr,at)
  432. #define attron(at) wattron(stdscr,at)
  433. #define attrset(at) wattrset(stdscr,at)
  434. #define bkgd(ch) wbkgd(stdscr,ch)
  435. #define bkgdset(ch) wbkgdset(stdscr,ch)
  436. #define clear() wclear(stdscr)
  437. #define clrtobot() wclrtobot(stdscr)
  438. #define clrtoeol() wclrtoeol(stdscr)
  439. #define delch() wdelch(stdscr)
  440. #define deleteln() winsdelln(stdscr,-1)
  441. #define echochar(c) wechochar(stdscr,c)
  442. #define erase() werase(stdscr)
  443. #define getch() wgetch(stdscr)
  444. #define getstr(st) wgetstr(stdscr,st)
  445. #define inch() winch(stdscr)
  446. #define inchnstr(s,n) winchnstr(stdscr,s,n)
  447. #define inchstr(s) winchstr(stdscr,s)
  448. #define innstr(s,n) winnstr(stdscr,s,n)
  449. #define insch(c) winsch(stdscr,c)
  450. #define insdelln(n) winsdelln(stdscr,n)
  451. #define insertln() winsdelln(stdscr,1)
  452. #define insnstr(s,n) winsnstr(stdscr,s,n)
  453. #define insstr(s) winsstr(stdscr,s)
  454. #define instr(s) winstr(stdscr,s)
  455. #define move(y,x) wmove(stdscr,y,x)
  456. #define refresh() wrefresh(stdscr)
  457. #define scrl(n) wscrl(stdscr,n)
  458. #define setscrreg(t,b) wsetscrreg(stdscr,t,b)
  459. #define standend() wstandend(stdscr)
  460. #define standout() wstandout(stdscr)
  461. #define timeout(delay) wtimeout(stdscr,delay)
  462. #define wdeleteln(win) winsdelln(win,-1)
  463. #define winsertln(win) winsdelln(win,1)
  464. /*
  465. * mv functions
  466. */
  467. /*
  468. #define mvwaddch(win,y,x,ch) (wmove(win,y,x) == ERR ? ERR : waddch(win,ch))
  469. #define mvwaddchnstr(win,y,x,st,n) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,st,n))
  470. #define mvwaddchstr(win,y,x,st) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,st,-1))
  471. #define mvwaddnstr(win,y,x,st,n) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,st,n))
  472. #define mvwaddstr(win,y,x,st) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,st,-1))
  473. #define mvwdelch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wdelch(win))
  474. #define mvwgetch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wgetch(win))
  475. #define mvwgetnstr(win,y,x,st,n) (wmove(win,y,x) == ERR ? ERR : wgetnstr(win,st,n))
  476. #define mvwgetstr(win,y,x,st) (wmove(win,y,x) == ERR ? ERR : wgetstr(win,st))
  477. #define mvwhline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline(win,c,n))
  478. #define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? (chtype)ERR : winch(win))
  479. #define mvwinchnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n))
  480. #define mvwinchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winchstr(win,s))
  481. #define mvwinnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n))
  482. #define mvwinsch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winsch(win,c))
  483. #define mvwinsnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n))
  484. #define mvwinsstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winsstr(win,s))
  485. #define mvwinstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winstr(win,s))
  486. #define mvwvline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline(win,c,n))
  487. */
  488. #define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)
  489. #define mvaddchnstr(y,x,st,n) mvwaddchnstr(stdscr,y,x,st,n)
  490. #define mvaddchstr(y,x,st) mvwaddchstr(stdscr,y,x,st)
  491. #define mvaddnstr(y,x,st,n) mvwaddnstr(stdscr,y,x,st,n)
  492. #define mvaddstr(y,x,st) mvwaddstr(stdscr,y,x,st)
  493. #define mvdelch(y,x) mvwdelch(stdscr,y,x)
  494. #define mvgetch(y,x) mvwgetch(stdscr,y,x)
  495. #define mvgetnstr(y,x,st,n) mvwgetnstr(stdscr,y,x,st,n)
  496. #define mvgetstr(y,x,st) mvwgetstr(stdscr,y,x,st)
  497. #define mvhline(y,x,c,n) mvwhline(stdscr,y,x,c,n)
  498. #define mvinch(y,x) mvwinch(stdscr,y,x)
  499. #define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,y,x,s,n)
  500. #define mvinchstr(y,x,s) mvwinchstr(stdscr,y,x,s)
  501. #define mvinnstr(y,x,s,n) mvwinnstr(stdscr,y,x,s,n)
  502. #define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c)
  503. #define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,y,x,s,n)
  504. #define mvinsstr(y,x,s) mvwinsstr(stdscr,y,x,s)
  505. #define mvinstr(y,x,s) mvwinstr(stdscr,y,x,s)
  506. #define mvvline(y,x,c,n) mvwvline(stdscr,y,x,c,n)
  507. #define add_wch(c) wadd_wch(stsdscr,c)
  508. #define addnwstr(wstr,n) waddnwstr(stdscr,wstr,n)
  509. #define addwstr(wstr,n) waddnwstr(stdscr,wstr,-1)
  510. #define attr_get() wattr_get(stdscr)
  511. #define attr_off(a) wattr_off(stdscr,a)
  512. #define attr_on(a) wattr_on(stdscr,a)
  513. #define attr_set(a) wattr_set(stdscr,a)
  514. #define box_set(w,v,h) wborder_set(w,v,v,h,h,0,0,0,9)
  515. #define chgat(n,a,c,o) wchgat(stdscr,n,a,c,o)
  516. #define echo_wchar(c) wecho_wchar(stdscr,c)
  517. #define getbkgd(win) ((win)->_bkgd)
  518. #define get_wch(c) wget_wch(stdscr,c)
  519. #define get_wstr(t) wgetn_wstr(stdscr,t,-1)
  520. #define getn_wstr(t,n) wgetn_wstr(stdscr,t,n)
  521. #define hline_set(c,n) whline_set(stdscr,c,n)
  522. #define in_wch(c) win_wch(stdscr,c)
  523. #define in_wchnstr(c,n) win_wchnstr(stdscr,c,n)
  524. #define in_wchstr(c) win_wchnstr(stdscr,c,-1)
  525. #define innwstr(c,n) winnwstr(stdscr,c,n)
  526. #define ins_nwstr(t,n) wins_nwstr(stdscr,t,n)
  527. #define ins_wch(c) wins_wch(stdscr,c)
  528. #define ins_wstr(t) wins_nwstr(stdscr,t,-1)
  529. #define inwstr(c) winnwstr(stdscr,c,-1)
  530. #define mvadd_wch(y,x,c) mvwadd_wch(stdscr,y,x,c)
  531. #define mvaddnwstr(y,x,wstr,n) mvwaddnwstr(stdscr,y,x,wstr,n)
  532. #define mvaddwstr(y,x,wstr,n) mvwaddnwstr(stdscr,y,x,wstr,-1)
  533. #define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,y,x,n,a,c,o)
  534. #define mvget_wch(y,x,c) mvwget_wch(stdscr,y,x,c)
  535. #define mvget_wstr(y,x,t) mvwgetn_wstr(stdscr,y,x,t,-1)
  536. #define mvgetn_wstr(y,x,t,n) mvwgetn_wstr(stdscr,y,x,t,n)
  537. #define mvhline_set(y,x,c,n) mvwhline_set(stdscr,y,x,c,n)
  538. #define mvin_wch(y,x,c) mvwin_wch(stdscr,y,x,c)
  539. #define mvin_wchnstr(y,x,c,n) mvwin_wchnstr(stdscr,y,x,c,n)
  540. #define mvin_wchstr(y,x,c) mvwin_wchnstr(stdscr,y,x,c,-1)
  541. #define mvinnwstr(y,x,c,n) mvwinnwstr(stdscr,y,x,c,n)
  542. #define mvins_nwstr(y,x,t,n) mvwins_nwstr(stdscr,y,x,t,n)
  543. #define mvins_wch(y,x,c) mvwins_wch(stdscr,y,x,c)
  544. #define mvins_wstr(y,x,t) mvwins_nwstr(stdscr,y,x,t,-1)
  545. #define mvinwstr(y,x,c) mvwinnwstr(stdscr,y,x,c,-1)
  546. #define mvvline_set(y,x,c,n) mvwvline_set(stdscr,y,x,c,n)
  547. /*
  548. #define mvwadd_wch(y,x,win,c) (wmove(win,y,x) == ERR ? ERR : wadd_wch(stsdscr,c))
  549. #define mvwaddnwstr(y,x,win,wstr,n) (wmove(win,y,x) == ERR ? ERR : waddnwstr(stdscr,wstr,n))
  550. #define mvwaddwstr(y,x,win,wstr,n) (wmove(win,y,x) == ERR ? ERR : waddnwstr(stdscr,wstr,-1))
  551. #define mvwchgat(win,y,x,n,a,c,o) (wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o))
  552. #define mvwget_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : wget_wch(win,n))
  553. #define mvwget_wstr(win,y,x,t) (wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,-1))
  554. #define mvwgetn_wstr(win,y,x,t,n) (wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,n))
  555. #define mvwhline_set(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline_set(win,c,n))
  556. #define mvwin_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : win_wch(win,c))
  557. #define mvwin_wchnstr(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : win_wchnstr(stdscr,c,n))
  558. #define mvwin_wchstr(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : win_wchnstr(stdscr,c,-1))
  559. #define mvwinnwstr(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : winnwstr(stdscr,c,n))
  560. #define mvwins_nwstr(win,y,x,t,n) (wmove(win,y,x) == ERR ? ERR : wins_nwstr(stdscr,t,n))
  561. #define mvwins_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : wins_wch(c))
  562. #define mvwins_wstr(win,y,x,t) (wmove(win,y,x) == ERR ? ERR : wins_nwstr(stdscr,t,-1))
  563. #define mvwinwstr(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winnwstr(stdscr,c,-1))
  564. #define mvwvline_set(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline_set(win,c,n))
  565. */
  566. #define slk_attr_off(a) slk_attroff(a)
  567. #define slk_attr_on(a) slk_attron(a)
  568. #define slk_attr_set(a) slk_attrset(a)
  569. #define vid_attr(a) vidattr(a)
  570. #define vline_set(c,n) vhline_set(stdscr,c,n)
  571. #define waddwstr(win,wstr,n) waddnwstr(win,wstr,-1)
  572. #define wattr_get(win) ((win)->_attrs)
  573. #define wget_wstr(w,t) wgetn_wstr(w,t,-1)
  574. #define win_wchstr(w,c) win_wchnstr(w,c,-1)
  575. #define wins_wstr(w,t) wins_nwstr(w,t,-1)
  576. #define winwstr(w,c) winnwstr(w,c,-1)
  577. /*
  578. * Pseudo-character tokens outside ASCII range. The curses wgetch() function
  579. * will return any given one of these only if the corresponding k- capability
  580. * is defined in your terminal's terminfo entry.
  581. */
  582. #define KEY_CODE_YES 0400
  583. #define KEY_MIN 0401
  584. #define KEY_BREAK 0401
  585. #define KEY_DOWN 0402
  586. #define KEY_UP 0403
  587. #define KEY_LEFT 0404
  588. #define KEY_RIGHT 0405
  589. #define KEY_HOME 0406
  590. #define KEY_BACKSPACE 0407
  591. #define KEY_F0 0410
  592. #define KEY_F(n) (KEY_F0+(n))
  593. #define KEY_DL 0510
  594. #define KEY_IL 0511
  595. #define KEY_DC 0512
  596. #define KEY_IC 0513
  597. #define KEY_EIC 0514
  598. #define KEY_CLEAR 0515
  599. #define KEY_EOS 0516
  600. #define KEY_EOL 0517
  601. #define KEY_SF 0520
  602. #define KEY_SR 0521
  603. #define KEY_NPAGE 0522
  604. #define KEY_PPAGE 0523
  605. #define KEY_STAB 0524
  606. #define KEY_CTAB 0525
  607. #define KEY_CATAB 0526
  608. #define KEY_ENTER 0527
  609. #define KEY_SRESET 0530
  610. #define KEY_RESET 0531
  611. #define KEY_PRINT 0532
  612. #define KEY_LL 0533
  613. #define KEY_A1 0534
  614. #define KEY_A3 0535
  615. #define KEY_B2 0536
  616. #define KEY_C1 0537
  617. #define KEY_C3 0540
  618. #define KEY_BTAB 0541
  619. #define KEY_BEG 0542
  620. #define KEY_CANCEL 0543
  621. #define KEY_CLOSE 0544
  622. #define KEY_COMMAND 0545
  623. #define KEY_COPY 0546
  624. #define KEY_CREATE 0547
  625. #define KEY_END 0550
  626. #define KEY_EXIT 0551
  627. #define KEY_FIND 0552
  628. #define KEY_HELP 0553
  629. #define KEY_MARK 0554
  630. #define KEY_MESSAGE 0555
  631. #define KEY_MOVE 0556
  632. #define KEY_NEXT 0557
  633. #define KEY_OPEN 0560
  634. #define KEY_OPTIONS 0561
  635. #define KEY_PREVIOUS 0562
  636. #define KEY_REDO 0563
  637. #define KEY_REFERENCE 0564
  638. #define KEY_REFRESH 0565
  639. #define KEY_REPLACE 0566
  640. #define KEY_RESTART 0567
  641. #define KEY_RESUME 0570
  642. #define KEY_SAVE 0571
  643. #define KEY_SBEG 0572
  644. #define KEY_SCANCEL 0573
  645. #define KEY_SCOMMAND 0574
  646. #define KEY_SCOPY 0575
  647. #define KEY_SCREATE 0576
  648. #define KEY_SDC 0577
  649. #define KEY_SDL 0600
  650. #define KEY_SELECT 0601
  651. #define KEY_SEND 0602
  652. #define KEY_SEOL 0603
  653. #define KEY_SEXIT 0604
  654. #define KEY_SFIND 0605
  655. #define KEY_SHELP 0606
  656. #define KEY_SHOME 0607
  657. #define KEY_SIC 0610
  658. #define KEY_SLEFT 0611
  659. #define KEY_SMESSAGE 0612
  660. #define KEY_SMOVE 0613
  661. #define KEY_SNEXT 0614
  662. #define KEY_SOPTIONS 0615
  663. #define KEY_SPREVIOUS 0616
  664. #define KEY_SPRINT 0617
  665. #define KEY_SREDO 0620
  666. #define KEY_SREPLACE 0621
  667. #define KEY_SRIGHT 0622
  668. #define KEY_SRSUME 0623
  669. #define KEY_SSAVE 0624
  670. #define KEY_SSUSPEND 0625
  671. #define KEY_SUNDO 0626
  672. #define KEY_SUSPEND 0627
  673. #define KEY_UNDO 0630
  674. #define KEY_MOUSE 0631
  675. #define KEY_RESIZE 0632
  676. #define KEY_MAX 0777
  677. extern int mcprint(char *, int);
  678. extern int has_key(int);