We call this routine whenever DECgraphics mode is enabled, even if it has been previously set, in case the user manages to reset the fonts. The actual termcap fixup only needs to be done once, but we can't call xputs() from the option setting or graphics assigning routines, so this is a convenient hook. */
| 385 | so this is a convenient hook. |
| 386 | */ |
| 387 | static void |
| 388 | tty_decgraphics_termcap_fixup(void) |
| 389 | { |
| 390 | static char ctrlN[] = "\016"; |
| 391 | static char ctrlO[] = "\017"; |
| 392 | static char appMode[] = "\033="; |
| 393 | static char numMode[] = "\033>"; |
| 394 | |
| 395 | /* these values are missing from some termcaps */ |
| 396 | if (!AS) |
| 397 | AS = ctrlN; /* ^N (shift-out [graphics font]) */ |
| 398 | if (!AE) |
| 399 | AE = ctrlO; /* ^O (shift-in [regular font]) */ |
| 400 | if (!KS) |
| 401 | KS = appMode; /* ESC= (application keypad mode) */ |
| 402 | if (!KE) |
| 403 | KE = numMode; /* ESC> (numeric keypad mode) */ |
| 404 | /* |
| 405 | * Select the line-drawing character set as the alternate font. |
| 406 | * Do not select NA ASCII as the primary font since people may |
| 407 | * reasonably be using the UK character set. |
| 408 | */ |
| 409 | if (SYMHANDLING(H_DEC)) { |
| 410 | xputs("\033)0"); /* "\e)0" load line drawing chars as secondary set */ |
| 411 | /* TI doesn't necessarily do this; explicitly switch to primary |
| 412 | font in case previous program (either before starting nethack |
| 413 | or during a shell escape) left the alternate font active */ |
| 414 | xputs(AE); |
| 415 | } |
| 416 | |
| 417 | #ifdef PC9800 |
| 418 | init_hilite(); |
| 419 | #endif |
| 420 | |
| 421 | #if defined(ASCIIGRAPH) && !defined(NO_TERMS) |
| 422 | #if DECgraphicsOptimization |
| 423 | /* some termcaps suffer from the bizarre notion that resetting |
| 424 | video attributes should also reset the chosen character set */ |
| 425 | if (dynamic_HIHE) { |
| 426 | assert(nh_HE != NULL); |
| 427 | xputs(nh_HE); /* turn off any active highlighting (before maybe |
| 428 | * changing HE or AE) */ |
| 429 | (void) strsubst(nh_HE, AE, ""); |
| 430 | (void) strsubst(nh_HE, ctrlO, ""); |
| 431 | /* if AE has prefixing, substituting an empty string for it in HE |
| 432 | would only work if it is a leading prefix of HE; remove the |
| 433 | magic sequences that loads US set ("\e(B") or UK set ("\e(A") |
| 434 | into the primary character set since we don't want HE to do that */ |
| 435 | (void) strsubst(nh_HE, "\033(B", ""); |
| 436 | (void) strsubst(nh_HE, "\033(A", ""); |
| 437 | } |
| 438 | #endif |
| 439 | |
| 440 | /* if AE is still present in HE, set a flag so that glyph writing |
| 441 | code will know that AS needs to be refreshed for consecutive |
| 442 | line drawing characters */ |
| 443 | const char *ae = AE; |
| 444 |
no test coverage detected