]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 6.1 - patch 20181229
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 30 Dec 2018 01:55:38 +0000 (01:55 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 30 Dec 2018 01:55:38 +0000 (01:55 +0000)
+ improve man/curs_mouse.3x with regard to xterm
+ modify tracemunch to accept filename parameters in addition to use
  as a pipe/filter.
+ minor optimization to reduce calls to _nc_reserve_pairs (prompted by
  discussion with Bryan Christ).
+ add test/pair_content.c and test/color_content.c
+ modify infocmp to omit filtering of "OTxx" names which are used for
  obsolete capabilities, when the output is sorted by long-names.
  Doing this helps when making a table of the short/long capability
  names.

45 files changed:
MANIFEST
NEWS
VERSION
dist.mk
doc/html/man/adacurses6-config.1.html
doc/html/man/captoinfo.1m.html
doc/html/man/clear.1.html
doc/html/man/curs_mouse.3x.html
doc/html/man/form.3x.html
doc/html/man/infocmp.1m.html
doc/html/man/infotocap.1m.html
doc/html/man/menu.3x.html
doc/html/man/ncurses.3x.html
doc/html/man/ncurses6-config.1.html
doc/html/man/panel.3x.html
doc/html/man/tabs.1.html
doc/html/man/terminfo.5.html
doc/html/man/tic.1m.html
doc/html/man/toe.1m.html
doc/html/man/tput.1.html
doc/html/man/tset.1.html
man/curs_mouse.3x
ncurses/base/lib_color.c
ncurses/base/new_pair.c
ncurses/curses.priv.h
package/debian-mingw/changelog
package/debian-mingw64/changelog
package/debian/changelog
package/mingw-ncurses.nsi
package/mingw-ncurses.spec
package/ncurses.spec
package/ncursest.spec
progs/dump_entry.c
test/color_content.c [new file with mode: 0644]
test/color_name.h
test/demo_altkeys.c
test/extended_color.c
test/foldkeys.c
test/modules
test/pair_content.c [new file with mode: 0644]
test/programs
test/savescreen.c
test/tclock.c
test/test.priv.h
test/tracemunch

index 3551d6d296812d33b0fdd2b71d00b7b956c4424e..27a22f6389d5949e3c876854543dd2c824f9dba0 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
 ./test/cardfile.dat
 ./test/chgat.c
 ./test/clip_printw.c
+./test/color_content.c
 ./test/color_name.h
 ./test/color_set.c
 ./test/configure
 ./test/package/mingw-ncurses-examples.spec
 ./test/package/ncurses-examples.spec
 ./test/padview.c
+./test/pair_content.c
 ./test/parse_rgb.h
 ./test/picsmap.c
 ./test/picsmap.h
diff --git a/NEWS b/NEWS
index 39121c15d0d17bf80e1f8d86be4522ad38303adb..f672d6b659fe2b368b20be9a6b4eaaa0a34c693e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.3231 2018/12/16 00:18:46 tom Exp $
+-- $Id: NEWS,v 1.3236 2018/12/29 23:45:51 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.
 
+20181229
+       + improve man/curs_mouse.3x with regard to xterm
+       + modify tracemunch to accept filename parameters in addition to use
+         as a pipe/filter.
+       + minor optimization to reduce calls to _nc_reserve_pairs (prompted by
+         discussion with Bryan Christ).
+       + add test/pair_content.c and test/color_content.c
+       + modify infocmp to omit filtering of "OTxx" names which are used for
+         obsolete capabilities, when the output is sorted by long-names.
+         Doing this helps when making a table of the short/long capability
+         names.
+
 20181215
        + several fixes for gcc8 strict compiler warnings.
        + fix a typo in comments (Aaron Gyes).
diff --git a/VERSION b/VERSION
index 0bab1fe9403d1a641d316d67425cca05d9114f4f..c99e42efbcdb363fc97d935e906d7a5bb5d777a8 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5:0:10 6.1     20181215
+5:0:10 6.1     20181229
diff --git a/dist.mk b/dist.mk
index 692aec26fdd9db908bc7ac9d59eff4371303ba17..3de52035568a264efab18a90fa759ef7910bcf98 100644 (file)
--- 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.1256 2018/12/15 19:14:57 tom Exp $
+# $Id: dist.mk,v 1.1258 2018/12/29 15:15:21 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 = 20181215
+NCURSES_PATCH = 20181229
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 235e07f308d110dd1efb4f064b6db97fa0af97c4..ff1a86cad5ab771b231e7ca1eea7a4fbd418c7f5 100644 (file)
 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>
 
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 
index 59a0bb0067e73e03188607db5874b615970ef628..1ff472ec09a0609b7becb628db9bcc55baee7455 100644 (file)
 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
        <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>
 
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>
index 54b8157dbd3de17ffdb6cc5a6d6bf0ec5f98faf5..a1a22a3e939be9f519744f814fbfbb52c2dcd3fd 100644 (file)
 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
        <STRONG><A HREF="tput.1.html">tput(1)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>
 
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 
index 978596675b084f33c561041a3d5d097d8afa2f5b..baafe6282d4d3ecc317d05dc0fb89167ce642789 100644 (file)
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_mouse.3x,v 1.49 2018/07/28 22:19:56 tom Exp @
+  * @Id: curs_mouse.3x,v 1.50 2018/12/29 23:40:47 tom Exp @
 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
 <HTML>
 
           \E[?1000%?%p1%{1}%=%th%el%;
 
+       The mouse driver also recognizes a newer xterm private mode 1006, e.g.,
+
+          \E[?1006;1000%?%p1%{1}%=%th%el%;
+
        The  <EM>z</EM>  member in the event structure is not presently used.  It is in-
        tended for use with touch screens (which may be pressure-sensitive)  or
        with 3D-mice/trackballs/power gloves.
        identify terminals which support the xterm mouse protocol, <STRONG>ncurses</STRONG>  as-
        sumes  that  if  your  $TERM  environment variable contains "xterm", or
        <STRONG>kmous</STRONG> is defined in the terminal description,  then  the  terminal  may
-       send mouse events.
+       send mouse events.  The <STRONG>kmous</STRONG> capability is checked first, allowing the
+       use of newer xterm mouse protocols.
 
 
 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
index 2fba6951fd9286c298e97368f937b730e80ad6c2..b296ec6d644e877ddb376e95a4983545f15abe79 100644 (file)
        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>  and  related  pages  whose names begin "form_" for detailed
        descriptions of the entry points.
 
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 
index f93f94d47dddcd47131a8e9652436ac3e2897b9a..c87696ee2d1c68e3c3a724d5725ecf4ab666d8ab 100644 (file)
 
        https://invisible-island.net/ncurses/tctest.html
 
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>
index 971ab4f27e9d0f615683ad4c4fde10ce7e0b259d..b70b1a92df082c5c40a4abd96e73eb8ab39c86b6 100644 (file)
@@ -85,7 +85,7 @@
 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>
 
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>
index 7a54da3c2cedf1792d8409c03af730b3a6386d0c..c9ddc85097dc623a005f25eb7d4f7e5d1306a541 100644 (file)
        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>  and  related  pages  whose names begin "menu_" for detailed
        descriptions of the entry points.
 
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 
index 092c974c9066e936e6d0322668edcb6d3db065c2..64590f9d9a4d0943d6a379397cd2f2ab7e5f2e1b 100644 (file)
@@ -59,7 +59,7 @@
        method of updating  character  screens  with  reasonable  optimization.
        This  implementation  is  "new  curses"  (ncurses)  and is the approved
        replacement for 4.4BSD classic curses,  which  has  been  discontinued.
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
        The  <STRONG>ncurses</STRONG>  library emulates the curses library of System V Release 4
        UNIX, and XPG4 (X/Open Portability Guide) curses  (also  known  as  XSI
index 2b0cd4e1e6542be05582173a8131501d24a544ca..cee519922c0228930ec66f2e4fb6c797b0981c9a 100644 (file)
 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>
 
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 
index 57118c0501a2742a4d7486d3d75061eccff7bd50..5c0b19b7a57ec4fc8248334329afc27d92df34f1 100644 (file)
 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>,
 
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>
index 7be465a9406558eddff17ddac9147148852264bf..4b55a3870e776815b4bdb03a6a37f7ec38ce0b28 100644 (file)
 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
        <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
 
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 
index ea4a93d77bcf0a3ab00c64947d08caca82b6117d..958ad4fcc40a55ccc87c3fa0cbb120adc5ca4979 100644 (file)
@@ -74,7 +74,7 @@
        <EM>Terminfo</EM> describes terminals by giving a set of capabilities which they
        have, by specifying how to perform screen operations, and by specifying
        padding  requirements  and  initialization  sequences.   This describes
-       <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 </PRE><H3><a name="h3-Terminfo-Entry-Syntax">Terminfo Entry Syntax</a></H3><PRE>
index 38270188e5779f0eacfe50a730b9f9ba928c7d12..d7a03f7f301bdd98a7b960eae307da151ea1f085 100644 (file)
        <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>,   <STRONG><A HREF="captoinfo.1m.html">captoinfo(1m)</A></STRONG>,   <STRONG><A HREF="infotocap.1m.html">infotocap(1m)</A></STRONG>,   <STRONG><A HREF="toe.1m.html">toe(1m)</A></STRONG>,   <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>,
        <STRONG><A HREF="term.5.html">term(5)</A></STRONG>.  <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
 
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>
index f070559298cafcf148786b9a1424f51f9812d400..fe0a68835b4488cae81c4ed229746b5a9e1c4eab 100644 (file)
        <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="captoinfo.1m.html">captoinfo(1m)</A></STRONG>,  <STRONG><A HREF="infotocap.1m.html">infotocap(1m)</A></STRONG>,  <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>,  <STRONG>ter-</STRONG>
        <STRONG><A HREF="terminfo.5.html">minfo(5)</A></STRONG>.
 
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 
index afa3be2a2b257d8f91bbdcb2871344b35c0c3007..32ddfb3836f1a50f1350476f157f080840af3cb6 100644 (file)
 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
        <STRONG><A HREF="clear.1.html">clear(1)</A></STRONG>, <STRONG>stty(1)</STRONG>, <STRONG><A HREF="tabs.1.html">tabs(1)</A></STRONG>, <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>, <STRONG><A HREF="curs_termcap.3x.html">curs_termcap(3x)</A></STRONG>.
 
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 
index 43ab7e464ac40586173aa827d45cdb07302245cf..88d8f5d5ad6bf80928910a5a60845590a7101d26 100644 (file)
        <STRONG>csh(1)</STRONG>,  <STRONG>sh(1)</STRONG>,  <STRONG>stty(1)</STRONG>,   <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>,   <STRONG>tty(4)</STRONG>,   <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>,
        <STRONG>ttys(5)</STRONG>, <STRONG>environ(7)</STRONG>
 
-       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181208).
+       This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20181229).
 
 
 
index f5d1cbabe7cafe6d4e679be76e8a9c6f21467c67..f48cb1e822a9f9a79ce2f8785cedff90c9ebfb69 100644 (file)
@@ -27,7 +27,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_mouse.3x,v 1.49 2018/07/28 22:19:56 tom Exp $
+.\" $Id: curs_mouse.3x,v 1.50 2018/12/29 23:40:47 tom Exp $
 .ie \n(.g .ds `` \(lq
 .el       .ds `` ``
 .ie \n(.g .ds '' \(rq
@@ -370,6 +370,12 @@ corresponds to private mode 1000 of xterm:
 \\E[?1000%?%p1%{1}%=%th%el%;
 .RE
 .PP
+The mouse driver also recognizes a newer xterm private mode 1006, e.g.,
+.PP
+.RS 3
+\\E[?1006;1000%?%p1%{1}%=%th%el%;
+.RE
+.PP
 The \fIz\fP member in the event structure is not presently used.
 It is intended
 for use with touch screens (which may be pressure-sensitive) or with
@@ -396,9 +402,11 @@ i.e., it is the beginning of the response.
 .PP
 Because there are no standard terminal responses that would serve to identify
 terminals which support the xterm mouse protocol, \fBncurses\fR assumes that
-if your $TERM environment variable contains "xterm",
+if your $TERM environment variable contains \*(``xterm\*('',
 or \fBkmous\fR is defined in
 the terminal description, then the terminal may send mouse events.
+The \fBkmous\fP capability is checked first, allowing the
+use of newer xterm mouse protocols.
 .SH SEE ALSO
 \fBcurses\fR(3X),
 \fBcurs_kernel\fR(3X),
index 409b66cab6a06a1e98558a95e600a693c2c41d9f..df8424b41107aa9d8f8a7b791d3871e297105f4e 100644 (file)
@@ -48,7 +48,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_color.c,v 1.138 2018/05/16 08:24:08 tom Exp $")
+MODULE_ID("$Id: lib_color.c,v 1.139 2018/12/29 20:10:07 tom Exp $")
 
 #ifdef USE_TERM_DRIVER
 #define CanChange      InfoOf(SP_PARM).canchange
@@ -405,7 +405,7 @@ NCURSES_SP_NAME(start_color) (NCURSES_SP_DCL0)
            COLORS = maxcolors;
 #endif
 
-           _nc_reserve_pairs(SP_PARM, 16);
+           ReservePairs(SP_PARM, 16);
            if (SP_PARM->_color_pairs != 0) {
                if (init_direct_colors(NCURSES_SP_ARG)) {
                    result = OK;
@@ -514,49 +514,41 @@ _nc_change_pair(SCREEN *sp, int pair)
     }
 }
 
-NCURSES_EXPORT(colorpair_t *)
+NCURSES_EXPORT(void)
 _nc_reserve_pairs(SCREEN *sp, int want)
 {
-    colorpair_t *result = 0;
     int have = sp->_pair_alloc;
 
-    if ((sp->_color_pairs != 0) && (want < sp->_pair_alloc)) {
-       result = &(sp->_color_pairs[want]);
-    } else {
-
-       if (have == 0)
-           have = 1;
-       while (have <= want)
-           have *= 2;
-       if (have > sp->_pair_limit)
-           have = sp->_pair_limit;
+    if (have == 0)
+       have = 1;
+    while (have <= want)
+       have *= 2;
+    if (have > sp->_pair_limit)
+       have = sp->_pair_limit;
 
-       if (sp->_color_pairs == 0) {
-           sp->_color_pairs = TYPE_CALLOC(colorpair_t, have);
-       } else if (have > sp->_pair_alloc) {
+    if (sp->_color_pairs == 0) {
+       sp->_color_pairs = TYPE_CALLOC(colorpair_t, have);
+    } else if (have > sp->_pair_alloc) {
 #if NCURSES_EXT_COLORS
-           colorpair_t *next;
-
-           if ((next = typeCalloc(colorpair_t, have)) == 0)
-               _nc_err_abort(MSG_NO_MEMORY);
-           memcpy(next, sp->_color_pairs, (size_t) sp->_pair_alloc * sizeof(*next));
-           _nc_copy_pairs(sp, next, sp->_color_pairs, sp->_pair_alloc);
-           free(sp->_color_pairs);
-           sp->_color_pairs = next;
+       colorpair_t *next;
+
+       if ((next = typeCalloc(colorpair_t, have)) == 0)
+           _nc_err_abort(MSG_NO_MEMORY);
+       memcpy(next, sp->_color_pairs, (size_t) sp->_pair_alloc * sizeof(*next));
+       _nc_copy_pairs(sp, next, sp->_color_pairs, sp->_pair_alloc);
+       free(sp->_color_pairs);
+       sp->_color_pairs = next;
 #else
-           TYPE_REALLOC(colorpair_t, have, sp->_color_pairs);
-           if (sp->_color_pairs != 0) {
-               memset(sp->_color_pairs + sp->_pair_alloc, 0,
-                      sizeof(colorpair_t) * (size_t) (have - sp->_pair_alloc));
-           }
-#endif
-       }
+       TYPE_REALLOC(colorpair_t, have, sp->_color_pairs);
        if (sp->_color_pairs != 0) {
-           sp->_pair_alloc = have;
-           result = &(sp->_color_pairs[want]);
+           memset(sp->_color_pairs + sp->_pair_alloc, 0,
+                  sizeof(colorpair_t) * (size_t) (have - sp->_pair_alloc));
        }
+#endif
+    }
+    if (sp->_color_pairs != 0) {
+       sp->_pair_alloc = have;
     }
-    return result;
 }
 
 /*
@@ -578,7 +570,7 @@ _nc_init_pair(SCREEN *sp, int pair, int f, int b)
 
     maxcolors = MaxColors;
 
-    _nc_reserve_pairs(sp, pair);
+    ReservePairs(sp, pair);
     previous = sp->_color_pairs[pair];
 #if NCURSES_EXT_FUNCS
     if (sp->_default_color || sp->_assumed_color) {
@@ -941,7 +933,7 @@ _nc_pair_content(SCREEN *sp, int pair, int *f, int *b)
        int fg;
        int bg;
 
-       _nc_reserve_pairs(sp, pair);
+       ReservePairs(sp, pair);
        fg = FORE_OF(sp->_color_pairs[pair]);
        bg = BACK_OF(sp->_color_pairs[pair]);
 #if NCURSES_EXT_FUNCS
@@ -1125,7 +1117,7 @@ NCURSES_SP_NAME(reset_color_pairs) (NCURSES_SP_DCL0)
            free(SP_PARM->_color_pairs);
            SP_PARM->_color_pairs = 0;
            SP_PARM->_pair_alloc = 0;
-           _nc_reserve_pairs(SP_PARM, 16);
+           ReservePairs(SP_PARM, 16);
            clearok(CurScreen(SP_PARM), TRUE);
            touchwin(StdScreen(SP_PARM));
        }
index bbccc19efa7953f3b1b4101c8e3452a512c54670..c47e61e7e8d7eeca4acadd9d7b2c78cecc4986f1 100644 (file)
@@ -60,7 +60,7 @@
 
 #endif
 
-MODULE_ID("$Id: new_pair.c,v 1.15 2018/03/01 15:02:12 tom Exp $")
+MODULE_ID("$Id: new_pair.c,v 1.17 2018/12/29 21:27:21 tom Exp $")
 
 #if NCURSES_EXT_COLORS
 
@@ -193,7 +193,8 @@ _nc_reset_color_pair(SCREEN *sp, int pair, colorpair_t * next)
 {
     colorpair_t *last;
     if (ValidPair(sp, pair)) {
-       last = _nc_reserve_pairs(sp, pair);
+       ReservePairs(sp, pair);
+       last = &(sp->_color_pairs[pair]);
        delink_color_pair(sp, pair);
        if (last->mode > cpFREE &&
            (last->fg != next->fg || last->bg != next->bg)) {
@@ -277,7 +278,8 @@ NCURSES_SP_NAME(alloc_pair) (NCURSES_SP_DCLx int fg, int bg)
            }
            if (!found && (SP_PARM->_pair_alloc < SP_PARM->_pair_limit)) {
                pair = SP_PARM->_pair_alloc;
-               if (_nc_reserve_pairs(sp, pair) == 0) {
+               ReservePairs(SP_PARM, pair);
+               if (SP_PARM->_color_pairs == 0) {
                    pair = -1;
                } else {
                    found = TRUE;
index b5be745dd0b9c3b390e8104fd91cd07709e86e32..4519ce95729451bf50c84c3cf7abb6423d39b3e9 100644 (file)
@@ -34,7 +34,7 @@
  ****************************************************************************/
 
 /*
- * $Id: curses.priv.h,v 1.612 2018/12/16 01:16:58 tom Exp $
+ * $Id: curses.priv.h,v 1.613 2018/12/29 20:07:04 tom Exp $
  *
  *     curses.priv.h
  *
@@ -1544,26 +1544,27 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
 #define PUTC_INIT      init_mb (PUT_st)
 #define PUTC(ch)       do { if(!isWidecExt(ch)) {                                  \
                        if (Charable(ch)) {                                         \
-                           TR_PUTC(CharOf(ch)); \
-                           NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \
+                           TR_PUTC(CharOf(ch));                                    \
+                           NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch));         \
                            COUNT_OUTCHARS(1);                                      \
                        } else {                                                    \
                            for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) {       \
                                PUTC_ch = (ch).chars[PUTC_i];                       \
                                if (PUTC_ch == L'\0')                               \
                                    break;                                          \
-                               PUTC_INIT;                                                  \
+                               PUTC_INIT;                                          \
                                PUTC_n = (int) wcrtomb(PUTC_buf,                    \
                                                       (ch).chars[PUTC_i], &PUT_st); \
                                if (PUTC_n <= 0) {                                  \
-                                   if (PUTC_ch && is8bits(PUTC_ch) && PUTC_i == 0) \
-                                       TR_PUTC(CharOf(ch)); \
+                                   if (PUTC_ch && is8bits(PUTC_ch) && PUTC_i == 0) \
+                                       TR_PUTC(CharOf(ch));                        \
                                        NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \
+                                   }                                               \
                                    break;                                          \
                                } else {                                            \
                                    int PUTC_j;                                     \
                                    for (PUTC_j = 0; PUTC_j < PUTC_n; ++PUTC_j) {   \
-                                       TR_PUTC(PUTC_buf[PUTC_j]); \
+                                       TR_PUTC(PUTC_buf[PUTC_j]);                  \
                                        NCURSES_OUTC_FUNC (NCURSES_SP_ARGx PUTC_buf[PUTC_j]); \
                                    }                                               \
                                }                                                   \
@@ -2065,9 +2066,13 @@ extern NCURSES_EXPORT(int) _nc_init_color(SCREEN *, int, int, int, int);
 extern NCURSES_EXPORT(int) _nc_init_pair(SCREEN *, int, int, int);
 extern NCURSES_EXPORT(int) _nc_pair_content(SCREEN *, int, int *, int *);
 extern NCURSES_EXPORT(bool) _nc_reset_colors(void);
-extern NCURSES_EXPORT(colorpair_t *) _nc_reserve_pairs(SCREEN *, int);
+extern NCURSES_EXPORT(void) _nc_reserve_pairs(SCREEN *, int);
 extern NCURSES_EXPORT(void) _nc_change_pair(SCREEN *, int);
 
+#define ReservePairs(sp,want) \
+           if ((sp->_color_pairs == 0) || (want >= sp->_pair_alloc)) \
+               _nc_reserve_pairs(sp, want)
+
 /* lib_getch.c */
 extern NCURSES_EXPORT(int) _nc_wgetch(WINDOW *, int *, int EVENTLIST_2nd(_nc_eventlist *));
 
index 6c6adfbde9173b1e277c084f9301e27e3efc7790..9f260cb645635868bcf180f86fc876463bbfb476 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.1+20181215) unstable; urgency=low
+ncurses6 (6.1+20181229) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 15 Dec 2018 14:14:57 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 29 Dec 2018 10:15:21 -0500
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index 6c6adfbde9173b1e277c084f9301e27e3efc7790..9f260cb645635868bcf180f86fc876463bbfb476 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.1+20181215) unstable; urgency=low
+ncurses6 (6.1+20181229) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 15 Dec 2018 14:14:57 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 29 Dec 2018 10:15:21 -0500
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index ce35b2badd16a18561f4784fbc17d28be4621306..b268fd0b54ba7e6e3fc641c35f33ce87a60f5f74 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.1+20181215) unstable; urgency=low
+ncurses6 (6.1+20181229) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 15 Dec 2018 14:14:57 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 29 Dec 2018 10:15:21 -0500
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
index 5c0b5f643a687ce9efede1e67c02aaeb65c9b645..2b9f4d52c662edeb47a0260cf233de31b4154dd5 100644 (file)
@@ -1,4 +1,4 @@
-; $Id: mingw-ncurses.nsi,v 1.303 2018/12/15 19:14:57 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.305 2018/12/29 15:15:21 tom Exp $\r
 \r
 ; TODO add examples\r
 ; TODO bump ABI to 6\r
@@ -10,7 +10,7 @@
 !define VERSION_MAJOR "6"\r
 !define VERSION_MINOR "1"\r
 !define VERSION_YYYY  "2018"\r
-!define VERSION_MMDD  "1215"\r
+!define VERSION_MMDD  "1229"\r
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
 \r
 !define MY_ABI   "5"\r
index 2abd05cd5850b0a7efe56a89cf6d6a673f57f346..519da61e9807b88195947f6a7804064131cd44af 100644 (file)
@@ -3,7 +3,7 @@
 Summary: shared libraries for terminal handling
 Name: mingw32-ncurses6
 Version: 6.1
-Release: 20181215
+Release: 20181229
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index e141cd1f0c9f1b30c3c7ae0c890c224f7d5615c4..89ad313ad67fc059a986b24f75cf804f83319caa 100644 (file)
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Version: 6.1
-Release: 20181215
+Release: 20181229
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index 4d62573089e69b61bb694f76d49729269a5f370a..cffae6fa83071b947a58f6f3a9ee1dbfea60ade3 100644 (file)
@@ -1,7 +1,7 @@
 Summary: Curses library with POSIX thread support.
 Name: ncursest6
 Version: 6.1
-Release: 20181215
+Release: 20181229
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index 3b1fcb1e10ae75d779e4ca8b8719142ad3f3d0e1..e9e8d6049fdc58cad349030255710bbe8d3b5d8e 100644 (file)
@@ -39,7 +39,7 @@
 #include "termsort.c"          /* this C file is generated */
 #include <parametrized.h>      /* so is this */
 
-MODULE_ID("$Id: dump_entry.c,v 1.168 2017/09/02 21:01:54 tom Exp $")
+MODULE_ID("$Id: dump_entry.c,v 1.169 2018/12/23 00:37:35 tom Exp $")
 
 #define DISCARD(string) string = ABSENT_STRING
 #define PRINTF (void) printf
@@ -94,7 +94,7 @@ static int indent = 8;
 #define OBSOLETE(n) (n[0] == 'O' && n[1] == 'T')
 #endif
 
-#define isObsolete(f,n) ((f == F_TERMINFO || f == F_VARIABLE) && OBSOLETE(n))
+#define isObsolete(f,n) ((f == F_TERMINFO || f == F_VARIABLE) && (sortmode != S_VARIABLE) && OBSOLETE(n))
 
 #if NCURSES_XNAMES
 #define BoolIndirect(j) ((j >= BOOLCOUNT) ? (j) : ((sortmode == S_NOSORT) ? j : bool_indirect[j]))
diff --git a/test/color_content.c b/test/color_content.c
new file mode 100644 (file)
index 0000000..77b04f1
--- /dev/null
@@ -0,0 +1,248 @@
+/****************************************************************************
+ * 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: color_content.c,v 1.2 2018/12/30 00:52:58 tom Exp $
+ */
+
+#define NEED_TIME_H
+#include <test.priv.h>
+
+typedef struct {
+    NCURSES_COLOR_T r;
+    NCURSES_COLOR_T g;
+    NCURSES_COLOR_T b;
+} MYCOLOR;
+
+static int i_opt;
+static int l_opt;
+static int n_opt;
+static int r_opt;
+static int s_opt;
+
+static MYCOLOR *expected;
+
+#if HAVE_GETTIMEOFDAY
+static struct timeval initial_time;
+static struct timeval finish_time;
+#endif
+
+static void
+failed(const char *msg)
+{
+    printw("%s", msg);
+    getch();
+    endwin();
+    ExitProgram(EXIT_FAILURE);
+}
+
+static NCURSES_COLOR_T
+random_color(void)
+{
+    return (NCURSES_COLOR_T) (rand() % 1000);
+}
+
+static void
+setup_test(void)
+{
+    initscr();
+    cbreak();
+    noecho();
+    scrollok(stdscr, TRUE);
+    if (has_colors()) {
+       start_color();
+       if (!can_change_color())
+           failed("this terminal cannot initialize colors");
+
+       if (!l_opt)
+           l_opt = COLORS;
+       if (l_opt <= 0)
+           failed("color limit must be greater than zero");
+
+       if (!n_opt) {
+           NCURSES_PAIRS_T color;
+
+           expected = typeCalloc(MYCOLOR, l_opt);
+           if (s_opt) {
+               NCURSES_COLOR_T r;
+               NCURSES_COLOR_T g;
+               NCURSES_COLOR_T b;
+               color = 0;
+               for (r = 0; r < 1000; ++r) {
+                   for (g = 0; g < 1000; ++g) {
+                       for (b = 0; b < 1000; ++b) {
+                           if (color < l_opt) {
+                               init_color(color, r, g, b);
+                               expected[color].r = r;
+                               expected[color].g = g;
+                               expected[color].b = b;
+                               ++color;
+                           } else {
+                               break;
+                           }
+                       }
+                   }
+               }
+           } else {
+               for (color = 1; color < l_opt; ++color) {
+                   expected[color].r = random_color();
+                   expected[color].g = random_color();
+                   expected[color].b = random_color();
+                   init_color(color, expected[color].r, expected[color].g,
+                              expected[color].b);
+               }
+           }
+       }
+    } else {
+       failed("This demo requires a color terminal");
+    }
+#if HAVE_GETTIMEOFDAY
+    gettimeofday(&initial_time, 0);
+#endif
+}
+
+static void
+run_test(void)
+{
+    NCURSES_PAIRS_T color;
+    bool success = TRUE;
+    for (color = 0; color < l_opt; ++color) {
+       NCURSES_COLOR_T r;
+       NCURSES_COLOR_T g;
+       NCURSES_COLOR_T b;
+       if (color_content(color, &r, &g, &b) == OK) {
+           if (expected != 0) {
+               if (r != expected[color].r)
+                   success = FALSE;
+               if (g != expected[color].g)
+                   success = FALSE;
+               if (b != expected[color].b)
+                   success = FALSE;
+           }
+       }
+    }
+    if (i_opt) {
+       addch(success ? '.' : '?');
+       refresh();
+    }
+}
+
+static void
+finish_test(void)
+{
+    getch();
+    endwin();
+}
+
+#if HAVE_GETTIMEOFDAY
+static double
+seconds(struct timeval *mark)
+{
+    double result = (double) mark->tv_sec;
+    result += ((double) mark->tv_usec / 1e6);
+    return result;
+}
+#endif
+
+static void
+usage(void)
+{
+    static const char *msg[] =
+    {
+       "Usage: pair_content [options]"
+       ,""
+       ,"Options:"
+       ," -i       interactive, showing test-progress"
+       ," -l NUM   test NUM color pairs, rather than terminal description"
+       ," -n       do not initialize color pairs"
+       ," -r COUNT repeat for given count"
+       ," -s       initialize pairs sequentially rather than random"
+    };
+    size_t n;
+    for (n = 0; n < SIZEOF(msg); n++)
+       fprintf(stderr, "%s\n", msg[n]);
+    ExitProgram(EXIT_FAILURE);
+}
+
+int
+main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
+{
+    int i;
+    int repeat;
+
+    while ((i = getopt(argc, argv, "il:nr:s")) != -1) {
+       switch (i) {
+       case 'i':
+           i_opt = 1;
+           break;
+       case 'l':
+           if ((l_opt = atoi(optarg)) <= 0)
+               usage();
+           break;
+       case 'n':
+           n_opt = 1;
+           break;
+       case 'r':
+           if ((r_opt = atoi(optarg)) <= 0)
+               usage();
+           break;
+       case 's':
+           s_opt = 1;
+           break;
+       default:
+           usage();
+       }
+    }
+    if (optind < argc)
+       usage();
+    if (r_opt <= 0)
+       r_opt = 1;
+
+    setup_test();
+
+    for (repeat = 0; repeat < r_opt; ++repeat) {
+       run_test();
+       if (i_opt) {
+           addch('.');
+           refresh();
+       }
+    }
+
+    if (i_opt) {
+       addch('\n');
+    }
+    printw("DONE: ");
+#if HAVE_GETTIMEOFDAY
+    gettimeofday(&finish_time, 0);
+    printw("%.03f seconds",
+          seconds(&finish_time)
+          - seconds(&initial_time));
+#endif
+    finish_test();
+
+    ExitProgram(EXIT_SUCCESS);
+}
index a9ea6a3e6009774258c83d0e28c4ccc707fec278..5ec4dcbf990e032a1c894a9de70360d707aa33fe 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2011-2012,2016 Free Software Foundation, Inc.              *
+ * Copyright (c) 2011-2016,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,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: color_name.h,v 1.5 2016/09/04 20:11:36 tom Exp $
+ * $Id: color_name.h,v 1.6 2018/12/29 15:19:30 tom Exp $
  */
 
 #ifndef __COLORNAME_H
@@ -79,7 +79,7 @@ color_code(const char *color)
     }
     return result;
 }
-#endif /* NEED_COLOR_NAME */
+#endif /* NEED_COLOR_CODE */
 
 #ifdef NEED_COLOR_NAME
 static const char *
index a83a549d23b5e19454da0eefed1b8715a8433e2f..0f4e898a7a6c38baca71e14a77d6dfcaaa8d0761 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2005-2016,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 2005-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            *
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: demo_altkeys.c,v 1.11 2017/06/17 18:33:03 tom Exp $
+ * $Id: demo_altkeys.c,v 1.12 2018/12/29 17:52:53 tom Exp $
  *
  * Demonstrate the define_key() function.
  * Thomas Dickey - 2005/10/22
  */
 
+#define NEED_TIME_H
 #include <test.priv.h>
 
 #if defined(NCURSES_VERSION) && NCURSES_EXT_FUNCS
 
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-
 #define MY_LOGFILE "demo_altkeys.log"
 #define MY_KEYS (KEY_MAX + 1)
 
index 437ed5683e2460347d718d5dea3dba1fc004bde7..63426e81ea0ec78d2427ccaba397d7caf285bfde 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2017 Free Software Foundation, Inc.                        *
+ * Copyright (c) 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,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: extended_color.c,v 1.10 2017/04/15 21:40:50 tom Exp $
+ * $Id: extended_color.c,v 1.11 2018/12/29 21:50:33 tom Exp $
  */
 
 #include <test.priv.h>
 
 #define SHOW(n) ((n) == ERR ? "ERR" : "OK")
 
+#if USE_SP_FUNCS
 static bool opt_s = FALSE;
+#define if_opt_s(a,b) (opt_s ? (a) : (b))
+#else
+#define if_opt_s(a,b) (b)
+#endif
 
 static void
 failed(const char *name)
@@ -51,11 +56,9 @@ do_pair_content(SCREEN *sp, int pair)
 {
     int i, f, b;
 
-    if (opt_s) {
-       i = extended_pair_content_sp(sp, pair, &f, &b);
-    } else {
-       i = extended_pair_content(0, &f, &b);
-    }
+    (void) sp;
+    i = if_opt_s(extended_pair_content_sp(sp, pair, &f, &b),
+                extended_pair_content(0, &f, &b));
     if (i != OK)
        failed("pair_content");
     printw("pair %d contains (%d,%d)\n", pair, f, b);
@@ -66,11 +69,10 @@ static void
 do_init_pair(SCREEN *sp, int pair, int fg, int bg)
 {
     int i;
-    if (opt_s) {
-       i = init_extended_pair_sp(sp, pair, fg, bg);
-    } else {
-       i = init_extended_pair(pair, fg, bg);
-    }
+
+    (void) sp;
+    i = if_opt_s(init_extended_pair_sp(sp, pair, fg, bg),
+                init_extended_pair(pair, fg, bg));
     if (i != OK)
        failed("init_pair");
 }
@@ -80,11 +82,10 @@ do_init_color(SCREEN *sp, int color, int adjust)
 {
     int r, g, b;
     int i;
-    if (opt_s) {
-       i = extended_color_content_sp(sp, color, &r, &g, &b);
-    } else {
-       i = extended_color_content(color, &r, &g, &b);
-    }
+
+    (void) sp;
+    i = if_opt_s(extended_color_content_sp(sp, color, &r, &g, &b),
+                extended_color_content(color, &r, &g, &b));
     if (i != OK)
        failed("color_content");
 
@@ -92,11 +93,8 @@ do_init_color(SCREEN *sp, int color, int adjust)
     g = (adjust + 1000 + g) % 1000;
     b = (adjust + 1000 + b) % 1000;
 
-    if (opt_s) {
-       i = init_extended_color_sp(sp, color, r, g, b);
-    } else {
-       i = init_extended_color(color, r, g, b);
-    }
+    i = if_opt_s(init_extended_color_sp(sp, color, r, g, b),
+                init_extended_color(color, r, g, b));
     if (i != OK)
        failed("init_color");
 }
@@ -116,11 +114,10 @@ show_1_rgb(SCREEN *sp, const char *name, int color, int y, int x)
 {
     int r, g, b;
     int i;
-    if (opt_s) {
-       i = extended_color_content_sp(sp, color, &r, &g, &b);
-    } else {
-       i = extended_color_content(color, &r, &g, &b);
-    }
+
+    (void) sp;
+    i = if_opt_s(extended_color_content_sp(sp, color, &r, &g, &b),
+                extended_color_content(color, &r, &g, &b));
     wmove(stdscr, y, x);
     if (i == OK) {
        printw("%-8s %3d/%3d/%3d", name, r, g, b);
@@ -166,9 +163,11 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
 
     while ((i = getopt(argc, argv, "s")) != -1) {
        switch (i) {
+#if USE_SP_FUNCS
        case 's':
            opt_s = TRUE;
            break;
+#endif
        default:
            usage();
            /* NOTREACHED */
@@ -210,11 +209,8 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
 
     printw("Drawing soft-key tabs with pair 2\n");
     slk_attrset(A_BOLD);       /* reverse-video is hard to see */
-    if (opt_s) {
-       extended_slk_color_sp(sp, 2);
-    } else {
-       extended_slk_color(2);
-    }
+    i = if_opt_s(extended_slk_color_sp(sp, 2),
+                extended_slk_color(2));
     for (i = 1; i <= 8; ++i) {
        char temp[80];
        sprintf(temp, "(SLK-%d)", i);
@@ -223,7 +219,9 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
     slk_touch();
     slk_noutrefresh();
 
-    if (opt_s ? can_change_color_sp(sp) : can_change_color()) {
+    i = if_opt_s(can_change_color_sp(sp),
+                can_change_color());
+    if (i) {
        do_color_set("Default Colors", 0);
        printw("Press any key to stop...\n");
        nodelay(stdscr, TRUE);
index f7ecfd97b9195c8fb41cd4e303538c7d8556a2d2..bcda90c203aaa167d708a71022fda13555982f16 100644 (file)
@@ -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            *
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey, 2006
  *
- * $Id: foldkeys.c,v 1.6 2017/06/17 19:36:33 tom Exp $
+ * $Id: foldkeys.c,v 1.7 2018/12/29 17:53:03 tom Exp $
  *
  * Demonstrate a method for altering key definitions at runtime.
  *
  * merging only for the keys which are defined in the terminal description.
  */
 
+#define NEED_TIME_H
 #include <test.priv.h>
 
 #if defined(NCURSES_VERSION) && NCURSES_EXT_FUNCS
 
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-
 #define MY_LOGFILE "demo_foldkeys.log"
 #define MY_KEYS (KEY_MAX + 1)
 
index dcdd29f5200f16abe6e4840d2baedfcf674f1bb5..4862b10008d9979e84e0c03864157c2b99f4e6c4 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: modules,v 1.68 2018/11/24 17:59:04 tom Exp $
+# $Id: modules,v 1.69 2018/12/29 15:32:12 tom Exp $
 ##############################################################################
 # Copyright (c) 1998-2017,2018 Free Software Foundation, Inc.                #
 #                                                                            #
@@ -38,6 +38,7 @@ bs            progs           $(srcdir)       $(HEADER_DEPS)
 cardfile       progs           $(srcdir)       $(HEADER_DEPS)  ../include/panel.h ../include/form.h
 chgat          progs           $(srcdir)       $(HEADER_DEPS)  $(srcdir)/popup_msg.h
 clip_printw    progs           $(srcdir)       $(HEADER_DEPS)  $(srcdir)/popup_msg.h
+color_content  progs           $(srcdir)       $(HEADER_DEPS)
 color_set      progs           $(srcdir)       $(HEADER_DEPS)
 demo_altkeys   progs           $(srcdir)       $(HEADER_DEPS)
 demo_defkey    progs           $(srcdir)       $(HEADER_DEPS)
@@ -80,6 +81,7 @@ movewindow    progs           $(srcdir)       $(HEADER_DEPS)  $(srcdir)/popup_msg.h
 ncurses                progs           $(srcdir)       $(HEADER_DEPS)  ../include/panel.h ../include/menu.h ../include/form.h
 newdemo                progs           $(srcdir)       $(HEADER_DEPS)
 padview                progs           $(srcdir)       $(HEADER_DEPS)  $(srcdir)/widechars.h   $(srcdir)/popup_msg.h
+pair_content   progs           $(srcdir)       $(HEADER_DEPS)
 picsmap                progs           $(srcdir)       $(HEADER_DEPS)
 popup_msg      progs           $(srcdir)       $(HEADER_DEPS)  $(srcdir)/popup_msg.h
 railroad       progs           $(srcdir)       $(HEADER_DEPS)
diff --git a/test/pair_content.c b/test/pair_content.c
new file mode 100644 (file)
index 0000000..4e1d0b8
--- /dev/null
@@ -0,0 +1,236 @@
+/****************************************************************************
+ * 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: pair_content.c,v 1.2 2018/12/30 00:54:48 tom Exp $
+ */
+
+#define NEED_TIME_H
+#include <test.priv.h>
+
+typedef struct {
+    NCURSES_COLOR_T fg;
+    NCURSES_COLOR_T bg;
+} MYPAIR;
+
+static int i_opt;
+static int l_opt;
+static int n_opt;
+static int r_opt;
+static int s_opt;
+
+static MYPAIR *expected;
+
+#if HAVE_GETTIMEOFDAY
+static struct timeval initial_time;
+static struct timeval finish_time;
+#endif
+
+static void
+failed(const char *msg)
+{
+    printw("%s", msg);
+    getch();
+    endwin();
+    ExitProgram(EXIT_FAILURE);
+}
+
+static NCURSES_COLOR_T
+random_color(void)
+{
+    return (NCURSES_COLOR_T) (rand() % COLORS);
+}
+
+static void
+setup_test(void)
+{
+    initscr();
+    cbreak();
+    noecho();
+    scrollok(stdscr, TRUE);
+    if (has_colors()) {
+       start_color();
+
+       if (!l_opt)
+           l_opt = COLOR_PAIRS;
+       if (l_opt <= 1)
+           failed("color-pair limit must be greater than one");
+
+       if (!n_opt) {
+           NCURSES_PAIRS_T pair;
+
+           expected = typeCalloc(MYPAIR, l_opt);
+           if (s_opt) {
+               NCURSES_COLOR_T fg;
+               NCURSES_COLOR_T bg;
+               pair = 1;
+               for (fg = 0; fg < COLORS; ++fg) {
+                   for (bg = 0; bg < COLORS; ++bg) {
+                       if (pair < l_opt) {
+                           init_pair(pair, fg, bg);
+                           expected[pair].fg = fg;
+                           expected[pair].bg = bg;
+                           ++pair;
+                       } else {
+                           break;
+                       }
+                   }
+               }
+           } else {
+               for (pair = 1; (int) pair < l_opt; ++pair) {
+                   expected[pair].fg = random_color();
+                   expected[pair].bg = random_color();
+                   init_pair(pair, expected[pair].fg, expected[pair].bg);
+               }
+           }
+       }
+    } else {
+       failed("This demo requires a color terminal");
+    }
+#if HAVE_GETTIMEOFDAY
+    gettimeofday(&initial_time, 0);
+#endif
+}
+
+static void
+run_test(void)
+{
+    NCURSES_PAIRS_T pair;
+    bool success = TRUE;
+    for (pair = 1; (int) pair < l_opt; ++pair) {
+       NCURSES_COLOR_T fg;
+       NCURSES_COLOR_T bg;
+       if (pair_content(pair, &fg, &bg) == OK) {
+           if (expected != 0) {
+               if (fg != expected[pair].fg)
+                   success = FALSE;
+               if (bg != expected[pair].bg)
+                   success = FALSE;
+           }
+       }
+    }
+    if (i_opt) {
+       addch(success ? '.' : '?');
+       refresh();
+    }
+}
+
+static void
+finish_test(void)
+{
+    getch();
+    endwin();
+}
+
+#if HAVE_GETTIMEOFDAY
+static double
+seconds(struct timeval *mark)
+{
+    double result = (double) mark->tv_sec;
+    result += ((double) mark->tv_usec / 1e6);
+    return result;
+}
+#endif
+
+static void
+usage(void)
+{
+    static const char *msg[] =
+    {
+       "Usage: pair_content [options]"
+       ,""
+       ,"Options:"
+       ," -i       interactive, showing test-progress"
+       ," -l NUM   test NUM color pairs, rather than terminal description"
+       ," -n       do not initialize color pairs"
+       ," -r COUNT repeat for given count"
+       ," -s       initialize pairs sequentially rather than random"
+    };
+    size_t n;
+    for (n = 0; n < SIZEOF(msg); n++)
+       fprintf(stderr, "%s\n", msg[n]);
+    ExitProgram(EXIT_FAILURE);
+}
+
+int
+main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
+{
+    int i;
+    int repeat;
+
+    while ((i = getopt(argc, argv, "il:nr:s")) != -1) {
+       switch (i) {
+       case 'i':
+           i_opt = 1;
+           break;
+       case 'l':
+           if ((l_opt = atoi(optarg)) <= 0)
+               usage();
+           break;
+       case 'n':
+           n_opt = 1;
+           break;
+       case 'r':
+           if ((r_opt = atoi(optarg)) <= 0)
+               usage();
+           break;
+       case 's':
+           s_opt = 1;
+           break;
+       default:
+           usage();
+       }
+    }
+    if (optind < argc)
+       usage();
+    if (r_opt <= 0)
+       r_opt = 1;
+
+    setup_test();
+
+    for (repeat = 0; repeat < r_opt; ++repeat) {
+       run_test();
+       if (i_opt) {
+           addch('.');
+           refresh();
+       }
+    }
+
+    if (i_opt) {
+       addch('\n');
+    }
+    printw("DONE: ");
+#if HAVE_GETTIMEOFDAY
+    gettimeofday(&finish_time, 0);
+    printw("%.03f seconds",
+          seconds(&finish_time)
+          - seconds(&initial_time));
+#endif
+    finish_test();
+
+    ExitProgram(EXIT_SUCCESS);
+}
index dfa4cb435363529ab5ad17332bdb8766c91607cd..e9e5144ccffc89cbbcc5acad958db1b250ee16e0 100644 (file)
@@ -1,6 +1,6 @@
-# $Id: programs,v 1.42 2018/11/24 17:56:32 tom Exp $
+# $Id: programs,v 1.43 2018/12/29 15:32:00 tom Exp $
 ##############################################################################
-# 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 "Software"), #
@@ -36,6 +36,7 @@ bs            $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   bs
 cardfile       $(LDFLAGS_DEFAULT)      $(LOCAL_LIBS)   cardfile
 chgat          $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   chgat popup_msg
 clip_printw    $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   clip_printw popup_msg
+color_content  $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   color_content
 color_set      $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   color_set
 demo_altkeys   $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   demo_altkeys
 demo_defkey    $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   demo_defkey
@@ -74,9 +75,10 @@ list_keys    $(LDFLAGS_TINFO)        $(LOCAL_LIBS)   list_keys
 lrtest         $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   lrtest
 movewindow     $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   movewindow popup_msg
 ncurses                $(LDFLAGS_DEFAULT)      $(LOCAL_LIBS)   ncurses
+newdemo                $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   newdemo
 padview                $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   padview popup_msg
+pair_content   $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   pair_content
 picsmap                $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   picsmap
-newdemo                $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   newdemo
 railroad       $(LDFLAGS_TINFO)        $(LOCAL_LIBS)   railroad
 rain           $(LDFLAGS_THREADS)      $(LOCAL_LIBS)   rain popup_msg
 redraw         $(LDFLAGS_CURSES)       $(LOCAL_LIBS)   redraw popup_msg
index 9d88079f94c3a5f8719db7be7b3d161465f1521d..d96089dab4a11bd53c537b99767984ae65c8f36f 100644 (file)
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: savescreen.c,v 1.53 2018/05/12 15:11:16 tom Exp $
+ * $Id: savescreen.c,v 1.54 2018/12/29 17:25:56 tom Exp $
  *
  * Demonstrate save/restore functions from the curses library.
  * Thomas Dickey - 2007/7/14
  */
 
+#define NEED_TIME_H
 #include <test.priv.h>
 #include <popup_msg.h>
 #include <parse_rgb.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-
 #if defined(__hpux)
 #define MyMarker 'X'
 #else
index 42cb8cf7269b5bd3495978aa947490e9f5f526b3..23456a4372f30718dc5d90b9de58b7c94410b911 100644 (file)
@@ -1,22 +1,12 @@
-/* $Id: tclock.c,v 1.38 2017/09/09 00:37:06 tom Exp $ */
+/* $Id: tclock.c,v 1.39 2018/12/29 17:23:42 tom Exp $ */
 
+#define NEED_TIME_H
 #include <test.priv.h>
 
 #if HAVE_MATH_H
 
 #include <math.h>
 
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-
 /*
   tclock - analog/digital clock for curses.
   If it gives you joy, then
index f4c11aa5506791777c71c8c1fdc84c5f29a030db..f1ac8774248f2d74ddeabd951b9bc908669274bf 100644 (file)
@@ -29,7 +29,7 @@
 /****************************************************************************
  *  Author: Thomas E. Dickey                    1996-on                     *
  ****************************************************************************/
-/* $Id: test.priv.h,v 1.169 2018/08/19 00:28:27 tom Exp $ */
+/* $Id: test.priv.h,v 1.171 2018/12/29 21:44:07 tom Exp $ */
 
 #ifndef __TEST_PRIV_H
 #define __TEST_PRIV_H 1
@@ -467,6 +467,12 @@ extern int optind;
 #define slk_clear()            /* nothing */
 #endif
 
+#if HAVE_TPUTS_SP
+#define USE_SP_FUNCS 1
+#else
+#define USE_SP_FUNCS 0
+#endif
+
 #ifndef HAVE_WSYNCDOWN
 #define wsyncdown(win)         /* nothing */
 #endif
@@ -897,6 +903,19 @@ extern char *strnames[], *strcodes[], *strfnames[];
 
 #endif
 
+#ifdef NEED_TIME_H
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#endif
+
 /* Use this to quiet gcc's -Wwrite-strings warnings, but accommodate SVr4
  * curses which doesn't have const parameters declared (so far) in the places
  * that XSI shows.
index 0e05aaee58d189d52723e30ad06d947148c68461..c23607e9cdf67cdaca3fa04b39c7eb41b44f1f85 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/env perl
-# $Id: tracemunch,v 1.20 2018/05/02 00:14:29 tom Exp $
+# $Id: tracemunch,v 1.24 2018/12/29 22:20:06 tom Exp $
 ##############################################################################
 # Copyright (c) 1998-2017,2018 Free Software Foundation, Inc.                #
 #                                                                            #
@@ -90,129 +90,149 @@ sub transaddr {
     return $arg;
 }
 
-while (<STDIN>) {
-    my $addr;
-    my $n;
-    my $awaiting = "";
-
-  CLASSIFY: {
-
-        my $thread = "";
-        if ( $_ =~ /^(0x[[:xdigit:]]+):/ ) {
-            $thr_addr{$1} = ++$thr_nums unless defined $thr_addr{$1};
-            $thread = "thread" . $thr_addr{$1} . ":";
-            $_ =~ s/^[^:]*://;
-        }
-
-        # Transform window pointer addresses so it's easier to compare logs
-        $awaiting = "curscr" if ( $_ =~ /creating curscr/ );
-        $awaiting = "newscr" if ( $_ =~ /creating newscr/ );
-        $awaiting = "stdscr" if ( $_ =~ /creating stdscr/ );
-        $awaiting = "screen" if ( $_ =~ /^(\+ )*called \{new_prescr\(\)/ );
-        if ( $_ =~ /^create :window 0x([[:xdigit:]]+)/ ) {
-            $addr = "0x$1";
-            if ( $awaiting eq "curscr" ) {
-                $curscr = $addr;
-            }
-            elsif ( $awaiting eq "newscr" ) {
-                $newscr = $addr;
+sub muncher($) {
+    my $STDIN = shift;
+
+    while (<$STDIN>) {
+        my $addr;
+        my $n;
+        my $awaiting = "";
+
+      CLASSIFY: {
+
+            # just in case someone tries a file with cr/lf line-endings:
+            $_ =~ s/\r\n/\n/g;
+            $_ =~ s/\r/\n/g;
+
+            my $thread = "";
+            if ( $_ =~ /^(0x[[:xdigit:]]+):/ ) {
+                $thr_addr{$1} = ++$thr_nums unless defined $thr_addr{$1};
+                $thread = "thread" . $thr_addr{$1} . ":";
+                $_ =~ s/^[^:]*://;
             }
-            elsif ( $awaiting eq "stdscr" ) {
-                $stdscr = $addr;
+
+            # Transform window pointer addresses so it's easier to compare logs
+            $awaiting = "curscr" if ( $_ =~ /creating curscr/ );
+            $awaiting = "newscr" if ( $_ =~ /creating newscr/ );
+            $awaiting = "stdscr" if ( $_ =~ /creating stdscr/ );
+            $awaiting = "screen" if ( $_ =~ /^(\+ )*called \{new_prescr\(\)/ );
+            if ( $_ =~ /^create :window 0x([[:xdigit:]]+)/ ) {
+                $addr = "0x$1";
+                if ( $awaiting eq "curscr" ) {
+                    $curscr = $addr;
+                }
+                elsif ( $awaiting eq "newscr" ) {
+                    $newscr = $addr;
+                }
+                elsif ( $awaiting eq "stdscr" ) {
+                    $stdscr = $addr;
+                }
+                else {
+                    $win_addr{$addr} = $win_nums++;
+                }
+                $awaiting = "";
             }
-            else {
-                $win_addr{$addr} = $win_nums++;
+            elsif ( $_ =~ /^(\+ )*called \{_nc_add_to_try\((0x[[:xdigit:]]+),/ )
+            {
+                $try_addr{$2} = ++$try_nums unless defined $try_addr{$2};
             }
-            $awaiting = "";
-        }
-        elsif ( $_ =~ /^(\+ )*called \{_nc_add_to_try\((0x[[:xdigit:]]+),/ ) {
-            $try_addr{$2} = ++$try_nums unless defined $try_addr{$2};
-        }
-        elsif ( $_ =~ /^(\+ )*_nc_alloc_screen_sp 0x([[:xdigit:]]+)/ ) {
-            $addr = "0x$2";
-            $scr_addr{$addr} = ++$scr_nums unless ( $scr_addr{$addr} );
-            $awaiting = "";
-        }
-        elsif ( $_ =~ /^(\+ )*return }0x([[:xdigit:]]+)/ ) {
-            $addr = "0x$2";
-            if ( $awaiting eq "screen" ) {
+            elsif ( $_ =~ /^(\+ )*_nc_alloc_screen_sp 0x([[:xdigit:]]+)/ ) {
+                $addr = "0x$2";
                 $scr_addr{$addr} = ++$scr_nums unless ( $scr_addr{$addr} );
+                $awaiting = "";
             }
-        }
-        elsif ( $_ =~ /^\.\.\.deleted win=0x([[:xdigit:]]+)/ ) {
-            $addr = "0x$1";
-            $_    = &transaddr($_);
-            if ( $addr eq $curscr ) {
-                $curscr = "";
-            }
-            elsif ( $addr eq $newscr ) {
-                $newscr = "";
-            }
-            elsif ( $addr eq $stdscr ) {
-                $stdscr = "";
-            }
-            else {
-                undef $win_addr{$addr};
+            elsif ( $_ =~ /^(\+ )*return }0x([[:xdigit:]]+)/ ) {
+                $addr = "0x$2";
+                if ( $awaiting eq "screen" ) {
+                    $scr_addr{$addr} = ++$scr_nums unless ( $scr_addr{$addr} );
+                }
             }
-        }
-
-        # Compactify runs of PutAttrChar calls (TR_CHARPUT)
-        if ( $_ =~ /$putattr/ ) {
-            my $putattr_chars = $1;
-            my $starty        = $2;
-            my $startx        = $3;
-            while (<STDIN>) {
-                if ( $_ =~ /$putattr/ ) {
-                    $putattr_chars .= $1;
+            elsif ( $_ =~ /^\.\.\.deleted win=0x([[:xdigit:]]+)/ ) {
+                $addr = "0x$1";
+                $_    = &transaddr($_);
+                if ( $addr eq $curscr ) {
+                    $curscr = "";
+                }
+                elsif ( $addr eq $newscr ) {
+                    $newscr = "";
+                }
+                elsif ( $addr eq $stdscr ) {
+                    $stdscr = "";
                 }
                 else {
-                    last;
+                    undef $win_addr{$addr};
                 }
             }
-            print
+
+            # Compactify runs of PutAttrChar calls (TR_CHARPUT)
+            if ( $_ =~ /$putattr/ ) {
+                my $putattr_chars = $1;
+                my $starty        = $2;
+                my $startx        = $3;
+                while (<$STDIN>) {
+                    if ( $_ =~ /$putattr/ ) {
+                        $putattr_chars .= $1;
+                    }
+                    else {
+                        last;
+                    }
+                }
+                print
 "RUN of PutAttrChar()s: \"$putattr_chars\" from ${starty}, ${startx}\n";
-            redo CLASSIFY;
-        }
-
-        # Compactify runs of waddnstr calls (TR_CALLS)
-        if ( $_ =~ /$waddnstr/ ) {
-            my $waddnstr_chars = $2;
-            my $winaddr        = $1;
-            while (<STDIN>) {
-                if ( $_ =~ /$waddnstr/ && $1 eq $winaddr ) {
-                    $waddnstr_chars .= $2;
+                redo CLASSIFY;
+            }
+
+            # Compactify runs of waddnstr calls (TR_CALLS)
+            if ( $_ =~ /$waddnstr/ ) {
+                my $waddnstr_chars = $2;
+                my $winaddr        = $1;
+                while (<$STDIN>) {
+                    if ( $_ =~ /$waddnstr/ && $1 eq $winaddr ) {
+                        $waddnstr_chars .= $2;
+                    }
+                    else {
+                        last;
+                    }
+                }
+                my $winaddstr = &transaddr($winaddr);
+                print "RUN of waddnstr()s: $winaddr, \"$waddnstr_chars\"\n";
+                redo CLASSIFY;
+            }
+
+            # More transformations can go here
+
+            # Repeated runs of anything
+            my $anyline     = &transaddr($_);
+            my $repeatcount = 1;
+            while (<$STDIN>) {
+                if ( &transaddr($_) eq $anyline ) {
+                    $repeatcount++;
                 }
                 else {
                     last;
                 }
             }
-            my $winaddstr = &transaddr($winaddr);
-            print "RUN of waddnstr()s: $winaddr, \"$waddnstr_chars\"\n";
-            redo CLASSIFY;
-        }
-
-        # More transformations can go here
-
-        # Repeated runs of anything
-        my $anyline     = &transaddr($_);
-        my $repeatcount = 1;
-        while (<STDIN>) {
-            if ( &transaddr($_) eq $anyline ) {
-                $repeatcount++;
+            if ( $repeatcount > 1 ) {
+                print "${repeatcount} REPEATS OF $anyline";
             }
             else {
-                last;
+                print $thread . $anyline;
             }
-        }
-        if ( $repeatcount > 1 ) {
-            print "${repeatcount} REPEATS OF $anyline";
-        }
-        else {
-            print $thread . $anyline;
-        }
-        redo CLASSIFY if $_;
-
-    }    # :CLASSIFY
+            redo CLASSIFY if $_;
+
+        }    # :CLASSIFY
+    }
+}
+
+if ( $#ARGV >= 0 ) {
+    while ( $#ARGV >= 0 ) {
+        my $file = shift @ARGV;
+        open my $ifh, "<", $file or die $!;
+        &muncher($ifh);
+    }
+}
+else {
+    &muncher( \*STDIN );
 }
 
 # tracemunch ends here