aboutsummaryrefslogtreecommitdiff
path: root/ncurses
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2021-02-25 17:22:00 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2021-02-25 17:22:00 +0000
commitbf0ab54638a5ef969749f6ceae30e864f9556ea8 (patch)
tree11690c2184e55d37bcd3c7fd13f3d0d9d20dbcb0 /ncurses
parent72c3fc31f590566e93496732d6fa769cd353e270 (diff)
downloadsrc-vendor/ncurses.tar.gz
src-vendor/ncurses.zip
Vendor import ncurses 6.2-20210220vendor/ncurses/6.2-20210220vendor/ncurses
Diffstat (limited to 'ncurses')
-rw-r--r--ncurses/Makefile.in46
-rwxr-xr-xncurses/base/MKlib_gen.sh17
-rw-r--r--ncurses/base/lib_addch.c18
-rw-r--r--ncurses/base/lib_addstr.c10
-rw-r--r--ncurses/base/lib_bkgd.c74
-rw-r--r--ncurses/base/lib_color.c45
-rw-r--r--ncurses/base/lib_driver.c4
-rw-r--r--ncurses/base/lib_getch.c74
-rw-r--r--ncurses/base/lib_getstr.c3
-rw-r--r--ncurses/base/lib_initscr.c9
-rw-r--r--ncurses/base/lib_mouse.c62
-rw-r--r--ncurses/base/lib_newterm.c13
-rw-r--r--ncurses/base/lib_screen.c8
-rw-r--r--ncurses/base/lib_set_term.c29
-rw-r--r--ncurses/base/new_pair.c27
-rw-r--r--ncurses/base/wresize.c12
-rw-r--r--ncurses/curses.priv.h79
-rw-r--r--ncurses/llib-lncurses283
-rw-r--r--ncurses/llib-lncursest283
-rw-r--r--ncurses/llib-lncursestw419
-rw-r--r--ncurses/llib-lncursesw419
-rw-r--r--ncurses/llib-ltinfo17
-rw-r--r--ncurses/llib-ltinfot17
-rw-r--r--ncurses/llib-ltinfotw17
-rw-r--r--ncurses/llib-ltinfow17
-rw-r--r--ncurses/modules8
-rw-r--r--ncurses/new_pair.h5
-rw-r--r--ncurses/report_hashing.c73
-rwxr-xr-x[-rw-r--r--]ncurses/tinfo/MKcaptab.sh0
-rwxr-xr-xncurses/tinfo/MKfallback.sh16
-rw-r--r--ncurses/tinfo/access.c12
-rw-r--r--ncurses/tinfo/captoinfo.c13
-rw-r--r--ncurses/tinfo/comp_parse.c4
-rw-r--r--ncurses/tinfo/doalloc.c4
-rw-r--r--ncurses/tinfo/lib_baudrate.c20
-rw-r--r--ncurses/tinfo/lib_cur_term.c7
-rw-r--r--ncurses/tinfo/lib_data.c7
-rw-r--r--ncurses/tinfo/lib_kernel.c12
-rw-r--r--ncurses/tinfo/lib_napms.c4
-rw-r--r--ncurses/tinfo/lib_options.c6
-rw-r--r--ncurses/tinfo/lib_print.c6
-rw-r--r--ncurses/tinfo/lib_raw.c11
-rw-r--r--ncurses/tinfo/lib_setup.c29
-rw-r--r--ncurses/tinfo/lib_tgoto.c4
-rw-r--r--ncurses/tinfo/lib_tparm.c459
-rw-r--r--ncurses/tinfo/lib_tputs.c16
-rw-r--r--ncurses/tinfo/lib_ttyflags.c6
-rw-r--r--ncurses/tinfo/lib_win32con.c1256
-rw-r--r--ncurses/tinfo/lib_win32util.c134
-rw-r--r--ncurses/tinfo/parse_entry.c10
-rw-r--r--ncurses/tinfo/read_entry.c16
-rw-r--r--ncurses/tinfo/tinfo_driver.c137
-rw-r--r--ncurses/tinfo/trim_sgr0.c4
-rw-r--r--ncurses/tinfo/write_entry.c4
-rw-r--r--ncurses/trace/lib_trace.c6
-rw-r--r--ncurses/trace/lib_tracebits.c42
-rw-r--r--ncurses/tty/hashmap.c4
-rw-r--r--ncurses/tty/lib_mvcur.c105
-rw-r--r--ncurses/tty/lib_twait.c4
-rw-r--r--ncurses/tty/lib_vidattr.c22
-rw-r--r--ncurses/tty/tty_update.c62
-rw-r--r--ncurses/wcwidth.h8
-rw-r--r--ncurses/widechar/lib_cchar.c16
-rw-r--r--ncurses/widechar/lib_ins_wch.c6
-rw-r--r--ncurses/widechar/lib_vid_attr.c23
-rw-r--r--ncurses/widechar/widechars.c6
-rw-r--r--ncurses/win32con/gettimeofday.c4
-rw-r--r--ncurses/win32con/wcwidth.c10
-rw-r--r--ncurses/win32con/win32_driver.c1221
-rw-r--r--ncurses/win32con/win_driver.c22
70 files changed, 4654 insertions, 1192 deletions
diff --git a/ncurses/Makefile.in b/ncurses/Makefile.in
index b242078804c4..8f2254d3a0d4 100644
--- a/ncurses/Makefile.in
+++ b/ncurses/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.168 2020/02/02 23:34:34 tom Exp $
+# $Id: Makefile.in,v 1.178 2021/01/23 20:34:00 tom Exp $
##############################################################################
-# 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 #
@@ -50,7 +50,7 @@ SHELL = @SHELL@
VPATH = @srcdir@
THIS = Makefile
-CF_MFLAGS = @cf_cv_makeflags@
+TOP_MFLAGS = @cf_cv_makeflags@ DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)"
@SET_MAKE@
x = @EXEEXT@
@@ -99,14 +99,15 @@ ETAGS = @ETAGS@
CC = @CC@
CPP = @CPP@
-CFLAGS = @CFLAGS@
+CFLAGS = @CFLAGS@ @EXTRA_CFLAGS@
+LIBS = @LIBS@
INCDIR = $(srcdir)/../include
-CPPFLAGS = -DHAVE_CONFIG_H -I../ncurses @CPPFLAGS@
+CPPFLAGS = -DHAVE_CONFIG_H -DBUILDING_NCURSES -I../ncurses @CPPFLAGS@
CCFLAGS = $(CPPFLAGS) $(CFLAGS)
-BUILD_CPPFLAGS = -DHAVE_CONFIG_H -DUSE_BUILD_CC -I../ncurses -I$(srcdir) -I../include -I$(INCDIR) @BUILD_CPPFLAGS@
+BUILD_CPPFLAGS = -DHAVE_CONFIG_H -DUSE_BUILD_CC -I../ncurses -I$(srcdir) -I../include -I$(INCDIR) @BUILD_CPPFLAGS@
BUILD_CC = @BUILD_CC@
BUILD_CCFLAGS = @BUILD_CFLAGS@
BUILD_LDFLAGS = @BUILD_LDFLAGS@
@@ -119,9 +120,9 @@ BUILD_EXEEXT = @BUILD_EXEEXT@
x = @EXEEXT@
CFLAGS_LIBTOOL = $(CCFLAGS)
-CFLAGS_NORMAL = $(CCFLAGS)
-CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE
-CFLAGS_PROFILE = $(CCFLAGS) -pg
+CFLAGS_NORMAL = $(CCFLAGS) -DNCURSES_STATIC
+CFLAGS_DEBUG = $(CCFLAGS) -DNCURSES_STATIC @CC_G_OPT@ -DTRACE
+CFLAGS_PROFILE = $(CCFLAGS) -DNCURSES_STATIC -pg
CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@
CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@)
@@ -177,17 +178,22 @@ AUTO_SRC = \
init_keytry.h \
keys.list
-HEADER_DEPS = \
- $(srcdir)/curses.priv.h \
- ../include/ncurses_dll.h \
+HEADER_DEPS = @INTERNALS_HDR@ \
../include/ncurses_cfg.h \
+ ../include/ncurses_def.h \
+ ../include/ncurses_dll.h \
../include/curses.h \
- $(INCDIR)/nc_panel.h \
../include/term.h \
- $(INCDIR)/term_entry.h \
- $(INCDIR)/nc_tparm.h \
+ ../include/unctrl.h \
$(INCDIR)/nc_alloc.h \
- $(INCDIR)/nc_mingw.h
+ $(INCDIR)/nc_panel.h \
+ $(INCDIR)/nc_string.h \
+ $(INCDIR)/nc_termios.h \
+ $(INCDIR)/nc_tparm.h \
+ $(INCDIR)/nc_win32.h \
+ $(INCDIR)/term_entry.h \
+ $(srcdir)/curses.priv.h \
+ $(srcdir)/new_pair.h
TEST_DEPS = ../lib/@LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@
TEST_ARGS = @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@
@@ -224,7 +230,7 @@ $(DESTDIR)$(libdir) :
../lib : ; mkdir $@
./fallback.c : $(tinfo)/MKfallback.sh
- $(SHELL) -e $(tinfo)/MKfallback.sh $(TERMINFO) $(TERMINFO_SRC) $(TIC_PATH) $(INFOCMP_PATH) $(FALLBACK_LIST) >$@
+ $(SHELL) -e $(tinfo)/MKfallback.sh $(TERMINFO) $(TERMINFO_SRC) "$(TIC_PATH)" "$(INFOCMP_PATH)" $(FALLBACK_LIST) >$@
./lib_gen.c : $(base)/MKlib_gen.sh ../include/curses.h
$(SHELL) -e $(base)/MKlib_gen.sh "$(CPP) $(CPPFLAGS)" "$(AWK)" generated <../include/curses.h >$@
@@ -238,7 +244,7 @@ keys.list : $(tinfo)/MKkeys_list.sh
make_keys$(BUILD_EXEEXT) : \
build.priv.h \
$(tinfo)/make_keys.c \
- names.c
+ ./names.c
$(BUILD_CC) -o $@ $(BUILD_CPPFLAGS) $(BUILD_CCFLAGS) $(tinfo)/make_keys.c $(BUILD_LDFLAGS) $(BUILD_LIBS)
make_hash$(BUILD_EXEEXT) : \
@@ -308,7 +314,7 @@ realclean :: distclean
../include/hashsize.h \
../include/parametrized.h \
../include/term.h :
- cd ../include; $(MAKE) $(CF_MFLAGS)
+ ( cd ../include && $(MAKE) $(TOP_MFLAGS) )
# These rules build test-programs for the modules that have test-drivers
test_progs : $(TEST_PROGS)
@@ -334,7 +340,7 @@ link_test$x : ./link_test.c $(TEST_DEPS) \
@ECHO_LD@ $(CC) -o $@ $(CFLAGS_DEFAULT) ../@DFT_OBJ_SUBDIR@/link_test$o $(TEST_LDFLAGS)
../@DFT_OBJ_SUBDIR@/dump_entry$o:
- cd ../progs && $(MAKE) ../@DFT_OBJ_SUBDIR@/dump_entry$o
+ ( cd ../progs && $(MAKE) ../@DFT_OBJ_SUBDIR@/dump_entry$o )
report_hashing$x : \
$(srcdir)/curses.priv.h \
diff --git a/ncurses/base/MKlib_gen.sh b/ncurses/base/MKlib_gen.sh
index c8e4efe0c8d1..3829eff8eecb 100755
--- a/ncurses/base/MKlib_gen.sh
+++ b/ncurses/base/MKlib_gen.sh
@@ -2,7 +2,7 @@
#
# MKlib_gen.sh -- generate sources from curses.h macro definitions
#
-# ($Id: MKlib_gen.sh,v 1.64 2020/02/15 14:58:02 tom Exp $)
+# ($Id: MKlib_gen.sh,v 1.68 2020/08/23 00:02:29 tom Exp $)
#
##############################################################################
# Copyright 2018,2020 Thomas E. Dickey #
@@ -73,12 +73,12 @@ USE="$3"
# appears in gcc 5.0 and (with modification) in 5.1, making it necessary to
# determine if we are using gcc, and if so, what version because the proposed
# solution uses a nonstandard option.
-PRG=`echo "$1" | $AWK '{ sub(/^[ ]*/,""); sub(/[ ].*$/, ""); print; }' || exit 0`
+PRG=`echo "$1" | "$AWK" '{ sub(/^[ ]*/,""); sub(/[ ].*$/, ""); print; }' || exit 0`
FSF=`("$PRG" --version 2>/dev/null || exit 0) | fgrep "Free Software Foundation" | head -n 1`
ALL=`"$PRG" -dumpversion 2>/dev/null || exit 0`
-ONE=`echo "$ALL" | sed -e 's/\..*$//'`
+ONE=`echo "$ALL" | sed -e 's/[^0-9].*$//'`
if test -n "$FSF" && test -n "$ALL" && test -n "$ONE" ; then
- if test $ONE -ge 5 ; then
+ if test "$ONE" -ge 5 ; then
echo ".. adding -P option to work around $PRG $ALL" >&2
preprocessor="$preprocessor -P"
fi
@@ -96,7 +96,6 @@ trap "rm -f $ED1 $ED2 $ED3 $ED4 $AW1 $AW2 $TMP" 0 1 2 3 15
ALL=$USE
if test "$USE" = implemented ; then
- CALL="call_"
cat >$ED1 <<EOF1
/^extern.*implemented/{
h
@@ -119,7 +118,6 @@ if test "$USE" = implemented ; then
}
EOF1
else
- CALL=""
cat >$ED1 <<EOF1
/^extern.*${ALL}/{
h
@@ -178,7 +176,7 @@ EOF3
if test "$USE" = generated ; then
cat >$ED4 <<EOF
- s/^\(.*\) \(.*\) (\(.*\))\$/NCURSES_EXPORT(\1) (\2) (\3)/
+ s/^\(.*\) \(.*\) (\(.*\))\$/NCURSES_EXPORT(\1) \2 (\3)/
/attr_[sg]et.* z)/s,z),z GCC_UNUSED),
EOF
else
@@ -433,6 +431,7 @@ BEGIN {
print "#include <ncurses_cfg.h>"
print ""
print "#undef NCURSES_NOMACROS /* _this_ file uses macros */"
+ print "#define NCURSES_NOMACROS 1"
print ""
print "#include <curses.priv.h>"
print ""
@@ -495,7 +494,7 @@ EOF
sed -n -f $ED1 \
| sed -e 's/NCURSES_EXPORT(\(.*\)) \(.*\) (\(.*\))/\1 \2(\3)/' \
| sed -f $ED2 \
-| $AWK -f $AW1 using=$USE \
+| "$AWK" -f $AW1 using="$USE" \
| sed \
-e 's/ [ ]*$//g' \
-e 's/^\([a-zA-Z_][a-zA-Z_]*[ *]*\)/\1 gen_/' \
@@ -507,7 +506,7 @@ $preprocessor $TMP 2>/dev/null \
-e 's/ / /g' \
-e 's/^ //' \
-e 's/_Bool/NCURSES_BOOL/g' \
-| $AWK -f $AW2 \
+| "$AWK" -f $AW2 \
| sed -f $ED3 \
| sed \
-e 's/^.*T_CALLED.*returnCode( \([a-z].*) \));/ return \1;/' \
diff --git a/ncurses/base/lib_addch.c b/ncurses/base/lib_addch.c
index 604b13be8cec..378c2881faac 100644
--- a/ncurses/base/lib_addch.c
+++ b/ncurses/base/lib_addch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-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 *
@@ -37,7 +37,7 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_addch.c,v 1.134 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_addch.c,v 1.137 2021/02/20 22:24:34 tom Exp $")
static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT);
@@ -208,6 +208,20 @@ _nc_build_wch(WINDOW *win, ARG_CH_T ch)
WINDOW_EXT(win, addch_x) = x;
WINDOW_EXT(win, addch_y) = y;
+ /*
+ * If the background character is a wide-character, that may interfere with
+ * processing multibyte characters in this function.
+ */
+ if (!is8bits(CharOf(CHDEREF(ch)))) {
+ if (WINDOW_EXT(win, addch_used) != 0) {
+ /* discard the incomplete multibyte character */
+ WINDOW_EXT(win, addch_used) = 0;
+ TR(TRACE_VIRTPUT,
+ ("Alert discarded incomplete multibyte"));
+ }
+ return 1;
+ }
+
init_mb(state);
buffer[WINDOW_EXT(win, addch_used)] = (char) CharOf(CHDEREF(ch));
WINDOW_EXT(win, addch_used) += 1;
diff --git a/ncurses/base/lib_addstr.c b/ncurses/base/lib_addstr.c
index 19ebfcd5b337..a1e8829dd7f5 100644
--- a/ncurses/base/lib_addstr.c
+++ b/ncurses/base/lib_addstr.c
@@ -45,7 +45,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_addstr.c,v 1.56 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_addstr.c,v 1.57 2020/12/05 20:06:19 tom Exp $")
NCURSES_EXPORT(int)
waddnstr(WINDOW *win, const char *astr, int n)
@@ -60,10 +60,10 @@ waddnstr(WINDOW *win, const char *astr, int n)
("... current %s", _traceattr(WINDOW_ATTRS(win))));
code = OK;
if (n < 0)
- n = (int) strlen(astr);
+ n = INT_MAX;
TR(TRACE_VIRTPUT, ("str is not null, length = %d", n));
- while ((n-- > 0) && (*str != '\0')) {
+ while ((*str != '\0') && (n-- > 0)) {
NCURSES_CH_T ch;
TR(TRACE_VIRTPUT, ("*str = %#o", UChar(*str)));
SetChar(ch, UChar(*str++), A_NORMAL);
@@ -232,10 +232,10 @@ waddnwstr(WINDOW *win, const wchar_t *str, int n)
("... current %s", _traceattr(WINDOW_ATTRS(win))));
code = OK;
if (n < 0)
- n = (int) wcslen(str);
+ n = INT_MAX;
TR(TRACE_VIRTPUT, ("str is not null, length = %d", n));
- while ((n-- > 0) && (*str != L('\0'))) {
+ while ((*str != L('\0')) && (n-- > 0)) {
NCURSES_CH_T ch;
TR(TRACE_VIRTPUT, ("*str[0] = %#lx", (unsigned long) *str));
SetChar(ch, *str++, A_NORMAL);
diff --git a/ncurses/base/lib_bkgd.c b/ncurses/base/lib_bkgd.c
index 2030030f91a5..23effc7cd141 100644
--- a/ncurses/base/lib_bkgd.c
+++ b/ncurses/base/lib_bkgd.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2018-2019,2020 Thomas E. Dickey *
+ * Copyright 2018-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 *
@@ -37,7 +37,9 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_bkgd.c,v 1.54 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_bkgd.c,v 1.62 2021/02/13 20:06:54 tom Exp $")
+
+static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
/*
* Set the window's background information.
@@ -49,7 +51,7 @@ static NCURSES_INLINE void
#endif
wbkgrndset(WINDOW *win, const ARG_CH_T ch)
{
- T((T_CALLED("wbkgdset(%p,%s)"), (void *) win, _tracech_t(ch)));
+ T((T_CALLED("wbkgrndset(%p,%s)"), (void *) win, _tracech_t(ch)));
if (win) {
attr_t off = AttrOf(win->_nc_bkgd);
@@ -103,26 +105,36 @@ NCURSES_EXPORT(void)
wbkgdset(WINDOW *win, chtype ch)
{
NCURSES_CH_T wch;
+ T((T_CALLED("wbkgdset(%p,%s)"), (void *) win, _tracechtype(ch)));
SetChar2(wch, ch);
wbkgrndset(win, CHREF(wch));
+ returnVoid;
}
/*
* Set the window's background information and apply it to each cell.
*/
-#if USE_WIDEC_SUPPORT
-NCURSES_EXPORT(int)
-#else
static NCURSES_INLINE int
-#undef wbkgrnd
-#endif
-wbkgrnd(WINDOW *win, const ARG_CH_T ch)
+_nc_background(WINDOW *win, const ARG_CH_T ch, bool narrow)
{
#undef SP_PARM
#define SP_PARM SP /* to use Charable() */
int code = ERR;
- T((T_CALLED("wbkgd(%p,%s)"), (void *) win, _tracech_t(ch)));
+#if USE_WIDEC_SUPPORT
+ T((T_CALLED("%s(%p,%s)"),
+ narrow ? "wbkgd" : "wbkgrnd",
+ (void *) win,
+ _tracecchar_t(ch)));
+#define TraceChar(c) _tracecchar_t2(1, &(c))
+#else
+ T((T_CALLED("%s(%p,%s)"),
+ "wbkgd",
+ (void *) win,
+ _tracech_t(ch)));
+ (void) narrow;
+#define TraceChar(c) _tracechar(CharOf(c))
+#endif
if (SP == 0) {
;
@@ -143,6 +155,14 @@ wbkgrnd(WINDOW *win, const ARG_CH_T ch)
SetPair(new_bkgd, 0);
}
+ /* avoid setting background-character to a null */
+ if (CharOf(new_bkgd) == 0) {
+ NCURSES_CH_T tmp_bkgd = blank;
+ SetAttr(tmp_bkgd, AttrOf(new_bkgd));
+ SetPair(tmp_bkgd, GetPair(new_bkgd));
+ new_bkgd = tmp_bkgd;
+ }
+
memset(&old_bkgd, 0, sizeof(old_bkgd));
(void) wgetbkgrnd(win, &old_bkgd);
@@ -160,7 +180,7 @@ wbkgrnd(WINDOW *win, const ARG_CH_T ch)
old_pair = 0;
}
T(("... old background char %s, attr %s, pair %d",
- _tracechar(CharOf(old_char)), _traceattr(old_attr), old_pair));
+ TraceChar(old_char), _traceattr(old_attr), old_pair));
new_char = new_bkgd;
RemAttr(new_char, ~A_CHARTEXT);
@@ -168,14 +188,18 @@ wbkgrnd(WINDOW *win, const ARG_CH_T ch)
new_pair = GetPair(new_bkgd);
/* SVr4 limits background character to printable 7-bits */
- if (!Charable(new_bkgd)) {
+ if (
+#if USE_WIDEC_SUPPORT
+ narrow &&
+#endif
+ !Charable(new_bkgd)) {
new_char = old_char;
}
if (!(new_attr & A_COLOR)) {
new_pair = 0;
}
T(("... new background char %s, attr %s, pair %d",
- _tracechar(CharOf(new_char)), _traceattr(new_attr), new_pair));
+ TraceChar(new_char), _traceattr(new_attr), new_pair));
(void) wbkgrndset(win, CHREF(new_bkgd));
@@ -196,7 +220,19 @@ wbkgrnd(WINDOW *win, const ARG_CH_T ch)
attr_t tmp_attr = AttrOf(*cp);
if (CharEq(*cp, old_bkgd)) {
- SetChar2(*cp, CharOf(new_char));
+#if USE_WIDEC_SUPPORT
+ if (!narrow) {
+ if (Charable(new_bkgd)) {
+ SetChar2(*cp, CharOf(new_char));
+ } else {
+ SetChar(*cp, L' ', AttrOf(new_char));
+ }
+ memcpy(cp->chars,
+ new_char.chars,
+ CCHARW_MAX * sizeof(cp->chars[0]));
+ } else
+#endif
+ SetChar2(*cp, CharOf(new_char));
}
if (tmp_pair != 0) {
if (tmp_pair == old_pair) {
@@ -220,10 +256,18 @@ wbkgrnd(WINDOW *win, const ARG_CH_T ch)
returnCode(code);
}
+#if USE_WIDEC_SUPPORT
+NCURSES_EXPORT(int)
+wbkgrnd(WINDOW *win, const ARG_CH_T ch)
+{
+ return _nc_background(win, ch, FALSE);
+}
+#endif
+
NCURSES_EXPORT(int)
wbkgd(WINDOW *win, chtype ch)
{
NCURSES_CH_T wch;
SetChar2(wch, ch);
- return wbkgrnd(win, CHREF(wch));
+ return _nc_background(win, CHREF(wch), TRUE);
}
diff --git a/ncurses/base/lib_color.c b/ncurses/base/lib_color.c
index 376ad4f6047d..907e9743fcda 100644
--- a/ncurses/base/lib_color.c
+++ b/ncurses/base/lib_color.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2018-2019,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 *
@@ -49,7 +49,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_color.c,v 1.143 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_color.c,v 1.146 2021/02/14 00:17:09 tom Exp $")
#ifdef USE_TERM_DRIVER
#define CanChange InfoOf(SP_PARM).canchange
@@ -140,7 +140,6 @@ NCURSES_EXPORT_VAR(const color_t*) _nc_hls_palette = hls_palette;
#endif
/* *INDENT-ON* */
-
#if NCURSES_EXT_FUNCS
/*
* These are called from _nc_do_color(), which in turn is called from
@@ -190,12 +189,12 @@ set_background_color(NCURSES_SP_DCLx int bg, NCURSES_SP_OUTC outc)
if (set_a_background) {
TPUTS_TRACE("set_a_background");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_1(set_a_background, bg),
+ TIPARM_1(set_a_background, bg),
1, outc);
} else {
TPUTS_TRACE("set_background");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_1(set_background, toggled_colors(bg)),
+ TIPARM_1(set_background, toggled_colors(bg)),
1, outc);
}
#endif
@@ -210,12 +209,12 @@ set_foreground_color(NCURSES_SP_DCLx int fg, NCURSES_SP_OUTC outc)
if (set_a_foreground) {
TPUTS_TRACE("set_a_foreground");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_1(set_a_foreground, fg),
+ TIPARM_1(set_a_foreground, fg),
1, outc);
} else {
TPUTS_TRACE("set_foreground");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_1(set_foreground, toggled_colors(fg)),
+ TIPARM_1(set_foreground, toggled_colors(fg)),
1, outc);
}
#endif
@@ -253,14 +252,15 @@ init_direct_colors(NCURSES_SP_DCL0)
{
static NCURSES_CONST char name[] = "RGB";
- int n;
- const char *s;
- int width;
rgb_bits_t *result = &(SP_PARM->_direct_color);
result->value = 0;
if (COLORS >= 8) {
+ int n;
+ const char *s;
+ int width;
+
/* find the number of bits needed for the maximum color value */
for (width = 0; (1 << width) - 1 < (COLORS - 1); ++width) {
;
@@ -361,7 +361,6 @@ NCURSES_EXPORT(int)
NCURSES_SP_NAME(start_color) (NCURSES_SP_DCL0)
{
int result = ERR;
- int maxpairs = 0, maxcolors = 0;
T((T_CALLED("start_color(%p)"), (void *) SP_PARM));
@@ -370,8 +369,8 @@ NCURSES_SP_NAME(start_color) (NCURSES_SP_DCL0)
} else if (SP_PARM->_coloron) {
result = OK;
} else {
- maxpairs = MaxPairs;
- maxcolors = MaxColors;
+ int maxpairs = MaxPairs;
+ int maxcolors = MaxColors;
if (reset_color_pair(NCURSES_SP_ARG) != TRUE) {
set_foreground_color(NCURSES_SP_ARGx
default_fg(NCURSES_SP_ARG),
@@ -672,14 +671,14 @@ _nc_init_pair(SCREEN *sp, int pair, int f, int b)
(int) tp[b].red, (int) tp[b].green, (int) tp[b].blue));
NCURSES_PUTP2("initialize_pair",
- TPARM_7(initialize_pair,
- pair,
- (int) tp[f].red,
- (int) tp[f].green,
- (int) tp[f].blue,
- (int) tp[b].red,
- (int) tp[b].green,
- (int) tp[b].blue));
+ TIPARM_7(initialize_pair,
+ pair,
+ (int) tp[f].red,
+ (int) tp[f].green,
+ (int) tp[f].blue,
+ (int) tp[b].red,
+ (int) tp[b].green,
+ (int) tp[b].blue));
}
#endif
@@ -746,7 +745,7 @@ _nc_init_color(SCREEN *sp, int color, int r, int g, int b)
CallDriver_4(sp, td_initcolor, color, r, g, b);
#else
NCURSES_PUTP2("initialize_color",
- TPARM_4(initialize_color, color, r, g, b));
+ TIPARM_4(initialize_color, color, r, g, b));
#endif
sp->_color_defs = max(color + 1, sp->_color_defs);
@@ -1004,7 +1003,7 @@ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx
if (set_color_pair) {
TPUTS_TRACE("set_color_pair");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_1(set_color_pair, pair),
+ TIPARM_1(set_color_pair, pair),
1, outc);
return;
} else if (SP_PARM != 0) {
diff --git a/ncurses/base/lib_driver.c b/ncurses/base/lib_driver.c
index 546760710cb7..c53802f3732a 100644
--- a/ncurses/base/lib_driver.c
+++ b/ncurses/base/lib_driver.c
@@ -34,8 +34,9 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_driver.c,v 1.8 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_driver.c,v 1.9 2020/08/29 19:53:35 tom Exp $")
+#ifndef EXP_WIN32_DRIVER
typedef struct DriverEntry {
const char *name;
TERM_DRIVER *driver;
@@ -77,6 +78,7 @@ _nc_get_driver(TERMINAL_CONTROL_BLOCK * TCB, const char *name, int *errret)
}
returnCode(code);
}
+#endif /* !EXP_WIN32_DRIVER */
NCURSES_EXPORT(int)
NCURSES_SP_NAME(has_key) (SCREEN *sp, int keycode)
diff --git a/ncurses/base/lib_getch.c b/ncurses/base/lib_getch.c
index bf2115dd0641..38537591afc0 100644
--- a/ncurses/base/lib_getch.c
+++ b/ncurses/base/lib_getch.c
@@ -41,9 +41,10 @@
**
*/
+#define NEED_KEY_EVENT
#include <curses.priv.h>
-MODULE_ID("$Id: lib_getch.c,v 1.139 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_getch.c,v 1.141 2020/09/05 22:50:47 tom Exp $")
#include <fifo_defs.h>
@@ -134,7 +135,7 @@ _nc_use_meta(WINDOW *win)
}
#ifdef USE_TERM_DRIVER
-# ifdef _WIN32
+# if defined(_NC_WINDOWS) && !defined(EXP_WIN32_DRIVER)
static HANDLE
_nc_get_handle(int fd)
{
@@ -155,7 +156,14 @@ check_mouse_activity(SCREEN *sp, int delay EVENTLIST_2nd(_nc_eventlist * evl))
#ifdef USE_TERM_DRIVER
TERMINAL_CONTROL_BLOCK *TCB = TCBOf(sp);
rc = TCBOf(sp)->drv->td_testmouse(TCBOf(sp), delay EVENTLIST_2nd(evl));
-# ifdef _WIN32
+# if defined(EXP_WIN32_DRIVER)
+ /* if we emulate terminfo on console, we have to use the console routine */
+ if (IsTermInfoOnConsole(sp)) {
+ rc = _nc_console_testmouse(sp,
+ _nc_console_handle(sp->_ifd),
+ delay EVENTLIST_2nd(evl));
+ } else
+# elif defined(_NC_WINDOWS)
/* if we emulate terminfo on console, we have to use the console routine */
if (IsTermInfoOnConsole(sp)) {
HANDLE fd = _nc_get_handle(sp->_ifd);
@@ -163,29 +171,36 @@ check_mouse_activity(SCREEN *sp, int delay EVENTLIST_2nd(_nc_eventlist * evl))
} else
# endif
rc = TCB->drv->td_testmouse(TCB, delay EVENTLIST_2nd(evl));
-#else
-#if USE_SYSMOUSE
+#else /* !USE_TERM_DRIVER */
+# if USE_SYSMOUSE
if ((sp->_mouse_type == M_SYSMOUSE)
&& (sp->_sysmouse_head < sp->_sysmouse_tail)) {
rc = TW_MOUSE;
} else
-#endif
+# endif
{
+# if defined(EXP_WIN32_DRIVER)
+ rc = _nc_console_testmouse(sp,
+ _nc_console_handle(sp->_ifd),
+ delay
+ EVENTLIST_2nd(evl));
+# else
rc = _nc_timed_wait(sp,
TWAIT_MASK,
delay,
(int *) 0
EVENTLIST_2nd(evl));
-#if USE_SYSMOUSE
+# endif
+# if USE_SYSMOUSE
if ((sp->_mouse_type == M_SYSMOUSE)
&& (sp->_sysmouse_head < sp->_sysmouse_tail)
&& (rc == 0)
&& (errno == EINTR)) {
rc |= TW_MOUSE;
}
-#endif
+# endif
}
-#endif
+#endif /* USE_TERM_DRIVER */
return rc;
}
@@ -290,31 +305,54 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
} else
#endif
{ /* Can block... */
-#ifdef USE_TERM_DRIVER
+#if defined(USE_TERM_DRIVER)
int buf;
-#ifdef _WIN32
+# if defined(EXP_WIN32_DRIVER)
+ if (NC_ISATTY(sp->_ifd) && IsTermInfoOnConsole(sp) && sp->_cbreak) {
+# if USE_PTHREADS_EINTR
+ if ((pthread_self) && (pthread_kill) && (pthread_equal))
+ _nc_globals.read_thread = pthread_self();
+# endif
+ n = _nc_console_read(sp,
+ _nc_console_handle(sp->_ifd),
+ &buf);
+# if USE_PTHREADS_EINTR
+ _nc_globals.read_thread = 0;
+# endif
+ } else
+# elif defined(_NC_WINDOWS)
if (NC_ISATTY(sp->_ifd) && IsTermInfoOnConsole(sp) && sp->_cbreak)
n = _nc_mingw_console_read(sp,
_nc_get_handle(sp->_ifd),
&buf);
else
-#endif
+# endif /* EXP_WIN32_DRIVER */
n = CallDriver_1(sp, td_read, &buf);
ch = buf;
-#else
+#else /* !USE_TERM_DRIVER */
+#if defined(EXP_WIN32_DRIVER)
+ int buf;
+#endif
unsigned char c2 = 0;
-# if USE_PTHREADS_EINTR
-# if USE_WEAK_SYMBOLS
+#if USE_PTHREADS_EINTR
+#if USE_WEAK_SYMBOLS
if ((pthread_self) && (pthread_kill) && (pthread_equal))
-# endif
+#endif
_nc_globals.read_thread = pthread_self();
-# endif
+#endif
+#if defined(EXP_WIN32_DRIVER)
+ n = _nc_console_read(sp,
+ _nc_console_handle(sp->_ifd),
+ &buf);
+ c2 = buf;
+#else
n = (int) read(sp->_ifd, &c2, (size_t) 1);
+#endif
#if USE_PTHREADS_EINTR
_nc_globals.read_thread = 0;
#endif
ch = c2;
-#endif
+#endif /* USE_TERM_DRIVER */
}
if ((n == -1) || (n == 0)) {
diff --git a/ncurses/base/lib_getstr.c b/ncurses/base/lib_getstr.c
index d0b09a3b927e..7871fb357a62 100644
--- a/ncurses/base/lib_getstr.c
+++ b/ncurses/base/lib_getstr.c
@@ -39,9 +39,10 @@
**
*/
+#define NEED_KEY_EVENT
#include <curses.priv.h>
-MODULE_ID("$Id: lib_getstr.c,v 1.34 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_getstr.c,v 1.35 2020/07/18 20:02:24 tom Exp $")
/*
* This wipes out the last character, no matter whether it was a tab, control
diff --git a/ncurses/base/lib_initscr.c b/ncurses/base/lib_initscr.c
index 2ace0924a0ea..6b9149135501 100644
--- a/ncurses/base/lib_initscr.c
+++ b/ncurses/base/lib_initscr.c
@@ -46,7 +46,7 @@
#include <sys/termio.h> /* needed for ISC */
#endif
-MODULE_ID("$Id: lib_initscr.c,v 1.45 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_initscr.c,v 1.48 2020/09/07 14:26:48 tom Exp $")
NCURSES_EXPORT(WINDOW *)
initscr(void)
@@ -66,10 +66,9 @@ initscr(void)
_nc_globals.init_screen = TRUE;
- if ((env = getenv("TERM")) == 0
- || *env == '\0') {
- env = "unknown";
- }
+ env = getenv("TERM");
+ (void) VALID_TERM_ENV(env, "unknown");
+
if ((name = strdup(env)) == NULL) {
fprintf(stderr, "Error opening allocating $TERM.\n");
ExitProgram(EXIT_FAILURE);
diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c
index 2530dec5a6e4..6caef327a3c0 100644
--- a/ncurses/base/lib_mouse.c
+++ b/ncurses/base/lib_mouse.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2018-2019,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 *
@@ -85,7 +85,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_mouse.c,v 1.184 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_mouse.c,v 1.192 2021/02/14 00:17:09 tom Exp $")
#include <tic.h>
@@ -142,19 +142,29 @@ make an error
#define MASK_RESERVED_EVENT(x) (mmask_t) NCURSES_MOUSE_MASK(x, 040)
#if NCURSES_MOUSE_VERSION == 1
+
#define BUTTON_CLICKED (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED | BUTTON4_CLICKED)
#define BUTTON_PRESSED (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED | BUTTON4_PRESSED)
#define BUTTON_RELEASED (BUTTON1_RELEASED | BUTTON2_RELEASED | BUTTON3_RELEASED | BUTTON4_RELEASED)
#define BUTTON_DOUBLE_CLICKED (BUTTON1_DOUBLE_CLICKED | BUTTON2_DOUBLE_CLICKED | BUTTON3_DOUBLE_CLICKED | BUTTON4_DOUBLE_CLICKED)
#define BUTTON_TRIPLE_CLICKED (BUTTON1_TRIPLE_CLICKED | BUTTON2_TRIPLE_CLICKED | BUTTON3_TRIPLE_CLICKED | BUTTON4_TRIPLE_CLICKED)
+
#define MAX_BUTTONS 4
+
#else
+
#define BUTTON_CLICKED (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED | BUTTON4_CLICKED | BUTTON5_CLICKED)
#define BUTTON_PRESSED (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED | BUTTON4_PRESSED | BUTTON5_PRESSED)
#define BUTTON_RELEASED (BUTTON1_RELEASED | BUTTON2_RELEASED | BUTTON3_RELEASED | BUTTON4_RELEASED | BUTTON5_RELEASED)
#define BUTTON_DOUBLE_CLICKED (BUTTON1_DOUBLE_CLICKED | BUTTON2_DOUBLE_CLICKED | BUTTON3_DOUBLE_CLICKED | BUTTON4_DOUBLE_CLICKED | BUTTON5_DOUBLE_CLICKED)
#define BUTTON_TRIPLE_CLICKED (BUTTON1_TRIPLE_CLICKED | BUTTON2_TRIPLE_CLICKED | BUTTON3_TRIPLE_CLICKED | BUTTON4_TRIPLE_CLICKED | BUTTON5_TRIPLE_CLICKED)
+
+#if NCURSES_MOUSE_VERSION == 2
#define MAX_BUTTONS 5
+#else
+#define MAX_BUTTONS 11
+#endif
+
#endif
#define INVALID_EVENT -1
@@ -426,7 +436,7 @@ enable_xterm_mouse(SCREEN *sp, int enable)
#if USE_EMX_MOUSE
sp->_emxmouse_activated = enable;
#else
- NCURSES_PUTP2("xterm-mouse", TPARM_1(sp->_mouse_xtermcap, enable));
+ NCURSES_PUTP2("xterm-mouse", TIPARM_1(sp->_mouse_xtermcap, enable));
#endif
sp->_mouse_active = enable;
}
@@ -477,8 +487,6 @@ unload_gpm_library(SCREEN *sp)
T(("unload GPM library"));
sp->_mouse_gpm_loaded = FALSE;
sp->_mouse_fd = -1;
- dlclose(sp->_dlopen_gpm);
- sp->_dlopen_gpm = 0;
}
}
@@ -486,7 +494,14 @@ static void
load_gpm_library(SCREEN *sp)
{
sp->_mouse_gpm_found = FALSE;
- if ((sp->_dlopen_gpm = dlopen(LIBGPM_SONAME, my_RTLD)) != 0) {
+
+ /*
+ * If we already had a successful dlopen, reuse it.
+ */
+ if (sp->_dlopen_gpm != 0) {
+ sp->_mouse_gpm_found = TRUE;
+ sp->_mouse_gpm_loaded = TRUE;
+ } else if ((sp->_dlopen_gpm = dlopen(LIBGPM_SONAME, my_RTLD)) != 0) {
#if (defined(__GNUC__) && (__GNUC__ >= 5)) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
@@ -500,13 +515,15 @@ load_gpm_library(SCREEN *sp)
#endif
T(("GPM initialization failed: %s", dlerror()));
unload_gpm_library(sp);
+ dlclose(sp->_dlopen_gpm);
+ sp->_dlopen_gpm = 0;
} else {
sp->_mouse_gpm_found = TRUE;
sp->_mouse_gpm_loaded = TRUE;
}
}
}
-#endif
+#endif /* HAVE_LIBDL */
static bool
enable_gpm_mouse(SCREEN *sp, bool enable)
@@ -928,7 +945,7 @@ handle_wheel(SCREEN *sp, MEVENT * eventp, int button, int wheel)
break;
case 1:
if (wheel) {
-#if NCURSES_MOUSE_VERSION == 2
+#if NCURSES_MOUSE_VERSION >= 2
eventp->bstate = MASK_PRESS(5);
/* See comment above for button 4 */
#else
@@ -953,10 +970,24 @@ static bool
decode_X10_bstate(SCREEN *sp, MEVENT * eventp, unsigned intro)
{
bool result;
+ int button = 0;
+ int wheel = (intro & 96) == 96;
eventp->bstate = 0;
- if (!handle_wheel(sp, eventp, (int) intro, (intro & 96) == 96)) {
+ if (intro >= 96) {
+ if (intro >= 160) {
+ button = (int) (intro - 152); /* buttons 8-11 */
+ } else {
+ button = (int) (intro - 92); /* buttons 4-7 */
+ }
+ } else {
+ button = (intro & 3);
+ }
+
+ if (button > MAX_BUTTONS) {
+ eventp->bstate = REPORT_MOUSE_POSITION;
+ } else if (!handle_wheel(sp, eventp, (int) intro, wheel)) {
/*
* Release events aren't reported for individual buttons, just for
@@ -1261,10 +1292,21 @@ decode_xterm_SGR1006(SCREEN *sp, MEVENT * eventp)
if (read_SGR(sp, &data)) {
int b = data.params[0];
int b3 = 1 + (b & 3);
+ int wheel = ((b & 64) == 64);
+
+ if (b >= 132) {
+ b3 = MAX_BUTTONS + 1;
+ } else if (b >= 128) {
+ b3 = (b - 120); /* buttons 8-11 */
+ } else if (b >= 64) {
+ b3 = (b - 60); /* buttons 6-7 */
+ }
eventp->id = NORMAL_EVENT;
if (data.final == 'M') {
- (void) handle_wheel(sp, eventp, b, (b & 64) == 64);
+ (void) handle_wheel(sp, eventp, b, wheel);
+ } else if (b3 > MAX_BUTTONS) {
+ eventp->bstate = REPORT_MOUSE_POSITION;
} else {
mmask_t pressed = (mmask_t) NCURSES_MOUSE_MASK(b3, NCURSES_BUTTON_PRESSED);
mmask_t release = (mmask_t) NCURSES_MOUSE_MASK(b3, NCURSES_BUTTON_RELEASED);
diff --git a/ncurses/base/lib_newterm.c b/ncurses/base/lib_newterm.c
index ac897906e9fb..bba97ba1fae8 100644
--- a/ncurses/base/lib_newterm.c
+++ b/ncurses/base/lib_newterm.c
@@ -49,7 +49,7 @@
#include <tic.h>
-MODULE_ID("$Id: lib_newterm.c,v 1.102 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_newterm.c,v 1.103 2020/09/05 21:34:04 tom Exp $")
#ifdef USE_TERM_DRIVER
#define NumLabels InfoOf(SP_PARM).numlabels
@@ -88,6 +88,12 @@ _nc_initscr(NCURSES_SP_DCL0)
buf.c_oflag &= (unsigned) ~(ONLCR);
#elif HAVE_SGTTY_H
buf.sg_flags &= ~(ECHO | CRMOD);
+#elif defined(EXP_WIN32_DRIVER)
+ buf.dwFlagIn = CONMODE_IN_DEFAULT;
+ buf.dwFlagOut = CONMODE_OUT_DEFAULT | VT_FLAG_OUT;
+ if (WINCONSOLE.isTermInfoConsole) {
+ buf.dwFlagIn |= VT_FLAG_IN;
+ }
#else
memset(&buf, 0, sizeof(buf));
#endif
@@ -195,6 +201,11 @@ NCURSES_SP_NAME(newterm) (NCURSES_SP_DCLx
current = CURRENT_SCREEN;
its_term = (current ? current->_term : 0);
+#if defined(EXP_WIN32_DRIVER)
+ _setmode(fileno(_ifp), _O_BINARY);
+ _setmode(fileno(_ofp), _O_BINARY);
+#endif
+
INIT_TERM_DRIVER();
/* this loads the capability entry, then sets LINES and COLS */
if (
diff --git a/ncurses/base/lib_screen.c b/ncurses/base/lib_screen.c
index 164356dc41de..6afba6611c61 100644
--- a/ncurses/base/lib_screen.c
+++ b/ncurses/base/lib_screen.c
@@ -42,7 +42,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_screen.c,v 1.97 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_screen.c,v 1.100 2020/05/25 22:48:41 tom Exp $")
#define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */
@@ -58,7 +58,7 @@ MODULE_ID("$Id: lib_screen.c,v 1.97 2020/02/02 23:34:34 tom Exp $")
#define ARG_SLIMIT(name) /* nothing */
#endif
-#define CUR_SLIMIT _nc_SLIMIT(limit - (target - base))
+#define CUR_SLIMIT _nc_SLIMIT(limit - (size_t) (target - base))
#define TOP_SLIMIT _nc_SLIMIT(sizeof(buffer))
/*
@@ -67,7 +67,7 @@ MODULE_ID("$Id: lib_screen.c,v 1.97 2020/02/02 23:34:34 tom Exp $")
* format. It happens to be unused in the file 5.22 database (2015/03/07).
*/
static const char my_magic[] =
-{'\210', '\210', '\210', '\210'};
+{'\210', '\210', '\210', '\210', 0};
#if NCURSES_EXT_PUTWIN
typedef enum {
@@ -441,7 +441,7 @@ read_win(WINDOW *win, FILE *fp)
}
static int
-read_row(char *source, NCURSES_CH_T * prior, NCURSES_CH_T * target, int length)
+read_row(char *source, NCURSES_CH_T *prior, NCURSES_CH_T *target, int length)
{
while (*source != '\0' && length > 0) {
#if NCURSES_WIDECHAR
diff --git a/ncurses/base/lib_set_term.c b/ncurses/base/lib_set_term.c
index c5f26bc7a656..8573fbe7d522 100644
--- a/ncurses/base/lib_set_term.c
+++ b/ncurses/base/lib_set_term.c
@@ -44,10 +44,17 @@
#include <curses.priv.h>
#include <tic.h>
+#if USE_GPM_SUPPORT
+#ifdef HAVE_LIBDL
+/* use dynamic loader to avoid linkage dependency */
+#include <dlfcn.h>
+#endif
+#endif
+
#undef CUR
#define CUR SP_TERMTYPE
-MODULE_ID("$Id: lib_set_term.c,v 1.169 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_set_term.c,v 1.175 2020/10/10 19:09:03 juergen Exp $")
#ifdef USE_TERM_DRIVER
#define MaxColors InfoOf(sp).maxcolors
@@ -197,6 +204,14 @@ delscreen(SCREEN *sp)
if (_nc_find_prescr() == sp) {
_nc_forget_prescr();
}
+#if USE_GPM_SUPPORT
+#ifdef HAVE_LIBDL
+ if (sp->_dlopen_gpm != 0) {
+ dlclose(sp->_dlopen_gpm);
+ sp->_dlopen_gpm = 0;
+ }
+#endif
+#endif /* USE_GPM_SUPPORT */
free(sp);
/*
@@ -340,8 +355,9 @@ NCURSES_SP_NAME(_nc_setupscreen) (
sp->_next_screen = _nc_screen_chain;
_nc_screen_chain = sp;
- if ((sp->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0)
+ if ((sp->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0) {
returnCode(ERR);
+ }
#endif
/*
@@ -391,6 +407,11 @@ NCURSES_SP_NAME(_nc_setupscreen) (
fflush(output);
setmode(output, O_BINARY);
#endif
+#if defined(EXP_WIN32_DRIVER)
+ T(("setting output mode to binary"));
+ fflush(output);
+ _setmode(fileno(output), _O_BINARY);
+#endif
NCURSES_SP_NAME(_nc_set_buffer) (NCURSES_SP_ARGx output, TRUE);
sp->_lines = (NCURSES_SIZE_T) slines;
sp->_lines_avail = (NCURSES_SIZE_T) slines;
@@ -399,6 +420,10 @@ NCURSES_SP_NAME(_nc_setupscreen) (
fflush(output);
sp->_ofd = output ? fileno(output) : -1;
sp->_ofp = output;
+#if defined(EXP_WIN32_DRIVER)
+ if (output)
+ _setmode(fileno(output), _O_BINARY);
+#endif
sp->out_limit = (size_t) ((2 + slines) * (6 + scolumns));
if ((sp->out_buffer = malloc(sp->out_limit)) == 0)
sp->out_limit = 0;
diff --git a/ncurses/base/new_pair.c b/ncurses/base/new_pair.c
index 547ab2818066..c04f4acbb95d 100644
--- a/ncurses/base/new_pair.c
+++ b/ncurses/base/new_pair.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2018-2019,2020 Thomas E. Dickey *
+ * Copyright 2018-2020,2021 Thomas E. Dickey *
* Copyright 2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -61,7 +61,7 @@
#endif
-MODULE_ID("$Id: new_pair.c,v 1.19 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: new_pair.c,v 1.21 2021/02/14 00:17:09 tom Exp $")
#if NCURSES_EXT_COLORS
@@ -144,17 +144,16 @@ static int
_nc_find_color_pair(SCREEN *sp, int fg, int bg)
{
colorpair_t find;
- int result;
- void *pp;
+ int result = -1;
find.fg = fg;
find.bg = bg;
- if (sp != 0 &&
- (pp = tfind(&find, &sp->_ordered_pairs, compare_data)) != 0) {
- colorpair_t *temp = *(colorpair_t **) pp;
- result = (int) (temp - sp->_color_pairs);
- } else {
- result = -1;
+ if (sp != 0) {
+ void *pp;
+ if ((pp = tfind(&find, &sp->_ordered_pairs, compare_data)) != 0) {
+ colorpair_t *temp = *(colorpair_t **) pp;
+ result = (int) (temp - sp->_color_pairs);
+ }
}
return result;
}
@@ -197,7 +196,10 @@ NCURSES_EXPORT(void)
_nc_reset_color_pair(SCREEN *sp, int pair, colorpair_t * next)
{
colorpair_t *last;
+
if (ValidPair(sp, pair)) {
+ bool used;
+
ReservePairs(sp, pair);
last = &(sp->_color_pairs[pair]);
delink_color_pair(sp, pair);
@@ -205,6 +207,11 @@ _nc_reset_color_pair(SCREEN *sp, int pair, colorpair_t * next)
(last->fg != next->fg || last->bg != next->bg)) {
/* remove the old entry from fast index */
tdelete(last, &sp->_ordered_pairs, compare_data);
+ used = FALSE;
+ } else {
+ used = (last->mode != cpFREE);
+ }
+ if (!used) {
/* create a new entry in fast index */
*last = *next;
tsearch(last, &sp->_ordered_pairs, compare_data);
diff --git a/ncurses/base/wresize.c b/ncurses/base/wresize.c
index 93276ef5c42b..30718b8878fd 100644
--- a/ncurses/base/wresize.c
+++ b/ncurses/base/wresize.c
@@ -34,7 +34,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: wresize.c,v 1.39 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: wresize.c,v 1.41 2020/04/18 21:01:00 tom Exp $")
static int
cleanup_lines(struct ldat *data, int length)
@@ -176,7 +176,15 @@ wresize(WINDOW *win, int ToLines, int ToCols)
if (s == 0)
returnCode(cleanup_lines(new_lines, row));
for (col = 0; col <= ToCols; ++col) {
- s[col] = (col <= size_x
+ bool valid = (col <= size_x);
+ if_WIDEC({
+ if (col == ToCols
+ && col < size_x
+ && isWidecBase(win->_line[row].text[col])) {
+ valid = FALSE;
+ }
+ });
+ s[col] = (valid
? win->_line[row].text[col]
: win->_nc_bkgd);
}
diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h
index 9ca0263a3033..a992bc9193f7 100644
--- a/ncurses/curses.priv.h
+++ b/ncurses/curses.priv.h
@@ -35,7 +35,7 @@
****************************************************************************/
/*
- * $Id: curses.priv.h,v 1.628 2020/02/02 23:34:34 tom Exp $
+ * $Id: curses.priv.h,v 1.639 2020/11/14 23:37:54 tom Exp $
*
* curses.priv.h
*
@@ -72,10 +72,6 @@ extern "C" {
#include <unistd.h>
#endif
-#if HAVE_SYS_BSDTYPES_H && !(defined(_WIN32) || defined(_WIN64))
-#include <sys/bsdtypes.h> /* needed for ISC */
-#endif
-
#if HAVE_LIMITS_H
# include <limits.h>
#elif HAVE_SYS_PARAM_H
@@ -107,6 +103,24 @@ extern "C" {
extern int errno;
#endif
+/* Some Windows related defines */
+#undef _NC_WINDOWS
+#if (defined(_WIN32) || defined(_WIN64))
+#define _NC_WINDOWS
+#else
+#undef EXP_WIN32_DRIVER
+#endif
+
+#undef _NC_MINGW
+#if (defined(__MINGW32__) || defined(__MINGW64__))
+#define _NC_MINGW
+#endif
+
+#undef _NC_MSC
+#ifdef _MSC_VER
+#define _NC_MSC
+#endif
+
/* Some systems have a broken 'select()', but workable 'poll()'. Use that */
#if HAVE_WORKING_POLL
#define USE_FUNC_POLL 1
@@ -185,7 +199,7 @@ extern int errno;
* the path separator in configure doesn't work properly. So, if building
* for MinGW, we enforce the correct Windows PATH separator
*/
-#ifdef _WIN32
+#if defined(_NC_WINDOWS)
# ifdef NCURSES_PATHSEP
# undef NCURSES_PATHSEP
# endif
@@ -275,11 +289,20 @@ extern NCURSES_EXPORT(void *) _nc_memmove (void *, const void *, size_t);
* Options for terminal drivers, etc...
*/
#ifdef USE_TERM_DRIVER
+#define NO_TERMINAL "unknown"
#define USE_SP_RIPOFF 1
#define USE_SP_TERMTYPE 1
#define USE_SP_WINDOWLIST 1
+#else
+#define NO_TERMINAL 0
#endif
+#define VALID_TERM_ENV(term_env, no_terminal) \
+ (term_env = (NonEmpty(term_env) \
+ ? term_env \
+ : no_terminal), \
+ NonEmpty(term_env))
+
/*
* Note: ht/cbt expansion flakes out randomly under Linux 1.1.47, but only
* when we're throwing control codes at the screen at high volume. To see
@@ -337,6 +360,10 @@ typedef TRIES {
#include <curses.h> /* we'll use -Ipath directive to get the right one! */
+#if !(defined(NCURSES_WGETCH_EVENTS) && defined(NEED_KEY_EVENT))
+#undef KEY_EVENT /* reduce compiler-warnings with Visual C++ */
+#endif
+
typedef struct
{
int red, green, blue; /* what color_content() returns */
@@ -953,6 +980,11 @@ typedef struct {
time_t dbd_time; /* cache last updated */
ITERATOR_VARS dbd_vars[dbdLAST];
+#if HAVE_TSEARCH
+ void *cached_tparm;
+ int count_tparm;
+#endif /* HAVE_TSEARCH */
+
#ifdef USE_TERM_DRIVER
int (*term_driver)(struct DriverTCB*, const char*, int*);
#endif
@@ -1334,7 +1366,7 @@ struct screen {
int _sysmouse_new_buttons;
#endif
-#ifdef USE_TERM_DRIVER
+#if defined(USE_TERM_DRIVER) || defined(EXP_WIN32_DRIVER)
MEVENT _drv_mouse_fifo[FIFO_SIZE];
int _drv_mouse_head;
int _drv_mouse_tail;
@@ -1828,7 +1860,7 @@ extern NCURSES_EXPORT(SCREEN *) _nc_retrace_sp (SCREEN *);
extern NCURSES_EXPORT(WINDOW *) _nc_retrace_win (WINDOW *);
extern NCURSES_EXPORT(attr_t) _nc_retrace_attr_t (attr_t);
extern NCURSES_EXPORT(char *) _nc_retrace_ptr (char *);
-extern NCURSES_EXPORT(char *) _nc_trace_ttymode(TTY *tty);
+extern NCURSES_EXPORT(char *) _nc_trace_ttymode(const TTY *tty);
extern NCURSES_EXPORT(char *) _nc_varargs (const char *, va_list);
extern NCURSES_EXPORT(chtype) _nc_retrace_chtype (chtype);
extern NCURSES_EXPORT(const char *) _nc_altcharset_name(attr_t, chtype);
@@ -2343,11 +2375,10 @@ extern NCURSES_EXPORT(int) _nc_eventlist_timeout(_nc_eventlist *);
*/
#if USE_WIDEC_SUPPORT
-#if defined(_WIN32)
+#if defined(_NC_WINDOWS) && !defined(_NC_MSC) && !defined(EXP_WIN32_DRIVER)
/*
* MinGW has wide-character functions, but they do not work correctly.
*/
-
extern int __MINGW_NOTHROW _nc_wctomb(char *, wchar_t);
#define wctomb(s,wc) _nc_wctomb(s,wc)
#define wcrtomb(s,wc,n) _nc_wctomb(s,wc)
@@ -2358,7 +2389,7 @@ extern int __MINGW_NOTHROW _nc_mbtowc(wchar_t *, const char *, size_t);
extern int __MINGW_NOTHROW _nc_mblen(const char *, size_t);
#define mblen(s,n) _nc_mblen(s, n)
-#endif /* _WIN32 */
+#endif /* _NC_WINDOWS && !_NC_MSC */
#if HAVE_MBTOWC && HAVE_MBLEN
#define reset_mbytes(state) IGNORE_RC(mblen(NULL, (size_t) 0)), IGNORE_RC(mbtowc(NULL, NULL, (size_t) 0))
@@ -2580,6 +2611,10 @@ extern NCURSES_EXPORT(int) TINFO_MVCUR(SCREEN*, int, int, int, int);
#define TINFO_MVCUR NCURSES_SP_NAME(_nc_mvcur)
#endif
+#if defined(EXP_WIN32_DRIVER)
+#include <nc_win32.h>
+#endif
+
/*
* Entrypoints using an extra parameter with the terminal driver.
*/
@@ -2602,6 +2637,9 @@ extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, int *, int *);
_nc_setupterm(name, fd, err, reuse)
#endif /* !USE_TERM_DRIVER */
+#ifdef EXP_WIN32_DRIVER
+extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER;
+#else
#ifdef USE_TERM_DRIVER
#if defined(USE_WIN32CON_DRIVER)
#include <nc_mingw.h>
@@ -2619,9 +2657,12 @@ extern NCURSES_EXPORT(int) _nc_mingw_testmouse(
#else
#endif
extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER;
-#endif
+#endif /* USE_TERM_DRIVER */
+#endif /* EXP_WIN32_DRIVER */
-#if defined(USE_TERM_DRIVER) && defined(USE_WIN32CON_DRIVER)
+#if defined(USE_TERM_DRIVER) && defined(EXP_WIN32_DRIVER)
+#define NC_ISATTY(fd) (0 != _nc_console_isatty(fd))
+#elif defined(USE_TERM_DRIVER) && defined(USE_WIN32CON_DRIVER)
#define NC_ISATTY(fd) _nc_mingw_isatty(fd)
#else
#define NC_ISATTY(fd) isatty(fd)
@@ -2630,15 +2671,21 @@ extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER;
#ifdef USE_TERM_DRIVER
# define IsTermInfo(sp) ((TCBOf(sp) != 0) && ((TCBOf(sp)->drv->isTerminfo)))
# define HasTInfoTerminal(sp) ((0 != TerminalOf(sp)) && IsTermInfo(sp))
-# if defined(USE_WIN32CON_DRIVER)
+# if defined(EXP_WIN32_DRIVER)
+# define IsTermInfoOnConsole(sp) (IsTermInfo(sp)&&_nc_console_test(TerminalOf(sp)->Filedes))
+# elif defined(USE_WIN32CON_DRIVER)
# define IsTermInfoOnConsole(sp) (IsTermInfo(sp)&&_nc_mingw_isconsole(TerminalOf(sp)->Filedes))
-#else
+# else
# define IsTermInfoOnConsole(sp) FALSE
# endif
#else
# define IsTermInfo(sp) TRUE
# define HasTInfoTerminal(sp) (0 != TerminalOf(sp))
-# define IsTermInfoOnConsole(sp) FALSE
+# if defined(EXP_WIN32_DRIVER)
+# define IsTermInfoOnConsole(sp) _nc_console_test(TerminalOf(sp)->Filedes)
+# else
+# define IsTermInfoOnConsole(sp) FALSE
+# endif
#endif
#define IsValidTIScreen(sp) (HasTInfoTerminal(sp))
diff --git a/ncurses/llib-lncurses b/ncurses/llib-lncurses
index 642c68d6ce5f..3033100792bf 100644
--- a/ncurses/llib-lncurses
+++ b/ncurses/llib-lncurses
@@ -452,85 +452,85 @@ int flash(void)
/* ./lib_gen.c */
#undef addch
-int (addch)(
+int addch(
const chtype z)
{ return(*(int *)0); }
#undef addchnstr
-int (addchnstr)(
+int addchnstr(
const chtype *a1,
int z)
{ return(*(int *)0); }
#undef addchstr
-int (addchstr)(
+int addchstr(
const chtype *z)
{ return(*(int *)0); }
#undef addnstr
-int (addnstr)(
+int addnstr(
const char *a1,
int z)
{ return(*(int *)0); }
#undef addstr
-int (addstr)(
+int addstr(
const char *z)
{ return(*(int *)0); }
#undef attroff
-int (attroff)(
- NCURSES_ATTR_T z)
+int attroff(
+ int z)
{ return(*(int *)0); }
#undef attron
-int (attron)(
- NCURSES_ATTR_T z)
+int attron(
+ int z)
{ return(*(int *)0); }
#undef attrset
-int (attrset)(
- NCURSES_ATTR_T z)
+int attrset(
+ int z)
{ return(*(int *)0); }
#undef attr_get
-int (attr_get)(
+int attr_get(
attr_t *a1,
short *a2,
void *z)
{ return(*(int *)0); }
#undef attr_off
-int (attr_off)(
+int attr_off(
attr_t a1,
void *z)
{ return(*(int *)0); }
#undef attr_on
-int (attr_on)(
+int attr_on(
attr_t a1,
void *z)
{ return(*(int *)0); }
#undef attr_set
-int (attr_set)(
+int attr_set(
attr_t a1,
short a2,
void *z)
{ return(*(int *)0); }
#undef bkgd
-int (bkgd)(
+int bkgd(
chtype z)
{ return(*(int *)0); }
#undef bkgdset
-void (bkgdset)(
+void bkgdset(
chtype z)
{ /* void */ }
#undef border
-int (border)(
+int border(
chtype a1,
chtype a2,
chtype a3,
@@ -542,14 +542,14 @@ int (border)(
{ return(*(int *)0); }
#undef box
-int (box)(
+int box(
WINDOW *a1,
chtype a2,
chtype z)
{ return(*(int *)0); }
#undef chgat
-int (chgat)(
+int chgat(
int a1,
attr_t a2,
short a3,
@@ -557,137 +557,137 @@ int (chgat)(
{ return(*(int *)0); }
#undef clear
-int (clear)(void)
+int clear(void)
{ return(*(int *)0); }
#undef clrtobot
-int (clrtobot)(void)
+int clrtobot(void)
{ return(*(int *)0); }
#undef clrtoeol
-int (clrtoeol)(void)
+int clrtoeol(void)
{ return(*(int *)0); }
#undef color_set
-int (color_set)(
+int color_set(
short a1,
void *z)
{ return(*(int *)0); }
#undef COLOR_PAIR
-int (COLOR_PAIR)(
+int COLOR_PAIR(
int z)
{ return(*(int *)0); }
#undef delch
-int (delch)(void)
+int delch(void)
{ return(*(int *)0); }
#undef deleteln
-int (deleteln)(void)
+int deleteln(void)
{ return(*(int *)0); }
#undef echochar
-int (echochar)(
+int echochar(
const chtype z)
{ return(*(int *)0); }
#undef erase
-int (erase)(void)
+int erase(void)
{ return(*(int *)0); }
#undef getbkgd
-chtype (getbkgd)(
+chtype getbkgd(
WINDOW *z)
{ return(*(chtype *)0); }
#undef getch
-int (getch)(void)
+int getch(void)
{ return(*(int *)0); }
#undef getnstr
-int (getnstr)(
+int getnstr(
char *a1,
int z)
{ return(*(int *)0); }
#undef getstr
-int (getstr)(
+int getstr(
char *z)
{ return(*(int *)0); }
#undef hline
-int (hline)(
+int hline(
chtype a1,
int z)
{ return(*(int *)0); }
#undef inch
-chtype (inch)(void)
+chtype inch(void)
{ return(*(chtype *)0); }
#undef inchnstr
-int (inchnstr)(
+int inchnstr(
chtype *a1,
int z)
{ return(*(int *)0); }
#undef inchstr
-int (inchstr)(
+int inchstr(
chtype *z)
{ return(*(int *)0); }
#undef innstr
-int (innstr)(
+int innstr(
char *a1,
int z)
{ return(*(int *)0); }
#undef insch
-int (insch)(
+int insch(
chtype z)
{ return(*(int *)0); }
#undef insdelln
-int (insdelln)(
+int insdelln(
int z)
{ return(*(int *)0); }
#undef insertln
-int (insertln)(void)
+int insertln(void)
{ return(*(int *)0); }
#undef insnstr
-int (insnstr)(
+int insnstr(
const char *a1,
int z)
{ return(*(int *)0); }
#undef insstr
-int (insstr)(
+int insstr(
const char *z)
{ return(*(int *)0); }
#undef instr
-int (instr)(
+int instr(
char *z)
{ return(*(int *)0); }
#undef move
-int (move)(
+int move(
int a1,
int z)
{ return(*(int *)0); }
#undef mvaddch
-int (mvaddch)(
+int mvaddch(
int a1,
int a2,
const chtype z)
{ return(*(int *)0); }
#undef mvaddchnstr
-int (mvaddchnstr)(
+int mvaddchnstr(
int a1,
int a2,
const chtype *a3,
@@ -695,14 +695,14 @@ int (mvaddchnstr)(
{ return(*(int *)0); }
#undef mvaddchstr
-int (mvaddchstr)(
+int mvaddchstr(
int a1,
int a2,
const chtype *z)
{ return(*(int *)0); }
#undef mvaddnstr
-int (mvaddnstr)(
+int mvaddnstr(
int a1,
int a2,
const char *a3,
@@ -710,14 +710,14 @@ int (mvaddnstr)(
{ return(*(int *)0); }
#undef mvaddstr
-int (mvaddstr)(
+int mvaddstr(
int a1,
int a2,
const char *z)
{ return(*(int *)0); }
#undef mvchgat
-int (mvchgat)(
+int mvchgat(
int a1,
int a2,
int a3,
@@ -727,19 +727,19 @@ int (mvchgat)(
{ return(*(int *)0); }
#undef mvdelch
-int (mvdelch)(
+int mvdelch(
int a1,
int z)
{ return(*(int *)0); }
#undef mvgetch
-int (mvgetch)(
+int mvgetch(
int a1,
int z)
{ return(*(int *)0); }
#undef mvgetnstr
-int (mvgetnstr)(
+int mvgetnstr(
int a1,
int a2,
char *a3,
@@ -747,14 +747,14 @@ int (mvgetnstr)(
{ return(*(int *)0); }
#undef mvgetstr
-int (mvgetstr)(
+int mvgetstr(
int a1,
int a2,
char *z)
{ return(*(int *)0); }
#undef mvhline
-int (mvhline)(
+int mvhline(
int a1,
int a2,
chtype a3,
@@ -762,13 +762,13 @@ int (mvhline)(
{ return(*(int *)0); }
#undef mvinch
-chtype (mvinch)(
+chtype mvinch(
int a1,
int z)
{ return(*(chtype *)0); }
#undef mvinchnstr
-int (mvinchnstr)(
+int mvinchnstr(
int a1,
int a2,
chtype *a3,
@@ -776,14 +776,14 @@ int (mvinchnstr)(
{ return(*(int *)0); }
#undef mvinchstr
-int (mvinchstr)(
+int mvinchstr(
int a1,
int a2,
chtype *z)
{ return(*(int *)0); }
#undef mvinnstr
-int (mvinnstr)(
+int mvinnstr(
int a1,
int a2,
char *a3,
@@ -791,14 +791,14 @@ int (mvinnstr)(
{ return(*(int *)0); }
#undef mvinsch
-int (mvinsch)(
+int mvinsch(
int a1,
int a2,
chtype z)
{ return(*(int *)0); }
#undef mvinsnstr
-int (mvinsnstr)(
+int mvinsnstr(
int a1,
int a2,
const char *a3,
@@ -806,21 +806,21 @@ int (mvinsnstr)(
{ return(*(int *)0); }
#undef mvinsstr
-int (mvinsstr)(
+int mvinsstr(
int a1,
int a2,
const char *z)
{ return(*(int *)0); }
#undef mvinstr
-int (mvinstr)(
+int mvinstr(
int a1,
int a2,
char *z)
{ return(*(int *)0); }
#undef mvvline
-int (mvvline)(
+int mvvline(
int a1,
int a2,
chtype a3,
@@ -828,7 +828,7 @@ int (mvvline)(
{ return(*(int *)0); }
#undef mvwaddch
-int (mvwaddch)(
+int mvwaddch(
WINDOW *a1,
int a2,
int a3,
@@ -836,7 +836,7 @@ int (mvwaddch)(
{ return(*(int *)0); }
#undef mvwaddchnstr
-int (mvwaddchnstr)(
+int mvwaddchnstr(
WINDOW *a1,
int a2,
int a3,
@@ -845,7 +845,7 @@ int (mvwaddchnstr)(
{ return(*(int *)0); }
#undef mvwaddchstr
-int (mvwaddchstr)(
+int mvwaddchstr(
WINDOW *a1,
int a2,
int a3,
@@ -853,7 +853,7 @@ int (mvwaddchstr)(
{ return(*(int *)0); }
#undef mvwaddnstr
-int (mvwaddnstr)(
+int mvwaddnstr(
WINDOW *a1,
int a2,
int a3,
@@ -862,7 +862,7 @@ int (mvwaddnstr)(
{ return(*(int *)0); }
#undef mvwaddstr
-int (mvwaddstr)(
+int mvwaddstr(
WINDOW *a1,
int a2,
int a3,
@@ -870,7 +870,7 @@ int (mvwaddstr)(
{ return(*(int *)0); }
#undef mvwchgat
-int (mvwchgat)(
+int mvwchgat(
WINDOW *a1,
int a2,
int a3,
@@ -881,21 +881,21 @@ int (mvwchgat)(
{ return(*(int *)0); }
#undef mvwdelch
-int (mvwdelch)(
+int mvwdelch(
WINDOW *a1,
int a2,
int z)
{ return(*(int *)0); }
#undef mvwgetch
-int (mvwgetch)(
+int mvwgetch(
WINDOW *a1,
int a2,
int z)
{ return(*(int *)0); }
#undef mvwgetnstr
-int (mvwgetnstr)(
+int mvwgetnstr(
WINDOW *a1,
int a2,
int a3,
@@ -904,7 +904,7 @@ int (mvwgetnstr)(
{ return(*(int *)0); }
#undef mvwgetstr
-int (mvwgetstr)(
+int mvwgetstr(
WINDOW *a1,
int a2,
int a3,
@@ -912,7 +912,7 @@ int (mvwgetstr)(
{ return(*(int *)0); }
#undef mvwhline
-int (mvwhline)(
+int mvwhline(
WINDOW *a1,
int a2,
int a3,
@@ -921,14 +921,14 @@ int (mvwhline)(
{ return(*(int *)0); }
#undef mvwinch
-chtype (mvwinch)(
+chtype mvwinch(
WINDOW *a1,
int a2,
int z)
{ return(*(chtype *)0); }
#undef mvwinchnstr
-int (mvwinchnstr)(
+int mvwinchnstr(
WINDOW *a1,
int a2,
int a3,
@@ -937,7 +937,7 @@ int (mvwinchnstr)(
{ return(*(int *)0); }
#undef mvwinchstr
-int (mvwinchstr)(
+int mvwinchstr(
WINDOW *a1,
int a2,
int a3,
@@ -945,7 +945,7 @@ int (mvwinchstr)(
{ return(*(int *)0); }
#undef mvwinnstr
-int (mvwinnstr)(
+int mvwinnstr(
WINDOW *a1,
int a2,
int a3,
@@ -954,7 +954,7 @@ int (mvwinnstr)(
{ return(*(int *)0); }
#undef mvwinsch
-int (mvwinsch)(
+int mvwinsch(
WINDOW *a1,
int a2,
int a3,
@@ -962,7 +962,7 @@ int (mvwinsch)(
{ return(*(int *)0); }
#undef mvwinsnstr
-int (mvwinsnstr)(
+int mvwinsnstr(
WINDOW *a1,
int a2,
int a3,
@@ -971,7 +971,7 @@ int (mvwinsnstr)(
{ return(*(int *)0); }
#undef mvwinsstr
-int (mvwinsstr)(
+int mvwinsstr(
WINDOW *a1,
int a2,
int a3,
@@ -979,7 +979,7 @@ int (mvwinsstr)(
{ return(*(int *)0); }
#undef mvwinstr
-int (mvwinstr)(
+int mvwinstr(
WINDOW *a1,
int a2,
int a3,
@@ -987,7 +987,7 @@ int (mvwinstr)(
{ return(*(int *)0); }
#undef mvwvline
-int (mvwvline)(
+int mvwvline(
WINDOW *a1,
int a2,
int a3,
@@ -996,103 +996,103 @@ int (mvwvline)(
{ return(*(int *)0); }
#undef PAIR_NUMBER
-int (PAIR_NUMBER)(
+int PAIR_NUMBER(
int z)
{ return(*(int *)0); }
#undef redrawwin
-int (redrawwin)(
+int redrawwin(
WINDOW *z)
{ return(*(int *)0); }
#undef refresh
-int (refresh)(void)
+int refresh(void)
{ return(*(int *)0); }
#undef scrl
-int (scrl)(
+int scrl(
int z)
{ return(*(int *)0); }
#undef scroll
-int (scroll)(
+int scroll(
WINDOW *z)
{ return(*(int *)0); }
#undef setscrreg
-int (setscrreg)(
+int setscrreg(
int a1,
int z)
{ return(*(int *)0); }
#undef standout
-int (standout)(void)
+int standout(void)
{ return(*(int *)0); }
#undef standend
-int (standend)(void)
+int standend(void)
{ return(*(int *)0); }
#undef timeout
-void (timeout)(
+void timeout(
int z)
{ /* void */ }
#undef touchline
-int (touchline)(
+int touchline(
WINDOW *a1,
int a2,
int z)
{ return(*(int *)0); }
#undef touchwin
-int (touchwin)(
+int touchwin(
WINDOW *z)
{ return(*(int *)0); }
#undef untouchwin
-int (untouchwin)(
+int untouchwin(
WINDOW *z)
{ return(*(int *)0); }
#undef vline
-int (vline)(
+int vline(
chtype a1,
int z)
{ return(*(int *)0); }
#undef waddchstr
-int (waddchstr)(
+int waddchstr(
WINDOW *a1,
const chtype *z)
{ return(*(int *)0); }
#undef waddstr
-int (waddstr)(
+int waddstr(
WINDOW *a1,
const char *z)
{ return(*(int *)0); }
#undef wattron
-int (wattron)(
+int wattron(
WINDOW *a1,
int z)
{ return(*(int *)0); }
#undef wattroff
-int (wattroff)(
+int wattroff(
WINDOW *a1,
int z)
{ return(*(int *)0); }
#undef wattrset
-int (wattrset)(
+int wattrset(
WINDOW *a1,
int z)
{ return(*(int *)0); }
#undef wattr_get
-int (wattr_get)(
+int wattr_get(
WINDOW *a1,
attr_t *a2,
short *a3,
@@ -1100,7 +1100,7 @@ int (wattr_get)(
{ return(*(int *)0); }
#undef wattr_set
-int (wattr_set)(
+int wattr_set(
WINDOW *a1,
attr_t a2,
short a3,
@@ -1108,173 +1108,173 @@ int (wattr_set)(
{ return(*(int *)0); }
#undef wdeleteln
-int (wdeleteln)(
+int wdeleteln(
WINDOW *z)
{ return(*(int *)0); }
#undef wgetstr
-int (wgetstr)(
+int wgetstr(
WINDOW *a1,
char *z)
{ return(*(int *)0); }
#undef winchstr
-int (winchstr)(
+int winchstr(
WINDOW *a1,
chtype *z)
{ return(*(int *)0); }
#undef winsertln
-int (winsertln)(
+int winsertln(
WINDOW *z)
{ return(*(int *)0); }
#undef winsstr
-int (winsstr)(
+int winsstr(
WINDOW *a1,
const char *z)
{ return(*(int *)0); }
#undef winstr
-int (winstr)(
+int winstr(
WINDOW *a1,
char *z)
{ return(*(int *)0); }
#undef wstandout
-int (wstandout)(
+int wstandout(
WINDOW *z)
{ return(*(int *)0); }
#undef wstandend
-int (wstandend)(
+int wstandend(
WINDOW *z)
{ return(*(int *)0); }
#undef getattrs
-int (getattrs)(
+int getattrs(
const WINDOW *z)
{ return(*(int *)0); }
#undef getcurx
-int (getcurx)(
+int getcurx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getcury
-int (getcury)(
+int getcury(
const WINDOW *z)
{ return(*(int *)0); }
#undef getbegx
-int (getbegx)(
+int getbegx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getbegy
-int (getbegy)(
+int getbegy(
const WINDOW *z)
{ return(*(int *)0); }
#undef getmaxx
-int (getmaxx)(
+int getmaxx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getmaxy
-int (getmaxy)(
+int getmaxy(
const WINDOW *z)
{ return(*(int *)0); }
#undef getparx
-int (getparx)(
+int getparx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getpary
-int (getpary)(
+int getpary(
const WINDOW *z)
{ return(*(int *)0); }
#undef wgetparent
-WINDOW *(wgetparent)(
+WINDOW *wgetparent(
const WINDOW *z)
{ return(*(WINDOW **)0); }
#undef is_cleared
-NCURSES_BOOL (is_cleared)(
+NCURSES_BOOL is_cleared(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_idcok
-NCURSES_BOOL (is_idcok)(
+NCURSES_BOOL is_idcok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_idlok
-NCURSES_BOOL (is_idlok)(
+NCURSES_BOOL is_idlok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_immedok
-NCURSES_BOOL (is_immedok)(
+NCURSES_BOOL is_immedok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_keypad
-NCURSES_BOOL (is_keypad)(
+NCURSES_BOOL is_keypad(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_leaveok
-NCURSES_BOOL (is_leaveok)(
+NCURSES_BOOL is_leaveok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_nodelay
-NCURSES_BOOL (is_nodelay)(
+NCURSES_BOOL is_nodelay(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_notimeout
-NCURSES_BOOL (is_notimeout)(
+NCURSES_BOOL is_notimeout(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_pad
-NCURSES_BOOL (is_pad)(
+NCURSES_BOOL is_pad(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_scrollok
-NCURSES_BOOL (is_scrollok)(
+NCURSES_BOOL is_scrollok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_subwin
-NCURSES_BOOL (is_subwin)(
+NCURSES_BOOL is_subwin(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_syncok
-NCURSES_BOOL (is_syncok)(
+NCURSES_BOOL is_syncok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef wgetdelay
-int (wgetdelay)(
+int wgetdelay(
const WINDOW *z)
{ return(*(int *)0); }
#undef wgetscrreg
-int (wgetscrreg)(
+int wgetscrreg(
const WINDOW *a1,
int *a2,
int *z)
{ return(*(int *)0); }
#undef mouse_trafo
-NCURSES_BOOL (mouse_trafo)(
+NCURSES_BOOL mouse_trafo(
int *a1,
int *a2,
NCURSES_BOOL z)
@@ -3632,6 +3632,13 @@ char *tiparm(
...)
{ return(*(char **)0); }
+#undef _nc_tiparm
+char *_nc_tiparm(
+ int expected,
+ const char *string,
+ ...)
+ { return(*(char **)0); }
+
/* ./tinfo/lib_tputs.c */
#undef PC
diff --git a/ncurses/llib-lncursest b/ncurses/llib-lncursest
index 0fbde935d07b..36a94b57297e 100644
--- a/ncurses/llib-lncursest
+++ b/ncurses/llib-lncursest
@@ -455,85 +455,85 @@ int flash(void)
/* ./lib_gen.c */
#undef addch
-int (addch)(
+int addch(
const chtype z)
{ return(*(int *)0); }
#undef addchnstr
-int (addchnstr)(
+int addchnstr(
const chtype *a1,
int z)
{ return(*(int *)0); }
#undef addchstr
-int (addchstr)(
+int addchstr(
const chtype *z)
{ return(*(int *)0); }
#undef addnstr
-int (addnstr)(
+int addnstr(
const char *a1,
int z)
{ return(*(int *)0); }
#undef addstr
-int (addstr)(
+int addstr(
const char *z)
{ return(*(int *)0); }
#undef attroff
-int (attroff)(
- NCURSES_ATTR_T z)
+int attroff(
+ int z)
{ return(*(int *)0); }
#undef attron
-int (attron)(
- NCURSES_ATTR_T z)
+int attron(
+ int z)
{ return(*(int *)0); }
#undef attrset
-int (attrset)(
- NCURSES_ATTR_T z)
+int attrset(
+ int z)
{ return(*(int *)0); }
#undef attr_get
-int (attr_get)(
+int attr_get(
attr_t *a1,
short *a2,
void *z)
{ return(*(int *)0); }
#undef attr_off
-int (attr_off)(
+int attr_off(
attr_t a1,
void *z)
{ return(*(int *)0); }
#undef attr_on
-int (attr_on)(
+int attr_on(
attr_t a1,
void *z)
{ return(*(int *)0); }
#undef attr_set
-int (attr_set)(
+int attr_set(
attr_t a1,
short a2,
void *z)
{ return(*(int *)0); }
#undef bkgd
-int (bkgd)(
+int bkgd(
chtype z)
{ return(*(int *)0); }
#undef bkgdset
-void (bkgdset)(
+void bkgdset(
chtype z)
{ /* void */ }
#undef border
-int (border)(
+int border(
chtype a1,
chtype a2,
chtype a3,
@@ -545,14 +545,14 @@ int (border)(
{ return(*(int *)0); }
#undef box
-int (box)(
+int box(
WINDOW *a1,
chtype a2,
chtype z)
{ return(*(int *)0); }
#undef chgat
-int (chgat)(
+int chgat(
int a1,
attr_t a2,
short a3,
@@ -560,137 +560,137 @@ int (chgat)(
{ return(*(int *)0); }
#undef clear
-int (clear)(void)
+int clear(void)
{ return(*(int *)0); }
#undef clrtobot
-int (clrtobot)(void)
+int clrtobot(void)
{ return(*(int *)0); }
#undef clrtoeol
-int (clrtoeol)(void)
+int clrtoeol(void)
{ return(*(int *)0); }
#undef color_set
-int (color_set)(
+int color_set(
short a1,
void *z)
{ return(*(int *)0); }
#undef COLOR_PAIR
-int (COLOR_PAIR)(
+int COLOR_PAIR(
int z)
{ return(*(int *)0); }
#undef delch
-int (delch)(void)
+int delch(void)
{ return(*(int *)0); }
#undef deleteln
-int (deleteln)(void)
+int deleteln(void)
{ return(*(int *)0); }
#undef echochar
-int (echochar)(
+int echochar(
const chtype z)
{ return(*(int *)0); }
#undef erase
-int (erase)(void)
+int erase(void)
{ return(*(int *)0); }
#undef getbkgd
-chtype (getbkgd)(
+chtype getbkgd(
WINDOW *z)
{ return(*(chtype *)0); }
#undef getch
-int (getch)(void)
+int getch(void)
{ return(*(int *)0); }
#undef getnstr
-int (getnstr)(
+int getnstr(
char *a1,
int z)
{ return(*(int *)0); }
#undef getstr
-int (getstr)(
+int getstr(
char *z)
{ return(*(int *)0); }
#undef hline
-int (hline)(
+int hline(
chtype a1,
int z)
{ return(*(int *)0); }
#undef inch
-chtype (inch)(void)
+chtype inch(void)
{ return(*(chtype *)0); }
#undef inchnstr
-int (inchnstr)(
+int inchnstr(
chtype *a1,
int z)
{ return(*(int *)0); }
#undef inchstr
-int (inchstr)(
+int inchstr(
chtype *z)
{ return(*(int *)0); }
#undef innstr
-int (innstr)(
+int innstr(
char *a1,
int z)
{ return(*(int *)0); }
#undef insch
-int (insch)(
+int insch(
chtype z)
{ return(*(int *)0); }
#undef insdelln
-int (insdelln)(
+int insdelln(
int z)
{ return(*(int *)0); }
#undef insertln
-int (insertln)(void)
+int insertln(void)
{ return(*(int *)0); }
#undef insnstr
-int (insnstr)(
+int insnstr(
const char *a1,
int z)
{ return(*(int *)0); }
#undef insstr
-int (insstr)(
+int insstr(
const char *z)
{ return(*(int *)0); }
#undef instr
-int (instr)(
+int instr(
char *z)
{ return(*(int *)0); }
#undef move
-int (move)(
+int move(
int a1,
int z)
{ return(*(int *)0); }
#undef mvaddch
-int (mvaddch)(
+int mvaddch(
int a1,
int a2,
const chtype z)
{ return(*(int *)0); }
#undef mvaddchnstr
-int (mvaddchnstr)(
+int mvaddchnstr(
int a1,
int a2,
const chtype *a3,
@@ -698,14 +698,14 @@ int (mvaddchnstr)(
{ return(*(int *)0); }
#undef mvaddchstr
-int (mvaddchstr)(
+int mvaddchstr(
int a1,
int a2,
const chtype *z)
{ return(*(int *)0); }
#undef mvaddnstr
-int (mvaddnstr)(
+int mvaddnstr(
int a1,
int a2,
const char *a3,
@@ -713,14 +713,14 @@ int (mvaddnstr)(
{ return(*(int *)0); }
#undef mvaddstr
-int (mvaddstr)(
+int mvaddstr(
int a1,
int a2,
const char *z)
{ return(*(int *)0); }
#undef mvchgat
-int (mvchgat)(
+int mvchgat(
int a1,
int a2,
int a3,
@@ -730,19 +730,19 @@ int (mvchgat)(
{ return(*(int *)0); }
#undef mvdelch
-int (mvdelch)(
+int mvdelch(
int a1,
int z)
{ return(*(int *)0); }
#undef mvgetch
-int (mvgetch)(
+int mvgetch(
int a1,
int z)
{ return(*(int *)0); }
#undef mvgetnstr
-int (mvgetnstr)(
+int mvgetnstr(
int a1,
int a2,
char *a3,
@@ -750,14 +750,14 @@ int (mvgetnstr)(
{ return(*(int *)0); }
#undef mvgetstr
-int (mvgetstr)(
+int mvgetstr(
int a1,
int a2,
char *z)
{ return(*(int *)0); }
#undef mvhline
-int (mvhline)(
+int mvhline(
int a1,
int a2,
chtype a3,
@@ -765,13 +765,13 @@ int (mvhline)(
{ return(*(int *)0); }
#undef mvinch
-chtype (mvinch)(
+chtype mvinch(
int a1,
int z)
{ return(*(chtype *)0); }
#undef mvinchnstr
-int (mvinchnstr)(
+int mvinchnstr(
int a1,
int a2,
chtype *a3,
@@ -779,14 +779,14 @@ int (mvinchnstr)(
{ return(*(int *)0); }
#undef mvinchstr
-int (mvinchstr)(
+int mvinchstr(
int a1,
int a2,
chtype *z)
{ return(*(int *)0); }
#undef mvinnstr
-int (mvinnstr)(
+int mvinnstr(
int a1,
int a2,
char *a3,
@@ -794,14 +794,14 @@ int (mvinnstr)(
{ return(*(int *)0); }
#undef mvinsch
-int (mvinsch)(
+int mvinsch(
int a1,
int a2,
chtype z)
{ return(*(int *)0); }
#undef mvinsnstr
-int (mvinsnstr)(
+int mvinsnstr(
int a1,
int a2,
const char *a3,
@@ -809,21 +809,21 @@ int (mvinsnstr)(
{ return(*(int *)0); }
#undef mvinsstr
-int (mvinsstr)(
+int mvinsstr(
int a1,
int a2,
const char *z)
{ return(*(int *)0); }
#undef mvinstr
-int (mvinstr)(
+int mvinstr(
int a1,
int a2,
char *z)
{ return(*(int *)0); }
#undef mvvline
-int (mvvline)(
+int mvvline(
int a1,
int a2,
chtype a3,
@@ -831,7 +831,7 @@ int (mvvline)(
{ return(*(int *)0); }
#undef mvwaddch
-int (mvwaddch)(
+int mvwaddch(
WINDOW *a1,
int a2,
int a3,
@@ -839,7 +839,7 @@ int (mvwaddch)(
{ return(*(int *)0); }
#undef mvwaddchnstr
-int (mvwaddchnstr)(
+int mvwaddchnstr(
WINDOW *a1,
int a2,
int a3,
@@ -848,7 +848,7 @@ int (mvwaddchnstr)(
{ return(*(int *)0); }
#undef mvwaddchstr
-int (mvwaddchstr)(
+int mvwaddchstr(
WINDOW *a1,
int a2,
int a3,
@@ -856,7 +856,7 @@ int (mvwaddchstr)(
{ return(*(int *)0); }
#undef mvwaddnstr
-int (mvwaddnstr)(
+int mvwaddnstr(
WINDOW *a1,
int a2,
int a3,
@@ -865,7 +865,7 @@ int (mvwaddnstr)(
{ return(*(int *)0); }
#undef mvwaddstr
-int (mvwaddstr)(
+int mvwaddstr(
WINDOW *a1,
int a2,
int a3,
@@ -873,7 +873,7 @@ int (mvwaddstr)(
{ return(*(int *)0); }
#undef mvwchgat
-int (mvwchgat)(
+int mvwchgat(
WINDOW *a1,
int a2,
int a3,
@@ -884,21 +884,21 @@ int (mvwchgat)(
{ return(*(int *)0); }
#undef mvwdelch
-int (mvwdelch)(
+int mvwdelch(
WINDOW *a1,
int a2,
int z)
{ return(*(int *)0); }
#undef mvwgetch
-int (mvwgetch)(
+int mvwgetch(
WINDOW *a1,
int a2,
int z)
{ return(*(int *)0); }
#undef mvwgetnstr
-int (mvwgetnstr)(
+int mvwgetnstr(
WINDOW *a1,
int a2,
int a3,
@@ -907,7 +907,7 @@ int (mvwgetnstr)(
{ return(*(int *)0); }
#undef mvwgetstr
-int (mvwgetstr)(
+int mvwgetstr(
WINDOW *a1,
int a2,
int a3,
@@ -915,7 +915,7 @@ int (mvwgetstr)(
{ return(*(int *)0); }
#undef mvwhline
-int (mvwhline)(
+int mvwhline(
WINDOW *a1,
int a2,
int a3,
@@ -924,14 +924,14 @@ int (mvwhline)(
{ return(*(int *)0); }
#undef mvwinch
-chtype (mvwinch)(
+chtype mvwinch(
WINDOW *a1,
int a2,
int z)
{ return(*(chtype *)0); }
#undef mvwinchnstr
-int (mvwinchnstr)(
+int mvwinchnstr(
WINDOW *a1,
int a2,
int a3,
@@ -940,7 +940,7 @@ int (mvwinchnstr)(
{ return(*(int *)0); }
#undef mvwinchstr
-int (mvwinchstr)(
+int mvwinchstr(
WINDOW *a1,
int a2,
int a3,
@@ -948,7 +948,7 @@ int (mvwinchstr)(
{ return(*(int *)0); }
#undef mvwinnstr
-int (mvwinnstr)(
+int mvwinnstr(
WINDOW *a1,
int a2,
int a3,
@@ -957,7 +957,7 @@ int (mvwinnstr)(
{ return(*(int *)0); }
#undef mvwinsch
-int (mvwinsch)(
+int mvwinsch(
WINDOW *a1,
int a2,
int a3,
@@ -965,7 +965,7 @@ int (mvwinsch)(
{ return(*(int *)0); }
#undef mvwinsnstr
-int (mvwinsnstr)(
+int mvwinsnstr(
WINDOW *a1,
int a2,
int a3,
@@ -974,7 +974,7 @@ int (mvwinsnstr)(
{ return(*(int *)0); }
#undef mvwinsstr
-int (mvwinsstr)(
+int mvwinsstr(
WINDOW *a1,
int a2,
int a3,
@@ -982,7 +982,7 @@ int (mvwinsstr)(
{ return(*(int *)0); }
#undef mvwinstr
-int (mvwinstr)(
+int mvwinstr(
WINDOW *a1,
int a2,
int a3,
@@ -990,7 +990,7 @@ int (mvwinstr)(
{ return(*(int *)0); }
#undef mvwvline
-int (mvwvline)(
+int mvwvline(
WINDOW *a1,
int a2,
int a3,
@@ -999,103 +999,103 @@ int (mvwvline)(
{ return(*(int *)0); }
#undef PAIR_NUMBER
-int (PAIR_NUMBER)(
+int PAIR_NUMBER(
int z)
{ return(*(int *)0); }
#undef redrawwin
-int (redrawwin)(
+int redrawwin(
WINDOW *z)
{ return(*(int *)0); }
#undef refresh
-int (refresh)(void)
+int refresh(void)
{ return(*(int *)0); }
#undef scrl
-int (scrl)(
+int scrl(
int z)
{ return(*(int *)0); }
#undef scroll
-int (scroll)(
+int scroll(
WINDOW *z)
{ return(*(int *)0); }
#undef setscrreg
-int (setscrreg)(
+int setscrreg(
int a1,
int z)
{ return(*(int *)0); }
#undef standout
-int (standout)(void)
+int standout(void)
{ return(*(int *)0); }
#undef standend
-int (standend)(void)
+int standend(void)
{ return(*(int *)0); }
#undef timeout
-void (timeout)(
+void timeout(
int z)
{ /* void */ }
#undef touchline
-int (touchline)(
+int touchline(
WINDOW *a1,
int a2,
int z)
{ return(*(int *)0); }
#undef touchwin
-int (touchwin)(
+int touchwin(
WINDOW *z)
{ return(*(int *)0); }
#undef untouchwin
-int (untouchwin)(
+int untouchwin(
WINDOW *z)
{ return(*(int *)0); }
#undef vline
-int (vline)(
+int vline(
chtype a1,
int z)
{ return(*(int *)0); }
#undef waddchstr
-int (waddchstr)(
+int waddchstr(
WINDOW *a1,
const chtype *z)
{ return(*(int *)0); }
#undef waddstr
-int (waddstr)(
+int waddstr(
WINDOW *a1,
const char *z)
{ return(*(int *)0); }
#undef wattron
-int (wattron)(
+int wattron(
WINDOW *a1,
int z)
{ return(*(int *)0); }
#undef wattroff
-int (wattroff)(
+int wattroff(
WINDOW *a1,
int z)
{ return(*(int *)0); }
#undef wattrset
-int (wattrset)(
+int wattrset(
WINDOW *a1,
int z)
{ return(*(int *)0); }
#undef wattr_get
-int (wattr_get)(
+int wattr_get(
WINDOW *a1,
attr_t *a2,
short *a3,
@@ -1103,7 +1103,7 @@ int (wattr_get)(
{ return(*(int *)0); }
#undef wattr_set
-int (wattr_set)(
+int wattr_set(
WINDOW *a1,
attr_t a2,
short a3,
@@ -1111,173 +1111,173 @@ int (wattr_set)(
{ return(*(int *)0); }
#undef wdeleteln
-int (wdeleteln)(
+int wdeleteln(
WINDOW *z)
{ return(*(int *)0); }
#undef wgetstr
-int (wgetstr)(
+int wgetstr(
WINDOW *a1,
char *z)
{ return(*(int *)0); }
#undef winchstr
-int (winchstr)(
+int winchstr(
WINDOW *a1,
chtype *z)
{ return(*(int *)0); }
#undef winsertln
-int (winsertln)(
+int winsertln(
WINDOW *z)
{ return(*(int *)0); }
#undef winsstr
-int (winsstr)(
+int winsstr(
WINDOW *a1,
const char *z)
{ return(*(int *)0); }
#undef winstr
-int (winstr)(
+int winstr(
WINDOW *a1,
char *z)
{ return(*(int *)0); }
#undef wstandout
-int (wstandout)(
+int wstandout(
WINDOW *z)
{ return(*(int *)0); }
#undef wstandend
-int (wstandend)(
+int wstandend(
WINDOW *z)
{ return(*(int *)0); }
#undef getattrs
-int (getattrs)(
+int getattrs(
const WINDOW *z)
{ return(*(int *)0); }
#undef getcurx
-int (getcurx)(
+int getcurx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getcury
-int (getcury)(
+int getcury(
const WINDOW *z)
{ return(*(int *)0); }
#undef getbegx
-int (getbegx)(
+int getbegx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getbegy
-int (getbegy)(
+int getbegy(
const WINDOW *z)
{ return(*(int *)0); }
#undef getmaxx
-int (getmaxx)(
+int getmaxx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getmaxy
-int (getmaxy)(
+int getmaxy(
const WINDOW *z)
{ return(*(int *)0); }
#undef getparx
-int (getparx)(
+int getparx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getpary
-int (getpary)(
+int getpary(
const WINDOW *z)
{ return(*(int *)0); }
#undef wgetparent
-WINDOW *(wgetparent)(
+WINDOW *wgetparent(
const WINDOW *z)
{ return(*(WINDOW **)0); }
#undef is_cleared
-NCURSES_BOOL (is_cleared)(
+NCURSES_BOOL is_cleared(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_idcok
-NCURSES_BOOL (is_idcok)(
+NCURSES_BOOL is_idcok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_idlok
-NCURSES_BOOL (is_idlok)(
+NCURSES_BOOL is_idlok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_immedok
-NCURSES_BOOL (is_immedok)(
+NCURSES_BOOL is_immedok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_keypad
-NCURSES_BOOL (is_keypad)(
+NCURSES_BOOL is_keypad(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_leaveok
-NCURSES_BOOL (is_leaveok)(
+NCURSES_BOOL is_leaveok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_nodelay
-NCURSES_BOOL (is_nodelay)(
+NCURSES_BOOL is_nodelay(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_notimeout
-NCURSES_BOOL (is_notimeout)(
+NCURSES_BOOL is_notimeout(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_pad
-NCURSES_BOOL (is_pad)(
+NCURSES_BOOL is_pad(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_scrollok
-NCURSES_BOOL (is_scrollok)(
+NCURSES_BOOL is_scrollok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_subwin
-NCURSES_BOOL (is_subwin)(
+NCURSES_BOOL is_subwin(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_syncok
-NCURSES_BOOL (is_syncok)(
+NCURSES_BOOL is_syncok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef wgetdelay
-int (wgetdelay)(
+int wgetdelay(
const WINDOW *z)
{ return(*(int *)0); }
#undef wgetscrreg
-int (wgetscrreg)(
+int wgetscrreg(
const WINDOW *a1,
int *a2,
int *z)
{ return(*(int *)0); }
#undef mouse_trafo
-NCURSES_BOOL (mouse_trafo)(
+NCURSES_BOOL mouse_trafo(
int *a1,
int *a2,
NCURSES_BOOL z)
@@ -3717,6 +3717,13 @@ char *tiparm(
...)
{ return(*(char **)0); }
+#undef _nc_tiparm
+char *_nc_tiparm(
+ int expected,
+ const char *string,
+ ...)
+ { return(*(char **)0); }
+
/* ./tinfo/lib_tputs.c */
#undef PC
diff --git a/ncurses/llib-lncursestw b/ncurses/llib-lncursestw
index 046313939ede..3c1aab97bc65 100644
--- a/ncurses/llib-lncursestw
+++ b/ncurses/llib-lncursestw
@@ -565,85 +565,85 @@ int flash(void)
/* ./lib_gen.c */
#undef addch
-int (addch)(
+int addch(
const chtype z)
{ return(*(int *)0); }
#undef addchnstr
-int (addchnstr)(
+int addchnstr(
const chtype *a1,
int z)
{ return(*(int *)0); }
#undef addchstr
-int (addchstr)(
+int addchstr(
const chtype *z)
{ return(*(int *)0); }
#undef addnstr
-int (addnstr)(
+int addnstr(
const char *a1,
int z)
{ return(*(int *)0); }
#undef addstr
-int (addstr)(
+int addstr(
const char *z)
{ return(*(int *)0); }
#undef attroff
-int (attroff)(
- NCURSES_ATTR_T z)
+int attroff(
+ int z)
{ return(*(int *)0); }
#undef attron
-int (attron)(
- NCURSES_ATTR_T z)
+int attron(
+ int z)
{ return(*(int *)0); }
#undef attrset
-int (attrset)(
- NCURSES_ATTR_T z)
+int attrset(
+ int z)
{ return(*(int *)0); }
#undef attr_get
-int (attr_get)(
+int attr_get(
attr_t *a1,
short *a2,
void *z)
{ return(*(int *)0); }
#undef attr_off
-int (attr_off)(
+int attr_off(
attr_t a1,
void *z)
{ return(*(int *)0); }
#undef attr_on
-int (attr_on)(
+int attr_on(
attr_t a1,
void *z)
{ return(*(int *)0); }
#undef attr_set
-int (attr_set)(
+int attr_set(
attr_t a1,
short a2,
void *z)
{ return(*(int *)0); }
#undef bkgd
-int (bkgd)(
+int bkgd(
chtype z)
{ return(*(int *)0); }
#undef bkgdset
-void (bkgdset)(
+void bkgdset(
chtype z)
{ /* void */ }
#undef border
-int (border)(
+int border(
chtype a1,
chtype a2,
chtype a3,
@@ -655,14 +655,14 @@ int (border)(
{ return(*(int *)0); }
#undef box
-int (box)(
+int box(
WINDOW *a1,
chtype a2,
chtype z)
{ return(*(int *)0); }
#undef chgat
-int (chgat)(
+int chgat(
int a1,
attr_t a2,
short a3,
@@ -670,137 +670,137 @@ int (chgat)(
{ return(*(int *)0); }
#undef clear
-int (clear)(void)
+int clear(void)
{ return(*(int *)0); }
#undef clrtobot
-int (clrtobot)(void)
+int clrtobot(void)
{ return(*(int *)0); }
#undef clrtoeol
-int (clrtoeol)(void)
+int clrtoeol(void)
{ return(*(int *)0); }
#undef color_set
-int (color_set)(
+int color_set(
short a1,
void *z)
{ return(*(int *)0); }
#undef COLOR_PAIR
-int (COLOR_PAIR)(
+int COLOR_PAIR(
int z)
{ return(*(int *)0); }
#undef delch
-int (delch)(void)
+int delch(void)
{ return(*(int *)0); }
#undef deleteln
-int (deleteln)(void)
+int deleteln(void)
{ return(*(int *)0); }
#undef echochar
-int (echochar)(
+int echochar(
const chtype z)
{ return(*(int *)0); }
#undef erase
-int (erase)(void)
+int erase(void)
{ return(*(int *)0); }
#undef getbkgd
-chtype (getbkgd)(
+chtype getbkgd(
WINDOW *z)
{ return(*(chtype *)0); }
#undef getch
-int (getch)(void)
+int getch(void)
{ return(*(int *)0); }
#undef getnstr
-int (getnstr)(
+int getnstr(
char *a1,
int z)
{ return(*(int *)0); }
#undef getstr
-int (getstr)(
+int getstr(
char *z)
{ return(*(int *)0); }
#undef hline
-int (hline)(
+int hline(
chtype a1,
int z)
{ return(*(int *)0); }
#undef inch
-chtype (inch)(void)
+chtype inch(void)
{ return(*(chtype *)0); }
#undef inchnstr
-int (inchnstr)(
+int inchnstr(
chtype *a1,
int z)
{ return(*(int *)0); }
#undef inchstr
-int (inchstr)(
+int inchstr(
chtype *z)
{ return(*(int *)0); }
#undef innstr
-int (innstr)(
+int innstr(
char *a1,
int z)
{ return(*(int *)0); }
#undef insch
-int (insch)(
+int insch(
chtype z)
{ return(*(int *)0); }
#undef insdelln
-int (insdelln)(
+int insdelln(
int z)
{ return(*(int *)0); }
#undef insertln
-int (insertln)(void)
+int insertln(void)
{ return(*(int *)0); }
#undef insnstr
-int (insnstr)(
+int insnstr(
const char *a1,
int z)
{ return(*(int *)0); }
#undef insstr
-int (insstr)(
+int insstr(
const char *z)
{ return(*(int *)0); }
#undef instr
-int (instr)(
+int instr(
char *z)
{ return(*(int *)0); }
#undef move
-int (move)(
+int move(
int a1,
int z)
{ return(*(int *)0); }
#undef mvaddch
-int (mvaddch)(
+int mvaddch(
int a1,
int a2,
const chtype z)
{ return(*(int *)0); }
#undef mvaddchnstr
-int (mvaddchnstr)(
+int mvaddchnstr(
int a1,
int a2,
const chtype *a3,
@@ -808,14 +808,14 @@ int (mvaddchnstr)(
{ return(*(int *)0); }
#undef mvaddchstr
-int (mvaddchstr)(
+int mvaddchstr(
int a1,
int a2,
const chtype *z)
{ return(*(int *)0); }
#undef mvaddnstr
-int (mvaddnstr)(
+int mvaddnstr(
int a1,
int a2,
const char *a3,
@@ -823,14 +823,14 @@ int (mvaddnstr)(
{ return(*(int *)0); }
#undef mvaddstr
-int (mvaddstr)(
+int mvaddstr(
int a1,
int a2,
const char *z)
{ return(*(int *)0); }
#undef mvchgat
-int (mvchgat)(
+int mvchgat(
int a1,
int a2,
int a3,
@@ -840,19 +840,19 @@ int (mvchgat)(
{ return(*(int *)0); }
#undef mvdelch
-int (mvdelch)(
+int mvdelch(
int a1,
int z)
{ return(*(int *)0); }
#undef mvgetch
-int (mvgetch)(
+int mvgetch(
int a1,
int z)
{ return(*(int *)0); }
#undef mvgetnstr
-int (mvgetnstr)(
+int mvgetnstr(
int a1,
int a2,
char *a3,
@@ -860,14 +860,14 @@ int (mvgetnstr)(
{ return(*(int *)0); }
#undef mvgetstr
-int (mvgetstr)(
+int mvgetstr(
int a1,
int a2,
char *z)
{ return(*(int *)0); }
#undef mvhline
-int (mvhline)(
+int mvhline(
int a1,
int a2,
chtype a3,
@@ -875,13 +875,13 @@ int (mvhline)(
{ return(*(int *)0); }
#undef mvinch
-chtype (mvinch)(
+chtype mvinch(
int a1,
int z)
{ return(*(chtype *)0); }
#undef mvinchnstr
-int (mvinchnstr)(
+int mvinchnstr(
int a1,
int a2,
chtype *a3,
@@ -889,14 +889,14 @@ int (mvinchnstr)(
{ return(*(int *)0); }
#undef mvinchstr
-int (mvinchstr)(
+int mvinchstr(
int a1,
int a2,
chtype *z)
{ return(*(int *)0); }
#undef mvinnstr
-int (mvinnstr)(
+int mvinnstr(
int a1,
int a2,
char *a3,
@@ -904,14 +904,14 @@ int (mvinnstr)(
{ return(*(int *)0); }
#undef mvinsch
-int (mvinsch)(
+int mvinsch(
int a1,
int a2,
chtype z)
{ return(*(int *)0); }
#undef mvinsnstr
-int (mvinsnstr)(
+int mvinsnstr(
int a1,
int a2,
const char *a3,
@@ -919,21 +919,21 @@ int (mvinsnstr)(
{ return(*(int *)0); }
#undef mvinsstr
-int (mvinsstr)(
+int mvinsstr(
int a1,
int a2,
const char *z)
{ return(*(int *)0); }
#undef mvinstr
-int (mvinstr)(
+int mvinstr(
int a1,
int a2,
char *z)
{ return(*(int *)0); }
#undef mvvline
-int (mvvline)(
+int mvvline(
int a1,
int a2,
chtype a3,
@@ -941,7 +941,7 @@ int (mvvline)(
{ return(*(int *)0); }
#undef mvwaddch
-int (mvwaddch)(
+int mvwaddch(
WINDOW *a1,
int a2,
int a3,
@@ -949,7 +949,7 @@ int (mvwaddch)(
{ return(*(int *)0); }
#undef mvwaddchnstr
-int (mvwaddchnstr)(
+int mvwaddchnstr(
WINDOW *a1,
int a2,
int a3,
@@ -958,7 +958,7 @@ int (mvwaddchnstr)(
{ return(*(int *)0); }
#undef mvwaddchstr
-int (mvwaddchstr)(
+int mvwaddchstr(
WINDOW *a1,
int a2,
int a3,
@@ -966,7 +966,7 @@ int (mvwaddchstr)(
{ return(*(int *)0); }
#undef mvwaddnstr
-int (mvwaddnstr)(
+int mvwaddnstr(
WINDOW *a1,
int a2,
int a3,
@@ -975,7 +975,7 @@ int (mvwaddnstr)(
{ return(*(int *)0); }
#undef mvwaddstr
-int (mvwaddstr)(
+int mvwaddstr(
WINDOW *a1,
int a2,
int a3,
@@ -983,7 +983,7 @@ int (mvwaddstr)(
{ return(*(int *)0); }
#undef mvwchgat
-int (mvwchgat)(
+int mvwchgat(
WINDOW *a1,
int a2,
int a3,
@@ -994,21 +994,21 @@ int (mvwchgat)(
{ return(*(int *)0); }
#undef mvwdelch
-int (mvwdelch)(
+int mvwdelch(
WINDOW *a1,
int a2,
int z)
{ return(*(int *)0); }
#undef mvwgetch
-int (mvwgetch)(
+int mvwgetch(
WINDOW *a1,
int a2,
int z)
{ return(*(int *)0); }
#undef mvwgetnstr
-int (mvwgetnstr)(
+int mvwgetnstr(
WINDOW *a1,
int a2,
int a3,
@@ -1017,7 +1017,7 @@ int (mvwgetnstr)(
{ return(*(int *)0); }
#undef mvwgetstr
-int (mvwgetstr)(
+int mvwgetstr(
WINDOW *a1,
int a2,
int a3,
@@ -1025,7 +1025,7 @@ int (mvwgetstr)(
{ return(*(int *)0); }
#undef mvwhline
-int (mvwhline)(
+int mvwhline(
WINDOW *a1,
int a2,
int a3,
@@ -1034,14 +1034,14 @@ int (mvwhline)(
{ return(*(int *)0); }
#undef mvwinch
-chtype (mvwinch)(
+chtype mvwinch(
WINDOW *a1,
int a2,
int z)
{ return(*(chtype *)0); }
#undef mvwinchnstr
-int (mvwinchnstr)(
+int mvwinchnstr(
WINDOW *a1,
int a2,
int a3,
@@ -1050,7 +1050,7 @@ int (mvwinchnstr)(
{ return(*(int *)0); }
#undef mvwinchstr
-int (mvwinchstr)(
+int mvwinchstr(
WINDOW *a1,
int a2,
int a3,
@@ -1058,7 +1058,7 @@ int (mvwinchstr)(
{ return(*(int *)0); }
#undef mvwinnstr
-int (mvwinnstr)(
+int mvwinnstr(
WINDOW *a1,
int a2,
int a3,
@@ -1067,7 +1067,7 @@ int (mvwinnstr)(
{ return(*(int *)0); }
#undef mvwinsch
-int (mvwinsch)(
+int mvwinsch(
WINDOW *a1,
int a2,
int a3,
@@ -1075,7 +1075,7 @@ int (mvwinsch)(
{ return(*(int *)0); }
#undef mvwinsnstr
-int (mvwinsnstr)(
+int mvwinsnstr(
WINDOW *a1,
int a2,
int a3,
@@ -1084,7 +1084,7 @@ int (mvwinsnstr)(
{ return(*(int *)0); }
#undef mvwinsstr
-int (mvwinsstr)(
+int mvwinsstr(
WINDOW *a1,
int a2,
int a3,
@@ -1092,7 +1092,7 @@ int (mvwinsstr)(
{ return(*(int *)0); }
#undef mvwinstr
-int (mvwinstr)(
+int mvwinstr(
WINDOW *a1,
int a2,
int a3,
@@ -1100,7 +1100,7 @@ int (mvwinstr)(
{ return(*(int *)0); }
#undef mvwvline
-int (mvwvline)(
+int mvwvline(
WINDOW *a1,
int a2,
int a3,
@@ -1109,115 +1109,115 @@ int (mvwvline)(
{ return(*(int *)0); }
#undef PAIR_NUMBER
-int (PAIR_NUMBER)(
+int PAIR_NUMBER(
int z)
{ return(*(int *)0); }
#undef redrawwin
-int (redrawwin)(
+int redrawwin(
WINDOW *z)
{ return(*(int *)0); }
#undef refresh
-int (refresh)(void)
+int refresh(void)
{ return(*(int *)0); }
#undef scrl
-int (scrl)(
+int scrl(
int z)
{ return(*(int *)0); }
#undef scroll
-int (scroll)(
+int scroll(
WINDOW *z)
{ return(*(int *)0); }
#undef setscrreg
-int (setscrreg)(
+int setscrreg(
int a1,
int z)
{ return(*(int *)0); }
#undef slk_attr_off
-int (slk_attr_off)(
+int slk_attr_off(
const attr_t a1,
void *z)
{ return(*(int *)0); }
#undef slk_attr_on
-int (slk_attr_on)(
+int slk_attr_on(
attr_t a1,
void *z)
{ return(*(int *)0); }
#undef standout
-int (standout)(void)
+int standout(void)
{ return(*(int *)0); }
#undef standend
-int (standend)(void)
+int standend(void)
{ return(*(int *)0); }
#undef timeout
-void (timeout)(
+void timeout(
int z)
{ /* void */ }
#undef touchline
-int (touchline)(
+int touchline(
WINDOW *a1,
int a2,
int z)
{ return(*(int *)0); }
#undef touchwin
-int (touchwin)(
+int touchwin(
WINDOW *z)
{ return(*(int *)0); }
#undef untouchwin
-int (untouchwin)(
+int untouchwin(
WINDOW *z)
{ return(*(int *)0); }
#undef vline
-int (vline)(
+int vline(
chtype a1,
int z)
{ return(*(int *)0); }
#undef waddchstr
-int (waddchstr)(
+int waddchstr(
WINDOW *a1,
const chtype *z)
{ return(*(int *)0); }
#undef waddstr
-int (waddstr)(
+int waddstr(
WINDOW *a1,
const char *z)
{ return(*(int *)0); }
#undef wattron
-int (wattron)(
+int wattron(
WINDOW *a1,
int z)
{ return(*(int *)0); }
#undef wattroff
-int (wattroff)(
+int wattroff(
WINDOW *a1,
int z)
{ return(*(int *)0); }
#undef wattrset
-int (wattrset)(
+int wattrset(
WINDOW *a1,
int z)
{ return(*(int *)0); }
#undef wattr_get
-int (wattr_get)(
+int wattr_get(
WINDOW *a1,
attr_t *a2,
short *a3,
@@ -1225,7 +1225,7 @@ int (wattr_get)(
{ return(*(int *)0); }
#undef wattr_set
-int (wattr_set)(
+int wattr_set(
WINDOW *a1,
attr_t a2,
short a3,
@@ -1233,210 +1233,210 @@ int (wattr_set)(
{ return(*(int *)0); }
#undef wdeleteln
-int (wdeleteln)(
+int wdeleteln(
WINDOW *z)
{ return(*(int *)0); }
#undef wgetstr
-int (wgetstr)(
+int wgetstr(
WINDOW *a1,
char *z)
{ return(*(int *)0); }
#undef winchstr
-int (winchstr)(
+int winchstr(
WINDOW *a1,
chtype *z)
{ return(*(int *)0); }
#undef winsertln
-int (winsertln)(
+int winsertln(
WINDOW *z)
{ return(*(int *)0); }
#undef winsstr
-int (winsstr)(
+int winsstr(
WINDOW *a1,
const char *z)
{ return(*(int *)0); }
#undef winstr
-int (winstr)(
+int winstr(
WINDOW *a1,
char *z)
{ return(*(int *)0); }
#undef wstandout
-int (wstandout)(
+int wstandout(
WINDOW *z)
{ return(*(int *)0); }
#undef wstandend
-int (wstandend)(
+int wstandend(
WINDOW *z)
{ return(*(int *)0); }
#undef getattrs
-int (getattrs)(
+int getattrs(
const WINDOW *z)
{ return(*(int *)0); }
#undef getcurx
-int (getcurx)(
+int getcurx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getcury
-int (getcury)(
+int getcury(
const WINDOW *z)
{ return(*(int *)0); }
#undef getbegx
-int (getbegx)(
+int getbegx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getbegy
-int (getbegy)(
+int getbegy(
const WINDOW *z)
{ return(*(int *)0); }
#undef getmaxx
-int (getmaxx)(
+int getmaxx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getmaxy
-int (getmaxy)(
+int getmaxy(
const WINDOW *z)
{ return(*(int *)0); }
#undef getparx
-int (getparx)(
+int getparx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getpary
-int (getpary)(
+int getpary(
const WINDOW *z)
{ return(*(int *)0); }
#undef wgetparent
-WINDOW *(wgetparent)(
+WINDOW *wgetparent(
const WINDOW *z)
{ return(*(WINDOW **)0); }
#undef is_cleared
-NCURSES_BOOL (is_cleared)(
+NCURSES_BOOL is_cleared(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_idcok
-NCURSES_BOOL (is_idcok)(
+NCURSES_BOOL is_idcok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_idlok
-NCURSES_BOOL (is_idlok)(
+NCURSES_BOOL is_idlok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_immedok
-NCURSES_BOOL (is_immedok)(
+NCURSES_BOOL is_immedok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_keypad
-NCURSES_BOOL (is_keypad)(
+NCURSES_BOOL is_keypad(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_leaveok
-NCURSES_BOOL (is_leaveok)(
+NCURSES_BOOL is_leaveok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_nodelay
-NCURSES_BOOL (is_nodelay)(
+NCURSES_BOOL is_nodelay(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_notimeout
-NCURSES_BOOL (is_notimeout)(
+NCURSES_BOOL is_notimeout(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_pad
-NCURSES_BOOL (is_pad)(
+NCURSES_BOOL is_pad(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_scrollok
-NCURSES_BOOL (is_scrollok)(
+NCURSES_BOOL is_scrollok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_subwin
-NCURSES_BOOL (is_subwin)(
+NCURSES_BOOL is_subwin(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_syncok
-NCURSES_BOOL (is_syncok)(
+NCURSES_BOOL is_syncok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef wgetdelay
-int (wgetdelay)(
+int wgetdelay(
const WINDOW *z)
{ return(*(int *)0); }
#undef wgetscrreg
-int (wgetscrreg)(
+int wgetscrreg(
const WINDOW *a1,
int *a2,
int *z)
{ return(*(int *)0); }
#undef add_wch
-int (add_wch)(
+int add_wch(
const cchar_t *z)
{ return(*(int *)0); }
#undef add_wchnstr
-int (add_wchnstr)(
+int add_wchnstr(
const cchar_t *a1,
int z)
{ return(*(int *)0); }
#undef add_wchstr
-int (add_wchstr)(
+int add_wchstr(
const cchar_t *z)
{ return(*(int *)0); }
#undef addnwstr
-int (addnwstr)(
+int addnwstr(
const wchar_t *a1,
int z)
{ return(*(int *)0); }
#undef addwstr
-int (addwstr)(
+int addwstr(
const wchar_t *z)
{ return(*(int *)0); }
#undef bkgrnd
-int (bkgrnd)(
+int bkgrnd(
const cchar_t *z)
{ return(*(int *)0); }
#undef bkgrndset
-void (bkgrndset)(
+void bkgrndset(
const cchar_t *z)
{ /* void */ }
#undef border_set
-int (border_set)(
+int border_set(
const cchar_t *a1,
const cchar_t *a2,
const cchar_t *a3,
@@ -1448,96 +1448,96 @@ int (border_set)(
{ return(*(int *)0); }
#undef box_set
-int (box_set)(
+int box_set(
WINDOW *a1,
const cchar_t *a2,
const cchar_t *z)
{ return(*(int *)0); }
#undef echo_wchar
-int (echo_wchar)(
+int echo_wchar(
const cchar_t *z)
{ return(*(int *)0); }
#undef get_wch
-int (get_wch)(
+int get_wch(
wint_t *z)
{ return(*(int *)0); }
#undef get_wstr
-int (get_wstr)(
+int get_wstr(
wint_t *z)
{ return(*(int *)0); }
#undef getbkgrnd
-int (getbkgrnd)(
+int getbkgrnd(
cchar_t *z)
{ return(*(int *)0); }
#undef getn_wstr
-int (getn_wstr)(
+int getn_wstr(
wint_t *a1,
int z)
{ return(*(int *)0); }
#undef hline_set
-int (hline_set)(
+int hline_set(
const cchar_t *a1,
int z)
{ return(*(int *)0); }
#undef in_wch
-int (in_wch)(
+int in_wch(
cchar_t *z)
{ return(*(int *)0); }
#undef in_wchnstr
-int (in_wchnstr)(
+int in_wchnstr(
cchar_t *a1,
int z)
{ return(*(int *)0); }
#undef in_wchstr
-int (in_wchstr)(
+int in_wchstr(
cchar_t *z)
{ return(*(int *)0); }
#undef innwstr
-int (innwstr)(
+int innwstr(
wchar_t *a1,
int z)
{ return(*(int *)0); }
#undef ins_nwstr
-int (ins_nwstr)(
+int ins_nwstr(
const wchar_t *a1,
int z)
{ return(*(int *)0); }
#undef ins_wch
-int (ins_wch)(
+int ins_wch(
const cchar_t *z)
{ return(*(int *)0); }
#undef ins_wstr
-int (ins_wstr)(
+int ins_wstr(
const wchar_t *z)
{ return(*(int *)0); }
#undef inwstr
-int (inwstr)(
+int inwstr(
wchar_t *z)
{ return(*(int *)0); }
#undef mvadd_wch
-int (mvadd_wch)(
+int mvadd_wch(
int a1,
int a2,
const cchar_t *z)
{ return(*(int *)0); }
#undef mvadd_wchnstr
-int (mvadd_wchnstr)(
+int mvadd_wchnstr(
int a1,
int a2,
const cchar_t *a3,
@@ -1545,14 +1545,14 @@ int (mvadd_wchnstr)(
{ return(*(int *)0); }
#undef mvadd_wchstr
-int (mvadd_wchstr)(
+int mvadd_wchstr(
int a1,
int a2,
const cchar_t *z)
{ return(*(int *)0); }
#undef mvaddnwstr
-int (mvaddnwstr)(
+int mvaddnwstr(
int a1,
int a2,
const wchar_t *a3,
@@ -1560,28 +1560,28 @@ int (mvaddnwstr)(
{ return(*(int *)0); }
#undef mvaddwstr
-int (mvaddwstr)(
+int mvaddwstr(
int a1,
int a2,
const wchar_t *z)
{ return(*(int *)0); }
#undef mvget_wch
-int (mvget_wch)(
+int mvget_wch(
int a1,
int a2,
wint_t *z)
{ return(*(int *)0); }
#undef mvget_wstr
-int (mvget_wstr)(
+int mvget_wstr(
int a1,
int a2,
wint_t *z)
{ return(*(int *)0); }
#undef mvgetn_wstr
-int (mvgetn_wstr)(
+int mvgetn_wstr(
int a1,
int a2,
wint_t *a3,
@@ -1589,7 +1589,7 @@ int (mvgetn_wstr)(
{ return(*(int *)0); }
#undef mvhline_set
-int (mvhline_set)(
+int mvhline_set(
int a1,
int a2,
const cchar_t *a3,
@@ -1597,14 +1597,14 @@ int (mvhline_set)(
{ return(*(int *)0); }
#undef mvin_wch
-int (mvin_wch)(
+int mvin_wch(
int a1,
int a2,
cchar_t *z)
{ return(*(int *)0); }
#undef mvin_wchnstr
-int (mvin_wchnstr)(
+int mvin_wchnstr(
int a1,
int a2,
cchar_t *a3,
@@ -1612,14 +1612,14 @@ int (mvin_wchnstr)(
{ return(*(int *)0); }
#undef mvin_wchstr
-int (mvin_wchstr)(
+int mvin_wchstr(
int a1,
int a2,
cchar_t *z)
{ return(*(int *)0); }
#undef mvinnwstr
-int (mvinnwstr)(
+int mvinnwstr(
int a1,
int a2,
wchar_t *a3,
@@ -1627,7 +1627,7 @@ int (mvinnwstr)(
{ return(*(int *)0); }
#undef mvins_nwstr
-int (mvins_nwstr)(
+int mvins_nwstr(
int a1,
int a2,
const wchar_t *a3,
@@ -1635,28 +1635,28 @@ int (mvins_nwstr)(
{ return(*(int *)0); }
#undef mvins_wch
-int (mvins_wch)(
+int mvins_wch(
int a1,
int a2,
const cchar_t *z)
{ return(*(int *)0); }
#undef mvins_wstr
-int (mvins_wstr)(
+int mvins_wstr(
int a1,
int a2,
const wchar_t *z)
{ return(*(int *)0); }
#undef mvinwstr
-int (mvinwstr)(
+int mvinwstr(
int a1,
int a2,
wchar_t *z)
{ return(*(int *)0); }
#undef mvvline_set
-int (mvvline_set)(
+int mvvline_set(
int a1,
int a2,
const cchar_t *a3,
@@ -1664,7 +1664,7 @@ int (mvvline_set)(
{ return(*(int *)0); }
#undef mvwadd_wch
-int (mvwadd_wch)(
+int mvwadd_wch(
WINDOW *a1,
int a2,
int a3,
@@ -1672,7 +1672,7 @@ int (mvwadd_wch)(
{ return(*(int *)0); }
#undef mvwadd_wchnstr
-int (mvwadd_wchnstr)(
+int mvwadd_wchnstr(
WINDOW *a1,
int a2,
int a3,
@@ -1681,7 +1681,7 @@ int (mvwadd_wchnstr)(
{ return(*(int *)0); }
#undef mvwadd_wchstr
-int (mvwadd_wchstr)(
+int mvwadd_wchstr(
WINDOW *a1,
int a2,
int a3,
@@ -1689,7 +1689,7 @@ int (mvwadd_wchstr)(
{ return(*(int *)0); }
#undef mvwaddnwstr
-int (mvwaddnwstr)(
+int mvwaddnwstr(
WINDOW *a1,
int a2,
int a3,
@@ -1698,7 +1698,7 @@ int (mvwaddnwstr)(
{ return(*(int *)0); }
#undef mvwaddwstr
-int (mvwaddwstr)(
+int mvwaddwstr(
WINDOW *a1,
int a2,
int a3,
@@ -1706,7 +1706,7 @@ int (mvwaddwstr)(
{ return(*(int *)0); }
#undef mvwget_wch
-int (mvwget_wch)(
+int mvwget_wch(
WINDOW *a1,
int a2,
int a3,
@@ -1714,7 +1714,7 @@ int (mvwget_wch)(
{ return(*(int *)0); }
#undef mvwget_wstr
-int (mvwget_wstr)(
+int mvwget_wstr(
WINDOW *a1,
int a2,
int a3,
@@ -1722,7 +1722,7 @@ int (mvwget_wstr)(
{ return(*(int *)0); }
#undef mvwgetn_wstr
-int (mvwgetn_wstr)(
+int mvwgetn_wstr(
WINDOW *a1,
int a2,
int a3,
@@ -1731,7 +1731,7 @@ int (mvwgetn_wstr)(
{ return(*(int *)0); }
#undef mvwhline_set
-int (mvwhline_set)(
+int mvwhline_set(
WINDOW *a1,
int a2,
int a3,
@@ -1740,7 +1740,7 @@ int (mvwhline_set)(
{ return(*(int *)0); }
#undef mvwin_wch
-int (mvwin_wch)(
+int mvwin_wch(
WINDOW *a1,
int a2,
int a3,
@@ -1748,7 +1748,7 @@ int (mvwin_wch)(
{ return(*(int *)0); }
#undef mvwin_wchnstr
-int (mvwin_wchnstr)(
+int mvwin_wchnstr(
WINDOW *a1,
int a2,
int a3,
@@ -1757,7 +1757,7 @@ int (mvwin_wchnstr)(
{ return(*(int *)0); }
#undef mvwin_wchstr
-int (mvwin_wchstr)(
+int mvwin_wchstr(
WINDOW *a1,
int a2,
int a3,
@@ -1765,7 +1765,7 @@ int (mvwin_wchstr)(
{ return(*(int *)0); }
#undef mvwinnwstr
-int (mvwinnwstr)(
+int mvwinnwstr(
WINDOW *a1,
int a2,
int a3,
@@ -1774,7 +1774,7 @@ int (mvwinnwstr)(
{ return(*(int *)0); }
#undef mvwins_nwstr
-int (mvwins_nwstr)(
+int mvwins_nwstr(
WINDOW *a1,
int a2,
int a3,
@@ -1783,7 +1783,7 @@ int (mvwins_nwstr)(
{ return(*(int *)0); }
#undef mvwins_wch
-int (mvwins_wch)(
+int mvwins_wch(
WINDOW *a1,
int a2,
int a3,
@@ -1791,7 +1791,7 @@ int (mvwins_wch)(
{ return(*(int *)0); }
#undef mvwins_wstr
-int (mvwins_wstr)(
+int mvwins_wstr(
WINDOW *a1,
int a2,
int a3,
@@ -1799,7 +1799,7 @@ int (mvwins_wstr)(
{ return(*(int *)0); }
#undef mvwinwstr
-int (mvwinwstr)(
+int mvwinwstr(
WINDOW *a1,
int a2,
int a3,
@@ -1807,7 +1807,7 @@ int (mvwinwstr)(
{ return(*(int *)0); }
#undef mvwvline_set
-int (mvwvline_set)(
+int mvwvline_set(
WINDOW *a1,
int a2,
int a3,
@@ -1816,49 +1816,49 @@ int (mvwvline_set)(
{ return(*(int *)0); }
#undef vline_set
-int (vline_set)(
+int vline_set(
const cchar_t *a1,
int z)
{ return(*(int *)0); }
#undef wadd_wchstr
-int (wadd_wchstr)(
+int wadd_wchstr(
WINDOW *a1,
const cchar_t *z)
{ return(*(int *)0); }
#undef waddwstr
-int (waddwstr)(
+int waddwstr(
WINDOW *a1,
const wchar_t *z)
{ return(*(int *)0); }
#undef wget_wstr
-int (wget_wstr)(
+int wget_wstr(
WINDOW *a1,
wint_t *z)
{ return(*(int *)0); }
#undef wgetbkgrnd
-int (wgetbkgrnd)(
+int wgetbkgrnd(
WINDOW *a1,
cchar_t *z)
{ return(*(int *)0); }
#undef win_wchstr
-int (win_wchstr)(
+int win_wchstr(
WINDOW *a1,
cchar_t *z)
{ return(*(int *)0); }
#undef wins_wstr
-int (wins_wstr)(
+int wins_wstr(
WINDOW *a1,
const wchar_t *z)
{ return(*(int *)0); }
#undef mouse_trafo
-NCURSES_BOOL (mouse_trafo)(
+NCURSES_BOOL mouse_trafo(
int *a1,
int *a2,
NCURSES_BOOL z)
@@ -4666,6 +4666,13 @@ char *tiparm(
...)
{ return(*(char **)0); }
+#undef _nc_tiparm
+char *_nc_tiparm(
+ int expected,
+ const char *string,
+ ...)
+ { return(*(char **)0); }
+
/* ./tinfo/lib_tputs.c */
#undef PC
diff --git a/ncurses/llib-lncursesw b/ncurses/llib-lncursesw
index dd084a44cf17..794d4929254a 100644
--- a/ncurses/llib-lncursesw
+++ b/ncurses/llib-lncursesw
@@ -562,85 +562,85 @@ int flash(void)
/* ./lib_gen.c */
#undef addch
-int (addch)(
+int addch(
const chtype z)
{ return(*(int *)0); }
#undef addchnstr
-int (addchnstr)(
+int addchnstr(
const chtype *a1,
int z)
{ return(*(int *)0); }
#undef addchstr
-int (addchstr)(
+int addchstr(
const chtype *z)
{ return(*(int *)0); }
#undef addnstr
-int (addnstr)(
+int addnstr(
const char *a1,
int z)
{ return(*(int *)0); }
#undef addstr
-int (addstr)(
+int addstr(
const char *z)
{ return(*(int *)0); }
#undef attroff
-int (attroff)(
- NCURSES_ATTR_T z)
+int attroff(
+ int z)
{ return(*(int *)0); }
#undef attron
-int (attron)(
- NCURSES_ATTR_T z)
+int attron(
+ int z)
{ return(*(int *)0); }
#undef attrset
-int (attrset)(
- NCURSES_ATTR_T z)
+int attrset(
+ int z)
{ return(*(int *)0); }
#undef attr_get
-int (attr_get)(
+int attr_get(
attr_t *a1,
short *a2,
void *z)
{ return(*(int *)0); }
#undef attr_off
-int (attr_off)(
+int attr_off(
attr_t a1,
void *z)
{ return(*(int *)0); }
#undef attr_on
-int (attr_on)(
+int attr_on(
attr_t a1,
void *z)
{ return(*(int *)0); }
#undef attr_set
-int (attr_set)(
+int attr_set(
attr_t a1,
short a2,
void *z)
{ return(*(int *)0); }
#undef bkgd
-int (bkgd)(
+int bkgd(
chtype z)
{ return(*(int *)0); }
#undef bkgdset
-void (bkgdset)(
+void bkgdset(
chtype z)
{ /* void */ }
#undef border
-int (border)(
+int border(
chtype a1,
chtype a2,
chtype a3,
@@ -652,14 +652,14 @@ int (border)(
{ return(*(int *)0); }
#undef box
-int (box)(
+int box(
WINDOW *a1,
chtype a2,
chtype z)
{ return(*(int *)0); }
#undef chgat
-int (chgat)(
+int chgat(
int a1,
attr_t a2,
short a3,
@@ -667,137 +667,137 @@ int (chgat)(
{ return(*(int *)0); }
#undef clear
-int (clear)(void)
+int clear(void)
{ return(*(int *)0); }
#undef clrtobot
-int (clrtobot)(void)
+int clrtobot(void)
{ return(*(int *)0); }
#undef clrtoeol
-int (clrtoeol)(void)
+int clrtoeol(void)
{ return(*(int *)0); }
#undef color_set
-int (color_set)(
+int color_set(
short a1,
void *z)
{ return(*(int *)0); }
#undef COLOR_PAIR
-int (COLOR_PAIR)(
+int COLOR_PAIR(
int z)
{ return(*(int *)0); }
#undef delch
-int (delch)(void)
+int delch(void)
{ return(*(int *)0); }
#undef deleteln
-int (deleteln)(void)
+int deleteln(void)
{ return(*(int *)0); }
#undef echochar
-int (echochar)(
+int echochar(
const chtype z)
{ return(*(int *)0); }
#undef erase
-int (erase)(void)
+int erase(void)
{ return(*(int *)0); }
#undef getbkgd
-chtype (getbkgd)(
+chtype getbkgd(
WINDOW *z)
{ return(*(chtype *)0); }
#undef getch
-int (getch)(void)
+int getch(void)
{ return(*(int *)0); }
#undef getnstr
-int (getnstr)(
+int getnstr(
char *a1,
int z)
{ return(*(int *)0); }
#undef getstr
-int (getstr)(
+int getstr(
char *z)
{ return(*(int *)0); }
#undef hline
-int (hline)(
+int hline(
chtype a1,
int z)
{ return(*(int *)0); }
#undef inch
-chtype (inch)(void)
+chtype inch(void)
{ return(*(chtype *)0); }
#undef inchnstr
-int (inchnstr)(
+int inchnstr(
chtype *a1,
int z)
{ return(*(int *)0); }
#undef inchstr
-int (inchstr)(
+int inchstr(
chtype *z)
{ return(*(int *)0); }
#undef innstr
-int (innstr)(
+int innstr(
char *a1,
int z)
{ return(*(int *)0); }
#undef insch
-int (insch)(
+int insch(
chtype z)
{ return(*(int *)0); }
#undef insdelln
-int (insdelln)(
+int insdelln(
int z)
{ return(*(int *)0); }
#undef insertln
-int (insertln)(void)
+int insertln(void)
{ return(*(int *)0); }
#undef insnstr
-int (insnstr)(
+int insnstr(
const char *a1,
int z)
{ return(*(int *)0); }
#undef insstr
-int (insstr)(
+int insstr(
const char *z)
{ return(*(int *)0); }
#undef instr
-int (instr)(
+int instr(
char *z)
{ return(*(int *)0); }
#undef move
-int (move)(
+int move(
int a1,
int z)
{ return(*(int *)0); }
#undef mvaddch
-int (mvaddch)(
+int mvaddch(
int a1,
int a2,
const chtype z)
{ return(*(int *)0); }
#undef mvaddchnstr
-int (mvaddchnstr)(
+int mvaddchnstr(
int a1,
int a2,
const chtype *a3,
@@ -805,14 +805,14 @@ int (mvaddchnstr)(
{ return(*(int *)0); }
#undef mvaddchstr
-int (mvaddchstr)(
+int mvaddchstr(
int a1,
int a2,
const chtype *z)
{ return(*(int *)0); }
#undef mvaddnstr
-int (mvaddnstr)(
+int mvaddnstr(
int a1,
int a2,
const char *a3,
@@ -820,14 +820,14 @@ int (mvaddnstr)(
{ return(*(int *)0); }
#undef mvaddstr
-int (mvaddstr)(
+int mvaddstr(
int a1,
int a2,
const char *z)
{ return(*(int *)0); }
#undef mvchgat
-int (mvchgat)(
+int mvchgat(
int a1,
int a2,
int a3,
@@ -837,19 +837,19 @@ int (mvchgat)(
{ return(*(int *)0); }
#undef mvdelch
-int (mvdelch)(
+int mvdelch(
int a1,
int z)
{ return(*(int *)0); }
#undef mvgetch
-int (mvgetch)(
+int mvgetch(
int a1,
int z)
{ return(*(int *)0); }
#undef mvgetnstr
-int (mvgetnstr)(
+int mvgetnstr(
int a1,
int a2,
char *a3,
@@ -857,14 +857,14 @@ int (mvgetnstr)(
{ return(*(int *)0); }
#undef mvgetstr
-int (mvgetstr)(
+int mvgetstr(
int a1,
int a2,
char *z)
{ return(*(int *)0); }
#undef mvhline
-int (mvhline)(
+int mvhline(
int a1,
int a2,
chtype a3,
@@ -872,13 +872,13 @@ int (mvhline)(
{ return(*(int *)0); }
#undef mvinch
-chtype (mvinch)(
+chtype mvinch(
int a1,
int z)
{ return(*(chtype *)0); }
#undef mvinchnstr
-int (mvinchnstr)(
+int mvinchnstr(
int a1,
int a2,
chtype *a3,
@@ -886,14 +886,14 @@ int (mvinchnstr)(
{ return(*(int *)0); }
#undef mvinchstr
-int (mvinchstr)(
+int mvinchstr(
int a1,
int a2,
chtype *z)
{ return(*(int *)0); }
#undef mvinnstr
-int (mvinnstr)(
+int mvinnstr(
int a1,
int a2,
char *a3,
@@ -901,14 +901,14 @@ int (mvinnstr)(
{ return(*(int *)0); }
#undef mvinsch
-int (mvinsch)(
+int mvinsch(
int a1,
int a2,
chtype z)
{ return(*(int *)0); }
#undef mvinsnstr
-int (mvinsnstr)(
+int mvinsnstr(
int a1,
int a2,
const char *a3,
@@ -916,21 +916,21 @@ int (mvinsnstr)(
{ return(*(int *)0); }
#undef mvinsstr
-int (mvinsstr)(
+int mvinsstr(
int a1,
int a2,
const char *z)
{ return(*(int *)0); }
#undef mvinstr
-int (mvinstr)(
+int mvinstr(
int a1,
int a2,
char *z)
{ return(*(int *)0); }
#undef mvvline
-int (mvvline)(
+int mvvline(
int a1,
int a2,
chtype a3,
@@ -938,7 +938,7 @@ int (mvvline)(
{ return(*(int *)0); }
#undef mvwaddch
-int (mvwaddch)(
+int mvwaddch(
WINDOW *a1,
int a2,
int a3,
@@ -946,7 +946,7 @@ int (mvwaddch)(
{ return(*(int *)0); }
#undef mvwaddchnstr
-int (mvwaddchnstr)(
+int mvwaddchnstr(
WINDOW *a1,
int a2,
int a3,
@@ -955,7 +955,7 @@ int (mvwaddchnstr)(
{ return(*(int *)0); }
#undef mvwaddchstr
-int (mvwaddchstr)(
+int mvwaddchstr(
WINDOW *a1,
int a2,
int a3,
@@ -963,7 +963,7 @@ int (mvwaddchstr)(
{ return(*(int *)0); }
#undef mvwaddnstr
-int (mvwaddnstr)(
+int mvwaddnstr(
WINDOW *a1,
int a2,
int a3,
@@ -972,7 +972,7 @@ int (mvwaddnstr)(
{ return(*(int *)0); }
#undef mvwaddstr
-int (mvwaddstr)(
+int mvwaddstr(
WINDOW *a1,
int a2,
int a3,
@@ -980,7 +980,7 @@ int (mvwaddstr)(
{ return(*(int *)0); }
#undef mvwchgat
-int (mvwchgat)(
+int mvwchgat(
WINDOW *a1,
int a2,
int a3,
@@ -991,21 +991,21 @@ int (mvwchgat)(
{ return(*(int *)0); }
#undef mvwdelch
-int (mvwdelch)(
+int mvwdelch(
WINDOW *a1,
int a2,
int z)
{ return(*(int *)0); }
#undef mvwgetch
-int (mvwgetch)(
+int mvwgetch(
WINDOW *a1,
int a2,
int z)
{ return(*(int *)0); }
#undef mvwgetnstr
-int (mvwgetnstr)(
+int mvwgetnstr(
WINDOW *a1,
int a2,
int a3,
@@ -1014,7 +1014,7 @@ int (mvwgetnstr)(
{ return(*(int *)0); }
#undef mvwgetstr
-int (mvwgetstr)(
+int mvwgetstr(
WINDOW *a1,
int a2,
int a3,
@@ -1022,7 +1022,7 @@ int (mvwgetstr)(
{ return(*(int *)0); }
#undef mvwhline
-int (mvwhline)(
+int mvwhline(
WINDOW *a1,
int a2,
int a3,
@@ -1031,14 +1031,14 @@ int (mvwhline)(
{ return(*(int *)0); }
#undef mvwinch
-chtype (mvwinch)(
+chtype mvwinch(
WINDOW *a1,
int a2,
int z)
{ return(*(chtype *)0); }
#undef mvwinchnstr
-int (mvwinchnstr)(
+int mvwinchnstr(
WINDOW *a1,
int a2,
int a3,
@@ -1047,7 +1047,7 @@ int (mvwinchnstr)(
{ return(*(int *)0); }
#undef mvwinchstr
-int (mvwinchstr)(
+int mvwinchstr(
WINDOW *a1,
int a2,
int a3,
@@ -1055,7 +1055,7 @@ int (mvwinchstr)(
{ return(*(int *)0); }
#undef mvwinnstr
-int (mvwinnstr)(
+int mvwinnstr(
WINDOW *a1,
int a2,
int a3,
@@ -1064,7 +1064,7 @@ int (mvwinnstr)(
{ return(*(int *)0); }
#undef mvwinsch
-int (mvwinsch)(
+int mvwinsch(
WINDOW *a1,
int a2,
int a3,
@@ -1072,7 +1072,7 @@ int (mvwinsch)(
{ return(*(int *)0); }
#undef mvwinsnstr
-int (mvwinsnstr)(
+int mvwinsnstr(
WINDOW *a1,
int a2,
int a3,
@@ -1081,7 +1081,7 @@ int (mvwinsnstr)(
{ return(*(int *)0); }
#undef mvwinsstr
-int (mvwinsstr)(
+int mvwinsstr(
WINDOW *a1,
int a2,
int a3,
@@ -1089,7 +1089,7 @@ int (mvwinsstr)(
{ return(*(int *)0); }
#undef mvwinstr
-int (mvwinstr)(
+int mvwinstr(
WINDOW *a1,
int a2,
int a3,
@@ -1097,7 +1097,7 @@ int (mvwinstr)(
{ return(*(int *)0); }
#undef mvwvline
-int (mvwvline)(
+int mvwvline(
WINDOW *a1,
int a2,
int a3,
@@ -1106,115 +1106,115 @@ int (mvwvline)(
{ return(*(int *)0); }
#undef PAIR_NUMBER
-int (PAIR_NUMBER)(
+int PAIR_NUMBER(
int z)
{ return(*(int *)0); }
#undef redrawwin
-int (redrawwin)(
+int redrawwin(
WINDOW *z)
{ return(*(int *)0); }
#undef refresh
-int (refresh)(void)
+int refresh(void)
{ return(*(int *)0); }
#undef scrl
-int (scrl)(
+int scrl(
int z)
{ return(*(int *)0); }
#undef scroll
-int (scroll)(
+int scroll(
WINDOW *z)
{ return(*(int *)0); }
#undef setscrreg
-int (setscrreg)(
+int setscrreg(
int a1,
int z)
{ return(*(int *)0); }
#undef slk_attr_off
-int (slk_attr_off)(
+int slk_attr_off(
const attr_t a1,
void *z)
{ return(*(int *)0); }
#undef slk_attr_on
-int (slk_attr_on)(
+int slk_attr_on(
attr_t a1,
void *z)
{ return(*(int *)0); }
#undef standout
-int (standout)(void)
+int standout(void)
{ return(*(int *)0); }
#undef standend
-int (standend)(void)
+int standend(void)
{ return(*(int *)0); }
#undef timeout
-void (timeout)(
+void timeout(
int z)
{ /* void */ }
#undef touchline
-int (touchline)(
+int touchline(
WINDOW *a1,
int a2,
int z)
{ return(*(int *)0); }
#undef touchwin
-int (touchwin)(
+int touchwin(
WINDOW *z)
{ return(*(int *)0); }
#undef untouchwin
-int (untouchwin)(
+int untouchwin(
WINDOW *z)
{ return(*(int *)0); }
#undef vline
-int (vline)(
+int vline(
chtype a1,
int z)
{ return(*(int *)0); }
#undef waddchstr
-int (waddchstr)(
+int waddchstr(
WINDOW *a1,
const chtype *z)
{ return(*(int *)0); }
#undef waddstr
-int (waddstr)(
+int waddstr(
WINDOW *a1,
const char *z)
{ return(*(int *)0); }
#undef wattron
-int (wattron)(
+int wattron(
WINDOW *a1,
int z)
{ return(*(int *)0); }
#undef wattroff
-int (wattroff)(
+int wattroff(
WINDOW *a1,
int z)
{ return(*(int *)0); }
#undef wattrset
-int (wattrset)(
+int wattrset(
WINDOW *a1,
int z)
{ return(*(int *)0); }
#undef wattr_get
-int (wattr_get)(
+int wattr_get(
WINDOW *a1,
attr_t *a2,
short *a3,
@@ -1222,7 +1222,7 @@ int (wattr_get)(
{ return(*(int *)0); }
#undef wattr_set
-int (wattr_set)(
+int wattr_set(
WINDOW *a1,
attr_t a2,
short a3,
@@ -1230,210 +1230,210 @@ int (wattr_set)(
{ return(*(int *)0); }
#undef wdeleteln
-int (wdeleteln)(
+int wdeleteln(
WINDOW *z)
{ return(*(int *)0); }
#undef wgetstr
-int (wgetstr)(
+int wgetstr(
WINDOW *a1,
char *z)
{ return(*(int *)0); }
#undef winchstr
-int (winchstr)(
+int winchstr(
WINDOW *a1,
chtype *z)
{ return(*(int *)0); }
#undef winsertln
-int (winsertln)(
+int winsertln(
WINDOW *z)
{ return(*(int *)0); }
#undef winsstr
-int (winsstr)(
+int winsstr(
WINDOW *a1,
const char *z)
{ return(*(int *)0); }
#undef winstr
-int (winstr)(
+int winstr(
WINDOW *a1,
char *z)
{ return(*(int *)0); }
#undef wstandout
-int (wstandout)(
+int wstandout(
WINDOW *z)
{ return(*(int *)0); }
#undef wstandend
-int (wstandend)(
+int wstandend(
WINDOW *z)
{ return(*(int *)0); }
#undef getattrs
-int (getattrs)(
+int getattrs(
const WINDOW *z)
{ return(*(int *)0); }
#undef getcurx
-int (getcurx)(
+int getcurx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getcury
-int (getcury)(
+int getcury(
const WINDOW *z)
{ return(*(int *)0); }
#undef getbegx
-int (getbegx)(
+int getbegx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getbegy
-int (getbegy)(
+int getbegy(
const WINDOW *z)
{ return(*(int *)0); }
#undef getmaxx
-int (getmaxx)(
+int getmaxx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getmaxy
-int (getmaxy)(
+int getmaxy(
const WINDOW *z)
{ return(*(int *)0); }
#undef getparx
-int (getparx)(
+int getparx(
const WINDOW *z)
{ return(*(int *)0); }
#undef getpary
-int (getpary)(
+int getpary(
const WINDOW *z)
{ return(*(int *)0); }
#undef wgetparent
-WINDOW *(wgetparent)(
+WINDOW *wgetparent(
const WINDOW *z)
{ return(*(WINDOW **)0); }
#undef is_cleared
-NCURSES_BOOL (is_cleared)(
+NCURSES_BOOL is_cleared(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_idcok
-NCURSES_BOOL (is_idcok)(
+NCURSES_BOOL is_idcok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_idlok
-NCURSES_BOOL (is_idlok)(
+NCURSES_BOOL is_idlok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_immedok
-NCURSES_BOOL (is_immedok)(
+NCURSES_BOOL is_immedok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_keypad
-NCURSES_BOOL (is_keypad)(
+NCURSES_BOOL is_keypad(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_leaveok
-NCURSES_BOOL (is_leaveok)(
+NCURSES_BOOL is_leaveok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_nodelay
-NCURSES_BOOL (is_nodelay)(
+NCURSES_BOOL is_nodelay(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_notimeout
-NCURSES_BOOL (is_notimeout)(
+NCURSES_BOOL is_notimeout(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_pad
-NCURSES_BOOL (is_pad)(
+NCURSES_BOOL is_pad(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_scrollok
-NCURSES_BOOL (is_scrollok)(
+NCURSES_BOOL is_scrollok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_subwin
-NCURSES_BOOL (is_subwin)(
+NCURSES_BOOL is_subwin(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef is_syncok
-NCURSES_BOOL (is_syncok)(
+NCURSES_BOOL is_syncok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
#undef wgetdelay
-int (wgetdelay)(
+int wgetdelay(
const WINDOW *z)
{ return(*(int *)0); }
#undef wgetscrreg
-int (wgetscrreg)(
+int wgetscrreg(
const WINDOW *a1,
int *a2,
int *z)
{ return(*(int *)0); }
#undef add_wch
-int (add_wch)(
+int add_wch(
const cchar_t *z)
{ return(*(int *)0); }
#undef add_wchnstr
-int (add_wchnstr)(
+int add_wchnstr(
const cchar_t *a1,
int z)
{ return(*(int *)0); }
#undef add_wchstr
-int (add_wchstr)(
+int add_wchstr(
const cchar_t *z)
{ return(*(int *)0); }
#undef addnwstr
-int (addnwstr)(
+int addnwstr(
const wchar_t *a1,
int z)
{ return(*(int *)0); }
#undef addwstr
-int (addwstr)(
+int addwstr(
const wchar_t *z)
{ return(*(int *)0); }
#undef bkgrnd
-int (bkgrnd)(
+int bkgrnd(
const cchar_t *z)
{ return(*(int *)0); }
#undef bkgrndset
-void (bkgrndset)(
+void bkgrndset(
const cchar_t *z)
{ /* void */ }
#undef border_set
-int (border_set)(
+int border_set(
const cchar_t *a1,
const cchar_t *a2,
const cchar_t *a3,
@@ -1445,96 +1445,96 @@ int (border_set)(
{ return(*(int *)0); }
#undef box_set
-int (box_set)(
+int box_set(
WINDOW *a1,
const cchar_t *a2,
const cchar_t *z)
{ return(*(int *)0); }
#undef echo_wchar
-int (echo_wchar)(
+int echo_wchar(
const cchar_t *z)
{ return(*(int *)0); }
#undef get_wch
-int (get_wch)(
+int get_wch(
wint_t *z)
{ return(*(int *)0); }
#undef get_wstr
-int (get_wstr)(
+int get_wstr(
wint_t *z)
{ return(*(int *)0); }
#undef getbkgrnd
-int (getbkgrnd)(
+int getbkgrnd(
cchar_t *z)
{ return(*(int *)0); }
#undef getn_wstr
-int (getn_wstr)(
+int getn_wstr(
wint_t *a1,
int z)
{ return(*(int *)0); }
#undef hline_set
-int (hline_set)(
+int hline_set(
const cchar_t *a1,
int z)
{ return(*(int *)0); }
#undef in_wch
-int (in_wch)(
+int in_wch(
cchar_t *z)
{ return(*(int *)0); }
#undef in_wchnstr
-int (in_wchnstr)(
+int in_wchnstr(
cchar_t *a1,
int z)
{ return(*(int *)0); }
#undef in_wchstr
-int (in_wchstr)(
+int in_wchstr(
cchar_t *z)
{ return(*(int *)0); }
#undef innwstr
-int (innwstr)(
+int innwstr(
wchar_t *a1,
int z)
{ return(*(int *)0); }
#undef ins_nwstr
-int (ins_nwstr)(
+int ins_nwstr(
const wchar_t *a1,
int z)
{ return(*(int *)0); }
#undef ins_wch
-int (ins_wch)(
+int ins_wch(
const cchar_t *z)
{ return(*(int *)0); }
#undef ins_wstr
-int (ins_wstr)(
+int ins_wstr(
const wchar_t *z)
{ return(*(int *)0); }
#undef inwstr
-int (inwstr)(
+int inwstr(
wchar_t *z)
{ return(*(int *)0); }
#undef mvadd_wch
-int (mvadd_wch)(
+int mvadd_wch(
int a1,
int a2,
const cchar_t *z)
{ return(*(int *)0); }
#undef mvadd_wchnstr
-int (mvadd_wchnstr)(
+int mvadd_wchnstr(
int a1,
int a2,
const cchar_t *a3,
@@ -1542,14 +1542,14 @@ int (mvadd_wchnstr)(
{ return(*(int *)0); }
#undef mvadd_wchstr
-int (mvadd_wchstr)(
+int mvadd_wchstr(
int a1,
int a2,
const cchar_t *z)
{ return(*(int *)0); }
#undef mvaddnwstr
-int (mvaddnwstr)(
+int mvaddnwstr(
int a1,
int a2,
const wchar_t *a3,
@@ -1557,28 +1557,28 @@ int (mvaddnwstr)(
{ return(*(int *)0); }
#undef mvaddwstr
-int (mvaddwstr)(
+int mvaddwstr(
int a1,
int a2,
const wchar_t *z)
{ return(*(int *)0); }
#undef mvget_wch
-int (mvget_wch)(
+int mvget_wch(
int a1,
int a2,
wint_t *z)
{ return(*(int *)0); }
#undef mvget_wstr
-int (mvget_wstr)(
+int mvget_wstr(
int a1,
int a2,
wint_t *z)
{ return(*(int *)0); }
#undef mvgetn_wstr
-int (mvgetn_wstr)(
+int mvgetn_wstr(
int a1,
int a2,
wint_t *a3,
@@ -1586,7 +1586,7 @@ int (mvgetn_wstr)(
{ return(*(int *)0); }
#undef mvhline_set
-int (mvhline_set)(
+int mvhline_set(
int a1,
int a2,
const cchar_t *a3,
@@ -1594,14 +1594,14 @@ int (mvhline_set)(
{ return(*(int *)0); }
#undef mvin_wch
-int (mvin_wch)(
+int mvin_wch(
int a1,
int a2,
cchar_t *z)
{ return(*(int *)0); }
#undef mvin_wchnstr
-int (mvin_wchnstr)(
+int mvin_wchnstr(
int a1,
int a2,
cchar_t *a3,
@@ -1609,14 +1609,14 @@ int (mvin_wchnstr)(
{ return(*(int *)0); }
#undef mvin_wchstr
-int (mvin_wchstr)(
+int mvin_wchstr(
int a1,
int a2,
cchar_t *z)
{ return(*(int *)0); }
#undef mvinnwstr
-int (mvinnwstr)(
+int mvinnwstr(
int a1,
int a2,
wchar_t *a3,
@@ -1624,7 +1624,7 @@ int (mvinnwstr)(
{ return(*(int *)0); }
#undef mvins_nwstr
-int (mvins_nwstr)(
+int mvins_nwstr(
int a1,
int a2,
const wchar_t *a3,
@@ -1632,28 +1632,28 @@ int (mvins_nwstr)(
{ return(*(int *)0); }
#undef mvins_wch
-int (mvins_wch)(
+int mvins_wch(
int a1,
int a2,
const cchar_t *z)
{ return(*(int *)0); }
#undef mvins_wstr
-int (mvins_wstr)(
+int mvins_wstr(
int a1,
int a2,
const wchar_t *z)
{ return(*(int *)0); }
#undef mvinwstr
-int (mvinwstr)(
+int mvinwstr(
int a1,
int a2,
wchar_t *z)
{ return(*(int *)0); }
#undef mvvline_set
-int (mvvline_set)(
+int mvvline_set(
int a1,
int a2,
const cchar_t *a3,
@@ -1661,7 +1661,7 @@ int (mvvline_set)(
{ return(*(int *)0); }
#undef mvwadd_wch
-int (mvwadd_wch)(
+int mvwadd_wch(
WINDOW *a1,
int a2,
int a3,
@@ -1669,7 +1669,7 @@ int (mvwadd_wch)(
{ return(*(int *)0); }
#undef mvwadd_wchnstr
-int (mvwadd_wchnstr)(
+int mvwadd_wchnstr(
WINDOW *a1,
int a2,
int a3,
@@ -1678,7 +1678,7 @@ int (mvwadd_wchnstr)(
{ return(*(int *)0); }
#undef mvwadd_wchstr
-int (mvwadd_wchstr)(
+int mvwadd_wchstr(
WINDOW *a1,
int a2,
int a3,
@@ -1686,7 +1686,7 @@ int (mvwadd_wchstr)(
{ return(*(int *)0); }
#undef mvwaddnwstr
-int (mvwaddnwstr)(
+int mvwaddnwstr(
WINDOW *a1,
int a2,
int a3,
@@ -1695,7 +1695,7 @@ int (mvwaddnwstr)(
{ return(*(int *)0); }
#undef mvwaddwstr
-int (mvwaddwstr)(
+int mvwaddwstr(
WINDOW *a1,
int a2,
int a3,
@@ -1703,7 +1703,7 @@ int (mvwaddwstr)(
{ return(*(int *)0); }
#undef mvwget_wch
-int (mvwget_wch)(
+int mvwget_wch(
WINDOW *a1,
int a2,
int a3,
@@ -1711,7 +1711,7 @@ int (mvwget_wch)(
{ return(*(int *)0); }
#undef mvwget_wstr
-int (mvwget_wstr)(
+int mvwget_wstr(
WINDOW *a1,
int a2,
int a3,
@@ -1719,7 +1719,7 @@ int (mvwget_wstr)(
{ return(*(int *)0); }
#undef mvwgetn_wstr
-int (mvwgetn_wstr)(
+int mvwgetn_wstr(
WINDOW *a1,
int a2,
int a3,
@@ -1728,7 +1728,7 @@ int (mvwgetn_wstr)(
{ return(*(int *)0); }
#undef mvwhline_set
-int (mvwhline_set)(
+int mvwhline_set(
WINDOW *a1,
int a2,
int a3,
@@ -1737,7 +1737,7 @@ int (mvwhline_set)(
{ return(*(int *)0); }
#undef mvwin_wch
-int (mvwin_wch)(
+int mvwin_wch(
WINDOW *a1,
int a2,
int a3,
@@ -1745,7 +1745,7 @@ int (mvwin_wch)(
{ return(*(int *)0); }
#undef mvwin_wchnstr
-int (mvwin_wchnstr)(
+int mvwin_wchnstr(
WINDOW *a1,
int a2,
int a3,
@@ -1754,7 +1754,7 @@ int (mvwin_wchnstr)(
{ return(*(int *)0); }
#undef mvwin_wchstr
-int (mvwin_wchstr)(
+int mvwin_wchstr(
WINDOW *a1,
int a2,
int a3,
@@ -1762,7 +1762,7 @@ int (mvwin_wchstr)(
{ return(*(int *)0); }
#undef mvwinnwstr
-int (mvwinnwstr)(
+int mvwinnwstr(
WINDOW *a1,
int a2,
int a3,
@@ -1771,7 +1771,7 @@ int (mvwinnwstr)(
{ return(*(int *)0); }
#undef mvwins_nwstr
-int (mvwins_nwstr)(
+int mvwins_nwstr(
WINDOW *a1,
int a2,
int a3,
@@ -1780,7 +1780,7 @@ int (mvwins_nwstr)(
{ return(*(int *)0); }
#undef mvwins_wch
-int (mvwins_wch)(
+int mvwins_wch(
WINDOW *a1,
int a2,
int a3,
@@ -1788,7 +1788,7 @@ int (mvwins_wch)(
{ return(*(int *)0); }
#undef mvwins_wstr
-int (mvwins_wstr)(
+int mvwins_wstr(
WINDOW *a1,
int a2,
int a3,
@@ -1796,7 +1796,7 @@ int (mvwins_wstr)(
{ return(*(int *)0); }
#undef mvwinwstr
-int (mvwinwstr)(
+int mvwinwstr(
WINDOW *a1,
int a2,
int a3,
@@ -1804,7 +1804,7 @@ int (mvwinwstr)(
{ return(*(int *)0); }
#undef mvwvline_set
-int (mvwvline_set)(
+int mvwvline_set(
WINDOW *a1,
int a2,
int a3,
@@ -1813,49 +1813,49 @@ int (mvwvline_set)(
{ return(*(int *)0); }
#undef vline_set
-int (vline_set)(
+int vline_set(
const cchar_t *a1,
int z)
{ return(*(int *)0); }
#undef wadd_wchstr
-int (wadd_wchstr)(
+int wadd_wchstr(
WINDOW *a1,
const cchar_t *z)
{ return(*(int *)0); }
#undef waddwstr
-int (waddwstr)(
+int waddwstr(
WINDOW *a1,
const wchar_t *z)
{ return(*(int *)0); }
#undef wget_wstr
-int (wget_wstr)(
+int wget_wstr(
WINDOW *a1,
wint_t *z)
{ return(*(int *)0); }
#undef wgetbkgrnd
-int (wgetbkgrnd)(
+int wgetbkgrnd(
WINDOW *a1,
cchar_t *z)
{ return(*(int *)0); }
#undef win_wchstr
-int (win_wchstr)(
+int win_wchstr(
WINDOW *a1,
cchar_t *z)
{ return(*(int *)0); }
#undef wins_wstr
-int (wins_wstr)(
+int wins_wstr(
WINDOW *a1,
const wchar_t *z)
{ return(*(int *)0); }
#undef mouse_trafo
-NCURSES_BOOL (mouse_trafo)(
+NCURSES_BOOL mouse_trafo(
int *a1,
int *a2,
NCURSES_BOOL z)
@@ -4581,6 +4581,13 @@ char *tiparm(
...)
{ return(*(char **)0); }
+#undef _nc_tiparm
+char *_nc_tiparm(
+ int expected,
+ const char *string,
+ ...)
+ { return(*(char **)0); }
+
/* ./tinfo/lib_tputs.c */
#undef PC
diff --git a/ncurses/llib-ltinfo b/ncurses/llib-ltinfo
index 27680cae5f33..b2160d4f66b7 100644
--- a/ncurses/llib-ltinfo
+++ b/ncurses/llib-ltinfo
@@ -264,6 +264,11 @@ void _nc_free_entries(
void _nc_leaks_tinfo(void)
{ /* void */ }
+#undef exit_terminfo
+void exit_terminfo(
+ int code)
+ { /* void */ }
+
/* ./fallback.c */
#undef _nc_fallback
@@ -898,6 +903,13 @@ char *tiparm(
...)
{ return(*(char **)0); }
+#undef _nc_tiparm
+char *_nc_tiparm(
+ int expected,
+ const char *string,
+ ...)
+ { return(*(char **)0); }
+
/* ./tinfo/lib_tputs.c */
#undef PC
@@ -1009,6 +1021,11 @@ const char *_nc_tputs_trace = {0};
#undef _nc_outchars
long _nc_outchars;
+#undef curses_trace
+unsigned curses_trace(
+ unsigned tracelevel)
+ { return(*(unsigned *)0); }
+
#undef trace
void trace(
const unsigned int tracelevel)
diff --git a/ncurses/llib-ltinfot b/ncurses/llib-ltinfot
index 8ac9facbe516..18780beb96b1 100644
--- a/ncurses/llib-ltinfot
+++ b/ncurses/llib-ltinfot
@@ -269,6 +269,11 @@ void _nc_free_entries(
void _nc_leaks_tinfo(void)
{ /* void */ }
+#undef exit_terminfo
+void exit_terminfo(
+ int code)
+ { /* void */ }
+
/* ./fallback.c */
#undef _nc_fallback
@@ -974,6 +979,13 @@ char *tiparm(
...)
{ return(*(char **)0); }
+#undef _nc_tiparm
+char *_nc_tiparm(
+ int expected,
+ const char *string,
+ ...)
+ { return(*(char **)0); }
+
/* ./tinfo/lib_tputs.c */
#undef PC
@@ -1099,6 +1111,11 @@ void _nc_count_outchars(
long increment)
{ /* void */ }
+#undef curses_trace
+unsigned curses_trace(
+ unsigned tracelevel)
+ { return(*(unsigned *)0); }
+
#undef trace
void trace(
const unsigned int tracelevel)
diff --git a/ncurses/llib-ltinfotw b/ncurses/llib-ltinfotw
index 7011dbef2a14..0e7e76275885 100644
--- a/ncurses/llib-ltinfotw
+++ b/ncurses/llib-ltinfotw
@@ -281,6 +281,11 @@ void _nc_free_entries(
void _nc_leaks_tinfo(void)
{ /* void */ }
+#undef exit_terminfo
+void exit_terminfo(
+ int code)
+ { /* void */ }
+
/* ./fallback.c */
#undef _nc_fallback2
@@ -996,6 +1001,13 @@ char *tiparm(
...)
{ return(*(char **)0); }
+#undef _nc_tiparm
+char *_nc_tiparm(
+ int expected,
+ const char *string,
+ ...)
+ { return(*(char **)0); }
+
/* ./tinfo/lib_tputs.c */
#undef PC
@@ -1121,6 +1133,11 @@ void _nc_count_outchars(
long increment)
{ /* void */ }
+#undef curses_trace
+unsigned curses_trace(
+ unsigned tracelevel)
+ { return(*(unsigned *)0); }
+
#undef trace
void trace(
const unsigned int tracelevel)
diff --git a/ncurses/llib-ltinfow b/ncurses/llib-ltinfow
index 7a68d7066557..815e6b3e3c3e 100644
--- a/ncurses/llib-ltinfow
+++ b/ncurses/llib-ltinfow
@@ -276,6 +276,11 @@ void _nc_free_entries(
void _nc_leaks_tinfo(void)
{ /* void */ }
+#undef exit_terminfo
+void exit_terminfo(
+ int code)
+ { /* void */ }
+
/* ./fallback.c */
#undef _nc_fallback2
@@ -920,6 +925,13 @@ char *tiparm(
...)
{ return(*(char **)0); }
+#undef _nc_tiparm
+char *_nc_tiparm(
+ int expected,
+ const char *string,
+ ...)
+ { return(*(char **)0); }
+
/* ./tinfo/lib_tputs.c */
#undef PC
@@ -1031,6 +1043,11 @@ const char *_nc_tputs_trace = {0};
#undef _nc_outchars
long _nc_outchars;
+#undef curses_trace
+unsigned curses_trace(
+ unsigned tracelevel)
+ { return(*(unsigned *)0); }
+
#undef trace
void trace(
const unsigned int tracelevel)
diff --git a/ncurses/modules b/ncurses/modules
index f4c3e8b763dc..e111712e16b0 100644
--- a/ncurses/modules
+++ b/ncurses/modules
@@ -1,4 +1,4 @@
-# $Id: modules,v 1.124 2020/02/02 23:34:34 tom Exp $
+# $Id: modules,v 1.127 2020/09/12 17:58:12 tom Exp $
##############################################################################
# Copyright 2019,2020 Thomas E. Dickey #
# Copyright 1998-2013,2017 Free Software Foundation, Inc. #
@@ -241,6 +241,12 @@ wcwidth lib $(win32con) $(HEADER_DEPS)
widechars lib $(wide) $(HEADER_DEPS)
win_driver lib $(win32con) $(HEADER_DEPS)
+@ port_win32
+lib_win32con lib $(tinfo) $(HEADER_DEPS)
+lib_win32util lib $(tinfo) $(HEADER_DEPS)
+wcwidth lib $(win32con) $(HEADER_DEPS)
+win32_driver lib $(win32con) $(HEADER_DEPS)
+
@ port_tinfo
tinfo_driver lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
diff --git a/ncurses/new_pair.h b/ncurses/new_pair.h
index 811abc11442b..dfda89077207 100644
--- a/ncurses/new_pair.h
+++ b/ncurses/new_pair.h
@@ -34,7 +34,7 @@
/*
* Common type definitions and macros for new_pair.c, lib_color.c
*
- * $Id: new_pair.h,v 1.10 2020/02/02 23:34:34 tom Exp $
+ * $Id: new_pair.h,v 1.11 2020/04/11 16:43:47 tom Exp $
*/
#ifndef NEW_PAIR_H
@@ -77,8 +77,7 @@
typedef enum {
cpKEEP = -1, /* color pair 0 */
cpFREE = 0, /* free for use */
- cpINIT = 1, /* init_pair() */
- cpAUTO = 1 /* alloc_pair() */
+ cpINIT = 1 /* initialized */
} CPMODE;
typedef struct _color_pairs
diff --git a/ncurses/report_hashing.c b/ncurses/report_hashing.c
new file mode 100644
index 000000000000..bed96efbe315
--- /dev/null
+++ b/ncurses/report_hashing.c
@@ -0,0 +1,73 @@
+/****************************************************************************
+ * Copyright 2020 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. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Thomas E. Dickey *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+#include <tic.h>
+
+MODULE_ID("$Id: report_hashing.c,v 1.3 2020/02/02 23:34:34 tom Exp $")
+
+static void
+check_names(const char *name, NCURSES_CONST char *const *table, int termcap)
+{
+ int errs = 0;
+ int n;
+ struct name_table_entry const *entry_ptr;
+ const HashValue *hash_table = _nc_get_hash_table(termcap);
+
+ printf("%s:\n", name);
+ for (n = 0; table[n] != NULL; ++n) {
+ entry_ptr = _nc_find_entry(table[n], hash_table);
+ if (entry_ptr == 0) {
+ printf(" %s\n", table[n]);
+ errs++;
+ }
+ }
+ if (errs)
+ printf("%d errors\n", errs);
+}
+
+int
+main(void)
+{
+#define CHECK_TI(name) check_names(#name, name, 0)
+#define CHECK_TC(name) check_names(#name, name, 1)
+
+ CHECK_TI(boolnames);
+ CHECK_TI(numnames);
+ CHECK_TI(strnames);
+
+ CHECK_TC(boolcodes);
+ CHECK_TC(numcodes);
+ CHECK_TC(strcodes);
+
+ return EXIT_SUCCESS;
+}
diff --git a/ncurses/tinfo/MKcaptab.sh b/ncurses/tinfo/MKcaptab.sh
index c800023d105a..c800023d105a 100644..100755
--- a/ncurses/tinfo/MKcaptab.sh
+++ b/ncurses/tinfo/MKcaptab.sh
diff --git a/ncurses/tinfo/MKfallback.sh b/ncurses/tinfo/MKfallback.sh
index 319ab066c885..64c65f197e0d 100755
--- a/ncurses/tinfo/MKfallback.sh
+++ b/ncurses/tinfo/MKfallback.sh
@@ -27,7 +27,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: MKfallback.sh,v 1.24 2020/02/08 21:52:37 tom Exp $
+# $Id: MKfallback.sh,v 1.25 2020/08/16 15:58:44 tom Exp $
#
# MKfallback.sh -- create fallback table for entry reads
#
@@ -44,12 +44,14 @@ terminfo_src=$1
shift
tic_path=$1
+test -z "$tic_path" && tic_path=tic
shift
infocmp_path=$1
+test -z "$infocmp_path" && infocmp_path=infocmp
shift
-case $tic_path in #(vi
+case "$tic_path" in #(vi
/*)
tic_head=`echo "$tic_path" | sed -e 's,/[^/]*$,,'`
PATH=$tic_head:$PATH
@@ -67,7 +69,7 @@ if test $# != 0 ; then
TERMINFO_DIRS=$TERMINFO:$terminfo_dir
export TERMINFO_DIRS
- $tic_path -x $terminfo_src >&2
+ "$tic_path" -x "$terminfo_src" >&2
else
tmp_info=
fi
@@ -90,10 +92,10 @@ then
/* fallback entries for: $* */
EOF
- for x in $*
+ for x in "$@"
do
echo "/* $x */"
- $infocmp_path -E $x | sed -e 's/\<short\>/NCURSES_INT2/g'
+ "$infocmp_path" -E "$x" | sed -e 's/\<short\>/NCURSES_INT2/g'
done
cat <<EOF
@@ -101,10 +103,10 @@ static const TERMTYPE2 fallbacks[$#] =
{
EOF
comma=""
- for x in $*
+ for x in "$@"
do
echo "$comma /* $x */"
- $infocmp_path -e $x
+ "$infocmp_path" -e "$x"
comma=","
done
diff --git a/ncurses/tinfo/access.c b/ncurses/tinfo/access.c
index c69707feb2c6..15593688266e 100644
--- a/ncurses/tinfo/access.c
+++ b/ncurses/tinfo/access.c
@@ -37,10 +37,16 @@
#include <tic.h>
-MODULE_ID("$Id: access.c,v 1.25 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: access.c,v 1.27 2020/08/29 16:22:03 juergen Exp $")
#define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c))
+#ifdef _NC_MSC
+# define ACCESS(FN, MODE) access((FN), (MODE)&(R_OK|W_OK))
+#else
+# define ACCESS access
+#endif
+
NCURSES_EXPORT(char *)
_nc_rootname(char *path)
{
@@ -112,7 +118,7 @@ _nc_access(const char *path, int mode)
if (path == 0) {
result = -1;
- } else if (access(path, mode) < 0) {
+ } else if (ACCESS(path, mode) < 0) {
if ((mode & W_OK) != 0
&& errno == ENOENT
&& strlen(path) < PATH_MAX) {
@@ -127,7 +133,7 @@ _nc_access(const char *path, int mode)
if (head == leaf)
_nc_STRCPY(head, ".", sizeof(head));
- result = access(head, R_OK | W_OK | X_OK);
+ result = ACCESS(head, R_OK | W_OK | X_OK);
} else {
result = -1;
}
diff --git a/ncurses/tinfo/captoinfo.c b/ncurses/tinfo/captoinfo.c
index 8b3b83d18239..de0133b386c6 100644
--- a/ncurses/tinfo/captoinfo.c
+++ b/ncurses/tinfo/captoinfo.c
@@ -98,7 +98,7 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: captoinfo.c,v 1.98 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: captoinfo.c,v 1.100 2020/07/08 21:39:54 tom Exp $")
#if 0
#define DEBUG_THIS(p) DEBUG(9, p)
@@ -216,12 +216,15 @@ cvtchar(register const char *sp)
}
break;
case '^':
+ len = 2;
c = UChar(*++sp);
- if (c == '?')
+ if (c == '?') {
c = 127;
- else
+ } else if (c == '\0') {
+ len = 1;
+ } else {
c &= 0x1f;
- len = 2;
+ }
break;
default:
c = UChar(*sp);
@@ -636,7 +639,7 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
/* we may have to move some trailing mandatory padding up front */
padding = str + strlen(str) - 1;
if (padding > str && *padding == '>') {
- if (*--padding == '/')
+ if (padding > (str + 1) && *--padding == '/')
--padding;
while (isdigit(UChar(*padding)) || *padding == '.' || *padding == '*')
padding--;
diff --git a/ncurses/tinfo/comp_parse.c b/ncurses/tinfo/comp_parse.c
index ab25d5b1f03d..2a89a866c374 100644
--- a/ncurses/tinfo/comp_parse.c
+++ b/ncurses/tinfo/comp_parse.c
@@ -48,10 +48,10 @@
#include <tic.h>
-MODULE_ID("$Id: comp_parse.c,v 1.109 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: comp_parse.c,v 1.110 2020/02/29 15:46:00 anonymous.maarten Exp $")
static void sanity_check2(TERMTYPE2 *, bool);
-NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2;
+NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2;
static void fixup_acsc(TERMTYPE2 *, int);
diff --git a/ncurses/tinfo/doalloc.c b/ncurses/tinfo/doalloc.c
index f0c8141ad05e..0bda12cae8be 100644
--- a/ncurses/tinfo/doalloc.c
+++ b/ncurses/tinfo/doalloc.c
@@ -40,9 +40,9 @@
#include <curses.priv.h>
-MODULE_ID("$Id: doalloc.c,v 1.12 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: doalloc.c,v 1.13 2020/08/30 00:27:15 tom Exp $")
-NCURSES_EXPORT(void *)
+void *
_nc_doalloc(void *oldp, size_t amount)
{
void *newp;
diff --git a/ncurses/tinfo/lib_baudrate.c b/ncurses/tinfo/lib_baudrate.c
index 4f72de50f652..311c41ac97fa 100644
--- a/ncurses/tinfo/lib_baudrate.c
+++ b/ncurses/tinfo/lib_baudrate.c
@@ -84,7 +84,7 @@
#undef USE_OLD_TTY
#endif /* USE_OLD_TTY */
-MODULE_ID("$Id: lib_baudrate.c,v 1.44 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_baudrate.c,v 1.45 2020/09/05 21:15:32 tom Exp $")
/*
* int
@@ -99,6 +99,7 @@ struct speed {
int actual_speed; /* the actual speed */
};
+#if !defined(EXP_WIN32_DRIVER)
#define DATA(number) { B##number, number }
static struct speed const speeds[] =
@@ -188,10 +189,16 @@ static struct speed const speeds[] =
#endif
#endif
};
+#endif /* !EXP_WIN32_DRIVER */
NCURSES_EXPORT(int)
_nc_baudrate(int OSpeed)
{
+#if defined(EXP_WIN32_DRIVER)
+ /* On Windows this is a noop */
+ (void) OSpeed;
+ return (OK);
+#else
#if !USE_REENTRANT
static int last_OSpeed;
static int last_baudrate;
@@ -230,13 +237,16 @@ _nc_baudrate(int OSpeed)
#endif
}
return (result);
+#endif /* !EXP_WIN32_DRIVER */
}
NCURSES_EXPORT(int)
_nc_ospeed(int BaudRate)
{
int result = 1;
-
+#if defined(EXP_WIN32_DRIVER)
+ (void) BaudRate;
+#else
if (BaudRate >= 0) {
unsigned i;
@@ -247,6 +257,7 @@ _nc_ospeed(int BaudRate)
}
}
}
+#endif
return (result);
}
@@ -257,6 +268,9 @@ NCURSES_SP_NAME(baudrate) (NCURSES_SP_DCL0)
T((T_CALLED("baudrate(%p)"), (void *) SP_PARM));
+#if defined(EXP_WIN32_DRIVER)
+ result = OK;
+#else
/*
* In debugging, allow the environment symbol to override when we're
* redirecting to a file, so we can construct repeatable test-cases
@@ -290,7 +304,7 @@ NCURSES_SP_NAME(baudrate) (NCURSES_SP_DCL0)
} else {
result = ERR;
}
-
+#endif /* !EXP_WIN32_DRIVER */
returnCode(result);
}
diff --git a/ncurses/tinfo/lib_cur_term.c b/ncurses/tinfo/lib_cur_term.c
index 4a90335d5e33..0373aebb11b9 100644
--- a/ncurses/tinfo/lib_cur_term.c
+++ b/ncurses/tinfo/lib_cur_term.c
@@ -39,8 +39,9 @@
#include <curses.priv.h>
#include <termcap.h> /* ospeed */
+#include <tic.h> /* VALID_STRING */
-MODULE_ID("$Id: lib_cur_term.c,v 1.42 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_cur_term.c,v 1.43 2020/10/24 18:54:32 tom Exp $")
#undef CUR
#define CUR TerminalType(termp).
@@ -99,13 +100,13 @@ NCURSES_SP_NAME(set_curterm) (NCURSES_SP_DCLx TERMINAL *termp)
if (TCB->drv &&
TCB->drv->isTerminfo &&
TerminalType(termp).Strings) {
- PC = (char) ((pad_char != NULL) ? pad_char[0] : 0);
+ PC = (char) (VALID_STRING(pad_char) ? pad_char[0] : 0);
}
TCB->csp = SP_PARM;
#else
ospeed = (NCURSES_OSPEED) _nc_ospeed(termp->_baudrate);
if (TerminalType(termp).Strings) {
- PC = (char) ((pad_char != NULL) ? pad_char[0] : 0);
+ PC = (char) (VALID_STRING(pad_char) ? pad_char[0] : 0);
}
#endif
#if !USE_REENTRANT
diff --git a/ncurses/tinfo/lib_data.c b/ncurses/tinfo/lib_data.c
index bf3e554df70d..39274f4e7c39 100644
--- a/ncurses/tinfo/lib_data.c
+++ b/ncurses/tinfo/lib_data.c
@@ -43,7 +43,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_data.c,v 1.80 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_data.c,v 1.81 2020/06/13 22:01:14 tom Exp $")
/*
* OS/2's native linker complains if we don't initialize public data when
@@ -155,6 +155,11 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
0, /* dbd_time */
{ { 0, 0 } }, /* dbd_vars */
+#if HAVE_TSEARCH
+ NULL, /* cached_tparm */
+ 0, /* count_tparm */
+#endif /* HAVE_TSEARCH */
+
#ifdef USE_TERM_DRIVER
0, /* term_driver */
#endif
diff --git a/ncurses/tinfo/lib_kernel.c b/ncurses/tinfo/lib_kernel.c
index 482657add7cf..d5b021b80728 100644
--- a/ncurses/tinfo/lib_kernel.c
+++ b/ncurses/tinfo/lib_kernel.c
@@ -49,8 +49,9 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_kernel.c,v 1.32 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_kernel.c,v 1.34 2020/11/21 22:05:58 tom Exp $")
+#ifdef TERMIOS
static int
_nc_vdisable(void)
{
@@ -71,6 +72,7 @@ _nc_vdisable(void)
#endif
return value;
}
+#endif /* TERMIOS */
/*
* erasechar()
@@ -92,6 +94,8 @@ NCURSES_SP_NAME(erasechar) (NCURSES_SP_DCL0)
result = termp->Ottyb.c_cc[VERASE];
if (result == _nc_vdisable())
result = ERR;
+#elif defined(EXP_WIN32_DRIVER)
+ result = ERR;
#else
result = termp->Ottyb.sg_erase;
#endif
@@ -127,6 +131,8 @@ NCURSES_SP_NAME(killchar) (NCURSES_SP_DCL0)
result = termp->Ottyb.c_cc[VKILL];
if (result == _nc_vdisable())
result = ERR;
+#elif defined(EXP_WIN32_DRIVER)
+ result = ERR;
#else
result = termp->Ottyb.sg_kill;
#endif
@@ -162,7 +168,11 @@ NCURSES_SP_NAME(flushinp) (NCURSES_SP_DCL0)
#else
errno = 0;
do {
+#if defined(EXP_WIN32_DRIVER)
+ _nc_console_flush(_nc_console_fd2handle(termp->Filedes));
+#else
ioctl(termp->Filedes, TIOCFLUSH, 0);
+#endif
} while
(errno == EINTR);
#endif
diff --git a/ncurses/tinfo/lib_napms.c b/ncurses/tinfo/lib_napms.c
index 99dacd722928..3a9fc3168784 100644
--- a/ncurses/tinfo/lib_napms.c
+++ b/ncurses/tinfo/lib_napms.c
@@ -52,7 +52,7 @@
#endif
#endif
-MODULE_ID("$Id: lib_napms.c,v 1.26 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_napms.c,v 1.27 2020/08/15 19:45:23 tom Exp $")
NCURSES_EXPORT(int)
NCURSES_SP_NAME(napms) (NCURSES_SP_DCLx int ms)
@@ -75,6 +75,8 @@ NCURSES_SP_NAME(napms) (NCURSES_SP_DCLx int ms)
request = remaining;
}
}
+#elif defined(_NC_WINDOWS)
+ Sleep((DWORD) ms);
#else
_nc_timed_wait(0, 0, ms, (int *) 0 EVENTLIST_2nd(0));
#endif
diff --git a/ncurses/tinfo/lib_options.c b/ncurses/tinfo/lib_options.c
index 784e06c17fa1..017a34aac6e7 100644
--- a/ncurses/tinfo/lib_options.c
+++ b/ncurses/tinfo/lib_options.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2020 Thomas E. Dickey *
+ * Copyright 2020,2021 Thomas E. Dickey *
* Copyright 1998-2014,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -47,7 +47,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_options.c,v 1.81 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_options.c,v 1.82 2021/02/14 00:17:35 tom Exp $")
NCURSES_EXPORT(int)
idlok(WINDOW *win, bool flag)
@@ -361,7 +361,7 @@ _nc_keypad(SCREEN *sp, int flag)
#else
if (flag) {
(void) NCURSES_PUTP2_FLUSH("keypad_xmit", keypad_xmit);
- } else if (!flag && keypad_local) {
+ } else if (keypad_local) {
(void) NCURSES_PUTP2_FLUSH("keypad_local", keypad_local);
}
diff --git a/ncurses/tinfo/lib_print.c b/ncurses/tinfo/lib_print.c
index eb9214925a92..4accdf6786ea 100644
--- a/ncurses/tinfo/lib_print.c
+++ b/ncurses/tinfo/lib_print.c
@@ -40,7 +40,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_print.c,v 1.25 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_print.c,v 1.28 2020/08/29 16:22:03 juergen Exp $")
NCURSES_EXPORT(int)
NCURSES_SP_NAME(mcprint) (NCURSES_SP_DCLx char *data, int len)
@@ -60,7 +60,7 @@ NCURSES_SP_NAME(mcprint) (NCURSES_SP_DCLx char *data, int len)
}
if (prtr_non) {
- switchon = TPARM_1(prtr_non, len);
+ switchon = TIPARM_1(prtr_non, len);
onsize = strlen(switchon);
offsize = 0;
} else {
@@ -96,7 +96,7 @@ NCURSES_SP_NAME(mcprint) (NCURSES_SP_DCLx char *data, int len)
* kernel will ship the contiguous clist items from the last write
* immediately.
*/
-#ifndef _WIN32
+#ifndef _NC_WINDOWS
(void) sleep(0);
#endif
free(mybuf);
diff --git a/ncurses/tinfo/lib_raw.c b/ncurses/tinfo/lib_raw.c
index a691a266b703..1e47f3b6fbfb 100644
--- a/ncurses/tinfo/lib_raw.c
+++ b/ncurses/tinfo/lib_raw.c
@@ -50,7 +50,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_raw.c,v 1.24 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_raw.c,v 1.26 2020/11/21 22:07:48 tom Exp $")
#if HAVE_SYS_TERMIO_H
#include <sys/termio.h> /* needed for ISC */
@@ -97,6 +97,8 @@ NCURSES_SP_NAME(raw) (NCURSES_SP_DCL0)
buf.c_iflag &= (unsigned) ~(COOKED_INPUT);
buf.c_cc[VMIN] = 1;
buf.c_cc[VTIME] = 0;
+#elif defined(EXP_WIN32_DRIVER)
+ buf.dwFlagIn &= (unsigned long) ~CONMODE_NORAW;
#else
buf.sg_flags |= RAW;
#endif
@@ -152,6 +154,9 @@ NCURSES_SP_NAME(cbreak) (NCURSES_SP_DCL0)
buf.c_lflag |= ISIG;
buf.c_cc[VMIN] = 1;
buf.c_cc[VTIME] = 0;
+#elif defined(EXP_WIN32_DRIVER)
+ buf.dwFlagIn |= CONMODE_NORAW;
+ buf.dwFlagIn &= (unsigned long) ~CONMODE_NOCBREAK;
#else
buf.sg_flags |= CBREAK;
#endif
@@ -231,6 +236,8 @@ NCURSES_SP_NAME(noraw) (NCURSES_SP_DCL0)
buf.c_lflag |= ISIG | ICANON |
(termp->Ottyb.c_lflag & IEXTEN);
buf.c_iflag |= COOKED_INPUT;
+#elif defined(EXP_WIN32_DRIVER)
+ buf.dwFlagIn |= CONMODE_NORAW;
#else
buf.sg_flags &= ~(RAW | CBREAK);
#endif
@@ -283,6 +290,8 @@ NCURSES_SP_NAME(nocbreak) (NCURSES_SP_DCL0)
#ifdef TERMIOS
buf.c_lflag |= ICANON;
buf.c_iflag |= ICRNL;
+#elif defined(EXP_WIN32_DRIVER)
+ buf.dwFlagIn |= (CONMODE_NOCBREAK | CONMODE_NORAW);
#else
buf.sg_flags &= ~CBREAK;
#endif
diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c
index a6527bfd0967..976227effade 100644
--- a/ncurses/tinfo/lib_setup.c
+++ b/ncurses/tinfo/lib_setup.c
@@ -49,7 +49,7 @@
#include <locale.h>
#endif
-MODULE_ID("$Id: lib_setup.c,v 1.207 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.212 2020/09/09 19:43:00 juergen Exp $")
/****************************************************************************
*
@@ -305,11 +305,19 @@ _nc_get_screensize(SCREEN *sp,
bool useEnv = _nc_prescreen.use_env;
bool useTioctl = _nc_prescreen.use_tioctl;
+#ifdef EXP_WIN32_DRIVER
+ /* If we are here, then Windows console is used in terminfo mode.
+ We need to figure out the size using the console API
+ */
+ _nc_console_size(linep, colp);
+ T(("screen size: winconsole lines = %d columns = %d", *linep, *colp));
+#else
/* figure out the size of the screen */
T(("screen size: terminfo lines = %d columns = %d", lines, columns));
*linep = (int) lines;
*colp = (int) columns;
+#endif
#if NCURSES_SP_FUNCS
if (sp) {
@@ -566,7 +574,7 @@ NCURSES_EXPORT(int)
_nc_unicode_locale(void)
{
int result = 0;
-#if defined(_WIN32) && USE_WIDEC_SUPPORT
+#if defined(_NC_WINDOWS) && USE_WIDEC_SUPPORT
result = 1;
#elif HAVE_LANGINFO_CODESET
char *env = nl_langinfo(CODESET);
@@ -655,13 +663,20 @@ TINFO_SETUP_TERM(TERMINAL **tp,
if (tname == 0) {
tname = getenv("TERM");
- if (tname == 0 || *tname == '\0') {
-#ifdef USE_TERM_DRIVER
+#if defined(EXP_WIN32_DRIVER)
+ if (!VALID_TERM_ENV(tname, NO_TERMINAL)) {
+ T(("Failure with TERM=%s", NonNull(tname)));
+ ret_error0(TGETENT_ERR, "TERM environment variable not set.\n");
+ }
+#elif defined(USE_TERM_DRIVER)
+ if (!NonEmpty(tname))
tname = "unknown";
#else
+ if (!NonEmpty(tname)) {
+ T(("Failure with TERM=%s", NonNull(tname)));
ret_error0(TGETENT_ERR, "TERM environment variable not set.\n");
-#endif
}
+#endif
}
myname = strdup(tname);
@@ -680,6 +695,10 @@ TINFO_SETUP_TERM(TERMINAL **tp,
*/
if (Filedes == STDOUT_FILENO && !NC_ISATTY(Filedes))
Filedes = STDERR_FILENO;
+#if defined(EXP_WIN32_DRIVER)
+ if (Filedes != STDERR_FILENO && NC_ISATTY(Filedes))
+ _setmode(Filedes, _O_BINARY);
+#endif
/*
* Check if we have already initialized to use this terminal. If so, we
diff --git a/ncurses/tinfo/lib_tgoto.c b/ncurses/tinfo/lib_tgoto.c
index 8e240856f823..9cf5e100ce87 100644
--- a/ncurses/tinfo/lib_tgoto.c
+++ b/ncurses/tinfo/lib_tgoto.c
@@ -36,7 +36,7 @@
#include <ctype.h>
#include <termcap.h>
-MODULE_ID("$Id: lib_tgoto.c,v 1.19 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_tgoto.c,v 1.21 2020/05/27 23:55:56 tom Exp $")
#if !PURE_TERMINFO
static bool
@@ -207,6 +207,6 @@ tgoto(const char *string, int x, int y)
result = tgoto_internal(string, x, y);
else
#endif
- result = TPARM_2(string, y, x);
+ result = TIPARM_2(string, y, x);
returnPtr(result);
}
diff --git a/ncurses/tinfo/lib_tparm.c b/ncurses/tinfo/lib_tparm.c
index 400cd31996f8..b8104eabcd5e 100644
--- a/ncurses/tinfo/lib_tparm.c
+++ b/ncurses/tinfo/lib_tparm.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2018-2019,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 *
@@ -38,12 +38,22 @@
*
*/
+#define entry _ncu_entry
+#define ENTRY _ncu_ENTRY
+
#include <curses.priv.h>
+#undef entry
+#undef ENTRY
+
+#if HAVE_TSEARCH
+#include <search.h>
+#endif
+
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: lib_tparm.c,v 1.108 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_tparm.c,v 1.129 2021/02/14 00:09:49 tom Exp $")
/*
* char *
@@ -110,17 +120,81 @@ NCURSES_EXPORT_VAR(int) _nc_tparm_err = 0;
#define TPS(var) _nc_prescreen.tparm_state.var
#define popcount _nc_popcount /* workaround for NetBSD 6.0 defect */
+#define isUPPER(c) ((c) >= 'A' && (c) <= 'Z')
+#define isLOWER(c) ((c) >= 'a' && (c) <= 'z')
+#define tc_BUMP() if (level < 0 && number < 2) number++
+
+typedef struct {
+ const char *format; /* format-string can be used as cache-key */
+ int tparm_type; /* bit-set for each string-parameter */
+ int num_actual;
+ int num_parsed;
+ int num_popped;
+ TPARM_ARG param[NUM_PARM];
+ char *p_is_s[NUM_PARM];
+} TPARM_DATA;
+
+#if HAVE_TSEARCH
+#define MyCache _nc_globals.cached_tparm
+#define MyCount _nc_globals.count_tparm
#if NO_LEAKS
+static int which_tparm;
+static TPARM_DATA **delete_tparm;
+#endif
+#endif /* HAVE_TSEARCH */
+
+static char dummy[] = ""; /* avoid const-cast */
+
+#if HAVE_TSEARCH
+static int
+cmp_format(const void *p, const void *q)
+{
+ const char *a = *(char *const *) p;
+ const char *b = *(char *const *) q;
+ return strcmp(a, b);
+}
+#endif
+
+#if NO_LEAKS
+#if HAVE_TSEARCH
+static void
+visit_nodes(const void *nodep, const VISIT which, const int depth)
+{
+ (void) depth;
+ if (which == preorder || which == leaf) {
+ delete_tparm[which_tparm] = *(TPARM_DATA **) nodep;
+ which_tparm++;
+ }
+}
+#endif
+
NCURSES_EXPORT(void)
_nc_free_tparm(void)
{
- if (TPS(out_buff) != 0) {
- FreeAndNull(TPS(out_buff));
- TPS(out_size) = 0;
- TPS(out_used) = 0;
- FreeAndNull(TPS(fmt_buff));
- TPS(fmt_size) = 0;
+#if HAVE_TSEARCH
+ if (MyCount != 0) {
+ delete_tparm = typeMalloc(TPARM_DATA *, MyCount);
+ which_tparm = 0;
+ twalk(MyCache, visit_nodes);
+ for (which_tparm = 0; which_tparm < MyCount; ++which_tparm) {
+ TPARM_DATA *ptr = delete_tparm[which_tparm];
+ tdelete(ptr, &MyCache, cmp_format);
+ free((char *) ptr->format);
+ free(ptr);
+ }
+ which_tparm = 0;
+ twalk(MyCache, visit_nodes);
+ FreeAndNull(delete_tparm);
+ MyCount = 0;
+ which_tparm = 0;
}
+#endif
+ FreeAndNull(TPS(out_buff));
+ TPS(out_size) = 0;
+ TPS(out_used) = 0;
+
+ FreeAndNull(TPS(fmt_buff));
+ TPS(fmt_size) = 0;
}
#endif
@@ -137,10 +211,7 @@ get_space(size_t need)
static NCURSES_INLINE void
save_text(const char *fmt, const char *s, int len)
{
- size_t s_len = strlen(s);
- if (len > (int) s_len)
- s_len = (size_t) len;
-
+ size_t s_len = (size_t) len + strlen(s) + strlen(fmt);
get_space(s_len + 1);
_nc_SPRINTF(TPS(out_buff) + TPS(out_used),
@@ -152,10 +223,8 @@ save_text(const char *fmt, const char *s, int len)
static NCURSES_INLINE void
save_number(const char *fmt, int number, int len)
{
- if (len < 30)
- len = 30; /* actually log10(MAX_INT)+1 */
-
- get_space((size_t) len + 1);
+ size_t s_len = (size_t) len + 30 + strlen(fmt);
+ get_space(s_len + 1);
_nc_SPRINTF(TPS(out_buff) + TPS(out_used),
_nc_SLIMIT(TPS(out_size) - TPS(out_used))
@@ -216,7 +285,6 @@ spush(char *x)
static NCURSES_INLINE char *
spop(void)
{
- static char dummy[] = ""; /* avoid const-cast */
char *result = dummy;
if (TPS(stack_ptr) > 0) {
TPS(stack_ptr)--;
@@ -325,10 +393,6 @@ parse_format(const char *s, char *format, int *len)
return s;
}
-#define isUPPER(c) ((c) >= 'A' && (c) <= 'Z')
-#define isLOWER(c) ((c) >= 'a' && (c) <= 'z')
-#define tc_BUMP() if (level < 0 && number < 2) number++
-
/*
* Analyze the string to see how many parameters we need from the varargs list,
* and what their types are. We will only accept string parameters if they
@@ -341,7 +405,7 @@ parse_format(const char *s, char *format, int *len)
* may be cases that we cannot see the explicit parameter numbers.
*/
NCURSES_EXPORT(int)
-_nc_tparm_analyze(const char *string, char *p_is_s[NUM_PARM], int *popcount)
+_nc_tparm_analyze(const char *string, char **p_is_s, int *popcount)
{
size_t len2;
int i;
@@ -350,7 +414,6 @@ _nc_tparm_analyze(const char *string, char *p_is_s[NUM_PARM], int *popcount)
int number = 0;
int level = -1;
const char *cp = string;
- static char dummy[] = "";
if (cp == 0)
return 0;
@@ -469,106 +532,179 @@ _nc_tparm_analyze(const char *string, char *p_is_s[NUM_PARM], int *popcount)
return number;
}
-static NCURSES_INLINE char *
-tparam_internal(int use_TPARM_ARG, const char *string, va_list ap)
+/*
+ * Analyze the capability string, finding the number of parameters and their
+ * types.
+ *
+ * TODO: cache the result so that this is done once per capability per term.
+ */
+static int
+tparm_setup(const char *string, TPARM_DATA * result)
{
- char *p_is_s[NUM_PARM];
- TPARM_ARG param[NUM_PARM];
- int popcount = 0;
- int number;
- int num_args;
- int len;
- int level;
- int x, y;
- int i;
- const char *cp = string;
- size_t len2;
- bool termcap_hack;
- bool incremented_two;
+ int rc = OK;
- if (cp == NULL) {
+ TPS(out_used) = 0;
+ memset(result, 0, sizeof(*result));
+
+ if (string == NULL) {
TR(TRACE_CALLS, ("%s: format is null", TPS(tname)));
- return NULL;
- }
+ rc = ERR;
+ } else {
+#if HAVE_TSEARCH
+ TPARM_DATA *fs;
+ void *ft;
+
+ result->format = string;
+ if ((ft = tfind(result, &MyCache, cmp_format)) != 0) {
+ fs = *(TPARM_DATA **) ft;
+ *result = *fs;
+ } else
+#endif
+ {
+ /*
+ * Find the highest parameter-number referred to in the format
+ * string. Use this value to limit the number of arguments copied
+ * from the variable-length argument list.
+ */
+ result->num_parsed = _nc_tparm_analyze(string,
+ result->p_is_s,
+ &(result->num_popped));
+ if (TPS(fmt_buff) == 0) {
+ TR(TRACE_CALLS, ("%s: error in analysis", TPS(tname)));
+ rc = ERR;
+ } else {
+ int n;
- TPS(out_used) = 0;
- len2 = strlen(cp);
-
- /*
- * Find the highest parameter-number referred to in the format string.
- * Use this value to limit the number of arguments copied from the
- * variable-length argument list.
- */
- number = _nc_tparm_analyze(cp, p_is_s, &popcount);
- if (TPS(fmt_buff) == 0) {
- TR(TRACE_CALLS, ("%s: error in analysis", TPS(tname)));
- return NULL;
+ if (result->num_parsed > NUM_PARM)
+ result->num_parsed = NUM_PARM;
+ if (result->num_popped > NUM_PARM)
+ result->num_popped = NUM_PARM;
+ result->num_actual = max(result->num_popped, result->num_parsed);
+
+ for (n = 0; n < result->num_actual; ++n) {
+ if (result->p_is_s[n])
+ result->tparm_type |= (1 << n);
+ }
+#if HAVE_TSEARCH
+ if ((fs = typeCalloc(TPARM_DATA, 1)) != 0) {
+ *fs = *result;
+ if ((fs->format = strdup(string)) != 0) {
+ if (tsearch(fs, &MyCache, cmp_format) != 0) {
+ ++MyCount;
+ } else {
+ rc = ERR;
+ }
+ } else {
+ rc = ERR;
+ }
+ } else {
+ rc = ERR;
+ }
+#endif
+ }
+ }
}
- incremented_two = FALSE;
+ return rc;
+}
- if (number > NUM_PARM)
- number = NUM_PARM;
- if (popcount > NUM_PARM)
- popcount = NUM_PARM;
- num_args = max(popcount, number);
+/*
+ * A few caps (such as plab_norm) have string-valued parms. We'll have to
+ * assume that the caller knows the difference, since a char* and an int may
+ * not be the same size on the stack. The normal prototype for tparm uses 9
+ * long's, which is consistent with our va_arg() usage.
+ */
+static void
+tparm_copy_valist(TPARM_DATA * data, int use_TPARM_ARG, va_list ap)
+{
+ int i;
- for (i = 0; i < num_args; i++) {
- /*
- * A few caps (such as plab_norm) have string-valued parms.
- * We'll have to assume that the caller knows the difference, since
- * a char* and an int may not be the same size on the stack. The
- * normal prototype for this uses 9 long's, which is consistent with
- * our va_arg() usage.
- */
- if (p_is_s[i] != 0) {
- p_is_s[i] = va_arg(ap, char *);
- param[i] = 0;
+ for (i = 0; i < data->num_actual; i++) {
+ if (data->p_is_s[i] != 0) {
+ char *value = va_arg(ap, char *);
+ if (value == 0)
+ value = dummy;
+ data->p_is_s[i] = value;
+ data->param[i] = 0;
} else if (use_TPARM_ARG) {
- param[i] = va_arg(ap, TPARM_ARG);
+ data->param[i] = va_arg(ap, TPARM_ARG);
} else {
- param[i] = (TPARM_ARG) va_arg(ap, int);
+ data->param[i] = (TPARM_ARG) va_arg(ap, int);
}
}
+}
+
+/*
+ * This is a termcap compatibility hack. If there are no explicit pop
+ * operations in the string, load the stack in such a way that successive pops
+ * will grab successive parameters. That will make the expansion of (for
+ * example) \E[%d;%dH work correctly in termcap style, which means tparam()
+ * will expand termcap strings OK.
+ */
+static bool
+tparm_tc_compat(TPARM_DATA * data)
+{
+ bool termcap_hack = FALSE;
- /*
- * This is a termcap compatibility hack. If there are no explicit pop
- * operations in the string, load the stack in such a way that
- * successive pops will grab successive parameters. That will make
- * the expansion of (for example) \E[%d;%dH work correctly in termcap
- * style, which means tparam() will expand termcap strings OK.
- */
TPS(stack_ptr) = 0;
- termcap_hack = FALSE;
- if (popcount == 0) {
+
+ if (data->num_popped == 0) {
+ int i;
+
termcap_hack = TRUE;
- for (i = number - 1; i >= 0; i--) {
- if (p_is_s[i])
- spush(p_is_s[i]);
+ for (i = data->num_parsed - 1; i >= 0; i--) {
+ if (data->p_is_s[i])
+ spush(data->p_is_s[i]);
else
- npush((int) param[i]);
+ npush((int) data->param[i]);
}
}
+ return termcap_hack;
+}
+
#ifdef TRACE
+static void
+tparm_trace_call(const char *string, TPARM_DATA * data)
+{
if (USE_TRACEF(TRACE_CALLS)) {
- for (i = 0; i < num_args; i++) {
- if (p_is_s[i] != 0) {
- save_text(", %s", _nc_visbuf(p_is_s[i]), 0);
- } else if ((long) param[i] > MAX_OF_TYPE(NCURSES_INT2) ||
- (long) param[i] < 0) {
+ int i;
+ for (i = 0; i < data->num_actual; i++) {
+ if (data->p_is_s[i] != 0) {
+ save_text(", %s", _nc_visbuf(data->p_is_s[i]), 0);
+ } else if ((long) data->param[i] > MAX_OF_TYPE(NCURSES_INT2) ||
+ (long) data->param[i] < 0) {
_tracef("BUG: problem with tparm parameter #%d of %d",
- i + 1, num_args);
+ i + 1, data->num_actual);
break;
} else {
- save_number(", %d", (int) param[i], 0);
+ save_number(", %d", (int) data->param[i], 0);
}
}
- _tracef(T_CALLED("%s(%s%s)"), TPS(tname), _nc_visbuf(cp), TPS(out_buff));
+ _tracef(T_CALLED("%s(%s%s)"), TPS(tname), _nc_visbuf(string), TPS(out_buff));
TPS(out_used) = 0;
_nc_unlock_global(tracef);
}
+}
+
+#else
+#define tparm_trace_call(string, data) /* nothing */
#endif /* TRACE */
+static NCURSES_INLINE char *
+tparam_internal(const char *string, TPARM_DATA * data)
+{
+ int number;
+ int len;
+ int level;
+ int x, y;
+ int i;
+ const char *cp = string;
+ size_t len2 = strlen(cp);
+ bool incremented_two = FALSE;
+ bool termcap_hack = tparm_tc_compat(data);
+
+ tparm_trace_call(string, data);
+
while ((cp - string) < (int) len2) {
if (*cp != '%') {
save_char(UChar(*cp));
@@ -619,10 +755,10 @@ tparam_internal(int use_TPARM_ARG, const char *string, va_list ap)
cp++;
i = (UChar(*cp) - '1');
if (i >= 0 && i < NUM_PARM) {
- if (p_is_s[i]) {
- spush(p_is_s[i]);
+ if (data->p_is_s[i]) {
+ spush(data->p_is_s[i]);
} else {
- npush((int) param[i]);
+ npush((int) data->param[i]);
}
}
break;
@@ -751,15 +887,15 @@ tparam_internal(int use_TPARM_ARG, const char *string, va_list ap)
*/
if (!incremented_two) {
incremented_two = TRUE;
- if (p_is_s[0] == 0) {
- param[0]++;
+ if (data->p_is_s[0] == 0) {
+ data->param[0]++;
if (termcap_hack)
- TPS(stack)[0].data.num = (int) param[0];
+ TPS(stack)[0].data.num = (int) data->param[0];
}
- if (p_is_s[1] == 0) {
- param[1]++;
+ if (data->p_is_s[1] == 0) {
+ data->param[1]++;
if (termcap_hack)
- TPS(stack)[1].data.num = (int) param[1];
+ TPS(stack)[1].data.num = (int) data->param[1];
}
}
break;
@@ -830,61 +966,130 @@ tparam_internal(int use_TPARM_ARG, const char *string, va_list ap)
get_space((size_t) 1);
TPS(out_buff)[TPS(out_used)] = '\0';
+ if (TPS(stack_ptr) && !_nc_tparm_err) {
+ DEBUG(2, ("tparm: stack has %d item%s on return",
+ TPS(stack_ptr),
+ TPS(stack_ptr) == 1 ? "" : "s"));
+ _nc_tparm_err++;
+ }
+
T((T_RETURN("%s"), _nc_visbuf(TPS(out_buff))));
return (TPS(out_buff));
}
#if NCURSES_TPARM_VARARGS
-#define tparm_varargs tparm
-#else
-#define tparm_proto tparm
-#endif
NCURSES_EXPORT(char *)
-tparm_varargs(const char *string, ...)
+tparm(const char *string, ...)
{
+ TPARM_DATA myData;
va_list ap;
- char *result;
+ char *result = NULL;
_nc_tparm_err = 0;
- va_start(ap, string);
#ifdef TRACE
TPS(tname) = "tparm";
#endif /* TRACE */
- result = tparam_internal(TRUE, string, ap);
- va_end(ap);
+
+ if (tparm_setup(string, &myData) == OK) {
+
+ va_start(ap, string);
+ tparm_copy_valist(&myData, TRUE, ap);
+ va_end(ap);
+
+ result = tparam_internal(string, &myData);
+ }
return result;
}
-#if !NCURSES_TPARM_VARARGS
+#else /* !NCURSES_TPARM_VARARGS */
+
NCURSES_EXPORT(char *)
-tparm_proto(const char *string,
- TPARM_ARG a1,
- TPARM_ARG a2,
- TPARM_ARG a3,
- TPARM_ARG a4,
- TPARM_ARG a5,
- TPARM_ARG a6,
- TPARM_ARG a7,
- TPARM_ARG a8,
- TPARM_ARG a9)
+tparm(const char *string,
+ TPARM_ARG a1,
+ TPARM_ARG a2,
+ TPARM_ARG a3,
+ TPARM_ARG a4,
+ TPARM_ARG a5,
+ TPARM_ARG a6,
+ TPARM_ARG a7,
+ TPARM_ARG a8,
+ TPARM_ARG a9)
{
- return tparm_varargs(string, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ TPARM_DATA myData;
+ char *result = NULL;
+
+ _nc_tparm_err = 0;
+#ifdef TRACE
+ TPS(tname) = "tparm";
+#endif /* TRACE */
+
+ if (tparm_setup(string, &myData) == OK) {
+
+ myData.param[0] = a1;
+ myData.param[1] = a2;
+ myData.param[2] = a3;
+ myData.param[3] = a4;
+ myData.param[4] = a5;
+ myData.param[5] = a6;
+ myData.param[6] = a7;
+ myData.param[7] = a8;
+ myData.param[8] = a9;
+
+ result = tparam_internal(string, &myData);
+ }
+ return result;
}
+
#endif /* NCURSES_TPARM_VARARGS */
NCURSES_EXPORT(char *)
tiparm(const char *string, ...)
{
+ TPARM_DATA myData;
va_list ap;
- char *result;
+ char *result = NULL;
_nc_tparm_err = 0;
- va_start(ap, string);
#ifdef TRACE
TPS(tname) = "tiparm";
#endif /* TRACE */
- result = tparam_internal(FALSE, string, ap);
- va_end(ap);
+
+ if (tparm_setup(string, &myData) == OK) {
+
+ va_start(ap, string);
+ tparm_copy_valist(&myData, FALSE, ap);
+ va_end(ap);
+
+ result = tparam_internal(string, &myData);
+ }
+ return result;
+}
+
+/*
+ * The internal-use flavor ensures that the parameters are numbers, not strings
+ */
+NCURSES_EXPORT(char *)
+_nc_tiparm(int expected, const char *string, ...)
+{
+ TPARM_DATA myData;
+ va_list ap;
+ char *result = NULL;
+
+ _nc_tparm_err = 0;
+#ifdef TRACE
+ TPS(tname) = "_nc_tiparm";
+#endif /* TRACE */
+
+ if (tparm_setup(string, &myData) == OK
+ && myData.num_actual <= expected
+ && myData.tparm_type == 0) {
+
+ va_start(ap, string);
+ tparm_copy_valist(&myData, FALSE, ap);
+ va_end(ap);
+
+ result = tparam_internal(string, &myData);
+ }
return result;
}
diff --git a/ncurses/tinfo/lib_tputs.c b/ncurses/tinfo/lib_tputs.c
index bfde26efd980..3eb19d2d9662 100644
--- a/ncurses/tinfo/lib_tputs.c
+++ b/ncurses/tinfo/lib_tputs.c
@@ -52,7 +52,7 @@
#include <termcap.h> /* ospeed */
#include <tic.h>
-MODULE_ID("$Id: lib_tputs.c,v 1.103 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_tputs.c,v 1.106 2020/11/29 00:40:08 tom Exp $")
NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */
NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */
@@ -120,16 +120,21 @@ delay_output(int ms)
NCURSES_EXPORT(void)
NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_DCL0)
{
+ T((T_CALLED("_nc_flush(%p)"), (void *) SP_PARM));
if (SP_PARM != 0 && SP_PARM->_ofd >= 0) {
+ TR(TRACE_CHARPUT, ("ofd:%d inuse:%lu buffer:%p",
+ SP_PARM->_ofd,
+ (unsigned long) SP_PARM->out_inuse,
+ SP_PARM->out_buffer));
if (SP_PARM->out_inuse) {
char *buf = SP_PARM->out_buffer;
size_t amount = SP->out_inuse;
SP->out_inuse = 0;
- TR(TRACE_CHARPUT, ("flushing %ld bytes", (unsigned long) amount));
+ TR(TRACE_CHARPUT, ("flushing %ld/%ld bytes",
+ (unsigned long) amount, _nc_outchars));
while (amount) {
ssize_t res = write(SP_PARM->_ofd, buf, amount);
-
if (res > 0) {
/* if the write was incomplete, try again */
amount -= (size_t) res;
@@ -142,10 +147,15 @@ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_DCL0)
break; /* an error we can not recover from */
}
}
+ } else if (SP_PARM->out_buffer == 0) {
+ TR(TRACE_CHARPUT, ("flushing stdout"));
+ fflush(stdout);
}
} else {
+ TR(TRACE_CHARPUT, ("flushing stdout"));
fflush(stdout);
}
+ returnVoid;
}
#if NCURSES_SP_FUNCS
diff --git a/ncurses/tinfo/lib_ttyflags.c b/ncurses/tinfo/lib_ttyflags.c
index bfcd64af58b1..6363a805be9c 100644
--- a/ncurses/tinfo/lib_ttyflags.c
+++ b/ncurses/tinfo/lib_ttyflags.c
@@ -42,7 +42,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_ttyflags.c,v 1.34 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_ttyflags.c,v 1.36 2020/09/05 22:54:47 tom Exp $")
NCURSES_EXPORT(int)
NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_DCLx TTY * buf)
@@ -156,6 +156,8 @@ NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_DCL0)
#ifdef TERMIOS
if (termp->Ottyb.c_oflag & OFLAGS_TABS)
tab = back_tab = NULL;
+#elif defined(EXP_WIN32_DRIVER)
+ /* noop */
#else
if (termp->Ottyb.sg_flags & XTABS)
tab = back_tab = NULL;
@@ -193,6 +195,8 @@ NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_DCL0)
if (_nc_get_tty_mode(&termp->Nttyb) == OK) {
#ifdef TERMIOS
termp->Nttyb.c_oflag &= (unsigned) (~OFLAGS_TABS);
+#elif defined(EXP_WIN32_DRIVER)
+ /* noop */
#else
termp->Nttyb.sg_flags &= (unsigned) (~XTABS);
#endif
diff --git a/ncurses/tinfo/lib_win32con.c b/ncurses/tinfo/lib_win32con.c
new file mode 100644
index 000000000000..3c0fe8160734
--- /dev/null
+++ b/ncurses/tinfo/lib_win32con.c
@@ -0,0 +1,1256 @@
+/****************************************************************************
+ * Copyright 2020 Thomas E. Dickey *
+ * Copyright 1998-2009,2010 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. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Juergen Pfeifer *
+ * and: Thomas E. Dickey *
+ ****************************************************************************/
+
+/*
+ * TODO - GetMousePos(POINT * result) from ntconio.c
+ */
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_win32con.c,v 1.6 2020/11/21 23:44:58 tom Exp $")
+
+#ifdef _NC_WINDOWS
+
+#ifdef _NC_MINGW
+#include <wchar.h>
+#else
+#include <tchar.h>
+#endif
+
+#include <io.h>
+
+#if USE_WIDEC_SUPPORT
+#define write_screen WriteConsoleOutputW
+#define read_screen ReadConsoleOutputW
+#else
+#define write_screen WriteConsoleOutput
+#define read_screen ReadConsoleOutput
+#endif
+
+static BOOL IsConsoleHandle(HANDLE hdl);
+static bool save_original_screen(void);
+static bool restore_original_screen(void) GCC_UNUSED;
+static bool read_screen_data(void);
+static int Adjust(int milliseconds, int diff);
+static int decode_mouse(SCREEN *sp, int mask);
+static bool handle_mouse(SCREEN *sp, MOUSE_EVENT_RECORD mer);
+static int rkeycompare(const void *el1, const void *el2);
+static int keycompare(const void *el1, const void *el2);
+static int MapKey(WORD vKey);
+static int AnsiKey(WORD vKey);
+
+static ULONGLONG tdiff(FILETIME fstart, FILETIME fend);
+
+#define GenMap(vKey,key) MAKELONG(key, vKey)
+static const LONG keylist[] =
+{
+ GenMap(VK_PRIOR, KEY_PPAGE),
+ GenMap(VK_NEXT, KEY_NPAGE),
+ GenMap(VK_END, KEY_END),
+ GenMap(VK_HOME, KEY_HOME),
+ GenMap(VK_LEFT, KEY_LEFT),
+ GenMap(VK_UP, KEY_UP),
+ GenMap(VK_RIGHT, KEY_RIGHT),
+ GenMap(VK_DOWN, KEY_DOWN),
+ GenMap(VK_DELETE, KEY_DC),
+ GenMap(VK_INSERT, KEY_IC)
+};
+static const LONG ansi_keys[] =
+{
+ GenMap(VK_PRIOR, 'I'),
+ GenMap(VK_NEXT, 'Q'),
+ GenMap(VK_END, 'O'),
+ GenMap(VK_HOME, 'H'),
+ GenMap(VK_LEFT, 'K'),
+ GenMap(VK_UP, 'H'),
+ GenMap(VK_RIGHT, 'M'),
+ GenMap(VK_DOWN, 'P'),
+ GenMap(VK_DELETE, 'S'),
+ GenMap(VK_INSERT, 'R')
+};
+#define array_length(a) (sizeof(a)/sizeof(a[0]))
+#define N_INI ((int)array_length(keylist))
+#define FKEYS 24
+#define MAPSIZE (FKEYS + N_INI)
+
+/* A process can only have a single console, so it's safe
+ to maintain all the information about it in a single
+ static structure.
+ */
+NCURSES_EXPORT_VAR(ConsoleInfo) _nc_CONSOLE;
+static bool console_initialized = FALSE;
+
+#define EnsureInit() (void)(console_initialized ? TRUE : _nc_console_checkinit(TRUE, TRUE))
+
+#define REQUIRED_MAX_V (DWORD)10
+#define REQUIRED_MIN_V (DWORD)0
+#define REQUIRED_BUILD (DWORD)17763
+/*
+ This function returns 0 if the Windows version has no support for
+ the modern Console interface, otherwise it returns 1
+ */
+NCURSES_EXPORT(int)
+_nc_console_vt_supported(void)
+{
+ OSVERSIONINFO osvi;
+ int res = 0;
+
+ T((T_CALLED("lib_win32con::_nc_console_vt_supported")));
+ ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+
+ GetVersionEx(&osvi);
+ T(("GetVersionEx returnedMajor=%ld, Minor=%ld, Build=%ld",
+ osvi.dwMajorVersion,
+ osvi.dwMinorVersion,
+ osvi.dwBuildNumber));
+ if (osvi.dwMajorVersion >= REQUIRED_MAX_V) {
+ if (osvi.dwMajorVersion == REQUIRED_MAX_V) {
+ if (((osvi.dwMinorVersion == REQUIRED_MIN_V) &&
+ (osvi.dwBuildNumber >= REQUIRED_BUILD)) ||
+ ((osvi.dwMinorVersion > REQUIRED_MIN_V)))
+ res = 1;
+ } else
+ res = 1;
+ }
+ returnCode(res);
+}
+
+NCURSES_EXPORT(void)
+_nc_console_size(int* Lines, int* Cols)
+{
+ EnsureInit();
+ if (Lines != NULL && Cols != NULL) {
+ if (WINCONSOLE.buffered) {
+ *Lines = (int) (WINCONSOLE.SBI.dwSize.Y);
+ *Cols = (int) (WINCONSOLE.SBI.dwSize.X);
+ } else {
+ *Lines = (int) (WINCONSOLE.SBI.srWindow.Bottom + 1 -
+ WINCONSOLE.SBI.srWindow.Top);
+ *Cols = (int) (WINCONSOLE.SBI.srWindow.Right + 1 -
+ WINCONSOLE.SBI.srWindow.Left);
+ }
+ }
+}
+
+/* Convert a file descriptor into a HANDLE
+ That's not necessarily a console HANDLE
+*/
+NCURSES_EXPORT(HANDLE)
+_nc_console_handle(int fd)
+{
+ intptr_t value = _get_osfhandle(fd);
+ return (HANDLE) value;
+}
+
+/* Validate that a HANDLE is actually a
+ console HANDLE
+*/
+static BOOL
+IsConsoleHandle(HANDLE hdl)
+{
+ DWORD dwFlag = 0;
+ BOOL result = FALSE;
+
+ T((T_CALLED("lib_win32con::IsConsoleHandle(HANDLE=%p"), hdl));
+
+ EnsureInit();
+
+ if (!GetConsoleMode(hdl, &dwFlag)) {
+ T(("GetConsoleMode failed"));
+ } else {
+ result = TRUE;
+ }
+
+ returnBool(result);
+}
+
+/* This is used when running in terminfo mode to discover,
+ whether or not the "terminal" is actually a Windows
+ Console. It's the responsibility of the console to deal
+ with the terminal escape sequences that are sent by
+ terminfo.
+ */
+NCURSES_EXPORT(int)
+_nc_console_test(int fd)
+{
+ int code = 0;
+ HANDLE hdl = INVALID_HANDLE_VALUE;
+ T((T_CALLED("lib_win32con::_nc_console_test(%d)"), fd));
+ hdl = _nc_console_handle(fd);
+ code = (int) IsConsoleHandle(hdl);
+ returnCode(code);
+}
+
+#define OutHandle() ((WINCONSOLE.isTermInfoConsole || WINCONSOLE.progMode) ? WINCONSOLE.hdl : WINCONSOLE.out)
+
+NCURSES_EXPORT(void)
+_nc_console_selectActiveHandle(void)
+{
+ if (WINCONSOLE.lastOut != WINCONSOLE.hdl) {
+ WINCONSOLE.lastOut = WINCONSOLE.hdl;
+ SetConsoleActiveScreenBuffer(WINCONSOLE.lastOut);
+ }
+}
+
+NCURSES_EXPORT(HANDLE)
+_nc_console_fd2handle(int fd)
+{
+ HANDLE hdl = _nc_console_handle(fd);
+ if (hdl==WINCONSOLE.inp) {
+ T(("lib_win32con:validateHandle %d -> WINCONSOLE.inp", fd));
+ } else if (hdl==WINCONSOLE.hdl) {
+ T(("lib_win32con:validateHandle %d -> WINCONSOLE.hdl", fd));
+ } else if (hdl==WINCONSOLE.out) {
+ T(("lib_win32con:validateHandle %d -> WINCONSOLE.out", fd));
+ } else {
+ T(("lib_win32con:validateHandle %d maps to unknown HANDLE", fd));
+ hdl = INVALID_HANDLE_VALUE;
+ }
+#if 1
+ assert(hdl != INVALID_HANDLE_VALUE);
+#endif
+ if (hdl != INVALID_HANDLE_VALUE) {
+ if (hdl != WINCONSOLE.inp && (!WINCONSOLE.isTermInfoConsole && WINCONSOLE.progMode)) {
+ if (hdl==WINCONSOLE.out && hdl!=WINCONSOLE.hdl) {
+ T(("lib_win32con:validateHandle forcing WINCONSOLE.out -> WINCONSOLE.hdl"));
+ hdl = WINCONSOLE.hdl;
+ }
+ }
+ }
+ return hdl;
+}
+
+NCURSES_EXPORT(int)
+_nc_console_setmode(HANDLE hdl, const TTY *arg)
+{
+ DWORD dwFlag = 0;
+ int code = ERR;
+ HANDLE alt;
+
+ if (arg) {
+#ifdef TRACE
+ TTY TRCTTY;
+#define TRCTTYOUT(flag) TRCTTY.dwFlagOut = flag
+#define TRCTTYIN(flag) TRCTTY.dwFlagIn = flag
+#else
+#define TRCTTYOUT(flag)
+#define TRCTTYIN(flag)
+#endif
+ T(("lib_win32con:_nc_console_setmode %s", _nc_trace_ttymode(arg)));
+ if (hdl==WINCONSOLE.inp) {
+ dwFlag = arg->dwFlagIn | ENABLE_MOUSE_INPUT | VT_FLAG_IN;
+ if (WINCONSOLE.isTermInfoConsole)
+ dwFlag |= (VT_FLAG_IN);
+ else
+ dwFlag &= (DWORD) ~(VT_FLAG_IN);
+ TRCTTYIN(dwFlag);
+ SetConsoleMode(hdl, dwFlag);
+
+ alt = OutHandle();
+ dwFlag = arg->dwFlagOut;
+ if (WINCONSOLE.isTermInfoConsole)
+ dwFlag |= (VT_FLAG_OUT);
+ else
+ dwFlag |= (VT_FLAG_OUT);
+ TRCTTYOUT(dwFlag);
+ SetConsoleMode(alt, dwFlag);
+ } else {
+ dwFlag = arg->dwFlagOut;
+ if (WINCONSOLE.isTermInfoConsole)
+ dwFlag |= (VT_FLAG_OUT);
+ else
+ dwFlag |= (VT_FLAG_OUT);
+ TRCTTYOUT(dwFlag);
+ SetConsoleMode(hdl, dwFlag);
+
+ alt = WINCONSOLE.inp;
+ dwFlag = arg->dwFlagIn | ENABLE_MOUSE_INPUT;
+ if (WINCONSOLE.isTermInfoConsole)
+ dwFlag |= (VT_FLAG_IN);
+ else
+ dwFlag &= (DWORD) ~(VT_FLAG_IN);
+ TRCTTYIN(dwFlag);
+ SetConsoleMode(alt, dwFlag);
+ T(("effective mode set %s", _nc_trace_ttymode(&TRCTTY)));
+ }
+ code = OK;
+ }
+ return(code);
+}
+
+NCURSES_EXPORT(int)
+_nc_console_getmode(HANDLE hdl, TTY *arg)
+{
+ int code = ERR;
+
+ if (arg) {
+ DWORD dwFlag = 0;
+ HANDLE alt;
+
+ if (hdl==WINCONSOLE.inp) {
+ if(GetConsoleMode(hdl, &dwFlag)) {
+ arg->dwFlagIn = dwFlag;
+ alt = OutHandle();
+ if (GetConsoleMode(alt, &dwFlag)) {
+ arg->dwFlagOut = dwFlag;
+ code = OK;
+ }
+ }
+ } else {
+ if (GetConsoleMode(hdl, &dwFlag)) {
+ arg->dwFlagOut = dwFlag;
+ alt = WINCONSOLE.inp;
+ if (GetConsoleMode(alt, &dwFlag)) {
+ arg->dwFlagIn = dwFlag;
+ code = OK;
+ }
+ }
+ }
+ }
+ T(("lib_win32con:_nc_console_getmode %s", _nc_trace_ttymode(arg)));
+ return(code);
+}
+
+NCURSES_EXPORT(int)
+_nc_console_flush(HANDLE hdl)
+{
+ int code = OK;
+
+ T((T_CALLED("lib_win32con::_nc_console_flush(hdl=%p"), hdl));
+
+ if (hdl != INVALID_HANDLE_VALUE) {
+ if (hdl == WINCONSOLE.hdl ||
+ hdl == WINCONSOLE.inp ||
+ hdl == WINCONSOLE.out) {
+ if (!FlushConsoleInputBuffer(WINCONSOLE.inp))
+ code = ERR;
+ } else {
+ code = ERR;
+ T(("_nc_console_flush not requesting a handle owned by console."));
+ }
+ }
+ returnCode(code);
+}
+
+NCURSES_EXPORT(WORD)
+_nc_console_MapColor(bool fore, int color)
+{
+ static const int _cmap[] =
+ {0, 4, 2, 6, 1, 5, 3, 7};
+ int a;
+ if (color < 0 || color > 7)
+ a = fore ? 7 : 0;
+ else
+ a = _cmap[color];
+ if (!fore)
+ a = a << 4;
+ return (WORD) a;
+}
+
+
+/*
+ * Attempt to save the screen contents. PDCurses does this if
+ * PDC_RESTORE_SCREEN is set, giving the same visual appearance on
+ * restoration as if the library had allocated a console buffer. MSDN
+ * says that the data which can be read is limited to 64Kb (and may be
+ * less).
+ */
+static bool
+save_original_screen(void)
+{
+ bool result = FALSE;
+
+ WINCONSOLE.save_region.Top = 0;
+ WINCONSOLE.save_region.Left = 0;
+ WINCONSOLE.save_region.Bottom = (SHORT) (WINCONSOLE.SBI.dwSize.Y - 1);
+ WINCONSOLE.save_region.Right = (SHORT) (WINCONSOLE.SBI.dwSize.X - 1);
+
+ if (read_screen_data()) {
+ result = TRUE;
+ } else {
+
+ WINCONSOLE.save_region.Top = WINCONSOLE.SBI.srWindow.Top;
+ WINCONSOLE.save_region.Left = WINCONSOLE.SBI.srWindow.Left;
+ WINCONSOLE.save_region.Bottom = WINCONSOLE.SBI.srWindow.Bottom;
+ WINCONSOLE.save_region.Right = WINCONSOLE.SBI.srWindow.Right;
+
+ WINCONSOLE.window_only = TRUE;
+
+ if (read_screen_data()) {
+ result = TRUE;
+ }
+ }
+
+ T(("... save original screen contents %s", result ? "ok" : "err"));
+ return result;
+}
+
+static bool
+restore_original_screen(void)
+{
+ COORD bufferCoord;
+ bool result = FALSE;
+ SMALL_RECT save_region = WINCONSOLE.save_region;
+
+ T(("... restoring %s",
+ WINCONSOLE.window_only ? "window" : "entire buffer"));
+
+ bufferCoord.X = (SHORT) (WINCONSOLE.window_only ?
+ WINCONSOLE.SBI.srWindow.Left : 0);
+ bufferCoord.Y = (SHORT) (WINCONSOLE.window_only ?
+ WINCONSOLE.SBI.srWindow.Top : 0);
+
+ if (write_screen(WINCONSOLE.hdl,
+ WINCONSOLE.save_screen,
+ WINCONSOLE.save_size,
+ bufferCoord,
+ &save_region)) {
+ result = TRUE;
+ mvcur(-1, -1, LINES - 2, 0);
+ T(("... restore original screen contents ok %dx%d (%d,%d - %d,%d)",
+ WINCONSOLE.save_size.Y,
+ WINCONSOLE.save_size.X,
+ save_region.Top,
+ save_region.Left,
+ save_region.Bottom,
+ save_region.Right));
+ } else {
+ T(("... restore original screen contents err"));
+ }
+ return result;
+}
+
+static bool
+read_screen_data(void)
+{
+ bool result = FALSE;
+ COORD bufferCoord;
+ size_t want;
+
+ WINCONSOLE.save_size.X = (SHORT) (WINCONSOLE.save_region.Right
+ - WINCONSOLE.save_region.Left + 1);
+ WINCONSOLE.save_size.Y = (SHORT) (WINCONSOLE.save_region.Bottom
+ - WINCONSOLE.save_region.Top + 1);
+
+ want = (size_t) (WINCONSOLE.save_size.X * WINCONSOLE.save_size.Y);
+
+ if ((WINCONSOLE.save_screen = malloc(want * sizeof(CHAR_INFO))) != 0) {
+ bufferCoord.X = (SHORT) (WINCONSOLE.window_only ?
+ WINCONSOLE.SBI.srWindow.Left : 0);
+ bufferCoord.Y = (SHORT) (WINCONSOLE.window_only ?
+ WINCONSOLE.SBI.srWindow.Top : 0);
+
+ T(("... reading console %s %dx%d into %d,%d - %d,%d at %d,%d",
+ WINCONSOLE.window_only ? "window" : "buffer",
+ WINCONSOLE.save_size.Y, WINCONSOLE.save_size.X,
+ WINCONSOLE.save_region.Top,
+ WINCONSOLE.save_region.Left,
+ WINCONSOLE.save_region.Bottom,
+ WINCONSOLE.save_region.Right,
+ bufferCoord.Y,
+ bufferCoord.X));
+
+ if (read_screen(WINCONSOLE.hdl,
+ WINCONSOLE.save_screen,
+ WINCONSOLE.save_size,
+ bufferCoord,
+ &WINCONSOLE.save_region)) {
+ result = TRUE;
+ } else {
+ T((" error %#lx", (unsigned long) GetLastError()));
+ FreeAndNull(WINCONSOLE.save_screen);
+ }
+ }
+
+ return result;
+}
+
+NCURSES_EXPORT(bool)
+_nc_console_get_SBI(void)
+{
+ bool rc = FALSE;
+ if (GetConsoleScreenBufferInfo(WINCONSOLE.hdl, &(WINCONSOLE.SBI))) {
+ T(("GetConsoleScreenBufferInfo"));
+ T(("... buffer(X:%d Y:%d)",
+ WINCONSOLE.SBI.dwSize.X,
+ WINCONSOLE.SBI.dwSize.Y));
+ T(("... window(X:%d Y:%d)",
+ WINCONSOLE.SBI.dwMaximumWindowSize.X,
+ WINCONSOLE.SBI.dwMaximumWindowSize.Y));
+ T(("... cursor(X:%d Y:%d)",
+ WINCONSOLE.SBI.dwCursorPosition.X,
+ WINCONSOLE.SBI.dwCursorPosition.Y));
+ T(("... display(Top:%d Bottom:%d Left:%d Right:%d)",
+ WINCONSOLE.SBI.srWindow.Top,
+ WINCONSOLE.SBI.srWindow.Bottom,
+ WINCONSOLE.SBI.srWindow.Left,
+ WINCONSOLE.SBI.srWindow.Right));
+ if (WINCONSOLE.buffered) {
+ WINCONSOLE.origin.X = 0;
+ WINCONSOLE.origin.Y = 0;
+ } else {
+ WINCONSOLE.origin.X = WINCONSOLE.SBI.srWindow.Left;
+ WINCONSOLE.origin.Y = WINCONSOLE.SBI.srWindow.Top;
+ }
+ rc = TRUE;
+ } else {
+ T(("GetConsoleScreenBufferInfo ERR"));
+ }
+ return rc;
+}
+
+#define MIN_WIDE 80
+#define MIN_HIGH 24
+
+/*
+ * In "normal" mode, reset the buffer- and window-sizes back to their original values.
+ */
+NCURSES_EXPORT(void)
+_nc_console_set_scrollback(bool normal, CONSOLE_SCREEN_BUFFER_INFO * info)
+{
+ SMALL_RECT rect;
+ COORD coord;
+ bool changed = FALSE;
+
+ T((T_CALLED("lib_win32con::_nc_console_set_scrollback(%s)"),
+ (normal
+ ? "normal"
+ : "application")));
+
+ T(("... SBI.srWindow %d,%d .. %d,%d",
+ info->srWindow.Top,
+ info->srWindow.Left,
+ info->srWindow.Bottom,
+ info->srWindow.Right));
+ T(("... SBI.dwSize %dx%d",
+ info->dwSize.Y,
+ info->dwSize.X));
+
+ if (normal) {
+ rect = info->srWindow;
+ coord = info->dwSize;
+ if (memcmp(info, &WINCONSOLE.SBI, sizeof(*info)) != 0) {
+ changed = TRUE;
+ WINCONSOLE.SBI = *info;
+ }
+ } else {
+ int high = info->srWindow.Bottom - info->srWindow.Top + 1;
+ int wide = info->srWindow.Right - info->srWindow.Left + 1;
+
+ if (high < MIN_HIGH) {
+ T(("... height %d < %d", high, MIN_HIGH));
+ high = MIN_HIGH;
+ changed = TRUE;
+ }
+ if (wide < MIN_WIDE) {
+ T(("... width %d < %d", wide, MIN_WIDE));
+ wide = MIN_WIDE;
+ changed = TRUE;
+ }
+
+ rect.Left =
+ rect.Top = 0;
+ rect.Right = (SHORT) (wide - 1);
+ rect.Bottom = (SHORT) (high - 1);
+
+ coord.X = (SHORT) wide;
+ coord.Y = (SHORT) high;
+
+ if (info->dwSize.Y != high ||
+ info->dwSize.X != wide ||
+ info->srWindow.Top != 0 ||
+ info->srWindow.Left != 0) {
+ changed = TRUE;
+ }
+
+ }
+
+ if (changed) {
+ T(("... coord %d,%d", coord.Y, coord.X));
+ T(("... rect %d,%d - %d,%d",
+ rect.Top, rect.Left,
+ rect.Bottom, rect.Right));
+ SetConsoleScreenBufferSize(WINCONSOLE.hdl, coord); /* dwSize */
+ SetConsoleWindowInfo(WINCONSOLE.hdl, TRUE, &rect); /* srWindow */
+ _nc_console_get_SBI();
+ }
+ returnVoid;
+}
+
+static ULONGLONG
+tdiff(FILETIME fstart, FILETIME fend)
+{
+ ULARGE_INTEGER ustart;
+ ULARGE_INTEGER uend;
+ ULONGLONG diff;
+
+ ustart.LowPart = fstart.dwLowDateTime;
+ ustart.HighPart = fstart.dwHighDateTime;
+ uend.LowPart = fend.dwLowDateTime;
+ uend.HighPart = fend.dwHighDateTime;
+
+ diff = (uend.QuadPart - ustart.QuadPart) / 10000;
+ return diff;
+}
+
+static int
+Adjust(int milliseconds, int diff)
+{
+ if (milliseconds != INFINITY) {
+ milliseconds -= diff;
+ if (milliseconds < 0)
+ milliseconds = 0;
+ }
+ return milliseconds;
+}
+
+#define BUTTON_MASK (FROM_LEFT_1ST_BUTTON_PRESSED | \
+ FROM_LEFT_2ND_BUTTON_PRESSED | \
+ FROM_LEFT_3RD_BUTTON_PRESSED | \
+ FROM_LEFT_4TH_BUTTON_PRESSED | \
+ RIGHTMOST_BUTTON_PRESSED)
+
+static int
+decode_mouse(SCREEN *sp, int mask)
+{
+ int result = 0;
+
+ (void) sp;
+ assert(sp && console_initialized);
+
+ if (mask & FROM_LEFT_1ST_BUTTON_PRESSED)
+ result |= BUTTON1_PRESSED;
+ if (mask & FROM_LEFT_2ND_BUTTON_PRESSED)
+ result |= BUTTON2_PRESSED;
+ if (mask & FROM_LEFT_3RD_BUTTON_PRESSED)
+ result |= BUTTON3_PRESSED;
+ if (mask & FROM_LEFT_4TH_BUTTON_PRESSED)
+ result |= BUTTON4_PRESSED;
+
+ if (mask & RIGHTMOST_BUTTON_PRESSED) {
+ switch (WINCONSOLE.numButtons) {
+ case 1:
+ result |= BUTTON1_PRESSED;
+ break;
+ case 2:
+ result |= BUTTON2_PRESSED;
+ break;
+ case 3:
+ result |= BUTTON3_PRESSED;
+ break;
+ case 4:
+ result |= BUTTON4_PRESSED;
+ break;
+ }
+ }
+
+ return result;
+}
+
+#define AdjustY() (WINCONSOLE.buffered ? 0 : (int) WINCONSOLE.SBI.srWindow.Top)
+
+static bool
+handle_mouse(SCREEN *sp, MOUSE_EVENT_RECORD mer)
+{
+ MEVENT work;
+ bool result = FALSE;
+
+ assert(sp);
+
+ sp->_drv_mouse_old_buttons = sp->_drv_mouse_new_buttons;
+ sp->_drv_mouse_new_buttons = mer.dwButtonState & BUTTON_MASK;
+
+ /*
+ * We're only interested if the button is pressed or released.
+ * FIXME: implement continuous event-tracking.
+ */
+ if (sp->_drv_mouse_new_buttons != sp->_drv_mouse_old_buttons) {
+ memset(&work, 0, sizeof(work));
+
+ if (sp->_drv_mouse_new_buttons) {
+ work.bstate |=
+ (mmask_t) decode_mouse(sp,
+ sp->_drv_mouse_new_buttons);
+ } else {
+ /* cf: BUTTON_PRESSED, BUTTON_RELEASED */
+ work.bstate |=
+ (mmask_t) (decode_mouse(sp,
+ sp->_drv_mouse_old_buttons)
+ >> 1);
+ result = TRUE;
+ }
+
+ work.x = mer.dwMousePosition.X;
+ work.y = mer.dwMousePosition.Y - AdjustY();
+
+ sp->_drv_mouse_fifo[sp->_drv_mouse_tail] = work;
+ sp->_drv_mouse_tail += 1;
+ }
+ return result;
+}
+
+static int
+rkeycompare(const void *el1, const void *el2)
+{
+ WORD key1 = (LOWORD((*((const LONG *) el1)))) & 0x7fff;
+ WORD key2 = (LOWORD((*((const LONG *) el2)))) & 0x7fff;
+
+ return ((key1 < key2) ? -1 : ((key1 == key2) ? 0 : 1));
+}
+
+
+static int
+keycompare(const void *el1, const void *el2)
+{
+ WORD key1 = HIWORD((*((const LONG *) el1)));
+ WORD key2 = HIWORD((*((const LONG *) el2)));
+
+ return ((key1 < key2) ? -1 : ((key1 == key2) ? 0 : 1));
+}
+
+static int
+MapKey(WORD vKey)
+{
+ int code = -1;
+
+ if (!WINCONSOLE.isTermInfoConsole) {
+ WORD nKey = 0;
+ void *res;
+ LONG key = GenMap(vKey, 0);
+
+ res = bsearch(&key,
+ WINCONSOLE.map,
+ (size_t) (N_INI + FKEYS),
+ sizeof(keylist[0]),
+ keycompare);
+ if (res) {
+ key = *((LONG *) res);
+ nKey = LOWORD(key);
+ code = (int) (nKey & 0x7fff);
+ if (nKey & 0x8000)
+ code = -code;
+ }
+ }
+ return code;
+}
+
+static int
+AnsiKey(WORD vKey)
+{
+ int code = -1;
+
+ if (!WINCONSOLE.isTermInfoConsole) {
+ WORD nKey = 0;
+ void *res;
+ LONG key = GenMap(vKey, 0);
+
+ res = bsearch(&key,
+ WINCONSOLE.ansi_map,
+ (size_t) (N_INI + FKEYS),
+ sizeof(keylist[0]),
+ keycompare);
+ if (res) {
+ key = *((LONG *) res);
+ nKey = LOWORD(key);
+ code = (int) (nKey & 0x7fff);
+ if (nKey & 0x8000)
+ code = -code;
+ }
+ }
+ return code;
+}
+
+NCURSES_EXPORT(int)
+_nc_console_keyok(int keycode, int flag)
+{
+ int code = ERR;
+ WORD nKey;
+ WORD vKey;
+ void *res;
+ LONG key = GenMap(0, (WORD) keycode);
+
+ T((T_CALLED("lib_win32con::_nc_console_keyok(%d, %d)"), keycode, flag));
+
+ res = bsearch(&key,
+ WINCONSOLE.rmap,
+ (size_t) (N_INI + FKEYS),
+ sizeof(keylist[0]),
+ rkeycompare);
+ if (res) {
+ key = *((LONG *) res);
+ vKey = HIWORD(key);
+ nKey = (LOWORD(key)) & 0x7fff;
+ if (!flag)
+ nKey |= 0x8000;
+ *(LONG *) res = GenMap(vKey, nKey);
+ }
+ returnCode(code);
+}
+
+NCURSES_EXPORT(bool)
+_nc_console_keyExist(int keycode)
+{
+ WORD nKey;
+ void *res;
+ bool found = FALSE;
+ LONG key = GenMap(0, (WORD) keycode);
+
+ T((T_CALLED("lib_win32con::_nc_console_keyExist(%d)"), keycode));
+ res = bsearch(&key,
+ WINCONSOLE.rmap,
+ (size_t) (N_INI + FKEYS),
+ sizeof(keylist[0]),
+ rkeycompare);
+ if (res) {
+ key = *((LONG *) res);
+ nKey = LOWORD(key);
+ if (!(nKey & 0x8000))
+ found = TRUE;
+ }
+ returnCode(found);
+}
+
+NCURSES_EXPORT(int)
+_nc_console_twait(
+ SCREEN *sp,
+ HANDLE hdl,
+ int mode,
+ int milliseconds,
+ int *timeleft
+ EVENTLIST_2nd(_nc_eventlist * evl))
+{
+ INPUT_RECORD inp_rec;
+ BOOL b;
+ DWORD nRead = 0, rc = (DWORD) (-1);
+ int code = 0;
+ FILETIME fstart;
+ FILETIME fend;
+ int diff;
+ bool isNoDelay = (milliseconds == 0);
+
+#ifdef NCURSES_WGETCH_EVENTS
+ (void) evl; /* TODO: implement wgetch-events */
+#endif
+
+#define IGNORE_CTRL_KEYS (SHIFT_PRESSED|LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED| \
+ LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED)
+#define CONSUME() ReadConsoleInput(hdl, &inp_rec, 1, &nRead)
+
+ assert(sp);
+
+ TR(TRACE_IEVENT, ("start twait: hdl=%p, %d milliseconds, mode: %d",
+ hdl, milliseconds, mode));
+
+ if (milliseconds < 0)
+ milliseconds = INFINITY;
+
+ memset(&inp_rec, 0, sizeof(inp_rec));
+
+ while (true) {
+ if (!isNoDelay) {
+ GetSystemTimeAsFileTime(&fstart);
+ rc = WaitForSingleObject(hdl, (DWORD) milliseconds);
+ GetSystemTimeAsFileTime(&fend);
+ diff = (int) tdiff(fstart, fend);
+ milliseconds = Adjust(milliseconds, diff);
+ if (milliseconds< 0)
+ break;
+ }
+
+ if (isNoDelay || (rc == WAIT_OBJECT_0)) {
+ if (mode) {
+ nRead = 0;
+ b = GetNumberOfConsoleInputEvents(hdl, &nRead);
+ if (!b) {
+ T(("twait:err GetNumberOfConsoleInputEvents"));
+ }
+ if (isNoDelay && b) {
+ T(("twait: Events Available: %ld", nRead));
+ if (nRead==0) {
+ code = 0;
+ goto end;
+ } else {
+ DWORD n = 0;
+ INPUT_RECORD* pInpRec =
+ TypeAlloca(INPUT_RECORD, nRead);
+ if (pInpRec != NULL) {
+ DWORD i;
+ BOOL f;
+ memset(pInpRec, 0, sizeof(INPUT_RECORD)*nRead);
+ f = PeekConsoleInput(hdl, pInpRec, nRead, &n);
+ if (f) {
+ for(i = 0; i < n; i++) {
+ if (pInpRec[i].EventType==KEY_EVENT) {
+ if(pInpRec[i].Event.KeyEvent.bKeyDown) {
+ DWORD ctrlMask =
+ (pInpRec[i].Event.KeyEvent.dwControlKeyState &
+ IGNORE_CTRL_KEYS);
+ if (!ctrlMask) {
+ code = TW_INPUT;
+ goto end;
+ }
+ }
+ }
+ }
+ } else {
+ T(("twait:err PeekConsoleInput"));
+ }
+ code = 0;
+ goto end;
+ } else {
+ T(("twait:err could not alloca input records"));
+ }
+ }
+ }
+ if (b && nRead > 0) {
+ b = PeekConsoleInput(hdl, &inp_rec, 1, &nRead);
+ if (!b) {
+ T(("twait:err PeekConsoleInput"));
+ }
+ if (b && nRead > 0) {
+ switch (inp_rec.EventType) {
+ case KEY_EVENT:
+ if (mode & TW_INPUT) {
+ WORD vk =
+ inp_rec.Event.KeyEvent.wVirtualKeyCode;
+ char ch =
+ inp_rec.Event.KeyEvent.uChar.AsciiChar;
+ T(("twait:event KEY_EVENT"));
+ T(("twait vk=%d, ch=%d, keydown=%d",
+ vk, ch, inp_rec.Event.KeyEvent.bKeyDown));
+ if (inp_rec.Event.KeyEvent.bKeyDown) {
+ T(("twait:event KeyDown"));
+ if (!WINCONSOLE.isTermInfoConsole &&
+ (0 == ch)) {
+ int nKey = MapKey(vk);
+ if (nKey < 0) {
+ CONSUME();
+ continue;
+ }
+ }
+ code = TW_INPUT;
+ goto end;
+ } else {
+ CONSUME();
+ }
+ }
+ continue;
+ case MOUSE_EVENT:
+ T(("twait:event MOUSE_EVENT"));
+ if (decode_mouse(sp,
+ (inp_rec.Event.MouseEvent.dwButtonState
+ & BUTTON_MASK)) == 0) {
+ CONSUME();
+ } else if (mode & TW_MOUSE) {
+ code = TW_MOUSE;
+ goto end;
+ }
+ continue;
+ /* e.g., FOCUS_EVENT */
+ default:
+ T(("twait:event Tyoe %d", inp_rec.EventType));
+ CONSUME();
+ _nc_console_selectActiveHandle();
+ continue;
+ }
+ }
+ }
+ }
+ continue;
+ } else {
+ if (rc != WAIT_TIMEOUT) {
+ code = -1;
+ break;
+ } else {
+ code = 0;
+ break;
+ }
+ }
+ }
+end:
+
+ TR(TRACE_IEVENT, ("end twait: returned %d (%lu), remaining time %d msec",
+ code, GetLastError(), milliseconds));
+
+ if (timeleft)
+ *timeleft = milliseconds;
+
+ return code;
+}
+
+NCURSES_EXPORT(int)
+_nc_console_testmouse(
+ SCREEN *sp,
+ HANDLE hdl,
+ int delay
+ EVENTLIST_2nd(_nc_eventlist * evl))
+{
+ int rc = 0;
+
+ assert(sp);
+
+ if (sp->_drv_mouse_head < sp->_drv_mouse_tail) {
+ rc = TW_MOUSE;
+ } else {
+ rc = _nc_console_twait(sp,
+ hdl,
+ TWAIT_MASK,
+ delay,
+ (int *) 0
+ EVENTLIST_2nd(evl));
+ }
+ return rc;
+}
+
+NCURSES_EXPORT(int)
+_nc_console_read(
+ SCREEN *sp,
+ HANDLE hdl,
+ int *buf)
+{
+ int rc = -1;
+ INPUT_RECORD inp_rec;
+ BOOL b;
+ DWORD nRead;
+ WORD vk;
+
+ assert(sp);
+ assert(buf);
+
+ memset(&inp_rec, 0, sizeof(inp_rec));
+
+ T((T_CALLED("lib_win32con::_nc_console_read(%p)"), sp));
+
+ while ((b = ReadConsoleInput(hdl, &inp_rec, 1, &nRead))) {
+ if (b && nRead > 0) {
+ if (rc < 0)
+ rc = 0;
+ rc = rc + (int) nRead;
+ if (inp_rec.EventType == KEY_EVENT) {
+ if (!inp_rec.Event.KeyEvent.bKeyDown)
+ continue;
+ *buf = (int) inp_rec.Event.KeyEvent.uChar.AsciiChar;
+ vk = inp_rec.Event.KeyEvent.wVirtualKeyCode;
+ /*
+ * There are 24 virtual function-keys, and typically
+ * 12 function-keys on a keyboard. Use the shift-modifier
+ * to provide the remaining 12 keys.
+ */
+ if (vk >= VK_F1 && vk <= VK_F12) {
+ if (inp_rec.Event.KeyEvent.dwControlKeyState &
+ SHIFT_PRESSED) {
+ vk = (WORD) (vk + 12);
+ }
+ }
+ if (*buf == 0) {
+ int key = MapKey(vk);
+ if (key < 0)
+ continue;
+ if (sp->_keypad_on) {
+ *buf = key;
+ } else {
+ ungetch('\0');
+ *buf = AnsiKey(vk);
+ }
+ }
+ break;
+ } else if (inp_rec.EventType == MOUSE_EVENT) {
+ if (handle_mouse(sp,
+ inp_rec.Event.MouseEvent)) {
+ *buf = KEY_MOUSE;
+ break;
+ }
+ }
+ continue;
+ }
+ }
+ returnCode(rc);
+}
+
+/* Our replacement for the systems _isatty to include also
+ a test for mintty. This is called from the NC_ISATTY macro
+ defined in curses.priv.h
+
+ Return codes:
+ - 0 : Not a TTY
+ - 1 : A Windows character device detected by _isatty
+ - 2 : A future implementation may return 2 for mintty
+ */
+NCURSES_EXPORT(int)
+_nc_console_isatty(int fd)
+{
+ int result = 0;
+ T((T_CALLED("lib_win32con::_nc_console_isatty(%d"), fd));
+
+ if (_isatty(fd))
+ result = 1;
+#ifdef _NC_CHECK_MINTTY
+ else {
+ if (_nc_console_checkmintty(fd, NULL)) {
+ result = 2;
+ fprintf(stderr, "ncurses on Windows must run in a Windows console.\n");
+ fprintf(stderr, "On newer versions of Windows, the calling program should create a PTY-like.\n");
+ fprintf(stderr, "device using the CreatePseudoConsole Windows API call.\n");
+ exit(EXIT_FAILURE);
+ }
+ }
+#endif
+ returnCode(result);
+}
+
+NCURSES_EXPORT(bool)
+_nc_console_checkinit(bool initFlag, bool assumeTermInfo)
+{
+ bool res = FALSE;
+
+ T((T_CALLED("lib_win32con::_nc_console_checkinit(initFlag=%d, assumeTermInfo=%d)"),
+ initFlag, assumeTermInfo));
+
+ if (!initFlag) {
+ res = console_initialized;
+ } else {
+ /* initialize once, or not at all */
+ if (!console_initialized) {
+ int i;
+ DWORD num_buttons;
+ WORD a;
+ BOOL buffered = FALSE;
+ BOOL b;
+
+ START_TRACE();
+ WINCONSOLE.isTermInfoConsole = assumeTermInfo;
+
+ WINCONSOLE.map = (LPDWORD)malloc(sizeof(DWORD)*MAPSIZE);
+ WINCONSOLE.rmap = (LPDWORD)malloc(sizeof(DWORD)*MAPSIZE);
+ WINCONSOLE.ansi_map = (LPDWORD)malloc(sizeof(DWORD)*MAPSIZE);
+
+ for (i = 0; i < (N_INI + FKEYS); i++) {
+ if (i < N_INI) {
+ WINCONSOLE.rmap[i] = WINCONSOLE.map[i] =
+ (DWORD) keylist[i];
+ WINCONSOLE.ansi_map[i] = (DWORD) ansi_keys[i];
+ } else {
+ WINCONSOLE.rmap[i] = WINCONSOLE.map[i] =
+ (DWORD) GenMap((VK_F1 + (i - N_INI)),
+ (KEY_F(1) + (i - N_INI)));
+ WINCONSOLE.ansi_map[i] =
+ (DWORD) GenMap((VK_F1 + (i - N_INI)),
+ (';' + (i - N_INI)));
+ }
+ }
+ qsort(WINCONSOLE.ansi_map,
+ (size_t) (MAPSIZE),
+ sizeof(keylist[0]),
+ keycompare);
+ qsort(WINCONSOLE.map,
+ (size_t) (MAPSIZE),
+ sizeof(keylist[0]),
+ keycompare);
+ qsort(WINCONSOLE.rmap,
+ (size_t) (MAPSIZE),
+ sizeof(keylist[0]),
+ rkeycompare);
+
+ if (GetNumberOfConsoleMouseButtons(&num_buttons)) {
+ WINCONSOLE.numButtons = (int) num_buttons;
+ } else {
+ WINCONSOLE.numButtons = 1;
+ }
+
+ a = _nc_console_MapColor(true, COLOR_WHITE) |
+ _nc_console_MapColor(false, COLOR_BLACK);
+ for (i = 0; i < CON_NUMPAIRS; i++)
+ WINCONSOLE.pairs[i] = a;
+
+ WINCONSOLE.inp = GetStdHandle(STD_INPUT_HANDLE);
+ WINCONSOLE.out = GetStdHandle(STD_OUTPUT_HANDLE);
+ WINCONSOLE.hdl = WINCONSOLE.out;
+
+ GetConsoleMode(WINCONSOLE.inp, &WINCONSOLE.originalMode.dwFlagIn);
+ GetConsoleMode(WINCONSOLE.out, &WINCONSOLE.originalMode.dwFlagOut);
+
+ if (!WINCONSOLE.isTermInfoConsole) {
+ b = AllocConsole();
+
+ if (!b)
+ b = AttachConsole(ATTACH_PARENT_PROCESS);
+
+ if (getenv("NCGDB") || getenv("NCURSES_CONSOLE2")) {
+ T(("... will not buffer console"));
+ } else {
+ T(("... creating console buffer"));
+ WINCONSOLE.hdl =
+ CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE,
+ 0,
+ NULL,
+ CONSOLE_TEXTMODE_BUFFER,
+ NULL);
+ buffered = TRUE;
+ }
+ }
+
+ /* We set binary I/O even when using the console
+ driver to cover the situation, that the
+ TERM variable is set to #win32con, but actually
+ Windows supports virtual terminal processing.
+ So if terminfo functions are used in this setup,
+ they actually may work.
+ */
+ _setmode(fileno(stdin), _O_BINARY);
+ _setmode(fileno(stdout), _O_BINARY);
+
+ if (WINCONSOLE.hdl != INVALID_HANDLE_VALUE) {
+ WINCONSOLE.buffered = buffered;
+ _nc_console_get_SBI();
+ WINCONSOLE.save_SBI = WINCONSOLE.SBI;
+ if (!buffered) {
+ save_original_screen();
+ _nc_console_set_scrollback(FALSE, &WINCONSOLE.SBI);
+ }
+ GetConsoleCursorInfo(WINCONSOLE.hdl, &WINCONSOLE.save_CI);
+ T(("... initial cursor is %svisible, %d%%",
+ (WINCONSOLE.save_CI.bVisible ? "" : "not-"),
+ (int) WINCONSOLE.save_CI.dwSize));
+ }
+
+ WINCONSOLE.initialized = TRUE;
+ console_initialized = TRUE;
+ }
+ res = (WINCONSOLE.hdl != INVALID_HANDLE_VALUE);
+ }
+ returnBool(res);
+}
+
+#endif // _NC_WINDOWS
diff --git a/ncurses/tinfo/lib_win32util.c b/ncurses/tinfo/lib_win32util.c
new file mode 100644
index 000000000000..d5bcd70199ed
--- /dev/null
+++ b/ncurses/tinfo/lib_win32util.c
@@ -0,0 +1,134 @@
+/****************************************************************************
+ * Copyright 2020 Thomas E. Dickey *
+ * Copyright 1998-2009,2010 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. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Juergen Pfeifer *
+ * and: Thomas E. Dickey *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_win32util.c,v 1.1 2020/08/14 21:57:01 juergen Exp $")
+
+#ifdef _NC_WINDOWS
+#include <io.h>
+
+#ifdef _NC_CHECK_MINTTY
+#define PSAPI_VERSION 2
+#include <psapi.h>
+#include <tchar.h>
+
+#define array_length(a) (sizeof(a)/sizeof(a[0]))
+
+/* This function tests, whether or not the ncurses application
+ is running as a descendant of MSYS2/cygwin mintty terminal
+ application. mintty doesn't use Windows Console for it's screen
+ I/O, so the native Windows _isatty doesn't recognize it as
+ character device. But we can discover we are at the end of an
+ Pipe and can query the server side of the pipe, looking whether
+ or not this is mintty.
+ For now we terminate the program if we discover that situation.
+ Althogh in theory it would be possible, to remotely manipulate
+ the terminal state of mintty, this is out of scope for now and
+ not worth the significant effort.
+ */
+NCURSES_EXPORT(int)
+_nc_console_checkmintty(int fd, LPHANDLE pMinTTY)
+{
+ HANDLE handle = _nc_console_handle(fd);
+ DWORD dw;
+ int code = 0;
+
+ T((T_CALLED("lib_winhelper::_nc_console_checkmintty(%d, %p)"), fd, pMinTTY));
+
+ if (handle != INVALID_HANDLE_VALUE) {
+ dw = GetFileType(handle);
+ if (dw == FILE_TYPE_PIPE) {
+ if (GetNamedPipeInfo(handle, 0, 0, 0, 0)) {
+ ULONG pPid;
+ /* Requires NT6 */
+ if (GetNamedPipeServerProcessId(handle, &pPid)) {
+ TCHAR buf[MAX_PATH];
+ DWORD len = 0;
+ /* These security attributes may allow us to
+ create a remote thread in mintty to manipulate
+ the terminal state remotely */
+ HANDLE pHandle = OpenProcess(
+ PROCESS_CREATE_THREAD
+ | PROCESS_QUERY_INFORMATION
+ | PROCESS_VM_OPERATION
+ | PROCESS_VM_WRITE
+ | PROCESS_VM_READ,
+ FALSE,
+ pPid);
+ if (pMinTTY)
+ *pMinTTY = INVALID_HANDLE_VALUE;
+ if (pHandle != INVALID_HANDLE_VALUE) {
+ if ((len = GetProcessImageFileName(
+ pHandle,
+ buf,
+ (DWORD)
+ array_length(buf)))) {
+ TCHAR *pos = _tcsrchr(buf, _T('\\'));
+ if (pos) {
+ pos++;
+ if (_tcsnicmp(pos, _TEXT("mintty.exe"), 10)
+ == 0) {
+ if (pMinTTY)
+ *pMinTTY = pHandle;
+ code = 1;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ returnCode(code);
+}
+#endif /* _NC_CHECK_MINTTY */
+
+#define JAN1970 116444736000000000LL /* the value for 01/01/1970 00:00 */
+
+NCURSES_EXPORT(int)
+_nc_gettimeofday(struct timeval *tv, void *tz GCC_UNUSED)
+{
+ union {
+ FILETIME ft;
+ long long since1601; /* time since 1 Jan 1601 in 100ns units */
+ } data;
+
+ GetSystemTimeAsFileTime(&data.ft);
+ tv->tv_usec = (long) ((data.since1601 / 10LL) % 1000000LL);
+ tv->tv_sec = (long) ((data.since1601 - JAN1970) / 10000000LL);
+ return (0);
+}
+
+#endif // _NC_WINDOWS
diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c
index 23574b6626bf..ec2d3364234e 100644
--- a/ncurses/tinfo/parse_entry.c
+++ b/ncurses/tinfo/parse_entry.c
@@ -48,7 +48,7 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: parse_entry.c,v 1.99 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: parse_entry.c,v 1.101 2020/10/24 21:37:13 tom Exp $")
#ifdef LINT
static short const parametrized[] =
@@ -544,10 +544,14 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent)
case STRING:
ptr = _nc_curr_token.tk_valstring;
- if (_nc_syntax == SYN_TERMCAP)
+ if (_nc_syntax == SYN_TERMCAP) {
+ int n = entry_ptr->nte_index;
ptr = _nc_captoinfo(_nc_curr_token.tk_name,
ptr,
- parametrized[entry_ptr->nte_index]);
+ (n < (int) SIZEOF(parametrized))
+ ? parametrized[n]
+ : 0);
+ }
entryp->tterm.Strings[entry_ptr->nte_index] = _nc_save_str(ptr);
break;
diff --git a/ncurses/tinfo/read_entry.c b/ncurses/tinfo/read_entry.c
index 5b570b0fe192..9741e103b7a9 100644
--- a/ncurses/tinfo/read_entry.c
+++ b/ncurses/tinfo/read_entry.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2018-2019,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 *
@@ -42,7 +42,7 @@
#include <tic.h>
-MODULE_ID("$Id: read_entry.c,v 1.157 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: read_entry.c,v 1.159 2021/02/14 00:17:09 tom Exp $")
#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts))
@@ -160,11 +160,11 @@ convert_strings(char *buf, char **Strings, int count, int size, char *table)
/* make sure all strings are NUL terminated */
if (VALID_STRING(Strings[i])) {
- for (p = Strings[i]; p <= table + size; p++)
+ for (p = Strings[i]; p < table + size; p++)
if (*p == '\0')
break;
/* if there is no NUL, ignore the string */
- if (p > table + size)
+ if (p >= table + size)
Strings[i] = ABSENT_STRING;
}
}
@@ -257,7 +257,6 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit)
char buf[MAX_ENTRY_SIZE + 2];
char *string_table;
unsigned want, have;
- bool need_ints;
size_t (*convert_numbers) (char *, NCURSES_INT2 *, int);
int size_of_numbers;
int max_entry_size = MAX_ENTRY_SIZE;
@@ -276,7 +275,7 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit)
returnDB(TGETENT_NO);
}
#if NCURSES_EXT_NUMBERS
- if ((need_ints = (LOW_MSB(buf) == MAGIC2))) {
+ if (LOW_MSB(buf) == MAGIC2) {
convert_numbers = convert_32bits;
size_of_numbers = SIZEOF_INT2;
} else {
@@ -285,7 +284,7 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit)
size_of_numbers = SIZEOF_SHORT;
}
#else
- if ((need_ints = (LOW_MSB(buf) == MAGIC2))) {
+ if (LOW_MSB(buf) == MAGIC2) {
convert_numbers = convert_32bits;
size_of_numbers = SIZEOF_32BITS;
} else {
@@ -666,11 +665,10 @@ decode_hex(const char **source)
{
int result = 0;
int nibble;
- int ch;
for (nibble = 0; nibble < 2; ++nibble) {
+ int ch = UChar(**source);
result <<= 4;
- ch = UChar(**source);
*source += 1;
if (ch >= '0' && ch <= '9') {
ch -= '0';
diff --git a/ncurses/tinfo/tinfo_driver.c b/ncurses/tinfo/tinfo_driver.c
index 7919a9b09276..c28d76415549 100644
--- a/ncurses/tinfo/tinfo_driver.c
+++ b/ncurses/tinfo/tinfo_driver.c
@@ -52,7 +52,7 @@
# endif
#endif
-MODULE_ID("$Id: tinfo_driver.c,v 1.67 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: tinfo_driver.c,v 1.71 2020/12/12 01:06:40 tom Exp $")
/*
* SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS,
@@ -123,6 +123,8 @@ get_baudrate(TERMINAL *termp)
if (GET_TTY(termp->Filedes, &termp->Nttyb) == OK) {
#ifdef TERMIOS
termp->Nttyb.c_oflag &= (unsigned) (~OFLAGS_TABS);
+#elif defined(EXP_WIN32_DRIVER)
+ /* noop */
#else
termp->Nttyb.sg_flags &= (unsigned) (~XTABS);
#endif
@@ -133,6 +135,9 @@ get_baudrate(TERMINAL *termp)
#else /* !USE_OLD_TTY */
#ifdef TERMIOS
my_ospeed = (NCURSES_OSPEED) cfgetospeed(&(termp->Nttyb));
+#elif defined(EXP_WIN32_DRIVER)
+ /* noop */
+ my_ospeed = 0;
#else
my_ospeed = (NCURSES_OSPEED) termp->Nttyb.sg_ospeed;
#endif
@@ -356,23 +361,23 @@ drv_setcolor(TERMINAL_CONTROL_BLOCK * TCB,
if (set_a_foreground) {
TPUTS_TRACE("set_a_foreground");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_1(set_a_foreground, color), 1, outc);
+ TIPARM_1(set_a_foreground, color), 1, outc);
} else {
TPUTS_TRACE("set_foreground");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_1(set_foreground,
- toggled_colors(color)), 1, outc);
+ TIPARM_1(set_foreground,
+ toggled_colors(color)), 1, outc);
}
} else {
if (set_a_background) {
TPUTS_TRACE("set_a_background");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_1(set_a_background, color), 1, outc);
+ TIPARM_1(set_a_background, color), 1, outc);
} else {
TPUTS_TRACE("set_background");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_1(set_background,
- toggled_colors(color)), 1, outc);
+ TIPARM_1(set_background,
+ toggled_colors(color)), 1, outc);
}
}
}
@@ -427,12 +432,19 @@ drv_size(TERMINAL_CONTROL_BLOCK * TCB, int *linep, int *colp)
useTioctl = _nc_prescreen.use_tioctl;
}
+#ifdef EXP_WIN32_DRIVER
+ /* If we are here, then Windows console is used in terminfo mode.
+ We need to figure out the size using the console API
+ */
+ _nc_console_size(linep, colp);
+ T(("screen size: winconsole lines = %d columns = %d", *linep, *colp));
+#else
/* figure out the size of the screen */
T(("screen size: terminfo lines = %d columns = %d", lines, columns));
*linep = (int) lines;
*colp = (int) columns;
-
+#endif
if (useEnv || useTioctl) {
int value;
@@ -602,6 +614,8 @@ drv_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag)
if ((drv_sgmode(TCB, FALSE, &(_term->Nttyb)) == OK)) {
#ifdef TERMIOS
_term->Nttyb.c_oflag &= (unsigned) ~OFLAGS_TABS;
+#elif defined(EXP_WIN32_DRIVER)
+ /* noop */
#else
_term->Nttyb.sg_flags &= (unsigned) ~XTABS;
#endif
@@ -627,6 +641,8 @@ drv_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag)
#ifdef TERMIOS
if (_term->Ottyb.c_oflag & OFLAGS_TABS)
tab = back_tab = NULL;
+#elif defined(EXP_WIN32_DRIVER)
+ /* noop */
#else
if (_term->Ottyb.sg_flags & XTABS)
tab = back_tab = NULL;
@@ -764,10 +780,10 @@ drv_initpair(TERMINAL_CONTROL_BLOCK * TCB, int pair, int f, int b)
tp[b].red, tp[b].green, tp[b].blue));
NCURSES_PUTP2("initialize_pair",
- TPARM_7(initialize_pair,
- pair,
- tp[f].red, tp[f].green, tp[f].blue,
- tp[b].red, tp[b].green, tp[b].blue));
+ TIPARM_7(initialize_pair,
+ pair,
+ tp[f].red, tp[f].green, tp[f].blue,
+ tp[b].red, tp[b].green, tp[b].blue));
}
}
@@ -800,7 +816,7 @@ drv_initcolor(TERMINAL_CONTROL_BLOCK * TCB,
AssertTCB();
if (initialize_color != NULL) {
NCURSES_PUTP2("initialize_color",
- TPARM_4(initialize_color, color, r, g, b));
+ TIPARM_4(initialize_color, color, r, g, b));
}
}
@@ -826,7 +842,7 @@ drv_do_color(TERMINAL_CONTROL_BLOCK * TCB,
if (set_color_pair) {
TPUTS_TRACE("set_color_pair");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_1(set_color_pair, pair), 1, outc);
+ TIPARM_1(set_color_pair, pair), 1, outc);
return;
} else if (sp != 0) {
_nc_pair_content(SP_PARM, pair, &fg, &bg);
@@ -933,11 +949,18 @@ drv_testmouse(TERMINAL_CONTROL_BLOCK * TCB,
} else
#endif
{
+#ifdef EXP_WIN32_DRIVER
+ rc = _nc_console_testmouse(sp,
+ _nc_console_handle(sp->_ifd),
+ delay
+ EVENTLIST_2nd(evl));
+#else
rc = TCBOf(sp)->drv->td_twait(TCBOf(sp),
TWAIT_MASK,
delay,
(int *) 0
EVENTLIST_2nd(evl));
+#endif
#if USE_SYSMOUSE
if ((sp->_mouse_type == M_SYSMOUSE)
&& (sp->_sysmouse_head < sp->_sysmouse_tail)
@@ -1235,16 +1258,25 @@ drv_twait(TERMINAL_CONTROL_BLOCK * TCB,
AssertTCB();
SetSP();
-
+#ifdef EXP_WIN32_DRIVER
+ return _nc_console_twait(sp,
+ _nc_console_handle(sp->_ifd),
+ mode,
+ milliseconds,
+ timeleft EVENTLIST_2nd(evl));
+#else
return _nc_timed_wait(sp, mode, milliseconds, timeleft EVENTLIST_2nd(evl));
+#endif
}
static int
drv_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf)
{
SCREEN *sp;
- unsigned char c2 = 0;
int n;
+#ifndef EXP_WIN32_DRIVER
+ unsigned char c2 = 0;
+#endif
AssertTCB();
assert(buf);
@@ -1254,11 +1286,19 @@ drv_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf)
if ((pthread_self) && (pthread_kill) && (pthread_equal))
_nc_globals.read_thread = pthread_self();
# endif
+#ifdef EXP_WIN32_DRIVER
+ n = _nc_console_read(sp,
+ _nc_console_handle(sp->_ifd),
+ buf);
+#else
n = (int) read(sp->_ifd, &c2, (size_t) 1);
+#endif
#if USE_PTHREADS_EINTR
_nc_globals.read_thread = 0;
#endif
+#ifndef EXP_WIN32_DRIVER
*buf = (int) c2;
+#endif
return n;
}
@@ -1275,6 +1315,8 @@ drv_nap(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int ms)
request = remaining;
}
}
+#elif defined(EXP_WIN32_DRIVER)
+ Sleep((DWORD) ms);
#else
_nc_timed_wait(0, 0, ms, (int *) 0 EVENTLIST_2nd(0));
#endif
@@ -1452,3 +1494,66 @@ NCURSES_EXPORT_VAR (TERM_DRIVER) _nc_TINFO_DRIVER = {
drv_kyExist, /* kyExist */
drv_cursorSet /* cursorSet */
};
+
+#ifdef EXP_WIN32_DRIVER
+/*
+ * The terminfo driver is mandatory and must always be present.
+ * So this is the natural place for the driver initialisation
+ * logic.
+ */
+
+typedef struct DriverEntry {
+ const char *name;
+ TERM_DRIVER *driver;
+} DRIVER_ENTRY;
+
+static DRIVER_ENTRY DriverTable[] =
+{
+#ifdef _NC_WINDOWS
+ {"win32console", &_nc_WIN_DRIVER},
+#endif
+ {"tinfo", &_nc_TINFO_DRIVER} /* must be last */
+};
+
+NCURSES_EXPORT(int)
+_nc_get_driver(TERMINAL_CONTROL_BLOCK * TCB, const char *name, int *errret)
+{
+ int code = ERR;
+ size_t i;
+ TERM_DRIVER *res = (TERM_DRIVER *) 0;
+ TERM_DRIVER *use = 0;
+
+ T((T_CALLED("_nc_get_driver(%p, %s, %p)"),
+ (void *) TCB, NonNull(name), (void *) errret));
+
+ assert(TCB != 0);
+
+ for (i = 0; i < SIZEOF(DriverTable); i++) {
+ res = DriverTable[i].driver;
+#ifdef _NC_WINDOWS
+ if ((i + 1) == SIZEOF(DriverTable)) {
+ /* For Windows >= 10.0.17763 Windows Console interface implements
+ virtual Terminal functionality.
+ If on Windows td_CanHandle returned FALSE although the terminal
+ name is empty, we default to ms-terminal as tinfo TERM type.
+ */
+ if (name == 0 || *name == 0 || (strcmp(name, "unknown") == 0)) {
+ name = MS_TERMINAL;
+ T(("Set TERM=%s", name));
+ }
+ }
+#endif
+ if (strcmp(DriverTable[i].name, res->td_name(TCB)) == 0) {
+ if (res->td_CanHandle(TCB, name, errret)) {
+ use = res;
+ break;
+ }
+ }
+ }
+ if (use != 0) {
+ TCB->drv = use;
+ code = OK;
+ }
+ returnCode(code);
+}
+#endif /* EXP_WIN32_DRIVER */
diff --git a/ncurses/tinfo/trim_sgr0.c b/ncurses/tinfo/trim_sgr0.c
index 4d10529c029f..30c8f75c1e8a 100644
--- a/ncurses/tinfo/trim_sgr0.c
+++ b/ncurses/tinfo/trim_sgr0.c
@@ -37,7 +37,7 @@
#include <tic.h>
-MODULE_ID("$Id: trim_sgr0.c,v 1.18 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: trim_sgr0.c,v 1.20 2020/05/27 23:54:31 tom Exp $")
#undef CUR
#define CUR tp->
@@ -52,7 +52,7 @@ set_attribute_9(TERMTYPE2 *tp, int flag)
const char *value;
char *result;
- value = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag);
+ value = TIPARM_9(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag);
if (PRESENT(value))
result = strdup(value);
else
diff --git a/ncurses/tinfo/write_entry.c b/ncurses/tinfo/write_entry.c
index 138517651e12..5bb7aee7f360 100644
--- a/ncurses/tinfo/write_entry.c
+++ b/ncurses/tinfo/write_entry.c
@@ -51,7 +51,7 @@
#define TRACE_NUM(n) /* nothing */
#endif
-MODULE_ID("$Id: write_entry.c,v 1.115 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: write_entry.c,v 1.116 2020/08/29 16:22:03 juergen Exp $")
static int total_written;
static int total_parts;
@@ -192,7 +192,7 @@ make_db_root(const char *path)
if ((rc = stat(path, &statbuf)) < 0) {
rc = mkdir(path
-#if !defined(_WIN32)
+#ifndef _NC_WINDOWS
,0777
#endif
);
diff --git a/ncurses/trace/lib_trace.c b/ncurses/trace/lib_trace.c
index 2c10b51d0170..5eb87fe0c176 100644
--- a/ncurses/trace/lib_trace.c
+++ b/ncurses/trace/lib_trace.c
@@ -48,7 +48,7 @@
#include <ctype.h>
-MODULE_ID("$Id: lib_trace.c,v 1.95 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_trace.c,v 1.97 2020/08/29 16:22:03 juergen Exp $")
NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */
@@ -213,7 +213,7 @@ _nc_va_tracef(const char *fmt, va_list ap)
# if USE_WEAK_SYMBOLS
if ((pthread_self))
# endif
-#ifdef _WIN32
+#ifdef _NC_WINDOWS
fprintf(fp, "%#lx:", (long) (intptr_t) pthread_self().p);
#else
fprintf(fp, "%#lx:", (long) (intptr_t) pthread_self());
@@ -349,7 +349,7 @@ _nc_fmt_funcptr(char *target, const char *source, size_t size)
if (ch != 0 || (n + 1) >= size)
leading = FALSE;
if (!leading) {
- _nc_SPRINTF(dst, _nc_SLIMIT(TR_FUNC_LEN - (dst - target))
+ _nc_SPRINTF(dst, _nc_SLIMIT(TR_FUNC_LEN - (size_t) (dst - target))
"%02x", ch & 0xff);
dst += 2;
}
diff --git a/ncurses/trace/lib_tracebits.c b/ncurses/trace/lib_tracebits.c
index 14e5d90bd097..4bc50f3b0857 100644
--- a/ncurses/trace/lib_tracebits.c
+++ b/ncurses/trace/lib_tracebits.c
@@ -35,7 +35,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_tracebits.c,v 1.28 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_tracebits.c,v 1.31 2020/11/14 23:38:11 tom Exp $")
#if HAVE_SYS_TERMIO_H
#include <sys/termio.h> /* needed for ISC */
@@ -72,9 +72,15 @@ MODULE_ID("$Id: lib_tracebits.c,v 1.28 2020/02/02 23:34:34 tom Exp $")
#ifdef TRACE
+#if defined(EXP_WIN32_DRIVER)
+#define BITNAMELEN 36
+#else
+#define BITNAMELEN 8
+#endif
+
typedef struct {
unsigned int val;
- const char name[8];
+ const char name[BITNAMELEN];
} BITNAMES;
#define TRACE_BUF_SIZE(num) (_nc_globals.tracebuf_ptr[num].size)
@@ -98,7 +104,7 @@ lookup_bits(char *buf, const BITNAMES * table, const char *label, unsigned int v
}
NCURSES_EXPORT(char *)
-_nc_trace_ttymode(TTY * tty)
+_nc_trace_ttymode(const TTY * tty)
/* describe the state of the terminal control bits exactly */
{
char *buf;
@@ -212,6 +218,36 @@ _nc_trace_ttymode(TTY * tty)
if (tty->c_lflag & ALLLOCAL)
lookup_bits(buf, lflags, "lflags", tty->c_lflag);
}
+#elif defined(EXP_WIN32_DRIVER)
+#define DATA(name) { name, { #name } }
+ static const BITNAMES dwFlagsOut[] =
+ {
+ DATA(ENABLE_PROCESSED_OUTPUT),
+ DATA(ENABLE_WRAP_AT_EOL_OUTPUT),
+ DATA(ENABLE_VIRTUAL_TERMINAL_PROCESSING),
+ DATA(DISABLE_NEWLINE_AUTO_RETURN),
+ DATA(ENABLE_LVB_GRID_WORLDWIDE)
+ };
+ static const BITNAMES dwFlagsIn[] =
+ {
+ DATA(ENABLE_PROCESSED_INPUT),
+ DATA(ENABLE_LINE_INPUT),
+ DATA(ENABLE_ECHO_INPUT),
+ DATA(ENABLE_MOUSE_INPUT),
+ DATA(ENABLE_INSERT_MODE),
+ DATA(ENABLE_QUICK_EDIT_MODE),
+ DATA(ENABLE_EXTENDED_FLAGS),
+ DATA(ENABLE_AUTO_POSITION),
+ DATA(ENABLE_VIRTUAL_TERMINAL_INPUT)
+ };
+
+ buf = _nc_trace_buf(0,
+ 8 + sizeof(dwFlagsOut) +
+ 8 + sizeof(dwFlagsIn));
+ if (buf != 0) {
+ lookup_bits(buf, dwFlagsIn, "dwIn", tty->dwFlagIn);
+ lookup_bits(buf, dwFlagsOut, "dwOut", tty->dwFlagOut);
+ }
#else
/* reference: ttcompat(4M) on SunOS 4.1 */
#ifndef EVENP
diff --git a/ncurses/tty/hashmap.c b/ncurses/tty/hashmap.c
index 9d1e482b00eb..3f124c96c896 100644
--- a/ncurses/tty/hashmap.c
+++ b/ncurses/tty/hashmap.c
@@ -74,7 +74,7 @@ AUTHOR
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: hashmap.c,v 1.68 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: hashmap.c,v 1.69 2020/05/31 17:50:48 tom Exp $")
#ifdef HASHDEBUG
@@ -88,7 +88,7 @@ MODULE_ID("$Id: hashmap.c,v 1.68 2020/02/02 23:34:34 tom Exp $")
# undef screen_lines
# define screen_lines(sp) MAXLINES
# define TEXTWIDTH(sp) 1
-int oldnums[MAXLINES], reallines[MAXLINES];
+static int oldnums[MAXLINES], reallines[MAXLINES];
static NCURSES_CH_T oldtext[MAXLINES][TEXTWIDTH(sp)];
static NCURSES_CH_T newtext[MAXLINES][TEXTWIDTH(sp)];
# define OLDNUM(sp,n) oldnums[n]
diff --git a/ncurses/tty/lib_mvcur.c b/ncurses/tty/lib_mvcur.c
index 5382b3bfe37b..dd0dc3d9b712 100644
--- a/ncurses/tty/lib_mvcur.c
+++ b/ncurses/tty/lib_mvcur.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2018-2019,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 *
@@ -160,7 +160,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_mvcur.c,v 1.151 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_mvcur.c,v 1.155 2021/02/06 13:53:41 tom Exp $")
#define WANT_CHAR(sp, y, x) NewScreen(sp)->_line[y].text[x] /* desired state */
@@ -279,8 +279,8 @@ reset_scroll_region(NCURSES_SP_DCL0)
{
if (change_scroll_region) {
NCURSES_PUTP2("change_scroll_region",
- TPARM_2(change_scroll_region,
- 0, screen_lines(SP_PARM) - 1));
+ TIPARM_2(change_scroll_region,
+ 0, screen_lines(SP_PARM) - 1));
}
}
@@ -399,13 +399,13 @@ NCURSES_SP_NAME(_nc_mvcur_init) (NCURSES_SP_DCL0)
* All these averages depend on the assumption that all parameter values
* are equally probable.
*/
- SP_PARM->_cup_cost = CostOf(TPARM_2(SP_PARM->_address_cursor, 23, 23), 1);
- SP_PARM->_cub_cost = CostOf(TPARM_1(parm_left_cursor, 23), 1);
- SP_PARM->_cuf_cost = CostOf(TPARM_1(parm_right_cursor, 23), 1);
- SP_PARM->_cud_cost = CostOf(TPARM_1(parm_down_cursor, 23), 1);
- SP_PARM->_cuu_cost = CostOf(TPARM_1(parm_up_cursor, 23), 1);
- SP_PARM->_hpa_cost = CostOf(TPARM_1(column_address, 23), 1);
- SP_PARM->_vpa_cost = CostOf(TPARM_1(row_address, 23), 1);
+ SP_PARM->_cup_cost = CostOf(TIPARM_2(SP_PARM->_address_cursor, 23, 23), 1);
+ SP_PARM->_cub_cost = CostOf(TIPARM_1(parm_left_cursor, 23), 1);
+ SP_PARM->_cuf_cost = CostOf(TIPARM_1(parm_right_cursor, 23), 1);
+ SP_PARM->_cud_cost = CostOf(TIPARM_1(parm_down_cursor, 23), 1);
+ SP_PARM->_cuu_cost = CostOf(TIPARM_1(parm_up_cursor, 23), 1);
+ SP_PARM->_hpa_cost = CostOf(TIPARM_1(column_address, 23), 1);
+ SP_PARM->_vpa_cost = CostOf(TIPARM_1(row_address, 23), 1);
/* non-parameterized screen-update strings */
SP_PARM->_ed_cost = NormalizedCost(clr_eos, 1);
@@ -422,17 +422,16 @@ NCURSES_SP_NAME(_nc_mvcur_init) (NCURSES_SP_DCL0)
SP_PARM->_el_cost = 0;
/* parameterized screen-update strings */
- SP_PARM->_dch_cost = NormalizedCost(TPARM_1(parm_dch, 23), 1);
- SP_PARM->_ich_cost = NormalizedCost(TPARM_1(parm_ich, 23), 1);
- SP_PARM->_ech_cost = NormalizedCost(TPARM_1(erase_chars, 23), 1);
- SP_PARM->_rep_cost = NormalizedCost(TPARM_2(repeat_char, ' ', 23), 1);
-
- SP_PARM->_cup_ch_cost = NormalizedCost(
- TPARM_2(SP_PARM->_address_cursor,
- 23, 23),
- 1);
- SP_PARM->_hpa_ch_cost = NormalizedCost(TPARM_1(column_address, 23), 1);
- SP_PARM->_cuf_ch_cost = NormalizedCost(TPARM_1(parm_right_cursor, 23), 1);
+ SP_PARM->_dch_cost = NormalizedCost(TIPARM_1(parm_dch, 23), 1);
+ SP_PARM->_ich_cost = NormalizedCost(TIPARM_1(parm_ich, 23), 1);
+ SP_PARM->_ech_cost = NormalizedCost(TIPARM_1(erase_chars, 23), 1);
+ SP_PARM->_rep_cost = NormalizedCost(TIPARM_2(repeat_char, ' ', 23), 1);
+
+ SP_PARM->_cup_ch_cost = NormalizedCost(TIPARM_2(SP_PARM->_address_cursor,
+ 23, 23),
+ 1);
+ SP_PARM->_hpa_ch_cost = NormalizedCost(TIPARM_1(column_address, 23), 1);
+ SP_PARM->_cuf_ch_cost = NormalizedCost(TIPARM_1(parm_right_cursor, 23), 1);
SP_PARM->_inline_cost = min(SP_PARM->_cup_ch_cost,
min(SP_PARM->_hpa_ch_cost,
SP_PARM->_cuf_ch_cost));
@@ -563,7 +562,7 @@ relative_move(NCURSES_SP_DCLx
vcost = INFINITY;
if (row_address != 0
- && _nc_safe_strcat(target, TPARM_1(row_address, to_y))) {
+ && _nc_safe_strcat(target, TIPARM_1(row_address, to_y))) {
vcost = SP_PARM->_vpa_cost;
}
@@ -573,12 +572,12 @@ relative_move(NCURSES_SP_DCLx
if (parm_down_cursor
&& SP_PARM->_cud_cost < vcost
&& _nc_safe_strcat(_nc_str_copy(target, &save),
- TPARM_1(parm_down_cursor, n))) {
+ TIPARM_1(parm_down_cursor, n))) {
vcost = SP_PARM->_cud_cost;
}
if (cursor_down
- && (*cursor_down != '\n' || SP_PARM->_nl)
+ && (*cursor_down != '\n')
&& (n * SP_PARM->_cud1_cost < vcost)) {
vcost = repeated_append(_nc_str_copy(target, &save), 0,
SP_PARM->_cud1_cost, n, cursor_down);
@@ -589,7 +588,7 @@ relative_move(NCURSES_SP_DCLx
if (parm_up_cursor
&& SP_PARM->_cuu_cost < vcost
&& _nc_safe_strcat(_nc_str_copy(target, &save),
- TPARM_1(parm_up_cursor, n))) {
+ TIPARM_1(parm_up_cursor, n))) {
vcost = SP_PARM->_cuu_cost;
}
@@ -613,7 +612,7 @@ relative_move(NCURSES_SP_DCLx
if (column_address
&& _nc_safe_strcat(_nc_str_copy(target, &save),
- TPARM_1(column_address, to_x))) {
+ TIPARM_1(column_address, to_x))) {
hcost = SP_PARM->_hpa_cost;
}
@@ -623,7 +622,7 @@ relative_move(NCURSES_SP_DCLx
if (parm_right_cursor
&& SP_PARM->_cuf_cost < hcost
&& _nc_safe_strcat(_nc_str_copy(target, &save),
- TPARM_1(parm_right_cursor, n))) {
+ TIPARM_1(parm_right_cursor, n))) {
hcost = SP_PARM->_cuf_cost;
}
@@ -716,7 +715,7 @@ relative_move(NCURSES_SP_DCLx
if (parm_left_cursor
&& SP_PARM->_cub_cost < hcost
&& _nc_safe_strcat(_nc_str_copy(target, &save),
- TPARM_1(parm_left_cursor, n))) {
+ TIPARM_1(parm_left_cursor, n))) {
hcost = SP_PARM->_cub_cost;
}
@@ -793,7 +792,8 @@ onscreen_mvcur(NCURSES_SP_DCLx
#define InitResult _nc_str_init(&result, buffer, sizeof(buffer))
/* tactic #0: use direct cursor addressing */
- if (_nc_safe_strcpy(InitResult, TPARM_2(SP_PARM->_address_cursor, ynew, xnew))) {
+ if (_nc_safe_strcpy(InitResult, TIPARM_2(SP_PARM->_address_cursor,
+ ynew, xnew))) {
tactic = 0;
usecost = SP_PARM->_cup_cost;
@@ -962,7 +962,7 @@ _nc_real_mvcur(NCURSES_SP_DCLx
NCURSES_CH_T oldattr;
int code;
- TR(TRACE_CALLS | TRACE_MOVE, (T_CALLED("_nc_tinfo_mvcur(%p,%d,%d,%d,%d)"),
+ TR(TRACE_CALLS | TRACE_MOVE, (T_CALLED("_nc_real_mvcur(%p,%d,%d,%d,%d)"),
(void *) SP_PARM, yold, xold, ynew, xnew));
if (SP_PARM == 0) {
@@ -997,37 +997,28 @@ _nc_real_mvcur(NCURSES_SP_DCLx
if (xold >= screen_columns(SP_PARM)) {
- if (SP_PARM->_nl) {
- int l = (xold + 1) / screen_columns(SP_PARM);
+ int l = (xold + 1) / screen_columns(SP_PARM);
- yold += l;
- if (yold >= screen_lines(SP_PARM))
- l -= (yold - screen_lines(SP_PARM) - 1);
+ yold += l;
+ if (yold >= screen_lines(SP_PARM))
+ l -= (yold - screen_lines(SP_PARM) - 1);
- if (l > 0) {
- if (carriage_return) {
- NCURSES_PUTP2("carriage_return", carriage_return);
- } else {
- myOutCh(NCURSES_SP_ARGx '\r');
- }
- xold = 0;
+ if (l > 0) {
+ if (carriage_return) {
+ NCURSES_PUTP2("carriage_return", carriage_return);
+ } else {
+ myOutCh(NCURSES_SP_ARGx '\r');
+ }
+ xold = 0;
- while (l > 0) {
- if (newline) {
- NCURSES_PUTP2("newline", newline);
- } else {
- myOutCh(NCURSES_SP_ARGx '\n');
- }
- l--;
+ while (l > 0) {
+ if (newline) {
+ NCURSES_PUTP2("newline", newline);
+ } else {
+ myOutCh(NCURSES_SP_ARGx '\n');
}
+ l--;
}
- } else {
- /*
- * If caller set nonl(), we cannot really use newlines to
- * position to the next row.
- */
- xold = -1;
- yold = -1;
}
}
diff --git a/ncurses/tty/lib_twait.c b/ncurses/tty/lib_twait.c
index 3ab168ddd346..a7604b3e293b 100644
--- a/ncurses/tty/lib_twait.c
+++ b/ncurses/tty/lib_twait.c
@@ -71,12 +71,12 @@
# include <sys/select.h>
# endif
#endif
-#ifdef _WIN32
+#if HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#undef CUR
-MODULE_ID("$Id: lib_twait.c,v 1.74 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_twait.c,v 1.75 2020/02/29 15:46:00 anonymous.maarten Exp $")
static long
_nc_gettime(TimeType * t0, int first)
diff --git a/ncurses/tty/lib_vidattr.c b/ncurses/tty/lib_vidattr.c
index c752919bf661..15e7397d5dbb 100644
--- a/ncurses/tty/lib_vidattr.c
+++ b/ncurses/tty/lib_vidattr.c
@@ -70,7 +70,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_vidattr.c,v 1.76 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_vidattr.c,v 1.78 2020/05/27 23:56:32 tom Exp $")
#define doPut(mode) \
TPUTS_TRACE(#mode); \
@@ -258,16 +258,16 @@ NCURSES_SP_NAME(vidputs) (NCURSES_SP_DCLx
if (turn_on || turn_off) {
TPUTS_TRACE("set_attributes");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- tparm(set_attributes,
- (newmode & A_STANDOUT) != 0,
- (newmode & A_UNDERLINE) != 0,
- (newmode & A_REVERSE) != 0,
- (newmode & A_BLINK) != 0,
- (newmode & A_DIM) != 0,
- (newmode & A_BOLD) != 0,
- (newmode & A_INVIS) != 0,
- (newmode & A_PROTECT) != 0,
- (newmode & A_ALTCHARSET) != 0),
+ TIPARM_9(set_attributes,
+ (newmode & A_STANDOUT) != 0,
+ (newmode & A_UNDERLINE) != 0,
+ (newmode & A_REVERSE) != 0,
+ (newmode & A_BLINK) != 0,
+ (newmode & A_DIM) != 0,
+ (newmode & A_BOLD) != 0,
+ (newmode & A_INVIS) != 0,
+ (newmode & A_PROTECT) != 0,
+ (newmode & A_ALTCHARSET) != 0),
1, outc);
PreviousAttr &= ALL_BUT_COLOR;
}
diff --git a/ncurses/tty/tty_update.c b/ncurses/tty/tty_update.c
index 8626c79e69e2..20f9349bd688 100644
--- a/ncurses/tty/tty_update.c
+++ b/ncurses/tty/tty_update.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2018-2019,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 *
@@ -85,7 +85,7 @@
#include <ctype.h>
-MODULE_ID("$Id: tty_update.c,v 1.305 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.310 2021/02/06 14:24:38 tom Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
@@ -117,14 +117,14 @@ static int ClrBottom(SCREEN *, int total);
static void ClearScreen(SCREEN *, NCURSES_CH_T blank);
static void ClrUpdate(SCREEN *);
static void DelChar(SCREEN *, int count);
-static void InsStr(SCREEN *, NCURSES_CH_T * line, int count);
+static void InsStr(SCREEN *, NCURSES_CH_T *line, int count);
static void TransformLine(SCREEN *, int const lineno);
#else
static int ClrBottom(int total);
static void ClearScreen(NCURSES_CH_T blank);
static void ClrUpdate(void);
static void DelChar(int count);
-static void InsStr(NCURSES_CH_T * line, int count);
+static void InsStr(NCURSES_CH_T *line, int count);
static void TransformLine(int const lineno);
#endif
@@ -136,7 +136,7 @@ static void TransformLine(int const lineno);
****************************************************************************/
static void
-position_check(NCURSES_SP_DCLx int expected_y, int expected_x, char *legend)
+position_check(NCURSES_SP_DCLx int expected_y, int expected_x, const char *legend)
/* check to see if the real cursor position matches the virtual */
{
char buf[20];
@@ -170,9 +170,9 @@ position_check(NCURSES_SP_DCLx int expected_y, int expected_x, char *legend)
if (y - 1 != expected_y || x - 1 != expected_x) {
NCURSES_SP_NAME(beep) (NCURSES_SP_ARG);
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- tparm("\033[%d;%dH",
- expected_y + 1,
- expected_x + 1),
+ TIPARM_2("\033[%d;%dH",
+ expected_y + 1,
+ expected_x + 1),
1, NCURSES_SP_NAME(_nc_outch));
_tracef("position seen (%d, %d) doesn't match expected one (%d, %d) in %s",
y - 1, x - 1, expected_y, expected_x, legend);
@@ -429,11 +429,12 @@ PutCharLR(NCURSES_SP_DCLx const ARG_CH_T ch)
/* we can put the char directly */
PutAttrChar(NCURSES_SP_ARGx ch);
} else if (enter_am_mode && exit_am_mode) {
+ int oldcol = SP_PARM->_curscol;
/* we can suppress automargin */
NCURSES_PUTP2("exit_am_mode", exit_am_mode);
PutAttrChar(NCURSES_SP_ARGx ch);
- SP_PARM->_curscol--;
+ SP_PARM->_curscol = oldcol;
position_check(NCURSES_SP_ARGx
SP_PARM->_cursrow,
SP_PARM->_curscol,
@@ -567,7 +568,7 @@ can_clear_with(NCURSES_SP_DCLx ARG_CH_T ch)
* This code is optimized using ech and rep.
*/
static int
-EmitRange(NCURSES_SP_DCLx const NCURSES_CH_T * ntext, int num)
+EmitRange(NCURSES_SP_DCLx const NCURSES_CH_T *ntext, int num)
{
int i;
@@ -605,7 +606,7 @@ EmitRange(NCURSES_SP_DCLx const NCURSES_CH_T * ntext, int num)
&& runcount > SP_PARM->_ech_cost + SP_PARM->_cup_ch_cost
&& can_clear_with(NCURSES_SP_ARGx CHREF(ntext0))) {
UpdateAttrs(SP_PARM, ntext0);
- NCURSES_PUTP2("erase_chars", TPARM_1(erase_chars, runcount));
+ NCURSES_PUTP2("erase_chars", TIPARM_1(erase_chars, runcount));
/*
* If this is the last part of the given interval,
@@ -620,6 +621,9 @@ EmitRange(NCURSES_SP_DCLx const NCURSES_CH_T * ntext, int num)
return 1; /* cursor stays in the middle */
}
} else if (repeat_char != 0 &&
+#if BSD_TPUTS
+ !isdigit(UChar(CharOf(ntext0))) &&
+#endif
#if USE_WIDEC_SUPPORT
(!SP_PARM->_screen_unicode &&
(CharOf(ntext0) < ((AttrOf(ntext0) & A_ALTCHARSET)
@@ -645,9 +649,9 @@ EmitRange(NCURSES_SP_DCLx const NCURSES_CH_T * ntext, int num)
AttrOf(ntext0) | A_ALTCHARSET);
}
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_2(repeat_char,
- CharOf(temp),
- rep_count),
+ TIPARM_2(repeat_char,
+ CharOf(temp),
+ rep_count),
1,
NCURSES_SP_NAME(_nc_outch));
SP_PARM->_curscol += rep_count;
@@ -679,8 +683,8 @@ EmitRange(NCURSES_SP_DCLx const NCURSES_CH_T * ntext, int num)
*/
static int
PutRange(NCURSES_SP_DCLx
- const NCURSES_CH_T * otext,
- const NCURSES_CH_T * ntext,
+ const NCURSES_CH_T *otext,
+ const NCURSES_CH_T *ntext,
int row,
int first, int last)
{
@@ -1701,7 +1705,7 @@ ClearScreen(NCURSES_SP_DCLx NCURSES_CH_T blank)
*/
static void
-InsStr(NCURSES_SP_DCLx NCURSES_CH_T * line, int count)
+InsStr(NCURSES_SP_DCLx NCURSES_CH_T *line, int count)
{
TR(TRACE_UPDATE, ("InsStr(%p, %p,%d) called",
(void *) SP_PARM,
@@ -1713,7 +1717,7 @@ InsStr(NCURSES_SP_DCLx NCURSES_CH_T * line, int count)
if (parm_ich) {
TPUTS_TRACE("parm_ich");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_1(parm_ich, count),
+ TIPARM_1(parm_ich, count),
1,
NCURSES_SP_NAME(_nc_outch));
while (count > 0) {
@@ -1766,7 +1770,7 @@ DelChar(NCURSES_SP_DCLx int count)
if (parm_dch) {
TPUTS_TRACE("parm_dch");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_1(parm_dch, count),
+ TIPARM_1(parm_dch, count),
1,
NCURSES_SP_NAME(_nc_outch));
} else {
@@ -1835,7 +1839,7 @@ scroll_csr_forward(NCURSES_SP_DCLx
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("parm_index");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_2(parm_index, n, 0),
+ TIPARM_1(parm_index, n),
n,
NCURSES_SP_NAME(_nc_outch));
} else if (parm_delete_line && bot == maxy) {
@@ -1843,7 +1847,7 @@ scroll_csr_forward(NCURSES_SP_DCLx
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("parm_delete_line");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_2(parm_delete_line, n, 0),
+ TIPARM_1(parm_delete_line, n),
n,
NCURSES_SP_NAME(_nc_outch));
} else if (scroll_forward && top == miny && bot == maxy) {
@@ -1900,7 +1904,7 @@ scroll_csr_backward(NCURSES_SP_DCLx
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("parm_rindex");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_2(parm_rindex, n, 0),
+ TIPARM_1(parm_rindex, n),
n,
NCURSES_SP_NAME(_nc_outch));
} else if (parm_insert_line && bot == maxy) {
@@ -1908,7 +1912,7 @@ scroll_csr_backward(NCURSES_SP_DCLx
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("parm_insert_line");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_2(parm_insert_line, n, 0),
+ TIPARM_1(parm_insert_line, n),
n,
NCURSES_SP_NAME(_nc_outch));
} else if (scroll_reverse && top == miny && bot == maxy) {
@@ -1956,7 +1960,7 @@ scroll_idl(NCURSES_SP_DCLx int n, int del, int ins, NCURSES_CH_T blank)
} else if (parm_delete_line) {
TPUTS_TRACE("parm_delete_line");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_2(parm_delete_line, n, 0),
+ TIPARM_1(parm_delete_line, n),
n,
NCURSES_SP_NAME(_nc_outch));
} else { /* if (delete_line) */
@@ -1972,7 +1976,7 @@ scroll_idl(NCURSES_SP_DCLx int n, int del, int ins, NCURSES_CH_T blank)
} else if (parm_insert_line) {
TPUTS_TRACE("parm_insert_line");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_2(parm_insert_line, n, 0),
+ TIPARM_1(parm_insert_line, n),
n,
NCURSES_SP_NAME(_nc_outch));
} else { /* if (insert_line) */
@@ -2037,7 +2041,7 @@ NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_DCLx
NCURSES_PUTP2("save_cursor", save_cursor);
}
NCURSES_PUTP2("change_scroll_region",
- TPARM_2(change_scroll_region, top, bot));
+ TIPARM_2(change_scroll_region, top, bot));
if (cursor_saved) {
NCURSES_PUTP2("restore_cursor", restore_cursor);
} else {
@@ -2047,7 +2051,7 @@ NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_DCLx
res = scroll_csr_forward(NCURSES_SP_ARGx n, top, bot, top, bot, blank);
NCURSES_PUTP2("change_scroll_region",
- TPARM_2(change_scroll_region, 0, maxy));
+ TIPARM_2(change_scroll_region, 0, maxy));
SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
@@ -2083,7 +2087,7 @@ NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_DCLx
NCURSES_PUTP2("save_cursor", save_cursor);
}
NCURSES_PUTP2("change_scroll_region",
- TPARM_2(change_scroll_region, top, bot));
+ TIPARM_2(change_scroll_region, top, bot));
if (cursor_saved) {
NCURSES_PUTP2("restore_cursor", restore_cursor);
} else {
@@ -2094,7 +2098,7 @@ NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_DCLx
-n, top, bot, top, bot, blank);
NCURSES_PUTP2("change_scroll_region",
- TPARM_2(change_scroll_region, 0, maxy));
+ TIPARM_2(change_scroll_region, 0, maxy));
SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
diff --git a/ncurses/wcwidth.h b/ncurses/wcwidth.h
index e261170188b1..ccae41a9b994 100644
--- a/ncurses/wcwidth.h
+++ b/ncurses/wcwidth.h
@@ -119,7 +119,7 @@ static int bisearch(wchar_t ucs, const struct interval *table, int max) {
* in ISO 10646.
*/
-int mk_wcwidth(wchar_t ucs)
+NCURSES_EXPORT(int) mk_wcwidth(wchar_t ucs)
{
/* sorted list of non-overlapping intervals of non-spacing characters */
/* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
@@ -207,7 +207,7 @@ int mk_wcwidth(wchar_t ucs)
}
-int mk_wcswidth(const wchar_t *pwcs, size_t n)
+NCURSES_EXPORT(int) mk_wcswidth(const wchar_t *pwcs, size_t n)
{
int w, width = 0;
@@ -230,7 +230,7 @@ int mk_wcswidth(const wchar_t *pwcs, size_t n)
* the traditional terminal character-width behaviour. It is not
* otherwise recommended for general use.
*/
-int mk_wcwidth_cjk(wchar_t ucs)
+NCURSES_EXPORT(int) mk_wcwidth_cjk(wchar_t ucs)
{
/* sorted list of non-overlapping intervals of East Asian Ambiguous
* characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */
@@ -298,7 +298,7 @@ int mk_wcwidth_cjk(wchar_t ucs)
}
-int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
+NCURSES_EXPORT(int) mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
{
int w, width = 0;
diff --git a/ncurses/widechar/lib_cchar.c b/ncurses/widechar/lib_cchar.c
index ed1d236d900c..62a1113ecaa6 100644
--- a/ncurses/widechar/lib_cchar.c
+++ b/ncurses/widechar/lib_cchar.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-2020,2021 Thomas E. Dickey *
* Copyright 2001-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -35,8 +35,9 @@
*/
#include <curses.priv.h>
+#include <wchar.h>
-MODULE_ID("$Id: lib_cchar.c,v 1.33 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_cchar.c,v 1.35 2021/01/17 00:04:08 tom Exp $")
/*
* The SuSv2 description leaves some room for interpretation. We'll assume wch
@@ -55,7 +56,7 @@ setcchar(cchar_t *wcval,
int color_pair = pair_arg;
unsigned len;
- TR(TRACE_CCALLS, (T_CALLED("setcchar(%p,%s,%lu,%d,%p)"),
+ TR(TRACE_CCALLS, (T_CALLED("setcchar(%p,%s,attrs=%lu,pair=%d,%p)"),
(void *) wcval, _nc_viswbuf(wch),
(unsigned long) attrs, color_pair, opts));
@@ -113,7 +114,12 @@ getcchar(const cchar_t *wcval,
(void *) pair_arg,
opts));
- if (opts == NULL && wcval != NULL) {
+#if !NCURSES_EXT_COLORS
+ if (opts != NULL) {
+ ; /* empty */
+ } else
+#endif
+ if (wcval != NULL) {
wchar_t *wp;
int len;
@@ -130,6 +136,8 @@ getcchar(const cchar_t *wcval,
} else if (attrs == 0 || pair_arg == 0) {
code = ERR;
} else if (len >= 0) {
+ TR(TRACE_CCALLS, ("copy %d wchars, first is %s", len,
+ _tracecchar_t(wcval)));
*attrs = AttrOf(*wcval) & A_ATTRIBUTES;
color_pair = GetPair(*wcval);
get_extended_pair(opts, color_pair);
diff --git a/ncurses/widechar/lib_ins_wch.c b/ncurses/widechar/lib_ins_wch.c
index a744f5bf138c..f75361081b62 100644
--- a/ncurses/widechar/lib_ins_wch.c
+++ b/ncurses/widechar/lib_ins_wch.c
@@ -40,7 +40,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_ins_wch.c,v 1.24 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_ins_wch.c,v 1.25 2020/12/05 20:04:59 tom Exp $")
/*
* Insert the given character, updating the current location to simplify
@@ -111,7 +111,7 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
if (win != 0
&& wstr != 0) {
if (n < 1)
- n = (int) wcslen(wstr);
+ n = INT_MAX;
code = OK;
if (n > 0) {
@@ -120,7 +120,7 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
NCURSES_SIZE_T oy = win->_cury;
NCURSES_SIZE_T ox = win->_curx;
- for (cp = wstr; ((cp - wstr) < n) && *cp; cp++) {
+ for (cp = wstr; (*cp != L'\0') && ((cp - wstr) < n); cp++) {
int len = _nc_wacs_width(*cp);
if ((len >= 0 && len != 1) || !is7bits(*cp)) {
diff --git a/ncurses/widechar/lib_vid_attr.c b/ncurses/widechar/lib_vid_attr.c
index e167bebeec64..2d9531f1b864 100644
--- a/ncurses/widechar/lib_vid_attr.c
+++ b/ncurses/widechar/lib_vid_attr.c
@@ -37,7 +37,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_vid_attr.c,v 1.28 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_vid_attr.c,v 1.30 2020/05/27 23:54:31 tom Exp $")
#define doPut(mode) \
TPUTS_TRACE(#mode); \
@@ -191,16 +191,16 @@ NCURSES_SP_NAME(vid_puts) (NCURSES_SP_DCLx
if (turn_on || turn_off) {
TPUTS_TRACE("set_attributes");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
- TPARM_9(set_attributes,
- (newmode & A_STANDOUT) != 0,
- (newmode & A_UNDERLINE) != 0,
- (newmode & A_REVERSE) != 0,
- (newmode & A_BLINK) != 0,
- (newmode & A_DIM) != 0,
- (newmode & A_BOLD) != 0,
- (newmode & A_INVIS) != 0,
- (newmode & A_PROTECT) != 0,
- (newmode & A_ALTCHARSET) != 0),
+ TIPARM_9(set_attributes,
+ (newmode & A_STANDOUT) != 0,
+ (newmode & A_UNDERLINE) != 0,
+ (newmode & A_REVERSE) != 0,
+ (newmode & A_BLINK) != 0,
+ (newmode & A_DIM) != 0,
+ (newmode & A_BOLD) != 0,
+ (newmode & A_INVIS) != 0,
+ (newmode & A_PROTECT) != 0,
+ (newmode & A_ALTCHARSET) != 0),
1, outc);
previous_attr &= ALL_BUT_COLOR;
previous_pair = 0;
@@ -264,7 +264,6 @@ NCURSES_SP_NAME(vid_puts) (NCURSES_SP_DCLx
TurnOn(A_VERTICAL, enter_vertical_hl_mode);
#endif
/* *INDENT-ON* */
-
}
if (reverse)
diff --git a/ncurses/widechar/widechars.c b/ncurses/widechar/widechars.c
index 35774793216d..d05ba98a8265 100644
--- a/ncurses/widechar/widechars.c
+++ b/ncurses/widechar/widechars.c
@@ -31,9 +31,9 @@
#if USE_WIDEC_SUPPORT
-MODULE_ID("$Id: widechars.c,v 1.7 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: widechars.c,v 1.9 2020/08/29 16:22:03 juergen Exp $")
-#if defined(_WIN32)
+#if (defined(_NC_WINDOWS)) && !defined(_NC_MSC)
/*
* MinGW has wide-character functions, but they do not work correctly.
*/
@@ -148,6 +148,6 @@ _nc_wctomb(char *s, wchar_t wc)
return result;
}
-#endif /* _WIN32 */
+#endif /* _NC_WINDOWS */
#endif /* USE_WIDEC_SUPPORT */
diff --git a/ncurses/win32con/gettimeofday.c b/ncurses/win32con/gettimeofday.c
index 8fad9a625416..94be7b563b95 100644
--- a/ncurses/win32con/gettimeofday.c
+++ b/ncurses/win32con/gettimeofday.c
@@ -36,11 +36,11 @@
#include <windows.h>
-MODULE_ID("$Id: gettimeofday.c,v 1.4 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: gettimeofday.c,v 1.6 2020/07/11 21:03:53 tom Exp $")
#define JAN1970 116444736000000000LL /* the value for 01/01/1970 00:00 */
-int
+NCURSES_EXPORT(int)
gettimeofday(struct timeval *tv, void *tz GCC_UNUSED)
{
union {
diff --git a/ncurses/win32con/wcwidth.c b/ncurses/win32con/wcwidth.c
index 17ebaa61a145..55843662e8aa 100644
--- a/ncurses/win32con/wcwidth.c
+++ b/ncurses/win32con/wcwidth.c
@@ -28,7 +28,7 @@
****************************************************************************/
#include <curses.priv.h>
-MODULE_ID("$Id: wcwidth.c,v 1.3 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: wcwidth.c,v 1.4 2020/07/11 21:02:10 tom Exp $")
#if USE_WIDEC_SUPPORT
#define mk_wcwidth(ucs) _nc_wcwidth(ucs)
@@ -36,10 +36,10 @@ MODULE_ID("$Id: wcwidth.c,v 1.3 2020/02/02 23:34:34 tom Exp $")
#define mk_wcwidth_cjk(ucs) _nc_wcwidth_cjk(ucs)
#define mk_wcswidth_cjk(pwcs, n) _nc_wcswidth_cjk(pwcs, n)
-extern int mk_wcwidth(wchar_t);
-extern int mk_wcswidth(const wchar_t *, size_t);
-extern int mk_wcwidth_cjk(wchar_t);
-extern int mk_wcswidth_cjk(const wchar_t *, size_t);
+NCURSES_EXPORT(int) mk_wcwidth(wchar_t);
+NCURSES_EXPORT(int) mk_wcswidth(const wchar_t *, size_t);
+NCURSES_EXPORT(int) mk_wcwidth_cjk(wchar_t);
+NCURSES_EXPORT(int) mk_wcswidth_cjk(const wchar_t *, size_t);
#include <wcwidth.h>
#else
diff --git a/ncurses/win32con/win32_driver.c b/ncurses/win32con/win32_driver.c
new file mode 100644
index 000000000000..45aadf2f596a
--- /dev/null
+++ b/ncurses/win32con/win32_driver.c
@@ -0,0 +1,1221 @@
+/****************************************************************************
+ * Copyright 2018,2020 Thomas E. Dickey *
+ * Copyright 2008-2016,2017 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. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Juergen Pfeifer *
+ * and: Thomas E. Dickey *
+ ****************************************************************************/
+
+/*
+ * TODO - improve screen-repainting performance, using implied wraparound to reduce write's
+ * TODO - make it optional whether screen is restored or not when non-buffered
+ */
+
+#include <curses.priv.h>
+#ifdef _NC_WINDOWS
+#if (defined(__MINGW32__) || defined(__MINGW64__))
+#include <wchar.h>
+#else
+#include <tchar.h>
+#endif
+#include <io.h>
+
+#define CUR TerminalType(my_term).
+
+MODULE_ID("$Id: win32_driver.c,v 1.2 2020/11/21 23:35:56 tom Exp $")
+
+#define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE)
+#define EXP_OPTIMIZE 0
+
+static bool console_initialized = FALSE;
+
+#define AssertTCB() assert(TCB != 0 && (TCB->magic == WINMAGIC))
+#define validateConsoleHandle() (AssertTCB() , console_initialized ||\
+ (console_initialized=\
+ _nc_console_checkinit(TRUE,FALSE)))
+#define SetSP() assert(TCB->csp != 0); sp = TCB->csp; (void) sp
+#define AdjustY() (WINCONSOLE.buffered ?\
+ 0 : (int) WINCONSOLE.SBI.srWindow.Top)
+#define RevAttr(attr) (WORD) (((attr) & 0xff00) | \
+ ((((attr) & 0x07) << 4) | \
+ (((attr) & 0x70) >> 4)))
+
+#if USE_WIDEC_SUPPORT
+#define write_screen WriteConsoleOutputW
+#define read_screen ReadConsoleOutputW
+#else
+#define write_screen WriteConsoleOutput
+#define read_screen ReadConsoleOutput
+#endif
+
+static WORD
+MapAttr(WORD res, attr_t ch)
+{
+ if (ch & A_COLOR) {
+ int p;
+
+ p = PairNumber(ch);
+ if (p > 0 && p < CON_NUMPAIRS) {
+ WORD a;
+ a = WINCONSOLE.pairs[p];
+ res = (WORD) ((res & 0xff00) | a);
+ }
+ }
+
+ if (ch & A_REVERSE) {
+ res = RevAttr(res);
+ }
+
+ if (ch & A_STANDOUT) {
+ res = RevAttr(res) | BACKGROUND_INTENSITY;
+ }
+
+ if (ch & A_BOLD)
+ res |= FOREGROUND_INTENSITY;
+
+ if (ch & A_DIM)
+ res |= BACKGROUND_INTENSITY;
+
+ return res;
+}
+
+#if 0 /* def TRACE */
+static void
+dump_screen(const char *fn, int ln)
+{
+ int max_cells = (WINCONSOLE.SBI.dwSize.Y *
+ (1 + WINCONSOLE.SBI.dwSize.X)) + 1;
+ char output[max_cells];
+ CHAR_INFO save_screen[max_cells];
+ COORD save_size;
+ SMALL_RECT save_region;
+ COORD bufferCoord;
+
+ T(("dump_screen %s@%d", fn, ln));
+
+ save_region.Top = WINCONSOLE.SBI.srWindow.Top;
+ save_region.Left = WINCONSOLE.SBI.srWindow.Left;
+ save_region.Bottom = WINCONSOLE.SBI.srWindow.Bottom;
+ save_region.Right = WINCONSOLE.SBI.srWindow.Right;
+
+ save_size.X = (SHORT) (save_region.Right - save_region.Left + 1);
+ save_size.Y = (SHORT) (save_region.Bottom - save_region.Top + 1);
+
+ bufferCoord.X = bufferCoord.Y = 0;
+
+ if (read_screen(WINCONSOLE.hdl,
+ save_screen,
+ save_size,
+ bufferCoord,
+ &save_region)) {
+ int i, j;
+ int ij = 0;
+ int k = 0;
+
+ for (i = save_region.Top; i <= save_region.Bottom; ++i) {
+ for (j = save_region.Left; j <= save_region.Right; ++j) {
+ output[k++] = save_screen[ij++].Char.AsciiChar;
+ }
+ output[k++] = '\n';
+ }
+ output[k] = 0;
+
+ T(("DUMP: %d,%d - %d,%d",
+ save_region.Top,
+ save_region.Left,
+ save_region.Bottom,
+ save_region.Right));
+ T(("%s", output));
+ }
+}
+
+#else
+#define dump_screen(fn,ln) /* nothing */
+#endif
+
+#if USE_WIDEC_SUPPORT
+/*
+ * TODO: support surrogate pairs
+ * TODO: support combining characters
+ * TODO: support acsc
+ * TODO: _nc_wacs should be part of sp.
+ */
+static BOOL
+con_write16(TERMINAL_CONTROL_BLOCK * TCB,
+ int y, int x, cchar_t *str, int limit)
+{
+ int actual = 0;
+ CHAR_INFO *ci = TypeAlloca(CHAR_INFO, limit);
+ COORD loc, siz;
+ SMALL_RECT rec;
+ int i;
+ cchar_t ch;
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ for (i = actual = 0; i < limit; i++) {
+ ch = str[i];
+ if (isWidecExt(ch))
+ continue;
+ ci[actual].Char.UnicodeChar = CharOf(ch);
+ ci[actual].Attributes = MapAttr(WINCONSOLE.SBI.wAttributes,
+ AttrOf(ch));
+ if (AttrOf(ch) & A_ALTCHARSET) {
+ if (_nc_wacs) {
+ int which = CharOf(ch);
+ if (which > 0
+ && which < ACS_LEN
+ && CharOf(_nc_wacs[which]) != 0) {
+ ci[actual].Char.UnicodeChar = CharOf(_nc_wacs[which]);
+ } else {
+ ci[actual].Char.UnicodeChar = ' ';
+ }
+ }
+ }
+ ++actual;
+ }
+
+ loc.X = (SHORT) 0;
+ loc.Y = (SHORT) 0;
+ siz.X = (SHORT) actual;
+ siz.Y = 1;
+
+ rec.Left = (SHORT) x;
+ rec.Top = (SHORT) (y + AdjustY());
+ rec.Right = (SHORT) (x + limit - 1);
+ rec.Bottom = rec.Top;
+
+ return write_screen(WINCONSOLE.hdl, ci, siz, loc, &rec);
+}
+#define con_write(tcb, y, x, str, n) con_write16(tcb, y, x, str, n)
+#else
+static BOOL
+con_write8(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n)
+{
+ CHAR_INFO *ci = TypeAlloca(CHAR_INFO, n);
+ COORD loc, siz;
+ SMALL_RECT rec;
+ int i;
+ chtype ch;
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ for (i = 0; i < n; i++) {
+ ch = str[i];
+ ci[i].Char.AsciiChar = ChCharOf(ch);
+ ci[i].Attributes = MapAttr(WINCONSOLE.SBI.wAttributes,
+ ChAttrOf(ch));
+ if (ChAttrOf(ch) & A_ALTCHARSET) {
+ if (sp->_acs_map)
+ ci[i].Char.AsciiChar =
+ ChCharOf(NCURSES_SP_NAME(_nc_acs_char) (sp, ChCharOf(ch)));
+ }
+ }
+
+ loc.X = (short) 0;
+ loc.Y = (short) 0;
+ siz.X = (short) n;
+ siz.Y = 1;
+
+ rec.Left = (short) x;
+ rec.Top = (short) y;
+ rec.Right = (short) (x + n - 1);
+ rec.Bottom = rec.Top;
+
+ return write_screen(WINCONSOLE.hdl, ci, siz, loc, &rec);
+}
+#define con_write(tcb, y, x, str, n) con_write8(tcb, y, x, str, n)
+#endif
+
+#if EXP_OPTIMIZE
+/*
+ * Comparing new/current screens, determine the last column-index for a change
+ * beginning on the given row,col position. Unlike a serial terminal, there is
+ * no cost for "moving" the "cursor" on the line as we update it.
+ */
+static int
+find_end_of_change(SCREEN *sp, int row, int col)
+{
+ int result = col;
+ struct ldat *curdat = CurScreen(sp)->_line + row;
+ struct ldat *newdat = NewScreen(sp)->_line + row;
+
+ while (col <= newdat->lastchar) {
+#if USE_WIDEC_SUPPORT
+ if (isWidecExt(curdat->text[col]) ||
+ isWidecExt(newdat->text[col])) {
+ result = col;
+ } else if (memcmp(&curdat->text[col],
+ &newdat->text[col],
+ sizeof(curdat->text[0]))) {
+ result = col;
+ } else {
+ break;
+ }
+#else
+ if (curdat->text[col] != newdat->text[col]) {
+ result = col;
+ } else {
+ break;
+ }
+#endif
+ ++col;
+ }
+ return result;
+}
+
+/*
+ * Given a row,col position at the end of a change-chunk, look for the
+ * beginning of the next change-chunk.
+ */
+static int
+find_next_change(SCREEN *sp, int row, int col)
+{
+ struct ldat *curdat = CurScreen(sp)->_line + row;
+ struct ldat *newdat = NewScreen(sp)->_line + row;
+ int result = newdat->lastchar + 1;
+
+ while (++col <= newdat->lastchar) {
+#if USE_WIDEC_SUPPORT
+ if (isWidecExt(curdat->text[col]) !=
+ isWidecExt(newdat->text[col])) {
+ result = col;
+ break;
+ } else if (memcmp(&curdat->text[col],
+ &newdat->text[col],
+ sizeof(curdat->text[0]))) {
+ result = col;
+ break;
+ }
+#else
+ if (curdat->text[col] != newdat->text[col]) {
+ result = col;
+ break;
+ }
+#endif
+ }
+ return result;
+}
+
+#define EndChange(first) \
+ find_end_of_change(sp, y, first)
+#define NextChange(last) \
+ find_next_change(sp, y, last)
+
+#endif /* EXP_OPTIMIZE */
+
+#define MARK_NOCHANGE(win,row) \
+ win->_line[row].firstchar = _NOCHANGE; \
+ win->_line[row].lastchar = _NOCHANGE
+
+static bool
+restore_original_screen(void)
+{
+ COORD bufferCoord;
+ bool result = FALSE;
+ SMALL_RECT save_region = WINCONSOLE.save_region;
+
+ T(("... restoring %s", WINCONSOLE.window_only ?
+ "window" : "entire buffer"));
+
+ bufferCoord.X = (SHORT) (WINCONSOLE.window_only ?
+ WINCONSOLE.SBI.srWindow.Left : 0);
+ bufferCoord.Y = (SHORT) (WINCONSOLE.window_only ?
+ WINCONSOLE.SBI.srWindow.Top : 0);
+
+ if (write_screen(WINCONSOLE.hdl,
+ WINCONSOLE.save_screen,
+ WINCONSOLE.save_size,
+ bufferCoord,
+ &save_region)) {
+ result = TRUE;
+ mvcur(-1, -1, LINES - 2, 0);
+ T(("... restore original screen contents ok %dx%d (%d,%d - %d,%d)",
+ WINCONSOLE.save_size.Y,
+ WINCONSOLE.save_size.X,
+ save_region.Top,
+ save_region.Left,
+ save_region.Bottom,
+ save_region.Right));
+ } else {
+ T(("... restore original screen contents err"));
+ }
+ return result;
+}
+
+static const char *
+wcon_name(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ (void) TCB;
+ return "win32console";
+}
+
+static int
+wcon_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ int result = ERR;
+ int y, nonempty, n, x0, x1, Width, Height;
+ SCREEN *sp;
+
+ T((T_CALLED("win32con::wcon_doupdate(%p)"), TCB));
+ if (validateConsoleHandle()) {
+ SetSP();
+
+ Width = screen_columns(sp);
+ Height = screen_lines(sp);
+ nonempty = min(Height, NewScreen(sp)->_maxy + 1);
+
+ T(("... %dx%d clear cur:%d new:%d",
+ Height, Width,
+ CurScreen(sp)->_clear,
+ NewScreen(sp)->_clear));
+
+ if (SP_PARM->_endwin == ewSuspend) {
+
+ T(("coming back from shell mode"));
+ NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_ARG);
+
+ NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_ARG);
+ SP_PARM->_mouse_resume(SP_PARM);
+
+ SP_PARM->_endwin = ewRunning;
+ }
+
+ if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) {
+ int x;
+#if USE_WIDEC_SUPPORT
+ cchar_t *empty = TypeAlloca(cchar_t, Width);
+ wchar_t blank[2] =
+ {
+ L' ', L'\0'
+ };
+
+ for (x = 0; x < Width; x++)
+ setcchar(&empty[x], blank, 0, 0, 0);
+#else
+ chtype *empty = TypeAlloca(chtype, Width);
+
+ for (x = 0; x < Width; x++)
+ empty[x] = ' ';
+#endif
+
+ for (y = 0; y < nonempty; y++) {
+ con_write(TCB, y, 0, empty, Width);
+ memcpy(empty,
+ CurScreen(sp)->_line[y].text,
+ (size_t) Width * sizeof(empty[0]));
+ }
+ CurScreen(sp)->_clear = FALSE;
+ NewScreen(sp)->_clear = FALSE;
+ touchwin(NewScreen(sp));
+ T(("... cleared %dx%d lines @%d of screen", nonempty, Width,
+ AdjustY()));
+ }
+
+ for (y = 0; y < nonempty; y++) {
+ x0 = NewScreen(sp)->_line[y].firstchar;
+ if (x0 != _NOCHANGE) {
+#if EXP_OPTIMIZE
+ int x2;
+ int limit = NewScreen(sp)->_line[y].lastchar;
+ while ((x1 = EndChange(x0)) <= limit) {
+ while ((x2 = NextChange(x1)) <=
+ limit && x2 <= (x1 + 2)) {
+ x1 = x2;
+ }
+ n = x1 - x0 + 1;
+ memcpy(&CurScreen(sp)->_line[y].text[x0],
+ &NewScreen(sp)->_line[y].text[x0],
+ n * sizeof(CurScreen(sp)->_line[y].text[x0]));
+ con_write(TCB,
+ y,
+ x0,
+ &CurScreen(sp)->_line[y].text[x0], n);
+ x0 = NextChange(x1);
+ }
+
+ /* mark line changed successfully */
+ if (y <= NewScreen(sp)->_maxy) {
+ MARK_NOCHANGE(NewScreen(sp), y);
+ }
+ if (y <= CurScreen(sp)->_maxy) {
+ MARK_NOCHANGE(CurScreen(sp), y);
+ }
+#else
+ x1 = NewScreen(sp)->_line[y].lastchar;
+ n = x1 - x0 + 1;
+ if (n > 0) {
+ memcpy(&CurScreen(sp)->_line[y].text[x0],
+ &NewScreen(sp)->_line[y].text[x0],
+ (size_t) n *
+ sizeof(CurScreen(sp)->_line[y].text[x0]));
+ con_write(TCB,
+ y,
+ x0,
+ &CurScreen(sp)->_line[y].text[x0], n);
+
+ /* mark line changed successfully */
+ if (y <= NewScreen(sp)->_maxy) {
+ MARK_NOCHANGE(NewScreen(sp), y);
+ }
+ if (y <= CurScreen(sp)->_maxy) {
+ MARK_NOCHANGE(CurScreen(sp), y);
+ }
+ }
+#endif
+ }
+ }
+
+ /* put everything back in sync */
+ for (y = nonempty; y <= NewScreen(sp)->_maxy; y++) {
+ MARK_NOCHANGE(NewScreen(sp), y);
+ }
+ for (y = nonempty; y <= CurScreen(sp)->_maxy; y++) {
+ MARK_NOCHANGE(CurScreen(sp), y);
+ }
+
+ if (!NewScreen(sp)->_leaveok) {
+ CurScreen(sp)->_curx = NewScreen(sp)->_curx;
+ CurScreen(sp)->_cury = NewScreen(sp)->_cury;
+
+ TCB->drv->td_hwcur(TCB,
+ 0,
+ 0,
+ CurScreen(sp)->_cury,
+ CurScreen(sp)->_curx);
+ }
+ _nc_console_selectActiveHandle();
+ result = OK;
+ }
+ returnCode(result);
+}
+
+static bool
+wcon_CanHandle(TERMINAL_CONTROL_BLOCK * TCB,
+ const char *tname,
+ int *errret GCC_UNUSED)
+{
+ bool code = FALSE;
+
+ T((T_CALLED("win32con::wcon_CanHandle(%p)"), TCB));
+
+ assert((TCB != 0) && (tname != 0));
+
+ TCB->magic = WINMAGIC;
+
+ if (tname == 0 || *tname == 0) {
+ if (!_nc_console_vt_supported())
+ code = TRUE;
+ } else if (tname != 0 && *tname == '#') {
+ /*
+ * Use "#" (a character which cannot begin a terminal's name) to
+ * select specific driver from the table.
+ *
+ * In principle, we could have more than one non-terminfo driver,
+ * e.g., "win32gui".
+ */
+ size_t n = strlen(tname + 1);
+ if (n != 0
+ && ((strncmp(tname + 1, "win32console", n) == 0)
+ || (strncmp(tname + 1, "win32con", n) == 0))) {
+ code = TRUE;
+ }
+ } else if (tname != 0 && stricmp(tname, "unknown") == 0) {
+ code = TRUE;
+ }
+
+ /*
+ * This is intentional, to avoid unnecessary breakage of applications
+ * using <term.h> symbols.
+ */
+ if (code && (TerminalType(&TCB->term).Booleans == 0)) {
+ _nc_init_termtype(&TerminalType(&TCB->term));
+#if NCURSES_EXT_NUMBERS
+ _nc_export_termtype2(&TCB->term.type, &TerminalType(&TCB->term));
+#endif
+ }
+
+ if (!code) {
+ if (_nc_console_test(0)) {
+ T(("isTermInfoConsole=TRUE"));
+ WINCONSOLE.isTermInfoConsole = TRUE;
+ }
+ }
+ returnBool(code);
+}
+
+static int
+wcon_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB,
+ int beepFlag)
+{
+ SCREEN *sp;
+ int res = ERR;
+
+ int high = (WINCONSOLE.SBI.srWindow.Bottom -
+ WINCONSOLE.SBI.srWindow.Top + 1);
+ int wide = (WINCONSOLE.SBI.srWindow.Right -
+ WINCONSOLE.SBI.srWindow.Left + 1);
+ int max_cells = (high * wide);
+ int i;
+
+ CHAR_INFO *this_screen = TypeAlloca(CHAR_INFO, max_cells);
+ CHAR_INFO *that_screen = TypeAlloca(CHAR_INFO, max_cells);
+ COORD this_size;
+ SMALL_RECT this_region;
+ COORD bufferCoord;
+
+ if (validateConsoleHandle()) {
+ SetSP();
+ this_region.Top = WINCONSOLE.SBI.srWindow.Top;
+ this_region.Left = WINCONSOLE.SBI.srWindow.Left;
+ this_region.Bottom = WINCONSOLE.SBI.srWindow.Bottom;
+ this_region.Right = WINCONSOLE.SBI.srWindow.Right;
+
+ this_size.X = (SHORT) wide;
+ this_size.Y = (SHORT) high;
+
+ bufferCoord.X = this_region.Left;
+ bufferCoord.Y = this_region.Top;
+
+ if (!beepFlag &&
+ read_screen(WINCONSOLE.hdl,
+ this_screen,
+ this_size,
+ bufferCoord,
+ &this_region)) {
+
+ memcpy(that_screen,
+ this_screen,
+ sizeof(CHAR_INFO) * (size_t) max_cells);
+
+ for (i = 0; i < max_cells; i++) {
+ that_screen[i].Attributes =
+ RevAttr(that_screen[i].Attributes);
+ }
+
+ write_screen(WINCONSOLE.hdl, that_screen, this_size,
+ bufferCoord, &this_region);
+ Sleep(200);
+ write_screen(WINCONSOLE.hdl, this_screen, this_size,
+ bufferCoord, &this_region);
+
+ } else {
+ MessageBeep(MB_ICONWARNING); /* MB_OK might be better */
+ }
+ res = OK;
+ }
+ return res;
+}
+
+static int
+wcon_print(TERMINAL_CONTROL_BLOCK * TCB,
+ char *data GCC_UNUSED,
+ int len GCC_UNUSED)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ return ERR;
+}
+
+static int
+wcon_defaultcolors(TERMINAL_CONTROL_BLOCK * TCB,
+ int fg GCC_UNUSED,
+ int bg GCC_UNUSED)
+{
+ SCREEN *sp;
+ int code = ERR;
+
+ AssertTCB();
+ SetSP();
+
+ return (code);
+}
+
+static void
+wcon_setcolor(TERMINAL_CONTROL_BLOCK * TCB,
+ int fore,
+ int color,
+ int (*outc) (SCREEN *, int) GCC_UNUSED)
+{
+ (void) TCB;
+ if (validateConsoleHandle()) {
+ WORD a = _nc_console_MapColor(fore, color);
+ a |= (WORD) ((WINCONSOLE.SBI.wAttributes) & (fore ? 0xfff8 : 0xff8f));
+ SetConsoleTextAttribute(WINCONSOLE.hdl, a);
+ _nc_console_get_SBI();
+ }
+}
+
+static bool
+wcon_rescol(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ bool res = FALSE;
+
+ (void) TCB;
+ if (validateConsoleHandle()) {
+ WORD a = FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN;
+ SetConsoleTextAttribute(WINCONSOLE.hdl, a);
+ _nc_console_get_SBI();
+ res = TRUE;
+ }
+ return res;
+}
+
+static bool
+wcon_rescolors(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ int result = FALSE;
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ return result;
+}
+
+static int
+wcon_size(TERMINAL_CONTROL_BLOCK * TCB, int *Lines, int *Cols)
+{
+ int result = ERR;
+
+ T((T_CALLED("win32con::wcon_size(%p)"), TCB));
+
+ if (validateConsoleHandle() &&
+ (Lines != NULL) && (Cols != NULL)) {
+ _nc_console_size(Lines, Cols);
+ result = OK;
+ }
+ returnCode(result);
+}
+
+static int
+wcon_setsize(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED,
+ int l GCC_UNUSED,
+ int c GCC_UNUSED)
+{
+ AssertTCB();
+ return ERR;
+}
+
+static int
+wcon_sgmode(TERMINAL_CONTROL_BLOCK * TCB, int setFlag, TTY * buf)
+{
+ int result = ERR;
+
+ T((T_CALLED("win32con::wcon_sgmode(TCB=(%p),setFlag=%d,TTY=(%p)"),
+ TCB, setFlag, buf));
+ if (buf != NULL && validateConsoleHandle()) {
+
+ if (setFlag) {
+ _nc_console_setmode(WINCONSOLE.hdl, buf);
+ TCB->term.Nttyb = *buf;
+ } else {
+ _nc_console_getmode(WINCONSOLE.hdl, &(TCB->term.Nttyb));
+ *buf = TCB->term.Nttyb;
+ }
+ result = OK;
+ }
+ returnCode(result);
+}
+
+#define MIN_WIDE 80
+#define MIN_HIGH 24
+
+static int
+wcon_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag)
+{
+ SCREEN *sp;
+ TERMINAL *_term = (TERMINAL *) TCB;
+ int code = ERR;
+
+ if (validateConsoleHandle()) {
+ sp = TCB->csp;
+
+ T((T_CALLED("win32con::wcon_mode(%p, progFlag=%d, defFlag=%d)"),
+ TCB, progFlag, defFlag));
+
+ WINCONSOLE.progMode = progFlag;
+ WINCONSOLE.lastOut = progFlag ? WINCONSOLE.hdl : WINCONSOLE.out;
+ SetConsoleActiveScreenBuffer(WINCONSOLE.lastOut);
+
+ if (progFlag) /* prog mode */ {
+ if (defFlag) {
+ if ((wcon_sgmode(TCB, FALSE, &(_term->Nttyb)) == OK)) {
+ code = OK;
+ }
+ } else {
+ /* reset_prog_mode */
+ if (wcon_sgmode(TCB, TRUE, &(_term->Nttyb)) == OK) {
+ if (sp) {
+ if (sp->_keypad_on)
+ _nc_keypad(sp, TRUE);
+ }
+ if (!WINCONSOLE.buffered) {
+ _nc_console_set_scrollback(FALSE, &WINCONSOLE.SBI);
+ }
+ code = OK;
+ }
+ }
+ T(("... buffered:%d, clear:%d",
+ WINCONSOLE.buffered, CurScreen(sp)->_clear));
+ } else { /* shell mode */
+ if (defFlag) {
+ /* def_shell_mode */
+ if (wcon_sgmode(TCB, FALSE, &(_term->Ottyb)) == OK) {
+ code = OK;
+ }
+ } else {
+ /* reset_shell_mode */
+ if (sp) {
+ _nc_keypad(sp, FALSE);
+ NCURSES_SP_NAME(_nc_flush) (sp);
+ }
+ code = wcon_sgmode(TCB, TRUE, &(_term->Ottyb));
+ if (!WINCONSOLE.buffered) {
+ _nc_console_set_scrollback(TRUE, &WINCONSOLE.save_SBI);
+ if (!restore_original_screen())
+ code = ERR;
+ }
+ SetConsoleCursorInfo(WINCONSOLE.hdl, &WINCONSOLE.save_CI);
+ }
+ }
+
+ }
+ returnCode(code);
+}
+
+static void
+wcon_screen_init(SCREEN *sp GCC_UNUSED)
+{
+}
+
+static void
+wcon_wrap(SCREEN *sp GCC_UNUSED)
+{
+}
+
+static void
+wcon_release(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ T((T_CALLED("win32con::wcon_release(%p)"), TCB));
+
+ AssertTCB();
+ if (TCB->prop)
+ free(TCB->prop);
+
+ returnVoid;
+}
+
+static void
+wcon_init(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ T((T_CALLED("win32con::wcon_init(%p)"), TCB));
+
+ AssertTCB();
+
+ if (!(console_initialized = _nc_console_checkinit(TRUE, FALSE))) {
+ returnVoid;
+ }
+
+ if (TCB) {
+ TCB->info.initcolor = TRUE;
+ TCB->info.canchange = FALSE;
+ TCB->info.hascolor = TRUE;
+ TCB->info.caninit = TRUE;
+
+ TCB->info.maxpairs = CON_NUMPAIRS;
+ TCB->info.maxcolors = 8;
+ TCB->info.numlabels = 0;
+ TCB->info.labelwidth = 0;
+ TCB->info.labelheight = 0;
+ TCB->info.nocolorvideo = 1;
+ TCB->info.tabsize = 8;
+
+ TCB->info.numbuttons = WINCONSOLE.numButtons;
+ TCB->info.defaultPalette = _nc_cga_palette;
+
+ }
+ returnVoid;
+}
+
+static void
+wcon_initpair(TERMINAL_CONTROL_BLOCK * TCB,
+ int pair,
+ int f,
+ int b)
+{
+ SCREEN *sp;
+
+ if (validateConsoleHandle()) {
+ SetSP();
+
+ if ((pair > 0) && (pair < CON_NUMPAIRS) && (f >= 0) && (f < 8)
+ && (b >= 0) && (b < 8)) {
+ WINCONSOLE.pairs[pair] =
+ _nc_console_MapColor(true, f) |
+ _nc_console_MapColor(false, b);
+ }
+ }
+}
+
+static void
+wcon_initcolor(TERMINAL_CONTROL_BLOCK * TCB,
+ int color GCC_UNUSED,
+ int r GCC_UNUSED,
+ int g GCC_UNUSED,
+ int b GCC_UNUSED)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+}
+
+static void
+wcon_do_color(TERMINAL_CONTROL_BLOCK * TCB,
+ int old_pair GCC_UNUSED,
+ int pair GCC_UNUSED,
+ int reverse GCC_UNUSED,
+ int (*outc) (SCREEN *, int) GCC_UNUSED
+)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+}
+
+static void
+wcon_initmouse(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ SCREEN *sp;
+
+ if (validateConsoleHandle()) {
+ SetSP();
+
+ sp->_mouse_type = M_TERM_DRIVER;
+ }
+}
+
+static int
+wcon_testmouse(TERMINAL_CONTROL_BLOCK * TCB,
+ int delay
+ EVENTLIST_2nd(_nc_eventlist * evl))
+{
+ int rc = 0;
+ SCREEN *sp;
+
+ if (validateConsoleHandle()) {
+ SetSP();
+
+ if (sp->_drv_mouse_head < sp->_drv_mouse_tail) {
+ rc = TW_MOUSE;
+ } else {
+ rc = TCBOf(sp)->drv->td_twait(TCBOf(sp),
+ TWAIT_MASK,
+ delay,
+ (int *) 0
+ EVENTLIST_2nd(evl));
+ }
+ }
+
+ return rc;
+}
+
+static int
+wcon_mvcur(TERMINAL_CONTROL_BLOCK * TCB,
+ int yold GCC_UNUSED, int xold GCC_UNUSED,
+ int y, int x)
+{
+ int ret = ERR;
+
+ (void) TCB;
+ if (validateConsoleHandle()) {
+ COORD loc;
+ loc.X = (short) x;
+ loc.Y = (short) (y + AdjustY());
+ SetConsoleCursorPosition(WINCONSOLE.hdl, loc);
+ ret = OK;
+ }
+ return ret;
+}
+
+static void
+wcon_hwlabel(TERMINAL_CONTROL_BLOCK * TCB,
+ int labnum GCC_UNUSED,
+ char *text GCC_UNUSED)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+}
+
+static void
+wcon_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB,
+ int OnFlag GCC_UNUSED)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+}
+
+static chtype
+wcon_conattr(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED)
+{
+ chtype res = A_NORMAL;
+ res |= (A_BOLD | A_DIM | A_REVERSE | A_STANDOUT | A_COLOR);
+ return res;
+}
+
+static void
+wcon_setfilter(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+}
+
+static void
+wcon_initacs(TERMINAL_CONTROL_BLOCK * TCB,
+ chtype *real_map GCC_UNUSED,
+ chtype *fake_map GCC_UNUSED)
+{
+#define DATA(a,b) { a, b }
+ static struct {
+ int acs_code;
+ int use_code;
+ } table[] = {
+ DATA('a', 0xb1), /* ACS_CKBOARD */
+ DATA('f', 0xf8), /* ACS_DEGREE */
+ DATA('g', 0xf1), /* ACS_PLMINUS */
+ DATA('j', 0xd9), /* ACS_LRCORNER */
+ DATA('l', 0xda), /* ACS_ULCORNER */
+ DATA('k', 0xbf), /* ACS_URCORNER */
+ DATA('m', 0xc0), /* ACS_LLCORNER */
+ DATA('n', 0xc5), /* ACS_PLUS */
+ DATA('q', 0xc4), /* ACS_HLINE */
+ DATA('t', 0xc3), /* ACS_LTEE */
+ DATA('u', 0xb4), /* ACS_RTEE */
+ DATA('v', 0xc1), /* ACS_BTEE */
+ DATA('w', 0xc2), /* ACS_TTEE */
+ DATA('x', 0xb3), /* ACS_VLINE */
+ DATA('y', 0xf3), /* ACS_LEQUAL */
+ DATA('z', 0xf2), /* ACS_GEQUAL */
+ DATA('0', 0xdb), /* ACS_BLOCK */
+ DATA('{', 0xe3), /* ACS_PI */
+ DATA('}', 0x9c), /* ACS_STERLING */
+ DATA(',', 0xae), /* ACS_LARROW */
+ DATA('+', 0xaf), /* ACS_RARROW */
+ DATA('~', 0xf9), /* ACS_BULLET */
+ };
+#undef DATA
+ unsigned n;
+
+ SCREEN *sp;
+ if (validateConsoleHandle()) {
+ SetSP();
+
+ for (n = 0; n < SIZEOF(table); ++n) {
+ real_map[table[n].acs_code] =
+ (chtype) table[n].use_code | A_ALTCHARSET;
+ if (sp != 0)
+ sp->_screen_acs_map[table[n].acs_code] = TRUE;
+ }
+ }
+}
+
+static int
+wcon_twait(TERMINAL_CONTROL_BLOCK * TCB,
+ int mode,
+ int milliseconds,
+ int *timeleft
+ EVENTLIST_2nd(_nc_eventlist * evl))
+{
+ SCREEN *sp;
+ int code = 0;
+
+ if (validateConsoleHandle()) {
+ SetSP();
+
+ code = _nc_console_twait(sp,
+ WINCONSOLE.inp,
+ mode,
+ milliseconds,
+ timeleft EVENTLIST_2nd(evl));
+ }
+ return code;
+}
+
+static int
+wcon_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf)
+{
+ SCREEN *sp;
+ int n = -1;
+
+ T((T_CALLED("win32con::wcon_read(%p)"), TCB));
+
+ assert(buf);
+ if (validateConsoleHandle()) {
+ SetSP();
+
+ n = _nc_console_read(sp, WINCONSOLE.inp, buf);
+ }
+ returnCode(n);
+}
+
+static int
+wcon_nap(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int ms)
+{
+ T((T_CALLED("win32con::wcon_nap(%p, %d)"), TCB, ms));
+ Sleep((DWORD) ms);
+ returnCode(OK);
+}
+
+static int
+wcon_cursorSet(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int mode)
+{
+ int res = -1;
+
+ T((T_CALLED("win32con:wcon_cursorSet(%d)"), mode));
+ if (validateConsoleHandle()) {
+ CONSOLE_CURSOR_INFO this_CI = WINCONSOLE.save_CI;
+ switch (mode) {
+ case 0:
+ this_CI.bVisible = FALSE;
+ break;
+ case 1:
+ break;
+ case 2:
+ this_CI.dwSize = 100;
+ break;
+ }
+ SetConsoleCursorInfo(WINCONSOLE.hdl, &this_CI);
+ }
+ returnCode(res);
+}
+
+static bool
+wcon_kyExist(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int keycode)
+{
+ bool found = FALSE;
+
+ T((T_CALLED("win32con::wcon_kyExist(%d)"), keycode));
+ found = _nc_console_keyExist(keycode);
+ returnBool(found);
+}
+
+static int
+wcon_kpad(TERMINAL_CONTROL_BLOCK * TCB, int flag GCC_UNUSED)
+{
+ SCREEN *sp;
+ int code = ERR;
+
+ T((T_CALLED("win32con::wcon_kpad(%p, %d)"), TCB, flag));
+
+ if (validateConsoleHandle()) {
+ SetSP();
+
+ if (sp) {
+ code = OK;
+ }
+ }
+ returnCode(code);
+}
+
+static int
+wcon_keyok(TERMINAL_CONTROL_BLOCK * TCB,
+ int keycode,
+ int flag)
+{
+ int code = ERR;
+ SCREEN *sp;
+
+ T((T_CALLED("win32con::wcon_keyok(%p, %d, %d)"), TCB, keycode, flag));
+
+ if (validateConsoleHandle()) {
+ SetSP();
+ if (sp) {
+ code = _nc_console_keyok(keycode, flag);
+ }
+ }
+ returnCode(code);
+}
+
+NCURSES_EXPORT_VAR (TERM_DRIVER) _nc_WIN_DRIVER = {
+ FALSE,
+ wcon_name, /* Name */
+ wcon_CanHandle, /* CanHandle */
+ wcon_init, /* init */
+ wcon_release, /* release */
+ wcon_size, /* size */
+ wcon_sgmode, /* sgmode */
+ wcon_conattr, /* conattr */
+ wcon_mvcur, /* hwcur */
+ wcon_mode, /* mode */
+ wcon_rescol, /* rescol */
+ wcon_rescolors, /* rescolors */
+ wcon_setcolor, /* color */
+ wcon_dobeepflash, /* DoBeepFlash */
+ wcon_initpair, /* initpair */
+ wcon_initcolor, /* initcolor */
+ wcon_do_color, /* docolor */
+ wcon_initmouse, /* initmouse */
+ wcon_testmouse, /* testmouse */
+ wcon_setfilter, /* setfilter */
+ wcon_hwlabel, /* hwlabel */
+ wcon_hwlabelOnOff, /* hwlabelOnOff */
+ wcon_doupdate, /* update */
+ wcon_defaultcolors, /* defaultcolors */
+ wcon_print, /* print */
+ wcon_size, /* getsize */
+ wcon_setsize, /* setsize */
+ wcon_initacs, /* initacs */
+ wcon_screen_init, /* scinit */
+ wcon_wrap, /* scexit */
+ wcon_twait, /* twait */
+ wcon_read, /* read */
+ wcon_nap, /* nap */
+ wcon_kpad, /* kpad */
+ wcon_keyok, /* kyOk */
+ wcon_kyExist, /* kyExist */
+ wcon_cursorSet /* cursorSet */
+};
+
+#endif /* _NC_WINDOWS */
diff --git a/ncurses/win32con/win_driver.c b/ncurses/win32con/win_driver.c
index 280aa6dc16cb..72a9cf53525f 100644
--- a/ncurses/win32con/win_driver.c
+++ b/ncurses/win32con/win_driver.c
@@ -55,11 +55,9 @@
#define CUR TerminalType(my_term).
-MODULE_ID("$Id: win_driver.c,v 1.63 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: win_driver.c,v 1.66 2020/03/01 00:18:49 tom Exp $")
-#ifndef __GNUC__
-# error We need GCC to compile for MinGW
-#endif
+#define TypeAlloca(type,count) (type*) _alloca(sizeof(type) * (size_t) (count))
#define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE)
@@ -262,7 +260,7 @@ static BOOL
con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int limit)
{
int actual = 0;
- CHAR_INFO ci[limit];
+ CHAR_INFO *ci = TypeAlloca(CHAR_INFO, limit);
COORD loc, siz;
SMALL_RECT rec;
int i;
@@ -311,7 +309,7 @@ con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int limit)
static BOOL
con_write8(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n)
{
- CHAR_INFO ci[n];
+ CHAR_INFO *ci = TypeAlloca(CHAR_INFO, n);
COORD loc, siz;
SMALL_RECT rec;
int i;
@@ -510,7 +508,7 @@ wcon_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) {
int x;
#if USE_WIDEC_SUPPORT
- cchar_t empty[Width];
+ cchar_t *empty = TypeAlloca(cchar_t, Width);
wchar_t blank[2] =
{
L' ', L'\0'
@@ -519,7 +517,7 @@ wcon_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
for (x = 0; x < Width; x++)
setcchar(&empty[x], blank, 0, 0, 0);
#else
- chtype empty[Width];
+ chtype *empty = TypeAlloca(chtype, Width);
for (x = 0; x < Width; x++)
empty[x] = ' ';
@@ -675,8 +673,8 @@ wcon_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB,
int max_cells = (high * wide);
int i;
- CHAR_INFO this_screen[max_cells];
- CHAR_INFO that_screen[max_cells];
+ CHAR_INFO *this_screen = TypeAlloca(CHAR_INFO, max_cells);
+ CHAR_INFO *that_screen = TypeAlloca(CHAR_INFO, max_cells);
COORD this_size;
SMALL_RECT this_region;
COORD bufferCoord;
@@ -701,7 +699,9 @@ wcon_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB,
bufferCoord,
&this_region)) {
- memcpy(that_screen, this_screen, sizeof(that_screen));
+ memcpy(that_screen,
+ this_screen,
+ sizeof(CHAR_INFO) * (size_t) max_cells);
for (i = 0; i < max_cells; i++) {
that_screen[i].Attributes = RevAttr(that_screen[i].Attributes);