curs_kernel.3x.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
  2. <!--
  3. ****************************************************************************
  4. * Copyright (c) 1998-2001,2005 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.15 2005/05/15 16:18: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. </PRE>
  45. <H2>NAME</H2><PRE>
  46. <STRONG>def_prog_mode</STRONG>, <STRONG>def_shell_mode</STRONG>, <STRONG>reset_prog_mode</STRONG>,
  47. <STRONG>reset_shell_mode</STRONG>, <STRONG>resetty</STRONG>, <STRONG>savetty</STRONG>, <STRONG>getsyx</STRONG>, <STRONG>setsyx</STRONG>,
  48. <STRONG>ripoffline</STRONG>, <STRONG>curs_set</STRONG>, <STRONG>napms</STRONG> - low-level <STRONG>curses</STRONG> routines
  49. </PRE>
  50. <H2>SYNOPSIS</H2><PRE>
  51. <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
  52. <STRONG>int</STRONG> <STRONG>def_prog_mode(void);</STRONG>
  53. <STRONG>int</STRONG> <STRONG>def_shell_mode(void);</STRONG>
  54. <STRONG>int</STRONG> <STRONG>reset_prog_mode(void);</STRONG>
  55. <STRONG>int</STRONG> <STRONG>reset_shell_mode(void);</STRONG>
  56. <STRONG>int</STRONG> <STRONG>resetty(void);</STRONG>
  57. <STRONG>int</STRONG> <STRONG>savetty(void);</STRONG>
  58. <STRONG>void</STRONG> <STRONG>getsyx(int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x);</STRONG>
  59. <STRONG>void</STRONG> <STRONG>setsyx(int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x);</STRONG>
  60. <STRONG>int</STRONG> <STRONG>ripoffline(int</STRONG> <STRONG>line,</STRONG> <STRONG>int</STRONG> <STRONG>(*init)(WINDOW</STRONG> <STRONG>*,</STRONG> <STRONG>int));</STRONG>
  61. <STRONG>int</STRONG> <STRONG>curs_set(int</STRONG> <STRONG>visibility);</STRONG>
  62. <STRONG>int</STRONG> <STRONG>napms(int</STRONG> <STRONG>ms);</STRONG>
  63. </PRE>
  64. <H2>DESCRIPTION</H2><PRE>
  65. The following routines give low-level access to various
  66. <STRONG>curses</STRONG> capabilities. Theses routines typically are used
  67. inside library routines.
  68. The <STRONG>def_prog_mode</STRONG> and <STRONG>def_shell_mode</STRONG> routines save the
  69. current terminal modes as the "program" (in <STRONG>curses</STRONG>) or
  70. "shell" (not in <STRONG>curses</STRONG>) state for use by the <STRONG>re-</STRONG>
  71. <STRONG>set_prog_mode</STRONG> and <STRONG>reset_shell_mode</STRONG> routines. This is done
  72. automatically by <STRONG>initscr</STRONG>. There is one such save area for
  73. each screen context allocated by <STRONG>newterm()</STRONG>.
  74. The <STRONG>reset_prog_mode</STRONG> and <STRONG>reset_shell_mode</STRONG> routines restore
  75. the terminal to "program" (in <STRONG>curses</STRONG>) or "shell" (out of
  76. <STRONG>curses</STRONG>) state. These are done automatically by <STRONG>endwin</STRONG>
  77. and, after an <STRONG>endwin</STRONG>, by <STRONG>doupdate</STRONG>, so they normally are
  78. not called.
  79. The <STRONG>resetty</STRONG> and <STRONG>savetty</STRONG> routines save and restore the
  80. state of the terminal modes. <STRONG>savetty</STRONG> saves the current
  81. state in a buffer and <STRONG>resetty</STRONG> restores the state to what
  82. it was at the last call to <STRONG>savetty</STRONG>.
  83. The <STRONG>getsyx</STRONG> routine returns the current coordinates of the
  84. virtual screen cursor in <EM>y</EM> and <EM>x</EM>. If <STRONG>leaveok</STRONG> is currently
  85. <STRONG>TRUE</STRONG>, then <STRONG>-1</STRONG>,<STRONG>-1</STRONG> is returned. If lines have been removed
  86. from the top of the screen, using <STRONG>ripoffline</STRONG>, <EM>y</EM> and <EM>x</EM> in-
  87. clude these lines; therefore, <EM>y</EM> and <EM>x</EM> should be used only
  88. as arguments for <STRONG>setsyx</STRONG>.
  89. The <STRONG>setsyx</STRONG> routine sets the virtual screen cursor to <EM>y</EM>, <EM>x</EM>.
  90. If <EM>y</EM> and <EM>x</EM> are both <STRONG>-1</STRONG>, then <STRONG>leaveok</STRONG> is set. The two rou-
  91. tines <STRONG>getsyx</STRONG> and <STRONG>setsyx</STRONG> are designed to be used by a li-
  92. brary routine, which manipulates <STRONG>curses</STRONG> windows but does
  93. not want to change the current position of the program's
  94. cursor. The library routine would call <STRONG>getsyx</STRONG> at the be-
  95. ginning, do its manipulation of its own windows, do a
  96. <STRONG>wnoutrefresh</STRONG> on its windows, call <STRONG>setsyx</STRONG>, and then call
  97. <STRONG>doupdate</STRONG>.
  98. The <STRONG>ripoffline</STRONG> routine provides access to the same facili-
  99. ty that <STRONG>slk_init</STRONG> [see <STRONG><A HREF="curs_slk.3x.html">curs_slk(3x)</A></STRONG>] uses to reduce the
  100. size of the screen. <STRONG>ripoffline</STRONG> must be called before
  101. <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG> is called. If <EM>line</EM> is positive, a line
  102. is removed from the top of <STRONG>stdscr</STRONG>; if <EM>line</EM> is negative, a
  103. line is removed from the bottom. When this is done inside
  104. <STRONG>initscr</STRONG>, the routine <STRONG>init</STRONG> (supplied by the user) is called
  105. with two arguments: a window pointer to the one-line win-
  106. dow that has been allocated and an integer with the number
  107. of columns in the window. Inside this initialization rou-
  108. tine, the integer variables <STRONG>LINES</STRONG> and <STRONG>COLS</STRONG> (defined in
  109. <STRONG>&lt;curses.h&gt;</STRONG>) are not guaranteed to be accurate and <STRONG>wrefresh</STRONG>
  110. or <STRONG>doupdate</STRONG> must not be called. It is allowable to call
  111. <STRONG>wnoutrefresh</STRONG> during the initialization routine.
  112. <STRONG>ripoffline</STRONG> can be called up to five times before calling
  113. <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG>.
  114. The <STRONG>curs_set</STRONG> routine sets the cursor state is set to in-
  115. visible, normal, or very visible for <STRONG>visibility</STRONG> equal to
  116. <STRONG>0</STRONG>, <STRONG>1</STRONG>, or <STRONG>2</STRONG> respectively. If the terminal supports the
  117. <EM>visibility</EM> requested, the previous <EM>cursor</EM> state is re-
  118. turned; otherwise, <STRONG>ERR</STRONG> is returned.
  119. The <STRONG>napms</STRONG> routine is used to sleep for <EM>ms</EM> milliseconds.
  120. </PRE>
  121. <H2>RETURN VALUE</H2><PRE>
  122. Except for <STRONG>curs_set</STRONG>, these routines always return <STRONG>OK</STRONG>.
  123. <STRONG>curs_set</STRONG> returns the previous cursor state, or <STRONG>ERR</STRONG> if the
  124. requested <EM>visibility</EM> is not supported.
  125. X/Open defines no error conditions. In this implementa-
  126. tion
  127. <STRONG>def_prog_mode</STRONG>, <STRONG>def_shell_mode</STRONG>, <STRONG>reset_prog_mode</STRONG>, <STRONG>re-</STRONG>
  128. <STRONG>set_shell_mode</STRONG>
  129. return an error if the terminal was not ini-
  130. tialized, or if the I/O call to obtain the
  131. terminal settings fails.
  132. <STRONG>ripoffline</STRONG>
  133. returns an error if the maximum number of
  134. ripped-off lines exceeds the maximum (NRIPS =
  135. 5).
  136. </PRE>
  137. <H2>NOTES</H2><PRE>
  138. Note that <STRONG>getsyx</STRONG> is a macro, so <STRONG>&amp;</STRONG> is not necessary before
  139. the variables <EM>y</EM> and <EM>x</EM>.
  140. Older SVr4 man pages warn that the return value of
  141. <STRONG>curs_set</STRONG> "is currently incorrect". This implementation
  142. gets it right, but it may be unwise to count on the cor-
  143. rectness of the return value anywhere else.
  144. Both ncurses and SVr4 will call <STRONG>curs_set</STRONG> in <STRONG>endwin</STRONG> if
  145. <STRONG>curs_set</STRONG> has been called to make the cursor other than
  146. normal, i.e., either invisible or very visible. There is
  147. no way for ncurses to determine the initial cursor state
  148. to restore that.
  149. </PRE>
  150. <H2>PORTABILITY</H2><PRE>
  151. The functions <STRONG>setsyx</STRONG> and <STRONG>getsyx</STRONG> are not described in the
  152. XSI Curses standard, Issue 4. All other functions are as
  153. described in XSI Curses.
  154. The SVr4 documentation describes <STRONG>setsyx</STRONG> and <STRONG>getsyx</STRONG> as hav-
  155. ing return type int. This is misleading, as they are
  156. macros with no documented semantics for the return value.
  157. </PRE>
  158. <H2>SEE ALSO</H2><PRE>
  159. <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>
  160. <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>
  161. <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>
  162. </PRE>
  163. <HR>
  164. <ADDRESS>
  165. Man(1) output converted with
  166. <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
  167. </ADDRESS>
  168. </BODY>
  169. </HTML>