Wikihack
Advertisement

Below is the full text to windows.c from the source code of NetHack 3.3.0. To link to a particular line, write [[NetHack 3.3.0/windows.c#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

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