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