-<!--
+<!--
* t
****************************************************************************
- * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. *
+ * Copyright 2018-2020,2021 Thomas E. Dickey *
+ * Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************
- * @Id: curs_attr.3x,v 1.60 2017/10/14 20:01:13 tom Exp @
+ * @Id: curs_attr.3x,v 1.70 2021/12/25 21:49:32 tom Exp @
* ---------------------------------------------------------------------------
* attr_get
* .br
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
-<meta name="generator" content="Manpage converted by man2html - see http://invisible-island.net/scripts/readme.html#others_scripts">
+<meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
<TITLE>curs_attr 3x</TITLE>
-<link rev=made href="mailto:bug-ncurses@gnu.org">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="author" href="mailto:bug-ncurses@gnu.org">
+
</HEAD>
<BODY>
<H1 class="no-header">curs_attr 3x</H1>
</PRE><H3><a name="h3-Legacy-window-attributes">Legacy window attributes</a></H3><PRE>
- Most of the window attribute routines are extensions of older routines
- which assume that color pairs are OR'd into the attribute parameter.
- These older routines use the same name, omitting an underscore (<STRONG>_</STRONG>).
+ The X/Open window attribute routines which <EM>set</EM> or <EM>get</EM>, turn <EM>on</EM> or <EM>off</EM>
+ are extensions of older routines which assume that color pairs are OR'd
+ into the attribute parameter. These newer routines use similar names,
+ because X/Open simply added an underscore (<STRONG>_</STRONG>) for the newer names.
+
+ The <STRONG>int</STRONG> datatype used in the legacy routines is treated as if it is the
+ same size as <STRONG>chtype</STRONG> (used by <STRONG><A HREF="curs_addch.3x.html">addch(3x)</A></STRONG>). It holds the common video at-
+ tributes (such as bold, reverse), as well as a few bits for color.
+ Those bits correspond to the <STRONG>A_COLOR</STRONG> symbol. The <STRONG>COLOR_PAIR</STRONG> macro pro-
+ vides a value which can be OR'd into the attribute parameter. For ex-
+ ample, as long as that value fits into the <STRONG>A_COLOR</STRONG> mask, then these
+ calls produce similar results:
+
+ attrset(A_BOLD | COLOR_PAIR(<EM>pair</EM>));
+ attr_set(A_BOLD, <EM>pair</EM>, NULL);
+
+ However, if the value does not fit, then the <STRONG>COLOR_PAIR</STRONG> macro uses only
+ the bits that fit. For example, because in ncurses <STRONG>A_COLOR</STRONG> has eight
+ (8) bits, then <STRONG>COLOR_PAIR(</STRONG><EM>259</EM><STRONG>)</STRONG> is 4 (i.e., 259 is 4 more than the limit
+ 255).
+
+ The <STRONG>PAIR_NUMBER</STRONG> macro extracts a pair number from an <STRONG>int</STRONG> (or <STRONG>chtype</STRONG>).
+ For example, the <EM>input</EM> and <EM>output</EM> values in these statements would be
+ the same:
+
+ int value = A_BOLD | COLOR_PAIR(<EM>input</EM>);
+ int <EM>output</EM> = PAIR_NUMBER(value);
The <STRONG>attrset</STRONG> routine is a legacy feature predating SVr4 curses but kept
in X/Open Curses for the same reason that SVr4 curses kept it: compati-
the routines <STRONG>attron</STRONG>, <STRONG>attroff</STRONG>, and <STRONG>attrset</STRONG>, or OR'd with the characters
passed to <STRONG>addch</STRONG> (see <STRONG><A HREF="curs_addch.3x.html">curs_addch(3x)</A></STRONG>).
- <EM>Name</EM> <EM>Description</EM>
- -----------------------------------------------------------
+ <STRONG>Name</STRONG> <STRONG>Description</STRONG>
+ -----------------------------------------------------------------
<STRONG>A_NORMAL</STRONG> Normal display (no highlight)
<STRONG>A_STANDOUT</STRONG> Best highlighting mode of the terminal.
<STRONG>A_UNDERLINE</STRONG> Underlining
<STRONG>A_ALTCHARSET</STRONG> Alternate character set
<STRONG>A_ITALIC</STRONG> Italics (non-X/Open extension)
<STRONG>A_CHARTEXT</STRONG> Bit-mask to extract a character
+ <STRONG>A_COLOR</STRONG> Bit-mask to extract a color (legacy routines)
These video attributes are supported by <STRONG>attr_on</STRONG> and related functions
(which also support the attributes recognized by <STRONG>attron</STRONG>, etc.):
- <EM>Name</EM> <EM>Description</EM>
+ <STRONG>Name</STRONG> <STRONG>Description</STRONG>
-----------------------------------------
<STRONG>WA_HORIZONTAL</STRONG> Horizontal highlight
<STRONG>WA_LEFT</STRONG> Left highlight
nate character set implementation. A 32-bit library can be used on a
64-bit system, but not necessarily the reverse.
- <EM>Year</EM> <EM>System</EM> <EM>Arch</EM> <EM>Color</EM> <EM>Char</EM> <EM>Notes</EM>
+ <STRONG>Year</STRONG> <STRONG>System</STRONG> <STRONG>Arch</STRONG> <STRONG>Color</STRONG> <STRONG>Char</STRONG> <STRONG>Notes</STRONG>
----------------------------------------------------------------
1992 Solaris 5.2 32 6 17 SVr4 curses
1992 HPUX 9 32 no 8 SVr2 curses
1995 Solaris 5.4 32/64 7 16 X/Open curses
1996 AIX 4.2 32 7 16 X/Open curses
1996 OSF/1 r4 32 6 16 X/Open curses
+
1997 HP-UX 11.00 32 6 8 X/Open curses
2000 U/Win 32/64 7/31 16 uses <STRONG>chtype</STRONG>
Other interfaces are rarely used now:
<STRONG>o</STRONG> BSD curses was improved slightly in 1993/1994 using Keith Bostic's
- modification to make the library 8-bit clean for <STRONG>nvi</STRONG>. He moved
+ modification to make the library 8-bit clean for <STRONG>nvi(1)</STRONG>. He moved
<EM>standout</EM> attribute to a structure member.
The resulting 4.4BSD curses was replaced by ncurses over the next
have the <STRONG>enter_italics_mode</STRONG> (<STRONG>sitm</STRONG>) and <STRONG>exit_italics_mode</STRONG> (<STRONG>ritm</STRONG>) capa-
bilities. Italics are not mentioned in X/Open Curses. Unlike the oth-
er video attributes, <STRONG>A_ITALIC</STRONG> is unrelated to the <STRONG>set_attributes</STRONG> capa-
- bilities. This implementation makes the assumption that <STRONG>exit_at-</STRONG>
- <STRONG>tribute_mode</STRONG> may also reset italics.
+ bilities. This implementation makes the assumption that <STRONG>exit_attri-</STRONG>
+ <STRONG>bute_mode</STRONG> may also reset italics.
Each of the functions added by XSI Curses has a parameter <EM>opts</EM>, which
X/Open Curses still (after more than twenty years) documents as re-
macros prefixed with <STRONG>WA_</STRONG>. The older macros have direct counterparts in
the newer set of names:
- <EM>Name</EM> <EM>Description</EM>
+ <STRONG>Name</STRONG> <STRONG>Description</STRONG>
------------------------------------------------------------
<STRONG>WA_NORMAL</STRONG> Normal display (no highlight)
<STRONG>WA_STANDOUT</STRONG> Best highlighting mode of the terminal.