Source:SLASH'EM 0.0.7E7F2/wintty.h
Jump to navigation
Jump to search
Below is the full text to wintty.h from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[Source:SLASH'EM 0.0.7E7F2/wintty.h#line123]], for example.
Source code for vanilla NetHack is at Source code.
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. /* 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. */ 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. uchar offx, offy; /* offset from topleft of display */ 31. short rows, cols; /* dimensions */ 32. short curx, cury; /* current cursor position */ 33. short 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. short plist_size; /* size of allocated plist (MENU) */ 42. short npages; /* number of pages in menu (MENU) */ 43. short 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. 52. /* descriptor for tty-based displays -- all the per-display data */ 53. struct DisplayDesc { 54. uchar rows, cols; /* width and height of tty display */ 55. uchar curx, cury; /* current cursor position on the screen */ 56. #ifdef TEXTCOLOR 57. int color; /* current color */ 58. #endif 59. int attrs; /* attributes in effect */ 60. int toplin; /* flag for topl stuff */ 61. int rawprint; /* number of raw_printed lines since synch */ 62. int inmore; /* non-zero if more() is active */ 63. int inread; /* non-zero if reading a character */ 64. int intr; /* non-zero if inread was interrupted */ 65. winid lastwin; /* last window used for I/O */ 66. char dismiss_more; /* extra character accepted at --More-- */ 67. }; 68. 69. #endif /* WINDOW_STRUCTS */ 70. 71. #define MAXWIN 20 /* maximum number of windows, cop-out */ 72. 73. /* tty dependent window types */ 74. #ifdef NHW_BASE 75. #undef NHW_BASE 76. #endif 77. #define NHW_BASE 6 78. 79. extern struct window_procs tty_procs; 80. 81. /* port specific variable declarations */ 82. extern winid BASE_WINDOW; 83. 84. extern struct WinDesc *wins[MAXWIN]; 85. 86. extern struct DisplayDesc *ttyDisplay; /* the tty display descriptor */ 87. 88. extern char morc; /* last character typed to xwaitforspace */ 89. extern char defmorestr[]; /* default --more-- prompt */ 90. 91. /* port specific external function references */ 92. 93. /* ### getline.c ### */ 94. E void FDECL(xwaitforspace, (const char *)); 95. 96. /* ### termcap.c, video.c ### */ 97. 98. E void FDECL(tty_startup,(int*, int*)); 99. #ifndef NO_TERMS 100. E void NDECL(tty_shutdown); 101. #endif 102. #if defined(apollo) 103. /* Apollos don't widen old-style function definitions properly -- they try to 104. * be smart and use the prototype, or some such strangeness. So we have to 105. * define UNWIDENDED_PROTOTYPES (in tradstdc.h), which makes CHAR_P below a 106. * char. But the tputs termcap call was compiled as if xputc's argument 107. * actually would be expanded. So here, we have to make an exception. */ 108. E void FDECL(xputc, (int)); 109. #else 110. E void FDECL(xputc, (CHAR_P)); 111. #endif 112. E void FDECL(xputs, (const char *)); 113. #if defined(SCREEN_VGA) || defined(SCREEN_8514) || defined(ALLEG_FX) 114. E void FDECL(xputg, (int, int, unsigned)); 115. #endif 116. E void NDECL(cl_end); 117. E void NDECL(clear_screen); 118. E void NDECL(home); 119. E void NDECL(standoutbeg); 120. E void NDECL(standoutend); 121. # if 0 122. E void NDECL(revbeg); 123. E void NDECL(boldbeg); 124. E void NDECL(blinkbeg); 125. E void NDECL(dimbeg); 126. E void NDECL(m_end); 127. # endif 128. E void NDECL(backsp); 129. E void NDECL(graph_on); 130. E void NDECL(graph_off); 131. E void NDECL(cl_eos); 132. 133. /* 134. * termcap.c (or facsimiles in other ports) is the right place for doing 135. * strange and arcane things such as outputting escape sequences to select 136. * a color or whatever. wintty.c should concern itself with WHERE to put 137. * stuff in a window. 138. */ 139. E void FDECL(term_start_attr,(int attr)); 140. E void FDECL(term_end_attr,(int attr)); 141. E void NDECL(term_start_raw_bold); 142. E void NDECL(term_end_raw_bold); 143. 144. #ifdef TEXTCOLOR 145. E void NDECL(term_end_color); 146. E void FDECL(term_start_color,(int color)); 147. E int FDECL(has_color,(int color)); 148. #endif /* TEXTCOLOR */ 149. 150. 151. /* ### topl.c ### */ 152. 153. E void FDECL(addtopl, (const char *)); 154. E void NDECL(more); 155. E void FDECL(update_topl, (const char *)); 156. E void FDECL(putsyms, (const char*)); 157. 158. /* ### wintty.c ### */ 159. #ifdef CLIPPING 160. E void NDECL(setclipped); 161. #endif 162. E void FDECL(docorner, (int, int)); 163. E void NDECL(end_glyphout); 164. E void FDECL(g_putch, (int)); 165. E void NDECL(win_tty_init); 166. 167. /* external declarations */ 168. E void FDECL(tty_init_nhwindows, (int *, char **)); 169. E void NDECL(tty_player_selection); 170. E void NDECL(tty_askname); 171. E void NDECL(tty_get_nh_event) ; 172. E void FDECL(tty_exit_nhwindows, (const char *)); 173. E void FDECL(tty_suspend_nhwindows, (const char *)); 174. E void NDECL(tty_resume_nhwindows); 175. E winid FDECL(tty_create_nhwindow, (int)); 176. E void FDECL(tty_clear_nhwindow, (winid)); 177. E void FDECL(tty_display_nhwindow, (winid, BOOLEAN_P)); 178. E void FDECL(tty_dismiss_nhwindow, (winid)); 179. E void FDECL(tty_destroy_nhwindow, (winid)); 180. E void FDECL(tty_curs, (winid,int,int)); 181. E void FDECL(tty_putstr, (winid, int, const char *)); 182. #ifdef FILE_AREAS 183. E void FDECL(tty_display_file, (const char *, const char *, BOOLEAN_P)); 184. #else 185. E void FDECL(tty_display_file, (const char *, BOOLEAN_P)); 186. #endif 187. E void FDECL(tty_start_menu, (winid)); 188. E void FDECL(tty_add_menu, (winid,int,const ANY_P *, 189. CHAR_P,CHAR_P,int,const char *, BOOLEAN_P)); 190. E void FDECL(tty_end_menu, (winid, const char *)); 191. E int FDECL(tty_select_menu, (winid, int, MENU_ITEM_P **)); 192. E char FDECL(tty_message_menu, (CHAR_P,int,const char *)); 193. E void NDECL(tty_update_inventory); 194. E void NDECL(tty_mark_synch); 195. E void NDECL(tty_wait_synch); 196. #ifdef CLIPPING 197. E void FDECL(tty_cliparound, (int, int)); 198. #endif 199. #ifdef POSITIONBAR 200. E void FDECL(tty_update_positionbar, (char *)); 201. #endif 202. E void FDECL(tty_print_glyph, (winid,XCHAR_P,XCHAR_P,int)); 203. E void FDECL(tty_raw_print, (const char *)); 204. E void FDECL(tty_raw_print_bold, (const char *)); 205. E int NDECL(tty_nhgetch); 206. E int FDECL(tty_nh_poskey, (int *, int *, int *)); 207. E void NDECL(tty_nhbell); 208. E int NDECL(tty_doprev_message); 209. E char FDECL(tty_yn_function, (const char *, const char *, CHAR_P)); 210. E void FDECL(tty_getlin, (const char *,char *)); 211. E int NDECL(tty_get_ext_cmd); 212. E void FDECL(tty_number_pad, (int)); 213. E void NDECL(tty_delay_output); 214. #ifdef CHANGE_COLOR 215. E void FDECL(tty_change_color,(int color,long rgb,int reverse)); 216. #ifdef MAC 217. E void FDECL(tty_change_background,(int white_or_black)); 218. E short FDECL(set_tty_font_name, (winid, char *)); 219. #endif 220. E char * NDECL(tty_get_color_string); 221. #endif 222. 223. /* other defs that really should go away (they're tty specific) */ 224. E void NDECL(tty_start_screen); 225. E void NDECL(tty_end_screen); 226. 227. E void FDECL(genl_outrip, (winid,int)); 228. 229. #ifdef NO_TERMS 230. # ifdef MAC 231. # ifdef putchar 232. # undef putchar 233. # undef putc 234. # endif 235. # define putchar term_putc 236. # define fflush term_flush 237. # define puts term_puts 238. E int FDECL(term_putc, (int c)); 239. E int FDECL(term_flush, (void *desc)); 240. E int FDECL(term_puts, (const char *str)); 241. # endif /* MAC */ 242. # if defined(MSDOS) || defined(WIN32CON) 243. # if defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST) || defined(WIN32CON) 244. # undef putchar 245. # undef putc 246. # undef puts 247. # define putchar(x) xputc(x) /* these are in video.c, nttty.c */ 248. # define putc(x) xputc(x) 249. # define puts(x) xputs(x) 250. # endif/*SCREEN_BIOS || SCREEN_DJGPPFAST || WIN32CON */ 251. # ifdef POSITIONBAR 252. E void FDECL(video_update_positionbar, (char *)); 253. # endif 254. # endif/*MSDOS*/ 255. #endif/*NO_TERMS*/ 256. 257. #undef E 258. 259. #endif /* WINTTY_H */