]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/curs_kernel.3x.html
e83dafb068068ff0e54e9de03b131fdbb284e05c
[ncurses.git] / doc / html / man / curs_kernel.3x.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
2 <!-- 
3   ****************************************************************************
4   * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc.                        *
5   *                                                                          *
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:                 *
13   *                                                                          *
14   * The above copyright notice and this permission notice shall be included  *
15   * in all copies or substantial portions of the Software.                   *
16   *                                                                          *
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.                               *
24   *                                                                          *
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       *
28   * authorization.                                                           *
29   ****************************************************************************
30   * @Id: curs_kernel.3x,v 1.18 2010/10/02 23:20:13 tom Exp @
31 -->
32 <HTML>
33 <HEAD>
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">
37 </HEAD>
38 <BODY>
39 <H1>curs_kernel 3x</H1>
40 <HR>
41 <PRE>
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>
44
45
46
47
48 </PRE>
49 <H2>NAME</H2><PRE>
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>
56 <H2>SYNOPSIS</H2><PRE>
57        <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>
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>
70
71
72 </PRE>
73 <H2>DESCRIPTION</H2><PRE>
74        The  following  routines  give low-level access to various
75        <STRONG>curses</STRONG> capabilities.  These routines  typically  are  used
76        inside library routines.
77
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  <STRONG>re-</STRONG>
81        <STRONG>set_prog_mode</STRONG> and <STRONG>reset_shell_mode</STRONG> routines.  This is done
82        automatically by <STRONG>initscr</STRONG>.  There is one such save area for
83        each screen context allocated by <STRONG>newterm()</STRONG>.
84
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
89        not called.
90
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>.
95
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>  in-
100        clude  these lines; therefore, <EM>y</EM> and <EM>x</EM> should be used only
101        as arguments for <STRONG>setsyx</STRONG>.
102
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  li-
106        brary  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 be-
109        ginning, 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>.
112
113        The <STRONG>ripoffline</STRONG> routine provides access to the same facili-
114        ty  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>&lt;curses.h&gt;</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.
127
128        <STRONG>ripoffline</STRONG>  can  be called up to five times before calling
129        <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG>.
130
131        The <STRONG>curs_set</STRONG> routine sets the cursor state  to  invisible,
132        normal, or very visible for <STRONG>visibility</STRONG> equal to <STRONG>0</STRONG>, <STRONG>1</STRONG>, or <STRONG>2</STRONG>
133        respectively.  If the terminal supports the <EM>visibility</EM> re-
134        quested, the previous <EM>cursor</EM> state is returned; otherwise,
135        <STRONG>ERR</STRONG> is returned.
136
137        The <STRONG>napms</STRONG> routine is used to sleep for <EM>ms</EM> milliseconds.
138
139
140 </PRE>
141 <H2>RETURN VALUE</H2><PRE>
142        Except for <STRONG>curs_set</STRONG>, these routines always return <STRONG>OK</STRONG>.
143
144        <STRONG>curs_set</STRONG> returns the previous cursor state, or <STRONG>ERR</STRONG> if  the
145        requested <EM>visibility</EM> is not supported.
146
147        X/Open  defines  no error conditions.  In this implementa-
148        tion
149
150               <STRONG>def_prog_mode</STRONG>, <STRONG>def_shell_mode</STRONG>, <STRONG>reset_prog_mode</STRONG>, <STRONG>re-</STRONG>
151               <STRONG>set_shell_mode</STRONG>
152                    return  an  error if the terminal was not ini-
153                    tialized, or if the I/O  call  to  obtain  the
154                    terminal settings fails.
155
156               <STRONG>ripoffline</STRONG>
157                    returns  an  error  if  the  maximum number of
158                    ripped-off lines exceeds the maximum (NRIPS  =
159                    5).
160
161
162 </PRE>
163 <H2>NOTES</H2><PRE>
164        Note  that <STRONG>getsyx</STRONG> is a macro, so <STRONG>&amp;</STRONG> is not necessary before
165        the variables <EM>y</EM> and <EM>x</EM>.
166
167        Older SVr4  man  pages  warn  that  the  return  value  of
168        <STRONG>curs_set</STRONG>  "is  currently  incorrect".  This implementation
169        gets it right, but it may be unwise to count on  the  cor-
170        rectness of the return value anywhere else.
171
172        Both  ncurses  and  SVr4  will  call <STRONG>curs_set</STRONG> in <STRONG>endwin</STRONG> if
173        <STRONG>curs_set</STRONG> has been called to make  the  cursor  other  than
174        normal,  i.e., either invisible or very visible.  There is
175        no way for ncurses to determine the initial  cursor  state
176        to restore that.
177
178
179 </PRE>
180 <H2>PORTABILITY</H2><PRE>
181        The  functions  <STRONG>setsyx</STRONG> and <STRONG>getsyx</STRONG> are not described in the
182        XSI Curses standard, Issue 4.  All other functions are  as
183        described in XSI Curses.
184
185        The SVr4 documentation describes <STRONG>setsyx</STRONG> and <STRONG>getsyx</STRONG> as hav-
186        ing return type int.  This  is  misleading,  as  they  are
187        macros with no documented semantics for the return value.
188
189
190 </PRE>
191 <H2>SEE ALSO</H2><PRE>
192        <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>
193        <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>
194        <STRONG><A HREF="curs_variables.3x.html">ables(3x)</A></STRONG>.
195
196
197
198                                                         <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>
199 </PRE>
200 <HR>
201 <ADDRESS>
202 Man(1) output converted with
203 <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
204 </ADDRESS>
205 </BODY>
206 </HTML>