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