2 ****************************************************************************
3 * Copyright (c) 1998-2018,2019 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.27 2019/11/30 21:06:30 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 https://invisible-island.net/scripts/readme.html#others_scripts">
36 <TITLE>curs_kernel 3x</TITLE>
37 <link rel="author" 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>
48 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
49 <STRONG>def_prog_mode</STRONG>, <STRONG>def_shell_mode</STRONG>, <STRONG>reset_prog_mode</STRONG>, <STRONG>reset_shell_mode</STRONG>,
50 <STRONG>resetty</STRONG>, <STRONG>savetty</STRONG>, <STRONG>getsyx</STRONG>, <STRONG>setsyx</STRONG>, <STRONG>ripoffline</STRONG>, <STRONG>curs_set</STRONG>, <STRONG>napms</STRONG> - low-
51 level <STRONG>curses</STRONG> routines
54 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
55 <STRONG>#include</STRONG> <STRONG><curses.h></STRONG>
57 <STRONG>int</STRONG> <STRONG>def_prog_mode(void);</STRONG>
58 <STRONG>int</STRONG> <STRONG>def_shell_mode(void);</STRONG>
59 <STRONG>int</STRONG> <STRONG>reset_prog_mode(void);</STRONG>
60 <STRONG>int</STRONG> <STRONG>reset_shell_mode(void);</STRONG>
61 <STRONG>int</STRONG> <STRONG>resetty(void);</STRONG>
62 <STRONG>int</STRONG> <STRONG>savetty(void);</STRONG>
63 <STRONG>void</STRONG> <STRONG>getsyx(int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>);</STRONG>
64 <STRONG>void</STRONG> <STRONG>setsyx(int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>);</STRONG>
65 <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>
66 <STRONG>int</STRONG> <STRONG>curs_set(int</STRONG> <EM>visibility</EM><STRONG>);</STRONG>
67 <STRONG>int</STRONG> <STRONG>napms(int</STRONG> <EM>ms</EM><STRONG>);</STRONG>
70 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
71 The following routines give low-level access to various <STRONG>curses</STRONG> capabil-
72 ities. These routines typically are used inside library routines.
75 </PRE><H3><a name="h3-def_prog_mode_-def_shell_mode">def_prog_mode, def_shell_mode</a></H3><PRE>
76 The <STRONG>def_prog_mode</STRONG> and <STRONG>def_shell_mode</STRONG> routines save the current terminal
77 modes as the "program" (in <STRONG>curses</STRONG>) or "shell" (not in <STRONG>curses</STRONG>) state for
78 use by the <STRONG>reset_prog_mode</STRONG> and <STRONG>reset_shell_mode</STRONG> routines. This is done
79 automatically by <STRONG>initscr</STRONG>. There is one such save area for each screen
80 context allocated by <STRONG>newterm</STRONG>.
83 </PRE><H3><a name="h3-reset_prog_mode_-reset_shell_mode">reset_prog_mode, reset_shell_mode</a></H3><PRE>
84 The <STRONG>reset_prog_mode</STRONG> and <STRONG>reset_shell_mode</STRONG> routines restore the terminal
85 to "program" (in <STRONG>curses</STRONG>) or "shell" (out of <STRONG>curses</STRONG>) state. These are
86 done automatically by <STRONG><A HREF="curs_initscr.3x.html">endwin(3x)</A></STRONG> and, after an <STRONG>endwin</STRONG>, by <STRONG>doupdate</STRONG>, so
87 they normally are not called.
90 </PRE><H3><a name="h3-resetty_-savetty">resetty, savetty</a></H3><PRE>
91 The <STRONG>resetty</STRONG> and <STRONG>savetty</STRONG> routines save and restore the state of the ter-
92 minal modes. <STRONG>savetty</STRONG> saves the current state in a buffer and <STRONG>resetty</STRONG>
93 restores the state to what it was at the last call to <STRONG>savetty</STRONG>.
96 </PRE><H3><a name="h3-getsyx">getsyx</a></H3><PRE>
97 The <STRONG>getsyx</STRONG> routine returns the current coordinates of the <EM>virtual</EM>
98 <EM>screen</EM> cursor in <EM>y</EM> and <EM>x</EM>. If <STRONG>leaveok</STRONG> is currently <STRONG>TRUE</STRONG>, then <STRONG>-1</STRONG>,<STRONG>-1</STRONG> is
99 returned. If lines have been removed from the top of the screen, using
100 <STRONG>ripoffline</STRONG>, <EM>y</EM> and <EM>x</EM> include these lines; therefore, <EM>y</EM> and <EM>x</EM> should be
101 used only as arguments for <STRONG>setsyx</STRONG>.
103 Few applications will use this feature, most use <STRONG>getyx</STRONG> instead.
106 </PRE><H3><a name="h3-setsyx">setsyx</a></H3><PRE>
107 The <STRONG>setsyx</STRONG> routine sets the <EM>virtual</EM> <EM>screen</EM> cursor to <EM>y</EM>, <EM>x</EM>. If <EM>y</EM> and <EM>x</EM>
108 are both <STRONG>-1</STRONG>, then <STRONG>leaveok</STRONG> is set. The two routines <STRONG>getsyx</STRONG> and <STRONG>setsyx</STRONG>
109 are designed to be used by a library routine, which manipulates <STRONG>curses</STRONG>
110 windows but does not want to change the current position of the pro-
111 gram's cursor. The library routine would call <STRONG>getsyx</STRONG> at the beginning,
112 do its manipulation of its own windows, do a <STRONG>wnoutrefresh</STRONG> on its win-
113 dows, call <STRONG>setsyx</STRONG>, and then call <STRONG>doupdate</STRONG>.
115 Few applications will use this feature, most use <STRONG>wmove</STRONG> instead.
118 </PRE><H3><a name="h3-ripoffline">ripoffline</a></H3><PRE>
119 The <STRONG>ripoffline</STRONG> routine provides access to the same facility that
120 <STRONG>slk_init</STRONG> [see <STRONG><A HREF="curs_slk.3x.html">curs_slk(3x)</A></STRONG>] uses to reduce the size of the screen.
121 <STRONG>ripoffline</STRONG> must be called before <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG> is called, to pre-
122 pare these initial actions:
124 <STRONG>o</STRONG> If <EM>line</EM> is positive, a line is removed from the top of <STRONG>stdscr</STRONG>.
126 <STRONG>o</STRONG> if <EM>line</EM> is negative, a line is removed from the bottom.
128 When the resulting initialization is done inside <STRONG>initscr</STRONG>, the routine
129 <STRONG>init</STRONG> (supplied by the user) is called with two arguments:
131 <STRONG>o</STRONG> a window pointer to the one-line window that has been allocated and
133 <STRONG>o</STRONG> an integer with the number of columns in the window.
135 Inside this initialization routine, the integer variables <STRONG>LINES</STRONG> and
136 <STRONG>COLS</STRONG> (defined in <STRONG><curses.h></STRONG>) are not guaranteed to be accurate and <STRONG>wre-</STRONG>
137 <STRONG>fresh</STRONG> or <STRONG>doupdate</STRONG> must not be called. It is allowable to call <STRONG>wnoutre-</STRONG>
138 <STRONG>fresh</STRONG> during the initialization routine.
140 <STRONG>ripoffline</STRONG> can be called up to five times before calling <STRONG>initscr</STRONG> or
141 <STRONG>newterm</STRONG>.
144 </PRE><H3><a name="h3-curs_set">curs_set</a></H3><PRE>
145 The <STRONG>curs_set</STRONG> routine sets the cursor state to invisible, normal, or
146 very visible for <STRONG>visibility</STRONG> equal to <STRONG>0</STRONG>, <STRONG>1</STRONG>, or <STRONG>2</STRONG> respectively. If the
147 terminal supports the <EM>visibility</EM> requested, the previous <EM>cursor</EM> state
148 is returned; otherwise, <STRONG>ERR</STRONG> is returned.
151 </PRE><H3><a name="h3-napms">napms</a></H3><PRE>
152 The <STRONG>napms</STRONG> routine is used to sleep for <EM>ms</EM> milliseconds.
155 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
156 Except for <STRONG>curs_set</STRONG>, these routines always return <STRONG>OK</STRONG>.
158 <STRONG>curs_set</STRONG> returns the previous cursor state, or <STRONG>ERR</STRONG> if the requested
159 <EM>visibility</EM> is not supported.
161 X/Open defines no error conditions. In this implementation
163 <STRONG>def_prog_mode</STRONG>, <STRONG>def_shell_mode</STRONG>, <STRONG>reset_prog_mode</STRONG>, <STRONG>reset_shell_mode</STRONG>
164 return an error if the terminal was not initialized, or if the I/O
165 call to obtain the terminal settings fails.
167 <STRONG>ripoffline</STRONG>
168 returns an error if the maximum number of ripped-off lines exceeds
169 the maximum (NRIPS = 5).
172 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
173 Note that <STRONG>getsyx</STRONG> is a macro, so <STRONG>&</STRONG> is not necessary before the variables
174 <EM>y</EM> and <EM>x</EM>.
176 Older SVr4 man pages warn that the return value of <STRONG>curs_set</STRONG> "is cur-
177 rently incorrect". This implementation gets it right, but it may be
178 unwise to count on the correctness of the return value anywhere else.
180 Both ncurses and SVr4 will call <STRONG>curs_set</STRONG> in <STRONG>endwin</STRONG> if <STRONG>curs_set</STRONG> has been
181 called to make the cursor other than normal, i.e., either invisible or
182 very visible. There is no way for ncurses to determine the initial
183 cursor state to restore that.
186 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
187 The <EM>virtual</EM> <EM>screen</EM> functions <STRONG>setsyx</STRONG> and <STRONG>getsyx</STRONG> are not described in the
188 XSI Curses standard, Issue 4. All other functions are as described in
191 The SVr4 documentation describes <STRONG>setsyx</STRONG> and <STRONG>getsyx</STRONG> as having return
192 type int. This is misleading, as they are macros with no documented
193 semantics for the return value.
196 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
197 <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><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>,
198 <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><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>.
202 <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>
206 <li><a href="#h2-NAME">NAME</a></li>
207 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
208 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
210 <li><a href="#h3-def_prog_mode_-def_shell_mode">def_prog_mode, def_shell_mode</a></li>
211 <li><a href="#h3-reset_prog_mode_-reset_shell_mode">reset_prog_mode, reset_shell_mode</a></li>
212 <li><a href="#h3-resetty_-savetty">resetty, savetty</a></li>
213 <li><a href="#h3-getsyx">getsyx</a></li>
214 <li><a href="#h3-setsyx">setsyx</a></li>
215 <li><a href="#h3-ripoffline">ripoffline</a></li>
216 <li><a href="#h3-curs_set">curs_set</a></li>
217 <li><a href="#h3-napms">napms</a></li>
220 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
221 <li><a href="#h2-NOTES">NOTES</a></li>
222 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
223 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>