ncurses 6.0 - patch 20161217

+ add tput-colorcube demo script.
+ add -r and -s options to tput-initc demo, to match usage in xterm.
+ flush the standard output in _nc_flush for the case where SP is zero,
  e.g., when called via putp.  This fixes a scenario where "tput flash"
  did not work after changes in 20130112.
This commit is contained in:
Thomas E. Dickey 2016-12-18 01:43:10 +00:00
parent 1b540608ea
commit c885a3fdd0
13 changed files with 228 additions and 20 deletions

View File

@ -1174,6 +1174,7 @@
./test/testaddch.c ./test/testaddch.c
./test/testcurs.c ./test/testcurs.c
./test/testscanw.c ./test/testscanw.c
./test/tput-colorcube
./test/tput-initc ./test/tput-initc
./test/tracemunch ./test/tracemunch
./test/view.c ./test/view.c

9
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.2708 2016/12/11 00:24:06 tom Exp $ -- $Id: NEWS,v 1.2711 2016/12/17 23:41:02 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,13 @@ 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.
20161217
+ add tput-colorcube demo script.
+ add -r and -s options to tput-initc demo, to match usage in xterm.
+ flush the standard output in _nc_flush for the case where SP is zero,
e.g., when called via putp. This fixes a scenario where "tput flash"
did not work after changes in 20130112.
20161210 20161210
+ add configure script option --disable-wattr-macros for use in cases + add configure script option --disable-wattr-macros for use in cases
where one wants to use the same headers for ncurses5/ncurses6 where one wants to use the same headers for ncurses5/ncurses6

View File

@ -1 +1 @@
5:0:9 6.0 20161210 5:0:9 6.0 20161217

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.1136 2016/12/10 12:47:46 tom Exp $ # $Id: dist.mk,v 1.1137 2016/12/17 16:05:02 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 = 6 NCURSES_MAJOR = 6
NCURSES_MINOR = 0 NCURSES_MINOR = 0
NCURSES_PATCH = 20161210 NCURSES_PATCH = 20161217
# 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

@ -51,7 +51,7 @@
#include <termcap.h> /* ospeed */ #include <termcap.h> /* ospeed */
#include <tic.h> #include <tic.h>
MODULE_ID("$Id: lib_tputs.c,v 1.98 2016/05/28 21:58:45 tom Exp $") MODULE_ID("$Id: lib_tputs.c,v 1.99 2016/12/17 20:47:21 tom Exp $")
NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */ NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */
NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */ NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */
@ -141,6 +141,8 @@ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_DCL0)
} }
} }
} }
} else {
fflush(stdout);
} }
} }

View File

@ -1,8 +1,8 @@
ncurses6 (6.0+20161210) unstable; urgency=low ncurses6 (6.0+20161217) unstable; urgency=low
* latest weekly patch * latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 10 Dec 2016 07:47:46 -0500 -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Dec 2016 11:05:02 -0500
ncurses6 (5.9-20131005) unstable; urgency=low ncurses6 (5.9-20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6 (6.0+20161210) unstable; urgency=low ncurses6 (6.0+20161217) unstable; urgency=low
* latest weekly patch * latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 10 Dec 2016 07:47:46 -0500 -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Dec 2016 11:05:02 -0500
ncurses6 (5.9-20131005) unstable; urgency=low ncurses6 (5.9-20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6 (6.0+20161210) unstable; urgency=low ncurses6 (6.0+20161217) unstable; urgency=low
* latest weekly patch * latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 10 Dec 2016 07:47:46 -0500 -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Dec 2016 11:05:02 -0500
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.188 2016/12/10 12:47:46 tom Exp $ ; $Id: mingw-ncurses.nsi,v 1.189 2016/12/17 16:05:02 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 "6" !define VERSION_MAJOR "6"
!define VERSION_MINOR "0" !define VERSION_MINOR "0"
!define VERSION_YYYY "2016" !define VERSION_YYYY "2016"
!define VERSION_MMDD "1210" !define VERSION_MMDD "1217"
!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: 6.0 Version: 6.0
Release: 20161210 Release: 20161217
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: 6.0 Version: 6.0
Release: 20161210 Release: 20161217
License: X11 License: X11
Group: Development/Libraries Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz Source: ncurses-%{version}-%{release}.tgz

130
test/tput-colorcube Normal file
View File

@ -0,0 +1,130 @@
#!/bin/sh
##############################################################################
# Copyright (c) 2016 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. #
##############################################################################
# $Id: tput-colorcube,v 1.1 2016/12/17 23:37:37 tom Exp $
# Use this script to print an xterm-style color cube, e.g., as done in
# the xterm 88colors2.pl and 256colors2.pl scripts.
failed() {
printf "?? $*\n" >&2
exit 1
}
newline() {
tput op
printf "\n"
}
if [ $# = 1 ]
then
myterm=$1
elif [ $# = 0 ]
then
myterm=$TERM
else
failed "expected one parameter or none"
fi
colors=$(tput -T $myterm colors 2>/dev/null)
if [ ${colors:-0} -le 0 ]
then
myterm=${myterm%%-color}
colors=$(tput -T $myterm colors 2>/dev/null)
fi
if [ ${colors:-0} -le 0 ]
then
failed "terminal $myterm does not support color"
fi
printf "System colors:\n"
color=0
inrow=$colors
to_do=$colors
[ $colors -gt 256 ] && colors=256
[ $inrow -gt 8 ] && inrow=8
[ $to_do -gt 16 ] && to_do=16
while [ $color -lt $to_do ]
do
[ $color = $inrow ] && newline
tput setab $color
printf ' '
color=$(expr $color + 1)
done
newline
[ $colors -le 16 ] && exit
if [ $colors = 256 ]
then
cube=6
ramp=232
elif [ $colors -ge 88 ]
then
cube=4
ramp=80
else
exit
fi
printf "\n"
printf "Color cube, ${cube}x${cube}x${cube}:\n"
g=0
cube2=$(expr $cube \* $cube)
while [ $g -lt $cube ]
do
r=0
while [ $r -lt $cube ]
do
b=0
while [ $b -lt $cube ]
do
color=$(expr 16 + \( $r \* $cube2 \) + \( $g \* $cube \) + $b)
tput setab $color
printf ' '
b=$(expr $b + 1)
done
tput op
printf ' '
r=$(expr $r + 1)
done
newline
g=$(expr $g + 1)
done
printf "\n"
printf "Grayscale ramp:\n"
color=$ramp
while [ $color -lt $colors ]
do
tput setab $color
printf ' '
color=$(expr $color + 1)
done
newline
# vi:ts=4 sw=4

View File

@ -26,7 +26,7 @@
# use or other dealings in this Software without prior written # # use or other dealings in this Software without prior written #
# authorization. # # authorization. #
############################################################################## ##############################################################################
# $Id: tput-initc,v 1.1 2016/12/10 23:35:46 tom Exp $ # $Id: tput-initc,v 1.5 2016/12/17 22:35:05 tom Exp $
# Some of the ".dat" files in ncurses' test-directory give r/g/b numbers for # Some of the ".dat" files in ncurses' test-directory give r/g/b numbers for
# default palettes of xterm and Linux console. This script reads the numbers # default palettes of xterm and Linux console. This script reads the numbers
# and (assuming the same or compatible terminal) uses tput to (re)initialize # and (assuming the same or compatible terminal) uses tput to (re)initialize
@ -37,6 +37,40 @@ failed() {
exit 1 exit 1
} }
usage() {
cat >&2 <<-EOF
usage: $0 [-r] [-s] [palette-data]
Use this script with a palette data-file to (re)initialize colors with
tput. This script assumes arrangements for 16-, 88- and 256-colors
like the xterm 88colors2.pl and 256colors2.pl scripts.
Options:
-r reverse palette
-s reverse system colors (first 16 if more than 16 colors)
EOF
exit 1
}
opt_r=no
opt_s=no
while getopts "rs" option "$@"
do
case $option in
(r)
opt_r=yes
;;
(s)
opt_s=yes
;;
(*)
usage
;;
esac
done
shift $(expr $OPTIND - 1)
if [ $# = 1 ] if [ $# = 1 ]
then then
file=$1 file=$1
@ -70,8 +104,20 @@ then
fi fi
cat $file |\ cat $file |\
awk -v myterm=$myterm ' awk -v opt_r=$opt_r \
BEGIN { limit=1000; } -v opt_s=$opt_s \
-v colors=$colors \
-v myterm=$myterm '
BEGIN {
limit = 1000;
range = -1;
cramp = -1;
if ( colors == 88 ) {
cramp = 80;
} else if ( colors = 256 ) {
cramp = 232;
}
}
function scaled(n) { function scaled(n) {
return (n * 1000)/limit; return (n * 1000)/limit;
} }
@ -83,5 +129,27 @@ function scaled(n) {
/^[0-9]+:/{ /^[0-9]+:/{
sub(":","",$1); sub(":","",$1);
printf "tput -T%s initc %d %d %d %d\n", myterm, $1,scaled($2),scaled($3),scaled($4); item = $1 + 0;
}' |sh - if (range < item) {
range = item;
}
params[$1] = sprintf ("%d %d %d", scaled($2),scaled($3),scaled($4));
}
END {
for (n = 0; n <= range; ++n) {
m = n;
if ( opt_r == "yes" ) {
if ( colors <= 16 ) {
m = range - n;
} else if ( ( opt_s == "yes" ) && ( n < 16 ) ) {
m = 15 - n;
} else if ( n >= cramp ) {
m = cramp + colors - 1 - n;
} else {
m = 16 + cramp - 1 - n;
}
}
printf "tput -T%s initc %d %s\n", myterm, m, params[n];
}
}
' |sh -