| 1 |
'\" t |
| 2 |
.\"*************************************************************************** |
| 3 |
.\" Copyright 2018-2024,2025 Thomas E. Dickey * |
| 4 |
.\" Copyright 1998-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 |
.\" |
| 31 |
.\" $Id: curs_addch.3x,v 1.144 2025/11/12 01:04:12 tom Exp $ |
| 32 |
.TH addch 3NCURSES 2025-11-11 "ncurses 6.6" "Library calls" |
| 33 |
.ie \n(.g \{\ |
| 34 |
.ds `` \(lq |
| 35 |
.ds '' \(rq |
| 36 |
.ds ' \(aq |
| 37 |
.ds ^ \(ha |
| 38 |
.ds ~ \(ti |
| 39 |
.\} |
| 40 |
.el \{\ |
| 41 |
.ie t .ds `` `` |
| 42 |
.el .ds `` "" |
| 43 |
.ie t .ds '' '' |
| 44 |
.el .ds '' "" |
| 45 |
.ds ' ' |
| 46 |
.ds ^ ^ |
| 47 |
.ds ~ ~ |
| 48 |
.\} |
| 49 |
. |
| 50 |
.de bP |
| 51 |
.ie n .IP \(bu 4 |
| 52 |
.el .IP \(bu 2 |
| 53 |
.. |
| 54 |
.SH NAME |
| 55 |
\fB\%addch\fP, |
| 56 |
\fB\%waddch\fP, |
| 57 |
\fB\%mvaddch\fP, |
| 58 |
\fB\%mvwaddch\fP, |
| 59 |
\fB\%echochar\fP, |
| 60 |
\fB\%wechochar\fP \- |
| 61 |
add a \fIcurses\fP character to a window and advance the cursor |
| 62 |
.SH SYNOPSIS |
| 63 |
.nf |
| 64 |
\fB#include <curses.h> |
| 65 |
.PP |
| 66 |
\fBint addch(const chtype \fIch\fP); |
| 67 |
\fBint waddch(WINDOW * \fIwin\fP, const chtype \fIch\fP); |
| 68 |
\fBint mvaddch(int \fIy\fP, int \fIx\fP, const chtype \fIch\fP); |
| 69 |
\fBint mvwaddch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const chtype \fIch\fP); |
| 70 |
.PP |
| 71 |
\fBint echochar(const chtype \fIch\fP); |
| 72 |
\fBint wechochar(WINDOW * \fIwin\fP, const chtype \fIch\fP); |
| 73 |
.PP |
| 74 |
\fI/* (integer) constants */\fP |
| 75 |
/*\fI .\|.\|. */ \fBACS_BLOCK;\fR |
| 76 |
/*\fI .\|.\|. */ \fBACS_BOARD;\fR |
| 77 |
/*\fI .\|.\|. */ \fBACS_BTEE;\fR |
| 78 |
/*\fI .\|.\|. */ \fBACS_BULLET;\fR |
| 79 |
/*\fI .\|.\|. */ \fBACS_CKBOARD;\fR |
| 80 |
/*\fI .\|.\|. */ \fBACS_DARROW;\fR |
| 81 |
/*\fI .\|.\|. */ \fBACS_DEGREE;\fR |
| 82 |
/*\fI .\|.\|. */ \fBACS_DIAMOND;\fR |
| 83 |
/*\fI .\|.\|. */ \fBACS_HLINE;\fR |
| 84 |
/*\fI .\|.\|. */ \fBACS_LANTERN;\fR |
| 85 |
/*\fI .\|.\|. */ \fBACS_LARROW;\fR |
| 86 |
/*\fI .\|.\|. */ \fBACS_LLCORNER;\fR |
| 87 |
/*\fI .\|.\|. */ \fBACS_LRCORNER;\fR |
| 88 |
/*\fI .\|.\|. */ \fBACS_LTEE;\fR |
| 89 |
/*\fI .\|.\|. */ \fBACS_PLMINUS;\fR |
| 90 |
/*\fI .\|.\|. */ \fBACS_PLUS;\fR |
| 91 |
/*\fI .\|.\|. */ \fBACS_RARROW;\fR |
| 92 |
/*\fI .\|.\|. */ \fBACS_RTEE;\fR |
| 93 |
/*\fI .\|.\|. */ \fBACS_S1;\fR |
| 94 |
/*\fI .\|.\|. */ \fBACS_S9;\fR |
| 95 |
/*\fI .\|.\|. */ \fBACS_TTEE;\fR |
| 96 |
/*\fI .\|.\|. */ \fBACS_UARROW;\fR |
| 97 |
/*\fI .\|.\|. */ \fBACS_ULCORNER;\fR |
| 98 |
/*\fI .\|.\|. */ \fBACS_URCORNER;\fR |
| 99 |
/*\fI .\|.\|. */ \fBACS_VLINE;\fR |
| 100 |
\fI/* extensions */\fP |
| 101 |
/*\fI .\|.\|. */ \fBACS_GEQUAL;\fR |
| 102 |
/*\fI .\|.\|. */ \fBACS_LEQUAL;\fR |
| 103 |
/*\fI .\|.\|. */ \fBACS_NEQUAL;\fR |
| 104 |
/*\fI .\|.\|. */ \fBACS_PI;\fR |
| 105 |
/*\fI .\|.\|. */ \fBACS_S3;\fR |
| 106 |
/*\fI .\|.\|. */ \fBACS_S7;\fR |
| 107 |
/*\fI .\|.\|. */ \fBACS_STERLING;\fR |
| 108 |
.fi |
| 109 |
.SH DESCRIPTION |
| 110 |
.SS waddch |
| 111 |
.B \%waddch |
| 112 |
writes the |
| 113 |
.I curses |
| 114 |
character |
| 115 |
.I ch |
| 116 |
to the window |
| 117 |
.IR win "," |
| 118 |
then advances the cursor position, |
| 119 |
analogously to the standard C library's \fI\%putchar\fP(3). |
| 120 |
\fB\%ncurses\fP(3NCURSES) describes the variants of this function. |
| 121 |
.PP |
| 122 |
Construct a |
| 123 |
.I curses |
| 124 |
character |
| 125 |
from a |
| 126 |
.I char |
| 127 |
by assignment or typecast. |
| 128 |
Subsection \*(``Video Attributes\*('' of \fB\%attron\fP(3NCURSES) describes |
| 129 |
how to manipulate its attributes and color pair. |
| 130 |
(A color pair selection is not honored unless initialized; |
| 131 |
see \fB\%start_color\fP(3NCURSES).) |
| 132 |
.PP |
| 133 |
The object or expression |
| 134 |
.I ch |
| 135 |
may contain attributes and/or a color pair identifier. |
| 136 |
(A |
| 137 |
.I \%chtype |
| 138 |
can be copied from place to place using \fB\%winch\fP(3NCURSES) and |
| 139 |
.BR \%waddch .) |
| 140 |
.I curses |
| 141 |
defines constants to aid the manipulation of character attributes; |
| 142 |
see \fB\%attr\fP(3NCURSES). |
| 143 |
A |
| 144 |
.I ch |
| 145 |
whose character component is a space, |
| 146 |
and whose only attribute is |
| 147 |
.BR \%A_NORMAL , |
| 148 |
is a |
| 149 |
.IR "blank character" "," |
| 150 |
and therefore combines with the window's background character; |
| 151 |
see \fB\%bkgd\fP(3NCURSES). |
| 152 |
.PP |
| 153 |
If |
| 154 |
.I ch |
| 155 |
is a |
| 156 |
backspace, |
| 157 |
carriage return, |
| 158 |
line feed, |
| 159 |
or |
| 160 |
tab, |
| 161 |
the cursor moves appropriately within the window. |
| 162 |
.bP |
| 163 |
Backspace moves the cursor one character left; |
| 164 |
at the left margin of a window, |
| 165 |
it does nothing. |
| 166 |
.bP |
| 167 |
Carriage return moves the cursor to the left margin on the same line of |
| 168 |
the window. |
| 169 |
.bP |
| 170 |
Line feed does a \fB\%clrtoeol\fP(3NCURSES), |
| 171 |
then advances as if from the right margin. |
| 172 |
.bP |
| 173 |
Tab advances the cursor to the next tab stop |
| 174 |
(possibly on the next line); |
| 175 |
these are placed at every eighth column by default. |
| 176 |
.IP |
| 177 |
Alter the tab interval with the |
| 178 |
.B \%TABSIZE |
| 179 |
extension; |
| 180 |
see \fB\%curses_variables\fP(3NCURSES). |
| 181 |
.PP |
| 182 |
If |
| 183 |
.I ch |
| 184 |
is any other nonprintable character, |
| 185 |
.I curses |
| 186 |
draws it in printable form using the same convention as |
| 187 |
\fB\%unctrl\fP(3NCURSES). |
| 188 |
Calling \fB\%winch\fP(3NCURSES) on the location of a nonprintable character |
| 189 |
does not return the character itself, |
| 190 |
but its \fB\%unctrl\fP(3NCURSES) representation. |
| 191 |
.PP |
| 192 |
Adding printable characters with \fB\%waddch\fP |
| 193 |
causes it to wrap at the right margin of the window: |
| 194 |
.bP |
| 195 |
If the cursor is not at the bottom of the scrolling region |
| 196 |
and advancement occurs at the right margin, |
| 197 |
the cursor automatically wraps to the beginning of the next line. |
| 198 |
.bP |
| 199 |
If the cursor is at the bottom of the scrolling region |
| 200 |
when advancement occurs at the right margin, |
| 201 |
and \fB\%scrollok\fP(3NCURSES) is enabled for |
| 202 |
.IR win , |
| 203 |
the scrolling region scrolls up one line |
| 204 |
and the cursor wraps as above. |
| 205 |
Otherwise, |
| 206 |
advancement and scrolling do not occur, |
| 207 |
and |
| 208 |
.B \%waddch |
| 209 |
returns |
| 210 |
.BR ERR "." |
| 211 |
.PP |
| 212 |
A window's margins may coincide with the screen boundaries. |
| 213 |
This may be a problem when |
| 214 |
.I \%ncurses |
| 215 |
updates the screen to match the curses window. |
| 216 |
When their right and bottom margins coincide, |
| 217 |
.I \%ncurses |
| 218 |
uses different strategies to handle the variations of scrolling and wrapping |
| 219 |
at the lower-right corner |
| 220 |
by depending on the terminal capabilities: |
| 221 |
.bP |
| 222 |
If the terminal does not automatically wrap as characters |
| 223 |
are added at the right margin |
| 224 |
(i.e., auto right margins), |
| 225 |
.I \%ncurses |
| 226 |
writes the character directly. |
| 227 |
.bP |
| 228 |
If the terminal has auto right margins, |
| 229 |
but also has capabilities for turning auto margins off and on, |
| 230 |
.I \%ncurses |
| 231 |
turns the auto margin feature off temporarily |
| 232 |
when writing to the lower-right corner. |
| 233 |
.bP |
| 234 |
If the terminal has an insertion mode which can be turned off and on, |
| 235 |
.I \%ncurses |
| 236 |
writes the character just before the lower-right corner, |
| 237 |
and then inserts a character to push the update into the corner. |
| 238 |
.SS wechochar |
| 239 |
.B \%echochar |
| 240 |
and |
| 241 |
.B \%wechochar |
| 242 |
are equivalent to calling |
| 243 |
.RB \%( w ) addch |
| 244 |
followed by |
| 245 |
.RB \%( w ) refresh |
| 246 |
on |
| 247 |
.B \%stdscr |
| 248 |
or the specified window. |
| 249 |
.I curses |
| 250 |
interprets these functions as a hint to its optimizer |
| 251 |
that only a single character cell in the window |
| 252 |
is being altered between refreshes; |
| 253 |
for non-control characters, |
| 254 |
a considerable performance gain may be enjoyed by employing them. |
| 255 |
.\" TODO: Combine the following with the "Line Drawing" subsection of |
| 256 |
.\" terminfo(5) and replace this with a cross reference there. |
| 257 |
.SS "Forms-Drawing Characters" |
| 258 |
.I curses |
| 259 |
defines macros starting with |
| 260 |
.B \%ACS_ |
| 261 |
that can be used with |
| 262 |
.B \%waddch |
| 263 |
to write line-drawing and other symbols to the screen. |
| 264 |
.I \%ncurses |
| 265 |
terms these |
| 266 |
.I "forms-drawing characters." |
| 267 |
.I curses |
| 268 |
uses the ACS default listed below if the terminal type lacks the |
| 269 |
.B \%acs_chars |
| 270 |
.RB \%( acsc ) |
| 271 |
capability; |
| 272 |
that capability does not define a replacement for the character; |
| 273 |
or if the terminal type and locale configuration |
| 274 |
require Unicode to access these characters, |
| 275 |
but the library is unable to use Unicode. |
| 276 |
The \*(``acsc char\*('' column corresponds to how the characters are |
| 277 |
specified in the |
| 278 |
.B \%acs_chars |
| 279 |
.RB \%( acsc ) |
| 280 |
string capability, |
| 281 |
and the characters in it may appear on the screen if the terminal type's |
| 282 |
database entry incorrectly advertises ACS support. |
| 283 |
The name \*(``ACS\*('' originates in the Alternate Character Set feature |
| 284 |
of the DEC VT100 terminal. |
| 285 |
.PP |
| 286 |
.ie t .ne 4v |
| 287 |
.el .ne 5v |
| 288 |
.TS |
| 289 |
Lb Lb Lb Lb |
| 290 |
Lb Lb Lb Lb |
| 291 |
Lb L L Lx. |
| 292 |
\& ACS acsc \& |
| 293 |
Symbol Default char Glyph Name |
| 294 |
_ |
| 295 |
ACS_BLOCK # 0 solid square block |
| 296 |
ACS_BOARD # h board of squares |
| 297 |
ACS_BTEE + v bottom tee |
| 298 |
ACS_BULLET o \*~ bullet |
| 299 |
ACS_CKBOARD : a checker board (stipple) |
| 300 |
ACS_DARROW v . arrow pointing down |
| 301 |
ACS_DEGREE \*' f degree symbol |
| 302 |
ACS_DIAMOND + \(ga diamond |
| 303 |
ACS_GEQUAL > > greater-than-or-equal-to |
| 304 |
ACS_HLINE \- q horizontal line |
| 305 |
ACS_LANTERN # i lantern symbol |
| 306 |
ACS_LARROW < , arrow pointing left |
| 307 |
ACS_LEQUAL < y less-than-or-equal-to |
| 308 |
ACS_LLCORNER + m lower left-hand corner |
| 309 |
ACS_LRCORNER + j lower right-hand corner |
| 310 |
ACS_LTEE + t left tee |
| 311 |
ACS_NEQUAL ! | not-equal |
| 312 |
ACS_PI * { greek pi |
| 313 |
ACS_PLMINUS # g plus/minus |
| 314 |
ACS_PLUS + n plus |
| 315 |
ACS_RARROW > + arrow pointing right |
| 316 |
ACS_RTEE + u right tee |
| 317 |
ACS_S1 \- o scan line 1 |
| 318 |
ACS_S3 \- p scan line 3 |
| 319 |
ACS_S7 \- r scan line 7 |
| 320 |
ACS_S9 \&_ s scan line 9 |
| 321 |
ACS_STERLING f } pound-sterling symbol |
| 322 |
ACS_TTEE + w top tee |
| 323 |
ACS_UARROW \*^ \- arrow pointing up |
| 324 |
ACS_ULCORNER + l upper left-hand corner |
| 325 |
ACS_URCORNER + k upper right-hand corner |
| 326 |
ACS_VLINE | x vertical line |
| 327 |
.TE |
| 328 |
.SH RETURN VALUE |
| 329 |
These functions return |
| 330 |
.B OK |
| 331 |
on success and |
| 332 |
.B ERR |
| 333 |
on failure. |
| 334 |
.PP |
| 335 |
In |
| 336 |
.IR \%ncurses , |
| 337 |
these functions fail if |
| 338 |
.bP |
| 339 |
the |
| 340 |
.I curses |
| 341 |
screen has not been initialized, |
| 342 |
.bP |
| 343 |
(for functions taking a |
| 344 |
.I \%WINDOW |
| 345 |
pointer argument) |
| 346 |
.I win |
| 347 |
is a null pointer, |
| 348 |
.bP |
| 349 |
wrapping to a new line is impossible because \fB\%scrollok\fP(3NCURSES) has |
| 350 |
not been called on |
| 351 |
.I win |
| 352 |
(or |
| 353 |
.BR \%stdscr "," |
| 354 |
as applicable) |
| 355 |
when a write to its bottom right location is attempted, |
| 356 |
or |
| 357 |
.bP |
| 358 |
it is not possible to add a complete character at the cursor position. |
| 359 |
.PP |
| 360 |
The last may be due to different causes: |
| 361 |
.bP |
| 362 |
conversion of a wide character to a multibyte character sequence can |
| 363 |
fail, |
| 364 |
or |
| 365 |
.bP |
| 366 |
at least one of the bytes resulting from wide character conversion to a |
| 367 |
multibyte character sequence cannot be added to the window. |
| 368 |
See section \*(``PORTABILITY\*('' below regarding the use of |
| 369 |
.B \%waddch |
| 370 |
with wide characters. |
| 371 |
.PP |
| 372 |
Functions prefixed with \*(``mv\*('' first perform cursor movement and |
| 373 |
fail if the position |
| 374 |
.RI ( y , |
| 375 |
.IR x ) |
| 376 |
is outside the window boundaries. |
| 377 |
.SH NOTES |
| 378 |
.BR \%addch "," |
| 379 |
.BR \%mvaddch "," |
| 380 |
.BR \%mvwaddch "," |
| 381 |
and |
| 382 |
.B \%echochar |
| 383 |
may be implemented as macros. |
| 384 |
.SH EXTENSIONS |
| 385 |
The symbols |
| 386 |
.IR \%ACS_S3 "," |
| 387 |
.IR \%ACS_S7 "," |
| 388 |
.IR \%ACS_LEQUAL "," |
| 389 |
.IR \%ACS_GEQUAL "," |
| 390 |
.IR \%ACS_PI "," |
| 391 |
.IR \%ACS_NEQUAL "," |
| 392 |
and |
| 393 |
.I \%ACS_STERLING |
| 394 |
were not documented in any publicly released System\ V |
| 395 |
.\" And did not exist yet as late as SVr4. |
| 396 |
.\" https://github.com/ryanwoodsmall/oldsysv/blob/master/\ |
| 397 |
.\" sysvr4/svr4/lib/xlibcurses/screen/curses.ed |
| 398 |
and are not standard. |
| 399 |
However, |
| 400 |
many publicly available |
| 401 |
.I \%term\%info |
| 402 |
entries include |
| 403 |
.B \%acs_chars |
| 404 |
.RB \%( acsc ) |
| 405 |
capabilities in which their key characters |
| 406 |
.RB ( pryz{|} ) |
| 407 |
are embedded, |
| 408 |
and a second-hand list of their character descriptions has come to light, |
| 409 |
which identifies them as VT100 special characters. |
| 410 |
.PP |
| 411 |
The DEC Special Character and Line Drawing Set (VT100) is indexed by |
| 412 |
an ASCII character in the range 96 (`) to 126 (~). |
| 413 |
That index character is part of the definition for the curses |
| 414 |
.B \%ACS_ |
| 415 |
symbols. |
| 416 |
The VT100 special characters can be categorized in three groups: |
| 417 |
.bP |
| 418 |
useful graphic symbols with a standard |
| 419 |
.B \%ACS_ |
| 420 |
symbol, |
| 421 |
(e.g., the line-drawing symbols), |
| 422 |
.bP |
| 423 |
possibly useful characters (these non-standard symbols), |
| 424 |
.bP |
| 425 |
representations of control characters (e.g., newline and vertical tabulation). |
| 426 |
.PP |
| 427 |
A few |
| 428 |
.B \%ACS_ |
| 429 |
symbols do not fit into DEC's VT100 scheme. |
| 430 |
The AT&T Teletype 5410v1 arrow symbols and |
| 431 |
.B \%ACS_BLOCK |
| 432 |
use indices outside the range 96 to 126. |
| 433 |
Two of the Teletype symbols use indices in that range, |
| 434 |
with different meaning versus the VT100: |
| 435 |
.bP |
| 436 |
.B \%ACS_BOARD |
| 437 |
corresponds to the VT100 symbol for newline |
| 438 |
.bP |
| 439 |
.B \%ACS_LANTERN |
| 440 |
corresponds to the VT100 symbol for vertical tabulation |
| 441 |
.PP |
| 442 |
AT&T defined |
| 443 |
.B \%ACS_ |
| 444 |
names for the most useful graphic symbols, |
| 445 |
as well as for its own. |
| 446 |
Its header file commented: |
| 447 |
.PP |
| 448 |
.EX |
| 449 |
.nf |
| 450 |
.\" Fill at 65 columns in your editor. |
| 451 |
/* |
| 452 |
* Standard alternate character set. The current ACS world is |
| 453 |
* evolving, so we support only a widely available subset: the |
| 454 |
* line drawing characters from the VT100, plus a few from the |
| 455 |
* Teletype 5410v1. Eventually there may be support of more |
| 456 |
* sophisticated ACS line drawing, such as that in the Teletype |
| 457 |
* 5410, the HP line drawing set, and the like. There may be |
| 458 |
* support for some non line oriented characters as well. |
| 459 |
* |
| 460 |
* Line drawing ACS names are of the form ACS_trbl, where t is |
| 461 |
* the top, r is the right, b is the bottom, and l is the left. |
| 462 |
* t, r, b, and l might be B (blank), S (single), D (double), or |
| 463 |
* T (thick). The subset defined here only uses B and S. |
| 464 |
*/ |
| 465 |
.fi |
| 466 |
.EE |
| 467 |
.PP |
| 468 |
Although these less-useful graphic symbols were not given names, |
| 469 |
they were used in |
| 470 |
.I \%terminfo |
| 471 |
entries. |
| 472 |
The |
| 473 |
.I \%ncurses |
| 474 |
developers invented ACS-prefixed names for them. |
| 475 |
.\" in v1_9_5_950928_e227 |
| 476 |
.SH PORTABILITY |
| 477 |
Applications employing |
| 478 |
.I \%ncurses |
| 479 |
extensions should condition their use on the visibility of the |
| 480 |
.B \%NCURSES_VERSION |
| 481 |
preprocessor macro. |
| 482 |
.PP |
| 483 |
X/Open Curses Issue\ 4 describes these functions. |
| 484 |
It specifies no error conditions for them. |
| 485 |
.PP |
| 486 |
SVr4 describes a successful return value only as |
| 487 |
\*(``an integer value other than |
| 488 |
.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 472 |
| 489 |
.PP |
| 490 |
The defaults specified for forms-drawing characters apply in the POSIX |
| 491 |
locale. |
| 492 |
.SS "ACS Symbols" |
| 493 |
X/Open Curses states that the |
| 494 |
.I \%ACS_ |
| 495 |
definitions are |
| 496 |
.I char |
| 497 |
constants. |
| 498 |
Some implementations are problematic. |
| 499 |
.bP |
| 500 |
Solaris |
| 501 |
.IR curses , |
| 502 |
for example, |
| 503 |
defines the ACS symbols as constants; |
| 504 |
others define them as elements of an array. |
| 505 |
.IP |
| 506 |
SVr4 used an array, |
| 507 |
.IR \%acs_map , |
| 508 |
as does |
| 509 |
.IR \%ncurses "." |
| 510 |
NetBSD |
| 511 |
.I curses |
| 512 |
also uses an array, |
| 513 |
actually named |
| 514 |
.IR \%_acs_char , |
| 515 |
with a \%\*(``#define\*('' for compatibility. |
| 516 |
.bP |
| 517 |
HP-UX |
| 518 |
.I curses |
| 519 |
equates some of the |
| 520 |
.I \%ACS_ |
| 521 |
symbols to the analogous |
| 522 |
.I \%WACS_ |
| 523 |
symbols as if the |
| 524 |
.I \%ACS_ |
| 525 |
symbols were wide characters |
| 526 |
(see \fB\%add_wch\fP(3NCURSES)). |
| 527 |
The misdefined symbols are the arrows and others that are not used for |
| 528 |
line drawing. |
| 529 |
.bP |
| 530 |
X/Open Curses |
| 531 |
(Issues\ 2 through 7) |
| 532 |
has a typographical error |
| 533 |
for the |
| 534 |
.I \%ACS_LANTERN |
| 535 |
symbol, equating its \*(``VT100+ Character\*('' to \*(``I\*('' |
| 536 |
(capital I), |
| 537 |
while the header files for SVr4 |
| 538 |
.I curses |
| 539 |
and other implementations use \*(``i\*('' |
| 540 |
(small i). |
| 541 |
.IP |
| 542 |
None of the terminal descriptions on Unix platforms use uppercase I, |
| 543 |
except for Solaris |
| 544 |
(in its |
| 545 |
.I \%term\%info |
| 546 |
entry for \fI\%screen\fP(1), |
| 547 |
apparently based on the X/Open documentation around 1995). |
| 548 |
On the other hand, |
| 549 |
its |
| 550 |
.B \%gs6300 |
| 551 |
(AT&T PC6300 with EMOTS Terminal Emulator) |
| 552 |
description uses lowercase i. |
| 553 |
.PP |
| 554 |
The |
| 555 |
.I displayed |
| 556 |
values of |
| 557 |
.I \%ACS_ |
| 558 |
constants depend on |
| 559 |
.bP |
| 560 |
the |
| 561 |
.I \%ncurses |
| 562 |
ABI \(em |
| 563 |
for example, |
| 564 |
wide-character versus non-wide-character configurations |
| 565 |
(the former is capable of displaying Unicode while the latter is not), |
| 566 |
and |
| 567 |
.bP |
| 568 |
whether the locale uses UTF-8 encoding. |
| 569 |
.PP |
| 570 |
In certain cases, |
| 571 |
the terminal is unable to display forms-drawing characters |
| 572 |
.I except |
| 573 |
by using UTF-8; |
| 574 |
see the discussion of the |
| 575 |
.I \%NCURSES_NO_UTF8_ACS |
| 576 |
environment variable in \fB\%ncurses\fP(3NCURSES). |
| 577 |
.SS "Character Set" |
| 578 |
X/Open Curses assumes that the parameter passed to |
| 579 |
.I \%waddch |
| 580 |
contains a single character. |
| 581 |
That character may have been more than eight bits wide in an SVr3 or |
| 582 |
SVr4 implementation, |
| 583 |
but X/Open Curses leaves the width of a non-wide character code |
| 584 |
unspecified. |
| 585 |
The standard further does not specify the internal structure of a |
| 586 |
.IR chtype "," |
| 587 |
though the use of bitwise operators to combine the character code with |
| 588 |
attributes and a color pair identifier into a |
| 589 |
.I \%chtype |
| 590 |
for passage to |
| 591 |
.I \%waddch |
| 592 |
is common. |
| 593 |
A portable application uses only the macros discussed in |
| 594 |
\fB\%attr\fP(3NCURSES) to manipulate a |
| 595 |
.IR \%chtype "." |
| 596 |
.PP |
| 597 |
In |
| 598 |
.IR \%ncurses , |
| 599 |
.I \%chtype |
| 600 |
holds an eight-bit character, |
| 601 |
but the library allows a multibyte character sequence to be passed via a |
| 602 |
succession of calls to |
| 603 |
.IR \%waddch "." |
| 604 |
Other implementations do not; |
| 605 |
a |
| 606 |
.I \%waddch |
| 607 |
call transmits exactly one character, |
| 608 |
which may be rendered in one or more screen locations depending on |
| 609 |
whether it is printable |
| 610 |
(see \fB\%unctrl\fP(3NCURSES)). |
| 611 |
Depending on the locale, |
| 612 |
.I \%ncurses |
| 613 |
inspects the byte passed in each |
| 614 |
.I \%waddch |
| 615 |
call and checks whether the latest call continues a multibyte character. |
| 616 |
When a character is |
| 617 |
.IR complete "," |
| 618 |
.I \%ncurses |
| 619 |
displays the character and advances the cursor. |
| 620 |
If the calling application interrupts the succession of bytes in |
| 621 |
a multibyte character sequence by changing the current location \(em |
| 622 |
for example, |
| 623 |
with \fB\%wmove\fP(3NCURSES) \(em |
| 624 |
.I \%ncurses |
| 625 |
discards the incomplete character. |
| 626 |
.PP |
| 627 |
For portability to other implementations, |
| 628 |
do not rely upon the foregoing behavior. |
| 629 |
Check whether a character can be represented as a single byte in the |
| 630 |
current locale. |
| 631 |
.bP |
| 632 |
If it can, |
| 633 |
call either |
| 634 |
.I \%waddch |
| 635 |
or |
| 636 |
.IR \%wadd_wch "." |
| 637 |
.bP |
| 638 |
If it cannot, |
| 639 |
use only |
| 640 |
.IR \%wadd_wch "." |
| 641 |
.SH HISTORY |
| 642 |
4BSD (1980) |
| 643 |
introduced |
| 644 |
.I \%waddch |
| 645 |
and its variants. |
| 646 |
.PP |
| 647 |
SVr3 (1987) |
| 648 |
added the |
| 649 |
.I \%echochar |
| 650 |
and |
| 651 |
.I \%wechochar |
| 652 |
functions and most of the |
| 653 |
.I ACS_ |
| 654 |
constants, |
| 655 |
except for |
| 656 |
.IR \%ACS_GEQUAL "," |
| 657 |
.IR \%ACS_LEQUAL "," |
| 658 |
.IR \%ACS_NEQUAL "," |
| 659 |
.IR \%ACS_PI "," |
| 660 |
.IR \%ACS_S3 "," |
| 661 |
.IR \%ACS_S7 "," |
| 662 |
and |
| 663 |
.IR \%ACS_STERLING "." |
| 664 |
.PP |
| 665 |
.I \%ncurses |
| 666 |
1.9.6 (1995) |
| 667 |
furnished the remaining |
| 668 |
.I ACS_ |
| 669 |
constants. |
| 670 |
.SH SEE ALSO |
| 671 |
\fB\%add_wch\fP(3NCURSES) describes comparable functions of the |
| 672 |
.I \%ncurses |
| 673 |
library in its wide-character configuration |
| 674 |
.RI \%( ncursesw ). |
| 675 |
.PP |
| 676 |
\fB\%ncurses\fP(3NCURSES), |
| 677 |
\fB\%addchstr\fP(3NCURSES), |
| 678 |
\fB\%addstr\fP(3NCURSES), |
| 679 |
\fB\%attr\fP(3NCURSES), |
| 680 |
\fB\%bkgd\fP(3NCURSES), |
| 681 |
\fB\%clear\fP(3NCURSES), |
| 682 |
\fB\%inch\fP(3NCURSES), |
| 683 |
\fB\%outopts\fP(3NCURSES), |
| 684 |
\fB\%refresh\fP(3NCURSES), |
| 685 |
\fB\%curses_variables\fP(3NCURSES), |
| 686 |
\fB\%putchar\fP(3) |