aboutsummaryrefslogtreecommitdiff
path: root/ncurses
diff options
context:
space:
mode:
Diffstat (limited to 'ncurses')
-rw-r--r--ncurses/Makefile.in80
-rw-r--r--ncurses/README.IZ6
-rw-r--r--ncurses/SigAction.h4
-rw-r--r--ncurses/base/MKkeyname.awk13
-rwxr-xr-xncurses/base/MKlib_gen.sh63
-rw-r--r--ncurses/base/MKunctrl.awk5
-rw-r--r--ncurses/base/define_key.c6
-rw-r--r--ncurses/base/keyok.c7
-rw-r--r--ncurses/base/lib_addch.c30
-rw-r--r--ncurses/base/lib_addstr.c10
-rw-r--r--ncurses/base/lib_beep.c6
-rw-r--r--ncurses/base/lib_bkgd.c95
-rw-r--r--ncurses/base/lib_box.c14
-rw-r--r--ncurses/base/lib_chgat.c23
-rw-r--r--ncurses/base/lib_color.c517
-rw-r--r--ncurses/base/lib_colorset.c19
-rw-r--r--ncurses/base/lib_dft_fgbg.c35
-rw-r--r--ncurses/base/lib_driver.c36
-rw-r--r--ncurses/base/lib_endwin.c12
-rw-r--r--ncurses/base/lib_erase.c12
-rw-r--r--ncurses/base/lib_flash.c6
-rw-r--r--ncurses/base/lib_freeall.c44
-rw-r--r--ncurses/base/lib_getch.c100
-rw-r--r--ncurses/base/lib_getstr.c10
-rw-r--r--ncurses/base/lib_hline.c20
-rw-r--r--ncurses/base/lib_inchstr.c23
-rw-r--r--ncurses/base/lib_initscr.c29
-rw-r--r--ncurses/base/lib_insch.c13
-rw-r--r--ncurses/base/lib_insnstr.c50
-rw-r--r--ncurses/base/lib_instr.c37
-rw-r--r--ncurses/base/lib_isendwin.c6
-rw-r--r--ncurses/base/lib_mouse.c628
-rw-r--r--ncurses/base/lib_newterm.c39
-rw-r--r--ncurses/base/lib_newwin.c22
-rw-r--r--ncurses/base/lib_overlay.c35
-rw-r--r--ncurses/base/lib_pad.c10
-rw-r--r--ncurses/base/lib_printw.c44
-rw-r--r--ncurses/base/lib_restart.c6
-rw-r--r--ncurses/base/lib_scanw.c47
-rw-r--r--ncurses/base/lib_screen.c847
-rw-r--r--ncurses/base/lib_scroll.c14
-rw-r--r--ncurses/base/lib_set_term.c120
-rw-r--r--ncurses/base/lib_slkatr_set.c23
-rw-r--r--ncurses/base/lib_slkcolor.c50
-rw-r--r--ncurses/base/lib_slkinit.c11
-rw-r--r--ncurses/base/lib_slkrefr.c8
-rw-r--r--ncurses/base/lib_slkset.c8
-rw-r--r--ncurses/base/lib_touch.c20
-rw-r--r--ncurses/base/lib_vline.c23
-rw-r--r--ncurses/base/lib_window.c11
-rw-r--r--ncurses/base/new_pair.c385
-rw-r--r--ncurses/base/resizeterm.c23
-rw-r--r--ncurses/base/safe_sprintf.c18
-rw-r--r--ncurses/base/use_window.c11
-rw-r--r--ncurses/base/wresize.c42
-rw-r--r--ncurses/build.priv.h29
-rw-r--r--ncurses/curses.priv.h695
-rw-r--r--ncurses/fifo_defs.h6
-rw-r--r--ncurses/llib-lncurses312
-rw-r--r--ncurses/llib-lncursest383
-rw-r--r--ncurses/llib-lncursestw568
-rw-r--r--ncurses/llib-lncursesw547
-rw-r--r--ncurses/llib-ltic44
-rw-r--r--ncurses/llib-ltict44
-rw-r--r--ncurses/llib-ltictw44
-rw-r--r--ncurses/llib-lticw44
-rw-r--r--ncurses/llib-ltinfo171
-rw-r--r--ncurses/llib-ltinfot192
-rw-r--r--ncurses/llib-ltinfotw215
-rw-r--r--ncurses/llib-ltinfow194
-rw-r--r--ncurses/modules10
-rw-r--r--ncurses/new_pair.h130
-rw-r--r--ncurses/report_offsets.c228
-rw-r--r--ncurses/tinfo/MKcaptab.sh37
-rw-r--r--ncurses/tinfo/MKcodes.awk6
-rwxr-xr-xncurses/tinfo/MKfallback.sh52
-rwxr-xr-xncurses/tinfo/MKkeys_list.sh16
-rw-r--r--ncurses/tinfo/MKnames.awk6
-rwxr-xr-xncurses/tinfo/MKuserdefs.sh146
-rw-r--r--ncurses/tinfo/access.c12
-rw-r--r--ncurses/tinfo/add_tries.c5
-rw-r--r--ncurses/tinfo/alloc_entry.c46
-rw-r--r--ncurses/tinfo/alloc_ttype.c203
-rw-r--r--ncurses/tinfo/captoinfo.c240
-rw-r--r--ncurses/tinfo/comp_error.c28
-rw-r--r--ncurses/tinfo/comp_expand.c71
-rw-r--r--ncurses/tinfo/comp_hash.c43
-rw-r--r--ncurses/tinfo/comp_parse.c269
-rw-r--r--ncurses/tinfo/comp_scan.c29
-rw-r--r--ncurses/tinfo/db_iterator.c78
-rw-r--r--ncurses/tinfo/entries.c67
-rw-r--r--ncurses/tinfo/free_ttype.c33
-rw-r--r--ncurses/tinfo/getenv_num.c6
-rw-r--r--ncurses/tinfo/hashed_db.c6
-rw-r--r--ncurses/tinfo/home_terminfo.c9
-rw-r--r--ncurses/tinfo/init_keytry.c8
-rw-r--r--ncurses/tinfo/lib_acs.c84
-rw-r--r--ncurses/tinfo/lib_baudrate.c81
-rw-r--r--ncurses/tinfo/lib_cur_term.c36
-rw-r--r--ncurses/tinfo/lib_data.c72
-rw-r--r--ncurses/tinfo/lib_longname.c15
-rw-r--r--ncurses/tinfo/lib_napms.c8
-rw-r--r--ncurses/tinfo/lib_options.c20
-rw-r--r--ncurses/tinfo/lib_print.c6
-rw-r--r--ncurses/tinfo/lib_raw.c30
-rw-r--r--ncurses/tinfo/lib_setup.c321
-rw-r--r--ncurses/tinfo/lib_termcap.c67
-rw-r--r--ncurses/tinfo/lib_tgoto.c15
-rw-r--r--ncurses/tinfo/lib_ti.c28
-rw-r--r--ncurses/tinfo/lib_tparm.c120
-rw-r--r--ncurses/tinfo/lib_tputs.c44
-rw-r--r--ncurses/tinfo/lib_ttyflags.c62
-rw-r--r--ncurses/tinfo/make_hash.c247
-rw-r--r--ncurses/tinfo/make_keys.c26
-rw-r--r--ncurses/tinfo/name_match.c13
-rw-r--r--ncurses/tinfo/obsolete.c149
-rw-r--r--ncurses/tinfo/parse_entry.c361
-rw-r--r--ncurses/tinfo/read_entry.c475
-rw-r--r--ncurses/tinfo/read_termcap.c60
-rw-r--r--ncurses/tinfo/strings.c9
-rw-r--r--ncurses/tinfo/tinfo_driver.c255
-rw-r--r--ncurses/tinfo/trim_sgr0.c10
-rw-r--r--ncurses/tinfo/use_screen.c10
-rw-r--r--ncurses/tinfo/write_entry.c265
-rw-r--r--ncurses/trace/lib_trace.c165
-rw-r--r--ncurses/trace/lib_traceatr.c181
-rw-r--r--ncurses/trace/lib_tracebits.c115
-rw-r--r--ncurses/trace/lib_tracedmp.c8
-rw-r--r--ncurses/trace/lib_tracemse.c16
-rw-r--r--ncurses/trace/trace_xnames.c10
-rw-r--r--ncurses/trace/visbuf.c39
-rwxr-xr-xncurses/tty/MKexpanded.sh8
-rw-r--r--ncurses/tty/hardscroll.c9
-rw-r--r--ncurses/tty/hashmap.c65
-rw-r--r--ncurses/tty/lib_mvcur.c100
-rw-r--r--ncurses/tty/lib_tstp.c12
-rw-r--r--ncurses/tty/lib_twait.c19
-rw-r--r--ncurses/tty/lib_vidattr.c23
-rw-r--r--ncurses/tty/tty_update.c210
-rw-r--r--ncurses/widechar/charable.c8
-rw-r--r--ncurses/widechar/lib_add_wch.c10
-rw-r--r--ncurses/widechar/lib_cchar.c42
-rw-r--r--ncurses/widechar/lib_get_wch.c14
-rw-r--r--ncurses/widechar/lib_get_wstr.c8
-rw-r--r--ncurses/widechar/lib_hline_set.c10
-rw-r--r--ncurses/widechar/lib_in_wch.c8
-rw-r--r--ncurses/widechar/lib_ins_wch.c29
-rw-r--r--ncurses/widechar/lib_inwstr.c22
-rw-r--r--ncurses/widechar/lib_key_name.c15
-rw-r--r--ncurses/widechar/lib_slk_wset.c11
-rw-r--r--ncurses/widechar/lib_unget_wch.c7
-rw-r--r--ncurses/widechar/lib_vid_attr.c75
-rw-r--r--ncurses/widechar/lib_vline_set.c13
-rw-r--r--ncurses/widechar/lib_wacs.c17
-rw-r--r--ncurses/widechar/widechars.c8
-rw-r--r--ncurses/win32con/gettimeofday.c7
-rw-r--r--ncurses/win32con/win_driver.c1817
157 files changed, 10664 insertions, 4374 deletions
diff --git a/ncurses/Makefile.in b/ncurses/Makefile.in
index f08bafb2b10f..27f7689b7124 100644
--- a/ncurses/Makefile.in
+++ b/ncurses/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.139 2013/08/04 20:20:45 tom Exp $
+# $Id: Makefile.in,v 1.164 2019/11/16 20:42:40 tom Exp $
##############################################################################
-# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2018,2019 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"), #
@@ -45,7 +45,7 @@
# turn off _all_ suffix rules; we'll generate our own
.SUFFIXES:
-SHELL = /bin/sh
+SHELL = @SHELL@
VPATH = @srcdir@
THIS = Makefile
@@ -70,7 +70,10 @@ includesubdir = @includesubdir@
INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir)
+PACKAGE = @PACKAGE@
+
LIBTOOL = @LIBTOOL@
+LIBTOOL_OPTS = @LIBTOOL_OPTS@ @EXPORT_SYMS@
LIBTOOL_CLEAN = @LIB_CLEAN@
LIBTOOL_COMPILE = @LIB_COMPILE@
LIBTOOL_LINK = @LIB_LINK@
@@ -80,7 +83,7 @@ LT_UNDEF = @LT_UNDEF@
INSTALL = @INSTALL@
INSTALL_LIB = @INSTALL@ @INSTALL_LIB@
-INSTALL_PROG = @INSTALL_PROGRAM@
+INSTALL_PROG = @INSTALL_PROGRAM@ @INSTALL_OPT_S@
INSTALL_DATA = @INSTALL_DATA@
AR = @AR@
@@ -98,13 +101,13 @@ CPP = @CPP@
CFLAGS = @CFLAGS@
INCDIR = $(srcdir)/../include
-CPPFLAGS = -DHAVE_CONFIG_H -I../ncurses -I$(srcdir) @CPPFLAGS@
+CPPFLAGS = -DHAVE_CONFIG_H -I../ncurses @CPPFLAGS@
CCFLAGS = $(CPPFLAGS) $(CFLAGS)
-BUILD_CPPFLAGS = -I../include -DUSE_BUILD_CC @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 = -DHAVE_CONFIG_H -I../ncurses -I$(srcdir) -I$(INCDIR) $(BUILD_CPPFLAGS) @BUILD_CFLAGS@
+BUILD_CCFLAGS = @BUILD_CFLAGS@
BUILD_LDFLAGS = @BUILD_LDFLAGS@
BUILD_LIBS = @BUILD_LIBS@
@@ -123,14 +126,16 @@ CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@
CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@)
LINK = $(LIBTOOL)
-LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@
+LDFLAGS = @LDFLAGS@ @LD_MODEL@
SHLIB_DIRS = -L../lib
-SHLIB_LIST = $(SHLIB_DIRS) @SHLIB_LIST@
-TINFO_LIST = $(SHLIB_DIRS) @TINFO_LIST@
-TICS_LIST = $(SHLIB_DIRS) @TICS_LIST@
+SHLIB_LIST = $(SHLIB_DIRS) @SHLIB_LIST@ @LIBS@
+TINFO_LIST = $(SHLIB_DIRS) @TINFO_LIST@ @LIBS@
+TICS_LIST = $(SHLIB_DIRS) @TICS_LIST@ @LIBS@
RPATH_LIST = @RPATH_LIST@
+RESULTING_SYMS = @RESULTING_SYMS@
+VERSIONED_SYMS = @VERSIONED_SYMS@
MK_SHARED_LIB = @MK_SHARED_LIB@
NCURSES_MAJOR = @NCURSES_MAJOR@
@@ -150,14 +155,17 @@ FALLBACK_LIST = @FALLBACK_LIST@
USE_BIG_STRINGS = @USE_BIG_STRINGS@
TERMINFO_CAPS = $(top_srcdir)/include/@TERMINFO_CAPS@
+CAPLIST = $(TERMINFO_CAPS) $(top_srcdir)/include/Caps-ncurses
TERMINFO = @TERMINFO@
TERMINFO_SRC = @TERMINFO_SRC@
-TIC_PATH = @TIC_PATH@
+TIC_PATH = @TIC@
+INFOCMP_PATH = @INFOCMP@
AUTO_SRC = \
./codes.c \
./comp_captab.c \
+ ./comp_userdefs.c \
./expanded.c \
./fallback.c \
./lib_gen.c \
@@ -191,6 +199,8 @@ TEST_PROGS = \
hashmap$x \
lib_mvcur$x
+LOCAL_LIBDIR = @top_builddir@/lib
+
base = $(srcdir)/base
serial = $(srcdir)/tty
tinfo = $(srcdir)/tinfo
@@ -199,8 +209,9 @@ wide = $(srcdir)/widechar
win32con = $(srcdir)/win32con
################################################################################
-all \
-libs :: $(AUTO_SRC) ../lib $(LIBRARIES)
+all libs :: $(AUTO_SRC) ../lib $(LIBRARIES)
+
+@CHECK_BUILD@all libs :: report_offsets$(BUILD_EXEEXT)
sources: $(AUTO_SRC)
@@ -211,45 +222,59 @@ $(DESTDIR)$(libdir) :
../lib : ; mkdir $@
./fallback.c : $(tinfo)/MKfallback.sh
- sh -e $(tinfo)/MKfallback.sh $(TERMINFO) $(TERMINFO_SRC) $(TIC_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
- sh -e $(base)/MKlib_gen.sh "$(CPP) $(CPPFLAGS)" "$(AWK)" generated <../include/curses.h >$@
+ $(SHELL) -e $(base)/MKlib_gen.sh "$(CPP) $(CPPFLAGS)" "$(AWK)" generated <../include/curses.h >$@
init_keytry.h: make_keys$(BUILD_EXEEXT) keys.list
./make_keys$(BUILD_EXEEXT) keys.list > $@
keys.list : $(tinfo)/MKkeys_list.sh
- AWK=$(AWK) sh $(tinfo)/MKkeys_list.sh $(TERMINFO_CAPS) | sort >$@
+ AWK=$(AWK) $(SHELL) $(tinfo)/MKkeys_list.sh $(CAPLIST) | LC_ALL=C sort >$@
make_keys$(BUILD_EXEEXT) : \
+ build.priv.h \
$(tinfo)/make_keys.c \
names.c
- $(BUILD_CC) -o $@ $(BUILD_CCFLAGS) $(tinfo)/make_keys.c $(BUILD_LDFLAGS) $(BUILD_LIBS)
+ $(BUILD_CC) -o $@ $(BUILD_CPPFLAGS) $(BUILD_CCFLAGS) $(tinfo)/make_keys.c $(BUILD_LDFLAGS) $(BUILD_LIBS)
make_hash$(BUILD_EXEEXT) : \
+ build.priv.h \
$(tinfo)/make_hash.c \
../include/hashsize.h
- $(BUILD_CC) -o $@ $(BUILD_CCFLAGS) $(tinfo)/make_hash.c $(BUILD_LDFLAGS) $(BUILD_LIBS)
+ $(BUILD_CC) -o $@ $(BUILD_CPPFLAGS) $(BUILD_CCFLAGS) $(tinfo)/make_hash.c $(BUILD_LDFLAGS) $(BUILD_LIBS)
+
+report_offsets$(BUILD_EXEEXT) : \
+ $(srcdir)/curses.priv.h \
+ $(srcdir)/report_offsets.c
+ $(BUILD_CC) -o $@ $(BUILD_CPPFLAGS) $(BUILD_CCFLAGS) $(srcdir)/report_offsets.c $(BUILD_LDFLAGS) $(BUILD_LIBS)
+ ./report_offsets$(BUILD_EXEEXT)
./expanded.c : $(srcdir)/curses.priv.h $(serial)/MKexpanded.sh
- sh -e $(serial)/MKexpanded.sh "$(CPP)" $(CPPFLAGS) > $@
+ $(SHELL) -e $(serial)/MKexpanded.sh "$(CPP)" $(CPPFLAGS) > $@
./comp_captab.c: \
make_hash$(BUILD_EXEEXT) \
../include/hashsize.h \
$(tinfo)/MKcaptab.sh \
$(tinfo)/MKcaptab.awk
- sh -e $(tinfo)/MKcaptab.sh $(AWK) $(USE_BIG_STRINGS) $(tinfo)/MKcaptab.awk $(srcdir)/../include/@TERMINFO_CAPS@ > $@
+ $(SHELL) -e $(tinfo)/MKcaptab.sh $(AWK) $(USE_BIG_STRINGS) $(tinfo)/MKcaptab.awk $(CAPLIST) > $@
+
+./comp_userdefs.c: \
+ make_hash$(BUILD_EXEEXT) \
+ ../include/hashsize.h \
+ $(tinfo)/MKuserdefs.sh
+ $(SHELL) -e $(tinfo)/MKuserdefs.sh $(AWK) $(USE_BIG_STRINGS) $(CAPLIST) > $@
./lib_keyname.c: keys.list $(base)/MKkeyname.awk
$(AWK) -f $(base)/MKkeyname.awk bigstrings=$(USE_BIG_STRINGS) keys.list > $@
./codes.c: $(tinfo)/MKcodes.awk
- $(AWK) -f $(tinfo)/MKcodes.awk bigstrings=$(USE_BIG_STRINGS) $(srcdir)/../include/@TERMINFO_CAPS@ >$@
+ $(AWK) -f $(tinfo)/MKcodes.awk bigstrings=$(USE_BIG_STRINGS) $(CAPLIST) >$@
./names.c: $(tinfo)/MKnames.awk
- $(AWK) -f $(tinfo)/MKnames.awk bigstrings=$(USE_BIG_STRINGS) $(srcdir)/../include/@TERMINFO_CAPS@ >$@
+ $(AWK) -f $(tinfo)/MKnames.awk bigstrings=$(USE_BIG_STRINGS) $(CAPLIST) >$@
./unctrl.c: $(base)/MKunctrl.awk
echo | $(AWK) -f $(base)/MKunctrl.awk bigstrings=$(USE_BIG_STRINGS) >$@
@@ -260,17 +285,16 @@ tags:
@MAKE_UPPER_TAGS@TAGS:
@MAKE_UPPER_TAGS@ $(ETAGS) *.[ch] */*.[ch]
-ncurses.map : $(LIBRARIES)
- $(NM) -p $(LIBRARIES) >$@
-
mostlyclean ::
- -rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace
+ -rm -f core tags TAGS *~ *.bak *.i *.ln *.atac
+ -test -d trace || rm -f trace
-rm -f $(TEST_PROGS)
clean :: mostlyclean
-rm -f $(AUTO_SRC)
-rm -f make_keys$(BUILD_EXEEXT)
-rm -f make_hash$(BUILD_EXEEXT)
+ -rm -f report_offsets$(BUILD_EXEEXT)
-rm -rf .libs *.dSYM *.map
distclean :: clean
@@ -288,7 +312,7 @@ realclean :: distclean
test_progs : $(TEST_PROGS)
./link_test.c : $(base)/MKlib_gen.sh ../include/curses.h
- sh -e $(base)/MKlib_gen.sh "$(CPP) $(CPPFLAGS)" "$(AWK)" implemented <../include/curses.h >$@
+ $(SHELL) -e $(base)/MKlib_gen.sh "$(CPP) $(CPPFLAGS)" "$(AWK)" implemented <../include/curses.h >$@
captoinfo$x : $(tinfo)/captoinfo.c $(TEST_DEPS)
@ECHO_LD@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DMAIN $(tinfo)/captoinfo.c $(TEST_LDFLAGS)
diff --git a/ncurses/README.IZ b/ncurses/README.IZ
index 78206cdfd712..aad1710d7eb1 100644
--- a/ncurses/README.IZ
+++ b/ncurses/README.IZ
@@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
--- Copyright (c) 2002,2006 Free Software Foundation, Inc. --
+-- Copyright (c) 2002-2006,2020 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
@@ -25,11 +25,11 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: README.IZ,v 1.2 2006/04/22 23:13:05 tom Exp $
+-- $Id: README.IZ,v 1.3 2020/01/18 17:02:13 tom Exp $
---------------------------------------------------------------------
Here is the patch. I did no testing whatsoever with event watching
-requests present (I need some applications which exersize this before
+requests present (I need some applications which exercise this before
this, probably lynx ;-), but the code looks working "the normal way".
I had no way to test that the poll() branch compiles/works...
diff --git a/ncurses/SigAction.h b/ncurses/SigAction.h
index 5dfde643f6a1..4467fc6289d2 100644
--- a/ncurses/SigAction.h
+++ b/ncurses/SigAction.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000,2005 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 *
@@ -32,7 +32,7 @@
****************************************************************************/
/*
- * $Id: SigAction.h,v 1.8 2005/08/06 20:05:32 tom Exp $
+ * $Id: SigAction.h,v 1.9 2005/08/06 20:05:32 tom Exp $
*
* This file exists to handle non-POSIX systems which don't have <unistd.h>,
* and usually no sigaction() nor <termios.h>
diff --git a/ncurses/base/MKkeyname.awk b/ncurses/base/MKkeyname.awk
index 790161193169..e133858f2835 100644
--- a/ncurses/base/MKkeyname.awk
+++ b/ncurses/base/MKkeyname.awk
@@ -1,6 +1,6 @@
-# $Id: MKkeyname.awk,v 1.48 2013/08/24 17:37:22 tom Exp $
+# $Id: MKkeyname.awk,v 1.50 2017/04/11 01:18:08 tom Exp $
##############################################################################
-# Copyright (c) 1999-2012,2013 Free Software Foundation, Inc. #
+# Copyright (c) 1999-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"), #
@@ -70,14 +70,13 @@ END {
print "NCURSES_EXPORT(NCURSES_CONST char *)"
print "safe_keyname (SCREEN *sp, int c)"
print "{"
- print " int i;"
print " char name[20];"
- print " char *p;"
print " NCURSES_CONST char *result = 0;"
print ""
print " if (c == -1) {"
print " result = \"-1\";"
print " } else {"
+ print " int i;"
if (bigstrings) {
print " for (i = 0; _nc_key_names[i].offset != -1; i++) {"
print " if (_nc_key_names[i].code == c) {"
@@ -114,7 +113,7 @@ END {
print " /* create and cache result as needed */"
print " if (MyTable[c] == 0) {"
print " int cc = c;"
- print " p = name;"
+ print " char *p = name;"
print "#define P_LIMIT (sizeof(name) - (size_t) (p - name))"
print " if (cc >= 128 && m_prefix) {"
print " _nc_STRCPY(p, \"M-\", P_LIMIT);"
@@ -135,7 +134,7 @@ END {
print " } else if (result == 0 && HasTerminal(sp)) {"
print " int j, k;"
print " char * bound;"
- print " TERMTYPE *tp = &(TerminalOf(sp)->type);"
+ print " TERMTYPE2 *tp = &TerminalType(TerminalOf(sp));"
print " unsigned save_trace = _nc_tracing;"
print ""
print " _nc_tracing = 0; /* prevent recursion via keybound() */"
@@ -166,8 +165,8 @@ END {
print "#if NO_LEAKS"
print "void _nc_keyname_leaks(void)"
print "{"
- print " int j;"
print " if (MyTable != 0) {"
+ print " int j;"
print " for (j = 0; j < SIZEOF_TABLE; ++j) {"
print " FreeIfNeeded(MyTable[j]);"
print " }"
diff --git a/ncurses/base/MKlib_gen.sh b/ncurses/base/MKlib_gen.sh
index d8cc3c9751fa..a1587c424452 100755
--- a/ncurses/base/MKlib_gen.sh
+++ b/ncurses/base/MKlib_gen.sh
@@ -2,10 +2,10 @@
#
# MKlib_gen.sh -- generate sources from curses.h macro definitions
#
-# ($Id: MKlib_gen.sh,v 1.46 2011/06/04 19:14:08 tom Exp $)
+# ($Id: MKlib_gen.sh,v 1.62 2018/06/09 19:27:00 tom Exp $)
#
##############################################################################
-# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2017,2018 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), #
@@ -62,10 +62,27 @@ if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
if test "${LC_COLLATE+set}" = set; then LC_COLLATE=C; export LC_COLLATE; fi
-preprocessor="$1 -DNCURSES_INTERNALS -I../include"
+preprocessor="$1 -DNCURSES_WATTR_MACROS -DNCURSES_INTERNALS -I../include"
AWK="$2"
USE="$3"
+# A patch discussed here:
+# https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02185.html
+# introduces spurious #line markers into the preprocessor output. The result
+# 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`
+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/\..*$//'`
+if test -n "$FSF" && test -n "$ALL" && test -n "$ONE" ; then
+ if test $ONE -ge 5 ; then
+ echo ".. adding -P option to work around $PRG $ALL" >&2
+ preprocessor="$preprocessor -P"
+ fi
+fi
+
PID=$$
ED1=sed1_${PID}.sed
ED2=sed2_${PID}.sed
@@ -74,7 +91,7 @@ ED4=sed4_${PID}.sed
AW1=awk1_${PID}.awk
AW2=awk2_${PID}.awk
TMP=gen__${PID}.c
-trap "rm -f $ED1 $ED2 $ED3 $ED4 $AW1 $AW2 $TMP" 0 1 2 5 15
+trap "rm -f $ED1 $ED2 $ED3 $ED4 $AW1 $AW2 $TMP" 0 1 2 3 15
ALL=$USE
if test "$USE" = implemented ; then
@@ -82,6 +99,7 @@ if test "$USE" = implemented ; then
cat >$ED1 <<EOF1
/^extern.*implemented/{
h
+ s/GCC_DEPRECATED([^)]*)//
s/NCURSES_SP_NAME(\([^)]*\))/NCURSES_SP_NAME___\1/
h
s/^.*implemented:\([^ *]*\).*/P_POUNDCif_USE_\1_SUPPORT/p
@@ -160,6 +178,7 @@ EOF3
if test "$USE" = generated ; then
cat >$ED4 <<EOF
s/^\(.*\) \(.*\) (\(.*\))\$/NCURSES_EXPORT(\1) (\2) (\3)/
+ /attr_[sg]et.* z)/s,z),z GCC_UNUSED),
EOF
else
cat >$ED4 <<EOF
@@ -213,7 +232,7 @@ $0 !~ /^P_/ {
} else if ( $first == "bool" || $first == "NCURSES_BOOL" ) {
returnType = "Bool";
} else if ( $second == "*" ) {
- returnType = "Ptr";
+ returnType = ($1 == "NCURSES_CONST") ? "CPtr" : "Ptr";
} else {
returnType = "Code";
}
@@ -224,6 +243,9 @@ $0 !~ /^P_/ {
break;
}
}
+ if (using == "implemented") {
+ printf "#undef %s\n", $myfunc;
+ }
print $0;
print "{";
argcount = 1;
@@ -256,6 +278,11 @@ $0 !~ /^P_/ {
dotrace = 0;
}
+ do_getstr = 0;
+ if ($myfunc ~ /get[n]?str/) {
+ do_getstr = 1;
+ }
+
call = "@@T((T_CALLED(\""
args = ""
comma = ""
@@ -292,7 +319,11 @@ $0 !~ /^P_/ {
call = call "%s"
} else if (pointer) {
if ( argtype == "char" ) {
- call = call "%s"
+ if (do_getstr) {
+ call = call "%p"
+ } else {
+ call = call "%s"
+ }
comma = comma "_nc_visbuf2(" num ","
pointer = 0;
} else {
@@ -342,7 +373,7 @@ $0 !~ /^P_/ {
call = call ")); "
if (dotrace)
- printf "%s", call
+ printf "%s\n\t@@", call
if (match($0, "^void")) {
call = ""
@@ -381,9 +412,10 @@ EOF1
cat >$AW2 <<EOF1
BEGIN {
+ printf "/* This file was generated by $0 $USE */\n"
+ print ""
print "/*"
print " * DO NOT EDIT THIS FILE BY HAND!"
- printf " * It is generated by $0 %s.\n", "$USE"
if ( "$USE" == "generated" ) {
print " *"
print " * This is a file of trivial functions generated from macro"
@@ -403,11 +435,6 @@ BEGIN {
print ""
print "#include <curses.priv.h>"
print ""
- print "#undef vw_scanw"
- print "#undef vwscanw"
- print ""
- print "#undef vw_printw"
- print "#undef vwprintw"
}
/^DECLARATIONS/ {start = 1; next;}
{
@@ -432,16 +459,16 @@ END {
for (n = 1; n < start; ++n) {
value = calls[n];
if ( value !~ /P_POUNDC/ ) {
- gsub(/[[:blank:]]+/," ",value);
- sub(/^[[:alnum:]_]+ /,"",value);
+ gsub(/[ \t]+/," ",value);
+ sub(/^[0-9a-zA-Z_]+ /,"",value);
sub(/^\* /,"",value);
- gsub(/[[:alnum:]_]+ \* /,"",value);
+ gsub(/[0-9a-zA-Z_]+ \* /,"",value);
gsub(/ (const) /," ",value);
gsub(/ (int|short|attr_t|chtype|wchar_t|NCURSES_BOOL|NCURSES_OUTC|NCURSES_OUTC_sp|va_list) /," ",value);
gsub(/ void /,"",value);
sub(/^/,"call_",value);
- gsub(/ (a[[:digit:]]|z) /, " 0 ", value);
- gsub(/ int[[:blank:]]*[(][^)]+[)][(][^)]+[)]/, "0", value);
+ gsub(/ (a[0-9]|z) /, " 0 ", value);
+ gsub(/ int[ \t]*[(][^)]+[)][(][^)]+[)]/, "0", value);
printf "\t%s;\n", value;
} else {
print value;
diff --git a/ncurses/base/MKunctrl.awk b/ncurses/base/MKunctrl.awk
index 51ceb6343920..0b505d0ce912 100644
--- a/ncurses/base/MKunctrl.awk
+++ b/ncurses/base/MKunctrl.awk
@@ -1,6 +1,6 @@
-# $Id: MKunctrl.awk,v 1.27 2012/06/09 20:29:33 tom Exp $
+# $Id: MKunctrl.awk,v 1.28 2017/02/11 17:30:48 tom Exp $
##############################################################################
-# Copyright (c) 1998-2009,2012 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2012,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"), #
@@ -143,6 +143,7 @@ END {
print "\tint check = (int) ChCharOf(ch);"
print "\tconst char *result;"
print ""
+ print "(void) sp;"
print "\tif (check >= 0 && check < (int)SIZEOF(unctrl_table)) {"
print "#if NCURSES_EXT_FUNCS"
print "\t\tif ((sp != 0)"
diff --git a/ncurses/base/define_key.c b/ncurses/base/define_key.c
index a49b094279c8..c78375a72c25 100644
--- a/ncurses/base/define_key.c
+++ b/ncurses/base/define_key.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2014 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 *
@@ -33,7 +33,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: define_key.c,v 1.20 2009/11/28 22:53:17 tom Exp $")
+MODULE_ID("$Id: define_key.c,v 1.21 2014/03/08 20:32:59 tom Exp $")
NCURSES_EXPORT(int)
NCURSES_SP_NAME(define_key) (NCURSES_SP_DCLx const char *str, int keycode)
@@ -47,7 +47,7 @@ NCURSES_SP_NAME(define_key) (NCURSES_SP_DCLx const char *str, int keycode)
unsigned ukey = (unsigned) keycode;
#ifdef USE_TERM_DRIVER
-#define CallHasKey(keycode) CallDriver_1(SP_PARM, kyExist, keycode)
+#define CallHasKey(keycode) CallDriver_1(SP_PARM, td_kyExist, keycode)
#else
#define CallHasKey(keycode) NCURSES_SP_NAME(has_key)(NCURSES_SP_ARGx keycode)
#endif
diff --git a/ncurses/base/keyok.c b/ncurses/base/keyok.c
index 00e936dacde9..180c54aa191c 100644
--- a/ncurses/base/keyok.c
+++ b/ncurses/base/keyok.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2014,2019 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 *
@@ -33,7 +33,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: keyok.c,v 1.13 2012/11/18 02:14:35 tom Exp $")
+MODULE_ID("$Id: keyok.c,v 1.15 2019/12/21 22:40:32 tom Exp $")
/*
* Enable (or disable) ncurses' interpretation of a keycode by adding (or
@@ -53,9 +53,8 @@ NCURSES_SP_NAME(keyok) (NCURSES_SP_DCLx int c, bool flag)
if (HasTerminal(SP_PARM)) {
T((T_CALLED("keyok(%p, %d,%d)"), (void *) SP_PARM, c, flag));
#ifdef USE_TERM_DRIVER
- code = CallDriver_2(sp, kyOk, c, flag);
+ code = CallDriver_2(sp, td_kyOk, c, flag);
#else
- T((T_CALLED("keyok(%d,%d)"), c, flag));
if (c >= 0) {
int count = 0;
char *s;
diff --git a/ncurses/base/lib_addch.c b/ncurses/base/lib_addch.c
index a7d498b490a0..fdb26415b205 100644
--- a/ncurses/base/lib_addch.c
+++ b/ncurses/base/lib_addch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2017,2019 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 *
@@ -36,7 +36,7 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_addch.c,v 1.128 2014/02/23 01:21:08 tom Exp $")
+MODULE_ID("$Id: lib_addch.c,v 1.133 2019/05/11 19:51:02 tom Exp $")
static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT);
@@ -51,7 +51,7 @@ static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT);
*/
/* Return bit mask for clearing color pair number if given ch has color */
-#define COLOR_MASK(ch) (~(attr_t)((ch) & A_COLOR ? A_COLOR : 0))
+#define COLOR_MASK(ch) (~(attr_t)(((ch) & A_COLOR) ? A_COLOR : 0))
static NCURSES_INLINE NCURSES_CH_T
render_char(WINDOW *win, NCURSES_CH_T ch)
@@ -117,14 +117,18 @@ _nc_render(WINDOW *win, NCURSES_CH_T ch)
#endif
static bool
-newline_forces_scroll(WINDOW *win, NCURSES_SIZE_T * ypos)
+newline_forces_scroll(WINDOW *win, NCURSES_SIZE_T *ypos)
{
bool result = FALSE;
- if (*ypos >= win->_regtop && *ypos == win->_regbottom) {
- *ypos = win->_regbottom;
- result = TRUE;
- } else {
+ if (*ypos >= win->_regtop && *ypos <= win->_regbottom) {
+ if (*ypos == win->_regbottom) {
+ *ypos = win->_regbottom;
+ result = TRUE;
+ } else if (*ypos < win->_maxy) {
+ *ypos = (NCURSES_SIZE_T) (*ypos + 1);
+ }
+ } else if (*ypos < win->_maxy) {
*ypos = (NCURSES_SIZE_T) (*ypos + 1);
}
return result;
@@ -270,11 +274,11 @@ waddch_literal(WINDOW *win, NCURSES_CH_T ch)
/* handle EILSEQ (i.e., when len >= -1) */
if (len == -1 && is8bits(CharOf(ch))) {
- int rc = OK;
const char *s = NCURSES_SP_NAME(unctrl)
(NCURSES_SP_ARGx (chtype) CharOf(ch));
if (s[1] != '\0') {
+ int rc = OK;
while (*s != '\0') {
rc = waddch(win, UChar(*s) | attr);
if (rc != OK)
@@ -299,7 +303,7 @@ waddch_literal(WINDOW *win, NCURSES_CH_T ch)
* adjustments.
*/
if_WIDEC({
- int len = wcwidth(CharOf(ch));
+ int len = _nc_wacs_width(CharOf(ch));
int i;
int j;
wchar_t *chars;
@@ -339,6 +343,7 @@ waddch_literal(WINDOW *win, NCURSES_CH_T ch)
return ERR;
x = win->_curx;
y = win->_cury;
+ CHECK_POSITION(win, x, y);
line = win->_line + y;
}
/*
@@ -427,7 +432,7 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch)
s[1] == 0
)
|| (
- (isprint((int)t) && !iscntrl((int)t))
+ (isprint((int) t) && !iscntrl((int) t))
#if USE_WIDEC_SUPPORT
|| ((sp == 0 || !sp->_legacy_coding) &&
(WINDOW_EXT(win, addch_used)
@@ -443,6 +448,7 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch)
*/
x = win->_curx;
y = win->_cury;
+ CHECK_POSITION(win, x, y);
switch (t) {
case '\t':
@@ -501,7 +507,7 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch)
default:
while (*s) {
NCURSES_CH_T sch;
- SetChar(sch, *s++, AttrOf(ch));
+ SetChar(sch, UChar(*s++), AttrOf(ch));
if_EXT_COLORS(SetPair(sch, GetPair(ch)));
if (waddch_literal(win, sch) == ERR)
return ERR;
diff --git a/ncurses/base/lib_addstr.c b/ncurses/base/lib_addstr.c
index a1a55cb8bfd8..55dc440b0047 100644
--- a/ncurses/base/lib_addstr.c
+++ b/ncurses/base/lib_addstr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2017,2019 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 *
@@ -44,7 +44,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_addstr.c,v 1.52 2011/05/28 23:02:09 tom Exp $")
+MODULE_ID("$Id: lib_addstr.c,v 1.55 2019/05/04 20:46:24 tom Exp $")
NCURSES_EXPORT(int)
waddnstr(WINDOW *win, const char *astr, int n)
@@ -87,7 +87,7 @@ waddchnstr(WINDOW *win, const chtype *astr, int n)
T((T_CALLED("waddchnstr(%p,%p,%d)"), (void *) win, (const void *) astr, n));
- if (!win)
+ if (!win || !astr)
returnCode(ERR);
y = win->_cury;
@@ -183,7 +183,7 @@ wadd_wchnstr(WINDOW *win, const cchar_t *astr, int n)
if (isWidecExt(astr[i]))
continue;
- len = wcwidth(CharOf(astr[i]));
+ len = _nc_wacs_width(CharOf(astr[i]));
if (x + len - 1 <= win->_maxx) {
line->text[x] = _nc_render(win, astr[i]);
@@ -194,6 +194,8 @@ wadd_wchnstr(WINDOW *win, const cchar_t *astr, int n)
}
SetWidecExt(line->text[x + j], j);
}
+ } else {
+ len = 1;
}
x = (NCURSES_SIZE_T) (x + len);
end += len - 1;
diff --git a/ncurses/base/lib_beep.c b/ncurses/base/lib_beep.c
index 4e14cb74a2bf..b775d56e8001 100644
--- a/ncurses/base/lib_beep.c
+++ b/ncurses/base/lib_beep.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2014 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 *
@@ -46,7 +46,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_beep.c,v 1.16 2013/01/12 17:26:25 tom Exp $")
+MODULE_ID("$Id: lib_beep.c,v 1.17 2014/03/08 20:32:59 tom Exp $")
/*
* beep()
@@ -65,7 +65,7 @@ NCURSES_SP_NAME(beep) (NCURSES_SP_DCL0)
#ifdef USE_TERM_DRIVER
if (SP_PARM != 0)
- res = CallDriver_1(SP_PARM, doBeepOrFlash, TRUE);
+ res = CallDriver_1(SP_PARM, td_doBeepOrFlash, TRUE);
#else
/* FIXME: should make sure that we are not in altchar mode */
if (cur_term == 0) {
diff --git a/ncurses/base/lib_bkgd.c b/ncurses/base/lib_bkgd.c
index 7bcd3ffb5a3f..aa1db21e4fa8 100644
--- a/ncurses/base/lib_bkgd.c
+++ b/ncurses/base/lib_bkgd.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 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 *
@@ -36,7 +36,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_bkgd.c,v 1.48 2012/12/09 01:01:19 tom Exp $")
+MODULE_ID("$Id: lib_bkgd.c,v 1.53 2019/08/17 20:59:41 tom Exp $")
/*
* Set the window's background information.
@@ -117,29 +117,98 @@ static NCURSES_INLINE int
#endif
wbkgrnd(WINDOW *win, const ARG_CH_T ch)
{
+#undef SP_PARM
+#define SP_PARM SP /* to use Charable() */
int code = ERR;
- int x, y;
T((T_CALLED("wbkgd(%p,%s)"), (void *) win, _tracech_t(ch)));
- if (win) {
+ if (SP == 0) {
+ ;
+ } else if (win) {
NCURSES_CH_T new_bkgd = CHDEREF(ch);
- NCURSES_CH_T old_bkgrnd;
+ NCURSES_CH_T old_bkgd;
+ int y;
+ NCURSES_CH_T old_char;
+ attr_t old_attr;
+ int old_pair;
+ NCURSES_CH_T new_char;
+ attr_t new_attr;
+ int new_pair;
+
+ /* SVr4 trims color info if non-color terminal */
+ if (!SP->_pair_limit) {
+ RemAttr(new_bkgd, A_COLOR);
+ SetPair(new_bkgd, 0);
+ }
+
+ memset(&old_bkgd, 0, sizeof(old_bkgd));
+ (void) wgetbkgrnd(win, &old_bkgd);
+
+ if (!memcmp(&old_bkgd, &new_bkgd, sizeof(new_bkgd))) {
+ T(("...unchanged"));
+ returnCode(OK);
+ }
- memset(&old_bkgrnd, 0, sizeof(old_bkgrnd));
- wgetbkgrnd(win, &old_bkgrnd);
+ old_char = old_bkgd;
+ RemAttr(old_char, ~A_CHARTEXT);
+ old_attr = AttrOf(old_bkgd);
+ old_pair = GetPair(old_bkgd);
+
+ if (!(old_attr & A_COLOR)) {
+ old_pair = 0;
+ }
+ T(("... old background char %s, attr %s, pair %d",
+ _tracechar(CharOf(old_char)), _traceattr(old_attr), old_pair));
+
+ new_char = new_bkgd;
+ RemAttr(new_char, ~A_CHARTEXT);
+ new_attr = AttrOf(new_bkgd);
+ new_pair = GetPair(new_bkgd);
+
+ /* SVr4 limits background character to printable 7-bits */
+ if (!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));
(void) wbkgrndset(win, CHREF(new_bkgd));
- (void) wattrset(win, (int) AttrOf(win->_nc_bkgd));
+
+ /* SVr4 updates color pair if old/new match, otherwise just attrs */
+ if ((new_pair != 0) && (new_pair == old_pair)) {
+ WINDOW_ATTRS(win) = new_attr;
+ SET_WINDOW_PAIR(win, new_pair);
+ } else {
+ WINDOW_ATTRS(win) = new_attr;
+ }
for (y = 0; y <= win->_maxy; y++) {
+ int x;
+
for (x = 0; x <= win->_maxx; x++) {
- if (CharEq(win->_line[y].text[x], old_bkgrnd)) {
- win->_line[y].text[x] = win->_nc_bkgd;
+ NCURSES_CH_T *cp = &(win->_line[y].text[x]);
+ int tmp_pair = GetPair(*cp);
+ attr_t tmp_attr = AttrOf(*cp);
+
+ if (CharEq(*cp, old_bkgd)) {
+ SetChar2(*cp, CharOf(new_char));
+ }
+ if (tmp_pair != 0) {
+ if (tmp_pair == old_pair) {
+ SetAttr(*cp, (tmp_attr & ~old_attr) | new_attr);
+ SetPair(*cp, new_pair);
+ } else {
+ SetAttr(*cp,
+ (tmp_attr & (~old_attr | A_COLOR))
+ | (new_attr & ALL_BUT_COLOR));
+ }
} else {
- NCURSES_CH_T wch = win->_line[y].text[x];
- RemAttr(wch, (~(A_ALTCHARSET | A_CHARTEXT)));
- win->_line[y].text[x] = _nc_render(win, wch);
+ SetAttr(*cp, (tmp_attr & ~old_attr) | new_attr);
+ SetPair(*cp, new_pair);
}
}
}
diff --git a/ncurses/base/lib_box.c b/ncurses/base/lib_box.c
index 6f17c97a5b07..dccb8e12d61c 100644
--- a/ncurses/base/lib_box.c
+++ b/ncurses/base/lib_box.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,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 *
@@ -42,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_box.c,v 1.24 2010/04/24 23:51:57 tom Exp $")
+MODULE_ID("$Id: lib_box.c,v 1.25 2017/10/27 21:56:17 tom Exp $")
#if USE_WIDEC_SUPPORT
static NCURSES_INLINE chtype
@@ -114,10 +114,20 @@ wborder(WINDOW *win,
win->_line[endy].lastchar = win->_line[0].lastchar = endx;
for (i = 0; i <= endy; i++) {
+#if USE_WIDEC_SUPPORT
+ if (endx > 0 && isWidecExt(win->_line[i].text[endx])) {
+ SetChar2(win->_line[i].text[endx - 1], ' ');
+ }
+#endif
SetChar2(win->_line[i].text[0], wls);
SetChar2(win->_line[i].text[endx], wrs);
win->_line[i].firstchar = 0;
win->_line[i].lastchar = endx;
+#if USE_WIDEC_SUPPORT
+ if (isWidecExt(win->_line[i].text[1])) {
+ SetChar2(win->_line[i].text[1], ' ');
+ }
+#endif
}
SetChar2(win->_line[0].text[0], wtl);
SetChar2(win->_line[0].text[endx], wtr);
diff --git a/ncurses/base/lib_chgat.c b/ncurses/base/lib_chgat.c
index 1eb1f59e2385..e969d69bebb7 100644
--- a/ncurses/base/lib_chgat.c
+++ b/ncurses/base/lib_chgat.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2010,2014 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-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 *
@@ -42,35 +42,38 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_chgat.c,v 1.10 2014/02/01 22:13:31 tom Exp $")
+MODULE_ID("$Id: lib_chgat.c,v 1.12 2017/03/16 23:45:20 tom Exp $")
NCURSES_EXPORT(int)
wchgat(WINDOW *win,
int n,
attr_t attr,
- NCURSES_PAIRS_T color,
+ NCURSES_PAIRS_T pair_arg,
const void *opts GCC_UNUSED)
{
- int i;
+ int code = ERR;
+ int color_pair = pair_arg;
T((T_CALLED("wchgat(%p,%d,%s,%d)"),
(void *) win,
n,
_traceattr(attr),
- (int) color));
+ color_pair));
+ set_extended_pair(opts, color_pair);
if (win) {
struct ldat *line = &(win->_line[win->_cury]);
+ int i;
- toggle_attr_on(attr, ColorPair(color));
+ toggle_attr_on(attr, ColorPair(color_pair));
for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) {
SetAttr(line->text[i], attr);
- SetPair(line->text[i], color);
+ SetPair(line->text[i], color_pair);
CHANGED_CELL(line, i);
}
- returnCode(OK);
- } else
- returnCode(ERR);
+ code = OK;
+ }
+ returnCode(code);
}
diff --git a/ncurses/base/lib_color.c b/ncurses/base/lib_color.c
index 9f7250ddafff..e2958051e6b8 100644
--- a/ncurses/base/lib_color.c
+++ b/ncurses/base/lib_color.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -38,14 +38,17 @@
* Handles color emulation of SYS V curses
*/
+#define NEW_PAIR_INTERNAL 1
+
#include <curses.priv.h>
+#include <new_pair.h>
#include <tic.h>
#ifndef CUR
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_color.c,v 1.109 2014/02/01 22:22:30 tom Exp $")
+MODULE_ID("$Id: lib_color.c,v 1.142 2019/12/22 00:57:53 tom Exp $")
#ifdef USE_TERM_DRIVER
#define CanChange InfoOf(SP_PARM).canchange
@@ -137,13 +140,6 @@ NCURSES_EXPORT_VAR(const color_t*) _nc_hls_palette = hls_palette;
/* *INDENT-ON* */
-/*
- * Ensure that we use color pairs only when colors have been started, and also
- * that the index is within the limits of the table which we allocated.
- */
-#define ValidPair(pair) \
- ((SP_PARM != 0) && (pair >= 0) && (pair < SP_PARM->_pair_limit) && SP_PARM->_coloron)
-
#if NCURSES_EXT_FUNCS
/*
* These are called from _nc_do_color(), which in turn is called from
@@ -188,7 +184,7 @@ static void
set_background_color(NCURSES_SP_DCLx int bg, NCURSES_SP_OUTC outc)
{
#ifdef USE_TERM_DRIVER
- CallDriver_3(SP_PARM, color, FALSE, bg, outc);
+ CallDriver_3(SP_PARM, td_color, FALSE, bg, outc);
#else
if (set_a_background) {
TPUTS_TRACE("set_a_background");
@@ -208,7 +204,7 @@ static void
set_foreground_color(NCURSES_SP_DCLx int fg, NCURSES_SP_OUTC outc)
{
#ifdef USE_TERM_DRIVER
- CallDriver_3(SP_PARM, color, TRUE, fg, outc);
+ CallDriver_3(SP_PARM, td_color, TRUE, fg, outc);
#else
if (set_a_foreground) {
TPUTS_TRACE("set_a_foreground");
@@ -251,6 +247,60 @@ init_color_table(NCURSES_SP_DCL0)
}
}
+static bool
+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) {
+ /* find the number of bits needed for the maximum color value */
+ for (width = 0; (1 << width) - 1 < (COLORS - 1); ++width) {
+ ;
+ }
+
+ if ((n = tigetflag(name)) > 0) {
+ n = (width + 2) / 3;
+ result->bits.red = UChar(n);
+ result->bits.green = UChar(n);
+ result->bits.blue = UChar(width - (2 * n));
+ } else if ((n = tigetnum(name)) > 0) {
+ result->bits.red = UChar(n);
+ result->bits.green = UChar(n);
+ result->bits.blue = UChar(n);
+ } else if ((s = tigetstr(name)) != 0 && VALID_STRING(s)) {
+ int red = n;
+ int green = n;
+ int blue = width - (2 * n);
+
+ switch (sscanf(s, "%d/%d/%d", &red, &green, &blue)) {
+ default:
+ blue = width - (2 * n);
+ /* FALLTHRU */
+ case 1:
+ green = n;
+ /* FALLTHRU */
+ case 2:
+ red = n;
+ /* FALLTHRU */
+ case 3:
+ /* okay */
+ break;
+ }
+ result->bits.red = UChar(red);
+ result->bits.green = UChar(green);
+ result->bits.blue = UChar(blue);
+ }
+ }
+ return (result->value != 0);
+}
+
/*
* Reset the color pair, e.g., to whatever color pair 0 is.
*/
@@ -258,7 +308,7 @@ static bool
reset_color_pair(NCURSES_SP_DCL0)
{
#ifdef USE_TERM_DRIVER
- return CallDriver(SP_PARM, rescol);
+ return CallDriver(SP_PARM, td_rescol);
#else
bool result = FALSE;
@@ -288,7 +338,7 @@ NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_DCL0)
result = TRUE;
#ifdef USE_TERM_DRIVER
- result = CallDriver(SP_PARM, rescolors);
+ result = CallDriver(SP_PARM, td_rescolors);
#else
if (orig_colors != 0) {
NCURSES_PUTP2("orig_colors", orig_colors);
@@ -346,7 +396,10 @@ NCURSES_SP_NAME(start_color) (NCURSES_SP_DCL0)
* allow for default-color as a component of a color-pair.
*/
SP_PARM->_pair_limit += (1 + (2 * maxcolors));
+#if !NCURSES_EXT_COLORS
+ SP_PARM->_pair_limit = limit_PAIRS(SP_PARM->_pair_limit);
#endif
+#endif /* NCURSES_EXT_FUNCS */
SP_PARM->_pair_count = maxpairs;
SP_PARM->_color_count = maxcolors;
#if !USE_REENTRANT
@@ -354,19 +407,26 @@ NCURSES_SP_NAME(start_color) (NCURSES_SP_DCL0)
COLORS = maxcolors;
#endif
- SP_PARM->_color_pairs = TYPE_CALLOC(colorpair_t, SP_PARM->_pair_limit);
+ ReservePairs(SP_PARM, 16);
if (SP_PARM->_color_pairs != 0) {
- SP_PARM->_color_table = TYPE_CALLOC(color_t, maxcolors);
- if (SP_PARM->_color_table != 0) {
- SP_PARM->_color_pairs[0] = PAIR_OF(default_fg(NCURSES_SP_ARG),
- default_bg(NCURSES_SP_ARG));
- init_color_table(NCURSES_SP_ARG);
-
+ if (init_direct_colors(NCURSES_SP_ARG)) {
+ result = OK;
+ } else {
+ SP_PARM->_color_table = TYPE_CALLOC(color_t, maxcolors);
+ if (SP_PARM->_color_table != 0) {
+ MakeColorPair(SP_PARM->_color_pairs[0],
+ default_fg(NCURSES_SP_ARG),
+ default_bg(NCURSES_SP_ARG));
+ init_color_table(NCURSES_SP_ARG);
+
+ result = OK;
+ }
+ }
+ if (result == OK) {
T(("started color: COLORS = %d, COLOR_PAIRS = %d",
COLORS, COLOR_PAIRS));
SP_PARM->_coloron = 1;
- result = OK;
} else if (SP_PARM->_color_pairs != 0) {
FreeAndNull(SP_PARM->_color_pairs);
}
@@ -388,7 +448,7 @@ start_color(void)
/* This function was originally written by Daniel Weaver <danw@znyx.com> */
static void
-rgb2hls(int r, int g, int b, NCURSES_COLOR_T *h, NCURSES_COLOR_T *l, NCURSES_COLOR_T *s)
+rgb2hls(int r, int g, int b, int *h, int *l, int *s)
/* convert RGB to HLS system */
{
int min, max, t;
@@ -399,7 +459,7 @@ rgb2hls(int r, int g, int b, NCURSES_COLOR_T *h, NCURSES_COLOR_T *l, NCURSES_COL
max = b;
/* calculate lightness */
- *l = (NCURSES_COLOR_T) ((min + max) / 20);
+ *l = ((min + max) / 20);
if (min == max) { /* black, white and all shades of gray */
*h = 0;
@@ -409,19 +469,88 @@ rgb2hls(int r, int g, int b, NCURSES_COLOR_T *h, NCURSES_COLOR_T *l, NCURSES_COL
/* calculate saturation */
if (*l < 50)
- *s = (NCURSES_COLOR_T) (((max - min) * 100) / (max + min));
+ *s = (((max - min) * 100) / (max + min));
else
- *s = (NCURSES_COLOR_T) (((max - min) * 100) / (2000 - max - min));
+ *s = (((max - min) * 100) / (2000 - max - min));
/* calculate hue */
if (r == max)
- t = (NCURSES_COLOR_T) (120 + ((g - b) * 60) / (max - min));
+ t = (120 + ((g - b) * 60) / (max - min));
else if (g == max)
- t = (NCURSES_COLOR_T) (240 + ((b - r) * 60) / (max - min));
+ t = (240 + ((b - r) * 60) / (max - min));
else
- t = (NCURSES_COLOR_T) (360 + ((r - g) * 60) / (max - min));
+ t = (360 + ((r - g) * 60) / (max - min));
+
+ *h = (t % 360);
+}
+
+/*
+ * Change all cells which use(d) a given color pair to force a repaint.
+ */
+NCURSES_EXPORT(void)
+_nc_change_pair(SCREEN *sp, int pair)
+{
+ int y, x;
+
+ if (CurScreen(sp)->_clear)
+ return;
+#if NO_LEAKS
+ if (_nc_globals.leak_checking)
+ return;
+#endif
+
+ for (y = 0; y <= CurScreen(sp)->_maxy; y++) {
+ struct ldat *ptr = &(CurScreen(sp)->_line[y]);
+ bool changed = FALSE;
+ for (x = 0; x <= CurScreen(sp)->_maxx; x++) {
+ if (GetPair(ptr->text[x]) == pair) {
+ /* Set the old cell to zero to ensure it will be
+ updated on the next doupdate() */
+ SetChar(ptr->text[x], 0, 0);
+ CHANGED_CELL(ptr, x);
+ changed = TRUE;
+ }
+ }
+ if (changed)
+ NCURSES_SP_NAME(_nc_make_oldhash) (NCURSES_SP_ARGx y);
+ }
+}
- *h = (NCURSES_COLOR_T) (t % 360);
+NCURSES_EXPORT(void)
+_nc_reserve_pairs(SCREEN *sp, int want)
+{
+ int have = sp->_pair_alloc;
+
+ if (have == 0)
+ have = 1;
+ while (have <= want)
+ have *= 2;
+ if (have > sp->_pair_limit)
+ have = sp->_pair_limit;
+
+ if (sp->_color_pairs == 0) {
+ sp->_color_pairs = TYPE_CALLOC(colorpair_t, have);
+ } else if (have > sp->_pair_alloc) {
+#if NCURSES_EXT_COLORS
+ colorpair_t *next;
+
+ if ((next = typeCalloc(colorpair_t, have)) == 0)
+ _nc_err_abort(MSG_NO_MEMORY);
+ memcpy(next, sp->_color_pairs, (size_t) sp->_pair_alloc * sizeof(*next));
+ _nc_copy_pairs(sp, next, sp->_color_pairs, sp->_pair_alloc);
+ free(sp->_color_pairs);
+ sp->_color_pairs = next;
+#else
+ TYPE_REALLOC(colorpair_t, have, sp->_color_pairs);
+ if (sp->_color_pairs != 0) {
+ memset(sp->_color_pairs + sp->_pair_alloc, 0,
+ sizeof(colorpair_t) * (size_t) (have - sp->_pair_alloc));
+ }
+#endif
+ }
+ if (sp->_color_pairs != 0) {
+ sp->_pair_alloc = have;
+ }
}
/*
@@ -429,32 +558,27 @@ rgb2hls(int r, int g, int b, NCURSES_COLOR_T *h, NCURSES_COLOR_T *l, NCURSES_COL
* values.
*/
NCURSES_EXPORT(int)
-NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx
- NCURSES_PAIRS_T pair,
- NCURSES_COLOR_T f,
- NCURSES_COLOR_T b)
+_nc_init_pair(SCREEN *sp, int pair, int f, int b)
{
- colorpair_t result;
+ static colorpair_t null_pair;
+ colorpair_t result = null_pair;
colorpair_t previous;
int maxcolors;
- T((T_CALLED("init_pair(%p,%d,%d,%d)"),
- (void *) SP_PARM,
- (int) pair,
- (int) f,
- (int) b));
+ T((T_CALLED("init_pair(%p,%d,%d,%d)"), (void *) sp, pair, f, b));
- if (!ValidPair(pair))
+ if (!ValidPair(sp, pair))
returnCode(ERR);
maxcolors = MaxColors;
- previous = SP_PARM->_color_pairs[pair];
+ ReservePairs(sp, pair);
+ previous = sp->_color_pairs[pair];
#if NCURSES_EXT_FUNCS
- if (SP_PARM->_default_color || SP_PARM->_assumed_color) {
+ if (sp->_default_color || sp->_assumed_color) {
bool isDefault = FALSE;
bool wasDefault = FALSE;
- int default_pairs = SP_PARM->_default_pairs;
+ int default_pairs = sp->_default_pairs;
/*
* Map caller's color number, e.g., -1, 0, 1, .., 7, etc., into
@@ -479,8 +603,8 @@ NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx
* Check if the table entry that we are going to init/update used
* default colors.
*/
- if ((FORE_OF(previous) == COLOR_DEFAULT)
- || (BACK_OF(previous) == COLOR_DEFAULT))
+ if (isDefaultColor(FORE_OF(previous))
+ || isDefaultColor(BACK_OF(previous)))
wasDefault = TRUE;
/*
@@ -501,10 +625,10 @@ NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx
* that does not will decrement the count - and possibly interfere
* with sequentially adding new pairs.
*/
- if (pair > (SP_PARM->_pair_count + default_pairs)) {
+ if (pair > (sp->_pair_count + default_pairs)) {
returnCode(ERR);
}
- SP_PARM->_default_pairs = default_pairs;
+ sp->_default_pairs = default_pairs;
} else
#endif
{
@@ -520,34 +644,22 @@ NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx
* initialized before a screen update is performed replacing original
* pair colors with the new ones).
*/
- result = PAIR_OF(f, b);
- if (previous != 0
- && previous != result) {
- int y, x;
-
- for (y = 0; y <= CurScreen(SP_PARM)->_maxy; y++) {
- struct ldat *ptr = &(CurScreen(SP_PARM)->_line[y]);
- bool changed = FALSE;
- for (x = 0; x <= CurScreen(SP_PARM)->_maxx; x++) {
- if (GetPair(ptr->text[x]) == pair) {
- /* Set the old cell to zero to ensure it will be
- updated on the next doupdate() */
- SetChar(ptr->text[x], 0, 0);
- CHANGED_CELL(ptr, x);
- changed = TRUE;
- }
- }
- if (changed)
- NCURSES_SP_NAME(_nc_make_oldhash) (NCURSES_SP_ARGx y);
- }
+ MakeColorPair(result, f, b);
+ if ((FORE_OF(previous) != 0
+ || BACK_OF(previous) != 0)
+ && !isSamePair(previous, result)) {
+ _nc_change_pair(sp, pair);
}
- SP_PARM->_color_pairs[pair] = result;
- if (GET_SCREEN_PAIR(SP_PARM) == pair)
- SET_SCREEN_PAIR(SP_PARM, (chtype) (~0)); /* force attribute update */
+ _nc_reset_color_pair(sp, pair, &result);
+ sp->_color_pairs[pair] = result;
+ _nc_set_color_pair(sp, pair, cpINIT);
+
+ if (GET_SCREEN_PAIR(sp) == pair)
+ SET_SCREEN_PAIR(sp, (int) (~0)); /* force attribute update */
#ifdef USE_TERM_DRIVER
- CallDriver_3(SP_PARM, initpair, pair, f, b);
+ CallDriver_3(sp, td_initpair, pair, f, b);
#else
if (initialize_pair && InPalette(f) && InPalette(b)) {
const color_t *tp = DefaultPalette;
@@ -573,6 +685,15 @@ NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx
returnCode(OK);
}
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx
+ NCURSES_PAIRS_T pair,
+ NCURSES_COLOR_T f,
+ NCURSES_COLOR_T b)
+{
+ return _nc_init_pair(SP_PARM, pair, f, b);
+}
+
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
init_pair(NCURSES_COLOR_T pair, NCURSES_COLOR_T f, NCURSES_COLOR_T b)
@@ -584,59 +705,65 @@ init_pair(NCURSES_COLOR_T pair, NCURSES_COLOR_T f, NCURSES_COLOR_T b)
#define okRGB(n) ((n) >= 0 && (n) <= 1000)
NCURSES_EXPORT(int)
-NCURSES_SP_NAME(init_color) (NCURSES_SP_DCLx
- NCURSES_COLOR_T color,
- NCURSES_COLOR_T r,
- NCURSES_COLOR_T g,
- NCURSES_COLOR_T b)
+_nc_init_color(SCREEN *sp, int color, int r, int g, int b)
{
int result = ERR;
int maxcolors;
T((T_CALLED("init_color(%p,%d,%d,%d,%d)"),
- (void *) SP_PARM,
+ (void *) sp,
color,
r, g, b));
- if (SP_PARM == 0)
+ if (sp == 0 || sp->_direct_color.value)
returnCode(result);
maxcolors = MaxColors;
if (InitColor
- && SP_PARM->_coloron
+ && sp->_coloron
&& (color >= 0 && OkColorHi(color))
&& (okRGB(r) && okRGB(g) && okRGB(b))) {
- SP_PARM->_color_table[color].init = 1;
- SP_PARM->_color_table[color].r = r;
- SP_PARM->_color_table[color].g = g;
- SP_PARM->_color_table[color].b = b;
+ sp->_color_table[color].init = 1;
+ sp->_color_table[color].r = r;
+ sp->_color_table[color].g = g;
+ sp->_color_table[color].b = b;
if (UseHlsPalette) {
rgb2hls(r, g, b,
- &SP_PARM->_color_table[color].red,
- &SP_PARM->_color_table[color].green,
- &SP_PARM->_color_table[color].blue);
+ &sp->_color_table[color].red,
+ &sp->_color_table[color].green,
+ &sp->_color_table[color].blue);
} else {
- SP_PARM->_color_table[color].red = r;
- SP_PARM->_color_table[color].green = g;
- SP_PARM->_color_table[color].blue = b;
+ sp->_color_table[color].red = r;
+ sp->_color_table[color].green = g;
+ sp->_color_table[color].blue = b;
}
#ifdef USE_TERM_DRIVER
- CallDriver_4(SP_PARM, initcolor, color, r, g, b);
+ CallDriver_4(sp, td_initcolor, color, r, g, b);
#else
NCURSES_PUTP2("initialize_color",
TPARM_4(initialize_color, color, r, g, b));
#endif
- SP_PARM->_color_defs = max(color + 1, SP_PARM->_color_defs);
+ sp->_color_defs = max(color + 1, sp->_color_defs);
result = OK;
}
returnCode(result);
}
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(init_color) (NCURSES_SP_DCLx
+ NCURSES_COLOR_T color,
+ NCURSES_COLOR_T r,
+ NCURSES_COLOR_T g,
+ NCURSES_COLOR_T b)
+{
+ return _nc_init_color(SP_PARM, color, r, g, b);
+}
+
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
init_color(NCURSES_COLOR_T color,
@@ -676,7 +803,7 @@ NCURSES_SP_NAME(has_colors) (NCURSES_SP_DCL0)
int code = FALSE;
(void) SP_PARM;
- T((T_CALLED("has_colors()")));
+ T((T_CALLED("has_colors(%p)"), (void *) SP_PARM));
if (HasTerminal(SP_PARM)) {
#ifdef USE_TERM_DRIVER
code = HasColor;
@@ -700,34 +827,54 @@ has_colors(void)
}
#endif
-NCURSES_EXPORT(int)
-NCURSES_SP_NAME(color_content) (NCURSES_SP_DCLx
- NCURSES_COLOR_T color,
- NCURSES_COLOR_T *r,
- NCURSES_COLOR_T *g,
- NCURSES_COLOR_T *b)
+static int
+_nc_color_content(SCREEN *sp, int color, int *r, int *g, int *b)
{
int result = ERR;
int maxcolors;
T((T_CALLED("color_content(%p,%d,%p,%p,%p)"),
- (void *) SP_PARM,
+ (void *) sp,
color,
(void *) r,
(void *) g,
(void *) b));
- if (SP_PARM == 0)
+ if (sp == 0)
returnCode(result);
maxcolors = MaxColors;
- if (color < 0 || !OkColorHi(color) || !SP_PARM->_coloron) {
+ if (color < 0 || !OkColorHi(color) || !sp->_coloron) {
result = ERR;
} else {
- NCURSES_COLOR_T c_r = SP_PARM->_color_table[color].red;
- NCURSES_COLOR_T c_g = SP_PARM->_color_table[color].green;
- NCURSES_COLOR_T c_b = SP_PARM->_color_table[color].blue;
+ int c_r, c_g, c_b;
+
+ if (sp->_direct_color.value) {
+ rgb_bits_t *work = &(sp->_direct_color);
+
+#define max_direct_color(name) ((1 << work->bits.name) - 1)
+#define value_direct_color(max) (1000 * ((color >> bitoff) & max)) / max
+
+ int max_r = max_direct_color(red);
+ int max_g = max_direct_color(green);
+ int max_b = max_direct_color(blue);
+
+ int bitoff = 0;
+
+ c_b = value_direct_color(max_b);
+ bitoff += work->bits.blue;
+
+ c_g = value_direct_color(max_g);
+ bitoff += work->bits.green;
+
+ c_r = value_direct_color(max_r);
+
+ } else {
+ c_r = sp->_color_table[color].red;
+ c_g = sp->_color_table[color].green;
+ c_b = sp->_color_table[color].blue;
+ }
if (r)
*r = c_r;
@@ -743,6 +890,23 @@ NCURSES_SP_NAME(color_content) (NCURSES_SP_DCLx
returnCode(result);
}
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(color_content) (NCURSES_SP_DCLx
+ NCURSES_COLOR_T color,
+ NCURSES_COLOR_T *r,
+ NCURSES_COLOR_T *g,
+ NCURSES_COLOR_T *b)
+{
+ int my_r, my_g, my_b;
+ int rc = _nc_color_content(SP_PARM, color, &my_r, &my_g, &my_b);
+ if (rc == OK) {
+ *r = limit_COLOR(my_r);
+ *g = limit_COLOR(my_g);
+ *b = limit_COLOR(my_b);
+ }
+ return rc;
+}
+
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
color_content(NCURSES_COLOR_T color,
@@ -755,29 +919,29 @@ color_content(NCURSES_COLOR_T color,
#endif
NCURSES_EXPORT(int)
-NCURSES_SP_NAME(pair_content) (NCURSES_SP_DCLx
- NCURSES_PAIRS_T pair,
- NCURSES_COLOR_T *f,
- NCURSES_COLOR_T *b)
+_nc_pair_content(SCREEN *sp, int pair, int *f, int *b)
{
int result;
T((T_CALLED("pair_content(%p,%d,%p,%p)"),
- (void *) SP_PARM,
+ (void *) sp,
(int) pair,
(void *) f,
(void *) b));
- if (!ValidPair(pair)) {
+ if (!ValidPair(sp, pair)) {
result = ERR;
} else {
- NCURSES_COLOR_T fg = (NCURSES_COLOR_T) FORE_OF(SP_PARM->_color_pairs[pair]);
- NCURSES_COLOR_T bg = (NCURSES_COLOR_T) BACK_OF(SP_PARM->_color_pairs[pair]);
+ int fg;
+ int bg;
+ ReservePairs(sp, pair);
+ fg = FORE_OF(sp->_color_pairs[pair]);
+ bg = BACK_OF(sp->_color_pairs[pair]);
#if NCURSES_EXT_FUNCS
- if (fg == COLOR_DEFAULT)
+ if (isDefaultColor(fg))
fg = -1;
- if (bg == COLOR_DEFAULT)
+ if (isDefaultColor(bg))
bg = -1;
#endif
@@ -787,7 +951,7 @@ NCURSES_SP_NAME(pair_content) (NCURSES_SP_DCLx
*b = bg;
TR(TRACE_ATTRS, ("...pair_content(%p,%d,%d,%d)",
- (void *) SP_PARM,
+ (void *) sp,
(int) pair,
(int) fg, (int) bg));
result = OK;
@@ -795,6 +959,21 @@ NCURSES_SP_NAME(pair_content) (NCURSES_SP_DCLx
returnCode(result);
}
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(pair_content) (NCURSES_SP_DCLx
+ NCURSES_PAIRS_T pair,
+ NCURSES_COLOR_T *f,
+ NCURSES_COLOR_T *b)
+{
+ int my_f, my_b;
+ int rc = _nc_pair_content(SP_PARM, pair, &my_f, &my_b);
+ if (rc == OK) {
+ *f = limit_COLOR(my_f);
+ *b = limit_COLOR(my_b);
+ }
+ return rc;
+}
+
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
pair_content(NCURSES_COLOR_T pair, NCURSES_COLOR_T *f, NCURSES_COLOR_T *b)
@@ -811,14 +990,14 @@ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx
NCURSES_SP_OUTC outc)
{
#ifdef USE_TERM_DRIVER
- CallDriver_4(SP_PARM, docolor, old_pair, pair, reverse, outc);
+ CallDriver_4(SP_PARM, td_docolor, old_pair, pair, reverse, outc);
#else
- NCURSES_COLOR_T fg = COLOR_DEFAULT;
- NCURSES_COLOR_T bg = COLOR_DEFAULT;
- NCURSES_COLOR_T old_fg = -1;
- NCURSES_COLOR_T old_bg = -1;
+ int fg = COLOR_DEFAULT;
+ int bg = COLOR_DEFAULT;
+ int old_fg = -1;
+ int old_bg = -1;
- if (!ValidPair(pair)) {
+ if (!ValidPair(SP_PARM, pair)) {
return;
} else if (pair != 0) {
if (set_color_pair) {
@@ -828,14 +1007,14 @@ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx
1, outc);
return;
} else if (SP_PARM != 0) {
- if (pair_content((NCURSES_COLOR_T) pair, &fg, &bg) == ERR)
+ if (_nc_pair_content(SP_PARM, pair, &fg, &bg) == ERR)
return;
}
}
if (old_pair >= 0
&& SP_PARM != 0
- && pair_content((NCURSES_COLOR_T) old_pair, &old_fg, &old_bg) != ERR) {
+ && _nc_pair_content(SP_PARM, old_pair, &old_fg, &old_bg) != ERR) {
if ((isDefaultColor(fg) && !isDefaultColor(old_fg))
|| (isDefaultColor(bg) && !isDefaultColor(old_bg))) {
#if NCURSES_EXT_FUNCS
@@ -858,19 +1037,19 @@ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx
}
} else {
reset_color_pair(NCURSES_SP_ARG);
- if (old_pair < 0)
+ if (old_pair < 0 && pair <= 0)
return;
}
#if NCURSES_EXT_FUNCS
if (isDefaultColor(fg))
- fg = (NCURSES_COLOR_T) default_fg(NCURSES_SP_ARG);
+ fg = default_fg(NCURSES_SP_ARG);
if (isDefaultColor(bg))
- bg = (NCURSES_COLOR_T) default_bg(NCURSES_SP_ARG);
+ bg = default_bg(NCURSES_SP_ARG);
#endif
if (reverse) {
- NCURSES_COLOR_T xx = fg;
+ int xx = fg;
fg = bg;
bg = xx;
}
@@ -899,3 +1078,87 @@ _nc_do_color(int old_pair, int pair, int reverse, NCURSES_OUTC outc)
_nc_outc_wrapper);
}
#endif
+
+#if NCURSES_EXT_COLORS
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(init_extended_pair) (NCURSES_SP_DCLx int pair, int f, int b)
+{
+ return _nc_init_pair(SP_PARM, pair, f, b);
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(init_extended_color) (NCURSES_SP_DCLx
+ int color,
+ int r, int g, int b)
+{
+ return _nc_init_color(SP_PARM, color, r, g, b);
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(extended_color_content) (NCURSES_SP_DCLx
+ int color,
+ int *r, int *g, int *b)
+{
+ return _nc_color_content(SP_PARM, color, r, g, b);
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(extended_pair_content) (NCURSES_SP_DCLx
+ int pair,
+ int *f, int *b)
+{
+ return _nc_pair_content(SP_PARM, pair, f, b);
+}
+
+NCURSES_EXPORT(void)
+NCURSES_SP_NAME(reset_color_pairs) (NCURSES_SP_DCL0)
+{
+ if (SP_PARM != 0) {
+ if (SP_PARM->_color_pairs) {
+ _nc_free_ordered_pairs(SP_PARM);
+ free(SP_PARM->_color_pairs);
+ SP_PARM->_color_pairs = 0;
+ SP_PARM->_pair_alloc = 0;
+ ReservePairs(SP_PARM, 16);
+ clearok(CurScreen(SP_PARM), TRUE);
+ touchwin(StdScreen(SP_PARM));
+ }
+ }
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+init_extended_pair(int pair, int f, int b)
+{
+ return NCURSES_SP_NAME(init_extended_pair) (CURRENT_SCREEN, pair, f, b);
+}
+
+NCURSES_EXPORT(int)
+init_extended_color(int color, int r, int g, int b)
+{
+ return NCURSES_SP_NAME(init_extended_color) (CURRENT_SCREEN,
+ color,
+ r, g, b);
+}
+
+NCURSES_EXPORT(int)
+extended_color_content(int color, int *r, int *g, int *b)
+{
+ return NCURSES_SP_NAME(extended_color_content) (CURRENT_SCREEN,
+ color,
+ r, g, b);
+}
+
+NCURSES_EXPORT(int)
+extended_pair_content(int pair, int *f, int *b)
+{
+ return NCURSES_SP_NAME(extended_pair_content) (CURRENT_SCREEN, pair, f, b);
+}
+
+NCURSES_EXPORT(void)
+reset_color_pairs(void)
+{
+ NCURSES_SP_NAME(reset_color_pairs) (CURRENT_SCREEN);
+}
+#endif /* NCURSES_SP_FUNCS */
+#endif /* NCURSES_EXT_COLORS */
diff --git a/ncurses/base/lib_colorset.c b/ncurses/base/lib_colorset.c
index e9354860ad0d..f3aef7e39110 100644
--- a/ncurses/base/lib_colorset.c
+++ b/ncurses/base/lib_colorset.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,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 *
@@ -41,22 +41,23 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_colorset.c,v 1.14 2014/02/01 22:10:42 tom Exp $")
+MODULE_ID("$Id: lib_colorset.c,v 1.15 2017/03/16 23:45:30 tom Exp $")
NCURSES_EXPORT(int)
-wcolor_set(WINDOW *win, NCURSES_PAIRS_T color_pair_number, void *opts)
+wcolor_set(WINDOW *win, NCURSES_PAIRS_T pair_arg, void *opts)
{
int code = ERR;
+ int color_pair = pair_arg;
- T((T_CALLED("wcolor_set(%p,%d)"), (void *) win, (int) color_pair_number));
+ T((T_CALLED("wcolor_set(%p,%d)"), (void *) win, color_pair));
+ set_extended_pair(opts, color_pair);
if (win
- && !opts
&& (SP != 0)
- && (color_pair_number >= 0)
- && (color_pair_number < SP->_pair_limit)) {
+ && (color_pair >= 0)
+ && (color_pair < SP->_pair_limit)) {
TR(TRACE_ATTRS, ("... current %ld", (long) GET_WINDOW_PAIR(win)));
- SET_WINDOW_PAIR(win, color_pair_number);
- if_EXT_COLORS(win->_color = color_pair_number);
+ SET_WINDOW_PAIR(win, color_pair);
+ if_EXT_COLORS(win->_color = color_pair);
code = OK;
}
returnCode(code);
diff --git a/ncurses/base/lib_dft_fgbg.c b/ncurses/base/lib_dft_fgbg.c
index 00cbafb39730..d5fd1a03a8d6 100644
--- a/ncurses/base/lib_dft_fgbg.c
+++ b/ncurses/base/lib_dft_fgbg.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2014,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 *
@@ -37,7 +37,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_dft_fgbg.c,v 1.26 2011/04/23 18:28:18 tom Exp $")
+MODULE_ID("$Id: lib_dft_fgbg.c,v 1.29 2017/03/25 21:00:49 tom Exp $")
/*
* Modify the behavior of color-pair 0 so that the library doesn't assume that
@@ -68,26 +68,27 @@ NCURSES_SP_NAME(assume_default_colors) (NCURSES_SP_DCLx int fg, int bg)
int code = ERR;
T((T_CALLED("assume_default_colors(%p,%d,%d)"), (void *) SP_PARM, fg, bg));
+ if (SP_PARM != 0) {
#ifdef USE_TERM_DRIVER
- if (sp != 0)
- code = CallDriver_2(sp, defaultcolors, fg, bg);
+ code = CallDriver_2(SP_PARM, td_defaultcolors, fg, bg);
#else
- if ((orig_pair || orig_colors) && !initialize_pair) {
+ if ((orig_pair || orig_colors) && !initialize_pair) {
- SP_PARM->_default_color = isDefaultColor(fg) || isDefaultColor(bg);
- SP_PARM->_has_sgr_39_49 = (tigetflag("AX") == TRUE);
- SP_PARM->_default_fg = isDefaultColor(fg) ? COLOR_DEFAULT : (fg & C_MASK);
- SP_PARM->_default_bg = isDefaultColor(bg) ? COLOR_DEFAULT : (bg & C_MASK);
- if (SP_PARM->_color_pairs != 0) {
- bool save = SP_PARM->_default_color;
- SP_PARM->_assumed_color = TRUE;
- SP_PARM->_default_color = TRUE;
- init_pair(0, (short) fg, (short) bg);
- SP_PARM->_default_color = save;
+ SP_PARM->_default_color = isDefaultColor(fg) || isDefaultColor(bg);
+ SP_PARM->_has_sgr_39_49 = (tigetflag("AX") == TRUE);
+ SP_PARM->_default_fg = isDefaultColor(fg) ? COLOR_DEFAULT : fg;
+ SP_PARM->_default_bg = isDefaultColor(bg) ? COLOR_DEFAULT : bg;
+ if (SP_PARM->_color_pairs != 0) {
+ bool save = SP_PARM->_default_color;
+ SP_PARM->_assumed_color = TRUE;
+ SP_PARM->_default_color = TRUE;
+ init_pair(0, (short) fg, (short) bg);
+ SP_PARM->_default_color = save;
+ }
+ code = OK;
}
- code = OK;
- }
#endif
+ }
returnCode(code);
}
diff --git a/ncurses/base/lib_driver.c b/ncurses/base/lib_driver.c
index 6301a5887d64..6211b70bec19 100644
--- a/ncurses/base/lib_driver.c
+++ b/ncurses/base/lib_driver.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 2008-2014,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -33,7 +33,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_driver.c,v 1.4 2012/09/22 19:32:46 tom Exp $")
+MODULE_ID("$Id: lib_driver.c,v 1.7 2018/06/24 00:06:37 tom Exp $")
typedef struct DriverEntry {
const char *name;
@@ -42,8 +42,8 @@ typedef struct DriverEntry {
static DRIVER_ENTRY DriverTable[] =
{
-#ifdef __MINGW32__
- {"win32con", &_nc_WIN_DRIVER},
+#ifdef _WIN32
+ {"win32console", &_nc_WIN_DRIVER},
#endif
{"tinfo", &_nc_TINFO_DRIVER} /* must be last */
};
@@ -63,24 +63,12 @@ _nc_get_driver(TERMINAL_CONTROL_BLOCK * TCB, const char *name, int *errret)
for (i = 0; i < SIZEOF(DriverTable); i++) {
res = DriverTable[i].driver;
- /*
- * 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".
- */
- if (name != 0 && *name == '#') {
- size_t n = strlen(name + 1);
- if (n != 0
- && strncmp(name + 1, DriverTable[i].name, n)) {
- continue;
+ if (strcmp(DriverTable[i].name, res->td_name(TCB)) == 0) {
+ if (res->td_CanHandle(TCB, name, errret)) {
+ use = res;
+ break;
}
}
- if (res->CanHandle(TCB, name, errret)) {
- use = res;
- break;
- }
}
if (use != 0) {
TCB->drv = use;
@@ -93,7 +81,7 @@ NCURSES_EXPORT(int)
NCURSES_SP_NAME(has_key) (SCREEN *sp, int keycode)
{
T((T_CALLED("has_key(%p, %d)"), (void *) sp, keycode));
- returnCode(IsValidTIScreen(sp) ? CallDriver_1(sp, kyExist, keycode) : FALSE);
+ returnCode(IsValidTIScreen(sp) ? CallDriver_1(sp, td_kyExist, keycode) : FALSE);
}
NCURSES_EXPORT(int)
@@ -108,7 +96,7 @@ NCURSES_SP_NAME(_nc_mcprint) (SCREEN *sp, char *data, int len)
int code = ERR;
if (0 != TerminalOf(sp))
- code = CallDriver_2(sp, print, data, len);
+ code = CallDriver_2(sp, td_print, data, len);
return (code);
}
@@ -126,7 +114,7 @@ NCURSES_SP_NAME(doupdate) (SCREEN *sp)
T((T_CALLED("doupdate(%p)"), (void *) sp));
if (IsValidScreen(sp))
- code = CallDriver(sp, update);
+ code = CallDriver(sp, td_update);
returnCode(code);
}
@@ -144,7 +132,7 @@ NCURSES_SP_NAME(mvcur) (SCREEN *sp, int yold, int xold, int ynew, int xnew)
TR(TRACE_CALLS | TRACE_MOVE, (T_CALLED("mvcur(%p,%d,%d,%d,%d)"),
(void *) sp, yold, xold, ynew, xnew));
if (HasTerminal(sp)) {
- code = CallDriver_4(sp, hwcur, yold, xold, ynew, xnew);
+ code = CallDriver_4(sp, td_hwcur, yold, xold, ynew, xnew);
}
returnCode(code);
}
diff --git a/ncurses/base/lib_endwin.c b/ncurses/base/lib_endwin.c
index 4596d0749633..c3ba37a65232 100644
--- a/ncurses/base/lib_endwin.c
+++ b/ncurses/base/lib_endwin.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2014,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 *
@@ -42,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_endwin.c,v 1.22 2009/10/24 22:02:14 tom Exp $")
+MODULE_ID("$Id: lib_endwin.c,v 1.24 2017/07/22 23:29:40 tom Exp $")
NCURSES_EXPORT(int)
NCURSES_SP_NAME(endwin) (NCURSES_SP_DCL0)
@@ -55,11 +55,11 @@ NCURSES_SP_NAME(endwin) (NCURSES_SP_DCL0)
#ifdef USE_TERM_DRIVER
TERMINAL_CONTROL_BLOCK *TCB = TCBOf(SP_PARM);
- SP_PARM->_endwin = TRUE;
- if (TCB && TCB->drv && TCB->drv->scexit)
- TCB->drv->scexit(SP_PARM);
+ SP_PARM->_endwin = ewSuspend;
+ if (TCB && TCB->drv && TCB->drv->td_scexit)
+ TCB->drv->td_scexit(SP_PARM);
#else
- SP_PARM->_endwin = TRUE;
+ SP_PARM->_endwin = ewSuspend;
SP_PARM->_mouse_wrap(SP_PARM);
_nc_screen_wrap();
_nc_mvcur_wrap(); /* wrap up cursor addressing */
diff --git a/ncurses/base/lib_erase.c b/ncurses/base/lib_erase.c
index bbf10ef81b92..6bac1ba10178 100644
--- a/ncurses/base/lib_erase.c
+++ b/ncurses/base/lib_erase.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2016 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 *
@@ -41,21 +41,25 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_erase.c,v 1.17 2009/10/24 22:32:29 tom Exp $")
+MODULE_ID("$Id: lib_erase.c,v 1.18 2016/05/28 23:11:26 tom Exp $")
NCURSES_EXPORT(int)
werase(WINDOW *win)
{
int code = ERR;
- int y;
NCURSES_CH_T blank;
- NCURSES_CH_T *sp, *end, *start;
+ NCURSES_CH_T *start;
T((T_CALLED("werase(%p)"), (void *) win));
if (win) {
+ NCURSES_CH_T *sp;
+ int y;
+
blank = win->_nc_bkgd;
for (y = 0; y <= win->_maxy; y++) {
+ NCURSES_CH_T *end;
+
start = win->_line[y].text;
end = &start[win->_maxx];
diff --git a/ncurses/base/lib_flash.c b/ncurses/base/lib_flash.c
index 3520177ea33f..7f25038cea51 100644
--- a/ncurses/base/lib_flash.c
+++ b/ncurses/base/lib_flash.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2014 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 *
@@ -46,7 +46,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_flash.c,v 1.13 2013/01/12 17:26:07 tom Exp $")
+MODULE_ID("$Id: lib_flash.c,v 1.14 2014/03/08 20:32:59 tom Exp $")
/*
* flash()
@@ -64,7 +64,7 @@ NCURSES_SP_NAME(flash) (NCURSES_SP_DCL0)
T((T_CALLED("flash(%p)"), (void *) SP_PARM));
#ifdef USE_TERM_DRIVER
if (SP_PARM != 0)
- res = CallDriver_1(SP_PARM, doBeepOrFlash, FALSE);
+ res = CallDriver_1(SP_PARM, td_doBeepOrFlash, FALSE);
#else
if (HasTerminal(SP_PARM)) {
/* FIXME: should make sure that we are not in altchar mode */
diff --git a/ncurses/base/lib_freeall.c b/ncurses/base/lib_freeall.c
index 031374924f00..4e29ec0f632f 100644
--- a/ncurses/base/lib_freeall.c
+++ b/ncurses/base/lib_freeall.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 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 *
@@ -39,7 +39,7 @@
extern int malloc_errfd; /* FIXME */
#endif
-MODULE_ID("$Id: lib_freeall.c,v 1.62 2012/11/17 23:53:03 tom Exp $")
+MODULE_ID("$Id: lib_freeall.c,v 1.71 2019/12/15 00:30:49 tom Exp $")
/*
* Free all ncurses data. This is used for testing only (there's no practical
@@ -48,11 +48,11 @@ MODULE_ID("$Id: lib_freeall.c,v 1.62 2012/11/17 23:53:03 tom Exp $")
NCURSES_EXPORT(void)
NCURSES_SP_NAME(_nc_freeall) (NCURSES_SP_DCL0)
{
- WINDOWLIST *p, *q;
static va_list empty_va;
T((T_CALLED("_nc_freeall()")));
#if NO_LEAKS
+ _nc_globals.leak_checking = TRUE;
if (SP_PARM != 0) {
if (SP_PARM->_oldnum_list != 0) {
FreeAndNull(SP_PARM->_oldnum_list);
@@ -60,12 +60,16 @@ NCURSES_SP_NAME(_nc_freeall) (NCURSES_SP_DCL0)
if (SP_PARM->_panelHook.destroy != 0) {
SP_PARM->_panelHook.destroy(SP_PARM->_panelHook.stdscr_pseudo_panel);
}
+#if NCURSES_EXT_COLORS
+ _nc_new_pair_leaks(SP_PARM);
+#endif
}
#endif
if (SP_PARM != 0) {
_nc_lock_global(curses);
while (WindowList(SP_PARM) != 0) {
+ WINDOWLIST *p, *q;
bool deleted = FALSE;
/* Delete only windows that're not a parent */
@@ -73,8 +77,19 @@ NCURSES_SP_NAME(_nc_freeall) (NCURSES_SP_DCL0)
WINDOW *p_win = &(p->win);
bool found = FALSE;
+#ifndef USE_SP_WINDOWLIST
+ if (p->screen != SP_PARM)
+ continue;
+#endif
+
for (each_window(SP_PARM, q)) {
WINDOW *q_win = &(q->win);
+
+#ifndef USE_SP_WINDOWLIST
+ if (q->screen != SP_PARM)
+ continue;
+#endif
+
if ((p != q)
&& (q_win->_flags & _SUBWIN)
&& (p_win == q_win->_parent)) {
@@ -131,22 +146,20 @@ _nc_freeall(void)
NCURSES_EXPORT(void)
NCURSES_SP_NAME(_nc_free_and_exit) (NCURSES_SP_DCLx int code)
{
- char *last_buffer = (SP_PARM != 0) ? SP_PARM->out_buffer : 0;
-
+ T((T_CALLED("_nc_free_and_exit(%d)"), code));
NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
NCURSES_SP_NAME(_nc_freeall) (NCURSES_SP_ARG);
#ifdef TRACE
- trace(0); /* close trace file, freeing its setbuf */
+ curses_trace(0); /* close trace file, freeing its setbuf */
{
static va_list fake;
free(_nc_varargs("?", fake));
}
#endif
- FreeIfNeeded(last_buffer);
exit(code);
}
-#else
+#else /* !HAVE_NC_FREEALL */
NCURSES_EXPORT(void)
_nc_freeall(void)
{
@@ -162,7 +175,7 @@ NCURSES_SP_NAME(_nc_free_and_exit) (NCURSES_SP_DCLx int code)
}
exit(code);
}
-#endif
+#endif /* HAVE_NC_FREEALL */
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(void)
@@ -171,3 +184,16 @@ _nc_free_and_exit(int code)
NCURSES_SP_NAME(_nc_free_and_exit) (CURRENT_SCREEN, code);
}
#endif
+
+NCURSES_EXPORT(void)
+exit_curses(int code)
+{
+#if NO_LEAKS
+#if NCURSES_SP_FUNCS
+ NCURSES_SP_NAME(_nc_free_and_exit) (CURRENT_SCREEN, code);
+#else
+ _nc_free_and_exit(code); /* deprecated... */
+#endif
+#endif
+ exit(code);
+}
diff --git a/ncurses/base/lib_getch.c b/ncurses/base/lib_getch.c
index 0a04ef5a6e1b..66c9f87e57d6 100644
--- a/ncurses/base/lib_getch.c
+++ b/ncurses/base/lib_getch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 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 *
@@ -42,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_getch.c,v 1.126 2013/02/16 18:30:37 tom Exp $")
+MODULE_ID("$Id: lib_getch.c,v 1.138 2019/11/03 00:11:16 tom Exp $")
#include <fifo_defs.h>
@@ -69,16 +69,20 @@ NCURSES_EXPORT(int)
NCURSES_SP_NAME(set_escdelay) (NCURSES_SP_DCLx int value)
{
int code = OK;
-#if USE_REENTRANT
- if (SP_PARM) {
- SET_ESCDELAY(value);
- } else {
+ if (value < 0) {
code = ERR;
- }
+ } else {
+#if USE_REENTRANT
+ if (SP_PARM) {
+ SET_ESCDELAY(value);
+ } else {
+ code = ERR;
+ }
#else
- (void) SP_PARM;
- ESCDELAY = value;
+ (void) SP_PARM;
+ ESCDELAY = value;
#endif
+ }
return code;
}
@@ -87,12 +91,16 @@ NCURSES_EXPORT(int)
set_escdelay(int value)
{
int code;
+ if (value < 0) {
+ code = ERR;
+ } else {
#if USE_REENTRANT
- code = NCURSES_SP_NAME(set_escdelay) (CURRENT_SCREEN, value);
+ code = NCURSES_SP_NAME(set_escdelay) (CURRENT_SCREEN, value);
#else
- ESCDELAY = value;
- code = OK;
+ ESCDELAY = value;
+ code = OK;
#endif
+ }
return code;
}
#endif
@@ -124,6 +132,17 @@ _nc_use_meta(WINDOW *win)
return (sp ? sp->_use_meta : 0);
}
+#ifdef USE_TERM_DRIVER
+# ifdef _WIN32
+static HANDLE
+_nc_get_handle(int fd)
+{
+ intptr_t value = _get_osfhandle(fd);
+ return (HANDLE) value;
+}
+# endif
+#endif
+
/*
* Check for mouse activity, returning nonzero if we find any.
*/
@@ -133,7 +152,16 @@ check_mouse_activity(SCREEN *sp, int delay EVENTLIST_2nd(_nc_eventlist * evl))
int rc;
#ifdef USE_TERM_DRIVER
- rc = TCBOf(sp)->drv->testmouse(TCBOf(sp), delay EVENTLIST_2nd(evl));
+ TERMINAL_CONTROL_BLOCK *TCB = TCBOf(sp);
+ rc = TCBOf(sp)->drv->td_testmouse(TCBOf(sp), delay EVENTLIST_2nd(evl));
+# ifdef _WIN32
+ /* if we emulate terminfo on console, we have to use the console routine */
+ if (IsTermInfoOnConsole(sp)) {
+ HANDLE fd = _nc_get_handle(sp->_ifd);
+ rc = _nc_mingw_testmouse(sp, fd, delay EVENTLIST_2nd(evl));
+ } else
+# endif
+ rc = TCB->drv->td_testmouse(TCB, delay EVENTLIST_2nd(evl));
#else
#if USE_SYSMOUSE
if ((sp->_mouse_type == M_SYSMOUSE)
@@ -204,11 +232,6 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
if (tail < 0)
return ERR;
-#ifdef HIDE_EINTR
- again:
- errno = 0;
-#endif
-
#ifdef NCURSES_WGETCH_EVENTS
if (evl
#if USE_GPM_SUPPORT || USE_EMX_MOUSE || USE_SYSMOUSE
@@ -259,7 +282,7 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
} else
#endif
#if USE_KLIBC_KBD
- if (isatty(sp->_ifd) && sp->_cbreak) {
+ if (NC_ISATTY(sp->_ifd) && sp->_cbreak) {
ch = _read_kbd(0, 1, !sp->_raw);
n = (ch == -1) ? -1 : 1;
sp->_extended_key = (ch == 0);
@@ -268,7 +291,14 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
{ /* Can block... */
#ifdef USE_TERM_DRIVER
int buf;
- n = CallDriver_1(sp, read, &buf);
+#ifdef _WIN32
+ if (NC_ISATTY(sp->_ifd) && IsTermInfoOnConsole(sp) && sp->_cbreak)
+ n = _nc_mingw_console_read(sp,
+ _nc_get_handle(sp->_ifd),
+ &buf);
+ else
+#endif
+ n = CallDriver_1(sp, td_read, &buf);
ch = buf;
#else
unsigned char c2 = 0;
@@ -286,24 +316,6 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
#endif
}
-#ifdef HIDE_EINTR
- /*
- * Under System V curses with non-restarting signals, getch() returns
- * with value ERR when a handled signal keeps it from completing.
- * If signals restart system calls, OTOH, the signal is invisible
- * except to its handler.
- *
- * We don't want this difference to show. This piece of code
- * tries to make it look like we always have restarting signals.
- */
- if (n <= 0 && errno == EINTR
-# if USE_PTHREADS_EINTR
- && (_nc_globals.have_sigwinch == 0)
-# endif
- )
- goto again;
-#endif
-
if ((n == -1) || (n == 0)) {
TR(TRACE_IEVENT, ("read(%d,&ch,1)=%d, errno=%d", sp->_ifd, n, errno));
ch = ERR;
@@ -333,7 +345,7 @@ fifo_clear(SCREEN *sp)
tail = peek = 0;
}
-static int kgetch(SCREEN *EVENTLIST_2nd(_nc_eventlist * evl));
+static int kgetch(SCREEN *, bool EVENTLIST_2nd(_nc_eventlist *));
static void
recur_wrefresh(WINDOW *win)
@@ -399,7 +411,7 @@ _nc_wgetch(WINDOW *win,
int ch;
int rc = 0;
#ifdef NCURSES_WGETCH_EVENTS
- long event_delay = -1;
+ int event_delay = -1;
#endif
T((T_CALLED("_nc_wgetch(%p)"), (void *) win));
@@ -510,7 +522,7 @@ _nc_wgetch(WINDOW *win,
int runcount = 0;
do {
- ch = kgetch(sp EVENTLIST_2nd(evl));
+ ch = kgetch(sp, win->_notimeout EVENTLIST_2nd(evl));
if (ch == KEY_MOUSE) {
++runcount;
if (sp->_mouse_inline(sp))
@@ -622,7 +634,7 @@ wgetch_events(WINDOW *win, _nc_eventlist * evl)
int code;
int value;
- T((T_CALLED("wgetch_events(%p,%p)"), win, evl));
+ T((T_CALLED("wgetch_events(%p,%p)"), (void *) win, (void *) evl));
code = _nc_wgetch(win,
&value,
_nc_use_meta(win)
@@ -665,11 +677,11 @@ wgetch(WINDOW *win)
*/
static int
-kgetch(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
+kgetch(SCREEN *sp, bool forever EVENTLIST_2nd(_nc_eventlist * evl))
{
TRIES *ptr;
int ch = 0;
- int timeleft = GetEscdelay(sp);
+ int timeleft = forever ? 9999999 : GetEscdelay(sp);
TR(TRACE_IEVENT, ("kgetch() called"));
diff --git a/ncurses/base/lib_getstr.c b/ncurses/base/lib_getstr.c
index 0e446349ca17..fc18e40fcaa4 100644
--- a/ncurses/base/lib_getstr.c
+++ b/ncurses/base/lib_getstr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -40,7 +40,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_getstr.c,v 1.30 2011/10/22 16:31:35 tom Exp $")
+MODULE_ID("$Id: lib_getstr.c,v 1.33 2018/09/01 20:18:09 tom Exp $")
/*
* This wipes out the last character, no matter whether it was a tab, control
@@ -85,9 +85,11 @@ wgetnstr_events(WINDOW *win,
T((T_CALLED("wgetnstr(%p,%p,%d)"), (void *) win, (void *) str, maxlen));
- if (!win)
+ if (!win || !str)
returnCode(ERR);
+ maxlen = _nc_getstr_limit(maxlen);
+
NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_ARGx &buf);
oldnl = sp->_nl;
@@ -142,7 +144,7 @@ wgetnstr_events(WINDOW *win,
str = WipeOut(win, y, x, oldstr, str, oldecho);
}
} else if (ch >= KEY_MIN
- || (maxlen >= 0 && str - oldstr >= maxlen)) {
+ || (str - oldstr >= maxlen)) {
NCURSES_SP_NAME(beep) (NCURSES_SP_ARG);
} else {
*str++ = (char) ch;
diff --git a/ncurses/base/lib_hline.c b/ncurses/base/lib_hline.c
index 1f0380830ddc..0fac51de74fb 100644
--- a/ncurses/base/lib_hline.c
+++ b/ncurses/base/lib_hline.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-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 *
@@ -29,6 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Sven Verdoolaege 2001 *
****************************************************************************/
/*
@@ -40,23 +42,21 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_hline.c,v 1.13 2010/12/19 01:48:39 tom Exp $")
+MODULE_ID("$Id: lib_hline.c,v 1.15 2017/10/28 19:57:42 tom Exp $")
NCURSES_EXPORT(int)
whline(WINDOW *win, chtype ch, int n)
{
int code = ERR;
- int start;
- int end;
T((T_CALLED("whline(%p,%s,%d)"), (void *) win, _tracechtype(ch), n));
if (win) {
struct ldat *line = &(win->_line[win->_cury]);
NCURSES_CH_T wch;
+ int start = win->_curx;
+ int end = start + n - 1;
- start = win->_curx;
- end = start + n - 1;
if (end > win->_maxx)
end = win->_maxx;
@@ -68,6 +68,14 @@ whline(WINDOW *win, chtype ch, int n)
SetChar2(wch, ch);
wch = _nc_render(win, wch);
+#if USE_WIDEC_SUPPORT
+ if (start > 0 && isWidecExt(line->text[start])) {
+ SetChar2(line->text[start - 1], ' ');
+ }
+ if (end < win->_maxx && isWidecExt(line->text[end + 1])) {
+ SetChar2(line->text[end + 1], ' ');
+ }
+#endif
while (end >= start) {
line->text[end] = wch;
end--;
diff --git a/ncurses/base/lib_inchstr.c b/ncurses/base/lib_inchstr.c
index aebb6d625d5c..bf30e3ce2663 100644
--- a/ncurses/base/lib_inchstr.c
+++ b/ncurses/base/lib_inchstr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,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 *
@@ -41,7 +41,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_inchstr.c,v 1.12 2010/12/20 01:37:41 tom Exp $")
+MODULE_ID("$Id: lib_inchstr.c,v 1.16 2017/04/30 00:10:25 tom Exp $")
NCURSES_EXPORT(int)
winchnstr(WINDOW *win, chtype *str, int n)
@@ -50,16 +50,19 @@ winchnstr(WINDOW *win, chtype *str, int n)
T((T_CALLED("winchnstr(%p,%p,%d)"), (void *) win, (void *) str, n));
- if (!str)
- returnCode(0);
+ if (!win || !str) {
+ i = ERR;
+ } else {
+ int row = win->_cury;
+ int col = win->_curx;
+ NCURSES_CH_T *text = win->_line[row].text;
- if (win) {
- for (; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++)
- str[i] =
- (chtype) CharOf(win->_line[win->_cury].text[win->_curx + i]) |
- AttrOf(win->_line[win->_cury].text[win->_curx + i]);
+ for (; (n < 0 || (i < n)) && (col + i <= win->_maxx); i++) {
+ str[i] = (((chtype) CharOf(text[col + i]) & A_CHARTEXT) |
+ AttrOf(text[col + i]));
+ }
+ str[i] = (chtype) 0;
}
- str[i] = (chtype) 0;
returnCode(i);
}
diff --git a/ncurses/base/lib_initscr.c b/ncurses/base/lib_initscr.c
index 334682fab71d..60f5e4d0d393 100644
--- a/ncurses/base/lib_initscr.c
+++ b/ncurses/base/lib_initscr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2017,2019 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,7 +29,7 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
- * and: Thomas E. Dickey 1996-2003 *
+ * and: Thomas E. Dickey 1996-on *
****************************************************************************/
/*
@@ -45,15 +45,13 @@
#include <sys/termio.h> /* needed for ISC */
#endif
-MODULE_ID("$Id: lib_initscr.c,v 1.39 2009/02/14 20:55:49 tom Exp $")
+MODULE_ID("$Id: lib_initscr.c,v 1.44 2019/06/22 00:02:01 tom Exp $")
NCURSES_EXPORT(WINDOW *)
initscr(void)
{
WINDOW *result;
- NCURSES_CONST char *name;
-
START_TRACE();
T((T_CALLED("initscr()")));
@@ -62,11 +60,19 @@ initscr(void)
/* Portable applications must not call initscr() more than once */
if (!_nc_globals.init_screen) {
+ const char *env;
+ char *name;
+
_nc_globals.init_screen = TRUE;
- if ((name = getenv("TERM")) == 0
- || *name == '\0')
- name = "unknown";
+ if ((env = getenv("TERM")) == 0
+ || *env == '\0') {
+ env = "unknown";
+ }
+ if ((name = strdup(env)) == NULL) {
+ fprintf(stderr, "Error opening allocating $TERM.\n");
+ ExitProgram(EXIT_FAILURE);
+ }
#ifdef __CYGWIN__
/*
* 2002/9/21
@@ -75,9 +81,9 @@ initscr(void)
* core when attempting to write to stdout. Opening /dev/tty
* explicitly seems to fix the problem.
*/
- if (isatty(fileno(stdout))) {
+ if (NC_ISATTY(fileno(stdout))) {
FILE *fp = fopen("/dev/tty", "w");
- if (fp != 0 && isatty(fileno(fp))) {
+ if (fp != 0 && NC_ISATTY(fileno(fp))) {
fclose(stdout);
dup2(fileno(fp), STDOUT_FILENO);
stdout = fdopen(STDOUT_FILENO, "w");
@@ -86,7 +92,7 @@ initscr(void)
#endif
if (newterm(name, stdout, stdin) == 0) {
fprintf(stderr, "Error opening terminal: %s.\n", name);
- exit(EXIT_FAILURE);
+ ExitProgram(EXIT_FAILURE);
}
/* def_shell_mode - done in newterm/_nc_setupscreen */
@@ -95,6 +101,7 @@ initscr(void)
#else
def_prog_mode();
#endif
+ free(name);
}
result = stdscr;
_nc_unlock_global(curses);
diff --git a/ncurses/base/lib_insch.c b/ncurses/base/lib_insch.c
index 32eaed739443..1ec70e3af83d 100644
--- a/ncurses/base/lib_insch.c
+++ b/ncurses/base/lib_insch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2016 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 *
@@ -43,7 +43,7 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_insch.c,v 1.35 2013/05/18 21:58:56 tom Exp $")
+MODULE_ID("$Id: lib_insch.c,v 1.36 2016/05/28 23:11:26 tom Exp $")
/*
* Insert the given character, updating the current location to simplify
@@ -56,7 +56,6 @@ _nc_insert_ch(SCREEN *sp, WINDOW *win, chtype ch)
int ch8 = (int) ChCharOf(ch);
NCURSES_CH_T wch;
int count;
- NCURSES_CONST char *s;
int tabsize = (
#if USE_REENTRANT
sp->_TABSIZE
@@ -102,6 +101,7 @@ _nc_insert_ch(SCREEN *sp, WINDOW *win, chtype ch)
win->_curx++;
}
} else if (iscntrl(ch8)) {
+ NCURSES_CONST char *s;
s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx (chtype) ch8);
while (*s != '\0') {
code = _nc_insert_ch(sp, win, ChAttrOf(ch) | UChar(*s));
@@ -121,6 +121,7 @@ _nc_insert_ch(SCREEN *sp, WINDOW *win, chtype ch)
if (count > 0) {
code = _nc_insert_wch(win, &wch);
} else if (count == -1) {
+ NCURSES_CONST char *s;
/* handle EILSEQ */
s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx (chtype) ch8);
if (strlen(s) > 1) {
@@ -145,15 +146,13 @@ _nc_insert_ch(SCREEN *sp, WINDOW *win, chtype ch)
NCURSES_EXPORT(int)
winsch(WINDOW *win, chtype c)
{
- NCURSES_SIZE_T oy;
- NCURSES_SIZE_T ox;
int code = ERR;
T((T_CALLED("winsch(%p, %s)"), (void *) win, _tracechtype(c)));
if (win != 0) {
- oy = win->_cury;
- ox = win->_curx;
+ NCURSES_SIZE_T oy = win->_cury;
+ NCURSES_SIZE_T ox = win->_curx;
code = _nc_insert_ch(_nc_screen_of(win), win, c);
diff --git a/ncurses/base/lib_insnstr.c b/ncurses/base/lib_insnstr.c
index ce03e64be002..8ee26a8091c1 100644
--- a/ncurses/base/lib_insnstr.c
+++ b/ncurses/base/lib_insnstr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2004,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 2004-2016,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -40,31 +40,55 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_insnstr.c,v 1.3 2009/10/24 22:04:35 tom Exp $")
+MODULE_ID("$Id: lib_insnstr.c,v 1.6 2018/03/10 20:13:59 Gyorgy.Jeney Exp $")
NCURSES_EXPORT(int)
winsnstr(WINDOW *win, const char *s, int n)
{
int code = ERR;
- NCURSES_SIZE_T oy;
- NCURSES_SIZE_T ox;
const unsigned char *str = (const unsigned char *) s;
- const unsigned char *cp;
T((T_CALLED("winsnstr(%p,%s,%d)"), (void *) win, _nc_visbufn(s, n), n));
if (win != 0 && str != 0) {
SCREEN *sp = _nc_screen_of(win);
+#if USE_WIDEC_SUPPORT
+ /*
+ * If the output contains "wide" (multibyte) characters, we will not
+ * really know the width of a character until we get the last byte
+ * of the character. Since the preceding byte(s) may use more columns
+ * on the screen than the final character, it is best to route the
+ * call to the wins_nwstr() function.
+ */
+ if (sp->_screen_unicode) {
+ size_t nn = (n > 0) ? (size_t) n : strlen(s);
+ wchar_t *buffer = typeMalloc(wchar_t, nn + 1);
+ if (buffer != 0) {
+ mbstate_t state;
+ size_t n3;
+ init_mb(state);
+ n3 = mbstowcs(buffer, s, nn);
+ if (n3 != (size_t) (-1)) {
+ code = wins_nwstr(win, buffer, (int) n3);
+ }
+ free(buffer);
+ }
+ }
+ if (code == ERR)
+#endif
+ {
+ NCURSES_SIZE_T oy = win->_cury;
+ NCURSES_SIZE_T ox = win->_curx;
+ const unsigned char *cp;
- oy = win->_cury;
- ox = win->_curx;
- for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) {
- _nc_insert_ch(sp, win, (chtype) UChar(*cp));
+ for (cp = str; (n <= 0 || (cp - str) < n) && *cp; cp++) {
+ _nc_insert_ch(sp, win, (chtype) UChar(*cp));
+ }
+ win->_curx = ox;
+ win->_cury = oy;
+ _nc_synchook(win);
+ code = OK;
}
- win->_curx = ox;
- win->_cury = oy;
- _nc_synchook(win);
- code = OK;
}
returnCode(code);
}
diff --git a/ncurses/base/lib_instr.c b/ncurses/base/lib_instr.c
index f708ecc51e4a..dbd2a020ac61 100644
--- a/ncurses/base/lib_instr.c
+++ b/ncurses/base/lib_instr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-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 *
@@ -41,41 +41,44 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_instr.c,v 1.21 2014/02/01 22:09:27 tom Exp $")
+MODULE_ID("$Id: lib_instr.c,v 1.23 2017/04/29 21:16:20 tom Exp $")
NCURSES_EXPORT(int)
winnstr(WINDOW *win, char *str, int n)
{
- int i = 0, row, col;
+ int i = 0;
T((T_CALLED("winnstr(%p,%p,%d)"), (void *) win, str, n));
- if (!str)
- returnCode(0);
-
- if (win) {
- getyx(win, row, col);
+ if (!win || !str) {
+ i = ERR;
+ } else {
+ int row = win->_cury;
+ int col = win->_curx;
+ NCURSES_CH_T *text = win->_line[row].text;
if (n < 0)
- n = win->_maxx - win->_curx + 1;
+ n = win->_maxx - col + 1;
for (; i < n;) {
#if USE_WIDEC_SUPPORT
- cchar_t *cell = &(win->_line[row].text[col]);
- wchar_t *wch;
+ cchar_t *cell = &(text[col]);
attr_t attrs;
NCURSES_PAIRS_T pair;
- int n2;
- bool done = FALSE;
mbstate_t state;
- size_t i3, n3;
char *tmp;
if (!isWidecExt(*cell)) {
+ wchar_t *wch;
+ int n2;
+
n2 = getcchar(cell, 0, 0, 0, 0);
if (n2 > 0
&& (wch = typeCalloc(wchar_t, (unsigned) n2 + 1)) != 0) {
+ bool done = FALSE;
+
if (getcchar(cell, wch, &attrs, &pair, 0) == OK) {
+ size_t n3;
init_mb(state);
n3 = wcstombs(0, wch, (size_t) 0);
@@ -89,6 +92,8 @@ winnstr(WINDOW *win, char *str, int n)
} else if ((tmp = typeCalloc(char, need)) == 0) {
done = TRUE;
} else {
+ size_t i3;
+
init_mb(state);
wcstombs(tmp, wch, n3);
for (i3 = 0; i3 < n3; ++i3)
@@ -103,14 +108,14 @@ winnstr(WINDOW *win, char *str, int n)
}
}
#else
- str[i++] = (char) CharOf(win->_line[row].text[col]);
+ str[i++] = (char) CharOf(text[col]);
#endif
if (++col > win->_maxx) {
break;
}
}
+ str[i] = '\0'; /* SVr4 does not seem to count the null */
}
- str[i] = '\0'; /* SVr4 does not seem to count the null */
T(("winnstr returns %s", _nc_visbuf(str)));
returnCode(i);
}
diff --git a/ncurses/base/lib_isendwin.c b/ncurses/base/lib_isendwin.c
index 923e35bf122f..d8507fa35cfa 100644
--- a/ncurses/base/lib_isendwin.c
+++ b/ncurses/base/lib_isendwin.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2000,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,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 *
@@ -42,14 +42,14 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_isendwin.c,v 1.7 2009/02/15 00:36:24 tom Exp $")
+MODULE_ID("$Id: lib_isendwin.c,v 1.8 2017/07/22 23:29:49 tom Exp $")
NCURSES_EXPORT(bool)
NCURSES_SP_NAME(isendwin) (NCURSES_SP_DCL0)
{
if (SP_PARM == NULL)
return FALSE;
- return SP_PARM->_endwin;
+ return (SP_PARM->_endwin == ewSuspend);
}
#if NCURSES_SP_FUNCS
diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c
index b0e0f613ebc3..34723f08941a 100644
--- a/ncurses/base/lib_mouse.c
+++ b/ncurses/base/lib_mouse.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 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 *
@@ -84,7 +84,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_mouse.c,v 1.141 2013/09/21 19:09:19 tom Exp $")
+MODULE_ID("$Id: lib_mouse.c,v 1.183 2019/08/10 17:11:50 tom Exp $")
#include <tic.h>
@@ -225,7 +225,7 @@ write_event(SCREEN *sp, int down, int button, int x, int y)
char buf[6];
unsigned long ignore;
- strcpy(buf, "\033[M"); /* should be the same as key_mouse */
+ _nc_STRCPY(buf, "\033[M", sizeof(buf)); /* should be the same as key_mouse */
buf[3] = ' ' + (button - 1) + (down ? 0 : 0x40);
buf[4] = ' ' + x - LEFT_COL + 1;
buf[5] = ' ' + y - TOP_ROW + 1;
@@ -376,9 +376,46 @@ static void
init_xterm_mouse(SCREEN *sp)
{
sp->_mouse_type = M_XTERM;
+ sp->_mouse_format = MF_X10;
sp->_mouse_xtermcap = tigetstr("XM");
- if (!VALID_STRING(sp->_mouse_xtermcap))
+ if (VALID_STRING(sp->_mouse_xtermcap)) {
+ char *code = strstr(sp->_mouse_xtermcap, "[?");
+ if (code != 0) {
+ code += 2;
+ while ((*code >= '0') && (*code <= '9')) {
+ char *next = code;
+ while ((*next >= '0') && (*next <= '9')) {
+ ++next;
+ }
+ if (!strncmp(code, "1006", (size_t) (next - code))) {
+ sp->_mouse_format = MF_SGR1006;
+ }
+#ifdef EXP_XTERM_1005
+ if (!strncmp(code, "1005", (size_t) (next - code))) {
+ sp->_mouse_format = MF_XTERM_1005;
+ }
+#endif
+ if (*next == ';') {
+ while (*next == ';') {
+ ++next;
+ }
+ code = next;
+ } else {
+ break;
+ }
+ }
+ }
+ } else {
+ int code = tigetnum("XM");
+ switch (code) {
+ case 1006:
+ break;
+ default:
+ code = 1000;
+ break;
+ }
sp->_mouse_xtermcap = "\033[?1000%?%p1%{1}%=%th%el%;";
+ }
}
#endif
@@ -395,22 +432,22 @@ enable_xterm_mouse(SCREEN *sp, int enable)
#if USE_GPM_SUPPORT
static bool
-allow_gpm_mouse(SCREEN *sp)
+allow_gpm_mouse(SCREEN *sp GCC_UNUSED)
{
bool result = FALSE;
#if USE_WEAK_SYMBOLS
/* Danger Robinson: do not use dlopen for libgpm if already loaded */
- if ((Gpm_Wgetch)) {
+ if ((Gpm_Wgetch) != 0) {
if (!sp->_mouse_gpm_loaded) {
T(("GPM library was already dlopen'd, not by us"));
}
} else
#endif
/* GPM does printf's without checking if stdout is a terminal */
- if (isatty(fileno(stdout))) {
- char *list = getenv("NCURSES_GPM_TERMS");
- char *env = getenv("TERM");
+ if (NC_ISATTY(fileno(stdout))) {
+ const char *list = getenv("NCURSES_GPM_TERMS");
+ const char *env = getenv("TERM");
if (list != 0) {
if (env != 0) {
result = _nc_name_match(list, env, "|:");
@@ -449,10 +486,17 @@ load_gpm_library(SCREEN *sp)
{
sp->_mouse_gpm_found = FALSE;
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"
+#endif
if (GET_DLSYM(gpm_fd) == 0 ||
GET_DLSYM(Gpm_Open) == 0 ||
GET_DLSYM(Gpm_Close) == 0 ||
GET_DLSYM(Gpm_GetEvent) == 0) {
+#if (defined(__GNUC__) && (__GNUC__ >= 5)) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
T(("GPM initialization failed: %s", dlerror()));
unload_gpm_library(sp);
} else {
@@ -560,8 +604,8 @@ initialize_mousetype(SCREEN *sp)
/* OS/2 VIO */
#if USE_EMX_MOUSE
if (!sp->_emxmouse_thread
- && strstr(TerminalOf(sp)->type.term_names, "xterm") == 0
- && key_mouse) {
+ && strstr(SP_TERMTYPE term_names, "xterm") == 0
+ && NonEmpty(key_mouse)) {
int handles[2];
if (pipe(handles) < 0) {
@@ -571,7 +615,7 @@ initialize_mousetype(SCREEN *sp)
int rc;
if (!sp->_emxmouse_buttons[0]) {
- char *s = getenv("MOUSE_BUTTONS_123");
+ const char *s = getenv("MOUSE_BUTTONS_123");
sp->_emxmouse_buttons[0] = 1;
if (s && strlen(s) >= 3) {
@@ -604,13 +648,14 @@ initialize_mousetype(SCREEN *sp)
#if USE_SYSMOUSE
{
+ static char dev_tty[] = "/dev/tty";
struct mouse_info the_mouse;
char *the_device = 0;
- if (isatty(sp->_ifd))
+ if (NC_ISATTY(sp->_ifd))
the_device = ttyname(sp->_ifd);
if (the_device == 0)
- the_device = "/dev/tty";
+ the_device = dev_tty;
sp->_mouse_fd = open(the_device, O_RDWR);
@@ -668,15 +713,12 @@ initialize_mousetype(SCREEN *sp)
#endif /* USE_SYSMOUSE */
#ifdef USE_TERM_DRIVER
- CallDriver(sp, initmouse);
+ CallDriver(sp, td_initmouse);
#else
/* we know how to recognize mouse events under "xterm" */
- if (key_mouse != 0) {
- if (!strcmp(key_mouse, xterm_kmous)
- || strstr(TerminalOf(sp)->type.term_names, "xterm") != 0) {
- init_xterm_mouse(sp);
- }
- } else if (strstr(TerminalOf(sp)->type.term_names, "xterm") != 0) {
+ if (NonEmpty(key_mouse)) {
+ init_xterm_mouse(sp);
+ } else if (strstr(SP_TERMTYPE term_names, "xterm") != 0) {
if (_nc_add_to_try(&(sp->_keytry), xterm_kmous, KEY_MOUSE) == OK)
init_xterm_mouse(sp);
}
@@ -690,10 +732,11 @@ _nc_mouse_init(SCREEN *sp)
/* initialize the mouse */
{
bool result = FALSE;
- int i;
if (sp != 0) {
if (!sp->_mouse_initialized) {
+ int i;
+
sp->_mouse_initialized = TRUE;
TR(MY_TRACE, ("_nc_mouse_init() called"));
@@ -846,173 +889,431 @@ _nc_mouse_event(SCREEN *sp)
return result; /* true if we found an event */
}
+#if USE_EMX_MOUSE
+#define PRESS_POSITION(n) \
+ do { \
+ eventp->bstate = MASK_PRESS(n); \
+ sp->_mouse_bstate |= MASK_PRESS(n); \
+ if (button & 0x40) { \
+ eventp->bstate = MASK_RELEASE(n); \
+ sp->_mouse_bstate &= ~MASK_PRESS(n); \
+ } \
+ } while (0)
+#else
+#define PRESS_POSITION(n) \
+ do { \
+ eventp->bstate = (mmask_t) ((sp->_mouse_bstate & MASK_PRESS(n)) \
+ ? REPORT_MOUSE_POSITION \
+ : MASK_PRESS(n)); \
+ sp->_mouse_bstate |= MASK_PRESS(n); \
+ } while (0)
+#endif
+
static bool
-_nc_mouse_inline(SCREEN *sp)
-/* mouse report received in the keyboard stream -- parse its info */
+handle_wheel(SCREEN *sp, MEVENT * eventp, int button, int wheel)
{
- int b;
- bool result = FALSE;
- MEVENT *eventp = sp->_mouse_eventp;
+ bool result = TRUE;
+
+ switch (button & 3) {
+ case 0:
+ if (wheel) {
+ eventp->bstate = MASK_PRESS(4);
+ /* Do not record in sp->_mouse_bstate; there will be no
+ * corresponding release event.
+ */
+ } else {
+ PRESS_POSITION(1);
+ }
+ break;
+ case 1:
+ if (wheel) {
+#if NCURSES_MOUSE_VERSION == 2
+ eventp->bstate = MASK_PRESS(5);
+ /* See comment above for button 4 */
+#else
+ /* Ignore this event as it is not a true press of the button */
+ eventp->bstate = REPORT_MOUSE_POSITION;
+#endif
+ } else {
+ PRESS_POSITION(2);
+ }
+ break;
+ case 2:
+ PRESS_POSITION(3);
+ break;
+ default:
+ result = FALSE;
+ break;
+ }
+ return result;
+}
- TR(MY_TRACE, ("_nc_mouse_inline() called"));
+static bool
+decode_X10_bstate(SCREEN *sp, MEVENT * eventp, unsigned intro)
+{
+ bool result;
- if (sp->_mouse_type == M_XTERM) {
- unsigned char kbuf[4];
- size_t grabbed;
- int res;
+ eventp->bstate = 0;
+
+ if (!handle_wheel(sp, eventp, (int) intro, (intro & 96) == 96)) {
- /* This code requires that your xterm entry contain the kmous
- * capability and that it be set to the \E[M documented in the
- * Xterm Control Sequences reference. This is how we
- * arrange for mouse events to be reported via a KEY_MOUSE
- * return value from wgetch(). After this value is received,
- * _nc_mouse_inline() gets called and is immediately
- * responsible for parsing the mouse status information
- * following the prefix.
- *
- * The following quotes from the ctrlseqs.ms document in the
- * X distribution, describing the X mouse tracking feature:
- *
- * Parameters for all mouse tracking escape sequences
- * generated by xterm encode numeric parameters in a single
- * character as value+040. For example, ! is 1.
- *
- * On button press or release, xterm sends ESC [ M CbCxCy.
- * The low two bits of Cb encode button information: 0=MB1
- * pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release. The
- * upper bits encode what modifiers were down when the
- * button was pressed and are added together. 4=Shift,
- * 8=Meta, 16=Control. Cx and Cy are the x and y coordinates
- * of the mouse event. The upper left corner is (1,1).
- *
- * (End quote) By the time we get here, we've eaten the
- * key prefix. FYI, the loop below is necessary because
- * mouse click info isn't guaranteed to present as a
- * single clist item.
- *
- * Wheel mice may return buttons 4 and 5 when the wheel is turned.
- * We encode those as button presses.
+ /*
+ * Release events aren't reported for individual buttons, just for
+ * the button set as a whole. However, because there are normally
+ * no mouse events under xterm that intervene between press and
+ * release, we can infer the button actually released by looking at
+ * the previous event.
*/
+ if (sp->_mouse_bstate & BUTTON_PRESSED) {
+ int b;
+
+ eventp->bstate = BUTTON_RELEASED;
+ for (b = 1; b <= MAX_BUTTONS; ++b) {
+ if (!(sp->_mouse_bstate & MASK_PRESS(b)))
+ eventp->bstate &= ~MASK_RELEASE(b);
+ }
+ sp->_mouse_bstate = 0;
+ } else {
+ /*
+ * xterm will return a stream of release-events to let the
+ * application know where the mouse is going, if private mode
+ * 1002 or 1003 is enabled.
+ */
+ eventp->bstate = REPORT_MOUSE_POSITION;
+ }
+ }
+
+ if (intro & 4) {
+ eventp->bstate |= BUTTON_SHIFT;
+ }
+ if (intro & 8) {
+ eventp->bstate |= BUTTON_ALT;
+ }
+ if (intro & 16) {
+ eventp->bstate |= BUTTON_CTRL;
+ }
+ result = (eventp->bstate & REPORT_MOUSE_POSITION) ? TRUE : FALSE;
+ return result;
+}
+
+/* This code requires that your xterm entry contain the kmous capability and
+ * that it be set to the \E[M documented in the Xterm Control Sequences
+ * reference. This is how we arrange for mouse events to be reported via a
+ * KEY_MOUSE return value from wgetch(). After this value is received,
+ * _nc_mouse_inline() gets called and is immediately responsible for parsing
+ * the mouse status information following the prefix.
+ *
+ * The following quotes from the ctlseqs.ms document in the XTerm distribution,
+ * describing the mouse tracking feature:
+ *
+ * Parameters for all mouse tracking escape sequences generated by xterm encode
+ * numeric parameters in a single character as value+040. For example, ! is
+ * 1.
+ *
+ * On button press or release, xterm sends ESC [ M CbCxCy. The low two bits of
+ * Cb encode button information: 0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed,
+ * 3=release. The upper bits encode what modifiers were down when the button
+ * was pressed and are added together. 4=Shift, 8=Meta, 16=Control. Cx and Cy
+ * are the x and y coordinates of the mouse event. The upper left corner is
+ * (1,1).
+ *
+ * (End quote) By the time we get here, we've eaten the key prefix. FYI, the
+ * loop below is necessary because mouse click info isn't guaranteed to present
+ * as a single clist item.
+ *
+ * Wheel mice may return buttons 4 and 5 when the wheel is turned. We encode
+ * those as button presses.
+ */
+static bool
+decode_xterm_X10(SCREEN *sp, MEVENT * eventp)
+{
+#define MAX_KBUF 3
+ unsigned char kbuf[MAX_KBUF + 1];
+ size_t grabbed;
+ int res;
+ bool result;
+
# if USE_PTHREADS_EINTR
# if USE_WEAK_SYMBOLS
- if ((pthread_self) && (pthread_kill) && (pthread_equal))
+ if ((pthread_self) && (pthread_kill) && (pthread_equal))
# endif
- _nc_globals.read_thread = pthread_self();
+ _nc_globals.read_thread = pthread_self();
# endif
- for (grabbed = 0; grabbed < 3; grabbed += (size_t) res) {
+ for (grabbed = 0; grabbed < MAX_KBUF; grabbed += (size_t) res) {
- /* For VIO mouse we add extra bit 64 to disambiguate button-up. */
+ /* For VIO mouse we add extra bit 64 to disambiguate button-up. */
+ res = (int) read(
#if USE_EMX_MOUSE
- res = (int) read(M_FD(sp) >= 0 ? M_FD(sp) : sp->_ifd, &kbuf, 3);
+ (M_FD(sp) >= 0) ? M_FD(sp) : sp->_ifd,
#else
- res = (int) read(sp->_ifd, kbuf + grabbed, 3 - grabbed);
+ sp->_ifd,
#endif
- if (res == -1)
- break;
- }
+ kbuf + grabbed, (size_t) (MAX_KBUF - (int) grabbed));
+ if (res == -1)
+ break;
+ }
#if USE_PTHREADS_EINTR
- _nc_globals.read_thread = 0;
+ _nc_globals.read_thread = 0;
#endif
- kbuf[3] = '\0';
+ kbuf[MAX_KBUF] = '\0';
- TR(TRACE_IEVENT,
- ("_nc_mouse_inline sees the following xterm data: '%s'", kbuf));
+ TR(TRACE_IEVENT,
+ ("_nc_mouse_inline sees the following xterm data: '%s'", kbuf));
- /* there's only one mouse... */
- eventp->id = NORMAL_EVENT;
+ /* there's only one mouse... */
+ eventp->id = NORMAL_EVENT;
- /* processing code goes here */
- eventp->bstate = 0;
+ result = decode_X10_bstate(sp, eventp, kbuf[0]);
+ eventp->x = (kbuf[1] - ' ') - 1;
+ eventp->y = (kbuf[2] - ' ') - 1;
+
+ return result;
+}
+
+#ifdef EXP_XTERM_1005
+/*
+ * This is identical to X10/X11 responses except that there are two UTF-8
+ * characters storing the ordinates instead of two bytes.
+ */
+static bool
+decode_xterm_1005(SCREEN *sp, MEVENT * eventp)
+{
+ char kbuf[80];
+ size_t grabbed;
+ size_t limit = (sizeof(kbuf) - 1);
+ unsigned coords[2];
+ bool result;
+
+ coords[0] = 0;
+ coords[1] = 0;
+
+# if USE_PTHREADS_EINTR
+# if USE_WEAK_SYMBOLS
+ if ((pthread_self) && (pthread_kill) && (pthread_equal))
+# endif
+ _nc_globals.read_thread = pthread_self();
+# endif
+ for (grabbed = 0; grabbed < limit;) {
+ int res;
+
+ res = (int) read(
#if USE_EMX_MOUSE
-#define PRESS_POSITION(n) \
- do { \
- eventp->bstate = MASK_PRESS(n); \
- sp->_mouse_bstate |= MASK_PRESS(n); \
- if (kbuf[0] & 0x40) { \
- eventp->bstate = MASK_RELEASE(n); \
- sp->_mouse_bstate &= ~MASK_PRESS(n); \
- } \
- } while (0)
+ (M_FD(sp) >= 0) ? M_FD(sp) : sp->_ifd,
#else
-#define PRESS_POSITION(n) \
- do { \
- eventp->bstate = (mmask_t) (sp->_mouse_bstate & MASK_PRESS(n) \
- ? REPORT_MOUSE_POSITION \
- : MASK_PRESS(n)); \
- sp->_mouse_bstate |= MASK_PRESS(n); \
- } while (0)
+ sp->_ifd,
#endif
+ (kbuf + grabbed), (size_t) 1);
+ if (res == -1)
+ break;
+ grabbed += (size_t) res;
+ if (grabbed > 1) {
+ size_t check = 1;
+ int n;
- switch (kbuf[0] & 0x3) {
- case 0x0:
- if ((kbuf[0] & 96) == 96) {
- eventp->bstate = MASK_PRESS(4);
- /* Do not record in sp->_mouse_bstate; there will be no
- * corresponding release event.
- */
- } else {
- PRESS_POSITION(1);
+ for (n = 0; n < 2; ++n) {
+ int rc;
+
+ if (check >= grabbed)
+ break;
+ rc = _nc_conv_to_utf32(&coords[n], kbuf + check, (unsigned)
+ (grabbed - check));
+ if (!rc)
+ break;
+ check += (size_t) rc;
}
- break;
+ if (n >= 2)
+ break;
+ }
+ }
+#if USE_PTHREADS_EINTR
+ _nc_globals.read_thread = 0;
+#endif
- case 0x1:
- if ((kbuf[0] & 96) == 96) {
-#if NCURSES_MOUSE_VERSION == 2
- eventp->bstate = MASK_PRESS(5);
- /* See comment above for button 4 */
+ TR(TRACE_IEVENT,
+ ("_nc_mouse_inline sees the following xterm data: %s",
+ _nc_visbufn(kbuf, (int) grabbed)));
+
+ /* there's only one mouse... */
+ eventp->id = NORMAL_EVENT;
+
+ result = decode_X10_bstate(sp, eventp, UChar(kbuf[0]));
+
+ eventp->x = (int) (coords[0] - ' ') - 1;
+ eventp->y = (int) (coords[1] - ' ') - 1;
+
+ return result;
+}
+#endif /* EXP_XTERM_1005 */
+
+/*
+ * ECMA-48 section 5.4
+ */
+#define isInter(c) ((c) >= 0x20 && (c) <= 0x2f)
+#define isParam(c) ((c) >= 0x30 && (c) <= 0x3f)
+#define isFinal(c) ((c) >= 0x40 && (c) <= 0x7e)
+
+#define MAX_PARAMS 9
+
+typedef struct {
+ int nerror; /* nonzero if there are unexpected chars */
+ int nparam; /* number of numeric parameters */
+ int params[MAX_PARAMS];
+ int final; /* the final-character */
+} SGR_DATA;
+
+static bool
+read_SGR(SCREEN *sp, SGR_DATA * result)
+{
+ char kbuf[80]; /* bigger than any possible mouse response */
+ int grabbed = 0;
+ int ch = 0;
+ int now = -1;
+ int marker = 1;
+
+ memset(result, 0, sizeof(*result));
+# if USE_PTHREADS_EINTR
+# if USE_WEAK_SYMBOLS
+ if ((pthread_self) && (pthread_kill) && (pthread_equal))
+# endif
+ _nc_globals.read_thread = pthread_self();
+# endif
+
+ do {
+ int res;
+
+ res = (int) read(
+#if USE_EMX_MOUSE
+ (M_FD(sp) >= 0) ? M_FD(sp) : sp->_ifd,
#else
- /* Ignore this event as it is not a true press of the button */
- eventp->bstate = REPORT_MOUSE_POSITION;
+ sp->_ifd,
#endif
- } else {
- PRESS_POSITION(2);
+ (kbuf + grabbed), (size_t) 1);
+ if (res == -1)
+ break;
+ if ((grabbed + MAX_KBUF) >= (int) sizeof(kbuf)) {
+ result->nerror++;
+ break;
+ }
+ ch = UChar(kbuf[grabbed]);
+ kbuf[grabbed + 1] = 0;
+ switch (ch) {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (marker) {
+ ++now;
+ result->nparam = (now + 1);
}
+ marker = 0;
+ result->params[now] = (result->params[now] * 10) + (ch - '0');
break;
-
- case 0x2:
- PRESS_POSITION(3);
+ case ';':
+ if (marker) {
+ ++now;
+ result->nparam = (now + 1);
+ }
+ marker = 1;
break;
-
- case 0x3:
- /*
- * Release events aren't reported for individual buttons, just for
- * the button set as a whole. However, because there are normally
- * no mouse events under xterm that intervene between press and
- * release, we can infer the button actually released by looking at
- * the previous event.
- */
- if (sp->_mouse_bstate & BUTTON_PRESSED) {
- eventp->bstate = BUTTON_RELEASED;
- for (b = 1; b <= MAX_BUTTONS; ++b) {
- if (!(sp->_mouse_bstate & MASK_PRESS(b)))
- eventp->bstate &= ~MASK_RELEASE(b);
- }
- sp->_mouse_bstate = 0;
- } else {
+ default:
+ if (ch < 32 || ch > 126) {
/*
- * XFree86 xterm will return a stream of release-events to
- * let the application know where the mouse is going, if the
- * private mode 1002 or 1003 is enabled.
+ * Technically other characters could be interspersed in the
+ * response. Ignore those for now.
*/
- eventp->bstate = REPORT_MOUSE_POSITION;
+ result->nerror++;
+ continue;
+ } else if (isFinal(ch)) {
+ if (marker) {
+ result->nparam++;
+ }
+ result->final = ch;
+ } else {
+ result->nerror++;
}
break;
}
- result = (eventp->bstate & REPORT_MOUSE_POSITION) ? TRUE : FALSE;
+ ++grabbed;
+ } while (!isFinal(ch));
+#if USE_PTHREADS_EINTR
+ _nc_globals.read_thread = 0;
+#endif
- if (kbuf[0] & 4) {
+ kbuf[++grabbed] = 0;
+ TR(TRACE_IEVENT,
+ ("_nc_mouse_inline sees the following xterm data: '%s'", kbuf));
+ return (grabbed > 0) && (result->nerror == 0);
+}
+
+static bool
+decode_xterm_SGR1006(SCREEN *sp, MEVENT * eventp)
+{
+ SGR_DATA data;
+ bool result = FALSE;
+ if (read_SGR(sp, &data)) {
+ int b = data.params[0];
+ int b3 = 1 + (b & 3);
+
+ eventp->id = NORMAL_EVENT;
+ if (data.final == 'M') {
+ (void) handle_wheel(sp, eventp, b, (b & 64) == 64);
+ } 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);
+ if (sp->_mouse_bstate & pressed) {
+ eventp->bstate = release;
+ sp->_mouse_bstate &= ~pressed;
+ } else {
+ eventp->bstate = REPORT_MOUSE_POSITION;
+ }
+ }
+ if (b & 4) {
eventp->bstate |= BUTTON_SHIFT;
}
- if (kbuf[0] & 8) {
+ if (b & 8) {
eventp->bstate |= BUTTON_ALT;
}
- if (kbuf[0] & 16) {
+ if (b & 16) {
eventp->bstate |= BUTTON_CTRL;
}
+ result = (eventp->bstate & REPORT_MOUSE_POSITION) ? TRUE : FALSE;
+ eventp->x = (data.params[1] ? (data.params[1] - 1) : 0);
+ eventp->y = (data.params[2] ? (data.params[2] - 1) : 0);
+ }
+ return result;
+}
+
+static bool
+_nc_mouse_inline(SCREEN *sp)
+/* mouse report received in the keyboard stream -- parse its info */
+{
+ bool result = FALSE;
+ MEVENT *eventp = sp->_mouse_eventp;
+
+ TR(MY_TRACE, ("_nc_mouse_inline() called"));
+
+ if (sp->_mouse_type == M_XTERM) {
+ switch (sp->_mouse_format) {
+ case MF_X10:
+ result = decode_xterm_X10(sp, eventp);
+ break;
+ case MF_SGR1006:
+ result = decode_xterm_SGR1006(sp, eventp);
+ break;
+#ifdef EXP_XTERM_1005
+ case MF_XTERM_1005:
+ result = decode_xterm_1005(sp, eventp);
+ break;
+#endif
+ }
- eventp->x = (kbuf[1] - ' ') - 1;
- eventp->y = (kbuf[2] - ' ') - 1;
TR(MY_TRACE,
("_nc_mouse_inline: primitive mouse-event %s has slot %ld",
_nc_tracemouse(sp, eventp),
@@ -1020,9 +1321,23 @@ _nc_mouse_inline(SCREEN *sp)
/* bump the next-free pointer into the circular list */
sp->_mouse_eventp = NEXT(eventp);
-#if 0 /* this return would be needed for QNX's mods to lib_getch.c */
- return (TRUE);
-#endif
+
+ if (!result) {
+ /* If this event is from a wheel-mouse, treat it like position
+ * reports and avoid waiting for the release-events which will
+ * never come.
+ */
+ if (eventp->bstate & BUTTON_PRESSED) {
+ int b;
+
+ for (b = 4; b <= MAX_BUTTONS; ++b) {
+ if ((eventp->bstate & MASK_PRESS(b))) {
+ result = TRUE;
+ break;
+ }
+ }
+ }
+ }
}
return (result);
@@ -1445,11 +1760,14 @@ NCURSES_EXPORT(int)
NCURSES_SP_NAME(getmouse) (NCURSES_SP_DCLx MEVENT * aevent)
{
int result = ERR;
+ MEVENT *eventp;
T((T_CALLED("getmouse(%p,%p)"), (void *) SP_PARM, (void *) aevent));
- if ((aevent != 0) && (SP_PARM != 0) && (SP_PARM->_mouse_type != M_NONE)) {
- MEVENT *eventp = SP_PARM->_mouse_eventp;
+ if ((aevent != 0) &&
+ (SP_PARM != 0) &&
+ (SP_PARM->_mouse_type != M_NONE) &&
+ (eventp = SP_PARM->_mouse_eventp) != 0) {
/* compute the current-event pointer */
MEVENT *prev = PREV(eventp);
@@ -1498,11 +1816,13 @@ NCURSES_EXPORT(int)
NCURSES_SP_NAME(ungetmouse) (NCURSES_SP_DCLx MEVENT * aevent)
{
int result = ERR;
+ MEVENT *eventp;
T((T_CALLED("ungetmouse(%p,%p)"), (void *) SP_PARM, (void *) aevent));
- if (aevent != 0 && SP_PARM != 0) {
- MEVENT *eventp = SP_PARM->_mouse_eventp;
+ if (aevent != 0 &&
+ SP_PARM != 0 &&
+ (eventp = SP_PARM->_mouse_eventp) != 0) {
/* stick the given event in the next-free slot */
*eventp = *aevent;
@@ -1530,7 +1850,6 @@ NCURSES_SP_NAME(mousemask) (NCURSES_SP_DCLx mmask_t newmask, mmask_t * oldmask)
/* set the mouse event mask */
{
mmask_t result = 0;
- int b;
T((T_CALLED("mousemask(%p,%#lx,%p)"),
(void *) SP_PARM,
@@ -1543,7 +1862,10 @@ NCURSES_SP_NAME(mousemask) (NCURSES_SP_DCLx mmask_t newmask, mmask_t * oldmask)
if (newmask || SP_PARM->_mouse_initialized) {
_nc_mouse_init(SP_PARM);
+
if (SP_PARM->_mouse_type != M_NONE) {
+ int b;
+
result = newmask &
(REPORT_MOUSE_POSITION
| BUTTON_ALT
diff --git a/ncurses/base/lib_newterm.c b/ncurses/base/lib_newterm.c
index 435763d096ea..84963db46f2c 100644
--- a/ncurses/base/lib_newterm.c
+++ b/ncurses/base/lib_newterm.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -48,7 +48,7 @@
#include <tic.h>
-MODULE_ID("$Id: lib_newterm.c,v 1.90 2013/09/28 21:02:56 tom Exp $")
+MODULE_ID("$Id: lib_newterm.c,v 1.101 2018/04/07 20:36:22 tom Exp $")
#ifdef USE_TERM_DRIVER
#define NumLabels InfoOf(SP_PARM).numlabels
@@ -76,6 +76,7 @@ _nc_initscr(NCURSES_SP_DCL0)
/* for extended XPG4 conformance requires cbreak() at this point */
/* (SVr4 curses does this anyway) */
+ T((T_CALLED("_nc_initscr(%p) ->term %p"), (void *) SP_PARM, (void *) term));
if (NCURSES_SP_NAME(cbreak) (NCURSES_SP_ARG) == OK) {
TTY buf;
@@ -93,7 +94,7 @@ _nc_initscr(NCURSES_SP_DCL0)
if (result == OK)
term->Nttyb = buf;
}
- return result;
+ returnCode(result);
}
/*
@@ -162,20 +163,16 @@ nofilter(void)
NCURSES_EXPORT(SCREEN *)
NCURSES_SP_NAME(newterm) (NCURSES_SP_DCLx
- NCURSES_CONST char *name,
+ const char *name,
FILE *ofp,
FILE *ifp)
{
- int value;
int errret;
SCREEN *result = 0;
SCREEN *current;
TERMINAL *its_term;
FILE *_ofp = ofp ? ofp : stdout;
FILE *_ifp = ifp ? ifp : stdin;
- int cols;
- int slk_format;
- int filter_mode;
TERMINAL *new_term = 0;
START_TRACE();
@@ -200,11 +197,10 @@ NCURSES_SP_NAME(newterm) (NCURSES_SP_DCLx
INIT_TERM_DRIVER();
/* this loads the capability entry, then sets LINES and COLS */
if (
-#if NCURSES_SP_FUNCS
- SP_PARM->_prescreen &&
-#endif
TINFO_SETUP_TERM(&new_term, name,
fileno(_ofp), &errret, FALSE) != ERR) {
+ int slk_format;
+ int filter_mode;
_nc_set_screen(0);
#ifdef USE_TERM_DRIVER
@@ -235,6 +231,9 @@ NCURSES_SP_NAME(newterm) (NCURSES_SP_DCLx
_nc_set_screen(current);
result = 0;
} else {
+ int value;
+ int cols;
+
#ifdef USE_TERM_DRIVER
TERMINAL_CONTROL_BLOCK *TCB;
#elif !NCURSES_SP_FUNCS
@@ -268,7 +267,11 @@ NCURSES_SP_NAME(newterm) (NCURSES_SP_DCLx
/* allow user to set maximum escape delay from the environment */
if ((value = _nc_getenv_num("ESCDELAY")) >= 0) {
+#if NCURSES_EXT_FUNCS
NCURSES_SP_NAME(set_escdelay) (NCURSES_SP_ARGx value);
+#else
+ ESCDELAY = value;
+#endif
}
/* if the terminal type has real soft labels, set those up */
@@ -284,7 +287,7 @@ NCURSES_SP_NAME(newterm) (NCURSES_SP_DCLx
#else
SP_PARM->_use_meta = FALSE;
#endif
- SP_PARM->_endwin = FALSE;
+ SP_PARM->_endwin = ewInitial;
#ifndef USE_TERM_DRIVER
/*
* Check whether we can optimize scrolling under dumb terminals in
@@ -306,7 +309,7 @@ NCURSES_SP_NAME(newterm) (NCURSES_SP_DCLx
/* compute movement costs so we can do better move optimization */
#ifdef USE_TERM_DRIVER
- TCBOf(SP_PARM)->drv->scinit(SP_PARM);
+ TCBOf(SP_PARM)->drv->td_scinit(SP_PARM);
#else /* ! USE_TERM_DRIVER */
/*
* Check for mismatched graphic-rendition capabilities. Most SVr4
@@ -344,8 +347,14 @@ NCURSES_SP_NAME(newterm) (NCURSES_SP_DCLx
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(SCREEN *)
-newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
+newterm(const char *name, FILE *ofp, FILE *ifp)
{
- return NCURSES_SP_NAME(newterm) (CURRENT_SCREEN_PRE, name, ofp, ifp);
+ SCREEN *rc;
+ _nc_lock_global(prescreen);
+ START_TRACE();
+ rc = NCURSES_SP_NAME(newterm) (CURRENT_SCREEN_PRE, name, ofp, ifp);
+ _nc_forget_prescr();
+ _nc_unlock_global(prescreen);
+ return rc;
}
#endif
diff --git a/ncurses/base/lib_newwin.c b/ncurses/base/lib_newwin.c
index a6c64beaaf4a..5d48107a3003 100644
--- a/ncurses/base/lib_newwin.c
+++ b/ncurses/base/lib_newwin.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-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 *
@@ -43,7 +43,7 @@
#include <curses.priv.h>
#include <stddef.h>
-MODULE_ID("$Id: lib_newwin.c,v 1.71 2011/05/28 21:32:51 tom Exp $")
+MODULE_ID("$Id: lib_newwin.c,v 1.74 2017/05/13 23:17:29 tom Exp $")
#define window_is(name) ((sp)->_##name == win)
@@ -91,8 +91,6 @@ remove_window_from_screen(WINDOW *win)
NCURSES_EXPORT(int)
_nc_freewin(WINDOW *win)
{
- WINDOWLIST *p, *q;
- int i;
int result = ERR;
#ifdef USE_SP_WINDOWLIST
SCREEN *sp = _nc_screen_of(win); /* pretend this is parameter */
@@ -101,17 +99,23 @@ _nc_freewin(WINDOW *win)
T((T_CALLED("_nc_freewin(%p)"), (void *) win));
if (win != 0) {
+
if (_nc_nonsp_try_global(curses) == 0) {
+ WINDOWLIST *p, *q;
+
q = 0;
- for (each_window(SP_PARM, p)) {
+ for (each_window(sp, p)) {
+
if (&(p->win) == win) {
remove_window_from_screen(win);
if (q == 0)
- WindowList(SP_PARM) = p->next;
+ WindowList(sp) = p->next;
else
q->next = p->next;
if (!(win->_flags & _SUBWIN)) {
+ int i;
+
for (i = 0; i <= win->_maxy; i++)
FreeIfNeeded(win->_line[i].text);
}
@@ -384,18 +388,18 @@ NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_DCLx
NCURSES_EXPORT(WINDOW *)
_nc_curscr_of(SCREEN *sp)
{
- return sp == 0 ? 0 : CurScreen(sp);
+ return (sp == 0) ? NULL : CurScreen(sp);
}
NCURSES_EXPORT(WINDOW *)
_nc_newscr_of(SCREEN *sp)
{
- return sp == 0 ? 0 : NewScreen(sp);
+ return (sp == 0) ? NULL : NewScreen(sp);
}
NCURSES_EXPORT(WINDOW *)
_nc_stdscr_of(SCREEN *sp)
{
- return sp == 0 ? 0 : StdScreen(sp);
+ return (sp == 0) ? NULL : StdScreen(sp);
}
#endif
diff --git a/ncurses/base/lib_overlay.c b/ncurses/base/lib_overlay.c
index a206248a1e74..64356ff1c8c6 100644
--- a/ncurses/base/lib_overlay.c
+++ b/ncurses/base/lib_overlay.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2016 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 *
@@ -40,21 +40,19 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_overlay.c,v 1.31 2013/04/06 23:47:13 tom Exp $")
+MODULE_ID("$Id: lib_overlay.c,v 1.32 2016/05/28 23:11:26 tom Exp $")
static int
overlap(const WINDOW *const src, WINDOW *const dst, int const flag)
{
int rc = ERR;
- int sx1, sy1, sx2, sy2;
- int dx1, dy1, dx2, dy2;
- int sminrow, smincol;
- int dminrow, dmincol;
- int dmaxrow, dmaxcol;
T((T_CALLED("overlap(%p,%p,%d)"), (const void *) src, (void *) dst, flag));
if (src != 0 && dst != 0) {
+ int sx1, sy1, sx2, sy2;
+ int dx1, dy1, dx2, dy2;
+
_nc_lock_global(curses);
T(("src : begy %ld, begx %ld, maxy %ld, maxx %ld",
@@ -79,12 +77,12 @@ overlap(const WINDOW *const src, WINDOW *const dst, int const flag)
dy2 = dy1 + dst->_maxy;
if (dx2 >= sx1 && dx1 <= sx2 && dy2 >= sy1 && dy1 <= sy2) {
- sminrow = max(sy1, dy1) - sy1;
- smincol = max(sx1, dx1) - sx1;
- dminrow = max(sy1, dy1) - dy1;
- dmincol = max(sx1, dx1) - dx1;
- dmaxrow = min(sy2, dy2) - dy1;
- dmaxcol = min(sx2, dx2) - dx1;
+ int sminrow = max(sy1, dy1) - sy1;
+ int smincol = max(sx1, dx1) - sx1;
+ int dminrow = max(sy1, dy1) - dy1;
+ int dmincol = max(sx1, dx1) - dx1;
+ int dmaxrow = min(sy2, dy2) - dy1;
+ int dmaxcol = min(sx2, dx2) - dx1;
rc = copywin(src, dst,
sminrow, smincol,
@@ -139,10 +137,6 @@ copywin(const WINDOW *src, WINDOW *dst,
int over)
{
int rc = ERR;
- int sx, sy, dx, dy;
- bool touched;
- attr_t bk;
- attr_t mask;
T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"),
(const void *) src,
@@ -155,6 +149,9 @@ copywin(const WINDOW *src, WINDOW *dst,
&& dst != 0
&& dmaxrow >= dminrow
&& dmaxcol >= dmincol) {
+ attr_t bk;
+ attr_t mask;
+
_nc_lock_global(curses);
bk = AttrOf(dst->_nc_bkgd);
@@ -163,18 +160,20 @@ copywin(const WINDOW *src, WINDOW *dst,
/* make sure rectangle exists in source */
if ((sminrow + dmaxrow - dminrow) <= (src->_maxy + 1) &&
(smincol + dmaxcol - dmincol) <= (src->_maxx + 1)) {
- bool copied = FALSE;
T(("rectangle exists in source"));
/* make sure rectangle fits in destination */
if (dmaxrow <= dst->_maxy && dmaxcol <= dst->_maxx) {
+ int sx, sy, dx, dy;
+ bool copied = FALSE;
T(("rectangle fits in destination"));
for (dy = dminrow, sy = sminrow;
dy <= dmaxrow;
sy++, dy++) {
+ bool touched;
if (dy < 0 || sy < 0)
continue;
diff --git a/ncurses/base/lib_pad.c b/ncurses/base/lib_pad.c
index b87498b500cd..8c7e5af01c9c 100644
--- a/ncurses/base/lib_pad.c
+++ b/ncurses/base/lib_pad.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,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 *
@@ -42,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_pad.c,v 1.46 2010/04/24 23:50:45 tom Exp $")
+MODULE_ID("$Id: lib_pad.c,v 1.47 2017/10/22 19:57:26 tom Exp $")
NCURSES_EXPORT(WINDOW *)
NCURSES_SP_NAME(newpad) (NCURSES_SP_DCLx int l, int c)
@@ -188,6 +188,12 @@ pnoutrefresh(WINDOW *win,
T(("pad being refreshed"));
+#ifdef TRACE
+ if (USE_TRACEF(TRACE_UPDATE)) {
+ _tracedump("...pad", win);
+ _nc_unlock_global(tracef);
+ }
+#endif /* TRACE */
#if USE_SCROLL_HINTS
if (win->_pad._pad_y >= 0) {
displaced = pminrow - win->_pad._pad_y
diff --git a/ncurses/base/lib_printw.c b/ncurses/base/lib_printw.c
index 56528f6bc7a7..41bd2f98946e 100644
--- a/ncurses/base/lib_printw.c
+++ b/ncurses/base/lib_printw.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 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 *
@@ -39,10 +39,10 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_printw.c,v 1.23 2012/09/03 17:55:28 tom Exp $")
+MODULE_ID("$Id: lib_printw.c,v 1.27 2019/01/19 15:46:25 tom Exp $")
NCURSES_EXPORT(int)
-printw(const char *fmt,...)
+printw(const char *fmt, ...)
{
va_list argp;
int code;
@@ -56,14 +56,14 @@ printw(const char *fmt,...)
#endif
va_start(argp, fmt);
- code = vwprintw(stdscr, fmt, argp);
+ code = vw_printw(stdscr, fmt, argp);
va_end(argp);
returnCode(code);
}
NCURSES_EXPORT(int)
-wprintw(WINDOW *win, const char *fmt,...)
+wprintw(WINDOW *win, const char *fmt, ...)
{
va_list argp;
int code;
@@ -77,16 +77,15 @@ wprintw(WINDOW *win, const char *fmt,...)
#endif
va_start(argp, fmt);
- code = vwprintw(win, fmt, argp);
+ code = vw_printw(win, fmt, argp);
va_end(argp);
returnCode(code);
}
NCURSES_EXPORT(int)
-mvprintw(int y, int x, const char *fmt,...)
+mvprintw(int y, int x, const char *fmt, ...)
{
- va_list argp;
int code;
#ifdef TRACE
@@ -98,17 +97,18 @@ mvprintw(int y, int x, const char *fmt,...)
#endif
if ((code = move(y, x)) != ERR) {
+ va_list argp;
+
va_start(argp, fmt);
- code = vwprintw(stdscr, fmt, argp);
+ code = vw_printw(stdscr, fmt, argp);
va_end(argp);
}
returnCode(code);
}
NCURSES_EXPORT(int)
-mvwprintw(WINDOW *win, int y, int x, const char *fmt,...)
+mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...)
{
- va_list argp;
int code;
#ifdef TRACE
@@ -120,8 +120,10 @@ mvwprintw(WINDOW *win, int y, int x, const char *fmt,...)
#endif
if ((code = wmove(win, y, x)) != ERR) {
+ va_list argp;
+
va_start(argp, fmt);
- code = vwprintw(win, fmt, argp);
+ code = vw_printw(win, fmt, argp);
va_end(argp);
}
returnCode(code);
@@ -144,3 +146,21 @@ vwprintw(WINDOW *win, const char *fmt, va_list argp)
}
returnCode(code);
}
+
+NCURSES_EXPORT(int)
+vw_printw(WINDOW *win, const char *fmt, va_list argp)
+{
+ char *buf;
+ int code = ERR;
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = _nc_screen_of(win);
+#endif
+
+ T((T_CALLED("vw_printw(%p,%s,va_list)"), (void *) win, _nc_visbuf(fmt)));
+
+ buf = NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_ARGx fmt, argp);
+ if (buf != 0) {
+ code = waddstr(win, buf);
+ }
+ returnCode(code);
+}
diff --git a/ncurses/base/lib_restart.c b/ncurses/base/lib_restart.c
index 3a3756e385e8..5bfb0788266d 100644
--- a/ncurses/base/lib_restart.c
+++ b/ncurses/base/lib_restart.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2015 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 *
@@ -41,7 +41,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_restart.c,v 1.15 2012/12/08 20:40:06 tom Exp $")
+MODULE_ID("$Id: lib_restart.c,v 1.16 2015/06/27 18:12:15 tom Exp $")
NCURSES_EXPORT(int)
NCURSES_SP_NAME(restartterm) (NCURSES_SP_DCLx
@@ -54,6 +54,7 @@ NCURSES_SP_NAME(restartterm) (NCURSES_SP_DCLx
TERMINAL *new_term = 0;
#endif
+ START_TRACE();
T((T_CALLED("restartterm(%p,%s,%d,%p)"),
(void *) SP_PARM,
termp,
@@ -110,6 +111,7 @@ NCURSES_SP_NAME(restartterm) (NCURSES_SP_DCLx
NCURSES_EXPORT(int)
restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
{
+ START_TRACE();
return NCURSES_SP_NAME(restartterm) (CURRENT_SCREEN, termp, filenum, errret);
}
#endif
diff --git a/ncurses/base/lib_scanw.c b/ncurses/base/lib_scanw.c
index 637aa46ece01..26a47d1abf55 100644
--- a/ncurses/base/lib_scanw.c
+++ b/ncurses/base/lib_scanw.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 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 *
@@ -40,21 +40,40 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_scanw.c,v 1.13 2011/10/22 16:31:35 tom Exp $")
+MODULE_ID("$Id: lib_scanw.c,v 1.18 2019/01/19 15:46:25 tom Exp $")
NCURSES_EXPORT(int)
-vwscanw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp)
+vwscanw(WINDOW *win, const char *fmt, va_list argp)
{
char buf[BUFSIZ];
+ int code = ERR;
- if (wgetnstr(win, buf, (int) sizeof(buf) - 1) == ERR)
- return (ERR);
+ if (wgetnstr(win, buf, (int) sizeof(buf) - 1) != ERR) {
+ if ((code = vsscanf(buf, fmt, argp)) == EOF) {
+ code = ERR;
+ }
+ }
- return (vsscanf(buf, fmt, argp));
+ return code;
}
NCURSES_EXPORT(int)
-scanw(NCURSES_CONST char *fmt,...)
+vw_scanw(WINDOW *win, const char *fmt, va_list argp)
+{
+ char buf[BUFSIZ];
+ int code = ERR;
+
+ if (wgetnstr(win, buf, (int) sizeof(buf) - 1) != ERR) {
+ if ((code = vsscanf(buf, fmt, argp)) == EOF) {
+ code = ERR;
+ }
+ }
+
+ return code;
+}
+
+NCURSES_EXPORT(int)
+scanw(const char *fmt, ...)
{
int code;
va_list ap;
@@ -62,13 +81,13 @@ scanw(NCURSES_CONST char *fmt,...)
T(("scanw(\"%s\",...) called", fmt));
va_start(ap, fmt);
- code = vwscanw(stdscr, fmt, ap);
+ code = vw_scanw(stdscr, fmt, ap);
va_end(ap);
return (code);
}
NCURSES_EXPORT(int)
-wscanw(WINDOW *win, NCURSES_CONST char *fmt,...)
+wscanw(WINDOW *win, const char *fmt, ...)
{
int code;
va_list ap;
@@ -76,31 +95,31 @@ wscanw(WINDOW *win, NCURSES_CONST char *fmt,...)
T(("wscanw(%p,\"%s\",...) called", (void *) win, fmt));
va_start(ap, fmt);
- code = vwscanw(win, fmt, ap);
+ code = vw_scanw(win, fmt, ap);
va_end(ap);
return (code);
}
NCURSES_EXPORT(int)
-mvscanw(int y, int x, NCURSES_CONST char *fmt,...)
+mvscanw(int y, int x, const char *fmt, ...)
{
int code;
va_list ap;
va_start(ap, fmt);
- code = (move(y, x) == OK) ? vwscanw(stdscr, fmt, ap) : ERR;
+ code = (move(y, x) == OK) ? vw_scanw(stdscr, fmt, ap) : ERR;
va_end(ap);
return (code);
}
NCURSES_EXPORT(int)
-mvwscanw(WINDOW *win, int y, int x, NCURSES_CONST char *fmt,...)
+mvwscanw(WINDOW *win, int y, int x, const char *fmt, ...)
{
int code;
va_list ap;
va_start(ap, fmt);
- code = (wmove(win, y, x) == OK) ? vwscanw(win, fmt, ap) : ERR;
+ code = (wmove(win, y, x) == OK) ? vw_scanw(win, fmt, ap) : ERR;
va_end(ap);
return (code);
}
diff --git a/ncurses/base/lib_screen.c b/ncurses/base/lib_screen.c
index 695ed30e7e10..9e942eaf8494 100644
--- a/ncurses/base/lib_screen.c
+++ b/ncurses/base/lib_screen.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 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 *
@@ -35,32 +35,509 @@
#include <curses.priv.h>
+#include <ctype.h>
+
#ifndef CUR
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_screen.c,v 1.41 2011/10/22 15:03:11 tom Exp $")
+MODULE_ID("$Id: lib_screen.c,v 1.96 2019/07/20 20:23:21 tom Exp $")
#define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */
+#define MARKER '\\'
+#define APPEND '+'
+#define GUTTER '|'
+#define L_CURL '{'
+#define R_CURL '}'
+
+#if USE_STRING_HACKS && HAVE_SNPRINTF
+#define ARG_SLIMIT(name) size_t name,
+#else
+#define ARG_SLIMIT(name) /* nothing */
+#endif
+
+#define CUR_SLIMIT _nc_SLIMIT(limit - (target - base))
+#define TOP_SLIMIT _nc_SLIMIT(sizeof(buffer))
+
+/*
+ * Use 0x888888 as the magic number for new-format files, since it cannot be
+ * mistaken for the _cury/_curx pair of 16-bit numbers which start the old
+ * format. It happens to be unused in the file 5.22 database (2015/03/07).
+ */
+static const char my_magic[] =
+{'\210', '\210', '\210', '\210'};
+
+#if NCURSES_EXT_PUTWIN
+typedef enum {
+ pINT /* int */
+ ,pSHORT /* short */
+ ,pBOOL /* bool */
+ ,pATTR /* attr_t */
+ ,pCHAR /* chtype */
+ ,pSIZE /* NCURSES_SIZE_T */
+#if NCURSES_WIDECHAR
+ ,pCCHAR /* cchar_t */
+#endif
+} PARAM_TYPE;
+
+typedef struct {
+ const char name[11];
+ attr_t attr;
+} SCR_ATTRS;
+
+typedef struct {
+ const char name[17];
+ PARAM_TYPE type;
+ size_t size;
+ size_t offset;
+} SCR_PARAMS;
+
+#define DATA(name) { { #name }, A_##name }
+static const SCR_ATTRS scr_attrs[] =
+{
+ DATA(NORMAL),
+ DATA(STANDOUT),
+ DATA(UNDERLINE),
+ DATA(REVERSE),
+ DATA(BLINK),
+ DATA(DIM),
+ DATA(BOLD),
+ DATA(ALTCHARSET),
+ DATA(INVIS),
+ DATA(PROTECT),
+ DATA(HORIZONTAL),
+ DATA(LEFT),
+ DATA(LOW),
+ DATA(RIGHT),
+ DATA(TOP),
+ DATA(VERTICAL),
+
+#ifdef A_ITALIC
+ DATA(ITALIC),
+#endif
+};
+#undef DATA
+
+#define sizeof2(type,name) sizeof(((type *)0)->name)
+#define DATA(name, type) { { #name }, type, sizeof2(WINDOW, name), offsetof(WINDOW, name) }
+
+static const SCR_PARAMS scr_params[] =
+{
+ DATA(_cury, pSIZE),
+ DATA(_curx, pSIZE),
+ DATA(_maxy, pSIZE),
+ DATA(_maxx, pSIZE),
+ DATA(_begy, pSIZE),
+ DATA(_begx, pSIZE),
+ DATA(_flags, pSHORT),
+ DATA(_attrs, pATTR),
+ DATA(_bkgd, pCHAR),
+ DATA(_notimeout, pBOOL),
+ DATA(_clear, pBOOL),
+ DATA(_leaveok, pBOOL),
+ DATA(_scroll, pBOOL),
+ DATA(_idlok, pBOOL),
+ DATA(_idcok, pBOOL),
+ DATA(_immed, pBOOL),
+ DATA(_sync, pBOOL),
+ DATA(_use_keypad, pBOOL),
+ DATA(_delay, pINT),
+ DATA(_regtop, pSIZE),
+ DATA(_regbottom, pSIZE),
+ DATA(_pad._pad_y, pSIZE),
+ DATA(_pad._pad_x, pSIZE),
+ DATA(_pad._pad_top, pSIZE),
+ DATA(_pad._pad_left, pSIZE),
+ DATA(_pad._pad_bottom, pSIZE),
+ DATA(_pad._pad_right, pSIZE),
+ DATA(_yoffset, pSIZE),
+#if NCURSES_WIDECHAR
+ DATA(_bkgrnd, pCCHAR),
+#if NCURSES_EXT_COLORS
+ DATA(_color, pINT),
+#endif
+#endif
+};
+#undef DATA
+
+static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
+
+/*
+ * Allocate and read a line of text. Caller must free it.
+ */
+static char *
+read_txt(FILE *fp)
+{
+ size_t limit = 1024;
+ char *result = malloc(limit);
+ char *buffer;
+
+ if (result != 0) {
+ int ch = 0;
+ size_t used = 0;
+
+ clearerr(fp);
+ result[used] = '\0';
+ do {
+ if (used + 2 >= limit) {
+ limit += 1024;
+ buffer = realloc(result, limit);
+ if (buffer == 0) {
+ free(result);
+ result = 0;
+ break;
+ }
+ result = buffer;
+ }
+ ch = fgetc(fp);
+ if (ch == EOF)
+ break;
+ result[used++] = (char) ch;
+ result[used] = '\0';
+ } while (ch != '\n');
+
+ if (ch == '\n') {
+ result[--used] = '\0';
+ T(("READ:%s", result));
+ } else if (used == 0) {
+ free(result);
+ result = 0;
+ }
+ }
+ return result;
+}
+
+static char *
+decode_attr(char *source, attr_t *target, int *color)
+{
+ bool found = FALSE;
+
+ T(("decode_attr '%s'", source));
+
+ while (*source) {
+ if (source[0] == MARKER && source[1] == L_CURL) {
+ source += 2;
+ found = TRUE;
+ } else if (source[0] == R_CURL) {
+ source++;
+ found = FALSE;
+ } else if (found) {
+ size_t n;
+ char *next = source;
+
+ if (source[0] == GUTTER) {
+ ++next;
+ } else if (*next == 'C') {
+ int value = 0;
+ unsigned pair;
+ next++;
+ while (isdigit(UChar(*next))) {
+ value = value * 10 + (*next++ - '0');
+ }
+ *target &= ~A_COLOR;
+ pair = (unsigned) ((value > 256)
+ ? COLOR_PAIR(255)
+ : COLOR_PAIR(value));
+ *target |= pair;
+ *color = value;
+ } else {
+ while (isalnum(UChar(*next))) {
+ ++next;
+ }
+ for (n = 0; n < SIZEOF(scr_attrs); ++n) {
+ if ((size_t) (next - source) == strlen(scr_attrs[n].name)) {
+ if (scr_attrs[n].attr) {
+ *target |= scr_attrs[n].attr;
+ } else {
+ *target = A_NORMAL;
+ }
+ break;
+ }
+ }
+ }
+ source = next;
+ } else {
+ break;
+ }
+ }
+ return source;
+}
+
+static char *
+decode_char(char *source, int *target)
+{
+ int limit = 0;
+ int base = 16;
+ const char digits[] = "0123456789abcdef";
+
+ T(("decode_char '%s'", source));
+ *target = ' ';
+ switch (*source) {
+ case MARKER:
+ switch (*++source) {
+ case APPEND:
+ break;
+ case MARKER:
+ *target = MARKER;
+ ++source;
+ break;
+ case 's':
+ *target = ' ';
+ ++source;
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ base = 8;
+ limit = 3;
+ break;
+ case 'u':
+ limit = 4;
+ ++source;
+ break;
+ case 'U':
+ limit = 8;
+ ++source;
+ break;
+ }
+ if (limit) {
+ *target = 0;
+ while (limit-- > 0) {
+ char *find = strchr(digits, *source++);
+ int ch = (find != 0) ? (int) (find - digits) : -1;
+ *target *= base;
+ if (ch >= 0 && ch < base) {
+ *target += ch;
+ }
+ }
+ }
+ break;
+ default:
+ *target = *source++;
+ break;
+ }
+ return source;
+}
+
+static char *
+decode_chtype(char *source, chtype fillin, chtype *target)
+{
+ attr_t attr = ChAttrOf(fillin);
+ int color = PAIR_NUMBER((int) attr);
+ int value;
+
+ T(("decode_chtype '%s'", source));
+ source = decode_attr(source, &attr, &color);
+ source = decode_char(source, &value);
+ *target = (ChCharOf(value) | attr | (chtype) COLOR_PAIR(color));
+ /* FIXME - ignore combining characters */
+ return source;
+}
+
+#if NCURSES_WIDECHAR
+static char *
+decode_cchar(char *source, cchar_t *fillin, cchar_t *target)
+{
+ int color;
+ attr_t attr = fillin->attr;
+ wchar_t chars[CCHARW_MAX];
+ int append = 0;
+ int value = 0;
+
+ T(("decode_cchar '%s'", source));
+ *target = blank;
+#if NCURSES_EXT_COLORS
+ color = fillin->ext_color;
+#else
+ color = (int) PAIR_NUMBER(attr);
+#endif
+ source = decode_attr(source, &attr, &color);
+ memset(chars, 0, sizeof(chars));
+ source = decode_char(source, &value);
+ chars[0] = (wchar_t) value;
+ /* handle combining characters */
+ while (source[0] == MARKER && source[1] == APPEND) {
+ source += 2;
+ source = decode_char(source, &value);
+ if (++append < CCHARW_MAX) {
+ chars[append] = (wchar_t) value;
+ }
+ }
+ setcchar(target, chars, attr, (short) color, &color);
+ return source;
+}
+#endif
+
+static int
+read_win(WINDOW *win, FILE *fp)
+{
+ int code = ERR;
+ size_t n;
+ int color;
+#if NCURSES_WIDECHAR
+ NCURSES_CH_T prior;
+#endif
+ chtype prior2;
+
+ memset(win, 0, sizeof(WINDOW));
+ for (;;) {
+ char *name;
+ char *value;
+ char *txt = read_txt(fp);
+
+ if (txt == 0)
+ break;
+ if (!strcmp(txt, "rows:")) {
+ free(txt);
+ code = OK;
+ break;
+ }
+ if ((value = strchr(txt, '=')) == 0) {
+ free(txt);
+ continue;
+ }
+ *value++ = '\0';
+ name = !strcmp(txt, "flag") ? value : txt;
+ for (n = 0; n < SIZEOF(scr_params); ++n) {
+ if (!strcmp(name, scr_params[n].name)) {
+ void *data = (void *) ((char *) win + scr_params[n].offset);
+
+ switch (scr_params[n].type) {
+ case pATTR:
+ (void) decode_attr(value, data, &color);
+ break;
+ case pBOOL:
+ *(bool *) data = TRUE;
+ break;
+ case pCHAR:
+ prior2 = ' ';
+ decode_chtype(value, prior2, data);
+ break;
+ case pINT:
+ *(int *) data = atoi(value);
+ break;
+ case pSHORT:
+ *(short *) data = (short) atoi(value);
+ break;
+ case pSIZE:
+ *(NCURSES_SIZE_T *) data = (NCURSES_SIZE_T) atoi(value);
+ break;
+#if NCURSES_WIDECHAR
+ case pCCHAR:
+ prior = blank;
+ decode_cchar(value, &prior, data);
+ break;
+#endif
+ }
+ break;
+ }
+ }
+ free(txt);
+ }
+ return code;
+}
+
+static int
+read_row(char *source, NCURSES_CH_T * prior, NCURSES_CH_T * target, int length)
+{
+ while (*source != '\0' && length > 0) {
+#if NCURSES_WIDECHAR
+ int len;
+
+ source = decode_cchar(source, prior, target);
+ len = _nc_wacs_width(target->chars[0]);
+ if (len > 1) {
+ int n;
+
+ SetWidecExt(CHDEREF(target), 0);
+ for (n = 1; n < len; ++n) {
+ target[n] = target[0];
+ SetWidecExt(CHDEREF(target), n);
+ }
+ target += (len - 1);
+ length -= (len - 1);
+ }
+#else
+ source = decode_chtype(source, *prior, target);
+#endif
+ *prior = *target;
+ ++target;
+ --length;
+ }
+ while (length-- > 0) {
+ *target++ = blank;
+ }
+ /* FIXME - see what error conditions should apply if I need to return ERR */
+ return 0;
+}
+#endif /* NCURSES_EXT_PUTWIN */
+
+/*
+ * Originally, getwin/putwin used fread/fwrite, because they used binary data.
+ * The new format uses printable ASCII, which does not have as predictable
+ * sizes. Consequently, we use buffered I/O, e.g., fgetc/fprintf, which need
+ * special handling if we want to read screen dumps from an older library.
+ */
+static int
+read_block(void *target, size_t length, FILE *fp)
+{
+ int result = 0;
+ char *buffer = target;
+
+ clearerr(fp);
+ while (length-- != 0) {
+ int ch = fgetc(fp);
+ if (ch == EOF) {
+ result = -1;
+ break;
+ }
+ *buffer++ = (char) ch;
+ }
+ return result;
+}
+
NCURSES_EXPORT(WINDOW *)
NCURSES_SP_NAME(getwin) (NCURSES_SP_DCLx FILE *filep)
{
WINDOW tmp, *nwin;
- int n;
+ bool old_format = FALSE;
T((T_CALLED("getwin(%p)"), (void *) filep));
if (filep == 0) {
returnWin(0);
}
- clearerr(filep);
- if (fread(&tmp, (size_t) 1, sizeof(WINDOW), filep) < sizeof(WINDOW)
- || ferror(filep)
- || tmp._maxy == 0
- || tmp._maxy > MAX_SIZE
- || tmp._maxx == 0
- || tmp._maxx > MAX_SIZE) {
+
+ /*
+ * Read the first 4 bytes to determine first if this is an old-format
+ * screen-dump, or new-format.
+ */
+ if (read_block(&tmp, (size_t) 4, filep) < 0) {
+ returnWin(0);
+ }
+ /*
+ * If this is a new-format file, and we do not support it, give up.
+ */
+ if (!memcmp(&tmp, my_magic, (size_t) 4)) {
+#if NCURSES_EXT_PUTWIN
+ if (read_win(&tmp, filep) < 0)
+#endif
+ returnWin(0);
+ } else if (read_block(((char *) &tmp) + 4, sizeof(WINDOW) - 4, filep) < 0) {
+ returnWin(0);
+ } else {
+ old_format = TRUE;
+ }
+
+ /*
+ * Check the window-size:
+ */
+ if (tmp._maxy == 0 ||
+ tmp._maxy > MAX_SIZE ||
+ tmp._maxx == 0 ||
+ tmp._maxx > MAX_SIZE) {
returnWin(0);
}
@@ -80,6 +557,7 @@ NCURSES_SP_NAME(getwin) (NCURSES_SP_DCLx FILE *filep)
* made sense is probably gone.
*/
if (nwin != 0) {
+ int n;
size_t linesize = sizeof(NCURSES_CH_T) * (size_t) (tmp._maxx + 1);
nwin->_curx = tmp._curx;
@@ -111,14 +589,55 @@ NCURSES_SP_NAME(getwin) (NCURSES_SP_DCLx FILE *filep)
if (tmp._flags & _ISPAD)
nwin->_pad = tmp._pad;
- for (n = 0; n <= nwin->_maxy; n++) {
- clearerr(filep);
- if (fread(nwin->_line[n].text, (size_t) 1, linesize, filep) < linesize
- || ferror(filep)) {
+ if (old_format) {
+ T(("reading old-format screen dump"));
+ for (n = 0; n <= nwin->_maxy; n++) {
+ if (read_block(nwin->_line[n].text, linesize, filep) < 0) {
+ delwin(nwin);
+ returnWin(0);
+ }
+ }
+ }
+#if NCURSES_EXT_PUTWIN
+ else {
+ char *txt = 0;
+ bool success = TRUE;
+ NCURSES_CH_T prior = blank;
+
+ T(("reading new-format screen dump"));
+ for (n = 0; n <= nwin->_maxy; n++) {
+ long row;
+ char *next;
+
+ if ((txt = read_txt(filep)) == 0) {
+ T(("...failed to read string for row %d", n + 1));
+ success = FALSE;
+ break;
+ }
+ row = strtol(txt, &next, 10);
+ if (row != (n + 1) || *next != ':') {
+ T(("...failed to read row-number %d", n + 1));
+ success = FALSE;
+ break;
+ }
+
+ if (read_row(++next, &prior, nwin->_line[n].text, tmp._maxx
+ + 1) < 0) {
+ T(("...failed to read cells for row %d", n + 1));
+ success = FALSE;
+ break;
+ }
+ free(txt);
+ txt = 0;
+ }
+
+ if (!success) {
+ free(txt);
delwin(nwin);
returnWin(0);
}
}
+#endif
touchwin(nwin);
}
returnWin(nwin);
@@ -132,24 +651,283 @@ getwin(FILE *filep)
}
#endif
+#if NCURSES_EXT_PUTWIN
+static void
+encode_attr(char *target, ARG_SLIMIT(limit)
+ attr_t source,
+ attr_t prior,
+ int source_color,
+ int prior_color)
+{
+#if USE_STRING_HACKS && HAVE_SNPRINTF
+ char *base = target;
+#endif
+ source &= ~A_CHARTEXT;
+ prior &= ~A_CHARTEXT;
+
+ *target = '\0';
+ if ((source != prior) || (source_color != prior_color)) {
+ size_t n;
+ bool first = TRUE;
+
+ *target++ = MARKER;
+ *target++ = L_CURL;
+
+ for (n = 0; n < SIZEOF(scr_attrs); ++n) {
+ if ((source & scr_attrs[n].attr) != 0 ||
+ ((source & ALL_BUT_COLOR) == 0 &&
+ (scr_attrs[n].attr == A_NORMAL))) {
+ if (first) {
+ first = FALSE;
+ } else {
+ *target++ = '|';
+ }
+ _nc_STRCPY(target, scr_attrs[n].name, limit);
+ target += strlen(target);
+ }
+ }
+ if (source_color != prior_color) {
+ if (!first)
+ *target++ = '|';
+ _nc_SPRINTF(target, CUR_SLIMIT "C%d", source_color);
+ target += strlen(target);
+ }
+
+ *target++ = R_CURL;
+ *target = '\0';
+ }
+}
+
+static void
+encode_cell(char *target, ARG_SLIMIT(limit) CARG_CH_T source, CARG_CH_T previous)
+{
+#if USE_STRING_HACKS && HAVE_SNPRINTF
+ char *base = target;
+#endif
+#if NCURSES_WIDECHAR
+ size_t n;
+ int source_pair = GetPair(*source);
+ int previous_pair = GetPair(*previous);
+
+ *target = '\0';
+ if ((previous->attr != source->attr) || (previous_pair != source_pair)) {
+ encode_attr(target, CUR_SLIMIT
+ source->attr,
+ previous->attr,
+ source_pair,
+ previous_pair);
+ }
+ target += strlen(target);
+#if NCURSES_EXT_COLORS
+ if (previous->ext_color != source->ext_color) {
+ _nc_SPRINTF(target, CUR_SLIMIT
+ "%c%cC%d%c", MARKER, L_CURL, source->ext_color, R_CURL);
+ }
+#endif
+ for (n = 0; n < SIZEOF(source->chars); ++n) {
+ unsigned uch = (unsigned) source->chars[n];
+ if (uch == 0)
+ continue;
+ if (n) {
+ *target++ = MARKER;
+ *target++ = APPEND;
+ }
+ *target++ = MARKER;
+ if (uch > 0xffff) {
+ _nc_SPRINTF(target, CUR_SLIMIT "U%08x", uch);
+ } else if (uch > 0xff) {
+ _nc_SPRINTF(target, CUR_SLIMIT "u%04x", uch);
+ } else if (uch < 32 || uch >= 127) {
+ _nc_SPRINTF(target, CUR_SLIMIT "%03o", uch & 0xff);
+ } else {
+ switch (uch) {
+ case ' ':
+ _nc_STRCPY(target, "s", limit);
+ break;
+ case MARKER:
+ *target++ = MARKER;
+ *target = '\0';
+ break;
+ default:
+ --target;
+ _nc_SPRINTF(target, CUR_SLIMIT "%c", uch);
+ break;
+ }
+ }
+ target += strlen(target);
+ }
+#else
+ chtype ch = CharOfD(source);
+
+ *target = '\0';
+ if (AttrOfD(previous) != AttrOfD(source)) {
+ encode_attr(target, CUR_SLIMIT
+ AttrOfD(source),
+ AttrOfD(previous),
+ GetPair(source),
+ GetPair(previous));
+ }
+ target += strlen(target);
+ *target++ = MARKER;
+ if (ch < 32 || ch >= 127) {
+ _nc_SPRINTF(target, CUR_SLIMIT "%03o", UChar(ch));
+ } else {
+ switch (ch) {
+ case ' ':
+ _nc_STRCPY(target, "s", limit);
+ break;
+ case MARKER:
+ *target++ = MARKER;
+ *target = '\0';
+ break;
+ default:
+ --target;
+ _nc_SPRINTF(target, CUR_SLIMIT "%c", UChar(ch));
+ break;
+ }
+ }
+#endif
+}
+#endif
+
NCURSES_EXPORT(int)
putwin(WINDOW *win, FILE *filep)
{
int code = ERR;
- int n;
T((T_CALLED("putwin(%p,%p)"), (void *) win, (void *) filep));
+#if NCURSES_EXT_PUTWIN
+ if (win != 0) {
+ const char *version = curses_version();
+ char buffer[1024];
+ NCURSES_CH_T last_cell;
+ int y;
+
+ memset(&last_cell, 0, sizeof(last_cell));
+
+ clearerr(filep);
+
+ /*
+ * Our magic number is technically nonprinting, but aside from that,
+ * all of the file is printable ASCII.
+ */
+#define PUTS(s) if (fputs(s, filep) == EOF || ferror(filep)) returnCode(code)
+ PUTS(my_magic);
+ PUTS(version);
+ PUTS("\n");
+ for (y = 0; y < (int) SIZEOF(scr_params); ++y) {
+ const char *name = scr_params[y].name;
+ const char *data = (char *) win + scr_params[y].offset;
+ const void *dp = (const void *) data;
+ attr_t attr;
+
+ *buffer = '\0';
+ if (!strncmp(name, "_pad.", (size_t) 5) && !(win->_flags & _ISPAD)) {
+ continue;
+ }
+ switch (scr_params[y].type) {
+ case pATTR:
+ attr = (*(const attr_t *) dp) & ~A_CHARTEXT;
+ encode_attr(buffer, TOP_SLIMIT
+ (*(const attr_t *) dp) & ~A_CHARTEXT,
+ A_NORMAL,
+ COLOR_PAIR((int) attr),
+ 0);
+ break;
+ case pBOOL:
+ if (!(*(const bool *) data)) {
+ continue;
+ }
+ _nc_STRCPY(buffer, name, sizeof(buffer));
+ name = "flag";
+ break;
+ case pCHAR:
+ attr = (*(const attr_t *) dp);
+ encode_attr(buffer, TOP_SLIMIT
+ * (const attr_t *) dp,
+ A_NORMAL,
+ COLOR_PAIR((int) attr),
+ 0);
+ break;
+ case pINT:
+ if (!(*(const int *) dp))
+ continue;
+ _nc_SPRINTF(buffer, TOP_SLIMIT
+ "%d", *(const int *) dp);
+ break;
+ case pSHORT:
+ if (!(*(const short *) dp))
+ continue;
+ _nc_SPRINTF(buffer, TOP_SLIMIT
+ "%d", *(const short *) dp);
+ break;
+ case pSIZE:
+ if (!(*(const NCURSES_SIZE_T *) dp))
+ continue;
+ _nc_SPRINTF(buffer, TOP_SLIMIT
+ "%d", *(const NCURSES_SIZE_T *) dp);
+ break;
+#if NCURSES_WIDECHAR
+ case pCCHAR:
+ encode_cell(buffer, TOP_SLIMIT
+ (CARG_CH_T) dp, CHREF(last_cell));
+ break;
+#endif
+ }
+ /*
+ * Only write non-default data.
+ */
+ if (*buffer != '\0') {
+ if (fprintf(filep, "%s=%s\n", name, buffer) <= 0
+ || ferror(filep))
+ returnCode(code);
+ }
+ }
+ /* Write row-data */
+ fprintf(filep, "rows:\n");
+ for (y = 0; y <= win->_maxy; y++) {
+ NCURSES_CH_T *data = win->_line[y].text;
+ int x;
+ if (fprintf(filep, "%d:", y + 1) <= 0
+ || ferror(filep))
+ returnCode(code);
+ for (x = 0; x <= win->_maxx; x++) {
+#if NCURSES_WIDECHAR
+ int len = _nc_wacs_width(data[x].chars[0]);
+ encode_cell(buffer, TOP_SLIMIT CHREF(data[x]), CHREF(last_cell));
+ last_cell = data[x];
+ PUTS(buffer);
+ if (len > 1)
+ x += (len - 1);
+#else
+ encode_cell(buffer, TOP_SLIMIT CHREF(data[x]), CHREF(last_cell));
+ last_cell = data[x];
+ PUTS(buffer);
+#endif
+ }
+ PUTS("\n");
+ }
+ code = OK;
+ }
+#else
+ /*
+ * This is the original putwin():
+ * A straight binary dump is simple, but its format can depend on whether
+ * ncurses is compiled with wide-character support, and also may depend
+ * on the version of ncurses, e.g., if the WINDOW structure is extended.
+ */
if (win != 0) {
size_t len = (size_t) (win->_maxx + 1);
+ int y;
clearerr(filep);
if (fwrite(win, sizeof(WINDOW), (size_t) 1, filep) != 1
|| ferror(filep))
returnCode(code);
- for (n = 0; n <= win->_maxy; n++) {
- if (fwrite(win->_line[n].text,
+ for (y = 0; y <= win->_maxy; y++) {
+ if (fwrite(win->_line[y].text,
sizeof(NCURSES_CH_T), len, filep) != len
|| ferror(filep)) {
returnCode(code);
@@ -157,6 +935,7 @@ putwin(WINDOW *win, FILE *filep)
}
code = OK;
}
+#endif
returnCode(code);
}
@@ -164,21 +943,23 @@ NCURSES_EXPORT(int)
NCURSES_SP_NAME(scr_restore) (NCURSES_SP_DCLx const char *file)
{
FILE *fp = 0;
+ int code = ERR;
T((T_CALLED("scr_restore(%p,%s)"), (void *) SP_PARM, _nc_visbuf(file)));
- if (_nc_access(file, R_OK) < 0
- || (fp = fopen(file, "rb")) == 0) {
- returnCode(ERR);
- } else {
+ if (_nc_access(file, R_OK) >= 0
+ && (fp = fopen(file, BIN_R)) != 0) {
delwin(NewScreen(SP_PARM));
NewScreen(SP_PARM) = getwin(fp);
#if !USE_REENTRANT
newscr = NewScreen(SP_PARM);
#endif
(void) fclose(fp);
- returnCode(OK);
+ if (NewScreen(SP_PARM) != 0) {
+ code = OK;
+ }
}
+ returnCode(code);
}
#if NCURSES_SP_FUNCS
@@ -198,7 +979,7 @@ scr_dump(const char *file)
T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file)));
if (_nc_access(file, W_OK) < 0
- || (fp = fopen(file, "wb")) == 0) {
+ || (fp = fopen(file, BIN_W)) == 0) {
result = ERR;
} else {
(void) putwin(newscr, fp);
@@ -211,7 +992,6 @@ scr_dump(const char *file)
NCURSES_EXPORT(int)
NCURSES_SP_NAME(scr_init) (NCURSES_SP_DCLx const char *file)
{
- FILE *fp = 0;
int code = ERR;
T((T_CALLED("scr_init(%p,%s)"), (void *) SP_PARM, _nc_visbuf(file)));
@@ -223,15 +1003,19 @@ NCURSES_SP_NAME(scr_init) (NCURSES_SP_DCLx const char *file)
!(exit_ca_mode && non_rev_rmcup)
#endif
) {
+ FILE *fp = 0;
+
if (_nc_access(file, R_OK) >= 0
- && (fp = fopen(file, "rb")) != 0) {
+ && (fp = fopen(file, BIN_R)) != 0) {
delwin(CurScreen(SP_PARM));
CurScreen(SP_PARM) = getwin(fp);
#if !USE_REENTRANT
curscr = CurScreen(SP_PARM);
#endif
(void) fclose(fp);
- code = OK;
+ if (CurScreen(SP_PARM) != 0) {
+ code = OK;
+ }
}
}
returnCode(code);
@@ -248,18 +1032,21 @@ scr_init(const char *file)
NCURSES_EXPORT(int)
NCURSES_SP_NAME(scr_set) (NCURSES_SP_DCLx const char *file)
{
+ int code = ERR;
+
T((T_CALLED("scr_set(%p,%s)"), (void *) SP_PARM, _nc_visbuf(file)));
- if (NCURSES_SP_NAME(scr_init) (NCURSES_SP_ARGx file) == ERR) {
- returnCode(ERR);
- } else {
+ if (NCURSES_SP_NAME(scr_init) (NCURSES_SP_ARGx file) == OK) {
delwin(NewScreen(SP_PARM));
NewScreen(SP_PARM) = dupwin(curscr);
#if !USE_REENTRANT
newscr = NewScreen(SP_PARM);
#endif
- returnCode(OK);
+ if (NewScreen(SP_PARM) != 0) {
+ code = OK;
+ }
}
+ returnCode(code);
}
#if NCURSES_SP_FUNCS
diff --git a/ncurses/base/lib_scroll.c b/ncurses/base/lib_scroll.c
index 8684e2519294..000f128fb0d6 100644
--- a/ncurses/base/lib_scroll.c
+++ b/ncurses/base/lib_scroll.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2011,2019 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 *
@@ -43,7 +43,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_scroll.c,v 1.29 2011/10/22 16:34:50 tom Exp $")
+MODULE_ID("$Id: lib_scroll.c,v 1.31 2019/08/03 22:27:55 tom Exp $")
NCURSES_EXPORT(void)
_nc_scroll_window(WINDOW *win,
@@ -77,11 +77,13 @@ _nc_scroll_window(WINDOW *win,
* setup cost. So there is no point in trying to be excessively
* clever -- esr.
*/
+#define BottomLimit(n) ((n) >= 0 && (n) >= top)
+#define TopLimit(n) ((n) <= win->_maxy && (n) <= bottom)
/* shift n lines downwards */
if (n < 0) {
limit = top - n;
- for (line = bottom; line >= limit && line >= 0; line--) {
+ for (line = bottom; line >= limit && BottomLimit(line); line--) {
TR(TRACE_MOVE, ("...copying %d to %d", line + n, line));
memcpy(win->_line[line].text,
win->_line[line + n].text,
@@ -89,7 +91,7 @@ _nc_scroll_window(WINDOW *win,
if_USE_SCROLL_HINTS(win->_line[line].oldindex =
win->_line[line + n].oldindex);
}
- for (line = top; line < limit && line <= win->_maxy; line++) {
+ for (line = top; line < limit && TopLimit(line); line++) {
TR(TRACE_MOVE, ("...filling %d", line));
for (j = 0; j <= win->_maxx; j++)
win->_line[line].text[j] = blank;
@@ -100,14 +102,14 @@ _nc_scroll_window(WINDOW *win,
/* shift n lines upwards */
if (n > 0) {
limit = bottom - n;
- for (line = top; line <= limit && line <= win->_maxy; line++) {
+ for (line = top; line <= limit && TopLimit(line); line++) {
memcpy(win->_line[line].text,
win->_line[line + n].text,
to_copy);
if_USE_SCROLL_HINTS(win->_line[line].oldindex =
win->_line[line + n].oldindex);
}
- for (line = bottom; line > limit && line >= 0; line--) {
+ for (line = bottom; line > limit && BottomLimit(line); line--) {
for (j = 0; j <= win->_maxx; j++)
win->_line[line].text[j] = blank;
if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX);
diff --git a/ncurses/base/lib_set_term.c b/ncurses/base/lib_set_term.c
index acf6bc1f71cd..fb0465a940a6 100644
--- a/ncurses/base/lib_set_term.c
+++ b/ncurses/base/lib_set_term.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -43,11 +43,10 @@
#include <curses.priv.h>
#include <tic.h>
-#ifndef CUR
+#undef CUR
#define CUR SP_TERMTYPE
-#endif
-MODULE_ID("$Id: lib_set_term.c,v 1.148 2013/08/31 13:33:06 tom Exp $")
+MODULE_ID("$Id: lib_set_term.c,v 1.168 2018/12/15 23:49:43 tom Exp $")
#ifdef USE_TERM_DRIVER
#define MaxColors InfoOf(sp).maxcolors
@@ -134,7 +133,6 @@ delink_screen(SCREEN *sp)
NCURSES_EXPORT(void)
delscreen(SCREEN *sp)
{
- int i;
T((T_CALLED("delscreen(%p)"), (void *) sp));
@@ -159,7 +157,10 @@ delscreen(SCREEN *sp)
(void) _nc_freewin(StdScreen(sp));
if (sp->_slk != 0) {
+
if (sp->_slk->ent != 0) {
+ int i;
+
for (i = 0; i < sp->_slk->labcnt; ++i) {
FreeIfNeeded(sp->_slk->ent[i].ent_text);
FreeIfNeeded(sp->_slk->ent[i].form_text);
@@ -181,6 +182,7 @@ delscreen(SCREEN *sp)
FreeIfNeeded(sp->_color_table);
FreeIfNeeded(sp->_color_pairs);
+ FreeIfNeeded(sp->_oldnum_list);
FreeIfNeeded(sp->oldhash);
FreeIfNeeded(sp->newhash);
FreeIfNeeded(sp->hashtab);
@@ -190,6 +192,10 @@ delscreen(SCREEN *sp)
NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
NCURSES_SP_NAME(del_curterm) (NCURSES_SP_ARGx sp->_term);
+ FreeIfNeeded(sp->out_buffer);
+ if (_nc_find_prescr() == sp) {
+ _nc_forget_prescr();
+ }
free(sp);
/*
@@ -206,6 +212,12 @@ delscreen(SCREEN *sp)
COLOR_PAIRS = 0;
#endif
_nc_set_screen(0);
+#if USE_WIDEC_SUPPORT
+ if (SP == 0) {
+ FreeIfNeeded(_nc_wacs);
+ _nc_wacs = 0;
+ }
+#endif
}
}
_nc_unlock_global(curses);
@@ -242,16 +254,17 @@ no_mouse_wrap(SCREEN *sp GCC_UNUSED)
}
#if NCURSES_EXT_FUNCS && USE_COLORFGBG
-static char *
-extract_fgbg(char *src, int *result)
+static const char *
+extract_fgbg(const char *src, int *result)
{
- char *dst = 0;
- long value = strtol(src, &dst, 0);
+ const char *dst = 0;
+ char *tmp = 0;
+ long value = strtol(src, &tmp, 0);
- if (dst == 0) {
+ if ((dst = tmp) == 0) {
dst = src;
} else if (value >= 0) {
- *result = value;
+ *result = (int) value;
}
while (*dst != 0 && *dst != ';')
dst++;
@@ -261,7 +274,7 @@ extract_fgbg(char *src, int *result)
}
#endif
-#define ReturnScreenError() { _nc_set_screen(0); \
+#define ReturnScreenError() do { _nc_set_screen(0); \
returnCode(ERR); } while (0)
/* OS-independent screen initializations */
@@ -276,9 +289,11 @@ NCURSES_SP_NAME(_nc_setupscreen) (
int filtered,
int slk_format)
{
+#ifndef USE_TERM_DRIVER
+ static const TTY null_TTY; /* all zeros iff uninitialized */
+#endif
char *env;
int bottom_stolen = 0;
- ripoff_t *rop;
SCREEN *sp;
#ifndef USE_TERM_DRIVER
bool support_cookies = USE_XMC_SUPPORT;
@@ -295,6 +310,7 @@ NCURSES_SP_NAME(_nc_setupscreen) (
if (!sp) {
sp = _nc_alloc_screen_sp();
+ T(("_nc_alloc_screen_sp %p", (void *) sp));
*spp = sp;
}
if (!sp
@@ -351,15 +367,21 @@ NCURSES_SP_NAME(_nc_setupscreen) (
slines = 1;
SET_LINES(slines);
#ifdef USE_TERM_DRIVER
- CallDriver(sp, setfilter);
+ CallDriver(sp, td_setfilter);
#else
- clear_screen = 0;
- cursor_down = parm_down_cursor = 0;
- cursor_address = 0;
- cursor_up = parm_up_cursor = 0;
- row_address = 0;
+ /* *INDENT-EQLS* */
+ clear_screen = ABSENT_STRING;
+ cursor_address = ABSENT_STRING;
+ cursor_down = ABSENT_STRING;
+ cursor_up = ABSENT_STRING;
+ parm_down_cursor = ABSENT_STRING;
+ parm_up_cursor = ABSENT_STRING;
+ row_address = ABSENT_STRING;
+ cursor_home = carriage_return;
+
+ if (back_color_erase)
+ clr_eos = ABSENT_STRING;
- cursor_home = carriage_return;
#endif
T(("filter screensize %dx%d", slines, scolumns));
}
@@ -411,8 +433,8 @@ NCURSES_SP_NAME(_nc_setupscreen) (
sp->_default_fg = COLOR_WHITE;
sp->_default_bg = COLOR_BLACK;
#else
- sp->_default_fg = C_MASK;
- sp->_default_bg = C_MASK;
+ sp->_default_fg = COLOR_DEFAULT;
+ sp->_default_bg = COLOR_DEFAULT;
#endif
/*
@@ -424,9 +446,9 @@ NCURSES_SP_NAME(_nc_setupscreen) (
char sep1, sep2;
int count = sscanf(env, "%d%c%d%c", &fg, &sep1, &bg, &sep2);
if (count >= 1) {
- sp->_default_fg = ((fg >= 0 && fg < MaxColors) ? fg : C_MASK);
+ sp->_default_fg = ((fg >= 0 && fg < MaxColors) ? fg : COLOR_DEFAULT);
if (count >= 3) {
- sp->_default_bg = ((bg >= 0 && bg < MaxColors) ? bg : C_MASK);
+ sp->_default_bg = ((bg >= 0 && bg < MaxColors) ? bg : COLOR_DEFAULT);
}
TR(TRACE_CHARPUT | TRACE_MOVE,
("from environment assumed fg=%d, bg=%d",
@@ -442,7 +464,7 @@ NCURSES_SP_NAME(_nc_setupscreen) (
* decide later if it is worth having default attributes as well.
*/
if (getenv("COLORFGBG") != 0) {
- char *p = getenv("COLORFGBG");
+ const char *p = getenv("COLORFGBG");
TR(TRACE_CHARPUT | TRACE_MOVE, ("decoding COLORFGBG %s", p));
p = extract_fgbg(p, &(sp->_default_fg));
p = extract_fgbg(p, &(sp->_default_bg));
@@ -453,7 +475,7 @@ NCURSES_SP_NAME(_nc_setupscreen) (
if (sp->_default_fg >= MaxColors) {
if (set_a_foreground != ABSENT_STRING
&& !strcmp(set_a_foreground, "\033[3%p1%dm")) {
- set_a_foreground = "\033[3%?%p1%{8}%>%t9%e%p1%d%;m";
+ set_a_foreground = strdup("\033[3%?%p1%{8}%>%t9%e%p1%d%;m");
} else {
sp->_default_fg %= MaxColors;
}
@@ -461,7 +483,7 @@ NCURSES_SP_NAME(_nc_setupscreen) (
if (sp->_default_bg >= MaxColors) {
if (set_a_background != ABSENT_STRING
&& !strcmp(set_a_background, "\033[4%p1%dm")) {
- set_a_background = "\033[4%?%p1%{8}%>%t9%e%p1%d%;m";
+ set_a_background = strdup("\033[4%?%p1%{8}%>%t9%e%p1%d%;m");
} else {
sp->_default_bg %= MaxColors;
}
@@ -573,7 +595,9 @@ NCURSES_SP_NAME(_nc_setupscreen) (
NCURSES_SP_NAME(_nc_init_acs) (NCURSES_SP_ARG);
#if USE_WIDEC_SUPPORT
sp->_screen_unicode = _nc_unicode_locale();
- _nc_init_wacs();
+ if (_nc_wacs == 0) {
+ _nc_init_wacs();
+ }
if (_nc_wacs == 0) {
ReturnScreenError();
}
@@ -617,10 +641,22 @@ NCURSES_SP_NAME(_nc_setupscreen) (
NewScreen(sp)->_clear = TRUE;
CurScreen(sp)->_clear = FALSE;
- NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_ARG);
- NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_ARG);
+ /*
+ * Get the current tty-modes. setupterm() may already have done this,
+ * unless we use the term-driver.
+ */
+#ifndef USE_TERM_DRIVER
+ if (cur_term != 0 &&
+ !memcmp(&cur_term->Ottyb, &null_TTY, sizeof(TTY)))
+#endif
+ {
+ NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_ARG);
+ }
if (safe_ripoff_sp && safe_ripoff_sp != safe_ripoff_stack) {
+ ripoff_t *rop;
+
for (rop = safe_ripoff_stack;
rop != safe_ripoff_sp && (rop - safe_ripoff_stack) < N_RIPS;
rop++) {
@@ -714,9 +750,12 @@ NCURSES_SP_NAME(_nc_ripoffline) (NCURSES_SP_DCLx
int (*init) (WINDOW *, int))
{
int code = ERR;
+ TR_FUNC_BFR(1);
START_TRACE();
- T((T_CALLED("ripoffline(%p,%d,%p)"), (void *) SP_PARM, line, init));
+ T((T_CALLED("ripoffline(%p,%d,%s)"),
+ (void *) SP_PARM, line,
+ TR_FUNC_ARG(0, init)));
#if NCURSES_SP_FUNCS
if (SP_PARM != 0 && SP_PARM->_prescreen)
@@ -725,12 +764,15 @@ NCURSES_SP_NAME(_nc_ripoffline) (NCURSES_SP_DCLx
if (line == 0) {
code = OK;
} else {
- if (safe_ripoff_sp == 0)
+ if (safe_ripoff_sp == 0) {
safe_ripoff_sp = safe_ripoff_stack;
+ }
if (safe_ripoff_sp < safe_ripoff_stack + N_RIPS) {
safe_ripoff_sp->line = line;
safe_ripoff_sp->hook = init;
(safe_ripoff_sp)++;
+ T(("ripped-off %d:%d chunks",
+ (int) (safe_ripoff_sp - safe_ripoff_stack), N_RIPS));
code = OK;
}
}
@@ -743,7 +785,12 @@ NCURSES_SP_NAME(_nc_ripoffline) (NCURSES_SP_DCLx
NCURSES_EXPORT(int)
_nc_ripoffline(int line, int (*init) (WINDOW *, int))
{
- return NCURSES_SP_NAME(_nc_ripoffline) (CURRENT_SCREEN_PRE, line, init);
+ int rc;
+ _nc_lock_global(prescreen);
+ START_TRACE();
+ rc = NCURSES_SP_NAME(_nc_ripoffline) (CURRENT_SCREEN_PRE, line, init);
+ _nc_unlock_global(prescreen);
+ return rc;
}
#endif
@@ -762,6 +809,11 @@ NCURSES_SP_NAME(ripoffline) (NCURSES_SP_DCLx
NCURSES_EXPORT(int)
ripoffline(int line, int (*init) (WINDOW *, int))
{
- return NCURSES_SP_NAME(ripoffline) (CURRENT_SCREEN_PRE, line, init);
+ int rc;
+ _nc_lock_global(prescreen);
+ START_TRACE();
+ rc = NCURSES_SP_NAME(ripoffline) (CURRENT_SCREEN_PRE, line, init);
+ _nc_unlock_global(prescreen);
+ return rc;
}
#endif
diff --git a/ncurses/base/lib_slkatr_set.c b/ncurses/base/lib_slkatr_set.c
index a3132e9ced1a..fa701f0b1008 100644
--- a/ncurses/base/lib_slkatr_set.c
+++ b/ncurses/base/lib_slkatr_set.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,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 *
@@ -38,30 +38,31 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkatr_set.c,v 1.15 2014/02/01 22:10:42 tom Exp $")
+MODULE_ID("$Id: lib_slkatr_set.c,v 1.16 2017/03/16 23:45:36 tom Exp $")
NCURSES_EXPORT(int)
NCURSES_SP_NAME(slk_attr_set) (NCURSES_SP_DCLx
const attr_t attr,
- NCURSES_PAIRS_T color_pair_number,
+ NCURSES_PAIRS_T pair_arg,
void *opts)
{
int code = ERR;
+ int color_pair = pair_arg;
T((T_CALLED("slk_attr_set(%p,%s,%d)"),
(void *) SP_PARM,
_traceattr(attr),
- (int) color_pair_number));
+ color_pair));
+ set_extended_pair(opts, color_pair);
if (SP_PARM != 0
&& SP_PARM->_slk != 0
- && !opts
- && color_pair_number >= 0
- && color_pair_number < SP_PARM->_pair_limit) {
+ && color_pair >= 0
+ && color_pair < SP_PARM->_pair_limit) {
TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
SetAttr(SP_PARM->_slk->attr, attr);
- if (color_pair_number > 0) {
- SetPair(SP_PARM->_slk->attr, color_pair_number);
+ if (color_pair > 0) {
+ SetPair(SP_PARM->_slk->attr, color_pair);
}
TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
code = OK;
@@ -71,9 +72,9 @@ NCURSES_SP_NAME(slk_attr_set) (NCURSES_SP_DCLx
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-slk_attr_set(const attr_t attr, NCURSES_COLOR_T color_pair_number, void *opts)
+slk_attr_set(const attr_t attr, NCURSES_COLOR_T pair_arg, void *opts)
{
return NCURSES_SP_NAME(slk_attr_set) (CURRENT_SCREEN, attr,
- color_pair_number, opts);
+ pair_arg, opts);
}
#endif
diff --git a/ncurses/base/lib_slkcolor.c b/ncurses/base/lib_slkcolor.c
index 2cf9e5d7f121..7edbe1afcc93 100644
--- a/ncurses/base/lib_slkcolor.c
+++ b/ncurses/base/lib_slkcolor.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -38,31 +38,53 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkcolor.c,v 1.17 2014/02/01 22:10:42 tom Exp $")
+MODULE_ID("$Id: lib_slkcolor.c,v 1.19 2018/03/01 15:02:12 tom Exp $")
-NCURSES_EXPORT(int)
-NCURSES_SP_NAME(slk_color) (NCURSES_SP_DCLx NCURSES_PAIRS_T color_pair_number)
+static int
+_nc_slk_color(SCREEN *sp, int pair_arg)
{
int code = ERR;
- T((T_CALLED("slk_color(%p,%d)"), (void *) SP_PARM, (int) color_pair_number));
+ T((T_CALLED("slk_color(%p,%d)"), (void *) sp, pair_arg));
- if (SP_PARM != 0
- && SP_PARM->_slk != 0
- && color_pair_number >= 0
- && color_pair_number < SP_PARM->_pair_limit) {
- TR(TRACE_ATTRS, ("... current is %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
- SetPair(SP_PARM->_slk->attr, color_pair_number);
- TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
+ if (sp != 0
+ && sp->_slk != 0
+ && pair_arg >= 0
+ && pair_arg < sp->_pair_limit) {
+ TR(TRACE_ATTRS, ("... current is %s", _tracech_t(CHREF(sp->_slk->attr))));
+ SetPair(sp->_slk->attr, pair_arg);
+ TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(sp->_slk->attr))));
code = OK;
}
returnCode(code);
}
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(slk_color) (NCURSES_SP_DCLx NCURSES_PAIRS_T pair_arg)
+{
+ return _nc_slk_color(SP_PARM, pair_arg);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+slk_color(NCURSES_PAIRS_T pair_arg)
+{
+ return NCURSES_SP_NAME(slk_color) (CURRENT_SCREEN, pair_arg);
+}
+#endif
+
+#if NCURSES_EXT_COLORS
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(extended_slk_color) (NCURSES_SP_DCLx int pair_arg)
+{
+ return _nc_slk_color(SP_PARM, pair_arg);
+}
+
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-slk_color(NCURSES_PAIRS_T color_pair_number)
+extended_slk_color(int pair_arg)
{
- return NCURSES_SP_NAME(slk_color) (CURRENT_SCREEN, color_pair_number);
+ return NCURSES_SP_NAME(extended_slk_color) (CURRENT_SCREEN, pair_arg);
}
#endif
+#endif
diff --git a/ncurses/base/lib_slkinit.c b/ncurses/base/lib_slkinit.c
index 9cbdfea98430..11bbdef6ccf7 100644
--- a/ncurses/base/lib_slkinit.c
+++ b/ncurses/base/lib_slkinit.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,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 *
@@ -40,7 +40,7 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkinit.c,v 1.13 2009/10/31 00:10:46 tom Exp $")
+MODULE_ID("$Id: lib_slkinit.c,v 1.14 2017/06/30 11:47:34 tom Exp $")
#ifdef USE_SP_RIPOFF
#define SoftkeyFormat SP_PARM->slk_format
@@ -75,6 +75,11 @@ NCURSES_SP_NAME(slk_init) (NCURSES_SP_DCLx int format)
NCURSES_EXPORT(int)
slk_init(int format)
{
- return NCURSES_SP_NAME(slk_init) (CURRENT_SCREEN_PRE, format);
+ int rc;
+ _nc_lock_global(prescreen);
+ START_TRACE();
+ rc = NCURSES_SP_NAME(slk_init) (CURRENT_SCREEN_PRE, format);
+ _nc_unlock_global(prescreen);
+ return rc;
}
#endif
diff --git a/ncurses/base/lib_slkrefr.c b/ncurses/base/lib_slkrefr.c
index 6d9fcd63507c..382f9c4b00f7 100644
--- a/ncurses/base/lib_slkrefr.c
+++ b/ncurses/base/lib_slkrefr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2014 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 *
@@ -43,7 +43,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_slkrefr.c,v 1.29 2013/01/12 17:25:48 tom Exp $")
+MODULE_ID("$Id: lib_slkrefr.c,v 1.30 2014/03/08 20:32:59 tom Exp $")
#ifdef USE_TERM_DRIVER
#define NumLabels InfoOf(SP_PARM).numlabels
@@ -97,7 +97,7 @@ slk_intern_refresh(SCREEN *sp)
if (slk->ent[i].visible) {
if (numlab > 0 && SLK_STDFMT(fmt)) {
#ifdef USE_TERM_DRIVER
- CallDriver_2(sp, hwlabel, i + 1, slk->ent[i].form_text);
+ CallDriver_2(sp, td_hwlabel, i + 1, slk->ent[i].form_text);
#else
if (i < num_labels) {
NCURSES_PUTP2("plab_norm",
@@ -125,7 +125,7 @@ slk_intern_refresh(SCREEN *sp)
if (numlab > 0) {
#ifdef USE_TERM_DRIVER
- CallDriver_1(sp, hwlabelOnOff, slk->hidden ? FALSE : TRUE);
+ CallDriver_1(sp, td_hwlabelOnOff, slk->hidden ? FALSE : TRUE);
#else
if (slk->hidden) {
NCURSES_PUTP2("label_off", label_off);
diff --git a/ncurses/base/lib_slkset.c b/ncurses/base/lib_slkset.c
index 9091e001a91d..66a4d043a687 100644
--- a/ncurses/base/lib_slkset.c
+++ b/ncurses/base/lib_slkset.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2019 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 *
@@ -44,7 +44,7 @@
#endif
#endif
-MODULE_ID("$Id: lib_slkset.c,v 1.24 2012/12/08 23:09:25 tom Exp $")
+MODULE_ID("$Id: lib_slkset.c,v 1.25 2019/05/04 20:46:24 tom Exp $")
NCURSES_EXPORT(int)
NCURSES_SP_NAME(slk_set) (NCURSES_SP_DCLx int i, const char *astr, int format)
@@ -89,9 +89,9 @@ NCURSES_SP_NAME(slk_set) (NCURSES_SP_DCLx int i, const char *astr, int format)
mbrtowc(&wc, p, need, &state);
if (!iswprint((wint_t) wc))
break;
- if (wcwidth(wc) + numcols > limit)
+ if (_nc_wacs_width(wc) + numcols > limit)
break;
- numcols += wcwidth(wc);
+ numcols += _nc_wacs_width(wc);
p += need;
}
numchrs = (int) (p - str);
diff --git a/ncurses/base/lib_touch.c b/ncurses/base/lib_touch.c
index 20ac9450f15f..451606483b86 100644
--- a/ncurses/base/lib_touch.c
+++ b/ncurses/base/lib_touch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-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 *
@@ -43,16 +43,19 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_touch.c,v 1.12 2012/06/09 20:29:33 tom Exp $")
+MODULE_ID("$Id: lib_touch.c,v 1.15 2017/11/21 00:14:26 tom Exp $")
+
+#undef is_linetouched
NCURSES_EXPORT(bool)
is_linetouched(WINDOW *win, int line)
{
T((T_CALLED("is_linetouched(%p,%d)"), (void *) win, line));
- /* XSI doesn't define any error */
- if (!win || (line > win->_maxy) || (line < 0))
- returnCode((bool) ERR);
+ /* XSI doesn't define any error, and gcc ultimately made it impossible */
+ if (!win || (line > win->_maxy) || (line < 0)) {
+ returnCode(FALSE);
+ }
returnCode(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE);
}
@@ -60,14 +63,15 @@ is_linetouched(WINDOW *win, int line)
NCURSES_EXPORT(bool)
is_wintouched(WINDOW *win)
{
- int i;
-
T((T_CALLED("is_wintouched(%p)"), (void *) win));
- if (win)
+ if (win) {
+ int i;
+
for (i = 0; i <= win->_maxy; i++)
if (win->_line[i].firstchar != _NOCHANGE)
returnCode(TRUE);
+ }
returnCode(FALSE);
}
diff --git a/ncurses/base/lib_vline.c b/ncurses/base/lib_vline.c
index 2f3148eca77c..acb5dfd125f8 100644
--- a/ncurses/base/lib_vline.c
+++ b/ncurses/base/lib_vline.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-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 *
@@ -29,6 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Sven Verdoolaege 2001 *
****************************************************************************/
/*
@@ -40,22 +42,21 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_vline.c,v 1.12 2010/12/19 01:22:58 tom Exp $")
+MODULE_ID("$Id: lib_vline.c,v 1.14 2017/10/28 19:55:44 tom Exp $")
NCURSES_EXPORT(int)
wvline(WINDOW *win, chtype ch, int n)
{
int code = ERR;
- int row, col;
- int end;
T((T_CALLED("wvline(%p,%s,%d)"), (void *) win, _tracechtype(ch), n));
if (win) {
NCURSES_CH_T wch;
- row = win->_cury;
- col = win->_curx;
- end = row + n - 1;
+ int row = win->_cury;
+ int col = win->_curx;
+ int end = row + n - 1;
+
if (end > win->_maxy)
end = win->_maxy;
@@ -67,6 +68,14 @@ wvline(WINDOW *win, chtype ch, int n)
while (end >= row) {
struct ldat *line = &(win->_line[end]);
+#if USE_WIDEC_SUPPORT
+ if (col > 0 && isWidecExt(line->text[col])) {
+ SetChar2(line->text[col - 1], ' ');
+ }
+ if (col < win->_maxx && isWidecExt(line->text[col + 1])) {
+ SetChar2(line->text[col + 1], ' ');
+ }
+#endif
line->text[col] = wch;
CHANGED_CELL(line, col);
end--;
diff --git a/ncurses/base/lib_window.c b/ncurses/base/lib_window.c
index 4baa36943c44..d755e88d66a3 100644
--- a/ncurses/base/lib_window.c
+++ b/ncurses/base/lib_window.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2016 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 *
@@ -39,7 +39,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_window.c,v 1.29 2010/12/19 01:47:22 tom Exp $")
+MODULE_ID("$Id: lib_window.c,v 1.30 2016/05/28 23:11:26 tom Exp $")
NCURSES_EXPORT(void)
_nc_synchook(WINDOW *win)
@@ -56,7 +56,6 @@ mvderwin(WINDOW *win, int y, int x)
/* move a derived window */
{
WINDOW *orig;
- int i;
int rc = ERR;
T((T_CALLED("mvderwin(%p,%d,%d)"), (void *) win, y, x));
@@ -66,6 +65,8 @@ mvderwin(WINDOW *win, int y, int x)
&& (x >= 0 && y >= 0)
&& (x + getmaxx(win) <= getmaxx(orig))
&& (y + getmaxy(win) <= getmaxy(orig))) {
+ int i;
+
wsyncup(win);
win->_parx = x;
win->_pary = y;
@@ -177,8 +178,6 @@ dupwin(WINDOW *win)
/* make an exact duplicate of the given window */
{
WINDOW *nwin = 0;
- size_t linesize;
- int i;
T((T_CALLED("dupwin(%p)"), (void *) win));
@@ -200,6 +199,8 @@ dupwin(WINDOW *win)
}
if (nwin != 0) {
+ int i;
+ size_t linesize;
nwin->_curx = win->_curx;
nwin->_cury = win->_cury;
diff --git a/ncurses/base/new_pair.c b/ncurses/base/new_pair.c
new file mode 100644
index 000000000000..2c3c2fb82a2d
--- /dev/null
+++ b/ncurses/base/new_pair.c
@@ -0,0 +1,385 @@
+/****************************************************************************
+ * Copyright (c) 2017-2018,2019 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: Thomas E. Dickey *
+ ****************************************************************************/
+
+/* new_pair.c
+ *
+ * New color-pair functions, alloc_pair and free_pair
+ */
+
+#define NEW_PAIR_INTERNAL 1
+#include <curses.priv.h>
+
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+#ifdef USE_TERM_DRIVER
+#define MaxColors InfoOf(SP_PARM).maxcolors
+#else
+#define MaxColors max_colors
+#endif
+
+#if NCURSES_EXT_COLORS
+
+/* fix redefinition versys tic.h */
+#undef entry
+#define entry my_entry
+#undef ENTRY
+#define ENTRY my_ENTRY
+
+#include <search.h>
+
+#endif
+
+MODULE_ID("$Id: new_pair.c,v 1.18 2019/01/21 14:54:47 tom Exp $")
+
+#if NCURSES_EXT_COLORS
+
+#ifdef NEW_PAIR_DEBUG
+
+static int
+prev_len(SCREEN *sp, int pair)
+{
+ int result = 1;
+ int base = pair;
+ colorpair_t *list = sp->_color_pairs;
+ while (list[pair].prev != base) {
+ result++;
+ pair = list[pair].prev;
+ }
+ return result;
+}
+
+static int
+next_len(SCREEN *sp, int pair)
+{
+ int result = 1;
+ int base = pair;
+ colorpair_t *list = sp->_color_pairs;
+ while (list[pair].next != base) {
+ result++;
+ pair = list[pair].next;
+ }
+ return result;
+}
+
+/*
+ * Trace the contents of LRU color-pairs.
+ */
+static void
+dumpit(SCREEN *sp, int pair, const char *tag)
+{
+ colorpair_t *list = sp->_color_pairs;
+ char bigbuf[256 * 20];
+ char *p = bigbuf;
+ int n;
+ size_t have = sizeof(bigbuf);
+
+ _nc_STRCPY(p, tag, have);
+ for (n = 0; n < sp->_pair_limit; ++n) {
+ if (list[n].mode != cpFREE) {
+ p += strlen(p);
+ if ((size_t) (p - bigbuf) + 50 > have)
+ break;
+ _nc_SPRINTF(p, _nc_SLIMIT(have - (p - bigbuf))
+ " %d%c(%d,%d)",
+ n, n == pair ? '@' : ':', list[n].next, list[n].prev);
+ }
+ }
+ T(("(%d/%d) %ld - %s",
+ next_len(sp, 0),
+ prev_len(sp, 0),
+ strlen(bigbuf), bigbuf));
+
+ if (next_len(sp, 0) != prev_len(sp, 0)) {
+ endwin();
+ ExitProgram(EXIT_FAILURE);
+ }
+}
+#else
+#define dumpit(sp, pair, tag) /* nothing */
+#endif
+
+static int
+compare_data(const void *a, const void *b)
+{
+ const colorpair_t *p = (const colorpair_t *) a;
+ const colorpair_t *q = (const colorpair_t *) b;
+ return ((p->fg == q->fg)
+ ? (p->bg - q->bg)
+ : (p->fg - q->fg));
+}
+
+static int
+_nc_find_color_pair(SCREEN *sp, int fg, int bg)
+{
+ colorpair_t find;
+ int result;
+ void *pp;
+
+ 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;
+ }
+ return result;
+}
+
+static void
+delink_color_pair(SCREEN *sp, int pair)
+{
+ colorpair_t *list = sp->_color_pairs;
+ int prev = list[pair].prev;
+ int next = list[pair].next;
+
+ /* delink this from its current location */
+ if (list[prev].next == pair &&
+ list[next].prev == pair) {
+ list[prev].next = next;
+ list[next].prev = prev;
+ dumpit(sp, pair, "delinked");
+ }
+}
+
+/*
+ * Discard all nodes in the fast-index.
+ */
+NCURSES_EXPORT(void)
+_nc_free_ordered_pairs(SCREEN *sp)
+{
+ if (sp && sp->_ordered_pairs && sp->_pair_alloc) {
+ int n;
+ for (n = 0; n < sp->_pair_alloc; ++n) {
+ tdelete(&sp->_color_pairs[n], &sp->_ordered_pairs, compare_data);
+ }
+ }
+}
+
+/*
+ * Use this call to update the fast-index when modifying an entry in the color
+ * pair table.
+ */
+NCURSES_EXPORT(void)
+_nc_reset_color_pair(SCREEN *sp, int pair, colorpair_t * next)
+{
+ colorpair_t *last;
+ if (ValidPair(sp, pair)) {
+ ReservePairs(sp, pair);
+ last = &(sp->_color_pairs[pair]);
+ delink_color_pair(sp, pair);
+ if (last->mode > cpFREE &&
+ (last->fg != next->fg || last->bg != next->bg)) {
+ /* remove the old entry from fast index */
+ tdelete(last, &sp->_ordered_pairs, compare_data);
+ /* create a new entry in fast index */
+ *last = *next;
+ tsearch(last, &sp->_ordered_pairs, compare_data);
+ }
+ }
+}
+
+/*
+ * Use this call to relink the newest pair to the front of the list, keeping
+ * "0" first.
+ */
+NCURSES_EXPORT(void)
+_nc_set_color_pair(SCREEN *sp, int pair, int mode)
+{
+ if (ValidPair(sp, pair)) {
+ colorpair_t *list = sp->_color_pairs;
+ dumpit(sp, pair, "SET_PAIR");
+ list[0].mode = cpKEEP;
+ if (list[pair].mode <= cpFREE)
+ sp->_pairs_used++;
+ list[pair].mode = mode;
+ if (list[0].next != pair) {
+ /* link it at the front of the list */
+ list[pair].next = list[0].next;
+ list[list[pair].next].prev = pair;
+ list[pair].prev = 0;
+ list[0].next = pair;
+ }
+ dumpit(sp, pair, "...after");
+ }
+}
+
+/*
+ * If we reallocate the color-pair array, we have to adjust the fast-index.
+ */
+NCURSES_EXPORT(void)
+_nc_copy_pairs(SCREEN *sp, colorpair_t * target, colorpair_t * source, int length)
+{
+ int n;
+ for (n = 0; n < length; ++n) {
+ void *find = tfind(source + n, &sp->_ordered_pairs, compare_data);
+ if (find != 0) {
+ tdelete(source + n, &sp->_ordered_pairs, compare_data);
+ tsearch(target + n, &sp->_ordered_pairs, compare_data);
+ }
+ }
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(alloc_pair) (NCURSES_SP_DCLx int fg, int bg)
+{
+ int pair;
+
+ T((T_CALLED("alloc_pair(%d,%d)"), fg, bg));
+ if (SP_PARM == 0) {
+ pair = -1;
+ } else if ((pair = _nc_find_color_pair(SP_PARM, fg, bg)) < 0) {
+ /*
+ * Check if all of the slots have been used. If not, find one and
+ * use that.
+ */
+ if (SP_PARM->_pairs_used + 1 < SP_PARM->_pair_limit) {
+ bool found = FALSE;
+ int hint = SP_PARM->_recent_pair;
+
+ /*
+ * The linear search is done to allow mixing calls to init_pair()
+ * and alloc_pair(). The former can make gaps...
+ */
+ for (pair = hint + 1; pair < SP_PARM->_pair_alloc; pair++) {
+ if (SP_PARM->_color_pairs[pair].mode == cpFREE) {
+ T(("found gap %d", pair));
+ found = TRUE;
+ break;
+ }
+ }
+ if (!found && (SP_PARM->_pair_alloc < SP_PARM->_pair_limit)) {
+ pair = SP_PARM->_pair_alloc;
+ ReservePairs(SP_PARM, pair);
+ if (SP_PARM->_color_pairs == 0) {
+ pair = -1;
+ } else {
+ found = TRUE;
+ }
+ }
+ if (!found) {
+ for (pair = 1; pair <= hint; pair++) {
+ if (SP_PARM->_color_pairs[pair].mode == cpFREE) {
+ T(("found gap %d", pair));
+ found = TRUE;
+ break;
+ }
+ }
+ }
+ if (found) {
+ SP_PARM->_recent_pair = pair;
+ } else {
+ pair = ERR;
+ }
+ } else {
+ /* reuse the oldest one */
+ pair = SP_PARM->_color_pairs[0].prev;
+ T(("reusing %d", pair));
+ }
+
+ if (_nc_init_pair(SP_PARM, pair, fg, bg) == ERR)
+ pair = ERR;
+ }
+ returnCode(pair);
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(find_pair) (NCURSES_SP_DCLx int fg, int bg)
+{
+ int pair;
+
+ T((T_CALLED("find_pair(%d,%d)"), fg, bg));
+ pair = _nc_find_color_pair(SP_PARM, fg, bg);
+ returnCode(pair);
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(free_pair) (NCURSES_SP_DCLx int pair)
+{
+ int result = ERR;
+ T((T_CALLED("free_pair(%d)"), pair));
+ if (ValidPair(SP_PARM, pair) && pair < SP_PARM->_pair_alloc) {
+ colorpair_t *cp = &(SP_PARM->_color_pairs[pair]);
+ if (pair != 0) {
+ _nc_change_pair(SP_PARM, pair);
+ delink_color_pair(SP_PARM, pair);
+ tdelete(cp, &SP_PARM->_ordered_pairs, compare_data);
+ cp->mode = cpFREE;
+ result = OK;
+ SP_PARM->_pairs_used--;
+ }
+ }
+ returnCode(result);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+alloc_pair(int f, int b)
+{
+ return NCURSES_SP_NAME(alloc_pair) (CURRENT_SCREEN, f, b);
+}
+
+NCURSES_EXPORT(int)
+find_pair(int f, int b)
+{
+ return NCURSES_SP_NAME(find_pair) (CURRENT_SCREEN, f, b);
+}
+
+NCURSES_EXPORT(int)
+free_pair(int pair)
+{
+ return NCURSES_SP_NAME(free_pair) (CURRENT_SCREEN, pair);
+}
+#endif
+
+#if NO_LEAKS
+NCURSES_EXPORT(void)
+_nc_new_pair_leaks(SCREEN *sp)
+{
+ if (sp->_color_pairs) {
+ while (sp->_color_pairs[0].next) {
+ free_pair(sp->_color_pairs[0].next);
+ }
+ }
+}
+#endif
+
+#else
+void _nc_new_pair(void);
+void
+_nc_new_pair(void)
+{
+}
+#endif /* NCURSES_EXT_COLORS */
diff --git a/ncurses/base/resizeterm.c b/ncurses/base/resizeterm.c
index 03d52a448b09..c99109a69dff 100644
--- a/ncurses/base/resizeterm.c
+++ b/ncurses/base/resizeterm.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2015,2016 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 *
@@ -45,7 +45,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: resizeterm.c,v 1.45 2012/07/07 17:07:23 tom Exp $")
+MODULE_ID("$Id: resizeterm.c,v 1.49 2016/05/28 23:11:26 tom Exp $")
/*
* If we're trying to be reentrant, do not want any local statics.
@@ -62,6 +62,12 @@ static int current_cols;
#define EXTRA_DCLS /* nothing */
#endif
+#if NCURSES_SP_FUNCS && !defined(USE_SP_WINDOWLIST)
+#define UNUSED_SP (void) sp
+#else
+#define UNUSED_SP /* nothing */
+#endif
+
#ifdef TRACE
static void
show_window_sizes(const char *name)
@@ -140,9 +146,10 @@ static int
ripped_bottom(WINDOW *win)
{
int result = 0;
- ripoff_t *rop;
if (win != 0) {
+ ripoff_t *rop;
+
#ifdef USE_SP_RIPOFF
SCREEN *sp = _nc_screen_of(win);
#endif
@@ -276,6 +283,7 @@ decrease_size(NCURSES_SP_DCLx int ToLines, int ToCols, int stolen EXTRA_DCLS)
WINDOWLIST *wp;
T((T_CALLED("decrease_size(%p, %d, %d)"), (void *) SP_PARM, ToLines, ToCols));
+ UNUSED_SP;
do {
found = FALSE;
@@ -310,6 +318,7 @@ increase_size(NCURSES_SP_DCLx int ToLines, int ToCols, int stolen EXTRA_DCLS)
WINDOWLIST *wp;
T((T_CALLED("increase_size(%p, %d, %d)"), (void *) SP_PARM, ToLines, ToCols));
+ UNUSED_SP;
do {
found = FALSE;
@@ -347,7 +356,7 @@ NCURSES_SP_NAME(resize_term) (NCURSES_SP_DCLx int ToLines, int ToCols)
(SP_PARM == 0) ? -1 : screen_lines(SP_PARM),
(SP_PARM == 0) ? -1 : screen_columns(SP_PARM)));
- if (SP_PARM == 0) {
+ if (SP_PARM == 0 || ToLines <= 0 || ToCols <= 0) {
returnCode(ERR);
}
@@ -397,7 +406,7 @@ NCURSES_SP_NAME(resize_term) (NCURSES_SP_DCLx int ToLines, int ToCols)
screen_columns(SP_PARM) = (NCURSES_SIZE_T) ToCols;
#ifdef USE_TERM_DRIVER
- CallDriver_2(SP_PARM, setsize, ToLines, ToCols);
+ CallDriver_2(SP_PARM, td_setsize, ToLines, ToCols);
#else
lines = (NCURSES_SIZE_T) ToLines;
columns = (NCURSES_SIZE_T) ToCols;
@@ -440,7 +449,7 @@ NCURSES_SP_NAME(resize_term) (NCURSES_SP_DCLx int ToLines, int ToCols)
NCURSES_EXPORT(int)
resize_term(int ToLines, int ToCols)
{
- int res = ERR;
+ int res;
_nc_sp_lock_global(curses);
res = NCURSES_SP_NAME(resize_term) (CURRENT_SCREEN, ToLines, ToCols);
_nc_sp_unlock_global(curses);
@@ -466,7 +475,7 @@ NCURSES_SP_NAME(resizeterm) (NCURSES_SP_DCLx int ToLines, int ToCols)
(SP_PARM == 0) ? -1 : screen_lines(SP_PARM),
(SP_PARM == 0) ? -1 : screen_columns(SP_PARM)));
- if (SP_PARM != 0) {
+ if (SP_PARM != 0 && ToLines > 0 && ToCols > 0) {
result = OK;
SP_PARM->_sig_winch = FALSE;
diff --git a/ncurses/base/safe_sprintf.c b/ncurses/base/safe_sprintf.c
index 34abd2f8cf47..e41da4ac27d1 100644
--- a/ncurses/base/safe_sprintf.c
+++ b/ncurses/base/safe_sprintf.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -33,7 +33,7 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: safe_sprintf.c,v 1.27 2013/01/20 01:04:32 tom Exp $")
+MODULE_ID("$Id: safe_sprintf.c,v 1.32 2018/12/15 22:26:38 tom Exp $")
#if USE_SAFE_SPRINTF
@@ -41,7 +41,7 @@ typedef enum {
Flags, Width, Prec, Type, Format
} PRINTF;
-#define VA_INTGR(type) ival = va_arg(ap, type)
+#define VA_INTGR(type) ival = (int) va_arg(ap, type)
#define VA_FLOAT(type) fval = va_arg(ap, type)
#define VA_POINT(type) pval = (void *)va_arg(ap, type)
@@ -157,9 +157,9 @@ _nc_printf_length(const char *fmt, va_list ap)
case 's':
VA_POINT(char *);
if (prec < 0)
- prec = strlen(pval);
+ prec = (int) strlen(pval);
if (prec > (int) length) {
- length = length + prec;
+ length = length + (size_t) prec;
buffer = typeRealloc(char, length, buffer);
if (buffer == 0) {
free(format);
@@ -224,7 +224,7 @@ NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_DCLx
{
char *result = 0;
- if (fmt != 0) {
+ if (SP_PARM != 0 && fmt != 0) {
#if USE_SAFE_SPRINTF
va_list ap2;
int len;
@@ -234,7 +234,7 @@ NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_DCLx
end_va_copy(ap2);
if ((int) my_length < len + 1) {
- my_length = 2 * (len + 1);
+ my_length = (size_t) (2 * (len + 1));
my_buffer = typeRealloc(char, my_length, my_buffer);
}
if (my_buffer != 0) {
@@ -259,9 +259,9 @@ NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_DCLx
if (my_buffer != 0) {
# if HAVE_VSNPRINTF
- vsnprintf(my_buffer, my_length, fmt, ap); /* GNU extension */
+ vsnprintf(my_buffer, my_length, fmt, ap); /* SUSv2, 1997 */
# else
- vsprintf(my_buffer, fmt, ap); /* ANSI */
+ vsprintf(my_buffer, fmt, ap); /* ISO/ANSI C, 1989 */
# endif
result = my_buffer;
}
diff --git a/ncurses/base/use_window.c b/ncurses/base/use_window.c
index 8eb733919848..c3a5b7237e61 100644
--- a/ncurses/base/use_window.c
+++ b/ncurses/base/use_window.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2007-2008,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 2007-2016,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -32,14 +32,19 @@
#include <curses.priv.h>
-MODULE_ID("$Id: use_window.c,v 1.9 2009/10/24 22:40:24 tom Exp $")
+MODULE_ID("$Id: use_window.c,v 1.12 2018/12/15 23:53:20 tom Exp $")
NCURSES_EXPORT(int)
use_window(WINDOW *win, NCURSES_WINDOW_CB func, void *data)
{
int code = OK;
+ TR_FUNC_BFR(1);
+
+ T((T_CALLED("use_window(%p,%s,%p)"),
+ (void *) win,
+ TR_FUNC_ARG(0, func),
+ data));
- T((T_CALLED("use_window(%p,%p,%p)"), (void *) win, func, data));
_nc_lock_global(curses);
code = func(win, data);
_nc_unlock_global(curses);
diff --git a/ncurses/base/wresize.c b/ncurses/base/wresize.c
index bc6b5732ea41..ee0594034d37 100644
--- a/ncurses/base/wresize.c
+++ b/ncurses/base/wresize.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2011,2019 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 *
@@ -33,13 +33,13 @@
#include <curses.priv.h>
-MODULE_ID("$Id: wresize.c,v 1.35 2011/05/21 18:55:07 tom Exp $")
+MODULE_ID("$Id: wresize.c,v 1.38 2019/05/11 20:15:15 tom Exp $")
static int
cleanup_lines(struct ldat *data, int length)
{
while (--length >= 0)
- free(data[length].text);
+ FreeAndNull(data[length].text);
free(data);
return ERR;
}
@@ -65,15 +65,29 @@ repair_subwindows(WINDOW *cmp)
if (tst->_parent == cmp) {
- if (tst->_pary > cmp->_maxy)
- tst->_pary = cmp->_maxy;
- if (tst->_parx > cmp->_maxx)
- tst->_parx = cmp->_maxx;
+#define REPAIR1(field, limit) \
+ if (tst->field > cmp->limit) \
+ tst->field = cmp->limit
- if (tst->_maxy + tst->_pary > cmp->_maxy)
- tst->_maxy = (NCURSES_SIZE_T) (cmp->_maxy - tst->_pary);
- if (tst->_maxx + tst->_parx > cmp->_maxx)
- tst->_maxx = (NCURSES_SIZE_T) (cmp->_maxx - tst->_parx);
+ REPAIR1(_pary, _maxy);
+ REPAIR1(_parx, _maxx);
+
+#define REPAIR2(field, limit) \
+ if (tst->limit + tst->field > cmp->limit) \
+ tst->limit = (NCURSES_SIZE_T) (cmp->limit - tst->field)
+
+ REPAIR2(_pary, _maxy);
+ REPAIR2(_parx, _maxx);
+
+#define REPAIR3(field, limit) \
+ if (tst->field > tst->limit) \
+ tst->field = tst->limit
+
+ REPAIR3(_cury, _maxy);
+ REPAIR3(_curx, _maxx);
+
+ REPAIR3(_regtop, _maxy);
+ REPAIR3(_regbottom, _maxy);
for (row = 0; row <= tst->_maxy; ++row) {
tst->_line[row].text = &pline[tst->_pary + row].text[tst->_parx];
@@ -204,16 +218,16 @@ wresize(WINDOW *win, int ToLines, int ToCols)
if (!(win->_flags & _SUBWIN)) {
if (ToCols == size_x) {
for (row = ToLines + 1; row <= size_y; row++) {
- free(win->_line[row].text);
+ FreeAndNull(win->_line[row].text);
}
} else {
for (row = 0; row <= size_y; row++) {
- free(win->_line[row].text);
+ FreeAndNull(win->_line[row].text);
}
}
}
- free(win->_line);
+ FreeAndNull(win->_line);
win->_line = new_lines;
/*
diff --git a/ncurses/build.priv.h b/ncurses/build.priv.h
index 096a4431bc1e..b175faf781c7 100644
--- a/ncurses/build.priv.h
+++ b/ncurses/build.priv.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2010,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 2010-2019,2020 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 *
@@ -31,11 +31,11 @@
****************************************************************************/
/*
- * $Id: build.priv.h,v 1.9 2012/02/22 22:17:02 tom Exp $
+ * $Id: build.priv.h,v 1.11 2020/01/18 17:03:32 tom Exp $
*
* build.priv.h
*
- * This is a reduced version of curses.priv.h, for build-time utilties.
+ * This is a reduced version of curses.priv.h, for build-time utilities.
* Because it has fewer dependencies, this simplifies cross-compiling.
*
*/
@@ -54,7 +54,7 @@ extern "C" {
#if USE_RCS_IDS
#define MODULE_ID(id) static const char Ident[] = id;
#else
-#define MODULE_ID(id) /*nothing*/
+#define MODULE_ID(id) /*nothing */
#endif
#include <stdlib.h>
@@ -66,7 +66,7 @@ extern "C" {
#include <errno.h>
-#include <curses.h> /* we'll use -Ipath directive to get the right one! */
+#include <curses.h> /* we'll use -Ipath directive to get the right one! */
/* usually in <unistd.h> */
#ifndef EXIT_SUCCESS
@@ -77,7 +77,7 @@ extern "C" {
#define EXIT_FAILURE 1
#endif
-#define FreeAndNull(p) free(p); p = 0
+#define FreeAndNull(p) do { free(p); p = 0; } while (0)
#define UChar(c) ((unsigned char)(c))
#define SIZEOF(v) (sizeof(v) / sizeof(v[0]))
@@ -89,20 +89,19 @@ extern "C" {
#define NCURSES_ARRAY(name) \
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, name)
-NCURSES_ARRAY(boolnames);
-NCURSES_ARRAY(boolfnames);
-NCURSES_ARRAY(numnames);
-NCURSES_ARRAY(numfnames);
-NCURSES_ARRAY(strnames);
-NCURSES_ARRAY(strfnames);
+ NCURSES_ARRAY(boolnames);
+ NCURSES_ARRAY(boolfnames);
+ NCURSES_ARRAY(numnames);
+ NCURSES_ARRAY(numfnames);
+ NCURSES_ARRAY(strnames);
+ NCURSES_ARRAY(strfnames);
#endif
#if NO_LEAKS
-NCURSES_EXPORT(void) _nc_names_leaks(void);
+ NCURSES_EXPORT(void) _nc_names_leaks(void);
#endif
#ifdef __cplusplus
}
#endif
-
-#endif /* CURSES_PRIV_H */
+#endif /* CURSES_PRIV_H */
diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h
index 7deffad5ea68..2c0ef2122790 100644
--- a/ncurses/curses.priv.h
+++ b/ncurses/curses.priv.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 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 *
@@ -34,7 +34,7 @@
****************************************************************************/
/*
- * $Id: curses.priv.h,v 1.530 2014/02/01 22:09:27 tom Exp $
+ * $Id: curses.priv.h,v 1.627 2019/12/14 22:36:12 tom Exp $
*
* curses.priv.h
*
@@ -71,7 +71,7 @@ extern "C" {
#include <unistd.h>
#endif
-#if HAVE_SYS_BSDTYPES_H
+#if HAVE_SYS_BSDTYPES_H && !(defined(_WIN32) || defined(_WIN64))
#include <sys/bsdtypes.h> /* needed for ISC */
#endif
@@ -180,6 +180,18 @@ extern int errno;
#endif
/*
+ * When building in the MSYS2 environment, the automatic discovery of
+ * the path separator in configure doesn't work properly. So, if building
+ * for MinGW, we enforce the correct Windows PATH separator
+ */
+#ifdef _WIN32
+# ifdef NCURSES_PATHSEP
+# undef NCURSES_PATHSEP
+# endif
+# define NCURSES_PATHSEP ';'
+#endif
+
+/*
* If desired, one can configure this, disabling environment variables that
* point to custom terminfo/termcap locations.
*/
@@ -228,6 +240,18 @@ extern NCURSES_EXPORT(void *) _nc_memmove (void *, const void *, size_t);
#endif
/*
+ * POSIX ignores the "b", which c89 specified. Some very old systems do not
+ * accept it.
+ */
+#if USE_FOPEN_BIN_R
+#define BIN_R "rb"
+#define BIN_W "wb"
+#else
+#define BIN_R "r"
+#define BIN_W "w"
+#endif
+
+/*
* Scroll hints are useless when hashmap is used
*/
#if !USE_SCROLL_HINTS
@@ -302,7 +326,7 @@ typedef TRIES {
#undef _XOPEN_SOURCE_EXTENDED
#undef _XPG5
#define _nc_bkgd _bkgd
-#define wgetbkgrnd(win, wch) *wch = win->_bkgd
+#define wgetbkgrnd(win, wch) ((*wch = win->_bkgd) != 0 ? OK : ERR)
#define wbkgrnd wbkgd
#endif
@@ -314,12 +338,21 @@ typedef TRIES {
typedef struct
{
- NCURSES_COLOR_T red, green, blue; /* what color_content() returns */
- NCURSES_COLOR_T r, g, b; /* params to init_color() */
+ int red, green, blue; /* what color_content() returns */
+ int r, g, b; /* params to init_color() */
int init; /* true if we called init_color() */
}
color_t;
+typedef union {
+ struct {
+ unsigned char red;
+ unsigned char green;
+ unsigned char blue;
+ } bits; /* bits per color-value in RGB */
+ unsigned value;
+} rgb_bits_t;
+
/*
* If curses.h did not expose the SCREEN-functions, then we do not need the
* parameter in the corresponding unextended functions.
@@ -346,6 +379,9 @@ color_t;
#include <nc_panel.h>
+#include <term.h>
+#include <nc_termios.h>
+
#define IsPreScreen(sp) (((sp) != 0) && sp->_prescreen)
#define HasTerminal(sp) (((sp) != 0) && (0 != ((sp)->_term)))
#define IsValidScreen(sp) (HasTerminal(sp) && !IsPreScreen(sp))
@@ -362,8 +398,31 @@ color_t;
#define TerminalOf(sp) CurTerm
#endif
-#include <term.h>
-#include <nc_termios.h>
+/*
+ * The legacy layout for TERMTYPE uses "short" for all of the numbers. Moving
+ * past that, numeric capabilities can be "int" by using a TERMTYPE2 structure
+ * in TERMINAL, and doing most of the internal work using TERMTYPE2. There are
+ * a few places (mostly to expose the legacy layout) where the distinction
+ * needs attention.
+ */
+#if NCURSES_EXT_COLORS && HAVE_INIT_EXTENDED_COLOR
+#define NCURSES_EXT_NUMBERS 1
+#define NCURSES_INT2 int
+#define SIZEOF_INT2 4
+#define TerminalType(tp) (tp)->type2
+#else
+#define NCURSES_EXT_NUMBERS 0
+#define NCURSES_INT2 short
+#define SIZEOF_INT2 2
+#define TerminalType(tp) (tp)->type
+#endif
+
+#define SIZEOF_SHORT 2
+
+#ifdef CUR
+#undef CUR
+#define CUR TerminalType(cur_term).
+#endif
/*
* Reduce dependency on cur_term global by using terminfo data from SCREEN's
@@ -373,7 +432,7 @@ color_t;
#undef CUR
#endif
-#define SP_TERMTYPE TerminalOf(sp)->type.
+#define SP_TERMTYPE TerminalType(TerminalOf(sp)).
#include <term_entry.h>
@@ -382,10 +441,11 @@ color_t;
/*
* Simplify ifdef's for the "*_ATTR" macros in case italics are not configured.
*/
-#ifdef A_ITALIC
+#if defined(A_ITALIC) && defined(exit_italics_mode)
#define USE_ITALIC 1
#else
#define USE_ITALIC 0
+#undef A_ITALIC
#define A_ITALIC 0
#endif
@@ -394,7 +454,7 @@ color_t;
* option for compiling the tracing into the library.
*/
#if 1
-#define ColorPair(n) NCURSES_BITS(n, 0)
+#define ColorPair(n) (NCURSES_BITS(n, 0) & A_COLOR)
#define PairNumber(a) (NCURSES_CAST(int,(((unsigned long)(a) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
#else
#define ColorPair(pair) COLOR_PAIR(pair)
@@ -414,7 +474,7 @@ color_t;
#define if_EXT_COLORS(stmt) stmt
#define SetPair(value,p) SetPair2((value).ext_color, AttrOf(value), p)
#define SetPair2(c,a,p) c = (p), \
- a = (unColor2(a) | (A_COLOR & (unsigned) ColorPair(oldColor(c))))
+ a = (unColor2(a) | ColorPair(oldColor(c)))
#define GetPair(value) GetPair2((value).ext_color, AttrOf(value))
#define GetPair2(c,a) ((c) ? (c) : PairNumber(a))
#define oldColor(p) (((p) > 255) ? 255 : (p))
@@ -422,20 +482,27 @@ color_t;
#define SET_WINDOW_PAIR(w,p) (w)->_color = (p)
#define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b) && GetPair(a) == GetPair(b))
-#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vid_puts)(NCURSES_SP_ARGx attr, (short) pair, 0, NCURSES_OUTC_FUNC)
+#define VIDPUTS(sp,attr,pair) do { \
+ int vid_pair = pair; \
+ NCURSES_SP_NAME(vid_puts)( \
+ NCURSES_SP_ARGx attr, \
+ (NCURSES_PAIRS_T) pair, \
+ &vid_pair, \
+ NCURSES_OUTC_FUNC); \
+ } while (0)
#else /* !NCURSES_EXT_COLORS */
#define if_EXT_COLORS(stmt) /* nothing */
#define SetPair(value,p) RemAttr(value, A_COLOR), \
- SetAttr(value, AttrOf(value) | (A_COLOR & (attr_t) ColorPair(p)))
+ SetAttr(value, AttrOf(value) | ColorPair(p))
#define GetPair(value) PairNumber(AttrOf(value))
#define GET_WINDOW_PAIR(w) PairNumber(WINDOW_ATTRS(w))
#define SET_WINDOW_PAIR(w,p) WINDOW_ATTRS(w) &= ALL_BUT_COLOR, \
- WINDOW_ATTRS(w) |= (A_COLOR & (attr_t) ColorPair(p))
+ WINDOW_ATTRS(w) |= ColorPair(p)
#define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b))
-#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vidputs)(NCURSES_SP_ARGx attr, NCURSES_OUTC_FUNC)
+#define VIDPUTS(sp,attr,pair) NCURSES_SP_NAME(vidputs)(NCURSES_SP_ARGx attr, NCURSES_OUTC_FUNC)
#endif /* NCURSES_EXT_COLORS */
@@ -491,6 +558,8 @@ NCURSES_EXPORT(int *) _nc_ptr_Escdelay (SCREEN *);
#endif
+#define HasHardTabs() (NonEmpty(clear_all_tabs) && NonEmpty(set_tab))
+
#define TR_MUTEX(data) _tracef("%s@%d: me:%08lX COUNT:%2u/%2d/%6d/%2d/%s%9u: " #data, \
__FILE__, __LINE__, \
(unsigned long) (pthread_self()), \
@@ -549,7 +618,10 @@ weak_symbol(pthread_mutexattr_settype);
weak_symbol(pthread_mutexattr_init);
extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *);
# undef sigprocmask
-# define sigprocmask _nc_sigprocmask
+# define sigprocmask(a, b, c) _nc_sigprocmask(a, b, c)
+# define GetThreadID() (((pthread_self)) ? pthread_self() : (pthread_t) getpid())
+# else
+# define GetThreadID() pthread_self()
# endif
#endif
@@ -569,7 +641,7 @@ weak_symbol(pthread_self);
weak_symbol(pthread_equal);
extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *);
# undef sigprocmask
-# define sigprocmask _nc_sigprocmask
+# define sigprocmask(a, b, c) _nc_sigprocmask(a, b, c)
# endif
#endif /* USE_PTHREADS_EINTR */
@@ -623,15 +695,13 @@ extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *);
/*
* Definitions for color pairs
*/
-typedef unsigned colorpair_t; /* type big enough to store PAIR_OF() */
-#define C_SHIFT 9 /* we need more bits than there are colors */
-#define C_MASK ((1 << C_SHIFT) - 1)
-#define PAIR_OF(fg, bg) (colorpair_t) ((((fg) & C_MASK) << C_SHIFT) | ((bg) & C_MASK))
-#define FORE_OF(c) (((c) >> C_SHIFT) & C_MASK)
-#define BACK_OF(c) ((c) & C_MASK)
-#define isDefaultColor(c) ((c) >= COLOR_DEFAULT || (c) < 0)
-#define COLOR_DEFAULT C_MASK
+#define MAX_OF_TYPE(t) (int)(((unsigned t)(~0))>>1)
+
+#include <new_pair.h>
+
+#define isDefaultColor(c) ((c) < 0)
+#define COLOR_DEFAULT -1
#if defined(USE_BUILD_CC) || (defined(USE_TERMLIB) && !defined(NEED_NCURSES_CH_T))
@@ -664,6 +734,14 @@ typedef enum {
#endif
} MouseType;
+typedef enum {
+ MF_X10 = 0 /* conventional 3-byte format */
+ , MF_SGR1006 /* xterm private mode 1006, SGR-style */
+#ifdef EXP_XTERM_1005
+ , MF_XTERM_1005 /* xterm UTF-8 private mode 1005 */
+#endif
+} MouseFormat;
+
/*
* Structures for scrolling.
*/
@@ -748,6 +826,16 @@ typedef struct {
#define TGETENT_MAX 4
/*
+ * When converting from terminfo to termcap, check for cases where we can trim
+ * octal escapes down to 2-character form. It is useful for terminfo format
+ * also, but not as important.
+ */
+#define MAX_TC_FIXUPS 10
+#define MIN_TC_FIXUPS 4
+
+#define isoctal(c) ((c) >= '0' && (c) <= '7')
+
+/*
* State of tparm().
*/
#define STACKSIZE 20
@@ -763,9 +851,6 @@ typedef struct {
#define NUM_VARS 26
typedef struct {
-#ifdef TRACE
- const char *tname;
-#endif
const char *tparam_base;
STACK_FRAME stack[STACKSIZE];
@@ -780,6 +865,9 @@ typedef struct {
int dynamic_var[NUM_VARS];
int static_vars[NUM_VARS];
+#ifdef TRACE
+ const char *tname;
+#endif
} TPARM_STATE;
typedef struct {
@@ -849,6 +937,8 @@ typedef struct {
int slk_format;
+ int getstr_limit; /* getstr_limit based on POSIX LINE_MAX */
+
char *safeprint_buf;
size_t safeprint_used;
@@ -862,6 +952,10 @@ typedef struct {
time_t dbd_time; /* cache last updated */
ITERATOR_VARS dbd_vars[dbdLAST];
+#ifdef USE_TERM_DRIVER
+ int (*term_driver)(struct DriverTCB*, const char*, int*);
+#endif
+
#ifndef USE_SP_WINDOWLIST
WINDOWLIST *_nc_windowlist;
#define WindowList(sp) _nc_globals._nc_windowlist
@@ -876,15 +970,30 @@ typedef struct {
int safeprint_rows;
#endif
-#ifdef USE_TERM_DRIVER
- int (*term_driver)(struct DriverTCB*, const char*, int*);
+#ifdef USE_PTHREADS
+ pthread_mutex_t mutex_curses;
+ pthread_mutex_t mutex_prescreen;
+ pthread_mutex_t mutex_screen;
+ pthread_mutex_t mutex_update;
+ pthread_mutex_t mutex_tst_tracef;
+ pthread_mutex_t mutex_tracef;
+ int nested_tracef;
+ int use_pthreads;
+#define _nc_use_pthreads _nc_globals.use_pthreads
+#if USE_PTHREADS_EINTR
+ pthread_t read_thread; /* The reading thread */
+#endif
+#endif
+#if USE_WIDEC_SUPPORT
+ char key_name[MB_LEN_MAX + 1];
#endif
#ifdef TRACE
- bool init_trace;
+ bool trace_opened;
char trace_fname[PATH_MAX];
int trace_level;
FILE *trace_fp;
+ int trace_fd;
char *tracearg_buf;
size_t tracearg_used;
@@ -908,16 +1017,8 @@ typedef struct {
#endif
#endif /* TRACE */
-#ifdef USE_PTHREADS
- pthread_mutex_t mutex_curses;
- pthread_mutex_t mutex_tst_tracef;
- pthread_mutex_t mutex_tracef;
- int nested_tracef;
- int use_pthreads;
-#define _nc_use_pthreads _nc_globals.use_pthreads
-#endif
-#if USE_PTHREADS_EINTR
- pthread_t read_thread; /* The reading thread */
+#if NO_LEAKS
+ bool leak_checking;
#endif
} NCURSES_GLOBALS;
@@ -925,24 +1026,47 @@ extern NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals;
#define N_RIPS 5
+/* The limit reserves one byte for a terminating NUL */
+#define my_getstr_limit (_nc_globals.getstr_limit - 1)
+#define _nc_getstr_limit(n) \
+ (((n) < 0) \
+ ? my_getstr_limit \
+ : (((n) > my_getstr_limit) \
+ ? my_getstr_limit \
+ : (n)))
+
+#ifdef USE_PTHREADS
+typedef struct _prescreen_list {
+ struct _prescreen_list *next;
+ pthread_t id;
+ struct screen *sp;
+} PRESCREEN_LIST;
+#endif
+
/*
* Global data which can be swept up into a SCREEN when one is created.
* It may be modified before the next SCREEN is created.
*/
typedef struct {
+#ifdef USE_PTHREADS
+ PRESCREEN_LIST *allocated;
+#else
+ struct screen * allocated;
+#endif
bool use_env;
bool filter_mode;
attr_t previous_attr;
+ TPARM_STATE tparm_state;
+ TTY *saved_tty; /* savetty/resetty information */
+ bool use_tioctl;
+ NCURSES_SP_OUTC _outch; /* output handler if not putc */
#ifndef USE_SP_RIPOFF
ripoff_t rippedoff[N_RIPS];
ripoff_t *rsp;
#endif
- TPARM_STATE tparm_state;
- TTY *saved_tty; /* savetty/resetty information */
#if NCURSES_NO_PADDING
bool _no_padding; /* flag to set if padding disabled */
#endif
- NCURSES_SP_OUTC _outch; /* output handler if not putc */
#if BROKEN_LINKER || USE_REENTRANT
chtype *real_acs_map;
int _LINES;
@@ -950,12 +1074,13 @@ typedef struct {
int _TABSIZE;
int _ESCDELAY;
TERMINAL *_cur_term;
+#endif
#ifdef TRACE
+#if BROKEN_LINKER || USE_REENTRANT
long _outchars;
const char *_tputs_trace;
#endif
#endif
- bool use_tioctl;
} NCURSES_PRESCREEN;
/*
@@ -971,6 +1096,12 @@ typedef struct {
extern NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen;
+typedef enum {
+ ewInitial = 0,
+ ewRunning,
+ ewSuspend
+} ENDWIN;
+
/*
* The SCREEN structure.
*/
@@ -1031,18 +1162,11 @@ struct screen {
struct _SLK *_slk; /* ptr to soft key struct / NULL */
int slk_format; /* selected format for this screen */
/* cursor movement costs; units are 10ths of milliseconds */
-#if NCURSES_NO_PADDING
- bool _no_padding; /* flag to set if padding disabled */
-#endif
int _char_padding; /* cost of character put */
int _cr_cost; /* cost of (carriage_return) */
int _cup_cost; /* cost of (cursor_address) */
int _home_cost; /* cost of (cursor_home) */
int _ll_cost; /* cost of (cursor_to_ll) */
-#if USE_HARD_TABS
- int _ht_cost; /* cost of (tab) */
- int _cbt_cost; /* cost of (backtab) */
-#endif /* USE_HARD_TABS */
int _cub1_cost; /* cost of (cursor_left) */
int _cuf1_cost; /* cost of (cursor_right) */
int _cud1_cost; /* cost of (cursor_down) */
@@ -1076,19 +1200,13 @@ struct screen {
int _scrolling; /* 1 if terminal's smart enough to */
/* used in lib_color.c */
+ rgb_bits_t _direct_color; /* RGB overrides color-table */
color_t *_color_table; /* screen's color palette */
int _color_count; /* count of colors in palette */
colorpair_t *_color_pairs; /* screen's color pair list */
- int _pair_count; /* count of color pairs */
+ int _pair_count; /* same as COLOR_PAIRS */
int _pair_limit; /* actual limit of color-pairs */
-#if NCURSES_EXT_FUNCS
- bool _assumed_color; /* use assumed colors */
- bool _default_color; /* use default colors */
- bool _has_sgr_39_49; /* has ECMA default color support */
- int _default_fg; /* assumed default foreground */
- int _default_bg; /* assumed default background */
- int _default_pairs; /* count pairs using default color */
-#endif
+ int _pair_alloc; /* current table-size of color-pairs */
chtype _ok_attributes; /* valid attributes for terminal */
chtype _xmc_suppress; /* attributes to suppress if xmc */
chtype _xmc_triggers; /* attributes to process if xmc */
@@ -1099,13 +1217,6 @@ struct screen {
/* used in lib_vidattr.c */
bool _use_rmso; /* true if we may use 'rmso' */
bool _use_rmul; /* true if we may use 'rmul' */
-#if USE_ITALIC
- bool _use_ritm; /* true if we may use 'ritm' */
-#endif
-
-#if USE_KLIBC_KBD
- bool _extended_key; /* true if an extended key */
-#endif
/*
* These data correspond to the state of the idcok() and idlok()
@@ -1133,10 +1244,65 @@ struct screen {
mmask_t _mouse_mask; /* set via mousemask() */
mmask_t _mouse_mask2; /* OR's in press/release bits */
mmask_t _mouse_bstate;
+ MouseFormat _mouse_format; /* type of xterm mouse protocol */
NCURSES_CONST char *_mouse_xtermcap; /* string to enable/disable mouse */
MEVENT _mouse_events[EV_MAX]; /* hold the last mouse event seen */
MEVENT *_mouse_eventp; /* next free slot in event queue */
+ /*
+ * These are data that support the proper handling of the panel stack on an
+ * per screen basis.
+ */
+ struct panelhook _panelHook;
+
+ bool _sig_winch;
+ SCREEN *_next_screen;
+
+ /* hashes for old and new lines */
+ unsigned long *oldhash, *newhash;
+ HASHMAP *hashtab;
+ int hashtab_len;
+ int *_oldnum_list;
+ int _oldnum_size;
+
+ NCURSES_SP_OUTC _outch; /* output handler if not putc */
+ NCURSES_OUTC jump;
+
+ ripoff_t rippedoff[N_RIPS];
+ ripoff_t *rsp;
+
+ int _legacy_coding; /* see use_legacy_coding() */
+
+#if NCURSES_NO_PADDING
+ bool _no_padding; /* flag to set if padding disabled */
+#endif
+
+#if USE_HARD_TABS
+ int _ht_cost; /* cost of (tab) */
+ int _cbt_cost; /* cost of (backtab) */
+#endif /* USE_HARD_TABS */
+
+ /* used in lib_vidattr.c */
+#if USE_ITALIC
+ bool _use_ritm; /* true if we may use 'ritm' */
+#endif
+
+ /* used in getch/twait */
+#if USE_KLIBC_KBD
+ bool _extended_key; /* true if an extended key */
+#endif
+
+ /* used in lib_color.c */
+#if NCURSES_EXT_FUNCS
+ bool _assumed_color; /* use assumed colors */
+ bool _default_color; /* use default colors */
+ bool _has_sgr_39_49; /* has ECMA default color support */
+ int _default_fg; /* assumed default foreground */
+ int _default_bg; /* assumed default background */
+ int _default_pairs; /* count pairs using default color */
+#endif
+
+ /* system-dependent mouse data */
#if USE_GPM_SUPPORT
bool _mouse_gpm_loaded;
bool _mouse_gpm_found;
@@ -1182,25 +1348,10 @@ struct screen {
int (*_ungetch)(SCREEN *, int);
#endif
- /*
- * These are data that support the proper handling of the panel stack on an
- * per screen basis.
- */
- struct panelhook _panelHook;
-
- bool _sig_winch;
- SCREEN *_next_screen;
-
- /* hashes for old and new lines */
- unsigned long *oldhash, *newhash;
- HASHMAP *hashtab;
- int hashtab_len;
- int *_oldnum_list;
- int _oldnum_size;
-
- NCURSES_SP_OUTC _outch; /* output handler if not putc */
-
- int _legacy_coding; /* see use_legacy_coding() */
+#ifdef USE_SP_WINDOWLIST
+ WINDOWLIST* _windowlist;
+#define WindowList(sp) (sp)->_windowlist
+#endif
#if USE_REENTRANT
char _ttytype[NAMESIZE];
@@ -1208,24 +1359,11 @@ struct screen {
int _TABSIZE;
int _LINES;
int _COLS;
-#ifdef TRACE
- long _outchars;
- const char *_tputs_trace;
-#endif
#endif
-#ifdef TRACE
- char tracechr_buf[40];
- char tracemse_buf[TRACEMSE_MAX];
-#endif
-#ifdef USE_SP_WINDOWLIST
- WINDOWLIST* _windowlist;
-#define WindowList(sp) (sp)->_windowlist
+#if NCURSES_SP_FUNCS
+ bool use_tioctl;
#endif
- NCURSES_OUTC jump;
-
- ripoff_t rippedoff[N_RIPS];
- ripoff_t *rsp;
/*
* ncurses/ncursesw are the same up to this point.
@@ -1238,7 +1376,20 @@ struct screen {
bool _screen_unicode;
#endif
- bool _use_tioctl;
+#if NCURSES_EXT_FUNCS && NCURSES_EXT_COLORS
+ void *_ordered_pairs; /* index used by alloc_pair() */
+ int _pairs_used; /* actual number of color-pairs used */
+ int _recent_pair; /* number for most recent free-pair */
+#endif
+
+#ifdef TRACE
+ char tracechr_buf[40];
+ char tracemse_buf[TRACEMSE_MAX];
+#if USE_REENTRANT
+ long _outchars;
+ const char *_tputs_trace;
+#endif
+#endif
};
extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain;
@@ -1258,6 +1409,12 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#define WINDOW_EXT(w,m) (((WINDOWLIST *)((void *)((char *)(w) - offsetof(WINDOWLIST, win))))->m)
+#ifdef USE_SP_WINDOWLIST
+#define SP_INIT_WINDOWLIST(sp) WindowList(sp) = 0
+#else
+#define SP_INIT_WINDOWLIST(sp) /* nothing */
+#endif
+
#define SP_PRE_INIT(sp) \
sp->_cursrow = -1; \
sp->_curscol = -1; \
@@ -1266,9 +1423,9 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
sp->_cbreak = 0; \
sp->_echo = TRUE; \
sp->_fifohead = -1; \
- sp->_endwin = TRUE; \
+ sp->_endwin = ewSuspend; \
sp->_cursor = -1; \
- WindowList(sp) = 0; \
+ SP_INIT_WINDOWLIST(sp); \
sp->_outch = NCURSES_OUTC_FUNC; \
sp->jump = 0 \
@@ -1350,6 +1507,8 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#define ChCharOf(c) ((chtype)(c) & (chtype)A_CHARTEXT)
#define ChAttrOf(c) ((chtype)(c) & (chtype)A_ATTRIBUTES)
+#define TR_PUTC(c) TR(TRACE_CHARPUT, ("PUTC %#x", UChar(c)))
+
#ifndef MB_LEN_MAX
#define MB_LEN_MAX 8 /* should be >= MB_CUR_MAX, but that may be a function */
#endif
@@ -1384,6 +1543,8 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
&& (a).chars[3] == (b).chars[3] \
&& (a).chars[4] == (b).chars[4] \
if_EXT_COLORS(&& (a).ext_color == (b).ext_color))
+#elif CCHARW_MAX > 0
+#error Inconsistent values for CCHARW_MAX
#else
#define CharEq(a,b) (!memcmp(&(a), &(b), sizeof(a)))
#endif
@@ -1404,23 +1565,27 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#define PUTC_INIT init_mb (PUT_st)
#define PUTC(ch) do { if(!isWidecExt(ch)) { \
if (Charable(ch)) { \
- NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \
+ TR_PUTC(CharOf(ch)); \
+ NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \
COUNT_OUTCHARS(1); \
} else { \
- PUTC_INIT; \
for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) { \
PUTC_ch = (ch).chars[PUTC_i]; \
if (PUTC_ch == L'\0') \
break; \
+ PUTC_INIT; \
PUTC_n = (int) wcrtomb(PUTC_buf, \
(ch).chars[PUTC_i], &PUT_st); \
if (PUTC_n <= 0) { \
- if (PUTC_ch && is8bits(PUTC_ch) && PUTC_i == 0) \
+ if (PUTC_ch && is8bits(PUTC_ch) && PUTC_i == 0) { \
+ TR_PUTC(CharOf(ch)); \
NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \
+ } \
break; \
} else { \
int PUTC_j; \
for (PUTC_j = 0; PUTC_j < PUTC_n; ++PUTC_j) { \
+ TR_PUTC(PUTC_buf[PUTC_j]); \
NCURSES_OUTC_FUNC (NCURSES_SP_ARGx PUTC_buf[PUTC_j]); \
} \
} \
@@ -1446,11 +1611,11 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
AttrOf(dst) |= (attr_t) (ext + 1)
#define if_WIDEC(code) code
-#define Charable(ch) ((SP_PARM->_legacy_coding) \
+#define Charable(ch) (((SP_PARM->_legacy_coding) \
|| (AttrOf(ch) & A_ALTCHARSET) \
- || (!isWidecExt(ch) && \
+ || (!isWidecExt(ch))) && \
(ch).chars[1] == L'\0' && \
- _nc_is_charable(CharOf(ch))))
+ _nc_is_charable(CharOf(ch)))
#define L(ch) L ## ch
#else /* }{ */
@@ -1468,7 +1633,10 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#define ARG_CH_T NCURSES_CH_T
#define CARG_CH_T NCURSES_CH_T
#define PUTC_DATA /* nothing */
-#define PUTC(ch) NCURSES_OUTC_FUNC (NCURSES_SP_ARGx (int) ch)
+#define PUTC(ch) { \
+ TR_PUTC(ch); \
+ NCURSES_OUTC_FUNC (NCURSES_SP_ARGx (int) ch); \
+ }
#define BLANK (' '|A_NORMAL)
#define ZEROS ('\0'|A_NORMAL)
@@ -1477,6 +1645,7 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#define isWidecExt(ch) (0)
#define if_WIDEC(code) /* nothing */
+#define Charable(ch) ((ch) >= ' ' && (ch) <= '~')
#define L(ch) ch
#endif /* } */
@@ -1523,7 +1692,7 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
/* FreeAndNull() is not a comma-separated expression because some compilers
* do not accept a mixture of void with values.
*/
-#define FreeAndNull(p) free(p); p = 0
+#define FreeAndNull(p) do { free(p); p = 0; } while (0)
#include <nc_alloc.h>
@@ -1532,14 +1701,18 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
* tries to limp along after a failure.
*/
#define TYPE_MALLOC(type, size, name) \
- name = typeMalloc(type, size); \
- if (name == 0) \
- _nc_err_abort(MSG_NO_MEMORY)
+ do { \
+ name = typeMalloc(type, size); \
+ if (name == 0) \
+ _nc_err_abort(MSG_NO_MEMORY); \
+ } while (0)
#define TYPE_REALLOC(type, size, name) \
- name = typeRealloc(type, size, name); \
- if (name == 0) \
- _nc_err_abort(MSG_NO_MEMORY)
+ do { \
+ name = typeRealloc(type, size, name); \
+ if (name == 0) \
+ _nc_err_abort(MSG_NO_MEMORY); \
+ } while (0)
/*
* TTY bit definition for converting tabs to spaces.
@@ -1558,6 +1731,14 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
# endif
#endif
+#ifdef __TANDEM
+#define ROOT_UID 65535
+#endif
+
+#ifndef ROOT_UID
+#define ROOT_UID 0
+#endif
+
/*
* Standardize/simplify common loops
*/
@@ -1574,6 +1755,9 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#define T_CREATE(fmt) "create :" fmt
#define T_RETURN(fmt) "return }" fmt
+#define NonNull(s) ((s) != 0 ? s : "<null>")
+#define NonEmpty(s) ((s) != 0 && *(s) != '\0')
+
#ifdef TRACE
#if USE_REENTRANT
@@ -1582,12 +1766,16 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#define TPUTS_TRACE(s) _nc_tputs_trace = s;
#endif
+#ifdef HAVE_CONSISTENT_GETENV
#define START_TRACE() \
if ((_nc_tracing & TRACE_MAXIMUM) == 0) { \
int t = _nc_getenv_num("NCURSES_TRACE"); \
if (t >= 0) \
- trace((unsigned) t); \
+ curses_trace((unsigned) t); \
}
+#else
+#define START_TRACE() /* nothing */
+#endif
/*
* Many of the _tracef() calls use static buffers; lock the trace state before
@@ -1604,27 +1792,34 @@ extern NCURSES_EXPORT(void) _nc_locked_tracef (const char *, ...) GCC_PRINTFLIKE
#define TR(n, a) if (USE_TRACEF(n)) _nc_locked_tracef a
#define T(a) TR(TRACE_CALLS, a)
-#define TRACE_RETURN(value,type) return _nc_retrace_##type(value)
+#define TRACE_RETURN(value,type) return _nc_retrace_##type((type)(value))
+#define TRACE_RETURN1(value,dst) return _nc_retrace_##dst(value)
#define TRACE_RETURN2(value,dst,src) return _nc_retrace_##dst##_##src(value)
#define TRACE_RETURN_SP(value,type) return _nc_retrace_##type(SP_PARM, value)
-#define NonNull(s) ((s) != 0 ? s : "<null>")
+typedef void VoidFunc(void);
+
+#define TR_FUNC_LEN ((sizeof(void *) + sizeof(void (*)(void))) * 2 + 4)
+#define TR_FUNC_BFR(max) char tr_func_data[max][TR_FUNC_LEN]
+#define TR_FUNC_ARG(num,func) _nc_fmt_funcptr(&tr_func_data[num][0], (const char *)&(func), sizeof((func)))
#define returnAttr(code) TRACE_RETURN(code,attr_t)
#define returnBits(code) TRACE_RETURN(code,unsigned)
#define returnBool(code) TRACE_RETURN(code,bool)
-#define returnCPtr(code) TRACE_RETURN(code,cptr)
-#define returnCVoidPtr(code) TRACE_RETURN(code,cvoid_ptr)
+#define returnCPtr(code) TRACE_RETURN1(code,cptr)
+#define returnCVoidPtr(code) TRACE_RETURN1(code,cvoid_ptr)
#define returnChar(code) TRACE_RETURN(code,char)
#define returnChtype(code) TRACE_RETURN(code,chtype)
#define returnCode(code) TRACE_RETURN(code,int)
#define returnIntAttr(code) TRACE_RETURN2(code,int,attr_t)
#define returnMMask(code) TRACE_RETURN_SP(code,mmask_t)
-#define returnPtr(code) TRACE_RETURN(code,ptr)
-#define returnSP(code) TRACE_RETURN(code,sp)
+#define returnPtr(code) TRACE_RETURN1(code,ptr)
+#define returnSP(code) TRACE_RETURN1(code,sp)
#define returnVoid T((T_RETURN(""))); return
-#define returnVoidPtr(code) TRACE_RETURN(code,void_ptr)
-#define returnWin(code) TRACE_RETURN(code,win)
+#define returnVoidPtr(code) TRACE_RETURN1(code,void_ptr)
+#define returnWin(code) TRACE_RETURN1(code,win)
+
+#define returnDB(rc) do { TR(TRACE_DATABASE,(T_RETURN("code %d"), (rc))); return (rc); } while (0)
extern NCURSES_EXPORT(NCURSES_BOOL) _nc_retrace_bool (int);
extern NCURSES_EXPORT(NCURSES_CONST void *) _nc_retrace_cvoid_ptr (NCURSES_CONST void *);
@@ -1645,6 +1840,8 @@ extern NCURSES_EXPORT(unsigned) _nc_retrace_unsigned (unsigned);
extern NCURSES_EXPORT(void *) _nc_retrace_void_ptr (void *);
extern NCURSES_EXPORT(void) _nc_fifo_dump (SCREEN *);
+extern NCURSES_EXPORT(char *) _nc_fmt_funcptr(char *, const char *, size_t);
+
#if USE_REENTRANT
NCURSES_WRAPPED_VAR(long, _nc_outchars);
NCURSES_WRAPPED_VAR(const char *, _nc_tputs_trace);
@@ -1659,6 +1856,10 @@ extern NCURSES_EXPORT_VAR(long) _nc_outchars;
extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing;
+extern NCURSES_EXPORT(char *) _nc_tracebits (void);
+extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *);
+extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *);
+
#if USE_WIDEC_SUPPORT
extern NCURSES_EXPORT(const char *) _nc_viswbuf2 (int, const wchar_t *);
extern NCURSES_EXPORT(const char *) _nc_viswbufn (const wchar_t *, int);
@@ -1674,6 +1875,7 @@ extern NCURSES_EXPORT(const char *) _nc_viscbuf (const NCURSES_CH_T *, int);
#define T(a)
#define TR(n, a)
#define TPUTS_TRACE(s)
+#define TR_FUNC_BFR(max)
#define returnAttr(code) return code
#define returnBits(code) return code
@@ -1691,6 +1893,8 @@ extern NCURSES_EXPORT(const char *) _nc_viscbuf (const NCURSES_CH_T *, int);
#define returnVoidPtr(code) return code
#define returnWin(code) return code
+#define returnDB(code) return code
+
#endif /* TRACE/!TRACE */
/*
@@ -1758,7 +1962,7 @@ extern NCURSES_EXPORT(void) name (void); \
#if USE_XMC_SUPPORT
#define UpdateAttrs(sp,c) if (!SameAttrOf(SCREEN_ATTRS(sp), c)) { \
attr_t chg = AttrOf(SCREEN_ATTRS(sp)); \
- VIDATTR(sp, AttrOf(c), GetPair(c)); \
+ VIDPUTS(sp, AttrOf(c), GetPair(c)); \
if (magic_cookie_glitch > 0 \
&& XMC_CHANGES((chg ^ AttrOf(SCREEN_ATTRS(sp))))) { \
T(("%s @%d before glitch %d,%d", \
@@ -1770,7 +1974,7 @@ extern NCURSES_EXPORT(void) name (void); \
}
#else
#define UpdateAttrs(sp,c) if (!SameAttrOf(SCREEN_ATTRS(sp), c)) { \
- VIDATTR(sp, AttrOf(c), GetPair(c)); \
+ VIDPUTS(sp, AttrOf(c), GetPair(c)); \
}
#endif
@@ -1837,6 +2041,20 @@ extern NCURSES_EXPORT(void) _nc_expanded (void);
#define getcwd(buf,len) getwd(buf)
#endif
+#define save_ttytype(termp) \
+ if (TerminalType(termp).term_names != 0) { \
+ _nc_STRNCPY(ttytype, \
+ TerminalType(termp).term_names, \
+ NAMESIZE - 1); \
+ ttytype[NAMESIZE - 1] = '\0'; \
+ }
+
+#if !NCURSES_WCWIDTH_GRAPHICS
+extern NCURSES_EXPORT(int) _nc_wacs_width(unsigned);
+#else
+#define _nc_wacs_width(ch) wcwidth(ch)
+#endif
+
/* charable.c */
#if USE_WIDEC_SUPPORT
extern NCURSES_EXPORT(bool) _nc_is_charable(wchar_t);
@@ -1859,6 +2077,16 @@ typedef struct
short source;
} alias_table_data;
+/* comp_userdefs.c */
+typedef struct {
+ short ute_name; /* offset of name to hash on */
+ unsigned ute_type; /* mask (BOOLEAN, NUMBER, STRING) */
+ unsigned ute_argc; /* number of parameters */
+ unsigned ute_args; /* bit-mask for string parameters */
+ short ute_index; /* index of associated variable in its array */
+ short ute_link; /* index in table of next hash, or -1 */
+} user_table_data;
+
/* doupdate.c */
#if USE_XMC_SUPPORT
extern NCURSES_EXPORT(void) _nc_do_xmc_glitch (attr_t);
@@ -1884,7 +2112,16 @@ extern NCURSES_EXPORT(int) _nc_wchstrlen(const cchar_t *);
#endif
/* lib_color.c */
+extern NCURSES_EXPORT(int) _nc_init_color(SCREEN *, int, int, int, int);
+extern NCURSES_EXPORT(int) _nc_init_pair(SCREEN *, int, int, int);
+extern NCURSES_EXPORT(int) _nc_pair_content(SCREEN *, int, int *, int *);
extern NCURSES_EXPORT(bool) _nc_reset_colors(void);
+extern NCURSES_EXPORT(void) _nc_reserve_pairs(SCREEN *, int);
+extern NCURSES_EXPORT(void) _nc_change_pair(SCREEN *, int);
+
+#define ReservePairs(sp,want) \
+ if ((sp->_color_pairs == 0) || (want >= sp->_pair_alloc)) \
+ _nc_reserve_pairs(sp, want)
/* lib_getch.c */
extern NCURSES_EXPORT(int) _nc_wgetch(WINDOW *, int *, int EVENTLIST_2nd(_nc_eventlist *));
@@ -1918,29 +2155,43 @@ extern NCURSES_EXPORT(bool) _nc_has_mouse (SCREEN *);
extern NCURSES_EXPORT(char *) _nc_get_locale(void);
extern NCURSES_EXPORT(int) _nc_unicode_locale(void);
extern NCURSES_EXPORT(int) _nc_locale_breaks_acs(TERMINAL *);
-extern NCURSES_EXPORT(int) _nc_setupterm(NCURSES_CONST char *, int, int *, int);
+extern NCURSES_EXPORT(int) _nc_setupterm(const char *, int, int *, int);
extern NCURSES_EXPORT(void) _nc_tinfo_cmdch(TERMINAL *, int);
+#ifdef USE_PTHREADS
+extern NCURSES_EXPORT(SCREEN *) _nc_find_prescr(void);
+extern NCURSES_EXPORT(void) _nc_forget_prescr(void);
+#else
+#define _nc_find_prescr() _nc_prescreen.allocated
+#define _nc_forget_prescr() _nc_prescreen.allocated = 0
+#endif
+
/* lib_set_term.c */
extern NCURSES_EXPORT(int) _nc_ripoffline(int, int(*)(WINDOW*, int));
/* lib_setup.c */
-#define ret_error(code, fmt, arg) if (errret) {\
- *errret = code;\
- returnCode(ERR);\
+#define ExitTerminfo(code) exit_terminfo(code)
+
+#define SETUP_FAIL ERR
+
+#define ret_error(rc, fmt, p, q) if (errret) {\
+ *errret = rc;\
+ q;\
+ returnCode(SETUP_FAIL);\
} else {\
- fprintf(stderr, fmt, arg);\
- exit(EXIT_FAILURE);\
+ fprintf(stderr, fmt, p);\
+ q;\
+ ExitTerminfo(EXIT_FAILURE);\
}
-#define ret_error1(code, fmt, arg) ret_error(code, "'%s': " fmt, arg)
+#define ret_error1(rc, fmt, p, q) ret_error(rc, "'%s': " fmt, p, q)
-#define ret_error0(code, msg) if (errret) {\
- *errret = code;\
- returnCode(ERR);\
+#define ret_error0(rc, msg) if (errret) {\
+ *errret = rc;\
+ returnCode(SETUP_FAIL);\
} else {\
fprintf(stderr, msg);\
- exit(EXIT_FAILURE);\
+ ExitTerminfo(EXIT_FAILURE);\
}
/* lib_tstp.c */
@@ -1984,7 +2235,6 @@ extern NCURSES_EXPORT(int) _nc_remove_key (TRIES **, unsigned);
extern NCURSES_EXPORT(int) _nc_remove_string (TRIES **, const char *);
/* elsewhere ... */
-extern NCURSES_EXPORT(ENTRY *) _nc_delink_entry (ENTRY *, TERMTYPE *);
extern NCURSES_EXPORT(SCREEN *) _nc_screen_of (WINDOW *);
extern NCURSES_EXPORT(TERMINAL*) _nc_get_cur_term (void);
extern NCURSES_EXPORT(WINDOW *) _nc_makenew (int, int, int, int, int);
@@ -1992,6 +2242,7 @@ extern NCURSES_EXPORT(char *) _nc_trace_buf (int, size_t);
extern NCURSES_EXPORT(char *) _nc_trace_bufcat (int, const char *);
extern NCURSES_EXPORT(char *) _nc_tracechar (SCREEN *, int);
extern NCURSES_EXPORT(char *) _nc_tracemouse (SCREEN *, MEVENT const *);
+extern NCURSES_EXPORT(char *) _nc_trace_mmask_t (SCREEN *, mmask_t);
extern NCURSES_EXPORT(int) _nc_access (const char *, int);
extern NCURSES_EXPORT(int) _nc_baudrate (int);
extern NCURSES_EXPORT(int) _nc_freewin (WINDOW *);
@@ -2002,14 +2253,14 @@ extern NCURSES_EXPORT(int) _nc_outch (int);
extern NCURSES_EXPORT(int) _nc_putchar (int);
extern NCURSES_EXPORT(int) _nc_putp(const char *, const char *);
extern NCURSES_EXPORT(int) _nc_putp_flush(const char *, const char *);
-extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const);
-extern NCURSES_EXPORT(int) _nc_setup_tinfo(const char *, TERMTYPE *);
+extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE2 *const);
+extern NCURSES_EXPORT(int) _nc_setup_tinfo(const char *, TERMTYPE2 *);
extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, int, int);
extern NCURSES_EXPORT(int) _nc_timed_wait (SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *));
+extern NCURSES_EXPORT(void) _nc_init_termtype (TERMTYPE2 *const);
extern NCURSES_EXPORT(void) _nc_do_color (int, int, int, NCURSES_OUTC);
extern NCURSES_EXPORT(void) _nc_flush (void);
-extern NCURSES_EXPORT(void) _nc_free_and_exit (int) GCC_NORETURN;
-extern NCURSES_EXPORT(void) _nc_free_entry (ENTRY *, TERMTYPE *);
+extern NCURSES_EXPORT(void) _nc_free_entry (ENTRY *, TERMTYPE2 *);
extern NCURSES_EXPORT(void) _nc_freeall (void);
extern NCURSES_EXPORT(void) _nc_hash_map (void);
extern NCURSES_EXPORT(void) _nc_init_keytry (SCREEN *);
@@ -2023,6 +2274,23 @@ extern NCURSES_EXPORT(void) _nc_signal_handler (int);
extern NCURSES_EXPORT(void) _nc_synchook (WINDOW *);
extern NCURSES_EXPORT(void) _nc_trace_tries (TRIES *);
+#if NCURSES_EXT_NUMBERS
+extern NCURSES_EXPORT(const TERMTYPE2 *) _nc_fallback2 (const char *);
+#else
+#define _nc_fallback2(tp) _nc_fallback(tp)
+#endif
+
+#if NCURSES_EXT_NUMBERS
+extern NCURSES_EXPORT(void) _nc_copy_termtype2 (TERMTYPE2 *, const TERMTYPE2 *);
+extern NCURSES_EXPORT(void) _nc_export_termtype2(TERMTYPE *, const TERMTYPE2 *);
+#else
+#define _nc_copy_termtype2(dst,src) _nc_copy_termtype((dst),(src))
+#define _nc_export_termtype2(dst,src) /* nothing */
+#define _nc_free_termtype2(t) _nc_free_termtype(t)
+/* also... */
+#define _nc_read_entry2 _nc_read_entry
+#endif
+
#if NO_LEAKS
extern NCURSES_EXPORT(void) _nc_alloc_entry_leaks(void);
extern NCURSES_EXPORT(void) _nc_captoinfo_leaks(void);
@@ -2030,9 +2298,11 @@ extern NCURSES_EXPORT(void) _nc_codes_leaks(void);
extern NCURSES_EXPORT(void) _nc_comp_captab_leaks(void);
extern NCURSES_EXPORT(void) _nc_comp_error_leaks(void);
extern NCURSES_EXPORT(void) _nc_comp_scan_leaks(void);
+extern NCURSES_EXPORT(void) _nc_comp_userdefs_leaks(void);
extern NCURSES_EXPORT(void) _nc_db_iterator_leaks(void);
extern NCURSES_EXPORT(void) _nc_keyname_leaks(void);
extern NCURSES_EXPORT(void) _nc_names_leaks(void);
+extern NCURSES_EXPORT(void) _nc_tgetent_leak(TERMINAL *);
extern NCURSES_EXPORT(void) _nc_tgetent_leaks(void);
#endif
@@ -2072,7 +2342,7 @@ extern NCURSES_EXPORT(int) _nc_eventlist_timeout(_nc_eventlist *);
*/
#if USE_WIDEC_SUPPORT
-#if defined(__MINGW32__)
+#if defined(_WIN32)
/*
* MinGW has wide-character functions, but they do not work correctly.
*/
@@ -2087,7 +2357,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 /* __MINGW32__ */
+#endif /* _WIN32 */
#if HAVE_MBTOWC && HAVE_MBLEN
#define reset_mbytes(state) IGNORE_RC(mblen(NULL, (size_t) 0)), IGNORE_RC(mbtowc(NULL, NULL, (size_t) 0))
@@ -2118,9 +2388,7 @@ extern NCURSES_EXPORT_VAR(int *) _nc_oldnums;
#define USE_SETBUF_0 0
-#define NC_BUFFERED(sp,flag) NCURSES_SP_NAME(_nc_set_buffer)(NCURSES_SP_ARGx sp->_ofp, flag)
-
-#define NC_OUTPUT(sp) ((sp != 0) ? sp->_ofp : stdout)
+#define NC_OUTPUT(sp) ((sp != 0 && sp->_ofp != 0) ? sp->_ofp : stdout)
/*
* On systems with a broken linker, define 'SP' as a function to force the
@@ -2202,7 +2470,6 @@ extern NCURSES_EXPORT(int) _nc_get_tty_mode(TTY *);
sp->jump = outc
#ifdef USE_TERM_DRIVER
-typedef void* TERM_HANDLE;
typedef struct _termInfo
{
@@ -2228,48 +2495,47 @@ typedef struct _termInfo
typedef struct term_driver {
bool isTerminfo;
- bool (*CanHandle)(struct DriverTCB*, const char*, int*);
- void (*init)(struct DriverTCB*);
- void (*release)(struct DriverTCB*);
- int (*size)(struct DriverTCB*, int* Line, int *Cols);
- int (*sgmode)(struct DriverTCB*, int setFlag, TTY*);
- chtype (*conattr)(struct DriverTCB*);
- int (*hwcur)(struct DriverTCB*, int yold, int xold, int y, int x);
- int (*mode)(struct DriverTCB*, int progFlag, int defFlag);
- bool (*rescol)(struct DriverTCB*);
- bool (*rescolors)(struct DriverTCB*);
- void (*color)(struct DriverTCB*, int fore, int color, int(*)(SCREEN*, int));
- int (*doBeepOrFlash)(struct DriverTCB*, int);
- void (*initpair)(struct DriverTCB*, int, int, int);
- void (*initcolor)(struct DriverTCB*, int, int, int, int);
- void (*docolor)(struct DriverTCB*, int, int, int, int(*)(SCREEN*, int));
- void (*initmouse)(struct DriverTCB*);
- int (*testmouse)(struct DriverTCB*, int EVENTLIST_2nd(_nc_eventlist*));
- void (*setfilter)(struct DriverTCB*);
- void (*hwlabel)(struct DriverTCB*, int, char*);
- void (*hwlabelOnOff)(struct DriverTCB*, int);
- int (*update)(struct DriverTCB*);
- int (*defaultcolors)(struct DriverTCB*, int, int);
- int (*print)(struct DriverTCB*, char*, int);
- int (*getsize)(struct DriverTCB*, int*, int*);
- int (*setsize)(struct DriverTCB*, int, int);
- void (*initacs)(struct DriverTCB*, chtype*, chtype*);
- void (*scinit)(SCREEN *);
- void (*scexit)(SCREEN *);
- int (*twait)(struct DriverTCB*, int, int, int* EVENTLIST_2nd(_nc_eventlist*));
- int (*read)(struct DriverTCB*, int*);
- int (*nap)(struct DriverTCB*, int);
- int (*kpad)(struct DriverTCB*, int);
- int (*kyOk)(struct DriverTCB*, int, int);
- bool (*kyExist)(struct DriverTCB*, int);
+ const char* (*td_name)(struct DriverTCB*);
+ bool (*td_CanHandle)(struct DriverTCB*, const char*, int*);
+ void (*td_init)(struct DriverTCB*);
+ void (*td_release)(struct DriverTCB*);
+ int (*td_size)(struct DriverTCB*, int* Line, int *Cols);
+ int (*td_sgmode)(struct DriverTCB*, int setFlag, TTY*);
+ chtype (*td_conattr)(struct DriverTCB*);
+ int (*td_hwcur)(struct DriverTCB*, int yold, int xold, int y, int x);
+ int (*td_mode)(struct DriverTCB*, int progFlag, int defFlag);
+ bool (*td_rescol)(struct DriverTCB*);
+ bool (*td_rescolors)(struct DriverTCB*);
+ void (*td_color)(struct DriverTCB*, int fore, int color, int(*)(SCREEN*, int));
+ int (*td_doBeepOrFlash)(struct DriverTCB*, int);
+ void (*td_initpair)(struct DriverTCB*, int, int, int);
+ void (*td_initcolor)(struct DriverTCB*, int, int, int, int);
+ void (*td_docolor)(struct DriverTCB*, int, int, int, int(*)(SCREEN*, int));
+ void (*td_initmouse)(struct DriverTCB*);
+ int (*td_testmouse)(struct DriverTCB*, int EVENTLIST_2nd(_nc_eventlist*));
+ void (*td_setfilter)(struct DriverTCB*);
+ void (*td_hwlabel)(struct DriverTCB*, int, char*);
+ void (*td_hwlabelOnOff)(struct DriverTCB*, int);
+ int (*td_update)(struct DriverTCB*);
+ int (*td_defaultcolors)(struct DriverTCB*, int, int);
+ int (*td_print)(struct DriverTCB*, char*, int);
+ int (*td_getsize)(struct DriverTCB*, int*, int*);
+ int (*td_setsize)(struct DriverTCB*, int, int);
+ void (*td_initacs)(struct DriverTCB*, chtype*, chtype*);
+ void (*td_scinit)(SCREEN *);
+ void (*td_scexit)(SCREEN *);
+ int (*td_twait)(struct DriverTCB*, int, int, int* EVENTLIST_2nd(_nc_eventlist*));
+ int (*td_read)(struct DriverTCB*, int*);
+ int (*td_nap)(struct DriverTCB*, int);
+ int (*td_kpad)(struct DriverTCB*, int);
+ int (*td_kyOk)(struct DriverTCB*, int, int);
+ bool (*td_kyExist)(struct DriverTCB*, int);
+ int (*td_cursorSet)(struct DriverTCB*, int);
} TERM_DRIVER;
typedef struct DriverTCB
{
TERMINAL term; /* needs to be the first Element !!! */
- TERM_HANDLE inp; /* The input handle of the Terminal */
- TERM_HANDLE out; /* The output handle of the Terminal in shell mode */
- TERM_HANDLE hdl; /* The output handle of the Terminal in prog mode */
TERM_DRIVER* drv; /* The driver for that Terminal */
SCREEN* csp; /* The screen that owns that Terminal */
TerminalInfo info; /* Driver independent core capabilities of the Terminal */
@@ -2318,7 +2584,7 @@ extern NCURSES_EXPORT(int) TINFO_MVCUR(SCREEN*, int, int, int, int);
*/
#ifdef USE_TERM_DRIVER
extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, TERMINAL *, int *, int *);
-extern NCURSES_EXPORT(int) _nc_setupterm_ex(TERMINAL **, NCURSES_CONST char *, int , int *, int);
+extern NCURSES_EXPORT(int) _nc_setupterm_ex(TERMINAL **, const char *, int , int *, int);
#define TINFO_GET_SIZE(sp, tp, lp, cp) \
_nc_get_screensize(sp, tp, lp, cp)
#define TINFO_SET_CURTERM(sp, tp) \
@@ -2336,19 +2602,42 @@ extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, int *, int *);
#endif /* !USE_TERM_DRIVER */
#ifdef USE_TERM_DRIVER
-#ifdef __MINGW32__
+#if defined(USE_WIN32CON_DRIVER)
#include <nc_mingw.h>
extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_WIN_DRIVER;
+extern NCURSES_EXPORT(int) _nc_mingw_isatty(int fd);
+extern NCURSES_EXPORT(int) _nc_mingw_isconsole(int fd);
+extern NCURSES_EXPORT(int) _nc_mingw_console_read(
+ SCREEN *sp,
+ HANDLE fd,
+ int *buf);
+extern NCURSES_EXPORT(int) _nc_mingw_testmouse(
+ SCREEN * sp,
+ HANDLE fd,
+ int delay EVENTLIST_2nd(_nc_eventlist*));
+#else
#endif
extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER;
#endif
+#if defined(USE_TERM_DRIVER) && defined(USE_WIN32CON_DRIVER)
+#define NC_ISATTY(fd) _nc_mingw_isatty(fd)
+#else
+#define NC_ISATTY(fd) isatty(fd)
+#endif
+
#ifdef USE_TERM_DRIVER
-#define IsTermInfo(sp) ((TCBOf(sp) != 0) && ((TCBOf(sp)->drv->isTerminfo)))
-#define HasTInfoTerminal(sp) ((0 != TerminalOf(sp)) && IsTermInfo(sp))
+# define IsTermInfo(sp) ((TCBOf(sp) != 0) && ((TCBOf(sp)->drv->isTerminfo)))
+# define HasTInfoTerminal(sp) ((0 != TerminalOf(sp)) && IsTermInfo(sp))
+# if defined(USE_WIN32CON_DRIVER)
+# define IsTermInfoOnConsole(sp) (IsTermInfo(sp)&&_nc_mingw_isconsole(TerminalOf(sp)->Filedes))
#else
-#define IsTermInfo(sp) TRUE
-#define HasTInfoTerminal(sp) (0 != TerminalOf(sp))
+# define IsTermInfoOnConsole(sp) FALSE
+# endif
+#else
+# define IsTermInfo(sp) TRUE
+# define HasTInfoTerminal(sp) (0 != TerminalOf(sp))
+# define IsTermInfoOnConsole(sp) FALSE
#endif
#define IsValidTIScreen(sp) (HasTInfoTerminal(sp))
@@ -2380,7 +2669,6 @@ extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(_nc_makenew) (SCREEN*, int, int,
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(_nc_reset_colors)(SCREEN*);
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(_nc_printf_string)(SCREEN*, const char *, va_list);
extern NCURSES_EXPORT(chtype) NCURSES_SP_NAME(_nc_acs_char)(SCREEN*,int);
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_curs_set)(SCREEN*,int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_get_tty_mode)(SCREEN*,TTY*);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_mcprint)(SCREEN*,char*, int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_msec_cost)(SCREEN*, const char *, int);
@@ -2389,19 +2677,11 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_outch)(SCREEN*, int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putchar)(SCREEN*, int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putp)(SCREEN*, const char *, const char*);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putp_flush)(SCREEN*, const char *, const char *);
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_resetty)(SCREEN*);
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_resize_term)(SCREEN*,int,int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_ripoffline)(SCREEN*, int, int (*)(WINDOW *,int));
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_savetty)(SCREEN*);
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_scr_init)(SCREEN*,const char*);
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_scr_restore)(SCREEN*, const char*);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_scrolln)(SCREEN*, int, int, int, int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_set_tty_mode)(SCREEN*, TTY*);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_setupscreen)(SCREEN**, int, int, FILE *, int, int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tgetent)(SCREEN*,char*,const char *);
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tigetnum)(SCREEN*,NCURSES_CONST char*);
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vid_attr)(SCREEN *, attr_t, NCURSES_COLOR_T, void *);
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vidputs)(SCREEN*,chtype,int(*) (SCREEN*, int));
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_color)(SCREEN*, int, int, int, NCURSES_SP_OUTC);
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_xmc_glitch)(SCREEN*, attr_t);
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_flush)(SCREEN*);
@@ -2450,6 +2730,11 @@ extern NCURSES_EXPORT(NCURSES_CONST char *) _nc_unctrl (SCREEN *, chtype);
#endif
+#ifdef EXP_XTERM_1005
+NCURSES_EXPORT(int) _nc_conv_to_utf8(unsigned char *, unsigned, unsigned);
+NCURSES_EXPORT(int) _nc_conv_to_utf32(unsigned *, const char *, unsigned);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/ncurses/fifo_defs.h b/ncurses/fifo_defs.h
index c0c795a81634..d0e21fafe871 100644
--- a/ncurses/fifo_defs.h
+++ b/ncurses/fifo_defs.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2008,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2016 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 *
@@ -34,7 +34,7 @@
/*
* Common macros for lib_getch.c, lib_ungetch.c
*
- * $Id: fifo_defs.h,v 1.7 2012/08/04 15:59:17 tom Exp $
+ * $Id: fifo_defs.h,v 1.8 2016/09/10 21:59:25 tom Exp $
*/
#ifndef FIFO_DEFS_H
@@ -82,6 +82,4 @@
#define cooked_key_in_fifo() ((head >= 0) && (peek != head))
#define raw_key_in_fifo() ((head >= 0) && (peek != tail))
-#undef HIDE_EINTR
-
#endif /* FIFO_DEFS_H */
diff --git a/ncurses/llib-lncurses b/ncurses/llib-lncurses
index d98dcd596326..1b291dd7729e 100644
--- a/ncurses/llib-lncurses
+++ b/ncurses/llib-lncurses
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2017,2019 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 1996-on *
+ * Author: Thomas E. Dickey 1996-on *
****************************************************************************/
/* LINTLIBRARY */
@@ -182,7 +182,7 @@ int wchgat(
WINDOW *win,
int n,
attr_t attr,
- short color,
+ short pair_arg,
const void *opts)
{ return(*(int *)0); }
@@ -240,6 +240,26 @@ int start_color_sp(
int start_color(void)
{ return(*(int *)0); }
+#undef _nc_change_pair
+void _nc_change_pair(
+ SCREEN *sp,
+ int pair)
+ { /* void */ }
+
+#undef _nc_reserve_pairs
+void _nc_reserve_pairs(
+ SCREEN *sp,
+ int want)
+ { /* void */ }
+
+#undef _nc_init_pair
+int _nc_init_pair(
+ SCREEN *sp,
+ int pair,
+ int f,
+ int b)
+ { return(*(int *)0); }
+
#undef init_pair_sp
int init_pair_sp(
SCREEN *sp,
@@ -255,6 +275,15 @@ int init_pair(
short b)
{ return(*(int *)0); }
+#undef _nc_init_color
+int _nc_init_color(
+ SCREEN *sp,
+ int color,
+ int r,
+ int g,
+ int b)
+ { return(*(int *)0); }
+
#undef init_color_sp
int init_color_sp(
SCREEN *sp,
@@ -307,6 +336,14 @@ int color_content(
short *b)
{ return(*(int *)0); }
+#undef _nc_pair_content
+int _nc_pair_content(
+ SCREEN *sp,
+ int pair,
+ int *f,
+ int *b)
+ { return(*(int *)0); }
+
#undef pair_content_sp
int pair_content_sp(
SCREEN *sp,
@@ -344,7 +381,7 @@ void _nc_do_color(
#undef wcolor_set
int wcolor_set(
WINDOW *win,
- short color_pair_number,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
@@ -1023,20 +1060,6 @@ int (vline)(
int z)
{ return(*(int *)0); }
-#undef vw_printw
-int (vw_printw)(
- WINDOW *a1,
- const char *a2,
- va_list z)
- { return(*(int *)0); }
-
-#undef vw_scanw
-int (vw_scanw)(
- WINDOW *a1,
- char *a2,
- va_list z)
- { return(*(int *)0); }
-
#undef waddchstr
int (waddchstr)(
WINDOW *a1,
@@ -1237,6 +1260,11 @@ NCURSES_BOOL (is_syncok)(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
+#undef wgetdelay
+int (wgetdelay)(
+ const WINDOW *z)
+ { return(*(int *)0); }
+
#undef wgetscrreg
int (wgetscrreg)(
const WINDOW *a1,
@@ -1586,14 +1614,14 @@ void nofilter(void)
#undef newterm_sp
SCREEN *newterm_sp(
SCREEN *sp,
- char *name,
+ const char *name,
FILE *ofp,
FILE *ifp)
{ return(*(SCREEN **)0); }
#undef newterm
SCREEN *newterm(
- char *name,
+ const char *name,
FILE *ofp,
FILE *ifp)
{ return(*(SCREEN **)0); }
@@ -1803,6 +1831,13 @@ int vwprintw(
va_list argp)
{ return(*(int *)0); }
+#undef vw_printw
+int vw_printw(
+ WINDOW *win,
+ const char *fmt,
+ va_list argp)
+ { return(*(int *)0); }
+
/* ./base/lib_redrawln.c */
#undef wredrawln
@@ -1829,14 +1864,14 @@ int wnoutrefresh(
#undef restartterm_sp
int restartterm_sp(
SCREEN *sp,
- char *termp,
+ const char *termp,
int filenum,
int *errret)
{ return(*(int *)0); }
#undef restartterm
int restartterm(
- char *termp,
+ const char *termp,
int filenum,
int *errret)
{ return(*(int *)0); }
@@ -1846,20 +1881,27 @@ int restartterm(
#undef vwscanw
int vwscanw(
WINDOW *win,
- char *fmt,
+ const char *fmt,
+ va_list argp)
+ { return(*(int *)0); }
+
+#undef vw_scanw
+int vw_scanw(
+ WINDOW *win,
+ const char *fmt,
va_list argp)
{ return(*(int *)0); }
#undef scanw
int scanw(
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
#undef wscanw
int wscanw(
WINDOW *win,
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
@@ -1867,7 +1909,7 @@ int wscanw(
int mvscanw(
int y,
int x,
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
@@ -1876,7 +1918,7 @@ int mvwscanw(
WINDOW *win,
int y,
int x,
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
@@ -2065,14 +2107,14 @@ int slk_restore(void)
int slk_attr_set_sp(
SCREEN *sp,
const attr_t attr,
- short color_pair_number,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
#undef slk_attr_set
int slk_attr_set(
const attr_t attr,
- short color_pair_number,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
@@ -2142,12 +2184,12 @@ int slk_clear(void)
#undef slk_color_sp
int slk_color_sp(
SCREEN *sp,
- short color_pair_number)
+ short pair_arg)
{ return(*(int *)0); }
#undef slk_color
int slk_color(
- short color_pair_number)
+ short pair_arg)
{ return(*(int *)0); }
/* ./base/lib_slkinit.c */
@@ -2255,6 +2297,12 @@ void _tracedump(
/* ./trace/lib_tracemse.c */
+#undef _nc_trace_mmask_t
+char *_nc_trace_mmask_t(
+ SCREEN *sp,
+ mmask_t code)
+ { return(*(char **)0); }
+
#undef _nc_tracemouse
char *_nc_tracemouse(
SCREEN *sp,
@@ -2500,10 +2548,6 @@ void _nc_do_xmc_glitch(
/* ./trace/varargs.c */
-typedef enum {
- atUnknown = 0, atInteger, atFloat, atPoint, atString
-} ARGTYPE;
-
#undef _nc_varargs
char *_nc_varargs(
const char *fmt,
@@ -2533,6 +2577,11 @@ void _nc_free_and_exit(
int code)
{ /* void */ }
+#undef exit_curses
+void exit_curses(
+ int code)
+ { /* void */ }
+
/* ./expanded.c */
#undef _nc_toggle_attr_on
@@ -2632,6 +2681,12 @@ int mcprint(
int len)
{ return(*(int *)0); }
+/* ./base/new_pair.c */
+
+#undef _nc_new_pair
+void _nc_new_pair(void)
+ { /* void */ }
+
/* ./base/resizeterm.c */
#undef is_term_resized_sp
@@ -2762,8 +2817,8 @@ int _nc_add_to_try(
#undef _nc_align_termtype
void _nc_align_termtype(
- TERMTYPE *to,
- TERMTYPE *from)
+ TERMTYPE2 *to,
+ TERMTYPE2 *from)
{ /* void */ }
#undef _nc_copy_termtype
@@ -2775,11 +2830,11 @@ void _nc_copy_termtype(
/* ./codes.c */
#undef boolcodes
-char *const boolcodes[] = {0};
+const char *const boolcodes[] = {0};
#undef numcodes
-char *const numcodes[] = {0};
+const char *const numcodes[] = {0};
#undef strcodes
-char *const strcodes[] = {0};
+const char *const strcodes[] = {0};
/* ./comp_captab.c */
@@ -2864,6 +2919,21 @@ struct name_table_entry const *_nc_find_type_entry(
NCURSES_BOOL termcap)
{ return(*(struct name_table_entry const **)0); }
+#undef _nc_find_user_entry
+struct user_table_entry const *_nc_find_user_entry(
+ const char *string)
+ { return(*(struct user_table_entry const **)0); }
+
+/* ./comp_userdefs.c */
+
+#undef _nc_get_userdefs_table
+const struct user_table_entry *_nc_get_userdefs_table(void)
+ { return(*(const struct user_table_entry **)0); }
+
+#undef _nc_get_hash_user
+const HashData *_nc_get_hash_user(void)
+ { return(*(const HashData **)0); }
+
/* ./tinfo/db_iterator.c */
#undef _nc_tic_dir
@@ -2910,7 +2980,7 @@ ENTRY *_nc_tail;
#undef _nc_free_entry
void _nc_free_entry(
ENTRY *headp,
- TERMTYPE *tterm)
+ TERMTYPE2 *tterm)
{ /* void */ }
#undef _nc_free_entries
@@ -2918,22 +2988,21 @@ void _nc_free_entries(
ENTRY *headp)
{ /* void */ }
-#undef _nc_delink_entry
-ENTRY *_nc_delink_entry(
- ENTRY *headp,
- TERMTYPE *tterm)
- { return(*(ENTRY **)0); }
-
#undef _nc_leaks_tinfo
void _nc_leaks_tinfo(void)
{ /* void */ }
+#undef exit_terminfo
+void exit_terminfo(
+ int code)
+ { /* void */ }
+
/* ./fallback.c */
#undef _nc_fallback
-const TERMTYPE *_nc_fallback(
+const TERMTYPE2 *_nc_fallback(
const char *name)
- { return(*(const TERMTYPE **)0); }
+ { return(*(const TERMTYPE2 **)0); }
/* ./tinfo/free_ttype.c */
@@ -2993,8 +3062,8 @@ void _nc_init_acs(void)
/* ./tinfo/lib_baudrate.c */
struct speed {
- int s;
- int sp;
+ int given_speed;
+ int actual_speed;
};
#undef _nc_baudrate
@@ -3119,18 +3188,23 @@ int flushinp(void)
struct kn { short offset; int code; };
#undef keyname_sp
-char *keyname_sp(
+const char *keyname_sp(
SCREEN *sp,
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef keyname
-char *keyname(
+const char *keyname(
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./tinfo/lib_longname.c */
+#undef longname_sp
+char *longname_sp(
+ SCREEN *sp)
+ { return(*(char **)0); }
+
#undef longname
char *longname(void)
{ return(*(char **)0); }
@@ -3382,7 +3456,7 @@ void _nc_update_screensize(
#undef _nc_setup_tinfo
int _nc_setup_tinfo(
const char *const tn,
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
#undef _nc_tinfo_cmdch
@@ -3406,7 +3480,7 @@ int _nc_locale_breaks_acs(
#undef _nc_setupterm
int _nc_setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret,
int reuse)
@@ -3418,7 +3492,7 @@ SCREEN *new_prescr(void)
#undef setupterm
int setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret)
{ return(*(int *)0); }
@@ -3446,35 +3520,35 @@ int tgetent(
#undef tgetflag_sp
int tgetflag_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetflag
int tgetflag(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum_sp
int tgetnum_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum
int tgetnum(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetstr_sp
char *tgetstr_sp(
SCREEN *sp,
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
#undef tgetstr
char *tgetstr(
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
@@ -3503,34 +3577,34 @@ char *tgoto(
#undef tigetflag_sp
int tigetflag_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetflag
int tigetflag(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum_sp
int tigetnum_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum
int tigetnum(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetstr_sp
char *tigetstr_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(char **)0); }
#undef tigetstr
char *tigetstr(
- char *str)
+ const char *str)
{ return(*(char **)0); }
/* ./tinfo/lib_tparm.c */
@@ -3547,7 +3621,7 @@ int _nc_tparm_analyze(
#undef tparm
char *tparm(
- char *string,
+ const char *string,
...)
{ return(*(char **)0); }
@@ -3668,6 +3742,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)
@@ -3710,9 +3789,9 @@ const char *_nc_retrace_cptr(
{ return(*(const char **)0); }
#undef _nc_retrace_cvoid_ptr
-void *_nc_retrace_cvoid_ptr(
- void *code)
- { return(*(void **)0); }
+const void *_nc_retrace_cvoid_ptr(
+ const void *code)
+ { return(*(const void **)0); }
#undef _nc_retrace_void_ptr
void *_nc_retrace_void_ptr(
@@ -3729,6 +3808,13 @@ WINDOW *_nc_retrace_win(
WINDOW *code)
{ return(*(WINDOW **)0); }
+#undef _nc_fmt_funcptr
+char *_nc_fmt_funcptr(
+ char *target,
+ const char *source,
+ size_t size)
+ { return(*(char **)0); }
+
/* ./trace/lib_traceatr.c */
#undef _traceattr2
@@ -3776,11 +3862,6 @@ chtype _nc_retrace_chtype(
/* ./trace/lib_tracebits.c */
-typedef struct {
- unsigned int val;
- const char *name;
-} BITNAMES;
-
#undef _nc_trace_ttymode
char *_nc_trace_ttymode(
struct termios *tty)
@@ -3908,17 +3989,17 @@ int _nc_name_match(
/* ./names.c */
#undef boolnames
-char *const boolnames[] = {0};
+const char *const boolnames[] = {0};
#undef boolfnames
-char *const boolfnames[] = {0};
+const char *const boolfnames[] = {0};
#undef numnames
-char *const numnames[] = {0};
+const char *const numnames[] = {0};
#undef numfnames
-char *const numfnames[] = {0};
+const char *const numfnames[] = {0};
#undef strnames
-char *const strnames[] = {0};
+const char *const strnames[] = {0};
#undef strfnames
-char *const strfnames[] = {0};
+const char *const strfnames[] = {0};
/* ./tinfo/obsolete.c */
@@ -3939,12 +4020,12 @@ void _nc_set_buffer(
#undef _nc_init_termtype
void _nc_init_termtype(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
#undef _nc_read_termtype
int _nc_read_termtype(
- TERMTYPE *ptr,
+ TERMTYPE2 *ptr,
char *buffer,
int limit)
{ return(*(int *)0); }
@@ -3952,21 +4033,23 @@ int _nc_read_termtype(
#undef _nc_read_file_entry
int _nc_read_file_entry(
const char *const filename,
- TERMTYPE *ptr)
+ TERMTYPE2 *ptr)
{ return(*(int *)0); }
#undef _nc_read_entry
int _nc_read_entry(
const char *const name,
char *const filename,
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
/* ./tinfo/read_termcap.c */
-#undef _nc_read_termcap
-void _nc_read_termcap(void)
- { /* void */ }
+#undef _nc_read_termcap_entry
+int _nc_read_termcap_entry(
+ const char *const tn,
+ TERMTYPE2 *const tp)
+ { return(*(int *)0); }
/* ./tinfo/strings.c */
@@ -4048,21 +4131,21 @@ int _nc_remove_string(
#undef _nc_trim_sgr0
char *_nc_trim_sgr0(
- TERMTYPE *tp)
+ TERMTYPE2 *tp)
{ return(*(char **)0); }
/* ./unctrl.c */
#undef unctrl_sp
-char *unctrl_sp(
+const char *unctrl_sp(
SCREEN *sp,
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef unctrl
-char *unctrl(
+const char *unctrl(
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./trace/visbuf.c */
@@ -4100,7 +4183,7 @@ const char *_nc_viscbuf(
#undef _nc_init_entry
void _nc_init_entry(
- TERMTYPE *const tp)
+ ENTRY *const tp)
{ /* void */ }
#undef _nc_copy_entry
@@ -4121,8 +4204,8 @@ void _nc_wrap_entry(
#undef _nc_merge_entry
void _nc_merge_entry(
- TERMTYPE *const to,
- TERMTYPE *const from)
+ ENTRY *const target,
+ ENTRY *const source)
{ /* void */ }
/* ./tinfo/captoinfo.c */
@@ -4154,11 +4237,8 @@ char *_nc_tic_expand(
#undef _nc_check_termtype2
void (*_nc_check_termtype2)(
- TERMTYPE *p1,
+ TERMTYPE2 *p1,
NCURSES_BOOL p2);
-#undef _nc_check_termtype
-void (*_nc_check_termtype)(
- TERMTYPE *p1);
#undef _nc_entry_match
NCURSES_BOOL _nc_entry_match(
@@ -4182,11 +4262,6 @@ int _nc_resolve_uses2(
NCURSES_BOOL literal)
{ return(*(int *)0); }
-#undef _nc_resolve_uses
-int _nc_resolve_uses(
- NCURSES_BOOL fullresolve)
- { return(*(int *)0); }
-
/* ./tinfo/comp_scan.c */
#undef _nc_syntax
@@ -4237,7 +4312,7 @@ void _nc_panic_mode(
#undef _nc_parse_entry
int _nc_parse_entry(
- struct entry *entryp,
+ ENTRY *entryp,
int literal,
NCURSES_BOOL silent)
{ return(*(int *)0); }
@@ -4248,23 +4323,26 @@ int _nc_capcmp(
const char *t)
{ return(*(int *)0); }
-typedef struct {
- const char *from;
- const char *to;
-} assoc;
-
/* ./tinfo/write_entry.c */
#undef _nc_set_writedir
void _nc_set_writedir(
- char *dir)
+ const char *dir)
{ /* void */ }
#undef _nc_write_entry
void _nc_write_entry(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
+#undef _nc_write_object
+int _nc_write_object(
+ TERMTYPE2 *tp,
+ char *buffer,
+ unsigned *offset,
+ unsigned limit)
+ { return(*(int *)0); }
+
#undef _nc_tic_written
int _nc_tic_written(void)
{ return(*(int *)0); }
diff --git a/ncurses/llib-lncursest b/ncurses/llib-lncursest
index 3401ad363cbc..eb43bfd35b23 100644
--- a/ncurses/llib-lncursest
+++ b/ncurses/llib-lncursest
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2008-2011,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 2008-2017,2019 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 2008-on *
+ * Author: Thomas E. Dickey 2008-on *
****************************************************************************/
/* LINTLIBRARY */
@@ -95,8 +95,6 @@ void _nc_scroll_oldhash(
/* ./base/lib_addch.c */
-#include <ctype.h>
-
#undef _nc_render
chtype _nc_render(
WINDOW *win,
@@ -184,7 +182,7 @@ int wchgat(
WINDOW *win,
int n,
attr_t attr,
- short color,
+ short pair_arg,
const void *opts)
{ return(*(int *)0); }
@@ -219,8 +217,6 @@ int wclrtoeol(
/* ./base/lib_color.c */
-#include <tic.h>
-
#undef _nc_COLOR_PAIRS
int _nc_COLOR_PAIRS(void)
{ return(*(int *)0); }
@@ -247,6 +243,26 @@ int start_color_sp(
int start_color(void)
{ return(*(int *)0); }
+#undef _nc_change_pair
+void _nc_change_pair(
+ SCREEN *sp,
+ int pair)
+ { /* void */ }
+
+#undef _nc_reserve_pairs
+void _nc_reserve_pairs(
+ SCREEN *sp,
+ int want)
+ { /* void */ }
+
+#undef _nc_init_pair
+int _nc_init_pair(
+ SCREEN *sp,
+ int pair,
+ int f,
+ int b)
+ { return(*(int *)0); }
+
#undef init_pair_sp
int init_pair_sp(
SCREEN *sp,
@@ -262,6 +278,15 @@ int init_pair(
short b)
{ return(*(int *)0); }
+#undef _nc_init_color
+int _nc_init_color(
+ SCREEN *sp,
+ int color,
+ int r,
+ int g,
+ int b)
+ { return(*(int *)0); }
+
#undef init_color_sp
int init_color_sp(
SCREEN *sp,
@@ -314,6 +339,14 @@ int color_content(
short *b)
{ return(*(int *)0); }
+#undef _nc_pair_content
+int _nc_pair_content(
+ SCREEN *sp,
+ int pair,
+ int *f,
+ int *b)
+ { return(*(int *)0); }
+
#undef pair_content_sp
int pair_content_sp(
SCREEN *sp,
@@ -351,7 +384,7 @@ void _nc_do_color(
#undef wcolor_set
int wcolor_set(
WINDOW *win,
- short color_pair_number,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
@@ -420,8 +453,6 @@ int flash(void)
/* ./lib_gen.c */
-#include <ncurses_cfg.h>
-
#undef addch
int (addch)(
const chtype z)
@@ -451,17 +482,17 @@ int (addstr)(
#undef attroff
int (attroff)(
- int z)
+ NCURSES_ATTR_T z)
{ return(*(int *)0); }
#undef attron
int (attron)(
- int z)
+ NCURSES_ATTR_T z)
{ return(*(int *)0); }
#undef attrset
int (attrset)(
- int z)
+ NCURSES_ATTR_T z)
{ return(*(int *)0); }
#undef attr_get
@@ -1032,20 +1063,6 @@ int (vline)(
int z)
{ return(*(int *)0); }
-#undef vw_printw
-int (vw_printw)(
- WINDOW *a1,
- const char *a2,
- va_list z)
- { return(*(int *)0); }
-
-#undef vw_scanw
-int (vw_scanw)(
- WINDOW *a1,
- char *a2,
- va_list z)
- { return(*(int *)0); }
-
#undef waddchstr
int (waddchstr)(
WINDOW *a1,
@@ -1246,6 +1263,11 @@ NCURSES_BOOL (is_syncok)(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
+#undef wgetdelay
+int (wgetdelay)(
+ const WINDOW *z)
+ { return(*(int *)0); }
+
#undef wgetscrreg
int (wgetscrreg)(
const WINDOW *a1,
@@ -1262,8 +1284,6 @@ NCURSES_BOOL (mouse_trafo)(
/* ./base/lib_getch.c */
-#include <fifo_defs.h>
-
#undef _nc_ESCDELAY
int _nc_ESCDELAY(void)
{ return(*(int *)0); }
@@ -1603,22 +1623,20 @@ void nofilter(void)
#undef newterm_sp
SCREEN *newterm_sp(
SCREEN *sp,
- char *name,
+ const char *name,
FILE *ofp,
FILE *ifp)
{ return(*(SCREEN **)0); }
#undef newterm
SCREEN *newterm(
- char *name,
+ const char *name,
FILE *ofp,
FILE *ifp)
{ return(*(SCREEN **)0); }
/* ./base/lib_newwin.c */
-#include "/usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h"
-
#undef _nc_freewin
int _nc_freewin(
WINDOW *win)
@@ -1822,6 +1840,13 @@ int vwprintw(
va_list argp)
{ return(*(int *)0); }
+#undef vw_printw
+int vw_printw(
+ WINDOW *win,
+ const char *fmt,
+ va_list argp)
+ { return(*(int *)0); }
+
/* ./base/lib_redrawln.c */
#undef wredrawln
@@ -1848,14 +1873,14 @@ int wnoutrefresh(
#undef restartterm_sp
int restartterm_sp(
SCREEN *sp,
- char *termp,
+ const char *termp,
int filenum,
int *errret)
{ return(*(int *)0); }
#undef restartterm
int restartterm(
- char *termp,
+ const char *termp,
int filenum,
int *errret)
{ return(*(int *)0); }
@@ -1865,20 +1890,27 @@ int restartterm(
#undef vwscanw
int vwscanw(
WINDOW *win,
- char *fmt,
+ const char *fmt,
+ va_list argp)
+ { return(*(int *)0); }
+
+#undef vw_scanw
+int vw_scanw(
+ WINDOW *win,
+ const char *fmt,
va_list argp)
{ return(*(int *)0); }
#undef scanw
int scanw(
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
#undef wscanw
int wscanw(
WINDOW *win,
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
@@ -1886,7 +1918,7 @@ int wscanw(
int mvscanw(
int y,
int x,
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
@@ -1895,7 +1927,7 @@ int mvwscanw(
WINDOW *win,
int y,
int x,
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
@@ -2084,14 +2116,14 @@ int slk_restore(void)
int slk_attr_set_sp(
SCREEN *sp,
const attr_t attr,
- short color_pair_number,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
#undef slk_attr_set
int slk_attr_set(
const attr_t attr,
- short color_pair_number,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
@@ -2161,12 +2193,12 @@ int slk_clear(void)
#undef slk_color_sp
int slk_color_sp(
SCREEN *sp,
- short color_pair_number)
+ short pair_arg)
{ return(*(int *)0); }
#undef slk_color
int slk_color(
- short color_pair_number)
+ short pair_arg)
{ return(*(int *)0); }
/* ./base/lib_slkinit.c */
@@ -2274,6 +2306,12 @@ void _tracedump(
/* ./trace/lib_tracemse.c */
+#undef _nc_trace_mmask_t
+char *_nc_trace_mmask_t(
+ SCREEN *sp,
+ mmask_t code)
+ { return(*(char **)0); }
+
#undef _nc_tracemouse
char *_nc_tracemouse(
SCREEN *sp,
@@ -2293,8 +2331,6 @@ char *_tracemouse(
/* ./tty/lib_tstp.c */
-#include <SigAction.h>
-
#undef _nc_signal_handler
void _nc_signal_handler(
int enable)
@@ -2455,9 +2491,6 @@ char *_nc_printf_string(
/* ./tty/tty_update.c */
-#include <sys/time.h>
-#include <sys/times.h>
-
#undef doupdate_sp
int doupdate_sp(
SCREEN *sp)
@@ -2524,10 +2557,6 @@ void _nc_do_xmc_glitch(
/* ./trace/varargs.c */
-typedef enum {
- atUnknown = 0, atInteger, atFloat, atPoint, atString
-} ARGTYPE;
-
#undef _nc_varargs
char *_nc_varargs(
const char *fmt,
@@ -2557,6 +2586,11 @@ void _nc_free_and_exit(
int code)
{ /* void */ }
+#undef exit_curses
+void exit_curses(
+ int code)
+ { /* void */ }
+
/* ./expanded.c */
#undef _nc_toggle_attr_on
@@ -2656,6 +2690,12 @@ int mcprint(
int len)
{ return(*(int *)0); }
+/* ./base/new_pair.c */
+
+#undef _nc_new_pair
+void _nc_new_pair(void)
+ { /* void */ }
+
/* ./base/resizeterm.c */
#undef is_term_resized_sp
@@ -2786,8 +2826,8 @@ int _nc_add_to_try(
#undef _nc_align_termtype
void _nc_align_termtype(
- TERMTYPE *to,
- TERMTYPE *from)
+ TERMTYPE2 *to,
+ TERMTYPE2 *from)
{ /* void */ }
#undef _nc_copy_termtype
@@ -2799,21 +2839,19 @@ void _nc_copy_termtype(
/* ./codes.c */
#undef _nc_boolcodes
-char *const *_nc_boolcodes(void)
- { return(*(char **)0); }
+const char *const *_nc_boolcodes(void)
+ { return(*(const char **)0); }
#undef _nc_numcodes
-char *const *_nc_numcodes(void)
- { return(*(char **)0); }
+const char *const *_nc_numcodes(void)
+ { return(*(const char **)0); }
#undef _nc_strcodes
-char *const *_nc_strcodes(void)
- { return(*(char **)0); }
+const char *const *_nc_strcodes(void)
+ { return(*(const char **)0); }
/* ./comp_captab.c */
-#include <hashsize.h>
-
#undef _nc_get_table
const struct name_table_entry *_nc_get_table(
NCURSES_BOOL termcap)
@@ -2895,9 +2933,22 @@ struct name_table_entry const *_nc_find_type_entry(
NCURSES_BOOL termcap)
{ return(*(struct name_table_entry const **)0); }
-/* ./tinfo/db_iterator.c */
+#undef _nc_find_user_entry
+struct user_table_entry const *_nc_find_user_entry(
+ const char *string)
+ { return(*(struct user_table_entry const **)0); }
+
+/* ./comp_userdefs.c */
+
+#undef _nc_get_userdefs_table
+const struct user_table_entry *_nc_get_userdefs_table(void)
+ { return(*(const struct user_table_entry **)0); }
-#include <time.h>
+#undef _nc_get_hash_user
+const HashData *_nc_get_hash_user(void)
+ { return(*(const HashData **)0); }
+
+/* ./tinfo/db_iterator.c */
#undef _nc_tic_dir
const char *_nc_tic_dir(
@@ -2943,7 +2994,7 @@ ENTRY *_nc_tail;
#undef _nc_free_entry
void _nc_free_entry(
ENTRY *headp,
- TERMTYPE *tterm)
+ TERMTYPE2 *tterm)
{ /* void */ }
#undef _nc_free_entries
@@ -2951,22 +3002,21 @@ void _nc_free_entries(
ENTRY *headp)
{ /* void */ }
-#undef _nc_delink_entry
-ENTRY *_nc_delink_entry(
- ENTRY *headp,
- TERMTYPE *tterm)
- { return(*(ENTRY **)0); }
-
#undef _nc_leaks_tinfo
void _nc_leaks_tinfo(void)
{ /* void */ }
+#undef exit_terminfo
+void exit_terminfo(
+ int code)
+ { /* void */ }
+
/* ./fallback.c */
#undef _nc_fallback
-const TERMTYPE *_nc_fallback(
+const TERMTYPE2 *_nc_fallback(
const char *name)
- { return(*(const TERMTYPE **)0); }
+ { return(*(const TERMTYPE2 **)0); }
/* ./tinfo/free_ttype.c */
@@ -3004,15 +3054,6 @@ char *_nc_home_terminfo(void)
/* ./tinfo/init_keytry.c */
-#if 0
-
-#include <init_keytry.h>
-
-#undef _nc_tinfo_fkeys
-const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0};
-
-#endif
-
#undef _nc_init_keytry
void _nc_init_keytry(
SCREEN *sp)
@@ -3035,11 +3076,9 @@ void _nc_init_acs(void)
/* ./tinfo/lib_baudrate.c */
-#include <termcap.h>
-
struct speed {
- int s;
- int sp;
+ int given_speed;
+ int actual_speed;
};
#undef _nc_baudrate
@@ -3204,15 +3243,15 @@ int flushinp(void)
struct kn { short offset; int code; };
#undef keyname_sp
-char *keyname_sp(
+const char *keyname_sp(
SCREEN *sp,
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef keyname
-char *keyname(
+const char *keyname(
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./tinfo/lib_longname.c */
@@ -3410,10 +3449,6 @@ int intrflush(
/* ./tinfo/lib_setup.c */
-#include <locale.h>
-#include <sys/ioctl.h>
-#include <langinfo.h>
-
#undef _nc_ttytype
char *_nc_ttytype(void)
{ return(*(char **)0); }
@@ -3498,7 +3533,7 @@ void _nc_update_screensize(
#undef _nc_setup_tinfo
int _nc_setup_tinfo(
const char *const tn,
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
#undef _nc_tinfo_cmdch
@@ -3522,19 +3557,27 @@ int _nc_locale_breaks_acs(
#undef _nc_setupterm
int _nc_setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret,
int reuse)
{ return(*(int *)0); }
+#undef _nc_find_prescr
+SCREEN *_nc_find_prescr(void)
+ { return(*(SCREEN **)0); }
+
+#undef _nc_forget_prescr
+void _nc_forget_prescr(void)
+ { /* void */ }
+
#undef new_prescr
SCREEN *new_prescr(void)
{ return(*(SCREEN **)0); }
#undef setupterm
int setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret)
{ return(*(int *)0); }
@@ -3553,12 +3596,6 @@ int tgetent_sp(
const char *name)
{ return(*(int *)0); }
-#if 0
-
-#include <capdefaults.c>
-
-#endif
-
#undef tgetent
int tgetent(
char *bufp,
@@ -3568,35 +3605,35 @@ int tgetent(
#undef tgetflag_sp
int tgetflag_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetflag
int tgetflag(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum_sp
int tgetnum_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum
int tgetnum(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetstr_sp
char *tgetstr_sp(
SCREEN *sp,
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
#undef tgetstr
char *tgetstr(
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
@@ -3625,34 +3662,34 @@ char *tgoto(
#undef tigetflag_sp
int tigetflag_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetflag
int tigetflag(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum_sp
int tigetnum_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum
int tigetnum(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetstr_sp
char *tigetstr_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(char **)0); }
#undef tigetstr
char *tigetstr(
- char *str)
+ const char *str)
{ return(*(char **)0); }
/* ./tinfo/lib_tparm.c */
@@ -3669,7 +3706,7 @@ int _nc_tparm_analyze(
#undef tparm
char *tparm(
- char *string,
+ const char *string,
...)
{ return(*(char **)0); }
@@ -3804,6 +3841,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)
@@ -3846,9 +3888,9 @@ const char *_nc_retrace_cptr(
{ return(*(const char **)0); }
#undef _nc_retrace_cvoid_ptr
-void *_nc_retrace_cvoid_ptr(
- void *code)
- { return(*(void **)0); }
+const void *_nc_retrace_cvoid_ptr(
+ const void *code)
+ { return(*(const void **)0); }
#undef _nc_retrace_void_ptr
void *_nc_retrace_void_ptr(
@@ -3865,6 +3907,13 @@ WINDOW *_nc_retrace_win(
WINDOW *code)
{ return(*(WINDOW **)0); }
+#undef _nc_fmt_funcptr
+char *_nc_fmt_funcptr(
+ char *target,
+ const char *source,
+ size_t size)
+ { return(*(char **)0); }
+
#undef _nc_use_tracef
int _nc_use_tracef(
unsigned mask)
@@ -3923,11 +3972,6 @@ chtype _nc_retrace_chtype(
/* ./trace/lib_tracebits.c */
-typedef struct {
- unsigned int val;
- const char *name;
-} BITNAMES;
-
#undef _nc_trace_ttymode
char *_nc_trace_ttymode(
struct termios *tty)
@@ -4055,28 +4099,28 @@ int _nc_name_match(
/* ./names.c */
#undef _nc_boolnames
-char *const *_nc_boolnames(void)
- { return(*(char **)0); }
+const char *const *_nc_boolnames(void)
+ { return(*(const char **)0); }
#undef _nc_boolfnames
-char *const *_nc_boolfnames(void)
- { return(*(char **)0); }
+const char *const *_nc_boolfnames(void)
+ { return(*(const char **)0); }
#undef _nc_numnames
-char *const *_nc_numnames(void)
- { return(*(char **)0); }
+const char *const *_nc_numnames(void)
+ { return(*(const char **)0); }
#undef _nc_numfnames
-char *const *_nc_numfnames(void)
- { return(*(char **)0); }
+const char *const *_nc_numfnames(void)
+ { return(*(const char **)0); }
#undef _nc_strnames
-char *const *_nc_strnames(void)
- { return(*(char **)0); }
+const char *const *_nc_strnames(void)
+ { return(*(const char **)0); }
#undef _nc_strfnames
-char *const *_nc_strfnames(void)
- { return(*(char **)0); }
+const char *const *_nc_strfnames(void)
+ { return(*(const char **)0); }
/* ./tinfo/obsolete.c */
@@ -4095,16 +4139,14 @@ void _nc_set_buffer(
/* ./tinfo/read_entry.c */
-#include <hashed_db.h>
-
#undef _nc_init_termtype
void _nc_init_termtype(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
#undef _nc_read_termtype
int _nc_read_termtype(
- TERMTYPE *ptr,
+ TERMTYPE2 *ptr,
char *buffer,
int limit)
{ return(*(int *)0); }
@@ -4112,23 +4154,23 @@ int _nc_read_termtype(
#undef _nc_read_file_entry
int _nc_read_file_entry(
const char *const filename,
- TERMTYPE *ptr)
+ TERMTYPE2 *ptr)
{ return(*(int *)0); }
#undef _nc_read_entry
int _nc_read_entry(
const char *const name,
char *const filename,
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
/* ./tinfo/read_termcap.c */
-#include <sys/types.h>
-
-#undef _nc_read_termcap
-void _nc_read_termcap(void)
- { /* void */ }
+#undef _nc_read_termcap_entry
+int _nc_read_termcap_entry(
+ const char *const tn,
+ TERMTYPE2 *const tp)
+ { return(*(int *)0); }
/* ./tinfo/strings.c */
@@ -4210,21 +4252,21 @@ int _nc_remove_string(
#undef _nc_trim_sgr0
char *_nc_trim_sgr0(
- TERMTYPE *tp)
+ TERMTYPE2 *tp)
{ return(*(char **)0); }
/* ./unctrl.c */
#undef unctrl_sp
-char *unctrl_sp(
+const char *unctrl_sp(
SCREEN *sp,
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef unctrl
-char *unctrl(
+const char *unctrl(
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./trace/visbuf.c */
@@ -4262,7 +4304,7 @@ const char *_nc_viscbuf(
#undef _nc_init_entry
void _nc_init_entry(
- TERMTYPE *const tp)
+ ENTRY *const tp)
{ /* void */ }
#undef _nc_copy_entry
@@ -4283,8 +4325,8 @@ void _nc_wrap_entry(
#undef _nc_merge_entry
void _nc_merge_entry(
- TERMTYPE *const to,
- TERMTYPE *const from)
+ ENTRY *const target,
+ ENTRY *const source)
{ /* void */ }
/* ./tinfo/captoinfo.c */
@@ -4316,11 +4358,8 @@ char *_nc_tic_expand(
#undef _nc_check_termtype2
void (*_nc_check_termtype2)(
- TERMTYPE *p1,
+ TERMTYPE2 *p1,
NCURSES_BOOL p2);
-#undef _nc_check_termtype
-void (*_nc_check_termtype)(
- TERMTYPE *p1);
#undef _nc_entry_match
NCURSES_BOOL _nc_entry_match(
@@ -4344,11 +4383,6 @@ int _nc_resolve_uses2(
NCURSES_BOOL literal)
{ return(*(int *)0); }
-#undef _nc_resolve_uses
-int _nc_resolve_uses(
- NCURSES_BOOL fullresolve)
- { return(*(int *)0); }
-
/* ./tinfo/comp_scan.c */
#undef _nc_syntax
@@ -4399,7 +4433,7 @@ void _nc_panic_mode(
#undef _nc_parse_entry
int _nc_parse_entry(
- struct entry *entryp,
+ ENTRY *entryp,
int literal,
NCURSES_BOOL silent)
{ return(*(int *)0); }
@@ -4410,23 +4444,26 @@ int _nc_capcmp(
const char *t)
{ return(*(int *)0); }
-typedef struct {
- const char *from;
- const char *to;
-} assoc;
-
/* ./tinfo/write_entry.c */
#undef _nc_set_writedir
void _nc_set_writedir(
- char *dir)
+ const char *dir)
{ /* void */ }
#undef _nc_write_entry
void _nc_write_entry(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
+#undef _nc_write_object
+int _nc_write_object(
+ TERMTYPE2 *tp,
+ char *buffer,
+ unsigned *offset,
+ unsigned limit)
+ { return(*(int *)0); }
+
#undef _nc_tic_written
int _nc_tic_written(void)
{ return(*(int *)0); }
diff --git a/ncurses/llib-lncursestw b/ncurses/llib-lncursestw
index b1919c43e822..40a9f5ed87ac 100644
--- a/ncurses/llib-lncursestw
+++ b/ncurses/llib-lncursestw
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2009-2011,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 2009-2018,2019 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 2009-on *
+ * Author: Thomas E. Dickey 2009-on *
****************************************************************************/
/* LINTLIBRARY */
@@ -95,8 +95,6 @@ void _nc_scroll_oldhash(
/* ./base/lib_addch.c */
-#include <ctype.h>
-
#undef _nc_render
cchar_t _nc_render(
WINDOW *win,
@@ -221,7 +219,7 @@ int wchgat(
WINDOW *win,
int n,
attr_t attr,
- short color,
+ short pair_arg,
const void *opts)
{ return(*(int *)0); }
@@ -256,8 +254,6 @@ int wclrtoeol(
/* ./base/lib_color.c */
-#include <tic.h>
-
#undef _nc_COLOR_PAIRS
int _nc_COLOR_PAIRS(void)
{ return(*(int *)0); }
@@ -284,6 +280,26 @@ int start_color_sp(
int start_color(void)
{ return(*(int *)0); }
+#undef _nc_change_pair
+void _nc_change_pair(
+ SCREEN *sp,
+ int pair)
+ { /* void */ }
+
+#undef _nc_reserve_pairs
+void _nc_reserve_pairs(
+ SCREEN *sp,
+ int want)
+ { /* void */ }
+
+#undef _nc_init_pair
+int _nc_init_pair(
+ SCREEN *sp,
+ int pair,
+ int f,
+ int b)
+ { return(*(int *)0); }
+
#undef init_pair_sp
int init_pair_sp(
SCREEN *sp,
@@ -299,6 +315,15 @@ int init_pair(
short b)
{ return(*(int *)0); }
+#undef _nc_init_color
+int _nc_init_color(
+ SCREEN *sp,
+ int color,
+ int r,
+ int g,
+ int b)
+ { return(*(int *)0); }
+
#undef init_color_sp
int init_color_sp(
SCREEN *sp,
@@ -351,6 +376,14 @@ int color_content(
short *b)
{ return(*(int *)0); }
+#undef _nc_pair_content
+int _nc_pair_content(
+ SCREEN *sp,
+ int pair,
+ int *f,
+ int *b)
+ { return(*(int *)0); }
+
#undef pair_content_sp
int pair_content_sp(
SCREEN *sp,
@@ -383,12 +416,85 @@ void _nc_do_color(
NCURSES_OUTC outc)
{ /* void */ }
+#undef init_extended_pair_sp
+int init_extended_pair_sp(
+ SCREEN *sp,
+ int pair,
+ int f,
+ int b)
+ { return(*(int *)0); }
+
+#undef init_extended_color_sp
+int init_extended_color_sp(
+ SCREEN *sp,
+ int color,
+ int r,
+ int g,
+ int b)
+ { return(*(int *)0); }
+
+#undef extended_color_content_sp
+int extended_color_content_sp(
+ SCREEN *sp,
+ int color,
+ int *r,
+ int *g,
+ int *b)
+ { return(*(int *)0); }
+
+#undef extended_pair_content_sp
+int extended_pair_content_sp(
+ SCREEN *sp,
+ int pair,
+ int *f,
+ int *b)
+ { return(*(int *)0); }
+
+#undef reset_color_pairs_sp
+void reset_color_pairs_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef init_extended_pair
+int init_extended_pair(
+ int pair,
+ int f,
+ int b)
+ { return(*(int *)0); }
+
+#undef init_extended_color
+int init_extended_color(
+ int color,
+ int r,
+ int g,
+ int b)
+ { return(*(int *)0); }
+
+#undef extended_color_content
+int extended_color_content(
+ int color,
+ int *r,
+ int *g,
+ int *b)
+ { return(*(int *)0); }
+
+#undef extended_pair_content
+int extended_pair_content(
+ int pair,
+ int *f,
+ int *b)
+ { return(*(int *)0); }
+
+#undef reset_color_pairs
+void reset_color_pairs(void)
+ { /* void */ }
+
/* ./base/lib_colorset.c */
#undef wcolor_set
int wcolor_set(
WINDOW *win,
- short color_pair_number,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
@@ -457,8 +563,6 @@ int flash(void)
/* ./lib_gen.c */
-#include <ncurses_cfg.h>
-
#undef addch
int (addch)(
const chtype z)
@@ -488,17 +592,17 @@ int (addstr)(
#undef attroff
int (attroff)(
- int z)
+ NCURSES_ATTR_T z)
{ return(*(int *)0); }
#undef attron
int (attron)(
- int z)
+ NCURSES_ATTR_T z)
{ return(*(int *)0); }
#undef attrset
int (attrset)(
- int z)
+ NCURSES_ATTR_T z)
{ return(*(int *)0); }
#undef attr_get
@@ -1081,20 +1185,6 @@ int (vline)(
int z)
{ return(*(int *)0); }
-#undef vw_printw
-int (vw_printw)(
- WINDOW *a1,
- const char *a2,
- va_list z)
- { return(*(int *)0); }
-
-#undef vw_scanw
-int (vw_scanw)(
- WINDOW *a1,
- char *a2,
- va_list z)
- { return(*(int *)0); }
-
#undef waddchstr
int (waddchstr)(
WINDOW *a1,
@@ -1295,6 +1385,11 @@ NCURSES_BOOL (is_syncok)(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
+#undef wgetdelay
+int (wgetdelay)(
+ const WINDOW *z)
+ { return(*(int *)0); }
+
#undef wgetscrreg
int (wgetscrreg)(
const WINDOW *a1,
@@ -1770,8 +1865,6 @@ NCURSES_BOOL (mouse_trafo)(
/* ./base/lib_getch.c */
-#include <fifo_defs.h>
-
#undef _nc_ESCDELAY
int _nc_ESCDELAY(void)
{ return(*(int *)0); }
@@ -2111,22 +2204,20 @@ void nofilter(void)
#undef newterm_sp
SCREEN *newterm_sp(
SCREEN *sp,
- char *name,
+ const char *name,
FILE *ofp,
FILE *ifp)
{ return(*(SCREEN **)0); }
#undef newterm
SCREEN *newterm(
- char *name,
+ const char *name,
FILE *ofp,
FILE *ifp)
{ return(*(SCREEN **)0); }
/* ./base/lib_newwin.c */
-#include "/usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h"
-
#undef _nc_freewin
int _nc_freewin(
WINDOW *win)
@@ -2330,6 +2421,13 @@ int vwprintw(
va_list argp)
{ return(*(int *)0); }
+#undef vw_printw
+int vw_printw(
+ WINDOW *win,
+ const char *fmt,
+ va_list argp)
+ { return(*(int *)0); }
+
/* ./base/lib_redrawln.c */
#undef wredrawln
@@ -2356,14 +2454,14 @@ int wnoutrefresh(
#undef restartterm_sp
int restartterm_sp(
SCREEN *sp,
- char *termp,
+ const char *termp,
int filenum,
int *errret)
{ return(*(int *)0); }
#undef restartterm
int restartterm(
- char *termp,
+ const char *termp,
int filenum,
int *errret)
{ return(*(int *)0); }
@@ -2373,20 +2471,27 @@ int restartterm(
#undef vwscanw
int vwscanw(
WINDOW *win,
- char *fmt,
+ const char *fmt,
+ va_list argp)
+ { return(*(int *)0); }
+
+#undef vw_scanw
+int vw_scanw(
+ WINDOW *win,
+ const char *fmt,
va_list argp)
{ return(*(int *)0); }
#undef scanw
int scanw(
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
#undef wscanw
int wscanw(
WINDOW *win,
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
@@ -2394,7 +2499,7 @@ int wscanw(
int mvscanw(
int y,
int x,
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
@@ -2403,7 +2508,7 @@ int mvwscanw(
WINDOW *win,
int y,
int x,
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
@@ -2592,14 +2697,14 @@ int slk_restore(void)
int slk_attr_set_sp(
SCREEN *sp,
const attr_t attr,
- short color_pair_number,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
#undef slk_attr_set
int slk_attr_set(
const attr_t attr,
- short color_pair_number,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
@@ -2669,12 +2774,23 @@ int slk_clear(void)
#undef slk_color_sp
int slk_color_sp(
SCREEN *sp,
- short color_pair_number)
+ short pair_arg)
{ return(*(int *)0); }
#undef slk_color
int slk_color(
- short color_pair_number)
+ short pair_arg)
+ { return(*(int *)0); }
+
+#undef extended_slk_color_sp
+int extended_slk_color_sp(
+ SCREEN *sp,
+ int pair_arg)
+ { return(*(int *)0); }
+
+#undef extended_slk_color
+int extended_slk_color(
+ int pair_arg)
{ return(*(int *)0); }
/* ./base/lib_slkinit.c */
@@ -2725,8 +2841,6 @@ int slk_refresh(void)
/* ./base/lib_slkset.c */
-#include <wctype.h>
-
#undef slk_set_sp
int slk_set_sp(
SCREEN *sp,
@@ -2784,6 +2898,12 @@ void _tracedump(
/* ./trace/lib_tracemse.c */
+#undef _nc_trace_mmask_t
+char *_nc_trace_mmask_t(
+ SCREEN *sp,
+ mmask_t code)
+ { return(*(char **)0); }
+
#undef _nc_tracemouse
char *_nc_tracemouse(
SCREEN *sp,
@@ -2803,8 +2923,6 @@ char *_tracemouse(
/* ./tty/lib_tstp.c */
-#include <SigAction.h>
-
#undef _nc_signal_handler
void _nc_signal_handler(
int enable)
@@ -2965,9 +3083,6 @@ char *_nc_printf_string(
/* ./tty/tty_update.c */
-#include <sys/time.h>
-#include <sys/times.h>
-
#undef doupdate_sp
int doupdate_sp(
SCREEN *sp)
@@ -3034,10 +3149,6 @@ void _nc_do_xmc_glitch(
/* ./trace/varargs.c */
-typedef enum {
- atUnknown = 0, atInteger, atFloat, atPoint, atString
-} ARGTYPE;
-
#undef _nc_varargs
char *_nc_varargs(
const char *fmt,
@@ -3067,6 +3178,11 @@ void _nc_free_and_exit(
int code)
{ /* void */ }
+#undef exit_curses
+void exit_curses(
+ int code)
+ { /* void */ }
+
/* ./widechar/charable.c */
#undef _nc_is_charable
@@ -3120,7 +3236,7 @@ int setcchar(
cchar_t *wcval,
const wchar_t *wch,
const attr_t attrs,
- short color_pair,
+ short pair_arg,
const void *opts)
{ return(*(int *)0); }
@@ -3129,7 +3245,7 @@ int getcchar(
const cchar_t *wcval,
wchar_t *wch,
attr_t *attrs,
- short *color_pair,
+ short *pair_arg,
void *opts)
{ return(*(int *)0); }
@@ -3227,9 +3343,9 @@ int winwstr(
/* ./widechar/lib_key_name.c */
#undef key_name
-char *key_name(
+const char *key_name(
wchar_t c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./widechar/lib_pecho_wchar.c */
@@ -3274,7 +3390,7 @@ int unget_wch(
int vid_puts_sp(
SCREEN *sp,
attr_t newmode,
- short pair,
+ short pair_arg,
void *opts,
NCURSES_OUTC_sp outc)
{ return(*(int *)0); }
@@ -3282,7 +3398,7 @@ int vid_puts_sp(
#undef vid_puts
int vid_puts(
attr_t newmode,
- short pair,
+ short pair_arg,
void *opts,
NCURSES_OUTC outc)
{ return(*(int *)0); }
@@ -3291,14 +3407,14 @@ int vid_puts(
int vid_attr_sp(
SCREEN *sp,
attr_t newmode,
- short pair,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
#undef vid_attr
int vid_attr(
attr_t newmode,
- short pair,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
@@ -3441,6 +3557,72 @@ int mcprint(
int len)
{ return(*(int *)0); }
+/* ./base/new_pair.c */
+
+#undef _nc_free_ordered_pairs
+void _nc_free_ordered_pairs(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_reset_color_pair
+void _nc_reset_color_pair(
+ SCREEN *sp,
+ int pair,
+ colorpair_t *next)
+ { /* void */ }
+
+#undef _nc_set_color_pair
+void _nc_set_color_pair(
+ SCREEN *sp,
+ int pair,
+ int mode)
+ { /* void */ }
+
+#undef _nc_copy_pairs
+void _nc_copy_pairs(
+ SCREEN *sp,
+ colorpair_t *target,
+ colorpair_t *source,
+ int length)
+ { /* void */ }
+
+#undef alloc_pair_sp
+int alloc_pair_sp(
+ SCREEN *sp,
+ int fg,
+ int bg)
+ { return(*(int *)0); }
+
+#undef find_pair_sp
+int find_pair_sp(
+ SCREEN *sp,
+ int fg,
+ int bg)
+ { return(*(int *)0); }
+
+#undef free_pair_sp
+int free_pair_sp(
+ SCREEN *sp,
+ int pair)
+ { return(*(int *)0); }
+
+#undef alloc_pair
+int alloc_pair(
+ int f,
+ int b)
+ { return(*(int *)0); }
+
+#undef find_pair
+int find_pair(
+ int f,
+ int b)
+ { return(*(int *)0); }
+
+#undef free_pair
+int free_pair(
+ int pair)
+ { return(*(int *)0); }
+
/* ./base/resizeterm.c */
#undef is_term_resized_sp
@@ -3571,8 +3753,8 @@ int _nc_add_to_try(
#undef _nc_align_termtype
void _nc_align_termtype(
- TERMTYPE *to,
- TERMTYPE *from)
+ TERMTYPE2 *to,
+ TERMTYPE2 *from)
{ /* void */ }
#undef _nc_copy_termtype
@@ -3581,24 +3763,34 @@ void _nc_copy_termtype(
const TERMTYPE *src)
{ /* void */ }
+#undef _nc_copy_termtype2
+void _nc_copy_termtype2(
+ TERMTYPE2 *dst,
+ const TERMTYPE2 *src)
+ { /* void */ }
+
+#undef _nc_export_termtype2
+void _nc_export_termtype2(
+ TERMTYPE *dst,
+ const TERMTYPE2 *src)
+ { /* void */ }
+
/* ./codes.c */
#undef _nc_boolcodes
-char *const *_nc_boolcodes(void)
- { return(*(char **)0); }
+const char *const *_nc_boolcodes(void)
+ { return(*(const char **)0); }
#undef _nc_numcodes
-char *const *_nc_numcodes(void)
- { return(*(char **)0); }
+const char *const *_nc_numcodes(void)
+ { return(*(const char **)0); }
#undef _nc_strcodes
-char *const *_nc_strcodes(void)
- { return(*(char **)0); }
+const char *const *_nc_strcodes(void)
+ { return(*(const char **)0); }
/* ./comp_captab.c */
-#include <hashsize.h>
-
#undef _nc_get_table
const struct name_table_entry *_nc_get_table(
NCURSES_BOOL termcap)
@@ -3680,9 +3872,22 @@ struct name_table_entry const *_nc_find_type_entry(
NCURSES_BOOL termcap)
{ return(*(struct name_table_entry const **)0); }
-/* ./tinfo/db_iterator.c */
+#undef _nc_find_user_entry
+struct user_table_entry const *_nc_find_user_entry(
+ const char *string)
+ { return(*(struct user_table_entry const **)0); }
-#include <time.h>
+/* ./comp_userdefs.c */
+
+#undef _nc_get_userdefs_table
+const struct user_table_entry *_nc_get_userdefs_table(void)
+ { return(*(const struct user_table_entry **)0); }
+
+#undef _nc_get_hash_user
+const HashData *_nc_get_hash_user(void)
+ { return(*(const HashData **)0); }
+
+/* ./tinfo/db_iterator.c */
#undef _nc_tic_dir
const char *_nc_tic_dir(
@@ -3728,7 +3933,7 @@ ENTRY *_nc_tail;
#undef _nc_free_entry
void _nc_free_entry(
ENTRY *headp,
- TERMTYPE *tterm)
+ TERMTYPE2 *tterm)
{ /* void */ }
#undef _nc_free_entries
@@ -3736,18 +3941,22 @@ void _nc_free_entries(
ENTRY *headp)
{ /* void */ }
-#undef _nc_delink_entry
-ENTRY *_nc_delink_entry(
- ENTRY *headp,
- TERMTYPE *tterm)
- { return(*(ENTRY **)0); }
-
#undef _nc_leaks_tinfo
void _nc_leaks_tinfo(void)
{ /* void */ }
+#undef exit_terminfo
+void exit_terminfo(
+ int code)
+ { /* void */ }
+
/* ./fallback.c */
+#undef _nc_fallback2
+const TERMTYPE2 *_nc_fallback2(
+ const char *name)
+ { return(*(const TERMTYPE2 **)0); }
+
#undef _nc_fallback
const TERMTYPE *_nc_fallback(
const char *name)
@@ -3760,6 +3969,11 @@ void _nc_free_termtype(
TERMTYPE *ptr)
{ /* void */ }
+#undef _nc_free_termtype2
+void _nc_free_termtype2(
+ TERMTYPE2 *ptr)
+ { /* void */ }
+
#undef _nc_user_definable
NCURSES_BOOL _nc_user_definable;
@@ -3789,15 +4003,6 @@ char *_nc_home_terminfo(void)
/* ./tinfo/init_keytry.c */
-#if 0
-
-#include <init_keytry.h>
-
-#undef _nc_tinfo_fkeys
-const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0};
-
-#endif
-
#undef _nc_init_keytry
void _nc_init_keytry(
SCREEN *sp)
@@ -3820,11 +4025,9 @@ void _nc_init_acs(void)
/* ./tinfo/lib_baudrate.c */
-#include <termcap.h>
-
struct speed {
- int s;
- int sp;
+ int given_speed;
+ int actual_speed;
};
#undef _nc_baudrate
@@ -3989,15 +4192,15 @@ int flushinp(void)
struct kn { short offset; int code; };
#undef keyname_sp
-char *keyname_sp(
+const char *keyname_sp(
SCREEN *sp,
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef keyname
-char *keyname(
+const char *keyname(
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./tinfo/lib_longname.c */
@@ -4195,10 +4398,6 @@ int intrflush(
/* ./tinfo/lib_setup.c */
-#include <locale.h>
-#include <sys/ioctl.h>
-#include <langinfo.h>
-
#undef _nc_ttytype
char *_nc_ttytype(void)
{ return(*(char **)0); }
@@ -4283,7 +4482,7 @@ void _nc_update_screensize(
#undef _nc_setup_tinfo
int _nc_setup_tinfo(
const char *const tn,
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
#undef _nc_tinfo_cmdch
@@ -4307,19 +4506,27 @@ int _nc_locale_breaks_acs(
#undef _nc_setupterm
int _nc_setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret,
int reuse)
{ return(*(int *)0); }
+#undef _nc_find_prescr
+SCREEN *_nc_find_prescr(void)
+ { return(*(SCREEN **)0); }
+
+#undef _nc_forget_prescr
+void _nc_forget_prescr(void)
+ { /* void */ }
+
#undef new_prescr
SCREEN *new_prescr(void)
{ return(*(SCREEN **)0); }
#undef setupterm
int setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret)
{ return(*(int *)0); }
@@ -4338,12 +4545,6 @@ int tgetent_sp(
const char *name)
{ return(*(int *)0); }
-#if 0
-
-#include <capdefaults.c>
-
-#endif
-
#undef tgetent
int tgetent(
char *bufp,
@@ -4353,35 +4554,35 @@ int tgetent(
#undef tgetflag_sp
int tgetflag_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetflag
int tgetflag(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum_sp
int tgetnum_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum
int tgetnum(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetstr_sp
char *tgetstr_sp(
SCREEN *sp,
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
#undef tgetstr
char *tgetstr(
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
@@ -4410,34 +4611,34 @@ char *tgoto(
#undef tigetflag_sp
int tigetflag_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetflag
int tigetflag(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum_sp
int tigetnum_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum
int tigetnum(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetstr_sp
char *tigetstr_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(char **)0); }
#undef tigetstr
char *tigetstr(
- char *str)
+ const char *str)
{ return(*(char **)0); }
/* ./tinfo/lib_tparm.c */
@@ -4454,7 +4655,7 @@ int _nc_tparm_analyze(
#undef tparm
char *tparm(
- char *string,
+ const char *string,
...)
{ return(*(char **)0); }
@@ -4589,6 +4790,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)
@@ -4631,9 +4837,9 @@ const char *_nc_retrace_cptr(
{ return(*(const char **)0); }
#undef _nc_retrace_cvoid_ptr
-void *_nc_retrace_cvoid_ptr(
- void *code)
- { return(*(void **)0); }
+const void *_nc_retrace_cvoid_ptr(
+ const void *code)
+ { return(*(const void **)0); }
#undef _nc_retrace_void_ptr
void *_nc_retrace_void_ptr(
@@ -4650,6 +4856,13 @@ WINDOW *_nc_retrace_win(
WINDOW *code)
{ return(*(WINDOW **)0); }
+#undef _nc_fmt_funcptr
+char *_nc_fmt_funcptr(
+ char *target,
+ const char *source,
+ size_t size)
+ { return(*(char **)0); }
+
#undef _nc_use_tracef
int _nc_use_tracef(
unsigned mask)
@@ -4719,11 +4932,6 @@ char *_tracecchar_t(
/* ./trace/lib_tracebits.c */
-typedef struct {
- unsigned int val;
- const char *name;
-} BITNAMES;
-
#undef _nc_trace_ttymode
char *_nc_trace_ttymode(
struct termios *tty)
@@ -4851,28 +5059,28 @@ int _nc_name_match(
/* ./names.c */
#undef _nc_boolnames
-char *const *_nc_boolnames(void)
- { return(*(char **)0); }
+const char *const *_nc_boolnames(void)
+ { return(*(const char **)0); }
#undef _nc_boolfnames
-char *const *_nc_boolfnames(void)
- { return(*(char **)0); }
+const char *const *_nc_boolfnames(void)
+ { return(*(const char **)0); }
#undef _nc_numnames
-char *const *_nc_numnames(void)
- { return(*(char **)0); }
+const char *const *_nc_numnames(void)
+ { return(*(const char **)0); }
#undef _nc_numfnames
-char *const *_nc_numfnames(void)
- { return(*(char **)0); }
+const char *const *_nc_numfnames(void)
+ { return(*(const char **)0); }
#undef _nc_strnames
-char *const *_nc_strnames(void)
- { return(*(char **)0); }
+const char *const *_nc_strnames(void)
+ { return(*(const char **)0); }
#undef _nc_strfnames
-char *const *_nc_strfnames(void)
- { return(*(char **)0); }
+const char *const *_nc_strfnames(void)
+ { return(*(const char **)0); }
/* ./tinfo/obsolete.c */
@@ -4891,16 +5099,14 @@ void _nc_set_buffer(
/* ./tinfo/read_entry.c */
-#include <hashed_db.h>
-
#undef _nc_init_termtype
void _nc_init_termtype(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
#undef _nc_read_termtype
int _nc_read_termtype(
- TERMTYPE *ptr,
+ TERMTYPE2 *ptr,
char *buffer,
int limit)
{ return(*(int *)0); }
@@ -4908,7 +5114,14 @@ int _nc_read_termtype(
#undef _nc_read_file_entry
int _nc_read_file_entry(
const char *const filename,
- TERMTYPE *ptr)
+ TERMTYPE2 *ptr)
+ { return(*(int *)0); }
+
+#undef _nc_read_entry2
+int _nc_read_entry2(
+ const char *const name,
+ char *const filename,
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
#undef _nc_read_entry
@@ -4920,11 +5133,11 @@ int _nc_read_entry(
/* ./tinfo/read_termcap.c */
-#include <sys/types.h>
-
-#undef _nc_read_termcap
-void _nc_read_termcap(void)
- { /* void */ }
+#undef _nc_read_termcap_entry
+int _nc_read_termcap_entry(
+ const char *const tn,
+ TERMTYPE2 *const tp)
+ { return(*(int *)0); }
/* ./tinfo/strings.c */
@@ -5006,21 +5219,21 @@ int _nc_remove_string(
#undef _nc_trim_sgr0
char *_nc_trim_sgr0(
- TERMTYPE *tp)
+ TERMTYPE2 *tp)
{ return(*(char **)0); }
/* ./unctrl.c */
#undef unctrl_sp
-char *unctrl_sp(
+const char *unctrl_sp(
SCREEN *sp,
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef unctrl
-char *unctrl(
+const char *unctrl(
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./trace/visbuf.c */
@@ -5080,7 +5293,7 @@ const char *_nc_viscbuf(
#undef _nc_init_entry
void _nc_init_entry(
- TERMTYPE *const tp)
+ ENTRY *const tp)
{ /* void */ }
#undef _nc_copy_entry
@@ -5101,8 +5314,8 @@ void _nc_wrap_entry(
#undef _nc_merge_entry
void _nc_merge_entry(
- TERMTYPE *const to,
- TERMTYPE *const from)
+ ENTRY *const target,
+ ENTRY *const source)
{ /* void */ }
/* ./tinfo/captoinfo.c */
@@ -5134,11 +5347,8 @@ char *_nc_tic_expand(
#undef _nc_check_termtype2
void (*_nc_check_termtype2)(
- TERMTYPE *p1,
+ TERMTYPE2 *p1,
NCURSES_BOOL p2);
-#undef _nc_check_termtype
-void (*_nc_check_termtype)(
- TERMTYPE *p1);
#undef _nc_entry_match
NCURSES_BOOL _nc_entry_match(
@@ -5162,11 +5372,6 @@ int _nc_resolve_uses2(
NCURSES_BOOL literal)
{ return(*(int *)0); }
-#undef _nc_resolve_uses
-int _nc_resolve_uses(
- NCURSES_BOOL fullresolve)
- { return(*(int *)0); }
-
/* ./tinfo/comp_scan.c */
#undef _nc_syntax
@@ -5217,7 +5422,7 @@ void _nc_panic_mode(
#undef _nc_parse_entry
int _nc_parse_entry(
- struct entry *entryp,
+ ENTRY *entryp,
int literal,
NCURSES_BOOL silent)
{ return(*(int *)0); }
@@ -5228,23 +5433,26 @@ int _nc_capcmp(
const char *t)
{ return(*(int *)0); }
-typedef struct {
- const char *from;
- const char *to;
-} assoc;
-
/* ./tinfo/write_entry.c */
#undef _nc_set_writedir
void _nc_set_writedir(
- char *dir)
+ const char *dir)
{ /* void */ }
#undef _nc_write_entry
void _nc_write_entry(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
+#undef _nc_write_object
+int _nc_write_object(
+ TERMTYPE2 *tp,
+ char *buffer,
+ unsigned *offset,
+ unsigned limit)
+ { return(*(int *)0); }
+
#undef _nc_tic_written
int _nc_tic_written(void)
{ return(*(int *)0); }
diff --git a/ncurses/llib-lncursesw b/ncurses/llib-lncursesw
index be768d716b9c..ae5581160f50 100644
--- a/ncurses/llib-lncursesw
+++ b/ncurses/llib-lncursesw
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2001-2011,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 2001-2018,2019 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 2001-on *
+ * Author: Thomas E. Dickey 2001-on *
****************************************************************************/
/* LINTLIBRARY */
@@ -95,8 +95,6 @@ void _nc_scroll_oldhash(
/* ./base/lib_addch.c */
-#include <ctype.h>
-
#undef _nc_render
cchar_t _nc_render(
WINDOW *win,
@@ -221,7 +219,7 @@ int wchgat(
WINDOW *win,
int n,
attr_t attr,
- short color,
+ short pair_arg,
const void *opts)
{ return(*(int *)0); }
@@ -256,8 +254,6 @@ int wclrtoeol(
/* ./base/lib_color.c */
-#include <tic.h>
-
#undef COLOR_PAIRS
int COLOR_PAIRS;
#undef COLORS
@@ -281,6 +277,26 @@ int start_color_sp(
int start_color(void)
{ return(*(int *)0); }
+#undef _nc_change_pair
+void _nc_change_pair(
+ SCREEN *sp,
+ int pair)
+ { /* void */ }
+
+#undef _nc_reserve_pairs
+void _nc_reserve_pairs(
+ SCREEN *sp,
+ int want)
+ { /* void */ }
+
+#undef _nc_init_pair
+int _nc_init_pair(
+ SCREEN *sp,
+ int pair,
+ int f,
+ int b)
+ { return(*(int *)0); }
+
#undef init_pair_sp
int init_pair_sp(
SCREEN *sp,
@@ -296,6 +312,15 @@ int init_pair(
short b)
{ return(*(int *)0); }
+#undef _nc_init_color
+int _nc_init_color(
+ SCREEN *sp,
+ int color,
+ int r,
+ int g,
+ int b)
+ { return(*(int *)0); }
+
#undef init_color_sp
int init_color_sp(
SCREEN *sp,
@@ -348,6 +373,14 @@ int color_content(
short *b)
{ return(*(int *)0); }
+#undef _nc_pair_content
+int _nc_pair_content(
+ SCREEN *sp,
+ int pair,
+ int *f,
+ int *b)
+ { return(*(int *)0); }
+
#undef pair_content_sp
int pair_content_sp(
SCREEN *sp,
@@ -380,12 +413,85 @@ void _nc_do_color(
NCURSES_OUTC outc)
{ /* void */ }
+#undef init_extended_pair_sp
+int init_extended_pair_sp(
+ SCREEN *sp,
+ int pair,
+ int f,
+ int b)
+ { return(*(int *)0); }
+
+#undef init_extended_color_sp
+int init_extended_color_sp(
+ SCREEN *sp,
+ int color,
+ int r,
+ int g,
+ int b)
+ { return(*(int *)0); }
+
+#undef extended_color_content_sp
+int extended_color_content_sp(
+ SCREEN *sp,
+ int color,
+ int *r,
+ int *g,
+ int *b)
+ { return(*(int *)0); }
+
+#undef extended_pair_content_sp
+int extended_pair_content_sp(
+ SCREEN *sp,
+ int pair,
+ int *f,
+ int *b)
+ { return(*(int *)0); }
+
+#undef reset_color_pairs_sp
+void reset_color_pairs_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef init_extended_pair
+int init_extended_pair(
+ int pair,
+ int f,
+ int b)
+ { return(*(int *)0); }
+
+#undef init_extended_color
+int init_extended_color(
+ int color,
+ int r,
+ int g,
+ int b)
+ { return(*(int *)0); }
+
+#undef extended_color_content
+int extended_color_content(
+ int color,
+ int *r,
+ int *g,
+ int *b)
+ { return(*(int *)0); }
+
+#undef extended_pair_content
+int extended_pair_content(
+ int pair,
+ int *f,
+ int *b)
+ { return(*(int *)0); }
+
+#undef reset_color_pairs
+void reset_color_pairs(void)
+ { /* void */ }
+
/* ./base/lib_colorset.c */
#undef wcolor_set
int wcolor_set(
WINDOW *win,
- short color_pair_number,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
@@ -454,8 +560,6 @@ int flash(void)
/* ./lib_gen.c */
-#include <ncurses_cfg.h>
-
#undef addch
int (addch)(
const chtype z)
@@ -485,17 +589,17 @@ int (addstr)(
#undef attroff
int (attroff)(
- int z)
+ NCURSES_ATTR_T z)
{ return(*(int *)0); }
#undef attron
int (attron)(
- int z)
+ NCURSES_ATTR_T z)
{ return(*(int *)0); }
#undef attrset
int (attrset)(
- int z)
+ NCURSES_ATTR_T z)
{ return(*(int *)0); }
#undef attr_get
@@ -1078,20 +1182,6 @@ int (vline)(
int z)
{ return(*(int *)0); }
-#undef vw_printw
-int (vw_printw)(
- WINDOW *a1,
- const char *a2,
- va_list z)
- { return(*(int *)0); }
-
-#undef vw_scanw
-int (vw_scanw)(
- WINDOW *a1,
- char *a2,
- va_list z)
- { return(*(int *)0); }
-
#undef waddchstr
int (waddchstr)(
WINDOW *a1,
@@ -1292,6 +1382,11 @@ NCURSES_BOOL (is_syncok)(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
+#undef wgetdelay
+int (wgetdelay)(
+ const WINDOW *z)
+ { return(*(int *)0); }
+
#undef wgetscrreg
int (wgetscrreg)(
const WINDOW *a1,
@@ -1767,8 +1862,6 @@ NCURSES_BOOL (mouse_trafo)(
/* ./base/lib_getch.c */
-#include <fifo_defs.h>
-
#undef ESCDELAY
int ESCDELAY;
@@ -2102,22 +2195,20 @@ void nofilter(void)
#undef newterm_sp
SCREEN *newterm_sp(
SCREEN *sp,
- char *name,
+ const char *name,
FILE *ofp,
FILE *ifp)
{ return(*(SCREEN **)0); }
#undef newterm
SCREEN *newterm(
- char *name,
+ const char *name,
FILE *ofp,
FILE *ifp)
{ return(*(SCREEN **)0); }
/* ./base/lib_newwin.c */
-#include "/usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h"
-
#undef _nc_freewin
int _nc_freewin(
WINDOW *win)
@@ -2321,6 +2412,13 @@ int vwprintw(
va_list argp)
{ return(*(int *)0); }
+#undef vw_printw
+int vw_printw(
+ WINDOW *win,
+ const char *fmt,
+ va_list argp)
+ { return(*(int *)0); }
+
/* ./base/lib_redrawln.c */
#undef wredrawln
@@ -2347,14 +2445,14 @@ int wnoutrefresh(
#undef restartterm_sp
int restartterm_sp(
SCREEN *sp,
- char *termp,
+ const char *termp,
int filenum,
int *errret)
{ return(*(int *)0); }
#undef restartterm
int restartterm(
- char *termp,
+ const char *termp,
int filenum,
int *errret)
{ return(*(int *)0); }
@@ -2364,20 +2462,27 @@ int restartterm(
#undef vwscanw
int vwscanw(
WINDOW *win,
- char *fmt,
+ const char *fmt,
+ va_list argp)
+ { return(*(int *)0); }
+
+#undef vw_scanw
+int vw_scanw(
+ WINDOW *win,
+ const char *fmt,
va_list argp)
{ return(*(int *)0); }
#undef scanw
int scanw(
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
#undef wscanw
int wscanw(
WINDOW *win,
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
@@ -2385,7 +2490,7 @@ int wscanw(
int mvscanw(
int y,
int x,
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
@@ -2394,7 +2499,7 @@ int mvwscanw(
WINDOW *win,
int y,
int x,
- char *fmt,
+ const char *fmt,
...)
{ return(*(int *)0); }
@@ -2583,14 +2688,14 @@ int slk_restore(void)
int slk_attr_set_sp(
SCREEN *sp,
const attr_t attr,
- short color_pair_number,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
#undef slk_attr_set
int slk_attr_set(
const attr_t attr,
- short color_pair_number,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
@@ -2660,12 +2765,23 @@ int slk_clear(void)
#undef slk_color_sp
int slk_color_sp(
SCREEN *sp,
- short color_pair_number)
+ short pair_arg)
{ return(*(int *)0); }
#undef slk_color
int slk_color(
- short color_pair_number)
+ short pair_arg)
+ { return(*(int *)0); }
+
+#undef extended_slk_color_sp
+int extended_slk_color_sp(
+ SCREEN *sp,
+ int pair_arg)
+ { return(*(int *)0); }
+
+#undef extended_slk_color
+int extended_slk_color(
+ int pair_arg)
{ return(*(int *)0); }
/* ./base/lib_slkinit.c */
@@ -2716,8 +2832,6 @@ int slk_refresh(void)
/* ./base/lib_slkset.c */
-#include <wctype.h>
-
#undef slk_set_sp
int slk_set_sp(
SCREEN *sp,
@@ -2775,6 +2889,12 @@ void _tracedump(
/* ./trace/lib_tracemse.c */
+#undef _nc_trace_mmask_t
+char *_nc_trace_mmask_t(
+ SCREEN *sp,
+ mmask_t code)
+ { return(*(char **)0); }
+
#undef _nc_tracemouse
char *_nc_tracemouse(
SCREEN *sp,
@@ -2794,8 +2914,6 @@ char *_tracemouse(
/* ./tty/lib_tstp.c */
-#include <SigAction.h>
-
#undef _nc_signal_handler
void _nc_signal_handler(
int enable)
@@ -2956,9 +3074,6 @@ char *_nc_printf_string(
/* ./tty/tty_update.c */
-#include <sys/time.h>
-#include <sys/times.h>
-
#undef doupdate_sp
int doupdate_sp(
SCREEN *sp)
@@ -3025,10 +3140,6 @@ void _nc_do_xmc_glitch(
/* ./trace/varargs.c */
-typedef enum {
- atUnknown = 0, atInteger, atFloat, atPoint, atString
-} ARGTYPE;
-
#undef _nc_varargs
char *_nc_varargs(
const char *fmt,
@@ -3058,6 +3169,11 @@ void _nc_free_and_exit(
int code)
{ /* void */ }
+#undef exit_curses
+void exit_curses(
+ int code)
+ { /* void */ }
+
/* ./widechar/charable.c */
#undef _nc_is_charable
@@ -3111,7 +3227,7 @@ int setcchar(
cchar_t *wcval,
const wchar_t *wch,
const attr_t attrs,
- short color_pair,
+ short pair_arg,
const void *opts)
{ return(*(int *)0); }
@@ -3120,7 +3236,7 @@ int getcchar(
const cchar_t *wcval,
wchar_t *wch,
attr_t *attrs,
- short *color_pair,
+ short *pair_arg,
void *opts)
{ return(*(int *)0); }
@@ -3218,9 +3334,9 @@ int winwstr(
/* ./widechar/lib_key_name.c */
#undef key_name
-char *key_name(
+const char *key_name(
wchar_t c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./widechar/lib_pecho_wchar.c */
@@ -3265,7 +3381,7 @@ int unget_wch(
int vid_puts_sp(
SCREEN *sp,
attr_t newmode,
- short pair,
+ short pair_arg,
void *opts,
NCURSES_OUTC_sp outc)
{ return(*(int *)0); }
@@ -3273,7 +3389,7 @@ int vid_puts_sp(
#undef vid_puts
int vid_puts(
attr_t newmode,
- short pair,
+ short pair_arg,
void *opts,
NCURSES_OUTC outc)
{ return(*(int *)0); }
@@ -3282,14 +3398,14 @@ int vid_puts(
int vid_attr_sp(
SCREEN *sp,
attr_t newmode,
- short pair,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
#undef vid_attr
int vid_attr(
attr_t newmode,
- short pair,
+ short pair_arg,
void *opts)
{ return(*(int *)0); }
@@ -3432,6 +3548,72 @@ int mcprint(
int len)
{ return(*(int *)0); }
+/* ./base/new_pair.c */
+
+#undef _nc_free_ordered_pairs
+void _nc_free_ordered_pairs(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_reset_color_pair
+void _nc_reset_color_pair(
+ SCREEN *sp,
+ int pair,
+ colorpair_t *next)
+ { /* void */ }
+
+#undef _nc_set_color_pair
+void _nc_set_color_pair(
+ SCREEN *sp,
+ int pair,
+ int mode)
+ { /* void */ }
+
+#undef _nc_copy_pairs
+void _nc_copy_pairs(
+ SCREEN *sp,
+ colorpair_t *target,
+ colorpair_t *source,
+ int length)
+ { /* void */ }
+
+#undef alloc_pair_sp
+int alloc_pair_sp(
+ SCREEN *sp,
+ int fg,
+ int bg)
+ { return(*(int *)0); }
+
+#undef find_pair_sp
+int find_pair_sp(
+ SCREEN *sp,
+ int fg,
+ int bg)
+ { return(*(int *)0); }
+
+#undef free_pair_sp
+int free_pair_sp(
+ SCREEN *sp,
+ int pair)
+ { return(*(int *)0); }
+
+#undef alloc_pair
+int alloc_pair(
+ int f,
+ int b)
+ { return(*(int *)0); }
+
+#undef find_pair
+int find_pair(
+ int f,
+ int b)
+ { return(*(int *)0); }
+
+#undef free_pair
+int free_pair(
+ int pair)
+ { return(*(int *)0); }
+
/* ./base/resizeterm.c */
#undef is_term_resized_sp
@@ -3562,8 +3744,8 @@ int _nc_add_to_try(
#undef _nc_align_termtype
void _nc_align_termtype(
- TERMTYPE *to,
- TERMTYPE *from)
+ TERMTYPE2 *to,
+ TERMTYPE2 *from)
{ /* void */ }
#undef _nc_copy_termtype
@@ -3572,19 +3754,29 @@ void _nc_copy_termtype(
const TERMTYPE *src)
{ /* void */ }
+#undef _nc_copy_termtype2
+void _nc_copy_termtype2(
+ TERMTYPE2 *dst,
+ const TERMTYPE2 *src)
+ { /* void */ }
+
+#undef _nc_export_termtype2
+void _nc_export_termtype2(
+ TERMTYPE *dst,
+ const TERMTYPE2 *src)
+ { /* void */ }
+
/* ./codes.c */
#undef boolcodes
-char *const boolcodes[] = {0};
+const char *const boolcodes[] = {0};
#undef numcodes
-char *const numcodes[] = {0};
+const char *const numcodes[] = {0};
#undef strcodes
-char *const strcodes[] = {0};
+const char *const strcodes[] = {0};
/* ./comp_captab.c */
-#include <hashsize.h>
-
#undef _nc_get_table
const struct name_table_entry *_nc_get_table(
NCURSES_BOOL termcap)
@@ -3666,9 +3858,22 @@ struct name_table_entry const *_nc_find_type_entry(
NCURSES_BOOL termcap)
{ return(*(struct name_table_entry const **)0); }
-/* ./tinfo/db_iterator.c */
+#undef _nc_find_user_entry
+struct user_table_entry const *_nc_find_user_entry(
+ const char *string)
+ { return(*(struct user_table_entry const **)0); }
-#include <time.h>
+/* ./comp_userdefs.c */
+
+#undef _nc_get_userdefs_table
+const struct user_table_entry *_nc_get_userdefs_table(void)
+ { return(*(const struct user_table_entry **)0); }
+
+#undef _nc_get_hash_user
+const HashData *_nc_get_hash_user(void)
+ { return(*(const HashData **)0); }
+
+/* ./tinfo/db_iterator.c */
#undef _nc_tic_dir
const char *_nc_tic_dir(
@@ -3714,7 +3919,7 @@ ENTRY *_nc_tail;
#undef _nc_free_entry
void _nc_free_entry(
ENTRY *headp,
- TERMTYPE *tterm)
+ TERMTYPE2 *tterm)
{ /* void */ }
#undef _nc_free_entries
@@ -3722,18 +3927,22 @@ void _nc_free_entries(
ENTRY *headp)
{ /* void */ }
-#undef _nc_delink_entry
-ENTRY *_nc_delink_entry(
- ENTRY *headp,
- TERMTYPE *tterm)
- { return(*(ENTRY **)0); }
-
#undef _nc_leaks_tinfo
void _nc_leaks_tinfo(void)
{ /* void */ }
+#undef exit_terminfo
+void exit_terminfo(
+ int code)
+ { /* void */ }
+
/* ./fallback.c */
+#undef _nc_fallback2
+const TERMTYPE2 *_nc_fallback2(
+ const char *name)
+ { return(*(const TERMTYPE2 **)0); }
+
#undef _nc_fallback
const TERMTYPE *_nc_fallback(
const char *name)
@@ -3746,6 +3955,11 @@ void _nc_free_termtype(
TERMTYPE *ptr)
{ /* void */ }
+#undef _nc_free_termtype2
+void _nc_free_termtype2(
+ TERMTYPE2 *ptr)
+ { /* void */ }
+
#undef _nc_user_definable
NCURSES_BOOL _nc_user_definable;
@@ -3775,15 +3989,6 @@ char *_nc_home_terminfo(void)
/* ./tinfo/init_keytry.c */
-#if 0
-
-#include <init_keytry.h>
-
-#undef _nc_tinfo_fkeys
-const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0};
-
-#endif
-
#undef _nc_init_keytry
void _nc_init_keytry(
SCREEN *sp)
@@ -3805,11 +4010,9 @@ void _nc_init_acs(void)
/* ./tinfo/lib_baudrate.c */
-#include <termcap.h>
-
struct speed {
- int s;
- int sp;
+ int given_speed;
+ int actual_speed;
};
#undef _nc_baudrate
@@ -3934,18 +4137,23 @@ int flushinp(void)
struct kn { short offset; int code; };
#undef keyname_sp
-char *keyname_sp(
+const char *keyname_sp(
SCREEN *sp,
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef keyname
-char *keyname(
+const char *keyname(
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./tinfo/lib_longname.c */
+#undef longname_sp
+char *longname_sp(
+ SCREEN *sp)
+ { return(*(char **)0); }
+
#undef longname
char *longname(void)
{ return(*(char **)0); }
@@ -4135,10 +4343,6 @@ int intrflush(
/* ./tinfo/lib_setup.c */
-#include <locale.h>
-#include <sys/ioctl.h>
-#include <langinfo.h>
-
#undef ttytype
char ttytype[256];
#undef LINES
@@ -4201,7 +4405,7 @@ void _nc_update_screensize(
#undef _nc_setup_tinfo
int _nc_setup_tinfo(
const char *const tn,
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
#undef _nc_tinfo_cmdch
@@ -4225,7 +4429,7 @@ int _nc_locale_breaks_acs(
#undef _nc_setupterm
int _nc_setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret,
int reuse)
@@ -4237,7 +4441,7 @@ SCREEN *new_prescr(void)
#undef setupterm
int setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret)
{ return(*(int *)0); }
@@ -4256,12 +4460,6 @@ int tgetent_sp(
const char *name)
{ return(*(int *)0); }
-#if 0
-
-#include <capdefaults.c>
-
-#endif
-
#undef tgetent
int tgetent(
char *bufp,
@@ -4271,35 +4469,35 @@ int tgetent(
#undef tgetflag_sp
int tgetflag_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetflag
int tgetflag(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum_sp
int tgetnum_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum
int tgetnum(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetstr_sp
char *tgetstr_sp(
SCREEN *sp,
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
#undef tgetstr
char *tgetstr(
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
@@ -4328,34 +4526,34 @@ char *tgoto(
#undef tigetflag_sp
int tigetflag_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetflag
int tigetflag(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum_sp
int tigetnum_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum
int tigetnum(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetstr_sp
char *tigetstr_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(char **)0); }
#undef tigetstr
char *tigetstr(
- char *str)
+ const char *str)
{ return(*(char **)0); }
/* ./tinfo/lib_tparm.c */
@@ -4372,7 +4570,7 @@ int _nc_tparm_analyze(
#undef tparm
char *tparm(
- char *string,
+ const char *string,
...)
{ return(*(char **)0); }
@@ -4493,6 +4691,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)
@@ -4535,9 +4738,9 @@ const char *_nc_retrace_cptr(
{ return(*(const char **)0); }
#undef _nc_retrace_cvoid_ptr
-void *_nc_retrace_cvoid_ptr(
- void *code)
- { return(*(void **)0); }
+const void *_nc_retrace_cvoid_ptr(
+ const void *code)
+ { return(*(const void **)0); }
#undef _nc_retrace_void_ptr
void *_nc_retrace_void_ptr(
@@ -4554,6 +4757,13 @@ WINDOW *_nc_retrace_win(
WINDOW *code)
{ return(*(WINDOW **)0); }
+#undef _nc_fmt_funcptr
+char *_nc_fmt_funcptr(
+ char *target,
+ const char *source,
+ size_t size)
+ { return(*(char **)0); }
+
/* ./trace/lib_traceatr.c */
#undef _traceattr2
@@ -4612,11 +4822,6 @@ char *_tracecchar_t(
/* ./trace/lib_tracebits.c */
-typedef struct {
- unsigned int val;
- const char *name;
-} BITNAMES;
-
#undef _nc_trace_ttymode
char *_nc_trace_ttymode(
struct termios *tty)
@@ -4744,17 +4949,17 @@ int _nc_name_match(
/* ./names.c */
#undef boolnames
-char *const boolnames[] = {0};
+const char *const boolnames[] = {0};
#undef boolfnames
-char *const boolfnames[] = {0};
+const char *const boolfnames[] = {0};
#undef numnames
-char *const numnames[] = {0};
+const char *const numnames[] = {0};
#undef numfnames
-char *const numfnames[] = {0};
+const char *const numfnames[] = {0};
#undef strnames
-char *const strnames[] = {0};
+const char *const strnames[] = {0};
#undef strfnames
-char *const strfnames[] = {0};
+const char *const strfnames[] = {0};
/* ./tinfo/obsolete.c */
@@ -4773,16 +4978,14 @@ void _nc_set_buffer(
/* ./tinfo/read_entry.c */
-#include <hashed_db.h>
-
#undef _nc_init_termtype
void _nc_init_termtype(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
#undef _nc_read_termtype
int _nc_read_termtype(
- TERMTYPE *ptr,
+ TERMTYPE2 *ptr,
char *buffer,
int limit)
{ return(*(int *)0); }
@@ -4790,7 +4993,14 @@ int _nc_read_termtype(
#undef _nc_read_file_entry
int _nc_read_file_entry(
const char *const filename,
- TERMTYPE *ptr)
+ TERMTYPE2 *ptr)
+ { return(*(int *)0); }
+
+#undef _nc_read_entry2
+int _nc_read_entry2(
+ const char *const name,
+ char *const filename,
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
#undef _nc_read_entry
@@ -4802,11 +5012,11 @@ int _nc_read_entry(
/* ./tinfo/read_termcap.c */
-#include <sys/types.h>
-
-#undef _nc_read_termcap
-void _nc_read_termcap(void)
- { /* void */ }
+#undef _nc_read_termcap_entry
+int _nc_read_termcap_entry(
+ const char *const tn,
+ TERMTYPE2 *const tp)
+ { return(*(int *)0); }
/* ./tinfo/strings.c */
@@ -4888,21 +5098,21 @@ int _nc_remove_string(
#undef _nc_trim_sgr0
char *_nc_trim_sgr0(
- TERMTYPE *tp)
+ TERMTYPE2 *tp)
{ return(*(char **)0); }
/* ./unctrl.c */
#undef unctrl_sp
-char *unctrl_sp(
+const char *unctrl_sp(
SCREEN *sp,
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef unctrl
-char *unctrl(
+const char *unctrl(
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./trace/visbuf.c */
@@ -4962,7 +5172,7 @@ const char *_nc_viscbuf(
#undef _nc_init_entry
void _nc_init_entry(
- TERMTYPE *const tp)
+ ENTRY *const tp)
{ /* void */ }
#undef _nc_copy_entry
@@ -4983,8 +5193,8 @@ void _nc_wrap_entry(
#undef _nc_merge_entry
void _nc_merge_entry(
- TERMTYPE *const to,
- TERMTYPE *const from)
+ ENTRY *const target,
+ ENTRY *const source)
{ /* void */ }
/* ./tinfo/captoinfo.c */
@@ -5016,11 +5226,8 @@ char *_nc_tic_expand(
#undef _nc_check_termtype2
void (*_nc_check_termtype2)(
- TERMTYPE *p1,
+ TERMTYPE2 *p1,
NCURSES_BOOL p2);
-#undef _nc_check_termtype
-void (*_nc_check_termtype)(
- TERMTYPE *p1);
#undef _nc_entry_match
NCURSES_BOOL _nc_entry_match(
@@ -5044,11 +5251,6 @@ int _nc_resolve_uses2(
NCURSES_BOOL literal)
{ return(*(int *)0); }
-#undef _nc_resolve_uses
-int _nc_resolve_uses(
- NCURSES_BOOL fullresolve)
- { return(*(int *)0); }
-
/* ./tinfo/comp_scan.c */
#undef _nc_syntax
@@ -5099,7 +5301,7 @@ void _nc_panic_mode(
#undef _nc_parse_entry
int _nc_parse_entry(
- struct entry *entryp,
+ ENTRY *entryp,
int literal,
NCURSES_BOOL silent)
{ return(*(int *)0); }
@@ -5110,23 +5312,26 @@ int _nc_capcmp(
const char *t)
{ return(*(int *)0); }
-typedef struct {
- const char *from;
- const char *to;
-} assoc;
-
/* ./tinfo/write_entry.c */
#undef _nc_set_writedir
void _nc_set_writedir(
- char *dir)
+ const char *dir)
{ /* void */ }
#undef _nc_write_entry
void _nc_write_entry(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
+#undef _nc_write_object
+int _nc_write_object(
+ TERMTYPE2 *tp,
+ char *buffer,
+ unsigned *offset,
+ unsigned limit)
+ { return(*(int *)0); }
+
#undef _nc_tic_written
int _nc_tic_written(void)
{ return(*(int *)0); }
diff --git a/ncurses/llib-ltic b/ncurses/llib-ltic
index 981bb196706a..15b010c508cb 100644
--- a/ncurses/llib-ltic
+++ b/ncurses/llib-ltic
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2012 Free Software Foundation, Inc. *
+ * Copyright (c) 2012-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 *
@@ -27,18 +27,17 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 2012 *
+ * Author: Thomas E. Dickey 2012-on *
****************************************************************************/
/* LINTLIBRARY */
/* ./tinfo/alloc_entry.c */
#include <curses.priv.h>
-#include <tic.h>
#undef _nc_init_entry
void _nc_init_entry(
- TERMTYPE *const tp)
+ ENTRY *const tp)
{ /* void */ }
#undef _nc_copy_entry
@@ -59,14 +58,12 @@ void _nc_wrap_entry(
#undef _nc_merge_entry
void _nc_merge_entry(
- TERMTYPE *const to,
- TERMTYPE *const from)
+ ENTRY *const target,
+ ENTRY *const source)
{ /* void */ }
/* ./tinfo/captoinfo.c */
-#include <ctype.h>
-
#undef _nc_captoinfo
char *_nc_captoinfo(
const char *cap,
@@ -94,11 +91,8 @@ char *_nc_tic_expand(
#undef _nc_check_termtype2
void (*_nc_check_termtype2)(
- TERMTYPE *p1,
+ TERMTYPE2 *p1,
NCURSES_BOOL p2);
-#undef _nc_check_termtype
-void (*_nc_check_termtype)(
- TERMTYPE *p1);
#undef _nc_entry_match
NCURSES_BOOL _nc_entry_match(
@@ -122,11 +116,6 @@ int _nc_resolve_uses2(
NCURSES_BOOL literal)
{ return(*(int *)0); }
-#undef _nc_resolve_uses
-int _nc_resolve_uses(
- NCURSES_BOOL fullresolve)
- { return(*(int *)0); }
-
/* ./tinfo/comp_scan.c */
#undef _nc_syntax
@@ -177,7 +166,7 @@ void _nc_panic_mode(
#undef _nc_parse_entry
int _nc_parse_entry(
- struct entry *entryp,
+ ENTRY *entryp,
int literal,
NCURSES_BOOL silent)
{ return(*(int *)0); }
@@ -188,25 +177,26 @@ int _nc_capcmp(
const char *t)
{ return(*(int *)0); }
-typedef struct {
- const char *from;
- const char *to;
-} assoc;
-
/* ./tinfo/write_entry.c */
-#include <hashed_db.h>
-
#undef _nc_set_writedir
void _nc_set_writedir(
- char *dir)
+ const char *dir)
{ /* void */ }
#undef _nc_write_entry
void _nc_write_entry(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
+#undef _nc_write_object
+int _nc_write_object(
+ TERMTYPE2 *tp,
+ char *buffer,
+ unsigned *offset,
+ unsigned limit)
+ { return(*(int *)0); }
+
#undef _nc_tic_written
int _nc_tic_written(void)
{ return(*(int *)0); }
diff --git a/ncurses/llib-ltict b/ncurses/llib-ltict
index 8371c1824876..db275ea8b9f7 100644
--- a/ncurses/llib-ltict
+++ b/ncurses/llib-ltict
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2013 Free Software Foundation, Inc. *
+ * Copyright (c) 2013-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 *
@@ -27,18 +27,17 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 2013 *
+ * Author: Thomas E. Dickey 2013-on *
****************************************************************************/
/* LINTLIBRARY */
/* ./tinfo/alloc_entry.c */
#include <curses.priv.h>
-#include <tic.h>
#undef _nc_init_entry
void _nc_init_entry(
- TERMTYPE *const tp)
+ ENTRY *const tp)
{ /* void */ }
#undef _nc_copy_entry
@@ -59,14 +58,12 @@ void _nc_wrap_entry(
#undef _nc_merge_entry
void _nc_merge_entry(
- TERMTYPE *const to,
- TERMTYPE *const from)
+ ENTRY *const target,
+ ENTRY *const source)
{ /* void */ }
/* ./tinfo/captoinfo.c */
-#include <ctype.h>
-
#undef _nc_captoinfo
char *_nc_captoinfo(
const char *cap,
@@ -94,11 +91,8 @@ char *_nc_tic_expand(
#undef _nc_check_termtype2
void (*_nc_check_termtype2)(
- TERMTYPE *p1,
+ TERMTYPE2 *p1,
NCURSES_BOOL p2);
-#undef _nc_check_termtype
-void (*_nc_check_termtype)(
- TERMTYPE *p1);
#undef _nc_entry_match
NCURSES_BOOL _nc_entry_match(
@@ -122,11 +116,6 @@ int _nc_resolve_uses2(
NCURSES_BOOL literal)
{ return(*(int *)0); }
-#undef _nc_resolve_uses
-int _nc_resolve_uses(
- NCURSES_BOOL fullresolve)
- { return(*(int *)0); }
-
/* ./tinfo/comp_scan.c */
#undef _nc_syntax
@@ -177,7 +166,7 @@ void _nc_panic_mode(
#undef _nc_parse_entry
int _nc_parse_entry(
- struct entry *entryp,
+ ENTRY *entryp,
int literal,
NCURSES_BOOL silent)
{ return(*(int *)0); }
@@ -188,25 +177,26 @@ int _nc_capcmp(
const char *t)
{ return(*(int *)0); }
-typedef struct {
- const char *from;
- const char *to;
-} assoc;
-
/* ./tinfo/write_entry.c */
-#include <hashed_db.h>
-
#undef _nc_set_writedir
void _nc_set_writedir(
- char *dir)
+ const char *dir)
{ /* void */ }
#undef _nc_write_entry
void _nc_write_entry(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
+#undef _nc_write_object
+int _nc_write_object(
+ TERMTYPE2 *tp,
+ char *buffer,
+ unsigned *offset,
+ unsigned limit)
+ { return(*(int *)0); }
+
#undef _nc_tic_written
int _nc_tic_written(void)
{ return(*(int *)0); }
diff --git a/ncurses/llib-ltictw b/ncurses/llib-ltictw
index 981bb196706a..15b010c508cb 100644
--- a/ncurses/llib-ltictw
+++ b/ncurses/llib-ltictw
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2012 Free Software Foundation, Inc. *
+ * Copyright (c) 2012-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 *
@@ -27,18 +27,17 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 2012 *
+ * Author: Thomas E. Dickey 2012-on *
****************************************************************************/
/* LINTLIBRARY */
/* ./tinfo/alloc_entry.c */
#include <curses.priv.h>
-#include <tic.h>
#undef _nc_init_entry
void _nc_init_entry(
- TERMTYPE *const tp)
+ ENTRY *const tp)
{ /* void */ }
#undef _nc_copy_entry
@@ -59,14 +58,12 @@ void _nc_wrap_entry(
#undef _nc_merge_entry
void _nc_merge_entry(
- TERMTYPE *const to,
- TERMTYPE *const from)
+ ENTRY *const target,
+ ENTRY *const source)
{ /* void */ }
/* ./tinfo/captoinfo.c */
-#include <ctype.h>
-
#undef _nc_captoinfo
char *_nc_captoinfo(
const char *cap,
@@ -94,11 +91,8 @@ char *_nc_tic_expand(
#undef _nc_check_termtype2
void (*_nc_check_termtype2)(
- TERMTYPE *p1,
+ TERMTYPE2 *p1,
NCURSES_BOOL p2);
-#undef _nc_check_termtype
-void (*_nc_check_termtype)(
- TERMTYPE *p1);
#undef _nc_entry_match
NCURSES_BOOL _nc_entry_match(
@@ -122,11 +116,6 @@ int _nc_resolve_uses2(
NCURSES_BOOL literal)
{ return(*(int *)0); }
-#undef _nc_resolve_uses
-int _nc_resolve_uses(
- NCURSES_BOOL fullresolve)
- { return(*(int *)0); }
-
/* ./tinfo/comp_scan.c */
#undef _nc_syntax
@@ -177,7 +166,7 @@ void _nc_panic_mode(
#undef _nc_parse_entry
int _nc_parse_entry(
- struct entry *entryp,
+ ENTRY *entryp,
int literal,
NCURSES_BOOL silent)
{ return(*(int *)0); }
@@ -188,25 +177,26 @@ int _nc_capcmp(
const char *t)
{ return(*(int *)0); }
-typedef struct {
- const char *from;
- const char *to;
-} assoc;
-
/* ./tinfo/write_entry.c */
-#include <hashed_db.h>
-
#undef _nc_set_writedir
void _nc_set_writedir(
- char *dir)
+ const char *dir)
{ /* void */ }
#undef _nc_write_entry
void _nc_write_entry(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
+#undef _nc_write_object
+int _nc_write_object(
+ TERMTYPE2 *tp,
+ char *buffer,
+ unsigned *offset,
+ unsigned limit)
+ { return(*(int *)0); }
+
#undef _nc_tic_written
int _nc_tic_written(void)
{ return(*(int *)0); }
diff --git a/ncurses/llib-lticw b/ncurses/llib-lticw
index 981bb196706a..15b010c508cb 100644
--- a/ncurses/llib-lticw
+++ b/ncurses/llib-lticw
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2012 Free Software Foundation, Inc. *
+ * Copyright (c) 2012-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 *
@@ -27,18 +27,17 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 2012 *
+ * Author: Thomas E. Dickey 2012-on *
****************************************************************************/
/* LINTLIBRARY */
/* ./tinfo/alloc_entry.c */
#include <curses.priv.h>
-#include <tic.h>
#undef _nc_init_entry
void _nc_init_entry(
- TERMTYPE *const tp)
+ ENTRY *const tp)
{ /* void */ }
#undef _nc_copy_entry
@@ -59,14 +58,12 @@ void _nc_wrap_entry(
#undef _nc_merge_entry
void _nc_merge_entry(
- TERMTYPE *const to,
- TERMTYPE *const from)
+ ENTRY *const target,
+ ENTRY *const source)
{ /* void */ }
/* ./tinfo/captoinfo.c */
-#include <ctype.h>
-
#undef _nc_captoinfo
char *_nc_captoinfo(
const char *cap,
@@ -94,11 +91,8 @@ char *_nc_tic_expand(
#undef _nc_check_termtype2
void (*_nc_check_termtype2)(
- TERMTYPE *p1,
+ TERMTYPE2 *p1,
NCURSES_BOOL p2);
-#undef _nc_check_termtype
-void (*_nc_check_termtype)(
- TERMTYPE *p1);
#undef _nc_entry_match
NCURSES_BOOL _nc_entry_match(
@@ -122,11 +116,6 @@ int _nc_resolve_uses2(
NCURSES_BOOL literal)
{ return(*(int *)0); }
-#undef _nc_resolve_uses
-int _nc_resolve_uses(
- NCURSES_BOOL fullresolve)
- { return(*(int *)0); }
-
/* ./tinfo/comp_scan.c */
#undef _nc_syntax
@@ -177,7 +166,7 @@ void _nc_panic_mode(
#undef _nc_parse_entry
int _nc_parse_entry(
- struct entry *entryp,
+ ENTRY *entryp,
int literal,
NCURSES_BOOL silent)
{ return(*(int *)0); }
@@ -188,25 +177,26 @@ int _nc_capcmp(
const char *t)
{ return(*(int *)0); }
-typedef struct {
- const char *from;
- const char *to;
-} assoc;
-
/* ./tinfo/write_entry.c */
-#include <hashed_db.h>
-
#undef _nc_set_writedir
void _nc_set_writedir(
- char *dir)
+ const char *dir)
{ /* void */ }
#undef _nc_write_entry
void _nc_write_entry(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
+#undef _nc_write_object
+int _nc_write_object(
+ TERMTYPE2 *tp,
+ char *buffer,
+ unsigned *offset,
+ unsigned limit)
+ { return(*(int *)0); }
+
#undef _nc_tic_written
int _nc_tic_written(void)
{ return(*(int *)0); }
diff --git a/ncurses/llib-ltinfo b/ncurses/llib-ltinfo
index 79ac2293e370..b438d5f7f2b5 100644
--- a/ncurses/llib-ltinfo
+++ b/ncurses/llib-ltinfo
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 2012-2017,2019 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 *
@@ -27,15 +27,13 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 2012 *
+ * Author: Thomas E. Dickey 2012-on *
****************************************************************************/
/* LINTLIBRARY */
/* ./tinfo/access.c */
#include <curses.priv.h>
-#include <ctype.h>
-#include <tic.h>
#undef _nc_rootname
char *_nc_rootname(
@@ -90,8 +88,8 @@ int _nc_add_to_try(
#undef _nc_align_termtype
void _nc_align_termtype(
- TERMTYPE *to,
- TERMTYPE *from)
+ TERMTYPE2 *to,
+ TERMTYPE2 *from)
{ /* void */ }
#undef _nc_copy_termtype
@@ -103,16 +101,14 @@ void _nc_copy_termtype(
/* ./codes.c */
#undef boolcodes
-char *const boolcodes[] = {0};
+const char *const boolcodes[] = {0};
#undef numcodes
-char *const numcodes[] = {0};
+const char *const numcodes[] = {0};
#undef strcodes
-char *const strcodes[] = {0};
+const char *const strcodes[] = {0};
/* ./comp_captab.c */
-#include <hashsize.h>
-
#undef _nc_get_table
const struct name_table_entry *_nc_get_table(
NCURSES_BOOL termcap)
@@ -194,9 +190,22 @@ struct name_table_entry const *_nc_find_type_entry(
NCURSES_BOOL termcap)
{ return(*(struct name_table_entry const **)0); }
-/* ./tinfo/db_iterator.c */
+#undef _nc_find_user_entry
+struct user_table_entry const *_nc_find_user_entry(
+ const char *string)
+ { return(*(struct user_table_entry const **)0); }
+
+/* ./comp_userdefs.c */
+
+#undef _nc_get_userdefs_table
+const struct user_table_entry *_nc_get_userdefs_table(void)
+ { return(*(const struct user_table_entry **)0); }
+
+#undef _nc_get_hash_user
+const HashData *_nc_get_hash_user(void)
+ { return(*(const HashData **)0); }
-#include <time.h>
+/* ./tinfo/db_iterator.c */
#undef _nc_tic_dir
const char *_nc_tic_dir(
@@ -242,7 +251,7 @@ ENTRY *_nc_tail;
#undef _nc_free_entry
void _nc_free_entry(
ENTRY *headp,
- TERMTYPE *tterm)
+ TERMTYPE2 *tterm)
{ /* void */ }
#undef _nc_free_entries
@@ -250,12 +259,6 @@ void _nc_free_entries(
ENTRY *headp)
{ /* void */ }
-#undef _nc_delink_entry
-ENTRY *_nc_delink_entry(
- ENTRY *headp,
- TERMTYPE *tterm)
- { return(*(ENTRY **)0); }
-
#undef _nc_leaks_tinfo
void _nc_leaks_tinfo(void)
{ /* void */ }
@@ -263,9 +266,9 @@ void _nc_leaks_tinfo(void)
/* ./fallback.c */
#undef _nc_fallback
-const TERMTYPE *_nc_fallback(
+const TERMTYPE2 *_nc_fallback(
const char *name)
- { return(*(const TERMTYPE **)0); }
+ { return(*(const TERMTYPE2 **)0); }
/* ./tinfo/free_ttype.c */
@@ -303,15 +306,6 @@ char *_nc_home_terminfo(void)
/* ./tinfo/init_keytry.c */
-#if 0
-
-#include <init_keytry.h>
-
-#undef _nc_tinfo_fkeys
-const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0};
-
-#endif
-
#undef _nc_init_keytry
void _nc_init_keytry(
SCREEN *sp)
@@ -333,11 +327,9 @@ void _nc_init_acs(void)
/* ./tinfo/lib_baudrate.c */
-#include <termcap.h>
-
struct speed {
- int s;
- int sp;
+ int given_speed;
+ int actual_speed;
};
#undef _nc_baudrate
@@ -462,26 +454,29 @@ int flushinp(void)
struct kn { short offset; int code; };
#undef keyname_sp
-char *keyname_sp(
+const char *keyname_sp(
SCREEN *sp,
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef keyname
-char *keyname(
+const char *keyname(
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./tinfo/lib_longname.c */
+#undef longname_sp
+char *longname_sp(
+ SCREEN *sp)
+ { return(*(char **)0); }
+
#undef longname
char *longname(void)
{ return(*(char **)0); }
/* ./tinfo/lib_napms.c */
-#include <sys/time.h>
-
#undef napms_sp
int napms_sp(
SCREEN *sp,
@@ -665,10 +660,6 @@ int intrflush(
/* ./tinfo/lib_setup.c */
-#include <locale.h>
-#include <sys/ioctl.h>
-#include <langinfo.h>
-
#undef ttytype
char ttytype[256];
#undef LINES
@@ -731,7 +722,7 @@ void _nc_update_screensize(
#undef _nc_setup_tinfo
int _nc_setup_tinfo(
const char *const tn,
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
#undef _nc_tinfo_cmdch
@@ -755,7 +746,7 @@ int _nc_locale_breaks_acs(
#undef _nc_setupterm
int _nc_setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret,
int reuse)
@@ -767,7 +758,7 @@ SCREEN *new_prescr(void)
#undef setupterm
int setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret)
{ return(*(int *)0); }
@@ -786,12 +777,6 @@ int tgetent_sp(
const char *name)
{ return(*(int *)0); }
-#if 0
-
-#include <capdefaults.c>
-
-#endif
-
#undef tgetent
int tgetent(
char *bufp,
@@ -801,35 +786,35 @@ int tgetent(
#undef tgetflag_sp
int tgetflag_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetflag
int tgetflag(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum_sp
int tgetnum_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum
int tgetnum(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetstr_sp
char *tgetstr_sp(
SCREEN *sp,
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
#undef tgetstr
char *tgetstr(
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
@@ -858,34 +843,34 @@ char *tgoto(
#undef tigetflag_sp
int tigetflag_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetflag
int tigetflag(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum_sp
int tigetnum_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum
int tigetnum(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetstr_sp
char *tigetstr_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(char **)0); }
#undef tigetstr
char *tigetstr(
- char *str)
+ const char *str)
{ return(*(char **)0); }
/* ./tinfo/lib_tparm.c */
@@ -902,7 +887,7 @@ int _nc_tparm_analyze(
#undef tparm
char *tparm(
- char *string,
+ const char *string,
...)
{ return(*(char **)0); }
@@ -1065,9 +1050,9 @@ const char *_nc_retrace_cptr(
{ return(*(const char **)0); }
#undef _nc_retrace_cvoid_ptr
-void *_nc_retrace_cvoid_ptr(
- void *code)
- { return(*(void **)0); }
+const void *_nc_retrace_cvoid_ptr(
+ const void *code)
+ { return(*(const void **)0); }
#undef _nc_retrace_void_ptr
void *_nc_retrace_void_ptr(
@@ -1084,6 +1069,13 @@ WINDOW *_nc_retrace_win(
WINDOW *code)
{ return(*(WINDOW **)0); }
+#undef _nc_fmt_funcptr
+char *_nc_fmt_funcptr(
+ char *target,
+ const char *source,
+ size_t size)
+ { return(*(char **)0); }
+
/* ./trace/lib_traceatr.c */
#undef _traceattr2
@@ -1131,11 +1123,6 @@ chtype _nc_retrace_chtype(
/* ./trace/lib_tracebits.c */
-typedef struct {
- unsigned int val;
- const char *name;
-} BITNAMES;
-
#undef _nc_trace_ttymode
char *_nc_trace_ttymode(
struct termios *tty)
@@ -1263,17 +1250,17 @@ int _nc_name_match(
/* ./names.c */
#undef boolnames
-char *const boolnames[] = {0};
+const char *const boolnames[] = {0};
#undef boolfnames
-char *const boolfnames[] = {0};
+const char *const boolfnames[] = {0};
#undef numnames
-char *const numnames[] = {0};
+const char *const numnames[] = {0};
#undef numfnames
-char *const numfnames[] = {0};
+const char *const numfnames[] = {0};
#undef strnames
-char *const strnames[] = {0};
+const char *const strnames[] = {0};
#undef strfnames
-char *const strfnames[] = {0};
+const char *const strfnames[] = {0};
/* ./tinfo/obsolete.c */
@@ -1292,16 +1279,14 @@ void _nc_set_buffer(
/* ./tinfo/read_entry.c */
-#include <hashed_db.h>
-
#undef _nc_init_termtype
void _nc_init_termtype(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
#undef _nc_read_termtype
int _nc_read_termtype(
- TERMTYPE *ptr,
+ TERMTYPE2 *ptr,
char *buffer,
int limit)
{ return(*(int *)0); }
@@ -1309,20 +1294,18 @@ int _nc_read_termtype(
#undef _nc_read_file_entry
int _nc_read_file_entry(
const char *const filename,
- TERMTYPE *ptr)
+ TERMTYPE2 *ptr)
{ return(*(int *)0); }
#undef _nc_read_entry
int _nc_read_entry(
const char *const name,
char *const filename,
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
/* ./tinfo/read_termcap.c */
-#include <sys/types.h>
-
#undef _nc_read_termcap
void _nc_read_termcap(void)
{ /* void */ }
@@ -1407,21 +1390,21 @@ int _nc_remove_string(
#undef _nc_trim_sgr0
char *_nc_trim_sgr0(
- TERMTYPE *tp)
+ TERMTYPE2 *tp)
{ return(*(char **)0); }
/* ./unctrl.c */
#undef unctrl_sp
-char *unctrl_sp(
+const char *unctrl_sp(
SCREEN *sp,
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef unctrl
-char *unctrl(
+const char *unctrl(
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./trace/visbuf.c */
diff --git a/ncurses/llib-ltinfot b/ncurses/llib-ltinfot
index 4f66f6a057d2..e33aefbb2a1c 100644
--- a/ncurses/llib-ltinfot
+++ b/ncurses/llib-ltinfot
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2013 Free Software Foundation, Inc. *
+ * Copyright (c) 2013-2017,2019 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 *
@@ -27,15 +27,13 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 2013 *
+ * Author: Thomas E. Dickey 2013-on *
****************************************************************************/
/* LINTLIBRARY */
/* ./tinfo/access.c */
#include <curses.priv.h>
-#include <ctype.h>
-#include <tic.h>
#undef _nc_rootname
char *_nc_rootname(
@@ -90,8 +88,8 @@ int _nc_add_to_try(
#undef _nc_align_termtype
void _nc_align_termtype(
- TERMTYPE *to,
- TERMTYPE *from)
+ TERMTYPE2 *to,
+ TERMTYPE2 *from)
{ /* void */ }
#undef _nc_copy_termtype
@@ -103,21 +101,19 @@ void _nc_copy_termtype(
/* ./codes.c */
#undef _nc_boolcodes
-char *const *_nc_boolcodes(void)
- { return(*(char **)0); }
+const char *const *_nc_boolcodes(void)
+ { return(*(const char **)0); }
#undef _nc_numcodes
-char *const *_nc_numcodes(void)
- { return(*(char **)0); }
+const char *const *_nc_numcodes(void)
+ { return(*(const char **)0); }
#undef _nc_strcodes
-char *const *_nc_strcodes(void)
- { return(*(char **)0); }
+const char *const *_nc_strcodes(void)
+ { return(*(const char **)0); }
/* ./comp_captab.c */
-#include <hashsize.h>
-
#undef _nc_get_table
const struct name_table_entry *_nc_get_table(
NCURSES_BOOL termcap)
@@ -199,9 +195,22 @@ struct name_table_entry const *_nc_find_type_entry(
NCURSES_BOOL termcap)
{ return(*(struct name_table_entry const **)0); }
-/* ./tinfo/db_iterator.c */
+#undef _nc_find_user_entry
+struct user_table_entry const *_nc_find_user_entry(
+ const char *string)
+ { return(*(struct user_table_entry const **)0); }
-#include <time.h>
+/* ./comp_userdefs.c */
+
+#undef _nc_get_userdefs_table
+const struct user_table_entry *_nc_get_userdefs_table(void)
+ { return(*(const struct user_table_entry **)0); }
+
+#undef _nc_get_hash_user
+const HashData *_nc_get_hash_user(void)
+ { return(*(const HashData **)0); }
+
+/* ./tinfo/db_iterator.c */
#undef _nc_tic_dir
const char *_nc_tic_dir(
@@ -247,7 +256,7 @@ ENTRY *_nc_tail;
#undef _nc_free_entry
void _nc_free_entry(
ENTRY *headp,
- TERMTYPE *tterm)
+ TERMTYPE2 *tterm)
{ /* void */ }
#undef _nc_free_entries
@@ -255,12 +264,6 @@ void _nc_free_entries(
ENTRY *headp)
{ /* void */ }
-#undef _nc_delink_entry
-ENTRY *_nc_delink_entry(
- ENTRY *headp,
- TERMTYPE *tterm)
- { return(*(ENTRY **)0); }
-
#undef _nc_leaks_tinfo
void _nc_leaks_tinfo(void)
{ /* void */ }
@@ -268,9 +271,9 @@ void _nc_leaks_tinfo(void)
/* ./fallback.c */
#undef _nc_fallback
-const TERMTYPE *_nc_fallback(
+const TERMTYPE2 *_nc_fallback(
const char *name)
- { return(*(const TERMTYPE **)0); }
+ { return(*(const TERMTYPE2 **)0); }
/* ./tinfo/free_ttype.c */
@@ -308,15 +311,6 @@ char *_nc_home_terminfo(void)
/* ./tinfo/init_keytry.c */
-#if 0
-
-#include <init_keytry.h>
-
-#undef _nc_tinfo_fkeys
-const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0};
-
-#endif
-
#undef _nc_init_keytry
void _nc_init_keytry(
SCREEN *sp)
@@ -339,11 +333,9 @@ void _nc_init_acs(void)
/* ./tinfo/lib_baudrate.c */
-#include <termcap.h>
-
struct speed {
- int s;
- int sp;
+ int given_speed;
+ int actual_speed;
};
#undef _nc_baudrate
@@ -508,15 +500,15 @@ int flushinp(void)
struct kn { short offset; int code; };
#undef keyname_sp
-char *keyname_sp(
+const char *keyname_sp(
SCREEN *sp,
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef keyname
-char *keyname(
+const char *keyname(
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./tinfo/lib_longname.c */
@@ -714,10 +706,6 @@ int intrflush(
/* ./tinfo/lib_setup.c */
-#include <locale.h>
-#include <sys/ioctl.h>
-#include <langinfo.h>
-
#undef _nc_ttytype
char *_nc_ttytype(void)
{ return(*(char **)0); }
@@ -802,7 +790,7 @@ void _nc_update_screensize(
#undef _nc_setup_tinfo
int _nc_setup_tinfo(
const char *const tn,
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
#undef _nc_tinfo_cmdch
@@ -826,19 +814,27 @@ int _nc_locale_breaks_acs(
#undef _nc_setupterm
int _nc_setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret,
int reuse)
{ return(*(int *)0); }
+#undef _nc_find_prescr
+SCREEN *_nc_find_prescr(void)
+ { return(*(SCREEN **)0); }
+
+#undef _nc_forget_prescr
+void _nc_forget_prescr(void)
+ { /* void */ }
+
#undef new_prescr
SCREEN *new_prescr(void)
{ return(*(SCREEN **)0); }
#undef setupterm
int setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret)
{ return(*(int *)0); }
@@ -857,12 +853,6 @@ int tgetent_sp(
const char *name)
{ return(*(int *)0); }
-#if 0
-
-#include <capdefaults.c>
-
-#endif
-
#undef tgetent
int tgetent(
char *bufp,
@@ -872,35 +862,35 @@ int tgetent(
#undef tgetflag_sp
int tgetflag_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetflag
int tgetflag(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum_sp
int tgetnum_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum
int tgetnum(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetstr_sp
char *tgetstr_sp(
SCREEN *sp,
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
#undef tgetstr
char *tgetstr(
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
@@ -929,34 +919,34 @@ char *tgoto(
#undef tigetflag_sp
int tigetflag_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetflag
int tigetflag(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum_sp
int tigetnum_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum
int tigetnum(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetstr_sp
char *tigetstr_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(char **)0); }
#undef tigetstr
char *tigetstr(
- char *str)
+ const char *str)
{ return(*(char **)0); }
/* ./tinfo/lib_tparm.c */
@@ -973,7 +963,7 @@ int _nc_tparm_analyze(
#undef tparm
char *tparm(
- char *string,
+ const char *string,
...)
{ return(*(char **)0); }
@@ -1150,9 +1140,9 @@ const char *_nc_retrace_cptr(
{ return(*(const char **)0); }
#undef _nc_retrace_cvoid_ptr
-void *_nc_retrace_cvoid_ptr(
- void *code)
- { return(*(void **)0); }
+const void *_nc_retrace_cvoid_ptr(
+ const void *code)
+ { return(*(const void **)0); }
#undef _nc_retrace_void_ptr
void *_nc_retrace_void_ptr(
@@ -1169,6 +1159,13 @@ WINDOW *_nc_retrace_win(
WINDOW *code)
{ return(*(WINDOW **)0); }
+#undef _nc_fmt_funcptr
+char *_nc_fmt_funcptr(
+ char *target,
+ const char *source,
+ size_t size)
+ { return(*(char **)0); }
+
#undef _nc_use_tracef
int _nc_use_tracef(
unsigned mask)
@@ -1227,11 +1224,6 @@ chtype _nc_retrace_chtype(
/* ./trace/lib_tracebits.c */
-typedef struct {
- unsigned int val;
- const char *name;
-} BITNAMES;
-
#undef _nc_trace_ttymode
char *_nc_trace_ttymode(
struct termios *tty)
@@ -1334,8 +1326,6 @@ int resetty(void)
/* ./tty/lib_twait.c */
-#include <sys/time.h>
-
#undef _nc_timed_wait
int _nc_timed_wait(
SCREEN *sp,
@@ -1361,28 +1351,28 @@ int _nc_name_match(
/* ./names.c */
#undef _nc_boolnames
-char *const *_nc_boolnames(void)
- { return(*(char **)0); }
+const char *const *_nc_boolnames(void)
+ { return(*(const char **)0); }
#undef _nc_boolfnames
-char *const *_nc_boolfnames(void)
- { return(*(char **)0); }
+const char *const *_nc_boolfnames(void)
+ { return(*(const char **)0); }
#undef _nc_numnames
-char *const *_nc_numnames(void)
- { return(*(char **)0); }
+const char *const *_nc_numnames(void)
+ { return(*(const char **)0); }
#undef _nc_numfnames
-char *const *_nc_numfnames(void)
- { return(*(char **)0); }
+const char *const *_nc_numfnames(void)
+ { return(*(const char **)0); }
#undef _nc_strnames
-char *const *_nc_strnames(void)
- { return(*(char **)0); }
+const char *const *_nc_strnames(void)
+ { return(*(const char **)0); }
#undef _nc_strfnames
-char *const *_nc_strfnames(void)
- { return(*(char **)0); }
+const char *const *_nc_strfnames(void)
+ { return(*(const char **)0); }
/* ./tinfo/obsolete.c */
@@ -1401,16 +1391,14 @@ void _nc_set_buffer(
/* ./tinfo/read_entry.c */
-#include <hashed_db.h>
-
#undef _nc_init_termtype
void _nc_init_termtype(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
#undef _nc_read_termtype
int _nc_read_termtype(
- TERMTYPE *ptr,
+ TERMTYPE2 *ptr,
char *buffer,
int limit)
{ return(*(int *)0); }
@@ -1418,20 +1406,18 @@ int _nc_read_termtype(
#undef _nc_read_file_entry
int _nc_read_file_entry(
const char *const filename,
- TERMTYPE *ptr)
+ TERMTYPE2 *ptr)
{ return(*(int *)0); }
#undef _nc_read_entry
int _nc_read_entry(
const char *const name,
char *const filename,
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
/* ./tinfo/read_termcap.c */
-#include <sys/types.h>
-
#undef _nc_read_termcap
void _nc_read_termcap(void)
{ /* void */ }
@@ -1516,21 +1502,21 @@ int _nc_remove_string(
#undef _nc_trim_sgr0
char *_nc_trim_sgr0(
- TERMTYPE *tp)
+ TERMTYPE2 *tp)
{ return(*(char **)0); }
/* ./unctrl.c */
#undef unctrl_sp
-char *unctrl_sp(
+const char *unctrl_sp(
SCREEN *sp,
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef unctrl
-char *unctrl(
+const char *unctrl(
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./trace/visbuf.c */
diff --git a/ncurses/llib-ltinfotw b/ncurses/llib-ltinfotw
index ec9b63d443ff..10a8fddb2e8a 100644
--- a/ncurses/llib-ltinfotw
+++ b/ncurses/llib-ltinfotw
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 2012-2018,2019 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 *
@@ -27,15 +27,13 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 2012 *
+ * Author: Thomas E. Dickey 2012-on *
****************************************************************************/
/* LINTLIBRARY */
/* ./tinfo/access.c */
#include <curses.priv.h>
-#include <ctype.h>
-#include <tic.h>
#undef _nc_rootname
char *_nc_rootname(
@@ -90,8 +88,8 @@ int _nc_add_to_try(
#undef _nc_align_termtype
void _nc_align_termtype(
- TERMTYPE *to,
- TERMTYPE *from)
+ TERMTYPE2 *to,
+ TERMTYPE2 *from)
{ /* void */ }
#undef _nc_copy_termtype
@@ -100,24 +98,34 @@ void _nc_copy_termtype(
const TERMTYPE *src)
{ /* void */ }
+#undef _nc_copy_termtype2
+void _nc_copy_termtype2(
+ TERMTYPE2 *dst,
+ const TERMTYPE2 *src)
+ { /* void */ }
+
+#undef _nc_export_termtype2
+void _nc_export_termtype2(
+ TERMTYPE *dst,
+ const TERMTYPE2 *src)
+ { /* void */ }
+
/* ./codes.c */
#undef _nc_boolcodes
-char *const *_nc_boolcodes(void)
- { return(*(char **)0); }
+const char *const *_nc_boolcodes(void)
+ { return(*(const char **)0); }
#undef _nc_numcodes
-char *const *_nc_numcodes(void)
- { return(*(char **)0); }
+const char *const *_nc_numcodes(void)
+ { return(*(const char **)0); }
#undef _nc_strcodes
-char *const *_nc_strcodes(void)
- { return(*(char **)0); }
+const char *const *_nc_strcodes(void)
+ { return(*(const char **)0); }
/* ./comp_captab.c */
-#include <hashsize.h>
-
#undef _nc_get_table
const struct name_table_entry *_nc_get_table(
NCURSES_BOOL termcap)
@@ -199,9 +207,22 @@ struct name_table_entry const *_nc_find_type_entry(
NCURSES_BOOL termcap)
{ return(*(struct name_table_entry const **)0); }
-/* ./tinfo/db_iterator.c */
+#undef _nc_find_user_entry
+struct user_table_entry const *_nc_find_user_entry(
+ const char *string)
+ { return(*(struct user_table_entry const **)0); }
+
+/* ./comp_userdefs.c */
-#include <time.h>
+#undef _nc_get_userdefs_table
+const struct user_table_entry *_nc_get_userdefs_table(void)
+ { return(*(const struct user_table_entry **)0); }
+
+#undef _nc_get_hash_user
+const HashData *_nc_get_hash_user(void)
+ { return(*(const HashData **)0); }
+
+/* ./tinfo/db_iterator.c */
#undef _nc_tic_dir
const char *_nc_tic_dir(
@@ -247,7 +268,7 @@ ENTRY *_nc_tail;
#undef _nc_free_entry
void _nc_free_entry(
ENTRY *headp,
- TERMTYPE *tterm)
+ TERMTYPE2 *tterm)
{ /* void */ }
#undef _nc_free_entries
@@ -255,18 +276,17 @@ void _nc_free_entries(
ENTRY *headp)
{ /* void */ }
-#undef _nc_delink_entry
-ENTRY *_nc_delink_entry(
- ENTRY *headp,
- TERMTYPE *tterm)
- { return(*(ENTRY **)0); }
-
#undef _nc_leaks_tinfo
void _nc_leaks_tinfo(void)
{ /* void */ }
/* ./fallback.c */
+#undef _nc_fallback2
+const TERMTYPE2 *_nc_fallback2(
+ const char *name)
+ { return(*(const TERMTYPE2 **)0); }
+
#undef _nc_fallback
const TERMTYPE *_nc_fallback(
const char *name)
@@ -279,6 +299,11 @@ void _nc_free_termtype(
TERMTYPE *ptr)
{ /* void */ }
+#undef _nc_free_termtype2
+void _nc_free_termtype2(
+ TERMTYPE2 *ptr)
+ { /* void */ }
+
#undef _nc_user_definable
NCURSES_BOOL _nc_user_definable;
@@ -308,15 +333,6 @@ char *_nc_home_terminfo(void)
/* ./tinfo/init_keytry.c */
-#if 0
-
-#include <init_keytry.h>
-
-#undef _nc_tinfo_fkeys
-const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0};
-
-#endif
-
#undef _nc_init_keytry
void _nc_init_keytry(
SCREEN *sp)
@@ -339,11 +355,9 @@ void _nc_init_acs(void)
/* ./tinfo/lib_baudrate.c */
-#include <termcap.h>
-
struct speed {
- int s;
- int sp;
+ int given_speed;
+ int actual_speed;
};
#undef _nc_baudrate
@@ -508,15 +522,15 @@ int flushinp(void)
struct kn { short offset; int code; };
#undef keyname_sp
-char *keyname_sp(
+const char *keyname_sp(
SCREEN *sp,
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef keyname
-char *keyname(
+const char *keyname(
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./tinfo/lib_longname.c */
@@ -714,10 +728,6 @@ int intrflush(
/* ./tinfo/lib_setup.c */
-#include <locale.h>
-#include <sys/ioctl.h>
-#include <langinfo.h>
-
#undef _nc_ttytype
char *_nc_ttytype(void)
{ return(*(char **)0); }
@@ -802,7 +812,7 @@ void _nc_update_screensize(
#undef _nc_setup_tinfo
int _nc_setup_tinfo(
const char *const tn,
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
#undef _nc_tinfo_cmdch
@@ -826,19 +836,27 @@ int _nc_locale_breaks_acs(
#undef _nc_setupterm
int _nc_setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret,
int reuse)
{ return(*(int *)0); }
+#undef _nc_find_prescr
+SCREEN *_nc_find_prescr(void)
+ { return(*(SCREEN **)0); }
+
+#undef _nc_forget_prescr
+void _nc_forget_prescr(void)
+ { /* void */ }
+
#undef new_prescr
SCREEN *new_prescr(void)
{ return(*(SCREEN **)0); }
#undef setupterm
int setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret)
{ return(*(int *)0); }
@@ -857,12 +875,6 @@ int tgetent_sp(
const char *name)
{ return(*(int *)0); }
-#if 0
-
-#include <capdefaults.c>
-
-#endif
-
#undef tgetent
int tgetent(
char *bufp,
@@ -872,35 +884,35 @@ int tgetent(
#undef tgetflag_sp
int tgetflag_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetflag
int tgetflag(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum_sp
int tgetnum_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum
int tgetnum(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetstr_sp
char *tgetstr_sp(
SCREEN *sp,
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
#undef tgetstr
char *tgetstr(
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
@@ -929,34 +941,34 @@ char *tgoto(
#undef tigetflag_sp
int tigetflag_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetflag
int tigetflag(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum_sp
int tigetnum_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum
int tigetnum(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetstr_sp
char *tigetstr_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(char **)0); }
#undef tigetstr
char *tigetstr(
- char *str)
+ const char *str)
{ return(*(char **)0); }
/* ./tinfo/lib_tparm.c */
@@ -973,7 +985,7 @@ int _nc_tparm_analyze(
#undef tparm
char *tparm(
- char *string,
+ const char *string,
...)
{ return(*(char **)0); }
@@ -1150,9 +1162,9 @@ const char *_nc_retrace_cptr(
{ return(*(const char **)0); }
#undef _nc_retrace_cvoid_ptr
-void *_nc_retrace_cvoid_ptr(
- void *code)
- { return(*(void **)0); }
+const void *_nc_retrace_cvoid_ptr(
+ const void *code)
+ { return(*(const void **)0); }
#undef _nc_retrace_void_ptr
void *_nc_retrace_void_ptr(
@@ -1169,6 +1181,13 @@ WINDOW *_nc_retrace_win(
WINDOW *code)
{ return(*(WINDOW **)0); }
+#undef _nc_fmt_funcptr
+char *_nc_fmt_funcptr(
+ char *target,
+ const char *source,
+ size_t size)
+ { return(*(char **)0); }
+
#undef _nc_use_tracef
int _nc_use_tracef(
unsigned mask)
@@ -1238,11 +1257,6 @@ char *_tracecchar_t(
/* ./trace/lib_tracebits.c */
-typedef struct {
- unsigned int val;
- const char *name;
-} BITNAMES;
-
#undef _nc_trace_ttymode
char *_nc_trace_ttymode(
struct termios *tty)
@@ -1345,8 +1359,6 @@ int resetty(void)
/* ./tty/lib_twait.c */
-#include <sys/time.h>
-
#undef _nc_timed_wait
int _nc_timed_wait(
SCREEN *sp,
@@ -1372,28 +1384,28 @@ int _nc_name_match(
/* ./names.c */
#undef _nc_boolnames
-char *const *_nc_boolnames(void)
- { return(*(char **)0); }
+const char *const *_nc_boolnames(void)
+ { return(*(const char **)0); }
#undef _nc_boolfnames
-char *const *_nc_boolfnames(void)
- { return(*(char **)0); }
+const char *const *_nc_boolfnames(void)
+ { return(*(const char **)0); }
#undef _nc_numnames
-char *const *_nc_numnames(void)
- { return(*(char **)0); }
+const char *const *_nc_numnames(void)
+ { return(*(const char **)0); }
#undef _nc_numfnames
-char *const *_nc_numfnames(void)
- { return(*(char **)0); }
+const char *const *_nc_numfnames(void)
+ { return(*(const char **)0); }
#undef _nc_strnames
-char *const *_nc_strnames(void)
- { return(*(char **)0); }
+const char *const *_nc_strnames(void)
+ { return(*(const char **)0); }
#undef _nc_strfnames
-char *const *_nc_strfnames(void)
- { return(*(char **)0); }
+const char *const *_nc_strfnames(void)
+ { return(*(const char **)0); }
/* ./tinfo/obsolete.c */
@@ -1412,16 +1424,14 @@ void _nc_set_buffer(
/* ./tinfo/read_entry.c */
-#include <hashed_db.h>
-
#undef _nc_init_termtype
void _nc_init_termtype(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
#undef _nc_read_termtype
int _nc_read_termtype(
- TERMTYPE *ptr,
+ TERMTYPE2 *ptr,
char *buffer,
int limit)
{ return(*(int *)0); }
@@ -1429,7 +1439,14 @@ int _nc_read_termtype(
#undef _nc_read_file_entry
int _nc_read_file_entry(
const char *const filename,
- TERMTYPE *ptr)
+ TERMTYPE2 *ptr)
+ { return(*(int *)0); }
+
+#undef _nc_read_entry2
+int _nc_read_entry2(
+ const char *const name,
+ char *const filename,
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
#undef _nc_read_entry
@@ -1441,8 +1458,6 @@ int _nc_read_entry(
/* ./tinfo/read_termcap.c */
-#include <sys/types.h>
-
#undef _nc_read_termcap
void _nc_read_termcap(void)
{ /* void */ }
@@ -1527,21 +1542,21 @@ int _nc_remove_string(
#undef _nc_trim_sgr0
char *_nc_trim_sgr0(
- TERMTYPE *tp)
+ TERMTYPE2 *tp)
{ return(*(char **)0); }
/* ./unctrl.c */
#undef unctrl_sp
-char *unctrl_sp(
+const char *unctrl_sp(
SCREEN *sp,
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef unctrl
-char *unctrl(
+const char *unctrl(
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./trace/visbuf.c */
diff --git a/ncurses/llib-ltinfow b/ncurses/llib-ltinfow
index f219698304bc..9142d8aee9e4 100644
--- a/ncurses/llib-ltinfow
+++ b/ncurses/llib-ltinfow
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 2012-2018,2019 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 *
@@ -27,15 +27,13 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 2012 *
+ * Author: Thomas E. Dickey 2012-on *
****************************************************************************/
/* LINTLIBRARY */
/* ./tinfo/access.c */
#include <curses.priv.h>
-#include <ctype.h>
-#include <tic.h>
#undef _nc_rootname
char *_nc_rootname(
@@ -90,8 +88,8 @@ int _nc_add_to_try(
#undef _nc_align_termtype
void _nc_align_termtype(
- TERMTYPE *to,
- TERMTYPE *from)
+ TERMTYPE2 *to,
+ TERMTYPE2 *from)
{ /* void */ }
#undef _nc_copy_termtype
@@ -100,19 +98,29 @@ void _nc_copy_termtype(
const TERMTYPE *src)
{ /* void */ }
+#undef _nc_copy_termtype2
+void _nc_copy_termtype2(
+ TERMTYPE2 *dst,
+ const TERMTYPE2 *src)
+ { /* void */ }
+
+#undef _nc_export_termtype2
+void _nc_export_termtype2(
+ TERMTYPE *dst,
+ const TERMTYPE2 *src)
+ { /* void */ }
+
/* ./codes.c */
#undef boolcodes
-char *const boolcodes[] = {0};
+const char *const boolcodes[] = {0};
#undef numcodes
-char *const numcodes[] = {0};
+const char *const numcodes[] = {0};
#undef strcodes
-char *const strcodes[] = {0};
+const char *const strcodes[] = {0};
/* ./comp_captab.c */
-#include <hashsize.h>
-
#undef _nc_get_table
const struct name_table_entry *_nc_get_table(
NCURSES_BOOL termcap)
@@ -194,9 +202,22 @@ struct name_table_entry const *_nc_find_type_entry(
NCURSES_BOOL termcap)
{ return(*(struct name_table_entry const **)0); }
-/* ./tinfo/db_iterator.c */
+#undef _nc_find_user_entry
+struct user_table_entry const *_nc_find_user_entry(
+ const char *string)
+ { return(*(struct user_table_entry const **)0); }
-#include <time.h>
+/* ./comp_userdefs.c */
+
+#undef _nc_get_userdefs_table
+const struct user_table_entry *_nc_get_userdefs_table(void)
+ { return(*(const struct user_table_entry **)0); }
+
+#undef _nc_get_hash_user
+const HashData *_nc_get_hash_user(void)
+ { return(*(const HashData **)0); }
+
+/* ./tinfo/db_iterator.c */
#undef _nc_tic_dir
const char *_nc_tic_dir(
@@ -242,7 +263,7 @@ ENTRY *_nc_tail;
#undef _nc_free_entry
void _nc_free_entry(
ENTRY *headp,
- TERMTYPE *tterm)
+ TERMTYPE2 *tterm)
{ /* void */ }
#undef _nc_free_entries
@@ -250,18 +271,17 @@ void _nc_free_entries(
ENTRY *headp)
{ /* void */ }
-#undef _nc_delink_entry
-ENTRY *_nc_delink_entry(
- ENTRY *headp,
- TERMTYPE *tterm)
- { return(*(ENTRY **)0); }
-
#undef _nc_leaks_tinfo
void _nc_leaks_tinfo(void)
{ /* void */ }
/* ./fallback.c */
+#undef _nc_fallback2
+const TERMTYPE2 *_nc_fallback2(
+ const char *name)
+ { return(*(const TERMTYPE2 **)0); }
+
#undef _nc_fallback
const TERMTYPE *_nc_fallback(
const char *name)
@@ -274,6 +294,11 @@ void _nc_free_termtype(
TERMTYPE *ptr)
{ /* void */ }
+#undef _nc_free_termtype2
+void _nc_free_termtype2(
+ TERMTYPE2 *ptr)
+ { /* void */ }
+
#undef _nc_user_definable
NCURSES_BOOL _nc_user_definable;
@@ -303,15 +328,6 @@ char *_nc_home_terminfo(void)
/* ./tinfo/init_keytry.c */
-#if 0
-
-#include <init_keytry.h>
-
-#undef _nc_tinfo_fkeys
-const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0};
-
-#endif
-
#undef _nc_init_keytry
void _nc_init_keytry(
SCREEN *sp)
@@ -333,11 +349,9 @@ void _nc_init_acs(void)
/* ./tinfo/lib_baudrate.c */
-#include <termcap.h>
-
struct speed {
- int s;
- int sp;
+ int given_speed;
+ int actual_speed;
};
#undef _nc_baudrate
@@ -462,26 +476,29 @@ int flushinp(void)
struct kn { short offset; int code; };
#undef keyname_sp
-char *keyname_sp(
+const char *keyname_sp(
SCREEN *sp,
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef keyname
-char *keyname(
+const char *keyname(
int c)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./tinfo/lib_longname.c */
+#undef longname_sp
+char *longname_sp(
+ SCREEN *sp)
+ { return(*(char **)0); }
+
#undef longname
char *longname(void)
{ return(*(char **)0); }
/* ./tinfo/lib_napms.c */
-#include <sys/time.h>
-
#undef napms_sp
int napms_sp(
SCREEN *sp,
@@ -665,10 +682,6 @@ int intrflush(
/* ./tinfo/lib_setup.c */
-#include <locale.h>
-#include <sys/ioctl.h>
-#include <langinfo.h>
-
#undef ttytype
char ttytype[256];
#undef LINES
@@ -731,7 +744,7 @@ void _nc_update_screensize(
#undef _nc_setup_tinfo
int _nc_setup_tinfo(
const char *const tn,
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
#undef _nc_tinfo_cmdch
@@ -755,7 +768,7 @@ int _nc_locale_breaks_acs(
#undef _nc_setupterm
int _nc_setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret,
int reuse)
@@ -767,7 +780,7 @@ SCREEN *new_prescr(void)
#undef setupterm
int setupterm(
- char *tname,
+ const char *tname,
int Filedes,
int *errret)
{ return(*(int *)0); }
@@ -786,12 +799,6 @@ int tgetent_sp(
const char *name)
{ return(*(int *)0); }
-#if 0
-
-#include <capdefaults.c>
-
-#endif
-
#undef tgetent
int tgetent(
char *bufp,
@@ -801,35 +808,35 @@ int tgetent(
#undef tgetflag_sp
int tgetflag_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetflag
int tgetflag(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum_sp
int tgetnum_sp(
SCREEN *sp,
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetnum
int tgetnum(
- char *id)
+ const char *id)
{ return(*(int *)0); }
#undef tgetstr_sp
char *tgetstr_sp(
SCREEN *sp,
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
#undef tgetstr
char *tgetstr(
- char *id,
+ const char *id,
char **area)
{ return(*(char **)0); }
@@ -858,34 +865,34 @@ char *tgoto(
#undef tigetflag_sp
int tigetflag_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetflag
int tigetflag(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum_sp
int tigetnum_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetnum
int tigetnum(
- char *str)
+ const char *str)
{ return(*(int *)0); }
#undef tigetstr_sp
char *tigetstr_sp(
SCREEN *sp,
- char *str)
+ const char *str)
{ return(*(char **)0); }
#undef tigetstr
char *tigetstr(
- char *str)
+ const char *str)
{ return(*(char **)0); }
/* ./tinfo/lib_tparm.c */
@@ -902,7 +909,7 @@ int _nc_tparm_analyze(
#undef tparm
char *tparm(
- char *string,
+ const char *string,
...)
{ return(*(char **)0); }
@@ -1065,9 +1072,9 @@ const char *_nc_retrace_cptr(
{ return(*(const char **)0); }
#undef _nc_retrace_cvoid_ptr
-void *_nc_retrace_cvoid_ptr(
- void *code)
- { return(*(void **)0); }
+const void *_nc_retrace_cvoid_ptr(
+ const void *code)
+ { return(*(const void **)0); }
#undef _nc_retrace_void_ptr
void *_nc_retrace_void_ptr(
@@ -1084,6 +1091,13 @@ WINDOW *_nc_retrace_win(
WINDOW *code)
{ return(*(WINDOW **)0); }
+#undef _nc_fmt_funcptr
+char *_nc_fmt_funcptr(
+ char *target,
+ const char *source,
+ size_t size)
+ { return(*(char **)0); }
+
/* ./trace/lib_traceatr.c */
#undef _traceattr2
@@ -1142,11 +1156,6 @@ char *_tracecchar_t(
/* ./trace/lib_tracebits.c */
-typedef struct {
- unsigned int val;
- const char *name;
-} BITNAMES;
-
#undef _nc_trace_ttymode
char *_nc_trace_ttymode(
struct termios *tty)
@@ -1274,17 +1283,17 @@ int _nc_name_match(
/* ./names.c */
#undef boolnames
-char *const boolnames[] = {0};
+const char *const boolnames[] = {0};
#undef boolfnames
-char *const boolfnames[] = {0};
+const char *const boolfnames[] = {0};
#undef numnames
-char *const numnames[] = {0};
+const char *const numnames[] = {0};
#undef numfnames
-char *const numfnames[] = {0};
+const char *const numfnames[] = {0};
#undef strnames
-char *const strnames[] = {0};
+const char *const strnames[] = {0};
#undef strfnames
-char *const strfnames[] = {0};
+const char *const strfnames[] = {0};
/* ./tinfo/obsolete.c */
@@ -1303,16 +1312,14 @@ void _nc_set_buffer(
/* ./tinfo/read_entry.c */
-#include <hashed_db.h>
-
#undef _nc_init_termtype
void _nc_init_termtype(
- TERMTYPE *const tp)
+ TERMTYPE2 *const tp)
{ /* void */ }
#undef _nc_read_termtype
int _nc_read_termtype(
- TERMTYPE *ptr,
+ TERMTYPE2 *ptr,
char *buffer,
int limit)
{ return(*(int *)0); }
@@ -1320,7 +1327,14 @@ int _nc_read_termtype(
#undef _nc_read_file_entry
int _nc_read_file_entry(
const char *const filename,
- TERMTYPE *ptr)
+ TERMTYPE2 *ptr)
+ { return(*(int *)0); }
+
+#undef _nc_read_entry2
+int _nc_read_entry2(
+ const char *const name,
+ char *const filename,
+ TERMTYPE2 *const tp)
{ return(*(int *)0); }
#undef _nc_read_entry
@@ -1332,8 +1346,6 @@ int _nc_read_entry(
/* ./tinfo/read_termcap.c */
-#include <sys/types.h>
-
#undef _nc_read_termcap
void _nc_read_termcap(void)
{ /* void */ }
@@ -1418,21 +1430,21 @@ int _nc_remove_string(
#undef _nc_trim_sgr0
char *_nc_trim_sgr0(
- TERMTYPE *tp)
+ TERMTYPE2 *tp)
{ return(*(char **)0); }
/* ./unctrl.c */
#undef unctrl_sp
-char *unctrl_sp(
+const char *unctrl_sp(
SCREEN *sp,
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
#undef unctrl
-char *unctrl(
+const char *unctrl(
chtype ch)
- { return(*(char **)0); }
+ { return(*(const char **)0); }
/* ./trace/visbuf.c */
diff --git a/ncurses/modules b/ncurses/modules
index b3b973210fc4..2772225e0a1b 100644
--- a/ncurses/modules
+++ b/ncurses/modules
@@ -1,6 +1,6 @@
-# $Id: modules,v 1.120 2013/01/26 22:17:55 tom Exp $
+# $Id: modules,v 1.123 2019/03/09 21:36:58 tom Exp $
##############################################################################
-# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2017,2019 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"), #
@@ -44,7 +44,7 @@ lib_clear lib $(base) $(HEADER_DEPS)
lib_clearok lib $(base) $(HEADER_DEPS)
lib_clrbot lib $(base) $(HEADER_DEPS)
lib_clreol lib $(base) $(HEADER_DEPS)
-lib_color lib $(base) $(HEADER_DEPS) $(INCDIR)/tic.h
+lib_color lib $(base) $(HEADER_DEPS) $(INCDIR)/tic.h $(srcdir)/new_pair.h
lib_colorset lib $(base) $(HEADER_DEPS)
lib_delch lib $(base) $(HEADER_DEPS)
lib_delwin lib $(base) $(HEADER_DEPS)
@@ -125,7 +125,7 @@ lib_freeall lib $(base) $(HEADER_DEPS) $(INCDIR)/tic.h
charable lib $(wide) $(HEADER_DEPS)
lib_add_wch lib $(wide) $(HEADER_DEPS)
lib_box_set lib $(wide) $(HEADER_DEPS)
-lib_cchar lib $(wide) $(HEADER_DEPS)
+lib_cchar lib $(wide) $(HEADER_DEPS) $(srcdir)/new_pair.h
lib_erasewchar lib $(wide) $(HEADER_DEPS)
lib_get_wch lib $(wide) $(HEADER_DEPS)
lib_get_wstr lib $(wide) $(HEADER_DEPS)
@@ -149,6 +149,7 @@ expanded lib . $(HEADER_DEPS)
legacy_coding lib $(base) $(HEADER_DEPS)
lib_dft_fgbg lib $(base) $(HEADER_DEPS)
lib_print lib $(tinfo) $(HEADER_DEPS)
+new_pair lib $(base) $(HEADER_DEPS) $(srcdir)/new_pair.h
resizeterm lib $(base) $(HEADER_DEPS)
trace_xnames lib $(trace) $(HEADER_DEPS)
use_screen lib $(tinfo) $(HEADER_DEPS)
@@ -164,6 +165,7 @@ codes lib . $(HEADER_DEPS)
comp_captab lib . $(HEADER_DEPS) $(INCDIR)/tic.h ../include/hashsize.h
comp_error lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
comp_hash lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h ../include/hashsize.h
+comp_userdefs lib . $(HEADER_DEPS) $(INCDIR)/tic.h ../include/hashsize.h
db_iterator lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
doalloc lib $(tinfo) $(HEADER_DEPS)
entries lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
diff --git a/ncurses/new_pair.h b/ncurses/new_pair.h
new file mode 100644
index 000000000000..49828d4a7725
--- /dev/null
+++ b/ncurses/new_pair.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+ * Copyright (c) 2017,2018 Free Software Foundation, Inc. *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a *
+ * copy of this software and associated documentation files (the *
+ * "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 *
+ ****************************************************************************/
+
+/*
+ * Common type definitions and macros for new_pair.c, lib_color.c
+ *
+ * $Id: new_pair.h,v 1.9 2018/03/01 15:02:12 tom Exp $
+ */
+
+#ifndef NEW_PAIR_H
+#define NEW_PAIR_H 1
+/* *INDENT-OFF* */
+
+#define LIMIT_TYPED(n,t) \
+ (t)(((n) > MAX_OF_TYPE(t)) \
+ ? MAX_OF_TYPE(t) \
+ : ((n) < -MAX_OF_TYPE(t)) \
+ ? -MAX_OF_TYPE(t) \
+ : (n))
+
+#define limit_COLOR(n) LIMIT_TYPED(n,NCURSES_COLOR_T)
+#define limit_PAIRS(n) LIMIT_TYPED(n,NCURSES_PAIRS_T)
+
+#define MAX_XCURSES_PAIR MAX_OF_TYPE(NCURSES_PAIRS_T)
+
+#if NCURSES_EXT_COLORS
+#define OPTIONAL_PAIR GCC_UNUSED
+#define get_extended_pair(opts, color_pair) \
+ if ((opts) != NULL) { \
+ *(int*)(opts) = color_pair; \
+ }
+#define set_extended_pair(opts, color_pair) \
+ if ((opts) != NULL) { \
+ color_pair = *(const int*)(opts); \
+ }
+#else
+#define OPTIONAL_PAIR /* nothing */
+#define get_extended_pair(opts, color_pair) /* nothing */
+#define set_extended_pair(opts, color_pair) \
+ if ((opts) != NULL) { \
+ color_pair = -1; \
+ }
+#endif
+
+#ifdef NEW_PAIR_INTERNAL
+
+typedef enum {
+ cpKEEP = -1, /* color pair 0 */
+ cpFREE = 0, /* free for use */
+ cpINIT = 1, /* init_pair() */
+ cpAUTO = 1 /* alloc_pair() */
+} CPMODE;
+
+typedef struct _color_pairs
+{
+ int fg;
+ int bg;
+#if NCURSES_EXT_COLORS
+ int mode; /* tells if the entry is allocated or free */
+ int prev; /* index of previous item */
+ int next; /* index of next item */
+#endif
+}
+colorpair_t;
+
+#define MakeColorPair(target,f,b) target.fg = f, target.bg = b
+#define isSamePair(a,b) ((a).fg == (b).fg && (a).bg == (b).bg)
+#define FORE_OF(c) (c).fg
+#define BACK_OF(c) (c).bg
+
+/*
+ * Ensure that we use color pairs only when colors have been started, and also
+ * that the index is within the limits of the table which we allocated.
+ */
+#define ValidPair(sp,pair) \
+ ((sp != 0) && (pair >= 0) && (pair < sp->_pair_limit) && sp->_coloron)
+
+#if NCURSES_EXT_COLORS
+extern NCURSES_EXPORT(void) _nc_copy_pairs(SCREEN*, colorpair_t*, colorpair_t*, int);
+extern NCURSES_EXPORT(void) _nc_free_ordered_pairs(SCREEN*);
+extern NCURSES_EXPORT(void) _nc_reset_color_pair(SCREEN*, int, colorpair_t*);
+extern NCURSES_EXPORT(void) _nc_set_color_pair(SCREEN*, int, int);
+#else
+#define _nc_free_ordered_pairs(sp) /* nothing */
+#define _nc_reset_color_pair(sp, pair, data) /* nothing */
+#define _nc_set_color_pair(sp, pair, mode) /* nothing */
+#endif
+
+#else
+
+typedef struct _color_pairs colorpair_t;
+
+#endif /* NEW_PAIR_INTERNAL */
+
+#if NO_LEAKS
+extern NCURSES_EXPORT(void) _nc_new_pair_leaks(SCREEN*);
+#endif
+
+/* *INDENT-ON* */
+
+#endif /* NEW_PAIR_H */
diff --git a/ncurses/report_offsets.c b/ncurses/report_offsets.c
new file mode 100644
index 000000000000..a0b5ba5e1860
--- /dev/null
+++ b/ncurses/report_offsets.c
@@ -0,0 +1,228 @@
+/****************************************************************************
+ * Copyright (c) 2017,2018 Free Software Foundation, Inc. *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a *
+ * copy of this software and associated documentation files (the *
+ * "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>
+
+MODULE_ID("$Id: report_offsets.c,v 1.20 2018/07/07 19:25:40 tom Exp $")
+
+#define show_size(type) \
+ flag = 0; \
+ last = 0; \
+ printf("%5lu " #type "\n", (unsigned long)sizeof(type))
+#define show_offset(type,member) \
+ next = (unsigned long)offsetof(type,member); \
+ if (last > next) \
+ printf("?? incorrect order for " #type "." #member "\n"); \
+ printf("%5lu %c " #type "." #member "\n", next, flag ? *flag : ' '); \
+ last = next; \
+ flag = 0
+
+#if NCURSES_WIDECHAR && NCURSES_EXT_COLORS
+#define show_COLORS(type,member) { flag = "c"; show_offset(type,member); }
+#else
+#define show_COLORS(type,member) /* nothing */
+#endif
+
+#ifdef USE_TERM_DRIVER
+#define show_DRIVER(type,member) { flag = "d"; show_offset(type,member); }
+#else
+#define show_DRIVER(type,member) /* nothing */
+#endif
+
+#if NO_LEAKS
+#define show_MLEAKS(type,member) { flag = "L"; show_offset(type,member); }
+#else
+#define show_MLEAKS(type,member) /* nothing */
+#endif
+
+#ifdef USE_TERM_DRIVER
+#define show_NORMAL(type,member) /* nothing */
+#else
+#define show_NORMAL(type,member) { flag = "n"; show_offset(type,member); }
+#endif
+
+#define show_OPTION(type,member) { flag = "+"; show_offset(type,member); }
+
+#if USE_REENTRANT
+#define show_REENTR(type,member) { flag = "r"; show_offset(type,member); }
+#else
+#define show_REENTR(type,member) /* nothing */
+#endif
+
+#if NCURSES_SP_FUNCS
+#define show_SPFUNC(type,member) { flag = "s"; show_offset(type,member); }
+#else
+#define show_SPFUNC(type,member) /* nothing */
+#endif
+
+#ifdef USE_PTHREADS
+#define show_THREAD(type,member) { flag = "t"; show_offset(type,member); }
+#else
+#define show_THREAD(type,member) /* nothing */
+#endif
+
+#ifdef TRACE
+#define show_TRACES(type,member) { flag = "T"; show_offset(type,member); }
+#else
+#define show_TRACES(type,member) /* nothing */
+#endif
+
+#if USE_WIDEC_SUPPORT
+#define show_WIDECH(type,member) { flag = "w"; show_offset(type,member); }
+#else
+#define show_WIDECH(type,member) /* nothing */
+#endif
+
+int
+main(void)
+{
+ const char *flag = 0;
+ unsigned long last, next;
+
+ printf("Size/offsets of data structures:\n");
+
+ show_size(attr_t);
+ show_size(chtype);
+#if USE_WIDEC_SUPPORT
+ show_size(cchar_t);
+#endif
+ show_size(mmask_t);
+ show_size(MEVENT);
+ show_size(NCURSES_BOOL);
+
+ printf("\n");
+ show_size(SCREEN);
+ show_offset(SCREEN, _ifd);
+ show_offset(SCREEN, _fifo);
+ show_offset(SCREEN, _fifohead);
+ show_offset(SCREEN, _direct_color);
+ show_offset(SCREEN, _panelHook);
+ show_offset(SCREEN, jump);
+ show_offset(SCREEN, rsp);
+#if NCURSES_NO_PADDING
+ show_OPTION(SCREEN, _no_padding);
+#endif
+#if USE_HARD_TABS
+ show_OPTION(SCREEN, _ht_cost);
+#endif
+#if USE_ITALIC
+ show_OPTION(SCREEN, _use_ritm);
+#endif
+#if USE_KLIBC_KBD
+ show_OPTION(SCREEN, _extended_key);
+#endif
+#if NCURSES_EXT_FUNCS
+ show_OPTION(SCREEN, _assumed_color);
+#endif
+#if USE_GPM_SUPPORT
+ show_OPTION(SCREEN, _mouse_gpm_loaded);
+#ifdef HAVE_LIBDL
+ show_OPTION(SCREEN, _dlopen_gpm);
+#endif
+#endif
+#if USE_EMX_MOUSE
+ show_OPTION(SCREEN, _emxmouse_wfd);
+#endif
+#if USE_SYSMOUSE
+ show_OPTION(SCREEN, _sysmouse_fifo);
+#endif
+ show_DRIVER(SCREEN, _drv_mouse_fifo);
+#if USE_SIZECHANGE
+ show_OPTION(SCREEN, _resize);
+#endif
+ show_DRIVER(SCREEN, _windowlist);
+ show_REENTR(SCREEN, _ttytype);
+ show_SPFUNC(SCREEN, use_tioctl);
+ show_WIDECH(SCREEN, _screen_acs_fix);
+ show_COLORS(SCREEN, _ordered_pairs);
+ show_TRACES(SCREEN, tracechr_buf);
+
+ printf("\n");
+ show_size(TERMINAL);
+ show_offset(TERMINAL, type);
+ show_offset(TERMINAL, Filedes);
+ show_offset(TERMINAL, Ottyb);
+ show_offset(TERMINAL, Nttyb);
+ show_offset(TERMINAL, _baudrate);
+ show_offset(TERMINAL, _termname);
+#if HAVE_INIT_EXTENDED_COLOR
+ show_COLORS(TERMINAL, type2);
+#endif
+
+ printf("\n");
+ show_size(TERMTYPE);
+#if NCURSES_XNAMES
+ show_OPTION(TERMTYPE, ext_str_table);
+ show_OPTION(TERMTYPE, ext_Strings);
+#endif
+
+ printf("\n");
+ show_size(WINDOW);
+ show_WIDECH(WINDOW, _bkgrnd);
+ show_COLORS(WINDOW, _color);
+
+ printf("\n");
+ show_size(NCURSES_GLOBALS);
+ show_offset(NCURSES_GLOBALS, init_signals);
+ show_DRIVER(NCURSES_GLOBALS, term_driver);
+ show_NORMAL(NCURSES_GLOBALS, _nc_windowlist);
+#if USE_HOME_TERMINFO
+ show_OPTION(NCURSES_GLOBALS, home_terminfo);
+#endif
+#if !USE_SAFE_SPRINTF
+ show_OPTION(NCURSES_GLOBALS, safeprint_rows);
+#endif
+ show_THREAD(NCURSES_GLOBALS, mutex_curses);
+#if USE_PTHREADS_EINTR
+ show_THREAD(NCURSES_GLOBALS, read_thread);
+#endif
+ show_WIDECH(NCURSES_GLOBALS, key_name);
+ show_TRACES(NCURSES_GLOBALS, trace_opened);
+ show_MLEAKS(NCURSES_GLOBALS, leak_checking);
+
+ printf("\n");
+ show_size(NCURSES_PRESCREEN);
+ show_offset(NCURSES_PRESCREEN, saved_tty);
+ show_offset(NCURSES_PRESCREEN, use_tioctl);
+ show_offset(NCURSES_PRESCREEN, _outch);
+ show_NORMAL(NCURSES_PRESCREEN, rippedoff);
+#if NCURSES_NO_PADDING
+ show_OPTION(NCURSES_PRESCREEN, _no_padding);
+#endif
+#if BROKEN_LINKER
+ show_offset(NCURSES_PRESCREEN, real_acs_map);
+#else
+ show_REENTR(NCURSES_PRESCREEN, real_acs_map);
+#endif
+
+ return EXIT_SUCCESS;
+}
diff --git a/ncurses/tinfo/MKcaptab.sh b/ncurses/tinfo/MKcaptab.sh
index 20c94a639b9a..f1e989c637f0 100644
--- a/ncurses/tinfo/MKcaptab.sh
+++ b/ncurses/tinfo/MKcaptab.sh
@@ -1,6 +1,6 @@
#!/bin/sh
##############################################################################
-# Copyright (c) 2007-2010,2011 Free Software Foundation, Inc. #
+# Copyright (c) 2007-2011,2019 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"), #
@@ -26,11 +26,28 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: MKcaptab.sh,v 1.14 2011/10/22 16:34:50 tom Exp $
-AWK=${1-awk}
-OPT1=${2-0}
-OPT2=${3-tinfo/MKcaptab.awk}
-DATA=${4-../include/Caps}
+# $Id: MKcaptab.sh,v 1.15 2019/04/06 21:53:49 tom Exp $
+
+if test $# != 0
+then
+ AWK="$1"; shift 1
+else
+ AWK=awk
+fi
+
+if test $# != 0
+then
+ OPT1="$1"; shift 1
+else
+ OPT1="-0"
+fi
+
+if test $# != 0
+then
+ OPT2="$1"; shift 1
+else
+ OPT2="tinfo/MKcaptab.awk"
+fi
cat <<EOF
/*
@@ -52,12 +69,12 @@ cat <<'EOF'
EOF
-./make_hash 1 info $OPT1 <$DATA
-./make_hash 3 cap $OPT1 <$DATA
+cat "$@" |./make_hash 1 info $OPT1
+cat "$@" |./make_hash 3 cap $OPT1
-$AWK -f $OPT2 bigstrings=$OPT1 tablename=capalias <$DATA
+cat "$@" |$AWK -f $OPT2 bigstrings=$OPT1 tablename=capalias
-$AWK -f $OPT2 bigstrings=$OPT1 tablename=infoalias <$DATA
+cat "$@" |$AWK -f $OPT2 bigstrings=$OPT1 tablename=infoalias
cat <<EOF
diff --git a/ncurses/tinfo/MKcodes.awk b/ncurses/tinfo/MKcodes.awk
index 97e5131ba07c..f0dc7b303bf6 100644
--- a/ncurses/tinfo/MKcodes.awk
+++ b/ncurses/tinfo/MKcodes.awk
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2010,2019 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"), #
@@ -25,7 +25,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: MKcodes.awk,v 1.9 2010/01/23 17:57:43 tom Exp $
+# $Id: MKcodes.awk,v 1.10 2019/03/09 16:43:37 tom Exp $
function large_item(value) {
result = sprintf("%d,", offset);
offset = offset + length(value) + 1;
@@ -79,7 +79,9 @@ BEGIN {
}
$1 ~ /^#/ {next;}
+$1 ~ /^(cap|info)alias/ {next;}
+$1 == "userdef" {next;}
$1 == "SKIPWARN" {next;}
$3 == "bool" {
diff --git a/ncurses/tinfo/MKfallback.sh b/ncurses/tinfo/MKfallback.sh
index 11f1d2ead138..33b973eee88e 100755
--- a/ncurses/tinfo/MKfallback.sh
+++ b/ncurses/tinfo/MKfallback.sh
@@ -1,6 +1,6 @@
#!/bin/sh
##############################################################################
-# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2017,2019 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"), #
@@ -26,7 +26,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: MKfallback.sh,v 1.15 2010/08/07 20:32:34 tom Exp $
+# $Id: MKfallback.sh,v 1.22 2019/06/30 10:44:15 tom Exp $
#
# MKfallback.sh -- create fallback table for entry reads
#
@@ -45,6 +45,9 @@ shift
tic_path=$1
shift
+infocmp_path=$1
+shift
+
case $tic_path in #(vi
/*)
tic_head=`echo "$tic_path" | sed -e 's,/[^/]*$,,'`
@@ -69,8 +72,10 @@ else
fi
cat <<EOF
+/* This file was generated by $0 */
+
/*
- * DO NOT EDIT THIS FILE BY HAND! It is generated by MKfallback.sh.
+ * DO NOT EDIT THIS FILE BY HAND!
*/
#include <curses.priv.h>
@@ -87,18 +92,18 @@ EOF
for x in $*
do
echo "/* $x */"
- infocmp -E $x
+ $infocmp_path -E $x | sed -e 's/\<short\>/NCURSES_INT2/g'
done
cat <<EOF
-static const TERMTYPE fallbacks[$#] =
+static const TERMTYPE2 fallbacks[$#] =
{
EOF
comma=""
for x in $*
do
echo "$comma /* $x */"
- infocmp -e $x
+ $infocmp_path -e $x
comma=","
done
@@ -109,28 +114,51 @@ EOF
fi
cat <<EOF
-NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *name GCC_UNUSED)
+NCURSES_EXPORT(const TERMTYPE2 *)
+_nc_fallback2 (const char *name GCC_UNUSED)
{
EOF
if [ "$*" ]
then
cat <<EOF
- const TERMTYPE *tp;
+ const TERMTYPE2 *tp;
for (tp = fallbacks;
- tp < fallbacks + sizeof(fallbacks)/sizeof(TERMTYPE);
- tp++)
- if (_nc_name_match(tp->term_names, name, "|"))
+ tp < fallbacks + sizeof(fallbacks)/sizeof(TERMTYPE2);
+ tp++) {
+ if (_nc_name_match(tp->term_names, name, "|")) {
return(tp);
+ }
+ }
EOF
else
echo " /* the fallback list is empty */";
fi
cat <<EOF
- return((TERMTYPE *)0);
+ return((const TERMTYPE2 *)0);
+}
+
+#if NCURSES_EXT_NUMBERS
+#undef _nc_fallback
+
+/*
+ * This entrypoint is used by tack.
+ */
+NCURSES_EXPORT(const TERMTYPE *)
+_nc_fallback (const char *name)
+{
+ const TERMTYPE2 *tp = _nc_fallback2(name);
+ const TERMTYPE *result = 0;
+ if (tp != 0) {
+ static TERMTYPE temp;
+ _nc_export_termtype2(&temp, tp);
+ result = &temp;
+ }
+ return result;
}
+#endif
EOF
if test -n "$tmp_info" ; then
diff --git a/ncurses/tinfo/MKkeys_list.sh b/ncurses/tinfo/MKkeys_list.sh
index 14017b016896..158e34d25538 100755
--- a/ncurses/tinfo/MKkeys_list.sh
+++ b/ncurses/tinfo/MKkeys_list.sh
@@ -1,7 +1,7 @@
#! /bin/sh
-# $Id: MKkeys_list.sh,v 1.4 2003/10/25 16:19:54 tom Exp $
+# $Id: MKkeys_list.sh,v 1.6 2019/03/02 22:47:33 tom Exp $
##############################################################################
-# Copyright (c) 2001,2003 Free Software Foundation, Inc. #
+# Copyright (c) 2001-2017,2019 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"), #
@@ -35,11 +35,16 @@
# Extract function-key names from the Caps file
#
: ${AWK-awk}
-DATA=${1-../../include/Caps}
+if test $# != 0
+then
+ DATA="$*"
+else
+ DATA=../../include/Caps
+fi
data=data$$
-trap 'rm -f $data' 0 1 2 5 15
-sed -e 's/[ ][ ]*/ /g' < $DATA >$data
+trap 'rm -f $data' EXIT INT QUIT TERM HUP
+cat $DATA | sed -e 's/[ ][ ]*/ /g' >$data
cat <<EOF
# These definitions were generated by $0 $DATA
@@ -53,6 +58,7 @@ ${AWK-awk} <$data '
/^#/ {next;}
/^capalias/ {next;}
/^infoalias/ {next;}
+/^userdef/ {next;}
$5 != "-" {
if (substr($5, 1, 4) == "KEY_" ) {
diff --git a/ncurses/tinfo/MKnames.awk b/ncurses/tinfo/MKnames.awk
index 7685d1831ef0..b8dd4b93c624 100644
--- a/ncurses/tinfo/MKnames.awk
+++ b/ncurses/tinfo/MKnames.awk
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2007-2008,2009 Free Software Foundation, Inc. #
+# Copyright (c) 2007-2009,2019 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"), #
@@ -25,7 +25,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: MKnames.awk,v 1.22 2009/03/21 21:03:39 tom Exp $
+# $Id: MKnames.awk,v 1.23 2019/03/09 16:49:06 tom Exp $
function large_item(value) {
result = sprintf("%d,", offset);
offset = offset + length(value) + 1;
@@ -79,7 +79,9 @@ BEGIN {
}
$1 ~ /^#/ {next;}
+$1 ~ /^(cap|info)alias/ {next;}
+$1 == "userdef" {next;}
$1 == "SKIPWARN" {next;}
$3 == "bool" {
diff --git a/ncurses/tinfo/MKuserdefs.sh b/ncurses/tinfo/MKuserdefs.sh
new file mode 100755
index 000000000000..7bd7369ffef8
--- /dev/null
+++ b/ncurses/tinfo/MKuserdefs.sh
@@ -0,0 +1,146 @@
+#!/bin/sh
+##############################################################################
+# Copyright (c) 2019 Free Software Foundation, Inc. #
+# #
+# Permission is hereby granted, free of charge, to any person obtaining a #
+# copy of this software and associated documentation files (the "Software"), #
+# to deal in the Software without restriction, including without limitation #
+# the rights to use, copy, modify, merge, publish, distribute, distribute #
+# with modifications, sublicense, and/or sell copies of the Software, and to #
+# permit persons to whom the Software is furnished to do so, subject to the #
+# following conditions: #
+# #
+# The above copyright notice and this permission notice shall be included in #
+# all copies or substantial portions of the Software. #
+# #
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
+# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
+# DEALINGS IN THE SOFTWARE. #
+# #
+# Except as contained in this notice, the name(s) of the above copyright #
+# holders shall not be used in advertising or otherwise to promote the sale, #
+# use or other dealings in this Software without prior written #
+# authorization. #
+##############################################################################
+# $Id: MKuserdefs.sh,v 1.9 2019/07/28 19:12:18 tom Exp $
+AWK=${1-awk}; shift 1
+OPT1=${1-0}; shift 1
+
+cat <<EOF
+/*
+ * generated by $0
+ */
+
+EOF
+
+cat <<'EOF'
+/*
+ * comp_userdefs.c -- The names of widely used user-defined capabilities
+ * indexed via a hash table for the compiler.
+ *
+ */
+
+#include <curses.priv.h>
+#include <tic.h>
+#include <hashsize.h>
+
+#if NCURSES_XNAMES
+EOF
+
+cat "$@" | ./make_hash 1 user $OPT1
+
+cat <<EOF
+
+#define USERTABSIZE SIZEOF(user_names_data)
+
+#if $OPT1
+static void
+next_string(const char *strings, unsigned *offset)
+{
+ *offset += (unsigned) strlen(strings + *offset) + 1;
+}
+
+static const struct user_table_entry *
+_nc_build_names(struct user_table_entry **actual,
+ const user_table_data *source,
+ const char *strings)
+{
+ if (*actual == 0) {
+ *actual = typeCalloc(struct user_table_entry, USERTABSIZE);
+ if (*actual != 0) {
+ unsigned n;
+ unsigned len = 0;
+ for (n = 0; n < USERTABSIZE; ++n) {
+ (*actual)[n].ute_name = strings + len;
+ (*actual)[n].ute_type = (int) source[n].ute_type;
+ (*actual)[n].ute_argc = source[n].ute_argc;
+ (*actual)[n].ute_args = source[n].ute_args;
+ (*actual)[n].ute_index = source[n].ute_index;
+ (*actual)[n].ute_link = source[n].ute_link;
+ next_string(strings, &len);
+ }
+ }
+ }
+ return *actual;
+}
+
+#define build_names(root) _nc_build_names(&_nc_##root##_table, \\
+ root##_names_data, \\
+ root##_names_text)
+#else
+#define build_names(root) _nc_ ## root ## _table
+#endif
+
+NCURSES_EXPORT(const struct user_table_entry *) _nc_get_userdefs_table (void)
+{
+ return build_names(user) ;
+}
+
+static HashValue
+info_hash(const char *string)
+{
+ long sum = 0;
+
+ DEBUG(9, ("hashing %s", string));
+ while (*string) {
+ sum += (long) (*string + (*(string + 1) << 8));
+ string++;
+ }
+
+ DEBUG(9, ("sum is %ld", sum));
+ return (HashValue) (sum % HASHTABSIZE);
+}
+
+static int
+compare_info_names(const char *a, const char *b)
+{
+ return !strcmp(a, b);
+}
+
+static const HashData hash_data[] = {
+ { HASHTABSIZE, _nc_user_hash_table, info_hash, compare_info_names }
+};
+
+NCURSES_EXPORT(const HashData *) _nc_get_hash_user (void)
+{
+ return hash_data;
+}
+
+#if NO_LEAKS
+NCURSES_EXPORT(void) _nc_comp_userdefs_leaks(void)
+{
+#if $OPT1
+ FreeIfNeeded(_nc_user_table);
+#endif
+}
+#endif /* NO_LEAKS */
+
+#else /*! NCURSES_XNAMES */
+NCURSES_EXPORT(void) _nc_comp_userdefs(void);
+NCURSES_EXPORT(void) _nc_comp_userdefs(void) { }
+#endif /* NCURSES_XNAMES */
+EOF
diff --git a/ncurses/tinfo/access.c b/ncurses/tinfo/access.c
index d9876875382d..e086bd0c6695 100644
--- a/ncurses/tinfo/access.c
+++ b/ncurses/tinfo/access.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2019 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 *
@@ -36,15 +36,7 @@
#include <tic.h>
-MODULE_ID("$Id: access.c,v 1.23 2012/09/01 19:21:29 tom Exp $")
-
-#ifdef __TANDEM
-#define ROOT_UID 65535
-#endif
-
-#ifndef ROOT_UID
-#define ROOT_UID 0
-#endif
+MODULE_ID("$Id: access.c,v 1.24 2019/01/19 15:38:07 tom Exp $")
#define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c))
diff --git a/ncurses/tinfo/add_tries.c b/ncurses/tinfo/add_tries.c
index 29a1a60045b5..f9a4cce680a2 100644
--- a/ncurses/tinfo/add_tries.c
+++ b/ncurses/tinfo/add_tries.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2019 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 *
@@ -39,7 +39,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: add_tries.c,v 1.10 2010/12/19 01:31:14 tom Exp $")
+MODULE_ID("$Id: add_tries.c,v 1.11 2019/07/27 22:59:11 tom Exp $")
#define SET_TRY(dst,src) if ((dst->ch = *src++) == 128) dst->ch = '\0'
#define CMP_TRY(a,b) ((a)? (a == b) : (b == 128))
@@ -109,6 +109,7 @@ _nc_add_to_try(TRIES ** tree, const char *str, unsigned code)
savedptr = ptr->child;
free(ptr);
}
+ *tree = NULL;
returnCode(ERR);
}
diff --git a/ncurses/tinfo/alloc_entry.c b/ncurses/tinfo/alloc_entry.c
index 14ea39118837..5fd33e76ee8d 100644
--- a/ncurses/tinfo/alloc_entry.c
+++ b/ncurses/tinfo/alloc_entry.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 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 *
@@ -47,7 +47,7 @@
#include <tic.h>
-MODULE_ID("$Id: alloc_entry.c,v 1.58 2013/08/17 19:20:38 tom Exp $")
+MODULE_ID("$Id: alloc_entry.c,v 1.63 2019/06/08 14:29:28 tom Exp $")
#define ABSENT_OFFSET -1
#define CANCELLED_OFFSET -2
@@ -58,7 +58,7 @@ static char *stringbuf; /* buffer for string capabilities */
static size_t next_free; /* next free character in stringbuf */
NCURSES_EXPORT(void)
-_nc_init_entry(TERMTYPE *const tp)
+_nc_init_entry(ENTRY * const tp)
/* initialize a terminal type data block */
{
#if NO_LEAKS
@@ -75,7 +75,7 @@ _nc_init_entry(TERMTYPE *const tp)
next_free = 0;
- _nc_init_termtype(tp);
+ _nc_init_termtype(&(tp->tterm));
}
NCURSES_EXPORT(ENTRY *)
@@ -85,7 +85,7 @@ _nc_copy_entry(ENTRY * oldp)
if (newp != 0) {
*newp = *oldp;
- _nc_copy_termtype(&(newp->tterm), &(oldp->tterm));
+ _nc_copy_termtype2(&(newp->tterm), &(oldp->tterm));
}
return newp;
}
@@ -96,7 +96,11 @@ _nc_save_str(const char *const string)
{
char *result = 0;
size_t old_next_free = next_free;
- size_t len = strlen(string) + 1;
+ size_t len;
+
+ if (!VALID_STRING(string))
+ return _nc_save_str("");
+ len = strlen(string) + 1;
if (len == 1 && next_free != 0) {
/*
@@ -126,7 +130,7 @@ _nc_wrap_entry(ENTRY * const ep, bool copy_strings)
int useoffsets[MAX_USES];
unsigned i, n;
unsigned nuses = ep->nuses;
- TERMTYPE *tp = &(ep->tterm);
+ TERMTYPE2 *tp = &(ep->tterm);
if (copy_strings) {
next_free = 0; /* clear static storage */
@@ -218,12 +222,22 @@ _nc_wrap_entry(ENTRY * const ep, bool copy_strings)
}
NCURSES_EXPORT(void)
-_nc_merge_entry(TERMTYPE *const to, TERMTYPE *const from)
+_nc_merge_entry(ENTRY * const target, ENTRY * const source)
/* merge capabilities from `from' entry into `to' entry */
{
+ TERMTYPE2 *to = &(target->tterm);
+ TERMTYPE2 *from = &(source->tterm);
+#if NCURSES_XNAMES
+ TERMTYPE2 copy;
+#endif
unsigned i;
+ if (source == 0 || from == 0 || target == 0 || to == 0)
+ return;
+
#if NCURSES_XNAMES
+ _nc_copy_termtype2(&copy, from);
+ from = &copy;
_nc_align_termtype(to, from);
#endif
for_each_boolean(i, from) {
@@ -233,18 +247,18 @@ _nc_merge_entry(TERMTYPE *const to, TERMTYPE *const from)
if (mergebool == CANCELLED_BOOLEAN)
to->Booleans[i] = FALSE;
else if (mergebool == TRUE)
- to->Booleans[i] = (char) mergebool;
+ to->Booleans[i] = (NCURSES_SBOOL) mergebool;
}
}
for_each_number(i, from) {
if (to->Numbers[i] != CANCELLED_NUMERIC) {
- short mergenum = from->Numbers[i];
+ int mergenum = from->Numbers[i];
if (mergenum == CANCELLED_NUMERIC)
to->Numbers[i] = ABSENT_NUMERIC;
else if (mergenum != ABSENT_NUMERIC)
- to->Numbers[i] = mergenum;
+ to->Numbers[i] = (NCURSES_INT2) mergenum;
}
}
@@ -263,6 +277,16 @@ _nc_merge_entry(TERMTYPE *const to, TERMTYPE *const from)
to->Strings[i] = mergestring;
}
}
+#if NCURSES_XNAMES
+ /* Discard the data allocated in _nc_copy_termtype2, but do not use
+ * _nc_free_termtype2 because that frees the string-table (which is
+ * not allocated by _nc_copy_termtype2).
+ */
+ free(copy.Booleans);
+ free(copy.Numbers);
+ free(copy.Strings);
+ free(copy.ext_Names);
+#endif
}
#if NO_LEAKS
diff --git a/ncurses/tinfo/alloc_ttype.c b/ncurses/tinfo/alloc_ttype.c
index 35c92dd8c2b9..49169a13ee3f 100644
--- a/ncurses/tinfo/alloc_ttype.c
+++ b/ncurses/tinfo/alloc_ttype.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2018,2019 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 *
@@ -42,7 +42,7 @@
#include <tic.h>
-MODULE_ID("$Id: alloc_ttype.c,v 1.27 2013/06/08 16:54:50 tom Exp $")
+MODULE_ID("$Id: alloc_ttype.c,v 1.31 2019/04/27 23:28:31 tom Exp $")
#if NCURSES_XNAMES
/*
@@ -61,7 +61,7 @@ merge_names(char **dst, char **a, int na, char **b, int nb)
} else if (cmp > 0) {
dst[n++] = *b++;
nb--;
- } else if (cmp == 0) {
+ } else {
dst[n++] = *a;
a++, b++;
na--, nb--;
@@ -78,37 +78,59 @@ merge_names(char **dst, char **a, int na, char **b, int nb)
}
static bool
-find_name(char **table, int length, char *name)
+find_name(char **table, int item, int length, const char *name)
{
- while (length-- > 0) {
- if (!strcmp(*table++, name)) {
- DEBUG(4, ("found name '%s'", name));
- return TRUE;
+ int n;
+ int result = -1;
+
+ for (n = item; n < length; ++n) {
+ if (!strcmp(table[n], name)) {
+ DEBUG(4, ("found name '%s' @%d", name, n));
+ result = n;
+ break;
}
}
- DEBUG(4, ("did not find name '%s'", name));
- return FALSE;
+ if (result < 0) {
+ DEBUG(4, ("did not find name '%s'", name));
+ }
+ return (result >= 0);
}
#define EXTEND_NUM(num, ext) \
+ DEBUG(4, ("extending " #num " from %d to %d", \
+ to->num, (unsigned short) (to->num + (ext - to->ext)))); \
to->num = (unsigned short) (to->num + (ext - to->ext))
static void
-realign_data(TERMTYPE *to, char **ext_Names,
+realign_data(TERMTYPE2 *to, char **ext_Names,
int ext_Booleans,
int ext_Numbers,
int ext_Strings)
{
int n, m, base;
- int limit = (to->ext_Booleans + to->ext_Numbers + to->ext_Strings);
+ int to_Booleans = to->ext_Booleans;
+ int to_Numbers = to->ext_Numbers;
+ int to_Strings = to->ext_Strings;
+ int to1, to2, from;
+
+ DEBUG(4, ("realign_data %d/%d/%d vs %d/%d/%d",
+ ext_Booleans,
+ ext_Numbers,
+ ext_Strings,
+ to->ext_Booleans,
+ to->ext_Numbers,
+ to->ext_Strings));
if (to->ext_Booleans != ext_Booleans) {
+ to1 = 0;
+ to2 = to_Booleans + to1;
+ from = 0;
EXTEND_NUM(num_Booleans, ext_Booleans);
TYPE_REALLOC(NCURSES_SBOOL, to->num_Booleans, to->Booleans);
for (n = to->ext_Booleans - 1,
m = ext_Booleans - 1,
base = to->num_Booleans - (m + 1); m >= 0; m--) {
- if (find_name(to->ext_Names, limit, ext_Names[m])) {
+ if (find_name(to->ext_Names, to1, to2, ext_Names[m + from])) {
to->Booleans[base + m] = to->Booleans[base + n--];
} else {
to->Booleans[base + m] = FALSE;
@@ -118,12 +140,15 @@ realign_data(TERMTYPE *to, char **ext_Names,
}
if (to->ext_Numbers != ext_Numbers) {
+ to1 = to_Booleans;
+ to2 = to_Numbers + to1;
+ from = ext_Booleans;
EXTEND_NUM(num_Numbers, ext_Numbers);
- TYPE_REALLOC(short, to->num_Numbers, to->Numbers);
+ TYPE_REALLOC(NCURSES_INT2, to->num_Numbers, to->Numbers);
for (n = to->ext_Numbers - 1,
m = ext_Numbers - 1,
base = to->num_Numbers - (m + 1); m >= 0; m--) {
- if (find_name(to->ext_Names, limit, ext_Names[m + ext_Booleans])) {
+ if (find_name(to->ext_Names, to1, to2, ext_Names[m + from])) {
to->Numbers[base + m] = to->Numbers[base + n--];
} else {
to->Numbers[base + m] = ABSENT_NUMERIC;
@@ -131,13 +156,17 @@ realign_data(TERMTYPE *to, char **ext_Names,
}
to->ext_Numbers = UShort(ext_Numbers);
}
+
if (to->ext_Strings != ext_Strings) {
+ to1 = to_Booleans + to_Numbers;
+ to2 = to_Strings + to1;
+ from = ext_Booleans + ext_Numbers;
EXTEND_NUM(num_Strings, ext_Strings);
TYPE_REALLOC(char *, to->num_Strings, to->Strings);
for (n = to->ext_Strings - 1,
m = ext_Strings - 1,
base = to->num_Strings - (m + 1); m >= 0; m--) {
- if (find_name(to->ext_Names, limit, ext_Names[m + ext_Booleans + ext_Numbers])) {
+ if (find_name(to->ext_Names, to1, to2, ext_Names[m + from])) {
to->Strings[base + m] = to->Strings[base + n--];
} else {
to->Strings[base + m] = ABSENT_STRING;
@@ -151,7 +180,7 @@ realign_data(TERMTYPE *to, char **ext_Names,
* Returns the first index in ext_Names[] for the given token-type
*/
static unsigned
-_nc_first_ext_name(TERMTYPE *tp, int token_type)
+_nc_first_ext_name(TERMTYPE2 *tp, int token_type)
{
unsigned first;
@@ -176,7 +205,7 @@ _nc_first_ext_name(TERMTYPE *tp, int token_type)
* Returns the last index in ext_Names[] for the given token-type
*/
static unsigned
-_nc_last_ext_name(TERMTYPE *tp, int token_type)
+_nc_last_ext_name(TERMTYPE2 *tp, int token_type)
{
unsigned last;
@@ -199,7 +228,7 @@ _nc_last_ext_name(TERMTYPE *tp, int token_type)
* Lookup an entry from extended-names, returning -1 if not found
*/
static int
-_nc_find_ext_name(TERMTYPE *tp, char *name, int token_type)
+_nc_find_ext_name(TERMTYPE2 *tp, char *name, int token_type)
{
unsigned j;
unsigned first = _nc_first_ext_name(tp, token_type);
@@ -218,7 +247,7 @@ _nc_find_ext_name(TERMTYPE *tp, char *name, int token_type)
* (e.g., Booleans[]).
*/
static int
-_nc_ext_data_index(TERMTYPE *tp, int n, int token_type)
+_nc_ext_data_index(TERMTYPE2 *tp, int n, int token_type)
{
switch (token_type) {
case BOOLEAN:
@@ -241,13 +270,14 @@ _nc_ext_data_index(TERMTYPE *tp, int n, int token_type)
* data.
*/
static bool
-_nc_del_ext_name(TERMTYPE *tp, char *name, int token_type)
+_nc_del_ext_name(TERMTYPE2 *tp, char *name, int token_type)
{
- int j;
- int first, last;
+ int first;
if ((first = _nc_find_ext_name(tp, name, token_type)) >= 0) {
- last = (int) NUM_EXT_NAMES(tp) - 1;
+ int j;
+ int last = (int) NUM_EXT_NAMES(tp) - 1;
+
for (j = first; j < last; j++) {
tp->ext_Names[j] = tp->ext_Names[j + 1];
}
@@ -285,7 +315,7 @@ _nc_del_ext_name(TERMTYPE *tp, char *name, int token_type)
* index into the corresponding data array is returned.
*/
static int
-_nc_ins_ext_name(TERMTYPE *tp, char *name, int token_type)
+_nc_ins_ext_name(TERMTYPE2 *tp, char *name, int token_type)
{
unsigned first = _nc_first_ext_name(tp, token_type);
unsigned last = _nc_last_ext_name(tp, token_type);
@@ -319,7 +349,7 @@ _nc_ins_ext_name(TERMTYPE *tp, char *name, int token_type)
case NUMBER:
tp->ext_Numbers++;
tp->num_Numbers++;
- TYPE_REALLOC(short, tp->num_Numbers, tp->Numbers);
+ TYPE_REALLOC(NCURSES_INT2, tp->num_Numbers, tp->Numbers);
for (k = (unsigned) (tp->num_Numbers - 1); k > j; k--)
tp->Numbers[k] = tp->Numbers[k - 1];
break;
@@ -340,7 +370,7 @@ _nc_ins_ext_name(TERMTYPE *tp, char *name, int token_type)
* cancellation of a name that is inherited from another entry.
*/
static void
-adjust_cancels(TERMTYPE *to, TERMTYPE *from)
+adjust_cancels(TERMTYPE2 *to, TERMTYPE2 *from)
{
int first = to->ext_Booleans + to->ext_Numbers;
int last = first + to->ext_Strings;
@@ -385,24 +415,30 @@ adjust_cancels(TERMTYPE *to, TERMTYPE *from)
}
NCURSES_EXPORT(void)
-_nc_align_termtype(TERMTYPE *to, TERMTYPE *from)
+_nc_align_termtype(TERMTYPE2 *to, TERMTYPE2 *from)
{
- int na = (int) NUM_EXT_NAMES(to);
- int nb = (int) NUM_EXT_NAMES(from);
- int n;
- bool same;
+ int na;
+ int nb;
char **ext_Names;
- int ext_Booleans, ext_Numbers, ext_Strings;
- bool used_ext_Names = FALSE;
- DEBUG(2, ("align_termtype to(%d:%s), from(%d:%s)", na, to->term_names,
- nb, from->term_names));
+ na = to ? ((int) NUM_EXT_NAMES(to)) : 0;
+ nb = from ? ((int) NUM_EXT_NAMES(from)) : 0;
+
+ DEBUG(2, ("align_termtype to(%d:%s), from(%d:%s)",
+ na, to ? NonNull(to->term_names) : "?",
+ nb, from ? NonNull(from->term_names) : "?"));
if (na != 0 || nb != 0) {
+ int ext_Booleans, ext_Numbers, ext_Strings;
+ bool used_ext_Names = FALSE;
+
if ((na == nb) /* check if the arrays are equivalent */
&&(to->ext_Booleans == from->ext_Booleans)
&& (to->ext_Numbers == from->ext_Numbers)
&& (to->ext_Strings == from->ext_Strings)) {
+ int n;
+ bool same;
+
for (n = 0, same = TRUE; n < na; n++) {
if (strcmp(to->ext_Names[n], from->ext_Names[n])) {
same = FALSE;
@@ -473,29 +509,80 @@ _nc_align_termtype(TERMTYPE *to, TERMTYPE *from)
}
#endif
-NCURSES_EXPORT(void)
-_nc_copy_termtype(TERMTYPE *dst, const TERMTYPE *src)
+#define srcINT 1
+#define dstINT 2
+
+/*
+ * TERMTYPE and TERMTYPE2 differ only with regard to the values in Numbers.
+ * Use 'mode' to decide which to use.
+ */
+static void
+copy_termtype(TERMTYPE2 *dst, const TERMTYPE2 *src, int mode)
{
-#if NCURSES_XNAMES
+#if NCURSES_XNAMES || NCURSES_EXT_NUMBERS
unsigned i;
#endif
+#if NCURSES_EXT_NUMBERS
+ short *oldptr = 0;
+ int *newptr = 0;
+#endif
+ DEBUG(2, ("copy_termtype"));
*dst = *src; /* ...to copy the sizes and string-tables */
TYPE_MALLOC(NCURSES_SBOOL, NUM_BOOLEANS(dst), dst->Booleans);
- TYPE_MALLOC(short, NUM_NUMBERS(dst), dst->Numbers);
TYPE_MALLOC(char *, NUM_STRINGS(dst), dst->Strings);
memcpy(dst->Booleans,
src->Booleans,
NUM_BOOLEANS(dst) * sizeof(dst->Booleans[0]));
- memcpy(dst->Numbers,
- src->Numbers,
- NUM_NUMBERS(dst) * sizeof(dst->Numbers[0]));
memcpy(dst->Strings,
src->Strings,
NUM_STRINGS(dst) * sizeof(dst->Strings[0]));
+#if NCURSES_EXT_NUMBERS
+ if ((mode & dstINT) == 0) {
+ DEBUG(2, ("...convert int ->short"));
+ TYPE_MALLOC(short, NUM_NUMBERS(dst), oldptr);
+ ((TERMTYPE *) dst)->Numbers = oldptr;
+ } else {
+ DEBUG(2, ("...copy without changing size"));
+ TYPE_MALLOC(int, NUM_NUMBERS(dst), newptr);
+ dst->Numbers = newptr;
+ }
+ if ((mode == srcINT) && (oldptr != 0)) {
+ DEBUG(2, ("...copy int ->short"));
+ for (i = 0; i < NUM_NUMBERS(dst); ++i) {
+ if (src->Numbers[i] > MAX_OF_TYPE(short)) {
+ oldptr[i] = MAX_OF_TYPE(short);
+ } else {
+ oldptr[i] = (short) src->Numbers[i];
+ }
+ }
+ } else if ((mode == dstINT) && (newptr != 0)) {
+ DEBUG(2, ("...copy short ->int"));
+ for (i = 0; i < NUM_NUMBERS(dst); ++i) {
+ newptr[i] = ((const short *) (src->Numbers))[i];
+ }
+ } else {
+ DEBUG(2, ("...copy %s without change",
+ (mode & dstINT)
+ ? "int"
+ : "short"));
+ memcpy(dst->Numbers,
+ src->Numbers,
+ NUM_NUMBERS(dst) * ((mode & dstINT)
+ ? sizeof(int)
+ : sizeof(short)));
+ }
+#else
+ (void) mode;
+ TYPE_MALLOC(short, NUM_NUMBERS(dst), dst->Numbers);
+ memcpy(dst->Numbers,
+ src->Numbers,
+ NUM_NUMBERS(dst) * sizeof(dst->Numbers[0]));
+#endif
+
/* FIXME: we probably should also copy str_table and ext_str_table,
* but tic and infocmp are not written to exploit that (yet).
*/
@@ -509,3 +596,33 @@ _nc_copy_termtype(TERMTYPE *dst, const TERMTYPE *src)
}
#endif
}
+
+/*
+ * This entrypoint is used by tack.
+ */
+NCURSES_EXPORT(void)
+_nc_copy_termtype(TERMTYPE *dst, const TERMTYPE *src)
+{
+ DEBUG(2, ("_nc_copy_termtype..."));
+ copy_termtype((TERMTYPE2 *) dst, (const TERMTYPE2 *) src, 0);
+}
+
+#if NCURSES_EXT_NUMBERS
+NCURSES_EXPORT(void)
+_nc_copy_termtype2(TERMTYPE2 *dst, const TERMTYPE2 *src)
+{
+ DEBUG(2, ("_nc_copy_termtype2..."));
+ copy_termtype(dst, src, srcINT | dstINT);
+}
+
+/*
+ * Use this for exporting the internal TERMTYPE2 to the legacy format used via
+ * the CUR macro by applications.
+ */
+NCURSES_EXPORT(void)
+_nc_export_termtype2(TERMTYPE *dst, const TERMTYPE2 *src)
+{
+ DEBUG(2, ("_nc_export_termtype2..."));
+ copy_termtype((TERMTYPE2 *) dst, src, srcINT);
+}
+#endif /* NCURSES_EXT_NUMBERS */
diff --git a/ncurses/tinfo/captoinfo.c b/ncurses/tinfo/captoinfo.c
index e02e622b0de3..a9eb1e53454d 100644
--- a/ncurses/tinfo/captoinfo.c
+++ b/ncurses/tinfo/captoinfo.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 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 *
@@ -33,12 +33,16 @@
****************************************************************************/
/*
- * captoinfo.c --- conversion between termcap and terminfo formats
+ * captoinfo.c
+ *
+ * Provide conversion in both directions between termcap and terminfo.
+ *
+ * cap-to-info --- conversion between termcap and terminfo formats
*
* The captoinfo() code was swiped from Ross Ridge's mytinfo package,
* adapted to fit ncurses by Eric S. Raymond <esr@snark.thyrsus.com>.
*
- * There is just one entry point:
+ * It has just one entry point:
*
* char *_nc_captoinfo(n, s, parameterized)
*
@@ -93,7 +97,13 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: captoinfo.c,v 1.77 2012/12/30 00:50:40 tom Exp $")
+MODULE_ID("$Id: captoinfo.c,v 1.97 2019/10/15 23:13:35 tom Exp $")
+
+#if 0
+#define DEBUG_THIS(p) DEBUG(9, p)
+#else
+#define DEBUG_THIS(p) /* nothing */
+#endif
#define MAX_PUSHED 16 /* max # args we can push onto the stack */
@@ -181,7 +191,7 @@ cvtchar(register const char *sp)
case '$':
case '\\':
case '%':
- c = (unsigned char) (*sp);
+ c = UChar(*sp);
len = 2;
break;
case '\0':
@@ -194,29 +204,33 @@ cvtchar(register const char *sp)
case '3':
len = 1;
while (isdigit(UChar(*sp))) {
- c = (unsigned char) (8 * c + (*sp++ - '0'));
+ c = UChar(8 * c + (*sp++ - '0'));
len++;
}
break;
default:
- c = (unsigned char) (*sp);
- len = 2;
+ c = UChar(*sp);
+ len = (c != '\0') ? 2 : 1;
break;
}
break;
case '^':
- c = (unsigned char) (*++sp & 0x1f);
+ c = UChar(*++sp);
+ if (c == '?')
+ c = 127;
+ else
+ c &= 0x1f;
len = 2;
break;
default:
- c = (unsigned char) (*sp);
- len = 1;
+ c = UChar(*sp);
+ len = (c != '\0') ? 1 : 0;
}
if (isgraph(c) && c != ',' && c != '\'' && c != '\\' && c != ':') {
dp = save_string(dp, "%\'");
dp = save_char(dp, c);
dp = save_char(dp, '\'');
- } else {
+ } else if (c != '\0') {
dp = save_string(dp, "%{");
if (c > 99)
dp = save_char(dp, c / 100 + '0');
@@ -232,6 +246,8 @@ static void
getparm(int parm, int n)
/* push n copies of param on the terminfo stack if not already there */
{
+ int nn;
+
if (seenr) {
if (parm == 1)
parm = 2;
@@ -239,7 +255,7 @@ getparm(int parm, int n)
parm = 1;
}
- while (n--) {
+ for (nn = 0; nn < n; ++nn) {
dp = save_string(dp, "%p");
dp = save_char(dp, '0' + parm);
}
@@ -248,7 +264,7 @@ getparm(int parm, int n)
if (n > 1) {
_nc_warning("string may not be optimal");
dp = save_string(dp, "%Pa");
- while (n--) {
+ while (n-- > 0) {
dp = save_string(dp, "%ga");
}
}
@@ -288,6 +304,8 @@ _nc_captoinfo(const char *cap, const char *s, int const parameterized)
seenr = 0;
param = 1;
+ DEBUG_THIS(("_nc_captoinfo params %d, %s", parameterized, s));
+
dp = init_string();
/* skip the initial padding (if we haven't been told not to) */
@@ -295,7 +313,7 @@ _nc_captoinfo(const char *cap, const char *s, int const parameterized)
if (s == 0)
s = "";
if (parameterized >= 0 && isdigit(UChar(*s)))
- for (capstart = s;; s++)
+ for (capstart = s; *s != '\0'; s++)
if (!(isdigit(UChar(*s)) || *s == '*' || *s == '.'))
break;
@@ -309,7 +327,7 @@ _nc_captoinfo(const char *cap, const char *s, int const parameterized)
}
switch (*s++) {
case '%':
- dp = save_char(dp, '%');
+ dp = save_string(dp, "%%");
break;
case 'r':
if (seenr++ == 1) {
@@ -342,13 +360,18 @@ _nc_captoinfo(const char *cap, const char *s, int const parameterized)
dp = save_string(dp, "%{2}%*%-");
break;
case '>':
- getparm(param, 2);
/* %?%{x}%>%t%{y}%+%; */
- dp = save_string(dp, "%?");
- s += cvtchar(s);
- dp = save_string(dp, "%>%t");
- s += cvtchar(s);
- dp = save_string(dp, "%+%;");
+ if (s[0] && s[1]) {
+ getparm(param, 2);
+ dp = save_string(dp, "%?");
+ s += cvtchar(s);
+ dp = save_string(dp, "%>%t");
+ s += cvtchar(s);
+ dp = save_string(dp, "%+%;");
+ } else {
+ _nc_warning("expected two characters after %%>");
+ dp = save_string(dp, "%>");
+ }
break;
case 'a':
if ((*s == '=' || *s == '+' || *s == '-'
@@ -429,12 +452,17 @@ _nc_captoinfo(const char *cap, const char *s, int const parameterized)
pop();
break;
case '0': /* not clear any of the historical termcaps did this */
- if (*s == '3')
+ if (*s == '3') {
+ ++s;
goto see03;
- else if (*s != '2')
- goto invalid;
- /* FALLTHRU */
+ }
+ if (*s == '2') {
+ ++s;
+ goto see02;
+ }
+ goto invalid;
case '2':
+ see02:
getparm(param, 1);
dp = save_string(dp, "%2d");
pop();
@@ -469,7 +497,8 @@ _nc_captoinfo(const char *cap, const char *s, int const parameterized)
}
break;
default:
- dp = save_char(dp, *s++);
+ if (*s != '\0')
+ dp = save_char(dp, *s++);
break;
}
}
@@ -480,7 +509,7 @@ _nc_captoinfo(const char *cap, const char *s, int const parameterized)
*/
if (capstart) {
dp = save_string(dp, "$<");
- for (s = capstart;; s++)
+ for (s = capstart; *s != '\0'; s++)
if (isdigit(UChar(*s)) || *s == '*' || *s == '.')
dp = save_char(dp, *s);
else
@@ -489,6 +518,9 @@ _nc_captoinfo(const char *cap, const char *s, int const parameterized)
}
(void) save_char(dp, '\0');
+
+ DEBUG_THIS(("... _nc_captoinfo %s", NonNull(my_string)));
+
return (my_string);
}
@@ -525,13 +557,13 @@ bcd_expression(const char *str)
static char *
save_tc_char(char *bufptr, int c1)
{
- char temp[80];
-
if (is7bits(c1) && isprint(c1)) {
if (c1 == ':' || c1 == '\\')
bufptr = save_char(bufptr, '\\');
bufptr = save_char(bufptr, c1);
} else {
+ char temp[80];
+
if (c1 == (c1 & 0x1f)) { /* iscntrl() returns T on 255 */
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
"%.20s", unctrl((chtype) c1));
@@ -554,6 +586,8 @@ save_tc_inequality(char *bufptr, int c1, int c2)
}
/*
+ * info-to-cap --- conversion between terminfo and termcap formats
+ *
* Here are the capabilities infotocap assumes it can translate to:
*
* %% output `%'
@@ -571,6 +605,8 @@ save_tc_inequality(char *bufptr, int c1, int c2)
* %m exclusive-or all parameters with 0177 (not in 4.4BSD)
*/
+#define octal_fixup(n, c) fixups[n].ch = ((fixups[n].ch << 3) | ((c) - '0'))
+
/*
* Convert a terminfo string to termcap format. Parameters are as in
* _nc_captoinfo().
@@ -586,7 +622,15 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
char *bufptr = init_string();
char octal[4];
int len;
+ int digits;
bool syntax_error = FALSE;
+ int myfix = 0;
+ struct {
+ int ch;
+ int offset;
+ } fixups[MAX_TC_FIXUPS];
+
+ DEBUG_THIS(("_nc_infotocap params %d, %s", parameterized, str));
/* we may have to move some trailing mandatory padding up front */
padding = str + strlen(str) - 1;
@@ -603,7 +647,9 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
bufptr = save_char(bufptr, *padding++);
}
- for (; *str && ((trimmed == 0) || (str < trimmed)); str++) {
+ for (; !syntax_error &&
+ *str &&
+ ((trimmed == 0) || (str < trimmed)); str++) {
int c1, c2;
char *cp = 0;
@@ -611,6 +657,14 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
if (str[1] == '\0' || (str + 1) == trimmed) {
bufptr = save_string(bufptr, "\\136");
++str;
+ } else if (str[1] == '?') {
+ /*
+ * Although the 4.3BSD termcap file has an instance of "kb=^?",
+ * that appears to be just cut/paste since neither 4.3BSD nor
+ * 4.4BSD termcap interprets "^?" as DEL.
+ */
+ bufptr = save_string(bufptr, "\\177");
+ ++str;
} else {
bufptr = save_char(bufptr, *str++);
bufptr = save_char(bufptr, *str);
@@ -625,17 +679,20 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
} else if (str[1] == ',') {
bufptr = save_char(bufptr, *++str);
} else {
- int xx1, xx2;
+ int xx1;
bufptr = save_char(bufptr, *str++);
xx1 = *str;
if (_nc_strict_bsd) {
- if (isdigit(UChar(xx1))) {
+
+ if (isoctal(UChar(xx1))) {
int pad = 0;
+ int xx2;
+ int fix = 0;
- if (!isdigit(UChar(str[1])))
+ if (!isoctal(UChar(str[1])))
pad = 2;
- else if (str[1] && !isdigit(UChar(str[2])))
+ else if (str[1] && !isoctal(UChar(str[2])))
pad = 1;
/*
@@ -650,10 +707,31 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
xx2 = '0';
pad = 0; /* FIXME - optionally pad to 3 digits */
}
+ if (myfix < MAX_TC_FIXUPS) {
+ fix = 3 - pad;
+ fixups[myfix].ch = 0;
+ fixups[myfix].offset = (int) (bufptr
+ - my_string
+ - 1);
+ }
while (pad-- > 0) {
bufptr = save_char(bufptr, xx2);
+ if (myfix < MAX_TC_FIXUPS) {
+ fixups[myfix].ch <<= 3;
+ fixups[myfix].ch |= (xx2 - '0');
+ }
xx2 = '0';
}
+ if (myfix < MAX_TC_FIXUPS) {
+ int n;
+ for (n = 0; n < fix; ++n) {
+ fixups[myfix].ch <<= 3;
+ fixups[myfix].ch |= (str[n] - '0');
+ }
+ if (fixups[myfix].ch < 32) {
+ ++myfix;
+ }
+ }
} else if (strchr("E\\nrtbf", xx1) == 0) {
switch (xx1) {
case 'e':
@@ -689,6 +767,24 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
break;
}
}
+ } else {
+ if (myfix < MAX_TC_FIXUPS && isoctal(UChar(xx1))) {
+ bool will_fix = TRUE;
+ int n;
+
+ fixups[myfix].ch = 0;
+ fixups[myfix].offset = (int) (bufptr - my_string - 1);
+ for (n = 0; n < 3; ++n) {
+ if (isoctal(str[n])) {
+ octal_fixup(myfix, str[n]);
+ } else {
+ will_fix = FALSE;
+ break;
+ }
+ }
+ if (will_fix && (fixups[myfix].ch < 32))
+ ++myfix;
+ }
}
bufptr = save_char(bufptr, xx1);
}
@@ -735,8 +831,9 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
} else if ((len = bcd_expression(str)) != 0) {
str += len;
bufptr = save_string(bufptr, "%B");
- } else if ((sscanf(str, "%%{%d}%%+%%c", &c1) == 1
- || sscanf(str, "%%'%c'%%+%%c", &ch1) == 1)
+ } else if ((sscanf(str, "%%{%d}%%+%%%c", &c1, &ch2) == 2
+ || sscanf(str, "%%'%c'%%+%%%c", &ch1, &ch2) == 2)
+ && ch2 == 'c'
&& (cp = strchr(str, '+'))) {
str = cp + 2;
bufptr = save_string(bufptr, "%+");
@@ -779,26 +876,46 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
bufptr = save_char(bufptr, '%');
ch1 = 0;
ch2 = 0;
+ digits = 0;
while (isdigit(UChar(*str))) {
+ if (++digits > 2) {
+ syntax_error = TRUE;
+ break;
+ }
ch2 = ch1;
ch1 = *str++;
- if (_nc_strict_bsd) {
- if (ch1 > '3')
- return 0;
+ if (digits == 2 && ch2 != '0') {
+ syntax_error = TRUE;
+ break;
+ } else if (_nc_strict_bsd) {
+ if (ch1 > '3') {
+ syntax_error = TRUE;
+ break;
+ }
} else {
bufptr = save_char(bufptr, ch1);
}
}
+ if (syntax_error)
+ break;
+ /*
+ * Convert %02 to %2 and %03 to %3
+ */
+ if (ch2 == '0' && !_nc_strict_bsd) {
+ ch2 = 0;
+ bufptr[-2] = bufptr[-1];
+ *--bufptr = 0;
+ }
if (_nc_strict_bsd) {
- if (ch2 != 0 && ch2 != '0')
- return 0;
- if (ch1 < '2')
+ if (ch2 != 0 && ch2 != '0') {
+ syntax_error = TRUE;
+ } else if (ch1 < '2') {
ch1 = 'd';
+ }
bufptr = save_char(bufptr, ch1);
}
- if (strchr("doxX.", *str)) {
- if (*str != 'd') /* termcap doesn't have octal, hex */
- return 0;
+ if (strchr("oxX.", *str)) {
+ syntax_error = TRUE; /* termcap doesn't have octal, hex */
}
break;
@@ -816,9 +933,11 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
* termcap notation.
*/
case 's':
- if (_nc_strict_bsd)
- return 0;
- bufptr = save_string(bufptr, "%s");
+ if (_nc_strict_bsd) {
+ syntax_error = TRUE;
+ } else {
+ bufptr = save_string(bufptr, "%s");
+ }
break;
case 'p':
@@ -830,8 +949,9 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
bufptr = save_string(bufptr, "%r");
seentwo++;
}
- } else if (*str >= '3')
- return (0);
+ } else if (*str >= '3') {
+ syntax_error = TRUE;
+ }
break;
case 'i':
@@ -855,6 +975,24 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
} /* endwhile (*str) */
+ if (!syntax_error &&
+ myfix > 0 &&
+ ((int) strlen(my_string) - (4 * myfix)) < MIN_TC_FIXUPS) {
+ while (--myfix >= 0) {
+ char *p = fixups[myfix].offset + my_string;
+ *p++ = '^';
+ *p++ = (char) (fixups[myfix].ch | '@');
+ while ((p[0] = p[2]) != '\0') {
+ ++p;
+ }
+ }
+ }
+
+ DEBUG_THIS(("... _nc_infotocap %s",
+ syntax_error
+ ? "<ERR>"
+ : _nc_visbuf(my_string)));
+
return (syntax_error ? NULL : my_string);
}
diff --git a/ncurses/tinfo/comp_error.c b/ncurses/tinfo/comp_error.c
index ff0acc799815..48ab9777a2c7 100644
--- a/ncurses/tinfo/comp_error.c
+++ b/ncurses/tinfo/comp_error.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2016,2019 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 *
@@ -41,7 +41,7 @@
#include <tic.h>
-MODULE_ID("$Id: comp_error.c,v 1.36 2012/02/22 22:34:31 tom Exp $")
+MODULE_ID("$Id: comp_error.c,v 1.39 2019/01/20 02:31:22 tom Exp $")
NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings = FALSE;
NCURSES_EXPORT_VAR(int) _nc_curr_line = 0; /* current line # in input */
@@ -66,12 +66,14 @@ _nc_set_source(const char *const name)
NCURSES_EXPORT(void)
_nc_set_type(const char *const name)
{
+#define MY_SIZE (size_t) MAX_NAME_SIZE
if (TermType == 0)
- TermType = typeMalloc(char, MAX_NAME_SIZE + 1);
+ TermType = typeMalloc(char, MY_SIZE + 1);
if (TermType != 0) {
TermType[0] = '\0';
- if (name)
- strncat(TermType, name, (size_t) MAX_NAME_SIZE);
+ if (name) {
+ _nc_STRNCAT(TermType, name, MY_SIZE, MY_SIZE);
+ }
}
}
@@ -103,7 +105,7 @@ where_is_problem(void)
}
NCURSES_EXPORT(void)
-_nc_warning(const char *const fmt,...)
+_nc_warning(const char *const fmt, ...)
{
va_list argp;
@@ -118,7 +120,7 @@ _nc_warning(const char *const fmt,...)
}
NCURSES_EXPORT(void)
-_nc_err_abort(const char *const fmt,...)
+_nc_err_abort(const char *const fmt, ...)
{
va_list argp;
@@ -131,7 +133,7 @@ _nc_err_abort(const char *const fmt,...)
}
NCURSES_EXPORT(void)
-_nc_syserr_abort(const char *const fmt,...)
+_nc_syserr_abort(const char *const fmt, ...)
{
va_list argp;
@@ -141,16 +143,18 @@ _nc_syserr_abort(const char *const fmt,...)
fprintf(stderr, "\n");
va_end(argp);
+#if defined(TRACE) || !defined(NDEBUG)
/* If we're debugging, try to show where the problem occurred - this
* will dump core.
*/
-#if defined(TRACE) || !defined(NDEBUG)
- abort();
-#else
+#ifndef USE_ROOT_ENVIRON
+ if (getuid() != ROOT_UID)
+#endif
+ abort();
+#endif
/* Dumping core in production code is not a good idea.
*/
exit(EXIT_FAILURE);
-#endif
}
#if NO_LEAKS
diff --git a/ncurses/tinfo/comp_expand.c b/ncurses/tinfo/comp_expand.c
index 2ab06ebabc89..07715579ee8e 100644
--- a/ncurses/tinfo/comp_expand.c
+++ b/ncurses/tinfo/comp_expand.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey <dickey@clark.net> 1998 *
+ * Author: Thomas E. Dickey 1998 *
****************************************************************************/
#include <curses.priv.h>
@@ -35,7 +35,13 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: comp_expand.c,v 1.25 2012/03/24 18:37:17 tom Exp $")
+MODULE_ID("$Id: comp_expand.c,v 1.31 2017/04/20 08:55:08 tom Exp $")
+
+#if 0
+#define DEBUG_THIS(p) DEBUG(9, p)
+#else
+#define DEBUG_THIS(p) /* nothing */
+#endif
static int
trailing_spaces(const char *src)
@@ -46,10 +52,9 @@ trailing_spaces(const char *src)
}
/* this deals with differences over whether 0x7f and 0x80..0x9f are controls */
-#define REALCTL(s) (UChar(*(s)) < 127 && iscntrl(UChar(*(s))))
#define REALPRINT(s) (UChar(*(s)) < 127 && isprint(UChar(*(s))))
-#define P_LIMIT(p) (length - (size_t)(p))
+#define P_LIMIT(p) (length - (size_t)(p))
NCURSES_EXPORT(char *)
_nc_tic_expand(const char *srcp, bool tic_format, int numbers)
@@ -59,9 +64,13 @@ _nc_tic_expand(const char *srcp, bool tic_format, int numbers)
int bufp;
const char *str = VALID_STRING(srcp) ? srcp : "\0\0";
- bool islong = (strlen(str) > 3);
size_t need = (2 + strlen(str)) * 4;
int ch;
+ int octals = 0;
+ struct {
+ int ch;
+ int offset;
+ } fixups[MAX_TC_FIXUPS];
if (srcp == 0) {
#if NO_LEAKS
@@ -77,6 +86,7 @@ _nc_tic_expand(const char *srcp, bool tic_format, int numbers)
return 0;
}
+ DEBUG_THIS(("_nc_tic_expand %s", _nc_visbuf(srcp)));
bufp = 0;
while ((ch = UChar(*str)) != 0) {
if (ch == '%' && REALPRINT(str + 1)) {
@@ -133,6 +143,8 @@ _nc_tic_expand(const char *srcp, bool tic_format, int numbers)
}
break;
default:
+ if (*str == ',') /* minitel1 uses this */
+ buffer[bufp++] = '\\';
buffer[bufp++] = *str;
break;
}
@@ -158,34 +170,28 @@ _nc_tic_expand(const char *srcp, bool tic_format, int numbers)
&& !(ch == '!' && !tic_format)
&& ch != '^'))
buffer[bufp++] = (char) ch;
-#if 0 /* FIXME: this would be more readable (in fact the whole 'islong' logic should be removed) */
- else if (ch == '\b') {
- buffer[bufp++] = '\\';
- buffer[bufp++] = 'b';
- } else if (ch == '\f') {
- buffer[bufp++] = '\\';
- buffer[bufp++] = 'f';
- } else if (ch == '\t' && islong) {
- buffer[bufp++] = '\\';
- buffer[bufp++] = 't';
- }
-#endif
- else if (ch == '\r' && (islong || (strlen(srcp) > 2 && str[1] == '\0'))) {
+ else if (ch == '\r') {
buffer[bufp++] = '\\';
buffer[bufp++] = 'r';
- } else if (ch == '\n' && islong) {
+ } else if (ch == '\n') {
buffer[bufp++] = '\\';
buffer[bufp++] = 'n';
}
#define UnCtl(c) ((c) + '@')
- else if (REALCTL(str) && ch != '\\'
- && (!islong || isdigit(UChar(str[1])))) {
+ else if (UChar(ch) < 32
+ && isdigit(UChar(str[1]))) {
_nc_SPRINTF(&buffer[bufp], _nc_SLIMIT(P_LIMIT(bufp))
"^%c", UnCtl(ch));
bufp += 2;
} else {
_nc_SPRINTF(&buffer[bufp], _nc_SLIMIT(P_LIMIT(bufp))
"\\%03o", ch);
+ if ((octals < MAX_TC_FIXUPS) &&
+ ((tic_format && (ch == 127)) || ch < 32)) {
+ fixups[octals].ch = UChar(ch);
+ fixups[octals].offset = bufp;
+ ++octals;
+ }
bufp += 4;
}
@@ -193,5 +199,26 @@ _nc_tic_expand(const char *srcp, bool tic_format, int numbers)
}
buffer[bufp] = '\0';
+
+ /*
+ * If most of a short string is ASCII control characters, reformat the
+ * string to show those in up-arrow format. For longer strings, it's
+ * more likely that the characters are just binary coding.
+ *
+ * If we're formatting termcap, just use the shorter format (up-arrows).
+ */
+ if (octals != 0 && (!tic_format || (bufp - (4 * octals)) < MIN_TC_FIXUPS)) {
+ while (--octals >= 0) {
+ char *p = buffer + fixups[octals].offset;
+ *p++ = '^';
+ *p++ = (char) ((fixups[octals].ch == 127)
+ ? '?'
+ : (fixups[octals].ch + (int) '@'));
+ while ((p[0] = p[2]) != 0) {
+ ++p;
+ }
+ }
+ }
+ DEBUG_THIS(("... %s", _nc_visbuf(buffer)));
return (buffer);
}
diff --git a/ncurses/tinfo/comp_hash.c b/ncurses/tinfo/comp_hash.c
index 959c6e156431..a62d38f9dc8d 100644
--- a/ncurses/tinfo/comp_hash.c
+++ b/ncurses/tinfo/comp_hash.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2019 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 *
@@ -44,7 +44,7 @@
#include <tic.h>
#include <hashsize.h>
-MODULE_ID("$Id: comp_hash.c,v 1.48 2009/08/08 17:36:21 tom Exp $")
+MODULE_ID("$Id: comp_hash.c,v 1.51 2019/10/12 16:32:13 tom Exp $")
/*
* Finds the entry for the given string in the hash table if present.
@@ -63,7 +63,9 @@ _nc_find_entry(const char *string,
hashvalue = data->hash_of(string);
- if (data->table_data[hashvalue] >= 0) {
+ if (hashvalue >= 0
+ && (unsigned) hashvalue < data->table_size
+ && data->table_data[hashvalue] >= 0) {
real_table = _nc_get_table(termcap);
ptr = real_table + data->table_data[hashvalue];
@@ -96,7 +98,9 @@ _nc_find_type_entry(const char *string,
const HashData *data = _nc_get_hash_info(termcap);
int hashvalue = data->hash_of(string);
- if (data->table_data[hashvalue] >= 0) {
+ if (hashvalue >= 0
+ && (unsigned) hashvalue < data->table_size
+ && data->table_data[hashvalue] >= 0) {
const struct name_table_entry *const table = _nc_get_table(termcap);
ptr = table + data->table_data[hashvalue];
@@ -112,3 +116,34 @@ _nc_find_type_entry(const char *string,
return ptr;
}
+
+#if NCURSES_XNAMES
+NCURSES_EXPORT(struct user_table_entry const *)
+_nc_find_user_entry(const char *string)
+{
+ const HashData *data = _nc_get_hash_user();
+ int hashvalue;
+ struct user_table_entry const *ptr = 0;
+ struct user_table_entry const *real_table;
+
+ hashvalue = data->hash_of(string);
+
+ if (hashvalue >= 0
+ && (unsigned) hashvalue < data->table_size
+ && data->table_data[hashvalue] >= 0) {
+
+ real_table = _nc_get_userdefs_table();
+ ptr = real_table + data->table_data[hashvalue];
+ while (!data->compare_names(ptr->ute_name, string)) {
+ if (ptr->ute_link < 0) {
+ ptr = 0;
+ break;
+ }
+ ptr = real_table + (ptr->ute_link
+ + data->table_data[data->table_size]);
+ }
+ }
+
+ return (ptr);
+}
+#endif /* NCURSES_XNAMES */
diff --git a/ncurses/tinfo/comp_parse.c b/ncurses/tinfo/comp_parse.c
index 82a61a52e35d..82c3fa2c950a 100644
--- a/ncurses/tinfo/comp_parse.c
+++ b/ncurses/tinfo/comp_parse.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 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 *
@@ -47,16 +47,12 @@
#include <tic.h>
-MODULE_ID("$Id: comp_parse.c,v 1.90 2013/08/31 15:22:31 tom Exp $")
+MODULE_ID("$Id: comp_parse.c,v 1.108 2019/12/14 22:34:35 tom Exp $")
-static void sanity_check2(TERMTYPE *, bool);
-NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE *, bool) = sanity_check2;
+static void sanity_check2(TERMTYPE2 *, bool);
+NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2;
-/* obsolete: 20040705 */
-static void sanity_check(TERMTYPE *);
-NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype) (TERMTYPE *) = sanity_check;
-
-static void fixup_acsc(TERMTYPE *, int);
+static void fixup_acsc(TERMTYPE2 *, int);
static void
enqueue(ENTRY * ep)
@@ -75,6 +71,8 @@ enqueue(ENTRY * ep)
newp->last->next = newp;
}
+#define NAMEBUFFER_SIZE (MAX_NAME_SIZE + 2)
+
static char *
force_bar(char *dst, char *src)
{
@@ -82,8 +80,8 @@ force_bar(char *dst, char *src)
size_t len = strlen(src);
if (len > MAX_NAME_SIZE)
len = MAX_NAME_SIZE;
- (void) strncpy(dst, src, len);
- _nc_STRCPY(dst + len, "|", MAX_NAME_SIZE);
+ _nc_STRNCPY(dst, src, MAX_NAME_SIZE);
+ _nc_STRCPY(dst + len, "|", NAMEBUFFER_SIZE - len);
src = dst;
}
return src;
@@ -107,8 +105,8 @@ static bool
check_collisions(char *n1, char *n2, int counter)
{
char *pstart, *qstart, *pend, *qend;
- char nc1[MAX_NAME_SIZE + 2];
- char nc2[MAX_NAME_SIZE + 2];
+ char nc1[NAMEBUFFER_SIZE];
+ char nc2[NAMEBUFFER_SIZE];
n1 = ForceBar(nc1, n1);
n2 = ForceBar(nc2, n2);
@@ -182,11 +180,11 @@ remove_collision(char *n1, char *n2)
++qend;
while ((*qstart++ = *qend++) != '\0') ;
fprintf(stderr, "...now\t%s\n", p2);
+ removed = TRUE;
} else {
fprintf(stderr, "Cannot remove alias '%.*s'\n",
(int) (qend - qstart), qstart);
}
- removed = TRUE;
break;
}
}
@@ -267,6 +265,126 @@ _nc_read_entry_source(FILE *fp, char *buf,
_nc_suppress_warnings = oldsuppress;
}
+#if NCURSES_XNAMES
+static unsigned
+find_capname(TERMTYPE2 *p, const char *name)
+{
+ unsigned num_names = NUM_EXT_NAMES(p);
+ unsigned n;
+ if (name != 0) {
+ for (n = 0; n < num_names; ++n) {
+ if (!strcmp(p->ext_Names[n], name))
+ break;
+ }
+ } else {
+ n = num_names + 1;
+ }
+ return n;
+}
+
+static int
+extended_captype(TERMTYPE2 *p, unsigned which)
+{
+ int result = UNDEF;
+ unsigned limit = 0;
+ limit += p->ext_Booleans;
+ if (limit != 0 && which < limit) {
+ result = BOOLEAN;
+ } else {
+ limit += p->ext_Numbers;
+ if (limit != 0 && which < limit) {
+ result = NUMBER;
+ } else {
+ limit += p->ext_Strings;
+ if (limit != 0 && which < limit) {
+ result = STRING;
+ } else if (which >= limit) {
+ result = CANCEL;
+ }
+ }
+ }
+ return result;
+}
+
+static const char *
+name_of_captype(int which)
+{
+ const char *result = "?";
+ switch (which) {
+ case BOOLEAN:
+ result = "boolean";
+ break;
+ case NUMBER:
+ result = "number";
+ break;
+ case STRING:
+ result = "string";
+ break;
+ }
+ return result;
+}
+
+#define valid_TERMTYPE2(p) \
+ ((p) != 0 && \
+ (p)->term_names != 0 && \
+ (p)->ext_Names != 0)
+
+/*
+ * Disallow changing the type of an extended capability when doing a "use"
+ * if one or the other is a string.
+ */
+static int
+invalid_merge(TERMTYPE2 *to, TERMTYPE2 *from)
+{
+ int rc = FALSE;
+ if (valid_TERMTYPE2(to)
+ && valid_TERMTYPE2(from)) {
+ char *to_name = _nc_first_name(to->term_names);
+ char *from_name = strdup(_nc_first_name(from->term_names));
+ unsigned num_names = NUM_EXT_NAMES(from);
+ unsigned n;
+
+ for (n = 0; n < num_names; ++n) {
+ const char *capname = from->ext_Names[n];
+ int tt = extended_captype(to, find_capname(to, capname));
+ int tf = extended_captype(from, n);
+
+ if (tt <= STRING
+ && tf <= STRING
+ && (tt == STRING) != (tf == STRING)) {
+ if (from_name != 0 && strcmp(to_name, from_name)) {
+ DEBUG(2,
+ ("merge of %s to %s changes type of %s from %s to %s",
+ from_name,
+ to_name,
+ from->ext_Names[n],
+ name_of_captype(tf),
+ name_of_captype(tt)));
+ } else {
+ DEBUG(2, ("merge of %s changes type of %s from %s to %s",
+ to_name,
+ from->ext_Names[n],
+ name_of_captype(tf),
+ name_of_captype(tt)));
+ }
+ _nc_warning("merge changes type of %s from %s to %s",
+ from->ext_Names[n],
+ name_of_captype(tf),
+ name_of_captype(tt));
+ rc = TRUE;
+ }
+ }
+ free(from_name);
+ }
+ return rc;
+}
+#define validate_merge(p, q) \
+ if (invalid_merge(&((p)->tterm), &((q)->tterm))) \
+ return FALSE
+#else
+#define validate_merge(p, q) /* nothing */
+#endif
+
NCURSES_EXPORT(int)
_nc_resolve_uses2(bool fullresolve, bool literal)
/* try to resolve all use capabilities */
@@ -319,6 +437,9 @@ _nc_resolve_uses2(bool fullresolve, bool literal)
char *lookfor = qp->uses[i].name;
long lookline = qp->uses[i].line;
+ if (lookfor == 0)
+ continue;
+
foundit = FALSE;
_nc_set_type(child);
@@ -337,11 +458,11 @@ _nc_resolve_uses2(bool fullresolve, bool literal)
/* if that didn't work, try to merge in a compiled entry */
if (!foundit) {
- TERMTYPE thisterm;
+ TERMTYPE2 thisterm;
char filename[PATH_MAX];
memset(&thisterm, 0, sizeof(thisterm));
- if (_nc_read_entry(lookfor, filename, &thisterm) == 1) {
+ if (_nc_read_entry2(lookfor, filename, &thisterm) == 1) {
DEBUG(2, ("%s: resolving use=%s (compiled)",
child, lookfor));
@@ -382,7 +503,7 @@ _nc_resolve_uses2(bool fullresolve, bool literal)
*/
if (fullresolve) {
do {
- TERMTYPE merged;
+ ENTRY merged;
keepgoing = FALSE;
@@ -396,7 +517,8 @@ _nc_resolve_uses2(bool fullresolve, bool literal)
* subsequent pass.
*/
for (i = 0; i < qp->nuses; i++)
- if (qp->uses[i].link->nuses) {
+ if (qp->uses[i].link
+ && qp->uses[i].link->nuses) {
DEBUG(2, ("%s: use entry %d unresolved",
_nc_first_name(qp->tterm.term_names), i));
goto incomplete;
@@ -408,20 +530,24 @@ _nc_resolve_uses2(bool fullresolve, bool literal)
* the merged entry the name field and string
* table pointer.
*/
- _nc_copy_termtype(&merged, &(qp->tterm));
+ _nc_copy_termtype2(&(merged.tterm), &(qp->tterm));
/*
* Now merge in each use entry in the proper
* (reverse) order.
*/
- for (; qp->nuses; qp->nuses--)
+ for (; qp->nuses; qp->nuses--) {
+ validate_merge(&merged,
+ qp->uses[qp->nuses - 1].link);
_nc_merge_entry(&merged,
- &qp->uses[qp->nuses - 1].link->tterm);
+ qp->uses[qp->nuses - 1].link);
+ }
/*
* Now merge in the original entry.
*/
- _nc_merge_entry(&merged, &qp->tterm);
+ validate_merge(&merged, qp);
+ _nc_merge_entry(&merged, qp);
/*
* Replace the original entry with the merged one.
@@ -432,7 +558,7 @@ _nc_resolve_uses2(bool fullresolve, bool literal)
#if NCURSES_XNAMES
FreeIfNeeded(qp->tterm.ext_Names);
#endif
- qp->tterm = merged;
+ qp->tterm = merged.tterm;
_nc_wrap_entry(qp, TRUE);
/*
@@ -459,54 +585,46 @@ _nc_resolve_uses2(bool fullresolve, bool literal)
DEBUG(2, ("RESOLUTION FINISHED"));
- if (fullresolve)
- if (_nc_check_termtype != 0) {
- _nc_curr_col = -1;
- for_entry_list(qp) {
- _nc_curr_line = (int) qp->startline;
- _nc_set_type(_nc_first_name(qp->tterm.term_names));
+ if (fullresolve) {
+ _nc_curr_col = -1;
+ for_entry_list(qp) {
+ _nc_curr_line = (int) qp->startline;
+ _nc_set_type(_nc_first_name(qp->tterm.term_names));
+ /*
+ * tic overrides this function pointer to provide more verbose
+ * checking.
+ */
+ if (_nc_check_termtype2 != sanity_check2) {
+ SCREEN *save_SP = SP;
+ SCREEN fake_sp;
+ TERMINAL fake_tm;
+ TERMINAL *save_tm = cur_term;
+
/*
- * tic overrides this function pointer to provide more verbose
- * checking.
+ * Setup so that tic can use ordinary terminfo interface to
+ * obtain capability information.
*/
- if (_nc_check_termtype2 != sanity_check2) {
- SCREEN *save_SP = SP;
- SCREEN fake_sp;
- TERMINAL fake_tm;
- TERMINAL *save_tm = cur_term;
-
- /*
- * Setup so that tic can use ordinary terminfo interface
- * to obtain capability information.
- */
- memset(&fake_sp, 0, sizeof(fake_sp));
- memset(&fake_tm, 0, sizeof(fake_tm));
- fake_sp._term = &fake_tm;
- fake_tm.type = qp->tterm;
- _nc_set_screen(&fake_sp);
- set_curterm(&fake_tm);
-
- _nc_check_termtype2(&qp->tterm, literal);
-
- _nc_set_screen(save_SP);
- set_curterm(save_tm);
- } else {
- fixup_acsc(&qp->tterm, literal);
- }
+ memset(&fake_sp, 0, sizeof(fake_sp));
+ memset(&fake_tm, 0, sizeof(fake_tm));
+ fake_sp._term = &fake_tm;
+ TerminalType(&fake_tm) = qp->tterm;
+ _nc_set_screen(&fake_sp);
+ set_curterm(&fake_tm);
+
+ _nc_check_termtype2(&qp->tterm, literal);
+
+ _nc_set_screen(save_SP);
+ set_curterm(save_tm);
+ } else {
+ fixup_acsc(&qp->tterm, literal);
}
- DEBUG(2, ("SANITY CHECK FINISHED"));
}
+ DEBUG(2, ("SANITY CHECK FINISHED"));
+ }
return (TRUE);
}
-/* obsolete: 20040705 */
-NCURSES_EXPORT(int)
-_nc_resolve_uses(bool fullresolve)
-{
- return _nc_resolve_uses2(fullresolve, FALSE);
-}
-
/*
* This bit of legerdemain turns all the terminfo variable names into
* references to locations in the arrays Booleans, Numbers, and Strings ---
@@ -517,18 +635,18 @@ _nc_resolve_uses(bool fullresolve)
#define CUR tp->
static void
-fixup_acsc(TERMTYPE *tp, int literal)
+fixup_acsc(TERMTYPE2 *tp, int literal)
{
if (!literal) {
- if (acs_chars == 0
- && enter_alt_charset_mode != 0
- && exit_alt_charset_mode != 0)
+ if (acs_chars == ABSENT_STRING
+ && PRESENT(enter_alt_charset_mode)
+ && PRESENT(exit_alt_charset_mode))
acs_chars = strdup(VT_ACSC);
}
}
static void
-sanity_check2(TERMTYPE *tp, bool literal)
+sanity_check2(TERMTYPE2 *tp, bool literal)
{
if (!PRESENT(exit_attribute_mode)) {
#ifdef __UNUSED__ /* this casts too wide a net */
@@ -547,7 +665,9 @@ sanity_check2(TERMTYPE *tp, bool literal)
#endif /* __UNUSED__ */
PAIRED(enter_standout_mode, exit_standout_mode);
PAIRED(enter_underline_mode, exit_underline_mode);
+#if defined(enter_italics_mode) && defined(exit_italics_mode)
PAIRED(enter_italics_mode, exit_italics_mode);
+#endif
}
/* we do this check/fix in postprocess_termcap(), but some packagers
@@ -578,23 +698,18 @@ sanity_check2(TERMTYPE *tp, bool literal)
PAIRED(enter_xon_mode, exit_xon_mode);
PAIRED(enter_am_mode, exit_am_mode);
ANDMISSING(label_off, label_on);
-#ifdef remove_clock
+#if defined(display_clock) && defined(remove_clock)
PAIRED(display_clock, remove_clock);
#endif
ANDMISSING(set_color_pair, initialize_pair);
}
-/* obsolete: 20040705 */
-static void
-sanity_check(TERMTYPE *tp)
-{
- sanity_check2(tp, FALSE);
-}
-
#if NO_LEAKS
NCURSES_EXPORT(void)
_nc_leaks_tic(void)
{
+ T((T_CALLED("_nc_free_tic()")));
+ _nc_globals.leak_checking = TRUE;
_nc_alloc_entry_leaks();
_nc_captoinfo_leaks();
_nc_comp_scan_leaks();
@@ -609,6 +724,6 @@ NCURSES_EXPORT(void)
_nc_free_tic(int code)
{
_nc_leaks_tic();
- _nc_free_tinfo(code);
+ exit_terminfo(code);
}
#endif
diff --git a/ncurses/tinfo/comp_scan.c b/ncurses/tinfo/comp_scan.c
index fe6e8e7631ce..b2072577a499 100644
--- a/ncurses/tinfo/comp_scan.c
+++ b/ncurses/tinfo/comp_scan.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-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 *
@@ -50,7 +50,7 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: comp_scan.c,v 1.102 2013/11/16 19:57:50 tom Exp $")
+MODULE_ID("$Id: comp_scan.c,v 1.108 2017/08/25 22:57:21 tom Exp $")
/*
* Maximum length of string capability we'll accept before raising an error.
@@ -168,6 +168,8 @@ next_char(void)
if (result != 0) {
FreeAndNull(result);
FreeAndNull(pushname);
+ bufptr = 0;
+ bufstart = 0;
allocated = 0;
}
/*
@@ -189,12 +191,11 @@ next_char(void)
* quite hard to get completely right. Try it and see. If you
* succeed, don't forget to hack push_back() correspondingly.
*/
- size_t used;
size_t len;
do {
+ size_t used = 0;
bufstart = 0;
- used = 0;
do {
if (used + (LEXBUFSIZ / 4) >= allocated) {
allocated += (allocated + LEXBUFSIZ);
@@ -223,6 +224,8 @@ next_char(void)
}
if ((bufptr = bufstart) != 0) {
used = strlen(bufptr);
+ if (used == 0)
+ return (EOF);
while (iswhite(*bufptr)) {
if (*bufptr == '\t') {
_nc_curr_col = (_nc_curr_col | 7) + 1;
@@ -669,7 +672,15 @@ _nc_get_token(bool silent)
if (numchk == numbuf)
_nc_warning("no value given for `%s'", tok_buf);
if ((*numchk != '\0') || (ch != separator))
- _nc_warning("Missing separator");
+ _nc_warning("Missing separator for `%s'", tok_buf);
+ if (number < 0)
+ _nc_warning("value of `%s' cannot be negative", tok_buf);
+ if (number > MAX_OF_TYPE(NCURSES_INT2)) {
+ _nc_warning("limiting value of `%s' from %#lx to %#x",
+ tok_buf,
+ number, MAX_OF_TYPE(NCURSES_INT2));
+ number = MAX_OF_TYPE(NCURSES_INT2);
+ }
}
_nc_curr_token.tk_name = tok_buf;
_nc_curr_token.tk_valnumber = (int) number;
@@ -810,8 +821,6 @@ _nc_trans_string(char *ptr, char *last)
}
if (c == '?' && (_nc_syntax != SYN_TERMCAP)) {
*(ptr++) = '\177';
- if (_nc_tracing)
- _nc_warning("Allow ^? as synonym for \\177");
} else {
if ((c &= 037) == 0)
c = 128;
@@ -824,8 +833,6 @@ _nc_trans_string(char *ptr, char *last)
if (c == EOF)
_nc_err_abort(MSG_NO_INPUTS);
-#define isoctal(c) ((c) >= '0' && (c) <= '7')
-
if (isoctal(c) || (strict_bsd && isdigit(c))) {
number = c - '0';
for (i = 0; i < 2; i++) {
@@ -990,10 +997,8 @@ _nc_push_token(int tokclass)
NCURSES_EXPORT(void)
_nc_panic_mode(char ch)
{
- int c;
-
for (;;) {
- c = next_char();
+ int c = next_char();
if (c == ch)
return;
if (c == EOF)
diff --git a/ncurses/tinfo/db_iterator.c b/ncurses/tinfo/db_iterator.c
index a14fb2161e01..a9d4e7bbfed0 100644
--- a/ncurses/tinfo/db_iterator.c
+++ b/ncurses/tinfo/db_iterator.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2006-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 2006-2017,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -43,7 +43,7 @@
#include <hashed_db.h>
#endif
-MODULE_ID("$Id: db_iterator.c,v 1.38 2013/12/14 21:23:20 tom Exp $")
+MODULE_ID("$Id: db_iterator.c,v 1.47 2018/11/24 22:42:01 tom Exp $")
#define HaveTicDirectory _nc_globals.have_tic_directory
#define KeepTicDirectory _nc_globals.keep_tic_directory
@@ -72,15 +72,18 @@ check_existence(const char *name, struct stat *sb)
{
bool result = FALSE;
- if (stat(name, sb) == 0
- && (S_ISDIR(sb->st_mode) || S_ISREG(sb->st_mode))) {
+ if (quick_prefix(name)) {
+ result = TRUE;
+ } else if (stat(name, sb) == 0
+ && (S_ISDIR(sb->st_mode)
+ || (S_ISREG(sb->st_mode) && sb->st_size))) {
result = TRUE;
}
#if USE_HASHED_DB
else if (strlen(name) < PATH_MAX - sizeof(DBM_SUFFIX)) {
char temp[PATH_MAX];
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "%s%s", name, DBM_SUFFIX);
- if (stat(temp, sb) == 0 && S_ISREG(sb->st_mode)) {
+ if (stat(temp, sb) == 0 && S_ISREG(sb->st_mode) && sb->st_size) {
result = TRUE;
}
}
@@ -89,6 +92,27 @@ check_existence(const char *name, struct stat *sb)
}
/*
+ * Trim newlines (and backslashes preceding those) and tab characters to
+ * help simplify scripting of the quick-dump feature. Leave spaces and
+ * other backslashes alone.
+ */
+static void
+trim_formatting(char *source)
+{
+ char *target = source;
+ char ch;
+
+ while ((ch = *source++) != '\0') {
+ if (ch == '\\' && *source == '\n')
+ continue;
+ if (ch == '\n' || ch == '\t')
+ continue;
+ *target++ = ch;
+ }
+ *target = '\0';
+}
+
+/*
* Store the latest value of an environment variable in my_vars[] so we can
* detect if one changes, invalidating the cached search-list.
*/
@@ -99,19 +123,21 @@ update_getenv(const char *name, DBDIRS which)
if (which < dbdLAST) {
char *value;
+ char *cached_value = my_vars[which].value;
+ bool same_value;
- if ((value = getenv(name)) == 0 || (value = strdup(value)) == 0) {
- ;
- } else if (my_vars[which].name == 0 || strcmp(my_vars[which].name, name)) {
- FreeIfNeeded(my_vars[which].value);
- my_vars[which].name = name;
- my_vars[which].value = value;
- result = TRUE;
- } else if ((my_vars[which].value != 0) ^ (value != 0)) {
- FreeIfNeeded(my_vars[which].value);
- my_vars[which].value = value;
- result = TRUE;
- } else if (value != 0 && strcmp(value, my_vars[which].value)) {
+ if ((value = getenv(name)) != 0) {
+ value = strdup(value);
+ }
+ same_value = ((value == 0 && cached_value == 0) ||
+ (value != 0 &&
+ cached_value != 0 &&
+ strcmp(value, cached_value) == 0));
+
+ /* Set variable name to enable checks in cache_expired(). */
+ my_vars[which].name = name;
+
+ if (!same_value) {
FreeIfNeeded(my_vars[which].value);
my_vars[which].value = value;
result = TRUE;
@@ -122,6 +148,7 @@ update_getenv(const char *name, DBDIRS which)
return result;
}
+#if NCURSES_USE_DATABASE || NCURSES_USE_TERMCAP
static char *
cache_getenv(const char *name, DBDIRS which)
{
@@ -133,6 +160,7 @@ cache_getenv(const char *name, DBDIRS which)
}
return result;
}
+#endif
/*
* The cache expires if at least a second has passed since the initial lookup,
@@ -187,7 +215,7 @@ _nc_tic_dir(const char *path)
HaveTicDirectory = TRUE;
} else if (HaveTicDirectory == 0) {
if (use_terminfo_vars()) {
- char *envp;
+ const char *envp;
if ((envp = getenv("TERMINFO")) != 0)
return _nc_tic_dir(envp);
}
@@ -251,7 +279,7 @@ _nc_first_db(DBDIRS * state, int *offset)
*state = dbdTIC;
*offset = 0;
- T(("_nc_first_db"));
+ T((T_CALLED("_nc_first_db")));
/* build a blob containing all of the strings we will use for a lookup
* table.
@@ -260,7 +288,7 @@ _nc_first_db(DBDIRS * state, int *offset)
size_t blobsize = 0;
const char *values[dbdLAST];
struct stat *my_stat;
- int j, k;
+ int j;
if (cache_has_expired)
free_cache();
@@ -330,10 +358,12 @@ _nc_first_db(DBDIRS * state, int *offset)
my_list = typeCalloc(char *, blobsize);
my_stat = typeCalloc(struct stat, blobsize);
if (my_list != 0 && my_stat != 0) {
- k = 0;
+ int k = 0;
my_list[k++] = my_blob;
for (j = 0; my_blob[j] != '\0'; ++j) {
- if (my_blob[j] == NCURSES_PATHSEP) {
+ if (my_blob[j] == NCURSES_PATHSEP
+ && ((&my_blob[j] - my_list[k - 1]) != 3
+ || !quick_prefix(my_list[k - 1]))) {
my_blob[j] = '\0';
my_list[k++] = &my_blob[j + 1];
}
@@ -347,8 +377,10 @@ _nc_first_db(DBDIRS * state, int *offset)
if (*my_list[j] == '\0')
my_list[j] = strdup(TERMINFO);
#endif
+ trim_formatting(my_list[j]);
for (k = 0; k < j; ++k) {
if (!strcmp(my_list[j], my_list[k])) {
+ T(("duplicate %s", my_list[j]));
k = j - 1;
while ((my_list[j] = my_list[j + 1]) != 0) {
++j;
@@ -377,6 +409,7 @@ _nc_first_db(DBDIRS * state, int *offset)
}
#endif
if (!found) {
+ T(("not found %s", my_list[j]));
k = j;
while ((my_list[k] = my_list[k + 1]) != 0) {
++k;
@@ -392,6 +425,7 @@ _nc_first_db(DBDIRS * state, int *offset)
free(my_stat);
}
}
+ returnVoid;
}
#if NO_LEAKS
diff --git a/ncurses/tinfo/entries.c b/ncurses/tinfo/entries.c
index e84033d47f1d..794c519b8884 100644
--- a/ncurses/tinfo/entries.c
+++ b/ncurses/tinfo/entries.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2006-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 2006-2017,2019 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 *
@@ -37,7 +37,7 @@
#include <tic.h>
-MODULE_ID("$Id: entries.c,v 1.21 2012/05/05 20:33:44 tom Exp $")
+MODULE_ID("$Id: entries.c,v 1.29 2019/12/15 00:18:03 tom Exp $")
/****************************************************************************
*
@@ -63,30 +63,8 @@ MODULE_ID("$Id: entries.c,v 1.21 2012/05/05 20:33:44 tom Exp $")
NCURSES_EXPORT_VAR(ENTRY *) _nc_head = 0;
NCURSES_EXPORT_VAR(ENTRY *) _nc_tail = 0;
-NCURSES_EXPORT(void)
-_nc_free_entry(ENTRY * headp, TERMTYPE *tterm)
-/* free the allocated storage consumed by the given list entry */
-{
- ENTRY *ep;
-
- if ((ep = _nc_delink_entry(headp, tterm)) != 0) {
- free(ep);
- }
-}
-
-NCURSES_EXPORT(void)
-_nc_free_entries(ENTRY * headp)
-/* free the allocated storage consumed by list entries */
-{
- (void) headp; /* unused - _nc_head is altered here! */
-
- while (_nc_head != 0) {
- _nc_free_termtype(&(_nc_head->tterm));
- }
-}
-
-NCURSES_EXPORT(ENTRY *)
-_nc_delink_entry(ENTRY * headp, TERMTYPE *tterm)
+static ENTRY *
+_nc_delink_entry(ENTRY * headp, TERMTYPE2 *tterm)
/* delink the allocated storage for the given list entry */
{
ENTRY *ep, *last;
@@ -112,6 +90,28 @@ _nc_delink_entry(ENTRY * headp, TERMTYPE *tterm)
}
NCURSES_EXPORT(void)
+_nc_free_entry(ENTRY * headp, TERMTYPE2 *tterm)
+/* free the allocated storage consumed by the given list entry */
+{
+ ENTRY *ep;
+
+ if ((ep = _nc_delink_entry(headp, tterm)) != 0) {
+ free(ep);
+ }
+}
+
+NCURSES_EXPORT(void)
+_nc_free_entries(ENTRY * headp)
+/* free the allocated storage consumed by list entries */
+{
+ (void) headp; /* unused - _nc_head is altered here! */
+
+ while (_nc_head != 0) {
+ _nc_free_termtype2(&(_nc_head->tterm));
+ }
+}
+
+NCURSES_EXPORT(void)
_nc_leaks_tinfo(void)
{
#if NO_LEAKS
@@ -120,14 +120,17 @@ _nc_leaks_tinfo(void)
T((T_CALLED("_nc_free_tinfo()")));
#if NO_LEAKS
+ _nc_globals.leak_checking = TRUE;
_nc_free_tparm();
_nc_tgetent_leaks();
if (TerminalOf(CURRENT_SCREEN) != 0) {
del_curterm(TerminalOf(CURRENT_SCREEN));
}
+ _nc_forget_prescr();
_nc_comp_captab_leaks();
+ _nc_comp_userdefs_leaks();
_nc_free_entries(_nc_head);
_nc_get_type(0);
_nc_first_name(0);
@@ -144,7 +147,8 @@ _nc_leaks_tinfo(void)
free(s);
#ifdef TRACE
- trace(0);
+ T((T_RETURN("")));
+ curses_trace(0);
_nc_trace_buf(-1, (size_t) 0);
#endif
@@ -160,3 +164,12 @@ _nc_free_tinfo(int code)
exit(code);
}
#endif
+
+NCURSES_EXPORT(void)
+exit_terminfo(int code)
+{
+#if NO_LEAKS
+ _nc_leaks_tinfo();
+#endif
+ exit(code);
+}
diff --git a/ncurses/tinfo/free_ttype.c b/ncurses/tinfo/free_ttype.c
index ad056ba4545b..351cda933c75 100644
--- a/ncurses/tinfo/free_ttype.c
+++ b/ncurses/tinfo/free_ttype.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999-2010,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2011,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 *
@@ -42,25 +42,46 @@
#include <tic.h>
-MODULE_ID("$Id: free_ttype.c,v 1.15 2011/02/06 01:08:31 tom Exp $")
+MODULE_ID("$Id: free_ttype.c,v 1.17 2017/04/13 01:06:04 tom Exp $")
-NCURSES_EXPORT(void)
-_nc_free_termtype(TERMTYPE *ptr)
+static void
+really_free_termtype(TERMTYPE2 *ptr, bool freeStrings)
{
T(("_nc_free_termtype(%s)", ptr->term_names));
- FreeIfNeeded(ptr->str_table);
+ if (freeStrings) {
+ FreeIfNeeded(ptr->str_table);
+ }
FreeIfNeeded(ptr->Booleans);
FreeIfNeeded(ptr->Numbers);
FreeIfNeeded(ptr->Strings);
#if NCURSES_XNAMES
- FreeIfNeeded(ptr->ext_str_table);
+ if (freeStrings) {
+ FreeIfNeeded(ptr->ext_str_table);
+ }
FreeIfNeeded(ptr->ext_Names);
#endif
memset(ptr, 0, sizeof(TERMTYPE));
_nc_free_entry(_nc_head, ptr);
}
+/*
+ * This entrypoint is used by tack.
+ */
+NCURSES_EXPORT(void)
+_nc_free_termtype(TERMTYPE *ptr)
+{
+ really_free_termtype((TERMTYPE2 *) ptr, !NCURSES_EXT_NUMBERS);
+}
+
+#if NCURSES_EXT_NUMBERS
+NCURSES_EXPORT(void)
+_nc_free_termtype2(TERMTYPE2 *ptr)
+{
+ really_free_termtype(ptr, TRUE);
+}
+#endif
+
#if NCURSES_XNAMES
NCURSES_EXPORT_VAR(bool) _nc_user_definable = TRUE;
diff --git a/ncurses/tinfo/getenv_num.c b/ncurses/tinfo/getenv_num.c
index d5e35cb46638..d3d257221cd7 100644
--- a/ncurses/tinfo/getenv_num.c
+++ b/ncurses/tinfo/getenv_num.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -36,7 +36,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: getenv_num.c,v 1.6 2013/09/28 20:25:08 tom Exp $")
+MODULE_ID("$Id: getenv_num.c,v 1.7 2018/06/30 19:54:49 tom Exp $")
NCURSES_EXPORT(int)
_nc_getenv_num(const char *name)
@@ -68,6 +68,8 @@ _nc_setenv_num(const char *name, int value)
_nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) "%s=%d", name, value);
if ((s = strdup(buffer)) != 0)
putenv(s);
+#else
+#error expected setenv/putenv functions
#endif
}
}
diff --git a/ncurses/tinfo/hashed_db.c b/ncurses/tinfo/hashed_db.c
index b59420585eac..cc8c9d4893cd 100644
--- a/ncurses/tinfo/hashed_db.c
+++ b/ncurses/tinfo/hashed_db.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2006-2011,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 2006-2013,2019 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 *
@@ -36,7 +36,7 @@
#if USE_HASHED_DB
-MODULE_ID("$Id: hashed_db.c,v 1.17 2013/12/15 00:33:01 tom Exp $")
+MODULE_ID("$Id: hashed_db.c,v 1.18 2019/01/21 17:34:49 tom Exp $")
#if HASHED_DB_API >= 2
static DBC *cursor;
@@ -273,7 +273,7 @@ _nc_db_next(DB * db, DBT * key, DBT * data)
result = -1;
}
#else
- result = db->seq(db, key, data, 0);
+ result = db->seq(db, key, data, R_NEXT);
#endif
return result;
}
diff --git a/ncurses/tinfo/home_terminfo.c b/ncurses/tinfo/home_terminfo.c
index e77f71c2aeb1..5c2869d4800f 100644
--- a/ncurses/tinfo/home_terminfo.c
+++ b/ncurses/tinfo/home_terminfo.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2016 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 *
@@ -37,7 +37,7 @@
#include <curses.priv.h>
#include <tic.h>
-MODULE_ID("$Id: home_terminfo.c,v 1.15 2012/10/27 21:49:14 tom Exp $")
+MODULE_ID("$Id: home_terminfo.c,v 1.16 2016/05/28 23:22:52 tom Exp $")
/* ncurses extension...fall back on user's private directory */
@@ -48,10 +48,11 @@ _nc_home_terminfo(void)
{
char *result = 0;
#if USE_HOME_TERMINFO
- char *home;
-
if (use_terminfo_vars()) {
+
if (MyBuffer == 0) {
+ char *home;
+
if ((home = getenv("HOME")) != 0) {
size_t want = (strlen(home) + sizeof(PRIVATE_INFO));
TYPE_MALLOC(char, want, MyBuffer);
diff --git a/ncurses/tinfo/init_keytry.c b/ncurses/tinfo/init_keytry.c
index ea47b382b493..4853ea120172 100644
--- a/ncurses/tinfo/init_keytry.c
+++ b/ncurses/tinfo/init_keytry.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2010,2016 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,7 +29,7 @@
#include <curses.priv.h>
#include <tic.h> /* struct tinfo_fkeys */
-MODULE_ID("$Id: init_keytry.c,v 1.17 2010/04/24 22:29:56 tom Exp $")
+MODULE_ID("$Id: init_keytry.c,v 1.18 2016/05/28 23:22:52 tom Exp $")
/*
** _nc_init_keytry()
@@ -66,14 +66,14 @@ _nc_tinfo_fkeysf(void)
NCURSES_EXPORT(void)
_nc_init_keytry(SCREEN *sp)
{
- unsigned n;
-
/* The sp->_keytry value is initialized in newterm(), where the sp
* structure is created, because we can not tell where keypad() or
* mouse_activate() (which will call keyok()) are first called.
*/
if (sp != 0) {
+ unsigned n;
+
for (n = 0; _nc_tinfo_fkeys[n].code; n++) {
if (_nc_tinfo_fkeys[n].offset < STRCOUNT) {
(void) _nc_add_to_try(&(sp->_keytry),
diff --git a/ncurses/tinfo/lib_acs.c b/ncurses/tinfo/lib_acs.c
index 704eda5c9a29..9e74f9f7dd65 100644
--- a/ncurses/tinfo/lib_acs.c
+++ b/ncurses/tinfo/lib_acs.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 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 *
@@ -39,7 +39,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_acs.c,v 1.44 2013/01/12 17:24:42 tom Exp $")
+MODULE_ID("$Id: lib_acs.c,v 1.49 2019/06/23 16:22:10 tom Exp $")
#if BROKEN_LINKER || USE_REENTRANT
#define MyBuffer _nc_prescreen.real_acs_map
@@ -166,12 +166,12 @@ NCURSES_SP_NAME(_nc_init_acs) (NCURSES_SP_DCL0)
real_map['E'] = '+'; /* large plus or crossover */
#ifdef USE_TERM_DRIVER
- CallDriver_2(SP_PARM, initacs, real_map, fake_map);
+ CallDriver_2(SP_PARM, td_initacs, real_map, fake_map);
#else
if (ena_acs != NULL) {
NCURSES_PUTP2("ena_acs", ena_acs);
}
-#if NCURSES_EXT_FUNCS
+#if NCURSES_EXT_FUNCS && defined(enter_pc_charset_mode) && defined(exit_pc_charset_mode)
/*
* Linux console "supports" the "PC ROM" character set by the coincidence
* that smpch/rmpch and smacs/rmacs have the same values. ncurses has
@@ -205,8 +205,13 @@ NCURSES_SP_NAME(_nc_init_acs) (NCURSES_SP_DCL0)
while (i + 1 < length) {
if (acs_chars[i] != 0 && UChar(acs_chars[i]) < ACS_LEN) {
real_map[UChar(acs_chars[i])] = UChar(acs_chars[i + 1]) | A_ALTCHARSET;
- if (SP != 0)
+ T(("#%d real_map[%s] = %s",
+ (int) i,
+ _tracechar(UChar(acs_chars[i])),
+ _tracechtype(real_map[UChar(acs_chars[i])])));
+ if (SP != 0) {
SP->_screen_acs_map[UChar(acs_chars[i])] = TRUE;
+ }
}
i += 2;
}
@@ -249,3 +254,72 @@ _nc_init_acs(void)
NCURSES_SP_NAME(_nc_init_acs) (CURRENT_SCREEN);
}
#endif
+
+#if !NCURSES_WCWIDTH_GRAPHICS
+NCURSES_EXPORT(int)
+_nc_wacs_width(unsigned ch)
+{
+ int result;
+ switch (ch) {
+ case 0x00a3: /* FALLTHRU - ncurses pound-sterling symbol */
+ case 0x00b0: /* FALLTHRU - VT100 degree symbol */
+ case 0x00b1: /* FALLTHRU - VT100 plus/minus */
+ case 0x00b7: /* FALLTHRU - VT100 bullet */
+ case 0x03c0: /* FALLTHRU - ncurses greek pi */
+ case 0x2190: /* FALLTHRU - Teletype arrow pointing left */
+ case 0x2191: /* FALLTHRU - Teletype arrow pointing up */
+ case 0x2192: /* FALLTHRU - Teletype arrow pointing right */
+ case 0x2193: /* FALLTHRU - Teletype arrow pointing down */
+ case 0x2260: /* FALLTHRU - ncurses not-equal */
+ case 0x2264: /* FALLTHRU - ncurses less-than-or-equal-to */
+ case 0x2265: /* FALLTHRU - ncurses greater-than-or-equal-to */
+ case 0x23ba: /* FALLTHRU - VT100 scan line 1 */
+ case 0x23bb: /* FALLTHRU - ncurses scan line 3 */
+ case 0x23bc: /* FALLTHRU - ncurses scan line 7 */
+ case 0x23bd: /* FALLTHRU - VT100 scan line 9 */
+ case 0x2500: /* FALLTHRU - VT100 horizontal line */
+ case 0x2501: /* FALLTHRU - thick horizontal line */
+ case 0x2502: /* FALLTHRU - VT100 vertical line */
+ case 0x2503: /* FALLTHRU - thick vertical line */
+ case 0x250c: /* FALLTHRU - VT100 upper left corner */
+ case 0x250f: /* FALLTHRU - thick upper left corner */
+ case 0x2510: /* FALLTHRU - VT100 upper right corner */
+ case 0x2513: /* FALLTHRU - thick upper right corner */
+ case 0x2514: /* FALLTHRU - VT100 lower left corner */
+ case 0x2517: /* FALLTHRU - thick lower left corner */
+ case 0x2518: /* FALLTHRU - VT100 lower right corner */
+ case 0x251b: /* FALLTHRU - thick lower right corner */
+ case 0x251c: /* FALLTHRU - VT100 tee pointing left */
+ case 0x2523: /* FALLTHRU - thick tee pointing left */
+ case 0x2524: /* FALLTHRU - VT100 tee pointing right */
+ case 0x252b: /* FALLTHRU - thick tee pointing right */
+ case 0x252c: /* FALLTHRU - VT100 tee pointing down */
+ case 0x2533: /* FALLTHRU - thick tee pointing down */
+ case 0x2534: /* FALLTHRU - VT100 tee pointing up */
+ case 0x253b: /* FALLTHRU - thick tee pointing up */
+ case 0x253c: /* FALLTHRU - VT100 large plus or crossover */
+ case 0x254b: /* FALLTHRU - thick large plus or crossover */
+ case 0x2550: /* FALLTHRU - double horizontal line */
+ case 0x2551: /* FALLTHRU - double vertical line */
+ case 0x2554: /* FALLTHRU - double upper left corner */
+ case 0x2557: /* FALLTHRU - double upper right corner */
+ case 0x255a: /* FALLTHRU - double lower left corner */
+ case 0x255d: /* FALLTHRU - double lower right corner */
+ case 0x2560: /* FALLTHRU - double tee pointing right */
+ case 0x2563: /* FALLTHRU - double tee pointing left */
+ case 0x2566: /* FALLTHRU - double tee pointing down */
+ case 0x2569: /* FALLTHRU - double tee pointing up */
+ case 0x256c: /* FALLTHRU - double large plus or crossover */
+ case 0x2592: /* FALLTHRU - VT100 checker board (stipple) */
+ case 0x25ae: /* FALLTHRU - Teletype solid square block */
+ case 0x25c6: /* FALLTHRU - VT100 diamond */
+ case 0x2603: /* FALLTHRU - Teletype lantern symbol */
+ result = 1;
+ break;
+ default:
+ result = wcwidth(ch);
+ break;
+ }
+ return result;
+}
+#endif /* !NCURSES_WCWIDTH_GRAPHICS */
diff --git a/ncurses/tinfo/lib_baudrate.c b/ncurses/tinfo/lib_baudrate.c
index 252d03c593d8..d91e8aa98fc0 100644
--- a/ncurses/tinfo/lib_baudrate.c
+++ b/ncurses/tinfo/lib_baudrate.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-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 *
@@ -39,7 +39,7 @@
#include <curses.priv.h>
#include <termcap.h> /* ospeed */
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
#include <sys/param.h>
#endif
@@ -49,7 +49,11 @@
* of the indices up to B115200 fit nicely in a 'short', allowing us to retain
* ospeed's type for compatibility.
*/
-#if NCURSES_OSPEED_COMPAT && ((defined(__FreeBSD__) && (__FreeBSD_version < 700000)) || defined(__NetBSD__) || defined(__OpenBSD__))
+#if NCURSES_OSPEED_COMPAT && \
+ ((defined(__FreeBSD__) && (__FreeBSD_version < 700000)) || \
+ defined(__NetBSD__) || \
+ ((defined(__OpenBSD__) && OpenBSD < 201510)) || \
+ defined(__APPLE__))
#undef B0
#undef B50
#undef B75
@@ -79,7 +83,7 @@
#undef USE_OLD_TTY
#endif /* USE_OLD_TTY */
-MODULE_ID("$Id: lib_baudrate.c,v 1.34 2013/12/15 01:29:02 tom Exp $")
+MODULE_ID("$Id: lib_baudrate.c,v 1.43 2017/03/31 17:19:30 tom Exp $")
/*
* int
@@ -90,8 +94,8 @@ MODULE_ID("$Id: lib_baudrate.c,v 1.34 2013/12/15 01:29:02 tom Exp $")
*/
struct speed {
- NCURSES_OSPEED s; /* values for 'ospeed' */
- int sp; /* the actual speed */
+ int given_speed; /* values for 'ospeed' */
+ int actual_speed; /* the actual speed */
};
#define DATA(number) { B##number, number }
@@ -117,6 +121,9 @@ static struct speed const speeds[] =
#elif defined(EXTA)
{EXTA, 19200},
#endif
+#ifdef B28800
+ DATA(28800),
+#endif
#ifdef B38400
DATA(38400),
#elif defined(EXTB)
@@ -127,18 +134,57 @@ static struct speed const speeds[] =
#endif
/* ifdef to prevent overflow when OLD_TTY is not available */
#if !(NCURSES_OSPEED_COMPAT && defined(__FreeBSD__) && (__FreeBSD_version > 700000))
+#ifdef B76800
+ DATA(76800),
+#endif
#ifdef B115200
DATA(115200),
#endif
+#ifdef B153600
+ DATA(153600),
+#endif
#ifdef B230400
DATA(230400),
#endif
+#ifdef B307200
+ DATA(307200),
+#endif
#ifdef B460800
DATA(460800),
#endif
+#ifdef B500000
+ DATA(500000),
+#endif
+#ifdef B576000
+ DATA(576000),
+#endif
#ifdef B921600
DATA(921600),
#endif
+#ifdef B1000000
+ DATA(1000000),
+#endif
+#ifdef B1152000
+ DATA(1152000),
+#endif
+#ifdef B1500000
+ DATA(1500000),
+#endif
+#ifdef B2000000
+ DATA(2000000),
+#endif
+#ifdef B2500000
+ DATA(2500000),
+#endif
+#ifdef B3000000
+ DATA(3000000),
+#endif
+#ifdef B3500000
+ DATA(3500000),
+#endif
+#ifdef B4000000
+ DATA(4000000),
+#endif
#endif
};
@@ -151,8 +197,11 @@ _nc_baudrate(int OSpeed)
#endif
int result = ERR;
- unsigned i;
+ if (OSpeed < 0)
+ OSpeed = (NCURSES_OSPEED) OSpeed;
+ if (OSpeed < 0)
+ OSpeed = (unsigned short) OSpeed;
#if !USE_REENTRANT
if (OSpeed == last_OSpeed) {
result = last_baudrate;
@@ -160,9 +209,14 @@ _nc_baudrate(int OSpeed)
#endif
if (result == ERR) {
if (OSpeed >= 0) {
+ unsigned i;
+
for (i = 0; i < SIZEOF(speeds); i++) {
- if (speeds[i].s == OSpeed) {
- result = speeds[i].sp;
+ if (speeds[i].given_speed > OSpeed) {
+ break;
+ }
+ if (speeds[i].given_speed == OSpeed) {
+ result = speeds[i].actual_speed;
break;
}
}
@@ -181,12 +235,13 @@ NCURSES_EXPORT(int)
_nc_ospeed(int BaudRate)
{
int result = 1;
- unsigned i;
if (BaudRate >= 0) {
+ unsigned i;
+
for (i = 0; i < SIZEOF(speeds); i++) {
- if (speeds[i].sp == BaudRate) {
- result = speeds[i].s;
+ if (speeds[i].actual_speed == BaudRate) {
+ result = speeds[i].given_speed;
break;
}
}
@@ -208,7 +263,7 @@ NCURSES_SP_NAME(baudrate) (NCURSES_SP_DCL0)
*/
#ifdef TRACE
if (IsValidTIScreen(SP_PARM)
- && !isatty(fileno(SP_PARM ? SP_PARM->_ofp : stdout))
+ && !NC_ISATTY(fileno((SP_PARM && SP_PARM->_ofp) ? SP_PARM->_ofp : stdout))
&& getenv("BAUDRATE") != 0) {
int ret;
if ((ret = _nc_getenv_num("BAUDRATE")) <= 0)
diff --git a/ncurses/tinfo/lib_cur_term.c b/ncurses/tinfo/lib_cur_term.c
index eaaacbcbe51f..e5cd76bf22a5 100644
--- a/ncurses/tinfo/lib_cur_term.c
+++ b/ncurses/tinfo/lib_cur_term.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-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 *
@@ -39,10 +39,10 @@
#include <curses.priv.h>
#include <termcap.h> /* ospeed */
-MODULE_ID("$Id: lib_cur_term.c,v 1.32 2013/10/28 00:10:27 tom Exp $")
+MODULE_ID("$Id: lib_cur_term.c,v 1.41 2017/06/17 22:21:35 tom Exp $")
#undef CUR
-#define CUR termp->type.
+#define CUR TerminalType(termp).
#if USE_REENTRANT
@@ -76,7 +76,7 @@ NCURSES_EXPORT_VAR(TERMINAL *) cur_term = 0;
#endif
NCURSES_EXPORT(TERMINAL *)
-NCURSES_SP_NAME(set_curterm) (NCURSES_SP_DCLx TERMINAL * termp)
+NCURSES_SP_NAME(set_curterm) (NCURSES_SP_DCLx TERMINAL *termp)
{
TERMINAL *oldterm;
@@ -95,16 +95,21 @@ NCURSES_SP_NAME(set_curterm) (NCURSES_SP_DCLx TERMINAL * termp)
#ifdef USE_TERM_DRIVER
TERMINAL_CONTROL_BLOCK *TCB = (TERMINAL_CONTROL_BLOCK *) termp;
ospeed = (NCURSES_OSPEED) _nc_ospeed(termp->_baudrate);
- if (TCB->drv->isTerminfo && termp->type.Strings) {
+ if (TCB->drv &&
+ TCB->drv->isTerminfo &&
+ TerminalType(termp).Strings) {
PC = (char) ((pad_char != NULL) ? pad_char[0] : 0);
}
TCB->csp = SP_PARM;
#else
ospeed = (NCURSES_OSPEED) _nc_ospeed(termp->_baudrate);
- if (termp->type.Strings) {
+ if (TerminalType(termp).Strings) {
PC = (char) ((pad_char != NULL) ? pad_char[0] : 0);
}
#endif
+#if !USE_REENTRANT
+ save_ttytype(termp);
+#endif
}
_nc_unlock_global(curses);
@@ -114,14 +119,14 @@ NCURSES_SP_NAME(set_curterm) (NCURSES_SP_DCLx TERMINAL * termp)
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(TERMINAL *)
-set_curterm(TERMINAL * termp)
+set_curterm(TERMINAL *termp)
{
return NCURSES_SP_NAME(set_curterm) (CURRENT_SCREEN, termp);
}
#endif
NCURSES_EXPORT(int)
-NCURSES_SP_NAME(del_curterm) (NCURSES_SP_DCLx TERMINAL * termp)
+NCURSES_SP_NAME(del_curterm) (NCURSES_SP_DCLx TERMINAL *termp)
{
int rc = ERR;
@@ -139,7 +144,10 @@ NCURSES_SP_NAME(del_curterm) (NCURSES_SP_DCLx TERMINAL * termp)
#endif
);
- _nc_free_termtype(&(termp->type));
+#if NCURSES_EXT_NUMBERS
+ _nc_free_termtype(&termp->type);
+#endif
+ _nc_free_termtype2(&TerminalType(termp));
if (termp == cur)
NCURSES_SP_NAME(set_curterm) (NCURSES_SP_ARGx 0);
@@ -151,7 +159,11 @@ NCURSES_SP_NAME(del_curterm) (NCURSES_SP_DCLx TERMINAL * termp)
#endif
#ifdef USE_TERM_DRIVER
if (TCB->drv)
- TCB->drv->release(TCB);
+ TCB->drv->td_release(TCB);
+#endif
+#if NO_LEAKS
+ /* discard memory used in tgetent's cache for this terminal */
+ _nc_tgetent_leak(termp);
#endif
free(termp);
@@ -162,9 +174,9 @@ NCURSES_SP_NAME(del_curterm) (NCURSES_SP_DCLx TERMINAL * termp)
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-del_curterm(TERMINAL * termp)
+del_curterm(TERMINAL *termp)
{
- int rc = ERR;
+ int rc;
_nc_lock_global(curses);
rc = NCURSES_SP_NAME(del_curterm) (CURRENT_SCREEN, termp);
diff --git a/ncurses/tinfo/lib_data.c b/ncurses/tinfo/lib_data.c
index 06b6f88077e4..860c247f84f4 100644
--- a/ncurses/tinfo/lib_data.c
+++ b/ncurses/tinfo/lib_data.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -42,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_data.c,v 1.66 2013/08/24 17:28:24 tom Exp $")
+MODULE_ID("$Id: lib_data.c,v 1.79 2018/09/01 19:36:39 tom Exp $")
/*
* OS/2's native linker complains if we don't initialize public data when
@@ -94,7 +94,9 @@ _nc_screen(void)
NCURSES_EXPORT(int)
_nc_alloc_screen(void)
{
- return ((my_screen = _nc_alloc_screen_sp()) != 0);
+ my_screen = _nc_alloc_screen_sp();
+ T(("_nc_alloc_screen_sp %p", my_screen));
+ return (my_screen != 0);
}
NCURSES_EXPORT(void)
@@ -137,6 +139,8 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
0, /* slk_format */
+ 2048, /* getstr_limit */
+
NULL, /* safeprint_buf */
0, /* safeprint_used */
@@ -150,6 +154,10 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
0, /* dbd_time */
{ { 0, 0 } }, /* dbd_vars */
+#ifdef USE_TERM_DRIVER
+ 0, /* term_driver */
+#endif
+
#ifndef USE_SP_WINDOWLIST
0, /* _nc_windowlist */
#endif
@@ -163,15 +171,28 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
0, /* safeprint_rows */
#endif
-#ifdef USE_TERM_DRIVER
- 0, /* term_driver */
+#ifdef USE_PTHREADS
+ PTHREAD_MUTEX_INITIALIZER, /* mutex_curses */
+ PTHREAD_MUTEX_INITIALIZER, /* mutex_prescreen */
+ PTHREAD_MUTEX_INITIALIZER, /* mutex_screen */
+ PTHREAD_MUTEX_INITIALIZER, /* mutex_update */
+ PTHREAD_MUTEX_INITIALIZER, /* mutex_tst_tracef */
+ PTHREAD_MUTEX_INITIALIZER, /* mutex_tracef */
+ 0, /* nested_tracef */
+ 0, /* use_pthreads */
+#if USE_PTHREADS_EINTR
+ 0, /* read_thread */
+#endif
+#endif
+#if USE_WIDEC_SUPPORT
+ CHARS_0s, /* key_name */
#endif
-
#ifdef TRACE
- FALSE, /* init_trace */
+ FALSE, /* trace_opened */
CHARS_0s, /* trace_fname */
0, /* trace_level */
NULL, /* trace_fp */
+ -1, /* trace_fd */
NULL, /* tracearg_buf */
0, /* tracearg_used */
@@ -194,15 +215,8 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
0, /* nested_tracef */
#endif
#endif /* TRACE */
-#ifdef USE_PTHREADS
- PTHREAD_MUTEX_INITIALIZER, /* mutex_curses */
- PTHREAD_MUTEX_INITIALIZER, /* mutex_tst_tracef */
- PTHREAD_MUTEX_INITIALIZER, /* mutex_tracef */
- 0, /* nested_tracef */
- 0, /* use_pthreads */
-#endif
-#if USE_PTHREADS_EINTR
- 0, /* read_thread */
+#if NO_LEAKS
+ FALSE, /* leak_checking */
#endif
};
@@ -214,17 +228,11 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
#define RIPOFF_0s { RIPOFF_0 }
NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = {
+ NULL, /* allocated */
TRUE, /* use_env */
FALSE, /* filter_mode */
A_NORMAL, /* previous_attr */
-#ifndef USE_SP_RIPOFF
- RIPOFF_0s, /* ripoff */
- NULL, /* rsp */
-#endif
{ /* tparm_state */
-#ifdef TRACE
- NULL, /* tname */
-#endif
NULL, /* tparam_base */
STACK_FRAME_0s, /* stack */
@@ -239,12 +247,20 @@ NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = {
NUM_VARS_0s, /* dynamic_var */
NUM_VARS_0s, /* static_vars */
+#ifdef TRACE
+ NULL, /* tname */
+#endif
},
NULL, /* saved_tty */
+ FALSE, /* use_tioctl */
+ 0, /* _outch */
+#ifndef USE_SP_RIPOFF
+ RIPOFF_0s, /* ripoff */
+ NULL, /* rsp */
+#endif
#if NCURSES_NO_PADDING
FALSE, /* flag to set if padding disabled */
#endif
- 0, /* _outch */
#if BROKEN_LINKER || USE_REENTRANT
NULL, /* real_acs_map */
0, /* LINES */
@@ -252,12 +268,13 @@ NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = {
8, /* TABSIZE */
1000, /* ESCDELAY */
0, /* cur_term */
+#endif
#ifdef TRACE
+#if BROKEN_LINKER || USE_REENTRANT
0L, /* _outchars */
NULL, /* _tputs_trace */
#endif
#endif
- FALSE, /* use_tioctl */
};
/* *INDENT-ON* */
@@ -287,6 +304,9 @@ init_global_mutexes(void)
if (!initialized) {
initialized = TRUE;
_nc_mutex_init(&_nc_globals.mutex_curses);
+ _nc_mutex_init(&_nc_globals.mutex_prescreen);
+ _nc_mutex_init(&_nc_globals.mutex_screen);
+ _nc_mutex_init(&_nc_globals.mutex_update);
_nc_mutex_init(&_nc_globals.mutex_tst_tracef);
_nc_mutex_init(&_nc_globals.mutex_tracef);
}
@@ -371,7 +391,7 @@ _nc_sigprocmask(int how, const sigset_t * newmask, sigset_t * oldmask)
if ((pthread_sigmask))
return pthread_sigmask(how, newmask, oldmask);
else
- return sigprocmask(how, newmask, oldmask);
+ return (sigprocmask) (how, newmask, oldmask);
}
#endif
#endif /* USE_PTHREADS */
diff --git a/ncurses/tinfo/lib_longname.c b/ncurses/tinfo/lib_longname.c
index 14903175b322..fa231b88def8 100644
--- a/ncurses/tinfo/lib_longname.c
+++ b/ncurses/tinfo/lib_longname.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c