Remove TEXTCOLOR build option

This commit is contained in:
nhmall
2023-11-22 16:01:58 -05:00
parent 6272e18d7b
commit 04082a2033
60 changed files with 105 additions and 483 deletions

View File

@@ -20,12 +20,12 @@ void nocmov(int, int);
void term_start_24bitcolor(struct unicode_representation *);
void term_end_24bitcolor(void);
#if defined(TEXTCOLOR) && defined(TERMLIB)
#if defined(TERMLIB)
#if (!defined(UNIX) || !defined(TERMINFO)) && !defined(TOS)
static void analyze_seq(char *, int *, int *);
#endif
#endif
#if defined(TEXTCOLOR) && (defined(TERMLIB) || defined(ANSI_DEFAULT))
#if (defined(TERMLIB) || defined(ANSI_DEFAULT))
static void init_hilite(void);
static void kill_hilite(void);
#endif
@@ -45,13 +45,11 @@ static char PC = '\0';
static char tbuf[512];
#endif /*TERMLIB*/
#ifdef TEXTCOLOR
#ifdef TOS
const char *hilites[CLR_MAX]; /* terminal escapes for the various colors */
#else
char NEARDATA *hilites[CLR_MAX]; /* terminal escapes for the various colors */
#endif
#endif
static char *KS = (char *) 0, *KE = (char *) 0; /* keypad sequences */
static char nullstr[] = "";
@@ -160,9 +158,7 @@ tty_startup(int *wid, int *hgt)
AE = nhStr("\017");
#endif
TE = VS = VE = nullstr;
#ifdef TEXTCOLOR
init_hilite();
#endif /* TEXTCOLOR */
*wid = CO;
*hgt = LI;
CL = nhStr("\033[2J"); /* last thing set */
@@ -297,7 +293,6 @@ tty_startup(int *wid, int *hgt)
AS = Tgetstr(nhStr("as")); /* alt charset start */
AE = Tgetstr(nhStr("ae")); /* alt charset end */
nh_CD = Tgetstr(nhStr("cd")); /* clear lines from cursor and down */
#ifdef TEXTCOLOR
#if defined(TOS) && defined(__GNUC__)
if (!strcmp(term, "builtin") || !strcmp(term, "tw52")
|| !strcmp(term, "st52")) {
@@ -305,7 +300,6 @@ tty_startup(int *wid, int *hgt)
}
#else
init_hilite();
#endif
#endif
*wid = CO;
*hgt = LI;
@@ -332,7 +326,7 @@ void
tty_shutdown(void)
{
/* we only attempt to clean up a few individual termcap variables */
#if defined(TEXTCOLOR) && (defined(TERMLIB) || defined(ANSI_DEFAULT))
#if defined(TERMLIB) || defined(ANSI_DEFAULT)
kill_hilite();
#endif
#ifdef TERMLIB
@@ -809,7 +803,7 @@ cl_eos(void) /* free after Robert Viduya */
}
}
#if defined(TEXTCOLOR) && defined(TERMLIB)
#if defined(TERMLIB)
#if defined(UNIX) && defined(TERMINFO)
/*
* Sets up color highlighting, using terminfo(4) escape sequences.
@@ -1218,9 +1212,9 @@ kill_hilite(void)
return;
}
#endif /* UNIX && TERMINFO */
#endif /* TEXTCOLOR && TERMLIB */
#endif /* TERMLIB */
#if defined(TEXTCOLOR) && !defined(TERMLIB) && defined(ANSI_DEFAULT)
#if !defined(TERMLIB) && defined(ANSI_DEFAULT)
static char adef_nilstring[] = "";
static void
@@ -1256,7 +1250,7 @@ init_hilite(void)
}
}
/* See TEXTCOLOR && TERMLIB && UNIX && TERMINFO code above. */
/* See TERMLIB && UNIX && TERMINFO code above. */
if (iflags.wc2_darkgray) {
/* Bright black is dark gray. */
hilites[CLR_BLACK] = (char *) alloc(sizeof "\033[1;30m");
@@ -1293,7 +1287,7 @@ kill_hilite(void)
hilites[CLR_BLACK] = 0;
}
}
#endif /* TEXTCOLOR && !TERMLIB && ANSI_DEFAULT */
#endif /* !TERMLIB && ANSI_DEFAULT */
static char nulstr[] = "";
@@ -1426,8 +1420,6 @@ term_end_raw_bold(void)
xputs(soOff);
}
#ifdef TEXTCOLOR
void
term_end_color(void)
{
@@ -1448,7 +1440,6 @@ term_start_bgcolor(int color)
Sprintf(tmp, "\033[%dm", ((color % 8) + 40));
xputs(tmp);
}
#endif /* TEXTCOLOR */
#ifdef ENHANCED_SYMBOLS

View File

@@ -125,11 +125,7 @@ struct window_procs tty_procs = {
| WC2_U_24BITCOLOR
#endif
),
#ifdef TEXTCOLOR
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */
#else
{1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1},
#endif
tty_init_nhwindows, tty_player_selection, tty_askname, tty_get_nh_event,
tty_exit_nhwindows, tty_suspend_nhwindows, tty_resume_nhwindows,
tty_create_nhwindow, tty_clear_nhwindow, tty_display_nhwindow,
@@ -548,9 +544,7 @@ tty_init_nhwindows(int *argcp UNUSED, char **argv UNUSED)
ttyDisplay->curx = ttyDisplay->cury = 0;
ttyDisplay->inmore = ttyDisplay->inread = ttyDisplay->intr = 0;
ttyDisplay->dismiss_more = 0;
#ifdef TEXTCOLOR
ttyDisplay->color = NO_COLOR;
#endif
ttyDisplay->attrs = 0;
ttyDisplay->topl_utf8 = 0;
ttyDisplay->mixed = 0;
@@ -1170,16 +1164,12 @@ set_item_state(
HUPSKIP();
tty_curs(window, 4, lineno);
term_start_attr(item->attr);
#ifdef TEXTCOLOR
if (item->color != NO_COLOR)
term_start_color(item->color);
#endif
(void) putchar(ch);
ttyDisplay->curx++;
#ifdef TEXTCOLOR
if (item->color != NO_COLOR)
term_end_color();
#endif
term_end_attr(item->attr);
}
@@ -1306,21 +1296,13 @@ toggle_menu_attr(boolean on, int color, int attr)
{
if (on) {
term_start_attr(attr);
#ifdef TEXTCOLOR
if (color != NO_COLOR)
term_start_color(color);
#endif
} else {
#ifdef TEXTCOLOR
if (color != NO_COLOR)
term_end_color();
#endif
term_end_attr(attr);
}
#ifndef TEXTCOLOR
nhUse(color);
#endif
}
static void
@@ -3549,12 +3531,10 @@ end_glyphout(void)
graph_off();
}
#endif
#ifdef TEXTCOLOR
if (ttyDisplay->color != NO_COLOR) {
term_end_color();
ttyDisplay->color = NO_COLOR;
}
#endif
}
#ifndef WIN32CON
@@ -3701,12 +3681,10 @@ tty_print_glyph(
}
#endif
if (iflags.use_color) {
#ifdef TEXTCOLOR
if (color != ttyDisplay->color) {
if (ttyDisplay->color != NO_COLOR)
term_end_color();
}
#endif
#ifdef ENHANCED_SYMBOLS
/* we don't link with termcap.o if NO_TERMS is defined */
if ((tty_procs.wincap2 & WC2_U_24BITCOLOR) && SYMHANDLING(H_UTF8)
@@ -3720,13 +3698,11 @@ tty_print_glyph(
colordone = TRUE;
}
#endif
#ifdef TEXTCOLOR
if (!colordone) {
ttyDisplay->color = color;
if (color != NO_COLOR)
term_start_color(color);
}
#endif /* TEXTCOLOR */
} /* iflags.use_color aka iflags.wc_color */
/* must be after color check; term_end_color may turn off inverse too;
@@ -3735,10 +3711,8 @@ tty_print_glyph(
to see although the Valkyrie quest ends up being hard on the eyes) */
if (iflags.use_color
&& bkglyphinfo && bkglyphinfo->framecolor != NO_COLOR) {
#ifdef TEXTCOLOR
ttyDisplay->framecolor = bkglyphinfo->framecolor;
term_start_bgcolor(bkglyphinfo->framecolor);
#endif
} else if ((((special & MG_PET) != 0 && iflags.hilite_pet)
|| ((special & MG_OBJPILE) != 0 && iflags.hilite_pile)
|| ((special & MG_FEMALE) != 0 && wizard && iflags.wizmgender)
@@ -3770,7 +3744,6 @@ tty_print_glyph(
if (inverse_on)
term_end_attr(ATR_INVERSE);
if (iflags.use_color) {
#ifdef TEXTCOLOR
/* turn off color as well, turning off ATR_INVERSE may have done
this already and if so, we won't know the current state unless
we do it explicitly */
@@ -3779,7 +3752,6 @@ tty_print_glyph(
term_end_color();
ttyDisplay->color = ttyDisplay->framecolor = NO_COLOR;
}
#endif
#ifdef ENHANCED_SYMBOLS
if (color24bit_on)
term_end_24bitcolor();
@@ -4051,9 +4023,7 @@ extern boolean status_activefields[MAXBLSTATS];
extern winid WIN_STATUS;
#ifdef STATUS_HILITES
#ifdef TEXTCOLOR
static int condcolor(long, unsigned long *);
#endif
static int condattr(long, unsigned long *);
static unsigned long *tty_colormasks;
static long tty_condition_bits;
@@ -4290,9 +4260,6 @@ tty_status_update(
/*FALLTHRU*/
default:
attrmask = (color >> 8) & 0x00FF;
#ifndef TEXTCOLOR
color = NO_COLOR;
#endif
fmt = status_fieldfmt[fldidx];
if (!fmt)
fmt = "%s";
@@ -4688,7 +4655,6 @@ check_windowdata(void)
return TRUE;
}
#ifdef TEXTCOLOR
/*
* Return what color this condition should
* be displayed in based on user settings.
@@ -4705,13 +4671,6 @@ condcolor(long bm, unsigned long *bmarray)
}
return NO_COLOR;
}
#else
/* might need something more elaborate if some compiler complains that
the condition where this gets used always has the same value */
#define condcolor(bm,bmarray) NO_COLOR
#define term_start_color(color) /*empty*/
#define term_end_color() /*empty*/
#endif /* TEXTCOLOR */
static int
condattr(long bm, unsigned long *bmarray)