summaryrefslogtreecommitdiffstats
path: root/lib/libcurses/base/lib_color.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2001-01-22 18:01:32 +0000
committermillert <millert@openbsd.org>2001-01-22 18:01:32 +0000
commit84af20cee44481ef9eb2070c76702603863c1a4c (patch)
treeb232b1727be5b5b1854432f2b87c149f7522cb9d /lib/libcurses/base/lib_color.c
parentfix memory leaks in SSH2 key exchange; ok markus@ (diff)
downloadwireguard-openbsd-84af20cee44481ef9eb2070c76702603863c1a4c.tar.xz
wireguard-openbsd-84af20cee44481ef9eb2070c76702603863c1a4c.zip
Update to ncurses-5.2-20010114
Diffstat (limited to 'lib/libcurses/base/lib_color.c')
-rw-r--r--lib/libcurses/base/lib_color.c82
1 files changed, 45 insertions, 37 deletions
diff --git a/lib/libcurses/base/lib_color.c b/lib/libcurses/base/lib_color.c
index 952698083d0..06b88fe43e5 100644
--- a/lib/libcurses/base/lib_color.c
+++ b/lib/libcurses/base/lib_color.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_color.c,v 1.9 2000/10/08 22:46:58 millert Exp $ */
+/* $OpenBSD: lib_color.c,v 1.10 2001/01/22 18:01:38 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -43,15 +43,17 @@
#include <term.h>
#include <tic.h>
-MODULE_ID("$From: lib_color.c,v 1.53 2000/09/02 18:02:15 tom Exp $")
+MODULE_ID("$From: lib_color.c,v 1.55 2000/12/10 02:43:27 tom Exp $")
/*
* These should be screen structure members. They need to be globals for
* historical reasons. So we assign them in start_color() and also in
* set_term()'s screen-switching logic.
*/
-int COLOR_PAIRS = 0;
-int COLORS = 0;
+NCURSES_EXPORT_VAR(int)
+COLOR_PAIRS = 0;
+NCURSES_EXPORT_VAR(int)
+COLORS = 0;
/*
* Given a RGB range of 0..1000, we'll normally set the individual values
@@ -92,8 +94,8 @@ static const color_t hls_palette[] =
* These are called from _nc_do_color(), which in turn is called from
* vidattr - so we have to assume that SP may be null.
*/
-static int
-default_fg(void)
+ static int
+ default_fg(void)
{
return (SP != 0) ? SP->_default_fg : COLOR_WHITE;
}
@@ -113,13 +115,13 @@ default_bg(void)
* to maintain compatibility with a pre-ANSI scheme. The same scheme is
* also used in the FreeBSD syscons.
*/
-static int
-toggled_colors(int c)
+ static int
+ toggled_colors(int c)
{
if (c < 16) {
static const int table[] =
{0, 4, 2, 6, 1, 5, 3, 7,
- 8, 12, 10, 14, 9, 13, 11, 15};
+ 8, 12, 10, 14, 9, 13, 11, 15};
c = table[c];
}
return c;
@@ -164,7 +166,7 @@ set_original_colors(void)
return FALSE;
}
-int
+NCURSES_EXPORT(int)
start_color(void)
{
int n;
@@ -258,8 +260,9 @@ rgb2hls(short r, short g, short b, short *h, short *l, short *s)
* Extension (1997/1/18) - Allow negative f/b values to set default color
* values.
*/
-int
-init_pair(short pair, short f, short b)
+NCURSES_EXPORT(int)
+init_pair
+(short pair, short f, short b)
{
unsigned result;
@@ -321,24 +324,25 @@ init_pair(short pair, short f, short b)
const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette;
T(("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)",
- pair,
- tp[f].red, tp[f].green, tp[f].blue,
- tp[b].red, tp[b].green, tp[b].blue));
+ pair,
+ tp[f].red, tp[f].green, tp[f].blue,
+ tp[b].red, tp[b].green, tp[b].blue));
if (initialize_pair) {
TPUTS_TRACE("initialize_pair");
putp(tparm(initialize_pair,
- pair,
- tp[f].red, tp[f].green, tp[f].blue,
- tp[b].red, tp[b].green, tp[b].blue));
+ pair,
+ tp[f].red, tp[f].green, tp[f].blue,
+ tp[b].red, tp[b].green, tp[b].blue));
}
}
returnCode(OK);
}
-int
-init_color(short color, short r, short g, short b)
+NCURSES_EXPORT(int)
+init_color
+(short color, short r, short g, short b)
{
T((T_CALLED("init_color(%d,%d,%d,%d)"), color, r, g, b));
@@ -352,9 +356,9 @@ init_color(short color, short r, short g, short b)
if (hue_lightness_saturation)
rgb2hls(r, g, b,
- &SP->_color_table[color].red,
- &SP->_color_table[color].green,
- &SP->_color_table[color].blue);
+ &SP->_color_table[color].red,
+ &SP->_color_table[color].green,
+ &SP->_color_table[color].blue);
else {
SP->_color_table[color].red = r;
SP->_color_table[color].green = g;
@@ -368,27 +372,28 @@ init_color(short color, short r, short g, short b)
returnCode(OK);
}
-bool
+NCURSES_EXPORT(bool)
can_change_color(void)
{
T((T_CALLED("can_change_color()")));
returnCode((can_change != 0) ? TRUE : FALSE);
}
-bool
+NCURSES_EXPORT(bool)
has_colors(void)
{
T((T_CALLED("has_colors()")));
returnCode((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs)
- && (((set_foreground != NULL)
- && (set_background != NULL))
- || ((set_a_foreground != NULL)
- && (set_a_background != NULL))
- || set_color_pair)) ? TRUE : FALSE);
+ && (((set_foreground != NULL)
+ && (set_background != NULL))
+ || ((set_a_foreground != NULL)
+ && (set_a_background != NULL))
+ || set_color_pair)) ? TRUE : FALSE);
}
-int
-color_content(short color, short *r, short *g, short *b)
+NCURSES_EXPORT(int)
+color_content
+(short color, short *r, short *g, short *b)
{
T((T_CALLED("color_content(%d,%p,%p,%p)"), color, r, g, b));
if (color < 0 || color >= COLORS)
@@ -403,8 +408,9 @@ color_content(short color, short *r, short *g, short *b)
returnCode(OK);
}
-int
-pair_content(short pair, short *f, short *b)
+NCURSES_EXPORT(int)
+pair_content
+(short pair, short *f, short *b)
{
T((T_CALLED("pair_content(%d,%p,%p)"), pair, f, b));
@@ -418,8 +424,9 @@ pair_content(short pair, short *f, short *b)
returnCode(OK);
}
-void
-_nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int))
+NCURSES_EXPORT(void)
+_nc_do_color
+(int old_pair, int pair, bool reverse, int (*outc) (int))
{
NCURSES_COLOR_T fg = C_MASK, bg = C_MASK;
NCURSES_COLOR_T old_fg, old_bg;
@@ -473,7 +480,8 @@ _nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int))
bg = xx;
}
- TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg));
+ TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair,
+ fg, bg));
if (fg != C_MASK) {
set_foreground_color(fg, outc);