Source:NetHack 3.4.3/include/wintty.h

From NetHackWiki
Jump to: navigation, search

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

  1. /*	SCCS Id: @(#)wintty.h	3.4	1996/02/18	*/
  2. /* Copyright (c) David Cohrs, 1991,1992				  */
  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. #ifndef WINTTY_H
  2. #define WINTTY_H
  3.  
  4. #define E extern
  5.  
  6. #ifndef WINDOW_STRUCTS
  7. #define WINDOW_STRUCTS
  8.  
  9. /* menu structure */
  10. typedef struct tty_mi {
  11. struct tty_mi *next;
  12. anything identifier;	/* user identifier */
  13. long count;			/* user count */
  14. char *str;			/* description string (including accelerator) */
  15. int attr;			/* string attribute */
  16. boolean selected;		/* TRUE if selected by user */
  17. char selector;		/* keyboard accelerator */
  18. char gselector;		/* group accelerator */
  19. } tty_menu_item;
  20.  
  21. /* descriptor for tty-based windows */
  22. struct WinDesc {
  23. int flags;			/* window flags */
  24. xchar type;			/* type of window */
  25. boolean active;		/* true if window is active */
  26. uchar offx, offy;		/* offset from topleft of display */
  27. short rows, cols;		/* dimensions */
  28. short curx, cury;		/* current cursor position */
  29. short maxrow, maxcol;	/* the maximum size used -- for MENU wins */
  30. 				/* maxcol is also used by WIN_MESSAGE for */
  31. 				/* tracking the ^P command */
  32. short *datlen;		/* allocation size for *data */
  33. char **data;		/* window data [row][column] */
  34. char *morestr;		/* string to display instead of default */
  35. tty_menu_item *mlist;	/* menu information (MENU) */
  36. tty_menu_item **plist;	/* menu page pointers (MENU) */
  37. short plist_size;		/* size of allocated plist (MENU) */
  38. short npages;		/* number of pages in menu (MENU) */
  39. short nitems;		/* total number of items (MENU) */
  40. short how;			/* menu mode - pick 1 or N (MENU) */
  41. char menu_ch;		/* menu char (MENU) */
  42. };
  43.  
  44. /* window flags */
  45. #define WIN_CANCELLED 1
  46. #define WIN_STOP 1		/* for NHW_MESSAGE; stops output */
  47.  
  48. /* descriptor for tty-based displays -- all the per-display data */
  49. struct DisplayDesc {
  50. uchar rows, cols;		/* width and height of tty display */
  51. uchar curx, cury;		/* current cursor position on the screen */
  52. #ifdef TEXTCOLOR
  53. int color;			/* current color */
  54. #endif
  55. int attrs;			/* attributes in effect */
  56. int toplin;			/* flag for topl stuff */
  57. int rawprint;		/* number of raw_printed lines since synch */
  58. int inmore;			/* non-zero if more() is active */
  59. int inread;			/* non-zero if reading a character */
  60. int intr;			/* non-zero if inread was interrupted */
  61. winid lastwin;		/* last window used for I/O */
  62. char dismiss_more;		/* extra character accepted at --More-- */
  63. };
  64.  
  65. #endif /* WINDOW_STRUCTS */
  66.  
  67. #define MAXWIN 20		/* maximum number of windows, cop-out */
  68.  
  69. /* tty dependent window types */
  70. #ifdef NHW_BASE
  71. #undef NHW_BASE
  72. #endif
  73. #define NHW_BASE    6
  74.  
  75. extern struct window_procs tty_procs;
  76.  
  77. /* port specific variable declarations */
  78. extern winid BASE_WINDOW;
  79.  
  80. extern struct WinDesc *wins[MAXWIN];
  81.  
  82. extern struct DisplayDesc *ttyDisplay;	/* the tty display descriptor */
  83.  
  84. extern char morc;		/* last character typed to xwaitforspace */
  85. extern char defmorestr[];	/* default --more-- prompt */
  86.  
  87. /* port specific external function references */
  88.  
  89. /* ### getline.c ### */
  90. E void FDECL(xwaitforspace, (const char *));
  91.  
  92. /* ### termcap.c, video.c ### */
  93.  
  94. E void FDECL(tty_startup,(int*, int*));
  95. #ifndef NO_TERMS
  96. E void NDECL(tty_shutdown);
  97. #endif
  98. #if defined(apollo)
  99. /* Apollos don't widen old-style function definitions properly -- they try to
  100. * be smart and use the prototype, or some such strangeness.  So we have to
  101. * define UNWIDENDED_PROTOTYPES (in tradstdc.h), which makes CHAR_P below a
  102. * char.  But the tputs termcap call was compiled as if xputc's argument
  103. * actually would be expanded.	So here, we have to make an exception. */
  104. E void FDECL(xputc, (int));
  105. #else
  106. E void FDECL(xputc, (CHAR_P));
  107. #endif
  108. E void FDECL(xputs, (const char *));
  109. #if defined(SCREEN_VGA) || defined(SCREEN_8514)
  110. E void FDECL(xputg, (int, int, unsigned));
  111. #endif
  112. E void NDECL(cl_end);
  113. E void NDECL(clear_screen);
  114. E void NDECL(home);
  115. E void NDECL(standoutbeg);
  116. E void NDECL(standoutend);
  117. # if 0
  118. E void NDECL(revbeg);
  119. E void NDECL(boldbeg);
  120. E void NDECL(blinkbeg);
  121. E void NDECL(dimbeg);
  122. E void NDECL(m_end);
  123. # endif
  124. E void NDECL(backsp);
  125. E void NDECL(graph_on);
  126. E void NDECL(graph_off);
  127. E void NDECL(cl_eos);
  128.  
  129. /*
  130. * termcap.c (or facsimiles in other ports) is the right place for doing
  131. * strange and arcane things such as outputting escape sequences to select
  132. * a color or whatever.  wintty.c should concern itself with WHERE to put
  133. * stuff in a window.
  134. */
  135. E void FDECL(term_start_attr,(int attr));
  136. E void FDECL(term_end_attr,(int attr));
  137. E void NDECL(term_start_raw_bold);
  138. E void NDECL(term_end_raw_bold);
  139.  
  140. #ifdef TEXTCOLOR
  141. E void NDECL(term_end_color);
  142. E void FDECL(term_start_color,(int color));
  143. E int FDECL(has_color,(int color));
  144. #endif /* TEXTCOLOR */
  145.  
  146.  
  147. /* ### topl.c ### */
  148.  
  149. E void FDECL(addtopl, (const char *));
  150. E void NDECL(more);
  151. E void FDECL(update_topl, (const char *));
  152. E void FDECL(putsyms, (const char*));
  153.  
  154. /* ### wintty.c ### */
  155. #ifdef CLIPPING
  156. E void NDECL(setclipped);
  157. #endif
  158. E void FDECL(docorner, (int, int));
  159. E void NDECL(end_glyphout);
  160. E void FDECL(g_putch, (int));
  161. E void NDECL(win_tty_init);
  162.  
  163. /* external declarations */
  164. E void FDECL(tty_init_nhwindows, (int *, char **));
  165. E void NDECL(tty_player_selection);
  166. E void NDECL(tty_askname);
  167. E void NDECL(tty_get_nh_event) ;
  168. E void FDECL(tty_exit_nhwindows, (const char *));
  169. E void FDECL(tty_suspend_nhwindows, (const char *));
  170. E void NDECL(tty_resume_nhwindows);
  171. E winid FDECL(tty_create_nhwindow, (int));
  172. E void FDECL(tty_clear_nhwindow, (winid));
  173. E void FDECL(tty_display_nhwindow, (winid, BOOLEAN_P));
  174. E void FDECL(tty_dismiss_nhwindow, (winid));
  175. E void FDECL(tty_destroy_nhwindow, (winid));
  176. E void FDECL(tty_curs, (winid,int,int));
  177. E void FDECL(tty_putstr, (winid, int, const char *));
  178. E void FDECL(tty_display_file, (const char *, BOOLEAN_P));
  179. E void FDECL(tty_start_menu, (winid));
  180. E void FDECL(tty_add_menu, (winid,int,const ANY_P *,
  181. 			CHAR_P,CHAR_P,int,const char *, BOOLEAN_P));
  182. E void FDECL(tty_end_menu, (winid, const char *));
  183. E int FDECL(tty_select_menu, (winid, int, MENU_ITEM_P **));
  184. E char FDECL(tty_message_menu, (CHAR_P,int,const char *));
  185. E void NDECL(tty_update_inventory);
  186. E void NDECL(tty_mark_synch);
  187. E void NDECL(tty_wait_synch);
  188. #ifdef CLIPPING
  189. E void FDECL(tty_cliparound, (int, int));
  190. #endif
  191. #ifdef POSITIONBAR
  192. E void FDECL(tty_update_positionbar, (char *));
  193. #endif
  194. E void FDECL(tty_print_glyph, (winid,XCHAR_P,XCHAR_P,int));
  195. E void FDECL(tty_raw_print, (const char *));
  196. E void FDECL(tty_raw_print_bold, (const char *));
  197. E int NDECL(tty_nhgetch);
  198. E int FDECL(tty_nh_poskey, (int *, int *, int *));
  199. E void NDECL(tty_nhbell);
  200. E int NDECL(tty_doprev_message);
  201. E char FDECL(tty_yn_function, (const char *, const char *, CHAR_P));
  202. E void FDECL(tty_getlin, (const char *,char *));
  203. E int NDECL(tty_get_ext_cmd);
  204. E void FDECL(tty_number_pad, (int));
  205. E void NDECL(tty_delay_output);
  206. #ifdef CHANGE_COLOR
  207. E void FDECL(tty_change_color,(int color,long rgb,int reverse));
  208. #ifdef MAC
  209. E void FDECL(tty_change_background,(int white_or_black));
  210. E short FDECL(set_tty_font_name, (winid, char *));
  211. #endif
  212. E char * NDECL(tty_get_color_string);
  213. #endif
  214.  
  215. /* other defs that really should go away (they're tty specific) */
  216. E void NDECL(tty_start_screen);
  217. E void NDECL(tty_end_screen);
  218.  
  219. E void FDECL(genl_outrip, (winid,int));
  220.  
  221. #ifdef NO_TERMS
  222. # ifdef MAC
  223. #  ifdef putchar
  224. #   undef putchar
  225. #   undef putc
  226. #  endif
  227. #  define putchar term_putc
  228. #  define fflush term_flush
  229. #  define puts term_puts
  230. E int FDECL(term_putc, (int c));
  231. E int FDECL(term_flush, (void *desc));
  232. E int FDECL(term_puts, (const char *str));
  233. # endif /* MAC */
  234. # if defined(MSDOS) || defined(WIN32CON)
  235. #  if defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST) || defined(WIN32CON)
  236. #   undef putchar
  237. #   undef putc
  238. #   undef puts
  239. #   define putchar(x) xputc(x)	/* these are in video.c, nttty.c */
  240. #   define putc(x) xputc(x)
  241. #   define puts(x) xputs(x)
  242. #  endif/*SCREEN_BIOS || SCREEN_DJGPPFAST || WIN32CON */
  243. #  ifdef POSITIONBAR
  244. E void FDECL(video_update_positionbar, (char *));
  245. #  endif
  246. # endif/*MSDOS*/
  247. #endif/*NO_TERMS*/
  248.  
  249. #undef E
  250.  
  251. #endif /* WINTTY_H */