From 54eecf50dacb387d60ad3fa022f5d570ed4ab490 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Tue, 21 Feb 2006 04:59:21 +0000 Subject: [PATCH] Removed useless extra element of atrtab[]; removed spurious extra color pair in 16-bit mode; revised comments (PDCurses' behavior is in fact per the standard, not an abberation). --- curspriv.h | 6 +++--- pdcurses/color.c | 16 +++++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/curspriv.h b/curspriv.h index c3cbc670..2f4453bf 100644 --- a/curspriv.h +++ b/curspriv.h @@ -15,7 +15,7 @@ * See the file maintain.er for details of the current maintainer. **************************************************************************/ -/* $Id: curspriv.h,v 1.34 2006/02/21 04:21:13 wmcbrine Exp $ */ +/* $Id: curspriv.h,v 1.35 2006/02/21 04:59:20 wmcbrine Exp $ */ /* CURSPRIV.H @@ -323,13 +323,13 @@ WINDS * PDC_findwin(WINDOW *); # define PDC_SHIFT 19 # define chtype_attr(ch) (atrtab[((ch >> PDC_SHIFT) & 0xFFFF)] << 8) #else -# define PDC_COLOR_PAIRS 33 +# define PDC_COLOR_PAIRS 32 # define PDC_OFFSET 8 # define PDC_SHIFT 8 # define chtype_attr(ch) (atrtab[((ch >> PDC_SHIFT) & 0xFF)] << 8) #endif -#define MAX_ATRTAB ((PDC_COLOR_PAIRS + 1) * PDC_OFFSET) +#define MAX_ATRTAB (PDC_COLOR_PAIRS * PDC_OFFSET) /* Internal mouse handling macros */ #define TRAPPED_MOUSE_X_POS (Trapped_Mouse_status.x) diff --git a/pdcurses/color.c b/pdcurses/color.c index d739bc48..5d47662f 100644 --- a/pdcurses/color.c +++ b/pdcurses/color.c @@ -35,7 +35,7 @@ static void PDC_init_pair(short, short, short); #ifdef PDCDEBUG const char *rcsid_color = - "$Id: color.c,v 1.36 2006/02/21 04:41:17 wmcbrine Exp $"; + "$Id: color.c,v 1.37 2006/02/21 04:59:21 wmcbrine Exp $"; #endif /*man-start********************************************************************* @@ -72,12 +72,12 @@ const char *rcsid_color = init_pair() changes the definitions of a color-pair. The routine takes three arguments: the number of the color-pair to be redefined, and the new values of the foreground and background - colors. The value of color-pair must be between 1 and - COLOR_PAIRS - 1. The values of foreground and background must be - between 0 and COLORS - 1 (this is a PDCurses abberation; - normally it is 0 and COLORS). If the color pair was previously - initialized, the screen is refreshed and all occurrences of that - color-pair are changed to the new definition. + colors. The value of color-pair must be between 0 and + COLOR_PAIRS - 1, inclusive. The values of foreground and + background must be between 0 and COLORS - 1, inclusive. If the + color pair was previously initialized, the screen is refreshed + and all occurrences of that color-pair are changed to the new + definition. has_colors() indicates if the terminal supports, and can maniplulate color. It returns TRUE or FALSE. @@ -273,8 +273,6 @@ void PDC_init_atrtab(void) for (i = 0; i < PDC_COLOR_PAIRS; i++) PDC_init_pair(i, orig_fore, orig_back); - - PDC_init_pair(PDC_COLOR_PAIRS, orig_back, orig_fore); } static void PDC_init_pair(short pairnum, short fg, short bg)