From: Thomas E. Dickey Date: Sun, 6 Jan 2013 01:29:15 +0000 (+0000) Subject: ncurses 5.9 - patch 20130105 X-Git-Tag: v6.0~121 X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=4b1ec76cb0a0fa5055909f534b3f928dafc7f7f1;ds=inline ncurses 5.9 - patch 20130105 + add "-s" option to test/view.c to allow it to start in single-step mode, reducing size of trace files when it is used for debugging MinGW changes. + revert part of 20121222 change to tinfo_driver.c + add experimental logic in win_driver.c to improve optimization of screen updates. This does not yet work with double-width characters, so it is ifdef'd out for the moment (prompted by report by Erwin Waterlander regarding screen flicker). --- diff --git a/NEWS b/NEWS index f84b3fef..f154f773 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------- --- Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. -- +-- Copyright (c) 1998-2012,2013 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 -- @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.2006 2012/12/29 22:37:28 tom Exp $ +-- $Id: NEWS,v 1.2008 2013/01/05 23:28:30 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,16 @@ 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. +20130105 + + add "-s" option to test/view.c to allow it to start in single-step + mode, reducing size of trace files when it is used for debugging + MinGW changes. + + revert part of 20121222 change to tinfo_driver.c + + add experimental logic in win_driver.c to improve optimization of + screen updates. This does not yet work with double-width characters, + so it is ifdef'd out for the moment (prompted by report by Erwin + Waterlander regarding screen flicker). + 20121229 + fix coverity warnings regarding copying into fixed-size buffers. + add throw-declarations in the c++ binding per Coverity warning. diff --git a/dist.mk b/dist.mk index e3b7cab9..d59b7242 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.907 2012/12/29 16:59:31 tom Exp $ +# $Id: dist.mk,v 1.908 2013/01/05 14:08:17 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 = 20121229 +NCURSES_PATCH = 20130105 # 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/tinfo_driver.c b/ncurses/tinfo/tinfo_driver.c index 5f2051b5..0a463082 100644 --- a/ncurses/tinfo/tinfo_driver.c +++ b/ncurses/tinfo/tinfo_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2008-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 2008-2012,2013 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 * @@ -50,7 +50,7 @@ # endif #endif -MODULE_ID("$Id: tinfo_driver.c,v 1.25 2012/12/22 21:44:10 tom Exp $") +MODULE_ID("$Id: tinfo_driver.c,v 1.26 2013/01/05 23:25:36 tom Exp $") /* * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, @@ -1150,8 +1150,7 @@ _nc_cookie_init(SCREEN *sp) /* initialize normal acs before wide, since we use mapping in the latter */ #if !USE_WIDEC_SUPPORT - sp->_screen_unicode = _nc_unicode_locale(); - if (sp->screen_unicode && _nc_locale_breaks_acs(sp->_term)) { + if (_nc_unicode_locale() && _nc_locale_breaks_acs(sp->_term)) { acs_chars = NULL; ena_acs = NULL; enter_alt_charset_mode = NULL; diff --git a/ncurses/win32con/win_driver.c b/ncurses/win32con/win_driver.c index 03313270..9b7a752e 100644 --- a/ncurses/win32con/win_driver.c +++ b/ncurses/win32con/win_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2013 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 * @@ -38,10 +38,12 @@ #include #define CUR my_term.type. -MODULE_ID("$Id: win_driver.c,v 1.15 2012/12/15 19:39:49 tom Exp $") +MODULE_ID("$Id: win_driver.c,v 1.16 2013/01/05 23:16:54 tom Exp $") #define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE) +#define EXP_OPTIMIZE 0 + #define AssertTCB() assert(TCB!=0 && TCB->magic==WINMAGIC) #define SetSP() assert(TCB->csp!=0); sp = TCB->csp; (void) sp @@ -242,6 +244,81 @@ con_write8(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n) #define con_write(tcb, y, x, str, n) con_write8(tcb, y, x, str, n) #endif +#if EXP_OPTIMIZE +/* + * Comparing new/current screens, determine the last column-index for a change + * beginning on the given row,col position. Unlike a serial terminal, there is + * no cost for "moving" the "cursor" on the line as we update it. + */ +static int +find_end_of_change(SCREEN *sp, int row, int col) +{ + int result = col; + struct ldat *curdat = CurScreen(sp)->_line + row; + struct ldat *newdat = NewScreen(sp)->_line + row; + + while (col <= newdat->lastchar) { +#if USE_WIDEC_SUPPORT + if (isWidecExt(curdat->text[col]) || isWidecExt(newdat->text[col])) { + result = col; + } else if (memcmp(&curdat->text[col], + &newdat->text[col], + sizeof(curdat->text[0]))) { + result = col; + } else { + break; + } +#else + if (curdat->text[col] != newdat->text[col]) { + result = col; + } else { + break; + } +#endif + ++col; + } + return result; +} + +/* + * Given a row,col position at the end of a change-chunk, look for the + * beginning of the next change-chunk. + */ +static int +find_next_change(SCREEN *sp, int row, int col) +{ + struct ldat *curdat = CurScreen(sp)->_line + row; + struct ldat *newdat = NewScreen(sp)->_line + row; + int result = newdat->lastchar + 1; + + while (++col <= newdat->lastchar) { +#if USE_WIDEC_SUPPORT + if (isWidecExt(curdat->text[col]) != isWidecExt(newdat->text[col])) { + result = col; + break; + } else if (memcmp(&curdat->text[col], + &newdat->text[col], + sizeof(curdat->text[0]))) { + result = col; + break; + } +#else + if (curdat->text[col] != newdat->text[col]) { + result = col; + break; + } +#endif + } + return result; +} + +#define EndChange(first) \ + find_end_of_change(sp, y, first) +#define NextChange(last) \ + find_next_change(sp, y, last) + +#endif /* EXP_OPTIMIZE */ + #define MARK_NOCHANGE(win,row) \ win->_line[row].firstchar = _NOCHANGE; \ win->_line[row].lastchar = _NOCHANGE @@ -291,6 +368,32 @@ drv_doupdate(TERMINAL_CONTROL_BLOCK * TCB) for (y = 0; y < nonempty; y++) { x0 = NewScreen(sp)->_line[y].firstchar; if (x0 != _NOCHANGE) { +#if EXP_OPTIMIZE + int x2; + int limit = NewScreen(sp)->_line[y].lastchar; + while ((x1 = EndChange(x0)) <= limit) { + while ((x2 = NextChange(x1)) <= limit && x2 <= (x1 + 2)) { + x1 = x2; + } + n = x1 - x0 + 1; + memcpy(&CurScreen(sp)->_line[y].text[x0], + &NewScreen(sp)->_line[y].text[x0], + n * sizeof(CurScreen(sp)->_line[y].text[x0])); + con_write(TCB, + y, + x0, + &CurScreen(sp)->_line[y].text[x0], n); + x0 = NextChange(x1); + } + + /* mark line changed successfully */ + if (y <= NewScreen(sp)->_maxy) { + MARK_NOCHANGE(NewScreen(sp), y); + } + if (y <= CurScreen(sp)->_maxy) { + MARK_NOCHANGE(CurScreen(sp), y); + } +#else x1 = NewScreen(sp)->_line[y].lastchar; n = x1 - x0 + 1; if (n > 0) { @@ -310,6 +413,7 @@ drv_doupdate(TERMINAL_CONTROL_BLOCK * TCB) MARK_NOCHANGE(CurScreen(sp), y); } } +#endif } } diff --git a/package/debian/changelog b/package/debian/changelog index c4a7623d..6d8b7350 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (5.9-20121229) unstable; urgency=low +ncurses6 (5.9-20130105) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 29 Dec 2012 12:00:04 -0500 + -- Thomas E. Dickey Sat, 05 Jan 2013 10:15:33 -0500 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/ncurses.spec b/package/ncurses.spec index 270a6862..9f472cfa 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Release: 5.9 -Version: 20121229 +Version: 20130105 License: X11 Group: Development/Libraries Source: ncurses-%{release}-%{version}.tgz diff --git a/test/view.c b/test/view.c index 76a88a30..cf11cbf0 100644 --- a/test/view.c +++ b/test/view.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2013 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 * @@ -50,7 +50,7 @@ * scroll operation worked, and the refresh() code only had to do a * partial repaint. * - * $Id: view.c,v 1.89 2012/12/29 22:38:28 tom Exp $ + * $Id: view.c,v 1.90 2013/01/05 23:18:13 tom Exp $ */ #include @@ -82,6 +82,9 @@ #include #endif +#undef CTRL +#define CTRL(x) ((x) & 0x1f) + static RETSIGTYPE finish(int sig) GCC_NORETURN; static void show_all(const char *tag); @@ -121,6 +124,7 @@ usage(void) #if defined(KEY_RESIZE) ," -r use old-style sigwinch handler rather than KEY_RESIZE" #endif + ," -s start in single-step mode, waiting for input" #ifdef TRACE ," -t trace screen updates" ," -T NUM specify trace mask" @@ -229,6 +233,7 @@ main(int argc, char *argv[]) int value = 0; bool done = FALSE; bool got_number = FALSE; + bool single_step = TRUE; #if CAN_RESIZE bool nonposix_resize = FALSE; #endif @@ -244,7 +249,7 @@ main(int argc, char *argv[]) (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ #endif - while ((i = getopt(argc, argv, "cin:rtT:")) != -1) { + while ((i = getopt(argc, argv, "cin:rstT:")) != -1) { switch (i) { case 'c': try_color = TRUE; @@ -262,6 +267,9 @@ main(int argc, char *argv[]) nonposix_resize = TRUE; break; #endif + case 's': + single_step = TRUE; + break; #ifdef TRACE case 'T': { @@ -357,7 +365,8 @@ main(int argc, char *argv[]) (void) nonl(); /* tell curses not to do NL->CR/NL on output */ (void) cbreak(); /* take input chars one at a time, no wait for \n */ (void) noecho(); /* don't echo input */ - nodelay(stdscr, TRUE); + if (!single_step) + nodelay(stdscr, TRUE); idlok(stdscr, TRUE); /* allow use of insert/delete line */ if (try_color) { @@ -478,6 +487,9 @@ main(int argc, char *argv[]) nodelay(stdscr, TRUE); my_delay = 0; break; + case CTRL('L'): + redrawwin(stdscr); + break; case ERR: if (!my_delay) napms(50);