Print this page
1059 curses.h conflicts with stdbool.h
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libxcurses/h/curses.h
+++ new/usr/src/lib/libxcurses/h/curses.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 -#pragma ident "%Z%%M% %I% %E% SMI"
28 -
29 27 /*
30 28 * curses.h
31 29 *
32 30 * XCurses Library
33 31 *
34 32 * Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved.
35 33 *
36 34 */
37 35
38 36 #ifndef __M_CURSES_H__
39 37 #define __M_CURSES_H__
40 38
41 39 #define _XOPEN_CURSES
42 40
43 41 #include <stdio.h>
44 42 #include <term.h>
45 43 #include <unctrl.h>
46 44 #include <wchar.h>
47 45
48 46 #ifndef EOF
49 47 #define EOF (-1)
50 48 #endif
51 49
52 50 #ifndef WEOF
53 51 #define WEOF (-1)
54 52 #endif
55 53
56 54 /*
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
57 55 * Not all <wchar.h> are created equal.
58 56 */
59 57 #ifndef _MBSTATE_T
60 58 #define _MBSTATE_T
61 59 typedef int mbstate_t;
62 60 #endif
63 61
64 62 #define ERR EOF
65 63 #define OK 0
66 64
67 -#if !(defined(__cplusplus) && defined(_BOOL))
65 +#if !(defined(__cplusplus) && defined(bool))
68 66 typedef short bool;
69 67 #endif
70 68
71 69 #define TRUE 1
72 70 #define FALSE 0
73 71
74 72 typedef unsigned short attr_t;
75 73
76 74 /*
77 75 * These attributes and masks can be applied to an attr_t.
78 76 * These are ordered according to the <no_color_video> mask,
79 77 * which has been extended to include additional attributes.
80 78 */
81 79 #define WA_NORMAL 0x0
82 80 #define WA_STANDOUT 0x0001
83 81 #define WA_UNDERLINE 0x0002
84 82 #define WA_REVERSE 0x0004
85 83 #define WA_BLINK 0x0008
86 84 #define WA_DIM 0x0010
87 85 #define WA_BOLD 0x0020
88 86 #define WA_INVIS 0x0040
89 87 #define WA_PROTECT 0x0080
90 88 #define WA_ALTCHARSET 0x0100
91 89 #define WA_HORIZONTAL 0x0200
92 90 #define WA_LEFT 0x0400
93 91 #define WA_LOW 0x0800
94 92 #define WA_RIGHT 0x1000
95 93 #define WA_TOP 0x2000
96 94 #define WA_VERTICAL 0x4000
97 95
98 96 #define WA_SGR_MASK 0x01ff /* Historical attribute set. */
99 97 #define WA_SGR1_MASK 0x7e00 /* Extended attribute set. */
100 98
101 99 /*
102 100 * Internal attribute used to support <ceol_standout_glitch>.
103 101 */
104 102 #define WA_COOKIE 0x8000
105 103
106 104 /*
107 105 * Color names.
108 106 */
109 107 #define COLOR_BLACK 0
110 108 #define COLOR_BLUE 1
111 109 #define COLOR_GREEN 2
112 110 #define COLOR_CYAN 3
113 111 #define COLOR_RED 4
114 112 #define COLOR_MAGENTA 5
115 113 #define COLOR_YELLOW 6
116 114 #define COLOR_WHITE 7
117 115
118 116 /*
119 117 * A cchar_t details the attributes, color, and a string of wide characters
120 118 * composing a complex character (p12). The wide character string consists
121 119 * of a spacing character (wcwidth() > 0) and zero or more non-spacing
122 120 * characters. Xcurses (p17) states that the minimum number of non-spacing
123 121 * characters associated with a spacing character must be at least 5, if a
124 122 * limit is imposed.
125 123 */
126 124 #define M_CCHAR_MAX 6
127 125
128 126 /***
129 127 *** Opaque data type. Keep your grubby mits off.
130 128 ***/
131 129 typedef struct {
132 130 short _f; /* True if start of character. */
133 131 short _n; /* Number of elements in wc[]. */
134 132 short _co; /* Color pair number. */
135 133 attr_t _at; /* Attribute flags. */
136 134 wchar_t _wc[M_CCHAR_MAX]; /* Complex spacing character. */
137 135 } cchar_t;
138 136
139 137 /***
140 138 *** Opaque data type. Keep your grubby mits off.
141 139 ***/
142 140 typedef struct window_t {
143 141 cchar_t _bg; /* Background. */
144 142 cchar_t _fg; /* Foreground, ignore character. */
145 143 short _cury, _curx; /* Curent cursor position in window. */
146 144 short _begy, _begx; /* Upper-left origin on screen. */
147 145 short _maxy, _maxx; /* Window dimensions. */
148 146 short _top, _bottom; /* Window's software scroll region. */
149 147 short _refy, _refx; /* Pad origin of last refresh. */
150 148 short _sminy, _sminx; /* T-L screen corner of last refresh. */
151 149 short _smaxy, _smaxx; /* B-R screen corner of last refresh. */
152 150 short _vmin, _vtime; /* wtimeout() control. */
153 151 short *_first, *_last; /* Dirty region for each screen line. */
154 152 unsigned short _flags; /* Internal flags for the window. */
155 153 unsigned short _scroll; /* Internal for scroll optimization. */
156 154 cchar_t **_line;
157 155 cchar_t *_base; /* Block of M*N screen cells. */
158 156 struct window_t *_parent; /* Parent of sub-window. */
159 157 } WINDOW;
160 158
161 159 /***
162 160 *** Opaque data type. Keep your grubby mits off.
163 161 ***/
164 162 typedef struct {
165 163 int _kfd; /* typeahead() file descriptor. */
166 164 FILE *_if, *_of; /* I/O file pointers. */
167 165 TERMINAL *_term; /* Associated terminfo entry. */
168 166 WINDOW *_newscr; /* New screen image built by wnoutrefresh(). */
169 167 WINDOW *_curscr; /* Current screen image after doupdate(). */
170 168 mbstate_t _state; /* Current multibyte state of _of. */
171 169 unsigned long *_hash; /* Hash values for curscr's screen lines. */
172 170 unsigned short _flags; /* Assorted flags. */
173 171 void *_decode; /* Function key decode tree. */
174 172 void *_in; /* Wide I/O object. */
175 173 struct {
176 174 int _size; /* Allocated size of the input stack. */
177 175 int _count; /* Number of entries on the input stack. */
178 176 int *_stack; /* Buffer used for the input stack. */
179 177 } _unget;
180 178 struct {
181 179 WINDOW *_w; /* Exists on if emulating soft label keys. */
182 180 char *_labels[8]; /* Soft label key strings. */
183 181 short _justify[8]; /* Justification for label. */
184 182 } _slk;
185 183 } SCREEN;
186 184
187 185 #ifndef __M_UNCTRL_H__
188 186 /*
189 187 * Backwards compatiblity with historical Curses applications.
190 188 */
191 189 typedef unsigned long chtype;
192 190 #endif
193 191
194 192 /*
195 193 * These attributes and masks can be applied to a chtype.
196 194 * They are order according to the <no_color_video> mask.
197 195 */
198 196 #define A_NORMAL 0x00000000L
199 197 #define A_ATTRIBUTES 0xffff0000L /* Color/Attribute mask */
200 198 #define A_CHARTEXT 0x0000ffffL /* 16-bit character mask */
201 199 #define A_COLOR 0xfe000000L /* Colour mask, see __COLOR_SHIFT */
202 200 #define A_STANDOUT 0x00010000L
203 201 #define A_UNDERLINE 0x00020000L
204 202 #define A_REVERSE 0x00040000L
205 203 #define A_BLINK 0x00080000L
206 204 #define A_DIM 0x00100000L
207 205 #define A_BOLD 0x00200000L
208 206 #define A_INVIS 0x00400000L
209 207 #define A_PROTECT 0x00800000L
210 208 #define A_ALTCHARSET 0x01000000L
211 209
212 210 /*
213 211 * Colour atttribute support for chtype.
214 212 */
215 213 #define __COLOR_SHIFT 26
216 214
217 215 /*
218 216 * Characters constants used with a chtype.
219 217 * Mapping defined in Xcurses Section 6.2.12 (p260).
220 218 */
221 219 #define ACS_VLINE (A_ALTCHARSET | 'x')
222 220 #define ACS_HLINE (A_ALTCHARSET | 'q')
223 221 #define ACS_ULCORNER (A_ALTCHARSET | 'l')
224 222 #define ACS_URCORNER (A_ALTCHARSET | 'k')
225 223 #define ACS_LLCORNER (A_ALTCHARSET | 'm')
226 224 #define ACS_LRCORNER (A_ALTCHARSET | 'j')
227 225 #define ACS_RTEE (A_ALTCHARSET | 'u')
228 226 #define ACS_LTEE (A_ALTCHARSET | 't')
229 227 #define ACS_BTEE (A_ALTCHARSET | 'v')
230 228 #define ACS_TTEE (A_ALTCHARSET | 'w')
231 229 #define ACS_PLUS (A_ALTCHARSET | 'n')
232 230 #define ACS_S1 (A_ALTCHARSET | 'o')
233 231 #define ACS_S9 (A_ALTCHARSET | 's')
234 232 #define ACS_DIAMOND (A_ALTCHARSET | '`')
235 233 #define ACS_CKBOARD (A_ALTCHARSET | 'a')
236 234 #define ACS_DEGREE (A_ALTCHARSET | 'f')
237 235 #define ACS_PLMINUS (A_ALTCHARSET | 'g')
238 236 #define ACS_BULLET (A_ALTCHARSET | '~')
239 237 #define ACS_LARROW (A_ALTCHARSET | ',')
240 238 #define ACS_RARROW (A_ALTCHARSET | '+')
241 239 #define ACS_DARROW (A_ALTCHARSET | '.')
242 240 #define ACS_UARROW (A_ALTCHARSET | '-')
243 241 #define ACS_BOARD (A_ALTCHARSET | 'h')
244 242 #define ACS_LANTERN (A_ALTCHARSET | 'I')
245 243 #define ACS_BLOCK (A_ALTCHARSET | '0')
246 244
247 245 #ifndef _XOPEN_SOURCE
248 246 /*
249 247 * MKS Extensions for double width box characters.
250 248 */
251 249 #define ACS_DVLINE ACS_VLINE
252 250 #define ACS_DHLINE ACS_HLINE
253 251 #define ACS_DULCORNER ACS_ULCORNER
254 252 #define ACS_DURCORNER ACS_URCORNER
255 253 #define ACS_DLLCORNER ACS_LLCORNER
256 254 #define ACS_DLRCORNER ACS_LRCORNER
257 255 #define ACS_DRTEE ACS_RTEE
258 256 #define ACS_DLTEE ACS_LTEE
259 257 #define ACS_DBTEE ACS_BTEE
260 258 #define ACS_DTTEE ACS_TTEE
261 259 #endif /* _XOPEN_SOURCE */
262 260
263 261 /*
264 262 * Wide characters constants for a cchar_t.
265 263 */
266 264 extern const cchar_t __WACS_VLINE;
267 265 extern const cchar_t __WACS_HLINE;
268 266 extern const cchar_t __WACS_ULCORNER;
269 267 extern const cchar_t __WACS_URCORNER;
270 268 extern const cchar_t __WACS_LLCORNER;
271 269 extern const cchar_t __WACS_LRCORNER;
272 270 extern const cchar_t __WACS_RTEE;
273 271 extern const cchar_t __WACS_LTEE;
274 272 extern const cchar_t __WACS_BTEE;
275 273 extern const cchar_t __WACS_TTEE;
276 274 extern const cchar_t __WACS_PLUS;
277 275 extern const cchar_t __WACS_S1;
278 276 extern const cchar_t __WACS_S9;
279 277 extern const cchar_t __WACS_DIAMOND;
280 278 extern const cchar_t __WACS_CKBOARD;
281 279 extern const cchar_t __WACS_DEGREE;
282 280 extern const cchar_t __WACS_PLMINUS;
283 281 extern const cchar_t __WACS_BULLET;
284 282 extern const cchar_t __WACS_LARROW;
285 283 extern const cchar_t __WACS_RARROW;
286 284 extern const cchar_t __WACS_DARROW;
287 285 extern const cchar_t __WACS_UARROW;
288 286 extern const cchar_t __WACS_BOARD;
289 287 extern const cchar_t __WACS_LANTERN;
290 288 extern const cchar_t __WACS_BLOCK;
291 289
292 290 #define WACS_VLINE &__WACS_VLINE
293 291 #define WACS_HLINE &__WACS_HLINE
294 292 #define WACS_ULCORNER &__WACS_ULCORNER
295 293 #define WACS_URCORNER &__WACS_URCORNER
296 294 #define WACS_LLCORNER &__WACS_LLCORNER
297 295 #define WACS_LRCORNER &__WACS_LRCORNER
298 296 #define WACS_RTEE &__WACS_RTEE
299 297 #define WACS_LTEE &__WACS_LTEE
300 298 #define WACS_BTEE &__WACS_BTEE
301 299 #define WACS_TTEE &__WACS_TTEE
302 300 #define WACS_PLUS &__WACS_PLUS
303 301 #define WACS_S1 &__WACS_S1
304 302 #define WACS_S9 &__WACS_S9
305 303 #define WACS_DIAMOND &__WACS_DIAMOND
306 304 #define WACS_CKBOARD &__WACS_CKBOARD
307 305 #define WACS_DEGREE &__WACS_DEGREE
308 306 #define WACS_PLMINUS &__WACS_PLMINUS
309 307 #define WACS_BULLET &__WACS_BULLET
310 308 #define WACS_LARROW &__WACS_LARROW
311 309 #define WACS_RARROW &__WACS_RARROW
312 310 #define WACS_DARROW &__WACS_DARROW
313 311 #define WACS_UARROW &__WACS_UARROW
314 312 #define WACS_BOARD &__WACS_BOARD
315 313 #define WACS_LANTERN &__WACS_LANTERN
316 314 #define WACS_BLOCK &__WACS_BLOCK
317 315
318 316 #ifndef _XOPEN_SOURCE
319 317 /*
320 318 * MKS Extensions for double width box characters.
321 319 */
322 320 #define WACS_DVLINE WACS_VLINE
323 321 #define WACS_DHLINE WACS_HLINE
324 322 #define WACS_DULCORNER WACS_ULCORNER
325 323 #define WACS_DURCORNER WACS_URCORNER
326 324 #define WACS_DLLCORNER WACS_LLCORNER
327 325 #define WACS_DLRCORNER WACS_LRCORNER
328 326 #define WACS_DRTEE WACS_RTEE
329 327 #define WACS_DLTEE WACS_LTEE
330 328 #define WACS_DBTEE WACS_BTEE
331 329 #define WACS_DTTEE WACS_TTEE
332 330 #endif /* _XOPEN_SOURCE */
333 331
334 332 /*
335 333 * Internal functions.
336 334 */
337 335 extern int __m_outc(int);
338 336 extern int __m_tty_wc(int, wchar_t *);
339 337 extern int __m_chtype_cc(chtype, cchar_t *);
340 338 extern chtype __m_cc_chtype(const cchar_t *);
341 339 extern int __m_copywin(const WINDOW *, WINDOW *, int);
342 340 extern WINDOW *__m_newwin(WINDOW *, int, int, int, int);
343 341
344 342 /*
345 343 * Internal macros.
346 344 */
347 345 #define __m_getpary(w) ((w)->_parent == (WINDOW *) 0 ? -1 \
348 346 : (w)->_begy - (w)->_parent->_begy)
349 347 #define __m_getparx(w) ((w)->_parent == (WINDOW *) 0 ? -1 \
350 348 : (w)->_begx - (w)->_parent->_begx)
351 349
352 350 /*
353 351 * Global Window Macros
354 352 */
355 353 #define getyx(w,y,x) (y = (w)->_cury, x = (w)->_curx)
356 354 #define getbegyx(w,y,x) (y = (w)->_begy, x = (w)->_begx)
357 355 #define getmaxyx(w,y,x) (y = (w)->_maxy, x = (w)->_maxx)
358 356 #define getparyx(w,y,x) (y = __m_getpary(w), x = __m_getparx(w))
359 357
360 358 /*
361 359 * Global variables
362 360 */
363 361 extern int LINES, COLS;
364 362 extern int COLORS, COLOR_PAIRS;
365 363 extern WINDOW *curscr, *stdscr;
366 364
367 365 #ifndef _XOPEN_SOURCE
368 366 /*
369 367 * Non-portable extension functions.
370 368 */
371 369 extern int wistombs(char *, const wint_t *, int);
372 370 extern int wistowcs(wchar_t *, const wint_t *, int);
373 371 #endif /* _XOPEN_SOURCE */
374 372
375 373 #ifdef M_CURSES_TRACE
376 374 /*
377 375 * Curses trace facility is only available with a version of
378 376 * the library that was compiled with -DM_CURSES_TRACE.
379 377 */
380 378 extern void traceoff(void);
381 379 extern void traceon(void);
382 380 #endif /* M_CURSES_TRACE */
383 381
384 382 extern int addch(chtype);
385 383 extern int addchnstr(const chtype *, int);
386 384 extern int addchstr(const chtype *);
387 385 extern int add_wch(const cchar_t *);
388 386 extern int add_wchnstr(const cchar_t *, int);
389 387 extern int add_wchstr(const cchar_t *);
390 388 extern int mvaddch(int, int, chtype);
391 389 extern int mvaddchnstr(int, int, const chtype *, int);
392 390 extern int mvaddchstr(int, int, const chtype *);
393 391 extern int mvadd_wch(int, int, const cchar_t *);
394 392 extern int mvadd_wchnstr(int, int, const cchar_t *, int);
395 393 extern int mvadd_wchstr(int, int, const cchar_t *);
396 394 extern int mvwaddch(WINDOW *, int, int, chtype);
397 395 extern int mvwaddchnstr(WINDOW *, int, int, const chtype *, int);
398 396 extern int mvwaddchstr(WINDOW *, int, int, const chtype *);
399 397 extern int mvwadd_wch(WINDOW *, int, int, const cchar_t *);
400 398 extern int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int);
401 399 extern int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *);
402 400 extern int waddch(WINDOW *, chtype);
403 401 extern int waddchnstr(WINDOW *, const chtype *, int);
404 402 extern int waddchstr(WINDOW *, const chtype *);
405 403 extern int wadd_wch(WINDOW *, const cchar_t *);
406 404 extern int wadd_wchnstr(WINDOW *, const cchar_t *, int);
407 405 extern int wadd_wchstr(WINDOW *, const cchar_t *);
408 406
409 407 extern int addnstr(const char *, int);
410 408 extern int addstr(const char *);
411 409 extern int addnwstr(const wchar_t *, int);
412 410 extern int addwstr(const wchar_t *);
413 411 extern int mvaddnstr(int, int, const char *, int);
414 412 extern int mvaddstr(int, int, const char *);
415 413 extern int mvaddnwstr(int, int, const wchar_t *, int);
416 414 extern int mvaddwstr(int, int, const wchar_t *);
417 415 extern int mvwaddnstr(WINDOW *, int, int, const char *, int);
418 416 extern int mvwaddstr(WINDOW *, int, int, const char *);
419 417 extern int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);
420 418 extern int mvwaddwstr(WINDOW *, int, int, const wchar_t *);
421 419 extern int waddnstr(WINDOW *, const char *, int);
422 420 extern int waddstr(WINDOW *, const char *);
423 421 extern int waddnwstr(WINDOW *, const wchar_t *, int);
424 422 extern int waddwstr(WINDOW *, const wchar_t *);
425 423
426 424 extern int attroff(int);
427 425 extern int attron(int);
428 426 extern int attrset(int);
429 427 extern int wattroff(WINDOW *, int);
430 428 extern int wattron(WINDOW *, int);
431 429 extern int wattrset(WINDOW *, int);
432 430
433 431 extern int attr_get(attr_t *, short *, void *);
434 432 extern int attr_off(attr_t, void *);
435 433 extern int attr_on(attr_t, void *);
436 434 extern int attr_set(attr_t, short, void *);
437 435 extern int color_set(short, void *);
438 436 extern int wattr_get(WINDOW *, attr_t *, short *, void *);
439 437 extern int wattr_off(WINDOW *, attr_t, void *);
440 438 extern int wattr_on(WINDOW *, attr_t, void *);
441 439 extern int wattr_set(WINDOW *, attr_t, short, void *);
442 440 extern int wcolor_set(WINDOW *, short, void *);
443 441
444 442 extern chtype COLOR_PAIR(short);
445 443 extern short PAIR_NUMBER(chtype);
446 444
447 445 extern int baudrate(void);
448 446
449 447 extern int delay_output(int);
450 448 extern int napms(int);
451 449
452 450 extern int beep(void);
453 451 extern int flash(void);
454 452
455 453 extern int bkgd(chtype);
456 454 extern int bkgdset(chtype);
457 455 extern chtype getbkgd(WINDOW *);
458 456 extern int wbkgd(WINDOW *, chtype);
459 457 extern int wbkgdset(WINDOW *, chtype);
460 458
461 459 extern int bkgrnd(const cchar_t *);
462 460 extern void bkgrndset(const cchar_t *);
463 461 extern int getbkgrnd(cchar_t *);
464 462 extern int wbkgrnd(WINDOW *, const cchar_t *);
465 463 extern void wbkgrndset(WINDOW *, const cchar_t *);
466 464 extern int wgetbkgrnd(WINDOW *, cchar_t *);
467 465
468 466 extern int border(
469 467 chtype, chtype, chtype, chtype,
470 468 chtype, chtype, chtype, chtype);
471 469 extern int border_set(
472 470 const cchar_t *, const cchar_t *,
473 471 const cchar_t *, const cchar_t *,
474 472 const cchar_t *, const cchar_t *,
475 473 const cchar_t *, const cchar_t *);
476 474 extern int box(WINDOW *, chtype, chtype);
477 475 extern int box_set(WINDOW *, const cchar_t *, const cchar_t *);
478 476 extern int wborder(
479 477 WINDOW *,
480 478 chtype, chtype, chtype, chtype,
481 479 chtype, chtype, chtype, chtype);
482 480 extern int wborder_set(
483 481 WINDOW *,
484 482 const cchar_t *, const cchar_t *,
485 483 const cchar_t *, const cchar_t *,
486 484 const cchar_t *, const cchar_t *,
487 485 const cchar_t *, const cchar_t *);
488 486
489 487 extern bool can_change_color(void);
490 488 extern int color_content(short, short *, short *, short *);
491 489 extern bool has_colors(void);
492 490 extern int init_color(short, short, short, short);
493 491 extern int init_pair(short, short, short);
494 492 extern int pair_content(short, short *, short *);
495 493 extern int start_color(void);
496 494
497 495 extern int cbreak(void);
498 496 extern int halfdelay(int);
499 497 extern int nocbreak(void);
500 498 extern int raw(void);
501 499 extern int noraw(void);
502 500
503 501 extern int chgat(int, attr_t, short, const void *);
504 502 extern int mvchgat(int, int, int, attr_t, short, const void *);
505 503 extern int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);
506 504 extern int wchgat(WINDOW *, int, attr_t, short, const void *);
507 505
508 506 extern int clear(void);
509 507 extern int clrtobot(void);
510 508 extern int clrtoeol(void);
511 509 extern int erase(void);
512 510 extern int wclear(WINDOW *);
513 511 extern int wclrtobot(WINDOW *);
514 512 extern int wclrtoeol(WINDOW *);
515 513 extern int werase(WINDOW *);
516 514
517 515 extern int clearok(WINDOW *, bool);
518 516 extern void idcok(WINDOW *, bool);
519 517 extern int idlok(WINDOW *, bool);
520 518 extern void immedok(WINDOW *, bool);
521 519 extern int intrflush(WINDOW *, bool);
522 520 extern int keypad(WINDOW *, bool);
523 521 extern int leaveok(WINDOW *, bool);
524 522 extern int meta(WINDOW *, bool);
525 523 extern int nodelay(WINDOW *, bool);
526 524 extern int notimeout(WINDOW *, bool);
527 525 extern int scrollok(WINDOW *, bool);
528 526 extern int syncok(WINDOW *, bool);
529 527
530 528 extern int copywin(const WINDOW *, WINDOW *, int, int, int, int, int, int, int);
531 529 extern int overlay(const WINDOW *, WINDOW *);
532 530 extern int overwrite(const WINDOW *, WINDOW *);
533 531
534 532 extern int curs_set(int);
535 533
536 534 extern int def_prog_mode(void);
537 535 extern int def_shell_mode(void);
538 536 extern int reset_prog_mode(void);
539 537 extern int reset_shell_mode(void);
540 538
541 539 extern int delch(void);
542 540 extern int mvdelch(int, int);
543 541 extern int mvwdelch(WINDOW *, int, int);
544 542 extern int wdelch(WINDOW *);
545 543
546 544 extern int deleteln(void);
547 545 extern int insdelln(int);
548 546 extern int insertln(void);
549 547 extern int wdeleteln(WINDOW *);
550 548 extern int winsdelln(WINDOW *, int);
551 549 extern int winsertln(WINDOW *);
552 550
553 551 extern void delscreen(SCREEN *);
554 552 extern SCREEN *newterm(char *, FILE *, FILE *);
555 553 extern SCREEN *set_term(SCREEN *);
556 554
557 555 extern int delwin(WINDOW *);
558 556 extern WINDOW *derwin(WINDOW *, int, int, int, int);
559 557 extern WINDOW *dupwin(WINDOW *);
560 558 extern WINDOW *getwin(FILE *);
561 559 extern int mvwin(WINDOW *, int, int);
562 560 extern int mvderwin(WINDOW *, int, int);
563 561 extern WINDOW *newwin(int, int, int, int);
564 562 extern int putwin(WINDOW *, FILE *);
565 563 extern int redrawwin(WINDOW *);
566 564 extern WINDOW *subwin(WINDOW *, int, int, int, int);
567 565 extern int wredrawln(WINDOW *, int, int);
568 566
569 567 extern int doupdate(void);
570 568 extern int refresh(void);
571 569 extern int wnoutrefresh(WINDOW *);
572 570 extern int wrefresh(WINDOW *);
573 571
574 572 extern int echo(void);
575 573 extern int noecho(void);
576 574 extern int echochar(chtype);
577 575 extern int echo_wchar(const cchar_t *);
578 576 extern int wechochar(WINDOW *, chtype);
579 577 extern int wecho_wchar(WINDOW *, const cchar_t *);
580 578
581 579 extern int endwin(void);
582 580 extern void filter(void);
583 581 extern WINDOW *initscr(void);
584 582 extern bool isendwin(void);
585 583 extern int ripoffline(int, int (*)(WINDOW *, int));
586 584 extern int typeahead(int);
587 585 extern void use_env(bool);
588 586
589 587 extern int erasechar(void);
590 588 extern int erasewchar(wchar_t *);
591 589 extern int killchar(void);
592 590 extern int killwchar(wchar_t *);
593 591
594 592 extern int flushinp(void);
595 593
596 594 extern int getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *);
597 595 extern int setcchar(cchar_t *, const wchar_t *, attr_t, short, const void *);
598 596
599 597 extern int getch(void);
600 598 extern int get_wch(wint_t *);
601 599 extern int mvgetch(int, int);
602 600 extern int mvget_wch(int, int, wint_t *);
603 601 extern int mvwgetch(WINDOW *, int, int);
604 602 extern int mvwget_wch(WINDOW *, int, int, wint_t *);
605 603 extern int wgetch(WINDOW *);
606 604 extern int wget_wch(WINDOW *, wint_t *);
607 605
608 606 extern int getnstr(char *, int);
609 607 extern int getstr(char *);
610 608 extern int mvgetnstr(int, int, char *, int);
611 609 extern int mvgetstr(int, int, char *);
612 610 extern int mvwgetnstr(WINDOW *, int, int, char *, int);
613 611 extern int mvwgetstr(WINDOW *, int, int, char *);
614 612 extern int wgetnstr(WINDOW *, char *, int);
615 613 extern int wgetstr(WINDOW *, char *);
616 614
617 615 extern int getn_wstr(wint_t *, int);
618 616 extern int get_wstr(wint_t *);
619 617 extern int mvgetn_wstr(int, int, wint_t *, int);
620 618 extern int mvget_wstr(int, int, wint_t *);
621 619 extern int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int);
622 620 extern int mvwget_wstr(WINDOW *, int, int, wint_t *);
623 621 extern int wgetn_wstr(WINDOW *, wint_t *, int);
624 622 extern int wget_wstr(WINDOW *, wint_t *);
625 623
626 624 extern bool has_ic(void);
627 625 extern bool has_il(void);
628 626
629 627 extern int hline(chtype, int);
630 628 extern int hline_set(const cchar_t *, int);
631 629 extern int vline(chtype, int);
632 630 extern int vline_set(const cchar_t *, int);
633 631 extern int mvhline(int, int, chtype, int);
634 632 extern int mvhline_set(int, int, const cchar_t *, int);
635 633 extern int mvvline(int, int, chtype, int);
636 634 extern int mvvline_set(int, int, const cchar_t *, int);
637 635 extern int mvwhline(WINDOW *, int, int, chtype, int);
638 636 extern int mvwhline_set(WINDOW *, int, int, const cchar_t *, int);
639 637 extern int mvwvline(WINDOW *, int, int, chtype, int);
640 638 extern int mvwvline_set(WINDOW *, int, int, const cchar_t *, int);
641 639 extern int whline(WINDOW *, chtype, int);
642 640 extern int whline_set(WINDOW *, const cchar_t *, int);
643 641 extern int wvline(WINDOW *, chtype, int);
644 642 extern int wvline_set(WINDOW *, const cchar_t *, int);
645 643
646 644 extern chtype inch(void);
647 645 extern int inchnstr(chtype *, int);
648 646 extern int inchstr(chtype *);
649 647 extern int in_wch(cchar_t *);
650 648 extern int in_wchnstr(cchar_t *, int);
651 649 extern int in_wchstr(cchar_t *);
652 650 extern chtype mvinch(int, int);
653 651 extern int mvinchnstr(int, int, chtype *, int);
654 652 extern int mvinchstr(int, int, chtype *);
655 653 extern int mvin_wch(int, int, cchar_t *);
656 654 extern int mvin_wchnstr(int, int, cchar_t *, int);
657 655 extern int mvin_wchstr(int, int, cchar_t *);
658 656 extern chtype mvwinch(WINDOW *, int, int);
659 657 extern int mvwinchnstr(WINDOW *, int, int, chtype *, int);
660 658 extern int mvwinchstr(WINDOW *, int, int, chtype *);
661 659 extern int mvwin_wch(WINDOW *, int, int, cchar_t *);
662 660 extern int mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int);
663 661 extern int mvwin_wchstr(WINDOW *, int, int, cchar_t *);
664 662 extern chtype winch(WINDOW *);
665 663 extern int winchnstr(WINDOW *, chtype *, int);
666 664 extern int winchstr(WINDOW *, chtype *);
667 665 extern int win_wch(WINDOW *, cchar_t *);
668 666 extern int win_wchnstr(WINDOW *, cchar_t *, int);
669 667 extern int win_wchstr(WINDOW *, cchar_t *);
670 668
671 669 extern int innstr(char *, int);
672 670 extern int instr(char *);
673 671 extern int innwstr(wchar_t *, int);
674 672 extern int inwstr(wchar_t *);
675 673 extern int mvinnstr(int, int, char *, int);
676 674 extern int mvinstr(int, int, char *);
677 675 extern int mvinnwstr(int, int, wchar_t *, int);
678 676 extern int mvinwstr(int, int, wchar_t *);
679 677 extern int mvwinnstr(WINDOW *, int, int, char *, int);
680 678 extern int mvwinstr(WINDOW *, int, int, char *);
681 679 extern int mvwinnwstr(WINDOW *, int, int, wchar_t *, int);
682 680 extern int mvwinwstr(WINDOW *, int, int, wchar_t *);
683 681 extern int winnstr(WINDOW *, char *, int);
684 682 extern int winstr(WINDOW *, char *);
685 683 extern int winnwstr(WINDOW *, wchar_t *, int);
686 684 extern int winwstr(WINDOW *, wchar_t *);
687 685
688 686 extern int insch(chtype);
689 687 extern int ins_wch(const cchar_t *);
690 688 extern int mvinsch(int, int, chtype);
691 689 extern int mvins_wch(int, int, const cchar_t *);
692 690 extern int mvwinsch(WINDOW *, int, int, chtype);
693 691 extern int mvwins_wch(WINDOW *, int, int, const cchar_t *);
694 692 extern int winsch(WINDOW *, chtype);
695 693 extern int wins_wch(WINDOW *, const cchar_t *);
696 694
697 695 extern int insnstr(const char *, int);
698 696 extern int insstr(const char *);
699 697 extern int ins_nwstr(const wchar_t *, int);
700 698 extern int ins_wstr(const wchar_t *);
701 699 extern int mvinsnstr(int, int, const char *, int);
702 700 extern int mvinsstr(int, int, const char *);
703 701 extern int mvins_nwstr(int, int, const wchar_t *, int);
704 702 extern int mvins_wstr(int, int, const wchar_t *);
705 703 extern int mvwinsnstr(WINDOW *, int, int, const char *, int);
706 704 extern int mvwinsstr(WINDOW *, int, int, const char *);
707 705 extern int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int);
708 706 extern int mvwins_wstr(WINDOW *, int, int, const wchar_t *);
709 707 extern int winsnstr(WINDOW *, const char *, int);
710 708 extern int winsstr(WINDOW *, const char *);
711 709 extern int wins_nwstr(WINDOW *, const wchar_t *, int);
712 710 extern int wins_wstr(WINDOW *, const wchar_t *);
713 711
714 712 extern bool is_linetouched(WINDOW *, int);
715 713 extern bool is_wintouched(WINDOW *);
716 714 extern int touchline(WINDOW *, int, int);
717 715 extern int touchwin(WINDOW *);
718 716 extern int wtouchln(WINDOW *, int, int, int);
719 717 extern int untouchwin(WINDOW *);
720 718
721 719 extern const char *keyname(int);
722 720 extern const char *key_name(wchar_t);
723 721
724 722 extern char *longname(void);
725 723 extern char *termname(void);
726 724
727 725 extern int move(int, int);
728 726 extern int wmove(WINDOW *, int, int);
729 727
730 728 extern int mvcur(int, int, int, int);
731 729
732 730 extern WINDOW *newpad(int, int);
733 731 extern int pechochar(WINDOW *, chtype);
734 732 extern int pecho_wchar(WINDOW *, const cchar_t *);
735 733 extern int pnoutrefresh(WINDOW *, int, int, int, int, int, int);
736 734 extern int prefresh(WINDOW *, int, int, int, int, int, int);
737 735 extern WINDOW *subpad(WINDOW *, int, int, int, int);
738 736
739 737 extern int nl(void);
740 738 extern int nonl(void);
741 739
742 740 extern int printw(const char *, ...);
743 741 extern int mvprintw(int, int, const char *, ...);
744 742 extern int mvwprintw(WINDOW *, int, int, const char *, ...);
745 743 #if defined(sun)
746 744 extern int vwprintw(WINDOW *, const char *, __va_list);
747 745 extern int vw_printw(WINDOW *, const char *, __va_list);
748 746 #else
749 747 extern int vwprintw(WINDOW *, const char *, void *);
750 748 extern int vw_printw(WINDOW *, const char *, void *);
751 749 #endif
752 750 extern int wprintw(WINDOW *, const char *, ...);
753 751
754 752 extern void qiflush(void);
755 753 extern void noqiflush(void);
756 754
757 755 extern int resetty(void);
758 756 extern int savetty(void);
759 757
760 758 extern int scanw(const char *, ...);
761 759 extern int mvscanw(int, int, const char *, ...);
762 760 extern int mvwscanw(WINDOW *, int, int, const char *, ...);
763 761 #if defined(sun)
764 762 extern int vwscanw(WINDOW *, const char *, __va_list);
765 763 extern int vw_scanw(WINDOW *, const char *, __va_list);
766 764 #else
767 765 extern int vwscanw(WINDOW *, const char *, void *);
768 766 extern int vw_scanw(WINDOW *, const char *, void *);
769 767 #endif
770 768 extern int wscanw(WINDOW *, const char *, ...);
771 769
772 770 extern int scr_dump(const char *);
773 771 extern int scr_init(const char *);
774 772 extern int scr_restore(const char *);
775 773 extern int scr_set(const char *);
776 774
777 775 extern int scrl(int);
778 776 extern int scroll(WINDOW *);
779 777 extern int setscrreg(int, int);
780 778 extern int wscrl(WINDOW *, int);
781 779 extern int wsetscrreg(WINDOW *, int, int);
782 780
783 781 extern int slk_attroff(const chtype);
784 782 extern int slk_attron(const chtype);
785 783 extern int slk_attrset(const chtype);
786 784 extern int slk_attr_off(const attr_t, void *);
787 785 extern int slk_attr_on(const attr_t, void *);
788 786 extern int slk_attr_set(const attr_t, short, void *);
789 787 extern int slk_color_set(short);
790 788 extern int slk_clear(void);
791 789 extern int slk_init(int);
792 790 extern char *slk_label(int);
793 791 extern int slk_noutrefresh(void);
794 792 extern int slk_refresh(void);
795 793 extern int slk_restore(void);
796 794 extern int slk_set(int, const char *, int);
797 795 extern int slk_touch(void);
798 796 extern int slk_wset(int, const wchar_t *, int);
799 797
800 798 extern int standend(void);
801 799 extern int wstandend(WINDOW *);
802 800 extern int standout(void);
803 801 extern int wstandout(WINDOW *);
804 802
805 803 extern chtype termattrs(void);
806 804 extern attr_t term_attrs(void);
807 805
808 806 extern void timeout(int);
809 807 extern void wtimeout(WINDOW *, int);
810 808
811 809 extern int ungetch(int);
812 810 extern int unget_wch(const wchar_t);
813 811
814 812 extern int vidattr(chtype);
815 813 extern int vid_attr(attr_t, short, void *);
816 814 extern int vidputs(chtype, int (*)(int));
817 815 extern int vid_puts(attr_t, short, void *, int (*)(int));
818 816
819 817 extern void wcursyncup(WINDOW *);
820 818 extern void wsyncdown(WINDOW *);
821 819 extern void wsyncup(WINDOW *);
822 820
823 821 extern const wchar_t *wunctrl(const cchar_t *);
824 822
825 823 /*
826 824 * These macros are not suitable for strict XPG4 conformance,
827 825 * because some of them evaluate their arguments more than once.
828 826 * However, they can improve speed and size of an application,
829 827 * provided an application is careful about not using side effects
830 828 * with function/macro parameters.
831 829 */
832 830 #ifndef _XOPEN_SOURCE_EXTENDED
833 831
834 832 #define addch(ch) waddch(stdscr,ch)
835 833 #define mvaddch(y,x,ch) (move(y,x)?ERR:addch(ch))
836 834 #define mvwaddch(w,y,x,ch) (wmove(w,y,x)?ERR:waddch(w,ch))
837 835
838 836 #define add_wch(cp) wadd_wch(stdscr,cp)
839 837 #define mvadd_wch(y,x,cp) (move(y,x)?ERR:add_wch(cp))
840 838 #define mvwadd_wch(w,y,x,cp) (wmove(w,y,x)?ERR:wadd_wch(w,cp))
841 839
842 840 #define addchnstr(chs,n) waddchnstr(stdscr,chs,n)
843 841 #define addchstr(chs) waddchstr(stdscr,chs)
844 842 #define mvaddchnstr(y,x,chs,n) (move(y,x)?ERR:addchnstr(chs,n))
845 843 #define mvaddchstr(y,x,chs) (move(y,x)?ERR:addchstr(chs))
846 844 #define mvwaddchnstr(w,y,x,chs,n) (wmove(w,y,x)?ERR:waddchnstr(w,chs,n))
847 845 #define mvwaddchstr(w,y,x,chs) (wmove(w,y,x)?ERR:waddchstr(w,chs))
848 846 #define waddchstr(w,chs) waddchnstr(w,chs,-1)
849 847
850 848 #define add_wchnstr(cp,n) wadd_wchnstr(stdscr,cp,n)
851 849 #define add_wchstr(cp) wadd_wchstr(stdscr,cp)
852 850 #define mvadd_wchnstr(y,x,cp,n) (move(y,x)?ERR:add_wchnstr(cp,n))
853 851 #define mvadd_wchstr(y,x,cp) (move(y,x)?ERR:add_wchstr(cp))
854 852 #define mvwadd_wchnstr(w,y,x,cp,n) (wmove(w,y,x)?ERR:wadd_wchnstr(w,cp,n))
855 853 #define mvwadd_wchstr(w,y,x,cp) (wmove(w,y,x)?ERR:wadd_wchstr(w,cp))
856 854 #define wadd_wchstr(w,cp) wadd_wchnstr(w,cp,-1)
857 855
858 856 #define addnstr(s,n) waddnstr(stdscr,s,n)
859 857 #define addstr(s) waddstr(stdscr,s)
860 858 #define mvaddnstr(y,x,s,n) (move(y,x)?ERR:addnstr(s,n))
861 859 #define mvaddstr(y,x,s) (move(y,x)?ERR:addstr(s))
862 860 #define mvwaddnstr(w,y,x,s,n) (wmove(w,y,x)?ERR:waddnstr(w,s,n))
863 861 #define mvwaddstr(w,y,x,s) (wmove(w,y,x)?ERR:waddstr(w,s))
864 862 #define waddstr(w,wcs) waddnstr(w,wcs,-1)
865 863
866 864 #define addnwstr(wcs,n) waddnwstr(stdscr,wcs,n)
867 865 #define addwstr(wcs) waddwstr(stdscr,wcs)
868 866 #define mvaddnwstr(y,x,wcs,n) (move(y,x)?ERR:addnwstr(wcs,n))
869 867 #define mvaddwstr(y,x,wcs) (move(y,x)?ERR:addwstr(wcs))
870 868 #define mvwaddnwstr(w,y,x,wcs,n) (wmove(w,y,x)?ERR:waddnwstr(w,wcs,n))
871 869 #define mvwaddwstr(w,y,x,wcs) (wmove(w,y,x)?ERR:waddwstr(w,wcs))
872 870 #define waddwstr(w,wcs) waddnwstr(w,wcs,-1)
873 871
874 872 #define attr_get(a,c,o) wattr_get(stdscr,a,c,o)
875 873 #define attr_off(a,o) wattr_off(stdscr,a,o)
876 874 #define attr_on(a,o) wattr_on(stdscr,a,o)
877 875 #define attr_set(a,c,o) wattr_set(stdscr,a,c,o)
878 876
879 877 #define COLOR_PAIR(n) ((chtype)(n)<<__COLOR_SHIFT)
880 878 #define PAIR_NUMBER(a) (((chtype)(a)&A_COLOR)>>__COLOR_SHIFT)
881 879
882 880 #define bkgd(ch) wbkgd(stdscr, ch)
883 881 #define bkgdset(ch) __m_chtype_cc(ch, &stdscr->_bg)
884 882 #define getbkgd(w) __m_cc_chtype(&(w)->_bg)
885 883 #define wbkgdset(w,ch) __m_chtype_cc(ch, &(w)->_bg)
886 884
887 885 #define bkgrnd(b) wbkgrnd(stdscr,b)
888 886 #define bkgrndset(b) wbkgrndset(stdscr,b)
889 887 #define getbkgrnd(b) wgetbkgrnd(stdscr,b)
890 888 #define wbkgrndset(w,b) ((w)->_bg = *(b))
891 889 #define wgetbkgrnd(w,b) (*(b) = (w)->_bg, OK)
892 890
893 891 #define border(ls, rs, ts, bs, tl, tr, bl, br) \
894 892 wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
895 893 #define border_set(ls, rs, ts, bs, tl, tr, bl, br) \
896 894 wborder_set(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
897 895 #define box(w,v,h) wborder(w,v,v,h,h,0,0,0,0)
898 896 #define box_set(w,v,h) wborder_set(w,v,v,h,h,0,0,0,0)
899 897
900 898 #define can_change_color() (2 < max_colors && can_change \
901 899 && initialize_color != (char *) 0)
902 900 #define has_colors() (0 < max_colors)
903 901
904 902 #define chgat(n,a,co,p) wchgat(stdscr,n,a,co,p)
905 903 #define mvchgat(y,x,n,a,co,p) (move(y,x)?ERR:chgat(n,a,co,p))
906 904 #define mvwchgat(w,y,x,n,a,co,p) (wmove(w,y,x)?ERR:wchgat(w,n,a,co,p))
907 905
908 906 #define clear() wclear(stdscr)
909 907 #define clrtobot() wclrtobot(stdscr)
910 908 #define clrtoeol() wclrtoeol(stdscr)
911 909 #define erase() werase(stdscr)
912 910 #define wclear(w) (clearok(w,1)?ERR:werase(w))
913 911 #define werase(w) (wmove(w,0,0)?ERR:wclrtobot(w))
914 912
915 913 #define delch() wdelch(stdscr)
916 914 #define mvdelch(y,x) (move(y,x)?ERR:delch())
917 915 #define mvwdelch(w,y,x) (wmove(w,y,x)?ERR:wdelch(w))
918 916
919 917 #define deleteln() wdeleteln(stdscr)
920 918 #define insdelln(n) winsdelln(stdscr,n)
921 919 #define insertln() winsertln(stdscr)
922 920 #define wdeleteln(w) winsdelln(w, -1)
923 921 #define winsertln(w) winsdelln(w, 1)
924 922
925 923 #define refresh() wrefresh(stdscr)
926 924
927 925 #define echochar(ch) wechochar(stdscr,ch)
928 926 #define echo_wchar(cp) wecho_wchar(stdscr,cp)
929 927 #define wechochar(w,ch) (waddch(w,ch)?ERR:wrefresh(w))
930 928 #define wecho_wchar(w,cp) (wadd_wch(w,cp)?ERR:wrefresh(w))
931 929
932 930 #define erasewchar(wp) __m_tty_wc(VERASE, wp)
933 931 #define killwchar(wp) __m_tty_wc(VKILL, wp)
934 932
935 933 #define getch() wgetch(stdscr)
936 934 #define mvgetch(y,x) (move(y,x)?ERR:getch())
937 935 #define mvwgetch(w,y,x) (wmove(w,y,x)?ERR:wgetch(w))
938 936
939 937 #define get_wch(wcp) wget_wch(stdscr,wcp)
940 938 #define mvget_wch(y,x,wcp) (move(y,x)?ERR:get_wch(wcp))
941 939 #define mvwget_wch(w,y,x,wcp) (wmove(w,y,x)?ERR:wget_wch(w,wcp))
942 940
943 941 #define getnstr(s,n) wgetnstr(stdscr,s,n)
944 942 #define getstr(s) wgetstr(stdscr,s)
945 943 #define mvgetnstr(y,x,s,n) (move(y,x)?ERR:getnstr(s,n))
946 944 #define mvgetstr(y,x,s) (move(y,x)?ERR:getstr(s))
947 945 #define mvwgetnstr(w,y,x,s,n) (wmove(w,y,x)?ERR:wgetnstr(w,s,n))
948 946 #define mvwgetstr(w,y,x,s) (wmove(w,y,x)?ERR:wgetstr(w,s))
949 947 #define wgetstr(w,s) wgetnstr(w,s,-1)
950 948
951 949 #define getn_wstr(wcs,n) wgetn_wstr(stdscr,wcs,n)
952 950 #define get_wstr(wcs) wget_wstr(stdscr,wcs)
953 951 #define mvgetn_wstr(y,x,wcs,n) (move(y,x)?ERR:getn_wstr(wcs,n))
954 952 #define mvget_wstr(y,x,wcs) (move(y,x)?ERR:get_wstr(wcs))
955 953 #define mvwgetn_wstr(w,y,x,wcs,n) (wmove(w,y,x)?ERR:wgetn_wstr(w,wcs,n))
956 954 #define mvwget_wstr(w,y,x,wcs) (wmove(w,y,x)?ERR:wget_wstr(w,wcs))
957 955 #define wget_wstr(w,wcs) wgetn_wstr(w,wcs,-1)
958 956
959 957 #define has_ic() (((insert_character != (char *) 0 \
960 958 || parm_ich != (char *) 0) \
961 959 && (delete_character != (char *) 0 \
962 960 || parm_dch != (char *) 0)) \
963 961 || (enter_insert_mode != (char *) 0 \
964 962 && exit_insert_mode))
965 963
966 964 #define has_il() (((insert_line != (char *) 0 \
967 965 || parm_insert_line != (char *) 0) \
968 966 && (delete_line != (char *) 0 \
969 967 || parm_delete_line !=(char*)0)) \
970 968 || change_scroll_region != (char *) 0)
971 969
972 970
973 971 #define hline(ch,n) whline(stdscr,ch,n)
974 972 #define vline(ch,n) wvline(stdscr,ch,n)
975 973 #define mvhline(y,x,ch,n) (move(y,x)?ERR:hline(ch,n))
976 974 #define mvvline(y,x,ch,n) (move(y,x)?ERR:vline(ch,n))
977 975 #define mvwhline(w,y,x,ch,n) (wmove(w,y,x)?ERR:whline(w,ch,n))
978 976 #define mvwvline(w,y,x,ch,n) (wmove(w,y,x)?ERR:wvline(w,ch,n))
979 977
980 978 #define hline_set(cp,n) whline_set(stdscr,cp,n)
981 979 #define vline_set(cp,n) wvline_set(stdscr,cp,n)
982 980 #define mvhline_set(y,x,cp,n) (move(y,x)?ERR:hline_set(cp,n))
983 981 #define mvvline_set(y,x,cp,n) (move(y,x)?ERR:vline_set(cp,n))
984 982 #define mvwhline_set(w,y,x,cp,n) (wmove(w,y,x)?ERR:whline_set(w,cp,n))
985 983 #define mvwvline_set(w,y,x,cp,n) (wmove(w,y,x)?ERR:wvline_set(w,cp,n))
986 984
987 985 #define inch() winch(stdscr)
988 986 #define mvinch(y,x) (move(y,x)?ERR:inch())
989 987 #define mvwinch(w,y,x) (wmove(w,y,x)?ERR:winch(w))
990 988
991 989 #define in_wch(cp) win_wch(stdscr,cp)
992 990 #define mvin_wch(y,x,cp) (move(y,x)?ERR:in_wch(cp))
993 991 #define mvwin_wch(w,y,x,cp) (wmove(w,y,x)?ERR:win_wch(w,cp))
994 992
995 993 #define inchnstr(chs,n) winchnstr(stdscr,chs,n)
996 994 #define inchstr(chs) winchstr(stdscr,chs)
997 995 #define mvinchnstr(y,x,chs,n) (move(y,x)?ERR:inchnstr(chs,n))
998 996 #define mvinchstr(y,x,chs) (move(y,x)?ERR:inchstr(chs))
999 997 #define mvwinchnstr(w,y,x,chs,n) (wmove(w,y,x)?ERR:winchnstr(w,chs,n))
1000 998 #define mvwinchstr(w,y,x,chs) (wmove(w,y,x)?ERR:winchstr(w,chs))
1001 999 #define winchstr(w,chs) winchnstr(w,chs,-1)
1002 1000
1003 1001 #define in_wchnstr(cp,n) win_wchnstr(stdscr,cp,n)
1004 1002 #define in_wchstr(cp) win_wchstr(stdscr,cp)
1005 1003 #define mvin_wchnstr(y,x,cp,n) (move(y,x)?ERR:in_wchnstr(cp,n))
1006 1004 #define mvin_wchstr(y,x,cp) (move(y,x)?ERR:in_wchstr(cp))
1007 1005 #define mvwin_wchnstr(w,y,x,cp,n) (wmove(w,y,x)?ERR:win_wchnstr(w,cp,n))
1008 1006 #define mvwin_wchstr(w,y,x,cp) (wmove(w,y,x)?ERR:win_wchstr(w,cp))
1009 1007 #define win_wchstr(w,cp) win_wchnstr(w,cp,-1)
1010 1008
1011 1009 #define innstr(s,n) winnstr(stdscr,s,n)
1012 1010 #define instr(s) winstr(stdscr,s)
1013 1011 #define mvinnstr(y,x,s,n) (move(y,x)?ERR:innstr(s,n))
1014 1012 #define mvinstr(y,x,s) (move(y,x)?ERR:instr(s))
1015 1013 #define mvwinnstr(w,y,x,s,n) (wmove(w,y,x)?ERR:winnstr(w,s,n))
1016 1014 #define mvwinstr(w,y,x,s) (wmove(w,y,x)?ERR:winstr(w,s))
1017 1015 #define winstr(w,s) winnstr(w,s,-1)
1018 1016
1019 1017 #define innwstr(wcs,n) winnwstr(stdscr,wcs,n)
1020 1018 #define inwstr(wcs) winwstr(stdscr,wcs)
1021 1019 #define mvinnwstr(y,x,wcs,n) (move(y,x)?ERR:innwstr(wcs,n))
1022 1020 #define mvinwstr(y,x,wcs) (move(y,x)?ERR:inwstr(wcs))
1023 1021 #define mvwinnwstr(w,y,x,wcs,n) (wmove(w,y,x)?ERR:winnwstr(w,wcs,n))
1024 1022 #define mvwinwstr(w,y,x,wcs) (wmove(w,y,x)?ERR:winwstr(w,wcs))
1025 1023 #define winwstr(w,wcs) winnwstr(w,wcs,-1)
1026 1024
1027 1025 #define insch(ch) winsch(stdscr,ch)
1028 1026 #define mvinsch(y,x,ch) (move(y,x)?ERR:insch(ch))
1029 1027 #define mvwinsch(w,y,x,ch) (wmove(w,y,x)?ERR:winsch(w,ch))
1030 1028
1031 1029 #define ins_wch(cp) wins_wch(stdscr,cp)
1032 1030 #define mvins_wch(y,x,cp) (move(y,x)?ERR:ins_wch(cp))
1033 1031 #define mvwins_wch(w,y,x,cp) (wmove(w,y,x)?ERR:wins_wch(w,cp))
1034 1032
1035 1033 #define insnstr(s,n) winsnstr(stdscr,s,n)
1036 1034 #define insstr(s) winsstr(stdscr,s)
1037 1035 #define mvinsnstr(y,x,s,n) (move(y,x)?ERR:insnstr(s,n))
1038 1036 #define mvinsstr(y,x,s) (move(y,x)?ERR:insstr(s))
1039 1037 #define mvwinsnstr(w, y, x, s, n) (wmove(w, y, x)?ERR:winsnstr(w, s, n))
1040 1038 #define mvwinsstr(w, y, x, s) (wmove(w, y, x)?ERR:winsstr(w, s))
1041 1039 #define winsstr(w, s) winsnstr(w, s, -1)
1042 1040
1043 1041 #define ins_nwstr(wcs, n) wins_nwstr(stdscr, wcs, n)
1044 1042 #define ins_wstr(wcs) wins_wstr(stdscr, wcs)
1045 1043 #define mvins_nwstr(y, x, wcs, n) (move(y, x)?ERR:ins_nwstr(wcs, n))
1046 1044 #define mvins_wstr(y, x, wcs) (move(y, x)?ERR:ins_wstr(wcs))
1047 1045 #define mvwins_nwstr(w, y, x, wcs, n) (wmove(w, y, x)?ERR:wins_nwstr(w,wcs,n))
1048 1046 #define mvwins_wstr(w, y, x, wcs) (wmove(w, y, x)?ERR:wins_wstr(w,wcs))
1049 1047 #define wins_wstr(w, wcs) wins_nwstr(w, wcs, -1)
1050 1048
1051 1049 #define is_linetouched(w, y) (0 <= (w)->_last[y])
1052 1050
1053 1051 #define mvcur(or, oc, nr, nc) __m_mvcur(or, oc, nr, nc, __m_outc)
1054 1052
1055 1053 #define move(y, x) wmove(stdscr, y, x)
1056 1054
1057 1055 #define overlay(s, t) __m_copywin(s, t, 1)
1058 1056 #define overwrite(s, t) __m_copywin(s, t, 0)
1059 1057
1060 1058 #define newpad(ny, nx) __m_newwin((WINDOW *) 0, ny, nx, -1, -1)
1061 1059 #define subpad(par, ny, nx, by, bx) subwin(par, ny, nx, by, bx)
1062 1060
1063 1061 #define nodelay(w, bf) (wtimeout(w, (bf)?0:-1), OK)
1064 1062 #define timeout(n) wtimeout(stdscr, n)
1065 1063
1066 1064 #define qiflush() ((void) intrflush((WINDOW *) 0, 1))
1067 1065 #define noqiflush() ((void) intrflush((WINDOW *) 0, 0))
1068 1066
1069 1067 #define redrawwin(w) wredrawln(w, 0, (w)->_maxy)
1070 1068
1071 1069 #define scrl(n) wscrl(stdscr, n)
1072 1070 #define setscrreg(t, b) wsetscrreg(stdscr, t, b)
1073 1071
1074 1072 #define standend() wstandend(stdscr)
1075 1073 #define standout() wstandout(stdscr)
1076 1074 #define wstandend(w) (wattr_set(w, WA_NORMAL, COLOR_BLACK, \
1077 1075 (void *)0), 1)
1078 1076 #define wstandout(w) (wattr_on(w, WA_STANDOUT, (void *)0), 1)
1079 1077
1080 1078 #define touchline(w, y, n) wtouchln(w, y, n, 1)
1081 1079 #define touchwin(w) wtouchln(w, 0, (w)->_maxy, 1)
1082 1080 #define untouchwin(w) wtouchln(w, 0, (w)->_maxy, 0)
1083 1081
1084 1082 #define termname() (cur_term->_term)
1085 1083
1086 1084 #ifndef _XOPEN_SOURCE
1087 1085 /*
1088 1086 * Obsolete functions names.
1089 1087 */
1090 1088 #define crmode cbreak
1091 1089 #define nocrmode nocbreak
1092 1090 #define saveterm def_prog_mode
1093 1091 #define fixterm reset_prog_mode
1094 1092 #define resetterm reset_shell_mode
1095 1093 #endif /* _XOPEN_SOURCE */
1096 1094 #endif /* _XOPEN_SOURCE_EXTENDED */
1097 1095
1098 1096 /*
1099 1097 * Special Keys
1100 1098 *
1101 1099 * Keypad layout
1102 1100 * A1 up A3
1103 1101 * left B2 right
1104 1102 * C1 down C3
1105 1103 *
1106 1104 * Chossing negative values for KEY_ constants means that they can
1107 1105 * be safely returned in either an int or long type.
1108 1106 */
1109 1107 #define __KEY_BASE (-2)
1110 1108 #define __KEY_MAX __KEY_BASE
1111 1109
1112 1110 #define KEY_CODE_YES (__KEY_BASE-1) /* Special indicator. */
1113 1111
1114 1112 #define KEY_BREAK (__KEY_BASE-2) /* Break key (unreliable) */
1115 1113 #define KEY_DOWN (__KEY_BASE-3) /* The four arrow keys ... */
1116 1114 #define KEY_UP (__KEY_BASE-4)
1117 1115 #define KEY_LEFT (__KEY_BASE-5)
1118 1116 #define KEY_RIGHT (__KEY_BASE-6)
1119 1117 #define KEY_HOME (__KEY_BASE-7) /* Move to upper-left corner. */
1120 1118 #define KEY_BACKSPACE (__KEY_BASE-8) /* Backspace */
1121 1119 #define KEY_F0 (__KEY_BASE-9) /* Function keys. Space for */
1122 1120 #define KEY_F(n) (KEY_F0-(n)) /* 64 keys is reserved. */
1123 1121 #define KEY_DL (__KEY_BASE-73) /* Delete line */
1124 1122 #define KEY_IL (__KEY_BASE-74) /* Insert line */
1125 1123 #define KEY_DC (__KEY_BASE-75) /* Delete character */
1126 1124 #define KEY_IC (__KEY_BASE-76) /* Ins char / enter ins mode */
1127 1125 #define KEY_EIC (__KEY_BASE-77) /* Exit insert char mode */
1128 1126 #define KEY_CLEAR (__KEY_BASE-78) /* Clear screen */
1129 1127 #define KEY_EOS (__KEY_BASE-79) /* Clear to end of screen */
1130 1128 #define KEY_EOL (__KEY_BASE-80) /* Clear to end of line */
1131 1129 #define KEY_SF (__KEY_BASE-81) /* Scroll 1 line forward */
1132 1130 #define KEY_SR (__KEY_BASE-82) /* Scroll 1 line backwards */
1133 1131 #define KEY_NPAGE (__KEY_BASE-83) /* Next page */
1134 1132 #define KEY_PPAGE (__KEY_BASE-84) /* Previous page */
1135 1133 #define KEY_STAB (__KEY_BASE-85) /* Set tab */
1136 1134 #define KEY_CTAB (__KEY_BASE-86) /* Clear tab */
1137 1135 #define KEY_CATAB (__KEY_BASE-87) /* Clear all tabs */
1138 1136 #define KEY_ENTER (__KEY_BASE-88) /* Enter or send */
1139 1137 #define KEY_SRESET (__KEY_BASE-89) /* Soft (partial) reset */
1140 1138 #define KEY_RESET (__KEY_BASE-90) /* Hard reset */
1141 1139 #define KEY_PRINT (__KEY_BASE-91) /* Print or copy */
1142 1140 #define KEY_LL (__KEY_BASE-92) /* Move to lower left corner. */
1143 1141 #define KEY_A1 (__KEY_BASE-93) /* Upper left of keypad */
1144 1142 #define KEY_A3 (__KEY_BASE-94) /* Upper rght of keypad */
1145 1143 #define KEY_B2 (__KEY_BASE-95) /* Center of keypad */
1146 1144 #define KEY_C1 (__KEY_BASE-96) /* Lower left of keypad */
1147 1145 #define KEY_C3 (__KEY_BASE-97) /* Lower right of keypad */
1148 1146 #define KEY_BTAB (__KEY_BASE-98) /* Back Tab */
1149 1147 #define KEY_BEG (__KEY_BASE-99) /* Beginning */
1150 1148 #define KEY_CANCEL (__KEY_BASE-100)
1151 1149 #define KEY_CLOSE (__KEY_BASE-101)
1152 1150 #define KEY_COMMAND (__KEY_BASE-102)
1153 1151 #define KEY_COPY (__KEY_BASE-103)
1154 1152 #define KEY_CREATE (__KEY_BASE-104)
1155 1153 #define KEY_END (__KEY_BASE-105)
1156 1154 #define KEY_EXIT (__KEY_BASE-106)
1157 1155 #define KEY_FIND (__KEY_BASE-107)
1158 1156 #define KEY_HELP (__KEY_BASE-108)
1159 1157 #define KEY_MARK (__KEY_BASE-109)
1160 1158 #define KEY_MESSAGE (__KEY_BASE-110)
1161 1159 #define KEY_MOUSE (__KEY_BASE-111) /* Mouse event occured */
1162 1160 #define KEY_MOVE (__KEY_BASE-112)
1163 1161 #define KEY_NEXT (__KEY_BASE-113) /* Next object */
1164 1162 #define KEY_OPEN (__KEY_BASE-114)
1165 1163 #define KEY_OPTIONS (__KEY_BASE-115)
1166 1164 #define KEY_PREVIOUS (__KEY_BASE-116) /* Previous object */
1167 1165 #define KEY_REDO (__KEY_BASE-117)
1168 1166 #define KEY_REFERENCE (__KEY_BASE-118)
1169 1167 #define KEY_REFRESH (__KEY_BASE-119)
1170 1168 #define KEY_REPLACE (__KEY_BASE-120)
1171 1169 #define KEY_RESTART (__KEY_BASE-121)
1172 1170 #define KEY_RESUME (__KEY_BASE-122)
1173 1171 #define KEY_SAVE (__KEY_BASE-123)
1174 1172 #define KEY_SBEG (__KEY_BASE-124) /* Shifted keys */
1175 1173 #define KEY_SCANCEL (__KEY_BASE-125)
1176 1174 #define KEY_SCOMMAND (__KEY_BASE-126)
1177 1175 #define KEY_SCOPY (__KEY_BASE-127)
1178 1176 #define KEY_SCREATE (__KEY_BASE-128)
1179 1177 #define KEY_SDC (__KEY_BASE-129)
1180 1178 #define KEY_SDL (__KEY_BASE-130)
1181 1179 #define KEY_SELECT (__KEY_BASE-131) /* Select */
1182 1180 #define KEY_SEND (__KEY_BASE-132) /* Shifted end key */
1183 1181 #define KEY_SEOL (__KEY_BASE-133)
1184 1182 #define KEY_SEXIT (__KEY_BASE-134)
1185 1183 #define KEY_SFIND (__KEY_BASE-135)
1186 1184 #define KEY_SHELP (__KEY_BASE-136)
1187 1185 #define KEY_SHOME (__KEY_BASE-137)
1188 1186 #define KEY_SIC (__KEY_BASE-138)
1189 1187 #define KEY_SLEFT (__KEY_BASE-139)
1190 1188 #define KEY_SMESSAGE (__KEY_BASE-140)
1191 1189 #define KEY_SMOVE (__KEY_BASE-141)
1192 1190 #define KEY_SNEXT (__KEY_BASE-142)
1193 1191 #define KEY_SOPTIONS (__KEY_BASE-143)
1194 1192 #define KEY_SPREVIOUS (__KEY_BASE-144)
1195 1193 #define KEY_SPRINT (__KEY_BASE-145)
1196 1194 #define KEY_SREDO (__KEY_BASE-146)
1197 1195 #define KEY_SREPLACE (__KEY_BASE-147)
1198 1196 #define KEY_SRIGHT (__KEY_BASE-148)
1199 1197 #define KEY_SRSUME (__KEY_BASE-149)
1200 1198 #define KEY_SSAVE (__KEY_BASE-150)
1201 1199 #define KEY_SSUSPEND (__KEY_BASE-151)
1202 1200 #define KEY_SUNDO (__KEY_BASE-152)
1203 1201 #define KEY_SUSPEND (__KEY_BASE-153)
1204 1202 #define KEY_UNDO (__KEY_BASE-154)
1205 1203
1206 1204 #define __KEY_MIN (__KEY_BASE-155)
1207 1205
1208 1206 #endif /* __M_CURSES_H__ */
↓ open down ↓ |
1131 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX