blob: 73918b88b9545530f49008a0ca52a6dbbf199a1b [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301'\" t
2.\"***************************************************************************
3.\" Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
4.\" *
5.\" Permission is hereby granted, free of charge, to any person obtaining a *
6.\" copy of this software and associated documentation files (the *
7.\" "Software"), to deal in the Software without restriction, including *
8.\" without limitation the rights to use, copy, modify, merge, publish, *
9.\" distribute, distribute with modifications, sublicense, and/or sell *
10.\" copies of the Software, and to permit persons to whom the Software is *
11.\" furnished to do so, subject to the following conditions: *
12.\" *
13.\" The above copyright notice and this permission notice shall be included *
14.\" in all copies or substantial portions of the Software. *
15.\" *
16.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23.\" *
24.\" Except as contained in this notice, the name(s) of the above copyright *
25.\" holders shall not be used in advertising or otherwise to promote the *
26.\" sale, use or other dealings in this Software without prior written *
27.\" authorization. *
28.\"***************************************************************************
29.\"
30.\" $Id: curs_addch.3x,v 1.27 2007/06/02 20:40:07 tom Exp $
31.TH curs_addch 3X ""
32.SH NAME
33\fBaddch\fR, \fBwaddch\fR, \fBmvaddch\fR, \fBmvwaddch\fR,
34\fBechochar\fR,
35\fBwechochar\fR - add a character (with attributes) to a \fBcurses\fR window, then advance the cursor
36.SH SYNOPSIS
37\fB#include <curses.h>\fR
38.PP
39\fBint addch(const chtype ch);\fR
40.br
41\fBint waddch(WINDOW *win, const chtype ch);\fR
42.br
43\fBint mvaddch(int y, int x, const chtype ch);\fR
44.br
45\fBint mvwaddch(WINDOW *win, int y, int x, const chtype ch);\fR
46.br
47\fBint echochar(const chtype ch);\fR
48.br
49\fBint wechochar(WINDOW *win, const chtype ch);\fR
50.br
51.SH DESCRIPTION
52The \fBaddch\fR, \fBwaddch\fR, \fBmvaddch\fR and \fBmvwaddch\fR routines put
53the character \fIch\fR into the given window at its current window position,
54which is then advanced. They are analogous to \fBputchar\fR in \fBstdio\fR(3).
55If the advance is at the right margin, the cursor automatically wraps to the
56beginning of the next line. At the bottom of the current scrolling region, if
57\fBscrollok\fR is enabled, the scrolling region is scrolled up one line.
58.PP
59If \fIch\fR is a tab, newline, or backspace,
60the cursor is moved appropriately within the window.
61Backspace moves the cursor one character left; at the left
62edge of a window it does nothing.
63Newline does a \fBclrtoeol\fR,
64then moves the cursor to the window left margin on the next line,
65scrolling the window if on the last line.
66Tabs are considered to be at every eighth column.
67The tab interval may be altered by setting the \fBTABSIZE\fR variable.
68.PP
69If \fIch\fR is any control character other than tab, newline, or backspace, it
70is drawn in \fB^\fR\fIX\fR notation. Calling \fBwinch\fR after adding a
71control character does not return the character itself, but instead returns
72the ^-representation of the control character.
73.PP
74Video attributes can be combined with a character argument passed to
75\fBaddch\fR or related functions by logical-ORing them into the character.
76(Thus, text, including attributes, can be copied from one place to another
77using \fBinch\fR and \fBaddch\fR.) See the \fBcurs_attr\fR(3X) page for
78values of predefined video attribute constants that can be usefully OR'ed
79into characters.
80.PP
81The \fBechochar\fR and \fBwechochar\fR routines are equivalent to a call to
82\fBaddch\fR followed by a call to \fBrefresh\fR, or a call to \fBwaddch\fR
83followed by a call to \fBwrefresh\fR. The knowledge that only a single
84character is being output is used and, for non-control characters, a
85considerable performance gain may be seen by using these routines instead of
86their equivalents.
87.SS Line Graphics
88The following variables may be used to add line drawing characters to the
89screen with routines of the \fBaddch\fR family. The default character listed
90below is used if the \fBacsc\fR capability does not define a terminal-specific
91replacement for it.
92The names are taken from VT100 nomenclature.
93.PP
94.TS
95l l l
96_ _ _
97l l l.
98\fIName\fR \fIDefault\fR \fIDescription\fR
99ACS_BLOCK # solid square block
100ACS_BOARD # board of squares
101ACS_BTEE + bottom tee
102ACS_BULLET o bullet
103ACS_CKBOARD : checker board (stipple)
104ACS_DARROW v arrow pointing down
105ACS_DEGREE ' degree symbol
106ACS_DIAMOND + diamond
107ACS_GEQUAL > greater-than-or-equal-to
108ACS_HLINE - horizontal line
109ACS_LANTERN # lantern symbol
110ACS_LARROW < arrow pointing left
111ACS_LEQUAL < less-than-or-equal-to
112ACS_LLCORNER + lower left-hand corner
113ACS_LRCORNER + lower right-hand corner
114ACS_LTEE + left tee
115ACS_NEQUAL ! not-equal
116ACS_PI * greek pi
117ACS_PLMINUS # plus/minus
118ACS_PLUS + plus
119ACS_RARROW > arrow pointing right
120ACS_RTEE + right tee
121ACS_S1 - scan line 1
122ACS_S3 - scan line 3
123ACS_S7 - scan line 7
124ACS_S9 \&_ scan line 9
125ACS_STERLING f pound-sterling symbol
126ACS_TTEE + top tee
127ACS_UARROW ^ arrow pointing up
128ACS_ULCORNER + upper left-hand corner
129ACS_URCORNER + upper right-hand corner
130ACS_VLINE | vertical line
131.TE
132.SH RETURN VALUE
133All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success
134(the SVr4 manuals specify only "an integer value other than \fBERR\fR") upon
135successful completion, unless otherwise noted in the preceding routine
136descriptions.
137.SH NOTES
138Note that \fBaddch\fR, \fBmvaddch\fR, \fBmvwaddch\fR, and
139\fBechochar\fR may be macros.
140.SH PORTABILITY
141All these functions are described in the XSI Curses standard, Issue 4.
142The defaults specified for forms-drawing characters apply in the POSIX locale.
143.LP
144Some ACS symbols
145(ACS_S3,
146ACS_S7,
147ACS_LEQUAL,
148ACS_GEQUAL,
149ACS_PI,
150ACS_NEQUAL,
151ACS_STERLING)
152were not documented in
153any publicly released System V. However, many publicly available terminfos
154include \fBacsc\fR strings in which their key characters (pryz{|}) are
155embedded, and a second-hand list of their character descriptions has come
156to light. The ACS-prefixed names for them were invented for \fBncurses\fR(3X).
157.LP
158The \fBTABSIZE\fR variable is implemented in some versions of curses,
159but is not part of X/Open curses.
160.LP
161If \fIch\fR is a carriage return,
162the cursor is moved to the beginning of the current row of the window.
163This is true of other implementations, but is not documented.
164.SH SEE ALSO
165\fBcurses\fR(3X),
166\fBcurs_attr\fR(3X),
167\fBcurs_clear\fR(3X),
168\fBcurs_inch\fR(3X),
169\fBcurs_outopts\fR(3X),
170\fBcurs_refresh\fR(3X),
171\fBputc\fR(3).
172.PP
173Comparable functions in the wide-character (ncursesw) library are
174described in
175\fBcurs_add_wch\fR(3X).
176.\"#
177.\"# The following sets edit modes for GNU EMACS
178.\"# Local Variables:
179.\"# mode:nroff
180.\"# fill-column:79
181.\"# End: