1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
<HTML>
<BODY>
<PRE>
<!-- Manpage converted by man2html 3.0.1 -->
</PRE>
<H2>NAME</H2><PRE>
<B>def_prog_mode</B>, <B>def_shell_mode</B>, <B>reset_prog_mode</B>,
<B>reset_shell_mode</B>, <B>resetty</B>, <B>savetty</B>, <B>getsyx</B>, <B>setsyx</B>, <B>ripof-</B>
<B>fline</B>, <B>curs_set</B>, <B>napms</B> - low-level <B>curses</B> routines
</PRE>
<H2>SYNOPSIS</H2><PRE>
<B>#include</B> <B><curses.h></B>
<B>int</B> <B>def_prog_mode(void);</B>
<B>int</B> <B>def_shell_mode(void);</B>
<B>int</B> <B>reset_prog_mode(void);</B>
<B>int</B> <B>reset_shell_mode(void);</B>
<B>int</B> <B>resetty(void);</B>
<B>int</B> <B>savetty(void);</B>
<B>void</B> <B>getsyx(int</B> <B>y,</B> <B>int</B> <B>x);</B>
<B>void</B> <B>setsyx(int</B> <B>y,</B> <B>int</B> <B>x);</B>
<B>int</B> <B>ripoffline(int</B> <B>line,</B> <B>int</B> <B>(*init)(WINDOW</B> <B>*,</B> <B>int));</B>
<B>int</B> <B>curs_set(int</B> <B>visibility);</B>
<B>int</B> <B>napms(int</B> <B>ms);</B>
</PRE>
<H2>DESCRIPTION</H2><PRE>
The following routines give low-level access to various
<B>curses</B> capabilities. Theses routines typically are used
inside library routines.
The <B>def_prog_mode</B> and <B>def_shell_mode</B> routines save the
current terminal modes as the "program" (in <B>curses</B>) or
"shell" (not in <B>curses</B>) state for use by the
<B>reset_prog_mode</B> and <B>reset_shell_mode</B> routines. This is
done automatically by <B>initscr</B>. There is one such save
area for each screen context allocated by <B>newterm()</B>.
The <B>reset_prog_mode</B> and <B>reset_shell_mode</B> routines restore
the terminal to "program" (in <B>curses</B>) or "shell" (out of
<B>curses</B>) state. These are done automatically by <B>endwin</B>
and, after an <B>endwin</B>, by <B>doupdate</B>, so they normally are
not called.
The <B>resetty</B> and <B>savetty</B> routines save and restore the
state of the terminal modes. <B>savetty</B> saves the current
state in a buffer and <B>resetty</B> restores the state to what
it was at the last call to <B>savetty</B>.
The <B>getsyx</B> routine returns the current coordinates of the
virtual screen cursor in <I>y</I> and <I>x</I>. If <B>leaveok</B> is currently
<B>TRUE</B>, then <B>-1</B>,<B>-1</B> is returned. If lines have been removed
from the top of the screen, using <B>ripoffline</B>, <I>y</I> and <I>x</I>
include these lines; therefore, <I>y</I> and <I>x</I> should be used
only as arguments for <B>setsyx</B>.
The <B>setsyx</B> routine sets the virtual screen cursor to <I>y</I>, <I>x</I>.
If <I>y</I> and <I>x</I> are both <B>-1</B>, then <B>leaveok</B> is set. The two rou-
tines <B>getsyx</B> and <B>setsyx</B> are designed to be used by a
library routine, which manipulates <B>curses</B> windows but does
not want to change the current position of the program's
cursor. The library routine would call <B>getsyx</B> at the
beginning, do its manipulation of its own windows, do a
<B>wnoutrefresh</B> on its windows, call <B>setsyx</B>, and then call
<B>doupdate</B>.
The <B>ripoffline</B> routine provides access to the same facil-
ity that <B>slk_init</B> [see <B><A HREF="curs_slk.3x.html">curs_slk(3x)</A></B>] uses to reduce the
size of the screen. <B>ripoffline</B> must be called before
<B>initscr</B> or <B>newterm</B> is called. If <I>line</I> is positive, a line
is removed from the top of <B>stdscr</B>; if <I>line</I> is negative, a
line is removed from the bottom. When this is done inside
<B>initscr</B>, the routine <B>init</B> (supplied by the user) is called
with two arguments: a window pointer to the one-line win-
dow that has been allocated and an integer with the number
of columns in the window. Inside this initialization rou-
tine, the integer variables <B>LINES</B> and <B>COLS</B> (defined in
<B><curses.h></B>) are not guaranteed to be accurate and <B>wrefresh</B>
or <B>doupdate</B> must not be called. It is allowable to call
<B>wnoutrefresh</B> during the initialization routine.
<B>ripoffline</B> can be called up to five times before calling
<B>initscr</B> or <B>newterm</B>.
The <B>curs_set</B> routine sets the cursor state is set to
invisible, normal, or very visible for <B>visibility</B> equal to
<B>0</B>, <B>1</B>, or <B>2</B> respectively. If the terminal supports the
<I>visibility</I> requested, the previous <I>cursor</I> state is
returned; otherwise, <B>ERR</B> is returned.
The <B>napms</B> routine is used to sleep for <I>ms</I> milliseconds.
</PRE>
<H2>RETURN VALUE</H2><PRE>
Except for <B>curs_set</B>, these routines always return <B>OK</B>.
<B>curs_set</B> returns the previous cursor state, or <B>ERR</B> if the
requested <I>visibility</I> is not supported.
</PRE>
<H2>NOTES</H2><PRE>
Note that <B>getsyx</B> is a macro, so <B>&</B> is not necessary before
the variables <I>y</I> and <I>x</I>.
Older SVr4 man pages warn that the return value of
<B>curs_set</B> "is currently incorrect". This implementation
gets it right, but it may be unwise to count on the cor-
rectness of the return value anywhere else.
Both ncurses and SVr4 will call <B>curs_set</B> in <B>endwin</B> if
<B>curs_set</B> has been called to make the cursor other than
normal, i.e., either visible or very visible. There is no
way for ncurses to determine the initial cursor state to
restore that.
</PRE>
<H2>PORTABILITY</H2><PRE>
The functions <B>setsyx</B> and <B>getsyx</B> are not described in the
XSI Curses standard, Issue 4. All other functions are as
described in XSI Curses.
The SVr4 documentation describes <B>setsyx</B> and <B>getsyx</B> as hav-
ing return type int. This is misleading, as they are
macros with no documented semantics for the return value.
</PRE>
<H2>SEE ALSO</H2><PRE>
<B><A HREF="ncurses.3x.html">curses(3x)</A></B>, <B><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></B>, <B><A HREF="curs_outopts.3x.html">curs_outopts(3x)</A></B>,
<B><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></B>, <B><A HREF="curs_scr_dump.3x.html">curs_scr_dump(3x)</A></B>, <B><A HREF="curs_slk.3x.html">curs_slk(3x)</A></B>
</PRE>
<HR>
<ADDRESS>
Man(1) output converted with
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
</ADDRESS>
</BODY>
</HTML>
|