ncurses 5.9 - patch 20150328

+ add "-f" option to test/savescreen.c to help with testing/debugging
  the extended putwin/getwin.
+ add logic for writing/reading combining characters in the extended
  putwin/getwin.
+ add "--enable-ext-putwin" configure option to turn on the extended
  putwin/getwin.
This commit is contained in:
Thomas E. Dickey 2015-03-29 01:05:49 +00:00
parent 87f20fc6e7
commit fe6abf0923
18 changed files with 2153 additions and 2020 deletions

10
INSTALL
View File

@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: INSTALL,v 1.184 2015/01/24 23:24:22 tom Exp $
-- $Id: INSTALL,v 1.185 2015/03/28 00:34:22 tom Exp $
---------------------------------------------------------------------
How to install Ncurses/Terminfo on your system
---------------------------------------------------------------------
@ -546,6 +546,14 @@ SUMMARY OF CONFIGURE OPTIONS:
compatible with libncursesw 5.4. None of the interfaces change, but
applications which have mouse mask mmask_t's must be recompiled.
--enable-ext-putwin
Modify the file-format written by putwin() to use printable text rather
than binary files, allowing getwin() to read screen dumps written by
differently-configured ncurses libraries. The extended getwin() can
still read binary screen dumps from the "same" configuration of
ncurses. This does not change the ABI (the binary interface seen by
calling applications).
--enable-getcap
Use the 4.4BSD getcap code if available, or a bundled version of it to
fetch termcap entries. Entries read in this way cannot use (make

10
NEWS
View File

@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: NEWS,v 1.2360 2015/03/21 23:44:50 tom Exp $
-- $Id: NEWS,v 1.2363 2015/03/28 21:50:39 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.
20150328
+ add "-f" option to test/savescreen.c to help with testing/debugging
the extended putwin/getwin.
+ add logic for writing/reading combining characters in the extended
putwin/getwin.
+ add "--enable-ext-putwin" configure option to turn on the extended
putwin/getwin.
20150321
+ in-progress changes to provide an extended version of putwin and
getwin which will be capable of reading screen-dumps between the

View File

@ -1 +1 @@
5:0:9 5.9 20150321
5:0:9 5.9 20150328

3954
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -28,14 +28,14 @@ dnl***************************************************************************
dnl
dnl Author: Thomas E. Dickey 1995-on
dnl
dnl $Id: configure.in,v 1.599 2015/02/21 21:12:07 tom Exp $
dnl $Id: configure.in,v 1.600 2015/03/27 10:48:27 tom Exp $
dnl Process this file with autoconf to produce a configure script.
dnl
dnl See http://invisible-island.net/autoconf/ for additional information.
dnl
dnl ---------------------------------------------------------------------------
AC_PREREQ(2.52.20030208)
AC_REVISION($Revision: 1.599 $)
AC_REVISION($Revision: 1.600 $)
AC_INIT(ncurses/base/lib_initscr.c)
AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
@ -1076,6 +1076,17 @@ if test "x$with_ext_mouse" = xyes ; then
fi
AC_SUBST(NCURSES_MOUSE_VERSION)
### use option --enable-ext-putwin to turn on extended screendumps
AC_MSG_CHECKING(if you want to use extended putwin/screendump)
AC_ARG_ENABLE(ext-colors,
[ --enable-ext-putwin compile with extended putwin/screendump],
[with_ext_putwin=$enableval],
[with_ext_putwin=no])
AC_MSG_RESULT($with_ext_putwin)
if test "x$with_ext_putwin" = xyes ; then
AC_DEFINE(NCURSES_EXT_PUTWIN,1,[Define to 1 to compile with extended putwin/screendump])
fi
AC_MSG_CHECKING(if you want \$NCURSES_NO_PADDING code)
AC_ARG_ENABLE(no-padding,
[ --enable-no-padding compile with $NCURSES_NO_PADDING code],

View File

@ -25,7 +25,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# $Id: dist.mk,v 1.1039 2015/03/21 16:25:11 tom Exp $
# $Id: dist.mk,v 1.1040 2015/03/27 10:27:01 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 = 20150321
NCURSES_PATCH = 20150328
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)

View File

@ -1,4 +1,4 @@
# $Id: ncurses_defs,v 1.68 2015/03/21 16:52:07 tom Exp $
# $Id: ncurses_defs,v 1.69 2015/03/27 10:47:31 tom Exp $
##############################################################################
# Copyright (c) 2000-2014,2015 Free Software Foundation, Inc. #
# #
@ -189,7 +189,7 @@ NCURSES_CHAR_EQ
NCURSES_EXPANDED
NCURSES_EXT_COLORS
NCURSES_EXT_FUNCS
NCURSES_EXT_SCREEN_DUMP
NCURSES_EXT_PUTWIN
NCURSES_NO_PADDING
NCURSES_OSPEED_COMPAT
NCURSES_PATHSEP ':'

View File

@ -41,18 +41,16 @@
#define CUR SP_TERMTYPE
#endif
MODULE_ID("$Id: lib_screen.c,v 1.64 2015/03/21 23:59:32 tom Exp $")
MODULE_ID("$Id: lib_screen.c,v 1.70 2015/03/29 00:16:00 tom Exp $")
#define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */
#define MARKER '\\'
#define APPEND '+'
#define GUTTER '|'
#define L_CURL '{'
#define R_CURL '}'
#define L_MARK "\\{"
#define R_MARK "}"
/*
* Use 0x8888 as the magic number for new-format files, since it cannot be
* mistaken for the _cury/_curx pair of 16-bit numbers which start the old
@ -61,7 +59,7 @@ MODULE_ID("$Id: lib_screen.c,v 1.64 2015/03/21 23:59:32 tom Exp $")
static char my_magic[] =
{'\210', '\210', '\210', '\210'};
#if NCURSES_EXT_SCREEN_DUMP
#if NCURSES_EXT_PUTWIN
typedef enum {
pINT /* int */
,pSHORT /* short */
@ -266,10 +264,12 @@ decode_char(char *source, int *target)
T(("decode_char '%s'", source));
*target = ' ';
switch (*source) {
case '\\':
case MARKER:
switch (*++source) {
case '\\':
*target = '\\';
case APPEND:
break;
case MARKER:
*target = MARKER;
++source;
break;
case 's':
@ -322,6 +322,7 @@ decode_chtype(char *source, chtype fillin, chtype *target)
source = decode_attr(source, &attr, &color);
source = decode_char(source, &value);
*target = ChCharOf(value) | attr | COLOR_PAIR(color);
/* FIXME - ignore combining characters */
return source;
}
@ -332,6 +333,7 @@ decode_cchar(char *source, cchar_t *fillin, cchar_t *target)
int color;
attr_t attr = fillin->attr;
wchar_t chars[CCHARW_MAX];
int append = 0;
T(("decode_cchar '%s'", source));
*target = blank;
@ -343,7 +345,15 @@ decode_cchar(char *source, cchar_t *fillin, cchar_t *target)
source = decode_attr(source, &attr, &color);
memset(chars, 0, sizeof(chars));
source = decode_char(source, &chars[0]);
/* FIXME - handle combining characters at this point */
/* handle combining characters */
while (source[0] == MARKER && source[1] == APPEND) {
int value;
source += 2;
source = decode_char(source, &value);
if (append++ < CCHARW_MAX) {
chars[append] = value;
}
}
setcchar(target, chars, attr, (short) color, NULL);
return source;
}
@ -423,7 +433,18 @@ read_row(char *source, NCURSES_CH_T * prior, NCURSES_CH_T * target, int length)
{
while (*source != '\0' && length > 0) {
#if NCURSES_WIDECHAR
int n, len;
source = decode_cchar(source, prior, target);
len = wcwidth(target->chars[0]);
if (len > 1) {
SetWidecExt(CHDEREF(target), 0);
for (n = 1; n < len; ++n) {
target[n] = target[0];
SetWidecExt(CHDEREF(target), n);
}
target += (len - 1);
length -= (len - 1);
}
#else
source = decode_chtype(source, *prior, target);
#endif
@ -437,7 +458,7 @@ read_row(char *source, NCURSES_CH_T * prior, NCURSES_CH_T * target, int length)
/* FIXME - see what error conditions should apply if I need to return ERR */
return 0;
}
#endif /* NCURSES_EXT_SCREEN_DUMP */
#endif /* NCURSES_EXT_PUTWIN */
/*
* Originally, getwin/putwin used fread/fwrite, because they used binary data.
@ -487,7 +508,7 @@ NCURSES_SP_NAME(getwin) (NCURSES_SP_DCLx FILE *filep)
* If this is a new-format file, and we do not support it, give up.
*/
if (!memcmp(&tmp, my_magic, 4)) {
#if NCURSES_EXT_SCREEN_DUMP
#if NCURSES_EXT_PUTWIN
if (read_win(&tmp, filep) < 0)
#endif
returnWin(0);
@ -563,7 +584,7 @@ NCURSES_SP_NAME(getwin) (NCURSES_SP_DCLx FILE *filep)
}
}
}
#if NCURSES_EXT_SCREEN_DUMP
#if NCURSES_EXT_PUTWIN
else {
char *txt;
bool success = TRUE;
@ -616,17 +637,20 @@ getwin(FILE *filep)
}
#endif
#if NCURSES_EXT_SCREEN_DUMP
#if NCURSES_EXT_PUTWIN
static void
encode_attr(char *target, attr_t source, attr_t prior)
{
source &= ~A_CHARTEXT;
prior &= ~A_CHARTEXT;
*target = '\0';
if (source != prior) {
size_t n;
bool first = TRUE;
strcpy(target, L_MARK);
target += strlen(target);
*target++ = MARKER;
*target++ = L_CURL;
for (n = 0; n < SIZEOF(scr_attrs); ++n) {
if ((source & scr_attrs[n].attr) != 0 ||
@ -648,7 +672,8 @@ encode_attr(char *target, attr_t source, attr_t prior)
target += strlen(target);
}
strcpy(target, R_MARK);
*target++ = R_CURL;
*target = '\0';
}
}
@ -665,28 +690,34 @@ encode_cell(char *target, CARG_CH_T source, CARG_CH_T previous)
target += strlen(target);
#if NCURSES_EXT_COLORS
if (previous->ext_color != source->ext_color) {
sprintf(target, "%sC%d%s", L_MARK, source->ext_color, R_MARK);
sprintf(target, "%c%cC%d%c", MARKER, L_CURL, source->ext_color, R_CURL);
}
#endif
for (n = 0; n < SIZEOF(source->chars); ++n) {
if (source->chars[n] == 0)
continue;
if (n) {
*target++ = MARKER;
*target++ = APPEND;
}
*target++ = MARKER;
if (source->chars[n] > 0xffff) {
sprintf(target, "\\U%08x", source->chars[n]);
sprintf(target, "U%08x", source->chars[n]);
} else if (source->chars[n] > 0xff) {
sprintf(target, "\\u%04x", source->chars[n]);
sprintf(target, "u%04x", source->chars[n]);
} else if (source->chars[n] < 32 || source->chars[n] >= 127) {
sprintf(target, "\\%03o", source->chars[n] & 0xff);
sprintf(target, "%03o", source->chars[n] & 0xff);
} else {
switch (source->chars[n]) {
case ' ':
strcpy(target, "\\s");
strcpy(target, "s");
break;
case '\\':
strcpy(target, "\\\\");
case MARKER:
*target++ = MARKER;
*target = '\0';
break;
default:
sprintf(target, "%c", source->chars[n]);
sprintf(--target, "%c", source->chars[n]);
break;
}
}
@ -700,18 +731,20 @@ encode_cell(char *target, CARG_CH_T source, CARG_CH_T previous)
encode_attr(target, AttrOfD(source), AttrOfD(previous));
}
target += strlen(target);
*target++ = MARKER;
if (ch < 32 || ch >= 127) {
sprintf(target, "\\%03o", ch);
sprintf(target, "%03o", ch);
} else {
switch (ch) {
case ' ':
strcpy(target, "\\s");
strcpy(target, "s");
break;
case '\\':
strcpy(target, "\\\\");
case MARKER:
*target++ = MARKER;
*target = '\0';
break;
default:
sprintf(target, "%c", ch);
sprintf(--target, "%c", ch);
break;
}
}
@ -728,7 +761,7 @@ putwin(WINDOW *win, FILE *filep)
T((T_CALLED("putwin(%p,%p)"), (void *) win, (void *) filep));
#if NCURSES_EXT_SCREEN_DUMP
#if NCURSES_EXT_PUTWIN
if (win != 0) {
const char *version = curses_version();
char buffer[1024];
@ -808,9 +841,12 @@ putwin(WINDOW *win, FILE *filep)
|| ferror(filep))
returnCode(code);
for (x = 0; x <= win->_maxx; x++) {
int len = wcwidth(data[x].chars[0]);
encode_cell(buffer, CHREF(data[x]), CHREF(last_cell));
last_cell = data[x];
PUTS(buffer);
if (len > 1)
x += (len - 1);
}
PUTS("\n");
}

View File

@ -1,8 +1,8 @@
ncurses6 (5.9+20150321) unstable; urgency=low
ncurses6 (5.9+20150328) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 21 Mar 2015 12:25:03 -0400
-- Thomas E. Dickey <dickey@invisible-island.net> Fri, 27 Mar 2015 06:27:01 -0400
ncurses6 (5.9-20131005) unstable; urgency=low

View File

@ -35,6 +35,7 @@ CONFIG_OPTIONS = \
--enable-const \
--enable-ext-colors \
--enable-ext-mouse \
--enable-ext-putwin \
--enable-interop \
--enable-sp-funcs \
--enable-term-driver \

View File

@ -1,8 +1,8 @@
ncurses6 (5.9+20150321) unstable; urgency=low
ncurses6 (5.9+20150328) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 21 Mar 2015 12:25:03 -0400
-- Thomas E. Dickey <dickey@invisible-island.net> Fri, 27 Mar 2015 06:27:01 -0400
ncurses6 (5.9-20131005) unstable; urgency=low

View File

@ -35,6 +35,7 @@ CONFIG_OPTIONS = \
--enable-const \
--enable-ext-colors \
--enable-ext-mouse \
--enable-ext-putwin \
--enable-interop \
--enable-sp-funcs \
--enable-term-driver \

View File

@ -1,8 +1,8 @@
ncurses6 (5.9+20150321) unstable; urgency=low
ncurses6 (5.9+20150328) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 21 Mar 2015 12:25:03 -0400
-- Thomas E. Dickey <dickey@invisible-island.net> Fri, 27 Mar 2015 06:27:01 -0400
ncurses6 (5.9-20120608) unstable; urgency=low

View File

@ -49,6 +49,7 @@ configure-stamp:
--enable-const \
--enable-ext-colors \
--enable-ext-mouse \
--enable-ext-putwin \
--enable-hard-tabs \
--enable-interop \
--enable-pc-files \

View File

@ -1,4 +1,4 @@
; $Id: mingw-ncurses.nsi,v 1.92 2015/03/21 16:25:11 tom Exp $
; $Id: mingw-ncurses.nsi,v 1.93 2015/03/27 10:27:01 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 "2015"
!define VERSION_MMDD "0321"
!define VERSION_MMDD "0328"
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}
!define MY_ABI "5"

View File

@ -3,7 +3,7 @@
Summary: shared libraries for terminal handling
Name: mingw32-ncurses6
Version: 5.9
Release: 20150321
Release: 20150328
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
@ -53,6 +53,7 @@ This package is used for testing ABI 6 with cross-compiles to MinGW.
--enable-const \\\
--enable-ext-colors \\\
--enable-ext-mouse \\\
--enable-ext-putwin \\\
--enable-interop \\\
--enable-sp-funcs \\\
--enable-term-driver \\\

View File

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

View File

@ -26,7 +26,7 @@
* authorization. *
****************************************************************************/
/*
* $Id: savescreen.c,v 1.23 2015/03/21 21:35:00 tom Exp $
* $Id: savescreen.c,v 1.27 2015/03/28 23:21:28 tom Exp $
*
* Demonstrate save/restore functions from the curses library.
* Thomas Dickey - 2007/7/14
@ -211,6 +211,7 @@ usage(void)
"Usage: savescreen [-r] files",
"",
"Options:",
" -f file fill/initialize screen using text from this file",
" -i use scr_init/scr_restore rather than scr_set",
" -k keep the restored dump-files rather than removing them",
" -r replay the screen-dump files"
@ -231,11 +232,19 @@ main(int argc, char *argv[])
bool replaying = FALSE;
bool done = FALSE;
char **files;
char *fill_by = 0;
#if USE_WIDEC_SUPPORT
cchar_t mycc;
int myxx;
#endif
setlocale(LC_ALL, "");
while ((ch = getopt(argc, argv, "ikr")) != -1) {
while ((ch = getopt(argc, argv, "f:ikr")) != -1) {
switch (ch) {
case 'f':
fill_by = optarg;
break;
case 'i':
use_init = TRUE;
break;
@ -281,6 +290,31 @@ main(int argc, char *argv[])
}
}
if (fill_by != 0) {
FILE *fp = fopen(fill_by, "r");
if (fp != 0) {
bool filled = FALSE;
move(1, 0);
while ((ch = fgetc(fp)) != EOF) {
if (addch(UChar(ch)) == ERR) {
filled = TRUE;
break;
}
}
fclose(fp);
if (!filled) {
while (addch(' ') != ERR) {
;
}
}
move(0, 0);
} else {
endwin();
fprintf(stderr, "Cannot open \"%s\"\n", fill_by);
ExitProgram(EXIT_FAILURE);
}
}
if (replaying) {
/*
@ -385,7 +419,17 @@ main(int argc, char *argv[])
for (cx = 0; cx < COLS; ++cx) {
wmove(curscr, cy, cx);
wmove(stdscr, cy, cx);
#if USE_WIDEC_SUPPORT
if (win_wch(curscr, &mycc) != ERR) {
myxx = wcwidth(mycc.chars[0]);
if (myxx > 0) {
wadd_wchnstr(stdscr, &mycc, 1);
cx += (myxx - 1);
}
}
#else
waddch(stdscr, winch(curscr));
#endif
}
}
}