Source:SLASH'EM 0.0.7E7F2/windows.c

From NetHackWiki
Revision as of 19:58, 7 March 2008 by Kernigh bot (talk | contribs) (SLASH'EM 0.0.7E7F2/windows.c moved to Source:SLASH'EM 0.0.7E7F2/windows.c: Robot: moved page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Below is the full text to windows.c from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[SLASH'EM 0.0.7E7F2/windows.c#line123]], for example.

The latest source code for vanilla NetHack is at 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.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 */
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 GTK_GRAPHICS
19.   /*
20.    * GTK interface (By issei@guru.gr.jp)
21.    */
22.   extern struct window_procs GTK_procs;
23.   extern void NDECL(win_GTK_init);
24.   #endif
25.   #ifdef GEM_GRAPHICS
26.   #include "wingem.h"
27.   #endif
28.   #ifdef MAC
29.   extern struct window_procs mac_procs;
30.   #endif
31.   #ifdef BEOS_GRAPHICS
32.   extern struct window_procs beos_procs;
33.   extern void NDECL(be_win_init);
34.   #endif
35.   #ifdef AMIGA_INTUITION
36.   extern struct window_procs amii_procs;
37.   extern struct window_procs amiv_procs;
38.   extern void NDECL(ami_wininit_data);
39.   #endif
40.   #ifdef WIN32_GRAPHICS
41.   extern struct window_procs win32_procs;
42.   #endif
43.   #ifdef GNOME_GRAPHICS
44.   #include "winGnome.h"
45.   extern struct window_procs Gnome_procs;
46.   #endif
47.   #ifdef GL_GRAPHICS
48.   #include "winGL.h"
49.   extern struct window_procs sdlgl_hardw_procs;
50.   #endif
51.   #ifdef SDL_GRAPHICS
52.   #include "winGL.h"
53.   extern struct window_procs sdlgl_softw_procs;
54.   #endif
55.   #ifdef PROXY_GRAPHICS
56.   #include "winproxy.h"
57.   extern struct window_procs proxy_procs;
58.   extern void NDECL(win_proxy_init);
59.   #endif
60.   #ifdef MSWIN_GRAPHICS
61.   extern struct window_procs mswin_procs;
62.   #endif
63.   
64.   STATIC_DCL void FDECL(def_raw_print, (const char *s));
65.   
66.   NEARDATA struct window_procs windowprocs;
67.   
68.   static
69.   struct win_choices {
70.       struct window_procs *procs;
71.       void NDECL((*ini_routine));		/* optional (can be 0) */
72.   } winchoices[] = {
73.   #ifdef TTY_GRAPHICS
74.       { &tty_procs, win_tty_init },
75.   #endif
76.   #ifdef X11_GRAPHICS
77.       { &X11_procs, win_X11_init },
78.   #endif
79.   #ifdef QT_GRAPHICS
80.       { &Qt_procs, 0 },
81.   #endif
82.   #ifdef GTK_GRAPHICS
83.       { &GTK_procs, win_GTK_init },
84.   #endif
85.   #ifdef GEM_GRAPHICS
86.       { &Gem_procs, win_Gem_init },
87.   #endif
88.   #ifdef MAC
89.       { &mac_procs, 0 },
90.   #endif
91.   #ifdef BEOS_GRAPHICS
92.       { &beos_procs, be_win_init },
93.   #endif
94.   #ifdef AMIGA_INTUITION
95.       { &amii_procs, ami_wininit_data },		/* Old font version of the game */
96.       { &amiv_procs, ami_wininit_data },		/* Tile version of the game */
97.   #endif
98.   #ifdef WIN32_GRAPHICS
99.       { &win32_procs, 0 },
100.  #endif
101.  #ifdef GNOME_GRAPHICS
102.      { &Gnome_procs, 0 },
103.  #endif
104.  #ifdef GL_GRAPHICS
105.      { &sdlgl_hardw_procs, 0 },
106.  #endif
107.  #ifdef SDL_GRAPHICS
108.      { &sdlgl_softw_procs, 0 },
109.  #endif
110.  #ifdef PROXY_GRAPHICS
111.      { &proxy_procs, win_proxy_init },
112.  #endif
113.  #ifdef MSWIN_GRAPHICS
114.      { &mswin_procs, 0 },
115.  #endif
116.      { 0, 0 }		/* must be last */
117.  };
118.  
119.  STATIC_OVL
120.  void
121.  def_raw_print(s)
122.  const char *s;
123.  {
124.      puts(s);
125.  }
126.  
127.  static int windows_lock = FALSE;
128.  
129.  int
130.  lock_windows(flag)
131.  int flag;
132.  {
133.      int retval = windows_lock;
134.      windows_lock = flag;
135.      return retval;
136.  }
137.  
138.  void
139.  choose_windows(s)
140.  const char *s;
141.  {
142.      register int i;
143.  
144.      if (windows_lock)
145.  	return;
146.  
147.      for(i=0; winchoices[i].procs; i++)
148.  	if (!strcmpi(s, winchoices[i].procs->name)) {
149.  	    windowprocs = *winchoices[i].procs;
150.  	    if (winchoices[i].ini_routine) (*winchoices[i].ini_routine)();
151.  	    return;
152.  	}
153.  
154.      if (!windowprocs.win_raw_print)
155.  	windowprocs.win_raw_print = def_raw_print;
156.  
157.      raw_printf("Window type %s not recognized.  Choices are:", s);
158.      for(i=0; winchoices[i].procs; i++)
159.  	raw_printf("        %s", winchoices[i].procs->name);
160.  
161.      if (windowprocs.win_raw_print == def_raw_print)
162.  	terminate(EXIT_SUCCESS);
163.      wait_synch();
164.  }
165.  
166.  /*
167.   * tty_message_menu() provides a means to get feedback from the
168.   * --More-- prompt; other interfaces generally don't need that.
169.   */
170.  /*ARGSUSED*/
171.  char
172.  genl_message_menu(let, how, mesg)
173.  char let;
174.  int how;
175.  const char *mesg;
176.  {
177.  #if defined(MAC_MPW)
178.  # pragma unused ( how,let )
179.  #endif
180.      pline("%s", mesg);
181.      return 0;
182.  }
183.  
184.  /*ARGSUSED*/
185.  void
186.  genl_preference_update(pref)
187.  const char *pref;
188.  {
189.  	/* window ports are expected to provide
190.  	   their own preference update routine
191.  	   for the preference capabilities that
192.  	   they support.
193.  	   Just return in this genl one. */
194.  }
195.  /*windows.c*/