curses.h revision 1.87.4.1 1 1.87.4.1 xtraeme /* $NetBSD: curses.h,v 1.87.4.1 2007/09/27 13:52:21 xtraeme Exp $ */
2 1.18 mikel
3 1.1 cgd /*
4 1.13 cgd * Copyright (c) 1981, 1993, 1994
5 1.7 cgd * The Regents of the University of California. All rights reserved.
6 1.1 cgd *
7 1.1 cgd * Redistribution and use in source and binary forms, with or without
8 1.1 cgd * modification, are permitted provided that the following conditions
9 1.1 cgd * are met:
10 1.1 cgd * 1. Redistributions of source code must retain the above copyright
11 1.1 cgd * notice, this list of conditions and the following disclaimer.
12 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 cgd * notice, this list of conditions and the following disclaimer in the
14 1.1 cgd * documentation and/or other materials provided with the distribution.
15 1.78 agc * 3. Neither the name of the University nor the names of its contributors
16 1.1 cgd * may be used to endorse or promote products derived from this software
17 1.1 cgd * without specific prior written permission.
18 1.1 cgd *
19 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 1.1 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 1.1 cgd * SUCH DAMAGE.
30 1.1 cgd *
31 1.21 perry * @(#)curses.h 8.5 (Berkeley) 4/29/95
32 1.1 cgd */
33 1.1 cgd
34 1.4 mycroft #ifndef _CURSES_H_
35 1.4 mycroft #define _CURSES_H_
36 1.1 cgd
37 1.22 mrg #include <sys/types.h>
38 1.22 mrg #include <sys/cdefs.h>
39 1.30 blymn #include <wchar.h>
40 1.22 mrg
41 1.4 mycroft #include <stdio.h>
42 1.87.4.1 xtraeme #include <stdbool.h>
43 1.20 lukem #include <termcap.h>
44 1.1 cgd
45 1.4 mycroft /*
46 1.31 jdc * attr_t must be the same size as wchar_t (see <wchar.h>) to avoid padding
47 1.31 jdc * in __LDATA.
48 1.4 mycroft */
49 1.30 blymn typedef wchar_t chtype;
50 1.30 blymn typedef wchar_t attr_t;
51 1.44 jdc
52 1.4 mycroft #ifndef TRUE
53 1.22 mrg #define TRUE (/*CONSTCOND*/1)
54 1.4 mycroft #endif
55 1.4 mycroft #ifndef FALSE
56 1.22 mrg #define FALSE (/*CONSTCOND*/0)
57 1.4 mycroft #endif
58 1.1 cgd
59 1.30 blymn #ifndef _CURSES_PRIVATE
60 1.30 blymn
61 1.64 blymn #define _puts(s) tputs(s, 0, __cputchar)
62 1.64 blymn #define _putchar(c) __cputchar(c)
63 1.1 cgd
64 1.4 mycroft /* Old-style terminal modes access. */
65 1.64 blymn #define crmode() cbreak()
66 1.64 blymn #define nocrmode() nocbreak()
67 1.64 blymn #define ospeed baudrate()
68 1.4 mycroft #endif /* _CURSES_PRIVATE */
69 1.50 jdc
70 1.7 cgd
71 1.22 mrg /* symbols for values returned by getch in keypad mode */
72 1.22 mrg #define KEY_MIN 0x101 /* minimum extended key value */
73 1.22 mrg #define KEY_BREAK 0x101 /* break key */
74 1.22 mrg #define KEY_DOWN 0x102 /* down arrow */
75 1.22 mrg #define KEY_UP 0x103 /* up arrow */
76 1.22 mrg #define KEY_LEFT 0x104 /* left arrow */
77 1.22 mrg #define KEY_RIGHT 0x105 /* right arrow*/
78 1.22 mrg #define KEY_HOME 0x106 /* home key */
79 1.22 mrg #define KEY_BACKSPACE 0x107 /* Backspace */
80 1.22 mrg
81 1.22 mrg /* First function key (block of 64 follow) */
82 1.24 simonb #define KEY_F0 0x108
83 1.22 mrg /* Function defining other function key values*/
84 1.24 simonb #define KEY_F(n) (KEY_F0+(n))
85 1.22 mrg
86 1.22 mrg #define KEY_DL 0x148 /* Delete Line */
87 1.22 mrg #define KEY_IL 0x149 /* Insert Line*/
88 1.22 mrg #define KEY_DC 0x14A /* Delete Character */
89 1.22 mrg #define KEY_IC 0x14B /* Insert Character */
90 1.22 mrg #define KEY_EIC 0x14C /* Exit Insert Char mode */
91 1.22 mrg #define KEY_CLEAR 0x14D /* Clear screen */
92 1.22 mrg #define KEY_EOS 0x14E /* Clear to end of screen */
93 1.22 mrg #define KEY_EOL 0x14F /* Clear to end of line */
94 1.22 mrg #define KEY_SF 0x150 /* Scroll one line forward */
95 1.22 mrg #define KEY_SR 0x151 /* Scroll one line back */
96 1.22 mrg #define KEY_NPAGE 0x152 /* Next Page */
97 1.22 mrg #define KEY_PPAGE 0x153 /* Prev Page */
98 1.22 mrg #define KEY_STAB 0x154 /* Set Tab */
99 1.22 mrg #define KEY_CTAB 0x155 /* Clear Tab */
100 1.22 mrg #define KEY_CATAB 0x156 /* Clear All Tabs */
101 1.22 mrg #define KEY_ENTER 0x157 /* Enter or Send */
102 1.22 mrg #define KEY_SRESET 0x158 /* Soft Reset */
103 1.22 mrg #define KEY_RESET 0x159 /* Hard Reset */
104 1.22 mrg #define KEY_PRINT 0x15A /* Print */
105 1.22 mrg #define KEY_LL 0x15B /* Home Down */
106 1.22 mrg
107 1.22 mrg /*
108 1.22 mrg * "Keypad" keys arranged like this:
109 1.22 mrg *
110 1.22 mrg * A1 up A3
111 1.22 mrg * left B2 right
112 1.22 mrg * C1 down C3
113 1.22 mrg *
114 1.22 mrg */
115 1.22 mrg #define KEY_A1 0x15C /* Keypad upper left */
116 1.22 mrg #define KEY_A3 0x15D /* Keypad upper right */
117 1.22 mrg #define KEY_B2 0x15E /* Keypad centre key */
118 1.22 mrg #define KEY_C1 0x15F /* Keypad lower left */
119 1.22 mrg #define KEY_C3 0x160 /* Keypad lower right */
120 1.22 mrg
121 1.22 mrg #define KEY_BTAB 0x161 /* Back Tab */
122 1.22 mrg #define KEY_BEG 0x162 /* Begin key */
123 1.22 mrg #define KEY_CANCEL 0x163 /* Cancel key */
124 1.22 mrg #define KEY_CLOSE 0x164 /* Close Key */
125 1.22 mrg #define KEY_COMMAND 0x165 /* Command Key */
126 1.22 mrg #define KEY_COPY 0x166 /* Copy key */
127 1.22 mrg #define KEY_CREATE 0x167 /* Create key */
128 1.22 mrg #define KEY_END 0x168 /* End key */
129 1.22 mrg #define KEY_EXIT 0x169 /* Exit key */
130 1.22 mrg #define KEY_FIND 0x16A /* Find key */
131 1.22 mrg #define KEY_HELP 0x16B /* Help key */
132 1.22 mrg #define KEY_MARK 0x16C /* Mark key */
133 1.22 mrg #define KEY_MESSAGE 0x16D /* Message key */
134 1.22 mrg #define KEY_MOVE 0x16E /* Move key */
135 1.22 mrg #define KEY_NEXT 0x16F /* Next Object key */
136 1.22 mrg #define KEY_OPEN 0x170 /* Open key */
137 1.22 mrg #define KEY_OPTIONS 0x171 /* Options key */
138 1.22 mrg #define KEY_PREVIOUS 0x172 /* Previous Object key */
139 1.22 mrg #define KEY_REDO 0x173 /* Redo key */
140 1.22 mrg #define KEY_REFERENCE 0x174 /* Ref Key */
141 1.22 mrg #define KEY_REFRESH 0x175 /* Refresh key */
142 1.22 mrg #define KEY_REPLACE 0x176 /* Replace key */
143 1.22 mrg #define KEY_RESTART 0x177 /* Restart key */
144 1.22 mrg #define KEY_RESUME 0x178 /* Resume key */
145 1.22 mrg #define KEY_SAVE 0x179 /* Save key */
146 1.22 mrg #define KEY_SBEG 0x17A /* Shift begin key */
147 1.22 mrg #define KEY_SCANCEL 0x17B /* Shift Cancel key */
148 1.22 mrg #define KEY_SCOMMAND 0x17C /* Shift Command key */
149 1.22 mrg #define KEY_SCOPY 0x17D /* Shift Copy key */
150 1.22 mrg #define KEY_SCREATE 0x17E /* Shift Create key */
151 1.22 mrg #define KEY_SDC 0x17F /* Shift Delete Character */
152 1.22 mrg #define KEY_SDL 0x180 /* Shift Delete Line */
153 1.22 mrg #define KEY_SELECT 0x181 /* Select key */
154 1.22 mrg #define KEY_SEND 0x182 /* Send key */
155 1.22 mrg #define KEY_SEOL 0x183 /* Shift Clear Line key */
156 1.22 mrg #define KEY_SEXIT 0x184 /* Shift Exit key */
157 1.22 mrg #define KEY_SFIND 0x185 /* Shift Find key */
158 1.22 mrg #define KEY_SHELP 0x186 /* Shift Help key */
159 1.22 mrg #define KEY_SHOME 0x187 /* Shift Home key */
160 1.22 mrg #define KEY_SIC 0x188 /* Shift Input key */
161 1.22 mrg #define KEY_SLEFT 0x189 /* Shift Left Arrow key */
162 1.22 mrg #define KEY_SMESSAGE 0x18A /* Shift Message key */
163 1.22 mrg #define KEY_SMOVE 0x18B /* Shift Move key */
164 1.22 mrg #define KEY_SNEXT 0x18C /* Shift Next key */
165 1.22 mrg #define KEY_SOPTIONS 0x18D /* Shift Options key */
166 1.22 mrg #define KEY_SPREVIOUS 0x18E /* Shift Previous key */
167 1.22 mrg #define KEY_SPRINT 0x18F /* Shift Print key */
168 1.22 mrg #define KEY_SREDO 0x190 /* Shift Redo key */
169 1.22 mrg #define KEY_SREPLACE 0x191 /* Shift Replace key */
170 1.22 mrg #define KEY_SRIGHT 0x192 /* Shift Right Arrow key */
171 1.44 jdc #define KEY_SRSUME 0x193 /* Shift Resume key */
172 1.22 mrg #define KEY_SSAVE 0x194 /* Shift Save key */
173 1.22 mrg #define KEY_SSUSPEND 0x195 /* Shift Suspend key */
174 1.22 mrg #define KEY_SUNDO 0x196 /* Shift Undo key */
175 1.22 mrg #define KEY_SUSPEND 0x197 /* Suspend key */
176 1.44 jdc #define KEY_UNDO 0x198 /* Undo key */
177 1.58 wiz #define KEY_MOUSE 0x199 /* Mouse event has occurred */
178 1.84 jdc #define KEY_RESIZE 0x200 /* Resize event has occurred */
179 1.84 jdc #define KEY_MAX 0x240 /* maximum extended key value */
180 1.22 mrg
181 1.82 christos #include <unctrl.h>
182 1.7 cgd
183 1.7 cgd /*
184 1.7 cgd * A window an array of __LINE structures pointed to by the 'lines' pointer.
185 1.7 cgd * A line is an array of __LDATA structures pointed to by the 'line' pointer.
186 1.7 cgd */
187 1.7 cgd
188 1.31 jdc /*
189 1.31 jdc * Definitions for characters and attributes in __LDATA
190 1.31 jdc */
191 1.31 jdc #define __CHARTEXT 0x000000ff /* bits for 8-bit characters */
192 1.31 jdc #define __NORMAL 0x00000000 /* Added characters are normal. */
193 1.84 jdc #define __STANDOUT 0x00000100 /* Added characters are standout. */
194 1.84 jdc #define __UNDERSCORE 0x00000200 /* Added characters are underscored. */
195 1.84 jdc #define __REVERSE 0x00000400 /* Added characters are reverse
196 1.31 jdc video. */
197 1.84 jdc #define __BLINK 0x00000800 /* Added characters are blinking. */
198 1.84 jdc #define __DIM 0x00001000 /* Added characters are dim. */
199 1.84 jdc #define __BOLD 0x00002000 /* Added characters are bold. */
200 1.84 jdc #define __BLANK 0x00004000 /* Added characters are blanked. */
201 1.84 jdc #define __PROTECT 0x00008000 /* Added characters are protected. */
202 1.84 jdc #define __ALTCHARSET 0x00010000 /* Added characters are ACS */
203 1.84 jdc #define __COLOR 0x03fe0000 /* Color bits */
204 1.84 jdc #define __ATTRIBUTES 0x03ffff00 /* All 8-bit attribute bits */
205 1.31 jdc
206 1.30 blymn typedef struct __ldata __LDATA;
207 1.30 blymn typedef struct __line __LINE;
208 1.30 blymn typedef struct __window WINDOW;
209 1.62 blymn typedef struct __screen SCREEN;
210 1.30 blymn
211 1.30 blymn /*
212 1.30 blymn * Attribute definitions
213 1.30 blymn */
214 1.31 jdc #define A_NORMAL __NORMAL
215 1.30 blymn #define A_STANDOUT __STANDOUT
216 1.30 blymn #define A_UNDERLINE __UNDERSCORE
217 1.30 blymn #define A_REVERSE __REVERSE
218 1.30 blymn #define A_BLINK __BLINK
219 1.30 blymn #define A_DIM __DIM
220 1.30 blymn #define A_BOLD __BOLD
221 1.30 blymn #define A_BLANK __BLANK
222 1.30 blymn #define A_PROTECT __PROTECT
223 1.31 jdc #define A_ALTCHARSET __ALTCHARSET
224 1.31 jdc #define A_ATTRIBUTES __ATTRIBUTES
225 1.31 jdc #define A_CHARTEXT __CHARTEXT
226 1.31 jdc #define A_COLOR __COLOR
227 1.30 blymn
228 1.30 blymn /*
229 1.30 blymn * Alternate character set definitions
230 1.30 blymn */
231 1.30 blymn
232 1.31 jdc #define NUM_ACS 128
233 1.30 blymn
234 1.30 blymn extern chtype _acs_char[NUM_ACS];
235 1.87 christos #ifdef __cplusplus
236 1.87 christos #define __UC_CAST(a) static_cast<unsigned char>(a)
237 1.87 christos #else
238 1.87 christos #define __UC_CAST(a) (unsigned char)(a)
239 1.87 christos #endif
240 1.87 christos #define ACS_RARROW _acs_char[__UC_CAST('+')]
241 1.87 christos #define ACS_LARROW _acs_char[__UC_CAST(',')]
242 1.87 christos #define ACS_UARROW _acs_char[__UC_CAST('-')]
243 1.87 christos #define ACS_DARROW _acs_char[__UC_CAST('.')]
244 1.87 christos #define ACS_BLOCK _acs_char[__UC_CAST('0')]
245 1.87 christos #define ACS_DIAMOND _acs_char[__UC_CAST('`')]
246 1.87 christos #define ACS_CKBOARD _acs_char[__UC_CAST('a')]
247 1.87 christos #define ACS_DEGREE _acs_char[__UC_CAST('f')]
248 1.87 christos #define ACS_PLMINUS _acs_char[__UC_CAST('g')]
249 1.87 christos #define ACS_BOARD _acs_char[__UC_CAST('h')]
250 1.87 christos #define ACS_LANTERN _acs_char[__UC_CAST('i')]
251 1.87 christos #define ACS_LRCORNER _acs_char[__UC_CAST('j')]
252 1.87 christos #define ACS_URCORNER _acs_char[__UC_CAST('k')]
253 1.87 christos #define ACS_ULCORNER _acs_char[__UC_CAST('l')]
254 1.87 christos #define ACS_LLCORNER _acs_char[__UC_CAST('m')]
255 1.87 christos #define ACS_PLUS _acs_char[__UC_CAST('n')]
256 1.87 christos #define ACS_HLINE _acs_char[__UC_CAST('q')]
257 1.87 christos #define ACS_S1 _acs_char[__UC_CAST('o')]
258 1.87 christos #define ACS_S9 _acs_char[__UC_CAST('s')]
259 1.87 christos #define ACS_LTEE _acs_char[__UC_CAST('t')]
260 1.87 christos #define ACS_RTEE _acs_char[__UC_CAST('u')]
261 1.87 christos #define ACS_BTEE _acs_char[__UC_CAST('v')]
262 1.87 christos #define ACS_TTEE _acs_char[__UC_CAST('w')]
263 1.87 christos #define ACS_VLINE _acs_char[__UC_CAST('x')]
264 1.87 christos #define ACS_BULLET _acs_char[__UC_CAST('~')]
265 1.30 blymn
266 1.57 wiz /* System V compatibility */
267 1.31 jdc #define ACS_SBBS ACS_LRCORNER
268 1.31 jdc #define ACS_BBSS ACS_URCORNER
269 1.30 blymn #define ACS_BSSB ACS_ULCORNER
270 1.31 jdc #define ACS_SSBB ACS_LLCORNER
271 1.31 jdc #define ACS_SSSS ACS_PLUS
272 1.31 jdc #define ACS_BSBS ACS_HLINE
273 1.31 jdc #define ACS_SSSB ACS_LTEE
274 1.31 jdc #define ACS_SBSS ACS_RTEE
275 1.30 blymn #define ACS_SSBS ACS_BTEE
276 1.30 blymn #define ACS_BSSS ACS_TTEE
277 1.30 blymn #define ACS_SBSB ACS_VLINE
278 1.31 jdc #define _acs_map _acs_char
279 1.30 blymn
280 1.30 blymn /*
281 1.83 jdc * Color definitions (ANSI color numbers)
282 1.30 blymn */
283 1.30 blymn
284 1.31 jdc #define COLOR_BLACK 0x00
285 1.31 jdc #define COLOR_RED 0x01
286 1.31 jdc #define COLOR_GREEN 0x02
287 1.31 jdc #define COLOR_YELLOW 0x03
288 1.31 jdc #define COLOR_BLUE 0x04
289 1.31 jdc #define COLOR_MAGENTA 0x05
290 1.31 jdc #define COLOR_CYAN 0x06
291 1.31 jdc #define COLOR_WHITE 0x07
292 1.7 cgd
293 1.87 christos #ifdef __cplusplus
294 1.87 christos #define __UINT32_CAST(a) static_cast<u_int32_t>(a)
295 1.87 christos #else
296 1.87 christos #define __UINT32_CAST(a) (u_int32_t)(a)
297 1.87 christos #endif
298 1.87 christos #define COLOR_PAIR(n) (((__UINT32_CAST(n)) << 17) & A_COLOR)
299 1.87 christos #define PAIR_NUMBER(n) (((__UINT32_CAST(n)) & A_COLOR) >> 17)
300 1.7 cgd
301 1.4 mycroft /* Curses external declarations. */
302 1.4 mycroft extern WINDOW *curscr; /* Current screen. */
303 1.4 mycroft extern WINDOW *stdscr; /* Standard screen. */
304 1.4 mycroft
305 1.22 mrg extern int __tcaction; /* If terminal hardware set. */
306 1.4 mycroft
307 1.4 mycroft extern int COLS; /* Columns on the screen. */
308 1.4 mycroft extern int LINES; /* Lines on the screen. */
309 1.83 jdc extern int COLORS; /* Max colors on the screen. */
310 1.83 jdc extern int COLOR_PAIRS; /* Max color pairs on the screen. */
311 1.74 jdc
312 1.74 jdc extern int ESCDELAY; /* Delay between keys in esc seq's. */
313 1.4 mycroft
314 1.85 jdc #define ERR (-1) /* Error return. */
315 1.85 jdc #define OK (0) /* Success return. */
316 1.4 mycroft
317 1.33 blymn /*
318 1.33 blymn * The following have, traditionally, been macros but X/Open say they
319 1.33 blymn * need to be functions. Keep the old macros for debugging.
320 1.33 blymn */
321 1.33 blymn #ifdef _CURSES_USE_MACROS
322 1.4 mycroft /* Standard screen pseudo functions. */
323 1.7 cgd #define addbytes(s, n) __waddbytes(stdscr, s, n, 0)
324 1.7 cgd #define addch(ch) waddch(stdscr, ch)
325 1.75 jdc #define addchnstr(s) waddchnstr(stdscr, s, n)
326 1.75 jdc #define addchstr(s) waddchnstr(stdscr, s, -1)
327 1.7 cgd #define addnstr(s, n) waddnstr(stdscr, s, n)
328 1.26 simonb #define addstr(s) waddnstr(stdscr, s, -1)
329 1.73 jdc #define attr_get(a, p, o) wattr_get(stdscr, a, p, o)
330 1.73 jdc #define attr_off(a, o) wattr_off(stdscr, a, o)
331 1.73 jdc #define attr_on(a, o) wattr_on(stdscr, a, o)
332 1.73 jdc #define attr_set(a, p, o) wattr_set(stdscr, a, p, o)
333 1.67 jdc #define attroff(attr) wattroff(stdscr, attr)
334 1.67 jdc #define attron(attr) wattron(stdscr, attr)
335 1.67 jdc #define attrset(attr) wattrset(stdscr, attr)
336 1.31 jdc #define bkgd(ch) wbkgd(stdscr, ch)
337 1.31 jdc #define bkgdset(ch) wbkgdset(stdscr, ch)
338 1.30 blymn #define border(l, r, t, b, tl, tr, bl, br) \
339 1.30 blymn wborder(stdscr, l, r, t, b, tl, tr, bl, br)
340 1.7 cgd #define clear() wclear(stdscr)
341 1.7 cgd #define clrtobot() wclrtobot(stdscr)
342 1.7 cgd #define clrtoeol() wclrtoeol(stdscr)
343 1.73 jdc #define color_set(c, o) wcolor_set(stdscr, c, o)
344 1.7 cgd #define delch() wdelch(stdscr)
345 1.7 cgd #define deleteln() wdeleteln(stdscr)
346 1.86 jdc #define echochar(c) wechochar(stdscr, c)
347 1.7 cgd #define erase() werase(stdscr)
348 1.7 cgd #define getch() wgetch(stdscr)
349 1.56 jdc #define getnstr(s, n) wgetnstr(stdscr, s, n)
350 1.7 cgd #define getstr(s) wgetstr(stdscr, s)
351 1.7 cgd #define inch() winch(stdscr)
352 1.52 simonb #define inchnstr(c) winchnstr(stdscr, c)
353 1.52 simonb #define inchstr(c) winchstr(stdscr, c)
354 1.52 simonb #define innstr(s, n) winnstr(stdscr, s, n)
355 1.7 cgd #define insch(ch) winsch(stdscr, ch)
356 1.30 blymn #define insdelln(n) winsdelln(stdscr, n)
357 1.7 cgd #define insertln() winsertln(stdscr)
358 1.52 simonb #define instr(s) winstr(stdscr, s)
359 1.7 cgd #define move(y, x) wmove(stdscr, y, x)
360 1.7 cgd #define refresh() wrefresh(stdscr)
361 1.31 jdc #define scrl(n) wscrl(stdscr, n)
362 1.55 jdc #define setscrreg(t, b) wsetscrreg(stdscr, t, b)
363 1.7 cgd #define standend() wstandend(stdscr)
364 1.7 cgd #define standout() wstandout(stdscr)
365 1.22 mrg #define timeout(delay) wtimeout(stdscr, delay)
366 1.22 mrg #define underscore() wunderscore(stdscr)
367 1.22 mrg #define underend() wunderend(stdscr)
368 1.7 cgd #define waddbytes(w, s, n) __waddbytes(w, s, n, 0)
369 1.26 simonb #define waddstr(w, s) waddnstr(w, s, -1)
370 1.4 mycroft
371 1.4 mycroft /* Standard screen plus movement pseudo functions. */
372 1.7 cgd #define mvaddbytes(y, x, s, n) mvwaddbytes(stdscr, y, x, s, n)
373 1.7 cgd #define mvaddch(y, x, ch) mvwaddch(stdscr, y, x, ch)
374 1.75 jdc #define mvaddchnstr(y, x, s, n) mvwaddchnstr(stdscr, y, x, s, n)
375 1.75 jdc #define mvaddchstr(y, x, s) mvwaddchstr(stdscr, y, x, s)
376 1.7 cgd #define mvaddnstr(y, x, s, n) mvwaddnstr(stdscr, y, x, s, n)
377 1.7 cgd #define mvaddstr(y, x, s) mvwaddstr(stdscr, y, x, s)
378 1.7 cgd #define mvdelch(y, x) mvwdelch(stdscr, y, x)
379 1.7 cgd #define mvgetch(y, x) mvwgetch(stdscr, y, x)
380 1.56 jdc #define mvgetnstr(y, x, s) mvwgetnstr(stdscr, y, x, s, n)
381 1.7 cgd #define mvgetstr(y, x, s) mvwgetstr(stdscr, y, x, s)
382 1.7 cgd #define mvinch(y, x) mvwinch(stdscr, y, x)
383 1.52 simonb #define mvinchnstr(y, x, c, n) mvwinchnstr(stdscr, y, x, c, n)
384 1.52 simonb #define mvinchstr(y, x, c) mvwinchstr(stdscr, y, x, c)
385 1.52 simonb #define mvinnstr(y, x, s, n) mvwinnstr(stdscr, y, x, s, n)
386 1.7 cgd #define mvinsch(y, x, c) mvwinsch(stdscr, y, x, c)
387 1.52 simonb #define mvinstr(y, x, s) mvwinstr(stdscr, y, x, s)
388 1.7 cgd #define mvwaddbytes(w, y, x, s, n) \
389 1.7 cgd (wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, n, 0))
390 1.7 cgd #define mvwaddch(w, y, x, ch) \
391 1.7 cgd (wmove(w, y, x) == ERR ? ERR : waddch(w, ch))
392 1.75 jdc #define mvwaddchnstr(w, y, x, s, n) \
393 1.75 jdc (wmove(w, y, x) == ERR ? ERR : waddchnstr(w, s, n))
394 1.75 jdc #define mvwaddchstr(w, y, x, s) \
395 1.75 jdc (wmove(w, y, x) == ERR ? ERR : waddchnstr(w, s, -1))
396 1.7 cgd #define mvwaddnstr(w, y, x, s, n) \
397 1.7 cgd (wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, n))
398 1.7 cgd #define mvwaddstr(w, y, x, s) \
399 1.25 simonb (wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, -1))
400 1.7 cgd #define mvwdelch(w, y, x) \
401 1.7 cgd (wmove(w, y, x) == ERR ? ERR : wdelch(w))
402 1.7 cgd #define mvwgetch(w, y, x) \
403 1.7 cgd (wmove(w, y, x) == ERR ? ERR : wgetch(w))
404 1.56 jdc #define mvwgetnstr(w, y, x, s, n) \
405 1.56 jdc (wmove(w, y, x) == ERR ? ERR : wgetnstr(w, s, n))
406 1.7 cgd #define mvwgetstr(w, y, x, s) \
407 1.7 cgd (wmove(w, y, x) == ERR ? ERR : wgetstr(w, s))
408 1.7 cgd #define mvwinch(w, y, x) \
409 1.7 cgd (wmove(w, y, x) == ERR ? ERR : winch(w))
410 1.52 simonb #define mvwinchnstr(w, y, x, c, n) \
411 1.52 simonb (wmove(w, y, x) == ERR ? ERR : winchnstr(w, c, n))
412 1.52 simonb #define mvwinchstr(w, y, x, s) \
413 1.52 simonb (wmove(w, y, x) == ERR ? ERR : winchstr(w, c))
414 1.52 simonb #define mvwinnstr(w, y, x, s, n) \
415 1.52 simonb (wmove(w, y, x) == ERR ? ERR : winnstr(w, s, n))
416 1.7 cgd #define mvwinsch(w, y, x, c) \
417 1.7 cgd (wmove(w, y, x) == ERR ? ERR : winsch(w, c))
418 1.52 simonb #define mvwinstr(w, y, x, s) \
419 1.52 simonb (wmove(w, y, x) == ERR ? ERR : winstr(w, s))
420 1.33 blymn
421 1.77 jdc /* Miscellaneous. */
422 1.77 jdc #define noqiflush() intrflush(stdscr, FALSE)
423 1.77 jdc #define qiflush() intrflush(stdscr, TRUE)
424 1.77 jdc
425 1.33 blymn #else
426 1.33 blymn /* Use functions not macros... */
427 1.44 jdc __BEGIN_DECLS
428 1.44 jdc int addbytes(const char *, int);
429 1.44 jdc int addch(chtype);
430 1.75 jdc int addchnstr(const chtype *, int);
431 1.75 jdc int addchstr(const chtype *);
432 1.44 jdc int addnstr(const char *, int);
433 1.44 jdc int addstr(const char *);
434 1.73 jdc int attr_get(attr_t *, short *, void *);
435 1.73 jdc int attr_off(attr_t, void *);
436 1.73 jdc int attr_on(attr_t, void *);
437 1.73 jdc int attr_set(attr_t, short, void *);
438 1.67 jdc int attroff(int);
439 1.67 jdc int attron(int);
440 1.67 jdc int attrset(int);
441 1.44 jdc int bkgd(chtype);
442 1.44 jdc void bkgdset(chtype);
443 1.44 jdc int border(chtype, chtype, chtype, chtype,
444 1.44 jdc chtype, chtype, chtype, chtype);
445 1.44 jdc int clear(void);
446 1.44 jdc int clrtobot(void);
447 1.44 jdc int clrtoeol(void);
448 1.73 jdc int color_set(short, void *);
449 1.44 jdc int delch(void);
450 1.44 jdc int deleteln(void);
451 1.86 jdc int echochar(const chtype);
452 1.44 jdc int erase(void);
453 1.44 jdc int getch(void);
454 1.56 jdc int getnstr(char *, int);
455 1.44 jdc int getstr(char *);
456 1.44 jdc chtype inch(void);
457 1.52 simonb int inchnstr(chtype *, int);
458 1.52 simonb int inchstr(chtype *);
459 1.52 simonb int innstr(char *, int);
460 1.44 jdc int insch(chtype);
461 1.44 jdc int insdelln(int);
462 1.44 jdc int insertln(void);
463 1.52 simonb int instr(char *);
464 1.44 jdc int move(int, int);
465 1.44 jdc int refresh(void);
466 1.44 jdc int scrl(int);
467 1.55 jdc int setscrreg(int, int);
468 1.44 jdc int standend(void);
469 1.44 jdc int standout(void);
470 1.44 jdc void timeout(int);
471 1.44 jdc int underscore(void);
472 1.44 jdc int underend(void);
473 1.44 jdc int waddbytes(WINDOW *, const char *, int);
474 1.44 jdc int waddstr(WINDOW *, const char *);
475 1.33 blymn
476 1.33 blymn /* Standard screen plus movement functions. */
477 1.44 jdc int mvaddbytes(int, int, const char *, int);
478 1.44 jdc int mvaddch(int, int, chtype);
479 1.75 jdc int mvaddchnstr(int, int, const chtype *, int);
480 1.75 jdc int mvaddchstr(int, int, const chtype *);
481 1.44 jdc int mvaddnstr(int, int, const char *, int);
482 1.44 jdc int mvaddstr(int, int, const char *);
483 1.44 jdc int mvdelch(int, int);
484 1.44 jdc int mvgetch(int, int);
485 1.56 jdc int mvgetnstr(int, int, char *, int);
486 1.44 jdc int mvgetstr(int, int, char *);
487 1.44 jdc chtype mvinch(int, int);
488 1.52 simonb int mvinchnstr(int, int, chtype *, int);
489 1.52 simonb int mvinchstr(int, int, chtype *);
490 1.52 simonb int mvinnstr(int, int, char *, int);
491 1.44 jdc int mvinsch(int, int, chtype);
492 1.52 simonb int mvinstr(int, int, char *);
493 1.44 jdc
494 1.44 jdc int mvwaddbytes(WINDOW *, int, int, const char *, int);
495 1.44 jdc int mvwaddch(WINDOW *, int, int, chtype);
496 1.75 jdc int mvwaddchnstr(WINDOW *, int, int, const chtype *, int);
497 1.75 jdc int mvwaddchstr(WINDOW *, int, int, const chtype *);
498 1.44 jdc int mvwaddnstr(WINDOW *, int, int, const char *, int);
499 1.44 jdc int mvwaddstr(WINDOW *, int, int, const char *);
500 1.44 jdc int mvwdelch(WINDOW *, int, int);
501 1.44 jdc int mvwgetch(WINDOW *, int, int);
502 1.56 jdc int mvwgetnstr(WINDOW *, int, int, char *, int);
503 1.44 jdc int mvwgetstr(WINDOW *, int, int, char *);
504 1.44 jdc chtype mvwinch(WINDOW *, int, int);
505 1.44 jdc int mvwinsch(WINDOW *, int, int, chtype);
506 1.44 jdc __END_DECLS
507 1.33 blymn #endif /* _CURSES_USE_MACROS */
508 1.33 blymn
509 1.34 jdc #define getyx(w, y, x) (y) = getcury(w), (x) = getcurx(w)
510 1.31 jdc #define getbegyx(w, y, x) (y) = getbegy(w), (x) = getbegx(w)
511 1.31 jdc #define getmaxyx(w, y, x) (y) = getmaxy(w), (x) = getmaxx(w)
512 1.61 blymn #define getparyx(w, y, x) (y) = getpary(w), (x) = getparx(w)
513 1.4 mycroft
514 1.4 mycroft /* Public function prototypes. */
515 1.14 jtc __BEGIN_DECLS
516 1.66 jdc int assume_default_colors(short, short);
517 1.63 christos int baudrate(void);
518 1.33 blymn int beep(void);
519 1.47 blymn int box(WINDOW *, chtype, chtype);
520 1.72 jdc bool can_change_color(void);
521 1.33 blymn int cbreak(void);
522 1.47 blymn int clearok(WINDOW *, bool);
523 1.47 blymn int color_content(short, short *, short *, short *);
524 1.47 blymn int copywin(const WINDOW *, WINDOW *, int, int, int, int, int, int, int);
525 1.47 blymn int curs_set(int);
526 1.33 blymn int def_prog_mode(void);
527 1.33 blymn int def_shell_mode(void);
528 1.69 blymn int define_key(char *, int);
529 1.62 blymn int delay_output(int);
530 1.62 blymn void delscreen(SCREEN *);
531 1.47 blymn int delwin(WINDOW *);
532 1.47 blymn WINDOW *derwin(WINDOW *, int, int, int, int);
533 1.47 blymn WINDOW *dupwin(WINDOW *);
534 1.44 jdc int doupdate(void);
535 1.33 blymn int echo(void);
536 1.33 blymn int endwin(void);
537 1.46 blymn char erasechar(void);
538 1.33 blymn int flash(void);
539 1.33 blymn int flushinp(void);
540 1.47 blymn int flushok(WINDOW *, bool);
541 1.47 blymn char *fullname(const char *, char *);
542 1.48 jdc chtype getattrs(WINDOW *);
543 1.47 blymn chtype getbkgd(WINDOW *);
544 1.47 blymn char *getcap(char *);
545 1.47 blymn int getcury(WINDOW *);
546 1.47 blymn int getcurx(WINDOW *);
547 1.47 blymn int getbegy(WINDOW *);
548 1.47 blymn int getbegx(WINDOW *);
549 1.47 blymn int getmaxy(WINDOW *);
550 1.47 blymn int getmaxx(WINDOW *);
551 1.61 blymn int getpary(WINDOW *);
552 1.61 blymn int getparx(WINDOW *);
553 1.33 blymn int gettmode(void);
554 1.71 blymn int halfdelay(int);
555 1.33 blymn bool has_colors(void);
556 1.55 jdc bool has_ic(void);
557 1.55 jdc bool has_il(void);
558 1.47 blymn int hline(chtype, int);
559 1.65 blymn int idcok(WINDOW *, bool);
560 1.47 blymn int idlok(WINDOW *, bool);
561 1.47 blymn int init_color(short, short, short, short);
562 1.47 blymn int init_pair(short, short, short);
563 1.33 blymn WINDOW *initscr(void);
564 1.47 blymn int intrflush(WINDOW *, bool);
565 1.33 blymn bool isendwin(void);
566 1.47 blymn bool is_linetouched(WINDOW *, int);
567 1.47 blymn bool is_wintouched(WINDOW *);
568 1.69 blymn int keyok(int, bool);
569 1.47 blymn void keypad(WINDOW *, bool);
570 1.76 jdc char *keyname(int);
571 1.46 blymn char killchar(void);
572 1.47 blymn int leaveok(WINDOW *, bool);
573 1.33 blymn char *longname(void);
574 1.47 blymn int meta(WINDOW *, bool);
575 1.47 blymn int mvcur(int, int, int, int);
576 1.60 blymn int mvderwin(WINDOW *, int, int);
577 1.47 blymn int mvhline(int, int, chtype, int);
578 1.47 blymn int mvprintw(int, int, const char *, ...)
579 1.44 jdc __attribute__((__format__(__printf__, 3, 4)));
580 1.47 blymn int mvscanw(int, int, const char *, ...)
581 1.44 jdc __attribute__((__format__(__scanf__, 3, 4)));
582 1.47 blymn int mvvline(int, int, chtype, int);
583 1.47 blymn int mvwhline(WINDOW *, int, int, chtype, int);
584 1.47 blymn int mvwvline(WINDOW *, int, int, chtype, int);
585 1.47 blymn int mvwin(WINDOW *, int, int);
586 1.52 simonb int mvwinchnstr(WINDOW *, int, int, chtype *, int);
587 1.52 simonb int mvwinchstr(WINDOW *, int, int, chtype *);
588 1.52 simonb int mvwinnstr(WINDOW *, int, int, char *, int);
589 1.52 simonb int mvwinstr(WINDOW *, int, int, char *);
590 1.47 blymn int mvwprintw(WINDOW *, int, int, const char *, ...)
591 1.44 jdc __attribute__((__format__(__printf__, 4, 5)));
592 1.47 blymn int mvwscanw(WINDOW *, int, int, const char *, ...)
593 1.44 jdc __attribute__((__format__(__scanf__, 4, 5)));
594 1.48 jdc int napms(int);
595 1.70 jdc WINDOW *newpad(int, int);
596 1.62 blymn SCREEN *newterm(char *, FILE *, FILE *);
597 1.47 blymn WINDOW *newwin(int, int, int, int);
598 1.33 blymn int nl(void);
599 1.72 jdc attr_t no_color_video(void);
600 1.33 blymn int nocbreak(void);
601 1.80 jdc int nodelay(WINDOW *, bool);
602 1.33 blymn int noecho(void);
603 1.33 blymn int nonl(void);
604 1.77 jdc void noqiflush(void);
605 1.33 blymn int noraw(void);
606 1.47 blymn int notimeout(WINDOW *, bool);
607 1.47 blymn int overlay(const WINDOW *, WINDOW *);
608 1.47 blymn int overwrite(const WINDOW *, WINDOW *);
609 1.47 blymn int pair_content(short, short *, short *);
610 1.86 jdc int pechochar(WINDOW *, const chtype);
611 1.70 jdc int pnoutrefresh(WINDOW *, int, int, int, int, int, int);
612 1.70 jdc int prefresh(WINDOW *, int, int, int, int, int, int);
613 1.44 jdc int printw(const char *, ...)
614 1.44 jdc __attribute__((__format__(__printf__, 1, 2)));
615 1.77 jdc void qiflush(void);
616 1.33 blymn int raw(void);
617 1.79 jdc int redrawwin(WINDOW *);
618 1.33 blymn int reset_prog_mode(void);
619 1.33 blymn int reset_shell_mode(void);
620 1.33 blymn int resetty(void);
621 1.59 blymn int resizeterm(int, int);
622 1.33 blymn int savetty(void);
623 1.44 jdc int scanw(const char *, ...)
624 1.44 jdc __attribute__((__format__(__scanf__, 1, 2)));
625 1.47 blymn int scroll(WINDOW *);
626 1.47 blymn int scrollok(WINDOW *, bool);
627 1.33 blymn int setterm(char *);
628 1.62 blymn SCREEN *set_term(SCREEN *);
629 1.44 jdc int start_color(void);
630 1.70 jdc WINDOW *subpad(WINDOW *, int, int, int, int);
631 1.47 blymn WINDOW *subwin(WINDOW *, int, int, int, int);
632 1.47 blymn int touchline(WINDOW *, int, int);
633 1.47 blymn int touchoverlap(WINDOW *, WINDOW *);
634 1.47 blymn int touchwin(WINDOW *);
635 1.47 blymn int ungetch(int);
636 1.47 blymn int untouchwin(WINDOW *);
637 1.66 jdc int use_default_colors(void);
638 1.47 blymn int vline(chtype, int);
639 1.47 blymn int vwprintw(WINDOW *, const char *, _BSD_VA_LIST_)
640 1.44 jdc __attribute__((__format__(__printf__, 2, 0)));
641 1.47 blymn int vwscanw(WINDOW *, const char *, _BSD_VA_LIST_)
642 1.44 jdc __attribute__((__format__(__scanf__, 2, 0)));
643 1.47 blymn int waddch(WINDOW *, chtype);
644 1.75 jdc int waddchnstr(WINDOW *, const chtype *, int);
645 1.75 jdc int waddchstr(WINDOW *, const chtype *);
646 1.47 blymn int waddnstr(WINDOW *, const char *, int);
647 1.73 jdc int wattr_get(WINDOW *, attr_t *, short *, void *);
648 1.73 jdc int wattr_off(WINDOW *, attr_t, void *);
649 1.73 jdc int wattr_on(WINDOW *, attr_t, void *);
650 1.73 jdc int wattr_set(WINDOW *, attr_t, short, void *);
651 1.67 jdc int wattroff(WINDOW *, int);
652 1.47 blymn int wattron(WINDOW *, int);
653 1.47 blymn int wattrset(WINDOW *, int);
654 1.47 blymn int wbkgd(WINDOW *, chtype);
655 1.47 blymn void wbkgdset(WINDOW *, chtype);
656 1.47 blymn int wborder(WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype,
657 1.47 blymn chtype, chtype);
658 1.47 blymn int wclear(WINDOW *);
659 1.47 blymn int wclrtobot(WINDOW *);
660 1.47 blymn int wclrtoeol(WINDOW *);
661 1.73 jdc int wcolor_set(WINDOW *, short, void *);
662 1.47 blymn int wdelch(WINDOW *);
663 1.47 blymn int wdeleteln(WINDOW *);
664 1.86 jdc int wechochar(WINDOW *, const chtype);
665 1.47 blymn int werase(WINDOW *);
666 1.47 blymn int wgetch(WINDOW *);
667 1.56 jdc int wgetnstr(WINDOW *, char *, int);
668 1.47 blymn int wgetstr(WINDOW *, char *);
669 1.47 blymn int whline(WINDOW *, chtype, int);
670 1.47 blymn chtype winch(WINDOW *);
671 1.52 simonb int winchnstr(WINDOW *, chtype *, int);
672 1.52 simonb int winchstr(WINDOW *, chtype *);
673 1.52 simonb int winnstr(WINDOW *, char *, int);
674 1.47 blymn int winsch(WINDOW *, chtype);
675 1.47 blymn int winsdelln(WINDOW *, int);
676 1.47 blymn int winsertln(WINDOW *);
677 1.52 simonb int winstr(WINDOW *, char *);
678 1.47 blymn int wmove(WINDOW *, int, int);
679 1.47 blymn int wnoutrefresh(WINDOW *);
680 1.47 blymn int wprintw(WINDOW *, const char *, ...)
681 1.44 jdc __attribute__((__format__(__printf__, 2, 3)));
682 1.79 jdc int wredrawln(WINDOW *, int, int);
683 1.47 blymn int wrefresh(WINDOW *);
684 1.59 blymn int wresize(WINDOW *, int, int);
685 1.47 blymn int wscanw(WINDOW *, const char *, ...)
686 1.44 jdc __attribute__((__format__(__scanf__, 2, 3)));
687 1.47 blymn int wscrl(WINDOW *, int);
688 1.55 jdc int wsetscrreg(WINDOW *, int, int);
689 1.47 blymn int wstandend(WINDOW *);
690 1.47 blymn int wstandout(WINDOW *);
691 1.47 blymn void wtimeout(WINDOW *, int);
692 1.47 blymn int wtouchln(WINDOW *, int, int, int);
693 1.47 blymn int wunderend(WINDOW *);
694 1.47 blymn int wunderscore(WINDOW *);
695 1.47 blymn int wvline(WINDOW *, chtype, int);
696 1.4 mycroft
697 1.7 cgd /* Private functions that are needed for user programs prototypes. */
698 1.33 blymn int __cputchar(int);
699 1.47 blymn int __waddbytes(WINDOW *, const char *, int, attr_t);
700 1.14 jtc __END_DECLS
701 1.1 cgd
702 1.4 mycroft #endif /* !_CURSES_H_ */
703