Source:NetHack 3.6.0/include/winprocs.h

From NetHackWiki
Jump to: navigation, search

Below is the full text to winprocs.h from the source code of NetHack 3.6.0. To link to a particular line, write [[Source:NetHack 3.6.0/include/winprocs.h#line123]], for example.

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.  /* NetHack 3.6	winprocs.h	$NHDT-Date: 1433806582 2015/06/08 23:36:22 $  $NHDT-Branch: master $:$NHDT-Revision: 1.36 $ */
  2.  /* Copyright (c) David Cohrs, 1992				  */
  3.  /* NetHack may be freely redistributed.  See license for details. */
  4.  
  5.  #ifndef WINPROCS_H
  6.  #define WINPROCS_H
  7.  
  8.  #include "botl.h"
  9.  
  10.  /* NB: this MUST match chain_procs below */
  11.  struct window_procs {
  12.      const char *name;     /* Names should start with [a-z].  Names must
  13.                             * not start with '-'.  Names starting with
  14.                             * '+' are reserved for processors. */
  15.      unsigned long wincap; /* window port capability options supported */
  16.      unsigned long
  17.          wincap2; /* additional window port capability options supported */
  18.      void FDECL((*win_init_nhwindows), (int *, char **));
  19.      void NDECL((*win_player_selection));
  20.      void NDECL((*win_askname));
  21.      void NDECL((*win_get_nh_event));
  22.      void FDECL((*win_exit_nhwindows), (const char *));
  23.      void FDECL((*win_suspend_nhwindows), (const char *));
  24.      void NDECL((*win_resume_nhwindows));
  25.      winid FDECL((*win_create_nhwindow), (int));
  26.      void FDECL((*win_clear_nhwindow), (winid));
  27.      void FDECL((*win_display_nhwindow), (winid, BOOLEAN_P));
  28.      void FDECL((*win_destroy_nhwindow), (winid));
  29.      void FDECL((*win_curs), (winid, int, int));
  30.      void FDECL((*win_putstr), (winid, int, const char *));
  31.      void FDECL((*win_putmixed), (winid, int, const char *));
  32.      void FDECL((*win_display_file), (const char *, BOOLEAN_P));
  33.      void FDECL((*win_start_menu), (winid));
  34.      void FDECL((*win_add_menu), (winid, int, const ANY_P *, CHAR_P, CHAR_P,
  35.                                   int, const char *, BOOLEAN_P));
  36.      void FDECL((*win_end_menu), (winid, const char *));
  37.      int FDECL((*win_select_menu), (winid, int, MENU_ITEM_P **));
  38.      char FDECL((*win_message_menu), (CHAR_P, int, const char *));
  39.      void NDECL((*win_update_inventory));
  40.      void NDECL((*win_mark_synch));
  41.      void NDECL((*win_wait_synch));
  42.  #ifdef CLIPPING
  43.      void FDECL((*win_cliparound), (int, int));
  44.  #endif
  45.  #ifdef POSITIONBAR
  46.      void FDECL((*win_update_positionbar), (char *));
  47.  #endif
  48.      void FDECL((*win_print_glyph), (winid, XCHAR_P, XCHAR_P, int, int));
  49.      void FDECL((*win_raw_print), (const char *));
  50.      void FDECL((*win_raw_print_bold), (const char *));
  51.      int NDECL((*win_nhgetch));
  52.      int FDECL((*win_nh_poskey), (int *, int *, int *));
  53.      void NDECL((*win_nhbell));
  54.      int NDECL((*win_doprev_message));
  55.      char FDECL((*win_yn_function), (const char *, const char *, CHAR_P));
  56.      void FDECL((*win_getlin), (const char *, char *));
  57.      int NDECL((*win_get_ext_cmd));
  58.      void FDECL((*win_number_pad), (int));
  59.      void NDECL((*win_delay_output));
  60.  #ifdef CHANGE_COLOR
  61.      void FDECL((*win_change_color), (int, long, int));
  62.  #ifdef MAC
  63.      void FDECL((*win_change_background), (int));
  64.      short FDECL((*win_set_font_name), (winid, char *));
  65.  #endif
  66.      char *NDECL((*win_get_color_string));
  67.  #endif
  68.  
  69.      /* other defs that really should go away (they're tty specific) */
  70.      void NDECL((*win_start_screen));
  71.      void NDECL((*win_end_screen));
  72.  
  73.      void FDECL((*win_outrip), (winid, int, time_t));
  74.      void FDECL((*win_preference_update), (const char *));
  75.      char *FDECL((*win_getmsghistory), (BOOLEAN_P));
  76.      void FDECL((*win_putmsghistory), (const char *, BOOLEAN_P));
  77.  #ifdef STATUS_VIA_WINDOWPORT
  78.      void NDECL((*win_status_init));
  79.      void NDECL((*win_status_finish));
  80.      void FDECL((*win_status_enablefield),
  81.                 (int, const char *, const char *, BOOLEAN_P));
  82.      void FDECL((*win_status_update), (int, genericptr_t, int, int));
  83.  #ifdef STATUS_HILITES
  84.      void FDECL((*win_status_threshold), (int, int, anything, int, int, int));
  85.  #endif
  86.  #endif
  87.      boolean NDECL((*win_can_suspend));
  88.  };
  89.  
  90.  extern
  91.  #ifdef HANGUPHANDLING
  92.      volatile
  93.  #endif
  94.      NEARDATA struct window_procs windowprocs;
  95.  
  96.  /*
  97.   * If you wish to only support one window system and not use procedure
  98.   * pointers, add the appropriate #ifdef below.
  99.   */
  100.  
  101.  #define init_nhwindows (*windowprocs.win_init_nhwindows)
  102.  #define player_selection (*windowprocs.win_player_selection)
  103.  #define askname (*windowprocs.win_askname)
  104.  #define get_nh_event (*windowprocs.win_get_nh_event)
  105.  #define exit_nhwindows (*windowprocs.win_exit_nhwindows)
  106.  #define suspend_nhwindows (*windowprocs.win_suspend_nhwindows)
  107.  #define resume_nhwindows (*windowprocs.win_resume_nhwindows)
  108.  #define create_nhwindow (*windowprocs.win_create_nhwindow)
  109.  #define clear_nhwindow (*windowprocs.win_clear_nhwindow)
  110.  #define display_nhwindow (*windowprocs.win_display_nhwindow)
  111.  #define destroy_nhwindow (*windowprocs.win_destroy_nhwindow)
  112.  #define curs (*windowprocs.win_curs)
  113.  #define putstr (*windowprocs.win_putstr)
  114.  #define putmixed (*windowprocs.win_putmixed)
  115.  #define display_file (*windowprocs.win_display_file)
  116.  #define start_menu (*windowprocs.win_start_menu)
  117.  #define add_menu (*windowprocs.win_add_menu)
  118.  #define end_menu (*windowprocs.win_end_menu)
  119.  #define select_menu (*windowprocs.win_select_menu)
  120.  #define message_menu (*windowprocs.win_message_menu)
  121.  #define update_inventory (*windowprocs.win_update_inventory)
  122.  #define mark_synch (*windowprocs.win_mark_synch)
  123.  #define wait_synch (*windowprocs.win_wait_synch)
  124.  #ifdef CLIPPING
  125.  #define cliparound (*windowprocs.win_cliparound)
  126.  #endif
  127.  #ifdef POSITIONBAR
  128.  #define update_positionbar (*windowprocs.win_update_positionbar)
  129.  #endif
  130.  #define print_glyph (*windowprocs.win_print_glyph)
  131.  #define raw_print (*windowprocs.win_raw_print)
  132.  #define raw_print_bold (*windowprocs.win_raw_print_bold)
  133.  #define nhgetch (*windowprocs.win_nhgetch)
  134.  #define nh_poskey (*windowprocs.win_nh_poskey)
  135.  #define nhbell (*windowprocs.win_nhbell)
  136.  #define nh_doprev_message (*windowprocs.win_doprev_message)
  137.  #define getlin (*windowprocs.win_getlin)
  138.  #define get_ext_cmd (*windowprocs.win_get_ext_cmd)
  139.  #define number_pad (*windowprocs.win_number_pad)
  140.  #define delay_output (*windowprocs.win_delay_output)
  141.  #ifdef CHANGE_COLOR
  142.  #define change_color (*windowprocs.win_change_color)
  143.  #ifdef MAC
  144.  #define change_background (*windowprocs.win_change_background)
  145.  #define set_font_name (*windowprocs.win_set_font_name)
  146.  #endif
  147.  #define get_color_string (*windowprocs.win_get_color_string)
  148.  #endif
  149.  
  150.  /* 3.4.2: There is a real yn_function() in the core now, which does
  151.   *        some buffer length validation on the parameters prior to
  152.   *        invoking the window port routine. yn_function() is in cmd.c
  153.   */
  154.  /* #define yn_function (*windowprocs.win_yn_function) */
  155.  
  156.  /* other defs that really should go away (they're tty specific) */
  157.  #define start_screen (*windowprocs.win_start_screen)
  158.  #define end_screen (*windowprocs.win_end_screen)
  159.  
  160.  #define outrip (*windowprocs.win_outrip)
  161.  #define preference_update (*windowprocs.win_preference_update)
  162.  #define getmsghistory (*windowprocs.win_getmsghistory)
  163.  #define putmsghistory (*windowprocs.win_putmsghistory)
  164.  #ifdef STATUS_VIA_WINDOWPORT
  165.  /* there is a status_initialize() in botl.c,
  166.   * which calls win_status_init() directly; same with status_finish.
  167.   */
  168.  #define status_enablefield (*windowprocs.win_status_enablefield)
  169.  #define status_update (*windowprocs.win_status_update)
  170.  #ifdef STATUS_HILITES
  171.  #define status_threshold (*windowprocs.win_status_threshold)
  172.  #endif
  173.  #endif
  174.  
  175.  /*
  176.   * WINCAP
  177.   * Window port preference capability bits.
  178.   * Some day this might be better in its own wincap.h file.
  179.   */
  180.  #define WC_COLOR 0x01L      /* 01 Port can display things in color       */
  181.  #define WC_HILITE_PET 0x02L /* 02 supports hilite pet                    */
  182.  #define WC_ASCII_MAP 0x04L  /* 03 supports an ascii map                  */
  183.  #define WC_TILED_MAP 0x08L  /* 04 supports a tiled map                   */
  184.  #define WC_PRELOAD_TILES 0x10L /* 05 supports pre-loading tiles */
  185.  #define WC_TILE_WIDTH 0x20L  /* 06 prefer this width of tile              */
  186.  #define WC_TILE_HEIGHT 0x40L /* 07 prefer this height of tile             */
  187.  #define WC_TILE_FILE 0x80L   /* 08 alternative tile file name             */
  188.  #define WC_INVERSE 0x100L    /* 09 Port supports inverse video            */
  189.  #define WC_ALIGN_MESSAGE \
  190.      0x200L /* 10 supports message alignmt top|b|l|r     */
  191.  #define WC_ALIGN_STATUS 0x400L /* 11 supports status alignmt top|b|l|r */
  192.  #define WC_VARY_MSGCOUNT \
  193.      0x800L                  /* 12 supports varying message window        */
  194.  #define WC_FONT_MAP 0x1000L /* 13 supports specification of map win font */
  195.  #define WC_FONT_MESSAGE \
  196.      0x2000L                    /* 14 supports specification of msg win font */
  197.  #define WC_FONT_STATUS 0x4000L /* 15 supports specification of sts win font \
  198.                                    */
  199.  #define WC_FONT_MENU 0x8000L   /* 16 supports specification of mnu win font */
  200.  #define WC_FONT_TEXT 0x10000L  /* 17 supports specification of txt win font \
  201.                                    */
  202.  #define WC_FONTSIZ_MAP \
  203.      0x20000L /* 18 supports specification of map win font */
  204.  #define WC_FONTSIZ_MESSAGE \
  205.      0x40000L /* 19 supports specification of msg win font */
  206.  #define WC_FONTSIZ_STATUS \
  207.      0x80000L /* 20 supports specification of sts win font */
  208.  #define WC_FONTSIZ_MENU \
  209.      0x100000L /* 21 supports specification of mnu win font */
  210.  #define WC_FONTSIZ_TEXT \
  211.      0x200000L /* 22 supports specification of txt win font */
  212.  #define WC_SCROLL_MARGIN \
  213.      0x400000L /* 23 supports setting scroll margin for map */
  214.  #define WC_SPLASH_SCREEN \
  215.      0x800000L /* 24 supports display of splash screen      */
  216.  #define WC_POPUP_DIALOG \
  217.      0x1000000L /* 25 supports queries in pop dialogs        */
  218.  #define WC_SCROLL_AMOUNT \
  219.      0x2000000L /* 26 scroll this amount at scroll margin    */
  220.  #define WC_EIGHT_BIT_IN \
  221.      0x4000000L /* 27 8-bit character input                  */
  222.  #define WC_PERM_INVENT \
  223.      0x8000000L /* 28 8-bit character input                  */
  224.  #define WC_MAP_MODE \
  225.      0x10000000L /* 29 map_mode option                        */
  226.  #define WC_WINDOWCOLORS \
  227.      0x20000000L /* 30 background color for message window    */
  228.  #define WC_PLAYER_SELECTION \
  229.      0x40000000L /* 31 background color for message window    */
  230.  #ifdef NHSTDC
  231.  #define WC_MOUSE_SUPPORT \
  232.      0x80000000UL /* 32 mouse support                          */
  233.  #else
  234.  #define WC_MOUSE_SUPPORT \
  235.      0x80000000L /* 32 mouse support                          */
  236.  #endif
  237.  /* no free bits */
  238.  
  239.  #define WC2_FULLSCREEN 0x01L /* 01 display full screen                    */
  240.  #define WC2_SOFTKEYBOARD 0x02L /* 02 software keyboard */
  241.  #define WC2_WRAPTEXT 0x04L /* 03 wrap long lines of text                */
  242.  #define WC2_HILITE_STATUS \
  243.      0x08L /* 04 hilite fields in status                */
  244.  #define WC2_SELECTSAVED 0x10L /* 05 saved game selection menu */
  245.  #define WC2_DARKGRAY 0x20L /* 06 use bold black for black glyphs        */
  246.                             /* 26 free bits */
  247.  
  248.  #define ALIGN_LEFT 1
  249.  #define ALIGN_RIGHT 2
  250.  #define ALIGN_TOP 3
  251.  #define ALIGN_BOTTOM 4
  252.  
  253.  /* player_selection */
  254.  #define VIA_DIALOG 0
  255.  #define VIA_PROMPTS 1
  256.  
  257.  /* map_mode settings - deprecated */
  258.  #define MAP_MODE_TILES 0
  259.  #define MAP_MODE_ASCII4x6 1
  260.  #define MAP_MODE_ASCII6x8 2
  261.  #define MAP_MODE_ASCII8x8 3
  262.  #define MAP_MODE_ASCII16x8 4
  263.  #define MAP_MODE_ASCII7x12 5
  264.  #define MAP_MODE_ASCII8x12 6
  265.  #define MAP_MODE_ASCII16x12 7
  266.  #define MAP_MODE_ASCII12x16 8
  267.  #define MAP_MODE_ASCII10x18 9
  268.  #define MAP_MODE_ASCII_FIT_TO_SCREEN 10
  269.  #define MAP_MODE_TILES_FIT_TO_SCREEN 11
  270.  
  271.  #if 0
  272.  #define WC_SND_SOUND 0x01L   /* 01 Port has some sound capabilities       */
  273.  #define WC_SND_SPEAKER 0x02L /* 02 Sound supported via built-in speaker   */
  274.  #define WC_SND_STEREO 0x04L  /* 03 Stereo sound supported                 */
  275.  #define WC_SND_RAW 0x08L     /* 04 Raw sound supported                    */
  276.  #define WC_SND_WAVE 0x10L    /* 05 Wave support                           */
  277.  #define WC_SND_MIDI 0x20L /* 06 Midi support                           */
  278.  					/* 26 free bits */
  279.  #endif
  280.  
  281.  struct wc_Opt {
  282.      const char *wc_name;
  283.      unsigned long wc_bit;
  284.  };
  285.  
  286.  /* role selection by player_selection(); this ought to be in the core... */
  287.  #define RS_NAME 0
  288.  #define RS_ROLE 1
  289.  #define RS_RACE 2
  290.  #define RS_GENDER 3
  291.  #define RS_ALGNMNT 4
  292.  #define RS_filter 5
  293.  #define RS_menu_arg(x) (ROLE_RANDOM - ((x) + 1)) /* 0..5 -> -3..-8 */
  294.  
  295.  /* Choose_windows() may be called multiple times; these constants tell the
  296.   * init function whether the window system is coming or going. */
  297.  #define WININIT 0
  298.  #define WININIT_UNDO 1
  299.  
  300.  #ifdef WINCHAIN
  301.  /* Setup phases for window chain elements.
  302.          void *  rv = X_procs_chain(int,	int, void *, void *, void *);
  303.                  Xprivate*	   ALLOC n	0	0	0
  304.                  -		   INIT	 n   self    next    nextdata
  305.     where:
  306.          Xprivate* is anything window chain entry type X wants back
  307.          n is the link count (starting with 1)
  308.          self is the Xprivate* returned earlier
  309.          next is struct winprocs * or struct chainprocs * for the next link
  310.          nextdata is the Xprivate* for the next link in the chain
  311.  */
  312.  #define WINCHAIN_ALLOC 0
  313.  #define WINCHAIN_INIT 1
  314.  
  315.  #define CARGS void *
  316.  
  317.  extern FILE *wc_tracelogf; /* Expose log file for additional debugging. */
  318.  
  319.  struct chain_procs {
  320.      const char *name;     /* Names should start with [a-z].  Names must
  321.                             * not start with '-'.  Names starting with
  322.                             * '+' are reserved for processors. */
  323.      unsigned long wincap; /* window port capability options supported */
  324.      unsigned long
  325.          wincap2; /* additional window port capability options supported */
  326.      void FDECL((*win_init_nhwindows), (CARGS, int *, char **));
  327.      void FDECL((*win_player_selection), (CARGS));
  328.      void FDECL((*win_askname), (CARGS));
  329.      void FDECL((*win_get_nh_event), (CARGS));
  330.      void FDECL((*win_exit_nhwindows), (CARGS, const char *));
  331.      void FDECL((*win_suspend_nhwindows), (CARGS, const char *));
  332.      void FDECL((*win_resume_nhwindows), (CARGS));
  333.      winid FDECL((*win_create_nhwindow), (CARGS, int));
  334.      void FDECL((*win_clear_nhwindow), (CARGS, winid));
  335.      void FDECL((*win_display_nhwindow), (CARGS, winid, BOOLEAN_P));
  336.      void FDECL((*win_destroy_nhwindow), (CARGS, winid));
  337.      void FDECL((*win_curs), (CARGS, winid, int, int));
  338.      void FDECL((*win_putstr), (CARGS, winid, int, const char *));
  339.      void FDECL((*win_putmixed), (CARGS, winid, int, const char *));
  340.      void FDECL((*win_display_file), (CARGS, const char *, BOOLEAN_P));
  341.      void FDECL((*win_start_menu), (CARGS, winid));
  342.      void FDECL((*win_add_menu), (CARGS, winid, int, const ANY_P *, CHAR_P,
  343.                                   CHAR_P, int, const char *, BOOLEAN_P));
  344.      void FDECL((*win_end_menu), (CARGS, winid, const char *));
  345.      int FDECL((*win_select_menu), (CARGS, winid, int, MENU_ITEM_P **));
  346.      char FDECL((*win_message_menu), (CARGS, CHAR_P, int, const char *));
  347.      void FDECL((*win_update_inventory), (CARGS));
  348.      void FDECL((*win_mark_synch), (CARGS));
  349.      void FDECL((*win_wait_synch), (CARGS));
  350.  #ifdef CLIPPING
  351.      void FDECL((*win_cliparound), (CARGS, int, int));
  352.  #endif
  353.  #ifdef POSITIONBAR
  354.      void FDECL((*win_update_positionbar), (CARGS, char *));
  355.  #endif
  356.      void FDECL((*win_print_glyph), (CARGS, winid, XCHAR_P, XCHAR_P, int, int));
  357.      void FDECL((*win_raw_print), (CARGS, const char *));
  358.      void FDECL((*win_raw_print_bold), (CARGS, const char *));
  359.      int FDECL((*win_nhgetch), (CARGS));
  360.      int FDECL((*win_nh_poskey), (CARGS, int *, int *, int *));
  361.      void FDECL((*win_nhbell), (CARGS));
  362.      int FDECL((*win_doprev_message), (CARGS));
  363.      char FDECL((*win_yn_function),
  364.                 (CARGS, const char *, const char *, CHAR_P));
  365.      void FDECL((*win_getlin), (CARGS, const char *, char *));
  366.      int FDECL((*win_get_ext_cmd), (CARGS));
  367.      void FDECL((*win_number_pad), (CARGS, int));
  368.      void FDECL((*win_delay_output), (CARGS));
  369.  #ifdef CHANGE_COLOR
  370.      void FDECL((*win_change_color), (CARGS, int, long, int));
  371.  #ifdef MAC
  372.      void FDECL((*win_change_background), (CARGS, int));
  373.      short FDECL((*win_set_font_name), (CARGS, winid, char *));
  374.  #endif
  375.      char *FDECL((*win_get_color_string), (CARGS));
  376.  #endif
  377.  
  378.      /* other defs that really should go away (they're tty specific) */
  379.      void FDECL((*win_start_screen), (CARGS));
  380.      void FDECL((*win_end_screen), (CARGS));
  381.  
  382.      void FDECL((*win_outrip), (CARGS, winid, int, time_t));
  383.      void FDECL((*win_preference_update), (CARGS, const char *));
  384.      char *FDECL((*win_getmsghistory), (CARGS, BOOLEAN_P));
  385.      void FDECL((*win_putmsghistory), (CARGS, const char *, BOOLEAN_P));
  386.  #ifdef STATUS_VIA_WINDOWPORT
  387.      void FDECL((*win_status_init), (CARGS));
  388.      void FDECL((*win_status_finish), (CARGS));
  389.      void FDECL((*win_status_enablefield),
  390.                 (CARGS, int, const char *, const char *, BOOLEAN_P));
  391.      void FDECL((*win_status_update), (CARGS, int, genericptr_t, int, int));
  392.  #ifdef STATUS_HILITES
  393.      void FDECL((*win_status_threshold),
  394.                 (CARGS, int, int, anything, int, int, int));
  395.  #endif
  396.  #endif
  397.      boolean FDECL((*win_can_suspend), (CARGS));
  398.  };
  399.  #endif /* WINCHAIN */
  400.  
  401.  #endif /* WINPROCS_H */