]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/curs_getcchar.3x.html
ncurses 6.1 - patch 20191214
[ncurses.git] / doc / html / man / curs_getcchar.3x.html
1 <!-- 
2   ****************************************************************************
3   * Copyright (c) 2001-2017,2019 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: curs_getcchar.3x,v 1.23 2019/11/30 22:22:32 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>curs_getcchar 3x</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">curs_getcchar 3x</H1>
42 <PRE>
43 <STRONG><A HREF="curs_getcchar.3x.html">curs_getcchar(3x)</A></STRONG>                                            <STRONG><A HREF="curs_getcchar.3x.html">curs_getcchar(3x)</A></STRONG>
44
45
46
47
48 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
49        <STRONG>getcchar</STRONG>,  <STRONG>setcchar</STRONG>  - Get a wide character string and rendition from a
50        <STRONG>cchar_t</STRONG> or set a <STRONG>cchar_t</STRONG> from a wide-character string
51
52
53 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
54        <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
55
56        <STRONG>int</STRONG> <STRONG>getcchar(</STRONG>
57                <STRONG>const</STRONG> <STRONG>cchar_t</STRONG> <STRONG>*</STRONG><EM>wcval</EM><STRONG>,</STRONG>
58                <STRONG>wchar_t</STRONG> <STRONG>*</STRONG><EM>wch</EM><STRONG>,</STRONG>
59                <STRONG>attr_t</STRONG> <STRONG>*</STRONG><EM>attrs</EM><STRONG>,</STRONG>
60                <STRONG>short</STRONG> <STRONG>*</STRONG><EM>color</EM><STRONG>_</STRONG><EM>pair</EM><STRONG>,</STRONG>
61                <STRONG>void</STRONG> <STRONG>*</STRONG><EM>opts</EM> <STRONG>);</STRONG>
62
63        <STRONG>int</STRONG> <STRONG>setcchar(</STRONG>
64                <STRONG>cchar_t</STRONG> <STRONG>*</STRONG><EM>wcval</EM><STRONG>,</STRONG>
65                <STRONG>const</STRONG> <STRONG>wchar_t</STRONG> <STRONG>*</STRONG><EM>wch</EM><STRONG>,</STRONG>
66                <STRONG>const</STRONG> <STRONG>attr_t</STRONG> <EM>attrs</EM><STRONG>,</STRONG>
67                <STRONG>short</STRONG> <EM>color</EM><STRONG>_</STRONG><EM>pair</EM><STRONG>,</STRONG>
68                <STRONG>const</STRONG> <STRONG>void</STRONG> <STRONG>*</STRONG><EM>opts</EM> <STRONG>);</STRONG>
69
70
71 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
72
73 </PRE><H3><a name="h3-getcchar">getcchar</a></H3><PRE>
74        The <STRONG>getcchar</STRONG> function gets a wide-character string and rendition from a
75        <STRONG>cchar_t</STRONG>  argument.   When <EM>wch</EM> is not a null pointer, the <STRONG>getcchar</STRONG> func-
76        tion does the following:
77
78        <STRONG>o</STRONG>   Extracts information from a <STRONG>cchar_t</STRONG> value <EM>wcval</EM>
79
80        <STRONG>o</STRONG>   Stores the character attributes in the location pointed to by <EM>attrs</EM>
81
82        <STRONG>o</STRONG>   Stores the color-pair in the location pointed to by <EM>color</EM><STRONG>_</STRONG><EM>pair</EM>
83
84        <STRONG>o</STRONG>   Stores the wide-character string, characters referenced  by  <EM>wcval</EM>,
85            into the array pointed to by <EM>wch</EM>.
86
87        When <EM>wch</EM> is a null pointer, the <STRONG>getcchar</STRONG> function does the following:
88
89        <STRONG>o</STRONG>   Obtains the number of wide characters pointed to by <EM>wcval</EM>
90
91        <STRONG>o</STRONG>   Does not change the data referenced by <EM>attrs</EM> or <EM>color</EM><STRONG>_</STRONG><EM>pair</EM>
92
93
94 </PRE><H3><a name="h3-setcchar">setcchar</a></H3><PRE>
95        The  <STRONG>setcchar</STRONG>  function initializes the location pointed to by <EM>wcval</EM> by
96        using:
97
98        <STRONG>o</STRONG>   The character attributes in <EM>attrs</EM>
99
100        <STRONG>o</STRONG>   The color pair in <EM>color</EM><STRONG>_</STRONG><EM>pair</EM>
101
102        <STRONG>o</STRONG>   The wide-character string pointed to by <EM>wch</EM>.  The  string  must  be
103            L'\0' terminated, contain at most one spacing character, which must
104            be the first.
105
106            Up to <STRONG>CCHARW_MAX</STRONG>-1 nonspacing characters  may  follow.   Additional
107            nonspacing characters are ignored.
108
109            The string may contain a single control character instead.  In that
110            case, no nonspacing characters are allowed.
111
112
113 </PRE><H2><a name="h2-EXTENSIONS">EXTENSIONS</a></H2><PRE>
114        X/Open Curses documents the <EM>opts</EM> argument as reserved for  future  use,
115        saying  that  it must be null.  This implementation uses that parameter
116        in ABI 6 for the functions which have a color-pair parameter to support
117        extended color pairs:
118
119        <STRONG>o</STRONG>   For   functions  which modify the color, e.g., <STRONG>setcchar</STRONG>, if <EM>opts</EM> is
120            set it is treated as a pointer to <STRONG>int</STRONG>, and used to  set  the  color
121            pair instead of the <STRONG>short</STRONG> pair parameter.
122
123        <STRONG>o</STRONG>   For  functions which retrieve the color, e.g., <STRONG>getcchar</STRONG>, if <EM>opts</EM> is
124            set it is treated as a pointer to <STRONG>int</STRONG>, and  used  to  retrieve  the
125            color pair as an <STRONG>int</STRONG> value, in addition retrieving it via the stan-
126            dard pointer to <STRONG>short</STRONG> parameter.
127
128
129 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
130        The <EM>wcval</EM> argument may be a value generated by a call to <STRONG>setcchar</STRONG> or by
131        a function that has a <STRONG>cchar_t</STRONG> output argument.  If <EM>wcval</EM> is constructed
132        by any other means, the effect is unspecified.
133
134
135 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
136        When <EM>wch</EM> is a null pointer, <STRONG>getcchar</STRONG> returns the number of wide charac-
137        ters referenced by <EM>wcval</EM>, including one for a trailing null.
138
139        When  <EM>wch</EM>  is  not  a null pointer, <STRONG>getcchar</STRONG> returns <STRONG>OK</STRONG> upon successful
140        completion, and <STRONG>ERR</STRONG> otherwise.
141
142        Upon successful completion, <STRONG>setcchar</STRONG> returns <STRONG>OK</STRONG>.  Otherwise, it returns
143        <STRONG>ERR</STRONG>.
144
145
146 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
147        The  <STRONG>CCHARW_MAX</STRONG>  symbol is specific to ncurses.  X/Open Curses does not
148        provide details for the layout of the <STRONG>cchar_t</STRONG> structure.  It tells what
149        data are stored in it:
150
151        <STRONG>o</STRONG>   a spacing character (<STRONG>wchar_t</STRONG>, i.e., 32-bits).
152
153        <STRONG>o</STRONG>   non-spacing characters (again, <STRONG>wchar_t</STRONG>'s).
154
155        <STRONG>o</STRONG>   attributes  (at  least  16 bits, inferred from the various ACS- and
156            WACS-flags).
157
158        <STRONG>o</STRONG>   color pair (at least 16 bits,  inferred  from  the  <STRONG>unsigned</STRONG>  <STRONG>short</STRONG>
159            type).
160
161        The non-spacing characters are optional, in the sense that zero or more
162        may be stored in a <STRONG>cchar_t</STRONG>.  XOpen/Curses specifies a limit:
163
164            Implementations may limit the number of non-spacing characters that
165            can  be  associated with a spacing character, provided any limit is
166            at least 5.
167
168        The Unix implementations at the time follow that limit:
169
170        <STRONG>o</STRONG>   AIX 4 and OSF1 4 use the same declaration with an array of  5  non-
171            spacing characters <EM>z</EM> and a single spacing character <EM>c</EM>.
172
173        <STRONG>o</STRONG>   HP-UX 10  uses  an  opaque  structure with 28 bytes, which is large
174            enough for the 6 <STRONG>wchar_t</STRONG> values.
175
176        <STRONG>o</STRONG>   Solaris xpg4 curses uses a single array of 6 <STRONG>wchar_t</STRONG> values.
177
178        This implementation's <STRONG>cchar_t</STRONG> was defined in 1995 using <STRONG>5</STRONG> for the total
179        of  spacing and non-spacing characters (<STRONG>CCHARW_MAX</STRONG>).  That was probably
180        due to a misreading of the  AIX 4  header  files,  because  the  X/Open
181        Curses  document  was  not generally available at that time.  Later (in
182        2002), this detail was overlooked when beginning to implement the func-
183        tions using the structure.
184
185        In  practice, even four non-spacing characters may seem enough.  X/Open
186        Curses documents possible uses for  non-spacing  characters,  including
187        using  them  for ligatures between characters (a feature apparently not
188        supported by any curses implementation).  Unicode does  not  limit  the
189        (analogous) number of combining characters, so some applications may be
190        affected.
191
192
193 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
194        Functions: <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG>, <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG>wcwidth(3)</STRONG>.
195
196
197
198                                                              <STRONG><A HREF="curs_getcchar.3x.html">curs_getcchar(3x)</A></STRONG>
199 </PRE>
200 <div class="nav">
201 <ul>
202 <li><a href="#h2-NAME">NAME</a></li>
203 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
204 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
205 <ul>
206 <li><a href="#h3-getcchar">getcchar</a></li>
207 <li><a href="#h3-setcchar">setcchar</a></li>
208 </ul>
209 </li>
210 <li><a href="#h2-EXTENSIONS">EXTENSIONS</a></li>
211 <li><a href="#h2-NOTES">NOTES</a></li>
212 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
213 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
214 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
215 </ul>
216 </div>
217 </BODY>
218 </HTML>