ncurses 5.9 - patch 20140621

+ change shared-library suffix for AIX 5 and 6 to ".so", avoiding
  conflict with the static library (report by Ben Lentz).
+ document RPATH_LIST in INSTALLATION file, as part of workarounds for
  upgrading an ncurses library using the "--with-shared" option.
+ modify test/ncurses.c c/C tests to cycle through subsets of the
  total number of colors, to better illustrate 8/16/88/256-colors by
  providing directly comparable screens.
+ add test/dots_curses.c, for comparison with the low-level examples.
This commit is contained in:
Thomas E. Dickey 2014-06-21 23:56:54 +00:00
parent 6be6b9d920
commit 987faea670
19 changed files with 1292 additions and 1125 deletions

10
Ada95/aclocal.m4 vendored
View File

@ -28,7 +28,7 @@ dnl***************************************************************************
dnl dnl
dnl Author: Thomas E. Dickey dnl Author: Thomas E. Dickey
dnl dnl
dnl $Id: aclocal.m4,v 1.86 2014/06/01 15:36:34 tom Exp $ dnl $Id: aclocal.m4,v 1.87 2014/06/21 21:58:06 tom Exp $
dnl Macros used in NCURSES Ada95 auto-configuration script. dnl Macros used in NCURSES Ada95 auto-configuration script.
dnl dnl
dnl These macros are maintained separately from NCURSES. The copyright on dnl These macros are maintained separately from NCURSES. The copyright on
@ -39,7 +39,7 @@ dnl See http://invisible-island.net/autoconf/ for additional information.
dnl dnl
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56 dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49
dnl ------------------ dnl ------------------
dnl Conditionally generate script according to whether we're using a given autoconf. dnl Conditionally generate script according to whether we're using a given autoconf.
dnl dnl
@ -48,7 +48,7 @@ dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
dnl $3 = code to use if AC_ACVERSION is older than $1. dnl $3 = code to use if AC_ACVERSION is older than $1.
define([CF_ACVERSION_CHECK], define([CF_ACVERSION_CHECK],
[ [
ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl
ifdef([m4_version_compare], ifdef([m4_version_compare],
[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
[CF_ACVERSION_COMPARE( [CF_ACVERSION_COMPARE(
@ -1733,7 +1733,7 @@ ifelse($1,,,[$1=$LIB_PREFIX])
AC_SUBST(LIB_PREFIX) AC_SUBST(LIB_PREFIX)
])dnl ])dnl
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl CF_LIB_SUFFIX version: 22 updated: 2013/09/07 13:54:05 dnl CF_LIB_SUFFIX version: 23 updated: 2014/06/21 17:47:12
dnl ------------- dnl -------------
dnl Compute the library file-suffix from the given model name dnl Compute the library file-suffix from the given model name
dnl $1 = model name dnl $1 = model name
@ -1758,7 +1758,7 @@ AC_DEFUN([CF_LIB_SUFFIX],
Xshared) #(vi Xshared) #(vi
case $cf_cv_system_name in case $cf_cv_system_name in
aix[[5-7]]*) #(vi aix[[5-7]]*) #(vi
$2='.a' $2='.so'
$3=[$]$2 $3=[$]$2
;; ;;
cygwin*|msys*|mingw*) #(vi cygwin*|msys*|mingw*) #(vi

2050
Ada95/configure vendored

File diff suppressed because it is too large Load Diff

20
INSTALL
View File

@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written -- -- sale, use or other dealings in this Software without prior written --
-- authorization. -- -- authorization. --
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- $Id: INSTALL,v 1.171 2014/04/26 20:30:01 tom Exp $ -- $Id: INSTALL,v 1.172 2014/06/21 18:53:42 tom Exp $
--------------------------------------------------------------------- ---------------------------------------------------------------------
How to install Ncurses/Terminfo on your system How to install Ncurses/Terminfo on your system
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -987,11 +987,23 @@ SUMMARY OF CONFIGURE OPTIONS:
shared libraries, you may encounter problems with the linker. shared libraries, you may encounter problems with the linker.
For example, it may prevent you from running the build tree's For example, it may prevent you from running the build tree's
copy of tic (for installing the terminfo database) because it copy of tic (for installing the terminfo database) because it
loads the system's copy of the ncurses shared libraries. In that loads the system's copy of the ncurses shared libraries.
case, using the misc/shlib script may be helpful, since it sets
$LD_LIBRARY_PATH to point to the build tree, e.g., In that case, using the misc/shlib script may be helpful, since it
sets $LD_LIBRARY_PATH to point to the build tree, e.g.,
./misc/shlib make install ./misc/shlib make install
Alternatively, for most platforms, the linker accepts a list of
directories which will be searched for libraries at run-time. The
configure script allows you to modify this list using the
RPATH_LIST environment variable. It is a colon-separated list of
directories (default: the "libdir" set via the configure script).
If you set that to put "../lib" first in the list, the linker will
look first at the build-directory, and avoid conflict with libraries
already installed. One drawback to this approach is that libraries
can be accidentally searched in any "../lib" directory.
NOTE: If you use the --with-ada-sharedlib option, you should also NOTE: If you use the --with-ada-sharedlib option, you should also
set this option, to ensure that C-language modules needed for the set this option, to ensure that C-language modules needed for the
Ada binding use appropriate compiler options. Ada binding use appropriate compiler options.

View File

@ -1075,6 +1075,7 @@
./test/demo_terminfo.c ./test/demo_terminfo.c
./test/ditto.c ./test/ditto.c
./test/dots.c ./test/dots.c
./test/dots_curses.c
./test/dots_mvcur.c ./test/dots_mvcur.c
./test/dots_termcap.c ./test/dots_termcap.c
./test/echochar.c ./test/echochar.c

12
NEWS
View File

@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written -- -- sale, use or other dealings in this Software without prior written --
-- authorization. -- -- authorization. --
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- $Id: NEWS,v 1.2226 2014/06/14 23:48:11 tom Exp $ -- $Id: NEWS,v 1.2229 2014/06/21 21:51:45 tom Exp $
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started This is a log of changes that ncurses has gone through since Zeyd started
@ -45,6 +45,16 @@ See the AUTHORS file for the corresponding full names.
Changes through 1.9.9e did not credit all contributions; Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information. it is not possible to add this information.
20140621
+ change shared-library suffix for AIX 5 and 6 to ".so", avoiding
conflict with the static library (report by Ben Lentz).
+ document RPATH_LIST in INSTALLATION file, as part of workarounds for
upgrading an ncurses library using the "--with-shared" option.
+ modify test/ncurses.c c/C tests to cycle through subsets of the
total number of colors, to better illustrate 8/16/88/256-colors by
providing directly comparable screens.
+ add test/dots_curses.c, for comparison with the low-level examples.
20140614 20140614
+ fix dereference before null check found by Coverity in tic.c + fix dereference before null check found by Coverity in tic.c
(cf: 20140524). (cf: 20140524).

10
aclocal.m4 vendored
View File

@ -28,7 +28,7 @@ dnl***************************************************************************
dnl dnl
dnl Author: Thomas E. Dickey 1995-on dnl Author: Thomas E. Dickey 1995-on
dnl dnl
dnl $Id: aclocal.m4,v 1.698 2014/06/01 15:35:36 tom Exp $ dnl $Id: aclocal.m4,v 1.700 2014/06/21 21:50:00 tom Exp $
dnl Macros used in NCURSES auto-configuration script. dnl Macros used in NCURSES auto-configuration script.
dnl dnl
dnl These macros are maintained separately from NCURSES. The copyright on dnl These macros are maintained separately from NCURSES. The copyright on
@ -62,7 +62,7 @@ AC_DEFUN([AM_LANGINFO_CODESET],
fi fi
])dnl ])dnl
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56 dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49
dnl ------------------ dnl ------------------
dnl Conditionally generate script according to whether we're using a given autoconf. dnl Conditionally generate script according to whether we're using a given autoconf.
dnl dnl
@ -71,7 +71,7 @@ dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
dnl $3 = code to use if AC_ACVERSION is older than $1. dnl $3 = code to use if AC_ACVERSION is older than $1.
define([CF_ACVERSION_CHECK], define([CF_ACVERSION_CHECK],
[ [
ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl
ifdef([m4_version_compare], ifdef([m4_version_compare],
[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
[CF_ACVERSION_COMPARE( [CF_ACVERSION_COMPARE(
@ -3706,7 +3706,7 @@ fi
]) ])
]) ])
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl CF_LIB_SUFFIX version: 22 updated: 2013/09/07 13:54:05 dnl CF_LIB_SUFFIX version: 23 updated: 2014/06/21 17:47:12
dnl ------------- dnl -------------
dnl Compute the library file-suffix from the given model name dnl Compute the library file-suffix from the given model name
dnl $1 = model name dnl $1 = model name
@ -3731,7 +3731,7 @@ AC_DEFUN([CF_LIB_SUFFIX],
Xshared) #(vi Xshared) #(vi
case $cf_cv_system_name in case $cf_cv_system_name in
aix[[5-7]]*) #(vi aix[[5-7]]*) #(vi
$2='.a' $2='.so'
$3=[$]$2 $3=[$]$2
;; ;;
cygwin*|msys*|mingw*) #(vi cygwin*|msys*|mingw*) #(vi

8
configure vendored
View File

@ -20515,7 +20515,7 @@ echo $ECHO_N "checking default library-dependency suffix... $ECHO_C" >&6
Xshared) #(vi Xshared) #(vi
case $cf_cv_system_name in case $cf_cv_system_name in
aix[5-7]*) #(vi aix[5-7]*) #(vi
DFT_LIB_SUFFIX='.a' DFT_LIB_SUFFIX='.so'
DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX
;; ;;
cygwin*|msys*|mingw*) #(vi cygwin*|msys*|mingw*) #(vi
@ -20601,7 +20601,7 @@ else
Xshared) #(vi Xshared) #(vi
case $cf_cv_system_name in case $cf_cv_system_name in
aix[5-7]*) #(vi aix[5-7]*) #(vi
CXX_LIB_SUFFIX='.a' CXX_LIB_SUFFIX='.so'
CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX
;; ;;
cygwin*|msys*|mingw*) #(vi cygwin*|msys*|mingw*) #(vi
@ -22491,7 +22491,7 @@ do
Xshared) #(vi Xshared) #(vi
case $cf_cv_system_name in case $cf_cv_system_name in
aix[5-7]*) #(vi aix[5-7]*) #(vi
cf_suffix='.a' cf_suffix='.so'
cf_depsuf=$cf_suffix cf_depsuf=$cf_suffix
;; ;;
cygwin*|msys*|mingw*) #(vi cygwin*|msys*|mingw*) #(vi
@ -22703,7 +22703,7 @@ echo "${as_me:-configure}:22680: testing overriding CXX_MODEL to SHARED ..." 1>&
Xshared) #(vi Xshared) #(vi
case $cf_cv_system_name in case $cf_cv_system_name in
aix[5-7]*) #(vi aix[5-7]*) #(vi
cf_suffix='.a' cf_suffix='.so'
cf_depsuf=$cf_suffix cf_depsuf=$cf_suffix
;; ;;
cygwin*|msys*|mingw*) #(vi cygwin*|msys*|mingw*) #(vi

View File

@ -25,7 +25,7 @@
# use or other dealings in this Software without prior written # # use or other dealings in this Software without prior written #
# authorization. # # authorization. #
############################################################################## ##############################################################################
# $Id: dist.mk,v 1.991 2014/06/14 09:12:57 tom Exp $ # $Id: dist.mk,v 1.992 2014/06/21 14:35:14 tom Exp $
# Makefile for creating ncurses distributions. # Makefile for creating ncurses distributions.
# #
# This only needs to be used directly as a makefile by developers, but # 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. # These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5 NCURSES_MAJOR = 5
NCURSES_MINOR = 9 NCURSES_MINOR = 9
NCURSES_PATCH = 20140614 NCURSES_PATCH = 20140621
# We don't append the patch to the version, since this only applies to releases # We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)

View File

@ -1,8 +1,8 @@
ncurses6 (5.9-20140614) unstable; urgency=low ncurses6 (5.9-20140621) unstable; urgency=low
* latest weekly patch * latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 14 Jun 2014 05:12:57 -0400 -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 21 Jun 2014 10:35:14 -0400
ncurses6 (5.9-20131005) unstable; urgency=low ncurses6 (5.9-20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6 (5.9-20140614) unstable; urgency=low ncurses6 (5.9-20140621) unstable; urgency=low
* latest weekly patch * latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 14 Jun 2014 05:12:57 -0400 -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 21 Jun 2014 10:35:14 -0400
ncurses6 (5.9-20131005) unstable; urgency=low ncurses6 (5.9-20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6 (5.9-20140614) unstable; urgency=low ncurses6 (5.9-20140621) unstable; urgency=low
* latest weekly patch * latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 14 Jun 2014 05:12:57 -0400 -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 21 Jun 2014 10:35:14 -0400
ncurses6 (5.9-20120608) unstable; urgency=low ncurses6 (5.9-20120608) unstable; urgency=low

View File

@ -1,4 +1,4 @@
; $Id: mingw-ncurses.nsi,v 1.46 2014/06/14 09:12:57 tom Exp $ ; $Id: mingw-ncurses.nsi,v 1.47 2014/06/21 14:35:14 tom Exp $
; TODO add examples ; TODO add examples
; TODO bump ABI to 6 ; TODO bump ABI to 6
@ -10,7 +10,7 @@
!define VERSION_MAJOR "5" !define VERSION_MAJOR "5"
!define VERSION_MINOR "9" !define VERSION_MINOR "9"
!define VERSION_YYYY "2014" !define VERSION_YYYY "2014"
!define VERSION_MMDD "0614" !define VERSION_MMDD "0621"
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}
!define MY_ABI "5" !define MY_ABI "5"

View File

@ -3,7 +3,7 @@
Summary: shared libraries for terminal handling Summary: shared libraries for terminal handling
Name: mingw32-ncurses6 Name: mingw32-ncurses6
Version: 5.9 Version: 5.9
Release: 20140614 Release: 20140621
License: X11 License: X11
Group: Development/Libraries Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz Source: ncurses-%{version}-%{release}.tgz

View File

@ -1,7 +1,7 @@
Summary: shared libraries for terminal handling Summary: shared libraries for terminal handling
Name: ncurses6 Name: ncurses6
Version: 5.9 Version: 5.9
Release: 20140614 Release: 20140621
License: X11 License: X11
Group: Development/Libraries Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz Source: ncurses-%{version}-%{release}.tgz

6
test/aclocal.m4 vendored
View File

@ -26,7 +26,7 @@ dnl sale, use or other dealings in this Software without prior written *
dnl authorization. * dnl authorization. *
dnl*************************************************************************** dnl***************************************************************************
dnl dnl
dnl $Id: aclocal.m4,v 1.95 2014/04/12 22:32:11 tom Exp $ dnl $Id: aclocal.m4,v 1.96 2014/06/21 21:59:59 tom Exp $
dnl dnl
dnl Author: Thomas E. Dickey dnl Author: Thomas E. Dickey
dnl dnl
@ -40,7 +40,7 @@ dnl See http://invisible-island.net/autoconf/ for additional information.
dnl dnl
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56 dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49
dnl ------------------ dnl ------------------
dnl Conditionally generate script according to whether we're using a given autoconf. dnl Conditionally generate script according to whether we're using a given autoconf.
dnl dnl
@ -49,7 +49,7 @@ dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
dnl $3 = code to use if AC_ACVERSION is older than $1. dnl $3 = code to use if AC_ACVERSION is older than $1.
define([CF_ACVERSION_CHECK], define([CF_ACVERSION_CHECK],
[ [
ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl
ifdef([m4_version_compare], ifdef([m4_version_compare],
[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
[CF_ACVERSION_COMPARE( [CF_ACVERSION_COMPARE(

151
test/dots_curses.c Normal file
View File

@ -0,0 +1,151 @@
/****************************************************************************
* Copyright (c) 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 *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/*
* Author: Thomas E. Dickey
*
* $Id: dots_curses.c,v 1.1 2014/06/21 16:07:50 tom Exp $
*
* A simple demo of the curses interface used for comparison with termcap.
*/
#include <test.priv.h>
#if !defined(__MINGW32__)
#include <sys/time.h>
#endif
#include <time.h>
#define valid(s) ((s != 0) && s != (char *)-1)
static bool interrupted = FALSE;
static long total_chars = 0;
static time_t started;
static void
cleanup(void)
{
endwin();
printf("\n\n%ld total chars, rate %.2f/sec\n",
total_chars,
((double) (total_chars) / (double) (time((time_t *) 0) - started)));
}
static void
onsig(int n GCC_UNUSED)
{
interrupted = TRUE;
}
static double
ranf(void)
{
long r = (rand() & 077777);
return ((double) r / 32768.);
}
static int
mypair(int fg, int bg)
{
int pair = (fg * COLORS) + bg;
return (pair >= COLOR_PAIRS) ? -1 : pair;
}
static void
set_colors(int fg, int bg)
{
int pair = mypair(fg, bg);
if (pair > 0) {
attron((attr_t) COLOR_PAIR(mypair(fg, bg)));
}
}
int
main(int argc GCC_UNUSED,
char *argv[]GCC_UNUSED)
{
int x, y, z, p;
int fg, bg;
double r;
double c;
CATCHALL(onsig);
srand((unsigned) time(0));
initscr();
if (has_colors()) {
start_color();
for (fg = 0; fg < COLORS; fg++) {
for (bg = 0; bg < COLORS; bg++) {
int pair = mypair(fg, bg);
if (pair > 0)
init_pair(pair, fg, bg);
}
}
}
r = (double) (LINES - 4);
c = (double) (COLS - 4);
started = time((time_t *) 0);
fg = COLOR_WHITE;
bg = COLOR_BLACK;
while (!interrupted) {
x = (int) (c * ranf()) + 2;
y = (int) (r * ranf()) + 2;
p = (ranf() > 0.9) ? '*' : ' ';
move(y, x);
if (has_colors()) {
z = (int) (ranf() * COLORS);
if (ranf() > 0.01) {
set_colors(fg = z, bg);
attron((attr_t) COLOR_PAIR(mypair(fg, bg)));
} else {
set_colors(fg, bg = z);
napms(1);
}
} else {
if (ranf() <= 0.01) {
if (ranf() > 0.6) {
attron(A_REVERSE);
} else {
attroff(A_REVERSE);
}
napms(1);
}
}
addch(p);
refresh();
++total_chars;
}
cleanup();
ExitProgram(EXIT_SUCCESS);
}

View File

@ -1,6 +1,6 @@
# $Id: modules,v 1.50 2013/12/07 18:06:01 tom Exp $ # $Id: modules,v 1.51 2014/06/21 15:28:46 tom Exp $
############################################################################## ##############################################################################
# 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 # # Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), # # copy of this software and associated documentation files (the "Software"), #
@ -49,6 +49,7 @@ demo_termcap progs $(srcdir) $(HEADER_DEPS)
demo_terminfo progs $(srcdir) $(HEADER_DEPS) demo_terminfo progs $(srcdir) $(HEADER_DEPS)
ditto progs $(srcdir) $(HEADER_DEPS) ditto progs $(srcdir) $(HEADER_DEPS)
dots progs $(srcdir) $(HEADER_DEPS) dots progs $(srcdir) $(HEADER_DEPS)
dots_curses progs $(srcdir) $(HEADER_DEPS)
dots_mvcur progs $(srcdir) $(HEADER_DEPS) dots_mvcur progs $(srcdir) $(HEADER_DEPS)
dots_termcap progs $(srcdir) $(HEADER_DEPS) dots_termcap progs $(srcdir) $(HEADER_DEPS)
echochar progs $(srcdir) $(HEADER_DEPS) echochar progs $(srcdir) $(HEADER_DEPS)

View File

@ -40,7 +40,7 @@ AUTHOR
Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993 Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
Thomas E. Dickey (beginning revision 1.27 in 1996). Thomas E. Dickey (beginning revision 1.27 in 1996).
$Id: ncurses.c,v 1.398 2014/05/03 19:38:16 juergen Exp $ $Id: ncurses.c,v 1.401 2014/06/21 18:37:29 tom Exp $
***************************************************************************/ ***************************************************************************/
@ -1998,6 +1998,10 @@ color_legend(WINDOW *helpwin, bool wide)
" a/A toggle altcharset off/on"); " a/A toggle altcharset off/on");
MvWPrintw(helpwin, row++, col, MvWPrintw(helpwin, row++, col,
" b/B toggle bold off/on"); " b/B toggle bold off/on");
if (has_colors()) {
MvWPrintw(helpwin, row++, col,
" c/C cycle used-colors through 8,16,...,COLORS");
}
MvWPrintw(helpwin, row++, col, MvWPrintw(helpwin, row++, col,
" n/N toggle text/number on/off"); " n/N toggle text/number on/off");
MvWPrintw(helpwin, row++, col, MvWPrintw(helpwin, row++, col,
@ -2018,6 +2022,35 @@ color_legend(WINDOW *helpwin, bool wide)
#define set_color_test(name, value) if (name != value) { name = value; base_row = 0; } #define set_color_test(name, value) if (name != value) { name = value; base_row = 0; }
static int
color_cycle(int current, int step)
{
int result = current;
if (step < 0) {
if (current <= 8) {
result = COLORS;
} else {
result = 8;
if ((result * 2) > COLORS) {
result = COLORS;
} else {
while ((result * 2) < current) {
result *= 2;
}
}
}
} else {
if (current >= COLORS) {
result = 8;
} else {
result *= 2;
}
if (result > COLORS)
result = COLORS;
}
return result;
}
/* generate a color test pattern */ /* generate a color test pattern */
static void static void
color_test(void) color_test(void)
@ -2027,7 +2060,8 @@ color_test(void)
int base_row = 0; int base_row = 0;
int grid_top = top + 3; int grid_top = top + 3;
int page_size = (LINES - grid_top); int page_size = (LINES - grid_top);
int pairs_max = PAIR_NUMBER(A_COLOR) + 1; int pairs_max;
int colors_max = COLORS;
int row_limit; int row_limit;
int per_row; int per_row;
char numbered[80]; char numbered[80];
@ -2040,23 +2074,24 @@ color_test(void)
bool opt_wide = FALSE; bool opt_wide = FALSE;
WINDOW *helpwin; WINDOW *helpwin;
if (COLORS * COLORS == COLOR_PAIRS) {
int limit = (COLORS - min_colors) * (COLORS - min_colors);
if (pairs_max > limit)
pairs_max = limit;
} else {
if (pairs_max > COLOR_PAIRS)
pairs_max = COLOR_PAIRS;
}
while (!done) { while (!done) {
int shown = 0; int shown = 0;
pairs_max = PAIR_NUMBER(A_COLOR) + 1;
if (colors_max * colors_max <= COLOR_PAIRS) {
int limit = (colors_max - min_colors) * (colors_max - min_colors);
if (pairs_max > limit)
pairs_max = limit;
} else {
if (pairs_max > COLOR_PAIRS)
pairs_max = COLOR_PAIRS;
}
/* this assumes an 80-column line */ /* this assumes an 80-column line */
if (opt_wide) { if (opt_wide) {
width = 4; width = 4;
hello = "Test"; hello = "Test";
per_row = (COLORS > 8) ? 16 : 8; per_row = (colors_max > 8) ? 16 : 8;
} else { } else {
width = 8; width = 8;
hello = "Hello"; hello = "Hello";
@ -2067,9 +2102,12 @@ color_test(void)
row_limit = (pairs_max + per_row - 1) / per_row; row_limit = (pairs_max + per_row - 1) / per_row;
move(0, 0); move(0, 0);
(void) printw("There are %d color pairs and %d colors%s\n", (void) printw("There are %d color pairs and %d colors",
pairs_max, COLORS, pairs_max, COLORS);
min_colors ? " besides 'default'" : ""); if (colors_max != COLORS)
(void) printw(" (using %d colors)", colors_max);
if (min_colors)
(void) addstr(" besides 'default'");
clrtobot(); clrtobot();
MvPrintw(top + 1, 0, MvPrintw(top + 1, 0,
@ -2088,8 +2126,8 @@ color_test(void)
int col = (i % per_row + 1) * width; int col = (i % per_row + 1) * width;
NCURSES_PAIRS_T pair = i; NCURSES_PAIRS_T pair = i;
#define InxToFG(i) (NCURSES_COLOR_T) ((i % (COLORS - min_colors)) + min_colors) #define InxToFG(i) (NCURSES_COLOR_T) ((i % (colors_max - min_colors)) + min_colors)
#define InxToBG(i) (NCURSES_COLOR_T) ((i / (COLORS - min_colors)) + min_colors) #define InxToBG(i) (NCURSES_COLOR_T) ((i / (colors_max - min_colors)) + min_colors)
if (row >= 0 && move(row, col) != ERR) { if (row >= 0 && move(row, col) != ERR) {
NCURSES_COLOR_T fg = InxToFG(i); NCURSES_COLOR_T fg = InxToFG(i);
NCURSES_COLOR_T bg = InxToBG(i); NCURSES_COLOR_T bg = InxToBG(i);
@ -2132,6 +2170,12 @@ color_test(void)
case 'B': case 'B':
opt_bold = TRUE; opt_bold = TRUE;
break; break;
case 'c':
colors_max = color_cycle(colors_max, -1);
break;
case 'C':
colors_max = color_cycle(colors_max, 1);
break;
case 'n': case 'n':
opt_nums = FALSE; opt_nums = FALSE;
break; break;
@ -2221,6 +2265,7 @@ wide_color_test(void)
int grid_top = top + 3; int grid_top = top + 3;
int page_size = (LINES - grid_top); int page_size = (LINES - grid_top);
int pairs_max = (unsigned short) (-1); int pairs_max = (unsigned short) (-1);
int colors_max = COLORS;
int row_limit; int row_limit;
int per_row; int per_row;
char numbered[80]; char numbered[80];
@ -2235,23 +2280,24 @@ wide_color_test(void)
wchar_t buffer[80]; wchar_t buffer[80];
WINDOW *helpwin; WINDOW *helpwin;
if (COLORS * COLORS == COLOR_PAIRS) {
int limit = (COLORS - min_colors) * (COLORS - min_colors);
if (pairs_max > limit)
pairs_max = limit;
} else {
if (pairs_max > COLOR_PAIRS)
pairs_max = COLOR_PAIRS;
}
while (!done) { while (!done) {
int shown = 0; int shown = 0;
pairs_max = (unsigned short) (-1);
if (colors_max * colors_max <= COLOR_PAIRS) {
int limit = (colors_max - min_colors) * (colors_max - min_colors);
if (pairs_max > limit)
pairs_max = limit;
} else {
if (pairs_max > COLOR_PAIRS)
pairs_max = COLOR_PAIRS;
}
/* this assumes an 80-column line */ /* this assumes an 80-column line */
if (opt_wide) { if (opt_wide) {
width = 4; width = 4;
hello = "Test"; hello = "Test";
per_row = (COLORS > 8) ? 16 : 8; per_row = (colors_max > 8) ? 16 : 8;
} else { } else {
width = 8; width = 8;
hello = "Hello"; hello = "Hello";
@ -2270,9 +2316,12 @@ wide_color_test(void)
row_limit = (pairs_max + per_row - 1) / per_row; row_limit = (pairs_max + per_row - 1) / per_row;
move(0, 0); move(0, 0);
(void) printw("There are %d color pairs and %d colors%s\n", (void) printw("There are %d color pairs and %d colors",
pairs_max, COLORS, pairs_max, COLORS);
min_colors ? " besides 'default'" : ""); if (colors_max != COLORS)
(void) printw(" (using %d colors)", colors_max);
if (min_colors)
(void) addstr(" besides 'default'");
clrtobot(); clrtobot();
MvPrintw(top + 1, 0, MvPrintw(top + 1, 0,
@ -2334,6 +2383,12 @@ wide_color_test(void)
case 'B': case 'B':
opt_bold = TRUE; opt_bold = TRUE;
break; break;
case 'c':
colors_max = color_cycle(colors_max, -1);
break;
case 'C':
colors_max = color_cycle(colors_max, 1);
break;
case 'n': case 'n':
opt_nums = FALSE; opt_nums = FALSE;
break; break;

View File

@ -1,6 +1,6 @@
# $Id: programs,v 1.24 2013/12/07 18:06:24 tom Exp $ # $Id: programs,v 1.25 2014/06/21 15:28:49 tom Exp $
############################################################################## ##############################################################################
# Copyright (c) 2006-2009,2013 Free Software Foundation, Inc. # # Copyright (c) 2006-2013,2014 Free Software Foundation, Inc. #
# # # #
# Permission is hereby granted, free of charge, to any person obtaining a # # Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), # # copy of this software and associated documentation files (the "Software"), #
@ -47,6 +47,7 @@ demo_termcap $(LDFLAGS_TINFO) $(LOCAL_LIBS) demo_termcap
demo_terminfo $(LDFLAGS_TINFO) $(LOCAL_LIBS) demo_terminfo demo_terminfo $(LDFLAGS_TINFO) $(LOCAL_LIBS) demo_terminfo
ditto $(LDFLAGS_THREADS) $(LOCAL_LIBS) ditto ditto $(LDFLAGS_THREADS) $(LOCAL_LIBS) ditto
dots $(LDFLAGS_TINFO) $(LOCAL_LIBS) dots dots $(LDFLAGS_TINFO) $(LOCAL_LIBS) dots
dots_curses $(LDFLAGS_CURSES) $(LOCAL_LIBS) dots_curses
dots_mvcur $(LDFLAGS_CURSES) $(LOCAL_LIBS) dots_mvcur dots_mvcur $(LDFLAGS_CURSES) $(LOCAL_LIBS) dots_mvcur
dots_termcap $(LDFLAGS_TINFO) $(LOCAL_LIBS) dots_termcap dots_termcap $(LDFLAGS_TINFO) $(LOCAL_LIBS) dots_termcap
echochar $(LDFLAGS_CURSES) $(LOCAL_LIBS) echochar echochar $(LDFLAGS_CURSES) $(LOCAL_LIBS) echochar