summaryrefslogtreecommitdiffstats
path: root/contrib/ncurses/ncurses
diff options
context:
space:
mode:
authorrafan <rafan@FreeBSD.org>2007-12-30 11:08:14 +0000
committerrafan <rafan@FreeBSD.org>2007-12-30 11:08:14 +0000
commit9f9e55f97a716ef0dd4082c4cef00a5a95b624a9 (patch)
tree319eb1471eaf8c0c9cfc606e7cb8987ca9167507 /contrib/ncurses/ncurses
parent7ed1a8e865bedf5154163476c1224b868257ab1a (diff)
downloadFreeBSD-src-9f9e55f97a716ef0dd4082c4cef00a5a95b624a9.zip
FreeBSD-src-9f9e55f97a716ef0dd4082c4cef00a5a95b624a9.tar.gz
Import ncurses 5.6-20071222 snapshot onto the vender branch
Diffstat (limited to 'contrib/ncurses/ncurses')
-rw-r--r--contrib/ncurses/ncurses/Makefile.in51
-rw-r--r--contrib/ncurses/ncurses/base/MKkeyname.awk83
-rwxr-xr-xcontrib/ncurses/ncurses/base/MKlib_gen.sh12
-rw-r--r--contrib/ncurses/ncurses/base/MKunctrl.awk92
-rw-r--r--contrib/ncurses/ncurses/base/define_key.c13
-rw-r--r--contrib/ncurses/ncurses/base/key_defined.c22
-rw-r--r--contrib/ncurses/ncurses/base/keyok.c14
-rw-r--r--contrib/ncurses/ncurses/base/lib_addstr.c15
-rw-r--r--contrib/ncurses/ncurses/base/lib_color.c48
-rw-r--r--contrib/ncurses/ncurses/base/lib_delwin.c31
-rw-r--r--contrib/ncurses/ncurses/base/lib_freeall.c55
-rw-r--r--contrib/ncurses/ncurses/base/lib_getch.c39
-rw-r--r--contrib/ncurses/ncurses/base/lib_initscr.c9
-rw-r--r--contrib/ncurses/ncurses/base/lib_instr.c10
-rw-r--r--contrib/ncurses/ncurses/base/lib_mouse.c24
-rw-r--r--contrib/ncurses/ncurses/base/lib_newterm.c34
-rw-r--r--contrib/ncurses/ncurses/base/lib_newwin.c75
-rw-r--r--contrib/ncurses/ncurses/base/lib_overlay.c11
-rw-r--r--contrib/ncurses/ncurses/base/lib_redrawln.c10
-rw-r--r--contrib/ncurses/ncurses/base/lib_refresh.c144
-rw-r--r--contrib/ncurses/ncurses/base/lib_restart.c18
-rw-r--r--contrib/ncurses/ncurses/base/lib_screen.c19
-rw-r--r--contrib/ncurses/ncurses/base/lib_set_term.c147
-rw-r--r--contrib/ncurses/ncurses/base/lib_slkinit.c15
-rw-r--r--contrib/ncurses/ncurses/base/lib_slkset.c13
-rw-r--r--contrib/ncurses/ncurses/base/lib_ungetch.c8
-rw-r--r--contrib/ncurses/ncurses/base/lib_window.c6
-rw-r--r--contrib/ncurses/ncurses/base/memmove.c6
-rw-r--r--contrib/ncurses/ncurses/base/resizeterm.c113
-rw-r--r--contrib/ncurses/ncurses/base/safe_sprintf.c56
-rw-r--r--contrib/ncurses/ncurses/base/tries.c22
-rw-r--r--contrib/ncurses/ncurses/base/use_window.c80
-rw-r--r--contrib/ncurses/ncurses/base/wresize.c17
-rw-r--r--contrib/ncurses/ncurses/curses.priv.h382
-rw-r--r--contrib/ncurses/ncurses/llib-lncurses549
-rw-r--r--contrib/ncurses/ncurses/llib-lncursesw573
-rw-r--r--contrib/ncurses/ncurses/modules31
-rw-r--r--contrib/ncurses/ncurses/tinfo/MKcaptab.awk134
-rw-r--r--contrib/ncurses/ncurses/tinfo/MKcaptab.sh149
-rw-r--r--contrib/ncurses/ncurses/tinfo/MKcodes.awk161
-rw-r--r--contrib/ncurses/ncurses/tinfo/MKnames.awk226
-rw-r--r--contrib/ncurses/ncurses/tinfo/access.c10
-rw-r--r--contrib/ncurses/ncurses/tinfo/add_tries.c39
-rw-r--r--contrib/ncurses/ncurses/tinfo/comp_error.c34
-rw-r--r--contrib/ncurses/ncurses/tinfo/comp_hash.c111
-rw-r--r--contrib/ncurses/ncurses/tinfo/comp_parse.c96
-rw-r--r--contrib/ncurses/ncurses/tinfo/db_iterator.c52
-rw-r--r--contrib/ncurses/ncurses/tinfo/entries.c144
-rw-r--r--contrib/ncurses/ncurses/tinfo/home_terminfo.c21
-rw-r--r--contrib/ncurses/ncurses/tinfo/init_keytry.c16
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_acs.c28
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_baudrate.c27
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_data.c148
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_options.c4
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_raw.c8
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_setup.c112
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_termcap.c60
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_tparm.c153
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_tputs.c17
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_ttyflags.c80
-rw-r--r--contrib/ncurses/ncurses/tinfo/make_keys.c6
-rw-r--r--contrib/ncurses/ncurses/tinfo/name_match.c24
-rw-r--r--contrib/ncurses/ncurses/tinfo/parse_entry.c20
-rw-r--r--contrib/ncurses/ncurses/tinfo/read_entry.c6
-rw-r--r--contrib/ncurses/ncurses/tinfo/setbuf.c6
-rw-r--r--contrib/ncurses/ncurses/tinfo/strings.c6
-rw-r--r--contrib/ncurses/ncurses/tinfo/trim_sgr0.c10
-rw-r--r--contrib/ncurses/ncurses/tinfo/use_screen.c60
-rw-r--r--contrib/ncurses/ncurses/tinfo/write_entry.c22
-rw-r--r--contrib/ncurses/ncurses/trace/lib_trace.c161
-rw-r--r--contrib/ncurses/ncurses/trace/lib_traceatr.c50
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracebits.c27
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracechr.c15
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracedmp.c57
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracemse.c27
-rw-r--r--contrib/ncurses/ncurses/trace/trace_buf.c42
-rw-r--r--contrib/ncurses/ncurses/trace/trace_tries.c30
-rw-r--r--contrib/ncurses/ncurses/trace/varargs.c26
-rw-r--r--contrib/ncurses/ncurses/trace/visbuf.c32
-rw-r--r--contrib/ncurses/ncurses/tty/hardscroll.c34
-rw-r--r--contrib/ncurses/ncurses/tty/hashmap.c43
-rw-r--r--contrib/ncurses/ncurses/tty/lib_mvcur.c11
-rw-r--r--contrib/ncurses/ncurses/tty/lib_tstp.c38
-rw-r--r--contrib/ncurses/ncurses/tty/lib_twait.c48
-rw-r--r--contrib/ncurses/ncurses/tty/lib_vidattr.c42
-rw-r--r--contrib/ncurses/ncurses/tty/tty_update.c25
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_cchar.c9
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_get_wch.c6
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c26
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_key_name.c62
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_unget_wch.c20
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_vid_attr.c5
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_wunctrl.c16
93 files changed, 3763 insertions, 1926 deletions
diff --git a/contrib/ncurses/ncurses/Makefile.in b/contrib/ncurses/ncurses/Makefile.in
index ce35c03..39826e3 100644
--- a/contrib/ncurses/ncurses/Makefile.in
+++ b/contrib/ncurses/ncurses/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.101 2006/10/14 19:08:11 tom Exp $
+# $Id: Makefile.in,v 1.112 2007/09/01 20:45:53 tom Exp $
##############################################################################
-# Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2006,2007 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"), #
@@ -112,12 +112,13 @@ CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@
CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@)
-LINK = $(LIBTOOL) $(CC)
+LINK = $(LIBTOOL)
LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@
SHLIB_DIRS = -L../lib
SHLIB_LIST = $(SHLIB_DIRS) @SHLIB_LIST@
TINFO_LIST = $(SHLIB_DIRS) @TINFO_LIST@
+TICS_LIST = $(SHLIB_DIRS) @TICS_LIST@
MK_SHARED_LIB = @MK_SHARED_LIB@
@@ -128,8 +129,6 @@ ABI_VERSION = @cf_cv_abi_version@
RANLIB = @LIB_PREP@
-IMPORT_LIB = @IMPORT_LIB@
-SHARED_LIB = @SHARED_LIB@
LIBRARIES = @LIBS_TO_MAKE@
LINT = @LINT@
@@ -138,6 +137,7 @@ LINT_LIBS = -lncurses @LIBS@
FALLBACK_LIST = @FALLBACK_LIST@
+USE_BIG_STRINGS = @USE_BIG_STRINGS@
TERMINFO_CAPS = $(top_srcdir)/include/@TERMINFO_CAPS@
AUTO_SRC = \
@@ -151,11 +151,10 @@ AUTO_SRC = \
./names.c \
./unctrl.c \
init_keytry.h \
- keys.list \
- names-stamp
+ keys.list
TEST_DEPS = ../lib/@LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@
-TEST_ARGS = -L../lib -lncurses@DFT_ARG_SUFFIX@
+TEST_ARGS = @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@
TEST_LDFLAGS = @LD_MODEL@ $(TEST_ARGS) @LIBS@ @LOCAL_LDFLAGS@ @LDFLAGS@
TEST_PROGS = \
@@ -179,7 +178,7 @@ sources: $(AUTO_SRC)
$(DESTDIR)$(bindir) \
$(DESTDIR)$(libdir) :
- sh $(srcdir)/../mkinstalldirs $@
+ sh $(srcdir)/../mkdirs.sh $@
../lib : ; mkdir $@
@@ -197,7 +196,7 @@ keys.list : $(tinfo)/MKkeys_list.sh
make_keys$(BUILD_EXEEXT) : \
$(tinfo)/make_keys.c \
- names-stamp
+ names.c
$(BUILD_CC) -o $@ $(BUILD_CCFLAGS) $(tinfo)/make_keys.c $(BUILD_LDFLAGS) $(BUILD_LIBS)
make_hash$(BUILD_EXEEXT) : \
@@ -211,27 +210,21 @@ make_hash$(BUILD_EXEEXT) : \
./comp_captab.c: \
make_hash$(BUILD_EXEEXT) \
../include/hashsize.h \
+ $(tinfo)/MKcaptab.sh \
$(tinfo)/MKcaptab.awk
- sh $(tinfo)/MKcaptab.awk $(AWK) $(srcdir)/../include/@TERMINFO_CAPS@ > $@
+ sh $(tinfo)/MKcaptab.sh $(AWK) $(USE_BIG_STRINGS) $(tinfo)/MKcaptab.awk $(srcdir)/../include/@TERMINFO_CAPS@ > $@
./lib_keyname.c: keys.list $(base)/MKkeyname.awk
- $(AWK) -f $(base)/MKkeyname.awk keys.list > $@
+ $(AWK) -f $(base)/MKkeyname.awk bigstrings=$(USE_BIG_STRINGS) keys.list > $@
-names-stamp: $(tinfo)/MKnames.awk
- $(AWK) -f $(tinfo)/MKnames.awk $(srcdir)/../include/@TERMINFO_CAPS@
- cat namehdr boolnames boolfnames numnames numfnames strnames strfnames nameftr >names.c
- cat namehdr boolcodes numcodes strcodes codeftr >codes.c
- -rm -f namehdr nameftr codeftr boolnames boolfnames boolcodes numnames numfnames numcodes strnames strfnames strcodes
- @echo >$@
+./codes.c: $(tinfo)/MKcodes.awk
+ $(AWK) -f $(tinfo)/MKcodes.awk bigstrings=$(USE_BIG_STRINGS) $(srcdir)/../include/@TERMINFO_CAPS@ >$@
-./names.c: names-stamp
- @echo made $@
-
-./codes.c: names-stamp
- @echo made $@
+./names.c: $(tinfo)/MKnames.awk
+ $(AWK) -f $(tinfo)/MKnames.awk bigstrings=$(USE_BIG_STRINGS) $(srcdir)/../include/@TERMINFO_CAPS@ >$@
./unctrl.c: $(base)/MKunctrl.awk
- echo | $(AWK) -f $(base)/MKunctrl.awk >$@
+ echo | $(AWK) -f $(base)/MKunctrl.awk bigstrings=$(USE_BIG_STRINGS) >$@
tags:
ctags *.[ch] */*.[ch]
@@ -267,17 +260,17 @@ test_progs : $(TEST_PROGS)
sh $(base)/MKlib_gen.sh "$(CPP) $(CPPFLAGS)" "$(AWK)" implemented <../include/curses.h >$@
captoinfo$x : $(tinfo)/captoinfo.c $(TEST_DEPS)
- @ECHO_LINK@ $(CC) -o $@ $(CFLAGS_DEFAULT) -DMAIN $(tinfo)/captoinfo.c $(TEST_LDFLAGS)
+ @ECHO_LINK@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DMAIN $(tinfo)/captoinfo.c $(TEST_LDFLAGS)
hardscroll$x : $(serial)/hardscroll.c $(TEST_DEPS)
- @ECHO_LINK@ $(CC) -o $@ $(CFLAGS_DEFAULT) -DSCROLLDEBUG $(serial)/hardscroll.c $(TEST_LDFLAGS)
+ @ECHO_LINK@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DSCROLLDEBUG $(serial)/hardscroll.c $(TEST_LDFLAGS)
-hashmap$x : $(serial)/hashmap.c $(TEST_DEPS)
- @ECHO_LINK@ $(CC) -o $@ $(CFLAGS_DEFAULT) -DHASHDEBUG $(serial)/hashmap.c $(TEST_LDFLAGS)
+hashmap$x : $(serial)/hashmap.c $(serial)/hardscroll.c $(TEST_DEPS)
+ @ECHO_LINK@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DHASHDEBUG $(serial)/hashmap.c $(serial)/hardscroll.c $(TEST_LDFLAGS)
lib_mvcur$x : $(serial)/lib_mvcur.c $(TEST_DEPS) \
../@DFT_OBJ_SUBDIR@/dump_entry$o
- @ECHO_LINK@ $(CC) -o $@ $(CFLAGS_DEFAULT) -DNCURSES_TEST -I$(serial)/../../progs $(serial)/lib_mvcur.c ../@DFT_OBJ_SUBDIR@/dump_entry$o $(TEST_LDFLAGS)
+ @ECHO_LINK@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DNCURSES_TEST -I$(serial)/../../progs $(serial)/lib_mvcur.c ../@DFT_OBJ_SUBDIR@/dump_entry$o $(TEST_LDFLAGS)
link_test$x : ./link_test.c $(TEST_DEPS) \
../@DFT_OBJ_SUBDIR@/link_test$o
diff --git a/contrib/ncurses/ncurses/base/MKkeyname.awk b/contrib/ncurses/ncurses/base/MKkeyname.awk
index 11dcfe5..c1d9475 100644
--- a/contrib/ncurses/ncurses/base/MKkeyname.awk
+++ b/contrib/ncurses/ncurses/base/MKkeyname.awk
@@ -1,6 +1,6 @@
-# $Id: MKkeyname.awk,v 1.30 2006/05/20 17:35:30 tom Exp $
+# $Id: MKkeyname.awk,v 1.38 2007/08/18 18:41:18 tom Exp $
##############################################################################
-# Copyright (c) 1999-2005,2006 Free Software Foundation, Inc. #
+# Copyright (c) 1999-2006,2007 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"), #
@@ -33,18 +33,39 @@ BEGIN {
print "#include <tic.h>"
print "#include <term_entry.h>"
print ""
- print "const struct kn _nc_key_names[] = {"
+ first = 1;
}
/^[^#]/ {
- printf "\t{ \"%s\", %s },\n", $1, $1;
+ if (bigstrings) {
+ if (first) {
+ print "struct kn { short offset; int code; };"
+ print "static const struct kn _nc_key_names[] = {"
+ }
+ printf "\t{ %d, %s },\n", offset, $1
+ offset += length($1) + 1
+ names = names"\n\t\""$1"\\0\""
+ } else {
+ if (first) {
+ print "struct kn { const char *name; int code; };"
+ print "static const struct kn _nc_key_names[] = {"
+ }
+ printf "\t{ \"%s\", %s },\n", $1, $1;
+ }
+ first = 0;
}
END {
- printf "\t{ 0, 0 }};\n"
+ if (bigstrings) {
+ printf "\t{ -1, 0 }};\n"
+ print ""
+ print "static const char key_names[] = "names";"
+ } else {
+ printf "\t{ 0, 0 }};\n"
+ }
print ""
print "#define SIZEOF_TABLE 256"
- print "static char **keyname_table;"
+ print "#define MyTable _nc_globals.keyname_table"
print ""
print "NCURSES_EXPORT(NCURSES_CONST char *) keyname (int c)"
print "{"
@@ -56,21 +77,30 @@ END {
print " if (c == -1) {"
print " result = \"-1\";"
print " } else {"
- print " for (i = 0; _nc_key_names[i].name != 0; i++) {"
- print " if (_nc_key_names[i].code == c) {"
- print " result = (NCURSES_CONST char *)_nc_key_names[i].name;"
- print " break;"
- print " }"
- print " }"
+ if (bigstrings) {
+ print " for (i = 0; _nc_key_names[i].offset != -1; i++) {"
+ print " if (_nc_key_names[i].code == c) {"
+ print " result = (NCURSES_CONST char *)key_names + _nc_key_names[i].offset;"
+ print " break;"
+ print " }"
+ print " }"
+ } else {
+ print " for (i = 0; _nc_key_names[i].name != 0; i++) {"
+ print " if (_nc_key_names[i].code == c) {"
+ print " result = (NCURSES_CONST char *)_nc_key_names[i].name;"
+ print " break;"
+ print " }"
+ print " }"
+ }
print ""
print " if (result == 0 && (c >= 0 && c < SIZEOF_TABLE)) {"
- print " if (keyname_table == 0)"
- print " keyname_table = typeCalloc(char *, SIZEOF_TABLE);"
- print " if (keyname_table != 0) {"
- print " if (keyname_table[c] == 0) {"
+ print " if (MyTable == 0)"
+ print " MyTable = typeCalloc(char *, SIZEOF_TABLE);"
+ print " if (MyTable != 0) {"
+ print " if (MyTable[c] == 0) {"
print " int cc = c;"
print " p = name;"
- print " if (cc >= 128) {"
+ print " if (cc >= 128 && (SP == 0 || SP->_use_meta)) {"
print " strcpy(p, \"M-\");"
print " p += 2;"
print " cc -= 128;"
@@ -81,9 +111,9 @@ END {
print " strcpy(p, \"^?\");"
print " else"
print " sprintf(p, \"%c\", cc);"
- print " keyname_table[c] = strdup(name);"
+ print " MyTable[c] = strdup(name);"
print " }"
- print " result = keyname_table[c];"
+ print " result = MyTable[c];"
print " }"
print "#if NCURSES_EXT_FUNCS && NCURSES_XNAMES"
print " } else if (result == 0 && cur_term != 0) {"
@@ -111,24 +141,15 @@ END {
print " return result;"
print "}"
print ""
- print "#if USE_WIDEC_SUPPORT"
- print "NCURSES_EXPORT(NCURSES_CONST char *) key_name (wchar_t c)"
- print "{"
- print " NCURSES_CONST char *result = keyname((int)c);"
- print " if (!strncmp(result, \"M-\", 2)) result = 0;"
- print " return result;"
- print "}"
- print "#endif"
- print ""
print "#if NO_LEAKS"
print "void _nc_keyname_leaks(void)"
print "{"
print " int j;"
- print " if (keyname_table != 0) {"
+ print " if (MyTable != 0) {"
print " for (j = 0; j < SIZEOF_TABLE; ++j) {"
- print " FreeIfNeeded(keyname_table[j]);"
+ print " FreeIfNeeded(MyTable[j]);"
print " }"
- print " FreeAndNull(keyname_table);"
+ print " FreeAndNull(MyTable);"
print " }"
print "}"
print "#endif /* NO_LEAKS */"
diff --git a/contrib/ncurses/ncurses/base/MKlib_gen.sh b/contrib/ncurses/ncurses/base/MKlib_gen.sh
index 30c44ff..b5b0714 100755
--- a/contrib/ncurses/ncurses/base/MKlib_gen.sh
+++ b/contrib/ncurses/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.27 2006/07/01 21:25:39 tom Exp $)
+# ($Id: MKlib_gen.sh,v 1.29 2007/08/18 13:17:14 tom Exp $)
#
##############################################################################
-# Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2006,2007 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,7 +62,7 @@ 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 -I../include"
+preprocessor="$1 -DNCURSES_INTERNALS -I../include"
AWK="$2"
USE="$3"
@@ -406,7 +406,11 @@ sed -n -f $ED1 \
| sed -e 's/NCURSES_EXPORT(\(.*\)) \(.*\) (\(.*\))/\1 \2(\3)/' \
| sed -f $ED2 \
| $AWK -f $AW1 using=$USE \
-| sed -e 's/^\([a-z_][a-z_]*[ *]*\)/\1 gen_/' -e 's/ / /g' >>$TMP
+| sed \
+ -e 's/ [ ]*$//g' \
+ -e 's/^\([a-zA-Z_][a-zA-Z_]*[ *]*\)/\1 gen_/' \
+ -e 's/gen_$//' \
+ -e 's/ / /g' >>$TMP
$preprocessor $TMP 2>/dev/null \
| sed \
diff --git a/contrib/ncurses/ncurses/base/MKunctrl.awk b/contrib/ncurses/ncurses/base/MKunctrl.awk
index e153fa8..5d187a8 100644
--- a/contrib/ncurses/ncurses/base/MKunctrl.awk
+++ b/contrib/ncurses/ncurses/base/MKunctrl.awk
@@ -1,6 +1,6 @@
-# $Id: MKunctrl.awk,v 1.11 2005/12/17 22:48:37 tom Exp $
+# $Id: MKunctrl.awk,v 1.14 2007/07/28 21:13:21 tom Exp $
##############################################################################
-# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2006,2007 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"), #
@@ -42,63 +42,111 @@ END {
print "NCURSES_EXPORT(NCURSES_CONST char *) unctrl (register chtype ch)"
print "{"
- printf "static const char* const table[] = {"
+ blob=""
+ offset=0
+ if (bigstrings) {
+ printf "static const short unctrl_table[] = {"
+ } else {
+ printf "static const char* const unctrl_table[] = {"
+ }
for ( ch = 0; ch < 256; ch++ ) {
gap = ","
- if ((ch % 8) == 0)
+ part=""
+ if ((ch % 8) == 0) {
printf "\n "
+ if (ch != 0)
+ blob = blob "\""
+ blob = blob "\n \""
+ }
+ if (bigstrings)
+ printf "%4d%s", offset, gap;
if (ch < 32) {
- printf "\"^\\%03o\"", ch + 64
+ part = sprintf ("^\\%03o", ch + 64);
+ offset = offset + 3;
} else if (ch == 127) {
- printf "\"^?\""
+ part = "^?";
+ offset = offset + 3;
} else if (ch >= 128 && ch < 160) {
- printf "\"~\\%03o\"", ch - 64
+ part = sprintf("~\\%03o", ch - 64);
+ offset = offset + 3;
} else {
- printf "\"\\%03o\"", ch
gap = gap " "
+ part = sprintf("\\%03o", ch);
+ offset = offset + 2;
}
if (ch == 255)
gap = "\n"
else if (((ch + 1) % 8) != 0)
gap = gap " "
- printf "%s", gap
+ if (bigstrings) {
+ blob = blob part "\\0";
+ } else {
+ printf "\"%s\"%s", part, gap
+ }
}
print "};"
+ blob = blob "\"";
print ""
print "#if NCURSES_EXT_FUNCS"
- printf "static const char* const table2[] = {"
+ if (bigstrings) {
+ blob = blob "\n#if NCURSES_EXT_FUNCS"
+ printf "static const short unctrl_c1[] = {"
+ } else {
+ printf "static const char* const unctrl_c1[] = {"
+ }
for ( ch = 128; ch < 160; ch++ ) {
gap = ","
- if ((ch % 8) == 0)
+ if ((ch % 8) == 0) {
+ if (ch != 128)
+ blob = blob "\""
printf "\n "
- if (ch >= 128 && ch < 160) {
- printf "\"\\%03o\"", ch
- gap = gap " "
+ blob = blob "\n \""
+ }
+ if (bigstrings) {
+ printf "%4d%s", offset, gap;
+ part = sprintf("\\%03o\\0", ch);
+ blob = blob part
+ offset = offset + 2;
+ if (((ch + 1) % 8) != 0)
+ gap = gap " "
+ } else {
+ if (ch >= 128 && ch < 160) {
+ printf "\"\\%03o\"", ch
+ gap = gap " "
+ }
+ if (ch == 255)
+ gap = "\n"
+ else if (((ch + 1) % 8) != 0)
+ gap = gap " "
+ printf "%s", gap
}
- if (ch == 255)
- gap = "\n"
- else if (((ch + 1) % 8) != 0)
- gap = gap " "
- printf "%s", gap
}
print "};"
print "#endif /* NCURSES_EXT_FUNCS */"
+ blob = blob "\"\n#endif /* NCURSES_EXT_FUNCS */\n"
print ""
+ if (bigstrings) {
+ print "static const char unctrl_blob[] = "blob";"
+ print ""
+ stringname = "unctrl_blob + unctrl"
+ } else {
+ stringname = "unctrl"
+ }
print "\tint check = ChCharOf(ch);"
print "\tconst char *result;"
print ""
- print "\tif (check >= 0 && check < (int)SIZEOF(table)) {"
+ print "\tif (check >= 0 && check < (int)SIZEOF(unctrl_table)) {"
print "#if NCURSES_EXT_FUNCS"
print "\t\tif ((SP != 0)"
print "\t\t && (SP->_legacy_coding > 1)"
print "\t\t && (check >= 128)"
print "\t\t && (check < 160))"
- print "\t\t\tresult = table2[check - 128];"
+ printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
print "\t\telse"
print "#endif /* NCURSES_EXT_FUNCS */"
- print "\t\t\tresult = table[check];"
+ printf "\t\t\tresult = %s_table[check];\n", stringname;
print "\t} else {"
print "\t\tresult = 0;"
print "\t}"
diff --git a/contrib/ncurses/ncurses/base/define_key.c b/contrib/ncurses/ncurses/base/define_key.c
index 3b5299a..3d5815f 100644
--- a/contrib/ncurses/ncurses/base/define_key.c
+++ b/contrib/ncurses/ncurses/base/define_key.c
@@ -32,7 +32,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: define_key.c,v 1.10 2006/06/17 18:19:48 tom Exp $")
+MODULE_ID("$Id: define_key.c,v 1.13 2006/12/30 23:23:31 tom Exp $")
NCURSES_EXPORT(int)
define_key(const char *str, int keycode)
@@ -43,16 +43,21 @@ define_key(const char *str, int keycode)
if (SP == 0) {
code = ERR;
} else if (keycode > 0) {
+ unsigned ukey = (unsigned) keycode;
+
if (str != 0) {
define_key(str, 0);
} else if (has_key(keycode)) {
- while (_nc_remove_key(&(SP->_keytry), (unsigned) keycode))
+ while (_nc_remove_key(&(SP->_keytry), ukey))
code = OK;
}
if (str != 0) {
if (key_defined(str) == 0) {
- (void) _nc_add_to_try(&(SP->_keytry), str, (unsigned) keycode);
- code = OK;
+ if (_nc_add_to_try(&(SP->_keytry), str, ukey) == OK) {
+ code = OK;
+ } else {
+ code = ERR;
+ }
} else {
code = ERR;
}
diff --git a/contrib/ncurses/ncurses/base/key_defined.c b/contrib/ncurses/ncurses/base/key_defined.c
index dac1887..759ad82 100644
--- a/contrib/ncurses/ncurses/base/key_defined.c
+++ b/contrib/ncurses/ncurses/base/key_defined.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2003 Free Software Foundation, Inc. *
+ * Copyright (c) 2003,2006 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,26 +32,27 @@
#include <curses.priv.h>
-MODULE_ID("$Id: key_defined.c,v 1.3 2003/05/17 23:12:27 tom Exp $")
+MODULE_ID("$Id: key_defined.c,v 1.6 2006/12/30 23:22:55 tom Exp $")
static int
-find_definition(struct tries *tree, const char *str)
+find_definition(TRIES * tree, const char *str)
{
- struct tries *ptr;
- int result = 0;
+ TRIES *ptr;
+ int result = OK;
if (str != 0 && *str != '\0') {
for (ptr = tree; ptr != 0; ptr = ptr->sibling) {
if (UChar(*str) == UChar(ptr->ch)) {
if (str[1] == '\0' && ptr->child != 0) {
- result = -1;
- } else if ((result = find_definition(ptr->child, str + 1)) == 0) {
+ result = ERR;
+ } else if ((result = find_definition(ptr->child, str + 1))
+ == OK) {
result = ptr->value;
} else if (str[1] == '\0') {
- result = -1;
+ result = ERR;
}
}
- if (result != 0)
+ if (result != OK)
break;
}
}
@@ -60,7 +61,8 @@ find_definition(struct tries *tree, const char *str)
/*
* Returns the keycode associated with the given string. If none is found,
- * return 0. If the string is only a prefix to other strings, return -1.
+ * return OK. If the string is only a prefix to other strings, return ERR.
+ * Otherwise, return the keycode's value (neither OK/ERR).
*/
NCURSES_EXPORT(int)
key_defined(const char *str)
diff --git a/contrib/ncurses/ncurses/base/keyok.c b/contrib/ncurses/ncurses/base/keyok.c
index 4c99506..ad8988c 100644
--- a/contrib/ncurses/ncurses/base/keyok.c
+++ b/contrib/ncurses/ncurses/base/keyok.c
@@ -27,12 +27,12 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey <dickey@clark.net> 1997 *
+ * Author: Thomas E. Dickey 1997-on *
****************************************************************************/
#include <curses.priv.h>
-MODULE_ID("$Id: keyok.c,v 1.6 2006/06/17 18:18:43 tom Exp $")
+MODULE_ID("$Id: keyok.c,v 1.7 2006/12/30 16:22:33 tom Exp $")
/*
* Enable (or disable) ncurses' interpretation of a keycode by adding (or
@@ -57,18 +57,20 @@ keyok(int c, bool flag)
if (flag) {
while ((s = _nc_expand_try(SP->_key_ok, ch, &count, 0)) != 0
&& _nc_remove_key(&(SP->_key_ok), ch)) {
- _nc_add_to_try(&(SP->_keytry), s, ch);
+ code = _nc_add_to_try(&(SP->_keytry), s, ch);
free(s);
- code = OK;
count = 0;
+ if (code != OK)
+ break;
}
} else {
while ((s = _nc_expand_try(SP->_keytry, ch, &count, 0)) != 0
&& _nc_remove_key(&(SP->_keytry), ch)) {
- _nc_add_to_try(&(SP->_key_ok), s, ch);
+ code = _nc_add_to_try(&(SP->_key_ok), s, ch);
free(s);
- code = OK;
count = 0;
+ if (code != OK)
+ break;
}
}
}
diff --git a/contrib/ncurses/ncurses/base/lib_addstr.c b/contrib/ncurses/ncurses/base/lib_addstr.c
index b7a0b40..4e3a040 100644
--- a/contrib/ncurses/ncurses/base/lib_addstr.c
+++ b/contrib/ncurses/ncurses/base/lib_addstr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2004,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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.46 2006/05/27 19:22:19 tom Exp $")
+MODULE_ID("$Id: lib_addstr.c,v 1.48 2007/10/13 19:56:57 tom Exp $")
NCURSES_EXPORT(int)
waddnstr(WINDOW *win, const char *astr, int n)
@@ -80,8 +80,7 @@ waddnstr(WINDOW *win, const char *astr, int n)
NCURSES_EXPORT(int)
waddchnstr(WINDOW *win, const chtype *astr, int n)
{
- NCURSES_SIZE_T y = win->_cury;
- NCURSES_SIZE_T x = win->_curx;
+ NCURSES_SIZE_T y, x;
int code = OK;
int i;
struct ldat *line;
@@ -91,6 +90,8 @@ waddchnstr(WINDOW *win, const chtype *astr, int n)
if (!win)
returnCode(ERR);
+ y = win->_cury;
+ x = win->_curx;
if (n < 0) {
const chtype *str;
n = 0;
@@ -128,8 +129,8 @@ NCURSES_EXPORT(int)
wadd_wchnstr(WINDOW *win, const cchar_t *astr, int n)
{
static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
- NCURSES_SIZE_T y = win->_cury;
- NCURSES_SIZE_T x = win->_curx;
+ NCURSES_SIZE_T y;
+ NCURSES_SIZE_T x;
int code = OK;
struct ldat *line;
int i, j, start, len, end;
@@ -139,6 +140,8 @@ wadd_wchnstr(WINDOW *win, const cchar_t *astr, int n)
if (!win)
returnCode(ERR);
+ y = win->_cury;
+ x = win->_curx;
if (n < 0) {
n = _nc_wchstrlen(astr);
}
diff --git a/contrib/ncurses/ncurses/base/lib_color.c b/contrib/ncurses/ncurses/base/lib_color.c
index a90ca9d..9cae495 100644
--- a/contrib/ncurses/ncurses/base/lib_color.c
+++ b/contrib/ncurses/ncurses/base/lib_color.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,21 +42,37 @@
#include <term.h>
#include <tic.h>
-MODULE_ID("$Id: lib_color.c,v 1.80 2006/11/26 01:33:16 tom Exp $")
+MODULE_ID("$Id: lib_color.c,v 1.85 2007/04/07 17:07:28 tom Exp $")
/*
* These should be screen structure members. They need to be globals for
* historical reasons. So we assign them in start_color() and also in
* set_term()'s screen-switching logic.
*/
+#if USE_REENTRANT
+NCURSES_EXPORT(int)
+NCURSES_PUBLIC_VAR(COLOR_PAIRS) (void)
+{
+ return SP ? SP->_pair_count : -1;
+}
+NCURSES_EXPORT(int)
+NCURSES_PUBLIC_VAR(COLORS) (void)
+{
+ return SP ? SP->_color_count : -1;
+}
+#else
NCURSES_EXPORT_VAR(int) COLOR_PAIRS = 0;
NCURSES_EXPORT_VAR(int) COLORS = 0;
+#endif
#define DATA(r,g,b) {r,g,b, 0,0,0, 0}
#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts))
+#define MAX_PALETTE 8
+
#define OkColorHi(n) (((n) < COLORS) && ((n) < max_colors))
+#define InPalette(n) ((n) >= 0 && (n) < MAX_PALETTE)
/*
* Given a RGB range of 0..1000, we'll normally set the individual values
@@ -162,10 +178,10 @@ init_color_table(void)
tp = (hue_lightness_saturation) ? hls_palette : cga_palette;
for (n = 0; n < COLORS; n++) {
- if (n < 8) {
+ if (InPalette(n)) {
SP->_color_table[n] = tp[n];
} else {
- SP->_color_table[n] = tp[n % 8];
+ SP->_color_table[n] = tp[n % MAX_PALETTE];
if (hue_lightness_saturation) {
SP->_color_table[n].green = 100;
} else {
@@ -239,8 +255,12 @@ start_color(void)
}
if (max_pairs > 0 && max_colors > 0) {
- COLOR_PAIRS = SP->_pair_count = max_pairs;
- COLORS = SP->_color_count = max_colors;
+ SP->_pair_count = max_pairs;
+ SP->_color_count = max_colors;
+#if !USE_REENTRANT
+ COLOR_PAIRS = max_pairs;
+ COLORS = max_colors;
+#endif
if ((SP->_color_pairs = TYPE_CALLOC(colorpair_t,
max_pairs)) != 0) {
@@ -365,13 +385,14 @@ init_pair(short pair, short f, short b)
if (GET_SCREEN_PAIR(SP) == pair)
SET_SCREEN_PAIR(SP, (chtype) (~0)); /* force attribute update */
- if (initialize_pair) {
+ if (initialize_pair && InPalette(f) && InPalette(b)) {
const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette;
- T(("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)",
- pair,
- tp[f].red, tp[f].green, tp[f].blue,
- tp[b].red, tp[b].green, tp[b].blue));
+ TR(TRACE_ATTRS,
+ ("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)",
+ pair,
+ tp[f].red, tp[f].green, tp[f].blue,
+ tp[b].red, tp[b].green, tp[b].blue));
TPUTS_TRACE("initialize_pair");
putp(TPARM_7(initialize_pair,
@@ -461,7 +482,8 @@ color_content(short color, short *r, short *g, short *b)
if (b)
*b = c_b;
- T(("...color_content(%d,%d,%d,%d)", color, c_r, c_g, c_b));
+ TR(TRACE_ATTRS, ("...color_content(%d,%d,%d,%d)",
+ color, c_r, c_g, c_b));
result = OK;
}
returnCode(result);
@@ -492,7 +514,7 @@ pair_content(short pair, short *f, short *b)
if (b)
*b = bg;
- T(("...pair_content(%d,%d,%d)", pair, fg, bg));
+ TR(TRACE_ATTRS, ("...pair_content(%d,%d,%d)", pair, fg, bg));
result = OK;
}
returnCode(result);
diff --git a/contrib/ncurses/ncurses/base/lib_delwin.c b/contrib/ncurses/ncurses/base/lib_delwin.c
index 89d8e7c3..fc68f9d 100644
--- a/contrib/ncurses/ncurses/base/lib_delwin.c
+++ b/contrib/ncurses/ncurses/base/lib_delwin.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2001,2007 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_delwin.c,v 1.13 2001/08/26 00:40:20 tom Exp $")
+MODULE_ID("$Id: lib_delwin.c,v 1.15 2007/12/22 23:34:26 tom Exp $")
static bool
cannot_delete(WINDOW *win)
@@ -63,16 +63,27 @@ cannot_delete(WINDOW *win)
NCURSES_EXPORT(int)
delwin(WINDOW *win)
{
+ int result = ERR;
+
T((T_CALLED("delwin(%p)"), win));
- if (win == 0
- || cannot_delete(win))
- returnCode(ERR);
+ if (_nc_try_global(windowlist) == 0) {
+ _nc_lock_window(win);
+ if (win == 0
+ || cannot_delete(win)) {
+ result = ERR;
+ _nc_unlock_window(win);
+ } else {
- if (win->_flags & _SUBWIN)
- touchwin(win->_parent);
- else if (curscr != 0)
- touchwin(curscr);
+ if (win->_flags & _SUBWIN)
+ touchwin(win->_parent);
+ else if (curscr != 0)
+ touchwin(curscr);
- returnCode(_nc_freewin(win));
+ _nc_unlock_window(win);
+ result = _nc_freewin(win);
+ }
+ _nc_unlock_global(windowlist);
+ }
+ returnCode(result);
}
diff --git a/contrib/ncurses/ncurses/base/lib_freeall.c b/contrib/ncurses/ncurses/base/lib_freeall.c
index 27897a9..dbf0483 100644
--- a/contrib/ncurses/ncurses/base/lib_freeall.c
+++ b/contrib/ncurses/ncurses/base/lib_freeall.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,1997 *
+ * Author: Thomas E. Dickey 1996-on *
****************************************************************************/
#include <curses.priv.h>
@@ -40,7 +40,7 @@
extern int malloc_errfd; /* FIXME */
#endif
-MODULE_ID("$Id: lib_freeall.c,v 1.38 2006/12/02 22:36:43 tom Exp $")
+MODULE_ID("$Id: lib_freeall.c,v 1.45 2007/12/22 23:29:37 tom Exp $")
/*
* Free all ncurses data. This is used for testing only (there's no practical
@@ -50,18 +50,22 @@ NCURSES_EXPORT(void)
_nc_freeall(void)
{
WINDOWLIST *p, *q;
- char *s;
static va_list empty_va;
T((T_CALLED("_nc_freeall()")));
#if NO_LEAKS
- _nc_free_tparm();
- if (_nc_oldnums != 0) {
- FreeAndNull(_nc_oldnums);
+ if (SP != 0) {
+ if (SP->_oldnum_list != 0) {
+ FreeAndNull(SP->_oldnum_list);
+ }
}
#endif
if (SP != 0) {
+ _nc_lock_global(windowlist);
+
while (_nc_windows != 0) {
+ bool deleted = FALSE;
+
/* Delete only windows that're not a parent */
for (p = _nc_windows; p != 0; p = p->next) {
bool found = FALSE;
@@ -76,39 +80,38 @@ _nc_freeall(void)
}
if (!found) {
- delwin(&(p->win));
+ if (delwin(&(p->win)) != ERR)
+ deleted = TRUE;
break;
}
}
+
+ /*
+ * Don't continue to loop if the list is trashed.
+ */
+ if (!deleted)
+ break;
}
delscreen(SP);
+ _nc_unlock_global(windowlist);
}
-#if NO_LEAKS
- _nc_tgetent_leaks();
-#endif
- del_curterm(cur_term);
- _nc_free_entries(_nc_head);
- _nc_get_type(0);
- _nc_first_name(0);
+ if (cur_term != 0)
+ del_curterm(cur_term);
+
#if USE_WIDEC_SUPPORT
FreeIfNeeded(_nc_wacs);
#endif
-#if NO_LEAKS
- _nc_alloc_entry_leaks();
- _nc_captoinfo_leaks();
- _nc_comp_scan_leaks();
- _nc_keyname_leaks();
- _nc_tic_expand(0, FALSE, 0);
-#endif
-
- if ((s = _nc_home_terminfo()) != 0)
- free(s);
-
(void) _nc_printf_string(0, empty_va);
#ifdef TRACE
(void) _nc_trace_buf(-1, 0);
#endif
+#if BROKEN_LINKER || USE_REENTRANT
+ FreeIfNeeded(_nc_prescreen.real_acs_map);
+#endif
+
+ _nc_leaks_tinfo();
+
#if HAVE_LIBDBMALLOC
malloc_dump(malloc_errfd);
#elif HAVE_LIBDMALLOC
diff --git a/contrib/ncurses/ncurses/base/lib_getch.c b/contrib/ncurses/ncurses/base/lib_getch.c
index 7891edf..64566cc 100644
--- a/contrib/ncurses/ncurses/base/lib_getch.c
+++ b/contrib/ncurses/ncurses/base/lib_getch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,12 +41,20 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_getch.c,v 1.75 2006/03/04 20:06:09 tom Exp $")
+MODULE_ID("$Id: lib_getch.c,v 1.80 2007/09/29 20:39:34 tom Exp $")
#include <fifo_defs.h>
+#if USE_REENTRANT
+NCURSES_EXPORT(int)
+NCURSES_PUBLIC_VAR(ESCDELAY) (void)
+{
+ return SP ? SP->_ESCDELAY : 1000;
+}
+#else
NCURSES_EXPORT_VAR(int)
ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */
+#endif
#ifdef NCURSES_WGETCH_EVENTS
#define TWAIT_MASK 7
@@ -104,8 +112,10 @@ fifo_pull(void)
h_inc();
#ifdef TRACE
- if (_nc_tracing & TRACE_IEVENT)
+ if (USE_TRACEF(TRACE_IEVENT)) {
_nc_fifo_dump();
+ _nc_unlock_global(tracef);
+ }
#endif
return ch;
}
@@ -200,8 +210,10 @@ fifo_push(EVENTLIST_0th(_nc_eventlist * evl))
t_inc();
TR(TRACE_IEVENT, ("pushed %s at %d", _tracechar(ch), tail));
#ifdef TRACE
- if (_nc_tracing & TRACE_IEVENT)
+ if (USE_TRACEF(TRACE_IEVENT)) {
_nc_fifo_dump();
+ _nc_unlock_global(tracef);
+ }
#endif
return ch;
}
@@ -234,15 +246,16 @@ _nc_wgetch(WINDOW *win,
T((T_CALLED("_nc_wgetch(%p)"), win));
*result = 0;
- if (win == 0 || SP == 0)
+ if (win == 0 || SP == 0) {
returnCode(ERR);
+ }
if (cooked_key_in_fifo()) {
if (wgetch_should_refresh(win))
wrefresh(win);
*result = fifo_pull();
- returnCode(OK);
+ returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
}
#ifdef NCURSES_WGETCH_EVENTS
if (evl && (evl->count == 0))
@@ -281,12 +294,10 @@ _nc_wgetch(WINDOW *win,
/* Return it first */
if (rc == KEY_EVENT) {
*result = rc;
- returnCode(OK);
- }
+ } else
#endif
-
- *result = fifo_pull();
- returnCode(OK);
+ *result = fifo_pull();
+ returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
}
if (win->_use_keypad != SP->_keypad_on)
@@ -318,7 +329,7 @@ _nc_wgetch(WINDOW *win,
#ifdef NCURSES_WGETCH_EVENTS
if (rc & 4) {
*result = KEY_EVENT;
- returnCode(OK);
+ returnCode(KEY_CODE_YES);
}
#endif
if (!rc)
@@ -384,7 +395,7 @@ _nc_wgetch(WINDOW *win,
if (ch == ERR) {
#if USE_SIZECHANGE
- if (SP->_sig_winch) {
+ if (_nc_handle_sigwinch(FALSE)) {
_nc_update_screensize();
/* resizeterm can push KEY_RESIZE */
if (cooked_key_in_fifo()) {
@@ -493,7 +504,7 @@ wgetch(WINDOW *win)
static int
kgetch(EVENTLIST_0th(_nc_eventlist * evl))
{
- struct tries *ptr;
+ TRIES *ptr;
int ch = 0;
int timeleft = ESCDELAY;
diff --git a/contrib/ncurses/ncurses/base/lib_initscr.c b/contrib/ncurses/ncurses/base/lib_initscr.c
index d2ae281..3874473 100644
--- a/contrib/ncurses/ncurses/base/lib_initscr.c
+++ b/contrib/ncurses/ncurses/base/lib_initscr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2007 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,19 +45,18 @@
#include <sys/termio.h> /* needed for ISC */
#endif
-MODULE_ID("$Id: lib_initscr.c,v 1.34 2005/10/22 20:30:38 tom Exp $")
+MODULE_ID("$Id: lib_initscr.c,v 1.35 2007/04/21 20:43:02 tom Exp $")
NCURSES_EXPORT(WINDOW *)
initscr(void)
{
- static bool initialized = FALSE;
NCURSES_CONST char *name;
START_TRACE();
T((T_CALLED("initscr()")));
/* Portable applications must not call initscr() more than once */
- if (!initialized) {
- initialized = TRUE;
+ if (!_nc_globals.init_screen) {
+ _nc_globals.init_screen = TRUE;
if ((name = getenv("TERM")) == 0
|| *name == '\0')
diff --git a/contrib/ncurses/ncurses/base/lib_instr.c b/contrib/ncurses/ncurses/base/lib_instr.c
index 809952f..3fb2949 100644
--- a/contrib/ncurses/ncurses/base/lib_instr.c
+++ b/contrib/ncurses/ncurses/base/lib_instr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2007 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_instr.c,v 1.15 2005/11/20 01:38:03 tom Exp $")
+MODULE_ID("$Id: lib_instr.c,v 1.16 2007/07/21 20:18:10 tom Exp $")
NCURSES_EXPORT(int)
winnstr(WINDOW *win, char *str, int n)
@@ -81,7 +81,7 @@ winnstr(WINDOW *win, char *str, int n)
n3 = wcstombs(0, wch, 0);
if (isEILSEQ(n3) || (n3 == 0)) {
;
- } else if ((int) (n3 + i) >= n) {
+ } else if ((int) (n3 + i) > n) {
done = TRUE;
} else if ((tmp = typeCalloc(char, n3 + 10)) == 0) {
done = TRUE;
@@ -102,9 +102,7 @@ winnstr(WINDOW *win, char *str, int n)
str[i++] = (char) CharOf(win->_line[row].text[col]);
#endif
if (++col > win->_maxx) {
- col = 0;
- if (++row > win->_maxy)
- break;
+ break;
}
}
}
diff --git a/contrib/ncurses/ncurses/base/lib_mouse.c b/contrib/ncurses/ncurses/base/lib_mouse.c
index f302327..aace7de 100644
--- a/contrib/ncurses/ncurses/base/lib_mouse.c
+++ b/contrib/ncurses/ncurses/base/lib_mouse.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 *
@@ -79,7 +79,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_mouse.c,v 1.85 2006/11/25 22:30:28 tom Exp $")
+MODULE_ID("$Id: lib_mouse.c,v 1.88 2007/09/29 21:50:04 tom Exp $")
#include <term.h>
#include <tic.h>
@@ -403,11 +403,11 @@ enable_gpm_mouse(int enable)
}
#endif /* USE_GPM_SUPPORT */
+#define xterm_kmous "\033[M"
+
static void
initialize_mousetype(void)
{
- static const char *xterm_kmous = "\033[M";
-
T((T_CALLED("initialize_mousetype()")));
/* Try gpm first, because gpm may be configured to run in xterm */
@@ -565,8 +565,8 @@ initialize_mousetype(void)
init_xterm_mouse();
}
} else if (strstr(cur_term->type.term_names, "xterm") != 0) {
- (void) _nc_add_to_try(&(SP->_keytry), xterm_kmous, KEY_MOUSE);
- init_xterm_mouse();
+ if (_nc_add_to_try(&(SP->_keytry), xterm_kmous, KEY_MOUSE) == OK)
+ init_xterm_mouse();
}
returnVoid;
}
@@ -985,12 +985,13 @@ _nc_mouse_parse(int runcount)
}
#ifdef TRACE
- if (_nc_tracing & TRACE_IEVENT) {
+ if (USE_TRACEF(TRACE_IEVENT)) {
_trace_slot("before mouse press/release merge:");
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
(long) (runp - SP->_mouse_events),
(long) ((eventp - SP->_mouse_events) + (EV_MAX - 1)) % EV_MAX,
runcount);
+ _nc_unlock_global(tracef);
}
#endif /* TRACE */
@@ -1028,12 +1029,13 @@ _nc_mouse_parse(int runcount)
(merge);
#ifdef TRACE
- if (_nc_tracing & TRACE_IEVENT) {
+ if (USE_TRACEF(TRACE_IEVENT)) {
_trace_slot("before mouse click merge:");
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
(long) (runp - SP->_mouse_events),
(long) ((eventp - SP->_mouse_events) + (EV_MAX - 1)) % EV_MAX,
runcount);
+ _nc_unlock_global(tracef);
}
#endif /* TRACE */
@@ -1099,12 +1101,13 @@ _nc_mouse_parse(int runcount)
(merge);
#ifdef TRACE
- if (_nc_tracing & TRACE_IEVENT) {
+ if (USE_TRACEF(TRACE_IEVENT)) {
_trace_slot("before mouse event queue compaction:");
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
(long) (runp - SP->_mouse_events),
(long) ((eventp - SP->_mouse_events) + (EV_MAX - 1)) % EV_MAX,
runcount);
+ _nc_unlock_global(tracef);
}
#endif /* TRACE */
@@ -1117,12 +1120,13 @@ _nc_mouse_parse(int runcount)
SP->_mouse_eventp = eventp = prev;
}
#ifdef TRACE
- if (_nc_tracing & TRACE_IEVENT) {
+ if (USE_TRACEF(TRACE_IEVENT)) {
_trace_slot("after mouse event queue compaction:");
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
(long) (runp - SP->_mouse_events),
(long) ((eventp - SP->_mouse_events) + (EV_MAX - 1)) % EV_MAX,
runcount);
+ _nc_unlock_global(tracef);
}
for (ep = runp; ep != eventp; ep = NEXT(ep))
if (ep->id != INVALID_EVENT)
diff --git a/contrib/ncurses/ncurses/base/lib_newterm.c b/contrib/ncurses/ncurses/base/lib_newterm.c
index fe201d6..05cd9b8 100644
--- a/contrib/ncurses/ncurses/base/lib_newterm.c
+++ b/contrib/ncurses/ncurses/base/lib_newterm.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 <term.h> /* clear_screen, cup & friends, cur_term */
#include <tic.h>
-MODULE_ID("$Id: lib_newterm.c,v 1.64 2006/01/14 15:36:24 tom Exp $")
+MODULE_ID("$Id: lib_newterm.c,v 1.67 2007/04/21 20:47:32 tom Exp $")
#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */
#define ONLCR 0
@@ -94,14 +94,12 @@ _nc_initscr(void)
* aside from possibly delaying a filter() call until some terminals have been
* initialized.
*/
-static bool filter_mode = FALSE;
-
NCURSES_EXPORT(void)
filter(void)
{
START_TRACE();
T((T_CALLED("filter")));
- filter_mode = TRUE;
+ _nc_prescreen.filter_mode = TRUE;
returnVoid;
}
@@ -115,7 +113,7 @@ nofilter(void)
{
START_TRACE();
T((T_CALLED("nofilter")));
- filter_mode = FALSE;
+ _nc_prescreen.filter_mode = FALSE;
returnVoid;
}
#endif
@@ -132,13 +130,6 @@ newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
START_TRACE();
T((T_CALLED("newterm(\"%s\",%p,%p)"), name, ofp, ifp));
- _nc_handle_sigwinch(0);
-
- /* allow user to set maximum escape delay from the environment */
- if ((value = _nc_getenv_num("ESCDELAY")) >= 0) {
- ESCDELAY = value;
- }
-
/* this loads the capability entry, then sets LINES and COLS */
if (setupterm(name, fileno(ofp), &errret) == ERR) {
result = 0;
@@ -149,7 +140,21 @@ newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
*/
current = SP;
_nc_set_screen(0);
- if (_nc_setupscreen(LINES, COLS, ofp, filter_mode, slk_format) == ERR) {
+
+ /* allow user to set maximum escape delay from the environment */
+ if ((value = _nc_getenv_num("ESCDELAY")) >= 0) {
+#if USE_REENTRANT
+ SP->_ESCDELAY = value;
+#else
+ ESCDELAY = value;
+#endif
+ }
+
+ if (_nc_setupscreen(LINES,
+ COLS,
+ ofp,
+ _nc_prescreen.filter_mode,
+ slk_format) == ERR) {
_nc_set_screen(current);
result = 0;
} else {
@@ -211,6 +216,5 @@ newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
result = SP;
}
}
- _nc_handle_sigwinch(1);
returnSP(result);
}
diff --git a/contrib/ncurses/ncurses/base/lib_newwin.c b/contrib/ncurses/ncurses/base/lib_newwin.c
index ba51633..b0f4603 100644
--- a/contrib/ncurses/ncurses/base/lib_newwin.c
+++ b/contrib/ncurses/ncurses/base/lib_newwin.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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_newwin.c,v 1.38 2006/10/14 20:31:19 tom Exp $")
+MODULE_ID("$Id: lib_newwin.c,v 1.42 2007/12/22 23:20:18 tom Exp $")
static WINDOW *
remove_window_from_screen(WINDOW *win)
@@ -52,16 +52,22 @@ remove_window_from_screen(WINDOW *win)
SCREEN *sp = *scan;
if (sp->_curscr == win) {
sp->_curscr = 0;
+#if !USE_REENTRANT
if (win == curscr)
curscr = 0;
+#endif
} else if (sp->_stdscr == win) {
sp->_stdscr = 0;
+#if !USE_REENTRANT
if (win == stdscr)
stdscr = 0;
+#endif
} else if (sp->_newscr == win) {
sp->_newscr = 0;
+#if !USE_REENTRANT
if (win == newscr)
newscr = 0;
+#endif
} else {
scan = &(*scan)->_next_screen;
continue;
@@ -79,29 +85,34 @@ _nc_freewin(WINDOW *win)
int i;
int result = ERR;
+ T((T_CALLED("_nc_freewin(%p)"), win));
+
if (win != 0) {
- for (p = _nc_windows, q = 0; p != 0; q = p, p = p->next) {
- if (&(p->win) == win) {
- remove_window_from_screen(win);
- if (q == 0)
- _nc_windows = p->next;
- else
- q->next = p->next;
-
- if (!(win->_flags & _SUBWIN)) {
- for (i = 0; i <= win->_maxy; i++)
- FreeIfNeeded(win->_line[i].text);
+ if (_nc_try_global(windowlist) == 0) {
+ for (p = _nc_windows, q = 0; p != 0; q = p, p = p->next) {
+ if (&(p->win) == win) {
+ remove_window_from_screen(win);
+ if (q == 0)
+ _nc_windows = p->next;
+ else
+ q->next = p->next;
+
+ if (!(win->_flags & _SUBWIN)) {
+ for (i = 0; i <= win->_maxy; i++)
+ FreeIfNeeded(win->_line[i].text);
+ }
+ free(win->_line);
+ free(p);
+
+ result = OK;
+ T(("...deleted win=%p", win));
+ break;
}
- free(win->_line);
- free(p);
-
- result = OK;
- T(("...deleted win=%p", win));
- break;
}
+ _nc_unlock_global(windowlist);
}
}
- return result;
+ returnCode(result);
}
NCURSES_EXPORT(WINDOW *)
@@ -208,24 +219,35 @@ _nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags)
WINDOW *win;
bool is_pad = (flags & _ISPAD);
- T(("_nc_makenew(%d,%d,%d,%d)", num_lines, num_columns, begy, begx));
+ T((T_CALLED("_nc_makenew(%d,%d,%d,%d)"), num_lines, num_columns, begy, begx));
if (SP == 0)
- return 0;
+ returnWin(0);
if (!dimension_limit(num_lines) || !dimension_limit(num_columns))
- return 0;
+ returnWin(0);
if ((wp = typeCalloc(WINDOWLIST, 1)) == 0)
- return 0;
+ returnWin(0);
+
+#ifdef USE_PTHREADS
+ {
+ pthread_mutexattr_t recattr;
+ memset(&recattr, 0, sizeof(recattr));
+ pthread_mutexattr_settype(&recattr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&(wp->mutex_use_window), &recattr);
+ }
+#endif
win = &(wp->win);
if ((win->_line = typeCalloc(struct ldat, ((unsigned) num_lines))) == 0) {
free(win);
- return 0;
+ returnWin(0);
}
+ _nc_lock_global(windowlist);
+
win->_curx = 0;
win->_cury = 0;
win->_maxy = num_lines - 1;
@@ -303,5 +325,6 @@ _nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags)
T((T_CREATE("window %p"), win));
- return (win);
+ _nc_unlock_global(windowlist);
+ returnWin(win);
}
diff --git a/contrib/ncurses/ncurses/base/lib_overlay.c b/contrib/ncurses/ncurses/base/lib_overlay.c
index 9ecc458..22bd2f8 100644
--- a/contrib/ncurses/ncurses/base/lib_overlay.c
+++ b/contrib/ncurses/ncurses/base/lib_overlay.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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_overlay.c,v 1.22 2006/10/14 20:43:31 tom Exp $")
+MODULE_ID("$Id: lib_overlay.c,v 1.23 2007/04/07 17:13:52 tom Exp $")
static int
overlap(const WINDOW *const s, WINDOW *const d, int const flag)
@@ -139,8 +139,8 @@ copywin(const WINDOW *src, WINDOW *dst,
{
int sx, sy, dx, dy;
bool touched;
- attr_t bk = AttrOf(dst->_nc_bkgd);
- attr_t mask = ~(attr_t) ((bk & A_COLOR) ? A_COLOR : 0);
+ attr_t bk;
+ attr_t mask;
T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"),
src, dst, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, over));
@@ -148,6 +148,9 @@ copywin(const WINDOW *src, WINDOW *dst,
if (!src || !dst)
returnCode(ERR);
+ bk = AttrOf(dst->_nc_bkgd);
+ mask = ~(attr_t) ((bk & A_COLOR) ? A_COLOR : 0);
+
/* make sure rectangle exists in source */
if ((sminrow + dmaxrow - dminrow) > (src->_maxy + 1) ||
(smincol + dmaxcol - dmincol) > (src->_maxx + 1)) {
diff --git a/contrib/ncurses/ncurses/base/lib_redrawln.c b/contrib/ncurses/ncurses/base/lib_redrawln.c
index 548ca97..6b0905f 100644
--- a/contrib/ncurses/ncurses/base/lib_redrawln.c
+++ b/contrib/ncurses/ncurses/base/lib_redrawln.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2001,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,17 +39,20 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_redrawln.c,v 1.11 2006/11/04 23:08:47 tom Exp $")
+MODULE_ID("$Id: lib_redrawln.c,v 1.12 2007/10/13 20:08:56 tom Exp $")
NCURSES_EXPORT(int)
wredrawln(WINDOW *win, int beg, int num)
{
int i;
int end;
- size_t len = (win->_maxx + 1);
+ size_t len;
T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num));
+ if (win == 0)
+ returnCode(ERR);
+
if (beg < 0)
beg = 0;
@@ -65,6 +68,7 @@ wredrawln(WINDOW *win, int beg, int num)
if (end > win->_maxy + 1)
end = win->_maxy + 1;
+ len = (win->_maxx + 1);
if (len > (size_t) (curscr->_maxx + 1))
len = (size_t) (curscr->_maxx + 1);
len *= sizeof(curscr->_line[0].text[0]);
diff --git a/contrib/ncurses/ncurses/base/lib_refresh.c b/contrib/ncurses/ncurses/base/lib_refresh.c
index 27649df..2a9cafb 100644
--- a/contrib/ncurses/ncurses/base/lib_refresh.c
+++ b/contrib/ncurses/ncurses/base/lib_refresh.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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_refresh.c,v 1.34 2006/05/27 19:21:19 tom Exp $")
+MODULE_ID("$Id: lib_refresh.c,v 1.41 2007/09/29 20:39:34 tom Exp $")
NCURSES_EXPORT(int)
wrefresh(WINDOW *win)
@@ -74,18 +74,20 @@ NCURSES_EXPORT(int)
wnoutrefresh(WINDOW *win)
{
NCURSES_SIZE_T limit_x;
- NCURSES_SIZE_T i, j;
+ NCURSES_SIZE_T src_row, src_col;
NCURSES_SIZE_T begx;
NCURSES_SIZE_T begy;
- NCURSES_SIZE_T m, n;
+ NCURSES_SIZE_T dst_row, dst_col;
#if USE_SCROLL_HINTS
bool wide;
#endif
T((T_CALLED("wnoutrefresh(%p)"), win));
#ifdef TRACE
- if (_nc_tracing & TRACE_UPDATE)
+ if (USE_TRACEF(TRACE_UPDATE)) {
_tracedump("...win", win);
+ _nc_unlock_global(tracef);
+ }
#endif /* TRACE */
/*
@@ -132,28 +134,121 @@ wnoutrefresh(WINDOW *win)
* so we'll force the issue.
*/
- /* limit(n) */
+ /* limit(dst_col) */
limit_x = win->_maxx;
- /* limit(j) */
+ /* limit(src_col) */
if (limit_x > newscr->_maxx - begx)
limit_x = newscr->_maxx - begx;
- for (i = 0, m = begy + win->_yoffset;
- i <= win->_maxy && m <= newscr->_maxy;
- i++, m++) {
- register struct ldat *nline = &newscr->_line[m];
- register struct ldat *oline = &win->_line[i];
+ for (src_row = 0, dst_row = begy + win->_yoffset;
+ src_row <= win->_maxy && dst_row <= newscr->_maxy;
+ src_row++, dst_row++) {
+ register struct ldat *nline = &newscr->_line[dst_row];
+ register struct ldat *oline = &win->_line[src_row];
if (oline->firstchar != _NOCHANGE) {
- int last = oline->lastchar;
+ int last_src = oline->lastchar;
+
+ if (last_src > limit_x)
+ last_src = limit_x;
+
+ src_col = oline->firstchar;
+ dst_col = src_col + begx;
+
+ if_WIDEC({
+ register int j;
+
+ /*
+ * Ensure that we will copy complete multi-column characters
+ * on the left-boundary.
+ */
+ if (isWidecExt(oline->text[src_col])) {
+ j = 1 + dst_col - WidecExt(oline->text[src_col]);
+ if (j < 0)
+ j = 0;
+ if (dst_col > j) {
+ src_col -= (dst_col - j);
+ dst_col = j;
+ }
+ }
+
+ /*
+ * Ensure that we will copy complete multi-column characters
+ * on the right-boundary.
+ */
+ j = last_src;
+ if (WidecExt(oline->text[j])) {
+ ++j;
+ while (j <= limit_x) {
+ if (isWidecBase(oline->text[j])) {
+ break;
+ } else {
+ last_src = j;
+ }
+ ++j;
+ }
+ }
+ });
- if (last > limit_x)
- last = limit_x;
+ if_WIDEC({
+ static cchar_t blank = BLANK;
+ int last_dst = begx + ((last_src < win->_maxx)
+ ? last_src
+ : win->_maxx);
+ int fix_left = dst_col;
+ int fix_right = last_dst;
+ register int j;
- for (j = oline->firstchar, n = j + begx; j <= last; j++, n++) {
- if (!CharEq(oline->text[j], nline->text[n])) {
- nline->text[n] = oline->text[j];
- CHANGED_CELL(nline, n);
+ /*
+ * Check for boundary cases where we may overwrite part of a
+ * multi-column character. For those, wipe the remainder of
+ * the character to blanks.
+ */
+ j = dst_col;
+ if (isWidecExt(nline->text[j])) {
+ /*
+ * On the left, we only care about multi-column characters
+ * that extend into the changed region.
+ */
+ fix_left = 1 + j - WidecExt(nline->text[j]);
+ if (fix_left < 0)
+ fix_left = 0; /* only if cell is corrupt */
+ }
+
+ j = last_dst;
+ if (WidecExt(nline->text[j]) != 0) {
+ /*
+ * On the right, any multi-column character is a problem,
+ * unless it happens to be contained in the change, and
+ * ending at the right boundary of the change. The
+ * computation for 'fix_left' accounts for the left-side of
+ * this character. Find the end of the character.
+ */
+ ++j;
+ while (j <= newscr->_maxx && isWidecExt(nline->text[j])) {
+ fix_right = j++;
+ }
+ }
+
+ /*
+ * The analysis is simpler if we do the clearing afterwards.
+ * Do that now.
+ */
+ if (fix_left < dst_col || fix_right > last_dst) {
+ for (j = fix_left; j <= fix_right; ++j) {
+ nline->text[j] = blank;
+ CHANGED_CELL(nline, j);
+ }
+ }
+ });
+
+ /*
+ * Copy the changed text.
+ */
+ for (; src_col <= last_src; src_col++, dst_col++) {
+ if (!CharEq(oline->text[src_col], nline->text[dst_col])) {
+ nline->text[dst_col] = oline->text[src_col];
+ CHANGED_CELL(nline, dst_col);
}
}
@@ -162,13 +257,14 @@ wnoutrefresh(WINDOW *win)
if (wide) {
int oind = oline->oldindex;
- nline->oldindex = (oind == _NEWINDEX) ? _NEWINDEX : begy + oind
- + win->_yoffset;
+ nline->oldindex = ((oind == _NEWINDEX)
+ ? _NEWINDEX
+ : (begy + oind + win->_yoffset));
}
#endif /* USE_SCROLL_HINTS */
oline->firstchar = oline->lastchar = _NOCHANGE;
- if_USE_SCROLL_HINTS(oline->oldindex = i);
+ if_USE_SCROLL_HINTS(oline->oldindex = src_row);
}
if (win->_clear) {
@@ -183,8 +279,10 @@ wnoutrefresh(WINDOW *win)
newscr->_leaveok = win->_leaveok;
#ifdef TRACE
- if (_nc_tracing & TRACE_UPDATE)
+ if (USE_TRACEF(TRACE_UPDATE)) {
_tracedump("newscr", newscr);
+ _nc_unlock_global(tracef);
+ }
#endif /* TRACE */
returnCode(OK);
}
diff --git a/contrib/ncurses/ncurses/base/lib_restart.c b/contrib/ncurses/ncurses/base/lib_restart.c
index ca27a0f..858ef65 100644
--- a/contrib/ncurses/ncurses/base/lib_restart.c
+++ b/contrib/ncurses/ncurses/base/lib_restart.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,23 +48,22 @@
#include <term.h> /* lines, columns, cur_term */
-MODULE_ID("$Id: lib_restart.c,v 1.6 2006/01/14 15:58:23 tom Exp $")
+MODULE_ID("$Id: lib_restart.c,v 1.8 2007/10/13 19:59:47 tom Exp $")
NCURSES_EXPORT(int)
restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
{
- int saveecho = SP->_echo;
- int savecbreak = SP->_cbreak;
- int saveraw = SP->_raw;
- int savenl = SP->_nl;
int result;
T((T_CALLED("restartterm(%s,%d,%p)"), termp, filenum, errret));
- _nc_handle_sigwinch(0);
if (setupterm(termp, filenum, errret) != OK) {
result = ERR;
- } else {
+ } else if (SP != 0) {
+ int saveecho = SP->_echo;
+ int savecbreak = SP->_cbreak;
+ int saveraw = SP->_raw;
+ int savenl = SP->_nl;
if (saveecho)
echo();
@@ -93,7 +92,8 @@ restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
#endif
result = OK;
+ } else {
+ result = ERR;
}
- _nc_handle_sigwinch(1);
returnCode(result);
}
diff --git a/contrib/ncurses/ncurses/base/lib_screen.c b/contrib/ncurses/ncurses/base/lib_screen.c
index 5d67e19..e6aecbd 100644
--- a/contrib/ncurses/ncurses/base/lib_screen.c
+++ b/contrib/ncurses/ncurses/base/lib_screen.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_screen.c,v 1.29 2006/05/27 19:21:38 tom Exp $")
+MODULE_ID("$Id: lib_screen.c,v 1.30 2007/03/10 23:20:41 tom Exp $")
NCURSES_EXPORT(WINDOW *)
getwin(FILE *filep)
@@ -146,7 +146,10 @@ scr_restore(const char *file)
returnCode(ERR);
} else {
delwin(newscr);
- SP->_newscr = newscr = getwin(fp);
+ SP->_newscr = getwin(fp);
+#if !USE_REENTRANT
+ newscr = SP->_newscr;
+#endif
(void) fclose(fp);
returnCode(OK);
}
@@ -184,7 +187,10 @@ scr_init(const char *file)
returnCode(ERR);
} else {
delwin(curscr);
- SP->_curscr = curscr = getwin(fp);
+ SP->_curscr = getwin(fp);
+#if !USE_REENTRANT
+ curscr = SP->_curscr;
+#endif
(void) fclose(fp);
returnCode(OK);
}
@@ -199,7 +205,10 @@ scr_set(const char *file)
returnCode(ERR);
} else {
delwin(newscr);
- SP->_newscr = newscr = dupwin(curscr);
+ SP->_newscr = dupwin(curscr);
+#if !USE_REENTRANT
+ newscr = SP->_newscr;
+#endif
returnCode(OK);
}
}
diff --git a/contrib/ncurses/ncurses/base/lib_set_term.c b/contrib/ncurses/ncurses/base/lib_set_term.c
index bcc42d1..2b1387a 100644
--- a/contrib/ncurses/ncurses/base/lib_set_term.c
+++ b/contrib/ncurses/ncurses/base/lib_set_term.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 <term.h> /* cur_term */
#include <tic.h>
-MODULE_ID("$Id: lib_set_term.c,v 1.91 2006/05/20 14:58:02 tom Exp $")
+MODULE_ID("$Id: lib_set_term.c,v 1.100 2007/09/08 21:23:43 tom Exp $")
NCURSES_EXPORT(SCREEN *)
set_term(SCREEN *screenp)
@@ -53,22 +53,28 @@ set_term(SCREEN *screenp)
T((T_CALLED("set_term(%p)"), screenp));
+ _nc_lock_global(set_SP);
+
oldSP = SP;
_nc_set_screen(screenp);
set_curterm(SP->_term);
+#if !USE_REENTRANT
curscr = SP->_curscr;
newscr = SP->_newscr;
stdscr = SP->_stdscr;
COLORS = SP->_color_count;
COLOR_PAIRS = SP->_pair_count;
+#endif
+
+ _nc_unlock_global(set_SP);
T((T_RETURN("%p"), oldSP));
return (oldSP);
}
static void
-_nc_free_keytry(struct tries *kt)
+_nc_free_keytry(TRIES * kt)
{
if (kt != 0) {
_nc_free_keytry(kt->child);
@@ -88,6 +94,7 @@ delscreen(SCREEN *sp)
T((T_CALLED("delscreen(%p)"), sp));
+ _nc_lock_global(set_SP);
while (*scan) {
if (*scan == sp) {
*scan = sp->_next_screen;
@@ -152,20 +159,20 @@ delscreen(SCREEN *sp)
* multiple references in different screens).
*/
if (sp == SP) {
+#if !USE_REENTRANT
curscr = 0;
newscr = 0;
stdscr = 0;
COLORS = 0;
COLOR_PAIRS = 0;
+#endif
_nc_set_screen(0);
}
+ _nc_unlock_global(set_SP);
+
returnVoid;
}
-static ripoff_t rippedoff[5];
-static ripoff_t *rsp = rippedoff;
-#define N_RIPS SIZEOF(SP->_rippedoff)
-
static bool
no_mouse_event(SCREEN *sp GCC_UNUSED)
{
@@ -214,17 +221,20 @@ extract_fgbg(char *src, int *result)
}
#endif
+#define ripoff_sp _nc_prescreen.rsp
+#define ripoff_stack _nc_prescreen.rippedoff
+
/* OS-independent screen initializations */
NCURSES_EXPORT(int)
-_nc_setupscreen(int slines,
- int scolumns,
+_nc_setupscreen(int slines GCC_UNUSED,
+ int scolumns GCC_UNUSED,
FILE *output,
bool filtered,
int slk_format)
{
int bottom_stolen = 0;
- int i;
bool support_cookies = USE_XMC_SUPPORT;
+ ripoff_t *rop;
T((T_CALLED("_nc_setupscreen(%d, %d, %p, %d, %d)"),
slines, scolumns, output, filtered, slk_format));
@@ -243,12 +253,20 @@ _nc_setupscreen(int slines,
if ((SP->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0)
returnCode(ERR);
+ /*
+ * We should always check the screensize, just in case.
+ */
+ _nc_get_screensize(&slines, &scolumns);
+ SET_LINES(slines);
+ SET_COLS(scolumns);
+ T((T_CREATE("screen %s %dx%d"), termname(), LINES, COLS));
+
SP->_filtered = filtered;
/* implement filter mode */
if (filtered) {
- slines = LINES = 1;
-
+ slines = 1;
+ SET_LINES(slines);
clear_screen = 0;
cursor_down = parm_down_cursor = 0;
cursor_address = 0;
@@ -258,18 +276,6 @@ _nc_setupscreen(int slines,
cursor_home = carriage_return;
T(("filter screensize %dx%d", LINES, COLS));
}
-
- /* If we must simulate soft labels, grab off the line to be used.
- We assume that we must simulate, if it is none of the standard
- formats (4-4 or 3-2-3) for which there may be some hardware
- support. */
- if (num_labels <= 0 || !SLK_STDFMT(slk_format)) {
- if (slk_format) {
- if (ERR == _nc_ripoffline(-SLK_LINES(slk_format),
- _nc_slk_initialize))
- returnCode(ERR);
- }
- }
#ifdef __DJGPP__
T(("setting output mode to binary"));
fflush(output);
@@ -484,6 +490,15 @@ _nc_setupscreen(int slines,
}
/* initialize normal acs before wide, since we use mapping in the latter */
+#if !USE_WIDEC_SUPPORT
+ if (_nc_unicode_locale() && _nc_locale_breaks_acs()) {
+ acs_chars = NULL;
+ ena_acs = NULL;
+ enter_alt_charset_mode = NULL;
+ exit_alt_charset_mode = NULL;
+ set_attributes = NULL;
+ }
+#endif
_nc_init_acs();
#if USE_WIDEC_SUPPORT
_nc_init_wacs();
@@ -506,15 +521,17 @@ _nc_setupscreen(int slines,
SP->newhash = 0;
T(("creating newscr"));
- if ((newscr = newwin(slines, scolumns, 0, 0)) == 0)
+ if ((SP->_newscr = newwin(slines, scolumns, 0, 0)) == 0)
returnCode(ERR);
T(("creating curscr"));
- if ((curscr = newwin(slines, scolumns, 0, 0)) == 0)
+ if ((SP->_curscr = newwin(slines, scolumns, 0, 0)) == 0)
returnCode(ERR);
- SP->_newscr = newscr;
- SP->_curscr = curscr;
+#if !USE_REENTRANT
+ newscr = SP->_newscr;
+ curscr = SP->_curscr;
+#endif
#if USE_SIZECHANGE
SP->_resize = resizeterm;
#endif
@@ -525,46 +542,63 @@ _nc_setupscreen(int slines,
def_shell_mode();
def_prog_mode();
- for (i = 0, rsp = rippedoff; rsp->line && (i < (int) N_RIPS); rsp++, i++) {
- T(("ripping off line %d at %s", i, rsp->line < 0 ? "bottom" : "top"));
- SP->_rippedoff[i] = rippedoff[i];
- if (rsp->hook) {
- int count = (rsp->line < 0) ? -rsp->line : rsp->line;
-
- SP->_rippedoff[i].w = newwin(count,
- scolumns,
- ((rsp->line < 0)
- ? SP->_lines_avail - count
- : 0),
- 0);
- if (SP->_rippedoff[i].w != 0)
- SP->_rippedoff[i].hook(SP->_rippedoff[i].w, scolumns);
+ for (rop = ripoff_stack;
+ rop != ripoff_sp && (rop - ripoff_stack) < N_RIPS;
+ rop++) {
+
+ /* If we must simulate soft labels, grab off the line to be used.
+ We assume that we must simulate, if it is none of the standard
+ formats (4-4 or 3-2-3) for which there may be some hardware
+ support. */
+ if (rop->hook == _nc_slk_initialize)
+ if (!(num_labels <= 0 || !SLK_STDFMT(slk_format)))
+ continue;
+ if (rop->hook) {
+ int count;
+ WINDOW *w;
+
+ count = (rop->line < 0) ? -rop->line : rop->line;
+ T(("ripping off %i lines at %s", count,
+ ((rop->line < 0)
+ ? "bottom"
+ : "top")));
+
+ w = newwin(count, scolumns,
+ ((rop->line < 0)
+ ? SP->_lines_avail - count
+ : 0),
+ 0);
+ if (w)
+ rop->hook(w, scolumns);
else
returnCode(ERR);
- if (rsp->line < 0)
+ if (rop->line < 0)
bottom_stolen += count;
else
SP->_topstolen += count;
SP->_lines_avail -= count;
}
- rsp->line = 0;
}
- SP->_rip_count = i;
/* reset the stack */
- rsp = rippedoff;
+ ripoff_sp = ripoff_stack;
T(("creating stdscr"));
assert((SP->_lines_avail + SP->_topstolen + bottom_stolen) == slines);
- if ((stdscr = newwin(LINES = SP->_lines_avail, scolumns, 0, 0)) == 0)
+ if ((SP->_stdscr = newwin(SP->_lines_avail, scolumns, 0, 0)) == 0)
returnCode(ERR);
- SP->_stdscr = stdscr;
+
+ SET_LINES(SP->_lines_avail);
+#if !USE_REENTRANT
+ stdscr = SP->_stdscr;
+#endif
returnCode(OK);
}
-/* The internal implementation interprets line as the number of
- lines to rip off from the top or bottom.
- */
+/*
+ * The internal implementation interprets line as the number of lines to rip
+ * off from the top or bottom.
+ */
NCURSES_EXPORT(int)
_nc_ripoffline(int line, int (*init) (WINDOW *, int))
{
@@ -572,13 +606,14 @@ _nc_ripoffline(int line, int (*init) (WINDOW *, int))
if (line != 0) {
- if (rsp >= rippedoff + N_RIPS)
+ if (ripoff_sp == 0)
+ ripoff_sp = ripoff_stack;
+ if (ripoff_sp >= ripoff_stack + N_RIPS)
returnCode(ERR);
- rsp->line = line;
- rsp->hook = init;
- rsp->w = 0;
- rsp++;
+ ripoff_sp->line = line;
+ ripoff_sp->hook = init;
+ ripoff_sp++;
}
returnCode(OK);
diff --git a/contrib/ncurses/ncurses/base/lib_slkinit.c b/contrib/ncurses/ncurses/base/lib_slkinit.c
index f003b5f..20c0baa 100644
--- a/contrib/ncurses/ncurses/base/lib_slkinit.c
+++ b/contrib/ncurses/ncurses/base/lib_slkinit.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000,2007 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 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkinit.c,v 1.5 2000/12/10 02:43:27 tom Exp $")
+MODULE_ID("$Id: lib_slkinit.c,v 1.6 2007/05/12 18:14:21 tom Exp $")
NCURSES_EXPORT(int)
slk_init(int format)
{
+ int code = ERR;
+
T((T_CALLED("slk_init(%d)"), format));
- if (format < 0 || format > 3)
- returnCode(ERR);
- _nc_slk_format = 1 + format;
- returnCode(OK);
+ if (format >= 0 && format <= 3 && !_nc_slk_format) {
+ _nc_slk_format = 1 + format;
+ code = _nc_ripoffline(-SLK_LINES(_nc_slk_format), _nc_slk_initialize);
+ }
+ returnCode(code);
}
diff --git a/contrib/ncurses/ncurses/base/lib_slkset.c b/contrib/ncurses/ncurses/base/lib_slkset.c
index 9379b36..e19f88e 100644
--- a/contrib/ncurses/ncurses/base/lib_slkset.c
+++ b/contrib/ncurses/ncurses/base/lib_slkset.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2007 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,12 +44,12 @@
#endif
#endif
-MODULE_ID("$Id: lib_slkset.c,v 1.16 2006/12/17 19:47:09 tom Exp $")
+MODULE_ID("$Id: lib_slkset.c,v 1.17 2007/10/13 20:08:46 tom Exp $")
NCURSES_EXPORT(int)
slk_set(int i, const char *astr, int format)
{
- SLK *slk = SP->_slk;
+ SLK *slk;
int offset;
int numchrs;
int numcols;
@@ -59,7 +59,12 @@ slk_set(int i, const char *astr, int format)
T((T_CALLED("slk_set(%d, \"%s\", %d)"), i, str, format));
- if (slk == NULL || i < 1 || i > slk->labcnt || format < 0 || format > 2)
+ if (SP == 0
+ || (slk = SP->_slk) == 0
+ || i < 1
+ || i > slk->labcnt
+ || format < 0
+ || format > 2)
returnCode(ERR);
if (str == NULL)
str = "";
diff --git a/contrib/ncurses/ncurses/base/lib_ungetch.c b/contrib/ncurses/ncurses/base/lib_ungetch.c
index a6164df..9570a33 100644
--- a/contrib/ncurses/ncurses/base/lib_ungetch.c
+++ b/contrib/ncurses/ncurses/base/lib_ungetch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2002,2007 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_ungetch.c,v 1.8 2002/08/24 22:08:48 tom Exp $")
+MODULE_ID("$Id: lib_ungetch.c,v 1.9 2007/09/29 21:49:56 tom Exp $")
#include <fifo_defs.h>
@@ -72,8 +72,10 @@ ungetch(int ch)
SP->_fifo[head] = ch;
T(("ungetch %s ok", _tracechar(ch)));
#ifdef TRACE
- if (_nc_tracing & TRACE_IEVENT)
+ if (USE_TRACEF(TRACE_IEVENT)) {
_nc_fifo_dump();
+ _nc_unlock_global(tracef);
+ }
#endif
returnCode(OK);
}
diff --git a/contrib/ncurses/ncurses/base/lib_window.c b/contrib/ncurses/ncurses/base/lib_window.c
index bb20f4f..530b08e 100644
--- a/contrib/ncurses/ncurses/base/lib_window.c
+++ b/contrib/ncurses/ncurses/base/lib_window.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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.22 2006/05/27 19:21:19 tom Exp $")
+MODULE_ID("$Id: lib_window.c,v 1.23 2007/06/30 23:36:11 tom Exp $")
NCURSES_EXPORT(void)
_nc_synchook(WINDOW *win)
@@ -149,7 +149,7 @@ wsyncdown(WINDOW *win)
/* left and right character in child coordinates */
int left = pp->_line[win->_pary + y].firstchar - win->_parx;
int right = pp->_line[win->_pary + y].lastchar - win->_parx;
- /* The change maybe outside the childs range */
+ /* The change may be outside the child's range */
if (left < 0)
left = 0;
if (right > win->_maxx)
diff --git a/contrib/ncurses/ncurses/base/memmove.c b/contrib/ncurses/ncurses/base/memmove.c
index 4fafc4c..093ad72 100644
--- a/contrib/ncurses/ncurses/base/memmove.c
+++ b/contrib/ncurses/ncurses/base/memmove.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000,2007 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 *
@@ -28,7 +28,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: memmove.c,v 1.4 2000/12/10 02:43:28 tom Exp $")
+MODULE_ID("$Id: memmove.c,v 1.5 2007/08/11 17:12:43 tom Exp $")
/****************************************************************************
* Author: Thomas E. Dickey <dickey@clark.net> 1998 *
@@ -51,7 +51,7 @@ _nc_memmove(void *s1, const void *s2, size_t n)
}
for (j = 0; j < n; j++)
bfr[j] = SRC[j];
- SRC = bfr;
+ s2 = bfr;
}
while (n-- != 0)
DST[n] = SRC[n];
diff --git a/contrib/ncurses/ncurses/base/resizeterm.c b/contrib/ncurses/ncurses/base/resizeterm.c
index 46faccb..8bea743 100644
--- a/contrib/ncurses/ncurses/base/resizeterm.c
+++ b/contrib/ncurses/ncurses/base/resizeterm.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2004,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,12 +41,24 @@
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$Id: resizeterm.c,v 1.18 2006/10/14 20:43:31 tom Exp $")
+MODULE_ID("$Id: resizeterm.c,v 1.24 2007/12/22 23:20:31 tom Exp $")
#define stolen_lines (screen_lines - SP->_lines_avail)
+/*
+ * If we're trying to be reentrant, do not want any local statics.
+ */
+#if USE_REENTRANT
+#define EXTRA_ARGS , CurLines, CurCols
+#define EXTRA_DCLS , int CurLines, int CurCols
+#else
static int current_lines;
static int current_cols;
+#define CurLines current_lines
+#define CurCols current_cols
+#define EXTRA_ARGS /* nothing */
+#define EXTRA_DCLS /* nothing */
+#endif
#ifdef TRACE
static void
@@ -54,6 +66,7 @@ show_window_sizes(const char *name)
{
WINDOWLIST *wp;
+ _nc_lock_global(windowlist);
_tracef("%s resizing: %2d x %2d (%2d x %2d)", name, LINES, COLS,
screen_lines, screen_columns);
for (wp = _nc_windows; wp != 0; wp = wp->next) {
@@ -64,6 +77,7 @@ show_window_sizes(const char *name)
(long) wp->win._begy,
(long) wp->win._begx);
}
+ _nc_unlock_global(windowlist);
}
#endif
@@ -121,10 +135,10 @@ parent_depth(WINDOW *cmp)
* FIXME: must adjust position so it's within the parent!
*/
static int
-adjust_window(WINDOW *win, int ToLines, int ToCols, int stolen)
+adjust_window(WINDOW *win, int ToLines, int ToCols, int stolen EXTRA_DCLS)
{
int result;
- int bottom = current_lines + SP->_topstolen - stolen;
+ int bottom = CurLines + SP->_topstolen - stolen;
int myLines = win->_maxy + 1;
int myCols = win->_maxx + 1;
@@ -134,13 +148,13 @@ adjust_window(WINDOW *win, int ToLines, int ToCols, int stolen)
(long) getbegy(win), (long) getbegx(win)));
if (win->_begy >= bottom) {
- win->_begy += (ToLines - current_lines);
+ win->_begy += (ToLines - CurLines);
} else {
- if (myLines == current_lines - stolen
- && ToLines != current_lines)
+ if (myLines == CurLines - stolen
+ && ToLines != CurLines)
myLines = ToLines - stolen;
- else if (myLines == current_lines
- && ToLines != current_lines)
+ else if (myLines == CurLines
+ && ToLines != CurLines)
myLines = ToLines;
}
@@ -150,12 +164,12 @@ adjust_window(WINDOW *win, int ToLines, int ToCols, int stolen)
if (myCols > ToCols)
myCols = ToCols;
- if (myLines == current_lines
- && ToLines != current_lines)
+ if (myLines == CurLines
+ && ToLines != CurLines)
myLines = ToLines;
- if (myCols == current_cols
- && ToCols != current_cols)
+ if (myCols == CurCols
+ && ToCols != CurCols)
myCols = ToCols;
result = wresize(win, myLines, myCols);
@@ -167,7 +181,7 @@ adjust_window(WINDOW *win, int ToLines, int ToCols, int stolen)
* children, decrease those to fit, then decrease the containing window, etc.
*/
static int
-decrease_size(int ToLines, int ToCols, int stolen)
+decrease_size(int ToLines, int ToCols, int stolen EXTRA_DCLS)
{
bool found;
int depth = 0;
@@ -185,7 +199,8 @@ decrease_size(int ToLines, int ToCols, int stolen)
if (!(win->_flags & _ISPAD)) {
if (child_depth(win) == depth) {
found = TRUE;
- if (adjust_window(win, ToLines, ToCols, stolen) != OK)
+ if (adjust_window(win, ToLines, ToCols,
+ stolen EXTRA_ARGS) != OK)
returnCode(ERR);
}
}
@@ -200,7 +215,7 @@ decrease_size(int ToLines, int ToCols, int stolen)
* parent, increase those to fit, then increase the contained window, etc.
*/
static int
-increase_size(int ToLines, int ToCols, int stolen)
+increase_size(int ToLines, int ToCols, int stolen EXTRA_DCLS)
{
bool found;
int depth = 0;
@@ -218,7 +233,8 @@ increase_size(int ToLines, int ToCols, int stolen)
if (!(win->_flags & _ISPAD)) {
if (parent_depth(win) == depth) {
found = TRUE;
- if (adjust_window(win, ToLines, ToCols, stolen) != OK)
+ if (adjust_window(win, ToLines, ToCols,
+ stolen EXTRA_ARGS) != OK)
returnCode(ERR);
}
}
@@ -235,36 +251,45 @@ increase_size(int ToLines, int ToCols, int stolen)
NCURSES_EXPORT(int)
resize_term(int ToLines, int ToCols)
{
- int result = OK;
- int was_stolen = (screen_lines - SP->_lines_avail);
+ int result = OK EXTRA_ARGS;
+ int was_stolen;
T((T_CALLED("resize_term(%d,%d) old(%d,%d)"),
ToLines, ToCols,
screen_lines, screen_columns));
+ if (SP == 0) {
+ returnCode(ERR);
+ }
+
+ _nc_lock_global(windowlist);
+
+ was_stolen = (screen_lines - SP->_lines_avail);
if (is_term_resized(ToLines, ToCols)) {
- int myLines = current_lines = screen_lines;
- int myCols = current_cols = screen_columns;
+ int myLines = CurLines = screen_lines;
+ int myCols = CurCols = screen_columns;
#ifdef TRACE
- if (_nc_tracing & TRACE_UPDATE)
+ if (USE_TRACEF(TRACE_UPDATE)) {
show_window_sizes("before");
+ _nc_unlock_global(tracef);
+ }
#endif
if (ToLines > screen_lines) {
- increase_size(myLines = ToLines, myCols, was_stolen);
- current_lines = myLines;
- current_cols = myCols;
+ increase_size(myLines = ToLines, myCols, was_stolen EXTRA_ARGS);
+ CurLines = myLines;
+ CurCols = myCols;
}
if (ToCols > screen_columns) {
- increase_size(myLines, myCols = ToCols, was_stolen);
- current_lines = myLines;
- current_cols = myCols;
+ increase_size(myLines, myCols = ToCols, was_stolen EXTRA_ARGS);
+ CurLines = myLines;
+ CurCols = myCols;
}
if (ToLines < myLines ||
ToCols < myCols) {
- decrease_size(ToLines, ToCols, was_stolen);
+ decrease_size(ToLines, ToCols, was_stolen EXTRA_ARGS);
}
screen_lines = lines = ToLines;
@@ -279,10 +304,11 @@ resize_term(int ToLines, int ToCols)
FreeAndNull(SP->newhash);
}
#ifdef TRACE
- if (_nc_tracing & TRACE_UPDATE) {
- LINES = ToLines - was_stolen;
- COLS = ToCols;
+ if (USE_TRACEF(TRACE_UPDATE)) {
+ SET_LINES(ToLines - was_stolen);
+ SET_COLS(ToCols);
show_window_sizes("after");
+ _nc_unlock_global(tracef);
}
#endif
}
@@ -291,8 +317,10 @@ resize_term(int ToLines, int ToCols)
* Always update LINES, to allow for call from lib_doupdate.c which
* needs to have the count adjusted by the stolen (ripped off) lines.
*/
- LINES = ToLines - was_stolen;
- COLS = ToCols;
+ SET_LINES(ToLines - was_stolen);
+ SET_COLS(ToCols);
+
+ _nc_unlock_global(windowlist);
returnCode(result);
}
@@ -308,22 +336,25 @@ resize_term(int ToLines, int ToCols)
NCURSES_EXPORT(int)
resizeterm(int ToLines, int ToCols)
{
- int result = OK;
-
- SP->_sig_winch = FALSE;
+ int result = ERR;
T((T_CALLED("resizeterm(%d,%d) old(%d,%d)"),
ToLines, ToCols,
screen_lines, screen_columns));
- if (is_term_resized(ToLines, ToCols)) {
+ if (SP != 0) {
+ result = OK;
+ SP->_sig_winch = FALSE;
+
+ if (is_term_resized(ToLines, ToCols)) {
#if USE_SIGWINCH
- ungetch(KEY_RESIZE); /* so application can know this */
- clearok(curscr, TRUE); /* screen contents are unknown */
+ ungetch(KEY_RESIZE); /* so application can know this */
+ clearok(curscr, TRUE); /* screen contents are unknown */
#endif
- result = resize_term(ToLines, ToCols);
+ result = resize_term(ToLines, ToCols);
+ }
}
returnCode(result);
diff --git a/contrib/ncurses/ncurses/base/safe_sprintf.c b/contrib/ncurses/ncurses/base/safe_sprintf.c
index 81fe44f..8fc5d89 100644
--- a/contrib/ncurses/ncurses/base/safe_sprintf.c
+++ b/contrib/ncurses/ncurses/base/safe_sprintf.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2001,2003 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2007 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.18 2003/08/09 21:52:04 tom Exp $")
+MODULE_ID("$Id: safe_sprintf.c,v 1.20 2007/04/21 22:28:06 tom Exp $")
#if USE_SAFE_SPRINTF
@@ -207,56 +207,58 @@ _nc_printf_length(const char *fmt, va_list ap)
}
#endif
+#define my_buffer _nc_globals.safeprint_buf
+#define my_length _nc_globals.safeprint_used
+
/*
* Wrapper for vsprintf that allocates a buffer big enough to hold the result.
*/
NCURSES_EXPORT(char *)
_nc_printf_string(const char *fmt, va_list ap)
{
- static char *buf;
- static size_t used;
char *result = 0;
if (fmt != 0) {
#if USE_SAFE_SPRINTF
int len = _nc_printf_length(fmt, ap);
- if ((int) used < len + 1) {
- used = 2 * (len + 1);
- buf = typeRealloc(char, used, buf);
+ if ((int) my_length < len + 1) {
+ my_length = 2 * (len + 1);
+ my_buffer = typeRealloc(char, my_length, my_buffer);
}
- if (buf != 0) {
- *buf = '\0';
+ if (my_buffer != 0) {
+ *my_buffer = '\0';
if (len >= 0) {
- vsprintf(buf, fmt, ap);
+ vsprintf(my_buffer, fmt, ap);
}
- result = buf;
+ result = my_buffer;
}
#else
- static int rows, cols;
+#define MyCols _nc_globals.safeprint_cols
+#define MyRows _nc_globals.safeprint_rows
- if (screen_lines > rows || screen_columns > cols) {
- if (screen_lines > rows)
- rows = screen_lines;
- if (screen_columns > cols)
- cols = screen_columns;
- used = (rows * (cols + 1)) + 1;
- buf = typeRealloc(char, used, buf);
+ if (screen_lines > MyRows || screen_columns > MyCols) {
+ if (screen_lines > MyRows)
+ MyRows = screen_lines;
+ if (screen_columns > MyCols)
+ MyCols = screen_columns;
+ my_length = (MyRows * (MyCols + 1)) + 1;
+ my_buffer = typeRealloc(char, my_length, my_buffer);
}
- if (buf != 0) {
+ if (my_buffer != 0) {
# if HAVE_VSNPRINTF
- vsnprintf(buf, used, fmt, ap); /* GNU extension */
+ vsnprintf(my_buffer, my_length, fmt, ap); /* GNU extension */
# else
- vsprintf(buf, fmt, ap); /* ANSI */
+ vsprintf(my_buffer, fmt, ap); /* ANSI */
# endif
- result = buf;
+ result = my_buffer;
}
#endif
- } else if (buf != 0) { /* see _nc_freeall() */
- free(buf);
- buf = 0;
- used = 0;
+ } else if (my_buffer != 0) { /* see _nc_freeall() */
+ free(my_buffer);
+ my_buffer = 0;
+ my_length = 0;
}
return result;
}
diff --git a/contrib/ncurses/ncurses/base/tries.c b/contrib/ncurses/ncurses/base/tries.c
index 4edb731..983a75a 100644
--- a/contrib/ncurses/ncurses/base/tries.c
+++ b/contrib/ncurses/ncurses/base/tries.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,16 +39,16 @@
#include <curses.priv.h>
-MODULE_ID("$Id: tries.c,v 1.22 2005/11/26 20:09:18 tom Exp $")
+MODULE_ID("$Id: tries.c,v 1.25 2007/09/29 20:37:13 tom Exp $")
/*
* Expand a keycode into the string that it corresponds to, returning null if
* no match was found, otherwise allocating a string of the result.
*/
NCURSES_EXPORT(char *)
-_nc_expand_try(struct tries *tree, unsigned code, int *count, size_t len)
+_nc_expand_try(TRIES * tree, unsigned code, int *count, size_t len)
{
- struct tries *ptr = tree;
+ TRIES *ptr = tree;
char *result = 0;
if (code != 0) {
@@ -68,11 +68,13 @@ _nc_expand_try(struct tries *tree, unsigned code, int *count, size_t len)
}
}
if (result != 0) {
- if ((result[len] = ptr->ch) == 0)
+ if (ptr != 0 && (result[len] = ptr->ch) == 0)
*((unsigned char *) (result + len)) = 128;
#ifdef TRACE
- if (len == 0 && _nc_tracing != 0)
+ if (len == 0 && USE_TRACEF(TRACE_MAXIMUM)) {
_tracef("expand_key %s %s", _tracechar(code), _nc_visbuf(result));
+ _nc_unlock_global(tracef);
+ }
#endif
}
return result;
@@ -83,7 +85,7 @@ _nc_expand_try(struct tries *tree, unsigned code, int *count, size_t len)
* true if the code was found/removed.
*/
NCURSES_EXPORT(int)
-_nc_remove_key(struct tries **tree, unsigned code)
+_nc_remove_key(TRIES ** tree, unsigned code)
{
T((T_CALLED("_nc_remove_key(%p,%d)"), tree, code));
@@ -99,7 +101,7 @@ _nc_remove_key(struct tries **tree, unsigned code)
/* don't cut the whole sub-tree */
(*tree)->value = 0;
} else {
- struct tries *to_free = *tree;
+ TRIES *to_free = *tree;
*tree = (*tree)->sibling;
free(to_free);
}
@@ -115,7 +117,7 @@ _nc_remove_key(struct tries **tree, unsigned code)
* true if the string was found/removed.
*/
NCURSES_EXPORT(int)
-_nc_remove_string(struct tries **tree, const char *string)
+_nc_remove_string(TRIES ** tree, const char *string)
{
T((T_CALLED("_nc_remove_string(%p,%s)"), tree, _nc_visbuf(string)));
@@ -127,7 +129,7 @@ _nc_remove_string(struct tries **tree, const char *string)
if (string[1] != 0)
returnCode(_nc_remove_string(&(*tree)->child, string + 1));
if ((*tree)->child == 0) {
- struct tries *to_free = *tree;
+ TRIES *to_free = *tree;
*tree = (*tree)->sibling;
free(to_free);
returnCode(TRUE);
diff --git a/contrib/ncurses/ncurses/base/use_window.c b/contrib/ncurses/ncurses/base/use_window.c
new file mode 100644
index 0000000..8792cb4
--- /dev/null
+++ b/contrib/ncurses/ncurses/base/use_window.c
@@ -0,0 +1,80 @@
+/****************************************************************************
+ * Copyright (c) 2007 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 2007 *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: use_window.c,v 1.2 2007/10/20 19:57:55 tom Exp $")
+
+#ifdef USE_PTHREADS
+NCURSES_EXPORT(void)
+_nc_lock_window(WINDOW *win)
+{
+ WINDOWLIST *p;
+
+ _nc_lock_global(windowlist);
+ for (p = _nc_windows; p != 0; p = p->next) {
+ if (&(p->win) == win) {
+ pthread_mutex_lock(&(p->mutex_use_window));
+ break;
+ }
+ }
+ _nc_unlock_global(windowlist);
+}
+
+NCURSES_EXPORT(void)
+_nc_unlock_window(WINDOW *win)
+{
+ WINDOWLIST *p;
+
+ _nc_lock_global(windowlist);
+ for (p = _nc_windows; p != 0; p = p->next) {
+ if (&(p->win) == win) {
+ pthread_mutex_unlock(&(p->mutex_use_window));
+ break;
+ }
+ }
+ _nc_unlock_global(windowlist);
+}
+#endif
+
+NCURSES_EXPORT(int)
+use_window(WINDOW *win, NCURSES_CALLBACK func, void *data)
+{
+ int code = OK;
+
+ T((T_CALLED("use_window(%p,%p,%p)"), win, func, data));
+ _nc_lock_window(win);
+ code = func(win, data);
+ _nc_unlock_window(win);
+
+ returnCode(code);
+}
diff --git a/contrib/ncurses/ncurses/base/wresize.c b/contrib/ncurses/ncurses/base/wresize.c
index ca6336d..f756f0f 100644
--- a/contrib/ncurses/ncurses/base/wresize.c
+++ b/contrib/ncurses/ncurses/base/wresize.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,13 +32,13 @@
#include <curses.priv.h>
-MODULE_ID("$Id: wresize.c,v 1.24 2006/10/14 20:43:31 tom Exp $")
+MODULE_ID("$Id: wresize.c,v 1.27 2007/12/22 23:20:53 tom Exp $")
static int
cleanup_lines(struct ldat *data, int length)
{
while (--length >= 0)
- free(data->text);
+ free(data[length].text);
free(data);
return ERR;
}
@@ -54,6 +54,8 @@ repair_subwindows(WINDOW *cmp)
struct ldat *pline = cmp->_line;
int row;
+ _nc_lock_global(windowlist);
+
for (wp = _nc_windows; wp != 0; wp = wp->next) {
WINDOW *tst = &(wp->win);
@@ -75,6 +77,7 @@ repair_subwindows(WINDOW *cmp)
repair_subwindows(tst);
}
}
+ _nc_unlock_global(windowlist);
}
/*
@@ -96,8 +99,10 @@ wresize(WINDOW *win, int ToLines, int ToCols)
(long) win->_begy, (long) win->_begx,
(long) win->_maxy, (long) win->_maxx,
(long) win->_regtop, (long) win->_regbottom));
- if (_nc_tracing & TRACE_UPDATE)
+ if (USE_TRACEF(TRACE_UPDATE)) {
_tracedump("...before", win);
+ _nc_unlock_global(tracef);
+ }
}
#endif
@@ -232,8 +237,10 @@ wresize(WINDOW *win, int ToLines, int ToCols)
(long) win->_begy, (long) win->_begx,
(long) win->_maxy, (long) win->_maxx,
(long) win->_regtop, (long) win->_regbottom));
- if (_nc_tracing & TRACE_UPDATE)
+ if (USE_TRACEF(TRACE_UPDATE)) {
_tracedump("...after:", win);
+ _nc_unlock_global(tracef);
+ }
#endif
returnCode(OK);
}
diff --git a/contrib/ncurses/ncurses/curses.priv.h b/contrib/ncurses/ncurses/curses.priv.h
index cfb3e62..54ffc8e 100644
--- a/contrib/ncurses/ncurses/curses.priv.h
+++ b/contrib/ncurses/ncurses/curses.priv.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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.314 2006/12/10 00:55:14 tom Exp $
+ * $Id: curses.priv.h,v 1.353 2007/12/23 00:15:38 tom Exp $
*
* curses.priv.h
*
@@ -202,16 +202,20 @@ extern NCURSES_EXPORT(void *) _nc_memmove (void *, const void *, size_t);
* delays and expansion in raw mode.
*/
-struct tries {
- struct tries *child; /* ptr to child. NULL if none */
- struct tries *sibling; /* ptr to sibling. NULL if none */
+#define TRIES struct tries
+typedef TRIES {
+ TRIES *child; /* ptr to child. NULL if none */
+ TRIES *sibling; /* ptr to sibling. NULL if none */
unsigned char ch; /* character at this node */
unsigned short value; /* code of string so far. 0 if none. */
-};
+#undef TRIES
+} TRIES;
/*
* Common/troublesome character definitions
*/
+#define StringOf(ch) {ch, 0}
+
#define L_BRACE '{'
#define R_BRACE '}'
#define S_QUOTE '\''
@@ -248,6 +252,10 @@ color_t;
#define wbkgrnd wbkgd
#endif
+#undef NCURSES_OPAQUE
+#define NCURSES_INTERNALS 1
+#define NCURSES_OPAQUE 0
+
#include <curses.h> /* we'll use -Ipath directive to get the right one! */
#include <term.h>
#include <term_entry.h>
@@ -284,6 +292,51 @@ color_t;
#define GET_SCREEN_PAIR(s) GetPair(SCREEN_ATTRS(s))
#define SET_SCREEN_PAIR(s,p) SetPair(SCREEN_ATTRS(s), p)
+#if USE_REENTRANT
+#define SET_LINES(value) SP->_LINES = value
+#define SET_COLS(value) SP->_COLS = value
+#else
+#define SET_LINES(value) LINES = value
+#define SET_COLS(value) COLS = value
+#endif
+
+#define TR_MUTEX(data) _tracef("%s@%d: me:%08lX COUNT:%2u/%2d/%6d/%2d/%s%9u: " #data, \
+ __FILE__, __LINE__, \
+ (unsigned long) (pthread_self()), \
+ data.__data.__lock, \
+ data.__data.__count, \
+ data.__data.__owner, \
+ data.__data.__kind, \
+ (data.__data.__nusers > 5) ? " OOPS " : "", \
+ data.__data.__nusers)
+#define TR_GLOBAL_MUTEX(name) TR_MUTEX(_nc_globals.mutex_##name)
+
+#ifdef USE_PTHREADS
+#if USE_REENTRANT
+#include <pthread.h>
+#define _nc_lock_global(name) pthread_mutex_lock(&_nc_globals.mutex_##name)
+#define _nc_try_global(name) pthread_mutex_trylock(&_nc_globals.mutex_##name)
+#define _nc_unlock_global(name) pthread_mutex_unlock(&_nc_globals.mutex_##name)
+
+extern NCURSES_EXPORT(void) _nc_lock_window(WINDOW *);
+extern NCURSES_EXPORT(void) _nc_unlock_window(WINDOW *);
+
+#else
+#error POSIX threads requires --enable-reentrant option
+#endif
+#else
+#define _nc_lock_global(name) /* nothing */
+#define _nc_try_global(name) 0
+#define _nc_unlock_global(name) /* nothing */
+
+#define _nc_lock_window(name) (void) TRUE
+#define _nc_unlock_window(name) /* nothing */
+
+#endif
+
+#define _nc_lock_screen(name) /* nothing */
+#define _nc_unlock_screen(name) /* nothing */
+
/*
* Definitions for color pairs
*/
@@ -366,7 +419,6 @@ typedef struct _SLK {
typedef struct {
int line; /* lines to take, < 0 => from bottom*/
int (*hook)(WINDOW *, int); /* callback for user */
- WINDOW *w; /* maybe we need this for cleanup */
} ripoff_t;
#if USE_GPM_SUPPORT
@@ -393,6 +445,186 @@ typedef int (*TYPE_Gpm_GetEvent) (Gpm_Event *);
#endif /* HAVE_LIBDL */
#endif /* USE_GPM_SUPPORT */
+typedef struct {
+ long sequence;
+ bool last_used;
+ char *fix_sgr0; /* this holds the filtered sgr0 string */
+ char *last_bufp; /* help with fix_sgr0 leak */
+ TERMINAL *last_term;
+} TGETENT_CACHE;
+
+#define TGETENT_MAX 4
+
+/*
+ * State of tparm().
+ */
+#define STACKSIZE 20
+
+typedef struct {
+ union {
+ int num;
+ char *str;
+ } data;
+ bool num_type;
+} STACK_FRAME;
+
+#define NUM_VARS 26
+
+typedef struct {
+#ifdef TRACE
+ const char *tname;
+#endif
+ const char *tparam_base;
+
+ STACK_FRAME stack[STACKSIZE];
+ int stack_ptr;
+
+ char *out_buff;
+ size_t out_size;
+ size_t out_used;
+
+ char *fmt_buff;
+ size_t fmt_size;
+
+ int dynamic_var[NUM_VARS];
+ int static_vars[NUM_VARS];
+} TPARM_STATE;
+
+typedef struct {
+ char *text;
+ size_t size;
+} TRACEBUF;
+
+/*
+ * The filesystem database normally uses a single-letter for the lower level
+ * of directories. Use a hexadecimal code for filesystems which do not
+ * preserve mixed-case names.
+ */
+#if MIXEDCASE_FILENAMES
+#define LEAF_FMT "%c"
+#else
+#define LEAF_FMT "%02x"
+#endif
+
+/*
+ * TRACEMSE_FMT is no longer than 80 columns, there are 5 numbers that
+ * could at most have 10 digits, and the mask contains no more than 32 bits
+ * with each bit representing less than 15 characters. Usually the whole
+ * string is less than 80 columns, but this buffer size is an absolute
+ * limit.
+ */
+#define TRACEMSE_MAX (80 + (5 * 10) + (32 * 15))
+#define TRACEMSE_FMT "id %2d at (%2d, %2d, %2d) state %4lx = {" /* } */
+
+/*
+ * Global data which is not specific to a screen.
+ */
+typedef struct {
+ SIG_ATOMIC_T have_sigwinch;
+ SIG_ATOMIC_T cleanup_nested;
+
+ bool init_signals;
+ bool init_screen;
+
+ const char *comp_sourcename;
+ char *comp_termtype;
+
+ bool have_tic_directory;
+ bool keep_tic_directory;
+ const char *tic_directory;
+
+ char *dbi_list;
+ int dbi_size;
+
+ char *first_name;
+ char **keyname_table;
+
+ char *safeprint_buf;
+ size_t safeprint_used;
+
+ TGETENT_CACHE tgetent_cache[TGETENT_MAX];
+ int tgetent_index;
+ long tgetent_sequence;
+
+#if USE_HOME_TERMINFO
+ char *home_terminfo;
+#endif
+
+#if !USE_SAFE_SPRINTF
+ int safeprint_cols;
+ int safeprint_rows;
+#endif
+
+#ifdef TRACE
+ bool init_trace;
+ char trace_fname[PATH_MAX];
+ int trace_level;
+ FILE *trace_fp;
+
+ char *tracearg_buf;
+ size_t tracearg_used;
+
+ TRACEBUF *tracebuf_ptr;
+ size_t tracebuf_used;
+
+ char tracechr_buf[40];
+
+ char *tracedmp_buf;
+ size_t tracedmp_used;
+
+ char tracemse_buf[TRACEMSE_MAX];
+
+ unsigned char *tracetry_buf;
+ size_t tracetry_used;
+
+#ifndef USE_TERMLIB
+ char traceatr_color_buf[2][80];
+ int traceatr_color_sel;
+ int traceatr_color_last;
+#endif /* USE_TERMLIB */
+
+#endif /* TRACE */
+
+#ifdef USE_PTHREADS
+ pthread_mutex_t mutex_set_SP;
+ pthread_mutex_t mutex_use_screen;
+ pthread_mutex_t mutex_use_window;
+ pthread_mutex_t mutex_windowlist;
+ pthread_mutex_t mutex_tst_tracef;
+ pthread_mutex_t mutex_tracef;
+ int nested_tracef;
+#endif
+} NCURSES_GLOBALS;
+
+extern NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals;
+
+#define N_RIPS 5
+
+/*
+ * Global data which is swept up into a SCREEN when one is created.
+ * It may be modified before the next SCREEN is created.
+ */
+typedef struct {
+ bool use_env;
+ bool filter_mode;
+ attr_t previous_attr;
+ ripoff_t rippedoff[N_RIPS];
+ ripoff_t *rsp;
+ TPARM_STATE tparm_state;
+ TTY *saved_tty; /* savetty/resetty information */
+#if BROKEN_LINKER || USE_REENTRANT
+ chtype *real_acs_map;
+ int _LINES;
+ int _COLS;
+#ifdef TRACE
+ long _outchars;
+ const char *_tputs_trace;
+#endif
+#endif
+} NCURSES_PRESCREEN;
+
+extern NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen;
+
/*
* The SCREEN structure.
*/
@@ -405,20 +637,19 @@ struct screen {
bool _buffered; /* setvbuf uses _setbuf data */
int _checkfd; /* filedesc for typeahead check */
TERMINAL *_term; /* terminal type information */
- short _lines; /* screen lines */
- short _columns; /* screen columns */
+ TTY _saved_tty; /* savetty/resetty information */
+ NCURSES_SIZE_T _lines; /* screen lines */
+ NCURSES_SIZE_T _columns; /* screen columns */
- short _lines_avail; /* lines available for stdscr */
- short _topstolen; /* lines stolen from top */
- ripoff_t _rippedoff[5]; /* list of lines stolen */
- int _rip_count; /* ...and total lines stolen */
+ NCURSES_SIZE_T _lines_avail; /* lines available for stdscr */
+ NCURSES_SIZE_T _topstolen; /* lines stolen from top */
WINDOW *_curscr; /* current screen */
WINDOW *_newscr; /* virtual screen to be updated to */
WINDOW *_stdscr; /* screen's full-window context */
- struct tries *_keytry; /* "Try" for use with keypad mode */
- struct tries *_key_ok; /* Disabled keys via keyok(,FALSE) */
+ TRIES *_keytry; /* "Try" for use with keypad mode */
+ TRIES *_key_ok; /* Disabled keys via keyok(,FALSE) */
bool _tried; /* keypad mode was initialized */
bool _keypad_on; /* keypad mode is currently on */
@@ -597,12 +828,25 @@ struct screen {
unsigned long *oldhash, *newhash;
HASHMAP *hashtab;
int hashtab_len;
+ int *_oldnum_list;
+ int _oldnum_size;
bool _cleanup; /* cleanup after int/quit signal */
int (*_outch)(int); /* output handler if not putc */
int _legacy_coding; /* see use_legacy_coding() */
+#if USE_REENTRANT
+ char _ttytype[NAMESIZE];
+ int _ESCDELAY;
+ int _TABSIZE;
+ int _LINES;
+ int _COLS;
+#ifdef TRACE
+ int _outchars;
+ const char *_tputs_trace;
+#endif
+#endif
/*
* ncurses/ncursesw are the same up to this point.
*/
@@ -615,6 +859,7 @@ struct screen {
};
extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain;
+extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
WINDOWLIST {
WINDOW win; /* first, so WINDOW_EXT() works */
@@ -625,6 +870,9 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain;
int addch_x; /* x-position for addch_work[] */
int addch_y; /* y-position for addch_work[] */
#endif
+#ifdef USE_PTHREADS
+ pthread_mutex_t mutex_use_window;
+#endif
};
#define WINDOW_EXT(win,field) (((WINDOWLIST *)(win))->field)
@@ -691,11 +939,17 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain;
#endif
#ifdef TRACE
-#define TRACE_OUTCHARS(n) _nc_outchars += (n);
+#if USE_REENTRANT
+#define COUNT_OUTCHARS(n) _nc_count_outchars(n);
+#else
+#define COUNT_OUTCHARS(n) _nc_outchars += (n);
+#endif
#else
-#define TRACE_OUTCHARS(n) /* nothing */
+#define COUNT_OUTCHARS(n) /* nothing */
#endif
+#define RESET_OUTCHARS() COUNT_OUTCHARS(-_nc_outchars)
+
#define UChar(c) ((unsigned char)(c))
#define ChCharOf(c) ((c) & (chtype)A_CHARTEXT)
#define ChAttrOf(c) ((c) & (chtype)A_ATTRIBUTES)
@@ -705,7 +959,7 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain;
#endif
#if USE_WIDEC_SUPPORT /* { */
-#define isEILSEQ(status) ((status == (size_t)-1) && (errno == EILSEQ))
+#define isEILSEQ(status) (((size_t)status == (size_t)-1) && (errno == EILSEQ))
#define init_mb(state) memset(&state, 0, sizeof(state))
@@ -718,12 +972,26 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain;
#define NulChar 0,0,0,0 /* FIXME: see CCHARW_MAX */
#define CharOf(c) ((c).chars[0])
#define AttrOf(c) ((c).attr)
-#define AddAttr(c,a) AttrOf(c) |= ((a) & A_ATTRIBUTES)
+
+#define AddAttr(c,a) AttrOf(c) |= ((a) & A_ATTRIBUTES)
#define RemAttr(c,a) AttrOf(c) &= ~((a) & A_ATTRIBUTES)
-#define SetAttr(c,a) AttrOf(c) = ((a) & A_ATTRIBUTES)
+#define SetAttr(c,a) AttrOf(c) = ((a) & A_ATTRIBUTES) | WidecExt(c)
+
#define NewChar2(c,a) { a, { c, NulChar } NulColor }
#define NewChar(ch) NewChar2(ChCharOf(ch), ChAttrOf(ch))
+
+#if CCHARW_MAX == 5
+#define CharEq(a,b) (((a).attr == (b).attr) \
+ && (a).chars[0] == (b).chars[0] \
+ && (a).chars[1] == (b).chars[1] \
+ && (a).chars[2] == (b).chars[2] \
+ && (a).chars[3] == (b).chars[3] \
+ && (a).chars[4] == (b).chars[4] \
+ if_EXT_COLORS(&& (a).ext_color == (b).ext_color))
+#else
#define CharEq(a,b) (!memcmp(&(a), &(b), sizeof(a)))
+#endif
+
#define SetChar(ch,c,a) do { \
NCURSES_CH_T *_cp = &ch; \
memset(_cp, 0, sizeof(ch)); \
@@ -741,7 +1009,7 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain;
#define PUTC(ch,b) do { if(!isWidecExt(ch)) { \
if (Charable(ch)) { \
fputc(CharOf(ch), b); \
- TRACE_OUTCHARS(1); \
+ COUNT_OUTCHARS(1); \
} else { \
PUTC_INIT; \
for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) { \
@@ -757,11 +1025,11 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain;
} \
fwrite(PUTC_buf, (unsigned) PUTC_n, 1, b); \
} \
- TRACE_OUTCHARS(PUTC_i); \
+ COUNT_OUTCHARS(PUTC_i); \
} } } while (0)
-#define BLANK { WA_NORMAL, {' '} NulColor }
-#define ZEROS { WA_NORMAL, {'\0'} NulColor }
+#define BLANK NewChar2(' ', WA_NORMAL)
+#define ZEROS NewChar2('\0', WA_NORMAL)
#define ISBLANK(ch) ((ch).chars[0] == L' ' && (ch).chars[1] == L'\0')
/*
@@ -887,6 +1155,12 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain;
#ifdef TRACE
+#if USE_REENTRANT
+#define TPUTS_TRACE(s) _nc_set_tputs_trace(s);
+#else
+#define TPUTS_TRACE(s) _nc_tputs_trace = s;
+#endif
+
#define START_TRACE() \
if ((_nc_tracing & TRACE_MAXIMUM) == 0) { \
int t = _nc_getenv_num("NCURSES_TRACE"); \
@@ -894,9 +1168,21 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain;
trace((unsigned) t); \
}
-#define TR(n, a) if (_nc_tracing & (n)) _tracef a
+/*
+ * Many of the _tracef() calls use static buffers; lock the trace state before
+ * trying to fill them.
+ */
+#if USE_REENTRANT
+#define USE_TRACEF(mask) _nc_use_tracef(mask)
+extern NCURSES_EXPORT(int) _nc_use_tracef (unsigned);
+extern NCURSES_EXPORT(void) _nc_locked_tracef (const char *, ...) GCC_PRINTFLIKE(1,2);
+#else
+#define USE_TRACEF(mask) (_nc_tracing & (mask))
+#define _nc_locked_tracef _tracef
+#endif
+
+#define TR(n, a) if (USE_TRACEF(n)) _nc_locked_tracef a
#define T(a) TR(TRACE_CALLS, a)
-#define TPUTS_TRACE(s) _nc_tputs_trace = s;
#define TRACE_RETURN(value,type) return _nc_retrace_##type(value)
#define returnAttr(code) TRACE_RETURN(code,attr_t)
@@ -927,8 +1213,19 @@ extern NCURSES_EXPORT(int) _nc_retrace_int (int);
extern NCURSES_EXPORT(unsigned) _nc_retrace_unsigned (unsigned);
extern NCURSES_EXPORT(void *) _nc_retrace_void_ptr (void *);
extern NCURSES_EXPORT(void) _nc_fifo_dump (void);
+
+#if USE_REENTRANT
+NCURSES_WRAPPED_VAR(long, _nc_outchars);
+NCURSES_WRAPPED_VAR(const char *, _nc_tputs_trace);
+#define _nc_outchars NCURSES_PUBLIC_VAR(_nc_outchars())
+#define _nc_tputs_trace NCURSES_PUBLIC_VAR(_nc_tputs_trace())
+extern NCURSES_EXPORT(void) _nc_set_tputs_trace (const char *);
+extern NCURSES_EXPORT(void) _nc_count_outchars (long);
+#else
extern NCURSES_EXPORT_VAR(const char *) _nc_tputs_trace;
extern NCURSES_EXPORT_VAR(long) _nc_outchars;
+#endif
+
extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing;
#if USE_WIDEC_SUPPORT
@@ -1083,6 +1380,21 @@ extern NCURSES_EXPORT(int) _nc_to_char(wint_t);
extern NCURSES_EXPORT(wint_t) _nc_to_widechar(int);
#endif
+/* comp_captab.c */
+typedef struct {
+ short nte_name; /* offset of name to hash on */
+ int nte_type; /* BOOLEAN, NUMBER or STRING */
+ short nte_index; /* index of associated variable in its array */
+ short nte_link; /* index in table of next hash, or -1 */
+} name_table_data;
+
+typedef struct
+{
+ short from;
+ short to;
+ short source;
+} alias_table_data;
+
/* doupdate.c */
#if USE_XMC_SUPPORT
extern NCURSES_EXPORT(void) _nc_do_xmc_glitch (attr_t);
@@ -1141,6 +1453,7 @@ extern NCURSES_EXPORT(char *) _nc_get_locale(void);
extern NCURSES_EXPORT(int) _nc_unicode_locale(void);
extern NCURSES_EXPORT(int) _nc_locale_breaks_acs(void);
extern NCURSES_EXPORT(int) _nc_setupterm(NCURSES_CONST char *, int, int *, bool);
+extern NCURSES_EXPORT(void) _nc_get_screensize(int *, int *);
/* lib_tstp.c */
#if USE_SIGWINCH
@@ -1177,10 +1490,10 @@ extern NCURSES_EXPORT(char *) _nc_strstr (const char *, const char *);
extern NCURSES_EXPORT(char *) _nc_printf_string (const char *, va_list);
/* tries.c */
-extern NCURSES_EXPORT(void) _nc_add_to_try (struct tries **, const char *, unsigned);
-extern NCURSES_EXPORT(char *) _nc_expand_try (struct tries *, unsigned, int *, size_t);
-extern NCURSES_EXPORT(int) _nc_remove_key (struct tries **, unsigned);
-extern NCURSES_EXPORT(int) _nc_remove_string (struct tries **, const char *);
+extern NCURSES_EXPORT(int) _nc_add_to_try (TRIES **, const char *, unsigned);
+extern NCURSES_EXPORT(char *) _nc_expand_try (TRIES *, unsigned, int *, size_t);
+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 *);
@@ -1210,13 +1523,16 @@ extern NCURSES_EXPORT(void) _nc_scroll_optimize (void);
extern NCURSES_EXPORT(void) _nc_set_buffer (FILE *, bool);
extern NCURSES_EXPORT(void) _nc_signal_handler (bool);
extern NCURSES_EXPORT(void) _nc_synchook (WINDOW *);
-extern NCURSES_EXPORT(void) _nc_trace_tries (struct tries *);
+extern NCURSES_EXPORT(void) _nc_trace_tries (TRIES *);
#if NO_LEAKS
extern NCURSES_EXPORT(void) _nc_alloc_entry_leaks(void);
extern NCURSES_EXPORT(void) _nc_captoinfo_leaks(void);
+extern NCURSES_EXPORT(void) _nc_codes_leaks(void);
+extern NCURSES_EXPORT(void) _nc_comp_captab_leaks(void);
extern NCURSES_EXPORT(void) _nc_comp_scan_leaks(void);
extern NCURSES_EXPORT(void) _nc_keyname_leaks(void);
+extern NCURSES_EXPORT(void) _nc_names_leaks(void);
extern NCURSES_EXPORT(void) _nc_tgetent_leaks(void);
#endif
@@ -1227,11 +1543,7 @@ extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, NCURSES_SIZE
#endif
#if USE_WIDEC_SUPPORT && !defined(USE_TERMLIB)
-#ifdef linux
extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate_t *);
-#else
-#define _nc_wcrtomb(s,wc,ps) wcrtomb(s,wc,ps)
-#endif
#endif
#if USE_SIZECHANGE
diff --git a/contrib/ncurses/ncurses/llib-lncurses b/contrib/ncurses/ncurses/llib-lncurses
index 594c72c..bca3288 100644
--- a/contrib/ncurses/ncurses/llib-lncurses
+++ b/contrib/ncurses/ncurses/llib-lncurses
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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-2006 *
+ * Author: Thomas E. Dickey 1996-2007 *
****************************************************************************/
/* LINTLIBRARY */
@@ -1017,6 +1017,11 @@ int wstandend(
WINDOW *z)
{ return(*(int *)0); }
+#undef getattrs
+int getattrs(
+ const WINDOW *z)
+ { return(*(int *)0); }
+
#undef getcurx
int getcurx(
const WINDOW *z)
@@ -1057,6 +1062,68 @@ int getpary(
const WINDOW *z)
{ return(*(int *)0); }
+#undef wgetparent
+WINDOW *wgetparent(
+ const WINDOW *z)
+ { return(*(WINDOW **)0); }
+
+#undef is_cleared
+NCURSES_BOOL is_cleared(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_idcok
+NCURSES_BOOL is_idcok(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_idlok
+NCURSES_BOOL is_idlok(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_immedok
+NCURSES_BOOL is_immedok(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_keypad
+NCURSES_BOOL is_keypad(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_leaveok
+NCURSES_BOOL is_leaveok(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_nodelay
+NCURSES_BOOL is_nodelay(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_notimeout
+NCURSES_BOOL is_notimeout(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_scrollok
+NCURSES_BOOL is_scrollok(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_syncok
+NCURSES_BOOL is_syncok(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef wgetscrreg
+int wgetscrreg(
+ const WINDOW *a1,
+ int *a2,
+ int *z)
+ { return(*(int *)0); }
+
#undef mouse_trafo
NCURSES_BOOL mouse_trafo(
int *a1,
@@ -2093,40 +2160,11 @@ int _nc_env_access(void)
/* ./tinfo/add_tries.c */
#undef _nc_add_to_try
-void _nc_add_to_try(
- struct tries **tree,
+int _nc_add_to_try(
+ TRIES **tree,
const char *str,
unsigned code)
- { /* void */ }
-
-/* ./tinfo/alloc_entry.c */
-
-#undef _nc_init_entry
-void _nc_init_entry(
- TERMTYPE *const tp)
- { /* void */ }
-
-#undef _nc_copy_entry
-ENTRY *_nc_copy_entry(
- ENTRY *oldp)
- { return(*(ENTRY **)0); }
-
-#undef _nc_save_str
-char *_nc_save_str(
- const char *const string)
- { return(*(char **)0); }
-
-#undef _nc_wrap_entry
-void _nc_wrap_entry(
- ENTRY *const ep,
- NCURSES_BOOL copy_strings)
- { /* void */ }
-
-#undef _nc_merge_entry
-void _nc_merge_entry(
- TERMTYPE *const to,
- TERMTYPE *const from)
- { /* void */ }
+ { return(*(int *)0); }
/* ./tinfo/alloc_ttype.c */
@@ -2142,22 +2180,6 @@ void _nc_copy_termtype(
TERMTYPE *src)
{ /* void */ }
-/* ./tinfo/captoinfo.c */
-
-#undef _nc_captoinfo
-char *_nc_captoinfo(
- const char *cap,
- const char *s,
- int const parameterized)
- { return(*(char **)0); }
-
-#undef _nc_infotocap
-char *_nc_infotocap(
- const char *cap,
- const char *str,
- int const parameterized)
- { return(*(char **)0); }
-
/* ./codes.c */
#undef boolcodes
@@ -2167,31 +2189,7 @@ char *const numcodes[] = {0};
#undef strcodes
char *const strcodes[] = {0};
-/* ./comp_captab.c */
-
-#include <ncurses_cfg.h>
-
-#undef _nc_info_hash_table
-const struct name_table_entry *const _nc_info_hash_table[995] = {0};
-#undef _nc_cap_hash_table
-const struct name_table_entry *const _nc_cap_hash_table[995] = {0};
-#undef _nc_capalias_table
-const struct alias _nc_capalias_table[] = {0};
-#undef _nc_infoalias_table
-const struct alias _nc_infoalias_table[] = {0};
-
-#undef _nc_get_table
-const struct name_table_entry *_nc_get_table(
- NCURSES_BOOL termcap)
- { return(*(const struct name_table_entry **)0); }
-
-#undef _nc_get_hash_table
-const struct name_table_entry *const *_nc_get_hash_table(
- NCURSES_BOOL termcap)
- { return(*(const struct name_table_entry **)0); }
-
/* ./tinfo/comp_error.c */
-
#undef _nc_suppress_warnings
NCURSES_BOOL _nc_suppress_warnings;
#undef _nc_curr_line
@@ -2236,134 +2234,6 @@ void _nc_syserr_abort(
...)
{ /* void */ }
-/* ./tinfo/comp_expand.c */
-
-#undef _nc_tic_expand
-char *_nc_tic_expand(
- const char *srcp,
- NCURSES_BOOL tic_format,
- int numbers)
- { return(*(char **)0); }
-
-/* ./tinfo/comp_hash.c */
-
-#include <hashsize.h>
-
-#undef _nc_find_entry
-struct name_table_entry const *_nc_find_entry(
- const char *string,
- const struct name_table_entry *const *hash_table)
- { return(*(struct name_table_entry const **)0); }
-
-#undef _nc_find_type_entry
-struct name_table_entry const *_nc_find_type_entry(
- const char *string,
- int type,
- const struct name_table_entry *table)
- { return(*(struct name_table_entry const **)0); }
-
-/* ./tinfo/comp_parse.c */
-
-#undef _nc_check_termtype2
-void (*_nc_check_termtype2)(
- TERMTYPE *p1,
- NCURSES_BOOL p2);
-#undef _nc_check_termtype
-void (*_nc_check_termtype)(
- TERMTYPE *p1);
-#undef _nc_head
-ENTRY *_nc_head;
-#undef _nc_tail
-ENTRY *_nc_tail;
-
-#undef _nc_free_entries
-void _nc_free_entries(
- ENTRY *headp)
- { /* void */ }
-
-#undef _nc_delink_entry
-ENTRY *_nc_delink_entry(
- ENTRY *headp,
- TERMTYPE *tterm)
- { return(*(ENTRY **)0); }
-
-#undef _nc_free_entry
-void _nc_free_entry(
- ENTRY *headp,
- TERMTYPE *tterm)
- { /* void */ }
-
-#undef _nc_entry_match
-NCURSES_BOOL _nc_entry_match(
- char *n1,
- char *n2)
- { return(*(NCURSES_BOOL *)0); }
-
-#undef _nc_read_entry_source
-void _nc_read_entry_source(
- FILE *fp,
- char *buf,
- int literal,
- NCURSES_BOOL silent,
- NCURSES_BOOL (*hook)(
- ENTRY *p1))
- { /* void */ }
-
-#undef _nc_resolve_uses2
-int _nc_resolve_uses2(
- NCURSES_BOOL fullresolve,
- 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
-int _nc_syntax;
-#undef _nc_curr_file_pos
-long _nc_curr_file_pos;
-#undef _nc_comment_start
-long _nc_comment_start;
-#undef _nc_comment_end
-long _nc_comment_end;
-#undef _nc_start_line
-long _nc_start_line;
-#undef _nc_curr_token
-struct token _nc_curr_token;
-#undef _nc_disable_period
-NCURSES_BOOL _nc_disable_period;
-
-#undef _nc_reset_input
-void _nc_reset_input(
- FILE *fp,
- char *buf)
- { /* void */ }
-
-#undef _nc_get_token
-int _nc_get_token(
- NCURSES_BOOL silent)
- { return(*(int *)0); }
-
-#undef _nc_trans_string
-int _nc_trans_string(
- char *ptr,
- char *last)
- { return(*(int *)0); }
-
-#undef _nc_push_token
-void _nc_push_token(
- int tokclass)
- { /* void */ }
-
-#undef _nc_panic_mode
-void _nc_panic_mode(
- char ch)
- { /* void */ }
-
/* ./tinfo/db_iterator.c */
#undef _nc_tic_dir
@@ -2400,6 +2270,34 @@ void *_nc_doalloc(
size_t amount)
{ return(*(void **)0); }
+/* ./tinfo/entries.c */
+
+#undef _nc_head
+ENTRY *_nc_head;
+#undef _nc_tail
+ENTRY *_nc_tail;
+
+#undef _nc_free_entry
+void _nc_free_entry(
+ ENTRY *headp,
+ TERMTYPE *tterm)
+ { /* void */ }
+
+#undef _nc_free_entries
+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_fallback
@@ -2442,7 +2340,7 @@ char *_nc_home_terminfo(void)
#include <init_keytry.h>
#undef _nc_tinfo_fkeys
-struct tinfo_fkeys _nc_tinfo_fkeys[];
+const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0};
#endif
@@ -2509,6 +2407,10 @@ WINDOW *newscr;
SCREEN *_nc_screen_chain;
#undef SP
SCREEN *SP;
+#undef _nc_globals
+NCURSES_GLOBALS _nc_globals;
+#undef _nc_prescreen
+NCURSES_PRESCREEN _nc_prescreen;
/* ./tinfo/lib_has_cap.c */
@@ -2536,8 +2438,7 @@ int flushinp(void)
/* ./lib_keyname.c */
-#undef _nc_key_names
-const struct kn _nc_key_names[] = {0};
+struct kn { short offset; int code; };
#undef keyname
char *keyname(
@@ -2677,7 +2578,7 @@ int TABSIZE;
#undef _nc_handle_sigwinch
int _nc_handle_sigwinch(
- int enable)
+ int update)
{ return(*(int *)0); }
#undef use_env
@@ -2685,6 +2586,12 @@ void use_env(
NCURSES_BOOL f)
{ /* void */ }
+#undef _nc_get_screensize
+void _nc_get_screensize(
+ int *linep,
+ int *colp)
+ { /* void */ }
+
#undef _nc_update_screensize
void _nc_update_screensize(void)
{ /* void */ }
@@ -2785,14 +2692,6 @@ char *tigetstr(
/* ./tinfo/lib_tparm.c */
-typedef struct {
- union {
- int num;
- char *str;
- } data;
- NCURSES_BOOL num_type;
-} stack_frame;
-
#undef _nc_tparm_err
int _nc_tparm_err;
@@ -3047,26 +2946,6 @@ char *const strnames[] = {0};
#undef strfnames
char *const strfnames[] = {0};
-/* ./tinfo/parse_entry.c */
-
-#undef _nc_parse_entry
-int _nc_parse_entry(
- struct entry *entryp,
- int literal,
- NCURSES_BOOL silent)
- { return(*(int *)0); }
-
-#undef _nc_capcmp
-int _nc_capcmp(
- const char *s,
- const char *t)
- { return(*(int *)0); }
-
-typedef struct {
- const char *from;
- const char *to;
-} assoc;
-
/* ./tinfo/read_entry.c */
#include <hashed_db.h>
@@ -3144,11 +3023,6 @@ NCURSES_BOOL _nc_safe_strcpy(
/* ./trace/trace_buf.c */
-typedef struct {
- char *text;
- size_t size;
-} LIST;
-
#undef _nc_trace_buf
char *_nc_trace_buf(
int bufnum,
@@ -3165,14 +3039,14 @@ char *_nc_trace_bufcat(
#undef _nc_trace_tries
void _nc_trace_tries(
- struct tries *tree)
+ TRIES *tree)
{ /* void */ }
/* ./base/tries.c */
#undef _nc_expand_try
char *_nc_expand_try(
- struct tries *tree,
+ TRIES *tree,
unsigned code,
int *count,
size_t len)
@@ -3180,13 +3054,13 @@ char *_nc_expand_try(
#undef _nc_remove_key
int _nc_remove_key(
- struct tries **tree,
+ TRIES **tree,
unsigned code)
{ return(*(int *)0); }
#undef _nc_remove_string
int _nc_remove_string(
- struct tries **tree,
+ TRIES **tree,
const char *string)
{ return(*(int *)0); }
@@ -3236,6 +3110,195 @@ const char *_nc_viscbuf(
int len)
{ return(*(const char **)0); }
+/* ./tinfo/alloc_entry.c */
+
+#undef _nc_init_entry
+void _nc_init_entry(
+ TERMTYPE *const tp)
+ { /* void */ }
+
+#undef _nc_copy_entry
+ENTRY *_nc_copy_entry(
+ ENTRY *oldp)
+ { return(*(ENTRY **)0); }
+
+#undef _nc_save_str
+char *_nc_save_str(
+ const char *const string)
+ { return(*(char **)0); }
+
+#undef _nc_wrap_entry
+void _nc_wrap_entry(
+ ENTRY *const ep,
+ NCURSES_BOOL copy_strings)
+ { /* void */ }
+
+#undef _nc_merge_entry
+void _nc_merge_entry(
+ TERMTYPE *const to,
+ TERMTYPE *const from)
+ { /* void */ }
+
+/* ./tinfo/captoinfo.c */
+
+#undef _nc_captoinfo
+char *_nc_captoinfo(
+ const char *cap,
+ const char *s,
+ int const parameterized)
+ { return(*(char **)0); }
+
+#undef _nc_infotocap
+char *_nc_infotocap(
+ const char *cap,
+ const char *str,
+ int const parameterized)
+ { return(*(char **)0); }
+
+/* ./comp_captab.c */
+
+#include <hashsize.h>
+
+#undef _nc_get_table
+const struct name_table_entry *_nc_get_table(
+ NCURSES_BOOL termcap)
+ { return(*(const struct name_table_entry **)0); }
+
+#undef _nc_get_hash_table
+const short *_nc_get_hash_table(
+ NCURSES_BOOL termcap)
+ { return(*(const short **)0); }
+
+#undef _nc_get_alias_table
+const struct alias *_nc_get_alias_table(
+ NCURSES_BOOL termcap)
+ { return(*(const struct alias **)0); }
+
+/* ./tinfo/comp_expand.c */
+
+#undef _nc_tic_expand
+char *_nc_tic_expand(
+ const char *srcp,
+ NCURSES_BOOL tic_format,
+ int numbers)
+ { return(*(char **)0); }
+
+/* ./tinfo/comp_hash.c */
+
+#undef _nc_find_entry
+struct name_table_entry const *_nc_find_entry(
+ const char *string,
+ const short *hash_table)
+ { return(*(struct name_table_entry const **)0); }
+
+#undef _nc_find_type_entry
+struct name_table_entry const *_nc_find_type_entry(
+ const char *string,
+ int type,
+ const struct name_table_entry *table)
+ { return(*(struct name_table_entry const **)0); }
+
+/* ./tinfo/comp_parse.c */
+
+#undef _nc_check_termtype2
+void (*_nc_check_termtype2)(
+ TERMTYPE *p1,
+ NCURSES_BOOL p2);
+#undef _nc_check_termtype
+void (*_nc_check_termtype)(
+ TERMTYPE *p1);
+
+#undef _nc_entry_match
+NCURSES_BOOL _nc_entry_match(
+ char *n1,
+ char *n2)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_read_entry_source
+void _nc_read_entry_source(
+ FILE *fp,
+ char *buf,
+ int literal,
+ NCURSES_BOOL silent,
+ NCURSES_BOOL (*hook)(
+ ENTRY *p1))
+ { /* void */ }
+
+#undef _nc_resolve_uses2
+int _nc_resolve_uses2(
+ NCURSES_BOOL fullresolve,
+ 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
+int _nc_syntax;
+#undef _nc_curr_file_pos
+long _nc_curr_file_pos;
+#undef _nc_comment_start
+long _nc_comment_start;
+#undef _nc_comment_end
+long _nc_comment_end;
+#undef _nc_start_line
+long _nc_start_line;
+#undef _nc_curr_token
+struct token _nc_curr_token;
+#undef _nc_disable_period
+NCURSES_BOOL _nc_disable_period;
+
+#undef _nc_reset_input
+void _nc_reset_input(
+ FILE *fp,
+ char *buf)
+ { /* void */ }
+
+#undef _nc_get_token
+int _nc_get_token(
+ NCURSES_BOOL silent)
+ { return(*(int *)0); }
+
+#undef _nc_trans_string
+int _nc_trans_string(
+ char *ptr,
+ char *last)
+ { return(*(int *)0); }
+
+#undef _nc_push_token
+void _nc_push_token(
+ int tokclass)
+ { /* void */ }
+
+#undef _nc_panic_mode
+void _nc_panic_mode(
+ char ch)
+ { /* void */ }
+
+/* ./tinfo/parse_entry.c */
+
+#undef _nc_parse_entry
+int _nc_parse_entry(
+ struct entry *entryp,
+ int literal,
+ NCURSES_BOOL silent)
+ { return(*(int *)0); }
+
+#undef _nc_capcmp
+int _nc_capcmp(
+ const char *s,
+ const char *t)
+ { return(*(int *)0); }
+
+typedef struct {
+ const char *from;
+ const char *to;
+} assoc;
+
/* ./tinfo/write_entry.c */
#undef _nc_set_writedir
diff --git a/contrib/ncurses/ncurses/llib-lncursesw b/contrib/ncurses/ncurses/llib-lncursesw
index 86ef284..12522e1 100644
--- a/contrib/ncurses/ncurses/llib-lncursesw
+++ b/contrib/ncurses/ncurses/llib-lncursesw
@@ -1066,6 +1066,11 @@ int wstandend(
WINDOW *z)
{ return(*(int *)0); }
+#undef getattrs
+int getattrs(
+ const WINDOW *z)
+ { return(*(int *)0); }
+
#undef getcurx
int getcurx(
const WINDOW *z)
@@ -1106,6 +1111,68 @@ int getpary(
const WINDOW *z)
{ return(*(int *)0); }
+#undef wgetparent
+WINDOW *wgetparent(
+ const WINDOW *z)
+ { return(*(WINDOW **)0); }
+
+#undef is_cleared
+NCURSES_BOOL is_cleared(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_idcok
+NCURSES_BOOL is_idcok(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_idlok
+NCURSES_BOOL is_idlok(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_immedok
+NCURSES_BOOL is_immedok(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_keypad
+NCURSES_BOOL is_keypad(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_leaveok
+NCURSES_BOOL is_leaveok(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_nodelay
+NCURSES_BOOL is_nodelay(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_notimeout
+NCURSES_BOOL is_notimeout(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_scrollok
+NCURSES_BOOL is_scrollok(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_syncok
+NCURSES_BOOL is_syncok(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef wgetscrreg
+int wgetscrreg(
+ const WINDOW *a1,
+ int *a2,
+ int *z)
+ { return(*(int *)0); }
+
#undef add_wch
int add_wch(
const cchar_t *z)
@@ -2529,14 +2596,6 @@ int getcchar(
void *opts)
{ return(*(int *)0); }
-/* ./widechar/lib_get_wch.c */
-
-#undef wget_wch
-int wget_wch(
- WINDOW *win,
- wint_t *result)
- { return(*(int *)0); }
-
/* ./widechar/lib_erasewchar.c */
#undef erasewchar
@@ -2549,6 +2608,14 @@ int killwchar(
wchar_t *wch)
{ return(*(int *)0); }
+/* ./widechar/lib_get_wch.c */
+
+#undef wget_wch
+int wget_wch(
+ WINDOW *win,
+ wint_t *result)
+ { return(*(int *)0); }
+
/* ./widechar/lib_get_wstr.c */
#undef wgetn_wstr
@@ -2614,6 +2681,13 @@ int winwstr(
wchar_t *wstr)
{ return(*(int *)0); }
+/* ./widechar/lib_key_name.c */
+
+#undef key_name
+char *key_name(
+ wchar_t c)
+ { return(*(char **)0); }
+
/* ./widechar/lib_pecho_wchar.c */
#undef pecho_wchar
@@ -2832,40 +2906,11 @@ int _nc_env_access(void)
/* ./tinfo/add_tries.c */
#undef _nc_add_to_try
-void _nc_add_to_try(
- struct tries **tree,
+int _nc_add_to_try(
+ TRIES **tree,
const char *str,
unsigned code)
- { /* void */ }
-
-/* ./tinfo/alloc_entry.c */
-
-#undef _nc_init_entry
-void _nc_init_entry(
- TERMTYPE *const tp)
- { /* void */ }
-
-#undef _nc_copy_entry
-ENTRY *_nc_copy_entry(
- ENTRY *oldp)
- { return(*(ENTRY **)0); }
-
-#undef _nc_save_str
-char *_nc_save_str(
- const char *const string)
- { return(*(char **)0); }
-
-#undef _nc_wrap_entry
-void _nc_wrap_entry(
- ENTRY *const ep,
- NCURSES_BOOL copy_strings)
- { /* void */ }
-
-#undef _nc_merge_entry
-void _nc_merge_entry(
- TERMTYPE *const to,
- TERMTYPE *const from)
- { /* void */ }
+ { return(*(int *)0); }
/* ./tinfo/alloc_ttype.c */
@@ -2881,22 +2926,6 @@ void _nc_copy_termtype(
TERMTYPE *src)
{ /* void */ }
-/* ./tinfo/captoinfo.c */
-
-#undef _nc_captoinfo
-char *_nc_captoinfo(
- const char *cap,
- const char *s,
- int const parameterized)
- { return(*(char **)0); }
-
-#undef _nc_infotocap
-char *_nc_infotocap(
- const char *cap,
- const char *str,
- int const parameterized)
- { return(*(char **)0); }
-
/* ./codes.c */
#undef boolcodes
@@ -2906,31 +2935,7 @@ char *const numcodes[] = {0};
#undef strcodes
char *const strcodes[] = {0};
-/* ./comp_captab.c */
-
-#include <ncurses_cfg.h>
-
-#undef _nc_info_hash_table
-const struct name_table_entry *const _nc_info_hash_table[995] = {0};
-#undef _nc_cap_hash_table
-const struct name_table_entry *const _nc_cap_hash_table[995] = {0};
-#undef _nc_capalias_table
-const struct alias _nc_capalias_table[] = {0};
-#undef _nc_infoalias_table
-const struct alias _nc_infoalias_table[] = {0};
-
-#undef _nc_get_table
-const struct name_table_entry *_nc_get_table(
- NCURSES_BOOL termcap)
- { return(*(const struct name_table_entry **)0); }
-
-#undef _nc_get_hash_table
-const struct name_table_entry *const *_nc_get_hash_table(
- NCURSES_BOOL termcap)
- { return(*(const struct name_table_entry **)0); }
-
/* ./tinfo/comp_error.c */
-
#undef _nc_suppress_warnings
NCURSES_BOOL _nc_suppress_warnings;
#undef _nc_curr_line
@@ -2975,134 +2980,6 @@ void _nc_syserr_abort(
...)
{ /* void */ }
-/* ./tinfo/comp_expand.c */
-
-#undef _nc_tic_expand
-char *_nc_tic_expand(
- const char *srcp,
- NCURSES_BOOL tic_format,
- int numbers)
- { return(*(char **)0); }
-
-/* ./tinfo/comp_hash.c */
-
-#include <hashsize.h>
-
-#undef _nc_find_entry
-struct name_table_entry const *_nc_find_entry(
- const char *string,
- const struct name_table_entry *const *hash_table)
- { return(*(struct name_table_entry const **)0); }
-
-#undef _nc_find_type_entry
-struct name_table_entry const *_nc_find_type_entry(
- const char *string,
- int type,
- const struct name_table_entry *table)
- { return(*(struct name_table_entry const **)0); }
-
-/* ./tinfo/comp_parse.c */
-
-#undef _nc_check_termtype2
-void (*_nc_check_termtype2)(
- TERMTYPE *p1,
- NCURSES_BOOL p2);
-#undef _nc_check_termtype
-void (*_nc_check_termtype)(
- TERMTYPE *p1);
-#undef _nc_head
-ENTRY *_nc_head;
-#undef _nc_tail
-ENTRY *_nc_tail;
-
-#undef _nc_free_entries
-void _nc_free_entries(
- ENTRY *headp)
- { /* void */ }
-
-#undef _nc_delink_entry
-ENTRY *_nc_delink_entry(
- ENTRY *headp,
- TERMTYPE *tterm)
- { return(*(ENTRY **)0); }
-
-#undef _nc_free_entry
-void _nc_free_entry(
- ENTRY *headp,
- TERMTYPE *tterm)
- { /* void */ }
-
-#undef _nc_entry_match
-NCURSES_BOOL _nc_entry_match(
- char *n1,
- char *n2)
- { return(*(NCURSES_BOOL *)0); }
-
-#undef _nc_read_entry_source
-void _nc_read_entry_source(
- FILE *fp,
- char *buf,
- int literal,
- NCURSES_BOOL silent,
- NCURSES_BOOL (*hook)(
- ENTRY *p1))
- { /* void */ }
-
-#undef _nc_resolve_uses2
-int _nc_resolve_uses2(
- NCURSES_BOOL fullresolve,
- 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
-int _nc_syntax;
-#undef _nc_curr_file_pos
-long _nc_curr_file_pos;
-#undef _nc_comment_start
-long _nc_comment_start;
-#undef _nc_comment_end
-long _nc_comment_end;
-#undef _nc_start_line
-long _nc_start_line;
-#undef _nc_curr_token
-struct token _nc_curr_token;
-#undef _nc_disable_period
-NCURSES_BOOL _nc_disable_period;
-
-#undef _nc_reset_input
-void _nc_reset_input(
- FILE *fp,
- char *buf)
- { /* void */ }
-
-#undef _nc_get_token
-int _nc_get_token(
- NCURSES_BOOL silent)
- { return(*(int *)0); }
-
-#undef _nc_trans_string
-int _nc_trans_string(
- char *ptr,
- char *last)
- { return(*(int *)0); }
-
-#undef _nc_push_token
-void _nc_push_token(
- int tokclass)
- { /* void */ }
-
-#undef _nc_panic_mode
-void _nc_panic_mode(
- char ch)
- { /* void */ }
-
/* ./tinfo/db_iterator.c */
#undef _nc_tic_dir
@@ -3139,6 +3016,34 @@ void *_nc_doalloc(
size_t amount)
{ return(*(void **)0); }
+/* ./tinfo/entries.c */
+
+#undef _nc_head
+ENTRY *_nc_head;
+#undef _nc_tail
+ENTRY *_nc_tail;
+
+#undef _nc_free_entry
+void _nc_free_entry(
+ ENTRY *headp,
+ TERMTYPE *tterm)
+ { /* void */ }
+
+#undef _nc_free_entries
+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_fallback
@@ -3181,7 +3086,7 @@ char *_nc_home_terminfo(void)
#include <init_keytry.h>
#undef _nc_tinfo_fkeys
-struct tinfo_fkeys _nc_tinfo_fkeys[];
+const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0};
#endif
@@ -3248,6 +3153,10 @@ WINDOW *newscr;
SCREEN *_nc_screen_chain;
#undef SP
SCREEN *SP;
+#undef _nc_globals
+NCURSES_GLOBALS _nc_globals;
+#undef _nc_prescreen
+NCURSES_PRESCREEN _nc_prescreen;
/* ./tinfo/lib_has_cap.c */
@@ -3275,19 +3184,13 @@ int flushinp(void)
/* ./lib_keyname.c */
-#undef _nc_key_names
-const struct kn _nc_key_names[] = {0};
+struct kn { short offset; int code; };
#undef keyname
char *keyname(
int c)
{ return(*(char **)0); }
-#undef key_name
-char *key_name(
- wchar_t c)
- { return(*(char **)0); }
-
/* ./tinfo/lib_longname.c */
#undef longname
@@ -3421,7 +3324,7 @@ int TABSIZE;
#undef _nc_handle_sigwinch
int _nc_handle_sigwinch(
- int enable)
+ int update)
{ return(*(int *)0); }
#undef use_env
@@ -3429,6 +3332,12 @@ void use_env(
NCURSES_BOOL f)
{ /* void */ }
+#undef _nc_get_screensize
+void _nc_get_screensize(
+ int *linep,
+ int *colp)
+ { /* void */ }
+
#undef _nc_update_screensize
void _nc_update_screensize(void)
{ /* void */ }
@@ -3529,14 +3438,6 @@ char *tigetstr(
/* ./tinfo/lib_tparm.c */
-typedef struct {
- union {
- int num;
- char *str;
- } data;
- NCURSES_BOOL num_type;
-} stack_frame;
-
#undef _nc_tparm_err
int _nc_tparm_err;
@@ -3802,26 +3703,6 @@ char *const strnames[] = {0};
#undef strfnames
char *const strfnames[] = {0};
-/* ./tinfo/parse_entry.c */
-
-#undef _nc_parse_entry
-int _nc_parse_entry(
- struct entry *entryp,
- int literal,
- NCURSES_BOOL silent)
- { return(*(int *)0); }
-
-#undef _nc_capcmp
-int _nc_capcmp(
- const char *s,
- const char *t)
- { return(*(int *)0); }
-
-typedef struct {
- const char *from;
- const char *to;
-} assoc;
-
/* ./tinfo/read_entry.c */
#include <hashed_db.h>
@@ -3899,11 +3780,6 @@ NCURSES_BOOL _nc_safe_strcpy(
/* ./trace/trace_buf.c */
-typedef struct {
- char *text;
- size_t size;
-} LIST;
-
#undef _nc_trace_buf
char *_nc_trace_buf(
int bufnum,
@@ -3920,14 +3796,14 @@ char *_nc_trace_bufcat(
#undef _nc_trace_tries
void _nc_trace_tries(
- struct tries *tree)
+ TRIES *tree)
{ /* void */ }
/* ./base/tries.c */
#undef _nc_expand_try
char *_nc_expand_try(
- struct tries *tree,
+ TRIES *tree,
unsigned code,
int *count,
size_t len)
@@ -3935,13 +3811,13 @@ char *_nc_expand_try(
#undef _nc_remove_key
int _nc_remove_key(
- struct tries **tree,
+ TRIES **tree,
unsigned code)
{ return(*(int *)0); }
#undef _nc_remove_string
int _nc_remove_string(
- struct tries **tree,
+ TRIES **tree,
const char *string)
{ return(*(int *)0); }
@@ -4013,6 +3889,195 @@ const char *_nc_viscbuf(
int len)
{ return(*(const char **)0); }
+/* ./tinfo/alloc_entry.c */
+
+#undef _nc_init_entry
+void _nc_init_entry(
+ TERMTYPE *const tp)
+ { /* void */ }
+
+#undef _nc_copy_entry
+ENTRY *_nc_copy_entry(
+ ENTRY *oldp)
+ { return(*(ENTRY **)0); }
+
+#undef _nc_save_str
+char *_nc_save_str(
+ const char *const string)
+ { return(*(char **)0); }
+
+#undef _nc_wrap_entry
+void _nc_wrap_entry(
+ ENTRY *const ep,
+ NCURSES_BOOL copy_strings)
+ { /* void */ }
+
+#undef _nc_merge_entry
+void _nc_merge_entry(
+ TERMTYPE *const to,
+ TERMTYPE *const from)
+ { /* void */ }
+
+/* ./tinfo/captoinfo.c */
+
+#undef _nc_captoinfo
+char *_nc_captoinfo(
+ const char *cap,
+ const char *s,
+ int const parameterized)
+ { return(*(char **)0); }
+
+#undef _nc_infotocap
+char *_nc_infotocap(
+ const char *cap,
+ const char *str,
+ int const parameterized)
+ { return(*(char **)0); }
+
+/* ./comp_captab.c */
+
+#include <hashsize.h>
+
+#undef _nc_get_table
+const struct name_table_entry *_nc_get_table(
+ NCURSES_BOOL termcap)
+ { return(*(const struct name_table_entry **)0); }
+
+#undef _nc_get_hash_table
+const short *_nc_get_hash_table(
+ NCURSES_BOOL termcap)
+ { return(*(const short **)0); }
+
+#undef _nc_get_alias_table
+const struct alias *_nc_get_alias_table(
+ NCURSES_BOOL termcap)
+ { return(*(const struct alias **)0); }
+
+/* ./tinfo/comp_expand.c */
+
+#undef _nc_tic_expand
+char *_nc_tic_expand(
+ const char *srcp,
+ NCURSES_BOOL tic_format,
+ int numbers)
+ { return(*(char **)0); }
+
+/* ./tinfo/comp_hash.c */
+
+#undef _nc_find_entry
+struct name_table_entry const *_nc_find_entry(
+ const char *string,
+ const short *hash_table)
+ { return(*(struct name_table_entry const **)0); }
+
+#undef _nc_find_type_entry
+struct name_table_entry const *_nc_find_type_entry(
+ const char *string,
+ int type,
+ const struct name_table_entry *table)
+ { return(*(struct name_table_entry const **)0); }
+
+/* ./tinfo/comp_parse.c */
+
+#undef _nc_check_termtype2
+void (*_nc_check_termtype2)(
+ TERMTYPE *p1,
+ NCURSES_BOOL p2);
+#undef _nc_check_termtype
+void (*_nc_check_termtype)(
+ TERMTYPE *p1);
+
+#undef _nc_entry_match
+NCURSES_BOOL _nc_entry_match(
+ char *n1,
+ char *n2)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_read_entry_source
+void _nc_read_entry_source(
+ FILE *fp,
+ char *buf,
+ int literal,
+ NCURSES_BOOL silent,
+ NCURSES_BOOL (*hook)(
+ ENTRY *p1))
+ { /* void */ }
+
+#undef _nc_resolve_uses2
+int _nc_resolve_uses2(
+ NCURSES_BOOL fullresolve,
+ 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
+int _nc_syntax;
+#undef _nc_curr_file_pos
+long _nc_curr_file_pos;
+#undef _nc_comment_start
+long _nc_comment_start;
+#undef _nc_comment_end
+long _nc_comment_end;
+#undef _nc_start_line
+long _nc_start_line;
+#undef _nc_curr_token
+struct token _nc_curr_token;
+#undef _nc_disable_period
+NCURSES_BOOL _nc_disable_period;
+
+#undef _nc_reset_input
+void _nc_reset_input(
+ FILE *fp,
+ char *buf)
+ { /* void */ }
+
+#undef _nc_get_token
+int _nc_get_token(
+ NCURSES_BOOL silent)
+ { return(*(int *)0); }
+
+#undef _nc_trans_string
+int _nc_trans_string(
+ char *ptr,
+ char *last)
+ { return(*(int *)0); }
+
+#undef _nc_push_token
+void _nc_push_token(
+ int tokclass)
+ { /* void */ }
+
+#undef _nc_panic_mode
+void _nc_panic_mode(
+ char ch)
+ { /* void */ }
+
+/* ./tinfo/parse_entry.c */
+
+#undef _nc_parse_entry
+int _nc_parse_entry(
+ struct entry *entryp,
+ int literal,
+ NCURSES_BOOL silent)
+ { return(*(int *)0); }
+
+#undef _nc_capcmp
+int _nc_capcmp(
+ const char *s,
+ const char *t)
+ { return(*(int *)0); }
+
+typedef struct {
+ const char *from;
+ const char *to;
+} assoc;
+
/* ./tinfo/write_entry.c */
#undef _nc_set_writedir
diff --git a/contrib/ncurses/ncurses/modules b/contrib/ncurses/ncurses/modules
index 2e863da..f28ef81 100644
--- a/contrib/ncurses/ncurses/modules
+++ b/contrib/ncurses/ncurses/modules
@@ -1,6 +1,6 @@
-# $Id: modules,v 1.107 2006/08/12 14:19:44 tom Exp $
+# $Id: modules,v 1.112 2007/09/08 22:03:34 tom Exp $
##############################################################################
-# Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2006,2007 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"), #
@@ -127,14 +127,15 @@ charable lib $(wide)
lib_add_wch lib $(wide)
lib_box_set lib $(wide)
lib_cchar lib $(wide)
-lib_get_wch lib $(wide)
lib_erasewchar lib $(wide)
+lib_get_wch lib $(wide)
lib_get_wstr lib $(wide)
lib_hline_set lib $(wide)
lib_in_wch lib $(wide)
lib_in_wchnstr lib $(wide)
lib_ins_wch lib $(wide)
lib_inwstr lib $(wide)
+lib_key_name lib $(wide)
lib_pecho_wchar lib $(wide)
lib_slk_wset lib $(wide)
lib_unget_wch lib $(wide)
@@ -151,24 +152,20 @@ lib_dft_fgbg lib $(base) ../include/term.h
lib_print lib $(tinfo) ../include/term.h
resizeterm lib $(base) ../include/term.h
trace_xnames lib $(trace) ../include/term.h $(INCDIR)/term_entry.h
+use_screen lib $(tinfo)
+use_window lib $(base)
wresize lib $(base) ../include/term.h
# Support for termcap (and tic, etc.), which can be a separate library
@ termlib
access lib $(tinfo)
add_tries lib $(tinfo)
-alloc_entry lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h
alloc_ttype lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h
-captoinfo lib $(tinfo) $(INCDIR)/tic.h
codes lib .
-comp_captab lib . $(INCDIR)/tic.h ../include/term.h ../include/hashsize.h
comp_error lib $(tinfo) $(INCDIR)/tic.h
-comp_expand lib $(tinfo) $(INCDIR)/tic.h
-comp_hash lib $(tinfo) ../include/term.h $(INCDIR)/tic.h ../include/hashsize.h
-comp_parse lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h
-comp_scan lib $(tinfo) $(INCDIR)/tic.h
db_iterator lib $(tinfo) $(INCDIR)/tic.h
doalloc lib $(tinfo)
+entries lib $(tinfo) ../include/term.h $(INCDIR)/tic.h
fallback lib . ../include/term.h $(INCDIR)/tic.h
free_ttype lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h
getenv_num lib $(tinfo)
@@ -200,7 +197,6 @@ lib_ttyflags lib $(tinfo) ../include/term.h
lib_twait lib $(serial)
name_match lib $(tinfo) ../include/term.h $(INCDIR)/tic.h
names lib .
-parse_entry lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h ../include/parametrized.h $(INCDIR)/capdefaults.c
read_entry lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h
read_termcap lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h
setbuf lib $(tinfo)
@@ -211,6 +207,17 @@ tries lib $(base)
trim_sgr0 lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h
unctrl lib .
visbuf lib $(trace) $(INCDIR)/tic.h
+
+# Modules used only for tic, other programs using internal interfaces
+@ ticlib
+alloc_entry lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h
+captoinfo lib $(tinfo) $(INCDIR)/tic.h
+comp_captab lib . $(INCDIR)/tic.h ../include/term.h ../include/hashsize.h
+comp_expand lib $(tinfo) $(INCDIR)/tic.h
+comp_hash lib $(tinfo) ../include/term.h $(INCDIR)/tic.h ../include/hashsize.h
+comp_parse lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h
+comp_scan lib $(tinfo) $(INCDIR)/tic.h
+parse_entry lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h ../include/parametrized.h $(INCDIR)/capdefaults.c
write_entry lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h
# Extensions to the termlib library
@@ -221,3 +228,5 @@ key_defined lib $(base)
keybound lib $(base)
keyok lib $(base)
version lib $(base)
+
+# vile:makemode
diff --git a/contrib/ncurses/ncurses/tinfo/MKcaptab.awk b/contrib/ncurses/ncurses/tinfo/MKcaptab.awk
index 57087b8..56d3d17 100644
--- a/contrib/ncurses/ncurses/tinfo/MKcaptab.awk
+++ b/contrib/ncurses/ncurses/tinfo/MKcaptab.awk
@@ -1,6 +1,5 @@
-#!/bin/sh
##############################################################################
-# Copyright (c) 1998-2000,2006 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2006,2007 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,73 +25,70 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: MKcaptab.awk,v 1.13 2006/04/22 21:46:17 tom Exp $
-AWK=${1-awk}
-DATA=${2-../include/Caps}
-
-cat <<'EOF'
-/*
- * comp_captab.c -- The names of the capabilities indexed via a hash
- * table for the compiler.
- *
- */
-
-#include <ncurses_cfg.h>
-#include <curses.priv.h>
-#include <tic.h>
-#include <term.h>
-
-EOF
-
-./make_hash 1 info <$DATA
-./make_hash 3 cap <$DATA
-
-cat <<'EOF'
-const struct alias _nc_capalias_table[] =
-{
-EOF
+# $Id: MKcaptab.awk,v 1.20 2007/08/12 00:26:15 tom Exp $
+function add_string(text) {
+ if (text != "IGNORE") {
+ offsets[num_strings] = offset;
+ offset = offset + length(text) + 1;
+ printf "%s\\0", text;
+ } else {
+ offsets[num_strings] = -1;
+ }
+ num_strings = num_strings + 1;
+ if ((num_strings % 3) == 0) {
+ printf "\\\n";
+ }
+ return offsets[num_strings - 1];
+}
+BEGIN {
+ first = 1;
+ num_aliases = 0;
+ num_strings = 0;
+ offset = 0;
+}
-$AWK <$DATA '
-$1 == "capalias" {
- if ($3 == "IGNORE")
- to = "(char *)NULL";
- else
- to = "\"" $3 "\"";
- printf "\t{\"%s\", %s, \"%s\"},\t /* %s */\n",
- $2, to, $4, $5
+/^[^#]/ {
+ if (first) {
+ printf "/* generated by MKcaptab.awk %s(%d) */\n", tablename, bigstrings;
+ print ""
+ if (bigstrings) {
+ printf "static struct alias *_nc_%s_table = 0;\n", tablename;
+ print "";
+ printf "static const char %s_text[] = \"\\\n", tablename;
+ } else {
+ printf "static const struct alias _nc_%s_table[] =\n", tablename;
+ printf "{\n";
}
-'
-
-cat <<'EOF'
- {(char *)NULL, (char *)NULL, (char *)NULL}
-};
-
-const struct alias _nc_infoalias_table[] =
-{
-EOF
-
-$AWK <$DATA '
-$1 == "infoalias" {
- if ($3 == "IGNORE")
- to = "(char *)NULL";
- else
- to = "\"" $3 "\"";
- printf "\t{\"%s\", %s, \"%s\"},\t /* %s */\n",
- $2, to, $4, $5
+ first = 0;
+ }
+ if ($1 == tablename) {
+ if ($3 == "IGNORE") {
+ to = "(char *)NULL";
+ } else {
+ to = "\"" $3 "\"";
}
-'
-
-cat <<'EOF'
- {(char *)NULL, (char *)NULL, (char *)NULL}
-};
-
-NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool termcap)
-{
- return termcap ? _nc_cap_table: _nc_info_table ;
-}
-
-NCURSES_EXPORT(const struct name_table_entry * const *) _nc_get_hash_table (bool termcap)
-{
- return termcap ? _nc_cap_hash_table: _nc_info_hash_table ;
-}
-EOF
+ if (bigstrings) {
+ c1 = add_string($2);
+ c2 = add_string($3);
+ c3 = add_string($4);
+ aliases[num_aliases] = sprintf("\t{%5d, %5d, %5d},\t /* %s */", c1, c2, c3, $5);
+ num_aliases = num_aliases + 1;
+ } else {
+ printf "\t{\"%s\", %s, \"%s\"},\t /* %s */\n", $2, to, $4, $5;
+ }
+ }
+ }
+END {
+ if (bigstrings) {
+ printf "\";\n\n";
+ printf "static const alias_table_data %s_data[] = {\n", tablename;
+ for (n = 0; n < num_aliases; ++n) {
+ printf "%s\n", aliases[n];
+ }
+ printf "};\n\n";
+ } else {
+ printf "\t{(char *)NULL, (char *)NULL, (char *)NULL}\n";
+ printf "};\n\n";
+ }
+ }
+# vile:sw=4:
diff --git a/contrib/ncurses/ncurses/tinfo/MKcaptab.sh b/contrib/ncurses/ncurses/tinfo/MKcaptab.sh
new file mode 100644
index 0000000..98c04e8
--- /dev/null
+++ b/contrib/ncurses/ncurses/tinfo/MKcaptab.sh
@@ -0,0 +1,149 @@
+#!/bin/sh
+##############################################################################
+# Copyright (c) 2007 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: MKcaptab.sh,v 1.8 2007/08/12 13:13:51 tom Exp $
+AWK=${1-awk}
+OPT1=${2-0}
+OPT2=${3-tinfo/MKcaptab.awk}
+DATA=${4-../include/Caps}
+
+cat <<'EOF'
+/*
+ * comp_captab.c -- The names of the capabilities indexed via a hash
+ * table for the compiler.
+ *
+ */
+
+#include <curses.priv.h>
+#include <tic.h>
+#include <hashsize.h>
+
+EOF
+
+./make_hash 1 info $OPT1 <$DATA
+./make_hash 3 cap $OPT1 <$DATA
+
+$AWK -f $OPT2 bigstrings=$OPT1 tablename=capalias <$DATA
+
+$AWK -f $OPT2 bigstrings=$OPT1 tablename=infoalias <$DATA
+
+cat <<EOF
+
+#if $OPT1
+static void
+next_string(const char *strings, unsigned *offset)
+{
+ *offset += strlen(strings + *offset) + 1;
+}
+
+static const struct name_table_entry *
+_nc_build_names(struct name_table_entry **actual,
+ const name_table_data *source,
+ const char *strings)
+{
+ if (*actual == 0) {
+ *actual = typeCalloc(struct name_table_entry, CAPTABSIZE);
+ if (*actual != 0) {
+ unsigned n;
+ unsigned len = 0;
+ for (n = 0; n < CAPTABSIZE; ++n) {
+ (*actual)[n].nte_name = strings + len;
+ (*actual)[n].nte_type = source[n].nte_type;
+ (*actual)[n].nte_index = source[n].nte_index;
+ (*actual)[n].nte_link = source[n].nte_link;
+ next_string(strings, &len);
+ }
+ }
+ }
+ return *actual;
+}
+
+#define add_alias(field) \\
+ if (source[n].field >= 0) { \\
+ (*actual)[n].field = strings + source[n].field; \\
+ }
+
+static const struct alias *
+_nc_build_alias(struct alias **actual,
+ const alias_table_data *source,
+ const char *strings,
+ unsigned tablesize)
+{
+ if (*actual == 0) {
+ *actual = typeCalloc(struct alias, tablesize + 1);
+ if (*actual != 0) {
+ unsigned n;
+ for (n = 0; n < tablesize; ++n) {
+ add_alias(from);
+ add_alias(to);
+ add_alias(source);
+ }
+ }
+ }
+ return *actual;
+}
+
+#define build_names(root) _nc_build_names(&_nc_##root##_table, \\
+ root##_names_data, \\
+ root##_names_text)
+#define build_alias(root) _nc_build_alias(&_nc_##root##alias_table, \\
+ root##alias_data, \\
+ root##alias_text, \\
+ SIZEOF(root##alias_data))
+#else
+#define build_names(root) _nc_ ## root ## _table
+#define build_alias(root) _nc_ ## root ## alias_table
+#endif
+
+NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool termcap)
+{
+ return termcap ? build_names(cap) : build_names(info) ;
+}
+
+NCURSES_EXPORT(const short *) _nc_get_hash_table (bool termcap)
+{
+ return termcap ? _nc_cap_hash_table: _nc_info_hash_table ;
+}
+
+NCURSES_EXPORT(const struct alias *) _nc_get_alias_table (bool termcap)
+{
+ return termcap ? build_alias(cap) : build_alias(info) ;
+}
+
+#if NO_LEAKS
+NCURSES_EXPORT(void) _nc_comp_captab_leaks(void)
+{
+#if $OPT1
+ FreeIfNeeded(_nc_cap_table);
+ FreeIfNeeded(_nc_info_table);
+ FreeIfNeeded(_nc_capalias_table);
+ FreeIfNeeded(_nc_infoalias_table);
+#endif
+}
+#endif /* NO_LEAKS */
+EOF
diff --git a/contrib/ncurses/ncurses/tinfo/MKcodes.awk b/contrib/ncurses/ncurses/tinfo/MKcodes.awk
new file mode 100644
index 0000000..db8ad55
--- /dev/null
+++ b/contrib/ncurses/ncurses/tinfo/MKcodes.awk
@@ -0,0 +1,161 @@
+##############################################################################
+# Copyright (c) 1998-2006,2007 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: MKcodes.awk,v 1.4 2007/11/03 20:24:15 tom Exp $
+function large_item(value) {
+ result = sprintf("%d,", offset);
+ offset = offset + length(value) + 1;
+ offcol = offcol + length(result) + 2;
+ if (offcol > 70) {
+ result = result "\n";
+ offcol = 0;
+ } else {
+ result = result " ";
+ }
+ bigstr = bigstr sprintf("\"%s\\0\" ", value);
+ bigcol = bigcol + length(value) + 5;
+ if (bigcol > 70) {
+ bigstr = bigstr "\\\n";
+ bigcol = 0;
+ }
+ return result;
+}
+
+function small_item(value) {
+ return sprintf("\t\t\"%s\",\n", value);
+}
+
+function print_strings(name,value) {
+ printf "DCL(%s) = {\n", name
+ print value
+ print "\t\t(NCURSES_CONST char *)0,"
+ print "};"
+ print ""
+}
+
+function print_offsets(name,value) {
+ printf "static const short _nc_offset_%s[] = {\n", name
+ printf "%s", value
+ print "};"
+ print ""
+ printf "static NCURSES_CONST char ** ptr_%s = 0;\n", name
+ print ""
+}
+
+BEGIN {
+ print "/* This file was generated by MKcodes.awk */"
+ print ""
+ print "#include <curses.priv.h>"
+ print ""
+ print "#define IT NCURSES_CONST char * const"
+ print ""
+ offset = 0;
+ offcol = 0;
+ bigcol = 0;
+ }
+
+$1 ~ /^#/ {next;}
+
+$1 == "SKIPWARN" {next;}
+
+$3 == "bool" {
+ small_boolcodes = small_boolcodes small_item($4);
+ large_boolcodes = large_boolcodes large_item($4);
+ }
+
+$3 == "num" {
+ small_numcodes = small_numcodes small_item($4);
+ large_numcodes = large_numcodes large_item($4);
+ }
+
+$3 == "str" {
+ small_strcodes = small_strcodes small_item($4);
+ large_strcodes = large_strcodes large_item($4);
+ }
+
+END {
+ print ""
+ print "#if BROKEN_LINKER || USE_REENTRANT"
+ print ""
+ print "#include <term.h>"
+ print ""
+ if (bigstrings) {
+ printf "static const char _nc_code_blob[] = \n"
+ printf "%s;\n", bigstr;
+ print_offsets("boolcodes", large_boolcodes);
+ print_offsets("numcodes", large_numcodes);
+ print_offsets("strcodes", large_strcodes);
+ print ""
+ print "static IT *"
+ print "alloc_array(NCURSES_CONST char ***value, const short *offsets, unsigned size)"
+ print "{"
+ print " if (*value == 0) {"
+ print " if ((*value = typeCalloc(NCURSES_CONST char *, size + 1)) != 0) {"
+ print " unsigned n;"
+ print " for (n = 0; n < size; ++n) {"
+ print " (*value)[n] = _nc_code_blob + offsets[n];"
+ print " }"
+ print " }"
+ print " }"
+ print " return *value;"
+ print "}"
+ print ""
+ print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return alloc_array(&ptr_##it, _nc_offset_##it, SIZEOF(_nc_offset_##it)); }"
+ } else {
+ print "#define DCL(it) static IT data##it[]"
+ print ""
+ print_strings("boolcodes", small_boolcodes);
+ print_strings("numcodes", small_numcodes);
+ print_strings("strcodes", small_strcodes);
+ print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }"
+ }
+ print ""
+ print "FIX(boolcodes)"
+ print "FIX(numcodes)"
+ print "FIX(strcodes)"
+ print ""
+ print "#define FREE_FIX(it) if (ptr_##it) { FreeAndNull(ptr_##it); }"
+ print ""
+ print "NCURSES_EXPORT(void)"
+ print "_nc_codes_leaks(void)"
+ print "{"
+ if (bigstrings) {
+ print "FREE_FIX(boolcodes)"
+ print "FREE_FIX(numcodes)"
+ print "FREE_FIX(strcodes)"
+ }
+ print "}"
+ print "#else"
+ print ""
+ print "#define DCL(it) NCURSES_EXPORT_VAR(IT) it[]"
+ print ""
+ print_strings("boolcodes", small_boolcodes);
+ print_strings("numcodes", small_numcodes);
+ print_strings("strcodes", small_strcodes);
+ print ""
+ print "#endif /* BROKEN_LINKER */"
+ }
diff --git a/contrib/ncurses/ncurses/tinfo/MKnames.awk b/contrib/ncurses/ncurses/tinfo/MKnames.awk
index 6be00ad..93e682c 100644
--- a/contrib/ncurses/ncurses/tinfo/MKnames.awk
+++ b/contrib/ncurses/ncurses/tinfo/MKnames.awk
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 1998-2000,2006 Free Software Foundation, Inc. #
+# Copyright (c) 2007 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,101 +25,159 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: MKnames.awk,v 1.12 2006/04/22 21:46:17 tom Exp $
-BEGIN {
- print "/* This file was generated by MKnames.awk */" > "namehdr"
- print "" > "namehdr"
- print "#include <curses.priv.h>" > "namehdr"
- print "" > "namehdr"
- print "#define IT NCURSES_CONST char * const" > "namehdr"
- print "" > "namehdr"
- print "#if BROKEN_LINKER" > "namehdr"
- print "#include <term.h>" > "namehdr"
- print "#define DCL(it) static IT data##it[]" > "namehdr"
- print "#else" > "namehdr"
- print "#define DCL(it) NCURSES_EXPORT_VAR(IT) it[]" > "namehdr"
- print "#endif" > "namehdr"
- print "" > "namehdr"
- print "/*" > "boolnames"
- print " * names.c - Arrays of capability names and codes" > "boolnames"
- print " *" > "boolnames"
- print " */" > "boolnames"
- print "" > "boolnames"
- print "DCL(boolnames) = {" > "boolnames"
- print "DCL(boolfnames) = {" > "boolfnames"
- print "DCL(boolcodes) = {" > "boolcodes"
- print "DCL(numnames) = {" > "numnames"
- print "DCL(numfnames) = {" > "numfnames"
- print "DCL(numcodes) = {" > "numcodes"
- print "DCL(strnames) = {" > "strnames"
- print "DCL(strfnames) = {" > "strfnames"
- print "DCL(strcodes) = {" > "strcodes"
- }
+# $Id: MKnames.awk,v 1.18 2007/11/03 20:24:15 tom Exp $
+function large_item(value) {
+ result = sprintf("%d,", offset);
+ offset = offset + length(value) + 1;
+ offcol = offcol + length(result) + 2;
+ if (offcol > 70) {
+ result = result "\n";
+ offcol = 0;
+ } else {
+ result = result " ";
+ }
+ bigstr = bigstr sprintf("\"%s\\0\" ", value);
+ bigcol = bigcol + length(value) + 5;
+ if (bigcol > 70) {
+ bigstr = bigstr "\\\n";
+ bigcol = 0;
+ }
+ return result;
+}
+
+function small_item(value) {
+ return sprintf("\t\t\"%s\",\n", value);
+}
+
+function print_strings(name,value) {
+ printf "DCL(%s) = {\n", name
+ print value
+ print "\t\t(NCURSES_CONST char *)0,"
+ print "};"
+ print ""
+}
+
+function print_offsets(name,value) {
+ printf "static const short _nc_offset_%s[] = {\n", name
+ printf "%s", value
+ print "};"
+ print ""
+ printf "static NCURSES_CONST char ** ptr_%s = 0;\n", name
+ print ""
+}
+
+BEGIN {
+ print "/* This file was generated by MKnames.awk */"
+ print ""
+ print "#include <curses.priv.h>"
+ print ""
+ print "#define IT NCURSES_CONST char * const"
+ print ""
+ offset = 0;
+ offcol = 0;
+ bigcol = 0;
+ }
$1 ~ /^#/ {next;}
$1 == "SKIPWARN" {next;}
$3 == "bool" {
- printf "\t\t\"%s\",\n", $2 > "boolnames"
- printf "\t\t\"%s\",\n", $1 > "boolfnames"
- printf "\t\t\"%s\",\n", $4 > "boolcodes"
+ small_boolnames = small_boolnames small_item($2);
+ large_boolnames = large_boolnames large_item($2);
+ small_boolfnames = small_boolfnames small_item($1);
+ large_boolfnames = large_boolfnames large_item($1);
}
$3 == "num" {
- printf "\t\t\"%s\",\n", $2 > "numnames"
- printf "\t\t\"%s\",\n", $1 > "numfnames"
- printf "\t\t\"%s\",\n", $4 > "numcodes"
+ small_numnames = small_numnames small_item($2);
+ large_numnames = large_numnames large_item($2);
+ small_numfnames = small_numfnames small_item($1);
+ large_numfnames = large_numfnames large_item($1);
}
$3 == "str" {
- printf "\t\t\"%s\",\n", $2 > "strnames"
- printf "\t\t\"%s\",\n", $1 > "strfnames"
- printf "\t\t\"%s\",\n", $4 > "strcodes"
+ small_strnames = small_strnames small_item($2);
+ large_strnames = large_strnames large_item($2);
+ small_strfnames = small_strfnames small_item($1);
+ large_strfnames = large_strfnames large_item($1);
}
-END {
- print "\t\t(NCURSES_CONST char *)0," > "boolnames"
- print "};" > "boolnames"
- print "" > "boolnames"
- print "\t\t(NCURSES_CONST char *)0," > "boolfnames"
- print "};" > "boolfnames"
- print "" > "boolfnames"
- print "\t\t(NCURSES_CONST char *)0," > "boolcodes"
- print "};" > "boolcodes"
- print "" > "boolcodes"
- print "\t\t(NCURSES_CONST char *)0," > "numnames"
- print "};" > "numnames"
- print "" > "numnames"
- print "\t\t(NCURSES_CONST char *)0," > "numfnames"
- print "};" > "numfnames"
- print "" > "numfnames"
- print "\t\t(NCURSES_CONST char *)0," > "numcodes"
- print "};" > "numcodes"
- print "" > "numcodes"
- print "\t\t(NCURSES_CONST char *)0," > "strnames"
- print "};" > "strnames"
- print "" > "strnames"
- print "\t\t(NCURSES_CONST char *)0," > "strfnames"
- print "};" > "strfnames"
- print "" > "strfnames"
- print "\t\t(NCURSES_CONST char *)0," > "strcodes"
- print "};" > "strcodes"
- print "" > "strcodes"
- print "#if BROKEN_LINKER" > "nameftr"
- print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }" > "nameftr"
- print "FIX(boolnames)" > "nameftr"
- print "FIX(boolfnames)" > "nameftr"
- print "FIX(numnames)" > "nameftr"
- print "FIX(numfnames)" > "nameftr"
- print "FIX(strnames)" > "nameftr"
- print "FIX(strfnames)" > "nameftr"
- print "#endif /* BROKEN_LINKER */" > "nameftr"
- print "" > "codeftr"
- print "#if BROKEN_LINKER" > "codeftr"
- print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }" > "codeftr"
- print "FIX(boolcodes)" > "codeftr"
- print "FIX(numcodes)" > "codeftr"
- print "FIX(strcodes)" > "codeftr"
- print "#endif /* BROKEN_LINKER */" > "codeftr"
+END {
+ print ""
+ print "#if BROKEN_LINKER || USE_REENTRANT"
+ print ""
+ print "#include <term.h>"
+ print ""
+ if (bigstrings) {
+ printf "static const char _nc_name_blob[] = \n"
+ printf "%s;\n", bigstr;
+ print_offsets("boolfnames", large_boolfnames);
+ print_offsets("boolnames", large_boolnames);
+ print_offsets("numfnames", large_numfnames);
+ print_offsets("numnames", large_numnames);
+ print_offsets("strfnames", large_strfnames);
+ print_offsets("strnames", large_strnames);
+ print ""
+ print "static IT *"
+ print "alloc_array(NCURSES_CONST char ***value, const short *offsets, unsigned size)"
+ print "{"
+ print " if (*value == 0) {"
+ print " if ((*value = typeCalloc(NCURSES_CONST char *, size + 1)) != 0) {"
+ print " unsigned n;"
+ print " for (n = 0; n < size; ++n) {"
+ print " (*value)[n] = _nc_name_blob + offsets[n];"
+ print " }"
+ print " }"
+ print " }"
+ print " return *value;"
+ print "}"
+ print ""
+ print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return alloc_array(&ptr_##it, _nc_offset_##it, SIZEOF(_nc_offset_##it)); }"
+ } else {
+ print "#define DCL(it) static IT data##it[]"
+ print ""
+ print_strings("boolnames", small_boolnames);
+ print_strings("boolfnames", small_boolfnames);
+ print_strings("numnames", small_numnames);
+ print_strings("numfnames", small_numfnames);
+ print_strings("strnames", small_strnames);
+ print_strings("strfnames", small_strfnames);
+ print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }"
+ }
+ print ""
+ print "FIX(boolnames)"
+ print "FIX(boolfnames)"
+ print "FIX(numnames)"
+ print "FIX(numfnames)"
+ print "FIX(strnames)"
+ print "FIX(strfnames)"
+ print ""
+ print ""
+ print "#define FREE_FIX(it) if (ptr_##it) { FreeAndNull(ptr_##it); }"
+ print ""
+ print "NCURSES_EXPORT(void)"
+ print "_nc_names_leaks(void)"
+ print "{"
+ if (bigstrings) {
+ print "FREE_FIX(boolnames)"
+ print "FREE_FIX(boolfnames)"
+ print "FREE_FIX(numnames)"
+ print "FREE_FIX(numfnames)"
+ print "FREE_FIX(strnames)"
+ print "FREE_FIX(strfnames)"
}
+ print "}"
+ print "#else"
+ print ""
+ print "#define DCL(it) NCURSES_EXPORT_VAR(IT) it[]"
+ print ""
+ print_strings("boolnames", small_boolnames);
+ print_strings("boolfnames", small_boolfnames);
+ print_strings("numnames", small_numnames);
+ print_strings("numfnames", small_numfnames);
+ print_strings("strnames", small_strnames);
+ print_strings("strfnames", small_strfnames);
+ print ""
+ print "#endif /* BROKEN_LINKER */"
+ }
diff --git a/contrib/ncurses/ncurses/tinfo/access.c b/contrib/ncurses/ncurses/tinfo/access.c
index c10b7e0a..ce8ccda 100644
--- a/contrib/ncurses/ncurses/tinfo/access.c
+++ b/contrib/ncurses/ncurses/tinfo/access.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,12 +32,13 @@
#include <curses.priv.h>
+#include <ctype.h>
#include <sys/stat.h>
#include <tic.h>
#include <nc_alloc.h>
-MODULE_ID("$Id: access.c,v 1.12 2006/08/05 17:18:14 tom Exp $")
+MODULE_ID("$Id: access.c,v 1.14 2007/11/18 00:57:53 tom Exp $")
#define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c))
@@ -45,14 +46,13 @@ NCURSES_EXPORT(char *)
_nc_rootname(char *path)
{
char *result = _nc_basename(path);
-#if !defined(MIXEDCASE_FILENAMES) || defined(PROG_EXT)
+#if !MIXEDCASE_FILENAMES || defined(PROG_EXT)
static char *temp;
char *s;
temp = strdup(result);
result = temp;
-#if !defined(MIXEDCASE_FILENAMES)
- int n;
+#if !MIXEDCASE_FILENAMES
for (s = result; *s != '\0'; ++s) {
*s = LOWERCASE(*s);
}
diff --git a/contrib/ncurses/ncurses/tinfo/add_tries.c b/contrib/ncurses/ncurses/tinfo/add_tries.c
index 46c93b8..455d142e 100644
--- a/contrib/ncurses/ncurses/tinfo/add_tries.c
+++ b/contrib/ncurses/ncurses/tinfo/add_tries.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2006 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-on *
****************************************************************************/
/*
@@ -39,20 +39,20 @@
#include <curses.priv.h>
-MODULE_ID("$Id: add_tries.c,v 1.5 2005/11/20 01:32:48 tom Exp $")
+MODULE_ID("$Id: add_tries.c,v 1.8 2006/12/30 23:15:26 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))
-NCURSES_EXPORT(void)
-_nc_add_to_try(struct tries **tree, const char *str, unsigned code)
+NCURSES_EXPORT(int)
+_nc_add_to_try(TRIES ** tree, const char *str, unsigned code)
{
- static bool out_of_memory = FALSE;
- struct tries *ptr, *savedptr;
+ TRIES *ptr, *savedptr;
unsigned const char *txt = (unsigned const char *) str;
- if (txt == 0 || *txt == '\0' || out_of_memory || code == 0)
- return;
+ T((T_CALLED("_nc_add_to_try(%p, %s, %u)"), *tree, _nc_visbuf(str), code));
+ if (txt == 0 || *txt == '\0' || code == 0)
+ returnCode(ERR);
if ((*tree) != 0) {
ptr = savedptr = (*tree);
@@ -67,16 +67,15 @@ _nc_add_to_try(struct tries **tree, const char *str, unsigned code)
if (CMP_TRY(ptr->ch, cmp)) {
if (*(++txt) == '\0') {
ptr->value = code;
- return;
+ returnCode(OK);
}
if (ptr->child != 0)
ptr = ptr->child;
else
break;
} else {
- if ((ptr->sibling = typeCalloc(struct tries, 1)) == 0) {
- out_of_memory = TRUE;
- return;
+ if ((ptr->sibling = typeCalloc(TRIES, 1)) == 0) {
+ returnCode(ERR);
}
savedptr = ptr = ptr->sibling;
@@ -87,11 +86,10 @@ _nc_add_to_try(struct tries **tree, const char *str, unsigned code)
}
} /* end for (;;) */
} else { /* (*tree) == 0 :: First sequence to be added */
- savedptr = ptr = (*tree) = typeCalloc(struct tries, 1);
+ savedptr = ptr = (*tree) = typeCalloc(TRIES, 1);
if (ptr == 0) {
- out_of_memory = TRUE;
- return;
+ returnCode(ERR);
}
SET_TRY(ptr, txt);
@@ -101,19 +99,16 @@ _nc_add_to_try(struct tries **tree, const char *str, unsigned code)
/* at this point, we are adding to the try. ptr->child == 0 */
while (*txt) {
- ptr->child = typeCalloc(struct tries, 1);
+ ptr->child = typeCalloc(TRIES, 1);
ptr = ptr->child;
if (ptr == 0) {
- out_of_memory = TRUE;
-
while ((ptr = savedptr) != 0) {
savedptr = ptr->child;
free(ptr);
}
-
- return;
+ returnCode(ERR);
}
SET_TRY(ptr, txt);
@@ -121,5 +116,5 @@ _nc_add_to_try(struct tries **tree, const char *str, unsigned code)
}
ptr->value = code;
- return;
+ returnCode(OK);
}
diff --git a/contrib/ncurses/ncurses/tinfo/comp_error.c b/contrib/ncurses/ncurses/tinfo/comp_error.c
index 015f348..56c362a 100644
--- a/contrib/ncurses/ncurses/tinfo/comp_error.c
+++ b/contrib/ncurses/ncurses/tinfo/comp_error.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2007 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,36 +41,36 @@
#include <tic.h>
-MODULE_ID("$Id: comp_error.c,v 1.30 2005/11/26 15:28:47 tom Exp $")
+MODULE_ID("$Id: comp_error.c,v 1.31 2007/04/21 23:38:32 tom Exp $")
NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings = FALSE;
NCURSES_EXPORT_VAR(int) _nc_curr_line = 0; /* current line # in input */
NCURSES_EXPORT_VAR(int) _nc_curr_col = 0; /* current column # in input */
-static const char *sourcename;
-static char *termtype;
+#define SourceName _nc_globals.comp_sourcename
+#define TermType _nc_globals.comp_termtype
NCURSES_EXPORT(const char *)
_nc_get_source(void)
{
- return sourcename;
+ return SourceName;
}
NCURSES_EXPORT(void)
_nc_set_source(const char *const name)
{
- sourcename = name;
+ SourceName = name;
}
NCURSES_EXPORT(void)
_nc_set_type(const char *const name)
{
- if (termtype == 0)
- termtype = typeMalloc(char, MAX_NAME_SIZE + 1);
- if (termtype != 0) {
- termtype[0] = '\0';
+ if (TermType == 0)
+ TermType = typeMalloc(char, MAX_NAME_SIZE + 1);
+ if (TermType != 0) {
+ TermType[0] = '\0';
if (name)
- strncat(termtype, name, MAX_NAME_SIZE);
+ strncat(TermType, name, MAX_NAME_SIZE);
}
}
@@ -78,25 +78,25 @@ NCURSES_EXPORT(void)
_nc_get_type(char *name)
{
#if NO_LEAKS
- if (name == 0 && termtype != 0) {
- FreeAndNull(termtype);
+ if (name == 0 && TermType != 0) {
+ FreeAndNull(TermType);
return;
}
#endif
if (name != 0)
- strcpy(name, termtype != 0 ? termtype : "");
+ strcpy(name, TermType != 0 ? TermType : "");
}
static NCURSES_INLINE void
where_is_problem(void)
{
- fprintf(stderr, "\"%s\"", sourcename);
+ fprintf(stderr, "\"%s\"", SourceName ? SourceName : "?");
if (_nc_curr_line >= 0)
fprintf(stderr, ", line %d", _nc_curr_line);
if (_nc_curr_col >= 0)
fprintf(stderr, ", col %d", _nc_curr_col);
- if (termtype != 0 && termtype[0] != '\0')
- fprintf(stderr, ", terminal '%s'", termtype);
+ if (TermType != 0 && TermType[0] != '\0')
+ fprintf(stderr, ", terminal '%s'", TermType);
fputc(':', stderr);
fputc(' ', stderr);
}
diff --git a/contrib/ncurses/ncurses/tinfo/comp_hash.c b/contrib/ncurses/ncurses/tinfo/comp_hash.c
index d4d9eaa..8b85eee 100644
--- a/contrib/ncurses/ncurses/tinfo/comp_hash.c
+++ b/contrib/ncurses/ncurses/tinfo/comp_hash.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2007 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 @@
#define DEBUG(level, params) /*nothing */
#endif
-MODULE_ID("$Id: comp_hash.c,v 1.28 2005/08/20 19:58:18 tom Exp $")
+MODULE_ID("$Id: comp_hash.c,v 1.33 2007/08/18 21:42:25 tom Exp $")
static int hash_function(const char *);
@@ -71,21 +71,24 @@ static int hash_function(const char *);
static void
_nc_make_hash_table(struct name_table_entry *table,
- struct name_table_entry **hash_table)
+ short *hash_table)
{
int i;
int hashvalue;
int collisions = 0;
+ for (i = 0; i < HASHTABSIZE; i++) {
+ hash_table[i] = -1;
+ }
for (i = 0; i < CAPTABSIZE; i++) {
hashvalue = hash_function(table[i].nte_name);
- if (hash_table[hashvalue] != (struct name_table_entry *) 0)
+ if (hash_table[hashvalue] >= 0)
collisions++;
if (hash_table[hashvalue] != 0)
- table[i].nte_link = (short) (hash_table[hashvalue] - table);
- hash_table[hashvalue] = &table[i];
+ table[i].nte_link = hash_table[hashvalue];
+ hash_table[hashvalue] = i;
}
DEBUG(4, ("Hash table complete: %d collisions out of %d entries",
@@ -130,18 +133,21 @@ hash_function(const char *string)
#ifndef MAIN_PROGRAM
NCURSES_EXPORT(struct name_table_entry const *)
_nc_find_entry(const char *string,
- const struct name_table_entry *const *hash_table)
+ const short *hash_table)
{
int hashvalue;
- struct name_table_entry const *ptr;
+ struct name_table_entry const *ptr = 0;
+ struct name_table_entry const *real_table;
hashvalue = hash_function(string);
- if ((ptr = hash_table[hashvalue]) != 0) {
+ if (hash_table[hashvalue] >= 0) {
+ real_table = _nc_get_table(hash_table != _nc_get_hash_table(FALSE));
+ ptr = real_table + hash_table[hashvalue];
while (strcmp(ptr->nte_name, string) != 0) {
if (ptr->nte_link < 0)
return 0;
- ptr = ptr->nte_link + hash_table[HASHTABSIZE];
+ ptr = real_table + (ptr->nte_link + hash_table[HASHTABSIZE]);
}
}
@@ -231,10 +237,10 @@ main(int argc, char **argv)
{
struct name_table_entry *name_table = typeCalloc(struct
name_table_entry, CAPTABSIZE);
- struct name_table_entry **hash_table = typeCalloc(struct name_table_entry
- *, HASHTABSIZE);
+ short *hash_table = typeCalloc(short, HASHTABSIZE);
const char *root_name = "";
int column = 0;
+ int bigstring = 0;
int n;
char buffer[BUFSIZ];
@@ -248,11 +254,12 @@ main(int argc, char **argv)
/* The first argument is the column-number (starting with 0).
* The second is the root name of the tables to generate.
*/
- if (argc <= 2
+ if (argc <= 3
|| (column = atoi(argv[1])) <= 0
|| (column >= MAX_COLUMNS)
- || *(root_name = argv[2]) == 0) {
- fprintf(stderr, "usage: make_hash column root_name\n");
+ || *(root_name = argv[2]) == 0
+ || (bigstring = atoi(argv[3])) < 0) {
+ fprintf(stderr, "usage: make_hash column root_name bigstring\n");
exit(EXIT_FAILURE);
}
@@ -288,36 +295,64 @@ main(int argc, char **argv)
/*
* Write the compiled tables to standard output
*/
- printf("static struct name_table_entry const _nc_%s_table[] =\n",
- root_name);
- printf("{\n");
- for (n = 0; n < CAPTABSIZE; n++) {
- sprintf(buffer, "\"%s\"",
- name_table[n].nte_name);
- printf("\t{ %15s,\t%10s,\t%3d, %3d }%c\n",
- buffer,
- typenames[name_table[n].nte_type],
- name_table[n].nte_index,
- name_table[n].nte_link,
- n < CAPTABSIZE - 1 ? ',' : ' ');
+ if (bigstring) {
+ int len = 0;
+ int nxt;
+
+ printf("static const char %s_names_text[] = \\\n", root_name);
+ for (n = 0; n < CAPTABSIZE; n++) {
+ nxt = strlen(name_table[n].nte_name) + 5;
+ if (nxt + len > 72) {
+ printf("\\\n");
+ len = 0;
+ }
+ printf("\"%s\\0\" ", name_table[n].nte_name);
+ len += nxt;
+ }
+ printf(";\n\n");
+
+ len = 0;
+ printf("static name_table_data const %s_names_data[] =\n",
+ root_name);
+ printf("{\n");
+ for (n = 0; n < CAPTABSIZE; n++) {
+ printf("\t{ %15d,\t%10s,\t%3d, %3d }%c\n",
+ len,
+ typenames[name_table[n].nte_type],
+ name_table[n].nte_index,
+ name_table[n].nte_link,
+ n < CAPTABSIZE - 1 ? ',' : ' ');
+ len += strlen(name_table[n].nte_name) + 1;
+ }
+ printf("};\n\n");
+ printf("static struct name_table_entry *_nc_%s_table = 0;\n\n", root_name);
+ } else {
+
+ printf("static struct name_table_entry %s _nc_%s_table[] =\n",
+ bigstring ? "" : "const",
+ root_name);
+ printf("{\n");
+ for (n = 0; n < CAPTABSIZE; n++) {
+ sprintf(buffer, "\"%s\"",
+ name_table[n].nte_name);
+ printf("\t{ %15s,\t%10s,\t%3d, %3d }%c\n",
+ buffer,
+ typenames[name_table[n].nte_type],
+ name_table[n].nte_index,
+ name_table[n].nte_link,
+ n < CAPTABSIZE - 1 ? ',' : ' ');
+ }
+ printf("};\n\n");
}
- printf("};\n\n");
- printf("const struct name_table_entry * const _nc_%s_hash_table[%d] =\n",
+ printf("static const short _nc_%s_hash_table[%d] =\n",
root_name,
HASHTABSIZE + 1);
printf("{\n");
for (n = 0; n < HASHTABSIZE; n++) {
- if (hash_table[n] != 0) {
- sprintf(buffer, "_nc_%s_table + %3ld",
- root_name,
- (long) (hash_table[n] - name_table));
- } else {
- strcpy(buffer, "0");
- }
- printf("\t%s,\n", buffer);
+ printf("\t%3d,\n", hash_table[n]);
}
- printf("\t_nc_%s_table\t/* base-of-table */\n", root_name);
+ printf("\t0\t/* base-of-table */\n");
printf("};\n\n");
printf("#if (BOOLCOUNT!=%d)||(NUMCOUNT!=%d)||(STRCOUNT!=%d)\n",
diff --git a/contrib/ncurses/ncurses/tinfo/comp_parse.c b/contrib/ncurses/ncurses/tinfo/comp_parse.c
index 667b325..aa60047 100644
--- a/contrib/ncurses/ncurses/tinfo/comp_parse.c
+++ b/contrib/ncurses/ncurses/tinfo/comp_parse.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 *
@@ -53,7 +53,7 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$Id: comp_parse.c,v 1.63 2006/07/08 18:55:14 tom Exp $")
+MODULE_ID("$Id: comp_parse.c,v 1.68 2007/11/03 20:41:46 tom Exp $")
static void sanity_check2(TERMTYPE *, bool);
NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE *, bool) = sanity_check2;
@@ -62,30 +62,6 @@ NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE *, bool) = sanit
static void sanity_check(TERMTYPE *);
NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype) (TERMTYPE *) = sanity_check;
-/****************************************************************************
- *
- * Entry queue handling
- *
- ****************************************************************************/
-/*
- * The entry list is a doubly linked list with NULLs terminating the lists:
- *
- * --------- --------- ---------
- * | | | | | | offset
- * |-------| |-------| |-------|
- * | ----+-->| ----+-->| NULL | next
- * |-------| |-------| |-------|
- * | NULL |<--+---- |<--+---- | last
- * --------- --------- ---------
- * ^ ^
- * | |
- * | |
- * _nc_head _nc_tail
- */
-
-NCURSES_EXPORT_VAR(ENTRY *) _nc_head = 0;
-NCURSES_EXPORT_VAR(ENTRY *) _nc_tail = 0;
-
static void
enqueue(ENTRY * ep)
/* add an entry to the in-core list */
@@ -103,51 +79,6 @@ enqueue(ENTRY * ep)
newp->last->next = newp;
}
-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)
-/* delink the allocated storage for the given list entry */
-{
- ENTRY *ep, *last;
-
- for (last = 0, ep = headp; ep != 0; last = ep, ep = ep->next) {
- if (&(ep->tterm) == tterm) {
- if (last != 0) {
- last->next = ep->next;
- }
- if (ep == _nc_head) {
- _nc_head = ep->next;
- }
- if (ep == _nc_tail) {
- _nc_tail = last;
- }
- break;
- }
- }
- return ep;
-}
-
-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);
- }
-}
-
static char *
force_bar(char *dst, char *src)
{
@@ -534,3 +465,26 @@ sanity_check(TERMTYPE *tp)
{
sanity_check2(tp, FALSE);
}
+
+#if NO_LEAKS
+NCURSES_EXPORT(void)
+_nc_leaks_tic(void)
+{
+ _nc_alloc_entry_leaks();
+ _nc_captoinfo_leaks();
+ _nc_comp_captab_leaks();
+ _nc_comp_scan_leaks();
+#if BROKEN_LINKER || USE_REENTRANT
+ _nc_names_leaks();
+ _nc_codes_leaks();
+#endif
+ _nc_tic_expand(0, FALSE, 0);
+}
+
+NCURSES_EXPORT(void)
+_nc_free_tic(int code)
+{
+ _nc_leaks_tic();
+ _nc_free_tinfo(code);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/db_iterator.c b/contrib/ncurses/ncurses/tinfo/db_iterator.c
index e69aa5e..fdc2bb0 100644
--- a/contrib/ncurses/ncurses/tinfo/db_iterator.c
+++ b/contrib/ncurses/ncurses/tinfo/db_iterator.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2006 Free Software Foundation, Inc. *
+ * Copyright (c) 2006,2007 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 2006 *
+ * Author: Thomas E. Dickey *
****************************************************************************/
/*
@@ -38,10 +38,11 @@
#include <tic.h>
-MODULE_ID("$Id: db_iterator.c,v 1.5 2006/12/16 19:06:42 tom Exp $")
+MODULE_ID("$Id: db_iterator.c,v 1.6 2007/04/22 00:00:26 tom Exp $")
-static bool have_tic_directory = FALSE;
-static bool keep_tic_directory = FALSE;
+#define HaveTicDirectory _nc_globals.have_tic_directory
+#define KeepTicDirectory _nc_globals.keep_tic_directory
+#define TicDirectory _nc_globals.tic_directory
/*
* Record the "official" location of the terminfo directory, according to
@@ -50,19 +51,17 @@ static bool keep_tic_directory = FALSE;
NCURSES_EXPORT(const char *)
_nc_tic_dir(const char *path)
{
- static const char *result = TERMINFO;
-
- if (!keep_tic_directory) {
+ if (!KeepTicDirectory) {
if (path != 0) {
- result = path;
- have_tic_directory = TRUE;
- } else if (!have_tic_directory && use_terminfo_vars()) {
+ TicDirectory = path;
+ HaveTicDirectory = TRUE;
+ } else if (!HaveTicDirectory && use_terminfo_vars()) {
char *envp;
if ((envp = getenv("TERMINFO")) != 0)
return _nc_tic_dir(envp);
}
}
- return result;
+ return TicDirectory;
}
/*
@@ -74,16 +73,15 @@ NCURSES_EXPORT(void)
_nc_keep_tic_dir(const char *path)
{
_nc_tic_dir(path);
- keep_tic_directory = TRUE;
+ KeepTicDirectory = TRUE;
}
/*
* Process the list of :-separated directories, looking for the terminal type.
* We don't use strtok because it does not show us empty tokens.
*/
-
-static char *this_db_list = 0;
-static int size_db_list;
+#define ThisDbList _nc_globals.dbi_list
+#define ThisDbSize _nc_globals.dbi_size
/*
* Cleanup.
@@ -91,10 +89,10 @@ static int size_db_list;
NCURSES_EXPORT(void)
_nc_last_db(void)
{
- if (this_db_list != 0) {
- FreeAndNull(this_db_list);
+ if (ThisDbList != 0) {
+ FreeAndNull(ThisDbList);
}
- size_db_list = 0;
+ ThisDbSize = 0;
}
/* The TERMINFO_DIRS value, if defined by the configure script, begins with a
@@ -104,14 +102,14 @@ static const char *
next_list_item(const char *source, int *offset)
{
if (source != 0) {
- FreeIfNeeded(this_db_list);
- this_db_list = strdup(source);
- size_db_list = strlen(source);
+ FreeIfNeeded(ThisDbList);
+ ThisDbList = strdup(source);
+ ThisDbSize = strlen(source);
}
- if (this_db_list != 0 && size_db_list && *offset < size_db_list) {
+ if (ThisDbList != 0 && ThisDbSize && *offset < ThisDbSize) {
static char system_db[] = TERMINFO;
- char *result = this_db_list + *offset;
+ char *result = ThisDbList + *offset;
char *marker = strchr(result, NCURSES_PATHSEP);
/*
@@ -124,9 +122,9 @@ next_list_item(const char *source, int *offset)
marker = result + *offset;
} else {
*marker++ = 0;
- *offset = marker - this_db_list;
+ *offset = marker - ThisDbList;
}
- if (*result == 0 && result != (this_db_list + size_db_list))
+ if (*result == 0 && result != (ThisDbList + ThisDbSize))
result = system_db;
return result;
}
@@ -153,7 +151,7 @@ _nc_next_db(DBDIRS * state, int *offset)
switch (*state) {
case dbdTIC:
- if (have_tic_directory)
+ if (HaveTicDirectory)
result = _nc_tic_dir(0);
break;
#if USE_DATABASE
diff --git a/contrib/ncurses/ncurses/tinfo/entries.c b/contrib/ncurses/ncurses/tinfo/entries.c
new file mode 100644
index 0000000..8b63f0d
--- /dev/null
+++ b/contrib/ncurses/ncurses/tinfo/entries.c
@@ -0,0 +1,144 @@
+/****************************************************************************
+ * Copyright (c) 2006,2007 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>
+
+#include <ctype.h>
+
+#include <tic.h>
+#include <term_entry.h>
+
+MODULE_ID("$Id: entries.c,v 1.4 2007/11/03 21:00:27 tom Exp $")
+
+/****************************************************************************
+ *
+ * Entry queue handling
+ *
+ ****************************************************************************/
+/*
+ * The entry list is a doubly linked list with NULLs terminating the lists:
+ *
+ * --------- --------- ---------
+ * | | | | | | offset
+ * |-------| |-------| |-------|
+ * | ----+-->| ----+-->| NULL | next
+ * |-------| |-------| |-------|
+ * | NULL |<--+---- |<--+---- | last
+ * --------- --------- ---------
+ * ^ ^
+ * | |
+ * | |
+ * _nc_head _nc_tail
+ */
+
+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)
+/* delink the allocated storage for the given list entry */
+{
+ ENTRY *ep, *last;
+
+ for (last = 0, ep = headp; ep != 0; last = ep, ep = ep->next) {
+ if (&(ep->tterm) == tterm) {
+ if (last != 0) {
+ last->next = ep->next;
+ }
+ if (ep == _nc_head) {
+ _nc_head = ep->next;
+ }
+ if (ep == _nc_tail) {
+ _nc_tail = last;
+ }
+ break;
+ }
+ }
+ return ep;
+}
+
+NCURSES_EXPORT(void)
+_nc_leaks_tinfo(void)
+{
+ char *s;
+
+ T((T_CALLED("_nc_free_tinfo()")));
+#if NO_LEAKS
+ _nc_free_tparm();
+ _nc_tgetent_leaks();
+#endif
+ _nc_free_entries(_nc_head);
+ _nc_get_type(0);
+ _nc_first_name(0);
+#if NO_LEAKS
+ _nc_keyname_leaks();
+#endif
+#if BROKEN_LINKER || USE_REENTRANT
+ _nc_names_leaks();
+ _nc_codes_leaks();
+#endif
+
+ if ((s = _nc_home_terminfo()) != 0)
+ free(s);
+ returnVoid;
+}
+
+#if NO_LEAKS
+NCURSES_EXPORT(void)
+_nc_free_tinfo(int code)
+{
+ _nc_leaks_tinfo();
+ exit(code);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/home_terminfo.c b/contrib/ncurses/ncurses/tinfo/home_terminfo.c
index ce6576a..92c2670 100644
--- a/contrib/ncurses/ncurses/tinfo/home_terminfo.c
+++ b/contrib/ncurses/ncurses/tinfo/home_terminfo.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2007 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 1998,2000,2004,2005 *
+ * Author: Thomas E. Dickey *
****************************************************************************/
/*
@@ -37,31 +37,32 @@
#include <curses.priv.h>
#include <tic.h>
-MODULE_ID("$Id: home_terminfo.c,v 1.9 2005/07/02 19:43:38 tom Exp $")
+MODULE_ID("$Id: home_terminfo.c,v 1.10 2007/04/21 23:11:53 tom Exp $")
#define my_length (strlen(home) + sizeof(PRIVATE_INFO))
/* ncurses extension...fall back on user's private directory */
+#define MyBuffer _nc_globals.home_terminfo
+
NCURSES_EXPORT(char *)
_nc_home_terminfo(void)
{
char *result = 0;
-#ifdef USE_HOME_TERMINFO
+#if USE_HOME_TERMINFO
char *home;
- static char *temp = 0;
if (use_terminfo_vars()) {
- if (temp == 0) {
+ if (MyBuffer == 0) {
if ((home = getenv("HOME")) != 0
&& my_length <= PATH_MAX) {
- temp = typeMalloc(char, my_length);
- if (temp == 0)
+ MyBuffer = typeMalloc(char, my_length);
+ if (MyBuffer == 0)
_nc_err_abort(MSG_NO_MEMORY);
- (void) sprintf(temp, PRIVATE_INFO, home);
+ (void) sprintf(MyBuffer, PRIVATE_INFO, home);
}
}
- result = temp;
+ result = MyBuffer;
}
#endif
return result;
diff --git a/contrib/ncurses/ncurses/tinfo/init_keytry.c b/contrib/ncurses/ncurses/tinfo/init_keytry.c
index 3461dd4..d203210 100644
--- a/contrib/ncurses/ncurses/tinfo/init_keytry.c
+++ b/contrib/ncurses/ncurses/tinfo/init_keytry.c
@@ -36,7 +36,7 @@
#include <term_entry.h>
-MODULE_ID("$Id: init_keytry.c,v 1.8 2006/01/21 23:43:28 tom Exp $")
+MODULE_ID("$Id: init_keytry.c,v 1.10 2007/04/29 22:57:50 tom Exp $")
/*
** _nc_init_keytry()
@@ -56,7 +56,7 @@ MODULE_ID("$Id: init_keytry.c,v 1.8 2006/01/21 23:43:28 tom Exp $")
#endif*/
#if BROKEN_LINKER
-struct tinfo_fkeys *
+const struct tinfo_fkeys *
_nc_tinfo_fkeysf(void)
{
return _nc_tinfo_fkeys;
@@ -76,9 +76,9 @@ _nc_init_keytry(void)
if (SP != 0) {
for (n = 0; _nc_tinfo_fkeys[n].code; n++) {
if (_nc_tinfo_fkeys[n].offset < STRCOUNT) {
- _nc_add_to_try(&(SP->_keytry),
- CUR Strings[_nc_tinfo_fkeys[n].offset],
- _nc_tinfo_fkeys[n].code);
+ (void) _nc_add_to_try(&(SP->_keytry),
+ CUR Strings[_nc_tinfo_fkeys[n].offset],
+ _nc_tinfo_fkeys[n].code);
}
}
#if NCURSES_XNAMES
@@ -96,9 +96,9 @@ _nc_init_keytry(void)
&& *name == 'k'
&& value != 0
&& key_defined(value) == 0) {
- _nc_add_to_try(&(SP->_keytry),
- value,
- n - STRCOUNT + KEY_MAX);
+ (void) _nc_add_to_try(&(SP->_keytry),
+ value,
+ n - STRCOUNT + KEY_MAX);
}
}
}
diff --git a/contrib/ncurses/ncurses/tinfo/lib_acs.c b/contrib/ncurses/ncurses/tinfo/lib_acs.c
index 2719795..6a24285 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_acs.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_acs.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,17 +35,18 @@
#include <curses.priv.h>
#include <term.h> /* ena_acs, acs_chars */
-MODULE_ID("$Id: lib_acs.c,v 1.30 2006/01/07 21:27:15 tom Exp $")
+MODULE_ID("$Id: lib_acs.c,v 1.34 2007/09/29 20:37:13 tom Exp $")
-#if BROKEN_LINKER
+#if BROKEN_LINKER || USE_REENTRANT
+#define MyBuffer _nc_prescreen.real_acs_map
NCURSES_EXPORT_VAR(chtype *)
_nc_acs_map(void)
{
- static chtype *the_map = 0;
- if (the_map == 0)
- the_map = typeCalloc(chtype, ACS_LEN);
- return the_map;
+ if (MyBuffer == 0)
+ MyBuffer = typeCalloc(chtype, ACS_LEN);
+ return MyBuffer;
}
+#undef MyBuffer
#else
NCURSES_EXPORT_VAR(chtype) acs_map[ACS_LEN] =
{
@@ -117,16 +118,6 @@ _nc_init_acs(void)
real_map['|'] = '!'; /* should be not-equal */
real_map['}'] = 'f'; /* should be pound-sterling symbol */
-#if !USE_WIDEC_SUPPORT
- if (_nc_unicode_locale() && _nc_locale_breaks_acs()) {
- acs_chars = NULL;
- ena_acs = NULL;
- enter_alt_charset_mode = NULL;
- exit_alt_charset_mode = NULL;
- set_attributes = NULL;
- }
-#endif
-
if (ena_acs != NULL) {
TPUTS_TRACE("ena_acs");
putp(ena_acs);
@@ -175,7 +166,7 @@ _nc_init_acs(void)
/* Show the equivalent mapping, noting if it does not match the
* given attribute, whether by re-ordering or duplication.
*/
- if (_nc_tracing & TRACE_CALLS) {
+ if (USE_TRACEF(TRACE_CALLS)) {
size_t n, m;
char show[ACS_LEN * 2 + 1];
for (n = 1, m = 0; n < ACS_LEN; n++) {
@@ -196,6 +187,7 @@ _nc_init_acs(void)
? "DIFF"
: "SAME"),
_nc_visbuf(show));
+ _nc_unlock_global(tracef);
}
#endif /* TRACE */
}
diff --git a/contrib/ncurses/ncurses/tinfo/lib_baudrate.c b/contrib/ncurses/ncurses/tinfo/lib_baudrate.c
index 5238924..4070160 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_baudrate.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_baudrate.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000,2002 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,7 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
****************************************************************************/
/*
@@ -39,6 +40,9 @@
#include <curses.priv.h>
#include <term.h> /* cur_term, pad_char */
#include <termcap.h> /* ospeed */
+#if defined(__FreeBSD__)
+#include <sys/param.h>
+#endif
/*
* These systems use similar header files, which define B1200 as 1200, etc.,
@@ -46,7 +50,7 @@
* of the indices up to B115200 fit nicely in a 'short', allowing us to retain
* ospeed's type for compatibility.
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#if (defined(__FreeBSD__) && (__FreeBSD_version < 700000)) || defined(__NetBSD__) || defined(__OpenBSD__)
#undef B0
#undef B50
#undef B75
@@ -76,7 +80,7 @@
#undef USE_OLD_TTY
#endif /* USE_OLD_TTY */
-MODULE_ID("$Id: lib_baudrate.c,v 1.22 2002/01/19 23:07:53 Andrey.A.Chernov Exp $")
+MODULE_ID("$Id: lib_baudrate.c,v 1.25 2007/10/20 15:00:41 Rong-En.Fan Exp $")
/*
* int
@@ -141,16 +145,20 @@ static struct speed const speeds[] =
NCURSES_EXPORT(int)
_nc_baudrate(int OSpeed)
{
+#if !USE_REENTRANT
static int last_OSpeed;
static int last_baudrate;
+#endif
- int result;
+ int result = ERR;
unsigned i;
+#if !USE_REENTRANT
if (OSpeed == last_OSpeed) {
result = last_baudrate;
- } else {
- result = ERR;
+ }
+#endif
+ if (result == ERR) {
if (OSpeed >= 0) {
for (i = 0; i < SIZEOF(speeds); i++) {
if (speeds[i].s == OSpeed) {
@@ -159,7 +167,12 @@ _nc_baudrate(int OSpeed)
}
}
}
- last_baudrate = result;
+#if !USE_REENTRANT
+ if (OSpeed == last_OSpeed) {
+ last_OSpeed = OSpeed;
+ last_baudrate = result;
+ }
+#endif
}
return (result);
}
diff --git a/contrib/ncurses/ncurses/tinfo/lib_data.c b/contrib/ncurses/ncurses/tinfo/lib_data.c
index 34f033a..225935e 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_data.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_data.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2007 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,15 +41,33 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_data.c,v 1.17 2005/01/22 17:39:22 tom Exp $")
+MODULE_ID("$Id: lib_data.c,v 1.34 2007/10/20 21:49:10 tom Exp $")
/*
* OS/2's native linker complains if we don't initialize public data when
* constructing a dll (reported by J.J.G.Ripoll).
*/
+#if USE_REENTRANT
+NCURSES_EXPORT(WINDOW *)
+NCURSES_PUBLIC_VAR(stdscr) (void)
+{
+ return SP ? SP->_stdscr : 0;
+}
+NCURSES_EXPORT(WINDOW *)
+NCURSES_PUBLIC_VAR(curscr) (void)
+{
+ return SP ? SP->_curscr : 0;
+}
+NCURSES_EXPORT(WINDOW *)
+NCURSES_PUBLIC_VAR(newscr) (void)
+{
+ return SP ? SP->_newscr : 0;
+}
+#else
NCURSES_EXPORT_VAR(WINDOW *) stdscr = 0;
NCURSES_EXPORT_VAR(WINDOW *) curscr = 0;
NCURSES_EXPORT_VAR(WINDOW *) newscr = 0;
+#endif
NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain = 0;
@@ -87,3 +105,129 @@ _nc_set_screen(SCREEN *sp)
#else
NCURSES_EXPORT_VAR(SCREEN *) SP = NULL; /* Some linkers require initialized data... */
#endif
+/* *INDENT-OFF* */
+#define CHARS_0s { '\0' }
+
+#define TGETENT_0 { 0L, FALSE, NULL, NULL, NULL }
+#define TGETENT_0s { TGETENT_0, TGETENT_0, TGETENT_0, TGETENT_0 }
+
+NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
+ 0, /* have_sigwinch */
+ 0, /* cleanup_nested */
+
+ FALSE, /* init_signals */
+ FALSE, /* init_screen */
+
+ NULL, /* comp_sourcename */
+ NULL, /* comp_termtype */
+
+ FALSE, /* have_tic_directory */
+ FALSE, /* keep_tic_directory */
+ TERMINFO, /* tic_directory */
+
+ NULL, /* dbi_list */
+ 0, /* dbi_size */
+
+ NULL, /* first_name */
+ NULL, /* keyname_table */
+
+ NULL, /* safeprint_buf */
+ 0, /* safeprint_used */
+
+ TGETENT_0s, /* tgetent_cache */
+ 0, /* tgetent_index */
+ 0, /* tgetent_sequence */
+
+#if USE_HOME_TERMINFO
+ NULL, /* home_terminfo */
+#endif
+
+#if !USE_SAFE_SPRINTF
+ 0, /* safeprint_cols */
+ 0, /* safeprint_rows */
+#endif
+
+#ifdef TRACE
+ FALSE, /* init_trace */
+ CHARS_0s, /* trace_fname */
+ 0, /* trace_level */
+ NULL, /* trace_fp */
+
+ NULL, /* tracearg_buf */
+ 0, /* tracearg_used */
+
+ NULL, /* tracebuf_ptr */
+ 0, /* tracebuf_used */
+
+ CHARS_0s, /* tracechr_buf */
+
+ NULL, /* tracedmp_buf */
+ 0, /* tracedmp_used */
+
+ CHARS_0s, /* tracemse_buf */
+
+ NULL, /* tracetry_buf */
+ 0, /* tracetry_used */
+
+#ifndef USE_TERMLIB
+ { CHARS_0s, CHARS_0s }, /* traceatr_color_buf */
+ 0, /* traceatr_color_sel */
+ -1, /* traceatr_color_last */
+#endif /* USE_TERMLIB */
+
+#endif /* TRACE */
+#ifdef USE_PTHREADS
+ PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, /* mutex_set_SP */
+ PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, /* mutex_use_screen */
+ PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, /* mutex_use_window */
+ PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, /* mutex_windowlist */
+ PTHREAD_MUTEX_INITIALIZER, /* mutex_tst_tracef */
+ PTHREAD_MUTEX_INITIALIZER, /* mutex_tracef */
+ 0, /* nested_tracef */
+#endif
+};
+
+#define STACK_FRAME_0 { { 0 }, 0 }
+#define STACK_FRAME_0s { STACK_FRAME_0 }
+#define NUM_VARS_0s { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
+
+#define RIPOFF_0 { 0,0 }
+#define RIPOFF_0s { RIPOFF_0 }
+
+NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = {
+ TRUE, /* use_env */
+ FALSE, /* filter_mode */
+ A_NORMAL, /* previous_attr */
+ RIPOFF_0s, /* ripoff */
+ NULL, /* rsp */
+ { /* tparm_state */
+#ifdef TRACE
+ NULL, /* tname */
+#endif
+ NULL, /* tparam_base */
+
+ STACK_FRAME_0s, /* stack */
+ 0, /* stack_ptr */
+
+ NULL, /* out_buff */
+ 0, /* out_size */
+ 0, /* out_used */
+
+ NULL, /* fmt_buff */
+ 0, /* fmt_size */
+
+ NUM_VARS_0s, /* dynamic_var */
+ NUM_VARS_0s, /* static_vars */
+ },
+ NULL, /* saved_tty */
+#if BROKEN_LINKER || USE_REENTRANT
+ NULL, /* real_acs_map */
+ 0, /* LINES */
+ 0, /* COLS */
+#ifdef TRACE
+ 0L, /* _outchars */
+ NULL, /* _tputs_trace */
+#endif
+#endif
+};
+/* *INDENT-ON* */
diff --git a/contrib/ncurses/ncurses/tinfo/lib_options.c b/contrib/ncurses/ncurses/tinfo/lib_options.c
index bdb0b70..5cdd1d4 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_options.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_options.c
@@ -43,7 +43,7 @@
#include <term.h>
-MODULE_ID("$Id: lib_options.c,v 1.49 2006/03/04 19:28:25 tom Exp $")
+MODULE_ID("$Id: lib_options.c,v 1.50 2006/12/30 16:03:27 tom Exp $")
NCURSES_EXPORT(int)
idlok(WINDOW *win, bool flag)
@@ -220,7 +220,7 @@ typeahead(int fd)
#if NCURSES_EXT_FUNCS
static int
-has_key_internal(int keycode, struct tries *tp)
+has_key_internal(int keycode, TRIES *tp)
{
if (tp == 0)
return (FALSE);
diff --git a/contrib/ncurses/ncurses/tinfo/lib_raw.c b/contrib/ncurses/ncurses/tinfo/lib_raw.c
index aa09f52..58e7188 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_raw.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_raw.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2002,2007 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 *
@@ -49,7 +49,7 @@
#include <curses.priv.h>
#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_raw.c,v 1.13 2002/07/06 22:00:45 tom Exp $")
+MODULE_ID("$Id: lib_raw.c,v 1.14 2007/09/29 21:50:22 tom Exp $")
#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
@@ -69,8 +69,8 @@ MODULE_ID("$Id: lib_raw.c,v 1.13 2002/07/06 22:00:45 tom Exp $")
#define COOKED_INPUT (IXON|BRKINT|PARMRK)
#ifdef TRACE
-#define BEFORE(N) if (_nc_tracing&TRACE_BITS) _tracef("%s before bits: %s", N, _nc_tracebits())
-#define AFTER(N) if (_nc_tracing&TRACE_BITS) _tracef("%s after bits: %s", N, _nc_tracebits())
+#define BEFORE(N) if (USE_TRACEF(TRACE_BITS)) _nc_locked_tracef("%s before bits: %s", N, _nc_tracebits())
+#define AFTER(N) if (USE_TRACEF(TRACE_BITS)) _nc_locked_tracef("%s after bits: %s", N, _nc_tracebits())
#else
#define BEFORE(s)
#define AFTER(s)
diff --git a/contrib/ncurses/ncurses/tinfo/lib_setup.c b/contrib/ncurses/ncurses/tinfo/lib_setup.c
index 3508242..1a061e0 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_setup.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_setup.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 *
****************************************************************************/
/*
@@ -53,7 +53,7 @@
#include <term.h> /* lines, columns, cur_term */
-MODULE_ID("$Id: lib_setup.c,v 1.95 2006/07/28 22:58:13 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.100 2007/09/01 20:58:26 tom Exp $")
/****************************************************************************
*
@@ -99,55 +99,57 @@ MODULE_ID("$Id: lib_setup.c,v 1.95 2006/07/28 22:58:13 tom Exp $")
# endif
#endif
+#if USE_REENTRANT
+NCURSES_EXPORT(char *)
+NCURSES_PUBLIC_VAR(ttytype) (void)
+{
+ static char empty[] = "";
+ return cur_term ? cur_term->type.term_names : empty;
+}
+NCURSES_EXPORT(int)
+NCURSES_PUBLIC_VAR(LINES) (void)
+{
+ return (SP ? SP->_LINES : _nc_prescreen._LINES);
+}
+NCURSES_EXPORT(int)
+NCURSES_PUBLIC_VAR(COLS) (void)
+{
+ return SP ? SP->_COLS : _nc_prescreen._COLS;
+}
+NCURSES_EXPORT(int)
+NCURSES_PUBLIC_VAR(TABSIZE) (void)
+{
+ return SP ? SP->_TABSIZE : 8;
+}
+#else
NCURSES_EXPORT_VAR(char) ttytype[NAMESIZE] = "";
NCURSES_EXPORT_VAR(int) LINES = 0;
NCURSES_EXPORT_VAR(int) COLS = 0;
NCURSES_EXPORT_VAR(int) TABSIZE = 0;
-
-static int _use_env = TRUE;
+#endif
#if USE_SIGWINCH
-int
-_nc_handle_sigwinch(int enable)
+/*
+ * If we have a pending SIGWINCH, set the flag in each screen.
+ */
+NCURSES_EXPORT(int)
+_nc_handle_sigwinch(int update)
{
- static int have_sigwinch = 0; /* initially no SIGWINCH's */
- static int can_resizeall = 1; /* initially enabled */
SCREEN *scan;
- int result;
-
- switch (enable) {
- default:
- /* record a SIGWINCH */
- have_sigwinch = 1;
- break;
- case 0:
- /* temporarily disable the next block */
- --can_resizeall;
- break;
- case 1:
- /* temporarily enable the next block */
- ++can_resizeall;
- break;
- }
- /*
- * If we have a pending SIGWINCH, set the flag in each screen.
- * But do this only if the block is enabled.
- */
- if (can_resizeall-- >= 0) { /* test and disable */
- if (have_sigwinch) {
- scan = _nc_screen_chain;
- while (scan) {
- scan->_sig_winch = TRUE;
- scan = scan->_next_screen;
- }
- have_sigwinch = 0;
+ (void) update; /* no longer used */
+
+ if (_nc_globals.have_sigwinch) {
+ _nc_globals.have_sigwinch = 0;
+
+ scan = _nc_screen_chain;
+ while (scan) {
+ scan->_sig_winch = TRUE;
+ scan = scan->_next_screen;
}
}
- result = can_resizeall + 1; /* reenable (unless disables are nested) */
- can_resizeall = result;
- return result;
+ return (SP ? SP->_sig_winch : 0);
}
#endif
@@ -156,19 +158,20 @@ NCURSES_EXPORT(void)
use_env(bool f)
{
T((T_CALLED("use_env()")));
- _use_env = f;
+ _nc_prescreen.use_env = f;
returnVoid;
}
-static void
+NCURSES_EXPORT(void)
_nc_get_screensize(int *linep, int *colp)
/* Obtain lines/columns values from the environment and/or terminfo entry */
{
+ int my_tabsize;
+
/* figure out the size of the screen */
T(("screen size: terminfo lines = %d columns = %d", lines, columns));
- _nc_handle_sigwinch(0);
- if (!_use_env) {
+ if (!_nc_prescreen.use_env) {
*linep = (int) lines;
*colp = (int) columns;
} else { /* usually want to query LINES and COLUMNS from environment */
@@ -246,14 +249,20 @@ _nc_get_screensize(int *linep, int *colp)
lines = (short) (*linep);
columns = (short) (*colp);
}
- _nc_handle_sigwinch(1);
T(("screen size is %dx%d", *linep, *colp));
if (VALID_NUMERIC(init_tabs))
- TABSIZE = (int) init_tabs;
+ my_tabsize = (int) init_tabs;
else
- TABSIZE = 8;
+ my_tabsize = 8;
+
+#if USE_REENTRANT
+ if (SP != 0)
+ SP->_TABSIZE = my_tabsize;
+#else
+ TABSIZE = my_tabsize;
+#endif
T(("TABSIZE = %d", TABSIZE));
}
@@ -536,8 +545,10 @@ _nc_setupterm(NCURSES_CONST char *tname, int Filedes, int *errret, bool reuse)
if (command_character && getenv("CC"))
do_prototype();
+#if !USE_REENTRANT
strncpy(ttytype, cur_term->type.term_names, NAMESIZE - 1);
ttytype[NAMESIZE - 1] = '\0';
+#endif
cur_term->Filedes = Filedes;
cur_term->_termname = strdup(tname);
@@ -557,13 +568,16 @@ _nc_setupterm(NCURSES_CONST char *tname, int Filedes, int *errret, bool reuse)
/*
* We should always check the screensize, just in case.
*/
+#if USE_REENTRANT
+ _nc_get_screensize(SP ? &(SP->_LINES) : &(_nc_prescreen._LINES),
+ SP ? &(SP->_COLS) : &(_nc_prescreen._COLS));
+#else
_nc_get_screensize(&LINES, &COLS);
+#endif
if (errret)
*errret = TGETENT_YES;
- T((T_CREATE("screen %s %dx%d"), tname, LINES, COLS));
-
if (generic_type) {
ret_error(TGETENT_NO, "'%s': I need something more specific.\n", tname);
}
diff --git a/contrib/ncurses/ncurses/tinfo/lib_termcap.c b/contrib/ncurses/ncurses/tinfo/lib_termcap.c
index 33e15c5..ff97eea 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_termcap.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_termcap.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,26 +45,20 @@
#include <term_entry.h>
-MODULE_ID("$Id: lib_termcap.c,v 1.58 2006/09/02 19:39:46 Miroslav.Lichvar Exp $")
+MODULE_ID("$Id: lib_termcap.c,v 1.61 2007/06/02 19:36:03 tom Exp $")
NCURSES_EXPORT_VAR(char *) UP = 0;
NCURSES_EXPORT_VAR(char *) BC = 0;
-typedef struct {
- long sequence;
- char *fix_sgr0; /* this holds the filtered sgr0 string */
- char *last_bufp; /* help with fix_sgr0 leak */
- TERMINAL *last_term;
-} CACHE;
+#define MyCache _nc_globals.tgetent_cache
+#define CacheInx _nc_globals.tgetent_index
+#define CacheSeq _nc_globals.tgetent_sequence
-#define MAX_CACHE 4
-static CACHE cache[MAX_CACHE];
-static int in_cache = 0;
-
-#define FIX_SGR0 cache[in_cache].fix_sgr0
-#define LAST_TRM cache[in_cache].last_term
-#define LAST_BUF cache[in_cache].last_bufp
-#define LAST_SEQ cache[in_cache].sequence
+#define FIX_SGR0 MyCache[CacheInx].fix_sgr0
+#define LAST_TRM MyCache[CacheInx].last_term
+#define LAST_BUF MyCache[CacheInx].last_bufp
+#define LAST_USE MyCache[CacheInx].last_used
+#define LAST_SEQ MyCache[CacheInx].sequence
/***************************************************************************
*
@@ -84,8 +78,6 @@ static int in_cache = 0;
NCURSES_EXPORT(int)
tgetent(char *bufp, const char *name)
{
- static long sequence;
-
int errcode;
int n;
bool found_cache = FALSE;
@@ -100,11 +92,17 @@ tgetent(char *bufp, const char *name)
* caller, but if tgetent() is called with the same buffer, that is
* good enough, since the previous data would be invalidated by the
* current call.
+ *
+ * bufp may be a null pointer, e.g., GNU termcap. That allocates data,
+ * which is good until the next tgetent() call. The conventional termcap
+ * is inconvenient because of the fixed buffer size, but because it uses
+ * caller-supplied buffers, can have multiple terminal descriptions in
+ * use at a given time.
*/
- for (n = 0; n < MAX_CACHE; ++n) {
- bool same_result = (bufp != 0 && cache[n].last_bufp == bufp);
+ for (n = 0; n < TGETENT_MAX; ++n) {
+ bool same_result = (MyCache[n].last_used && MyCache[n].last_bufp == bufp);
if (same_result) {
- in_cache = n;
+ CacheInx = n;
if (FIX_SGR0 != 0) {
FreeAndNull(FIX_SGR0);
}
@@ -114,10 +112,10 @@ tgetent(char *bufp, const char *name)
if (LAST_TRM != 0 && LAST_TRM != cur_term) {
TERMINAL *trm = LAST_TRM;
del_curterm(LAST_TRM);
- for (in_cache = 0; in_cache < MAX_CACHE; ++in_cache)
+ for (CacheInx = 0; CacheInx < TGETENT_MAX; ++CacheInx)
if (LAST_TRM == trm)
LAST_TRM = 0;
- in_cache = n;
+ CacheInx = n;
}
found_cache = TRUE;
break;
@@ -126,15 +124,15 @@ tgetent(char *bufp, const char *name)
if (!found_cache) {
int best = 0;
- for (in_cache = 0; in_cache < MAX_CACHE; ++in_cache) {
- if (LAST_SEQ < cache[best].sequence) {
- best = in_cache;
+ for (CacheInx = 0; CacheInx < TGETENT_MAX; ++CacheInx) {
+ if (LAST_SEQ < MyCache[best].sequence) {
+ best = CacheInx;
}
}
- in_cache = best;
+ CacheInx = best;
}
LAST_TRM = cur_term;
- LAST_SEQ = ++sequence;
+ LAST_SEQ = ++CacheSeq;
PC = 0;
UP = 0;
@@ -164,6 +162,7 @@ tgetent(char *bufp, const char *name)
}
}
LAST_BUF = bufp;
+ LAST_USE = TRUE;
(void) baudrate(); /* sets ospeed as a side-effect */
@@ -282,9 +281,10 @@ tgetstr(NCURSES_CONST char *id, char **area)
NCURSES_EXPORT(void)
_nc_tgetent_leaks(void)
{
- for (in_cache = 0; in_cache < MAX_CACHE; ++in_cache) {
+ for (CacheInx = 0; CacheInx < TGETENT_MAX; ++CacheInx) {
FreeIfNeeded(FIX_SGR0);
- del_curterm(LAST_TRM);
+ if (LAST_TRM != 0)
+ del_curterm(LAST_TRM);
}
}
#endif
diff --git a/contrib/ncurses/ncurses/tinfo/lib_tparm.c b/contrib/ncurses/ncurses/tinfo/lib_tparm.c
index cba31d9..d11fcf8 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_tparm.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_tparm.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 <term.h>
#include <tic.h>
-MODULE_ID("$Id: lib_tparm.c,v 1.71 2006/11/26 01:12:56 tom Exp $")
+MODULE_ID("$Id: lib_tparm.c,v 1.74 2007/09/29 20:37:13 tom Exp $")
/*
* char *
@@ -105,43 +105,20 @@ MODULE_ID("$Id: lib_tparm.c,v 1.71 2006/11/26 01:12:56 tom Exp $")
* resulting in x mod y, not the reverse.
*/
-#define STACKSIZE 20
-
-typedef struct {
- union {
- int num;
- char *str;
- } data;
- bool num_type;
-} stack_frame;
-
NCURSES_EXPORT_VAR(int) _nc_tparm_err = 0;
-static stack_frame stack[STACKSIZE];
-static int stack_ptr;
-static const char *tparam_base = "";
-
-#ifdef TRACE
-static const char *tname;
-#endif /* TRACE */
-
-static char *out_buff;
-static size_t out_size;
-static size_t out_used;
-
-static char *fmt_buff;
-static size_t fmt_size;
+#define TPS(var) _nc_prescreen.tparm_state.var
#if NO_LEAKS
NCURSES_EXPORT(void)
_nc_free_tparm(void)
{
- if (out_buff != 0) {
- FreeAndNull(out_buff);
- out_size = 0;
- out_used = 0;
- FreeAndNull(fmt_buff);
- fmt_size = 0;
+ if (TPS(out_buff) != 0) {
+ FreeAndNull(TPS(out_buff));
+ TPS(out_size) = 0;
+ TPS(out_used) = 0;
+ FreeAndNull(TPS(fmt_buff));
+ TPS(fmt_size) = 0;
}
}
#endif
@@ -149,11 +126,11 @@ _nc_free_tparm(void)
static NCURSES_INLINE void
get_space(size_t need)
{
- need += out_used;
- if (need > out_size) {
- out_size = need * 2;
- out_buff = typeRealloc(char, out_size, out_buff);
- if (out_buff == 0)
+ need += TPS(out_used);
+ if (need > TPS(out_size)) {
+ TPS(out_size) = need * 2;
+ TPS(out_buff) = typeRealloc(char, TPS(out_size), TPS(out_buff));
+ if (TPS(out_buff) == 0)
_nc_err_abort(MSG_NO_MEMORY);
}
}
@@ -167,8 +144,8 @@ save_text(const char *fmt, const char *s, int len)
get_space(s_len + 1);
- (void) sprintf(out_buff + out_used, fmt, s);
- out_used += strlen(out_buff + out_used);
+ (void) sprintf(TPS(out_buff) + TPS(out_used), fmt, s);
+ TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used));
}
static NCURSES_INLINE void
@@ -179,8 +156,8 @@ save_number(const char *fmt, int number, int len)
get_space((unsigned) len + 1);
- (void) sprintf(out_buff + out_used, fmt, number);
- out_used += strlen(out_buff + out_used);
+ (void) sprintf(TPS(out_buff) + TPS(out_used), fmt, number);
+ TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used));
}
static NCURSES_INLINE void
@@ -189,18 +166,18 @@ save_char(int c)
if (c == 0)
c = 0200;
get_space(1);
- out_buff[out_used++] = c;
+ TPS(out_buff)[TPS(out_used)++] = c;
}
static NCURSES_INLINE void
npush(int x)
{
- if (stack_ptr < STACKSIZE) {
- stack[stack_ptr].num_type = TRUE;
- stack[stack_ptr].data.num = x;
- stack_ptr++;
+ if (TPS(stack_ptr) < STACKSIZE) {
+ TPS(stack)[TPS(stack_ptr)].num_type = TRUE;
+ TPS(stack)[TPS(stack_ptr)].data.num = x;
+ TPS(stack_ptr)++;
} else {
- DEBUG(2, ("npush: stack overflow: %s", _nc_visbuf(tparam_base)));
+ DEBUG(2, ("npush: stack overflow: %s", _nc_visbuf(TPS(tparam_base))));
_nc_tparm_err++;
}
}
@@ -209,12 +186,12 @@ static NCURSES_INLINE int
npop(void)
{
int result = 0;
- if (stack_ptr > 0) {
- stack_ptr--;
- if (stack[stack_ptr].num_type)
- result = stack[stack_ptr].data.num;
+ if (TPS(stack_ptr) > 0) {
+ TPS(stack_ptr)--;
+ if (TPS(stack)[TPS(stack_ptr)].num_type)
+ result = TPS(stack)[TPS(stack_ptr)].data.num;
} else {
- DEBUG(2, ("npop: stack underflow: %s", _nc_visbuf(tparam_base)));
+ DEBUG(2, ("npop: stack underflow: %s", _nc_visbuf(TPS(tparam_base))));
_nc_tparm_err++;
}
return result;
@@ -223,12 +200,12 @@ npop(void)
static NCURSES_INLINE void
spush(char *x)
{
- if (stack_ptr < STACKSIZE) {
- stack[stack_ptr].num_type = FALSE;
- stack[stack_ptr].data.str = x;
- stack_ptr++;
+ if (TPS(stack_ptr) < STACKSIZE) {
+ TPS(stack)[TPS(stack_ptr)].num_type = FALSE;
+ TPS(stack)[TPS(stack_ptr)].data.str = x;
+ TPS(stack_ptr)++;
} else {
- DEBUG(2, ("spush: stack overflow: %s", _nc_visbuf(tparam_base)));
+ DEBUG(2, ("spush: stack overflow: %s", _nc_visbuf(TPS(tparam_base))));
_nc_tparm_err++;
}
}
@@ -238,12 +215,13 @@ spop(void)
{
static char dummy[] = ""; /* avoid const-cast */
char *result = dummy;
- if (stack_ptr > 0) {
- stack_ptr--;
- if (!stack[stack_ptr].num_type && stack[stack_ptr].data.str != 0)
- result = stack[stack_ptr].data.str;
+ if (TPS(stack_ptr) > 0) {
+ TPS(stack_ptr)--;
+ if (!TPS(stack)[TPS(stack_ptr)].num_type
+ && TPS(stack)[TPS(stack_ptr)].data.str != 0)
+ result = TPS(stack)[TPS(stack_ptr)].data.str;
} else {
- DEBUG(2, ("spop: stack underflow: %s", _nc_visbuf(tparam_base)));
+ DEBUG(2, ("spop: stack underflow: %s", _nc_visbuf(TPS(tparam_base))));
_nc_tparm_err++;
}
return result;
@@ -369,10 +347,11 @@ _nc_tparm_analyze(const char *string, char *p_is_s[NUM_PARM], int *popcount)
if (cp == 0)
return 0;
- if ((len2 = strlen(cp)) > fmt_size) {
- fmt_size = len2 + fmt_size + 2;
- if ((fmt_buff = typeRealloc(char, fmt_size, fmt_buff)) == 0)
- return 0;
+ if ((len2 = strlen(cp)) > TPS(fmt_size)) {
+ TPS(fmt_size) = len2 + TPS(fmt_size) + 2;
+ TPS(fmt_buff) = typeRealloc(char, TPS(fmt_size), TPS(fmt_buff));
+ if (TPS(fmt_buff) == 0)
+ return 0;
}
memset(p_is_s, 0, sizeof(p_is_s[0]) * NUM_PARM);
@@ -381,7 +360,7 @@ _nc_tparm_analyze(const char *string, char *p_is_s[NUM_PARM], int *popcount)
while ((cp - string) < (int) len2) {
if (*cp == '%') {
cp++;
- cp = parse_format(cp, fmt_buff, &len);
+ cp = parse_format(cp, TPS(fmt_buff), &len);
switch (*cp) {
default:
break;
@@ -474,7 +453,6 @@ _nc_tparm_analyze(const char *string, char *p_is_s[NUM_PARM], int *popcount)
static NCURSES_INLINE char *
tparam_internal(const char *string, va_list ap)
{
-#define NUM_VARS 26
char *p_is_s[NUM_PARM];
TPARM_ARG param[NUM_PARM];
int popcount;
@@ -485,13 +463,11 @@ tparam_internal(const char *string, va_list ap)
int i;
const char *cp = string;
size_t len2;
- static int dynamic_var[NUM_VARS];
- static int static_vars[NUM_VARS];
if (cp == NULL)
return NULL;
- out_used = 0;
+ TPS(out_used) = 0;
len2 = strlen(cp);
/*
@@ -500,7 +476,7 @@ tparam_internal(const char *string, va_list ap)
* variable-length argument list.
*/
number = _nc_tparm_analyze(cp, p_is_s, &popcount);
- if (fmt_buff == 0)
+ if (TPS(fmt_buff) == 0)
return NULL;
for (i = 0; i < max(popcount, number); i++) {
@@ -525,22 +501,23 @@ tparam_internal(const char *string, va_list ap)
* the expansion of (for example) \E[%d;%dH work correctly in termcap
* style, which means tparam() will expand termcap strings OK.
*/
- stack_ptr = 0;
+ TPS(stack_ptr) = 0;
if (popcount == 0) {
popcount = number;
for (i = number - 1; i >= 0; i--)
npush(param[i]);
}
#ifdef TRACE
- if (_nc_tracing & TRACE_CALLS) {
+ if (USE_TRACEF(TRACE_CALLS)) {
for (i = 0; i < popcount; i++) {
if (p_is_s[i] != 0)
save_text(", %s", _nc_visbuf(p_is_s[i]), 0);
else
save_number(", %d", param[i], 0);
}
- _tracef(T_CALLED("%s(%s%s)"), tname, _nc_visbuf(cp), out_buff);
- out_used = 0;
+ _tracef(T_CALLED("%s(%s%s)"), TPS(tname), _nc_visbuf(cp), TPS(out_buff));
+ TPS(out_used) = 0;
+ _nc_unlock_global(tracef);
}
#endif /* TRACE */
@@ -548,8 +525,8 @@ tparam_internal(const char *string, va_list ap)
if (*cp != '%') {
save_char(UChar(*cp));
} else {
- tparam_base = cp++;
- cp = parse_format(cp, fmt_buff, &len);
+ TPS(tparam_base) = cp++;
+ cp = parse_format(cp, TPS(fmt_buff), &len);
switch (*cp) {
default:
break;
@@ -561,7 +538,7 @@ tparam_internal(const char *string, va_list ap)
case 'o': /* FALLTHRU */
case 'x': /* FALLTHRU */
case 'X': /* FALLTHRU */
- save_number(fmt_buff, npop(), len);
+ save_number(TPS(fmt_buff), npop(), len);
break;
case 'c': /* FALLTHRU */
@@ -573,7 +550,7 @@ tparam_internal(const char *string, va_list ap)
break;
case 's':
- save_text(fmt_buff, spop(), len);
+ save_text(TPS(fmt_buff), spop(), len);
break;
case 'p':
@@ -591,10 +568,10 @@ tparam_internal(const char *string, va_list ap)
cp++;
if (isUPPER(*cp)) {
i = (UChar(*cp) - 'A');
- static_vars[i] = npop();
+ TPS(static_vars)[i] = npop();
} else if (isLOWER(*cp)) {
i = (UChar(*cp) - 'a');
- dynamic_var[i] = npop();
+ TPS(dynamic_var)[i] = npop();
}
break;
@@ -602,10 +579,10 @@ tparam_internal(const char *string, va_list ap)
cp++;
if (isUPPER(*cp)) {
i = (UChar(*cp) - 'A');
- npush(static_vars[i]);
+ npush(TPS(static_vars)[i]);
} else if (isLOWER(*cp)) {
i = (UChar(*cp) - 'a');
- npush(dynamic_var[i]);
+ npush(TPS(dynamic_var)[i]);
}
break;
@@ -768,10 +745,10 @@ tparam_internal(const char *string, va_list ap)
} /* endwhile (*cp) */
get_space(1);
- out_buff[out_used] = '\0';
+ TPS(out_buff)[TPS(out_used)] = '\0';
- T((T_RETURN("%s"), _nc_visbuf(out_buff)));
- return (out_buff);
+ T((T_RETURN("%s"), _nc_visbuf(TPS(out_buff))));
+ return (TPS(out_buff));
}
#if NCURSES_TPARM_VARARGS
@@ -789,7 +766,7 @@ tparm_varargs(NCURSES_CONST char *string,...)
_nc_tparm_err = 0;
va_start(ap, string);
#ifdef TRACE
- tname = "tparm";
+ TPS(tname) = "tparm";
#endif /* TRACE */
result = tparam_internal(string, ap);
va_end(ap);
diff --git a/contrib/ncurses/ncurses/tinfo/lib_tputs.c b/contrib/ncurses/ncurses/tinfo/lib_tputs.c
index 3a18ffd..aab3351 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_tputs.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_tputs.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2007 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,12 +45,12 @@
#include <termcap.h> /* ospeed */
#include <tic.h>
-MODULE_ID("$Id: lib_tputs.c,v 1.62 2003/08/23 21:39:20 tom Exp $")
+MODULE_ID("$Id: lib_tputs.c,v 1.64 2007/09/29 20:37:13 tom Exp $")
-NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */
-NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */
+NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */
+NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */
-NCURSES_EXPORT_VAR(int) _nc_nulls_sent = 0; /* used by 'tack' program */
+NCURSES_EXPORT_VAR(int) _nc_nulls_sent = 0; /* used by 'tack' program */
static int (*my_outch) (int c) = _nc_outch;
@@ -84,7 +84,7 @@ _nc_flush(void)
NCURSES_EXPORT(int)
_nc_outch(int ch)
{
- TRACE_OUTCHARS(1);
+ COUNT_OUTCHARS(1);
if (SP != 0
&& SP->_cleanup) {
@@ -119,7 +119,7 @@ tputs(const char *string, int affcnt, int (*outc) (int))
#ifdef TRACE
char addrbuf[32];
- if (_nc_tracing & TRACE_TPUTS) {
+ if (USE_TRACEF(TRACE_TPUTS)) {
if (outc == _nc_outch)
(void) strcpy(addrbuf, "_nc_outch");
else
@@ -130,7 +130,8 @@ tputs(const char *string, int affcnt, int (*outc) (int))
} else {
_tracef("tputs(%s, %d, %s) called", _nc_visbuf(string), affcnt, addrbuf);
}
- _nc_tputs_trace = (char *) NULL;
+ TPUTS_TRACE(NULL);
+ _nc_unlock_global(tracef);
}
#endif /* TRACE */
diff --git a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
index 77c35fa..4cbbf50 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,35 @@
#include <curses.priv.h>
#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_ttyflags.c,v 1.13 2006/12/10 01:31:54 tom Exp $")
+MODULE_ID("$Id: lib_ttyflags.c,v 1.15 2007/05/26 18:54:25 tom Exp $")
NCURSES_EXPORT(int)
_nc_get_tty_mode(TTY * buf)
{
int result = OK;
- if (cur_term == 0) {
+ if (buf == 0) {
result = ERR;
} else {
- for (;;) {
- if (GET_TTY(cur_term->Filedes, buf) != 0) {
- if (errno == EINTR)
- continue;
- result = ERR;
+ if (cur_term == 0) {
+ result = ERR;
+ } else {
+ for (;;) {
+ if (GET_TTY(cur_term->Filedes, buf) != 0) {
+ if (errno == EINTR)
+ continue;
+ result = ERR;
+ }
+ break;
}
- break;
}
- }
- if (result == ERR)
- memset(buf, 0, sizeof(*buf));
+ if (result == ERR)
+ memset(buf, 0, sizeof(*buf));
- TR(TRACE_BITS, ("_nc_get_tty_mode(%d): %s",
- cur_term->Filedes, _nc_trace_ttymode(buf)));
+ TR(TRACE_BITS, ("_nc_get_tty_mode(%d): %s",
+ cur_term->Filedes, _nc_trace_ttymode(buf)));
+ }
return (result);
}
@@ -71,22 +75,26 @@ _nc_set_tty_mode(TTY * buf)
{
int result = OK;
- if (cur_term == 0) {
+ if (buf == 0) {
result = ERR;
} else {
- for (;;) {
- if (SET_TTY(cur_term->Filedes, buf) != 0) {
- if (errno == EINTR)
- continue;
- if ((errno == ENOTTY) && (SP != 0))
- SP->_notty = TRUE;
- result = ERR;
+ if (cur_term == 0) {
+ result = ERR;
+ } else {
+ for (;;) {
+ if (SET_TTY(cur_term->Filedes, buf) != 0) {
+ if (errno == EINTR)
+ continue;
+ if ((errno == ENOTTY) && (SP != 0))
+ SP->_notty = TRUE;
+ result = ERR;
+ }
+ break;
}
- break;
}
+ TR(TRACE_BITS, ("_nc_set_tty_mode(%d): %s",
+ cur_term->Filedes, _nc_trace_ttymode(buf)));
}
- TR(TRACE_BITS, ("_nc_set_tty_mode(%d): %s",
- cur_term->Filedes, _nc_trace_ttymode(buf)));
return (result);
}
@@ -164,19 +172,33 @@ reset_shell_mode(void)
returnCode(ERR);
}
+static TTY *
+saved_tty(void)
+{
+ TTY *result = 0;
+
+ if (SP != 0) {
+ result = &(SP->_saved_tty);
+ } else {
+ if (_nc_prescreen.saved_tty == 0) {
+ _nc_prescreen.saved_tty = typeCalloc(TTY, 1);
+ }
+ result = _nc_prescreen.saved_tty;
+ }
+ return result;
+}
+
/*
** savetty() and resetty()
**
*/
-static TTY buf;
-
NCURSES_EXPORT(int)
savetty(void)
{
T((T_CALLED("savetty()")));
- returnCode(_nc_get_tty_mode(&buf));
+ returnCode(_nc_get_tty_mode(saved_tty()));
}
NCURSES_EXPORT(int)
@@ -184,5 +206,5 @@ resetty(void)
{
T((T_CALLED("resetty()")));
- returnCode(_nc_set_tty_mode(&buf));
+ returnCode(_nc_set_tty_mode(saved_tty()));
}
diff --git a/contrib/ncurses/ncurses/tinfo/make_keys.c b/contrib/ncurses/ncurses/tinfo/make_keys.c
index 8f6243c..0036718 100644
--- a/contrib/ncurses/ncurses/tinfo/make_keys.c
+++ b/contrib/ncurses/ncurses/tinfo/make_keys.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2007 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 USE_TERMLIB 1
#include <curses.priv.h>
-MODULE_ID("$Id: make_keys.c,v 1.12 2005/08/20 19:58:18 tom Exp $")
+MODULE_ID("$Id: make_keys.c,v 1.13 2007/01/07 00:00:14 tom Exp $")
#include <names.c>
@@ -113,7 +113,7 @@ main(int argc, char *argv[])
"#if BROKEN_LINKER",
"static",
"#endif",
- "struct tinfo_fkeys _nc_tinfo_fkeys[] = {",
+ "const struct tinfo_fkeys _nc_tinfo_fkeys[] = {",
0
};
static const char *suffix[] =
diff --git a/contrib/ncurses/ncurses/tinfo/name_match.c b/contrib/ncurses/ncurses/tinfo/name_match.c
index fee3ba3..c8d728f 100644
--- a/contrib/ncurses/ncurses/tinfo/name_match.c
+++ b/contrib/ncurses/ncurses/tinfo/name_match.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999-2004,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2005,2007 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,38 +34,38 @@
#include <term.h>
#include <tic.h>
-MODULE_ID("$Id: name_match.c,v 1.15 2005/01/22 21:47:25 tom Exp $")
+MODULE_ID("$Id: name_match.c,v 1.16 2007/04/21 21:28:13 tom Exp $")
/*
* _nc_first_name(char *names)
*
* Extract the primary name from a compiled entry.
*/
+#define FirstName _nc_globals.first_name
NCURSES_EXPORT(char *)
_nc_first_name(const char *const sp)
/* get the first name from the given name list */
{
- static char *buf;
- register unsigned n;
+ unsigned n;
#if NO_LEAKS
if (sp == 0) {
- if (buf != 0)
- FreeAndNull(buf); /* for leak-testing */
+ if (FirstName != 0)
+ FreeAndNull(FirstName);
return 0;
}
#endif
- if (buf == 0)
- buf = typeMalloc(char, MAX_NAME_SIZE + 1);
+ if (FirstName == 0)
+ FirstName = typeMalloc(char, MAX_NAME_SIZE + 1);
for (n = 0; n < MAX_NAME_SIZE; n++) {
- if ((buf[n] = sp[n]) == '\0'
- || (buf[n] == '|'))
+ if ((FirstName[n] = sp[n]) == '\0'
+ || (FirstName[n] == '|'))
break;
}
- buf[n] = '\0';
- return (buf);
+ FirstName[n] = '\0';
+ return (FirstName);
}
/*
diff --git a/contrib/ncurses/ncurses/tinfo/parse_entry.c b/contrib/ncurses/ncurses/tinfo/parse_entry.c
index 510b232..375ce8f 100644
--- a/contrib/ncurses/ncurses/tinfo/parse_entry.c
+++ b/contrib/ncurses/ncurses/tinfo/parse_entry.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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>
#include <term_entry.h>
-MODULE_ID("$Id: parse_entry.c,v 1.63 2006/06/17 17:57:50 tom Exp $")
+MODULE_ID("$Id: parse_entry.c,v 1.65 2007/08/11 16:19:02 tom Exp $")
#ifdef LINT
static short const parametrized[] =
@@ -283,7 +283,7 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent)
} else {
/* normal token lookup */
entry_ptr = _nc_find_entry(_nc_curr_token.tk_name,
- _nc_syntax ? _nc_cap_hash_table : _nc_info_hash_table);
+ _nc_get_hash_table(_nc_syntax));
/*
* Our kluge to handle aliasing. The reason it's done
@@ -300,7 +300,7 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent)
if (entryp->nuses != 0) {
BAD_TC_USAGE
}
- for (ap = _nc_capalias_table; ap->from; ap++)
+ for (ap = _nc_get_alias_table(TRUE); ap->from; ap++)
if (strcmp(ap->from, _nc_curr_token.tk_name) == 0) {
if (ap->to == (char *) 0) {
_nc_warning("%s (%s termcap extension) ignored",
@@ -308,14 +308,15 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent)
goto nexttok;
}
- entry_ptr = _nc_find_entry(ap->to, _nc_cap_hash_table);
+ entry_ptr = _nc_find_entry(ap->to,
+ _nc_get_hash_table(TRUE));
if (entry_ptr && !silent)
_nc_warning("%s (%s termcap extension) aliased to %s",
ap->from, ap->source, ap->to);
break;
}
} else { /* if (_nc_syntax == SYN_TERMINFO) */
- for (ap = _nc_infoalias_table; ap->from; ap++)
+ for (ap = _nc_get_alias_table(FALSE); ap->from; ap++)
if (strcmp(ap->from, _nc_curr_token.tk_name) == 0) {
if (ap->to == (char *) 0) {
_nc_warning("%s (%s terminfo extension) ignored",
@@ -323,7 +324,8 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent)
goto nexttok;
}
- entry_ptr = _nc_find_entry(ap->to, _nc_info_hash_table);
+ entry_ptr = _nc_find_entry(ap->to,
+ _nc_get_hash_table(FALSE));
if (entry_ptr && !silent)
_nc_warning("%s (%s terminfo extension) aliased to %s",
ap->from, ap->source, ap->to);
@@ -796,8 +798,8 @@ postprocess_termcap(TERMTYPE *tp, bool has_base)
/* now we know we found a match in ko_table, so... */
- from_ptr = _nc_find_entry(ap->from, _nc_cap_hash_table);
- to_ptr = _nc_find_entry(ap->to, _nc_info_hash_table);
+ from_ptr = _nc_find_entry(ap->from, _nc_get_hash_table(TRUE));
+ to_ptr = _nc_find_entry(ap->to, _nc_get_hash_table(FALSE));
if (!from_ptr || !to_ptr) /* should never happen! */
_nc_err_abort("ko translation table is invalid, I give up");
diff --git a/contrib/ncurses/ncurses/tinfo/read_entry.c b/contrib/ncurses/ncurses/tinfo/read_entry.c
index c6c3275..6a050ee 100644
--- a/contrib/ncurses/ncurses/tinfo/read_entry.c
+++ b/contrib/ncurses/ncurses/tinfo/read_entry.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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>
#include <term_entry.h>
-MODULE_ID("$Id: read_entry.c,v 1.99 2006/08/19 15:58:50 tom Exp $")
+MODULE_ID("$Id: read_entry.c,v 1.100 2007/11/17 23:56:50 tom Exp $")
#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts))
@@ -409,7 +409,7 @@ _nc_read_tic_entry(char *filename,
unsigned need = 4 + strlen(path) + strlen(name);
if (need <= limit) {
- (void) sprintf(filename, "%s/%c/%s", path, *name, name);
+ (void) sprintf(filename, "%s/" LEAF_FMT "/%s", path, *name, name);
result = _nc_read_file_entry(filename, tp);
}
}
diff --git a/contrib/ncurses/ncurses/tinfo/setbuf.c b/contrib/ncurses/ncurses/tinfo/setbuf.c
index 94bb6d3..ba910e8 100644
--- a/contrib/ncurses/ncurses/tinfo/setbuf.c
+++ b/contrib/ncurses/ncurses/tinfo/setbuf.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2007 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: setbuf.c,v 1.12 2003/11/15 23:55:34 tom Exp $")
+MODULE_ID("$Id: setbuf.c,v 1.13 2007/05/12 19:04:02 tom Exp $")
/*
* If the output file descriptor is connected to a tty (the typical case) it
@@ -102,7 +102,7 @@ _nc_set_buffer(FILE *ofp, bool buffered)
{
/* optional optimization hack -- do before any output to ofp */
#if HAVE_SETVBUF || HAVE_SETBUFFER
- if (SP->_buffered != (int)buffered) {
+ if (SP->_buffered != buffered) {
unsigned buf_len;
char *buf_ptr;
diff --git a/contrib/ncurses/ncurses/tinfo/strings.c b/contrib/ncurses/ncurses/tinfo/strings.c
index d5377fe..78cd2ef 100644
--- a/contrib/ncurses/ncurses/tinfo/strings.c
+++ b/contrib/ncurses/ncurses/tinfo/strings.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2000,2003 Free Software Foundation, Inc. *
+ * Copyright (c) 2000-2003,2007 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: strings.c,v 1.5 2003/08/16 23:46:00 tom Exp $")
+MODULE_ID("$Id: strings.c,v 1.6 2007/08/11 17:12:17 tom Exp $")
/****************************************************************************
* Useful string functions (especially for mvcur)
@@ -52,7 +52,7 @@ _nc_strstr(const char *haystack, const char *needle)
while ((len1 != 0) && (len1-- >= len2)) {
if (!strncmp(haystack, needle, len2)) {
- result = haystack;
+ result = (char *) haystack;
break;
}
haystack++;
diff --git a/contrib/ncurses/ncurses/tinfo/trim_sgr0.c b/contrib/ncurses/ncurses/tinfo/trim_sgr0.c
index 3ce18e0..80c8f77 100644
--- a/contrib/ncurses/ncurses/tinfo/trim_sgr0.c
+++ b/contrib/ncurses/ncurses/tinfo/trim_sgr0.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2005 Free Software Foundation, Inc. *
+ * Copyright (c) 2005-2006,2007 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>
#include <term_entry.h>
-MODULE_ID("$Id: trim_sgr0.c,v 1.7 2006/12/02 19:37:57 tom Exp $")
+MODULE_ID("$Id: trim_sgr0.c,v 1.8 2007/04/07 17:14:11 tom Exp $")
#undef CUR
#define CUR tp->
@@ -247,9 +247,7 @@ _nc_trim_sgr0(TERMTYPE *tp)
if (!rewrite_sgr(on, enter_alt_charset_mode)
|| !rewrite_sgr(off, exit_alt_charset_mode)
|| !rewrite_sgr(end, exit_alt_charset_mode)) {
- FreeIfNeeded(on);
FreeIfNeeded(off);
- FreeIfNeeded(end);
} else if (similar_sgr(off, end)
&& !similar_sgr(off, on)) {
TR(TRACE_DATABASE, ("adjusting sgr(9:off) : %s", _nc_visbuf(off)));
@@ -315,8 +313,8 @@ _nc_trim_sgr0(TERMTYPE *tp)
*/
free(off);
}
- free(end);
- free(on);
+ FreeIfNeeded(end);
+ FreeIfNeeded(on);
} else {
/*
* Possibly some applications are confused if sgr0 contains rmacs,
diff --git a/contrib/ncurses/ncurses/tinfo/use_screen.c b/contrib/ncurses/ncurses/tinfo/use_screen.c
new file mode 100644
index 0000000..27730b0
--- /dev/null
+++ b/contrib/ncurses/ncurses/tinfo/use_screen.c
@@ -0,0 +1,60 @@
+/****************************************************************************
+ * Copyright (c) 2007 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 2007 *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: use_screen.c,v 1.2 2007/09/08 21:46:48 tom Exp $")
+
+NCURSES_EXPORT(int)
+use_screen(SCREEN *screen, NCURSES_CALLBACK func, void *data)
+{
+ SCREEN *save_SP;
+ int code = OK;
+
+ T((T_CALLED("use_screen(%p,%p,%p)"), screen, func, data));
+
+ /*
+ * FIXME - add a flag so a given thread can check if _it_ has already
+ * recurred through this point, return an error if so.
+ */
+ _nc_lock_global(use_screen);
+ save_SP = SP;
+ set_term(screen);
+
+ code = func(screen->_stdscr, data);
+
+ set_term(save_SP);
+ _nc_unlock_global(use_screen);
+ returnCode(code);
+
+ return 0;
+}
diff --git a/contrib/ncurses/ncurses/tinfo/write_entry.c b/contrib/ncurses/ncurses/tinfo/write_entry.c
index 5426f1f..05027e0 100644
--- a/contrib/ncurses/ncurses/tinfo/write_entry.c
+++ b/contrib/ncurses/ncurses/tinfo/write_entry.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 *
@@ -54,7 +54,7 @@
#define TRACE_OUT(p) /*nothing */
#endif
-MODULE_ID("$Id: write_entry.c,v 1.68 2006/10/14 20:45:16 tom Exp $")
+MODULE_ID("$Id: write_entry.c,v 1.70 2007/11/17 23:38:28 tom Exp $")
static int total_written;
@@ -97,17 +97,16 @@ check_writeable(int code)
static const char dirnames[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
static bool verified[sizeof(dirnames)];
- char dir[2];
+ char dir[sizeof(LEAF_FMT)];
char *s = 0;
if (code == 0 || (s = strchr(dirnames, code)) == 0)
- _nc_err_abort("Illegal terminfo subdirectory \"%c\"", code);
+ _nc_err_abort("Illegal terminfo subdirectory \"" LEAF_FMT "\"", code);
if (verified[s - dirnames])
return;
- dir[0] = code;
- dir[1] = '\0';
+ sprintf(dir, LEAF_FMT, code);
if (make_db_root(dir) < 0) {
_nc_err_abort("%s/%s: permission denied", _nc_tic_dir(0), dir);
}
@@ -358,7 +357,7 @@ _nc_write_entry(TERMTYPE *const tp)
if (strlen(first_name) > sizeof(filename) - 3)
_nc_warning("terminal name too long.");
- sprintf(filename, "%c/%s", first_name[0], first_name);
+ sprintf(filename, LEAF_FMT "/%s", first_name[0], first_name);
/*
* Has this primary name been written since the first call to
@@ -399,7 +398,7 @@ _nc_write_entry(TERMTYPE *const tp)
}
check_writeable(ptr[0]);
- sprintf(linkname, "%c/%s", ptr[0], ptr);
+ sprintf(linkname, LEAF_FMT "/%s", ptr[0], ptr);
if (strcmp(filename, linkname) == 0) {
_nc_warning("self-synonym ignored");
@@ -502,7 +501,8 @@ compute_offsets(char **Strings, unsigned strmax, short *offsets)
} else {
offsets[i] = nextfree;
nextfree += strlen(Strings[i]) + 1;
- TRACE_OUT(("put Strings[%d]=%s(%d)", i, _nc_visbuf(Strings[i]), nextfree));
+ TRACE_OUT(("put Strings[%d]=%s(%d)", (int) i,
+ _nc_visbuf(Strings[i]), nextfree));
}
}
return nextfree;
@@ -740,7 +740,7 @@ write_object(TERMTYPE *tp, char *buffer, unsigned *offset, unsigned limit)
*/
for (i = 0; i < tp->ext_Strings; i++) {
if (VALID_STRING(tp->Strings[i + STRCOUNT])) {
- TRACE_OUT(("WRITE ext_Strings[%d]=%s", i,
+ TRACE_OUT(("WRITE ext_Strings[%d]=%s", (int) i,
_nc_visbuf(tp->Strings[i + STRCOUNT])));
if (!WRITE_STRING(tp->Strings[i + STRCOUNT]))
return (ERR);
@@ -751,7 +751,7 @@ write_object(TERMTYPE *tp, char *buffer, unsigned *offset, unsigned limit)
* Write the extended names
*/
for (i = 0; i < extcnt; i++) {
- TRACE_OUT(("WRITE ext_Names[%d]=%s", i, tp->ext_Names[i]));
+ TRACE_OUT(("WRITE ext_Names[%d]=%s", (int) i, tp->ext_Names[i]));
if (!WRITE_STRING(tp->ext_Names[i]))
return (ERR);
}
diff --git a/contrib/ncurses/ncurses/trace/lib_trace.c b/contrib/ncurses/ncurses/trace/lib_trace.c
index 7f78122..d634438 100644
--- a/contrib/ncurses/ncurses/trace/lib_trace.c
+++ b/contrib/ncurses/ncurses/trace/lib_trace.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,37 +46,69 @@
#include <ctype.h>
-MODULE_ID("$Id: lib_trace.c,v 1.59 2006/08/19 12:05:25 tom Exp $")
+MODULE_ID("$Id: lib_trace.c,v 1.65 2007/09/29 21:47:46 tom Exp $")
NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */
#ifdef TRACE
+
+#if USE_REENTRANT
+NCURSES_EXPORT(const char *)
+NCURSES_PUBLIC_VAR(_nc_tputs_trace) (void)
+{
+ return SP ? SP->_tputs_trace : _nc_prescreen._tputs_trace;
+}
+NCURSES_EXPORT(long)
+NCURSES_PUBLIC_VAR(_nc_outchars) (void)
+{
+ return SP ? SP->_outchars : _nc_prescreen._outchars;
+}
+NCURSES_EXPORT(void)
+_nc_set_tputs_trace(const char *s)
+{
+ if (SP)
+ SP->_tputs_trace = s;
+ else
+ _nc_prescreen._tputs_trace = s;
+}
+NCURSES_EXPORT(void)
+_nc_count_outchars(long increment)
+{
+ if (SP)
+ SP->_outchars += increment;
+ else
+ _nc_prescreen._outchars += increment;
+}
+#else
NCURSES_EXPORT_VAR(const char *) _nc_tputs_trace = "";
NCURSES_EXPORT_VAR(long) _nc_outchars = 0;
+#endif
-static FILE *tracefp = 0; /* default to writing to stderr */
+#define TraceFP _nc_globals.trace_fp
+#define TracePath _nc_globals.trace_fname
+#define TraceLevel _nc_globals.trace_level
NCURSES_EXPORT(void)
trace(const unsigned int tracelevel)
{
- static bool been_here = FALSE;
- static char my_name[PATH_MAX];
-
- if ((tracefp == 0) && tracelevel) {
- const char *mode = been_here ? "ab" : "wb";
+ if ((TraceFP == 0) && tracelevel) {
+ const char *mode = _nc_globals.init_trace ? "ab" : "wb";
- if (*my_name == '\0') {
- if (getcwd(my_name, sizeof(my_name) - 10) == 0) {
+ if (TracePath[0] == '\0') {
+ if (getcwd(TracePath, sizeof(TracePath) - 12) == 0) {
perror("curses: Can't get working directory");
exit(EXIT_FAILURE);
}
- strcat(my_name, "/trace");
+ strcat(TracePath, "/trace");
+ if (_nc_is_dir_path(TracePath)) {
+ strcat(TracePath, ".log");
+ }
}
- been_here = TRUE;
+ _nc_globals.init_trace = TRUE;
_nc_tracing = tracelevel;
- if (_nc_access(my_name, W_OK) < 0
- || (tracefp = fopen(my_name, mode)) == 0) {
+ if (_nc_access(TracePath, W_OK) < 0
+ || (TraceFP = fopen(TracePath, mode)) == 0) {
perror("curses: Can't open 'trace' file");
exit(EXIT_FAILURE);
}
@@ -85,18 +117,18 @@ trace(const unsigned int tracelevel)
* end of each line. This is useful in case the program dies.
*/
#if HAVE_SETVBUF /* ANSI */
- (void) setvbuf(tracefp, (char *) 0, _IOLBF, 0);
+ (void) setvbuf(TraceFP, (char *) 0, _IOLBF, 0);
#elif HAVE_SETBUF /* POSIX */
- (void) setbuffer(tracefp, (char *) 0);
+ (void) setbuffer(TraceFP, (char *) 0);
#endif
_tracef("TRACING NCURSES version %s.%d (tracelevel=%#x)",
NCURSES_VERSION,
NCURSES_VERSION_PATCH,
tracelevel);
} else if (tracelevel == 0) {
- if (tracefp != 0) {
- fclose(tracefp);
- tracefp = 0;
+ if (TraceFP != 0) {
+ fclose(TraceFP);
+ TraceFP = 0;
}
_nc_tracing = tracelevel;
} else if (_nc_tracing != tracelevel) {
@@ -105,13 +137,12 @@ trace(const unsigned int tracelevel)
}
}
-NCURSES_EXPORT(void)
-_tracef(const char *fmt,...)
+static void
+_nc_va_tracef(const char *fmt, va_list ap)
{
static const char Called[] = T_CALLED("");
static const char Return[] = T_RETURN("");
- static int level;
- va_list ap;
+
bool before = FALSE;
bool after = FALSE;
unsigned doit = _nc_tracing;
@@ -120,12 +151,12 @@ _tracef(const char *fmt,...)
if (strlen(fmt) >= sizeof(Called) - 1) {
if (!strncmp(fmt, Called, sizeof(Called) - 1)) {
before = TRUE;
- level++;
+ TraceLevel++;
} else if (!strncmp(fmt, Return, sizeof(Return) - 1)) {
after = TRUE;
}
if (before || after) {
- if ((level <= 1)
+ if ((TraceLevel <= 1)
|| (doit & TRACE_ICALLS) != 0)
doit &= (TRACE_CALLS | TRACE_CCALLS);
else
@@ -134,25 +165,34 @@ _tracef(const char *fmt,...)
}
if (doit != 0) {
- if (tracefp == 0)
- tracefp = stderr;
+ if (TraceFP == 0)
+ TraceFP = stderr;
if (before || after) {
int n;
- for (n = 1; n < level; n++)
- fputs("+ ", tracefp);
+ for (n = 1; n < TraceLevel; n++)
+ fputs("+ ", TraceFP);
}
- va_start(ap, fmt);
- vfprintf(tracefp, fmt, ap);
- fputc('\n', tracefp);
- va_end(ap);
- fflush(tracefp);
+ vfprintf(TraceFP, fmt, ap);
+ fputc('\n', TraceFP);
+ fflush(TraceFP);
}
- if (after && level)
- level--;
+ if (after && TraceLevel)
+ TraceLevel--;
+
errno = save_err;
}
+NCURSES_EXPORT(void)
+_tracef(const char *fmt,...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ _nc_va_tracef(fmt, ap);
+ va_end(ap);
+}
+
/* Trace 'bool' return-values */
NCURSES_EXPORT(NCURSES_BOOL)
_nc_retrace_bool(NCURSES_BOOL code)
@@ -224,4 +264,53 @@ _nc_retrace_win(WINDOW *code)
T((T_RETURN("%p"), code));
return code;
}
+
+#if USE_REENTRANT
+/*
+ * Check if the given trace-mask is enabled.
+ *
+ * This function may be called from within one of the functions that fills
+ * in parameters for _tracef(), but in that case we do not want to lock the
+ * mutex, since it is already locked.
+ */
+NCURSES_EXPORT(int)
+_nc_use_tracef(unsigned mask)
+{
+ bool result = FALSE;
+
+ _nc_lock_global(tst_tracef);
+ if (!_nc_globals.nested_tracef++) {
+ if ((result = (_nc_tracing & (mask))) != 0) {
+ /* we will call _nc_locked_tracef(), no nesting so far */
+ _nc_lock_global(tracef);
+ } else {
+ /* we will not call _nc_locked_tracef() */
+ _nc_globals.nested_tracef = 0;
+ }
+ } else {
+ /* we may call _nc_locked_tracef(), but with nested_tracef > 0 */
+ result = (_nc_tracing & (mask));
+ }
+ _nc_unlock_global(tst_tracef);
+ return result;
+}
+
+/*
+ * We call this if _nc_use_tracef() returns true, which means we must unlock
+ * the tracef mutex.
+ */
+NCURSES_EXPORT(void)
+_nc_locked_tracef(const char *fmt,...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ _nc_va_tracef(fmt, ap);
+ va_end(ap);
+
+ if (--(_nc_globals.nested_tracef) == 0)
+ _nc_unlock_global(tracef);
+}
+#endif /* USE_REENTRANT */
+
#endif /* TRACE */
diff --git a/contrib/ncurses/ncurses/trace/lib_traceatr.c b/contrib/ncurses/ncurses/trace/lib_traceatr.c
index ee6cf5f..108eb8b 100644
--- a/contrib/ncurses/ncurses/trace/lib_traceatr.c
+++ b/contrib/ncurses/ncurses/trace/lib_traceatr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,33 +39,37 @@
#include <curses.priv.h>
#include <term.h> /* acs_chars */
-MODULE_ID("$Id: lib_traceatr.c,v 1.56 2006/12/02 21:18:28 tom Exp $")
+MODULE_ID("$Id: lib_traceatr.c,v 1.59 2007/06/09 17:22:10 tom Exp $")
#define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name))
#ifdef TRACE
-static const char l_brace[] = {L_BRACE, 0};
-static const char r_brace[] = {R_BRACE, 0};
+static const char l_brace[] = StringOf(L_BRACE);
+static const char r_brace[] = StringOf(R_BRACE);
#ifndef USE_TERMLIB
+
+#define my_buffer _nc_globals.traceatr_color_buf
+#define my_select _nc_globals.traceatr_color_sel
+#define my_cached _nc_globals.traceatr_color_last
+
static char *
color_of(int c)
{
- static char buffer[2][80];
- static int sel;
- static int last = -1;
-
- if (c != last) {
- last = c;
- sel = !sel;
+ if (c != my_cached) {
+ my_cached = c;
+ my_select = !my_select;
if (c == COLOR_DEFAULT)
- strcpy(buffer[sel], "default");
+ strcpy(my_buffer[my_select], "default");
else
- sprintf(buffer[sel], "color%d", c);
+ sprintf(my_buffer[my_select], "color%d", c);
}
- return buffer[sel];
+ return my_buffer[my_select];
}
+
+#undef my_buffer
+#undef my_select
#endif /* !USE_TERMLIB */
NCURSES_EXPORT(char *)
@@ -173,17 +177,19 @@ _nc_retrace_attr_t(attr_t code)
const char *
_nc_altcharset_name(attr_t attr, chtype ch)
{
+ typedef struct {
+ unsigned int val;
+ const char *name;
+ } ALT_NAMES;
+
const char *result = 0;
if ((attr & A_ALTCHARSET) && (acs_chars != 0)) {
char *cp;
char *found = 0;
- static const struct {
- unsigned int val;
- const char *name;
- } names[] =
+ /* *INDENT-OFF* */
+ static const ALT_NAMES names[] =
{
- /* *INDENT-OFF* */
{ 'l', "ACS_ULCORNER" }, /* upper left corner */
{ 'm', "ACS_LLCORNER" }, /* lower left corner */
{ 'k', "ACS_URCORNER" }, /* upper right corner */
@@ -217,9 +223,9 @@ _nc_altcharset_name(attr_t attr, chtype ch)
{ '|', "ACS_NEQUAL" }, /* not equal */
{ '}', "ACS_STERLING" }, /* UK pound sign */
{ '\0', (char *) 0 }
- /* *INDENT-OFF* */
- },
- *sp;
+ };
+ /* *INDENT-OFF* */
+ const ALT_NAMES *sp;
for (cp = acs_chars; cp[0] && cp[1]; cp += 2) {
if (ChCharOf(cp[1]) == ChCharOf(ch)) {
diff --git a/contrib/ncurses/ncurses/trace/lib_tracebits.c b/contrib/ncurses/ncurses/trace/lib_tracebits.c
index d9defd0..de2394c 100644
--- a/contrib/ncurses/ncurses/trace/lib_tracebits.c
+++ b/contrib/ncurses/ncurses/trace/lib_tracebits.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,7 +35,7 @@
#include <curses.priv.h>
#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_tracebits.c,v 1.13 2006/12/10 01:33:00 tom Exp $")
+MODULE_ID("$Id: lib_tracebits.c,v 1.15 2007/06/30 16:14:20 tom Exp $")
#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
@@ -53,10 +53,27 @@ MODULE_ID("$Id: lib_tracebits.c,v 1.13 2006/12/10 01:33:00 tom Exp $")
#ifndef TOSTOP
#define TOSTOP 0
#endif
+
#ifndef IEXTEN
#define IEXTEN 0
#endif
+#ifndef ONLCR
+#define ONLCR 0
+#endif
+
+#ifndef OCRNL
+#define OCRNL 0
+#endif
+
+#ifndef ONOCR
+#define ONOCR 0
+#endif
+
+#ifndef ONLRET
+#define ONLRET 0
+#endif
+
#ifdef TRACE
typedef struct {
@@ -108,8 +125,12 @@ _nc_trace_ttymode(TTY * tty)
{
{OPOST, "OPOST"},
{OFLAGS_TABS, "XTABS"},
+ {ONLCR, "ONLCR"},
+ {OCRNL, "OCRNL"},
+ {ONOCR, "ONOCR"},
+ {ONLRET, "ONLRET"},
{0, NULL}
-#define ALLOUT (OPOST)
+#define ALLOUT (OPOST|OFLAGS_TABS|ONLCR|OCRNL|ONOCR|ONLRET)
}, cflags[] =
{
{CLOCAL, "CLOCAL"},
diff --git a/contrib/ncurses/ncurses/trace/lib_tracechr.c b/contrib/ncurses/ncurses/trace/lib_tracechr.c
index 34a2bb6..479756a 100644
--- a/contrib/ncurses/ncurses/trace/lib_tracechr.c
+++ b/contrib/ncurses/ncurses/trace/lib_tracechr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2007 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,34 +39,35 @@
#include <ctype.h>
-MODULE_ID("$Id: lib_tracechr.c,v 1.12 2005/04/16 16:55:46 tom Exp $")
+MODULE_ID("$Id: lib_tracechr.c,v 1.13 2007/04/21 23:16:37 tom Exp $")
#ifdef TRACE
+#define MyBuffer _nc_globals.tracechr_buf
+
NCURSES_EXPORT(char *)
_tracechar(int ch)
{
- static char result[40];
NCURSES_CONST char *name;
if (ch > KEY_MIN || ch < 0) {
name = keyname(ch);
if (name == 0 || *name == '\0')
name = "NULL";
- (void) sprintf(result, "'%.30s' = %#03o", name, ch);
+ (void) sprintf(MyBuffer, "'%.30s' = %#03o", name, ch);
} else if (!is8bits(ch) || !isprint(UChar(ch))) {
/*
* workaround for glibc bug:
* sprintf changes the result from unctrl() to an empty string if it
* does not correspond to a valid multibyte sequence.
*/
- (void) sprintf(result, "%#03o", ch);
+ (void) sprintf(MyBuffer, "%#03o", ch);
} else {
name = unctrl((chtype) ch);
if (name == 0 || *name == 0)
name = "null"; /* shouldn't happen */
- (void) sprintf(result, "'%.30s' = %#03o", name, ch);
+ (void) sprintf(MyBuffer, "'%.30s' = %#03o", name, ch);
}
- return (result);
+ return (MyBuffer);
}
#else
empty_module(_nc_lib_tracechr)
diff --git a/contrib/ncurses/ncurses/trace/lib_tracedmp.c b/contrib/ncurses/ncurses/trace/lib_tracedmp.c
index 41739a9..d56d1a5 100644
--- a/contrib/ncurses/ncurses/trace/lib_tracedmp.c
+++ b/contrib/ncurses/ncurses/trace/lib_tracedmp.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,15 +39,16 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_tracedmp.c,v 1.27 2006/10/14 20:43:31 tom Exp $")
+MODULE_ID("$Id: lib_tracedmp.c,v 1.29 2007/06/30 23:01:19 tom Exp $")
#ifdef TRACE
+
+#define my_buffer _nc_globals.tracedmp_buf
+#define my_length _nc_globals.tracedmp_used
+
NCURSES_EXPORT(void)
_tracedump(const char *name, WINDOW *win)
{
- static char *buf = 0;
- static size_t used = 0;
-
int i, j, n, width;
/* compute narrowest possible display width */
@@ -66,13 +67,13 @@ _tracedump(const char *name, WINDOW *win)
}
if (width < win->_maxx)
++width;
- if (++width + 1 > (int) used) {
- used = 2 * (width + 1);
- buf = typeRealloc(char, used, buf);
+ if (++width + 1 > (int) my_length) {
+ my_length = 2 * (width + 1);
+ my_buffer = typeRealloc(char, my_length, my_buffer);
}
for (n = 0; n <= win->_maxy; ++n) {
- char *ep = buf;
+ char *ep = my_buffer;
bool haveattrs, havecolors;
/*
@@ -99,6 +100,30 @@ _tracedump(const char *name, WINDOW *win)
(long) win->_line[n].lastchar,
ep);
+ /* if there are multi-column characters on the line, print them now */
+ if_WIDEC({
+ bool multicolumn = FALSE;
+ for (j = 0; j < width; ++j)
+ if (WidecExt(win->_line[n].text[j]) != 0) {
+ multicolumn = TRUE;
+ break;
+ }
+ if (multicolumn) {
+ ep = my_buffer;
+ for (j = 0; j < width; ++j) {
+ int test = WidecExt(win->_line[n].text[j]);
+ if (test) {
+ ep[j] = test + '0';
+ } else {
+ ep[j] = ' ';
+ }
+ }
+ ep[j] = '\0';
+ _tracef("%*s[%2d]%*s='%s'", (int) strlen(name),
+ "widec", n, 8, " ", my_buffer);
+ }
+ });
+
/* dump A_COLOR part, will screw up if there are more than 96 */
havecolors = FALSE;
for (j = 0; j < width; ++j)
@@ -107,7 +132,7 @@ _tracedump(const char *name, WINDOW *win)
break;
}
if (havecolors) {
- ep = buf;
+ ep = my_buffer;
for (j = 0; j < width; ++j) {
int pair = GetPair(win->_line[n].text[j]);
if (pair >= 52)
@@ -123,7 +148,7 @@ _tracedump(const char *name, WINDOW *win)
}
ep[j] = '\0';
_tracef("%*s[%2d]%*s='%s'", (int) strlen(name),
- "colors", n, 8, " ", buf);
+ "colors", n, 8, " ", my_buffer);
}
for (i = 0; i < 4; ++i) {
@@ -137,20 +162,20 @@ _tracedump(const char *name, WINDOW *win)
break;
}
if (haveattrs) {
- ep = buf;
+ ep = my_buffer;
for (j = 0; j < width; ++j)
ep[j] = hex[(AttrOf(win->_line[n].text[j]) & mask) >>
((i + 4) * 4)];
ep[j] = '\0';
_tracef("%*s%d[%2d]%*s='%s'", (int) strlen(name) -
- 1, "attrs", i, n, 8, " ", buf);
+ 1, "attrs", i, n, 8, " ", my_buffer);
}
}
}
#if NO_LEAKS
- free(buf);
- buf = 0;
- used = 0;
+ free(my_buffer);
+ my_buffer = 0;
+ my_length = 0;
#endif
}
diff --git a/contrib/ncurses/ncurses/trace/lib_tracemse.c b/contrib/ncurses/ncurses/trace/lib_tracemse.c
index 98290a1..5edcc13 100644
--- a/contrib/ncurses/ncurses/trace/lib_tracemse.c
+++ b/contrib/ncurses/ncurses/trace/lib_tracemse.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2007 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,23 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_tracemse.c,v 1.12 2005/06/11 19:53:50 tom Exp $")
+MODULE_ID("$Id: lib_tracemse.c,v 1.13 2007/04/21 21:23:00 tom Exp $")
#ifdef TRACE
+#define my_buffer _nc_globals.tracemse_buf
+
NCURSES_EXPORT(char *)
_tracemouse(MEVENT const *ep)
{
- /*
- * hmm - format is no longer than 80 columns, there are 5 numbers that
- * could at most have 10 digits, and the mask contains no more than 32 bits
- * with each bit representing less than 15 characters. Usually the whole
- * string is less than 80 columns, but this buffer size is an absolute
- * limit.
- */
- static char buf[80 + (5 * 10) + (32 * 15)];
-
- (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {",
+ (void) sprintf(my_buffer, TRACEMSE_FMT,
ep->id,
ep->x,
ep->y,
ep->z,
(unsigned long) ep->bstate);
-#define SHOW(m, s) if ((ep->bstate & m) == m) strcat(strcat(buf, s), ", ")
+#define SHOW(m, s) if ((ep->bstate & m) == m) strcat(strcat(my_buffer, s), ", ")
SHOW(BUTTON1_RELEASED, "release-1");
SHOW(BUTTON1_PRESSED, "press-1");
@@ -115,10 +108,10 @@ _tracemouse(MEVENT const *ep)
#undef SHOW
- if (buf[strlen(buf) - 1] == ' ')
- buf[strlen(buf) - 2] = '\0';
- (void) strcat(buf, "}");
- return (buf);
+ if (my_buffer[strlen(my_buffer) - 1] == ' ')
+ my_buffer[strlen(my_buffer) - 2] = '\0';
+ (void) strcat(my_buffer, "}");
+ return (my_buffer);
}
#else /* !TRACE */
diff --git a/contrib/ncurses/ncurses/trace/trace_buf.c b/contrib/ncurses/ncurses/trace/trace_buf.c
index 85b4fbe..7bf91c6 100644
--- a/contrib/ncurses/ncurses/trace/trace_buf.c
+++ b/contrib/ncurses/ncurses/trace/trace_buf.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2007 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,46 +35,42 @@
#include <curses.priv.h>
-MODULE_ID("$Id: trace_buf.c,v 1.12 2003/03/15 21:21:36 tom Exp $")
+MODULE_ID("$Id: trace_buf.c,v 1.13 2007/04/21 22:50:08 tom Exp $")
-typedef struct {
- char *text;
- size_t size;
-} LIST;
+#define MyList _nc_globals.tracebuf_ptr
+#define MySize _nc_globals.tracebuf_used
static char *
_nc_trace_alloc(int bufnum, size_t want)
{
char *result = 0;
- static LIST *list;
- static size_t have;
if (bufnum >= 0) {
- if ((size_t) (bufnum + 1) > have) {
+ if ((size_t) (bufnum + 1) > MySize) {
size_t need = (bufnum + 1) * 2;
- if ((list = typeRealloc(LIST, need, list)) == 0)
+ if ((MyList = typeRealloc(TRACEBUF, need, MyList)) == 0)
return (0);
- while (need > have)
- list[have++].text = 0;
+ while (need > MySize)
+ MyList[MySize++].text = 0;
}
- if (list[bufnum].text == 0
- || want > list[bufnum].size) {
- if ((list[bufnum].text = typeRealloc(char, want, list[bufnum].text))
- != 0)
- list[bufnum].size = want;
+ if (MyList[bufnum].text == 0
+ || want > MyList[bufnum].size) {
+ MyList[bufnum].text = typeRealloc(char, want, MyList[bufnum].text);
+ if (MyList[bufnum].text != 0)
+ MyList[bufnum].size = want;
}
- result = list[bufnum].text;
+ result = MyList[bufnum].text;
}
#if NO_LEAKS
else {
- if (have) {
- while (have--) {
- if (list[have].text != 0)
- free(list[have].text);
+ if (MySize) {
+ while (MySize--) {
+ if (MyList[MySize].text != 0)
+ free(MyList[MySize].text);
}
- free(list);
+ free(MyList);
}
}
#endif
diff --git a/contrib/ncurses/ncurses/trace/trace_tries.c b/contrib/ncurses/ncurses/trace/trace_tries.c
index d703322..0aa0b22 100644
--- a/contrib/ncurses/ncurses/trace/trace_tries.c
+++ b/contrib/ncurses/ncurses/trace/trace_tries.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999,2000,2001 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2006,2007 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,25 +35,27 @@
#include <curses.priv.h>
-MODULE_ID("$Id: trace_tries.c,v 1.10 2001/10/20 22:42:51 tom Exp $")
+MODULE_ID("$Id: trace_tries.c,v 1.12 2007/04/21 21:55:41 tom Exp $")
#ifdef TRACE
-static unsigned char *buffer;
-static unsigned len;
+#define my_buffer _nc_globals.tracetry_buf
+#define my_length _nc_globals.tracetry_used
static void
-recur_tries(struct tries *tree, unsigned level)
+recur_tries(TRIES * tree, unsigned level)
{
- if (level > len)
- buffer = (unsigned char *) realloc(buffer, len = (level + 1) * 4);
+ if (level > my_length) {
+ my_length = (level + 1) * 4;
+ my_buffer = (unsigned char *) realloc(my_buffer, my_length);
+ }
while (tree != 0) {
- if ((buffer[level] = tree->ch) == 0)
- buffer[level] = 128;
- buffer[level + 1] = 0;
+ if ((my_buffer[level] = tree->ch) == 0)
+ my_buffer[level] = 128;
+ my_buffer[level + 1] = 0;
if (tree->value != 0) {
_tracef("%5d: %s (%s)", tree->value,
- _nc_visbuf((char *) buffer), keyname(tree->value));
+ _nc_visbuf((char *) my_buffer), keyname(tree->value));
}
if (tree->child)
recur_tries(tree->child, level + 1);
@@ -62,13 +64,13 @@ recur_tries(struct tries *tree, unsigned level)
}
NCURSES_EXPORT(void)
-_nc_trace_tries(struct tries *tree)
+_nc_trace_tries(TRIES * tree)
{
- buffer = typeMalloc(unsigned char, len = 80);
+ my_buffer = typeMalloc(unsigned char, my_length = 80);
_tracef("BEGIN tries %p", tree);
recur_tries(tree, 0);
_tracef(". . . tries %p", tree);
- free(buffer);
+ free(my_buffer);
}
#else
diff --git a/contrib/ncurses/ncurses/trace/varargs.c b/contrib/ncurses/ncurses/trace/varargs.c
index aee2010..5e63d21 100644
--- a/contrib/ncurses/ncurses/trace/varargs.c
+++ b/contrib/ncurses/ncurses/trace/varargs.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2001-2002,2003 Free Software Foundation, Inc. *
+ * Copyright (c) 2001-2003,2007 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 @@
#include <ctype.h>
-MODULE_ID("$Id: varargs.c,v 1.4 2003/05/24 21:10:28 tom Exp $")
+MODULE_ID("$Id: varargs.c,v 1.6 2007/07/14 15:51:27 tom Exp $")
#ifdef TRACE
@@ -49,6 +49,9 @@ typedef enum {
#define VA_PTR(type) pval = (char *)va_arg(ap, type)
#define VA_STR(type) sval = va_arg(ap, type)
+#define MyBuffer _nc_globals.tracearg_buf
+#define MyLength _nc_globals.tracearg_used
+
/*
* Returns a string that represents the parameter list of a printf-style call.
*/
@@ -56,8 +59,6 @@ NCURSES_EXPORT(char *)
_nc_varargs(const char *fmt, va_list ap)
{
static char dummy[] = "";
- static char *result_buf;
- static size_t result_len;
char buffer[BUFSIZ];
const char *param;
@@ -65,11 +66,11 @@ _nc_varargs(const char *fmt, va_list ap)
if (fmt == 0 || *fmt == '\0')
return dummy;
- if (result_len == 0)
- result_buf = typeMalloc(char, result_len = BUFSIZ);
- if (result_buf == 0)
+ if (MyLength == 0)
+ MyBuffer = typeMalloc(char, MyLength = BUFSIZ);
+ if (MyBuffer == 0)
return dummy;
- *result_buf = '\0';
+ *MyBuffer = '\0';
while (*fmt != '\0') {
if (*fmt == '%') {
@@ -159,13 +160,14 @@ _nc_varargs(const char *fmt, va_list ap)
case atString:
param = _nc_visbuf2(1, sval);
break;
+ case atUnknown:
default:
strcpy(buffer, "?");
break;
}
- result_len += strlen(param) + 2;
- result_buf = typeRealloc(char, result_len, result_buf);
- sprintf(result_buf + strlen(result_buf), ", %s", param);
+ MyLength += strlen(param) + 2;
+ MyBuffer = typeRealloc(char, MyLength, MyBuffer);
+ sprintf(MyBuffer + strlen(MyBuffer), ", %s", param);
}
}
used = atUnknown;
@@ -175,7 +177,7 @@ _nc_varargs(const char *fmt, va_list ap)
}
}
- return (result_buf);
+ return (MyBuffer);
}
#else
empty_module(_nc_varargs)
diff --git a/contrib/ncurses/ncurses/trace/visbuf.c b/contrib/ncurses/ncurses/trace/visbuf.c
index 0540ee6..74081ef 100644
--- a/contrib/ncurses/ncurses/trace/visbuf.c
+++ b/contrib/ncurses/ncurses/trace/visbuf.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2001-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 2001-2006,2007 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,11 +42,16 @@
#include <tic.h>
#include <ctype.h>
-MODULE_ID("$Id: visbuf.c,v 1.21 2006/12/02 21:20:28 tom Exp $")
+MODULE_ID("$Id: visbuf.c,v 1.26 2007/06/09 17:21:53 tom Exp $")
-static const char d_quote[] = {D_QUOTE, 0};
-static const char l_brace[] = {L_BRACE, 0};
-static const char r_brace[] = {R_BRACE, 0};
+#define NormalLen(len) (unsigned) ((len + 1) * 4)
+#define WideLen(len) (unsigned) ((len + 1) * 4 * MB_CUR_MAX)
+
+#ifdef TRACE
+static const char d_quote[] = StringOf(D_QUOTE);
+static const char l_brace[] = StringOf(L_BRACE);
+static const char r_brace[] = StringOf(R_BRACE);
+#endif
static char *
_nc_vischar(char *tp, unsigned c)
@@ -68,6 +73,10 @@ _nc_vischar(char *tp, unsigned c)
} else if (c == '\033') {
*tp++ = '\\';
*tp++ = 'e';
+ } else if (UChar(c) == 0x7f) {
+ *tp++ = '\\';
+ *tp++ = '^';
+ *tp++ = '?';
} else if (is7bits(c) && iscntrl(UChar(c))) {
*tp++ = '\\';
*tp++ = '^';
@@ -96,11 +105,11 @@ _nc_visbuf2n(int bufnum, const char *buf, int len)
len = strlen(buf);
#ifdef TRACE
- tp = vbuf = _nc_trace_buf(bufnum, (unsigned) (len * 4) + 5);
+ tp = vbuf = _nc_trace_buf(bufnum, NormalLen(len));
#else
{
- static char *mybuf[2];
- mybuf[bufnum] = typeRealloc(char, (unsigned) (len * 4) + 5, mybuf[bufnum]);
+ static char *mybuf[4];
+ mybuf[bufnum] = typeRealloc(char, NormalLen(len), mybuf[bufnum]);
tp = vbuf = mybuf[bufnum];
}
#endif
@@ -161,11 +170,11 @@ _nc_viswbuf2n(int bufnum, const wchar_t *buf, int len)
len = wcslen(buf);
#ifdef TRACE
- tp = vbuf = _nc_trace_buf(bufnum, (unsigned) (len * 4) + 5);
+ tp = vbuf = _nc_trace_buf(bufnum, WideLen(len));
#else
{
static char *mybuf[2];
- mybuf[bufnum] = typeRealloc(char, (unsigned) (len * 4) + 5, mybuf[bufnum]);
+ mybuf[bufnum] = typeRealloc(char, WideLen(len), mybuf[bufnum]);
tp = vbuf = mybuf[bufnum];
}
#endif
@@ -259,7 +268,8 @@ _nc_viscbuf2(int bufnum, const NCURSES_CH_T * buf, int len)
result = _nc_trace_bufcat(bufnum, l_brace);
result = _nc_trace_bufcat(bufnum, d_quote);
for (j = first; j <= last; ++j) {
- if ((found = _nc_altcharset_name(attr, (chtype) CharOf(buf[j]))) != 0) {
+ found = _nc_altcharset_name(attr, (chtype) CharOf(buf[j]));
+ if (found != 0) {
result = _nc_trace_bufcat(bufnum, found);
attr &= ~A_ALTCHARSET;
} else
diff --git a/contrib/ncurses/ncurses/tty/hardscroll.c b/contrib/ncurses/ncurses/tty/hardscroll.c
index 7815db7..7d8979a 100644
--- a/contrib/ncurses/ncurses/tty/hardscroll.c
+++ b/contrib/ncurses/ncurses/tty/hardscroll.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 *
@@ -145,7 +145,7 @@ AUTHOR
#include <curses.priv.h>
-MODULE_ID("$Id: hardscroll.c,v 1.36 2001/01/14 00:17:28 tom Exp $")
+MODULE_ID("$Id: hardscroll.c,v 1.41 2007/09/29 21:48:36 tom Exp $")
#if defined(SCROLLDEBUG) || defined(HASHDEBUG)
@@ -158,22 +158,25 @@ oldnums[MAXLINES];
# undef TR
# define TR(n, a) if (_nc_tracing & (n)) { _tracef a ; putchar('\n'); }
+extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing;
+
#else /* no debug */
/* OLDNUM(n) indicates which line will be shifted to the position n.
if OLDNUM(n) == _NEWINDEX, then the line n in new, not shifted from
somewhere. */
NCURSES_EXPORT_VAR(int *)
-_nc_oldnums = 0;
+_nc_oldnums = 0; /* obsolete: keep for ABI compat */
# if USE_HASHMAP
- static int oldnums_allocated = 0;
-# define oldnums _nc_oldnums
+# define oldnums SP->_oldnum_list
# define OLDNUM(n) oldnums[n]
# else /* !USE_HASHMAP */
# define OLDNUM(n) newscr->_line[n].oldindex
# endif /* !USE_HASHMAP */
+#define OLDNUM_SIZE SP->_oldnum_size
+
#endif /* defined(SCROLLDEBUG) || defined(HASHDEBUG) */
NCURSES_EXPORT(void)
@@ -183,17 +186,17 @@ _nc_scroll_optimize(void)
int i;
int start, end, shift;
- TR(TRACE_ICALLS, ("_nc_scroll_optimize() begins"));
+ TR(TRACE_ICALLS, (T_CALLED("_nc_scroll_optimize")));
#if !defined(SCROLLDEBUG) && !defined(HASHDEBUG)
#if USE_HASHMAP
/* get enough storage */
- if (oldnums_allocated < screen_lines) {
+ if (OLDNUM_SIZE < screen_lines) {
int *new_oldnums = typeRealloc(int, screen_lines, oldnums);
if (!new_oldnums)
return;
oldnums = new_oldnums;
- oldnums_allocated = screen_lines;
+ OLDNUM_SIZE = screen_lines;
}
/* calculate the indices */
_nc_hash_map();
@@ -201,8 +204,10 @@ _nc_scroll_optimize(void)
#endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */
#ifdef TRACE
- if (_nc_tracing & (TRACE_UPDATE | TRACE_MOVE))
+ if (USE_TRACEF(TRACE_UPDATE | TRACE_MOVE)) {
_nc_linedump();
+ _nc_unlock_global(tracef);
+ }
#endif /* TRACE */
/* pass 1 - from top to bottom scrolling up */
@@ -253,6 +258,7 @@ _nc_scroll_optimize(void)
}
#endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */
}
+ TR(TRACE_ICALLS, (T_RETURN("")));
}
#if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG)
@@ -260,23 +266,17 @@ NCURSES_EXPORT(void)
_nc_linedump(void)
/* dump the state of the real and virtual oldnum fields */
{
- static size_t have;
- static char *buf;
-
int n;
+ char *buf = 0;
size_t want = (screen_lines + 1) * 4;
- if (have < want)
- buf = typeMalloc(char, have = want);
+ buf = typeMalloc(char, want);
(void) strcpy(buf, "virt");
for (n = 0; n < screen_lines; n++)
(void) sprintf(buf + strlen(buf), " %02d", OLDNUM(n));
TR(TRACE_UPDATE | TRACE_MOVE, (buf));
-#if NO_LEAKS
free(buf);
- have = 0;
-#endif
}
#endif /* defined(TRACE) || defined(SCROLLDEBUG) */
diff --git a/contrib/ncurses/ncurses/tty/hashmap.c b/contrib/ncurses/ncurses/tty/hashmap.c
index 1f482d4..9b60df6 100644
--- a/contrib/ncurses/ncurses/tty/hashmap.c
+++ b/contrib/ncurses/ncurses/tty/hashmap.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 *
@@ -70,7 +70,7 @@ AUTHOR
#include <curses.priv.h>
#include <term.h> /* for back_color_erase */
-MODULE_ID("$Id: hashmap.c,v 1.49 2006/03/11 19:33:49 tom Exp $")
+MODULE_ID("$Id: hashmap.c,v 1.56 2007/10/13 18:47:25 Miroslav.Lichvar Exp $")
#ifdef HASHDEBUG
@@ -81,7 +81,8 @@ MODULE_ID("$Id: hashmap.c,v 1.49 2006/03/11 19:33:49 tom Exp $")
# define screen_lines MAXLINES
# define TEXTWIDTH 1
int oldnums[MAXLINES], reallines[MAXLINES];
-static chtype oldtext[MAXLINES][TEXTWIDTH], newtext[MAXLINES][TEXTWIDTH];
+static NCURSES_CH_T oldtext[MAXLINES][TEXTWIDTH];
+static NCURSES_CH_T newtext[MAXLINES][TEXTWIDTH];
# define OLDNUM(n) oldnums[n]
# define OLDTEXT(n) oldtext[n]
# define NEWTEXT(m) newtext[m]
@@ -89,7 +90,7 @@ static chtype oldtext[MAXLINES][TEXTWIDTH], newtext[MAXLINES][TEXTWIDTH];
#else /* !HASHDEBUG */
-# define OLDNUM(n) _nc_oldnums[n]
+# define OLDNUM(n) SP->_oldnum_list[n]
# define OLDTEXT(n) curscr->_line[n].text
# define NEWTEXT(m) newscr->_line[m].text
# define TEXTWIDTH (curscr->_maxx+1)
@@ -130,8 +131,8 @@ update_cost(NCURSES_CH_T * from, NCURSES_CH_T * to)
int cost = 0;
int i;
- for (i = TEXTWIDTH; i > 0; i--)
- if (!(CharEq(*from++, *to++)))
+ for (i = TEXTWIDTH; i > 0; i--, from++, to++)
+ if (!(CharEq(*from, *to)))
cost++;
return cost;
@@ -147,8 +148,8 @@ update_cost_from_blank(NCURSES_CH_T * to)
if (back_color_erase)
SetPair(blank, GetPair(stdscr->_nc_bkgd));
- for (i = TEXTWIDTH; i > 0; i--)
- if (!(CharEq(blank, *to++)))
+ for (i = TEXTWIDTH; i > 0; i--, to++)
+ if (!(CharEq(blank, *to)))
cost++;
return cost;
@@ -446,11 +447,14 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
char line[BUFSIZ], *st;
int n;
- SP = typeCalloc(SCREEN, 1);
+ if (setupterm(NULL, fileno(stdout), (int *) 0) == ERR)
+ return EXIT_FAILURE;
+ (void) _nc_alloc_screen();
+
for (n = 0; n < screen_lines; n++) {
reallines[n] = n;
oldnums[n] = _NEWINDEX;
- oldtext[n][0] = newtext[n][0] = '.';
+ CharOf(oldtext[n][0]) = CharOf(newtext[n][0]) = '.';
}
if (isatty(fileno(stdin)))
@@ -462,7 +466,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
for (;;) {
/* grab a test command */
if (fgets(line, sizeof(line), stdin) == (char *) NULL)
- exit(EXIT_SUCCESS);
+ break;
switch (line[0]) {
case '#': /* comment */
@@ -484,22 +488,22 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
case 'n': /* use following letters as text of new lines */
for (n = 0; n < screen_lines; n++)
- newtext[n][0] = '.';
+ CharOf(newtext[n][0]) = '.';
for (n = 0; n < screen_lines; n++)
if (line[n + 1] == '\n')
break;
else
- newtext[n][0] = line[n + 1];
+ CharOf(newtext[n][0]) = line[n + 1];
break;
case 'o': /* use following letters as text of old lines */
for (n = 0; n < screen_lines; n++)
- oldtext[n][0] = '.';
+ CharOf(oldtext[n][0]) = '.';
for (n = 0; n < screen_lines; n++)
if (line[n + 1] == '\n')
break;
else
- oldtext[n][0] = line[n + 1];
+ CharOf(oldtext[n][0]) = line[n + 1];
break;
case 'd': /* dump state of test arrays */
@@ -508,12 +512,12 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
#endif
(void) fputs("Old lines: [", stdout);
for (n = 0; n < screen_lines; n++)
- putchar(oldtext[n][0]);
+ putchar(CharOf(oldtext[n][0]));
putchar(']');
putchar('\n');
(void) fputs("New lines: [", stdout);
for (n = 0; n < screen_lines; n++)
- putchar(newtext[n][0]);
+ putchar(CharOf(newtext[n][0]));
putchar(']');
putchar('\n');
break;
@@ -527,12 +531,17 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
_nc_scroll_optimize();
(void) fputs("Done.\n", stderr);
break;
+ default:
case '?':
usage();
break;
}
}
+#if NO_LEAKS
+ _nc_free_and_exit(EXIT_SUCCESS);
+#else
return EXIT_SUCCESS;
+#endif
}
#endif /* HASHDEBUG */
diff --git a/contrib/ncurses/ncurses/tty/lib_mvcur.c b/contrib/ncurses/ncurses/tty/lib_mvcur.c
index 4c0ef4a..19984c9 100644
--- a/contrib/ncurses/ncurses/tty/lib_mvcur.c
+++ b/contrib/ncurses/ncurses/tty/lib_mvcur.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 *
@@ -155,7 +155,7 @@
#include <term.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_mvcur.c,v 1.107 2006/11/25 22:31:59 tom Exp $")
+MODULE_ID("$Id: lib_mvcur.c,v 1.110 2007/08/11 16:15:57 tom Exp $")
#define WANT_CHAR(y, x) SP->_newscr->_line[y].text[x] /* desired state */
#define BAUDRATE cur_term->_baudrate /* bits per second */
@@ -959,6 +959,7 @@ NCURSES_EXPORT_VAR(int) _nc_optimize_enable = OPTIMIZE_ALL;
#include <tic.h>
#include <dump_entry.h>
+#include <time.h>
NCURSES_EXPORT_VAR(const char *) _nc_progname = "mvcur";
@@ -1017,7 +1018,7 @@ roll(int n)
int
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
- (void) strcpy(tname, termname());
+ strcpy(tname, getenv("TERM"));
load_term();
_nc_setupscreen(lines, columns, stdout, FALSE, 0);
baudrate();
@@ -1088,7 +1089,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
load_term();
} else if (sscanf(buf, "d %s", capname) == 1) {
struct name_table_entry const *np = _nc_find_entry(capname,
- _nc_info_hash_table);
+ _nc_get_hash_table(FALSE));
if (np == NULL)
(void) printf("No such capability as \"%s\"\n", capname);
@@ -1116,7 +1117,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
}
} else if (buf[0] == 'i') {
dump_init((char *) NULL, F_TERMINFO, S_TERMINFO, 70, 0, FALSE);
- dump_entry(&cur_term->type, FALSE, TRUE, 0, 0, 0);
+ dump_entry(&cur_term->type, FALSE, TRUE, 0, 0);
putchar('\n');
} else if (buf[0] == 'o') {
if (_nc_optimize_enable & OPTIMIZE_MVCUR) {
diff --git a/contrib/ncurses/ncurses/tty/lib_tstp.c b/contrib/ncurses/ncurses/tty/lib_tstp.c
index 4c9f9fb..2a341fa 100644
--- a/contrib/ncurses/ncurses/tty/lib_tstp.c
+++ b/contrib/ncurses/ncurses/tty/lib_tstp.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 _POSIX_SOURCE
#endif
-MODULE_ID("$Id: lib_tstp.c,v 1.32 2006/04/01 19:31:34 tom Exp $")
+MODULE_ID("$Id: lib_tstp.c,v 1.36 2007/04/21 19:51:29 tom Exp $")
#if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC)
#define USE_SIGTSTP 1
@@ -234,14 +234,12 @@ tstp(int dummy GCC_UNUSED)
static void
cleanup(int sig)
{
- static int nested;
-
/*
* Actually, doing any sort of I/O from within an signal handler is
* "unsafe". But we'll _try_ to clean up the screen and terminal
* settings on the way out.
*/
- if (!nested++
+ if (!_nc_globals.cleanup_nested++
&& (sig == SIGINT
|| sig == SIGQUIT)) {
#if HAVE_SIGACTION || HAVE_SIGVEC
@@ -277,7 +275,7 @@ cleanup(int sig)
static void
sigwinch(int sig GCC_UNUSED)
{
- _nc_handle_sigwinch(-1);
+ _nc_globals.have_sigwinch = 1;
}
#endif /* USE_SIGWINCH */
@@ -351,29 +349,27 @@ CatchIfDefault(int sig, RETSIGTYPE (*handler) (int))
NCURSES_EXPORT(void)
_nc_signal_handler(bool enable)
{
- static bool initialized = FALSE;
-
T((T_CALLED("_nc_signal_handler(%d)"), enable));
#if USE_SIGTSTP /* Xenix 2.x doesn't have SIGTSTP, for example */
{
static bool ignore_tstp = FALSE;
if (!ignore_tstp) {
- static sigaction_t act, oact;
+ static sigaction_t new_sigaction, old_sigaction;
if (!enable) {
- act.sa_handler = SIG_IGN;
- sigaction(SIGTSTP, &act, &oact);
- } else if (act.sa_handler != SIG_DFL) {
- sigaction(SIGTSTP, &oact, NULL);
- } else if (sigaction(SIGTSTP, NULL, &oact) == 0
- && (oact.sa_handler == SIG_DFL)) {
- sigemptyset(&act.sa_mask);
+ new_sigaction.sa_handler = SIG_IGN;
+ sigaction(SIGTSTP, &new_sigaction, &old_sigaction);
+ } else if (new_sigaction.sa_handler != SIG_DFL) {
+ sigaction(SIGTSTP, &old_sigaction, NULL);
+ } else if (sigaction(SIGTSTP, NULL, &old_sigaction) == 0
+ && (old_sigaction.sa_handler == SIG_DFL)) {
+ sigemptyset(&new_sigaction.sa_mask);
#ifdef SA_RESTART
- act.sa_flags |= SA_RESTART;
+ new_sigaction.sa_flags |= SA_RESTART;
#endif /* SA_RESTART */
- act.sa_handler = tstp;
- (void) sigaction(SIGTSTP, &act, NULL);
+ new_sigaction.sa_handler = tstp;
+ (void) sigaction(SIGTSTP, &new_sigaction, NULL);
} else {
ignore_tstp = TRUE;
}
@@ -381,14 +377,14 @@ _nc_signal_handler(bool enable)
}
#endif /* !USE_SIGTSTP */
- if (!initialized) {
+ if (!_nc_globals.init_signals) {
if (enable) {
CatchIfDefault(SIGINT, cleanup);
CatchIfDefault(SIGTERM, cleanup);
#if USE_SIGWINCH
CatchIfDefault(SIGWINCH, sigwinch);
#endif
- initialized = TRUE;
+ _nc_globals.init_signals = TRUE;
}
}
returnVoid;
diff --git a/contrib/ncurses/ncurses/tty/lib_twait.c b/contrib/ncurses/ncurses/tty/lib_twait.c
index 28e503f..1e4546d 100644
--- a/contrib/ncurses/ncurses/tty/lib_twait.c
+++ b/contrib/ncurses/ncurses/tty/lib_twait.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2004,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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,7 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
****************************************************************************/
/*
@@ -61,38 +62,42 @@
# endif
#endif
-MODULE_ID("$Id: lib_twait.c,v 1.51 2006/05/27 21:57:43 tom Exp $")
+MODULE_ID("$Id: lib_twait.c,v 1.54 2007/08/11 16:32:48 tom Exp $")
+
+#if HAVE_GETTIMEOFDAY
+# define PRECISE_GETTIME 1
+# define TimeType struct timeval
+#else
+# define PRECISE_GETTIME 0
+# define TimeType time_t
+#endif
static long
-_nc_gettime(bool first)
+_nc_gettime(TimeType * t0, bool first)
{
long res;
-#if HAVE_GETTIMEOFDAY
-# define PRECISE_GETTIME 1
- static struct timeval t0;
- struct timeval t1;
+#if PRECISE_GETTIME
+ TimeType t1;
gettimeofday(&t1, (struct timezone *) 0);
if (first) {
- t0 = t1;
+ *t0 = t1;
res = 0;
} else {
/* .tv_sec and .tv_usec are unsigned, be careful when subtracting */
- if (t0.tv_usec > t1.tv_usec) { /* Convert 1s in 1e6 microsecs */
- t1.tv_usec += 1000000;
+ if (t0->tv_usec > t1.tv_usec) {
+ t1.tv_usec += 1000000; /* Convert 1s in 1e6 microsecs */
t1.tv_sec--;
}
- res = (t1.tv_sec - t0.tv_sec) * 1000
- + (t1.tv_usec - t0.tv_usec) / 1000;
+ res = (t1.tv_sec - t0->tv_sec) * 1000
+ + (t1.tv_usec - t0->tv_usec) / 1000;
}
#else
-# define PRECISE_GETTIME 0
- static time_t t0;
time_t t1 = time((time_t *) 0);
if (first) {
- t0 = t1;
+ *t0 = t1;
}
- res = (t1 - t0) * 1000;
+ res = (t1 - *t0) * 1000;
#endif
TR(TRACE_IEVENT, ("%s time: %ld msec", first ? "get" : "elapsed", res));
return res;
@@ -147,7 +152,8 @@ _nc_timed_wait(int mode,
{
int fd;
int count;
- int result;
+ int result = 0;
+ TimeType t0;
#ifdef NCURSES_WGETCH_EVENTS
int timeout_is_event = 0;
@@ -160,7 +166,7 @@ _nc_timed_wait(int mode,
struct pollfd *fds = fd_list;
#elif defined(__BEOS__)
#elif HAVE_SELECT
- static fd_set set;
+ fd_set set;
#endif
long starttime, returntime;
@@ -180,10 +186,10 @@ _nc_timed_wait(int mode,
}
#endif
-#if PRECISE_GETTIME
+#if PRECISE_GETTIME && HAVE_NANOSLEEP
retry:
#endif
- starttime = _nc_gettime(TRUE);
+ starttime = _nc_gettime(&t0, TRUE);
count = 0;
@@ -362,7 +368,7 @@ _nc_timed_wait(int mode,
#endif /* USE_FUNC_POLL, etc */
- returntime = _nc_gettime(FALSE);
+ returntime = _nc_gettime(&t0, FALSE);
if (milliseconds >= 0)
milliseconds -= (returntime - starttime);
diff --git a/contrib/ncurses/ncurses/tty/lib_vidattr.c b/contrib/ncurses/ncurses/tty/lib_vidattr.c
index dbbbc97..ac2a74f 100644
--- a/contrib/ncurses/ncurses/tty/lib_vidattr.c
+++ b/contrib/ncurses/ncurses/tty/lib_vidattr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 *
@@ -65,7 +65,7 @@
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$Id: lib_vidattr.c,v 1.46 2006/01/21 23:39:40 tom Exp $")
+MODULE_ID("$Id: lib_vidattr.c,v 1.49 2007/06/30 21:58:04 tom Exp $")
#define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc)
@@ -87,10 +87,11 @@ MODULE_ID("$Id: lib_vidattr.c,v 1.46 2006/01/21 23:39:40 tom Exp $")
} \
}
+#define PreviousAttr _nc_prescreen.previous_attr
+
NCURSES_EXPORT(int)
vidputs(chtype newmode, int (*outc) (int))
{
- static attr_t previous_attr = A_NORMAL;
attr_t turn_on, turn_off;
int pair;
bool reverse = FALSE;
@@ -101,18 +102,19 @@ vidputs(chtype newmode, int (*outc) (int))
#define fix_pair0 FALSE
#endif
+ newmode &= A_ATTRIBUTES;
T((T_CALLED("vidputs(%s)"), _traceattr(newmode)));
/* this allows us to go on whether or not newterm() has been called */
if (SP)
- previous_attr = AttrOf(SCREEN_ATTRS(SP));
+ PreviousAttr = AttrOf(SCREEN_ATTRS(SP));
- TR(TRACE_ATTRS, ("previous attribute was %s", _traceattr(previous_attr)));
+ TR(TRACE_ATTRS, ("previous attribute was %s", _traceattr(PreviousAttr)));
if ((SP != 0)
&& (magic_cookie_glitch > 0)) {
#if USE_XMC_SUPPORT
- static chtype table[] =
+ static const chtype table[] =
{
A_STANDOUT,
A_UNDERLINE,
@@ -183,7 +185,7 @@ vidputs(chtype newmode, int (*outc) (int))
newmode &= ~mask;
}
- if (newmode == previous_attr)
+ if (newmode == PreviousAttr)
returnCode(OK);
pair = PAIR_NUMBER(newmode);
@@ -192,17 +194,17 @@ vidputs(chtype newmode, int (*outc) (int))
newmode &= ~A_REVERSE;
}
- turn_off = (~newmode & previous_attr) & ALL_BUT_COLOR;
- turn_on = (newmode & ~previous_attr) & ALL_BUT_COLOR;
+ turn_off = (~newmode & PreviousAttr) & ALL_BUT_COLOR;
+ turn_on = (newmode & ~PreviousAttr) & ALL_BUT_COLOR;
- SetColorsIf(((pair == 0) && !fix_pair0), previous_attr);
+ SetColorsIf(((pair == 0) && !fix_pair0), PreviousAttr);
if (newmode == A_NORMAL) {
- if ((previous_attr & A_ALTCHARSET) && exit_alt_charset_mode) {
+ if ((PreviousAttr & A_ALTCHARSET) && exit_alt_charset_mode) {
doPut(exit_alt_charset_mode);
- previous_attr &= ~A_ALTCHARSET;
+ PreviousAttr &= ~A_ALTCHARSET;
}
- if (previous_attr) {
+ if (PreviousAttr) {
if (exit_attribute_mode) {
doPut(exit_attribute_mode);
} else {
@@ -213,10 +215,10 @@ vidputs(chtype newmode, int (*outc) (int))
TurnOff(A_STANDOUT, exit_standout_mode);
}
}
- previous_attr &= ALL_BUT_COLOR;
+ PreviousAttr &= ALL_BUT_COLOR;
}
- SetColorsIf((pair != 0) || fix_pair0, previous_attr);
+ SetColorsIf((pair != 0) || fix_pair0, PreviousAttr);
} else if (set_attributes) {
if (turn_on || turn_off) {
TPUTS_TRACE("set_attributes");
@@ -230,9 +232,9 @@ vidputs(chtype newmode, int (*outc) (int))
(newmode & A_INVIS) != 0,
(newmode & A_PROTECT) != 0,
(newmode & A_ALTCHARSET) != 0), 1, outc);
- previous_attr &= ALL_BUT_COLOR;
+ PreviousAttr &= ALL_BUT_COLOR;
}
- SetColorsIf((pair != 0) || fix_pair0, previous_attr);
+ SetColorsIf((pair != 0) || fix_pair0, PreviousAttr);
} else {
TR(TRACE_ATTRS, ("turning %s off", _traceattr(turn_off)));
@@ -250,9 +252,9 @@ vidputs(chtype newmode, int (*outc) (int))
if (turn_off && exit_attribute_mode) {
doPut(exit_attribute_mode);
turn_on |= (newmode & ALL_BUT_COLOR);
- previous_attr &= ALL_BUT_COLOR;
+ PreviousAttr &= ALL_BUT_COLOR;
}
- SetColorsIf((pair != 0) || fix_pair0, previous_attr);
+ SetColorsIf((pair != 0) || fix_pair0, PreviousAttr);
TR(TRACE_ATTRS, ("turning %s on", _traceattr(turn_on)));
/* *INDENT-OFF* */
@@ -283,7 +285,7 @@ vidputs(chtype newmode, int (*outc) (int))
if (SP)
SetAttr(SCREEN_ATTRS(SP), newmode);
else
- previous_attr = newmode;
+ PreviousAttr = newmode;
returnCode(OK);
}
diff --git a/contrib/ncurses/ncurses/tty/tty_update.c b/contrib/ncurses/ncurses/tty/tty_update.c
index 6926b56..8666813 100644
--- a/contrib/ncurses/ncurses/tty/tty_update.c
+++ b/contrib/ncurses/ncurses/tty/tty_update.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 *
@@ -74,7 +74,7 @@
#include <ctype.h>
#include <term.h>
-MODULE_ID("$Id: tty_update.c,v 1.238 2006/11/25 22:33:21 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.243 2007/10/13 20:03:32 tom Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
@@ -289,7 +289,7 @@ PutAttrChar(CARG_CH_T ch)
#endif
{
PUTC(CHDEREF(ch), SP->_ofp); /* macro's fastest... */
- TRACE_OUTCHARS(1);
+ COUNT_OUTCHARS(1);
}
SP->_curscol += chlen;
if (char_padding) {
@@ -624,13 +624,18 @@ doupdate(void)
T((T_CALLED("doupdate()")));
+ if (curscr == 0
+ || newscr == 0)
+ returnCode(ERR);
+
#ifdef TRACE
- if (_nc_tracing & TRACE_UPDATE) {
+ if (USE_TRACEF(TRACE_UPDATE)) {
if (curscr->_clear)
_tracef("curscr is clear");
else
_tracedump("curscr", curscr);
_tracedump("newscr", newscr);
+ _nc_unlock_global(tracef);
}
#endif /* TRACE */
@@ -640,7 +645,7 @@ doupdate(void)
SP->_fifohold--;
#if USE_SIZECHANGE
- if (SP->_endwin || SP->_sig_winch) {
+ if (SP->_endwin || _nc_handle_sigwinch(FALSE)) {
/*
* This is a transparent extension: XSI does not address it,
* and applications need not know that ncurses can do it.
@@ -666,7 +671,7 @@ doupdate(void)
}
#if USE_TRACE_TIMES
/* zero the metering machinery */
- _nc_outchars = 0;
+ RESET_OUTCHARS();
(void) times(&before);
#endif /* USE_TRACE_TIMES */
@@ -826,9 +831,10 @@ doupdate(void)
#ifdef TRACE
/* show altered highlights after magic-cookie check */
- if (_nc_tracing & TRACE_UPDATE) {
+ if (USE_TRACEF(TRACE_UPDATE)) {
_tracef("After magic-cookie check...");
_tracedump("newscr", newscr);
+ _nc_unlock_global(tracef);
}
#endif /* TRACE */
}
@@ -836,7 +842,6 @@ doupdate(void)
nonempty = 0;
if (curscr->_clear || newscr->_clear) { /* force refresh ? */
- TR(TRACE_UPDATE, ("clearing and updating from scratch"));
ClrUpdate();
curscr->_clear = FALSE; /* reset flag */
newscr->_clear = FALSE; /* reset flag */
@@ -967,7 +972,7 @@ ClrUpdate(void)
NCURSES_CH_T blank = ClrBlank(stdscr);
int nonempty = min(screen_lines, newscr->_maxy + 1);
- TR(TRACE_UPDATE, ("ClrUpdate() called"));
+ TR(TRACE_UPDATE, (T_CALLED("ClrUpdate")));
ClearScreen(blank);
@@ -977,6 +982,8 @@ ClrUpdate(void)
for (i = 0; i < nonempty; i++)
TransformLine(i);
+
+ TR(TRACE_UPDATE, (T_RETURN("")));
}
/*
diff --git a/contrib/ncurses/ncurses/widechar/lib_cchar.c b/contrib/ncurses/ncurses/widechar/lib_cchar.c
index b6458ee..b4a0c37 100644
--- a/contrib/ncurses/ncurses/widechar/lib_cchar.c
+++ b/contrib/ncurses/ncurses/widechar/lib_cchar.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2001-2004,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 2001-2005,2007 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,7 +35,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_cchar.c,v 1.11 2005/01/29 21:29:16 tom Exp $")
+MODULE_ID("$Id: lib_cchar.c,v 1.12 2007/05/12 19:03:06 tom Exp $")
/*
* The SuSv2 description leaves some room for interpretation. We'll assume wch
@@ -54,8 +54,9 @@ setcchar(cchar_t *wcval,
int len;
int code = OK;
- TR(TRACE_CCALLS, (T_CALLED("setcchar(%p,%s,%ld,%d,%p)"),
- wcval, _nc_viswbuf(wch), attrs, color_pair, opts));
+ TR(TRACE_CCALLS, (T_CALLED("setcchar(%p,%s,%lu,%d,%p)"),
+ wcval, _nc_viswbuf(wch),
+ (unsigned long) attrs, color_pair, opts));
len = wcslen(wch);
if (opts != NULL
diff --git a/contrib/ncurses/ncurses/widechar/lib_get_wch.c b/contrib/ncurses/ncurses/widechar/lib_get_wch.c
index c73c363..7985df2 100644
--- a/contrib/ncurses/ncurses/widechar/lib_get_wch.c
+++ b/contrib/ncurses/ncurses/widechar/lib_get_wch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2006,2007 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>
#include <ctype.h>
-MODULE_ID("$Id: lib_get_wch.c,v 1.13 2006/06/03 17:27:57 tom Exp $")
+MODULE_ID("$Id: lib_get_wch.c,v 1.14 2007/05/12 19:03:16 tom Exp $")
#if HAVE_MBTOWC && HAVE_MBLEN
#define reset_mbytes(state) mblen(NULL, 0), mbtowc(NULL, NULL, 0)
@@ -77,7 +77,7 @@ wget_wch(WINDOW *win, wint_t *result)
* _nc_wgetch(), while we want to return a wide character or KEY_xxx code.
*/
for (;;) {
- T(("reading %d of %d", count + 1, sizeof(buffer)));
+ T(("reading %d of %d", (int) count + 1, (int) sizeof(buffer)));
code = _nc_wgetch(win, &value, TRUE EVENTLIST_2nd((_nc_eventlist *) 0));
if (code == ERR) {
break;
diff --git a/contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c b/contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c
index 41ba18c..e9f0646 100644
--- a/contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c
+++ b/contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002,2004 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2004-2007 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 Dickey 2002,2004 *
+ * Author: Thomas Dickey *
****************************************************************************/
/*
@@ -39,27 +39,35 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_in_wchnstr.c,v 1.3 2004/05/16 00:12:30 tom Exp $")
+MODULE_ID("$Id: lib_in_wchnstr.c,v 1.7 2007/02/11 01:00:00 tom Exp $")
NCURSES_EXPORT(int)
-win_wchnstr(WINDOW *win, cchar_t * wchstr, int n)
+win_wchnstr(WINDOW *win, cchar_t *wchstr, int n)
{
int code = OK;
- TR(TRACE_CALLS, (T_CALLED("win_wchnstr(%p,%p,%d)"), win, wchstr, n));
+ T((T_CALLED("win_wchnstr(%p,%p,%d)"), win, wchstr, n));
if (win != 0
&& wchstr != 0) {
+ NCURSES_CH_T *src;
int row, col;
- int j;
+ int j, k, limit;
getyx(win, row, col);
+ limit = getmaxx(win) - col;
+ src = &(win->_line[row].text[col]);
if (n < 0) {
- n = getmaxx(win) + 1 - getcurx(win);
+ n = limit;
+ } else if (n > limit) {
+ n = limit;
}
- for (j = 0; j < n; ++j) {
- wchstr[j] = win->_line[row].text[col + j];
+ for (j = k = 0; j < n; ++j) {
+ if (j == 0 || !WidecExt(src[j]) || isWidecBase(src[j])) {
+ wchstr[k++] = src[j];
+ }
}
+ memset(&(wchstr[k]), 0, sizeof(*wchstr));
T(("result = %s", _nc_viscbuf(wchstr, n)));
} else {
code = ERR;
diff --git a/contrib/ncurses/ncurses/widechar/lib_key_name.c b/contrib/ncurses/ncurses/widechar/lib_key_name.c
new file mode 100644
index 0000000..e24c965
--- /dev/null
+++ b/contrib/ncurses/ncurses/widechar/lib_key_name.c
@@ -0,0 +1,62 @@
+/****************************************************************************
+ * Copyright (c) 2007 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. *
+ ****************************************************************************/
+
+/*
+** lib_key_name.c
+**
+** The routine key_name().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_key_name.c,v 1.2 2007/06/12 21:01:13 tom Exp $")
+
+NCURSES_EXPORT(NCURSES_CONST char *)
+key_name(wchar_t c)
+{
+ cchar_t my_cchar;
+ wchar_t *my_wchars;
+ size_t len;
+
+ /* FIXME: move to _nc_globals */
+ static char result[MB_LEN_MAX + 1];
+
+ memset(&my_cchar, 0, sizeof(my_cchar));
+ my_cchar.chars[0] = c;
+ my_cchar.chars[1] = L'\0';
+
+ my_wchars = wunctrl(&my_cchar);
+ len = wcstombs(result, my_wchars, sizeof(result) - 1);
+ if (isEILSEQ(len) || (len == 0)) {
+ return "UNKNOWN KEY";
+ }
+
+ result[len] = '\0';
+ return result;
+}
diff --git a/contrib/ncurses/ncurses/widechar/lib_unget_wch.c b/contrib/ncurses/ncurses/widechar/lib_unget_wch.c
index 62ec89d..b2dc7ff 100644
--- a/contrib/ncurses/ncurses/widechar/lib_unget_wch.c
+++ b/contrib/ncurses/ncurses/widechar/lib_unget_wch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002-2003,2004 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2004,2007 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,26 +39,30 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_unget_wch.c,v 1.7 2004/12/05 01:21:31 tom Exp $")
+MODULE_ID("$Id: lib_unget_wch.c,v 1.9 2007/11/25 00:57:00 tom Exp $")
-#ifdef linux
/*
- * glibc's wcrtomb() function is broken - does not return the proper value
- * when target is null (noted for glibc 2.3.2). This is a workaround.
+ * Wrapper for wcrtomb() which obtains the length needed for the given
+ * wide-character 'source'.
*/
NCURSES_EXPORT(size_t)
_nc_wcrtomb(char *target, wchar_t source, mbstate_t * state)
{
+ int result;
+
if (target == 0) {
wchar_t temp[2];
const wchar_t *tempp = temp;
temp[0] = source;
temp[1] = 0;
- return wcsrtombs(NULL, &tempp, 0, state);
+ result = wcsrtombs(NULL, &tempp, 0, state);
+ } else {
+ result = wcrtomb(target, source, state);
}
- return wcrtomb(target, source, state);
+ if (!isEILSEQ(result) && (result == 0))
+ result = 1;
+ return result;
}
-#endif
NCURSES_EXPORT(int)
unget_wch(const wchar_t wch)
diff --git a/contrib/ncurses/ncurses/widechar/lib_vid_attr.c b/contrib/ncurses/ncurses/widechar/lib_vid_attr.c
index 2ba16b5..1dc679e 100644
--- a/contrib/ncurses/ncurses/widechar/lib_vid_attr.c
+++ b/contrib/ncurses/ncurses/widechar/lib_vid_attr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2006,2007 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 <term.h>
-MODULE_ID("$Id: lib_vid_attr.c,v 1.4 2006/11/26 00:26:00 tom Exp $")
+MODULE_ID("$Id: lib_vid_attr.c,v 1.5 2007/06/30 22:03:02 tom Exp $")
#define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc)
@@ -72,6 +72,7 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
#define fix_pair0 FALSE
#endif
+ newmode &= A_ATTRIBUTES;
T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair));
/* this allows us to go on whether or not newterm() has been called */
diff --git a/contrib/ncurses/ncurses/widechar/lib_wunctrl.c b/contrib/ncurses/ncurses/widechar/lib_wunctrl.c
index cd7c56ca..be2259a 100644
--- a/contrib/ncurses/ncurses/widechar/lib_wunctrl.c
+++ b/contrib/ncurses/ncurses/widechar/lib_wunctrl.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2001-2003,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 2001-2005,2007 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,23 +35,21 @@
#include <curses.priv.h>
-#if USE_WIDEC_SUPPORT
-
-MODULE_ID("$Id: lib_wunctrl.c,v 1.8 2005/04/16 18:10:44 tom Exp $")
+MODULE_ID("$Id: lib_wunctrl.c,v 1.12 2007/06/12 20:22:32 tom Exp $")
NCURSES_EXPORT(wchar_t *)
wunctrl(cchar_t *wc)
{
- static wchar_t str[5], *sp;
+ static wchar_t str[CCHARW_MAX + 1], *sp;
if (Charable(*wc)) {
const char *p = unctrl((unsigned) _nc_to_char((wint_t) CharOf(*wc)));
- for (sp = str; *p;)
- *sp++ = _nc_to_widechar(*p++);
+ for (sp = str; *p; ++p) {
+ *sp++ = _nc_to_widechar(*p);
+ }
+ *sp = 0;
return str;
} else
return wc->chars;
}
-
-#endif
OpenPOWER on IntegriCloud