📄 curs_terminfo.3x.html
字号:
fer to invalid memory locations until another <STRONG>setupterm</STRONG> has been called. The <STRONG>restartterm</STRONG> routine is similar to <STRONG>setupterm</STRONG> and <STRONG>initscr</STRONG>, except that it is called after restoring memory to a previous state (for example, when reloading a game saved as a core image dump). It assumes that the windows and the input and output options are the same as when mem- ory was saved, but the terminal type and baud rate may be different. Accordingly, it saves various tty state bits, does a setupterm, and then restores the bits. The <STRONG>tparm</STRONG> routine instantiates the string <EM>str</EM> with parame- ters <EM>pi</EM>. A pointer is returned to the result of <EM>str</EM> with the parameters applied. The <STRONG>tputs</STRONG> routine applies padding information to the string <EM>str</EM> and outputs it. The <EM>str</EM> must be a terminfo string variable or the return value from <STRONG>tparm</STRONG>, <STRONG>tgetstr</STRONG>, or <STRONG>tgoto</STRONG>. <EM>affcnt</EM> is the number of lines affected, or 1 if not applicable. <EM>putc</EM> is a <STRONG>putchar</STRONG>-like routine to which the characters are passed, one at a time. The <STRONG>putp</STRONG> routine calls <STRONG>tputs(</STRONG><EM>str</EM><STRONG>,</STRONG> <STRONG>1,</STRONG> <STRONG>putchar)</STRONG>. Note that the output of <STRONG>putp</STRONG> always goes to <STRONG>stdout</STRONG>, not to the <EM>fildes</EM> specified in <STRONG>setupterm</STRONG>. The <STRONG>vidputs</STRONG> routine displays the string on the terminal in the video attribute mode <EM>attrs</EM>, which is any combination of the attributes listed in <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>. The characters are passed to the <STRONG>putchar</STRONG>-like routine <EM>putc</EM>. The <STRONG>vidattr</STRONG> routine is like the <STRONG>vidputs</STRONG> routine, except that it outputs through <STRONG>putchar</STRONG>. The <STRONG>vid_attr</STRONG> and <STRONG>vid_puts</STRONG> routines correspond to vidattr and vidputs, respectively. They use a set of arguments for representing the video attributes plus color, i.e., one of type attr_t for the attributes and one of short for the color_pair number. The <STRONG>vid_attr</STRONG> and <STRONG>vid_puts</STRONG> routines are designed to use the attribute constants with the <EM>WA</EM><STRONG>_</STRONG> prefix. The opts argument is reserved for future use. Currently, applications must provide a null pointer for that argument. The <STRONG>mvcur</STRONG> routine provides low-level cursor motion. It takes effect immediately (rather than at the next re- fresh). The <STRONG>tigetflag</STRONG>, <STRONG>tigetnum</STRONG> and <STRONG>tigetstr</STRONG> routines return the value of the capability corresponding to the <STRONG>terminfo</STRONG> <EM>cap-</EM> <EM>name</EM> passed to them, such as <STRONG>xenl</STRONG>. The <STRONG>tigetflag</STRONG> routine returns the value <STRONG>-1</STRONG> if <EM>capname</EM> is not a boolean capability, or <STRONG>0</STRONG> if it is canceled or absent from the terminal description. The <STRONG>tigetnum</STRONG> routine returns the value <STRONG>-2</STRONG> if <EM>capname</EM> is not a numeric capability, or <STRONG>-1</STRONG> if it is canceled or ab- sent from the terminal description. The <STRONG>tigetstr</STRONG> routine returns the value <STRONG>(char</STRONG> <STRONG>*)-1</STRONG> if <EM>cap-</EM> <EM>name</EM> is not a string capability, or <STRONG>0</STRONG> if it is canceled or absent from the terminal description. The <EM>capname</EM> for each capability is given in the table col- umn entitled <EM>capname</EM> code in the capabilities section of <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. <STRONG>char</STRONG> <STRONG>*boolnames</STRONG>, <STRONG>*boolcodes</STRONG>, <STRONG>*boolfnames</STRONG> <STRONG>char</STRONG> <STRONG>*numnames</STRONG>, <STRONG>*numcodes</STRONG>, <STRONG>*numfnames</STRONG> <STRONG>char</STRONG> <STRONG>*strnames</STRONG>, <STRONG>*strcodes</STRONG>, <STRONG>*strfnames</STRONG> These null-terminated arrays contain the <EM>capnames</EM>, the <STRONG>termcap</STRONG> codes, and the full C names, for each of the <STRONG>ter-</STRONG> <STRONG>minfo</STRONG> variables.</PRE><H2>RETURN VALUE</H2><PRE> Routines that return an integer return <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> (SVr4 only specifies "an integer value other than <STRONG>ERR</STRONG>") upon successful completion, unless otherwise noted in the preceding routine descriptions. Routines that return pointers always return <STRONG>NULL</STRONG> on error. X/Open defines no error conditions. In this implementa- tion <STRONG>del_curterm</STRONG> returns an error if its terminal parameter is null. <STRONG>restartterm</STRONG> returns an error if the associated call to <STRONG>se-</STRONG> <STRONG>tupterm</STRONG> returns an error. <STRONG>setupterm</STRONG> returns an error if it cannot allocate enough memory, or create the initial windows (stdscr, curscr, newscr). Other error conditions are documented above.</PRE><H2>NOTES</H2><PRE> The <STRONG>setupterm</STRONG> routine should be used in place of <STRONG>setterm</STRONG>. It may be useful when you want to test for terminal capa- bilities without committing to the allocation of storage involved in <STRONG>initscr</STRONG>. Note that <STRONG>vidattr</STRONG> and <STRONG>vidputs</STRONG> may be macros.</PRE><H2>PORTABILITY</H2><PRE> The function <STRONG>setterm</STRONG> is not described in the XSI Curses standard and must be considered non-portable. All other functions are as described in the XSI curses standard. In System V Release 4, <STRONG>set_curterm</STRONG> has an <STRONG>int</STRONG> return type and returns <STRONG>OK</STRONG> or <STRONG>ERR</STRONG>. We have chosen to implement the XSI Curses semantics. In System V Release 4, the third argument of <STRONG>tputs</STRONG> has the type <STRONG>int</STRONG> <STRONG>(*putc)(char)</STRONG>. The XSI Curses standard prototypes <STRONG>tparm</STRONG> with a fixed num- ber of parameters, rather than a variable argument list. This implementation uses a variable argument list. Portable applications should provide 9 parameters after the format; zeroes are fine for this purpose. XSI notes that after calling <STRONG>mvcur</STRONG>, the curses state may not match the actual terminal state, and that an applica- tion should touch and refresh the window before resuming normal curses calls. Both ncurses and System V Release 4 curses implement <STRONG>mvcur</STRONG> using the SCREEN data allocated in either <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG>. So though it is documented as a terminfo function, <STRONG>mvcur</STRONG> is really a curses function which is not well specified.</PRE><H2>SEE ALSO</H2><PRE> <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_kernel.3x.html">curs_kernel(3x)</A></STRONG>, <STRONG>curs_term-</STRONG> <STRONG><A HREF="curs_termcap.3x.html">cap(3x)</A></STRONG>, <STRONG><A HREF="putc.3S.html">putc(3S)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG></PRE><HR><ADDRESS>Man(1) output converted with<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a></ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -