]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 6.2 - patch 20210306
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 7 Mar 2021 01:58:37 +0000 (01:58 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 7 Mar 2021 01:58:37 +0000 (01:58 +0000)
+ improved test/test_parm.c, by limiting the tests to capabilities
  that might have parameters or padding, and combined with tputs test.
+ improve discussion of padding versus tparm and tputs in
  man/curs_terminfo.3x
+ update portability note for FreeBSD in man/tput.1

16 files changed:
NEWS
VERSION
dist.mk
man/curs_terminfo.3x
man/tput.1
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
test/README
test/test.priv.h
test/test_opaque.c
test/test_tparm.c

diff --git a/NEWS b/NEWS
index 3856e71b9292142acaf1b8850d2e058443f23ff3..25bf2fd5f764c5efb9380ec49c1ebf6a3ad5c47b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -26,7 +26,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.3636 2021/02/28 01:10:59 tom Exp $
+-- $Id: NEWS,v 1.3638 2021/03/06 22:42:18 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -46,6 +46,13 @@ 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.
 
 Changes through 1.9.9e did not credit all contributions;
 it is not possible to add this information.
 
+20210306
+       + improved test/test_parm.c, by limiting the tests to capabilities
+         that might have parameters or padding, and combined with tputs test.
+       + improve discussion of padding versus tparm and tputs in
+         man/curs_terminfo.3x
+       + update portability note for FreeBSD in man/tput.1
+
 20210227
        + modify tic/infocmp to eliminate unnecessary "\" to escape ":" in
          terminfo format.
 20210227
        + modify tic/infocmp to eliminate unnecessary "\" to escape ":" in
          terminfo format.
diff --git a/VERSION b/VERSION
index 3f303bef629313596865de79f29a4fbb4709368b..f2d367fa800a2e25ed9cb4ac55f9570d2425a333 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5:0:10 6.2     20210227
+5:0:10 6.2     20210306
diff --git a/dist.mk b/dist.mk
index f7224e3aeb07c89ab276b25df4d855bdda4ead84..0cfcb5c366021778b8aa11d5ddf17444ca91c16e 100644 (file)
--- a/dist.mk
+++ b/dist.mk
@@ -26,7 +26,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: dist.mk,v 1.1402 2021/02/27 11:12:00 tom Exp $
+# $Id: dist.mk,v 1.1403 2021/03/06 12:54:29 tom Exp $
 # Makefile for creating ncurses distributions.
 #
 # This only needs to be used directly as a makefile by developers, but
 # Makefile for creating ncurses distributions.
 #
 # This only needs to be used directly as a makefile by developers, but
@@ -38,7 +38,7 @@ SHELL = /bin/sh
 # These define the major/minor/patch versions of ncurses.
 NCURSES_MAJOR = 6
 NCURSES_MINOR = 2
 # These define the major/minor/patch versions of ncurses.
 NCURSES_MAJOR = 6
 NCURSES_MINOR = 2
-NCURSES_PATCH = 20210227
+NCURSES_PATCH = 20210306
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 9120a04b9a9820406ddb77b8edd25beb81665e9a..9cdbbddf5c07f25202265537eeb49c7b7b7f2b78 100644 (file)
@@ -27,7 +27,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_terminfo.3x,v 1.72 2021/01/02 23:50:04 tom Exp $
+.\" $Id: curs_terminfo.3x,v 1.74 2021/03/06 16:05:19 tom Exp $
 .TH curs_terminfo 3X ""
 .ie \n(.g .ds `` \(lq
 .el       .ds `` ``
 .TH curs_terminfo 3X ""
 .ie \n(.g .ds `` \(lq
 .el       .ds `` ``
@@ -280,6 +280,12 @@ the prototype expects \fBlong\fP (integer) values.
 .bP
 Aside from the \fBset_attributes\fP (\fBsgr\fP) capability,
 most terminal capabilities require no more than one or two parameters.
 .bP
 Aside from the \fBset_attributes\fP (\fBsgr\fP) capability,
 most terminal capabilities require no more than one or two parameters.
+.bP
+Padding information is ignored by \fBtparm\fP;
+it is interpreted by \fBtputs\fP.
+.bP
+The capability string is null-terminated.
+Use \*(``\\200\*('' where an ASCII NUL is needed in the output.
 .PP
 \fBtiparm\fP is a newer form of \fBtparm\fP which uses \fI<stdarg.h>\fP
 rather than a fixed-parameter list.
 .PP
 \fBtiparm\fP is a newer form of \fBtparm\fP which uses \fI<stdarg.h>\fP
 rather than a fixed-parameter list.
@@ -287,7 +293,10 @@ Its numeric parameters are integers (int) rather than longs.
 .\" ***************************************************************************
 .SS Output Functions
 .PP
 .\" ***************************************************************************
 .SS Output Functions
 .PP
-The \fBtputs\fR routine applies padding information to the string
+The \fBtputs\fR routine applies padding information
+(i.e., by interpreting marker embedded in the terminfo capability
+such as \*(``$<5>\*('' as 5 milliseconds)
+to the string
 \fIstr\fR and outputs it:
 .bP
 The \fIstr\fR parameter must be a terminfo string
 \fIstr\fR and outputs it:
 .bP
 The \fIstr\fR parameter must be a terminfo string
index 64fb453016eb19223bd99b3c4e710275075acf03..8e4a565842c403939dd104018cae08b112d0c232 100644 (file)
@@ -1,6 +1,6 @@
 '\" t
 .\"***************************************************************************
 '\" t
 .\"***************************************************************************
-.\" Copyright 2018,2020 Thomas E. Dickey                                     *
+.\" Copyright 2018-2020,2021 Thomas E. Dickey                                *
 .\" Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
@@ -28,7 +28,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: tput.1,v 1.65 2020/12/19 22:17:47 tom Exp $
+.\" $Id: tput.1,v 1.66 2021/03/06 15:56:23 tom Exp $
 .TH @TPUT@ 1 ""
 .ds d @TERMINFO@
 .ds n 1
 .TH @TPUT@ 1 ""
 .ds d @TERMINFO@
 .ds n 1
@@ -547,6 +547,9 @@ A few platforms such as FreeBSD recognize termcap names rather
 than terminfo capability names in their respective \fBtput\fP commands.
 Since 2010, NetBSD's \fBtput\fP uses terminfo names.
 Before that, it (like FreeBSD) recognized termcap names.
 than terminfo capability names in their respective \fBtput\fP commands.
 Since 2010, NetBSD's \fBtput\fP uses terminfo names.
 Before that, it (like FreeBSD) recognized termcap names.
+.IP
+Beginning in 2021, FreeBSD uses the ncurses \fBtput\fP,
+configured for both terminfo (tested first) and termcap (as a fallback).
 .PP
 Because (apparently) \fIall\fP of the certified Unix systems
 support the full set of capability names, the reasoning for documenting
 .PP
 Because (apparently) \fIall\fP of the certified Unix systems
 support the full set of capability names, the reasoning for documenting
index a14e2f82a545726d84d51d0c4103e121077d6358..cce99274e62839db70683090ad1c10172e9a3267 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.2+20210227) unstable; urgency=low
+ncurses6 (6.2+20210306) unstable; urgency=low
 
   * latest weekly patch
 
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 27 Feb 2021 06:12:01 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 06 Mar 2021 07:54:29 -0500
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index a14e2f82a545726d84d51d0c4103e121077d6358..cce99274e62839db70683090ad1c10172e9a3267 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.2+20210227) unstable; urgency=low
+ncurses6 (6.2+20210306) unstable; urgency=low
 
   * latest weekly patch
 
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 27 Feb 2021 06:12:01 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 06 Mar 2021 07:54:29 -0500
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index b8b895cc0a4c5382ee0462290447802e6a24c6aa..1a19175752f0c0be7a0fb026f969ce2624df49da 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.2+20210227) unstable; urgency=low
+ncurses6 (6.2+20210306) unstable; urgency=low
 
   * latest weekly patch
 
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 27 Feb 2021 06:12:01 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 06 Mar 2021 07:54:29 -0500
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
index c1c4f91deda04c8a6b148f1943b0a1635ca8c69e..6abb5b23efb9b50aadfc7760f19921647986ecb6 100644 (file)
@@ -1,4 +1,4 @@
-; $Id: mingw-ncurses.nsi,v 1.445 2021/02/27 11:12:00 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.446 2021/03/06 12:54:29 tom Exp $\r
 \r
 ; TODO add examples\r
 ; TODO bump ABI to 6\r
 \r
 ; TODO add examples\r
 ; TODO bump ABI to 6\r
@@ -10,7 +10,7 @@
 !define VERSION_MAJOR "6"\r
 !define VERSION_MINOR "2"\r
 !define VERSION_YYYY  "2021"\r
 !define VERSION_MAJOR "6"\r
 !define VERSION_MINOR "2"\r
 !define VERSION_YYYY  "2021"\r
-!define VERSION_MMDD  "0227"\r
+!define VERSION_MMDD  "0306"\r
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
 \r
 !define MY_ABI   "5"\r
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
 \r
 !define MY_ABI   "5"\r
index a62760ed7b91821bdcbde3e289e93e36a57b4764..77844265456f403b187805e6988a2647db82b7a1 100644 (file)
@@ -3,7 +3,7 @@
 Summary: shared libraries for terminal handling
 Name: mingw32-ncurses6
 Version: 6.2
 Summary: shared libraries for terminal handling
 Name: mingw32-ncurses6
 Version: 6.2
-Release: 20210227
+Release: 20210306
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index 27b3a7e8dceb97e6f12c2fad9518525ab6f7e17f..8777335924c7b8828d9ce79905506a95e1df62e3 100644 (file)
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Version: 6.2
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Version: 6.2
-Release: 20210227
+Release: 20210306
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index 1a773490835127f8ad3e281a6d6d0c94530c870a..38ad98347ed188c8dedde4b59f6bf11e79ab663e 100644 (file)
@@ -1,7 +1,7 @@
 Summary: Curses library with POSIX thread support.
 Name: ncursest6
 Version: 6.2
 Summary: Curses library with POSIX thread support.
 Name: ncursest6
 Version: 6.2
-Release: 20210227
+Release: 20210306
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index 5dc07c657bfd54f491648169dbf678a24ebed617..09633462fd7496cfac05caab47cb878ec615ec05 100644 (file)
@@ -26,7 +26,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: README,v 1.72 2021/02/13 22:53:41 tom Exp $
+-- $Id: README,v 1.73 2021/03/07 00:08:58 tom Exp $
 -------------------------------------------------------------------------------
 
 The programs in this directory are used to test and demonstrate ncurses.
 -------------------------------------------------------------------------------
 
 The programs in this directory are used to test and demonstrate ncurses.
@@ -326,8 +326,8 @@ erase                               test: cardfile demo_menus filter firework firstlast hanoi lrtest ncurse
 erasechar                      test: ncurses
 erasechar_sp                   test: sp_tinfo
 erasewchar                     test: ncurses
 erasechar                      test: ncurses
 erasechar_sp                   test: sp_tinfo
 erasewchar                     test: ncurses
-exit_curses                    -
-exit_terminfo                  test: demo_tabs demo_termcap demo_terminfo dots dots_mvcur dots_termcap list_keys railroad sp_tinfo test_arrays test_sgr test_termattrs test_tparm test_vid_puts test_vidputs
+exit_curses                    test: back_ground background blue bs cardfile chgat clip_printw color_content color_set demo_altkeys demo_defkey demo_forms demo_keyok demo_menus demo_new_pair demo_panels demo_tabs demo_termcap demo_terminfo ditto dots dots_curses dots_mvcur dots_termcap dots_xcurses dup_field echochar extended_color filter firework firstlast foldkeys form_driver_w gdc hanoi hashtest inch_wide inchs ins_wide insdelln inserts key_names keynames knight list_keys lrtest move_field movewindow ncurses newdemo padview pair_content picsmap railroad rain redraw savescreen sp_tinfo tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_arrays test_get_wstr test_getstr test_instr test_inwstr test_opaque test_setupterm test_sgr test_termattrs test_tparm test_vid_puts test_vidputs testaddch testcurs testscanw view worm xmas
+exit_terminfo                  lib: ncurses
 extended_color_content         test: color_content extended_color
 extended_color_content_sp      test: extended_color
 extended_pair_content          test: extended_color pair_content
 extended_color_content         test: color_content extended_color
 extended_color_content_sp      test: extended_color
 extended_pair_content          test: extended_color pair_content
@@ -423,9 +423,9 @@ is_leaveok                  test: test_opaque
 is_linetouched                 lib: form
 is_nodelay                     test: test_opaque
 is_notimeout                   test: test_opaque
 is_linetouched                 lib: form
 is_nodelay                     test: test_opaque
 is_notimeout                   test: test_opaque
-is_pad                         -
+is_pad                         test: test_opaque
 is_scrollok                    test: ncurses test_opaque
 is_scrollok                    test: ncurses test_opaque
-is_subwin                      -
+is_subwin                      test: test_opaque
 is_syncok                      test: test_opaque
 is_term_resized                        -
 is_term_resized_sp             -
 is_syncok                      test: test_opaque
 is_term_resized                        -
 is_term_resized_sp             -
@@ -696,7 +696,7 @@ tiparm                              -
 touchline                      test: chgat clip_printw insdelln
 touchwin                       test: chgat clip_printw demo_menus filter firstlast inch_wide inchs ins_wide insdelln inserts movewindow ncurses popup_msg redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque xmas
 tparm                          test: dots dots_mvcur test_sgr test_tparm progs: tic tput
 touchline                      test: chgat clip_printw insdelln
 touchwin                       test: chgat clip_printw demo_menus filter firstlast inch_wide inchs ins_wide insdelln inserts movewindow ncurses popup_msg redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque xmas
 tparm                          test: dots dots_mvcur test_sgr test_tparm progs: tic tput
-tputs                          test: dots dots_mvcur dots_termcap railroad test_vid_puts test_vidputs progs: clear_cmd reset_cmd tabs
+tputs                          test: dots dots_mvcur dots_termcap railroad test_tparm test_vid_puts test_vidputs progs: clear_cmd reset_cmd tabs
 tputs_sp                       test: sp_tinfo
 trace                          -
 ttytype                                test: demo_terminfo test_sgr
 tputs_sp                       test: sp_tinfo
 trace                          -
 ttytype                                test: demo_terminfo test_sgr
@@ -775,7 +775,7 @@ wget_wch                    test: ins_wide ncurses test_add_wchstr test_addwstr
 wget_wstr                      test: test_get_wstr
 wgetbkgrnd                     lib: ncurses
 wgetch                         test: cardfile chgat clip_printw demo_defkey demo_keyok demo_menus demo_panels ditto dump_window dup_field edit_field gdc insdelln inserts knight move_field movewindow ncurses newdemo popup_msg rain redraw test_addchstr test_addstr test_opaque testcurs worm
 wget_wstr                      test: test_get_wstr
 wgetbkgrnd                     lib: ncurses
 wgetch                         test: cardfile chgat clip_printw demo_defkey demo_keyok demo_menus demo_panels ditto dump_window dup_field edit_field gdc insdelln inserts knight move_field movewindow ncurses newdemo popup_msg rain redraw test_addchstr test_addstr test_opaque testcurs worm
-wgetdelay                      -
+wgetdelay                      test: test_opaque
 wgetn_wstr                     test: ncurses test_get_wstr
 wgetnstr                       test: ncurses test_getstr
 wgetparent                     test: test_opaque
 wgetn_wstr                     test: ncurses test_get_wstr
 wgetnstr                       test: ncurses test_getstr
 wgetparent                     test: test_opaque
index 6913b25d14ca758e90660cbc49d6ecdfbc2d87e3..b360c8a9bb77a6aa14750a92f583a2d927a6c057 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright 2018-2019,2020 Thomas E. Dickey                                *
+ * Copyright 2018-2020,2021 Thomas E. Dickey                                *
  * Copyright 1998-2017,2018 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * Copyright 1998-2017,2018 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
@@ -30,7 +30,7 @@
 /****************************************************************************
  *  Author: Thomas E. Dickey                    1996-on                     *
  ****************************************************************************/
 /****************************************************************************
  *  Author: Thomas E. Dickey                    1996-on                     *
  ****************************************************************************/
-/* $Id: test.priv.h,v 1.191 2020/09/12 23:54:42 tom Exp $ */
+/* $Id: test.priv.h,v 1.193 2021/03/07 00:38:34 tom Exp $ */
 
 #ifndef __TEST_PRIV_H
 #define __TEST_PRIV_H 1
 
 #ifndef __TEST_PRIV_H
 #define __TEST_PRIV_H 1
@@ -914,11 +914,14 @@ extern int TABSIZE;
 
 #if defined(NCURSES_VERSION) && HAVE_NC_ALLOC_H
 #include <nc_alloc.h>
 
 #if defined(NCURSES_VERSION) && HAVE_NC_ALLOC_H
 #include <nc_alloc.h>
-#if HAVE_EXIT_TERMINFO && defined(USE_TINFO)
+#if HAVE_EXIT_TERMINFO && (defined(USE_TERMINFO) || defined(USE_TINFO))
 #undef ExitProgram
 #define ExitProgram(code) exit_terminfo(code)
 #undef ExitProgram
 #define ExitProgram(code) exit_terminfo(code)
+#elif HAVE_EXIT_CURSES
+#undef ExitProgram
+#define ExitProgram(code) exit_curses(code)
 #endif
 #endif
-#else
+#else /* not ncurses-tree */
 #define typeMalloc(type,n) (type *) malloc((size_t)(n) * sizeof(type))
 #define typeCalloc(type,elts) (type *) calloc((size_t)(elts), sizeof(type))
 #define typeRealloc(type,n,p) (type *) realloc(p, (size_t)(n) * sizeof(type))
 #define typeMalloc(type,n) (type *) malloc((size_t)(n) * sizeof(type))
 #define typeCalloc(type,elts) (type *) calloc((size_t)(elts), sizeof(type))
 #define typeRealloc(type,n,p) (type *) realloc(p, (size_t)(n) * sizeof(type))
index 8e19a8c29cc403ab143d46185152774c8fa6f82f..eeea2302284c12df8d1e7d65eed9237d079920b7 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
  * Copyright 2007-2008,2009 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * Copyright 2007-2008,2009 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
@@ -27,7 +27,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: test_opaque.c,v 1.10 2020/02/02 23:34:34 tom Exp $
+ * $Id: test_opaque.c,v 1.12 2021/03/06 23:53:34 tom Exp $
  *
  * Author: Thomas E Dickey
  *
  *
  * Author: Thomas E Dickey
  *
@@ -45,6 +45,9 @@
        bool is_scrollok(const WINDOW *win);
        bool is_syncok(const WINDOW *win);
        int wgetscrreg (const WINDOW *, int *, int *);
        bool is_scrollok(const WINDOW *win);
        bool is_syncok(const WINDOW *win);
        int wgetscrreg (const WINDOW *, int *, int *);
+       bool is_pad(const WINDOW *win);
+       bool is_subwin(const WINDOW *win);
+       int wgetdelay(const WINDOW *win);
  */
 
 #include <test.priv.h>
  */
 
 #include <test.priv.h>
@@ -209,6 +212,8 @@ static struct {
 };
 /* *INDENT-ON* */
 
 };
 /* *INDENT-ON* */
 
+#define bool2c(c) ((c) ? 'T' : 'F')
+
 /*
  * Display and/or allow update for the properties accessed in the opaque
  * window.  Some may change state after refreshing the window, so we
 /*
  * Display and/or allow update for the properties accessed in the opaque
  * window.  Some may change state after refreshing the window, so we
@@ -227,18 +232,35 @@ show_opaque(WINDOW *stswin, WINDOW *txtwin, bool before, int active)
        show_keyword(stswin, n, active, bool_funcs[n].name);
 
        to_result(stswin, n, before);
        show_keyword(stswin, n, active, bool_funcs[n].name);
 
        to_result(stswin, n, before);
-       wprintw(stswin, "%c", bool_funcs[n].func(txtwin, -1) ? 'T' : 'F');
+       wprintw(stswin, "%c", bool2c(bool_funcs[n].func(txtwin, -1)));
     }
 
     }
 
+    show_keyword(stswin, n, active, "is_pad");
+    to_result(stswin, n, TRUE);
+    wprintw(stswin, "%c", bool2c(is_pad(txtwin)));
+
+    ++n;
+    show_keyword(stswin, n, active, "is_subwin");
+    to_result(stswin, n, TRUE);
+    wprintw(stswin, "%c", bool2c(is_subwin(txtwin)));
+
+    ++n;
     show_keyword(stswin, n, active, "wgetparent");
     to_result(stswin, n, TRUE);
     wprintw(stswin, "%p", (void *) wgetparent(txtwin));
 
     show_keyword(stswin, n, active, "wgetparent");
     to_result(stswin, n, TRUE);
     wprintw(stswin, "%p", (void *) wgetparent(txtwin));
 
+    ++n;
+    show_keyword(stswin, n, active, "wgetdelay");
+    to_result(stswin, n, TRUE);
+    wprintw(stswin, "%d", wgetdelay(txtwin));
+
     ++n;
     show_keyword(stswin, n, active, "wgetscrreg");
     to_result(stswin, n, TRUE);
     if (wgetscrreg(txtwin, &top, &bottom) == OK)
        wprintw(stswin, "%d,%d", top, bottom);
     ++n;
     show_keyword(stswin, n, active, "wgetscrreg");
     to_result(stswin, n, TRUE);
     if (wgetscrreg(txtwin, &top, &bottom) == OK)
        wprintw(stswin, "%d,%d", top, bottom);
+    else
+       wprintw(stswin, "none");
 
     wnoutrefresh(stswin);
     return active;
 
     wnoutrefresh(stswin);
     return active;
index 40ffc4fb1d07f0916a46110c39cd4efe98d0908a..01fadfee714f4c5bc9943a5c13fff36792f8217e 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
  *                                                                          *
  * 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
  *
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: test_tparm.c,v 1.4 2020/05/31 00:51:32 tom Exp $
+ * $Id: test_tparm.c,v 1.17 2021/03/06 23:39:14 tom Exp $
  *
  * Exercise tparm, either for all possible capabilities with fixed parameters,
  * or one capability with all possible parameters.
  *
  * Exercise tparm, either for all possible capabilities with fixed parameters,
  * or one capability with all possible parameters.
@@ -53,8 +53,35 @@ failed(const char *msg)
 #if HAVE_TIGETSTR
 
 static int a_opt;
 #if HAVE_TIGETSTR
 
 static int a_opt;
+static int p_opt;
 static int v_opt;
 
 static int v_opt;
 
+/*
+ * Total tests (and failures):
+ */
+static long total_tests;
+static long total_fails;
+
+/*
+ * Total characters formatted for tputs:
+ */
+static long total_nulls;
+static long total_ctrls;
+static long total_print;
+
+static int
+output_func(int ch)
+{
+    if (ch == 0) {
+       total_nulls++;
+    } else if (ch < 32 || (ch >= 127 && ch < 160)) {
+       total_ctrls++;
+    } else {
+       total_print++;
+    }
+    return ch;
+}
+
 static int
 isNumeric(char *source)
 {
 static int
 isNumeric(char *source)
 {
@@ -65,21 +92,30 @@ isNumeric(char *source)
     return result;
 }
 
     return result;
 }
 
-static char *
-validate(const char *name)
+static int
+relevant(const char *name, const char *value)
 {
 {
-    char *value = tigetstr(name);
-    if (!VALID_STRING(value)) {
-       if (v_opt > 1) {
+    int code = 1;
+    if (VALID_STRING(value)) {
+       if (strstr(value, "%p") == 0
+           && strstr(value, "%d") == 0
+           && strstr(value, "%s") == 0
+           && (!p_opt || strstr(value, "$<") == 0)) {
+           if (v_opt > 2)
+               printf("? %s noparams\n", name);
+           code = 0;
+       }
+    } else {
+       if (v_opt > 2) {
            printf("? %s %s\n",
                   (value == ABSENT_STRING)
                   ? "absent"
                   : "cancel",
                   name);
        }
            printf("? %s %s\n",
                   (value == ABSENT_STRING)
                   ? "absent"
                   : "cancel",
                   name);
        }
-       value = 0;
+       code = 0;
     }
     }
-    return value;
+    return code;
 }
 
 static int
 }
 
 static int
@@ -108,34 +144,37 @@ increment(int *all_parms, int *num_parms, int len_parms, int end_parms)
 }
 
 static void
 }
 
 static void
-test_tparm(const char *name, int *number)
+test_tparm(const char *name, const char *format, int *number)
 {
 {
-    char *format = tigetstr(name);
-    if ((format = validate(name)) != 0) {
-       char *result = tparm(format,
-                            number[0],
-                            number[1],
-                            number[2],
-                            number[3],
-                            number[4],
-                            number[5],
-                            number[6],
-                            number[7],
-                            number[8]);
-       if (v_opt > 1)
-           printf(".. %2d = %2d %2d %2d %2d %2d %2d %2d %2d %2d %s\n",
-                  result != 0 ? (int) strlen(result) : -1,
-                  number[0],
-                  number[1],
-                  number[2],
-                  number[3],
-                  number[4],
-                  number[5],
-                  number[6],
-                  number[7],
-                  number[8],
-                  name);
+    char *result = tparm(format,
+                        number[0],
+                        number[1],
+                        number[2],
+                        number[3],
+                        number[4],
+                        number[5],
+                        number[6],
+                        number[7],
+                        number[8]);
+    total_tests++;
+    if (result != NULL) {
+       tputs(result, 1, output_func);
+    } else {
+       total_fails++;
     }
     }
+    if (v_opt > 1)
+       printf(".. %2d = %2d %2d %2d %2d %2d %2d %2d %2d %2d %s\n",
+              result != 0 ? (int) strlen(result) : -1,
+              number[0],
+              number[1],
+              number[2],
+              number[3],
+              number[4],
+              number[5],
+              number[6],
+              number[7],
+              number[8],
+              name);
 }
 
 static void
 }
 
 static void
@@ -145,12 +184,14 @@ usage(void)
     {
        "Usage: test_tparm [options] [capability] [value1 [value2 [...]]]",
        "",
     {
        "Usage: test_tparm [options] [capability] [value1 [value2 [...]]]",
        "",
-       "Print all distinct combinations of given capability.",
+       "Use tparm/tputs for all distinct combinations of given capability.",
        "",
        "Options:",
        " -T TERM  override $TERM; this may be a comma-separated list or \"-\"",
        "          to read a list from standard-input",
        "",
        "Options:",
        " -T TERM  override $TERM; this may be a comma-separated list or \"-\"",
        "          to read a list from standard-input",
-       " -a       if capability is given, test all combinations of values",
+       " -a       test all combinations of parameters",
+       "          [value1...] forms a vector of maximum parameter-values.",
+       " -p       test capabilities with no parameters but having padding",
        " -r NUM   repeat tests NUM times",
        " -v       show values and results",
     };
        " -r NUM   repeat tests NUM times",
        " -v       show values and results",
     };
@@ -164,6 +205,8 @@ usage(void)
 #define PLURAL(n) n, (n != 1) ? "s" : ""
 #define COLONS(n) (n >= 1) ? ":" : ""
 
 #define PLURAL(n) n, (n != 1) ? "s" : ""
 #define COLONS(n) (n >= 1) ? ":" : ""
 
+#define NUMFORM "%10ld"
+
 int
 main(int argc, char *argv[])
 {
 int
 main(int argc, char *argv[])
 {
@@ -172,22 +215,31 @@ main(int argc, char *argv[])
     char *old_term = getenv("TERM");
     int r_opt = 1;
     char *t_opt = 0;
     char *old_term = getenv("TERM");
     int r_opt = 1;
     char *t_opt = 0;
-    int len_names = 0;         /* cur # of items in all_names[] */
-    int use_names = 10;                /* max # of items in all_names[] */
-    char **all_names = typeCalloc(char *, use_names);
+
+    int len_caps = 0;          /* cur # of items in all_caps[] */
+    int max_caps = 10;         /* max # of items in all_caps[] */
+    char **all_caps = typeCalloc(char *, max_caps);
+
     int all_parms[10];         /* workspace for "-a" option */
     int all_parms[10];         /* workspace for "-a" option */
+
     int len_terms = 0;         /* cur # of items in all_terms[] */
     int len_terms = 0;         /* cur # of items in all_terms[] */
-    int use_terms = 10;                /* max # of items in all_terms[] */
-    char **all_terms = typeCalloc(char *, use_terms);
+    int max_terms = 10;                /* max # of items in all_terms[] */
+    char **all_terms = typeCalloc(char *, max_terms);
+
+    int use_caps;
+    char **cap_name;
+    char **cap_data;
+
     int len_parms = 0;         /* cur # of items in num_parms[], str_parms[] */
     int len_parms = 0;         /* cur # of items in num_parms[], str_parms[] */
-    int use_parms = argc + 10; /* max # of items in num_parms[], str_parms[] */
-    int *num_parms = typeCalloc(int, use_parms);
-    char **str_parms = typeCalloc(char *, use_parms);
+    int max_parms = argc + 10; /* max # of items in num_parms[], str_parms[] */
+    int *num_parms = typeCalloc(int, max_parms);
+    char **str_parms = typeCalloc(char *, max_parms);
+    long use_parms = 1;
 
 
-    if (all_names == 0 || all_terms == 0 || num_parms == 0 || str_parms == 0)
+    if (all_caps == 0 || all_terms == 0 || num_parms == 0 || str_parms == 0)
        failed("no memory");
 
        failed("no memory");
 
-    while ((n = getopt(argc, argv, "T:ar:v")) != -1) {
+    while ((n = getopt(argc, argv, "T:apr:v")) != -1) {
        switch (n) {
        case 'T':
            t_opt = optarg;
        switch (n) {
        case 'T':
            t_opt = optarg;
@@ -195,6 +247,9 @@ main(int argc, char *argv[])
        case 'a':
            ++a_opt;
            break;
        case 'a':
            ++a_opt;
            break;
+       case 'p':
+           ++p_opt;
+           break;
        case 'r':
            r_opt = atoi(optarg);
            break;
        case 'r':
            r_opt = atoi(optarg);
            break;
@@ -213,14 +268,14 @@ main(int argc, char *argv[])
      */
     if (optind < argc) {
        if (!isNumeric(argv[optind])) {
      */
     if (optind < argc) {
        if (!isNumeric(argv[optind])) {
-           all_names[len_names++] = strdup(argv[optind++]);
+           all_caps[len_caps++] = strdup(argv[optind++]);
        }
     }
 
     /*
      * Any remaining arguments must be possible parameter values.  If numeric,
        }
     }
 
     /*
      * Any remaining arguments must be possible parameter values.  If numeric,
-     * and "-a" is not set, use those as the maximum values within which the
-     * test parameters should vary.
+     * and "-a" is not set, use those as the actual values for which the
+     * capabilities are tested.
      */
     while (optind < argc) {
        if (isNumeric(argv[optind])) {
      */
     while (optind < argc) {
        if (isNumeric(argv[optind])) {
@@ -232,14 +287,16 @@ main(int argc, char *argv[])
        ++optind;
        ++len_parms;
     }
        ++optind;
        ++len_parms;
     }
-    for (n = len_parms; n < use_parms; ++n) {
+    for (n = len_parms; n < max_parms; ++n) {
        static char dummy[1];
        str_parms[n] = dummy;
     }
     if (v_opt) {
        printf("%d parameter%s%s\n", PLURAL(len_parms), COLONS(len_parms));
        static char dummy[1];
        str_parms[n] = dummy;
     }
     if (v_opt) {
        printf("%d parameter%s%s\n", PLURAL(len_parms), COLONS(len_parms));
-       for (n = 0; n < len_parms; ++n) {
-           printf(" %d: %d (%s)\n", n + 1, num_parms[n], str_parms[n]);
+       if (v_opt > 3) {
+           for (n = 0; n < len_parms; ++n) {
+               printf(" %d: %d (%s)\n", n + 1, num_parms[n], str_parms[n]);
+           }
        }
     }
 
        }
     }
 
@@ -260,9 +317,9 @@ main(int argc, char *argv[])
                while (t != s && isspace(UChar(t[-1])))
                    *--t = '\0';
                s = strdup(s);
                while (t != s && isspace(UChar(t[-1])))
                    *--t = '\0';
                s = strdup(s);
-               if (len_terms + 2 >= use_terms) {
-                   use_terms *= 2;
-                   all_terms = typeRealloc(char *, use_terms, all_terms);
+               if (len_terms + 2 >= max_terms) {
+                   max_terms *= 2;
+                   all_terms = typeRealloc(char *, max_terms, all_terms);
                    if (all_terms == 0)
                        failed("no memory: all_terms");
                }
                    if (all_terms == 0)
                        failed("no memory: all_terms");
                }
@@ -273,9 +330,9 @@ main(int argc, char *argv[])
            char *t;
            while ((t = strtok(s, ",")) != 0) {
                s = 0;
            char *t;
            while ((t = strtok(s, ",")) != 0) {
                s = 0;
-               if (len_terms + 2 >= use_terms) {
-                   use_terms *= 2;
-                   all_terms = typeRealloc(char *, use_terms, all_terms);
+               if (len_terms + 2 >= max_terms) {
+                   max_terms *= 2;
+                   all_terms = typeRealloc(char *, max_terms, all_terms);
                    if (all_terms == 0)
                        failed("no memory: all_terms");
                }
                    if (all_terms == 0)
                        failed("no memory: all_terms");
                }
@@ -288,8 +345,10 @@ main(int argc, char *argv[])
     all_terms[len_terms] = 0;
     if (v_opt) {
        printf("%d term%s:\n", PLURAL(len_terms));
     all_terms[len_terms] = 0;
     if (v_opt) {
        printf("%d term%s:\n", PLURAL(len_terms));
-       for (n = 0; n < len_terms; ++n) {
-           printf(" %d: %s\n", n + 1, all_terms[n]);
+       if (v_opt > 3) {
+           for (n = 0; n < len_terms; ++n) {
+               printf(" %d: %s\n", n + 1, all_terms[n]);
+           }
        }
     }
 
        }
     }
 
@@ -300,34 +359,45 @@ main(int argc, char *argv[])
      * TODO: To address the "other" systems which do not follow SVr4,
      * just use the output from infocmp on $TERM.
      */
      * TODO: To address the "other" systems which do not follow SVr4,
      * just use the output from infocmp on $TERM.
      */
-    if (len_names == 0) {
+    if (len_caps == 0) {
 #if defined(HAVE_CURSES_DATA_BOOLNAMES) || defined(DECL_CURSES_DATA_BOOLNAMES)
        for (n = 0; strnames[n] != 0; ++n) {
 #if defined(HAVE_CURSES_DATA_BOOLNAMES) || defined(DECL_CURSES_DATA_BOOLNAMES)
        for (n = 0; strnames[n] != 0; ++n) {
-           if (len_names + 2 >= use_names) {
-               use_names *= 2;
-               all_names = typeRealloc(char *, use_names, all_names);
-               if (all_names == 0) {
-                   failed("no memory: all_names");
+           if (len_caps + 2 >= max_caps) {
+               max_caps *= 2;
+               all_caps = typeRealloc(char *, max_caps, all_caps);
+               if (all_caps == 0) {
+                   failed("no memory: all_caps");
                }
            }
                }
            }
-           all_names[len_names++] = strdup(strnames[n]);
+           all_caps[len_caps++] = strdup(strnames[n]);
        }
 #else
        }
 #else
-       all_names[len_names++] = strdup("cup");
-       all_names[len_names++] = strdup("sgr");
+       all_caps[len_caps++] = strdup("cup");
+       all_caps[len_caps++] = strdup("sgr");
 #endif
     }
 #endif
     }
-    all_names[len_names] = 0;
+    all_caps[len_caps] = 0;
     if (v_opt) {
     if (v_opt) {
-       printf("%d name%s%s\n", PLURAL(len_names), COLONS(len_names));
-       for (n = 0; n < len_names; ++n) {
-           printf(" %d: %s\n", n + 1, all_names[n]);
+       printf("%d name%s%s\n", PLURAL(len_caps), COLONS(len_caps));
+       if (v_opt > 3) {
+           for (n = 0; n < len_caps; ++n) {
+               printf(" %d: %s\n", n + 1, all_caps[n]);
+           }
        }
     }
 
        }
     }
 
+    cap_name = typeMalloc(char *, len_caps);
+    cap_data = typeMalloc(char *, len_caps);
+
     if (r_opt <= 0)
        r_opt = 1;
 
     if (r_opt <= 0)
        r_opt = 1;
 
+    if (a_opt) {
+       for (n = 0; n < use_parms; ++n)
+           if (num_parms[n])
+               use_parms *= (num_parms[n] + 1);
+    }
+
     for (r_run = 0; r_run < r_opt; ++r_run) {
        for (t_run = 0; t_run < len_terms; ++t_run) {
            int errs;
     for (r_run = 0; r_run < r_opt; ++r_run) {
        for (t_run = 0; t_run < len_terms; ++t_run) {
            int errs;
@@ -336,23 +406,42 @@ main(int argc, char *argv[])
                printf("** skipping %s (errs:%d)\n", all_terms[t_run], errs);
            }
 
                printf("** skipping %s (errs:%d)\n", all_terms[t_run], errs);
            }
 
-           if (v_opt)
-               printf("** testing %s\n", all_terms[t_run]);
-           if (len_names == 1) {
-               if (a_opt) {
-                   /* for each combination of values */
-                   memset(all_parms, 0, sizeof(all_parms));
-                   do {
-                       test_tparm(all_names[0], all_parms);
+           /*
+            * Most of the capabilities have no parameters, e.g., they are
+            * function-keys or simple operations such as clear-display.
+            * Ignore those, since they do not really exercise tparm.
+            */
+           use_caps = 0;
+           for (n = 0; n < len_caps; ++n) {
+               char *value = tigetstr(all_caps[n]);
+               if (relevant(all_caps[n], value)) {
+                   cap_name[use_caps] = all_caps[n];
+                   cap_data[use_caps] = value;
+                   use_caps++;
+               }
+           }
+
+           if (v_opt) {
+               printf("[%d:%d] %d cap%s * %ld param%s \"%s\"\n",
+                      r_run + 1, r_opt,
+                      PLURAL(use_caps),
+                      PLURAL(use_parms),
+                      all_terms[t_run]);
+           }
+
+           if (a_opt) {
+               /* for each combination of values */
+               memset(all_parms, 0, sizeof(all_parms));
+               do {
+                   for (n_run = 0; n_run < use_caps; ++n_run) {
+                       test_tparm(cap_name[n_run], cap_data[n_run], all_parms);
                    }
                    }
-                   while (increment(all_parms, num_parms, len_parms, 0));
-               } else {
-                   /* for the given values */
-                   test_tparm(all_names[0], num_parms);
                }
                }
+               while (increment(all_parms, num_parms, len_parms, 0));
            } else {
            } else {
-               for (n_run = 0; n_run < len_names; ++n_run) {
-                   test_tparm(all_names[n_run], num_parms);
+               /* for the given values */
+               for (n_run = 0; n_run < use_caps; ++n_run) {
+                   test_tparm(cap_name[n_run], cap_data[n_run], all_parms);
                }
            }
            if (cur_term != 0) {
                }
            }
            if (cur_term != 0) {
@@ -362,11 +451,21 @@ main(int argc, char *argv[])
            }
        }
     }
            }
        }
     }
+
+    printf("Tests:\n");
+    printf(NUMFORM " total\n", total_tests);
+    if (total_fails)
+       printf(NUMFORM " failed\n", total_fails);
+    printf("Characters:\n");
+    printf(NUMFORM " nulls\n", total_nulls);
+    printf(NUMFORM " controls\n", total_ctrls);
+    printf(NUMFORM " printable\n", total_print);
+    printf(NUMFORM " total\n", total_nulls + total_ctrls + total_print);
 #if NO_LEAKS
 #if NO_LEAKS
-    for (n = 0; n < len_names; ++n) {
-       free(all_names[n]);
+    for (n = 0; n < len_caps; ++n) {
+       free(all_caps[n]);
     }
     }
-    free(all_names);
+    free(all_caps);
     free(old_term);
     for (n = 0; n < len_terms; ++n) {
        free(all_terms[n]);
     free(old_term);
     for (n = 0; n < len_terms; ++n) {
        free(all_terms[n]);
@@ -374,6 +473,8 @@ main(int argc, char *argv[])
     free(all_terms);
     free(num_parms);
     free(str_parms);
     free(all_terms);
     free(num_parms);
     free(str_parms);
+    free(cap_name);
+    free(cap_data);
 #endif
 
     ExitProgram(EXIT_SUCCESS);
 #endif
 
     ExitProgram(EXIT_SUCCESS);