OSDN Git Service

adjust for patch
[jnethack/source.git] / include / wintty.h
1 /* NetHack 3.6  wintty.h        $NHDT-Date: 1433806583 2015/06/08 23:36:23 $  $NHDT-Branch: master $:$NHDT-Revision: 1.24 $ */
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 #define MAXWIN 20 /* maximum number of windows, cop-out */
73
74 /* tty dependent window types */
75 #ifdef NHW_BASE
76 #undef NHW_BASE
77 #endif
78 #define NHW_BASE 6
79
80 extern struct window_procs tty_procs;
81
82 /* port specific variable declarations */
83 extern winid BASE_WINDOW;
84
85 extern struct WinDesc *wins[MAXWIN];
86
87 extern struct DisplayDesc *ttyDisplay; /* the tty display descriptor */
88
89 extern char morc;         /* last character typed to xwaitforspace */
90 extern char defmorestr[]; /* default --more-- prompt */
91
92 /* port specific external function references */
93
94 /* ### getline.c ### */
95 E void FDECL(xwaitforspace, (const char *));
96
97 /* ### termcap.c, video.c ### */
98
99 E void FDECL(tty_startup, (int *, int *));
100 #ifndef NO_TERMS
101 E void NDECL(tty_shutdown);
102 #endif
103 #if defined(apollo)
104 /* Apollos don't widen old-style function definitions properly -- they try to
105  * be smart and use the prototype, or some such strangeness.  So we have to
106  * define UNWIDENDED_PROTOTYPES (in tradstdc.h), which makes CHAR_P below a
107  * char.  But the tputs termcap call was compiled as if xputc's argument
108  * actually would be expanded.  So here, we have to make an exception. */
109 E void FDECL(xputc, (int));
110 #else
111 E void FDECL(xputc, (CHAR_P));
112 # if 1 /*JP*/
113 E void FDECL(xputc2, (int, int));
114 # endif
115 #endif
116 E void FDECL(xputs, (const char *));
117 #if defined(SCREEN_VGA) || defined(SCREEN_8514)
118 E void FDECL(xputg, (int, int, unsigned));
119 #endif
120 E void NDECL(cl_end);
121 E void NDECL(clear_screen);
122 E void NDECL(home);
123 E void NDECL(standoutbeg);
124 E void NDECL(standoutend);
125 #if 0
126 E void NDECL(revbeg);
127 E void NDECL(boldbeg);
128 E void NDECL(blinkbeg);
129 E void NDECL(dimbeg);
130 E void NDECL(m_end);
131 #endif
132 E void NDECL(backsp);
133 E void NDECL(graph_on);
134 E void NDECL(graph_off);
135 E void NDECL(cl_eos);
136
137 /*
138  * termcap.c (or facsimiles in other ports) is the right place for doing
139  * strange and arcane things such as outputting escape sequences to select
140  * a color or whatever.  wintty.c should concern itself with WHERE to put
141  * stuff in a window.
142  */
143 E void FDECL(term_start_attr, (int attr));
144 E void FDECL(term_end_attr, (int attr));
145 E void NDECL(term_start_raw_bold);
146 E void NDECL(term_end_raw_bold);
147
148 #ifdef TEXTCOLOR
149 E void NDECL(term_end_color);
150 E void FDECL(term_start_color, (int color));
151 E int FDECL(has_color, (int color));
152 #endif /* TEXTCOLOR */
153
154 /* ### topl.c ### */
155
156 E void FDECL(addtopl, (const char *));
157 E void NDECL(more);
158 E void FDECL(update_topl, (const char *));
159 E void FDECL(putsyms, (const char *));
160 #if 1 /*JP*/
161 E void FDECL(raw_putsyms, (const char*));
162 #endif
163
164 /* ### wintty.c ### */
165 #ifdef CLIPPING
166 E void NDECL(setclipped);
167 #endif
168 E void FDECL(docorner, (int, int));
169 E void NDECL(end_glyphout);
170 E void FDECL(g_putch, (int));
171 E void FDECL(win_tty_init, (int));
172
173 /* external declarations */
174 E void FDECL(tty_init_nhwindows, (int *, char **));
175 E void NDECL(tty_player_selection);
176 E void NDECL(tty_askname);
177 E void NDECL(tty_get_nh_event);
178 E void FDECL(tty_exit_nhwindows, (const char *));
179 E void FDECL(tty_suspend_nhwindows, (const char *));
180 E void NDECL(tty_resume_nhwindows);
181 E winid FDECL(tty_create_nhwindow, (int));
182 E void FDECL(tty_clear_nhwindow, (winid));
183 E void FDECL(tty_display_nhwindow, (winid, BOOLEAN_P));
184 E void FDECL(tty_dismiss_nhwindow, (winid));
185 E void FDECL(tty_destroy_nhwindow, (winid));
186 E void FDECL(tty_curs, (winid, int, int));
187 E void FDECL(tty_putstr, (winid, int, const char *));
188 E void FDECL(tty_display_file, (const char *, BOOLEAN_P));
189 E void FDECL(tty_start_menu, (winid));
190 E void FDECL(tty_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int,
191                             const char *, BOOLEAN_P));
192 E void FDECL(tty_end_menu, (winid, const char *));
193 E int FDECL(tty_select_menu, (winid, int, MENU_ITEM_P **));
194 E char FDECL(tty_message_menu, (CHAR_P, int, const char *));
195 E void NDECL(tty_update_inventory);
196 E void NDECL(tty_mark_synch);
197 E void NDECL(tty_wait_synch);
198 #ifdef CLIPPING
199 E void FDECL(tty_cliparound, (int, int));
200 #endif
201 #ifdef POSITIONBAR
202 E void FDECL(tty_update_positionbar, (char *));
203 #endif
204 E void FDECL(tty_print_glyph, (winid, XCHAR_P, XCHAR_P, int, int));
205 E void FDECL(tty_raw_print, (const char *));
206 E void FDECL(tty_raw_print_bold, (const char *));
207 E int NDECL(tty_nhgetch);
208 E int FDECL(tty_nh_poskey, (int *, int *, int *));
209 E void NDECL(tty_nhbell);
210 E int NDECL(tty_doprev_message);
211 E char FDECL(tty_yn_function, (const char *, const char *, CHAR_P));
212 E void FDECL(tty_getlin, (const char *, char *));
213 E int NDECL(tty_get_ext_cmd);
214 E void FDECL(tty_number_pad, (int));
215 E void NDECL(tty_delay_output);
216 #ifdef CHANGE_COLOR
217 E void FDECL(tty_change_color, (int color, long rgb, int reverse));
218 #ifdef MAC
219 E void FDECL(tty_change_background, (int white_or_black));
220 E short FDECL(set_tty_font_name, (winid, char *));
221 #endif
222 E char *NDECL(tty_get_color_string);
223 #endif
224 #ifdef STATUS_VIA_WINDOWPORT
225 E void NDECL(tty_status_init);
226 E void FDECL(tty_status_update, (int, genericptr_t, int, int));
227 #ifdef STATUS_HILITES
228 E void FDECL(tty_status_threshold, (int, int, anything, int, int, int));
229 #endif
230 #endif
231
232 /* other defs that really should go away (they're tty specific) */
233 E void NDECL(tty_start_screen);
234 E void NDECL(tty_end_screen);
235
236 E void FDECL(genl_outrip, (winid, int, time_t));
237
238 E char *FDECL(tty_getmsghistory, (BOOLEAN_P));
239 E void FDECL(tty_putmsghistory, (const char *, BOOLEAN_P));
240
241 #ifdef NO_TERMS
242 #ifdef MAC
243 #ifdef putchar
244 #undef putchar
245 #undef putc
246 #endif
247 #define putchar term_putc
248 #define fflush term_flush
249 #define puts term_puts
250 E int FDECL(term_putc, (int c));
251 E int FDECL(term_flush, (void *desc));
252 E int FDECL(term_puts, (const char *str));
253 #endif /* MAC */
254 #if defined(MSDOS) || defined(WIN32)
255 #if defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST) || defined(WIN32)
256 #undef putchar
257 #undef putc
258 #undef puts
259 #define putchar(x) xputc(x) /* these are in video.c, nttty.c */
260 #define putc(x) xputc(x)
261 #define puts(x) xputs(x)
262 #endif /*SCREEN_BIOS || SCREEN_DJGPPFAST || WIN32 */
263 #ifdef POSITIONBAR
264 E void FDECL(video_update_positionbar, (char *));
265 #endif
266 #endif /*MSDOS*/
267 #endif /*NO_TERMS*/
268
269 #undef E
270
271 #endif /* WINTTY_H */