1 /* $LynxId: LYCurses.h,v 1.96 2018/03/11 22:19:36 tom Exp $ */ 2 #ifndef LYCURSES_H 3 #define LYCURSES_H 4 5 #ifndef HTUTILS_H 6 #include <HTUtils.h> 7 #endif 8 9 /* 10 * Because we have to configure PDCURSES last, we may get bogus definitions 11 * from the system curses library - cancel these now. 12 */ 13 #ifdef HAVE_XCURSES 14 15 #undef ASSUME_DEFAULT_COLORS 16 #undef COLOR_CURSES 17 #undef FANCY_CURSES 18 #undef HAVE_CBREAK 19 #undef HAVE_RESIZETERM 20 #undef HAVE_USE_DEFAULT_COLORS 21 #undef NCURSES 22 #undef USE_DEFAULT_COLORS 23 24 #define HAVE_CBREAK 1 25 #define COLOR_CURSES 1 26 #define FANCY_CURSES 1 27 28 #endif 29 30 /* 31 * The simple color scheme maps the 8 combinations of bold/underline/reverse 32 * to the standard 8 ANSI colors (with some variations based on context). 33 */ 34 #undef USE_COLOR_TABLE 35 36 #ifdef USE_COLOR_STYLE 37 #define USE_COLOR_TABLE 1 /* default color logic is used */ 38 #else 39 #if defined(USE_SLANG) || defined(COLOR_CURSES) 40 #define USE_COLOR_TABLE 1 41 #endif 42 #endif 43 44 #ifdef TRUE 45 #undef TRUE /* to prevent parse error :( */ 46 #endif /* TRUE */ 47 #ifdef FALSE 48 #undef FALSE /* to prevent parse error :( */ 49 #endif /* FALSE */ 50 51 #ifdef USE_SLANG 52 #define ENABLE_SLFUTURE_CONST 1 53 #include <slang.h> 54 #ifndef SLFUTURE_CONST 55 #define SLFUTURE_CONST /* nothing */ 56 #endif 57 typedef unsigned long chtype; 58 59 #undef WINDOW 60 typedef struct { 61 int top_y; 62 int left_x; 63 int height; 64 int width; 65 } WINDOW; 66 67 /* slang doesn't really do windows... */ 68 #define waddch(w,c) LYaddch(c) 69 #define waddstr(w,s) addstr(s) 70 #define wmove(win, row, col) SLsmg_gotorc(((win)?(win)->top_y:0) + (row), ((win)?(win)->left_x:0) + (col)) 71 72 #ifndef SLSMG_UARROW_CHAR 73 #define SLSMG_UARROW_CHAR '^' 74 #endif 75 76 #ifndef SLSMG_DARROW_CHAR 77 #define SLSMG_DARROW_CHAR 'v' 78 #endif 79 80 #ifndef SLSMG_LARROW_CHAR 81 #define SLSMG_LARROW_CHAR '<' 82 #endif 83 84 #ifndef SLSMG_RARROW_CHAR 85 #define SLSMG_RARROW_CHAR '>' 86 #endif 87 88 #ifndef SLSMG_CKBRD_CHAR 89 #define SLSMG_CKBRD_CHAR '#' 90 #endif 91 92 #ifndef SLSMG_BLOCK_CHAR 93 #define SLSMG_BLOCK_CHAR '#' 94 #endif 95 96 #ifndef ACS_UARROW 97 #define ACS_UARROW SLSMG_UARROW_CHAR 98 #endif 99 100 #ifndef ACS_DARROW 101 #define ACS_DARROW SLSMG_DARROW_CHAR 102 #endif 103 104 #ifndef ACS_LARROW 105 #define ACS_LARROW SLSMG_LARROW_CHAR 106 #endif 107 108 #ifndef ACS_RARROW 109 #define ACS_RARROW SLSMG_RARROW_CHAR 110 #endif 111 112 #ifndef ACS_CKBOARD 113 #define ACS_CKBOARD SLSMG_CKBRD_CHAR 114 #endif 115 116 #ifndef ACS_BLOCK 117 #define ACS_BLOCK SLSMG_BLOCK_CHAR 118 #endif 119 120 #else /* Using curses: */ 121 122 #ifdef VMS 123 #define FANCY_CURSES 124 125 #endif /* VMS */ 126 127 #ifndef HAVE_TYPE_CHTYPE 128 129 #ifdef __PDCURSES__ 130 #define HAVE_TYPE_CHTYPE 1 131 #endif 132 133 #if defined(_VMS_CURSES) || defined(VMS) 134 typedef char chtype; 135 136 #define HAVE_TYPE_CHTYPE 1 137 #endif 138 139 #endif /* ! HAVE_TYPE_CHTYPE */ 140 141 /* 142 * CR may be defined before the curses.h include occurs. 143 * There is a conflict between the termcap char *CR and the define. 144 * Assuming that the definition of CR will always be carriage return. 145 * 06-09-94 Lynx 2-3-1 Garrett Arch Blythe 146 */ 147 #ifdef CR 148 #undef CR /* to prevent parse error :( */ 149 #define REDEFINE_CR 150 #endif /* CR */ 151 152 #ifdef HZ 153 #undef HZ /* to prevent parse error :( */ 154 #endif /* HZ */ 155 156 /* SunOS 4.x has a redefinition between ioctl.h and termios.h */ 157 #if defined(sun) && !defined(__SVR4) 158 #undef NL0 159 #undef NL1 160 #undef CR0 161 #undef CR1 162 #undef CR2 163 #undef CR3 164 #undef TAB0 165 #undef TAB1 166 #undef TAB2 167 #undef XTABS 168 #undef BS0 169 #undef BS1 170 #undef FF0 171 #undef FF1 172 #undef ECHO 173 #undef NOFLSH 174 #undef TOSTOP 175 #undef FLUSHO 176 #undef PENDIN 177 #endif 178 179 #if defined(_MSC_VER) 180 #undef MOUSE_MOVED /* conflict between PDCURSES and _WIN32 */ 181 #endif /* _MSC_VER */ 182 183 /* 184 * Do this to build with glibc 2.1.3 (apparently it was not used to build a 185 * system before release). 186 */ 187 #include <signal.h> 188 189 #undef CS /* some BSD versions of curses use this */ 190 #define CS curses_CS /* ...but we don't */ 191 192 #ifdef ERR 193 #undef ERR /* all versions of curses define this */ 194 #endif 195 196 #ifdef KEY_EVENT 197 #undef KEY_EVENT /* wincon.h or Cygwin's copy of it */ 198 #endif 199 200 #ifdef MOUSE_MOVED 201 #undef MOUSE_MOVED /* wincon.h or MINGW32's copy of it */ 202 #endif 203 204 #ifdef HAVE_CONFIG_H 205 # ifdef HAVE_NCURSESW_NCURSES_H 206 # undef GCC_PRINTFLIKE /* <libutf8.h> may define 'printf' */ 207 # include <ncursesw/ncurses.h> 208 # undef printf /* but we don't want that... */ 209 # else 210 # ifdef HAVE_NCURSES_NCURSES_H 211 # include <ncurses/ncurses.h> 212 # else 213 # ifdef HAVE_NCURSES_H 214 # include <ncurses.h> 215 # else 216 # ifdef HAVE_CURSESX_H 217 # include <cursesX.h> /* Ultrix */ 218 # else 219 # ifdef HAVE_JCURSES_H 220 # include <jcurses.h> /* sony_news */ 221 # else 222 # ifdef HAVE_XCURSES 223 # include <xcurses.h> /* PDCurses' UNIX port */ 224 # else 225 # include <curses.h> /* default */ 226 # endif 227 # endif 228 # endif 229 # endif 230 # endif 231 # endif 232 233 # if defined(wgetbkgd) && !defined(getbkgd) 234 # define getbkgd(w) wgetbkgd(w) /* workaround pre-1.9.9g bug */ 235 # endif 236 237 # ifdef FANCY_CURSES 238 # if defined(NCURSES) && defined(HAVE_NCURSESW_TERM_H) 239 # include <ncursesw/term.h> 240 # else 241 # if defined(NCURSES) && defined(HAVE_NCURSES_TERM_H) 242 # include <ncurses/term.h> 243 # else 244 # if defined(HAVE_NCURSESW_NCURSES_H) || defined(HAVE_NCURSES_NCURSES_H) || defined(HAVE_XCURSES) 245 # undef HAVE_TERM_H /* only use one in comparable path! */ 246 # endif 247 # if defined(HAVE_TERM_H) 248 # include <term.h> 249 # endif 250 # endif 251 # endif 252 # endif 253 254 # if defined(NCURSES_VERSION) && defined(HAVE_DEFINE_KEY) 255 # define USE_KEYMAPS 1 256 # endif 257 258 #else 259 # if defined(VMS) && defined(__GNUC__) 260 # include <LYGCurses.h> 261 # else 262 # include <curses.h> /* everything else */ 263 # endif /* VMS && __GNUC__ */ 264 #endif /* HAVE_CONFIG_H */ 265 266 /* 267 * PDCurses' mouse code does nothing in the DJGPP configuration. 268 */ 269 #if defined(PDCURSES) && !defined(__DJGPP__) && !defined(HAVE_XCURSES) 270 #define USE_MOUSE 1 271 #endif 272 273 /* 274 * Pick up the native ncurses name: 275 */ 276 #if defined(NCURSES_MOUSE_VERSION) 277 #define USE_MOUSE 1 278 #endif 279 280 /* 281 * For systems where select() does not work for TTY's, we can poll using 282 * curses. 283 */ 284 #if defined(_WINDOWS) || defined(__MINGW32__) 285 #if defined(PDCURSES) && defined(PDC_BUILD) && PDC_BUILD >= 2401 286 #define USE_CURSES_NODELAY 1 287 #endif 288 289 #if defined(NCURSES_VERSION) 290 #define USE_CURSES_NODELAY 1 291 #endif 292 #endif /* _WINDOWS || __MINGW32__ */ 293 294 #if defined(NCURSES_VERSION) && defined(__BEOS__) 295 #define USE_CURSES_NODELAY 1 296 #endif 297 298 /* 299 * If we have pads, use them to implement left/right scrolling. 300 */ 301 #if defined(HAVE_NEWPAD) && defined(HAVE_PNOUTREFRESH) && !defined(PDCURSES) 302 #define USE_CURSES_PADS 1 303 #endif 304 305 /* 306 * ncurses 1.9.9e won't work for pads, but 4.2 does (1.9.9g doesn't have a 307 * convenient ifdef, though it would work). 308 */ 309 #if defined(NCURSES_VERSION) && !defined(NCURSES_VERSION_MAJOR) 310 #undef USE_CURSES_PADS 311 #endif 312 313 /* 314 * Most implementations of curses treat pair 0 specially, as the default 315 * foreground and background color. Also, the COLORS variable corresponds to 316 * the total number of colors. 317 * 318 * PDCurses does not follow these rules. Its COLORS variable claims it has 319 * 8 colors, but it actually implements 16. That makes it hard to optimize 320 * color settings against color pair 0 in a portable fashion. 321 */ 322 #if defined(COLOR_CURSES) 323 #if defined(PDCURSES) || defined(HAVE_XCURSES) 324 #define COLORS 16 /* should be a variable... */ 325 #else 326 #define USE_CURSES_PAIR_0 327 #endif 328 #endif 329 330 #if defined(_WINDOWS) && defined(PDCURSES) && defined(PDC_BUILD) && PDC_BUILD >= 2401 331 #define USE_MAXSCREEN_TOGGLE 1 332 extern void maxmizeWindowSize(void); 333 extern void recoverWindowSize(void); 334 #endif 335 336 #endif /* USE_SLANG */ 337 338 #ifdef __cplusplus 339 extern "C" { 340 #endif 341 #ifdef USE_SLANG 342 #define LYstopPopup() /* nothing */ 343 #define LYtopwindow() LYwin 344 #else 345 extern void LYsubwindow(WINDOW * param); 346 extern WINDOW *LYtopwindow(void); 347 348 #define LYstopPopup() LYsubwindow(0) 349 #endif /* NCURSES */ 350 351 extern void LYbox(WINDOW * win, int formfield); 352 extern WINDOW *LYstartPopup(int *top_y, int *left_x, int *height, int *width); 353 354 /* 355 * Useful macros not in PDCurses or very old ncurses headers. 356 */ 357 #if !defined(HAVE_GETBEGX) && !defined(getbegx) 358 #define getbegx(win) ((win)->_begx) 359 #endif 360 #if !defined(HAVE_GETBEGY) && !defined(getbegy) 361 #define getbegy(win) ((win)->_begy) 362 #endif 363 #if !defined(HAVE_GETBKGD) && !defined(getbkgd) 364 #define getbkgd(win) ((win)->_bkgd) 365 #endif 366 367 #if defined(HAVE_WATTR_GET) 368 extern long LYgetattrs(WINDOW * win); 369 370 #else 371 #if defined(HAVE_GETATTRS) || defined(getattrs) 372 #define LYgetattrs(win) getattrs(win) 373 #else 374 #define LYgetattrs(win) ((win)->_attrs) 375 #endif 376 #endif /* HAVE_WATTR_GET */ 377 378 #if defined(PDCURSES) 379 #define HAVE_GETBKGD 1 /* can use fallback definition */ 380 #define HAVE_NAPMS 1 /* can use millisecond-delays */ 381 # if defined(PDC_BUILD) && PDC_BUILD >= 2401 382 extern int saved_scrsize_x; 383 extern int saved_scrsize_y; 384 # endif 385 #endif 386 387 #ifdef HAVE_NAPMS 388 #define SECS2Secs(n) (1000 * (n)) 389 #define Secs2SECS(n) ((n) / 1000.0) 390 #define SECS_FMT "%.3f" 391 #else 392 #define SECS2Secs(n) (n) 393 #define Secs2SECS(n) (n) 394 #define SECS_FMT "%.0f" 395 #endif 396 397 #ifdef NCURSES_VERSION 398 extern void _nc_freeall(void); /* HAVE__NC_FREEALL */ 399 extern void _nc_free_and_exit(int); /* HAVE__NC_FREE_AND_EXIT */ 400 #endif 401 402 /* Both slang and curses: */ 403 #ifndef TRUE 404 #define TRUE 1 405 #endif /* !TRUE */ 406 #ifndef FALSE 407 #define FALSE 0 408 #endif /* !FALSE */ 409 410 #ifdef REDEFINE_CR 411 #define CR FROMASCII('\015') 412 #endif /* REDEFINE_CR */ 413 414 #ifdef ALT_CHAR_SET 415 #define BOXVERT 0 /* use alt char set for popup window vertical borders */ 416 #define BOXHORI 0 /* use alt char set for popup window vertical borders */ 417 #endif 418 419 #ifndef BOXVERT 420 #define BOXVERT '*' /* character for popup window vertical borders */ 421 #endif 422 #ifndef BOXHORI 423 #define BOXHORI '*' /* character for popup window horizontal borders */ 424 #endif 425 426 #ifndef KEY_DOWN 427 #undef HAVE_KEYPAD /* avoid confusion with bogus 'keypad()' */ 428 #endif 429 430 extern int LYlines; /* replaces LINES */ 431 extern int LYcols; /* replaces COLS */ 432 433 /* 434 * The scrollbar, if used, occupies the rightmost column. 435 */ 436 #ifdef USE_SCROLLBAR 437 #define LYbarWidth (LYShowScrollbar ? 1 : 0) 438 #else 439 #define LYbarWidth 0 440 #endif 441 442 /* 443 * Usable limits for display: 444 */ 445 #if defined(FANCY_CURSES) || defined(USE_SLANG) 446 #if defined(PDCURSES) 447 #define LYcolLimit (LYcols - LYbarWidth - 1) /* PDCurses wrapping is buggy */ 448 #else 449 #define LYcolLimit (LYcols - LYbarWidth) 450 #endif 451 #else 452 #define LYcolLimit (LYcols - 1) 453 #endif 454 455 #ifdef USE_CURSES_PADS 456 extern WINDOW *LYwin; 457 extern int LYshiftWin; 458 extern int LYwideLines; 459 extern int LYtableCols; 460 extern BOOLEAN LYuseCursesPads; 461 462 #else 463 #define LYwin stdscr 464 #define LYshiftWin 0 465 #define LYwideLines 0 466 #define LYtableCols 0 467 #endif 468 469 extern BOOLEAN setup(char *terminal); 470 extern int LYscreenHeight(void); 471 extern int LYscreenWidth(void); 472 extern int LYstrExtent(const char *string, int len, int maxCells); 473 extern int LYstrExtent2(const char *string, int len); 474 extern int LYstrFittable(const char *string, int maxCells); 475 extern int LYstrCells(const char *string); 476 extern void LYclear(void); 477 extern void LYclrtoeol(void); 478 extern void LYerase(void); 479 extern void LYmove(int y, int x); 480 extern void LYnoVideo(int mask); 481 extern void LYnormalColor(void); 482 extern void LYpaddstr(WINDOW * w, int width, const char *s); 483 extern void LYrefresh(void); 484 extern void LYstartTargetEmphasis(void); 485 extern void LYstopTargetEmphasis(void); 486 extern void LYtouchline(int row); 487 extern void LYwaddnstr(WINDOW * w, const char *s, size_t len); 488 extern void start_curses(void); 489 extern void stop_curses(void); 490 491 #define LYaddstr(s) LYwaddnstr(LYwin, s, strlen(s)) 492 493 #ifdef VMS 494 extern int DCLsystem(char *command); 495 extern void VMSexit(); 496 extern int ttopen(); 497 extern int ttclose(); 498 extern int ttgetc(); 499 extern void VMSsignal(int sig, void (*func) ()); 500 #endif /* VMS */ 501 502 #if defined(USE_COLOR_STYLE) 503 extern void add_to_lss_list(const char *source, const char *resolved); 504 extern void clear_lss_list(void); 505 extern void curses_css(char *name, int dir); 506 extern void curses_style(int style, int dir); 507 extern void curses_w_style(WINDOW * win, int style, int dir); 508 extern void init_color_styles(char **from_cmdline, const char *default_styles); 509 extern void reinit_color_styles(void); 510 extern void setHashStyle(int style, int color, int cattr, int mono, const char *element); 511 extern void setStyle(int style, int color, int cattr, int mono); 512 extern void update_color_style(void); 513 extern void wcurses_css(WINDOW * win, char *name, int dir); 514 515 # define LynxChangeStyle(style,dir) curses_style(style,dir) 516 # define LynxWChangeStyle(win,style,dir) curses_w_style(win,style,dir) 517 #else 518 # define LynxWChangeStyle(win,style,dir) (void)1 519 #endif /* USE_COLOR_STYLE */ 520 521 #ifdef USE_COLOR_TABLE 522 extern void LYaddAttr(int a); 523 extern void LYsubAttr(int a); 524 extern void lynx_setup_colors(void); 525 extern unsigned Lynx_Color_Flags; 526 #endif 527 528 #if defined(USE_COLOR_TABLE) || defined(USE_SLANG) 529 extern int Current_Attr; 530 #endif 531 532 #ifdef USE_SLANG 533 #define SHOW_WHEREIS_TARGETS 1 534 535 #if !defined(VMS) && !defined(DJGPP) 536 #define USE_MOUSE 1 537 #endif 538 539 #if !defined(__DJGPP__) && !defined(__CYGWIN__) 540 #define USE_KEYMAPS 1 541 #endif 542 543 #define SL_LYNX_USE_COLOR 1 544 #define SL_LYNX_OVERRIDE_COLOR 2 545 546 #define start_bold() LYaddAttr(LYUnderlineLinks ? 4 : 1) 547 #define start_reverse() LYaddAttr(2) 548 #define start_underline() LYaddAttr(LYUnderlineLinks ? 1 : 4) 549 #define stop_bold() LYsubAttr(LYUnderlineLinks ? 4 : 1) 550 #define stop_reverse() LYsubAttr(2) 551 #define stop_underline() LYsubAttr(LYUnderlineLinks ? 1 : 4) 552 553 #ifdef FANCY_CURSES 554 #undef FANCY_CURSES 555 #endif /* FANCY_CURSES */ 556 557 /* 558 * Map some curses functions to slang functions. 559 */ 560 #define stdscr ((WINDOW *)0) 561 #define COLS SLtt_Screen_Cols 562 #define LINES SLtt_Screen_Rows 563 #define move SLsmg_gotorc 564 #define addstr SLsmg_write_string 565 extern void LY_SLerase(void); 566 567 #define erase LY_SLerase 568 #define clear LY_SLerase 569 #define standout SLsmg_reverse_video 570 #define standend SLsmg_normal_video 571 #define clrtoeol SLsmg_erase_eol 572 573 #ifdef SLSMG_NEWLINE_SCROLLS 574 #define scrollok(a,b) SLsmg_Newline_Behavior \ 575 = ((b) ? SLSMG_NEWLINE_SCROLLS : SLSMG_NEWLINE_MOVES) 576 #else 577 #define scrollok(a,b) SLsmg_Newline_Moves = ((b) ? 1 : -1) 578 #endif 579 580 #define LYaddch(ch) SLsmg_write_char(ch) 581 582 #if SLANG_VERSION >= 20000 583 #define addch_raw(ch) do { \ 584 SLsmg_Char_Type buf; \ 585 buf.nchars = 1; \ 586 buf.wchars[0] = ch; \ 587 buf.color = Current_Attr; \ 588 SLsmg_write_raw (&buf, 1); \ 589 } while (0) 590 #else 591 #define addch_raw(ch) do { \ 592 SLsmg_Char_Type buf; \ 593 buf = (ch) | (Current_Attr << 4); \ 594 SLsmg_write_raw (&buf, 1); \ 595 } while (0) 596 #endif /* SLANG_VERSION >= 20000 */ 597 598 #define echo() 599 #define printw SLsmg_printf 600 601 extern int curscr; 602 extern BOOLEAN FullRefresh; 603 604 #ifdef clearok 605 #undef clearok 606 #endif /* clearok */ 607 #define clearok(a,b) { FullRefresh = (BOOLEAN)b; } 608 extern void LY_SLrefresh(void); 609 610 #ifdef refresh 611 #undef refresh 612 #endif /* refresh */ 613 #define refresh LY_SLrefresh 614 615 #ifdef VMS 616 extern void VTHome(void); 617 618 #define endwin() LYclear(),refresh(),SLsmg_reset_smg(),VTHome() 619 #else 620 #define endwin SLsmg_reset_smg(),SLang_reset_tty 621 #endif /* VMS */ 622 623 #else /* Define curses functions: */ 624 625 #ifdef FANCY_CURSES 626 #define SHOW_WHEREIS_TARGETS 1 627 628 #ifdef VMS 629 /* 630 * For VMS curses, [w]setattr() and [w]clrattr() 631 * add and subtract, respectively, the attributes 632 * _UNDERLINE, _BOLD, _REVERSE, and _BLINK. - FM 633 */ 634 #define start_bold() setattr(LYUnderlineLinks ? _UNDERLINE : _BOLD) 635 #define stop_bold() clrattr(LYUnderlineLinks ? _UNDERLINE : _BOLD) 636 #define start_underline() setattr(LYUnderlineLinks ? _BOLD : _UNDERLINE) 637 #define stop_underline() clrattr(LYUnderlineLinks ? _BOLD : _UNDERLINE) 638 #define start_reverse() setattr(_REVERSE) 639 #define wstart_reverse(w) wsetattr(w, _REVERSE) 640 #define stop_reverse() clrattr(_REVERSE) 641 #define wstop_reverse(w) wclrattr(w, _REVERSE) 642 643 #else /* Not VMS: */ 644 645 extern int string_to_attr(const char *name); 646 647 /* 648 * For Unix FANCY_FANCY curses we interpose 649 * our own functions to add or subtract the 650 * A_foo attributes. - FM 651 */ 652 #if defined(USE_COLOR_TABLE) && !defined(USE_COLOR_STYLE) 653 extern void LYaddWAttr(WINDOW * win, int a); 654 extern void LYsubWAttr(WINDOW * win, int a); 655 extern void LYaddWAttr(WINDOW * win, int a); 656 extern void LYsubWAttr(WINDOW * win, int a); 657 658 #undef standout 659 #define standout() lynx_standout(TRUE) 660 #undef standend 661 #define standend() lynx_standout(FALSE) 662 #else 663 #define LYaddAttr(attr) LYaddWAttr(LYwin,attr) 664 #define LYaddWAttr(win,attr) wattron(win,attr) 665 #define LYsubAttr(attr) LYsubWAttr(LYwin,attr) 666 #define LYsubWAttr(win,attr) wattroff(win,attr) 667 #endif 668 669 #if defined(USE_COLOR_TABLE) 670 extern void lynx_set_color(int a); 671 extern void lynx_standout(int a); 672 extern char *LYgetTableString(int code); 673 extern int LYgetTableAttr(void); 674 extern int lynx_chg_color(int, int, int); 675 #endif 676 677 #define start_bold() LYaddAttr(LYUnderlineLinks ? A_UNDERLINE : A_BOLD) 678 #define stop_bold() LYsubAttr(LYUnderlineLinks ? A_UNDERLINE : A_BOLD) 679 #define start_underline() LYaddAttr(LYUnderlineLinks ? A_BOLD : A_UNDERLINE) 680 #define stop_underline() LYsubAttr(LYUnderlineLinks ? A_BOLD : A_UNDERLINE) 681 682 #define start_reverse() LYaddAttr(A_REVERSE) 683 #define wstart_reverse(w) LYaddWAttr(w, A_REVERSE) 684 #define stop_reverse() LYsubAttr(A_REVERSE) 685 #define wstop_reverse(w) LYsubWAttr(w, A_REVERSE) 686 687 #endif /* VMS */ 688 689 #else /* Not FANCY_CURSES: */ 690 /* *INDENT-OFF* */ 691 #ifdef COLOR_CURSES 692 #undef COLOR_CURSES 693 Error FANCY_CURSES 694 There is a problem with the configuration. We expect to have FANCY_CURSES 695 defined when COLOR_CURSES is defined, since we build on the attributes used in 696 FANCY_CURSES. Check your config.log to see why the FANCY_CURSES test failed. 697 #endif 698 /* *INDENT-ON* */ 699 700 /* 701 * We only have [w]standout() and [w]standin(), 702 * so we'll use them synonymously for bold and 703 * reverse, and ignore underline. - FM 704 */ 705 #define start_bold() standout() 706 #define start_underline() /* nothing */ 707 #define start_reverse() standout() 708 #define wstart_reverse(a) wstandout(a) 709 #define stop_bold() standend() 710 #define stop_underline() /* nothing */ 711 #define stop_reverse() standend() 712 #define wstop_reverse(a) wstandend(a) 713 714 #endif /* FANCY_CURSES */ 715 716 #ifdef __hpux /* FIXME: configure check */ 717 #undef ACS_UARROW 718 #undef ACS_DARROW 719 #undef ACS_LARROW 720 #undef ACS_RARROW 721 #undef ACS_BLOCK 722 #undef ACS_CKBOARD 723 #endif 724 725 #ifndef ACS_UARROW 726 #define ACS_UARROW '^' 727 #endif 728 729 #ifndef ACS_DARROW 730 #define ACS_DARROW 'V' 731 #endif 732 733 #ifndef ACS_LARROW 734 #define ACS_LARROW '{' 735 #endif 736 737 #ifndef ACS_RARROW 738 #define ACS_RARROW '}' 739 #endif 740 741 #ifndef ACS_BLOCK 742 #define ACS_BLOCK '}' 743 #endif 744 745 #ifndef ACS_CKBOARD 746 #define ACS_CKBOARD '}' 747 #endif 748 749 #define LYaddch(ch) waddch(LYwin, ch) 750 751 #define addch_raw(ch) LYaddch(ch) 752 753 #endif /* USE_SLANG */ 754 755 #ifdef USE_SLANG 756 #define LYGetYX(y, x) y = SLsmg_get_row(), x = SLsmg_get_column() 757 #else 758 #ifdef getyx 759 #define LYGetYX(y, x) getyx(LYwin, y, x) 760 #else 761 #define LYGetYX(y, x) y = LYwin->_cury, x = LYwin->_curx 762 #endif /* getyx */ 763 #endif /* USE_SLANG */ 764 765 /* 766 * If the screen library allows us to specify "default" color, allow user to 767 * control it. 768 */ 769 #ifdef USE_DEFAULT_COLORS 770 #if defined(USE_SLANG) || defined(HAVE_ASSUME_DEFAULT_COLORS) 771 #define EXP_ASSUMED_COLOR 1 772 #endif 773 #endif 774 775 extern void lynx_enable_mouse(int); 776 extern void lynx_force_repaint(void); 777 extern void lynx_nl2crlf(int normal); 778 extern void lynx_start_title_color(void); 779 extern void lynx_stop_title_color(void); 780 extern void lynx_start_link_color(int flag, int pending); 781 extern void lynx_stop_link_color(int flag, int pending); 782 extern void lynx_stop_target_color(void); 783 extern void lynx_start_target_color(void); 784 extern void lynx_start_status_color(void); 785 extern void lynx_stop_status_color(void); 786 extern void lynx_start_h1_color(void); 787 extern void lynx_stop_h1_color(void); 788 extern void lynx_start_prompt_color(void); 789 extern void lynx_stop_prompt_color(void); 790 extern void lynx_start_radio_color(void); 791 extern void lynx_stop_radio_color(void); 792 extern void lynx_stop_all_colors(void); 793 794 extern void lynx_start_bold(void); 795 extern void lynx_start_reverse(void); 796 extern void lynx_start_underline(void); 797 extern void lynx_stop_bold(void); 798 extern void lynx_stop_reverse(void); 799 extern void lynx_stop_underline(void); 800 801 extern void restart_curses(void); 802 803 /* 804 * To prevent corrupting binary data on DOS, MS-WINDOWS or OS/2 we open files 805 * and stdout in BINARY mode by default. Where necessary we should open and 806 * (close!) TEXT mode. 807 * 808 * Note: EMX has no corresponding variable like _fmode on DOS, but it does 809 * have setmode. 810 */ 811 #if defined(_WINDOWS) || defined(DJGPP) || defined(__EMX__) || defined(WIN_EX) 812 #define SetOutputMode(mode) fflush(stdout), setmode(fileno(stdout), mode) 813 #else 814 #define SetOutputMode(mode) /* nothing */ 815 #endif 816 817 #if defined(_WINDOWS) || defined(DJGPP) 818 #define SetDefaultMode(mode) _fmode = mode 819 #else 820 #define SetDefaultMode(mode) /* nothing */ 821 #endif 822 823 /* 824 * Very old versions of curses cannot put the cursor on the lower right corner. 825 * Adjust our "hidden" cursor position accordingly. 826 */ 827 #if defined(FANCY_CURSES) || defined(USE_SLANG) 828 #define LYHideCursor() LYmove((LYlines - 1), (LYcolLimit - 1)) 829 #else 830 #define LYHideCursor() LYmove((LYlines - 1), (LYcolLimit - 2)) 831 #endif 832 833 #define LYParkCursor() LYmove((LYlines - 1), 0); LYclrtoeol() 834 835 extern void LYstowCursor(WINDOW * win, int row, int col); 836 extern void LYSetDisplayLines(void); 837 838 #ifdef __cplusplus 839 } 840 #endif 841 #endif /* LYCURSES_H */ 842