Wikia

Wikihack

Source:NetHack 3.2.0/wintty.h

2,032pages on
this wiki
Talk0

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

Warning! This is the source code from an old release. For the latest release, see Source code

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

Around Wikia's network

Random Wiki