| 1 |
'\" t |
| 2 |
.\"*************************************************************************** |
| 3 |
.\" Copyright 2018-2024,2025 Thomas E. Dickey * |
| 4 |
.\" Copyright 1998-2010,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_inch.3x,v 1.70 2025/02/15 19:36:03 tom Exp $ |
| 32 |
.TH inch 3NCURSES 2025-02-15 "ncurses 6.6" "Library calls" |
| 33 |
.ie \n(.g \{\ |
| 34 |
.ds `` \(lq |
| 35 |
.ds '' \(rq |
| 36 |
.\} |
| 37 |
.el \{\ |
| 38 |
.ie t .ds `` `` |
| 39 |
.el .ds `` "" |
| 40 |
.ie t .ds '' '' |
| 41 |
.el .ds '' "" |
| 42 |
.\} |
| 43 |
. |
| 44 |
.de bP |
| 45 |
.ie n .IP \(bu 4 |
| 46 |
.el .IP \(bu 2 |
| 47 |
.. |
| 48 |
.SH NAME |
| 49 |
\fB\%inch\fP, |
| 50 |
\fB\%winch\fP, |
| 51 |
\fB\%mvinch\fP, |
| 52 |
\fB\%mvwinch\fP \- |
| 53 |
get a \fIcurses\fR character from a window |
| 54 |
.SH SYNOPSIS |
| 55 |
.nf |
| 56 |
\fB#include <curses.h> |
| 57 |
.PP |
| 58 |
\fBchtype inch(void); |
| 59 |
\fBchtype winch(WINDOW * \fIwin\fP); |
| 60 |
\fBchtype mvinch(int \fIy\fP, int \fIx\fP); |
| 61 |
\fBchtype mvwinch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP); |
| 62 |
.fi |
| 63 |
.SH DESCRIPTION |
| 64 |
.B \%winch |
| 65 |
returns the |
| 66 |
.I curses |
| 67 |
character, |
| 68 |
including its attributes and color pair identifier, |
| 69 |
at the cursor position in the window |
| 70 |
.IR win "." |
| 71 |
Subsection \*(``Video Attributes\*('' of \fB\%attron\fP(3NCURSES) explains |
| 72 |
how to extract these data from a |
| 73 |
.IR chtype "." |
| 74 |
\fB\%ncurses\fP(3NCURSES) describes the variants of this function. |
| 75 |
.SH RETURN VALUE |
| 76 |
These functions return |
| 77 |
.B OK |
| 78 |
on success and |
| 79 |
.B ERR |
| 80 |
on failure. |
| 81 |
.PP |
| 82 |
In |
| 83 |
.IR \%ncurses "," |
| 84 |
they return |
| 85 |
.B ERR |
| 86 |
if |
| 87 |
.I win |
| 88 |
is |
| 89 |
.IR NULL "." |
| 90 |
.PP |
| 91 |
Functions prefixed with \*(``mv\*('' first perform cursor movement and |
| 92 |
fail if the position |
| 93 |
.RI ( y , |
| 94 |
.IR x ) |
| 95 |
is outside the window boundaries. |
| 96 |
.SH NOTES |
| 97 |
.BR \%inch , |
| 98 |
.BR \%mvinch , |
| 99 |
and |
| 100 |
.B \%mvwinch |
| 101 |
may be implemented as macros. |
| 102 |
.PP |
| 103 |
These functions do not fail if the window contains cells of |
| 104 |
.I curses |
| 105 |
complex characters; |
| 106 |
that is, |
| 107 |
if they contain characters with codes wider than eight bits |
| 108 |
(or greater than 255 as an unsigned decimal integer). |
| 109 |
They instead extract only the low-order eight bits of the character code |
| 110 |
from the cell. |
| 111 |
.SH PORTABILITY |
| 112 |
X/Open Curses Issue\ 4 describes these functions. |
| 113 |
It specifies no error conditions for them. |
| 114 |
.SH HISTORY |
| 115 |
The original |
| 116 |
.I curses |
| 117 |
in 4BSD (1980) defined |
| 118 |
.I \%winch |
| 119 |
as a macro accessing the |
| 120 |
.I \%WINDOW |
| 121 |
structure member representing character cell data, |
| 122 |
at that time a |
| 123 |
.IR char "," |
| 124 |
containing only a 7-bit ASCII character code |
| 125 |
and a \*(``standout\*(`` attribute bit, |
| 126 |
the only one the library supported. |
| 127 |
.PP |
| 128 |
SVr2 |
| 129 |
.I curses |
| 130 |
(1984) |
| 131 |
extended this approach, |
| 132 |
widening the character code to eight bits |
| 133 |
and permitting several attributes to be combined with it |
| 134 |
by storing them together in a |
| 135 |
.IR \%chtype "," |
| 136 |
an alias of |
| 137 |
.IR "unsigned short" "." |
| 138 |
.\" ...indirectly through a preprocessor macro named CHTYPE, encouraging |
| 139 |
.\" builders to change the typedef to `char` or `long` as desired. More |
| 140 |
.\" innocent times with respect to ABI compatibility concerns... --GBR |
| 141 |
Because a macro was used, |
| 142 |
its value was not type-checked |
| 143 |
as a function return value could have been. |
| 144 |
Goodheart documented SVr3 (1987) |
| 145 |
.I \%winch |
| 146 |
as returning an |
| 147 |
.IR int "." |
| 148 |
.\" ...but the implementation remained unchanged. |
| 149 |
SVr3.1's (1987) |
| 150 |
.I \%chtype |
| 151 |
became an alias of |
| 152 |
.IR "unsigned long" "," |
| 153 |
using 16 bits for the character code and |
| 154 |
widening the type in practical terms to 32 bits, |
| 155 |
as 64-bit Unix systems were not yet in wide use, |
| 156 |
and fixed-width integral types would not be standard until ISO C99. |
| 157 |
.\" Cray's UNICOS was 1985 (how many shops had Crays?). DEC OSF/1 for |
| 158 |
.\" the Alpha arrived in 1993. --GBR |
| 159 |
SVr3.2 (1988) |
| 160 |
added a 6-bit color pair identifier alongside the attributes. |
| 161 |
.SH SEE ALSO |
| 162 |
\fB\%in_wch\fP(3NCURSES) describes comparable functions of the |
| 163 |
.I \%ncurses |
| 164 |
library in its wide-character configuration |
| 165 |
.RI \%( ncursesw ). |
| 166 |
.PP |
| 167 |
\fB\%ncurses\fP(3NCURSES), |
| 168 |
\fB\%instr\fP(3NCURSES) |