]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_util.3x
ncurses 5.4
[ncurses.git] / man / curs_util.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
3 .\"                                                                          *
4 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
5 .\" copy of this software and associated documentation files (the            *
6 .\" "Software"), to deal in the Software without restriction, including      *
7 .\" without limitation the rights to use, copy, modify, merge, publish,      *
8 .\" distribute, distribute with modifications, sublicense, and/or sell       *
9 .\" copies of the Software, and to permit persons to whom the Software is    *
10 .\" furnished to do so, subject to the following conditions:                 *
11 .\"                                                                          *
12 .\" The above copyright notice and this permission notice shall be included  *
13 .\" in all copies or substantial portions of the Software.                   *
14 .\"                                                                          *
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22 .\"                                                                          *
23 .\" Except as contained in this notice, the name(s) of the above copyright   *
24 .\" holders shall not be used in advertising or otherwise to promote the     *
25 .\" sale, use or other dealings in this Software without prior written       *
26 .\" authorization.                                                           *
27 .\"***************************************************************************
28 .\"
29 .\" $Id: curs_util.3x,v 1.12 2004/01/31 17:24:53 tom Exp $
30 .TH curs_util 3X ""
31 .SH NAME
32 \fBdelay_output\fR,
33 \fBfilter\fR,
34 \fBflushinp\fR,
35 \fBgetwin\fR,
36 \fBkey_name\fR,
37 \fBkeyname\fR,
38 \fBputwin\fR,
39 \fBunctrl\fR,
40 \fBuse_env\fR,
41 \fBwunctrl\fR - miscellaneous \fBcurses\fR utility routines
42 .SH SYNOPSIS
43 \fB#include <curses.h>\fR
44 .sp
45 \fBchar *unctrl(chtype c);\fR
46 .br
47 \fBchar *wunctrl(cchar_t *c);\fR
48 .br
49 \fBchar *keyname(int c);\fR
50 .br
51 \fBchar *key_name(wchar_t w);\fR
52 .br
53 \fBvoid filter(void);\fR
54 .br
55 \fBvoid use_env(bool f);\fR
56 .br
57 \fBint putwin(WINDOW *win, FILE *filep);\fR
58 .br
59 \fBWINDOW *getwin(FILE *filep);\fR
60 .br
61 \fBint delay_output(int ms);\fR
62 .br
63 \fBint flushinp(void);\fR
64 .br
65 .SH DESCRIPTION
66 The \fBunctrl\fR routine returns a character string which is a printable
67 representation of the character \fIc\fR, ignoring attributes.
68 Control characters are displayed in the \fB^\fR\fIX\fR notation.
69 Printing characters are displayed as is.
70 The corresponding \fBwunctrl\fR returns a printable representation of
71 a wide-character.
72 .PP
73 The \fBkeyname\fR routine returns a character string corresponding to the key \fIc\fR.
74 Control characters are displayed in the \fB^\fR\fIX\fR notation.
75 Values above 128 are either meta characters, shown in the \fBM-\fR\fIX\fR notation,
76 or the names of function keys, or null.
77 The corresponding \fBkey_name\fR returns a character string corresponding
78 to the wide-character value \fIw\fR.
79 The two functions do not return the same set of strings;
80 the latter returns null where the former would display a meta character.
81 .PP
82 The \fBfilter\fR routine, if used, must be called before \fBinitscr\fR or
83 \fBnewterm\fR are called.  The effect is that, during those calls, \fBLINES\fR
84 is set to 1; the capabilities \fBclear\fR, \fBcup\fR, \fBcud\fR, \fBcud1\fR,
85 \fBcuu1\fR, \fBcuu\fR, \fBvpa\fR are disabled; and the \fBhome\fR string is
86 set to the value of \fBcr\fR.
87 .PP
88 The \fBuse_env\fR routine, if used, is called before \fBinitscr\fR or
89 \fBnewterm\fR are called.  When called with \fBFALSE\fR as an
90 argument, the values of \fBlines\fR and \fBcolumns\fR specified in the
91 \fIterminfo\fR database will be used, even if environment variables
92 \fBLINES\fR and \fBCOLUMNS\fR (used by default) are set, or if
93 \fBcurses\fR is running in a window (in which case default behavior
94 would be to use the window size if \fBLINES\fR and \fBCOLUMNS\fR are
95 not set).
96 .PP
97 The \fBputwin\fR routine writes all data associated with window \fIwin\fR into
98 the file to which \fIfilep\fR points.  This information can be later retrieved
99 using the \fBgetwin\fR function.
100 .PP
101 The \fBgetwin\fR routine reads window related data stored in the file by
102 \fBputwin\fR.  The routine then creates and initializes a new window using that
103 data.  It returns a pointer to the new window.
104 .PP
105 The \fBdelay_output\fR routine inserts an \fIms\fR millisecond pause
106 in output.  This routine should not be used extensively because
107 padding characters are used rather than a CPU pause.
108 If no padding character is specified, this uses \fBnapms\fR to perform the delay.
109 .PP
110 The \fBflushinp\fR routine throws away any typeahead that has been typed by the
111 user and has not yet been read by the program.
112 .SH RETURN VALUE
113 Except for \fBflushinp\fR, routines that return an integer return \fBERR\fR
114 upon failure and \fBOK\fR (SVr4 specifies only "an integer value other than
115 \fBERR\fR") upon successful completion.
116 .PP
117 \fBflushinp\fR always returns \fBOK\fR.
118 .PP
119 Routines that return pointers return \fBNULL\fR on error.
120 .SH PORTABILITY
121 The XSI Curses standard, Issue 4 describes these functions.
122 It states that \fBunctrl\fR and \fBwunctrl\fR will return a null pointer if
123 unsuccessful, but does not define any error conditions.
124 .PP
125 The SVr4 documentation describes the action of \fBfilter\fR only in the vaguest
126 terms.  The description here is adapted from the XSI Curses standard (which
127 erroneously fails to describe the disabling of \fBcuu\fR).
128 .PP
129 The strings returned by \fBunctrl\fR in this implementation are determined
130 at compile time, showing C1 controls from the upper-128 codes with a `~'
131 prefix rather than `^'.
132 Other implementations typically show both sets of control characters with `^',
133 and may strip the parameter to 7 bits.
134 This implementation uses 8 bits but does not modify the string to reflect
135 locale.
136 .SH SEE ALSO
137 \fBcurses\fR(3X),
138 \fBcurs_initscr\fR(3X),
139 \fBcurs_kernel\fR(3X),
140 \fBcurs_scr_dump\fR(3X).
141 .\"#
142 .\"# The following sets edit modes for GNU EMACS
143 .\"# Local Variables:
144 .\"# mode:nroff
145 .\"# fill-column:79
146 .\"# End: