1 | /* SCCS Id: @(#)windows.c 3.3 96/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 */
12 | extern struct window_procs X11_procs;
13 | extern void NDECL(win_X11_init);
14 | #endif
15 | #ifdef QT_GRAPHICS
16 | extern struct window_procs Qt_procs;
17 | #endif
18 | #ifdef GEM_GRAPHICS
19 | #include "wingem.h"
20 | #endif
21 | #ifdef MAC
22 | extern struct window_procs mac_procs;
23 | #endif
24 | #ifdef BEOS_GRAPHICS
25 | extern struct window_procs beos_procs;
26 | extern void NDECL(be_win_init);
27 | #endif
28 | #ifdef AMIGA_INTUITION
29 | extern struct window_procs amii_procs;
30 | extern struct window_procs amiv_procs;
31 | extern void NDECL(ami_wininit_data);
32 | #endif
33 | #ifdef WIN32_GRAPHICS
34 | extern struct window_procs win32_procs;
35 | #endif
36 | #ifdef GNOME_GRAPHICS
37 | #include "winGnome.h"
38 | extern struct window_procs Gnome_procs;
39 | #endif
40 |
41 | STATIC_DCL void FDECL(def_raw_print, (const char *s));
42 |
43 | NEARDATA struct window_procs windowprocs;
44 |
45 | static
46 | struct win_choices {
47 | struct window_procs *procs;
48 | void NDECL((*ini_routine)); /* optional (can be 0) */
49 | } winchoices[] = {
50 | #ifdef TTY_GRAPHICS
51 | { &tty_procs, win_tty_init },
52 | #endif
53 | #ifdef X11_GRAPHICS
54 | { &X11_procs, win_X11_init },
55 | #endif
56 | #ifdef QT_GRAPHICS
57 | { &Qt_procs, 0 },
58 | #endif
59 | #ifdef GEM_GRAPHICS
60 | { &Gem_procs, win_Gem_init },
61 | #endif
62 | #ifdef MAC
63 | { &mac_procs, 0 },
64 | #endif
65 | #ifdef BEOS_GRAPHICS
66 | { &beos_procs, be_win_init },
67 | #endif
68 | #ifdef AMIGA_INTUITION
69 | { &amii_procs, ami_wininit_data }, /* Old font version of the game */
70 | { &amiv_procs, ami_wininit_data }, /* Tile version of the game */
71 | #endif
72 | #ifdef WIN32_GRAPHICS
73 | { &win32_procs, 0 },
74 | #endif
75 | #ifdef GNOME_GRAPHICS
76 | { &Gnome_procs, 0 },
77 | #endif
78 | { 0, 0 } /* must be last */
79 | };
80 |
81 | STATIC_OVL
82 | void
83 | def_raw_print(s)
84 | const char *s;
85 | {
86 | puts(s);
87 | }
88 |
89 | void
90 | choose_windows(s)
91 | const char *s;
92 | {
93 | register int i;
94 |
95 | for(i=0; winchoices[i].procs; i++)
96 | if (!strcmpi(s, winchoices[i].procs->name)) {
97 | windowprocs = *winchoices[i].procs;
98 | if (winchoices[i].ini_routine) (*winchoices[i].ini_routine)();
99 | return;
100 | }
101 |
102 | if (!windowprocs.win_raw_print)
103 | windowprocs.win_raw_print = def_raw_print;
104 |
105 | raw_printf("Window type %s not recognized. Choices are:", s);
106 | for(i=0; winchoices[i].procs; i++)
107 | raw_printf(" %s", winchoices[i].procs->name);
108 |
109 | if (windowprocs.win_raw_print == def_raw_print)
110 | terminate(EXIT_SUCCESS);
111 | wait_synch();
112 | }
113 |
114 | /*
115 | * tty_message_menu() provides a means to get feedback from the
116 | * --More-- prompt; other interfaces generally don't need that.
117 | */
118 | /*ARGSUSED*/
119 | char
120 | genl_message_menu(let, how, mesg)
121 | char let;
122 | int how;
123 | const char *mesg;
124 | {
125 | pline("%s", mesg);
126 | return 0;
127 | }
128 |
129 | /*windows.c*/