]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_addch.3x
ncurses 4.1
[ncurses.git] / man / curs_addch.3x
1 '\" t
2 .TH curs_addch 3X ""
3 .SH NAME
4 \fBaddch\fR, \fBwaddch\fR, \fBmvaddch\fR, \fBmvwaddch\fR,
5 \fBechochar\fR, \fBwechochar\fR - add a character (with attributes) to a
6 \fBcurses\fR window, then advance the cursor
7 .SH SYNOPSIS
8 \fB#include <curses.h>\fR
9
10 \fBint addch(chtype ch);\fR
11 .br
12 \fBint waddch(WINDOW *win, chtype ch);\fR
13 .br
14 \fBint mvaddch(int y, int x, chtype ch);\fR
15 .br
16 \fBint mvwaddch(WINDOW *win, int y, int x, chtype ch);\fR
17 .br
18 \fBint echochar(chtype ch);\fR
19 .br
20 \fBint wechochar(WINDOW *win, chtype ch);\fR
21 .br
22 .SH DESCRIPTION
23 The \fBaddch\fR, \fBwaddch\fR, \fBmvaddch\fR and \fBmvwaddch\fR routines put
24 the character \fIch\fR into the given window at its current window position,
25 which is then advanced.  They are analogous to \fBputchar\fR in \fBstdio\fR(3).
26 If the advance is at the right margin, the cursor automatically wraps to the
27 beginning of the next line.  At the bottom of the current scrolling region, if
28 \fBscrollok\fR is enabled, the scrolling region is scrolled up one line.
29
30 If \fIch\fR is a tab, newline, or backspace, the cursor is moved appropriately
31 within the window.  Backspace moves the cursor one character left; at the left
32 edge of a window it does nothing.  Newline does a \fBclrtoeol\fR, then moves
33 the cursor to the window left margin on the next line, scrolling the window if
34 on the last line).  Tabs are considered to be at every eighth column.
35
36 If \fIch\fR is any control character other than tab, newline, or backspace, it
37 is drawn in \fB^\fR\fIX\fR notation.  Calling \fBwinch\fR after adding a
38 control character does not return the character itself, but instead returns
39 the ^-representation of the control character.  (To emit control characters
40 literally, use \fBechochar\fR.)
41
42 Video attributes can be combined with a character argument passed to
43 \fBaddch\fR or related functions by logical-ORing them into the character.
44 (Thus, text, including attributes, can be copied from one place to another
45 using \fBinch\fR and \fBaddch\fR.).  See the \fBcurs_attr\fR(3X) page for
46 values of predefined video attribute constants that can be usefully OR'ed
47 into characters.
48
49 The \fBechochar\fR and \fBwechochar\fR routines are equivalent to a call to
50 \fBaddch\fR followed by a call to \fBrefresh\fR, or a call to \fBwaddch\fR
51 followed by a call to \fBwrefresh\fR.  The knowledge that only a single
52 character is being output is used and, for non-control characters, a
53 considerable performance gain may be seen by using these routines instead of
54 their equivalents.
55 .SS Line Graphics
56 The following variables may be used to add line drawing characters to the
57 screen with routines of the \fBaddch\fR family.  The default character listed
58 below is used if the \fBacsc\fR capability doesn't define a terminal-specific
59 replacement for it (but see the EXTENSIONS section below).  The names are
60 taken from VT100 nomenclature.
61
62 .TS
63 l l l
64 _ _ _
65 l l l.
66 \fIName\fR      \fIDefault\fR   \fIDescription\fR
67 ACS_ULCORNER    +       upper left-hand corner
68 ACS_LLCORNER    +       lower left-hand corner
69 ACS_URCORNER    +       upper right-hand corner
70 ACS_LRCORNER    +       lower right-hand corner
71 ACS_RTEE        +       right tee
72 ACS_LTEE        +       left tee
73 ACS_BTEE        +       bottom tee
74 ACS_TTEE        +       top tee
75 ACS_HLINE       -       horizontal line
76 ACS_VLINE       |       vertical line
77 ACS_PLUS        +       plus
78 ACS_S1          -       scan line 1
79 ACS_S9          \&_     scan line 9
80 ACS_DIAMOND     +       diamond
81 ACS_CKBOARD     :       checker board (stipple)
82 ACS_DEGREE      '       degree symbol
83 ACS_PLMINUS     #       plus/minus
84 ACS_BULLET      o       bullet
85 ACS_LARROW      <       arrow pointing left
86 ACS_RARROW      >       arrow pointing right
87 ACS_DARROW      v       arrow pointing down
88 ACS_UARROW      ^       arrow pointing up
89 ACS_BOARD       #       board of squares
90 ACS_LANTERN     #       lantern symbol
91 ACS_BLOCK       #       solid square block
92 ACS_S3          -       scan line 3
93 ACS_S7          -       scan line 7
94 ACS_LEQUAL      <       less-than-or-equal-to
95 ACS_GEQUAL      >       greater-than-or-equal-to
96 ACS_PI          *       greek pi
97 ACS_NEQUAL      !       not-equal
98 ACS_STERLING    f       pound-sterling symbol
99 .TE
100
101 .SH RETURN VALUE
102 All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success
103 (the SVr4 manuals specify only "an integer value other than \fBERR\fR") upon
104 successful completion, unless otherwise noted in the preceding routine
105 descriptions.
106 .SH NOTES
107 Note that \fBaddch\fR, \fBmvaddch\fR, \fBmvwaddch\fR, and
108 \fBechochar\fR may be macros.
109 .SH EXTENSIONS
110 The following extended \fBcurses\fR features are available only on PC-clone
111 consoles and compatible terminals obeying the ANSI.SYS de-facto standard for
112 terminal control sequences.  They are not part of XSI curses.
113
114 The attribute A_ALTCHARSET actually forces literal display of PC ROM characters
115 including the high-half graphics.  Your console driver may still capture or
116 translate a few (such as ESC) but this feature should give you access to the
117 card-suit characters, up and down-arrow, and most others in the range 0-32.
118 (In a terminfo entry designed for use with \fBncurses\fR, the high-half 
119 characters are obtained using this attribute with an \fBacsc\fR string in
120 which the second of each pair is a high-half character.)
121
122 Giving \fBwechochar\fR an argument with its high bit set will produce the
123 corresponding high-half ASCII graphic (SVr4 curses also has this feature but
124 does not document it).  A control-character argument, however, will not
125 typically produce the corresponding graphic; characters such as CR, NL, FF and
126 TAB are typically interpreted by the console driver itself, and ESC will be
127 interpreted as the leader of a control sequence.
128 .SH PORTABILITY
129 All these functions are described in the XSI Curses standard, Issue 4.
130 The defaults specified for forms-drawing characters apply in the POSIX locale.
131
132 The seven ACS symbols starting with \fBACS_S3\fR were not documented in
133 any publicly released System V.  However, many publicly available terminfos
134 include \fBacsc\fR strings in which their key characters (pryz{|}) are 
135 embedded, and a second-hand list of their character descriptions has come
136 to light.  The ACS-prefixed names for them were invented for \fBncurses\fR(3X).
137 .SH SEE ALSO
138 \fBcurses\fR(3X), \fBcurs_attr\fR(3X), \fBcurs_clear\fR(3X),
139 \fBcurs_inch\fR(3X), \fBcurs_outopts\fR(3X), \fBcurs_refresh\fR(3X),
140 \fBputc\fR(3S).
141 .\"#
142 .\"# The following sets edit modes for GNU EMACS
143 .\"# Local Variables:
144 .\"# mode:nroff
145 .\"# fill-column:79
146 .\"# End: