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

@@ -10,10 +10,10 @@
#error You cannot compile this with both GUISTUB and TTYSTUB defined.
#endif
struct window_procs mswin_procs = { "-guistubs" };
struct window_procs mswin_procs = { WPIDMINUS(guistubs) };
#ifdef QT_GRAPHICS
struct window_procs Qt_procs = { "-guistubs" };
struct window_procs Qt_procs = { WPIDMINUS(guistubs) };
int qt_tilewidth, qt_tileheight, qt_fontsize, qt_compact_mode;
#endif
void
@@ -59,7 +59,7 @@ main(int argc, char *argv[])
HANDLE hConIn;
HANDLE hConOut;
struct window_procs tty_procs = { "-ttystubs" };
struct window_procs tty_procs = { WPIDMINUS(ttystubs) };
#ifdef CURSES_GRAPHICS
char erase_char, kill_char;
#endif

View File

@@ -893,7 +893,7 @@ safe_routines(void)
* Get a set of valid safe windowport function
* pointers during early startup initialization.
*/
if (!WINDOWPORT(safe-startup))
if (!WINDOWPORT(safestartup))
windowprocs = *get_safe_procs(1);
if (!GUILaunched)
windowprocs.win_nhgetch = windows_console_custom_nhgetch;
@@ -1316,7 +1316,7 @@ tty_self_recover_prompt(void)
c = 'n';
ct = 0;
saved_procs = windowprocs;
if (!WINDOWPORT(safe-startup))
if (!WINDOWPORT(safestartup))
windowprocs = *get_safe_procs(2); /* arg 2 uses no-newline variant */
windowprocs.win_nhgetch = windows_console_custom_nhgetch;
raw_print("\n");

View File

@@ -233,7 +233,7 @@ win32_abort(void)
exit_nhwindows((char *) 0);
iflags.window_inited = FALSE;
}
if (!WINDOWPORT(mswin) && !WINDOWPORT(safe-startup))
if (!WINDOWPORT(mswin) && !WINDOWPORT(safestartup))
safe_routines();
if (wizard) {
raw_print("Execute debug breakpoint wizard?");