]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/curs_kernel.3x.html
ncurses 6.0 - patch 20160820
[ncurses.git] / doc / html / man / curs_kernel.3x.html
1 <!-- 
2   ****************************************************************************
3   * Copyright (c) 1998-2010,2015 Free Software Foundation, Inc.                        *
4   *                                                                          *
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   ****************************************************************************
29   * @Id: curs_kernel.3x,v 1.20 2015/07/21 01:10:11 tom Exp @
30 -->
31 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
32 <HTML>
33 <HEAD>
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">
39 </HEAD>
40 <BODY>
41 <H1 class="no-header">curs_kernel 3x</H1>
42 <PRE>
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>
44
45
46
47
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>,
50        <STRONG>reset_shell_mode</STRONG>, <STRONG>resetty</STRONG>, <STRONG>savetty</STRONG>, <STRONG>getsyx</STRONG>, <STRONG>setsyx</STRONG>,
51        <STRONG>ripoffline</STRONG>, <STRONG>curs_set</STRONG>, <STRONG>napms</STRONG> - low-level <STRONG>curses</STRONG> routines
52
53
54 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
55        <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
56
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>
68
69
70 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
71        The  following  routines  give low-level access to various
72        <STRONG>curses</STRONG> capabilities.  These routines  typically  are  used
73        inside library routines.
74
75
76 </PRE><H3><a name="h3-def_prog_mode_-def_shell_mode">def_prog_mode, def_shell_mode</a></H3><PRE>
77        The  <STRONG>def_prog_mode</STRONG>  and  <STRONG>def_shell_mode</STRONG>  routines save the
78        current terminal modes as the  "program"  (in  <STRONG>curses</STRONG>)  or
79        "shell"   (not  in  <STRONG>curses</STRONG>)  state  for  use  by  the  <STRONG>re-</STRONG>
80        <STRONG>set_prog_mode</STRONG> and <STRONG>reset_shell_mode</STRONG> routines.  This is done
81        automatically by <STRONG>initscr</STRONG>.  There is one such save area for
82        each screen context allocated by <STRONG>newterm()</STRONG>.
83
84
85 </PRE><H3><a name="h3-reset_prog_mode_-reset_shell_mode">reset_prog_mode, reset_shell_mode</a></H3><PRE>
86        The <STRONG>reset_prog_mode</STRONG> and <STRONG>reset_shell_mode</STRONG> routines  restore
87        the  terminal  to "program" (in <STRONG>curses</STRONG>) or "shell" (out of
88        <STRONG>curses</STRONG>) state.  These are  done  automatically  by  <STRONG>endwin</STRONG>
89        and,  after  an  <STRONG>endwin</STRONG>, by <STRONG>doupdate</STRONG>, so they normally are
90        not called.
91
92
93 </PRE><H3><a name="h3-resetty_-savetty">resetty, savetty</a></H3><PRE>
94        The <STRONG>resetty</STRONG> and <STRONG>savetty</STRONG>  routines  save  and  restore  the
95        state  of  the  terminal modes.  <STRONG>savetty</STRONG> saves the current
96        state in a buffer and <STRONG>resetty</STRONG> restores the state  to  what
97        it was at the last call to <STRONG>savetty</STRONG>.
98
99
100 </PRE><H3><a name="h3-getsyx">getsyx</a></H3><PRE>
101        The  <STRONG>getsyx</STRONG> routine returns the current coordinates of the
102        virtual screen cursor in <EM>y</EM> and <EM>x</EM>.  If <STRONG>leaveok</STRONG> is currently
103        <STRONG>TRUE</STRONG>,  then <STRONG>-1</STRONG>,<STRONG>-1</STRONG> is returned.  If lines have been removed
104        from the top of the screen, using <STRONG>ripoffline</STRONG>, <EM>y</EM> and <EM>x</EM>  in-
105        clude  these lines; therefore, <EM>y</EM> and <EM>x</EM> should be used only
106        as arguments for <STRONG>setsyx</STRONG>.
107
108
109 </PRE><H3><a name="h3-setsyx">setsyx</a></H3><PRE>
110        The <STRONG>setsyx</STRONG> routine sets the virtual screen cursor to <EM>y</EM>, <EM>x</EM>.
111        If <EM>y</EM> and <EM>x</EM> are both <STRONG>-1</STRONG>, then <STRONG>leaveok</STRONG> is set.  The two rou-
112        tines <STRONG>getsyx</STRONG> and <STRONG>setsyx</STRONG> are designed to be used by  a  li-
113        brary  routine,  which manipulates <STRONG>curses</STRONG> windows but does
114        not want to change the current position of  the  program's
115        cursor.   The library routine would call <STRONG>getsyx</STRONG> at the be-
116        ginning, do its manipulation of  its  own  windows,  do  a
117        <STRONG>wnoutrefresh</STRONG>  on  its  windows, call <STRONG>setsyx</STRONG>, and then call
118        <STRONG>doupdate</STRONG>.
119
120
121 </PRE><H3><a name="h3-ripoffline">ripoffline</a></H3><PRE>
122        The <STRONG>ripoffline</STRONG> routine provides access to the same facili-
123        ty  that  <STRONG>slk_init</STRONG>  [see  <STRONG><A HREF="curs_slk.3x.html">curs_slk(3x)</A></STRONG>] uses to reduce the
124        size of the screen.   <STRONG>ripoffline</STRONG>  must  be  called  before
125        <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG> is called, to prepare these initial ac-
126        tions:
127
128        <STRONG>o</STRONG>   If <EM>line</EM> is positive, a line is removed from the top of
129            <STRONG>stdscr</STRONG>.
130
131        <STRONG>o</STRONG>   if  <EM>line</EM>  is negative, a line is removed from the bot-
132            tom.
133
134        When the resulting initialization is done inside  <STRONG>initscr</STRONG>,
135        the routine <STRONG>init</STRONG> (supplied by the user) is called with two
136        arguments:
137
138        <STRONG>o</STRONG>   a window pointer to the one-line window that has  been
139            allocated and
140
141        <STRONG>o</STRONG>   an integer with the number of columns in the window.
142
143        Inside  this initialization routine, the integer variables
144        <STRONG>LINES</STRONG> and <STRONG>COLS</STRONG> (defined in <STRONG>&lt;curses.h&gt;</STRONG>) are not  guaranteed
145        to  be  accurate  and  <STRONG>wrefresh</STRONG>  or  <STRONG>doupdate</STRONG>  must not be
146        called.  It is allowable to call <STRONG>wnoutrefresh</STRONG>  during  the
147        initialization routine.
148
149        <STRONG>ripoffline</STRONG>  can  be called up to five times before calling
150        <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG>.
151
152
153 </PRE><H3><a name="h3-curs_set">curs_set</a></H3><PRE>
154        The <STRONG>curs_set</STRONG> routine sets the cursor state  to  invisible,
155        normal, or very visible for <STRONG>visibility</STRONG> equal to <STRONG>0</STRONG>, <STRONG>1</STRONG>, or <STRONG>2</STRONG>
156        respectively.  If the terminal supports the <EM>visibility</EM> re-
157        quested, the previous <EM>cursor</EM> state is returned; otherwise,
158        <STRONG>ERR</STRONG> is returned.
159
160
161 </PRE><H3><a name="h3-napms">napms</a></H3><PRE>
162        The <STRONG>napms</STRONG> routine is used to sleep for <EM>ms</EM> milliseconds.
163
164
165 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
166        Except for <STRONG>curs_set</STRONG>, these routines always return <STRONG>OK</STRONG>.
167
168        <STRONG>curs_set</STRONG> returns the previous cursor state, or <STRONG>ERR</STRONG> if  the
169        requested <EM>visibility</EM> is not supported.
170
171        X/Open  defines  no error conditions.  In this implementa-
172        tion
173
174        <STRONG>def_prog_mode</STRONG>, <STRONG>def_shell_mode</STRONG>, <STRONG>reset_prog_mode</STRONG>,
175        <STRONG>reset_shell_mode</STRONG>
176             return  an error if the terminal was not initialized,
177             or if the I/O call to obtain  the  terminal  settings
178             fails.
179
180        <STRONG>ripoffline</STRONG>
181             returns  an error if the maximum number of ripped-off
182             lines exceeds the maximum (NRIPS = 5).
183
184
185 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
186        Note that <STRONG>getsyx</STRONG> is a macro, so <STRONG>&amp;</STRONG> is not necessary  before
187        the variables <EM>y</EM> and <EM>x</EM>.
188
189        Older  SVr4  man  pages  warn  that  the  return  value of
190        <STRONG>curs_set</STRONG> "is currently  incorrect".   This  implementation
191        gets  it  right, but it may be unwise to count on the cor-
192        rectness of the return value anywhere else.
193
194        Both ncurses and SVr4 will  call  <STRONG>curs_set</STRONG>  in  <STRONG>endwin</STRONG>  if
195        <STRONG>curs_set</STRONG>  has  been  called  to make the cursor other than
196        normal, i.e., either invisible or very visible.  There  is
197        no  way  for ncurses to determine the initial cursor state
198        to restore that.
199
200
201 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
202        The functions <STRONG>setsyx</STRONG> and <STRONG>getsyx</STRONG> are not described  in  the
203        XSI  Curses standard, Issue 4.  All other functions are as
204        described in XSI Curses.
205
206        The SVr4 documentation describes <STRONG>setsyx</STRONG> and <STRONG>getsyx</STRONG> as hav-
207        ing  return  type  int.  This  is  misleading, as they are
208        macros with no documented semantics for the return value.
209
210
211 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
212        <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>
213        <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>
214        <STRONG><A HREF="curs_variables.3x.html">ables(3x)</A></STRONG>.
215
216
217
218                                                         <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>
219 </PRE>
220 <div class="nav">
221 <ul>
222 <li><a href="#h2-NAME">NAME</a></li>
223 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
224 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
225 <ul>
226 <li><a href="#h3-def_prog_mode_-def_shell_mode">def_prog_mode, def_shell_mode</a></li>
227 <li><a href="#h3-reset_prog_mode_-reset_shell_mode">reset_prog_mode, reset_shell_mode</a></li>
228 <li><a href="#h3-resetty_-savetty">resetty, savetty</a></li>
229 <li><a href="#h3-getsyx">getsyx</a></li>
230 <li><a href="#h3-setsyx">setsyx</a></li>
231 <li><a href="#h3-ripoffline">ripoffline</a></li>
232 <li><a href="#h3-curs_set">curs_set</a></li>
233 <li><a href="#h3-napms">napms</a></li>
234 </ul>
235 </li>
236 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
237 <li><a href="#h2-NOTES">NOTES</a></li>
238 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
239 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
240 </ul>
241 </div>
242 </BODY>
243 </HTML>