]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_inch.3x
ncurses 6.1 - patch 20180210
[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.20 2017/11/18 23:47:37 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.  If any attributes are set for that position,
55 their values are OR'ed into the value returned.  Constants defined in
56 \fB<curses.h>\fR can be used with the \fB&\fR (logical AND) operator to
57 extract the character or attributes alone.
58 .
59 .SS Attributes
60 The following bit-masks may be AND-ed with characters returned by \fBwinch\fR.
61 .
62 .TS
63 l l .
64 \fBA_CHARTEXT\fR        Bit-mask to extract character
65 \fBA_ATTRIBUTES\fR      Bit-mask to extract attributes
66 \fBA_COLOR\fR   Bit-mask to extract color-pair field information
67 .TE
68 .SH RETURN VALUE
69 Functions with a "mv" prefix first perform a cursor movement using
70 \fBwmove\fP, and return an error if the position is outside the window,
71 or if the window pointer is null.
72 .PP
73 The \fBwinch\fP function does not return an error if the window contains
74 characters larger than 8-bits (255).
75 Only the low-order 8 bits of the character are used by \fBwinch\fP.
76 .SH NOTES
77 Note that all of these routines may be macros.
78 .SH PORTABILITY
79 These functions are described in the XSI Curses standard, Issue 4.
80 .PP
81 Very old systems (before standardization) provide a different function
82 with the same name:
83 .bP
84 The \fBwinch\fP function was part of the original BSD curses library,
85 which stored a 7-bit character combined with the \fIstandout\fP attribute.
86 .IP
87 In BSD curses, \fBwinch\fP returned only the character (as an integer)
88 with the \fIstandout\fP attribute removed.
89 .bP
90 System V curses added support for several video attributes which
91 could be combined with characters in the window.
92 .IP
93 Reflecting this improvement, the function was altered to return the
94 character combined with all video attributes in a \fBchtype\fP value.
95 .PP
96 X/Open Curses does not specify 
97 the size and layout of attributes, color and character values in
98 \fBchtype\fP; it is implementation-dependent.
99 This implementation uses 8 bits for character values.
100 An application using more bits, e.g., a Unicode value,
101 should use the wide-character equivalents to these functions.
102 .SH SEE ALSO
103 .TP 5
104 \fBcurses\fR(3X)
105 gives an overview of the WINDOW and \fBchtype\fP data types.
106 .TP 5
107 \fBcurs_attr\fR(3X)
108 goes into more detail, pointing out portability problems and
109 constraints on the use of \fBchtype\fP for returning window information.
110 .TP 5
111 \fBcurs_in_wch\fR(3X)
112 describes comparable functions for the wide-character (ncursesw) library.