From 4f84dbbd027e85fc88e2c6be466b3237141e027e Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 2 Feb 2014 00:11:40 +0000 Subject: [PATCH] ncurses 5.9 - patch 20140201 + add/use symbol NCURSES_PAIRS_T like NCURSES_COLOR_T, to illustrate which "short" types are for color pairs and which are color values. + fix build for s390x, by correcting field bit offsets in generated representation clauses when int=32 long=64 and endian=big, or at least on s390x (patch by Nicolas Boulenguez). + minor cleanup change to test/form_driver_w.c (patch by Gaute Hope). --- Ada95/gen/gen.c | 123 +++++++++-------- NEWS | 10 +- c++/cursesw.cc | 20 +-- c++/cursesw.h | 34 ++--- dist.mk | 4 +- include/curses.h.in | 63 +++++---- include/curses.wide | 14 +- ncurses/base/lib_chgat.c | 16 ++- ncurses/base/lib_color.c | 87 +++++++----- ncurses/base/lib_colorset.c | 8 +- ncurses/base/lib_instr.c | 6 +- ncurses/base/lib_slkatr_set.c | 10 +- ncurses/base/lib_slkcolor.c | 10 +- ncurses/curses.priv.h | 22 ++-- ncurses/trace/lib_traceatr.c | 6 +- ncurses/tty/tty_update.c | 6 +- ncurses/widechar/lib_cchar.c | 12 +- ncurses/widechar/lib_vid_attr.c | 16 +-- package/debian-mingw/changelog | 4 +- package/debian-mingw64/changelog | 4 +- package/debian/changelog | 4 +- package/mingw-ncurses.nsi | 4 +- package/mingw-ncurses.spec | 2 +- package/ncurses.spec | 2 +- progs/infocmp.c | 10 +- test/background.c | 14 +- test/color_set.c | 8 +- test/form_driver_w.c | 17 +-- test/ncurses.c | 220 +++++++++++++++++-------------- test/test.priv.h | 14 +- 30 files changed, 427 insertions(+), 343 deletions(-) diff --git a/Ada95/gen/gen.c b/Ada95/gen/gen.c index 7595672e..082315b6 100644 --- a/Ada95/gen/gen.c +++ b/Ada95/gen/gen.c @@ -32,7 +32,7 @@ /* Version Control - $Id: gen.c,v 1.62 2014/01/26 00:21:52 Nicolas.Boulenguez Exp $ + $Id: gen.c,v 1.64 2014/02/01 19:52:47 tom Exp $ --------------------------------------------------------------------------*/ /* This program generates various record structures and constants from the @@ -57,9 +57,14 @@ #include #include -#define UChar(c) ((unsigned char)(c)) +#undef UCHAR +#undef UINT +#define UChar(c) ((UCHAR)(c)) #define RES_NAME "Reserved" +typedef unsigned char UCHAR; +typedef unsigned int UINT; + static const char *model = ""; static int little_endian = 0; @@ -70,45 +75,43 @@ typedef struct } name_attribute_pair; +static UCHAR +bit_is_set(const UCHAR * const data, + const UINT offset) +{ + const UCHAR byte = data[offset >> 3]; + UINT bit; + + if (little_endian) + bit = offset; /* offset */ + else /* or */ + bit = ~offset; /* 7 - offset */ + bit &= 7; /* modulo 8 */ + return byte & (UCHAR) (1 << bit); +} + +/* Find lowest and highest used offset in a byte array. */ +/* Returns 0 if and only if all bits are unset. */ static int -find_pos(char *s, unsigned len, int *low, int *high) +find_pos(const UCHAR * const data, + const UINT sizeof_data, + UINT * const low, + UINT * const high) { - unsigned int i, j; - int l = 0; + const UINT last = (sizeof_data << 3) - 1; + UINT offset; - *high = -1; - *low = (int)(8 * len); + for (offset = last; !bit_is_set(data, offset); offset--) + if (!offset) /* All bits are 0. */ + return 0; + *high = offset; - for (i = 0; i < len; i++, s++) + for (offset = 0; !bit_is_set(data, offset); offset++) { - if (*s) - { - for (j = 0; j < 8 * sizeof(char); j++) - - { - if (((little_endian && ((*s) & 0x01)) || - (!little_endian && ((*s) & 0x80)))) - { - if (l > *high) - *high = l; - if (l < *low) - *low = l; - } - l++; - if (little_endian) - { - *s >>= 1; - } - else - { - *s = (char)(*s << 1); - } - } - } - else - l += 8; } - return (*high >= 0 && (*low <= *high)) ? *low : -1; + *low = offset; + + return -1; } /* @@ -122,13 +125,13 @@ static void gen_reps( const name_attribute_pair * nap, /* array of name_attribute_pair records */ const char *name, /* name of the represented record type */ - int len, /* size of the record in bytes */ - int bias) + const UINT len, /* size of the record in bytes */ + const UINT bias) { - const int len_bits = (8 * len); - int i, l, low, high; + const UINT len_bits = len << 3; + int i, l; + UINT low, high; int width = strlen(RES_NAME) + 3; - unsigned long a; assert(nap != NULL); @@ -157,11 +160,9 @@ gen_reps( for (i = 0; nap[i].name != (char *)0; i++) if (nap[i].attr) { - a = nap[i].attr; - l = find_pos((char *)&a, sizeof(a), &low, &high); - if (l >= 0) + if (find_pos((const UCHAR *)(&(nap[i].attr)) + bias, len, &low, &high)) printf(" %-*s at 0 range %2d .. %2d;\n", width, nap[i].name, - low - bias, high - bias); + low, high); } printf(" end record;\n"); printf(" pragma Warnings (Off);"); @@ -176,10 +177,9 @@ chtype_rep(const char *name, attr_t mask) { attr_t x = (attr_t)-1; attr_t t = x & mask; - int low, high; - int l = find_pos((char *)&t, sizeof(t), &low, &high); + UINT low, high; - if (l >= 0) + if (find_pos((const UCHAR *)(&t), sizeof(t), &low, &high)) printf(" %-5s at 0 range %2d .. %2d;\n", name, low, high); } @@ -200,10 +200,9 @@ gen_chtype_rep(const char *name) static void mrep_rep(const char *name, void *rec) { - int low, high; - int l = find_pos((char *)rec, sizeof(MEVENT), &low, &high); + UINT low, high; - if (l >= 0) + if (find_pos((const UCHAR *)rec, sizeof(MEVENT), &low, &high)) printf(" %-7s at 0 range %3d .. %3d;\n", name, low, high); } @@ -289,7 +288,9 @@ gen_attr_set(const char *name) } attr = attr >> 1; } - gen_reps(nap, name, (len + 7) / 8, little_endian ? start : 0); + gen_reps(nap, name, + (UINT) ((len + 7) / 8), + (UINT) (little_endian ? start >> 3 : 0)); } static void @@ -312,7 +313,9 @@ gen_trace(const char *name) {"Attributes_And_Colors", TRACE_ATTRS}, {(char *)0, 0} }; - gen_reps(nap, name, sizeof(int), 0); + + gen_reps(nap, name, sizeof(UINT), + little_endian ? 0 : sizeof(nap[0].attr) - sizeof(UINT)); } static void @@ -340,7 +343,9 @@ gen_menu_opt_rep(const char *name) #endif {(char *)0, 0} }; - gen_reps(nap, name, sizeof(int), 0); + + gen_reps(nap, name, sizeof(Menu_Options), + little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Menu_Options)); } static void @@ -353,7 +358,9 @@ gen_item_opt_rep(const char *name) #endif {(char *)0, 0} }; - gen_reps(nap, name, sizeof(int), 0); + + gen_reps(nap, name, sizeof(Item_Options), + little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Item_Options)); } static void @@ -369,7 +376,9 @@ gen_form_opt_rep(const char *name) #endif {(char *)0, 0} }; - gen_reps(nap, name, sizeof(int), 0); + + gen_reps(nap, name, sizeof(Form_Options), + little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Form_Options)); } /* @@ -412,7 +421,9 @@ gen_field_opt_rep(const char *name) #endif {(char *)0, 0} }; - gen_reps(nap, name, sizeof(int), 0); + + gen_reps(nap, name, sizeof(Field_Options), + little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Field_Options)); } /* diff --git a/NEWS b/NEWS index eb4c0bf3..f3d12bb2 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.2157 2014/01/26 00:20:39 tom Exp $ +-- $Id: NEWS,v 1.2161 2014/02/01 22:30:45 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,14 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20140201 + + add/use symbol NCURSES_PAIRS_T like NCURSES_COLOR_T, to illustrate + which "short" types are for color pairs and which are color values. + + fix build for s390x, by correcting field bit offsets in generated + representation clauses when int=32 long=64 and endian=big, or at + least on s390x (patch by Nicolas Boulenguez). + + minor cleanup change to test/form_driver_w.c (patch by Gaute Hope). + 20140125 + remove unnecessary ifdef's in Ada95/gen/gen.c, which reportedly do not work as is with gcc 4.8 due to fixes using chtype cast made for diff --git a/c++/cursesw.cc b/c++/cursesw.cc index adbcf6e7..16438770 100644 --- a/c++/cursesw.cc +++ b/c++/cursesw.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 2007-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 2007-2012,2014 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 * @@ -42,7 +42,7 @@ #include "internal.h" #include "cursesw.h" -MODULE_ID("$Id: cursesw.cc,v 1.53 2012/12/08 22:06:41 tom Exp $") +MODULE_ID("$Id: cursesw.cc,v 1.54 2014/02/01 22:10:42 tom Exp $") #define COLORS_NEED_INITIALIZATION -1 #define COLORS_NOT_INITIALIZED 0 @@ -401,16 +401,16 @@ NCursesWindow::useColors(void) } } -short +NCURSES_PAIRS_T NCursesWindow::getPair() const { - return static_cast(PAIR_NUMBER(getattrs(w))); + return static_cast(PAIR_NUMBER(getattrs(w))); } -short +NCURSES_COLOR_T NCursesWindow::getcolor(int getback) const { - short fore, back; + NCURSES_COLOR_T fore, back; if (HaveColors()) { if (::pair_content(getPair(), &fore, &back) == ERR) @@ -428,27 +428,27 @@ int NCursesWindow::NumberOfColors() return (HaveColors()) ? COLORS : 1; } -short +NCURSES_PAIRS_T NCursesWindow::getcolor() const { return (HaveColors()) ? getPair() : 0; } int -NCursesWindow::setpalette(short fore, short back, short pair) +NCursesWindow::setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair) { return (HaveColors()) ? ::init_pair(pair, fore, back) : OK; } int -NCursesWindow::setpalette(short fore, short back) +NCursesWindow::setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back) { return setpalette(fore, back, getPair()); } int -NCursesWindow::setcolor(short pair) +NCursesWindow::setcolor(NCURSES_PAIRS_T pair) { if (HaveColors()) { if ((pair < 1) || (pair > COLOR_PAIRS)) diff --git a/c++/cursesw.h b/c++/cursesw.h index 4472ea9c..ca07b042 100644 --- a/c++/cursesw.h +++ b/c++/cursesw.h @@ -1,7 +1,7 @@ // * This makes emacs happy -*-Mode: C++;-*- // vile:cppmode /**************************************************************************** - * Copyright (c) 1998-2008,2011 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2014 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 * @@ -31,7 +31,7 @@ #ifndef NCURSES_CURSESW_H_incl #define NCURSES_CURSESW_H_incl 1 -// $Id: cursesw.h,v 1.49 2011/09/17 22:12:10 tom Exp $ +// $Id: cursesw.h,v 1.50 2014/02/01 22:17:37 tom Exp $ #include @@ -118,7 +118,7 @@ inline int UNDEF(box)(WINDOW *win, int v, int h) { return box(win, v, h); } #endif #ifdef chgat -inline int UNDEF(chgat)(int n, attr_t attr, short color, const void *opts) { +inline int UNDEF(chgat)(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts) { return chgat(n, attr, color, opts); } #undef chgat #define chgat UNDEF(chgat) @@ -151,7 +151,7 @@ inline int UNDEF(clrtoeol)() { return clrtoeol(); } #endif #ifdef color_set -inline chtype UNDEF(color_set)(short p, void* opts) { return color_set(p, opts); } +inline chtype UNDEF(color_set)(NCURSES_PAIRS_T p, void* opts) { return color_set(p, opts); } #undef color_set #define color_set UNDEF(color_set) #endif @@ -361,7 +361,7 @@ inline int UNDEF(mvaddstr)(int y, int x, const char * str) #ifdef mvchgat inline int UNDEF(mvchgat)(int y, int x, int n, - attr_t attr, short color, const void *opts) { + attr_t attr, NCURSES_PAIRS_T color, const void *opts) { return mvchgat(y, x, n, attr, color, opts); } #undef mvchgat #define mvchgat UNDEF(mvchgat) @@ -463,7 +463,7 @@ inline int UNDEF(mvwaddstr)(WINDOW *win, int y, int x, const char * str) #ifdef mvwchgat inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n, - attr_t attr, short color, const void *opts) { + attr_t attr, NCURSES_PAIRS_T color, const void *opts) { return mvwchgat(win, y, x, n, attr, color, opts); } #undef mvwchgat #define mvwchgat UNDEF(mvwchgat) @@ -763,10 +763,10 @@ private: void set_keyboard(); - short getcolor(int getback) const; - short getPair() const; + NCURSES_COLOR_T getcolor(int getback) const; + NCURSES_PAIRS_T getPair() const; - static int setpalette(short fore, short back, short pair); + static int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair); static int colorInitialized; // This private constructor is only used during the initialization @@ -896,19 +896,19 @@ public: int maxy() const { return getmaxy(w) == ERR ? ERR : getmaxy(w)-1; } // Largest y coord in window - short getcolor() const; + NCURSES_PAIRS_T getcolor() const; // Actual color pair - short foreground() const { return getcolor(0); } + NCURSES_COLOR_T foreground() const { return getcolor(0); } // Actual foreground color - short background() const { return getcolor(1); } + NCURSES_COLOR_T background() const { return getcolor(1); } // Actual background color - int setpalette(short fore, short back); + int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back); // Set color palette entry - int setcolor(short pair); + int setcolor(NCURSES_PAIRS_T pair); // Set actually used palette entry // ------------------------------------------------------------------------- @@ -1107,18 +1107,18 @@ public: chtype attrget() { return ::getattrs(w); } // Get the window attributes; - int color_set(short color_pair_number, void* opts=NULL) { + int color_set(NCURSES_PAIRS_T color_pair_number, void* opts=NULL) { return ::wcolor_set(w, color_pair_number, opts); } // Set the window color attribute; - int chgat(int n, attr_t attr, short color, const void *opts=NULL) { + int chgat(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) { return ::wchgat(w, n, attr, color, opts); } // Change the attributes of the next n characters in the current line. If // n is negative or greater than the number of remaining characters in the // line, the attributes will be changed up to the end of the line. int chgat(int y, int x, - int n, attr_t attr, short color, const void *opts=NULL) { + int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) { return ::mvwchgat(w, y, x, n, attr, color, opts); } // Move the cursor to the requested position and then perform chgat() as // described above. diff --git a/dist.mk b/dist.mk index 3fbdae0a..a4bdc3f2 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.968 2014/01/25 16:16:43 tom Exp $ +# $Id: dist.mk,v 1.969 2014/02/01 17:10:27 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -37,7 +37,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 5 NCURSES_MINOR = 9 -NCURSES_PATCH = 20140125 +NCURSES_PATCH = 20140201 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/include/curses.h.in b/include/curses.h.in index 62dcb75c..15c9f7f2 100644 --- a/include/curses.h.in +++ b/include/curses.h.in @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2013,2014 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 * @@ -32,7 +32,7 @@ * and: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: curses.h.in,v 1.236 2013/09/07 19:07:23 tom Exp $ */ +/* $Id: curses.h.in,v 1.237 2014/02/01 22:08:12 tom Exp $ */ #ifndef __NCURSES_H #define __NCURSES_H @@ -91,11 +91,20 @@ #define NCURSES_INLINE @NCURSES_INLINE@ /* - * The internal type used for color values + * The internal type used for color values, and for color-pairs. The latter + * allows the curses library to enumerate the combinations of foreground and + * background colors used by an application, and is normally the product of the + * total foreground and background colors. + * + * X/Open uses "short" for both of these types, ultimately because they are + * numbers from the terminal database, which uses 16-bit signed values. */ #undef NCURSES_COLOR_T #define NCURSES_COLOR_T short +#undef NCURSES_PAIRS_T +#define NCURSES_PAIRS_T short + /* * Definition used to make WINDOW and similar structs opaque. */ @@ -573,10 +582,10 @@ extern NCURSES_EXPORT(int) addstr (const char *); /* generated */ extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */ extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */ extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */ -extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_get (attr_t *, NCURSES_PAIRS_T *, void *); /* generated */ extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */ extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */ -extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_set (attr_t, NCURSES_PAIRS_T, void *); /* generated */ extern NCURSES_EXPORT(int) baudrate (void); /* implemented */ extern NCURSES_EXPORT(int) beep (void); /* implemented */ extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */ @@ -585,13 +594,13 @@ extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,cht extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */ extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */ extern NCURSES_EXPORT(int) cbreak (void); /* implemented */ -extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *); /* generated */ +extern NCURSES_EXPORT(int) chgat (int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */ extern NCURSES_EXPORT(int) clear (void); /* generated */ extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */ extern NCURSES_EXPORT(int) clrtobot (void); /* generated */ extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */ -extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*); /* implemented */ -extern NCURSES_EXPORT(int) color_set (short,void*); /* generated */ +extern NCURSES_EXPORT(int) color_content (NCURSES_COLOR_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) color_set (NCURSES_PAIRS_T,void*); /* generated */ extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */ extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ extern NCURSES_EXPORT(int) curs_set (int); /* implemented */ @@ -630,8 +639,8 @@ extern NCURSES_EXPORT(chtype) inch (void); /* generated */ extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */ extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */ extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */ -extern NCURSES_EXPORT(int) init_color (short,short,short,short); /* implemented */ -extern NCURSES_EXPORT(int) init_pair (short,short,short); /* implemented */ +extern NCURSES_EXPORT(int) init_color (NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) init_pair (NCURSES_PAIRS_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */ extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */ extern NCURSES_EXPORT(int) insch (chtype); /* generated */ extern NCURSES_EXPORT(int) insdelln (int); /* generated */ @@ -655,7 +664,7 @@ extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* gener extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */ extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */ extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */ -extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *); /* generated */ +extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */ extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */ extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */ extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */ @@ -681,7 +690,7 @@ extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */ extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */ extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */ -extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */ +extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, NCURSES_PAIRS_T, const void *);/* generated */ extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */ extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */ extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */ @@ -715,7 +724,7 @@ extern NCURSES_EXPORT(int) noraw (void); /* implemented */ extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */ extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) pair_content (short,short*,short*); /* implemented */ +extern NCURSES_EXPORT(int) pair_content (NCURSES_PAIRS_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */ extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */ extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */ extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */ @@ -749,9 +758,9 @@ extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */ extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */ extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */ extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */ -extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,NCURSES_PAIRS_T,void*); /* implemented */ extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */ -extern NCURSES_EXPORT(int) slk_color (short); /* implemented */ +extern NCURSES_EXPORT(int) slk_color (NCURSES_PAIRS_T); /* implemented */ extern NCURSES_EXPORT(int) slk_init (int); /* implemented */ extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */ extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */ @@ -790,18 +799,18 @@ extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */ extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */ extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */ extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */ -extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *); /* generated */ +extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, NCURSES_PAIRS_T *, void *); /* generated */ extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *); /* implemented */ extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *); /* implemented */ -extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *); /* generated */ +extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, NCURSES_PAIRS_T, void *); /* generated */ extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype); /* implemented */ extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */ extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ -extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */ +extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, NCURSES_PAIRS_T, const void *);/* implemented */ extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */ -extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*); /* implemented */ +extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,NCURSES_PAIRS_T,void*); /* implemented */ extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */ @@ -947,7 +956,7 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(beep) (SCREEN*); /* implemented:SP_FU extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(can_change_color) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(cbreak) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(curs_set) (SCREEN*, int); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, short, short*, short*, short*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_prog_mode) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_shell_mode) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(delay_output) (SCREEN*, int); /* implemented:SP_FUNC */ @@ -963,8 +972,8 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(halfdelay) (SCREEN*, int); /* impleme extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_colors) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_ic) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_il) (SCREEN*); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, short, short, short, short); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, short, short, short); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(intrflush) (SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(isendwin) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(keyname) (SCREEN*, int); /* implemented:SP_FUNC */ @@ -981,7 +990,7 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noecho) (SCREEN*); /* implemented:SP_ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nonl) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(void) NCURSES_SP_NAME(noqiflush) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noraw) (SCREEN*); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, short, short*, short*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(void) NCURSES_SP_NAME(qiflush) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(raw) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_prog_mode) (SCREEN*); /* implemented:SP_FUNC */ @@ -996,9 +1005,9 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attroff) (SCREEN*, const chtype); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attron) (SCREEN*, const chtype); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attrset) (SCREEN*, const chtype); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(slk_attr) (SCREEN*); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, short, void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, NCURSES_PAIRS_T, void*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_clear) (SCREEN*); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, short); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_init) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(slk_label) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_noutrefresh) (SCREEN*); /* implemented:SP_FUNC */ @@ -1293,7 +1302,7 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* : OK), \ OK) #define wattr_get(win,a,p,opts) ((void)(((a) != (void *)0) ? (*(a) = (win) ? (win)->_attrs : 0) : OK), \ - (void)(((p) != (void *)0) ? (*(p) = (short) ((win) ? (win)->_color : 0)) : OK), \ + (void)(((p) != (void *)0) ? (*(p) = (NCURSES_PAIRS_T) ((win) ? (win)->_color : 0)) : OK), \ OK) #else #define wattr_set(win,a,p,opts) (((win) \ @@ -1301,7 +1310,7 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* : OK), \ OK) #define wattr_get(win,a,p,opts) ((void)(((a) != (void *)0) ? (*(a) = (win) ? (win)->_attrs : 0) : OK), \ - (void)(((p) != (void *)0) ? (*(p) = (short) ((win) ? PAIR_NUMBER((win)->_attrs) : 0)) : OK), \ + (void)(((p) != (void *)0) ? (*(p) = (NCURSES_PAIRS_T) ((win) ? PAIR_NUMBER((win)->_attrs) : 0)) : OK), \ OK) #endif #endif /* NCURSES_OPAQUE */ diff --git a/include/curses.wide b/include/curses.wide index cb76e2c2..5d130a96 100644 --- a/include/curses.wide +++ b/include/curses.wide @@ -1,4 +1,4 @@ -/* $Id: curses.wide,v 1.45 2012/07/28 18:10:02 tom Exp $ */ +/* $Id: curses.wide,v 1.46 2014/02/01 22:00:32 tom Exp $ */ /* * vile:cmode: * This file is part of ncurses, designed to be appended after curses.h.in @@ -135,7 +135,7 @@ extern NCURSES_EXPORT(int) erasewchar (wchar_t*); /* implemented */ extern NCURSES_EXPORT(int) get_wch (wint_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) get_wstr (wint_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *); /* generated:WIDEC */ -extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, short*, void*); /* implemented */ +extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, NCURSES_PAIRS_T*, void*); /* implemented */ extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) in_wch (cchar_t *); /* generated:WIDEC */ @@ -185,12 +185,12 @@ extern NCURSES_EXPORT(int) mvwins_wstr (WINDOW *, int, int, const wchar_t *); /* extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *); /* implemented */ -extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, short, const void *); /* implemented */ +extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, NCURSES_PAIRS_T, const void *); /* implemented */ extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int); /* implemented */ extern NCURSES_EXPORT(attr_t) term_attrs (void); /* implemented */ extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* implemented */ -extern NCURSES_EXPORT(int) vid_attr (attr_t, short, void *); /* implemented */ -extern NCURSES_EXPORT(int) vid_puts (attr_t, short, void *, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vid_attr (attr_t, NCURSES_PAIRS_T, void *); /* implemented */ +extern NCURSES_EXPORT(int) vid_puts (attr_t, NCURSES_PAIRS_T, void *, NCURSES_OUTC); /* implemented */ extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* implemented */ extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* implemented */ @@ -221,8 +221,8 @@ extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* imple extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(term_attrs) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const wchar_t); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, short, void *); /* implemented:SP_FUNC */ -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, short, void *, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ #endif #ifndef NCURSES_NOMACROS diff --git a/ncurses/base/lib_chgat.c b/ncurses/base/lib_chgat.c index cdddaeae..1eb1f59e 100644 --- a/ncurses/base/lib_chgat.c +++ b/ncurses/base/lib_chgat.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2014 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 * @@ -42,14 +42,22 @@ #include -MODULE_ID("$Id: lib_chgat.c,v 1.9 2010/03/31 23:38:02 tom Exp $") +MODULE_ID("$Id: lib_chgat.c,v 1.10 2014/02/01 22:13:31 tom Exp $") NCURSES_EXPORT(int) -wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED) +wchgat(WINDOW *win, + int n, + attr_t attr, + NCURSES_PAIRS_T color, + const void *opts GCC_UNUSED) { int i; - T((T_CALLED("wchgat(%p,%d,%s,%d)"), (void *) win, n, _traceattr(attr), color)); + T((T_CALLED("wchgat(%p,%d,%s,%d)"), + (void *) win, + n, + _traceattr(attr), + (int) color)); if (win) { struct ldat *line = &(win->_line[win->_cury]); diff --git a/ncurses/base/lib_color.c b/ncurses/base/lib_color.c index 13bc209c..9f7250dd 100644 --- a/ncurses/base/lib_color.c +++ b/ncurses/base/lib_color.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2013,2014 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 * @@ -45,7 +45,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_color.c,v 1.108 2013/03/09 22:33:38 tom Exp $") +MODULE_ID("$Id: lib_color.c,v 1.109 2014/02/01 22:22:30 tom Exp $") #ifdef USE_TERM_DRIVER #define CanChange InfoOf(SP_PARM).canchange @@ -388,7 +388,7 @@ start_color(void) /* This function was originally written by Daniel Weaver */ static void -rgb2hls(int r, int g, int b, short *h, short *l, short *s) +rgb2hls(int r, int g, int b, NCURSES_COLOR_T *h, NCURSES_COLOR_T *l, NCURSES_COLOR_T *s) /* convert RGB to HLS system */ { int min, max, t; @@ -399,7 +399,7 @@ rgb2hls(int r, int g, int b, short *h, short *l, short *s) max = b; /* calculate lightness */ - *l = (short) ((min + max) / 20); + *l = (NCURSES_COLOR_T) ((min + max) / 20); if (min == max) { /* black, white and all shades of gray */ *h = 0; @@ -409,19 +409,19 @@ rgb2hls(int r, int g, int b, short *h, short *l, short *s) /* calculate saturation */ if (*l < 50) - *s = (short) (((max - min) * 100) / (max + min)); + *s = (NCURSES_COLOR_T) (((max - min) * 100) / (max + min)); else - *s = (short) (((max - min) * 100) / (2000 - max - min)); + *s = (NCURSES_COLOR_T) (((max - min) * 100) / (2000 - max - min)); /* calculate hue */ if (r == max) - t = (short) (120 + ((g - b) * 60) / (max - min)); + t = (NCURSES_COLOR_T) (120 + ((g - b) * 60) / (max - min)); else if (g == max) - t = (short) (240 + ((b - r) * 60) / (max - min)); + t = (NCURSES_COLOR_T) (240 + ((b - r) * 60) / (max - min)); else - t = (short) (360 + ((r - g) * 60) / (max - min)); + t = (NCURSES_COLOR_T) (360 + ((r - g) * 60) / (max - min)); - *h = (short) (t % 360); + *h = (NCURSES_COLOR_T) (t % 360); } /* @@ -429,13 +429,20 @@ rgb2hls(int r, int g, int b, short *h, short *l, short *s) * values. */ NCURSES_EXPORT(int) -NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx short pair, short f, short b) +NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx + NCURSES_PAIRS_T pair, + NCURSES_COLOR_T f, + NCURSES_COLOR_T b) { colorpair_t result; colorpair_t previous; int maxcolors; - T((T_CALLED("init_pair(%p,%d,%d,%d)"), (void *) SP_PARM, pair, f, b)); + T((T_CALLED("init_pair(%p,%d,%d,%d)"), + (void *) SP_PARM, + (int) pair, + (int) f, + (int) b)); if (!ValidPair(pair)) returnCode(ERR); @@ -547,15 +554,19 @@ NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx short pair, short f, short b) TR(TRACE_ATTRS, ("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)); + (int) pair, + (int) tp[f].red, (int) tp[f].green, (int) tp[f].blue, + (int) tp[b].red, (int) tp[b].green, (int) tp[b].blue)); NCURSES_PUTP2("initialize_pair", TPARM_7(initialize_pair, pair, - tp[f].red, tp[f].green, tp[f].blue, - tp[b].red, tp[b].green, tp[b].blue)); + (int) tp[f].red, + (int) tp[f].green, + (int) tp[f].blue, + (int) tp[b].red, + (int) tp[b].green, + (int) tp[b].blue)); } #endif @@ -564,7 +575,7 @@ NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx short pair, short f, short b) #if NCURSES_SP_FUNCS NCURSES_EXPORT(int) -init_pair(short pair, short f, short b) +init_pair(NCURSES_COLOR_T pair, NCURSES_COLOR_T f, NCURSES_COLOR_T b) { return NCURSES_SP_NAME(init_pair) (CURRENT_SCREEN, pair, f, b); } @@ -574,7 +585,10 @@ init_pair(short pair, short f, short b) NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (NCURSES_SP_DCLx - short color, short r, short g, short b) + NCURSES_COLOR_T color, + NCURSES_COLOR_T r, + NCURSES_COLOR_T g, + NCURSES_COLOR_T b) { int result = ERR; int maxcolors; @@ -625,7 +639,10 @@ NCURSES_SP_NAME(init_color) (NCURSES_SP_DCLx #if NCURSES_SP_FUNCS NCURSES_EXPORT(int) -init_color(short color, short r, short g, short b) +init_color(NCURSES_COLOR_T color, + NCURSES_COLOR_T r, + NCURSES_COLOR_T g, + NCURSES_COLOR_T b) { return NCURSES_SP_NAME(init_color) (CURRENT_SCREEN, color, r, g, b); } @@ -685,7 +702,10 @@ has_colors(void) NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (NCURSES_SP_DCLx - short color, short *r, short *g, short *b) + NCURSES_COLOR_T color, + NCURSES_COLOR_T *r, + NCURSES_COLOR_T *g, + NCURSES_COLOR_T *b) { int result = ERR; int maxcolors; @@ -725,7 +745,10 @@ NCURSES_SP_NAME(color_content) (NCURSES_SP_DCLx #if NCURSES_SP_FUNCS NCURSES_EXPORT(int) -color_content(short color, short *r, short *g, short *b) +color_content(NCURSES_COLOR_T color, + NCURSES_COLOR_T *r, + NCURSES_COLOR_T *g, + NCURSES_COLOR_T *b) { return NCURSES_SP_NAME(color_content) (CURRENT_SCREEN, color, r, g, b); } @@ -733,13 +756,15 @@ color_content(short color, short *r, short *g, short *b) NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (NCURSES_SP_DCLx - short pair, short *f, short *b) + NCURSES_PAIRS_T pair, + NCURSES_COLOR_T *f, + NCURSES_COLOR_T *b) { int result; T((T_CALLED("pair_content(%p,%d,%p,%p)"), (void *) SP_PARM, - pair, + (int) pair, (void *) f, (void *) b)); @@ -763,8 +788,8 @@ NCURSES_SP_NAME(pair_content) (NCURSES_SP_DCLx TR(TRACE_ATTRS, ("...pair_content(%p,%d,%d,%d)", (void *) SP_PARM, - pair, - fg, bg)); + (int) pair, + (int) fg, (int) bg)); result = OK; } returnCode(result); @@ -772,7 +797,7 @@ NCURSES_SP_NAME(pair_content) (NCURSES_SP_DCLx #if NCURSES_SP_FUNCS NCURSES_EXPORT(int) -pair_content(short pair, short *f, short *b) +pair_content(NCURSES_COLOR_T pair, NCURSES_COLOR_T *f, NCURSES_COLOR_T *b) { return NCURSES_SP_NAME(pair_content) (CURRENT_SCREEN, pair, f, b); } @@ -803,14 +828,14 @@ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx 1, outc); return; } else if (SP_PARM != 0) { - if (pair_content((short) pair, &fg, &bg) == ERR) + if (pair_content((NCURSES_COLOR_T) pair, &fg, &bg) == ERR) return; } } if (old_pair >= 0 && SP_PARM != 0 - && pair_content((short) old_pair, &old_fg, &old_bg) != ERR) { + && pair_content((NCURSES_COLOR_T) old_pair, &old_fg, &old_bg) != ERR) { if ((isDefaultColor(fg) && !isDefaultColor(old_fg)) || (isDefaultColor(bg) && !isDefaultColor(old_bg))) { #if NCURSES_EXT_FUNCS @@ -839,9 +864,9 @@ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx #if NCURSES_EXT_FUNCS if (isDefaultColor(fg)) - fg = (short) default_fg(NCURSES_SP_ARG); + fg = (NCURSES_COLOR_T) default_fg(NCURSES_SP_ARG); if (isDefaultColor(bg)) - bg = (short) default_bg(NCURSES_SP_ARG); + bg = (NCURSES_COLOR_T) default_bg(NCURSES_SP_ARG); #endif if (reverse) { diff --git a/ncurses/base/lib_colorset.c b/ncurses/base/lib_colorset.c index 6210a0e8..e9354860 100644 --- a/ncurses/base/lib_colorset.c +++ b/ncurses/base/lib_colorset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. * + * Copyright (c) 1998-2009,2014 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 * @@ -41,14 +41,14 @@ #include #include -MODULE_ID("$Id: lib_colorset.c,v 1.13 2009/10/24 22:02:14 tom Exp $") +MODULE_ID("$Id: lib_colorset.c,v 1.14 2014/02/01 22:10:42 tom Exp $") NCURSES_EXPORT(int) -wcolor_set(WINDOW *win, short color_pair_number, void *opts) +wcolor_set(WINDOW *win, NCURSES_PAIRS_T color_pair_number, void *opts) { int code = ERR; - T((T_CALLED("wcolor_set(%p,%d)"), (void *) win, color_pair_number)); + T((T_CALLED("wcolor_set(%p,%d)"), (void *) win, (int) color_pair_number)); if (win && !opts && (SP != 0) diff --git a/ncurses/base/lib_instr.c b/ncurses/base/lib_instr.c index 5677b57b..f708ecc5 100644 --- a/ncurses/base/lib_instr.c +++ b/ncurses/base/lib_instr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2013,2014 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 * @@ -41,7 +41,7 @@ #include -MODULE_ID("$Id: lib_instr.c,v 1.20 2013/01/20 01:58:13 tom Exp $") +MODULE_ID("$Id: lib_instr.c,v 1.21 2014/02/01 22:09:27 tom Exp $") NCURSES_EXPORT(int) winnstr(WINDOW *win, char *str, int n) @@ -64,7 +64,7 @@ winnstr(WINDOW *win, char *str, int n) cchar_t *cell = &(win->_line[row].text[col]); wchar_t *wch; attr_t attrs; - short pair; + NCURSES_PAIRS_T pair; int n2; bool done = FALSE; mbstate_t state; diff --git a/ncurses/base/lib_slkatr_set.c b/ncurses/base/lib_slkatr_set.c index bd5f5396..a3132e9c 100644 --- a/ncurses/base/lib_slkatr_set.c +++ b/ncurses/base/lib_slkatr_set.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. * + * Copyright (c) 1998-2009,2014 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 * @@ -38,12 +38,12 @@ */ #include -MODULE_ID("$Id: lib_slkatr_set.c,v 1.14 2009/10/24 22:47:03 tom Exp $") +MODULE_ID("$Id: lib_slkatr_set.c,v 1.15 2014/02/01 22:10:42 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (NCURSES_SP_DCLx const attr_t attr, - short color_pair_number, + NCURSES_PAIRS_T color_pair_number, void *opts) { int code = ERR; @@ -51,7 +51,7 @@ NCURSES_SP_NAME(slk_attr_set) (NCURSES_SP_DCLx T((T_CALLED("slk_attr_set(%p,%s,%d)"), (void *) SP_PARM, _traceattr(attr), - color_pair_number)); + (int) color_pair_number)); if (SP_PARM != 0 && SP_PARM->_slk != 0 @@ -71,7 +71,7 @@ NCURSES_SP_NAME(slk_attr_set) (NCURSES_SP_DCLx #if NCURSES_SP_FUNCS NCURSES_EXPORT(int) -slk_attr_set(const attr_t attr, short color_pair_number, void *opts) +slk_attr_set(const attr_t attr, NCURSES_COLOR_T color_pair_number, void *opts) { return NCURSES_SP_NAME(slk_attr_set) (CURRENT_SCREEN, attr, color_pair_number, opts); diff --git a/ncurses/base/lib_slkcolor.c b/ncurses/base/lib_slkcolor.c index c1211bcb..2cf9e5d7 100644 --- a/ncurses/base/lib_slkcolor.c +++ b/ncurses/base/lib_slkcolor.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. * + * Copyright (c) 1998-2009,2014 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 * @@ -38,14 +38,14 @@ */ #include -MODULE_ID("$Id: lib_slkcolor.c,v 1.16 2009/10/24 22:12:21 tom Exp $") +MODULE_ID("$Id: lib_slkcolor.c,v 1.17 2014/02/01 22:10:42 tom Exp $") NCURSES_EXPORT(int) -NCURSES_SP_NAME(slk_color) (NCURSES_SP_DCLx short color_pair_number) +NCURSES_SP_NAME(slk_color) (NCURSES_SP_DCLx NCURSES_PAIRS_T color_pair_number) { int code = ERR; - T((T_CALLED("slk_color(%p,%d)"), (void *) SP_PARM, color_pair_number)); + T((T_CALLED("slk_color(%p,%d)"), (void *) SP_PARM, (int) color_pair_number)); if (SP_PARM != 0 && SP_PARM->_slk != 0 @@ -61,7 +61,7 @@ NCURSES_SP_NAME(slk_color) (NCURSES_SP_DCLx short color_pair_number) #if NCURSES_SP_FUNCS NCURSES_EXPORT(int) -slk_color(short color_pair_number) +slk_color(NCURSES_PAIRS_T color_pair_number) { return NCURSES_SP_NAME(slk_color) (CURRENT_SCREEN, color_pair_number); } diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index 752110a6..7deffad5 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2013,2014 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 * @@ -34,7 +34,7 @@ ****************************************************************************/ /* - * $Id: curses.priv.h,v 1.529 2013/11/16 19:44:28 tom Exp $ + * $Id: curses.priv.h,v 1.530 2014/02/01 22:09:27 tom Exp $ * * curses.priv.h * @@ -288,14 +288,6 @@ typedef TRIES { * Structure for palette tables */ -typedef struct -{ - short red, green, blue; /* what color_content() returns */ - short r, g, b; /* params to init_color() */ - int init; /* true if we called init_color() */ -} -color_t; - #define MAXCOLUMNS 135 #define MAXLINES 66 #define FIFO_SIZE MAXCOLUMNS+2 /* for nocbreak mode input */ @@ -320,6 +312,14 @@ color_t; #include /* we'll use -Ipath directive to get the right one! */ +typedef struct +{ + NCURSES_COLOR_T red, green, blue; /* what color_content() returns */ + NCURSES_COLOR_T r, g, b; /* params to init_color() */ + int init; /* true if we called init_color() */ +} +color_t; + /* * If curses.h did not expose the SCREEN-functions, then we do not need the * parameter in the corresponding unextended functions. @@ -2400,7 +2400,7 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_set_tty_mode)(SCREEN*, TTY*) extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_setupscreen)(SCREEN**, int, int, FILE *, int, int); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tgetent)(SCREEN*,char*,const char *); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tigetnum)(SCREEN*,NCURSES_CONST char*); -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vid_attr)(SCREEN *, attr_t, short, void *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vid_attr)(SCREEN *, attr_t, NCURSES_COLOR_T, void *); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vidputs)(SCREEN*,chtype,int(*) (SCREEN*, int)); extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_color)(SCREEN*, int, int, int, NCURSES_SP_OUTC); extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_xmc_glitch)(SCREEN*, attr_t); diff --git a/ncurses/trace/lib_traceatr.c b/ncurses/trace/lib_traceatr.c index d1c0de40..5fb0df95 100644 --- a/ncurses/trace/lib_traceatr.c +++ b/ncurses/trace/lib_traceatr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2013,2014 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 * @@ -43,7 +43,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_traceatr.c,v 1.80 2013/08/31 13:33:06 tom Exp $") +MODULE_ID("$Id: lib_traceatr.c,v 1.81 2014/02/01 22:09:27 tom Exp $") #define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name)) @@ -151,7 +151,7 @@ _traceattr2(int bufnum, chtype newmode) _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "{%d}", pairnum); #else - short fg, bg; + NCURSES_COLOR_T fg, bg; if (pair_content(pairnum, &fg, &bg) == OK) { _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) diff --git a/ncurses/tty/tty_update.c b/ncurses/tty/tty_update.c index 3addd02e..8a110ee9 100644 --- a/ncurses/tty/tty_update.c +++ b/ncurses/tty/tty_update.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2013,2014 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 * @@ -82,7 +82,7 @@ #include -MODULE_ID("$Id: tty_update.c,v 1.276 2013/02/16 21:12:02 tom Exp $") +MODULE_ID("$Id: tty_update.c,v 1.277 2014/02/01 22:09:27 tom Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -490,7 +490,7 @@ can_clear_with(NCURSES_SP_DCLx ARG_CH_T ch) if (SP_PARM->_default_fg != C_MASK || SP_PARM->_default_bg != C_MASK) return FALSE; if ((pair = GetPair(CHDEREF(ch))) != 0) { - short fg, bg; + NCURSES_COLOR_T fg, bg; if (NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx (short) pair, &fg, &bg) == ERR diff --git a/ncurses/widechar/lib_cchar.c b/ncurses/widechar/lib_cchar.c index 679dd717..654bebb4 100644 --- a/ncurses/widechar/lib_cchar.c +++ b/ncurses/widechar/lib_cchar.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2001-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 2001-2012,2014 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 * @@ -35,7 +35,7 @@ #include -MODULE_ID("$Id: lib_cchar.c,v 1.26 2012/03/24 18:37:17 tom Exp $") +MODULE_ID("$Id: lib_cchar.c,v 1.27 2014/02/01 22:10:42 tom Exp $") /* * The SuSv2 description leaves some room for interpretation. We'll assume wch @@ -47,7 +47,7 @@ NCURSES_EXPORT(int) setcchar(cchar_t *wcval, const wchar_t *wch, const attr_t attrs, - short color_pair, + NCURSES_PAIRS_T color_pair, const void *opts) { unsigned i; @@ -56,7 +56,7 @@ setcchar(cchar_t *wcval, TR(TRACE_CCALLS, (T_CALLED("setcchar(%p,%s,%lu,%d,%p)"), (void *) wcval, _nc_viswbuf(wch), - (unsigned long) attrs, color_pair, opts)); + (unsigned long) attrs, (int) color_pair, opts)); if (opts != NULL || wch == NULL @@ -96,7 +96,7 @@ NCURSES_EXPORT(int) getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs, - short *color_pair, + NCURSES_PAIRS_T *color_pair, void *opts) { wchar_t *wp; @@ -125,7 +125,7 @@ getcchar(const cchar_t *wcval, code = ERR; } else if (len >= 0) { *attrs = AttrOf(*wcval) & A_ATTRIBUTES; - *color_pair = (short) GetPair(*wcval); + *color_pair = (NCURSES_PAIRS_T) GetPair(*wcval); wmemcpy(wch, wcval->chars, (size_t) len); wch[len] = L'\0'; code = OK; diff --git a/ncurses/widechar/lib_vid_attr.c b/ncurses/widechar/lib_vid_attr.c index 5034a42f..0be2b195 100644 --- a/ncurses/widechar/lib_vid_attr.c +++ b/ncurses/widechar/lib_vid_attr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 2002-2013,2014 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 * @@ -36,7 +36,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_vid_attr.c,v 1.21 2013/08/31 20:09:12 tom Exp $") +MODULE_ID("$Id: lib_vid_attr.c,v 1.22 2014/02/01 22:09:27 tom Exp $") #define doPut(mode) \ TPUTS_TRACE(#mode); \ @@ -68,7 +68,7 @@ MODULE_ID("$Id: lib_vid_attr.c,v 1.21 2013/08/31 20:09:12 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (NCURSES_SP_DCLx attr_t newmode, - short pair, + NCURSES_PAIRS_T pair, void *opts GCC_UNUSED, NCURSES_SP_OUTC outc) { @@ -267,7 +267,7 @@ NCURSES_SP_NAME(vid_puts) (NCURSES_SP_DCLx returnCode(OK); #else - T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair)); + T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), (int) pair)); set_color(newmode, pair); returnCode(NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx newmode, outc)); #endif @@ -276,7 +276,7 @@ NCURSES_SP_NAME(vid_puts) (NCURSES_SP_DCLx #if NCURSES_SP_FUNCS NCURSES_EXPORT(int) vid_puts(attr_t newmode, - short pair, + NCURSES_PAIRS_T pair, void *opts GCC_UNUSED, NCURSES_OUTC outc) { @@ -293,10 +293,10 @@ vid_puts(attr_t newmode, NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (NCURSES_SP_DCLx attr_t newmode, - short pair, + NCURSES_PAIRS_T pair, void *opts) { - T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), pair)); + T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), (int) pair)); returnCode(NCURSES_SP_NAME(vid_puts) (NCURSES_SP_ARGx newmode, pair, @@ -306,7 +306,7 @@ NCURSES_SP_NAME(vid_attr) (NCURSES_SP_DCLx #if NCURSES_SP_FUNCS NCURSES_EXPORT(int) -vid_attr(attr_t newmode, short pair, void *opts) +vid_attr(attr_t newmode, NCURSES_PAIRS_T pair, void *opts) { return NCURSES_SP_NAME(vid_attr) (CURRENT_SCREEN, newmode, pair, opts); } diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index 54b1b7e0..d863cb90 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (5.9-20140125) unstable; urgency=low +ncurses6 (5.9-20140201) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 25 Jan 2014 11:16:43 -0500 + -- Thomas E. Dickey Sat, 01 Feb 2014 12:10:27 -0500 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index 54b1b7e0..d863cb90 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (5.9-20140125) unstable; urgency=low +ncurses6 (5.9-20140201) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 25 Jan 2014 11:16:43 -0500 + -- Thomas E. Dickey Sat, 01 Feb 2014 12:10:27 -0500 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index c53aab3e..473e7bd5 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (5.9-20140125) unstable; urgency=low +ncurses6 (5.9-20140201) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 25 Jan 2014 11:16:43 -0500 + -- Thomas E. Dickey Sat, 01 Feb 2014 12:10:27 -0500 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index cace7bd0..ad6ea01f 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.22 2014/01/25 16:16:43 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.23 2014/02/01 17:10:27 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "5" !define VERSION_MINOR "9" !define VERSION_YYYY "2014" -!define VERSION_MMDD "125" +!define VERSION_MMDD "201" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index d62fc9cf..12d658dc 100644 --- a/package/mingw-ncurses.spec +++ b/package/mingw-ncurses.spec @@ -3,7 +3,7 @@ Summary: shared libraries for terminal handling Name: mingw32-ncurses6 Version: 5.9 -Release: 20140125 +Release: 20140201 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncurses.spec b/package/ncurses.spec index ae8cd714..5025aa35 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 5.9 -Release: 20140125 +Release: 20140201 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/progs/infocmp.c b/progs/infocmp.c index d52d05a6..587cbc34 100644 --- a/progs/infocmp.c +++ b/progs/infocmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2013,2014 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 * @@ -42,7 +42,7 @@ #include -MODULE_ID("$Id: infocmp.c,v 1.128 2013/12/15 01:06:52 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.129 2014/02/01 22:11:03 tom Exp $") #define L_CURL "{" #define R_CURL "}" @@ -858,7 +858,7 @@ analyze_string(const char *name, const char *cap, TERMTYPE *tp) /* now check for standard-mode sequences */ if (!expansion && (csi = skip_csi(sp)) != 0 - && (len = strspn(sp + csi, "0123456789;")) + && (len = (strspn) (sp + csi, "0123456789;")) && (len < sizeof(buf3)) && (next = (size_t) csi + len) && ((sp[next] == 'h') || (sp[next] == 'l'))) { @@ -879,7 +879,7 @@ analyze_string(const char *name, const char *cap, TERMTYPE *tp) if (!expansion && (csi = skip_csi(sp)) != 0 && sp[csi] == '?' - && (len = strspn(sp + csi + 1, "0123456789;")) + && (len = (strspn) (sp + csi + 1, "0123456789;")) && (len < sizeof(buf3)) && (next = (size_t) csi + 1 + len) && ((sp[next] == 'h') || (sp[next] == 'l'))) { @@ -899,7 +899,7 @@ analyze_string(const char *name, const char *cap, TERMTYPE *tp) /* now check for ECMA highlight sequences */ if (!expansion && (csi = skip_csi(sp)) != 0 - && (len = strspn(sp + csi, "0123456789;")) != 0 + && (len = (strspn) (sp + csi, "0123456789;")) != 0 && (len < sizeof(buf3)) && (next = (size_t) csi + len) && sp[next] == 'm') { diff --git a/test/background.c b/test/background.c index 356c9a61..6c5ad996 100644 --- a/test/background.c +++ b/test/background.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2003-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 2003-2012,2014 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 * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: background.c,v 1.13 2012/06/09 20:30:33 tom Exp $ + * $Id: background.c,v 1.14 2014/02/01 22:10:42 tom Exp $ */ #define NEED_COLOR_CODE 1 @@ -39,31 +39,31 @@ static int default_fg = COLOR_WHITE; static void test_background(void) { - short f, b; + NCURSES_COLOR_T f, b; int row; int chr; if (pair_content(0, &f, &b) == ERR) { printw("pair 0 contains no data\n"); } else { - printw("pair 0 contains (%d,%d)\n", f, b); + printw("pair 0 contains (%d,%d)\n", (int) f, (int) b); } getch(); printw("Initializing pair 1 to red/%s\n", color_name(default_bg)); - init_pair(1, COLOR_RED, (short) default_bg); + init_pair(1, COLOR_RED, (NCURSES_COLOR_T) default_bg); bkgdset((chtype) (' ' | COLOR_PAIR(1))); printw("RED/BLACK\n"); getch(); printw("Initializing pair 2 to %s/blue\n", color_name(default_fg)); - init_pair(2, (short) default_fg, COLOR_BLUE); + init_pair(2, (NCURSES_COLOR_T) default_fg, COLOR_BLUE); bkgdset((chtype) (' ' | COLOR_PAIR(2))); printw("This line should be %s/blue\n", color_name(default_fg)); getch(); printw("Initializing pair 3 to %s/cyan (ACS_HLINE)\n", color_name(default_fg)); - init_pair(3, (short) default_fg, COLOR_CYAN); + init_pair(3, (NCURSES_COLOR_T) default_fg, COLOR_CYAN); printw("...and drawing a box which should be followed by lines\n"); bkgdset(ACS_HLINE | COLOR_PAIR(3)); /* diff --git a/test/color_set.c b/test/color_set.c index 041e6fd7..477d049c 100644 --- a/test/color_set.c +++ b/test/color_set.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2003-2008,2012 Free Software Foundation, Inc. * + * Copyright (c) 2003-2012,2014 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 * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: color_set.c,v 1.7 2012/12/15 22:04:14 tom Exp $ + * $Id: color_set.c,v 1.8 2014/02/01 22:10:42 tom Exp $ */ #include @@ -38,7 +38,7 @@ int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - short f, b; + NCURSES_COLOR_T f, b; int i; initscr(); @@ -49,7 +49,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) start_color(); (void) pair_content(0, &f, &b); - printw("pair 0 contains (%d,%d)\n", f, b); + printw("pair 0 contains (%d,%d)\n", (int) f, (int) b); getch(); printw("Initializing pair 1 to red/black\n"); diff --git a/test/form_driver_w.c b/test/form_driver_w.c index 276209f4..f1ebf625 100644 --- a/test/form_driver_w.c +++ b/test/form_driver_w.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2013 Free Software Foundation, Inc. * + * Copyright (c) 2013,2014 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 * @@ -31,7 +31,7 @@ ****************************************************************************/ /* - * $Id: form_driver_w.c,v 1.9 2013/12/07 20:35:54 tom Exp $ + * $Id: form_driver_w.c,v 1.10 2014/02/01 20:49:39 Gaute.Hope Exp $ * * Test form_driver_w (int, int, wchar_t), a wide char aware * replacement of form_driver. @@ -101,22 +101,17 @@ main(void) switch (ch) { case KEY_DOWN: /* Go to next field */ - form_driver(my_form, REQ_NEXT_FIELD); + form_driver_w(my_form, KEY_CODE_YES, REQ_NEXT_FIELD); /* Go to the end of the present buffer */ /* Leaves nicely at the last character */ - form_driver(my_form, REQ_END_LINE); + form_driver_w(my_form, KEY_CODE_YES, REQ_END_LINE); break; case KEY_UP: /* Go to previous field */ - form_driver(my_form, REQ_PREV_FIELD); - form_driver(my_form, REQ_END_LINE); + form_driver_w(my_form, KEY_CODE_YES, REQ_PREV_FIELD); + form_driver_w(my_form, KEY_CODE_YES, REQ_END_LINE); break; default: -#if 0 - /* If this is a normal character, it gets printed */ - form_driver(my_form, ch); - wadd_wch(my_form->current->working, ch); -#endif break; } break; diff --git a/test/ncurses.c b/test/ncurses.c index cb806673..40d8ac46 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2013,2014 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 * @@ -40,7 +40,7 @@ AUTHOR Author: Eric S. Raymond 1993 Thomas E. Dickey (beginning revision 1.27 in 1996). -$Id: ncurses.c,v 1.396 2013/11/23 21:43:51 tom Exp $ +$Id: ncurses.c,v 1.397 2014/02/01 22:29:37 tom Exp $ ***************************************************************************/ @@ -157,9 +157,9 @@ static bool use_colors; /* true if we use colors */ static int max_pairs; /* ...and the number of color pairs */ typedef struct { - short red; - short green; - short blue; + NCURSES_COLOR_T red; + NCURSES_COLOR_T green; + NCURSES_COLOR_T blue; } RGB_DATA; static RGB_DATA *all_colors; @@ -1301,29 +1301,29 @@ show_color_attr(int fg, int bg, int tx) } static bool -cycle_color_attr(int ch, short *fg, short *bg, short *tx) +cycle_color_attr(int ch, NCURSES_COLOR_T *fg, NCURSES_COLOR_T *bg, NCURSES_COLOR_T *tx) { bool error = FALSE; if (use_colors) { switch (ch) { case 'f': - *fg = (short) (*fg + 1); + *fg = (NCURSES_COLOR_T) (*fg + 1); break; case 'F': - *fg = (short) (*fg - 1); + *fg = (NCURSES_COLOR_T) (*fg - 1); break; case 'b': - *bg = (short) (*bg + 1); + *bg = (NCURSES_COLOR_T) (*bg + 1); break; case 'B': - *bg = (short) (*bg - 1); + *bg = (NCURSES_COLOR_T) (*bg - 1); break; case 't': - *tx = (short) (*tx + 1); + *tx = (NCURSES_COLOR_T) (*tx + 1); break; case 'T': - *tx = (short) (*tx - 1); + *tx = (NCURSES_COLOR_T) (*tx - 1); break; default: beep(); @@ -1331,17 +1331,17 @@ cycle_color_attr(int ch, short *fg, short *bg, short *tx) break; } if (*fg >= COLORS) - *fg = (short) min_colors; + *fg = (NCURSES_COLOR_T) min_colors; if (*fg < min_colors) - *fg = (short) (COLORS - 1); + *fg = (NCURSES_COLOR_T) (COLORS - 1); if (*bg >= COLORS) - *bg = (short) min_colors; + *bg = (NCURSES_COLOR_T) min_colors; if (*bg < min_colors) - *bg = (short) (COLORS - 1); + *bg = (NCURSES_COLOR_T) (COLORS - 1); if (*tx >= COLORS) *tx = -1; if (*tx < -1) - *tx = (short) (COLORS - 1); + *tx = (NCURSES_COLOR_T) (COLORS - 1); } else { beep(); error = TRUE; @@ -1493,7 +1493,13 @@ init_attr_list(ATTR_TBL * target, attr_t attrs) } static bool -attr_getc(int *skip, short *fg, short *bg, short *tx, int *ac, unsigned *kc, unsigned limit) +attr_getc(int *skip, + NCURSES_COLOR_T *fg, + NCURSES_COLOR_T *bg, + NCURSES_COLOR_T *tx, + int *ac, + unsigned *kc, + unsigned limit) { bool result = TRUE; bool error = FALSE; @@ -1559,9 +1565,9 @@ attr_test(void) { int n; int skip = get_xmc(); - short fg = COLOR_BLACK; /* color pair 0 is special */ - short bg = COLOR_BLACK; - short tx = -1; + NCURSES_COLOR_T fg = COLOR_BLACK; /* color pair 0 is special */ + NCURSES_COLOR_T bg = COLOR_BLACK; + NCURSES_COLOR_T tx = -1; int ac = 0; unsigned j, k; ATTR_TBL my_list[SIZEOF(attrs_to_test)]; @@ -1581,8 +1587,8 @@ attr_test(void) chtype extras = (chtype) ac; if (use_colors) { - short pair = (short) (fg != COLOR_BLACK || bg != COLOR_BLACK); - if (pair != 0) { + NCURSES_PAIRS_T pair = 0; + if ((fg != COLOR_BLACK) || (bg != COLOR_BLACK)) { pair = 1; if (init_pair(pair, fg, bg) == ERR) { beep(); @@ -1668,7 +1674,7 @@ wide_init_attr_string(void) } static void -set_wide_background(short pair) +set_wide_background(NCURSES_PAIRS_T pair) { cchar_t normal; wchar_t blank[2]; @@ -1686,7 +1692,7 @@ get_wide_background(void) attr_t result = A_NORMAL; attr_t attr; cchar_t ch; - short pair; + NCURSES_PAIRS_T pair; wchar_t wch[10]; memset(&ch, 0, sizeof(ch)); @@ -1699,7 +1705,12 @@ get_wide_background(void) } static int -wide_show_attr(int row, int skip, bool arrow, chtype attr, short pair, const char *name) +wide_show_attr(int row, + int skip, + bool arrow, + chtype attr, + NCURSES_PAIRS_T pair, + const char *name) { int ncv = get_ncv(); chtype test = attr & ~WA_ALTCHARSET; @@ -1729,7 +1740,7 @@ wide_show_attr(int row, int skip, bool arrow, chtype attr, short pair, const cha } } else { attr_t old_attr = 0; - short old_pair = 0; + NCURSES_PAIRS_T old_pair = 0; (void) (attr_get) (&old_attr, &old_pair, 0); (void) attr_set(attr, pair, 0); @@ -1777,8 +1788,8 @@ wide_show_attr(int row, int skip, bool arrow, chtype attr, short pair, const cha static bool wide_attr_getc(int *skip, - short *fg, short *bg, - short *tx, int *ac, + NCURSES_COLOR_T *fg, NCURSES_COLOR_T *bg, + NCURSES_COLOR_T *tx, int *ac, unsigned *kc, unsigned limit) { bool result = TRUE; @@ -1845,9 +1856,9 @@ wide_attr_test(void) { int n; int skip = get_xmc(); - short fg = COLOR_BLACK; /* color pair 0 is special */ - short bg = COLOR_BLACK; - short tx = -1; + NCURSES_COLOR_T fg = COLOR_BLACK; /* color pair 0 is special */ + NCURSES_COLOR_T bg = COLOR_BLACK; + NCURSES_COLOR_T tx = -1; int ac = 0; unsigned j, k; ATTR_TBL my_list[SIZEOF(attrs_to_test)]; @@ -1863,11 +1874,11 @@ wide_attr_test(void) do { int row = 2; - short pair = 0; - short extras = 0; + NCURSES_PAIRS_T pair = 0; + NCURSES_PAIRS_T extras = 0; if (use_colors) { - pair = (short) (fg != COLOR_BLACK || bg != COLOR_BLACK); + pair = (NCURSES_PAIRS_T) (fg != COLOR_BLACK || bg != COLOR_BLACK); if (pair != 0) { pair = 1; if (init_pair(pair, fg, bg) == ERR) { @@ -2011,7 +2022,7 @@ color_legend(WINDOW *helpwin, bool wide) static void color_test(void) { - short i; + NCURSES_PAIRS_T i; int top = 0, width; int base_row = 0; int grid_top = top + 3; @@ -2072,16 +2083,16 @@ color_test(void) show_color_name(top + 2, (i + 1) * width, i + min_colors, opt_wide); /* show a grid of colors, with color names/ numbers on the left */ - for (i = (short) (base_row * per_row); i < pairs_max; i++) { + for (i = (NCURSES_PAIRS_T) (base_row * per_row); i < pairs_max; i++) { int row = grid_top + (i / per_row) - base_row; int col = (i % per_row + 1) * width; - short pair = i; + NCURSES_PAIRS_T pair = i; -#define InxToFG(i) (short) ((i % (COLORS - min_colors)) + min_colors) -#define InxToBG(i) (short) ((i / (COLORS - min_colors)) + min_colors) +#define InxToFG(i) (NCURSES_COLOR_T) ((i % (COLORS - min_colors)) + min_colors) +#define InxToBG(i) (NCURSES_COLOR_T) ((i / (COLORS - min_colors)) + min_colors) if (row >= 0 && move(row, col) != ERR) { - short fg = InxToFG(i); - short bg = InxToBG(i); + NCURSES_COLOR_T fg = InxToFG(i); + NCURSES_COLOR_T bg = InxToBG(i); init_pair(pair, fg, bg); attron((attr_t) COLOR_PAIR(pair)); @@ -2093,7 +2104,7 @@ color_test(void) attron((attr_t) A_REVERSE); if (opt_nums) { - sprintf(numbered, "{%02X}", i); + sprintf(numbered, "{%02X}", (int) i); hello = numbered; } printw("%-*.*s", width, width, hello); @@ -2278,7 +2289,7 @@ wide_color_test(void) for (i = (base_row * per_row); i < pairs_max; i++) { int row = grid_top + (i / per_row) - base_row; int col = (i % per_row + 1) * width; - short pair = (short) i; + NCURSES_PAIRS_T pair = (NCURSES_PAIRS_T) i; if (row >= 0 && move(row, col) != ERR) { init_pair(pair, InxToFG(i), InxToBG(i)); @@ -2409,21 +2420,21 @@ wide_color_test(void) #endif /* USE_WIDEC_SUPPORT */ static void -change_color(short current, int field, int value, int usebase) +change_color(NCURSES_PAIRS_T current, int field, int value, int usebase) { - short red, green, blue; + NCURSES_COLOR_T red, green, blue; color_content(current, &red, &green, &blue); switch (field) { case 0: - red = (short) (usebase ? (red + value) : value); + red = (NCURSES_COLOR_T) (usebase ? (red + value) : value); break; case 1: - green = (short) (usebase ? (green + value) : value); + green = (NCURSES_COLOR_T) (usebase ? (green + value) : value); break; case 2: - blue = (short) (usebase ? (blue + value) : value); + blue = (NCURSES_COLOR_T) (usebase ? (blue + value) : value); break; } @@ -2434,7 +2445,7 @@ change_color(short current, int field, int value, int usebase) static void init_all_colors(void) { - short c; + NCURSES_PAIRS_T c; for (c = 0; c < COLORS; ++c) init_color(c, @@ -2460,18 +2471,20 @@ color_edit(void) refresh(); for (i = 0; i < max_colors; i++) - init_pair((short) i, (short) COLOR_WHITE, (short) i); + init_pair((NCURSES_PAIRS_T) i, + (NCURSES_COLOR_T) COLOR_WHITE, + (NCURSES_COLOR_T) i); MvPrintw(LINES - 2, 0, "Number: %d", value); do { - short red, green, blue; + NCURSES_COLOR_T red, green, blue; attron(A_BOLD); MvAddStr(0, 20, "Color RGB Value Editing"); attroff(A_BOLD); - for (i = (short) top_color; + for (i = (NCURSES_COLOR_T) top_color; (i - top_color < page_size) && (i < max_colors); i++) { char numeric[80]; @@ -2485,30 +2498,30 @@ color_edit(void) addstr(" "); (void) attrset(A_NORMAL); - color_content((short) i, &red, &green, &blue); + color_content((NCURSES_PAIRS_T) i, &red, &green, &blue); addstr(" R = "); if (current == i && field == 0) attron(A_STANDOUT); - printw("%04d", red); + printw("%04d", (int) red); if (current == i && field == 0) (void) attrset(A_NORMAL); addstr(", G = "); if (current == i && field == 1) attron(A_STANDOUT); - printw("%04d", green); + printw("%04d", (int) green); if (current == i && field == 1) (void) attrset(A_NORMAL); addstr(", B = "); if (current == i && field == 2) attron(A_STANDOUT); - printw("%04d", blue); + printw("%04d", (int) blue); if (current == i && field == 2) (void) attrset(A_NORMAL); (void) attrset(A_NORMAL); printw(" ( %3d %3d %3d )", - scaled_rgb(red), - scaled_rgb(green), - scaled_rgb(blue)); + (int) scaled_rgb(red), + (int) scaled_rgb(green), + (int) scaled_rgb(blue)); } MvAddStr(LINES - 3, 0, @@ -2572,15 +2585,15 @@ color_edit(void) break; case '+': - change_color((short) current, field, value, 1); + change_color((NCURSES_PAIRS_T) current, field, value, 1); break; case '-': - change_color((short) current, field, -value, 1); + change_color((NCURSES_PAIRS_T) current, field, -value, 1); break; case '=': - change_color((short) current, field, value, 0); + change_color((NCURSES_PAIRS_T) current, field, value, 0); break; case '?': @@ -2607,7 +2620,9 @@ color_edit(void) endwin(); main_menu(FALSE); for (i = 0; i < max_colors; i++) - init_pair((short) i, (short) COLOR_WHITE, (short) i); + init_pair((NCURSES_PAIRS_T) i, + (NCURSES_COLOR_T) COLOR_WHITE, + (NCURSES_COLOR_T) i); refresh(); break; @@ -2674,7 +2689,7 @@ cycle_attr(int ch, unsigned *at_code, chtype *attr, ATTR_TBL * list, unsigned li } static bool -cycle_colors(int ch, int *fg, int *bg, short *pair) +cycle_colors(int ch, int *fg, int *bg, NCURSES_PAIRS_T *pair) { bool result = FALSE; @@ -2702,10 +2717,12 @@ cycle_colors(int ch, int *fg, int *bg, short *pair) break; } if (result) { - *pair = (short) (*fg != COLOR_BLACK || *bg != COLOR_BLACK); + *pair = (NCURSES_PAIRS_T) (*fg != COLOR_BLACK || *bg != COLOR_BLACK); if (*pair != 0) { *pair = 1; - if (init_pair(*pair, (short) *fg, (short) *bg) == ERR) { + if (init_pair(*pair, + (NCURSES_COLOR_T) *fg, + (NCURSES_COLOR_T) *bg) == ERR) { result = FALSE; } } @@ -2764,7 +2781,7 @@ slk_help(void) static void call_slk_color(int fg, int bg) { - init_pair(1, (short) bg, (short) fg); + init_pair(1, (NCURSES_COLOR_T) bg, (NCURSES_COLOR_T) fg); slk_color(1); MvPrintw(SLK_WORK, 0, "Colors %d/%d\n", fg, bg); clrtoeol(); @@ -2786,7 +2803,7 @@ slk_test(void) #if HAVE_SLK_COLOR int fg = COLOR_BLACK; int bg = COLOR_WHITE; - short pair = 0; + NCURSES_PAIRS_T pair = 0; #endif ATTR_TBL my_list[SIZEOF(attrs_to_test)]; unsigned my_size = init_attr_list(my_list, termattrs()); @@ -2910,7 +2927,7 @@ wide_slk_test(void) unsigned at_code = 0; int fg = COLOR_BLACK; int bg = COLOR_WHITE; - short pair = 0; + NCURSES_PAIRS_T pair = 0; ATTR_TBL my_list[SIZEOF(attrs_to_test)]; unsigned my_size = init_attr_list(my_list, term_attrs()); @@ -3008,13 +3025,13 @@ wide_slk_test(void) case 'F': if (use_colors) { - fg = (short) ((fg + 1) % COLORS); + fg = (NCURSES_COLOR_T) ((fg + 1) % COLORS); call_slk_color(fg, bg); } break; case 'B': if (use_colors) { - bg = (short) ((bg + 1) % COLORS); + bg = (NCURSES_COLOR_T) ((bg + 1) % COLORS); call_slk_color(fg, bg); } break; @@ -3025,7 +3042,7 @@ wide_slk_test(void) #endif default: if (cycle_attr(c, &at_code, &attr, my_list, my_size)) { - slk_attr_set(attr, (short) (fg || bg), NULL); + slk_attr_set(attr, (NCURSES_COLOR_T) (fg || bg), NULL); slk_touch(); slk_noutrefresh(); break; @@ -3054,7 +3071,7 @@ wide_slk_test(void) #endif /* SLK_INIT */ static void -show_256_chars(int repeat, attr_t attr, short pair) +show_256_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) { unsigned first = 0; unsigned last = 255; @@ -3087,7 +3104,7 @@ show_256_chars(int repeat, attr_t attr, short pair) * terminal to perform functions. The remaining codes can be graphic. */ static void -show_upper_chars(int base, int pagesize, int repeat, attr_t attr, short pair) +show_upper_chars(int base, int pagesize, int repeat, attr_t attr, NCURSES_PAIRS_T pair) { unsigned code; unsigned first = (unsigned) base; @@ -3129,7 +3146,7 @@ show_upper_chars(int base, int pagesize, int repeat, attr_t attr, short pair) #define PC_COLS 4 static void -show_pc_chars(int repeat, attr_t attr, short pair) +show_pc_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) { unsigned code; @@ -3170,7 +3187,7 @@ show_pc_chars(int repeat, attr_t attr, short pair) } static void -show_box_chars(int repeat, attr_t attr, short pair) +show_box_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) { (void) repeat; @@ -3217,7 +3234,7 @@ show_1_acs(int n, int repeat, const char *name, chtype code) } static void -show_acs_chars(int repeat, attr_t attr, short pair) +show_acs_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) /* display the ACS character set */ { int n; @@ -3290,8 +3307,8 @@ acs_display(void) int fg = COLOR_BLACK; int bg = COLOR_BLACK; unsigned at_code = 0; - short pair = 0; - void (*last_show_acs) (int, attr_t, short) = 0; + NCURSES_PAIRS_T pair = 0; + void (*last_show_acs) (int, attr_t, NCURSES_PAIRS_T) = 0; ATTR_TBL my_list[SIZEOF(attrs_to_test)]; unsigned my_size = init_attr_list(my_list, termattrs()); @@ -3392,7 +3409,7 @@ acs_display(void) #if USE_WIDEC_SUPPORT static cchar_t * -merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, short pair) +merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, NCURSES_PAIRS_T pair) { int count; @@ -3421,7 +3438,7 @@ show_paged_widechars(int base, int repeat, int space, attr_t attr, - short pair) + NCURSES_PAIRS_T pair) { int first = base * pagesize; int last = first + pagesize - 1; @@ -3457,7 +3474,7 @@ show_paged_widechars(int base, } static void -show_upper_widechars(int first, int repeat, int space, attr_t attr, short pair) +show_upper_widechars(int first, int repeat, int space, attr_t attr, NCURSES_PAIRS_T pair) { cchar_t temp; wchar_t code; @@ -3530,7 +3547,7 @@ show_1_wacs(int n, int repeat, const char *name, const cchar_t *code) #define MERGE_ATTR(wch) merge_wide_attr(&temp, wch, attr, pair) static void -show_wacs_chars(int repeat, attr_t attr, short pair) +show_wacs_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) /* display the wide-ACS character set */ { cchar_t temp; @@ -3590,7 +3607,7 @@ show_wacs_chars(int repeat, attr_t attr, short pair) #ifdef WACS_D_PLUS static void -show_wacs_chars_double(int repeat, attr_t attr, short pair) +show_wacs_chars_double(int repeat, attr_t attr, NCURSES_PAIRS_T pair) /* display the wide-ACS character set */ { cchar_t temp; @@ -3651,7 +3668,7 @@ show_wacs_chars_double(int repeat, attr_t attr, short pair) #ifdef WACS_T_PLUS static void -show_wacs_chars_thick(int repeat, attr_t attr, short pair) +show_wacs_chars_thick(int repeat, attr_t attr, NCURSES_PAIRS_T pair) /* display the wide-ACS character set */ { cchar_t temp; @@ -3715,7 +3732,7 @@ show_wacs_chars_thick(int repeat, attr_t attr, short pair) #define MERGE_ATTR(n,wch) merge_wide_attr(&temp[n], wch, attr, pair) static void -show_wbox_chars(int repeat, attr_t attr, short pair) +show_wbox_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) { cchar_t temp[8]; @@ -3750,7 +3767,7 @@ show_wbox_chars(int repeat, attr_t attr, short pair) #undef MERGE_ATTR static int -show_2_wacs(int n, const char *name, const char *code, attr_t attr, short pair) +show_2_wacs(int n, const char *name, const char *code, attr_t attr, NCURSES_PAIRS_T pair) { const int height = 16; int row = 2 + (n % height); @@ -3767,7 +3784,7 @@ show_2_wacs(int n, const char *name, const char *code, attr_t attr, short pair) #define SHOW_UTF8(n, name, code) show_2_wacs(n, name, code, attr, pair) static void -show_utf8_chars(int repeat, attr_t attr, short pair) +show_utf8_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) { int n; @@ -3832,8 +3849,8 @@ wide_acs_display(void) int fg = COLOR_BLACK; int bg = COLOR_BLACK; unsigned at_code = 0; - short pair = 0; - void (*last_show_wacs) (int, attr_t, short) = 0; + NCURSES_PAIRS_T pair = 0; + void (*last_show_wacs) (int, attr_t, NCURSES_PAIRS_T) = 0; ATTR_TBL my_list[SIZEOF(attrs_to_test)]; unsigned my_size = init_attr_list(my_list, term_attrs()); @@ -4632,7 +4649,7 @@ saywhat(NCURSES_CONST char *text) mkpanel(rows,cols,tly,tlx) - alloc a win and panel and associate them --------------------------------------------------------------------------*/ static PANEL * -mkpanel(short color, int rows, int cols, int tly, int tlx) +mkpanel(NCURSES_COLOR_T color, int rows, int cols, int tly, int tlx) { WINDOW *win; PANEL *pan = 0; @@ -4641,8 +4658,10 @@ mkpanel(short color, int rows, int cols, int tly, int tlx) if ((pan = new_panel(win)) == 0) { delwin(win); } else if (use_colors) { - short fg = (short) ((color == COLOR_BLUE) ? COLOR_WHITE : COLOR_BLACK); - short bg = color; + NCURSES_COLOR_T fg = (NCURSES_COLOR_T) ((color == COLOR_BLUE) + ? COLOR_WHITE + : COLOR_BLACK); + NCURSES_COLOR_T bg = color; init_pair(color, fg, bg); wbkgdset(win, (attr_t) (COLOR_PAIR(color) | ' ')); @@ -6220,7 +6239,7 @@ overlap_helpitem(int state, int item, char *message) static void overlap_test_1_attr(WINDOW *win, int flavor, int col) { - short cpair = (short) (1 + (flavor * 2) + col); + NCURSES_PAIRS_T cpair = (NCURSES_PAIRS_T) (1 + (flavor * 2) + col); switch (flavor) { case 0: @@ -6243,7 +6262,7 @@ overlap_test_1_attr(WINDOW *win, int flavor, int col) static void overlap_test_2_attr(WINDOW *win, int flavor, int col) { - short cpair = (short) (9 + (flavor * 2) + col); + NCURSES_PAIRS_T cpair = (NCURSES_PAIRS_T) (9 + (flavor * 2) + col); switch (flavor) { case 0: @@ -6977,7 +6996,7 @@ main(int argc, char *argv[]) max_pairs = COLOR_PAIRS; /* was > 256 ? 256 : COLOR_PAIRS */ if (can_change_color()) { - short cp; + NCURSES_PAIRS_T cp; all_colors = typeMalloc(RGB_DATA, (unsigned) max_colors); if (!all_colors) failed("all_colors"); @@ -7005,9 +7024,10 @@ main(int argc, char *argv[]) && okRGB(red) && okRGB(green) && okRGB(blue)) { - all_colors[c].red = (short) ((red * 1000) / scale); - all_colors[c].green = (short) ((green * 1000) / scale); - all_colors[c].blue = (short) ((blue * 1000) / scale); +#define Scaled(n) (NCURSES_COLOR_T) (((n) * 1000) / scale) + all_colors[c].red = Scaled(red); + all_colors[c].green = Scaled(green); + all_colors[c].blue = Scaled(blue); } } fclose(fp); diff --git a/test/test.priv.h b/test/test.priv.h index 905efb25..d3915fba 100644 --- a/test/test.priv.h +++ b/test/test.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2013,2014 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 * @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: test.priv.h,v 1.122 2013/10/20 00:25:18 tom Exp $ */ +/* $Id: test.priv.h,v 1.123 2014/02/01 22:09:27 tom Exp $ */ #ifndef __TEST_PRIV_H #define __TEST_PRIV_H 1 @@ -424,6 +424,14 @@ extern int optind; #define NCURSES_CH_T cchar_t #endif +#ifndef NCURSES_COLOR_T +#define NCURSES_COLOR_T short +#endif + +#ifndef NCURSES_PAIRS_T +#define NCURSES_PAIRS_T short +#endif + #ifndef NCURSES_OPAQUE #define NCURSES_OPAQUE 0 #endif @@ -546,7 +554,7 @@ extern char *strnames[], *strcodes[], *strfnames[]; if ((count = getcchar(s, NULL, NULL, NULL, NULL)) > 0) { \ wchar_t test_wch[CCHARW_MAX + 2]; \ attr_t test_attrs; \ - short test_pair; \ + NCURSES_PAIRS_T test_pair; \ \ if (getcchar( s, test_wch, &test_attrs, &test_pair, NULL) == OK \ && test_wch[0] != L'\0') { \ -- 2.44.0