external symbol file that can be changed without rebuilding
new hints-based configuration system
allow documentation to be specialized to the options in the game binary
+add param to winsys ini routines to allow cleaner shifting during startup
to initialize the function pointer table to _something_ so that calls to
raw_print() will not fail. Choose_windows() should be called almost
immediately upon entering main(). Look at unixmain.c for an example.
+Choose_windows will call an (optional) ini_routine with a single argument
+of WININIT to allow any needed setup. Because choose_windows() may be called
+multiple times during argument and option processing, to handle the case where
+ini_routines have side effects that need to be undone, the old ini_routine (if
+any) will be called with an argument of WININIT_UNDO before the new
+ini_routine (if any) is called (with WININIT).
Display_gamewindows() is a common routine that displays the two standard
game windows (WIN_MESSAGE, WIN_MAP), and the status display. It is normally
extern int NDECL(WindowGetchar);
extern void FDECL(ami_argset, (int *, char *[]));
extern void FDECL(ami_mkargline, (int *, char **[]));
-extern void ami_wininit_data(void);
+extern void FDECL(ami_wininit_data, (int));
#define FromWBench 0 /* A hint for compiler ... */
/* extern boolean FromWBench; /* how were we run? */
E void FDECL(msgkey, (Widget, XtPointer, XEvent*));
E void FDECL(nh_XtPopup, (Widget, int, Widget));
E void FDECL(nh_XtPopdown, (Widget));
-E void NDECL(win_X11_init);
+E void FDECL(win_X11_init, (int));
E void FDECL(nh_keyscroll, (Widget, XEvent*, String*, Cardinal*));
/* ### winmesg.c ### */
E void FDECL(docorner, (int, int));
E void NDECL(end_glyphout);
E void FDECL(g_putch, (int));
-E void NDECL(win_Gem_init);
+E void FDECL(win_Gem_init, (int));
E int NDECL(mar_gem_init);
E char NDECL(mar_ask_class);
E char * NDECL(mar_ask_name);
#define RS_ALGNMNT 4
#define RS_menu_arg(x) (ROLE_RANDOM - ((x) + 1)) /* 0..4 -> -3..-7 */
+/* Choose_windows() may be called multiple times; these constants tell the
+ * init function whether the window system is coming or going. */
+#define WININIT 0
+#define WININIT_UNDO 1
+
#endif /* WINPROCS_H */
E void FDECL(docorner, (int, int));
E void NDECL(end_glyphout);
E void FDECL(g_putch, (int));
-E void NDECL(win_tty_init);
+E void FDECL(win_tty_init, (int));
#ifdef UNICODE_WIDEWINPORT
E void FDECL(u_putch, (nhwchar));
#endif
/* cannot just blindly include winX.h without including all of X11 stuff */
/* and must get the order of include files right. Don't bother */
extern struct window_procs X11_procs;
-extern void NDECL(win_X11_init);
+extern void FDECL(win_X11_init, (int));
#endif
#ifdef QT_GRAPHICS
extern struct window_procs Qt_procs;
#endif
#ifdef BEOS_GRAPHICS
extern struct window_procs beos_procs;
-extern void NDECL(be_win_init);
+extern void FDECL(be_win_init, (int)); FAIL /* be_win_init doesn't exist? */
#endif
#ifdef AMIGA_INTUITION
extern struct window_procs amii_procs;
extern struct window_procs amiv_procs;
-extern void NDECL(ami_wininit_data);
+extern void FDECL(ami_wininit_data, (int));
#endif
#ifdef WIN32_GRAPHICS
extern struct window_procs win32_procs;
static
struct win_choices {
struct window_procs *procs;
- void NDECL((*ini_routine)); /* optional (can be 0) */
+ void FDECL((*ini_routine), (int)); /* optional (can be 0) */
} winchoices[] = {
#ifdef TTY_GRAPHICS
{ &tty_procs, win_tty_init },
{ 0, 0 } /* must be last */
};
+static struct win_choices *last_winchoice = 0;
+
boolean
genl_can_suspend_no(VOID_ARGS){
return FALSE;
{
register int i;
- for(i=0; winchoices[i].procs; i++)
+ for(i=0; winchoices[i].procs; i++){
if (!strcmpi(s, winchoices[i].procs->name)) {
windowprocs = *winchoices[i].procs;
- if (winchoices[i].ini_routine) (*winchoices[i].ini_routine)();
+
+ if (last_winchoice && last_winchoice->ini_routine)
+ (*last_winchoice->ini_routine)(WININIT_UNDO);
+ if (winchoices[i].ini_routine)
+ (*winchoices[i].ini_routine)(WININIT);
+ last_winchoice = &winchoices[i];
return;
}
+ }
if (!windowprocs.win_raw_print)
windowprocs.win_raw_print = def_raw_print;
s, winchoices[0].procs->name);
} else {
raw_printf("Window type %s not recognized. Choices are:", s);
- for(i=0; winchoices[i].procs; i++)
+ for(i=0; winchoices[i].procs; i++){
raw_printf(" %s", winchoices[i].procs->name);
+ }
}
if (windowprocs.win_raw_print == def_raw_print)
/*ARGSUSED*/
void
-genl_putmsghistory(msg, restoring)
+genl_putmsghistory(msg, is_restoring)
const char *msg;
-boolean restoring;
+boolean is_restoring;
{
/* window ports can provide
their own putmsghistory() routine to
intact at the end of each call.
*/
#if 0 /* maybe... */
- if (!restoring) pline1(msg);
+ if (!is_restoring) pline1("%s", msg);
#endif
return;
}
long amii_libvers = LIBRARY_FONT_VERSION;
void
-ami_wininit_data( void )
+ami_wininit_data( dir )
+ int dir;
{
extern unsigned short amii_init_map[ AMII_MAXCOLORS ];
extern unsigned short amiv_init_map[ AMII_MAXCOLORS ];
+
+ if( dir != WININIT) return;
+
if( !WINVERS_AMIV )
{
# ifdef TEXTCOLOR
}
void
-win_X11_init()
+win_X11_init(dir)
+ int dir;
{
+ if(dir != WININIT) return;
+
#ifdef OPENWINBUG
/* With the OpenWindows 3.0 libraries and the SunOS 4.1.2 ld, these
* two routines will not be found when linking. An apparently correct
}
void
-win_tty_init()
+win_tty_init(dir)
+int dir;
{
+ if(dir != WININIT) return;
# if defined(WIN32CON)
nttty_open();
# endif