]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_inch.3x
ncurses 6.1 - patch 20190518
[ncurses.git] / man / curs_inch.3x
1 '\" t
2 .\"***************************************************************************
3 .\" Copyright (c) 1998-2017,2018 Free Software Foundation, Inc.              *
4 .\"                                                                          *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
6 .\" copy of this software and associated documentation files (the            *
7 .\" "Software"), to deal in the Software without restriction, including      *
8 .\" without limitation the rights to use, copy, modify, merge, publish,      *
9 .\" distribute, distribute with modifications, sublicense, and/or sell       *
10 .\" copies of the Software, and to permit persons to whom the Software is    *
11 .\" furnished to do so, subject to the following conditions:                 *
12 .\"                                                                          *
13 .\" The above copyright notice and this permission notice shall be included  *
14 .\" in all copies or substantial portions of the Software.                   *
15 .\"                                                                          *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23 .\"                                                                          *
24 .\" Except as contained in this notice, the name(s) of the above copyright   *
25 .\" holders shall not be used in advertising or otherwise to promote the     *
26 .\" sale, use or other dealings in this Software without prior written       *
27 .\" authorization.                                                           *
28 .\"***************************************************************************
29 .\"
30 .\" $Id: curs_inch.3x,v 1.21 2018/07/28 21:34:06 tom Exp $
31 .TH curs_inch 3X ""
32 .de bP
33 .ie n  .IP \(bu 4
34 .el    .IP \(bu 2
35 ..
36 .SH NAME
37 \fBinch\fR,
38 \fBwinch\fR,
39 \fBmvinch\fR,
40 \fBmvwinch\fR \- get a character and attributes from a \fBcurses\fR window
41 .SH SYNOPSIS
42 \fB#include <curses.h>\fR
43 .sp
44 \fBchtype inch(void);\fR
45 .br
46 \fBchtype winch(WINDOW *win);\fR
47 .br
48 \fBchtype mvinch(int y, int x);\fR
49 .br
50 \fBchtype mvwinch(WINDOW *win, int y, int x);\fR
51 .br
52 .SH DESCRIPTION
53 These routines return the character, of type \fBchtype\fR, at the current
54 position in the named window.
55 If any attributes are set for that position,
56 their values are OR'ed into the value returned.
57 Constants defined in
58 \fB<curses.h>\fR can be used with the \fB&\fR (logical AND) operator to
59 extract the character or attributes alone.
60 .
61 .SS Attributes
62 The following bit-masks may be AND-ed with characters returned by \fBwinch\fR.
63 .
64 .TS
65 l l .
66 \fBA_CHARTEXT\fR        Bit-mask to extract character
67 \fBA_ATTRIBUTES\fR      Bit-mask to extract attributes
68 \fBA_COLOR\fR   Bit-mask to extract color-pair field information
69 .TE
70 .SH RETURN VALUE
71 Functions with a "mv" prefix first perform a cursor movement using
72 \fBwmove\fP, and return an error if the position is outside the window,
73 or if the window pointer is null.
74 .PP
75 The \fBwinch\fP function does not return an error if the window contains
76 characters larger than 8-bits (255).
77 Only the low-order 8 bits of the character are used by \fBwinch\fP.
78 .SH NOTES
79 Note that all of these routines may be macros.
80 .SH PORTABILITY
81 These functions are described in the XSI Curses standard, Issue 4.
82 .PP
83 Very old systems (before standardization) provide a different function
84 with the same name:
85 .bP
86 The \fBwinch\fP function was part of the original BSD curses library,
87 which stored a 7-bit character combined with the \fIstandout\fP attribute.
88 .IP
89 In BSD curses, \fBwinch\fP returned only the character (as an integer)
90 with the \fIstandout\fP attribute removed.
91 .bP
92 System V curses added support for several video attributes which
93 could be combined with characters in the window.
94 .IP
95 Reflecting this improvement, the function was altered to return the
96 character combined with all video attributes in a \fBchtype\fP value.
97 .PP
98 X/Open Curses does not specify 
99 the size and layout of attributes, color and character values in
100 \fBchtype\fP; it is implementation-dependent.
101 This implementation uses 8 bits for character values.
102 An application using more bits, e.g., a Unicode value,
103 should use the wide-character equivalents to these functions.
104 .SH SEE ALSO
105 .TP 5
106 \fBcurses\fR(3X)
107 gives an overview of the WINDOW and \fBchtype\fP data types.
108 .TP 5
109 \fBcurs_attr\fR(3X)
110 goes into more detail, pointing out portability problems and
111 constraints on the use of \fBchtype\fP for returning window information.
112 .TP 5
113 \fBcurs_in_wch\fR(3X)
114 describes comparable functions for the wide-character (ncursesw) library.