Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | <!-- |
| 2 | **************************************************************************** |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 3 | * Copyright (c) 1998-2010,2015 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 | **************************************************************************** |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 29 | * @Id: curs_kernel.3x,v 1.20 2015/07/21 01:10:11 tom Exp @ |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 30 | --> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 31 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 32 | <HTML> |
| 33 | <HEAD> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 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"> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 41 | <H1 class="no-header">curs_kernel 3x</H1> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 42 | <PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 49 | <H2><a name="h2-NAME">NAME</a></H2><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 |
| 53 | |
| 54 | |
| 55 | </PRE> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 56 | <H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 57 | <STRONG>#include</STRONG> <STRONG><curses.h></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 Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 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> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 70 | |
| 71 | |
| 72 | </PRE> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 73 | <H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 74 | The following routines give low-level access to various |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 75 | <STRONG>curses</STRONG> capabilities. These routines typically are used |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 76 | inside library routines. |
| 77 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 78 | |
| 79 | </PRE> |
| 80 | <H3><a name="h3-def_prog_mode_-def_shell_mode">def_prog_mode, def_shell_mode</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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>. |
| 87 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 88 | |
| 89 | </PRE> |
| 90 | <H3><a name="h3-reset_prog_mode_-reset_shell_mode">reset_prog_mode, reset_shell_mode</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 |
| 95 | not called. |
| 96 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 97 | |
| 98 | </PRE> |
| 99 | <H3><a name="h3-resetty_-savetty">resetty, savetty</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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>. |
| 104 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 105 | |
| 106 | </PRE> |
| 107 | <H3><a name="h3-getsyx">getsyx</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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>. |
| 114 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 115 | |
| 116 | </PRE> |
| 117 | <H3><a name="h3-setsyx">setsyx</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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>. |
| 127 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 128 | |
| 129 | </PRE> |
| 130 | <H3><a name="h3-ripoffline">ripoffline</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 134 | <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><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. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 157 | |
| 158 | <STRONG>ripoffline</STRONG> can be called up to five times before calling |
| 159 | <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG>. |
| 160 | |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 161 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 162 | </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 Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 173 | The <STRONG>napms</STRONG> routine is used to sleep for <EM>ms</EM> milliseconds. |
| 174 | |
| 175 | |
| 176 | </PRE> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 177 | <H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 178 | 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 Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 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 |
| 190 | fails. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 191 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 192 | <STRONG>ripoffline</STRONG> |
| 193 | returns an error if the maximum number of ripped-off |
| 194 | lines exceeds the maximum (NRIPS = 5). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 195 | |
| 196 | |
| 197 | </PRE> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 198 | <H2><a name="h2-NOTES">NOTES</a></H2><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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>. |
| 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 Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 215 | <H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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. |
| 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 Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 222 | macros with no documented semantics for the return value. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 223 | |
| 224 | |
| 225 | </PRE> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 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>. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 230 | |
| 231 | |
| 232 | |
| 233 | <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG> |
| 234 | </PRE> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 235 | <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 Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 257 | </BODY> |
| 258 | </HTML> |