]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/user_caps.5.html
6d6e9126a28025603d05d3a89f0262fe6fefb1fe
[ncurses.git] / doc / html / man / user_caps.5.html
1 <!-- 
2   ****************************************************************************
3   * Copyright (c) 2017,2018 Free Software Foundation, Inc.                   *
4   *                                                                          *
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:                 *
12   *                                                                          *
13   * The above copyright notice and this permission notice shall be included  *
14   * in all copies or substantial portions of the Software.                   *
15   *                                                                          *
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.                               *
23   *                                                                          *
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       *
27   * authorization.                                                           *
28   ****************************************************************************
29   * @Id: user_caps.5,v 1.9 2018/07/28 22:05:23 tom Exp @
30 -->
31 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
32 <HTML>
33 <HEAD>
34 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
35 <meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
36 <TITLE>user_caps 5</TITLE>
37 <link rel="author" href="mailto:bug-ncurses@gnu.org">
38 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
39 </HEAD>
40 <BODY>
41 <H1 class="no-header">user_caps 5</H1>
42 <PRE>
43 <STRONG><A HREF="user_caps.5.html">user_caps(5)</A></STRONG>                  File Formats Manual                 <STRONG><A HREF="user_caps.5.html">user_caps(5)</A></STRONG>
44
45
46
47
48 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
49        user_caps - user-defined terminfo capabilities
50
51
52 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
53        <STRONG>tic</STRONG> <STRONG>-x,</STRONG> <STRONG>infocmp</STRONG> <STRONG>-x</STRONG>
54
55
56 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
57
58 </PRE><H3><a name="h3-Background">Background</a></H3><PRE>
59        Before  ncurses 5.0, terminfo databases used a <EM>fixed</EM> <EM>repertoire</EM> of ter-
60        minal capabilities designed for the SVr2 terminal database in 1984, and
61        extended  in stages through SVr4 (1989), and standardized in the Single
62        Unix Specification beginning in 1995.
63
64        Most of the <EM>extensions</EM> in this fixed repertoire were additions  to  the
65        tables of boolean, numeric and string capabilities.  Rather than change
66        the meaning of an existing capability, a new name was added.  The  ter-
67        minfo  database  uses a binary format; binary compatibility was ensured
68        by using a header which gave the number of items in the tables for each
69        type of capability.  The standardization was incomplete:
70
71        <STRONG>o</STRONG>   The <EM>binary</EM> <EM>format</EM> itself is not described in the X/Open Curses doc-
72            umentation.  Only the <EM>source</EM> <EM>format</EM> is described.
73
74            Library developers rely upon the SVr4 documentation,  and  reverse-
75            engineering the compiled terminfo files to match the binary format.
76
77        <STRONG>o</STRONG>   Lacking a standard for the binary format, most implementations copy
78            the SVr2 binary format, which uses 16-bit signed integers,  and  is
79            limited to 4096-byte entries.
80
81            The  format  cannot  represent very large numeric capabilities, nor
82            can it represent large numbers of special keyboard definitions.
83
84        <STRONG>o</STRONG>   The tables of capability names differ between implementations.
85
86            Although they <EM>may</EM> provide all of the standard capability names, the
87            position  in the tables differs because some features were added as
88            needed, while others were added  (out  of  order)  to  comply  with
89            X/Open Curses.
90
91            While  ncurses' repertoire of predefined capabilities is closest to
92            Solaris, Solaris's terminfo database has a few differences from the
93            list  published by X/Open Curses.  For example, ncurses can be con-
94            figured with tables which match the terminal databases for AIX, HP-
95            UX or OSF/1, rather than the default Solaris-like configuration.
96
97        <STRONG>o</STRONG>   In  SVr4  curses  and  ncurses, the terminal database is defined at
98            compile-time using a text file which lists the  different  terminal
99            capabilities.
100
101            In  principle,  the  text-file  can  be  extended,  but  doing this
102            requires recompiling and reinstalling the library.   The  text-file
103            used in ncurses for terminal capabilities includes details for var-
104            ious systems past the documented X/Open Curses features.  For exam-
105            ple, ncurses supports these capabilities in each configuration:
106
107                memory_lock
108                     (meml) lock memory above cursor
109
110                memory_unlock
111                     (memu) unlock memory
112
113                box_chars_1
114                     (box1) box characters primary set
115
116            The memory lock/unlock capabilities were included because they were
117            used in the X11R6 terminal description for <STRONG>xterm</STRONG>.  The  <EM>box1</EM>  capa-
118            bility  is  used  in tic to help with terminal descriptions written
119            for AIX.
120
121        During the 1990s, some users were reluctant to use terminfo in spite of
122        its performance advantages over termcap:
123
124        <STRONG>o</STRONG>   The fixed repertoire prevented users from adding features for unan-
125            ticipated terminal improvements (or required them to reuse existing
126            capabilities as a workaround).
127
128        <STRONG>o</STRONG>   The  limitation  to  16-bit  signed  integers  was  also mentioned.
129            Because termcap stores everything as a string, it  could  represent
130            larger numbers.
131
132        Although  termcap's  extensibility  was  rarely  used (it was never the
133        <EM>speaker</EM> who had actually used the feature), the criticism had a  point.
134        ncurses  5.0  provided a way to detect nonstandard capabilities, deter-
135        mine their type and optionally store and retrieve them in a  way  which
136        did  not  interfere  with other applications.  These are referred to as
137        <EM>user-defined</EM> <EM>capabilities</EM> because no  modifications  to  the  toolset's
138        predefined capability names are needed.
139
140        The  ncurses  utilities <STRONG>tic</STRONG> and <STRONG>infocmp</STRONG> have a command-line option "-x"
141        to  control  whether  the  nonstandard  capabilities  are   stored   or
142        retrieved.   A  library function <STRONG>use_extended_names</STRONG> is provided for the
143        same purpose.
144
145        When compiling a terminal database, if "-x" is set, <STRONG>tic</STRONG>  will  store  a
146        user-defined capability if the capability name is not one of the prede-
147        fined names.
148
149        Because ncurses provides  a  termcap  library  interface,  these  user-
150        defined capabilities may be visible to termcap applications:
151
152        <STRONG>o</STRONG>   The   termcap  interface  (like  all  implementations  of  termcap)
153            requires that the capability names are 2-characters.
154
155            When the capability is simple enough for use in a termcap  applica-
156            tion, it is provided as a 2-character name.
157
158        <STRONG>o</STRONG>   There  are  other user-defined capabilities which refer to features
159            not usable in termcap, e.g., parameterized strings  that  use  more
160            than two parameters or use more than the trivial expression support
161            provided by termcap.  For these, the terminfo database should  have
162            only capability names with 3 or more characters.
163
164        <STRONG>o</STRONG>   Some terminals can send distinct strings for special keys (cursor-,
165            keypad- or function-keys) depending on modifier keys  (shift,  con-
166            trol,  etc.).   While  terminfo and termcap have a set of 60 prede-
167            fined function-key  names,  to  which  a  series  of  keys  can  be
168            assigned,  that  is  insufficient for more than a dozen keys multi-
169            plied by more than a couple of modifier combinations.  The  ncurses
170            database  uses a convention based on <STRONG>xterm</STRONG> to provide extended spe-
171            cial-key names.
172
173            Fitting that into termcap's limitation of 2-character  names  would
174            be  pointless.   These  extended  keys are available only with ter-
175            minfo.
176
177
178 </PRE><H3><a name="h3-Recognized-capabilities">Recognized capabilities</a></H3><PRE>
179        The ncurses library uses the user-definable  capabilities.   While  the
180        terminfo  database  may  have  other extensions, ncurses makes explicit
181        checks for these:
182
183           AX <EM>boolean</EM>, asserts that the terminal interprets SGR 39 and  SGR  49
184              by  resetting  the foreground and background color, respectively,
185              to the default.
186
187              This is a feature recognized by the <STRONG>screen</STRONG> program as well.
188
189           E3 <EM>string</EM>, tells how to  clear  the  terminal's  scrollback  buffer.
190              When present, the <STRONG><A HREF="clear.1.html">clear(1)</A></STRONG> program sends this before clearing the
191              terminal.
192
193              The command "<STRONG>tput</STRONG> <STRONG>clear</STRONG>" does the same thing.
194
195           RGB
196              <EM>boolean</EM>, <EM>number</EM> <STRONG>or</STRONG> <EM>string</EM>, to assert  that  the  <STRONG>set_a_foreground</STRONG>
197              and  <STRONG>set_a_background</STRONG>  capabilities  correspond to <EM>direct</EM> <EM>colors</EM>,
198              using an RGB (red/green/blue) convention.  This capability allows
199              the  <STRONG>color_content</STRONG>  function to return appropriate values without
200              requiring the application to initialize colors using <STRONG>init_color</STRONG>.
201
202              The capability type determines the values which ncurses sees:
203
204              <EM>boolean</EM>
205                 implies that the number of bits for red, green  and  blue  are
206                 the  same.   Using  the maximum number of colors, ncurses adds
207                 two, divides that sum by three, and assigns the result to red,
208                 green and blue in that order.
209
210                 If the number of bits needed for the number of colors is not a
211                 multiple of three, the blue (and  green)  components  lose  in
212                 comparison to red.
213
214              <EM>number</EM>
215                 tells  ncurses  what result to add to red, green and blue.  If
216                 ncurses runs out of bits, blue (and green) lose just as in the
217                 <EM>boolean</EM> case.
218
219              <EM>string</EM>
220                 explicitly  list  the  number  of bits used for red, green and
221                 blue components as a slash-separated list of decimal integers.
222
223              Because there are several  RGB  encodings  in  use,  applications
224              which  make  assumptions  about  the number of bits per color are
225              unlikely to work reliably.  As a trivial case, for  example,  one
226              could  define  <STRONG>RGB#1</STRONG> to represent the standard eight ANSI colors,
227              i.e., one bit per color.
228
229           U8 <EM>number</EM>, asserts that ncurses must use Unicode  values  for  line-
230              drawing characters, and that it should ignore the alternate char-
231              acter set capabilities when the locale uses UTF-8 encoding.   For
232              more  information,  see  the discussion of <STRONG>NCURSES_NO_UTF8_ACS</STRONG> in
233              <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG>.
234
235              Set this capability to a nonzero value to enable it.
236
237           XM <EM>string</EM>, override ncurses's built-in string which enables/disables
238              <STRONG>xterm</STRONG> mouse mode.
239
240
241 </PRE><H3><a name="h3-Extended-key-definitions">Extended key-definitions</a></H3><PRE>
242        Several terminals provide the ability to send distinct strings for com-
243        binations of modified special keys.  There  is  no  standard  for  what
244        those keys can send.
245
246        Since 1999, <STRONG>xterm</STRONG> has supported <EM>shift</EM>, <EM>control</EM>, <EM>alt</EM>, and <EM>meta</EM> modifiers
247        which produce distinct special-key strings.  In a terminal description,
248        ncurses  has  no special knowledge of the modifiers used.  Applications
249        can use the <EM>naming</EM> <EM>convention</EM> established for <STRONG>xterm</STRONG> to find these  spe-
250        cial keys in the terminal description.
251
252        Starting  with  the curses convention that <EM>key</EM> <EM>names</EM> begin with "k" and
253        that shifted special keys are  an  uppercase  name,  ncurses'  terminal
254        database defines these names to which a suffix is added:
255
256             <EM>Name</EM>   <EM>Description</EM>
257             ---------------------------------------------------------------
258             kDC    special form of kdch1 (delete character)
259             kDN    special form of kcud1 (cursor down)
260             kEND   special form of kend (End)
261             kHOM   special form of khome (Home)
262             kLFT   special form of kcub1 (cursor-left or cursor-back)
263             kNXT   special form of knext (Next, or Page-Down)
264             kPRV   special form of kprev (Prev, or Page-Up)
265             kRIT   special form of kcuf1 (cursor-right, or cursor-forward)
266             kUP    special form of kcuu1 (cursor-up)
267
268        These are the suffixes used to denote the modifiers:
269
270             <EM>Value</EM>   <EM>Description</EM>
271             ----------------------------------
272             2       Shift
273             3       Alt
274             4       Shift + Alt
275             5       Control
276             6       Shift + Control
277             7       Alt + Control
278             8       Shift + Alt + Control
279             9       Meta
280             10      Meta + Shift
281             11      Meta + Alt
282             12      Meta + Alt + Shift
283             13      Meta + Ctrl
284             14      Meta + Ctrl + Shift
285             15      Meta + Ctrl + Alt
286             16      Meta + Ctrl + Alt + Shift
287
288        None  of these are predefined; terminal descriptions can refer to <EM>names</EM>
289        which ncurses will allocate at runtime to <EM>key-codes</EM>.  To use these keys
290        in an ncurses program, an application could do this:
291
292        <STRONG>o</STRONG>   using a list of extended key <EM>names</EM>, ask <STRONG><A HREF="curs_terminfo.3x.html">tigetstr(3x)</A></STRONG> for their val-
293            ues, and
294
295        <STRONG>o</STRONG>   given the list of values,  ask  <STRONG><A HREF="key_defined.3x.html">key_defined(3x)</A></STRONG>  for  the  <EM>key-code</EM>
296            which would be returned for those keys by <STRONG><A HREF="curs_getch.3x.html">wgetch(3x)</A></STRONG>.
297
298
299 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
300        The  "-x" extension feature of <STRONG>tic</STRONG> and <STRONG>infocmp</STRONG> has been adopted in Net-
301        BSD curses.  That implementation stores user-defined capabilities,  but
302        makes no use of these capabilities itself.
303
304
305 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
306        <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>.
307
308
309 </PRE><H2><a name="h2-AUTHORS">AUTHORS</a></H2><PRE>
310        Thomas E. Dickey
311        beginning with ncurses 5.0 (1999)
312
313
314
315                                                                   <STRONG><A HREF="user_caps.5.html">user_caps(5)</A></STRONG>
316 </PRE>
317 <div class="nav">
318 <ul>
319 <li><a href="#h2-NAME">NAME</a></li>
320 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
321 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
322 <ul>
323 <li><a href="#h3-Background">Background</a></li>
324 <li><a href="#h3-Recognized-capabilities">Recognized capabilities</a></li>
325 <li><a href="#h3-Extended-key-definitions">Extended key-definitions</a></li>
326 </ul>
327 </li>
328 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
329 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
330 <li><a href="#h2-AUTHORS">AUTHORS</a></li>
331 </ul>
332 </div>
333 </BODY>
334 </HTML>