1 .\"***************************************************************************
2 .\" Copyright 2018-2021,2023 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.31 2023/10/01 22:36:35 tom Exp $
31 .TH curs_variables 3X 2023-10-01 "ncurses 6.4" "Library calls"
62 \fIcurses\fR data types, constants, and global variables
65 \fB#include <curses.h>\fP
67 \fI/* data types */\fP
68 \fBtypedef \fI/*\fP .\|.\|. \fI*/\fP bool;\fP
69 \fBtypedef \fI/*\fP .\|.\|. \fI*/\fP chtype;\fP
70 \fBtypedef \fI/*\fP .\|.\|. \fI*/\fP cchar_t;\fP
71 \fBtypedef \fI/*\fP .\|.\|. \fI*/\fP attr_t;\fP
72 \fBtypedef \fI/*\fP .\|.\|. \fI*/\fP WINDOW;\fP
75 \fBconst bool TRUE;\fP
76 \fBconst bool FALSE;\fP
78 \fBconst \fI/*\fP .\|.\|. \fI*/\fP ERR;\fP
79 \fBconst \fI/*\fP .\|.\|. \fI*/\fP OK;\fP
82 \fBint COLOR_PAIRS;\fP
88 \fBWINDOW * curscr;\fP
89 \fBWINDOW * newscr;\fP
90 \fBWINDOW * stdscr;\fP
93 This page summarizes data types,
95 and variables provided by the \fIcurses\fP library.
96 Locate further discussion in \fB\%curses\fP(3X).
98 Depending on \fIncurses\fP's build-time configuration,
99 the variables may instead be
100 macros (see \fB\%curs_threads\fP(3X) and \fB\%curs_opaque\fP(3X))
101 that provide read-only access to the library's state.
103 applications should treat them as read-only to avoid
104 confusing the library.
105 .SS bool, TRUE, FALSE
106 X/Open Issue 4 \fIcurses\fP (1996) preceded the ISO C99 and ISO C++98
108 each of which also defined a Boolean data type.
109 The \fIcurses\fP library requires an integral type \fIbool\fP and
110 constants \fBTRUE\fP and \fBFALSE\fP to store its two possible values.
112 \fIcurses\fP and \fIterminfo\fP routines frequently return these
113 constant integral values indicating failure and success,
116 The \fI\%chtype\fP integral type combines a
119 character with attributes encoding the character's \fIrendition\fP,
120 such as the styling of its typeface and/or foreground and background
129 \fI\%chtype\fP is too small for the standard C library's wide-character
132 \fI\%cchar_t\fP is a type that can accommodate an \fI\%attr_t\fP and
133 enough wide characters to store what Unicode terms a \fIgrapheme cluster\fP
134 (a \*(``user-perceived character\*('' [UAX #29],
135 which may nevertheless require several character encoding units to
137 \fI\%attr_t\fP is an integral type storing \*(``wide\*('' attributes that
138 apply to \fI\%cchar_t\fPs.
146 Once \fIcurses\fP is initialized,
148 contains the number of color pairs supported by the terminal.
150 its value is the product \fB\%COLORS\fP \(mu \fB\%COLORS\fP,
151 but this is not always true.
153 A few terminals use HLS colors,
157 terminals supporting a large number of colors are limited by the number
158 of color pairs that a \fIsigned short\fP value can represent.
160 Once \fIcurses\fP is initialized,
162 contains the number of colors supported by the terminal.
164 Once \fIcurses\fP is initialized,
166 contains the screen's width in character cells;
168 the number of columns.
170 For \fIcurses\fP to distinguish an escape character corresponding to a
171 user's press of an \*(``Escape\*('' key on the input device from one
172 included in a control sequence used by a cursor movement or function
174 the library waits to see if another key event occurs after the escape
177 stores this interval in milliseconds.
179 Once \fIcurses\fP is initialized,
181 contains the screen's height in character cells;
185 The \fIcurses\fP library converts a tab character to this number of
186 spaces as it adds a tab to a window;
187 see \fB\%curs_addch\fP(3X).
189 \fIcurses\fP records updates to the terminal screen in a \fI\%WINDOW\fP
190 structure named \fB\%curscr\fP.
192 This object is referred to as the \*(``physical screen\*('' in
193 \fB\%curs_refresh\fP(3X) and
194 \fB\%curs_outopts\fP(3X).
196 \fIncurses\fP collects pending updates to the terminal screen in a
197 \fI\%WINDOW\fP structure named \fB\%newscr\fP.
199 This object is referred to as the \*(``virtual screen\*('' in the
200 \fB\%curs_kernel\fP(3X),
201 \fB\%curs_refresh\fP(3X),
203 \fB\%curs_outopts\fP(3X).
204 When the screen is refreshed,
205 \fIcurses\fP determines a minimal set of updates using the terminal's
206 capabilities to make \fB\%curscr\fP look like \fB\%newscr\fP.
208 Once \fIcurses\fP is initialized,
209 it creates a \fI\%WINDOW\fP structure named \fB\%stdscr\fP.
210 It is the same size as the terminal screen and is the default window
211 used by routines that do not take a parameter identifying one.
212 Many \fIcurses\fP functions use this window.
214 Either \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X) initializes
217 If \fIncurses\fP is configured to provide separate \fIcurses\fP and
218 \fIterminfo\fP libraries,
219 most of these variables reside in the \fIcurses\fP library.
221 The X/Open Curses standard documents all of the foregoing types and
222 symbols except for \fB\%newscr\fP,
224 and \fB\%ESCDELAY\fP.
226 X/Open Curses describes \fB\%curscr\fP only as \*(``an internal data
228 SVID gave more details,
229 noting its use \*(``for certain low-level operations like clearing and
230 redrawing a screen containing garbage\*(''.
231 Neither specified its interaction with the rest of the interface beyond
232 use as an argument to \fB\%clearok\fP(3X) and \fB\%wrefresh\fP(3X).
234 \fB\%newscr\fP is a feature of SVr4 \fIcurses\fP.
235 When refreshing the screen, this window is used as a working area
236 for combining the standard screen \fB\%stdscr\fP with any other windows
237 which the application may have created with \fB\%newwin\fP(3X).
238 When the updated \fB\%newscr\fP is complete,
239 \fIcurses\fP updates \fB\%curscr\fP to match \fB\%newscr\fP.
241 \fB\%TABSIZE\fP is a feature of SVr4 \fIcurses\fP.
243 SVr4 initially sets \fB\%TABSIZE\fP from the terminal description's
244 \fB\%init_tabs\fP capability.
246 it can be altered by applications using SVr4 \fIcurses\fP.
248 SVr4 \fIcurses\fP uses the value of \fB\%TABSIZE\fP to compute the
249 position of tab stops when updating both
250 the virtual screen with \fB\%addch\fP(3X) and
251 the physical screen with \fB\%mvcur\fP(3X).
253 \fIncurses\fP uses the value of \fB\%TABSIZE\fP only to update the
255 It uses the terminal description's \*(``\fBit\fP\*(''
256 (\fB\%init_tabs\fP) capability for computing hardware tabs
258 tab stops on the physical screen).
260 Other implementations differ.
262 NetBSD \fIcurses\fP allows \fB\%TABSIZE\fP to be set through an
263 environment variable.
264 \fIncurses\fP does not.
266 NetBSD \fIcurses\fP does not support hardware tabs;
267 it uses the \fB\%init_tabs\fP capability and the \fB\%TABSIZE\fP
268 variable only for updating the virtual screen.
270 \fB\%ESCDELAY\fP is a feature of AIX \fIcurses\fP.
273 the units for \fB\%ESCDELAY\fP are \fIfifths\fP of milliseconds.
275 The default value for AIX's \fB\%ESCDELAY\fP equals 0.1 seconds.
277 AIX also enforces a limit of 10,000 seconds for \fB\%ESCDELAY\fP;
278 \fIncurses\fP does not enforce any upper limit.
280 \fIncurses\fP has long used \fB\%ESCDELAY\fP with units of milliseconds,
281 making it impossible to be completely compatible with AIX.
283 most users have decided either to override the value,
284 or to rely upon its default.
287 \fB\%curs_opaque\fP(3X),
288 \fB\%curs_terminfo\fP(3X),
289 \fB\%curs_threads\fP(3X),
290 \fB\%term_variables\fP(3X),
291 \fB\%terminfo\fP(\*n)
293 [UAX #29] \*(``Unicode Standard Annex #29: Unicode Text
295 \%<https://\*:unicode\*:.org/\*:reports/\*:tr29/>