blob: 962e9dc868d444f72ea0ceeffa1f24a9513655c9 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301'\" t
2.\"***************************************************************************
micky3879b9f5e72025-07-08 18:04:53 -04003.\" Copyright 2018-2023,2024 Thomas E. Dickey *
4.\" Copyright 1998-2010,2017 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05305.\" *
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.\"
micky3879b9f5e72025-07-08 18:04:53 -040031.\" $Id: curs_inch.3x,v 1.51 2024/04/20 21:20:07 tom Exp $
32.TH curs_inch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "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..
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053048.SH NAME
micky3879b9f5e72025-07-08 18:04:53 -040049\fB\%inch\fP,
50\fB\%winch\fP,
51\fB\%mvinch\fP,
52\fB\%mvwinch\fP \-
53get a \fIcurses\fR character from a window
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053054.SH SYNOPSIS
micky3879b9f5e72025-07-08 18:04:53 -040055.nf
56\fB#include <curses.h>
57.PP
58\fBchtype inch(void);
59\fBchtype winch(WINDOW *\fIwin\fP);
60.PP
61\fBchtype mvinch(int \fIy\fP, int \fIx\fP);
62\fBchtype mvwinch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
63.fi
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053064.SH DESCRIPTION
micky3879b9f5e72025-07-08 18:04:53 -040065These routines return the character, of type \fBchtype\fP, at the current
66position in the named window.
67If any attributes are set for that position,
68their values are OR'ed into the value returned.
69Constants defined in
70\fB<curses.h>\fP can be used with the \fB&\fP (logical AND) operator to
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053071extract the character or attributes alone.
72.
73.SS Attributes
micky3879b9f5e72025-07-08 18:04:53 -040074The following bit masks may be AND-ed with characters returned by \fBwinch\fP.
75.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053076.TS
micky3879b9f5e72025-07-08 18:04:53 -040077Lb Lb
78Lb Lx.
79Name Description
80_
81A_CHARTEXT Extract character
82A_ATTRIBUTES Extract attributes
83A_COLOR Extract color pair information
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053084.TE
Steve Kondikae271bc2015-11-15 02:50:53 +010085.SH RETURN VALUE
micky3879b9f5e72025-07-08 18:04:53 -040086Functions prefixed with \*(``mv\*('' first perform cursor movement and
87fail if the position
88.RI ( y ,
89.IR x )
90is outside the window boundaries.
91.PP
92The \fBwinch\fP function does not return an error if the window contains
93characters larger than 8-bits (255).
94Only the low-order 8 bits of the character are used by \fBwinch\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053095.SH NOTES
96Note that all of these routines may be macros.
97.SH PORTABILITY
micky3879b9f5e72025-07-08 18:04:53 -040098These functions are described in X/Open Curses, Issue 4.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053099.PP
micky3879b9f5e72025-07-08 18:04:53 -0400100Very old systems (before standardization) provide a different function
101with the same name:
102.bP
103The \fBwinch\fP function was part of the original BSD curses library,
104which stored a 7-bit character combined with the \fIstandout\fP attribute.
105.IP
106In BSD curses, \fBwinch\fP returned only the character (as an integer)
107with the \fIstandout\fP attribute removed.
108.bP
109System V curses added support for several video attributes which
110could be combined with characters in the window.
111.IP
112Reflecting this improvement, the function was altered to return the
113character combined with all video attributes in a \fBchtype\fP value.
114.PP
115X/Open Curses does not specify
116the size and layout of attributes, color and character values in
117\fBchtype\fP; it is implementation-dependent.
118This implementation uses 8 bits for character values.
119An application using more bits, e.g., a Unicode value,
120should use the wide-character equivalents to these functions.
121.SH SEE ALSO
122\fB\%curs_in_wch\fP(3X) describes comparable functions of the
123.I \%ncurses
124library in its wide-character configuration
125.RI ( \%ncursesw ).
126.PP
127\fB\%curses\fP(3X),
128\fB\%curs_instr\fP(3X)