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