]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/curs_variables.3x.html
ncurses 6.4 - patch 20231125
[ncurses.git] / doc / html / man / curs_variables.3x.html
1 <!--
2   ****************************************************************************
3   * Copyright 2018-2021,2023 Thomas E. Dickey                                *
4   * Copyright 2010-2015,2017 Free Software Foundation, Inc.                  *
5   *                                                                          *
6   * Permission is hereby granted, free of charge, to any person obtaining a  *
7   * copy of this software and associated documentation files (the            *
8   * "Software"), to deal in the Software without restriction, including      *
9   * without limitation the rights to use, copy, modify, merge, publish,      *
10   * distribute, distribute with modifications, sublicense, and/or sell       *
11   * copies of the Software, and to permit persons to whom the Software is    *
12   * furnished to do so, subject to the following conditions:                 *
13   *                                                                          *
14   * The above copyright notice and this permission notice shall be included  *
15   * in all copies or substantial portions of the Software.                   *
16   *                                                                          *
17   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18   * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20   * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21   * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22   * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23   * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24   *                                                                          *
25   * Except as contained in this notice, the name(s) of the above copyright   *
26   * holders shall not be used in advertising or otherwise to promote the     *
27   * sale, use or other dealings in this Software without prior written       *
28   * authorization.                                                           *
29   ****************************************************************************
30   * @Id: curs_variables.3x,v 1.34 2023/11/25 14:32:36 tom Exp @
31 -->
32 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
33 <HTML>
34 <HEAD>
35 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
36 <meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
37 <TITLE>curs_variables 3x 2023-11-25 ncurses 6.4 Library calls</TITLE>
38 <link rel="author" href="mailto:bug-ncurses@gnu.org">
39
40 </HEAD>
41 <BODY>
42 <H1 class="no-header">curs_variables 3x 2023-11-25 ncurses 6.4 Library calls</H1>
43 <PRE>
44 <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>               Library calls              <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>
45
46
47
48
49 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
50        <EM>bool</EM>,  <EM>chtype</EM>,  <EM>cchar</EM><STRONG>_</STRONG><EM>t</EM>,  <EM>attr</EM><STRONG>_</STRONG><EM>t</EM>, <EM>WINDOW</EM>, <STRONG>TRUE</STRONG>, <STRONG>FALSE</STRONG>, <STRONG>ERR</STRONG>, <STRONG>OK</STRONG>, <STRONG>COLORS</STRONG>,
51        <STRONG>COLOR_PAIRS</STRONG>, <STRONG>COLS</STRONG>, <STRONG>ESCDELAY</STRONG>, <STRONG>LINES</STRONG>, <STRONG>TABSIZE</STRONG>, <STRONG>curscr</STRONG>, <STRONG>newscr</STRONG>,  <STRONG>stdscr</STRONG>  -
52        <EM>curses</EM> data types, constants, and global variables
53
54
55 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
56        <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
57
58        <EM>/*</EM> <EM>data</EM> <EM>types</EM> <EM>*/</EM>
59        <STRONG>typedef</STRONG> <EM>/*</EM> <STRONG>...</STRONG> <EM>*/</EM> <STRONG>bool;</STRONG>
60        <STRONG>typedef</STRONG> <EM>/*</EM> <STRONG>...</STRONG> <EM>*/</EM> <STRONG>chtype;</STRONG>
61        <STRONG>typedef</STRONG> <EM>/*</EM> <STRONG>...</STRONG> <EM>*/</EM> <STRONG>cchar_t;</STRONG>
62        <STRONG>typedef</STRONG> <EM>/*</EM> <STRONG>...</STRONG> <EM>*/</EM> <STRONG>attr_t;</STRONG>
63        <STRONG>typedef</STRONG> <EM>/*</EM> <STRONG>...</STRONG> <EM>*/</EM> <STRONG>WINDOW;</STRONG>
64
65        <EM>/*</EM> <EM>constants</EM> <EM>*/</EM>
66        <STRONG>const</STRONG> <STRONG>bool</STRONG> <STRONG>TRUE;</STRONG>
67        <STRONG>const</STRONG> <STRONG>bool</STRONG> <STRONG>FALSE;</STRONG>
68
69        <STRONG>const</STRONG> <EM>/*</EM> <STRONG>...</STRONG> <EM>*/</EM> <STRONG>ERR;</STRONG>
70        <STRONG>const</STRONG> <EM>/*</EM> <STRONG>...</STRONG> <EM>*/</EM> <STRONG>OK;</STRONG>
71
72        <EM>/*</EM> <EM>variables</EM> <EM>*/</EM>
73        <STRONG>int</STRONG> <STRONG>COLOR_PAIRS;</STRONG>
74        <STRONG>int</STRONG> <STRONG>COLORS;</STRONG>
75        <STRONG>int</STRONG> <STRONG>COLS;</STRONG>
76        <STRONG>int</STRONG> <STRONG>ESCDELAY;</STRONG>
77        <STRONG>int</STRONG> <STRONG>LINES;</STRONG>
78        <STRONG>int</STRONG> <STRONG>TABSIZE;</STRONG>
79        <STRONG>WINDOW</STRONG> <STRONG>*</STRONG> <STRONG>curscr;</STRONG>
80        <STRONG>WINDOW</STRONG> <STRONG>*</STRONG> <STRONG>newscr;</STRONG>
81        <STRONG>WINDOW</STRONG> <STRONG>*</STRONG> <STRONG>stdscr;</STRONG>
82
83
84 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
85        This  page  summarizes data types, constants, and variables provided by
86        the <EM>curses</EM> library.  Locate further discussion in <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>.
87
88        Depending on <EM>ncurses</EM>'s  build-time  configuration,  the  variables  may
89        instead  be  macros  (see  <STRONG><A HREF="curs_threads.3x.html">curs_threads(3x)</A></STRONG>  and  <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>) that
90        provide read-only access to  the  library's  state.   In  either  case,
91        applications  should  treat  them  as  read-only to avoid confusing the
92        library.
93
94
95 </PRE><H3><a name="h3-bool_-TRUE_-FALSE">bool, TRUE, FALSE</a></H3><PRE>
96        X/Open Issue 4 <EM>curses</EM>  (1996)  preceded  the  ISO  C99  and  ISO  C++98
97        standards,  each of which also defined a Boolean data type.  The <EM>curses</EM>
98        library requires an integral type <EM>bool</EM> and constants <STRONG>TRUE</STRONG> and <STRONG>FALSE</STRONG>  to
99        store its two possible values.
100
101
102 </PRE><H3><a name="h3-ERR_-OK">ERR, OK</a></H3><PRE>
103        <EM>curses</EM>  and <EM>terminfo</EM> routines frequently return these constant integral
104        values indicating failure and success, respectively.
105
106
107 </PRE><H3><a name="h3-chtype">chtype</a></H3><PRE>
108        The <EM>chtype</EM> integral type combines a ("narrow",  8-bit)  character  with
109        attributes  encoding  the character's <EM>rendition</EM>, such as the styling of
110        its  typeface  and/or  foreground  and  background  colors.   See,  for
111        example, <STRONG><A HREF="curs_addch.3x.html">addch(3x)</A></STRONG>, <STRONG><A HREF="curs_attr.3x.html">attron(3x)</A></STRONG>, and <STRONG><A HREF="curs_inch.3x.html">inch(3x)</A></STRONG>.
112
113
114 </PRE><H3><a name="h3-cchar_t_-attr_t">cchar_t, attr_t</a></H3><PRE>
115        <EM>chtype</EM>  is  too small for the standard C library's wide-character type,
116        <EM>wchar</EM><STRONG>_</STRONG><EM>t</EM>.  <EM>cchar</EM><STRONG>_</STRONG><EM>t</EM> is a type that can accommodate an <EM>attr</EM><STRONG>_</STRONG><EM>t</EM>  and  enough
117        wide  characters  to  store  what  Unicode  terms a <EM>grapheme</EM> <EM>cluster</EM> (a
118        "user-perceived character" [UAX #29], which  may  nevertheless  require
119        several  character encoding units to represent).  <EM>attr</EM><STRONG>_</STRONG><EM>t</EM> is an integral
120        type storing "wide"  attributes  that  apply  to  <EM>cchar</EM><STRONG>_</STRONG><EM>t</EM>s.   See,  for
121        example, <STRONG><A HREF="curs_add_wch.3x.html">add_wch(3x)</A></STRONG>, <STRONG><A HREF="curs_attr.3x.html">attr_on(3x)</A></STRONG>, and <STRONG><A HREF="curs_in_wch.3x.html">in_wch(3x)</A></STRONG>.
122
123
124 </PRE><H3><a name="h3-COLOR_PAIRS">COLOR_PAIRS</a></H3><PRE>
125        Once  <EM>curses</EM>  is  initialized, <STRONG>COLOR_PAIRS</STRONG> contains the number of color
126        pairs supported by the terminal.   Often,  its  value  is  the  product
127        <STRONG>COLORS</STRONG> x <STRONG>COLORS</STRONG>, but this is not always true.
128
129        <STRONG>o</STRONG>   A few terminals use HLS colors, ignoring this rule; and
130
131        <STRONG>o</STRONG>   terminals  supporting  a  large number of colors are limited by the
132            number of color pairs that a <EM>signed</EM> <EM>short</EM> value can represent.
133
134
135 </PRE><H3><a name="h3-COLORS">COLORS</a></H3><PRE>
136        Once <EM>curses</EM> is  initialized,  <STRONG>COLORS</STRONG>  contains  the  number  of  colors
137        supported by the terminal.
138
139
140 </PRE><H3><a name="h3-COLS">COLS</a></H3><PRE>
141        Once  <EM>curses</EM>  is  initialized,  <STRONG>COLS</STRONG>  contains  the  screen's  width in
142        character cells; that is, the number of columns.
143
144
145 </PRE><H3><a name="h3-ESCDELAY">ESCDELAY</a></H3><PRE>
146        For <EM>curses</EM> to distinguish an escape character corresponding to a user's
147        press  of  an  "Escape"  key on the input device from one included in a
148        control sequence used by a cursor movement or function key, the library
149        waits  to  see  if another key event occurs after the escape character.
150        <STRONG>ESCDELAY</STRONG> stores this interval in milliseconds.
151
152
153 </PRE><H3><a name="h3-LINES">LINES</a></H3><PRE>
154        Once <EM>curses</EM> is initialized,  <STRONG>LINES</STRONG>  contains  the  screen's  height  in
155        character cells; that is, the number of lines.
156
157
158 </PRE><H3><a name="h3-TABSIZE">TABSIZE</a></H3><PRE>
159        The <EM>curses</EM> library converts a tab character to this number of spaces as
160        it adds a tab to a window; see <STRONG><A HREF="curs_addch.3x.html">curs_addch(3x)</A></STRONG>.
161
162
163 </PRE><H3><a name="h3-curscr">curscr</a></H3><PRE>
164        <EM>curses</EM> records updates to the terminal screen  in  a  <EM>WINDOW</EM>  structure
165        named <STRONG>curscr</STRONG>.
166
167        This object is referred to as the "physical screen" in <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>
168        and <STRONG><A HREF="curs_outopts.3x.html">curs_outopts(3x)</A></STRONG>.
169
170
171 </PRE><H3><a name="h3-newscr">newscr</a></H3><PRE>
172        <EM>ncurses</EM> collects pending updates to the terminal  screen  in  a  <EM>WINDOW</EM>
173        structure named <STRONG>newscr</STRONG>.
174
175        This   object   is   referred   to  as  the  "virtual  screen"  in  the
176        <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>,  <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>,  and  <STRONG><A HREF="curs_outopts.3x.html">curs_outopts(3x)</A></STRONG>.   When  the
177        screen  is  refreshed, <EM>curses</EM> determines a minimal set of updates using
178        the terminal's capabilities to make <STRONG>curscr</STRONG> look like <STRONG>newscr</STRONG>.
179
180
181 </PRE><H3><a name="h3-stdscr">stdscr</a></H3><PRE>
182        Once <EM>curses</EM> is initialized, it creates a <EM>WINDOW</EM> structure named <STRONG>stdscr</STRONG>.
183        It  is  the  same size as the terminal screen and is the default window
184        used by routines that do not take a parameter  identifying  one.   Many
185        <EM>curses</EM> functions use this window.
186
187
188 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
189        Either <STRONG><A HREF="curs_initscr.3x.html">initscr(3x)</A></STRONG> or <STRONG><A HREF="curs_initscr.3x.html">newterm(3x)</A></STRONG> initializes <EM>curses</EM>.
190
191        If  <EM>ncurses</EM>  is  configured  to  provide  separate  <EM>curses</EM> and <EM>terminfo</EM>
192        libraries, most of these variables reside in the <EM>curses</EM> library.
193
194
195 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
196        The X/Open Curses standard documents all of  the  foregoing  types  and
197        symbols except for <STRONG>newscr</STRONG>, <STRONG>TABSIZE</STRONG>, and <STRONG>ESCDELAY</STRONG>.
198
199        X/Open  Curses  describes  <STRONG>curscr</STRONG> only as "an internal data structure";
200        SVID  gave  more  details,  noting  its  use  "for  certain   low-level
201        operations  like  clearing  and redrawing a screen containing garbage".
202        Neither specified its interaction with the rest of the interface beyond
203        use as an argument to <STRONG><A HREF="curs_outopts.3x.html">clearok(3x)</A></STRONG> and <STRONG><A HREF="curs_refresh.3x.html">wrefresh(3x)</A></STRONG>.
204
205        <STRONG>newscr</STRONG>  is  a feature of SVr4 <EM>curses</EM>.  When refreshing the screen, this
206        window is used as a working area  for  combining  the  standard  screen
207        <STRONG>stdscr</STRONG>  with  any  other windows which the application may have created
208        with <STRONG><A HREF="curs_window.3x.html">newwin(3x)</A></STRONG>.  When the updated <STRONG>newscr</STRONG> is complete,  <EM>curses</EM>  updates
209        <STRONG>curscr</STRONG> to match <STRONG>newscr</STRONG>.
210
211        <STRONG>TABSIZE</STRONG> is a feature of SVr4 <EM>curses</EM>.
212
213        <STRONG>o</STRONG>   SVr4   initially  sets  <STRONG>TABSIZE</STRONG>  from  the  terminal  description's
214            <STRONG>init_tabs</STRONG>  capability.   After  that,  it   can   be   altered   by
215            applications using SVr4 <EM>curses</EM>.
216
217        <STRONG>o</STRONG>   SVr4  <EM>curses</EM>  uses  the value of <STRONG>TABSIZE</STRONG> to compute the position of
218            tab stops when updating both the virtual screen with <STRONG><A HREF="curs_addch.3x.html">addch(3x)</A></STRONG>  and
219            the physical screen with <STRONG><A HREF="curs_terminfo.3x.html">mvcur(3x)</A></STRONG>.
220
221        <STRONG>o</STRONG>   <EM>ncurses</EM>  uses  the  value  of  <STRONG>TABSIZE</STRONG>  only  to update the virtual
222            screen.   It  uses  the  terminal  description's  "<STRONG>it</STRONG>"  (<STRONG>init_tabs</STRONG>)
223            capability  for  computing hardware tabs (that is, tab stops on the
224            physical screen).
225
226        <STRONG>o</STRONG>   Other implementations differ.  For instance, NetBSD  <EM>curses</EM>  allows
227            <STRONG>TABSIZE</STRONG>  to  be  set through an environment variable.  <EM>ncurses</EM> does
228            not.
229
230            NetBSD <EM>curses</EM> does not support hardware tabs; it uses the <STRONG>init_tabs</STRONG>
231            capability  and  the <STRONG>TABSIZE</STRONG> variable only for updating the virtual
232            screen.
233
234        <STRONG>ESCDELAY</STRONG> is a feature of AIX <EM>curses</EM>.
235
236        <STRONG>o</STRONG>   In AIX, the units for <STRONG>ESCDELAY</STRONG> are <EM>fifths</EM> of milliseconds.
237
238        <STRONG>o</STRONG>   The default value for AIX's <STRONG>ESCDELAY</STRONG> equals 0.1 seconds.
239
240        <STRONG>o</STRONG>   AIX also enforces a limit of 10,000 seconds for  <STRONG>ESCDELAY</STRONG>;  <EM>ncurses</EM>
241            does not enforce any upper limit.
242
243        <EM>ncurses</EM>  has  long  used <STRONG>ESCDELAY</STRONG> with units of milliseconds, making it
244        impossible to be completely compatible with  AIX.   Consequently,  most
245        users  have  decided  either to override the value, or to rely upon its
246        default.
247
248
249 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
250        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>,   <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>,   <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>,   <STRONG><A HREF="curs_threads.3x.html">curs_threads(3x)</A></STRONG>,
251        <STRONG><A HREF="term_variables.3x.html">term_variables(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>
252
253        [UAX  #29]  "Unicode  Standard  Annex  #29: Unicode Text Segmentation";
254        &lt;https://unicode.org/reports/tr29/&gt;
255
256
257
258 ncurses 6.4                       2023-11-25                <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>
259 </PRE>
260 <div class="nav">
261 <ul>
262 <li><a href="#h2-NAME">NAME</a></li>
263 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
264 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
265 <ul>
266 <li><a href="#h3-bool_-TRUE_-FALSE">bool, TRUE, FALSE</a></li>
267 <li><a href="#h3-ERR_-OK">ERR, OK</a></li>
268 <li><a href="#h3-chtype">chtype</a></li>
269 <li><a href="#h3-cchar_t_-attr_t">cchar_t, attr_t</a></li>
270 <li><a href="#h3-COLOR_PAIRS">COLOR_PAIRS</a></li>
271 <li><a href="#h3-COLORS">COLORS</a></li>
272 <li><a href="#h3-COLS">COLS</a></li>
273 <li><a href="#h3-ESCDELAY">ESCDELAY</a></li>
274 <li><a href="#h3-LINES">LINES</a></li>
275 <li><a href="#h3-TABSIZE">TABSIZE</a></li>
276 <li><a href="#h3-curscr">curscr</a></li>
277 <li><a href="#h3-newscr">newscr</a></li>
278 <li><a href="#h3-stdscr">stdscr</a></li>
279 </ul>
280 </li>
281 <li><a href="#h2-NOTES">NOTES</a></li>
282 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
283 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
284 </ul>
285 </div>
286 </BODY>
287 </HTML>