ncurses 5.9 - patch 20120908

+ add test-screens to test/ncurses to show 256-characters at a time,
  to help with mingw port.
This commit is contained in:
Thomas E. Dickey 2012-09-09 00:20:10 +00:00
parent cdbe3d3df7
commit a3754ea95e
6 changed files with 139 additions and 31 deletions

6
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.1952 2012/09/03 17:59:39 tom Exp $ -- $Id: NEWS,v 1.1953 2012/09/08 22:05:39 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,10 @@ 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.
20120908
+ add test-screens to test/ncurses to show 256-characters at a time,
to help with mingw port.
20120903 20120903
+ simplify varargs logic in lib_printw.c; va_copy is no longer needed + simplify varargs logic in lib_printw.c; va_copy is no longer needed
there. there.

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.891 2012/09/03 12:47:40 tom Exp $ # $Id: dist.mk,v 1.892 2012/09/08 15:40:37 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 = 20120903 NCURSES_PATCH = 20120908
# 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-20120903) unstable; urgency=low ncurses6 (5.9-20120908) unstable; urgency=low
* latest weekly patch * latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Mon, 03 Sep 2012 08:47:49 -0400 -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 08 Sep 2012 14:28:23 -0400
ncurses6 (5.9-20120608) unstable; urgency=low ncurses6 (5.9-20120608) unstable; urgency=low

View File

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

View File

@ -26,7 +26,7 @@
* authorization. * * authorization. *
****************************************************************************/ ****************************************************************************/
/* /*
* $Id: demo_menus.c,v 1.34 2012/06/09 20:30:33 tom Exp $ * $Id: demo_menus.c,v 1.35 2012/09/09 00:01:20 tom Exp $
* *
* Demonstrate a variety of functions from the menu library. * Demonstrate a variety of functions from the menu library.
* Thomas Dickey - 2005/4/9 * Thomas Dickey - 2005/4/9
@ -867,7 +867,7 @@ main(int argc, char *argv[])
#endif /* HAVE_RIPOFFLINE */ #endif /* HAVE_RIPOFFLINE */
#ifdef TRACE #ifdef TRACE
case 't': case 't':
trace(strtoul(optarg, 0, 0)); trace((unsigned) strtoul(optarg, 0, 0));
break; break;
#endif #endif
default: default:

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.373 2012/07/21 17:40:21 tom Exp $ $Id: ncurses.c,v 1.377 2012/09/08 23:58:58 tom Exp $
***************************************************************************/ ***************************************************************************/
@ -3011,15 +3011,46 @@ wide_slk_test(void)
#endif #endif
#endif /* SLK_INIT */ #endif /* SLK_INIT */
/* ISO 6429: codes 0x80 to 0x9f may be control characters that cause the static void
show_256_chars(int repeat, attr_t attr, short pair)
{
unsigned first = 0;
unsigned last = 255;
unsigned code;
int count;
erase();
attron(A_BOLD);
MvPrintw(0, 20, "Display of Character Codes %#0x to %#0x",
first, last);
attroff(A_BOLD);
refresh();
for (code = first; code <= last; ++code) {
int row = (int) (2 + (code / 16));
int col = (int) (5 * (code % 16));
mvaddch(row, col, colored_chtype(code, attr, pair));
for (count = 1; count < repeat; ++count) {
addch(colored_chtype(code, attr, pair));
}
}
}
/*
* Show a slice of 32 characters, allowing those to be repeated up to the
* screen's width.
*
* ISO 6429: codes 0x80 to 0x9f may be control characters that cause the
* terminal to perform functions. The remaining codes can be graphic. * terminal to perform functions. The remaining codes can be graphic.
*/ */
static void static void
show_upper_chars(unsigned first, int repeat, attr_t attr, short pair) show_upper_chars(int base, int pagesize, int repeat, attr_t attr, short pair)
{ {
bool C1 = (first == 128);
unsigned code; unsigned code;
unsigned last = first + 31; unsigned first = (unsigned) base;
unsigned last = first + (unsigned) pagesize - 2;
bool C1 = (first == 128);
int reply; int reply;
erase(); erase();
@ -3031,8 +3062,8 @@ show_upper_chars(unsigned first, int repeat, attr_t attr, short pair)
for (code = first; code <= last; code++) { for (code = first; code <= last; code++) {
int count = repeat; int count = repeat;
int row = 2 + ((int) (code - first) % 16); int row = 2 + ((int) (code - first) % (pagesize / 2));
int col = ((int) (code - first) / 16) * COLS / 2; int col = ((int) (code - first) / (pagesize / 2)) * COLS / 2;
char tmp[80]; char tmp[80];
sprintf(tmp, "%3u (0x%x)", code, code); sprintf(tmp, "%3u (0x%x)", code, code);
MvPrintw(row, col, "%*s: ", COLS / 4, tmp); MvPrintw(row, col, "%*s: ", COLS / 4, tmp);
@ -3206,6 +3237,7 @@ static void
acs_display(void) acs_display(void)
{ {
int c = 'a'; int c = 'a';
int pagesize = 32;
char *term = getenv("TERM"); char *term = getenv("TERM");
const char *pch_kludge = ((term != 0 && strstr(term, "linux")) const char *pch_kludge = ((term != 0 && strstr(term, "linux"))
? "p=PC, " ? "p=PC, "
@ -3233,6 +3265,13 @@ acs_display(void)
else else
beep(); beep();
break; break;
case 'w':
if (pagesize == 32) {
pagesize = 256;
} else {
pagesize = 32;
}
break;
case 'x': case 'x':
ToggleAcs(last_show_acs, show_box_chars); ToggleAcs(last_show_acs, show_box_chars);
break; break;
@ -3276,15 +3315,18 @@ acs_display(void)
} }
break; break;
} }
if (last_show_acs != 0) if (pagesize != 32) {
show_256_chars(repeat, attr, pair);
} else if (last_show_acs != 0) {
last_show_acs(repeat, attr, pair); last_show_acs(repeat, attr, pair);
else } else {
show_upper_chars((unsigned) (digit * 32 + 128), repeat, attr, pair); show_upper_chars(digit * pagesize + 128, pagesize, repeat, attr, pair);
}
MvPrintw(LINES - 3, 0, MvPrintw(LINES - 3, 0,
"Note: ANSI terminals may not display C1 characters."); "Note: ANSI terminals may not display C1 characters.");
MvPrintw(LINES - 2, 0, MvPrintw(LINES - 2, 0,
"Select: a=ACS, x=box, %s0=C1, 1-3,+/- non-ASCII, </> repeat, ESC=quit", "Select: a=ACS, w=all x=box, %s0=C1, 1-3,+/- non-ASCII, </> repeat, ESC=quit",
pch_kludge); pch_kludge);
if (use_colors) { if (use_colors) {
MvPrintw(LINES - 1, 0, MvPrintw(LINES - 1, 0,
@ -3323,6 +3365,53 @@ merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, short pair)
return dst; return dst;
} }
/*
* Header/legend take up no more than 8 lines, leaving 16 lines on a 24-line
* display. If there are no repeats, we could normally display 16 lines of 64
* characters (1024 total). However, taking repeats and double-width cells
* into account, use 256 characters for the page.
*/
static void
show_paged_widechars(int base,
int pagesize,
int repeat,
int space,
attr_t attr,
short pair)
{
int first = base * pagesize;
int last = first + pagesize - 1;
int per_line = 16;
cchar_t temp;
wchar_t code;
wchar_t codes[10];
erase();
attron(A_BOLD);
MvPrintw(0, 20, "Display of Character Codes %#x to %#x", first, last);
attroff(A_BOLD);
for (code = first; (int) code <= last; code++) {
int row = (2 + ((int) code - first) / per_line);
int col = 5 * ((int) code % per_line);
int count;
memset(&codes, 0, sizeof(codes));
codes[0] = code;
setcchar(&temp, codes, attr, pair, 0);
move(row, col);
if (wcwidth(code) == 0 && code != 0) {
addch((chtype) space |
(A_REVERSE ^ attr) |
(attr_t) COLOR_PAIR(pair));
}
add_wch(&temp);
for (count = 1; count < repeat; ++count) {
add_wch(&temp);
}
}
}
static void 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, short pair)
{ {
@ -3343,11 +3432,13 @@ show_upper_widechars(int first, int repeat, int space, attr_t attr, short pair)
int count = repeat; int count = repeat;
int y, x; int y, x;
memset(&codes, 0, sizeof(codes));
codes[0] = code;
sprintf(tmp, "%3ld (0x%lx)", (long) code, (long) code); sprintf(tmp, "%3ld (0x%lx)", (long) code, (long) code);
MvPrintw(row, col, "%*s: ", COLS / 4, tmp); MvPrintw(row, col, "%*s: ", COLS / 4, tmp);
memset(&codes, 0, sizeof(codes));
codes[0] = code;
setcchar(&temp, codes, attr, pair, 0); setcchar(&temp, codes, attr, pair, 0);
do { do {
/* /*
* Give non-spacing characters something to combine with. If we * Give non-spacing characters something to combine with. If we
@ -3361,10 +3452,10 @@ show_upper_widechars(int first, int repeat, int space, attr_t attr, short pair)
(attr_t) COLOR_PAIR(pair)); (attr_t) COLOR_PAIR(pair));
} }
/* /*
* This could use add_wch(), but is done for comparison with the * This uses echo_wchar(), for comparison with the normal 'f'
* normal 'f' test (and to make a test-case for echo_wchar()). * test (and to make a test-case for echo_wchar()). The screen
* The screen will flicker because the erase() at the top of the * may flicker because the erase() at the top of the function
* function is met by the builtin refresh() in echo_wchar(). * is met by the builtin refresh() in echo_wchar().
*/ */
echo_wchar(&temp); echo_wchar(&temp);
/* /*
@ -3692,6 +3783,7 @@ wide_acs_display(void)
int digit = 0; int digit = 0;
int repeat = 1; int repeat = 1;
int space = ' '; int space = ' ';
int pagesize = 32;
chtype attr = A_NORMAL; chtype attr = A_NORMAL;
int fg = COLOR_BLACK; int fg = COLOR_BLACK;
int bg = COLOR_BLACK; int bg = COLOR_BLACK;
@ -3717,6 +3809,13 @@ wide_acs_display(void)
ToggleAcs(last_show_wacs, show_wacs_chars_thick); ToggleAcs(last_show_wacs, show_wacs_chars_thick);
break; break;
#endif #endif
case 'w':
if (pagesize == 32) {
pagesize = 256;
} else {
pagesize = 32;
}
break;
case 'x': case 'x':
ToggleAcs(last_show_wacs, show_wbox_chars); ToggleAcs(last_show_wacs, show_wbox_chars);
break; break;
@ -3750,20 +3849,25 @@ wide_acs_display(void)
} }
break; break;
} }
if (last_show_wacs != 0) if (pagesize != 32) {
show_paged_widechars(digit, pagesize, repeat, space, attr, pair);
} else if (last_show_wacs != 0) {
last_show_wacs(repeat, attr, pair); last_show_wacs(repeat, attr, pair);
else } else {
show_upper_widechars(digit * 32 + 128, repeat, space, attr, pair); show_upper_widechars(digit * 32 + 128, repeat, space, attr, pair);
}
MvPrintw(LINES - 3, 0, MvPrintw(LINES - 4, 0,
"Select: a/d/t WACS, x box, u UTF-8, 0-9,+/- non-ASCII, </> repeat, ESC=quit"); "Select: a/d/t WACS, w=all x=box, u UTF-8, ^L repaint");
MvPrintw(LINES - 3, 2,
"0-9,+/- non-ASCII, </> repeat, _ space, ESC=quit");
if (use_colors) { if (use_colors) {
MvPrintw(LINES - 2, 0, MvPrintw(LINES - 2, 2,
"v/V, f/F, b/B cycle through video attributes (%s) and color %d/%d.", "v/V, f/F, b/B cycle through video attributes (%s) and color %d/%d.",
attrs_to_cycle[at_code].name, attrs_to_cycle[at_code].name,
fg, bg); fg, bg);
} else { } else {
MvPrintw(LINES - 2, 0, MvPrintw(LINES - 2, 2,
"v/V cycles through video attributes (%s).", "v/V cycles through video attributes (%s).",
attrs_to_cycle[at_code].name); attrs_to_cycle[at_code].name);
} }