From 5487d20851d0dea54352bb44817b39e9945f90c2 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 12 Dec 2021 01:11:22 +0000 Subject: [PATCH] ncurses 6.3 - patch 20211211 + add test/combine.c, to demo/test combining characters. --- Ada95/gen/gen.c | 7 +- MANIFEST | 1 + NEWS | 5 +- VERSION | 2 +- dist.mk | 4 +- ncurses/base/lib_delwin.c | 5 +- package/debian-mingw/changelog | 4 +- package/debian-mingw64/changelog | 4 +- package/debian/changelog | 4 +- package/mingw-ncurses.nsi | 4 +- package/mingw-ncurses.spec | 2 +- package/ncurses.spec | 2 +- package/ncursest.spec | 2 +- progs/tic.c | 7 +- test/combine.c | 204 +++++++++++++++++++++++++++++++ test/modules | 3 +- test/programs | 3 +- 17 files changed, 237 insertions(+), 26 deletions(-) create mode 100644 test/combine.c diff --git a/Ada95/gen/gen.c b/Ada95/gen/gen.c index 51bc161a..d92fa68e 100644 --- a/Ada95/gen/gen.c +++ b/Ada95/gen/gen.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2021 Thomas E. Dickey * * Copyright 1998-2014,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ /* Version Control - $Id: gen.c,v 1.77 2020/08/16 18:05:05 tom Exp $ + $Id: gen.c,v 1.78 2021/12/11 21:03:21 tom Exp $ --------------------------------------------------------------------------*/ /* This program prints on its standard output the source for the @@ -95,7 +95,7 @@ print_size_of(FILE * fp, const char *name, size_t value) { - fprintf(fp, " %-28s : constant := %lu;\n", name, value); + fprintf(fp, " %-28s : constant := %lu;\n", name, (unsigned long)value); } #define PRINT_NAMED_CONSTANT(name) \ @@ -490,6 +490,7 @@ main(int argc, const char *argv[]) print_comment(fp, "Field_Options from opts(3FORM)"); PRINT_NAMED_BITMASK(Field_Options, O_NL_OVERLOAD); PRINT_NAMED_BITMASK(Field_Options, O_BS_OVERLOAD); + /* Field_Options_Size is defined below */ print_comment(fp, "MEVENT structure from mouse(3NCURSES)"); diff --git a/MANIFEST b/MANIFEST index 749138c8..9d8227f0 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1111,6 +1111,7 @@ ./test/color_content.c ./test/color_name.h ./test/color_set.c +./test/combine.c ./test/configure ./test/configure.in ./test/demo_altkeys.c diff --git a/NEWS b/NEWS index 14b80105..38757c73 100644 --- a/NEWS +++ b/NEWS @@ -26,7 +26,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.3753 2021/12/04 23:03:57 tom Exp $ +-- $Id: NEWS,v 1.3755 2021/12/11 21:46:44 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -46,6 +46,9 @@ 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. +20211211 + + add test/combine.c, to demo/test combining characters. + 20211204 + improve configure check for getttynam (report by Werner Fink). diff --git a/VERSION b/VERSION index ff17e157..47b17ecb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.3 20211204 +5:0:10 6.3 20211211 diff --git a/dist.mk b/dist.mk index 60566f57..4049465d 100644 --- a/dist.mk +++ b/dist.mk @@ -26,7 +26,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.1453 2021/12/04 12:21:05 tom Exp $ +# $Id: dist.mk,v 1.1454 2021/12/11 13:00:34 tom Exp $ # 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 = 3 -NCURSES_PATCH = 20211204 +NCURSES_PATCH = 20211211 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/ncurses/base/lib_delwin.c b/ncurses/base/lib_delwin.c index ce793e53..1136305a 100644 --- a/ncurses/base/lib_delwin.c +++ b/ncurses/base/lib_delwin.c @@ -43,16 +43,17 @@ #include -MODULE_ID("$Id: lib_delwin.c,v 1.23 2021/11/15 23:05:32 tom Exp $") +MODULE_ID("$Id: lib_delwin.c,v 1.24 2021/12/11 23:56:25 tom Exp $") static bool cannot_delete(WINDOW *win) { - WINDOWLIST *p; bool result = TRUE; + if (IS_PAD(win)) { result = FALSE; } else { + WINDOWLIST *p; #ifdef USE_SP_WINDOWLIST SCREEN *sp = _nc_screen_of(win); #endif diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index be050edb..15113b4f 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.3+20211204) unstable; urgency=low +ncurses6 (6.3+20211211) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 04 Dec 2021 07:21:05 -0500 + -- Thomas E. Dickey Sat, 11 Dec 2021 08:00:34 -0500 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index be050edb..15113b4f 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.3+20211204) unstable; urgency=low +ncurses6 (6.3+20211211) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 04 Dec 2021 07:21:05 -0500 + -- Thomas E. Dickey Sat, 11 Dec 2021 08:00:34 -0500 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index 419ee651..711f901d 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.3+20211204) unstable; urgency=low +ncurses6 (6.3+20211211) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 04 Dec 2021 07:21:05 -0500 + -- Thomas E. Dickey Sat, 11 Dec 2021 08:00:34 -0500 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index 37711689..b341d678 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.495 2021/12/04 12:21:05 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.496 2021/12/11 13:00:34 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "3" !define VERSION_YYYY "2021" -!define VERSION_MMDD "1204" +!define VERSION_MMDD "1211" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index 2c7f93be..53a35c94 100644 --- a/package/mingw-ncurses.spec +++ b/package/mingw-ncurses.spec @@ -3,7 +3,7 @@ Summary: shared libraries for terminal handling Name: mingw32-ncurses6 Version: 6.3 -Release: 20211204 +Release: 20211211 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncurses.spec b/package/ncurses.spec index aef73619..a77934d1 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.3 -Release: 20211204 +Release: 20211211 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncursest.spec b/package/ncursest.spec index 0462181c..9bae667d 100644 --- a/package/ncursest.spec +++ b/package/ncursest.spec @@ -1,7 +1,7 @@ Summary: Curses library with POSIX thread support. Name: ncursest6 Version: 6.3 -Release: 20211204 +Release: 20211211 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/progs/tic.c b/progs/tic.c index dba2890b..bd83ac23 100644 --- a/progs/tic.c +++ b/progs/tic.c @@ -49,7 +49,7 @@ #include #include -MODULE_ID("$Id: tic.c,v 1.307 2021/10/05 08:07:05 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.308 2021/12/12 00:00:33 tom Exp $") #define STDIN_NAME "" @@ -682,7 +682,6 @@ int main(int argc, char *argv[]) { char my_tmpname[PATH_MAX]; - char my_altfile[PATH_MAX]; int v_opt = -1; int smart_defaults = TRUE; char *termcap; @@ -933,6 +932,7 @@ main(int argc, char *argv[]) } if (tmp_fp == NULL) { + char my_altfile[PATH_MAX]; tmp_fp = open_input(source_file, my_altfile); if (!strcmp(source_file, "-")) { source_file = STDIN_NAME; @@ -2717,12 +2717,11 @@ show_fkey_name(NAME_VALUE * data) static void check_conflict(TERMTYPE2 *tp) { - bool conflict = FALSE; - if (!(_nc_syntax == SYN_TERMCAP && capdump)) { char *check = calloc((size_t) (NUM_STRINGS(tp) + 1), sizeof(char)); NAME_VALUE *given = get_fkey_list(tp); unsigned j, k; + bool conflict = FALSE; if (check == NULL) failed("check_conflict"); diff --git a/test/combine.c b/test/combine.c new file mode 100644 index 00000000..0a30dd60 --- /dev/null +++ b/test/combine.c @@ -0,0 +1,204 @@ +/**************************************************************************** + * Copyright 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 * + * "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: combine.c,v 1.7 2021/12/12 01:10:28 tom Exp $ + */ + +#include + +#if USE_WIDEC_SUPPORT + +static int c_opt; +static int r_opt; + +static int +next_char(int value) +{ + do { + ++value; + } while (!iswprint((wint_t) value)); + return value; +} + +static void +do_row(int row, int base_ch, int over_ch) +{ + int col = 0; + bool done = FALSE; + bool reverse = (r_opt && !(row % 2)); + + move(row, col); + printw("[U+%04X]", over_ch); + do { + if (c_opt) { + wchar_t source[2]; + cchar_t target; + attr_t attr = reverse ? A_REVERSE : A_NORMAL; + + source[1] = 0; + + source[0] = base_ch; + setcchar(&target, source, attr, 0, NULL); + add_wch(&target); + + source[0] = over_ch; + setcchar(&target, source, attr, 0, NULL); + add_wch(&target); + } else { + wchar_t data[3]; + + data[0] = base_ch; + data[1] = over_ch; + data[2] = 0; + if (reverse) + attr_on(A_REVERSE, NULL); + addwstr(data); + if (reverse) + attr_off(A_REVERSE, NULL); + } + col = getcurx(stdscr); + base_ch = next_char(base_ch); + done = (col + 1 >= COLS); + } while (!done); +} + +#define LAST_OVER 0x6f + +static int +next_over(int value) +{ + if (++value > LAST_OVER) + value = 0; + return value; +} + +static int +prev_over(int value) +{ + if (--value < 0) + value = LAST_OVER; + return value; +} + +static void +do_all(int over_it) +{ + int row; + + for (row = 0; row < LINES; ++row) { + do_row(row, ' ', 0x300 + over_it); + over_it = next_over(over_it); + } +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: combine [options]", + "", + "Demonstrate combining-characters.", + "", + "Options:", + " -c use cchar_t data rather than wchar_t string", + " -r draw even-numbered rows in reverse-video", + }; + unsigned 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 n; + int over_it = 0; + bool done = FALSE; + + while ((n = getopt(argc, argv, "cr")) != -1) { + switch (n) { + case 'c': + c_opt = TRUE; + break; + case 'r': + r_opt = TRUE; + break; + default: + usage(); + break; + } + } + + setlocale(LC_ALL, ""); + initscr(); + cbreak(); + noecho(); + keypad(stdscr, TRUE); + + do { + do_all(over_it); + switch (getch()) { + case 'q': + case QUIT: + case ESCAPE: + done = TRUE; + break; + case KEY_HOME: + case '0': + over_it = 0; + break; + case KEY_END: + case '$': + over_it = LAST_OVER; + break; + case KEY_UP: + case '-': + over_it = prev_over(over_it); + break; + case KEY_DOWN: + case '+': + over_it = next_over(over_it); + break; + } + } while (!done); + + endwin(); + + ExitProgram(EXIT_SUCCESS); +} +#else +int +main(void) +{ + printf("This program requires wide-curses functions\n"); + ExitProgram(EXIT_FAILURE); +} +#endif diff --git a/test/modules b/test/modules index de3d140a..6ba90a37 100644 --- a/test/modules +++ b/test/modules @@ -1,4 +1,4 @@ -# $Id: modules,v 1.74 2021/02/13 16:33:43 tom Exp $ +# $Id: modules,v 1.75 2021/12/11 17:41:34 tom Exp $ ############################################################################## # Copyright 2018-2020,2021 Thomas E. Dickey # # Copyright 1998-2016,2017 Free Software Foundation, Inc. # @@ -42,6 +42,7 @@ 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) +combine progs $(srcdir) $(HEADER_DEPS) demo_altkeys progs $(srcdir) $(HEADER_DEPS) demo_defkey progs $(srcdir) $(HEADER_DEPS) demo_forms progs $(srcdir) $(HEADER_DEPS) $(srcdir)/edit_field.h diff --git a/test/programs b/test/programs index 6946faab..77a82413 100644 --- a/test/programs +++ b/test/programs @@ -1,4 +1,4 @@ -# $Id: programs,v 1.49 2021/03/13 20:37:44 tom Exp $ +# $Id: programs,v 1.50 2021/12/11 17:46:18 tom Exp $ ############################################################################## # Copyright 2018-2020,2021 Thomas E. Dickey # # Copyright 2006-2016,2017 Free Software Foundation, Inc. # @@ -40,6 +40,7 @@ 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 +combine $(LDFLAGS_CURSES) $(LOCAL_LIBS) combine popup_msg demo_altkeys $(LDFLAGS_CURSES) $(LOCAL_LIBS) demo_altkeys demo_defkey $(LDFLAGS_CURSES) $(LOCAL_LIBS) demo_defkey demo_forms $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) demo_forms edit_field popup_msg -- 2.44.0