updated window_procs

Add a non-string identifier to window_procs for use in runtime
identification of the current window port being used.

Use a macro WPID to add the identification at the top of the
various existing window_procs declarations. It expands to the
existing text string, as well as the newly added field wp_id
with a wp_ identifier.

For example, WPID(tty) expands to: "tty", wp_tty

The generated wp_tty must be present in the wp_ids enum at
the top of include/winprocs.h.

The WINDOWPORT(x) macro has been updated to expand to a simple
value comparison (port.wp_id == wp_x), instead of a
string comparison.
This commit is contained in:
nhmall
2022-06-29 23:21:19 -04:00
parent a518d82c54
commit f228fefabd
15 changed files with 39 additions and 18 deletions

View File

@@ -6304,7 +6304,7 @@ initoptions_finish(void)
* Option processing can take place before a user-decided WindowPort
* is even initialized, so check for that too.
*/
if (!WINDOWPORT(safe-startup)) {
if (!WINDOWPORT(safestartup)) {
if (iflags.hilite_delta && !wc2_supported("statushilites")) {
raw_printf("Status highlighting not supported for %s interface.",
windowprocs.name);

View File

@@ -312,7 +312,7 @@ choose_windows(const char *s)
free((genericptr_t) tmps) /*, tmps = 0*/ ;
if (windowprocs.win_raw_print == def_raw_print
|| WINDOWPORT(safe-startup))
|| WINDOWPORT(safestartup))
nh_terminate(EXIT_SUCCESS);
}
@@ -539,7 +539,7 @@ static void hup_void_fdecl_constchar_p(const char *);
static perminvent_info *hup_update_invent_slot(winid, int, perminvent_info *);
static struct window_procs hup_procs = {
"hup", 0L, 0L,
WPID(hup), 0L, 0L,
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
hup_init_nhwindows,
hup_void_ndecl, /* player_selection */