MCPcopy Create free account
hub / github.com/NetHack/NetHack / g_putch

Function g_putch

win/tty/wintty.c:3739–3790  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3737}
3738
3739void
3740g_putch(int in_ch)
3741{
3742 char ch = (char) in_ch;
3743
3744#ifndef WIN32CON
3745 HUPSKIP();
3746
3747#if defined(ASCIIGRAPH)
3748 if (SYMHANDLING(H_UTF8)) {
3749 (void) putchar(ch);
3750 } else if (SYMHANDLING(H_IBM)
3751 /* for DECgraphics, lower-case letters with high bit set mean
3752 switch character set and render with high bit clear;
3753 user might want 8-bits for other characters */
3754 || (iflags.eight_bit_tty && (!SYMHANDLING(H_DEC)
3755 || (in_ch & 0x7f) < 0x60))) {
3756 /* IBM-compatible displays don't need other stuff */
3757 (void) putchar(ch);
3758 } else if (ch & 0x80) {
3759 if (!GFlag || HE_resets_AS) {
3760 graph_on();
3761 GFlag = TRUE;
3762 }
3763 (void) putchar((ch ^ 0x80)); /* Strip 8th bit */
3764 } else {
3765 if (GFlag
3766#ifdef DECgraphicsOptimization
3767 /* for DECgraphics, we only need to switch back from the line
3768 drawing character set to the normal one if 'ch' is a lowercase
3769 letter or one of a handful of punctuation characters (the
3770 range is contiguous but somewhat odd); deferring graph_off()
3771 now might allow skipping both it and next potential graph_on() */
3772 && ch >= 0x5f && ch <= 0x7e
3773#endif
3774 ) {
3775 graph_off();
3776 GFlag = FALSE;
3777 }
3778 (void) putchar(ch);
3779 }
3780
3781#else /* ?ASCIIGRAPH */
3782 (void) putchar(ch);
3783
3784#endif /* ASCIIGRAPH */
3785#else /* WIN32CON */
3786 console_g_putch(in_ch);
3787 nhUse(ch);
3788#endif /* WIN32CON */
3789 return;
3790}
3791
3792#if defined(UNIX) || defined(VMS)
3793#if defined(ENHANCED_SYMBOLS)

Callers 3

redotoplinFunction · 0.85
process_text_windowFunction · 0.85
tty_print_glyphFunction · 0.85

Calls 3

console_g_putchFunction · 0.85
graph_onFunction · 0.70
graph_offFunction · 0.70

Tested by

no test coverage detected