1 .\"***************************************************************************
2 .\" Copyright 2018-2023,2024 Thomas E. Dickey *
3 .\" Copyright 2010-2015,2017 Free Software Foundation, Inc. *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a *
6 .\" copy of this software and associated documentation files (the *
7 .\" "Software"), to deal in the Software without restriction, including *
8 .\" without limitation the rights to use, copy, modify, merge, publish, *
9 .\" distribute, distribute with modifications, sublicense, and/or sell *
10 .\" copies of the Software, and to permit persons to whom the Software is *
11 .\" furnished to do so, subject to the following conditions: *
13 .\" The above copyright notice and this permission notice shall be included *
14 .\" in all copies or substantial portions of the Software. *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 .\" Except as contained in this notice, the name(s) of the above copyright *
25 .\" holders shall not be used in advertising or otherwise to promote the *
26 .\" sale, use or other dealings in this Software without prior written *
28 .\"***************************************************************************
30 .\" $Id: curs_variables.3x,v 1.49 2024/06/22 21:25:23 tom Exp $
31 .TH curs_variables 3X 2024-06-22 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
71 \fIcurses\fR data types, constants, and global variables
74 \fB#include <curses.h>
77 \fBtypedef \fI/*\fP .\|.\|. \fI*/\fP bool;
78 \fBtypedef \fI/*\fP .\|.\|. \fI*/\fP chtype;
79 \fBtypedef \fI/*\fP .\|.\|. \fI*/\fP cchar_t;
80 \fBtypedef \fI/*\fP .\|.\|. \fI*/\fP attr_t;
81 \fBtypedef \fI/*\fP .\|.\|. \fI*/\fP SCREEN;
82 \fBtypedef \fI/*\fP .\|.\|. \fI*/\fP WINDOW;
88 \fBconst \fI/*\fP .\|.\|. \fI*/\fP ERR;
89 \fBconst \fI/*\fP .\|.\|. \fI*/\fP OK;
105 This page summarizes data types,
107 and variables provided by the \fIcurses\fP library.
108 Locate further discussion in \fB\%curses\fP(3X).
110 Depending on \fI\%ncurses\fP's build-time configuration,
111 the variables may instead be
112 macros (see \fB\%curs_threads\fP(3X) and \fB\%curs_opaque\fP(3X))
113 that provide read-only access to the library's state.
115 applications should treat them as read-only to avoid
116 confusing the library.
119 The \fIcurses\fP library defines \fBTRUE\fP and \fBFALSE\fP
120 to represent the values of the Boolean data type.
122 \fIcurses\fP and \fIterminfo\fP routines frequently return these
123 constant integral values indicating failure and success,
125 .SH "PREDEFINED TYPES"
127 X/Open Issue 4 \fIcurses\fP (1996) preceded the ISO C99 and ISO C++98
129 each of which also defined a Boolean data type.
130 The \fIcurses\fP library requires an integral type \fIbool\fP.
132 \fB\%ncurses\fP' configure script attempts to discover the
133 data type used by the system's C and C++ compilers,
134 to reuse for the \fIcurses\fP \fIbool\fP.
136 The \fI\%chtype\fP integral type combines a
139 character with attributes encoding the character's \fIrendition\fP,
140 such as the styling of its typeface and/or foreground and background
148 .SS "\fIcchar_t\fP, \fIattr_t\fP"
149 \fI\%chtype\fP is too small for the standard C library's wide-character
152 \fI\%cchar_t\fP is a type that can accommodate an \fI\%attr_t\fP and
153 enough wide characters to store what Unicode terms a \fIgrapheme cluster\fP
154 (a \*(``user-perceived character\*('' [UAX #29],
155 which may nevertheless require several character encoding units to
157 \fI\%attr_t\fP is an integral type storing \*(``wide\*('' attributes that
158 apply to \fI\%cchar_t\fPs.
167 manages a terminal device with this structure type;
168 see \fB\%initscr\fP(3X).
171 represents rectangular portions of the terminal screen with the
174 see subsection \*(``Overview\*('' of \fB\%ncurses\fP(3X).
176 .SS "curscr, stdscr, newscr"
177 The library records updates to the terminal screen in a window named
179 This object is referred to as the \*(``physical screen\*('' in
180 \fB\%curs_refresh\fP(3X) and
181 \fB\%curs_outopts\fP(3X).
183 \fI\%ncurses\fP collects pending updates to the terminal screen in a
184 window named \fB\%newscr\fP.
185 This object is referred to as the \*(``virtual screen\*('' in the
186 \fB\%curs_kernel\fP(3X),
187 \fB\%curs_refresh\fP(3X),
189 \fB\%curs_outopts\fP(3X).
190 When the screen is refreshed,
191 \fIcurses\fP determines a minimal set of updates using the terminal's
192 capabilities to make \fB\%curscr\fP look like \fB\%newscr\fP.
194 Once \fIcurses\fP is initialized,
195 it creates a window named \fB\%stdscr\fP.
196 It is the same size as the terminal screen and is the default window
197 used by routines that do not take a parameter identifying one.
198 Many \fIcurses\fP functions use this window.
200 Once \fIcurses\fP is initialized,
202 contains the number of colors supported by the terminal;
203 see \fB\%curs_color\fP(3X).
205 Once \fIcurses\fP is initialized,
207 contains the number of color pairs supported by the terminal;
208 see \fB\%curs_color\fP(3X).
210 Once \fIcurses\fP is initialized,
214 contain the screen's width and height in character cells,
217 the number of columns and lines.
221 to distinguish the ESC character resulting from a user's press of the
222 \*(``Escape\*('' key on the input device from one beginning an
224 (as commonly produced by function keys),
225 it waits after the escape character to see if further characters are
226 available on the input stream within a short interval.
228 stores this interval in milliseconds.
230 If \fB\%keypad\fP(3X) is disabled for the
232 window receiving input,
233 a program must disambiguate escape sequences itself.
235 The \fIcurses\fP library converts a tab character to this number of
236 spaces as it adds a tab to a window;
237 see \fB\%curs_addch\fP(3X).
239 Either \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X) initializes
244 is configured to provide separate
249 most of these variables reside in the former.
251 The X/Open Curses standard documents all of the foregoing types and
252 symbols except for \fB\%newscr\fP,
254 and \fB\%ESCDELAY\fP.
256 X/Open Curses describes \fB\%curscr\fP only as \*(``an internal data
258 SVr4 gave more details,
259 noting its use \*(``for certain low-level operations like clearing and
260 redrawing a screen containing garbage\*(''.
261 .\" SVID 4, Volume 3, p. 408
262 Neither specified its interaction with the rest of the interface beyond
263 use as an argument to \fB\%clearok\fP(3X) and \fB\%wrefresh\fP(3X).
265 \fB\%newscr\fP is a feature of SVr4 \fIcurses\fP.
266 When refreshing the screen,
267 it is used as a working area for combining the standard window
268 \fB\%stdscr\fP with any others the application may have created with
270 When the update of \fB\%newscr\fP is complete,
271 \fIcurses\fP modifies \fB\%curscr\fP to match \fB\%newscr\fP.
273 \fB\%TABSIZE\fP is a feature of SVr4 \fIcurses\fP.
275 SVr4 initially sets \fB\%TABSIZE\fP from the terminal description's
276 \fB\%init_tabs\fP capability.
278 it can be altered by applications using SVr4 \fIcurses\fP.
280 SVr4 \fIcurses\fP uses the value of \fB\%TABSIZE\fP to compute the
281 position of tab stops when updating both
282 the virtual screen with \fB\%addch\fP(3X) and
283 the physical screen with \fB\%mvcur\fP(3X).
285 \fI\%ncurses\fP uses the value of \fB\%TABSIZE\fP only to update the
287 It uses the terminal description's \*(``\fBit\fP\*(''
288 \%(\fBinit_tabs\fP) capability for computing hardware tabs
290 tab stops on the physical screen).
292 Other implementations differ.
294 NetBSD \fIcurses\fP allows \fB\%TABSIZE\fP to be set through an
295 environment variable.
296 \fI\%ncurses\fP does not.
298 NetBSD \fIcurses\fP does not support hardware tabs;
299 it uses the \fB\%init_tabs\fP capability and the \fB\%TABSIZE\fP
300 variable only for updating the virtual screen.
302 \fB\%ESCDELAY\fP is a feature of AIX \fIcurses\fP.
305 the units for \fB\%ESCDELAY\fP are \fIfifths\fP of milliseconds.
307 The default value for AIX's \fB\%ESCDELAY\fP equals 0.1 seconds.
309 AIX also enforces a limit of 10,000 seconds for \fB\%ESCDELAY\fP;
310 \fI\%ncurses\fP does not enforce any upper limit.
312 \fI\%ncurses\fP has long used \fB\%ESCDELAY\fP with units of
314 making it impossible to be completely compatible with AIX.
316 most users have decided either to override the value,
317 or to rely upon its default.
320 \fB\%curs_color\fP(3X),
321 \fB\%curs_opaque\fP(3X),
322 \fB\%curs_terminfo\fP(3X),
323 \fB\%curs_threads\fP(3X),
324 \fB\%term_variables\fP(3X),
327 [UAX #29] \*(``Unicode Standard Annex #29: Unicode Text
329 \%<https://\*:unicode\*:.org/\*:reports/\*:tr29/>