]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - man/curs_util.3x
ncurses 6.4 - patch 20230918
[ncurses.git] / man / curs_util.3x
index c5d64f200b24540699b72fbefc385dbfbd86d824..6390749b590e284df1e24f52394e5e5b9cd3ca2e 100644 (file)
@@ -28,8 +28,8 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_util.3x,v 1.66 2023/03/11 20:28:02 tom Exp $
-.TH curs_util 3X ""
+.\" $Id: curs_util.3x,v 1.77 2023/09/16 23:37:03 tom Exp $
+.TH curs_util 3X 2023-09-16 "ncurses 6.4" "Library calls"
 .ie \n(.g .ds `` \(lq
 .el       .ds `` ``
 .ie \n(.g .ds '' \(rq
 .ie n  .IP \(bu 4
 .el    .IP \(bu 2
 ..
-.na
-.hy 0
 .SH NAME
-\fBdelay_output\fP,
-\fBfilter\fP,
-\fBflushinp\fP,
-\fBgetwin\fP,
-\fBkey_name\fP,
-\fBkeyname\fP,
-\fBnofilter\fP,
-\fBputwin\fP,
-\fBunctrl\fP,
-\fBuse_env\fP,
-\fBuse_tioctl\fP,
-\fBwunctrl\fP \- miscellaneous \fBcurses\fP utility routines
-.ad
-.hy
+\fB\%delay_output\fP,
+\fB\%filter\fP,
+\fB\%flushinp\fP,
+\fB\%getwin\fP,
+\fB\%key_name\fP,
+\fB\%keyname\fP,
+\fB\%nofilter\fP,
+\fB\%putwin\fP,
+\fB\%unctrl\fP,
+\fB\%use_env\fP,
+\fB\%use_tioctl\fP,
+\fB\%wunctrl\fP \-
+miscellaneous \fIcurses\fR utility routines
 .SH SYNOPSIS
 \fB#include <curses.h>\fP
 .sp
 \fBconst char *key_name(wchar_t \fIw\fB);\fR
 .sp
 \fBvoid filter(void);\fP
-.br
-\fBvoid nofilter(void);\fP
 .sp
 \fBvoid use_env(bool \fIf\fB);\fR
-.br
-\fBvoid use_tioctl(bool \fIf\fB);\fR
 .sp
 \fBint putwin(WINDOW *\fIwin\fB, FILE *\fIfilep\fB);\fR
 .br
 \fBint delay_output(int \fIms\fB);\fR
 .br
 \fBint flushinp(void);\fP
+.sp
+/* extensions */
 .br
+\fBvoid nofilter(void);\fP
+.br
+\fBvoid use_tioctl(bool \fIf\fB);\fR
 .SH DESCRIPTION
 .SS unctrl
-.PP
 The \fBunctrl\fP routine returns a character string which is a printable
-representation of the character \fIc\fP, ignoring attributes.
-Control characters are displayed in the \fB^\fIX\fR notation.
-Printing characters are displayed as is.
-.PP
-The corresponding \fBwunctrl\fP returns a printable representation of
-a wide character.
-.SS keyname/key_name
-.PP
-The \fBkeyname\fP routine returns a character string
-corresponding to the key \fIc\fP:
+representation of the character \fIc\fP:
 .bP
 Printable characters are displayed as themselves,
 e.g., a one-character string containing the key.
 .bP
 Control characters are displayed in the \fB^\fIX\fR notation.
 .bP
+Printing characters are displayed as is.
+.bP
 DEL (character 127) is displayed as \fB^?\fP.
 .bP
 Values above 128 are either meta characters
@@ -111,20 +101,38 @@ shown in the \fBM\-\fIX\fR notation,
 or are displayed as themselves.
 In the latter case, the values may not be printable;
 this follows the X/Open specification.
+.PP
+The corresponding \fBwunctrl\fP returns a printable representation of
+a complex character \fIc\fP.
+.PP
+In both \fBunctrl\fP and \fBwunctrl\fP the attributes and color associated
+with the character parameter are ignored.
+.SS keyname/key_name
+The \fBkeyname\fP routine returns a character string
+corresponding to the key \fIc\fP.
+Key codes are different from character codes.
 .bP
-Values above 256 may be the names of the names of function keys.
+Key codes below 256 are characters.
+They are displayed using \fBunctrl\fP.
 .bP
-Otherwise (if there is no corresponding name) the function returns null,
-to denote an error.
+Values above 256 may be the codes for function keys.
+The function key name is displayed.
+.bP
+Otherwise (if there is no corresponding name and the key is not a character)
+the function returns null, to denote an error.
 X/Open also lists an \*(``UNKNOWN KEY\*('' return value,
 which some implementations return rather than null.
 .LP
-The corresponding \fBkey_name\fP returns a character string corresponding
+The corresponding \fBkey_name\fP returns
+a multibyte character string corresponding
 to the wide-character value \fIw\fP.
-The two functions do not return the same set of strings;
-the latter returns null where the former would display a meta character.
+The two functions (\fBkeyname\fP and \fBkey_name\fP)
+do not return the same set of strings:
+.bP
+\fBkeyname\fP returns null where \fBkey_name\fP would display a meta character.
+.bP
+\fBkey_name\fP does not return the name of a function key.
 .SS filter/nofilter
-.PP
 The \fBfilter\fP routine, if used, must be called before \fBinitscr\fP or
 \fBnewterm\fP are called.
 Calling \fBfilter\fP causes these changes in initialization:
@@ -152,7 +160,6 @@ using a different value of \fB$TERM\fP.
 The limitation arises because the \fBfilter\fP routine modifies the
 in-memory copy of the terminal information.
 .SS use_env
-.PP
 The \fBuse_env\fP routine, if used,
 should be called before \fBinitscr\fP or
 \fBnewterm\fP are called
@@ -178,7 +185,6 @@ from the operating system or terminal database.
 \fBNcurses\fP also updates the screen size in response to \fBSIGWINCH\fP,
 unless overridden by the \fBLINES\fP or \fBCOLUMNS\fP environment variables,
 .SS use_tioctl
-.PP
 The \fBuse_tioctl\fP routine, if used,
 should be called before \fBinitscr\fP or \fBnewterm\fP are called
 (because those compute the screen size).
@@ -198,6 +204,7 @@ it is still the environment variables which set the screen size.
 .PP
 The \fBuse_env\fP and \fBuse_tioctl\fP routines combine as
 summarized here:
+.PP
 .TS
 center tab(/);
 l l l
@@ -221,7 +228,6 @@ FALSE/FALSE/T{
 T}
 .TE
 .SS putwin/getwin
-.PP
 The \fBputwin\fP routine writes all data associated
 with window (or pad) \fIwin\fP into
 the file to which \fIfilep\fP points.
@@ -250,7 +256,6 @@ If cells in the retrieved window use color pairs which have not been
 created in the application using \fBinit_pair\fP,
 they will not be colored when the window is refreshed.
 .SS delay_output
-.PP
 The \fBdelay_output\fP routine inserts an \fIms\fP millisecond pause
 in output.
 This routine should not be used extensively because
@@ -258,7 +263,6 @@ padding characters are used rather than a CPU pause.
 If no padding character is specified,
 this uses \fBnapms\fP to perform the delay.
 .SS flushinp
-.PP
 The \fBflushinp\fP routine throws away any typeahead that has been typed by the
 user and has not yet been read by the program.
 .SH RETURN VALUE
@@ -280,13 +284,11 @@ returns an error if the associated \fBfwrite\fP calls return an error.
 .RE
 .SH PORTABILITY
 .SS filter
-.PP
 The SVr4 documentation describes the action of \fBfilter\fP only in the vaguest
 terms.
 The description here is adapted from the XSI Curses standard (which
 erroneously fails to describe the disabling of \fBcuu\fP).
 .SS keyname
-.PP
 The \fBkeyname\fP function may return the names of user-defined
 string capabilities which are defined in the terminfo entry via the \fB\-x\fP
 option of \fB@TIC@\fP.
@@ -298,13 +300,11 @@ merged from all terminal descriptions which have been loaded.
 The \fBuse_extended_names\fP(3X) function controls whether this data is
 loaded when the terminal description is read by the library.
 .SS nofilter/use_tioctl
-.PP
 The \fBnofilter\fP and \fBuse_tioctl\fP routines are specific to \fBncurses\fP.
 They were not supported on Version 7, BSD or System V implementations.
 It is recommended that any code depending on \fBncurses\fP extensions
 be conditioned using NCURSES_VERSION.
 .SS putwin/getwin file-format
-.PP
 The \fBputwin\fP and \fBgetwin\fP functions have several issues with
 portability:
 .bP
@@ -335,7 +335,6 @@ Doing that can run into problems mixing block- and buffered-I/O.
 This implementation reduces the problem on writes by flushing the output.
 However, reading from a file written using mixed schemes may not be successful.
 .SS unctrl/wunctrl
-.PP
 The XSI Curses standard, Issue 4 describes these functions.
 It states that \fBunctrl\fP and \fBwunctrl\fP will return a null pointer if
 unsuccessful, but does not define any error conditions.
@@ -390,13 +389,12 @@ However, \fBncurses\fP' \fB<curses.h>\fP includes \fB<unctrl.h>\fP,
 matching the behavior of SVr4 curses.
 Other implementations may not do that.
 .SS use_env/use_tioctl
-.PP
 If \fBncurses\fP is configured to provide the sp-functions extension,
 the state of \fBuse_env\fP and \fBuse_tioctl\fP may be updated before
 creating each \fIscreen\fP rather than once only
 (\fBcurs_sp_funcs\fP(3X)).
 This feature of \fBuse_env\fP
-is not provided by other implementation of curses.
+is not provided by other implementations of curses.
 .SH SEE ALSO
 \fBcurses\fP(3X),
 \fBcurs_initscr\fP(3X),