2 ****************************************************************************
3 * Copyright (c) 1998-2010,2015 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************
29 * @Id: curs_kernel.3x,v 1.20 2015/07/21 01:10:11 tom Exp @
31 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
34 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
35 <meta name="generator" content="Manpage converted by man2html - see http://invisible-island.net/scripts/readme.html#others_scripts">
36 <TITLE>curs_kernel 3x</TITLE>
37 <link rev=made href="mailto:bug-ncurses@gnu.org">
38 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
41 <H1 class="no-header">curs_kernel 3x</H1>
43 <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG> <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>
49 <H2><a name="h2-NAME">NAME</a></H2><PRE>
50 <STRONG>def_prog_mode</STRONG>, <STRONG>def_shell_mode</STRONG>, <STRONG>reset_prog_mode</STRONG>,
51 <STRONG>reset_shell_mode</STRONG>, <STRONG>resetty</STRONG>, <STRONG>savetty</STRONG>, <STRONG>getsyx</STRONG>, <STRONG>setsyx</STRONG>,
52 <STRONG>ripoffline</STRONG>, <STRONG>curs_set</STRONG>, <STRONG>napms</STRONG> - low-level <STRONG>curses</STRONG> routines
56 <H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
57 <STRONG>#include</STRONG> <STRONG><curses.h></STRONG>
59 <STRONG>int</STRONG> <STRONG>def_prog_mode(void);</STRONG>
60 <STRONG>int</STRONG> <STRONG>def_shell_mode(void);</STRONG>
61 <STRONG>int</STRONG> <STRONG>reset_prog_mode(void);</STRONG>
62 <STRONG>int</STRONG> <STRONG>reset_shell_mode(void);</STRONG>
63 <STRONG>int</STRONG> <STRONG>resetty(void);</STRONG>
64 <STRONG>int</STRONG> <STRONG>savetty(void);</STRONG>
65 <STRONG>void</STRONG> <STRONG>getsyx(int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>);</STRONG>
66 <STRONG>void</STRONG> <STRONG>setsyx(int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>);</STRONG>
67 <STRONG>int</STRONG> <STRONG>ripoffline(int</STRONG> <EM>line</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>(*</STRONG><EM>init</EM><STRONG>)(WINDOW</STRONG> <STRONG>*,</STRONG> <STRONG>int));</STRONG>
68 <STRONG>int</STRONG> <STRONG>curs_set(int</STRONG> <EM>visibility</EM><STRONG>);</STRONG>
69 <STRONG>int</STRONG> <STRONG>napms(int</STRONG> <EM>ms</EM><STRONG>);</STRONG>
73 <H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
74 The following routines give low-level access to various
75 <STRONG>curses</STRONG> capabilities. These routines typically are used
76 inside library routines.
80 <H3><a name="h3-def_prog_mode_-def_shell_mode">def_prog_mode, def_shell_mode</a></H3><PRE>
81 The <STRONG>def_prog_mode</STRONG> and <STRONG>def_shell_mode</STRONG> routines save the
82 current terminal modes as the "program" (in <STRONG>curses</STRONG>) or
83 "shell" (not in <STRONG>curses</STRONG>) state for use by the <STRONG>re-</STRONG>
84 <STRONG>set_prog_mode</STRONG> and <STRONG>reset_shell_mode</STRONG> routines. This is done
85 automatically by <STRONG>initscr</STRONG>. There is one such save area for
86 each screen context allocated by <STRONG>newterm()</STRONG>.
90 <H3><a name="h3-reset_prog_mode_-reset_shell_mode">reset_prog_mode, reset_shell_mode</a></H3><PRE>
91 The <STRONG>reset_prog_mode</STRONG> and <STRONG>reset_shell_mode</STRONG> routines restore
92 the terminal to "program" (in <STRONG>curses</STRONG>) or "shell" (out of
93 <STRONG>curses</STRONG>) state. These are done automatically by <STRONG>endwin</STRONG>
94 and, after an <STRONG>endwin</STRONG>, by <STRONG>doupdate</STRONG>, so they normally are
99 <H3><a name="h3-resetty_-savetty">resetty, savetty</a></H3><PRE>
100 The <STRONG>resetty</STRONG> and <STRONG>savetty</STRONG> routines save and restore the
101 state of the terminal modes. <STRONG>savetty</STRONG> saves the current
102 state in a buffer and <STRONG>resetty</STRONG> restores the state to what
103 it was at the last call to <STRONG>savetty</STRONG>.
107 <H3><a name="h3-getsyx">getsyx</a></H3><PRE>
108 The <STRONG>getsyx</STRONG> routine returns the current coordinates of the
109 virtual screen cursor in <EM>y</EM> and <EM>x</EM>. If <STRONG>leaveok</STRONG> is currently
110 <STRONG>TRUE</STRONG>, then <STRONG>-1</STRONG>,<STRONG>-1</STRONG> is returned. If lines have been removed
111 from the top of the screen, using <STRONG>ripoffline</STRONG>, <EM>y</EM> and <EM>x</EM> in-
112 clude these lines; therefore, <EM>y</EM> and <EM>x</EM> should be used only
113 as arguments for <STRONG>setsyx</STRONG>.
117 <H3><a name="h3-setsyx">setsyx</a></H3><PRE>
118 The <STRONG>setsyx</STRONG> routine sets the virtual screen cursor to <EM>y</EM>, <EM>x</EM>.
119 If <EM>y</EM> and <EM>x</EM> are both <STRONG>-1</STRONG>, then <STRONG>leaveok</STRONG> is set. The two rou-
120 tines <STRONG>getsyx</STRONG> and <STRONG>setsyx</STRONG> are designed to be used by a li-
121 brary routine, which manipulates <STRONG>curses</STRONG> windows but does
122 not want to change the current position of the program's
123 cursor. The library routine would call <STRONG>getsyx</STRONG> at the be-
124 ginning, do its manipulation of its own windows, do a
125 <STRONG>wnoutrefresh</STRONG> on its windows, call <STRONG>setsyx</STRONG>, and then call
126 <STRONG>doupdate</STRONG>.
130 <H3><a name="h3-ripoffline">ripoffline</a></H3><PRE>
131 The <STRONG>ripoffline</STRONG> routine provides access to the same facili-
132 ty that <STRONG>slk_init</STRONG> [see <STRONG><A HREF="curs_slk.3x.html">curs_slk(3x)</A></STRONG>] uses to reduce the
133 size of the screen. <STRONG>ripoffline</STRONG> must be called before
134 <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG> is called, to prepare these initial ac-
137 <STRONG>o</STRONG> If <EM>line</EM> is positive, a line is removed from the top of
138 <STRONG>stdscr</STRONG>.
140 <STRONG>o</STRONG> if <EM>line</EM> is negative, a line is removed from the bot-
143 When the resulting initialization is done inside <STRONG>initscr</STRONG>,
144 the routine <STRONG>init</STRONG> (supplied by the user) is called with two
147 <STRONG>o</STRONG> a window pointer to the one-line window that has been
150 <STRONG>o</STRONG> an integer with the number of columns in the window.
152 Inside this initialization routine, the integer variables
153 <STRONG>LINES</STRONG> and <STRONG>COLS</STRONG> (defined in <STRONG><curses.h></STRONG>) are not guaranteed
154 to be accurate and <STRONG>wrefresh</STRONG> or <STRONG>doupdate</STRONG> must not be
155 called. It is allowable to call <STRONG>wnoutrefresh</STRONG> during the
156 initialization routine.
158 <STRONG>ripoffline</STRONG> can be called up to five times before calling
159 <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG>.
163 <H3><a name="h3-curs_set">curs_set</a></H3><PRE>
164 The <STRONG>curs_set</STRONG> routine sets the cursor state to invisible,
165 normal, or very visible for <STRONG>visibility</STRONG> equal to <STRONG>0</STRONG>, <STRONG>1</STRONG>, or <STRONG>2</STRONG>
166 respectively. If the terminal supports the <EM>visibility</EM> re-
167 quested, the previous <EM>cursor</EM> state is returned; otherwise,
168 <STRONG>ERR</STRONG> is returned.
172 <H3><a name="h3-napms">napms</a></H3><PRE>
173 The <STRONG>napms</STRONG> routine is used to sleep for <EM>ms</EM> milliseconds.
177 <H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
178 Except for <STRONG>curs_set</STRONG>, these routines always return <STRONG>OK</STRONG>.
180 <STRONG>curs_set</STRONG> returns the previous cursor state, or <STRONG>ERR</STRONG> if the
181 requested <EM>visibility</EM> is not supported.
183 X/Open defines no error conditions. In this implementa-
186 <STRONG>def_prog_mode</STRONG>, <STRONG>def_shell_mode</STRONG>, <STRONG>reset_prog_mode</STRONG>,
187 <STRONG>reset_shell_mode</STRONG>
188 return an error if the terminal was not initialized,
189 or if the I/O call to obtain the terminal settings
192 <STRONG>ripoffline</STRONG>
193 returns an error if the maximum number of ripped-off
194 lines exceeds the maximum (NRIPS = 5).
198 <H2><a name="h2-NOTES">NOTES</a></H2><PRE>
199 Note that <STRONG>getsyx</STRONG> is a macro, so <STRONG>&</STRONG> is not necessary before
200 the variables <EM>y</EM> and <EM>x</EM>.
202 Older SVr4 man pages warn that the return value of
203 <STRONG>curs_set</STRONG> "is currently incorrect". This implementation
204 gets it right, but it may be unwise to count on the cor-
205 rectness of the return value anywhere else.
207 Both ncurses and SVr4 will call <STRONG>curs_set</STRONG> in <STRONG>endwin</STRONG> if
208 <STRONG>curs_set</STRONG> has been called to make the cursor other than
209 normal, i.e., either invisible or very visible. There is
210 no way for ncurses to determine the initial cursor state
215 <H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
216 The functions <STRONG>setsyx</STRONG> and <STRONG>getsyx</STRONG> are not described in the
217 XSI Curses standard, Issue 4. All other functions are as
218 described in XSI Curses.
220 The SVr4 documentation describes <STRONG>setsyx</STRONG> and <STRONG>getsyx</STRONG> as hav-
221 ing return type int. This is misleading, as they are
222 macros with no documented semantics for the return value.
226 <H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
227 <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>, <STRONG><A HREF="curs_outopts.3x.html">curs_outopts(3x)</A></STRONG>, <STRONG>curs_re-</STRONG>
228 <STRONG><A HREF="curs_refresh.3x.html">fresh(3x)</A></STRONG>, <STRONG><A HREF="curs_scr_dump.3x.html">curs_scr_dump(3x)</A></STRONG>, <STRONG><A HREF="curs_slk.3x.html">curs_slk(3x)</A></STRONG>, <STRONG>curs_vari-</STRONG>
229 <STRONG><A HREF="curs_variables.3x.html">ables(3x)</A></STRONG>.
233 <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>
237 <li><a href="#h2-NAME">NAME</a></li>
238 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
239 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
241 <li><a href="#h3-def_prog_mode_-def_shell_mode">def_prog_mode, def_shell_mode</a></li>
242 <li><a href="#h3-reset_prog_mode_-reset_shell_mode">reset_prog_mode, reset_shell_mode</a></li>
243 <li><a href="#h3-resetty_-savetty">resetty, savetty</a></li>
244 <li><a href="#h3-getsyx">getsyx</a></li>
245 <li><a href="#h3-setsyx">setsyx</a></li>
246 <li><a href="#h3-ripoffline">ripoffline</a></li>
247 <li><a href="#h3-curs_set">curs_set</a></li>
248 <li><a href="#h3-napms">napms</a></li>
251 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
252 <li><a href="#h2-NOTES">NOTES</a></li>
253 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
254 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>