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
|
---|
70 | The \fBunctrl\fR routine returns a character string which is a printable
|
---|
71 | representation of the character \fIc\fR, ignoring attributes.
|
---|
72 | Control characters are displayed in the \fB^\fR\fIX\fR notation.
|
---|
73 | Printing characters are displayed as is.
|
---|
74 | The corresponding \fBwunctrl\fR returns a printable representation of
|
---|
75 | a wide-character.
|
---|
76 | .PP
|
---|
77 | The \fBkeyname\fR routine returns a character string corresponding to the key \fIc\fR.
|
---|
78 | Control characters are displayed in the \fB^\fR\fIX\fR notation.
|
---|
79 | Values above 128 are either meta characters, shown in the \fBM-\fR\fIX\fR notation,
|
---|
80 | or the names of function keys, or null.
|
---|
81 | The corresponding \fBkey_name\fR returns a character string corresponding
|
---|
82 | to the wide-character value \fIw\fR.
|
---|
83 | The two functions do not return the same set of strings;
|
---|
84 | the latter returns null where the former would display a meta character.
|
---|
85 | .PP
|
---|
86 | The \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
|
---|
88 | is 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
|
---|
90 | set to the value of \fBcr\fR.
|
---|
91 | .PP
|
---|
92 | The \fBuse_env\fR routine, if used, is called before \fBinitscr\fR or
|
---|
93 | \fBnewterm\fR are called. When called with \fBFALSE\fR as an
|
---|
94 | argument, 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
|
---|
98 | would be to use the window size if \fBLINES\fR and \fBCOLUMNS\fR are
|
---|
99 | not set).
|
---|
100 | Note that setting \fBLINES\fR or \fBCOLUMNS\fR overrides the
|
---|
101 | corresponding size which may be obtained from the operating system.
|
---|
102 | .PP
|
---|
103 | The \fBputwin\fR routine writes all data associated with window \fIwin\fR into
|
---|
104 | the file to which \fIfilep\fR points. This information can be later retrieved
|
---|
105 | using the \fBgetwin\fR function.
|
---|
106 | .PP
|
---|
107 | The \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
|
---|
109 | data. It returns a pointer to the new window.
|
---|
110 | .PP
|
---|
111 | The \fBdelay_output\fR routine inserts an \fIms\fR millisecond pause
|
---|
112 | in output. This routine should not be used extensively because
|
---|
113 | padding characters are used rather than a CPU pause.
|
---|
114 | If no padding character is specified, this uses \fBnapms\fR to perform the delay.
|
---|
115 | .PP
|
---|
116 | The \fBflushinp\fR routine throws away any typeahead that has been typed by the
|
---|
117 | user and has not yet been read by the program.
|
---|
118 | .SH RETURN VALUE
|
---|
119 | Except for \fBflushinp\fR, routines that return an integer return \fBERR\fR
|
---|
120 | upon failure and \fBOK\fR (SVr4 specifies only "an integer value other than
|
---|
121 | \fBERR\fR") upon successful completion.
|
---|
122 | .PP
|
---|
123 | Routines that return pointers return \fBNULL\fR on error.
|
---|
124 | .PP
|
---|
125 | X/Open does not define any error conditions.
|
---|
126 | In this implementation
|
---|
127 | .RS
|
---|
128 | .TP 5
|
---|
129 | \fBflushinp\fR
|
---|
130 | returns an error if the terminal was not initialized.
|
---|
131 | .TP 5
|
---|
132 | \fBputwin\fP
|
---|
133 | returns an error if the associated \fBfwrite\fP calls return an error.
|
---|
134 | .RE
|
---|
135 | .SH PORTABILITY
|
---|
136 | The XSI Curses standard, Issue 4 describes these functions.
|
---|
137 | It states that \fBunctrl\fR and \fBwunctrl\fR will return a null pointer if
|
---|
138 | unsuccessful, but does not define any error conditions.
|
---|
139 | .PP
|
---|
140 | The SVr4 documentation describes the action of \fBfilter\fR only in the vaguest
|
---|
141 | terms. The description here is adapted from the XSI Curses standard (which
|
---|
142 | erroneously fails to describe the disabling of \fBcuu\fR).
|
---|
143 | .PP
|
---|
144 | The strings returned by \fBunctrl\fR in this implementation are determined
|
---|
145 | at compile time, showing C1 controls from the upper-128 codes with a `~'
|
---|
146 | prefix rather than `^'.
|
---|
147 | Other implementations typically show both sets of control characters with `^',
|
---|
148 | and may strip the parameter to 7 bits.
|
---|
149 | This implementation uses 8 bits but does not modify the string to reflect
|
---|
150 | locale.
|
---|
151 | .PP
|
---|
152 | The \fBkeyname\fP function may return the names of user-defined
|
---|
153 | string capabilities which are defined in the terminfo entry via the \fB-x\fP
|
---|
154 | option 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:
|
---|