1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
3 ****************************************************************************
4 * Copyright (c) 1998 Free Software Foundation, Inc. *
6 * Permission is hereby granted, free of charge, to any person obtaining a *
7 * copy of this software and associated documentation files (the *
8 * "Software"), to deal in the Software without restriction, including *
9 * without limitation the rights to use, copy, modify, merge, publish, *
10 * distribute, distribute with modifications, sublicense, and/or sell *
11 * copies of the Software, and to permit persons to whom the Software is *
12 * furnished to do so, subject to the following conditions: *
14 * The above copyright notice and this permission notice shall be included *
15 * in all copies or substantial portions of the Software. *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
20 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
23 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
25 * Except as contained in this notice, the name(s) of the above copyright *
26 * holders shall not be used in advertising or otherwise to promote the *
27 * sale, use or other dealings in this Software without prior written *
29 ****************************************************************************
30 * @Id: curs_kernel.3x,v 1.13 2001/12/08 18:01:25 tom Exp @
34 <TITLE>curs_kernel 3x</TITLE>
35 <link rev=made href="mailto:bug-ncurses@gnu.org">
36 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
39 <H1>curs_kernel 3x</H1>
42 <!-- Manpage converted by man2html 3.0.1 -->
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>
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>, <STRONG>ripof-</STRONG>
52 <STRONG>fline</STRONG>, <STRONG>curs_set</STRONG>, <STRONG>napms</STRONG> - low-level <STRONG>curses</STRONG> routines
56 <H2>SYNOPSIS</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> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x);</STRONG>
66 <STRONG>void</STRONG> <STRONG>setsyx(int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x);</STRONG>
67 <STRONG>int</STRONG> <STRONG>ripoffline(int</STRONG> <STRONG>line,</STRONG> <STRONG>int</STRONG> <STRONG>(*init)(WINDOW</STRONG> <STRONG>*,</STRONG> <STRONG>int));</STRONG>
68 <STRONG>int</STRONG> <STRONG>curs_set(int</STRONG> <STRONG>visibility);</STRONG>
69 <STRONG>int</STRONG> <STRONG>napms(int</STRONG> <STRONG>ms);</STRONG>
73 <H2>DESCRIPTION</H2><PRE>
74 The following routines give low-level access to various
75 <STRONG>curses</STRONG> capabilities. Theses routines typically are used
76 inside library routines.
78 The <STRONG>def_prog_mode</STRONG> and <STRONG>def_shell_mode</STRONG> routines save the
79 current terminal modes as the "program" (in <STRONG>curses</STRONG>) or
80 "shell" (not in <STRONG>curses</STRONG>) state for use by the
81 <STRONG>reset_prog_mode</STRONG> and <STRONG>reset_shell_mode</STRONG> routines. This is
82 done automatically by <STRONG>initscr</STRONG>. There is one such save
83 area for each screen context allocated by <STRONG>newterm()</STRONG>.
85 The <STRONG>reset_prog_mode</STRONG> and <STRONG>reset_shell_mode</STRONG> routines restore
86 the terminal to "program" (in <STRONG>curses</STRONG>) or "shell" (out of
87 <STRONG>curses</STRONG>) state. These are done automatically by <STRONG>endwin</STRONG>
88 and, after an <STRONG>endwin</STRONG>, by <STRONG>doupdate</STRONG>, so they normally are
91 The <STRONG>resetty</STRONG> and <STRONG>savetty</STRONG> routines save and restore the
92 state of the terminal modes. <STRONG>savetty</STRONG> saves the current
93 state in a buffer and <STRONG>resetty</STRONG> restores the state to what
94 it was at the last call to <STRONG>savetty</STRONG>.
96 The <STRONG>getsyx</STRONG> routine returns the current coordinates of the
97 virtual screen cursor in <EM>y</EM> and <EM>x</EM>. If <STRONG>leaveok</STRONG> is currently
98 <STRONG>TRUE</STRONG>, then <STRONG>-1</STRONG>,<STRONG>-1</STRONG> is returned. If lines have been removed
99 from the top of the screen, using <STRONG>ripoffline</STRONG>, <EM>y</EM> and <EM>x</EM>
100 include these lines; therefore, <EM>y</EM> and <EM>x</EM> should be used
101 only as arguments for <STRONG>setsyx</STRONG>.
103 The <STRONG>setsyx</STRONG> routine sets the virtual screen cursor to <EM>y</EM>, <EM>x</EM>.
104 If <EM>y</EM> and <EM>x</EM> are both <STRONG>-1</STRONG>, then <STRONG>leaveok</STRONG> is set. The two rou-
105 tines <STRONG>getsyx</STRONG> and <STRONG>setsyx</STRONG> are designed to be used by a
106 library routine, which manipulates <STRONG>curses</STRONG> windows but does
107 not want to change the current position of the program's
108 cursor. The library routine would call <STRONG>getsyx</STRONG> at the
109 beginning, do its manipulation of its own windows, do a
110 <STRONG>wnoutrefresh</STRONG> on its windows, call <STRONG>setsyx</STRONG>, and then call
111 <STRONG>doupdate</STRONG>.
113 The <STRONG>ripoffline</STRONG> routine provides access to the same facil-
114 ity that <STRONG>slk_init</STRONG> [see <STRONG><A HREF="curs_slk.3x.html">curs_slk(3x)</A></STRONG>] uses to reduce the
115 size of the screen. <STRONG>ripoffline</STRONG> must be called before
116 <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG> is called. If <EM>line</EM> is positive, a line
117 is removed from the top of <STRONG>stdscr</STRONG>; if <EM>line</EM> is negative, a
118 line is removed from the bottom. When this is done inside
119 <STRONG>initscr</STRONG>, the routine <STRONG>init</STRONG> (supplied by the user) is called
120 with two arguments: a window pointer to the one-line win-
121 dow that has been allocated and an integer with the number
122 of columns in the window. Inside this initialization rou-
123 tine, the integer variables <STRONG>LINES</STRONG> and <STRONG>COLS</STRONG> (defined in
124 <STRONG><curses.h></STRONG>) are not guaranteed to be accurate and <STRONG>wrefresh</STRONG>
125 or <STRONG>doupdate</STRONG> must not be called. It is allowable to call
126 <STRONG>wnoutrefresh</STRONG> during the initialization routine.
128 <STRONG>ripoffline</STRONG> can be called up to five times before calling
129 <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG>.
131 The <STRONG>curs_set</STRONG> routine sets the cursor state is set to
132 invisible, normal, or very visible for <STRONG>visibility</STRONG> equal to
133 <STRONG>0</STRONG>, <STRONG>1</STRONG>, or <STRONG>2</STRONG> respectively. If the terminal supports the
134 <EM>visibility</EM> requested, the previous <EM>cursor</EM> state is
135 returned; otherwise, <STRONG>ERR</STRONG> is returned.
137 The <STRONG>napms</STRONG> routine is used to sleep for <EM>ms</EM> milliseconds.
141 <H2>RETURN VALUE</H2><PRE>
142 Except for <STRONG>curs_set</STRONG>, these routines always return <STRONG>OK</STRONG>.
143 <STRONG>curs_set</STRONG> returns the previous cursor state, or <STRONG>ERR</STRONG> if the
144 requested <EM>visibility</EM> is not supported.
149 Note that <STRONG>getsyx</STRONG> is a macro, so <STRONG>&</STRONG> is not necessary before
150 the variables <EM>y</EM> and <EM>x</EM>.
152 Older SVr4 man pages warn that the return value of
153 <STRONG>curs_set</STRONG> "is currently incorrect". This implementation
154 gets it right, but it may be unwise to count on the cor-
155 rectness of the return value anywhere else.
157 Both ncurses and SVr4 will call <STRONG>curs_set</STRONG> in <STRONG>endwin</STRONG> if
158 <STRONG>curs_set</STRONG> has been called to make the cursor other than
159 normal, i.e., either invisible or very visible. There is
160 no way for ncurses to determine the initial cursor state
165 <H2>PORTABILITY</H2><PRE>
166 The functions <STRONG>setsyx</STRONG> and <STRONG>getsyx</STRONG> are not described in the
167 XSI Curses standard, Issue 4. All other functions are as
168 described in XSI Curses.
170 The SVr4 documentation describes <STRONG>setsyx</STRONG> and <STRONG>getsyx</STRONG> as hav-
171 ing return type int. This is misleading, as they are
172 macros with no documented semantics for the return value.
176 <H2>SEE ALSO</H2><PRE>
177 <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>,
178 <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(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>
182 <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>
186 Man(1) output converted with
187 <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>