1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 23 */ 24 25 /* Copyright (c) 1988 AT&T */ 26 /* All Rights Reserved */ 27 28 /* 29 * University Copyright- Copyright (c) 1982, 1986, 1988 30 * The Regents of the University of California 31 * All Rights Reserved 32 * 33 * University Acknowledgment- Portions of this document are derived from 34 * software developed by the University of California, Berkeley, and its 35 * contributors. 36 */ 37 #ifndef _CURSES_H 38 #define _CURSES_H 39 40 /* 41 * curses.h - this file is automatically made from caps and 42 * curses.ed. Don't make changes directly to curses.h! 43 */ 44 45 #include <widec.h> 46 47 #include <stdio.h> 48 49 #ifdef __cplusplus 50 extern "C" { 51 #endif 52 53 #define CSMAX 4 54 55 /* 56 * This trick is used to distinguish between SYSV and V7 systems. 57 * We assume that L_ctermid is only defined in stdio.h in SYSV 58 * systems, but not in V7 or Berkeley UNIX. 59 */ 60 #ifdef L_ctermid 61 #ifdef SYSV 62 #undef SYSV 63 #endif 64 #define SYSV 65 #endif 66 /* Some V7 systems define L_ctermid - we list those here */ 67 #ifdef BSD 68 #undef SYSV 69 #endif 70 71 #ifdef SYSV 72 73 #include <termio.h> 74 typedef struct termio SGTTY; 75 typedef struct termios SGTTYS; 76 77 #else /* !SYSV */ 78 79 #ifndef _SGTTYB_ 80 #include <sgtty.h> 81 #endif /* _SGTTYB_ */ 82 typedef struct sgttyb SGTTY; 83 84 #endif /* SYSV */ 85 86 /* 87 * bool is a built-in type in standard C++ and as such is not 88 * defined here when using standard C++. However, the GNU compiler 89 * fixincludes utility nonetheless creates it's own version of this 90 * header for use by gcc and g++. In that version it adds a redundant 91 * guard for __cplusplus. To avoid the creation of a gcc/g++ specific 92 * header we need to include the following magic comment: 93 * 94 * we must use the C++ compiler's type 95 * 96 * The above comment should not be removed or changed until GNU 97 * gcc/fixinc/inclhack.def is updated to bypass this header. 98 */ 99 #if !defined(__cplusplus) && !defined(_BOOL) 100 typedef char bool; 101 #endif /* !defined(__cplusplus) && !defined(_BOOL) */ 102 103 #define _VR3_COMPAT_CODE 104 /* 105 * chtype is the type used to store a character together with attributes. 106 * It can be set to "char" to save space, or "long" to get more attributes. 107 */ 108 #ifdef CHTYPE 109 typedef CHTYPE chtype; 110 #else 111 #ifdef _LP64 112 typedef unsigned int chtype; 113 #else 114 typedef unsigned long chtype; 115 #endif /* _LP64 */ 116 #endif /* CHTYPE */ 117 118 /* 119 * Define for the 'old' definition of chtype is required 120 * when we are running in compatibility mode 121 */ 122 #ifdef _VR3_COMPAT_CODE 123 typedef unsigned short _ochtype; 124 #endif 125 126 /* TRUE and FALSE get defined so many times, */ 127 /* let's not get in the way of other definitions. */ 128 #if !defined(TRUE) || ((TRUE) != 1) 129 #define TRUE (1) 130 #endif 131 #if !defined(FALSE) || ((FALSE) != 0) 132 #define FALSE (0) 133 #endif 134 #if !defined(ERR) || ((ERR) != -1) 135 #define ERR (-1) 136 #endif 137 #if !defined(OK) || ((OK) != 0) 138 #define OK (0) 139 #endif 140 141 /* short-hand notations */ 142 typedef struct _win_st WINDOW; 143 typedef struct screen SCREEN; 144 typedef struct _Mouse MOUSE_STATUS; 145 146 struct _win_st 147 { 148 short _cury, _curx; /* current coordinates */ 149 short _maxy, _maxx; /* max coordinates */ 150 short _begy, _begx; /* (0,0) screen coordinates */ 151 char _flags; 152 short _yoffset; /* actual begy is _begy+_yoffset */ 153 bool _clear, /* clearok() info */ 154 _leave, /* leaveok() info */ 155 _immed, /* window in immediate mode */ 156 _sync; /* auto syncup of parent */ 157 WINDOW *_padwin; /* "pad" area for current window */ 158 #ifdef _VR3_COMPAT_CODE 159 _ochtype **_y16; /* MUST stay at this offset in WINDOW */ 160 #endif 161 short *_firstch; /* first change in line */ 162 short *_lastch; /* last change in line */ 163 short _tmarg, _bmarg; /* scrolling region bounds */ 164 /* MUST stay at this offset in WINDOW */ 165 unsigned _scroll : 1; /* scrollok() info */ 166 unsigned _use_idl : 1; 167 unsigned _use_keypad : 1; 168 unsigned _notimeout : 1; 169 unsigned _use_idc : 1; 170 chtype _attrs; /* current window attributes */ 171 chtype _bkgd; /* background, normally blank */ 172 int _delay; /* delay period on wgetch */ 173 /* 0: for nodelay */ 174 /* <0: for infinite delay */ 175 /* >0: delay time in millisec */ 176 short _ndescs; /* number of descendants */ 177 short _parx, _pary; /* coords relative to parent (0,0) */ 178 WINDOW *_parent; /* the parent if this is a subwin */ 179 chtype **_y; /* lines of data */ 180 short _nbyte; /* number of bytes to come */ 181 short _index; /* index to hold coming char */ 182 char _waitc[CSMAX]; /* array to hold partial m-width char */ 183 bool _insmode; /* TRUE for inserting, */ 184 /* FALSE for adding */ 185 }; 186 187 /* _lastch is initially set to this, _firstch is set to win->_maxx */ 188 #define _NOCHANGE -1 189 #define _INFINITY 16000 /* no line can be longer than this */ 190 191 /* values for win->_flags */ 192 #define _ISPAD 001 193 #define _WINCHANGED 002 194 #define _WINMOVED 004 195 #define _WINSDEL 010 196 #define _CANT_BE_IMMED 020 197 #define _WIN_ADD_ONE 040 198 #define _WIN_INS_ONE 100 199 200 struct _Mouse { 201 int x, y; 202 short button[3]; 203 int changes; 204 }; 205 206 #define CURS_STUPID 0 207 #define CURS_UNKNOWN 1 208 #define CURS_BAD_MALLOC 2 209 210 /* 211 * Various tricks to shut up lint about things that are perfectly fine. 212 */ 213 #if defined(__lint) && !defined(CURSES) /* if not internal to curses source */ 214 struct screen { 215 int _nobody_; 216 }; 217 #endif /* __lint */ 218 219 /* common external variables */ 220 221 extern int LINES, COLS, TABSIZE, COLORS, COLOR_PAIRS; 222 223 extern short curs_errno; 224 225 extern WINDOW *stdscr, *curscr; 226 227 extern MOUSE_STATUS Mouse_status; 228 229 extern char ttytype[]; 230 231 extern char curs_parm_err[], 232 *curs_err_strings[]; 233 234 /* Function declarations */ 235 236 #ifdef _VR3_COMPAT_CODE 237 238 extern _ochtype *acs_map; 239 extern chtype *acs32map; 240 241 /* definitions for Vr3 source compatibility */ 242 243 #define initscr initscr32 244 #define newterm newterm32 245 #define waddch w32addch 246 #define wechochar w32echochar 247 #define pechochar p32echochar 248 #define winsch w32insch 249 #define vidputs vid32puts 250 #define vidattr vid32attr 251 #define wattroff w32attroff 252 #define wattron w32attron 253 #define wattrset w32attrset 254 #define acs_map acs32map 255 #define box box32 256 257 #ifdef __STDC__ 258 extern WINDOW *initscr(void); 259 extern SCREEN *newterm(char *, FILE *, FILE *); 260 #else 261 extern WINDOW *initscr(); 262 extern SCREEN *newterm(); 263 #endif 264 265 /* declarations for mini-curses */ 266 267 #ifdef __STDC__ 268 extern WINDOW *m_initscr(void); 269 270 extern SCREEN *m_newterm(char *, FILE *, FILE *); 271 272 extern int m_addch(int), m_addstr(char *), m_clear(void), m_erase(void), 273 m_move(int, int), m_refresh(void); 274 275 #else /* __STDC__ */ 276 extern WINDOW *m_initscr(); 277 278 extern SCREEN *m_newterm(); 279 280 extern int m_addch(), m_addstr(), m_clear(), m_erase(), 281 m_move(), m_refresh(); 282 283 #endif /* __STDC__ */ 284 285 #else /* _VR3_COMPAT_CODE */ 286 287 extern chtype *acs_map; 288 289 #endif /* _VR3_COMPAT_CODE */ 290 291 #ifdef __STDC__ 292 293 extern SCREEN *newscreen(char *, int, int, int, FILE *, FILE *); 294 extern SCREEN *setcurscreen(SCREEN *); 295 296 extern WINDOW *initscr(void); 297 extern WINDOW *newwin(int, int, int, int); 298 extern WINDOW *newpad(int, int); 299 extern WINDOW *derwin(WINDOW *, int, int, int, int); 300 extern WINDOW *dupwin(WINDOW *); 301 extern WINDOW *getwin(FILE *); 302 303 extern int wgetch(WINDOW *); /* it can return KEY_*, for instance. */ 304 305 extern char *longname(void); /* long name of terminal */ 306 extern char *termname(void); /* effective terminal name */ 307 extern char *keyname(int); /* name of token returned by wgetch() */ 308 extern char *slk_label(int); 309 extern char erasechar(void); 310 extern char killchar(void); 311 extern char *unctrl(int); 312 313 extern chtype termattrs(void); 314 315 extern void vidupdate(chtype, chtype, int (*)(char)); 316 extern void wsyncup(WINDOW *); 317 extern void wsyncdown(WINDOW *); 318 extern void delscreen(SCREEN *); 319 extern void curserr(void); 320 extern void _setqiflush(int); 321 extern void wcursyncup(WINDOW *); 322 323 extern int cbreak(void); 324 extern int nocbreak(void); 325 extern int reset_prog_mode(void); 326 extern int reset_shell_mode(void); 327 extern int def_prog_mode(void); 328 extern int _setecho(int); 329 extern int _setnonl(int); 330 extern int def_shell_mode(void); 331 extern int raw(void); 332 extern int savetty(void); 333 extern int traceon(void); 334 extern int _meta(int); 335 extern int traceoff(void); 336 extern int noraw(void); 337 extern int flushinp(void); 338 extern int _getsyx(int *, int *); 339 extern int _ring(bool); 340 extern int resetty(void); 341 extern int ripoffline(int, int (*)(WINDOW *, int)); 342 extern int setsyx(int, int); 343 extern int slk_refresh(void); 344 extern int slk_restore(void); 345 extern int wstandend(WINDOW *); 346 extern int wstandout(WINDOW *); 347 extern int wattroff(WINDOW *, chtype); 348 extern int wattron(WINDOW *, chtype); 349 extern int wattrset(WINDOW *, chtype); 350 extern int wrefresh(WINDOW *); 351 352 extern int copywin(WINDOW *, WINDOW *, int, int, int, int, int, int, int); 353 extern int curs_set(int); 354 extern int delay_output(int); 355 extern int delwin(WINDOW *); 356 extern int doupdate(void); 357 extern int drainio(int); 358 extern int endwin(void); 359 extern int isendwin(void); 360 extern int baudrate(void); 361 extern int has_ic(void); 362 extern int has_il(void); 363 extern int keypad(WINDOW *, bool); 364 extern int mvcur(int, int, int, int); 365 366 extern int mvprintw(int, int, ...); 367 extern int mvscanw(int, int, ...); 368 extern int mvwprintw(WINDOW *, int, int, ...); 369 extern int mvwscanw(WINDOW *, int, int, ...); 370 extern int printw(char *, ...); 371 extern int scanw(char *, ...); 372 extern int wprintw(WINDOW *, ...); 373 extern int wscanw(WINDOW *, ...); 374 375 /* __va_list is the ANSI-C safe definition of the */ 376 /* va_list type as allowed to be defined in stdlib.h. */ 377 /* <stdio.h> provides the nested include of <va_list.h> */ 378 /* which provides this namespace safe definition. */ 379 /* Either <stdarg.h> or <varargs.h> must be included to */ 380 /* use these interfaces. */ 381 382 extern int vwprintw(WINDOW *, char *, __va_list); 383 extern int vwscanw(WINDOW *, char *, __va_list); 384 385 extern int mvwin(WINDOW *, int, int); 386 extern int mvderwin(WINDOW *, int, int); 387 extern int napms(int); 388 extern int newkey(char *, short, bool); 389 extern int filter(void); 390 extern int pechochar(WINDOW *, chtype); 391 extern int pnoutrefresh(WINDOW *, int, int, int, int, int, int); 392 extern int prefresh(WINDOW *, int, int, int, int, int, int); 393 394 extern int putwin(WINDOW *, FILE *); 395 extern int wredrawln(WINDOW *, int, int); 396 extern int scr_dump(char *); 397 extern int setupterm(char *, int, int *); 398 399 extern int slk_attron(chtype); 400 extern int slk_attroff(chtype); 401 extern int slk_attrset(chtype); 402 extern int slk_clear(void); 403 extern int slk_noutrefresh(void); 404 extern int slk_set(int, char *, int); 405 extern int slk_start(int, int *); 406 extern int slk_touch(void); 407 extern int start_color(void); 408 extern int typeahead(int); 409 410 extern bool can_change_color(void); 411 extern bool has_colors(void); 412 413 extern int waddch(WINDOW *, chtype); 414 extern int waddchnstr(WINDOW *, chtype *, int); 415 extern int waddnstr(WINDOW *, char *, int); 416 extern int wbkgd(WINDOW *, chtype); 417 extern int wborder(WINDOW *, chtype, chtype, chtype, chtype, 418 chtype, chtype, chtype, chtype); 419 extern int wclrtobot(WINDOW *); 420 extern int wclrtoeol(WINDOW *); 421 extern int wdelch(WINDOW *); 422 extern int wechochar(WINDOW *, chtype); 423 extern int wgetstr(WINDOW *, char *); 424 extern int wgetnstr(WINDOW *, char *, int); 425 extern int whline(WINDOW *, chtype, int); 426 extern int wvline(WINDOW *, chtype, int); 427 extern int winchnstr(WINDOW *, chtype *, int); 428 extern int winchstr(WINDOW *, chtype *); 429 extern int winnstr(WINDOW *, char *, int); 430 extern int winsch(WINDOW *, chtype); 431 extern int winsdelln(WINDOW *, int); /* internal */ 432 extern int winsnstr(WINDOW *, char *, int); 433 extern int winstr(WINDOW *, char *); 434 extern int wmove(WINDOW *, int, int); 435 extern int wnoutrefresh(WINDOW *); 436 extern int wredrawln(WINDOW *, int, int); 437 extern int wscrl(WINDOW *, int); 438 extern int wsetscrreg(WINDOW *, int, int); 439 extern int wtouchln(WINDOW *, int, int, int); 440 441 extern int crmode(void); 442 extern int nocrmode(void); 443 extern int ungetch(int); 444 445 extern int mouse_set(long int); 446 extern int mouse_on(long int); 447 extern int mouse_off(long int); 448 extern int request_mouse_pos(void); 449 extern int map_button(unsigned long); 450 451 extern void wmouse_position(WINDOW *, int *, int *); 452 453 extern unsigned long getmouse(void), getbmap(void); 454 455 /* the following declarations take integers as arguments */ 456 /* to keep the CI5 compiler happy. what we really want */ 457 /* to pass is given in comments. (by the way, we don't */ 458 /* save anything by passing short or bool, since compiler */ 459 /* expands them to integers any way */ 460 461 extern int pair_content(short, short *, short *); 462 extern int color_content(short, short *, short *, short *); /* as above */ 463 extern int init_color(short, short, short, short); 464 extern int init_pair(short, short, short); 465 extern int idlok(WINDOW *, bool); 466 467 extern void immedok(WINDOW *, bool); 468 469 extern chtype winwch(WINDOW *); 470 471 extern int pechowchar(WINDOW *, chtype); 472 extern int ungetwch(const wchar_t); 473 extern int waddnwstr(WINDOW *, wchar_t *, int); 474 extern int waddwch(WINDOW *, chtype); 475 extern int waddwchnstr(WINDOW *, chtype *, int); 476 extern int wechowchar(WINDOW *, chtype); 477 extern int wgetnwstr(WINDOW *, wchar_t *, int); 478 extern int wgetwch(WINDOW *); 479 extern int wgetwstr(WINDOW *, wchar_t *); 480 extern int winnwstr(WINDOW *, wchar_t *, int); 481 extern int winsnwstr(WINDOW *, wchar_t *, int); 482 extern int winswch(WINDOW *, chtype); 483 extern int winwchnstr(WINDOW *, chtype *, int); 484 extern int winwstr(WINDOW *, wchar_t *); 485 486 #else /* __STDC__ */ 487 488 extern SCREEN *newscreen(), /* termname, lines, cols, tabsiz, fout, fin */ 489 *setcurscreen(); /* screenptr */ 490 491 extern WINDOW *initscr(), 492 *newwin(), /* nlines, ncols, begy, begx */ 493 *newpad(), /* nlines, ncols */ 494 *derwin(), /* orig, nlines, ncols, begy, begx */ 495 *dupwin(), /* orig */ 496 *getwin(); /* file */ 497 498 extern int wgetch(); /* because it can return KEY_*, for instance. */ 499 500 extern char *longname(), /* long name of terminal */ 501 *termname(), /* effective terminal name */ 502 *keyname(), /* (int) name of token returned by wgetch() */ 503 *slk_label(), /* index */ 504 erasechar(), 505 killchar(), 506 *unctrl(); 507 508 extern chtype termattrs(); 509 510 extern void vidupdate(), wsyncup(), wsyncdown(), 511 delkeymap(), 512 delscreen(), curserr(), 513 _setqiflush(), 514 immedok(), 515 wcursyncup(); 516 517 extern int cbreak(), nocbreak(), 518 reset_prog_mode(), reset_shell_mode(), def_prog_mode(), 519 _setecho(), _setnonl(), 520 def_shell_mode(), raw(), 521 savetty(), traceon(), _meta(), 522 traceoff(), noraw(), flushinp(), _getsyx(), 523 _ring(), resetty(), ripoffline(), setsyx(), slk_refresh(), 524 slk_restore(), wstandend(), wstandout(), 525 wattroff(), wattron(), wattrset(), wrefresh(); 526 527 extern int color_cont(), copywin(), curs_set(), delay_output(), delwin(), 528 doupdate(), drainio(), endwin(), isendwin(), 529 baudrate(), has_ic(), has_il(), idlok(), 530 init_color(), init_pair(), keypad(), mvcur(); 531 532 extern int mvprintw(), mvscanw(), mvwprintw(), mvwscanw(), 533 printw(), scanw(), wprintw(), wscanw(), vwprintw(), vwscanw(); 534 535 extern int mvwin(), mvderwin(), napms(), newkey(), filter(), 536 pair_content(), pechochar(), pnoutrefresh(), prefresh(); 537 538 extern int putwin(), wredrawln(), scr_dump(), setupterm(); 539 540 extern int slk_attrof(), slk_attrof(), slk_attrset(), 541 slk_clear(), slk_noutrefresh(), slk_set(), 542 slk_start(), slk_touch(), start_color(), 543 typeahead(); 544 545 extern bool can_change_color(), has_colors(); 546 547 extern int waddch(), waddchnstr(), waddnstr(), wbkgd(), 548 wborder(), wclrtobot(), wclrtoeol(), wdelch(), wechochar(), 549 wgetstr(), wgetnstr(), whline(), wvline(), winchnstr(), 550 winchstr(), winnstr(), winsch(), 551 winsdelln(), /* internal */ 552 winsnstr(), winstr(), wmove(), wnoutrefresh(), wredrawln(), 553 wscrl(), wsetscrreg(), wtouchln(); 554 555 extern int crmode(), nocrmode(), ungetch(); 556 557 extern int mouse_set(), mouse_on(), mouse_off(), 558 request_mouse_pos(), map_button(); 559 560 extern void wmouse_position(); 561 562 extern unsigned long getmouse(), getbmap(); 563 564 extern chtype winwch(); 565 566 extern int pechowchar(), ungetwch(), waddnwstr(), waddwch(), 567 waddwchnstr(), wechowchar(), wgetnwstr(), wgetwch(), 568 wgetwstr(), winnwstr(), winsnwstr(), winswch(), 569 winwchnstr(), winwstr(); 570 571 #endif /* __STDC__ */ 572 573 #define getsyx(y, x) _getsyx(&(y), &(x)) 574 575 /* 576 * Functions to get at the window structure. 577 */ 578 579 #define getyx(win, y, x) ((y) = getcury(win), (x) = getcurx(win)) 580 #define getbegyx(win, y, x) ((y) = getbegy(win), (x) = getbegx(win)) 581 #define getmaxyx(win, y, x) ((y) = getmaxy(win), (x) = getmaxx(win)) 582 #define getparyx(win, y, x) ((y) = getpary(win), (x) = getparx(win)) 583 584 #if defined(CURS_PERFORMANCE) && !defined(__lint) 585 #define getcury(win) ((win)->_cury) 586 #define getcurx(win) ((win)->_curx) 587 #define getbegy(win) ((win)->_begy) 588 #define getbegx(win) ((win)->_begx) 589 #define getmaxy(win) ((win)->_maxy) 590 #define getmaxx(win) ((win)->_maxx) 591 #define getpary(win) ((win)->_pary) 592 #define getparx(win) ((win)->_parx) 593 #define getbkgd(win) ((win)->_bkgd) 594 #define getattrs(win) ((win)->_attrs) 595 #else /* defined(CURS_PERFORMANCE) && !defined(__lint) */ 596 597 #ifdef __STDC__ 598 extern int getcury(WINDOW *); 599 extern int getcurx(WINDOW *); 600 extern int getbegy(WINDOW *); 601 extern int getbegx(WINDOW *); 602 extern int getmaxy(WINDOW *); 603 extern int getmaxx(WINDOW *); 604 extern int getpary(WINDOW *); 605 extern int getparx(WINDOW *); 606 607 extern chtype getbkgd(WINDOW *); 608 extern chtype getattrs(WINDOW *); 609 610 #else /* __STDC__ */ 611 extern int getcury(), getcurx(), getbegy(), getbegx(), 612 getmaxy(), getmaxx(), getpary(), getparx(); 613 614 extern chtype getbkgd(), getattrs(); 615 616 #endif /* __STDC__ */ 617 #endif /* defined(CURS_PERFORMANCE) && !defined(__lint) */ 618 619 #if defined(NOMACROS) || defined(__lint) 620 621 #ifdef __STDC__ 622 623 extern SCREEN *newterm(char *, FILE *, FILE *); 624 extern SCREEN *set_term(SCREEN *); 625 626 extern WINDOW *subpad(WINDOW *, int, int, int, int); 627 extern WINDOW *subwin(WINDOW *, int, int, int, int); 628 629 extern char *unctrl(int); 630 631 extern chtype inch(void); 632 extern chtype winch(WINDOW *); 633 extern chtype mvinch(int, int); 634 extern chtype mvwinch(WINDOW *, int, int); 635 636 extern int addch(chtype); 637 extern int addchnstr(chtype *, int); 638 extern int addchstr(chtype *); 639 extern int addnstr(char *, int); 640 extern int addstr(char *); 641 extern int attroff(chtype); 642 extern int attron(chtype); 643 extern int attrset(chtype); 644 extern int beep(void); 645 extern int bkgd(chtype); 646 extern int border(chtype, chtype, chtype, chtype, 647 chtype, chtype, chtype, chtype); 648 extern int box(WINDOW *, chtype, chtype); 649 extern int clear(void); 650 extern int clearok(WINDOW *, bool); 651 extern int clrtobot(void); 652 extern int clrtoeol(void); 653 extern int crmode(void); 654 extern int delch(void); 655 extern int deleteln(void); 656 extern int echo(void); 657 extern int echochar(chtype); 658 extern int erase(void); 659 extern int fixterm(void); 660 extern int flash(void); 661 extern int garbagedlines(WINDOW *, int, int); 662 extern int garbagedwin(WINDOW *); 663 extern int getch(void); 664 extern int getstr(char *); 665 extern int gettmode(void); 666 extern int halfdelay(int); 667 extern int hline(chtype, int); 668 extern int inchnstr(chtype *, int); 669 extern int inchstr(chtype *); 670 extern int innstr(char *, int); 671 extern int insch(chtype); 672 extern int insdelln(int); 673 extern int insertln(void); 674 extern int insnstr(char *, int); 675 extern int insstr(char *); 676 extern int instr(char *); 677 extern int intrflush(WINDOW *, int); 678 extern int is_linetouched(WINDOW *, int); 679 extern int is_wintouched(WINDOW *); 680 extern int leaveok(WINDOW *, bool); 681 extern int meta(WINDOW *, int); 682 extern int move(int, int); 683 extern int mvaddch(int, int, chtype); 684 extern int mvaddchnstr(int, int, chtype *, int); 685 extern int mvaddchstr(int, int, chtype *); 686 extern int mvaddnstr(int, int, char *, int); 687 extern int mvaddstr(int, int, char *); 688 extern int mvdelch(int, int); 689 extern int mvgetch(int, int); 690 extern int mvgetstr(int, int, char *); 691 extern int mvhline(int, int, chtype, int); 692 extern int mvinchnstr(int, int, chtype *, int); 693 extern int mvinchstr(int, int, chtype *); 694 extern int mvinnstr(int, int, char *, int); 695 extern int mvinsch(int, int, chtype); 696 extern int mvinsnstr(int, int, char *, int); 697 extern int mvinsstr(int, int, char *); 698 extern int mvinstr(int, int, char *); 699 extern int mvvline(int, int, chtype, int); 700 extern int mvwaddch(WINDOW *, int, int, chtype); 701 extern int mvwaddchnstr(WINDOW *, int, int, chtype *, int); 702 extern int mvwaddchstr(WINDOW *, int, int, chtype *); 703 extern int mvwaddnstr(WINDOW *, int, int, char *, int); 704 extern int mvwaddstr(WINDOW *, int, int, char *); 705 extern int mvwdelch(WINDOW *, int, int); 706 extern int mvwgetch(WINDOW *, int, int); 707 extern int mvwgetstr(WINDOW *, int, int, char *); 708 extern int mvwhline(WINDOW *, int, int, chtype, int); 709 extern int mvwinchnstr(WINDOW *, int, int, chtype *, int); 710 extern int mvwinchstr(WINDOW *, int, int, chtype *); 711 extern int mvwinnstr(WINDOW *, int, int, char *, int); 712 extern int mvwinsch(WINDOW *, int, int, chtype); 713 extern int mvwinsnstr(WINDOW *, int, int, char *, int); 714 extern int mvwinsstr(WINDOW *, int, int, char *); 715 extern int mvwinstr(WINDOW *, int, int, char *); 716 extern int mvwvline(WINDOW *, int, int, chtype, int); 717 extern int nl(void); 718 extern int nocrmode(void); 719 extern int nodelay(WINDOW *, bool); 720 extern int noecho(void); 721 extern int nonl(void); 722 extern int notimeout(WINDOW *, bool); 723 extern int overlay(WINDOW *, WINDOW *); 724 extern int overwrite(WINDOW *, WINDOW *); 725 extern int redrawwin(WINDOW *); 726 extern int refresh(void); 727 extern int resetterm(void); 728 extern int saveterm(void); 729 extern int scr_init(char *); 730 extern int scr_restore(char *); 731 extern int scr_set(char *); 732 extern int scrl(int); 733 extern int scroll(WINDOW *); 734 extern int scrollok(WINDOW *, bool); 735 extern int setscrreg(int, int); 736 extern int setterm(char *); 737 extern int slk_init(int); 738 extern int standend(void); 739 extern int standout(void); 740 extern int syncok(WINDOW *, bool); 741 extern int touchline(WINDOW *, int, int); 742 extern int touchwin(WINDOW *); 743 extern int untouchwin(WINDOW *); 744 extern int vline(chtype, int); 745 extern int waddchstr(WINDOW *, chtype *); 746 extern int waddstr(WINDOW *, char *); 747 extern int wclear(WINDOW *); 748 extern int wdeleteln(WINDOW *); 749 extern int werase(WINDOW *); 750 extern int winchstr(WINDOW *, chtype *); 751 extern int winsertln(WINDOW *); 752 extern int winsstr(WINDOW *, char *); 753 extern int winstr(WINDOW *, char *); 754 extern int wstandend(WINDOW *); 755 extern int wstandout(WINDOW *); 756 757 extern void bkgdset(chtype); 758 extern void idcok(WINDOW *, bool); 759 extern void noqiflush(void); 760 extern void wbkgdset(WINDOW *, chtype); 761 extern void qiflush(void); 762 extern void timeout(int); 763 extern void wtimeout(WINDOW *, int); 764 extern void use_env(int); /* int sb. char */ 765 766 extern chtype inwch(void); 767 extern chtype mvinwch(int, int); 768 extern chtype mvwinwch(WINDOW *, int, int); 769 770 extern int addnwstr(wchar_t *, int); 771 extern int addwch(chtype); 772 extern int addwchnstr(chtype *, int); 773 extern int addwchstr(chtype *); 774 extern int addwstr(wchar_t *); 775 extern int echowchar(chtype); 776 extern int getnwstr(wchar_t *, int); 777 extern int getwch(void); 778 extern int getwstr(wchar_t *); 779 extern int innwstr(wchar_t *, int); 780 extern int insnwstr(wchar_t *, int); 781 extern int inswch(chtype); 782 extern int inswstr(wchar_t *); 783 extern int inwchnstr(chtype *, int); 784 extern int inwchstr(chtype *); 785 extern int inwstr(wchar_t *); 786 extern int mvaddnwstr(int, int, wchar_t *, int); 787 extern int mvaddwch(int, int, chtype); 788 extern int mvaddwchnstr(int, int, chtype *, int); 789 extern int mvaddwchstr(int, int, chtype *); 790 extern int mvaddwstr(int, int, wchar_t *); 791 extern int mvgetnwstr(int, int, wchar_t *, int); 792 extern int mvgetwch(int, int); 793 extern int mvgetwstr(int, int, wchar_t *); 794 extern int mvinnwstr(int, int, wchar_t *, int); 795 extern int mvinsnwstr(int, int, wchar_t *, int); 796 extern int mvinswch(int, int, chtype); 797 extern int mvinswstr(int, int, wchar_t *); 798 extern int mvinwchnstr(int, int, chtype *, int); 799 extern int mvinwchstr(int, int, chtype *); 800 extern int mvinwstr(int, int, wchar_t *); 801 extern int mvwaddnwstr(WINDOW *, int, int, wchar_t *, int); 802 extern int mvwaddwch(WINDOW *, int, int, chtype); 803 extern int mvwaddwchnstr(WINDOW *, int, int, chtype *, int); 804 extern int mvwaddwchstr(WINDOW *, int, int, chtype *); 805 extern int mvwaddwstr(WINDOW *, int, int, wchar_t *); 806 extern int mvwgetnwstr(WINDOW *, int, int, wchar_t *, int); 807 extern int mvwgetwch(WINDOW *, int, int); 808 extern int mvwgetwstr(WINDOW *, int, int, wchar_t *); 809 extern int mvwinnwstr(WINDOW *, int, int, wchar_t *, int); 810 extern int mvwinsnwstr(WINDOW *, int, int, wchar_t *, int); 811 extern int mvwinswch(WINDOW *, int, int, chtype); 812 extern int mvwinswstr(WINDOW *, int, int, wchar_t *); 813 extern int mvwinwchnstr(WINDOW *, int, int, chtype *, int); 814 extern int mvwinwchstr(WINDOW *, int, int, chtype *); 815 extern int mvwinwstr(WINDOW *, int, int, wchar_t *); 816 extern int waddwchstr(WINDOW *, chtype *); 817 extern int waddwstr(WINDOW *, wchar_t *); 818 extern int winswstr(WINDOW *, wchar_t *); 819 extern int winwchstr(WINDOW *, chtype *); 820 821 #else /* __STDC__ */ 822 823 extern SCREEN *newterm(), /* termname, fout, fin */ 824 extern SCREEN *set_term(); /* screenptr */ 825 826 extern WINDOW *subpad(), 827 extern WINDOW *subwin(); 828 829 extern chtype inch(), winch(), mvinch(), mvwinch(); 830 831 extern char *unctrl(); 832 833 extern int addch(), addchnstr(), addchstr(), addnstr(), addstr(), 834 attroff(), attron(), attrset(), beep(), bkgd(), 835 border(), box(), clear(), clearok(), clrtobot(), clrtoeol(), 836 crmode(), delch(), deleteln(), echo(), echochar(), 837 erase(), 838 /* MORE */ fixterm(), 839 flash(), garbagedlines(), garbagedwin(), 840 getch(), getstr(), gettmode(), halfdelay(), hline(), 841 inchnstr(), inchstr(), innstr(), insch(), 842 insdelln(), insertln(), insnstr(), insstr(), instr(), 843 intrflush(), 844 is_linetouched(), is_wintouched(), leaveok(), meta(), 845 move(), mvaddch(), mvaddchnstr(), mvaddchstr(), mvaddnstr(), 846 mvaddstr(), mvdelch(), mvgetch(), mvgetstr(), mvhline(), 847 mvinchnstr(), mvinchstr(), mvinnstr(), mvinsch(), mvinsnstr(), 848 mvinsstr(), mvinstr(), mvvline(), mvwaddch(), mvwaddchnstr(), 849 mvwaddchstr(), mvwaddnstr(), mvwaddstr(), mvwdelch(), 850 mvwgetch(), mvwgetstr(), mvwhline(), mvwinchnstr(), 851 mvwinchstr(), mvwinnstr(), mvwinsch(), mvwinsnstr(), 852 mvwinsstr(), mvwinstr(), mvwvline(), 853 nl(), nocrmode(), nodelay(), 854 noecho(), nonl(), notimeout(), 855 overlay(), overwrite(), redrawwin(), refresh(), 856 resetterm(), saveterm(), scr_init(), 857 scr_restore(), scr_set(), scrl(), 858 scroll(), scrollok(), setscrreg(), setterm(), 859 slk_init(), standend(), standout(), 860 syncok(), touchline(), touchwin(), untouchwin(), vline(), 861 waddchstr(), waddstr(), wclear(), 862 wdeleteln(), werase(), winchstr(), winsertln(), 863 winsstr(), winstr(), wstandend(), wstandout(); 864 865 extern void bkgdset(), wbkgdset(), idcok(), noqiflush(), 866 qiflush(), timeout(), wtimeout(), use_env(); 867 868 extern unsigned long getmouse(), getbmap(); 869 870 extern chtype inwch(), mvinwch(), mvwinwch(); 871 872 extern int addnwstr(), addwch(), addwchnstr(), addwchstr(), 873 addwstr(), echowchar(), getnwstr(), getwch(), 874 getwstr(), innwstr(), insnwstr(), inswch(), 875 inswstr(), inwchnstr(), inwchstr(), inwstr(), 876 mvaddnwstr(), mvaddwch(), mvaddwchnstr(), mvaddwchstr(), 877 mvaddwstr(), mvgetnwstr(), mvgetwch(), mvgetwstr(), 878 mvinnwstr(), mvinsnwstr(), mvinswch(), mvinswstr(), 879 mvinwchnstr(), mvinwchstr(), mvinwstr(), mvwaddnwstr(), 880 mvwaddwch(), mvwaddwchnstr(), mvwaddwchstr(), mvwaddwstr(), 881 mvwgetnwstr(), mvwgetwch(), mvwgetwstr(), mvwinnwstr(), 882 mvwinsnwstr(), mvwinswch(), mvwinswstr(), mvwinwchnstr(), 883 mvwinwchstr(), mvwinwstr(), waddwchstr(), waddwstr(), 884 winswstr(), winwchstr(); 885 886 #endif /* __STDC__ */ 887 888 #else /* NOMACROS || __lint */ 889 890 /* 891 * The defines from here down to the #endif for NOMACROS 892 * define macros, which may be more efficient than their 893 * function versions. The functions may be accessed by defining 894 * NOMACROS in C code. This is useful for debugging purposes. 895 */ 896 897 #include <unctrl.h> 898 899 /* pseudo functions for stdscr */ 900 #define addch(ch) waddch(stdscr, ch) 901 #define addnstr(s, n) waddnstr(stdscr, s, n) 902 #define addstr(str) waddstr(stdscr, str) 903 #define attroff(at) wattroff(stdscr, at) 904 #define attron(at) wattron(stdscr, at) 905 #define attrset(at) wattrset(stdscr, at) 906 #define bkgd(c) wbkgd(stdscr, c) 907 #define border(ls, rs, ts, bs, tl, tr, bl, br) \ 908 wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) 909 #define clear() wclear(stdscr) 910 #define clrtobot() wclrtobot(stdscr) 911 #define clrtoeol() wclrtoeol(stdscr) 912 #define delch() wdelch(stdscr) 913 #define deleteln() wdeleteln(stdscr) 914 #define echochar(ch) wechochar(stdscr, ch) 915 #define erase() werase(stdscr) 916 #define getch() wgetch(stdscr) 917 #define getstr(str) wgetstr(stdscr, str) 918 #define inch() winch(stdscr) 919 #define insch(c) winsch(stdscr, c) 920 #define insdelln(id) winsdelln(stdscr, id) 921 #define insertln() winsertln(stdscr) 922 #define insnstr(s, n) winsnstr(stdscr, s, n) 923 #define insstr(s) winsstr(stdscr, s) 924 #define move(y, x) wmove(stdscr, y, x) 925 #define refresh() wrefresh(stdscr) 926 #define scrl(n) wscrl(stdscr, n) 927 #define setscrreg(t, b) wsetscrreg(stdscr, t, b) 928 #define standend() wstandend(stdscr) 929 #define standout() wstandout(stdscr) 930 #define timeout(tm) wtimeout(stdscr, tm) 931 #define hline(c, num) whline(stdscr, c, num) 932 #define vline(c, num) wvline(stdscr, c, num) 933 #define addchstr(str) waddchstr(stdscr, str) 934 #define addchnstr(str, n) waddchnstr(stdscr, str, n) 935 #define instr(str) winstr(stdscr, (str)) 936 #define innstr(str, n) winnstr(stdscr, (str), (n)) 937 #define inchstr(str) winchstr(stdscr, str) 938 #define inchnstr(str, n) winchnstr(stdscr, str, n) 939 #define bkgdset(c) wbkgdset(stdscr, c) 940 941 #define addnwstr(ws, n) waddnwstr(stdscr, ws, n) 942 #define addwch(ch) waddwch(stdscr, ch) 943 #define addwchnstr(str, n) waddwchnstr(stdscr, str, n) 944 #define addwchstr(str) waddwchstr(stdscr, str) 945 #define addwstr(ws) waddwstr(stdscr, ws) 946 #define echowchar(ch) wechowchar(stdscr, ch) 947 #define getnwstr(ws, n) wgetnwstr(stdscr, ws, n) 948 #define getwch() wgetwch(stdscr) 949 #define getwstr(ws) wgetwstr(stdscr, ws) 950 #define innwstr(ws, n) winnwstr(stdscr, ws, n) 951 #define insnwstr(ws, n) winsnwstr(stdscr, ws, n) 952 #define inswch(c) winswch(stdscr, c) 953 #define inswstr(ws) winswstr(stdscr, ws) 954 #define inwch() winwch(stdscr) 955 #define inwchnstr(str, n) winwchnstr(stdscr, str, n) 956 #define inwchstr(str) winwchstr(stdscr, str) 957 #define inwstr(ws) winwstr(stdscr, ws) 958 959 #define adjcurspos() wadjcurspos(stdscr) 960 #define movenextch() wmovenextch(stdscr) 961 #define moveprevch() wmoveprevch(stdscr) 962 963 /* functions to define environment flags of a window */ 964 #ifdef CURS_PERFORMANCE 965 #define wbkgdset(win, c) \ 966 (((win)->_attrs = (((win)->_attrs & ~((win)->_bkgd & A_ATTRIBUTES)) | \ 967 (c & A_ATTRIBUTES))), ((win)->_bkgd = (c))) 968 #define syncok(win, bf) ((win)->_parent ? (win)->_sync = (bf) : ERR) 969 #define notimeout(win, bf) \ 970 (((win)->_notimeout = ((bf) ? TRUE : FALSE)), OK) 971 #define clearok(win, bf) (((win)->_clear = (bf)), OK) 972 #define leaveok(win, bf) (((win)->_leave = (bf)), OK) 973 #define scrollok(win, bf) (((win)->_scroll = ((bf) ? TRUE : FALSE)), OK) 974 #define idcok(win, bf) ((win)->_use_idc = ((bf) ? TRUE : FALSE)) 975 #define nodelay(win, bf) (((win)->_delay = (bf) ? 0 : -1), OK) 976 #define is_wintouched(win) ((win)->_flags & _WINCHANGED) 977 #define is_linetouched(win, line) \ 978 ((((line) >= (win)->_maxy) || ((line) < 0)) ? ERR : \ 979 (((win)->_firstch[(line)] == _INFINITY) ? FALSE : TRUE)) 980 981 #define subwin(win, nl, nc, by, bx) \ 982 derwin((win), (nl), (nc), (by-win->_begy), (bx-win->_begx)) 983 #define touchwin(win) wtouchln((win), 0, (win)->_maxy, TRUE) 984 #define redrawwin(win) wredrawln((win), 0, (win)->_maxy) 985 #define winchstr(win, str) \ 986 winchnstr((win), str, ((win)->_maxx - (win)->_curx)) 987 #define winstr(win, str) \ 988 winnstr((win), str, ((win)->_maxx - (win)->_curx)) 989 #define untouchwin(win) wtouchln((win), 0, ((win)->_maxy), FALSE) 990 #define winch(win) ((win)->_y[(win)->_cury][(win)->_curx]) 991 992 #define wtimeout(win, tm) ((win)->_delay = (tm)) 993 #define use_env(bf) (_use_env = (bf)) 994 995 #else /* CURS_PERFORMANCE */ 996 997 #ifdef __STDC__ 998 999 extern void wbkgdset(WINDOW *, chtype); 1000 extern void idcok(WINDOW *, bool); 1001 extern void wtimeout(WINDOW *, int); 1002 extern void use_env(int); /* int sb. char */ 1003 1004 extern int syncok(WINDOW *, bool); 1005 extern int notimeout(WINDOW *, bool); 1006 extern int clearok(WINDOW *, bool); 1007 extern int leaveok(WINDOW *, bool); 1008 extern int scrollok(WINDOW *, bool); 1009 extern int nodelay(WINDOW *, bool); 1010 extern int is_linetouched(WINDOW *, int); 1011 extern int is_wintouched(WINDOW *); 1012 extern int touchwin(WINDOW *); 1013 extern int redrawwin(WINDOW *); 1014 extern int winchstr(WINDOW *, chtype *); 1015 extern int winstr(WINDOW *, char *); 1016 extern int untouchwin(WINDOW *); 1017 1018 extern chtype winch(WINDOW *); 1019 1020 extern WINDOW *subwin(WINDOW *, int, int, int, int); 1021 1022 #else /* __STDC__ */ 1023 1024 extern void wbkgdset(), idcok(), wtimeout(), use_env(); 1025 1026 extern int syncok(), notimeout(), clearok(), leaveok(), 1027 scrollok(), nodelay(), is_linetouched(), is_wintouched(), 1028 touchwin(), redrawwin(), winchstr(), winstr(), 1029 untouchwin(); 1030 1031 extern chtype winch(); 1032 1033 extern WINDOW *subwin(); 1034 1035 #endif /* __STDC__ */ 1036 1037 #endif /* CURS_PERFORMANCE */ 1038 1039 /* functions for move and update */ 1040 #define mvaddch(y, x, ch) \ 1041 mvwaddch(stdscr, y, x, ch) 1042 #define mvaddnstr(y, x, s, n) \ 1043 mvwaddnstr(stdscr, y, x, s, n) 1044 #define mvaddstr(y, x, str) \ 1045 mvwaddstr(stdscr, y, x, str) 1046 #define mvdelch(y, x) \ 1047 mvwdelch(stdscr, y, x) 1048 #define mvgetch(y, x) \ 1049 mvwgetch(stdscr, y, x) 1050 #define mvgetstr(y, x, str) \ 1051 mvwgetstr(stdscr, y, x, str) 1052 #define mvinch(y, x) \ 1053 mvwinch(stdscr, y, x) 1054 #define mvinsch(y, x, c) \ 1055 mvwinsch(stdscr, y, x, c) 1056 #define mvinsnstr(y, x, s, n) \ 1057 mvwinsnstr(stdscr, y, x, s, n) 1058 #define mvinsstr(y, x, s) \ 1059 mvwinsstr(stdscr, y, x, s) 1060 #define mvaddchstr(y, x, str) \ 1061 mvwaddchstr(stdscr, y, x, str) 1062 #define mvaddchnstr(y, x, str, n) \ 1063 mvwaddchnstr(stdscr, y, x, str, n) 1064 #define mvinstr(y, x, str) \ 1065 mvwinstr(stdscr, y, x, (str)) 1066 #define mvinnstr(y, x, str, n) \ 1067 mvwinnstr(stdscr, y, x, (str), (n)) 1068 #define mvinchstr(y, x, str) \ 1069 mvwinchstr(stdscr, y, x, str) 1070 #define mvinchnstr(y, x, str, n) \ 1071 mvwinchnstr(stdscr, y, x, str, n) 1072 #define mvhline(y, x, c, num) \ 1073 mvwhline(stdscr, y, x, c, num) 1074 #define mvvline(y, x, c, num) \ 1075 mvwvline(stdscr, y, x, c, num) 1076 1077 #define mvaddnwstr(y, x, ws, n) \ 1078 mvwaddnwstr(stdscr, y, x, ws, n) 1079 #define mvaddwch(y, x, ch) \ 1080 mvwaddwch(stdscr, y, x, ch) 1081 #define mvaddwchnstr(y, x, str, n) \ 1082 mvwaddwchnstr(stdscr, y, x, str, n) 1083 #define mvaddwchstr(y, x, str) \ 1084 mvwaddwchstr(stdscr, y, x, str) 1085 #define mvaddwstr(y, x, ws) \ 1086 mvwaddwstr(stdscr, y, x, ws) 1087 #define mvgetnwstr(y, x, ws, n) \ 1088 mvwgetnwstr(stdscr, y, x, ws, n) 1089 #define mvgetwch(y, x) \ 1090 mvwgetwch(stdscr, y, x) 1091 #define mvgetwstr(y, x, ws) \ 1092 mvwgetwstr(stdscr, y, x, ws) 1093 #define mvinnwstr(y, x, ws, n) \ 1094 mvwinnwstr(stdscr, y, x, ws, n) 1095 #define mvinsnwstr(y, x, ws, n) \ 1096 mvwinsnwstr(stdscr, y, x, ws, n) 1097 #define mvinswch(y, x, c) \ 1098 mvwinswch(stdscr, y, x, c) 1099 #define mvinswstr(y, x, ws) \ 1100 mvwinswstr(stdscr, y, x, ws) 1101 #define mvinwch(y, x) \ 1102 mvwinwch(stdscr, y, x) 1103 #define mvinwchnstr(y, x, str, n) \ 1104 mvwinwchnstr(stdscr, y, x, str, n) 1105 #define mvinwchstr(y, x, str) \ 1106 mvwinwchstr(stdscr, y, x, str) 1107 #define mvinwstr(y, x, ws) \ 1108 mvwinwstr(stdscr, y, x, ws) 1109 1110 #define mvwaddch(win, y, x, ch) \ 1111 (wmove(win, y, x) == ERR ? ERR : waddch(win, ch)) 1112 #define mvwaddnstr(win, y, x, s, n) \ 1113 (wmove(win, y, x) == ERR ? ERR : waddnstr(win, s, n)) 1114 #define mvwaddstr(win, y, x, str) \ 1115 (wmove(win, y, x) == ERR ? ERR : waddstr(win, str)) 1116 #define mvwdelch(win, y, x) \ 1117 (wmove(win, y, x) == ERR ? ERR : wdelch(win)) 1118 #define mvwgetch(win, y, x) \ 1119 (wmove(win, y, x) == ERR ? ERR : wgetch(win)) 1120 #define mvwgetstr(win, y, x, str) \ 1121 (wmove(win, y, x) == ERR ? ERR : wgetstr(win, str)) 1122 #define mvwinch(win, y, x) \ 1123 (wmove(win, y, x) == ERR ? (chtype)ERR : winch(win)) 1124 #define mvwinsch(win, y, x, c) \ 1125 (wmove(win, y, x) == ERR ? ERR : winsch(win, c)) 1126 #define mvwinsnstr(win, y, x, s, n) \ 1127 (wmove(win, y, x) == ERR ? ERR : winsnstr(win, s, n)) 1128 #define mvwinsstr(win, y, x, s) \ 1129 (wmove(win, y, x) == ERR ? ERR : winsstr(win, s)) 1130 #define mvwhline(win, y, x, c, num) \ 1131 (wmove(win, y, x) == ERR ? ERR : whline(win, c, num)) 1132 #define mvwvline(win, y, x, c, num) \ 1133 (wmove(win, y, x) == ERR ? ERR : wvline(win, c, num)) 1134 #define mvwaddchstr(win, y, x, str) \ 1135 (wmove(win, y, x) == ERR ? ERR : waddchstr(win, str)) 1136 #define mvwaddchnstr(win, y, x, str, n) \ 1137 (wmove(win, y, x) == ERR ? ERR : waddchnstr(win, str, n)) 1138 #define mvwinstr(win, y, x, str) \ 1139 (wmove(win, y, x) == ERR ? ERR : winstr(win, str)) 1140 #define mvwinnstr(win, y, x, str, n) \ 1141 (wmove(win, y, x) == ERR ? ERR : winnstr(win, str, n)) 1142 #define mvwinchstr(win, y, x, str) \ 1143 (wmove(win, y, x) == ERR ? ERR : winchstr(win, str)) 1144 #define mvwinchnstr(win, y, x, str, n) \ 1145 (wmove(win, y, x) == ERR ? ERR : winchnstr(win, str, n)) 1146 #define mvwaddnwstr(win, y, x, ws, n) \ 1147 (wmove(win, y, x) == ERR ? ERR : waddnwstr(win, ws, n)) 1148 #define mvwaddwch(win, y, x, ch) \ 1149 (wmove(win, y, x) == ERR ? ERR : waddwch(win, ch)) 1150 #define mvwaddwchnstr(win, y, x, str, n) \ 1151 (wmove(win, y, x) == ERR ? ERR : waddwchnstr(win, str, n)) 1152 #define mvwaddwchstr(win, y, x, str) \ 1153 (wmove(win, y, x) == ERR ? ERR : waddwchstr(win, str)) 1154 #define mvwaddwstr(win, y, x, ws) \ 1155 (wmove(win, y, x) == ERR ? ERR : waddwstr(win, ws)) 1156 #define mvwgetnwstr(win, y, x, ws, n) \ 1157 (wmove(win, y, x) == ERR ? ERR : wgetnwstr(win, ws, n)) 1158 #define mvwgetwch(win, y, x) \ 1159 (wmove(win, y, x) == ERR ? ERR : wgetwch(win)) 1160 #define mvwgetwstr(win, y, x, ws) \ 1161 (wmove(win, y, x) == ERR ? ERR : wgetwstr(win, ws)) 1162 #define mvwinnwstr(win, y, x, ws, n) \ 1163 (wmove(win, y, x) == ERR ? ERR : winnwstr(win, ws, n)) 1164 #define mvwinsnwstr(win, y, x, ws, n) \ 1165 (wmove(win, y, x) == ERR ? ERR : winsnwstr(win, ws, n)) 1166 #define mvwinswch(win, y, x, c) \ 1167 (wmove(win, y, x) == ERR ? ERR : winswch(win, c)) 1168 #define mvwinswstr(win, y, x, ws) \ 1169 (wmove(win, y, x) == ERR ? ERR : winswstr(win, ws)) 1170 #define mvwinwch(win, y, x) \ 1171 (wmove(win, y, x) == ERR ?(chtype) ERR : winwch(win)) 1172 #define mvwinwchnstr(win, y, x, str, n) \ 1173 (wmove(win, y, x) == ERR ? ERR : winwchnstr(win, str, n)) 1174 #define mvwinwchstr(win, y, x, str) \ 1175 (wmove(win, y, x) == ERR ? ERR : winwchstr(win, str)) 1176 #define mvwinwstr(win, y, x, ws) \ 1177 (wmove(win, y, x) == ERR ? ERR : winwstr(win, ws)) 1178 1179 #define waddwchstr(win, str) waddwchnstr(win, str, -1) 1180 #define winwchstr(win, str) winwchnstr(win, str, -1) 1181 #define waddwstr(win, ws) waddnwstr(win, ws, -1) 1182 #define winswstr(win, ws) winsnwstr(win, ws, -1) 1183 1184 #ifdef CURS_MACROS 1185 #define overlay(src, dst) _overlap((src), (dst), TRUE) 1186 #define overwrite(src, dst) _overlap((src), (dst), FALSE) 1187 #define wdeleteln(win) winsdelln((win), -1) 1188 #define winsertln(win) winsdelln((win), 1) 1189 #define wstandend(win) wattrset((win), A_NORMAL) 1190 #define wstandout(win) wattron((win), A_STANDOUT) 1191 #define beep() _ring(TRUE) 1192 #define flash() _ring(FALSE) 1193 #define scroll(win) wscrl((win), 1) 1194 #define slk_init(f) slk_start(((f == 0) ? 3 : 2), NULL) 1195 #define scr_init(file) _scr_all(file, 0) 1196 #define scr_restore(file) _scr_all(file, 1) 1197 #define scr_set(file) _scr_all(file, 2) 1198 #define subpad(win, nl, nc, by, bx) derwin((win), (nl), (nc), (by), (bx)) 1199 #define box(win, v, h) wborder((win), (v), (v), (h), (h), 0, 0, 0, 0) 1200 #define newterm(type, fout, fin) newscreen((type), 0, 0, 0, (fout), (fin)) 1201 #define touchline(win, y, n) wtouchln((win), (y), (n), TRUE) 1202 1203 #define waddstr(win, str) waddnstr((win), (str), -1) 1204 #define werase(win) (wmove((win), 0, 0), wclrtobot(win)) 1205 #define wclear(win) (clearok((win), TRUE), werase(win)) 1206 #define intrflush(win, flag) _setqiflush(flag) 1207 #define meta(win, flag) _meta(flag) 1208 1209 #define setterm(name) setupterm((name), 1, (char *)NULL) 1210 #define gettmode() (OK) 1211 #define halfdelay(tens) ttimeout((tens)*100) 1212 1213 #define echo() _setecho(TRUE) 1214 #define noecho() _setecho(FALSE) 1215 #define nl() _setnonl(FALSE) 1216 #define nonl() _setnonl(TRUE) 1217 1218 #else /* CURS_MACROS */ 1219 1220 #ifdef __STDC__ 1221 1222 extern int overlay(WINDOW *, WINDOW *); 1223 extern int overwrite(WINDOW *, WINDOW *); 1224 extern int wdeleteln(WINDOW *); 1225 extern int winsertln(WINDOW *); 1226 extern int wstandend(WINDOW *); 1227 extern int wstandout(WINDOW *); 1228 extern int beep(void); 1229 extern int flash(void); 1230 extern int scroll(WINDOW *); 1231 extern int slk_init(int); 1232 extern int scr_init(char *); 1233 extern int scr_restore(char *); 1234 extern int box(WINDOW *, chtype, chtype); 1235 extern int touchline(WINDOW *, int, int); 1236 extern int waddstr(WINDOW *, char *); 1237 extern int werase(WINDOW *); 1238 extern int wclear(WINDOW *); 1239 extern int intrflush(WINDOW *, int); 1240 extern int meta(WINDOW *, int); 1241 extern int setterm(char *); 1242 extern int gettmode(void); 1243 extern int halfdelay(int); 1244 extern int echo(void); 1245 extern int noecho(void); 1246 extern int nl(void); 1247 extern int nonl(void); 1248 1249 extern WINDOW *subpad(WINDOW *, int, int, int, int); 1250 1251 extern SCREEN *newterm(char *, FILE *, FILE *); 1252 1253 #else /* __STDC__ */ 1254 1255 extern int overlay(), overwrite(), wdeleteln(), winsertln(), 1256 wstandend(), wstandout(), beep(), flash(), 1257 scroll(), slk_init(), scr_init(), scr_restore(), 1258 box(), touchline(), waddstr(), werase(), 1259 wclear(), intrflush(), meta(), setterm(), gettmode(), 1260 halfdelay(), echo(), noecho(), nl(), nonl(); 1261 1262 extern WINDOW *subpad(); 1263 1264 extern SCREEN *newterm(); 1265 1266 #endif /* __STDC__ */ 1267 #endif /* CURS_MACROS */ 1268 1269 #define garbagedlines wredrawln 1270 #define garbagedwin redrawwin 1271 1272 #define crmode cbreak 1273 #define nocrmode nocbreak 1274 #define saveterm def_prog_mode 1275 #define fixterm reset_prog_mode 1276 #define resetterm reset_shell_mode 1277 1278 #define waddchstr(win, str) waddchnstr((win), (str), -1) 1279 #define winsstr(win, str) winsnstr((win), (str), -1) 1280 1281 /* iocontrol functions */ 1282 #define qiflush() _setqiflush(TRUE) 1283 #define noqiflush() _setqiflush(FALSE) 1284 1285 #define set_term setcurscreen 1286 1287 #endif /* NOMACROS || __lint */ 1288 1289 /* 1290 * Standard alternate character set. The current ACS world is evolving, 1291 * so we support only a widely available subset: the line drawing characters 1292 * from the VT100, plus a few from the Teletype 5410v1. Eventually there 1293 * may be support of more sophisticated ACS line drawing, such as that 1294 * in the Teletype 5410, the HP line drawing set, and the like. There may 1295 * be support for some non line oriented characters as well. 1296 * 1297 * Line drawing ACS names are of the form ACS_trbl, where t is the top, r 1298 * is the right, b is the bottom, and l is the left. t, r, b, and l might 1299 * be B (blank), S (single), D (double), or T (thick). The subset defined 1300 * here only uses B and S. 1301 */ 1302 1303 #define ACS_BSSB (acs_map['l']) 1304 #define ACS_SSBB (acs_map['m']) 1305 #define ACS_BBSS (acs_map['k']) 1306 #define ACS_SBBS (acs_map['j']) 1307 #define ACS_SBSS (acs_map['u']) 1308 #define ACS_SSSB (acs_map['t']) 1309 #define ACS_SSBS (acs_map['v']) 1310 #define ACS_BSSS (acs_map['w']) 1311 #define ACS_BSBS (acs_map['q']) 1312 #define ACS_SBSB (acs_map['x']) 1313 #define ACS_SSSS (acs_map['n']) 1314 1315 /* 1316 * Human readable names for the most commonly used characters. 1317 * "Upper", "right", etc. are chosen to be consistent with the vt100 manual. 1318 */ 1319 1320 #define ACS_ULCORNER ACS_BSSB 1321 #define ACS_LLCORNER ACS_SSBB 1322 #define ACS_URCORNER ACS_BBSS 1323 #define ACS_LRCORNER ACS_SBBS 1324 #define ACS_RTEE ACS_SBSS 1325 #define ACS_LTEE ACS_SSSB 1326 #define ACS_BTEE ACS_SSBS 1327 #define ACS_TTEE ACS_BSSS 1328 #define ACS_HLINE ACS_BSBS 1329 #define ACS_VLINE ACS_SBSB 1330 #define ACS_PLUS ACS_SSSS 1331 #define ACS_S1 (acs_map['o']) /* scan line 1 */ 1332 #define ACS_S9 (acs_map['s']) /* scan line 9 */ 1333 #define ACS_DIAMOND (acs_map['`']) /* diamond */ 1334 #define ACS_CKBOARD (acs_map['a']) /* checker board (stipple) */ 1335 #define ACS_DEGREE (acs_map['f']) /* degree symbol */ 1336 #define ACS_PLMINUS (acs_map['g']) /* plus/minus */ 1337 #define ACS_BULLET (acs_map['~']) /* bullet */ 1338 /* Teletype 5410v1 symbols */ 1339 #define ACS_LARROW (acs_map[',']) /* arrow pointing left */ 1340 #define ACS_RARROW (acs_map['+']) /* arrow pointing right */ 1341 #define ACS_DARROW (acs_map['.']) /* arrow pointing down */ 1342 #define ACS_UARROW (acs_map['-']) /* arrow pointing up */ 1343 #define ACS_BOARD (acs_map['h']) /* board of squares */ 1344 #define ACS_LANTERN (acs_map['i']) /* lantern symbol */ 1345 #define ACS_BLOCK (acs_map['0']) /* solid square block */ 1346 1347 /* Funny "characters" enabled for various special function keys for input */ 1348 /* This list is created from caps and curses.ed. Do not edit it! */ 1349 #define KEY_MIN 0401 /* Minimum curses key */ 1350 #define KEY_BREAK 0401 /* break key (unreliable) */ 1351 #define KEY_DOWN 0402 /* Sent by terminal down arrow key */ 1352 #define KEY_UP 0403 /* Sent by terminal up arrow key */ 1353 #define KEY_LEFT 0404 /* Sent by terminal left arrow key */ 1354 #define KEY_RIGHT 0405 /* Sent by terminal right arrow key */ 1355 #define KEY_HOME 0406 /* Sent by home key. */ 1356 #define KEY_BACKSPACE 0407 /* Sent by backspace key */ 1357 #define KEY_F0 0410 /* function key f0. */ 1358 #define KEY_F(n) (KEY_F0+(n)) /* Space for 64 function keys */ 1359 /* is reserved. */ 1360 #define KEY_DL 0510 /* Sent by delete line key. */ 1361 #define KEY_IL 0511 /* Sent by insert line. */ 1362 #define KEY_DC 0512 /* Sent by delete character key. */ 1363 #define KEY_IC 0513 /* Sent by ins char/enter mode key. */ 1364 #define KEY_EIC 0514 /* Sent by rmir or smir in ins mode. */ 1365 #define KEY_CLEAR 0515 /* Sent by clear screen or erase key. */ 1366 #define KEY_EOS 0516 /* Sent by clear-to-end-of-screen. */ 1367 #define KEY_EOL 0517 /* Sent by clear-to-end-of-line key. */ 1368 #define KEY_SF 0520 /* Sent by scroll-forward/down key */ 1369 #define KEY_SR 0521 /* Sent by scroll-backward/up key */ 1370 #define KEY_NPAGE 0522 /* Sent by next-page key */ 1371 #define KEY_PPAGE 0523 /* Sent by previous-page key */ 1372 #define KEY_STAB 0524 /* Sent by set-tab key */ 1373 #define KEY_CTAB 0525 /* Sent by clear-tab key */ 1374 #define KEY_CATAB 0526 /* Sent by clear-all-tabs key. */ 1375 #define KEY_ENTER 0527 /* Enter/send (unreliable) */ 1376 #define KEY_SRESET 0530 /* soft (partial) reset (unreliable) */ 1377 #define KEY_RESET 0531 /* reset or hard reset (unreliable) */ 1378 #define KEY_PRINT 0532 /* print or copy */ 1379 #define KEY_LL 0533 /* Sent by home-down key */ 1380 /* The keypad is arranged like this: */ 1381 /* a1 up a3 */ 1382 /* left b2 right */ 1383 /* c1 down c3 */ 1384 #define KEY_A1 0534 /* Upper left of keypad */ 1385 #define KEY_A3 0535 /* Upper right of keypad */ 1386 #define KEY_B2 0536 /* Center of keypad */ 1387 #define KEY_C1 0537 /* Lower left of keypad */ 1388 #define KEY_C3 0540 /* Lower right of keypad */ 1389 #define KEY_BTAB 0541 /* Back tab key */ 1390 #define KEY_BEG 0542 /* beg(inning) key */ 1391 #define KEY_CANCEL 0543 /* cancel key */ 1392 #define KEY_CLOSE 0544 /* close key */ 1393 #define KEY_COMMAND 0545 /* cmd (command) key */ 1394 #define KEY_COPY 0546 /* copy key */ 1395 #define KEY_CREATE 0547 /* create key */ 1396 #define KEY_END 0550 /* end key */ 1397 #define KEY_EXIT 0551 /* exit key */ 1398 #define KEY_FIND 0552 /* find key */ 1399 #define KEY_HELP 0553 /* help key */ 1400 #define KEY_MARK 0554 /* mark key */ 1401 #define KEY_MESSAGE 0555 /* message key */ 1402 #define KEY_MOVE 0556 /* move key */ 1403 #define KEY_NEXT 0557 /* next object key */ 1404 #define KEY_OPEN 0560 /* open key */ 1405 #define KEY_OPTIONS 0561 /* options key */ 1406 #define KEY_PREVIOUS 0562 /* previous object key */ 1407 #define KEY_REDO 0563 /* redo key */ 1408 #define KEY_REFERENCE 0564 /* ref(erence) key */ 1409 #define KEY_REFRESH 0565 /* refresh key */ 1410 #define KEY_REPLACE 0566 /* replace key */ 1411 #define KEY_RESTART 0567 /* restart key */ 1412 #define KEY_RESUME 0570 /* resume key */ 1413 #define KEY_SAVE 0571 /* save key */ 1414 #define KEY_SBEG 0572 /* shifted beginning key */ 1415 #define KEY_SCANCEL 0573 /* shifted cancel key */ 1416 #define KEY_SCOMMAND 0574 /* shifted command key */ 1417 #define KEY_SCOPY 0575 /* shifted copy key */ 1418 #define KEY_SCREATE 0576 /* shifted create key */ 1419 #define KEY_SDC 0577 /* shifted delete char key */ 1420 #define KEY_SDL 0600 /* shifted delete line key */ 1421 #define KEY_SELECT 0601 /* select key */ 1422 #define KEY_SEND 0602 /* shifted end key */ 1423 #define KEY_SEOL 0603 /* shifted clear line key */ 1424 #define KEY_SEXIT 0604 /* shifted exit key */ 1425 #define KEY_SFIND 0605 /* shifted find key */ 1426 #define KEY_SHELP 0606 /* shifted help key */ 1427 #define KEY_SHOME 0607 /* shifted home key */ 1428 #define KEY_SIC 0610 /* shifted input key */ 1429 #define KEY_SLEFT 0611 /* shifted left arrow key */ 1430 #define KEY_SMESSAGE 0612 /* shifted message key */ 1431 #define KEY_SMOVE 0613 /* shifted move key */ 1432 #define KEY_SNEXT 0614 /* shifted next key */ 1433 #define KEY_SOPTIONS 0615 /* shifted options key */ 1434 #define KEY_SPREVIOUS 0616 /* shifted prev key */ 1435 #define KEY_SPRINT 0617 /* shifted print key */ 1436 #define KEY_SREDO 0620 /* shifted redo key */ 1437 #define KEY_SREPLACE 0621 /* shifted replace key */ 1438 #define KEY_SRIGHT 0622 /* shifted right arrow */ 1439 #define KEY_SRSUME 0623 /* shifted resume key */ 1440 #define KEY_SSAVE 0624 /* shifted save key */ 1441 #define KEY_SSUSPEND 0625 /* shifted suspend key */ 1442 #define KEY_SUNDO 0626 /* shifted undo key */ 1443 #define KEY_SUSPEND 0627 /* suspend key */ 1444 #define KEY_UNDO 0630 /* undo key */ 1445 #define KEY_MOUSE 0631 /* Mouse event has occured */ 1446 #define KEY_MAX 0777 /* Maximum curses key */ 1447 1448 /* 1449 * The definition for 'reg' is not standard, and is provided for 1450 * compatibility reasons. User's are discouraged from using this. 1451 */ 1452 #define reg register 1453 1454 /* Various video attributes */ 1455 #define A_STANDOUT 000010000000 1456 #define _STANDOUT A_STANDOUT /* for compatability with old curses */ 1457 #define A_UNDERLINE 000020000000 1458 #define A_REVERSE 000040000000 1459 #define A_BLINK 000100000000 1460 #define A_DIM 000200000000 1461 #define A_BOLD 000400000000 1462 #define A_ALTCHARSET 001000000000 1463 1464 /* The next two are subject to change so don't depend on them */ 1465 #define A_INVIS 010000000000 1466 #define A_PROTECT 020000000000U 1467 1468 #define A_NORMAL 000000000000 1469 #define A_ATTRIBUTES 031777700000U /* 0xCFFF8000 */ 1470 #define A_CHARTEXT 006000077777 /* 0x30007FFF */ 1471 #define A_COLOR 000007700000 1472 1473 #define A_WATTRIBUTES 031770000000U /* 0xCFE00000 */ 1474 #define A_WCHARTEXT 006007777777 /* 0x301FFFFF */ 1475 1476 #define COLOR_PAIR(n) ((n) << 15) 1477 #define PAIR_NUMBER(n) (((n) & A_COLOR) >> 15) 1478 1479 /* definition of 8 basic color */ 1480 #define COLOR_BLACK 0 1481 #define COLOR_RED 1 1482 #define COLOR_GREEN 2 1483 #define COLOR_YELLOW 3 1484 #define COLOR_BLUE 4 1485 #define COLOR_MAGENTA 5 1486 #define COLOR_CYAN 6 1487 #define COLOR_WHITE 7 1488 1489 /* mouse related macros: don't change these definitions or bit-masks. */ 1490 /* they are interdependent (used by _map_button() in tgetch() */ 1491 #define BUTTON_RELEASED 0 1492 #define BUTTON_PRESSED 1 1493 #define BUTTON_CLICKED 2 1494 #define BUTTON_DOUBLE_CLICKED 3 1495 #define BUTTON_TRIPLE_CLICKED 4 1496 1497 #define MOUSE_X_POS (Mouse_status.x) 1498 #define MOUSE_Y_POS (Mouse_status.y) 1499 #define A_BUTTON_CHANGED (Mouse_status.changes & 7) 1500 #define MOUSE_MOVED (Mouse_status.changes & 8) 1501 #define MOUSE_POS_REPORT (Mouse_status.changes & 16) 1502 #define BUTTON_CHANGED(x) (Mouse_status.changes & (1 << ((x) - 1))) 1503 #define BUTTON_STATUS(x) (Mouse_status.button[(x)-1]) 1504 1505 /* definition of mouse bit-masks */ 1506 #define BUTTON1_RELEASED 000000000001 1507 #define BUTTON1_PRESSED 000000000002 1508 #define BUTTON1_CLICKED 000000000004 1509 #define BUTTON1_DOUBLE_CLICKED 000000000010 1510 #define BUTTON1_TRIPLE_CLICKED 000000000020 1511 #define BUTTON2_RELEASED 000000000040 1512 #define BUTTON2_PRESSED 000000000100 1513 #define BUTTON2_CLICKED 000000000200 1514 #define BUTTON2_DOUBLE_CLICKED 000000000400 1515 #define BUTTON2_TRIPLE_CLICKED 000000001000 1516 #define BUTTON3_RELEASED 000000002000 1517 #define BUTTON3_PRESSED 000000004000 1518 #define BUTTON3_CLICKED 000000010000 1519 #define BUTTON3_DOUBLE_CLICKED 000000020000 1520 #define BUTTON3_TRIPLE_CLICKED 000000040000 1521 #define ALL_MOUSE_EVENTS 000000077777 1522 #define REPORT_MOUSE_POSITION 000000100000 1523 1524 #ifdef __cplusplus 1525 } 1526 #endif 1527 1528 #endif /* _CURSES_H */ 1529