blob: 57e640857bc73a2626ea555907a789bdf8bbadc5 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301<!--
2 ****************************************************************************
Steve Kondikae271bc2015-11-15 02:50:53 +01003 * Copyright (c) 1998-2010,2015 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05304 * *
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: *
12 * *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
15 * *
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. *
23 * *
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 *
27 * authorization. *
28 ****************************************************************************
Steve Kondikae271bc2015-11-15 02:50:53 +010029 * @Id: curs_kernel.3x,v 1.20 2015/07/21 01:10:11 tom Exp @
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053030-->
Steve Kondikae271bc2015-11-15 02:50:53 +010031<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053032<HTML>
33<HEAD>
Steve Kondikae271bc2015-11-15 02:50:53 +010034<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">
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053036<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">
39</HEAD>
40<BODY>
Steve Kondikae271bc2015-11-15 02:50:53 +010041<H1 class="no-header">curs_kernel 3x</H1>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053042<PRE>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053043<STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG> <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>
44
45
46
47
48</PRE>
Steve Kondikae271bc2015-11-15 02:50:53 +010049<H2><a name="h2-NAME">NAME</a></H2><PRE>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053050 <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
53
54
55</PRE>
Steve Kondikae271bc2015-11-15 02:50:53 +010056<H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053057 <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
58
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>
Steve Kondikae271bc2015-11-15 02:50:53 +010065 <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>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053070
71
72</PRE>
Steve Kondikae271bc2015-11-15 02:50:53 +010073<H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053074 The following routines give low-level access to various
Steve Kondikae271bc2015-11-15 02:50:53 +010075 <STRONG>curses</STRONG> capabilities. These routines typically are used
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053076 inside library routines.
77
Steve Kondikae271bc2015-11-15 02:50:53 +010078
79</PRE>
80<H3><a name="h3-def_prog_mode_-def_shell_mode">def_prog_mode, def_shell_mode</a></H3><PRE>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053081 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>.
87
Steve Kondikae271bc2015-11-15 02:50:53 +010088
89</PRE>
90<H3><a name="h3-reset_prog_mode_-reset_shell_mode">reset_prog_mode, reset_shell_mode</a></H3><PRE>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053091 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
95 not called.
96
Steve Kondikae271bc2015-11-15 02:50:53 +010097
98</PRE>
99<H3><a name="h3-resetty_-savetty">resetty, savetty</a></H3><PRE>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530100 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>.
104
Steve Kondikae271bc2015-11-15 02:50:53 +0100105
106</PRE>
107<H3><a name="h3-getsyx">getsyx</a></H3><PRE>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530108 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>.
114
Steve Kondikae271bc2015-11-15 02:50:53 +0100115
116</PRE>
117<H3><a name="h3-setsyx">setsyx</a></H3><PRE>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530118 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>.
127
Steve Kondikae271bc2015-11-15 02:50:53 +0100128
129</PRE>
130<H3><a name="h3-ripoffline">ripoffline</a></H3><PRE>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530131 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
Steve Kondikae271bc2015-11-15 02:50:53 +0100134 <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG> is called, to prepare these initial ac-
135 tions:
136
137 <STRONG>o</STRONG> If <EM>line</EM> is positive, a line is removed from the top of
138 <STRONG>stdscr</STRONG>.
139
140 <STRONG>o</STRONG> if <EM>line</EM> is negative, a line is removed from the bot-
141 tom.
142
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
145 arguments:
146
147 <STRONG>o</STRONG> a window pointer to the one-line window that has been
148 allocated and
149
150 <STRONG>o</STRONG> an integer with the number of columns in the window.
151
152 Inside this initialization routine, the integer variables
153 <STRONG>LINES</STRONG> and <STRONG>COLS</STRONG> (defined in <STRONG>&lt;curses.h&gt;</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.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530157
158 <STRONG>ripoffline</STRONG> can be called up to five times before calling
159 <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG>.
160
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530161
Steve Kondikae271bc2015-11-15 02:50:53 +0100162</PRE>
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.
169
170
171</PRE>
172<H3><a name="h3-napms">napms</a></H3><PRE>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530173 The <STRONG>napms</STRONG> routine is used to sleep for <EM>ms</EM> milliseconds.
174
175
176</PRE>
Steve Kondikae271bc2015-11-15 02:50:53 +0100177<H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530178 Except for <STRONG>curs_set</STRONG>, these routines always return <STRONG>OK</STRONG>.
179
180 <STRONG>curs_set</STRONG> returns the previous cursor state, or <STRONG>ERR</STRONG> if the
181 requested <EM>visibility</EM> is not supported.
182
183 X/Open defines no error conditions. In this implementa-
184 tion
185
Steve Kondikae271bc2015-11-15 02:50:53 +0100186 <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
190 fails.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530191
Steve Kondikae271bc2015-11-15 02:50:53 +0100192 <STRONG>ripoffline</STRONG>
193 returns an error if the maximum number of ripped-off
194 lines exceeds the maximum (NRIPS = 5).
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530195
196
197</PRE>
Steve Kondikae271bc2015-11-15 02:50:53 +0100198<H2><a name="h2-NOTES">NOTES</a></H2><PRE>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530199 Note that <STRONG>getsyx</STRONG> is a macro, so <STRONG>&amp;</STRONG> is not necessary before
200 the variables <EM>y</EM> and <EM>x</EM>.
201
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.
206
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
211 to restore that.
212
213
214</PRE>
Steve Kondikae271bc2015-11-15 02:50:53 +0100215<H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530216 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.
219
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
Steve Kondikae271bc2015-11-15 02:50:53 +0100222 macros with no documented semantics for the return value.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530223
224
225</PRE>
Steve Kondikae271bc2015-11-15 02:50:53 +0100226<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>.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530230
231
232
233 <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>
234</PRE>
Steve Kondikae271bc2015-11-15 02:50:53 +0100235<div class="nav">
236<ul>
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>
240<ul>
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>
249</ul>
250</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>
255</ul>
256</div>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530257</BODY>
258</HTML>