source: trunk/ncurses/man/curs_util.3x@ 2787

Last change on this file since 2787 was 2621, checked in by bird, 19 years ago

GNU ncurses 5.5

File size: 7.0 KB
Line 
1.\"***************************************************************************
2.\" Copyright (c) 1998-2004,2005 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.17 2005/06/25 21:51:37 tom Exp $
30.TH curs_util 3X ""
31.na
32.hy 0
33.SH NAME
34\fBdelay_output\fR,
35\fBfilter\fR,
36\fBflushinp\fR,
37\fBgetwin\fR,
38\fBkey_name\fR,
39\fBkeyname\fR,
40\fBputwin\fR,
41\fBunctrl\fR,
42\fBuse_env\fR,
43\fBwunctrl\fR - miscellaneous \fBcurses\fR utility routines
44.ad
45.hy
46.SH SYNOPSIS
47\fB#include <curses.h>\fR
48.sp
49\fBchar *unctrl(chtype c);\fR
50.br
51\fBchar *wunctrl(cchar_t *c);\fR
52.br
53\fBchar *keyname(int c);\fR
54.br
55\fBchar *key_name(wchar_t w);\fR
56.br
57\fBvoid filter(void);\fR
58.br
59\fBvoid use_env(bool f);\fR
60.br
61\fBint putwin(WINDOW *win, FILE *filep);\fR
62.br
63\fBWINDOW *getwin(FILE *filep);\fR
64.br
65\fBint delay_output(int ms);\fR
66.br
67\fBint flushinp(void);\fR
68.br
69.SH DESCRIPTION
70The \fBunctrl\fR routine returns a character string which is a printable
71representation of the character \fIc\fR, ignoring attributes.
72Control characters are displayed in the \fB^\fR\fIX\fR notation.
73Printing characters are displayed as is.
74The corresponding \fBwunctrl\fR returns a printable representation of
75a wide-character.
76.PP
77The \fBkeyname\fR routine returns a character string corresponding to the key \fIc\fR.
78Control characters are displayed in the \fB^\fR\fIX\fR notation.
79Values above 128 are either meta characters, shown in the \fBM-\fR\fIX\fR notation,
80or the names of function keys, or null.
81The corresponding \fBkey_name\fR returns a character string corresponding
82to the wide-character value \fIw\fR.
83The two functions do not return the same set of strings;
84the latter returns null where the former would display a meta character.
85.PP
86The \fBfilter\fR routine, if used, must be called before \fBinitscr\fR or
87\fBnewterm\fR are called. The effect is that, during those calls, \fBLINES\fR
88is set to 1; the capabilities \fBclear\fR, \fBcup\fR, \fBcud\fR, \fBcud1\fR,
89\fBcuu1\fR, \fBcuu\fR, \fBvpa\fR are disabled; and the \fBhome\fR string is
90set to the value of \fBcr\fR.
91.PP
92The \fBuse_env\fR routine, if used, is called before \fBinitscr\fR or
93\fBnewterm\fR are called. When called with \fBFALSE\fR as an
94argument, the values of \fBlines\fR and \fBcolumns\fR specified in the
95\fIterminfo\fR database will be used, even if environment variables
96\fBLINES\fR and \fBCOLUMNS\fR (used by default) are set, or if
97\fBcurses\fR is running in a window (in which case default behavior
98would be to use the window size if \fBLINES\fR and \fBCOLUMNS\fR are
99not set).
100Note that setting \fBLINES\fR or \fBCOLUMNS\fR overrides the
101corresponding size which may be obtained from the operating system.
102.PP
103The \fBputwin\fR routine writes all data associated with window \fIwin\fR into
104the file to which \fIfilep\fR points. This information can be later retrieved
105using the \fBgetwin\fR function.
106.PP
107The \fBgetwin\fR routine reads window related data stored in the file by
108\fBputwin\fR. The routine then creates and initializes a new window using that
109data. It returns a pointer to the new window.
110.PP
111The \fBdelay_output\fR routine inserts an \fIms\fR millisecond pause
112in output. This routine should not be used extensively because
113padding characters are used rather than a CPU pause.
114If no padding character is specified, this uses \fBnapms\fR to perform the delay.
115.PP
116The \fBflushinp\fR routine throws away any typeahead that has been typed by the
117user and has not yet been read by the program.
118.SH RETURN VALUE
119Except for \fBflushinp\fR, routines that return an integer return \fBERR\fR
120upon failure and \fBOK\fR (SVr4 specifies only "an integer value other than
121\fBERR\fR") upon successful completion.
122.PP
123Routines that return pointers return \fBNULL\fR on error.
124.PP
125X/Open does not define any error conditions.
126In this implementation
127.RS
128.TP 5
129\fBflushinp\fR
130returns an error if the terminal was not initialized.
131.TP 5
132\fBputwin\fP
133returns an error if the associated \fBfwrite\fP calls return an error.
134.RE
135.SH PORTABILITY
136The XSI Curses standard, Issue 4 describes these functions.
137It states that \fBunctrl\fR and \fBwunctrl\fR will return a null pointer if
138unsuccessful, but does not define any error conditions.
139.PP
140The SVr4 documentation describes the action of \fBfilter\fR only in the vaguest
141terms. The description here is adapted from the XSI Curses standard (which
142erroneously fails to describe the disabling of \fBcuu\fR).
143.PP
144The strings returned by \fBunctrl\fR in this implementation are determined
145at compile time, showing C1 controls from the upper-128 codes with a `~'
146prefix rather than `^'.
147Other implementations typically show both sets of control characters with `^',
148and may strip the parameter to 7 bits.
149This implementation uses 8 bits but does not modify the string to reflect
150locale.
151.PP
152The \fBkeyname\fP function may return the names of user-defined
153string capabilities which are defined in the terminfo entry via the \fB-x\fP
154option of \fBtic\fP.
155.SH SEE ALSO
156\fBcurses\fR(3X),
157\fBcurs_initscr\fR(3X),
158\fBcurs_kernel\fR(3X),
159\fBcurs_scr_dump\fR(3X).
160.\"#
161.\"# The following sets edit modes for GNU EMACS
162.\"# Local Variables:
163.\"# mode:nroff
164.\"# fill-column:79
165.\"# End:
Note: See TracBrowser for help on using the repository browser.