Source:NetHack 3.1.0/windows.c

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to windows.c from the source code of NetHack 3.1.0. To link to a particular line, write [[NetHack 3.1.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.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1.    /*	SCCS Id: @(#)windows.c	3.1	93/01/08	*/
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.   #endif
21.   
22.   struct window_procs NEARDATA windowprocs;
23.   
24.   static
25.   struct win_choices {
26.       struct window_procs *procs;
27.       void NDECL((*ini_routine));		/* optional (can be 0) */
28.   } winchoices[] = {
29.   #ifdef TTY_GRAPHICS
30.       { &tty_procs, win_tty_init },
31.   #endif
32.   #ifdef X11_GRAPHICS
33.       { &X11_procs, win_X11_init },
34.   #endif
35.   #ifdef MAC
36.   	{ & mac_procs , NULL } ,
37.   #endif
38.   #ifdef AMIGA_INTUITION
39.   	{ & amii_procs , NULL } ,
40.   #endif
41.       { 0, 0 }		/* must be last */
42.   };
43.   
44.   void
45.   choose_windows(s)
46.   const char *s;
47.   {
48.       register int i;
49.   
50.       for(i=0; winchoices[i].procs; i++)
51.   	if (!strcmpi(s, winchoices[i].procs->name)) {
52.   	    windowprocs = *winchoices[i].procs;
53.   	    if (winchoices[i].ini_routine) (*winchoices[i].ini_routine)();
54.   	    return;
55.   	}
56.   
57.       raw_printf("Window type %s not recognized.  Choices are:", s);
58.       for(i=0; winchoices[i].procs; i++)
59.   	raw_printf("        %s", winchoices[i].procs->name);
60.   }
61.   
62.   /*windows.c*/