1/* SCCS Id: @(#)windows.c 3.4 1996/05/19 */ 2/* Copyright (c) D. Cohrs, 1993. */ 3/* NetHack may be freely redistributed. See license for details. */ 4 5#include "hack.h" 6#ifdef TTY_GRAPHICS 7#include "wintty.h" 8#endif 9#ifdef X11_GRAPHICS 10/* cannot just blindly include winX.h without including all of X11 stuff */ 11/* and must get the order of include files right. Don't bother */ 12extern struct window_procs X11_procs; 13extern void NDECL(win_X11_init); 14#endif 15#ifdef QT_GRAPHICS 16extern struct window_procs Qt_procs; 17#endif 18#ifdef GEM_GRAPHICS 19#include "wingem.h" 20#endif 21#ifdef MAC 22extern struct window_procs mac_procs; 23#endif 24#ifdef BEOS_GRAPHICS 25extern struct window_procs beos_procs; 26extern void NDECL(be_win_init); 27#endif 28#ifdef AMIGA_INTUITION 29extern struct window_procs amii_procs; 30extern struct window_procs amiv_procs; 31extern void NDECL(ami_wininit_data); 32#endif 33#ifdef WIN32_GRAPHICS 34extern struct window_procs win32_procs; 35#endif 36#ifdef GNOME_GRAPHICS 37#include "winGnome.h" 38extern struct window_procs Gnome_procs; 39#endif 40#ifdef MSWIN_GRAPHICS 41extern struct window_procs mswin_procs; 42#endif 43 44STATIC_DCL void FDECL(def_raw_print, (const char *s)); 45 46NEARDATA struct window_procs windowprocs; 47 48static 49struct win_choices { 50 struct window_procs *procs; 51 void NDECL((*ini_routine)); /* optional (can be 0) */ 52} winchoices[] = { 53#ifdef TTY_GRAPHICS 54 { &tty_procs, win_tty_init }, 55#endif 56#ifdef X11_GRAPHICS 57 { &X11_procs, win_X11_init }, 58#endif 59#ifdef QT_GRAPHICS 60 { &Qt_procs, 0 }, 61#endif 62#ifdef GEM_GRAPHICS 63 { &Gem_procs, win_Gem_init }, 64#endif 65#ifdef MAC 66 { &mac_procs, 0 }, 67#endif 68#ifdef BEOS_GRAPHICS 69 { &beos_procs, be_win_init }, 70#endif 71#ifdef AMIGA_INTUITION 72 { &amii_procs, ami_wininit_data }, /* Old font version of the game */ 73 { &amiv_procs, ami_wininit_data }, /* Tile version of the game */ 74#endif 75#ifdef WIN32_GRAPHICS 76 { &win32_procs, 0 }, 77#endif 78#ifdef GNOME_GRAPHICS 79 { &Gnome_procs, 0 }, 80#endif 81#ifdef MSWIN_GRAPHICS 82 { &mswin_procs, 0 }, 83#endif 84 { 0, 0 } /* must be last */ 85}; 86 87STATIC_OVL 88void 89def_raw_print(s) 90const char *s; 91{ 92 puts(s); 93} 94 95void 96choose_windows(s) 97const char *s; 98{ 99 register int i; 100 101 for(i=0; winchoices[i].procs; i++) 102 if (!strcmpi(s, winchoices[i].procs->name)) { 103 windowprocs = *winchoices[i].procs; 104 if (winchoices[i].ini_routine) (*winchoices[i].ini_routine)(); 105 return; 106 } 107 108 if (!windowprocs.win_raw_print) 109 windowprocs.win_raw_print = def_raw_print; 110 111 raw_printf("Window type %s not recognized. Choices are:", s); 112 for(i=0; winchoices[i].procs; i++) 113 raw_printf(" %s", winchoices[i].procs->name); 114 115 if (windowprocs.win_raw_print == def_raw_print) 116 terminate(EXIT_SUCCESS); 117 wait_synch(); 118} 119 120/* 121 * tty_message_menu() provides a means to get feedback from the 122 * --More-- prompt; other interfaces generally don't need that. 123 */ 124/*ARGSUSED*/ 125char 126genl_message_menu(let, how, mesg) 127char let; 128int how; 129const char *mesg; 130{ 131 pline("%s", mesg); 132 return 0; 133} 134 135/*ARGSUSED*/ 136void 137genl_preference_update(pref) 138const char *pref; 139{ 140 /* window ports are expected to provide 141 their own preference update routine 142 for the preference capabilities that 143 they support. 144 Just return in this genl one. */ 145} 146/*windows.c*/ 147