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

View File

@@ -2098,6 +2098,7 @@ extern void consoletty_open(int);
extern void consoletty_rubout(void); extern void consoletty_rubout(void);
extern int tgetch(void); extern int tgetch(void);
extern int console_poskey(coordxy *, coordxy *, int *); extern int console_poskey(coordxy *, coordxy *, int *);
void console_g_putch(int in_ch);
extern void set_output_mode(int); extern void set_output_mode(int);
extern void synch_cursor(void); extern void synch_cursor(void);
extern void nethack_enter_consoletty(void); extern void nethack_enter_consoletty(void);
@@ -2302,6 +2303,13 @@ extern int getlock(void);
extern const char *get_portable_device(void); extern const char *get_portable_device(void);
#endif #endif
/* ### pcsys.c, windsys.c ### */
#if defined(MICRO) || defined(WIN32)
ATTRNORETURN extern void nethack_exit(int) NORETURN;
#else
#define nethack_exit exit
#endif
/* ### pcsys.c ### */ /* ### pcsys.c ### */
#if defined(MICRO) || defined(WIN32) #if defined(MICRO) || defined(WIN32)

View File

@@ -268,7 +268,6 @@ extern int alternative_palette(char *);
#endif #endif
#define nethack_enter(argc, argv) nethack_enter_windows() #define nethack_enter(argc, argv) nethack_enter_windows()
ATTRNORETURN extern void nethack_exit(int) NORETURN;
extern boolean file_exists(const char *); extern boolean file_exists(const char *);
extern boolean file_newer(const char *, const char *); extern boolean file_newer(const char *, const char *);
#ifndef SYSTEM_H #ifndef SYSTEM_H

View File

@@ -129,6 +129,8 @@ struct tty_status_fields {
#endif #endif
#define NHW_BASE (NHW_LAST_TYPE + 1) #define NHW_BASE (NHW_LAST_TYPE + 1)
/* external declarations */
extern struct window_procs tty_procs; extern struct window_procs tty_procs;
/* port specific variable declarations */ /* port specific variable declarations */
@@ -144,24 +146,53 @@ extern char defmorestr[]; /* default --more-- prompt */
/* port specific external function references */ /* port specific external function references */
/* ### getline.c ### */ /* ### getline.c ### */
extern void xwaitforspace(const char *); extern void xwaitforspace(const char *);
/* ### termcap.c, video.c ### */ /* ### termcap.c, video.c ### */
extern void tty_startup(int *, int *); /*
#ifndef NO_TERMS * TERM or NO_TERMS
extern void tty_shutdown(void); *
#endif * The tty windowport interface relies on lower-level support routines
extern int xputc(int); * to actually manipulate the terminal/display. Those are the right place
extern void xputs(const char *); * for doing strange and arcane things such as outputting escape sequences
#if defined(SCREEN_VGA) || defined(SCREEN_8514) || defined(SCREEN_VESA) * to select a color or whatever. wintty.c should concern itself with WHERE
extern void xputg(const glyph_info *, const glyph_info *); * to put stuff in a window.
#endif
* The TERM routines are found in:
*
* !NO_TERMS: termcap.c
*
* NO_TERMS:
* WINCON sys/windows/consoletty.c
* MSDOS sys/msdos/video.c
*
*/
extern void backsp(void);
extern void cl_end(void); extern void cl_end(void);
extern void term_clear_screen(void); extern void cl_eos(void);
extern void graph_on(void);
extern void graph_off(void);
extern void home(void); extern void home(void);
extern void standoutbeg(void); extern void standoutbeg(void);
extern void standoutend(void); extern void standoutend(void);
extern int term_attr_fixup(int);
extern void term_clear_screen(void);
extern void term_curs_set(int);
extern void term_end_attr(int attr);
extern void term_end_color(void);
extern void term_end_extracolor(void);
extern void term_end_raw_bold(void);
extern void term_start_attr(int attr);
extern void term_start_bgcolor(int color);
extern void term_start_color(int color);
extern void term_start_extracolor(uint32, uint16);
extern void term_start_raw_bold(void);
extern void term_startup(int *, int *);
extern void term_shutdown(void);
extern int xputc(int);
extern void xputs(const char *);
#if 0 #if 0
extern void revbeg(void); extern void revbeg(void);
extern void boldbeg(void); extern void boldbeg(void);
@@ -169,29 +200,9 @@ extern void blinkbeg(void);
extern void dimbeg(void); extern void dimbeg(void);
extern void m_end(void); extern void m_end(void);
#endif #endif
extern void backsp(void); #if defined(SCREEN_VGA) || defined(SCREEN_8514) || defined(SCREEN_VESA)
extern void graph_on(void); extern void xputg(const glyph_info *, const glyph_info *);
extern void graph_off(void); #endif
extern void cl_eos(void);
/*
* termcap.c (or facsimiles in other ports) is the right place for doing
* strange and arcane things such as outputting escape sequences to select
* a color or whatever. wintty.c should concern itself with WHERE to put
* stuff in a window.
*/
extern int term_attr_fixup(int);
extern void term_start_attr(int attr);
extern void term_end_attr(int attr);
extern void term_start_raw_bold(void);
extern void term_end_raw_bold(void);
extern void term_end_color(void);
extern void term_start_color(int color);
extern void term_start_bgcolor(int color);
extern void term_start_extracolor(uint32, uint16);
extern void term_end_extracolor(void); /* termcap.c, consoletty.c */
extern void term_curs_set(int);
/* ### topl.c ### */ /* ### topl.c ### */
@@ -203,6 +214,7 @@ extern void update_topl(const char *);
extern void putsyms(const char *); extern void putsyms(const char *);
/* ### wintty.c ### */ /* ### wintty.c ### */
#ifdef CLIPPING #ifdef CLIPPING
extern void setclipped(void); extern void setclipped(void);
#endif #endif
@@ -217,7 +229,7 @@ extern void g_pututf8(uint8 *);
extern void erase_tty_screen(void); extern void erase_tty_screen(void);
extern void win_tty_init(int); extern void win_tty_init(int);
/* external declarations */ /* tty interface */
extern void tty_init_nhwindows(int *, char **); extern void tty_init_nhwindows(int *, char **);
extern void tty_preference_update(const char *); extern void tty_preference_update(const char *);
extern void tty_player_selection(void); extern void tty_player_selection(void);

View File

@@ -541,7 +541,7 @@ setftty(void)
} }
void void
tty_startup(int *width, int *height) term_startup(int *width, int *height)
{ {
_mt_init_stuff(); _mt_init_stuff();
*width = CO; *width = CO;

View File

@@ -36,12 +36,6 @@ staticfn void fixup_death(int);
staticfn int wordcount(char *); staticfn int wordcount(char *);
staticfn void bel_copy1(char **, char *); staticfn void bel_copy1(char **, char *);
#if defined(__BEOS__) || defined(MICRO) || defined(OS2) || defined(WIN32)
ATTRNORETURN extern void nethack_exit(int) NORETURN;
#else
#define nethack_exit exit
#endif
#define done_stopprint program_state.stopprint #define done_stopprint program_state.stopprint
/* /*

View File

@@ -55,6 +55,7 @@
#endif #endif
#define GETCURPOS 0x03 /* Get Cursor Position */ #define GETCURPOS 0x03 /* Get Cursor Position */
#define SETCURTYP 0x01 /* Set Cursor Type */
#define GETMODE 0x0f /* Get Video Mode */ #define GETMODE 0x0f /* Get Video Mode */
#define SETMODE 0x00 /* Set Video Mode */ #define SETMODE 0x00 /* Set Video Mode */
#define SETPAGE 0x05 /* Set Video Page */ #define SETPAGE 0x05 /* Set Video Page */
@@ -248,6 +249,8 @@ extern void txt_nhbell(void);
extern void txt_startup(int *, int *); extern void txt_startup(int *, int *);
extern void txt_xputs(const char *, int, int); extern void txt_xputs(const char *, int, int);
extern void txt_xputc(char, int); extern void txt_xputc(char, int);
extern void txt_hide_cursor(void);
extern void txt_show_cursor(void);
/* ### vidvga.c ### */ /* ### vidvga.c ### */
@@ -258,6 +261,8 @@ extern void vga_clear_screen(int);
extern void vga_cl_end(int, int); extern void vga_cl_end(int, int);
extern void vga_cl_eos(int); extern void vga_cl_eos(int);
extern int vga_detect(void); extern int vga_detect(void);
extern void vga_hide_cursor(void);
extern void vga_show_cursor(void);
#ifdef SIMULATE_CURSOR #ifdef SIMULATE_CURSOR
extern void vga_DrawCursor(void); extern void vga_DrawCursor(void);
#endif #endif
@@ -273,7 +278,7 @@ extern void vga_HideCursor(void);
#endif #endif
extern void vga_Init(void); extern void vga_Init(void);
extern void vga_tty_end_screen(void); extern void vga_tty_end_screen(void);
extern void vga_tty_startup(int *, int *); extern void vga_term_startup(int *, int *);
extern void vga_xputs(const char *, int, int); extern void vga_xputs(const char *, int, int);
extern void vga_xputc(char, int); extern void vga_xputc(char, int);
extern void vga_xputg(const glyph_info *, const glyph_info *); extern void vga_xputg(const glyph_info *, const glyph_info *);
@@ -288,6 +293,8 @@ extern void vesa_clear_screen(int);
extern void vesa_cl_end(int, int); extern void vesa_cl_end(int, int);
extern void vesa_cl_eos(int); extern void vesa_cl_eos(int);
extern int vesa_detect(void); extern int vesa_detect(void);
extern void vesa_hide_cursor(void);
extern void vesa_show_cursor(void);
#ifdef SIMULATE_CURSOR #ifdef SIMULATE_CURSOR
extern void vesa_DrawCursor(void); extern void vesa_DrawCursor(void);
#endif #endif
@@ -302,7 +309,7 @@ extern void vesa_HideCursor(void);
#endif #endif
extern void vesa_Init(void); extern void vesa_Init(void);
extern void vesa_tty_end_screen(void); extern void vesa_tty_end_screen(void);
extern void vesa_tty_startup(int *, int *); extern void vesa_term_startup(int *, int *);
extern void vesa_xputs(const char *, int, int); extern void vesa_xputs(const char *, int, int);
extern void vesa_xputc(char, int); extern void vesa_xputc(char, int);
extern void vesa_xputg(const glyph_info *, const glyph_info *); extern void vesa_xputg(const glyph_info *, const glyph_info *);

View File

@@ -146,6 +146,61 @@ boolean traditional = FALSE; /* traditional TTY character mode */
boolean inmap = FALSE; /* in the map window */ boolean inmap = FALSE; /* in the map window */
char ttycolors[CLR_MAX]; /* also used/set in options.c */ char ttycolors[CLR_MAX]; /* also used/set in options.c */
/* for linkage from wintty.c */
void
term_shutdown(void)
{
}
#ifdef ASCIIGRAPH
void
graph_on(void)
{
}
void
graph_off(void)
{
}
#endif
void
term_curs_set(int visibility)
{
static int vis = -1;
if (vis == visibility)
return;
if (!visibility) {
if (!iflags.grmode) {
txt_hide_cursor();
#ifdef SCREEN_VGA
} else if (iflags.usevga) {
vga_hide_cursor();
#endif
#ifdef SCREEN_VESA
} else if (iflags.usevesa) {
vesa_hide_cursor();
}
#endif
} else if (visibility) {
if (!iflags.grmode) {
txt_show_cursor();
#ifdef SCREEN_VGA
} else if (iflags.usevga) {
vga_show_cursor();
#endif
#ifdef SCREEN_VESA
} else if (iflags.usevesa) {
vesa_show_cursor();
}
#endif
}
vis = visibility;
}
void void
backsp(void) backsp(void)
{ {
@@ -447,7 +502,7 @@ tty_number_pad(int state)
} }
void void
tty_startup(int *wid, int *hgt) term_startup(int *wid, int *hgt)
{ {
/* code to sense display adapter is required here - MJA */ /* code to sense display adapter is required here - MJA */
@@ -461,12 +516,12 @@ tty_startup(int *wid, int *hgt)
#ifdef SCREEN_VGA #ifdef SCREEN_VGA
if (iflags.usevga) { if (iflags.usevga) {
vga_tty_startup(wid, hgt); vga_term_startup(wid, hgt);
} else } else
#endif #endif
#ifdef SCREEN_VESA #ifdef SCREEN_VESA
if (iflags.usevesa) { if (iflags.usevesa) {
vesa_tty_startup(wid, hgt); vesa_term_startup(wid, hgt);
} else } else
#endif #endif
txt_startup(wid, hgt); txt_startup(wid, hgt);

View File

@@ -38,6 +38,14 @@ extern int attrib_gr_normal; /* graphics mode normal attribute */
extern int attrib_text_intense; /* text mode intense attribute */ extern int attrib_text_intense; /* text mode intense attribute */
extern int attrib_gr_intense; /* graphics mode intense attribute */ extern int attrib_gr_intense; /* graphics mode intense attribute */
#if defined(SCREEN_BIOS) && !defined(PC9800)
static unsigned char cursor_info = 0,
cursor_start_scanline = 6, cursor_end_scanline = 7;
static void get_cursinfo(unsigned char *start, unsigned char *end,
unsigned char *flg);
#endif
void void
txt_get_scr_size(void) txt_get_scr_size(void)
{ {
@@ -80,6 +88,7 @@ txt_get_scr_size(void)
LI = regs.h.dl + 1; LI = regs.h.dl + 1;
CO = regs.h.ah; CO = regs.h.ah;
#endif /* PC9800 */ #endif /* PC9800 */
} }
@@ -260,6 +269,9 @@ txt_startup(int *wid, int *hgt)
attrib_gr_normal = attrib_text_normal; attrib_gr_normal = attrib_text_normal;
attrib_gr_intense = attrib_text_intense; attrib_gr_intense = attrib_text_intense;
g_attribute = attrib_text_normal; /* Give it a starting value */ g_attribute = attrib_text_normal; /* Give it a starting value */
get_cursinfo(&cursor_start_scanline,
&cursor_end_scanline,
&cursor_info);
} }
/* /*
@@ -400,6 +412,61 @@ void txt_get_cursor(int *x, int *y)
(void) int86(VIDEO_BIOS, &regs, &regs); /* Get Cursor Position */ (void) int86(VIDEO_BIOS, &regs, &regs); /* Get Cursor Position */
*x = regs.h.dl; *x = regs.h.dl;
*y = regs.h.dh; *y = regs.h.dh;
if (!cursor_info) {
cursor_start_scanline = regs.h.ch;
cursor_end_scanline = regs.h.cl;
cursor_info = 1;
}
}
void txt_hide_cursor(void)
{
union REGS regs;
regs.x.dx = 0;
regs.h.ah = SETCURTYP; /* set cursor type */
regs.h.ch = 0x3F; /* starting scanline */
regs.h.cl = 0; /* ending scanline */
regs.x.bx = 0;
(void) int86(VIDEO_BIOS, &regs, &regs);
}
void txt_show_cursor(void)
{
union REGS regs;
regs.x.dx = 0;
regs.h.ah = SETCURTYP; /* set cursor type */
if (cursor_info) {
regs.h.ch = cursor_start_scanline; /* starting scanline */
regs.h.cl = cursor_end_scanline; /* ending scanline */
} else {
regs.h.ch = 6; /* starting scanline */
regs.h.cl = 7; /* ending scanline */
}
regs.x.bx = 0;
(void) int86(VIDEO_BIOS, &regs, &regs);
}
static void
get_cursinfo(uchar *start, uchar *end, uchar *flg)
{
union REGS regs;
regs.x.dx = 0;
regs.h.ah = GETCURPOS; /* get cursor position */
regs.x.cx = 0;
regs.x.bx = 0;
(void) int86(VIDEO_BIOS, &regs, &regs); /* Get Cursor Position */
if (regs.h.ch != 0x3f) {
*start = regs.h.ch;
*end = regs.h.cl;
} else {
*start = 6;
*end = 7;
}
*flg = 1;
} }
#endif /* SCREEN_BIOS && !PC9800 */ #endif /* SCREEN_BIOS && !PC9800 */

View File

@@ -603,7 +603,7 @@ vesa_tty_end_screen(void)
} }
void void
vesa_tty_startup(int *wid, int *hgt) vesa_term_startup(int *wid, int *hgt)
{ {
/* code to sense display adapter is required here - MJA */ /* code to sense display adapter is required here - MJA */
@@ -2042,6 +2042,16 @@ vesa_SetSoftPalette(const struct Pixel *palette)
return TRUE; return TRUE;
} }
void
vesa_hide_cursor(void)
{
}
void
vesa_show_cursor(void)
{
}
#ifdef POSITIONBAR #ifdef POSITIONBAR
#define PBAR_ROW (LI - 4) #define PBAR_ROW (LI - 4)

View File

@@ -297,7 +297,7 @@ vga_tty_end_screen(void)
} }
void void
vga_tty_startup(int *wid, int *hgt) vga_term_startup(int *wid, int *hgt)
{ {
/* code to sense display adapter is required here - MJA */ /* code to sense display adapter is required here - MJA */
@@ -1159,6 +1159,16 @@ vga_SetPalette(const struct Pixel *p)
} }
} }
void
vga_hide_cursor(void)
{
}
void
vga_show_cursor(void)
{
}
/*static unsigned char colorbits[]={0x01,0x02,0x04,0x08}; */ /* wrong */ /*static unsigned char colorbits[]={0x01,0x02,0x04,0x08}; */ /* wrong */
static unsigned char colorbits[] = { 0x08, 0x04, 0x02, 0x01 }; static unsigned char colorbits[] = { 0x08, 0x04, 0x02, 0x01 };

View File

@@ -22,12 +22,6 @@
#include <unistd.h> /* for getcwd() prototype */ #include <unistd.h> /* for getcwd() prototype */
#endif #endif
#if defined(MICRO) || defined(OS2)
ATTRNORETURN void nethack_exit(int) NORETURN;
#else
#define nethack_exit exit
#endif
char *exepath(char *); char *exepath(char *);
char orgdir[PATHLEN]; /* also used in pcsys.c, amidos.c */ char orgdir[PATHLEN]; /* also used in pcsys.c, amidos.c */

View File

@@ -27,11 +27,6 @@
#define filesize filesize_nh #define filesize filesize_nh
#endif #endif
#if defined(MICRO) || defined(OS2)
ATTRNORETURN void nethack_exit(int) NORETURN;
#else
#define nethack_exit exit
#endif
static void msexit(void); static void msexit(void);
#ifdef MOVERLAY #ifdef MOVERLAY
@@ -276,6 +271,7 @@ msexit(void)
restore_colors(); restore_colors();
#endif #endif
wait_synch(); wait_synch();
term_curs_set(1);
return; return;
} }
#endif /* MICRO || OS2 */ #endif /* MICRO || OS2 */

View File

@@ -235,8 +235,8 @@ ifeq "$(WANT_DEBUG)" "1"
GDBEXE=$(dostargetexes)gdb.exe GDBEXE=$(dostargetexes)gdb.exe
GDBBAT=NHGDB.BAT GDBBAT=NHGDB.BAT
GDBCMDLINE=directory nhsrc/src nhsrc/include nhsrc/sys/msdos \ GDBCMDLINE=directory nhsrc/src nhsrc/include nhsrc/sys/msdos \
nhsrc/sys/share nhsrc/win/share nhsrc/win/curses \ nhsrc/sys/share nhsrc/win/curses \
nhsrc/win/tty nhsrc/util nhsrc/win/tty
else else
GDBEXE= GDBEXE=
GDBBAT= GDBBAT=

View File

@@ -1079,7 +1079,7 @@ setftty(void)
} }
void void
tty_startup(int *wid, int *hgt) term_startup(int *wid, int *hgt)
{ {
*wid = console.width; *wid = console.width;
*hgt = console.height; *hgt = console.height;
@@ -1092,6 +1092,36 @@ tty_number_pad(int state UNUSED)
// do nothing // do nothing
} }
/* stub tcap replacements for linkage from wintty.c */
void
term_shutdown(void)
{
consoletty_exit();
}
#ifdef ASCIIGRAPH
void
graph_on(void)
{
}
void
graph_off(void)
{
}
#endif
void
tty_end_screen(void)
{
term_clear_screen();
really_move_cursor();
buffer_fill_to_end(console.back_buffer, &clear_cell, 0, 0);
back_buffer_flip();
FlushConsoleInputBuffer(console.hConIn);
}
void void
tty_start_screen(void) tty_start_screen(void)
{ {
@@ -1107,16 +1137,6 @@ tty_start_screen(void)
#endif /* VIRTUAL_TERMINAL_SEQUENCES */ #endif /* VIRTUAL_TERMINAL_SEQUENCES */
} }
void
tty_end_screen(void)
{
term_clear_screen();
really_move_cursor();
buffer_fill_to_end(console.back_buffer, &clear_cell, 0, 0);
back_buffer_flip();
FlushConsoleInputBuffer(console.hConIn);
}
static BOOL static BOOL
CtrlHandler(DWORD ctrltype) CtrlHandler(DWORD ctrltype)
{ {
@@ -1251,6 +1271,7 @@ console_poskey(coordxy *x, coordxy *y, int *mod)
if (gc.Cmd.swap_yz) if (gc.Cmd.swap_yz)
numberpad |= 0x10; numberpad |= 0x10;
#endif #endif
term_curs_set(1);
ch = (program_state.done_hup) ch = (program_state.done_hup)
? '\033' ? '\033'
: keyboard_handling.pCheckInput( : keyboard_handling.pCheckInput(
@@ -1262,6 +1283,7 @@ console_poskey(coordxy *x, coordxy *y, int *mod)
*x = cc.x; *x = cc.x;
*y = cc.y; *y = cc.y;
} }
term_curs_set(0);
return ch; return ch;
} }
@@ -1462,7 +1484,7 @@ xputc_core(int ch)
*/ */
#endif #endif
void void
g_putch(int in_ch) console_g_putch(int in_ch)
{ {
unsigned char ch; unsigned char ch;
cell_t cell; cell_t cell;
@@ -1644,6 +1666,25 @@ term_clear_screen(void)
home(); home();
} }
void
term_curs_set(int visibility)
{
static int vis = -1;
if (vis == visibility)
return;
static CONSOLE_CURSOR_INFO cursorinfo = { 0, 0 };
if (!cursorinfo.dwSize) {
GetConsoleCursorInfo(console.hConOut, &cursorinfo);
vis = cursorinfo.bVisible ? 1 : 0;
}
cursorinfo.bVisible = visibility ? (BOOL) TRUE : (BOOL) FALSE;
SetConsoleCursorInfo(console.hConOut, &cursorinfo);
vis = visibility;
}
void void
home(void) home(void)
{ {

View File

@@ -25,7 +25,6 @@ char *translate_path_variables(const char *, char *);
char *exename(void); char *exename(void);
boolean fakeconsole(void); boolean fakeconsole(void);
void freefakeconsole(void); void freefakeconsole(void);
ATTRNORETURN extern void nethack_exit(int) NORETURN;
#if defined(MSWIN_GRAPHICS) #if defined(MSWIN_GRAPHICS)
extern void mswin_destroy_reg(void); extern void mswin_destroy_reg(void);
#endif #endif

View File

@@ -78,7 +78,7 @@ static char tgotobuf[20];
static char tty_standout_on[16], tty_standout_off[16]; static char tty_standout_on[16], tty_standout_off[16];
void void
tty_startup(int *wid, int *hgt) term_startup(int *wid, int *hgt)
{ {
#ifdef TERMLIB #ifdef TERMLIB
const char *term; const char *term;
@@ -336,7 +336,7 @@ tty_startup(int *wid, int *hgt)
*/ */
/* deallocate resources prior to final termination */ /* deallocate resources prior to final termination */
void void
tty_shutdown(void) term_shutdown(void)
{ {
/* we only attempt to clean up a few individual termcap variables */ /* we only attempt to clean up a few individual termcap variables */
#if defined(TERMLIB) || defined(ANSI_DEFAULT) #if defined(TERMLIB) || defined(ANSI_DEFAULT)
@@ -1494,10 +1494,16 @@ term_start_bgcolor(int color)
void void
term_curs_set(int visibility) term_curs_set(int visibility)
{ {
static int vis = -1;
if (vis == visibility)
return;
if (!visibility && nh_VI) if (!visibility && nh_VI)
xputs(nh_VI); xputs(nh_VI);
else if (visibility && nh_VE) else if (visibility && nh_VE)
xputs(nh_VE); xputs(nh_VE);
vis = visibility;
} }
#ifdef CHANGE_COLOR #ifdef CHANGE_COLOR

View File

@@ -197,7 +197,7 @@ static int clipy = 0, clipymax = 0;
extern void adjust_cursor_flags(struct WinDesc *); extern void adjust_cursor_flags(struct WinDesc *);
#endif #endif
#if defined(ASCIIGRAPH) && !defined(NO_TERMS) #if defined(ASCIIGRAPH)
boolean GFlag = FALSE; boolean GFlag = FALSE;
boolean HE_resets_AS; /* see termcap.c */ boolean HE_resets_AS; /* see termcap.c */
#endif #endif
@@ -518,9 +518,9 @@ tty_init_nhwindows(int *argcp UNUSED, char **argv UNUSED)
/* /*
* Remember tty modes, to be restored on exit. * 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 * 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 * due to ordering of graphics settings
*/ */
#if defined(UNIX) || defined(VMS) #if defined(UNIX) || defined(VMS)
@@ -529,7 +529,7 @@ tty_init_nhwindows(int *argcp UNUSED, char **argv UNUSED)
gettty(); gettty();
/* to port dependant tty setup */ /* to port dependant tty setup */
tty_startup(&wid, &hgt); term_startup(&wid, &hgt);
setftty(); /* calls start_screen */ setftty(); /* calls start_screen */
term_curs_set(0); term_curs_set(0);
@@ -840,12 +840,7 @@ tty_exit_nhwindows(const char *str)
ttyDisplay = (struct DisplayDesc *) 0; ttyDisplay = (struct DisplayDesc *) 0;
#endif #endif
#ifndef NO_TERMS /*(until this gets added to the window interface)*/ term_shutdown(); /* cleanup termcap/terminfo/whatever */
tty_shutdown(); /* cleanup termcap/terminfo/whatever */
#endif
#ifdef WIN32CON
consoletty_exit();
#endif
iflags.window_inited = 0; iflags.window_inited = 0;
} }
@@ -3720,15 +3715,15 @@ end_glyphout(void)
} }
} }
#ifndef WIN32CON
void void
g_putch(int in_ch) g_putch(int in_ch)
{ {
char ch = (char) in_ch; char ch = (char) in_ch;
#ifndef WIN32CON
HUPSKIP(); HUPSKIP();
#if defined(ASCIIGRAPH) && !defined(NO_TERMS) #if defined(ASCIIGRAPH)
if (SYMHANDLING(H_UTF8)) { if (SYMHANDLING(H_UTF8)) {
(void) putchar(ch); (void) putchar(ch);
} else if (SYMHANDLING(H_IBM) } else if (SYMHANDLING(H_IBM)
@@ -3762,14 +3757,16 @@ g_putch(int in_ch)
(void) putchar(ch); (void) putchar(ch);
} }
#else #else /* ?ASCIIGRAPH */
(void) putchar(ch); (void) putchar(ch);
#endif /* ASCIIGRAPH && !NO_TERMS */ #endif /* ASCIIGRAPH */
#else /* WIN32CON */
console_g_putch(in_ch);
nhUse(ch);
#endif /* WIN32CON */
return; return;
} }
#endif /* !WIN32CON */
#if defined(UNIX) || defined(VMS) #if defined(UNIX) || defined(VMS)
#if defined(ENHANCED_SYMBOLS) #if defined(ENHANCED_SYMBOLS)
@@ -3965,13 +3962,12 @@ term_start_bgcolor(int color)
{ {
/* placeholder for now */ /* placeholder for now */
} }
#endif /* !MSDOS && !WIN32 */
void void
term_curs_set(int visibility UNUSED) term_curs_set(int visibility UNUSED)
{ {
/* nothing */ /* nothing */
} }
#endif
#ifdef CHANGE_COLOR #ifdef CHANGE_COLOR
void void

View File

@@ -53,7 +53,6 @@ Version _WIN_32IE Platform/IE
/*#define COMCTL_URL /*#define COMCTL_URL
* "http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp"*/ * "http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp"*/
ATTRNORETURN extern void nethack_exit(int) NORETURN;
static TCHAR *_get_cmd_arg(TCHAR *pCmdLine); static TCHAR *_get_cmd_arg(TCHAR *pCmdLine);
static HRESULT GetComCtlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor); static HRESULT GetComCtlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor);
BOOL WINAPI BOOL WINAPI