]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_kernel.3x
ncurses 5.4
[ncurses.git] / man / curs_kernel.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 1998 Free Software Foundation, Inc.                        *
3 .\"                                                                          *
4 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
5 .\" copy of this software and associated documentation files (the            *
6 .\" "Software"), to deal in the Software without restriction, including      *
7 .\" without limitation the rights to use, copy, modify, merge, publish,      *
8 .\" distribute, distribute with modifications, sublicense, and/or sell       *
9 .\" copies of the Software, and to permit persons to whom the Software is    *
10 .\" furnished to do so, subject to the following conditions:                 *
11 .\"                                                                          *
12 .\" The above copyright notice and this permission notice shall be included  *
13 .\" in all copies or substantial portions of the Software.                   *
14 .\"                                                                          *
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22 .\"                                                                          *
23 .\" Except as contained in this notice, the name(s) of the above copyright   *
24 .\" holders shall not be used in advertising or otherwise to promote the     *
25 .\" sale, use or other dealings in this Software without prior written       *
26 .\" authorization.                                                           *
27 .\"***************************************************************************
28 .\"
29 .\" $Id: curs_kernel.3x,v 1.13 2001/12/08 18:01:25 tom Exp $
30 .TH curs_kernel 3X ""
31 .SH NAME
32 \fBdef_prog_mode\fR, \fBdef_shell_mode\fR,
33 \fBreset_prog_mode\fR, \fBreset_shell_mode\fR, \fBresetty\fR,
34 \fBsavetty\fR, \fBgetsyx\fR, \fBsetsyx\fR, \fBripoffline\fR,
35 \fBcurs_set\fR, \fBnapms\fR - low-level \fBcurses\fR routines
36 .SH SYNOPSIS
37 \fB#include <curses.h>\fR
38
39 \fBint def_prog_mode(void);\fR
40 .br
41 \fBint def_shell_mode(void);\fR
42 .br
43 \fBint reset_prog_mode(void);\fR
44 .br
45 \fBint reset_shell_mode(void);\fR
46 .br
47 \fBint resetty(void);\fR
48 .br
49 \fBint savetty(void);\fR
50 .br
51 \fBvoid getsyx(int y, int x);\fR
52 .br
53 \fBvoid setsyx(int y, int x);\fR
54 .br
55 \fBint ripoffline(int line, int (*init)(WINDOW *, int));\fR
56 .br
57 \fBint curs_set(int visibility);\fR
58 .br
59 \fBint napms(int ms);\fR
60 .br
61 .SH DESCRIPTION
62 The following routines give low-level access to various \fBcurses\fR
63 capabilities.  Theses routines typically are used inside library
64 routines.
65
66 The \fBdef_prog_mode\fR and \fBdef_shell_mode\fR routines save the
67 current terminal modes as the "program" (in \fBcurses\fR) or "shell"
68 (not in \fBcurses\fR) state for use by the \fBreset_prog_mode\fR and
69 \fBreset_shell_mode\fR routines.  This is done automatically by
70 \fBinitscr\fR.  There is one such save area for each screen context
71 allocated by \fBnewterm()\fR.
72
73 The \fBreset_prog_mode\fR and \fBreset_shell_mode\fR routines restore
74 the terminal to "program" (in \fBcurses\fR) or "shell" (out of
75 \fBcurses\fR) state.  These are done automatically by \fBendwin\fR
76 and, after an \fBendwin\fR, by \fBdoupdate\fR, so they normally are
77 not called.
78
79 The \fBresetty\fR and \fBsavetty\fR routines save and restore the
80 state of the terminal modes.  \fBsavetty\fR saves the current state in
81 a buffer and \fBresetty\fR restores the state to what it was at the
82 last call to \fBsavetty\fR.
83
84 The \fBgetsyx\fR routine returns the current coordinates of the virtual screen
85 cursor in \fIy\fR and \fIx\fR.  If \fBleaveok\fR is currently \fBTRUE\fR, then
86 \fB-1\fR,\fB-1\fR is returned.  If lines have been removed from the top of the
87 screen, using \fBripoffline\fR, \fIy\fR and \fIx\fR include these lines;
88 therefore, \fIy\fR and \fIx\fR should be used only as arguments for
89 \fBsetsyx\fR.
90
91 The \fBsetsyx\fR routine sets the virtual screen cursor to
92 \fIy\fR, \fIx\fR.  If \fIy\fR and \fIx\fR are both \fB-1\fR, then
93 \fBleaveok\fR is set.  The two routines \fBgetsyx\fR and \fBsetsyx\fR
94 are designed to be used by a library routine, which manipulates
95 \fBcurses\fR windows but does not want to change the current position
96 of the program's cursor.  The library routine would call \fBgetsyx\fR
97 at the beginning, do its manipulation of its own windows, do a
98 \fBwnoutrefresh\fR on its windows, call \fBsetsyx\fR, and then call
99 \fBdoupdate\fR.
100
101 The \fBripoffline\fR routine provides access to the same facility that
102 \fBslk_init\fR [see \fBcurs_slk\fR(3X)] uses to reduce the size of the
103 screen.  \fBripoffline\fR must be called before \fBinitscr\fR or
104 \fBnewterm\fR is called.  If \fIline\fR is positive, a line is removed
105 from the top of \fBstdscr\fR; if \fIline\fR is negative, a line is
106 removed from the bottom.  When this is done inside \fBinitscr\fR, the
107 routine \fBinit\fR (supplied by the user) is called with two
108 arguments: a window pointer to the one-line window that has been
109 allocated and an integer with the number of columns in the window.
110 Inside this initialization routine, the integer variables \fBLINES\fR
111 and \fBCOLS\fR (defined in \fB<curses.h>\fR) are not guaranteed to be
112 accurate and \fBwrefresh\fR or \fBdoupdate\fR must not be called.  It
113 is allowable to call \fBwnoutrefresh\fR during the initialization
114 routine.
115
116 \fBripoffline\fR can be called up to five times before calling \fBinitscr\fR or
117 \fBnewterm\fR.
118
119 The \fBcurs_set\fR routine sets the cursor state is set to invisible,
120 normal, or very visible for \fBvisibility\fR equal to \fB0\fR,
121 \fB1\fR, or \fB2\fR respectively.  If the terminal supports the
122 \fIvisibility\fR requested, the previous \fIcursor\fR state is
123 returned; otherwise, \fBERR\fR is returned.
124
125 The \fBnapms\fR routine is used to sleep for \fIms\fR milliseconds.
126 .SH RETURN VALUE
127 Except for \fBcurs_set\fR, these routines always return \fBOK\fR.
128 \fBcurs_set\fR returns the previous cursor state, or \fBERR\fR if the
129 requested \fIvisibility\fR is not supported.
130 .SH NOTES
131 Note that \fBgetsyx\fR is a macro, so \fB&\fR is not necessary before
132 the variables \fIy\fR and \fIx\fR.
133
134 Older SVr4 man pages warn that the return value of \fBcurs_set\fR "is currently
135 incorrect".  This implementation gets it right, but it may be unwise to count
136 on the correctness of the return value anywhere else.
137
138 Both ncurses and SVr4 will call \fBcurs_set\fR in \fBendwin\fR
139 if \fBcurs_set\fR
140 has been called to make the cursor other than normal, i.e., either
141 invisible or very visible.
142 There is no way for ncurses to determine the initial cursor state to
143 restore that.
144 .SH PORTABILITY
145 The functions \fBsetsyx\fR and \fBgetsyx\fR are not described in the XSI
146 Curses standard, Issue 4.  All other functions are as described in XSI Curses.
147
148 The SVr4 documentation describes \fBsetsyx\fR and \fBgetsyx\fR as having return
149 type int. This is misleading, as they are macros with no documented semantics
150 for the return value.
151 .SH SEE ALSO
152 \fBcurses\fR(3X), \fBcurs_initscr\fR(3X), \fBcurs_outopts\fR(3X), \fBcurs_refresh\fR(3X),
153 \fBcurs_scr_dump\fR(3X), \fBcurs_slk\fR(3X)
154 .\"#
155 .\"# The following sets edit modes for GNU EMACS
156 .\"# Local Variables:
157 .\"# mode:nroff
158 .\"# fill-column:79
159 .\"# End: