Source:NetHack 3.4.3/src/windows.c

From NetHackWiki
Jump to: navigation, search

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

Top of file

  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. */

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. #include "hack.h"
  2. #ifdef TTY_GRAPHICS
  3. #include "wintty.h"
  4. #endif
  5. #ifdef X11_GRAPHICS
  6. /* cannot just blindly include winX.h without including all of X11 stuff */
  7. /* and must get the order of include files right.  Don't bother */
  8. extern struct window_procs X11_procs;
  9. extern void NDECL(win_X11_init);
  10. #endif
  11. #ifdef QT_GRAPHICS
  12. extern struct window_procs Qt_procs;
  13. #endif
  14. #ifdef GEM_GRAPHICS
  15. #include "wingem.h"
  16. #endif
  17. #ifdef MAC
  18. extern struct window_procs mac_procs;
  19. #endif
  20. #ifdef BEOS_GRAPHICS
  21. extern struct window_procs beos_procs;
  22. extern void NDECL(be_win_init);
  23. #endif
  24. #ifdef AMIGA_INTUITION
  25. extern struct window_procs amii_procs;
  26. extern struct window_procs amiv_procs;
  27. extern void NDECL(ami_wininit_data);
  28. #endif
  29. #ifdef WIN32_GRAPHICS
  30. extern struct window_procs win32_procs;
  31. #endif
  32. #ifdef GNOME_GRAPHICS
  33. #include "winGnome.h"
  34. extern struct window_procs Gnome_procs;
  35. #endif
  36. #ifdef MSWIN_GRAPHICS
  37. extern struct window_procs mswin_procs;
  38. #endif
  39.  
  40. STATIC_DCL void FDECL(def_raw_print, (const char *s));
  41.  
  42. NEARDATA struct window_procs windowprocs;
  43.  
  44. static
  45. struct win_choices {
  46. struct window_procs *procs;
  47. void NDECL((*ini_routine));		/* optional (can be 0) */
  48. } winchoices[] = {
  49. #ifdef TTY_GRAPHICS
  50. { &tty_procs, win_tty_init },
  51. #endif
  52. #ifdef X11_GRAPHICS
  53. { &X11_procs, win_X11_init },
  54. #endif
  55. #ifdef QT_GRAPHICS
  56. { &Qt_procs, 0 },
  57. #endif
  58. #ifdef GEM_GRAPHICS
  59. { &Gem_procs, win_Gem_init },
  60. #endif
  61. #ifdef MAC
  62. { &mac_procs, 0 },
  63. #endif
  64. #ifdef BEOS_GRAPHICS
  65. { &beos_procs, be_win_init },
  66. #endif
  67. #ifdef AMIGA_INTUITION
  68. { &amii_procs, ami_wininit_data },		/* Old font version of the game */
  69. { &amiv_procs, ami_wininit_data },		/* Tile version of the game */
  70. #endif
  71. #ifdef WIN32_GRAPHICS
  72. { &win32_procs, 0 },
  73. #endif
  74. #ifdef GNOME_GRAPHICS
  75. { &Gnome_procs, 0 },
  76. #endif
  77. #ifdef MSWIN_GRAPHICS
  78. { &mswin_procs, 0 },
  79. #endif
  80. { 0, 0 }		/* must be last */
  81. };

def_raw_print

  1. STATIC_OVL
  2. void
  3. def_raw_print(s)
  4. const char *s;
  5. {
  6. puts(s);
  7. }

choose_windows

  1. void
  2. choose_windows(s)
  3. const char *s;
  4. {
  5. register int i;
  6.  
  7. for(i=0; winchoices[i].procs; i++)
  8. 	if (!strcmpi(s, winchoices[i].procs->name)) {
  9. 	    windowprocs = *winchoices[i].procs;
  10. 	    if (winchoices[i].ini_routine) (*winchoices[i].ini_routine)();
  11. 	    return;
  12. 	}
  13.  
  14. if (!windowprocs.win_raw_print)
  15. 	windowprocs.win_raw_print = def_raw_print;
  16.  
  17. raw_printf("Window type %s not recognized.  Choices are:", s);
  18. for(i=0; winchoices[i].procs; i++)
  19. 	raw_printf("        %s", winchoices[i].procs->name);
  20.  
  21. if (windowprocs.win_raw_print == def_raw_print)
  22. 	terminate(EXIT_SUCCESS);
  23. wait_synch();
  24. }

genl_message_menu

  1. /*
  2. * tty_message_menu() provides a means to get feedback from the
  3. * --More-- prompt; other interfaces generally don't need that.
  4. */
  5. /*ARGSUSED*/
  6. char
  7. genl_message_menu(let, how, mesg)
  8. char let;
  9. int how;
  10. const char *mesg;
  11. {
  12. pline("%s", mesg);
  13. return 0;
  14. }

genl_preference_update

  1. /*ARGSUSED*/
  2. void
  3. genl_preference_update(pref)
  4. const char *pref;
  5. {
  6. 	/* window ports are expected to provide
  7. 	   their own preference update routine
  8. 	   for the preference capabilities that
  9. 	   they support.
  10. 	   Just return in this genl one. */
  11. }
  12. /*windows.c*/