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.43 2024/01/05 21:46:58 tom Exp $
31 .TH curs_variables 3X 2024-01-05 "ncurses 6.4" "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.
219 For \fIcurses\fP to distinguish an escape character corresponding to a
220 user's press of an \*(``Escape\*('' key on the input device from one
221 included in a control sequence used by a cursor movement or function
223 the library waits to see if another key event occurs after the escape
226 stores this interval in milliseconds.
228 The \fIcurses\fP library converts a tab character to this number of
229 spaces as it adds a tab to a window;
230 see \fB\%curs_addch\fP(3X).
232 Either \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X) initializes
235 If \fI\%ncurses\fP is configured to provide separate \fIcurses\fP and
236 \fIterminfo\fP libraries,
237 most of these variables reside in the \fIcurses\fP library.
239 The X/Open Curses standard documents all of the foregoing types and
240 symbols except for \fB\%newscr\fP,
242 and \fB\%ESCDELAY\fP.
244 X/Open Curses describes \fB\%curscr\fP only as \*(``an internal data
246 SVr4 gave more details,
247 noting its use \*(``for certain low-level operations like clearing and
248 redrawing a screen containing garbage\*(''.
249 .\" SVID 4, Volume 3, p. 408
250 Neither specified its interaction with the rest of the interface beyond
251 use as an argument to \fB\%clearok\fP(3X) and \fB\%wrefresh\fP(3X).
253 \fB\%newscr\fP is a feature of SVr4 \fIcurses\fP.
254 When refreshing the screen,
255 it is used as a working area for combining the standard window
256 \fB\%stdscr\fP with any others the application may have created with
258 When the update of \fB\%newscr\fP is complete,
259 \fIcurses\fP modifies \fB\%curscr\fP to match \fB\%newscr\fP.
261 \fB\%TABSIZE\fP is a feature of SVr4 \fIcurses\fP.
263 SVr4 initially sets \fB\%TABSIZE\fP from the terminal description's
264 \fB\%init_tabs\fP capability.
266 it can be altered by applications using SVr4 \fIcurses\fP.
268 SVr4 \fIcurses\fP uses the value of \fB\%TABSIZE\fP to compute the
269 position of tab stops when updating both
270 the virtual screen with \fB\%addch\fP(3X) and
271 the physical screen with \fB\%mvcur\fP(3X).
273 \fI\%ncurses\fP uses the value of \fB\%TABSIZE\fP only to update the
275 It uses the terminal description's \*(``\fBit\fP\*(''
276 (\fB\%init_tabs\fP) capability for computing hardware tabs
278 tab stops on the physical screen).
280 Other implementations differ.
282 NetBSD \fIcurses\fP allows \fB\%TABSIZE\fP to be set through an
283 environment variable.
284 \fI\%ncurses\fP does not.
286 NetBSD \fIcurses\fP does not support hardware tabs;
287 it uses the \fB\%init_tabs\fP capability and the \fB\%TABSIZE\fP
288 variable only for updating the virtual screen.
290 \fB\%ESCDELAY\fP is a feature of AIX \fIcurses\fP.
293 the units for \fB\%ESCDELAY\fP are \fIfifths\fP of milliseconds.
295 The default value for AIX's \fB\%ESCDELAY\fP equals 0.1 seconds.
297 AIX also enforces a limit of 10,000 seconds for \fB\%ESCDELAY\fP;
298 \fI\%ncurses\fP does not enforce any upper limit.
300 \fI\%ncurses\fP has long used \fB\%ESCDELAY\fP with units of
302 making it impossible to be completely compatible with AIX.
304 most users have decided either to override the value,
305 or to rely upon its default.
308 \fB\%curs_color\fP(3X),
309 \fB\%curs_opaque\fP(3X),
310 \fB\%curs_terminfo\fP(3X),
311 \fB\%curs_threads\fP(3X),
312 \fB\%term_variables\fP(3X),
315 [UAX #29] \*(``Unicode Standard Annex #29: Unicode Text
317 \%<https://\*:unicode\*:.org/\*:reports/\*:tr29/>