add a macro to ease conditional testing based on active window port

Add WINDOWPORT macro

example:
if (WINDOWPORT("tty"))
	pline("Look at me, I'm on tty at the moment!");
This commit is contained in:
nhmall
2018-12-02 09:56:44 -05:00
parent 38b31dd9ca
commit 4a4b3fb8f1
10 changed files with 35 additions and 27 deletions

View File

@@ -190,7 +190,7 @@ sanitize_name(namebuf)
char *namebuf;
{
int c;
boolean strip_8th_bit = (!strcmp(windowprocs.name, "tty")
boolean strip_8th_bit = (WINDOWPORT("tty")
&& !iflags.wc_eight_bit_input);
/* it's tempting to skip this for single-user platforms, since

View File

@@ -1049,7 +1049,7 @@ wiz_show_wmodes(VOID_ARGS)
int x, y;
char row[COLNO + 1];
struct rm *lev;
boolean istty = !strcmp(windowprocs.name, "tty");
boolean istty = WINDOWPORT("tty");
win = create_nhwindow(NHW_TEXT);
if (istty)

View File

@@ -1279,7 +1279,7 @@ boolean uncomp;
int i = 0;
int f;
#ifdef TTY_GRAPHICS
boolean istty = !strncmpi(windowprocs.name, "tty", 3);
boolean istty = WINDOWPORT("tty");
#endif
Strcpy(cfn, filename);

View File

@@ -828,7 +828,7 @@ register int fd;
#ifdef AMII_GRAPHICS
{
extern struct window_procs amii_procs;
if (windowprocs.win_init_nhwindows == amii_procs.win_init_nhwindows) {
if (WINDOWPORT("amii") {
extern winid WIN_BASE;
clear_nhwindow(WIN_BASE); /* hack until there's a hook for this */
}
@@ -844,7 +844,7 @@ register int fd;
curs(WIN_MAP, 1, 1);
dotcnt = 0;
dotrow = 2;
if (strncmpi("X11", windowprocs.name, 3))
if (!WINDOWPORT("X11"))
putstr(WIN_MAP, 0, "Restoring:");
#endif
restoreprocs.mread_flags = 1; /* return despite error */
@@ -859,7 +859,7 @@ register int fd;
dotrow++;
dotcnt = 0;
}
if (strncmpi("X11", windowprocs.name, 3)) {
if (!WINDOWPORT("X11")) {
putstr(WIN_MAP, 0, ".");
}
mark_synch();

View File

@@ -178,7 +178,7 @@ dosave0()
dotcnt = 0;
dotrow = 2;
curs(WIN_MAP, 1, 1);
if (strncmpi("X11", windowprocs.name, 3))
if (!WINDOWPORT("X11"))
putstr(WIN_MAP, 0, "Saving:");
#endif
#ifdef MFLOPPY
@@ -242,7 +242,7 @@ dosave0()
dotrow++;
dotcnt = 0;
}
if (strncmpi("X11", windowprocs.name, 3)) {
if (!WINDOWPORT("X11")) {
putstr(WIN_MAP, 0, ".");
}
mark_synch();