Source:NetHack 3.6.1/include/winprocs.h

From NetHackWiki
(Redirected from Source:Winprocs.h)
Jump to: navigation, search

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