From: Thomas E. Dickey Date: Sun, 18 Dec 2016 01:43:10 +0000 (+0000) Subject: ncurses 6.0 - patch 20161217 X-Git-Tag: v6.1~58 X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=c885a3fdd089f784f17dd2e9c03d8eb774072dc9 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. --- diff --git a/MANIFEST b/MANIFEST index 17299185..656325d6 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1174,6 +1174,7 @@ ./test/testaddch.c ./test/testcurs.c ./test/testscanw.c +./test/tput-colorcube ./test/tput-initc ./test/tracemunch ./test/view.c diff --git a/NEWS b/NEWS index 61ed600a..8cdb035a 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.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 @@ -45,6 +45,13 @@ 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. +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 + add configure script option --disable-wattr-macros for use in cases where one wants to use the same headers for ncurses5/ncurses6 diff --git a/VERSION b/VERSION index d797ee92..1e6ab168 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:9 6.0 20161210 +5:0:9 6.0 20161217 diff --git a/dist.mk b/dist.mk index c0b5a9ab..e39e5852 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.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. # # 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 = 6 NCURSES_MINOR = 0 -NCURSES_PATCH = 20161210 +NCURSES_PATCH = 20161217 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/ncurses/tinfo/lib_tputs.c b/ncurses/tinfo/lib_tputs.c index 39a4832b..0d5cb5c6 100644 --- a/ncurses/tinfo/lib_tputs.c +++ b/ncurses/tinfo/lib_tputs.c @@ -51,7 +51,7 @@ #include /* ospeed */ #include -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(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */ @@ -141,6 +141,8 @@ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_DCL0) } } } + } else { + fflush(stdout); } } diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index c6f2ab9e..89c49fe0 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.0+20161210) unstable; urgency=low +ncurses6 (6.0+20161217) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 10 Dec 2016 07:47:46 -0500 + -- Thomas E. Dickey Sat, 17 Dec 2016 11:05:02 -0500 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index c6f2ab9e..89c49fe0 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.0+20161210) unstable; urgency=low +ncurses6 (6.0+20161217) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 10 Dec 2016 07:47:46 -0500 + -- Thomas E. Dickey Sat, 17 Dec 2016 11:05:02 -0500 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index 1370e2e7..64e59207 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.0+20161210) unstable; urgency=low +ncurses6 (6.0+20161217) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 10 Dec 2016 07:47:46 -0500 + -- Thomas E. Dickey Sat, 17 Dec 2016 11:05:02 -0500 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index 735618ec..5b10c37f 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -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 bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "0" !define VERSION_YYYY "2016" -!define VERSION_MMDD "1210" +!define VERSION_MMDD "1217" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index 9ea6f183..89ae453f 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: 6.0 -Release: 20161210 +Release: 20161217 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncurses.spec b/package/ncurses.spec index 9728c9c7..3847651b 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.0 -Release: 20161210 +Release: 20161217 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/test/tput-colorcube b/test/tput-colorcube new file mode 100644 index 00000000..480ff92e --- /dev/null +++ b/test/tput-colorcube @@ -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 diff --git a/test/tput-initc b/test/tput-initc index 3382ee5a..d4dfddc0 100644 --- a/test/tput-initc +++ b/test/tput-initc @@ -26,7 +26,7 @@ # use or other dealings in this Software without prior written # # 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 # default palettes of xterm and Linux console. This script reads the numbers # and (assuming the same or compatible terminal) uses tput to (re)initialize @@ -37,6 +37,40 @@ failed() { 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 ] then file=$1 @@ -70,8 +104,20 @@ then fi cat $file |\ -awk -v myterm=$myterm ' -BEGIN { limit=1000; } +awk -v opt_r=$opt_r \ + -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) { return (n * 1000)/limit; } @@ -83,5 +129,27 @@ function scaled(n) { /^[0-9]+:/{ sub(":","",$1); - printf "tput -T%s initc %d %d %d %d\n", myterm, $1,scaled($2),scaled($3),scaled($4); -}' |sh - + item = $1 + 0; + 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 -