⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intov.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 4 页
字号:
occur as described in<xref href=truncation><a href="#tag_001_004_002_002">Truncation, Wrapping and Scrolling</a></xref>.</dl><h5><a name = "tag_001_004_003_001">&nbsp;</a>Control Characters</h5>The Curses functions that perform special-character processing conceptuallyconvert control characters to the caret ('^') character followed bya second character (which is an upper-case letter if it is alphabetic) andwrite this string to the window in place of the control character.  Thefunctions that retrieve text from the window will not retrieve the originalcontrol character.<h4><a name = "tag_001_004_004">&nbsp;</a>Rendition of Characters Placed into a Window</h4><xref type="3" name="wrendition"></xref>When the application adds or inserts characters into a window, the effect isas follows:<p>If the character is not the space character, then the window receives:<ul><p><li>the character that the application specifies<p><li>the colour that the application specifies; or the window colour, if theapplication does not specify a colour<p><li>the attributes specified, OR-ed with the window attributes.<p></ul><p>If the character is the space character, then the window receives:<ul><p><li>the background character<p><li>the colour that the application specifies; or the window colour, ifthe application does not specify a colour<p><li>the attributes specified, OR-ed with the window attributes.<p></ul><h3><a name = "tag_001_005">&nbsp;</a>Input Processing</h3><xref type="2" name="terminalinput"></xref>The Curses input model provides a variety of ways to obtain input from thekeyboard.<h4><a name = "tag_001_005_001">&nbsp;</a>Keypad Processing</h4><xref type="3" name="keypadproc"></xref>The application can enable or disablekeypad translationby calling<i><a href="keypad.html">keypad()</a></i>.When translation is enabled, Curses attempts to translate a sequence ofterminal input that represents the pressing of a function key into a singlekey code.  When translation is disabled, Curses passes terminal input to theapplication without such translation, and any interpretation of the input asrepresenting the pressing of a keypad key must be done by the application.<p>The complete set of key codes for keypad keys that Curses can process isspecified by the constants defined in<i><a href="curses.h.html">&lt;curses.h&gt;</a></i>whose names begin with &quot;KEY_&quot;.<br>Each terminal type described in the<b>terminfo</b>database may support some or all of these key codes.The<b>terminfo</b>database specifies the sequence of input characters from the terminal typethat correspond to each key code (see<xref href=keypad></xref>).<p>The Curses implementation cannot translate keypad keys on terminals wherepressing the keys does not transmit a unique sequence.<p>When translation is enabled and a character that could be the beginning of afunction key (such as escape) is received, Curses notes the time and beginsaccumulating characters.  If Curses receives additional characters thatrepresent the pressing of a keypad key, within an unspecified interval fromthe time the first character was received, then Curses converts this input toa key code for presentation to the application.  If such characters are notreceived during this interval, translation of this input does not occur andthe individual characters are presented to the application separately.(Because Curses waits for this interval to accumulate a key code, manyterminals experience a delay between the time a user presses the escape keyand the time the escape is returned to the application.)<p>In addition, No Timeout Mode provides that in any case where Curses hasreceived part of a function key sequence, it waits indefinitely for thecomplete key sequence.  The &quot;unspecified interval&quot; in the previous paragraphbecomes infinite in No Timeout Mode.  No Timeout Mode allows the use offunction keys over slow communication lines.  No Timeout Mode lets the usertype the individual characters of a function key sequence, but also delaysapplication response when the user types a character (not a function key) thatbegins a function key sequence.  For this reason, in No Timeout Mode manyterminals will appear to hang between the time a user presses the escape keyand the time another key is pressed.  No Timeout Mode is switchable by calling<i><a href="notimeout.html">notimeout()</a></i>.<p>If any special characters (see<xref href=specialchars><a href="#tag_001_004_003">Special Characters</a></xref>)are defined or redefined to be characters that are members of a function keysequence, then Curses will be unable to recognise and translate those functionkeys.<p>Several of the modes discussed below are described in terms of availability ofinput.  If keypad translation is enabled, then input is not available onceCurses has begun receiving a keypad sequence until the sequence is completelyreceived or the interval has elapsed.<br><h4><a name = "tag_001_005_002">&nbsp;</a>Input Mode</h4><xref type="3" name="inputmode"></xref>The <b>XBD</b> specification (<b>Special Characters</b>) defines flow-control characters, theinterrupt character, the erase character, and the kill character.  Fourmutually-exclusive Cursesmodes let the application control the effect of these input characters:<p><table  bordercolor=#000000 border=1<tr valign=top><th align=center><b>Input Mode</b><th align=center><b>Effect</b><tr valign=top><td align=left>Cooked Mode<td align=left> This achieves normal line-at-a-time processing with all special characters handled outside the application.  This achieves the same effect as canonical-mode input processing as specified in the <b>XBD</b> specification. The state of the ISIG and IXON flags are not changed upon entering this mode by calling and are set upon entering this mode by calling <tr valign=top><td align=left>&nbsp;<td align=left> The implementation supports erase and kill characters from any supported locale, no matter what the width of the character is. <tr valign=top><td align=left>cbreak Mode<td align=left> Characters typed by the user are immediately available to the application and Curses does not perform special processing on either the erase character or the kill character.  An application can select cbreak mode to do its own line editing but to let the abort character be used to abort the task.  This mode achieves the same effect as non-canonical-mode, Case B input processing (with MIN set to 1 and ICRNL cleared) as specified in the <b>XBD</b> specification. The state of the ISIG and IXON flags are not changed upon entering this mode. <tr valign=top><td align=left>Half-Delay Mode<td align=left> The effect is the same as cbreak, except that input functions wait until a character is available or an interval defined by the application elapses, whichever comes first.  This mode achieves the same effect as non-canonical-mode, Case C input processing (with TIME set to the value specified by the application) as specified in the <b>XBD</b> specification. The state of the ISIG and IXON flags are not changed upon entering this mode. <tr valign=top><td align=left>Raw Mode<td align=left> Raw mode gives the application maximum control over terminal input.  The application sees each character as it is typed.  This achieves the same effect as non-canonical mode, Case D input processing as specified in the <b>XBD</b> specification.  The ISIG and IXON flags are cleared upon entering this mode. </table><p>The terminal interface settings are recorded when the process calls<i><a href="initscr.html">initscr()</a></i>or<i><a href="newterm.html">newterm()</a></i>to initialise Curses and restores these settings when<i><a href="endwin.html">endwin()</a></i>is called.  The initial input mode for Cursesoperations is unspecified&nbsp;unless the implementation supports Enhanced Curses compliance,in which the initial input mode is cbreak mode.<p>The behaviour of the BREAK key depends on other bits in the display driverthat are not set by Curses.<br><h4><a name = "tag_001_005_003">&nbsp;</a>Delay Mode</h4>Two mutually-exclusive delay modes specify how quickly certain Cursesfunctions return to the application when there is no terminal input waitingwhen the function is called:<dl compact><dt>No Delay<dd>The function fails.<dt>Delay<dd>The application waits until the implementation passes text through to theapplication.  If cbreak or Raw Mode is set, this is after one character.Otherwise, this is after the first &lt;newline&gt; character, end-of-line character,or end-of-file character.</dl><p>The effect of No Delay Mode on function key processing is unspecified.<h4><a name = "tag_001_005_004">&nbsp;</a>Echo Processing</h4>Echo mode determines whether Curses echoes typed characters to the screen.The effect of Echo mode is analogous to the effect of the ECHO flag in thelocal mode field of the <b>termios</b> structure associated with the terminaldevice connected to the window.  However, Curses always clears the ECHO flagwhen invoked,to inhibit the operating system from performingechoing.  The method of echoing characters is not identical to the operatingsystem's method of echoing characters, because Curses performs additionalprocessing of terminal input.<p>If in Echo mode, Curses performs its own echoing:  Any visible input characteris stored in the current or specified window by the input function that theapplication called, at that window's cursor position, as though<i><a href="addch.html">addch()</a></i>were called, with all consequent effects such as cursor movement and wrapping.<p>If not in Echo mode, any echoing of input must be performed by theapplication.  Applications often perform their own echoing in a controlledarea of the screen, or do not echo at all, so they disable Echo mode.<p>It may not be possible to turn off echo processing forsynchronous and networked asynchronous terminalsbecause echo processing is done directly by theterminals.  Applications running on such terminals should be aware that any characters typed willappear on the screen at wherever the cursor ispositioned.<h3><a name = "tag_001_006">&nbsp;</a>The Set of Curses Functions</h3>The Curses functions allow:  overall screen, window and pad manipulation;output to windows and pads; reading terminal input; control over terminal andCurses input and output options; environment query functions; colourmanipulation; use of soft label keys; access to the </i><b>terminfo</b> database ofterminal capabilities; and access to low-level functions.<h4><a name = "tag_001_006_001">&nbsp;</a>Function Name Conventions</h4>The reference manual pages in<xref href=manpages></xref>present families of multiple Curses functions.  Most function families havedifferent functions that give the programmer the following options:<ul><p><li>A function with the basic name operates on the window<i>stdscr</i>.A function with the same name plus the <i>w</i> prefix operates on a windowspecified by the <i>win</i> argument.<p>When the reference manual page for a function family refers to the<i>current or specified window</i>,it means<i>stdscr</i>for the basic functions and the window specified by<i>win</i> for any <i>w</i> function.<p>Functions whose names have the <i>p</i> prefix require an argument that is apad instead of a window.<p><li>A function with the basic name operates based on the current cursor position(of the current or specified window, as described above).A function with the same name plus the <i>mv</i> prefix moves the cursor to aposition specified by the <i>y</i> and <i>x</i> arguments before performing thespecified operation.<p>When the reference manual page for a function family refers to the<i>current or specified position</i>,it means the cursor position for the basic functions and the position(<i>y</i>, <i>x</i>) for any <i>mv</i> function.<p>The <i>mvw</i> prefix exists and combines the <i>mv</i> semantics discussed herewith the <i>w</i> semantics discussed above.  The window argument is alwaysspecified before the coordinates.<p><li>A function with the basic name is often provided for historical compatibilityand operates only on single-byte characters.  A function with the same nameplus the <i>w</i> infix operates on wide (multi-byte) characters.  A functionwith the same name plus the <i>_w</i> infix operates on complex characters andtheir renditions.<p><li>When a function with the basic name operates on a single character, there issometimes a function with the same name plus the <i>n</i> infix that operateson multiple characters.  An <i>n</i> argument specifies the number ofcharacters to process.  The respective manual page specifies the outcome ifthe value of <i>n</i> is inappropriate.<p></ul><hr size=2 noshade><h4><a name = "tag_001_006_002">&nbsp;</a>Function Families Provided</h4><p><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Function Names</b><th align=center><b>Description</b><th align=center>s<th align=center>w<th align=center>c<th align=center><b>Refer to</b><tr valign=top><td align=left>&nbsp;<td align=left><b>Add (Overwrite)</b><th align=center>&nbsp;<th align=center>&nbsp;<th align=center>&nbsp;<th align=center>&nbsp;<tr valign=top><td align=left><i>[<i>mv</i>][<i>w</i>]<i>addch()</i><td align=left>add a character<td align=center>Y<td align=center>Y<td align=center>Y<td align=left><i><a href="addch.html">addch()</a></i><tr valign=top><td align=left><i></i>[<i>mv</i>][<i>w</i>]<i>addch</i>[<i>n</i>]<i>str()</i><td align=left>add a character string<td align=center>N<td align=center>N<td align=center>N<td align=left><i><a href="addchstr.html">addchstr()</a></i><tr valign=top><td align=left><i></i>[<i>mv</i>][<i>w</i>]<i>add</i>[<i>n</i>]<i>str()</i><td align=left>add a string<td align=center>Y<td align=center>Y<td align=center>Y<td align=left><i><a href="addnstr.html">addnstr()</a></i><tr valign=top><td align=left><i></i>[<i>mv</i>][<i>w</i>]<i>add</i>[<i>n</i>]<i>wstr()</i><td align=left>add a wide character string<td align=center>Y<td align=center>Y<td align=center>Y<td align=left><i><a href="addnwstr.html">addnwstr()</a></i><tr valign=top><td align=left><i></i>[<i>mv</i>][<i>w</i>]<i>add_wch()</i><td align=left>add a wide character and rendition<td align=center>Y<td align=center>Y<td align=center>Y<td align=left><i><a href="add_wch.html">add_wch()</a></i><tr valign=top><td align=left><i></i>[<i>mv</i>][<i>w</i>]<i>add_wch</i>[<i>n</i>]<i>str()</i><td align=left>add an array of wide characters and renditions<td align=center>?<td align=center>N<td align=center>N<td align=left><i><a href="add_wchnstr.html">add_wchnstr()</a></i><tr valign=top><td align=left>&nbsp;<td align=left></i><b>Change Renditions</b><i>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -