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

📄 intov.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>Interface Overview</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><blockquote><center><h2><a name = "tag_001">&nbsp;</a>Interface Overview</h2></center><xref type="1" name="intoverview"></xref><h3><a name = "tag_001_001">&nbsp;</a>Components</h3>A Curses initialisation function, usually<i><a href="initscr.html">initscr()</a></i>,determines the terminal model in use, by reference to either an argument or anenvironment variable.  If that model is defined in <b>terminfo</b>, then thesame <b>terminfo</b> entry tells Cursesexactly how to operate the terminal.<p>In this case, a comprehensive API lets the application perform terminaloperations.  The Curses run-time system receives each terminal request andsends appropriate commands to the terminal to achieve the desired effect.<h5><a name = "tag_001_001_000_001">&nbsp;</a>Relationship to the XBD Specification</h5>Applications using Cursesshould not also control the terminal using capabilities of thegeneral terminal interface defined in the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b>&nbsp;</a> .<p>There is no requirement that the paradigms that exist while in Cursesmode be carried over outside the Curses environment (see<xref href=defshell><a href="def_prog_mode.html#tag_000_000"></a></xref>).<h5><a name = "tag_001_001_000_002">&nbsp;</a>Relationship to Signals</h5>Curses implementations may provide for special handling of the SIGINT,SIGQUIT and SIGTSTP signals if their disposition is SIGDFL at the time<i><a href="initscr.html">initscr()</a></i>is called (see<xref href=initscr><a href="initscr.html#tag_000_000"></a></xref>).<p>Any special handling for these signals may remain in effect for the life ofthe process or until the process changes the disposition of the signal.<p>None of the Curses functions are required to be safe with respect to signals(see<i><a href="../xsh/sigaction.html">sigaction()</a></i>in the <b>XSH</b> specification).<p>The behaviour of Curses with respect to signals not defined by the<b>XSH</b> specification is unspecified.<h3><a name = "tag_001_002">&nbsp;</a>Screens, Windows and Terminals</h3><xref type="2" name="concepts"></xref><h5><a name = "tag_001_002_000_001">&nbsp;</a>Screen</h5>A screen is the physical output device of the terminal.  In Curses,a <b>SCREEN</b> data type is an opaque data type associated with a terminal.Each window (see below) is associated with a <b>SCREEN</b>.<h5><a name = "tag_001_002_000_002">&nbsp;</a>Windows</h5>The Curses functions permit manipulation of<i>window</i>objects, which can be thought of as two-dimensional arrays of characters andtheir renditions.  A default window called<i>stdscr</i>,which is the size of the terminal screen, is supplied.  Others may be createdwith<i><a href="newwin.html">newwin()</a></i>.<p>Variables declared as <b>WINDOW *</b> refer to windows (and to subwindows,derived windows, and pads, as described below).  These data structures aremanipulated with functions described on the reference manual pages in<xref href=chapTERMINFO><a href="terminfo.html#tag_002">Terminfo Source Format (ENHANCED CURSES)</a></xref>.Among the most basic functions are<i><a href="move.html">move()</a></i>and<i><a href="addch.html">addch()</a></i>.More general versions of these functions are included that allow a process tospecify a window.<p>After using functions to manipulate a window,<i><a href="refresh.html">refresh()</a></i>is called, telling Curses to make the CRT screen look like<i>stdscr</i>.<p>Line drawing characters may be specified to be output.  On input, Cursesis also able to translate arrow and function keys that transmit escapesequences into single values.  The line drawing charactersand input values use names defined in<i><a href="curses.h.html">&lt;curses.h&gt;</a></i>.<p>Each window has a flag that indicates that the information in the window coulddiffer from the information displayed on the terminal device.Making any change to the contents of the window, moving or modifying thewindow, or setting the window's cursor position, sets this flag (<I>touches</I>the window).  Refreshing the window clears this flag.  (For furtherinformation, see<xref href=manpage_touch><a href="is_linetouched.html#tag_001_009">Synchronous and Networked Asynchronous Terminals</a></xref>.)<h5><a name = "tag_001_002_000_003">&nbsp;</a>Subwindows</h5>A<i>subwindow</i>is a window, created within another window (called the<i>parent window</i>),and positioned relative to the parent window.A subwindow can be created by calling<i><a href="derwin.html">derwin()</a></i>,<i><a href="newpad.html">newpad()</a></i>or<i><a href="subwin.html">subwin()</a></i>.<p>Subwindows can be created from a parent window by calling<i><a href="subwin.html">subwin()</a></i>.The position and size of subwindows on the screen must be identical to ortotally within the parent window.  Changes to either the parent window or thesubwindow affect both.  Window clipping is not a property of subwindows.<h5><a name = "tag_001_002_000_004">&nbsp;</a>Ancestors</h5>The term<i>ancestor</i>refers to a window's parent, or its parent, and so on.<h5><a name = "tag_001_002_000_005">&nbsp;</a>Derived Windows</h5>Derived windows are subwindows whose position is defined by reference to theparent window rather than in absolute screen coordinates.  Derived windows areotherwise no different from subwindows.<h5><a name = "tag_001_002_000_006">&nbsp;</a>Pads</h5>A pad is a specialised case of subwindow that is not necessarily associatedwith a viewable part of a screen.  Functions that deal with pads are alldiscussed in<xref href=newpad><a href="newpad.html#tag_001_009">Synchronous and Networked Asynchronous Terminals</a></xref>.<h5><a name = "tag_001_002_000_007">&nbsp;</a>Terminal</h5>A terminal is the logical input and output device through whichcharacter-based applications interact with the user.<b>TERMINAL</b>is an opaque data type associated with a terminal.  A<b>TERMINAL</b>data structure primarily contains information about the capabilities of theterminal, as defined by<b>terminfo</b>.A<b>TERMINAL</b>also contains information about the terminal modes and current state for inputand output operations.  Each screen (see above) is associated with a<b>TERMINAL</b>.<h3><a name = "tag_001_003">&nbsp;</a>Characters</h3><xref type="2" name="char_overview"></xref><h4><a name = "tag_001_003_001">&nbsp;</a>Character Storage Size</h4>Historically, a position on the screen has corresponded to a single storedbyte.  This correspondence is no longer true for several reasons:<ul><p><li>Some characters may occupy several columns when displayed on the screen (see<xref href=multicolumn><a href="#tag_001_003_002">Multi-column Characters</a></xref>).<p><li>Some characters may be non-spacing characters, defined only in association witha spacing character (see<xref href=zerowidth><a href="#tag_001_003_005">Non-spacing Characters</a></xref>).<p><li>The number of bytes to hold a character from theextended character sets depends on the LC_CTYPE locale category.<p></ul><p>The internal storage format of characters and renditions is unspecified.There is no implied correspondence between the internal storage format andthe external representation of characters and renditions in objects of type<b>chtype</b>and<b>cchar_t</b>.<h4><a name = "tag_001_003_002">&nbsp;</a>Multi-column Characters</h4><xref type="3" name="multicolumn"></xref>Some character sets define<i>multi-column characters</i>that occupy more than one column position when displayed on the screen.<p>Writing a character whose width is greater than the width of the destinationwindow is an error.<h4><a name = "tag_001_003_003">&nbsp;</a>Attributes</h4><xref type="3" name="rendition"></xref>Each character can be displayed with<i>attributes</i>such as underlining, reverse video or colour on terminals that support suchdisplay enhancements.  Current attributes of a window are applied to allcharacters that are written into the window with<i><a href="waddch.html">waddch()</a></i>,<i><a href="wadd_wch.html">wadd_wch()</a></i>,<i><a href="waddstr.html">waddstr()</a></i>,<i><a href="waddchstr.html">waddchstr()</a></i>,<i><a href="waddwstr.html">waddwstr()</a></i>,<i><a href="wadd_wchstr.html">wadd_wchstr()</a></i>and<i><a href="wprintw.html">wprintw()</a></i>.Attributes can be combined.<p>Attributes can be specified using constants with the A_ prefix specified in<i><a href="curses.h.html">&lt;curses.h&gt;</a></i>.The A_ constants manipulate attributes in objects of type<b>chtype</b>.&nbsp;Additional attributes can be specified using constants with the WA_prefix.  The WA_ constants manipulate attributes in objects of type<b>attr_t</b>.<p>Two constants that begin with A_ and WA_ and that represent the sameterminal capability refer to the same attribute in the<b>terminfo</b>database and in the window data structure.  The effect on a window does notdiffer depending on whether the application specifies A_ or WA_constants.  For example, when an application updates window attributesusing the interfaces that support the A_ values, a query of the windowattribute using the function that returns WA_ values reflects thisupdate.  When it updates window attributes using the interfaces thatsupport the WA_ values, for which corresponding A_ values exist, a queryof the window attribute using the function that returns A_ valuesreflects this update.<h4><a name = "tag_001_003_004">&nbsp;</a>Rendition</h4><xref type="3" name="rendnew"></xref>The<i>rendition</i>of a character displayed on the screen is its attributes&nbsp;and a colour pair.<p>The rendition of a character written to the screenbecomes a property of the character and moves withthe character through any scrolling and insert/delete line/characteroperations.  To the extent possible on a particular terminal, a character'srendition corresponds to the graphic rendition of the characterput on the screen.<p>If a given terminal does not support a rendition that an applicationprogram is trying to use, Curses may substitute a different rendition for it.<p>Colours are always used in pairs (referred to as colour-pairs).A colour-pair consists of a foreground colour (for characters) anda background colour (for the field on which the characters are displayed).<br><h4><a name = "tag_001_003_005">&nbsp;</a>Non-spacing Characters</h4><xref type="3" name="zerowidth"></xref>The requirements in this section are in effect only for implementationsthat claim Enhanced Curses compliance.<p>Some character sets may contain<i>non-spacing</i>characters.  (Non-spacing characters are those,other than the '\0' character,for which<i><a href="../xsh/wcwidth.html">wcwidth()</a></i>returns a width of zero.) The application may write non-spacing characters toa window.  Every non-spacing character in a window is associated with aspacing character and modifies the spacing character.  Non-spacing charactersin a window cannot be addressed separately.  A non-spacing character isimplicitly addressed whenever a Curses operation affects the spacing characterwith which the non-spacing character is associated.<p>Non-spacing charactersdo not support attributes.  For interfaces that use wide characters andattributes, the attributes are ignored if the wide character is a non-spacingcharacter.Multi-column characters have a single set of attributes for all columns.  Theassociation of non-spacing characters with spacing characters can becontrolled by the application using the wide character interfaces.  The widecharacter string functions provide codeset-dependent association.<p>Two typical effects of a non-spacing character associated with a spacingcharacter called <i>c</i>, are as follows:<ul><p><li>The non-spacing character may modify the appearanceof <i>c</i>.  (For instance, there may be non-spacing characters that adddiacritical marks to characters.  However, there may also be spacingcharacters with built-in diacritical marks.)<p><li>The non-spacing character may bridge <i>c</i> to the character following<i>c</i>.  (Examples of this usage are the formation of ligatures and theconversion of characters into compound display forms, words, or ideograms.)<p></ul><p>Implementations may limit the number of non-spacing characters that can beassociated with a spacing character, provided any limit is at least 5.<h5><a name = "tag_001_003_005_001">&nbsp;</a>Complex Characters</h5><xref type="5" name="complexchar"></xref>A<i>complex character</i>is a set of associated characters, which may include a spacing characterand may include any non-spacing characters associated with it.  A<i>spacing complex character</i>is a spacing character followed by any non-spacing characters associated withit.  That is, a spacing complex character is a complex character that includesone spacing character.  An example of a code set that has complex characters

⌨️ 快捷键说明

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