Source:NetHack 3.6.1/src/windows.c

From NetHackWiki
(Redirected from Source:Ref/def raw print)
Jump to: navigation, search

Below is the full text to windows.c from the source code of NetHack 3.6.1. To link to a particular line, write [[Source:NetHack 3.6.1/src/windows.c#line123]], for example.

Top of file

  1.  /* NetHack 3.6	windows.c	$NHDT-Date: 1495232365 2017/05/19 22:19:25 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.41 $ */
  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.  
  2.  #include "hack.h"
  3.  #ifdef TTY_GRAPHICS
  4.  #include "wintty.h"
  5.  #endif
  6.  #ifdef X11_GRAPHICS
  7.  /* Cannot just blindly include winX.h without including all of X11 stuff
  8.     and must get the order of include files right.  Don't bother. */
  9.  extern struct window_procs X11_procs;
  10.  extern void FDECL(win_X11_init, (int));
  11.  #endif
  12.  #ifdef QT_GRAPHICS
  13.  extern struct window_procs Qt_procs;
  14.  #endif
  15.  #ifdef GEM_GRAPHICS
  16.  #include "wingem.h"
  17.  #endif
  18.  #ifdef MAC
  19.  extern struct window_procs mac_procs;
  20.  #endif
  21.  #ifdef BEOS_GRAPHICS
  22.  extern struct window_procs beos_procs;
  23.  extern void FDECL(be_win_init, (int));
  24.  FAIL /* be_win_init doesn't exist? XXX*/
  25.  #endif
  26.  #ifdef AMIGA_INTUITION
  27.  extern struct window_procs amii_procs;
  28.  extern struct window_procs amiv_procs;
  29.  extern void FDECL(ami_wininit_data, (int));
  30.  #endif
  31.  #ifdef WIN32_GRAPHICS
  32.  extern struct window_procs win32_procs;
  33.  #endif
  34.  #ifdef GNOME_GRAPHICS
  35.  #include "winGnome.h"
  36.  extern struct window_procs Gnome_procs;
  37.  #endif
  38.  #ifdef MSWIN_GRAPHICS
  39.  extern struct window_procs mswin_procs;
  40.  #endif
  41.  #ifdef WINCHAIN
  42.  extern struct window_procs chainin_procs;
  43.  extern void FDECL(chainin_procs_init, (int));
  44.  extern void *FDECL(chainin_procs_chain, (int, int, void *, void *, void *));
  45.  
  46.  extern struct chain_procs chainout_procs;
  47.  extern void FDECL(chainout_procs_init, (int));
  48.  extern void *FDECL(chainout_procs_chain, (int, int, void *, void *, void *));
  49.  
  50.  extern struct chain_procs trace_procs;
  51.  extern void FDECL(trace_procs_init, (int));
  52.  extern void *FDECL(trace_procs_chain, (int, int, void *, void *, void *));
  53.  #endif
  54.  
  55.  STATIC_DCL void FDECL(def_raw_print, (const char *s));
  56.  
  57.  #ifdef DUMPLOG
  58.  STATIC_DCL winid FDECL(dump_create_nhwindow, (int));
  59.  STATIC_DCL void FDECL(dump_clear_nhwindow, (winid));
  60.  STATIC_DCL void FDECL(dump_display_nhwindow, (winid, BOOLEAN_P));
  61.  STATIC_DCL void FDECL(dump_destroy_nhwindow, (winid));
  62.  STATIC_DCL void FDECL(dump_start_menu, (winid));
  63.  STATIC_DCL void FDECL(dump_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, const char *, BOOLEAN_P));
  64.  STATIC_DCL void FDECL(dump_end_menu, (winid, const char *));
  65.  STATIC_DCL int FDECL(dump_select_menu, (winid, int, MENU_ITEM_P **));
  66.  STATIC_DCL void FDECL(dump_putstr, (winid, int, const char *));
  67.  #endif /* DUMPLOG */
  68.  
  69.  #ifdef HANGUPHANDLING
  70.  volatile
  71.  #endif
  72.      NEARDATA struct window_procs windowprocs;
  73.  
  74.  #ifdef WINCHAIN
  75.  #define CHAINR(x) , x
  76.  #else
  77.  #define CHAINR(x)
  78.  #endif
  79.  
  80.  static struct win_choices {
  81.      struct window_procs *procs;
  82.      void FDECL((*ini_routine), (int)); /* optional (can be 0) */
  83.  #ifdef WINCHAIN
  84.      void *FDECL((*chain_routine), (int, int, void *, void *, void *));
  85.  #endif
  86.  } winchoices[] = {
  87.  #ifdef TTY_GRAPHICS
  88.      { &tty_procs, win_tty_init CHAINR(0) },
  89.  #endif
  90.  #ifdef X11_GRAPHICS
  91.      { &X11_procs, win_X11_init CHAINR(0) },
  92.  #endif
  93.  #ifdef QT_GRAPHICS
  94.      { &Qt_procs, 0 CHAINR(0) },
  95.  #endif
  96.  #ifdef GEM_GRAPHICS
  97.      { &Gem_procs, win_Gem_init CHAINR(0) },
  98.  #endif
  99.  #ifdef MAC
  100.      { &mac_procs, 0 CHAINR(0) },
  101.  #endif
  102.  #ifdef BEOS_GRAPHICS
  103.      { &beos_procs, be_win_init CHAINR(0) },
  104.  #endif
  105.  #ifdef AMIGA_INTUITION
  106.      { &amii_procs,
  107.        ami_wininit_data CHAINR(0) }, /* Old font version of the game */
  108.      { &amiv_procs,
  109.        ami_wininit_data CHAINR(0) }, /* Tile version of the game */
  110.  #endif
  111.  #ifdef WIN32_GRAPHICS
  112.      { &win32_procs, 0 CHAINR(0) },
  113.  #endif
  114.  #ifdef GNOME_GRAPHICS
  115.      { &Gnome_procs, 0 CHAINR(0) },
  116.  #endif
  117.  #ifdef MSWIN_GRAPHICS
  118.      { &mswin_procs, 0 CHAINR(0) },
  119.  #endif
  120.  #ifdef WINCHAIN
  121.      { &chainin_procs, chainin_procs_init, chainin_procs_chain },
  122.      { (struct window_procs *) &chainout_procs, chainout_procs_init,
  123.        chainout_procs_chain },
  124.  
  125.      { (struct window_procs *) &trace_procs, trace_procs_init,
  126.        trace_procs_chain },
  127.  #endif
  128.      { 0, 0 CHAINR(0) } /* must be last */
  129.  };
  130.  
  131.  #ifdef WINCHAIN
  132.  struct winlink {
  133.      struct winlink *nextlink;
  134.      struct win_choices *wincp;
  135.      void *linkdata;
  136.  };
  137.  /* NB: this chain does not contain the terminal real window system pointer */
  138.  
  139.  static struct winlink *chain = 0;
  140.  

wl_new

  1.  static struct winlink *
  2.  wl_new()
  3.  {
  4.      return calloc(1, sizeof(struct winlink));
  5.  }

wl_addhead

  1.  static void
  2.  wl_addhead(struct winlink *wl)
  3.  {
  4.      wl->nextlink = chain;
  5.      chain = wl;
  6.  }

wl_addtail

  1.  static void
  2.  wl_addtail(struct winlink *wl)
  3.  {
  4.      struct winlink *p = chain;
  5.  
  6.      if (!chain) {
  7.          chain = wl;
  8.          return;
  9.      }
  10.      while (p->nextlink) {
  11.          p = p->nextlink;
  12.      }
  13.      p->nextlink = wl;
  14.      return;
  15.  }
  16.  #endif /* WINCHAIN */
  17.  
  18.  static struct win_choices *last_winchoice = 0;
  19.  

genl_can_suspend_no

  1.  boolean
  2.  genl_can_suspend_no(VOID_ARGS)
  3.  {
  4.      return FALSE;
  5.  }
  6.  

genl_can_suspend_yes

  1.  boolean
  2.  genl_can_suspend_yes(VOID_ARGS)
  3.  {
  4.      return TRUE;
  5.  }
  6.  

def_raw_print

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

win_choices_find

  1.  #ifdef WINCHAIN
  2.  static struct win_choices *
  3.  win_choices_find(s)
  4.  const char *s;
  5.  {
  6.      register int i;
  7.  
  8.      for (i = 0; winchoices[i].procs; i++) {
  9.          if (!strcmpi(s, winchoices[i].procs->name)) {
  10.              return &winchoices[i];
  11.          }
  12.      }
  13.      return (struct win_choices *) 0;
  14.  }
  15.  #endif
  16.  

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 ('+' == winchoices[i].procs->name[0])
  9.              continue;
  10.          if ('-' == winchoices[i].procs->name[0])
  11.              continue;
  12.          if (!strcmpi(s, winchoices[i].procs->name)) {
  13.              windowprocs = *winchoices[i].procs;
  14.  
  15.              if (last_winchoice && last_winchoice->ini_routine)
  16.                  (*last_winchoice->ini_routine)(WININIT_UNDO);
  17.              if (winchoices[i].ini_routine)
  18.                  (*winchoices[i].ini_routine)(WININIT);
  19.              last_winchoice = &winchoices[i];
  20.              return;
  21.          }
  22.      }
  23.  
  24.      if (!windowprocs.win_raw_print)
  25.          windowprocs.win_raw_print = def_raw_print;
  26.  
  27.      if (!winchoices[0].procs) {
  28.          raw_printf("No window types?");
  29.          exit(EXIT_FAILURE);
  30.      }
  31.      if (!winchoices[1].procs) {
  32.          config_error_add("Window type %s not recognized.  The only choice is: %s",
  33.                     s, winchoices[0].procs->name);
  34.      } else {
  35.          char buf[BUFSZ];
  36.          boolean first = TRUE;
  37.          buf[0] = '\0';
  38.          for (i = 0; winchoices[i].procs; i++) {
  39.              if ('+' == winchoices[i].procs->name[0])
  40.                  continue;
  41.              if ('-' == winchoices[i].procs->name[0])
  42.                  continue;
  43.              Sprintf(eos(buf), "%s%s", first ? "" : ",", winchoices[i].procs->name);
  44.              first = FALSE;
  45.          }
  46.          config_error_add("Window type %s not recognized.  Choices are: %s", s, buf);
  47.      }
  48.  
  49.      if (windowprocs.win_raw_print == def_raw_print)
  50.          nh_terminate(EXIT_SUCCESS);
  51.  }
  52.  
  53.  #ifdef WINCHAIN

addto_windowchain

  1.  void
  2.  addto_windowchain(s)
  3.  const char *s;
  4.  {
  5.      register int i;
  6.  
  7.      for (i = 0; winchoices[i].procs; i++) {
  8.          if ('+' != winchoices[i].procs->name[0])
  9.              continue;
  10.          if (!strcmpi(s, winchoices[i].procs->name)) {
  11.              struct winlink *p = wl_new();
  12.              p->wincp = &winchoices[i];
  13.              wl_addtail(p);
  14.              /* NB: The ini_routine() will be called during commit. */
  15.              return;
  16.          }
  17.      }
  18.  
  19.      windowprocs.win_raw_print = def_raw_print;
  20.  
  21.      raw_printf("Window processor %s not recognized.  Choices are:", s);
  22.      for (i = 0; winchoices[i].procs; i++) {
  23.          if ('+' != winchoices[i].procs->name[0])
  24.              continue;
  25.          raw_printf("        %s", winchoices[i].procs->name);
  26.      }
  27.  
  28.      exit(EXIT_FAILURE);
  29.  }
  30.  

commit_windowchain

  1.  void
  2.  commit_windowchain()
  3.  {
  4.      struct winlink *p;
  5.      int n;
  6.      int wincap, wincap2;
  7.  
  8.      if (!chain)
  9.          return;
  10.  
  11.      /* Save wincap* from the real window system - we'll restore it below. */
  12.      wincap = windowprocs.wincap;
  13.      wincap2 = windowprocs.wincap2;
  14.  
  15.      /* add -chainin at head and -chainout at tail */
  16.      p = wl_new();
  17.      p->wincp = win_choices_find("-chainin");
  18.      if (!p->wincp) {
  19.          raw_printf("Can't locate processor '-chainin'");
  20.          exit(EXIT_FAILURE);
  21.      }
  22.      wl_addhead(p);
  23.  
  24.      p = wl_new();
  25.      p->wincp = win_choices_find("-chainout");
  26.      if (!p->wincp) {
  27.          raw_printf("Can't locate processor '-chainout'");
  28.          exit(EXIT_FAILURE);
  29.      }
  30.      wl_addtail(p);
  31.  
  32.      /* Now alloc() init() similar to Objective-C. */
  33.      for (n = 1, p = chain; p; n++, p = p->nextlink) {
  34.          p->linkdata = (*p->wincp->chain_routine)(WINCHAIN_ALLOC, n, 0, 0, 0);
  35.      }
  36.  
  37.      for (n = 1, p = chain; p; n++, p = p->nextlink) {
  38.          if (p->nextlink) {
  39.              (void) (*p->wincp->chain_routine)(WINCHAIN_INIT, n, p->linkdata,
  40.                                                p->nextlink->wincp->procs,
  41.                                                p->nextlink->linkdata);
  42.          } else {
  43.              (void) (*p->wincp->chain_routine)(WINCHAIN_INIT, n, p->linkdata,
  44.                                                last_winchoice->procs, 0);
  45.          }
  46.      }
  47.  
  48.      /* Restore the saved wincap* values.  We do it here to give the
  49.       * ini_routine()s a chance to change or check them. */
  50.      chain->wincp->procs->wincap = wincap;
  51.      chain->wincp->procs->wincap2 = wincap2;
  52.  
  53.      /* Call the init procs.  Do not re-init the terminal real win. */
  54.      p = chain;
  55.      while (p->nextlink) {
  56.          if (p->wincp->ini_routine) {
  57.              (*p->wincp->ini_routine)(WININIT);
  58.          }
  59.          p = p->nextlink;
  60.      }
  61.  
  62.      /* Install the chain into window procs very late so ini_routine()s
  63.       * can raw_print on error. */
  64.      windowprocs = *chain->wincp->procs;
  65.  
  66.      p = chain;
  67.      while (p) {
  68.          struct winlink *np = p->nextlink;
  69.          free(p);
  70.          p = np; /* assignment, not proof */
  71.      }
  72.  }
  73.  #endif /* WINCHAIN */
  74.  

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 UNUSED;
  9.  int how UNUSED;
  10.  const char *mesg;
  11.  {
  12.      pline("%s", mesg);
  13.      return 0;
  14.  }
  15.  
  16.  /*ARGSUSED*/

genl_preference_update

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

genl_getmsghistory

  1.  char *
  2.  genl_getmsghistory(init)
  3.  boolean init UNUSED;
  4.  {
  5.      /* window ports can provide
  6.         their own getmsghistory() routine to
  7.         preserve message history between games.
  8.         The routine is called repeatedly from
  9.         the core save routine, and the window
  10.         port is expected to successively return
  11.         each message that it wants saved, starting
  12.         with the oldest message first, finishing
  13.         with the most recent.
  14.         Return null pointer when finished.
  15.       */
  16.      return (char *) 0;
  17.  }
  18.  

genl_putmsghistory

  1.  void
  2.  genl_putmsghistory(msg, is_restoring)
  3.  const char *msg;
  4.  boolean is_restoring;
  5.  {
  6.      /* window ports can provide
  7.         their own putmsghistory() routine to
  8.         load message history from a saved game.
  9.         The routine is called repeatedly from
  10.         the core restore routine, starting with
  11.         the oldest saved message first, and
  12.         finishing with the latest.
  13.         The window port routine is expected to
  14.         load the message recall buffers in such
  15.         a way that the ordering is preserved.
  16.         The window port routine should make no
  17.         assumptions about how many messages are
  18.         forthcoming, nor should it assume that
  19.         another message will follow this one,
  20.         so it should keep all pointers/indexes
  21.         intact at the end of each call.
  22.      */
  23.  
  24.      /* this doesn't provide for reloading the message window with the
  25.         previous session's messages upon restore, but it does put the quest
  26.         message summary lines there by treating them as ordinary messages */
  27.      if (!is_restoring)
  28.          pline("%s", msg);
  29.      return;
  30.  }
  31.  
  32.  #ifdef HANGUPHANDLING
  33.  /*
  34.   * Dummy windowing scheme used to replace current one with no-ops
  35.   * in order to avoid all terminal I/O after hangup/disconnect.
  36.   */
  37.  
  38.  static int NDECL(hup_nhgetch);
  39.  static char FDECL(hup_yn_function, (const char *, const char *, CHAR_P));
  40.  static int FDECL(hup_nh_poskey, (int *, int *, int *));
  41.  static void FDECL(hup_getlin, (const char *, char *));
  42.  static void FDECL(hup_init_nhwindows, (int *, char **));
  43.  static void FDECL(hup_exit_nhwindows, (const char *));
  44.  static winid FDECL(hup_create_nhwindow, (int));
  45.  static int FDECL(hup_select_menu, (winid, int, MENU_ITEM_P **));
  46.  static void FDECL(hup_add_menu, (winid, int, const anything *, CHAR_P, CHAR_P,
  47.                                   int, const char *, BOOLEAN_P));
  48.  static void FDECL(hup_end_menu, (winid, const char *));
  49.  static void FDECL(hup_putstr, (winid, int, const char *));
  50.  static void FDECL(hup_print_glyph, (winid, XCHAR_P, XCHAR_P, int, int));
  51.  static void FDECL(hup_outrip, (winid, int, time_t));
  52.  static void FDECL(hup_curs, (winid, int, int));
  53.  static void FDECL(hup_display_nhwindow, (winid, BOOLEAN_P));
  54.  static void FDECL(hup_display_file, (const char *, BOOLEAN_P));
  55.  #ifdef CLIPPING
  56.  static void FDECL(hup_cliparound, (int, int));
  57.  #endif
  58.  #ifdef CHANGE_COLOR
  59.  static void FDECL(hup_change_color, (int, long, int));
  60.  #ifdef MAC
  61.  static short FDECL(hup_set_font_name, (winid, char *));
  62.  #endif
  63.  static char *NDECL(hup_get_color_string);
  64.  #endif /* CHANGE_COLOR */
  65.  static void FDECL(hup_status_update, (int, genericptr_t, int, int, int, unsigned long *));
  66.  
  67.  static int NDECL(hup_int_ndecl);
  68.  static void NDECL(hup_void_ndecl);
  69.  static void FDECL(hup_void_fdecl_int, (int));
  70.  static void FDECL(hup_void_fdecl_winid, (winid));
  71.  static void FDECL(hup_void_fdecl_constchar_p, (const char *));
  72.  
  73.  static struct window_procs hup_procs = {
  74.      "hup", 0L, 0L, hup_init_nhwindows,
  75.      hup_void_ndecl,                                    /* player_selection */
  76.      hup_void_ndecl,                                    /* askname */
  77.      hup_void_ndecl,                                    /* get_nh_event */
  78.      hup_exit_nhwindows, hup_void_fdecl_constchar_p,    /* suspend_nhwindows */
  79.      hup_void_ndecl,                                    /* resume_nhwindows */
  80.      hup_create_nhwindow, hup_void_fdecl_winid,         /* clear_nhwindow */
  81.      hup_display_nhwindow, hup_void_fdecl_winid,        /* destroy_nhwindow */
  82.      hup_curs, hup_putstr, hup_putstr,                  /* putmixed */
  83.      hup_display_file, hup_void_fdecl_winid,            /* start_menu */
  84.      hup_add_menu, hup_end_menu, hup_select_menu, genl_message_menu,
  85.      hup_void_ndecl,                                    /* update_inventory */
  86.      hup_void_ndecl,                                    /* mark_synch */
  87.      hup_void_ndecl,                                    /* wait_synch */
  88.  #ifdef CLIPPING
  89.      hup_cliparound,
  90.  #endif
  91.  #ifdef POSITIONBAR
  92.      (void FDECL((*), (char *))) hup_void_fdecl_constchar_p,
  93.                                                        /* update_positionbar */
  94.  #endif
  95.      hup_print_glyph,
  96.      hup_void_fdecl_constchar_p,                       /* raw_print */
  97.      hup_void_fdecl_constchar_p,                       /* raw_print_bold */
  98.      hup_nhgetch, hup_nh_poskey, hup_void_ndecl,       /* nhbell  */
  99.      hup_int_ndecl,                                    /* doprev_message */
  100.      hup_yn_function, hup_getlin, hup_int_ndecl,       /* get_ext_cmd */
  101.      hup_void_fdecl_int,                               /* number_pad */
  102.      hup_void_ndecl,                                   /* delay_output  */
  103.  #ifdef CHANGE_COLOR
  104.      hup_change_color,
  105.  #ifdef MAC
  106.      hup_void_fdecl_int,                               /* change_background */
  107.      hup_set_font_name,
  108.  #endif
  109.      hup_get_color_string,
  110.  #endif /* CHANGE_COLOR */
  111.      hup_void_ndecl,                                   /* start_screen */
  112.      hup_void_ndecl,                                   /* end_screen */
  113.      hup_outrip, genl_preference_update, genl_getmsghistory,
  114.      genl_putmsghistory,
  115.      hup_void_ndecl,                                   /* status_init */
  116.      hup_void_ndecl,                                   /* status_finish */
  117.      genl_status_enablefield, hup_status_update,
  118.      genl_can_suspend_no,
  119.  };
  120.  
  121.  static void FDECL((*previnterface_exit_nhwindows), (const char *)) = 0;
  122.  

nhwindows_hangup

  1.  /* hangup has occurred; switch to no-op user interface */
  2.  void
  3.  nhwindows_hangup()
  4.  {
  5.      char *FDECL((*previnterface_getmsghistory), (BOOLEAN_P)) = 0;
  6.  
  7.  #ifdef ALTMETA
  8.      /* command processor shouldn't look for 2nd char after seeing ESC */
  9.      iflags.altmeta = FALSE;
  10.  #endif
  11.  
  12.      /* don't call exit_nhwindows() directly here; if a hangup occurs
  13.         while interface code is executing, exit_nhwindows could knock
  14.         the interface's active data structures out from under itself */
  15.      if (iflags.window_inited
  16.          && windowprocs.win_exit_nhwindows != hup_exit_nhwindows)
  17.          previnterface_exit_nhwindows = windowprocs.win_exit_nhwindows;
  18.  
  19.      /* also, we have to leave the old interface's getmsghistory()
  20.         in place because it will be called while saving the game */
  21.      if (windowprocs.win_getmsghistory != hup_procs.win_getmsghistory)
  22.          previnterface_getmsghistory = windowprocs.win_getmsghistory;
  23.  
  24.      windowprocs = hup_procs;
  25.  
  26.      if (previnterface_getmsghistory)
  27.          windowprocs.win_getmsghistory = previnterface_getmsghistory;
  28.  }
  29.  

hup_exit_nhwindows

  1.  static void
  2.  hup_exit_nhwindows(lastgasp)
  3.  const char *lastgasp;
  4.  {
  5.      /* core has called exit_nhwindows(); call the previous interface's
  6.         shutdown routine now; xxx_exit_nhwindows() needs to call other
  7.         xxx_ routines directly rather than through windowprocs pointers */
  8.      if (previnterface_exit_nhwindows) {
  9.          lastgasp = 0; /* don't want exit routine to attempt extra output */
  10.          (*previnterface_exit_nhwindows)(lastgasp);
  11.          previnterface_exit_nhwindows = 0;
  12.      }
  13.      iflags.window_inited = 0;
  14.  }
  15.  

hup_nhgetch

  1.  static int
  2.  hup_nhgetch(VOID_ARGS)
  3.  {
  4.      return '\033'; /* ESC */
  5.  }
  6.  
  7.  /*ARGSUSED*/

hup_yn_function

  1.  static char
  2.  hup_yn_function(prompt, resp, deflt)
  3.  const char *prompt UNUSED, *resp UNUSED;
  4.  char deflt;
  5.  {
  6.      if (!deflt)
  7.          deflt = '\033';
  8.      return deflt;
  9.  }
  10.  
  11.  /*ARGSUSED*/

hup_nh_poskey

  1.  static int
  2.  hup_nh_poskey(x, y, mod)
  3.  int *x UNUSED, *y UNUSED, *mod UNUSED;
  4.  {
  5.      return '\033';
  6.  }
  7.  
  8.  /*ARGSUSED*/

hup_getlin

  1.  static void
  2.  hup_getlin(prompt, outbuf)
  3.  const char *prompt UNUSED;
  4.  char *outbuf;
  5.  {
  6.      Strcpy(outbuf, "\033");
  7.  }
  8.  
  9.  /*ARGSUSED*/

hup_init_nhwindows

  1.  static void
  2.  hup_init_nhwindows(argc_p, argv)
  3.  int *argc_p UNUSED;
  4.  char **argv UNUSED;
  5.  {
  6.      iflags.window_inited = 1;
  7.  }
  8.  
  9.  /*ARGUSED*/

hup_create_nhwindow

  1.  static winid
  2.  hup_create_nhwindow(type)
  3.  int type UNUSED;
  4.  {
  5.      return WIN_ERR;
  6.  }
  7.  
  8.  /*ARGSUSED*/

hup_select_menu

  1.  static int
  2.  hup_select_menu(window, how, menu_list)
  3.  winid window UNUSED;
  4.  int how UNUSED;
  5.  struct mi **menu_list UNUSED;
  6.  {
  7.      return -1;
  8.  }
  9.  
  10.  /*ARGSUSED*/

hup_add_menu

  1.  static void
  2.  hup_add_menu(window, glyph, identifier, sel, grpsel, attr, txt, preselected)
  3.  winid window UNUSED;
  4.  int glyph UNUSED, attr UNUSED;
  5.  const anything *identifier UNUSED;
  6.  char sel UNUSED, grpsel UNUSED;
  7.  const char *txt UNUSED;
  8.  boolean preselected UNUSED;
  9.  {
  10.      return;
  11.  }
  12.  
  13.  /*ARGSUSED*/

hup_end_menu

  1.  static void
  2.  hup_end_menu(window, prompt)
  3.  winid window UNUSED;
  4.  const char *prompt UNUSED;
  5.  {
  6.      return;
  7.  }
  8.  
  9.  /*ARGSUSED*/

hup_putstr

  1.  static void
  2.  hup_putstr(window, attr, text)
  3.  winid window UNUSED;
  4.  int attr UNUSED;
  5.  const char *text UNUSED;
  6.  {
  7.      return;
  8.  }
  9.  
  10.  /*ARGSUSED*/

hup_print_glyph

  1.  static void
  2.  hup_print_glyph(window, x, y, glyph, bkglyph)
  3.  winid window UNUSED;
  4.  xchar x UNUSED, y UNUSED;
  5.  int glyph UNUSED;
  6.  int bkglyph UNUSED;
  7.  {
  8.      return;
  9.  }
  10.  
  11.  /*ARGSUSED*/

hup_outrip

  1.  static void
  2.  hup_outrip(tmpwin, how, when)
  3.  winid tmpwin UNUSED;
  4.  int how UNUSED;
  5.  time_t when UNUSED;
  6.  {
  7.      return;
  8.  }
  9.  
  10.  /*ARGSUSED*/

hup_curs

  1.  static void
  2.  hup_curs(window, x, y)
  3.  winid window UNUSED;
  4.  int x UNUSED, y UNUSED;
  5.  {
  6.      return;
  7.  }
  8.  
  9.  /*ARGSUSED*/

hup_display_nhwindow

  1.  static void
  2.  hup_display_nhwindow(window, blocking)
  3.  winid window UNUSED;
  4.  boolean blocking UNUSED;
  5.  {
  6.      return;
  7.  }
  8.  
  9.  /*ARGSUSED*/

hup_display_file

  1.  static void
  2.  hup_display_file(fname, complain)
  3.  const char *fname UNUSED;
  4.  boolean complain UNUSED;
  5.  {
  6.      return;
  7.  }
  8.  
  9.  #ifdef CLIPPING
  10.  /*ARGSUSED*/

hup_cliparound

  1.  static void
  2.  hup_cliparound(x, y)
  3.  int x UNUSED, y UNUSED;
  4.  {
  5.      return;
  6.  }
  7.  #endif
  8.  
  9.  #ifdef CHANGE_COLOR
  10.  /*ARGSUSED*/

hup_change_color

  1.  static void
  2.  hup_change_color(color, rgb, reverse)
  3.  int color, reverse;
  4.  long rgb;
  5.  {
  6.      return;
  7.  }
  8.  
  9.  #ifdef MAC
  10.  /*ARGSUSED*/

hup_set_font_name

  1.  static short
  2.  hup_set_font_name(window, fontname)
  3.  winid window;
  4.  char *fontname;
  5.  {
  6.      return 0;
  7.  }
  8.  #endif /* MAC */
  9.  

hup_get_color_string

  1.  static char *
  2.  hup_get_color_string(VOID_ARGS)
  3.  {
  4.      return (char *) 0;
  5.  }
  6.  #endif /* CHANGE_COLOR */
  7.  
  8.  /*ARGSUSED*/

hup_status_update

  1.  static void
  2.  hup_status_update(idx, ptr, chg, pc, color, colormasks)
  3.  int idx UNUSED;
  4.  genericptr_t ptr UNUSED;
  5.  int chg UNUSED, pc UNUSED, color UNUSED;
  6.  unsigned long *colormasks UNUSED;
  7.  
  8.  {
  9.      return;
  10.  }
  11.  
  12.  /*
  13.   * Non-specific stubs.
  14.   */
  15.  

hup_int_ndecl

  1.  static int
  2.  hup_int_ndecl(VOID_ARGS)
  3.  {
  4.      return -1;
  5.  }
  6.  

hup_void_ndecl

  1.  static void
  2.  hup_void_ndecl(VOID_ARGS)
  3.  {
  4.      return;
  5.  }
  6.  
  7.  /*ARGUSED*/

hup_void_fdecl_int

  1.  static void
  2.  hup_void_fdecl_int(arg)
  3.  int arg UNUSED;
  4.  {
  5.      return;
  6.  }
  7.  
  8.  /*ARGUSED*/

hup_void_fdecl_winid

  1.  static void
  2.  hup_void_fdecl_winid(window)
  3.  winid window UNUSED;
  4.  {
  5.      return;
  6.  }
  7.  
  8.  /*ARGUSED*/

hup_void_fdecl_constchar_p

  1.  static void
  2.  hup_void_fdecl_constchar_p(string)
  3.  const char *string UNUSED;
  4.  {
  5.      return;
  6.  }
  7.  
  8.  #endif /* HANGUPHANDLING */
  9.  
  10.  
  11.  /****************************************************************************/
  12.  /* genl backward compat stuff                                               */
  13.  /****************************************************************************/
  14.  
  15.  const char *status_fieldnm[MAXBLSTATS];
  16.  const char *status_fieldfmt[MAXBLSTATS];
  17.  char *status_vals[MAXBLSTATS];
  18.  boolean status_activefields[MAXBLSTATS];
  19.  NEARDATA winid WIN_STATUS;
  20.  

genl_status_init

  1.  void
  2.  genl_status_init()
  3.  {
  4.      int i;
  5.  
  6.      for (i = 0; i < MAXBLSTATS; ++i) {
  7.          status_vals[i] = (char *) alloc(MAXCO);
  8.          *status_vals[i] = '\0';
  9.          status_activefields[i] = FALSE;
  10.          status_fieldfmt[i] = (const char *) 0;
  11.      }
  12.      /* Use a window for the genl version; backward port compatibility */
  13.      WIN_STATUS = create_nhwindow(NHW_STATUS);
  14.      display_nhwindow(WIN_STATUS, FALSE);
  15.  }
  16.  

genl_status_finish

  1.  void
  2.  genl_status_finish()
  3.  {
  4.      /* tear down routine */
  5.      int i;
  6.  
  7.      /* free alloc'd memory here */
  8.      for (i = 0; i < MAXBLSTATS; ++i) {
  9.          if (status_vals[i])
  10.              free((genericptr_t) status_vals[i]), status_vals[i] = (char *) 0;
  11.      }
  12.  }
  13.  

genl_status_enablefield

  1.  void
  2.  genl_status_enablefield(fieldidx, nm, fmt, enable)
  3.  int fieldidx;
  4.  const char *nm;
  5.  const char *fmt;
  6.  boolean enable;
  7.  {
  8.      status_fieldfmt[fieldidx] = fmt;
  9.      status_fieldnm[fieldidx] = nm;
  10.      status_activefields[fieldidx] = enable;
  11.  }
  12.  

genl_status_update

  1.  /* call once for each field, then call with BL_FLUSH to output the result */
  2.  void
  3.  genl_status_update(idx, ptr, chg, percent, color, colormasks)
  4.  int idx;
  5.  genericptr_t ptr;
  6.  int chg UNUSED, percent UNUSED, color UNUSED;
  7.  unsigned long *colormasks UNUSED;
  8.  {
  9.      char newbot1[MAXCO], newbot2[MAXCO];
  10.      long cond, *condptr = (long *) ptr;
  11.      register int i;
  12.      unsigned pass, lndelta;
  13.      enum statusfields idx1, idx2, *fieldlist;
  14.      char *nb, *text = (char *) ptr;
  15.  
  16.      static enum statusfields fieldorder[][15] = {
  17.          /* line one */
  18.          { BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN,
  19.            BL_SCORE, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH,
  20.            BL_FLUSH },
  21.          /* line two, default order */
  22.          { BL_LEVELDESC, BL_GOLD,
  23.            BL_HP, BL_HPMAX, BL_ENE, BL_ENEMAX, BL_AC,
  24.            BL_XP, BL_EXP, BL_HD,
  25.            BL_TIME,
  26.            BL_HUNGER, BL_CAP, BL_CONDITION,
  27.            BL_FLUSH },
  28.          /* move time to the end */
  29.          { BL_LEVELDESC, BL_GOLD,
  30.            BL_HP, BL_HPMAX, BL_ENE, BL_ENEMAX, BL_AC,
  31.            BL_XP, BL_EXP, BL_HD,
  32.            BL_HUNGER, BL_CAP, BL_CONDITION,
  33.            BL_TIME, BL_FLUSH },
  34.          /* move experience and time to the end */
  35.          { BL_LEVELDESC, BL_GOLD,
  36.            BL_HP, BL_HPMAX, BL_ENE, BL_ENEMAX, BL_AC,
  37.            BL_HUNGER, BL_CAP, BL_CONDITION,
  38.            BL_XP, BL_EXP, BL_HD, BL_TIME, BL_FLUSH },
  39.          /* move level description plus gold and experience and time to end */
  40.          { BL_HP, BL_HPMAX, BL_ENE, BL_ENEMAX, BL_AC,
  41.            BL_HUNGER, BL_CAP, BL_CONDITION,
  42.            BL_LEVELDESC, BL_GOLD, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_FLUSH },
  43.      };
  44.  
  45.      /* in case interface is using genl_status_update() but has not
  46.         specified WC2_FLUSH_STATUS (status_update() for field values
  47.         is buffered so final BL_FLUSH is needed to produce output) */
  48.      windowprocs.wincap2 |= WC2_FLUSH_STATUS;
  49.  
  50.      if (idx != BL_FLUSH) {
  51.          if (!status_activefields[idx])
  52.              return;
  53.          switch (idx) {
  54.          case BL_CONDITION:
  55.              cond = condptr ? *condptr : 0L;
  56.              nb = status_vals[idx];
  57.              *nb = '\0';
  58.              if (cond & BL_MASK_STONE)
  59.                  Strcpy(nb = eos(nb), " Stone");
  60.              if (cond & BL_MASK_SLIME)
  61.                  Strcpy(nb = eos(nb), " Slime");
  62.              if (cond & BL_MASK_STRNGL)
  63.                  Strcpy(nb = eos(nb), " Strngl");
  64.              if (cond & BL_MASK_FOODPOIS)
  65.                  Strcpy(nb = eos(nb), " FoodPois");
  66.              if (cond & BL_MASK_TERMILL)
  67.                  Strcpy(nb = eos(nb), " TermIll");
  68.              if (cond & BL_MASK_BLIND)
  69.                  Strcpy(nb = eos(nb), " Blind");
  70.              if (cond & BL_MASK_DEAF)
  71.                  Strcpy(nb = eos(nb), " Deaf");
  72.              if (cond & BL_MASK_STUN)
  73.                  Strcpy(nb = eos(nb), " Stun");
  74.              if (cond & BL_MASK_CONF)
  75.                  Strcpy(nb = eos(nb), " Conf");
  76.              if (cond & BL_MASK_HALLU)
  77.                  Strcpy(nb = eos(nb), " Hallu");
  78.              if (cond & BL_MASK_LEV)
  79.                  Strcpy(nb = eos(nb), " Lev");
  80.              if (cond & BL_MASK_FLY)
  81.                  Strcpy(nb = eos(nb), " Fly");
  82.              if (cond & BL_MASK_RIDE)
  83.                  Strcpy(nb = eos(nb), " Ride");
  84.              break;
  85.          default:
  86.              Sprintf(status_vals[idx],
  87.                      status_fieldfmt[idx] ? status_fieldfmt[idx] : "%s",
  88.                      text ? text : "");
  89.              break;
  90.          }
  91.          return; /* processed one field other than BL_FLUSH */
  92.      } /* (idx != BL_FLUSH) */
  93.  
  94.      /* We've received BL_FLUSH; time to output the gathered data */
  95.      nb = newbot1;
  96.      *nb = '\0';
  97.      for (i = 0; (idx1 = fieldorder[0][i]) != BL_FLUSH; ++i) {
  98.          if (status_activefields[idx1])
  99.              Strcpy(nb = eos(nb), status_vals[idx1]);
  100.      }
  101.      /* if '$' is encoded, buffer length of \GXXXXNNNN is 9 greater than
  102.         single char; we want to subtract that 9 when checking display length */
  103.      lndelta = (status_activefields[BL_GOLD]
  104.                 && strstr(status_vals[BL_GOLD], "\\G")) ? 9 : 0;
  105.      /* basic bot2 formats groups of second line fields into five buffers,
  106.         then decides how to order those buffers based on comparing lengths
  107.         of [sub]sets of them to the width of the map; we have more control
  108.         here but currently emulate that behavior */
  109.      for (pass = 1; pass <= 4; pass++) {
  110.          fieldlist = fieldorder[pass];
  111.          nb = newbot2;
  112.          *nb = '\0';
  113.          for (i = 0; (idx2 = fieldlist[i]) != BL_FLUSH; ++i) {
  114.              if (status_activefields[idx2]) {
  115.                  const char *val = status_vals[idx2];
  116.  
  117.                  switch (idx2) {
  118.                  case BL_HP: /* for pass 4, Hp comes first; mungspaces()
  119.                                 will strip the unwanted leading spaces */
  120.                  case BL_XP: case BL_HD:
  121.                  case BL_TIME:
  122.                      Strcpy(nb = eos(nb), " ");
  123.                      break;
  124.                  case BL_LEVELDESC:
  125.                      /* leveldesc has no leading space, so if we've moved
  126.                         it past the first position, provide one */
  127.                      if (i != 0)
  128.                          Strcpy(nb = eos(nb), " ");
  129.                      break;
  130.                  /*
  131.                   * We want "  hunger encumbrance conditions"
  132.                   *   or    "  encumbrance conditions"
  133.                   *   or    "  hunger conditions"
  134.                   *   or    "  conditions"
  135.                   * 'hunger'      is either " " or " hunger_text";
  136.                   * 'encumbrance' is either " " or " encumbrance_text";
  137.                   * 'conditions'  is either ""  or " cond1 cond2...".
  138.                   */
  139.                  case BL_HUNGER:
  140.                      /* hunger==" " - keep it, end up with " ";
  141.                         hunger!=" " - insert space and get "  hunger" */
  142.                      if (strcmp(val, " "))
  143.                          Strcpy(nb = eos(nb), " ");
  144.                      break;
  145.                  case BL_CAP:
  146.                      /* cap==" " - suppress it, retain "  hunger" or " ";
  147.                         cap!=" " - use it, get "  hunger cap" or "  cap" */
  148.                      if (!strcmp(val, " "))
  149.                          ++val;
  150.                      break;
  151.                  default:
  152.                      break;
  153.                  }
  154.                  Strcpy(nb = eos(nb), val); /* status_vals[idx2] */
  155.              } /* status_activefields[idx2] */
  156.  
  157.              if (idx2 == BL_CONDITION && pass < 4
  158.                  && strlen(newbot2) - lndelta > COLNO)
  159.                  break; /* switch to next order */
  160.          } /* i */
  161.  
  162.          if (idx2 == BL_FLUSH) { /* made it past BL_CONDITION */
  163.              if (pass > 1)
  164.                  mungspaces(newbot2);
  165.              break;
  166.          }
  167.      } /* pass */
  168.      curs(WIN_STATUS, 1, 0);
  169.      putstr(WIN_STATUS, 0, newbot1);
  170.      curs(WIN_STATUS, 1, 1);
  171.      putmixed(WIN_STATUS, 0, newbot2); /* putmixed() due to GOLD glyph */
  172.  }
  173.  
  174.  STATIC_VAR struct window_procs dumplog_windowprocs_backup;
  175.  STATIC_VAR FILE *dumplog_file;
  176.  
  177.  #ifdef DUMPLOG
  178.  STATIC_VAR time_t dumplog_now;
  179.  
  180.  STATIC_DCL char *FDECL(dump_fmtstr, (const char *, char *));
  181.  

dump_fmtstr

  1.  STATIC_OVL char *
  2.  dump_fmtstr(fmt, buf)
  3.  const char *fmt;
  4.  char *buf;
  5.  {
  6.      const char *fp = fmt;
  7.      char *bp = buf;
  8.      int slen, len = 0;
  9.      char tmpbuf[BUFSZ];
  10.      char verbuf[BUFSZ];
  11.      long uid;
  12.      time_t now;
  13.  
  14.      now = dumplog_now;
  15.      uid = (long) getuid();
  16.  
  17.      /*
  18.       * Note: %t and %T assume that time_t is a 'long int' number of
  19.       * seconds since some epoch value.  That's quite iffy....  The
  20.       * unit of time might be different and the datum size might be
  21.       * some variant of 'long long int'.  [Their main purpose is to
  22.       * construct a unique file name rather than record the date and
  23.       * time; violating the 'long seconds since base-date' assumption
  24.       * may or may not interfere with that usage.]
  25.       */
  26.  
  27.      while (fp && *fp && len < BUFSZ-1) {
  28.          if (*fp == '%') {
  29.              fp++;
  30.              switch (*fp) {
  31.              default:
  32.                  goto finish;
  33.              case '\0': /* fallthrough */
  34.              case '%':  /* literal % */
  35.                  Sprintf(tmpbuf, "%%");
  36.                  break;
  37.              case 't': /* game start, timestamp */
  38.                  Sprintf(tmpbuf, "%lu", (unsigned long) ubirthday);
  39.                  break;
  40.              case 'T': /* current time, timestamp */
  41.                  Sprintf(tmpbuf, "%lu", (unsigned long) now);
  42.                  break;
  43.              case 'd': /* game start, YYYYMMDDhhmmss */
  44.                  Sprintf(tmpbuf, "%08ld%06ld",
  45.                          yyyymmdd(ubirthday), hhmmss(ubirthday));
  46.                  break;
  47.              case 'D': /* current time, YYYYMMDDhhmmss */
  48.                  Sprintf(tmpbuf, "%08ld%06ld", yyyymmdd(now), hhmmss(now));
  49.                  break;
  50.              case 'v': /* version, eg. "3.6.1-0" */
  51.                  Sprintf(tmpbuf, "%s", version_string(verbuf));
  52.                  break;
  53.              case 'u': /* UID */
  54.                  Sprintf(tmpbuf, "%ld", uid);
  55.                  break;
  56.              case 'n': /* player name */
  57.                  Sprintf(tmpbuf, "%s", *plname ? plname : "unknown");
  58.                  break;
  59.              case 'N': /* first character of player name */
  60.                  Sprintf(tmpbuf, "%c", *plname ? *plname : 'u');
  61.                  break;
  62.              }
  63.  
  64.              slen = strlen(tmpbuf);
  65.              if (len + slen < BUFSZ-1) {
  66.                  len += slen;
  67.                  Sprintf(bp, "%s", tmpbuf);
  68.                  bp += slen;
  69.                  if (*fp) fp++;
  70.              } else
  71.                  break;
  72.          } else {
  73.              *bp = *fp;
  74.              bp++;
  75.              fp++;
  76.              len++;
  77.          }
  78.      }
  79.   finish:
  80.      *bp = '\0';
  81.      return buf;
  82.  }
  83.  #endif /* DUMPLOG */
  84.  

dump_open_log

  1.  void
  2.  dump_open_log(now)
  3.  time_t now;
  4.  {
  5.  #ifdef DUMPLOG
  6.      char buf[BUFSZ];
  7.      char *fname;
  8.  
  9.      dumplog_now = now;
  10.  #ifdef SYSCF
  11.      if (!sysopt.dumplogfile)
  12.          return;
  13.      fname = dump_fmtstr(sysopt.dumplogfile, buf);
  14.  #else
  15.      fname = dump_fmtstr(DUMPLOG_FILE, buf);
  16.  #endif
  17.      dumplog_file = fopen(fname, "w");
  18.      dumplog_windowprocs_backup = windowprocs;
  19.  
  20.  #else /*!DUMPLOG*/
  21.      nhUse(now);
  22.  #endif /*?DUMPLOG*/
  23.  }
  24.  

dump_close_log

  1.  void
  2.  dump_close_log()
  3.  {
  4.      if (dumplog_file) {
  5.          (void) fclose(dumplog_file);
  6.          dumplog_file = (FILE *) 0;
  7.      }
  8.  }
  9.  

dump_forward_putstr

  1.  void
  2.  dump_forward_putstr(win, attr, str, no_forward)
  3.  winid win;
  4.  int attr;
  5.  const char *str;
  6.  int no_forward;
  7.  {
  8.      if (dumplog_file)
  9.          fprintf(dumplog_file, "%s\n", str);
  10.      if (!no_forward)
  11.          putstr(win, attr, str);
  12.  }
  13.  

dump_putstr

  1.  /*ARGSUSED*/
  2.  STATIC_OVL void
  3.  dump_putstr(win, attr, str)
  4.  winid win UNUSED;
  5.  int attr UNUSED;
  6.  const char *str;
  7.  {
  8.      if (dumplog_file)
  9.          fprintf(dumplog_file, "%s\n", str);
  10.  }
  11.  

dump_create_nhwindow

  1.  STATIC_OVL winid
  2.  dump_create_nhwindow(dummy)
  3.  int dummy;
  4.  {
  5.      return dummy;
  6.  }
  7.  
  8.  /*ARGUSED*/

dump_clear_nhwindow

  1.  STATIC_OVL void
  2.  dump_clear_nhwindow(win)
  3.  winid win UNUSED;
  4.  {
  5.      return;
  6.  }
  7.  
  8.  /*ARGSUSED*/

dump_display_nhwindow

  1.  STATIC_OVL void
  2.  dump_display_nhwindow(win, p)
  3.  winid win UNUSED;
  4.  boolean p UNUSED;
  5.  {
  6.      return;
  7.  }
  8.  
  9.  /*ARGUSED*/

dump_destroy_nhwindow

  1.  STATIC_OVL void
  2.  dump_destroy_nhwindow(win)
  3.  winid win UNUSED;
  4.  {
  5.      return;
  6.  }
  7.  
  8.  /*ARGUSED*/

dump_start_menu

  1.  STATIC_OVL void
  2.  dump_start_menu(win)
  3.  winid win UNUSED;
  4.  {
  5.      return;
  6.  }
  7.  
  8.  /*ARGSUSED*/

dump_add_menu

  1.  STATIC_OVL void
  2.  dump_add_menu(win, glyph, identifier, ch, gch, attr, str, preselected)
  3.  winid win UNUSED;
  4.  int glyph UNUSED;
  5.  const anything *identifier UNUSED;
  6.  char ch;
  7.  char gch UNUSED;
  8.  int attr UNUSED;
  9.  const char *str;
  10.  boolean preselected UNUSED;
  11.  {
  12.      if (dumplog_file) {
  13.          if (glyph == NO_GLYPH)
  14.              fprintf(dumplog_file, " %s\n", str);
  15.          else
  16.              fprintf(dumplog_file, "  %c - %s\n", ch, str);
  17.      }
  18.  }
  19.  
  20.  /*ARGSUSED*/

dump_end_menu

  1.  STATIC_OVL void
  2.  dump_end_menu(win, str)
  3.  winid win UNUSED;
  4.  const char *str;
  5.  {
  6.      if (dumplog_file) {
  7.          if (str)
  8.              fprintf(dumplog_file, "%s\n", str);
  9.          else
  10.              fputs("\n", dumplog_file);
  11.      }
  12.  }
  13.  

dump_select_menu

  1.  STATIC_OVL int
  2.  dump_select_menu(win, how, item)
  3.  winid win UNUSED;
  4.  int how UNUSED;
  5.  menu_item **item;
  6.  {
  7.      *item = (menu_item *) 0;
  8.      return 0;
  9.  }
  10.  

dump_redirect

  1.  void
  2.  dump_redirect(onoff_flag)
  3.  boolean onoff_flag;
  4.  {
  5.      if (dumplog_file) {
  6.          if (onoff_flag) {
  7.              windowprocs.win_create_nhwindow = dump_create_nhwindow;
  8.              windowprocs.win_clear_nhwindow = dump_clear_nhwindow;
  9.              windowprocs.win_display_nhwindow = dump_display_nhwindow;
  10.              windowprocs.win_destroy_nhwindow = dump_destroy_nhwindow;
  11.              windowprocs.win_start_menu = dump_start_menu;
  12.              windowprocs.win_add_menu = dump_add_menu;
  13.              windowprocs.win_end_menu = dump_end_menu;
  14.              windowprocs.win_select_menu = dump_select_menu;
  15.              windowprocs.win_putstr = dump_putstr;
  16.          } else {
  17.              windowprocs = dumplog_windowprocs_backup;
  18.          }
  19.          iflags.in_dumplog = onoff_flag;
  20.      } else {
  21.          iflags.in_dumplog = FALSE;
  22.      }
  23.  }
  24.  
  25.  /*windows.c*/