| 1 | /****************************************************************************
|
|---|
| 2 | * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
|
|---|
| 3 | * *
|
|---|
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a *
|
|---|
| 5 | * copy of this software and associated documentation files (the *
|
|---|
| 6 | * "Software"), to deal in the Software without restriction, including *
|
|---|
| 7 | * without limitation the rights to use, copy, modify, merge, publish, *
|
|---|
| 8 | * distribute, distribute with modifications, sublicense, and/or sell *
|
|---|
| 9 | * copies of the Software, and to permit persons to whom the Software is *
|
|---|
| 10 | * furnished to do so, subject to the following conditions: *
|
|---|
| 11 | * *
|
|---|
| 12 | * The above copyright notice and this permission notice shall be included *
|
|---|
| 13 | * in all copies or substantial portions of the Software. *
|
|---|
| 14 | * *
|
|---|
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
|---|
| 16 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
|---|
| 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
|---|
| 18 | * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
|---|
| 19 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
|---|
| 20 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
|---|
| 21 | * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
|---|
| 22 | * *
|
|---|
| 23 | * Except as contained in this notice, the name(s) of the above copyright *
|
|---|
| 24 | * holders shall not be used in advertising or otherwise to promote the *
|
|---|
| 25 | * sale, use or other dealings in this Software without prior written *
|
|---|
| 26 | * authorization. *
|
|---|
| 27 | ****************************************************************************/
|
|---|
| 28 |
|
|---|
| 29 | /****************************************************************************
|
|---|
| 30 | * Author: Zeyd M. Ben-Halim <[email protected]> 1992,1995 *
|
|---|
| 31 | * and: Eric S. Raymond <[email protected]> *
|
|---|
| 32 | * and: Thomas E. Dickey 1996-on *
|
|---|
| 33 | ****************************************************************************/
|
|---|
| 34 |
|
|---|
| 35 | /* $Id: curses.h.in,v 1.157 2005/07/02 16:58:28 tom Exp $ */
|
|---|
| 36 |
|
|---|
| 37 | #ifndef __NCURSES_H
|
|---|
| 38 | #define __NCURSES_H
|
|---|
| 39 |
|
|---|
| 40 | #define CURSES 1
|
|---|
| 41 | #define CURSES_H 1
|
|---|
| 42 |
|
|---|
| 43 | /* This should be defined for the enhanced functionality to be visible.
|
|---|
| 44 | * However, some of the wide-character (enhanced) functionality is missing.
|
|---|
| 45 | * So we do not define it (yet).
|
|---|
| 46 | #define _XOPEN_CURSES 1
|
|---|
| 47 | */
|
|---|
| 48 |
|
|---|
| 49 | /* These are defined only in curses.h, and are used for conditional compiles */
|
|---|
| 50 | #define NCURSES_VERSION_MAJOR @NCURSES_MAJOR@
|
|---|
| 51 | #define NCURSES_VERSION_MINOR @NCURSES_MINOR@
|
|---|
| 52 | #define NCURSES_VERSION_PATCH @NCURSES_PATCH@
|
|---|
| 53 |
|
|---|
| 54 | /* This is defined in more than one ncurses header, for identification */
|
|---|
| 55 | #undef NCURSES_VERSION
|
|---|
| 56 | #define NCURSES_VERSION "@NCURSES_MAJOR@.@NCURSES_MINOR@"
|
|---|
| 57 |
|
|---|
| 58 | /*
|
|---|
| 59 | * Identify the mouse encoding version.
|
|---|
| 60 | */
|
|---|
| 61 | #define NCURSES_MOUSE_VERSION @NCURSES_MOUSE_VERSION@
|
|---|
| 62 |
|
|---|
| 63 | /*
|
|---|
| 64 | * Definitions to facilitate DLL's.
|
|---|
| 65 | */
|
|---|
| 66 | #include <ncurses_dll.h>
|
|---|
| 67 |
|
|---|
| 68 | /*
|
|---|
| 69 | * User-definable tweak to disable the include of <stdbool.h>.
|
|---|
| 70 | */
|
|---|
| 71 | #ifndef NCURSES_ENABLE_STDBOOL_H
|
|---|
| 72 | #define NCURSES_ENABLE_STDBOOL_H @cf_cv_header_stdbool_h@
|
|---|
| 73 | #endif
|
|---|
| 74 |
|
|---|
| 75 | /*
|
|---|
| 76 | * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses
|
|---|
| 77 | * configured using --disable-macros.
|
|---|
| 78 | */
|
|---|
| 79 | #ifdef NCURSES_NOMACROS
|
|---|
| 80 | #define NCURSES_ATTR_T attr_t
|
|---|
| 81 | #endif
|
|---|
| 82 |
|
|---|
| 83 | #ifndef NCURSES_ATTR_T
|
|---|
| 84 | #define NCURSES_ATTR_T int
|
|---|
| 85 | #endif
|
|---|
| 86 |
|
|---|
| 87 | /*
|
|---|
| 88 | * Expands to 'const' if ncurses is configured using --enable-const. Note that
|
|---|
| 89 | * doing so makes it incompatible with other implementations of X/Open Curses.
|
|---|
| 90 | */
|
|---|
| 91 | #undef NCURSES_CONST
|
|---|
| 92 | #define NCURSES_CONST @NCURSES_CONST@
|
|---|
| 93 |
|
|---|
| 94 | /*
|
|---|
| 95 | * The internal type used for color values
|
|---|
| 96 | */
|
|---|
| 97 | #undef NCURSES_COLOR_T
|
|---|
| 98 | #define NCURSES_COLOR_T short
|
|---|
| 99 |
|
|---|
| 100 | /*
|
|---|
| 101 | * The internal type used for window dimensions.
|
|---|
| 102 | */
|
|---|
| 103 | #undef NCURSES_SIZE_T
|
|---|
| 104 | #define NCURSES_SIZE_T short
|
|---|
| 105 |
|
|---|
| 106 | /*
|
|---|
| 107 | * NCURSES_CH_T is used in building the library, but not used otherwise in
|
|---|
| 108 | * this header file, since that would make the normal/wide-character versions
|
|---|
| 109 | * of the header incompatible.
|
|---|
| 110 | */
|
|---|
| 111 | #undef NCURSES_CH_T
|
|---|
| 112 | #define NCURSES_CH_T @NCURSES_CH_T@
|
|---|
| 113 |
|
|---|
| 114 | #if @cf_cv_enable_lp64@ && defined(_LP64)
|
|---|
| 115 | typedef unsigned chtype;
|
|---|
| 116 | typedef unsigned mmask_t;
|
|---|
| 117 | #else
|
|---|
| 118 | typedef unsigned @cf_cv_typeof_chtype@ chtype;
|
|---|
| 119 | typedef unsigned @cf_cv_typeof_mmask_t@ mmask_t;
|
|---|
| 120 | #endif
|
|---|
| 121 |
|
|---|
| 122 | #include <stdio.h>
|
|---|
| 123 | #include <unctrl.h>
|
|---|
| 124 | #include <stdarg.h> /* we need va_list */
|
|---|
| 125 | #ifdef _XOPEN_SOURCE_EXTENDED
|
|---|
| 126 | #include <stddef.h> /* we want wchar_t */
|
|---|
| 127 | #endif /* _XOPEN_SOURCE_EXTENDED */
|
|---|
| 128 |
|
|---|
| 129 | /* XSI and SVr4 specify that curses implements 'bool'. However, C++ may also
|
|---|
| 130 | * implement it. If so, we must use the C++ compiler's type to avoid conflict
|
|---|
| 131 | * with other interfaces.
|
|---|
| 132 | *
|
|---|
| 133 | * A further complication is that <stdbool.h> may declare 'bool' to be a
|
|---|
| 134 | * different type, such as an enum which is not necessarily compatible with
|
|---|
| 135 | * C++. If we have <stdbool.h>, make 'bool' a macro, so users may #undef it.
|
|---|
| 136 | * Otherwise, let it remain a typedef to avoid conflicts with other #define's.
|
|---|
| 137 | * In either case, make a typedef for NCURSES_BOOL which can be used if needed
|
|---|
| 138 | * from either C or C++.
|
|---|
| 139 | */
|
|---|
| 140 |
|
|---|
| 141 | #undef TRUE
|
|---|
| 142 | #define TRUE 1
|
|---|
| 143 |
|
|---|
| 144 | #undef FALSE
|
|---|
| 145 | #define FALSE 0
|
|---|
| 146 |
|
|---|
| 147 | typedef @cf_cv_type_of_bool@ NCURSES_BOOL;
|
|---|
| 148 |
|
|---|
| 149 | #if @USE_CXX_BOOL@ /* __cplusplus, etc. */
|
|---|
| 150 |
|
|---|
| 151 | /* use the C++ compiler's bool type */
|
|---|
| 152 | #define NCURSES_BOOL bool
|
|---|
| 153 |
|
|---|
| 154 | #else /* c89, c99, etc. */
|
|---|
| 155 |
|
|---|
| 156 | #if NCURSES_ENABLE_STDBOOL_H
|
|---|
| 157 | #include <stdbool.h>
|
|---|
| 158 | /* use whatever the C compiler decides bool really is */
|
|---|
| 159 | #define NCURSES_BOOL bool
|
|---|
| 160 | #else
|
|---|
| 161 | /* there is no predefined bool - use our own */
|
|---|
| 162 | #undef bool
|
|---|
| 163 | #define bool NCURSES_BOOL
|
|---|
| 164 | #endif
|
|---|
| 165 |
|
|---|
| 166 | #endif /* !__cplusplus, etc. */
|
|---|
| 167 |
|
|---|
| 168 | #ifdef __cplusplus
|
|---|
| 169 | extern "C" {
|
|---|
| 170 | #define NCURSES_CAST(type,value) static_cast<type>(value)
|
|---|
| 171 | #else
|
|---|
| 172 | #define NCURSES_CAST(type,value) (type)(value)
|
|---|
| 173 | #endif
|
|---|
| 174 |
|
|---|
| 175 | /*
|
|---|
| 176 | * XSI attributes. In the ncurses implementation, they are identical to the
|
|---|
| 177 | * A_ attributes.
|
|---|
| 178 | */
|
|---|
| 179 | #define WA_ATTRIBUTES A_ATTRIBUTES
|
|---|
| 180 | #define WA_NORMAL A_NORMAL
|
|---|
| 181 | #define WA_STANDOUT A_STANDOUT
|
|---|
| 182 | #define WA_UNDERLINE A_UNDERLINE
|
|---|
| 183 | #define WA_REVERSE A_REVERSE
|
|---|
| 184 | #define WA_BLINK A_BLINK
|
|---|
| 185 | #define WA_DIM A_DIM
|
|---|
| 186 | #define WA_BOLD A_BOLD
|
|---|
| 187 | #define WA_ALTCHARSET A_ALTCHARSET
|
|---|
| 188 | #define WA_INVIS A_INVIS
|
|---|
| 189 | #define WA_PROTECT A_PROTECT
|
|---|
| 190 | #define WA_HORIZONTAL A_HORIZONTAL
|
|---|
| 191 | #define WA_LEFT A_LEFT
|
|---|
| 192 | #define WA_LOW A_LOW
|
|---|
| 193 | #define WA_RIGHT A_RIGHT
|
|---|
| 194 | #define WA_TOP A_TOP
|
|---|
| 195 | #define WA_VERTICAL A_VERTICAL
|
|---|
| 196 |
|
|---|
| 197 | /* colors */
|
|---|
| 198 | extern NCURSES_EXPORT_VAR(int) COLORS;
|
|---|
| 199 | extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS;
|
|---|
| 200 |
|
|---|
| 201 | #define COLOR_BLACK 0
|
|---|
| 202 | #define COLOR_RED 1
|
|---|
| 203 | #define COLOR_GREEN 2
|
|---|
| 204 | #define COLOR_YELLOW 3
|
|---|
| 205 | #define COLOR_BLUE 4
|
|---|
| 206 | #define COLOR_MAGENTA 5
|
|---|
| 207 | #define COLOR_CYAN 6
|
|---|
| 208 | #define COLOR_WHITE 7
|
|---|
| 209 |
|
|---|
| 210 | /* line graphics */
|
|---|
| 211 |
|
|---|
| 212 | #if @BROKEN_LINKER@
|
|---|
| 213 | extern NCURSES_EXPORT_VAR(chtype*) _nc_acs_map(void);
|
|---|
| 214 | #define acs_map (_nc_acs_map())
|
|---|
| 215 | #else
|
|---|
| 216 | extern NCURSES_EXPORT_VAR(chtype) acs_map[];
|
|---|
| 217 | #endif
|
|---|
| 218 |
|
|---|
| 219 | #define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char,c)])
|
|---|
| 220 |
|
|---|
| 221 | /* VT100 symbols begin here */
|
|---|
| 222 | #define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */
|
|---|
| 223 | #define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */
|
|---|
| 224 | #define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */
|
|---|
| 225 | #define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */
|
|---|
| 226 | #define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */
|
|---|
| 227 | #define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */
|
|---|
| 228 | #define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */
|
|---|
| 229 | #define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */
|
|---|
| 230 | #define ACS_HLINE NCURSES_ACS('q') /* horizontal line */
|
|---|
| 231 | #define ACS_VLINE NCURSES_ACS('x') /* vertical line */
|
|---|
| 232 | #define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */
|
|---|
| 233 | #define ACS_S1 NCURSES_ACS('o') /* scan line 1 */
|
|---|
| 234 | #define ACS_S9 NCURSES_ACS('s') /* scan line 9 */
|
|---|
| 235 | #define ACS_DIAMOND NCURSES_ACS('`') /* diamond */
|
|---|
| 236 | #define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */
|
|---|
| 237 | #define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */
|
|---|
| 238 | #define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */
|
|---|
| 239 | #define ACS_BULLET NCURSES_ACS('~') /* bullet */
|
|---|
| 240 | /* Teletype 5410v1 symbols begin here */
|
|---|
| 241 | #define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */
|
|---|
| 242 | #define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */
|
|---|
| 243 | #define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */
|
|---|
| 244 | #define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */
|
|---|
| 245 | #define ACS_BOARD NCURSES_ACS('h') /* board of squares */
|
|---|
| 246 | #define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */
|
|---|
| 247 | #define ACS_BLOCK NCURSES_ACS('0') /* solid square block */
|
|---|
| 248 | /*
|
|---|
| 249 | * These aren't documented, but a lot of System Vs have them anyway
|
|---|
| 250 | * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
|
|---|
| 251 | * The ACS_names may not match AT&T's, our source didn't know them.
|
|---|
| 252 | */
|
|---|
| 253 | #define ACS_S3 NCURSES_ACS('p') /* scan line 3 */
|
|---|
| 254 | #define ACS_S7 NCURSES_ACS('r') /* scan line 7 */
|
|---|
| 255 | #define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */
|
|---|
| 256 | #define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */
|
|---|
| 257 | #define ACS_PI NCURSES_ACS('{') /* Pi */
|
|---|
| 258 | #define ACS_NEQUAL NCURSES_ACS('|') /* not equal */
|
|---|
| 259 | #define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */
|
|---|
| 260 |
|
|---|
| 261 | /*
|
|---|
| 262 | * Line drawing ACS names are of the form ACS_trbl, where t is the top, r
|
|---|
| 263 | * is the right, b is the bottom, and l is the left. t, r, b, and l might
|
|---|
| 264 | * be B (blank), S (single), D (double), or T (thick). The subset defined
|
|---|
| 265 | * here only uses B and S.
|
|---|
| 266 | */
|
|---|
| 267 | #define ACS_BSSB ACS_ULCORNER
|
|---|
| 268 | #define ACS_SSBB ACS_LLCORNER
|
|---|
| 269 | #define ACS_BBSS ACS_URCORNER
|
|---|
| 270 | #define ACS_SBBS ACS_LRCORNER
|
|---|
| 271 | #define ACS_SBSS ACS_RTEE
|
|---|
| 272 | #define ACS_SSSB ACS_LTEE
|
|---|
| 273 | #define ACS_SSBS ACS_BTEE
|
|---|
| 274 | #define ACS_BSSS ACS_TTEE
|
|---|
| 275 | #define ACS_BSBS ACS_HLINE
|
|---|
| 276 | #define ACS_SBSB ACS_VLINE
|
|---|
| 277 | #define ACS_SSSS ACS_PLUS
|
|---|
| 278 |
|
|---|
| 279 | #undef ERR
|
|---|
| 280 | #define ERR (-1)
|
|---|
| 281 |
|
|---|
| 282 | #undef OK
|
|---|
| 283 | #define OK (0)
|
|---|
| 284 |
|
|---|
| 285 | /* values for the _flags member */
|
|---|
| 286 | #define _SUBWIN 0x01 /* is this a sub-window? */
|
|---|
| 287 | #define _ENDLINE 0x02 /* is the window flush right? */
|
|---|
| 288 | #define _FULLWIN 0x04 /* is the window full-screen? */
|
|---|
| 289 | #define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */
|
|---|
| 290 | #define _ISPAD 0x10 /* is this window a pad? */
|
|---|
| 291 | #define _HASMOVED 0x20 /* has cursor moved since last refresh? */
|
|---|
| 292 | #define _WRAPPED 0x40 /* cursor was just wrappped */
|
|---|
| 293 |
|
|---|
| 294 | /*
|
|---|
| 295 | * this value is used in the firstchar and lastchar fields to mark
|
|---|
| 296 | * unchanged lines
|
|---|
| 297 | */
|
|---|
| 298 | #define _NOCHANGE -1
|
|---|
| 299 |
|
|---|
| 300 | /*
|
|---|
| 301 | * this value is used in the oldindex field to mark lines created by insertions
|
|---|
| 302 | * and scrolls.
|
|---|
| 303 | */
|
|---|
| 304 | #define _NEWINDEX -1
|
|---|
| 305 |
|
|---|
| 306 | typedef struct screen SCREEN;
|
|---|
| 307 | typedef struct _win_st WINDOW;
|
|---|
| 308 |
|
|---|
| 309 | typedef chtype attr_t; /* ...must be at least as wide as chtype */
|
|---|
| 310 |
|
|---|
| 311 | #ifdef _XOPEN_SOURCE_EXTENDED
|
|---|
| 312 |
|
|---|
| 313 | #if @NCURSES_LIBUTF8@
|
|---|
| 314 | #ifdef mblen /* libutf8.h defines it w/o undefining first */
|
|---|
| 315 | #undef mblen
|
|---|
| 316 | #endif
|
|---|
| 317 | #include <libutf8.h>
|
|---|
| 318 | #endif
|
|---|
| 319 |
|
|---|
| 320 | #if @NEED_WCHAR_H@
|
|---|
| 321 | #include <wchar.h> /* ...to get mbstate_t, etc. */
|
|---|
| 322 | #endif
|
|---|
| 323 |
|
|---|
| 324 | #if @NCURSES_WCHAR_T@
|
|---|
| 325 | typedef unsigned short wchar_t@NCURSES_OK_WCHAR_T@;
|
|---|
| 326 | #endif
|
|---|
| 327 |
|
|---|
| 328 | #if @NCURSES_WINT_T@
|
|---|
| 329 | typedef unsigned int wint_t@NCURSES_OK_WCHAR_T@;
|
|---|
| 330 | #endif
|
|---|
| 331 |
|
|---|
| 332 | #define CCHARW_MAX 5
|
|---|
| 333 | typedef struct
|
|---|
| 334 | {
|
|---|
| 335 | attr_t attr;
|
|---|
| 336 | wchar_t chars[CCHARW_MAX];
|
|---|
| 337 | #if @NCURSES_EXT_COLORS@
|
|---|
| 338 | int ext_color; /* color pair, must be more than 16-bits */
|
|---|
| 339 | #endif
|
|---|
| 340 | }
|
|---|
| 341 | cchar_t;
|
|---|
| 342 |
|
|---|
| 343 | #endif /* _XOPEN_SOURCE_EXTENDED */
|
|---|
| 344 |
|
|---|
| 345 | struct ldat;
|
|---|
| 346 |
|
|---|
| 347 | struct _win_st
|
|---|
| 348 | {
|
|---|
| 349 | NCURSES_SIZE_T _cury, _curx; /* current cursor position */
|
|---|
| 350 |
|
|---|
| 351 | /* window location and size */
|
|---|
| 352 | NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */
|
|---|
| 353 | NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */
|
|---|
| 354 |
|
|---|
| 355 | short _flags; /* window state flags */
|
|---|
| 356 |
|
|---|
| 357 | /* attribute tracking */
|
|---|
| 358 | attr_t _attrs; /* current attribute for non-space character */
|
|---|
| 359 | chtype _bkgd; /* current background char/attribute pair */
|
|---|
| 360 |
|
|---|
| 361 | /* option values set by user */
|
|---|
| 362 | bool _notimeout; /* no time out on function-key entry? */
|
|---|
| 363 | bool _clear; /* consider all data in the window invalid? */
|
|---|
| 364 | bool _leaveok; /* OK to not reset cursor on exit? */
|
|---|
| 365 | bool _scroll; /* OK to scroll this window? */
|
|---|
| 366 | bool _idlok; /* OK to use insert/delete line? */
|
|---|
| 367 | bool _idcok; /* OK to use insert/delete char? */
|
|---|
| 368 | bool _immed; /* window in immed mode? (not yet used) */
|
|---|
| 369 | bool _sync; /* window in sync mode? */
|
|---|
| 370 | bool _use_keypad; /* process function keys into KEY_ symbols? */
|
|---|
| 371 | int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */
|
|---|
| 372 |
|
|---|
| 373 | struct ldat *_line; /* the actual line data */
|
|---|
| 374 |
|
|---|
| 375 | /* global screen state */
|
|---|
| 376 | NCURSES_SIZE_T _regtop; /* top line of scrolling region */
|
|---|
| 377 | NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */
|
|---|
| 378 |
|
|---|
| 379 | /* these are used only if this is a sub-window */
|
|---|
| 380 | int _parx; /* x coordinate of this window in parent */
|
|---|
| 381 | int _pary; /* y coordinate of this window in parent */
|
|---|
| 382 | WINDOW *_parent; /* pointer to parent if a sub-window */
|
|---|
| 383 |
|
|---|
| 384 | /* these are used only if this is a pad */
|
|---|
| 385 | struct pdat
|
|---|
| 386 | {
|
|---|
| 387 | NCURSES_SIZE_T _pad_y, _pad_x;
|
|---|
| 388 | NCURSES_SIZE_T _pad_top, _pad_left;
|
|---|
| 389 | NCURSES_SIZE_T _pad_bottom, _pad_right;
|
|---|
| 390 | } _pad;
|
|---|
| 391 |
|
|---|
| 392 | NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */
|
|---|
| 393 |
|
|---|
| 394 | #ifdef _XOPEN_SOURCE_EXTENDED
|
|---|
| 395 | cchar_t _bkgrnd; /* current background char/attribute pair */
|
|---|
| 396 | #if @NCURSES_EXT_COLORS@
|
|---|
| 397 | int _color; /* current color-pair for non-space character */
|
|---|
| 398 | #endif
|
|---|
| 399 | #endif
|
|---|
| 400 | };
|
|---|
| 401 |
|
|---|
| 402 | extern NCURSES_EXPORT_VAR(WINDOW *) stdscr;
|
|---|
| 403 | extern NCURSES_EXPORT_VAR(WINDOW *) curscr;
|
|---|
| 404 | extern NCURSES_EXPORT_VAR(WINDOW *) newscr;
|
|---|
| 405 |
|
|---|
| 406 | extern NCURSES_EXPORT_VAR(int) LINES;
|
|---|
| 407 | extern NCURSES_EXPORT_VAR(int) COLS;
|
|---|
| 408 | extern NCURSES_EXPORT_VAR(int) TABSIZE;
|
|---|
| 409 |
|
|---|
| 410 | /*
|
|---|
| 411 | * This global was an undocumented feature under AIX curses.
|
|---|
| 412 | */
|
|---|
| 413 | extern NCURSES_EXPORT_VAR(int) ESCDELAY; /* ESC expire time in milliseconds */
|
|---|
| 414 |
|
|---|
| 415 | extern NCURSES_EXPORT_VAR(char) ttytype[]; /* needed for backward compatibility */
|
|---|
| 416 |
|
|---|
| 417 | /*
|
|---|
| 418 | * These functions are extensions - not in XSI Curses.
|
|---|
| 419 | */
|
|---|
| 420 | #if @NCURSES_EXT_FUNCS@
|
|---|
| 421 | extern NCURSES_EXPORT(bool) is_term_resized (int, int);
|
|---|
| 422 | extern NCURSES_EXPORT(char *) keybound (int, int);
|
|---|
| 423 | extern NCURSES_EXPORT(const char *) curses_version (void);
|
|---|
| 424 | extern NCURSES_EXPORT(int) assume_default_colors (int, int);
|
|---|
| 425 | extern NCURSES_EXPORT(int) define_key (const char *, int);
|
|---|
| 426 | extern NCURSES_EXPORT(int) key_defined (const char *);
|
|---|
| 427 | extern NCURSES_EXPORT(int) keyok (int, bool);
|
|---|
| 428 | extern NCURSES_EXPORT(int) resize_term (int, int);
|
|---|
| 429 | extern NCURSES_EXPORT(int) resizeterm (int, int);
|
|---|
| 430 | extern NCURSES_EXPORT(int) use_default_colors (void);
|
|---|
| 431 | extern NCURSES_EXPORT(int) use_extended_names (bool);
|
|---|
| 432 | extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);
|
|---|
| 433 | #else
|
|---|
| 434 | #define curses_version() NCURSES_VERSION
|
|---|
| 435 | #endif
|
|---|
| 436 |
|
|---|
| 437 | /*
|
|---|
| 438 | * This is an extension to support events...
|
|---|
| 439 | */
|
|---|
| 440 | #if @NCURSES_EXT_FUNCS@
|
|---|
| 441 | #ifdef NCURSES_WGETCH_EVENTS
|
|---|
| 442 | #if !defined(__BEOS__) /* Fix _nc_timed_wait() on BEOS... */
|
|---|
| 443 | # define NCURSES_EVENT_VERSION 1
|
|---|
| 444 | #endif /* !defined(__BEOS__) */
|
|---|
| 445 |
|
|---|
| 446 | /*
|
|---|
| 447 | * Bits to set in _nc_event.data.flags
|
|---|
| 448 | */
|
|---|
| 449 | # define _NC_EVENT_TIMEOUT_MSEC 1
|
|---|
| 450 | # define _NC_EVENT_FILE 2
|
|---|
| 451 | # define _NC_EVENT_FILE_READABLE 2
|
|---|
| 452 | # if 0 /* Not supported yet... */
|
|---|
| 453 | # define _NC_EVENT_FILE_WRITABLE 4
|
|---|
| 454 | # define _NC_EVENT_FILE_EXCEPTION 8
|
|---|
| 455 | # endif
|
|---|
| 456 |
|
|---|
| 457 | typedef struct
|
|---|
| 458 | {
|
|---|
| 459 | int type;
|
|---|
| 460 | union
|
|---|
| 461 | {
|
|---|
| 462 | long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */
|
|---|
| 463 | struct
|
|---|
| 464 | {
|
|---|
| 465 | unsigned int flags;
|
|---|
| 466 | int fd;
|
|---|
| 467 | unsigned int result;
|
|---|
| 468 | } fev; /* _NC_EVENT_FILE */
|
|---|
| 469 | } data;
|
|---|
| 470 | } _nc_event;
|
|---|
| 471 |
|
|---|
| 472 | typedef struct
|
|---|
| 473 | {
|
|---|
| 474 | int count;
|
|---|
| 475 | int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */
|
|---|
| 476 | _nc_event *events[1];
|
|---|
| 477 | } _nc_eventlist;
|
|---|
| 478 |
|
|---|
| 479 | extern NCURSES_EXPORT(int) wgetch_events(WINDOW *, _nc_eventlist *); /* experimental */
|
|---|
| 480 | extern NCURSES_EXPORT(int) wgetnstr_events(WINDOW *,char *,int,_nc_eventlist *);/* experimental */
|
|---|
| 481 |
|
|---|
| 482 | #endif /* NCURSES_WGETCH_EVENTS */
|
|---|
| 483 | #endif /* NCURSES_EXT_FUNCS */
|
|---|
| 484 |
|
|---|
| 485 | /*
|
|---|
| 486 | * GCC (and some other compilers) define '__attribute__'; we're using this
|
|---|
| 487 | * macro to alert the compiler to flag inconsistencies in printf/scanf-like
|
|---|
| 488 | * function calls. Just in case '__attribute__' isn't defined, make a dummy.
|
|---|
| 489 | * Old versions of G++ do not accept it anyway, at least not consistently with
|
|---|
| 490 | * GCC.
|
|---|
| 491 | */
|
|---|
| 492 | #if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__))
|
|---|
| 493 | #define __attribute__(p) /* nothing */
|
|---|
| 494 | #endif
|
|---|
| 495 |
|
|---|
| 496 | /*
|
|---|
| 497 | * We cannot define these in ncurses_cfg.h, since they require parameters to be
|
|---|
| 498 | * passed (that's non-portable).
|
|---|
| 499 | */
|
|---|
| 500 | #ifndef GCC_PRINTFLIKE
|
|---|
| 501 | #if defined(GCC_PRINTF) && !defined(printf)
|
|---|
| 502 | #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
|
|---|
| 503 | #else
|
|---|
| 504 | #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
|
|---|
| 505 | #endif
|
|---|
| 506 | #endif
|
|---|
| 507 |
|
|---|
| 508 | #ifndef GCC_SCANFLIKE
|
|---|
| 509 | #if defined(GCC_SCANF) && !defined(scanf)
|
|---|
| 510 | #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
|
|---|
| 511 | #else
|
|---|
| 512 | #define GCC_SCANFLIKE(fmt,var) /*nothing*/
|
|---|
| 513 | #endif
|
|---|
| 514 | #endif
|
|---|
| 515 |
|
|---|
| 516 | #ifndef GCC_NORETURN
|
|---|
| 517 | #define GCC_NORETURN /* nothing */
|
|---|
| 518 | #endif
|
|---|
| 519 |
|
|---|
| 520 | #ifndef GCC_UNUSED
|
|---|
| 521 | #define GCC_UNUSED /* nothing */
|
|---|
| 522 | #endif
|
|---|
| 523 |
|
|---|
| 524 | /*
|
|---|
| 525 | * Function prototypes. This is the complete XSI Curses list of required
|
|---|
| 526 | * functions. Those marked `generated' will have sources generated from the
|
|---|
| 527 | * macro definitions later in this file, in order to satisfy XPG4.2
|
|---|
| 528 | * requirements.
|
|---|
| 529 | */
|
|---|
| 530 |
|
|---|
| 531 | extern NCURSES_EXPORT(int) addch (const chtype); /* generated */
|
|---|
| 532 | extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */
|
|---|
| 533 | extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */
|
|---|
| 534 | extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */
|
|---|
| 535 | extern NCURSES_EXPORT(int) addstr (const char *); /* generated */
|
|---|
| 536 | extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */
|
|---|
| 537 | extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */
|
|---|
| 538 | extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */
|
|---|
| 539 | extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *); /* generated */
|
|---|
| 540 | extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */
|
|---|
| 541 | extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */
|
|---|
| 542 | extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *); /* generated */
|
|---|
| 543 | extern NCURSES_EXPORT(int) baudrate (void); /* implemented */
|
|---|
| 544 | extern NCURSES_EXPORT(int) beep (void); /* implemented */
|
|---|
| 545 | extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */
|
|---|
| 546 | extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */
|
|---|
| 547 | extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */
|
|---|
| 548 | extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */
|
|---|
| 549 | extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */
|
|---|
| 550 | extern NCURSES_EXPORT(int) cbreak (void); /* implemented */
|
|---|
| 551 | extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *); /* generated */
|
|---|
| 552 | extern NCURSES_EXPORT(int) clear (void); /* generated */
|
|---|
| 553 | extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */
|
|---|
| 554 | extern NCURSES_EXPORT(int) clrtobot (void); /* generated */
|
|---|
| 555 | extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */
|
|---|
| 556 | extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*); /* implemented */
|
|---|
| 557 | extern NCURSES_EXPORT(int) color_set (short,void*); /* generated */
|
|---|
| 558 | extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */
|
|---|
| 559 | extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */
|
|---|
| 560 | extern NCURSES_EXPORT(int) curs_set (int); /* implemented */
|
|---|
| 561 | extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */
|
|---|
| 562 | extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */
|
|---|
| 563 | extern NCURSES_EXPORT(int) delay_output (int); /* implemented */
|
|---|
| 564 | extern NCURSES_EXPORT(int) delch (void); /* generated */
|
|---|
| 565 | extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */
|
|---|
| 566 | extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */
|
|---|
| 567 | extern NCURSES_EXPORT(int) deleteln (void); /* generated */
|
|---|
| 568 | extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */
|
|---|
| 569 | extern NCURSES_EXPORT(int) doupdate (void); /* implemented */
|
|---|
| 570 | extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */
|
|---|
| 571 | extern NCURSES_EXPORT(int) echo (void); /* implemented */
|
|---|
| 572 | extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */
|
|---|
| 573 | extern NCURSES_EXPORT(int) erase (void); /* generated */
|
|---|
| 574 | extern NCURSES_EXPORT(int) endwin (void); /* implemented */
|
|---|
| 575 | extern NCURSES_EXPORT(char) erasechar (void); /* implemented */
|
|---|
| 576 | extern NCURSES_EXPORT(void) filter (void); /* implemented */
|
|---|
|
|---|