mirror of
https://github.com/Aigor44/ncursesw-morphos.git
synced 2025-03-07 16:16:53 +08:00
ncurses 6.1 - patch 20181124
+ check --with-fallbacks option to ensure there is a value, and add the fallback information to top-level Makefile summary. + add some traces in initialization to show whether a fallback entry is used. + build-fix for test/movewindow with ncurses-examples on Solaris. + add "-l" option to test/background, to dump screen contents in a form that lets different curses implementations be compared. + modify the initialization checks for mouse so that the xterm+sm+1006 block will work with terminal descriptions not mentioning xterm (report by Tomas Janousek).
This commit is contained in:
parent
bf5877fb3d
commit
44963481f1
2
MANIFEST
2
MANIFEST
@ -1115,6 +1115,8 @@
|
||||
./test/dots_mvcur.c
|
||||
./test/dots_termcap.c
|
||||
./test/dots_xcurses.c
|
||||
./test/dump_window.c
|
||||
./test/dump_window.h
|
||||
./test/echochar.c
|
||||
./test/edit_field.c
|
||||
./test/edit_field.h
|
||||
|
@ -1,6 +1,6 @@
|
||||
# $Id: Makefile.in,v 1.40 2015/08/05 23:15:41 tom Exp $
|
||||
# $Id: Makefile.in,v 1.41 2018/11/24 22:38:10 tom Exp $
|
||||
##############################################################################
|
||||
# Copyright (c) 1998-2014,2015 Free Software Foundation, Inc. #
|
||||
# Copyright (c) 1998-2015,2018 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"), #
|
||||
@ -83,6 +83,7 @@ preinstall :
|
||||
@ echo ' include directory: '$(include_dir)
|
||||
@ echo ' man directory: '$(mandir)
|
||||
@MAKE_TERMINFO@ @ echo ' terminfo directory: '$(ticdir)
|
||||
@USE_FALLBACKS@ @ echo ' using fallback-list: '@FALLBACK_LIST@
|
||||
@MAKE_PC_FILES@ @ echo ' pkg-config directory: '$(pkgdir)
|
||||
@ echo ''
|
||||
@ test "$(include_dir)" = "$(prefix)/include" || \
|
||||
|
14
NEWS
14
NEWS
@ -25,7 +25,7 @@
|
||||
-- sale, use or other dealings in this Software without prior written --
|
||||
-- authorization. --
|
||||
-------------------------------------------------------------------------------
|
||||
-- $Id: NEWS,v 1.3214 2018/11/17 22:45:23 tom Exp $
|
||||
-- $Id: NEWS,v 1.3219 2018/11/24 22:39:15 tom Exp $
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
This is a log of changes that ncurses has gone through since Zeyd started
|
||||
@ -45,6 +45,18 @@ 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.
|
||||
|
||||
20181124
|
||||
+ check --with-fallbacks option to ensure there is a value, and add
|
||||
the fallback information to top-level Makefile summary.
|
||||
+ add some traces in initialization to show whether a fallback entry is
|
||||
used.
|
||||
+ build-fix for test/movewindow with ncurses-examples on Solaris.
|
||||
+ add "-l" option to test/background, to dump screen contents in a form
|
||||
that lets different curses implementations be compared.
|
||||
+ modify the initialization checks for mouse so that the xterm+sm+1006
|
||||
block will work with terminal descriptions not mentioning xterm
|
||||
(report by Tomas Janousek).
|
||||
|
||||
20181117
|
||||
+ ignore the hex/b64 $TERMINFO in toe's listing.
|
||||
+ correct a status-check in _nc_read_tic_entry() so that if reading
|
||||
|
21
configure.in
21
configure.in
@ -28,14 +28,14 @@ dnl***************************************************************************
|
||||
dnl
|
||||
dnl Author: Thomas E. Dickey 1995-on
|
||||
dnl
|
||||
dnl $Id: configure.in,v 1.671 2018/11/11 01:12:44 tom Exp $
|
||||
dnl $Id: configure.in,v 1.672 2018/11/24 22:37:01 tom Exp $
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
dnl See https://invisible-island.net/autoconf/ for additional information.
|
||||
dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
AC_PREREQ(2.52.20170501)
|
||||
AC_REVISION($Revision: 1.671 $)
|
||||
AC_REVISION($Revision: 1.672 $)
|
||||
AC_INIT(ncurses/base/lib_initscr.c)
|
||||
AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
|
||||
|
||||
@ -611,8 +611,23 @@ AC_ARG_WITH(fallbacks,
|
||||
[with_fallback=$withval],
|
||||
[with_fallback=])
|
||||
AC_MSG_RESULT($with_fallback)
|
||||
FALLBACK_LIST=`test "$with_fallback" != no && echo "$with_fallback" | sed -e 's/,/ /g'`
|
||||
|
||||
case ".$with_fallback" in
|
||||
(.|.no)
|
||||
FALLBACK_LIST=
|
||||
;;
|
||||
(.yes)
|
||||
AC_MSG_WARN(expected a list of terminal descriptions)
|
||||
;;
|
||||
(*)
|
||||
FALLBACK_LIST=`echo "$with_fallback" | sed -e 's/,/ /g'`
|
||||
;;
|
||||
esac
|
||||
|
||||
USE_FALLBACKS=
|
||||
test -z "$FALLBACK_LIST" && USE_FALLBACKS="#"
|
||||
AC_SUBST(FALLBACK_LIST)
|
||||
AC_SUBST(USE_FALLBACKS)
|
||||
|
||||
AC_MSG_CHECKING(if you want modern xterm or antique)
|
||||
AC_ARG_WITH(xterm-new,
|
||||
|
4
dist.mk
4
dist.mk
@ -25,7 +25,7 @@
|
||||
# use or other dealings in this Software without prior written #
|
||||
# authorization. #
|
||||
##############################################################################
|
||||
# $Id: dist.mk,v 1.1251 2018/11/17 15:41:00 tom Exp $
|
||||
# $Id: dist.mk,v 1.1252 2018/11/24 14:57:06 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 = 1
|
||||
NCURSES_PATCH = 20181117
|
||||
NCURSES_PATCH = 20181124
|
||||
|
||||
# We don't append the patch to the version, since this only applies to releases
|
||||
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
|
||||
|
@ -84,7 +84,7 @@
|
||||
#define CUR SP_TERMTYPE
|
||||
#endif
|
||||
|
||||
MODULE_ID("$Id: lib_mouse.c,v 1.179 2018/10/20 18:33:23 tom Exp $")
|
||||
MODULE_ID("$Id: lib_mouse.c,v 1.181 2018/11/24 17:28:37 tom Exp $")
|
||||
|
||||
#include <tic.h>
|
||||
|
||||
@ -605,7 +605,7 @@ initialize_mousetype(SCREEN *sp)
|
||||
#if USE_EMX_MOUSE
|
||||
if (!sp->_emxmouse_thread
|
||||
&& strstr(SP_TERMTYPE term_names, "xterm") == 0
|
||||
&& key_mouse) {
|
||||
&& NonEmpty(key_mouse)) {
|
||||
int handles[2];
|
||||
|
||||
if (pipe(handles) < 0) {
|
||||
@ -716,11 +716,8 @@ initialize_mousetype(SCREEN *sp)
|
||||
CallDriver(sp, td_initmouse);
|
||||
#else
|
||||
/* we know how to recognize mouse events under "xterm" */
|
||||
if (key_mouse != 0) {
|
||||
if (!strcmp(key_mouse, xterm_kmous)
|
||||
|| strstr(SP_TERMTYPE term_names, "xterm") != 0) {
|
||||
init_xterm_mouse(sp);
|
||||
}
|
||||
if (NonEmpty(key_mouse)) {
|
||||
init_xterm_mouse(sp);
|
||||
} else if (strstr(SP_TERMTYPE term_names, "xterm") != 0) {
|
||||
if (_nc_add_to_try(&(sp->_keytry), xterm_kmous, KEY_MOUSE) == OK)
|
||||
init_xterm_mouse(sp);
|
||||
|
@ -34,7 +34,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* $Id: curses.priv.h,v 1.606 2018/09/01 20:16:30 tom Exp $
|
||||
* $Id: curses.priv.h,v 1.607 2018/11/24 17:27:36 tom Exp $
|
||||
*
|
||||
* curses.priv.h
|
||||
*
|
||||
@ -1763,6 +1763,7 @@ typedef void VoidFunc(void);
|
||||
|
||||
#define TR_FUNC(value) ((const char*) (value))
|
||||
#define NonNull(s) ((s) != 0 ? s : "<null>")
|
||||
#define NonEmpty(s) ((s) != 0 && *(s) != '\0')
|
||||
|
||||
#define returnAttr(code) TRACE_RETURN(code,attr_t)
|
||||
#define returnBits(code) TRACE_RETURN(code,unsigned)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2006-2016,2017 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 2006-2017,2018 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 *
|
||||
@ -43,7 +43,7 @@
|
||||
#include <hashed_db.h>
|
||||
#endif
|
||||
|
||||
MODULE_ID("$Id: db_iterator.c,v 1.46 2017/07/01 22:54:42 tom Exp $")
|
||||
MODULE_ID("$Id: db_iterator.c,v 1.47 2018/11/24 22:42:01 tom Exp $")
|
||||
|
||||
#define HaveTicDirectory _nc_globals.have_tic_directory
|
||||
#define KeepTicDirectory _nc_globals.keep_tic_directory
|
||||
@ -148,6 +148,7 @@ update_getenv(const char *name, DBDIRS which)
|
||||
return result;
|
||||
}
|
||||
|
||||
#if NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP
|
||||
static char *
|
||||
cache_getenv(const char *name, DBDIRS which)
|
||||
{
|
||||
@ -159,6 +160,7 @@ cache_getenv(const char *name, DBDIRS which)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The cache expires if at least a second has passed since the initial lookup,
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
MODULE_ID("$Id: lib_setup.c,v 1.196 2018/09/08 20:14:26 tom Exp $")
|
||||
MODULE_ID("$Id: lib_setup.c,v 1.197 2018/11/24 22:13:16 tom Exp $")
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
@ -746,7 +746,9 @@ TINFO_SETUP_TERM(TERMINAL **tp,
|
||||
#else
|
||||
#if NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP
|
||||
status = _nc_setup_tinfo(tname, &TerminalType(termp));
|
||||
T(("_nc_setup_tinfo returns %d", status));
|
||||
#else
|
||||
T(("no database available"));
|
||||
status = TGETENT_NO;
|
||||
#endif
|
||||
|
||||
@ -755,6 +757,7 @@ TINFO_SETUP_TERM(TERMINAL **tp,
|
||||
const TERMTYPE2 *fallback = _nc_fallback2(tname);
|
||||
|
||||
if (fallback) {
|
||||
T(("found fallback entry"));
|
||||
TerminalType(termp) = *fallback;
|
||||
status = TGETENT_YES;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
MODULE_ID("$Id: tinfo_driver.c,v 1.60 2018/09/08 21:11:49 tom Exp $")
|
||||
MODULE_ID("$Id: tinfo_driver.c,v 1.63 2018/11/24 22:17:03 tom Exp $")
|
||||
|
||||
/*
|
||||
* SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS,
|
||||
@ -162,7 +162,9 @@ drv_CanHandle(TERMINAL_CONTROL_BLOCK * TCB, const char *tname, int *errret)
|
||||
|
||||
#if (NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP)
|
||||
status = _nc_setup_tinfo(tname, &TerminalType(termp));
|
||||
T(("_nc_setup_tinfo returns %d", status));
|
||||
#else
|
||||
T(("no database available"));
|
||||
status = TGETENT_NO;
|
||||
#endif
|
||||
|
||||
@ -171,6 +173,7 @@ drv_CanHandle(TERMINAL_CONTROL_BLOCK * TCB, const char *tname, int *errret)
|
||||
const TERMTYPE2 *fallback = _nc_fallback2(tname);
|
||||
|
||||
if (fallback) {
|
||||
T(("found fallback entry"));
|
||||
TerminalType(termp) = *fallback;
|
||||
status = TGETENT_YES;
|
||||
}
|
||||
@ -894,11 +897,8 @@ drv_initmouse(TERMINAL_CONTROL_BLOCK * TCB)
|
||||
|
||||
/* we know how to recognize mouse events under "xterm" */
|
||||
if (sp != 0) {
|
||||
if (key_mouse != 0) {
|
||||
if (!strcmp(key_mouse, xterm_kmous)
|
||||
|| strstr(SP_TERMTYPE term_names, "xterm") != 0) {
|
||||
init_xterm_mouse(sp);
|
||||
}
|
||||
if (NonEmpty(key_mouse)) {
|
||||
init_xterm_mouse(sp);
|
||||
} else if (strstr(SP_TERMTYPE term_names, "xterm") != 0) {
|
||||
if (_nc_add_to_try(&(sp->_keytry), xterm_kmous, KEY_MOUSE) == OK)
|
||||
init_xterm_mouse(sp);
|
||||
|
@ -1,8 +1,8 @@
|
||||
ncurses6 (6.1+20181117) unstable; urgency=low
|
||||
ncurses6 (6.1+20181124) unstable; urgency=low
|
||||
|
||||
* latest weekly patch
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Nov 2018 10:41:00 -0500
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 24 Nov 2018 09:57:06 -0500
|
||||
|
||||
ncurses6 (5.9-20131005) unstable; urgency=low
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
ncurses6 (6.1+20181117) unstable; urgency=low
|
||||
ncurses6 (6.1+20181124) unstable; urgency=low
|
||||
|
||||
* latest weekly patch
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Nov 2018 10:41:00 -0500
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 24 Nov 2018 09:57:06 -0500
|
||||
|
||||
ncurses6 (5.9-20131005) unstable; urgency=low
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
ncurses6 (6.1+20181117) unstable; urgency=low
|
||||
ncurses6 (6.1+20181124) unstable; urgency=low
|
||||
|
||||
* latest weekly patch
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Nov 2018 10:41:00 -0500
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 24 Nov 2018 09:57:06 -0500
|
||||
|
||||
ncurses6 (5.9-20120608) unstable; urgency=low
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
; $Id: mingw-ncurses.nsi,v 1.298 2018/11/17 15:41:00 tom Exp $
|
||||
; $Id: mingw-ncurses.nsi,v 1.299 2018/11/24 14:57:06 tom Exp $
|
||||
|
||||
; TODO add examples
|
||||
; TODO bump ABI to 6
|
||||
@ -10,7 +10,7 @@
|
||||
!define VERSION_MAJOR "6"
|
||||
!define VERSION_MINOR "1"
|
||||
!define VERSION_YYYY "2018"
|
||||
!define VERSION_MMDD "1117"
|
||||
!define VERSION_MMDD "1124"
|
||||
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}
|
||||
|
||||
!define MY_ABI "5"
|
||||
|
@ -3,7 +3,7 @@
|
||||
Summary: shared libraries for terminal handling
|
||||
Name: mingw32-ncurses6
|
||||
Version: 6.1
|
||||
Release: 20181117
|
||||
Release: 20181124
|
||||
License: X11
|
||||
Group: Development/Libraries
|
||||
Source: ncurses-%{version}-%{release}.tgz
|
||||
|
@ -1,7 +1,7 @@
|
||||
Summary: shared libraries for terminal handling
|
||||
Name: ncurses6
|
||||
Version: 6.1
|
||||
Release: 20181117
|
||||
Release: 20181124
|
||||
License: X11
|
||||
Group: Development/Libraries
|
||||
Source: ncurses-%{version}-%{release}.tgz
|
||||
|
@ -1,7 +1,7 @@
|
||||
Summary: Curses library with POSIX thread support.
|
||||
Name: ncursest6
|
||||
Version: 6.1
|
||||
Release: 20181117
|
||||
Release: 20181124
|
||||
License: X11
|
||||
Group: Development/Libraries
|
||||
Source: ncurses-%{version}-%{release}.tgz
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2003-2014,2017 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 2003-2017,2018 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 *
|
||||
@ -26,12 +26,13 @@
|
||||
* authorization. *
|
||||
****************************************************************************/
|
||||
/*
|
||||
* $Id: background.c,v 1.17 2017/09/29 22:54:33 tom Exp $
|
||||
* $Id: background.c,v 1.18 2018/11/24 20:28:45 tom Exp $
|
||||
*/
|
||||
|
||||
#define NEED_COLOR_CODE 1
|
||||
#define NEED_COLOR_NAME 1
|
||||
#include <color_name.h>
|
||||
#include <dump_window.h>
|
||||
|
||||
static int default_bg = COLOR_BLACK;
|
||||
static int default_fg = COLOR_WHITE;
|
||||
@ -48,19 +49,19 @@ test_background(void)
|
||||
} else {
|
||||
printw("pair 0 contains (%d,%d)\n", (int) f, (int) b);
|
||||
}
|
||||
getch();
|
||||
dump_window(stdscr);
|
||||
|
||||
printw("Initializing pair 1 to red/%s\n", color_name(default_bg));
|
||||
init_pair(1, COLOR_RED, (NCURSES_COLOR_T) default_bg);
|
||||
bkgdset((chtype) (' ' | COLOR_PAIR(1)));
|
||||
printw("RED/BLACK\n");
|
||||
getch();
|
||||
dump_window(stdscr);
|
||||
|
||||
printw("Initializing pair 2 to %s/blue\n", color_name(default_fg));
|
||||
init_pair(2, (NCURSES_COLOR_T) default_fg, COLOR_BLUE);
|
||||
bkgdset((chtype) (' ' | COLOR_PAIR(2)));
|
||||
printw("This line should be %s/blue\n", color_name(default_fg));
|
||||
getch();
|
||||
dump_window(stdscr);
|
||||
|
||||
printw("Initializing pair 3 to %s/cyan (ACS_HLINE)\n", color_name(default_fg));
|
||||
init_pair(3, (NCURSES_COLOR_T) default_fg, COLOR_CYAN);
|
||||
@ -94,36 +95,36 @@ test_background(void)
|
||||
for (chr = 0; chr < 32; ++chr)
|
||||
AddCh(' ');
|
||||
printw("j\n");
|
||||
getch();
|
||||
dump_window(stdscr);
|
||||
|
||||
bkgdset((chtype) (' ' | COLOR_PAIR(0)));
|
||||
printw("Default Colors\n");
|
||||
getch();
|
||||
dump_window(stdscr);
|
||||
|
||||
printw("Resetting colors to pair 1\n");
|
||||
bkgdset((chtype) (' ' | COLOR_PAIR(1)));
|
||||
printw("This line should be red/%s\n", color_name(default_bg));
|
||||
getch();
|
||||
dump_window(stdscr);
|
||||
|
||||
printw("Setting screen to pair 0\n");
|
||||
bkgd((chtype) (' ' | COLOR_PAIR(0)));
|
||||
getch();
|
||||
dump_window(stdscr);
|
||||
|
||||
printw("Setting screen to pair 1\n");
|
||||
bkgd((chtype) (' ' | COLOR_PAIR(1)));
|
||||
getch();
|
||||
dump_window(stdscr);
|
||||
|
||||
printw("Setting screen to pair 2\n");
|
||||
bkgd((chtype) (' ' | COLOR_PAIR(2)));
|
||||
getch();
|
||||
dump_window(stdscr);
|
||||
|
||||
printw("Setting screen to pair 3\n");
|
||||
bkgd((chtype) (' ' | COLOR_PAIR(3)));
|
||||
getch();
|
||||
dump_window(stdscr);
|
||||
|
||||
printw("Setting screen to pair 0\n");
|
||||
bkgd((chtype) (' ' | COLOR_PAIR(0)));
|
||||
getch();
|
||||
dump_window(stdscr);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -164,7 +165,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
while ((n = getopt(argc, argv, "ab:df:")) != -1) {
|
||||
while ((n = getopt(argc, argv, "ab:df:l:")) != -1) {
|
||||
switch (n) {
|
||||
#if HAVE_ASSUME_DEFAULT_COLORS
|
||||
case 'a':
|
||||
@ -182,6 +183,10 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
|
||||
case 'f':
|
||||
default_fg = color_code(optarg);
|
||||
break;
|
||||
case 'l':
|
||||
if (!open_dump(optarg))
|
||||
usage();
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
@ -230,6 +235,6 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
|
||||
getch();
|
||||
}
|
||||
endwin();
|
||||
|
||||
close_dump();
|
||||
ExitProgram(EXIT_SUCCESS);
|
||||
}
|
||||
|
179
test/dump_window.c
Normal file
179
test/dump_window.c
Normal file
@ -0,0 +1,179 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2018 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: dump_window.c,v 1.3 2018/11/24 23:41:15 tom Exp $
|
||||
*/
|
||||
#include <dump_window.h>
|
||||
|
||||
static FILE *dumpfp;
|
||||
|
||||
int
|
||||
open_dump(const char *fn)
|
||||
{
|
||||
int result = 0;
|
||||
close_dump();
|
||||
if ((dumpfp = fopen(fn, "a")) != 0)
|
||||
result = 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
close_dump(void)
|
||||
{
|
||||
if (dumpfp != 0) {
|
||||
fclose(dumpfp);
|
||||
dumpfp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dump_window(WINDOW *w)
|
||||
{
|
||||
wgetch(w);
|
||||
if (dumpfp != 0) {
|
||||
int y, x;
|
||||
int oldy, oldx;
|
||||
int maxy, maxx;
|
||||
int pass;
|
||||
char *cvec = 0;
|
||||
char *avec = 0;
|
||||
char *pvec = 0;
|
||||
int ccnt = 0;
|
||||
int acnt = 0;
|
||||
int pcnt = 0;
|
||||
int endy = -1;
|
||||
int endx = -1;
|
||||
|
||||
fprintf(dumpfp, "Window %p\n", (void *) w);
|
||||
|
||||
getyx(w, oldy, oldx);
|
||||
getmaxyx(w, maxy, maxx);
|
||||
fprintf(dumpfp, "size (%dx%d)\n", maxy, maxx);
|
||||
getbegyx(w, y, x);
|
||||
fprintf(dumpfp, "begin (%dx%d)\n", maxy, maxx);
|
||||
getyx(w, y, x);
|
||||
fprintf(dumpfp, "position (%d,%d)\n", y, x);
|
||||
|
||||
if (maxy > 0 && maxx > 0) {
|
||||
for (pass = 0; pass < 2; ++pass) {
|
||||
for (y = 0; y < maxy; ++y) {
|
||||
|
||||
if (cvec)
|
||||
memset(cvec, 0, (size_t) maxx + 1);
|
||||
if (avec)
|
||||
memset(avec, 0, (size_t) maxx + 1);
|
||||
if (pvec)
|
||||
memset(pvec, 0, (size_t) maxx + 1);
|
||||
|
||||
for (x = 0; x < maxx; ++x) {
|
||||
chtype data = mvwinch(w, y, x);
|
||||
chtype temp;
|
||||
char cc = (char) ((data & 0xff) ? (data & 0xff) : ' ');
|
||||
char aa;
|
||||
char pp;
|
||||
|
||||
temp = ((data & A_ATTRIBUTES) & (~A_COLOR));
|
||||
if (temp) {
|
||||
if (temp & A_ALTCHARSET) {
|
||||
aa = (temp & A_BOLD) ? 'A' : 'a';
|
||||
} else if (temp & A_STANDOUT) {
|
||||
aa = (temp & A_BOLD) ? 'S' : 's';
|
||||
} else if (temp & A_REVERSE) {
|
||||
aa = (temp & A_BOLD) ? 'R' : 'r';
|
||||
} else if (temp & A_UNDERLINE) {
|
||||
aa = (temp & A_BOLD) ? 'U' : 'u';
|
||||
} else {
|
||||
aa = (temp & A_BOLD) ? 'b' : '?';
|
||||
}
|
||||
} else {
|
||||
aa = ' ';
|
||||
}
|
||||
if (data & A_COLOR) {
|
||||
if (PAIR_NUMBER((int) data) < 8) {
|
||||
pp = (char) ('0' + PAIR_NUMBER((int) data));
|
||||
} else {
|
||||
pp = '*';
|
||||
}
|
||||
} else {
|
||||
pp = ' ';
|
||||
}
|
||||
|
||||
if (pass) {
|
||||
if (cvec)
|
||||
cvec[x] = cc;
|
||||
if (avec)
|
||||
avec[x] = aa;
|
||||
if (pvec)
|
||||
pvec[x] = pp;
|
||||
} else {
|
||||
if (cc != ' ' || aa != ' ' || pp != ' ') {
|
||||
if (endx < x)
|
||||
endx = x;
|
||||
if (endy < y)
|
||||
endy = y;
|
||||
}
|
||||
ccnt += (cc != ' ');
|
||||
acnt += (aa != ' ');
|
||||
pcnt += (pp != ' ');
|
||||
}
|
||||
}
|
||||
if (pass) {
|
||||
fprintf(dumpfp, "%3d", y + 1);
|
||||
if (cvec)
|
||||
fprintf(dumpfp, "\tc|%.*s|\n", maxx, cvec);
|
||||
if (avec)
|
||||
fprintf(dumpfp, "\ta|%.*s|\n", maxx, avec);
|
||||
if (pvec)
|
||||
fprintf(dumpfp, "\tp|%.*s|\n", maxx, pvec);
|
||||
}
|
||||
}
|
||||
if (pass) {
|
||||
free(cvec);
|
||||
free(avec);
|
||||
free(pvec);
|
||||
} else {
|
||||
fprintf(dumpfp, "%d cells with characters\n", ccnt);
|
||||
fprintf(dumpfp, "%d cells with video-attributes\n", acnt);
|
||||
fprintf(dumpfp, "%d cells with color-attributes\n", pcnt);
|
||||
if (endy < 0 || endx < 0)
|
||||
break;
|
||||
/* reduce the dump a little, ignore really blank cells */
|
||||
maxx = endx + 1;
|
||||
maxy = endy + 1;
|
||||
if (ccnt)
|
||||
cvec = malloc((size_t) maxx + 1);
|
||||
if (acnt)
|
||||
avec = malloc((size_t) maxx + 1);
|
||||
if (pcnt)
|
||||
pvec = malloc((size_t) maxx + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
wmove(w, oldy, oldx);
|
||||
}
|
||||
}
|
40
test/dump_window.h
Normal file
40
test/dump_window.h
Normal file
@ -0,0 +1,40 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2018 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: dump_window.h,v 1.1 2018/11/24 18:13:53 tom Exp $
|
||||
*/
|
||||
#ifndef DUMP_WINDOW_H_incl
|
||||
#define DUMP_WINDOW_H_incl 1
|
||||
|
||||
#include <test.priv.h>
|
||||
|
||||
extern int open_dump(const char *fn);
|
||||
extern void close_dump(void);
|
||||
extern void dump_window(WINDOW *w);
|
||||
|
||||
#endif /* DUMP_WINDOW_H_incl */
|
@ -1,4 +1,4 @@
|
||||
# $Id: modules,v 1.67 2018/02/03 23:45:16 tom Exp $
|
||||
# $Id: modules,v 1.68 2018/11/24 17:59:04 tom Exp $
|
||||
##############################################################################
|
||||
# Copyright (c) 1998-2017,2018 Free Software Foundation, Inc. #
|
||||
# #
|
||||
@ -54,6 +54,7 @@ dots_curses progs $(srcdir) $(HEADER_DEPS)
|
||||
dots_mvcur progs $(srcdir) $(HEADER_DEPS)
|
||||
dots_termcap progs $(srcdir) $(HEADER_DEPS)
|
||||
dots_xcurses progs $(srcdir) $(HEADER_DEPS)
|
||||
dump_window progs $(srcdir) $(HEADER_DEPS) $(srcdir)/dump_window.h
|
||||
echochar progs $(srcdir) $(HEADER_DEPS)
|
||||
edit_field progs $(srcdir) $(HEADER_DEPS) $(srcdir)/edit_field.h $(srcdir)/popup_msg.h
|
||||
extended_color progs $(srcdir) $(HEADER_DEPS)
|
||||
|
@ -26,7 +26,7 @@
|
||||
* authorization. *
|
||||
****************************************************************************/
|
||||
/*
|
||||
* $Id: movewindow.c,v 1.47 2018/06/09 17:35:50 tom Exp $
|
||||
* $Id: movewindow.c,v 1.48 2018/11/24 21:29:46 tom Exp $
|
||||
*
|
||||
* Demonstrate move functions for windows and derived windows from the curses
|
||||
* library.
|
||||
@ -105,8 +105,10 @@ message(int lineno, CONST_FMT char *fmt, va_list argp)
|
||||
vsprintf(buffer, fmt, argp);
|
||||
addstr(buffer);
|
||||
}
|
||||
#else
|
||||
#elif defined(HAVE_VW_PRINTW)
|
||||
vw_printw(stdscr, fmt, argp);
|
||||
#else
|
||||
vwprintw(stdscr, fmt, argp);
|
||||
#endif
|
||||
|
||||
move(y, x);
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: programs,v 1.41 2017/10/22 16:06:57 tom Exp $
|
||||
# $Id: programs,v 1.42 2018/11/24 17:56:32 tom Exp $
|
||||
##############################################################################
|
||||
# Copyright (c) 2006-2016,2017 Free Software Foundation, Inc. #
|
||||
# #
|
||||
@ -30,7 +30,7 @@
|
||||
# Author: Thomas E. Dickey
|
||||
#
|
||||
# programs used for ncurses tests
|
||||
background $(LDFLAGS_CURSES) $(LOCAL_LIBS) background
|
||||
background $(LDFLAGS_CURSES) $(LOCAL_LIBS) background dump_window
|
||||
blue $(LDFLAGS_CURSES) $(LOCAL_LIBS) blue
|
||||
bs $(LDFLAGS_CURSES) $(LOCAL_LIBS) bs
|
||||
cardfile $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) cardfile
|
||||
|
Loading…
Reference in New Issue
Block a user