]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_inch.3x
ncurses 6.2 - patch 20200509
[ncurses.git] / man / curs_inch.3x
1 '\" t
2 .\"***************************************************************************
3 .\" Copyright 2018-2019,2020 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.23 2020/02/02 23:34:34 tom Exp $
32 .TH curs_inch 3X ""
33 .ie \n(.g .ds `` \(lq
34 .el       .ds `` ``
35 .ie \n(.g .ds '' \(rq
36 .el       .ds '' ''
37 .de bP
38 .ie n  .IP \(bu 4
39 .el    .IP \(bu 2
40 ..
41 .SH NAME
42 \fBinch\fR,
43 \fBwinch\fR,
44 \fBmvinch\fR,
45 \fBmvwinch\fR \- get a character and attributes from a \fBcurses\fR window
46 .SH SYNOPSIS
47 \fB#include <curses.h>\fR
48 .sp
49 \fBchtype inch(void);\fR
50 .br
51 \fBchtype winch(WINDOW *win);\fR
52 .br
53 \fBchtype mvinch(int y, int x);\fR
54 .br
55 \fBchtype mvwinch(WINDOW *win, int y, int x);\fR
56 .br
57 .SH DESCRIPTION
58 These routines return the character, of type \fBchtype\fR, at the current
59 position in the named window.
60 If any attributes are set for that position,
61 their values are OR'ed into the value returned.
62 Constants defined in
63 \fB<curses.h>\fR can be used with the \fB&\fR (logical AND) operator to
64 extract the character or attributes alone.
65 .
66 .SS Attributes
67 The following bit-masks may be AND-ed with characters returned by \fBwinch\fR.
68 .
69 .TS
70 l l .
71 \fBA_CHARTEXT\fR        Bit-mask to extract character
72 \fBA_ATTRIBUTES\fR      Bit-mask to extract attributes
73 \fBA_COLOR\fR   Bit-mask to extract color-pair field information
74 .TE
75 .SH RETURN VALUE
76 Functions with a \*(``mv\*('' prefix first perform a cursor movement using
77 \fBwmove\fP, and return an error if the position is outside the window,
78 or if the window pointer is null.
79 .PP
80 The \fBwinch\fP function does not return an error if the window contains
81 characters larger than 8-bits (255).
82 Only the low-order 8 bits of the character are used by \fBwinch\fP.
83 .SH NOTES
84 Note that all of these routines may be macros.
85 .SH PORTABILITY
86 These functions are described in the XSI Curses standard, Issue 4.
87 .PP
88 Very old systems (before standardization) provide a different function
89 with the same name:
90 .bP
91 The \fBwinch\fP function was part of the original BSD curses library,
92 which stored a 7-bit character combined with the \fIstandout\fP attribute.
93 .IP
94 In BSD curses, \fBwinch\fP returned only the character (as an integer)
95 with the \fIstandout\fP attribute removed.
96 .bP
97 System V curses added support for several video attributes which
98 could be combined with characters in the window.
99 .IP
100 Reflecting this improvement, the function was altered to return the
101 character combined with all video attributes in a \fBchtype\fP value.
102 .PP
103 X/Open Curses does not specify 
104 the size and layout of attributes, color and character values in
105 \fBchtype\fP; it is implementation-dependent.
106 This implementation uses 8 bits for character values.
107 An application using more bits, e.g., a Unicode value,
108 should use the wide-character equivalents to these functions.
109 .SH SEE ALSO
110 .TP 5
111 \fBcurses\fR(3X)
112 gives an overview of the WINDOW and \fBchtype\fP data types.
113 .TP 5
114 \fBcurs_attr\fR(3X)
115 goes into more detail, pointing out portability problems and
116 constraints on the use of \fBchtype\fP for returning window information.
117 .TP 5
118 \fBcurs_in_wch\fR(3X)
119 describes comparable functions for the wide-character (ncursesw) library.