some tty updates

Add a note about NO_TERMS to include/wintty.h for clarity.

Rename tty_startup and tty_shutdown to term_startup() and
term_shutdown(). They are found in termcap.c for !NO_TERMS
like most of the other term_ routines, as well as having
versions for several of the NO_TERMS platforms. They aren't
part of the tty_interface called from the core. The tty
implementation does call and rely on them.

Remove some conditional #ifdef's around term_shutdown()
(formerly tty_shutdown()) and just ensure that all the
tty platforms have an implementation that they can link
with, even if it is just a stub presently.

Put the protype for nethack_exit in extern.h to reduce
maintenance to a single spot, and remove it from other
locations. A warning in the msdos cross-compile led to
this change.
This commit is contained in:
nhmall
2025-01-04 19:01:34 -05:00
parent 7982c72e8b
commit 37758c7e48
18 changed files with 293 additions and 100 deletions
+8 -2
View File
@@ -78,7 +78,7 @@ static char tgotobuf[20];
static char tty_standout_on[16], tty_standout_off[16];
void
tty_startup(int *wid, int *hgt)
term_startup(int *wid, int *hgt)
{
#ifdef TERMLIB
const char *term;
@@ -336,7 +336,7 @@ tty_startup(int *wid, int *hgt)
*/
/* deallocate resources prior to final termination */
void
tty_shutdown(void)
term_shutdown(void)
{
/* we only attempt to clean up a few individual termcap variables */
#if defined(TERMLIB) || defined(ANSI_DEFAULT)
@@ -1494,10 +1494,16 @@ term_start_bgcolor(int color)
void
term_curs_set(int visibility)
{
static int vis = -1;
if (vis == visibility)
return;
if (!visibility && nh_VI)
xputs(nh_VI);
else if (visibility && nh_VE)
xputs(nh_VE);
vis = visibility;
}
#ifdef CHANGE_COLOR
+17 -21
View File
@@ -197,7 +197,7 @@ static int clipy = 0, clipymax = 0;
extern void adjust_cursor_flags(struct WinDesc *);
#endif
#if defined(ASCIIGRAPH) && !defined(NO_TERMS)
#if defined(ASCIIGRAPH)
boolean GFlag = FALSE;
boolean HE_resets_AS; /* see termcap.c */
#endif
@@ -518,9 +518,9 @@ tty_init_nhwindows(int *argcp UNUSED, char **argv UNUSED)
/*
* Remember tty modes, to be restored on exit.
*
* gettty() must be called before tty_startup()
* gettty() must be called before term_startup()
* due to ordering of LI/CO settings
* tty_startup() must be called before initoptions()
* term_startup() must be called before initoptions()
* due to ordering of graphics settings
*/
#if defined(UNIX) || defined(VMS)
@@ -529,7 +529,7 @@ tty_init_nhwindows(int *argcp UNUSED, char **argv UNUSED)
gettty();
/* to port dependant tty setup */
tty_startup(&wid, &hgt);
term_startup(&wid, &hgt);
setftty(); /* calls start_screen */
term_curs_set(0);
@@ -840,12 +840,7 @@ tty_exit_nhwindows(const char *str)
ttyDisplay = (struct DisplayDesc *) 0;
#endif
#ifndef NO_TERMS /*(until this gets added to the window interface)*/
tty_shutdown(); /* cleanup termcap/terminfo/whatever */
#endif
#ifdef WIN32CON
consoletty_exit();
#endif
term_shutdown(); /* cleanup termcap/terminfo/whatever */
iflags.window_inited = 0;
}
@@ -3720,15 +3715,15 @@ end_glyphout(void)
}
}
#ifndef WIN32CON
void
g_putch(int in_ch)
{
char ch = (char) in_ch;
#ifndef WIN32CON
HUPSKIP();
#if defined(ASCIIGRAPH) && !defined(NO_TERMS)
#if defined(ASCIIGRAPH)
if (SYMHANDLING(H_UTF8)) {
(void) putchar(ch);
} else if (SYMHANDLING(H_IBM)
@@ -3762,14 +3757,16 @@ g_putch(int in_ch)
(void) putchar(ch);
}
#else
#else /* ?ASCIIGRAPH */
(void) putchar(ch);
#endif /* ASCIIGRAPH && !NO_TERMS */
#endif /* ASCIIGRAPH */
#else /* WIN32CON */
console_g_putch(in_ch);
nhUse(ch);
#endif /* WIN32CON */
return;
}
#endif /* !WIN32CON */
#if defined(UNIX) || defined(VMS)
#if defined(ENHANCED_SYMBOLS)
@@ -3867,9 +3864,9 @@ tty_print_glyph(
#ifndef NO_TERMS
if (ul_hack && ch == '_') { /* non-destructive underscore */
(void) putchar((char) ' ');
backsp();
}
(void) putchar((char) ' ');
backsp();
}
#endif
if (iflags.use_color) {
ttyDisplay->colorflags = NH_BASIC_COLOR;
@@ -3965,13 +3962,12 @@ term_start_bgcolor(int color)
{
/* placeholder for now */
}
#endif /* !MSDOS && !WIN32 */
void
term_curs_set(int visibility UNUSED)
{
/* nothing */
}
#endif
#ifdef CHANGE_COLOR
void
-1
View File
@@ -53,7 +53,6 @@ Version _WIN_32IE Platform/IE
/*#define COMCTL_URL
* "http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp"*/
ATTRNORETURN extern void nethack_exit(int) NORETURN;
static TCHAR *_get_cmd_arg(TCHAR *pCmdLine);
static HRESULT GetComCtlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor);
BOOL WINAPI