Fandom

Wikihack

Source:NetHack 3.2.0/windows.c

2,034pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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

Also on Fandom

Random Wiki