]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - man/curs_inch.3x
ncurses 6.5 - patch 20240511
[ncurses.git] / man / curs_inch.3x
index 9cfb6cef45a55d08ade1f0f1304db7c3d9b24dc4..17be0fb9e5a86f9f62b283c8390896ecab37ceea 100644 (file)
-.\" $Id: curs_inch.3x,v 1.7 1997/01/05 01:29:23 tom Exp $
-.TH curs_inch 3X ""
+'\" t
+.\"***************************************************************************
+.\" Copyright 2018-2023,2024 Thomas E. Dickey                                *
+.\" Copyright 1998-2010,2017 Free Software Foundation, Inc.                  *
+.\"                                                                          *
+.\" Permission is hereby granted, free of charge, to any person obtaining a  *
+.\" copy of this software and associated documentation files (the            *
+.\" "Software"), to deal in the Software without restriction, including      *
+.\" without limitation the rights to use, copy, modify, merge, publish,      *
+.\" distribute, distribute with modifications, sublicense, and/or sell       *
+.\" copies of the Software, and to permit persons to whom the Software is    *
+.\" furnished to do so, subject to the following conditions:                 *
+.\"                                                                          *
+.\" The above copyright notice and this permission notice shall be included  *
+.\" in all copies or substantial portions of the Software.                   *
+.\"                                                                          *
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+.\"                                                                          *
+.\" Except as contained in this notice, the name(s) of the above copyright   *
+.\" holders shall not be used in advertising or otherwise to promote the     *
+.\" sale, use or other dealings in this Software without prior written       *
+.\" authorization.                                                           *
+.\"***************************************************************************
+.\"
+.\" $Id: curs_inch.3x,v 1.52 2024/05/11 20:39:53 tom Exp $
+.TH curs_inch 3X 2024-05-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
+.ie \n(.g \{\
+.ds `` \(lq
+.ds '' \(rq
+.\}
+.el \{\
+.ie t .ds `` ``
+.el   .ds `` ""
+.ie t .ds '' ''
+.el   .ds '' ""
+.\}
+.
+.de bP
+.ie n  .IP \(bu 4
+.el    .IP \(bu 2
+..
 .SH NAME
-\fBinch\fR, \fBwinch\fR, \fBmvinch\fR, \fBmvwinch\fR
-- get a character and attributes from a \fBcurses\fR window
+\fB\%inch\fP,
+\fB\%winch\fP,
+\fB\%mvinch\fP,
+\fB\%mvwinch\fP \-
+get a \fIcurses\fR character from a window
 .SH SYNOPSIS
-\fB#include <curses.h>\fR
-
-\fBchtype inch(void);\fR
-.br
-\fBchtype winch(WINDOW *win);\fR
-.br
-\fBchtype mvinch(int y, int x);\fR
-.br
-\fBchtype mvwinch(WINDOW *win, int y, int x);\fR
-.br
+.nf
+\fB#include <curses.h>
+.PP
+\fBchtype inch(void);
+\fBchtype winch(WINDOW *\fIwin\fP);
+\fBchtype mvinch(int \fIy\fP, int \fIx\fP);
+\fBchtype mvwinch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
+.fi
 .SH DESCRIPTION
-These routines return the character, of type \fBchtype\fR, at the current
-position in the named window.  If any attributes are set for that position,
-their values are OR'ed into the value returned.  Constants defined in
-\fB<curses.h>\fR can be used with the \fB&\fR (logical AND) operator to
-extract the character or attributes alone.
-
-.SS Attributes
-The following bit-masks may be AND-ed with characters returned by \fBwinch\fR.
-
-.TS
-l l .
-\fBA_CHARTEXT\fR       Bit-mask to extract character
-\fBA_ATTRIBUTES\fR     Bit-mask to extract attributes
-\fBA_COLOR\fR          Bit-mask to extract color-pair field information
-.TE
+.B \%winch
+returns the
+.I curses
+character,
+including rendering attributes and color pair identifier,
+at the cursor position in the window
+.IR win "."
+Subsection \*(``Video Attributes\*('' of \fB\%attron\fP(3X) explains
+how to extract these data from a
+.IR chtype "."
+\fB\%ncurses\fP(3X) describes the variants of this function.
+.SH RETURN VALUE
+Functions prefixed with \*(``mv\*('' first perform cursor movement and
+fail if the position
+.RI ( y ,
+.IR x )
+is outside the window boundaries.
+.PP
+These functions do not return an error if the window comprises cells of
+.I curses
+complex characters
+(that is,
+they contain characters with codes wider than eight bits,
+or greater than 255 as an unsigned decimal integer).
+They instead extract only the low-order eight bits of character data
+in the cell.
 .SH NOTES
-Note that all of these routines may be macros.
+.BR \%inch ,
+.BR \%mvinch ,
+and
+.B \%mvwinch
+may be implemented as macros.
 .SH PORTABILITY
-These functions are described in the XSI Curses standard, Issue 4.
+X/Open Curses,
+Issue 4 describes these functions.
+It specifies no error conditions for them.
+.SH HISTORY
+.B \%winch
+was implemented in the original 4BSD
+.I curses
+library
+(November 1980).
+It returned only the character code
+(as an integer)
+with the \*(``standout\*(`` attribute bit
+(the only one it supported)
+cleared.
+Because 7-bit ASCII was the only character encoding supported,
+4BSD's
+.B \%winch
+returned a
+.I char
+type.
+.\" Through macros, it directly accessed a `char` structure member.
+.PP
+System\ V
+.I curses
+(1983) permitted several rendering attributes to be combined with a
+character in a window.
+Reflecting this improvement,
+.B \%winch
+.\" XXX: possibly returned a `short` in SVr1 through SVr3 --GBR
+returned an
+.I int
+in SVr3.2 (1988)
+and switched to
+.I chtype
+in SVr4 (1989).
+.PP
+X/Open Curses does not specify the sizes of the character code or
+color pair identifier,
+nor the quantity of rendering attribute bits,
+in
+.IR chtype ";"
+these are implementation-dependent.
+.I \%ncurses
+uses eight bits for the character code.
+An application requiring a wider character type,
+for instance to handle Unicode,
+should use the wide-character counterparts of these functions.
 .SH SEE ALSO
-\fBcurses\fR(3X).
-.\"#
-.\"# The following sets edit modes for GNU EMACS
-.\"# Local Variables:
-.\"# mode:nroff
-.\"# fill-column:79
-.\"# End:
+\fB\%curs_in_wch\fP(3X) describes comparable functions of the
+.I \%ncurses
+library in its wide-character configuration
+.RI ( \%ncursesw ).
+.PP
+\fB\%curses\fP(3X),
+\fB\%curs_instr\fP(3X)